unity_art_puzzle_playable_luna/5.5.0/engine/luna/script1.js

1 line
699 KiB
JavaScript

if(window.Bridge.property=function(e,t,s,i,n,r){const a={enumerable:!r,configurable:!0};if(s&&s.get&&(a.get=s.get),s&&s.set&&(a.set=s.set),!s||!s.get&&!s.set){const e=Bridge.getTypeAlias(n)+"$"+t;n.$init=n.$init||{},i&&(n.$init[e]=s),function(e,t,s,i){e.get=function(){const e=this.$init[s];return void 0===e?i:e},e.set=function(e){this.$init[s]=e}}(a,0,e,s)}const o=[t],h=n.$descriptors||[];for(let e=0;e<h.length;e++){const s=h[e];if(s.name===t)for(let e=0;e<h.length;e++){const t=h[e];t.get===s.get&&t.set===s.set&&(-1===o.indexOf(t.name)&&o.push(t.name))}}for(const t of o)Object.defineProperty(e,t,a),e["get"+t]=e["get"+t]||a.get,e["set"+t]=e["set"+t]||a.set;return a},DEVELOP){const e=window.Error;window.Error=function(...t){const s=new e(...t);return pc.Debugger&&pc.Debugger.Console.exception(s,{},2),s},Object.setPrototypeOf(window.Error,e),window.Error.prototype=Object.create(e.prototype)}window.pc={};let onBox2DLoaded=null;pc.waitForBox2D=new Promise((e=>{onBox2DLoaded=e})),"undefined"!=typeof Box2D?window.Box2D().then(onBox2DLoaded):onBox2DLoaded(null),pc.waitForBox2D.then((e=>{window.box2d=e}));let onMecanimLoaded=null;pc.waitForMecanim=new Promise((e=>{onMecanimLoaded=e})),"undefined"!=typeof Mecanim?window.Mecanim().then(onMecanimLoaded):onMecanimLoaded(null),pc.waitForMecanim.then((e=>{window.mecanim=e})),window.performance||(window.performance={now:()=>Date.now()}),window.performance.now||(window.performance.now=()=>Date.now()),(()=>{const e={1593909819:0,"-499022955":-1};if(!e.hasOwnProperty(-499022955)){const e=Object.prototype.hasOwnProperty;Object.prototype.hasOwnProperty=function(...t){return e.call(this,String(t[0]))}}})(),Array.prototype.values||(Array.prototype.values=Array.prototype[Symbol.iterator]),(()=>{"use strict";var e,t={},s={};function i(e){var n=s[e];if(void 0!==n)return n.exports;var r=s[e]={exports:{}};return t[e](r,r.exports,i),r.exports}i.m=t,e=[],i.O=(t,s,n,r)=>{if(!s){var a=1/0;for(c=0;c<e.length;c++){for(var[s,n,r]=e[c],o=!0,h=0;h<s.length;h++)(!1&r||a>=r)&&Object.keys(i.O).every((e=>i.O[e](s[h])))?s.splice(h--,1):(o=!1,r<a&&(a=r));if(o){e.splice(c--,1);var l=n();void 0!==l&&(t=l)}}return t}r=r||0;for(var c=e.length;c>0&&e[c-1][2]>r;c--)e[c]=e[c-1];e[c]=[s,n,r]},i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={0:0};i.O.j=t=>0===e[t];var t=(t,s)=>{var n,r,[a,o,h]=s,l=0;if(a.some((t=>0!==e[t]))){for(n in o)i.o(o,n)&&(i.m[n]=o[n]);if(h)var c=h(i)}for(t&&t(s);l<a.length;l++)r=a[l],i.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return i.O(c)},s=self.webpackChunkluna=self.webpackChunkluna||[];s.forEach(t.bind(null,0)),s.push=t.bind(null,s.push.bind(s))})()})(),(self.webpackChunkluna=self.webpackChunkluna||[]).push([[1],[(e,t,s)=>{"use strict";s.d(t,{a:()=>B.a,b:()=>Q,c:()=>J,d:()=>U.a,e:()=>i.a,f:()=>$,g:()=>B.b,h:()=>c,i:()=>A,j:()=>C,k:()=>i.b,l:()=>r,m:()=>R,n:()=>y,o:()=>i.c,p:()=>i.g,q:()=>Y,r:()=>i.i});var i=s(4);const n={tmpVec21:null,tmpVec22:null,diff:null};class r{constructor(e=0,t=0){this.x=e,this.y=t,this._data=null,DEBUG&&d(this),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"Vec2")}add(e){return DEBUG&&d(e),this.x+=e.x,this.y+=e.y,DEBUG&&d(this),this}add2(e,t){return DEBUG&&(d(e),d(t)),this.x=e.x+t.x,this.y=e.y+t.y,this}clone(){return(new r).copy(this)}copy(e){return DEBUG&&d(e),this.x=e.x,this.y=e.y,this}dot(e){return DEBUG&&d(e),this.x*e.x+this.y*e.y}equals(e){const t=n.diff;return t.x=this.x-e.x,t.y=this.y-e.y,t.lengthSq()<999999943962493e-25}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSq(){return this.x*this.x+this.y*this.y}lerp(e,t,s){return DEBUG&&(d(e),d(t)),s=(0,i.c)(s,0,1),this.x=e.x+s*(t.x-e.x),this.y=e.y+s*(t.y-e.y),DEBUG&&d(this),this}lerpUnclamped(e,t,s){return DEBUG&&(d(e),d(t)),this.x=e.x+s*(t.x-e.x),this.y=e.y+s*(t.y-e.y),DEBUG&&d(this),this}mul(e){return DEBUG&&d(e),this.x*=e.x,this.y*=e.y,DEBUG&&d(this),this}mul2(e,t){return DEBUG&&(d(t),d(e)),this.x=e.x*t.x,this.y=e.y*t.y,DEBUG&&d(this),this}normalize(){const e=this.x*this.x+this.y*this.y;if(e>0){const t=1/Math.sqrt(e);this.x*=t,this.y*=t}return DEBUG&&d(this),this}scale(e){return this.x*=e,this.y*=e,DEBUG&&d(this),this}set(e,t){return this.x=e,this.y=t,DEBUG&&d(this),this}sub(e){return DEBUG&&d(e),this.x-=e.x,this.y-=e.y,DEBUG&&d(this),this}sub2(e,t){return DEBUG&&(d(e),d(t)),this.x=e.x-t.x,this.y=e.y-t.y,this}toString(){return"["+this.x+", "+this.y+"]"}setFromMax(e,t){return e>this.x&&(this.x=e),t>this.y&&(this.y=t),DEBUG&&d(this),this}strictEquals(e){return e instanceof r&&this.equals(e)}div(e){return this.x/=e.x,this.y/=e.y,DEBUG&&d(this),this}$getType(){return r}getitem(e){switch(e){case 0:return this.x;case 1:return this.y;default:return NaN}}iget(e){return this.getitem(e)}setitem(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t}DEBUG&&d(this)}iset(e,t){this.setitem(e,t)}getHashCode(){return this.x^this.y}hash(){return this.getHashCode()}$clone(e=new r){return e.copy(this),e}fromVector3(e){return this.x=e.x,this.y=e.y,DEBUG&&d(this),this}fromVector4(e){return this.x=e.x,this.y=e.y,DEBUG&&d(this),this}get data(){return this._data||(this._data=new Float32Array(2)),this._data[0]=this.x,this._data[1]=this.y,this._data}}n.tmpVec21=new r,n.tmpVec22=new r,n.diff=new r,r.ctor=r,r.$kind="struct",r.kEpsilon=1e-5,r.kEpsilonNormalSqrt=1e-15,r.angle=(e,t)=>{const{tmpVec21:s,tmpVec22:r}=n;return DEBUG&&(d(e),d(t)),s.copy(e).normalize(),r.copy(t).normalize(),Math.acos((0,i.c)(s.dot(r),-1,1))*i.b},r.signedAngle=(e,t)=>r.angle(e,t)*(0,i.k)(e.x*t.y-e.y*t.x),r.lengthClamp=(e,t)=>(DEBUG&&d(e),e.lengthSq()>t*t?e.clone().normalize().scale(t):e.clone()),r.reflect=(e,t)=>{DEBUG&&(d(e),d(t));const{tmpVec21:s}=n;s.copy(t);const i=-2*s.dot(e);return s.scale(i),s.add(e).clone()},r.moveTowards=(e,t,s)=>{DEBUG&&(d(e),d(t));const i=n.tmpVec21.copy(t).sub(e),r=i.length();return r<=s||r<1401298e-51?t.clone():e.clone().add(i.scale(1/r*s))},r.smoothDamp=(e,t,s,i,n,a)=>{DEBUG&&(d(e),d(t));const o=2/(i=Math.max(1e-4,i)),h=o*a,l=1/(1+h+.479999989271164*h*h+.234999999403954*h*h*h),c=e.clone().sub(t.clone()),u=t.clone(),_=n*i,m=r.lengthClamp(c.clone(),_);t=e.clone().sub(m.clone());const p=s.v.clone().add(m.clone().scale(o)).scale(a);s.v=s.v.clone().sub(p.clone().scale(o)).scale(l);let g=t.clone().add(m.clone().add(p.clone()).scale(l));return u.clone().sub(e.clone()).dot(g.clone().sub(u.clone()))>0&&(g=u.clone(),s.v=g.clone().sub(u.clone()).scale(1/a)),g.clone()},r.equals=(e,t)=>null===e&&null===t||e&&t&&e.equals(t),r.getDefaultValue=()=>new r,r.FromVector3=e=>new r(e.x,e.y),r.FromVector4=e=>new r(e.x,e.y);const a=new r(1,1);a._data=new Float32Array(2),Object.freeze(a),r.ONE=a;const o=new r(1,0);o._data=new Float32Array(2),Object.freeze(o),r.RIGHT=o;const h=new r(0,1);h._data=new Float32Array(2),Object.freeze(h),r.UP=h;const l=new r(0,0);l._data=new Float32Array(2),Object.freeze(l),r.ZERO=l;class c{constructor(){const e=new Float32Array(9);e[0]=e[4]=e[8]=1,this.data=e,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"Mat3")}clone(){return(new c).copy(this)}copy(e){DEBUG&&m(e);const t=e.data,s=this.data;return s[0]=t[0],s[1]=t[1],s[2]=t[2],s[3]=t[3],s[4]=t[4],s[5]=t[5],s[6]=t[6],s[7]=t[7],s[8]=t[8],this}set(e){const t=this.data;return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],DEBUG&&m(this),this}setFromEulerAngles(e,t,s){const i=this.data,n=Math.sin(e),r=Math.cos(e),a=Math.sin(t),o=Math.cos(t),h=Math.sin(s),l=Math.cos(s);i[0]=o*l,i[1]=r*h+l*n*a,i[2]=n*h-r*l*a,i[3]=-o*h,i[4]=r*l-n*a*h,i[5]=l*n+r*a*h,i[6]=a,i[7]=-o*n,i[8]=r*o}equals(e){DEBUG&&(m(e),m(this));const t=this.data,s=e.data;return t[0]===s[0]&&t[1]===s[1]&&t[2]===s[2]&&t[3]===s[3]&&t[4]===s[4]&&t[5]===s[5]&&t[6]===s[6]&&t[7]===s[7]&&t[8]===s[8]}isIdentity(){const e=this.data;return 1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&1===e[4]&&0===e[5]&&0===e[6]&&0===e[7]&&1===e[8]}setIdentity(){const e=this.data;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,this}toString(){let e="[";for(let t=0;t<9;t++)e+=this.data[t],e+=9!==t?", ":"";return e+="]",e}transpose(){const e=this.data;let t;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,DEBUG&&m(this),this}transformVector(e,t=new R){DEBUG&&u(e);const s=this.data,i=e.x,n=e.y,r=e.z;return t.x=i*s[0]+n*s[3]+r*s[6],t.y=i*s[1]+n*s[4]+r*s[7],t.z=i*s[2]+n*s[5]+r*s[8],DEBUG&&u(t),t}}function d(e){if(!DEBUG)return;const t=e instanceof r,s="number"==typeof e.x&&"number"==typeof e.y,i=!Number.isNaN(e.x)&&!Number.isNaN(e.y),n=t&&i&&s;if(console.assert(n),TESTS&&!n)throw new Error("Vec2 consistency check failed")}function u(e){if(!DEBUG)return;const t=e instanceof R,s="number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.z,i=!Number.isNaN(e.x)&&!Number.isNaN(e.y)&&!Number.isNaN(e.z),n=t&&i&&s;if(console.assert(n),TESTS&&!n)throw new Error("Vec3 consistency check failed")}function _(e){if(!DEBUG)return;const t=e instanceof y,s="number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.z&&"number"==typeof e.w,i=!(Number.isNaN(e.x)||Number.isNaN(e.y)||Number.isNaN(e.z)||Number.isNaN(e.w)),n=t&&i&&s;if(console.assert(n),TESTS&&!n)throw new Error("Vec4 consistency check failed")}function m(e){if(!DEBUG)return;const t=e instanceof c,s=e.data.every((e=>"number"==typeof e)),i=e.data.every((e=>!Number.isNaN(e))),n=t&&i&&s;if(console.assert(n),TESTS&&!n)throw new Error("Mat3 consistency check failed")}function p(e){if(!DEBUG)return;const t=e instanceof A,s=e.data.every((e=>"number"==typeof e)),i=e.data.every((e=>!Number.isNaN(e))),n=t&&i&&s;if(console.assert(n),TESTS&&!n)throw new Error("Mat4 consistency check failed")}function g(e){if(!DEBUG)return;const t=e instanceof C,s="number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.z&&"number"==typeof e.w,i=!(Number.isNaN(e.x)||Number.isNaN(e.y)||Number.isNaN(e.z)||Number.isNaN(e.w)),n=t&&i&&s;if(console.assert(n),TESTS&&!n)throw new Error("Quat consistency check failed")}c.IDENTITY=Object.freeze(new c),c.ZERO=Object.freeze((new c).set([0,0,0,0,0,0,0,0,0]));const f={tmpVec41:null,diff:null};class y{constructor(e=0,t=0,s=0,i=0){this.x=e,this.y=t,this.z=s,this.w=i,this._data=null,DEBUG&&_(this),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"Vec4")}add(e){return DEBUG&&_(e),this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,DEBUG&&_(this),this}add2(e,t){return DEBUG&&(_(t),_(e)),this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,DEBUG&&_(this),this}clone(){return(new y).copy(this)}copy(e){return DEBUG&&_(e),this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}dot(e){return DEBUG&&_(e),this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}equals(e){const t=f.diff;return t.x=this.x-e.x,t.y=this.y-e.y,t.z=this.z-e.z,t.w=this.w-e.w,t.lengthSq()<999999943962493e-25}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}lerp(e,t,s){return DEBUG&&(_(e),_(t)),this.x=e.x+s*(t.x-e.x),this.y=e.y+s*(t.y-e.y),this.z=e.z+s*(t.z-e.z),this.w=e.w+s*(t.w-e.w),DEBUG&&_(this),this}mul(e){return DEBUG&&_(e),this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,DEBUG&&_(this),this}mul2(e,t){return DEBUG&&(_(e),_(t)),this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this.w=e.w*t.w,DEBUG&&_(this),this}normalize(){const e=this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w;if(e>0){const t=1/Math.sqrt(e);this.x*=t,this.y*=t,this.z*=t,this.w*=t}return DEBUG&&_(this),this}scale(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,DEBUG&&_(this),this}set(e,t,s,i){return this.x=e,this.y=t,this.z=s,this.w=i,DEBUG&&_(this),this}setFromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],DEBUG&&_(this),this}sub(e){return DEBUG&&_(e),this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,DEBUG&&_(this),this}sub2(e,t){return DEBUG&&(_(t),_(e)),this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}toString(){return"["+this.x+", "+this.y+", "+this.z+", "+this.w+"]"}project(e){DEBUG&&_(e);const t=(this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w)/(e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w);return this.x=e.x*t,this.y=e.y*t,this.z=e.z*t,this.w=e.w*t,DEBUG&&_(this),this}getitem(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:return NaN}}iget(e){return this.getitem(e)}setitem(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t}DEBUG&&_(this)}iset(e,t){this.setitem(e,t)}strictEquals(e){return e instanceof y&&this.equals(e)}lerpUnclamped(e,t,s){return DEBUG&&(_(e),_(t)),this.x=e.x+s*(t.x-e.x),this.y=e.y+s*(t.y-e.y),this.z=e.z+s*(t.z-e.z),this.w=e.w+s*(t.w-e.w),DEBUG&&_(this),this}hash(){return this.x^this.y^this.z^this.w}getHashCode(){return this.hash()}fromVector2(e){return this.x=e.x,this.y=e.y,this.z=0,this.w=0,DEBUG&&_(this),this}fromVector3(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=0,DEBUG&&_(this),this}$getType(){return y}$clone(e=new y){return e.copy(this),e}get data(){return this._data||(this._data=new Float32Array(4)),this._data[0]=this.x,this._data[1]=this.y,this._data[2]=this.z,this._data[3]=this.w,this._data}}f.tmpVec41=new y,f.diff=new y,y.ctor=y,y.$kind="struct",y.distance=(e,t)=>f.tmpVec41.copy(e).sub(t).length(),y.moveTowards=(e,t,s)=>{DEBUG&&(_(e),_(t));const i=f.tmpVec41.copy(t).sub(e),n=i.length();return n<=s||n<1401298e-51?t.clone():e.clone().add(i.scale(1/n*s))},y.equals=(e,t)=>null===e&&null===t||null!==e&&null!==t&&e.equals(t),y.getDefaultValue=()=>new y,y.FromVector2=e=>new y(e.x,e.y,0,0),y.FromVector3=e=>new y(e.x,e.y,e.z,0);const E=new y(1,1,1,1);E._data=new Float32Array(4),Object.freeze(E),y.ONE=E;const T=new y(0,0,0,0);T._data=new Float32Array(4),Object.freeze(T),y.ZERO=T;const S={_tmpVec31:null,_tmpVec32:null,_tmpVec33:null,_tmpQuat1:null,_tmpQuat2:null,get tmpVec31(){return this._tmpVec31=this._tmpVec31||new R,this._tmpVec31},get tmpVec32(){return this._tmpVec32=this._tmpVec32||new R,this._tmpVec32},get tmpVec33(){return this._tmpVec33=this._tmpVec33||new R,this._tmpVec33},get tmpQuat1(){return this._tmpQuat1=this._tmpQuat1||new C,this._tmpQuat1},get tmpQuat2(){return this._tmpQuat2=this._tmpQuat2||new C,this._tmpQuat2}};class A{constructor(){this.data=new Float32Array(16),this.data[0]=this.data[5]=this.data[10]=this.data[15]=1,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"Mat4")}add2(e,t){DEBUG&&(p(e),p(t));const s=e.data,i=t.data,n=this.data;return n[0]=s[0]+i[0],n[1]=s[1]+i[1],n[2]=s[2]+i[2],n[3]=s[3]+i[3],n[4]=s[4]+i[4],n[5]=s[5]+i[5],n[6]=s[6]+i[6],n[7]=s[7]+i[7],n[8]=s[8]+i[8],n[9]=s[9]+i[9],n[10]=s[10]+i[10],n[11]=s[11]+i[11],n[12]=s[12]+i[12],n[13]=s[13]+i[13],n[14]=s[14]+i[14],n[15]=s[15]+i[15],DEBUG&&p(this),this}add(e){return DEBUG&&p(e),this.add2(this,e)}clone(){return(new A).copy(this)}copy(e){DEBUG&&p(e);const t=e.data,s=this.data;return s[0]=t[0],s[1]=t[1],s[2]=t[2],s[3]=t[3],s[4]=t[4],s[5]=t[5],s[6]=t[6],s[7]=t[7],s[8]=t[8],s[9]=t[9],s[10]=t[10],s[11]=t[11],s[12]=t[12],s[13]=t[13],s[14]=t[14],s[15]=t[15],this}equals(e){DEBUG&&(p(e),p(this));const t=this.data,s=e.data;return t[0]===s[0]&&t[1]===s[1]&&t[2]===s[2]&&t[3]===s[3]&&t[4]===s[4]&&t[5]===s[5]&&t[6]===s[6]&&t[7]===s[7]&&t[8]===s[8]&&t[9]===s[9]&&t[10]===s[10]&&t[11]===s[11]&&t[12]===s[12]&&t[13]===s[13]&&t[14]===s[14]&&t[15]===s[15]}isIdentity(){DEBUG&&p(this);const e=this.data;return 1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]}mul2(e,t){let s,i,n,r;DEBUG&&(p(e),p(t));const a=e.data,o=t.data,h=this.data,l=a[0],c=a[1],d=a[2],u=a[3],_=a[4],m=a[5],g=a[6],f=a[7],y=a[8],E=a[9],T=a[10],S=a[11],A=a[12],b=a[13],C=a[14],w=a[15];return s=o[0],i=o[1],n=o[2],r=o[3],h[0]=l*s+_*i+y*n+A*r,h[1]=c*s+m*i+E*n+b*r,h[2]=d*s+g*i+T*n+C*r,h[3]=u*s+f*i+S*n+w*r,s=o[4],i=o[5],n=o[6],r=o[7],h[4]=l*s+_*i+y*n+A*r,h[5]=c*s+m*i+E*n+b*r,h[6]=d*s+g*i+T*n+C*r,h[7]=u*s+f*i+S*n+w*r,s=o[8],i=o[9],n=o[10],r=o[11],h[8]=l*s+_*i+y*n+A*r,h[9]=c*s+m*i+E*n+b*r,h[10]=d*s+g*i+T*n+C*r,h[11]=u*s+f*i+S*n+w*r,s=o[12],i=o[13],n=o[14],r=o[15],h[12]=l*s+_*i+y*n+A*r,h[13]=c*s+m*i+E*n+b*r,h[14]=d*s+g*i+T*n+C*r,h[15]=u*s+f*i+S*n+w*r,DEBUG&&p(this),this}mul(e){return DEBUG&&p(e),this.mul2(this,e)}transformPoint(e,t=new R){DEBUG&&u(e);const s=this.data,i=e.x,n=e.y,r=e.z;return t.x=i*s[0]+n*s[4]+r*s[8]+s[12],t.y=i*s[1]+n*s[5]+r*s[9]+s[13],t.z=i*s[2]+n*s[6]+r*s[10]+s[14],DEBUG&&u(t),t}transformPointPerspective(e,t=new R){DEBUG&&u(e),this.transformPoint(e,t);const s=this.data,i=e.x,n=e.y,r=e.z,a=i*s[3]+n*s[7]+r*s[11]+s[15];return Math.abs(a)>1e-7?(t.x/=a,t.y/=a,t.z/=a):(t.x=0,t.y=0,t.z=0),DEBUG&&u(t),t}transformPointInverse(e,t=new R){DEBUG&&u(e);const s=this.data,i=e.x-s[12],n=e.y-s[13],r=e.z-s[14];return t.x=i*s[0]+n*s[1]+r*s[2],t.y=i*s[4]+n*s[5]+r*s[6],t.z=i*s[8]+n*s[9]+r*s[10],DEBUG&&u(t),t}transformVector(e,t=new R){DEBUG&&u(e);const s=this.data,i=e.x,n=e.y,r=e.z;return t.x=i*s[0]+n*s[4]+r*s[8],t.y=i*s[1]+n*s[5]+r*s[9],t.z=i*s[2]+n*s[6]+r*s[10],DEBUG&&u(t),t}transformVec4(e,t=new y){DEBUG&&_(e);const s=this.data,i=e.x,n=e.y,r=e.z,a=e.w;return t.x=i*s[0]+n*s[4]+r*s[8]+a*s[12],t.y=i*s[1]+n*s[5]+r*s[9]+a*s[13],t.z=i*s[2]+n*s[6]+r*s[10]+a*s[14],t.w=i*s[3]+n*s[7]+r*s[11]+a*s[15],DEBUG&&_(t),t}setLookAt(e,t,s){DEBUG&&(u(e),u(t),u(s));const i=S.tmpVec31,n=S.tmpVec32,r=S.tmpVec33;if(r.sub2(t,e),r.length()<1e-6)return this.setIdentity();r.normalize(),n.copy(s).normalize(),i.cross(n,r).normalize(),n.cross(r,i);const a=this.data;return a[0]=i.x,a[1]=i.y,a[2]=i.z,a[3]=0,a[4]=n.x,a[5]=n.y,a[6]=n.z,a[7]=0,a[8]=r.x,a[9]=r.y,a[10]=r.z,a[11]=0,a[12]=e.x,a[13]=e.y,a[14]=e.z,a[15]=1,DEBUG&&p(this),this}setFrustum(e,t,s,i,n,r){const a=2*n,o=t-e,h=i-s,l=r-n,c=this.data;return c[0]=a/o,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=a/h,c[6]=0,c[7]=0,c[8]=-(t+e)/o,c[9]=-(i+s)/h,c[10]=(-r-n)/l,c[11]=-1,c[12]=0,c[13]=0,c[14]=-a*r/l,c[15]=0,DEBUG&&p(this),this}setPerspective(e,t,s,i,n=!1){let r,a;return 0===s&&(s=.01),n?(r=s*Math.tan(e*Math.PI/360),a=r/t):(a=s*Math.tan(e*Math.PI/360),r=a*t),this.setFrustum(-r,r,-a,a,s,i)}setOrtho(e,t,s,i,n,r){const a=this.data;return a[0]=2/(t-e),a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2/(i-s),a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=-2/(r-n),a[11]=0,a[12]=-(t+e)/(t-e),a[13]=-(i+s)/(i-s),a[14]=-(r+n)/(r-n),a[15]=1,DEBUG&&p(this),this}setFromAxisAngle(e,t){DEBUG&&u(e),t*=i.a;const s=e.x,n=e.y,r=e.z,a=Math.cos(t),o=Math.sin(t),h=1-a,l=h*s,c=h*n,d=this.data;return d[0]=l*s+a,d[1]=l*n+o*r,d[2]=l*r-o*n,d[3]=0,d[4]=l*n-o*r,d[5]=c*n+a,d[6]=c*r+o*s,d[7]=0,d[8]=l*r+o*n,d[9]=c*r-s*o,d[10]=h*r*r+a,d[11]=0,d[12]=0,d[13]=0,d[14]=0,d[15]=1,DEBUG&&p(this),this}setTranslate(e,t,s){const i=this.data;return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=e,i[13]=t,i[14]=s,i[15]=1,DEBUG&&p(this),this}setScale(e,t,s){const i=this.data;return i[0]=e,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=t,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=s,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,DEBUG&&p(this),this}setPositionAndOrthoNormalBasis(e,t,s,i){const n=this.data;return n[0]=t.x,n[1]=s.x,n[2]=i.x,n[3]=0,n[4]=t.y,n[5]=s.y,n[6]=i.y,n[7]=0,n[8]=t.z,n[9]=s.z,n[10]=i.z,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,DEBUG&&p(this),this}invert(){const e=this.data,t=e[0],s=e[1],i=e[2],n=e[3],r=e[4],a=e[5],o=e[6],h=e[7],l=e[8],c=e[9],d=e[10],u=e[11],_=e[12],m=e[13],g=e[14],f=e[15],y=t*a-s*r,E=t*o-i*r,T=t*h-n*r,S=s*o-i*a,A=s*h-n*a,b=i*h-n*o,C=l*m-c*_,w=l*g-d*_,x=l*f-u*_,R=c*g-d*m,I=c*f-u*m,M=d*f-u*g,P=y*M-E*I+T*R+S*x-A*w+b*C;if(0===P)this.setIdentity();else{const p=1/P;e[0]=(a*M-o*I+h*R)*p,e[1]=(-s*M+i*I-n*R)*p,e[2]=(m*b-g*A+f*S)*p,e[3]=(-c*b+d*A-u*S)*p,e[4]=(-r*M+o*x-h*w)*p,e[5]=(t*M-i*x+n*w)*p,e[6]=(-_*b+g*T-f*E)*p,e[7]=(l*b-d*T+u*E)*p,e[8]=(r*I-a*x+h*C)*p,e[9]=(-t*I+s*x-n*C)*p,e[10]=(_*A-m*T+f*y)*p,e[11]=(-l*A+c*T-u*y)*p,e[12]=(-r*R+a*w-o*C)*p,e[13]=(t*R-s*w+i*C)*p,e[14]=(-_*S+m*E-g*y)*p,e[15]=(l*S-c*E+d*y)*p}return DEBUG&&p(this),this}set(e){const t=this.data;return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],DEBUG&&p(this),this}setFromArray(e,t=0){const s=this.data;for(let i=0;i<16;i++)s[i]=e[t+i];return DEBUG&&p(this),this}setIdentity(){const e=this.data;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}setTRS(e,t,s){const i=e.x,n=e.y,r=e.z,a=t.x,o=t.y,h=t.z,l=t.w,c=s.x,d=s.y,u=s.z,_=a+a,m=o+o,g=h+h,f=a*_,y=a*m,E=a*g,T=o*m,S=o*g,A=h*g,b=l*_,C=l*m,w=l*g,x=this.data;return x[0]=(1-(T+A))*c,x[1]=(y+w)*c,x[2]=(E-C)*c,x[3]=0,x[4]=(y-w)*d,x[5]=(1-(f+A))*d,x[6]=(S+b)*d,x[7]=0,x[8]=(E+C)*u,x[9]=(S-b)*u,x[10]=(1-(f+T))*u,x[11]=0,x[12]=i,x[13]=n,x[14]=r,x[15]=1,DEBUG&&p(this),this}transpose(){let e;const t=this.data;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,DEBUG&&p(this),this}invertTo3x3(e){const t=this.data,s=e.data,i=t[0],n=t[1],r=t[2],a=t[4],o=t[5],h=t[6],l=t[8],c=t[9],d=t[10],u=d*o-h*c,_=-d*n+r*c,m=h*n-r*o,p=-d*a+h*l,g=d*i-r*l,f=-h*i+r*a,y=c*a-o*l,E=-c*i+n*l,T=o*i-n*a,S=i*u+n*p+r*y;if(0===S)return this;const A=1/S;return s[0]=A*u,s[1]=A*_,s[2]=A*m,s[3]=A*p,s[4]=A*g,s[5]=A*f,s[6]=A*y,s[7]=A*E,s[8]=A*T,this}getTranslation(e=new R){return e.set(this.data[12],this.data[13],this.data[14])}getTranslation4(e=new y){return e.set(this.data[12],this.data[13],this.data[14],0)}getX(e=new R){return e.set(this.data[0],this.data[1],this.data[2])}getY(e=new R){return e.set(this.data[4],this.data[5],this.data[6])}getZ(e=new R){return e.set(this.data[8],this.data[9],this.data[10])}getScale(e=new R){const t=S.tmpVec31,s=S.tmpVec32,i=S.tmpVec33;return this.getX(t),this.getY(s),this.getZ(i),e.set(t.length(),s.length(),i.length()),e}setFromEulerAngles(e,t,s){e*=i.a,t*=i.a,s*=i.a;const n=Math.sin(-e),r=Math.cos(-e),a=Math.sin(-t),o=Math.cos(-t),h=Math.sin(-s),l=Math.cos(-s),c=this.data;return c[0]=o*l,c[1]=-o*h,c[2]=a,c[3]=0,c[4]=r*h+l*n*a,c[5]=r*l-n*a*h,c[6]=-o*n,c[7]=0,c[8]=n*h-r*l*a,c[9]=l*n+r*a*h,c[10]=r*o,c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,DEBUG&&p(this),this}getEulerAngles(e=new R){const t=S.tmpVec31;this.getScale(t);const s=t.x,n=t.y,r=t.z,a=this.data,o=Math.asin(-a[2]/s),h=.5*Math.PI;let l=0,c=0;return o<h?o>-h?(l=Math.atan2(a[6]/n,a[10]/r),c=Math.atan2(a[1]/s,a[0]/s)):(c=0,l=-Math.atan2(a[4]/n,a[5]/n)):(c=0,l=Math.atan2(a[4]/n,a[5]/n)),e.set(l,o,c).scale(i.b)}toString(){let e,t;for(t="[",e=0;e<16;e+=1)t+=this.data[e],t+=15!==e?", ":"";return t+="]",t}setColumn(e,t){return DEBUG&&_(t),this.data[4*e]=t.x,this.data[4*e+1]=t.y,this.data[4*e+2]=t.z,this.data[4*e+3]=t.w,DEBUG&&p(this),this}getColumn(e){switch(e){case 0:return new y(this.data[0],this.data[1],this.data[2],this.data[3]);case 1:return new y(this.data[4],this.data[5],this.data[6],this.data[7]);case 2:return new y(this.data[8],this.data[9],this.data[10],this.data[11]);case 3:return new y(this.data[12],this.data[13],this.data[14],this.data[15]);default:return null}}getRow(e){switch(e){case 0:return new y(this.data[0],this.data[4],this.data[8],this.data[12]);case 1:return new y(this.data[1],this.data[5],this.data[9],this.data[13]);case 2:return new y(this.data[2],this.data[6],this.data[10],this.data[14]);case 3:return new y(this.data[3],this.data[7],this.data[11],this.data[15]);default:return null}}scale(e){for(let t=0;t<16;t++)this.data[t]*=e;DEBUG&&p(this)}determinant(){const e=this.data,t=e[0],s=e[1],i=e[2],n=e[3],r=e[4],a=e[5],o=e[6],h=e[7],l=e[8],c=e[9],d=e[10],u=e[11],_=e[12],m=e[13],p=e[14],g=e[15];return(t*a-s*r)*(d*g-u*p)-(t*o-i*r)*(c*g-u*m)+(t*h-n*r)*(c*p-d*m)+(s*o-i*a)*(l*g-u*_)-(s*h-n*a)*(l*p-d*_)+(i*h-n*o)*(l*m-c*_)}getRotation(e=new C){return e.setFromMat4(this),e}multiplyInverse(e){DEBUG&&p(e);const t=S.tmpVec31,s=S.tmpVec32,i=S.tmpQuat1,n=S.tmpQuat2;n.setFromMat4(this).conjugate(),i.setFromMat4(e),e.getTranslation(s),this.getTranslation(t),s.sub(t),n.transformVector(s,s),n.mul(i),this.setTRS(s,n,R.ONE),DEBUG&&p(this)}transformVectorInverse(e,t=new R){DEBUG&&u(e);const s=S.tmpQuat1,i=S.tmpVec31;return s.setFromMat4(this),this.getTranslation(i),t.sub2(e,i),s.transformVectorInverse(t,t),t}setRotation(e){return DEBUG&&g(e),this.setTRS(R.ZERO,e,R.ONE)}setTranslation(e){DEBUG&&u(e);const t=this.data;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this}setPerspective_Unity(e,t,s,i,n=!1){return this.setPerspective(e,t,s,i,n),this.data[8]*=-1,this.data[9]*=-1,this.data[10]*=-1,this.data[11]*=-1,this}multiplyPoint(e,t=new R){DEBUG&&u(e);const s=this.data,i=e.x,n=e.y,r=e.z;t.x=i*s[0]+n*s[4]+r*s[8]+s[12],t.y=i*s[1]+n*s[5]+r*s[9]+s[13],t.z=i*s[2]+n*s[6]+r*s[10]+s[14];const a=1/(i*s[3]+n*s[7]+r*s[11]+s[15]);return t.scale(a),DEBUG&&u(t),t}setData(e,t,s,i,n,r,a,o,h,l,c,d,u,_,m,g){return this.data[0]=e,this.data[1]=t,this.data[2]=s,this.data[3]=i,this.data[4]=n,this.data[5]=r,this.data[6]=a,this.data[7]=o,this.data[8]=h,this.data[9]=l,this.data[10]=c,this.data[11]=d,this.data[12]=u,this.data[13]=_,this.data[14]=m,this.data[15]=g,DEBUG&&p(this),this}validTRS(){return!(Math.abs(this.data[3])>1e-5||Math.abs(this.data[7])>1e-5||Math.abs(this.data[11])>1e-5||Math.abs(this.data[15]-1)>1e-5)&&Math.abs(this.determinant())>=1e-5}decomposeProjection(){const e=new UnityEngine.FrustumPlanes.ctor;return e.zFar=(this.data[15]-this.data[14])/(this.data[11]-this.data[10]),e.zNear=(this.data[15]+this.data[14])/(this.data[11]+this.data[10]),e.left=(this.data[11]+this.data[8])/(this.data[3]+this.data[0])*e.zNear,e.right=(this.data[11]-this.data[8])/(this.data[3]-this.data[0])*e.zNear,e.top=(this.data[11]-this.data[9])/(this.data[7]-this.data[5])*e.zNear,e.bottom=(this.data[11]+this.data[9])/(this.data[7]+this.data[5])*e.zNear,e}transformPlane(e){const t=this.clone().invert(),s=e.normal.x,i=e.normal.y,n=e.normal.z,r=e.distance;return new UnityEngine.Plane.$ctor1(new R(t.e00*s+t.e10*i+t.e20*n+t.e30*r,t.e01*s+t.e11*i+t.e21*n+t.e31*r,t.e02*s+t.e12*i+t.e22*n+t.e32*r),t.e03*s+t.e13*i+t.e23*n+t.e33*r)}strictEquals(e){return e instanceof A&&this.equals(e)}$clone(e=new A){return e.copy(this),e}equalsWithEpsilon(e,t=1e-6){const s=this.data,i=e.data;for(let e=0;e<16;e++)if(Math.abs(s[e]-i[e])>=t)return!1;return!0}get e00(){return this.data[0]}set e00(e){this.data[0]=e}get e10(){return this.data[1]}set e10(e){this.data[1]=e}get e20(){return this.data[2]}set e20(e){this.data[2]=e}get e30(){return this.data[3]}set e30(e){this.data[3]=e}get e01(){return this.data[4]}set e01(e){this.data[4]=e}get e11(){return this.data[5]}set e11(e){this.data[5]=e}get e21(){return this.data[6]}set e21(e){this.data[6]=e}get e31(){return this.data[7]}set e31(e){this.data[7]=e}get e02(){return this.data[8]}set e02(e){this.data[8]=e}get e12(){return this.data[9]}set e12(e){this.data[9]=e}get e22(){return this.data[10]}set e22(e){this.data[10]=e}get e32(){return this.data[11]}set e32(e){this.data[11]=e}get e03(){return this.data[12]}set e03(e){this.data[12]=e}get e13(){return this.data[13]}set e13(e){this.data[13]=e}get e23(){return this.data[14]}set e23(e){this.data[14]=e}get e33(){return this.data[15]}set e33(e){this.data[15]=e}get singular(){return 0===this.determinant()}getitem(e){return this.data[e]}iget(e){return this.getitem(e)}setitem(e,t){this.data[e]=t}iset(e,t){this.setitem(e,t)}getitem$1(e,t){return this.data[e+4*t]}ijget(e,t){return this.getitem$1(e,t)}setitem$1(e,t,s){this.data[e+4*t]=s}ijset(e,t,s){this.setitem$1(e,t,s)}getHashCode(){let e=this.data[0];for(let t=0;t<this.data.length;t++)e^=this.data[t];return e}hash(){return this.getHashCode()}}A.ctor=A,A.$kind="struct",A.fromArray=e=>{const t=new A;return t.data=e,DEBUG&&p(t),t},A.getDefaultValue=()=>new A,A.mat3FromMat4=(e,t)=>{e.data[0]=t.data[0],e.data[1]=t.data[1],e.data[2]=t.data[2],e.data[3]=t.data[4],e.data[4]=t.data[5],e.data[5]=t.data[6],e.data[6]=t.data[8],e.data[7]=t.data[9],e.data[8]=t.data[10]},A.inverse3DAffine=(e,t)=>{t.v=e.clone().invert()},A.setFrustumUnity=(e,t,s,i,n,r)=>{const a=2*n,o=t-e,h=i-s,l=n-r,c=new A;return c.data[0]=a/o,c.data[1]=0,c.data[2]=0,c.data[3]=0,c.data[4]=0,c.data[5]=a/h,c.data[6]=0,c.data[7]=0,c.data[8]=(t+e)/o,c.data[9]=(i+s)/h,c.data[10]=(r+n)/l,c.data[11]=-1,c.data[12]=0,c.data[13]=0,c.data[14]=a*r/l,c.data[15]=0,c},A.setLookAtUnity=(e,t,s)=>{DEBUG&&(u(e),u(t),u(s));const i=new A,n=new R,r=new R,a=new R;if(a.sub2(t,e),a.length()<1e-6)return i.setIdentity();a.normalize(),r.copy(s).normalize(),n.cross(r,a).normalize(),r.cross(a,n),i.data[0]=-n.x,i.data[1]=n.y,i.data[2]=-n.z,i.data[3]=0,i.data[4]=r.x,i.data[5]=r.y,i.data[6]=r.z,i.data[7]=0,i.data[8]=-a.x,i.data[9]=-a.y,i.data[10]=-a.z,i.data[11]=0,i.data[12]=e.x,i.data[13]=e.y,i.data[14]=e.z,i.data[15]=1,DEBUG&&p(void 0)},A.equals=(e,t)=>null===e&&null===t||null!==e&&null!==t&&e.equals(t),A.IDENTITY=Object.freeze(new A),A.ZERO=Object.freeze((new A).set([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]));const b={_tmpVec31:null,_tmpVec32:null,_tmpVec33:null,get tmpVec31(){return this._tmpVec31=this._tmpVec31||new R,this._tmpVec31},get tmpVec32(){return this._tmpVec32=this._tmpVec32||new R,this._tmpVec32},get tmpVec33(){return this._tmpVec33=this._tmpVec33||new R,this._tmpVec33}};class C{constructor(e=0,t=0,s=0,i=1){this.x=e,this.y=t,this.z=s,this.w=i,DEBUG&&g(this),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"Quat")}clone(){return new C(this.x,this.y,this.z,this.w)}conjugate(){return this.x*=-1,this.y*=-1,this.z*=-1,this}copy(e){return DEBUG&&g(e),this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}equals(e){return this.dot(e)>.999998986721039}dot(e){return DEBUG&&(g(e),g(this)),this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}negate(){return this.x*=-1,this.y*=-1,this.z*=-1,this.w*=-1,this}transformVectorInverse(e,t=new R){DEBUG&&u(e);const s=2*e.x,i=2*e.y,n=2*e.z,r=this.w*this.w-.5,a=this.x*s+this.y*i+this.z*n;return t.x=s*r-(this.y*n-this.z*i)*this.w+this.x*a,t.y=i*r-(this.z*s-this.x*n)*this.w+this.y*a,t.z=n*r-(this.x*i-this.y*s)*this.w+this.z*a,DEBUG&&u(t),t}extractAxes(e,t,s){const i=this.x,n=this.y,r=this.z,a=this.w,o=i+i,h=n+n,l=r+r,c=o*i,d=h*n,_=l*r,m=o*n,p=o*r,g=o*a,f=h*r,y=h*a,E=l*a;e.set(1-d-_,m+E,p-y),t.set(m-E,1-c-_,f+g),s.set(p+y,f-g,1-c-d),DEBUG&&(u(e),u(t),u(s))}getAxisAngle(e){let t=2*Math.acos(this.w);const s=Math.sin(t/2);return 0!==s?(e.x=this.x/s,e.y=this.y/s,e.z=this.z/s,(e.x<0||e.y<0||e.z<0)&&(e.x*=-1,e.y*=-1,e.z*=-1,t*=-1)):(e.x=1,e.y=0,e.z=0),t*i.b}getEulerAngles(e=new R){let t,s,n;const r=this.x,a=this.y,o=this.z,h=this.w,l=2*(h*a-r*o);return l<=-.99999?(t=2*Math.atan2(r,h),s=-Math.PI/2,n=0):l>=.99999?(t=2*Math.atan2(r,h),s=Math.PI/2,n=0):(t=Math.atan2(2*(h*r+a*o),1-2*(r*r+a*a)),s=Math.asin(l),n=Math.atan2(2*(h*o+r*a),1-2*(a*a+o*o))),e.set(t,s,n).scale(i.b)}getUnityEulerAngles(){const e=new A,t=new R,s=new R(1,0,0),n=new R(0,1,0),r=new R(0,0,1);this.transformVector(s,s),this.transformVector(n,n),this.transformVector(r,r),e.data[0]=s.x,e.data[1]=s.y,e.data[2]=s.z,e.data[4]=n.x,e.data[5]=n.y,e.data[6]=n.z,e.data[8]=r.x,e.data[9]=r.y,e.data[10]=r.z,e.data[15]=1;const a=e.data,o=a[0],h=a[8],l=a[1],c=a[5],d=a[9],u=a[2],_=a[10];return t.x=Math.asin(-(0,i.c)(d,-1,1)),Math.abs(d)<.99999?(t.y=Math.atan2(h,_),t.z=Math.atan2(l,c)):(t.y=Math.atan2(-u,o),t.z=0),t.scale(i.b),t}invert(){return this.conjugate().normalize()}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}mul(e){DEBUG&&g(e);const t=this.x,s=this.y,i=this.z,n=this.w,r=e.x,a=e.y,o=e.z,h=e.w;return this.x=n*r+t*h+s*o-i*a,this.y=n*a+s*h+i*r-t*o,this.z=n*o+i*h+t*a-s*r,this.w=n*h-t*r-s*a-i*o,DEBUG&&g(this),this}mul2(e,t){DEBUG&&(g(e),g(t));const s=e.x,i=e.y,n=e.z,r=e.w,a=t.x,o=t.y,h=t.z,l=t.w;return this.x=r*a+s*l+i*h-n*o,this.y=r*o+i*l+n*a-s*h,this.z=r*h+n*l+s*o-i*a,this.w=r*l-s*a-i*o-n*h,DEBUG&&g(this),this}nearest(e,t=new C){const s=(this.x-e.x)*(this.x-e.x)+(this.y-e.y)*(this.y-e.y)+(this.z-e.z)*(this.z-e.z)+(this.w-e.w)*(this.w-e.w),i=(this.x+e.x)*(this.x+e.x)+(this.y+e.y)*(this.y+e.y)+(this.z+e.z)*(this.z+e.z)+(this.w+e.w)*(this.w+e.w);return t.copy(e),s>i&&(t.x*=-1,t.y*=-1,t.z*=-1,t.w*=-1),DEBUG&&g(t),t}normalize(){let e=this.length();return 0===e?(this.x=this.y=this.z=0,this.w=1):(e=1/e,this.x*=e,this.y*=e,this.z*=e,this.w*=e),DEBUG&&g(this),this}set(e,t,s,i){return this.x=e,this.y=t,this.z=s,this.w=i,DEBUG&&g(this),this}fromTo(e,t){const{tmpVec31:s,tmpVec32:i}=b;s.copy(e).normalize(),i.copy(t).normalize();const n=this.fromToRotation(s,i);return this.set(n.x,n.y,n.z,n.w),this}setFromAxisAngle(e,t){const{tmpVec31:s}=b;if(e.equalsWithEpsilon(R.ZERO))return this.x=0,this.y=0,this.z=0,this.w=1,this;t*=.5*i.a,s.copy(e).normalize();const n=Math.sin(t),r=Math.cos(t);return this.x=n*s.x,this.y=n*s.y,this.z=n*s.z,this.w=r,DEBUG&&g(this),this}setFromEulerAngles(e,t,s){const n=.5*i.a;e*=n,t*=n,s*=n;const r=Math.sin(e),a=Math.cos(e),o=Math.sin(t),h=Math.cos(t),l=Math.sin(s),c=Math.cos(s);return this.x=r*h*c-a*o*l,this.y=a*o*c+r*h*l,this.z=a*h*l-r*o*c,this.w=a*h*c+r*o*l,DEBUG&&g(this),this}setFromMat4(e){let t,s,i=e.data[0],n=e.data[1],r=e.data[2],a=e.data[4],o=e.data[5],h=e.data[6],l=e.data[8],c=e.data[9],d=e.data[10],u=1/Math.sqrt(i*i+n*n+r*r),_=1/Math.sqrt(a*a+o*o+h*h),m=1/Math.sqrt(l*l+c*c+d*d);u=Number.isFinite(u)?u:1,_=Number.isFinite(_)?_:1,m=Number.isFinite(m)?m:1,i*=u,n*=u,r*=u,a*=_,o*=_,h*=_,l*=m,c*=m,d*=m;const p=i+o+d;return p>=0?(t=Math.sqrt(p+1),this.w=.5*t,t=.5/t,this.x=(h-c)*t,this.y=(l-r)*t,this.z=(n-a)*t):i>o?i>d?(s=i-(o+d)+1,s=Math.sqrt(s),this.x=.5*s,s=.5/s,this.w=(h-c)*s,this.y=(n+a)*s,this.z=(r+l)*s):(s=d-(i+o)+1,s=Math.sqrt(s),this.z=.5*s,s=.5/s,this.w=(n-a)*s,this.x=(l+r)*s,this.y=(c+h)*s):o>d?(s=o-(d+i)+1,s=Math.sqrt(s),this.y=.5*s,s=.5/s,this.w=(l-r)*s,this.z=(h+c)*s,this.x=(a+n)*s):(s=d-(i+o)+1,s=Math.sqrt(s),this.z=.5*s,s=.5/s,this.w=(n-a)*s,this.x=(l+r)*s,this.y=(c+h)*s),DEBUG&&g(this),this}slerp(e,t,s){return s=(0,i.c)(s,0,1),this.slerpUnclamped(e,t,s)}slerpUnclamped(e,t,s){let i,n,r,a;const o=e.x,h=e.y,l=e.z,c=e.w;i=t.x,n=t.y,r=t.z,a=t.w;let d=c*a+o*i+h*n+l*r;if(d<0&&(a=-a,i=-i,n=-n,r=-r,d=-d),Math.abs(d)>=1)return this.w=c,this.x=o,this.y=h,this.z=l,DEBUG&&g(this),this;const u=Math.acos(d),_=Math.sqrt(1-d*d);if(Math.abs(_)<.001)return this.w=.5*c+.5*a,this.x=.5*o+.5*i,this.y=.5*h+.5*n,this.z=.5*l+.5*r,DEBUG&&g(this),this;const m=Math.sin((1-s)*u)/_,p=Math.sin(s*u)/_;return this.w=c*m+a*p,this.x=o*m+i*p,this.y=h*m+n*p,this.z=l*m+r*p,DEBUG&&g(this),this}transformVector(e,t=new R){DEBUG&&u(e);const s=e.x,i=e.y,n=e.z,r=this.x,a=this.y,o=this.z,h=this.w,l=h*s+a*n-o*i,c=h*i+o*s-r*n,d=h*n+r*i-a*s,_=-r*s-a*i-o*n;return t.x=l*h+_*-r+c*-o-d*-a,t.y=c*h+_*-a+d*-r-l*-o,t.z=d*h+_*-o+l*-a-c*-r,DEBUG&&u(t),t}toString(){return"["+this.x+", "+this.y+", "+this.z+", "+this.w+"]"}setLookAt(e,t){if(e.equals(R.ZERO))return this.copy(C.IDENTITY);const s=(new A).setLookAt(R.ZERO,e,t);return this.setFromMat4(s),this}getitem(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:return NaN}}iget(e){return this.getitem(e)}setitem(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t}DEBUG&&g(this)}iset(e,t){this.setitem(e,t)}setFromEulerAngles_Unity(e,t,s){const n=e*i.a*.5,r=t*i.a*.5,a=s*i.a*.5,o=Math.sin(n),h=Math.cos(n),l=Math.sin(r),c=Math.cos(r),d=Math.sin(a),u=Math.cos(a);return this.x=c*o*u+l*h*d,this.y=l*h*u-c*o*d,this.z=c*h*d-l*o*u,this.w=c*h*u+l*o*d,DEBUG&&g(this),this}getEulerAngles_Unity(e=new R){const t=this,s=t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w,n=t.x*t.w-t.y*t.z;return n>.4995*s?(e.x=Math.PI/2,e.y=2*Math.atan2(t.y,t.x),e.z=0):n<-.4995*s?(e.x=-Math.PI/2,e.y=-2*Math.atan2(t.y,t.x),e.z=0):(e.x=Math.asin(2*(t.w*t.x-t.y*t.z)),e.y=Math.atan2(2*t.w*t.y+2*t.z*t.x,1-2*(t.x*t.x+t.y*t.y)),e.z=Math.atan2(2*t.w*t.z+2*t.x*t.y,1-2*(t.z*t.z+t.x*t.x))),e.x*=i.b,e.y*=i.b,e.z*=i.b,e.x+=e.x<0?360:0,e.y+=e.y<0?360:0,e.z+=e.z<0?360:0,e}getPositiveEulerAngles(){return this.getEulerAngles_Unity()}fromToRotation(e,t){const s=new R;s.cross(e,t);const i=new C;return i.x=s.x,i.y=s.y,i.z=s.z,i.w=Math.sqrt(e.lengthSq()*t.lengthSq())+e.dot(t),DEBUG&&g(i),i.normalize()}strictEquals(e){return e instanceof C&&this.equals(e)}approximatelyEquals(e,t=1e-5){return Math.abs(this.x-e.x)<t&&Math.abs(this.y-e.y)<t&&Math.abs(this.z-e.z)<t&&Math.abs(this.w-e.w)<t}toAngleAxis(e,t){const s=this.$clone().normalize();e.v=2*Math.acos(s.w)*i.b;const n=Math.sqrt(1-s.w*s.w);n<1e-4?(t.v.x=1,t.v.z=t.v.y=0):(t.v.x=s.x/n,t.v.y=s.y/n,t.v.z=s.z/n)}$clone(e=new C){return e.copy(this),e}get xyz(){return new R(this.x,this.y,this.z)}}C.ctor=C,C.$kind="struct",C.getDefaultValue=()=>new C,C.rotateTowards=(e,t,s)=>{DEBUG&&(g(e),g(t));const i=C.angle(e,t);if(i<1401298e-51)return t;return(new C).slerpUnclamped(e,t,Math.min(1,s/i))},C.angle=(e,t)=>{DEBUG&&(g(e),g(t));const s=e.dot(t);let n=0;return s<.999998986721039&&(n=2*Math.acos(Math.min(Math.abs(s),1))*i.b),n},C.IDENTITY=Object.freeze(new C),C.ZERO=Object.freeze(new C(0,0,0,0));const w={tmpVec31:null,tmpVec32:null,diff:null,_tmpQuat1:null,_tmpQuat2:null,get tmpQuat1(){return this._tmpQuat1=this._tmpQuat1||new C,this._tmpQuat1},get tmpQuat2(){return this._tmpQuat2=this._tmpQuat2||new C,this._tmpQuat2}};function x(e){return Math.abs(e)>1e-5?1/e:0}class R{constructor(e=0,t=0,s=0){this.x=e,this.y=t,this.z=s,this._data=null,DEBUG&&u(this),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"Vec3")}add(e){return DEBUG&&u(e),this.x+=e.x,this.y+=e.y,this.z+=e.z,DEBUG&&u(this),this}add2(e,t){return DEBUG&&(u(t),u(e)),this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,DEBUG&&u(this),this}addScalars(e,t,s){return this.x+=e,this.y+=t,this.z+=s,DEBUG&&u(this),this}clone(){return(new R).copy(this)}copy(e){return DEBUG&&u(e),this.x=e.x,this.y=e.y,this.z=e.z,this}cross(e,t){DEBUG&&(u(e),u(t));const s=e.x,i=e.y,n=e.z,r=t.x,a=t.y,o=t.z;return this.x=i*o-a*n,this.y=n*r-o*s,this.z=s*a-r*i,DEBUG&&u(this),this}dot(e){return DEBUG&&(u(e),u(this)),this.x*e.x+this.y*e.y+this.z*e.z}equals(e,t=999999943962493e-25){const s=w.diff;return s.x=this.x-e.x,s.y=this.y-e.y,s.z=this.z-e.z,s.lengthSq()<t}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}lerp(e,t,s){return DEBUG&&(u(e),u(t)),s=(0,i.c)(s,0,1),this.x=e.x+s*(t.x-e.x),this.y=e.y+s*(t.y-e.y),this.z=e.z+s*(t.z-e.z),DEBUG&&u(this),this}lerpUnclamped(e,t,s){return DEBUG&&(u(e),u(t)),this.x=e.x+s*(t.x-e.x),this.y=e.y+s*(t.y-e.y),this.z=e.z+s*(t.z-e.z),DEBUG&&u(this),this}mul(e){return DEBUG&&u(e),this.x*=e.x,this.y*=e.y,this.z*=e.z,DEBUG&&u(this),this}mul2(e,t){return DEBUG&&(u(e),u(t)),this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,DEBUG&&u(this),this}mulScalars(e,t,s){return this.x*=e,this.y*=t,this.z*=s,DEBUG&&u(this),this}normalize(){const e=this.x*this.x+this.y*this.y+this.z*this.z;if(e>0){const t=1/Math.sqrt(e);this.x*=t,this.y*=t,this.z*=t}return DEBUG&&u(this),this}project(e){DEBUG&&u(e);const t=this.x*e.x+this.y*e.y+this.z*e.z,s=e.x*e.x+e.y*e.y+e.z*e.z;if(s<Number.EPSILON)return R.ZERO.clone();const i=t/s;return this.x=e.x*i,this.y=e.y*i,this.z=e.z*i,DEBUG&&u(this),this}scale(e){return this.x*=e,this.y*=e,this.z*=e,DEBUG&&u(this),this}set(e,t,s=0){return this.x=e,this.y=t,this.z=s,DEBUG&&u(this),this}sub(e){return DEBUG&&u(e),this.x-=e.x,this.y-=e.y,this.z-=e.z,DEBUG&&u(this),this}sub2(e,t){return DEBUG&&(u(e),u(t)),this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,DEBUG&&u(this),this}subScalars(e,t,s){return this.x-=e,this.y-=t,this.z-=s,DEBUG&&u(this),this}toString(){return"["+this.x+", "+this.y+", "+this.z+"]"}slerp(e,t,s){DEBUG&&(u(e),u(t)),s=(0,i.c)(s,0,1);const n=e.length();if(n<Number.EPSILON)return this.copy(e);const r=t.length();if(r<Number.EPSILON)return this.copy(t);const a=1-s,o=e.dot(t)/(n*r);if(o<=-1||o>=1)return this.copy(e).normalize().scale(a*n+s*r);const h=Math.acos(o);if(h<Number.EPSILON)return this.copy(e);const l=Math.sin(h),c=Math.sin(a*h)/l,d=Math.sin(s*h)/l;return this.set(e.x*c+t.x*d,e.y*c+t.y*d,e.z*c+t.z*d).normalize().scale(a*n+s*r)}slerpUnclamped(e,t,s){DEBUG&&(u(e),u(t));const i=e.length();if(i<Number.EPSILON)return this.copy(e);const n=t.length();if(n<Number.EPSILON)return this.copy(t);const r=1-s,a=e.dot(t)/(i*n);if(a<=-1||a>=1)return this.copy(e).normalize().scale(r*i+s*n);const o=Math.acos(a);if(o<Number.EPSILON)return this.copy(e);const h=Math.sin(o),l=Math.sin(r*o)/h,c=Math.sin(s*o)/h;return this.set(e.x*l+t.x*c,e.y*l+t.y*c,e.z*l+t.z*c).normalize().scale(r*i+s*n)}abs(e=null){return e?(e.x=this.x<0?-this.x:this.x,e.y=this.y<0?-this.y:this.y,e.z=this.z<0?-this.z:this.z,e):(this.x<0&&(this.x=-this.x),this.y<0&&(this.y=-this.y),this.z<0&&(this.z=-this.z),this)}strictEquals(e){return e instanceof R&&this.equals(e)}approximatelyEquals(e,t=1e-5){return Math.abs(this.x-e.x)<t&&Math.abs(this.y-e.y)<t&&Math.abs(this.z-e.z)<t}invertSafe(){return this.x=x(this.x),this.y=x(this.y),this.z=x(this.z),DEBUG&&u(this),this}$getType(){return R}getitem(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:return NaN}}iget(e){return this.getitem(e)}setitem(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t}DEBUG&&u(this)}iset(e,t){this.setitem(e,t)}getHashCode(){return this.x^this.y^this.z}hash(){return this.getHashCode()}$clone(e=new R){return e.copy(this),e}fromVector2(e){return this.x=e.x,this.y=e.y,this.z=0,DEBUG&&u(this),this}fromVector4(e){return this.x=e.x,this.y=e.y,this.z=e.z,DEBUG&&u(this),this}equalsWithEpsilon(e,t=1e-6){return Math.abs(this.x-e.x)<t&&Math.abs(this.y-e.y)<t&&Math.abs(this.z-e.z)<t}get data(){return this._data||(this._data=new Float32Array(3)),this._data[0]=this.x,this._data[1]=this.y,this._data[2]=this.z,this._data}}w.tmpVec31=new R,w.tmpVec32=new R,w.diff=new R,R.ctor=R,R.$kind="struct",R.kEpsilon=1e-5,R.kEpsilonNormalSqrt=1e-15,R.REVERSED_Z=new R(1,1,-1),R.cachedNegativeInfinity=new R(-1/0,-1/0,-1/0),R.cachedPositiveInfinity=new R(1/0,1/0,1/0),R.cachedForward=new R(0,0,1),R.cachedBack=new R(0,0,-1),R.cachedOne=new R(1,1,1);const I=new R(0,0,1);I._data=new Float32Array(3),Object.freeze(I),R.BACK=I;const M=new R(0,-1,0);M._data=new Float32Array(3),Object.freeze(M),R.DOWN=M;const P=new R(0,0,-1);P._data=new Float32Array(3),Object.freeze(P),R.FORWARD=P;const v=new R(-1,0,0);v._data=new Float32Array(3),Object.freeze(v),R.LEFT=v;const D=new R(1,1,1);D._data=new Float32Array(3),Object.freeze(D),R.ONE=D;const O=new R(1,0,0);O._data=new Float32Array(3),Object.freeze(O),R.RIGHT=O;const L=new R(0,1,0);L._data=new Float32Array(3),Object.freeze(L),R.UP=L;const F=new R(0,0,0);F._data=new Float32Array(3),Object.freeze(F),R.ZERO=F,R.distance=(e,t)=>w.tmpVec31.copy(e).sub(t).length(),R.projectOnPlane=(e,t,s=new R)=>{DEBUG&&(u(e),u(t));const{tmpVec31:i,tmpVec32:n}=w;return i.copy(e),n.copy(e),i.sub(n.project(t)),s.copy(i),s},R.smoothDamp=(e,t,s,i,n,r)=>{DEBUG&&(u(e),u(t));const a=2/(i=Math.max(1e-4,i)),o=a*r,h=1/(1+o+.479999989271164*o*o+.234999999403954*o*o*o),l=e.clone().sub(t.clone()),c=t.clone(),d=n*i,_=R.clampMagnitude(l.clone(),d);t=e.clone().sub(_.clone());const m=s.v.clone().add(_.clone().scale(a)).scale(r);s.v=s.v.clone().sub(m.clone().scale(a)).scale(h);let p=t.clone().add(_.clone().add(m.clone()).scale(h));return c.clone().sub(e.clone()).dot(p.clone().sub(c.clone()))>0&&(p=c.clone(),s.v=p.clone().sub(c.clone()).scale(1/r)),p.clone()},R.clampMagnitude=(e,t)=>{DEBUG&&u(e);return e.length()>Math.abs(t)?e.clone().normalize().scale(t):e.clone()},R.reflect=(e,t)=>{DEBUG&&(u(e),u(t));const{tmpVec31:s}=w;return s.copy(t),s.scale(-2*e.dot(t)).add(e),s.clone()},R.moveTowards=(e,t,s)=>{DEBUG&&(u(e),u(t));const i=w.tmpVec31.copy(t).sub(e),n=i.length();return n<=s||n<1401298e-51?t.clone():e.clone().add(i.scale(1/n*s))},R.orthoNormalize=(e,t,s)=>{e.normalize(),t.cross(e,t),t.cross(t,e),t.normalize(),s.cross(e,t)},R.signedAngle=(e,t,s)=>{DEBUG&&(u(e),u(t),u(s));const{tmpVec31:n,tmpVec32:r}=w;n.copy(e).normalize(),r.copy(t).normalize();const a=(0,i.c)(r.dot(n),-1,1);n.cross(e,t);const o=s.dot(n);return Math.acos(a)*(0,i.k)(o)*i.b},R.rotateTowards=(e,t,s,n)=>{DEBUG&&(u(e),u(t));const{tmpVec31:r,tmpVec32:a,tmpQuat1:o,tmpQuat2:h}=w,l=r.cross(e,t),c=o.setLookAt(e,l),d=h.setLookAt(t,l),_=C.rotateTowards(c,d,s*i.b);r.set(0,0,1);const m=_.transformVector(r,a),p=t.length()-e.length(),g=e.length()+(0,i.k)(p)*Math.min(Math.abs(p),n);return m.normalize(),m.mul(new R(g,g,g)),m.clone()},R.angle=(e,t)=>{DEBUG&&(u(e),u(t));const{tmpVec31:s,tmpVec32:n}=w;return Math.acos((0,i.c)(s.copy(e).normalize().dot(n.copy(t).normalize()),-1,1))*i.b},R.equals=(e,t)=>null===e&&null===t||!!e&&!!t&&e.equals(t),R.getDefaultValue=()=>new R,R.FromVector2=e=>new R(e.x,e.y,0),R.FromVector4=e=>new R(e.x,e.y,e.z);var U=s(21),B=s(22),N=s(35);class k{constructor(e,t,s){this.x=e,this.y=t,this.z=s}dot2(e,t){return this.x*e+this.y*t}}const z=[new k(1,1,0),new k(-1,1,0),new k(1,-1,0),new k(-1,-1,0),new k(1,0,1),new k(-1,0,1),new k(1,0,-1),new k(-1,0,-1),new k(0,1,1),new k(0,-1,1),new k(0,1,-1),new k(0,-1,-1)],V=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180],G=new Array(512),H=new Array(512);function j(e){return e*e*e*(e*(6*e-15)+10)}function W(e,t,s){return(1-s)*e+s*t}function Y(e,t){let s=Math.floor(e),i=Math.floor(t);e-=s,t-=i,s&=255,i&=255;const n=H[s+G[i]].dot2(e,t),r=H[s+G[i+1]].dot2(e,t-1),a=H[s+1+G[i]].dot2(e-1,t),o=H[s+1+G[i+1]].dot2(e-1,t-1),h=j(e);return W(W(n,a,h),W(r,o,h),j(t))}!function(e){e>0&&e<1&&(e*=65536),(e=Math.floor(e))<256&&(e|=e<<8);for(let t=0;t<256;t++){let s;s=1&t?V[t]^255&e:V[t]^e>>8&255,G[t]=G[t+256]=s,H[t]=H[t+256]=z[s%12]}}(0);const K={_tmpVecA:null,_tmpVecB:null,_tmpVecC:null,_tmpVecD:null,_tmpVecE:null,get tmpVecA(){return this._tmpVecA=this._tmpVecA||new R,this._tmpVecA},get tmpVecB(){return this._tmpVecB=this._tmpVecB||new R,this._tmpVecB},get tmpVecC(){return this._tmpVecC=this._tmpVecC||new R,this._tmpVecC},get tmpVecD(){return this._tmpVecD=this._tmpVecD||new R,this._tmpVecD},get tmpVecE(){return this._tmpVecE=this._tmpVecE||new R,this._tmpVecE}};class Q{constructor(e=new R,t=new R){this.center=e,this.halfExtents=t,this._min=new R,this._max=new R,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"BoundingBox")}static getDefaultValue(){return new Q}add(e){const t=this.center,s=t.x,i=t.y,n=t.z,r=this.halfExtents,a=r.x,o=r.y,h=r.z;let l=s-a,c=s+a,d=i-o,u=i+o,_=n-h,m=n+h;const p=e.center,g=p.x,f=p.y,y=p.z,E=e.halfExtents,T=E.x,S=E.y,A=E.z,b=g-T,C=g+T,w=f-S,x=f+S,R=y-A,I=y+A;b<l&&(l=b),C>c&&(c=C),w<d&&(d=w),x>u&&(u=x),R<_&&(_=R),I>m&&(m=I),t.x=.5*(l+c),t.y=.5*(d+u),t.z=.5*(_+m),r.x=.5*(c-l),r.y=.5*(u-d),r.z=.5*(m-_)}copy(e){this.center.copy(e.center),this.halfExtents.copy(e.halfExtents)}clone(){return new Q(this.center.clone(),this.halfExtents.clone())}intersects(e){const t=this.getMax(),s=this.getMin(),i=e.getMax(),n=e.getMin();return s.x<=i.x&&t.x>=n.x&&s.y<=i.y&&t.y>=n.y&&s.z<=i.z&&t.z>=n.z}_intersectsRay(e,t){const s=K.tmpVecA.copy(this.getMin()).sub(e.origin),i=K.tmpVecB.copy(this.getMax()).sub(e.origin),n=e.direction;0===n.x?(s.x=s.x<0?-Number.MAX_VALUE:Number.MAX_VALUE,i.x=i.x<0?-Number.MAX_VALUE:Number.MAX_VALUE):(s.x/=n.x,i.x/=n.x),0===n.y?(s.y=s.y<0?-Number.MAX_VALUE:Number.MAX_VALUE,i.y=i.y<0?-Number.MAX_VALUE:Number.MAX_VALUE):(s.y/=n.y,i.y/=n.y),0===n.z?(s.z=s.z<0?-Number.MAX_VALUE:Number.MAX_VALUE,i.z=i.z<0?-Number.MAX_VALUE:Number.MAX_VALUE):(s.z/=n.z,i.z/=n.z);const r=K.tmpVecC.set(Math.min(s.x,i.x),Math.min(s.y,i.y),Math.min(s.z,i.z)),a=K.tmpVecD.set(Math.max(s.x,i.x),Math.max(s.y,i.y),Math.max(s.z,i.z)),o=Math.min(Math.min(a.x,a.y),a.z),h=Math.max(Math.max(r.x,r.y),r.z),l=o>=h&&h>=0;return l&&t.copy(e.direction).scale(h).add(e.origin),l}_fastIntersectsRay(e){const t=K.tmpVecA,s=K.tmpVecB,i=K.tmpVecC,n=K.tmpVecD,r=K.tmpVecE,a=e.direction;return t.sub2(e.origin,this.center),n.set(Math.abs(t.x),Math.abs(t.y),Math.abs(t.z)),i.mul2(t,a),!(n.x>this.halfExtents.x&&i.x>=0)&&(!(n.y>this.halfExtents.y&&i.y>=0)&&(!(n.z>this.halfExtents.z&&i.z>=0)&&(r.set(Math.abs(a.x),Math.abs(a.y),Math.abs(a.z)),s.cross(a,t),s.set(Math.abs(s.x),Math.abs(s.y),Math.abs(s.z)),!(s.x>this.halfExtents.y*r.z+this.halfExtents.z*r.y)&&(!(s.y>this.halfExtents.x*r.z+this.halfExtents.z*r.x)&&!(s.z>this.halfExtents.x*r.y+this.halfExtents.y*r.x)))))}intersectsRay(e,t=null){return t?this._intersectsRay(e,t):this._fastIntersectsRay(e)}setToInfinity(){this.center.set(0,0,0),this.halfExtents.set(Number.MAX_SAFE_INTEGER/2,Number.MAX_SAFE_INTEGER/2,Number.MAX_SAFE_INTEGER/2)}setToNegativeSize(){return this.halfExtents.set(Number.MIN_SAFE_INTEGER/2,Number.MIN_SAFE_INTEGER/2,Number.MIN_SAFE_INTEGER/2),this}setMinMax(e,t){this.center.add2(t,e).scale(.5),this.halfExtents.sub2(t,e).scale(.5)}getMin(){return this._min.copy(this.center).sub(this.halfExtents)}getMax(){return this._max.copy(this.center).add(this.halfExtents)}containsPoint(e){const t=this.getMin(),s=this.getMax();return!(e.x<t.x||e.x>s.x||e.y<t.y||e.y>s.y||e.z<t.z||e.z>s.z)}setFromTransformedAabb(e,t,s=!1){const i=this.center,n=this.halfExtents,r=e.center,a=e.halfExtents,o=t.data,h=o[0],l=o[4],c=o[8],d=o[1],u=o[5],_=o[9],m=o[2],p=o[6],g=o[10],f=Math.abs(h),y=Math.abs(l),E=Math.abs(c),T=Math.abs(d),S=Math.abs(u),A=Math.abs(_),b=Math.abs(m),C=Math.abs(p),w=Math.abs(g);if(i.set(o[12]+h*r.x+l*r.y+c*r.z,o[13]+d*r.x+u*r.y+_*r.z,o[14]+m*r.x+p*r.y+g*r.z),n.set(f*a.x+y*a.y+E*a.z,T*a.x+S*a.y+A*a.z,b*a.x+C*a.y+w*a.z),s){const e=o[3],t=o[7],s=o[11],h=o[15],l=Math.abs(e),c=Math.abs(t),d=Math.abs(s),u=Math.abs(h),_=h+e*r.x+t*r.y+s*r.z,m=u+l*a.x+c*a.y+d*a.z;i.scale(1/_),n.scale(1/m)}}compute(e,t){if(0===e.length)return void this.setToInfinity();t=t||3;const s=K.tmpVecA.set(e[0],e[1],e[2]),i=K.tmpVecB.set(e[0],e[1],e[2]),n=e.length/t;for(let r=1;r<n;r++){const n=e[r*t+0],a=e[r*t+1],o=e[r*t+2];n<s.x&&(s.x=n),a<s.y&&(s.y=a),o<s.z&&(s.z=o),n>i.x&&(i.x=n),a>i.y&&(i.y=a),o>i.z&&(i.z=o)}this.setMinMax(s,i)}expandToPoint(e){const t=this.getMin(),s=this.getMax();t.x=Math.min(t.x,e.x),t.y=Math.min(t.y,e.y),t.z=Math.min(t.z,e.z),s.x=Math.max(s.x,e.x),s.y=Math.max(s.y,e.y),s.z=Math.max(s.z,e.z),this.setMinMax(t,s)}expand(e){this.halfExtents.add(K.tmpVecA.copy(e).scale(.5))}closestPoint(e){const t=e.clone();return t.sub(this.center),t.x=(0,i.c)(t.x,-this.halfExtents.x,this.halfExtents.x),t.y=(0,i.c)(t.y,-this.halfExtents.y,this.halfExtents.y),t.z=(0,i.c)(t.z,-this.halfExtents.z,this.halfExtents.z),t.add(this.center),t}strictEquals(e){return e instanceof Q&&this.equals(e)}equals(e){return this.center.equals(e.center)&&this.halfExtents.equals(e.halfExtents)}intersectRayDistance(e,t){const s=new R;return!!this._intersectsRay(e,s)&&(t.v=R.distance(e.origin,s),!0)}getVertices(e=[]){if(e.length<8)for(let t=e.length;t<8;t++)e.push(new R);const t=this.center,s=this.halfExtents;return e[0].x=t.x-s.x,e[0].y=t.y-s.y,e[0].z=t.z-s.z,e[1].x=t.x+s.x,e[1].y=t.y-s.y,e[1].z=t.z-s.z,e[2].x=t.x-s.x,e[2].y=t.y+s.y,e[2].z=t.z-s.z,e[3].x=t.x+s.x,e[3].y=t.y+s.y,e[3].z=t.z-s.z,e[4].x=t.x-s.x,e[4].y=t.y-s.y,e[4].z=t.z+s.z,e[5].x=t.x+s.x,e[5].y=t.y-s.y,e[5].z=t.z+s.z,e[6].x=t.x-s.x,e[6].y=t.y+s.y,e[6].z=t.z+s.z,e[7].x=t.x+s.x,e[7].y=t.y+s.y,e[7].z=t.z+s.z,e}getHashCode(){return this.center.getHashCode()^this.halfExtents.getHashCode()<<2}get min(){return this.getMin()}set min(e){this.setMinMax(e,this.getMax())}get max(){return this.getMax()}set max(e){this.setMinMax(this.getMin(),e)}}Q.ctor=Q,Q.$kind="struct",Q.equals=(e,t)=>null===e&&null===t||e&&t&&e.equals(t);const X={_viewProj:null,get viewProj(){return this._viewProj=this._viewProj||new A,this._viewProj}},q={radius:0,center:new R};class ${constructor(e=(new A).setPerspective(90,16/9,.1,1e3),t=new A){this.planes=[],this.unityPlanesOrthographic=[],this.unityPlanesPerspective=[];for(let e=0;e<6;e++)this.planes[e]=[];this.unityPlanesOrthographic[0]=this.planes[1],this.unityPlanesOrthographic[1]=this.planes[0],this.unityPlanesOrthographic[2]=this.planes[2],this.unityPlanesOrthographic[3]=this.planes[3],this.unityPlanesOrthographic[4]=this.planes[5],this.unityPlanesOrthographic[5]=this.planes[4],this.unityPlanesPerspective[0]=this.planes[1],this.unityPlanesPerspective[1]=this.planes[0],this.unityPlanesPerspective[2]=this.planes[3],this.unityPlanesPerspective[3]=this.planes[2],this.unityPlanesPerspective[4]=this.planes[5],this.unityPlanesPerspective[5]=this.planes[4],this.update(e,t)}update(e,t){X.viewProj.mul2(e,t);const s=X.viewProj.data;this.planes[0][0]=s[3]-s[0],this.planes[0][1]=s[7]-s[4],this.planes[0][2]=s[11]-s[8],this.planes[0][3]=s[15]-s[12];let i=Math.sqrt(this.planes[0][0]*this.planes[0][0]+this.planes[0][1]*this.planes[0][1]+this.planes[0][2]*this.planes[0][2]);this.planes[0][0]/=i,this.planes[0][1]/=i,this.planes[0][2]/=i,this.planes[0][3]/=i,this.planes[1][0]=s[3]+s[0],this.planes[1][1]=s[7]+s[4],this.planes[1][2]=s[11]+s[8],this.planes[1][3]=s[15]+s[12],i=Math.sqrt(this.planes[1][0]*this.planes[1][0]+this.planes[1][1]*this.planes[1][1]+this.planes[1][2]*this.planes[1][2]),this.planes[1][0]/=i,this.planes[1][1]/=i,this.planes[1][2]/=i,this.planes[1][3]/=i,this.planes[2][0]=s[3]+s[1],this.planes[2][1]=s[7]+s[5],this.planes[2][2]=s[11]+s[9],this.planes[2][3]=s[15]+s[13],i=Math.sqrt(this.planes[2][0]*this.planes[2][0]+this.planes[2][1]*this.planes[2][1]+this.planes[2][2]*this.planes[2][2]),this.planes[2][0]/=i,this.planes[2][1]/=i,this.planes[2][2]/=i,this.planes[2][3]/=i,this.planes[3][0]=s[3]-s[1],this.planes[3][1]=s[7]-s[5],this.planes[3][2]=s[11]-s[9],this.planes[3][3]=s[15]-s[13],i=Math.sqrt(this.planes[3][0]*this.planes[3][0]+this.planes[3][1]*this.planes[3][1]+this.planes[3][2]*this.planes[3][2]),this.planes[3][0]/=i,this.planes[3][1]/=i,this.planes[3][2]/=i,this.planes[3][3]/=i,this.planes[4][0]=s[3]-s[2],this.planes[4][1]=s[7]-s[6],this.planes[4][2]=s[11]-s[10],this.planes[4][3]=s[15]-s[14],i=Math.sqrt(this.planes[4][0]*this.planes[4][0]+this.planes[4][1]*this.planes[4][1]+this.planes[4][2]*this.planes[4][2]),this.planes[4][0]/=i,this.planes[4][1]/=i,this.planes[4][2]/=i,this.planes[4][3]/=i,this.planes[5][0]=s[3]+s[2],this.planes[5][1]=s[7]+s[6],this.planes[5][2]=s[11]+s[10],this.planes[5][3]=s[15]+s[14],i=Math.sqrt(this.planes[5][0]*this.planes[5][0]+this.planes[5][1]*this.planes[5][1]+this.planes[5][2]*this.planes[5][2]),this.planes[5][0]/=i,this.planes[5][1]/=i,this.planes[5][2]/=i,this.planes[5][3]/=i}containsPoint(e){for(let t=0;t<6;t++)if(this.planes[t][0]*e.x+this.planes[t][1]*e.y+this.planes[t][2]*e.z+this.planes[t][3]<=0)return!1;return!0}containsSphere(e,t=null){let s,i,n=0;const r=e.radius,a=e.center,o=a.x,h=a.y,l=a.z,c=this.planes;let d;for(i=0;i<6;i++){if(d=c[i],s=4===i&&t?d[0]*o+d[1]*h+d[2]*l+t:d[0]*o+d[1]*h+d[2]*l+d[3],s<=-r)return 0;s>r&&n++}return 6===n?2:1}containsCylinder(e,t,s){for(let i=0;i<this.planes.length;i++){const n=this.planes[i],r=-(n[0]*t.x+n[1]*t.y+n[2]*t.z);if(Math.abs(r)>Number.EPSILON){const i=(n[0]*e.x+n[1]*e.y+n[2]*e.z+n[3])/r,a=q;a.center.x=e.x+t.x*i,a.center.y=e.y+t.y*i,a.center.z=e.z+t.z*i,a.radius=s;if(this.containsSphere(a))return!0}}return!1}}class J{constructor(){this._center=R.ZERO.clone(),this._radius=0}get center(){return this._center}set center(e){this._center=e}get radius(){return this._radius}set radius(e){this._radius=e}}pc.Vec3=R,pc.Quat=C,pc.Mat4=A,pc.Vec4=y,pc.Mat3=c,pc.Vec2=r,pc.math={RAD_TO_DEG:i.b,DEG_TO_RAD:i.a,clamp:i.c,intToBytes24:i.d,intToBytes32:i.e,lerp:i.g,inverseLerp:i.f,powerOfTwo:i.i,random:i.j,smoothstep:i.m,smootherstep:i.l,sign:i.k,nextPowerOfTwo:i.h},pc.Color=U.a,pc.AnimationCurve=B.a,pc.Keyframe=B.b,pc.BoundingBox=Q,pc.noise={perlin2:Y},pc.ColorGradient=N.a},(e,t,s)=>{"use strict";s.d(t,{a:()=>r.a,c:()=>l,b:()=>a.a,d:()=>u.a,e:()=>g,f:()=>n.a,g:()=>i.a,h:()=>A,i:()=>y.c,k:()=>c.a,j:()=>d.b});var i=s(46),n=s(47),r=s(17),a=s(18),o=s(2);let h=0;class l{constructor(e,t){this.id=h++,this.$id=0,this.system=e,this.entity=t,this.data=null,this.events=new o.a(this),this.events.on("set_enabled",this.onSetEnabled,this)}get enabled(){throw new Error("Should be overwritten")}set enabled(e){throw new Error("Should be overwritten")}onSetEnabled(e,t,s){t!==s&&this.entity.enabled&&(s?this.onEnable():this.onDisable())}onEnable(){}onDisable(){}destroy(){this.system&&this.entity&&this.system.removeComponent(this.entity)}toUnityObject(){return this.unityClass?UnityEngine.Object.FromHandle(this.unityClass,this):null}}l.prototype.unityClass=null;var c=s(19),d=s(24),u=s(15),_=s(36),m=s(48);class p{constructor(e,t){this.object=e,this.time=t,this.updatedAt=UnityEngine.Time.time,this.instant=!t||t<=0,this.secondPassProcess=!1,this.enabled=!0,this.instant&&this.prepare()}prepare(){this.isValid&&(this.object.enabled=!1)}update(){if(!this.isValid||this.instant||this.time<=0)return;const e=UnityEngine.Time.time,t=e-this.updatedAt;this.updatedAt=e,this.time-=t,this.time<=0&&(this.prepare(),this.secondPassProcess=!0)}execute(){this.isValid&&(this.object.onDestroy&&this.object.onDestroy(),this.object.destroy(),this.object=null)}get isValid(){return null!==this.object&&!this.object._destroyed}get isReady(){return this.enabled&&(this.instant||this.time<=0)||!this.isValid}}class g extends p{prepare(){if(!this.isValid)return;const e=this.object.collectAllUnityComponents();for(let t=0;t<e.length;t++){e[t].enabled=!1}}execute(){if(!this.isValid)return;const e=this.object;e._beingDestroyed=!0,e.enabled=!1;const t=e.collectAllUnityComponents();for(let e=0;e<t.length;e++){const s=t[e];s.onDestroy&&s.onDestroy()}e.destroy(),this.object=null}get isValid(){const e=this.object;return null!==e&&!e._destroyed&&!e._beingDestroyed}}var f=s(59),y=s(13);class E extends a.a{constructor(e){super(e),this.id="unitymanager",this.callbacksDisabled=!1,this.fixedTimeStep=.02,this.maximumAllowedTimeStep=.1,this.timeScale=1,this.maximumParticleTimestep=.15,UnityEngine.Time.fixedUnscaledDeltaTime=this.fixedTimeStep/this.timeScale,this._fixedAccumulator=0,this.app.events.on("update",this.onUpdate,this),this.app.events.on("frameend",this.onFrameEnd,this),this.app.events.on("focus",this.onApplicationFocus,this),this.app.events.on("blur",this.onApplicationBlur,this),this.systems=[],this.destroyQueue=new Array(64),this.destroyQueueTmp=new Array(64),this.destroyQueueLength=0,this.destroyQueueProcessing=!1;const t=y.c.instance;this._applyProjectSettings(t)}registerSystem(e){this.systems.push(e)}onUpdate(e){if(this._invokeQueueOnSystems((t=>t.onStart(e))),this._invokeQueueOnSystems((t=>t.onBeforeUpdates(e))),Math.abs(UnityEngine.Time.timeScale)>Number.EPSILON){for(this._fixedAccumulator=Math.min(this.maximumAllowedTimeStep,this._fixedAccumulator+e*UnityEngine.Time.timeScale),UnityEngine.Time.SetActiveFixedTime(!0);this._fixedAccumulator>=this.fixedTimeStep;)UnityEngine.Time.FixedUpdate(this.fixedTimeStep),this._invokeQueueOnSystems((e=>e.onFixedUpdate(this.fixedTimeStep))),this._fixedAccumulator-=this.fixedTimeStep;UnityEngine.Time.SetActiveFixedTime(!1)}this._invokeDestroyQueue(!1),this._invokeQueueOnSystems((t=>t.onUpdate(e))),this._invokeDestroyQueue(!0),this._invokeQueueOnSystems((t=>t.onPostUpdate(e))),this._invokeDestroyQueue(!1),this._invokeQueueOnSystems((t=>t.onBeforeRender(e)))}onFrameEnd(){this._invokeQueueOnSystems((e=>e.onAfterRender(0)))}onApplicationFocus(){this._invokeQueueOnSystems((e=>e.onApplicationFocus(!0)))}onApplicationBlur(){this._invokeQueueOnSystems((e=>e.onApplicationFocus(!1)))}_invokeQueueOnSystems(e){for(let t=0;t<this.systems.length;t++){const s=this.systems[t];this._triggerPerformanceSample(s,!0),e(s),this._triggerPerformanceSample(s,!1)}}_triggerPerformanceSample(e,t){const s=e.performanceSamplerSection;s&&(t?this.app.counters.startSection(s):this.app.counters.endSection(s))}disableCallbacks(){this.callbacksDisabled=!0}enableCallbacks(){this.callbacksDisabled=!1}invokeCallbacks(e){if(e.isPrefab&&!e.parent)return;this.callbacksDisabled=!1,u.a.instance.startSection(u.a.SCRIPTS);const t=new f.a;this._collectComponents(e,t),this._invokeQueue(t),u.a.instance.endSection(u.a.SCRIPTS)}_collectComponents(e,t){const s=e.collectAllUnityComponents();for(let e=0;e<s.length;e++){const i=s[e];(i.onAwake||i.onEnable||i.onDisable)&&t.push(i)}}_invokeQueue(e){if(0===e.length)return;const t=e.getComponents();for(let e=0;e<t.length;e++){const s=t[e];s.entity._enabledInHierarchy&&(s.onInit(),s.enabled&&s.onEnable(),s.enabled||s.onDisable())}}enqueueDestroy(e){e.isValid&&(this.destroyQueueProcessing&&(e.enabled=!1),this.destroyQueue[this.destroyQueueLength]=e,this.destroyQueueLength++)}_invokeDestroyQueue(e){if(0===this.destroyQueueLength)return;let t=0;if(this.destroyQueueProcessing=!0,e)for(let e=0;e<this.destroyQueueLength;e++)this.destroyQueue[e].update();for(let e=0;e<this.destroyQueueLength;e++){const s=this.destroyQueue[e];s.isReady?s.secondPassProcess||s.execute():(this.destroyQueueTmp[t]=s,t++)}for(let e=0;e<this.destroyQueueLength;e++){const t=this.destroyQueue[e];t.isReady&&t.secondPassProcess&&t.execute()}for(let e=0;e<this.destroyQueueLength;e++)this.destroyQueue[e].enabled=!0;const s=this.destroyQueue;this.destroyQueue=this.destroyQueueTmp,this.destroyQueueTmp=s,this.destroyQueueLength=t,this.destroyQueueProcessing=!1}_applyProjectSettings(e){this.fixedTimeStep=e.timeSettings.fixedDeltaTime,this.maximumAllowedTimeStep=e.timeSettings.miximumDeltaTime,this.timeScale=e.timeSettings.timeScale,this.maximumParticleTimestep=e.timeSettings.maximumParticleTimestep}}const T=["OnMouseDown","OnMouseDrag","OnMouseEnter","OnMouseExit","OnMouseOver","OnMouseUp","OnMouseUpAsButton","OnTriggerEnter","OnTriggerStay","OnTriggerExit","OnCollisionEnter","OnCollisionStay","OnCollisionExit","OnTriggerEnter2D","OnTriggerStay2D","OnTriggerExit2D","OnCollisionEnter2D","OnCollisionStay2D","OnCollisionExit2D","UnityEngine$UI$IMaterialModifier$GetModifiedMaterial","UnityEngine$UI$IMeshModifier$ModifyMesh","UnityEngine$UI$IMeshModifier$ModifyMesh$1","OnPopulateMesh","UnityEngine$ICanvasRaycastFilter$IsRaycastLocationValid","OnAnimatorMove","ApplyRootMotionBuiltin"],S=new Map;class A extends c.a{constructor(e,t,s=!0){super();const i=Bridge._getTypeByName(t);this.code=new i(this),this.scriptsExecutionOrder=0,this.internalExecutionOrder=100,this["__"+t]=this.code,this.code.handle=this,this.unityClass=i,this._enabled=s,this._events=[],function(e){const t=e.code.constructor;if(S.has(t))return;const s=[];for(let e=0;e<T.length;e++)t.prototype[T[e]]!==UnityEngine.UI.Graphic.prototype.OnPopulateMesh&&t.prototype[T[e]]&&s.push(T[e]);S.set(t,s)}(this),this._addEventListeners()}storeMagicMethods(e){if(e.isPrefab)return;const t=Bridge.as(this.code,UnityEngine.EventSystems.IEventSystemHandler);e._eventHanders||(e._eventHanders=[]),t&&e._eventHanders.push(t);const s=S.get(this.code.constructor);if(0!==s.length)for(let t=0;t<s.length;t++){const i=e._magicMethods[s[t]]||[];i.push(this),e._magicMethods[s[t]]=i}}removeMagicMethods(e){const t=S.get(this.code.constructor);if(0!==t.length)for(let s=0;s<t.length;s++){const i=e._magicMethods[t[s]];if(i){const e=i.indexOf(this);e>=0&&(i[e]=i[i.length-1],i.length-=1)}}}configureForEntity(e){this.code.ConfigureForEntity&&this.code.ConfigureForEntity(e)}onEnable(){return!!super.onEnable()&&(this._invokeOverload("OnEnable"),!0)}onDisable(){return!!super.onDisable()&&(this._invokeOverload("OnDisable"),!0)}onDestroy(){return!!super.onDestroy()&&(this.stopAllCoroutines(),this._invokeOverload("DestroyInternal"),this._invokeOverload("OnDestroy"),!0)}onAwake(){u.a.instance.startSubSection(u.a.SCRIPTS_ON_AWAKE),this._invokeOverload("Awake"),u.a.instance.endSubSection(u.a.SCRIPTS_ON_AWAKE)}onStart(){u.a.instance.startSubSection(u.a.SCRIPTS_ON_START),this._invokeOverload("Start"),u.a.instance.endSubSection(u.a.SCRIPTS_ON_START)}onUpdate(){this._invokeOverload("Update")}onFixedUpdate(){this._invokeOverload("FixedUpdate")}onPostUpdate(){this.code.LateUpdate()}onBeforeRender(){this.code.OnPreRender()}onAfterRender(){this.code.OnPostRender()}onApplicationFocus(e){this.code.OnApplicationFocus(e)}onPointerEnter(e){(this.code.OnPointerEnter||this.code.UnityEngine$EventSystems$IPointerEnterHandler$OnPointerEnter).call(this.code,e)}onPointerExit(e){(this.code.OnPointerExit||this.code.UnityEngine$EventSystems$IPointerExitHandler$OnPointerExit).call(this.code,e)}onPointerDown(e){(this.code.OnPointerDown||this.code.UnityEngine$EventSystems$IPointerDownHandler$OnPointerDown).call(this.code,e)}onPointerUp(e){(this.code.OnPointerUp||this.code.UnityEngine$EventSystems$IPointerUpHandler$OnPointerUp).call(this.code,e)}onPointerClick(e){(this.code.OnPointerClick||this.code.UnityEngine$EventSystems$IPointerClickHandler$OnPointerClick).call(this.code,e)}onBeginDrag(e){(this.code.onBeginDrag||this.code.UnityEngine$EventSystems$IBeginDragHandler$OnBeginDrag).call(this.code,e)}onDrag(e){(this.code.OnDrag||this.code.UnityEngine$EventSystems$IDragHandler$OnDrag).call(this.code,e)}onEndDrag(e){(this.code.OnEndDrag||this.code.UnityEngine$EventSystems$IEndDragHandler$OnEndDrag).call(this.code,e)}addCoroutine(e){this._system.addCoroutine(e,this)}addFixedUpdateCoroutine(e){this._system.addFixedUpdateCoroutine(e,this)}addEndOfFrameCoroutine(e){this._system.addEndOfFrameCoroutine(e,this)}stopAllCoroutines(){this._system.stopAllCoroutines(this)}stopCoroutine(e){this._system.stopCoroutine(e,this)}_addEventListeners(){this.code.Update&&this._events.push("onUpdate"),this.code.FixedUpdate&&this._events.push("onFixedUpdate"),this.code.LateUpdate&&this._events.push("onPostUpdate"),this.code.OnPostRender&&this._events.push("onAfterRender"),this.code.OnApplicationFocus&&this._events.push("onApplicationFocus")}_queuesToSubscribe(){return this._events}_invokeOverload(e){try{const t=this.code.overloads[e+"()"]||e,s=this.code[t];if(void 0!==s){const e=s.call(this.code);e&&"Bridge.GeneratorEnumerator"===e.$$fullname&&new UnityEngine.Coroutine(e,this)}}catch(e){e=e.hasOwnProperty("errorStack")?e.errorStack:e,console.error(e)}}onCanvasGroupChanged(){this._invokeOverload("OnCanvasGroupChanged")}onBeforeTransformParentChanged(){this._invokeOverload("OnBeforeTransformParentChanged")}onTransformParentChanged(){this._invokeOverload("OnTransformParentChanged")}onTransformChildrenChanged(){this._invokeOverload("OnTransformChildrenChanged")}onParticleSystemStopped(){this._invokeOverload("OnParticleSystemStopped")}onRenderImage(e,t){const s=this.code.OnRenderImage;return s&&s.call(this.code,e,t),!!s}}A.create=(e,t,s)=>{const i=Bridge._getTypeByName(t);return Bridge.isFunction(i)?new A(e,t,s):null};class b extends d.b{constructor(e){super(e),this.id="monoBehaviour",this.performanceSamplerSection=u.a.SCRIPTS,this.scriptsExecutionOrder={},this._coroutines={onUpdate:{},onFixedUpdate:{},onAfterRender:{}};const t=y.c.instance;this._applyProjectSettings(t)}addComponent(e,t){return super.addComponent(e,t),t.scriptsExecutionOrder=this.scriptsExecutionOrder[t.code.$$fullname]||0,t.storeMagicMethods(e),t}removeComponent(e,t){super.removeComponent(e,t),t.removeMagicMethods(e)}onBeforeUpdates(){UnityEngine.Input.OnMouseUpdate()}onUpdate(e){this.app.counters.startSubSection(u.a.SCRIPTS_ON_UPDATE),super.onUpdate(e);const t=this._coroutines.onUpdate;for(const s in t){const i=t[s],n=i.length>0?i[0][1]:null;if(!n||!n._entity._activeSelf){delete t[s];continue}let r=0,a=-1;for(let t=i.length-1;t>=0;--t){const s=i[t][0];s.Update(e),s.isDone?(r++,a<0&&(a=t)):a>=0&&(i[a--]=i[t])}r===i.length?delete t[s]:r>0&&i.splice(0,r)}this.app.counters.endSubSection(u.a.SCRIPTS_ON_UPDATE)}onFixedUpdate(e){this.app.counters.startSubSection(u.a.SCRIPTS_ON_FIXED_UPDATE),super.onFixedUpdate(e),this._updateCoroutines(this._coroutines.onFixedUpdate,this._handleFixedUpdate),this.app.counters.endSubSection(u.a.SCRIPTS_ON_FIXED_UPDATE)}onPostUpdate(e){this.app.counters.startSubSection(u.a.SCRIPTS_ON_POST_UPDATE),super.onPostUpdate(e),this.app.counters.endSubSection(u.a.SCRIPTS_ON_POST_UPDATE)}onAfterRender(e){super.onAfterRender(e),this._updateCoroutines(this._coroutines.onAfterRender,this._handleEndOfFrame)}_updateCoroutines(e,t){for(const s in e){const i=e[s],n=i.length>0?i[0][1]:null;if(!n||!n._entity._activeSelf){delete e[s];continue}const r=i.length;for(let e=r-1;e>=0;--e)t(i[e][0]);i.length===r?delete e[s]:i.splice(0,r)}}_handleFixedUpdate(e){e.HandleFixedUpdate()}_handleEndOfFrame(e){e.HandleEndOfFrame()}stopAllCoroutines(e){const t=this._coroutines.onUpdate[e._id];if(t)for(let e=0;e<t.length;++e){t[e][0].Cancel()}}stopCoroutine(e,t){const s=this._coroutines.onUpdate[t._id];if(s)for(let t=0;t<s.length;++t){const i=s[t][0];i.enumeratorStack&&i.enumeratorStack.Count>0&&i.enumeratorStack.Peek()===e&&i.Cancel()}}addCoroutine(e,t){this._addCoroutineToQueue(e,t,this._coroutines.onUpdate)}addFixedUpdateCoroutine(e,t){this._addCoroutineToQueue(e,t,this._coroutines.onFixedUpdate)}addEndOfFrameCoroutine(e,t){this._addCoroutineToQueue(e,t,this._coroutines.onAfterRender)}_addCoroutineToQueue(e,t,s){s[t._id]||(s[t._id]=[]),s[t._id].push([e,t])}_applyProjectSettings(e){const t={};for(let s=0;s<e.scriptsExecutionOrder.length;s++){const i=e.scriptsExecutionOrder[s];t[i.name]=i.value}this.scriptsExecutionOrder=t}}var C=s(49);pc.Debugger=_.a,pc.GraphNode=i.a,pc.Entity=n.a,pc.Application=r.a,pc.Component=l,pc.UnityComponentSystem=d.b,pc.Counters=u.a,pc.Scene=m.a,pc.DestroyTask=p,pc.DestroyEntityTask=g,pc.DestroyScriptableObjectTask=class extends p{prepare(){}execute(){this.isValid&&(this.object.CallOnDisable(),this.object.CallOnDestroy(),this.object._destroyed=!0)}get isValid(){return!this.object._destroyed}},pc.UnityComponentSystemManagerSystem=E,pc.MonoBehaviourComponent=A,pc.MonoBehaviourSystem=b,pc.ProjectSettings=y.c,pc.QualitySettings=C.a},(e,t,s)=>{"use strict";s.d(t,{a:()=>h,b:()=>n,c:()=>b.a,d:()=>E,e:()=>m,f:()=>o});s(44);let i=0;function n(){return"id:"+i++}let r=0,a=0;const o={pause:function(){a=performance.now()},resume:function(){r+=performance.now()-a,a=0},now:function(){return a||performance.now()-r}};class h{constructor(e){this.defaultScope=e,this._callbacks={},this._callbackActive={}}on(e,t,s=null){return this._callbacks[e]||(this._callbacks[e]=[]),this._callbackActive[e]&&this._callbackActive[e]===this._callbacks[e]&&(this._callbackActive[e]=this._callbackActive[e].slice()),this._callbacks[e].push({callback:t,scope:s||this.defaultScope}),this}off(e=null,t=null,s=null){if(!this._callbacks)return this;if(this._callbackActive)if(e)this._callbackActive[e]&&this._callbackActive[e]===this._callbacks[e]&&(this._callbackActive[e]=this._callbackActive[e].slice());else for(const e in this._callbackActive)this._callbacks[e]&&this._callbacks[e]===this._callbackActive[e]&&(this._callbackActive[e]=this._callbackActive[e].slice());if(e)if(t){const i=this._callbacks[e];if(!i)return this;let n=i.length;for(;n--;)i[n].callback===t&&i[n].scope===s&&i.splice(n,1)}else this._callbacks[e]&&delete this._callbacks[e];else this._callbacks=null;return this}fire(e,...t){if(!e||!this._callbacks||!this._callbacks[e])return this;let s;this._callbackActive||(this._callbackActive={}),this._callbackActive[e]?(this._callbackActive[e]===this._callbacks[e]&&(this._callbackActive[e]=this._callbackActive[e].slice()),s=this._callbacks[e].slice()):this._callbackActive[e]=this._callbacks[e];for(let i=0;(s||this._callbackActive[e])&&i<(s||this._callbackActive[e]).length;i++){const n=(s||this._callbackActive[e])[i];if(n.callback.apply(n.scope,t),n.callback.once){const t=this._callbacks[e].indexOf(n);-1!==t&&(this._callbackActive[e]===this._callbacks[e]&&(this._callbackActive[e]=this._callbackActive[e].slice()),this._callbacks[e].splice(t,1))}}return s||(this._callbackActive[e]=null),this}once(e,t,s){return t.once=!0,this.on(e,t,s),this}}const l=navigator.userAgent;let c=!1,d=!1,u=!1,_=!1;/(windows|mac os|linux|cros)/i.test(l)&&(c=!0),/android/i.test(l)?(c=!1,d=!0,u=!0):/ip([ao]d|hone)/i.test(l)&&(c=!1,d=!0,_=!0);const m={desktop:c,mobile:d,ios:_,android:u},p=new Uint32Array(2048),g=new Uint32Array(64),f=new Uint32Array(64),y={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",alegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};p[0]=0;for(let e=1;e<1024;++e){let t=e<<13,s=0;for(;0==(8388608&t);)s-=8388608,t<<=1;t&=-8388609,s+=947912704,p[e]=t|s}for(let e=1024;e<2048;++e)p[e]=939524096+(e-1024<<13);f[0]=0;for(let e=1;e<31;++e)f[e]=e<<23;f[31]=1199570944,f[32]=2147483648;for(let e=33;e<63;++e)f[e]=2147483648+(e-32<<23);f[63]=3347054592,g[0]=0;for(let e=1;e<64;++e)g[e]=32===e?0:1024;function E(e){const t=new Float32Array(e.length),s=new Uint32Array(t.buffer);for(let t=0;t<e.length;t++){const i=e[t],n=i>>10;s[t]=p[g[n]+(1023&i)]+f[n]}return t}const T=Object.create(null);function S(e,t,s,i,n){const r=Object.keys(e),a=Object.keys(t);let o=!0;for(let e=0;e<Math.max(r.length,a.length);e++){const t=r[e],h=a[e];t?h?t!==h&&(n.push(`Inconsistency in set "${i}": object #0 has property "${t}" at position ${e} and object #${s} has property "${h}" at position ${e}.`),o=!1):(n.push(`Inconsistency in set "${i}": object #0 has an additional property "${t}" at position ${e}.`),o=!1):(n.push(`Inconsistency in set "${i}": object #${s} has an additional property "${h}" at position ${e}.`),o=!1)}return o}const A={addObjectToValidationSet:function(e,t){TESTS&&(T[t]||(T[t]=[]),T[t].push(e))},validate:function(){if(!TESTS)return;const e=[];for(const t in T){const s=T[t];if(s.length<=1)continue;const i=s[0];for(let n=1;n<s.length&&S(i,s[n],n,t,e);n++);}if(e.forEach((e=>console.error(e))),0!==e.length)throw new Error(`Hidden shape validation failed, found ${e.length} error(s)`)}};var b=s(14);const C=new Set;function w(e){window.parent&&window.parent.postMessage({target:"editor:stubber",propertyOrMethodName:e,calledFrom:x()},"*")}function x(){const e=(new Error).stack.split("\n"),t=e.findIndex((e=>e.includes("Proxy.<anonymous>")||e.includes("Class.<anonymous>")));if(-1===t)return null;const s=e[t+1].split(" at ")[1].split(" ")[0];if(!s.includes(".")||0===s.length)return null;const i=s.split(".")[1].split("$")[0];return i.length>0&&!["get","set"].includes(i)?i:null}const R=new Map;function I(e=null,t=!1){if(t&&R.has(e))return R.get(e);const s=new Map,i=new Proxy(Object,{get:(t,i)=>"generateConstructorFor"===i||"ctor"===i?function(e){const t=I(e),s=function(){return t};return Object.setPrototypeOf(s,t),s.prototype=t,s}:"reportProperty"===i?function(e,t){return function(e){C.has(e)||(C.add(e),console.warn(`You are using the "${e}" property which is not supported by Luna. Please open a support request if you experience any issues.`),w(e))}(e),s.has(e)?s.get(e):t}:"reportMethod"===i?function(e,t){return function(e){C.has(e)||(C.add(e),console.warn(`You are using the "${e}" method which is not supported by Luna. Please open a support request if you experience any issues.`),w(e))}(e),t}:"$$isStubbed"===i||("$interfaces"===i||"$descriptors"===i||"$$aliases"===i||"$$inheritors"===i||"$$inherits"===i||"$typeArguments"===i?[]:"$$initCtor"!==i?"constructor"===i?Function:"$$fullname"===i||"$$name"===i?e:()=>{}:void 0),set:(t,i,n)=>(s.set(`${e}.${String(i)}`,n),!0),construct:()=>i});return t&&R.set(e,i),i}const M=I();Object.assign(pc,b.a),pc.time=o,pc.Events=h,pc.Conversion={fromFloat16ToFloat32:E,tryParseHtmlString:function(e,t){if("#"===e[0])return t.fromString(e),!0;let s=e.toLowerCase();return!(!/^[a-z]+$/.test(s)||(s=y[s],!s))&&(t.fromString(s),!0)}},TESTS&&(pc.hiddenShapeValidator=A),pc.stubProxy=M,pc.generateStubProxy=I},(e,t,s)=>{"use strict";s.d(t,{a:()=>c,b:()=>o,c:()=>i,d:()=>r,e:()=>n,f:()=>a,g:()=>l,h:()=>h});const i=1e4,n=1e5,r=1e6,a=1e-4,o=1.1920929e-7,h=.005,l=2/180*Math.PI,c=h*h*2.01},(e,t,s)=>{"use strict";s.d(t,{a:()=>i,b:()=>n,c:()=>r,d:()=>a,e:()=>o,f:()=>l,g:()=>h,h:()=>p,i:()=>c,j:()=>d,k:()=>m,l:()=>_,m:()=>u});const i=Math.PI/180,n=180/Math.PI;function r(e,t,s){return e>=s?s:e<=t?t:e}function a(e){return[e>>16&255,e>>8&255,255&e]}function o(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}function h(e,t,s){return e+(t-e)*r(s,0,1)}function l(e,t,s){return t-e==0?0:(s-e)/(t-e)}function c(e){return 0!==e&&!(e&e-1)}function d(e,t){const s=t-e;return Math.random()*s+e}function u(e,t,s){if(s<=0)return e;if(s>=1)return t;const i=s*s*(3-2*s);return t*i+e*(1-i)}function _(e,t,s){return s<=e?0:s>=t?1:(s=(s-e)/(t-e))*s*s*(s*(6*s-15)+10)}function m(e){return e<0?-1:1}function p(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,(e|=e>>32)+1}},(e,t,s)=>{"use strict";s.d(t,{a:()=>ut,b:()=>Rt,c:()=>B.a,d:()=>Ze,g:()=>i.b,e:()=>mt,f:()=>Je,k:()=>L,h:()=>F,j:()=>O,i:()=>D,l:()=>ft,n:()=>I.b,m:()=>et,p:()=>he,o:()=>Ss,q:()=>ys,r:()=>Re.a,u:()=>Ue,s:()=>ot,t:()=>it,v:()=>d.a,w:()=>nt,x:()=>a.c,y:()=>M.a,z:()=>U.a,A:()=>Vt,B:()=>zt});var i=s(8),n=s(25),r=s(60),a=s(16);let o=0;class h extends r.b{constructor(){super(),this.name="Untitled",this.id=o++,this._shader=null,this.meshInstances=[],this.dirty=!0,this.enableAutoInstancing=!1}get shader(){return this._shader}set shader(e){e.handle instanceof a.c&&(e=e.handle),this._shader=e}}var l=s(2),c=s(17),d=s(7),u=s(11);const _=new u.a,m={};class p extends h{constructor(){super(),this.$id=0,this.keywords=new u.a,this.drawOrder=0,this.renderQueue=0,this.enableInstancing=!1,this._readDepth=!1,this._localKeywordsVersion=-1,this._globalKeywordsVersion=-1,this.floatParameters=[],this.colorParameters=[],this.vectorParameters=[],this.textureParameters=[],this.materialFlags=[],this["__UnityEngine.Material"]=null,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"UnityMaterial")}getShadowCasterPasses(e){let t=m[this.$id];if(t)return t;if(t=[],e){const s=l.c.SHADER_PASS_SHADOW_CASTER;for(let i=0;i<e.passes.length;i++){const n=e.passes[i];n.lightMode===s&&t.push(n)}0===t.length&&e.fallbackShader&&t.push(...this.getShadowCasterPasses(e.fallbackShader))}return m[this.$id]=t,t}getPass(e,t=[]){if(t.length=0,!this._shader)return t;for(let s=0;s<this._shader.passes.length;s++){const i=this._shader.passes[s];i.lightMode===e&&t.push(i)}return t}setPass(e){if(!this._shader)return void UnityEngine.Debug.Log$1("Missing shader.");const t=this._shader.passes.length;if(e<0||e>t)return void UnityEngine.Debug.Log$1("Shader pass out of range setup attempt.");const s=this._shader.passes[e];UnityEngine.GL.SetPassMaterial=this["__UnityEngine.Material"],c.a.getApplication().renderer.setPass(this,s)}setParametersFromShaderDefaults(){if(!this.shader)return;const e=this.shader.defaultParameters;for(const t in e)this.setParameter(t,this.cloneParameterData(e[t])),e[t]instanceof d.a&&this.setParameter(t+"_ST",this.cloneParameterData([1,1,0,0]))}setup(){for(let e=0;e<this.floatParameters.length;e++)this.setParameter(this.floatParameters[e].name,this.floatParameters[e].value);for(let e=0;e<this.colorParameters.length;e++)this.setParameter(this.colorParameters[e].name,this.colorParameters[e].value.data);for(let e=0;e<this.vectorParameters.length;e++)this.setParameter(this.vectorParameters[e].name,this.vectorParameters[e].value.data);for(let e=0;e<this.textureParameters.length;e++){const t=this.textureParameters[e].value;this.setParameter(this.textureParameters[e].name,t?t.handle:null)}const e=[];for(let t=0;t<this.materialFlags.length;t++){const s=this.materialFlags[t];s.enabled&&this.shader.supportsKeyword(s.name)&&e.push(s.name)}for(let t=0;t<this.shader.passes.length;t++){const s=this.shader.passes[t];for(let t=0;t<s.keywordGroups.length;t++){const i=s.keywordGroups[t].getEnabledKeywords().filter((t=>e.includes(t)));i.length>1&&console.error(`Material ${this.name} contains more than one enabled keywords from the same keyword group. Enabled keywords: ${i}`)}}this.shaderKeywords=e,this.updateFlags()}deleteParameter(e){super.deleteParameter(e);const t=this._shader.defaultParameters[e];t&&this.setParameter(e,t)}setParameter(e,t,s=0){if(super.setParameter(e,t),null===t&&this._shader){const t=this._shader.defaultParameters[e];t&&this.setParameter(e,t)}else t instanceof d.a&&!t.device.webgl2&&(t._pot||0!==t._addressU||0!==t._addressV||UnityEngine.Debug.LogWarning$1("Material's '"+this.name+"' texture '"+t.name+"' wrap mode is set to 'Repeat', but it's resolution NOT POWER OF TWO (NPOT)\nOnly textures with Power Of Two (POT) resolution can be used with WrapMode=Repeat"))}clone(){const e=new p;return e.name=this.name,e._shader=this._shader,e.copyPropertiesFromMaterial(this),e}hasProperty(e){return this.parameters.hasOwnProperty(e)||this.shader.defaultParameterNames.hasOwnProperty(e)}copyPropertiesFromMaterial(e){this.renderQueue=e.renderQueue,this.enableInstancing=e.enableInstancing,this.keywords.copy(e.keywords),this.$id=e.$id;for(const t in e.parameters)this.setParameter(t,this.cloneParameterData(e.parameters[t].data))}cloneParameterData(e){return e instanceof Float32Array||Array.isArray(e)?new Float32Array(e):e}updateFlags(){if(this._localKeywordsVersion===this.keywords.version&&this._globalKeywordsVersion===a.c.globalKeywords.version)return;if(this._localKeywordsVersion=this.keywords.version,this._globalKeywordsVersion=a.c.globalKeywords.version,!this._shader)return;const e=this._shader;this._readDepth=!1,_.clear(),_.merge(this.keywords),_.merge(a.c.globalKeywords),e.isCreatedByShaderGraph&&(e.shaderDefinedKeywords.includes("_ADDITIONAL_LIGHTS")?_.enableKeywordId(u.b._ADDITIONAL_LIGHTS):e.shaderDefinedKeywords.includes("_ADDITIONAL_LIGHTS_VERTEX")&&_.enableKeywordId(u.b._ADDITIONAL_LIGHTS_VERTEX));for(let t=0;t<e.passes.length;t++){const s=e.passes[t];if(!s.hasDepthReader)continue;const i=s.getVariant(_,!1,!0);if(i&&i.readDepth){this._readDepth=!0;break}}}get shaderKeywords(){return this.keywords.getEnabledKeywords()}set shaderKeywords(e){this.keywords.setEnabledKeywords(e)}get passCount(){return this._shader.passes.length}get readDepth(){return this.updateFlags(),this._readDepth}}var g=s(33),f=s(0),y=s(1),E=s(29);const T={shadowsMode:0,shadowStrength:1,shadowBias:.05,shadowNormalBias:.4,shadowResolution:l.c.SHADOW_RESOLUTION_FROM_QUALITY_SETTINGS},S=new f.m,A=new f.i,b=new f.i,C=new f.i,w=(new f.i).setTRS(new f.m(-.5,-.5,0),f.j.IDENTITY,f.m.ONE);let x=0;class R{constructor(){this.id=x++,this._type=l.c.LIGHTTYPE_DIRECTIONAL,this._color=new f.d(.8,.8,.8),this._intensity=1,this._castShadows=!1,this._enabled=!1,this._mask=1,this._cullingMask=-1,this._renderMode=0,this._affectLightmapped=!1,this._nodeAabbVer=0,this.isStatic=!1,this.key=0,this._aabb=new f.b,this._attenuationEnd=10,this._shadowType=l.c.SHADOW_PCF3,this._cookie=null,this._cookieScale=new f.l(1,1),this._outerConeAngle=45,this._finalColor=new Float32Array([.8,.8,.8,1]);const e=Math.pow(this._finalColor[0],2.2);this._linearFinalColor=new Float32Array([e,e,e,e]),this._worldToLightMatrix=new f.i,this._node=null,this._luminance=0,this._effectiveLuminance=0,this._range=0,this._priority=0,this._directionToLight=new f.m,this._position=new f.m,this._shadowsMode=T.shadowsMode,this._shadowStrength=T.shadowStrength,this._shadowBias=T.shadowBias,this._shadowNormalBias=T.shadowNormalBias,this._shadowResolution=T.shadowResolution}destroy(){}update(e){if(!this._node)return!1;if(this._nodeAabbVer===this._node.aabbVersion)return this._type===l.c.LIGHTTYPE_POINT?E.a.isVisibleInFrustum(e.frustum,this._aabb.center,this._attenuationEnd):E.a.isAABBVisibleInFrustum(e.frustum,this._aabb);this._nodeAabbVer=this._node.aabbVersion,this.getBoundingBox(this._aabb);const t=this._node.worldTransformInverse,s=1/this._attenuationEnd;return this._position.copy(this._node.getPosition()),this._type===l.c.LIGHTTYPE_POINT?(this._worldToLightMatrix.copy(t).scale(s),this._worldToLightMatrix.data[15]=1,E.a.isVisibleInFrustum(e.frustum,this._node.getPosition(),this._attenuationEnd)):(this._type===l.c.LIGHTTYPE_SPOT?(A.setIdentity(),A.data[11]=2*Math.tan(f.e*this._outerConeAngle*.5),A.data[15]=0,b.setScale(s,s,s),b.data[15]=s,this._worldToLightMatrix.mul2(b,A),this._worldToLightMatrix.mul2(this._worldToLightMatrix,t)):(S.set(this._cookieScale.x,this._cookieScale.x,this._cookieScale.x),C.setTRS(this._node.getPosition(),this._node.getRotation(),S),this._worldToLightMatrix.mul2(C,w).invert(),this._worldToLightMatrix.data[2]=0,this._worldToLightMatrix.data[6]=0,this._worldToLightMatrix.data[10]=0,this._worldToLightMatrix.data[14]=0,this._directionToLight.copy(this._node.forward).scale(-1)),E.a.isAABBVisibleInFrustum(e.frustum,this._aabb))}getColor(){return this._color}getBoundingBox(e){if(this._type===l.c.LIGHTTYPE_SPOT){const t=this.attenuationEnd,s=this._outerConeAngle,i=this._node,n=Math.abs(Math.tan(s*f.e*.5)*t);e.center.set(0,0,.5*t),e.halfExtents.set(n,n,.5*t),e.setFromTransformedAabb(e,i.getWorldTransform())}else this._type===l.c.LIGHTTYPE_POINT?(e.center.copy(this._node.getPosition()),e.halfExtents.set(this.attenuationEnd,this.attenuationEnd,this.attenuationEnd)):this._type===l.c.LIGHTTYPE_DIRECTIONAL&&(e.center.copy(this._node.getPosition()),e.halfExtents.set(1/0,1/0,1/0))}_updateFinalColor(){const e=this._color,t=e.r,s=e.g,i=e.b,n=e.a,r=this._intensity,a=this._finalColor,o=this._linearFinalColor;a[0]=t*r,a[1]=s*r,a[2]=i*r,a[3]=n*r,r>=1?(o[0]=Math.pow(t,2.2)*r,o[1]=Math.pow(s,2.2)*r,o[2]=Math.pow(i,2.2)*r,o[3]=Math.pow(n,2.2)*r):(o[0]=Math.pow(a[0],2.2),o[1]=Math.pow(a[1],2.2),o[2]=Math.pow(a[2],2.2),o[3]=Math.pow(a[3],2.2)),this._luminance=(.3*t+.59*s+.11*i)*r}setColor(e,t,s){let i=e;e instanceof f.d&&(i=e.r,t=e.g,s=e.b),this._color.set(i,t,s),this._updateFinalColor()}updateKey(){this.key=this._type<<29|(this._castShadows?1:0)<<28|this._shadowType<<25|(this._cookie?1:0)<<24}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e)}get affectLightmapped(){return this._affectLightmapped}set affectLightmapped(e){this._affectLightmapped=e}get type(){return this._type}set type(e){if(this._type===e)return;this._type=e,this.updateKey();const t=this._shadowType;this._shadowType=null,this.shadowType=t}get mask(){return this._mask}set mask(e){this._mask!==e&&(this._mask=e)}get renderMode(){return this._renderMode}set renderMode(e){this._renderMode!==e&&(this._renderMode=e)}get range(){return this._range}set range(e){this._range=e}get cullingMask(){return this._cullingMask}set cullingMask(e){this._cullingMask!==e&&(this._cullingMask=e)}get shadowType(){return this._shadowType}set shadowType(e){if(this._shadowType===e)return;const t=y.a.getApplication().graphicsDevice;this._type===l.c.LIGHTTYPE_POINT&&(e=l.c.SHADOW_PCF3),e!==l.c.SHADOW_PCF5||t.webgl2||(e=l.c.SHADOW_PCF3),e!==l.c.SHADOW_VSM32||t.textureFloatRenderable||(e=l.c.SHADOW_VSM16),e!==l.c.SHADOW_VSM16||t.textureHalfFloatRenderable||(e=l.c.SHADOW_VSM8),this._shadowType=e,this.updateKey()}get shadows(){return this._shadowsMode}get castShadows(){return this._castShadows&&this._mask!==l.c.MASK_LIGHTMAP&&0!==this._mask}set castShadows(e){this._castShadows!==e&&(this._castShadows=e,this.updateKey())}get shadowsMode(){return this._shadowsMode}set shadowsMode(e){this._shadowsMode!==e&&(this._shadowsMode=e)}get shadowStrength(){return this._shadowStrength}set shadowStrength(e){this._shadowStrength!==e&&(this._shadowStrength=e)}get shadowBias(){return this._shadowBias}set shadowBias(e){this._shadowBias!==e&&(this._shadowBias=e)}get shadowNormalBias(){return this._shadowNormalBias}set shadowNormalBias(e){this._shadowNormalBias!==e&&(this._shadowNormalBias=e)}get shadowResolution(){return this._shadowResolution}set shadowResolution(e){this._shadowResolution!==e&&(this._shadowResolution=e)}get outerConeAngle(){return this._outerConeAngle}set outerConeAngle(e){this._outerConeAngle!==e&&(this._outerConeAngle=e,this._nodeAabbVer=-1)}get intensity(){return this._intensity}set intensity(e){this._intensity!==e&&(this._intensity=e,this._updateFinalColor())}get cookie(){return this._cookie}set cookie(e){this._cookie!==e&&(this._cookie=e,this.updateKey())}get cookieScale(){return this._cookieScale}set cookieScale(e){this._cookieScale=e,this._nodeAabbVer=-1}get attenuationEnd(){return this._attenuationEnd}set attenuationEnd(e){this._attenuationEnd=e,this._nodeAabbVer=-1}}R.LightDefaults={type:"point",color:new f.d(1,1,1,1),cookieScale:f.l.ONE,intensity:1,range:10,cullingMask:-1};var I=s(51),M=s(6);const P=new f.m,v=new f.m;class D{constructor(e){const t=e.deltaPositions;this.indices=[];for(let e=0;e<t.length;e++)this.indices.push(e);this.deltaPositions=e.deltaPositions,this.deltaNormals=this.hasNonZeroNumbers(e.deltaNormals)?e.deltaNormals:null,this.deltaTangents=this.hasNonZeroNumbers(e.deltaTangents)?e.deltaTangents:null,this.weight=e.weight}hasNonZeroNumbers(e){for(let t=0;t<e.length;t++)if(0!==e[t])return!0;return!1}}class O{constructor(e={}){this.frames=e.frames||[],this.name=e.name||"",this.aabb=e.aabb||null}get indices(){return this.frames[0].indices}}class L{constructor(e){this.aabb=new f.b,this._baseBuffer=null,this._baseAabb=null,this._targets=e,this._dirty=!0,this._aabbDirty=!0,this._baseData=null,this._offsetPF=0,this._offsetNF=0,this._offsetTF=0,this._vertSizeF=0}_setBaseMesh(e){this._baseBuffer=e.vertexBuffer,this._baseAabb=e._aabb,this._baseData=new Float32Array(this._baseBuffer.storage);let t=-1,s=-1,i=-1;const n=this._baseBuffer.format.elements,r=this._baseBuffer.format.size;for(let e=0;e<n.length;e++)n[e].name===l.c.SEMANTIC_POSITION?t=n[e].offset:n[e].name===l.c.SEMANTIC_NORMAL?s=n[e].offset:n[e].name===l.c.SEMANTIC_TANGENT&&(i=n[e].offset);this._offsetPF=t/4,this._offsetNF=s/4,this._offsetTF=i/4,this._vertSizeF=r/4,this._dirty=!0}_calculateAabb(){if(!this._baseBuffer)return;this.aabb.copy(this._baseAabb);const e=this._vertSizeF,t=this._offsetPF,s=this._baseData;for(let i=0;i<this._targets.length;i++){const n=this._targets[i];if(!n.aabb&&n.indices.length>0){n.aabb=this.aabb.clone(),P.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),v.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);const i=n.indices.length;for(let r=0;r<n.frames.length;r++){const a=n.frames[r].deltaPositions;for(let r=0;r<i;r++){const i=n.indices[r]*e+t,o=s[i]+a[3*r],h=s[i+1]+a[3*r+1],l=s[i+2]+a[3*r+2];P.x>o&&(P.x=o),P.y>h&&(P.y=h),P.z>l&&(P.z=l),v.x<o&&(v.x=o),v.y<h&&(v.y=h),v.z<l&&(v.z=l)}}n.aabb.setMinMax(P,v)}n.aabb&&this.aabb.add(n.aabb)}this._aabbDirty=!1}addTarget(e){this._targets.push(e),this._aabbDirty=!0}removeTarget(e){const t=this._targets.indexOf(e);-1!==t&&(this._targets.splice(t,1),this._aabbDirty=!0)}getTarget(e){return this._targets[e]}}class F{constructor(e){this.morph=e,this._vertexBuffer=null,this._vertexData=null,this.weights={},this._dirty=!0}_setBaseMesh(e){this.destroy(),this._vertexBuffer=new M.a(this.morph._baseBuffer.device,this.morph._baseBuffer.format,this.morph._baseBuffer.numVertices,l.c.BUFFER_DYNAMIC,this.morph._baseBuffer.storage.slice(0)),this._vertexData=new Float32Array(this._vertexBuffer.storage),this.weights={};for(let e=0;e<this.morph._targets.length;e++)this.weights[this.morph._targets[e].name]=0;this._dirty=!0}destroy(){this._vertexBuffer&&(this._vertexBuffer.destroy(),this._vertexBuffer=null)}getWeight(e){const t=Object.keys(this.weights)[e];return this.weights[t]}setWeight(e,t){const s=Object.keys(this.weights)[e];this.weights[s]=(0,f.o)(t,0,100),this._dirty=!0}getCount(){return Object.keys(this.weights).length}updateBounds(e){this.morph._baseBuffer!==e.vertexBuffer&&this.morph._setBaseMesh(e),this._vertexData||this._setBaseMesh(e),this.morph._aabbDirty&&this.morph._calculateAabb()}update(e){this.morph._baseBuffer!==e.vertexBuffer&&this.morph._setBaseMesh(e),this._vertexData||this._setBaseMesh(e);const t=this.morph._targets,s=Object.keys(this.weights).map((e=>this.weights[e]));this._vertexData.set(this.morph._baseData);for(let e=0;e<t.length;e++){const i=s[e];if(0===i)continue;const n=t[e],r=n.frames;if(1===r.length&&this._applyFrame(r[0],i/100,n),r.length>1){if(i<r[0].weight){const e=r[0],t=i/e.weight;this._applyFrame(e,t,n);continue}if(i>r[r.length-1].weight){const e=r[r.length-1],t=i/e.weight;this._applyFrame(e,t,n);continue}if(2===r.length){const e=r[0],t=r[1];this._applyFrame(e,1,n);const s=(i-e.weight)/(t.weight-e.weight);this._applyFrame(t,s,n);continue}let e,t;for(let s=0;s<r.length-1&&(e=s,t=s+1,!(r[e].weight<i&&i<r[t].weight));s++);const s=(i-r[e].weight)/(r[t].weight-r[e].weight);this._applyFrame(r[e],1-s,n),this._applyFrame(r[t],s,n)}}this._vertexBuffer.unlock()}_applyFrame(e,t,s){const i=e.indices.length,n=this.morph._vertSizeF,r=this.morph._offsetPF,a=this.morph._offsetNF,o=this.morph._offsetTF,h=this._vertexData;for(let a=0;a<i;a++){const i=e.deltaPositions,o=3*a,l=s.indices[a]*n+r;h[l]+=i[o]*t,h[l+1]+=i[o+1]*t,h[l+2]+=i[o+2]*t}if(e.deltaNormals){const r=e.deltaNormals;for(let e=0;e<i;e++){const i=3*e,o=s.indices[e]*n+a;h[o]+=r[i]*t,h[o+1]+=r[i+1]*t,h[o+2]+=r[i+2]*t}}if(e.deltaTangents){const r=e.deltaTangents;for(let e=0;e<i;e++){const i=4*e,a=s.indices[e]*n+o;h[a]+=r[i]*t,h[a+1]+=r[i+1]*t,h[a+2]+=r[i+2]*t,h[a+3]+=r[i+3]*t,h[a+3]=h[a+3]>0?1:-1}}}}var U=s(9),B=s(10),N=s(30);const k=new f.m,z=new f.m,V=new f.n,G="zDHiP9sPyT/bD8k/f6ziP9sPyT/bD8k/2w/JP3+s4j/MMeI/f6ziP7VT+z/MMeI/L/7jP9sPyT/bD8k/+FDkP9sPyT/bD8k/2w/JP/hQ5D8v/uM/+FDkP+zj/j8v/uM/L/7jP+zj/j/DYf4/f6ziP8Nh/j+1U/s/w2H+P3+s4j8v/uM/f6ziP9sPyT8v/uM/6esLQOTLFkDlOgpAw2H+P+U6CkC1U/s/5ToKQMNh/j/p6wtAw2H+P+zj/j/p6wtA+FDkP9sPyT/bD8k/L/7jP9sPyT/bD8k/2w/JPy/+4z/4UOQ/L/7jP+zj/j/4UOQ/ruzVP9sPyT/bD8k/2w/JP67s1T/bD8k/f6ziP67s1T/bD8k/8mHPP9sPyT/bD8k/2w/JP/Jhzz/bD8k/bLDVP/Jhzz/bD8k/2w/JP9sPyT/xYc8/2w/JP/Fhzz9ssNU/2w/JP9sPyT/xYc8/7PbbP2yw1T/xYc8/zDHiP/Fhzz/bD8k/zDHiP+z22z/xYc8/7PbbP8wx4j9IaeI/D5DiP+z22z9IaeI/bLDVP+z22z8PkOI/fqbiP3+s4j/jNNw/D5DiP+M03D9ssNU/D5DiP36m4j/jNNw/8mHPP2yw1T/jNNw/2w/JP+M03D9/rOI/2w/JP/Jhzz/jNNw/u/foP3+s4j9+puI/D5DiP7v36D9+puI/9C/vP7v36D8PkOI/SGniP8wx4j+Lu+g/D5DiP4u76D/0L+8/D5DiP0hp4j+Lu+g/P1D1P/Qv7z+Lu+g/tVP7P4u76D/MMeI/tVP7Pz9Q9T+Lu+g/P1D1P7VT+z8PUvw/rSn9Pz9Q9T8PUvw/9C/vPz9Q9T+tKf0/t9n9P8Nh/j/S3fY/rSn9P9Ld9j/0L+8/rSn9P7fZ/T/S3fY/u/foP/Qv7z/S3fY/f6ziP9Ld9j/DYf4/f6ziP7v36D/S3fY/E17xP8Nh/j/29f4/7OP+PxNe8T/29f4/L/7jPxNe8T/s4/4/E17xPy/+4z/nfeM/f6ziPxNe8T/nfeM/w2H+PxNe8T9/rOI/ruzVP3+s4j/nfeM/L/7jP67s1T/nfeM/2w/JP67s1T8v/uM//NQOQOnrC0BgsQtATFULQPzUDkBgsQtAB6ERQPzUDkBMVQtAHdgKQOU6CkBKAQ5ATFULQEoBDkAHoRFATFULQB3YCkBKAQ5AjEoUQAehEUBKAQ5A5MsWQEoBDkDlOgpA5MsWQIxKFEBKAQ5A1dIFQOzj/j/29f4/w2H+P9XSBUD29f4/6esLQNXSBUDDYf4/p5wHQOU6CkAd2ApATFULQKecB0Ad2ApA2eMEQKecB0BMVQtAYLELQOnrC0BGeghATFULQEZ6CEDZ4wRATFULQGCxC0BGeghAORQCQNnjBEBGeghAw2H+P0Z6CEDp6wtAw2H+PzkUAkBGeghAORQCQMNh/j+32f0/rSn9PzkUAkC32f0/2eMEQDkUAkCtKf0/D1L8P7VT+z+iUgFArSn9P6JSAUDZ4wRArSn9Pw9S/D+iUgFAp5wHQNnjBECiUgFA5ToKQKJSAUC1U/s/5ToKQKecB0CiUgFAjEoUQOTLFkBiHhlAjzobQIxKFEBiHhlAB6ERQIxKFECPOhtAfhgdQFevHkAOVRhAjzobQA5VGEAHoRFAjzobQH4YHUAOVRhA/NQOQAehEUAOVRhA6esLQA5VGEBXrx5A6esLQPzUDkAOVRhAngkYQFevHkBG5yBA1qshQJ4JGEBG5yBAG/IQQJ4JGEDWqyFAngkYQBvyEEDb2A5A6esLQJ4JGEDb2A5AV68eQJ4JGEDp6wtA1dIFQOnrC0Db2A5A7OP+P9vYDkAb8hBA7OP+P9XSBUDb2A5AG/IQQNarIUBXrx5A6esLQFevHkDkyxZAV68eQOnrC0Ab8hBA6esLQOzj/j8b8hBAG/IQQOzj/j9BuQBAG/IQQEG5AEDs4/4/QbkAQBvyEEAb8hBAG/IQQNarIUAb8hBA+FDkP9sPyT/4UOQ/QbkAQPhQ5D/s4/4/+FDkP0G5AED4UOQ/QbkAQOzj/j/4UOQ/IKM/QOJ+PEDBFj9ATsdCQMEWP0BYHkBATsdCQCCjP0DBFj9AOpdEQFgeQEDBFj9A4n48QDqXREDBFj9A2w9JQDqXREDifjxAOpdEQNsPSUCS60VATsdCQDqXRECS60VAWB5AQDqXREBOx0JAcDY2QO3tL0BE4TRA4n48QEThNECT0zZA4n48QHA2NkBE4TRAkfo7QOJ+PEDBFj9AV8E6QMEWP0BYHkBAV8E6QJH6O0DBFj9AIXk7QFgeQEDBFj9A4n48QCF5O0DBFj9Ak9M2QCF5O0DifjxAIXk7QJPTNkAc/DhAV8E6QCF5O0Ac/DhAWB5AQCF5O0BXwTpAHPw4QJPTNkA3UjZAV8E6QDdSNkBE4TRAV8E6QBz8OEA3UjZAmuM4QEThNEACrzJA7e0vQJrjOEACrzJA4n48QJrjOEDt7S9AmuM4QOJ+PECR+jtAV8E6QJrjOECR+jtAROE0QJrjOEBXwTpAQM4qQO3tL0DjXCNAV68eQONcI0DkyxZA41wjQFevHkBAzipAV68eQNarIUBAzipAc5ImQEDOKkDkCyxA1qshQOQLLEBAzipA1qshQHOSJkDkCyxA5i8vQO3tL0ACrzJA1w0uQAKvMkBE4TRA1w0uQOYvL0ACrzJA/eYvQEThNEA3UjZAk9M2QP3mL0A3UjZAQM4qQP3mL0CT0zZA/eYvQEDOKkCykyxA1w0uQP3mL0CykyxAROE0QP3mL0DXDS5ARBAxQEDOKkDkCyxAk9M2QOQLLEBAzipAk9M2QEQQMUDkCyxARBAxQJPTNkBE4TRAQM4qQEThNEDt7S9AQM4qQEQQMUBE4TRAvDEgQFevHkB+GB1AtH0hQH4YHUCPOhtAtH0hQLwxIEB+GB1A4mUfQI86G0BiHhlA5MsWQOJlH0BiHhlA41wjQOJlH0DkyxZA4mUfQONcI0DijSJAtH0hQOJlH0DijSJAjzobQOJlH0C0fSFAspMsQEDOKkCMkSlA1w0uQIyRKUAT3ydA1w0uQLKTLECMkSlA5wosQBPfJ0DhxyVA41wjQOcKLEDhxyVA7e0vQOcKLEDjXCNA5wosQO3tL0DmLy9A1w0uQOcKLEDmLy9AE98nQOcKLEDXDS5A4o0iQONcI0DhxyVAtH0hQOHHJUAT3ydAtH0hQOKNIkDhxyVAqFgjQBPfJ0CMkSlAQM4qQKhYI0CMkSlAV68eQKhYI0BAzipAqFgjQFevHkC8MSBAtH0hQKhYI0C8MSBAE98nQKhYI0C0fSFAc5ImQNarIUBG5yBAQM4qQEbnIEBXrx5AQM4qQHOSJkBG5yBA",H="2w/JP9sPyT/MMeI/2DPjP8wx4j+1U/s/zDHiP9gz4z/bD8k/2DPjP9sPyT/bD8k/bKn/P7VT+z/lOgpAKfkMQOU6CkDkyxZA5ToKQCn5DEBsqf8/KfkMQFQ0AkBsqf8/bKn/P1Q0AkADjuY/2DPjPwOO5j/bD8k/A47mP9gz4z9sqf8/2DPjP7VT+z9sqf8/QpLqP9sPyT/bD8k/A47mP9sPyT/bD8k/2w/JPwOO5j9Ckuo/A47mP1Q0AkBCkuo/n54gQOTLFkDjXCNAEsMtQONcI0Dt7S9A41wjQBLDLUCfniBAEsMtQHRjK0CfniBATOY1QO3tL0BwNjZA4n48QEzmNUBwNjZA3P07QEzmNUDifjxAWJk/QOJ+PEAgoz9ATsdCQFiZP0Agoz9AprdCQFiZP0BOx0JAkutFQNsPSUDT5UVATsdCQNPlRUCmt0JATsdCQJLrRUDT5UVA5t1FQKa3QkDT5UVA2w9JQNPlRUDbD0lA2w9JQObdRUDT5UVA5t1FQNsPSUD2y0VAgIdCQObdRUD2y0VAprdCQObdRUCAh0JAs0I/QNz9O0B2YT9AgIdCQHZhP0Cmt0JAgIdCQLNCP0B2YT9AWJk/QKa3QkB2YT9A4n48QHZhP0Dc/TtA4n48QFiZP0B2YT9AhB8/QNz9O0CzQj9AgIdCQIQfP0CzQj9AVlVCQIQfP0CAh0JA9stFQNsPSUCkvUVAgIdCQKS9RUBWVUJAgIdCQPbLRUCkvUVA2KNFQFZVQkCkvUVA2w9JQKS9RUDbD0lA2w9JQNijRUCkvUVA2KNFQNsPSUDcZ0VAAbpBQNijRUDcZ0VAVlVCQNijRUABukFAVwc+QMZQOkDuaT5AAbpBQO5pPkBWVUJAAbpBQFcHPkDuaT5AhB8/QFZVQkDuaT5A3P07QO5pPkDGUDpA3P07QIQfP0DuaT5AAdQzQMZQOkDC2zJAdGMrQAHUM0DC2zJAEsMtQAHUM0B0YytAAdQzQBLDLUBu4jRA3P07QAHUM0Bu4jRAxlA6QAHUM0Dc/TtATOY1QNz9O0Bu4jRAEsMtQEzmNUBu4jRA7e0vQEzmNUASwy1A+A48QKdOOEAwjDxAwsJAQPgOPEAwjDxAaRRAQPgOPEDCwkBAnO9EQNsPSUBtxERAwsJAQG3EREBpFEBAwsJAQJzvREBtxERANmdEQGkUQEBtxERA2w9JQG3EREDbD0lA2w9JQDZnREBtxERAhHwxQHRjK0DC2zJAxlA6QIR8MUDC2zJAp044QIR8MUDGUDpA1BlFQNsPSUCc70RAwsJAQNQZRUCc70RAJFZBQNQZRUDCwkBAMIw8QKdOOEBP+jxAwsJAQE/6PEAkVkFAwsJAQDCMPEBP+jxApb89QCRWQUBP+jxAxlA6QE/6PECnTjhAxlA6QKW/PUBP+jxApb89QMZQOkBXBz5AAbpBQKW/PUBXBz5AJFZBQKW/PUABukFA3GdFQNsPSUDqTUVAAbpBQOpNRUAkVkFAAbpBQNxnRUDqTUVA1BlFQCRWQUDqTUVA2w9JQOpNRUDbD0lA2w9JQNQZRUDqTUVANmdEQNsPSUDGCURAUaA+QDZnREDGCURAaRRAQDZnREBRoD5AMtA4QCqbMkCGEDpAUaA+QIYQOkBpFEBAUaA+QDLQOECGEDpA+A48QGkUQECGEDpAp044QIYQOkAqmzJAp044QPgOPECGEDpAbysqQCqbMkAUJSVA5MsWQG8rKkAUJSVABW4jQG8rKkDkyxZAbysqQAVuI0CHLy5Ap044QG8rKkCHLy5AKpsyQG8rKkCnTjhAhHwxQKdOOECHLy5AdGMrQIcvLkAFbiNAdGMrQIR8MUCHLy5AwykKQOTLFkA7+fU/QpLqPzv59T/bD8k/O/n1P0KS6j/DKQpAQpLqP1Q0AkDDKQpAwykKQFQ0AkDkyxZABW4jQOTLFkB0YytA5MsWQAVuI0DDKQpABW4jQOTLFkDDKQpAKfkMQOTLFkCfniBA5MsWQJ+eIEB0YytAn54gQOTLFkAp+QxA5MsWQFQ0AkAp+QxA2w/JP9sPyT+9ffI/2w/JP7198j/kyxZA2w/JP9sPyT+9ffI/5MsWQOTLFkDqWDRA2w9JQOTLFkDqWDRAAAAAAOTLFkDbD0lA5MsWQAAAAADbD8k/2w/JP+TLFkDbD8k/5MsWQOTLFkDbD8k/2w/JP9sPyT86OfM/2w/JPzo58z/kyxZA2w/JP9sPyT86OfM/giI5QNsPSUDqWDRATiYrQOpYNEDkyxZATiYrQIIiOUDqWDRA5MsWQOTLFkC9ffI/2w/JP+TLFkC9ffI/5MsWQOTLFkDbD8k/5MsWQOTLFkBpwh9ATiYrQOTLFkBpwh9A5MsWQOTLFkBOJitAacIfQOTLFkBQHiZATiYrQFAeJkAr+zNATiYrQGnCH0BQHiZArRk8QCv7M0B6oj9A2w9JQK0ZPEB6oj9A2w9JQK0ZPEDbD0lArRk8QNsPSUCCIjlATiYrQK0ZPECCIjlAK/szQK0ZPEBOJitA0AYDQNsPyT/bD8k/O/n1P9sPyT/bD8k/2w/JPzv59T/QBgNAO/n1P+TLFkDQBgNABYEfQPiQKkDkyxZA5MsWQOTLFkDQBgNA5MsWQAWBH0DkyxZATntAQNsPSUB6oj9Abnc4QHqiP0Ar+zNAbnc4QE57QEB6oj9ANWEuQCv7M0BQHiZA5MsWQDVhLkBQHiZA+JAqQDVhLkDkyxZANWEuQPiQKkCTJTFAbnc4QDVhLkCTJTFAK/szQDVhLkBudzhAA44KQNAGA0DkyxZA5MsWQOTLFkD4kCpA5MsWQAOOCkDkyxZAA44KQOTLFkA6OfM/0AYDQDo58z/bD8k/0AYDQAOOCkA6OfM/icY3QCqbMkAy0DhAbUI9QDLQOEBRoD5AbUI9QInGN0Ay0DhAkmhDQFGgPkDGCURA2w9JQJJoQ0DGCURA2w9JQJJoQ0DbD0lAkmhDQNsPSUAXCUNAbUI9QJJoQ0AXCUNAUaA+QJJoQ0BtQj1AkyUxQPiQKkC6UTNAbnc4QLpRM0DKWjtAbnc4QJMlMUC6UTNAslJBQMpaO0C4mUJA2w9JQLJSQUC4mUJA2w9JQLJSQUDbD0lAslJBQNsPSUBOe0BAbnc4QLJSQUBOe0BAylo7QLJSQUBudzhAFwlDQNsPSUC4mUJAbUI9QLiZQkDKWjtAbUI9QBcJQ0C4mUJAmoI2QMpaO0C6UTNA+JAqQJqCNkC6UTNAKpsyQJqCNkD4kCpAmoI2QCqbMkCJxjdAbUI9QJqCNkCJxjdAylo7QJqCNkBtQj1ABYEfQOTLFkAUJSVA+JAqQBQlJUAqmzJA+JAqQAWBH0AUJSVA";function j(e,t,s=new f.m){const i=Math.sin(e),n=Math.cos(e),r=Math.sin(t),a=Math.cos(t);return s.x=i*a,s.y=i*r,s.z=n,s}function W(e){const t=window.atob(e),s=t.length/Float32Array.BYTES_PER_ELEMENT,i=new DataView(new ArrayBuffer(Float32Array.BYTES_PER_ELEMENT)),n=new Float32Array(s);let r=0;for(let e=0;e<s;e++)r=4*e,i.setUint8(0,t.charCodeAt(r)),i.setUint8(1,t.charCodeAt(r+1)),i.setUint8(2,t.charCodeAt(r+2)),i.setUint8(3,t.charCodeAt(r+3)),n[e]=i.getFloat32(0,!0);return n}function Y(e,t,s,i=new f.n){return z.x=e,z.y=t,z.z=s,i.x=z.dot(f.m.RIGHT),i.y=z.dot(f.m.UP),i.z=z.dot(f.m.BACK),i.w=1,i}const K={loadSkyboxMesh(){const e=new i.b,t=W(G),s=W(H),n=t.length,r=8*n*3,a=3*n,o=4*n,h=y.a.getApplication().graphicsDevice,c=new Float32Array(r),d=new Float32Array(4*n*8),u=function(e,t){const s=new Uint16Array(e*t);for(let i=0;i<t;i++)for(let t=0;t<e;t++){const n=t+e*i;i%2==0?s[n]=n:(s[n]=n+2,s[n+2]=n,s[n+1]=n+1,t+=2)}return s}(630,8);for(let e=0;e<n;e++){j(t[e],s[e],k),k.y=(0,f.o)(k.y,0,1);const i=3*e,n=4*e;c[i]=k.x,c[i+1]=k.y,c[i+2]=k.z,Y(k.x,k.y,k.z,V),d[n]=V.x,d[n+1]=V.y,d[n+2]=V.z,d[n+3]=V.w,c[i+a]=-k.x,c[i+a+1]=k.y,c[i+a+2]=k.z,Y(-k.x,k.y,k.z,V),d[n+o]=V.x,d[n+o+1]=V.y,d[n+o+2]=V.z,d[n+o+3]=V.w,c[i+2*a]=-k.x,c[i+2*a+1]=k.y,c[i+2*a+2]=-k.z,Y(-k.x,k.y,-k.z,V),d[n+2*o]=V.x,d[n+2*o+1]=V.y,d[n+2*o+2]=V.z,d[n+2*o+3]=V.w,c[i+3*a]=k.x,c[i+3*a+1]=k.y,c[i+3*a+2]=-k.z,Y(k.x,k.y,-k.z,V),d[n+3*o]=V.x,d[n+3*o+1]=V.y,d[n+3*o+2]=V.z,d[n+3*o+3]=V.w,c[i+4*a]=-k.x,c[i+4*a+1]=-k.y,c[i+4*a+2]=k.z,Y(-k.x,-k.y,k.z,V),d[n+4*o]=V.x,d[n+4*o+1]=V.y,d[n+4*o+2]=V.z,d[n+4*o+3]=V.w,c[i+5*a]=-k.x,c[i+5*a+1]=-k.y,c[i+5*a+2]=-k.z,Y(-k.x,-k.y,-k.z,V),d[n+5*o]=V.x,d[n+5*o+1]=V.y,d[n+5*o+2]=V.z,d[n+5*o+3]=V.w,c[i+6*a]=k.x,c[i+6*a+1]=-k.y,c[i+6*a+2]=-k.z,Y(k.x,-k.y,-k.z,V),d[n+6*o]=V.x,d[n+6*o+1]=V.y,d[n+6*o+2]=V.z,d[n+6*o+3]=V.w,c[i+7*a]=k.x,c[i+7*a+1]=-k.y,c[i+7*a+2]=k.z,Y(k.x,-k.y,k.z,V),d[n+7*o]=V.x,d[n+7*o+1]=V.y,d[n+7*o+2]=V.z,d[n+7*o+3]=V.w}const _=[{semantic:l.c.SEMANTIC_POSITION,components:3,type:l.c.TYPE_FLOAT32},{semantic:l.c.SEMANTIC_TEXCOORD0,components:4,type:l.c.TYPE_FLOAT32}],m=c.length/3,p=new U.a(h,_),g=new M.a(h,p,m),E=new N.a(g);for(let e=0;e<m;e++)E.element[l.c.SEMANTIC_POSITION].set(c[3*e],c[3*e+1],c[3*e+2]),E.element[l.c.SEMANTIC_TEXCOORD0].set(d[4*e],d[4*e+1],d[4*e+2],d[4*e+3]),E.next();return E.end(),e.vertexBuffer=g,e.indexBuffer[0]=new B.a(h,l.c.INDEXFORMAT_UINT16,5040,l.c.BUFFER_STATIC,u.buffer),e.primitive[0].type=l.c.PRIMITIVE_TRIANGLES,e.primitive[0].base=0,e.primitive[0].count=u.length,e.primitive[0].indexed=!0,e.aabb.setToInfinity(),e}};var Q=s(23),X=s(14);const q={precisionCode:function(e){let t="precision "+e.precision+" float;\n";return e.webgl2&&(t+="#ifdef GL2\nprecision "+e.precision+" sampler2DShadow;\n#endif\n"),t},versionCode:function(e){return e.webgl2?"#version 300 es\n":""},dummyFragmentCode:function(){return"void main(void) {gl_FragColor = vec4(0.0);}"},begin:function(){return"void main(void)\n{\n"},end:function(){return"}\n"}};var $=s(27);const J={vertex_position:X.a.SEMANTIC_POSITION,vertex_normal:X.a.SEMANTIC_NORMAL,vertex_tangent:X.a.SEMANTIC_TANGENT,vertex_texCoord0:X.a.SEMANTIC_TEXCOORD0,vertex_texCoord1:X.a.SEMANTIC_TEXCOORD1,vertex_texCoord2:X.a.SEMANTIC_TEXCOORD2,vertex_texCoord3:X.a.SEMANTIC_TEXCOORD3,vertex_texCoord4:X.a.SEMANTIC_TEXCOORD4,vertex_texCoord5:X.a.SEMANTIC_TEXCOORD5,vertex_texCoord6:X.a.SEMANTIC_TEXCOORD6,vertex_texCoord7:X.a.SEMANTIC_TEXCOORD7,vertex_color:X.a.SEMANTIC_COLOR,vertex_boneIndices:X.a.SEMANTIC_BLENDINDICES,vertex_boneWeights:X.a.SEMANTIC_BLENDWEIGHT},Z={convolveLastMipOfCubemapPS:"#extension GL_EXT_shader_texture_lod : enable\nhighp vec4 sampleCubeLod(highp samplerCube sampler, highp vec3 coord, mediump float lod) {\n#if defined(GL_EXT_shader_texture_lod)\n return textureCubeLodEXT( sampler, coord, lod );\n#else\n return textureCube( sampler, coord, lod );\n#endif\n}\nuniform highp samplerCube _Cubemap_; \nuniform highp float _Level_; \nvoid main() { \n // just sample all directions (+X, -X etc) and average the result\n gl_FragColor = vec4(( \n sampleCubeLod( _Cubemap_, vec3( 1.0, 0.0, 0.0 ), _Level_ ) + \n sampleCubeLod( _Cubemap_, vec3( -1.0, 0.0, 0.0 ), _Level_ ) + \n sampleCubeLod( _Cubemap_, vec3( 0.0, 1.0, 0.0 ), _Level_ ) + \n sampleCubeLod( _Cubemap_, vec3( 0.0, -1.0, 0.0 ), _Level_ ) + \n sampleCubeLod( _Cubemap_, vec3( 0.0, 0.0, 1.0 ), _Level_ ) +\n sampleCubeLod( _Cubemap_, vec3( 0.0, 0.0, -1.0 ), _Level_ ) \n ) * 0.1666666667); \n}",convolveLastMipOfCubemapVS:"attribute vec2 vertex_position; \nvoid main() { \n gl_Position = vec4( vertex_position, 0.5, 1.0 ); \n}",fullscreenQuadVS:"attribute vec2 vertex_position;\nvarying vec2 vUv0;\nvoid main(void)\n{\n gl_Position = vec4(vertex_position, 0.5, 1.0);\n vUv0 = vertex_position.xy*0.5+0.5;\n}\n",gles3PS:"#define varying in\nout highp vec4 pc_fragColor;\n#define gl_FragColor pc_fragColor\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad\n#define GL2\n",gles3VS:"#define attribute in\n#define varying out\n#define texture2D texture\n#define GL2\n#define VERTEXSHADER\n"},ee={convolveLastMipOfCubemapPS:Z.convolveLastMipOfCubemapPS,convolveLastMipOfCubemapVS:Z.convolveLastMipOfCubemapVS,fullscreenQuadVS:Z.fullscreenQuadVS,gles3PS:Z.gles3PS,gles3VS:Z.gles3VS,collectAttribs(e){const t={};let s=0,i=e.indexOf("attribute");for(;i>=0&&!(i>0&&"/"===e[i-1]);){const n=e.indexOf(";",i),r=e.lastIndexOf(" ",n),a=e.substr(r+1,n-(r+1)),o=J[a];void 0!==o?t[a]=o:(t[a]="ATTR"+s,s++),i=e.indexOf("attribute",i+1)}return t},createShader(e,t,s,i=!1){let n=Z[t],r=q.precisionCode(e)+"\n"+Z[s];r=(0,$.c)(r);const o=this.collectAttribs(n);return e.webgl2&&(n=q.versionCode(e)+this.gles3VS+n,r=q.versionCode(e)+this.gles3PS+r),new a.a(e,{attributes:o,vshader:n,fshader:r,useTransformFeedback:i})},createShaderFromCode(e,t,s,i,n=!1,r=!0){const o=e.programLib._cache,h=o[i];if(void 0!==h)return h;s=q.precisionCode(e)+"\n"+(s||q.dummyFragmentCode()),s=(0,$.c)(s);const l=this.collectAttribs(t);return o[i]=new a.a(e,{attributes:l,vshader:t,fshader:s,useTransformFeedback:n},r),o[i]}};var te=s(41);const se=new Uint8Array([0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1]),ie=new f.m(1,1,-1),ne=new f.m(1,-1,-1);let re=null,ae=null,oe=null;class he{constructor(e,t,s){this.app=e,this.scene=t,this.renderSettings=s,this.defaultReflectionResolution=UnityEngine.RenderSettings._defaultReflectionResolution,this.indirectSpecular=new f.d(.4465786,.4964123,.5748172,1),this._meshInstance=null,this.environmentCubemap=null,this.isVisible=!1,this.matrix_projection=new f.i,this.matrix_view=new f.i,this.matrix_viewProjection=new f.i,this.sunPosition=new f.m,this.referenceAmbientProbe=s.referenceAmbientProbe,this.useReferenceAmbientProbe=s.useReferenceAmbientProbe,this.isDirty=!1}install(){oe=new d.a(UnityEngine.Graphics.graphicsDevice,{cubemap:!0,rgbm:!1,width:2,height:2,name:"SkyboxBlackCube"}),oe._levels[0]=[se,se,se,se,se,se],this.environmentCubemap=oe,this.scene.addSkybox(this)}get meshInstance(){if(this._meshInstance)return this._meshInstance;const e=new y.f;e.cullingLayer=-1;const t=new i.a(e,K.loadSkyboxMesh(),new p);t.cull=!1,t._shaderDefs=l.c.SHADERDEF_RENDERTYPE_BACKGROUND;const s=UnityEngine.RenderSettings._skybox;s&&s.handle&&(t.material=s.handle);return(new n.a).meshInstances=[t],e._sync(),this._meshInstance=t,this._meshInstance}update(){const e=UnityEngine.RenderSettings._skybox;if(!e||!e.handle)return this.indirectSpecular.set(0,0,0,1),void(this.isVisible=!1);this.isVisible=!0,this._meshInstance&&(this._meshInstance.material=e.handle),this.app.systems.reflectionprobe.scheduleProbeUpdate()}updateSkyDrawCall(e,t=!1){this.matrix_view.setTRS(f.m.ZERO,e._node.getRotation(),t?ne:ie).invert(),e._projection===l.c.PROJECTION_PERSPECTIVE?e._usePhysicalProperties?pc.Camera.calculateProjectionMatrixFromPhysicalProperties_Unity(this.matrix_projection,e._focalLength,e._sensorSize,e._lensShift,e._nearClip,e._farClip,e._aspect,e._gateFit):this.matrix_projection.setPerspective(e._fov,e._aspect,.01,1):this.matrix_projection.setPerspective(90,e._aspect,.01,1),this.matrix_viewProjection.mul2(this.matrix_projection,this.matrix_view),this.meshInstance.setParameter(this.app.renderer.unityIds.viewProjId.name,this.matrix_viewProjection.data);let s=UnityEngine.RenderSettings.sun;if(s&&0==(s._mask&l.c.MASK_DYNAMIC))s=s.handle;else{const e=this.app.systems.light.store,t=Object.keys(e);for(let i=0;i<t.length;i++){const n=e[t[i]],r=n.data;if(r.enabled&&n.entity.enabled&&"directional"===r.type){s=r.light;break}}}const i=s?s._node?s._node:s.entity:null;if(s&&i&&i.enabled)this.meshInstance.setParameter("_LightColor0",s.color.data),this.sunPosition.set(0,0,-1),i.transformDirection(this.sunPosition,this.sunPosition),this.meshInstance.setParameter("_WorldSpaceLightPos0",[this.sunPosition.x,this.sunPosition.y,this.sunPosition.z,0]);else{this.meshInstance.setParameter("_LightColor0",[0,0,0,0]);const e=this.app.isUrp?-1:0;this.meshInstance.setParameter("_WorldSpaceLightPos0",[0,0,e,0])}}getSkyDrawCall(e){return this.meshInstance}prepareEnvironmentReflectionsIfNeeded(){this.isDirty&&(this.bakeEnvironmentReflections(),this.isDirty=!1)}bakeEnvironmentReflections(){const e=this.defaultReflectionResolution||128;switch(UnityEngine.RenderSettings.defaultReflectionMode){case UnityEngine.Rendering.DefaultReflectionMode.Skybox:this.environmentCubemap=this.renderSettings.defaultReflection?this.renderSettings.defaultReflection.handle:this.bakeToCubemap(e);break;case UnityEngine.Rendering.DefaultReflectionMode.Custom:{const e=UnityEngine.RenderSettings.customReflection;this.environmentCubemap=(e?e.handle:null)||oe;break}}this.updateReflectionIntensity(),this.computeIndirectSpecular(),UnityEngine.LightmapSettings.reflectionProbes.environmentProbe.cubemap=this.environmentCubemap}updateReflectionIntensity(){this.environmentCubemap.intensity=UnityEngine.RenderSettings._reflectionIntensity}computeIndirectSpecular(){const e=UnityEngine.RenderSettings._reflectionIntensity;if(this.useReferenceAmbientProbe){const t=UnityEngine.Mathf.LinearToGammaSpace(this.referenceAmbientProbe.data[0]*e),s=UnityEngine.Mathf.LinearToGammaSpace(this.referenceAmbientProbe.data[9]*e),i=UnityEngine.Mathf.LinearToGammaSpace(this.referenceAmbientProbe.data[18]*e);this.indirectSpecular.set(t,s,i,e)}else{if(!this.environmentCubemap||this.environmentCubemap===oe)return;this.indirectSpecular.set(0,0,0,e);const t=this.app.graphicsDevice,s=Math.log(this.environmentCubemap.width)/Math.log(2)|0,i=t.activeFramebuffer;if(!re){const e=new d.a(t,{mipmaps:!1,width:1,height:1,format:l.c.PIXELFORMAT_R8_G8_B8_A8,name:"IndirectSpecularPixel"});re=new Q.a({depth:!1,colorBuffer:e})}ae||(ae=ee.createShaderFromCode(t,ee.convolveLastMipOfCubemapVS,ee.convolveLastMipOfCubemapPS,"convolveLastMipOfCubemap")),t.scope.resolve("_Cubemap_").setValue(this.environmentCubemap),t.scope.resolve("_Level_").setValue(s),(0,te.a)(t,re,ae);const n=re._colorBuffer.toBuffer();this.indirectSpecular.set(n[0],n[1],n[2],255).scale(1/255),t.setFramebuffer(i)}}bakeEnvironmentLighting(){UnityEngine.RenderSettings.ambientMode===UnityEngine.Rendering.AmbientMode.Skybox&&(this.update(),this.isVisible?(this.lightingCubemap=this.bakeToCubemap(8),this.lightingCubemap.sync(0)):this.lightingCubemap=null)}bakeToCubemap(e,t=new d.a(this.app.graphicsDevice,{cubemap:!0,rgbm:!1})){const s=this.app.graphicsDevice,i=new y.f,n=i.addComponent("camera",{projection:l.c.PROJECTION_ORTHOGRAPHIC,aspectRatio:1,orthoHeight:1});if(t._width=t._height=e,!this.isVisible)return t;const r=[[0,90,0],[0,-90,0],[-90,0,0],[90,0,0],[0,0,0],[0,180,0]];for(let e=0;e<6;e++)i.setLocalEulerAngles(r[e][0],r[e][1],r[e][2]),i._sync(),this.updateSkyDrawCall(n.camera,!0),n.renderTarget=new Q.a({colorBuffer:t,face:e,depth:!1}),this.app.renderer.setCamera(n.camera,n.renderTarget,!0),this.app.renderer.renderMeshInstance(new u.a,null,n.camera,this.meshInstance,[]);return s.gl.generateMipmap(t._glTarget),t.markUploaded(),t}}class le{constructor(e){this._device=e,this._cache={},this._generators={},this._isClearingCache=!1}register(e,t){this._generators[e]=t}clearCache(){const e=this._cache;this._isClearingCache=!0;for(const t in e)e.hasOwnProperty(t)&&e[t].destroy();this._cache={},this._isClearingCache=!1}removeFromCache(e){if(this._isClearingCache)return;const t=this._cache;for(const s in t)if(t.hasOwnProperty(s)&&t[s]===e){delete t[s];break}}}class ce{constructor(){this.globalId=0,this.revision=0}equals(e){return this.globalId===e.globalId&&this.revision===e.revision}notequals(e){return this.globalId!==e.globalId||this.revision!==e.revision}copy(e){this.globalId=e.globalId,this.revision=e.revision}reset(){this.globalId=0,this.revision=0}}class de{constructor(e,t,s,i){this.locationId=i,this.scopeId=e.scope.resolve(t),this.version=new ce,s===l.c.UNIFORMTYPE_FLOAT&&"[0]"===t.substr(t.length-3)&&(s=l.c.UNIFORMTYPE_FLOATARRAY),this.dataType=s,this.value=null,this.dataType===l.c.UNIFORMTYPE_VEC2?this.value=[null,null]:this.dataType===l.c.UNIFORMTYPE_VEC3?this.value=[null,null,null]:this.value=[null,null,null,null],this.array=[],this.slot=-1,this.meta=null}}let ue=0;class _e{constructor(){ue++,this.version=new ce,this.version.globalId=ue}increment(){this.version.revision++}}class me{constructor(e){this.name=e,this.value=null,this.previous_value=null,this.versionObject=new _e}setValue(e){this.value=e,this.previous_value=null,this.versionObject.increment()}pushValue(e){if(this.previous_value)throw new Error("pushValue is limited to storing 1 previous value");const t=this.value;this.setValue(e),this.previous_value=t}popValue(){this.setValue(this.previous_value)}getValue(){return this.value}}class pe{constructor(e){this.name=e,this.variables={}}resolve(e){return this.variables.hasOwnProperty(e)||(this.variables[e]=new me(e)),this.variables[e]}}class ge{constructor(e){this.device=e,this.vertexArrayObject=null,this.usedInFrame=0,this.indexBuffer=null,this.vertexBuffer=null,this.attributes=new Array(16);for(let e=0;e<this.attributes.length;e++){const t={size:0,type:0,normalized:!1,stride:0,offset:0,divisor:0,enabled:!1,buffer:null};this.attributes[e]=t}}applyFrom(e){const t=UnityEngine.Graphics.graphicsDevice,s=t.gl;e.indexBuffer!==this.indexBuffer&&(this.indexBuffer=e.indexBuffer,s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,this.indexBuffer)),this.vertexBuffer=null;const i=this.attributes.length>t.maxVertexAttributes?t.maxVertexAttributes:this.attributes.length;for(let n=0;n<i;n++){const i=this.attributes[n],r=e.attributes[n];r.enabled!==i.enabled&&(r.enabled&&!i.enabled?s.enableVertexAttribArray(n):!r.enabled&&i.enabled&&s.disableVertexAttribArray(n),i.enabled=r.enabled),i.enabled&&(i.buffer===r.buffer&&i.size===r.size&&i.type===r.type&&i.normalized===r.normalized&&i.stride===r.stride&&i.offset===r.offset||(this.vertexBuffer!==r.buffer&&(this.vertexBuffer=r.buffer,s.bindBuffer(s.ARRAY_BUFFER,this.vertexBuffer)),i.buffer=r.buffer,i.size=r.size,i.type=r.type,i.normalized=r.normalized,i.stride=r.stride,i.offset=r.offset,s.vertexAttribPointer(n,i.size,i.type,i.normalized,i.stride,i.offset)),t.extInstancing&&i.divisor!==r.divisor&&(i.divisor=r.divisor,s.vertexAttribDivisor(n,i.divisor)))}}}class fe{constructor(e,t=60){this.device=e,this.stateFrameLifetime=t,this.currentFrame=0,this.boundVertexArrayObject=null,this.globalState=new ge(this.device),this.temporaryState=new ge(this.device),this.map=new Map}get vertexArrayObjectSupported(){return this.device.extVertexArrayObject}enableVertexAttribArray(e){this.temporaryState.attributes[e].enabled=!0}disableVertexAttribArray(e){this.temporaryState.attributes[e].enabled=!1}vertexAttribPointer(e,t,s,i,n,r){const a=this.temporaryState.attributes[e];a.size=t,a.type=s,a.normalized=i,a.stride=n,a.offset=r,a.buffer=this.temporaryState.vertexBuffer}vertexAttribDivisor(e,t){this.temporaryState.attributes[e].divisor=t}bindBuffer(e,t){const s=this.device.gl;switch(e){case s.ARRAY_BUFFER:this.temporaryState.vertexBuffer=t;break;case s.ELEMENT_ARRAY_BUFFER:this.temporaryState.indexBuffer=t}}applyState(e){if(this.vertexArrayObjectSupported){const t=this.map.get(e)||new ge(this.device);this.map.set(e,t);const s=this.device.gl;return t.vertexArrayObject||(t.vertexArrayObject=s.createVertexArray()),this.boundVertexArrayObject!==t.vertexArrayObject&&(this.boundVertexArrayObject=t.vertexArrayObject,s.bindVertexArray(t.vertexArrayObject)),t.usedInFrame=this.currentFrame,t.applyFrom(this.temporaryState),t.vertexArrayObject}return this.globalState.applyFrom(this.temporaryState),null}unbindVertexArrayObject(){if(this.boundVertexArrayObject){this.device.gl.bindVertexArray(null),this.boundVertexArrayObject=null}}cleanup(e){if(this.currentFrame=e,this.currentFrame%this.stateFrameLifetime==0)for(const e of this.map.keys()){const t=this.map.get(e);if(this.currentFrame-t.usedInFrame>=this.stateFrameLifetime){if(t.vertexArrayObject){this.device.gl.deleteVertexArray(t.vertexArrayObject)}this.map.delete(e)}}}disableAllAttributes(){const e=Math.min(this.device.maxVertexAttributes,this.temporaryState.attributes.length);for(let t=0;t<e;t++)this.temporaryState.attributes[t].enabled=!1}}const ye="resizecanvas",Ee=new Float32Array([1,1,1,1]),Te=new Float32Array([0,0,0,0]),Se=new Float32Array([0,0,0,1]),Ae=new Float32Array([1,0,0,1]),be=new Float32Array([0,0,1,1]),Ce=function(e,t){const s=e.width,i=e.height;if(s>t||i>t){const n=t/Math.max(s,i),r=Math.floor(s*n),a=Math.floor(i*n);UnityEngine.Debug.LogWarning$1("Image dimensions larger than max supported texture size of "+t+". Resizing from "+s+", "+i+" to "+r+", "+a+".");const o=document.createElement("canvas");o.width=r,o.height=a;return o.getContext("2d").drawImage(e,0,0,s,i,0,0,r,a),o}return e};function we(e,t){let s=!0;const i=e.createTexture();e.bindTexture(e.TEXTURE_2D,i),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,2,2,0,e.RGBA,t,null);const n=e.createFramebuffer();return e.bindFramebuffer(e.FRAMEBUFFER,n),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,i,0),e.checkFramebufferStatus(e.FRAMEBUFFER)!==e.FRAMEBUFFER_COMPLETE&&(s=!1),e.bindTexture(e.TEXTURE_2D,null),e.deleteTexture(i),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteFramebuffer(n),s}var xe=s(20),Re=s(26);const Ie=[new f.l(0,1),new f.l(1,1),new f.l(0,0),new f.l(1,0)],Me=[0,1,2,2,1,3],Pe=[0,1,5,5,4,0,1,2,6,6,5,1,2,3,7,7,6,2,4,5,9,9,8,4,5,6,10,10,9,5,6,7,11,11,10,6,8,9,13,13,12,8,9,10,14,14,13,9,10,11,15,15,14,10],ve=[!0,!1,!1,!1,!1,!1,!0,!1,!1,!1],De=(e,t,s,i,n,r)=>{e[t]=s,e[t+1]=i,e[t+2]=0,e[t+3]=n,e[t+4]=r},Oe=(e,t,s)=>{if(e<=t)return 1;{const i=e/t,n=Math.ceil(i)-i<1e-5?Math.ceil(i):i;return Math.floor(e%t/t/t<s?n:n+1)}},Le=(e,t,s)=>{const i=s.x,n=s.y,r=.5*i,a=.5*n,o=e.pivotNormalized,h=new f.l(o.x*i,o.y*n),l=e.getBorderUnits(),c=e.getInnerUvRect(),d=e.getOuterUvRect(),u=new f.l(i-l.x-l.z,n-l.y-l.w),_=i>l.x+l.z?[-h.x,-h.x+l.x,-h.x+l.x+u.x,-h.x+i]:[-h.x,-h.x+r,-h.x+r,-h.x+i],m=n>l.y+l.w?[-h.y,-h.y+l.y,-h.y+l.y+u.y,-h.y+n]:[-h.y,-h.y+a,-h.y+a,-h.y+n],p=[d.x,c.x,c.z,d.z],g=[d.y,c.y,c.w,d.w],y=t.vertexBuffer;return((e,t,s,i,n)=>{for(let r=0;r<4;r++)for(let a=0;a<4;a++)De(e,5*(4*r+a),t[a],s[r],i[a],n[r])})(new Float32Array(y.storage),_,m,p,g),y.unlock(),t.recalculateBounds(),t},Fe=(e,t,s,n)=>{const r=new U.a(y.a.getApplication().graphicsDevice,[{semantic:l.c.SEMANTIC_POSITION,components:3,type:l.c.TYPE_FLOAT32},{semantic:l.c.SEMANTIC_TEXCOORD0,components:2,type:l.c.TYPE_FLOAT32}]),a=t.x,o=t.y,h=e.border,c=e.pixelSize,d=e.pixelsPerUnit,u=(new f.n).copy(h).scale(1/d),_=new f.l((c.x-h.x-h.z)/d,(c.y-h.y-h.w)/d),m=new f.l(a-u.x-u.z,o-u.y-u.w);let p,g=4,E=4;if(s===UnityEngine.SpriteTileMode.Continuous)g+=2*Math.max(0,Math.ceil(m.x/_.x)),E+=2*Math.max(0,Math.ceil(m.y/_.y)),p=new f.l(m.x%_.x,m.y%_.y);else if(s===UnityEngine.SpriteTileMode.Adaptive){const e=Oe(m.x,_.x,n);_.x=m.x/e,g+=Math.max(0,2*e);const t=Oe(m.y,_.y,n);_.y=m.y/t,E+=Math.max(0,2*t),p=_}const T=g*E,S=(g-1)*(E-1)*6,A=new B.a(y.a.getApplication().graphicsDevice,l.c.INDEXFORMAT_UINT16,S);let b=0;const C=new Uint16Array(A.lock());for(let e=0;e<E-1;e++)for(let t=0;t<g-1;t++){const s=e*g+t;C[b++]=s,C[b++]=s+1,C[b++]=s+g,C[b++]=s+1,C[b++]=s+1+g,C[b++]=s+g}A.unlock(),A.preventDestroy=!0;const w=new Float32Array(5*T),x=new M.a(y.a.getApplication().graphicsDevice,r,0);x.storage=w.buffer,x.numVertices=T,x.unlock();const R=new i.b;return R.vertexBuffer=x,R.indexBuffer[0]=A,R.primitive[0].type=l.c.PRIMITIVE_TRIANGLES,R.primitive[0].base=0,R.primitive[0].count=S,R.primitive[0].indexed=!0,R.aabb=new f.b(new f.m(e.aabb[0],e.aabb[1],e.aabb[2]),new f.m(a/2,o/2,e.aabb[5])),R.subMeshes=[R],((e,t,s,i,n,r,a)=>{const o=s.x,h=s.y,l=new f.l(e.pivotNormalized.x*o,e.pivotNormalized.y*h),c=e.border,d=e.borderUv,u=e.getBorderUnits(),_=e.getInnerUvRect(),m=e.getOuterUvRect(),p=new f.l(1-d.z-d.x,1-d.w-d.y),g=new f.l(o-u.x-u.z,h-u.y-u.w),y=new f.l(p.x*(a.x/r.x),p.y*(a.y/r.y));let E,T;const S=u.x+u.z;if(o>S)E=[-l.x,-l.x+u.x,-l.x+u.x+g.x,-l.x+o],T=[m.x,_.x,_.z,m.z];else{const e=c.x/(c.x+c.z)*o;E=[-l.x,-l.x+e,-l.x+e,-l.x+o];const t=o/S;T=[m.x,m.x+d.x*t,_.z,_.z+d.z*t]}let A,b;const C=u.y+u.w;if(h>C)A=[-l.y,-l.y+u.y,-l.y+u.y+g.y,-l.y+h],b=[m.y,_.y,_.w,m.w];else{const e=h/C,t=c.y/(c.y+c.w)*h;A=[-l.y,-l.y+t,-l.y+t,-l.y+h],b=[m.y,m.y+d.y*e,_.w,_.w+d.w*e]}const w=t.vertexBuffer,x=new Float32Array(w.storage);let R=0,I=0,M=0;const P=new f.l(E[0],A[0]);for(let e=0;e<n;e++){let t=0;for(0===e?(t=b[0],P.y=A[0]):1===e?(t=b[1],P.y=A[1]):e===n-3?(t=b[1]+y.y,P.y=A[2]):e===n-2?(t=b[2],P.y=A[2]):e===n-1?(t=b[3],P.y=A[3]):t=e%2==0?b[1]:b[2],I=e*i,M=5*I,De(x,M,E[0],P.y,T[0],t),I+=1,M=5*I,De(x,M,E[1],P.y,T[1],t),P.x=E[1],R=2;R<i-4;R+=2)I=e*i+R,M=5*I,De(x,M,P.x,P.y,T[1],t),P.x+=R===i-4?a.x:r.x,I+=1,M=5*I,De(x,M,P.x,P.y,T[2],t);i>4&&(R=i-4,I=e*i+R,M=5*I,De(x,M,P.x,P.y,T[1],t),P.x+=a.x,I+=1,M=5*I,De(x,M,E[2],P.y,T[1]+y.x,t)),R=i-2,I=e*i+R,M=5*I,De(x,M,E[2],P.y,T[2],t),R=i-1,I=e*i+R,M=5*I,De(x,M,E[3],P.y,T[3],t),e===n-4?P.y+=a.y:e%2==0&&(P.y+=r.y)}w.unlock()})(e,R,t,g,E,_,p),R};class Ue{constructor(e){this.$id=0,this.attributes=e,this.$sprite=!0,this.mesh=null,this.rectWithTransparency=null,this.rectWithoutTransparency=null,this["__UnityEngine.Sprite"]=null,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"Sprite")}getName(){return this.attributes.name}getUvRect(){const e=this.textureRect,t=this.texture;return new f.n(e.x/t.width,e.y/t.height,(e.z-e.x)/t.width,(e.w-e.y)/t.height)}getInnerUvRect(){const e=this.uvRect,t=this.borderUv;return new f.n(e.x+t.x,e.y+t.y,e.x+e.z-t.z,e.y+e.w-t.w)}getOuterUvRect(){const e=this.uvRect;return new f.n(e.x,e.y,e.x+e.z,e.y+e.w)}getPivot(){return this.attributes.pivot}getPivotNormalized(){const e=this.attributes.nativeSize;return new f.l(this.attributes.pivot.x/e.x,this.attributes.pivot.y/e.y)}getAABB(){return this.attributes.aabb}getVertices(){const e=new Array(this.attributes.vertices.length/5);for(let t=0;t<e.length;t++)e[t]=new f.l(this.attributes.vertices[5*t],this.attributes.vertices[5*t+1]);return e}getTriangles(){return this.attributes.triangles}getTextureRect(){return this.attributes.textureRect}getTextureRectWithTransparency(){if(null===this.rectWithTransparency){const e=this.getTextureRect(),t=this.getTransparency();this.rectWithTransparency=new UnityEngine.Rect.$ctor1(0,0,e.z-e.x+t.x+t.z,e.w-e.y+t.y+t.w)}return this.rectWithTransparency}getTextureRectWithoutTransparency(){if(null===this.rectWithoutTransparency){const e=this.getTextureRect();this.rectWithoutTransparency=new UnityEngine.Rect.$ctor1(e.x,e.y,e.z-e.x,e.w-e.y)}return this.rectWithoutTransparency}getTextureRectBeforeResize(){return this.attributes.textureRectBeforeResize}getBorder(){return this.attributes.border}getBorderUnits(){const e=this.border,t=this.pixelsPerUnit;return(new f.n).copy(e).scale(1/t)}getBorderUv(){const e=this.uvRect,t=this.border,s=this.pixelSize;return new f.n(e.z*(t.x/s.x),e.w*(t.y/s.y),e.z*(t.z/s.x),e.w*(t.w/s.y))}getTexture(){return this.attributes.texture}getTransparency(){return this.attributes.transparency}getBounds(){return this.attributes.bounds}getPixelsPerUnit(){return this.attributes.pixelsPerUnit}getTextureRectOffset(){return this.attributes.textureRectOffset}getMesh(){return this.mesh||(this.mesh=this.attributes.vertices?(e=>{const t=new i.b,s=new Float32Array(e.attributes.vertices),n=e.attributes.vertices.length/5;return t.vertexBuffer=t.defaultVertexBuffer(ve,n,s.buffer),t.setIndicies(e.attributes.triangles,UnityEngine.MeshTopology.Triangles,0,!0,0),t})(this):(e=>{const t=new i.b,s=e.pixelsPerUnit,n=e.pixelSize,r=e.getPivotNormalized(),a=new f.m(-r.x*n.x/s,-r.y*n.y/s,0),o=new f.m((1-r.x)*n.x/s,(1-r.y)*n.y/s,0),h=[new f.m(a.x,o.y,0),new f.m(o.x,o.y,0),new f.m(a.x,a.y,0),new f.m(o.x,a.y,0)];return t.setVectorStream({_items:h,_size:h.length,Count:h.length},l.c.SEMANTIC_POSITION,3),t.setVectorStream({_items:Ie,_size:Ie.length,Count:Ie.length},l.c.SEMANTIC_TEXCOORD0,2),t.setIndicies(Me,UnityEngine.MeshTopology.Triangles,0,!0,0),t})(this)),this.mesh}get9SlicedMesh(e){return((e,t)=>{const s=new i.b,n=new Float32Array(80);return s.vertexBuffer=s.defaultVertexBuffer(ve,16,n.buffer),s.setIndicies(Pe,UnityEngine.MeshTopology.Triangles,0,!1,0),Le(e,s,t)})(this,e)}updateMesh(e,t){return Le(this,e,t)}get9TiledMesh(e,t,s){return Fe(this,e,t,s)}updateMeshTiled(e,t){return Le(this,e,t)}get pivotNormalized(){return this.getPivotNormalized()}get pivot(){return this.getPivot()}get aabb(){return this.getAABB()}get transparency(){return this.getTransparency()}get textureRect(){return this.getTextureRect()}get textureRectBeforeResize(){return this.getTextureRect()}get pixelsPerUnit(){return this.getPixelsPerUnit()}get texture(){return this.getTexture()}get border(){return this.getBorder()}get borderUv(){return this.getBorderUv()}get uvRect(){return this.getUvRect()}get vertices(){return this.getVertices()}get pixelSize(){return new f.l(this.textureRect.z,this.textureRect.w)}}Ue.create=(e,t,s,i,n,r,a)=>{const o=t.x,h=t.y,l=t.z,c=t.w,d=l/i,u=c/i,_=d/2,m=u/2,p=d*(s.x-o)/l,g=u*(s.y-h)/c;return new Ue({aabb:[0,0,0,_,m,0],border:a,bounds:[-p,-g,d-p,u-g],pixelsPerUnit:i,texture:e,textureRect:(new f.n).copy(t),textureRectBeforeResize:new f.n(o,h,l,c),transparency:new f.n(0,0,0,0),triangles:[0,1,2,2,1,3],vertices:[-p,u-g,0,o/e._width,(h+c)/e._height,d-p,u-g,0,(o+l)/e._width,(h+c)/e._height,-p,-g,0,o/e._width,h/e._height,d-p,-g,0,(o+l)/e._width,h/e._height],pivot:s.clone()})};class Be{constructor(e,t,s,i,n,r){this.mesh=e,this.matrix=t,this.material=s,this.submeshIndex=i,this.shaderPass=n,this.materialPropertyBlock=r}}const Ne={x:0,y:0,width:1,height:1},ke=new u.a,ze=new f.i;let Ve=null,Ge=null;const He=[],je={executeCommandBuffer:function(e){if(!e)return;Ve||(Ve=new y.f,Ve.name="CommandBufferDrawCall");const t=y.a.getApplication().renderer,s=t.device,n=e.renderTargetIdentifier.target["__UnityEngine.RenderTexture"].renderTarget;s.setRenderTarget(n),s.updateBegin(),s.setColorWrite(!0,!0,!0,!0),s.setDepthWrite(!0),t.setupViewport(Ne,n.width,n.height),e.view&&e.proj?ze.mul2(e.proj,e.view):ze.copy(UnityEngine.GL.matrix),t.viewProjId.setValue(ze.data),t.unityIds.viewProjId.setValue(ze.data);const r=e.clearCommand;r&&n&&t.clearTarget(n,r);for(let s=0;s<e.commands.length;s++){const n=e.commands[s],r=n.mesh,a=-1===n.submeshIndex?r.subMeshes:[r.subMeshes[n.submeshIndex]];for(let e=0;e<a.length;e++){const s=a[e];Ve.setWorldTransform(n.matrix),Ge?(Ge.node=Ve,Ge.mesh=s,Ge.material=n.material):Ge=new i.a(Ve,s,n.material);const r=n.materialPropertyBlock;r&&r.applyToMeshInstance(Ge),t.renderMeshInstance(ke,null,null,Ge,null)}}},drawMesh:function(e,t,s,n,r,a,o){if(!e)return;const h=e.subMeshes[a];if(!h)return void console.error("Submesh index in intermediate renderer is out of bounds");const l=pc.Application.getApplication().renderer;let c=He.pop();if(c)c.node.cullingLayer=n,c.node.setWorldTransform(t),c.mesh=h,c.material=s;else{const e=new pc.Entity;e.cullingLayer=n,e.setWorldTransform(t),c=new i.a(e,h,s)}o&&o.applyToMeshInstance(c),window.spector&&window.spector.setMarker("DrawMesh: material="+s.name+" shader="+s.shader.name);const d=r?String(r.$id):"allcameras";l.addProceduralDrawCallToQueue(c,d)},drawMeshNow:function(e,t,s){const n=UnityEngine.GL.SetPassMaterial;if(!n)return;const r=n.handle;if(!r)return;const a=e.subMeshes[s];if(!a)return void console.error("Submesh index in intermediate renderer is out of bounds");const o=pc.Application.getApplication().renderer,h=o.device,l=new pc.Entity;l.setWorldTransform(t);const c=new i.a(l,a,r),d=c;h.setVertexBuffer(a.vertexBuffer,0),h.setIndexBuffer(a.indexBuffer[0]),o.setMaterial(h,r),o.pushUniforms(h,d.parameters),o.setDrawCall(h,d),window.spector&&window.spector.setMarker("DrawMeshNow: material="+r.name+" shader="+r.shader.name),o.drawInstance(h,c,a,0,!0)},freeProceduralMeshInstance:function(e){e.parameters={},He.push(e)}};class We extends r.b{constructor(){super(),this.parametersCount=0}copyFromMeshInstance(e){for(const t in e.parameters)this.setParameter(t,this.cloneParameterData(e.parameters[t].data))}applyToMeshInstance(e){e.parameters={};for(const t in this.parameters)e.setParameter(t,this.cloneParameterData(this.parameters[t].data))}getParameter(e){const t=this.parameters[e];return t?this.cloneAsPlainArray(t.data):null}setParameter(e,t){this.parameters.hasOwnProperty(e)||this.parametersCount++,super.setParameter(e,this.cloneParameterData(t))}clear(){this.parameters={},this.parametersCount=0}cloneParameterData(e){return e instanceof Float32Array||Array.isArray(e)?new Float32Array(e):e}cloneAsPlainArray(e){return e instanceof Float32Array?e.slice():e}get isEmpty(){return 0===this.parametersCount}}var Ye=s(28),Ke=s(34);const Qe="unity_GUIZTestMode";class Xe{constructor(e){this.id=i.b.id++,this.entity=e.entity,this.parentScreen=e,this.renderers=[],this._depthConsumers=new Set,this.device=y.a.getApplication().graphicsDevice,this._renderer=y.a.getApplication().renderer,this.renderersDirty=!1,this._aabb=new f.b,this.node=e.entity,this.visible=!0,this.cull=!0,this.isCanvas=!0,this.isSortingGroup=!1,this._material=UnityEngine.Canvas.GetDefaultCanvasMaterial().handle,this._material.setParameter(Qe,l.c.FUNC_ALWAYS+1);const t=this._material.parameters[Qe];t.scopeId||(t.scopeId=this.device.scope.resolve(Qe)),this._mesh=null,this._nearestScreen=null,this.scene=y.a.getApplication().scene,this.visibleThisFrame=!0,this.zdist=0,this._shaderDefs=0,this.morphInstance=null,this._lightProbe=null,this.instancingData=null,this.skinInstance=null,this._flipFaces=!1,this.parameters={},this.stencilFront=null,this.stencilBack=null,this.constAttributes=null,this.isIndexBufferEmpty=!1,this.drawCalls=[],this.meshInstances=[],TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"CanvasMeshInstance")}uiElementsSort(e,t){return Ye.a.uiElementsSort(e.model,t.model)}collectNestedScreensRecursive(){return this.parentScreen.childScreens.reduce(((e,t)=>e=[...e,t.canvasMeshInstance,...t.canvasMeshInstance.collectNestedScreensRecursive()]),[])}render(e,t,s,i,n){y.d.instance.startSubSection(y.d.RENDER_UI),this.checkDirtyAndUpdateHierarchy(),this.drawCalls.length=0,this.meshInstances.length=0;const a=this.collectNestedScreensRecursive(),o=this.renderers,h=[];for(let e=0;e<o.length;e++){const t=o[e];if(!t.isCanvas&&(0===t._groupAlpha||t.culledByTransparency))continue;!t.isCanvas&&t.popMaterialCount>0&&h.push(t);const s=t.model.meshInstances;for(let e=0;e<s.length;e++){const t=s[e];(t.isCanvas||0!==t._mesh.primitive[0].count)&&(t.material&&this.meshInstances.push(t))}}s?E.a.cullUi(s,this.meshInstances,this.drawCalls):this.parentScreen.parentScreen?this.drawCalls=this.meshInstances:this.drawCalls=[...this.meshInstances,...a].sort(Ye.a.sortNestedOverlayCanvases);for(let e=0;e<h.length;e++){const t=h[e],s=this.getLastDrawChild(t.entity,this.drawCalls,0);if(s){const e=s.node._guid;this.scene.activeUiMasks[e]||(this.scene.activeUiMasks[e]=[]),this.scene.activeUiMasks[e].push(t)}}const c=this.parentScreen.screenType!==l.c.SCREEN_TYPE_SCREEN?l.c.FUNC_LESSEQUAL+1:l.c.FUNC_ALWAYS+1,d=this.drawCalls;for(let a=0;a<this.drawCalls.length;a++){const o=this.drawCalls[a];if(o.isCanvas){o.render(e,t,s,i,n);continue}y.d.instance.recordUiElements(),o.material.setParameter(Qe,c);const h=this.renderer.dynamicBatcher.getBatchGroup(d,a);if(h){this.device.geometryStateManager.unbindVertexArrayObject(),this.renderer.dynamicBatcher.updateBatchGroup(h);const i=o,a=i.mesh.vertexBuffer,c=i.mesh.indexBuffer[0],d=i.mesh.primitive[0];i.mesh.vertexBuffer=h.vertexBuffer,i.mesh.indexBuffer[0]=h.indexBuffer,i.mesh.primitive[0]=h.primitive,i.parameters[Ke.a]=new r.a(this.device.scope.resolve(Ke.a),h.matrices,0),i._shaderDefs|=l.c.SHADERDEF_BATCHING,this.renderer.renderMeshInstance(e,t,s,i,n),i.mesh.vertexBuffer=a,i.mesh.indexBuffer[0]=c,i.mesh.primitive[0]=d,delete i.parameters[Ke.a],i._shaderDefs&=~l.c.SHADERDEF_BATCHING}else this.renderer.renderMeshInstance(e,t,s,o,n);const u=this.scene.activeUiMasks[o.node._guid];if(u){for(let i=0;i<u.length;i++){const r=u[i],a=r._popMaterials,o=r.model.meshInstances[0];if(o)for(let i=0;i<a.length;i++){const r=a[i].handle;this.clearMask(e,t,s,o,n,r)}}this.scene.activeUiMasks[o.node._guid]=null}a+=(h?h.instances.length:1)-1}if(!this.parentScreen.parentScreen)for(const e in this.scene.activeUiMasks)this.scene.activeUiMasks[e]=null;y.d.instance.endSubSection(y.d.RENDER_UI)}getLastDrawChild(e,t,s){let i=null;const n=e.allChildren();for(let e=s+1;e<t.length;e++){const s=t[e],r=s.node;n.indexOf(r)>=0&&(i=s)}return i}clearMask(e,t,s,i,n,r){const a=i.material,o=i.parameters.hasOwnProperty("_ColorMask")?i.parameters._ColorMask.data:null;i.material=r,o&&(i.parameters._ColorMask.data=r.parameters._ColorMask.data),this.renderer.renderMeshInstance(e,t,s,i,n),i.material=a,o&&(i.parameters._ColorMask.data=o)}addRenderer(e){this.renderers.includes(e)||(this.renderers.push(e),this.renderersDirty=!0)}removeRenderer(e){this.renderers.includes(e)&&(this.renderers.splice(this.renderers.indexOf(e),1),this._depthConsumers.has(e)&&this._depthConsumers.delete(e),this.renderersDirty=!0)}tryAddDepthConsumer(e){let t=!1;for(let s=0;s<e.model.materials.length;s++){const i=e.model.materials[s];if(i&&i.shader&&i.shader.readDepth){this._depthConsumers.add(e),t=!0;break}}t||this._depthConsumers.delete(e),this._depthConsumers.size>0?this.scene.addCanvasDepthConsumer(this):this.scene.removeCanvasDepthConsumer(this)}checkDirtyAndUpdateHierarchy(){this.updateModel();for(let e=0;e<this.renderers.length;e++)this.renderers[e].applyColor();if(!this.renderersDirty)return;this.parentScreen.system._syncDrawOrder(),this.parentScreen._updateStencilParameters(),this.renderers.sort(this.uiElementsSort),this._aabb.setToInfinity();const e=this.renderers;for(let t=0;t<e.length;t++){const s=e[t].model.meshInstances;for(let e=0;e<s.length;e++)this._aabb.add(s[e].aabb)}this.renderersDirty=!1}updateModel(){const e=this.renderers;for(let t=0;t<e.length;t++){const s=e[t];s.isCanvas||s.model.update()}}configureLightmap(){throw new Error}hasUVChannel(e){if(!this._mesh)return!1;const t=this._mesh.vertexBuffer.format;switch(e){case l.c.SEMANTIC_TEXCOORD0:return t.hasUv0;case l.c.SEMANTIC_TEXCOORD1:return t.hasUv1;case l.c.SEMANTIC_TEXCOORD2:return t.hasUv2;case l.c.SEMANTIC_TEXCOORD3:return t.hasUv3;default:return!1}}get aabb(){return this.checkDirtyAndUpdateHierarchy(),this._aabb}get mesh(){return this._mesh}get sortingLayerIndex(){return this.parentScreen.sortingLayerIndex}get sortingOrder(){return this.parentScreen.sortingOrder}get drawOrder(){return this.parentScreen.drawOrder}get material(){return this._material}set material(e){this._material=e}get model(){return this.parentScreen}get renderer(){return this._renderer}}var qe=s(31),$e=s(12);class Je extends $e.a{constructor(){super(),this.meshFilter=null,this.code=new UnityEngine.MeshRenderer(this),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"MeshRendererComponent")}onEnable(){return!!super.onEnable()&&(this.updateMesh(),!0)}getMeshInstancesForRender(){return this.synchronizeWithEntity(),this.updateMesh(),this.model.update(),this.model.meshInstances}get meshInstances(){return this.getMeshInstancesForRender()}updateMesh(){this.meshFilter&&!this.meshFilter._destroyed||(this.meshFilter=this.entity.getUnityComponent("meshFilter"));const e=this.meshFilter?this.meshFilter.mesh:null;this.model.mesh!==e&&(this.model.mesh=e)}}class Ze extends $e.a{constructor(){super(),this.code=new UnityEngine.LineRenderer(this),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"LineRendererComponent")}onEnable(){return!!super.onEnable()&&(this.code.OnEnable(),!0)}}class et extends $e.a{constructor(){super(),this.code=new UnityEngine.SkinnedMeshRenderer(this),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"SkinnedMeshRendererComponent")}}const tt=new xe.a({func:l.c.FUNC_LESSEQUAL,ref:1,writeMask:255,readMask:255,zfail:l.c.STENCILOP_KEEP,zpass:l.c.STENCILOP_KEEP,fail:l.c.STENCILOP_KEEP}),st=new xe.a({func:l.c.FUNC_GREATER,ref:1,writeMask:255,readMask:255,zfail:l.c.STENCILOP_KEEP,zpass:l.c.STENCILOP_KEEP,fail:l.c.STENCILOP_KEEP});class it extends $e.a{constructor(){super(),this.code=new UnityEngine.SpriteRenderer(this),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"SpriteRendererComponent")}onEnable(){return!!super.onEnable()&&(this.updateStencil(),!0)}get meshInstances(){return super.getMeshInstancesForRender()}updateStencil(){if(this.code.maskInteraction===UnityEngine.SpriteMaskInteraction.None)this.model.stencil=null;else{const e=this.code.maskInteraction===UnityEngine.SpriteMaskInteraction.VisibleInsideMask;this.model.stencil=e?tt:st}}}class nt extends $e.a{constructor(){super(),this.code=new UnityEngine.TrailRenderer(this),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"TrailRendererComponent")}_queuesToSubscribe(){return["onUpdate"]}onEnable(){return!!super.onEnable()&&(this.code.OnEnable(),!0)}onUpdate(e){this.code.Update()}}const rt=new xe.a({func:l.c.FUNC_ALWAYS,ref:0,writeMask:255,readMask:255,zfail:l.c.STENCILOP_KEEP,zpass:l.c.STENCILOP_INCREMENT,fail:l.c.STENCILOP_KEEP}),at=new xe.a({func:l.c.FUNC_ALWAYS,ref:0,writeMask:255,readMask:255,zfail:l.c.STENCILOP_KEEP,zpass:l.c.STENCILOP_DECREMENT,fail:l.c.STENCILOP_KEEP});class ot extends $e.a{constructor(){super(),this.code=new UnityEngine.SpriteMask(this),this._sprite=null,this._alphaCutoff=.2,this._isCustomRangeActive=!1,this._frontSortingLayerID=0,this._frontSortingOrder=0,this._backSortingLayerID=-1e6,this._backSortingOrder=-1e3,this._spriteSortPoint=0,this._dirty=!0,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"SpriteMaskComponent")}get isCustomRangeActive(){return this._isCustomRangeActive}set isCustomRangeActive(e){this._isCustomRangeActive!==e&&(this._isCustomRangeActive=e,this._dirty=!0)}get alphaCutoff(){return this._alphaCutoff}set alphaCutoff(e){this._alphaCutoff!==e&&(this._alphaCutoff=e,this.model.setParameter("_Cutoff",this._alphaCutoff))}get frontSortingLayerID(){return this._frontSortingLayerID}set frontSortingLayerID(e){this._isCustomRangeActive&&this._frontSortingLayerID!==e&&(this._frontSortingLayerID=e,this._dirty=!0)}get frontSortingOrder(){return this._frontSortingOrder}set frontSortingOrder(e){this._isCustomRangeActive&&this._frontSortingOrder!==e&&(this._frontSortingOrder=e,this._dirty=!0)}get backSortingLayerID(){return this._backSortingLayerID}set backSortingLayerID(e){this._isCustomRangeActive&&this._backSortingLayerID!==e&&(this._backSortingLayerID=e,this._dirty=!0)}get backSortingOrder(){return this._backSortingOrder}set backSortingOrder(e){this._isCustomRangeActive&&this._backSortingOrder!==e&&(this._backSortingOrder=e,this._dirty=!0)}get sprite(){return this._sprite}set sprite(e){this._sprite!==e&&(this._sprite=e,this.model.setParameter("_MainTex",this._sprite.texture),this.model.mesh=this._sprite.getMesh())}onEnable(){return!!super.onEnable()&&(this.model._stencil=rt,this.model.setParameter("_Cutoff",this.alphaCutoff),!0)}updateMaskRange(){this._dirty&&(this.isCustomRangeActive?(this.model.meshInstances[0].sortingOrder=this.backSortingOrder,this.model.meshInstances[0].sortingLayerIndex=UnityEngine.SortingLayer.GetLayerValueFromID(this.backSortingLayerID),this.model.meshInstances[1].sortingOrder=this.frontSortingOrder,this.model.meshInstances[1].sortingLayerIndex=UnityEngine.SortingLayer.GetLayerValueFromID(this.frontSortingLayerID)):(this.model.meshInstances[0].sortingOrder=Number.MIN_SAFE_INTEGER,this.model.meshInstances[0].sortingLayerIndex=Number.MIN_SAFE_INTEGER,this.model.meshInstances[1].sortingOrder=Number.MAX_SAFE_INTEGER,this.model.meshInstances[1].sortingLayerIndex=Number.MAX_SAFE_INTEGER),this._dirty=!1)}changeStencilToAdditionalDrawCall(){return this.model.update(),this.model.meshInstances[1].stencilFront=at,this.model.meshInstances[1].stencilBack=at,this.updateMaskRange(),!0}getMeshInstancesForRender(){return this.model.mesh&&(this.model.mesh.subMeshes.length=2,this.model.mesh.subMeshes[1]=this.model.mesh.subMeshes[0],this.changeStencilToAdditionalDrawCall()),this.code.OnBeforeRender&&this.code.OnBeforeRender(),this.model.update(),this.model.meshInstances}get meshInstances(){return this.getMeshInstancesForRender()}}class ht extends y.j{constructor(e){super(e),this.id="renderer"}}const lt={findParentScreen:function(e){let t=e,s=null;for(;t;){if(t.screen){s=t.screen;break}t=t.parent}return s}},ct="_MainTex";let dt=0;class ut extends y.k{constructor(){super(),this.id=dt++,this.model=new n.a,this._color=new f.d(1,1,1,1),this._groupAlpha=1,this.code=new UnityEngine.CanvasRenderer(this),this._parentCanvas=null,this._showMaskGraphics=!0,this._absoluteDepth=0,this._hasPopInstruction=!1,this._popMaterialCount=0,this._popMaterials=[],this.mesh=null,this.isCanvas=!1,this._cullTransparentMesh=!1,this.cull=!1,this.culledByTransparency=!1,this["__UnityEngine.CanvasRenderer"]=this.code,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"CanvasRendererComponent")}get cullTransparentMesh(){return this._cullTransparentMesh}set cullTransparentMesh(e){this._cullTransparentMesh=e}get showMaskGraphics(){return this._showMaskGraphics}set showMaskGraphics(e){this._showMaskGraphics=e,this.model.setParameter("_ColorMask",e?15:0)}get absoluteDepth(){return this._absoluteDepth}set absoluteDepth(e){this._absoluteDepth=e}get hasPopInstruction(){return this._hasPopInstruction}set hasPopInstruction(e){this._hasPopInstruction=e}get popMaterialCount(){return this._popMaterialCount}set popMaterialCount(e){this._popMaterialCount=e}updateParentCanvas(){const e=this.findParentCanvas();this.reparentCanvas(e)}onEnable(){return this.updateParentCanvas(),super.onEnable()}onDisable(){return this.reparentCanvas(null),super.onDisable()}onScreenChanged(e){this.reparentCanvas(e)}onCanvasGroupChanged(){this.setGroupAlpha(UnityEngine.CanvasGroup.ExtractAlpha(this.entity.element._canvasGroups))}onAttached(){const e=this._entity;e.element||e.addComponent("element",{pivot:new f.l(.5,.5),anchor:new f.n(0,0,1,1),sizeDelta:new f.l(0,0),anchoredPosition:new f.l(0,0)});const t=e.element;t.events.on("set:stencillayer",this._onStencilLayerChange,this),t.events.on("set:draworder",this._onDrawOrderChange,this),this.model.element=t,this.model.entity=e}_onStencilLayerChange(e){const t=this.entity.element;this.model.stencil=t._getStencilParameters(),this.model.masksChildren&&this.model.setParameter("UNITY_UI_ALPHACLIP",1)}_onDrawOrderChange(e){const t=this._entity.element,s=t._nearestScreen;this.model.nearestScreen=s,this.model.element=t,this.model.drawOrder=e,s&&(this.model.sortingLayerIndex=s.sortingLayerIndex,this.model.sortingOrder=s.sortingOrder)}setTexture(e){e?this.model.setParameter(ct,e):this.model.deleteParameter(ct)}getTexture(){return this.model.getParameter(ct)}setColor(e){this._color.equals(e)||(this._color.copy(e),this.applyColor())}getColor(){return this._color}setMaterial(e,t){const s=this.model.materials;s[t]=e,this.model.materials=s,this._parentCanvas&&this._parentCanvas.canvasMeshInstance.tryAddDepthConsumer(this)}getMaterial(e){return this.model.materials?this.model.materials[e]:null}setMaterialCount(e){const t=this.model.materials||[];t.length=e,this.model.materials=t}getMaterialCount(){return this.model.materials?this.model.materials.length:0}setMesh(e){this.model.mesh=e,this.applyColor()}getMesh(){return this.model.mesh}findParentCanvas(){return lt.findParentScreen(this._entity)}addToParentCanvas(){this._parentCanvas&&!this._entity.isPrefab&&this._parentCanvas.canvasMeshInstance.addRenderer(this)}removeFromParentCanvas(){this._parentCanvas&&this._parentCanvas.canvasMeshInstance.removeRenderer(this)}reparentCanvas(e){if(!this.entity.enabled)return this.removeFromParentCanvas(),void(this._parentCanvas=null);if(e!==this._parentCanvas){this.removeFromParentCanvas();const t=this._parentCanvas?this._parentCanvas["__UnityEngine.Canvas"]:null;this._parentCanvas=e;const s=e?e["__UnityEngine.Canvas"]:null;this.enabled&&this.addToParentCanvas();const i=this.entity.element?this.entity.element["UnityEngine.UI.Graphic"]:null;this.entity.element._nearestScreen=e,i&&(i.m_canvas=s,i.OnCanvasChanged(t,s))}}setGroupAlpha(e){this._groupAlpha=e,this.applyColor()}applyColor(){const e=this.model.meshInstances;for(let t=0;t<e.length;t++){e[t]._shaderDefs|=l.c.SHADERDEF_UI}this.model.setParameter("_GroupAlpha",this._groupAlpha),this.model.setParameter("_CanvasColor",this._color.data),this.model.element&&this.model.element.color&&(this.culledByTransparency=this.cullTransparentMesh&&0===this.model.element.color.a)}setPopMaterial(e,t){this._popMaterials[t]||this._popMaterialCount++,this._popMaterials[t]=e}}class _t extends y.j{constructor(e){super(e),this.id="canvasRenderer"}}class mt extends y.k{constructor(){super(),this.id=0,this._mesh=null,this["__UnityEngine.MeshFilter"]=null,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"MeshFilterComponent")}get mesh(){return this._mesh}set mesh(e){this._mesh=e}}class pt extends y.j{constructor(e){super(e),this.id="meshFilter"}}class gt extends y.j{constructor(e){super(e),this.id="reflectionprobe",this.needsProbeUpdate=!1}scheduleProbeUpdate(){this.needsProbeUpdate=!0}onBeforeRender(e){this.needsProbeUpdate&&this.refreshReflectionProbes(),this.needsProbeUpdate=!1,super.onBeforeRender(e)}refreshReflectionProbes(){const e=this.app.systems.renderer._components;for(const t in e){if(!e.hasOwnProperty(t))continue;const s=e[t];s.enabled&&(s.code&&s.code.UpdateReflectionProbes())}}}class ft extends y.k{constructor(){super(),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"ReflectionProbeComponent")}onEnable(){return!!super.onEnable()&&(this.code.OnEnable(),!0)}onDisable(){return!!super.onDisable()&&(this.code.OnDisable(),!0)}onTransformChanged(){this.code.OnReflectionProbeChanged()}onBeforeRender(e){this.code.OnBeforeRender()}_queuesToSubscribe(){return["onBeforeRender"]}refreshReflectionProbes(){this.system.scheduleProbeUpdate()}}class yt{constructor(e){this.enabled=!0,this.component=e,this.light=null,this.type="directional",this.color=new f.d(1,1,1),this.intensity=1,this.castShadows=!1,this.range=10,this.outerConeAngle=45,this.shadowType=l.c.SHADOW_PCF3,this.cookie=null,this.cookieScale=null,this.mask=1,this.cullingMask=1,this.affectDynamic=!0,this.affectLightmapped=!1,this.isStatic=!1,this.renderMode=0,this.shadowsMode=T.shadowsMode,this.shadowStrength=T.shadowStrength,this.shadowBias=T.shadowBias,this.shadowNormalBias=T.shadowNormalBias,this.shadowResolution=T.shadowResolution}}class Et extends y.c{constructor(e,t){super(e,t),this.data=new yt(this),this["__UnityEngine.Light"]=null,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"LightComponent")}addLightToScene(){this.system.app.scene.addLight(this.light)}removeLightFromScene(){this.system.app.scene.removeLight(this.light)}onEnable(){this.light.enabled=!0,this.enabled&&this.entity.enabled&&this.addLightToScene()}onDisable(){this.light.enabled=!1,this.removeLightFromScene()}get enabled(){return this.data.enabled}set enabled(e){this.enabled!==e&&(this.data.enabled=e,this.onSetEnabled("enabled",!e,e))}get light(){return this.data.light}set light(e){this.data.light=e}get type(){return this.data.type}set type(e){const t=this.type;e!==t&&(this.data.type=e,this.system.changeType(this,t,e),this.enabled&&this.entity.enabled&&this.onEnable())}get color(){return this.data.color}set color(e){this.data.color=e,this.light.setColor(e)}get intensity(){return this.data.intensity}set intensity(e){this.intensity!==e&&(this.data.intensity=e,this.light.intensity=e)}get castShadows(){return this.data.castShadows}set castShadows(e){this.castShadows!==e&&(this.data.castShadows=e,this.light.castShadows=e)}get range(){return this.data.range}set range(e){this.range!==e&&(this.data.range=e,this.light.attenuationEnd=e)}get outerConeAngle(){return this.data.outerConeAngle}set outerConeAngle(e){this.outerConeAngle!==e&&(this.data.outerConeAngle=e,this.light.outerConeAngle=e)}get shadowType(){return this.data.shadowType}set shadowType(e){this.shadowType!==e&&(this.data.shadowType=e,this.light.shadowType=e)}get shadowsMode(){return this.data.shadowsMode}set shadowsMode(e){this.data.shadowsMode!==e&&(this.data.shadowsMode=e,this.light.shadowsMode=e)}get shadowStrength(){return this.data.shadowStrength}set shadowStrength(e){this.data.shadowStrength!==e&&(this.data.shadowStrength=e,this.light.shadowStrength=e)}get shadowBias(){return this.data.shadowBias}set shadowBias(e){this.shadowBias!==e&&(this.data.shadowBias=e,this.light.shadowBias=e)}get shadowNormalBias(){return this.data.shadowNormalBias}set shadowNormalBias(e){this.data.shadowNormalBias!==e&&(this.data.shadowNormalBias=e,this.light.shadowNormalBias=e)}get shadowResolution(){return this.data.shadowResolution}set shadowResolution(e){this.data.shadowResolution!==e&&(this.data.shadowResolution=e,this.light.shadowResolution=e)}get cookieScale(){return this.data.cookieScale}set cookieScale(e){this.data.cookieScale=e,this.light.cookieScale=e}get mask(){return this.data.mask}set mask(e){this.mask!==e&&(this.data.mask=e,this.light.mask=e)}get cullingMask(){return this.data.cullingMask}set cullingMask(e){this.cullingMask!==e&&(this.data.cullingMask=e,this.light.cullingMask=e)}get isStatic(){return this.data.isStatic}set isStatic(e){this.isStatic!==e&&(this.data.isStatic=e,this.light.isStatic=e)}get renderMode(){return this.data.renderMode}set renderMode(e){this.renderMode!==e&&(this.data.renderMode=e,this.light.renderMode=e)}get cookie(){return this.data.cookie}set cookie(e){this.cookie!==e&&(e&&(e.minFilter=l.c.FILTER_LINEAR),this.data.cookie=e,this.light.cookie=e)}get affectDynamic(){return this.data.affectDynamic}set affectDynamic(e){this.affectDynamic!==e&&(this.data.affectDynamic=e,e?this.light.mask|=l.c.MASK_DYNAMIC:this.light.mask&=~l.c.MASK_DYNAMIC,this.light.mask=this.light._mask)}get affectLightmapped(){return this.data.affectLightmapped}set affectLightmapped(e){this.affectLightmapped!==e&&(this.data.affectLightmapped=e,e?this.light.mask|=l.c.MASK_BAKED:this.light.mask&=~l.c.MASK_BAKED,this.light.mask=this.light._mask)}}const Tt={directional:l.c.LIGHTTYPE_DIRECTIONAL,point:l.c.LIGHTTYPE_POINT,spot:l.c.LIGHTTYPE_SPOT};class St extends y.b{constructor(e){super(e),this.id="light",this.ComponentType=Et}initializeComponentData(e,t){const s=new R;s.type=Tt[t.type],s._node=e.entity,s.renderMode=t.renderMode,s.range=t.range,s.affectLightmapped=t.affectLightmapped,e.data.light=s,void 0!==t.enabled&&(e.enabled=t.enabled),void 0!==t.light&&(e.light=t.light),t.type&&(e.type=t.type),void 0!==t.color&&(e.color=t.color),void 0!==t.intensity&&(e.intensity=t.intensity),void 0!==t.castShadows&&(e.castShadows=t.castShadows),void 0!==t.range&&(e.range=t.range),void 0!==t.outerConeAngle&&(e.outerConeAngle=t.outerConeAngle),void 0!==t.shadowType&&(e.shadowType=t.shadowType),void 0!==t.cookie&&(e.cookie=t.cookie),void 0!==t.cookieScale&&(e.cookieScale=t.cookieScale),void 0!==t.mask&&(e.mask=t.mask),void 0!==t.cullingMask&&(e.cullingMask=t.cullingMask),void 0!==t.affectDynamic&&(e.affectDynamic=t.affectDynamic),void 0!==t.affectLightmapped&&(e.affectLightmapped=t.affectLightmapped),void 0!==t.isStatic&&(e.isStatic=t.isStatic),void 0!==t.renderMode&&(e.renderMode=t.renderMode),void 0!==t.shadowsMode&&(e.shadowsMode=t.shadowsMode),void 0!==t.shadowStrength&&(e.shadowStrength=t.shadowStrength),void 0!==t.shadowBias&&(e.shadowBias=t.shadowBias),void 0!==t.shadowNormalBias&&(e.shadowNormalBias=t.shadowNormalBias),void 0!==t.shadowResolution&&(e.shadowResolution=t.shadowResolution),super.initializeComponentData(e,t)}removeComponent(e){e.light.data.light.destroy(),y.b.prototype.removeComponent.call(this,e)}changeType(e,t,s){t!==s&&(e.light.type=Tt[s])}}class At{constructor(e,t,s,i,n){this.font=e,this.fontSize=t,this.fontScale=s,this.color=i.clone(),this.fontStyle=n}init(e,t,s,i,n){this.font=e,this.fontSize=t,this.fontScale=s,this.color.copy(i),this.fontStyle=n}copy(e){this.font=e.font,this.fontSize=e.fontSize,this.fontScale=e.fontScale,this.color.copy(e.color),this.fontStyle=e.fontStyle}}class bt{constructor(e,t,s){this.text=e,this.width=t,this.fontScale=s}}class Ct{constructor(e=new f.m,t=0){this.cursorPos=e,this.charWidth=t}}class wt{constructor(e=0,t=0,s=0,i=0){this.startCharIdx=e,this.height=t,this.topY=s,this.leading=i}}const xt="msdf";class Rt{constructor(e,t){this.type=e&&e.type||xt,this.em=1,this.intensity=0,this._data=null,this.data=e,this._name=t.name||"",this._ascent=e.info.ascent||0,this._lineHeight=t.originalLineHeight||0,this._fontSize=e.info.fontSize||null,this._originalFontSize=t.originalFontSize||64,this._characterInfo=t.characterInfo||null,this._textures=t.texture||null}get name(){return this._name}get ascent(){return this._ascent}get lineHeight(){return this._lineHeight}get fontSize(){return this._fontSize}get characterInfo(){return this._characterInfo}get texture(){return this._textures}get data(){return this._data}set data(e){if(this._data=e,e)for(const e in this._data.chars)this._data.chars.hasOwnProperty(e)&&(this._data.chars[e].map=0)}}Rt.fonts={};const It=/<.[^>]*>/gm,Mt={size:"fontSize",color:"color",fontStyle:"fontStyle"},Pt={br:!0,quad:!0},vt={aqua:"#00ffffff",black:"#000000ff",blue:"#0000ffff",brown:"#a52a2aff",cyan:"#00ffffff",fuchsia:"#ff00ffff",green:"#008000ff",grey:"#808080ff",lightblue:"#add8e6ff",lime:"#00ff00ff",magenta:"#ff00ffff",maroon:"#800000ff",navy:"#000080ff",olive:"#808000ff",orange:"#ffa500ff",purple:"#800080ff",red:"#ff0000ff",silver:"#c0c0c0ff",teal:"#008080ff",white:"#ffffffff",yellow:"#ffff00ff"};class Dt{constructor(e,t){this.startIndex=e,this.foundTag=t,this.content="",this.isClosing=!1;const s=(t=t.substr(1,t.length-2)).split("=");let i=s[0];i=i.toLowerCase(),i.startsWith("/")&&(i=i.substr(1),this.isClosing=!0),this.tag=i;let n=s[1]?s[1]:null;if(n&&n.startsWith('"')&&n.endsWith('"')&&(n=n.substr(1,n.length-2)),n&&(n=n.toLowerCase()),this.value=n,this.colorValue=new f.d,this.intValue=0,!this.isClosing&&!this.isClosing)switch(this.tag){case"color":this.colorValue=this.parseColor(this.value,this.colorValue);break;case"size":this.intValue=Number.parseInt(this.value,10)}}apply(e,t,s){const i=Mt[this.tag];if(this.isClosing)switch(this.tag){case"color":e.color.copy(t.color);break;case"size":e.fontSize=t.fontSize,e.fontScale=t.fontScale;break;default:e[i]=t[i]}else switch(this.tag){case"color":e.color.copy(this.colorValue);break;case"size":e.fontSize=this.intValue,e.fontScale=e.fontSize/s;break;default:e[i]=this.intValue}}parseColor(e,t=new f.d){return e.startsWith("#")||(e=vt[e]),t.fromString(e),t}}Dt.tagRegex=It,Dt.supportedSingleTags=Pt,Dt.unityColorsMap=vt,Dt.removeTags=e=>e.replace(It,""),Dt.extractTags=(e,t)=>{const s=t._tags;s.length=0;let i=0,n=null;for(;n=It.exec(e);){const e=n[0],t=new Dt(n.index-i,e);i+=e.length,s.push(t)}const r=Dt.removeTags(e),a=Dt.validateTags(s,r);return t.areTagsValid=a,e=a?r:e},Dt.validateTags=(e,t)=>{if(0===e.length)return!0;const s=[];for(let i=0;i<e.length;i++){const n=e[i];if(!Pt[n.tag])if(n.isClosing){const e=s.pop();if(e.tag!==n.tag)return!1;n.content=t.substr(e.startIndex,n.startIndex-e.startIndex),e.content=t.substr(e.startIndex,n.startIndex-e.startIndex)}else s.push(n)}return 0===s.length};const Ot=11;let Lt=null;const Ft=[{semantic:l.c.SEMANTIC_POSITION,components:3,type:l.c.TYPE_FLOAT32},{semantic:l.c.SEMANTIC_TEXCOORD0,components:2,type:l.c.TYPE_FLOAT32},{semantic:l.c.SEMANTIC_TEXCOORD1,components:2,type:l.c.TYPE_FLOAT32},{semantic:l.c.SEMANTIC_COLOR,components:4,type:l.c.TYPE_FLOAT32}],Ut=new f.m,Bt=new f.m,Nt=new f.n;class kt{constructor(e){this._offset=new f.m,this._bakedOffset=new f.m,this._bounds=new f.l,this._metrics=new f.n,this.canvasRenderer=e,this._vertexCount=0,this._bufferSize=0,this._buffer=null,this._resizeBuffers(16),this._fontScale=0,this._bestFit=!1,this._font=null,this._maxFontSize=0,this._minFontSize=0,this._minFontSizeOriginal=0,this._maxFontSizeOriginal=0,this._horizontalWrap=!1,this._verticalOverflow=!1,this._lineHeight=0,this._lineSpacing=0,this._fontSize=0,this._textHeight=0,this._align=l.c.TEXT_ALIGN_CENTER,this._color=new f.d(1,1,1,1),this._verticalAlign="top",this._text="",this._dirtyVertices=!1,this._dirtyOffset=!1,this._lineCount=0,this._characters=[],this._lines=[],this._tags=[],this.areTagsValid=!0,this._defaultSettings=new At(null,0,0,new f.d,0),this._currentSettings=new At(null,0,0,new f.d,0),this._measureSettings=new At(null,0,0,new f.d,0),this._recursiveCounter=0,this._measures=null,this._recursiveLimit=10,this.graphicsDevice=y.a.getApplication().graphicsDevice,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"TextGenerator")}_reset(){this._bufferSize=0,this._buffer=new Float32Array(0)}_textIndexBuffer(){if(Lt)return Lt;Lt=new B.a(this.graphicsDevice,l.c.INDEXFORMAT_UINT16,32768);const e=new Uint16Array(Lt.lock());let t=0;for(let s=0;s<32762;s+=6)e[s+0]=t+3,e[s+1]=t+0,e[s+2]=t+1,e[s+3]=t+1,e[s+4]=t+3,e[s+5]=t+2,t+=4;return Lt.unlock(),Lt.preventDestroy=!0,Lt}populate(e,t){t.font?(this._updateSettings(t),this._updateText(e),t._dirtyOffset=this._dirtyOffset,t._dirtyVertices=this._dirtyVertices,this._dirtyVertices&&this._fillMesh(),this._dirtyOffset&&this._updateAligns()):this._vertexCount=0}updateMesh(e,t,s=f.m.ZERO){const i=this._vertexCount,n=e.vertexBuffer;for(let e=0;e<i;e++)this._buffer[11*e+0]+=s.x-this._bakedOffset.x,this._buffer[11*e+1]+=s.y-this._bakedOffset.y,this._buffer[11*e+2]+=s.z-this._bakedOffset.z;for(let e=0;e<this._lines.length;e++){this._lines[e].topY+=s.y-this._bakedOffset.y}for(let e=0;e<this._characters.length;e++){this._characters[e].cursorPos.sub(this._bakedOffset).add(s)}n.numVertices=i,n.storage=this._buffer.buffer,n.unlock(),e.primitive[0].type=l.c.PRIMITIVE_TRIANGLES,e.primitive[0].base=0,e.primitive[0].count=i/4*6,e.primitive[0].indexed=!0,e.indexBuffer[0]=this._textIndexBuffer(),this._bakedOffset.copy(s)}_updateAligns(e){e=e||this._measureText(this._text,void 0,!1);const t=this._font.data,s=this._lineHeight*this._fontScale,i=s+s/this._font.lineHeight*.5,n=Math.round(this._bounds.y/i),r=(this._verticalOverflow?e.length:Math.min(e.length,n>0?n:1))*i;let a=this._fontSize/t.info.fontSize;this._bestFit&&(a=this._minFontSize/t.info.fontSize);let o=-1;for(let t=0;t<e.length;t++)o=Math.max(e[t].width,o);this._metrics.set(Math.ceil(o/this._fontScale*a),Math.ceil(r/this._fontScale*a),Math.ceil(this._metrics.z),Math.ceil(this._metrics.w)),0===this._fontScale&&(this._metrics.x=0,this._metrics.y=0);const h=this._bounds.y;let c=0;switch(this._verticalAlign){case l.c.TEXT_VERTICAL_ALIGN_BOTTOM:c=h-r;break;case l.c.TEXT_VERTICAL_ALIGN_MIDDLE:c=.5*(h-r);break;case l.c.TEXT_VERTICAL_ALIGN_TOP:c=0}const d=h-c-i;this._offset.set(0,d,0),this._dirtyOffset=!1}applyTags(e,t,s,i){if(this.areTagsValid)for(let n=0;n<this._tags.length;n++){const r=this._tags[n];e===r.startIndex&&r.apply(t,s,i)}}_fillMesh(){this._characters.length=0,this._lines.length=0;const e=this._font.data;let t=this._text;t=t.replace(/\r\n/gm,"\n").replace(/\n\r/gm,"\n"),t=t.replace(/\t/gm," "),t=Dt.extractTags(t,this),this._bakedOffset.set(0,0,0);const s=this._font.fontSize,i=this._fontSize,n=this._font._originalFontSize;this._lineHeight=this._lineSpacing*this._font.lineHeight*(s/n),this._fontScale=i/s,0===this._recursiveCounter&&(this._measures=this._measureText(t,1e15,!1));let r=-1,a=0;for(let e=0;e<this._measures.length;e++)r=Math.max(r,this._measures[e].width),a+=this._lineHeight*this._measures[e].fontScale;let o=Math.min(this._bounds.x/r,this._bounds.y/a),h=Math.min(this._maxFontSize,s*o);this._metrics.set(0,0,r,a);const l=this._bestFit&&!this._verticalOverflow;if(l&&this._bounds.x>0){this._metrics.set(0,0,r/this._fontSize*this._maxFontSize,a/this._fontSize*this._maxFontSize);const s=t.split("\n").length;if(0===this._recursiveCounter){o=this._bounds.y/(s*this._lineHeight),h=e.info.fontSize*o;const t=Math.max(Math.min(this._maxFontSize,h),this._minFontSize);this._fontScale=t/e.info.fontSize}}if(this._horizontalWrap){if(this._recursiveCounter>=this._recursiveLimit)return;if(this._measures=this._measureText(t,this._bounds.x,!0),this.measureAlignment(),this._recursiveCounter+=1,l){this._maxFontSize-this._minFontSize>.051&&this._fontSize<this._maxFontSize&&(this._recursiveCounter-1==0?this._fontSize=this._minFontSize:this._minFontSize=this._fontSize,this._fontSize+=Math.max((this._maxFontSize-this._fontSize)/2,.05),this._fontSize=Math.floor(20*Math.min(this._fontSize,this._maxFontSize)+.5)/20,this._fillMesh())}}else this._measureText(t,1e15,!0),this.measureAlignment()}measureAlignment(){let e=0,t=0;let s=0;this._defaultSettings.init(this._font,this._fontSize,this._fontScale,this._color,0),this._currentSettings.init(this._font,this._fontSize,this._fontScale,this._color,0);const i=this._font.data;let n=0,r=0,a=0;if(null===this._measures)return;kt.missingCharactersLastCall="";let o=0;for(let h=0;h<this._measures.length;h++){const c=this._measures[h];switch(n=r,c.width>o&&(o=c.width),this._align){case l.c.TEXT_ALIGN_LEFT:e=0;break;case l.c.TEXT_ALIGN_CENTER:e=.5*(this._bounds.x-c.width);break;case l.c.TEXT_ALIGN_RIGHT:e=this._bounds.x-c.width}const d=this._lineHeight*this._currentSettings.fontScale,u=d/this._font.lineHeight*.5;let _=-(t-d);h>0&&!this._bestFit&&(_-=u);let m=0!==this._bounds.y?this._bounds.y:0;_===d&&0!==m&&1===this._measures.length&&(m+=1);const p=_>m,g=o>this._bounds.x;if(!this._verticalOverflow&&0!==this._bounds.y&&(p||this._bestFit&&g)){if(this._bestFit&&this._fontSize>this._minFontSizeOriginal&&(this._recursiveCounter>0||this._fontSize===this._maxFontSize)){if(this._maxFontSize=this._fontSize,this._fontSize-=Math.max((this._fontSize-this._minFontSize)/2,.05),this._fontSize=Math.floor(20*Math.max(this._fontSize,this._minFontSize)+.5)/20,this._recursiveCounter>=this._recursiveLimit)return;return void this._fillMesh()}0===h&&UnityEngine.Debug.LogWarning$1("[Rendering] Text will be hidden, as there are not enough space even for 1 line!\nSet BestFit or enable vertical overflow");continue}const y=d+u;t-=y-(this._lineHeight*this._measures[Math.max(h-1,0)].fontScale+u);for(let n=0;n<c.text.length;n++){this.applyTags(a,this._currentSettings,this._defaultSettings,i.info.fontSize);const o=c.text.charCodeAt(n);let h=0,l=0,d=0;const u=i.chars[o];if(!u){kt.missingCharactersLastCall+=String.fromCharCode(o);continue}h=u.xoffset*this._currentSettings.fontScale,l=u.yoffset*this._currentSettings.fontScale,d=u.xadvance*this._currentSettings.fontScale;const _=u.width*this._currentSettings.fontScale,m=u.height*this._currentSettings.fontScale,p=t+y,g=y;Ut.set(e+h,p-l-m,0),Bt.set(e+h+_,p-l,0),Nt.set(0,1-(l+m)/g,1,1-l/g),this.addCharToBuffer(s,Ut,Bt,u,Nt,this._currentSettings.color),this._characters.push(new Ct(new f.m(e+h,p-l-m,0).add(this._bakedOffset),_)),e+=d,s++,r++,a++}this._lines.push(new wt(n,y,t+this._bakedOffset.y+y,0)),t-=y,this.applyTags(a,this._currentSettings,this._defaultSettings,i.info.fontSize),a++}kt.missingCharactersLastCall.length>0&&console.warn("CanvasRenderer "+this.canvasRenderer.entity.name+" is missing characters to render: "+kt.missingCharactersLastCall+". Check if they are supported by Font "+this._font.name+" or included in Fonts Settings."),this._vertexCount=4*s,this._dirtyVertices=!1,this._updateAligns(this._measures),this._lineCount=this._measures.length}addCharToBuffer(e,t,s,i,n,r){const a=4*e,o=(a+0)*Ot,h=(a+1)*Ot,l=(a+2)*Ot,c=(a+3)*Ot;this._buffer[o]=t.x,this._buffer[o+1]=t.y,this._buffer[o+2]=t.z,this._buffer[o+3]=i.uvBottomLeft[0],this._buffer[o+4]=i.uvBottomLeft[1],this._buffer[o+5]=n.x,this._buffer[o+6]=n.y,this._buffer[o+7]=r.r,this._buffer[o+8]=r.g,this._buffer[o+9]=r.b,this._buffer[o+10]=r.a,this._buffer[h]=t.x,this._buffer[h+1]=s.y,this._buffer[h+2]=t.z,this._buffer[h+3]=i.uvTopLeft[0],this._buffer[h+4]=i.uvTopLeft[1],this._buffer[h+5]=n.x,this._buffer[h+6]=n.w,this._buffer[h+7]=r.r,this._buffer[h+8]=r.g,this._buffer[h+9]=r.b,this._buffer[h+10]=r.a,this._buffer[l]=s.x,this._buffer[l+1]=s.y,this._buffer[l+2]=t.z,this._buffer[l+3]=i.uvTopRight[0],this._buffer[l+4]=i.uvTopRight[1],this._buffer[l+5]=n.z,this._buffer[l+6]=n.w,this._buffer[l+7]=r.r,this._buffer[l+8]=r.g,this._buffer[l+9]=r.b,this._buffer[l+10]=r.a,this._buffer[c]=s.x,this._buffer[c+1]=t.y,this._buffer[c+2]=t.z,this._buffer[c+3]=i.uvBottomRight[0],this._buffer[c+4]=i.uvBottomRight[1],this._buffer[c+5]=n.z,this._buffer[c+6]=n.y,this._buffer[c+7]=r.r,this._buffer[c+8]=r.g,this._buffer[c+9]=r.b,this._buffer[c+10]=r.a}measureText(e,t,s){if(e=e||"",this._updateSettings(s),!this._font)return f.l.ZERO;const i=this._font.data;this._fontScale=this._fontSize/i.info.fontSize,e=Dt.removeTags(e);const n=this._measureText(e,t,!1);let r=-1;for(let e=0;e<n.length;e++)r=Math.max(r,n[e].width);const a=n.length*i.info.lineHeight*this._fontScale;return new f.l(r,a)}_measureText(e,t,s){const i=this._font.data,n=[],r=e.replace("\n\r","\n").replace("\r\n","\n").split(/\n/);let a="";const o=i.chars[" ".charCodeAt(0)];let h=o?o.xadvance*this._fontScale:0;this._defaultSettings.init(this._font,this._fontSize,this._fontScale,this._color,0),this._currentSettings.init(this._font,this._fontSize,this._fontScale,this._color,0),this._measureSettings.init(this._font,this._fontSize,this._fontScale,this._color,0);let l=0,c=0;const d={maxFontScale:0};this._measureSettings.copy(this._currentSettings);for(let e=0;e<r.length;e++){let u=r[e].split(" ");this._measureSettings.copy(this._currentSettings),u=this._checkBigWords(u,i,this._fontScale,t,l,this._measureSettings,this._defaultSettings,i.info.fontSize,s,this._bestFit);let _=0;for(let e=0;e<u.length;e++){const s=u[e],r=this._calculateWidth(s,i,this._fontScale,l,this._currentSettings,this._defaultSettings,i.info.fontSize,d);_>0&&_+r>t&&(h=o?o.xadvance*this._currentSettings.fontScale:0,a=a.substring(0,a.length-1),_-=h,n.push(new bt(a,_,c)),c=0,a="",_=0,l++),c=Math.max(c,d.maxFontScale),l+=s.length,a+=s+" ",h=o?o.xadvance*this._currentSettings.fontScale:0,_+=r+h,this.applyTags(l,this._currentSettings,this._defaultSettings,i.info.fontSize),l++}a=a.substring(0,a.length-1),_-=h,n.push(new bt(a,_,c)),c=0,a="",_=0}return n}getMeasuredText(e){return e.map((e=>e.text)).join("\n")}_calculateWidth(e,t,s,i,n,r,a,o){let h=0;for(let s=0;s<e.length;s++){this.applyTags(i,n,r,a),o&&(o.maxFontScale=Math.max(o.maxFontScale,n.fontScale));const l=e.charCodeAt(s),c=t.chars[l];c&&(h+=c.xadvance*n.fontScale),i++}return 0===e.length&&o&&(o.maxFontScale=s),h}_splitWord(e,t,s,i){const n=[];let r=0,a=0;for(;a<e.length;){const o=e.charCodeAt(a),h=t.chars[o],l=(h?h.xadvance:0)*s;if(h){if(r>0&&r+l>=i){const t=e.substring(0,a);e=e.substring(a),r=l,a=1,n.push(t);continue}r+=l}a++}return n.push(e),n}_checkBigWords(e,t,s,i,n,r,a,o,h,l){const c=[];for(let d=0;d<e.length;d++){const u=e[d],_=this._calculateWidth(u,t,s,n,r,a,o);if(!l&&_>i){const e=this._splitWord(u,t,s,i);for(let t=0;t<e.length;t++)c.push(e[t]),n+=e[t].length,h&&t!==e.length-1&&this.applyTagsOffsets(n,1)}else c.push(u)}return c}applyTagsOffsets(e,t){for(let s=0;s<this._tags.length;s++){const i=this._tags[s];i.startIndex<e||(i.startIndex+=t)}}_updateText(e){this._text!==e&&(this._dirtyVertices=!0,this._dirtyOffset=!0),this._text=e,this._resizeBuffers(e.length)}_updateSettings(e){this._verticalAlign!==e.verticalAlign&&(this._dirtyOffset=!0),this._fontSize===e.fontSize&&this._bestFit===e.bestFit&&this._font===e.font&&this._maxFontSize===e.maxFontSize&&this._minFontSize===e.minFontSize&&this._horizontalWrap===e.horizontalWrap&&this._verticalOverflow===e.verticalOverflow&&this._lineSpacing===e.lineSpacing&&this._lineHeight===e.lineHeight&&this._align===e.align&&this._color.equals(e.color)||(this._dirtyVertices=!0,this._dirtyOffset=!0),this._bounds&&this._bounds.x===e.bounds.x&&this._bounds.y===e.bounds.y||(this._dirtyOffset=!0,(this._horizontalWrap||this._bestFit||this._align!==l.c.TEXT_ALIGN_LEFT)&&(this._dirtyVertices=!0)),this._verticalAlign=e.verticalAlign,this._fontSize=e.fontSize,this._bestFit=e.bestFit,this._font=e.font,this._align=e.align,this._maxFontSize=e.maxFontSize,this._minFontSize=e.minFontSize,this._minFontSizeOriginal=e.minFontSize,this._maxFontSizeOriginal=e.maxFontSize,this._horizontalWrap=e.horizontalWrap,this._verticalOverflow=void 0!==e.verticalOverflow?e.verticalOverflow:this._verticalOverflow,this._recursiveCounter=0,this._measures=null,this._recursiveLimit=10,this._bounds.copy(e.bounds),this._lineSpacing=void 0!==e.lineSpacing?e.lineSpacing:this._lineSpacing,this._lineHeight=e.lineHeight,e.color&&this._color.copy(e.color)}_resizeBuffers(e){this._bufferSize=e,this._buffer=new Float32Array(44*e)}populateWithErrors(e,t,s){t.bestFit=t.resizeTextForBestFit,t.font=t.font.handle,t.maxFontSize=t.resizeTextMaxSize,t.minFontSize=t.resizeTextMinSize,t.lineHeight=t.lineSpacing,t.horizontalWrap=!(0===t.horizontalOverflow),t.bounds=t.generationExtents,t.verticalAlign="top",t.align=l.c.TEXT_ALIGN_LEFT,t._bestFit=t.resizeTextForBestFit,t._fontSize=t.fontSize,t._font=t.font,t._maxFontSize=t.resizeTextMaxSize,t._minFontSize=t.resizeTextMinSize,t._lineHeight=t.lineSpacing,t._verticalOverflow=t.verticalOverflow,t._horizontalWrap=!(0===t.horizontalOverflow),t._bounds=t.generationExtents,t._verticalAlign="top",t._align=l.c.TEXT_ALIGN_LEFT,this.populate(e,t)}get offset(){return this._offset}get vertexCount(){return this._vertexCount}get lineCount(){return this._lineCount}get characterCount(){return this._characters.length}get lines(){return this._lines}get characters(){return this._characters}}kt.createEmptyMesh=function(){const e=y.a.getApplication().graphicsDevice,t=new U.a(e,Ft),s=new M.a(e,t,0),n=new i.b(!0);return n.vertexBuffer=s,n.indexBuffer=[new B.a(e,l.c.INDEXFORMAT_UINT16,0)],n.primitive[0].type=l.c.PRIMITIVE_TRIANGLES,n.primitive[0].base=0,n.primitive[0].count=0,n.primitive[0].indexed=!0,n},kt.fontRatio=3.75,kt.missingCharactersLastCall="";class zt extends d.a{constructor(e,t={}){super(e,t),this._videoWidth=0,this._videoHeight=0,this._frameCount=0,this._frameRate=24,this._videoWidth=void 0!==t.width?t.width:this._videoWidth,this._videoHeight=void 0!==t.height?t.height:this._videoHeight,this._frameRate=void 0!==t.frameRate?t.frameRate:this._frameRate,this._frameCount=void 0!==t.frameCount?t.frameCount:this._frameCount}get frameRate(){return this._frameRate}get frameCount(){return this._frameCount}get videoWidth(){return this._videoWidth}get videoHeight(){return this._videoHeight}}class Vt extends y.k{constructor(){super(),this.code=UnityEngine.Object.FromHandle(UnityEngine.Video.VideoPlayer,this),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"VideoPlayerComponent")}configureForEntity(e){this._entity=e}onEnable(){return!!super.onEnable()&&(this.code.OnEnable(),!0)}onDisable(){return!!super.onDisable()&&(this.code.OnDisable&&this.code.OnDisable(),!0)}onDestroy(){return!!super.onDestroy()&&(this.code.OnDestroy&&this.code.OnDestroy(),!0)}}class Gt extends y.j{constructor(e){super(e),this.id="videoPlayer"}}let Ht=null,jt=null,Wt=null,Yt=0;const Kt=new f.d,Qt=16,Xt=[0,1,2,0,2,3,0,3,4,0,4,5,0,5,6],qt=[0,1,5,5,4,0,1,2,6,6,5,1,2,3,7,7,6,2,4,5,9,9,8,4,5,6,10,10,9,5,6,7,11,11,10,6,8,9,13,13,12,8,9,10,14,14,13,9,10,11,15,15,14,10],$t=[0,1,5,5,4,0,1,2,6,6,5,1,2,3,7,7,6,2,4,5,9,9,8,4,6,7,11,11,10,6,8,9,13,13,12,8,9,10,14,14,13,9,10,11,15,15,14,10],Jt=[0,0,0,0];class Zt{constructor(e){if(this._element=e,this._entity=e.entity,this._system=e.system,this._texture=null,this._masksChildren=!1,this._alphaTest=.01,this._ignoreMask=!1,this._showMaskGraphics=!0,this._enabled=!0,this._rect=new f.n(0,0,1,1),this._border=new f.n(0,0,0,0),this._color=new f.d(1,1,1,1),this._pivotPoint=new f.m,this._buffer=new Float32Array(0),this._fillEdges=new f.n(0,0,1,1),this._material=UnityEngine.Canvas.DefaultCanvasMaterial.handle,this._canvasRenderer=this._entity._unityComponents.canvasRenderer[0],!this._canvasRenderer){const e=new ut;this._entity.addUnityComponentFromDeserialization("canvasRenderer",e),this._canvasRenderer=this._entity._unityComponents.canvasRenderer[0]}this._mesh=this._createMesh(),this._model=this._canvasRenderer.model,this._model.setParameter("_TextureSampleAdd",Jt),this._canvasRenderer.setMesh(this._mesh),this._canvasRenderer.setMaterial(this._material,0),this._fillCenter=!0,this._fillAmount=0,this._pixelsPerUnitMultiplier=1,this._fillMethod=0,this._fillOrigin=0,this._preserveAspect=!1,this._width=0,this._height=0,this._sprite=null,this._spriteType=0,this._element.events.on("resize",this._onParentResize,this),this.preventUpdateMesh=!1,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"ImageElement")}destroy(){this._canvasRenderer.setMesh(null),this._element.events.off("resize",this._onParentResize),this._mesh&&(this._mesh.destroy(),this._mesh=null)}_onParentResize(){if(this._mesh){if(this._pivotPoint.equals(this._element._pivotPoint)&&this._width===this._element.width&&this._height===this._element.height)return;this._updateMesh(),this._width=this._element.width,this._height=this._element.height,this._pivotPoint.copy(this._element._pivotPoint)}}setVerticesDirty(){this._mesh&&this._updateMesh()}_updateMaterial(){const e=this._material||UnityEngine.Canvas.DefaultCanvasMaterial.handle;this._canvasRenderer.setMaterial(e,0)}_imageIndexBuffer(){if(Ht)return Ht;Ht=new B.a(this._system.app.graphicsDevice,l.c.INDEXFORMAT_UINT16,qt.length);return new Uint16Array(Ht.lock()).set(qt),Ht.unlock(),Ht.preventDestroy=!0,Ht}_emptyCenterImageIndexBuffer(){if(jt)return jt;jt=new B.a(this._system.app.graphicsDevice,l.c.INDEXFORMAT_UINT16,$t.length);return new Uint16Array(jt.lock()).set($t),jt.unlock(),jt.preventDestroy=!0,jt}_imageRadialIndexBuffer(){if(Wt)return Wt;Wt=new B.a(this._system.app.graphicsDevice,l.c.INDEXFORMAT_UINT16,Xt.length);return new Uint16Array(Wt.lock()).set(Xt),Wt.unlock(),Wt.preventDestroy=!0,Wt}_createMesh(){if(this._entity.isPrefab)return null;const e=new U.a(this._system.app.graphicsDevice,[{semantic:l.c.SEMANTIC_POSITION,components:3,type:l.c.TYPE_FLOAT32},{semantic:l.c.SEMANTIC_TEXCOORD0,components:2,type:l.c.TYPE_FLOAT32},{semantic:l.c.SEMANTIC_COLOR,components:4,type:l.c.TYPE_FLOAT32}]);Yt=9,this._fillEdges=new f.n(0,0,1,1),this._buffer=new Float32Array(Qt*Yt);const t=new M.a(this._system.app.graphicsDevice,e,Qt,l.c.BUFFER_STATIC,this._buffer.buffer),s=new i.b(!0);return s.vertexBuffer=t,s.indexBuffer[0]=this._imageIndexBuffer(),s.primitive[0].type=l.c.PRIMITIVE_TRIANGLES,s.primitive[0].base=0,s.primitive[0].count=qt.length,s.primitive[0].indexed=!0,s.subMeshes=[s],s}_updateMesh(){if(!this.preventUpdateMesh)if(this._texture||(this._spriteType=l.c.SPRITE_TYPE_SIMPLE),this._mesh){if(this._spriteType===l.c.SPRITE_TYPE_FILLED&&this._fillMethod===l.c.FILL_METHOD_RADIAL360)this._updateMeshRadial(),this._mesh.indexBuffer[0]=this._imageRadialIndexBuffer(),this._mesh.primitive[0].count=Xt.length;else{this._updateMeshSquare();this._spriteType!==l.c.SPRITE_TYPE_TILED&&this._spriteType!==l.c.SPRITE_TYPE_SLICED||this._fillCenter?(this._mesh.indexBuffer[0]=this._imageIndexBuffer(),this._mesh.primitive[0].count=qt.length):(this._mesh.indexBuffer[0]=this._emptyCenterImageIndexBuffer(),this._mesh.primitive[0].count=$t.length)}this._canvasRenderer.setMesh(this._mesh)}else this._canvasRenderer.setMesh(null)}_updateMeshSquare(){const e=this._element.width||0,t=this._element.height||0,s=new f.n(0,0,0,0),i=new f.l(0,0);this._calculatePaddings(e,t,s,i),this._spriteType===l.c.SPRITE_TYPE_FILLED?(this._fillMethod===l.c.FILL_METHOD_HORIZONTAL&&this._fillEdges.set(this._fillOrigin===l.c.FILL_ORIGIN_BOTTOM_LEFT?0:1-this._fillAmount,0,this._fillOrigin===l.c.FILL_ORIGIN_BOTTOM_LEFT?this._fillAmount:1,1),this._fillMethod===l.c.FILL_METHOD_VERTICAL&&this._fillEdges.set(0,this._fillOrigin===l.c.FILL_ORIGIN_BOTTOM_LEFT?0:1-this._fillAmount,1,this._fillOrigin===l.c.FILL_ORIGIN_BOTTOM_LEFT?this._fillAmount:1)):this._fillEdges.set(0,0,1,1);let n=this._spriteType===l.c.SPRITE_TYPE_SLICED||this._spriteType===l.c.SPRITE_TYPE_TILED?1:0;this._sprite&&this._element.screen&&(n=n*this._element.screen.screen.referencePixelsPerUnit/this.multipliedPixelsPerUnit);const r=[s.x+e*this._fillEdges.x,s.x+e*this._fillEdges.x+Math.min(this._border.x*n,.5*e),s.x+(e-s.x-s.z)*this._fillEdges.z-Math.min(this._border.z*n,.5*e),s.x+(e-s.x-s.z)*this._fillEdges.z],a=[s.y+(t-s.y-s.w)*this._fillEdges.w,s.y+(t-s.y-s.w)*this._fillEdges.w-Math.min(this._border.w*n,.5*t),s.y+t*this._fillEdges.y+Math.min(this._border.y*n,.5*t),s.y+t*this._fillEdges.y],o=[(0,f.p)(this._rect.x,this._rect.x+this._rect.z,this._fillEdges.x),(0,f.p)(this._rect.x,this._rect.x+this._rect.z,this._fillEdges.x),(0,f.p)(this._rect.x,this._rect.x+this._rect.z,this._fillEdges.z),(0,f.p)(this._rect.x,this._rect.x+this._rect.z,this._fillEdges.z)],h=[(0,f.p)(this._rect.y,this._rect.y+this._rect.w,this._fillEdges.w),(0,f.p)(this._rect.y,this._rect.y+this._rect.w,this._fillEdges.w),(0,f.p)(this._rect.y,this._rect.y+this._rect.w,this._fillEdges.y),(0,f.p)(this._rect.y,this._rect.y+this._rect.w,this._fillEdges.y)];if(this._spriteType!==l.c.SPRITE_TYPE_SLICED&&this._spriteType!==l.c.SPRITE_TYPE_TILED||!this._texture)this._spriteType,l.c.SPRITE_TYPE_TILED;else{if(o[1]+=this._border.x/this._texture.width,o[2]-=this._border.z/this._texture.width,r[1]>r[2]){const e=r[1];r[1]=r[2],r[2]=e}if(h[1]-=this._border.w/this._texture.height,h[2]+=this._border.y/this._texture.height,a[2]>a[1]){const e=a[1];a[1]=a[2],a[2]=e}}const c=this._mesh.vertexBuffer,d=this.color,u=new Float32Array(c.storage);for(let e=0;e<4;e++)for(let t=0;t<4;t++){let s=(4*e+t)*Yt;u[s++]=-this._element._pivotPoint.x+r[t],u[s++]=-this._element._pivotPoint.y+a[e],u[s++]=0,u[s++]=o[t],u[s++]=h[e],u[s++]=d.r,u[s++]=d.g,u[s++]=d.b,u[s++]=d.a}c.unlock()}_calculatePaddings(e,t,s,i){let n=e,r=t,a=1,o=1;if(this._texture&&(n=this._texture.width,r=this._texture.height),this._sprite){s.copy(this._sprite.transparency);const e=this._sprite.getTextureRect();n=e.z-e.x+s.x+s.z,r=e.w-e.y+s.y+s.w}if(e===n&&t===r||(a=e/n,o=t/r),i.x=e,i.y=t,this._preserveAspect&&this._spriteType!==l.c.SPRITE_TYPE_SLICED&&this._spriteType!==l.c.SPRITE_TYPE_TILED){const e=Math.min(a,o);i.x=e*n,i.y=e*r,s.scale(e)}else 1===a&&1===o||(s.x*=a,s.y*=o,s.z*=a,s.w*=o);if(i.x===e&&i.y===t||s.add(new f.n((e-i.x)*this._element.pivot.x,(t-i.y)*this._element.pivot.y,(e-i.x)*(1-this._element.pivot.x),(t-i.y)*(1-this._element.pivot.y))),this._sprite){const e=this._sprite.transparency;i.x*=1-(e.x+e.z)/n,i.y*=1-(e.y+e.w)/r}return s}_updateMeshRadial(){const e=this._element.width||0,t=this._element.height||0,s=new f.n(0,0,0,0),i=new f.l(0,0);this._calculatePaddings(e,t,s,i);let n=360*this._fillAmount;const r=i.x/2,a=s.x+r,o=i.y/2,h=s.y+o,c=this._rect.z/2,d=this._rect.w/2,u=this._rect.x+c,_=this._rect.y+d,m=[a],p=[h],g=[u],y=[_];let E=0,T=0,S=!1;switch(this._fillOrigin){case l.c.FILL_ORIGIN_RADIAL_BOTTOM:T=270;break;case l.c.FILL_ORIGIN_RADIAL_RIGHT:T=0;break;case l.c.FILL_ORIGIN_RADIAL_TOP:T=90;break;case l.c.FILL_ORIGIN_RADIAL_LEFT:T=180}const A=this._element["UnityEngine.UI.Image"].m_FillClockwise?-1:1;let b=0,C=0;for(;n>0;){const e=Math.min(n,E);T+=A*e,T=(T+360)%360,T<=45||T>315?(m.push(a+r),g.push(u+c),C=Math.tan(T*f.e),p.push(h+o*C),y.push(_+d*C)):T<=135?(b=1/Math.tan(T*f.e),m.push(a+r*b),g.push(u+c*b),p.push(h+o),y.push(_+d)):T<=225?(m.push(a-r),g.push(u-c),C=-Math.tan(T*f.e),p.push(h+o*C),y.push(_+d*C)):T<=315&&(b=-1/Math.tan(T*f.e),m.push(a+r*b),g.push(u+c*b),p.push(h-o),y.push(_-d)),n-=e,S?E=90:(E=45,S=!0)}for(;m.length<Qt;)m.push(a);for(;p.length<Qt;)p.push(h);for(;g.length<Qt;)g.push(u);for(;y.length<Qt;)y.push(_);const w=this._mesh.vertexBuffer,x=this.color,R=new Float32Array(w.storage);for(let e=0;e<Qt;e++)R[e*Yt+0]=-this._element._pivotPoint.x+m[e],R[e*Yt+1]=-this._element._pivotPoint.y+p[e],R[e*Yt+2]=0,R[e*Yt+3]=g[e],R[e*Yt+4]=y[e],R[e*Yt+5]=x.r,R[e*Yt+6]=x.g,R[e*Yt+7]=x.b,R[e*Yt+8]=x.a;w.unlock()}synchornizeProperties(e,t){const s=e.m_OverrideSprite||e.m_Sprite,i=s?s.handle:null,n=t&&e.m_Texture?e.m_Texture.handle:null,r=t?this._texture!==n:this._sprite!==i,a=t&&(e.m_UVRect.m_XMin!==this._rect.x||e.m_UVRect.m_YMin!==this._rect.y||e.m_UVRect.m_Width!==this._rect.z||e.m_UVRect.m_Height!==this._rect.w);(this._fillCenter!==e.m_FillCenter||this._fillAmount!==e.m_FillAmount||this._fillMethod!==e.m_FillMethod||this._fillOrigin!==e.m_FillOrigin||r||a)&&(t&&this._texture!==n?this.texture=n:t||this._sprite===i||(this.sprite=i),a&&this._rect.set(e.m_UVRect.m_XMin,e.m_UVRect.m_YMin,e.m_UVRect.m_Width,e.m_UVRect.m_Height),t||(this._fillCenter=e.m_FillCenter,this._fillAmount=e.m_FillAmount,this._pixelsPerUnitMultiplier=e.m_PixelsPerUnitMultiplier,this._fillMethod=e.m_FillMethod,this._fillOrigin=e.m_FillOrigin),this._updateMesh()),Kt.copy(e.m_Color)}get color(){return this._color}set color(e){this._color.copy(e)}get masksChildren(){return this._masksChildren}set masksChildren(e){this._masksChildren=e,this._canvasRenderer.model.masksChildren=e,this._element&&this._element.screen&&(this._element.screen.screen.canvasMeshInstance.renderersDirty=!0)}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest=e,this._updateMaterial()}get opacity(){return this._color.data[3]}set opacity(e){this._color.a=e,this.color=this._color}get rect(){return this._rect}set rect(e){this._rect.set(e.x,e.y,e.z,e.w),this._mesh&&this._updateMesh()}get border(){return this._border}set border(e){this._border.set(e.x,e.y,e.z,e.w),this._mesh&&this._updateMesh()}get material(){return this._material}set material(e){this._material=e,this._updateMaterial()}get texture(){return this._texture}set texture(e){this._texture=e,this._canvasRenderer.setTexture(this._texture),this._mesh&&this._updateMesh()}get ignoreMask(){return this._ignoreMask}set ignoreMask(e){this._ignoreMask=e,e&&(this.alphaTest=0),this._updateMaterial()}get showMaskGraphics(){return this._showMaskGraphics}set showMaskGraphics(e){this._showMaskGraphics=e,this._canvasRenderer.showMaskGraphics=e,this._updateMaterial()}get enabled(){return this._enabled}set enabled(e){if(this._enabled===e)return;this._enabled=e,this._canvasRenderer.enabled=e;const t=this._enabled?this._canvasRenderer.findParentCanvas():null;this._canvasRenderer.reparentCanvas(t)}get sprite(){return this._sprite}set sprite(e){if(this._sprite=e,e){this._texture=e.texture,this._canvasRenderer.setTexture(this._texture);const t=e.uvRect;this._rect.set(t.x,t.y,t.z,t.w);const s=this.spriteType===l.c.SPRITE_TYPE_SIMPLE?f.n.ZERO:e.border;this._border.set(s.x,s.y,s.z,s.w)}else this._texture=null,this._canvasRenderer.setTexture(this._texture);this._updateMesh()}get spriteType(){return this._spriteType||l.c.SPRITE_TYPE_SLICED}set spriteType(e){this._spriteType=e,this.sprite=this._sprite}get preserveAspect(){return this._preserveAspect}set preserveAspect(e){this._preserveAspect=e,this._updateMesh()}get fillMethod(){return this._fillMethod}set fillMethod(e){this._fillMethod=e,this._updateMesh()}get fillCenter(){return this._fillCenter}set fillCenter(e){this._fillCenter=e,this._updateMesh()}get fillOrigin(){return this._fillOrigin}set fillOrigin(e){this._fillOrigin=e,this._updateMesh()}get fillAmount(){return this._fillAmount}set fillAmount(e){this._fillAmount=e,this._updateMesh()}get pixelsPerUnitMultiplier(){return this._pixelsPerUnitMultiplier}set pixelsPerUnitMultiplier(e){this._pixelsPerUnitMultiplier=e,this._updateMesh()}get multipliedPixelsPerUnit(){return this._sprite.pixelsPerUnit*this._pixelsPerUnitMultiplier}}const es=[1,1,1,0],ts=new f.d,ss=new f.m;class is{constructor(e){if(this._element=e,this._system=e.system,this._entity=e.entity,this._text="",this._enabled=!0,this._horizontalWrap=!1,this._verticalOverflow=!1,this._align=l.c.TEXT_ALIGN_CENTER,this._veticalAlign=l.c.TEXT_VERTICAL_ALIGN_MIDDLE,this._font=null,this._color=new f.d(1,1,1,1),this._spacing=1,this._fontSize=32,this._lineHeight=1,this._bestFit=!1,this._minFontSize=0,this._maxFontSize=1e3,this.width=0,this.height=0,this.bounds=new f.l,this._material=null,this._textGenerator=null,this._dirtyVertices=!1,this._dirtyOffset=!1,this._canvasRenderer=this._entity._unityComponents.canvasRenderer?this._entity._unityComponents.canvasRenderer[0]:null,!this._canvasRenderer){const e=new ut;this._entity.addUnityComponentFromDeserialization("canvasRenderer",e),this._canvasRenderer=this._entity._unityComponents.canvasRenderer[0]}this._tintTexture=null,this._mesh=this._createMesh(),this._model=this._canvasRenderer.model,this._model.setParameter("_TextureSampleAdd",es),this._canvasRenderer.setMesh(this._mesh),this._canvasRenderer.setMaterial(this._material,0),this._masksChildren=!1}destroy(){this._canvasRenderer.setMesh(null),this._mesh&&(this._mesh.destroy(),this._mesh=null)}_updateMaterial(){const e=this._material||UnityEngine.Canvas.DefaultCanvasMaterial.handle;this._canvasRenderer.setMaterial(e,0)}_createMesh(){if(this._entity.isPrefab)return null;this._textGenerator=new kt(this._canvasRenderer);const e=kt.createEmptyMesh();return e.subMeshes=[e],e}_updateAligns(e){void 0!==this._element.width&&void 0!==this._element.height&&(e||(this.bounds.set(this._element.width,this._element.height),this._textGenerator.populate(this.text,this)),ss.set(-this._element._pivotPoint.x,-this._element._pivotPoint.y,0).add(this._textGenerator.offset),this._textGenerator.updateMesh(this._mesh,this,ss))}_updateMesh(e,t){if(this._entity.isPrefab)return;if(this._element._dirtyRect&&this._entity._sync(),!(0===this._element.width||0===this._element.height||this._element&&this._element.width&&this._element.height))return;this.bounds.set(this._element.width,this._element.height),this._textGenerator.populate(t,this);0!==this._textGenerator.vertexCount?(this._dirtyVertices&&this._textGenerator.updateMesh(this._mesh,this),this._dirtyOffset&&this._updateAligns(!0),(this._dirtyVertices||this._dirtyOffset)&&this._element.dirtifyRect(),this._canvasRenderer.getMesh()||this._canvasRenderer.setMesh(e)):this._canvasRenderer.setMesh(null)}setVerticesDirty(){this._updateText(this._text)}_updateText(e=this._text){this._font&&(this._mesh||(this._updateMaterial(),this._mesh=this._createMesh(),this._canvasRenderer.setMesh(this._mesh)),this._updateMesh(this._mesh,e),this._canvasRenderer.setTexture(this._font.texture))}synchornizeProperties(e){ts.copy(e.m_Color)}get text(){return this._text}set text(e){const t=(e||"").toString();this._text!==t&&(this._text=t)}get color(){return this._color}set color(e){this._color.copy(e)}get opacity(){return this._color.data[3]}set opacity(e){this._color.a=e,this.color=this._color}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight=e}get lineSpacing(){return this._spacing}set lineSpacing(e){this._spacing=e}get align(){return this._align}set align(e){this._align=e}get verticalAlign(){return this._veticalAlign}set verticalAlign(e){this._veticalAlign=e}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize=e}get horizontalWrap(){return this._horizontalWrap}set horizontalWrap(e){this._horizontalWrap=e}get verticalOverflow(){return this._verticalOverflow}set verticalOverflow(e){this._verticalOverflow=e}get font(){return this._font}set font(e){this._font=e}get bestFit(){return this._bestFit}set bestFit(e){this._bestFit=e}get minFontSize(){return this._minFontSize}set minFontSize(e){this._minFontSize=e}get maxFontSize(){return this._maxFontSize}set maxFontSize(e){this._maxFontSize=e}get enabled(){return this._enabled}set enabled(e){if(this._enabled===e)return;this._enabled=e,this._canvasRenderer.enabled=e,!this._enabled&&this._textGenerator&&this._textGenerator._reset();const t=this._enabled?this._canvasRenderer.findParentCanvas():null;this._canvasRenderer.reparentCanvas(t)}get material(){return this._material}set material(e){this._material=e,this._updateMaterial()}get masksChildren(){return this._masksChildren}set masksChildren(e){this._masksChildren=e;const t=this._canvasRenderer.model.meshInstances;for(let s=0;s<t.length;s++){const i=t[s];e?i._shaderDefs|=l.c.SHADERDEF_UI_MASK:i._shaderDefs&=~l.c.SHADERDEF_UI_MASK}this._element&&this._element.screen&&(this._element.screen.screen.canvasMeshInstance.renderersDirty=!0)}get tintTexture(){return this._tintTexture}set tintTexture(e){this._tintTexture=e,this._updateText(this._text)}}class ns{constructor(){this.enabled=!0}}class rs extends y.c{constructor(e,t){super(e,t),this.data=new ns,this._width=0,this._height=0,this._stencilLayer=255,this._anchors=new f.n,this._pivot=new f.l(.5,.5),this._sizeDelta=new f.l(0,0);const s=t.getLocalPosition();this._anchoredPosition=new f.l(s.x,s.y),this.entity.events.on("insert",this._onInsert,this),this._lastSyncAABBVersion=-1,this._dirtyScreen=!1,this._dirtyRect=!1,this.screen=null,this._nearestScreen=null,this._type=l.c.ELEMENTTYPE_GROUP,this._pivotPoint=new f.m,this._drawOrder=-1,this._masked=!1,this._image=null,this._text=null,this._localPositionAnimated=new f.m,this._dirtyAnimatedLocalPosition=!1,this._anchoredPositionAnimated=new f.m,this._dirtyAnimatedAnchoredPosition=!1,this._canvasGroups=[],this.cachedRect=new UnityEngine.Rect,this["__UnityEngine.UI.CanvasScaler"]=null,this["UnityEngine.UI.Graphic"]=null,this["UnityEngine.UI.Button"]=null,this["UnityEngine.UI.RawImage"]=null,this["UnityEngine.UI.Slider"]=null,this["UnityEngine.UI.Text"]=null,this["UnityEngine.UI.Image"]=null,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"ElementComponent")}dirtifyScreen(){if(!this._dirtyScreen){this.entity._app.scene.addDirty(this.entity),this._dirtyScreen=!0;for(let e=0;e<this.entity.children.length;e++){const t=this.entity.children[e];t.element&&t.element.dirtifyRect()}}}dirtifyRect(){if(!this._dirtyRect){this.entity._app.scene.addDirty(this.entity),this._dirtyRect=!0;for(let e=0;e<this.entity.children.length;e++){const t=this.entity.children[e];t.element&&t.element.dirtifyRect()}}}_getStencilParameters(){const e=this._masked?l.c.FUNC_EQUAL:l.c.FUNC_ALWAYS,t=this._image&&this._image.masksChildren||this._text&&this._text.masksChildren;return new xe.a({func:e,ref:this._stencilLayer,writeMask:t?this._stencilLayer:0,readMask:t?this._stencilLayer>>1:this._stencilLayer,zfail:l.c.STENCILOP_KEEP,zpass:l.c.STENCILOP_REPLACE,fail:this._masked?l.c.STENCILOP_KEEP:l.c.STENCILOP_REPLACE})}_patch(){this.entity.flags|=y.g.Flags.HijackedByElementComponent,this._lastSyncAABBVersion=-1,this.dirtifyRect()}_unpatch(){this.entity.flags&=~y.g.Flags.HijackedByElementComponent}getRect(){const e=this._findParentElement();return e&&e.element.getRect(),this._dirtyRect&&this.entity._sync(),this.cachedRect.m_XMin=-this._pivotPoint.x,this.cachedRect.m_YMin=-this._pivotPoint.y,this.cachedRect.m_Width=this._width,this.cachedRect.m_Height=this._height,this.cachedRect.m_XMax=this.cachedRect.m_XMin+this._width,this.cachedRect.m_YMax=this.cachedRect.m_YMin+this._height,this.cachedRect}setVerticesDirty(){this._image&&this._image.setVerticesDirty(),this._text&&this._text.setVerticesDirty()}_onInsert(e,t=!0){const s=this._findScreen();this._updateScreen(s,!1),s&&!this.entity.isPrefab&&this.entity.getScene()&&(t?this.triggerOnElementDimesionsChange(!0,!0):this.entity._elementDimesionsChange())}_updateScreen(e,t=!1){this.screen=this._findScreen(),this._patch(),this.events.fire("set:screen",this.screen),this.dirtifyRect(),this.dirtifyScreen(),this._updateScreenForNonElement(this.entity,e,t),this.screen&&!t&&this.screen.screen.syncDrawOrder()}_updateScreenForNonElement(e,t,s){const i=e.getChildren();for(let e=0,n=i.length;e<n;e++)i[e].element?i[e].element._updateScreen(t,s):this._updateScreenForNonElement(i[e],t,s)}_findScreen(){let e=this.entity,t=this.screen&&this.screen.screen;for(this._nearestScreen=null;e;)this._nearestScreen=this._nearestScreen||e.screen,t=e.screen||t,e=e._parent;return t?t.entity:null}_findParentElement(){let e=this.entity._parent;for(;e&&!e.element;)e=e._parent;return e}addCanvasGroup(e,t=null){null==t?t=0:this.entity._canvasGroups.length>0&&t++,this._canvasGroups.splice(t,0,e);const s=this.entity.children;for(let i=0;i<s.length;i++){const n=s[i].element;n&&n.addCanvasGroup(e,t)}}removeCanvasGroup(e){const t=this._canvasGroups.indexOf(e);t>-1&&this._canvasGroups.splice(t,1);const s=this.entity.children;for(let t=0;t<s.length;t++){const i=s[t].element;i&&i.removeCanvasGroup(e)}}onRemove(){this.entity.events.off("insert",this._onInsert),this._unpatch(),this._image&&this._image.destroy(),this._text&&this._text.destroy()}triggerOnElementDimesionsChange(e,t){this.entity._elementDimesionsChange();const s=this.entity.children;for(let i=0;i<s.length;i++){if(!s[i]._activeSelf)continue;const n=s[i].element;if(n){const s=e&&n._anchors.x!==n._anchors.z,i=t&&n._anchors.y!==n._anchors.w;(s||i)&&n.triggerOnElementDimesionsChange(s,i)}}}setupParametersFromImage(e,t,s,i,n,r,a,o,h,l,c,d){const u=this._image;u&&(u.preventUpdateMesh=!0,this["UnityEngine.UI.Image"]=e,u.sprite=t,u.spriteType=s,u.fillMethod=i,u.fillOrigin=n,u.fillAmount=r,u.fillCenter=a,u.pixelsPerUnitMultiplier=o,u.preserveAspect=h,u.ignoreMask=l,u.enabled=c,u.color=e.m_Color,u.preventUpdateMesh=!1,u._updateMesh(),this.material=d)}get enabled(){return this.data.enabled}set enabled(e){const t=this.data.enabled;this.data.enabled=e,this.events.fire("set_enabled","enabled",t,e)}get type(){return this._type}set type(e){e!==this._type&&(this._type=e,this._image&&(this._image.destroy(),this._image=null),this._text&&(this._text.destroy(),this._text=null),e===l.c.ELEMENTTYPE_IMAGE?this._image=new Zt(this):e===l.c.ELEMENTTYPE_TEXT&&(this._text=new is(this)))}get drawOrder(){return this._drawOrder}set drawOrder(e){this._drawOrder!==e&&(this._drawOrder=e,this.events.fire("set:draworder",this._drawOrder))}get width(){return this._width}get height(){return this._height}get pivot(){return this._pivot}set pivot(e){this._pivot.set(e.x,e.y),this.dirtifyRect()}get anchor(){return this._anchors}set anchor(e){if(e.equals(this._anchors))return;const t=this._anchors.z-this._anchors.x!=e.z-e.x,s=this._anchors.w-this._anchors.y!=e.w-e.y;this._anchors.copy(e),this.dirtifyRect(),(t||s)&&this.triggerOnElementDimesionsChange(t,s)}get anchoredPosition(){return this._anchoredPosition}set anchoredPosition(e){this._anchoredPosition.copy(e),this.dirtifyRect()}get sizeDelta(){return this._sizeDelta}set sizeDelta(e){const t=this._sizeDelta.x!==e.x,s=this._sizeDelta.y!==e.y;(t||s)&&(this._sizeDelta.copy(e),this.dirtifyRect(),this.triggerOnElementDimesionsChange(t,s))}get rect(){return this.getRect()}get stencilLayer(){return this._stencilLayer}set stencilLayer(e){this._stencilLayer!==e&&(this._stencilLayer=e,this.events.fire("set:stencillayer",e))}get fontSize(){return this._text?this._text.fontSize:null}set fontSize(e){this._text&&(this._text.fontSize=e)}get color(){return this._text?this._text.color:this._image?this._image.color:null}set color(e){this._text?this._text.color=e:this._image&&(this._image.color=e)}get font(){return this._text?this._text.font:null}set font(e){this._text&&(this._text.font=e)}get lineHeight(){return this._text?this._text.lineHeight:null}set lineHeight(e){this._text&&(this._text.lineHeight=e)}get align(){return this._text?this._text.align:null}set align(e){this._text&&(this._text.align=e)}get verticalAlign(){return this._text?this._text.verticalAlign:null}set verticalAlign(e){this._text&&(this._text.verticalAlign=e)}get text(){return this._text?this._text.text:null}set text(e){this._text&&(this._text.text=e)}get texture(){return this._image?this._image.texture:null}set texture(e){this._image&&(this._image.texture=e)}get material(){return this._text?this._text.material:this._image?this._image.material:null}set material(e){this._text?this._text.material=e:this._image&&(this._image.material=e)}get opacity(){return this._text?this._text.opacity:this._image?this._image.opacity:null}set opacity(e){this._text?this._text.opacity=e:this._image&&(this._image.opacity=e)}get masksChildren(){return this._text?this._text.masksChildren:this._image?this._image.masksChildren:null}set masksChildren(e){this._text?this._text.masksChildren=e:this._image&&(this._image.masksChildren=e)}get showMaskGraphics(){return this._image?this._image.showMaskGraphics:null}set showMaskGraphics(e){this._image&&(this._image.showMaskGraphics=e)}get alphaTest(){return this._image?this._image.alphaTest:null}set alphaTest(e){this._image&&(this._image.alphaTest=e)}get border(){return this._image?this._image.border:null}set border(e){this._image&&(this._image.border=e)}}class as extends y.b{constructor(e){super(e),this.id="element",this.app=e,this.ComponentType=rs,this.events.on("beforeremove",this.onRemoveComponent,this)}initializeComponentData(e,t){t.anchor&&e._anchors.copy(t.anchor),t.pivot&&e._pivot.copy(t.pivot),t.sizeDelta&&e._sizeDelta.copy(t.sizeDelta),t.anchoredPosition&&e._anchoredPosition.copy(t.anchoredPosition);const s=e._findScreen();s&&s.screen&&e._updateScreen(s),super.initializeComponentData(e,t)}onRemoveComponent(e,t){t.onRemove()}}const os=new f.n(0,0,1,1),hs=new f.l;class ls{constructor(){this.clearColor=new f.d(.722,.722,.722,1),this.clearFlags=UnityEngine.CameraClearFlags.Skybox,this.depthTextureMode=UnityEngine.DepthTextureMode.Depth,this.nearClip=.1,this.farClip=1e3,this.fov=45,this.orthoHeight=100,this.projection=l.c.PROJECTION_PERSPECTIVE,this.priority=0,this.rect=new f.n(0,0,1,1),this.enabled=!0,this.flipFaces=!1,this.cullingMask=0,this.usePhysicalProperties=!1,this.focalLength=50,this.sensorSize=new f.l(36,24),this.lensShift=new f.l,this.gateFit=l.c.GATE_FIT_HORIZONTAL,this.gateFittedFOV=45,this.gateFittedLensShift=new f.l,this.camera=null,this.aspectRatio=16/9,this.aspectRatioMode=l.c.ASPECT_AUTO,this.renderTarget=null,this.calculateTransform=null,this.universalAdditionalCameraData=null,this.depthRenderTarget=null}}class cs extends y.c{constructor(e,t){super(e,t),this.data=new ls,this.events.on("set_aspectRatio",this.onSetAspectRatio,this),this.events.on("set_camera",this.onSetCamera,this),this.events.on("set_clearColor",this.onSetClearColor,this),this.events.on("set_fov",this.onSetFov,this),this.events.on("set_orthoHeight",this.onSetOrthoHeight,this),this.events.on("set_nearClip",this.onSetNearClip,this),this.events.on("set_farClip",this.onSetFarClip,this),this.events.on("set_projection",this.onSetProjection,this),this.events.on("set_clearFlags",this.updateClearFlags,this),this.events.on("set_renderTarget",this.onSetRenderTarget,this),this.events.on("set_rect",this.onSetRect,this),this.events.on("set_scissorRect",this.onSetScissorRect,this),this.events.on("set_calculateTransform",this.onSetCalculateTransform,this),this.events.on("set_cullingMask",this.onSetCullingMask,this),this.events.on("set_depthTextureMode",this.onSetDepthTextureMode,this),this.events.on("set_usePhysicalProperties",this.onSetUsePhysicalProperties,this),this.events.on("set_focalLength",this.onSetFocalLength,this),this.events.on("set_sensorSize",this.onSetSensorSize,this),this.events.on("set_lensShift",this.onSetLensShift,this),this.events.on("set_gateFit",this.onSetGateFit,this),this.device=y.a.getApplication().graphicsDevice,this.layerCullDistancesActivated=!1,this.layerCullDistances=new Array(32).fill(0),this["__UnityEngine.Camera"]=null,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"CameraComponent")}screenToWorld(e,t,s,i){const n=this.system.app.graphicsDevice;return this.data.camera.screenToWorld(e,t,s,n.clientRect.width,n.clientRect.height,i)}worldToScreen(e,t){const s=this.system.app.graphicsDevice;return this.data.camera.worldToScreen(e,s.clientRect.width,s.clientRect.height,t)}onSetAspectRatio(e,t,s){this.data.camera.aspectRatio=s}onSetCamera(e,t,s){t&&(t._node=null),s._node=this.entity}onSetClearColor(e,t,s){const i=this.data.camera.clearColor;i[0]=s.r,i[1]=s.g,i[2]=s.b,i[3]=s.a}onSetFov(e,t,s){this.data.camera.fov=s}onSetCullingMask(e,t,s){this.data.camera.cullingMask=s}onSetOrthoHeight(e,t,s){this.data.camera.orthoHeight=s}onSetNearClip(e,t,s){this.data.camera.nearClip=s}onSetFarClip(e,t,s){this.data.camera.farClip=s}onSetCalculateTransform(e,t,s){this.camera.calculateTransform=s,this.camera.overrideCalculateTransform=!!s}onSetProjection(e,t,s){this.data.camera.projection=s}addCameraToScene(){this.system.app.isUrp&&this.additionalCameraData&&this.additionalCameraData.renderType===l.c.URP_CAMERA_RENDER_TYPE_BASE&&this.system.app.scene.addUrpBaseCamera(this),this.system.app.scene.addCamera(this)}removeCameraFromScene(){this.system.app.scene.removeCamera(this),this.system.app.scene.removeUrpBaseCamera(this)}updateClearFlags(){let e=0;switch(this.clearFlags){case UnityEngine.CameraClearFlags.Skybox:e=l.c.CLEARFLAG_COLOR|l.c.CLEARFLAG_STENCIL|l.c.CLEARFLAG_DEPTH|l.c.CLEARFLAG_USE_SKYBOX;break;case UnityEngine.CameraClearFlags.Color:e=l.c.CLEARFLAG_COLOR|l.c.CLEARFLAG_STENCIL|l.c.CLEARFLAG_DEPTH;break;case UnityEngine.CameraClearFlags.Depth:e=l.c.CLEARFLAG_DEPTH}this.data.camera.clearFlags=e}onSetDepthTextureMode(e){this.data.depthTextureMode=e}onSetRenderTarget(e,t,s){this.data.camera.renderTarget=s}onSetRect(e,t,s){this.data.camera.setRect(s.x,s.y,s.z,s.w)}onSetScissorRect(e,t,s){this.data.camera.setScissorRect(s.x,s.y,s.z,s.w)}onSetUsePhysicalProperties(e,t,s){this.data.camera.usePhysicalProperties=s}onSetFocalLength(e,t,s){this.data.camera.focalLength=s}onSetSensorSize(e,t,s){this.data.camera.setSensorSize(s.x,s.y)}onSetLensShift(e,t,s){this.data.camera.setLensShift(s.x,s.y)}onSetGateFit(e,t,s){this.data.camera.gateFit=s}onEnable(){this.system.addCamera(this),this.enabled&&this.entity.enabled&&this.addCameraToScene(),this.data.depthRenderTarget=this.createDepthRenderTarget()}onDisable(){this.removeCameraFromScene(),this.system.removeCamera(this)}onDestroy(){this.destroyDepthRenderTarget(this.data.depthRenderTarget)}calculateAspectRatio(e){const t=e||this.system.app.graphicsDevice,s=this.rect;return t.width*s.z/(t.height*s.w)}frameBegin(e){this.aspectRatioMode===l.c.ASPECT_AUTO&&(this.aspectRatio=this.calculateAspectRatio(e))}frameEnd(){this.handleOnRenderImageCallback()}resetProjectionMatrix(){this.camera.resetProjectionMatrix()}calculateObliqueMatrix(e){return this.camera.calculateObliqueMatrix(e)}changeAspectRatio(e){this.aspectRatioMode=l.c.ASPECT_MANUAL,this.aspectRatio=e}resetAspect(){this.aspectRatioMode=l.c.ASPECT_AUTO}createDepthRenderTarget(){const e=this.camera.getRect(),t=Math.floor(e.width*this.device.width),s=Math.floor(e.height*this.device.height);return this.depthTextureMode!==UnityEngine.DepthTextureMode.Depth?null:Q.a.getTempBuffer(t,s,null,l.c.PIXELFORMAT_DEPTH)}destroyDepthRenderTarget(e){e&&Q.a.releaseTempBuffer(e)}handleOnRenderImageCallback(){if(0===this.getOnRenderImageSubscribersCount())return;const e=this["__UnityEngine.Camera"].targetTexture,t=e?e.handle.width:this.device.width,s=e?e.handle.height:this.device.height;let i=UnityEngine.RenderTexture.GetTemporary(t,s),n=UnityEngine.RenderTexture.GetTemporary(t,s);e?UnityEngine.Graphics.Blit(e,i):(this.device.setTexture(i.handle,0),this.device.activeTexture(0),this.device.gl.copyTexImage2D(this.device.gl.TEXTURE_2D,0,this.device.gl.RGB,0,0,t,s,0));for(let e=0;e<this.entity._unityComponents.monoBehaviour.length;e++){if(this.entity._unityComponents.monoBehaviour[e].onRenderImage(i,n)){const e=i;i=n,n=e}}UnityEngine.Graphics.Blit(i,e),UnityEngine.RenderTexture.ReleaseTemporary(i),UnityEngine.RenderTexture.ReleaseTemporary(n)}getOnRenderImageSubscribersCount(){let e=0;for(let t=0;t<this.entity._unityComponents.monoBehaviour.length;t++){this.entity._unityComponents.monoBehaviour[t].code.OnRenderImage&&e++}return e}get depthRenderTarget(){const e=this.camera.getRect(),t=Math.floor(e.width*this.device.width),s=Math.floor(e.height*this.device.height),i=this.data.depthRenderTarget;if(i){if(i.width===t&&i.height===s)return i;this.destroyDepthRenderTarget(i)}return this.data.depthRenderTarget=this.createDepthRenderTarget(),this.data.depthRenderTarget}get clearFlags(){return this.data.clearFlags}set clearFlags(e){const t=this.data.clearFlags;this.data.clearFlags=e,this.events.fire("set_clearFlags","clearFlags",t,e)}get projection(){return this.data.projection}set projection(e){const t=this.data.projection;this.data.projection=e,this.events.fire("set_projection","projection",t,e)}get fov(){return this.data.fov}set fov(e){const t=this.data.fov;this.data.fov=e,this.events.fire("set_fov","fov",t,e)}get usePhysicalProperties(){return this.data.usePhysicalProperties}set usePhysicalProperties(e){const t=this.data.usePhysicalProperties;this.data.usePhysicalProperties=e,this.events.fire("set_usePhysicalProperties","usePhysicalProperties",t,e),this.data.usePhysicalProperties&&this.calculateProjectionParamsFromPhysicalProperties()}get focalLength(){return this.data.focalLength}set focalLength(e){const t=this.data.focalLength;this.data.focalLength=e,this.events.fire("set_focalLength","focalLength",t,e),t!==e&&this.data.usePhysicalProperties&&this.calculateProjectionParamsFromPhysicalProperties()}get sensorSize(){return this.data.sensorSize}set sensorSize(e){const t=this.data.sensorSize;this.data.sensorSize=e,this.events.fire("set_sensorSize","sensorSize",t,e),this.data.usePhysicalProperties&&this.calculateProjectionParamsFromPhysicalProperties()}get lensShift(){return this.data.lensShift}set lensShift(e){const t=this.data.lensShift;this.data.lensShift=e,this.events.fire("set_lensShift","lensShift",t,e),this.data.usePhysicalProperties&&this.calculateProjectionParamsFromPhysicalProperties()}get gateFit(){return this.data.gateFit}set gateFit(e){const t=this.data.gateFit;this.data.gateFit=e,this.events.fire("set_gateFit","gateFit",t,e)}calculateProjectionParamsFromPhysicalProperties(){this.focalLength=(0,f.o)(this.focalLength,pc.Camera.fieldOfViewToFocalLength(179,this.sensorSize.y),pc.Camera.fieldOfViewToFocalLength(1e-5,this.sensorSize.x)),this.fov=pc.Camera.focalLengthToFieldOfView(this.focalLength,this.sensorSize.y),this.calculateGateFitParams()}calculateGateFitParams(){this.gateFittedLensShift=this.lensShift.clone();const e=this.aspectRatio*this.sensorSize.y/this.sensorSize.x;this.gateFit===l.c.GATE_FIT_FILL&&e>1||this.gateFit===l.c.GATE_FIT_OVERSCAN&&e<1||this.gateFit===l.c.GATE_FIT_HORIZONTAL?(this.gateFittedFOV=pc.Camera.focalLengthToFieldOfView(this.focalLength,this.sensorSize.x/this.aspectRatio),this.gateFittedLensShift.y*=e):(this.gateFittedFOV=pc.Camera.focalLengthToFieldOfView(this.focalLength,this.sensorSize.y),this.gateFittedLensShift.x*=1/e)}getGateFittedFieldOfView(){return this.usePhysicalProperties?this.gateFittedFOV:this.fov}getGateFittedLensShift(){return this.usePhysicalProperties?this.gateFittedLensShift:f.l.ZERO}get orthoHeight(){return this.data.orthoHeight}set orthoHeight(e){const t=this.data.orthoHeight;this.data.orthoHeight=e,this.events.fire("set_orthoHeight","orthoHeight",t,e)}get nearClip(){return this.data.nearClip}set nearClip(e){const t=this.data.nearClip;this.data.nearClip=e,this.events.fire("set_nearClip","nearClip",t,e)}get farClip(){return this.data.farClip}set farClip(e){const t=this.data.farClip;this.data.farClip=e,this.events.fire("set_farClip","farClip",t,e)}get priority(){return this.data.priority}set priority(e){const t=this.data.priority;this.data.priority=e,this.events.fire("set_priority","priority",t,e)}get rect(){return this.data.rect}set rect(e){const t=this.data.rect;this.data.rect=e,this.events.fire("set_rect","rect",t,e)}get camera(){return this.data.camera}set camera(e){const t=this.data.camera;this.data.camera=e,this.events.fire("set_camera","camera",t,e)}get aspectRatio(){return this.data.aspectRatio}set aspectRatio(e){const t=this.data.aspectRatio;this.data.aspectRatio=e,this.events.fire("set_aspectRatio","aspectRatio",t,e)}get aspectRatioMode(){return this.data.aspectRatioMode}set aspectRatioMode(e){this.data.aspectRatioMode=e}get renderTarget(){return this.data.renderTarget}set renderTarget(e){const t=this.data.renderTarget;this.data.renderTarget=e,this.events.fire("set_renderTarget","renderTarget",t,e)}get calculateTransform(){return this.data.calculateTransform}set calculateTransform(e){const t=this.data.calculateTransform;this.data.calculateTransform=e,this.events.fire("set_calculateTransform","calculateTransform",t,e)}get flipFaces(){return this.data.flipFaces}set flipFaces(e){const t=this.data.flipFaces;this.data.flipFaces=e,this.events.fire("set_flipFaces","flipFaces",t,e)}get cullingMask(){return this.data.cullingMask}set cullingMask(e){const t=this.data.cullingMask;this.data.cullingMask=e,this.events.fire("set_cullingMask","cullingMask",t,e)}get clearColor(){return this.data.clearColor}set clearColor(e){const t=this.data.clearColor;this.data.clearColor=e,this.events.fire("set_clearColor","clearColor",t,e)}get enabled(){return this.data.enabled}set enabled(e){const t=this.data.enabled;this.data.enabled=e,this.events.fire("set_enabled","enabled",t,e)}get projectionMatrix(){return this.data.camera.projMat}set projectionMatrix(e){this.data.camera.setProjectionMatrix(e)}get viewMatrix(){return this.data.camera._node.getWorldTransform().clone().invert()}get frustum(){return this.data.camera.frustum}get node(){return this.data.camera._node}get unityRect(){return this.rect}set unityRect(e){this.rect=e}get unityPixelRect(){const e=this.renderTarget;return e?(hs.x=e.width,hs.y=e.height):(hs.x=this.device._width,hs.y=this.device._height),os.copy(this.rect),os.x*=hs.x,os.y*=hs.y,os.z*=hs.x,os.w*=hs.y,os}set unityPixelRect(e){const t=this.renderTarget;t?(hs.x=t.width,hs.y=t.height):(hs.x=this.device._width,hs.y=this.device._height);const s=e.x/hs.x,i=e.y/hs.y;let n=e.z/hs.x,r=e.w/hs.y;n=(0,f.o)(s+n,0,1)-s,r=(0,f.o)(i+r,0,1)-i,this.rect=new f.n(s,i,n,r)}set depthTextureMode(e){this.data.depthTextureMode=e}get depthTextureMode(){return this.data.depthTextureMode}get additionalCameraData(){if(!this.data.universalAdditionalCameraData){const e=UnityEngine.Object.FromHandle(UnityEngine.Camera,this);this.data.universalAdditionalCameraData=e.GetUniversalAdditionalCameraData()}return this.data.universalAdditionalCameraData}}class ds extends y.b{constructor(e){super(e),this.id="camera",this.ComponentType=cs,this.cameras=[],this.events.on("beforeremove",this.onBeforeRemove,this),this.events.on("remove",this.onRemove,this),y.b.events.on("update",this.onUpdate,this)}initializeComponentData(e,t){e.camera=new g.a,e.camera._component=e,void 0!==t.enabled&&(e.enabled=t.enabled),void 0!==t.aspectRatio&&(e.aspectRatio=t.aspectRatio),void 0!==t.aspectRatioMode&&(e.aspectRatioMode=t.aspectRatioMode),void 0!==t.renderTarget&&(e.renderTarget=t.renderTarget),void 0!==t.clearColor&&(e.clearColor=t.clearColor),void 0!==t.fov&&(e.fov=t.fov),void 0!==t.orthoHeight&&(e.orthoHeight=t.orthoHeight),void 0!==t.nearClip&&(e.nearClip=t.nearClip),void 0!==t.farClip&&(e.farClip=t.farClip),void 0!==t.projection&&(e.projection=t.projection),void 0!==t.priority&&(e.priority=t.priority),void 0!==t.clearFlags&&(e.clearFlags=t.clearFlags),void 0!==t.rect&&(e.rect=t.rect),void 0!==t.calculateTransform&&(e.calculateTransform=t.calculateTransform),void 0!==t.flipFaces&&(e.flipFaces=t.flipFaces),void 0!==t.cullingMask&&(e.cullingMask=t.cullingMask),void 0!==t.focalLength&&(e.focalLength=t.focalLength),void 0!==t.sensorSize&&(e.sensorSize=t.sensorSize),void 0!==t.lensShift&&(e.lensShift=t.lensShift),void 0!==t.gateFit&&(e.gateFit=t.gateFit),void 0!==t.usePhysicalProperties&&(e.usePhysicalProperties=t.usePhysicalProperties),super.initializeComponentData(e,t)}onBeforeRemove(e,t){this.removeCamera(t)}onRemove(e,t){t.camera=null}onUpdate(e){}addCamera(e){this.cameras.push(e),this.sortCamerasByPriority()}removeCamera(e){const t=this.cameras.indexOf(e);t>=0&&(this.cameras.splice(t,1),this.sortCamerasByPriority())}sortCamerasByPriority(){this.cameras.sort(((e,t)=>e.priority-t.priority))}}class us{constructor(){this.enabled=!0}}class _s extends y.c{constructor(e,t){super(e,t),this.data=new us,this._resolution=new f.l(this.system.app.graphicsDevice.width,this.system.app.graphicsDevice.height),this._referenceResolution=new f.l(640,320),this._offset=new f.l(0,0),this._scaleMode=_s.SCALEMODE_NONE,this.scale=1,this._scaleBlend=.5,this._scaleFactor=1,this._planeHeight=0,this._camera=null,this._referencePixelsPerUnit=100,this._sortingLayerIndex=0,this._sortingOrder=0,this._screenType=l.c.SCREEN_TYPE_SCREEN,this._screenDistance=1,this.parentScreen=null,this.childScreens=[],this._isFallbackOverlay=!1,this.canvasMeshInstance=new Xe(this),this.registered=!1,this._rootPointerEventReceiver=!1,this["__UnityEngine.Canvas"]=null,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"ScreenComponent")}_updateScreenInChildren(){for(let e=0;e<this.entity._children.length;e++){const t=this.entity._children[e].element;t&&t._updateScreen(t._findScreen(),!0)}this.syncDrawOrder()}syncDrawOrder(){const e=y.a.getApplication().systems.screen;e&&(e._dirtyOrder=!0)}_calcProjectionMatrix(){const e=this._screenType,t=this.camera;e===l.c.SCREEN_TYPE_CAMERA&&t&&(t.projection===l.c.PROJECTION_PERSPECTIVE?this._planeHeight=Math.tan(t.fov/2*(Math.PI/180))*Math.abs(2*this._screenDistance):this._planeHeight=2*t.orthoHeight),this.entity.element.dirtifyScreen()}_findParentScreen(){return lt.findParentScreen(this.entity.parent)}onRemove(){this.reparentChildrenToNewCanvas()}reparentChildrenToNewCanvas(){const e=lt.findParentScreen(this.entity.parent),t=this.canvasMeshInstance.renderers;for(let s=0;s<t.length;s++){t[s].reparentCanvas(e)}}_updateScale(){this.scale=this._calcScale(this._resolution,this.referenceResolution)}_calcScale(e,t){if(this._scaleMode===_s.SCALEMODE_NONE)return this.scaleFactor;if(this._scaleMode===_s.SCALEMODE_EXPAND)return Math.min(e.x/t.x,e.y/t.y);if(this._scaleMode===_s.SCALEMODE_SHRINK)return Math.max(e.x/t.x,e.y/t.y);{const s=Math.log2(e.x/t.x),i=Math.log2(e.y/t.y),n=(0,f.p)(s,i,this.scaleBlend);return Math.pow(2,n)}}_onResize(e,t,s,i){const n=this.camera;let r=s,a=i;n&&n.renderTarget&&(r=n.renderTarget.width,a=n.renderTarget.height),this._screenType!==l.c.SCREEN_TYPE_WORLD&&(this._resolution.set(r,a),this.resolution=this._resolution),this.entity.element&&this.entity.element.triggerOnElementDimesionsChange(!0,!0)}_updateStencilRecursive(e,t){const s=e.element,i=!!s,n=i&&(s._image&&s._image.masksChildren||s._text&&s._text.masksChildren);i&&(s._masked=t.maskingDepth>0,n&&(t.maskingDepth++,t.ref=(1<<t.maskingDepth)-1),s.stencilLayer=t.ref);for(let s=0;s<e._children.length;s++)this._updateStencilRecursive(e._children[s],t);i&&n&&(t.maskingDepth--,t.ref=(1<<t.maskingDepth)-1)}_updateStencilParameters(){if(!this.entity)return;this._updateStencilRecursive(this.entity,{ref:0,maskingDepth:0})}addScreenToScene(){this.screenType!==l.c.SCREEN_TYPE_SCREEN&&this.system.app.scene.addRenderer(this),this.system.app.graphicsDevice.events.on("resizecanvas",this._onResize,this),this.parentScreen?this.parentScreen.addChildScreen(this):this.system.app.scene.addScreen(this),this.system.app.scene.events.fire("canvasScreenAddedOnScene",this)}removeScreenFromScene(){this.screenType!==l.c.SCREEN_TYPE_SCREEN&&this.system.app.scene.removeRenderer(this),this.system.app.graphicsDevice.events.off("resizecanvas",this._onResize,this),this.parentScreen?this.parentScreen.removeChildScreen(this):this.system.app.scene.removeScreen(this),this.system.app.scene.events.fire("canvasScreenRemovedFromScene",this)}addChildScreen(e){this.childScreens.includes(e)||this.childScreens.push(e)}removeChildScreen(e){this.childScreens=this.childScreens.filter((t=>t!==e))}onEnable(){this.registered=!0;const e=lt.findParentScreen(this.entity.parent);this.setParentScreen(e,!0);const t=this.system.app.graphicsDevice;this._onResize(t.width,t.height,t._width,t._height),this.notifyChildrenCanvasRenderers(this.entity.children)}notifyChildrenCanvasRenderers(e){for(let t=0;t<e.length;t++){const s=e[t];for(let e=0;e<s._canvasElements.length;e++){const t=s._canvasElements[e].canvasRenderer;t&&t.handle.updateParentCanvas()}this.notifyChildrenCanvasRenderers(s.children)}}onDisable(){this.system.app.scene.events.off("canvasScreenAddedOnScene",this.canvasScreenAddedOnSceneEventHandler,this),this.system.app.scene.events.off("canvasScreenRemovedFromScene",this.canvasScreenRemovedFromSceneEventHandler,this),this.setParentScreen(null,!1),this.registered=!1}onDestroy(){this.reparentChildrenToNewCanvas()}getMeshInstancesForRender(){return this.meshInstances}setParentScreen(e,t){t=!!t,this.registered&&this.removeScreenFromScene(),this.parentScreen=e,this.registered&&t&&(this.addScreenToScene(),this.system.app.scene.events.on("canvasScreenAddedOnScene",this.canvasScreenAddedOnSceneEventHandler,this),this.system.app.scene.events.on("canvasScreenRemovedFromScene",this.canvasScreenRemovedFromSceneEventHandler,this),null===e&&(this.system.app.scene.events.fire("newRootCanvasScreenAdded",this),this.system.app.scene.events.on("newRootCanvasScreenAdded",this.newRootCanvasScreenAddedEventHandler,this)))}canvasScreenAddedOnSceneEventHandler(e){e===this.parentScreen&&this.addScreenToScene()}canvasScreenRemovedFromSceneEventHandler(e){e===this.parentScreen&&this.removeScreenFromScene()}newRootCanvasScreenAddedEventHandler(e){e===lt.findParentScreen(this.entity.parent)&&(this.system.app.scene.events.off("newRootCanvasScreenAdded",this.newRootCanvasScreenAddedEventHandler,this),this.setParentScreen(e,this.enabled))}get enabled(){return this.data.enabled}set enabled(e){const t=this.data.enabled;this.data.enabled=e,this.events.fire("set_enabled","enabled",t,e)}get resolution(){return this._resolution}set resolution(e){const t=this.camera;t&&t.renderTarget||(this._screenType!==l.c.SCREEN_TYPE_SCREEN?0!==e.x&&0!==e.y&&this._resolution.set(e.x,e.y):t&&t.renderTarget||this._resolution.set(this.system.app.graphicsDevice._width,this.system.app.graphicsDevice._height),this._scaleMode===_s.SCALEMODE_NONE&&this.referenceResolution.copy(this._resolution),this._updateScale(),this._calcProjectionMatrix(),this.events.fire("set:resolution",this._resolution))}get offset(){return this._offset}set offset(e){this._offset.set(e.x,e.y),this._calcProjectionMatrix()}get referenceResolution(){return this._scaleMode===_s.SCALEMODE_NONE?this._resolution:this._referenceResolution}set referenceResolution(e){this._referenceResolution.set(e.x,e.y),this._updateScale(),this._calcProjectionMatrix(),this.events.fire("set:referenceresolution",this._resolution)}get screenType(){return this.parentScreen?this.parentScreen.screenType:this._screenType}set screenType(e){if(this._screenType===e)return;this.registered&&this.enabled&&this.removeScreenFromScene(),this._screenType=e;const t=this.screenType;if(this._isFallbackOverlay=!1,t===l.c.SCREEN_TYPE_CAMERA)if(this._camera){const e=this._camera._node.getPosition();this.entity.element.anchoredPosition.set(e.x,e.y)}else this._isFallbackOverlay=!0,this._screenType=l.c.SCREEN_TYPE_SCREEN;t===l.c.SCREEN_TYPE_SCREEN&&(this.canvasMeshInstance.visible=!0),this._resolution.set(this.system.app.graphicsDevice._width,this.system.app.graphicsDevice._height),this.resolution=this._resolution,this.events.fire("set:screentype",t),this.registered&&this.enabled&&this.addScreenToScene()}get screenDistance(){return this._screenDistance}set screenDistance(e){this._screenDistance=e,this._calcProjectionMatrix()}get scaleMode(){return this._scaleMode}set scaleMode(e){e!==_s.SCALEMODE_NONE&&e!==_s.SCALEMODE_BLEND&&e!==_s.SCALEMODE_EXPAND&&e!==_s.SCALEMODE_SHRINK&&(e=_s.SCALEMODE_NONE),this._screenType===l.c.SCREEN_TYPE_WORLD&&e!==_s.SCALEMODE_NONE&&(e=_s.SCALEMODE_NONE),this._scaleMode=e,this.resolution=this._resolution,this.events.fire("set:scalemode",this._scaleMode)}get scaleBlend(){return this._scaleBlend}set scaleBlend(e){this._scaleBlend=e,this._updateScale(),this._calcProjectionMatrix(),this.events.fire("set:scaleblend",this._scaleBlend)}get camera(){return this.rootScreen._camera}set camera(e){this._camera=e,this._camera||this.screenType!==l.c.SCREEN_TYPE_CAMERA||(this.screenType=l.c.SCREEN_TYPE_SCREEN,this._isFallbackOverlay=!0),this._camera&&this._isFallbackOverlay&&(this.screenType=l.c.SCREEN_TYPE_CAMERA),e&&e.renderTarget&&this._resolution.set(e.renderTarget.width,e.renderTarget.height),this._calcProjectionMatrix()}get meshInstances(){return[this.canvasMeshInstance]}get referencePixelsPerUnit(){return this._referencePixelsPerUnit}set referencePixelsPerUnit(e){this._referencePixelsPerUnit=e,this.resolution=this._resolution}get rootScreen(){let e=this,t=this.entity;for(;t;)e=t.screen||e,t=t.parent;return e}get scaleFactor(){return this._scaleFactor}set scaleFactor(e){this._scaleFactor=e,this._updateScale(),this._calcProjectionMatrix()}get overrideSorting(){return this["__UnityEngine.Canvas"].overrideSorting}set overrideSorting(e){this["__UnityEngine.Canvas"].overrideSorting=e}get sortingOrder(){return!this.isNested||this["__UnityEngine.Canvas"].overrideSorting?this._sortingOrder:this.parentScreen.sortingOrder}set sortingOrder(e){this._sortingOrder=e}get sortingLayerIndex(){return!this.isNested||this["__UnityEngine.Canvas"].overrideSorting?this._sortingLayerIndex:this.parentScreen.sortingLayerIndex}set sortingLayerIndex(e){this._sortingLayerIndex=e}get isNested(){return!!this.parentScreen}get drawOrder(){return this.entity.element.drawOrder}get isFallbackOverlay(){return this._isFallbackOverlay}set isFallbackOverlay(e){this._isFallbackOverlay=e}}_s.SCALEMODE_NONE="none",_s.SCALEMODE_BLEND="blend",_s.SCALEMODE_EXPAND="expand",_s.SCALEMODE_SHRINK="shrink";const ms=function(e,t){const s=e.element;if(s){const i=e._unityComponents.canvasRenderer[0];i&&(i._absoluteDepth=t),s.drawOrder=t++}const i=e._children;for(let e=0;e<i.length;e++)t=ms(i[e],t);return t};class ps extends y.b{constructor(e){super(e),this.id="screen",this.app=e,this._dirtyOrder=!1,this.ComponentType=_s,y.b.events.on("update",this._onUpdate,this),this.events.on("beforeremove",this.onRemoveComponent,this)}initializeComponentData(e,t){e.syncDrawOrder(),super.initializeComponentData(e,t),e._updateScreenInChildren()}destroy(){this.events.off()}_syncDrawOrder(){ms(y.a.getApplication().root,0)}_onUpdate(e){this._dirtyOrder&&(this._syncDrawOrder(),this._dirtyOrder=!1)}onRemoveComponent(e,t){t.onRemove()}onDestroy(e,t){t.onRemove()}}const gs="unity_GUIZTestMode";class fs{constructor(e){this.node=e.entity,this.isSortingGroup=!0,this.isCanvas=!1,this._childRenderers=[],this._sortingGroupComponent=e,this.visible=!0,this.cull=!0,this.device=y.a.getApplication().graphicsDevice,this.renderer=y.a.getApplication().renderer,this.drawOrder=0,this.zdist=0,this._material=null,this.mesh=new i.b,this._lightProbe=null,this.instancingData=null,this._shaderDefs=0,this.isIndexBufferEmpty=!1,this._aabb=new f.b,this.visibleThisFrame=!0,this.skinInstance=null,this.morphInstance=null,this._mesh=null,this._material=UnityEngine.Canvas.GetDefaultCanvasMaterial().handle,this._material.setParameter(gs,l.c.FUNC_ALWAYS+1);const t=this._material.parameters.unity_GUIZTestMode;t.scopeId||(t.scopeId=this.device.scope.resolve(gs))}addRenderer(e){this._childRenderers.includes(e)||(this._childRenderers.push(e),this._aabb.add(e.aabb))}removeRenderer(e){const t=this._childRenderers.indexOf(e);t>=0&&(this._childRenderers.splice(t,1),this._aabb=new f.b,this._childRenderers.forEach((e=>{this._aabb.add(e.aabb)})))}_sortDrawCalls(e){return e.sort(Ye.a.genericSortTransparent)}render(e,t,s,i){const n=this.getDrawCalls();for(let r=0;r<n.length;r++){const a=n[r];a.isSortingGroup?a.render(e,t,s,i):this.renderer.renderMeshInstance(e,t,s,a,i)}}getDrawCalls(){const e=this._collectMeshInstances(),t=this.childSortingGroupInstances.filter((e=>e.node.enabled));return this._sortDrawCalls([...e,...t])}_collectMeshInstances(){return this._childRenderers.filter((e=>e.enabled&&e.entity.enabled)).reduce(((e,t)=>[...e,...t.meshInstances]),[])}get material(){return this._material}get aabb(){return this._aabb}get childSortingGroupInstances(){return this._sortingGroupComponent.childSortingGroups.map((e=>e.sortingGroupRenderInstance))}get sortingLayerIndex(){return this._sortingGroupComponent.sortingLayerIndex}get sortingOrder(){return this._sortingGroupComponent.sortingOrder}}class ys extends $e.a{constructor(e,t,s,i){super(),this._entity=null,this._enabled=e,this._sortingLayerIndex=t||0,this._sortingOrder=s||0,this._sortingLayerName=i,this.internalExecutionOrder=10,this._childSortingGroups=[],this._parentSortingGroup=null,this.sortingGroupRenderInstance=new fs(this),this["__UnityEngine.Rendering.SortingGroup"]=null,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"SortingGroupComponent")}onEnable(){return!!super.onEnable()&&(this.onSortingGroupChanged(),this._entity.events.on("insert",this.onSortingGroupChanged,this),this._entity.events.on("insertRecursive",this.onSortingGroupChanged,this),!0)}onDisable(){return!!super.onDisable()&&(this._entity.events.off("insert"),this._entity.events.off("insertRecursive"),!0)}configureForEntity(e){this.entity=e}addRenderer(e){y.a.getApplication().scene.removeRenderer(e),this.sortingGroupRenderInstance.addRenderer(e)}removeRenderer(e){this.sortingGroupRenderInstance.removeRenderer(e),y.a.getApplication().scene.addRenderer(e)}getMeshInstancesForRender(){return[this.sortingGroupRenderInstance]}onSortingGroupChanged(){this._setupParentSortingGroup(),this._setupChildRenderers(this._entity)}_setupParentSortingGroup(){const e=this._findParentSortingGroup();e!==this&&(this._parentSortingGroup&&(this._parentSortingGroup.removeChildSortingGroup(this),y.a.getApplication().scene.addRenderer(this)),this._parentSortingGroup=e,this._parentSortingGroup&&this._parentSortingGroup.enabled&&(this._parentSortingGroup.addChildSortingGroup(this),y.a.getApplication().scene.removeRenderer(this)))}_setupChildRenderers(e){const t=e._unityComponents.renderer[0];t instanceof pc.SpriteRendererComponent&&this.addRenderer(t);const s=e.children;for(let e=0;e<s.length;e++){const t=s[e];if(t._unityComponents.sortingGroup[0])continue;const i=t._unityComponents.renderer[0];(i instanceof pc.SpriteRendererComponent||i instanceof pc.MeshRendererComponent&&t._unityComponents.canvasRenderer[0])&&this.addRenderer(i),i instanceof pc.SpriteMaskComponent&&(i._isCustomRangeActive||(i.model.meshInstances[0].sortingLayerIndex=this._sortingLayerIndex,i.model.meshInstances[1].sortingLayerIndex=this._sortingLayerIndex),this.addRenderer(i)),this._setupChildRenderers(s[e])}}addChildSortingGroup(e){this._childSortingGroups.includes(e)||this._childSortingGroups.push(e)}removeChildSortingGroup(e){const t=this._childSortingGroups.indexOf(e);t>-1&&this._childSortingGroups.splice(t,1)}_findParentSortingGroup(){let e=null,t=this.entity._parent;if(!t)return null;for(;t;){if(e=t&&t._unityComponents.sortingGroup[0],e)return e;t=t._parent}return null}get entity(){return this._entity}set entity(e){this._entity=e,this.sortingGroupRenderInstance.node=e}get childSortingGroups(){return this._childSortingGroups}get sortingLayerIndex(){return this._sortingLayerIndex}set sortingLayerIndex(e){this._sortingLayerIndex=e}get sortingOrder(){return this._sortingOrder}set sortingOrder(e){this._sortingOrder=e}get sortingLayerName(){return this._sortingLayerName}}class Es extends y.j{constructor(e){super(e),this.id="sortingGroup"}}var Ts=s(19);class Ss extends Ts.a{constructor(){super(),this.id=0,this._material=null,this["__UnityEngine.Skybox"]=null,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"SkyboxComponent")}get material(){return this._material}set material(e){this._material=e}}class As extends y.j{constructor(e){super(e),this.id="skybox"}}pc.Mesh=i.b,pc.MeshInstance=i.a,pc.Model=n.a,pc.UnityMaterial=p,pc.Camera=g.a,pc.Light=R,pc.Skin=I.b,pc.VertexFormat=U.a,pc.VertexBuffer=M.a,pc.IndexBuffer=B.a,pc.Texture=d.a,pc.VertexIterator=N.a,pc.GraphicsDevice=class{constructor(e,t={}){this.canvas=e,this.shader=null,this.precision="mediump",this.maxCubeMapSize=0,this.maxTextureSize=0,this.maxVolumeSize=0,this.maxAnisotropy=0,this.indexBuffer=null,this.vertexBuffers=[],this.vbOffsets=[],this._enableAutoInstancing=!!t.enableAutoInstancing,this.autoInstancingMaxObjects=16384,this.attributesInvalidated=!0,this.activeFramebuffer=null,this.textureUnit=0,this.textureUnits=[],this._maxPixelRatio=2,this.renderTarget=null,this._width=0,this._height=0,this.updateClientRect(),this.vertexShaderCache={},this.fragmentShaderCache={},this.shaders=[],this.textures=[],this.targets=[],this.contextLost=!1,this._contextLostHandler=function(e){e.preventDefault(),this.contextLost=!0,DEBUG&&UnityEngine.Debug.Log$1("GraphicsDevice: WebGL context lost.")}.bind(this),this._contextRestoredHandler=function(){DEBUG&&UnityEngine.Debug.Log$1("GraphicsDevice: WebGL context restored."),this.initializeContext(),this.contextLost=!1}.bind(this),e.addEventListener("webglcontextlost",this._contextLostHandler,!1),e.addEventListener("webglcontextrestored",this._contextRestoredHandler,!1);const s=!(!t||void 0===t.preferWebGl2)&&t.preferWebGl2;this.webgl2=!1;const i=s?["webgl2","experimental-webgl2","webgl","experimental-webgl"]:["webgl","experimental-webgl"];let n=null;(t=t||{}).stencil=!0,t.antialias=!t.disableAntiAliasing&&window.devicePixelRatio<2,t.alpha=!1;for(let r=0;r<i.length;r++){try{n=e.getContext(i[r],t)}catch(e){}if(n){this.webgl2=s&&r<2;break}}if(!n)throw new Error("WebGL not supported");n.blendColor(0,0,0,0),this.blending=!1,this.blendSrc=l.c.BLENDMODE_ONE,this.blendDst=l.c.BLENDMODE_ZERO,this.blendSrcAlpha=l.c.BLENDMODE_ONE,this.blendDstAlpha=l.c.BLENDMODE_ZERO,this.separateAlphaBlend=!1,this.blendEquation=l.c.BLENDEQUATION_ADD,this.blendAlphaEquation=l.c.BLENDEQUATION_ADD,this.separateAlphaEquation=!1,this.writeRed=!0,this.writeGreen=!0,this.writeBlue=!0,this.writeAlpha=!0,this.depthTest=!0,this.depthFunc=l.c.FUNC_LESSEQUAL,this.depthWrite=!0,this.stencil=!1,this.stencilFuncFront=this.stencilFuncBack=l.c.FUNC_ALWAYS,this.stencilRefFront=this.stencilRefBack=0,this.stencilMaskFront=this.stencilMaskBack=255,this.stencilFailFront=this.stencilFailBack=l.c.STENCILOP_KEEP,this.stencilZfailFront=this.stencilZfailBack=l.c.STENCILOP_KEEP,this.stencilZpassFront=this.stencilZpassBack=l.c.STENCILOP_KEEP,this.stencilWriteMaskFront=255,this.stencilWriteMaskBack=255,this.alphaToCoverage=!1,this.raster=!0,this.depthBiasEnabled=!1,this.vx=this.vy=this.vw=this.vh=0,this.sx=this.sy=this.sw=this.sh=0,this.cullMode=l.c.CULLFACE_BACK,this.cullFace=n.BACK,this.unpackFlipY=!1,this.unpackPremultiplyAlpha=!1,this.clearDepth=1,this.clearRed=0,this.clearBlue=0,this.clearGreen=0,this.clearAlpha=0,this.clearStencil=0,this.gl=n,this.initializeExtensions(),this.initializeCapabilities(),this.initializeRenderState();for(let e=0;e<this.maxCombinedTextures;e++)this.textureUnits.push([null,null,null]);this.defaultClearOptions={color:[0,0,0,1],depth:1,stencil:0,flags:l.c.CLEARFLAG_COLOR|l.c.CLEARFLAG_DEPTH},this.glAddress=[n.REPEAT,n.CLAMP_TO_EDGE,n.MIRRORED_REPEAT],this.glBlendEquation=[n.FUNC_ADD,n.FUNC_SUBTRACT,n.FUNC_REVERSE_SUBTRACT,this.webgl2?n.MIN:this.extBlendMinmax?this.extBlendMinmax.MIN_EXT:n.FUNC_ADD,this.webgl2?n.MAX:this.extBlendMinmax?this.extBlendMinmax.MAX_EXT:n.FUNC_ADD],this.glBlendFunction=[n.ZERO,n.ONE,n.SRC_COLOR,n.ONE_MINUS_SRC_COLOR,n.DST_COLOR,n.ONE_MINUS_DST_COLOR,n.SRC_ALPHA,n.SRC_ALPHA_SATURATE,n.ONE_MINUS_SRC_ALPHA,n.DST_ALPHA,n.ONE_MINUS_DST_ALPHA],this.glComparison=[n.NEVER,n.LESS,n.EQUAL,n.LEQUAL,n.GREATER,n.NOTEQUAL,n.GEQUAL,n.ALWAYS],this.glStencilOp=[n.KEEP,n.ZERO,n.REPLACE,n.INCR,n.INCR_WRAP,n.DECR,n.DECR_WRAP,n.INVERT],this.glClearFlag=[0,n.COLOR_BUFFER_BIT,n.DEPTH_BUFFER_BIT,n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT,n.STENCIL_BUFFER_BIT,n.STENCIL_BUFFER_BIT|n.COLOR_BUFFER_BIT,n.STENCIL_BUFFER_BIT|n.DEPTH_BUFFER_BIT,n.STENCIL_BUFFER_BIT|n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT],this.glCull=[0,n.BACK,n.FRONT,n.FRONT_AND_BACK],this.glFilter=[n.NEAREST,n.LINEAR,n.NEAREST_MIPMAP_NEAREST,n.NEAREST_MIPMAP_LINEAR,n.LINEAR_MIPMAP_NEAREST,n.LINEAR_MIPMAP_LINEAR],this.glPrimitive=[n.POINTS,n.LINES,n.LINE_LOOP,n.LINE_STRIP,n.TRIANGLES,n.TRIANGLE_STRIP,n.TRIANGLE_FAN],this.glType=[n.BYTE,n.UNSIGNED_BYTE,n.SHORT,n.UNSIGNED_SHORT,n.INT,n.UNSIGNED_INT,n.FLOAT],this.pcUniformType={},this.pcUniformType[n.BOOL]=l.c.UNIFORMTYPE_BOOL,this.pcUniformType[n.INT]=l.c.UNIFORMTYPE_INT,this.pcUniformType[n.FLOAT]=l.c.UNIFORMTYPE_FLOAT,this.pcUniformType[n.FLOAT_VEC2]=l.c.UNIFORMTYPE_VEC2,this.pcUniformType[n.FLOAT_VEC3]=l.c.UNIFORMTYPE_VEC3,this.pcUniformType[n.FLOAT_VEC4]=l.c.UNIFORMTYPE_VEC4,this.pcUniformType[n.INT_VEC2]=l.c.UNIFORMTYPE_IVEC2,this.pcUniformType[n.INT_VEC3]=l.c.UNIFORMTYPE_IVEC3,this.pcUniformType[n.INT_VEC4]=l.c.UNIFORMTYPE_IVEC4,this.pcUniformType[n.BOOL_VEC2]=l.c.UNIFORMTYPE_BVEC2,this.pcUniformType[n.BOOL_VEC3]=l.c.UNIFORMTYPE_BVEC3,this.pcUniformType[n.BOOL_VEC4]=l.c.UNIFORMTYPE_BVEC4,this.pcUniformType[n.FLOAT_MAT2]=l.c.UNIFORMTYPE_MAT2,this.pcUniformType[n.FLOAT_MAT3]=l.c.UNIFORMTYPE_MAT3,this.pcUniformType[n.FLOAT_MAT4]=l.c.UNIFORMTYPE_MAT4,this.pcUniformType[n.SAMPLER_2D]=l.c.UNIFORMTYPE_TEXTURE2D,this.pcUniformType[n.SAMPLER_CUBE]=l.c.UNIFORMTYPE_TEXTURECUBE,this.webgl2&&(this.pcUniformType[n.SAMPLER_2D_SHADOW]=l.c.UNIFORMTYPE_TEXTURE2D_SHADOW,this.pcUniformType[n.SAMPLER_CUBE_SHADOW]=l.c.UNIFORMTYPE_TEXTURECUBE_SHADOW,this.pcUniformType[n.SAMPLER_3D]=l.c.UNIFORMTYPE_TEXTURE3D),this.targetToSlot={},this.targetToSlot[n.TEXTURE_2D]=0,this.targetToSlot[n.TEXTURE_CUBE_MAP]=1,this.targetToSlot[n.TEXTURE_3D]=2,this.commitFunction=[],this.commitFunction[l.c.UNIFORMTYPE_BOOL]=function(e,t){e.value!==t&&(n.uniform1i(e.locationId,t),e.value=t)},this.commitFunction[l.c.UNIFORMTYPE_INT]=this.commitFunction[l.c.UNIFORMTYPE_BOOL],this.commitFunction[l.c.UNIFORMTYPE_FLOAT]=function(e,t){e.value!==t&&(n.uniform1f(e.locationId,t),e.value=t)},this.commitFunction[l.c.UNIFORMTYPE_VEC2]=function(e,t){const s=e.value,i=t[0],r=t[1];s[0]===i&&s[1]===r||(s[0]=i,s[1]=r,n.uniform2fv(e.locationId,s))},this.commitFunction[l.c.UNIFORMTYPE_VEC3]=function(e,t){const s=e.value,i=t[0],r=t[1],a=t[2];s[0]===i&&s[1]===r&&s[2]===a||(s[0]=i,s[1]=r,s[2]=a,n.uniform3fv(e.locationId,s))},this.commitFunction[l.c.UNIFORMTYPE_VEC4]=function(e,t){const s=e.value,i=t[0],r=t[1],a=t[2],o=t[3];(t.length>4||s[0]!==i||s[1]!==r||s[2]!==a||s[3]!==o)&&(n.uniform4fv(e.locationId,t),s[0]=i,s[1]=r,s[2]=a,s[3]=o)},this.commitFunction[l.c.UNIFORMTYPE_IVEC2]=function(e,t){const s=e.value,i=t[0],r=t[1];s[0]===i&&s[1]===r||(n.uniform2iv(e.locationId,t),s[0]=i,s[1]=r)},this.commitFunction[l.c.UNIFORMTYPE_BVEC2]=this.commitFunction[l.c.UNIFORMTYPE_IVEC2],this.commitFunction[l.c.UNIFORMTYPE_IVEC3]=function(e,t){const s=e.value,i=t[0],r=t[1],a=t[2];s[0]===i&&s[1]===r&&s[2]===a||(n.uniform3iv(e.locationId,t),s[0]=i,s[1]=r,s[2]=a)},this.commitFunction[l.c.UNIFORMTYPE_BVEC3]=this.commitFunction[l.c.UNIFORMTYPE_IVEC3],this.commitFunction[l.c.UNIFORMTYPE_IVEC4]=function(e,t){const s=e.value,i=t[0],r=t[1],a=t[2],o=t[3];s[0]===i&&s[1]===r&&s[2]===a&&s[3]===o||(n.uniform4iv(e.locationId,t),s[0]=i,s[1]=r,s[2]=a,s[3]=o)},this.commitFunction[l.c.UNIFORMTYPE_BVEC4]=this.commitFunction[l.c.UNIFORMTYPE_IVEC4],this.commitFunction[l.c.UNIFORMTYPE_MAT2]=function(e,t){n.uniformMatrix2fv(e.locationId,!1,t)},this.commitFunction[l.c.UNIFORMTYPE_MAT3]=function(e,t){n.uniformMatrix3fv(e.locationId,!1,t)},this.commitFunction[l.c.UNIFORMTYPE_MAT4]=function(e,t){n.uniformMatrix4fv(e.locationId,!1,t)},this.commitFunction[l.c.UNIFORMTYPE_FLOATARRAY]=function(e,t){n.uniform1fv(e.locationId,t)},this.scope=new pe("Device"),this.programLib=new le(this);for(const e in q)q.hasOwnProperty(e)&&this.programLib.register(e,q[e]);this.events=new l.a(this),this.supportsBoneTextures=this.extTextureFloat&&this.maxVertexTextures>0,this.useTexCubeLod=this.extTextureLod&&this.maxTextures<16;let r=this.vertexUniformsCount;r-=16,r-=8,r-=1,r-=16,this.boneLimit=Math.floor(r/4),this.boneLimit=Math.min(this.boneLimit,128),"Mali-450 MP"===this.unmaskedRenderer&&(this.boneLimit=34),"Apple A8 GPU"===this.unmaskedRenderer&&(this.forceCpuParticles=!0),this._drawCallsPerFrame=0,this._vram={tex:0,vb:0,ib:0},this._shaderStats={vsCompiled:0,fsCompiled:0,linked:0,materialShaders:0,compileTime:0},this.constantTexSource=this.scope.resolve("source"),this.extTextureFloat?this.webgl2?this.textureFloatRenderable=!!this.extColorBufferFloat:this.textureFloatRenderable=we(n,n.FLOAT):this.textureFloatRenderable=!1,this.extTextureHalfFloat?this.webgl2?this.textureHalfFloatRenderable=!!this.extColorBufferFloat:this.textureHalfFloatRenderable=we(n,this.extTextureHalfFloat.HALF_FLOAT_OES):this.textureHalfFloatRenderable=!1,this.initializeGrabPassTexture(),this.activeDrawCall=null,this.geometryStateManager=new fe(this)}getPrecision(){const e=this.gl;let t="highp";if(e.getShaderPrecisionFormat){const s=e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT),i=e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT),n=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT),r=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT),a=s.precision>0&&n.precision>0,o=i.precision>0&&r.precision>0;a||(o?(t="mediump",DEBUG&&UnityEngine.Debug.LogWarning$1("WARNING: highp not supported, using mediump")):(t="lowp",DEBUG&&UnityEngine.Debug.LogWarning$1("WARNING: highp and mediump not supported, using lowp")))}return t}initializeExtensions(){const e=this.gl,t=e.getSupportedExtensions()||[],s=function(...s){let i=null;for(let n=0;n<s.length;n++)-1!==t.indexOf(s[n])&&(i=e.getExtension(s[n]));return i};if(this.webgl2)this.extBlendMinmax=!0,this.extDrawBuffers=!0,this.extInstancing=!0,this.extStandardDerivatives=!0,this.extTextureFloat=!0,this.extTextureHalfFloat=!0,this.extTextureHalfFloatLinear=!0,this.extTextureLod=!0,this.extUintElement=!0,this.extVertexArrayObject=!0,this.extColorBufferFloat=s("EXT_color_buffer_float");else{if(this.extBlendMinmax=s("EXT_blend_minmax"),this.extDrawBuffers=s("EXT_draw_buffers"),this.extInstancing=s("ANGLE_instanced_arrays"),this.extInstancing){const t=this.extInstancing;e.drawArraysInstanced=t.drawArraysInstancedANGLE.bind(t),e.drawElementsInstanced=t.drawElementsInstancedANGLE.bind(t),e.vertexAttribDivisor=t.vertexAttribDivisorANGLE.bind(t)}else console.warn("Instancing is not supported on this device, some of the features will not work properly (e.g. particles)"),e.drawArraysInstanced=function(){},e.drawElementsInstanced=function(){},e.vertexAttribDivisor=function(){};if(this.extStandardDerivatives=s("OES_standard_derivatives"),this.extTextureFloat=s("OES_texture_float"),this.extTextureHalfFloat=s("OES_texture_half_float"),this.extTextureHalfFloatLinear=s("OES_texture_half_float_linear"),this.extTextureLod=s("EXT_shader_texture_lod"),this.extUintElement=s("OES_element_index_uint"),this.extVertexArrayObject=s("OES_vertex_array_object"),this.extVertexArrayObject){const t=this.extVertexArrayObject;e.createVertexArray=t.createVertexArrayOES.bind(t),e.deleteVertexArray=t.deleteVertexArrayOES.bind(t),e.isVertexArray=t.isVertexArrayOES.bind(t),e.bindVertexArray=t.bindVertexArrayOES.bind(t)}this.extColorBufferFloat=null,this.extDepthTexture=s("WEBGL_depth_texture")}this.extDebugRendererInfo=s("WEBGL_debug_renderer_info"),this.extTextureFloatLinear=s("OES_texture_float_linear"),this.extTextureFilterAnisotropic=s("EXT_texture_filter_anisotropic","WEBKIT_EXT_texture_filter_anisotropic"),this.extCompressedTextureETC1=s("WEBGL_compressed_texture_etc1"),this.extCompressedTextureETC=s("WEBGL_compressed_texture_etc"),this.extCompressedTexturePVRTC=s("WEBGL_compressed_texture_pvrtc","WEBKIT_WEBGL_compressed_texture_pvrtc"),this.extCompressedTextureS3TC=s("WEBGL_compressed_texture_s3tc","WEBKIT_WEBGL_compressed_texture_s3tc"),this.extParallelShaderCompile=s("KHR_parallel_shader_compile")}initializeCapabilities(){const e=this.gl;let t;this.maxPrecision=this.precision=this.getPrecision();const s=e.getContextAttributes();this.supportsMsaa=s.antialias,this.supportsStencil=s.stencil,this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxCubeMapSize=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),this.maxRenderBufferSize=e.getParameter(e.MAX_RENDERBUFFER_SIZE),this.maxTextures=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),this.maxCombinedTextures=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),this.maxVertexTextures=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this.vertexUniformsCount=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),this.fragmentUniformsCount=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),this.maxVertexAttributes=e.getParameter(e.MAX_VERTEX_ATTRIBS),this.webgl2?(this.maxDrawBuffers=e.getParameter(e.MAX_DRAW_BUFFERS),this.maxColorAttachments=e.getParameter(e.MAX_COLOR_ATTACHMENTS),this.maxVolumeSize=e.getParameter(e.MAX_3D_TEXTURE_SIZE)):(t=this.extDrawBuffers,this.maxDrawBuffers=t?e.getParameter(t.MAX_DRAW_BUFFERS_EXT):1,this.maxColorAttachments=t?e.getParameter(t.MAX_COLOR_ATTACHMENTS_EXT):1,this.maxVolumeSize=1),t=this.extDebugRendererInfo,this.unmaskedRenderer=t?e.getParameter(t.UNMASKED_RENDERER_WEBGL):"",this.unmaskedVendor=t?e.getParameter(t.UNMASKED_VENDOR_WEBGL):"",t=this.extTextureFilterAnisotropic,this.maxAnisotropy=t?e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1}initializeRenderState(){const e=this.gl;this.blending=!1,e.disable(e.BLEND),this.blendSrc=l.c.BLENDMODE_ONE,this.blendDst=l.c.BLENDMODE_ZERO,this.blendSrcAlpha=l.c.BLENDMODE_ONE,this.blendDstAlpha=l.c.BLENDMODE_ZERO,this.separateAlphaBlend=!1,this.blendEquation=l.c.BLENDEQUATION_ADD,this.blendAlphaEquation=l.c.BLENDEQUATION_ADD,this.separateAlphaEquation=!1,e.blendFunc(e.ONE,e.ZERO),e.blendEquation(e.FUNC_ADD),this.writeRed=!0,this.writeGreen=!0,this.writeBlue=!0,this.writeAlpha=!0,e.colorMask(!0,!0,!0,!0),this.cullMode=l.c.CULLFACE_BACK,e.enable(e.CULL_FACE),e.cullFace(e.BACK),this.depthTest=!0,e.enable(e.DEPTH_TEST),this.depthFunc=l.c.FUNC_LESSEQUAL,e.depthFunc(e.LEQUAL),this.depthWrite=!0,e.depthMask(!0),this.stencil=!1,e.disable(e.STENCIL_TEST),this.stencilFuncFront=this.stencilFuncBack=l.c.FUNC_ALWAYS,this.stencilRefFront=this.stencilRefBack=0,this.stencilMaskFront=this.stencilMaskBack=255,e.stencilFunc(e.ALWAYS,0,255),this.stencilFailFront=this.stencilFailBack=l.c.STENCILOP_KEEP,this.stencilZfailFront=this.stencilZfailBack=l.c.STENCILOP_KEEP,this.stencilZpassFront=this.stencilZpassBack=l.c.STENCILOP_KEEP,this.stencilWriteMaskFront=255,this.stencilWriteMaskBack=255,e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.stencilMask(255),this.alphaToCoverage=!1,this.raster=!0,this.webgl2&&(e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.disable(e.RASTERIZER_DISCARD)),this.depthBiasEnabled=!1,e.disable(e.POLYGON_OFFSET_FILL),this.clearDepth=1,e.clearDepth(1),this.clearRed=0,this.clearBlue=0,this.clearGreen=0,this.clearAlpha=0,e.clearColor(0,0,0,0),this.clearStencil=0,e.clearStencil(0),this.vx=this.vy=this.vw=this.vh=0,this.sx=this.sy=this.sw=this.sh=0,this.webgl2?e.hint(e.FRAGMENT_SHADER_DERIVATIVE_HINT,e.NICEST):this.extStandardDerivatives&&e.hint(this.extStandardDerivatives.FRAGMENT_SHADER_DERIVATIVE_HINT_OES,e.NICEST),e.enable(e.SCISSOR_TEST),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),this.unpackFlipY=!1,e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),this.unpackPremultiplyAlpha=!1,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),this.depthRange=new f.l(0,1),e.depthRange(this.depthRange.x,this.depthRange.y)}initializeContext(){this.initializeExtensions(),this.initializeCapabilities(),this.initializeRenderState();for(let e=0,t=this.shaders.length;e<t;e++)this.compileShaderAndBindAttributes(this.shaders[e]);this.shader=null,this.indexBuffer=null,this.attributesInvalidated=!0,this.vertexBuffers=[];for(let e=0,t=this.textures.length;e<t;e++){const t=this.textures[e];this.destroyTexture(t),t.dirtyAll()}this.textureUnit=0,this.textureUnits.length=0;for(let e=0;e<this.maxCombinedTextures;e++)this.textureUnits.push([null,null,null]);for(let e=0,t=this.targets.length;e<t;e++)this.targets[e]._glFrameBuffer=null,this.targets[e]._glDepthBuffer=null,this.targets[e]._glResolveFrameBuffer=null,this.targets[e]._glMsaaColorBuffer=null,this.targets[e]._glMsaaDepthBuffer=null;this.renderTarget=null,this.activeFramebuffer=null}initializeGrabPassTexture(){if(this.grabPassTexture)return;const e=new d.a(this,{name:"texture_grabPass",format:l.c.PIXELFORMAT_R8_G8_B8_A8,autoMipmap:!1});e.minFilter=l.c.FILTER_LINEAR,e.magFilter=l.c.FILTER_LINEAR,e.addressU=l.c.ADDRESS_CLAMP_TO_EDGE,e.addressV=l.c.ADDRESS_CLAMP_TO_EDGE,e.setSource(this.canvas);const t=this.scope.resolve(e.name);t.setValue(e),this.grabPassTextureId=t,this.grabPassTexture=e}updateClientRect(){this.clientRect=this.canvas.getBoundingClientRect()}setViewport(e,t,s,i){this.vx===e&&this.vy===t&&this.vw===s&&this.vh===i||(this.gl.viewport(e,t,s,i),this.vx=e,this.vy=t,this.vw=s,this.vh=i)}setDepthRange(e,t){this.depthRange.x===e&&this.depthRange.y===t||(this.depthRange.set(e,t),this.gl.depthRange(e,t))}setScissor(e,t,s,i){this.sx===e&&this.sy===t&&this.sw===s&&this.sh===i||(this.gl.scissor(e,t,s,i),this.sx=e,this.sy=t,this.sw=s,this.sh=i)}getProgramLibrary(){return this.programLib}setProgramLibrary(e){this.programLib=e}setFramebuffer(e){this.activeFramebuffer!==e&&(this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,e),this.activeFramebuffer=e)}_checkFbo(){const e=this.gl;switch(e.checkFramebufferStatus(e.FRAMEBUFFER)){case e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:UnityEngine.Debug.LogError$1("ERROR: FRAMEBUFFER_INCOMPLETE_ATTACHMENT");break;case e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:UnityEngine.Debug.LogError$1("ERROR: FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");break;case e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:UnityEngine.Debug.LogError$1("ERROR: FRAMEBUFFER_INCOMPLETE_DIMENSIONS");break;case e.FRAMEBUFFER_UNSUPPORTED:UnityEngine.Debug.LogError$1("ERROR: FRAMEBUFFER_UNSUPPORTED");case e.FRAMEBUFFER_COMPLETE:}}updateBegin(){const e=this.gl,t=this.renderTarget;if(t)if(t._glFrameBuffer){this.setFramebuffer(t._glFrameBuffer);const e=t._colorBuffer;e&&(this.setViewport(0,0,e._width,e._height),this.setScissor(0,0,e._width,e._height))}else{t._device=this,t._glFrameBuffer=e.createFramebuffer(),this.setFramebuffer(t._glFrameBuffer);const s=t._colorBuffer;s&&(s._glTexture||(s._width=Math.min(s.width,this.maxRenderBufferSize),s._height=Math.min(s.height,this.maxRenderBufferSize),this.setTexture(s,0)),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,s._cubemap?e.TEXTURE_CUBE_MAP_POSITIVE_X+t._face:e.TEXTURE_2D,s._glTexture,0));const i=t._depthBuffer;if(i&&this.webgl2)i._glTexture||(i._width=Math.min(i.width,this.maxRenderBufferSize),i._height=Math.min(i.height,this.maxRenderBufferSize),this.setTexture(i,0)),t._stencil?e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,i._cubemap?e.TEXTURE_CUBE_MAP_POSITIVE_X+t._face:e.TEXTURE_2D,t._depthBuffer._glTexture,0):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,i._cubemap?e.TEXTURE_CUBE_MAP_POSITIVE_X+t._face:e.TEXTURE_2D,t._depthBuffer._glTexture,0);else if(t._depth)if(this.extDepthTexture&&t.depthBuffer)this.setTexture(t.depthBuffer,0),t._stencil?e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,i._cubemap?e.TEXTURE_CUBE_MAP_POSITIVE_X+t._face:e.TEXTURE_2D,t._depthBuffer._glTexture,0):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,i._cubemap?e.TEXTURE_CUBE_MAP_POSITIVE_X+t._face:e.TEXTURE_2D,t._depthBuffer._glTexture,0);else{t._samples>1&&this.webgl2||(t._glDepthBuffer||(t._glDepthBuffer=e.createRenderbuffer()),e.bindRenderbuffer(e.RENDERBUFFER,t._glDepthBuffer),t._stencil?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t._glDepthBuffer)):(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t._glDepthBuffer)),e.bindRenderbuffer(e.RENDERBUFFER,null))}DEBUG&&this._checkFbo(),this.webgl2&&t._samples>1&&(t._glResolveFrameBuffer=t._glFrameBuffer,t._glFrameBuffer=e.createFramebuffer(),this.setFramebuffer(t._glFrameBuffer),s&&(t._glMsaaColorBuffer||(t._glMsaaColorBuffer=e.createRenderbuffer()),e.bindRenderbuffer(e.RENDERBUFFER,t._glMsaaColorBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,t._samples,s._glInternalFormat,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,t._glMsaaColorBuffer)),t._depth&&(t._glMsaaDepthBuffer||(t._glMsaaDepthBuffer=e.createRenderbuffer()),e.bindRenderbuffer(e.RENDERBUFFER,t._glMsaaDepthBuffer),t._stencil?(e.renderbufferStorageMultisample(e.RENDERBUFFER,t._samples,e.DEPTH24_STENCIL8,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t._glMsaaDepthBuffer)):(e.renderbufferStorageMultisample(e.RENDERBUFFER,t._samples,e.DEPTH_COMPONENT32F,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t._glMsaaDepthBuffer))),DEBUG&&this._checkFbo()),this.targets.push(t)}else this.setFramebuffer(null)}updateEnd(){const e=this.gl,t=this.renderTarget;if(t){const s=t._colorBuffer;s&&s._glTexture&&s.mipmaps&&s._pot&&(this.activeTexture(this.maxCombinedTextures-1),this.bindTexture(s),e.generateMipmap(s._glTarget)),this.webgl2&&t._samples>1&&t.autoResolve&&t.resolve()}this.geometryStateManager.unbindVertexArrayObject()}initializeTexture(e){const t=this.gl;let s;switch(e._glTexture=t.createTexture(),e._levels&&e._levels[0]&&"VIDEO"===e._levels[0].tagName&&(e._needsUpdate=!0),e._glTarget=e._cubemap?t.TEXTURE_CUBE_MAP:e._volume?t.TEXTURE_3D:t.TEXTURE_2D,e._format){case l.c.PIXELFORMAT_A8:e._glFormat=t.ALPHA,e._glInternalFormat=t.ALPHA,e._glPixelType=t.UNSIGNED_BYTE;break;case l.c.PIXELFORMAT_L8:e._glFormat=t.LUMINANCE,e._glInternalFormat=t.LUMINANCE,e._glPixelType=t.UNSIGNED_BYTE;break;case l.c.PIXELFORMAT_L8_A8:e._glFormat=t.LUMINANCE_ALPHA,e._glInternalFormat=t.LUMINANCE_ALPHA,e._glPixelType=t.UNSIGNED_BYTE;break;case l.c.PIXELFORMAT_R5_G6_B5:e._glFormat=t.RGB,e._glInternalFormat=t.RGB,e._glPixelType=t.UNSIGNED_SHORT_5_6_5;break;case l.c.PIXELFORMAT_R5_G5_B5_A1:e._glFormat=t.RGBA,e._glInternalFormat=t.RGBA,e._glPixelType=t.UNSIGNED_SHORT_5_5_5_1;break;case l.c.PIXELFORMAT_R4_G4_B4_A4:e._glFormat=t.RGBA,e._glInternalFormat=t.RGBA,e._glPixelType=t.UNSIGNED_SHORT_4_4_4_4;break;case l.c.PIXELFORMAT_R8_G8_B8:e._glFormat=t.RGB,e._glInternalFormat=this.webgl2?t.RGB8:t.RGB,e._glPixelType=t.UNSIGNED_BYTE;break;case l.c.PIXELFORMAT_R8_G8_B8_A8:e._glFormat=t.RGBA,e._glInternalFormat=this.webgl2?t.RGBA8:t.RGBA,e._glPixelType=t.UNSIGNED_BYTE;break;case l.c.PIXELFORMAT_DXT1:s=this.extCompressedTextureS3TC,e._glFormat=t.RGB,e._glInternalFormat=s.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case l.c.PIXELFORMAT_DXT3:s=this.extCompressedTextureS3TC,e._glFormat=t.RGBA,e._glInternalFormat=s.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case l.c.PIXELFORMAT_DXT5:s=this.extCompressedTextureS3TC,e._glFormat=t.RGBA,e._glInternalFormat=s.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;case l.c.PIXELFORMAT_ETC1:s=this.extCompressedTextureETC1,e._glFormat=t.RGB,e._glInternalFormat=s.COMPRESSED_RGB_ETC1_WEBGL;break;case l.c.PIXELFORMAT_PVRTC_2BPP_RGB_1:s=this.extCompressedTexturePVRTC,e._glFormat=t.RGB,e._glInternalFormat=s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;break;case l.c.PIXELFORMAT_PVRTC_2BPP_RGBA_1:s=this.extCompressedTexturePVRTC,e._glFormat=t.RGBA,e._glInternalFormat=s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;break;case l.c.PIXELFORMAT_PVRTC_4BPP_RGB_1:s=this.extCompressedTexturePVRTC,e._glFormat=t.RGB,e._glInternalFormat=s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;break;case l.c.PIXELFORMAT_PVRTC_4BPP_RGBA_1:s=this.extCompressedTexturePVRTC,e._glFormat=t.RGBA,e._glInternalFormat=s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;break;case l.c.PIXELFORMAT_ETC2_RGB:s=this.extCompressedTextureETC,e._glFormat=t.RGB,e._glInternalFormat=s.COMPRESSED_RGB8_ETC2;break;case l.c.PIXELFORMAT_ETC2_RGBA:s=this.extCompressedTextureETC,e._glFormat=t.RGBA,e._glInternalFormat=s.COMPRESSED_RGBA8_ETC2_EAC;break;case l.c.PIXELFORMAT_RGB16F:s=this.extTextureHalfFloat,e._glFormat=t.RGB,this.webgl2?(e._glInternalFormat=t.RGB16F,e._glPixelType=t.HALF_FLOAT):(e._glInternalFormat=t.RGB,e._glPixelType=s.HALF_FLOAT_OES);break;case l.c.PIXELFORMAT_RGBA16F:s=this.extTextureHalfFloat,e._glFormat=t.RGBA,this.webgl2?(e._glInternalFormat=t.RGBA16F,e._glPixelType=t.HALF_FLOAT):(e._glInternalFormat=t.RGBA,e._glPixelType=s.HALF_FLOAT_OES);break;case l.c.PIXELFORMAT_RGB32F:e._glFormat=t.RGB,this.webgl2?e._glInternalFormat=t.RGB32F:e._glInternalFormat=t.RGB,e._glPixelType=t.FLOAT;break;case l.c.PIXELFORMAT_RGBA32F:e._glFormat=t.RGBA,this.webgl2?e._glInternalFormat=t.RGBA32F:e._glInternalFormat=t.RGBA,e._glPixelType=t.FLOAT;break;case l.c.PIXELFORMAT_R32F:e._glFormat=t.RED,e._glInternalFormat=t.R32F,e._glPixelType=t.FLOAT;break;case l.c.PIXELFORMAT_DEPTH:this.webgl2?(e._glFormat=t.DEPTH_COMPONENT,e._glInternalFormat=t.DEPTH_COMPONENT32F,e._glPixelType=t.FLOAT):(e._glFormat=t.DEPTH_COMPONENT,e._glInternalFormat=t.DEPTH_COMPONENT,e._glPixelType=t.UNSIGNED_INT);break;case l.c.PIXELFORMAT_DEPTHSTENCIL:e._glFormat=t.DEPTH_STENCIL,e._glInternalFormat=t.DEPTH24_STENCIL8,e._glPixelType=t.UNSIGNED_INT_24_8;break;case l.c.PIXELFORMAT_111110F:e._glFormat=t.RGB,e._glInternalFormat=t.R11F_G11F_B10F,e._glPixelType=t.FLOAT;break;case l.c.PIXELFORMAT_SRGB:e._glFormat=t.RGB,e._glInternalFormat=t.SRGB8,e._glPixelType=t.UNSIGNED_BYTE;break;case l.c.PIXELFORMAT_SRGBA:e._glFormat=t.RGBA,e._glInternalFormat=t.SRGB8_ALPHA8,e._glPixelType=t.UNSIGNED_BYTE}this.textures.push(e)}destroyTexture(e){if(e._glTexture){const t=this.textures.indexOf(e);-1!==t&&this.textures.splice(t,1);for(const t in this.scope.variables)if(this.scope.variables.hasOwnProperty(t)){const s=this.scope.variables[t];s.value===e&&(s.value=null)}for(let t=0;t<this.textureUnits.length;t++){const s=this.textureUnits[t];for(let t=0;t<s.length;t++)s[t]===e._glTexture&&(s[t]=null)}this.gl.deleteTexture(e._glTexture),delete e._glTexture,delete e._glTarget,delete e._glFormat,delete e._glInternalFormat,delete e._glPixelType,this._vram.tex-=e._gpuSize}}setUnpackFlipY(e){if(this.unpackFlipY!==e){this.unpackFlipY=e;const t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e)}}setUnpackPremultiplyAlpha(e){if(this.unpackPremultiplyAlpha!==e){this.unpackPremultiplyAlpha=e;const t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e)}}uploadCubemapFromAtlas(e){const t=e._atlas,s=this.gl,i=this.textureUnits[0],n=i?i[0]:null;t._glTexture||(this.setTexture(t,0),this.uploadTexture(t));const r=this.activeFramebuffer,a=s.createFramebuffer();this.setFramebuffer(a),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,t._glTexture,0),e._needsUpload=!1,e._needsMipmapsUpload=!1,this.setTexture(e,0);for(let i=0;i<e._rects.length;i+=4){const n=e._rects[i+0]*t._width,r=e._rects[i+1]*t._height,a=e._rects[i+2]*t._width-n,o=e._rects[i+3]*t._height-r,h=i/4|0,l=h/6|0,c=h%6|0;s.copyTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+c,l,e._glInternalFormat,n,r,a,o,0)}e._mipmaps&&24===e._rects.length&&s.generateMipmap(e._glTarget),this.setFramebuffer(r),n&&(s.bindTexture(s.TEXTURE_2D,n),this.textureUnits[0][0]=n)}uploadTexture(e){const t=this.gl;if(!e._needsUpload&&(e._needsMipmapsUpload&&e._mipmapsUploaded||!e._pot))return;let s,i,n=0;for(e._cubemap&&e._atlas&&e._rects&&this.uploadCubemapFromAtlas(e);e._levels[n]||0===n;)if(e._needsUpload||0!==n){if(n&&(!e._needsMipmapsUpload||!e._mipmaps))break;if(s=e._levels[n],1!==n||e._compressed||(t.generateMipmap(e._glTarget),e._mipmapsUploaded=!0),e._cubemap){let r;if(s[0]instanceof HTMLCanvasElement||s[0]instanceof HTMLImageElement||s[0]instanceof HTMLVideoElement)for(r=0;r<6;r++){if(!e._levelsUpdated[0][r])continue;let i=s[r];i instanceof HTMLImageElement&&(i.width>this.maxCubeMapSize||i.height>this.maxCubeMapSize)&&(i=Ce(i,this.maxCubeMapSize),0===n&&(e.width=i.width,e.height=i.height)),this.setUnpackFlipY(e._flipY),this.setUnpackPremultiplyAlpha(e._premultiplyAlpha),t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+r,n,e._glInternalFormat,e._glFormat,e._glPixelType,i)}else for(this.setUnpackPremultiplyAlpha(e._premultiplyAlpha),i=1/Math.pow(2,n),r=0;r<6;r++){if(!e._levelsUpdated[0][r])continue;const a=s[r];e._compressed?t.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+r,n,e._glInternalFormat,Math.max(e._width*i,1),Math.max(e._height*i,1),0,a):(this.setUnpackFlipY(e._flipY),this.setUnpackPremultiplyAlpha(e._premultiplyAlpha),t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+r,n,e._glInternalFormat,Math.max(e._width*i,1),Math.max(e._height*i,1),0,e._glFormat,e._glPixelType,a))}}else e._volume?(i=1/Math.pow(2,n),e._compressed?t.compressedTexImage3D(t.TEXTURE_3D,n,e._glInternalFormat,Math.max(e._width*i,1),Math.max(e._height*i,1),Math.max(e._depth*i,1),0,s):(this.setUnpackFlipY(!1),this.setUnpackPremultiplyAlpha(e._premultiplyAlpha),t.texImage3D(t.TEXTURE_3D,n,e._glInternalFormat,Math.max(e._width*i,1),Math.max(e._height*i,1),Math.max(e._depth*i,1),0,e._glFormat,e._glPixelType,s))):(s instanceof HTMLCanvasElement||s instanceof HTMLImageElement||s instanceof HTMLVideoElement?(s instanceof HTMLImageElement&&(s.width>this.maxTextureSize||s.height>this.maxTextureSize)&&(s=Ce(s,this.maxTextureSize),0===n&&(e.width=s.width,e.height=s.height)),this.setUnpackFlipY(e._flipY),this.setUnpackPremultiplyAlpha(e._premultiplyAlpha),t.texImage2D(t.TEXTURE_2D,n,e._glInternalFormat,e._glFormat,e._glPixelType,s)):(i=1/Math.pow(2,n),e._compressed?t.compressedTexImage2D(t.TEXTURE_2D,n,e._glInternalFormat,Math.max(e._width*i,1),Math.max(e._height*i,1),0,s):(this.setUnpackFlipY(!1),this.setUnpackPremultiplyAlpha(e._premultiplyAlpha),t.texImage2D(t.TEXTURE_2D,n,e._glInternalFormat,Math.max(e._width*i,1),Math.max(e._height*i,1),0,e._glFormat,e._glPixelType,s),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST))),e._mipmapsUploaded=0!==n);n++}else n++;if(e._needsUpload)if(e._cubemap)for(let t=0;t<6;t++)e._levelsUpdated[0][t]=!1;else e._levelsUpdated[0]=!1;!e._compressed&&e._mipmaps&&e._needsMipmapsUpload&&e._pot&&1===e._levels.length&&(t.generateMipmap(e._glTarget),e._mipmapsUploaded=!0),e._gpuSize&&(this._vram.tex-=e._gpuSize),e._gpuSize=e.gpuSize,this._vram.tex+=e._gpuSize}activeTexture(e){this.textureUnit!==e&&(this.gl.activeTexture(this.gl.TEXTURE0+e),this.textureUnit=e)}bindTexture(e){const t=e._glTarget,s=e._glTexture,i=this.textureUnit,n=this.targetToSlot[t];this.textureUnits[i][n]!==s&&(this.gl.bindTexture(t,s),this.textureUnits[i][n]=s)}bindTextureOnUnit(e,t){const s=e._glTarget,i=e._glTexture,n=this.targetToSlot[s];this.textureUnits[t][n]!==i&&(this.activeTexture(t),this.gl.bindTexture(s,i),this.textureUnits[t][n]=i)}setTextureParameters(e){const t=this.gl,s=e._parameterFlags,i=e._glTarget;if(1&s){let s=e._minFilter;(!e._pot||!e._mipmaps||e._compressed&&1===e._levels.length)&&(s===l.c.FILTER_NEAREST_MIPMAP_NEAREST||s===l.c.FILTER_NEAREST_MIPMAP_LINEAR?s=l.c.FILTER_NEAREST:s!==l.c.FILTER_LINEAR_MIPMAP_NEAREST&&s!==l.c.FILTER_LINEAR_MIPMAP_LINEAR||(s=l.c.FILTER_LINEAR)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,this.glFilter[s])}if(2&s&&t.texParameteri(i,t.TEXTURE_MAG_FILTER,this.glFilter[e._magFilter]),4&s&&(this.webgl2?t.texParameteri(i,t.TEXTURE_WRAP_S,this.glAddress[e._addressU]):t.texParameteri(i,t.TEXTURE_WRAP_S,this.glAddress[e._pot?e._addressU:l.c.ADDRESS_CLAMP_TO_EDGE])),8&s&&(this.webgl2?t.texParameteri(i,t.TEXTURE_WRAP_T,this.glAddress[e._addressV]):t.texParameteri(i,t.TEXTURE_WRAP_T,this.glAddress[e._pot?e._addressV:l.c.ADDRESS_CLAMP_TO_EDGE])),16&s&&this.webgl2&&t.texParameteri(i,t.TEXTURE_WRAP_R,this.glAddress[e._addressW]),32&s&&this.webgl2&&t.texParameteri(i,t.TEXTURE_COMPARE_MODE,e._compareOnRead?t.COMPARE_REF_TO_TEXTURE:t.NONE),64&s&&this.webgl2&&t.texParameteri(i,t.TEXTURE_COMPARE_FUNC,this.glComparison[e._compareFunc]),128&s){const s=this.extTextureFilterAnisotropic;s&&t.texParameterf(i,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.max(1,Math.min(Math.round(e._anisotropy),this.maxAnisotropy)))}}setTexture(e,t){e._glTexture||this.initializeTexture(e),e._parameterFlags>0||e._needsUpload||e._needsMipmapsUpload?(this.activeTexture(t),this.bindTexture(e),e._parameterFlags&&(this.setTextureParameters(e),e._parameterFlags=0),(e._needsUpload||e._needsMipmapsUpload)&&(this.uploadTexture(e),e!==this.grabPassTexture&&(e.markUploaded(),e._needsMipmapsUpload=!1))):this.bindTextureOnUnit(e,t)}setBuffers(e,t={}){const s=this.gl;let i,n;const r=this.shader.attributes;if(this.attributesInvalidated){let t,a,o;const h=!!this.activeDrawCall;this.geometryStateManager.disableAllAttributes();for(let c=0,d=r.length;c<d;c++){i=r[c];const d=i.locationId;t=i.scopeId.value;const u=d>l.c.ShaderAttributeSlots[l.c.SEMANTIC_TEXCOORD0]&&d<=l.c.ShaderAttributeSlots[l.c.SEMANTIC_TEXCOORD3],_=h&&this.activeDrawCall.hasUVChannel(i.scopeId.name),m=u&&h&&!_;if(null!==t&&(a=this.vertexBuffers[t.stream],o=this.vbOffsets[t.stream]||0,a&&!a.format.elementMap[t.name]&&!m)){const e=i.locationId;this.geometryStateManager.disableVertexAttribArray(e),t=null}if(t||m){if(void 0===a)continue;let r;if(m){const e=a.format.elements;let t=l.c.ShaderAttributeSlots[l.c.SEMANTIC_TEXCOORD0]-1;for(let s=0;s<e.length;s++){const n=e[s],a=l.c.ShaderAttributeSlots[n.name];a>t&&a<=i.locationId&&(r=n.scopeId.value,t=a)}if(!r){this.geometryStateManager.disableVertexAttribArray(d),s.vertexAttrib4fv(d,Te);continue}}else r=t;n=a.bufferId,this.geometryStateManager.bindBuffer(s.ARRAY_BUFFER,n),this.geometryStateManager.enableVertexAttribArray(d),this.geometryStateManager.vertexAttribPointer(d,r.numComponents,this.glType[r.dataType],r.normalize,r.stride,r.offset+o);t&&1===t.stream&&e>0?this.geometryStateManager.vertexAttribDivisor(d,1):this.geometryStateManager.vertexAttribDivisor(d,0)}else this.geometryStateManager.disableVertexAttribArray(d),"POSITION"===i.scopeId.name?s.vertexAttrib4fv(d,Se):"COLOR"===i.scopeId.name?s.vertexAttrib4fv(d,Ee):"TANGENT"===i.scopeId.name?s.vertexAttrib4fv(d,Ae):"NORMAL"===i.scopeId.name?s.vertexAttrib4fv(d,be):s.vertexAttrib4fv(d,Te)}this.attributesInvalidated=!1}for(let e=0,n=r.length;e<n;e++){i=r[e];const n=t[i.scopeId.name];if(!n)continue;const a=i.locationId;this.geometryStateManager.disableVertexAttribArray(a),s.vertexAttrib4fv(a,n)}n=this.indexBuffer?this.indexBuffer.bufferId:null,this.geometryStateManager.bindBuffer(s.ELEMENT_ARRAY_BUFFER,n)}draw(e,t,s,i={},n=null){const r=this.gl,a=this.shader,o=a.samplers,h=a.uniforms;if(0===t)return;this.activeDrawCall=n,t>0&&(this.attributesInvalidated=!0),this.setBuffers(t,i),this.geometryStateManager.applyState(this.activeDrawCall);let c=0;for(let e=0,t=o.length;e<t;e++){const t=o[e];let i=t.scopeId.value;null==i&&(i=s[t.scopeId.name]||l.c.UniformDefaultValues[t.dataType]);const n=t.scopeId.name;if(t.meta||(t.meta={hdr:this.scope.resolve(n+"_HDR"),texels:this.scope.resolve(n+"_TexelSize")},t.meta.hdr.setValue([0,0,0,0]),t.meta.texels.setValue([0,0,0,0])),i instanceof d.a){const e=i;this.setTexture(e,c);const s=t.meta.hdr.value,n=t.meta.texels.value;e.rgbm?(s[0]=5*e.intensity,s[1]=1,s[2]=0,s[3]=1):(s[0]=1*e.intensity,s[1]=1,s[2]=0,s[3]=0),n[0]=1/e.width,n[1]=1/e.height,n[2]=e.width,n[3]=e.height,t.meta.hdr.versionObject.increment(),t.meta.texels.versionObject.increment(),DEBUG&&this.renderTarget&&this.renderTarget._samples<2&&(this.renderTarget.colorBuffer&&this.renderTarget.colorBuffer===e?UnityEngine.Debug.LogError$1("Trying to bind current color buffer as a texture"):this.renderTarget.depthBuffer&&this.renderTarget.depthBuffer===e&&UnityEngine.Debug.LogError$1("Trying to bind current depth buffer as a texture")),t.slot!==c&&(r.uniform1i(t.locationId,c),t.slot=c),c++}else{const e=i;t.array.length=0;for(let s=0;s<e.length;s++){const i=e[s];this.setTexture(i,c),t.array[s]=c,c++}r.uniform1iv(t.locationId,t.array)}}for(let e=0,t=h.length;e<t;e++){const t=h[e],i=t.scopeId,n=t.version,r=i.versionObject.version;n.globalId===r.globalId&&n.revision===r.revision||(n.globalId=r.globalId,n.revision=r.revision,null===i.value||void 0===i.value?this.commitFunction[t.dataType](t,s[i.name]||l.c.UniformDefaultValues[t.dataType]):this.commitFunction[t.dataType](t,i.value))}const u=this.glPrimitive[e.type],_=e.count;if(e.type===l.c.PRIMITIVE_TRIANGLES&&y.d.instance.recordTriangles(t>0?_*t:_),e.indexed){const s=this.indexBuffer,i=s.glFormat,n=e.base*s.bytesPerIndex;t>0?r.drawElementsInstanced(u,_,i,n,t):r.drawElements(u,_,i,n)}else{const s=e.base;t>0?r.drawArraysInstanced(u,s,_,t):r.drawArrays(u,s,_)}this._drawCallsPerFrame++,this.activeDrawCall=null}clear(e){const t=this.defaultClearOptions,s=l.c.CLEARFLAG_COLOR|l.c.CLEARFLAG_STENCIL|l.c.CLEARFLAG_DEPTH,i=void 0===(e=e||t).flags||null===e.flags?t.flags:e.flags;if(0!==i){const n=this.gl;if(i&l.c.CLEARFLAG_COLOR){const s=e.color?e.color:t.color;this.setClearColor(s[0],s[1],s[2],s[3])}if(i&l.c.CLEARFLAG_DEPTH){const s=void 0===e.depth||null===e.depth?t.depth:e.depth;this.setClearDepth(s),this.depthWrite||n.depthMask(!0)}if(i&l.c.CLEARFLAG_STENCIL){const s=void 0===e.stencil||null===e.stencil?t.stencil:e.stencil;this.setClearStencil(s)}n.clear(this.glClearFlag[i&s]),i&l.c.CLEARFLAG_DEPTH&&(this.depthWrite||n.depthMask(!1))}}readPixels(e,t,s,i,n){const r=this.gl;r.readPixels(e,t,s,i,r.RGBA,r.UNSIGNED_BYTE,n)}setClearDepth(e){e!==this.clearDepth&&(this.gl.clearDepth(e),this.clearDepth=e)}setClearColor(e,t,s,i){e===this.clearRed&&t===this.clearGreen&&s===this.clearBlue&&i===this.clearAlpha||(this.gl.clearColor(e,t,s,i),this.clearRed=e,this.clearGreen=t,this.clearBlue=s,this.clearAlpha=i)}setClearStencil(e){e!==this.clearStencil&&(this.gl.clearStencil(e),this.clearStencil=e)}setRenderTarget(e){this.renderTarget=e}getRenderTarget(){return this.renderTarget}getDepthTest(){return this.depthTest}setDepthTest(e){if(this.depthTest!==e){const t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.depthTest=e}}setDepthFunc(e){this.depthFunc!==e&&(this.gl.depthFunc(this.glComparison[e]),this.depthFunc=e)}getDepthWrite(){return this.depthWrite}setDepthWrite(e){this.depthWrite!==e&&(this.gl.depthMask(e),this.depthWrite=e)}setColorWrite(e,t,s,i){this.writeRed===e&&this.writeGreen===t&&this.writeBlue===s&&this.writeAlpha===i||(this.gl.colorMask(e,t,s,i),this.writeRed=e,this.writeGreen=t,this.writeBlue=s,this.writeAlpha=i)}setDepthBias(e){this.depthBiasEnabled!==e&&(this.depthBiasEnabled=e,e?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL))}setDepthBiasValues(e,t){this.gl.polygonOffset(t,e)}getBlending(){return this.blending}setBlending(e){if(this.blending!==e){const t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.blending=e}}setStencilTest(e){if(this.stencil!==e){const t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.stencil=e}}setStencilFunc(e,t,s){if(this.stencilFuncFront!==e||this.stencilRefFront!==t||this.stencilMaskFront!==s||this.stencilFuncBack!==e||this.stencilRefBack!==t||this.stencilMaskBack!==s){this.gl.stencilFunc(this.glComparison[e],t,s),this.stencilFuncFront=this.stencilFuncBack=e,this.stencilRefFront=this.stencilRefBack=t,this.stencilMaskFront=this.stencilMaskBack=s}}setStencilFuncFront(e,t,s){if(this.stencilFuncFront!==e||this.stencilRefFront!==t||this.stencilMaskFront!==s){const i=this.gl;i.stencilFuncSeparate(i.FRONT,this.glComparison[e],t,s),this.stencilFuncFront=e,this.stencilRefFront=t,this.stencilMaskFront=s}}setStencilFuncBack(e,t,s){if(this.stencilFuncBack!==e||this.stencilRefBack!==t||this.stencilMaskBack!==s){const i=this.gl;i.stencilFuncSeparate(i.BACK,this.glComparison[e],t,s),this.stencilFuncBack=e,this.stencilRefBack=t,this.stencilMaskBack=s}}setStencilOperation(e,t,s,i){this.stencilFailFront===e&&this.stencilZfailFront===t&&this.stencilZpassFront===s&&this.stencilFailBack===e&&this.stencilZfailBack===t&&this.stencilZpassBack===s||(this.gl.stencilOp(this.glStencilOp[e],this.glStencilOp[t],this.glStencilOp[s]),this.stencilFailFront=this.stencilFailBack=e,this.stencilZfailFront=this.stencilZfailBack=t,this.stencilZpassFront=this.stencilZpassBack=s),this.stencilWriteMaskFront===i&&this.stencilWriteMaskBack===i||(this.gl.stencilMask(i),this.stencilWriteMaskFront=i,this.stencilWriteMaskBack=i)}setStencilOperationFront(e,t,s,i){this.stencilFailFront===e&&this.stencilZfailFront===t&&this.stencilZpassFront===s||(this.gl.stencilOpSeparate(this.gl.FRONT,this.glStencilOp[e],this.glStencilOp[t],this.glStencilOp[s]),this.stencilFailFront=e,this.stencilZfailFront=t,this.stencilZpassFront=s),this.stencilWriteMaskFront!==i&&(this.gl.stencilMaskSeparate(this.gl.FRONT,i),this.stencilWriteMaskFront=i)}setStencilOperationBack(e,t,s,i){this.stencilFailBack===e&&this.stencilZfailBack===t&&this.stencilZpassBack===s||(this.gl.stencilOpSeparate(this.gl.BACK,this.glStencilOp[e],this.glStencilOp[t],this.glStencilOp[s]),this.stencilFailBack=e,this.stencilZfailBack=t,this.stencilZpassBack=s),this.stencilWriteMaskBack!==i&&(this.gl.stencilMaskSeparate(this.gl.BACK,i),this.stencilWriteMaskBack=i)}setBlendFunction(e,t){(this.blendSrc!==e||this.blendDst!==t||this.separateAlphaBlend)&&(this.gl.blendFunc(this.glBlendFunction[e],this.glBlendFunction[t]),this.blendSrc=e,this.blendDst=t,this.separateAlphaBlend=!1)}setBlendFunctionSeparate(e,t,s,i){this.blendSrc===e&&this.blendDst===t&&this.blendSrcAlpha===s&&this.blendDstAlpha===i&&this.separateAlphaBlend||(this.gl.blendFuncSeparate(this.glBlendFunction[e],this.glBlendFunction[t],this.glBlendFunction[s],this.glBlendFunction[i]),this.blendSrc=e,this.blendDst=t,this.blendSrcAlpha=s,this.blendDstAlpha=i,this.separateAlphaBlend=!0)}setBlendEquationSeparate(e,t){this.blendEquation===e&&this.blendAlphaEquation===t&&this.separateAlphaEquation||(this.gl.blendEquationSeparate(this.glBlendEquation[e],this.glBlendEquation[t]),this.blendEquation=e,this.blendAlphaEquation=t,this.separateAlphaEquation=!0)}setCullMode(e){if(this.cullMode!==e){if(e===l.c.CULLFACE_NONE)this.gl.disable(this.gl.CULL_FACE);else{this.cullMode===l.c.CULLFACE_NONE&&this.gl.enable(this.gl.CULL_FACE);const t=this.glCull[e];this.cullFace!==t&&(this.gl.cullFace(t),this.cullFace=t)}this.cullMode=e}}getCullMode(){return this.cullMode}setIndexBuffer(e){this.indexBuffer=e}setVertexBuffer(e,t,s){if(!e)return;this.vertexBuffers[t]===e&&this.vbOffsets[t]===s||(this.vertexBuffers[t]=e,this.vbOffsets[t]=s,this.attributesInvalidated=!0);const i=e.getFormat().elements;for(let e=0;e<i.length;e++){const s=i[e];s.stream===t&&s.scopeId.value===s||(s.stream=t,s.scopeId.setValue(s),this.attributesInvalidated=!0)}}compileShaderSource(e,t){const s=this.gl;let i=t?this.vertexShaderCache[e]:this.fragmentShaderCache[e];return i||(i=s.createShader(t?s.VERTEX_SHADER:s.FRAGMENT_SHADER),s.shaderSource(i,e),s.compileShader(i),t?this.vertexShaderCache[e]=i:this.fragmentShaderCache[e]=i),i}compileShaderAndBindAttributes(e){const t=this.gl,s=e.definition,i=this.compileShaderSource(s.vshader,!0),n=this.compileShaderSource(s.fshader,!1),r=t.createProgram();if(t.attachShader(r,n),t.attachShader(r,i),this.webgl2&&s.useTransformFeedback){const e=s.attributes,i=[];for(const t in e)e.hasOwnProperty(t)&&i.push("out_"+t);t.transformFeedbackVaryings(r,i,t.INTERLEAVED_ATTRIBS)}for(const e in s.attributes)if(s.attributes.hasOwnProperty(e)){const i=s.attributes[e],n=l.c.ShaderAttributeSlots[i];t.bindAttribLocation(r,n,e)}e._glProgram=r,e.ready=!1}linkShader(e){this.gl.linkProgram(e._glProgram)}createShader(e,t=!0){t&&(this.compileShaderAndBindAttributes(e),this.linkShader(e)),this.shaders.push(e)}destroyShader(e){const t=this.shaders.indexOf(e);-1!==t&&this.shaders.splice(t,1),e._glProgram&&(this.gl.deleteProgram(e._glProgram),e._glProgram=null,this.removeShaderFromCache(e))}_addLineNumbers(e){const t=e.split("\n");for(let e=0,s=t.length;e<s;e++)t[e]=e+1+":\t"+t[e];return t.join("\n")}postLink(e){const t=this.gl,s=e._glProgram,i=e.definition;if(!t.getProgramParameter(s,t.LINK_STATUS))return UnityEngine.Debug.LogError$1("Failed to link shader program. Error: "+t.getProgramInfoLog(s)),!1;let n,r,a,o;n=0;const h=t.getProgramParameter(s,t.ACTIVE_ATTRIBUTES);for(;n<h;)r=t.getActiveAttrib(s,n++),a=t.getAttribLocation(s,r.name),void 0===i.attributes[r.name]&&UnityEngine.Debug.LogError$1('Vertex shader attribute "'+r.name+'" is not mapped to a semantic in shader definition.'),o=new de(this,i.attributes[r.name],this.pcUniformType[r.type],a),e.attributes.push(o);e.samplers=[],e.uniforms=[],n=0;const l=t.getProgramParameter(s,t.ACTIVE_UNIFORMS);for(;n<l;)r=t.getActiveUniform(s,n++),a=t.getUniformLocation(s,r.name),o=new de(this,r.name,this.pcUniformType[r.type],a),r.type===t.SAMPLER_2D||r.type===t.SAMPLER_CUBE||this.webgl2&&(r.type===t.SAMPLER_2D_SHADOW||r.type===t.SAMPLER_CUBE_SHADOW||r.type===t.SAMPLER_3D)?e.samplers.push(o):e.uniforms.push(o);return e.ready=!0,!0}setShader(e){if(e!==this.shader){if(!e.ready){if(!this.postLink(e))return!1;e.uniformsUsage=this.getUniformsInUse(e.uniforms)}this.shader=e,this.gl.useProgram(e._glProgram),this.attributesInvalidated=!0}return!0}getHdrFormat(){return this.textureHalfFloatRenderable?l.c.PIXELFORMAT_RGB16F:this.textureFloatRenderable?l.c.PIXELFORMAT_RGB32F:l.c.PIXELFORMAT_R8_G8_B8_A8}getBoneLimit(){return this.boneLimit}setBoneLimit(e){this.boneLimit=e}resizeCanvas(e,t){this._width=e,this._height=t;const s=Math.min(this._maxPixelRatio,window.devicePixelRatio);e*=s,t*=s,this.canvas.width=e,this.canvas.height=t,this.events.fire(ye,e,t,this._width,this._height)}setResolution(e,t){this._width=e,this._height=t,this.canvas.width=e,this.canvas.height=t,this.events.fire(ye,e,t,this._width,this._height)}getUniformsInUse(e){let t=0;for(let s=0;s<e.length;s++){const i=e[s],n=l.c.UNIFORMS_USAGE_MAP[i.scopeId.name];void 0!==n&&(t|=n)}return t}applyStencilState(e,t,s){e||t||!s?(e||t)&&(this.setStencilTest(!0),e===t?(this.setStencilFunc(e.func,e.ref,e.readMask),this.setStencilOperation(e.fail,e.zfail,e.zpass,e.writeMask)):(e?(this.setStencilFuncFront(e.func,e.ref,e.readMask),this.setStencilOperationFront(e.fail,e.zfail,e.zpass,e.writeMask)):(this.setStencilFuncFront(l.c.FUNC_ALWAYS,0,255),this.setStencilOperationFront(l.c.STENCILOP_KEEP,l.c.STENCILOP_KEEP,l.c.STENCILOP_KEEP,255)),t?(this.setStencilFuncBack(t.func,t.ref,t.readMask),this.setStencilOperationBack(t.fail,t.zfail,t.zpass,t.writeMask)):(this.setStencilFuncBack(l.c.FUNC_ALWAYS,0,255),this.setStencilOperationBack(l.c.STENCILOP_KEEP,l.c.STENCILOP_KEEP,l.c.STENCILOP_KEEP,255)))):this.setStencilTest(!1)}clearShaderCache(){const e=this.gl;let t;for(t in this.fragmentShaderCache)this.fragmentShaderCache.hasOwnProperty(t)&&(e.deleteShader(this.fragmentShaderCache[t]),delete this.fragmentShaderCache[t]);for(t in this.vertexShaderCache)this.vertexShaderCache.hasOwnProperty(t)&&(e.deleteShader(this.vertexShaderCache[t]),delete this.vertexShaderCache[t]);this.programLib.clearCache()}removeShaderFromCache(e){this.programLib.removeFromCache(e)}destroy(){this.grabPassTexture.destroy(),this.clearShaderCache(),this.canvas.removeEventListener("webglcontextlost",this._contextLostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this._contextRestoredHandler,!1),this._contextLostHandler=null,this._contextRestoredHandler=null,this.canvas=null,this.gl=null}beginFrame(e){this._drawCallsPerFrame=0,this.geometryStateManager.cleanup(e)}get width(){return this.gl.drawingBufferWidth||this.canvas.width}get height(){return this.gl.drawingBufferHeight||this.canvas.height}get enableAutoInstancing(){return this._enableAutoInstancing}set enableAutoInstancing(e){this._enableAutoInstancing=e&&this.extInstancing}get maxPixelRatio(){return this._maxPixelRatio}set maxPixelRatio(e){this._maxPixelRatio=e,this.resizeCanvas(this._width,this._height)}},pc.UnityShader=a.c,pc.UnityShaderPass=a.b,pc.SphericalHarmonicsL2=Re.a,pc.RenderTarget=Q.a,pc.Sprite=Ue,pc.CommandBuffer=class{constructor(){this.device=y.a.getApplication().graphicsDevice,this._name="",this.commands=[],this.renderTargetIdentifier=null,this.clearCommand=null,this.view=null,this.proj=null}clear(){this.commands.length=0,this.renderTargetIdentifier=null,this.clearCommand=null}clearRenderTarget(e,t,s){let i=0;e&&(i|=l.c.CLEARFLAG_DEPTH),t&&(i|=l.c.CLEARFLAG_COLOR),this.clearCommand={color:s.data,depth:1,flags:i}}setRenderTarget(e){this.renderTargetIdentifier=e}drawMesh(e,t=f.i.IDENTITY.clone(),s=null,i=-1,n=-1,r=null){const a=new Be(e,t,s,i,n,r);this.commands.push(a)}setViewMatrix(e){this.view=e}setProjectionMatrix(e){this.proj=e}get name(){return this._name}set name(e){this._name=e}},pc.Graphics=je,pc.UnityMaterialPropertyBlock=We,pc.RenderTargetIdentifier=class{constructor(){this._name="",this._target=null}get target(){return this._target}set target(e){this._target=e}},pc.ReflectionProbeData=class{constructor(){this.boxProjection=!1,this.cubemap=new d.a(UnityEngine.Graphics.graphicsDevice,{cubemap:!0,rgbm:!1,name:"ReflectionProbeData_Cubemap"}),this.position=new f.n,this.min=new f.n,this.max=new f.n,this.box={min:new f.n,max:new f.n,position:new f.n}}getBox(e){return this.box.min.copy(this.min),this.box.max.copy(this.max),this.box.position.copy(this.position),this.boxProjection,this.box}},pc.ScopeId=me,pc.ShaderPatches=$.a,pc.ForwardRenderer=qe.a,pc.RendererComponent=$e.a,pc.MeshRendererComponent=Je,pc.LineRendererComponent=Ze,pc.SkinnedMeshRendererComponent=et,pc.SpriteRendererComponent=it,pc.TrailRendererComponent=nt,pc.RendererComponentSystem=ht,pc.SpriteMaskComponent=ot,pc.SortUtils=Ye.a,pc.CanvasRendererComponent=ut,pc.CanvasRendererSystem=_t,pc.MeshFilterComponent=mt,pc.MeshFilterComponentSystem=pt,pc.ReflectionProbeSystem=gt,pc.ReflectionProbeComponent=ft,pc.LightComponent=Et,pc.LightComponentSystem=St,pc.UICharInfo=Ct,pc.Font=Rt,pc.TextGenerator=kt,pc.UIUtils=lt,pc.VideoTexture=zt,pc.VideoPlayerComponent=Vt,pc.VideoPlayerSystem=Gt,pc.ElementComponent=rs,pc.ElementComponentSystem=as,pc.CameraComponent=cs,pc.CameraComponentSystem=ds,pc.ScreenComponent=_s,pc.ScreenComponentSystem=ps,pc.SortingGroupComponent=ys,pc.SortingGroupComponentSystem=Es,pc.SortingGroupRenderInstance=fs,pc.UILineInfo=wt,pc.SkyboxLoader=K,pc.SkyboxComponent=Ss,pc.SkyboxComponentSystem=As},(e,t,s)=>{"use strict";s.d(t,{a:()=>n});var i=s(2);class n{constructor(e,t,s,n=i.c.BUFFER_STATIC,r=null){this.usage=n,this.format=t,this.numVertices=s,this.numBytes=t.size*s,e._vram.vb+=this.numBytes,this.device=e,this.bufferId=null,this._storage=null,this.batchId=0,r?this.setData(r):this.storage=new ArrayBuffer(this.numBytes),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"VertexBuffer")}destroy(){this.bufferId&&(this.device._vram.vb-=this.numBytes),this.invalidateBuffer()}getFormat(){return this.format}getUsage(){return this.usage}getNumVertices(){return this.numVertices}lock(){return this.storage}unlock(){this.unlockSlice(0,this.numBytes)}unlockSlice(e,t){const s=this.device.gl;let n;switch(this.usage){case i.c.BUFFER_STATIC:n=s.STATIC_DRAW;break;case i.c.BUFFER_DYNAMIC:n=s.DYNAMIC_DRAW;break;case i.c.BUFFER_STREAM:n=s.STREAM_DRAW;break;case i.c.BUFFER_GPUDYNAMIC:n=this.device.webgl2?s.DYNAMIC_COPY:s.STATIC_DRAW}const r=!this.bufferId,a=0===e&&t===this.numBytes;if(r&&(this.bufferId=s.createBuffer()),r||a)s.bindBuffer(s.ARRAY_BUFFER,this.bufferId),s.bufferData(s.ARRAY_BUFFER,this.storage,n);else{const i=new Uint8Array(this.storage,e,t);s.bindBuffer(s.ARRAY_BUFFER,this.bufferId),s.bufferSubData(s.ARRAY_BUFFER,e,i)}this.batchId=0}setData(e){return e.byteLength!==this.numBytes?(this.storage=null,UnityEngine.Debug.LogError$1("VertexBuffer: wrong initial data size: expected "+this.numBytes+", got "+e.byteLength),!1):(this.storage=e,this.unlock(),this.numVertices=e.byteLength/this.format.size,!0)}resize(e){const t=e*this.format.size;if(t!==this.numBytes){this.device._vram.vb+=t-this.numBytes,this.numBytes=t,this.numVertices=e;const s=this.storage;this.storage=new ArrayBuffer(this.numBytes),new Uint8Array(this.storage).set(new Uint8Array(s).subarray(0,this.numBytes)),this.invalidateBuffer()}}invalidateBuffer(){const e=this.device;if(this.bufferId){const t=e.gl;t.deleteBuffer(this.bufferId),this.bufferId=null,e.geometryStateManager.globalState.vertexBuffer=null,e.vertexBuffers.length=0,e.vbOffsets.length=0,e.attributesInvalidated=!0;const s=e.geometryStateManager.globalState.attributes;for(let e=0;e<s.length;e++){const i=s[e];i.enabled&&(t.disableVertexAttribArray(e),i.enabled=!1)}}}get storage(){return this._storage}set storage(e){this._storage=e}get storageFloat32(){return new Float32Array(this._storage)}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>a});var i=s(2),n=s(0);const r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];r[i.c.PIXELFORMAT_A8]=1,r[i.c.PIXELFORMAT_L8]=1,r[i.c.PIXELFORMAT_L8_A8]=1,r[i.c.PIXELFORMAT_R5_G6_B5]=2,r[i.c.PIXELFORMAT_R5_G5_B5_A1]=2,r[i.c.PIXELFORMAT_R4_G4_B4_A4]=2,r[i.c.PIXELFORMAT_R8_G8_B8]=4,r[i.c.PIXELFORMAT_R8_G8_B8_A8]=4,r[i.c.PIXELFORMAT_RGB16F]=8,r[i.c.PIXELFORMAT_RGBA16F]=8,r[i.c.PIXELFORMAT_RGB32F]=16,r[i.c.PIXELFORMAT_RGBA32F]=16,r[i.c.PIXELFORMAT_R32F]=4,r[i.c.PIXELFORMAT_DEPTH]=4,r[i.c.PIXELFORMAT_DEPTHSTENCIL]=4,r[i.c.PIXELFORMAT_111110F]=4,r[i.c.PIXELFORMAT_SRGB]=4,r[i.c.PIXELFORMAT_SRGBA]=4;class a{constructor(e,t){this.device=e,this.$id=0,this.name=null,this._width=4,this._height=4,this._depth=1,this._pot=!0,this._format=i.c.PIXELFORMAT_R8_G8_B8_A8,this.rgbm=!1,this.intensity=1,this._cubemap=!1,this._volume=!1,this.fixCubemapSeams=!1,this._flipY=!0,this._premultiplyAlpha=!1,this._mipmaps=!0,this._minFilter=i.c.FILTER_LINEAR_MIPMAP_NEAREST,this._magFilter=i.c.FILTER_LINEAR,this._anisotropy=1,this._addressU=i.c.ADDRESS_CLAMP_TO_EDGE,this._addressV=i.c.ADDRESS_CLAMP_TO_EDGE,this._addressW=i.c.ADDRESS_CLAMP_TO_EDGE,this._glTexture=null,this._glTarget=0,this._glInternalFormat=0,this._glFormat=0,this._glPixelType=0,this._compareOnRead=!1,this._compareFunc=i.c.FUNC_LESS,this._levels=null,this._atlas=null,this._rects=null,this._buffer=null,this._levelsUpdated=null,this._needsUpload=!1,this._needsMipmapsUpload=!1,this._mipmapsUploaded=!1,this._parameterFlags=0,void 0!==t&&(this.name=t.name||null,this._width=void 0!==t.width?t.width:this._width,this._height=void 0!==t.height?t.height:this._height,this._pot=(0,n.r)(this._width)&&(0,n.r)(this._height),this._format=void 0!==t.format?t.format:this._format,this.rgbm=void 0!==t.rgbm?t.rgbm:this.rgbm,void 0!==t.mipmaps?this._mipmaps=t.mipmaps:this._mipmaps=void 0!==t.autoMipmap?t.autoMipmap:this._mipmaps,this._levels=t.levels||null,this._atlas=t.atlas||null,this._rects=t.rects||null,this._cubemap=void 0!==t.cubemap?t.cubemap:this._cubemap,this.fixCubemapSeams=void 0!==t.fixCubemapSeams?t.fixCubemapSeams:this.fixCubemapSeams,this._minFilter=void 0!==t.minFilter?t.minFilter:this._minFilter,this._magFilter=void 0!==t.magFilter?t.magFilter:this._magFilter,this._anisotropy=void 0!==t.anisotropy?t.anisotropy:this._anisotropy,this._addressU=void 0!==t.addressU?t.addressU:this._addressU,this._addressV=void 0!==t.addressV?t.addressV:this._addressV,this._compareOnRead=void 0!==t.compareOnRead?t.compareOnRead:this._compareOnRead,this._flipY=void 0!==t.flipY?t.flipY:this._flipY,this._premultiplyAlpha=void 0!==t.premultiplyAlpha?t.premultiplyAlpha:this._premultiplyAlpha,e.webgl2&&(this._depth=void 0!==t.depth?t.depth:this._depth,this._volume=void 0!==t.volume?t.volume:this._volume)),this._compressed=this._format===i.c.PIXELFORMAT_DXT1||this._format===i.c.PIXELFORMAT_DXT3||this._format===i.c.PIXELFORMAT_DXT5||this._format>=i.c.PIXELFORMAT_ETC1,this._invalid=!1,this._lockedLevel=-1,this._levels||(this._cubemap?this._levels=[[null,null,null,null,null,null]]:this._levels=[null]),this.dirtyAll(),this._gpuSize=0,this._needsUpdate=!1,this["__UnityEngine.Texture"]=null,this["__UnityEngine.Texture2D"]=null,this["__UnityEngine.Cubemap"]=null,this["__UnityEngine.RenderTexture"]=null,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,this instanceof pc.VideoTexture?"VideoTexture":"Texture"),a.allTextures.push(this)}destroy(){this.device&&this.device.destroyTexture(this),this.device=null,this._levels=null;const e=a.allTextures.indexOf(this);-1!==e&&a.allTextures.splice(e,1)}dirtyAll(){this._levelsUpdated=this._cubemap?[[!0,!0,!0,!0,!0,!0]]:[!0],this._needsUpload=!0,this._needsMipmapsUpload=this._mipmaps,this._mipmapsUploaded=!1,this._parameterFlags=255}lock(e={level:0,face:0,mode:i.c.TEXTURELOCK_WRITE}){if(void 0===e.level&&(e.level=0),void 0===e.face&&(e.face=0),void 0===e.mode&&(e.mode=i.c.TEXTURELOCK_WRITE),this._lockedLevel=e.level,null===this._levels[e.level])switch(this._format){case i.c.PIXELFORMAT_A8:case i.c.PIXELFORMAT_L8:this._levels[e.level]=new Uint8Array(this._width*this._height*this._depth);break;case i.c.PIXELFORMAT_L8_A8:this._levels[e.level]=new Uint8Array(this._width*this._height*this._depth*2);break;case i.c.PIXELFORMAT_R5_G6_B5:case i.c.PIXELFORMAT_R5_G5_B5_A1:case i.c.PIXELFORMAT_R4_G4_B4_A4:this._levels[e.level]=new Uint16Array(this._width*this._height*this._depth);break;case i.c.PIXELFORMAT_R8_G8_B8:this._levels[e.level]=new Uint8Array(this._width*this._height*this._depth*3);break;case i.c.PIXELFORMAT_R8_G8_B8_A8:this._levels[e.level]=new Uint8Array(this._width*this._height*this._depth*4);break;case i.c.PIXELFORMAT_DXT1:this._levels[e.level]=new Uint8Array(Math.floor((this._width+3)/4)*Math.floor((this._height+3)/4)*8*this._depth);break;case i.c.PIXELFORMAT_DXT3:case i.c.PIXELFORMAT_DXT5:this._levels[e.level]=new Uint8Array(Math.floor((this._width+3)/4)*Math.floor((this._height+3)/4)*16*this._depth);break;case i.c.PIXELFORMAT_RGB16F:this._levels[e.level]=new Uint16Array(this._width*this._height*this._depth*3);break;case i.c.PIXELFORMAT_RGB32F:this._levels[e.level]=new Float32Array(this._width*this._height*this._depth*3);break;case i.c.PIXELFORMAT_RGBA16F:this._levels[e.level]=new Uint16Array(this._width*this._height*this._depth*4);break;case i.c.PIXELFORMAT_RGBA32F:this._levels[e.level]=new Float32Array(this._width*this._height*this._depth*4)}return this._levels[e.level]}setSource(e){let t=!1,s=0,i=0;if(this._cubemap){if(Array.isArray(e)){s=e[0].width||0,i=e[0].height||0;for(let n=0;n<6;n++)if(!(e[n]&&e[n].width===s&&e[n].height===i&&(e[n]instanceof HTMLImageElement||e[n]instanceof HTMLCanvasElement||e[n]instanceof HTMLVideoElement))){t=!0;break}}else t=!0;if(!t)for(let t=0;t<6;t++)this._levels[0][t]!==e[t]&&(this._levelsUpdated[0][t]=!0)}else e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||(t=!0),t||(e!==this._levels[0]&&(this._levelsUpdated[0]=!0),s=e.width,i=e.height);if(t)if(this._width=4,this._height=4,this._pot=!0,this._cubemap)for(let e=0;e<6;e++)this._levels[0][e]=null,this._levelsUpdated[0][e]=!0;else this._levels[0]=null,this._levelsUpdated[0]=!0;else this._width=s,this._height=i,this._pot=(0,n.r)(this._width)&&(0,n.r)(this._height),this._levels[0]=e;this._invalid===t&&t||(this._invalid=t,this.upload())}unlock(){DEBUG&&-1===this._lockedLevel&&UnityEngine.Debug.Log$1("pc.Texture#unlock: Attempting to unlock a texture that is not locked."),this.upload(),this._lockedLevel=-1}upload(){this._needsUpload=!0,this._needsMipmapsUpload=this._mipmaps}apply(){this.upload(),this.device.setTexture(this,0),this.device.uploadTexture(this)}clone(){const e={name:this.name,width:this._width,height:this._height,addressU:this._addressU,addressV:this._addressV,mipmaps:this._mipmaps,minFilter:this._minFilter,magFilter:this._magFilter,autoMipmap:this._mipmaps,rgbm:this.rgbm,anisotropy:this._anisotropy,format:this._format},t=new a(this.device,e);return t.setSource(this._levels[0]),t}createBuffer(e,t,s){switch(e){case i.c.PIXELFORMAT_R8_G8_B8:return new Uint8Array(3*t*s);case i.c.PIXELFORMAT_R8_G8_B8_A8:return new Uint8Array(4*t*s);default:return null}}readPixels(e,t,s,i){const n=this.device.gl;this.device.setTexture(this,0),n.readPixels(e.x,e.y,e.width,e.height,this._glFormat,this._glPixelType,this.buffer),this._levels[0]=this.buffer}toBuffer(){const e=this.device.gl;this._glTexture||(this.device.setTexture(this,0),this.device.uploadTexture(this));const t=this._glTexture,s=this.width,i=this.height;(this._needsUpload||this._needsMipmapsUpload)&&this.device.uploadTexture(this);const n=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,n),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0);const r=new Uint8Array(s*i*4);return e.readPixels(0,0,s,i,e.RGBA,e.UNSIGNED_BYTE,r),e.deleteFramebuffer(n),r}sync(e){const t=this.device.gl,s=this._glTexture,i=this.width/(1<<e),n=this.height/(1<<e),r=this.device.activeFramebuffer,a=t.createFramebuffer();if(this.device.setFramebuffer(a),this._cubemap){this._levels=this._levels||[],this._levels[e]=this._levels[e]||[];for(let r=0;r<6;r++)t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+r,s,e),this._levels[e][r]=new Uint8Array(i*n*4),t.readPixels(0,0,i,n,t.RGBA,t.UNSIGNED_BYTE,this._levels[e][r])}else t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,e),this._levels=this._levels||[],this._levels[e]=new Uint8Array(i*n*4),t.readPixels(0,0,i,n,t.RGBA,t.UNSIGNED_BYTE,this._levels[e]);this.device.setFramebuffer(r)}markUploaded(){this._needsUpdate||(this._needsUpload=!1)}handlePositionInRepeatMode(e,t){return e>t-1||e<0?Math.abs(e%t):e}handlePositionInClampMode(e,t){return e<0?0:e>t-1?t-1:e}getPixel(e,t){this.bufferCheck();let s=e,r=t;this._addressU===i.c.ADDRESS_REPEAT&&this._addressV===i.c.ADDRESS_REPEAT?(s=this.handlePositionInRepeatMode(e,this.width),r=this.handlePositionInRepeatMode(t,this.height)):this._addressU===i.c.ADDRESS_CLAMP_TO_EDGE&&this._addressV===i.c.ADDRESS_CLAMP_TO_EDGE&&(s=this.handlePositionInClampMode(e,this.width),r=this.handlePositionInClampMode(t,this.height));const a=r*this.width*4+4*s,o=this._buffer[a],h=this._buffer[a+1],l=this._buffer[a+2],c=this._buffer[a+3];return new n.d(o/255,h/255,l/255,c/255)}getPixels(e,t,s,i,r){this.bufferCheck();const a=[];let o=0;for(let r=t;r<t+i;r++)for(let t=e;t<e+s;t++){const e=r*this.width*4+4*t,s=this._buffer[e],i=this._buffer[e+1],h=this._buffer[e+2],l=this._buffer[e+3];a[o++]=new n.d(s/255,i/255,h/255,l/255)}return a}getPixels32(e){this.bufferCheck(e);const t=this.width,s=this.height,i=[];let r=0;for(let e=0;e<0+s;e++)for(let s=0;s<0+t;s++){const t=e*this.width*4+4*s,a=this._buffer[t],o=this._buffer[t+1],h=this._buffer[t+2],l=this._buffer[t+3];i[r++]=new n.d(a,o,h,l)}return i}setPixel(e,t,s){this.bufferCheck();let n=e,r=t;this._addressU===i.c.ADDRESS_REPEAT&&this._addressV===i.c.ADDRESS_REPEAT?(n=this.handlePositionInRepeatMode(e,this.width),r=this.handlePositionInRepeatMode(t,this.height)):this._addressU===i.c.ADDRESS_CLAMP_TO_EDGE&&this._addressV===i.c.ADDRESS_CLAMP_TO_EDGE&&(n=this.handlePositionInClampMode(e,this.width),r=this.handlePositionInClampMode(t,this.height));const a=r*this.width*4+4*n;this.fillBuffer(a,s),this._levels[0]=this._buffer,this._needsUpload=!0}setPixels(e,t,s,i,n,r){this.bufferCheck(r);let a=0;for(let r=s;r<s+n;r++)for(let s=t;s<t+i;s++,a++){const t=r*this.width*4+4*s;this.fillBuffer(t,e[a])}this._levels[0]=this._buffer,this._needsUpload=!0}setPixels32(e,t,s,i,n,r){if(this.bufferCheck(r),e||t||s||i){let r=0;for(let a=t;a<t+i;a++)for(let t=e;t<e+s;t++,r++){const e=a*this.width*4+4*t;this.fillBuffer32(e,n[r])}}else for(let e=0;e<n.length;e++){const t=4*e;this.fillBuffer32(t,n[e])}this._levels[0]=this._buffer,this._needsUpload=!0}bufferCheck(e=-1){null===this._buffer&&(this._buffer=this.toBuffer())}fillBuffer(e,t){this._buffer[e]=255*t.r,this._buffer[e+1]=255*t.g,this._buffer[e+2]=255*t.b,this._buffer[e+3]=255*t.a}fillBuffer32(e,t){this._buffer[e]=t.r,this._buffer[e+1]=t.g,this._buffer[e+2]=t.b,this._buffer[e+3]=t.a}setPixelData(e){this.device.setTexture(this,0),this._levels=[e],this.device.uploadTexture(this)}copyCubemap(e){e._glTexture||this.device.uploadTexture(e),this._glTexture=e._glTexture,this._glTarget=e._glTarget,this._glInternalFormat=e._glInternalFormat,this._glFormat=e._glFormat,this._glPixelType=e._glPixelType,this._parameterFlags=e._parameterFlags,this.rgbm=e.rgbm,this._width=e._width,this._height=e._height,this._needsUpload=!1,this._needsMipmapsUpload=!1}toDataURI(e=!1){const t=this.width,s=this.height,i=this.toBuffer(),n=document.createElement("canvas");n.width=t,n.height=s;const r=n.getContext("2d",{alpha:!0}),a=r.createImageData(t,s);a.data.set(i),r.putImageData(a,0,0),r.scale(1,-1),r.translate(0,-a.height),r.drawImage(r.canvas,0,0);const o=n.toDataURL();if(e)return o;const h=window.open("",this.name,`width=${this.width},height=${this.height}`),l=new Image;return l.src=o,l.width=this.width,l.height=this.height,h.document.write(l.outerHTML),h.document.body.style.margin="0","Texture is shown in a new tab"}get minFilter(){return this._minFilter}set minFilter(e){this._minFilter!==e&&(this._minFilter=e,this._parameterFlags|=1)}get magFilter(){return this._magFilter}set magFilter(e){this._magFilter!==e&&(this._magFilter=e,this._parameterFlags|=2)}get addressU(){return this._addressU}set addressU(e){this._addressU!==e&&(this._addressU=e,this._parameterFlags|=4)}get addressV(){return this._addressV}set addressV(e){this._addressV!==e&&(this._addressV=e,this._parameterFlags|=8)}get addressW(){return this._addressW}set addressW(e){this.device.webgl2&&(this._volume?e!==this._addressW&&(this._addressW=e,this._parameterFlags|=16):UnityEngine.Debug.LogWarning$1("pc.Texture#addressW: Can't set W addressing mode for a non-3D texture."))}get compareOnRead(){return this._compareOnRead}set compareOnRead(e){this._compareOnRead!==e&&(this._compareOnRead=e,this._parameterFlags|=32)}get compareFunc(){return this._compareFunc}set compareFunc(e){this._compareFunc!==e&&(this._compareFunc=e,this._parameterFlags|=64)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy!==e&&(this._anisotropy=e,this._parameterFlags|=128)}get autoMipmap(){return this._mipmaps}set autoMipmap(e){this._mipmaps=e}get mipmaps(){return this._mipmaps}set mipmaps(e){this._mipmaps!==e&&(this._mipmaps=e,this._minFilterDirty=!0,e&&(this._needsMipmapsUpload=!0))}get width(){return this._width}set width(e){this._width=e}get height(){return this._height}set height(e){this._height=e}get depth(){return this._depth}set depth(e){this._depth=e}get format(){return this._format}get cubemap(){return this._cubemap}get gpuSize(){let e=1;!this._pot||!this._mipmaps&&this._minFilter!==i.c.FILTER_NEAREST_MIPMAP_NEAREST&&this._minFilter!==i.c.FILTER_NEAREST_MIPMAP_LINEAR&&this._minFilter!==i.c.FILTER_LINEAR_MIPMAP_NEAREST&&this._minFilter!==i.c.FILTER_LINEAR_MIPMAP_LINEAR||this._compressed&&1===this._levels.length||(e=Math.round(Math.log2(Math.max(this._width,this._height))+1));let t=this._width,s=this._height,n=this._depth,a=0;for(let o=0;o<e;o++){if(this._compressed)if(this._format===i.c.PIXELFORMAT_ETC1)a+=Math.floor((t+3)/4)*Math.floor((s+3)/4)*8*n;else if(this._format===i.c.PIXELFORMAT_PVRTC_2BPP_RGB_1||this._format===i.c.PIXELFORMAT_PVRTC_2BPP_RGBA_1)a+=Math.max(t,16)*Math.max(s,8)/(4*n);else if(this._format===i.c.PIXELFORMAT_PVRTC_4BPP_RGB_1||this._format===i.c.PIXELFORMAT_PVRTC_4BPP_RGBA_1)a+=Math.max(t,8)*Math.max(s,8)/(2*n);else{const e=4,r=4,o=this._format===i.c.PIXELFORMAT_DXT1?8:16;a+=Math.floor((t+e-1)/e)*Math.floor((s+r-1)/r)*o*n}else a+=t*s*n*r[this._format];t=Math.max(.5*t,1),s=Math.max(.5*s,1),n=Math.max(.5*n,1)}return this._cubemap&&(a*=6),a}get volume(){return this._volume}get flipY(){return this._flipY}set flipY(e){this._flipY!==e&&(this._flipY=e,this._needsUpload=!0)}get premultiplyAlpha(){return this._premultiplyAlpha}set premultiplyAlpha(e){this._premultiplyAlpha!==e&&(this._premultiplyAlpha=e,this._needsUpload=!0)}get formatMultiplier(){switch(this.format){case i.c.PIXELFORMAT_A8:case i.c.PIXELFORMAT_L8:return 1;case i.c.PIXELFORMAT_L8_A8:return 2;case i.c.PIXELFORMAT_R8_G8_B8:return 3;case i.c.PIXELFORMAT_R8_G8_B8_A8:default:return 4}}get buffer(){return this._buffer||(this._buffer=new Uint8Array(this.width*this.height*this.formatMultiplier)),this._buffer}set buffer(e){this._buffer=e}}a.allTextures=[]},(e,t,s)=>{"use strict";s.d(t,{a:()=>S,b:()=>T});var i=s(0),n=s(2),r=s(60),a=s(9),o=s(6),h=s(10);const l=[null,null,i.l,i.m,i.n],c=new Float32Array([1,1,1,1]),d=new Float32Array([0,0,0,0]),u=new Float32Array([0,0,0,1]),_=new Float32Array([1,0,0,1]),m=new Float32Array([0,0,1,1]),p=new i.b,g=new i.i,f=[!0,!1,!1,!1,!1,!1,!1,!1,!1,!1],y=[{semantic:n.c.SEMANTIC_POSITION,components:3,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_NORMAL,components:3,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_TANGENT,components:4,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_BLENDWEIGHT,components:4,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_BLENDINDICES,components:4,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_COLOR,components:4,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_TEXCOORD0,components:2,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_TEXCOORD1,components:2,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_TEXCOORD2,components:2,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_TEXCOORD3,components:2,type:n.c.TYPE_FLOAT32}],E=[{semantic:n.c.SEMANTIC_POSITION,components:3,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_NORMAL,components:3,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_TANGENT,components:4,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_COLOR,components:4,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_TEXCOORD0,components:2,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_TEXCOORD1,components:2,type:n.c.TYPE_FLOAT32}];class T{constructor(e=!1){this.name="",this._refCount=0,this.id=T.id++,this.$id=0,this.vertexBuffer=e?null:this.defaultVertexBuffer(f,0,new ArrayBuffer(0)),this.indexBuffer=[null],this.primitive=[{type:0,base:0,count:0,indexed:!0}],this.skin=null,this.morph=null,this.meshInstance=null,this._aabb=new i.b,this.bindposes=[],this.subMeshes=[],this.parentMeshId=-1,this.boneAabb=null,this.boneUsed=[],this.version=0,this.bufferUsage=n.c.BUFFER_STATIC,this.vao=null,this["__UnityEngine.Mesh"]=null,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"Mesh")}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBuffer=null);for(let e=0;e<this.indexBuffer.length;e++)this.indexBuffer[e]&&this.indexBuffer[e].destroy(),this.indexBuffer=[]}defaultVertexBuffer(e,t,s){const i=[];for(let t=0;t<e.length;t++)e[t]&&i.push(y[t]);return this.defaultVertexBufferWithFormatElements(i,t,s)}defaultVertexBufferWithFormatElements(e,t,s){const i=new a.a(UnityEngine.Graphics.graphicsDevice,e);return new o.a(UnityEngine.Graphics.graphicsDevice,i,t,this.bufferUsage||n.c.BUFFER_STATIC,s)}getDescriptionForSemantics(e,t=null){if(t)return{semantic:e,components:t,type:n.c.TYPE_FLOAT32};for(let t=0;t<y.length;t++)if(y[t].semantic===e)return y[t];throw new Error("Unknown or unsupported semantic requested: "+e)}defaultIndexBuffer(e,t){return new h.a(UnityEngine.Graphics.graphicsDevice,n.c.INDEXFORMAT_UINT16,e,this.bufferUsage||n.c.BUFFER_STATIC,t)}markDynamic(){this.vertexBuffer&&(this.vertexBuffer.lock(),this.vertexBuffer.usage=n.c.BUFFER_DYNAMIC,this.vertexBuffer.unlock()),this.indexBuffer[0]&&(this.indexBuffer[0].lock(),this.indexBuffer[0].usage=n.c.BUFFER_DYNAMIC,this.indexBuffer[0].unlock()),this.bufferUsage=n.c.BUFFER_DYNAMIC}uploadMeshData(){this.vertexBuffer&&this.vertexBuffer.unlock();for(let e=0;e<this.subMeshes.length;e++){const t=this.subMeshes[e];t.vertexBuffer=this.vertexBuffer,t.indexBuffer[0]&&t.indexBuffer[0].unlock()}}clear(){this.vertexBuffer&&this.vertexBuffer.resize(0),this.indexBuffer[0]&&this.indexBuffer[0].resize(0),this.version++}setIndicies(e,t,s,i,r){this.subMeshes.length<=s&&this.setSubMeshCount(s+1);const a=this.subMeshes[s];let o=0;switch(t){case UnityEngine.MeshTopology.Triangles:o=n.c.PRIMITIVE_TRIANGLES;break;case UnityEngine.MeshTopology.Lines:o=n.c.PRIMITIVE_LINES;break;case UnityEngine.MeshTopology.LineStrip:o=n.c.PRIMITIVE_LINESTRIP;break;case UnityEngine.MeshTopology.Points:o=n.c.PRIMITIVE_POINTS}if(null===o)throw new Error('Unknown or unsupported topology "'+t+'" passed!');a.primitive[0].type=o,a.primitive[0].base=r,a.primitive[0].count=e.length,a.primitive[0].indexed=!0,a.vertexBuffer=this.vertexBuffer,a.indexBuffer[0]=a.indexBuffer[0]||new h.a(UnityEngine.Graphics.graphicsDevice,n.c.INDEXFORMAT_UINT16,0,n.c.BUFFER_STATIC),a.indexBuffer[0].resize(e.length),new Uint16Array(a.indexBuffer[0].lock()).set(e),!1!==i&&this.recalculateBounds(),this.uploadMeshData(),this.version++}getIndicies(e){const t=this.subMeshes[e];return new Uint16Array(t.indexBuffer[0].lock())}getUVInTriangle(e,t){const s=this.vertexBuffer,r=new i.l;let a=3*e;if(!s)return r;const o=s.format.getStructureFor(n.c.SEMANTIC_TEXCOORD0);let h=0,l=new Uint16Array(this.subMeshes[h].indexBuffer[0].storage);for(;a>=l.length;)a-=l.length,h++,l=new Uint16Array(this.subMeshes[h].indexBuffer[0].storage);if(o.offset<0)return r;const c=(l[a+t]*o.stride+o.offset)/4,d=new Float32Array(s.storage);return r.set(d[c+0],d[c+1]),r}getVectorStream(e,t,s){const i=this.vertexBuffer;if(!i)return;const n=i.format.getStructureFor(t);if(n.offset<0)return;const r=new Float32Array(i.storage),a=new Array(i.numVertices);let o=0;for(let e=n.offset/4;e<r.length;e+=n.stride/4){const t=new l[s];t.x=r[e+0],t.y=r[e+1],s>2&&(t.z=r[e+2]),s>3&&(t.w=r[e+3]),a[o++]=t}e._items=a,e._size=a.length}setVectorStream(e,t,s){if(!e||0===e._size)return void this.disableSemantic(t);this.enableSemantic(t);const i=this.vertexBuffer;i.resize(Math.max(e._size,i.numVertices));const n=i.format.getStructureFor(t),r=new Float32Array(i.storage);let a=0;const o=e._size*n.stride/4;switch(s){case 2:for(let t=n.offset/4;t<o;t+=n.stride/4){const s=e._items[a++];r[t+0]=s.x,r[t+1]=s.y}break;case 3:for(let t=n.offset/4;t<o;t+=n.stride/4){const s=e._items[a++];r[t+0]=s.x,r[t+1]=s.y,r[t+2]=s.z}break;case 4:for(let t=n.offset/4;t<o;t+=n.stride/4){const s=e._items[a++];r[t+0]=s.x,r[t+1]=s.y,r[t+2]=s.z,r[t+3]=s.w}}this.meshInstance&&this.meshInstance._aabbVer++,this.uploadMeshData(),this.version++}getColorStream(e,t,s){const n=this.vertexBuffer;if(!n)return;const r=n.format.getStructureFor(t);if(r.offset<0)return;const a=new Float32Array(n.storage),o=new Array(n.numVertices);let h=0;for(let e=r.offset/4;e<a.length;e+=r.stride/4){const t=new i.d;t.r=a[e+0]*s,t.g=a[e+1]*s,t.b=a[e+2]*s,t.a=a[e+3]*s,o[h++]=t}e._items=o,e._size=o.length}getUIVertexStream(e,t){if(e._size=0,t._size=0,!this.vertexBuffer||!this.indexBuffer[0])return;e._size=e._items.length=this.vertexBuffer.numVertices,t._size=t._items.length=this.primitive[0].count,t._items=Array.from(new Uint16Array(this.indexBuffer[0].storage));const s=new Float32Array(this.vertexBuffer.storage),i=this.vertexBuffer.format.size/4,r=this.vertexBuffer.format.getStructureFor(n.c.SEMANTIC_POSITION,!0),a=this.vertexBuffer.format.getStructureFor(n.c.SEMANTIC_NORMAL,!0),o=this.vertexBuffer.format.getStructureFor(n.c.SEMANTIC_TANGENT,!0),h=this.vertexBuffer.format.getStructureFor(n.c.SEMANTIC_COLOR,!0),l=this.vertexBuffer.format.getStructureFor(n.c.SEMANTIC_TEXCOORD0,!0),c=this.vertexBuffer.format.getStructureFor(n.c.SEMANTIC_TEXCOORD1,!0);for(let t=0;t<s.length;t+=i){const n=new UnityEngine.UIVertex;let d=-1;e._items[t/i|0]=n,(d=r.offset)>=0&&n.position.set(s[t+d+0],s[t+d+1],s[t+d+2]),(d=a.offset)>=0&&n.normal.set(s[t+d+0],s[t+d+1],s[t+d+2]),(d=o.offset)>=0&&n.tangent.set(s[t+d+0],s[t+d+1],s[t+d+2],s[t+d+3]),(d=h.offset)>=0&&(n.color.r=255*s[t+d+0]|0,n.color.g=255*s[t+d+1]|0,n.color.b=255*s[t+d+2]|0,n.color.a=255*s[t+d+3]|0),(d=l.offset)>=0&&n.uv0.set(s[t+d+0],s[t+d+1]),(d=c.offset)>=0&&n.uv1.set(s[t+d+0],s[t+d+1])}}setUIVertexStream(e,t){if(this.vertexBuffer){const e=E,t=this.vertexBuffer.format;if(t.elements.length!==e.length)this.vertexBuffer.destroy(),this.vertexBuffer=null;else for(let s=0;s<e.length;s++)if(t.elements[s].name!==e[s].semantic){this.vertexBuffer.destroy(),this.vertexBuffer=null;break}}if(!this.vertexBuffer){const t=new a.a(UnityEngine.Graphics.graphicsDevice,E);this.vertexBuffer=new o.a(UnityEngine.Graphics.graphicsDevice,t,e._size,this.bufferUsage||n.c.BUFFER_STATIC,null)}t._items.length=t._size,this.setIndicies(t._items,UnityEngine.MeshTopology.Triangles,0,!0,0),this.vertexBuffer.resize(e._size);const s=new Float32Array(this.vertexBuffer.storage);for(let t=0;t<s.length;t+=18){const i=e._items[t/18];s[t+0]=i.position.x,s[t+1]=i.position.y,s[t+2]=i.position.z,s[t+3]=i.normal.x,s[t+4]=i.normal.y,s[t+5]=i.normal.z,s[t+6]=i.tangent.x,s[t+7]=i.tangent.y,s[t+8]=i.tangent.z,s[t+9]=i.tangent.w,s[t+10]=i.color.r/255,s[t+11]=i.color.g/255,s[t+12]=i.color.b/255,s[t+13]=i.color.a/255,s[t+14]=i.uv0.x,s[t+15]=i.uv0.y,s[t+16]=i.uv1.x,s[t+17]=i.uv1.y}this.uploadMeshData(),this.primitive[0].type=n.c.PRIMITIVE_TRIANGLES,this.primitive[0].base=0,this.primitive[0].count=t._items.length,this.primitive[0].indexed=!0}setColorStream(e,t,s){if(!e||0===e._size)return void this.disableSemantic(t);this.enableSemantic(t);const i=this.vertexBuffer;i.resize(Math.max(e._size,i.numVertices));const n=i.format.getStructureFor(t),r=new Float32Array(i.storage);let a=0;const o=e._size*n.stride/4,h=1/s;for(let t=n.offset/4;t<o;t+=n.stride/4){const s=e._items[a++];r[t+0]=s.r*h,r[t+1]=s.g*h,r[t+2]=s.b*h,r[t+3]=s.a*h}this.uploadMeshData(),this.version++}initializeBuffers(){this.destroy(),this.vertexBuffer=new o.a(UnityEngine.Graphics.graphicsDevice,new a.a(UnityEngine.Graphics.graphicsDevice,[]),0),this.vertexBuffer.numBytes=0,this.vertexBuffer.numVertices=0,this.indexBuffer=[new h.a(UnityEngine.Graphics.graphicsDevice,n.c.INDEXFORMAT_UINT16,0,n.c.BUFFER_STATIC)]}enableSemantic(e){let t=this.vertexBuffer;t||(t=new o.a(UnityEngine.Graphics.graphicsDevice,new a.a(UnityEngine.Graphics.graphicsDevice,[]),0),t.numBytes=0,t.numVertices=0,this.vertexBuffer=t);const s=t.format;if(s.getStructureFor(e).offset>=0)return;const i=new Float32Array(t.storage),n=[];for(let e=0;e<s.elements.length;e++){const t=s.elements[e];n.push({semantic:t.name,type:t.dataType,components:t.numComponents,normalize:t.normalize})}n.push(this.getDescriptionForSemantics(e));const r=new a.a(UnityEngine.Graphics.graphicsDevice,n),h=new Float32Array(r.size/4*t.numVertices);for(let e=0;e<t.numVertices;e++)for(let t=0;t<s.size/4;t++)h[e*r.size/4+t]=i[e*s.size/4+t];t.invalidateBuffer();const l=t.numVertices*t.format.size;t.device._vram.vb+=l-t.numBytes,t.format=r,t.numBytes=l,t.storage=h.buffer}disableSemantic(e){const t=this.vertexBuffer;if(!t)return;const s=t.format;if(s.getStructureFor(e).offset<0)return;const i=new Float32Array(t.storage),n=[];for(let t=0;t<s.elements.length;t++){const i=s.elements[t];i.name!==e&&n.push({semantic:i.name,type:i.dataType,components:i.numComponents,normalize:i.normalize})}const r=new a.a(UnityEngine.Graphics.graphicsDevice,n),o=new Float32Array(r.size/4*t.numVertices);let h=0;for(let e=0;e<t.numVertices;e++)o[h++]=i[e];t.invalidateBuffer();const l=t.numVertices*t.format.size;t.device._vram.vb+=l-t.numBytes,t.format=r,t.numBytes=l,t.storage=o.buffer}recalculateBounds(){const e=new i.m,t=this.vertexBuffer.format.getStructureFor(n.c.SEMANTIC_POSITION,!0);if(t.offset<0)return void this._aabb.setMinMax(i.m.ZERO,i.m.ZERO);const s=new Float32Array(this.vertexBuffer.lock());this._aabb.setToInfinity();for(let n=0;n<this.subMeshes.length;n++){const r=new i.m(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),a=new i.m(-Number.MAX_SAFE_INTEGER,-Number.MAX_SAFE_INTEGER,-Number.MAX_SAFE_INTEGER),o=this.subMeshes[n],h=new Uint16Array(o.indexBuffer[0].storage);for(let i=0;i<h.length;i++){const n=h[i]*t.stride+t.offset;e.set(s[n+0],s[n+1],s[n+2]),r.x=r.x>e.x?e.x:r.x,r.y=r.y>e.y?e.y:r.y,r.z=r.z>e.z?e.z:r.z,a.x=a.x<e.x?e.x:a.x,a.y=a.y<e.y?e.y:a.y,a.z=a.z<e.z?e.z:a.z}h.length>0?o._aabb.setMinMax(r,a):o._aabb.setToInfinity(),h.length>0&&(this._aabb.expandToPoint(r),this._aabb.expandToPoint(a))}}getVertexArrayObject(){if(this.vao)return this.vao;const e=UnityEngine.Graphics.graphicsDevice;this.vao=e.gl.createVertexArray(),e.gl.bindVertexArray(this.vao),this.vertexBuffer.unlock(),this.indexBuffer[0].unlock();const t=this.vertexBuffer.format;for(let t=0;t<16;t++)e.gl.disableVertexAttribArray(t);e.gl.vertexAttrib4fv(n.c.ShaderAttributeSlots.POSITION,u),e.gl.vertexAttrib4fv(n.c.ShaderAttributeSlots.COLOR,c),e.gl.vertexAttrib4fv(n.c.ShaderAttributeSlots.TANGENT,_),e.gl.vertexAttrib4fv(n.c.ShaderAttributeSlots.NORMAL,m),e.gl.vertexAttrib4fv(n.c.ShaderAttributeSlots.TEXCOORD0,d);for(let s=0;s<t.elements.length;s++){const i=t.elements[s],r=n.c.ShaderAttributeSlots[i.name];e.gl.enableVertexAttribArray(r),e.gl.vertexAttribPointer(r,i.numComponents,e.glType[i.dataType],i.normalize,i.stride,i.offset)}return e.gl.bindVertexArray(null),this.vao}setSubMeshCount(e){for(let t=e;t<this.subMeshes.length;t++)this.subMeshes[t]._refCount=-1/0;this.subMeshes.length=e;for(let t=0;t<e;t++)this.subMeshes[t]||(this.subMeshes[t]=new T(!0),this.subMeshes[t].name=`SubMesh-${t}`,this.subMeshes[t].parentMeshId=this.id,this.subMeshes[t].vertexBuffer=this.vertexBuffer,this.subMeshes[t].indexBuffer=[new h.a(UnityEngine.Graphics.graphicsDevice,n.c.INDEXFORMAT_UINT16,0,n.c.BUFFER_STATIC)]);this.version++}recalculateNormals(){this.enableSemantic(n.c.SEMANTIC_NORMAL);const e=this.vertexBuffer.format.getStructureFor(n.c.SEMANTIC_POSITION,!0),t=this.vertexBuffer.format.getStructureFor(n.c.SEMANTIC_NORMAL,!0),s=new Float32Array(this.vertexBuffer.lock()),r=new i.m,a=new i.m,o=new i.m;let h=-1;for(let i=0;i<this.subMeshes.length;i++){if(this.getTopology(i)!==UnityEngine.MeshTopology.Triangles)throw new Error("Cannot recalculate normals for non-triangle mesh");const n=this.subMeshes[i],l=new Uint16Array(n.indexBuffer[0].storage);for(let i=0;i<l.length;i+=3)h=l[i+0]*e.stride+e.offset,r.set(s[h+0],s[h+1],s[h+2]),h=l[i+1]*e.stride+e.offset,a.set(s[h+0],s[h+1],s[h+2]),h=l[i+2]*e.stride+e.offset,o.set(s[h+0],s[h+1],s[h+2]),a.sub(o),r.sub(o),o.cross(r,a),h=l[i+0]*t.stride+t.offset,s[h+0]=o.x,s[h+1]=o.y,s[h+2]=o.z,h=l[i+1]*t.stride+t.offset,s[h+0]=o.x,s[h+1]=o.y,s[h+2]=o.z,h=l[i+2]*t.stride+t.offset,s[h+0]=o.x,s[h+1]=o.y,s[h+2]=o.z}this.vertexBuffer.unlock()}recalculateTangents(){const e=this.vertexBuffer.format.getStructureFor(n.c.SEMANTIC_TEXCOORD0,!0);if(e.offset<0)return;this.enableSemantic(n.c.SEMANTIC_TANGENT);const t=this.vertexBuffer.format.getStructureFor(n.c.SEMANTIC_POSITION,!0),s=this.vertexBuffer.format.getStructureFor(n.c.SEMANTIC_TANGENT,!0),r=new Float32Array(this.vertexBuffer.lock()),a=new i.m,o=new i.m,h=new i.m,l=new i.l,c=new i.l,d=new i.l,u=new i.m;let _=-1;for(let i=0;i<this.subMeshes.length;i++){if(this.getTopology(i)!==UnityEngine.MeshTopology.Triangles)throw new Error("Cannot recalculate tangents for non-triangle mesh");const n=this.subMeshes[i],m=new Uint16Array(n.indexBuffer[0].storage);for(let i=0;i<m.length;i+=3){_=m[i+0]*t.stride+t.offset,a.set(r[_+0],r[_+1],r[_+2]),_=m[i+1]*t.stride+t.offset,o.set(r[_+0],r[_+1],r[_+2]),_=m[i+2]*t.stride+t.offset,h.set(r[_+0],r[_+1],r[_+2]),_=m[i+0]*e.stride+e.offset,l.set(r[_+0],r[_+1]),_=m[i+1]*e.stride+e.offset,c.set(r[_+0],r[_+1]),_=m[i+2]*e.stride+e.offset,d.set(r[_+0],r[_+1]);const n=c.x-l.x,p=d.x-l.x,g=c.x-d.x,f=c.y-l.y,y=d.y-l.y,E=c.y-d.y,T=Math.abs(n)+Math.abs(f),S=Math.abs(p)+Math.abs(y),A=Math.abs(g)+Math.abs(E);T>S?T>A?(u.sub2(o,a),u.x*=n>0?1:-1,u.y*=f>0?1:-1):(u.sub2(h,o),u.x*=g>0?1:-1,u.y*=E>0?1:-1):S>A?(u.sub2(h,a),u.x*=p>0?1:-1,u.y*=y>0?1:-1):(u.sub2(h,o),u.x*=g>0?1:-1,u.y*=E>0?1:-1),_=m[i+0]*s.stride+s.offset,r[_+0]=u.x,r[_+1]=u.y,r[_+2]=u.z,r[_+3]=1,_=m[i+1]*s.stride+s.offset,r[_+0]=u.x,r[_+1]=u.y,r[_+2]=u.z,r[_+3]=1,_=m[i+2]*s.stride+s.offset,r[_+0]=u.x,r[_+1]=u.y,r[_+2]=u.z,r[_+3]=1}}this.vertexBuffer.unlock()}getVertexCount(){return this.vertexBuffer?this.vertexBuffer.numVertices:0}getTopology(e){const t=this.subMeshes[e];switch(t.primitive[0].type){case n.c.PRIMITIVE_TRIANGLES:return UnityEngine.MeshTopology.Triangles;case n.c.PRIMITIVE_LINES:return UnityEngine.MeshTopology.Lines;case n.c.PRIMITIVE_LINESTRIP:return UnityEngine.MeshTopology.LineStrip;case n.c.PRIMITIVE_POINTS:return UnityEngine.MeshTopology.Points}throw new Error("Mesh's topology is set to \""+t.primitive[0].type+'", which is not supported by Unity API')}configureIndexBufferAsTriangleStrip(e,t){this.primitive[e].type=n.c.PRIMITIVE_TRISTRIP,this.primitive[e].base=0,this.primitive[e].count=t,this.primitive[e].indexed=!0}configureIndexBufferAsTriangles(e,t){this.primitive[e].type=n.c.PRIMITIVE_TRIANGLES,this.primitive[e].base=0,this.primitive[e].count=t,this.primitive[e].indexed=!0}clone(){const e=new T;e.name=this.name+" Instance",e.aabb.copy(this.aabb);const t=[];for(let e=0;e<this.vertexBuffer.format.elements.length;e++){const s=this.vertexBuffer.format.elements[e];t[e]={semantic:s.name,components:s.numComponents,type:s.dataType}}const s=e.defaultVertexBufferWithFormatElements(t,this.getVertexCount(),this.vertexBuffer.storage.slice(0,this.vertexBuffer.storage.byteLength));e.vertexBuffer=s,e.subMeshes=[];for(let t=0;t<this.subMeshes.length;t++){const i=this.subMeshes[t],r=i.indexBuffer[0],a=r.storage.slice(0,r.storage.byteLength),o=new Uint16Array(a),h=new T(!0);h.aabb.copy(i.aabb);const l=e.defaultIndexBuffer(o.length,o.buffer);h.vertexBuffer=s,h.indexBuffer[0]=l,h.primitive[0].type=n.c.PRIMITIVE_TRIANGLES,h.primitive[0].base=0,h.primitive[0].count=o.length,h.primitive[0].indexed=!0,e.subMeshes.push(h)}e.indexBuffer=e.subMeshes[0].indexBuffer,e.primitive[0].type=n.c.PRIMITIVE_TRIANGLES,e.primitive[0].base=0,e.primitive[0].count=e.indexBuffer[0].numIndices,e.primitive[0].indexed=!0;for(let t=0;t<this.bindposes.length;t++)e.bindposes.push(this.bindposes[t].clone());return e}get aabb(){return this.morph?this.morph.aabb:this._aabb}set aabb(e){this.morph?(this._aabb=this.morph._baseAabb=e,this.morph._calculateAabb()):this._aabb=e,this.version++}}T.id=0;class S extends r.b{constructor(e,t,s){super(),this._key=[0,0],this.id=T.id++,this.isStatic=!1,this.node=e,this._mesh=t,t._refCount++,t.meshInstance=this,this._material=s,this._element=null,this._nearestScreen=null,this._shaderDefs=0,this._shaderDefs|=t.vertexBuffer.format.hasUv0?n.c.SHADERDEF_UV0:0,this._shaderDefs|=t.vertexBuffer.format.hasUv1?n.c.SHADERDEF_UV1:0,this._shaderDefs|=t.vertexBuffer.format.hasColor?n.c.SHADERDEF_VCOLOR:0,this._shaderDefs|=t.vertexBuffer.format.hasTangents?n.c.SHADERDEF_TANGENTS:0,this._shaderDefs|=n.c.SHADERDEF_CAST_SHADOWS,this._shaderDefs&=~n.c.SHADERDEF_NOSHADOWS,this._lightHash=0,this.visible=!0,this._flipFaces=!1,this.cull=!0,this.pick=!0,this.drawOrder=0,this.sortingLayerIndex=0,this.sortingOrder=0,this.zdist=0,this.mask=0,this.constAttributes={},this._worldAabbOverride=null,this.updateKey(),this._skinInstance=null,this._morphInstance=null,this.instancingData=null,this._aabb=new i.b,this._boneAabb=null,this._aabbVer=-1,this.drawOrder=0,this.visibleThisFrame=!1,this._lightProbe=null,this.stencilFront=null,this.stencilBack=null,this.lightmapIndex=-1,this.lightmapSceneIndex=-1,this.isCanvas=!1,this.isSortingGroup=!1,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"MeshInstance")}updateKey(){const e=this.material,t=2e7-1e3*((e?e.renderQueue:null)||2e3)+(e?e.id:0);this._key[n.c.SORTKEY_FORWARD]=function(e,t){return(e?1:0)<<26|(33554431&t)<<0}(!1,t)}configureLightmap(){const e=UnityEngine.LightmapSettings.manager.getLightmap(this.lightmapSceneIndex,this.lightmapIndex);e&&e.lightmapColor?this.setParameter("unity_Lightmap",e.lightmapColor.handle):this.setParameter("unity_Lightmap",null),(this._shaderDefs&n.c.SHADERDEF_DIRLM)>0&&(e&&e.lightmapDirection?this.setParameter("unity_LightmapInd",e.lightmapDirection.handle):this.setParameter("unity_LightmapInd",null))}hasUVChannel(e){if(!this._mesh)return!1;const t=this._mesh.vertexBuffer.format;switch(e){case n.c.SEMANTIC_TEXCOORD0:return t.hasUv0;case n.c.SEMANTIC_TEXCOORD1:return t.hasUv1;case n.c.SEMANTIC_TEXCOORD2:return t.hasUv2;case n.c.SEMANTIC_TEXCOORD3:return t.hasUv3;default:return!1}}get mesh(){return this._mesh}set mesh(e){this._mesh&&this._mesh._refCount--,this._mesh=e,e&&e._refCount++}get aabb(){if(this.worldAabbOverride)return this.worldAabbOverride;let e;if(this.skinInstance){const t=this.mesh.skin.boneNames.length+5;let s,r;if(!this.mesh.boneAabb){this.mesh.boneAabb=[],this.mesh.boneUsed=[];const a=this.mesh.vertexBuffer.format.elements,o=this.mesh.vertexBuffer.numVertices,h=this.mesh.vertexBuffer.format.size;let l,c,d,u,_,m,p;for(r=0;r<a.length;r++)a[r].name===n.c.SEMANTIC_POSITION?c=a[r].offset:a[r].name===n.c.SEMANTIC_BLENDINDICES?d=a[r].offset:a[r].name===n.c.SEMANTIC_BLENDWEIGHT&&(u=a[r].offset);const g=new Float32Array(this.mesh.vertexBuffer.storage),f=new Float32Array(this.mesh.vertexBuffer.storage),y=c/4,E=u/4,T=d/4,S=h/4;let A,b,C,w,x;const R=[],I=[];for(s=this.mesh.boneUsed,r=0;r<t;r++)R[r]=new i.m(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),I[r]=new i.m(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(_=0;_<o;_++)for(m=0;m<4;m++)f[_*S+E+m]>0&&(l=g[_*S+T+m],C=f[_*S+y],w=f[_*S+y+1],x=f[_*S+y+2],A=I[l],b=R[l],b.x>C&&(b.x=C),b.y>w&&(b.y=w),b.z>x&&(b.z=x),A.x<C&&(A.x=C),A.y<w&&(A.y=w),A.z<x&&(A.z=x),s[l]=!0);if(this.morphInstance){let e;const t=this.morphInstance.morph._targets,s=new Float32Array(3*o),i=new Float32Array(3*o);let n,r,a,h,l,c,d;for(_=0;_<o;_++)s[3*_]=i[3*_]=f[_*S+y],s[3*_+1]=i[3*_+1]=f[_*S+y+1],s[3*_+2]=i[3*_+2]=f[_*S+y+2];for(p=0;p<t.length;p++){h=t[p];for(let t=0;t<h.frames.length;t++)for(l=h.frames[t].indices,c=l.length,d=h.frames[t].deltaPositions,m=0;m<c;m++)e=l[m],n=d[3*m],r=d[3*m+1],a=d[3*m+2],n<0?s[3*e]+=n:i[3*e]+=n,r<0?s[3*e+1]+=r:i[3*e+1]+=r,a<0?s[3*e+2]+=a:i[3*e+2]+=a}}for(r=0;r<t;r++)e=new i.b,e.setMinMax(R[r],I[r]),this.mesh.boneAabb.push(e)}if(!this._boneAabb)for(this._boneAabb=[],r=0;r<this.mesh.boneAabb.length;r++)this._boneAabb[r]=new i.b;for(s=this.mesh.boneUsed,r=0;r<this.mesh.boneAabb.length;r++)s[r]&&this._boneAabb[r].setFromTransformedAabb(this.mesh.boneAabb[r],this.skinInstance.matrices[r]);const a=this.skinInstance.skin.rootBone?this.skinInstance.skin.rootBone.getWorldTransform():this.node.getWorldTransform();let o=!0;for(r=0;r<this.mesh.boneAabb.length;r++)s[r]&&(o?(p.center.copy(this._boneAabb[r].center),p.halfExtents.copy(this._boneAabb[r].halfExtents),o=!1):p.add(this._boneAabb[r]));this._aabb.setFromTransformedAabb(p,a)}else if(this.node._aabbVer!==this._aabbVer){e=this.mesh?this.mesh.aabb:this._aabb,this.mesh||e.setToInfinity();const t=this.parameters.localToWorldMatrix?g.set(this.parameters.localToWorldMatrix.data):this.node.getWorldTransform();this._aabb.setFromTransformedAabb(e,t),this._aabbVer=this.node._aabbVer}return this._aabb}set aabb(e){this._aabb=e}get worldAabbOverride(){return this._worldAabbOverride}set worldAabbOverride(e){this._worldAabbOverride=e}get material(){return this._material}set material(e){this._material=e}get skinInstance(){return this._skinInstance}set skinInstance(e){this._skinInstance=e,this._shaderDefs=e?this._shaderDefs|n.c.SHADERDEF_SKIN:this._shaderDefs&~n.c.SHADERDEF_SKIN}get morphInstance(){return this._morphInstance}set morphInstance(e){this._morphInstance=e}get key(){return this._key[n.c.SORTKEY_FORWARD]}set key(e){this._key[n.c.SORTKEY_FORWARD]=e}get renderQueue(){return this.material?this.material.renderQueue:2e3}get isIndexBufferEmpty(){return!1}get castShadows(){return 0!=(this._shaderDefs&n.c.SHADERDEF_CAST_SHADOWS)}set castShadows(e){this._shaderDefs=e?this._shaderDefs|n.c.SHADERDEF_CAST_SHADOWS:this._shaderDefs&~n.c.SHADERDEF_CAST_SHADOWS}get receiveShadows(){return 0==(this._shaderDefs&n.c.SHADERDEF_NOSHADOW)}set receiveShadows(e){this._shaderDefs=e?this._shaderDefs&~n.c.SHADERDEF_NOSHADOW:this._shaderDefs|n.c.SHADERDEF_NOSHADOW}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>r});var i=s(2);const n=[0,0,0,0,0,0,0];n[i.c.TYPE_INT8]=1,n[i.c.TYPE_UINT8]=1,n[i.c.TYPE_INT16]=2,n[i.c.TYPE_UINT16]=2,n[i.c.TYPE_INT32]=4,n[i.c.TYPE_UINT32]=4,n[i.c.TYPE_FLOAT32]=4;class r{constructor(e,t){this.elements=[],this.hasUv0=!1,this.hasUv1=!1,this.hasUv2=!1,this.hasUv3=!1,this.hasColor=!1,this.hasTangents=!1,this.elementMap={},this.channels=0,this.size=0;for(let s=0,r=t.length;s<r;s++){const r=t[s],a={name:r.semantic,offset:0,stride:0,stream:-1,scopeId:e.scope.resolve(r.semantic),dataType:r.type,numComponents:r.components,normalize:void 0!==r.normalize&&r.normalize,size:r.components*n[r.type]};this.elements.push(a),this.size+=4*Math.ceil(a.size/4),r.semantic===i.c.SEMANTIC_TEXCOORD0?this.hasUv0=!0:r.semantic===i.c.SEMANTIC_TEXCOORD1?this.hasUv1=!0:r.semantic===i.c.SEMANTIC_TEXCOORD2?this.hasUv2=!0:r.semantic===i.c.SEMANTIC_TEXCOORD3?this.hasUv3=!0:r.semantic===i.c.SEMANTIC_COLOR?this.hasColor=!0:r.semantic===i.c.SEMANTIC_TANGENT&&(this.hasTangents=!0),this.channels|=1<<i.c.ShaderAttributeSlots[r.semantic]}let s=0;for(let e=0,t=this.elements.length;e<t;e++){const t=this.elements[e];t.offset=s,t.stride=this.size,s+=t.size,this.elementMap[t.name]=t}}getStructureFor(e,t=!1){let s=-1;const i=t?4:1;for(let t=0;t<this.elements.length;t++)if(this.elements[t].name===e){s=this.elements[t].offset;break}return{offset:s/i,stride:this.size/i}}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>n});var i=s(2);class n{constructor(e,t,s,r=i.c.BUFFER_STATIC,a=null){this.usage=r,this.format=t,this.numIndices=s,this.device=e;const o=this.device.gl;switch(t){case i.c.INDEXFORMAT_UINT8:this.glFormat=o.UNSIGNED_BYTE;break;case i.c.INDEXFORMAT_UINT16:this.glFormat=o.UNSIGNED_SHORT;break;case i.c.INDEXFORMAT_UINT32:this.glFormat=o.UNSIGNED_INT}this.bytesPerIndex=n.getFormatSize(t),this.numBytes=this.numIndices*this.bytesPerIndex,this.preventDestroy=!1,this.bufferId=null,this.storage=null,a?this.setData(a):this.storage=new ArrayBuffer(this.numBytes),e._vram.ib+=this.numBytes,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"IndexBuffer")}destroy(){this.preventDestroy||(this.bufferId&&(this.device._vram.ib-=this.numBytes),this.invalidateBuffer())}getFormat(){return this.format}getNumIndices(){return this.numIndices}lock(){return this.storage}unlock(){this.unlockSlice(0,this.numBytes)}unlockSlice(e,t){const s=this.device.gl;let n;switch(this.usage){case i.c.BUFFER_STATIC:n=s.STATIC_DRAW;break;case i.c.BUFFER_DYNAMIC:n=s.DYNAMIC_DRAW;break;case i.c.BUFFER_STREAM:n=s.STREAM_DRAW;break;case i.c.BUFFER_GPUDYNAMIC:n=this.device.webgl2?s.DYNAMIC_COPY:s.STATIC_DRAW}const r=!this.bufferId,a=0===e&&t===this.numBytes;if(r&&(this.bufferId=s.createBuffer()),r||a)s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,this.bufferId),s.bufferData(s.ELEMENT_ARRAY_BUFFER,this.storage,n);else{const i=new Uint8Array(this.storage,e,t);s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,this.bufferId),s.bufferSubData(s.ELEMENT_ARRAY_BUFFER,e,i)}}setData(e){return e.byteLength!==this.numBytes?(UnityEngine.Debug.LogError$1("IndexBuffer: wrong initial data size: expected "+this.numBytes+", got "+e.byteLength),!1):(this.storage=e,this.unlock(),this.numIndices=e.byteLength/this.bytesPerIndex,!0)}resize(e){const t=e*this.bytesPerIndex;if(t!==this.numBytes){this.numBytes=t,this.numIndices=e;const s=this.storage;this.storage=new ArrayBuffer(this.numBytes),new Uint8Array(this.storage).set(new Uint8Array(s).subarray(0,this.numBytes)),this.invalidateBuffer()}}invalidateBuffer(){const e=this.device;if(this.bufferId){e.gl.deleteBuffer(this.bufferId),this.bufferId=null,e.indexBuffer===this&&(e.indexBuffer=null)}}get storageInt16(){return new Int16Array(this.storage)}get storageInt32(){return new Int32Array(this.storage)}static getFormatSize(e){switch(e){case i.c.INDEXFORMAT_UINT8:return 1;case i.c.INDEXFORMAT_UINT16:return 2;case i.c.INDEXFORMAT_UINT32:return 4}return 0}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>a,b:()=>o});const i=32,n=Math.ceil(10),r={namesToIds:{},idsToNames:{},nextId:0,getIdByName(e){if(void 0===this.namesToIds[e]){if(this.nextId>=320)return UnityEngine.Debug.LogWarning$1("320 keywords limit exceed. "+e+" was not added!"),null;this.namesToIds[e]=this.nextId,this.idsToNames[this.nextId]=e,this.nextId++}return this.namesToIds[e]}};class a{constructor(){this._version=0,this.bitfield=new Uint32Array(n),this.cardinality=0}setEnabledKeywords(e){this.clear();for(let t=0;t<e.length;t++)this.enableKeyword(e[t])}enableKeyword(e){this.enableKeywordId(r.getIdByName(e))}disableKeyword(e){void 0!==r.namesToIds[e]&&this.disableKeywordId(r.getIdByName(e))}enableKeywordId(e){if(e>=r.nextId||e<0)return;const t=Math.floor(e/i),s=1<<e%i;(this.bitfield[t]&s)===s||(this.cardinality++,this.bitfield[t]|=s),this.updateVersion()}disableKeywordId(e){if(e>=r.nextId||e<0)return;const t=Math.floor(e/i),s=1<<e%i;(this.bitfield[t]&s)===s&&(this.cardinality--,this.bitfield[t]&=~s),this.updateVersion()}isKeywordEnabled(e){return void 0!==r.namesToIds[e]&&this.isKeywordIdEnabled(r.getIdByName(e))}isKeywordIdEnabled(e){if(e>=r.nextId||e<0)return!1;const t=Math.floor(e/i),s=1<<e%i;return(this.bitfield[t]&s)===s}subset(e){let t=!0;for(let s=0;s<n;s++){const i=this.bitfield[s],n=e.bitfield[s];t=t&&(n&i)===i}return t}getEnabledKeywords(){const e=r.nextId,t=[];for(let s=0;s<e;s++){const e=r.idsToNames[s];this.isKeywordEnabled(e)&&t.push(e)}return t}getEnabledKeywordsIds(){const e=r.nextId,t=[];for(let s=0;s<e;s++)this.isKeywordIdEnabled(s)&&t.push(s);return t}merge(e){for(let t=0;t<n;t++){const s=this.bitfield[t],i=e.bitfield[t];this.bitfield[t]=s|i}this.updateCardinality(),this.updateVersion()}clear(){for(let e=0;e<n;e++)this.bitfield[e]=0;this.cardinality=0,this.updateVersion()}copy(e){for(let t=0;t<n;t++)this.bitfield[t]=e.bitfield[t];this.cardinality=e.cardinality,this.updateVersion()}updateCardinality(){this.cardinality=0;for(let e=0;e<n;e++){let t=this.bitfield[e];0!==t&&(t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),this.cardinality+=16843009*(t+(t>>4)&252645135)>>24)}}updateVersion(){this._version++}get version(){return this._version}get enabledKeywords(){return this.getEnabledKeywords().join(" ")}toString(){return this.enabledKeywords}}a.union=function(e,t,s=new a){s.clear();for(let i=0;i<n;i++)s.bitfield[i]=e.bitfield[i]|t.bitfield[i];return s.updateCardinality(),s.updateVersion(),s},a.intersection=function(e,t,s=new a){s.clear();for(let i=0;i<n;i++)s.bitfield[i]=e.bitfield[i]&t.bitfield[i];return s.updateCardinality(),s.updateVersion(),s},a.keywordsEqual=function(e,t,s=new a){return a.intersection(e,t,s),e.cardinality===s.cardinality&&e.cardinality===t.cardinality},a.differenceLeft=function(e,t,s=new a){s.clear();for(let i=0;i<n;i++)s.bitfield[i]=(e.bitfield[i]^t.bitfield[i])&e.bitfield[i];return s.updateCardinality(),s.updateVersion(),s},a.differenceRight=function(e,t,s){return a.differenceLeft(t,e,s)},a.difference=function(e,t,s=new a){s.clear();for(let i=0;i<n;i++)s.bitfield[i]=e.bitfield[i]^t.bitfield[i];return s.updateCardinality(),s.updateVersion(),s};const o={LIGHTMAP_ON:r.getIdByName("LIGHTMAP_ON"),DIRLIGHTMAP_COMBINED:r.getIdByName("DIRLIGHTMAP_COMBINED"),POINT_COOKIE:r.getIdByName("POINT_COOKIE"),POINT:r.getIdByName("POINT"),SPOT:r.getIdByName("SPOT"),DIRECTIONAL_COOKIE:r.getIdByName("DIRECTIONAL_COOKIE"),DIRECTIONAL:r.getIdByName("DIRECTIONAL"),VERTEXLIGHT_ON:r.getIdByName("VERTEXLIGHT_ON"),LIGHTPROBE_SH:r.getIdByName("LIGHTPROBE_SH"),FOG_LINEAR:r.getIdByName("FOG_LINEAR"),FOG_EXP:r.getIdByName("FOG_EXP"),FOG_EXP2:r.getIdByName("FOG_EXP2"),SHADOWS_DEPTH:r.getIdByName("SHADOWS_DEPTH"),SHADOWS_SCREEN:r.getIdByName("SHADOWS_SCREEN"),UNITY_PASS_SHADOWCASTER:r.getIdByName("UNITY_PASS_SHADOWCASTER"),_MAIN_LIGHT_SHADOWS:r.getIdByName("_MAIN_LIGHT_SHADOWS"),_MAIN_LIGHT_SHADOWS_CASCADE:r.getIdByName("_MAIN_LIGHT_SHADOWS_CASCADE"),_SHADOWS_SOFT:r.getIdByName("_SHADOWS_SOFT"),_ADDITIONAL_LIGHTS:r.getIdByName("_ADDITIONAL_LIGHTS"),_ADDITIONAL_LIGHTS_VERTEX:r.getIdByName("_ADDITIONAL_LIGHTS_VERTEX"),_ADDITIONAL_OFF:r.getIdByName("_ADDITIONAL_OFF")}},(e,t,s)=>{"use strict";s.d(t,{a:()=>a});var i=s(1),n=s(0),r=s(25);class a extends i.k{constructor(){super(),this.id=0,this._model=new r.a,this._castShadows=!0,this._receiveShadows=!0,this.system=i.a.getApplication().systems.renderer,this.__renderer="",this.code=null,this._aabb=null,this._lastAABBVersion=-1}get aabb(){return this._aabb||(this._aabb=new n.b),this.model&&this.model.mesh?this._aabb.setFromTransformedAabb(this.model.mesh.aabb,this.entity.worldTransform):this._aabb.setMinMax(n.m.ZERO,n.m.ZERO),this._aabb}get meshInstances(){return this.model?this.model.meshInstances:null}set meshInstances(e){this.model&&(this.model.meshInstances=e)}get castShadows(){return this._castShadows}set castShadows(e){this._castShadows!==e&&(this._castShadows=e,this.model.castShadows=e)}get receiveShadows(){return this._receiveShadows}set receiveShadows(e){this._receiveShadows!==e&&(this._receiveShadows=e,this.model.receiveShadows=e)}onAttached(){super.onAttached(),this.model&&(this.model.entity=this.entity)}onEnable(){return!!super.onEnable()&&(i.a.getApplication().scene.addRenderer(this),!0)}onDisable(){return!!super.onDisable()&&(i.a.getApplication().scene.removeRenderer(this),!0)}synchronizeWithEntity(){if(!this.entity||!this.code)return;const e=this.model.skin&&this.model.skin.rootBone,t=e?e.aabbVersion:this.entity.aabbVersion;this._destroyed||this._lastAABBVersion===t||(this._lastAABBVersion=t,this.code._lightProbeUsage&&this.code.UpdateProbes(),this.model.flipFaces=e?e._isOddlyScaled():this.entity._isOddlyScaled())}getMeshInstancesForRender(){return this.synchronizeWithEntity(),this.code.OnBeforeRender&&this.code.OnBeforeRender(),this.model.update(),this.model.meshInstances}getPropertyBlock(e,t){this.model.update();const s=this.model.meshInstances[t];s?e.handle.copyFromMeshInstance(s):UnityEngine.Debug.LogWarning$1("MaterialPropertyBlock index "+t+" is out of range")}setPropertyBlock(e,t){this.model.update(),this.model._materialPropertyBlocks[t]=e.handle,this.model._needsUpdate=!0}hasPropertyBlock(){const e=this.model._materialPropertyBlocks.length;if(0===e)return!1;for(let t=0;t<e;t++)if(this.model._materialPropertyBlocks[t])return!0;return!1}setMesh(e){this.model.setMeshDirectlyToMeshInstance(e)}get model(){return this._model}set model(e){this._model=e}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>a,b:()=>h,c:()=>d,d:()=>n,e:()=>r});var i=s(49);class n{constructor(){this.name=null,this.value=0}}class r{constructor(){this.id=0,this.name=null,this.value=0}}class a{constructor(){this.id=0,this.name=null}}class o{constructor(){this.fixedDeltaTime=0,this.miximumDeltaTime=0,this.timeScale=0,this.maximumParticleTimestep=0}}class h{constructor(){this.enabled=!1,this.layerId=0,this.otherLayerId=0}}class l{constructor(){this.gravity=null,this.defaultSolverIterations=0,this.bounceThreshold=0,this.autoSyncTransforms=!1,this.autoSimulation=!1,this.collisionMatrix=[]}}class c{constructor(){this.material=null,this.gravity=null,this.positionIterations=0,this.velocityIterations=0,this.velocityThreshold=0,this.maxLinearCorrection=0,this.maxAngularCorrection=0,this.maxTranslationSpeed=0,this.maxRotationSpeed=0,this.baumgarteScale=0,this.baumgarteTOIScale=0,this.timeToSleep=0,this.linearSleepTolerance=0,this.angularSleepTolerance=0,this.defaultContactOffset=0,this.autoSimulation=!1,this.queriesHitTriggers=!1,this.queriesStartInColliders=!1,this.callbacksOnDisable=!1,this.reuseCollisionCallbacks=!1,this.autoSyncTransforms=!1,this.collisionMatrix=[]}}class d{constructor(){this.scriptsExecutionOrder=[],this.sortingLayers=[],this.cullingLayers=[],this.timeSettings=new o,this.physicsSettings=new l,this.physics2DSettings=new c,this.qualitySettings=new i.a,this.enableRealtimeShadows=!0,this.enableAutoInstancing=!1,this.enableDynamicBatching=!0,this.lightmapEncodingQuality=0,this.desiredColorSpace=null,this.allTagsInProject=null}}d.instance=new d},(e,t,s)=>{"use strict";s.d(t,{a:()=>l});const i={SHADER_PASS_ALWAYS:0,SHADER_PASS_FORWARD_BASE:1,SHADER_PASS_FORWARD_ADD:2,SHADER_PASS_SHADOW_CASTER:3,SHADER_PASS_GRAB_PASS:4,SHADER_PASS_VERTEX:5,SHADER_PASS_VERTEX_LM:6,SHADER_PASS_UNIVERSAL_FORWARD_LIT:7,SHADER_PASS_UNIVERSAL_FORWARD_ONLY:8,SHADER_PASS_SRP_DEFAULT_UNLIT:9,RENDER_TYPE_BACKGROUND:0,RENDER_TYPE_OPAQUE:1,RENDER_TYPE_TRANSPARENT:2,LIGHT_MODE_TAG_NAME:"LIGHTMODE",LIGHT_MODE_ALWAYS_NAME:"ALWAYS",LIGHT_MODE_FORWARD_BASE_NAME:"FORWARDBASE",LIGHT_MODE_FORWARD_ADD_NAME:"FORWARDADD",LIGHT_MODE_UNIVERSAL_FORWARD_NAME:"UniversalForward",LIGHT_MODE_UNIVERSAL_FORWARD_ONLY_NAME:"UniversalForwardOnly",LIGHT_MODE_SRP_DEFAULT_UNLIT_NAME:"SRPDEFAULTUNLIT",LIGHT_MODE_SHADOW_CASTER_NAME:"SHADOWCASTER",GRAB_PASS_TAG_NAME:"GRABPASS",LIGHT_MODE_VERTEX_NAME:"Vertex",LIGHT_MODE_VERTEX_LM_NAME:"VertexLM",shaderPassToLightmode:{0:"ALWAYS",1:"FORWARDBASE",2:"FORWARDADD",3:"SHADOWCASTER",4:"GRABPASS",5:"Vertex",6:"VertexLM",7:"UniversalForward",8:"UniversalForwardOnly",9:"SRPDEFAULTUNLIT"},lightmodeToShaderPass:{ALWAYS:0,FORWARDBASE:1,FORWARDADD:2,SHADOWCASTER:3,GRABPASS:4,Vertex:5,VertexLM:6,UniversalForward:7,UniversalForwardOnly:8,SRPDEFAULTUNLIT:9},RENDER_TYPE_TAG_NAME:"RENDERTYPE",RENDER_TYPE_BACKGROUND_NAME:"Background",RENDER_TYPE_OPAQUE_NAME:"Opaque",RENDER_TYPE_TRANSPARENT_NAME:"Transparent",SHADERDEF_NOSHADOW:1,SHADERDEF_SKIN:2,SHADERDEF_UV0:4,SHADERDEF_UV1:8,SHADERDEF_VCOLOR:16,SHADERDEF_INSTANCING:32,SHADERDEF_LM:64,SHADERDEF_DIRLM:128,SHADERDEF_SCREENSPACE:256,SHADERDEF_TANGENTS:512,SHADERDEF_LMUV0:1024,SHADERDEF_LM_DLDR:2048,SHADERDEF_LM_BAKED_AMBIENT:4096,SHADERDEF_LIGHTPROBES:8192,SHADERDEF_BLEND_REFLECTION_PROBES:16384,SHADERDEF_RENDERTYPE_BACKGROUND:32768,SHADERDEF_PARTICLES_INSTANCING:65536,SHADERDEF_UI_MASK:1<<17,SHADERDEF_REVERT_STENCIL:1<<18,SHADERDEF_STENCIL_OVERRIDE:1<<19,SHADERDEF_UI:1<<20,SHADERDEF_CAST_SHADOWS:1<<21,SHADERDEF_BATCHING:1<<22,SORTKEY_FORWARD:0,SORTKEY_DEPTH:1,SEMANTIC_POSITION:"POSITION",SEMANTIC_NORMAL:"NORMAL",SEMANTIC_TANGENT:"TANGENT",SEMANTIC_BLENDWEIGHT:"BLENDWEIGHT",SEMANTIC_BLENDINDICES:"BLENDINDICES",SEMANTIC_COLOR:"COLOR",SEMANTIC_TEXCOORD0:"TEXCOORD0",SEMANTIC_TEXCOORD1:"TEXCOORD1",SEMANTIC_TEXCOORD2:"TEXCOORD2",SEMANTIC_TEXCOORD3:"TEXCOORD3",SEMANTIC_TEXCOORD4:"TEXCOORD4",SEMANTIC_TEXCOORD5:"TEXCOORD5",SEMANTIC_TEXCOORD6:"TEXCOORD6",SEMANTIC_TEXCOORD7:"TEXCOORD7",SEMANTIC_ATTR0:"ATTR0",SEMANTIC_ATTR1:"ATTR1",SEMANTIC_ATTR2:"ATTR2",SEMANTIC_ATTR3:"ATTR3",SEMANTIC_ATTR4:"ATTR4",SEMANTIC_ATTR5:"ATTR5",SEMANTIC_ATTR6:"ATTR6",SEMANTIC_ATTR7:"ATTR7",SEMANTIC_ATTR8:"ATTR8",SEMANTIC_ATTR9:"ATTR9",SEMANTIC_ATTR10:"ATTR10",SEMANTIC_ATTR11:"ATTR11",SEMANTIC_ATTR12:"ATTR12",SEMANTIC_ATTR13:"ATTR13",SEMANTIC_ATTR14:"ATTR14",SEMANTIC_ATTR15:"ATTR15",ADDRESS_REPEAT:0,ADDRESS_CLAMP_TO_EDGE:1,ADDRESS_MIRRORED_REPEAT:2,PIXELFORMAT_A8:0,PIXELFORMAT_L8:1,PIXELFORMAT_L8_A8:2,PIXELFORMAT_R5_G6_B5:3,PIXELFORMAT_R5_G5_B5_A1:4,PIXELFORMAT_R4_G4_B4_A4:5,PIXELFORMAT_R8_G8_B8:6,PIXELFORMAT_R8_G8_B8_A8:7,PIXELFORMAT_DXT1:8,PIXELFORMAT_DXT3:9,PIXELFORMAT_DXT5:10,PIXELFORMAT_RGB16F:11,PIXELFORMAT_RGBA16F:12,PIXELFORMAT_RGB32F:13,PIXELFORMAT_RGBA32F:14,PIXELFORMAT_R32F:15,PIXELFORMAT_DEPTH:16,PIXELFORMAT_DEPTHSTENCIL:17,PIXELFORMAT_111110F:18,PIXELFORMAT_SRGB:19,PIXELFORMAT_SRGBA:20,PIXELFORMAT_ETC1:21,PIXELFORMAT_ETC2_RGB:22,PIXELFORMAT_ETC2_RGBA:23,PIXELFORMAT_PVRTC_2BPP_RGB_1:24,PIXELFORMAT_PVRTC_2BPP_RGBA_1:25,PIXELFORMAT_PVRTC_4BPP_RGB_1:26,PIXELFORMAT_PVRTC_4BPP_RGBA_1:27,TEXTURELOCK_READ:1,TEXTURELOCK_WRITE:2},n={LIGHT_MODE_NAMES:[i.LIGHT_MODE_ALWAYS_NAME,i.LIGHT_MODE_FORWARD_BASE_NAME,i.LIGHT_MODE_FORWARD_ADD_NAME,i.LIGHT_MODE_SHADOW_CASTER_NAME,i.GRAB_PASS_TAG_NAME,i.LIGHT_MODE_VERTEX_NAME,i.LIGHT_MODE_VERTEX_LM_NAME,i.LIGHT_MODE_UNIVERSAL_FORWARD_NAME,i.LIGHT_MODE_UNIVERSAL_FORWARD_ONLY_NAME,i.LIGHT_MODE_SRP_DEFAULT_UNLIT_NAME],RENDER_TYPE_NAMES:[i.RENDER_TYPE_BACKGROUND_NAME,i.RENDER_TYPE_OPAQUE_NAME,i.RENDER_TYPE_TRANSPARENT_NAME]},r={BLENDMODE_ZERO:0,BLENDMODE_ONE:1,BLENDMODE_SRC_COLOR:2,BLENDMODE_ONE_MINUS_SRC_COLOR:3,BLENDMODE_DST_COLOR:4,BLENDMODE_ONE_MINUS_DST_COLOR:5,BLENDMODE_SRC_ALPHA:6,BLENDMODE_SRC_ALPHA_SATURATE:7,BLENDMODE_ONE_MINUS_SRC_ALPHA:8,BLENDMODE_DST_ALPHA:9,BLENDMODE_ONE_MINUS_DST_ALPHA:10,BLENDEQUATION_ADD:0,BLENDEQUATION_SUBTRACT:1,BLENDEQUATION_REVERSE_SUBTRACT:2,BLENDEQUATION_MIN:3,BLENDEQUATION_MAX:4,BUFFER_STATIC:0,BUFFER_DYNAMIC:1,BUFFER_STREAM:2,BUFFER_GPUDYNAMIC:3,CLEARFLAG_COLOR:1,CLEARFLAG_DEPTH:2,CLEARFLAG_STENCIL:4,CLEARFLAG_USE_SKYBOX:8,CUBEFACE_POSX:0,CUBEFACE_NEGX:1,CUBEFACE_POSY:2,CUBEFACE_NEGY:3,CUBEFACE_POSZ:4,CUBEFACE_NEGZ:5,CULLFACE_NONE:0,CULLFACE_BACK:1,CULLFACE_FRONT:2,CULLFACE_FRONTANDBACK:3,TYPE_INT8:0,TYPE_UINT8:1,TYPE_INT16:2,TYPE_UINT16:3,TYPE_INT32:4,TYPE_UINT32:5,TYPE_FLOAT32:6,FILTER_NEAREST:0,FILTER_LINEAR:1,FILTER_NEAREST_MIPMAP_NEAREST:2,FILTER_NEAREST_MIPMAP_LINEAR:3,FILTER_LINEAR_MIPMAP_NEAREST:4,FILTER_LINEAR_MIPMAP_LINEAR:5,FUNC_NEVER:0,FUNC_LESS:1,FUNC_EQUAL:2,FUNC_LESSEQUAL:3,FUNC_GREATER:4,FUNC_NOTEQUAL:5,FUNC_GREATEREQUAL:6,FUNC_ALWAYS:7,INDEXFORMAT_UINT8:0,INDEXFORMAT_UINT16:1,INDEXFORMAT_UINT32:2,PRIMITIVE_POINTS:0,PRIMITIVE_LINES:1,PRIMITIVE_LINELOOP:2,PRIMITIVE_LINESTRIP:3,PRIMITIVE_TRIANGLES:4,PRIMITIVE_TRISTRIP:5,PRIMITIVE_TRIFAN:6,STENCILOP_KEEP:0,STENCILOP_ZERO:1,STENCILOP_REPLACE:2,STENCILOP_INCREMENT:3,STENCILOP_INCREMENTWRAP:4,STENCILOP_DECREMENT:5,STENCILOP_DECREMENTWRAP:6,STENCILOP_INVERT:7,UNIFORMTYPE_BOOL:0,UNIFORMTYPE_INT:1,UNIFORMTYPE_FLOAT:2,UNIFORMTYPE_VEC2:3,UNIFORMTYPE_VEC3:4,UNIFORMTYPE_VEC4:5,UNIFORMTYPE_IVEC2:6,UNIFORMTYPE_IVEC3:7,UNIFORMTYPE_IVEC4:8,UNIFORMTYPE_BVEC2:9,UNIFORMTYPE_BVEC3:10,UNIFORMTYPE_BVEC4:11,UNIFORMTYPE_MAT2:12,UNIFORMTYPE_MAT3:13,UNIFORMTYPE_MAT4:14,UNIFORMTYPE_TEXTURE2D:15,UNIFORMTYPE_TEXTURECUBE:16,UNIFORMTYPE_FLOATARRAY:17,UNIFORMTYPE_TEXTURE2D_SHADOW:18,UNIFORMTYPE_TEXTURECUBE_SHADOW:19,UNIFORMTYPE_TEXTURE3D:20,URP_CAMERA_RENDER_TYPE_BASE:0,URP_CAMERA_RENDER_TYPE_OVERLAY:1},a={};a[r.UNIFORMTYPE_BOOL]=0,a[r.UNIFORMTYPE_INT]=0,a[r.UNIFORMTYPE_FLOAT]=0,a[r.UNIFORMTYPE_VEC2]=new Float32Array([0,0]),a[r.UNIFORMTYPE_VEC3]=new Float32Array([0,0,0]),a[r.UNIFORMTYPE_VEC4]=new Float32Array([0,0,0,0]),a[r.UNIFORMTYPE_IVEC2]=new Int32Array([0,0]),a[r.UNIFORMTYPE_IVEC3]=new Int32Array([0,0,0]),a[r.UNIFORMTYPE_IVEC4]=new Int32Array([0,0,0,0]),a[r.UNIFORMTYPE_BVEC2]=0,a[r.UNIFORMTYPE_BVEC3]=0,a[r.UNIFORMTYPE_BVEC4]=0,a[r.UNIFORMTYPE_MAT2]=new Float32Array([0,0,0,0]),a[r.UNIFORMTYPE_MAT3]=new Float32Array([0,0,0,0,0,0,0,0,0]),a[r.UNIFORMTYPE_MAT4]=new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),a[r.UNIFORMTYPE_TEXTURE2D]=null,a[r.UNIFORMTYPE_TEXTURECUBE]=null,a[r.UNIFORMTYPE_FLOATARRAY]=new Float32Array([0,0,0,0]),a[r.UNIFORMTYPE_TEXTURE2D_SHADOW]=null,a[r.UNIFORMTYPE_TEXTURECUBE_SHADOW]=null;const o={};o[i.SEMANTIC_POSITION]=0,o[i.SEMANTIC_NORMAL]=1,o[i.SEMANTIC_TANGENT]=2,o[i.SEMANTIC_BLENDWEIGHT]=3,o[i.SEMANTIC_BLENDINDICES]=4,o[i.SEMANTIC_COLOR]=5,o[i.SEMANTIC_TEXCOORD0]=6,o[i.SEMANTIC_TEXCOORD1]=7,o[i.SEMANTIC_TEXCOORD2]=8,o[i.SEMANTIC_TEXCOORD3]=9,o[i.SEMANTIC_TEXCOORD4]=10,o[i.SEMANTIC_TEXCOORD5]=11,o[i.SEMANTIC_TEXCOORD6]=12,o[i.SEMANTIC_TEXCOORD7]=13,o[i.SEMANTIC_ATTR0]=14,o[i.SEMANTIC_ATTR1]=15,o[i.SEMANTIC_ATTR2]=16,o[i.SEMANTIC_ATTR3]=17,o[i.SEMANTIC_ATTR4]=18,o[i.SEMANTIC_ATTR5]=19,o[i.SEMANTIC_ATTR6]=20,o[i.SEMANTIC_ATTR7]=21,o[i.SEMANTIC_ATTR8]=22,o[i.SEMANTIC_ATTR9]=23,o[i.SEMANTIC_ATTR10]=24,o[i.SEMANTIC_ATTR11]=25,o[i.SEMANTIC_ATTR12]=26,o[i.SEMANTIC_ATTR13]=27,o[i.SEMANTIC_ATTR14]=28,o[i.SEMANTIC_ATTR15]=29;const h={unity_MatrixMVP:2,unity_MatrixMV:4,unity_MatrixVP:8,unity_MatrixV:16,unity_MatrixInvV:32,glstate_matrix_projection:64,unity_MatrixTMV:128,unity_MatrixITMV:256,unity_ObjectToWorld:512,unity_WorldToObject:1024,unity_CameraProjection:2048,unity_CameraInvProjection:4096,"unity_CameraWorldClipPlanes[0]":1,"hlslcc_mtx4x4unity_MatrixMVP[0]":2,"hlslcc_mtx4x4unity_MatrixMV[0]":4,"hlslcc_mtx4x4unity_MatrixVP[0]":8,"hlslcc_mtx4x4unity_MatrixV[0]":16,"hlslcc_mtx4x4unity_MatrixInvV[0]":32,"hlslcc_mtx4x4glstate_matrix_projection[0]":64,"hlslcc_mtx4x4unity_MatrixTMV[0]":128,"hlslcc_mtx4x4unity_MatrixITMV[0]":256,"hlslcc_mtx4x4unity_ObjectToWorld[0]":512,"hlslcc_mtx4x4unity_WorldToObject[0]":1024,"hlslcc_mtx4x4unity_CameraProjection[0]":2048,"hlslcc_mtx4x4unity_CameraInvProjection[0]":4096,Names:[]};h.Names[0]="~PlaceHolder to keep byte shift equal to index~",h.Names[1]="hlslcc_mtx4x4unity_MatrixMVP",h.Names[2]="hlslcc_mtx4x4unity_MatrixMV",h.Names[3]="hlslcc_mtx4x4unity_MatrixVP",h.Names[4]="hlslcc_mtx4x4unity_MatrixV",h.Names[5]="hlslcc_mtx4x4unity_MatrixInvV",h.Names[6]="hlslcc_mtx4x4glstate_matrix_projection",h.Names[7]="hlslcc_mtx4x4unity_MatrixTMV",h.Names[8]="hlslcc_mtx4x4unity_MatrixITMV",h.Names[9]="hlslcc_mtx4x4unity_ObjectToWorld",h.Names[10]="hlslcc_mtx4x4unity_WorldToObject",h.Names[11]="hlslcc_mtx4x4unity_CameraProjection",h.Names[12]="hlslcc_mtx4x4unity_CameraInvProjection",h.InstanceScopeUniform=[],h.InstanceScopeUniform[0]=!1,h.InstanceScopeUniform[1]=!1,h.InstanceScopeUniform[2]=!1,h.InstanceScopeUniform[3]=!1,h.InstanceScopeUniform[4]=!1,h.InstanceScopeUniform[5]=!1,h.InstanceScopeUniform[6]=!1,h.InstanceScopeUniform[7]=!1,h.InstanceScopeUniform[8]=!1,h.InstanceScopeUniform[9]=!0,h.InstanceScopeUniform[10]=!0,h.InstanceScopeUniform[11]=!1,h.InstanceScopeUniform[12]=!1;const l=Object.assign({},{EVENT_MOUSEDOWN:"mousedown",EVENT_MOUSEMOVE:"mousemove",EVENT_MOUSEUP:"mouseup",EVENT_MOUSEWHEEL:"mousewheel",EVENT_TOUCHSTART:"touchstart",EVENT_TOUCHEND:"touchend",EVENT_TOUCHMOVE:"touchmove",EVENT_TOUCHCANCEL:"touchcancel",KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ENTER:13,KEY_SHIFT:16,KEY_CONTROL:17,KEY_ALT:18,KEY_PAUSE:19,KEY_CAPS_LOCK:20,KEY_ESCAPE:27,KEY_SPACE:32,KEY_PAGE_UP:33,KEY_PAGE_DOWN:34,KEY_END:35,KEY_HOME:36,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_PRINT_SCREEN:44,KEY_INSERT:45,KEY_DELETE:46,KEY_0:48,KEY_1:49,KEY_2:50,KEY_3:51,KEY_4:52,KEY_5:53,KEY_6:54,KEY_7:55,KEY_8:56,KEY_9:57,KEY_SEMICOLON:59,KEY_EQUAL:61,KEY_A:65,KEY_B:66,KEY_C:67,KEY_D:68,KEY_E:69,KEY_F:70,KEY_G:71,KEY_H:72,KEY_I:73,KEY_J:74,KEY_K:75,KEY_L:76,KEY_M:77,KEY_N:78,KEY_O:79,KEY_P:80,KEY_Q:81,KEY_R:82,KEY_S:83,KEY_T:84,KEY_U:85,KEY_V:86,KEY_W:87,KEY_X:88,KEY_Y:89,KEY_Z:90,KEY_WINDOWS:91,KEY_CONTEXT_MENU:93,KEY_NUMPAD_0:96,KEY_NUMPAD_1:97,KEY_NUMPAD_2:98,KEY_NUMPAD_3:99,KEY_NUMPAD_4:100,KEY_NUMPAD_5:101,KEY_NUMPAD_6:102,KEY_NUMPAD_7:103,KEY_NUMPAD_8:104,KEY_NUMPAD_9:105,KEY_MULTIPLY:106,KEY_ADD:107,KEY_SEPARATOR:108,KEY_SUBTRACT:109,KEY_DECIMAL:110,KEY_DIVIDE:111,KEY_F1:112,KEY_F2:113,KEY_F3:114,KEY_F4:115,KEY_F5:116,KEY_F6:117,KEY_F7:118,KEY_F8:119,KEY_F9:120,KEY_F10:121,KEY_F11:122,KEY_F12:123,KEY_COMMA:188,KEY_PERIOD:190,KEY_SLASH:191,KEY_OPEN_BRACKET:219,KEY_BACK_SLASH:220,KEY_CLOSE_BRACKET:221,KEY_META:224,MOUSEBUTTON_NONE:-1,MOUSEBUTTON_LEFT:0,MOUSEBUTTON_MIDDLE:1,MOUSEBUTTON_RIGHT:2,PAD_1:0,PAD_2:1,PAD_3:2,PAD_4:3,PAD_FACE_1:0,PAD_FACE_2:1,PAD_FACE_3:2,PAD_FACE_4:3,PAD_L_SHOULDER_1:4,PAD_R_SHOULDER_1:5,PAD_L_SHOULDER_2:6,PAD_R_SHOULDER_2:7,PAD_SELECT:8,PAD_START:9,PAD_L_STICK_BUTTON:10,PAD_R_STICK_BUTTON:11,PAD_UP:12,PAD_DOWN:13,PAD_LEFT:14,PAD_RIGHT:15,PAD_VENDOR:16,PAD_L_STICK_X:0,PAD_L_STICK_Y:1,PAD_R_STICK_X:2,PAD_R_STICK_Y:3},{FILLMODE_NONE:"NONE",FILLMODE_FILL_WINDOW:"FILL_WINDOW",FILLMODE_KEEP_ASPECT:"KEEP_ASPECT",RESOLUTION_AUTO:"AUTO",RESOLUTION_FIXED:"FIXED",SCREEN_TYPE_WORLD:"world",SCREEN_TYPE_CAMERA:"camera",SCREEN_TYPE_SCREEN:"screen"},{FOG_NONE:"none",FOG_LINEAR:"linear",FOG_EXP:"exp",FOG_EXP2:"exp2"},{LIGHTTYPE_DIRECTIONAL:0,LIGHTTYPE_POINT:1,LIGHTTYPE_SPOT:2,SHADOWS_MODE_NO_SHADOWS:0,SHADOWS_MODE_HARD_SHADOWS:1,SHADOWS_MODE_SOFT_SHADOWS:2,SHADOW_RESOLUTION_FROM_QUALITY_SETTINGS:-1,SHADOW_RESOLUTION_LOW:0,SHADOW_RESOLUTION_MEDIUM:1,SHADOW_RESOLUTION_HIGH:2,SHADOW_RESOLUTION_VERY_HIGH:3,SHADOW_PCF3:0,SHADOW_DEPTH:0,SHADOW_VSM8:1,SHADOW_VSM16:2,SHADOW_VSM32:3,SHADOW_PCF5:4,MASK_DYNAMIC:1,MASK_BAKED:2,MASK_LIGHTMAP:4},{PROJECTION_PERSPECTIVE:0,PROJECTION_ORTHOGRAPHIC:1,VIEW_CENTER:0,VIEW_LEFT:1,VIEW_RIGHT:2,ASPECT_AUTO:0,ASPECT_MANUAL:1,GATE_FIT_NONE:0,GATE_FIT_VERTICAL:1,GATE_FIT_HORIZONTAL:2,GATE_FIT_FILL:3,GATE_FIT_OVERSCAN:4},i,n,r,{TEXT_ALIGN_LEFT:"left",TEXT_ALIGN_RIGHT:"right",TEXT_ALIGN_CENTER:"center",TEXT_VERTICAL_ALIGN_TOP:"top",TEXT_VERTICAL_ALIGN_MIDDLE:"middle",TEXT_VERTICAL_ALIGN_BOTTOM:"bottom"},{SPRITE_TYPE_SIMPLE:0,SPRITE_TYPE_SLICED:1,SPRITE_TYPE_TILED:2,SPRITE_TYPE_FILLED:3,FILL_METHOD_HORIZONTAL:0,FILL_METHOD_VERTICAL:1,FILL_METHOD_RADIAL90:2,FILL_METHOD_RADIAL180:3,FILL_METHOD_RADIAL360:4,FILL_ORIGIN_BOTTOM_LEFT:0,FILL_ORIGIN_TOP_RIGHT:1,FILL_ORIGIN_RADIAL_BOTTOM:0,FILL_ORIGIN_RADIAL_RIGHT:1,FILL_ORIGIN_RADIAL_TOP:2,FILL_ORIGIN_RADIAL_LEFT:3},{ELEMENTTYPE_GROUP:"group",ELEMENTTYPE_IMAGE:"image",ELEMENTTYPE_TEXT:"text"},{SHADOWS_MODE_NO_SHADOWS:0,SHADOWS_MODE_HARD_SHADOWS:1,SHADOWS_MODE_HARD_AND_SOFT_SHADOWS:2},{UNKNOWN:0,PORTRAIT:1,PORTRAIT_UPSIDE_DOWN:2,LANDSCAPE_LEFT:3,LANDSCAPE_RIGHT:4});l.UniformDefaultValues=a,l.ShaderAttributeSlots=o,l.UNIFORMS_USAGE_MAP=h},(e,t,s)=>{"use strict";s.d(t,{a:()=>n});class i{constructor(){this.times={[n.SCRIPTS]:0,[n.ANIMATIONS]:0,[n.ANIMATORS]:0,[n.PHYSICS2D]:0,[n.PHYSICS]:0,[n.RENDER]:0,[n.FRAME]:0},this.drawCalls=0,this.frames=0,this.uiElements=0,this.materialSwitches=0,this.verticesCount=0,this.trianglesCount=0,this.totalSkinnedMeshes=0,this.visibleSkinnedMeshes=0,this.offscreenUpdatedSkinnedMeshes=0,this.shadowCasters=0,this.particleSystems=0,this.particles=0,this.animators=0,this.animatorLayers=0,this.activeBlendStates=0,this.animations=0,this.animatedParameters=0,this.animationKeys=0,this.maxUsedRam=0,this.currentFrameUsedRam=0}reset(){this.times.scripts=0,this.times.animations=0,this.times.animators=0,this.times.physics2d=0,this.times.physics=0,this.times.render=0,this.times.frame=0,this.drawCalls=0,this.frames=0,this.uiElements=0,this.materialSwitches=0,this.verticesCount=0,this.trianglesCount=0,this.totalSkinnedMeshes=0,this.visibleSkinnedMeshes=0,this.offscreenUpdatedSkinnedMeshes=0,this.shadowCasters=0,this.particleSystems=0,this.particles=0,this.animators=0,this.animatorLayers=0,this.activeBlendStates=0,this.animations=0,this.animatedParameters=0,this.animationKeys=0,this.maxUsedRam=0,this.currentFrameUsedRam=0}copy(e){return this.times.scripts=e.times.scripts,this.times.animations=e.times.animations,this.times.animators=e.times.animators,this.times.physics2d=e.times.physics2d,this.times.physics=e.times.physics,this.times.render=e.times.render,this.times.frame=e.times.frame,this.drawCalls=e.drawCalls,this.frames=e.frames,this.uiElements=e.uiElements,this.materialSwitches=e.materialSwitches,this.verticesCount=e.verticesCount,this.trianglesCount=e.trianglesCount,this.totalSkinnedMeshes=e.totalSkinnedMeshes,this.visibleSkinnedMeshes=e.visibleSkinnedMeshes,this.offscreenUpdatedSkinnedMeshes=e.offscreenUpdatedSkinnedMeshes,this.shadowCasters=e.shadowCasters,this.particleSystems=e.particleSystems,this.particles=e.particles,this.animators=e.animators,this.animatorLayers=e.animatorLayers,this.activeBlendStates=e.activeBlendStates,this.animations=e.animations,this.animatedParameters=e.animatedParameters,this.animationKeys=e.animationKeys,this.maxUsedRam=e.maxUsedRam,this.currentFrameUsedRam=e.currentFrameUsedRam,this}}class n{constructor(){this.sample=new i,this.current=new i,this.previous=new i,this.totalDrawCalls=0,this.detailedBreakdown={metrics:{resetTimestamp:performance.now(),frames:0,ram:0},timings:{[n.SCRIPTS]:{total:0,[n.SCRIPTS_ON_AWAKE[1]]:0,[n.SCRIPTS_ON_START[1]]:0,[n.SCRIPTS_ON_UPDATE[1]]:0,[n.SCRIPTS_ON_FIXED_UPDATE[1]]:0,[n.SCRIPTS_ON_POST_UPDATE[1]]:0},[n.ANIMATIONS]:{total:0,[n.ANIMATIONS_EVENTS[1]]:0},[n.ANIMATORS]:{total:0,[n.ANIMATORS_EVENTS[1]]:0},[n.PHYSICS2D]:{total:0,[n.PHYSICS_2D_ON_COLLISION_ENTER[1]]:0,[n.PHYSICS_2D_ON_COLLISION_STAY[1]]:0,[n.PHYSICS_2D_ON_COLLISION_EXIT[1]]:0,[n.PHYSICS_2D_ON_TRIGGER_ENTER[1]]:0,[n.PHYSICS_2D_ON_TRIGGER_STAY[1]]:0,[n.PHYSICS_2D_ON_TRIGGER_EXIT[1]]:0},[n.PHYSICS]:{total:0,[n.PHYSICS_ON_COLLISION_ENTER[1]]:0,[n.PHYSICS_ON_COLLISION_STAY[1]]:0,[n.PHYSICS_ON_COLLISION_EXIT[1]]:0,[n.PHYSICS_ON_TRIGGER_ENTER[1]]:0,[n.PHYSICS_ON_TRIGGER_STAY[1]]:0,[n.PHYSICS_ON_TRIGGER_EXIT[1]]:0,[n.PHYSICS_JOINTS[1]]:0},[n.RENDER]:{total:0,[n.RENDER_DEPTH[1]]:0,[n.RENDER_UI[1]]:0,[n.RENDER_SKIN_AND_MORPH[1]]:0,[n.RENDER_SHADOWS[1]]:0},[n.PARTICLES]:{total:0,[n.PARTICLES_RENDERER[1]]:0,[n.PARTICLES_COLOR_BY_SPEED[1]]:0,[n.PARTICLES_COLOR_OVER_LIFETIME[1]]:0,[n.PARTICLES_FORCE_OVER_LIFETIME[1]]:0,[n.PARTICLES_INHERIT_VELOCITY[1]]:0,[n.PARTICLES_LIMIT_VELOCITY_OVER_LIFETIME[1]]:0,[n.PARTICLES_NOISE[1]]:0,[n.PARTICLES_ROTATION_BY_SPEED[1]]:0,[n.PARTICLES_ROTATION_OVER_LIFETIME[1]]:0,[n.PARTICLES_SIZE_BY_SPEED[1]]:0,[n.PARTICLES_SIZE_OVER_LIFETIME[1]]:0,[n.PARTICLES_TEXTURE_SHEET_ANIMATION[1]]:0,[n.PARTICLES_VELOCITY_OVER_LIFETIME[1]]:0,[n.PARTICLES_SHAPE[1]]:0,[n.PARTICLES_EMITTER[1]]:0},[n.FRAME]:{total:0}}},this.webglVersion=window.WebGL2RenderingContext?2:1,this.webglExtensions=null,this.sectionsStack=[],this.recordedSkinnedMeshes=[],this.recordedMorphInstances=[]}get advancedMode(){return DEVELOP||TESTS}getSnapshot(){const e=this.sample,t=Math.max(1,e.frames),s={scriptsTime:e.times.scripts/t,animationsTime:e.times.animations/t,animatorsTime:e.times.animators/t,physics2dTime:e.times.physics2d/t,physicsTime:e.times.physics/t,renderTime:e.times.render/t,frameTime:e.times.frame/t,drawCalls:e.drawCalls/t,webglVersion:this.webglVersion,webglExtensions:this.webglExtensions,currentRam:e.currentFrameUsedRam,maxRam:e.maxUsedRam};return e.reset(),s}tick(){this.sample.frames++,this.sample.times.scripts+=this.current.times.scripts,this.sample.times.animations+=this.current.times.animations,this.sample.times.animators+=this.current.times.animators,this.sample.times.physics2d+=this.current.times.physics2d,this.sample.times.physics+=this.current.times.physics,this.sample.times.render+=this.current.times.render,this.sample.times.frame+=this.current.times.frame,this.sample.drawCalls+=this.current.drawCalls,this.sample.uiElements+=this.current.uiElements,this.sample.materialSwitches+=this.current.materialSwitches,this.sample.verticesCount+=this.current.verticesCount,this.sample.trianglesCount+=this.current.trianglesCount,this.sample.totalSkinnedMeshes+=this.current.totalSkinnedMeshes,this.sample.visibleSkinnedMeshes+=this.current.visibleSkinnedMeshes,this.sample.offscreenUpdatedSkinnedMeshes+=this.current.offscreenUpdatedSkinnedMeshes,this.sample.shadowCasters+=this.current.shadowCasters,this.sample.particleSystems+=this.current.particleSystems,this.sample.particles+=this.current.particles,this.sample.animators+=this.current.animators,this.sample.animatorLayers+=this.current.animatorLayers,this.sample.activeBlendStates+=this.current.activeBlendStates,this.sample.animations+=this.current.animations,this.sample.animatedParameters+=this.current.animatedParameters,this.sample.animationKeys+=this.current.animationKeys,this.sample.currentFrameUsedRam=this.current.currentFrameUsedRam,this.sample.maxUsedRam<this.current.currentFrameUsedRam&&(this.sample.maxUsedRam=this.current.currentFrameUsedRam,window.appStatsTracer&&window.appStatsTracer.registerRam(this.sample.maxUsedRam)),this.previous.copy(this.current),this.current.reset(),this.recordedSkinnedMeshes=[],this.recordedMorphInstances=[],this.advancedMode&&(this.detailedBreakdown.metrics.frames++,performance.memory&&(this.detailedBreakdown.metrics.ram+=performance.memory.usedJSHeapSize))}recordDrawCall(){this.current.drawCalls+=1,this.totalDrawCalls+=1}recordUiElements(){this.current.uiElements+=1}recordMaterialSwitch(){this.current.materialSwitches+=1}recordVertices(e){this.current.verticesCount+=e}recordTriangles(e){this.current.trianglesCount+=e/3}recordSkinnedMesh(e,t){if(!this.advancedMode||this.recordedSkinnedMeshes.includes(e.node._guid))return;this.current.totalSkinnedMeshes+=1,t&&this.recordVisibleSkinnedMesh();const s=e.skinInstance.skin;s&&s.updateWhenOffscreen&&this.recordOffscreenUpdatedSkinnedMeshes(),this.recordedSkinnedMeshes.push(e.node._guid)}recordMorphInstance(e){this.advancedMode&&!this.recordedMorphInstances.includes(e.node._guid)&&(e.visibleThisFrame&&this.recordVisibleMorphInstance(),this.current.totalSkinnedMeshes+=1,this.recordedMorphInstances.push(e.node._guid))}recordVisibleSkinnedMesh(){this.current.visibleSkinnedMeshes+=1}recordVisibleMorphInstance(){this.current.visibleSkinnedMeshes+=1}recordOffscreenUpdatedSkinnedMeshes(){this.current.offscreenUpdatedSkinnedMeshes+=1}recordActiveAnimator(){this.current.animators+=1}recordActiveAnimation(){this.current.animations+=1}recordAnimatedParameters(e){this.current.animatedParameters+=e}recordAnimatorLayers(e){this.current.animatorLayers+=e}recordActiveBlendState(){this.current.activeBlendStates+=1}recordMemoryUsage(){window.performance.memory&&(this.current.currentFrameUsedRam=window.performance.memory.usedJSHeapSize)}recordAnimationKeys(e){this.current.animationKeys+=e}recordShadowCasters(e){for(let t=0;t<e.length;t++){const s=e[t];this.current.shadowCasters+=s.length}}recordParticleSystem(){this.current.particleSystems+=1}recordParticles(e){this.current.particles+=e}markFrameStart(){this.current.times[n.FRAME]-=performance.now(),this.detailedBreakdown.timings[n.FRAME].total-=performance.now()}markFrameEnd(){this.current.times[n.FRAME]+=performance.now(),this.detailedBreakdown.timings[n.FRAME].total+=performance.now(),this.tick()}startSection(e){this.advancedMode?this.startSubSection([e,null]):this.tickCounters(e,null,-performance.now())}endSection(e){this.advancedMode?this.endSubSection([e,null]):this.tickCounters(e,null,performance.now())}startSubSection(e){const t=e[0],s=e[1];if(!this.advancedMode)return void this.tickCounters(t,null,-performance.now());const i=this.sectionsStack[this.sectionsStack.length-1];i&&this.tickCounters(i[0],i[1],performance.now()),this.tickCounters(t,s,-performance.now()),this.sectionsStack.push(e)}endSubSection(e){const t=e[0],s=e[1];if(!this.advancedMode)return void this.tickCounters(t,null,performance.now());this.tickCounters(t,s,performance.now());const i=this.sectionsStack.pop();this.advancedMode&&(i[0]!==t&&this.reportInconsistency(`Trying to end "${t}" section which is not active`),i[1]!==s&&this.reportInconsistency(`Trying to end "${s}" while "${i[1]}" sub section is still active`));const n=this.sectionsStack[this.sectionsStack.length-1];n&&this.tickCounters(n[0],n[1],-performance.now())}tickCounters(e,t,s){e in this.current.times&&(this.current.times[e]+=s),this.advancedMode&&(this.detailedBreakdown.timings[e]&&(this.detailedBreakdown.timings[e].total+=s),t&&this.detailedBreakdown.timings[e]&&(this.detailedBreakdown.timings[e][t]+=s))}reportInconsistency(e){if(DEBUG)throw new Error(e);console.error(e)}}n.SCRIPTS="scripts",n.SCRIPTS_ON_AWAKE=[n.SCRIPTS,"Awake"],n.SCRIPTS_ON_START=[n.SCRIPTS,"Start"],n.SCRIPTS_ON_UPDATE=[n.SCRIPTS,"Update"],n.SCRIPTS_ON_FIXED_UPDATE=[n.SCRIPTS,"FixedUpdate"],n.SCRIPTS_ON_POST_UPDATE=[n.SCRIPTS,"LateUpdate"],n.ANIMATIONS="animations",n.ANIMATIONS_EVENTS=[n.ANIMATIONS,"animationEvents"],n.ANIMATORS="animators",n.ANIMATORS_EVENTS=[n.ANIMATORS,"animatorEvents"],n.PHYSICS2D="physics2d",n.PHYSICS_2D_ON_COLLISION_ENTER=[n.PHYSICS2D,"OnCollisionEnter2D"],n.PHYSICS_2D_ON_COLLISION_STAY=[n.PHYSICS2D,"OnCollisionStay2D"],n.PHYSICS_2D_ON_COLLISION_EXIT=[n.PHYSICS2D,"OnCollisionExit2D"],n.PHYSICS_2D_ON_TRIGGER_ENTER=[n.PHYSICS2D,"OnTriggerEnter2D"],n.PHYSICS_2D_ON_TRIGGER_STAY=[n.PHYSICS2D,"OnTriggerStay2D"],n.PHYSICS_2D_ON_TRIGGER_EXIT=[n.PHYSICS2D,"OnTriggerExit2D"],n.PHYSICS="physics",n.PHYSICS_ON_COLLISION_ENTER=[n.PHYSICS,"OnCollisionEnter"],n.PHYSICS_ON_COLLISION_STAY=[n.PHYSICS,"OnCollisionStay"],n.PHYSICS_ON_COLLISION_EXIT=[n.PHYSICS,"OnCollisionExit"],n.PHYSICS_ON_TRIGGER_ENTER=[n.PHYSICS,"OnTriggerEnter"],n.PHYSICS_ON_TRIGGER_STAY=[n.PHYSICS,"OnTriggerStay"],n.PHYSICS_ON_TRIGGER_EXIT=[n.PHYSICS,"OnTriggerExit"],n.PHYSICS_JOINTS=[n.PHYSICS,"Joints"],n.RENDER="render",n.RENDER_DEPTH=[n.RENDER,"depth"],n.RENDER_UI=[n.RENDER,"ui"],n.RENDER_SKIN_AND_MORPH=[n.RENDER,"skinAndMorph"],n.RENDER_SHADOWS=[n.RENDER,"shadows"],n.PARTICLES="particles",n.PARTICLES_RENDERER=[n.PARTICLES,"renderer"],n.PARTICLES_COLOR_BY_SPEED=[n.PARTICLES,"colorBySpeed"],n.PARTICLES_COLOR_OVER_LIFETIME=[n.PARTICLES,"colorOverLifetime"],n.PARTICLES_FORCE_OVER_LIFETIME=[n.PARTICLES,"forceOverLifetime"],n.PARTICLES_INHERIT_VELOCITY=[n.PARTICLES,"inheritVelocity"],n.PARTICLES_LIMIT_VELOCITY_OVER_LIFETIME=[n.PARTICLES,"limitVelocityOverLifetime"],n.PARTICLES_NOISE=[n.PARTICLES,"noise"],n.PARTICLES_ROTATION_BY_SPEED=[n.PARTICLES,"rotationBySpeed"],n.PARTICLES_ROTATION_OVER_LIFETIME=[n.PARTICLES,"rotationOverLifetime"],n.PARTICLES_SIZE_BY_SPEED=[n.PARTICLES,"sizeBySpeed"],n.PARTICLES_SIZE_OVER_LIFETIME=[n.PARTICLES,"sizeOverLifetime"],n.PARTICLES_TEXTURE_SHEET_ANIMATION=[n.PARTICLES,"textureSheetAnimation"],n.PARTICLES_VELOCITY_OVER_LIFETIME=[n.PARTICLES,"velocityOverLifetime"],n.PARTICLES_SHAPE=[n.PARTICLES,"shape"],n.PARTICLES_EMITTER=[n.PARTICLES,"emitter"],n.FRAME="frame",n.instance=new n},(e,t,s)=>{"use strict";s.d(t,{a:()=>u,b:()=>m,c:()=>p});var i=s(2),n=s(1),r=s(11),a=s(27),o=s(32),h=s(0);const l={vertex_position:i.c.SEMANTIC_POSITION,vertex_normal:i.c.SEMANTIC_NORMAL,vertex_tangent:i.c.SEMANTIC_TANGENT,vertex_texCoord0:i.c.SEMANTIC_TEXCOORD0,vertex_texCoord1:i.c.SEMANTIC_TEXCOORD1,vertex_color:i.c.SEMANTIC_COLOR,vertex_boneWeights:i.c.SEMANTIC_BLENDWEIGHT,vertex_boneIndices:i.c.SEMANTIC_BLENDINDICES,instancing_translation:i.c.SEMANTIC_TEXCOORD5,instancing_rotation:i.c.SEMANTIC_TEXCOORD6,instancing_scale:i.c.SEMANTIC_TEXCOORD7,instancing_color:i.c.SEMANTIC_ATTR0,instancing_st:i.c.SEMANTIC_ATTR1,batching_matrix_index:i.c.SEMANTIC_ATTR0,_glesVertex:i.c.SEMANTIC_POSITION,_glesNormal:i.c.SEMANTIC_NORMAL,_glesTangent:i.c.SEMANTIC_TANGENT,_glesMultiTexCoord0:i.c.SEMANTIC_TEXCOORD0,_glesMultiTexCoord1:i.c.SEMANTIC_TEXCOORD1,_glesMultiTexCoord2:i.c.SEMANTIC_TEXCOORD2,_glesMultiTexCoord3:i.c.SEMANTIC_TEXCOORD3,_glesColor:i.c.SEMANTIC_COLOR,_glesTANGENT:i.c.SEMANTIC_TANGENT,in_POSITION0:i.c.SEMANTIC_POSITION,in_NORMAL0:i.c.SEMANTIC_NORMAL,in_TANGENT0:i.c.SEMANTIC_TANGENT,in_TEXCOORD0:i.c.SEMANTIC_TEXCOORD0,in_TEXCOORD1:i.c.SEMANTIC_TEXCOORD1,in_TEXCOORD2:i.c.SEMANTIC_TEXCOORD2,in_TEXCOORD3:i.c.SEMANTIC_TEXCOORD3,in_COLOR0:i.c.SEMANTIC_COLOR,_patched_POSITION:i.c.SEMANTIC_POSITION,_patched_COLOR:i.c.SEMANTIC_COLOR,_patched_NORMAL:i.c.SEMANTIC_NORMAL,_patched_TANGENT:i.c.SEMANTIC_TANGENT,_patched_TEXCOORD0:i.c.SEMANTIC_TEXCOORD0},c=new r.a,d=new r.a;class u{constructor(e,t,s=!0){this.device=e,this.definition=t,this.attributes=[],this.uniforms=[],this.samplers=[],this.ready=!1,this._glProgram=null,this.uniformsUsage=0,this.device.createShader(this,s),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"Shader")}destroy(){this.device.destroyShader(this)}}class _{constructor(e,t,s,i,n){this.graphicsDevice=e,this.keywords=new r.a,this.passId=-1,this.subShaderIndex=-1,this.readDepth=!1,this.shader=null,this._particlesShader=null,this._skinnedShader=null,this._uiShader=null,this._uiBatchingShader=null,this._sourceShader=n,this._batchingShader=null,this.usedVertexUniformVectors=0,this.usedFragmentUniformVectors=0,this.setupKeywords(t),this.setupShader(s,i),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"UnityShaderVariant");window.shaderVariantsTraceResults&&(this.traceObject=null)}setupTraceTracker(e,t){if(window.shaderVariantsTraceResults){const s=this.keywords.getEnabledKeywords();this.traceObject=_.createShaderVariantDTO(e,t.passType,t.id,t.subShaderIndex,s)}}getShader(e){return e&i.c.SHADERDEF_PARTICLES_INSTANCING?this.getParticlesShader():e&i.c.SHADERDEF_SKIN?this.getSkinnedShader():e&i.c.SHADERDEF_BATCHING?e&i.c.SHADERDEF_UI?this.getUIBatchingShader():this.getBatchingShader():e&i.c.SHADERDEF_UI?this.getUIShader():this.shader}applyMissingShader(e){const t=(0,a.b)(this._sourceShader.$id);return UnityEngine.Debug.LogError$1(`Shader ${this._sourceShader.name} with id #${this._sourceShader.$id} is replaced as missing shader.`),e&i.c.SHADERDEF_PARTICLES_INSTANCING?this._particlesShader=t:e&i.c.SHADERDEF_SKIN?this._skinnedShader=t:this.shader=t,t}getParticlesShader(){return null!==this._particlesShader||(this._particlesShader=new u(this.graphicsDevice,{attributes:l,vshader:a.a.patchParticlesVertexShader(this.shader.definition.vshader,l),fshader:this.shader.definition.fshader})),this._particlesShader}getSkinnedShader(){return null!==this._skinnedShader||(this._skinnedShader=new u(this.graphicsDevice,{attributes:l,vshader:a.a.patchSkinningVertexShader(this.shader.definition.vshader,l),fshader:this.shader.definition.fshader})),this._skinnedShader}getUIShader(){if(null!==this._uiShader)return this._uiShader;const e=this.shader.definition.vshader.includes("// This is a VP stub");return this._uiShader=new u(this.graphicsDevice,{attributes:l,vshader:e?this.shader.definition.vshader:a.a.patchUIVertexShader(this.shader.definition.vshader,l),fshader:this.shader.definition.fshader}),this._uiShader}getBatchingShader(){if(null!==this._batchingShader)return this._batchingShader;const e=this.shader.definition.vshader.includes("// This is a VP stub");return this._batchingShader=new u(this.graphicsDevice,{attributes:l,vshader:e?this.shader.definition.vshader:a.a.patchBatchingVertexShader(this.shader.definition.vshader,!0),fshader:this.shader.definition.fshader}),this._batchingShader}getUIBatchingShader(){if(null!==this._uiBatchingShader)return this._uiBatchingShader;const e=this.shader.definition.vshader.includes("// This is a VP stub");return this._uiBatchingShader=new u(this.graphicsDevice,{attributes:l,vshader:e?this.shader.definition.vshader:a.a.patchUIVertexShader(this.shader.definition.vshader,l,!0),fshader:this.shader.definition.fshader}),this._uiBatchingShader}setupKeywords(e){this.keywords.setEnabledKeywords(e)}setupShader(e,t){n.a.getApplication().isUrp&&(e=a.a.patchUrpShader(e),t=a.a.patchUrpShader(t)),this.shader=new u(this.graphicsDevice,{attributes:l,vshader:e,fshader:t},!1),this.usedVertexUniformVectors=(0,o.a)(e),this.usedFragmentUniformVectors=(0,o.a)(t)}}_.createShaderVariantDTO=function(e,t,s,i,n){const r=[e.name,e.guid,t,s,i,...n].join("-");return{shaderName:e.name,shaderGUID:e.guid,passType:t,passId:s,subShaderIndex:i,keywords:n,id:r}};class m{constructor(){this.lightMode=i.c.SHADER_PASS_ALWAYS,this.renderType=i.c.RENDER_TYPE_OPAQUE,this.grabPassTextureName=null,this.graphicsDevice=null,this.shaders=[],this.boundParameters=[],this.sourceShader=null,this.supportedKeywords=new r.a,this.keywordGroups=[],this.id=-1,this.subShaderIndex=-1,this.name=null,this.passType=0,this.zTest=null,this.zWrite=null,this.culling=null,this.blending=null,this.alphaBlending=null,this.colorWriteMask=null,this.offsetUnits=null,this.offsetFactor=null,this.stencilRef=null,this.stencilReadMask=null,this.stencilWriteMask=null,this.stencilOp=null,this.stencilOpFront=null,this.stencilOpBack=null,this.tags=null,this.passDefinedKeywords=null,this.passDefinedKeywordGroups=null,this.hasDepthReader=!1,this.usePass=!1,this.variants=[],this.excludedVariants=[],this.missingVariants=[],this.missingVariantKeywords=new r.a,this.maxUsedVertexUniformVectors=0,this.maxUsedFragmentUniformVectors=0,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"UnityShaderPass")}setupTags(){for(let e=0;e<this.tags.length;e++){const t=this.tags[e],s=t.name.toUpperCase();s===i.c.LIGHT_MODE_TAG_NAME&&(this.lightMode=i.c.lightmodeToShaderPass[t.value]),s===i.c.RENDER_TYPE_TAG_NAME&&t.value===i.c.RENDER_TYPE_BACKGROUND_NAME&&(this.renderType=i.c.RENDER_TYPE_BACKGROUND)}}setupKeywords(){this.supportedKeywords.setEnabledKeywords(this.passDefinedKeywords);for(let e=0;e<this.passDefinedKeywordGroups.length;e++)this.keywordGroups[e]=new r.a,this.keywordGroups[e].setEnabledKeywords(this.passDefinedKeywordGroups[e].keywords)}getVariant(e,t=!1,s=!0){let i=null,n=null;r.a.intersection(e,this.supportedKeywords,d);let a=Math.min(this.keywordGroups.length,d.cardinality);for(let e=0;e<this.keywordGroups.length;e++)r.a.intersection(d,this.keywordGroups[e],c),0!==c.cardinality||this.passDefinedKeywordGroups[e].hasDiscard||a++;const o=this.missingVariants.length?[...this.missingVariants,...this.variants]:this.variants;for(let e=0;e<o.length;e++){const t=o[e];if(r.a.intersection(d,t.keywords,c),t.keywords.cardinality===a&&c.cardinality===d.cardinality&&null===n&&(n=t),s){const e=c.cardinality;if(e===d.cardinality&&e===t.keywords.cardinality){i=t;break}}else c.cardinality===t.keywords.cardinality&&(null===i||i.keywords.cardinality<c.cardinality)&&(i=t)}null===i&&o.length>0&&(i=null!==n?n:o[0]),null!==i&&this.isVariantExcluded(i)&&(this.missingVariantKeywords=i.keywords,i=null);const h=window.shaderVariantsTraceResults;if(t&&h&&null!==i)if(i.keywords.cardinality===d.cardinality)null!==i.traceObject&&h.registerShaderVariant(i.traceObject);else{const e=_.createShaderVariantDTO(this.sourceShader,this.passType,this.id,this.subShaderIndex,i.keywords.getEnabledKeywords());h.registerShaderVariant(e)}return i}isVariantExcluded(e){for(let t=0;t<this.excludedVariants.length;t++){const s=this.excludedVariants[t];if((e.subShaderIndex===this.subShaderIndex||e.passId===this.id)&&r.a.keywordsEqual(e.keywords,s.keywords))return!0}return!1}setupVariants(){const e=[];for(let t=0;t<this.variants.length;t++){const s=this.variants[t],i=ShaderProgramsLibrary[s.vertexProgram],n=ShaderProgramsLibrary[s.fragmentProgram],r=new _(this.graphicsDevice,s.keywords,i,n,this.sourceShader);r.readDepth=s.readDepth,r.subShaderIndex=s.subShaderIndex,r.passId=s.passId,r.setupTraceTracker(this.sourceShader,this),e.push(r)}this.variants=e}setupExcludedVariants(){const e=[];for(let t=0;t<this.excludedVariants.length;t++){const s=this.excludedVariants[t],i=new _(this.graphicsDevice,s.keywords,"","",this.sourceShader);i.subShaderIndex=s.subShaderIndex,i.passId=s.passId,e.push(i)}this.excludedVariants=e}updateRenderState(e){for(let t=0;t<this.boundParameters.length;t++){const s=e.parameters[this.boundParameters[t].name];s&&s.data?this.boundParameters[t].val=s.data:this.boundParameters[t].val=0}}setupRenderSettings(){this._collectBoundParameters(this.zTest,this.boundParameters),this._collectBoundParameters(this.zWrite,this.boundParameters),this._collectBoundParameters(this.culling,this.boundParameters),this._collectBoundParameters(this.blending,this.boundParameters),this._collectBoundParameters(this.alphaBlending,this.boundParameters),this._collectBoundParameters(this.colorWriteMask,this.boundParameters),this._collectBoundParameters(this.offsetUnits,this.boundParameters),this._collectBoundParameters(this.offsetFactor,this.boundParameters),this._collectBoundParameters(this.stencilRef,this.boundParameters),this._collectBoundParameters(this.stencilReadMask,this.boundParameters),this._collectBoundParameters(this.stencilWriteMask,this.boundParameters),this._collectBoundParameters(this.stencilOp,this.boundParameters),this._collectBoundParameters(this.stencilOpFront,this.boundParameters),this._collectBoundParameters(this.stencilOpBack,this.boundParameters)}_collectBoundParameters(e,t){if(e)if("Luna.Unity.DTO.UnityEngine.Assets.Shader.Pass+Value"===e.$$fullname&&e.name)t.push(e);else for(const s in e){if(!e.hasOwnProperty(s))continue;const i=e[s];i&&i.$$fullname&&this._collectBoundParameters(i,t)}}applyMissingVariant(e,t,s){const o=n.a.getApplication().graphicsDevice,h=(0,a.b)(this.sourceShader.$id),l=new _(o,e,h.definition.vshader,h.definition.fshader,this.sourceShader);r.a.intersection(l.keywords,this.supportedKeywords,d),l.keywords.clear(),l.keywords.merge(d),l.shader=h;const c=this.missingVariantKeywords.getEnabledKeywords();let u=`"${this.sourceShader.name}/${i.c.shaderPassToLightmode[t.lightMode]}/${c.length>0?c.join(" "):"_"}" is not found and replaced as missing shader.`;if(DEVELOP){const e=s?`Target gameobject: ${s.node.name}. `:"";u=u.concat(` ${e}Please make sure shader doesn't have compilation errors, #pragma exclude_renderers gles, #pragma target 4.0 or above and shader variant is not excluded in Runtime Analysis/Shaders tab.`)}return UnityEngine.Debug.LogError$1(u),this.missingVariants.push(l),l}calculateMaxUsedUniformVectors(){this.maxUsedVertexUniformVectors=0,this.maxUsedFragmentUniformVectors=0;for(let e=0;e<this.variants.length;e++){const t=this.variants[e];this.maxUsedVertexUniformVectors=Math.max(this.maxUsedVertexUniformVectors,t.usedVertexUniformVectors),this.maxUsedFragmentUniformVectors=Math.max(this.maxUsedFragmentUniformVectors,t.usedFragmentUniformVectors)}}}class p{get fallbackShader(){return this.unityFallbackShader?this.unityFallbackShader.handle:null}set fallbackShader(e){this.unityFallbackShader=UnityEngine.Object.FromHandle(UnityEngine.Shader,e)}constructor(e){this.$id=0,this.graphicsDevice=e,this.name=null,this.guid=null,this.shaderDefinedKeywords=null,this.passes=[],this.usePasses=[],this.defaultParameterValues=[],this.defaultParameters={},this.defaultParameterNames=null,this.supportedKeywords=new r.a,this.unityFallbackShader=null,this.readDepth=!1,this.isCreatedByShaderGraph=!1,this.maxUsedVertexUniformVectors=0,this.maxUsedFragmentUniformVectors=0,this["__UnityEngine.Shader"]=null,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"UnityShader")}onAfterDeserialize(){this.setupUsePasses()}setup(){this.supportedKeywords.setEnabledKeywords(this.shaderDefinedKeywords),this.setupPasses(),this.setupDefaultParameters()}setupPasses(){this.maxUsedVertexUniformVectors=0,this.maxUsedFragmentUniformVectors=0;for(let e=0;e<this.passes.length;e++){const t=this.passes[e];t.graphicsDevice=this.graphicsDevice,t.sourceShader=this,t.setupTags(),t.setupKeywords(),t.setupVariants(),t.setupExcludedVariants(),t.setupRenderSettings(),t.calculateMaxUsedUniformVectors(),this.maxUsedVertexUniformVectors=Math.max(this.maxUsedVertexUniformVectors,t.maxUsedVertexUniformVectors),this.maxUsedFragmentUniformVectors=Math.max(this.maxUsedFragmentUniformVectors,t.maxUsedFragmentUniformVectors)}}setupUsePasses(){for(let e=0;e<this.usePasses.length;e++){const t=this.usePasses[e],s=t.shader.handle.passes.find((e=>e.name.toLowerCase()===t.pass.toLowerCase()));s&&this.passes.push(s)}}setupDefaultParameters(){this.defaultParameterNames={};for(let e=0;e<this.defaultParameterValues.length;e++){const t=this.defaultParameterValues[e];switch(this.defaultParameterNames[t.name]=!0,t.type){case Luna.Unity.DTO.UnityEngine.Assets.Shader.ShaderParameterType.Vector:case Luna.Unity.DTO.UnityEngine.Assets.Shader.ShaderParameterType.Color:this.defaultParameters[t.name]=t.value.data;break;case Luna.Unity.DTO.UnityEngine.Assets.Shader.ShaderParameterType.Scalar:this.defaultParameters[t.name]=t.value.x;break;case Luna.Unity.DTO.UnityEngine.Assets.Shader.ShaderParameterType.Texture:{const e=UnityEngine.Texture2D[t.textureValue+"Texture"];this.defaultParameters[t.name]=e?e.handle:null;break}}}}supportsKeyword(e){return this.supportedKeywords.isKeywordEnabled(e)}}p.globalKeywords=new r.a,p.globalUniforms={},p.resolveGlobalUniform=function(e){let t=p.globalUniforms[e];if(!t){const s=pc.Application.getApplication().graphicsDevice;t=p.globalUniforms[e]=s.scope.resolve(e)}return t},p.setGlobalUniform=function(e,t){p.resolveGlobalUniform(e).setValue(t)},p.getGlobalUniform=function(e){return p.resolveGlobalUniform(e).value},p.getGlobalUniformNumber=function(e){return p.getGlobalUniform(e)||0},p.getGlobalMatrixUniform=function(e){let t=p.getGlobalArrayUniform(e);return t?(t instanceof Float32Array||(t=new Float32Array(t)),h.i.fromArray(t)):new h.i},p.setGlobalMatrixUniform=function(e,t){p.setGlobalArrayUniform(e,t.data)},p.getGlobalArrayUniform=function(e){return p.getGlobalUniform(e)||null},p.setGlobalArrayUniform=function(e,t){t&&p.setGlobalUniform(e,t)},p.enableKeyword=function(e){this.globalKeywords.enableKeyword(e)},p.disableKeyword=function(e){this.globalKeywords.disableKeyword(e)},p.getEnabledKeywords=function(){return this.globalKeywords.getEnabledKeywords()},p.generateReport=function(){const e=pc.Application.getApplication().graphicsDevice,t={unityShadersCount:0,totalVariantsCount:0,totalExcludedVariantsCount:0,totalMissingVariantsCount:0,vertexShadersCount:0,fragmentShadersCount:0,shaderPatches:0,shaderVariantsLog:"",shadersLog:""},s=Object.values(UnityEngine.Shader.shaderIndex);t.unityShadersCount=s.length,t.totalVariantsCount=0,t.totalExcludedVariantsCount=0,t.totalMissingVariantsCount=0,t.shadersLog=s.map((e=>`\t[${e.$id}] "${e.name} ( [ ${e.passes.map((e=>i.c.shaderPassToLightmode[e.lightMode])).join(", ")} ] passes, ${e.passes.reduce(((e,t)=>e+t.variants.length),0)} variants )"`)).join("\n"),t.shaderVariantsLog="";for(let e=0;e<s.length;e++){const n=s[e],r=n.passes.reduce(((e,t)=>e+t.variants.length),0);t.shaderVariantsLog+=`[${n.$id}] "${n.name} ( [ ${n.passes.map((e=>i.c.shaderPassToLightmode[e.lightMode])).join(", ")} ] passes, ${r} variants )"\n`;const a=n.passes;for(let e=0;e<a.length;e++){const s=a[e];t.shaderVariantsLog+=s.variants.length>0?`\tVariants:\n ${s.variants.map((t=>`\t(${e})${i.c.shaderPassToLightmode[s.lightMode]}: `+(t.keywords.getEnabledKeywords().toString()||"<no keywords>")+(s.isVariantExcluded(t)?" (excluded)":""))).join("\n")}\n`:`\t(${e})${i.c.shaderPassToLightmode[s.lightMode]}: <no variants>\n`,t.totalVariantsCount+=s.variants.length,t.totalVariantsCount-=s.excludedVariants.length,t.totalExcludedVariantsCount+=s.excludedVariants.length,t.totalMissingVariantsCount+=s.missingVariants.length,t.shaderPatches+=s.variants.filter((e=>e._particlesShader)).length,t.shaderPatches+=s.variants.filter((e=>e._batchingShader)).length,t.shaderPatches+=s.variants.filter((e=>e._uiBatchingShader)).length,t.shaderPatches+=s.variants.filter((e=>e._skinnedShader)).length,t.shaderPatches+=s.variants.filter((e=>e._uiShader)).length}}return t.vertexShadersCount=Object.values(e.vertexShaderCache).length,t.fragmentShadersCount=Object.values(e.fragmentShaderCache).length,t},p.shaderReport=function(){const e=p.generateReport();console.log(`Shaders Report\nUnityShadersCount: ${e.unityShadersCount},\nTotalVariantsCount: ${e.totalVariantsCount},\nTotalExcludedVariantsCount: ${e.totalExcludedVariantsCount},\nMissingVariantUseCount: ${e.totalMissingVariantsCount},\nCompiledGLVertexShaders: ${e.vertexShadersCount},\nCompiledGlFragmentShaders: ${e.fragmentShadersCount},\nPatchedShaderVariants: ${e.shaderPatches},\nShaders:\n${e.shadersLog}\n\nShaderVariants:\n${e.shaderVariantsLog}\n`)}},(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{a:()=>Application});var _math_index_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),_input_index_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(45),_core_index_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(2),_entity_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(47),_system_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(18),_registry_js__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(58),_counters_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(15),_scene_js__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(48),_debugger_js__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(36),_settings_project_settings_js__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(13),_rendering_render_target_pool_js__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(50),_rendering_batching_batching_analytics_js__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(37);const unityAttenuationTextureBase64="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABAAAAAABCAYAAABADtw1AAAA+ElEQVRYCc1RSRLDIAxr///jbqlVqhkNJW4IZtEh8oYsyHUz3L64GxCCgYeBjJh4GhArIyZehjxGDUA9Rb9feNGq5ozBAOaUP0WpM1fmGa1dDJqX4nzGy7VXir0aey3sndWexrgzcqAl9s7X9PJZ5IB6O5KXZmpqEbN7GqgD+Z1SNX3P9v7pRvSPaKRb+HfkTI1e7eyI+TM7cIbw/jVn9rjlLDUjNKAVpRPti3o9PKr2CH3ui35r6no8Y6f6mb1fvTBe0RO9gWf6i9i9igbfNMIPtXr8n2h/9NpLt8cb0DO5p/eRO7gLPOJOM/etsps+Rr8395Y4yssbZyWMID2grNAAAAAASUVORK5CYII=",unitySpotTextureBase64="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACABAMAAAAxEHz4AAAAA3NCSVQICAjb4U/gAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAEHRSTlMAESIzRFVmd4iZqrvM3e7/dpUBFQAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAO9SURBVGiB3VnredpAEEQdGHdg0wGiA4tUgKggiFSASAMB3EAQFQTRgeUO7HRg3IHtDkxm9+70AFk6sfoSf9k/2D9mNDO7iHt0Op+6nC7XhQh9LkcBfgYFY67T4n+bPp6APRfVNxTWIhwFJ7DrefyhKCwZgL8k+MBL64YoriwZGN8juO/74yCY4IMo+pYMjIf0IYGDEBUQyQhWrBgUfuABPg3D+RK1CMMZKCDChkHhhz7gQEdcxDEL/JFisMKPA8CjaBNzbcGxCIOJBYOj8dMQ8DjeJVx3cQyKcKYZqkyg/z3C4/FxnCT3j1wPSQKK5YIY+tdVEmBA4VcR4ID+3qOe8AcoorViqDDBBjwf+E2MpzNa1RNUxFsw+F6VCTbgB8DvEoa/6mKK5A4MgV9hwlEGQuD58a+5YhFgCJWJcgkQ4Hrj6ZLwBv52OLwbCmJYziYwUS6BBSAA5Kfxh7Q0A5JEDB9JIAHD8Xxl8G+HXL0bhvViMiqXoAXAAPwXHp+KQA5k4gMJLCCYR7t7wr8d41nE/unhLloE5RJIwHi62sBAKV4xPCbb9WxCEk4dsAAY2D+f6jcuXvYwoSQce1AJrGI2UI4nBpiI1yqF0wjRAhLwMZ4ZSMJkdBIjHAyGLOC5PAATwwtLGN0ce+AI0YJqAVpCtDiJkSPEDNQI0BIwC8cxkgNEWCtAS6AYiwRw4CHCpE6AkpAgRq/ooXvpcoS1AlgCx+jmCXIOagSQhBIPqgccYR0eEijGoz7QFCkHtQJYAnsoElAEu0cbASSBPORDoAh0D+wIuA+5EJyuisDKgfLAIaQEKgKrHmgC9pCFoCOwdMAeiiGoCNBEKwGQoBt53S1kaBtBFoJJMcvQDg8PxRQdnaFtBOkk9K8u8k2wzjBN0bSBm4Axso2AQsAoZW1ommE+xVYIsi7a4tM2qD5yF783aYJqw0/TRxB4zZpg2uBpAtNF6wh4mLNBaI3Avgk8CBkBD+LtfVOCh19mFJlg05xgmxG4w2+N5khP0g89y0TQbBDNKB4T2OP1KKYEgy/nEXy9+X8IxCG20EbhIIlHWfhlEn+dP8EbSfxSlb/WhT8s//63sYWfd+kCQ7zEkS+ypMs88UKzhaWudLEtXu6LNxziLU8bmy7htk+88RRvfeWbb/H2X3wAIT4CkR/CiI+BxAdR8qMw8WGc/DhQfCApPhKVH8qKj4XlB9Pio3H54bz4ekB+QSG/IhFf0sivieQXVeKrMvllnfy6UH5hKb8y7YgvbY2IFm+eZZffZ6L/Vv0BqFspPs/Tph4AAAAASUVORK5CYII=",unityNHxRoughnessBase64="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAABACAMAAADCg1mMAAAAA3NCSVQICAjb4U/gAAABEVBMVEX+/v7v7+/S0tKysrKfn5+ampqHh4d5eXltbW1mZmZkZGRjY2NiYmJeXl5bW1taWlpZWVlTU1NPT09OTk5MTExJSUlISEhHR0dGRkZFRUVERERCQkJBQUE+Pj49PT07Ozs6Ojo5OTk4ODg3Nzc2NjY1NTU0NDQzMzMyMjIxMTEwMDAvLy8uLi4tLS0sLCwrKysqKiopKSkoKCgnJycmJiYlJSUkJCQjIyMiIiIhISEgICAfHx8eHh4dHR0cHBwbGxsaGhoZGRkYGBgXFxcWFhYVFRUUFBQTExMSEhIREREQEBAPDw8ODg4NDQ0MDAwLCwsKCgoJCQkICAgHBwcGBgYFBQUEBAQDAwMCAgIBAQEAAAAUqg0sAAAACXBIWXMAAAsSAAALEgHS3X78AAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAABDdJREFUeJzl1wlf2jAcxnF334fbnHNz3hvoB9SqxYJSDkUF5RKGW9//C1n+SZsmpWlTWq72eQe/L2laFgzD+Cfe3/HuYfpbMAxvgsgZpl3sGAHwN4hCYYJZA+lRABmDUApTzZQDGCfC7BT7AEgiBFaYcvUf4dwAxoIwyXJxrjyALIK8wnjbgzST9cm8AKI+CtHXB+8dmi9ApAiR5YdqDg4QoUL4/rDZPX7yALIKIQlGjg8QHQIgGoTRAIK3C5rv2Y0AIKkwIkHAfPnye5d1u91RAcIrBBOQrZcJ77ILBSDHENRAEsA/3jO82yGLAEBGIZiBDIB3vEd5h19UACEUpAgC5Iva2ew2XaQAEgqyBkEABPWu7XZ5u4UXPYA/w0gGYgDXfK/2lrUm2rgARlKQJ3DtF9cPtTfpxgrgp+BvIBLw6hfUO9rvzI0fwIfBz8BPwNnvyOfq+fZbvEkBBFQQGYgF+H5hPdvegE0UwFNB0mBIwA2A6WfqmXjc3qijTR7Ai8EDYZiAFxjqd82n9dBev0GbFoC0gpuBg4ARcOvn6ukvD/HXaFMFEDOIENwJHAIUgPv12d/erL9CmwEAPD8EkQEjwAGw/Uy+WX9N6mtoswKA56PgNHASsAIMgNnP5ZP6S7SZAsDzRHAYMAT0ENhHwD4AtB/O/o1dP5MAZBIIjAF3COgRoAfAuvys/Ksr3F6FzSoAnhCBM+AIOIF223oBkPd+45rM/PErsJkGwBMpOI8Bcwjwy9D+/Cfffbfk7qP9OF/XZx8Azx3BxYC8ES0BmPnlj7986vj8X+CVYcXinADgiREcBOZnMSfg6Cf1xfkCwHNB4AysU2D+K7KfAXwDwpu/BndfCe0cLT93AHhDCNSAvBjNP0j4kxB/CtIr0Hr6dV0/Q9O0+QSAuSLYxwBGzwA9AvbvD79+Pp/LzS8AnsBgMHARsAGs/lwudzznADAewTQw/yxZd6F5DZIrEF9/hcLp6cnJyWEMAPCcCObfBesmINcAuQPgAkCPP/Qryn5cAGDOg4BmPQjkKUDPAAXQNOjPZuMEAGMQGANMgAXgDoAbQNNUVVEymXTcAGD8l5J5FeCLAG4BuAMAAH7/vVQqjgAwDsEiIALVqq4XCqp6iPp3NuMKAGMMCAE8BugerFTQO0A9Osikf22uxRkAZr0dyBsBDgG6BsrlM01V9vd+b639iDuAQQ0wQacDAtXSeV5Vsrs766vLCQAwGANE0GwiAb2QO8qmt36ufEkGgDX0Vuz1Wq2bWqWoHWdTG6tLi8kCIASdZr1WPlMPUuvfP39IGgAQ9PutRq2UV3bXvy2+TR4A2qDXua3pambj68eXiQRAp+D+rnaubC+9e5FMAETQb15q6eU3z5MKgJ6D9sXR6qtnyQUwHjql7ddPEgxgGJ3c+8eJBjBaKwvJBjD0RwkHMJ4mHeBT0gGM/4ecz/SdIIT+AAAAAElFTkSuQmCC",_mouseMovementDelta=new _math_index_js__WEBPACK_IMPORTED_MODULE_0__.m;class Application{constructor(e,t){this.events=new _core_index_js__WEBPACK_IMPORTED_MODULE_2__.a(this),Application._currentApplication=this,this._time=0,this.timeScale=1,this.maxDeltaTime=.1,this.frame=0,this.autoRender=!0,this.renderNextFrame=!1,this._fillMode=_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.FILLMODE_KEEP_ASPECT,this._resolutionMode=_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.RESOLUTION_FIXED,this.minimumResolution=null,this.paused=!1,this.isUrp=!1,this.graphicsDevice=t.graphicsDevice,this.counters=_counters_js__WEBPACK_IMPORTED_MODULE_5__.a.instance,this.counters.webglExtensions=this.graphicsDevice.gl.getSupportedExtensions(),this._audioManager=t.audioManager,this._entityIndex={},this.scene=new _scene_js__WEBPACK_IMPORTED_MODULE_6__.a,this.root=new _entity_js__WEBPACK_IMPORTED_MODULE_3__.a(this),this.root._enabledInHierarchy=!0,this.keyboard=t.keyboard,this.mouse=new _input_index_js__WEBPACK_IMPORTED_MODULE_1__.a(e),this.touch="ontouchstart"in window?new _input_index_js__WEBPACK_IMPORTED_MODULE_1__.b(e):null,this._targetAspect=null,this.systems=new _registry_js__WEBPACK_IMPORTED_MODULE_11__.a,this._visibilityChangeHandler=this.onVisibilityChange.bind(this),document.addEventListener("visibilitychange",this._visibilityChangeHandler,!1),this.events.on("focus",this.onApplicationFocus,this),this.events.on("blur",this.onApplicationBlur,this),this.tick=this._tick.bind(this),this._renderTargetPool=new _rendering_render_target_pool_js__WEBPACK_IMPORTED_MODULE_9__.a(this.graphicsDevice),this.batchingAnalytics=_rendering_batching_batching_analytics_js__WEBPACK_IMPORTED_MODULE_10__.a.instance,this.focused=document.hasFocus(),this.onChangeEvent=new CustomEvent("focusChange",{detail:{isFocused:!1}})}isFocused(){return this.focused}onApplicationFocus(){this.onChangeEvent.detail.isFocused=!0,this.focused=!0,document.dispatchEvent(this.onChangeEvent)}onApplicationBlur(){this.onChangeEvent.detail.isFocused=!1,this.focused=!1,document.dispatchEvent(this.onChangeEvent)}get audioManager(){return this._audioManager}get targetAspect(){return this._targetAspect}set targetAspect(e){this._targetAspect=e,this.setCanvasFillMode(this._fillMode,window.innerWidth,window.innerHeight)}get renderTargetPool(){return this._renderTargetPool}start(){this.frame=0,this.tick(0)}_tick(e){if(!this.graphicsDevice)return;const t=_core_index_js__WEBPACK_IMPORTED_MODULE_2__.f.now();let s=(t-(this._time||t))/1e3;s=(0,_math_index_js__WEBPACK_IMPORTED_MODULE_0__.o)(s,0,this.maxDeltaTime),s*=this.timeScale,this._time=t,UnityEngine.Time.Update(s),window.requestAnimationFrame(this.tick),this.graphicsDevice.contextLost||this.paused||(this.counters.markFrameStart(),this.update(s),this.counters.startSection(_counters_js__WEBPACK_IMPORTED_MODULE_5__.a.RENDER),this.renderer&&(this.autoRender||this.renderNextFrame)&&(this.render(),this.renderNextFrame=!1),this.counters.endSection(_counters_js__WEBPACK_IMPORTED_MODULE_5__.a.RENDER),this.events.fire("frameend"),this.counters.recordMemoryUsage(),this.counters.markFrameEnd(),this.batchingAnalytics.markFrameEnd())}update(e){this.frame++,this.graphicsDevice.updateClientRect(),_system_js__WEBPACK_IMPORTED_MODULE_4__.a.update(e),this.events.fire("update",e),this.mouse&&this.mouse.update(),this.keyboard&&this.keyboard.update(),UnityEngine.Input.Update(),UnityEngine.SceneManagement.SceneManager.ProcessAsync(),this.renderTargetPool.freeUnusedRenderTargets()}render(){this.graphicsDevice.beginFrame(this.frame),this.events.fire("prerender"),this.scene.syncHierarchy(),this.renderer.renderComposition(),this.events.fire("postrender")}syncHierarchy(){this.scene.syncHierarchy()}setCanvasFillMode(e,t,s){this._fillMode=e;const i=this.resizeCanvas(t,s);this.graphicsDevice.resizeCanvas(i.width,i.height)}setCanvasResolution(e,t,s){this._resolutionMode=e,e===_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.RESOLUTION_AUTO&&void 0===t&&(t=this.graphicsDevice.canvas.clientWidth,s=this.graphicsDevice.canvas.clientHeight,0===t&&0===s&&(t=window.innerWidth,s=window.innerHeight)),this.graphicsDevice.resizeCanvas(t,s)}onVisibilityChange(){document.hidden?this._audioManager.suspend():this._audioManager.resume()}resizeCanvas(e,t){const s=window.innerWidth,i=window.innerHeight;if(this._fillMode===_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.FILLMODE_KEEP_ASPECT){const n=this._targetAspect||this.graphicsDevice.canvas.width/this.graphicsDevice.canvas.height;n>s/i?t=(e=s)/n:e=(t=i)*n,this.minimumResolution&&(e<this.minimumResolution.x||t<this.minimumResolution.y)&&(e=this.minimumResolution.x,t=this.minimumResolution.y)}else this._fillMode===_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.FILLMODE_FILL_WINDOW&&(e=s,t=i);return this.graphicsDevice.canvas.style.width=e+"px",this.graphicsDevice.canvas.style.height=t+"px",this._resolutionMode===_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.RESOLUTION_AUTO&&this.setCanvasResolution(_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.RESOLUTION_AUTO),{width:e,height:t}}mimicUnityMouse(){window.UnityEngine.Input.mousePosition=new _math_index_js__WEBPACK_IMPORTED_MODULE_0__.m(0,0,0),this.touch?(this.touch.events.on(_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.EVENT_TOUCHSTART,this._onTouchStart,this),this.touch.events.on(_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.EVENT_TOUCHEND,this._onTouchEnd,this),this.touch.events.on(_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.EVENT_TOUCHMOVE,this._onTouchMove,this),this.touch.events.on(_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.EVENT_TOUCHCANCEL,this._onTouchEnd,this),UnityEngine.Input.mousePresent=!1,UnityEngine.Input.touchSupported=!0):(this.mouse.events.on(_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.EVENT_MOUSEUP,this._onMouseUp,this),this.mouse.events.on(_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.EVENT_MOUSEDOWN,this._onMouseDown,this),this.mouse.events.on(_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.EVENT_MOUSEMOVE,this._onMouseMove,this),this.mouse.events.on(_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.EVENT_MOUSEWHEEL,this._onMouseScroll,this)),this.events.on("prerender",this._updateInputFlags,this),this.events.on("frameend",this._resetScroll,this),this.events.on("frameend",this._resetMouseAxis,this)}_updateInputFlags(){window.UnityEngine.Input.mouseButtonsUp[0]=!1,window.UnityEngine.Input.mouseButtonsUp[1]=!1,window.UnityEngine.Input.mouseButtonsUp[2]=!1,window.UnityEngine.Input.mouseButtonsDown[0]=!1,window.UnityEngine.Input.mouseButtonsDown[1]=!1,window.UnityEngine.Input.mouseButtonsDown[2]=!1,window.UnityEngine.Input.axes.Insert("Mouse ScrollWheel",0)}_resetScroll(){window.UnityEngine.Input.axes.Insert("Mouse ScrollWheel",0),window.UnityEngine.Input.mouseScrollDelta=new _math_index_js__WEBPACK_IMPORTED_MODULE_0__.l(0,0)}_resetMouseAxis(){window.UnityEngine.Input.axes.Insert("Mouse X",0),window.UnityEngine.Input.axes.Insert("Mouse Y",0)}_onMouseUp(e){const t={x:e.x,y:this.graphicsDevice._height-e.y,z:0};window.UnityEngine.Input.mouseButtonsUp[e.button]=!0,window.UnityEngine.Input.mouseButtons[e.button]=!1,window.UnityEngine.Input.mouseButtonsDown[e.button]=!1,window.UnityEngine.Input.mousePosition=new _math_index_js__WEBPACK_IMPORTED_MODULE_0__.m(t.x,t.y,t.z)}_onMouseMove(e){const t={x:e.x,y:this.graphicsDevice._height-e.y,z:0};_mouseMovementDelta.set(t.x-window.UnityEngine.Input.mousePosition.x,t.y-window.UnityEngine.Input.mousePosition.y,t.z),window.UnityEngine.Input.axes.Insert("Mouse X",.1*_mouseMovementDelta.x),window.UnityEngine.Input.axes.Insert("Mouse Y",.1*_mouseMovementDelta.y),window.UnityEngine.Input.mousePosition=new _math_index_js__WEBPACK_IMPORTED_MODULE_0__.m(t.x,t.y,t.z)}_onMouseScroll(e){window.UnityEngine.Input.axes.Insert("Mouse ScrollWheel",.1*e.wheel),window.UnityEngine.Input.mouseScrollDelta=new _math_index_js__WEBPACK_IMPORTED_MODULE_0__.l(0,e.wheel)}_onMouseDown(e){window.UnityEngine.Input.mouseButtonsDown[e.button]=!0,window.UnityEngine.Input.mouseButtons[e.button]=!0,window.UnityEngine.Input.mouseButtonsUp[e.button]=!1;const t={x:e.x,y:this.graphicsDevice._height-e.y,z:0};window.UnityEngine.Input.mousePosition=new _math_index_js__WEBPACK_IMPORTED_MODULE_0__.m(t.x,t.y,t.z)}_onTouchStart(e){const t={x:e.changedTouches[0].x,y:e.changedTouches[0].y,button:0};for(let t=0;t<e.changedTouches.length;t++){const s=e.changedTouches[t];UnityEngine.Input.OnTouchStart(s.id,s.x,this.graphicsDevice._height-s.y)}return this._onMouseDown(t),!0}_onTouchEnd(e){const t={x:e.changedTouches[0].x,y:e.changedTouches[0].y,button:0};for(let t=0;t<e.changedTouches.length;t++){const s=e.changedTouches[t];UnityEngine.Input.OnTouchEnd(s.id,s.x,this.graphicsDevice._height-s.y)}return this._onMouseUp(t),!0}_onTouchMove(e){const t={x:e.changedTouches[0].x,y:e.changedTouches[0].y,button:0};for(let t=0;t<e.changedTouches.length;t++){const s=e.changedTouches[t];UnityEngine.Input.OnTouchMoved(s.id,s.x,this.graphicsDevice._height-s.y)}return this._onMouseMove(t),!0}getRootObjects(){return this.root.children}getMainCamera(){let e=null;for(let t=0;t<this.systems.camera.cameras.length;t++){const s=this.systems.camera.cameras[t];if("MainCamera"===s.entity.tag)return s;s.renderTarget||e||(e=s)}return e}initializeBuiltInTextures(){const e=[["white",[255,255,255,255]],["red",[255,0,0,0]],["gray",[128,128,128,128]],["bump",[127,127,255,127]],["black",[0,0,0,0]]];let t=null,s=null;for(let i=0;i<e.length;i++){const n=e[i][0],r=e[i][1],a=new pc.Texture(this.graphicsDevice,{width:4,height:4,format:_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.PIXELFORMAT_R8_G8_B8_A8,premultiplyAlpha:!1,name:n}),o=a.lock();for(let e=0;e<16;e++)o[4*e+0]=r[0],o[4*e+1]=r[1],o[4*e+2]=r[2],o[4*e+3]=r[3];a.unlock(),UnityEngine.Texture2D[n+"Texture"]=UnityEngine.Object.FromHandle(UnityEngine.Texture2D,a),"black"===n&&(t=o),"gray"===n&&(s=o)}UnityEngine.Texture2D.greyTexture=UnityEngine.Texture2D.grayTexture;const i=new pc.Texture(this.graphicsDevice,{width:4,height:4,format:_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.PIXELFORMAT_R8_G8_B8_A8,cubemap:!0,premultiplyAlpha:!1,name:"BlackCube"});i._levels=[[t,t,t,t,t]],i.upload(),UnityEngine.Cubemap.blackCube=UnityEngine.Object.FromHandle(UnityEngine.Cubemap,i);const n=new pc.Texture(this.graphicsDevice,{width:4,height:4,format:_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.PIXELFORMAT_R8_G8_B8_A8,cubemap:!0,premultiplyAlpha:!1,name:"UnityDefault3D"});n._levels=[[s,s,s,s,s]],n.upload(),UnityEngine.Cubemap.defaultCube=UnityEngine.Object.FromHandle(UnityEngine.Cubemap,n);const r=new pc.Texture(this.graphicsDevice,{width:1024,height:1,addressU:_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.ADDRESS_CLAMP_TO_EDGE,addressV:_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.ADDRESS_CLAMP_TO_EDGE,format:_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.PIXELFORMAT_R8_G8_B8_A8,premultiplyAlpha:!1,name:"UnityAttenuationTexture"});let a=document.createElement("IMG");a.src=unityAttenuationTextureBase64,r.setSource(a),UnityEngine.Texture2D.attenuationTexture=UnityEngine.Object.FromHandle(UnityEngine.Texture2D,r);const o=new pc.Texture(this.graphicsDevice,{width:128,height:128,addressU:_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.ADDRESS_CLAMP_TO_EDGE,addressV:_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.ADDRESS_CLAMP_TO_EDGE,format:_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.PIXELFORMAT_R8_G8_B8_A8,premultiplyAlpha:!1,name:"UnitySpotTexture"});a=document.createElement("IMG"),a.src=unitySpotTextureBase64,o.setSource(a),UnityEngine.Texture2D.spotTexture=UnityEngine.Object.FromHandle(UnityEngine.Texture2D,o);const h=new pc.Texture(this.graphicsDevice,{width:256,height:64,addressU:_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.ADDRESS_CLAMP_TO_EDGE,addressV:_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.ADDRESS_CLAMP_TO_EDGE,format:_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.PIXELFORMAT_R8_G8_B8_A8,premultiplyAlpha:!1,name:"unityNHxRoughnessTexture"});a=document.createElement("IMG"),a.src=unityNHxRoughnessBase64,h.setSource(a),UnityEngine.Texture2D.nhxRoughnessTexture=UnityEngine.Object.FromHandle(UnityEngine.Texture2D,h),_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.UniformDefaultValues[_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.UNIFORMTYPE_TEXTURE2D]=UnityEngine.Texture2D.blackTexture.handle,_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.UniformDefaultValues[_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.UNIFORMTYPE_TEXTURECUBE]=UnityEngine.Cubemap.defaultCube.handle,_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.UniformDefaultValues[_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.UNIFORMTYPE_TEXTURE2D_SHADOW]=UnityEngine.Texture2D.blackTexture.handle,_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.UniformDefaultValues[_core_index_js__WEBPACK_IMPORTED_MODULE_2__.c.UNIFORMTYPE_TEXTURECUBE_SHADOW]=UnityEngine.Cubemap.defaultCube.handle}installPlayroundOverrides(){const overrides=window.playgroundOverrides||{};for(const className in overrides){if(!overrides.hasOwnProperty(className))continue;const classNameString=JSON.stringify(className),backupClassNameString=JSON.stringify("_"+className);let code="Deserializers[ "+backupClassNameString+" ] = Deserializers[ "+classNameString+"];\n";code+="Deserializers[ "+classNameString+" ] = function () {\n",code+=" var result = Deserializers[ "+backupClassNameString+" ].apply( this, arguments );\n";const fields=overrides[className],formatValue=e=>{switch(e[0]){case"float":case"int":case"string":return JSON.stringify(e[1]);case"boolean":return JSON.stringify(!!e[1]);case"color":return"new pc.Color("+e.slice(1,5).join(",")+")";case"vector2":return"new pc.Vec2("+e.slice(1,3).join(",")+")";case"vector3":return"new pc.Vec3("+e.slice(1,4).join(",")+")";case"vector4":return"new pc.Vec4("+e.slice(1,5).join(",")+")";case"enum":return JSON.stringify(parseInt(e[1],10));case"float[]":case"int[]":case"string[]":case"boolean[]":case"color[]":case"vector2[]":case"vector3[]":case"vector4[]":case"enum[]":{const t=e[0].replace("[]",""),s=e.slice(1),i={float:"System.Single",int:"System.Int32",string:"System.String",boolean:"System.Boolean",color:"pc.Color",vector2:"pc.Vec2",vector3:"pc.Vec3",vector4:"pc.Vec4",enum:"System.Int32"};if(void 0===i[t])return void _debugger_js__WEBPACK_IMPORTED_MODULE_7__.a.Console.error(`Unsupported field type: ${e[0]}`);const n=e=>formatValue([t].concat(e));return"System.Array.init(["+s.map(n).join(",")+"], "+i[t]+")"}default:return void _debugger_js__WEBPACK_IMPORTED_MODULE_7__.a.Console.error(`Unsupported field type: ${e[0]}`)}};for(const e in fields){if(!fields.hasOwnProperty(e))continue;const t=fields[e],s=formatValue(t);void 0!==s&&(code+=" result."+e+" = "+formatValue(t)+"; \n")}code+=" return result;\n",code+="}",eval("(function() { "+code+"})()")}}muteAudio(){this.audioManager.masterVolume=0}unmuteAudio(){this.audioManager.masterVolume=1}pause(){_core_index_js__WEBPACK_IMPORTED_MODULE_2__.f.pause(),this.paused=!0,this.audioManager.suspend()}resume(){this.paused&&(_core_index_js__WEBPACK_IMPORTED_MODULE_2__.f.resume(),this.paused=!1,this.audioManager.resume())}tickUrpRenderer(){this.isUrp=!0}initializeRenderer(){const e={enableRealtimeShadows:_settings_project_settings_js__WEBPACK_IMPORTED_MODULE_8__.c.instance.enableRealtimeShadows};this.renderer=this.isUrp?new pc.ForwardRendererUrp(this.graphicsDevice,this.scene,e):new pc.ForwardRenderer(this.graphicsDevice,this.scene,e)}}Application._currentApplication=null,Application.getApplication=()=>Application._currentApplication},(e,t,s)=>{"use strict";s.d(t,{a:()=>n});var i=s(2);class n{constructor(e){this.app=e,this.store={},this.ComponentType=null,this.id="",this.creatingPrefabs=!1,this.events=new i.a(this)}addComponent(e,t){const s=new this.ComponentType(this,e);return t=t||{},this.store[e.getGuid()]={entity:e,data:s.data},e.c[this.id]=s,this.initializeComponentData(s,t),s}removeComponent(e,t=null){const s=this.store[e.getGuid()],i=e.c[this.id];this.events.fire("beforeremove",e,i),delete this.store[e.getGuid()],delete e.c[this.id],this.events.fire("remove",e,s.data)}initializeComponentData(e,t){e.enabled&&e.entity.enabled&&e.onEnable()}destroy(){this.events.off()}}n.events=new i.a(null),n.update=e=>{n.events.fire("update",e)},n.destroy=()=>{n.events.off("update")}},(e,t,s)=>{"use strict";s.d(t,{a:()=>r});let i=0;const n={};class r{constructor(){this._enabled=!0,this._destroyed=!1,this.$id=0,this._id=null,this._entity=null,this._system=null,this._code=null,this.internalExecutionOrder=0,this.scriptsExecutionOrder=0,this._scriptsExecutionOrder=0,this._sortingOrderInQueue=i++,this._activatedCallbacks={onAwake:!1,onEnable:!1,onStart:!1,onDisable:!0,onDestroy:!1}}get code(){return this._code}set code(e){this._code=e}get sortingOrderInQueue(){return this.$id}get enabled(){return this._enabled}set enabled(e){const t=this._enabled&&this._entity&&this._entity.enabled,s=e&&this._entity&&this._entity.enabled;this._enabled=e,t===s||this._system.app.systems.unitymanager.callbacksDisabled||(s?this.onEnable():this.onDisable())}get entity(){return this._entity}get system(){return this._system}set system(e){this._system=e}configureForEntity(e){}onInit(){return!this._destroyed&&!this._activatedCallbacks.onAwake&&(this._activatedCallbacks.onAwake=!0,this._activatedCallbacks.onDestroy=!1,this.onAwake(),!0)}onAwake(){}onAttached(){}onEnable(){return!this._destroyed&&!this._activatedCallbacks.onEnable&&(this._activatedCallbacks.onEnable=!0,this._activatedCallbacks.onDisable=!1,this._system._onComponentEnabled(this),this._activatedCallbacks.onStart||this._system._componentShouldStart(this),!0)}onStart(){}onUpdate(e){}onFixedUpdate(e){}onPostUpdate(e){}onBeforeRender(e){}onAfterRender(e){}onApplicationFocus(e){}onDisable(){return!this._destroyed&&!this._activatedCallbacks.onDisable&&(this._activatedCallbacks.onDisable=!0,this._activatedCallbacks.onEnable=!1,this._system._onComponentDisabled(this),!0)}onDestroy(){return!this._destroyed&&!this._activatedCallbacks.onDestroy&&(this._activatedCallbacks.onDestroy=!0,!0)}rememberCallback(e){e in this._activatedCallbacks&&(this._activatedCallbacks[e]=!0)}callbackActivated(e){return this._activatedCallbacks[e]}_onEntityStateChanged(e){this._system.app.systems.unitymanager.callbacksDisabled||(e?this.onEnable():this.onDisable())}_queuesToSubscribe(){return[]}destroy(){this._system&&this._entity&&this._system.removeComponent(this._entity,this),this._destroyed=!0}toUnityObject(){return this.unityClass?UnityEngine.Object.FromHandle(this.unityClass,this):null}}r.prototype.unityClass=null,r.addRequiredComponents=(e,t,s)=>{if(!t)return;const i=Bridge.getTypeName(t),a=Deserializers.typeNameToIdMap[i];if(void 0===a)return;let o;n.hasOwnProperty(a)?o=n[a]:(o=[],o.push(a),r.getAllRequiredComponents(a,o),n[a]=o);const h=UnityEngine.Object.FromHandle(UnityEngine.GameObject,e);for(let e=1;e<o.length;e++){const t=o[e],i=Bridge._getTypeByName(Deserializers.types[t]);if(!h.GetComponent(i)){const e=h.AddComponent(i);s.push(e.handle)}}},r.getAllRequiredComponents=(e,t)=>{const s=Deserializers.requiredComponents[e];if(s&&0!==s.length)for(let e=0;e<s.length;e++){const i=s[e];t.indexOf(i)>=0||(t.push(i),r.getAllRequiredComponents(i,t))}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>n});var i=s(2);class n{constructor(e){this.func=void 0===e.func?i.c.FUNC_ALWAYS:e.func,this.ref=e.ref||0,this.readMask=void 0===e.readMask?255:e.readMask,this.writeMask=void 0===e.writeMask?255:e.writeMask,this.fail=e.fail||i.c.STENCILOP_KEEP,this.zfail=e.zfail||i.c.STENCILOP_KEEP,this.zpass=e.zpass||i.c.STENCILOP_KEEP}clone(){return new n({func:this.func,ref:this.ref,readMask:this.readMask,writeMask:this.writeMask,fail:this.fail,zfail:this.zfail,zpass:this.zpass})}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>r});var i=s(4);const n=1e-5;class r{constructor(e,t,s,i){this.r=e||0,this.g=t||0,this.b=s||0,this.a=void 0!==i?i:void 0!==e&&void 0!==e&&void 0!==e?1:0,this._data=null,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"Color")}get data(){return this._data||(this._data=new Float32Array(4)),this._data[0]=this.r,this._data[1]=this.g,this._data[2]=this.b,this._data[3]=this.a,this._data}set rgba(e){this.r=(e>>24)/255,this.g=(e<<8>>24)/255,this.b=(e<<16>>24)/255,this.a=(e<<24>>24)/255}clone(){return new r(this.r,this.g,this.b,this.a)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}set(e,t,s,i=1){return this.r=e,this.g=t,this.b=s,this.a=i,this}setFromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this.a=e[t+3],this}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return this.fromString(e)}fromString(e){const t=parseInt(e.replace("#","0x"),16);let s;return e.length>7?s=(0,i.e)(t):(s=(0,i.d)(t),s[3]=255),this.set(s[0]/255,s[1]/255,s[2]/255,s[3]/255),this}toString(e=!1){let t="#"+((1<<24)+(Math.round(255*this.r)<<16)+(Math.round(255*this.g)<<8)+Math.round(255*this.b)).toString(16).slice(1);if(e){const e=Math.round(255*this.a).toString(16);this.a<16/255?t+="0"+e:t+=e}return t}getitem(e){switch(e){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:return NaN}}setitem(e,t){switch(e){case 0:this.r=t;break;case 1:this.g=t;break;case 2:this.b=t;break;case 3:this.a=t}}premultiply(){return this.r*=this.a,this.g*=this.a,this.b*=this.a,this}add(e,t,s,i){return this.r+=e,this.g+=t,this.b+=s,this.a+=i,this.clamp()}mul(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this.a*=e.a,this}mul2(e,t){return this.r=e.r*t.r,this.g=e.g*t.g,this.b=e.b*t.b,this.a=e.a*t.a,this}scale(e){return this.r*=e,this.g*=e,this.b*=e,this.a*=e,this}clamp(){return this.r=Math.max(0,Math.min(this.r,1)),this.g=Math.max(0,Math.min(this.g,1)),this.b=Math.max(0,Math.min(this.b,1)),this.a=Math.max(0,Math.min(this.a,1)),this}toLinear(){return this.r=r.gammaToLinear(this.r),this.g=r.gammaToLinear(this.g),this.b=r.gammaToLinear(this.b),this}equals(e){return Math.abs(this.r-e.r)<n&&Math.abs(this.g-e.g)<n&&Math.abs(this.b-e.b)<n&&Math.abs(this.a-e.a)<n}getHashCode(){return this.r^this.g^this.b^this.a}hash(){return this.getHashCode()}strictEquals(e){return e instanceof r&&this.equals(e)}lerpTo(e,t){this.r=e.r*t+this.r*(1-t),this.g=e.g*t+this.g*(1-t),this.b=e.b*t+this.b*(1-t),this.a=e.a*t+this.a*(1-t)}grayscale(){return.29899999499321*this.r+.587000012397766*this.g+.114*this.b}linear(){return new r(UnityEngine.Mathf.GammaToLinearSpace(this.r),UnityEngine.Mathf.GammaToLinearSpace(this.g),UnityEngine.Mathf.GammaToLinearSpace(this.b),this.a)}gamma(){return new r(UnityEngine.Mathf.LinearToGammaSpace(this.r),UnityEngine.Mathf.LinearToGammaSpace(this.g),UnityEngine.Mathf.LinearToGammaSpace(this.b),this.a)}maxColorComponent(){return Math.max(Math.max(this.r,this.g),this.b)}$getType(){return r}$clone(e=new r){return e.copy(this),e}}r.ctor=r,r.$kind="struct",r.gammaToLinear=e=>e<=.04045?e/12.92:e<1?Math.pow((e+.055)/1.055,2.4):Math.pow(e,2.2),r.hsvToRGB=(e,t,s,n)=>{let a=0,o=0,h=0;const l=Math.floor(6*e),c=6*e-l;switch(l%6){case 0:a=s,o=s*(1-(1-c)*t),h=s*(1-t);break;case 1:a=s*(1-c*t),o=s,h=s*(1-t);break;case 2:a=s*(1-t),o=s,h=s*(1-(1-c)*t);break;case 3:a=s*(1-t),o=s*(1-c*t),h=s;break;case 4:a=s*(1-(1-c)*t),o=s*(1-t),h=s;break;case 5:a=s,o=s*(1-t),h=s*(1-c*t)}return n||(a=(0,i.c)(a,0,1),o=(0,i.c)(o,0,1),h=(0,i.c)(h,0,1)),new r(a,o,h,1)},r.rgbToHSV=(e,t,s,i)=>{e.b>e.g&&e.b>e.r?r.rgbToHSVHelper(4,e.b,e.r,e.g,t,s,i):e.g>e.r?r.rgbToHSVHelper(2,e.g,e.b,e.r,t,s,i):r.rgbToHSVHelper(0,e.r,e.g,e.b,t,s,i)},r.rgbToHSVHelper=(e,t,s,i,n,r,a)=>{if(a.v=t,0!==a.v){const t=s<=i?s:i,o=a.v-t;if(0!==o?(r.v=o/a.v,n.v=e+(s-i)/o):(r.v=0,n.v=e+(s-i)),n.v/=6,n.v>=0)return;++n.v}else r.v=0,n.v=0},r.lerp=(e,t,s)=>r.lerpUnclamped(e,t,(0,i.c)(s,0,1)),r.lerpUnclamped=(e,t,s)=>new r(UnityEngine.Mathf.LerpUnclamped(e.r,t.r,s),UnityEngine.Mathf.LerpUnclamped(e.g,t.g,s),UnityEngine.Mathf.LerpUnclamped(e.b,t.b,s),UnityEngine.Mathf.LerpUnclamped(e.a,t.a,s)),r.equals=(e,t)=>null===e&&null===t||null!==e&&null!==t&&e.equals(t),r.getDefaultValue=()=>new r,r.rgba8888ToColor=(e,t)=>{e.r=((4278190080&t)>>>24)/255,e.g=((16711680&t)>>>16)/255,e.b=((65280&t)>>>8)/255,e.a=(255&t)/255},r.rgb888ToColor=(e,t)=>{e.r=((16711680&t)>>>16)/255,e.g=((65280&t)>>>8)/255,e.b=(255&t)/255},r.fromString=e=>(new r).fromString(e)},(e,t,s)=>{"use strict";s.d(t,{a:()=>l,b:()=>h});var i=s(2);const n=3,r=1e-5,a={x:0,y:1,z:2,w:3},o={r:0,g:1,b:2,a:3};class h{constructor(e=null,t=null,s=null,i=null,r=0,a=0,o=0){this.time=e,this.value=t,this.inTangent=s,this.outTangent=i,this.tangentMode=0,this.leftConstant=a===n||7===r||71===r||103===r,this.rightConstant=o===n||97===r||101===r||103===r,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"Keyframe")}}class l{constructor(e){this.id=(0,i.b)(),this.path=e.path,this.componentType=e.componentType,this.property=e.property,this.targetsLocalEulerAnglesRaw=!1,this.targetObject=null,this.targetProperty=null,this.isVectorProperty=!1,this.vectorPropertyIndex=-1,this.isMaterialPropertyCurve=!1,this.objectCurve=!1,this.preWrapMode=UnityEngine.WrapMode.Default,this.postWrapMode=UnityEngine.WrapMode.Default,this.keys=[];const t=this.property?this.property.split("."):[];if(this.property&&t.length>1?(this.targetObject=t[0],this.targetProperty=t[1],"localEulerAnglesRaw"===this.targetObject?this.targetsLocalEulerAnglesRaw=!0:"blendShape"===this.targetObject&&(this.targetProperty=this.property.substring(11,this.property.length))):(this.targetProperty=this.property,this.targetObject=null),this.keyId=this.path+":"+this.componentType+"."+this.property,this.componentType){this.isMaterialPropertyCurve=this.componentType.indexOf("Renderer")>=0&&"material"===this.targetObject;const e=this.property.split(".");if(this.isVectorProperty=e.length>2,this.isVectorProperty){const t=e[e.length-1],s=o.hasOwnProperty(t)?o:a;this.vectorPropertyIndex=s[t]}else this.vectorPropertyIndex=-1}if(e.keyframes)this.keys=e.keyframes;else if(e.keys_flow){const t=e.keys_flow;this.keys=[];for(let e=0;e<t.length;e+=7)this.keys.push(new h(t[e],t[e+1],t[e+2],t[e+3],t[e+4],t[e+5],t[e+6]))}else{if(this.keys=[],e.keys)for(let t=0;t<e.keys.length;t++){const s=e.keys[t];this.keys.push(new h(s[0],s[1],s[2],s[3],s[4],s[5],s[6]))}if(e.objectReferenceKeys)for(let t=0;t<e.objectReferenceKeys.length;t++){const s=e.objectReferenceKeys[t];this.keys.push(new h(s[0],s[1],s[2],s[3],s[4],s[5],s[6]))}this.objectCurve=!!e.objectReferenceKeys}TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"AnimationCurve")}setValue(e,t){0!==this.keys.length&&(e>=this.keys.length?this.keys[this.keys.length-1].value=t:this.keys[e].value=t)}getValue(e){return 0===this.keys.length?-1:e>=this.keys.length?this.keys[this.keys.length-1].value:this.keys[e].value}addKey(e,t){const s=new h(e,t);return this.addKeyFrame(s)}addKeyFrame(e){if(!e||Number.isNaN(e.time)||Number.isNaN(e.value))return-1;const t=this.keys.length;if(0===t||e.time>this.keys[t-1].time)return this.keys.push(e),t;if(e.time<this.keys[0].time)return this.keys.splice(0,0,e),0;for(let s=0;s<t;s++){if(Math.abs(this.keys[s].time-e.time)<Number.EPSILON)return this.keys[s]=e,s;if(this.keys[s].time>e.time)return this.keys.splice(s,0,e),s}return this.keys.push(e),t}findKeyIndexAt(e){if(e<=this.keys[0].time)return 0;const t=this.keys.length;if(e>=this.keys[t-1].time)return t-2;e+=r;let s=0,i=t;for(;s!==i;){const t=Math.floor((s+i)/2);this.keys[t].time<e?s=t+1:i=t}return s-1}sample(e,t){const s=e.getOrCreateKey(this,this.keyId);s.set(this.value(t,s))}value(e,t=null){if(0===this.keys.length)return 0;if(1===this.keys.length)return this.keys[0].value;if(this.keys[this.keys.length-1].time-e<=r)return this.keys[this.keys.length-1].value;let s=t?t.idx:-1;2===this.keys.length?s=0:(-1!==s&&(this.keys[s].time>e||this.keys[s+1].time<e)&&(s=-1),-1===s&&(s=this.findKeyIndexAt(e))),t&&(t.idx=s);const i=this.keys[s],n=this.keys[s+1];if(n.time<=e+r)return n.value;if(null===i.outTangent||null===n.inTangent||i.time>e)return i.value;if(i.rightConstant||n.leftConstant||i.outTangent===1/0||n.inTangent===1/0)return i.value;const a=n.time-i.time,o=(e-i.time)/a;if(this.objectCurve)return o<n.value?i.value:n.value;const h=i.outTangent*a,l=n.inTangent*a,c=o*o,d=c*o,u=d-2*c+o,_=d-c,m=-2*d+3*c;return(2*d-3*c+1)*i.value+u*h+_*l+m*n.value}clone(){return new l({keyframes:[...this.keys],path:this.path,componentType:this.componentType,property:this.property})}_keysAt(e){if(1===this.keys.length)return this.keys;if(e>=this.keys[this.keys.length-1].time)return[this.keys[this.keys.length-1]];if(e<=this.keys[0].time)return[this.keys[0]];for(let t=0;t<this.keys.length;t++)if(this.keys[t].time>e)return[this.keys[t-1],this.keys[t]];return null}}l.createLinear=function(e,t,s,i){return new l({keys:[[e,t,0,0],[s,i,0,0]]})},l.createEaseInOut=function(e,t,s,i){return new l(e===s?{keys:[[e,t,0,0]]}:{keys:[[e,t,0,0],[s,i,0,0]]})}},(e,t,s)=>{"use strict";s.d(t,{a:()=>n});var i=s(2);class n{constructor(e){if(this._colorBuffer=e.colorBuffer,this._glFrameBuffer=null,this._glDepthBuffer=null,this._depthBuffer=e.depthBuffer,this._face=void 0!==e.face?e.face:0,this._depthBuffer){const e=this._depthBuffer._format;e===i.c.PIXELFORMAT_DEPTH?(this._depth=!0,this._stencil=!1):e===i.c.PIXELFORMAT_DEPTHSTENCIL?(this._depth=!0,this._stencil=!0):(UnityEngine.Debug.LogWarning$1("Incorrect depthBuffer format. Must be PIXELFORMAT_DEPTH or PIXELFORMAT_DEPTHSTENCIL"),this._depth=!1,this._stencil=!1)}else this._depth=void 0===e.depth||e.depth,this._stencil=void 0!==e.stencil&&e.stencil;this._samples=void 0!==e.samples?e.samples:1,this.autoResolve=void 0===e.autoResolve||e.autoResolve,this._glResolveFrameBuffer=null,this._glMsaaColorBuffer=null,this._glMsaaDepthBuffer=null,this._device=null}destroy(){if(!this._device)return;const e=this._device,t=e.targets.indexOf(this);-1!==t&&e.targets.splice(t,1);const s=e.gl;this._glFrameBuffer&&(s.deleteFramebuffer(this._glFrameBuffer),this._glFrameBuffer=null),this._glDepthBuffer&&(s.deleteRenderbuffer(this._glDepthBuffer),this._glDepthBuffer=null),this._glResolveFrameBuffer&&(s.deleteFramebuffer(this._glResolveFrameBuffer),this._glResolveFrameBuffer=null),this._glMsaaColorBuffer&&(s.deleteRenderbuffer(this._glMsaaColorBuffer),this._glMsaaColorBuffer=null),this._glMsaaDepthBuffer&&(s.deleteRenderbuffer(this._glMsaaDepthBuffer),this._glMsaaDepthBuffer=null)}resolve(e=!0,t=!!this._depthBuffer){if(!this._device)return;if(!this._device.webgl2)return;const s=this._device.gl;s.bindFramebuffer(i.c.READ_FRAMEBUFFER,this._glFrameBuffer),s.bindFramebuffer(i.c.DRAW_FRAMEBUFFER,this._glResolveFrameBuffer),s.blitFramebuffer(0,0,this.width,this.height,0,0,this.width,this.height,(e?s.COLOR_BUFFER_BIT:0)|(t?s.DEPTH_BUFFER_BIT:0),s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,this._glFrameBuffer)}get colorBuffer(){return this._colorBuffer}get depthBuffer(){return this._depthBuffer}get face(){return this._face}get width(){return this._colorBuffer?this._colorBuffer.width:this._depthBuffer.width}get height(){return this._colorBuffer?this._colorBuffer.height:this._depthBuffer.height}static getTempBuffer(e,t,s=null,i=null){return pc.Application.getApplication().renderTargetPool.getTempRenderTarget(e,t,s,i)}static releaseTempBuffer(e){pc.Application.getApplication().renderTargetPool.releaseTempRenderTarget(e)}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>a,b:()=>o});var i=s(2),n=s(18),r=s(59);const a=["rigidbody","collider","joint","rigidbody2D","collider2D","joint2D","uiBehaviour","monoBehaviour","animator","animation","particlesystem","particleSystemRenderer","reflectionprobe","videoPlayer","canvasRenderer","audiosourceunity","renderer","meshFilter","effector2D","sortingGroup","skybox"];class o extends n.a{constructor(e){super(e),this.id="unity",this._components={},this.performanceSamplerSection=null,this.app.systems.unitymanager.registerSystem(this),this.queues={onStart:new r.a,onFixedUpdate:new r.a,onUpdate:new r.a,onPostUpdate:new r.a,onBeforeRender:new r.a,onAfterRender:new r.a,onApplicationFocus:new r.a}}addComponent(e,t){if(t._id)throw new Error("Component already belongs somewhere!");return t._id=(0,i.b)(),t._entity=e,t.system=this,t.scriptsExecutionOrder=0,e._unityComponents[this.id].push(t),this._components[t._id]=t,t.onAttached(),e.enabled&&t.enabled&&t._onEntityStateChanged(!0),t}removeComponent(e,t){this._onComponentDisabled(t),delete this._components[t._id];const s=e._unityComponents[t._system.id],i=s.indexOf(t);i<0||(s[i]=s[s.length-1],s.length-=1)}onStart(e){this._invokeQueue("onStart",(e=>e.onStart()),!0)}onBeforeUpdates(e){}onFixedUpdate(e){this._invokeQueue("onFixedUpdate",(t=>t.onFixedUpdate(e)))}onUpdate(e){this._invokeQueue("onUpdate",(t=>t.onUpdate(e)))}onPostUpdate(e){this._invokeQueue("onPostUpdate",(t=>t.onPostUpdate(e)))}onBeforeRender(e){this._invokeQueue("onBeforeRender",(t=>t.onBeforeRender(e)))}onAfterRender(e){this._invokeQueue("onAfterRender",(t=>t.onAfterRender(e)))}onApplicationFocus(e){this._invokeQueue("onApplicationFocus",(t=>t.onApplicationFocus(e)))}_invokeQueue(e,t,s=!1){const i=this.queues[e];if(0===i.length)return;const n=i.processing,r=i.getComponents();n||(i.processing=!0),s&&i.clear();for(let s=0;s<r.length;s++){const i=r[s];i.entity._enabledInHierarchy&&!i.callbackActivated(e)&&(i.rememberCallback(e),t(i))}s&&this.queues[e].length>0&&this._invokeQueue(e,t,s),n||(this.queues[e].processing=!1)}_onComponentEnabled(e){const t=e._queuesToSubscribe();for(let s=0;s<t.length;s++)this.queues[t[s]].push(e)}_componentShouldStart(e){this.queues.onStart.push(e)}_onComponentDisabled(e){const t=e._queuesToSubscribe();for(let s=0;s<t.length;s++)this.queues[t[s]].delete(e._id);this.queues.onStart.delete(e._id)}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>h});var i=s(0),n=s(2),r=s(51),a=s(8),o=s(31);class h{constructor(){this.meshInstances=[],this.morphInstance=null,this._materials=[],this._mesh=null,this._meshVersion=0,this._skin=null,this._bones=null,this._sortingLayerIndex=0,this._sortingOrder=0,this._cullingLayer=0,this._entity=null,this._lightmapIndex=-1,this._lightmapSceneIndex=0,this._lightmapScaleOffset=new i.n,this._drawOrder=0,this._nearestScreen=null,this._stencil=null,this._element=null,this._visible=!0,this._parameters={},this._constAttributes={},this._isStatic=!1,this._needsUpdate=!0,this._masksChildren=!1,this._reflectionProbes=null,this._blendReflectionProbes=!1,this._lightProbe=null,this._lightProbeUsage=!1,this._flipFaces=!1,this._materialPropertyBlocks=[],this._castShadows=!0,this._receiveShadows=!0,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"Model")}getParameters(){return this._parameters}setParameters(e){Object.assign(this._parameters,e),this._needsUpdate||this._updateParameters()}getParameter(e){return this._parameters[e]}setParameter(e,t){this._parameters[e]!==t&&(this._parameters[e]=t,this._needsUpdate||this._updateParameters())}deleteParameter(e){this._parameters[e]&&(delete this._parameters[e],this._needsUpdate||this._updateParameters())}setConstant(e,t){this._constAttributes[e]=t,this._needsUpdate||this._updateConstants()}deleteConstant(e){delete this._constAttributes[e],this._needsUpdate||this._updateConstants()}update(){this._mesh&&this._mesh.version===this._meshVersion&&!this._needsUpdate||(this._needsUpdate=!1,this._configureMeshInstances())}setMeshDirectlyToMeshInstance(e){if(0===this.meshInstances.length)this.mesh!==e&&(this.mesh=e);else{const t=this.meshInstances[0];t.mesh!==e&&(t.mesh=e)}}setBlendShapeWeight(e,t){this.morphInstance?this.morphInstance.setWeight(e,t):UnityEngine.Debug.LogError$1("SetBlendShapeWeight called for non blendable mesh.")}getBlendShapesCount(){return this.morphInstance?this.morphInstance.getCount():0}getBlendShapeWeight(e){return this.morphInstance?this.morphInstance.getWeight(e):(UnityEngine.Debug.LogError$1("GetBlendShapeWeight called for non blendable mesh."),0)}_configureMeshInstances(){if(!this._mesh)return void(this.meshInstances.length=0);if(this._meshVersion=this._mesh.version,!this._materials)return void UnityEngine.Debug.Log$1("Missing materials on "+this.entity.name);const e=this._mesh.subMeshes.length,t=this._materials.length;let s=0,i=!1;s=1===e?Math.max(1,t):e,this.meshInstances.length=s,this._materialPropertyBlocks.length=t;for(let e=0;e<this.meshInstances.length;e++){const t=this._materials[Math.min(this._materials.length-1,e)],s=this._mesh.subMeshes[Math.min(this._mesh.subMeshes.length-1,e)];if(this.meshInstances[e]){const n=this.meshInstances[e].mesh!==s;i=i||n||this.meshInstances[e].material!==t,this.meshInstances[e].mesh=s,this.meshInstances[e].material=t,n&&(this.meshInstances[e]._aabbVer=-1)}else this.meshInstances[e]=new a.a(this.entity,s,t),i=!0,this.morphInstance&&(this.meshInstances[e].morphInstance=this.morphInstance);this.meshInstances[e].batchId=0}this.entity&&(this.skin&&this.skin.rootBone?this._flipFaces=this.skin.rootBone._isOddlyScaled():this._flipFaces=this.entity._isOddlyScaled()),this._updateParameters(),this._updateConstants(),this._updateSkin(),this._updateFlipFaces(),this._updateSortingIndexes(),this._updateCulling(),this._updateEntity(),this._configureLightmaps(),this._updateLightProbe(),this._updateReflectionProbes(),this._updateReflectionProbesBlending(),this._updateVisibility(),this._updateElement(),this._updateNearestScreen(),this._updateDrawOrder(),this._updateStencil(),this._updateMasksChildren(),this._updateCastShadows(),this._updateReceiveShadows()}_configureLightmaps(){if(!this._mesh)return;let e=0;this._mesh.vertexBuffer.format.hasUv1||(e|=n.c.SHADERDEF_LMUV0),1===UnityEngine.LightmapSettings.environmentLightingMode&&(e|=n.c.SHADERDEF_LM_BAKED_AMBIENT),UnityEngine.LightmapSettings.lightmapsMode===UnityEngine.LightmapsMode.CombinedDirectional&&(e|=n.c.SHADERDEF_DIRLM);for(let t=0;t<this.meshInstances.length;t++){const s=this.meshInstances[t];!this._lightmapScaleOffset||this._lightmapIndex<0?(s._shaderDefs&=~(n.c.SHADERDEF_LM|n.c.SHADERDEF_DIRLM|n.c.SHADERDEF_LMUV0|n.c.SHADERDEF_LM_DLDR),s.deleteParameter("unity_Lightmap"),s.deleteParameter("unity_LightmapInd"),s.deleteParameter("unity_LightmapST")):(s._shaderDefs|=e|n.c.SHADERDEF_LM,s.setParameter("unity_LightmapST",[this._lightmapScaleOffset.x,this._lightmapScaleOffset.y,this._lightmapScaleOffset.z,this._lightmapScaleOffset.w]),s.lightmapIndex=this._lightmapIndex,s.lightmapSceneIndex=this._lightmapSceneIndex)}}_updateParameters(){for(let e=0;e<this.meshInstances.length;e++){const t=this.meshInstances[e];for(const e in this._parameters)t.setParameter(e,this._parameters[e]);for(const e in t.parameters)e in this._parameters||t.deleteParameter(e);const s=this._materialPropertyBlocks[e];s&&s.applyToMeshInstance(t)}}_updateConstants(){for(let e=0;e<this.meshInstances.length;e++){const t=this.meshInstances[e];for(const e in this._constAttributes)t.constAttributes[e]=this._constAttributes[e];for(const e in t.constAttributes)e in this._constAttributes||delete t.constAttributes[e]}}_updateSkin(){if(!this._skin)return;const e=new r.a(this._skin);e.bones=this._bones;for(let t=0;t<this.meshInstances.length;t++)this.meshInstances[t].mesh.skin=this._skin,this.meshInstances[t].skinInstance=e}_updateSortingIndexes(){for(let e=0;e<this.meshInstances.length;e++)this.meshInstances[e].sortingLayerIndex=this._sortingLayerIndex,this.meshInstances[e].sortingOrder=this._sortingOrder}_updateFlipFaces(){for(let e=0;e<this.meshInstances.length;e++)this.meshInstances[e]._flipFaces=this._flipFaces}_updateReflectionProbes(){const e=this._reflectionProbes?this._reflectionProbes[0]:null,t=this._reflectionProbes?this._reflectionProbes[1]:null;for(let s=0;s<this.meshInstances.length;s++){const i=this.meshInstances[s];if(e){const t=e.getBox(i.aabb);i.setParameter(o.b[0],e.cubemap),i.setParameter(o.b[1],t.min.data),i.setParameter(o.b[2],t.max.data),i.setParameter(o.b[3],t.position.data)}else i.deleteParameter(o.b[0]),i.deleteParameter(o.b[1]),i.deleteParameter(o.b[2]),i.deleteParameter(o.b[3]);if(t){const e=t.getBox(i.aabb);i.setParameter(o.b[4],t.cubemap),i.setParameter(o.b[5],e.min.data),i.setParameter(o.b[6],e.max.data),i.setParameter(o.b[7],e.position.data)}else i.deleteParameter(o.b[4]),i.deleteParameter(o.b[5]),i.deleteParameter(o.b[6]),i.deleteParameter(o.b[7])}}_updateReflectionProbesBlending(){for(let e=0;e<this.meshInstances.length;e++){const t=this.meshInstances[e];this._blendReflectionProbes?t._shaderDefs|=n.c.SHADERDEF_BLEND_REFLECTION_PROBES:t._shaderDefs&=~n.c.SHADERDEF_BLEND_REFLECTION_PROBES}}_updateLightProbe(){const e=(!this._lightmapScaleOffset||this._lightmapIndex<0)&&this.lightProbeUsage;for(let t=0;t<this.meshInstances.length;t++){const s=this.meshInstances[t];e?(s._shaderDefs|=n.c.SHADERDEF_LIGHTPROBES,s._lightProbe=this._lightProbe):(s._shaderDefs&=~n.c.SHADERDEF_LIGHTPROBES,s._lightProbe=null)}}_updateCulling(){for(let e=0;e<this.meshInstances.length;e++)this.meshInstances[e].mask=1<<this._cullingLayer}_updateVisibility(){for(let e=0;e<this.meshInstances.length;e++)this.meshInstances[e].visible=this._visible}_updateEntity(){for(let e=0;e<this.meshInstances.length;e++)this.meshInstances[e].node=this.entity}_updateElement(){for(let e=0;e<this.meshInstances.length;e++)this.meshInstances[e]._element=this._element}_updateNearestScreen(){for(let e=0;e<this.meshInstances.length;e++)this.meshInstances[e]._nearestScreen=this._nearestScreen}_updateDrawOrder(){for(let e=0;e<this.meshInstances.length;e++)this.meshInstances[e].drawOrder=this._drawOrder}_updateStencil(){for(let e=0;e<this.meshInstances.length;e++){const t=this.meshInstances[e];t.stencilBack=this._stencil,t.stencilFront=this._stencil,this._stencil?t._shaderDefs|=n.c.SHADERDEF_STENCIL_OVERRIDE:t._shaderDefs&=~n.c.SHADERDEF_STENCIL_OVERRIDE}}_updateMasksChildren(){for(let e=0;e<this.meshInstances.length;e++){const t=this.meshInstances[e];this._masksChildren?t._shaderDefs|=n.c.SHADERDEF_UI_MASK:t._shaderDefs&=~n.c.SHADERDEF_UI_MASK}}_updateCastShadows(){for(let e=0;e<this.meshInstances.length;e++)this.meshInstances[e].castShadows=this._castShadows}_updateReceiveShadows(){for(let e=0;e<this.meshInstances.length;e++)this.meshInstances[e].receiveShadows=this._receiveShadows}destroy(){const e=this.meshInstances;for(let t=0;t<e.length;t++){const s=e[t],i=s.mesh;if(i&&(i._refCount--,i._refCount<1)){i.vertexBuffer&&(i.vertexBuffer.destroy(),i.vertexBuffer=null);for(let e=0;e<i.indexBuffer.length;e++){const t=i.indexBuffer[e];t&&t.destroy()}i.indexBuffer.length=0}const n=s.skinInstance;if(n){const e=n.boneTexture;e&&e.destroy()}s.skinInstance=null;const r=s.morphInstance;r&&r.destroy(),s.morphInstance=null,s.material=null}}get visible(){return this._visible}set visible(e){this._visible=e,this._needsUpdate||this._updateVisibility()}get stencil(){return this._stencil}set stencil(e){this._stencil=e,this._needsUpdate||this._updateStencil()}get element(){return this._element}set element(e){this._element=e,this._needsUpdate||this._updateElement()}get nearestScreen(){return this._nearestScreen}set nearestScreen(e){this._nearestScreen=e,this._needsUpdate||this._updateNearestScreen()}get lightmapIndex(){return this._lightmapIndex}set lightmapIndex(e){this._lightmapIndex=e,this._needsUpdate||this._configureLightmaps()}get lightmapScaleOffset(){return this._lightmapScaleOffset}set lightmapScaleOffset(e){this._lightmapScaleOffset=e,this._needsUpdate||this._configureLightmaps()}get materials(){return this._materials}set materials(e){this._materials=e,this._needsUpdate=!0}get material(){return this._materials?this._materials[0]:null}set material(e){this._materials=this._materials||[],this._materials[0]=e,this._needsUpdate=!0}get mesh(){return this._mesh}set mesh(e){this._mesh=e,this._needsUpdate=!0}get skin(){return this._skin}set skin(e){this._skin=e,this._needsUpdate||this._updateSkin()}get bones(){return this._bones}set bones(e){this._bones=e,this._needsUpdate||this._updateSkin()}get sortingLayerIndex(){return this._sortingLayerIndex}set sortingLayerIndex(e){this._sortingLayerIndex=e,this._needsUpdate||this._updateSortingIndexes()}get sortingOrder(){return this._sortingOrder}set sortingOrder(e){this._sortingOrder=e,this._needsUpdate||this._updateSortingIndexes()}get drawOrder(){return this._drawOrder}set drawOrder(e){this._drawOrder=e,this._needsUpdate||this._updateDrawOrder()}get cullingLayer(){return this._cullingLayer}set cullingLayer(e){this._cullingLayer=e,this._needsUpdate||this._updateCulling()}get lightProbe(){return this._lightProbe}set lightProbe(e){this._lightProbe=e,this._needsUpdate||this._updateLightProbe()}get lightProbeUsage(){return this._lightProbeUsage}set lightProbeUsage(e){e!==this._lightProbeUsage&&(this._lightProbeUsage=e,this._needsUpdate||this._updateLightProbe())}get blendReflectionProbes(){return this._blendReflectionProbes}set blendReflectionProbes(e){this._blendReflectionProbes!==e&&(this._blendReflectionProbes=e,this._needsUpdate||this._updateReflectionProbesBlending())}get reflectionProbes(){return this._reflectionProbes}set reflectionProbes(e){null===this._reflectionProbes&&null===e||(this._reflectionProbes=e,this._needsUpdate||this._updateReflectionProbes())}get flipFaces(){return this._flipFaces}set flipFaces(e){this._flipFaces!==e&&(this._flipFaces=e,this._needsUpdate||this._updateFlipFaces())}get isStatic(){return this._isStatic}set isStatic(e){this._isStatic=e}get masksChildren(){return this._masksChildren}set masksChildren(e){this._masksChildren=e,this._needsUpdate||this._updateMasksChildren()}get entity(){return this._entity}set entity(e){this._entity=e}get castShadows(){return this._castShadows}set castShadows(e){this._castShadows=e,this._needsUpdate||this._updateCastShadows()}get receiveShadows(){return this._receiveShadows}set receiveShadows(e){this._receiveShadows=e,this._needsUpdate||this._updateReceiveShadows()}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>_});var i=s(0);const n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=1/(4*Math.PI),a=1/(2*Math.PI),o=15/(16*Math.PI),h=5/(64*Math.PI),l=15/(64*Math.PI),c=new i.d,d=new i.m,u=new Float32Array(n);class _{constructor(e=n){this.data=new Float32Array(e),this.uniforms=null}get(e,t){return this.data[9*e+t]}set(e,t,s){this.data[9*e+t]=s}copy(e){for(let t=0;t<this.data.length;t++)this.data[t]=e.data[t]}clear(){for(let e=0;e<this.data.length;e++)this.data[e]=0}setFromInterpolation(e,t){for(let s=0;s<this.data.length;s++){this.data[s]=0;for(let i=0;i<e.length;i++)this.data[s]+=e[i].data[s]*t[i]}}addCubemap(e,t){const s=e.width;let i=0;const r=this.data;u.set(n),this.data=u;for(let n=0;n<6;n++){const r=e._levels[0][n];for(let e=0;e<s;e++)for(let a=0;a<s;a++){const o=e*s+a,h=a/(s-1)*2-1,l=e/(s-1)*2-1,u=1+h*h+l*l,_=4/(Math.sqrt(u)*u);switch(d.set(h,-l,1).normalize(),n){case 0:d.set(d.z,-d.y,-d.x);break;case 1:d.set(-d.z,-d.y,d.x);break;case 2:d.set(d.x,d.z,d.y);break;case 3:d.set(d.x,-d.z,-d.y);break;case 4:d.set(d.x,-d.y,d.z);break;case 5:d.set(-d.x,-d.y,-d.z)}c.set(r[4*o+0]/255,r[4*o+1]/255,r[4*o+2]/255,1),this.addDirectionalLight(d,c,t,_/2.956),i+=_}}for(let e=0;e<this.data.length;e++)r[e]+=4*u[e]*Math.PI/i;this.data=r}addAmbientLight(e){c.copy(e).toLinear(),this.data[0]+=c.r,this.data[9]+=c.g,this.data[18]+=c.b}addSkyGradient(e,t,s){this.addAmbientLight(t),this.addDirectionalLight(i.m.UP,e,1,1),this.addDirectionalLight(i.m.DOWN,s,1,1)}addPointLight(e,t,s,n){const r=e.length()/n;d.copy(e).normalize();const a=(0,i.o)(1/(1+25*r*r)*(0,i.o)(5*(1-r),0,1),0,1);this.addDirectionalLight(d,t,s,a)}addSpotLight(e,t,s,i,n){this.addPointLight(e,t,s,i)}addDirectionalLight(e,t,s,i){c.copy(t).scale(s).toLinear().scale(2.956*i),this.addLightFromDirection(e,c)}addLightFromDirection(e,t){const s=r,i=a*e.y,n=a*e.z,c=a*e.x,d=o*(e.x*e.y),u=o*(e.y*e.z),_=h*(3*e.z*e.z-1),m=o*(e.x*e.z),p=l*(e.x*e.x-e.y*e.y);this.data[0]+=t.r*s,this.data[1]+=t.r*i,this.data[2]+=t.r*n,this.data[3]+=t.r*c,this.data[4]+=t.r*d,this.data[5]+=t.r*u,this.data[6]+=t.r*_,this.data[7]+=t.r*m,this.data[8]+=t.r*p,this.data[9]+=t.g*s,this.data[10]+=t.g*i,this.data[11]+=t.g*n,this.data[12]+=t.g*c,this.data[13]+=t.g*d,this.data[14]+=t.g*u,this.data[15]+=t.g*_,this.data[16]+=t.g*m,this.data[17]+=t.g*p,this.data[18]+=t.b*s,this.data[19]+=t.b*i,this.data[20]+=t.b*n,this.data[21]+=t.b*c,this.data[22]+=t.b*d,this.data[23]+=t.b*u,this.data[24]+=t.b*_,this.data[25]+=t.b*m,this.data[26]+=t.b*p}updateUniforms(){this.uniforms||(this.uniforms=[new i.n,new i.n,new i.n,new i.n,new i.n,new i.n,new i.n]);for(let e=0;e<3;e++)this.uniforms[e].x=this.get(e,3),this.uniforms[e].y=this.get(e,1),this.uniforms[e].z=this.get(e,2),this.uniforms[e].w=this.get(e,0)-this.get(e,6);for(let e=0;e<3;e++)this.uniforms[e+3].x=this.get(e,4),this.uniforms[e+3].y=this.get(e,5),this.uniforms[e+3].z=3*this.get(e,6),this.uniforms[e+3].w=this.get(e,7);this.uniforms[6].x=this.get(0,8),this.uniforms[6].y=this.get(1,8),this.uniforms[6].z=this.get(2,8),this.uniforms[6].w=1;for(let e=0;e<7;e++)this.uniforms[e].data}isEmpty(){for(let e=0;e<this.data.length;e++)if(Math.abs(this.data[e])>=1e-8)return!1;return!0}}_.fromArray=function(e){const t=new _([]);return t.data=e,t}},(e,t,s)=>{"use strict";s.d(t,{a:()=>U,b:()=>v,c:()=>O});var i=s(2),n=s(1),r=s(39),a=s(16),o=s(32);const h=/void\s+main\s*\(\s*(void)?\s*\)\s*{/,l="attribute\\s+(highp\\s*|lowp\\s*|mediump\\s*)?vec[2|3|4]\\s+",c=/\s*vec(2|3|4)\s*/,d="\\s*;",u=/uniform mat4 matrix_viewProjection;/,_=" ",m="// #define BONE_LIMIT 128 // will be added in code\nuniform mat4 matrix_pose[BONE_LIMIT];\nmat4 getBoneMatrix(const in float i) {\n mat4 bone = matrix_pose[int(i)];\n return bone;\n}\n",p="uniform sampler2D texture_poseMap;\nuniform vec2 texture_poseMapSize;\nmat4 getBoneMatrix(const in float i)\n{\n float j = i * 4.0;\n float x = mod(j, float(texture_poseMapSize.x));\n float y = floor(j / float(texture_poseMapSize.x));\n float dx = 1.0 / float(texture_poseMapSize.x);\n float dy = 1.0 / float(texture_poseMapSize.y);\n y = dy * (y + 0.5);\n vec4 v1 = texture2D(texture_poseMap, vec2(dx * (x + 0.5), y));\n vec4 v2 = texture2D(texture_poseMap, vec2(dx * (x + 1.5), y));\n vec4 v3 = texture2D(texture_poseMap, vec2(dx * (x + 2.5), y));\n vec4 v4 = texture2D(texture_poseMap, vec2(dx * (x + 3.5), y));\n mat4 bone = mat4(v1, v2, v3, v4);\n return bone;\n}\n",g="attribute vec4 vertex_boneWeights;\nattribute vec4 vertex_boneIndices;\nmat4 skinnedMatrix;\n\nmat4 getSkinnedModelMatrix() {\n return (\n getBoneMatrix( vertex_boneIndices.x ) * vertex_boneWeights.x +\n getBoneMatrix( vertex_boneIndices.y ) * vertex_boneWeights.y +\n getBoneMatrix( vertex_boneIndices.z ) * vertex_boneWeights.z +\n getBoneMatrix( vertex_boneIndices.w ) * vertex_boneWeights.w );\n}\n\nvec4 get_POSITION( vec4 pos )\n{\n return skinnedMatrix * pos;\n}\n\nvec4 get_NORMAL( vec4 normal )\n{\n return skinnedMatrix * normal;\n}\n\nvec4 get_TANGENT( vec4 tangent )\n{\n return skinnedMatrix * tangent;\n}\n",f="// Instancing attributes\nattribute vec3 instancing_translation;\nattribute vec4 instancing_rotation;\nattribute vec3 instancing_scale;\nattribute vec4 instancing_color;\nattribute vec4 instancing_st;\n\n// Uniforms\nuniform highp mat4 matrix_viewInverse;\nuniform highp mat4 matrix_viewProjection;\nuniform highp mat4 matrix_modelRotation;\nuniform highp mat4 matrix_modelTranslation;\nuniform highp vec3 system_scale;\nuniform int renderer_alignment;\nuniform float worldSimulationSpace;\n\n// Quaternion multiplication\n// http://mathworld.wolfram.com/Quaternion.html\nvec4 quaternion_multiply( vec4 lhs, vec4 rhs ) {\n return vec4(\n rhs.xyz * lhs.w + lhs.xyz * rhs.w + cross( lhs.xyz, rhs.xyz ),\n lhs.w * rhs.w - dot( lhs.xyz, rhs.xyz )\n );\n}\n\n// Vector rotation with a quaternion\n// http://mathworld.wolfram.com/Quaternion.html\nvec3 quaternion_rotate_vector( vec3 vector, vec4 quaternion ) {\n vec4 quaternion_conjugate = quaternion * vec4( -1, -1, -1, 1 );\n return quaternion_multiply( quaternion, quaternion_multiply( vec4( vector, 0 ), quaternion_conjugate ) ).xyz;\n}\n\nmat4 transpose( mat4 m ) {\n return mat4(\n m[ 0 ][ 0 ], m[ 1 ][ 0 ], m[ 2 ][ 0 ], m[ 3 ][ 0 ],\n m[ 0 ][ 1 ], m[ 1 ][ 1 ], m[ 2 ][ 1 ], m[ 3 ][ 1 ],\n m[ 0 ][ 2 ], m[ 1 ][ 2 ], m[ 2 ][ 2 ], m[ 3 ][ 2 ],\n m[ 0 ][ 3 ], m[ 1 ][ 3 ], m[ 2 ][ 3 ], m[ 3 ][ 3 ]);\n}\n\nmat4 getFacingAlignmentRotation( vec4 particlePosition ) {\n vec3 eye = matrix_viewInverse[ 3 ].xyz;\n vec3 pivot = particlePosition.xyz;\n\n // Find desired rotation between two vectors\n vec4 cameraZ = vec4( normalize( pivot - eye ), 0 );\n vec4 cameraY = matrix_viewInverse * vec4( 0, 1, 0, 0 );\n vec4 cameraX = vec4( cross(cameraY.xyz, cameraZ.xyz), 0 );\n cameraY = vec4( cross(cameraZ.xyz, cameraX.xyz), 0 );\n\n mat4 extraRotation = mat4( 0.0 );\n extraRotation[ 0 ] = cameraX;\n extraRotation[ 1 ] = cameraY;\n extraRotation[ 2 ] = cameraZ;\n extraRotation[ 3 ][ 3 ] = 1.0;\n\n return extraRotation;\n}\n\n// Applies rotation, then scale, then translate to the\n// vertex coordinates.\n\n#define VIEW_ALIGNMENT 0\n#define WORLD_ALIGNMENT 1\n#define LOCAL_ALIGNMENT 2\n#define FACING_ALIGNMENT 3\n\nmat4 alignment_rotation;\nmat4 simulationSpace_rotation;\nmat4 simulationSpace_translation;\n\nvec4 transform_vertex( vec4 vertex, mat4 matrix_scale ) {\n vec4 v = matrix_scale * vertex;\n v = vec4( quaternion_rotate_vector( v.xyz, instancing_rotation ), 1.0 );\n v = alignment_rotation * v;\n\n v += vec4( instancing_translation, 0 );\n\n v = simulationSpace_rotation * v;\n v = simulationSpace_translation * v;\n\n return v;\n}\n\nvec4 get_POSITION( vec4 position ) {\n if ( worldSimulationSpace > 0.0 ) {\n simulationSpace_rotation = mat4( 1.0 );\n simulationSpace_translation = mat4( 1.0 );\n } else {\n simulationSpace_rotation = matrix_modelRotation;\n simulationSpace_translation = mat4( 1.0 );\n simulationSpace_translation[ 3 ] = matrix_modelTranslation[ 3 ];\n }\n\n if ( LOCAL_ALIGNMENT == renderer_alignment ) {\n // local alignment means rotation starts with hierarchy rotation\n alignment_rotation = matrix_modelRotation;\n } else if ( WORLD_ALIGNMENT == renderer_alignment ) {\n // world alignment means rotation starts with E\n alignment_rotation = mat4( 1.0 );\n } else if ( ( VIEW_ALIGNMENT == renderer_alignment ) || ( FACING_ALIGNMENT == renderer_alignment ) ) {\n // view alignment means rotation starts with camera rotation\n // Assume scales are 0\n\n vec4 camRight = vec4(normalize(matrix_viewInverse[0].xyz), 0);\n vec4 camUp = vec4(normalize(matrix_viewInverse[1].xyz), 0);\n vec4 camFwd = -vec4(normalize(matrix_viewInverse[2].xyz), 0);\n\n alignment_rotation = mat4(camRight, camUp, camFwd, vec4( 0, 0, 0, 1 ));\n }\n\n alignment_rotation = transpose( simulationSpace_rotation ) * alignment_rotation;\n\n mat4 scale;\n scale[ 0 ] = vec4( system_scale.x * instancing_scale.x, 0, 0, 0 );\n scale[ 1 ] = vec4( 0, system_scale.y * instancing_scale.y, 0, 0 );\n scale[ 2 ] = vec4( 0, 0, system_scale.z * instancing_scale.z, 0 );\n scale[ 3 ] = vec4( 0, 0, 0, 1 );\n\n vec4 vertex = vec4( position.xyz, 1 );\n vec4 vertexPosition = transform_vertex( vertex, scale );\n\n if ( FACING_ALIGNMENT == renderer_alignment ) {\n vec4 pivot_vertex = vec4( 0, 0, 0, 1 );\n vec4 pivot = transform_vertex( pivot_vertex, scale );\n\n alignment_rotation = transpose( simulationSpace_rotation ) * getFacingAlignmentRotation( pivot );\n vertexPosition = transform_vertex( vertex, scale );\n }\n\n return vertexPosition;\n}\n\nvec4 get_COLOR( vec4 color ) {\n return color * instancing_color;\n}\n\nvec4 get_TEXCOORD0( vec4 texcoord ) {\n return vec4( ( texcoord.xy + instancing_st.zw ) * instancing_st.xy, texcoord.zw );\n}\n\nvec4 get_NORMAL( vec4 normal ) {\n normal = vec4( quaternion_rotate_vector( normal.xyz, instancing_rotation ), 0 );\n normal = alignment_rotation * normal;\n normal = simulationSpace_rotation * normal;\n return normal;\n}\n\nvec4 get_TANGENT( vec4 tangent ) {\n tangent = vec4( quaternion_rotate_vector( tangent.xyz, instancing_rotation ), 0 );\n tangent = alignment_rotation * tangent;\n tangent = simulationSpace_rotation * tangent;\n return tangent;\n}\n",y=function(e,t,s,i){return e.substring(0,t)+i+e.substring(t+s)},E=function(e,t,s){return e.substring(0,t)+s+e.substring(t)},T=function(e,t,s,i){return e.substring(0,t)+i+e.substring(s)},S=function(e,t,s,i){let n=e,r=t[0].search(s);return r+=t.index,n=y(n,r,s.length,i),n},A=function(e,t){let s=e;return s=y(s,t.index,t[0].length,""),s},b=function(e,t,s,i,n){let r=e;const a=new RegExp(l+s+d),o=r.match(a);if(o){const e=o[0].match(c)[0].trim();r=S(r,o,"attribute","");const i="_patched_"+t;if(n.defines+="attribute "+e+" "+i+";\n","vec4"===e)n.main+=_+s+" = get_"+t+"( "+i+" );\n";else{let r="",a="";"vec2"===e?(r=".xy",a=", 0, 0"):"vec3"===e&&(r=".xyz",a=", 0"),n.main+=_+s+" = get_"+t+"( vec4( "+i+a+") )"+r+";\n"}}return r},C=function(e,t,s){let i=null;for(const n in t){if(t[n]!==s)continue;const r=new RegExp(l+n+d);if(e.match(r)){i=n;break}}return i},w=function(e,t,s,i){let n=e;for(let e=0;e<t.length;e++){const r=t[e],a=C(n,s,r);if(null!==a){n=b(n,r,a,0,i)}}return n},x=function(e,t){const s=e.match("\\s*#version [0-9]+\\s*");if(!s)return e;const i=s[0].trim(),n=A(e,s);return t.defines=i+"\n\n"+t.defines,n};class R{constructor(e,t){this.baseShader=e,this.patchShader=t,this.defines="",this.main="",this.getMain=function(){return"void main() {\n"+this.main+" _main(); // Initial main function call\n}\n"},this.combine=function(){return"\n// Patched defines\n"+this.defines+"\n// Patch shader\n"+this.patchShader+"\n\n// Base shader\n"+this.baseShader+"\n\n// Patched main\n"+this.getMain()}}}const I=function(e){const t=new RegExp(u),s=e.match(t);return null===s?e:A(e,s)},M=function(e){const t=(0,o.a)(e.combine()),s=(0,r.d)(n.a.getApplication().graphicsDevice,t),i=[];i.push("hlslcc_mtx4x4unity_ObjectToWorld");const a=[],h=e.baseShader.indexOf("hlslcc_mtx4x4unity_WorldToObject")>0;h&&(i.push("hlslcc_mtx4x4unity_WorldToObject"),e.patchShader+="mat4 inverse(vec4[4] m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n}"),e.patchShader+="// Batching Patch\nattribute float batching_matrix_index;\nuniform vec4 batching_matrices[BATCHING_MATRICES_LENGTH * 4];\n";for(let t=0;t<i.length;t++)a.push(i[t].replace("hlslcc_mtx4x4unity","BATCHING")),e.patchShader+="highp vec4 "+a[t]+"[4];\n";e.patchShader+="\nvoid update_batching_matrix() {\n int start_index = int(batching_matrix_index) * 4;\n",e.patchShader+=a[0]+"[0] = batching_matrices[start_index + 0];\n",e.patchShader+=a[0]+"[1] = batching_matrices[start_index + 1];\n",e.patchShader+=a[0]+"[2] = batching_matrices[start_index + 2];\n",e.patchShader+=a[0]+"[3] = batching_matrices[start_index + 3];\n",h&&(e.patchShader+="mat4 WTO = inverse(BATCHING_ObjectToWorld);",e.patchShader+="BATCHING_WorldToObject[0] = WTO[0];",e.patchShader+="BATCHING_WorldToObject[1] = WTO[1];",e.patchShader+="BATCHING_WorldToObject[2] = WTO[2];",e.patchShader+="BATCHING_WorldToObject[3] = WTO[3];"),e.patchShader+="}\n",e.defines+="#define BATCHING_MATRICES_LENGTH "+s+"\n",e.main+=" update_batching_matrix();\n";for(let t=0;t<i.length;t++){const s=i[t],n=new RegExp(s,"g");e.baseShader=e.baseShader.replace(n,a[t]),e.baseShader=e.baseShader.replace(a[t],s)}return e},P=function(e){const t=(0,o.a)(e.combine()),s=(0,r.d)(n.a.getApplication().graphicsDevice,t);e.patchShader+=U.batchingPatch,e.defines+="#define BATCHING_MATRICES_LENGTH "+s+"\n",e.main+=" update_batching_matrix();\n";const i="hlslcc_mtx4x4unity_ObjectToWorld",a=new RegExp(i,"g");return e.baseShader=e.baseShader.replace(a,"BATCHING_ObjectToWorld"),e.baseShader=e.baseShader.replace("BATCHING_ObjectToWorld",i),e},v=function(e){return new a.a(n.a.getApplication().graphicsDevice,{attributes:{_glesVertex:i.c.SEMANTIC_POSITION,_glesNormal:i.c.SEMANTIC_NORMAL,_glesTangent:i.c.SEMANTIC_TANGENT,_glesMultiTexCoord0:i.c.SEMANTIC_TEXCOORD0,_glesMultiTexCoord1:i.c.SEMANTIC_TEXCOORD1,_glesMultiTexCoord2:i.c.SEMANTIC_TEXCOORD2,_glesMultiTexCoord3:i.c.SEMANTIC_TEXCOORD3,_glesColor:i.c.SEMANTIC_COLOR},vshader:"// This is a VP stub for shader #"+e+" \n attribute vec3 _glesVertex; varying highp vec2 xlv_TEXCOORD0; uniform mat4 matrix_model;\nuniform mat4 matrix_viewProjection;\nvoid main() { gl_Position = matrix_viewProjection * matrix_model * vec4(_glesVertex, 1.0); }",fshader:"// This is a FP stub for shader #"+e+" \n uniform sampler2D _MainTex; void main(void) { gl_FragColor = vec4(1, 0, 1, 1); }"})},D=/^#extension.*$/gm,O=function(e){const t=new RegExp(D),s=e.match(t);return s?(e=e.replace(t,""),e=s[0]+"\n"+e):e},L=function(e){const t=/for\(.*\)\n.*{/i;let s=e.match(t),i=e,n=0;for(;null!==s;){const r=s[0],a=/u_xlati\d+/i,o=/u_xlati_loop_\d+/i,h=r.match(a),l=r.match(o);if(!h||!l){n+=s.index+r.length,i=i.slice(s.index+r.length),s=i.match(t);continue}const c="\n\t\tif("+l[0]+">="+h[0]+"){break;}",d=E(r,r.length,c).replace(a,"LOOP_ITERATION_LIMIT"),u=(e=T(e,s.index+n,n+s.index+r.length,d)).match(/void main/i),_="const int LOOP_ITERATION_LIMIT = 4;\n";e=E(e,u.index,_),n+=s.index+r.length,i=i.slice(s.index+r.length),s=i.match(t)}return e},F=function(e){if(null!==e.match(/vec4 TempArray/i)){const t=/vec4 TempArray0/i,s="\nmediump vec4 GetDither(int i){\n if (i <= 0) return TempArray0[0];\n else if (i == 1) return TempArray0[1];\n else if (i == 2) return TempArray0[2];\n else if (i == 3) return TempArray0[3];\n else if (i == 4) return TempArray0[4];\n else if (i == 5) return TempArray0[5];\n else if (i == 6) return TempArray0[6];\n else if (i == 7) return TempArray0[7];\n else if (i == 8) return TempArray0[8];\n else if (i == 9) return TempArray0[9];\n else if (i == 10) return TempArray0[10];\n else if (i == 11) return TempArray0[11];\n else if (i == 12) return TempArray0[12];\n else if (i == 13) return TempArray0[13];\n else if (i == 14) return TempArray0[14];\n else if (i == 15) return TempArray0[15];\n return TempArray0[0];}\n";if(!e.match(t))return console.error("Something went wrong while patching Shader Graph with Dither node, probably need to improve pattern"),e;const i=/void main/i,n=/TempArray0\[u_xlati0\.x].x/i,r=e.match(i),a=(e=E(e,r.index,s)).match(n);e=T(e,a.index,a.index+a[0].length,"GetDither(u_xlati0.x).x")}return e},U={patchParticlesVertexShader:function(e,t){const s=new R(e,f);s.baseShader=I(s.baseShader);const n=[i.c.SEMANTIC_POSITION,i.c.SEMANTIC_COLOR,i.c.SEMANTIC_TEXCOORD0,i.c.SEMANTIC_NORMAL,i.c.SEMANTIC_TANGENT];s.baseShader=x(s.baseShader,s),s.baseShader=w(s.baseShader,n,t,s);const r=new RegExp(h),a=s.baseShader.match(r);return null===a?(UnityEngine.Debug.LogError$1("Shader patching error. Main function not found\n"+e),null):(s.baseShader=S(s.baseShader,a,"main","_main"),s.combine())},patchSkinningVertexShader:function(e,t){const s=n.a.getApplication().graphicsDevice;let r;s.supportsBoneTextures?r=new R(e,p+"\n"+g):(r=new R(e,m+"\n"+g),r.defines+="#define BONE_LIMIT "+s.getBoneLimit()+"\n"),r.main+=" skinnedMatrix = getSkinnedModelMatrix();\n";const a=[i.c.SEMANTIC_POSITION,i.c.SEMANTIC_NORMAL,i.c.SEMANTIC_TANGENT];r.baseShader=x(r.baseShader,r),r.baseShader=w(r.baseShader,a,t,r);const o=new RegExp(h),l=r.baseShader.match(o);if(null===l)return UnityEngine.Debug.LogError$1("Shader patching error. Main function not found\n"+e),null;r.baseShader=S(r.baseShader,l,"main","_main");let c=r.combine();const d="vec3 _patched_POSITION;",u=new RegExp(d);return r.defines.match(u)&&(c=c.replace(d,"vec4 _patched_POSITION;"),c=c.replace("vec4( _patched_POSITION, 0)","_patched_POSITION")),c},patchUIVertexShader:function(e,t,s=!1){const n=new R(e,U.uiPatch);n.baseShader=I(n.baseShader);const r=[i.c.SEMANTIC_COLOR];n.baseShader=x(n.baseShader,n),n.baseShader=w(n.baseShader,r,t,n);const a=new RegExp(h),o=n.baseShader.match(a);if(null===o)return UnityEngine.Debug.LogError$1("Shader patching error. Main function not found\n"+e),null;n.baseShader=S(n.baseShader,o,"main","_main"),s&&P(n);return n.combine()},patchBatchingVertexShader:function(e,t=!1){const s=new R(e,"");s.baseShader=I(s.baseShader),s.baseShader=x(s.baseShader,s);const i=new RegExp(h),n=s.baseShader.match(i);if(null===n)return UnityEngine.Debug.LogError$1("Shader patching error. Main function not found\n"+e),null;s.baseShader=S(s.baseShader,n,"main","_main"),t&&M(s);return s.combine()},patchUrpShader:function(e){return e=L(e),e=F(e)},particlesPatch:f,skinConstVS:m,skinTexVS:p,skinPatch:g,uiPatch:"// Uniforms\n uniform vec4 _CanvasColor;\n uniform float _GroupAlpha;\n\n vec4 get_COLOR( vec4 color ) {\n vec4 correctedColor = color * _CanvasColor;\n correctedColor.a *= _GroupAlpha;\n\n return correctedColor;\n }\n",batchingPatch:"// Batching Patch\nattribute float batching_matrix_index;\nuniform vec4 batching_matrices[BATCHING_MATRICES_LENGTH * 4];\nhighp vec4 BATCHING_ObjectToWorld[4];\n\nvoid update_batching_matrix() {\n int index = int(batching_matrix_index) * 4;\n BATCHING_ObjectToWorld[0] = batching_matrices[index + 0];\n BATCHING_ObjectToWorld[1] = batching_matrices[index + 1];\n BATCHING_ObjectToWorld[2] = batching_matrices[index + 2];\n BATCHING_ObjectToWorld[3] = batching_matrices[index + 3];\n}\n"}},(e,t,s)=>{"use strict";s.d(t,{a:()=>i});const i={genericSortOpaque(e,t){const s=e._material,i=t._material;return s&&i?s.renderQueue!==i.renderQueue?s.renderQueue-i.renderQueue:e.sortingLayerIndex!==t.sortingLayerIndex?e.sortingLayerIndex-t.sortingLayerIndex:e.sortingOrder!==t.sortingOrder?e.sortingOrder-t.sortingOrder:e.drawOrder!==t.drawOrder?e.drawOrder-t.drawOrder:e.zdist&&t.zdist&&e.zdist!==t.zdist?e.zdist-t.zdist:e.node===t.node?t.mesh.id-e.mesh.id:s.id!==i.id?s.id-i.id:e.mesh.id-t.mesh.id:0},genericSortTransparent(e,t){const s=e._material,i=t._material;return s&&i?s.renderQueue!==i.renderQueue?s.renderQueue-i.renderQueue:e.sortingLayerIndex!==t.sortingLayerIndex?e.sortingLayerIndex-t.sortingLayerIndex:e.sortingOrder!==t.sortingOrder?e.sortingOrder-t.sortingOrder:e.drawOrder!==t.drawOrder?e.drawOrder-t.drawOrder:e.zdist&&t.zdist&&e.zdist!==t.zdist?-(e.zdist-t.zdist):e.mesh&&t.mesh&&-1!==e.mesh.parentMeshId&&e.mesh.parentMeshId===t.mesh.parentMeshId&&e.mesh.id!==t.mesh.id||e.node===t.node?e.mesh.id-t.mesh.id:s.id!==i.id?s.id-i.id:e.mesh.id-t.mesh.id:0},sortOpaqueAndTransparent(e,t,s){for(let i=0;i<e.length;i++){const n=e[i];n.material.renderQueue<=2500&&t.push(n),n.material.renderQueue>2500&&s.push(n)}},uiElementsSort:(e,t)=>e.drawOrder-t.drawOrder,calculateSortDistances(e,t,s){for(let i=0;i<e.length;i++){const n=e[i],r=n.aabb.center;n.zdist=(r.x-t.x)*s.x+(r.y-t.y)*s.y+(r.z-t.z)*s.z}},cameraCompare:(e,t)=>e.priority-t.priority,sortOverlayCanvases:(e,t)=>e.sortingOrder!==t.sortingOrder?e.sortingOrder-t.sortingOrder:e.$id-t.$id,sortNestedOverlayCanvases:(e,t)=>e.sortingOrder!==t.sortingOrder?e.sortingOrder-t.sortingOrder:e.drawOrder!==t.drawOrder?e.drawOrder-t.drawOrder:e.mesh.$id-t.mesh.$id}},(e,t,s)=>{"use strict";s.d(t,{a:()=>o});var i=s(0);const n={radius:0,center:null},r=[],a=function(e,t,s=null){return n.center=t.center,n.radius=t.halfExtents.length(),0!==e.containsSphere(n,s)},o={cullMasked:function(e,t,s,i){let n=0;const r=void 0===e.cullingMask?4294967295:e.cullingMask;for(let e=0;e<s;e++){const s=t[e],a=!0;if(s.material&&((!s._mesh||s._mesh._refCount!==-1/0)&&s.visible))if(s.cull){if(a){const e=s.node.cullingLayer||0,t=1<<e;if(e<0)continue;if(0==(t&r))continue}i[n++]=s,s.visibleThisFrame=!0}else i[n++]=s,s.visibleThisFrame=!0}return i.length=n,n},cullFrustum:function(e,t,s){let i=0;const n=e.frustum,r=e._component&&e._component.layerCullDistancesActivated;for(let o=0;o<t.length;o++){const h=t[o];let l=!0;if(h.cull)if(r){const t=e._component.layerCullDistances[h.node.cullingLayer];l=a(n,h.aabb,e.calculateCustomFarClip(t))}else l=a(n,h.aabb);h.visibleThisFrame=l,l&&(s[i++]=h)}return s.length=i,i},cullUi:function(e,t,s){let i=0,n=0;const r=t.length,o=[],h=e.frustum;for(let e=0;e<r;e++){const s=t[e];s&&(s.material&&(s._mesh&&s._mesh._refCount===-1/0||s.visible&&(s.cull,o[n++]=s,s.visibleThisFrame=!0)))}for(let e=0;e<o.length;e++){const t=o[e];let n=!0;const r=!t._nearestScreen;t.cull&&r&&(n=a(h,t.aabb)),n?(s[i++]=t,t.visibleThisFrame=!0):t.visibleThisFrame=!1}return i},cullShadowCascades:function(e,t,s,n){const a=t.lightMatrix,o=a.getX(),h=a.getY(),l=a.transformVector(i.m.FORWARD),c=new i.m,d=r;d.length=s.length,d.fill(0);for(let i=0;i<s.length;i++){const n=s[i];if(!n.cull){d[i]=15;continue}const r=n.aabb.center,a=n.aabb.halfExtents.length();if(e.frustum.containsCylinder(r,l,a))for(let e=0;e<t.shadowMapsLength;e++){const s=t.getShadowMapData(e),n=s.boundingSphere.center,l=s.boundingSphere.radius;c.sub2(n,r);const u=c.dot(o),_=c.dot(h);Math.sqrt(u*u+_*_)<=l+a&&(d[i]|=1<<e)}}for(let e=0;e<n.length;e++){const t=n[e];let i=0;for(let n=0;n<d.length;n++){0!=(d[n]&1<<e)&&(t[i++]=s[n])}t.length=i}return n},reset:function(e,t){for(let s=0;s<t;s++)e[s].visibleThisFrame=!1},isAABBVisibleInFrustum:a,isVisibleInFrustum:function(e,t,s,i=null){return n.center=t,n.radius=s,0!==e.containsSphere(n,i)}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>r});var i=s(2);class n{constructor(e,t){switch(this.index=0,this.numComponents=t.numComponents,t.dataType){case i.c.TYPE_INT8:this.array=new Int8Array(e,t.offset);break;case i.c.TYPE_UINT8:this.array=new Uint8Array(e,t.offset);break;case i.c.TYPE_INT16:this.array=new Int16Array(e,t.offset);break;case i.c.TYPE_UINT16:this.array=new Uint16Array(e,t.offset);break;case i.c.TYPE_INT32:this.array=new Int32Array(e,t.offset);break;case i.c.TYPE_UINT32:this.array=new Uint32Array(e,t.offset);break;case i.c.TYPE_FLOAT32:this.array=new Float32Array(e,t.offset)}}get(e){return this.array[this.index+e]}set(e,t=0,s=0,i=0){this.array[this.index]=e,1!==this.numComponents&&(this.array[this.index+1]=t,2!==this.numComponents&&(this.array[this.index+2]=s,3!==this.numComponents&&(this.array[this.index+3]=i)))}}class r{constructor(e){this.vertexBuffer=e,this.buffer=this.vertexBuffer.lock(),this.accessors=[],this.element={};const t=this.vertexBuffer.getFormat();for(let e=0;e<t.elements.length;e++){const s=t.elements[e];this.accessors[e]=new n(this.buffer,s),this.element[s.name]=this.accessors[e]}}next(e=1){let t=0;const s=this.accessors,i=this.accessors.length,n=this.vertexBuffer.getFormat();for(;t<i;){const i=s[t++];i.index+=e*n.size/i.array.BYTES_PER_ELEMENT}}end(){this.vertexBuffer.unlock()}setVector4(e,t){this.element[e].set(t[0],t[1],t[2]||0,t[3]||1)}setVector3(e,t){this.element[e].set(t[0],t[1],t[2])}setVector2(e,t){this.element[e].set(t[0],t[1])}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>xt,b:()=>ze});var i=s(0),n=s(2),r=s(26);const a=new i.m;class o{constructor(){this.mainLight=null,this.pixelLights=[],this.vertexLights=[],this.otherLights=[],this.allLights=[]}reset(){this.mainLight=null,this.pixelLights.length=0,this.vertexLights.length=0,this.otherLights.length=0,this.allLights.length=0}addOtherLights(e){for(let t=0;t<this.otherLights.length;t++){const s=this.otherLights[t];a.copy(s._directionToLight),s._type===n.c.LIGHTTYPE_DIRECTIONAL?e.addDirectionalLight(a,s._color,s._intensity,1):s._type===n.c.LIGHTTYPE_POINT&&e.addPointLight(a,s._color,s._intensity,s.attenuationEnd),s._type===n.c.LIGHTTYPE_SPOT&&e.addSpotLight(a,s._color,s._intensity,s.attenuationEnd,s._outerConeAngle)}}combineAllLights(){this.allLights.length=0,this.mainLight&&this.allLights.push(this.mainLight);for(let e=0;e<this.pixelLights.length;e++)this.allLights.push(this.pixelLights[e]);for(let e=0;e<this.vertexLights.length;e++)this.allLights.push(this.vertexLights[e]);for(let e=0;e<this.otherLights.length;e++)this.allLights.push(this.otherLights[e])}toString(){return"{ "+(this.mainLight?this.mainLight._node.name:"<NONE>")+", Pixel = ["+this.pixelLights.map((e=>e._node.name)).join(", ")+"], Vertex = ["+this.vertexLights.map((e=>e._node.name)).join(", ")+"], SH = ["+this.otherLights.map((e=>e._node.name)).join(", ")+"] }"}}var h=s(11),l=s(38),c=s(20),d=s(7),u=s(9),_=s(16),m=s(28),p=s(1),g=s(15),f=s(29),y=s(6);const E=Number.MAX_SAFE_INTEGER,T={color:[1,1,1,1],depth:1,stencil:0,flags:n.c.CLEARFLAG_DEPTH|n.c.CLEARFLAG_COLOR|n.c.CLEARFLAG_STENCIL},S={sortedDrawCalls:[],keywords:new h.a};class A{get clearOptions(){return T}constructor(e,t){this.device=e,this.renderer=t}updateDepthTexture(e,t=2500){const s=this.selectDrawCalls(e,t,S.sortedDrawCalls);this.renderDrawCalls(s)}selectDrawCalls(e,t,s=[]){let i=0;for(let n=0;n<e.length;n++){e[n].material.renderQueue<=t&&(s[i++]=e[n])}return s.length=i,s.sort(((e,t)=>e.material.$id-t.material.$id)),s}renderDrawCalls(e){let t=null,s=null;const i=S.keywords;for(let n=0;n<e.length;n++){const r=e[n];t!==r.material&&(t=r.material,s=t.getShadowCasterPasses(t._shader),this.renderer.setMaterial(this.device,t),i.copy(t.keywords),i.enableKeywordId(h.b.SHADOWS_DEPTH),i.enableKeywordId(h.b.UNITY_PASS_SHADOWCASTER)),0!==s.length&&this.renderDrawCall(s,i,r)}}renderDrawCall(e,t,s){const i=this.device,r=this.renderer,a=s.mesh;i.setVertexBuffer(s.morphInstance&&s.morphInstance._vertexBuffer?s.morphInstance._vertexBuffer:a.vertexBuffer,0),i.setIndexBuffer(a.indexBuffer[0]),r.setSkinning(i,s),r.pushUniforms(i,s.parameters),r.setDrawCall(i,s),i.setDepthRange((s._shaderDefs&n.c.SHADERDEF_RENDERTYPE_BACKGROUND)>0?1:0,1);for(let i=0;i<e.length;i++)r.renderMeshInstancePass(e[i],t,s);r.popUniforms(i,s.parameters),r.setDrawCall(i,null)}}var b=s(10),C=s(30),w=s(41);const x={shadowFrustumNearPoints:[new i.m(-1,-1,-1),new i.m(1,-1,-1),new i.m(-1,1,-1),new i.m(1,1,-1)],shadowFrustumFarPoints:[new i.m(-1,-1,1),new i.m(1,-1,1),new i.m(-1,1,1),new i.m(1,1,1)]},R={spherePoints:[],sphereCenter:new i.m,sphereMatrix:new i.i,vectorOffset:new i.m,shadowFadeData:new i.n,shadowCenterData:new i.n,cornerDirection:new i.m,shadowCenter:new i.m,intersectionDistances:[0,0],shadowFrustum:[new i.m,new i.m,new i.m,new i.m,new i.m,new i.m,new i.m,new i.m],shadowFrustumNearPoint:new i.m,shadowFrustumFarPoint:new i.m};function I(e){return.4*(0,i.o)(1-e.fov/180,0,1)}function M(e,t=new i.c){const s=R.spherePoints;s[0]=e[0],s[1]=e[2],s[2]=e[5],s[3]=e[6];for(let e=1;e>=0;e--){const n=s[2*e],r=s[2*e+1],a=R.sphereCenter.add2(n,r).scale(.5),o=i.m.distance(n,a),h=s[2*(1-e)],l=s[2*(1-e)+1];if(i.m.distance(h,a)<=o&&i.m.distance(l,a)<=o)return t.center.copy(a),t.radius=o,t}return function(e,t=new i.c){const s=R.sphereMatrix.setIdentity();for(let t=0;t<e.length;t++)s.data[t+0]=e[t].x,s.data[t+4]=e[t].y,s.data[t+8]=e[t].z,s.data[t+12]=1;const n=s.determinant();for(let t=0;t<e.length;t++)s.data[t+0]=e[t].x*e[t].x+e[t].y*e[t].y+e[t].z*e[t].z,s.data[t+4]=e[t].y,s.data[t+8]=e[t].z,s.data[t+12]=1;const r=s.determinant();for(let t=0;t<e.length;t++)s.data[t+0]=e[t].x,s.data[t+4]=e[t].x*e[t].x+e[t].y*e[t].y+e[t].z*e[t].z,s.data[t+8]=e[t].z,s.data[t+12]=1;const a=s.determinant();for(let t=0;t<e.length;t++)s.data[t+0]=e[t].x,s.data[t+4]=e[t].y,s.data[t+8]=e[t].x*e[t].x+e[t].y*e[t].y+e[t].z*e[t].z,s.data[t+12]=1;const o=s.determinant();for(let t=0;t<e.length;t++)s.data[t+0]=e[t].x*e[t].x+e[t].y*e[t].y+e[t].z*e[t].z,s.data[t+4]=e[t].x,s.data[t+8]=e[t].y,s.data[t+12]=e[t].z;const h=s.determinant(),l=R.sphereCenter;l.x=.5*r/n,l.y=.5*a/n,l.z=.5*o/n;const c=Math.sqrt(l.x*l.x+l.y*l.y+l.z*l.z-h/n);return t.center.copy(l),t.radius=c,t}(s,t)}function P(e,t,s,n=new i.n){const r=2/t.data[0]/s,a=-1*t.data[10];return n.x=e.shadowBias*a,n.y=1,n.z=e.shadowNormalBias*r,n.w=0,n}function v(e,t,s,n,r,a=new i.c){const o=function(e,t,s){let n=1;if(0!==s){const t=e.projInvMat.transformPointPerspective(i.m.ONE,R.cornerDirection).normalize(),s=I(e),r=R.shadowCenter.set(0,0,-s),a=1-s,o=R.intersectionDistances,h=function(e,t,s,n,r){const a=n*n,o=(new i.m).sub2(s,e),h=o.dot(t);if(h<0)return!1;const l=o.lengthSq()-h*h;if(l>a)return!1;const c=Math.sqrt(a-l);return r[0]=h-c,r[1]=h+c,!0}(i.m.ZERO,t,r,a,o);h&&(n=Math.abs(o[1]*t.z))}return(t*n-e.nearClip)/(e.farClip-e.nearClip)}(e,s,n),h=function(e,t,s,n,r=[]){const a=n[s]*t,o=n[s+1]*t;for(let t=0;t<x.shadowFrustumNearPoints.length;t++){const s=e.invViewProjMat.transformPointPerspective(x.shadowFrustumNearPoints[t],R.shadowFrustumNearPoint),n=e.invViewProjMat.transformPointPerspective(x.shadowFrustumFarPoints[t],R.shadowFrustumFarPoint);r[t]=r[t]||new i.m,r[t].lerp(s,n,a),r[t+4]=r[t+4]||new i.m,r[t+4].lerp(s,n,o)}return r}(e,o,t,r,R.shadowFrustum);return M(h,a)}const D=new Float32Array(4),O=new Float32Array(16),L=new Float32Array(64),F={normalizedOrthographicProjection:(new i.i).setOrtho(0,1,0,1,0,1),inverseForwardMatrix:(new i.i).setScale(1,1,-1)},U={shaderKeywords:new h.a,sphericalShadowRange:new i.c,shadowFadeData:new i.n,shadowCenterData:new i.n,cameraToWorldMatrix:new i.i,cameraFarPlanePoints:[new i.m,new i.m,new i.m,new i.m]};class B{constructor(e,t,s,i){this.device=e,this.renderer=t,this.settings=s,this.renderingBuffer=new N(this.device),this.renderTargetPool=i,this.shaderPasses=null}collectShadows(e,t,s){const n=this.renderer.unityIds,r=this.device.width,a=this.device.height,o=this.getRenderTarget(r,a);this.renderer.setCameraTarget(e,o,!0),n.shadowMapTexture.setValue(s.shadowMapTexture),this.updateShadowUniformArraysFromData(s),n.shadowSplitSqRadii.setValue(D),n.shadowSplitSpheres.setValue(O),n.worldToShadow.setValue(L);const h=function(e,t,s=new i.c){let n=e._node.position,r=t;const a=I(e);let o=R.vectorOffset.set(0,0,-a*r);return o=e.viewInvMat.transformVector(o,o),n=R.sphereCenter.add2(n,o),r*=1-a,s.center.copy(n),s.radius=r,s}(e,this.settings.shadowDistance,U.sphericalShadowRange),l=function(e,t,s,n,r=new i.n){const a=e.radius-.2*n;return r.x=1-s.shadowStrength,r.y=t.farClip/n,r.z=1/(e.radius-a),r.w=-a/(e.radius-a),r}(h,e,t,this.settings.shadowDistance,U.shadowFadeData);n.lightShadowData.setValue(l.data);const c=function(e,t=new i.n){return t.x=e.center.x,t.y=e.center.y,t.z=e.center.z,t.w=1,t}(h,U.shadowCenterData);n.shadowFadeCenterAndType.setValue(c.data),n.modelMatrixId.pushValue(i.i.IDENTITY.data),n.viewProjId.pushValue(F.normalizedOrthographicProjection.data),n.camToWorldId.pushValue(U.cameraToWorldMatrix.mul2(e.viewInvMat,F.inverseForwardMatrix).data),this.updateCameraFarPlaneAttribute(e);const d=this.getShaderVariant(t);return(0,w.b)(this.device,o,this.renderingBuffer.vertexBuffer,this.renderingBuffer.indexBuffer,this.renderingBuffer.primitive,d.shader),n.modelMatrixId.popValue(),n.viewProjId.popValue(),n.camToWorldId.popValue(),o}updateCameraFarPlaneAttribute(e){const t=e.farClip,s=Math.tan(e.fov*i.e/2)*t,n=s*e.aspectRatio,r=U.cameraFarPlanePoints;r[0].set(-n,-s,t),r[1].set(n,-s,t),r[2].set(-n,s,t),r[3].set(n,s,t),this.renderingBuffer.updateCameraFarPlaneAttribute(r)}updateShadowUniformArraysFromData(e){D.fill(0),O.fill(0),L.fill(0);for(let t=0;t<e.shadowMapsLength;t++){const s=e.getShadowMapData(t),i=s.boundingSphere.radius*s.boundingSphere.radius;D[t]=i,O.set(s.boundingSphere.center.data,4*t),O[4*t+3]=i,L.set(s.worldToShadowMatrix.data,16*t)}for(let t=e.shadowMapsLength;t<4;t++)D[t]=Number.NEGATIVE_INFINITY,O[4*t+3]=Number.NEGATIVE_INFINITY,L[16*t+15]=1}getRenderTarget(e,t){const s=n.c.PIXELFORMAT_R8_G8_B8_A8;return this.renderTargetPool.getTempRenderTarget(e,t,s)}getShaderVariant(e){U.shaderKeywords.clear(),U.shaderKeywords.enableKeyword("SHADOWS_SPLIT_SPHERES"),1===this.settings.shadowCascades&&U.shaderKeywords.enableKeyword("SHADOWS_SINGLE_CASCADE");const t=this.settings.getShadowsModeForLight(e);return this.getShaderPasses()[t].getVariant(U.shaderKeywords,!0,!1)}getShaderPasses(){if(!this.shaderPasses){this.shaderPasses=[];const e=UnityEngine.Shader.Find("Hidden/Internal-ScreenSpaceShadows").handle;for(let t=0;t<e.passes.length;t++){const s=e.passes[t];switch(s.tags.find((e=>"SHADOWMAPFILTER"===e.name.toUpperCase())).value){case"HardShadow":this.shaderPasses[n.c.SHADOWS_MODE_HARD_SHADOWS]=s;break;case"PCF_SOFT":this.shaderPasses[n.c.SHADOWS_MODE_SOFT_SHADOWS]=s}}}return this.shaderPasses}}class N{constructor(e){this.device=e,this._vertexBuffer=this.createVertexBuffer(),this._indexBuffer=this.createIndexBuffer(),this._primitive=this.createPrimitive()}get vertexBuffer(){return this._vertexBuffer}get indexBuffer(){return this._indexBuffer}get primitive(){return this._primitive}updateCameraFarPlaneAttribute(e){const t=new Float32Array(this.vertexBuffer.lock());for(let s=0;s<e.length;s++){const i=e[s],n=7*s+4;t[n+0]=i.x,t[n+1]=i.y,t[n+2]=i.z}this.vertexBuffer.unlock()}createVertexBuffer(){const e=new u.a(this.device,[{semantic:n.c.SEMANTIC_POSITION,components:2,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_TEXCOORD0,components:2,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_TEXCOORD1,components:3,type:n.c.TYPE_FLOAT32}]),t=new y.a(this.device,e,4),s=new C.a(t);return s.element[n.c.SEMANTIC_POSITION].set(0,0),s.element[n.c.SEMANTIC_TEXCOORD0].set(0,0),s.next(),s.element[n.c.SEMANTIC_POSITION].set(1,0),s.element[n.c.SEMANTIC_TEXCOORD0].set(1,0),s.next(),s.element[n.c.SEMANTIC_POSITION].set(0,1),s.element[n.c.SEMANTIC_TEXCOORD0].set(0,1),s.next(),s.element[n.c.SEMANTIC_POSITION].set(1,1),s.element[n.c.SEMANTIC_TEXCOORD0].set(1,1),s.end(),t}createIndexBuffer(){const e=new b.a(this.device,n.c.INDEXFORMAT_UINT8,6,n.c.BUFFER_STATIC),t=new Uint8Array(e.lock());return t[0]=0,t[1]=1,t[2]=2,t[3]=2,t[4]=1,t[5]=3,e.unlock(),e}createPrimitive(){return{type:n.c.PRIMITIVE_TRIANGLES,base:0,count:6,indexed:!0}}}var k=s(33);const z={shadowBounds:new i.b,shadowMatrix:new i.i,lightMatrixXAxis:new i.m,lightMatrixYAxis:new i.m,lightMatrixZAxis:new i.m};class V{constructor(e){this.settings=e,this._node=new p.g,this._camera=new k.a,this._camera._node=this.node}get camera(){return this._camera}get node(){return this._node}updateFromDirectionalLight(e,t,s){const i=t.getShadowMapData(s),n=this.calculateShadowBounds(t.lightMatrix,i,z.shadowBounds),r=.1*n.halfExtents.z,a=2.3*n.halfExtents.z,o=z.shadowMatrix.setOrtho(-n.halfExtents.x,n.halfExtents.x,-n.halfExtents.y,n.halfExtents.y,r,a),h=this.settings.getShadowMapSizeForLight(e);this.node.position=this.calculateShadowCameraPosition(t.lightMatrix,n,h,h,this.node.position),this.node.rotation.setFromMat4(t.lightMatrix),this.camera.setProjectionMatrix(o),i.worldToShadowMatrix.copy(this.camera.viewProjMat)}calculateShadowCameraPosition(e,t,s,n,r=new i.m){const a=e.getX(z.lightMatrixXAxis),o=e.getY(z.lightMatrixYAxis),h=e.getZ(z.lightMatrixZAxis);e.transformPoint(t.center,r);const l=a.dot(r),c=o.dot(r),d=l%(2*t.halfExtents.x/s),u=c%(2*t.halfExtents.y/n);return r.x-=a.x*d+o.x*u+h.x*t.halfExtents.z*1.2,r.y-=a.y*d+o.y*u+h.y*t.halfExtents.z*1.2,r.z-=a.z*d+o.z*u+h.z*t.halfExtents.z*1.2,r}calculateShadowBounds(e,t,s=new i.b){switch(this.settings.shadowProjection){case 0:return this.calculateShadowBoundsForCloseFitProjection(e,s);case 1:return this.calculateShadowBoundsForStableProjection(e,t,s)}return s.center.copy(i.m.ZERO),s.halfExtents.copy(i.m.ZERO),s}calculateShadowBoundsForStableProjection(e,t,s=new i.b){const n=t.boundingSphere;return s.center=e.transformPointInverse(n.center,s.center),s.halfExtents.set(n.radius,n.radius,n.radius),s}calculateShadowBoundsForCloseFitProjection(e,t=new i.b){return t.center.copy(i.m.ZERO),t.halfExtents.copy(i.m.ZERO),t}}class G{constructor(e){this._shadowMapRenderTarget=e,this._shadowMapData=[],this._lightMatrix=new i.i}get lightMatrix(){return this._lightMatrix}get shadowMapRenderTarget(){return this._shadowMapRenderTarget}get shadowMapTexture(){return this._shadowMapRenderTarget.depthBuffer}get shadowMapsLength(){return this._shadowMapData.length}getShadowMapData(e){return this._shadowMapData[e]}setShadowMapData(e,t){this._shadowMapData[e]=t}}class H{constructor(){this._worldToShadowMatrix=(new i.i).setIdentity(),this._boundingSphere=new i.c}get worldToShadowMatrix(){return this._worldToShadowMatrix}get boundingSphere(){return this._boundingSphere}}const j=(new i.i).setScale(.5,.5,.5).setTranslation(new i.m(.5,.5,.5)),W={worldToShadowMatrixOffset:new i.i,cascadeDimensions:[0,0],shadowBias:new i.n,shadowCasters:[],visibleShadowCasters:[[],[],[],[]]};class Y{constructor(e,t,s,i){this.device=e,this.renderer=t,this.settings=s,this.depthPass=new A(e,t),this.shadowCamera=new V(s),this.renderTargetPool=i}render(e,t,s){const[i,n]=function(e,t=[0,0]){let s=1,i=1;return 2===e?s=2:4===e&&(s=2,i=2),t[0]=s,t[1]=i,t}(this.settings.shadowCascades,W.cascadeDimensions),r=this.settings.getShadowMapSizeForLight(s),a=r,o=r*n/i,h=a/i,l=o/n,c=this.getRenderTarget(a,o),d=new G(c);d.lightMatrix.setRotation(s._node.rotation);for(let t=0;t<this.settings.shadowCascades;t++){const s=new H;v(e,t,this.settings.shadowDistance,this.settings.shadowProjection,this.settings.shadowCascadesSplit,s.boundingSphere),d.setShadowMapData(t,s)}const u=this.selectShadowCasters(s,t,W.shadowCasters),_=f.a.cullShadowCascades(e,d,u,W.visibleShadowCasters);p.d.instance.recordShadowCasters(_),this.setScissorsWithBorders(c.width,c.height,1),this.setPolygonOffset(!0,1,1);for(let e=0;e<n;e++)for(let t=0;t<i;t++){const a=e*i+t,o=d.getShadowMapData(a);this.shadowCamera.updateFromDirectionalLight(s,d,a),o.worldToShadowMatrix.mul2(j,o.worldToShadowMatrix);const u=W.worldToShadowMatrixOffset;u.setScale(1/i,1/n,1),u.e03=t/i,u.e13=e/n,o.worldToShadowMatrix.mul2(u,o.worldToShadowMatrix);const m=P(s,this.shadowCamera.camera.projMat,r,W.shadowBias);this.renderer.unityIds.lightShadowBias.pushValue(m.data);const p=t*h,g=e*l;this.renderer.setCameraTarget(this.shadowCamera.camera,c,!1),this.device.setViewport(p,g,h,h),this.depthPass.updateDepthTexture(_[a],E),this.renderer.unityIds.lightShadowBias.popValue()}return this.setPolygonOffset(!1),this.setScissorsWithBorders(c.width,c.height,0),d}selectShadowCasters(e,t,s=[]){let i=0;for(let r=0;r<t.length;r++){const a=t[r],o=0!=(a._shaderDefs&n.c.SHADERDEF_CAST_SHADOWS),h=0!=(e.cullingMask&a.node.layerMask);o&&h&&(s[i++]=a)}return s.length=i,s}getRenderTarget(e,t){const s=n.c.PIXELFORMAT_DEPTH,i=DEBUG?n.c.PIXELFORMAT_RGBA16F:null,r=this.renderTargetPool.getTempRenderTarget(e,t,i,s);return this.renderer.clearTarget(r,this.depthPass.clearOptions),r}setPolygonOffset(e,t=0,s=0){e?this.device.gl.enable(this.device.gl.POLYGON_OFFSET_FILL):this.device.gl.disable(this.device.gl.POLYGON_OFFSET_FILL),this.device.gl.polygonOffset(t,s)}setScissorsWithBorders(e,t,s){this.device.setScissor(s,s,e-2*s,t-2*s)}}const K={shadowRenderingResult:new class{constructor(){this.renderTarget=null,this.mask=null}shouldRenderShadows(e){const t=!!this.renderTarget,s=0!=(this.mask&e.node.layerMask);return t&&s}}};class Q{constructor(e,t,s,i){this.settings=s,this.renderTargetPool=i,this.shadowMapRenderingPass=new Y(e,t,s,i),this.shadowMapCollectorPass=new B(e,t,s,i)}render(e,t,s){const i=K.shadowRenderingResult;i.mask=0,i.renderTarget=null;const n=s[0],r=this.shadowMapRenderingPass.render(e,t,n),a=this.shadowMapCollectorPass.collectShadows(e,n,r);return this.renderTargetPool.releaseTempRenderTarget(r.shadowMapRenderTarget),i.renderTarget=a,i.mask=n.cullingMask,i}isShadowsEnabled(e){if(this.settings.shadowsEnabled)for(let t=0;t<e.length;t++){const s=e[t];if(this.settings.getShadowsModeForLight(s)>0&&s.castShadows)return!0}return!1}}class X{constructor(e){this._projectSettings=e,this._qualitySettings=e.qualitySettings}get shadowsMode(){return this._qualitySettings.shadows}get shadowsEnabled(){return this._projectSettings.enableRealtimeShadows&&this.shadowsMode>n.c.SHADOWS_MODE_NO_SHADOWS}get shadowmaskMode(){return this._qualitySettings.shadowmaskMode}get shadowDistance(){return this._qualitySettings.shadowDistance}get shadowNearPlaneOffset(){return this._qualitySettings.shadowNearPlaneOffset}get shadowProjection(){return this._qualitySettings.shadowProjection}get shadowCascades(){const e=this._qualitySettings.shadowCascades;return 0===e?1:e}get shadowCascadesSplit(){return 2===this.shadowCascades?[0,this._qualitySettings.shadowCascade2Split,1]:4===this.shadowCascades?[0,this._qualitySettings.shadowCascade4Split.x,this._qualitySettings.shadowCascade4Split.y,this._qualitySettings.shadowCascade4Split.z,1]:[0,1]}get shadowResolution(){return this._qualitySettings.shadowResolution}getShadowsModeForLight(e){const t=e.shadowsMode,s=this.shadowsMode;return Math.min(s,t)}getShadowMapSizeForLight(e){return this.getMaxShadowMapSizeForLight(e)*this.getShadowResolutionMultiplier(e)}getMaxShadowMapSizeForLight(e){switch(e.type){case n.c.LIGHTTYPE_DIRECTIONAL:return 4096;case n.c.LIGHTTYPE_SPOT:return 2048;case n.c.LIGHTTYPE_POINT:return 1024}return 0}getShadowResolutionMultiplier(e=null){let t=this.shadowResolution;switch(e&&e.shadowResolution!==n.c.SHADOW_RESOLUTION_FROM_QUALITY_SETTINGS&&(t=e.shadowResolution),t){case n.c.SHADOW_RESOLUTION_LOW:return.125;case n.c.SHADOW_RESOLUTION_MEDIUM:return.25;case n.c.SHADOW_RESOLUTION_HIGH:return.5;case n.c.SHADOW_RESOLUTION_VERY_HIGH:return 1}return 1}}var q=s(14),$=s(27),J=s(32),Z=s(37),ee=s(34),te=s(39),se=s(5);class ie{constructor(e){this.device=e,this.gl=this.device.gl,this.availableBuffers=[],this.releasedBuffers=[];for(let e=0;e<2;e++)this.releasedBuffers[e]=[]}get(e,t){let s=null;return this.availableBuffers.length>0&&(s=this.availableBuffers.pop()),this.prepareBuffer(s,e,t)}release(e){this.releasedBuffers[this.releasedBuffers.length-1].push(e)}claimReleasedBuffers(){const e=this.releasedBuffers[0];this.availableBuffers.push(...e),e.length=0;for(let e=1;e<this.releasedBuffers.length;e++)this.releasedBuffers[e-1].push(...this.releasedBuffers[e]),this.releasedBuffers[e].length=0}prepareBuffer(e,t,s){return e}}class ne extends ie{prepareBuffer(e,t,s){const i=se.c.getFormatSize(t),n=s.byteLength/i;e||(e=new se.c(this.device,t,n,q.a.BUFFER_DYNAMIC)),e.format!==t&&(e.format=t,e.bytesPerIndex=i,e.numIndices=e.numBytes/i),e.numIndices<n&&e.resize(n);return new Uint8Array(e.lock()).set(s),e.unlockSlice(0,s.byteLength),e}}class re extends ie{prepareBuffer(e,t,s){const i=s.byteLength/t.size;e||(e=new se.y(this.device,t,i,q.a.BUFFER_DYNAMIC)),e.format!==t&&(e.format=t,e.numVertices=e.numBytes/t.size),e.numVertices<i&&e.resize(i),e.numVertices=i;return new Uint8Array(e.lock()).set(s),e.unlockSlice(0,s.byteLength),e}}const ae={buffer:new(s(40).a)};class oe{constructor(e){this.device=e,this.app=p.a.getApplication(),this.vertexBufferPool=new re(e),this.indexBufferPool=new ne(e),this.globalBatchGroupId=-1,this.batchGroups=new Map,this.usedbatchGroups=[],this.maxPatchUsedUniformVectors=this.getMaxUniformVectorsUsedByPatches()}releaseBuffers(){for(const[e,t]of this.batchGroups)this.usedbatchGroups[e]||(t.vertexBuffer&&this.vertexBufferPool.release(t.vertexBuffer),t.indexBuffer&&this.indexBufferPool.release(t.indexBuffer),this.batchGroups.delete(e));this.usedbatchGroups=[],this.vertexBufferPool.claimReleasedBuffers(),this.indexBufferPool.claimReleasedBuffers()}getBatchGroup(e,t){const s=e[t];if(!p.i.instance.enableDynamicBatching||s.isIndexBufferEmpty||s.instancingData||s.skinInstance)return null;const i=s.node.lossyScale,n=i.x,r=i.y,a=i.z,o=s.mesh.vertexBuffer.format.channels,h=s.material.$id,l=this.calculateMaxBatchesAmount(s.material);let c=1;for(let i=t+1;i<e.length;i++){const t=e[i],d=t.node.lossyScale,u=d.x,_=d.y,m=d.z;if(c>=l||h!==t.material.$id||s._shaderDefs!==t._shaderDefs||s.key!==t.key||o!==t.mesh.vertexBuffer.format.channels||t.skinInstance||Math.sign(n)!==Math.sign(u)||Math.sign(r)!==Math.sign(_)||Math.sign(a)!==Math.sign(m))break;if(!s.batchId||s.batchId!==t.batchId){if(!le(s.parameters,t.parameters))break;if(!de(s.constAttributes,t.constAttributes))break}c++}let d=null;if(c>1){const i=s.batchId||this.getNextBatchGroupId();d=this.batchGroups.get(i)||new ee.c(i),this.batchGroups.set(i,d),this.usedbatchGroups[i]=d;const n=[...d.instances];d.instances.length!==c&&(d.flags|=ee.b.Dirty),d.instances.length=c;for(let s=0;s<d.instances.length;s++){const r=e[t+s];r.isStatic||(d.flags|=ee.b.Dynamic),r.batchId!==d.id&&(d.flags|=ee.b.InvalidBatchId),r.mesh.vertexBuffer.batchId!==i&&(d.flags|=ee.b.Dirty),d.instances[s]!==r&&(d.flags|=ee.b.Dirty,d.instances[s]=r),s<n.length&&n[s]!==d.instances[s]&&(d.flags|=ee.b.Dirty)}}return c>1?(Z.a.instance.recordBatchedInstances(c),Z.a.instance.recordInstancesPerBatch(c),d.flags&ee.b.Dirty?Z.a.instance.recordDirtyBatchGroup():d.flags&ee.b.Dynamic?Z.a.instance.recordDynamicBatchGroup():Z.a.instance.recordUntouchedBatchGroup()):Z.a.instance.recordNonBatchedInstance(),Z.a.instance.recordPossibleInstancesPerBatch(l),d}updateBatchGroup(e){if(e.flags&ee.b.Dirty){e.vertexBuffer&&this.vertexBufferPool.release(e.vertexBuffer),e.indexBuffer&&this.indexBufferPool.release(e.indexBuffer);const t=this.batchVertexBuffer(e.instances),[s,i]=this.batchIndexBuffer(e.instances),n=this.batchMatrices(e.instances,e.matrices),r={type:q.a.PRIMITIVE_TRIANGLES,base:0,count:i,indexed:!0};e.vertexBuffer=t,e.indexBuffer=s,e.matrices=n,e.primitive=r;for(let t=0;t<e.instances.length;t++){const s=e.instances[t];s.batchId=e.id,s.mesh.vertexBuffer.batchId=e.id}}else if(e.flags&ee.b.InvalidBatchId)for(let t=0;t<e.instances.length;t++)e.instances[t].batchId=e.id;else e.flags&ee.b.Dynamic&&(e.matrices=this.batchMatrices(e.instances,e.matrices));e.flags=ee.b.None}batchVertexBuffer(e){let t=ae.buffer;t.clear(),t=(0,te.c)(e,0,e.length,t);const s=this.updateVertexFormat(e[0].mesh.vertexBuffer.format,t.byteLength);return t=(0,te.e)(e,0,e.length,t),ae.buffer=t,this.vertexBufferPool.get(s,t.uint8Array.subarray(0,t.uint8ArrayLength))}batchIndexBuffer(e){let t=ae.buffer;t.clear(),t=(0,te.a)(e,0,e.length,t),ae.buffer=t;const s=e[0].mesh.indexBuffer[0].format,i=this.indexBufferPool.get(s,t.uint8Array.subarray(0,t.uint8ArrayLength));return[i,t.uint8ArrayLength/i.bytesPerIndex]}batchMatrices(e,t=null){let s=ae.buffer;return s.clear(),s=(0,te.b)(e,0,e.length,s),ae.buffer=s,t&&t.length===s.float32ArrayLength?(t.set(s.float32Array.subarray(0,s.float32ArrayLength)),t):s.float32Array.slice(0,s.float32ArrayLength)}updateVertexFormat(e,t){(e=Object.assign({},e)).elementMap=Object.assign({},e.elementMap),e.elements=Object.assign([],e.elements);const s=q.a.SEMANTIC_ATTR0,i={name:s,offset:t,stride:4,stream:0,scopeId:this.device.scope.resolve(s),dataType:q.a.TYPE_FLOAT32,numComponents:1,normalize:!1,size:4};return e.elementMap[s]=i,e.elements.push(i),e.size+=i.size,e}getNextBatchGroupId(){return this.globalBatchGroupId++,this.globalBatchGroupId}getMaxUniformVectorsUsedByPatches(){let e=0;return e=Math.max(e,(0,J.a)($.a.particlesPatch)),e=Math.max(e,(0,J.a)($.a.skinConstVS)),e=Math.max(e,(0,J.a)($.a.skinTexVS)),e=Math.max(e,(0,J.a)($.a.skinPatch)),e=Math.max(e,(0,J.a)($.a.uiPatch)),e}calculateMaxBatchesAmount(e){const t=e.shader.maxUsedVertexUniformVectors+this.maxPatchUsedUniformVectors;return(0,te.d)(this.device,t)}}function he(e,t){if(e.length===t.length){for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}return!1}function le(e,t){const s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;for(const i of s)if(!ce(e[i].data,t[i].data))return!1;return!0}function ce(e,t){if(e===t)return!0;const s=Array.isArray(e)&&Array.isArray(t),i=e instanceof ArrayBuffer&&t instanceof ArrayBuffer,n=ArrayBuffer.isView(e)&&ArrayBuffer.isView(t);return s?he(e,t):i?function(e,t){if(e.byteLength===t.byteLength)return he(new Uint8Array(e),new Uint8Array(t));return!1}(e,t):!!n&&function(e,t){if(e.byteLength===t.byteLength)return e instanceof Float32Array&&t instanceof Float32Array||e instanceof Int32Array&&t instanceof Int32Array||e instanceof Uint32Array&&t instanceof Uint32Array||e instanceof Int16Array&&t instanceof Int16Array||e instanceof Uint16Array&&t instanceof Uint16Array||e instanceof Int8Array&&t instanceof Int8Array||e instanceof Uint8Array&&t instanceof Uint8Array||e instanceof Uint8ClampedArray&&t instanceof Uint8ClampedArray?he(e,t):he(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength));return!1}(e,t)}function de(e,t){const s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;for(const i of s)if(!ce(e[i],t[i]))return!1;return!0}var ue=s(60);const _e=[];for(let e=0;e<8;e++)_e.push(new i.m);const me=new i.i,pe=new i.i,ge=new i.i,fe=new i.i,ye=new i.i,Ee=new i.i,Te=new i.i,Se=new i.i,Ae=new i.i,be=new i.i,Ce=new i.i,we=new i.i,xe=[0,0,0,0],Re=new Float32Array(4),Ie=new i.i,Me=new i.i,Pe={},ve=[0,0];let De,Oe;const Le=new Float32Array(24),Fe=i.i.IDENTITY.clone(),Ue=i.i.IDENTITY.clone(),Be=[0,0,0,0],Ne=[0,0,0,0],ke=["unity_SHAr","unity_SHAg","unity_SHAb","unity_SHBr","unity_SHBg","unity_SHBb","unity_SHC"],ze=["unity_SpecCube0","unity_SpecCube0_BoxMin","unity_SpecCube0_BoxMax","unity_SpecCube0_ProbePosition","unity_SpecCube1","unity_SpecCube1_BoxMin","unity_SpecCube1_BoxMax","unity_SpecCube1_ProbePosition"],Ve={min0:[-1/0,-1/0,-1/0,0],max0:[1/0,1/0,1/0,1],position0:[0,0,0,0],min1:[-1/0,-1/0,-1/0,1],max1:[1/0,1/0,1/0,1],position1:[0,0,0,0]};let Ge=null,He=null;const je=new r.a,We=new r.a,Ye=new Float32Array([0,0,0,0]),Ke=new Float32Array(4),Qe=new Float32Array(4),Xe=new Float32Array(4),qe=new Float32Array(4),$e=new Float32Array(4),Je=new Float32Array(16),Ze=new Float32Array(16),et=new Float32Array(4),tt=new Float32Array(4),st=new h.a,it=new h.a,nt=[],rt=[],at=[],ot=[],ht=[],lt=[];let ct=null,dt=null,ut=null;const _t={};let mt={},pt={},gt=null,ft=!1;const yt=new i.b,Et=function(e){return!(0===e.comp.val||8===e.comp.val&&0===e.pass.val&&0===e.fail.val&&0===e.zFail.val)},Tt=l.a.unityCompareFunctionToPlaycanvas,St=l.a.unityStencilOpToPlaycanvas,At=l.a.unityBlendModeToPlaycanvas,bt=l.a.unityCullModeToPlaycanvas,Ct=l.a.unityBlendOpToPlaycanvas;function wt(e){return"hlslcc_mtx4x4"+e+"[0]"}class xt{constructor(e,t,s={}){this.device=e,this.app=p.a.getApplication();const i=this.device;this.scene=t,this.lightData=new o,this.currentDirLight=null,He=new c.a({}),Ge=new c.a({}),this._forwardTime=0,this._skinTime=0,this._morphTime=0,this._instancingTime=0,this.clearMaskStencil=new c.a({}),this.library=i.getProgramLibrary();const n=i.scope;this.viewProjId=n.resolve("matrix_viewProjection"),this.viewInvId=n.resolve("matrix_viewInverse"),this.modelMatrixId=n.resolve("matrix_model"),this.poseMatrixId=n.resolve("matrix_pose[0]"),this.boneTextureId=n.resolve("texture_poseMap"),this.boneTextureSizeId=n.resolve("texture_poseMapSize"),this.unityIds={modelViewProjId:n.resolve(wt("unity_MatrixMVP")),modelViewId:n.resolve(wt("unity_MatrixMV")),viewProjId:n.resolve(wt("unity_MatrixVP")),viewProjInvId:n.resolve(wt("unity_MatrixInvVP")),viewId:n.resolve(wt("unity_MatrixV")),invViewId:n.resolve(wt("unity_MatrixInvV")),legacyProjId:n.resolve(wt("glstate_matrix_projection")),transposeModelViewId:n.resolve(wt("unity_MatrixTMV")),inverseTransposeModelViewId:n.resolve(wt("unity_MatrixITMV")),modelMatrixId:n.resolve(wt("unity_ObjectToWorld")),modelMatrixInvId:n.resolve(wt("unity_WorldToObject")),cameraProjectionId:n.resolve(wt("unity_CameraProjection")),cameraInvProjectionId:n.resolve(wt("unity_CameraInvProjection")),camToWorldId:n.resolve(wt("unity_CameraToWorld")),worldToCamId:n.resolve(wt("unity_WorldToCamera")),worldSpaceCameraPos:n.resolve("_WorldSpaceCameraPos"),projectionParamsId:n.resolve("_ProjectionParams"),screenParamsId:n.resolve("_ScreenParams"),zbufferParams:n.resolve("_ZBufferParams"),cameraOrthoParamsId:n.resolve("unity_OrthoParams"),cameraWorldClipPlanesId:n.resolve("unity_CameraWorldClipPlanes[0]"),time:n.resolve("_Time"),sinTime:n.resolve("_SinTime"),cosTime:n.resolve("_CosTime"),deltaTime:n.resolve("unity_DeltaTime"),timeParameters:n.resolve("_TimeParameters"),ambientSky:n.resolve("unity_AmbientSky"),ambientEquator:n.resolve("unity_AmbientEquator"),ambientGround:n.resolve("unity_AmbientGround"),glstateLightModelAmbient:n.resolve("glstate_lightmodel_ambient"),fogParamsId:n.resolve("unity_FogParams"),fogColorId:n.resolve("unity_FogColor"),fogStart:n.resolve("unity_FogStart"),fogEnd:n.resolve("unity_FogEnd"),indirectSpecularId:n.resolve("unity_IndirectSpecColor"),lightProbeIds:new Array(ke.length),reflectionProbeIds:new Array(ze.length),worldTransformParamsId:n.resolve("unity_WorldTransformParams"),roughness:n.resolve("unity_NHxRoughness"),cameraDepthTexture:n.resolve("_CameraDepthTexture"),lastCameraDepthTexture:n.resolve("_LastCameraDepthTexture"),lightShadowBias:n.resolve("unity_LightShadowBias"),shadowMapTexture:n.resolve("_ShadowMapTexture"),shadowFadeCenterAndType:n.resolve("unity_ShadowFadeCenterAndType"),lightShadowData:n.resolve("_LightShadowData"),worldToShadow:n.resolve(wt("unity_WorldToShadow")),shadowSplitSqRadii:n.resolve("unity_ShadowSplitSqRadii"),shadowSplitSpheres:n.resolve("unity_ShadowSplitSpheres[0]")},this.lightIds={lightColor:n.resolve("_LightColor0"),worldSpaceLightPosition:n.resolve("_WorldSpaceLightPos0"),vertexX:n.resolve("unity_4LightPosX0"),vertexY:n.resolve("unity_4LightPosY0"),vertexZ:n.resolve("unity_4LightPosZ0"),vertexAttenuation:n.resolve("unity_4LightAtten0"),vertexLightColors:n.resolve("unity_LightColor[0]"),vertexLightPositions:n.resolve("unity_LightPosition[0]"),attenuationTexture:n.resolve("_LightTexture0"),fallOffTexture:n.resolve("_LightTextureB0"),matrix:n.resolve(wt("unity_WorldToLight"))};for(let e=0;e<ke.length;e++)this.unityIds.lightProbeIds[e]=n.resolve(ke[e]);for(let e=0;e<ze.length;e++)this.unityIds.reflectionProbeIds[e]=n.resolve(ze[e]);this.fogColor=new Float32Array(4),this.fogParams=new Float32Array(4),this.ambientSky=new Float32Array(4),this.lightmodel_ambient=new Float32Array(4),this._material=null,this._ambientProbe=null,this.enableRealtimeShadows=!!s.enableRealtimeShadows,this.renderingAsScreenSpace=!1,this.globalKeywords=new h.a,this._depthPass=new A(i,this),this.renderTargetPool=this.app.renderTargetPool;const r=new X(p.i.instance);this.shadowRenderer=new Q(i,this,r,this.renderTargetPool),this.shadowRenderingResult=null,this.dynamicBatcher=new oe(i),this.invertCulling=!1}getPassesFromMaterial(e){e.getPass(n.c.SHADER_PASS_ALWAYS,nt),e.getPass(n.c.SHADER_PASS_FORWARD_BASE,rt),e.getPass(n.c.SHADER_PASS_FORWARD_ADD,at),e.getPass(n.c.SHADER_PASS_VERTEX,ot),e.getPass(n.c.SHADER_PASS_VERTEX_LM,ht),e.getPass(n.c.SHADER_PASS_GRAB_PASS,lt)}updateScissor(){tt[0]=this.device.sx,tt[1]=this.device.sy,tt[2]=this.device.sw,tt[3]=this.device.sh}renderBatchGroup(e,t,s,i,r,a,o){const h=this.dynamicBatcher.getBatchGroup(e,a);if(h){this.device.geometryStateManager.unbindVertexArrayObject(),this.dynamicBatcher.updateBatchGroup(h);const e=t,a=e.mesh.vertexBuffer,l=e.mesh.indexBuffer[0],c=e.mesh.primitive[0];return e.mesh.vertexBuffer=h.vertexBuffer,e.mesh.indexBuffer[0]=h.indexBuffer,e.mesh.primitive[0]=h.primitive,e.parameters[ee.a]=new ue.a(this.device.scope.resolve(ee.a),h.matrices,0),e._shaderDefs|=n.c.SHADERDEF_BATCHING,this.renderMeshInstance(o,s,i,t,r),e.mesh.vertexBuffer=a,e.mesh.indexBuffer[0]=l,e.mesh.primitive[0]=c,delete e.parameters[ee.a],e._shaderDefs&=~n.c.SHADERDEF_BATCHING,h.instances.length-1}return this.renderMeshInstance(o,s,i,t,r),0}renderMeshInstance(e,t,s,i,r){const a=this.device,o=i.material,l=(i._shaderDefs&n.c.SHADERDEF_LM)>0;if(gt=s,!o||0===i.mesh.primitive.length||0===i.mesh.primitive[0].count)return;this.getPassesFromMaterial(o);const c=rt.length>0||at.length>0,d=ot.length>0;this.handleGrabPass(),l&&i.configureLightmap(),this.updateScissor();const u=i.morphInstance&&i.morphInstance._vertexBuffer||i.mesh.vertexBuffer;if(this.device.setVertexBuffer(u,0),this.device.setIndexBuffer(i.mesh.indexBuffer[0]),this.app.counters.recordDrawCall(),i.mesh.meshInstance){const e=i.mesh.meshInstance.instancingData;this.app.counters.recordVertices(e&&e.count>0?u.numVertices*e.count:u.numVertices)}else this.app.counters.recordVertices(u.numVertices);if(this.setSkinning(this.device,i),this.setMaterial(this.device,i.material),this.pushUniforms(this.device,i.parameters),this.setDrawCall(this.device,i),a.setDepthRange((i._shaderDefs&n.c.SHADERDEF_RENDERTYPE_BACKGROUND)>0?1:0,1),e.merge(o.keywords),l&&e.enableKeywordId(h.b.LIGHTMAP_ON),(i._shaderDefs&n.c.SHADERDEF_DIRLM)>0&&e.enableKeywordId(h.b.DIRLIGHTMAP_COMBINED),0==(i._shaderDefs&n.c.SHADERDEF_NOSHADOW)&&this.shadowRenderingResult&&this.shadowRenderingResult.shouldRenderShadows(i)&&e.enableKeywordId(h.b.SHADOWS_SCREEN),this.renderMeshInstancePasses(nt,e,i),!c&&!d)return this.popUniforms(a,i.parameters),void this.setDrawCall(a,null);c?this.drawForwardPasses(rt,at,i,r,e,l,t,s):this.drawVertexPasses(ot,ht,i,r,e,l),this.restoreScissorTest(),this.popUniforms(a,i.parameters),this.setDrawCall(a,null)}handleGrabPass(){for(let e=0;e<lt.length;e++){const t=lt[e];pt[t.grabPassTextureName]=t,ft=!0}}setupLightProbe(e,t){return!e&&t?We.copy(t):We.clear(),this.lightData.addOtherLights(We),We}drawForwardPasses(e,t,s,i,n,r,a,o){l.a.getLightsData(s,i,this.lightData),it.copy(n);const h=this.setupLightProbe(r,a);this.dispatchLightProbe(h,it,r),this.dispatchVertexLights(this.lightData.vertexLights,it),this.dispatchMainLight(o,this.lightData.mainLight,it),this.renderMeshInstancePasses(e,it,s);for(let e=0;e<this.lightData.pixelLights.length;e++){const i=this.lightData.pixelLights[e];it.copy(n),this.dispatchMainLight(o,i,it),this.renderMeshInstancePasses(t,it,s)}}drawVertexPasses(e,t,s,i,n,r){l.a.getLightsData(s,i,this.lightData),it.copy(n),this.dispatchVertexLights(this.lightData.allLights,it);const a=r?t:e;this.renderMeshInstancePasses(a,it,s)}renderMeshInstancePasses(e,t,s){for(let i=0;i<e.length;i++){const n=e[i];n.usePass||this.renderMeshInstancePass(n,t,s)}}renderGrabPass(e,t){const s=this.device,i=t.grabPassTextureName,n=this.initializeGrabPassTexture(e,i);s.setTexture(n,0),s.gl.copyTexSubImage2D(s.gl.TEXTURE_2D,0,0,0,0,0,n._width,n._height),s.scope.resolve(i).setValue(n)}initializeGrabPassTexture(e,t){let s=_t[t];const i=e?e._screenParams:[this.device.width,this.device.height];return s&&s._width===i[0]&&s._height===i[1]||(s=this.createTexture(i[0],i[1]),s.name=t,this.device.initializeTexture(s),_t[t]=s),s}createTexture(e,t){return new d.a(this.device,{format:n.c.PIXELFORMAT_R8_G8_B8,autoMipmap:!0,mipmaps:!1,width:e,height:t,minFilter:n.c.FILTER_LINEAR,magFilter:n.c.FILTER_LINEAR,addressU:n.c.ADDRESS_CLAMP_TO_EDGE,addressV:n.c.ADDRESS_CLAMP_TO_EDGE,levels:[null]})}restoreScissorTest(){this.device.setScissor(tt[0],tt[1],tt[2],tt[3])}dispatchMainLight(e,t,s){t?(Ye.set(t._finalColor),t._type===n.c.LIGHTTYPE_DIRECTIONAL?(Ke[0]=t._directionToLight.x,Ke[1]=t._directionToLight.y,Ke[2]=t._directionToLight.z,Ke[3]=0):(Ke[0]=t._position.x,Ke[1]=t._position.y,Ke[2]=t._position.z,Ke[3]=1),this.lightIds.matrix.setValue(t._worldToLightMatrix.data)):(Ye[0]=0,Ye[1]=0,Ye[2]=0,Ye[3]=0,Ke[0]=0,Ke[1]=0,Ke[2]=this.app.isUrp?-1:0,Ke[3]=0),this.lightIds.lightColor.setValue(Ye),this.lightIds.worldSpaceLightPosition.setValue(Ke),t&&t._type===n.c.LIGHTTYPE_POINT?t._cookie?(s.enableKeywordId(h.b.POINT_COOKIE),this.lightIds.attenuationTexture.setValue(t._cookie||UnityEngine.Texture2D.spotTexture.handle),this.lightIds.fallOffTexture.setValue(UnityEngine.Texture2D.attenuationTexture.handle)):(s.enableKeywordId(h.b.POINT),this.lightIds.attenuationTexture.setValue(UnityEngine.Texture2D.attenuationTexture.handle)):t&&t._type===n.c.LIGHTTYPE_SPOT?(s.enableKeywordId(h.b.SPOT),this.lightIds.attenuationTexture.setValue(t._cookie||UnityEngine.Texture2D.spotTexture.handle),this.lightIds.fallOffTexture.setValue(UnityEngine.Texture2D.attenuationTexture.handle)):t&&t._cookie?(s.enableKeywordId(h.b.DIRECTIONAL_COOKIE),this.lightIds.attenuationTexture.setValue(t._cookie)):s.enableKeywordId(h.b.DIRECTIONAL)}dispatchVertexLights(e,t){if(0===e.length)t.disableKeywordId(h.b.VERTEXLIGHT_ON);else{t.enableKeywordId(h.b.VERTEXLIGHT_ON);for(let t=0;t<4;t++)if(t<e.length){const s=e[t],i=s._type===n.c.LIGHTTYPE_DIRECTIONAL?s._directionToLight:s._position,r=s._finalColor,a=s._range;Qe[t]=i.x,Xe[t]=i.y,qe[t]=i.z,Je[4*t+0]=r[0],Je[4*t+1]=r[1],Je[4*t+2]=r[2],Je[4*t+3]=r[3],Ze[4*t+0]=i.x,Ze[4*t+1]=i.y,Ze[4*t+2]=-i.z,Ze[4*t+3]=s._type===n.c.LIGHTTYPE_DIRECTIONAL?0:1,$e[t]=25/(a*a)}else Qe[t]=0,Xe[t]=0,qe[t]=0,Je[4*t+0]=0,Je[4*t+1]=0,Je[4*t+2]=0,Je[4*t+3]=0,Ze[4*t+0]=0,Ze[4*t+1]=0,Ze[4*t+2]=0,Ze[4*t+3]=0,$e[t]=0;this.lightIds.vertexX.setValue(Qe),this.lightIds.vertexY.setValue(Xe),this.lightIds.vertexZ.setValue(qe),this.lightIds.vertexAttenuation.setValue($e),this.lightIds.vertexLightColors.setValue(Je),this.lightIds.vertexLightPositions.setValue(Ze)}}dispatchLightProbe(e,t,s){if(s)t.disableKeywordId(h.b.LIGHTPROBE_SH);else{t.enableKeywordId(h.b.LIGHTPROBE_SH),e.updateUniforms();for(let t=0;t<this.unityIds.lightProbeIds.length;t++)this.unityIds.lightProbeIds[t].setValue(e.uniforms[t]._data)}}renderMeshInstancePass(e,t,s){const i=this.device,r=s.material,a=s.mesh;if(!a||!a.indexBuffer[0])return;if(window.spector&&s.node){const t=s.node._unityComponents,i=t&&t.canvasRenderer&&t.canvasRenderer[0];let r=null;i&&(r=i._parentCanvas?i._parentCanvas.entity.name:i.model.entity.name);let a=r;null===r?a=s.node.name:r!==s.node.name&&(a=r+" - "+s.node.name),window.spector.setMarker(a+": "+n.c.LIGHT_MODE_NAMES[e.lightMode])}e.updateRenderState(r),this.updateRenderState(s,e,t);let o=e.getVariant(t,!0,!0);o||(o=e.applyMissingVariant(t.getEnabledKeywords(),e,s));let h=o.getShader(s._shaderDefs);if(!i.setShader(h))return h=o.applyMissingShader(s._shaderDefs),void i.setShader(h);if(ft)for(let e=0;e<h.samplers.length;e++){const t=h.samplers[e].scopeId.name,s=pt[t];!s||"_GrabTexture"!==t&&mt[t]||(this.renderGrabPass(gt,s),mt[t]=!0)}if(window.spector){const t=o.keywords.getEnabledKeywords().join(" "),i=s.node._unityComponents,r=i&&i.canvasRenderer&&i.canvasRenderer[0];let a=null;r&&(a=r._parentCanvas?r._parentCanvas.entity.fullname:"<none>"),h._glProgram.__SPECTOR_Metadata={Material:"["+s.material.$id+"] "+s.material.name,Shader:"["+e.sourceShader.$id+"] "+e.sourceShader.name,RenderType:n.c.RENDER_TYPE_NAMES[e.renderType],LightMode:n.c.LIGHT_MODE_NAMES[e.lightMode],Keywords:0===o.keywords.cardinality?"<none>":t,RenderQueue:s.material.renderQueue,SortingLayerIndex:s.sortingLayerIndex,SortingOrder:s.sortingOrder,DrawOrder:s.drawOrder,ZDist:s.zdist,ParentCanvas:a}}this.drawInstance(i,s,a,0,!0)}setMaterial(e,t,s=!1){this._material&&(s||this._material!==t)&&this.popUniforms(e,this._material.parameters),(this._material!==t||s)&&(this.app.counters.recordMaterialSwitch(),this.pushUniforms(e,t.parameters)),this._material=t}pushUniforms(e,t){for(const s in t){const i=t[s];i.scopeId||(i.scopeId=e.scope.resolve(s)),i.scopeId.pushValue(i.data)}const s=e.scope.resolve("_ClipRect");if(s.value){const e=s.value;e[0]=-1/0,e[1]=-1/0,e[2]=1/0,e[3]=1/0,s.versionObject.increment()}else s.setValue([-1/0,-1/0,1/0,1/0])}popUniforms(e,t){for(const e in t)if(t.hasOwnProperty(e)){t[e].scopeId.popValue()}}setDrawCall(e,t){null!==t&&(et[3]=t._flipFaces?-1:1,this.unityIds.worldTransformParamsId.setValue(et))}setPass(e,t){t.updateRenderState(e);const s=this.device,i=t,n=l.a.unityCullModeToPlaycanvas(0|i.culling.val);s.setCullMode(n);const r=l.a.unityCompareFunctionToPlaycanvas(0|i.zTest.val),a=r>=0&&r<=7,o=i.zWrite.val>0;s.setBlending(!0),s.setDepthTest(a),s.setDepthWrite(o);const h=i.offsetUnits.val,c=i.offsetFactor.val;h||c?(s.setDepthBias(!0),s.setDepthBiasValues(h,c)):s.setDepthBias(!1),this.setBlendFunctionAndEquation(i),a&&s.setDepthFunc(r);const d=i.colorWriteMask.val,u=(8&d)>0,_=(4&d)>0,m=(2&d)>0,p=(1&d)>0;s.setColorWrite(u,_,m,p);const g=this.device;st.copy(this.globalKeywords),st.merge(e.keywords);let f=t.getVariant(st,!0,!0);f||(f=t.applyMissingVariant(st.getEnabledKeywords(),t,null));let y=f.getShader(0);if(!g.setShader(y))return y=f.applyMissingShader(0),void g.setShader(y);this.setMaterial(g,e,!0)}renderForward(e,t,s,i){const r=this.device,a=n.f.now();r._enableAutoInstancing&&this.prepareAutoInstancing(t,s),mt={},pt={},ft=!1;for(let n=0;n<s;n++){const s=t[n],r=s._lightProbe||this._ambientProbe;st.copy(this.globalKeywords),s.isCanvas?s.render(st,r,e,s,i):s.isSortingGroup?s.render(st,r,e,i):p.i.instance.enableDynamicBatching?n+=this.renderBatchGroup(t,s,r,e,i,n,st):this.renderMeshInstance(st,r,e,s,i)}this._material&&(this.popUniforms(r,this._material.parameters),this._material=null),r.updateEnd(),this._forwardTime+=n.f.now()-a}updateRenderState(e,t,s){const i=this.device;let r=bt(0|t.culling.val);(e._flipFaces||this.invertCulling)&&(r===n.c.CULLFACE_BACK?r=n.c.CULLFACE_FRONT:r===n.c.CULLFACE_FRONT&&(r=n.c.CULLFACE_BACK)),i.setCullMode(r);const a=Tt(0|t.zTest.val),o=a>=0&&a<=7,h=t.zWrite.val>0;i.setBlending(!0),i.setDepthTest(o),o&&i.setDepthFunc(a),i.setDepthWrite(h);const l=t.offsetUnits.val,c=t.offsetFactor.val;if(l||c?(i.setDepthBias(!0),i.setDepthBiasValues(l,c)):i.setDepthBias(!1),this.setBlendFunctionAndEquation(t),(e._shaderDefs&n.c.SHADERDEF_REVERT_STENCIL)>0){const t=e.stencilFront.ref,s=1===t;this.clearMaskStencil.func=s?n.c.FUNC_ALWAYS:n.c.FUNC_EQUAL,this.clearMaskStencil.zpass=s?n.c.STENCILOP_ZERO:n.c.STENCILOP_REPLACE,this.clearMaskStencil.ref=t>>1,this.clearMaskStencil.readMask=s?255:t>>1,this.clearMaskStencil.writeMask=s?255:t,i.applyStencilState(this.clearMaskStencil,this.clearMaskStencil,!0)}else{const s=this.isUiStencil(e),r=(e._shaderDefs&n.c.SHADERDEF_STENCIL_OVERRIDE)===n.c.SHADERDEF_STENCIL_OVERRIDE,a=Et(t.stencilOp),o=Et(t.stencilOpFront)||Et(t.stencilOpBack);(s||r)&&e.stencilFront&&e.stencilBack?(e.node.element&&s&&(this._materialToStencilState(e.material,e.stencilFront),this._materialToStencilState(e.material,e.stencilBack)),i.applyStencilState(e.stencilFront,e.stencilBack,!0)):a?(this._renderStateToStencilState(t,t.stencilOp,Ge),e.stencilFront&&(Ge=e.stencilFront),i.applyStencilState(Ge,Ge,!0)):o?(this._renderStateToStencilState(t,t.stencilOpFront,Ge),this._renderStateToStencilState(t,t.stencilOpBack,He),i.applyStencilState(Ge,He,!0)):i.applyStencilState(null,null,!0)}let d=e.parameters.hasOwnProperty("_ColorMask")?e.parameters._ColorMask.data:t.colorWriteMask.val;(e._shaderDefs&n.c.SHADERDEF_REVERT_STENCIL)>0&&(d=0);const u=(8&d)>0,_=(4&d)>0,m=(2&d)>0,p=(1&d)>0;i.setColorWrite(u,_,m,p),e.parameters.hasOwnProperty("UNITY_UI_ALPHACLIP")&&0!==e.parameters.UNITY_UI_ALPHACLIP.data&&s.enableKeyword("UNITY_UI_ALPHACLIP")}setBlendFunctionAndEquation(e){const t=At(0|e.blending.src.val),s=At(0|e.blending.dst.val),i=Ct(0|e.blending.op.val),n=At(0|e.alphaBlending.src.val),r=At(0|e.alphaBlending.dst.val),a=Ct(0|e.alphaBlending.op.val);this.device.setBlendFunctionSeparate(t,s,n,r),this.device.setBlendEquationSeparate(i,a)}isUiStencil(e){return!!(e.material.parameters._Stencil&&e.material.parameters._StencilOp&&e.material.parameters._StencilComp&&e.material.parameters._StencilReadMask&&e.material.parameters._StencilWriteMask&&e.material.parameters._ColorMask)}_renderStateToStencilState(e,t,s){s.func=Tt(0|t.comp.val),s.ref=0|e.stencilRef.val,s.readMask=0|e.stencilReadMask.val,s.writeMask=0|e.stencilWriteMask.val,s.fail=St(0|t.fail.val),s.zfail=St(0|t.zFail.val),s.zpass=St(0|t.pass.val)}_materialToStencilState(e,t){t.func=Tt(0|e.parameters._StencilComp.data),t.ref=0|e.parameters._Stencil.data,t.readMask=0|e.parameters._StencilReadMask.data,t.writeMask=0|e.parameters._StencilWriteMask.data,e.parameters._StencilZFail?t.fail=St(0|e.parameters._StencilZFail.data):t.fail=0,e.parameters._StencilZPass?t.zfail=St(0|e.parameters._StencilZPass.data):t.zfail=0,t.zpass=St(0|e.parameters._StencilOp.data)}setCamera(e,t,s=!1){const i=UnityEngine.Object.FromHandle(UnityEngine.Camera,e._component);UnityEngine.Camera.TriggerOnPreRender(i),UnityEngine.Canvas.TriggerWillRenderCanvases(),this.setCameraTarget(e,t,s),UnityEngine.Camera.TriggerOnPostRender(i)}setCameraTarget(e,t,s=!1){pe.copy(e.viewMat),me.copy(e.viewInvMat),ye.copy(e.projMat),Ee.copy(e.projInvMat),ge.copy(e.viewProjMat),fe.copy(e.invViewProjMat),Te.copy(e.cameraToWorldMat),Se.copy(e.worldToCameraMat),this.viewInvId.setValue(me.data),this.unityIds.invViewId.setValue(me.data),this.unityIds.viewId.setValue(pe.data),this.unityIds.viewProjId.setValue(ge.data),this.unityIds.viewProjInvId.setValue(fe.data),this.unityIds.legacyProjId.setValue(ye.data),this.unityIds.camToWorldId.setValue(Te.data),this.unityIds.worldToCamId.setValue(Se.data),this.unityIds.cameraProjectionId.setValue(ye.data),this.unityIds.cameraInvProjectionId.setValue(Ee.data);const i=e.projection===n.c.PROJECTION_ORTHOGRAPHIC?e.frustum.unityPlanesOrthographic:e.frustum.unityPlanesPerspective;for(let e=0,t=0;e<i.length;e++,t+=4)Le[t]=i[e][0],Le[t+1]=i[e][1],Le[t+2]=i[e][2],Le[t+3]=i[e][3];this.unityIds.cameraWorldClipPlanesId.setValue(Le);const r=e._node.getPosition();Re[0]=r.x,Re[1]=r.y,Re[2]=r.z,Re[3]=0,e._screenParams[0]=e.renderTarget?e.renderTarget.width:this.device.width,e._screenParams[1]=e.renderTarget?e.renderTarget.height:this.device.height,e._screenParams[2]=1+1/e._screenParams[0],e._screenParams[3]=1+1/e._screenParams[1],this.unityIds.worldSpaceCameraPos.setValue(Re),this.unityIds.projectionParamsId.setValue(e._projectionParams),this.unityIds.cameraOrthoParamsId.setValue(e._orthoParams),this.unityIds.screenParamsId.setValue(e._screenParams),this.unityIds.zbufferParams.setValue(e._zbufferParams);const a=this.device;a.setRenderTarget(t),a.updateBegin();let o=e.getRect();const h=t?t.width:a.width,l=t?t.height:a.height;let c=Math.floor(o.x*h),d=Math.floor(o.y*l),u=Math.floor(o.width*h),_=Math.floor(o.height*l);a.setViewport(c,d,u,_),a.setScissor(c,d,u,_),s&&a.clear(e._clearOptions),o=e._scissorRect,c=Math.floor(o.x*h),d=Math.floor(o.y*l),u=Math.floor(o.width*h),_=Math.floor(o.height*l),a.setScissor(c,d,u,_),this.viewProjId.setValue(ge.data)}dispatchGlobalLights(){if(this.ambientSky=UnityEngine.RenderSettings.ambientSkyColor.data,this.lightmodel_ambient[0]=this.ambientSky[0]/2,this.lightmodel_ambient[1]=this.ambientSky[1]/2,this.lightmodel_ambient[2]=this.ambientSky[2]/2,this.lightmodel_ambient[3]=this.ambientSky[3]/2,this.unityIds.glstateLightModelAmbient.setValue(this.lightmodel_ambient),this.unityIds.ambientSky.setValue(this.ambientSky),this.unityIds.ambientEquator.setValue(UnityEngine.RenderSettings.ambientEquatorColor.data),this.unityIds.ambientGround.setValue(UnityEngine.RenderSettings.ambientGroundColor.data),this.scene.skybox){const e=this.scene.skybox.indirectSpecular;this.unityIds.indirectSpecularId.setValue(e.data)}this._ambientProbe=UnityEngine.RenderSettings.ambientProbe||je;const e=UnityEngine.LightmapSettings.reflectionProbes,t=e&&e.environmentProbe?e.environmentProbe:null;t?(this.unityIds.reflectionProbeIds[0].setValue(t.cubemap),this.unityIds.reflectionProbeIds[1].setValue(Ve.min0),this.unityIds.reflectionProbeIds[2].setValue(Ve.max0),this.unityIds.reflectionProbeIds[3].setValue(Ve.position0),this.unityIds.reflectionProbeIds[4].setValue(t.cubemap),this.unityIds.reflectionProbeIds[5].setValue(Ve.min1),this.unityIds.reflectionProbeIds[6].setValue(Ve.max1),this.unityIds.reflectionProbeIds[7].setValue(Ve.position1)):(this.unityIds.reflectionProbeIds[0].setValue(null),this.unityIds.reflectionProbeIds[1].setValue(i.n.ZERO.data),this.unityIds.reflectionProbeIds[2].setValue(i.n.ZERO.data),this.unityIds.reflectionProbeIds[3].setValue(i.n.ZERO.data),this.unityIds.reflectionProbeIds[4].setValue(null),this.unityIds.reflectionProbeIds[5].setValue(i.n.ZERO.data),this.unityIds.reflectionProbeIds[6].setValue(i.n.ZERO.data),this.unityIds.reflectionProbeIds[7].setValue(i.n.ZERO.data))}checkSkinnedMeshVisibility(e,t,s,i){const n=e.rootBone?e.rootBone:s.node;let r=!1;for(let s=0;s<t.length;s++)i.center=n.transformPoint(e.localBounds.center,i.center),i.halfExtents.copy(n.getLossyScale()),i.halfExtents.mul(e.localBounds.halfExtents),r=r||!!f.a.isAABBVisibleInFrustum(t[s].frustum,i);return r}updateCpuSkinMatrices(e,t){if(0===t)return;const s=n.f.now();for(let s=0;s<t;s++){const t=e[s],i=t.skinInstance;if(i){if(this.app.counters.advancedMode){const e=this.checkSkinnedMeshVisibility(i.skin,this.getCameras(),t,yt);this.app.counters.recordSkinnedMesh(t,e)}for(let e=0;e<i.bones.length;e++){const t=i.bones[e];if(t&&(i._dirty=i._dirty||t._aabbVer!==i.bonesAabbVersions[e],i._dirty))break}if(i._dirty){for(let e=0;e<i.bones.length;e++){const t=i.bones[e];t&&(i.bonesAabbVersions[e]=t._aabbVer)}const e=i.skin.rootBone||t.node;i.updateMatrices(e)}}}this._skinTime+=n.f.now()-s}updateGpuSkinMatrices(e,t,s){const i=n.f.now();let r=!1;for(let i=0;i<t;i++){const t=e[i];r=!1;const n=t.skinInstance;if(!n||!n._dirty)continue;const a=n.skin;r=!!a.updateWhenOffscreen||this.checkSkinnedMeshVisibility(a,s,t,yt),r&&(n.updateMatrixPalette(),n._dirty=!1)}this._skinTime+=n.f.now()-i}updateMorphedBounds(e,t){const s=n.f.now();for(let s=0;s<t;s++){const t=e[s].morphInstance;t&&this.app.counters.recordMorphInstance(e[s]),t&&t._dirty&&t.updateBounds(e[s].mesh)}this._morphTime+=n.f.now()-s}updateMorphing(e,t){const s=n.f.now();for(let s=0;s<t;s++){if(!e[s].visibleThisFrame)continue;const t=e[s].morphInstance;t&&t._dirty&&(t.update(e[s].mesh),t._dirty=!1)}this._morphTime+=n.f.now()-s}setSkinning(e,t){t.skinInstance&&(e.supportsBoneTextures?(De=t.skinInstance.boneTexture,this.boneTextureId.setValue(De),ve[0]=De.width,ve[1]=De.height,this.boneTextureSizeId.setValue(ve)):this.poseMatrixId.setValue(t.skinInstance.matrixPalette))}setMatrix(e,t){this.device.scope.resolve(wt(e)).setValue(t)}addProceduralDrawCallToQueue(e,t){let s=Pe[t];s||(s=[],Pe[t]=s),s.push(e)}drawInstance(e,t,s,i,r){const a=e.shader.uniformsUsage;let o=t.node.worldTransform,h=t.node.worldTransformInverse;return t.skinInstance&&t.skinInstance.skin&&t.skinInstance.skin.rootBone&&(o=t.skinInstance.skin.rootBone.worldTransform,h=t.skinInstance.skin.rootBone.worldTransformInverse),t.parameters.localToWorldMatrix&&(o=Ie.set(t.parameters.localToWorldMatrix.data),0!=(a&n.c.UNIFORMS_USAGE_MAP.unity_WorldToObject)&&(h=t.parameters.worldToLocalMatrix?Me.set(t.parameters.worldToLocalMatrix.data):Me.copy(o).invert())),this.modelMatrixId.setValue(o.data),this.unityIds.modelMatrixId.setValue(o.data),this.unityIds.modelMatrixInvId.setValue(h.data),0!=(a&n.c.UNIFORMS_USAGE_MAP.unity_MatrixMVP)&&(Ae.copy(ye),Ae.mul2(Ae,pe),Ae.mul2(Ae,o),this.unityIds.modelViewProjId.setValue(Ae.data)),0!=(a&n.c.UNIFORMS_USAGE_MAP.unity_MatrixMV)&&(be.copy(pe),be.mul2(be,o),this.unityIds.modelViewId.setValue(be.data)),0!=(a&n.c.UNIFORMS_USAGE_MAP.unity_MatrixTMV)&&(Ce.copy(be),Ce.transpose(),this.unityIds.transposeModelViewId.setValue(Ce.data)),0!=(a&n.c.UNIFORMS_USAGE_MAP.unity_MatrixITMV)&&(0==(a&n.c.UNIFORMS_USAGE_MAP.unity_MatrixTMV)&&(Ce.copy(be),Ce.transpose()),we.copy(Ce),we.invert(),this.unityIds.inverseTransposeModelViewId.setValue(we.data)),Oe=t.instancingData,Oe?(e.setVertexBuffer(Oe._buffer,1,Oe.offset),e.draw(s.primitive[i],Oe.count,t.material._shader.defaultParameters,t.constAttributes,t),Oe._buffer===ct?(t.instancingData=null,Oe.count-1):0):(e.draw(s.primitive[i],null,t.material._shader.defaultParameters,t.constAttributes,t),0)}prepareAutoInstancing(e,t){const s=n.f.now();ct||this.setupInstancing(this.device);let i=0,r=0;const a=dt;for(let s=0;s<t;s++){const o=s,h=e[s],l=h.material,c=h.mesh;if(!l||!c||!l.enableAutoInstancing)continue;if(null!==h.instancingData)continue;let d=0;for(d=s+1;d<t;d++){const t=e[d],s=t.material,i=t.mesh;if(s!==l||i!==c)break}if(d-o>1){for(h.instancingData={count:d-o,offset:4*i,_buffer:ct},h._shaderDefs|=n.c.SHADERDEF_INSTANCING,r=o;r<d;r++){const t=e[r].node.getWorldTransform().data;a.set(t,i),i+=16}s=d-1}else s=o,h._shaderDefs&=~n.c.SHADERDEF_INSTANCING,h.instancingData=null}this._instancingTime+=(n.f.now()-s)/1e3,ct.unlock()}switchRenderingToScreenSpace(e){if(e!==this.renderingAsScreenSpace)if(this.renderingAsScreenSpace=e,e){const e=i.i.IDENTITY.data,t=this.device;Fe.setOrtho(0,t._width,0,t._height,-1e3,1e3),Ue.copy(Fe).invert(),this.unityIds.viewId.pushValue(e),this.unityIds.legacyProjId.pushValue(Fe.data),this.viewProjId.pushValue(Fe.data),this.unityIds.viewProjId.pushValue(Fe.data),this.unityIds.viewProjInvId.pushValue(Ue.data)}else this.unityIds.viewId.popValue(),this.unityIds.legacyProjId.popValue(),this.viewProjId.popValue(),this.unityIds.viewProjId.popValue(),this.unityIds.viewProjInvId.popValue()}setupInstancing(e){if(!ut){const t=[{semantic:n.c.SEMANTIC_TEXCOORD2,components:4,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_TEXCOORD3,components:4,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_TEXCOORD4,components:4,type:n.c.TYPE_FLOAT32},{semantic:n.c.SEMANTIC_TEXCOORD5,components:4,type:n.c.TYPE_FLOAT32}];ut=new u.a(e,t)}ct||(ct=new y.a(e,ut,e.autoInstancingMaxObjects,n.c.BUFFER_DYNAMIC),dt=new Float32Array(ct.lock()))}clearTarget(e,t){window.spector&&window.spector.setMarker("Clear RT");const s=this.device,i=s.renderTarget;s.setRenderTarget(e),s.updateBegin(),s.setColorWrite(!0,!0,!0,!0),s.setDepthWrite(!0),this.setupViewport({x:0,y:0,width:1,height:1},e.width,e.height),this.device.clear(t),s.setRenderTarget(i)}clearView(e){window.spector&&window.spector.setMarker("Clear");const t=e.camera,s=t.renderTarget,i=this.device;i.setRenderTarget(s),i.updateBegin(),i.setColorWrite(!0,!0,!0,!0),i.setDepthWrite(!0);const n=t.getRect(),r=s?s.width:i.width,a=s?s.height:i.height;this.setupViewport(n,r,a),this.processClear(e)}processClear(e){this.device.clear(e.camera._clearOptions)}setupViewport(e,t,s){const i=this.device,n=Math.floor(e.x*t),r=Math.floor(e.y*s),a=Math.floor(e.width*t),o=Math.floor(e.height*s);i.setViewport(n,r,a,o),i.setScissor(n,r,a,o)}setSceneConstants(){this.globalKeywords.copy(_.c.globalKeywords),this.dispatchGlobalLights();const e=UnityEngine.RenderSettings;e.fog&&(xe[2]=0,xe[3]=0,e.fogMode===UnityEngine.FogMode.Exponential?this.globalKeywords.enableKeywordId(h.b.FOG_EXP):e.fogMode===UnityEngine.FogMode.ExponentialSquared?this.globalKeywords.enableKeywordId(h.b.FOG_EXP2):(this.globalKeywords.enableKeywordId(h.b.FOG_LINEAR),xe[2]=-1/(e.fogEndDistance-e.fogStartDistance),xe[3]=e.fogEndDistance/(e.fogEndDistance-e.fogStartDistance)),xe[0]=e.fogDensity/Math.sqrt(Math.log(2)),xe[1]=e.fogDensity/Math.log(2),this.unityIds.fogParamsId.setValue(xe)),this.unityIds.fogColorId.setValue(e.fogColor.data),Be[0]=e.fogStartDistance,Be[1]=e.fogStartDistance,Be[2]=e.fogStartDistance,Be[3]=e.fogStartDistance,Ne[0]=e.fogEndDistance,Ne[1]=e.fogEndDistance,Ne[2]=e.fogEndDistance,Ne[3]=e.fogEndDistance,this.unityIds.fogStart.setValue(Be),this.unityIds.fogEnd.setValue(Ne);const t=UnityEngine.Time.time,s=UnityEngine.Time.deltaTime,i=UnityEngine.Time.smoothDeltaTime;this.unityIds.time.setValue([t/20,t,2*t,3*t]),this.unityIds.sinTime.setValue([Math.sin(t/8),Math.sin(t/4),Math.sin(t/2),Math.sin(t)]),this.unityIds.cosTime.setValue([Math.cos(t/8),Math.cos(t/4),Math.cos(t/2),Math.cos(t)]),this.unityIds.deltaTime.setValue([s,1/s,i,1/i]),this.unityIds.timeParameters.setValue([t,Math.sin(t),Math.cos(t),0]),UnityEngine.Texture2D.nhxRoughnessTexture&&this.unityIds.roughness.setValue(UnityEngine.Texture2D.nhxRoughnessTexture.handle)}renderComposition(){window.spector&&window.spector.clearMarker();const e=this.device,t=this.scene.getMeshInstances(),s=this.scene.meshInstancesCount;this.app.counters.startSubSection(g.a.RENDER_SKIN_AND_MORPH),this.updateCpuSkinMatrices(t,s),this.updateMorphedBounds(t,s),this.app.counters.endSubSection(g.a.RENDER_SKIN_AND_MORPH),this.scene.skybox.prepareEnvironmentReflectionsIfNeeded(),this.setSceneConstants();const i=this.getCameras();i.sort(m.a.cameraCompare),this.app.counters.startSubSection(g.a.RENDER_SKIN_AND_MORPH),this.updateGpuSkinMatrices(t,s,i),this.updateMorphing(t,s),this.app.counters.endSubSection(g.a.RENDER_SKIN_AND_MORPH),this.renderCameras(i);const r=this.scene.overlayScreens;if(r.length>0){e.setRenderTarget(null),e.updateBegin();const t=[this.device.width,this.device.height,1+1/this.device.width,1+1/this.device.height];this.unityIds.screenParamsId.setValue(t),this.setupViewport({x:0,y:0,width:1,height:1},e.width,e.height),e.clear({flags:n.c.CLEARFLAG_STENCIL}),this.switchRenderingToScreenSpace(!0);for(let e=0;e<r.length;e++){r[e].canvasMeshInstance.render(this.globalKeywords,null,null,null,this.scene._lights)}this.switchRenderingToScreenSpace(!1),e.updateEnd()}for(const e in Pe){const t=Pe[e];for(const e of t)pc.Graphics.freeProceduralMeshInstance(e);t.length=0}this.dynamicBatcher.releaseBuffers()}updateLights(e,t){const s=[];for(let i=0;i<t.length;i++){const n=t[i];n.update(e)&&s.push(n)}return s}setupGlobalKeywordsForCamera(e,t){}setupWorldScreensVisibility(e,t){for(const s of e._worldScreens)s.screenType===n.c.SCREEN_TYPE_CAMERA?s.canvasMeshInstance.visible=s.camera===t:s.canvasMeshInstance.visible=!0}getCameras(){return this.scene._cameras}renderCameras(e){for(let t=0;t<e.length;t++)this.renderCamera(e[t])}renderCamera(e){const t=e.camera,s=e.camera.renderTarget;e.frameBegin(s),UnityEngine.Camera.TriggerOnPreCull(UnityEngine.Object.FromHandle(UnityEngine.Camera,t._component)),this.setupWorldScreensVisibility(this.scene,t);const i=this.scene.getMeshInstancesCached();let n=this.scene.meshInstancesCount;const r=Pe[e.$id];r&&(n=this.addProceduralMeshes(r,i,n));const a=Pe.allcameras;a&&(n=this.addProceduralMeshes(a,i,n));const o=n,h=[],l=[];f.a.cullMasked(t,i,o,h),f.a.cullFrustum(t,h,l);const c=[],d=[];m.a.sortOpaqueAndTransparent(l,c,d),m.a.calculateSortDistances(c,t._node.getPosition(),t._node.forward),m.a.calculateSortDistances(d,t._node.getPosition(),t._node.forward);const u=this.updateLights(t,this.scene._lights);this.setupGlobalKeywordsForCamera(t,u),this.clearView(e),this.needToRenderDepth()&&(this.app.counters.startSubSection(g.a.RENDER_DEPTH),this.renderCameraDepth(e,l,u),this.app.counters.endSubSection(g.a.RENDER_DEPTH)),this.renderShadowMap(e,h,l,u),this.setCamera(t,t.renderTarget),c.sort(m.a.genericSortOpaque),this.renderForward(t,c,c.length,u);const _=this.scene.getSkyboxForRender(),p=this.getSkyboxOverride(e),y=_.meshInstance.material;_.meshInstance.material=p||y,this.drawSkybox(_,t,u),this.onOpaqueRendered(t),d.sort(m.a.genericSortTransparent),this.renderForward(t,d,d.length,u),this.freeShadowMap(),e.frameEnd(),_.meshInstance.material=y}getSkyboxOverride(e){const t=e.entity._unityComponents;return t.skybox.length>0?t.skybox[0]._material:null}addProceduralMeshes(e,t,s){for(const i of e)t.length===s?t.push(i):t[s]=i,s++;return s}needToRenderDepth(){return this.scene.hasVisibleDepthConsumers()}renderCameraDepth(e,t,s){const i=e.depthRenderTarget;this.renderDepth(e.camera,t,s,i,2500),this.setCameraDepthTexture(i.depthBuffer)}renderDepth(e,t,s,i,n){this.clearTarget(i,this._depthPass.clearOptions),this.setCameraTarget(e,i,!1),t&&t.length>0&&(l.a.getLightsData(t[0],s,this.lightData),this.dispatchMainLight(e,this.lightData.mainLight,st)),this._depthPass.updateDepthTexture(t,n)}setCameraDepthTexture(e){e&&(this.device.webgl2||this.device.extDepthTexture)?(this.unityIds.lastCameraDepthTexture.setValue(e),this.unityIds.cameraDepthTexture.setValue(e)):(this.unityIds.cameraDepthTexture.setValue(UnityEngine.Texture2D.greyTexture.handle),this.unityIds.lastCameraDepthTexture.setValue(UnityEngine.Texture2D.greyTexture.handle))}renderShadowMap(e,t,s,i){if(!this.shadowRenderer.isShadowsEnabled(i))return;const n=e.createDepthRenderTarget();this.renderDepth(e.camera,s,i,n,E),this.setCameraDepthTexture(n.depthBuffer),g.a.instance.startSubSection(g.a.RENDER_SHADOWS),this.shadowRenderingResult=this.shadowRenderer.render(e.camera,t,i),this.unityIds.shadowMapTexture.setValue(this.shadowRenderingResult.renderTarget.colorBuffer),g.a.instance.endSubSection(g.a.RENDER_SHADOWS),e.destroyDepthRenderTarget(n),this.setCameraDepthTexture(e.depthRenderTarget.depthBuffer)}freeShadowMap(){this.shadowRenderingResult&&(this.shadowRenderingResult.renderTarget&&this.renderTargetPool.releaseTempRenderTarget(this.shadowRenderingResult.renderTarget),this.shadowRenderingResult=null)}needToDrawSkybox(e,t){return!!e&&t.clearSkybox&&e.isVisible}drawSkybox(e,t,s){if(!this.needToDrawSkybox(e,t))return;e.updateSkyDrawCall(t);const i=e.meshInstance;i.cull=!1,i.visible=!0,this.renderMeshInstance(this.globalKeywords,null,null,i,s)}onOpaqueRendered(e){this.device.geometryStateManager.unbindVertexArrayObject()}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>a});const i=/uniform\s+(highp\s*|lowp\s*|mediump\s*)?(\w+)\s+(\w+)(\[(\w+)\])?/,n=new RegExp(i,"g"),r=new RegExp(i);function a(e){let t=0;const s=e.match(n);if(s)for(let e=0;e<s.length;e++){const i=s[e].match(r),n=parseInt(i[5],10);Number.isNaN(n)?t++:t+=n}return t}},(e,t,s)=>{"use strict";s.d(t,{a:()=>u});var i=s(0),n=s(1),r=s(2);const a=new i.m,o=new i.m,h=new i.m,l=new i.m,c=new i.n,d=new i.n;class u{constructor(){this._projection=r.c.PROJECTION_PERSPECTIVE,this._nearClip=.1,this._farClip=1e4,this._fov=45,this._orthoHeight=10,this._aspect=16/9,this.cullingMask=4294967295,this._usePhysicalProperties=!1,this._focalLength=50,this._sensorSize=new i.l(36,24),this._lensShift=new i.l,this._gateFit=r.c.GATE_FIT_HORIZONTAL,this._lastAabbVer=-1,this._projMatDirty=!0,this._projMat=new i.i,this._projInvMat=new i.i,this._viewMatDirty=!0,this._viewMat=new i.i,this._viewInvMat=new i.i,this._viewProjMatDirty=!0,this._viewProjMat=new i.i,this._invViewProjMat=new i.i,this._projMatOverride=null,this._rect={x:0,y:0,width:1,height:1},this._scissorRect={x:0,y:0,width:1,height:1},this._frustumDirty=!0,this._frustum=new i.f(this._projMat,this._viewMat),this.renderTarget=null,this._clearOptions={color:[.5,.5,.5,1],depth:1,stencil:0,flags:r.c.CLEARFLAG_COLOR|r.c.CLEARFLAG_DEPTH|r.c.CLEARFLAG_STENCIL|r.c.CLEARFLAG_USE_SKYBOX},this._node=null,this.calculateTransform=null,this._overrideCalculateTransform=!1,this._component=null,this._zbufferParams=new Float32Array(4),this._screenParams=new Float32Array(4),this._orthoParams=new Float32Array(4),this._projectionParams=new Float32Array(4)}worldToScreen(e,t,s,n=new i.m){return this.viewProjMat.multiplyPoint(e,n),n.x=.5*(n.x+1)*t,n.y=.5*(n.y+1)*s,l.sub2(e,this._node.getPosition()),n.z=l.dot(this._node.forward),n}screenToWorld(e,t,s,n,l,c=new i.m){const d=this._node.getPosition(),u=this.invViewProjMat;if(this._projection===r.c.PROJECTION_PERSPECTIVE){o.set(e/n*2-1,t/l*2-1,1),u.transformPoint(o,h);const i=o.x*u.data[3]+o.y*u.data[7]+o.z*u.data[11]+u.data[15];h.scale(1/i);const r=s/this._farClip;c.lerp(d,h,r)}else{const r=this._farClip-this._nearClip;a.set(e/n,t/l,(s-this._nearClip)/r),a.scale(2),a.sub(i.m.ONE),u.transformPoint(a,c)}return c}setProjectionMatrix(e){this._projMatOverride=e?e.clone():null,this._projMatDirty=!0}_updateScreens(){const e=n.a.getApplication().scene.worldScreens;for(let t=0;t<e.length;t++){const s=e[t];s.screenType===r.c.SCREEN_TYPE_CAMERA&&s._calcProjectionMatrix()}}getRect(){return this._rect}setRect(e,t,s,i){this._rect.x=e,this._rect.y=t,this._rect.width=s,this._rect.height=i,this._projMatDirty=!0}setScissorRect(e,t,s,i){this._scissorRect.x=e,this._scissorRect.y=t,this._scissorRect.width=s,this._scissorRect.height=i}setSensorSize(e,t){this._sensorSize.x=e,this._sensorSize.y=t}setLensShift(e,t){this._lensShift.x=e,this._lensShift.y=t}resetProjectionMatrix(){this._projMatOverride=null,this._projMatDirty=!0}calculateObliqueMatrix(e){c.copy(e);const t=this.projMat.clone();d.x=c.x>=0?1:-1,d.y=c.y>=0?1:-1,d.z=1,d.w=1,this.projInvMat.transformVec4(d,d),c.scale(2/c.dot(d));const s=t.data;return s[2]=c.x-s[3],s[6]=c.y-s[7],s[10]=c.z-s[11],s[14]=c.w-s[15],t}updateProjMat(){if(this._projMatOverride)this._projMat.copy(this._projMatOverride);else if(this._projection===r.c.PROJECTION_PERSPECTIVE)this._usePhysicalProperties?u.calculateProjectionMatrixFromPhysicalProperties_Unity(this._projMat,this._focalLength,this._sensorSize,this._lensShift,this._nearClip,this._farClip,this._aspect,this._gateFit):this._projMat.setPerspective(this._fov,this._aspect,this._nearClip,this._farClip);else{const e=this._orthoHeight,t=e*this._aspect;this._projMat.setOrtho(-t,t,-e,e,this._nearClip,this._farClip)}const e=this._nearClip,t=this._farClip,s=this.aspectRatio,i=this.orthoHeight;this._orthoParams[0]=i*s,this._orthoParams[1]=i,this._orthoParams[2]=0,this._orthoParams[3]=this.projection===r.c.PROJECTION_ORTHOGRAPHIC?1:0,this._zbufferParams[0]=1-t/e,this._zbufferParams[1]=t/e,this._zbufferParams[2]=this._zbufferParams[0]/t,this._zbufferParams[3]=this._zbufferParams[1]/t,this._projectionParams[0]=1,this._projectionParams[1]=e,this._projectionParams[2]=t,this._projectionParams[3]=1/t,this._projInvMat.copy(this._projMat).invert(),this._updateScreens(),this._frustumDirty=!0,this._projMatDirty=!1,this._viewProjMatDirty=!0}updateViewMat(){const e=this._node;if(this._overrideCalculateTransform)this.calculateTransform(this._viewInvMat,r.c.VIEW_CENTER);else{const t=e.getPosition(),s=e.getRotation();this._viewInvMat.setTRS(t,s,i.m.REVERSED_Z)}this._viewMat.copy(this._viewInvMat).invert();const t=e.getLossyScale();0!==t.x&&0!==t.y&&0!==t.z||UnityEngine.Debug.LogWarning$1("Camera world transform matrix has 0 scale. That leads to losing rotation data"),this._updateScreens(),this._frustumDirty=!0,this._viewMatDirty=!1,this._viewProjMatDirty=!0,this._lastAabbVer=e._aabbVer}set overrideCalculateTransform(e){this._viewMatDirty=!0,this._overrideCalculateTransform=e}get viewMatDirty(){return this._viewMatDirty||this._lastAabbVer!==this._node._aabbVer}get viewMat(){return this.viewMatDirty&&this.updateViewMat(),this._viewMat}get viewInvMat(){return this.viewMatDirty&&this.updateViewMat(),this._viewInvMat}get projMat(){return this._projMatDirty&&this.updateProjMat(),this._projMat}get projInvMat(){return this._projMatDirty&&this.updateProjMat(),this._projInvMat}get viewProjMat(){return(this.viewMatDirty||this._projMatDirty||this._viewProjMatDirty)&&(this._viewProjMat.mul2(this.projMat,this.viewMat),this._invViewProjMat.copy(this._viewProjMat).invert(),this._viewProjMatDirty=!1),this._viewProjMat}get invViewProjMat(){return(this.viewMatDirty||this._projMatDirty||this._viewProjMatDirty)&&this._invViewProjMat.copy(this.viewProjMat).invert(),this._invViewProjMat}get frustum(){return(this._frustumDirty||this.viewMatDirty||this._projMatDirty)&&(this._frustum.update(this.projMat,this.viewMat),this._frustumDirty=!1),this._frustum}get aspectRatio(){return this._aspect}set aspectRatio(e){this._aspect!==e&&(this._aspect=e,this._projMatDirty=!0)}get projection(){return this._projection}set projection(e){this._projection!==e&&(this._projection=e,this._projMatDirty=!0)}get nearClip(){return this._nearClip}set nearClip(e){this._nearClip!==e&&(this._nearClip=e,this._projMatDirty=!0)}get farClip(){return this._farClip}set farClip(e){this._farClip!==e&&(this._farClip=e,this._projMatDirty=!0)}calculateCustomFarClip(e){if(0===e)return this.frustum.planes[4][3];return this.frustum.planes[4][3]-this.farClip+e}get fov(){return this._fov}set fov(e){this._fov!==e&&(this._fov=e,this._projMatDirty=!0)}get orthoHeight(){return this._orthoHeight}set orthoHeight(e){this._orthoHeight!==e&&(this._orthoHeight=e,this._projMatDirty=!0)}get clearColor(){return this._clearOptions.color}set clearColor(e){this._clearOptions.color[0]=e[0],this._clearOptions.color[1]=e[1],this._clearOptions.color[2]=e[2],this._clearOptions.color[3]=e[3]}get clearDepth(){return this._clearOptions.depth}set clearDepth(e){this._clearOptions.depth=e}get clearSkybox(){return 0!=(this._clearOptions.flags&r.c.CLEARFLAG_USE_SKYBOX)}set clearSkybox(e){e?this._clearOptions.flags|=r.c.CLEARFLAG_USE_SKYBOX:this._clearOptions.flags&=~r.c.CLEARFLAG_USE_SKYBOX}get clearStencil(){return this._clearOptions.stencil}set clearStencil(e){this._clearOptions.stencil=e}get clearFlags(){return this._clearOptions.flags}set clearFlags(e){this._clearOptions.flags=e}get worldToCameraMat(){return this._node.worldTransformInverse.clone()}get cameraToWorldMat(){return this._node.worldTransform.clone()}set usePhysicalProperties(e){this._usePhysicalProperties!==e&&(this._usePhysicalProperties=e,this._projMatDirty=!0)}get usePhysicalProperties(){return this._usePhysicalProperties}set focalLength(e){this._focalLength!==e&&(this._focalLength=e,this._usePhysicalProperties&&(this._projMatDirty=!0))}get focalLength(){return this._focalLength}set sensorSize(e){this._sensorSize!==e&&(this._sensorSize=e,this._usePhysicalProperties&&(this._projMatDirty=!0))}get sensorSize(){return this._sensorSize}set lensShift(e){this._lensShift!==e&&(this._lensShift=e,this._usePhysicalProperties&&(this._projMatDirty=!0))}get lensShift(){return this._lensShift}set gateFit(e){this._gateFit!==e&&(this._gateFit=e,this._usePhysicalProperties&&(this._projMatDirty=!0))}get gateFit(){return this._gateFit}}u.calculateProjectionMatrixFromPhysicalProperties_Unity=(e,t,s,i,n,a,o,h)=>{const l=o*s.y/s.x,c=i.clone();let d=o,_=0,m=h;1===l?m=r.c.GATE_FIT_NONE:h===r.c.GATE_FIT_FILL&&l>1||h===r.c.GATE_FIT_OVERSCAN&&l<1?m=r.c.GATE_FIT_HORIZONTAL:(h===r.c.GATE_FIT_FILL&&l<1||h===r.c.GATE_FIT_OVERSCAN&&l>1)&&(m=r.c.GATE_FIT_VERTICAL),m===r.c.GATE_FIT_HORIZONTAL?(_=u.focalLengthToFieldOfView(t,s.x/o),c.y*=l):m===r.c.GATE_FIT_VERTICAL?(_=u.focalLengthToFieldOfView(t,s.y),c.x*=1/l):(_=u.focalLengthToFieldOfView(t,s.y),d=s.x/s.y),e.setPerspective(_,d,n,a),e.data[8]=2*c.x,e.data[9]=2*c.y},u.calculateProjectionMatrixFromPhysicalProperties=(e,t,s,i,n,r,a)=>u.calculateProjectionMatrixFromPhysicalProperties_Unity(e.v,t,s,i,n,r,a.aspect,a.mode),u.focalLengthToFieldOfView=(e,t)=>2*i.k*Math.atan(.5*t/e),u.fieldOfViewToFocalLength=(e,t)=>.5*t/Math.tan(i.k*e*.5)},(e,t,s)=>{"use strict";s.d(t,{a:()=>r,b:()=>n,c:()=>i});class i{constructor(e){this.id=e,this.flags=n.Dynamic|n.InvalidBatchId|n.Dirty,this.instances=[],this.vertexBuffer=null,this.indexBuffer=null,this.primitive=null,this.matrices=null}}const n={None:0,Dynamic:1,InvalidBatchId:2,Dirty:4},r="batching_matrices[0]"},(e,t,s)=>{"use strict";s.d(t,{a:()=>_});var i=s(21),n=s(4);const r=0,a=1;let o,h;const l={lower:null,upper:null},c={lower:null,upper:null};class d{constructor(e,t){this.time=e,this.color=t}}class u{constructor(e,t){this.time=e,this.alpha=t}}class _{constructor(e,t,s){e=e||[],t=t||[],this._colorKeys="object"!=typeof e[0]?this.formatColorKeys(e):e,this._alphaKeys="object"!=typeof t[0]?this.formatAlphaKeys(t):t,this._mode=s||r,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"ColorGradient")}sampleInplace(e,t){if(this.findExtremeColors(e,l),this.findExtremeAlphaValues(e,c),l.lower===l.upper&&c.lower===c.upper)return t.copy(l.lower.color),void(t.a=c.lower.alpha);switch(this._mode){case a:return void(l.lower.time===e?(t.copy(l.lower.color),t.a=c.lower.alpha):(t.copy(l.upper.color),t.a=c.upper.alpha));case r:{const s=(e-l.lower.time)/(l.upper.time-l.lower.time),i=(e-c.lower.time)/(c.upper.time-c.lower.time);return void this.lerpColorInPlace(l.lower.color,l.upper.color,c.lower.alpha,c.upper.alpha,s,i,t)}default:UnityEngine.Debug.LogError$1("Gradient mode: "+this._mode+" Not supported")}}evaluate(e){const t=new i.a;return this.sampleInplace(e,t),t}evaluateRef(e,t){return this.sampleInplace(e,t),t}findExtremeColors(e,t){o=h=this._colorKeys[0];for(let t=0;t<this._colorKeys.length;t++){if(!(this._colorKeys[t].time<e)){h=this._colorKeys[t];break}o=h=this._colorKeys[t]}t.lower=o,t.upper=h}findExtremeAlphaValues(e,t){o=h=this._alphaKeys[0];for(let t=0;t<this._alphaKeys.length;t++){if(!(this._alphaKeys[t].time<e)){h=this._alphaKeys[t];break}o=h=this._alphaKeys[t]}t.lower=o,t.upper=h}lerpColorInPlace(e,t,s,i,r,a,o){o.r=(0,n.g)(e.r,t.r,r),o.g=(0,n.g)(e.g,t.g,r),o.b=(0,n.g)(e.b,t.b,r),o.a=(0,n.g)(s,i,a)}formatColorKeys(e){const t=[];for(let s=0;s<e.length;s+=5){const n=e[s],r=new i.a(e[s+1],e[s+2],e[s+3],e[s+4]);t.push(new d(n,r))}return t}formatAlphaKeys(e){const t=[];for(let s=0;s<e.length;s+=2){const i=e[s],n=e[s+1];t.push(new u(i,n))}return t}setKeys(e,t){this._colorKeys=("object"!=typeof e[0]?this.formatColorKeys(e):e)||[],this._alphaKeys=("object"!=typeof t[0]?this.formatAlphaKeys(t):t)||[]}setKey(e,t){for(let t=0;t<this._colorKeys.length;t++)if(this._colorKeys[t].time===e.time){this._colorKeys[t]=e,e=null;break}e&&this._colorKeys.push(e);for(let e=0;e<this._alphaKeys.length;e++)if(this._alphaKeys[e].time===t.time){this._alphaKeys[e]=t,t=null;break}t&&this._alphaKeys.push(t)}get mode(){return this._mode}set mode(e){this._mode=e}get alphaKeys(){return this._alphaKeys}set alphaKeys(e){this._alphaKeys=e}get colorKeys(){return this._colorKeys}set colorKeys(e){this._colorKeys=e}set m_NumColorKeys(e){this._colorKeys.length=e;for(let e=0;e<this._colorKeys.length;e++)this._colorKeys[e]||(this._colorKeys[e]=new d(0,new i.a(1,1,1,1)))}set m_NumAlphaKeys(e){this._alphaKeys.length=e;for(let e=0;e<this._alphaKeys.length;e++)this._alphaKeys[e]||(this._alphaKeys[e]=new u(0,1))}setKeyInternal(e,t){this._colorKeys.length>e&&(this._colorKeys[e].color.copy(t),this._colorKeys[e].color.a=1),this._alphaKeys.length>e&&(this._alphaKeys[e].alpha=t.a)}getKey(e){const t=new i.a(1,1,1,1);return this._colorKeys.length>e&&t.copy(this._colorKeys[e].color),this._alphaKeys.length>e&&(t.a=this._alphaKeys[e].alpha),t}setATime(e,t){this._alphaKeys.length>e&&(this._alphaKeys[e].time=t)}setCTime(e,t){this._colorKeys.length>e&&(this._colorKeys[e].time=t)}get key0(){return this.getKey(0)}set key0(e){this.setKeyInternal(0,e)}set atime0(e){this.setATime(0,e)}set ctime0(e){this.setCTime(0,e)}get key1(){return this.getKey(1)}set key1(e){this.setKeyInternal(1,e)}set atime1(e){this.setATime(1,e)}set ctime1(e){this.setCTime(1,e)}get key2(){return this.getKey(2)}set key2(e){this.setKeyInternal(2,e)}set atime2(e){this.setATime(2,e)}set ctime2(e){this.setCTime(2,e)}get key3(){return this.getKey(3)}set key3(e){this.setKeyInternal(3,e)}set atime3(e){this.setATime(3,e)}set ctime3(e){this.setCTime(3,e)}get key4(){return this.getKey(4)}set key4(e){this.setKeyInternal(4,e)}set atime4(e){this.setATime(4,e)}set ctime4(e){this.setCTime(4,e)}get key5(){return this.getKey(5)}set key5(e){this.setKeyInternal(5,e)}set atime5(e){this.setATime(5,e)}set ctime5(e){this.setCTime(5,e)}get key6(){return this.getKey(6)}set key6(e){this.setKeyInternal(6,e)}set atime6(e){this.setATime(6,e)}set ctime6(e){this.setCTime(6,e)}get key7(){return this.getKey(7)}set key7(e){this.setKeyInternal(7,e)}set atime7(e){this.setATime(7,e)}set ctime7(e){this.setCTime(7,e)}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>a});const i=[];const n=new class{constructor(){this.logType="runtime",this.buildID=Deserializers.buildID,this.sessionID=this.uuidv4(),this.uniqueID="",this.userAgent=window.navigator.userAgent,this.logEvent="",this.logCount=0,this.logs=[]}uuidv4(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)))}addToGroup(e,t,s,n){if(0===n)return;if("**Exception:** "===e)return;if(i.includes(e))return;const r=this.uuidv4(),a=window.screen.width,o=window.screen.height,h=this.logs.length;this.logs.push({logID:r,order:h,description:e,details:t,timestamp:s,severity:n,screenWidth:a,screenHeight:o}),i.push(e),this.logs.length<40||this.sendToUnity("logcapacity")}sendToUnity(e){if(0===this.logs.length)return;this.logEvent=e,this.logCount=this.logs.length,this.uniqueID=this.uuidv4();const t=new Headers;t.append("Content-Type","application/json"),fetch(window.location.origin+"/runtime/diagnostics",{method:"POST",body:JSON.stringify(this),headers:t,keepalive:!0}),this.logs=[],this.logEvent=""}};window.setTimeout((()=>{n.sendToUnity("timeout")}),1e4),window.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&n.sendToUnity("visibilitychange")}),!1);class r{}r._logs=[],r._lastId=0,r.log=(e,t={},s=0,i=0,a)=>{if(!DEVELOP)return;Object.keys(t).forEach((s=>{e=e.replace(s,t[s])}));const o=(new Date).getTime(),h=r._lastId++;let l;if(s>0){const e=(a||(new Error).stack).split("\n");l=e.slice(2+i,e.length).join("\n")}r._logs.push({id:h,stackTrace:l,type:s,unix:o,message:e}),n.addToGroup(e,l,o,s)},r.info=(e,t={},s=1,i)=>{r.log(e,t,0,s,i)},r.warn=(e,t={},s=1,i)=>{r.log(e,t,1,s,i)},r.error=(e,t={},s=1,i)=>{r.log(e,t,2,s,i)},r.exception=(e,t={},s=1)=>{r.log("**Exception:** "+e.message,t,2,s,e.stack)},r.assert=(e,t,s={},i=1,n)=>{e||r.log("**Assertion failed:** "+t,s,2,i,n)};const a={Console:r}},(e,t,s)=>{"use strict";s.d(t,{a:()=>r});var i=s(13);class n{constructor(){this.reset()}get id(){return[this.batchedInstances,this.nonBatchedInstances,this.dirtyBatchGroups,this.dynamicBatchGroups,this.untouchedBatchGroups,this.minPossibleInstancesPerBatch,this.maxPossibleInstancesPerBatch,this.minInstancesPerBatch,this.maxInstancesPerBatch].join(",")}reset(){this.batchedInstances=0,this.nonBatchedInstances=0,this.dirtyBatchGroups=0,this.dynamicBatchGroups=0,this.untouchedBatchGroups=0,this.minPossibleInstancesPerBatch=Number.MAX_SAFE_INTEGER,this.maxPossibleInstancesPerBatch=Number.MIN_SAFE_INTEGER,this.minInstancesPerBatch=Number.MAX_SAFE_INTEGER,this.maxInstancesPerBatch=Number.MIN_SAFE_INTEGER}}class r{constructor(){this.data=new n,this.set=new Set}recordBatchedInstances(e){this.data.batchedInstances+=e}recordNonBatchedInstance(){this.data.nonBatchedInstances+=1}recordDirtyBatchGroup(){this.data.dirtyBatchGroups+=1}recordDynamicBatchGroup(){this.data.dynamicBatchGroups+=1}recordUntouchedBatchGroup(){this.data.untouchedBatchGroups+=1}recordPossibleInstancesPerBatch(e){this.data.minPossibleInstancesPerBatch=Math.min(this.data.minPossibleInstancesPerBatch,e),this.data.maxPossibleInstancesPerBatch=Math.max(this.data.maxPossibleInstancesPerBatch,e)}recordInstancesPerBatch(e){this.data.minInstancesPerBatch=Math.min(this.data.minInstancesPerBatch,e),this.data.maxInstancesPerBatch=Math.max(this.data.maxInstancesPerBatch,e)}markFrameEnd(){if(DEVELOP&&i.c.instance.enableDynamicBatching){const e=this.data.id;this.set.has(e)||(this.sendToUnity(this.data),this.set.add(e)),this.data.reset()}}sendToUnity(e){const t=new Headers;t.append("Content-Type","application/json"),fetch(window.location.origin+"/runtime/batching",{method:"POST",body:JSON.stringify(e),headers:t,keepalive:!0})}}r.instance=new r},(e,t,s)=>{"use strict";s.d(t,{a:()=>u});var i=s(2),n=s(0);let r=3;const a=[i.c.STENCILOP_KEEP,i.c.STENCILOP_ZERO,i.c.STENCILOP_REPLACE,i.c.STENCILOP_INCREMENT,i.c.STENCILOP_INCREMENT,i.c.STENCILOP_DECREMENT,i.c.STENCILOP_INVERT,i.c.STENCILOP_INCREMENTWRAP,i.c.STENCILOP_DECREMENTWRAP],o=[i.c.CULLFACE_NONE,i.c.CULLFACE_FRONT,i.c.CULLFACE_BACK],h=[i.c.BLENDMODE_ZERO,i.c.BLENDMODE_ONE,i.c.BLENDMODE_DST_COLOR,i.c.BLENDMODE_SRC_COLOR,i.c.BLENDMODE_ONE_MINUS_DST_COLOR,i.c.BLENDMODE_SRC_ALPHA,i.c.BLENDMODE_ONE_MINUS_SRC_COLOR,i.c.BLENDMODE_DST_ALPHA,i.c.BLENDMODE_ONE_MINUS_DST_ALPHA,i.c.BLENDMODE_SRC_ALPHA_SATURATE,i.c.BLENDMODE_ONE_MINUS_SRC_ALPHA],l=function(e,t){return t._priority-e._priority},c=new n.m,d=[],u={opacityMapChannelIDs:{r:1,g:2,b:3,a:4},getLightsData(e,t,s,a=!1){if(s.reset(),d.length=0,0===t.length)return;let o=-1;const h=e.node,u=1<<h.cullingLayer,_=h.getPosition(),m=e.aabb,p=m.getMax(),g=m.getMin(),f=(p.x-g.x)*(p.y-g.y)*(p.z-g.z);r=UnityEngine.RenderSettings._pixelLightCount;for(let e=0;e<t.length;e++){const r=t[e];if(0==(r._cullingMask&u))continue;if(0==(r._mask&i.c.MASK_DYNAMIC))continue;const a=r._aabb.getMax(),h=r._aabb.getMin();let l=Math.max(0,Math.min(p.x,a.x)-Math.max(g.x,h.x))*Math.max(0,Math.min(p.y,a.y)-Math.max(g.y,h.y))*Math.max(0,Math.min(p.z,a.z)-Math.max(g.z,h.z));if(0===f)l=r._aabb.intersects(m)?1:0;else if(l<=0&&r._type!==i.c.LIGHTTYPE_DIRECTIONAL)continue;if(r._type===i.c.LIGHTTYPE_DIRECTIONAL&&!r._cookie&&r._renderMode!==UnityEngine.LightRenderMode.ForceVertex){const e=s.mainLight;(null===e||e._luminance<r._luminance||e._luminance===r._luminance&&r._renderMode===UnityEngine.LightRenderMode.ForcePixel&&e._renderMode!==UnityEngine.LightRenderMode.ForcePixel)&&(s.mainLight=r)}if(r._effectiveLuminance=r._luminance,r._type!==i.c.LIGHTTYPE_DIRECTIONAL){c.sub2(r._position,_),r._directionToLight.copy(c);const e=c.length()/r.attenuationEnd;r._effectiveLuminance*=(0,n.o)(1/(1+25*e*e)*(0,n.o)(5*(1-e),0,1),0,1),r._range=e}d.push(r),r===s.mainLight&&(o=d.length-1),r._priority=l/(0===f?1:f),r._renderMode===UnityEngine.LightRenderMode.ForcePixel&&(r._priority+=1e4),r._renderMode===UnityEngine.LightRenderMode.Auto&&(r._priority+=100)}o>=0&&(d[o]=d[d.length-1],d.length-=1),d.sort(l);let y=0;for(y=0;y<d.length;y++){const e=d[y];if(s.pixelLights.length>=r)break;if(e._renderMode===UnityEngine.LightRenderMode.ForceVertex||a)break;s.pixelLights.push(e)}for(;y<d.length;y++){const e=d[y];if(!(e._effectiveLuminance<1e-4)){if(s.vertexLights.length>=4)break;e._type===i.c.LIGHTTYPE_DIRECTIONAL?s.otherLights.push(e):s.vertexLights.push(e)}}for(;y<d.length;y++)s.otherLights.push(d[y]);s.combineAllLights()},unityCompareFunctionToPlaycanvas:e=>e-1,unityStencilOpToPlaycanvas:e=>a[e],unityBlendModeToPlaycanvas:e=>h[e],unityCullModeToPlaycanvas:e=>o[e],unityBlendOpToPlaycanvas:e=>e<=UnityEngine.Rendering.BlendOp.Max?e:null}},(e,t,s)=>{"use strict";s.d(t,{a:()=>r,b:()=>a,c:()=>n,d:()=>h,e:()=>o});var i=s(40);function n(e,t,s,n=new i.a){for(let i=t;i<t+s;i++){const t=e[i].mesh.vertexBuffer,s=new Uint8Array(t.storage),r=n.reserve(Uint8Array,s.length);n.uint8Array.set(s,r)}return n}function r(e,t,s,n=new i.a){let r=0;for(let i=t;i<t+s;i++){const t=e[i].mesh,s=new Uint16Array(t.indexBuffer[0].storage,0,t.primitive[0].count),a=n.reserve(Uint16Array,s.length);for(let e=0;e<s.length;e++)n.uint16Array[a+e]=s[e]+r;r+=t.vertexBuffer.numVertices}return n}function a(e,t,s,n=new i.a){for(let i=t;i<t+s;i++){const t=e[i];let s=t.node.getWorldTransform().data;t.parameters.localToWorldMatrix&&(s=t.parameters.localToWorldMatrix.data);const r=n.reserve(Float32Array,s.length);n.float32Array.set(s,r)}return n}function o(e,t,s,n=new i.a){for(let i=t;i<t+s;i++){const s=e[i].mesh.vertexBuffer,r=n.reserve(Float32Array,s.numVertices);n.float32Array.fill(i-t,r,r+s.numVertices)}return n}function h(e,t){let s=(e.vertexUniformsCount-t)/4|0;return s>200?s=200:s<1&&(s=0),s}},(e,t,s)=>{"use strict";s.d(t,{a:()=>n});var i=s(4);class n{constructor(){this.byteCapacity=0,this.byteLength=0,this.createBuffers(this.byteCapacity)}get uint8ArrayLength(){return this.getLength(Uint8Array)}get uint16ArrayLength(){return this.getLength(Uint16Array)}get float32ArrayLength(){return this.getLength(Float32Array)}getLength(e){return this.byteLength/e.BYTES_PER_ELEMENT}reserve(e,t){const s=this.getLength(e),i=(s+t)*e.BYTES_PER_ELEMENT;return this.byteCapacity<i&&this.ensureByteCapacity(i),this.byteLength=this.byteLength<i?i:this.byteLength,s}clear(e=!1){e&&this.uint8Array.fill(0,0,this.uint8ArrayLength),this.byteLength=0}createBuffers(e){this.buffer=new ArrayBuffer(e),this.uint8Array=new Uint8Array(this.buffer),this.uint16Array=new Uint16Array(this.buffer),this.float32Array=new Float32Array(this.buffer)}ensureByteCapacity(e){if(this.byteCapacity=(0,i.h)(e),this.byteLength>0){const e=this.uint8Array.subarray(0,this.byteLength);this.createBuffers(this.byteCapacity),this.uint8Array.set(e)}else this.createBuffers(this.byteCapacity)}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>d,b:()=>u});var i=s(2),n=s(9),r=s(6),a=s(30),o=s(10);let h=null,l=null;const c={type:i.c.PRIMITIVE_TRIANGLES,base:0,count:6,indexed:!0};function d(e,t,s){if(null===h){const t=new n.a(e,[{semantic:i.c.SEMANTIC_POSITION,components:2,type:i.c.TYPE_FLOAT32}]);h=new r.a(e,t,4);const s=new a.a(h);s.element[i.c.SEMANTIC_POSITION].set(-1,-1),s.next(),s.element[i.c.SEMANTIC_POSITION].set(1,-1),s.next(),s.element[i.c.SEMANTIC_POSITION].set(-1,1),s.next(),s.element[i.c.SEMANTIC_POSITION].set(1,1),s.end()}if(null===l){l=new o.a(e,i.c.INDEXFORMAT_UINT8,6,i.c.BUFFER_STATIC);const t=new Uint8Array(l.lock());t[0]=0,t[1]=1,t[2]=2,t[3]=2,t[4]=1,t[5]=3,l.unlock()}u(e,t,h,l,c,s)}function u(e,t,s,n,r,a){const o=e.renderTarget;e.setRenderTarget(t),e.updateBegin();const h=t?t.width:e.width,l=t?t.height:e.height,c=h,d=l;e.setViewport(0,0,h,l),e.setScissor(0,0,c,d);const u=e.getDepthTest(),_=e.getDepthWrite(),m=e.getCullMode();e.setDepthTest(!1),e.setDepthWrite(!1),e.setCullMode(i.c.CULLFACE_NONE),e.setBlending(!1),e.setVertexBuffer(s,0),e.setIndexBuffer(n),e.setShader(a),e.draw(r,null,{}),e.setDepthTest(u),e.setDepthWrite(_),e.setCullMode(m),e.updateEnd(),e.setRenderTarget(o),e.updateBegin()}},(e,t,s)=>{"use strict";s.d(t,{a:()=>i});class i{constructor(e){this.options=e,this._rigidbodies=[],this._fauxBodies={},this._colliders=[],this._constraints=[],this._isSimulating=!1,this._world=null,this.setup()}enableRigidbody(e){this._rigidbodies.includes(e)||(this.linkBodyAndBodyComponent(e.body,e),this.addRigidbody(e.body),this._rigidbodies.push(e),this.reattachCollidersInChildren(e.entity))}disableRigidbody(e){const t=this._rigidbodies,s=t.indexOf(e);s<0||(this.removeRigidbody(e.body),this.unlinkBodyAndBodyComponent(e.body,e),t[s]=t[t.length-1],t.pop(),this.reattachCollidersInChildren(e.entity))}enableCollider(e){throw new Error("Not implemented")}disableCollider(e){throw new Error("Not implemented")}onFixedUpdate(e){this._isSimulating=!0,this.onBeforeSimulation(),this.onSimulationStep(e),this.onAfterSimulation(),this._isSimulating=!1}onBeforeSimulation(){const e=this._rigidbodies;e.sort(this.compareBodyDepths);for(let t=0;t<e.length;t++)this.preSimulationSynchronization(e[t],i.PreSyncStages.TransformToPhysics);for(let t=0;t<e.length;t++)this.preSimulationSynchronization(e[t],i.PreSyncStages.PhysicsToTransform);for(const e in this._fauxBodies)this.preSimulationSynchronization(this._fauxBodies[e],i.PreSyncStages.TransformToPhysics);for(let e=0;e<this._colliders.length;e++)this.preSimulationSynchronizationForCollider(this._colliders[e])}onAfterSimulation(){const e=this._rigidbodies;for(let t=0;t<e.length;t++){const s=e[t];this.postSimulationSynchronization(s);const i=s._entity;s._worldTransformVersion=i.aabbVersion}const t=this._colliders;for(let e=0;e<t.length;e++){const s=t[e],i=s._entity;s._worldTransformVersion=i.aabbVersion}this.handleContacts()}compareBodyDepths(e,t){return e._entity.graphDepth-t._entity.graphDepth}dispatchContact(e,t,s){return e.sendPhysicsEvent(t,s)}entityHasEventListeners(e,t){return!!e._magicMethods[t]&&0!==e._magicMethods[t].length}getCollisionMatrix(){throw new Error("Not implemented")}setIgnoreCollisionBetweenLayers(e,t,s){const i=this.getCollisionMatrix(),n=i[e]||0,r=i[t]||0;s?(i[e]=n|1<<t,i[t]=r|1<<e):(i[e]=n&~(1<<t),i[t]=r&~(1<<e))}reattachCollidersInChildren(e,t=!1){if(!e._enabledInHierarchy)return;const s=this.getAttachedColliders(e);for(let t=0;t<s.length;t++){const i=s[t],n=i.body?this.getBodyComponentForBody(i.body):null;!i.enabled||!i.body||n&&n.entity===e||(this.disableCollider(i),this.enableCollider(i))}const i=e._children;for(let e=0,s=i.length;e<s;e++){const s=i[e];this.getAttachedRigidbodyComponent(s)&&!t||this.reattachCollidersInChildren(s)}}syncHierarchyRecursive(e){this.reattachCollidersInChildren(e,!0)}syncHierarchy(e){if(e._enabledInHierarchy){if(this.getAttachedRigidbodyComponent(e))return;this.reattachCollidersInChildren(e)}}syncTransformsInChildren(e){if(!e._enabledInHierarchy)return;const t=this.getAttachedRigidbodyComponent(e);t&&this.preSimulationSynchronization(t,i.PreSyncStages.TransformToPhysics);const s=this._fauxBodies[e._guid];s&&this.preSimulationSynchronization(s,i.PreSyncStages.TransformToPhysics);const n=this.getAttachedColliders(e);for(let e=0;e<n.length;e++){const t=n[e];t.enabled&&t.body&&this.preSimulationSynchronizationForCollider(t)}const r=e._children;for(let e=0,t=r.length;e<t;e++)this.syncTransformsInChildren(r[e])}syncTransforms(e){this._isSimulating||this.syncTransformsInChildren(e)}setup(){throw new Error("Not Implemented")}onSimulationStep(e){throw new Error("Not Implemented")}getAttachedColliders(e){throw new Error("Not Implemented")}getAttachedRigidbodyComponent(e){throw new Error("Not Implemented")}attachFauxRigidbody(e){throw new Error("Not Implemented")}addRigidbody(e){throw new Error("Not Implemented")}removeRigidbody(e){throw new Error("Not Implemented")}addCollider(e,t){throw new Error("Not Implemented")}removeCollider(e,t){throw new Error("Not Implemented")}handleContacts(){throw new Error("Not Implemented")}addConstraint(e){throw new Error("Not Implemented")}removeConstraint(e){throw new Error("Not Implemented")}preSimulationSynchronization(e,t){throw new Error("Not Implemented")}preSimulationSynchronizationForCollider(e){throw new Error("Not implemented")}postSimulationSynchronization(e){throw new Error("Not Implemented")}getBodyComponentForBody(e){throw new Error("Not implemented")}linkBodyAndBodyComponent(e,t){throw new Error("Not implemented")}unlinkBodyAndBodyComponent(e,t){throw new Error("Not implemented")}getColliderComponentForCollider(e){throw new Error("Not implemented")}linkColliderAndColliderComponent(e,t){throw new Error("Not implemented")}unlinkColliderAndColliderComponent(e,t){throw new Error("Not implemented")}getJointComponentForJoint(e){throw new Error("Not implemented")}linkJointAndJointComponent(e,t){throw new Error("Not implemented")}unlinkJointAndJointComponent(e,t){throw new Error("Not implemented")}}i.PreSyncStages={TransformToPhysics:1,PhysicsToTransform:2},pc.BasePhysicsAdapter=i},(e,t,s)=>{"use strict";s.d(t,{a:()=>l,b:()=>o});var i=s(2),n=s(0);const r=(e,t)=>e%t||0;class a{constructor(e){this.events=new i.a(this),this._sound=null,this._volume=1,this._suspended=!1,this._startTime=0,this._duration=0,this._pitch=1,this._loop=!1,this._sound=null,this._state=2,this._startedAt=0,this._startOffset=null,this._currentTime=0,this._currentOffset=0,this._manager=e,this.gain=null,this._inputNode=null,this._connectorNode=null,this._initializeNodes(),this._endedHandler=this._onEnded.bind(this),this.source=null}_initializeNodes(){this.gain=this._manager.context.createGain(),this._inputNode=this.gain,this._connectorNode=this.gain,this._connectorNode.connect(this._manager.context.destination)}_addAudioListeners(){this._manager.events.on("volumechange",this._onManagerVolumeChange,this),this._manager.events.on("suspend",this._onManagerSuspend,this),this._manager.events.on("resume",this._onManagerResume,this)}playOneShot(e,t){if(!e.handle)return;this.volume=t;const s=this._createSource(e.handle.buffer);this.source.playbackRate.value=this.pitch,s&&(this._addAudioListeners(),s.start(0))}play(){if(1===this._state)return this.resume();if("running"!==this._manager.contextState&&this._manager.requestResume(),2!==this._state&&this.stop(),!this.source){if(!this._createSource())return!1}let e=r(this._startOffset,this.duration);return e=r(this._startTime+e,this._sound.duration),this._addAudioListeners(),this._duration?this.source.start(0,e,this._duration):this.source.start(0,e),this._startedAt=this._manager.contextCurrentTime,this._currentTime=0,this._currentOffset=e,this._state=0,this.volume=this._volume,this.loop=this._loop,this.pitch=this._pitch,this._manager.suspended&&this._onManagerSuspend(),!0}pause(){return!(0!==this._state||!this.source)&&(this._updateCurrentTime(),this.terminateSource(),this._startOffset=null,this._state=1,!0)}terminateSource(){this.source&&(this.source.onended=null,this.source.stop(0),this.source=null)}resume(e=!1){if(1!==this._state||this._manager.suspended)return!1;this.source||this._createSource();let t=e?UnityEngine.Time.unscaledTime:this.currentTime;return null!==this._startOffset&&(t=r(this._startOffset,this.duration),t=r(this._startTime+t,this._sound.duration),this._startOffset=null),this._duration?this.source.start(0,t,this._duration):this.source.start(0,t),this._state=0,this._startedAt=this._manager.contextCurrentTime,this._currentOffset=t,this.volume=this._volume,this.loop=this._loop,this.pitch=this._pitch,!0}stop(){return 2!==this._state&&(this._manager.events.off("volumechange",this._onManagerVolumeChange),this._manager.events.off("suspend",this._onManagerSuspend),this._manager.events.off("resume",this._onManagerResume),this._startedAt=0,this._currentTime=0,this._currentOffset=0,this.terminateSource(),this._state=2,!0)}_createSource(e=null){if(!this._sound&&!e)return null;const t=this._manager.context;return(e||this._sound.buffer)&&(this.source=t.createBufferSource(),this.source.buffer=e||this._sound.buffer,this.source.connect(this._inputNode),this.source.onended=this._endedHandler,this.source.loopStart=r(this._startTime,this.source.buffer.duration),this._duration&&(this.source.loopEnd=Math.max(this.source.loopStart,r(this._startTime+this._duration,this.source.buffer.duration)))),this.source}_updateCurrentTime(){this._currentTime=r((this._manager.contextCurrentTime-this._startedAt)*this._pitch+this._currentOffset,this.duration)}get volume(){return this._volume}set volume(e){e=(0,n.o)(e,0,1),this._volume=e,this.gain&&(this.gain.gain.value=e*this._manager.volume)}_onEnded(){this.sound&&this.sound.buffer&&this.sound.buffer.duration>this._currentTime&&1===this._state||(this.events.fire("end"),this.stop())}_onManagerVolumeChange(){this.volume=this._volume}_onManagerSuspend(){0!==this._state||this._suspended||(this._suspended=!0,this.pause())}_onManagerResume(e){this._suspended&&(this._suspended=!1,this.resume(e))}get duration(){return this._sound?this._duration?r(this._duration,this._sound.duration):this._sound.duration:0}set duration(e){this._duration=Math.max(0,Number(e)||0);const t=0===this._state;this.stop(),t&&this.play()}get isPlaying(){return 0===this._state}get isPaused(){return 1===this._state}get isStopped(){return 2===this._state}get isSuspended(){return this._suspended}get pitch(){return this._pitch}set pitch(e){this._currentOffset=this.currentTime,this._startedAt=this._manager.contextCurrentTime,this._pitch=Math.max(Number(e)||0,.01),this.source&&(this.source.playbackRate.value=this._pitch)}get loop(){return this._loop}set loop(e){this._loop=!!e,this.source&&(this.source.loop=this._loop)}get sound(){return this._sound}set sound(e){this._sound=e,2!==this._state?this.stop():this._createSource()}get currentTime(){return 1===this._state?this._currentTime:2!==this._state&&this.source?(this._updateCurrentTime(),this._currentTime):0}set currentTime(e){e<0||(0===this._state?(this.stop(),this._startOffset=e,this.play()):(this._startOffset=e,this._currentTime=e))}}class o{constructor(e){this.audio=null,this.buffer=null,this.name="",e instanceof Audio?this.audio=e:this.buffer=e}get duration(){let e=0;return this.buffer?e=this.buffer.duration:this.audio&&(e=this.audio.duration),e||0}}var h=s(1);class l extends h.k{constructor(e){super(),e=e||{},this._soundInstance=new a(h.a.getApplication()._audioManager),this._playOnAwake=void 0!==e.playOnAwake&&e.playOnAwake,this.loop=void 0!==e.loop&&e.loop,this.sound=e.sound||null,this.volume=void 0===e.volume?1:e.volume,this.pitch=void 0===e.pitch?1:e.pitch,this.time=0,this.code=UnityEngine.Object.FromHandle(UnityEngine.AudioSource,this),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"AudioSourceUnityComponent")}get playOnAwake(){return this._playOnAwake}set playOnAwake(e){this._playOnAwake=e}get loop(){return this._soundInstance.loop}set loop(e){this._soundInstance.loop=e}get time(){return this._soundInstance.currentTime}set time(e){this._soundInstance.currentTime=e}get volume(){return this._soundInstance.volume}set volume(e){this._soundInstance.volume=e}get pitch(){return this._soundInstance.pitch}set pitch(e){this._soundInstance.pitch=e}get sound(){return this._soundInstance.sound}set sound(e){this._soundInstance.sound=e}get isPlaying(){return this._soundInstance.isPlaying}onEnable(){return!!super.onEnable()&&(this._playOnAwake&&this.play(),!0)}onDisable(){return!!super.onDisable()&&(this._soundInstance.isPlaying&&this._soundInstance.stop(),!0)}play(){this._soundInstance.sound&&this._soundInstance.play()}pause(){this._soundInstance.sound&&this._soundInstance.pause()}resume(){this._soundInstance.sound&&this._soundInstance.resume()}stop(){this._soundInstance.sound&&this._soundInstance.stop()}}class c extends h.j{constructor(e){super(e),this.id="audiosourceunity"}}pc.SoundManager=class{constructor(e){this.context=null,this.context="undefined"!=typeof AudioContext?new AudioContext:new window.webkitAudioContext;const t=this.context;if(this.addInteractionListeners(),i.e.ios){const s=function(){const i=t.createBuffer(1,1,44100),n=t.createBufferSource();n.buffer=i,n.connect(t.destination),n.start(0),n.disconnect(),e.removeEventListener("touchstart",s)};e.addEventListener("touchstart",s)}this._volume=1,this._masterVolume=1,this.suspended="suspended"===this.context.state,this.resumeFromAwake=!0,this.events=new i.a(this)}addInteractionListeners(){this.resumeContext=()=>{this.context.resume(),this.suspended=!1,this.events.fire("resume",this.resumeFromAwake),this.resumeFromAwake=!1,window.removeEventListener("mousedown",this.resumeContext),window.removeEventListener("touchend",this.resumeContext)},window.addEventListener("mousedown",this.resumeContext),window.addEventListener("touchend",this.resumeContext)}suspend(){this.suspended=!0,this.events.fire("suspend")}resume(){i.e.ios?this.addInteractionListeners():(this.suspended=!1,this.events.fire("resume",this.resumeFromAwake))}requestResume(){this.context.resume()}get contextState(){return this.context.state||"undefined"}get contextCurrentTime(){return this.context.currentTime}get volume(){return this._volume*this._masterVolume}set volume(e){e=(0,n.o)(e,0,1),this._volume=e,this.events.fire("volumechange",this.volume)}set masterVolume(e){e=(0,n.o)(e,0,1),this._masterVolume=e,this.events.fire("volumechange",this.volume)}},pc.SoundInstance=a,pc.Sound=o,pc.AudioSourceUnityComponent=l,pc.AudioSourceUnitySystem=c},()=>{const e=/at (.+)\(/,t=/(.+)@/;let s=null,i="";function n(e=i){console.error(e),window.pi.logEvent("luna:crashed",!1,{errorMessage:e})}function r(){s&&clearTimeout(s),s=setTimeout((()=>{i?n(i.trim()):r()}),5e3)}function a(e){let t=null;t="string"==typeof e?e:e instanceof Error?e.message+" "+o(e.stack):e.message+" "+o(e.errorStack.stack),i=t+"\n"+i,i=i.substring(0,1024)}function o(s){const i=s.split("\n"),n=[];for(const s of i){const[,i]=e.exec(s)||t.exec(s)||[];if(i&&n.push(i.trim()),n.length>=3)break}return`[${n.join(" / ")}]`}window.addEventListener("DOMContentLoaded",(()=>{r()})),["luna:build","luna:start","luna:starting","luna:started"].forEach((e=>{window.addEventListener(e,(()=>{r()}))})),window.addEventListener("luna:started",(()=>{const e=document.getElementById("application-canvas"),t=s=>{n("WebGL context lost: "+s.statusMessage),e.removeEventListener("webglcontextlost",t)};e.addEventListener("webglcontextlost",t,{once:!0}),pc.Application.getApplication().events.once("postrender",(()=>{s&&clearTimeout(s),s=null}))})),window.addEventListener("error",a),pc.crashDetector={reportError:a}},(e,t,s)=>{"use strict";s.d(t,{a:()=>o,b:()=>c});var i=s(2);function n(e){return"string"==typeof e?e.toUpperCase().charCodeAt(0):e}const r={9:"Tab",13:"Enter",16:"Shift",17:"Control",18:"Alt",27:"Escape",37:"Left",38:"Up",39:"Right",40:"Down",46:"Delete",91:"Win"};class a{constructor(e,t){const s=e._getTargetCoords(t);this.x=NaN,this.y=NaN,s&&(this.x=s.x,this.y=s.y),this.wheel=t instanceof WheelEvent?-t.deltaY:0,this.dx=this.x-e._lastX,this.dy=this.y-e._lastY,this.button=i.c.MOUSEBUTTON_NONE,t instanceof MouseEvent&&("mousedown"===t.type||"mouseup"===t.type)&&(this.button=t.button),this.buttons=e._buttons.slice(0),this.element=t.target,this.ctrlKey=t.ctrlKey||!1,this.altKey=t.altKey||!1,this.shiftKey=t.shiftKey||!1,this.metaKey=t.metaKey||!1,this.event=t}}class o{constructor(e){this._lastX=0,this._lastY=0,this._buttons=[!1,!1,!1],this._lastbuttons=[!1,!1,!1],this._upHandler=this._handleUp.bind(this),this._downHandler=this._handleDown.bind(this),this._moveHandler=this._handleMove.bind(this),this._wheelHandler=this._handleWheel.bind(this),this._target=null,this._attached=!1,this.attach(e),this.events=new i.a(this)}_contextMenuHandler(e){e.preventDefault()}attach(e){this._target=e,this._attached||(this._attached=!0,window.addEventListener("mouseup",this._upHandler,!1),window.addEventListener("mousedown",this._downHandler,!1),window.addEventListener("mousemove",this._moveHandler,!1),window.addEventListener("wheel",this._wheelHandler,!1))}detach(){this._attached&&(this._attached=!1,this._target=null,window.removeEventListener("mouseup",this._upHandler),window.removeEventListener("mousedown",this._downHandler),window.removeEventListener("mousemove",this._moveHandler),window.removeEventListener("wheel",this._wheelHandler))}disableContextMenu(){this._target&&this._target.addEventListener("contextmenu",this._contextMenuHandler)}enableContextMenu(){this._target&&this._target.removeEventListener("contextmenu",this._contextMenuHandler)}update(){this._lastbuttons[0]=this._buttons[0],this._lastbuttons[1]=this._buttons[1],this._lastbuttons[2]=this._buttons[2]}isPressed(e){return this._buttons[e]}wasPressed(e){return this._buttons[e]&&!this._lastbuttons[e]}wasReleased(e){return!this._buttons[e]&&this._lastbuttons[e]}_handleUp(e){this._buttons[e.button]=!1;const t=new a(this,e);Number.isNaN(t.x)||this.events.fire(i.c.EVENT_MOUSEUP,t)}_handleDown(e){this._buttons[e.button]=!0;const t=new a(this,e);Number.isNaN(t.x)||this.events.fire(i.c.EVENT_MOUSEDOWN,t)}_handleMove(e){const t=new a(this,e);Number.isNaN(t.x)||(this.events.fire(i.c.EVENT_MOUSEMOVE,t),this._lastX=t.x,this._lastY=t.y)}_handleWheel(e){const t=new a(this,e);Number.isNaN(t.x)||this.events.fire(i.c.EVENT_MOUSEWHEEL,t)}_getTargetCoords(e){const t=this._target.getBoundingClientRect(),s=Math.floor(t.left),i=Math.floor(t.top);return e.clientX<s||e.clientX>=s+this._target.clientWidth||e.clientY<i||e.clientY>=i+this._target.clientHeight?null:{x:e.clientX-s,y:e.clientY-i}}}class h{constructor(e,t){const s=function(e,t){let s=0,i=0;for(;!(t instanceof HTMLElement);)t=t.parentNode;let n=t;do{s+=n.offsetLeft-n.scrollLeft,i+=n.offsetTop-n.scrollTop,n=n.offsetParent}while(n);return{x:e.pageX-s,y:e.pageY-i}}(e,t);this.id=e.identifier,this.x=s.x,this.y=s.y,this.target=t,this.touch=e}}class l{constructor(e,t){if(this.element=e.target||t,this.event=e,this.touches=[],this.changedTouches=[],e){let t,s=e.touches.length;for(t=0;t<s;t++)this.touches.push(new h(e.touches[t],this.element));for(s=e.changedTouches.length,t=0;t<s;t++)this.changedTouches.push(new h(e.changedTouches[t],this.element))}}getTouchById(e,t){let s;const i=t.length;for(s=0;s<i;s++)if(t[s].id===e)return t[s];return null}}class c{constructor(e){this._element=null,this._startHandler=this._handleTouchStart.bind(this),this._endHandler=this._handleTouchEnd.bind(this),this._moveHandler=this._handleTouchMove.bind(this),this._cancelHandler=this._handleTouchCancel.bind(this),this.attach(e),this.events=new i.a(this)}attach(e){this._element&&this.detach(),this._element=e,this._element.addEventListener("touchstart",this._startHandler,!1),this._element.addEventListener("touchend",this._endHandler,!1),this._element.addEventListener("touchmove",this._moveHandler,!1),this._element.addEventListener("touchcancel",this._cancelHandler,!1)}detach(){this._element&&(this._element.removeEventListener("touchstart",this._startHandler,!1),this._element.removeEventListener("touchend",this._endHandler,!1),this._element.removeEventListener("touchmove",this._moveHandler,!1),this._element.removeEventListener("touchcancel",this._cancelHandler,!1)),this._element=null}_handleTouchStart(e){this.events.fire("touchstart",new l(e))}_handleTouchEnd(e){this.events.fire("touchend",new l(e))}_handleTouchMove(e){e.preventDefault(),this.events.fire("touchmove",new l(e))}_handleTouchCancel(e){this.events.fire("touchcancel",new l(e))}}var d=s(14);const u={getOrientation(){switch(window.screen.orientation.type){case"portrait-primary":return d.a.PORTRAIT;case"portrait-secondary":return d.a.PORTRAIT_UPSIDE_DOWN;case"landscape-primary":return d.a.LANDSCAPE_LEFT;case"landscape-secondary":return d.a.LANDSCAPE_RIGHT;default:this.calculateOrientation()}return 0},calculateOrientation:()=>window.screen.width>window.screen.height?d.a.LANDSCAPE_LEFT:window.screen.height>window.screen.width?d.a.PORTRAIT:0};pc.Keyboard=class{constructor(e){this._element=null,this._keyDownHandler=this._handleKeyDown.bind(this),this._keyUpHandler=this._handleKeyUp.bind(this),this.events=new i.a(this),this._keymap={},this._lastmap={},e&&this.attach(e)}attach(e){this._element&&this.detach(),this._element=e,this._element.addEventListener("keydown",this._keyDownHandler,!1),this._element.addEventListener("keyup",this._keyUpHandler,!1)}detach(){this._element.removeEventListener("keydown",this._keyDownHandler),this._element.removeEventListener("keyup",this._keyUpHandler),this._element=null}toKeyIdentifier(e){e=n(e);const t=r[e.toString()];if(t)return t;let s=e.toString(16).toUpperCase();const i=s.length;for(let e=0;e<4-i;e++)s="0"+s;return"U+"+s}_handleKeyDown(e){const t=e.keyCode||e.charCode;if(void 0===t)return;const s=this.toKeyIdentifier(t);this._keymap[s]=!0}_handleKeyUp(e){const t=e.keyCode||e.charCode;if(void 0===t)return;const s=this.toKeyIdentifier(t);delete this._keymap[s]}update(){this._lastmap=Object.assign({},this._keymap)}isPressed(e){const t=n(e),s=this.toKeyIdentifier(t);return!!this._keymap[s]}wasPressed(e){const t=n(e),s=this.toKeyIdentifier(t);return!!this._keymap[s]&&!this._lastmap[s]}wasReleased(e){const t=n(e),s=this.toKeyIdentifier(t);return!this._keymap[s]&&!!this._lastmap[s]}anyKey(){return Object.keys(this._keymap).length>0}anyKeyDown(){for(const e in this._keymap)if(this._keymap.hasOwnProperty(e)&&!this._lastmap.hasOwnProperty(e))return!0;return!1}},pc.Mouse=o,pc.Touch=h,pc.TouchDevice=c,pc.TouchEvent=l,pc.DeviceOrientation=u},(e,t,s)=>{"use strict";s.d(t,{a:()=>b});var i=s(0),n=s(2);const r=new i.j,a=new i.j,o=new i.i,h=new i.i,l=new i.m,c=new i.m,d=new i.m,u=new i.m,_={invRotation:new i.j,invScale:new i.m,invRotationMatrix:new i.i,invScaleMatrix:new i.i},m={tmpMatrix:new i.i},p={parentLocalRotation:new i.j,rotationMultiplier:new i.m},g={newLocalRotation:new i.j},f={invLocalRotation:new i.j,rotationMultiplier:new i.m},y={currentRSInverse:new i.i},E={newLocalRotation:new i.j},T={tempVector:new i.m},S={tmpVector:new i.m},A={tmpVector:new i.m,tmpMatrix:new i.i,desiredLocalScale:new i.m,desiredWorldPosition:new i.m};class b{constructor(e="Untitled"){this.name=e,this.tag=null,this._localPosition=new i.m(0,0,0),this._localRotation=new i.j(0,0,0,1),this._localScale=new i.m(1,1,1),this._localEulerAngles=new i.m(0,0,0),this._localTransform=new i.i,this._position=new i.m(0,0,0),this._rotation=new i.j(0,0,0,1),this._eulerAngles=new i.m(0,0,0),this._lossyScale=new i.m(1,1,1),this._worldTransform=new i.i,this._worldTransformInverse=new i.i,this._hijackedLocalPosition=new i.m,this._hijackedLocalScale=new i.m,this._hijackedLocalEulerAngles=new i.m,this._hijackedLocalRotation=new i.j,this._aabbVer=0,this._right=null,this._up=null,this._forward=null,this._static=!1,this._parent=null,this._children=[],this._graphDepth=0,this._cullingLayer=0,this.layerMask=0,this._activeSelf=!0,this._enabledInHierarchy=!1,this.hasChanged=!0,this._layoutElements=[],this._layoutControllers=[],this._layoutSelfControllers=[],this._dimensionListeners=[],this._canvasElements=[],this._canvasGroups=[],this._meshModifiers=[],this.isPrefab=!1,this._app=null,this.events=new n.a(this),this._unityComponents={rigidbody:[],collider:[],joint:[],rigidbody2D:[],collider2D:[],joint2D:[],uiBehaviour:[],monoBehaviour:[],animator:[],animation:[],particlesystem:[],particleSystemRenderer:[],reflectionprobe:[],videoPlayer:[],canvasRenderer:[],audiosourceunity:[],renderer:[],meshFilter:[],effector2D:[],sortingGroup:[],skybox:[]},this.c={},this.flags=0,this.scene=null}get fullname(){return this.parent?`${this.parent.fullname}/${this.name}`:this.name}get element(){return this.c.element}get camera(){return this.c.camera}get light(){return this.c.light}get screen(){return this.c.screen}removeOrReparent(e,t=!1){e?this.parent.removeChild(this):this.reparent(e)}destroy(){this.removeOrReparent(null)}getLossyScale(){return this.flags&b.Flags.LossyScaleDirty?(this.flags&=~b.Flags.LossyScaleDirty,r.copy(this.getRotation()),h.setTRS(i.m.ZERO,r.invert(),i.m.ONE),this.getWorldRotationAndScale(o),h.mul2(h,o),this._lossyScale.set(h.data[0],h.data[5],h.data[10]),this._lossyScale):this._lossyScale}_onInsertChild(e){e._parent=this,e.element&&(this.setupCanvasGroups(e),e.notifyCanvasGroupChanged(e)),e.notifyScreenHierarchyChanged(),this.updateHierarchyState(e),e._updateGraphDepth(),e.onParentChanged(),e.events.fire("insert",this);let t=e.parent;for(;t;)t.events.fire("insertRecursive",this),t=t.parent;if(!e.element)for(let t=0;t<e._children.length;t++){const s=e._children[t].element;s&&s._onInsert(e)}this.notifyTransformChildrenChanged(),e.notifyTransformParentChanged();const s=this._app.systems;s.physics.syncHierarchy(e),s.physics2D.syncHierarchy(e)}_onInsertChildOnLoad(e){if(e._parent=this,e.element){if(this.setupCanvasGroups(e),!e.isPrefab){const t=e._unityComponents.canvasRenderer[0];if(t){t.onCanvasGroupChanged();const s=e.screen?e.screen:pc.UIUtils.findParentScreen(e.parent);t.onScreenChanged(s)}}e.element._onInsert(this,!1)}this.updateHierarchyState(e)}updateHierarchyState(e){const t=e._activeSelf&&this.enabled;e._enabledInHierarchy!==t&&(e._enabledInHierarchy=t,e._notifyHierarchyStateChanged(e,t))}muteTransformModificationCallback(){this.flags|=b.Flags.TransformModificationCallbackMuted}unmuteTransformModificationCallback(){this.flags&=~b.Flags.TransformModificationCallbackMuted,this.flags&b.Flags.TransformModificationCallbackRequested&&(this._onModifyTransform(),this.flags&=~b.Flags.TransformModificationCallbackRequested)}_onModifyTransform(){if(this.flags&b.Flags.TransformModificationCallbackMuted)return void(this.flags|=b.Flags.TransformModificationCallbackRequested);if(!this._app)return;const e=this._app.systems;e.physics.syncTransforms(this),e.physics2D.syncTransforms(this)}lookAt(e,t){l.copy(e),c.copy(t),o.setLookAt(this.getPosition(),l,c),r.setFromMat4(o),this.setRotation(r)}translate(e,t,s){e instanceof i.m?l.copy(e):l.set(e,t,s),l.add(this.getPosition()),this.setPosition(l)}translateLocal(e,t,s){e instanceof i.m?l.copy(e):l.set(e,t,s),this.getLocalRotation().transformVector(l,l),l.add(this.getLocalPosition()),this.setLocalPosition(l)}rotate(e,t,s){if(e instanceof i.m?r.setFromEulerAngles_Unity(e.x,e.y,e.z):r.setFromEulerAngles_Unity(e,t,s),null===this._parent)a.mul2(r,this.getLocalRotation()),this.setLocalRotation(a);else{const e=this.getRotation(),t=this._parent.getRotation();a.copy(t).invert().mul2(a,r).mul2(r,e),this.setRotation(a)}}rotateLocal(e,t,s){e instanceof i.m?r.setFromEulerAngles_Unity(e.x,e.y,e.z):r.setFromEulerAngles_Unity(e,t,s),r.mul2(this.getLocalRotation(),r),this.setLocalRotation(r)}_isOddlyScaled(){const e=this.getWorldTransform().data,t=e[0],s=e[1],i=e[2],n=e[4],r=e[5],a=e[6],o=e[8],h=e[9],l=e[10];return t*(r*l-a*h)-n*(s*l-i*h)+o*(s*a-i*r)<0}_sync(){this.flags&b.Flags.HijackedByElementComponent?this._syncElementComponent():this._syncGraphNode()}_syncElementComponent(){const{tmpVector:e}=S;this.parent&&this.parent._sync();const t=this.element,s=t._dirtyRect,n=t._dirtyScreen;let r=this.element._lastSyncAABBVersion!==this.aabbVersion;if(!s&&!n&&!r)return;this.hasChanged=!0,this.flags&=~b.Flags.HijackedByElementComponent;const a=t._width,o=t._height;if(s||r){const s=t._findParentElement();if(s){const n=s.element;if(t._width=(t._anchors.z-t._anchors.x)*n._width+t._sizeDelta.x,t._height=(t._anchors.w-t._anchors.y)*n._height+t._sizeDelta.y,this._parent===s){const s=n._width*t._anchors.x,r=n._width*t._anchors.z,a=n._height*t._anchors.y,o=n._height*t._anchors.w;e.set((0,i.p)(s,r,t._pivot.x)+t._anchoredPosition.x,(0,i.p)(a,o,t._pivot.y)+t._anchoredPosition.y,0),this.setLocalPosition(e.x-n._pivotPoint.x,e.y-n._pivotPoint.y,this.getLocalPosition().z)}else this.setLocalPosition(t._anchoredPosition.x,t._anchoredPosition.y,this.getLocalPosition().z)}else t._width=t._sizeDelta.x,t._height=t._sizeDelta.y,this.setLocalPosition(t._anchoredPosition.x,t._anchoredPosition.y,this.getLocalPosition().z)}if(r=this.element._lastSyncAABBVersion!==this.aabbVersion,r||n||s){t._pivotPoint.set(t._width*t._pivot.x,t._height*t._pivot.y,0),this._tryResizeScreen();const e=t.cachedRect;e.m_XMin=-t._pivotPoint.x,e.m_YMin=-t._pivotPoint.y,e.m_Width=t._width,e.m_Height=t._height,e.m_XMax=e.m_XMin+e.m_Width,e.m_YMax=e.m_YMin+e.m_Height,t.events.fire("resize",t._width,t._height)}t._lastSyncAABBVersion=this.aabbVersion,t._dirtyRect=!1,t._dirtyScreen=!1,this.flags|=b.Flags.HijackedByElementComponent;const h=t._width!==a,l=t._height!==o;s||!h&&!l||t.triggerOnElementDimesionsChange(h,l)}_tryResizeScreen(){const e=this.element,{tmpMatrix:t,tmpVector:s,desiredLocalScale:r,desiredWorldPosition:a}=A,o=this.screen;if(!(o&&!o._findParentScreen()))return;const h=o.resolution;switch(o.screenType){case n.c.SCREEN_TYPE_SCREEN:{e._width=h.x/o.scale,e._height=h.y/o.scale,a.set(.5*h.x,.5*h.y,0),this.setPosition(a),s.set(o.scale,o.scale,o.scale),t.setTRS(i.m.ZERO,this.getRotation(),s),this.setWorldRotationAndScale(t);const n=this.getLocalPosition();e._anchoredPosition.set(n.x,n.y),e._pivotPoint.set(.5*e._width,.5*e._height,0);break}case n.c.SCREEN_TYPE_CAMERA:{const t=o.camera._component.entity;e._width=h.x/o.scale,e._height=h.y/o.scale,e._sizeDelta.copy(h),r.set(1,1,1),r.scale(o._planeHeight/e._height),this.isParentOf(t)||(s.set(0,0,o._screenDistance),t.transformPoint(s,s,!0),this.setPosition(s)),this.setRotation(t.getRotation()),this.setLocalScale(r);const i=this.getLocalPosition();e._anchoredPosition.set(i.x,i.y),e._pivotPoint.set(.5*e._width,.5*e._height,0);break}case n.c.SCREEN_TYPE_WORLD:e._width=e._sizeDelta.x,e._height=e._sizeDelta.y,this.setLocalPosition(e._anchoredPosition.x,e._anchoredPosition.y,this.getLocalPosition().z)}e._sizeDelta.set(e._width,e._height)}_syncGraphNode(){this.parent&&this.parent._sync()}findByNameImmediate(e){for(let t=0;t<this._children.length;t++){const s=this._children[t];if(s.name===e)return s}return null}findByNameEnabled(e){return e?this.findByNamesEnabledInternal(e.split("/"),0):null}findByNamesEnabledInternal(e,t){if(!this.enabled)return null;if(this.scene||this.name!==e[t])t=0;else{if(t===e.length-1)return this;t++}for(let s=0;s<this._children.length;s++){const i=this._children[s].findByNamesEnabledInternal(e,t);if(null!==i)return i}return null}getWorldRotationAndScale(e=new i.i){const{tmpMatrix:t}=m;return this.parent?(this.parent.getWorldRotationAndScale(e),t.setTRS(i.m.ZERO,this.getLocalRotation(),this.getLocalScale()),e.mul2(e,t)):e.setTRS(i.m.ZERO,this.getLocalRotation(),this.getLocalScale()),e}getWorldRotationAndScaleInverse(e=new i.i,t=null){const{invRotation:s,invRotationMatrix:n,invScale:r,invScaleMatrix:a}=_;if(s.copy(this.getLocalRotation()).invert(),n.setRotation(s),r.copy(t||this.getLocalScale()).invertSafe(),a.setScale(r.x,r.y,r.z),e.mul2(a,n),this.parent){const t=this.parent.getWorldRotationAndScaleInverse();e.mul2(e,t)}return e}setWorldRotationAndScale(e){const{currentRSInverse:t}=y;this.getWorldRotationAndScaleInverse(t,i.m.ONE),t.mul2(t,e),this.setLocalScale(t.data[0],t.data[5],t.data[10])}getLocalRotationAndScale(e=new i.i){return e.setTRS(i.m.ZERO,this.getLocalRotation(),this.getLocalScale()),e}setParent(e,t){if(t){const t=this.getPosition().clone(),s=this.getRotation().clone(),i=this.getWorldRotationAndScale();this.removeOrReparent(e,!0),this.muteTransformModificationCallback(),this.setPosition(t),this.setRotation(s),this.setWorldRotationAndScale(i),this.unmuteTransformModificationCallback()}else{const t=this.getLocalScale().clone(),s=this.getLocalPosition(),i=this.getLocalRotation().clone();this.removeOrReparent(e,!0),this.muteTransformModificationCallback(),this.setLocalScale(t),this.setLocalPosition(s),this.setLocalRotation(i),this.unmuteTransformModificationCallback()}if(this.element){const e=pc.UIUtils.findParentScreen(this);this.reparentElementRecursive(e)}}reparentElementRecursive(e){if(this.element){const t=this._unityComponents?this._unityComponents.canvasRenderer[0]:null;t&&t.reparentCanvas(e)}const t=this.children;for(let s=0;s<t.length;s++){t[s].reparentElementRecursive(e)}}isParentOf(e){const t=e._graphDepth-this._graphDepth;if(t<=0||t>=e._graphDepth||null===e.parent)return!1;let s=e;for(let e=0;e<t;e++)s=s.parent;return s===this}isChildOf(e){return e.isParentOf(this)}_notifyHierarchyStateChanged(e,t){e._onHierarchyStateChanged(t);const s=e._children;for(let e=0,i=s.length;e<i;e++)s[e]._activeSelf&&this._notifyHierarchyStateChanged(s[e],t)}_elementDimesionsChange(){}_onHierarchyStateChanged(e){this._enabledInHierarchy=e}findByTag(e){return this._findByTag(e)}_findByTag(e){const t=[];for(let s=0;s<this._children.length;s++){const i=this._children[s];if(!i._enabledInHierarchy)continue;i.tag===e&&t.push(i);const n=i._findByTag(e);n.length&&t.push(...n)}return t}findByName(e){if(this.name===e)return this;for(let t=0;t<this._children.length;t++){const s=this._children[t].findByName(e);if(null!==s)return s}return null}getRoot(){return this.root}getParent(){return this._parent}parents(){const e=[];let t=this.parent;for(;t;)e.push(t),t=t.parent;return e}allChildren(e=[]){for(let t=0;t<this.children.length;t++)e.push(this.children[t]),this.children[t].allChildren(e);return e}getScene(){const e=this.parent;return e?e.scene?e.scene:e.getScene():null}isDescendantOf(e){let t=this._parent;for(;t;){if(t===e)return!0;t=t._parent}return!1}isAncestorOf(e){return e.isDescendantOf(this)}getChildren(){return this._children}getEulerAngles(){return this.flags&b.Flags.EulerAnglesDirty&&(this.getRotation().getEulerAngles_Unity(this._eulerAngles),this.flags&=~b.Flags.EulerAnglesDirty),this._eulerAngles}setEulerAngles(e,t,s){e instanceof i.m?r.setFromEulerAngles_Unity(e.x,e.y,e.z):r.setFromEulerAngles_Unity(e,t,s),this.setRotation(r)}getLocalEulerAngles(){return this.flags&b.Flags.LocalEulersAnglesDirty&&(this.getLocalRotation().getEulerAngles_Unity(this._localEulerAngles),this.flags&=~b.Flags.LocalEulersAnglesDirty),this._localEulerAngles}setLocalEulerAngles(e,t,s){const{newLocalRotation:n}=E;e instanceof i.m?n.setFromEulerAngles_Unity(e.x,e.y,e.z):n.setFromEulerAngles_Unity(e,t,s),this.setLocalRotation(n)}setLocalPositionGraphNodeNoDirty(e,t,s){this._localPosition.set(e,t,s)}setLocalRotationNoDirty(e,t,s,i){this._localRotation.set(e,t,s,i),this._localRotation.normalize()}setLocalScaleNoDirty(e,t,s){this._localScale.set(e,t,s)}getLocalPosition(){return this.flags&b.Flags.HijackedByElementComponent?this.getLocalPositionElementComponent():this.getLocalPositionGraphNode()}getLocalPositionGraphNode(){return this._localPosition}getLocalPositionElementComponent(){return this.element.getRect(),this.getLocalPositionGraphNode()}setLocalPosition(e,t,s){this.flags&b.Flags.HijackedByElementComponent?this.setLocalPositionElementComponent(e,t,s):this.setLocalPositionGraphNode(e,t,s)}setLocalPositionGraphNode(e,t,s){e instanceof i.m?c.copy(e):c.set(e,t,s),this._localPosition.approximatelyEquals(c,Number.EPSILON)||(this._localPosition.copy(c),this.onLocalPositionChanged(),this._onModifyTransform())}setLocalPositionElementComponent(e,t,s){const{tempVector:n}=T;n.copy(this.getLocalPositionElementComponent()),e instanceof i.m?(this.setLocalPositionGraphNode(e.x,e.y,e.z),n.sub2(e,n)):(this.setLocalPositionGraphNode(e,t,s),n.x=e-n.x,n.y=t-n.y),this.element._anchoredPosition.x+=n.x,this.element._anchoredPosition.y+=n.y,this.element.dirtifyRect()}getLocalRotation(){return this._localRotation}setLocalRotation(e,t,s,n){e instanceof i.j?r.copy(e):r.set(e,t,s,n),r.normalize(),this._localRotation.approximatelyEquals(r,Number.EPSILON)||(this._localRotation.copy(r),this.onLocalRotationChanged(),this._onModifyTransform())}getLocalScale(){return this._localScale}setLocalScale(e,t,s){e instanceof i.m?l.copy(e):l.set(e,t,s),this._localScale.approximatelyEquals(l,Number.EPSILON)||(this._localScale.copy(l),this.onLocalScaleChanged(),this._onModifyTransform())}getLocalScaleSign(e){const t=this.getLocalScale();e.set(Math.sign(t.x)||1,Math.sign(t.y)||1,Math.sign(t.z)||1)}getLocalScaleRotationMultipliers(e){this.getLocalScaleSign(e);const t=e.x,s=e.y,i=e.z,n=s*i,r=t*i,a=t*s;e.set(n,r,a)}getLocalTransform(){return this.flags&b.Flags.LocalTransformDirty?(this.flags&=~b.Flags.LocalTransformDirty,this._localTransform.setTRS(this.getLocalPosition(),this.getLocalRotation(),this.getLocalScale()),this._localTransform):this._localTransform}setLocalTransform(e){this.muteTransformModificationCallback(),this.setLocalPosition(e.getTranslation()),this.setLocalRotation(e.getRotation()),this.setLocalScale(e.getScale()),this.unmuteTransformModificationCallback()}getPosition(){if(!(this.flags&b.Flags.PositionDirty))return this._position;this.flags&=~b.Flags.PositionDirty,this._position.copy(this.getLocalPosition());let e=this.parent;for(;e;)this._position.mul(e.getLocalScale()),e.getLocalRotation().transformVector(this._position,this._position),this._position.add(e.getLocalPosition()),e=e.parent;return this._position}setPosition(e,t,s){e instanceof i.m?d.copy(e):d.set(e,t,s),this.parent&&this.parent.transformPointInverse(d,d),this.setLocalPosition(d)}getRotation(){if(!(this.flags&b.Flags.RotationDirty))return this._rotation;this.flags&=~b.Flags.RotationDirty;const{parentLocalRotation:e,rotationMultiplier:t}=p;this._rotation.copy(this.getLocalRotation());let s=this.parent;for(;s;){s.getLocalScaleRotationMultipliers(t);const i=t.x,n=t.y,r=t.z;e.copy(s.getLocalRotation()),e.x*=i,e.y*=n,e.z*=r,this._rotation.mul2(e,this._rotation),this._rotation.x*=i,this._rotation.y*=n,this._rotation.z*=r,s=s.parent}return this._rotation}setRotation(e,t,s,n){const{newLocalRotation:r}=g;e instanceof i.j?r.copy(e):r.set(e,t,s,n),this.parent?this.setLocalRotation(this.parent.transformQuaternionInverse(r)):this.setLocalRotation(r)}getWorldTransform(){return this.flags&b.Flags.WorldTransformDirty?(this.flags&=~b.Flags.WorldTransformDirty,this.parent?this._worldTransform.mul2(this._parent.getWorldTransform(),this.getLocalTransform()):this._worldTransform.copy(this.getLocalTransform()),this._worldTransform):this._worldTransform}setWorldTransform(e){this.muteTransformModificationCallback(),this.setPosition(e.getTranslation()),this.setRotation(e.getRotation());const t=e.clone();t.data[12]=t.data[13]=t.data[14]=0,this.setWorldRotationAndScale(t),this.unmuteTransformModificationCallback()}getWorldTransformInverse(){return this.flags&b.Flags.WorldTransformInverseDirty?(this.flags&=~b.Flags.WorldTransformInverseDirty,this._worldTransformInverse.copy(this.getWorldTransform()).invert(),this._worldTransformInverse):this._worldTransformInverse}transformPoint(e,t=new i.m,s=!1){t.copy(e);let n=this;for(;n;)s||t.mul(n.getLocalScale()),n.getLocalRotation().transformVector(t,t),t.add(n.getLocalPosition()),n=n.parent;return t}transformPointInverse(e,t=new i.m){return this.parent?this.parent.transformPointInverse(e,t):t.copy(e),t.sub(this.getLocalPosition()),r.copy(this.getLocalRotation()).invert().transformVector(t,t),t.mul(c.copy(this.getLocalScale()).invertSafe()),t}transformVector(e,t=new i.m){t.copy(e);let s=this;for(;s;)t.mul(s.getLocalScale()),s.getLocalRotation().transformVector(t,t),s=s.parent;return t}transformVectorInverse(e,t=new i.m){return this.parent?this.parent.transformVectorInverse(e,t):t.copy(e),r.copy(this.getLocalRotation()).invert().transformVector(t,t),t.mul(c.copy(this.getLocalScale()).invertSafe()),t}transformDirection(e,t=new i.m){t.copy(e),this.getLocalRotation().transformVector(t,t);let s=this.parent;for(;s;)s.getLocalScaleSign(u),t.x*=u.x,t.y*=u.y,t.z*=u.z,s.getLocalRotation().transformVector(t,t),s=s.parent;return t}transformDirectionInverse(e,t=new i.m,s=!1){if(this.parent?this.parent.transformDirectionInverse(e,t,!0):t.copy(e),r.copy(this.getLocalRotation()).invert().transformVector(t,t),s){const e=this.getLocalScale(),s=Math.sign(e.x)||1,i=Math.sign(e.y)||1,n=Math.sign(e.z)||1;t.x*=s,t.y*=i,t.z*=n}return t}transformQuaternionInverse(e,t=new i.j){const{invLocalRotation:s,rotationMultiplier:n}=f;return this.parent?this.parent.transformQuaternionInverse(e,t):t.copy(e),s.copy(this.getLocalRotation()).invert(),t.mul2(s,t),this.getLocalScaleRotationMultipliers(n),t.x*=n.x,t.y*=n.y,t.z*=n.z,t}hijackLocalPosition(){return this.flags&b.Flags.LocalPositionHijacked||(this.flags|=b.Flags.LocalPositionHijacked,this._hijackedLocalPosition.copy(this.getLocalPosition())),this._hijackedLocalPosition}hijackLocalScale(){return this.flags&b.Flags.LocalScaleHijacked||(this.flags|=b.Flags.LocalScaleHijacked,this._hijackedLocalScale.copy(this.getLocalScale())),this._hijackedLocalScale}hijackLocalEulerAngles(){return this.flags&b.Flags.LocalEulerAnglesHijacked||(this.flags|=b.Flags.LocalEulerAnglesHijacked,this._hijackedLocalEulerAngles.copy(this.getLocalEulerAngles())),this._hijackedLocalEulerAngles}hijackLocalRotation(){return this.flags&b.Flags.LocalRotationHijacked||(this.flags|=b.Flags.LocalRotationHijacked,this._hijackedLocalRotation.copy(this.getLocalRotation())),this._hijackedLocalRotation}releaseHijackedProperties(){this.flags&b.Flags.LocalPositionHijacked&&(this.flags&=~b.Flags.LocalPositionHijacked,this.setLocalPosition(this._hijackedLocalPosition)),this.flags&b.Flags.LocalScaleHijacked&&(this.flags&=~b.Flags.LocalScaleHijacked,this.setLocalScale(this._hijackedLocalScale)),this.flags&b.Flags.LocalRotationHijacked&&(this.flags&=~b.Flags.LocalRotationHijacked,this.setLocalRotation(this._hijackedLocalRotation)),this.flags&b.Flags.LocalEulerAnglesHijacked&&(this.flags&=~b.Flags.LocalEulerAnglesHijacked,this.setLocalEulerAngles(this._hijackedLocalEulerAngles))}reparent(e,t){this.notifyBeforeTransformParentChanged();const s=this._parent;if(this.element&&this.element._nearestScreen&&(this.element._nearestScreen.canvasMeshInstance.renderersDirty=!0),s)if(s!==e)s.removeChild(this,!0),s.notifyTransformChildrenChanged();else if(e)return void e.moveChildIndex(this,t);e&&(t>=0?e.insertChild(this,t):e.addChild(this)),this._app.scene.addDirty(this)}addChild(e,t=!1){if(null!==e._parent)throw new Error("GraphNode is already parented");this._children.push(e),t?this._onInsertChildOnLoad(e):this._onInsertChild(e)}insertChild(e,t){if(null!==e._parent)throw new Error("GraphNode is already parented");this._children.splice(t,0,e),this._onInsertChild(e)}moveChildIndex(e,t){if(t<0){const t=this._children.indexOf(e);this._children.push(this._children.splice(t,1)[0])}else{const s=this._children.indexOf(e);this._children.splice(s,1),this._children.splice(t,0,e)}e.onParentChanged(),this.element&&this.element.triggerOnElementDimesionsChange(!0,!0)}setupCanvasGroups(e){let t=e.parent;for(;t&&t.element&&0===e._parent.element._canvasGroups.length;)t=t.parent;t&&t.element&&e._parent.element._canvasGroups.length>0?e.element._canvasGroups=e._parent.element._canvasGroups.slice():e.element._canvasGroups.length=0,this.setupCanvasGroupsInChildren(e,e.element._canvasGroups)}setupCanvasGroupsInChildren(e,t){if(e.element){e.element._canvasGroups=t.slice();for(let t=0;t<e._canvasGroups.length;t++)e.element._canvasGroups.unshift(e._canvasGroups[t]);for(let t=0;t<e.children.length;t++)this.setupCanvasGroupsInChildren(e.children[t],e.element._canvasGroups)}}notifyScreenHierarchyChanged(){const e=pc.UIUtils.findParentScreen(this.parent);this.notifyScreenChanged(e),this.tryReparentScreen(e,this.children)}tryReparentScreen(e,t){for(let s=0;s<t.length;s++){const i=t[s];i.screen?i.screen.setParentScreen(e,!0):i.tryReparentScreen(e,i.children)}}_updateGraphDepth(){this._parent?this._graphDepth=this._parent._graphDepth+1:this._graphDepth=0;for(let e=0,t=this._children.length;e<t;e++)this._children[e]._updateGraphDepth()}removeChild(e,t=!1){e.notifyScreenHierarchyChanged(),t||e._notifyHierarchyStateChanged(e,!1);for(let t=0;t<this._children.length;++t)if(this._children[t]===e)return this._children.splice(t,1),e._parent=null,void e.notifyScreenHierarchyChanged()}syncHierarchy(){if(!this.enabled)return;this._sync();const e=this._children;for(let t=0,s=e.length;t<s;t++)e[t].syncHierarchy()}notifyCanvasGroupChanged(e){if(this.isPrefab)return;const t=e._unityComponents.monoBehaviour,s=e._unityComponents.canvasRenderer[0];for(let e=0;e<t.length;e++){t[e].onCanvasGroupChanged()}s&&s.onCanvasGroupChanged();const i=e.children;for(let e=0;e<i.length;e++)this.notifyCanvasGroupChanged(i[e])}notifyScreenChanged(e){if(this.isPrefab)return;this.screen&&(e=this.screen);const t=this._unityComponents.canvasRenderer[0];t&&t.onScreenChanged(e);const s=this.children;for(let t=0;t<s.length;t++)s[t].notifyScreenChanged(e)}notifyBeforeTransformParentChanged(){if(this.isPrefab)return;const e=this._unityComponents.monoBehaviour;for(let t=0;t<e.length;t++){e[t].onBeforeTransformParentChanged()}}notifyTransformParentChanged(){if(this.isPrefab)return;const e=this._unityComponents.monoBehaviour;for(let t=0;t<e.length;t++){e[t].onTransformParentChanged()}this.notifySortingGroupParentChanged()}notifySortingGroupParentChanged(){if(this.isPrefab)return;const[e]=this._unityComponents.sortingGroup;e&&e.onSortingGroupChanged();const t=this.children;for(let e=0;e<t.length;e++)t[e].notifySortingGroupParentChanged()}notifyTransformChildrenChanged(){if(this.isPrefab)return;const e=this._unityComponents.animator;for(let t=0;t<e.length;t++){e[t].onTransformChildrenChanged()}const t=this._unityComponents.monoBehaviour;for(let e=0;e<t.length;e++){t[e].onTransformChildrenChanged()}}onLocalRotationChanged(){this.flags|=b.Flags.LocalEulersAnglesDirty,this.flags|=b.Flags.LossyScaleDirty,this.flags&b.Flags.LocalTransformDirty||(this.flags|=b.Flags.LocalTransformDirty,this.onLocalTransformChanged()),this.flags&b.Flags.RotationDirty||(this.flags|=b.Flags.RotationDirty,this.onRotationChanged());for(let e=0;e<this.children.length;e++)this.children[e].onParentLocalRotationChanged();this.increaseTransformVersion()}onLocalScaleChanged(){this.flags|=b.Flags.LossyScaleDirty,this.flags&b.Flags.LocalTransformDirty||(this.flags|=b.Flags.LocalTransformDirty,this.onLocalTransformChanged());for(let e=0;e<this.children.length;e++)this.children[e].onParentLocalScaleChanged();this.increaseTransformVersion()}onLocalPositionChanged(){this.flags|=b.Flags.PositionDirty,this.flags&b.Flags.LocalTransformDirty||(this.flags|=b.Flags.LocalTransformDirty,this.onLocalTransformChanged());for(let e=0;e<this.children.length;e++)this.children[e].onParentLocalPositionChanged();this.increaseTransformVersion()}onRotationChanged(){this.flags|=b.Flags.EulerAnglesDirty,this.flags|=b.Flags.LossyScaleDirty,this.increaseTransformVersion()}onLocalTransformChanged(){this.flags&b.Flags.WorldTransformDirty||(this.flags|=b.Flags.WorldTransformDirty,this.onWorldTransformChanged()),this.increaseTransformVersion()}onWorldTransformChanged(){this.flags|=b.Flags.WorldTransformInverseDirty;for(let e=0;e<this.children.length;e++)this.children[e].onParentWorldTransformChanged();this.increaseTransformVersion()}onParentLocalRotationChanged(){this.flags|=b.Flags.LossyScaleDirty,this.flags|=b.Flags.PositionDirty,this.flags&b.Flags.RotationDirty||(this.flags|=b.Flags.RotationDirty,this.onRotationChanged());for(let e=0;e<this.children.length;e++)this.children[e].onParentLocalRotationChanged();this.increaseTransformVersion()}onParentLocalScaleChanged(){this.flags|=b.Flags.LossyScaleDirty,this.flags|=b.Flags.PositionDirty,this.flags&b.Flags.RotationDirty||(this.flags|=b.Flags.RotationDirty,this.onRotationChanged());for(let e=0;e<this.children.length;e++)this.children[e].onParentLocalScaleChanged();this.increaseTransformVersion()}onParentLocalPositionChanged(){this.flags|=b.Flags.PositionDirty;for(let e=0;e<this.children.length;e++)this.children[e].onParentLocalPositionChanged();this.increaseTransformVersion()}onParentWorldTransformChanged(){this.flags&b.Flags.WorldTransformDirty||(this.flags|=b.Flags.WorldTransformDirty,this.onWorldTransformChanged()),this.increaseTransformVersion()}onParentChanged(){this.onParentLocalPositionChanged(),this.onParentLocalRotationChanged(),this.onParentLocalScaleChanged(),this.onParentWorldTransformChanged()}increaseTransformVersion(){this._aabbVer++,this.flags&b.Flags.HijackedByElementComponent&&this._app.scene.addDirty(this)}get static(){return this._static}set static(e){this._static=e}get right(){return this._right||(this._right=new i.m),this.getWorldTransform().getX(this._right).normalize()}get up(){return this._up||(this._up=new i.m),this.getWorldTransform().getY(this._up).normalize()}get forward(){return this._forward||(this._forward=new i.m),this.getWorldTransform().getZ(this._forward).normalize()}get aabbVersion(){return this._aabbVer}get enabled(){return this._activeSelf&&this._enabledInHierarchy}set enabled(e){this._activeSelf!==e&&(this._activeSelf=e,e&&this._app.scene.addDirty(this),this._parent&&!this._parent.enabled||this._notifyHierarchyStateChanged(this,e))}get activeSelf(){return this._activeSelf}get parent(){return this._parent}get root(){let e=this._parent;if(!e)return this;for(;e._parent;)e=e._parent;return e}get children(){return this._children}get graphDepth(){return this._graphDepth}get cullingLayer(){return this._cullingLayer}set cullingLayer(e){this._cullingLayer=e,this.layerMask=1<<e}get lossyScale(){return this.getLossyScale()}get eulerAngles(){return this.getEulerAngles()}set eulerAngles(e){this.setEulerAngles(e)}get localEulerAngles(){return this.getLocalEulerAngles()}set localEulerAngles(e){this.setLocalEulerAngles(e)}get localPosition(){return this.getLocalPosition()}set localPosition(e){this.setLocalPosition(e)}get localRotation(){return this.getLocalRotation()}set localRotation(e){this.setLocalRotation(e)}get localScale(){return this.getLocalScale()}set localScale(e){this.setLocalScale(e)}get localTransform(){return this.getLocalTransform()}set localTransform(e){this.setLocalTransform(e)}get position(){return this.getPosition()}set position(e){this.setPosition(e)}get rotation(){return this.getRotation()}set rotation(e){this.setRotation(e)}get worldTransform(){return this.getWorldTransform()}set worldTransform(e){this.setWorldTransform(e)}get worldTransformInverse(){return this.getWorldTransformInverse()}}b.Flags={LocalEulersAnglesDirty:1,RotationDirty:2,EulerAnglesDirty:4,LossyScaleDirty:8,PositionDirty:16,LocalTransformDirty:32,WorldTransformDirty:64,WorldTransformInverseDirty:128,TransformModificationCallbackMuted:256,TransformModificationCallbackRequested:512,LocalPositionHijacked:1024,LocalScaleHijacked:2048,LocalEulerAnglesHijacked:4096,LocalRotationHijacked:8192,HijackedByElementComponent:16384},b.PositionDirty=b.Flags.PositionDirty|b.Flags.LocalTransformDirty|b.Flags.WorldTransformDirty|b.Flags.WorldTransformInverseDirty,b.RotationDirty=b.Flags.RotationDirty|b.Flags.EulerAnglesDirty|b.Flags.LocalEulersAnglesDirty|b.Flags.LocalTransformDirty|b.Flags.WorldTransformDirty|b.Flags.WorldTransformInverseDirty,b.ScaleDirty=b.Flags.LossyScaleDirty|b.Flags.LocalTransformDirty|b.Flags.WorldTransformDirty|b.Flags.WorldTransformInverseDirty,b.TransformDirty=b.PositionDirty|b.RotationDirty|b.ScaleDirty},(e,t,s)=>{"use strict";s.d(t,{a:()=>l});var i=s(2),n=s(46),r=s(17),a=s(19),o=s(24);let h=!1;class l extends n.a{constructor(e,t,s=!1){if(e instanceof r.a&&(t=e,e="Untitled"),super(e),this._app=t,!t&&(this._app=r.a.getApplication(),!this._app))throw new Error("Couldn't find current application");this.$id=0,this.objectJson=null,this.isPrefab=!0===s,this.getGuid(),this["__UnityEngine.Object"]=null,this["__UnityEngine.Transform"]=null,this["__UnityEngine.RectTransform"]=null,this["__UnityEngine.GameObject"]=null,this._destroying=!1,this._cullingLayer=0,this._beingDestroyed=!1,this._destroyed=!1,this._magicMethods={},this._eventHanders=null,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"Entity")}sendMessageToScripts(e,t,s){const i=this._unityComponents.monoBehaviour;if(0!==i.length&&e)for(let n=0;n<i.length;n++){const r=i[n].code;if(r!==s)try{if(r&&r[e]){const s=r[e].apply(r,t);s&&"Bridge.GeneratorEnumerator"===s.$$fullname&&new UnityEngine.Coroutine(s,r.handle)}}catch(e){console.error(e)}}}_elementDimesionsChange(){for(let e=0;e<this._dimensionListeners.length;e++){this._dimensionListeners[e].OnRectTransformDimensionsChange()}}sendPhysicsEvent(e,t){const s=this._magicMethods[e];if(!s)return!1;for(let i=0;i<s.length;i++){const n=s[i];try{const s=n.code[e].call(n.code,t);s&&"Bridge.GeneratorEnumerator"===s.$$fullname&&new UnityEngine.Coroutine(s,n.code.handle)}catch(e){console.error(e)}}return!0}hasMagicMethod(e){return!!this._magicMethods[e]}removeOrReparent(e,t=!1){if(null===e)if(t){const e=this.getWorldTransform().clone();let t=this.getScene();t||(t=window.$scene),this.reparent(t.root,-1),this.setLocalTransform(e)}else this.parent.removeChild(this);else this.reparent(e,-1)}getComponents(e){const t=[];if(!e)for(const e in this.c)this.c.hasOwnProperty(e)&&t.push(this.c[e]);for(const e in this._unityComponents){if(!this._unityComponents.hasOwnProperty(e))continue;const s=this._unityComponents[e];for(const e in s)s.hasOwnProperty(e)&&t.push(s[e])}return t}getUnityComponents(e){const t=[],s=this._unityComponents;if(!s)return t;for(let i=0,n=e.length;i<n;++i){const n=e[i];if(!s.hasOwnProperty(n))continue;const r=s[n];for(const e in r)r.hasOwnProperty(e)&&t.push(r[e])}return t}getUnityComponent(e){return this._unityComponents&&this._unityComponents[e][0]||null}collectAllUnityComponents(){let e=this.getUnityComponents(o.a);const t=this.allChildren();for(let s=0;s<t.length;s++){e=t[s].getUnityComponents(o.a).concat(e)}return e}addComponent(e,t){const s=this._app.systems.getSystemByName(e);if(!s)throw new Error('addComponent: System "'+e+"\" doesn't exist");return this.c[e]?(DEBUG&&UnityEngine.Debug.LogWarning$1('addComponent: Entity already has "'+e+'" component. (Check for components duplicates, e.g. SkinnedMesh & MeshFilter are both "Models")'),null):s.addComponent(this,t)}addUnityComponentFromDeserialization(e,t){this._app.systems.getSystemByName(e).addComponent(this,t)}addUnityComponent(e,t){const s=[];if(this._app.systems.unitymanager.disableCallbacks(),this._app.systems.getSystemByName(e).addComponent(this,t),s.push(t),!h){h=!0,a.a.addRequiredComponents(this,t.code,s),this._app.systems.unitymanager.enableCallbacks();for(let e=s.length-1;e>=0;e--){const t=s[e];t instanceof a.a&&(t.configureForEntity(this),t.onAttached(),t.onInit(),this.enabled&&t.enabled&&t._onEntityStateChanged(!0))}h=!1}}removeComponent(e){const t=this._app.systems.getSystemByName(e);if(!t)throw new Error('removeComponent: System "'+e+"\" doesn't exist");this.c[e]?t.removeComponent(this):DEBUG&&UnityEngine.Debug.LogWarning$1("removeComponent: Entity doesn't have \""+e+'" component')}getGuid(){return this._guid||this.setGuid((0,i.b)()),this._guid}setGuid(e){const t=this._app._entityIndex;this._guid&&delete t[this._guid],this._guid=e,t[this._guid]=this}_onHierarchyStateChanged(e){if(super._onHierarchyStateChanged.call(this,e),this._unityComponents)for(let t=0;t<o.a.length;t++){const s=this._unityComponents[o.a[t]];for(let t=0;t<s.length;t++)s[t]._onEntityStateChanged(e)}let t;const s=this.c;for(const i in s)s.hasOwnProperty(i)&&(t=s[i],t.enabled&&(e?t.onEnable():t.onDisable()))}findByGuid(e){if(this._guid===e)return this;const t=this._app._entityIndex[e];return t&&(t===this||t.isDescendantOf(this))?t:null}destroy(){let e;for(e in this._destroying=!0,this.c)this.c.hasOwnProperty(e)&&(this.c[e].enabled=!1);for(e in this.c)this.c.hasOwnProperty(e)&&this.c[e].system.removeComponent(this);for(let e=0;e<o.a.length;e++){const t=this._unityComponents[o.a[e]];for(let e=0;e<t.length;e++)t[e].destroy()}this._parent&&this._parent.removeChild(this);const t=this._children;let s=t.shift();for(;s;)s instanceof l&&s.destroy(),s._parent=null,s=t.shift();this.events.off(),this._destroying=!1,this._destroyed=!0,this._layoutElements.length=0,this._layoutControllers.length=0,this._layoutSelfControllers.length=0,this._dimensionListeners.length=0,this._canvasElements.length=0,this._canvasGroups.length=0,this._meshModifiers.length=0}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>n});var i=s(2);class n{constructor(){this.ambientLight=null,this.skybox=null,this.meshInstancesCount=0,this._meshInstances=[],this._depthConsumers=[],this._canvasDepthConsumers=new Set,this._renderers=[],this._cameras=[],this._urpBaseCameras=[],this._lights=[],this._overlayScreensDirty=!1,this._overlayScreens=[],this._worldScreens=[],this.activeUiMasks={},this.dirtyEntities=new Set,this.events=new i.a(this)}addDirty(e){this.dirtyEntities.add(e)}syncHierarchy(){const e=[...this.dirtyEntities];for(const t of e)t.syncHierarchy();this.dirtyEntities.clear()}addRenderer(e){this._renderers.includes(e)||this._renderers.push(e)}addSkybox(e){this.skybox=e}removeRenderer(e){const t=this._renderers.indexOf(e);-1!==t&&this._renderers.splice(t,1)}addCanvasDepthConsumer(e){this._canvasDepthConsumers.add(e)}removeCanvasDepthConsumer(e){this._canvasDepthConsumers.delete(e)}getMeshInstances(){this._depthConsumers.length=0;for(let e=0;e<this.meshInstancesCount;e++)this._meshInstances[e]=null;this.meshInstancesCount=0;for(let e=0;e<this._renderers.length;e++){const t=this._renderers[e].getMeshInstancesForRender();for(let e=0;e<t.length;e++){const s=t[e];s.isIndexBufferEmpty&&!s.isCanvas||((s.material&&s.material.readDepth||s.isCanvas&&this._canvasDepthConsumers.has(s))&&this._depthConsumers.push(s),this._meshInstances.length===this.meshInstancesCount?this._meshInstances.push(s):this._meshInstances[this.meshInstancesCount]=s,this.meshInstancesCount++)}}return this._meshInstances}getSkyboxForRender(){return this.skybox}getMeshInstancesCached(){return this._meshInstances}addCamera(e){this._cameras.includes(e)||this._cameras.push(e)}addUrpBaseCamera(e){this._urpBaseCameras.includes(e)||this._urpBaseCameras.push(e)}removeCamera(e){-1!==this._cameras.indexOf(e)&&this._cameras.splice(this._cameras.indexOf(e),1)}removeUrpBaseCamera(e){const t=this._urpBaseCameras.indexOf(e);-1!==t&&this._urpBaseCameras.splice(t,1)}addLight(e){this._lights.includes(e)||this._lights.push(e)}removeLight(e){this._lights.splice(this._lights.indexOf(e),1)}addScreen(e){const t=e.screenType===i.c.SCREEN_TYPE_SCREEN?this._overlayScreens:this._worldScreens;t.includes(e)||(t.push(e),t===this._overlayScreens&&(this._overlayScreensDirty=!0))}removeScreen(e){const t=e.screenType===i.c.SCREEN_TYPE_SCREEN?this._overlayScreens:this._worldScreens;t.includes(e)&&t.splice(t.indexOf(e),1)}hasVisibleDepthConsumers(){let e=!1;for(const t of this._depthConsumers.values())if(t.visibleThisFrame){e=!0;break}return e}get overlayScreens(){return this._overlayScreensDirty&&(this._overlayScreensDirty=!1,this._overlayScreens.sort(pc.SortUtils.sortOverlayCanvases)),this._overlayScreens}get worldScreens(){return this._worldScreens}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>n});var i=s(13);class n{constructor(){this._currentQualityLevel=0}static get instance(){return i.c.instance.qualitySettings}get currentQualityLevel(){return this._currentQualityLevel}set currentQualityLevel(e){const t=e>this.countOfQualityLevels?this.countOfQualityLevels-1:e<0?0:e;if(t===this._currentQualityLevel)return;const s=this.qualityLevels[t];this.activeColorSpace=s.activeColorSpace,this.anisotropicFiltering=s.anisotropicFiltering,this.antiAliasing=s.antiAliasing,this.asyncUploadBufferSize=s.asyncUploadTimeSlice,this.asyncUploadTimeSlice=s.activeColorSpace,this.billboardsFaceCameraPosition=s.billboardsFaceCameraPosition,this.lodBias=s.lodBias,this.masterTextureLimit=s.masterTextureLimit,this.maximumLODLevel=s.maximumLODLevel,this.maxQueuedFrames=s.maxQueuedFrames,this.particleRaycastBudget=s.particleRaycastBudget,this.pixelLightCount=s.pixelLightCount,this.realtimeReflectionProbes=s.realtimeReflectionProbes,this.resolutionScalingFixedDPIFactor=s.resolutionScalingFixedDPIFactor,this.desiredColorSpace=s.desiredColorSpace,this.shadowCascade2Split=s.shadowCascade2Split,this.shadowCascade4Split=s.shadowCascade4Split,this.shadowCascades=s.shadowCascades,this.shadowDistance=s.shadowDistance,this.shadowmaskMode=s.shadowmaskMode,this.shadowNearPlaneOffset=s.shadowNearPlaneOffset,this.shadowProjection=s.shadowProjection,this.shadowResolution=s.shadowResolution,this.shadows=s.shadows,this.softParticles=s.softParticles,this.softVegetation=s.softVegetation,this.streamingMipmapsActive=s.streamingMipmapsActive,this.streamingMipmapsAddAllCameras=s.streamingMipmapsAddAllCameras,this.streamingMipmapsMaxFileIORequests=s.streamingMipmapsMaxFileIORequests,this.streamingMipmapsMaxLevelReduction=s.streamingMipmapsMaxLevelReduction,this.streamingMipmapsMemoryBudget=s.streamingMipmapsMemoryBudget,this.streamingMipmapsRenderersPerFrame=s.streamingMipmapsRenderersPerFrame,this.vSyncCount=s.vSyncCount,this._currentQualityLevel=t}get countOfQualityLevels(){return this.names.length}get qualityLevels(){return this._qualityLevels}set qualityLevels(e){this._qualityLevels=e}set names(e){this._names=e}get names(){return this._names}set shadows(e){this._shadows=e}get shadows(){return this._shadows}set anisotropicFiltering(e){this._anisotropicFiltering=e}get anisotropicFiltering(){return this._anisotropicFiltering}get antiAliasing(){return this._antiAliasing}set antiAliasing(e){this._antiAliasing=e}get lodBias(){return this._lodBias}set lodBias(e){this._lodBias=e}get shadowCascades(){return this._shadowCascades}set shadowCascades(e){this._shadowCascades=e}get shadowDistance(){return this._shadowDistance}set shadowDistance(e){this._shadowDistance=e}get shadowmaskMode(){return this._shadowmaskMode}set shadowmaskMode(e){this._shadowmaskMode=e}get shadowProjection(){return this._shadowProjection}set shadowProjection(e){this._shadowProjection=e}get shadowResolution(){return this._shadowResolution}set shadowResolution(e){this._shadowResolution=e}get softParticles(){return this._softParticles}set softParticles(e){this._softParticles=e}set softVegetation(e){this._softVegetation=e}get softVegetation(){return this._softVegetation}set activeColorSpace(e){this._activeColorSpace=e}get activeColorSpace(){return this._activeColorSpace}set desiredColorSpace(e){this._desiredColorSpace=e}get desiredColorSpace(){return this._desiredColorSpace}set masterTextureLimit(e){this._masterTextureLimit=e}get masterTextureLimit(){return this._masterTextureLimit}set maxQueuedFrames(e){this._maxQueuedFrames=e}get maxQueuedFrames(){return this._maxQueuedFrames}set particleRaycastBudget(e){this._particleRaycastBudget=e}get particleRaycastBudget(){return this._particleRaycastBudget}set pixelLightCount(e){this._pixelLightCount=e}get pixelLightCount(){return this._pixelLightCount}set realtimeReflectionProbes(e){this._realtimeReflectionProbes=e}get realtimeReflectionProbes(){return this._realtimeReflectionProbes}set shadowCascade2Split(e){this._shadowCascade2Split=e}get shadowCascade2Split(){return this._shadowCascade2Split}set shadowCascade4Split(e){this._shadowCascade4Split=e}get shadowCascade4Split(){return this._shadowCascade4Split}set streamingMipmapsActive(e){this._streamingMipmapsActive=e}get streamingMipmapsActive(){return this._streamingMipmapsActive}set vSyncCount(e){this._vSyncCount=e}get vSyncCount(){return this._vSyncCount}set asyncUploadBufferSize(e){this._asyncUploadBufferSize=e}get asyncUploadBufferSize(){return this._asyncUploadBufferSize}set asyncUploadTimeSlice(e){this._asyncUploadTimeSlice=e}get asyncUploadTimeSlice(){return this._asyncUploadTimeSlice}set billboardsFaceCameraPosition(e){this._billboardsFaceCameraPosition=e}get billboardsFaceCameraPosition(){return this._billboardsFaceCameraPosition}set shadowNearPlaneOffset(e){this._shadowNearPlaneOffset=e}get shadowNearPlaneOffset(){return this._shadowNearPlaneOffset}set streamingMipmapsMemoryBudget(e){this._streamingMipmapsMemoryBudget=e}get streamingMipmapsMemoryBudget(){return this._streamingMipmapsMemoryBudget}set maximumLODLevel(e){this._maximumLODLevel=e}get maximumLODLevel(){return this._maximumLODLevel}set streamingMipmapsAddAllCameras(e){this._streamingMipmapsAddAllCameras=e}get streamingMipmapsAddAllCameras(){return this._streamingMipmapsAddAllCameras}set streamingMipmapsMaxLevelReduction(e){this._streamingMipmapsMaxLevelReduction=e}get streamingMipmapsMaxLevelReduction(){return this._streamingMipmapsMaxLevelReduction}set streamingMipmapsRenderersPerFrame(e){this._streamingMipmapsRenderersPerFrame=e}get streamingMipmapsRenderersPerFrame(){return this._streamingMipmapsRenderersPerFrame}set resolutionScalingFixedDPIFactor(e){this._resolutionScalingFixedDPIFactor=e}get resolutionScalingFixedDPIFactor(){return this._resolutionScalingFixedDPIFactor}set streamingMipmapsMaxFileIORequests(e){this._streamingMipmapsMaxFileIORequests=e}get streamingMipmapsMaxFileIORequests(){return this._streamingMipmapsMaxFileIORequests}getQualityLevel(){return this.currentQualityLevel}setQualityLevel(e,t=!0){this.currentQualityLevel=e}increaseLevel(e=!1){this.currentQualityLevel++}decreaseLevel(e=!1){this.currentQualityLevel--}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>r});var i=s(23),n=s(7);class r{constructor(e){this.device=e,this.freeList=[],this.freeListIterations=[],this.takenList=[],this.textureOptions={name:"RenderTargetPoolObject",width:0,height:0,format:0,mipmaps:!1,levels:[null]},this.renderTargetOptions={colorBuffer:null,depthBuffer:null},this.currentFreeIteration=0}getTempRenderTarget(e,t,s=null,r=null){let a=this.findFreeRenderTarget(e,t,s,r);if(!a){const o=this.getTextureOptionsObject();o.width=e,o.height=t;const h=this.getRenderTargetOptionsObject();s&&(o.format=s,o.name="RenderTargetPooled_Color",h.colorBuffer=new n.a(this.device,o)),r&&(o.format=r,o.name="RenderTargetPooled_Depth",h.depthBuffer=new n.a(this.device,o)),a=new i.a(h)}return this.takenList.push(a),a}releaseTempRenderTarget(e){const t=this.takenList.indexOf(e);-1!==t&&(this.freeList.push(e),this.freeListIterations.push(this.currentFreeIteration),this.takenList.splice(t,1))}freeUnusedRenderTargets(e=15){for(let t=this.freeListIterations.length-1;t>=0;t--){const s=this.freeListIterations[t];if(this.currentFreeIteration-s>=e){const e=this.freeList[t];e.colorBuffer&&e.colorBuffer.destroy(),e.depthBuffer&&e.depthBuffer.destroy(),e.destroy(),this.freeList.splice(t,1),this.freeListIterations.splice(t,1)}}this.currentFreeIteration++}findFreeRenderTarget(e,t,s=null,i=null){for(let n=this.freeList.length-1;n>=0;n--){const r=this.freeList[n];let a=!0;if(a=a&&r.width===e,a=a&&r.height===t,a=a&&!!r.colorBuffer==!!s,s&&(a=a&&r.colorBuffer.format===s),a=a&&!!r.depthBuffer==!!i,i&&(a=a&&r.depthBuffer.format===i),a)return this.freeList.splice(n,1),this.freeListIterations.splice(n,1),r}return null}getTextureOptionsObject(){return this.textureOptions}getRenderTargetOptionsObject(){return this.renderTargetOptions.colorBuffer=null,this.renderTargetOptions.depthBuffer=null,this.renderTargetOptions}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>h,b:()=>o});var i=s(0),n=s(2),r=s(7);const a=new i.i;class o{constructor(e,t,s){this.device=e,this.inverseBindPose=t,this.boneNames=s,this.updateWhenOffscreen=!1,this.localBounds=null,this.rootBone=null}}class h{constructor(e){this.skin=e,this._dirty=!0,this.bones=[];const t=e.inverseBindPose.length,s=e.device;if(s.supportsBoneTextures){let e;e=t>256?64:t>64?32:t>16?16:8,this.boneTexture=new r.a(s,{width:e,height:e,format:n.c.PIXELFORMAT_RGBA32F,mipmaps:!1,minFilter:n.c.FILTER_NEAREST,magFilter:n.c.FILTER_NEAREST}),this.matrixPalette=this.boneTexture.lock()}else this.matrixPalette=new Float32Array(16*t);this.matrices=[],this.bonesAabbVersions=[];for(let e=0;e<t;e++)this.matrices[e]=new i.i,this.bonesAabbVersions[e]=-1}updateMatrices(e){a.copy(e.getWorldTransform()).invert();for(let e=this.bones.length-1;e>=0;e--)null!==this.bones[e]&&e<this.matrices.length&&(this.matrices[e].mul2(a,this.bones[e].getWorldTransform()),this.matrices[e].mul2(this.matrices[e],this.skin.inverseBindPose[e]))}updateMatrixPalette(){const e=this.matrixPalette;for(let t=this.bones.length-1;t>=0;t--)if(t<this.matrices.length){const s=this.matrices[t].data,i=16*t;e[i]=s[0],e[i+1]=s[1],e[i+2]=s[2],e[i+3]=s[3],e[i+4]=s[4],e[i+5]=s[5],e[i+6]=s[6],e[i+7]=s[7],e[i+8]=s[8],e[i+9]=s[9],e[i+10]=s[10],e[i+11]=s[11],e[i+12]=s[12],e[i+13]=s[13],e[i+14]=s[14],e[i+15]=s[15]}this.skin.device.supportsBoneTextures&&(this.boneTexture.lock(),this.boneTexture.unlock())}}},,,,(e,t,s)=>{"use strict";s.d(t,{a:()=>b,b:()=>T,c:()=>R,d:()=>N,e:()=>O});var i=s(2),n=s(0),r=s(1);const a=new Set,o=0,h=1,l=2,c=3;class d{constructor(e,t){this.id=e.keyId,this.curve=e,this.value=null,this._value=null,this.target=t,this.idx=-1,this.interoplateType=o,this.dirty=!1,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"InterpolatedKey")}set(e){this.dirty=this.dirty||e!==this._value||this.curve.targetsLocalEulerAnglesRaw,this._value=e,this.value=e}}let u=null;pc.waitForMecanim.then((e=>{u=e}));let _=null;class m{constructor(){this.weight=!1,this.additive=!1}}class p{constructor(){this.applyRootMotion=!1,this.hasTransformHierarchy=!1,this.supportsOnAnimatorMove=!1,this.layers=[]}getLayer(e){return e>this.layers.length?(this.layers.length=e,this.layers[e]=new m):this.layers[e]||(this.layers[e]=new m),this.layers[e]}}class g{constructor(e){this.animator=e,this.animatorCS=e.code,this.animatorCache=new p,this.transformHierarchy=new O(e.entity),this.animatorWASM=new u.Animator(this.animatorCS.name,this.animatorCS.GetInstanceID(),this.transformHierarchy.rootT),this.graph=new R,this.graph.initializeGraph(this.animatorCS),this.isDirty=!0}awakeFromLoad(){this.animatorWASM.awakeFromLoad()}deactivate(){this.animatorWASM.deactivate()}rebind(e){this.animatorWASM.rebind(e)}updateLayers(){this.graph.rebuildGraph(this.animatorCS),this.setDirty()}updateAvatar(e){this.animatorWASM.setAvatar(e.native),this.setDirty()}updateAnimationSet(e){const t=_||(_={motions:new u.AnimationClipVector},_);t.motions.resize(0,null);for(let s=0;s<e.length;s++){const i=e[s];i&&i.native&&t.motions.push_back(i.native)}this.animatorWASM.setMotions(t.motions),this.setDirty()}updateBindings(){this.animatorCache=new p,this.animatorWASM.rebind(!1),this.graph.setDirty(),this.isDirty=!1}sync(){const e=this.animatorCS,t=this.animatorCache;t.applyRootMotion!==e&&(this.animatorWASM.setApplyRootMotion(e.applyRootMotion),t.applyRootMotion=e.applyRootMotion),t.hasTransformHierarchy!==e.hasTransformHierarchy&&(this.animatorWASM.setHasTransformHierarchy(e.hasTransformHierarchy),t.hasTransformHierarchy=e.hasTransformHierarchy);const s=this.animator.entity.hasMagicMethod("OnAnimatorMove");t.supportsOnAnimatorMove!==s&&(this.animatorWASM.setSupportsOnAnimatorMove(this.animator.entity.hasMagicMethod("OnAnimatorMove")),t.supportsOnAnimatorMove=s);const i=this.animatorCS.stateMachines;for(let e=0;e<i.length;e++)this.synchronizeLayerParameters(e,i[e],this.graph);this.isDirty&&this.updateBindings()}synchronizeLayerParameters(e,t,s){const i=s.layerMixer,n=this.animatorCache.getLayer(e),r=0===e?1:t.layer.defaultWeight;n.weight!==r&&(i.setInputWeight(e,r),n.weight=r),n.additive!==t.layer.isAdditive&&(i.setLayerAdditive(e,t.layer.isAdditive),n.additive=t.layer.isAdditive);const a=s.getLayerPlayables(e);this.synchronizeLayerStateParameters(t,a)}synchronizeLayerStateParameters(e,t){let s=e.state,i=e.stateMotion,n=t.first;const r=t.mixer;s&&(n.setParameters(i&&i.native?i.native:null,s.speed*s.speedMultiplier,s.state.mirror,s.cycleOffset,s.state.writeDefaultValues),r.setInputWeight(0,1)),s=e.nextState,i=e.nextStateMotion,n=t.second,s?(n.setParameters(i&&i.native?i.native:null,s.speed*s.speedMultiplier,s.state.mirror,s.cycleOffset,s.state.writeDefaultValues),e.transition&&(r.setInputWeight(0,e.transition.FromAlpha),r.setInputWeight(1,e.transition.ToAlpha))):(n.setParameters(null,1,!1,0,!1),r.setInputWeight(1,0))}prepare(e){this.sync(),this.graph.layerMixer.onAdvanceTime(e);for(let t=0;t<this.animatorCS.stateMachines.length;t++){const s=this.animatorCS.stateMachines[t],i=this.graph.getLayerPlayables(t);i.mixer.onAdvanceTime(e),i.first.onAdvanceTime(e),i.second.onAdvanceTime(e),i.first.setTime(s.state.time),i.second.setTime(s.nextState?s.nextState.time:0)}}syncJsToWasm(){this.transformHierarchy.syncHierarchyToWASM()}syncWasmToJs(){this.transformHierarchy.syncHierarchyToJS()}fkPass(e){u.Animator.fkPass(this.animatorWASM,this.graph.layerMixer,e)}ikPass(e){u.Animator.ikPass(this.animatorWASM,this.graph.layerMixer,e)}applyOnAnimationMove(e,t){u.Animator.applyOnAnimatorMove(this.animatorWASM,e,t)}applyBuiltinRootMotion(e){this.animatorWASM.applyBuiltinRootMotion(e)}free(){this.graph.dispose(),this.animatorWASM.delete(),this.animatorWASM=null,this.transformHierarchy.dispose(),this.transformHierarchy=null}setDirty(){this.isDirty=!0}get rootMotionTargetRotation(){const e=new n.j,t=this.animatorWASM.getBuiltinRootMotionTargetRotationJS();return N.readFloat4(t,e),e}get angularVelocity(){const e=new n.m,t=this.animatorWASM.getAngularVelocityJS();return N.readFloat3(t,e),e}get bodyPosition(){const e=new n.m,t=this.animatorWASM.getBodyRotationJS();return N.readFloat3(t,e),e}get bodyRotation(){const e=new n.j,t=this.animatorWASM.getBodyRotationJS();return N.readFloat4(t,e),e}get deltaPosition(){const e=new n.m,t=this.animatorWASM.getDeltaPositionJS();return N.readFloat3(t,e),e}get deltaRotation(){const e=new n.j,t=this.animatorWASM.getDeltaRotationJS();return N.readFloat4(t,e),e}get gravityWeight(){return this.animatorWASM.getGravityWeightJS()}get pivotPosition(){const e=new n.m,t=this.animatorWASM.getPivotPositionJS();return N.readFloat3(t,e),e}get pivotWeight(){return this.animatorWASM.getPivotWeightJS()}get targetPosition(){const e=new n.m,t=this.animatorWASM.getTargetPositionJS();return N.readFloat3(t,e),e}get targetRotation(){const e=new n.j,t=this.animatorWASM.getTargetRotationJS();return N.readFloat4(t,e),e}get velocity(){const e=new n.m,t=this.animatorWASM.getVelocityJS();return N.readFloat3(t,e),e}get animatorGraph(){return this.graph}get hierarchy(){return this.transformHierarchy}}let f=null;pc.waitForMecanim.then((e=>{f=e}));let y=!1;const E=function(){y||(window.traceResults.markModuleAsUsed(window.traceResults.EngineModules.Mecanim),y=!0)};class T extends r.k{constructor(){super(),this.wasmSampler=null,this.code=UnityEngine.Object.FromHandle(UnityEngine.Animator,this),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"AnimatorComponent")}onEnable(){return!!super.onEnable()&&(this.code.OnEnable(),!0)}onUpdate(e){this.code.AddTime(e)}onDestroy(){return this.wasmSampler&&(this.wasmSampler.free(),this.wasmSampler=null),super.onDestroy()}onTransformChildrenChanged(){this.hasWASMSampler()&&this.wasmSampler.hierarchy.rebuildTransformHierarchy()}_queuesToSubscribe(){return["onUpdate"]}hasWASMSampler(){return!!this.wasmSampler}getWASMSampler(){return TRACE&&E(),this.wasmSampler}createWASMSampler(){if(TRACE&&E(),this.hasWASMSampler())throw new Error("Sampler exists. Please destroy previous one before new one creation!");this.wasmSampler=new g(this)}destroyWASMSampler(){TRACE&&E(),this.wasmSampler&&(this.wasmSampler.free(),this.wasmSampler=null)}updateAnimatorController(){TRACE&&E(),this.wasmSampler&&this.wasmSampler.updateLayers()}updateAvatar(e){TRACE&&E(),this.wasmSampler&&this.wasmSampler.updateAvatar(e)}updateAnimationSet(e){TRACE&&E(),this.wasmSampler&&this.wasmSampler.updateAnimationSet(e)}layerStateChanged(e){TRACE&&E(),this.wasmSampler&&this.wasmSampler.animatorGraph.getLayerPlayables(e).swap()}}T.isMecanimWASMModuleProvided=function(){return!!f};let S=null;pc.waitForMecanim.then((e=>{S=e}));class A extends r.j{constructor(e){super(e),this.id="animator",this.performanceSamplerSection=r.d.ANIMATORS,S&&S.StaticInitializer.initialize()}destroy(){S&&S.StaticInitializer.cleanup(),super.destroy()}}class b extends r.k{constructor(){super(),this["__UnityEngine.Animation"]=null,this.code=UnityEngine.Object.FromHandle(UnityEngine.Animation,this),TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"AnimationComponent")}onEnable(){return!!super.onEnable()&&(this.code.OnEnable(),!0)}onUpdate(e){this.code.AddTime(e)}_queuesToSubscribe(){return["onUpdate"]}}class C extends r.j{constructor(e){super(e),this.id="animation",this.performanceSamplerSection=r.d.ANIMATIONS}}let w=null;pc.waitForMecanim.then((e=>{w=e}));class x{constructor(){this.firstClipPlayable=null,this.secondClipPlayable=null,this.clipMixerPlayable=null,this.disposed=!1,this.initialize()}swap(){const e=this.firstClipPlayable,t=this.secondClipPlayable;this.firstClipPlayable=t,this.secondClipPlayable=e,this.clipMixerPlayable.swapInputs()}initialize(){this.firstClipPlayable=new w.AnimationClipSampler,this.secondClipPlayable=new w.AnimationClipSampler,this.clipMixerPlayable=new w.AnimationClipMixer,w.SamplerBase.connectNoTopologyChange(this.firstClipPlayable,this.clipMixerPlayable,-1,-1),w.SamplerBase.connectNoTopologyChange(this.secondClipPlayable,this.clipMixerPlayable,-1,-1)}dispose(){this.disposed||(this.disposed=!0,this.firstClipPlayable.dispose(),this.firstClipPlayable.delete(),this.firstClipPlayable=null,this.secondClipPlayable.dispose(),this.secondClipPlayable.delete(),this.secondClipPlayable=null,this.clipMixerPlayable.dispose(),this.clipMixerPlayable.delete(),this.clipMixerPlayable=null)}get first(){return this.firstClipPlayable}get second(){return this.secondClipPlayable}get mixer(){return this.clipMixerPlayable}}class R{constructor(){this.layersMixerPlayable=null,this.layers=[],this.initialized=!1}rebuildGraph(e){this.dispose(),this.initializeGraph(e)}initializeGraph(e){if(this.initialized)return;this.layersMixerPlayable=new w.AnimationLayerMixer;const t=e.stateMachines.length;this.layers.length=t;for(let t=0;t<e.stateMachines.length;t++){const e=this.layers[t]=new x;w.SamplerBase.connectNoTopologyChange(e.mixer,this.layersMixerPlayable,-1,-1)}this.initialized=!0}dispose(){if(this.initialized){this.initialized=!1;for(const e of this.layers)e.dispose();this.layers.length=0,this.layersMixerPlayable.dispose(),this.layersMixerPlayable.delete(),this.layersMixerPlayable=null}}checkInitialized(){if(!this.initialized)throw new Error("Animator graph is not initialized. Please initialize it before!")}getLayerPlayables(e){if(this.checkInitialized(),e>this.layers.length)throw new RangeError("Layer index is out of the range");return this.layers[e]}setDirty(){this.layersMixerPlayable.setDirty();for(const e of this.layers)e.first.setDirty(),e.second.setDirty(),e.mixer.setDirty()}get layerMixer(){return this.checkInitialized(),this.layersMixerPlayable}}let I=null;pc.waitForMecanim.then((e=>{I=e}));const M=new n.m,P=new n.j,v=new n.m;class D{constructor(e,t){this.node=e,this.transform=t,this.aabbVersion=-1}}class O{constructor(e){if(!e)throw ReferenceError("Object reference not set to an instance of an object.");this.app=pc.Application.getApplication(),this.node=e,this.hierarchy=null,this.hierarchyHeadPointer=0,this.rebuildTransformHierarchy()}rebuildTransformHierarchy(){this.hierarchy&&this.destroyTransformHierarchy();const e=new D(this.node,new I.Transform(this.node.name,this.node.$id));this.hierarchy=[e],this.buildHierarchyRecursive(e,this.hierarchy),this.hierarchyHeadPointer=e.transform.getLocalTransforms()}dispose(){this.hierarchy&&this.destroyTransformHierarchy()}syncHierarchyToJS(e=!1){const t=this.hierarchyHeadPointer,s=this.hierarchy.length,i=N.trsXSize;let n=!1;for(let a=e?1:0;a<s;++a){const e=t+i*a;N.readTRS(e,M,P,v);const s=this.hierarchy[a],o=s.node;o._localPosition.approximatelyEquals(M,Number.EPSILON)||(o.setLocalPositionGraphNodeNoDirty(M.x,M.y,M.z),o.flags|=r.g.PositionDirty,n=!0),o._localRotation.approximatelyEquals(P,Number.EPSILON)||(o.setLocalRotationNoDirty(P.x,P.y,P.z,P.w),o.flags|=r.g.RotationDirty,n=!0),o._localScale.approximatelyEquals(v,Number.EPSILON)||(o.setLocalScaleNoDirty(v.x,v.y,v.z),o.flags|=r.g.ScaleDirty,n=!0),n&&(o.increaseTransformVersion(),s.aabbVersion=o._aabbVer)}n&&(this.app.systems.physics.syncTransforms(this.hierarchy[0].node),this.app.systems.physics2D.syncTransforms(this.hierarchy[0].node))}syncHierarchyToWASM(e=!1){const t=this.hierarchyHeadPointer,s=this.hierarchy.length,i=N.trsXSize;for(let n=e?1:0;n<s;++n){const e=t+i*n,s=this.hierarchy[n],r=this.hierarchy[n].node;s.aabbVersion!==r._aabbVer&&(s.aabbVersion=r._aabbVer,N.writeTRS(e,r.localPosition,r.localRotation,r.localScale))}}buildHierarchyRecursive(e,t){for(const s of e.node.children){const i=new D(s,new I.Transform(s.name,s.$id));i.transform.setParent(e.transform),t.push(i),this.buildHierarchyRecursive(i,this.hierarchy)}}destroyTransformHierarchy(){for(const e of this.hierarchy)e.transform.delete();this.hierarchy.length=0,this.hierarchy=null}get rootT(){return this.hierarchy.length>0?this.hierarchy[0].transform:null}}let L=null,F=null;pc.waitForMecanim.then((e=>{e&&(L=e,F=L.HEAPF32)}));const U=function(e){if(e<=0)throw new Error(`Invalid pointer ${e}!`)},B=function(e){return e>>2},N={readFloat3:function(e,t){U(e);const s=B(e);t.x=F[s],t.y=F[s+1],t.z=F[s+2]},writeFloat3:function(e,t){U(e);const s=B(e);F[s]=t.x,F[s+1]=t.y,F[s+2]=t.z},readFloat4:function(e,t){U(e);const s=B(e);t.x=F[s],t.y=F[s+1],t.z=F[s+2],t.w=F[s+3]},writeFloat4:function(e,t){U(e);const s=B(e);F[s]=t.x,F[s+1]=t.y,F[s+2]=t.z,F[s+3]=t.w},readTRS:function(e,t,s,i){U(e);const n=B(e);t.x=F[n],t.y=F[n+1],t.z=F[n+2],s.x=F[n+3],s.y=F[n+4],s.z=F[n+5],s.w=F[n+6],i.x=F[n+7],i.y=F[n+8],i.z=F[n+9]},writeTRS:function(e,t,s,i){U(e);const n=B(e);F[n]=t.x,F[n+1]=t.y,F[n+2]=t.z,F[n+3]=s.x,F[n+4]=s.y,F[n+5]=s.z,F[n+6]=s.w,F[n+7]=i.x,F[n+8]=i.y,F[n+9]=i.z},trsXSize:40};pc.CurveSampler=class{constructor(){this.keys={},this.keyArray=[],this.eventsMemo={},this.events=[],this.aQuat=new n.j,this.bQuat=new n.j,this.resultQuat=new n.j,this.copiedFrom={},this.id=(0,i.b)(),this.targetObjectsSet=!1,this.cycleNumber=0,TESTS&&pc.hiddenShapeValidator.addObjectToValidationSet(this,"CurveSampler")}putKey(e){this.keys[e.id]=e,this.keyArray.push(e)}pushEvent(e){e.id=e.id||(0,i.b)(),this.eventsMemo[e.id]||(this.eventsMemo[e.id]=!0,this.events.push(e))}popEvents(){const e=this.events;return this.events=[],e}recycleEvents(){let e=-1;for(let t=0;t<this.events.length;t++)e=Math.max(e,this.events[t].time);return this.events=[],this.eventsMemo={},e}copyKeysFromSampler(e){for(let t=0;t<e.keyArray.length;t++){const s=e.keyArray[t];this.keys[s.id]||this.putKey(new d(s.curve,s.target))}this.copiedFrom[e.id]=!0,this.targetObjectsSet=!1}blendSamplers(e,t,s,i){this.copiedFrom[e.id]||this.copyKeysFromSampler(e),this.copiedFrom[s.id]||this.copyKeysFromSampler(s);const n=i/(t+i);if(!Number.isNaN(n)){r.d.instance.recordActiveBlendState();for(let t=0;t<this.keyArray.length;t++){const i=this.keyArray[t],r=e.keys[i.id],a=s.keys[i.id];if(!r||!a){const e=r||a;i.set(e.value);continue}i.interoplateType===o&&(i.interoplateType=this.figureInterpolateType(i.curve,i));const d=r.value,u=a.value;switch(i.interoplateType){case h:{const i=this.keyArray[t+0],r=this.keyArray[t+1],a=this.keyArray[t+2],o=this.keyArray[t+3];null===this.aQuat?this.resultQuat=this.bQuat:null===this.bQuat?this.resultQuat=this.aQuat:(this.aQuat.x=e.keys[i.id].value,this.aQuat.y=e.keys[r.id].value,this.aQuat.z=e.keys[a.id].value,this.aQuat.w=e.keys[o.id].value,this.bQuat.x=s.keys[i.id].value,this.bQuat.y=s.keys[r.id].value,this.bQuat.z=s.keys[a.id].value,this.bQuat.w=s.keys[o.id].value,this.resultQuat=this.resultQuat.slerp(this.aQuat,this.bQuat,n)),i.set(this.resultQuat.x),r.set(this.resultQuat.y),a.set(this.resultQuat.z),o.set(this.resultQuat.w),t+=3}break;case c:i.set(u);break;case l:{let e=(1-n)*d+n*u;Object.is(e,-0)&&(e=0),i.set(e)}}}}}figureInterpolateType(e,t){const s=t.curve.targetObject;return t.target&&null!==t.target[s]&&void 0!==t.target[s]&&t.target[s].constructor===n.j||"m_LocalRotation"===s?h:e.objectCurve?c:l}ensureTargetObjects(e){e.__defaults__=e.__defaults__||{};for(let t=0;t<this.keyArray.length;t++){const s=this.keyArray[t];if(s.target||(s.target=this.findTargetObject(e.handle,s.curve),s.interoplateType=this.figureInterpolateType(s.curve,s)),s.target&&!e.__defaults__.hasOwnProperty(s.id)){const t=new d(s.curve,s.target);if(s.curve.targetObject){if(!s.target[s.curve.targetObject])continue;s.curve.isMaterialPropertyCurve?this.setMaterialProperty(t,s):this.setObjectProperty(t,s)}else t.value=s.target[s.curve.targetProperty];e.__defaults__[t.id]=t}}this.targetObjectsSet=!0}findTargetObject(e,t){const s=t.path.split("/");for(let t=0;t<s.length&&e;t++)s[t].length>0&&(e=e.findByNameImmediate(s[t]));if(!e)return null;if("UnityEngine.GameObject"===t.componentType)return UnityEngine.Object.FromHandle(UnityEngine.GameObject,e);const i=Bridge._getTypeByName(t.componentType);return UnityEngine.Object.FromHandle(UnityEngine.GameObject,e).GetComponent(i)}setMaterialProperty(e,t){const s=t.target[t.curve.targetObject],i=t.curve.targetProperty,n=s.handle.parameters[i];if(!n)return;const r=n.data;t.curve.isVectorProperty?e.value=r[t.curve.vectorPropertyIndex]:e.value=r}setObjectProperty(e,t){e.value=t.target[t.curve.targetObject][t.curve.targetProperty]}applyKey(e){if(!e.target)return;let t=e.target[e.curve.targetObject];if(!t)return void(e.target[e.curve.targetProperty]=e.value);const s=e.curve.targetProperty;if(e.curve.isMaterialPropertyCurve){t=e.target[e.curve.targetObject].handle.parameters;const i=t[s];i&&(e.curve.isVectorProperty?(i.data[e.curve.vectorPropertyIndex]=e.value,i.scopeId&&i.scopeId.versionObject.increment()):i.data=e.value)}else t[e.curve.targetProperty]=e.value}getOrCreateKey(e,t){let s=this.keys[t];return s||(s=new d(e,void 0),this.putKey(s)),s}writeDefaults(e){if(e.__defaults__)for(const t in e.__defaults__){const s=e.__defaults__[t];this.applyKey(s);const i=s.target;i.OnDidApplyAnimationProperties&&i.OnDidApplyAnimationProperties(),i.entity&&i.entity.releaseHijackedProperties()}}apply(e){this.targetObjectsSet||this.ensureTargetObjects(e),a.clear(),r.d.instance.recordAnimatedParameters(this.keyArray.length);for(let e=0;e<this.keyArray.length;e++){const t=this.keyArray[e];t.dirty&&(t.dirty=!1,r.d.instance.recordAnimationKeys(t.curve.keys.length),t.target&&t.curve.targetObject&&!t.target[t.curve.targetObject]?(UnityEngine.Debug.LogWarning$1(`AnimationKey issue: Target: ${t.target.name}, TargetObj: ${t&&t.target?t.target.$$fullname:"null"}, TargetField: ${t&&t.curve?t.curve.targetObject:"null"}`),this.keyArray.splice(e,1),e--):(t.target&&(t.target.OnDidApplyAnimationProperties||t.target.entity)&&a.add(t.target),this.applyKey(t)))}for(const e of a)e.OnDidApplyAnimationProperties&&e.OnDidApplyAnimationProperties(),e.entity&&e.entity.releaseHijackedProperties()}},pc.AnimatorComponent=T,pc.AnimatorSystem=A,pc.AnimationComponent=b,pc.AnimationSystem=C,pc.AnimatorWASMSampler=g},,,(e,t,s)=>{"use strict";s.d(t,{a:()=>i});class i{constructor(){this.list=[],this.map={}}getSystemByName(e){const t=this.map[e];if(!t)throw new Error(`Unknown system "${e}"`);return t}get animation(){return this.map.animation}get animator(){return this.map.animator}get audiosourceunity(){return this.map.audiosourceunity}get monoBehaviour(){return this.map.monoBehaviour}get camera(){return this.map.camera}get element(){return this.map.element}get canvasRenderer(){return this.map.canvasRenderer}get light(){return this.map.light}get meshFilter(){return this.map.meshFilter}get particlesystem(){return this.map.particlesystem}get particleSystemRenderer(){return this.map.particleSystemRenderer}get physics(){return this.map.physics}get collider(){return this.map.collider}get joint(){return this.map.joint}get rigidbody(){return this.map.rigidbody}get physics2D(){return this.map.physics2D}get collider2D(){return this.map.collider2D}get effector2D(){return this.map.effector2D}get joint2D(){return this.map.joint2D}get rigidbody2D(){return this.map.rigidbody2D}get reflectionprobe(){return this.map.reflectionprobe}get renderer(){return this.map.renderer}get screen(){return this.map.screen}get unitymanager(){return this.map.unitymanager}get videoPlayer(){return this.map.videoPlayer}get sortingGroup(){return this.map.sortingGroup}get skybox(){return this.map.skybox}get unity(){return this.map.unity}add(e){const t=e.id;if(this.map[t])throw new Error(`ComponentSystem name "${t}" already registered or not allowed`);this.map[t]=e,this.list.push(e)}remove(e){const t=e.id;if(!this.map[t])throw new Error(`No ComponentSystem named "${t}" registered"`);this.map[t]=null;const s=this.list.indexOf(this.map[t]);-1!==s&&this.list.splice(s,1)}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>n});const i=function(e,t){const s=e.internalExecutionOrder-t.internalExecutionOrder;return 0!==s?s:e._scriptsExecutionOrder-t._scriptsExecutionOrder};class n{constructor(){this._components=[],this._needsSort=!1,this.processing=!1}push(e){e._scriptsExecutionOrder=4294967296*(e.scriptsExecutionOrder+32768)+(e.sortingOrderInQueue+2147483648),0!==this._components.length&&e._scriptsExecutionOrder<this._components[this._components.length-1]._scriptsExecutionOrder&&(this._needsSort=!0),this._components.push(e)}getComponents(){return this._needsSort&&(this._needsSort=!1,this._components.sort(i)),this._components.slice()}delete(e){for(let t=0;t<this._components.length;t++)if(e===this._components[t]._id)return void this._components.splice(t,1)}clear(){this._components.length=0}get length(){return this._components.length}}},(e,t,s)=>{"use strict";s.d(t,{a:()=>i,b:()=>n});class i{constructor(e,t,s){this.scopeId=e,this.data=t,this.passFlags=s}}class n{constructor(){this.parameters={},this.batchId=0}getParameter(e){const t=this.parameters[e];return t?t.data:null}setParameter(e,t,s=-524285){const n=this.parameters[e];n?(n.data=t,n.passFlags=s):this.parameters[e]=new i(null,t,s),this.batchId=0}deleteParameter(e){this.parameters[e]&&(delete this.parameters[e],this.batchId=0)}}}]]);"use strict";(self.webpackChunkluna=self.webpackChunkluna||[]).push([[3],{},e=>{e.O(0,[1],(()=>{return t=2,e(e.s=t);var t}));e.O()}]),(self.webpackChunkluna=self.webpackChunkluna||[]).push([[6],{},e=>{e.O(0,[1],(()=>{return t=0,e(e.s=t);var t}));e.O()}]),(self.webpackChunkluna=self.webpackChunkluna||[]).push([[5],{},e=>{e.O(0,[1],(()=>{return t=45,e(e.s=t);var t}));e.O()}]),(self.webpackChunkluna=self.webpackChunkluna||[]).push([[4],{},e=>{e.O(0,[1],(()=>{return t=1,e(e.s=t);var t}));e.O()}]),(self.webpackChunkluna=self.webpackChunkluna||[]).push([[11],{},e=>{e.O(0,[1],(()=>{return t=5,e(e.s=t);var t}));e.O()}]),(self.webpackChunkluna=self.webpackChunkluna||[]).push([[10],{},e=>{e.O(0,[1],(()=>{return t=42,e(e.s=t);var t}));e.O()}]),(self.webpackChunkluna=self.webpackChunkluna||[]).push([[2],{},e=>{e.O(0,[1],(()=>{return t=55,e(e.s=t);var t}));e.O()}]),(self.webpackChunkluna=self.webpackChunkluna||[]).push([[14],{},e=>{e.O(0,[1],(()=>{return t=43,e(e.s=t);var t}));e.O()}]),(self.webpackChunkluna=self.webpackChunkluna||[]).push([[13],{57:(e,t,s)=>{var i=s(1),n=s(0),r=s(5);class a{constructor(e){this.application=e,this.network=e.network,this.objectSpace=e.objectSpace,this.registry=this.objectSpace.getRegistry()}get app(){return this.application.app}get graphicsDevice(){return this.app.graphicsDevice}loadAsync(e,t,s){throw new Error("Not Implemented")}unloadAsync(e){throw new Error("Not Implemented")}}var o=s(55),h=s(2),l=s(43);const c=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Scene.GameObject"],d=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.Transform"],u=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.Animator"],_=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.Animation"],m=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.Canvas"],p=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.CanvasGroup"],g=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.RectTransform"],f=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.Camera"],y=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.AudioSource"],E=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.Light"],T=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.MeshFilter"],S=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.MeshRenderer"],A=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.ParticleSystemRenderer"],b=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.SkinnedMeshRenderer"],C=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.SpriteRenderer"],w=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.SpriteMask"],x=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.Rigidbody"],R=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.BoxCollider"],I=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.SphereCollider"],M=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.MeshCollider"],P=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.CapsuleCollider"],v=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.Rigidbody2D"],D=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.BoxCollider2D"],O=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.CircleCollider2D"],L=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.CapsuleCollider2D"],F=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.EdgeCollider2D"],U=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.PolygonCollider2D"],B=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.SpringJoint2D"],N=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.DistanceJoint2D"],k=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.FixedJoint2D"],z=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.HingeJoint2D"],V=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.WheelJoint2D"],G=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.FrictionJoint2D"],H=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.RelativeJoint2D"],j=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.SliderJoint2D"],W=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.TargetJoint2D"],Y=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.LineRenderer"],K=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.TrailRenderer"],Q=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.PlatformEffector2D"],X=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Components.SortingGroup"];class q extends a{fork(){const e=new q(this.application);return e.registry=e.registry.Clone().AllowUpdate(),e}loadAsync(e,t,s){if(this.app.systems.monoBehaviour.creatingPrefabs){const e={isPrefabProxy:!0,prefab:t};return this.registry.Put(t.id,e)}const i=this._loadObject(e,e.root,t,this.registry);return i.isPrefab=this.app.systems.monoBehaviour.creatingPrefabs,i.objectJson=t,i}_loadObject(e,t,s,n,r=!1){if(n.Has(s.id)&&!n.updatesAllowed){const e=n.Get(s.id);if(!e.isPrefabProxy)return e;n.Release(s.id)}const a=s.data,o=new i.f(a[c.name],this.app,r||this.app.systems.monoBehaviour.creatingPrefabs);o.enabled=!!a[c.enabled],o.cullingLayer=a[c.layer],o.static=!!a[c.isStatic],o.tag=i.i.instance.allTagsInProject[a[c.tagId]],o._graphDepth=t?t.graphDepth+1:0,o.isPrefab&&(o.objectJson=s);const h=s.children;for(let t=0;t<h.length;t++)this._loadObject(e,o,h[t],this.registry);const l=s.components,d=Deserializers.typeNameToIdMap["UnityEngine.CanvasRenderer"];for(let e=0;e<l.length;e++)l[e].type===d&&e>1&&([l[1],l[e]]=[l[e],l[1]]);for(let t=0;t<l.length;t++)this._loadComponent(e,o,l[t],this.registry),o.flags|=i.g.TransformDirty;return t&&t.addChild(o,!0),n.Put(s.id,o)}unloadAsync(e){for(let t=0;t<e.components.length;t++)this.registry.Release(e.components[t].id);for(let t=0;t<e.children.length;t++)this.unloadAsync(e.children[t])}_loadComponent(e,t,s,i){let n=null;switch(Deserializers.types[s.type]){case"UnityEngine.Transform":n=this._loadTransformComponent(e,t,s,i);break;case"UnityEngine.Animator":n=this._loadAnimatorComponent(e,t,s,i);break;case"UnityEngine.Animation":n=this._loadAnimationComponent(e,t,s,i);break;case"UnityEngine.Canvas":n=this._loadCanvasComponent(e,t,s,i);break;case"UnityEngine.CanvasGroup":n=this._loadCanvasGroupComponent(e,t,s,i);break;case"UnityEngine.EventSystems.UIBehaviour":n=this._loadUIBehaviourComponent(e,t,s,i);break;case"UnityEngine.TextMesh":n=this._loadTextMesh(e,t,s,i);break;case"UnityEngine.RectTransform":n=this._loadRectTransformComponent(e,t,s,i);break;case"UnityEngine.Camera":n=this._loadCameraComponent(e,t,s,i);break;case"UnityEngine.Video.VideoPlayer":n=this._loadVideoPlayerComponent(e,t,s,i);break;case"UnityEngine.AudioSource":n=this._loadAudioSourceComponent(e,t,s,i);break;case"UnityEngine.Light":n=this._loadLightComponent(e,t,s,i);break;case"UnityEngine.MeshFilter":n=this._loadMeshFilterComponent(e,t,s,i);break;case"UnityEngine.SkinnedMeshRenderer":n=this._loadSkinnedMeshRendererComponent(e,t,s,i);break;case"UnityEngine.MeshRenderer":n=this._loadMeshRendererComponent(e,t,s,i);break;case"UnityEngine.SpriteRenderer":n=this._loadSpriteRendererComponent(e,t,s,i);break;case"UnityEngine.SpriteMask":n=this._loadSpriteMaskComponent(e,t,s,i);break;case"UnityEngine.MonoBehaviour":n=this._loadMonoBehaviourComponent(e,t,s,i);break;case"UnityEngine.Rigidbody":n=this._loadRigidbodyComponent(e,t,s,i);break;case"UnityEngine.BoxCollider":n=this._loadBoxColliderComponent(e,t,s,i);break;case"UnityEngine.SphereCollider":n=this._loadSphereColliderComponent(e,t,s,i);break;case"UnityEngine.MeshCollider":n=this._loadMeshColliderComponent(e,t,s,i);break;case"UnityEngine.CapsuleCollider":n=this._loadCapsuleColliderComponent(e,t,s,i);break;case"UnityEngine.WheelCollider":n=this._loadWheelColliderComponent(e,t,s,i);break;case"UnityEngine.CharacterController":n=this._loadCharacterControllerComponent(e,t,s,i);break;case"UnityEngine.Rigidbody2D":n=this._loadRigidbody2DComponent(e,t,s,i);break;case"UnityEngine.BoxCollider2D":n=this._loadBoxCollider2DComponent(e,t,s,i);break;case"UnityEngine.CircleCollider2D":n=this._loadCircleCollider2DComponent(e,t,s,i);break;case"UnityEngine.CapsuleCollider2D":n=this._loadCapsuleCollider2DComponent(e,t,s,i);break;case"UnityEngine.EdgeCollider2D":n=this._loadEdgeCollider2DComponent(e,t,s,i);break;case"UnityEngine.PolygonCollider2D":n=this._loadPolygonCollider2DComponent(e,t,s,i);break;case"UnityEngine.SpringJoint2D":n=this._loadSpringJoint2DComponent(e,t,s,i);break;case"UnityEngine.DistanceJoint2D":n=this._loadDistanceJoint2DComponent(e,t,s,i);break;case"UnityEngine.FixedJoint2D":n=this._loadFixedJoint2DComponent(e,t,s,i);break;case"UnityEngine.HingeJoint2D":n=this._loadHingeJoint2DComponent(e,t,s,i);break;case"UnityEngine.WheelJoint2D":n=this._loadWheelJoint2DComponent(e,t,s,i);break;case"UnityEngine.FrictionJoint2D":n=this._loadFrictionJoint2DComponent(e,t,s,i);break;case"UnityEngine.RelativeJoint2D":n=this._loadRelativeJoint2DComponent(e,t,s,i);break;case"UnityEngine.SliderJoint2D":n=this._loadSliderJoint2DComponent(e,t,s,i);break;case"UnityEngine.TargetJoint2D":n=this._loadTargetJoint2DComponent(e,t,s,i);break;case"UnityEngine.PlatformEffector2D":n=this._loadPlatformEffector2DComponent(e,t,s,i);break;case"UnityEngine.ParticleSystem":n=this._loadParticleSystemComponent(e,t,s,i);break;case"UnityEngine.ParticleSystemRenderer":n=this._loadParticleSystemRendererComponent(e,t,s,i);break;case"UnityEngine.LineRenderer":n=this._loadLineRendererComponent(e,t,s,i);break;case"UnityEngine.CanvasRenderer":n=this._loadCanvasRendererComponent(e,t,s,i);break;case"UnityEngine.TrailRenderer":n=this._loadTrailRendererComponent(e,t,s,i);break;case"UnityEngine.ReflectionProbe":n=this._loadReflectionProbeComponent(e,t,s,i);break;case"UnityEngine.Rendering.SortingGroup":n=this._loadSortingGroupComponent(t,s,i);break;case"UnityEngine.Skybox":n=this._loadSkyboxComponent(e,t,s);break;case"UnityEngine.SpringJoint":case"UnityEngine.FixedJoint":case"UnityEngine.HingeJoint":case"UnityEngine.CharacterJoint":case"UnityEngine.ConfigurableJoint":n=this._loadJointComponent(e,t,s,i)}return n&&(i.Has(s.id)&&i.Release(s.id),i.Put(s.id,n)),n}_loadTransformComponent(e,t,s,n){const r=s.data;return t.setLocalPositionGraphNodeNoDirty(r[d.position+0],r[d.position+1],r[d.position+2]),t.setLocalRotationNoDirty(r[d.rotation+0],r[d.rotation+1],r[d.rotation+2],r[d.rotation+3]),t.setLocalScaleNoDirty(r[d.scale+0],r[d.scale+1],r[d.scale+2]),t.flags|=i.g.TransformDirty,t["__UnityEngine.Transform"]=new UnityEngine.Transform(t),t}_loadAnimatorComponent(e,t,s,i){const n=s.data,r=new o.b;t.addUnityComponentFromDeserialization("animator",r),r._entity=t;const a=new UnityEngine.Animator(r);r._enabled=!!n[u.enabled],r.code=a,a.animatorController=i.TryGet(n[u.animatorController+1]),a.avatar=i.TryGet(n[u.avatar+1]),a.updateMode=n[u.updateMode],a.hasTransformHierarchy=n[u.hasTransformHierarchy],a.hasTransformHierarchy=!!n[u.hasTransformHierarchy],a.applyRootMotion=!!n[u.applyRootMotion];const h=n[u.humanBones],l=r.code.humanBones;for(let t=0;t<h.length;t+=2)e.r(h[t+0],h[t+1],2,l);return r}_loadAnimationComponent(e,t,s,i){const n=s.data,r=new(System.Collections.Generic.List$1(UnityEngine.AnimationClip).ctor),a=n[_.clips];for(let e=0;e<a.length;e+=2){const t=i.Get(a[e+1]);r.add(t)}const h=new o.a;h._enabled=!!n[_.enabled],h._entity=t,t.addUnityComponentFromDeserialization("animation",h);const l=h["__UnityEngine.Animation"];return l.playAutomatically=n[_.playAutomatically],l.clip=i.TryGet(n[_.clip+1]),l.clips=r,l.wrapMode=n[_.wrapMode],h.code=l,h}_loadCanvasComponent(e,t,s,n){const r=i.h.create(t,Deserializers.types[s.type],!!s.data[m.enabled]);return r.code.ConfigureForEntity(t),t.screen.$id=s.id,t.addUnityComponentFromDeserialization("monoBehaviour",r),r.code.enabled=s.data[m.enabled],r.code.internalExecutionOrder=0,e.deserializeTo(s.data,r.code,"Luna.Unity.DTO.UnityEngine.Components.Canvas"),r}_loadCanvasGroupComponent(e,t,s,n){const r=i.h.create(t,Deserializers.types[s.type],s.data[p.enabled]);return r.code.code=r.code,e.deserializeTo(s.data,r.code,"Luna.Unity.DTO.UnityEngine.Components.CanvasGroup"),t.addUnityComponentFromDeserialization("monoBehaviour",r),r}_loadUIBehaviourComponent(e,t,s,n){const r=Deserializers.types[s.class],a=i.h.create(t,r,s.enabled);return a?(a.code.ConfigureForEntity(t),e.deserializeTo(s.data,a.code),t.addUnityComponentFromDeserialization("monoBehaviour",a),a):null}_loadTextMesh(e,t,s,n){const r=i.h.create(t,Deserializers.types[s.type],!0);return r?(r.code.ConfigureForEntity(t),e.deserializeTo(s.data,r.code,"Luna.Unity.DTO.UnityEngine.Components.TextMesh"),t.addUnityComponentFromDeserialization("monoBehaviour",r),r):null}_loadRectTransformComponent(e,t,s,r){const a=s.data;t.addComponent("element",{pivot:new n.l(a[g.pivot+0],a[g.pivot+1]),anchor:new n.n(a[g.anchorMin+0],a[g.anchorMin+1],a[g.anchorMax+0],a[g.anchorMax+1]),sizeDelta:new n.l(a[g.sizeDelta+0],a[g.sizeDelta+1]),anchoredPosition:new n.l(a[g.anchoredPosition3D+0],a[g.anchoredPosition3D+1])}),t.element._width=t.element.sizeDelta.x,t.element._height=t.element.sizeDelta.y;const o=t.getLocalPosition();return t.setLocalPositionGraphNodeNoDirty(o.x,o.y,a[g.anchoredPosition3D+2]),t.setLocalRotationNoDirty(a[g.rotation+0],a[g.rotation+1],a[g.rotation+2],a[g.rotation+3]),t.setLocalScaleNoDirty(a[g.scale+0],a[g.scale+1],a[g.scale+2]),t.flags|=i.g.TransformDirty,t["__UnityEngine.Transform"]=t["__UnityEngine.RectTransform"]=new UnityEngine.RectTransform(t),t}_loadCameraComponent(e,t,s,i){const r=s.data,a=r[f.rect];if(t.addComponent("camera",{enabled:!!r[f.enabled],clearColor:new n.d(r[f.backgroundColor+0],r[f.backgroundColor+1],r[f.backgroundColor+2],r[f.backgroundColor+3]),aspectRatio:this.graphicsDevice.width/this.graphicsDevice.height,fov:r[f.fieldOfView],nearClip:r[f.nearClipPlane],farClip:r[f.farClipPlane],clearFlags:r[f.clearFlags],projection:r[f.orthographic]?h.c.PROJECTION_ORTHOGRAPHIC:h.c.PROJECTION_PERSPECTIVE,orthoHeight:r[f.orthographicSize],priority:r[f.depth],cullingMask:r[f.cullingMask],rect:new n.n(a[0],a[1],a[2],a[3]),usePhysicalProperties:r[f.usePhysicalProperties],focalLength:r[f.focalLength],sensorSize:new n.l(r[f.sensorSize+0],r[f.sensorSize+1]),lensShift:new n.l(r[f.lensShift+0],r[f.lensShift+1]),gateFit:r[f.gateFit]}),r[f.targetTexture+1]){const e=UnityEngine.Object.FromHandle(UnityEngine.RenderTexture,this.registry.Get(r[f.targetTexture+1]));if(e){UnityEngine.Object.FromHandle(UnityEngine.Camera,t.camera).targetTexture=e,t.camera.aspectRatio=1*e.handle.width/e.handle.height}}return t.camera}_loadVideoPlayerComponent(e,t,s,i){const n=s.data,a=new r.A,o=new UnityEngine.Video.VideoPlayer(a);return o.ConfigureForEntity(t),a.code=o,t.addUnityComponentFromDeserialization("videoPlayer",a),e.deserializeTo(n,o,"Luna.Unity.DTO.UnityEngine.Components.VideoPlayer"),a}_loadAudioSourceComponent(e,t,s,i){const n=s.data,r=new l.a({loop:n[y.loop],sound:i.TryGet(n[y.clip+1]),playOnAwake:n[y.playOnAwake],volume:n[y.volume],pitch:n[y.pitch]}),a=r.code,o=i.TryGet(n[y.outputAudioMixerGroup+1]);return a.UpdateOutputGroup(o),t.addUnityComponentFromDeserialization("audiosourceunity",r),r.enabled=!!n[y.enabled],r}_loadLightComponent(e,t,s,i){const r=s.data;return t.addComponent("light",{type:["spot","directional","point",null][r[E.type]],color:new n.d(r[E.color+0],r[E.color+1],r[E.color+2],r[E.color+3]),intensity:r[E.intensity],outerConeAngle:r[E.spotAngle],range:r[E.range],cullingMask:r[E.cullingMask],castShadows:r[E.shadows]!==UnityEngine.LightShadows.None,shadowType:h.c.SHADOW_VSM32,affectDynamic:r[E.lightmapBakeType]!==UnityEngine.LightmapBakeType.Baked,affectLightmapped:r[E.lightmapBakeType]<=UnityEngine.LightmapBakeType.Baked,enabled:!!r[E.enabled],renderMode:r[E.renderMode],cookie:i.TryGet(r[E.cookie+1]),cookieScale:new n.l(r[E.cookieSize],r[E.cookieSize]),shadowsMode:r[E.shadows],shadowStrength:r[E.shadowStrength],shadowBias:r[E.shadowBias],shadowNormalBias:r[E.shadowNormalBias],shadowResolution:r[E.shadowResolution]}),t.light}_loadMeshFilterComponent(e,t,s,i){const n=s.data,a=new r.e;t.addUnityComponentFromDeserialization("meshFilter",a),a.id=s.id;const o=n[T.sharedMesh+1];return a.mesh=i.TryGet(o),o&&!a.mesh&&UnityEngine.Debug.LogWarning$1(`GameObject ${t.name} is missing mesh. Check force excluded assets if it got excluded.`,null,DEVELOP?[{Item1:t.name,Item2:`[${t.name}](gameobject://${t._guid})`}]:void 0),a}_loadMeshRendererComponent(e,t,s,i){const n=s.data,a=this._loadRendererComponent(S,new r.f,e,t,s,i),o=a.code;return o.lightProbeUsage=n[S.lightProbeUsage],o.reflectionProbeUsage=n[S.reflectionProbeUsage],a}_loadSkinnedMeshRendererComponent(e,t,s,i){const a=s.data,o=a[b.sharedMesh+1];if(!o)return UnityEngine.Debug.LogWarning$1(`Missing mesh on skinned mesh. GameObject : ${t.name}`,null,DEVELOP?[{Item1:t.name,Item2:`[${t.name}](gameobject://${t._guid})`}]:void 0),null;const h=i.TryGet(o);if(!h)return UnityEngine.Debug.LogWarning$1(`Missing mesh on skinned mesh. Please check that it wasn't excluded from build. GameObject : ${t.name}`,null,DEVELOP?[{Item1:t.name,Item2:`[${t.name}](gameobject://${t._guid})`}]:void 0),null;const l=this._loadRendererComponent(b,new r.m,e,t,s,i),c=l.model;c.mesh=h;const d=l.code;d.lightProbeUsage=a[b.lightProbeUsage],d.reflectionProbeUsage=a[b.reflectionProbeUsage];const u=a[b.bones];if(0!==u.length){const t=new Array(u.length/2),s=new Array(0);for(let i=0;i<u.length;i+=2)e.r(!0,u[i+1],2,s),t.push(u[i+1]);l.model.bones=s,l.model.skin=new r.n(this.graphicsDevice,h.bindposes,t),l.__renderer="skinned-mesh";const i=a[b.localBounds];l.model.skin.localBounds=new n.b(new n.m(i[0],i[1],i[2]),new n.m(i[3],i[4],i[5])),l.model.skin.updateWhenOffscreen=!!a[b.updateWhenOffscreen],e.r(!0,a[b.rootBone+1],0,l.model.skin,"rootBone")}const _=a[b.blendShapesWeights];if(0!==_.length){const e=new r.h(h.morph);e._setBaseMesh(h);for(let t=0;t<_.length;t++)e.setWeight(t,_[t][0]);c.morphInstance=e}return l}_loadSpriteRendererComponent(e,t,s,i){const a=s.data,o=this._loadRendererComponent(C,new r.t,e,t,s,i),h=o.code,l=i.TryGet(a[C.sprite+1]);return h.sortingLayerIndex=UnityEngine.SortingLayer.GetLayerValueFromID(a[C.sortingLayerID]),h.sortingOrder=a[C.sortingOrder],h.color=new n.d(a[C.color+0],a[C.color+1],a[C.color+2],a[C.color+3]),h.flipX=a[C.flipX],h.flipY=a[C.flipY],h.drawMode=a[C.drawMode],h.size=new n.l(a[C.size],a[C.size+1]),h.tileMode=a[C.tileMode],h.adaptiveModeThreshold=a[C.adaptiveModeThreshold],h.maskInteraction=a[C.maskInteraction],h.spriteSortPoint=a[C.spriteSortPoint],l&&(h.sprite=UnityEngine.Object.FromHandle(UnityEngine.Sprite,l)),o.__renderer="sprite",o}_loadSpriteMaskComponent(e,t,s,i){const n=s.data,a=this._loadRendererComponent(w,new r.s,e,t,s,i);a._frontSortingLayerID=n[w.frontSortingLayerID],a._frontSortingOrder=n[w.frontSortingOrder],a._backSortingLayerID=n[w.backSortingLayerID],a._backSortingOrder=n[w.backSortingOrder],a._alphaCutoff=n[w.alphaCutoff],a._isCustomRangeActive=n[w.isCustomRangeActive],a._spriteSortPoint=n[w.spriteSortPoint];const o=i.TryGet(n[w.sprite+1]);return o&&(a.sprite=o),a}_loadRigidbodyComponent(e,t,s,i){const n=s.data,r=new pc.RigidbodyComponent({enabled:!0,maxAngularVelocity:n[x.maxAngularVelocity],mass:n[x.mass],drag:n[x.drag],angularDrag:n[x.angularDrag],useGravity:!!n[x.useGravity],isKinematic:!!n[x.isKinematic],constraints:n[x.constraints],collisionDetectionMode:n[x.collisionDetectionMode],interpolation:n[x.interpolation]});return t.addUnityComponentFromDeserialization("rigidbody",r),r}_loadBoxColliderComponent(e,t,s,i){const r=s.data,a=new pc.BoxColliderComponent({enabled:!!r[R.enabled],size:new n.m(r[R.size+0],r[R.size+1],r[R.size+2]),material:i.TryGet(r[R.material+1]),center:new n.m(r[R.center+0],r[R.center+1],r[R.center+2]),isTrigger:!!r[R.isTrigger]});return t.addUnityComponentFromDeserialization("collider",a),a}_loadSphereColliderComponent(e,t,s,i){const r=s.data,a=new pc.SphereColliderComponent({enabled:!!r[I.enabled],radius:r[I.radius],material:i.TryGet(r[I.material+1]),center:new n.m(r[I.center+0],r[I.center+1],r[I.center+2]),isTrigger:!!r[I.isTrigger]});return t.addUnityComponentFromDeserialization("collider",a),a}_loadMeshColliderComponent(e,t,s,i){const n=s.data,r=new pc.MeshColliderComponent({enabled:!!n[M.enabled],mesh:i.TryGet(n[M.sharedMesh+1]),material:i.TryGet(n[M.material+1]),isTrigger:!!n[M.isTrigger],convex:!!n[M.convex]});return t.addUnityComponentFromDeserialization("collider",r),r}_loadCapsuleColliderComponent(e,t,s,i){const r=s.data,a=new pc.CapsuleColliderComponent({enabled:!!r[P.enabled],radius:r[P.radius],material:i.TryGet(r[P.material+1]),center:new n.m(r[P.center+0],r[P.center+1],r[P.center+2]),height:r[P.height],direction:r[P.direction],isTrigger:!!r[P.isTrigger]});return t.addUnityComponentFromDeserialization("collider",a),a}_loadWheelColliderComponent(e,t,s,i){const n=s.data,r=new pc.WheelColliderComponent,a=UnityEngine.Object.FromHandle(Bridge._getTypeByName(Deserializers.types[s.type]),r);return t.addUnityComponentFromDeserialization("collider",r),e.deserializeTo(n,a,"Luna.Unity.DTO.UnityEngine.Components.WheelCollider"),r}_loadCharacterControllerComponent(e,t,s,i){const n=new pc.CharacterControllerComponent,r=UnityEngine.Object.FromHandle(Bridge._getTypeByName(Deserializers.types[s.type]),n);return t.addUnityComponentFromDeserialization("collider",n),e.deserializeTo(s.data,r,"Luna.Unity.DTO.UnityEngine.Components.CharacterController"),n}_loadRigidbody2DComponent(e,t,s,i){const n=s.data,r=new pc.Rigidbody2DComponent({entity:t,enabled:!0,simulated:n[v.simulated],useAutoMass:n[v.useAutoMass],type:n[v.bodyType],mass:n[v.mass],drag:n[v.drag],angularDrag:n[v.angularDrag],gravityScale:n[v.gravityScale],collisionDetectionMode:n[v.collisionDetectionMode],constraints:n[v.constraints],material:i.TryGet(n[v.material+1])});return t.addUnityComponentFromDeserialization("rigidbody2D",r),r}_loadBoxCollider2DComponent(e,t,s,i){const r=s.data,a=new pc.BoxCollider2DComponent({enabled:!!r[D.enabled],isTrigger:r[D.isTrigger],usedByEffector:r[D.usedByEffector],density:r[D.density],size:new n.l(r[D.size+0],r[D.size+1]),center:new n.l(r[D.offset+0],r[D.offset+1]),radius:r[D.edgeRadius],material:i.TryGet(r[D.material+1])});return t.addUnityComponentFromDeserialization("collider2D",a),a}_loadCircleCollider2DComponent(e,t,s,i){const r=s.data,a=new pc.CircleCollider2DComponent({enabled:!!r[O.enabled],isTrigger:r[O.isTrigger],usedByEffector:r[O.usedByEffector],density:r[O.density],radius:r[O.radius],center:new n.l(r[O.offset+0],r[O.offset+1]),material:i.TryGet(r[O.material+1])});return t.addUnityComponentFromDeserialization("collider2D",a),a}_loadCapsuleCollider2DComponent(e,t,s,i){const r=s.data,a=new pc.CapsuleCollider2DComponent({enabled:!!r[L.enabled],isTrigger:r[L.isTrigger],usedByEffector:r[L.usedByEffector],density:r[L.density],center:new n.l(r[L.offset+0],r[L.offset+1]),material:i.TryGet(r[L.material+1]),direction:r[L.direction],size:new n.l(r[L.size+0],r[L.size+1])});return t.addUnityComponentFromDeserialization("collider2D",a),a}_loadEdgeCollider2DComponent(e,t,s,i){const r=s.data,a=new pc.EdgeCollider2DComponent({enabled:!!r[F.enabled],isTrigger:r[F.isTrigger],usedByEffector:r[F.usedByEffector],density:r[F.density],points:r[F.points],offset:new n.l(r[F.offset+0],r[F.offset+1]),radius:r[F.edgeRadius],material:i.TryGet(r[F.material+1]),useAdjacentStartPoint:!!r[F.useAdjacentStartPoint],useAdjacentEndPoint:!!r[F.useAdjacentEndPoint],adjacentStartPoint:new n.l(r[F.adjacentStartPoint],r[F.adjacentStartPoint+1]),adjacentEndPoint:new n.l(r[F.adjacentEndPoint],r[F.adjacentEndPoint+1])});return t.addUnityComponentFromDeserialization("collider2D",a),a}_loadPolygonCollider2DComponent(e,t,s,i){const r=s.data,a=new pc.PolygonCollider2DComponent({enabled:!!r[U.enabled],isTrigger:r[U.isTrigger],usedByEffector:r[U.usedByEffector],density:r[U.density],points:r[U.points],offset:new n.l(r[U.offset+0],r[U.offset+1]),material:i.TryGet(r[U.material+1])});return t.addUnityComponentFromDeserialization("collider2D",a),a}_loadSpringJoint2DComponent(e,t,s,i){const r=s.data;return this._loadJoint2DComponent(e,t,s,B,new pc.SpringJoint2DComponent({enabled:!!r[B.enabled],autoConfigureDistance:!!r[B.autoConfigureDistance],enableCollision:!!r[B.enableCollision],breakForce:r[B.breakForce],breakTorque:r[B.breakTorque],frequency:r[B.frequency],dampingRatio:r[B.dampingRatio],distance:r[B.distance],autoConfigureConnectedAnchor:!!r[B.autoConfigureConnectedAnchor],anchor:new n.l(r[B.anchor+0],r[B.anchor+1]),connectedAnchor:new n.l(r[B.connectedAnchor+0],r[B.connectedAnchor+1])}))}_loadDistanceJoint2DComponent(e,t,s,i){const r=s.data;return this._loadJoint2DComponent(e,t,s,N,new pc.DistanceJoint2DComponent({enabled:!!r[N.enabled],enableCollision:!!r[N.enableCollision],breakForce:r[N.breakForce],breakTorque:r[N.breakTorque],maxDistanceOnly:r[N.maxDistanceOnly],distance:r[N.distance],autoConfigureDistance:!!r[N.autoConfigureDistance],autoConfigureConnectedAnchor:!!r[N.autoConfigureConnectedAnchor],anchor:new n.l(r[N.anchor+0],r[N.anchor+1]),connectedAnchor:new n.l(r[N.connectedAnchor+0],r[N.connectedAnchor+1])}))}_loadFixedJoint2DComponent(e,t,s,i){const r=s.data;return this._loadJoint2DComponent(e,t,s,k,new pc.FixedJoint2DComponent({enabled:!!r[k.enabled],enableCollision:!!r[k.enableCollision],breakForce:r[k.breakForce],breakTorque:r[k.breakTorque],frequency:r[k.frequency],dampingRatio:r[k.dampingRatio],autoConfigureConnectedAnchor:!!r[k.autoConfigureConnectedAnchor],anchor:new n.l(r[k.anchor+0],r[k.anchor+1]),connectedAnchor:new n.l(r[k.connectedAnchor+0],r[k.connectedAnchor+1])}))}_loadHingeJoint2DComponent(e,t,s,i){const r=s.data,a=new UnityEngine.JointAngleLimits2D;e.deserializeTo(r[z.limits],a);const o=new UnityEngine.JointMotor2D;return e.deserializeTo(r[z.motor],o),this._loadJoint2DComponent(e,t,s,z,new pc.HingeJoint2DComponent({enabled:!!r[z.enabled],enableCollision:!!r[z.enableCollision],breakForce:r[z.breakForce],breakTorque:r[z.breakTorque],autoConfigureConnectedAnchor:!!r[z.autoConfigureConnectedAnchor],anchor:new n.l(r[z.anchor+0],r[z.anchor+1]),connectedAnchor:new n.l(r[z.connectedAnchor+0],r[z.connectedAnchor+1]),useLimits:!!r[z.useLimits],limits:a,useMotor:!!r[z.useMotor],motor:o}))}_loadWheelJoint2DComponent(e,t,s,i){const r=s.data,a=new UnityEngine.JointSuspension2D;e.deserializeTo(r[V.suspension],a);const o=new UnityEngine.JointMotor2D;return e.deserializeTo(r[V.motor],o),this._loadJoint2DComponent(e,t,s,V,new pc.WheelJoint2DComponent({enabled:!!r[V.enabled],enableCollision:!!r[V.enableCollision],breakForce:r[V.breakForce],breakTorque:r[V.breakTorque],autoConfigureConnectedAnchor:!!r[V.autoConfigureConnectedAnchor],anchor:new n.l(r[V.anchor+0],r[V.anchor+1]),connectedAnchor:new n.l(r[V.connectedAnchor+0],r[V.connectedAnchor+1]),suspension:a,useMotor:!!r[V.useMotor],motor:o}))}_loadFrictionJoint2DComponent(e,t,s,i){const r=s.data;return this._loadJoint2DComponent(e,t,s,G,new pc.FrictionJoint2DComponent({enabled:!!r[G.enabled],enableCollision:!!r[G.enableCollision],breakForce:r[G.breakForce],breakTorque:r[G.breakTorque],autoConfigureConnectedAnchor:!!r[G.autoConfigureConnectedAnchor],anchor:new n.l(r[G.anchor+0],r[G.anchor+1]),connectedAnchor:new n.l(r[G.connectedAnchor+0],r[G.connectedAnchor+1]),maxForce:r[G.maxForce],maxTorque:r[G.maxTorque]}))}_loadRelativeJoint2DComponent(e,t,s,i){const r=s.data;return this._loadJoint2DComponent(e,t,s,H,new pc.RelativeJoint2DComponent({enabled:!!r[H.enabled],enableCollision:r[H.enableCollision],breakForce:r[H.breakForce],breakTorque:r[H.breakTorque],autoConfigureOffset:r[H.autoConfigureOffset],linearOffset:new n.l(r[H.linearOffset+0],r[H.linearOffset+1]),angularOffset:r[H.angularOffset],maxForce:r[H.maxForce],maxTorque:r[H.maxTorque],correctionScale:r[H.correctionScale]}))}_loadSliderJoint2DComponent(e,t,s,i){const r=s.data,a=new UnityEngine.JointTranslationLimits2D;e.deserializeTo(r[j.limits],a);const o=new UnityEngine.JointMotor2D;return e.deserializeTo(r[j.motor],o),this._loadJoint2DComponent(e,t,s,j,new pc.SliderJoint2DComponent({enabled:!!r[j.enabled],enableCollision:!!r[j.enableCollision],breakForce:r[j.breakForce],breakTorque:r[j.breakTorque],autoConfigureConnectedAnchor:!!r[j.autoConfigureConnectedAnchor],anchor:new n.l(r[j.anchor+0],r[j.anchor+1]),connectedAnchor:new n.l(r[j.connectedAnchor+0],r[j.connectedAnchor+1]),autoConfigureAngle:!!r[j.autoConfigureAngle],angle:r[j.angle],useLimits:!!r[j.useLimits],limits:a,useMotor:!!r[j.useMotor],motor:o}))}_loadTargetJoint2DComponent(e,t,s,i){const r=s.data;return this._loadJoint2DComponent(e,t,s,W,new pc.TargetJoint2DComponent({enabled:!!r[W.enabled],enableCollision:r[W.enableCollision],breakForce:r[W.breakForce],breakTorque:r[W.breakTorque],autoConfigureTarget:r[W.autoConfigureTarget],target:new n.l(r[W.target+0],r[W.target+1]),anchor:new n.l(r[W.anchor+0],r[W.anchor+1]),maxForce:r[W.maxForce],dampingRatio:r[W.dampingRatio],frequency:r[W.frequency]}))}_loadPlatformEffector2DComponent(e,t,s,i){const n=s.data,r=new pc.PlatformEffector2DComponent({enabled:!!n[Q.enabled],useColliderMask:!!n[Q.useColliderMask],colliderMask:n[Q.colliderMask]});return t.addUnityComponentFromDeserialization("effector2D",r),r}_loadJoint2DComponent(e,t,s,i,n){const r=s.data,a=Deserializers.types[s.type],o=UnityEngine.Object.FromHandle(Bridge._getTypeByName(a),n);return e.r(r[i.connectedBody+0],r[i.connectedBody+1],0,o,"connectedBody"),t.addUnityComponentFromDeserialization("joint2D",n),n}_loadParticleSystemComponent(e,t,s,i){const n=new pc.ParticleSystem,r=new pc.ParticleSystemComponent({particleSystem:n});return e.deserializeTo(s.data,n,"Luna.Unity.DTO.UnityEngine.Components.ParticleSystem"),t.addUnityComponentFromDeserialization("particlesystem",r),r}_loadParticleSystemRendererComponent(e,t,s,i){return this._loadParticlesRendererComponent(A,new pc.ParticleSystemRendererComponent,e,t,s,i)}_loadJointComponent(e,t,s,i){const n=s.data,r=new pc.JointComponent({type:Deserializers.types[s.type]}),a=UnityEngine.Object.FromHandle(Bridge._getTypeByName(Deserializers.types[s.type]),r);return e.deserializeTo(n,a,Deserializers.types[s.type].replace("UnityEngine.","Luna.Unity.DTO.UnityEngine.Components.")),t.addUnityComponentFromDeserialization("joint",r),r}_loadMonoBehaviourComponent(e,t,s,n){const r=Deserializers.types[s.class],a=i.h.create(t,r,!!s.enabled);return a?(e.deserializeTo(s.data,a.code),t.addUnityComponentFromDeserialization("monoBehaviour",a),a):null}_loadRendererComponent(e,t,s,i,r,a){const o=r.data,h=t;i.addUnityComponentFromDeserialization("renderer",h);const l=o[e.sharedMaterials],c=[];for(let e=0;e<l.length;e+=2){let t=a.TryGet(l[e+1]);t||(t=UnityEngine.Graphics.InternalErrorShaderMaterial.handle),c.push(t)}return h.model.materials=c,h.model.sortingLayerIndex=UnityEngine.SortingLayer.GetLayerValueFromID(o[e.sortingLayerID]),h.model.sortingOrder=o[e.sortingOrder],h.model.cullingLayer=i.cullingLayer,h.enabled=!!o[e.enabled],h.castShadows=o[e.shadowCastingMode]>UnityEngine.Rendering.ShadowCastingMode.Off,h.receiveShadows=!!o[e.receiveShadows],h.id=r.id,h.model._lightmapSceneIndex=o[e.lightmapSceneIndex],h.model._lightmapIndex=o[e.lightmapIndex],h.model.lightmapScaleOffset=new n.n(o[e.lightmapScaleOffset+0],o[e.lightmapScaleOffset+1],o[e.lightmapScaleOffset+2],o[e.lightmapScaleOffset+3]),h}_loadParticlesRendererComponent(e,t,s,i,r,a){const o=r.data,h=t;i.addUnityComponentFromDeserialization("particleSystemRenderer",h);const l=o[e.sharedMaterials],c=[];for(let e=0;e<l.length;e+=2){if(2===e)continue;let t=a.TryGet(l[e+1]);t||(t=UnityEngine.Graphics.InternalErrorShaderMaterial.handle),c.push(t)}return h.model.materials=c,h.model.sortingLayerIndex=UnityEngine.SortingLayer.GetLayerValueFromID(o[e.sortingLayerID]),h.model.sortingOrder=o[e.sortingOrder],h.model.cullingLayer=i.cullingLayer,h.enabled=!!o[e.enabled],h.castShadows=o[e.shadowCastingMode]>UnityEngine.Rendering.ShadowCastingMode.Off,h.receiveShadows=!!o[e.receiveShadows],h.id=r.id,h.model._lightmapSceneIndex=o[e.lightmapSceneIndex],h.model._lightmapIndex=o[e.lightmapIndex],h.model.lightmapScaleOffset=new n.n(o[e.lightmapScaleOffset+0],o[e.lightmapScaleOffset+1],o[e.lightmapScaleOffset+2],o[e.lightmapScaleOffset+3]),h.mesh=a.TryGet(o[A.mesh+1]),h.meshCount=o[A.meshCount],h.activeVertexStreamsCount=o[A.activeVertexStreamsCount],h.alignment=o[A.alignment],h.renderMode=o[A.renderMode],h.sortMode=o[A.sortMode],h.lengthScale=o[A.lengthScale],h.velocityScale=o[A.velocityScale],h.cameraVelocityScale=o[A.cameraVelocityScale],h.normalDirection=o[A.normalDirection],h.sortingFudge=o[A.sortingFudge],h.minParticleSize=o[A.minParticleSize],h.maxParticleSize=o[A.maxParticleSize],h.pivot.x=o[A.pivot],h.pivot.y=o[A.pivot+1],h.pivot.z=o[A.pivot+2],h}_loadLineRendererComponent(e,t,s,i){const n=this._loadRendererComponent(Y,new r.d,e,t,s,i),a=n.code;return e.deserializeTo(s.data,a,"Luna.Unity.DTO.UnityEngine.Components.LineRenderer"),n}_loadCanvasRendererComponent(e,t,s,i){const n=new r.a;return e.deserializeTo(s.data,n.code,"Luna.Unity.DTO.UnityEngine.Components.CanvasRenderer"),t.addUnityComponentFromDeserialization("canvasRenderer",n),n}_loadTrailRendererComponent(e,t,s,i){const n=this._loadRendererComponent(K,new r.w,e,t,s,i),a=n.code;return e.deserializeTo(s.data,a,"Luna.Unity.DTO.UnityEngine.Components.TrailRenderer"),n}_loadReflectionProbeComponent(e,t,s,i){const n=s.data,a=new r.l,o=UnityEngine.Object.FromHandle(UnityEngine.ReflectionProbe,a);return e.deserializeTo(n,o,"Luna.Unity.DTO.UnityEngine.Components.ReflectionProbe"),t.addUnityComponentFromDeserialization("reflectionprobe",a),a}_loadSortingGroupComponent(e,t,s){const i=t.data,n=!!i[X.enabled],a=UnityEngine.SortingLayer.GetLayerValueFromID(i[X.sortingLayerIndex]),o=i[X.sortingOrder],h=i[X.sortingLayerName],l=new r.q(n,a,o,h);return e.addUnityComponentFromDeserialization("sortingGroup",l),l.configureForEntity(e),l}_loadSkyboxComponent(e,t,s){const i=new r.o,n=UnityEngine.Object.FromHandle(UnityEngine.Skybox,i);return e.deserializeTo(s.data,n,"Luna.Unity.DTO.UnityEngine.Components.Skybox"),t.addUnityComponentFromDeserialization("skybox",i),i.configureForEntity(t),i}}class $ extends a{loadAsync(e,t,s){const i=e.d("Luna.Unity.DTO.UnityEngine.Audio.AudioMixer",t.data),n=new UnityEditor.Audio.AudioMixerController(i);this.registry.Put(t.id,n);for(let e=0;e<n.groups.length;e++)this.registry.Put(n.groups[e].id,n.groups[e]);return n}unloadAsync(e){this.registry.Release(e.id)}}class J extends a{loadAsync(e,t,s){const i=e.d("Luna.Unity.DTO.UnityEngine.Audio.AudioMixerSnapshot",t.data),n=new UnityEngine.Audio.AudioMixerSnapshot(i);return this.registry.Put(t.id,n),n}unloadAsync(e){this.registry.Release(e.id)}}var Z=s(13);const ee=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Assets.ProjectSettings"],te=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Assets.ProjectSettings+ScriptsExecutionOrder"],se=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Assets.ProjectSettings+SortingLayer"],ie=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Assets.ProjectSettings+CullingLayer"],ne=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Assets.ProjectSettings+TimeSettings"],re=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Assets.ProjectSettings+PhysicsSettings"],ae=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Assets.ProjectSettings+PhysicsSettings+CollisionMask"],oe=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Assets.ProjectSettings+Physics2DSettings"];class he extends a{loadAsync(e,t,s){const i=t.data,n=Z.c.instance;return n.enableRealtimeShadows=!!i[ee.enableRealtimeShadows],n.enableAutoInstancing=!!i[ee.enableAutoInstancing],n.enableDynamicBatching=!!i[ee.enableDynamicBatching],n.allTagsInProject=i[ee.allTags],this.loadScriptsExecutionOrderSettings(i,n),this.loadSortingLayerSettings(i,n),this.loadCullingLayerSettings(i,n),this.loadTimeSettings(i,n),this.loadPhysicsSettings(i,n),this.loadPhysics2DSettings(i,n,e),this.loadQualitySettings(i,n,e),this.loadLightmapSettings(i,n),null}unloadAsync(e){this.registry.Release(e.id)}loadScriptsExecutionOrderSettings(e,t){const s=e[ee.scriptsExecutionOrder],i=[];for(let e=0;e<s.length;e++){const t=s[e],n=new Z.d;n.name=t[te.name],n.value=t[te.value],i.push(n)}t.scriptsExecutionOrder=i}loadSortingLayerSettings(e,t){const s=e[ee.sortingLayers],i=[];for(let e=0;e<s.length;e++){const t=s[e],n=new Z.e;n.id=t[se.id],n.name=t[se.name],n.value=t[se.value],i.push(n)}t.sortingLayers=i;for(let e=0;e<i.length;e++){const t=i[e],s=new UnityEngine.SortingLayer;s.id=t.id,s.name=t.name,s.value=t.value,UnityEngine.SortingLayer.layers.push(s)}}loadCullingLayerSettings(e,t){const s=e[ee.cullingLayers],i=[];for(let e=0;e<s.length;e++){const t=s[e],n=new Z.a;n.id=t[ie.id],n.name=t[ie.name],i.push(n)}t.cullingLayers=i;for(let e=0;e<i.length;e++){const t=i[e],s=new UnityEngine.LayerMask.CullingLayer;s.id=t.id,s.name=t.name,UnityEngine.LayerMask.layers.push(s)}}loadTimeSettings(e,t){const s=e[ee.timeSettings];t.timeSettings.fixedDeltaTime=s[ne.fixedDeltaTime],t.timeSettings.miximumDeltaTime=s[ne.maximumDeltaTime],t.timeSettings.timeScale=s[ne.timeScale],t.timeSettings.maximumParticleTimestep=s[ne.maximumParticleTimestep]}loadPhysicsSettings(e,t){const s=e[ee.physicsSettings];t.physicsSettings.gravity=new n.m(s[re.gravity+0],s[re.gravity+1],s[re.gravity+2]),t.physicsSettings.defaultSolverIterations=s[re.defaultSolverIterations],t.physicsSettings.bounceThreshold=s[re.bounceThreshold],t.physicsSettings.autoSyncTransforms=!!s[re.autoSyncTransforms],t.physicsSettings.autoSimulation=!!s[re.autoSimulation];const i=s[re.collisionMatrix],r=[];for(let e=0;e<i.length;e++){const t=i[e],s=new Z.b;s.enabled=!!t[ae.enabled],s.layerId=t[ae.layerId],s.otherLayerId=t[ae.otherLayerId],r.push(s)}t.physicsSettings.collisionMatrix=r}loadPhysics2DSettings(e,t,s){const i=e[ee.physics2DSettings];t.physics2DSettings.gravity=new n.l(i[oe.gravity+0],i[oe.gravity+1]),t.physics2DSettings.autoSyncTransforms=!!i[oe.autoSyncTransforms],t.physics2DSettings.positionIterations=i[oe.positionIterations],t.physics2DSettings.velocityIterations=i[oe.velocityIterations],t.physics2DSettings.angularSleepTolerance=i[oe.angularSleepTolerance],t.physics2DSettings.autoSimulation=!!i[oe.autoSimulation],t.physics2DSettings.baumgarteScale=i[oe.baumgarteScale],t.physics2DSettings.baumgarteTOIScale=i[oe.baumgarteTOIScale],t.physics2DSettings.callbacksOnDisable=!!i[oe.callbacksOnDisable],t.physics2DSettings.defaultContactOffset=i[oe.defaultContactOffset],t.physics2DSettings.linearSleepTolerance=i[oe.linearSleepTolerance],t.physics2DSettings.maxAngularCorrection=i[oe.maxAngularCorrection],t.physics2DSettings.maxLinearCorrection=i[oe.maxLinearCorrection],t.physics2DSettings.maxRotationSpeed=i[oe.maxRotationSpeed],t.physics2DSettings.maxTranslationSpeed=i[oe.maxTranslationSpeed],t.physics2DSettings.timeToSleep=i[oe.timeToSleep],t.physics2DSettings.velocityThreshold=i[oe.velocityThreshold],t.physics2DSettings.queriesHitTriggers=!!i[oe.queriesHitTriggers],t.physics2DSettings.queriesStartInColliders=!!i[oe.queriesStartInColliders],s.r(!0,i[oe.material+1],0,t.physics2DSettings,"material");const r=i[oe.collisionMatrix],a=[];for(let e=0;e<r.length;e++){const t=r[e],s=new Z.b;s.enabled=!!t[ae.enabled],s.layerId=t[ae.layerId],s.otherLayerId=t[ae.otherLayerId],a.push(s)}t.physics2DSettings.collisionMatrix=a}loadQualitySettings(e,t,s){const i=e[ee.qualitySettings];s.deserializeTo(i,t.qualitySettings,"Luna.Unity.DTO.UnityEngine.Assets.QualitySettings")}loadLightmapSettings(e,t){t.lightmapEncodingQuality=e[ee.lightmapEncodingQuality],t.desiredColorSpace=e[ee.desiredColorSpace]}}const le=/\+/g;class ce{constructor(){this.referenceQueue=[],this.pendingQueue=[],this.onAfterDeserialize=[],this.root=null,this.goHandler=new q(window.$application)}r(e,t,s,i,n=null){const r={type:null==e?null:"boolean"==typeof e?e:Deserializers.types[e],id:t,targetType:s,targetObject:i,targetProperty:n};this.referenceQueue.push(r)}resolveReferences(e){for(let t=0;t<this.referenceQueue.length;t++)this.resolveInstruction(e,this.referenceQueue[t]);this.referenceQueue=this.pendingQueue,this.pendingQueue=[],this._fireSerializationCallbacks()}resolveInstruction(e,t){if(null===t.type||null===t.id)return void this.applyObject(t,null);const s=e.TryGet(t.id);if(!s)return void this.pendingQueue.push(t);const i=!0===t.type?null:this._getTypeByName(t.type);let n=s;!i||n.$kind||n.isPrefabProxy||(n=UnityEngine.Object.FromHandle(i,s)),n.isPrefabProxy&&(n=this.createPrefabProxy(n,e,t,i),this.connectProxy(n)),this.applyObject(t,n)}createPrefabProxy(e,t,s,i){return new Proxy(e,{get:(e,n)=>{if(e[n])return e[n];if("__proxyInstance"===n)return e;if("__setupPrefab"===n)return()=>this.setupPrefab(e,t,s,i);const r=(e=this.loadProxyPrefab(e,s))[n];return r instanceof Function?r.bind(e):r},set:(e,t,i)=>{if("__sameConnectedProxies"===t){const t=ce.connectedPrefabProxies[e.prefabId||e.$id];for(let s=0;s<t.length;s++)t[s].__proxyInstance.$id===e.$id&&(t[s].__value=i);return!0}return"__value"===t?(this.applyObject(s,i),!0):e[t]?(e[t]=i,!0):((e=this.loadProxyPrefab(e,s))[t]=i,!0)}})}loadProxyPrefab(e,t){let s=null;const i=e.prefabId||e.$id,n=ce.connectedPrefabProxies[i];if(!n)return t.targetObject[t.targetProperty];for(let t=0;t<n.length;t++)if(n[t].__proxyInstance===e){if(s){n[t].__value=s;continue}s=n[t].__setupPrefab()}else n[t].__setupPrefab();return delete ce.connectedPrefabProxies[i],s}connectProxy(e){const t=e.__proxyInstance.prefabId||e.__proxyInstance.$id;ce.connectedPrefabProxies[t]||(ce.connectedPrefabProxies[t]=[]),ce.connectedPrefabProxies[t].push(e)}setupPrefab(e,t,s,i){if(e.componentId){const n=t.Get(e.prefabId).prefab;n&&this.goHandler._loadObject(this,null,n,t,!0);const r=t.Get(e.componentId),a=UnityEngine.Object.FromHandle(i,r);return this.applyObject(s,a),a.isPrefab=!0,a}{const n=e.prefab,r=this.goHandler._loadObject(this,null,n,t),a=UnityEngine.Object.FromHandle(i,r);return this.applyObject(s,a),a.handle.isPrefab=!0,a.handle.objectJson=n,a}}applyObject(e,t){0===e.targetType?e.targetObject[e.targetProperty]=t:1===e.targetType?(e.targetProperty=e.targetObject.Count,e.targetObject.add(t),e.targetObject=e.targetObject._items):(e.targetProperty=e.targetObject.length,e.targetObject.push(t)),e.targetType=0}d(e,t,s=null){if(!t)return null;const i=Deserializers[e](this,t,s);return this._tryRegisterAsSerializationCallbackReceiver(i),i}deserializeTo(e,t,s=null){const i=Deserializers[s||t.$$fullname](this,e,t);return this._tryRegisterAsSerializationCallbackReceiver(i),i}c(e){const t=this._getTypeByName(e);if(!t||!t.$$fullname)return{};if(t.ctor&&0===t.ctor.length)return new t.ctor;{const e=Object.create(t.prototype);return e.$initialize&&e.$initialize(),e}}_getTypeByName(e){const t=ce.typeCache;if(!t.hasOwnProperty(e)){let s=Bridge.ns(e.replace(le,"."));s.$$fullname||(DEBUG&&UnityEngine.Debug.LogWarning$1("Unknown class found: "+e),s=pc.stubProxy.generateConstructorFor(e)),t[e]=s}return t[e]}_tryRegisterAsSerializationCallbackReceiver(e){void 0!==e.UnityEngine$ISerializationCallbackReceiver$OnAfterDeserialize&&this.onAfterDeserialize.push(e)}_fireSerializationCallbacks(){this.onAfterDeserialize.reverse();for(let e=0;e<this.onAfterDeserialize.length;e++)this.onAfterDeserialize[e].UnityEngine$ISerializationCallbackReceiver$OnAfterDeserialize();this.onAfterDeserialize=[]}}ce.typeCache={};class de extends ce{constructor(e){super(),this.registry=e}r(e,t,s,i,n=null){if(null===e||null===t)return;const r={type:"boolean"==typeof e?e:Deserializers.types[e],id:t,targetType:s,targetObject:i,targetProperty:n};this.resolveInstruction(this.registry,r)}}ce.connectedPrefabProxies={};const ue=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Assets.Material"];class _e extends a{constructor(e){super(e),this.request=new de(null)}loadAsync(e,t,s){this.request.registry=this.registry;const i=this.request.d("Luna.Unity.DTO.UnityEngine.Assets.Material",t.data);return i.shader=this.registry.TryGet(t.data[ue.shader+1]),i.setup(),"Default UI Material"===i.name&&(UnityEngine.Canvas.DefaultCanvasMaterial=UnityEngine.Object.FromHandle(UnityEngine.Material,i)),"Sprites-Default"===i.name&&(UnityEngine.Material.SpritesDefault=UnityEngine.Object.FromHandle(UnityEngine.Material,i)),"Sprites-Mask"===i.name&&(UnityEngine.Material.SpriteMasksDefault=UnityEngine.Object.FromHandle(UnityEngine.Material,i)),"Font Material"===i.name&&(UnityEngine.Material.FontDefault=UnityEngine.Object.FromHandle(UnityEngine.Material,i)),"Default-Material"!==i.name&&"Lit"!==i.name||(UnityEngine.Material.MeshDefault=UnityEngine.Object.FromHandle(UnityEngine.Material,i)),this.registry.Put(t.id,i),i}unloadAsync(e){this.registry.Release(e.id)}}class me extends a{loadAsync(e,t,s){const i=e.d("Luna.Unity.DTO.UnityEngine.Assets.PhysicMaterial",t.data),n=new Goblin.PhysicMaterial(i);return this.registry.Put(t.id,n),n}unloadAsync(e){this.registry.Release(e.id)}}class pe extends a{loadAsync(e,t,s){const i=e.d("Luna.Unity.DTO.UnityEngine.Assets.PhysicsMaterial2D",t.data);return this.registry.Put(t.id,i),i}unloadAsync(e){this.registry.Release(e.id)}}const ge=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Assets.Mesh"],fe=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Assets.Mesh+SubMesh"],ye=new Blob;class Ee extends a{loadAsync(e,t,s){const i=t.data,a=new r.g(!0),o=s.find((e=>e.manifest.id===t.assetBundleId)).blob||ye;a.name=i[ge.name];const l=i[ge.vertices];let c=o.slice(l[0],l[0]+l[1]);const d=i[ge.halfPrecision]?(0,h.d)(new Uint16Array(c)):new Float32Array(c),u=a.defaultVertexBuffer(i[ge.streams],i[ge.vertexCount],d.buffer);i[ge.vertices]=null,a.vertexBuffer=u,a.subMeshes=[];const _=i[ge.subMeshes],m=i[ge.aabb];for(let e=0;e<_.length;e++){const s=_[e][fe.triangles],i=new Uint16Array(o.slice(s[0],s[0]+s[1])),l=new r.g;l.aabb=new n.b(new n.m(m[0],m[1],m[2]),new n.m(m[3],m[4],m[5])),l.$id=t.id;const c=a.defaultIndexBuffer(i.length,i.buffer);l.vertexBuffer=u,l.indexBuffer[0]=c,l.primitive[0].type=h.c.PRIMITIVE_TRIANGLES,l.primitive[0].base=0,l.primitive[0].count=i.length,l.primitive[0].indexed=!0,a.subMeshes.push(l)}a.indexBuffer=a.subMeshes[0].indexBuffer,a.primitive[0].type=h.c.PRIMITIVE_TRIANGLES,a.primitive[0].base=0,a.primitive[0].count=_[0].length,a.primitive[0].indexed=!0,a.aabb=new n.b(new n.m(m[0],m[1],m[2]),new n.m(m[3],m[4],m[5]));const p=i[ge.bindposes];for(let e=0;e<p.length;e+=16)a.bindposes.push((new n.i).setData(p[e+0],p[e+1],p[e+2],p[e+3],p[e+4],p[e+5],p[e+6],p[e+7],p[e+8],p[e+9],p[e+10],p[e+11],p[e+12],p[e+13],p[e+14],p[e+15]));const g=i[ge.blendShapes];if(0!==g.length){a.morph=new r.k([]);for(let e=0;e<g.length;e++){const t=g[e],s=t[1],n={};n.name=t[0],n.frames=[];for(let e=0;e<s.length;e++){const s={};s.weight=t[1][e][0],c=o.slice(t[1][e][1][0],t[1][e][1][0]+t[1][e][1][1]),s.deltaPositions=i[ge.halfPrecision]?(0,h.d)(new Uint16Array(c)):t[1][e][1],c=o.slice(t[1][e][2][0],t[1][e][2][0]+t[1][e][2][1]),s.deltaNormals=i[ge.halfPrecision]?(0,h.d)(new Uint16Array(c)):t[1][e][2],c=o.slice(t[1][e][3][0],t[1][e][3][0]+t[1][e][3][1]),s.deltaTangents=i[ge.halfPrecision]?(0,h.d)(new Uint16Array(c)):t[1][e][3];const a=new r.i(s);n.frames[e]=a}const l=new r.j(n);a.morph.addTarget(l),a.morph._setBaseMesh(a)}}return this.registry.Put(t.id,a),a}unloadAsync(e){const t=this.registry.Release(e.id);t&&t.destroy()}}const Te=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Scene.Scene"],Se=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Assets.RenderSettings"],Ae=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Assets.RenderSettings+LightProbes"];class be extends a{loadAsync(e,t,s){const i=t.data,n=(new at).initializeAsTemplate({renderSettings:e.d("Luna.Unity.DTO.UnityEngine.Assets.RenderSettings",t.render_settings.data),rootJsons:t.objects,name:i[Te.name],index:i[Te.index]}),r=s.find((e=>e.manifest.id===t.assetBundleId)).blob,a=t.render_settings.data[Se.lightProbes];return this.parseLightProbeData(r,a,n.renderSettings.lightProbes),UnityEngine.SceneManagement.SceneManager.scenes.push(n),n}parseLightProbeData(e,t,s){const i=[],a=this.getTypedArrayFromBlobAndMarker(Float32Array,e,t[Ae.bakedProbes]);for(let e=0;e<a.length;e+=27)i.push(r.r.fromArray(a.subarray(e,e+27)));s.bakedProbes=i;const o=[],h=this.getTypedArrayFromBlobAndMarker(Float32Array,e,t[Ae.positions]);for(let e=0;e<h.length;e+=3)o.push(new n.m(h[e+0],h[e+1],h[e+2]));s.positions=o;const l=[],c=this.getTypedArrayFromBlobAndMarker(Float32Array,e,t[Ae.hullRays]);for(let e=0;e<c.length;e+=3)l.push(new n.m(c[e+0],c[e+1],c[e+2]));s.hullRays=l;const d=[],u=this.getTypedArrayFromBlobAndMarker(Float32Array,e,t[Ae.matrices]);for(let e=0;e<u.length;e+=16)d.push(n.i.fromArray(u.subarray(e,e+16)));s.matrices=d,s.tetrahedra=this.getTypedArrayFromBlobAndMarker(Int16Array,e,t[Ae.tetrahedra]),s.neighbours=this.getTypedArrayFromBlobAndMarker(Int16Array,e,t[Ae.neighbours])}getTypedArrayFromBlobAndMarker(e,t,s){return new e(t?t.slice(s[0],s[0]+s[1]):0)}unloadAsync(e){this.registry.Release(e.id)}}class Ce extends a{constructor(e){super(e),this.shaders=[]}loadAsync(e,t,s){const i=new r.x(this.graphicsDevice);return e.d("Luna.Unity.DTO.UnityEngine.Assets.Shader",t.data,i),i.setup(),this.registry.Put(t.id,i),this.shaders.push(i),UnityEngine.Shader.shaderIndex[i.name]=i,i}unloadAsync(e){this.registry.Release(e.id)}onAfterDeserialize(){for(let e=0;e<this.shaders.length;e++)this.shaders[e].onAfterDeserialize()}}const we=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Assets.VideoClip"];class xe extends a{constructor(e){super(e),this.playgroundAssetOverrides=window.playgroundAssetOverrides||{}}loadAsync(e,t,s){const i=t.data,n={name:i[we.name],width:i[we.width],height:i[we.height],frameRate:i[we.frameRate],frameCount:i[we.frameCount]},a=new r.B(this.app.graphicsDevice,n);return this.registry.Put(t.id,a),new Promise(((e,s)=>{try{this.network.GetVideoAsync(this._getVideoUrl(t)).continueWith((t=>{if(t.status===System.Threading.Tasks.TaskStatus.ranToCompletion){const s=t.result;a.setSource(s),e(a)}else{(t.exception&&t.exception.innerException?t.exception.innerException.message:null)===LunaUnity.Utils.Network.ERR_ABORTED||s(t.error||t.exception)}}))}catch(e){s(e)}}))}_getVideoUrl(e){return"external"===this.network.resourceConfig.video&&e.id in this.playgroundAssetOverrides?this.playgroundAssetOverrides[e.id]:"assets/bundles/"+e.assetBundleId+"/"+e.id+(e.ext||".mp4")}unloadAsync(e){const t=this.registry.Release(e.id);t&&t.destroy()}}const Re=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Assets.AudioClip"];class Ie extends a{constructor(e){super(e),this.playgroundAssetOverrides=window.playgroundAssetOverrides||{}}loadAsync(e,t,s){const i=new l.b(null);i.name=t.data[Re.name];const n=this._getSoundUrl(t);return new Promise(((e,s)=>{try{const s=function(t){i.buffer=t,e(i)},r=function(t){const s=t.innerException?t.innerException.message:t.message||t;s!==LunaUnity.Utils.Network.ERR_ABORTED&&console.error(s||"Error loading audio url: "+n),i.buffer=null,e(i)},a=this.app._audioManager;this.registry.Put(t.id,i),this.network.GetSoundAsync(this._getSoundUrl(t)).continueWith((e=>{e.status===System.Threading.Tasks.TaskStatus.ranToCompletion?a.context.decodeAudioData(e.result,s,r):r(e.error||e.exception)}))}catch(e){s(e)}}))}_getSoundUrl(e){return"external"===this.network.resourceConfig.sound&&e.id in this.playgroundAssetOverrides?this.playgroundAssetOverrides[e.id]:"assets/bundles/"+e.assetBundleId+"/"+e.id+(e.ext||".mp3")}unloadAsync(e){const t=this.registry.Release(e.id);t&&(t.buffer=null)}}const Me=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Textures.Sprite"];class Pe extends a{loadAsync(e,t,s){const i=t.data,a=this.registry.Get(i[Me.texture+1]),o=new r.u({}),h=i[Me.textureWidth]/a.width;return o.attributes.transparency=new n.n((i[Me.packedRect+0]-i[Me.textureRect+0])*a.width,(i[Me.packedRect+1]-i[Me.textureRect+1])*a.height,(i[Me.textureRect+2]-i[Me.packedRect+2])*a.width,(i[Me.textureRect+3]-i[Me.packedRect+3])*a.height),o.attributes.textureRectBeforeResize=new n.n(0,0,i[Me.nativeSize],i[Me.nativeSize+1]),o.attributes.textureRect=new n.n(i[Me.packedRect+0]*a.width,i[Me.packedRect+1]*a.height,i[Me.packedRect+2]*a.width,i[Me.packedRect+3]*a.height),o.attributes.graphicsDevice=this.graphicsDevice,o.attributes.texture=a,o.attributes.border=new n.n(Math.max(0,i[Me.border+0]*a.width-o.attributes.transparency.x),Math.max(0,i[Me.border+1]*a.height-o.attributes.transparency.y),Math.max(0,i[Me.border+2]*a.width-o.attributes.transparency.z),Math.max(0,i[Me.border+3]*a.height-o.attributes.transparency.w)),o.attributes.name=i[Me.name],o.attributes.bounds=i[Me.bounds],o.attributes.pixelsPerUnit=i[Me.pixelsPerUnit]/h,o.attributes.aabb=i[Me.aabb],o.attributes.vertices=i[Me.vertices],o.attributes.triangles=i[Me.triangles],o.attributes.nativeSize=new n.l(i[Me.nativeSize],i[Me.nativeSize+1]),o.attributes.pivot=new n.l(i[Me.pivot+0],i[Me.pivot+1]),o.attributes.textureRectOffset=new n.l(i[Me.textureRectOffset+0],i[Me.textureRectOffset+1]),this.registry.Put(t.id,o),o}unloadAsync(e){const t=this.registry.Release(e.id);t&&t.mesh&&t.mesh.destroy()}}const ve=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Textures.Texture2D"],De=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Textures.RenderTexture"],Oe=[h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_A8,h.c.PIXELFORMAT_R4_G4_B4_A4,h.c.PIXELFORMAT_R8_G8_B8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R5_G6_B5,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_RGBA32F,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_PVRTC_2BPP_RGBA_1,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8,h.c.PIXELFORMAT_R8_G8_B8_A8];class Le extends a{constructor(e){super(e),this.playgroundAssetOverrides=window.playgroundAssetOverrides||{},this._dummyTexture=null}loadAsync(e,t,s){if(0===t.type)return this._loadTexture2dAsync(t);if(1===t.type)return this._loadTexture3dAsync(t);if(2===t.type)return Promise.resolve(null);if(3===t.type)return this._loadRenderTextureAsync(t);throw new Error('Unknown texture type: "'+t.type+'"')}_loadRenderTextureAsync(e){const t=new UnityEngine.RenderTexture.Create(e.data[De.width],e.data[De.height],16,0);return this.registry.Put(e.id,t.handle),Promise.resolve(t.handle)}_loadTexture3dAsync(e){throw new Error("Not Implemented")}_getDummyTexture(){if(this._dummyTexture)return this._dummyTexture;this._dummyTexture=new r.v(this.app.graphicsDevice,{name:"DummyTexture",width:16,height:16,format:h.c.PIXELFORMAT_R8_G8_B8_A8});const e=this._dummyTexture.lock();for(let t=0;t<e.length;t+=3)e[t+0]=255,e[t+1]=0,e[t+2]=255,e[t+4]=127;return this._dummyTexture.unlock(),this._dummyTexture}_loadTexture2dAsync(e){const t=e.data,s=t[ve.filterMode],i=t[ve.mipmapCount]>1;let n=i?h.c.FILTER_NEAREST_MIPMAP_NEAREST:h.c.FILTER_NEAREST,a=h.c.FILTER_NEAREST;s===UnityEngine.FilterMode.Bilinear?(n=i?h.c.FILTER_LINEAR_MIPMAP_NEAREST:h.c.FILTER_LINEAR,a=h.c.FILTER_LINEAR):s===UnityEngine.FilterMode.Trilinear&&(n=i?h.c.FILTER_LINEAR_MIPMAP_LINEAR:h.c.FILTER_LINEAR,a=h.c.FILTER_LINEAR);const o=t[ve.wrapMode]===UnityEngine.TextureWrapMode.Repeat?h.c.ADDRESS_REPEAT:h.c.ADDRESS_CLAMP_TO_EDGE,l={name:t[ve.name]||"",width:t[ve.width],height:t[ve.height],addressU:o,addressV:o,mipmaps:i,minFilter:n,magFilter:a,autoMipmap:i,rgbm:!!t[ve.hdr],anisotropy:Math.min(this.graphicsDevice.maxAnisotropy,t[ve.anisoLevel]),format:Oe[t[ve.format]]};if(e.dummy){const t=this._getDummyTexture();return this.registry.Put(e.id,t),Promise.resolve(t)}const c=new r.v(this.app.graphicsDevice,l);return this.registry.Put(e.id,c),new Promise(((t,s)=>{this.network.GetImageAsync(this._getTextureUrl(e)).continueWith((e=>{try{if(e.status===System.Threading.Tasks.TaskStatus.ranToCompletion){const s=e.result;c.setSource(s),s.remove(),c.mipmaps=l.mipmaps,c.minFilter=l.minFilter,c.magFilter=l.magFilter,c.anisotropy=l.anisotropy,t(c)}else{(e.exception&&e.exception.innerException?e.exception.innerException.message:null)===LunaUnity.Utils.Network.ERR_ABORTED||s(e.error||e.exception)}}catch(e){s(e)}}))}))}_getTextureUrl(e){return"external"===this.network.resourceConfig.image&&e.id in this.playgroundAssetOverrides?this.playgroundAssetOverrides[e.id]:"assets/bundles/"+e.assetBundleId+"/"+e.id+(e.ext||".png")}unloadAsync(e){const t=this.registry.Release(e.id);t&&t.destroy()}}const Fe=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Textures.Cubemap"];class Ue extends a{loadAsync(e,t,s){return 2===t.type?this._loadCubemapAsync(t):null}_loadCubemapAsync(e){const t=e.data,s=t[Fe.size],i=t[Fe.filterMode],n=t[Fe.mipmapCount]>0,a=t[Fe.name];let o=n?h.c.FILTER_NEAREST_MIPMAP_NEAREST:h.c.FILTER_NEAREST,l=h.c.FILTER_NEAREST;i===UnityEngine.FilterMode.Bilinear?(o=n?h.c.FILTER_LINEAR_MIPMAP_NEAREST:h.c.FILTER_LINEAR,l=h.c.FILTER_LINEAR):i===UnityEngine.FilterMode.Trilinear&&(o=n?h.c.FILTER_LINEAR_MIPMAP_LINEAR:h.c.FILTER_LINEAR,l=h.c.FILTER_LINEAR);const c=t[Fe.wrapMode]===UnityEngine.TextureWrapMode.Repeat?h.c.ADDRESS_REPEAT:h.c.ADDRESS_CLAMP_TO_EDGE,d=new r.v(this.graphicsDevice,{name:a,width:s,height:s,minFilter:o,magFilter:l,addressU:c,addressV:c,anisotropy:Math.min(this.graphicsDevice.maxAnisotropy,t[Fe.anisoLevel]),cubemap:!0,mipmaps:n,rgbm:!!t[Fe.hdr],flipY:!0,atlas:this.registry.Get(t[Fe.atlasId]),rects:t[Fe.rects]});return d.upload(),this.registry.Put(e.id,d),d}unloadAsync(e){const t=this.registry.Release(e.id);t&&t.destroy()}}let Be=null;pc.waitForMecanim.then((e=>{Be=e}));const Ne=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Animation.Data.AnimationClip"],ke=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Animation.Data.AnimationCurve"],ze=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Animation.Data.AnimationEvent"];class Ve extends a{loadAsync(e,t,s){const i=t.data,r=new UnityEngine.AnimationClip,a=s.find((e=>e.manifest.id===t.assetBundleId)).blob;r.name=i[Ne.name],r.frameRate=i[Ne.frameRate],r.length=i[Ne.length],r.wrapMode=i[Ne.wrapMode],r.isLooping=!!i[Ne.isLooping];const o=!!i[Ne.hasMuscleCurves];Be&&o&&this.setupNativeAssets(r,a,t);const l=i[Ne.localBounds];r.localBounds=new n.b(new n.m(l[0],l[1],l[2]),new n.m(l[3]/2,l[4]/2,l[5]/2));const c=i[Ne.curves];r.curves=new Array(c.length);for(let t=0;t<c.length;t++){const s=c[t],o=s[ke.keys],l=a.slice(o[0],o[0]+o[1]),d=i[Ne.halfPrecision]?(0,h.d)(new Uint16Array(l)):new Float32Array(l),u=s[ke.objectReferenceKeys]||[],_=new Array(Math.floor(d.length/7)+u.length);for(let e=0;e<d.length;e+=7)_[e/7]=new n.g(d[e],d[e+1],d[e+2],d[e+3],d[e+4],d[e+5],d[e+6]);for(let t=0;t<u.length;t++){const s=u[t];_[t+d.length/7]=e.deserializeTo(s,new n.g,"Luna.Unity.DTO.UnityEngine.Animation.Data.AnimationCurve+ObjectReferenceKey")}const m={path:s[ke.path],componentType:s[ke.componentType],property:s[ke.property],keyframes:_};r.curves[t]=new n.a(m),u.length>0&&(r.curves[t].objectCurve=!0)}const d=i[Ne.events];r.events=new Array(d.length);for(let t=0;t<d.length;t++){const s=d[t],i=new UnityEngine.AnimationEvent;i.functionName=s[ze.functionName],i.floatParameter=s[ze.floatParameter],i.intParameter=s[ze.intParameter],i.stringParameter=s[ze.stringParameter],i.time=s[ze.time],e.r(s[ze.objectReferenceParameter],s[ze.objectReferenceParameter+1],0,i,"objectReferenceParameter"),r.events[t]=i}return this.registry.Put(t.id,r),r}setupNativeAssets(e,t,s){const i=s.data,n=e.native=new Be.AnimationClip(e.name,s.id);let r=null;r=i[Ne.clipMuscleConstant],r&&this.setupNativeAsset(n,t,r,n.setClipMuscleConstant);const a=i[Ne.clipBindingConstant];r=a[0],r&&this.setupNativeAsset(n,t,r,n.setClipGenericBindings),r=a[1],r&&this.setupNativeAsset(n,t,r,n.setClipPPtrCurveMapping)}setupNativeAsset(e,t,s,i){const n=new Uint8Array(t.slice(s[0],s[0]+s[1])),r=Be._malloc(n.byteLength);Be.HEAPU8.set(n,r),i.call(e,r,n.byteLength)}unloadAsync(e){this.registry.Release(e.id)}}const Ge=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Animations.BlendTree"],He=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Animations.ChildMotion"];class je extends a{loadAsync(e,t,s){const i=t.data,r=new UnityEditor.Animations.BlendTree;r.name=i[Ge.name],r.blendParameter=i[Ge.blendParameter],r.blendParameterY=i[Ge.blendParameterY],r.blendType=i[Ge.blendType],r.children=i[Ge.children],r.useAutomaticThresholds=i[Ge.useAutomaticThresholds],r.minThreshold=i[Ge.minThreshold],r.maxThreshold=i[Ge.maxThreshold];const a=i[Ge.children];r.children=new Array(a.length);for(let t=0;t<a.length;++t){const s=new UnityEditor.Animations.ChildMotion,i=a[t];e.r(!0,i[He.motion+1],0,s,"motion"),s.position=new n.l,s.position.x=i[He.position+0],s.position.y=i[He.position+1],s.threshold=i[He.threshold],s.timeScale=i[He.timeScale],s.cycleOffset=i[He.cycleOffset],s.directBlendParameter=i[He.directBlendParameter],s.mirror=i[He.mirror],r.children[t]=s}return this.registry.Put(t.id,r),r}unloadAsync(e){this.registry.Release(e.id)}}class We extends a{loadAsync(e,t,s){const i=e.d("Luna.Unity.DTO.UnityEngine.Animation.Mecanim.AnimatorController",t.data),n=new UnityEditor.Animations.AnimatorController.$ctor1(i,this.registry);return this.registry.Put(t.id,n),n}unloadAsync(e){this.registry.Release(e.id)}}class Ye extends a{loadAsync(e,t,s){const i=new UnityEngine.AnimatorOverrideController;return e.d("Luna.Unity.DTO.UnityEngine.Animation.Mecanim.AnimatorOverrideController",t.data,i),this.registry.Put(t.id,i),i}unloadAsync(e){this.registry.Release(e.id)}}let Ke=null;pc.waitForMecanim.then((e=>{Ke=e}));class Qe extends a{loadAsync(e,t,s){const i=new UnityEngine.Avatar;if(e.d("Luna.Unity.DTO.UnityEngine.Animation.Mecanim.Avatar",t.data,i),this.registry.Put(t.id,i),Ke&&i.isValid){const e=i.native=new Ke.Avatar(i.name,t.id),s=Ke._malloc(i.constant.length);Ke.HEAPU8.set(i.constant,s),e.setAsset(s,i.constant.length)}return i}unloadAsync(e){this.registry.Release(e.id)}}const Xe=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Assets.Font"];class qe extends a{loadAsync(e,t,s){const i=t.data,n={name:i[Xe.name],ascent:i[Xe.ascent],originalLineHeight:i[Xe.originalLineHeight],fontSize:i[Xe.fontSize],originalFontSize:i[Xe.originalFontSize],characterInfo:i[Xe.characterInfo],texture:this.registry.TryGet(t.data[Xe.texture+1])},a=new r.b(t.font,n);return this.registry.Put(t.id,a),r.b.fonts=r.b.fonts||{},r.b.fonts[t.data[Xe.name]]=a,r.b.fonts[t.data[Xe.name].replace("-Regular","")]=a,UnityEngine.Font.FontDefault&&"Arial"!==t.data[Xe.name]||(UnityEngine.Font.FontDefault=new UnityEngine.Font(a)),a}unloadAsync(e){this.registry.Release(e.id)}}class $e extends a{loadAsync(e,t,s){return e.deserializeTo(t.data,UnityEngine.Resources,"Luna.Unity.DTO.UnityEngine.Assets.Resources"),rt.handlers.prefab_component.load(),null}unloadAsync(e){this.registry.Release(e.id)}}class Je extends a{loadAsync(e,t,s){try{const s=Deserializers.types[t.class],i=e.d(s,t.data);return i.name=t.name,i?(this.registry.Put(t.id,i),i):(UnityEngine.Debug.LogWarning$1("Failed to instantiate ScriptableObject of type "+s),null)}catch(e){return UnityEngine.Debug.LogWarning$1("Cannot put scriptable object with id "+t.id+": "+e),null}}unloadAsync(e){this.registry.Release(e.id)}}const Ze=Deserializers.fields["Luna.Unity.DTO.UnityEngine.Assets.TextAsset"];class et extends a{loadAsync(e,t,s){const i=new UnityEngine.TextAsset;return i.data=t.data[Ze.data],i.name=t.data[Ze.name],i.bytes64=t.data[Ze.bytes64],this.registry.Put(t.id,i),i}unloadAsync(e){this.registry.Release(e.id)}}class tt extends a{load(){const e=UnityEngine.Resources.componentToPrefabIds;for(let t=0;t<e.length;t+=2){const s=e[t],i=e[t+1];this.registry.Put(s,{isPrefabProxy:!0,componentId:s,prefabId:i})}}}var st=s(17);class it extends a{loadAsync(e,t,s){const i=new UnityEngine.Rendering.Universal.UniversalRenderPipelineAsset,n=e.d("Luna.Unity.DTO.UnityEngine.Assets.UniversalRenderPipelineAsset",t.data,i);return this.registry.Put(t.id,n),UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset=n,this.app.tickUrpRenderer(),{result:n}}unloadAsync(e){this.registry.Release(e.id)}}class nt extends a{loadAsync(e,t,s){const i=new UnityEngine.U2D.SpriteAtlas;return e.d("Luna.Unity.DTO.UnityEngine.Assets.SpriteAtlas",t.data,i),this.registry.Put(t.id,i),i}unloadAsync(e){this.registry.Release(e.id)}}class rt{constructor(e){this.objectSpace=e.objectSpace,this.manifest=e.manifest,this.network=e.network,this.namesToId={},this.downloadPromise=null,this.dowloadBlobPromise=null,this.progress={total:0,loaded:0,progress:0},this.onProgress=null,this.blob=null,this.json=null}_tickResource(){this.progress.loaded++,this.progress.progress=.25+this.progress.loaded/this.progress.total*.75,this.onProgress&&this.onProgress(this.progress.progress)}_collectDependencies(e,t){let s=[];if(!e[t]){e[t]=!0,s.push(t);const i=rt.bundles[t].dependencies;for(let t=0;t<i.length;t++)s=s.concat(this._collectDependencies(e,i[t]))}return s}_loadAsync(){if(this.loadCompletionSource)return this.loadCompletionSource.task;this.loadCompletionSource=new System.Threading.Tasks.TaskCompletionSource,this.loadCompletionSource.task.setSynchronous(!0);const e=this._collectDependencies({},this.manifest.id),t=[],s=[],i=new ce;for(let i=0;i<e.length;i++){const n=rt.new(e[i]);s.push(n),t.push(n._downloadBundleDataAsync(),n._downloadBlobDataAsync())}return Promise.all(t).then((()=>{window.dispatchEvent(new Event("luna:startup:bundlesLoad")),this.progress.progress=.25,this.progress.total=0;for(const e of s)for(const t in e.json)this.progress.total+=(e.json[t]||[]).length;return this.progress.loaded=-1,this._tickResource(),console.info("%cBundle chain loaded successfully","background-color: black; color: white; padding: 1em;"),this._loadSimpleAssetsAsync(i,s).then((()=>(console.info("%cSimple assets loaded successfully","background-color: black; color: white; padding: 1em;"),window.dispatchEvent(new Event("luna:startup:loadSimpleAssetsAsync")),this._compileShaders(),window.dispatchEvent(new Event("luna:startup:shaderReady")),this._loadComplexAssetsAsync(i,s).then((()=>(console.info("%cComplex assets loaded successfully","background-color: black; color: white; padding: 1em;"),i.resolveReferences(this.objectSpace.getRegistry()),this._postProcessShaders(),window.dispatchEvent(new Event("luna:startup:loadComplexAssetsAsync")),this._loadPrefabsAsync(i,s).then((()=>(console.info("%cPrefabs loaded successfully","background-color: black; color: white; padding: 1em;"),i.resolveReferences(this.objectSpace.getRegistry()),window.dispatchEvent(new Event("luna:startup:loadPrefabsAsync")),this._loadScenesAsync(i,s).then((()=>{console.info("%cScenes loaded successfully","background-color: black; color: white; padding: 1em;"),i.resolveReferences(this.objectSpace.getRegistry()),window.dispatchEvent(new Event("luna:startup:loadScenesAsync")),this.loadCompletionSource.setResult(this)})))))))))))})).catch((e=>{console.error(e)})),this.loadCompletionSource.task}_postProcessShaders(){const e=rt.handlers.shader.shaders;for(let t=0;t<e.length;t++)e[t].onAfterDeserialize()}_compileShaders(){const e=pc.Application.getApplication().graphicsDevice,t=e.shaders;for(let s=0;s<t.length;s++){const i=t[s];e.compileShaderAndBindAttributes(i)}for(let s=0;s<t.length;s++){const i=t[s];e.linkShader(i)}if(window.lunaStartup)for(let s=0;s<t.length;s++){const i=t[s];i.ready||e.postLink(i)}}_downloadBlobDataAsync(){return this.dowloadBlobPromise||(this.dowloadBlobPromise=new Promise((e=>{this.network.GetBlobAsync("assets/bundles/"+this.manifest.id+"/data.blob").continueWith((t=>{if(t.status===System.Threading.Tasks.TaskStatus.ranToCompletion)this.blob=t.result,rt.tickResource(),e();else{(t.exception&&t.exception.innerException?t.exception.innerException.message:null)===LunaUnity.Utils.Network.ERR_ABORTED||e()}}))}))),this.dowloadBlobPromise}_downloadBundleDataAsync(){return this.downloadPromise||(this.downloadPromise=new Promise(((e,t)=>{this.network.GetJsonAsync("assets/bundles/"+this.manifest.id+"/bundle.json").continueWith((s=>{s.status===System.Threading.Tasks.TaskStatus.ranToCompletion?(this.json=s.result,rt.tickResource(),e()):t(s.error||s.exception)}))}))),this.downloadPromise}_loadSimpleAssetsAsync(e,t){return this._loadAssetsFromBundlesAsync(e,t,[{handler:"urp_asset",json:"urp-assets"},{handler:"shader",json:"shaders"},{handler:"texture",json:"textures"},{handler:"mesh",json:"meshes"},{handler:"video",json:"videos"},{handler:"sound",json:"sounds"},{handler:"animation_clip",json:"animation-clips"},{handler:"blend_tree",json:"blend-trees"},{handler:"text_asset",json:"text-assets"},{handler:"audio_mixer",json:"audio-mixers"},{handler:"physic_material",json:"physic-materials"},{handler:"physics_material_2d",json:"physics-materials-2d"},{handler:"audio_mixer_snapshot",json:"audio-mixer-snapshots"},{handler:"avatar",json:"avatars"}])}_loadComplexAssetsAsync(e,t){return this._loadAssetsFromBundlesAsync(e,t,[{handler:"cubemap",json:"cubemaps"},{handler:"material",json:"materials"},{handler:"sprite",json:"sprites"},{handler:"font",json:"fonts"},{handler:"animator_controller",json:"animator-controllers"},{handler:"animator_override_controller",json:"animator-override-controllers"},{handler:"sprite_atlas",json:"sprite-atlases"}])}_loadPrefabsAsync(e,t){let s=[],i=[];for(let e=0;e<t.length;e++){const n=t[e];n._guardAssetType("prefabs",(()=>{s=s.concat(n.json.prefabs||[])})),n._guardAssetType("scriptable-objects",(()=>{i=i.concat(n.json["scriptable-objects"]||[])}))}const n=rt.handlers.game_object,r=rt.handlers.scriptable_object,a=st.a.getApplication().systems.list;for(let e=0;e<a.length;e++){a[e].creatingPrefabs=!0}for(let i=0;i<s.length;i++)n.loadAsync(e,s[i],t),this._tickResource();for(let e=0;e<a.length;e++){a[e].creatingPrefabs=!1}const o=[];for(let t=0;t<i.length;t++){const s=r.loadAsync(e,i[t],[]);o.push(s),this._tickResource()}for(let e=0;e<o.length;e++){const t=o[e];t.CallAwake&&t.CallAwake(),t.CallOnEnable&&t.CallOnEnable()}return Promise.resolve(null)}_loadScenesAsync(e,t){return this._loadAssetsFromBundlesAsync(e,t,[{handler:"resources",json:"resources"},{handler:"scene",json:"scenes"}])}_loadAssetsFromBundlesAsync(e,t,s){const i=[],n={};for(let r=0;r<s.length;r++){const a=s[r].handler,o=s[r].json,h=rt.handlers[a];let l=[];for(let e=0;e<t.length;e++){const s=t[e];n[s.manifest.id]=s,s._guardAssetType(o,(()=>{l=l.concat(s.json[o]||[])}))}for(let s=0;s<l.length;s++){let r=l[s];window.playgroundBundlesOverrides&&(r=window.playgroundBundlesOverrides[r.id]||r);const a=h.loadAsync(e,r,t);this._tickResource(),a instanceof Promise&&i.push(a.then((()=>rt.tickResource()))),n[r.assetBundleId].namesToId[(r.name||"").toLowerCase()]=l[s].id||r.$id}}return Promise.all(i)}_remove(){console.warn("Requested removal of asset bundle id = "+this.manifest.id+" - this is no-op for now")}_guardAssetType(e,t){this._guardAssetTypes=this._guardAssetTypes||{},this._guardAssetTypes[e]||t(),this._guardAssetTypes[e]=!0}}rt.handlers=null,rt.bundles=null,rt._bundles={},rt.objectSpace=null,rt.network=null,rt.configure=(e,t)=>{rt.objectSpace=e.objectSpace,rt.network=e.network,rt.bundles=t,rt.handlers={game_object:new q(e),audio_mixer:new $(e),audio_mixer_snapshot:new J(e),project_settings:new he(e),material:new _e(e),physic_material:new me(e),physics_material_2d:new pe(e),mesh:new Ee(e),scene:new be(e),shader:new Ce(e),video:new xe(e),sound:new Ie(e),sprite:new Pe(e),texture:new Le(e),cubemap:new Ue(e),animation_clip:new Ve(e),blend_tree:new je(e),animator_controller:new We(e),animator_override_controller:new Ye(e),font:new qe(e),resources:new $e(e),scriptable_object:new Je(e),text_asset:new et(e),sprite_atlas:new nt(e),urp_asset:new it(e),prefab_component:new tt(e),avatar:new Qe(e)}},rt._resources=0,rt.tickResource=()=>{rt._resources++},rt.loadAsync=e=>rt.new(e)._loadAsync(),rt.loadProjectSettingsAsync=(e,t)=>{const s=new System.Threading.Tasks.TaskCompletionSource;rt.configure(e,t);const i=new ce,n=rt.new(-2),r=[{handler:"project_settings",json:"project-settings"}];return n._downloadBundleDataAsync().then((()=>n._loadAssetsFromBundlesAsync(i,[n],r))).then((()=>{console.info("%cProject Settings loaded successfully","background-color: black; color: white; padding: 1em;"),i.resolveReferences(n.objectSpace.getRegistry()),s.setResult(void 0)})).catch((e=>{console.error(e)})),s.task},rt.checkIsObjectAlreadyLoadedFromResources=e=>!e.isPrefabProxy,rt.loadObject=e=>{const t=new ce,s=rt.handlers.game_object.loadAsync(t,e.prefab,[]);return t.resolveReferences(rt.objectSpace.getRegistry()),s},rt.new=e=>{const t=rt.bundles[e];return rt._bundles[e]=rt._bundles[e]||new rt({manifest:t,objectSpace:rt.objectSpace,network:rt.network}),rt._bundles[e]},rt.cleanup=()=>{Object.keys(rt._bundles).forEach((e=>{const t=rt._bundles[e];t.blob=null,t.json=null})),window.blobs=null,window.jsons=null,window.sounds=null,MODULE_prefabs||"facebook-instant-games"===window.$environment.targetPlatform||window.$application.objectSpace.getRegistry().Clear()};class at{constructor(){this.$id=0,this.isLoaded=!1,this.index=-1,this.name="",this.template=null,this.renderSettings=null,this.root=null,this.rootJsons=null,this.projectSettings=i.i.instance}initializeAsTemplate(e){return this.rootJsons=e.rootJsons,this.renderSettings=e.renderSettings,this.name=e.name,this.index=e.index,this}_createRoot(){this.root=new i.f,this.root.scene=this,this.root.name="SceneRoot: "+this.name,i.a.getApplication().root.addChild(this.root)}initializeAsDontDestroyOnLoad(){this.name="DontDestroyOnLoad",this.isLoaded=!0,this._createRoot()}isValid(){return!0}_load(e){this.isLoaded=!0,this._createRoot(),UnityEngine.LightmapSettings.reflectionProbes||(UnityEngine.LightmapSettings.reflectionProbes=new UnityEngine.ReflectionProbes),this._installLightProbes(),this._installLightmaps(),this.disableCallbacks(),this._loadObjects(),e!==UnityEngine.SceneManagement.LoadSceneMode.Instant&&e!==UnityEngine.SceneManagement.LoadSceneMode.Single||(window.$scene=this,this._applyRenderSettings(),this._updateEnvironmentLighting()),this.invokeCallbacks(this.root),this.root.syncHierarchy()}loadAsync(e){return this._load(e)}unload(){this._unload()}_unload(){const e=this.root.children.slice();for(let t=0;t<e.length;t++)new i.e(e[t],0).execute();this.root.destroy(),this.root=null,this.isLoaded=!1,this._uninstallLightProbes()}findChild(e,t){if(t.id===e)return t;{let s=null;for(let i=0;i<t.children.length&&(s=this.findChild(e,t.children[i]),!s);i++);return s}}_instantiate(e,t,s,i,n,r){const a=rt.handlers.game_object.fork(),o=new ce;let h;o.root=n||this.root;let l=!1;if(e.handle&&!e.handle.isPrefab){const s=e.gameObject.handle.$id;t.handle.$id===s?h=t.handle.objectJson:(t=t.handle.objectJson,h=this.findChild(s,t)),t=e.handle}else if(t.isPrefabProxy)h=t.prefab||a.registry.Get(t.prefabId).prefab,h||(h=a.registry.Get(t.prefabId).objectJson);else if(h=(t=t.handle).objectJson,l=!0,!h)throw new Error("Unable to instantiate a non-prefab object");this.disableCallbacks();const c=a.loadAsync(o,h,[]);if(c.isPrefab=!1,e.handle&&!e.handle.isPrefab&&this._copyTransformsFromSource(e.handle,c),c.name=(t.name||c.name)+"(Clone)",l&&(c.enabled=t.activeSelf),o.resolveReferences(a.registry),s&&i)c.muteTransformModificationCallback(),c.setRotation(i),c.setPosition(s),c.unmuteTransformModificationCallback();else if(r){c.muteTransformModificationCallback();const e=c.getLocalRotationAndScale();c.setRotation(c.getLocalRotation().clone()),c.setPosition(c.getLocalPosition().clone()),c.setWorldRotationAndScale(e),c.unmuteTransformModificationCallback()}this.invokeCallbacks(c);const d=a.registry.Get(t.isPrefabProxy?t.componentId||h.id:e.handle.$id);if(d.code)return d.code;if(t.isPrefabProxy)return UnityEngine.Object.FromHandle(e,d);if(Bridge.Reflection.isAssignableFrom(UnityEngine.Transform,Bridge.getType(e)))return UnityEngine.Object.FromHandle(UnityEngine.GameObject,d).transform;if("GameObject"===Bridge.Reflection.getTypeName(Bridge.getType(e)))return UnityEngine.Object.FromHandle(UnityEngine.GameObject,d);throw new Error("Don't know what should be instantiated")}_copyTransformsFromSource(e,t){this._copyTransformFromSource(e,t),this._copyRectTransformFromSource(e,t)}_copyTransformFromSource(e,t){const s=e["__UnityEngine.Transform"],i=t["__UnityEngine.Transform"];s&&i&&(i.setlocalPosition(s.localPosition),i.setlocalRotation(s.localRotation),i.setlocalScale(s.localScale));const n=e.children?e.children.length:0,r=t.children?t.children.length:0,a=n<r?n:r;for(let s=0;s<a;s++)this._copyTransformFromSource(e.children[s],t.children[s])}_copyRectTransformFromSource(e,t){const s=e["__UnityEngine.RectTransform"],i=t["__UnityEngine.RectTransform"];s&&i&&(i.setpivot(s.pivot),i.setanchorMin(s.anchorMin),i.setanchorMax(s.anchorMax),i.setanchoredPosition(s.anchoredPosition),i.setsizeDelta(s.sizeDelta));const n=e.children?e.children.length:0,r=t.children?t.children.length:0,a=n<r?n:r;for(let s=0;s<a;s++)this._copyRectTransformFromSource(e.children[s],t.children[s])}_applyRenderSettings(){const e=i.a.getApplication(),t=UnityEngine.RenderSettings,s=this.renderSettings;e.scene.ambientLight=(new n.d).copy(s.ambientLight),t._ambientMode=s.ambientMode,t._pixelLightCount=e.isUrp?4:s.pixelLightCount,t._ambientLight=s.ambientLight.clone(),t._ambientSkyColor=s.ambientSkyColor.clone(),t._ambientEquatorColor=s.ambientEquatorColor.clone(),t._ambientGroundColor=s.ambientGroundColor.clone(),t._ambientIntensity=s.ambientIntensity,t._reflectionIntensity=s.reflectionIntensity,t._defaultReflectionMode=s.defaultReflectionMode,t._defaultReflectionResolution=s.defaultReflectionResolution,t.sun=s.sun,t._skybox=s.skybox,t.mixedBakeMode=s.mixedBakeMode,t.fogDensity=s.fogDensity,t.fogColor=s.fogColor.clone(),t.fogStartDistance=s.fogStartDistance,t.fogEndDistance=s.fogEndDistance,t.fogMode=s.fogMode,t.fog=s.fog,t.hasLightDataAsset=s.hasLightDataAsset,t.hasManualGenerate=s.hasManualGenerate,t.ambientProbe.clear(),this._installSkybox(),t._customReflection=s.customReflection}_updateEnvironmentLighting(){const e=UnityEngine.RenderSettings,t=i.a.getApplication();t.scene.skybox.update(),t.scene.skybox.environmentCubemap||e.defaultReflectionMode!==UnityEngine.Rendering.DefaultReflectionMode.Skybox&&e.defaultReflectionMode!==UnityEngine.Rendering.DefaultReflectionMode.Custom?(t.scene.skybox.computeIndirectSpecular(),t.scene.skybox.updateReflectionIntensity()):UnityEngine.DynamicGI.BakeReflectionsCubemap(),this.handleAmbientLight()}handleAmbientLight(){UnityEngine.RenderSettings.ambientProbe.copy(this.renderSettings.ambientProbe)}_installSkybox(){const e=i.a.getApplication();e.scene.skybox||(e.scene.skybox=new r.p(e,e.scene,this.renderSettings),e.scene.skybox.install(),e.scene.skybox.environmentCubemap=this.renderSettings.defaultReflection?this.renderSettings.defaultReflection.handle:null)}_installLightmaps(){this.renderSettings.lightmaps&&0!==this.renderSettings.lightmaps.length&&(UnityEngine.LightmapSettings.lightmapEncodingQuality=this.projectSettings.lightmapEncodingQuality,UnityEngine.LightmapSettings.bakedColorSpace=this.projectSettings.desiredColorSpace,UnityEngine.LightmapSettings.lightmapsMode=this.renderSettings.lightmapsMode,UnityEngine.LightmapSettings.environmentLightingMode=this.renderSettings.environmentLightingMode,UnityEngine.LightmapSettings.manager.loadSceneLightmaps(this.index,this.renderSettings.lightmaps))}_installLightProbes(){if(UnityEngine.LightmapSettings.lightProbes||(UnityEngine.LightmapSettings.lightProbes=this.renderSettings.lightProbes),!this.renderSettings.lightProbes||!this.renderSettings.lightProbes.HasProbes)return;const e=UnityEngine.SceneManagement.SceneManager.currentLightProbeProvider;e&&e.index===this.index||(UnityEngine.LightmapSettings.lightProbes&&UnityEngine.LightmapSettings.lightProbes.HasProbes&&UnityEngine.Debug.LogWarning$1("Another scene with light probes was loaded. Previous light probes were unloaded."),UnityEngine.LightmapSettings.lightProbes=this.renderSettings.lightProbes),UnityEngine.SceneManagement.SceneManager.currentLightProbeProvider=this}_uninstallLightProbes(){if(UnityEngine.SceneManagement.SceneManager.currentLightProbeProvider!==this)return;const e=this.getClosestLoadedSceneMatch((e=>e._containsLightProbes()));e&&e._installLightProbes()}getClosestLoadedSceneMatch(e){const t=UnityEngine.SceneManagement.SceneManager,s=t.GetSceneIndex(this);if(s<0)return null;const i=t.loadedScenes._items,n=t.loadedScenes.Count;for(let t=s-1;t>=0;t--){const s=i[t];if(s&&s.isLoaded&&(!e||e(s)))return s}for(let t=s+1;t<n;t++){const s=i[t];if(s&&s.isLoaded&&(!e||e(s)))return s}return null}_containsLightProbes(){return this.renderSettings.lightProbes&&this.renderSettings.lightProbes.HasProbes}_loadObjects(){const e=rt.handlers.game_object.fork(),t=new ce;t.root=this.root;const s=i.a.getApplication().systems;for(let s=0;s<this.rootJsons.length;s++)e.loadAsync(t,this.rootJsons[s],[]);s.physics.syncTransforms(this.root),s.physics2D.syncTransforms(this.root),s.physics.syncHierarchyRecursive(this.root),s.physics2D.syncHierarchyRecursive(this.root);const n=e.registry.TryGet(this.renderSettings.sunLightObjectId);this.renderSettings.sun=UnityEngine.Object.FromHandle(UnityEngine.Light,n),t.resolveReferences(e.registry)}invokeCallbacks(e){i.a.getApplication().systems.unitymanager.invokeCallbacks(e)}disableCallbacks(){i.a.getApplication().systems.unitymanager.disableCallbacks()}getRootGameObjects(){if(!this.root)return System.Array.init([],UnityEngine.GameObject);const e=this.root.children,t=e.length,s=new Array(t);for(let i=0;i<t;++i)s[i]=UnityEngine.Object.FromHandle(UnityEngine.GameObject,e[i]);return System.Array.init(s,UnityEngine.GameObject)}createInstance(){const e=new at;return e.template=this,e.index=this.index,e.name=this.name,e.rootJsons=this.rootJsons,e.renderSettings=this.renderSettings,e}setActive(e){e&&window.$scene!==this&&(this._applyRenderSettings(),this._updateEnvironmentLighting(),window.$scene=this)}addGameObjectToRoot(e){const t=e.handle;let s=null;if(t.parent&&(s=t.parent.scene),s&&s===this)return;const i=t.getWorldTransform().clone();t.reparent(this.root,-1),t.setLocalTransform(i)}}window.LunaUnity=window.LunaUnity||{},window.LunaUnity.Objects=window.LunaUnity.Objects||{},window.LunaUnity.Objects.Scene=at,window.LunaUnity.Objects.Request=ce,window.LunaUnity.Objects.ImmediateRequest=de,window.LunaUnity.Objects.LightmapManager=class{constructor(){this.lightmaps=[]}getLightmap(e,t){const s=this.lightmaps[e];return s?s.lightmaps[t]:null}loadSceneLightmaps(e,t){this.lightmaps[e]=this.lightmaps[e]||{lightmaps:[],custom:!1},this.lightmaps[e].lightmaps=t,this.lightmaps[e].custom=!1}setManagedLightmaps(e){const t=UnityEngine.SceneManagement.SceneManager.loadedScenes._items;let s=0;const i=UnityEngine.SceneManagement.SceneManager.loadedScenes.Count;for(let n=0;n<i;n++){const r=t[n],a=this.lightmaps[r.index];if(a){const r=[];let o=a.lightmaps.length,h=!0;for(let e=n+1;e<i;e++)if(this.lightmaps[t[e].index]){h=!1;break}h&&(o=e.length-s);for(let t=0;t<o;t++)r.push(new UnityEngine.LightmapData.$ctor1(e[s])),s++;a.custom=!0,a.lightmaps=r}}}getManagedLightmaps(){if(0===this.lightmaps.length)return System.Array.init([],UnityEngine.LightmapData);const e=[],t=UnityEngine.SceneManagement.SceneManager.loadedScenes._items,s=UnityEngine.SceneManagement.SceneManager.loadedScenes.Count;for(let i=0;i<s;i++){const s=t[i],n=this.lightmaps[s.index];if(n){const t=n.lightmaps;for(let s=0;s<t.length;s++)e.push(new UnityEngine.LightmapData.$ctor1(t[s]))}}return System.Array.init(e,UnityEngine.LightmapData)}},window.LunaUnity.Objects.Bundle=rt}},e=>{e.O(0,[1],(()=>{return t=57,e(e.s=t);var t}));e.O()}]),function(){const e=function(e,t){this.o=e,this.n=t};Object.defineProperty(e.prototype,"v",{get:function(){return null===this.n||void 0===this.n?this.o:this.o[this.n]},set:function(e){null!==this.n&&void 0!==this.n||(e&&e.$clone?e.$clone(this.o):this.o=e),this.o[this.n]=e}}),Bridge.ref=function(t,s){return Bridge.isArray(s)&&(s=System.Array.toIndex(t,s)),new e(t,s)},Bridge._getTypeByName=LunaUnity.Objects.Request.prototype._getTypeByName}(),window.System$Collections$Generic$ICollection$1$Function$contains="contains",window.System$Collections$Generic$ICollection$1$Function$getItem="getItem",window.System$Collections$Generic$ICollection$1$Function$setItem="setItem",window.System$Collections$Generic$ICollection$1$Function$removeItem="removeItem",window.System$Collections$Generic$IDictionary$2$Function$Function$add="add",window.System$Collections$Generic$IDictionary$2$Function$Function$containsKey="containsKey",window.System$Collections$Generic$IDictionary$2$Function$Function$getItem="getItem",window.System$Collections$Generic$IDictionary$2$Function$Function$setItem="setItem",window.System$Collections$Generic$IDictionary$2$Function$Function$removeItem="removeItem",Bridge.ns=function(e,t){const s=e.split(".");let i=0;if(t||(t=Bridge.global),t===Bridge.global&&(window.$typeCache=window.$typeCache||{},window.$typeCache[e]))return window.$typeCache[e];for(i=0;i<s.length;i++)void 0===t[s[i]]&&(t[s[i]]={}),t=t[s[i]];return t===Bridge.global&&(window.$typeCache[e]=t),t};