4dfe86ef5f
Se sube la caché en disco (live/, icons/, spellicons/, achievements/) para no depender de que wowhead/zamimg siga sirviendo los assets: aunque el código la repuebla bajo demanda, lo ya descargado queda respaldado en el repo.
3 lines
261 KiB
JavaScript
3 lines
261 KiB
JavaScript
/*! For license information please see viewer.min.js.LICENSE.txt */
|
|
(()=>{"use strict";var t,e;window.requestAnimFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t,e){window.setTimeout(t,1e3/60)},jQuery.support.cors=!0,$.ajaxTransport?($.ajaxSetup({flatOptions:{renderer:!0}}),$.ajaxTransport("+binary",function(t,e,i){if(window.FormData&&(t.dataType&&"binary"==t.dataType||t.data&&(window.ArrayBuffer&&t.data instanceof ArrayBuffer||window.Blob&&t.data instanceof Blob)))return{send:function(e,i){var r=new XMLHttpRequest,n=t.url,s=t.type,a=t.responseType||"blob",o=t.data||null;t.renderer&&r.addEventListener("progress",function(e){e.lengthComputable&&(t.renderer.downloads[this.responseURL]?t.renderer.downloads[this.responseURL].loaded=e.loaded:t.renderer.downloads[this.responseURL]={loaded:e.loaded,total:e.total},t.renderer.updateProgress())}),r.addEventListener("load",function(){t.renderer&&(delete t.renderer.downloads[this.responseURL],t.renderer.updateProgress());var e={};e[t.dataType]=r.response,i(r.status,r.statusText,e,r.getAllResponseHeaders())}),r.open(s,n,!0),r.responseType=a,r.send(o)},abort:function(){i.abort()}}})):(t=$.httpData,$.httpData=function(e,i,r){return"binary"==i?e.response:t(e,i,r)},$.ajaxSetup({beforeSend:function(t,e){"binary"==e.dataType&&(t.responseType=e.responseType||"arraybuffer",t.addEventListener("progress",function(t){e.renderer&&t.lengthComputable&&(e.renderer.downloads[this.responseURL]?e.renderer.downloads[this.responseURL].loaded=t.loaded:e.renderer.downloads[this.responseURL]={loaded:t.loaded,total:t.total},e.renderer.updateProgress())},!1),t.addEventListener("load",function(){e.renderer&&(delete e.renderer.downloads[this.responseURL],e.renderer.updateProgress())},!1))}})),Math.randomInt=Math.randomInt||function(t,e){return Math.floor(Math.random()*(e-t))+t},"function"!=typeof Object.create&&(Object.create=(e=function(){},function(t){if(arguments.length>1)throw Error("Second argument not supported");if("object"!=typeof t)throw TypeError("Argument must be an object");e.prototype=t;var i=new e;return e.prototype=null,i})),window.console=window.console||{log:function(){},error:function(){},warn:function(){}};let i=Float32Array;function r(t,e,r){const n=new i(3);return t&&(n[0]=t),e&&(n[1]=e),r&&(n[2]=r),n}function n(t,e,r){return(r=r||new i(3))[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r}function s(t,e,r){return(r=r||new i(3))[0]=t[0]*e[0],r[1]=t[1]*e[1],r[2]=t[2]*e[2],r}let a=Float32Array;function o(t){return(t=t||new a(16))[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function l(t,e){e=e||new a(16);const i=t[0],r=t[1],n=t[2],s=t[3],o=t[4],l=t[5],h=t[6],u=t[7],c=t[8],d=t[9],f=t[10],g=t[11],p=t[12],m=t[13],b=t[14],y=t[15],F=f*y,v=b*g,S=h*y,C=b*u,T=h*g,x=f*u,_=n*y,A=b*s,w=n*g,E=f*s,M=n*u,D=h*s,B=c*m,k=p*d,P=o*m,R=p*l,L=o*d,I=c*l,U=i*m,O=p*r,W=i*d,H=c*r,G=i*l,j=o*r,N=F*l+C*d+T*m-(v*l+S*d+x*m),z=v*r+_*d+E*m-(F*r+A*d+w*m),V=S*r+A*l+M*m-(C*r+_*l+D*m),q=x*r+w*l+D*d-(T*r+E*l+M*d),X=1/(i*N+o*z+c*V+p*q);return e[0]=X*N,e[1]=X*z,e[2]=X*V,e[3]=X*q,e[4]=X*(v*o+S*c+x*p-(F*o+C*c+T*p)),e[5]=X*(F*i+A*c+w*p-(v*i+_*c+E*p)),e[6]=X*(C*i+_*o+D*p-(S*i+A*o+M*p)),e[7]=X*(T*i+E*o+M*c-(x*i+w*o+D*c)),e[8]=X*(B*u+R*g+L*y-(k*u+P*g+I*y)),e[9]=X*(k*s+U*g+H*y-(B*s+O*g+W*y)),e[10]=X*(P*s+O*u+G*y-(R*s+U*u+j*y)),e[11]=X*(I*s+W*u+j*g-(L*s+H*u+G*g)),e[12]=X*(P*f+I*b+k*h-(L*b+B*h+R*f)),e[13]=X*(W*b+B*n+O*f-(U*f+H*b+k*n)),e[14]=X*(U*h+j*b+R*n-(G*b+P*n+O*h)),e[15]=X*(G*f+L*n+H*h-(W*h+j*f+I*n)),e}function h(t,e,i){i=i||r();const n=e[0],s=e[1],a=e[2],o=n*t[3]+s*t[7]+a*t[11]+t[15];return i[0]=(n*t[0]+s*t[4]+a*t[8]+t[12])/o,i[1]=(n*t[1]+s*t[5]+a*t[9]+t[13])/o,i[2]=(n*t[2]+s*t[6]+a*t[10]+t[14])/o,i}function u(t,e,i){i=i||r();const n=e[0],s=e[1],a=e[2];return i[0]=n*t[0]+s*t[4]+a*t[8],i[1]=n*t[1]+s*t[5]+a*t[9],i[2]=n*t[2]+s*t[6]+a*t[10],i}const c=5120,d=5121,f=5122,g=5123,p=5124,m=5125,b=5126,y={};{const t=y;t[5120]=Int8Array,t[5121]=Uint8Array,t[5122]=Int16Array,t[5123]=Uint16Array,t[5124]=Int32Array,t[5125]=Uint32Array,t[5126]=Float32Array,t[32819]=Uint16Array,t[32820]=Uint16Array,t[33635]=Uint16Array,t[5131]=Uint16Array,t[33640]=Uint32Array,t[35899]=Uint32Array,t[35902]=Uint32Array,t[36269]=Uint32Array,t[34042]=Uint32Array}function F(t){if(t instanceof Int8Array)return c;if(t instanceof Uint8Array)return d;if(t instanceof Uint8ClampedArray)return d;if(t instanceof Int16Array)return f;if(t instanceof Uint16Array)return g;if(t instanceof Int32Array)return p;if(t instanceof Uint32Array)return m;if(t instanceof Float32Array)return b;throw new Error("unsupported typed array type")}function v(t){if(t===Int8Array)return c;if(t===Uint8Array)return d;if(t===Uint8ClampedArray)return d;if(t===Int16Array)return f;if(t===Uint16Array)return g;if(t===Int32Array)return p;if(t===Uint32Array)return m;if(t===Float32Array)return b;throw new Error("unsupported typed array type")}function S(t){const e=y[t];if(!e)throw new Error("unknown gl type");return e}const C="undefined"!=typeof SharedArrayBuffer?function(t){return t&&t.buffer&&(t.buffer instanceof ArrayBuffer||t.buffer instanceof SharedArrayBuffer)}:function(t){return t&&t.buffer&&t.buffer instanceof ArrayBuffer};function T(...t){console.error(...t)}const x=new Map;function _(t,e){if(!t||"object"!=typeof t)return!1;let i=x.get(e);i||(i=new WeakMap,x.set(e,i));let r=i.get(t);if(void 0===r){const n=Object.prototype.toString.call(t);r=n.substring(8,n.length-1)===e,i.set(t,r)}return r}function A(t,e){return"undefined"!=typeof WebGLTexture&&_(e,"WebGLTexture")}const w=34962,E={attribPrefix:""};function M(t,e,i,r,n){t.bindBuffer(e,i),t.bufferData(e,r,n||35044)}function D(t,e,i,r){if(n=e,"undefined"!=typeof WebGLBuffer&&_(n,"WebGLBuffer"))return e;var n;i=i||w;const s=t.createBuffer();return M(t,i,s,e,r),s}function B(t){return"indices"===t}function k(t){return t.length?t:t.data}const P=/coord|texture/i,R=/color|colour/i;function L(t,e,i){return t.numComponents||t.size||function(t,e){let i;if(i=P.test(t)?2:R.test(t)?4:3,e%i>0)throw new Error(`Can not guess numComponents for attribute '${t}'. Tried ${i} but ${e} values is not evenly divisible by ${i}. You should specify it.`);return i}(e,i||k(t).length)}function I(t,e){if(C(t))return t;if(C(t.data))return t.data;Array.isArray(t)&&(t={data:t});let i=t.type?U(t.type):void 0;return i||(i=B(e)?Uint16Array:Float32Array),new i(t.data)}function U(t){return"number"==typeof t?S(t):t||Float32Array}function O(t,e){return{buffer:e.buffer,numValues:24,type:(i=e.type,"number"==typeof i?i:i?v(i):5126),arrayType:U(e.type)};var i}function W(t,e){const i=e.data||e,r=U(e.type),n=i*r.BYTES_PER_ELEMENT,s=t.createBuffer();return t.bindBuffer(w,s),t.bufferData(w,n,e.drawType||35044),{buffer:s,numValues:i,type:v(r),arrayType:r}}function H(t,e,i){const r=I(e,i);return{arrayType:r.constructor,buffer:D(t,r,void 0,e.drawType),type:F(r),numValues:0}}function G(t,e){const i={};return Object.keys(e).forEach(function(r){if(!B(r)){const s=e[r],a=s.attrib||s.name||s.attribName||E.attribPrefix+r;if(s.value){if(!Array.isArray(s.value)&&!C(s.value))throw new Error("array.value is not array or typedarray");i[a]={value:s.value}}else{let e;e=s.buffer&&s.buffer instanceof WebGLBuffer?O:"number"==typeof s||"number"==typeof s.data?W:H;const{buffer:o,type:l,numValues:h,arrayType:u}=e(t,s,r),c=void 0!==s.normalize?s.normalize:(n=u)===Int8Array||n===Uint8Array,d=L(s,r,h);i[a]={buffer:o,numComponents:d,type:l,normalize:c,stride:s.stride||0,offset:s.offset||0,divisor:void 0===s.divisor?void 0:s.divisor,drawType:s.drawType}}}var n}),t.bindBuffer(w,null),i}const j=["position","positions","a_position"];function N(t,e,i){const r=G(t,e),n=Object.assign({},i||{});n.attribs=Object.assign({},i?i.attribs:{},r);const s=e.indices;if(s){const e=I(s,"indices");n.indices=D(t,e,34963),n.numElements=e.length,n.elementType=F(e)}else n.numElements||(n.numElements=function(t,e){let i,r;for(r=0;r<j.length&&(i=j[r],!(i in e))&&(i=E.attribPrefix+i,!(i in e));++r);r===j.length&&(i=Object.keys(e)[0]);const n=e[i];if(!n.buffer)return 1;t.bindBuffer(w,n.buffer);const s=t.getBufferParameter(w,34660);var a;t.bindBuffer(w,null);const o=s/(5120===(a=n.type)||5121===a?1:5122===a||5123===a?2:5124===a||5125===a||5126===a?4:0),l=n.numComponents||n.size,h=o/l;if(h%1!=0)throw new Error(`numComponents ${l} not correct for length ${length}`);return h}(t,n.attribs));return n}function z(t,e,i){const r="indices"===i?34963:w;return D(t,I(e,i),r)}function V(t,e){const i={};return Object.keys(e).forEach(function(r){i[r]=z(t,e[r],r)}),e.indices?(i.numElements=e.indices.length,i.elementType=F(I(e.indices))):i.numElements=function(t){let e,i;for(i=0;i<j.length&&(e=j[i],!(e in t));++i);i===j.length&&(e=Object.keys(t)[0]);const r=t[e],n=k(r).length;if(void 0===n)return 1;const s=L(r,e),a=n/s;if(n%s>0)throw new Error(`numComponents ${s} not correct for length ${n}`);return a}(e),i}function q(t,e){let i=0;return t.push=function(){for(let e=0;e<arguments.length;++e){const r=arguments[e];if(r instanceof Array||C(r))for(let e=0;e<r.length;++e)t[i++]=r[e];else t[i++]=r}},t.reset=function(t){i=t||0},t.numComponents=e,Object.defineProperty(t,"numElements",{get:function(){return this.length/this.numComponents|0}}),t}function X(t,e,i){return q(new(i||Float32Array)(t*e),t)}function J(t,e,i){const r=t.length,n=new Float32Array(3);for(let s=0;s<r;s+=3)i(e,[t[s],t[s+1],t[s+2]],n),t[s]=n[0],t[s+1]=n[1],t[s+2]=n[2]}function Y(t,e,i){i=i||r();const n=e[0],s=e[1],a=e[2];return i[0]=n*t[0]+s*t[1]+a*t[2],i[1]=n*t[4]+s*t[5]+a*t[6],i[2]=n*t[8]+s*t[9]+a*t[10],i}function K(t,e){return J(t,e,u),t}function Z(t,e){return J(t,l(e),Y),t}function Q(t,e){return J(t,e,h),t}function tt(t,e){return Object.keys(t).forEach(function(i){const r=t[i];i.indexOf("pos")>=0?Q(r,e):i.indexOf("tan")>=0||i.indexOf("binorm")>=0?K(r,e):i.indexOf("norm")>=0&&Z(r,e)}),t}function et(t,e,i){return t=t||2,{position:{numComponents:2,data:[(e=e||0)+-1*(t*=.5),(i=i||0)+-1*t,e+1*t,i+-1*t,e+-1*t,i+1*t,e+1*t,i+1*t]},normal:[0,0,1,0,0,1,0,0,1,0,0,1],texcoord:[0,0,1,0,0,1,1,1],indices:[0,1,2,2,1,3]}}function it(t,e,i,r,n){t=t||1,e=e||1,i=i||1,r=r||1,n=n||o();const s=(i+1)*(r+1),a=X(3,s),l=X(3,s),h=X(2,s);for(let n=0;n<=r;n++)for(let s=0;s<=i;s++){const o=s/i,u=n/r;a.push(t*o-.5*t,0,e*u-.5*e),l.push(0,1,0),h.push(o,u)}const u=i+1,c=X(3,i*r*2,Uint16Array);for(let t=0;t<r;t++)for(let e=0;e<i;e++)c.push((t+0)*u+e,(t+1)*u+e,(t+0)*u+e+1),c.push((t+1)*u+e,(t+1)*u+e+1,(t+0)*u+e+1);return tt({position:a,normal:l,texcoord:h,indices:c},n)}function rt(t,e,i,r,n,s,a){if(e<=0||i<=0)throw new Error("subdivisionAxis and subdivisionHeight must be > 0");r=r||0,s=s||0;const o=(n=n||Math.PI)-r,l=(a=a||2*Math.PI)-s,h=(e+1)*(i+1),u=X(3,h),c=X(3,h),d=X(2,h);for(let n=0;n<=i;n++)for(let a=0;a<=e;a++){const h=a/e,f=n/i,g=l*h+s,p=o*f+r,m=Math.sin(g),b=Math.cos(g),y=Math.sin(p),F=b*y,v=Math.cos(p),S=m*y;u.push(t*F,t*v,t*S),c.push(F,v,S),d.push(1-h,f)}const f=e+1,g=X(3,e*i*2,Uint16Array);for(let t=0;t<e;t++)for(let e=0;e<i;e++)g.push((e+0)*f+t,(e+0)*f+t+1,(e+1)*f+t),g.push((e+1)*f+t,(e+0)*f+t+1,(e+1)*f+t+1);return{position:u,normal:c,texcoord:d,indices:g}}const nt=[[3,7,5,1],[6,2,0,4],[6,7,3,2],[0,1,5,4],[7,6,4,5],[2,3,1,0]];function st(t){const e=(t=t||1)/2,i=[[-e,-e,-e],[+e,-e,-e],[-e,+e,-e],[+e,+e,-e],[-e,-e,+e],[+e,-e,+e],[-e,+e,+e],[+e,+e,+e]],r=[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],n=[[1,0],[0,0],[0,1],[1,1]],s=X(3,24),a=X(3,24),o=X(2,24),l=X(3,12,Uint16Array);for(let t=0;t<6;++t){const e=nt[t];for(let l=0;l<4;++l){const h=i[e[l]],u=r[t],c=n[l];s.push(h),a.push(u),o.push(c)}const h=4*t;l.push(h+0,h+1,h+2),l.push(h+0,h+2,h+3)}return{position:s,normal:a,texcoord:o,indices:l}}function at(t,e,i,r,n,s,a){if(r<3)throw new Error("radialSubdivisions must be 3 or greater");if(n<1)throw new Error("verticalSubdivisions must be 1 or greater");const o=void 0===s||s,l=void 0===a||a,h=(o?2:0)+(l?2:0),u=(r+1)*(n+1+h),c=X(3,u),d=X(3,u),f=X(2,u),g=X(3,r*(n+h/2)*2,Uint16Array),p=r+1,m=Math.atan2(t-e,i),b=Math.cos(m),y=Math.sin(m),F=n+(l?2:0);for(let s=o?-2:0;s<=F;++s){let a,o=s/n,l=i*o;s<0?(l=0,o=1,a=t):s>n?(l=i,o=1,a=e):a=t+s/n*(e-t),-2!==s&&s!==n+2||(a=0,o=0),l-=i/2;for(let t=0;t<p;++t){const e=Math.sin(t*Math.PI*2/r),i=Math.cos(t*Math.PI*2/r);c.push(e*a,l,i*a),s<0?d.push(0,-1,0):s>n?d.push(0,1,0):0===a?d.push(0,0,0):d.push(e*b,y,i*b),f.push(t/r,1-o)}}for(let t=0;t<n+h;++t)if(!(1===t&&o||t===n+h-2&&l))for(let e=0;e<r;++e)g.push(p*(t+0)+0+e,p*(t+0)+1+e,p*(t+1)+1+e),g.push(p*(t+0)+0+e,p*(t+1)+1+e,p*(t+1)+0+e);return{position:c,normal:d,texcoord:f,indices:g}}function ot(t,e){e=e||[];const i=[];for(let r=0;r<t.length;r+=4){const n=t[r],s=t.slice(r+1,r+4);s.push.apply(s,e);for(let t=0;t<n;++t)i.push.apply(i,s)}return i}function lt(){const t=[0,0,0,0,150,0,30,0,0,0,150,0,30,150,0,30,0,0,30,0,0,30,30,0,100,0,0,30,30,0,100,30,0,100,0,0,30,60,0,30,90,0,67,60,0,30,90,0,67,90,0,67,60,0,0,0,30,30,0,30,0,150,30,0,150,30,30,0,30,30,150,30,30,0,30,100,0,30,30,30,30,30,30,30,100,0,30,100,30,30,30,60,30,67,60,30,30,90,30,30,90,30,67,60,30,67,90,30,0,0,0,100,0,0,100,0,30,0,0,0,100,0,30,0,0,30,100,0,0,100,30,0,100,30,30,100,0,0,100,30,30,100,0,30,30,30,0,30,30,30,100,30,30,30,30,0,100,30,30,100,30,0,30,30,0,30,60,30,30,30,30,30,30,0,30,60,0,30,60,30,30,60,0,67,60,30,30,60,30,30,60,0,67,60,0,67,60,30,67,60,0,67,90,30,67,60,30,67,60,0,67,90,0,67,90,30,30,90,0,30,90,30,67,90,30,30,90,0,67,90,30,67,90,0,30,90,0,30,150,30,30,90,30,30,90,0,30,150,0,30,150,30,0,150,0,0,150,30,30,150,30,0,150,0,30,150,30,30,150,0,0,0,0,0,0,30,0,150,30,0,0,0,0,150,30,0,150,0],e=ot([18,0,0,1,18,0,0,-1,6,0,1,0,6,1,0,0,6,0,-1,0,6,1,0,0,6,0,1,0,6,1,0,0,6,0,-1,0,6,1,0,0,6,0,-1,0,6,-1,0,0]),i=ot([18,200,70,120,18,80,70,200,6,70,200,210,6,200,200,70,6,210,100,70,6,210,160,70,6,70,180,210,6,100,70,210,6,76,210,100,6,140,210,80,6,90,130,110,6,160,160,220],[255]),r=t.length/3,n={position:X(3,r),texcoord:X(2,r),normal:X(3,r),color:X(4,r,Uint8Array),indices:X(3,r/3,Uint16Array)};n.position.push(t),n.texcoord.push([.22,.19,.22,.79,.34,.19,.22,.79,.34,.79,.34,.19,.34,.19,.34,.31,.62,.19,.34,.31,.62,.31,.62,.19,.34,.43,.34,.55,.49,.43,.34,.55,.49,.55,.49,.43,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,1,1,1,0,0,1,1,1,0]),n.normal.push(e),n.color.push(i);for(let t=0;t<r;++t)n.indices.push(t);return n}function ht(t,e,i,r,a,o,l){if(a<=0)throw new Error("subdivisionDown must be > 0");const h=(l=l||1)-(o=o||0),u=2*(a+1)*4,c=X(3,u),d=X(3,u),f=X(2,u);function g(t,e,i){return t+(e-t)*i}function p(e,i,l,u,p,m){for(let b=0;b<=a;b++){const y=i/1,F=b/a,v=2*(y-.5),S=(o+F*h)*Math.PI,C=Math.sin(S),T=Math.cos(S),x=g(t,e,C),_=v*r,A=T*t,w=C*x;c.push(_,A,w);const E=n(s([0,C,T],l),u);d.push(E),f.push(y*p+m,F)}}for(let t=0;t<2;t++){const r=2*(t/1-.5);p(e,t,[1,1,1],[0,0,0],1,0),p(e,t,[0,0,0],[r,0,0],0,0),p(i,t,[1,1,1],[0,0,0],1,0),p(i,t,[0,0,0],[r,0,0],0,1)}const m=X(3,2*a*4,Uint16Array);function b(t,e){for(let i=0;i<a;++i)m.push(t+i+0,t+i+1,e+i+0),m.push(t+i+1,e+i+1,e+i+0)}const y=a+1;return b(0*y,4*y),b(5*y,7*y),b(6*y,2*y),b(3*y,1*y),{position:c,normal:d,texcoord:f,indices:m}}function ut(t,e,i,r,n,s){return at(t,t,e,i,r,n,s)}function ct(t,e,i,r,n,s){if(i<3)throw new Error("radialSubdivisions must be 3 or greater");if(r<3)throw new Error("verticalSubdivisions must be 3 or greater");n=n||0;const a=(s=s||2*Math.PI)-n,o=i+1,l=r+1,h=o*l,u=X(3,h),c=X(3,h),d=X(2,h),f=X(3,i*r*2,Uint16Array);for(let s=0;s<l;++s){const l=s/r,h=l*Math.PI*2,f=Math.sin(h),g=t+f*e,p=Math.cos(h),m=p*e;for(let t=0;t<o;++t){const e=t/i,r=n+e*a,s=Math.sin(r),o=Math.cos(r),h=s*g,b=o*g,y=s*f,F=o*f;u.push(h,m,b),c.push(y,p,F),d.push(e,1-l)}}for(let t=0;t<r;++t)for(let e=0;e<i;++e){const i=1+e,r=1+t;f.push(o*t+e,o*r+e,o*t+i),f.push(o*r+e,o*r+i,o*t+i)}return{position:u,normal:c,texcoord:d,indices:f}}function dt(t,e,i,r,n){if(e<3)throw new Error("divisions must be at least 3");n=n||1,r=r||0;const s=(e+1)*((i=i||1)+1),a=X(3,s),o=X(3,s),l=X(2,s),h=X(3,i*e*2,Uint16Array);let u=0;const c=t-r,d=e+1;for(let t=0;t<=i;++t){const s=r+c*Math.pow(t/i,n);for(let r=0;r<=e;++r){const n=2*Math.PI*r/e,c=s*Math.cos(n),f=s*Math.sin(n);if(a.push(c,0,f),o.push(0,1,0),l.push(1-r/e,t/i),t>0&&r!==e){const t=u+(r+1),e=u+r,i=u+r-d,n=u+(r+1)-d;h.push(t,e,i),h.push(t,i,n)}}u+=e+1}return{position:a,normal:o,texcoord:l,indices:h}}function ft(t){return function(e){return V(e,t.apply(this,Array.prototype.slice.call(arguments,1)))}}function gt(t){return function(e){return N(e,t.apply(null,Array.prototype.slice.call(arguments,1)))}}gt(lt),ft(lt),gt(st),ft(st),gt(it),ft(it),gt(rt),ft(rt),gt(at),ft(at),gt(et),ft(et),gt(ht),ft(ht),gt(ut),ft(ut),gt(ct),ft(ct),gt(dt),ft(dt);function pt(t){return!!t.texStorage2D}const mt=function(){const t={},e={};return function(i,r){return function(i){const r=i.constructor.name;if(!t[r]){for(const t in i)if("number"==typeof i[t]){const r=e[i[t]];e[i[t]]=r?`${r} | ${t}`:t}t[r]=!0}}(i),e[r]||("number"==typeof r?`0x${r.toString(16)}`:r)}}();new Uint8Array([128,192,255,255]),function(){let t}();const bt=6407,yt=33319,Ft=6403,vt={};{const t=vt;t[6406]={numColorComponents:1},t[6409]={numColorComponents:1},t[6410]={numColorComponents:2},t[bt]={numColorComponents:3},t[6408]={numColorComponents:4},t[Ft]={numColorComponents:1},t[36244]={numColorComponents:1},t[yt]={numColorComponents:2},t[33320]={numColorComponents:2},t[bt]={numColorComponents:3},t[36248]={numColorComponents:3},t[6408]={numColorComponents:4},t[36249]={numColorComponents:4},t[6402]={numColorComponents:1},t[34041]={numColorComponents:2}}const St=T;function Ct(t){return"undefined"!=typeof document&&document.getElementById?document.getElementById(t):null}const Tt=33984,xt=34962,_t=5126,At=5124,wt=5125,Et=3553,Mt=34067,Dt=32879,Bt=35866,kt={};function Pt(t,e){return kt[e].bindPoint}function Rt(t,e){return function(i){t.uniform1i(e,i)}}function Lt(t,e){return function(i){t.uniform1iv(e,i)}}function It(t,e){return function(i){t.uniform2iv(e,i)}}function Ut(t,e){return function(i){t.uniform3iv(e,i)}}function Ot(t,e){return function(i){t.uniform4iv(e,i)}}function Wt(t,e,i,r){const n=Pt(0,e);return pt(t)?function(e){let s,a;!e||A(0,e)?(s=e,a=null):(s=e.texture,a=e.sampler),t.uniform1i(r,i),t.activeTexture(Tt+i),t.bindTexture(n,s),t.bindSampler(i,a)}:function(e){t.uniform1i(r,i),t.activeTexture(Tt+i),t.bindTexture(n,e)}}function Ht(t,e,i,r,n){const s=Pt(0,e),a=new Int32Array(n);for(let t=0;t<n;++t)a[t]=i+t;return pt(t)?function(e){t.uniform1iv(r,a),e.forEach(function(e,r){let n,o;t.activeTexture(Tt+a[r]),!e||A(0,e)?(n=e,o=null):(n=e.texture,o=e.sampler),t.bindSampler(i,o),t.bindTexture(s,n)})}:function(e){t.uniform1iv(r,a),e.forEach(function(e,i){t.activeTexture(Tt+a[i]),t.bindTexture(s,e)})}}function Gt(t,e){return function(i){if(i.value)switch(t.disableVertexAttribArray(e),i.value.length){case 4:t.vertexAttrib4fv(e,i.value);break;case 3:t.vertexAttrib3fv(e,i.value);break;case 2:t.vertexAttrib2fv(e,i.value);break;case 1:t.vertexAttrib1fv(e,i.value);break;default:throw new Error("the length of a float constant value must be between 1 and 4!")}else t.bindBuffer(xt,i.buffer),t.enableVertexAttribArray(e),t.vertexAttribPointer(e,i.numComponents||i.size,i.type||_t,i.normalize||!1,i.stride||0,i.offset||0),t.vertexAttribDivisor&&t.vertexAttribDivisor(e,i.divisor||0)}}function jt(t,e){return function(i){if(i.value){if(t.disableVertexAttribArray(e),4!==i.value.length)throw new Error("The length of an integer constant value must be 4!");t.vertexAttrib4iv(e,i.value)}else t.bindBuffer(xt,i.buffer),t.enableVertexAttribArray(e),t.vertexAttribIPointer(e,i.numComponents||i.size,i.type||At,i.stride||0,i.offset||0),t.vertexAttribDivisor&&t.vertexAttribDivisor(e,i.divisor||0)}}function Nt(t,e){return function(i){if(i.value){if(t.disableVertexAttribArray(e),4!==i.value.length)throw new Error("The length of an unsigned integer constant value must be 4!");t.vertexAttrib4uiv(e,i.value)}else t.bindBuffer(xt,i.buffer),t.enableVertexAttribArray(e),t.vertexAttribIPointer(e,i.numComponents||i.size,i.type||wt,i.stride||0,i.offset||0),t.vertexAttribDivisor&&t.vertexAttribDivisor(e,i.divisor||0)}}function zt(t,e,i){const r=i.size,n=i.count;return function(i){t.bindBuffer(xt,i.buffer);const s=i.size||i.numComponents||r,a=s/n,o=i.type||_t,l=kt[o].size*s,h=i.normalize||!1,u=i.offset||0,c=l/n;for(let r=0;r<n;++r)t.enableVertexAttribArray(e+r),t.vertexAttribPointer(e+r,a,o,h,l,u+c*r),t.vertexAttribDivisor&&t.vertexAttribDivisor(e+r,i.divisor||0)}}kt[5126]={Type:Float32Array,size:4,setter:function(t,e){return function(i){t.uniform1f(e,i)}},arraySetter:function(t,e){return function(i){t.uniform1fv(e,i)}}},kt[35664]={Type:Float32Array,size:8,setter:function(t,e){return function(i){t.uniform2fv(e,i)}},cols:2},kt[35665]={Type:Float32Array,size:12,setter:function(t,e){return function(i){t.uniform3fv(e,i)}},cols:3},kt[35666]={Type:Float32Array,size:16,setter:function(t,e){return function(i){t.uniform4fv(e,i)}},cols:4},kt[At]={Type:Int32Array,size:4,setter:Rt,arraySetter:Lt},kt[35667]={Type:Int32Array,size:8,setter:It,cols:2},kt[35668]={Type:Int32Array,size:12,setter:Ut,cols:3},kt[35669]={Type:Int32Array,size:16,setter:Ot,cols:4},kt[5125]={Type:Uint32Array,size:4,setter:function(t,e){return function(i){t.uniform1ui(e,i)}},arraySetter:function(t,e){return function(i){t.uniform1uiv(e,i)}}},kt[36294]={Type:Uint32Array,size:8,setter:function(t,e){return function(i){t.uniform2uiv(e,i)}},cols:2},kt[36295]={Type:Uint32Array,size:12,setter:function(t,e){return function(i){t.uniform3uiv(e,i)}},cols:3},kt[36296]={Type:Uint32Array,size:16,setter:function(t,e){return function(i){t.uniform4uiv(e,i)}},cols:4},kt[35670]={Type:Uint32Array,size:4,setter:Rt,arraySetter:Lt},kt[35671]={Type:Uint32Array,size:8,setter:It,cols:2},kt[35672]={Type:Uint32Array,size:12,setter:Ut,cols:3},kt[35673]={Type:Uint32Array,size:16,setter:Ot,cols:4},kt[35674]={Type:Float32Array,size:32,setter:function(t,e){return function(i){t.uniformMatrix2fv(e,!1,i)}},rows:2,cols:2},kt[35675]={Type:Float32Array,size:48,setter:function(t,e){return function(i){t.uniformMatrix3fv(e,!1,i)}},rows:3,cols:3},kt[35676]={Type:Float32Array,size:64,setter:function(t,e){return function(i){t.uniformMatrix4fv(e,!1,i)}},rows:4,cols:4},kt[35685]={Type:Float32Array,size:32,setter:function(t,e){return function(i){t.uniformMatrix2x3fv(e,!1,i)}},rows:2,cols:3},kt[35686]={Type:Float32Array,size:32,setter:function(t,e){return function(i){t.uniformMatrix2x4fv(e,!1,i)}},rows:2,cols:4},kt[35687]={Type:Float32Array,size:48,setter:function(t,e){return function(i){t.uniformMatrix3x2fv(e,!1,i)}},rows:3,cols:2},kt[35688]={Type:Float32Array,size:48,setter:function(t,e){return function(i){t.uniformMatrix3x4fv(e,!1,i)}},rows:3,cols:4},kt[35689]={Type:Float32Array,size:64,setter:function(t,e){return function(i){t.uniformMatrix4x2fv(e,!1,i)}},rows:4,cols:2},kt[35690]={Type:Float32Array,size:64,setter:function(t,e){return function(i){t.uniformMatrix4x3fv(e,!1,i)}},rows:4,cols:3},kt[35678]={Type:null,size:0,setter:Wt,arraySetter:Ht,bindPoint:Et},kt[35680]={Type:null,size:0,setter:Wt,arraySetter:Ht,bindPoint:Mt},kt[35679]={Type:null,size:0,setter:Wt,arraySetter:Ht,bindPoint:Dt},kt[35682]={Type:null,size:0,setter:Wt,arraySetter:Ht,bindPoint:Et},kt[36289]={Type:null,size:0,setter:Wt,arraySetter:Ht,bindPoint:Bt},kt[36292]={Type:null,size:0,setter:Wt,arraySetter:Ht,bindPoint:Bt},kt[36293]={Type:null,size:0,setter:Wt,arraySetter:Ht,bindPoint:Mt},kt[36298]={Type:null,size:0,setter:Wt,arraySetter:Ht,bindPoint:Et},kt[36299]={Type:null,size:0,setter:Wt,arraySetter:Ht,bindPoint:Dt},kt[36300]={Type:null,size:0,setter:Wt,arraySetter:Ht,bindPoint:Mt},kt[36303]={Type:null,size:0,setter:Wt,arraySetter:Ht,bindPoint:Bt},kt[36306]={Type:null,size:0,setter:Wt,arraySetter:Ht,bindPoint:Et},kt[36307]={Type:null,size:0,setter:Wt,arraySetter:Ht,bindPoint:Dt},kt[36308]={Type:null,size:0,setter:Wt,arraySetter:Ht,bindPoint:Mt},kt[36311]={Type:null,size:0,setter:Wt,arraySetter:Ht,bindPoint:Bt};const Vt={};Vt[5126]={size:4,setter:Gt},Vt[35664]={size:8,setter:Gt},Vt[35665]={size:12,setter:Gt},Vt[35666]={size:16,setter:Gt},Vt[At]={size:4,setter:jt},Vt[35667]={size:8,setter:jt},Vt[35668]={size:12,setter:jt},Vt[35669]={size:16,setter:jt},Vt[5125]={size:4,setter:Nt},Vt[36294]={size:8,setter:Nt},Vt[36295]={size:12,setter:Nt},Vt[36296]={size:16,setter:Nt},Vt[35670]={size:4,setter:jt},Vt[35671]={size:8,setter:jt},Vt[35672]={size:12,setter:jt},Vt[35673]={size:16,setter:jt},Vt[35674]={size:4,setter:zt,count:2},Vt[35675]={size:9,setter:zt,count:3},Vt[35676]={size:16,setter:zt,count:4};const qt=/ERROR:\s*\d+:(\d+)/gi;const Xt=/^[ \t]*\n/;function Jt(t){let e=0;return Xt.test(t)&&(e=1,t=t.replace(Xt,"")),{lineOffset:e,shaderSource:t}}function Yt(t,e){return t.errorCallback(e),t.callback&&setTimeout(()=>{t.callback(`${e}\n${t.errors.join("\n")}`)}),null}function $t(t,e,i,r){r=r||St;if(!t.getShaderParameter(i,35713)){const n=t.getShaderInfoLog(i),{lineOffset:s,shaderSource:a}=Jt(t.getShaderSource(i)),o=`${function(t,e="",i=0){const r=[...e.matchAll(qt)],n=new Map(r.map((t,i)=>{const n=parseInt(t[1]),s=r[i+1],a=s?s.index:e.length;return[n-1,e.substring(t.index,a)]}));return t.split("\n").map((t,e)=>{const r=n.get(e);return`${e+1+i}: ${t}${r?`\n\n^^^ ${r}`:""}`}).join("\n")}(a,n,s)}\nError compiling ${mt(t,e)}: ${n}`;return r(o),o}return""}function Kt(t,e,i){let r,n,s;if("function"==typeof e&&(i=e,e=void 0),"function"==typeof t)i=t,t=void 0;else if(t&&!Array.isArray(t)){const e=t;i=e.errorCallback,t=e.attribLocations,r=e.transformFeedbackVaryings,n=e.transformFeedbackMode,s=e.callback}const a=i||St,o=[],l={errorCallback(t,...e){o.push(t),a(t,...e)},transformFeedbackVaryings:r,transformFeedbackMode:n,callback:s,errors:o};{let i={};Array.isArray(t)?t.forEach(function(t,r){i[t]=e?e[r]:r}):i=t||{},l.attribLocations=i}return l}const Zt=["VERTEX_SHADER","FRAGMENT_SHADER"];function Qt(t,e){return e.indexOf("frag")>=0?35632:e.indexOf("vert")>=0?35633:void 0}const te=(t=0)=>new Promise(e=>setTimeout(e,t));function ee(t,e,i){const r=t.createProgram(),{attribLocations:n,transformFeedbackVaryings:s,transformFeedbackMode:a}=Kt(i);for(let i=0;i<e.length;++i){let n=e[i];if("string"==typeof n){const e=Ct(n),s=e?e.text:n;let a=t[Zt[i]];e&&e.type&&(a=Qt(0,e.type)||a),n=t.createShader(a),t.shaderSource(n,Jt(s).shaderSource),t.compileShader(n),t.attachShader(r,n)}}Object.entries(n).forEach(([e,i])=>t.bindAttribLocation(r,i,e));{let e=s;e&&(e.attribs&&(e=e.attribs),Array.isArray(e)||(e=Object.keys(e)),t.transformFeedbackVaryings(r,e,a||35981))}return t.linkProgram(r),r}function ie(t,e,i,r,n){const s=Kt(i,r,n),a=new Set(e),o=ee(t,e,s);function l(t,e){const i=se(t,e,s.errorCallback);return i&&function(t,e,i){const r=t.getAttachedShaders(e);for(const e of r)i.has(e)&&t.deleteShader(e);t.deleteProgram(e)}(t,e,a),i}if(!s.callback)return l(t,o)?void 0:o;ne(t,o).then(()=>{const e=l(t,o);s.callback(e,e?void 0:o)})}function re(t){return function(e,i,...r){return new Promise((n,s)=>{const a=Kt(...r);a.callback=(t,e)=>{t?s(t):n(e)},t(e,i,a)})}}re(ie),re(Fe);async function ne(t,e){const i=t.getExtension("KHR_parallel_shader_compile"),r=i?(t,e)=>t.getProgramParameter(e,i.COMPLETION_STATUS_KHR):()=>!0;let n=0;do{await te(n),n=1e3/60}while(!r(t,e))}function se(t,e,i){i=i||St;if(!t.getProgramParameter(e,35714)){const r=t.getProgramInfoLog(e);i(`Error in program linking: ${r}`);return`${r}\n${t.getAttachedShaders(e).map(e=>$t(t,t.getShaderParameter(e,t.SHADER_TYPE),e,i)).filter(t=>t).join("\n")}`}}function ae(t,e,i,r,n){return ie(t,e,i,r,n)}function oe(t){const e=t.name;return e.startsWith("gl_")||e.startsWith("webgl_")}const le=/(\.|\[|]|\w+)/g,he=t=>t>="0"&&t<="9";function ue(t,e,i,r){const n=t.split(le).filter(t=>""!==t);let s=0,a="";for(;;){const t=n[s++];a+=t;const o=he(t[0]),l=o?parseInt(t):t;o&&(a+=n[s++]);if(s===n.length){i[l]=e;break}{const t=n[s++],e="["===t,o=i[l]||(e?[]:{});i[l]=o,i=o,r[a]=r[a]||function(t){return function(e){ge(t,e)}}(o),a+=t}}}function ce(t,e){let i=0;function r(e,r,n){const s=r.name.endsWith("[0]"),a=r.type,o=kt[a];if(!o)throw new Error(`unknown type: 0x${a.toString(16)}`);let l;if(o.bindPoint){const e=i;i+=r.size,l=s?o.arraySetter(t,a,e,n,r.size):o.setter(t,a,e,n,r.size)}else l=o.arraySetter&&s?o.arraySetter(t,n):o.setter(t,n);return l.location=n,l}const n={},s={},a=t.getProgramParameter(e,35718);for(let i=0;i<a;++i){const a=t.getActiveUniform(e,i);if(oe(a))continue;let o=a.name;o.endsWith("[0]")&&(o=o.substr(0,o.length-3));const l=t.getUniformLocation(e,a.name);if(l){const t=r(0,a,l);n[o]=t,ue(o,t,s,n)}}return n}function de(t,e){const i={},r=t.getProgramParameter(e,35971);for(let n=0;n<r;++n){const r=t.getTransformFeedbackVarying(e,n);i[r.name]={index:n,type:r.type,size:r.size}}return i}function fe(t,e){const i=t.getProgramParameter(e,35718),r=[],n=[];for(let s=0;s<i;++s){n.push(s),r.push({});const i=t.getActiveUniform(e,s);r[s].name=i.name}[["UNIFORM_TYPE","type"],["UNIFORM_SIZE","size"],["UNIFORM_BLOCK_INDEX","blockNdx"],["UNIFORM_OFFSET","offset"]].forEach(function(i){const s=i[0],a=i[1];t.getActiveUniforms(e,n,t[s]).forEach(function(t,e){r[e][a]=t})});const s={},a=t.getProgramParameter(e,35382);for(let i=0;i<a;++i){const r=t.getActiveUniformBlockName(e,i),n={index:t.getUniformBlockIndex(e,r),usedByVertexShader:t.getActiveUniformBlockParameter(e,i,35396),usedByFragmentShader:t.getActiveUniformBlockParameter(e,i,35398),size:t.getActiveUniformBlockParameter(e,i,35392),uniformIndices:t.getActiveUniformBlockParameter(e,i,35395)};n.used=n.usedByVertexShader||n.usedByFragmentShader,s[r]=n}return{blockSpecs:s,uniformData:r}}function ge(t,e){for(const i in e){const r=t[i];"function"==typeof r?r(e[i]):ge(t[i],e[i])}}function pe(t,...e){const i=t.uniformSetters||t,r=e.length;for(let t=0;t<r;++t){const r=e[t];if(Array.isArray(r)){const t=r.length;for(let e=0;e<t;++e)pe(i,r[e])}else for(const t in r){const e=i[t];e&&e(r[t])}}}function me(t,e){const i={},r=t.getProgramParameter(e,35721);for(let n=0;n<r;++n){const r=t.getActiveAttrib(e,n);if(oe(r))continue;const s=t.getAttribLocation(e,r.name),a=Vt[r.type],o=a.setter(t,s,a);o.location=s,i[r.name]=o}return i}function be(t,e){const i={program:e,uniformSetters:ce(t,e),attribSetters:me(t,e)};return pt(t)&&(i.uniformBlockSpec=fe(t,e),i.transformFeedbackInfo=de(t,e)),i}const ye=/\s|{|}|;/;function Fe(t,e,i,r,n){const s=Kt(i,r,n),a=[];if(e=e.map(function(t){if(!ye.test(t)){const e=Ct(t);if(e)t=e.text;else{const e=`no element with id: ${t}`;s.errorCallback(e),a.push(e)}}return t}),a.length)return Yt(s,"");const o=s.callback;o&&(s.callback=(e,i)=>{o(e,e?void 0:be(t,i))});const l=ae(t,e,s);return l?be(t,l):null}function ve(t,e,i,r,n){for(const[s,a]of Object.entries(e)){const o={...n},l=i[s];Array.isArray(l)||Object.assign(o,l);const h=se(t,a,o.errorCallback);if(h){for(const i of Object.values(e)){const e=t.getAttachedShaders(i);t.deleteProgram(i);for(const i of e)r.has(i)||t.deleteShader(i)}return h}}}function Se(t,e,i={}){const r=new Set,n=Object.fromEntries(Object.entries(e).map(([e,n])=>{const s={...i},a=Array.isArray(n)?n:n.shaders;return Array.isArray(n)||Object.assign(s,n),a.forEach(r.add,r),[e,ee(t,a,s)]}));if(i.callback)return void async function(t,e){for(const i of Object.values(e))await ne(t,i)}(t,n).then(()=>{const s=ve(t,n,e,r,i);i.callback(s,s?void 0:n)});return ve(t,n,e,r,i)?void 0:n}function Ce(t,e,i){function r(t,e){return Object.fromEntries(Object.entries(e).map(([e,i])=>[e,be(t,i)]))}const n=(i=Kt(i)).callback;n&&(i.callback=(e,i)=>{n(e,e?void 0:r(t,i))});const s=Se(t,e,i);if(!n&&s)return r(t,s)}re(Se),re(Ce);const Te=36096,xe=33306,_e={};_e[34041]=xe,_e[6401]=36128,_e[36168]=36128,_e[6402]=Te,_e[33189]=Te,_e[33190]=Te,_e[36012]=Te,_e[35056]=xe,_e[36013]=xe;const Ae={};Ae[32854]=!0,Ae[32855]=!0,Ae[36194]=!0,Ae[34041]=!0,Ae[33189]=!0,Ae[6401]=!0,Ae[36168]=!0;var we={};const Ee={position:3,normal:3,tangent:3,texcoord:2,texcoord0:2,texcoord1:2,texcoord2:2};var Me={};class De{constructor(){this.attribs={}}disableAll(){for(let t in this.attribs)this.gl.disableVertexAttribArray(this.attribs[t]);this.attribs={}}enable(t,e){this.gl=t;var i={};for(let n in e){var r=e[n];void 0!==r.loc&&(void 0===this.attribs[r.loc]&&t.enableVertexAttribArray(r.loc),t.vertexAttribPointer(r.loc,r.size,r.type,!1,r.stride,r.offset),i[r.loc]=r.loc,this.attribs[n]=null)}for(let t in this.attribs);this.attribs=i}}class Be{static CreateProgramAttributes(t,e){var i={},r=0;for(let a in e){var n=e[a],s=Ee[a];i[n]={type:t.FLOAT,size:s,offset:4*r},r+=s}for(let t in i)i[t].stride=4*r;return i}CleanUpPrograms(){Me={}}ReleaseProgram(t){}static _GetProgram(t){return Me[t]}static RegisterProgram(t,e){if(!Me[t]){var i=e.shaders;Me[t]={shaders:[i[0],i[1]],attributes:e.attributes}}return Me[t]}static GetProgram(t,e,i,r){var n=Me[e],s="";for(var a in i)s+=a+":"+i[a]+"-";if(!n){var o=e.split("."),l=we[o[0]][o[1]];l&&(n=Be.RegisterProgram(e,l))}if(!n)throw"Program not registered: "+o;n.programInfo||(n.programInfo={}),n.programInfo[s]=Be.CompileProgram(t,n.shaders,i),r=r||n.attributes&&Be.CreateProgramAttributes(t,n.attributes);var h=n.programInfo[s];if(r)for(var a in r){var u=h.attribSetters[a];u&&(r[a]=r[a]||{},r[a].loc=u.location)}return h.attributes=r,h}static CompileProgram(t,e,i,r){var n="";for(var s in i){var a=i[s];n="#define "+s+" "+(null===a?"":a)+"\n"}var o={};const l=Fe(t,[n+e[0],n+e[1]],null,null);if(r)for(var s in r){var h=l.attribSetters[s];h&&(r[s]=r[s]||{},r[s].loc=h.location)}for(var s in l.uniformSetters)o[s]=l.uniformSetters[s].location;return l.uniforms=o,l}}var ke=new Be,Pe=1e-6,Re="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;Math.PI;function Le(){var t=new Re(3);return Re!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Ie(t){var e=t[0],i=t[1],r=t[2];return Math.hypot(e,i,r)}function Ue(t,e,i){var r=new Re(3);return r[0]=t,r[1]=e,r[2]=i,r}function Oe(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function We(t,e,i,r){return t[0]=e,t[1]=i,t[2]=r,t}function He(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}function Ge(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t}function je(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t}function Ne(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t[2]=Math.min(e[2],i[2]),t}function ze(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t[2]=Math.max(e[2],i[2]),t}function Ve(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function qe(t,e,i,r){return t[0]=e[0]+i[0]*r,t[1]=e[1]+i[1]*r,t[2]=e[2]+i[2]*r,t}function Xe(t){var e=t[0],i=t[1],r=t[2];return e*e+i*i+r*r}function Je(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function Ye(t,e){var i=e[0],r=e[1],n=e[2],s=i*i+r*r+n*n;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t}function $e(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Ke(t,e,i){var r=e[0],n=e[1],s=e[2],a=i[0],o=i[1],l=i[2];return t[0]=n*l-s*o,t[1]=s*a-r*l,t[2]=r*o-n*a,t}function Ze(t,e,i,r){var n=e[0],s=e[1],a=e[2];return t[0]=n+r*(i[0]-n),t[1]=s+r*(i[1]-s),t[2]=a+r*(i[2]-a),t}function Qe(t,e,i){var r=e[0],n=e[1],s=e[2],a=i[3]*r+i[7]*n+i[11]*s+i[15];return a=a||1,t[0]=(i[0]*r+i[4]*n+i[8]*s+i[12])/a,t[1]=(i[1]*r+i[5]*n+i[9]*s+i[13])/a,t[2]=(i[2]*r+i[6]*n+i[10]*s+i[14])/a,t}function ti(t,e,i){var r=e[0],n=e[1],s=e[2];return t[0]=r*i[0]+n*i[3]+s*i[6],t[1]=r*i[1]+n*i[4]+s*i[7],t[2]=r*i[2]+n*i[5]+s*i[8],t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var ei,ii=Ge,ri=Ie;ei=Le();function ni(){var t=new Re(16);return Re!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function si(t,e){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],t}function ai(t,e,i,r,n,s,a,o,l,h,u,c,d,f,g,p){var m=new Re(16);return m[0]=t,m[1]=e,m[2]=i,m[3]=r,m[4]=n,m[5]=s,m[6]=a,m[7]=o,m[8]=l,m[9]=h,m[10]=u,m[11]=c,m[12]=d,m[13]=f,m[14]=g,m[15]=p,m}function oi(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function li(t,e){if(t===e){var i=e[1],r=e[2],n=e[3],s=e[6],a=e[7],o=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=i,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=s,t[11]=e[14],t[12]=n,t[13]=a,t[14]=o}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function hi(t,e){var i=e[0],r=e[1],n=e[2],s=e[3],a=e[4],o=e[5],l=e[6],h=e[7],u=e[8],c=e[9],d=e[10],f=e[11],g=e[12],p=e[13],m=e[14],b=e[15],y=i*o-r*a,F=i*l-n*a,v=i*h-s*a,S=r*l-n*o,C=r*h-s*o,T=n*h-s*l,x=u*p-c*g,_=u*m-d*g,A=u*b-f*g,w=c*m-d*p,E=c*b-f*p,M=d*b-f*m,D=y*M-F*E+v*w+S*A-C*_+T*x;return D?(D=1/D,t[0]=(o*M-l*E+h*w)*D,t[1]=(n*E-r*M-s*w)*D,t[2]=(p*T-m*C+b*S)*D,t[3]=(d*C-c*T-f*S)*D,t[4]=(l*A-a*M-h*_)*D,t[5]=(i*M-n*A+s*_)*D,t[6]=(m*v-g*T-b*F)*D,t[7]=(u*T-d*v+f*F)*D,t[8]=(a*E-o*A+h*x)*D,t[9]=(r*A-i*E-s*x)*D,t[10]=(g*C-p*v+b*y)*D,t[11]=(c*v-u*C-f*y)*D,t[12]=(o*_-a*w-l*x)*D,t[13]=(i*w-r*_+n*x)*D,t[14]=(p*F-g*S-m*y)*D,t[15]=(u*S-c*F+d*y)*D,t):null}function ui(t,e,i){var r=e[0],n=e[1],s=e[2],a=e[3],o=e[4],l=e[5],h=e[6],u=e[7],c=e[8],d=e[9],f=e[10],g=e[11],p=e[12],m=e[13],b=e[14],y=e[15],F=i[0],v=i[1],S=i[2],C=i[3];return t[0]=F*r+v*o+S*c+C*p,t[1]=F*n+v*l+S*d+C*m,t[2]=F*s+v*h+S*f+C*b,t[3]=F*a+v*u+S*g+C*y,F=i[4],v=i[5],S=i[6],C=i[7],t[4]=F*r+v*o+S*c+C*p,t[5]=F*n+v*l+S*d+C*m,t[6]=F*s+v*h+S*f+C*b,t[7]=F*a+v*u+S*g+C*y,F=i[8],v=i[9],S=i[10],C=i[11],t[8]=F*r+v*o+S*c+C*p,t[9]=F*n+v*l+S*d+C*m,t[10]=F*s+v*h+S*f+C*b,t[11]=F*a+v*u+S*g+C*y,F=i[12],v=i[13],S=i[14],C=i[15],t[12]=F*r+v*o+S*c+C*p,t[13]=F*n+v*l+S*d+C*m,t[14]=F*s+v*h+S*f+C*b,t[15]=F*a+v*u+S*g+C*y,t}function ci(t,e,i){var r,n,s,a,o,l,h,u,c,d,f,g,p=i[0],m=i[1],b=i[2];return e===t?(t[12]=e[0]*p+e[4]*m+e[8]*b+e[12],t[13]=e[1]*p+e[5]*m+e[9]*b+e[13],t[14]=e[2]*p+e[6]*m+e[10]*b+e[14],t[15]=e[3]*p+e[7]*m+e[11]*b+e[15]):(r=e[0],n=e[1],s=e[2],a=e[3],o=e[4],l=e[5],h=e[6],u=e[7],c=e[8],d=e[9],f=e[10],g=e[11],t[0]=r,t[1]=n,t[2]=s,t[3]=a,t[4]=o,t[5]=l,t[6]=h,t[7]=u,t[8]=c,t[9]=d,t[10]=f,t[11]=g,t[12]=r*p+o*m+c*b+e[12],t[13]=n*p+l*m+d*b+e[13],t[14]=s*p+h*m+f*b+e[14],t[15]=a*p+u*m+g*b+e[15]),t}function di(t,e,i){var r=i[0],n=i[1],s=i[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function fi(t,e,i){var r=Math.sin(i),n=Math.cos(i),s=e[4],a=e[5],o=e[6],l=e[7],h=e[8],u=e[9],c=e[10],d=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*n+h*r,t[5]=a*n+u*r,t[6]=o*n+c*r,t[7]=l*n+d*r,t[8]=h*n-s*r,t[9]=u*n-a*r,t[10]=c*n-o*r,t[11]=d*n-l*r,t}function gi(t,e,i){var r=Math.sin(i),n=Math.cos(i),s=e[0],a=e[1],o=e[2],l=e[3],h=e[4],u=e[5],c=e[6],d=e[7];return e!==t&&(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]),t[0]=s*n+h*r,t[1]=a*n+u*r,t[2]=o*n+c*r,t[3]=l*n+d*r,t[4]=h*n-s*r,t[5]=u*n-a*r,t[6]=c*n-o*r,t[7]=d*n-l*r,t}function pi(t,e,i){var r=e[0],n=e[1],s=e[2],a=e[3],o=r+r,l=n+n,h=s+s,u=r*o,c=r*l,d=r*h,f=n*l,g=n*h,p=s*h,m=a*o,b=a*l,y=a*h;return t[0]=1-(f+p),t[1]=c+y,t[2]=d-b,t[3]=0,t[4]=c-y,t[5]=1-(u+p),t[6]=g+m,t[7]=0,t[8]=d+b,t[9]=g-m,t[10]=1-(u+f),t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t}function mi(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function bi(t,e){var i=e[0],r=e[1],n=e[2],s=e[4],a=e[5],o=e[6],l=e[8],h=e[9],u=e[10];return t[0]=Math.hypot(i,r,n),t[1]=Math.hypot(s,a,o),t[2]=Math.hypot(l,h,u),t}var yi=function(t,e,i,r,n){var s,a=1/Math.tan(e/2);return t[0]=a/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=n&&n!==1/0?(s=1/(r-n),t[10]=(n+r)*s,t[14]=2*n*r*s):(t[10]=-1,t[14]=-2*r),t};var Fi=ui;const vi={2:"Wowhead",3:"LolKing",6:"HeroKing",7:"DestinyDB"};class Si{constructor(t){if(!t.type||!vi[t.type])throw"Viewer error: Bad viewer type given";if(!t.container)throw"Viewer error: Bad container given";if(!t.aspect)throw"Viewer error: Bad aspect ratio given";if(!t.contentPath)throw"Viewer error: No content path given";this.type=t.type,this.container=t.container,this.aspect=parseFloat(t.aspect),this.renderer=null,this.options=t;const e=this.container.width(),i=Math.round(e/this.aspect);this.init(e,i)}destroy(){this.renderer&&this.renderer.destroy(),this.options=null,this.container=null}init(t,e){if(void 0!==typeof window.Uint8Array&&void 0!==typeof window.DataView)try{const t=document.createElement("canvas");if(!(t.getContext("webgl",{alpha:!1})||t.getContext("experimental-webgl",{alpha:!1})))return void console.log("viewer init failed")}catch(t){return void console.log("viewer init failed")}this.mode=1,this.renderer=new Da(this),this.renderer.resize(t,e),this.renderer.init()}setAdaptiveMode(t){this.renderer.setAdaptiveMode(t)}setZoom(t){this.renderer.zoom.target=t}setOffset(t,e){this.renderer.setTranslation(t,e,0)}setFullscreen(t){t?Si.requestFullscreen(this.renderer.canvas[0]):Si.exitFullscreen()}method(t,e){return void 0===e&&(e=[]),this.renderer?this.renderer.method(t,[].concat(e)):null}option(t,e){return void 0!==e&&(this.options[t]=e),this.options[t]}static isFullscreen(){return!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)}static requestFullscreen(t){document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||(t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):t.mozRequestFullScreen?t.mozRequestFullScreen():t.msRequestFullscreen&&t.msRequestFullscreen())}static exitFullscreen(){(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)&&(document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen())}}const Ci=Si;const Ti=class{constructor(t,e,i){this.ba=t,this.f=e,this.g=i,this.e=!1,this.dc=t.createBuffer(),this.f=0}c(t){const e=this.ba;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.dc),!this.e||this.f<t.byteLength?(e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,this.g?e.DYNAMIC_DRAW:e.STATIC_DRAW),this.f=t.byteLength,this.e=!0):e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)}a(){return this.f}d(){const t=this.ba;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.dc)}b(){const t=this.ba;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}};const xi=class{constructor(t,e,i){this.f=t,this.ba=e,this.g=i,this.dc=!1,this.e=t.createBuffer(),this.ba=0}d(){const t=this.f;t.bindBuffer(t.ARRAY_BUFFER,this.e)}b(){const t=this.f;t.bindBuffer(t.ARRAY_BUFFER,null)}c(t){const e=this.f;e.bindBuffer(e.ARRAY_BUFFER,this.e),!this.dc||this.ba<t.byteLength?(e.bufferData(e.ARRAY_BUFFER,t,this.g?e.DYNAMIC_DRAW:e.STATIC_DRAW),this.dc=!0,this.ba=t.byteLength):e.bufferSubData(e.ARRAY_BUFFER,0,t),e.bindBuffer(e.ARRAY_BUFFER,null)}a(){return this.ba}};var _i;!function(t){t[t.GFLOAT=0]="GFLOAT",t[t.GUNSIGNED_BYTE=1]="GUNSIGNED_BYTE"}(_i||(_i={}));class Ai{constructor(t,e,i,r,n,s){this.b=t,this.c=e,this.a=i,this.f=r,this.e=n,this.d=s}}function wi(t,e){switch(e){case _i.GFLOAT:return t.FLOAT;case _i.GUNSIGNED_BYTE:return t.UNSIGNED_BYTE}}const Ei=class{constructor(t,e){this.ba=t,this.f=e,this.dc=null,this.e=[],this.dc=e.createVertexArrayOES()}a(t){this.ba;this.d(),t.d(),this.b(),this.e.push(t)}c(t,e){const i=this.ba;this.d(),t.d();for(const t of e)i.enableVertexAttribArray(t.b),i.vertexAttribPointer(t.b,t.c,wi(i,t.a),t.f,t.e,t.d);this.b(),this.e.push(t)}d(){this.f.bindVertexArrayOES(this.dc)}b(){this.f.bindVertexArrayOES(null)}};const Mi=class{constructor(t,e){this.ba=t,this.dc=e,this.f=[]}a(t){this.e=t}c(t,e){this.f.push({buffer:t,bindings:e})}d(){const t=this.ba;this.e.d();const e=this.dc.a();for(const e of this.f){e.b.d();for(const i of e.a)this.dc.e(i.b),t.vertexAttribPointer(i.b,i.c,wi(t,i.a),i.f,i.e,i.d)}this.dc.c(e)}b(){}};class Di{}class Bi{constructor(t,e,i,r=0){this.c=t,this.b=e,this.d=i,this.a=r}}class ki{constructor(t,e){this.b=t,this.a=e}}class Pi{constructor(t,e){this.a=t,this.b=e}}class Ri extends Di{}const Li=class extends Ri{constructor(t,e,i,r){super(),this.e=t,this.cba=e,this.d=i,this.ba=r}a(){return this.d.c}b(t){const e=this.d;t.d(this.cba),t.g(e.c),t.b(e.e),t.j(e.f),t.e(e.d),t.c(e.a),t.a(e.b),pe(this.cba.d(),this.ba)}};const Ii=class{constructor(t,e,i,r){if(this.ba=t,this.c=Fe(t,[i,r],Object.keys(e),null),!this.c)throw"Failed to create program"}a(){this.ba.useProgram(this.c.program)}d(){return this.c}};class Ui{static f(t){const e=32767&t;return e<Oi.length?Oi[e]:(WH.debug("Unknown shader effect:",e),["PS_Combiners_Opaque","VS_Diffuse_T1"])}static g(t,e){let i="";if(-1e3==t&&3==e)return"Skin";if(32768&t)return Ui.f(t)[0];if(1==e)i=112&t?"PS_Combiners_Mod":"PS_Combiners_Opaque";else{i=(112&t?"PS_Combiners_Mod":"PS_Combiners_Opaque")+"_"+(112&t?["Opaque","Mod","Mod","Add","Mod2x","Mod","Mod2xNA","AddNA"]:["Opaque","Mod","Mod","AddAlpha","Mod2x","Mod","Mod2xNA","AddAlpha"])[7&t]}return i}static h(t,e){let i="";if(-1e3==t&&3==e)i="T1_T1_T1";else{if(32768&t)return Ui.f(t)[1];i=1==e?128&t?"Env":16384&t?"T2":"T1":128&t?8&t?"Env_Env":"Env_T1":8&t?"T1_Env":16384&t?"T1_T2":"T1_T1"}return"VS_Diffuse_"+i}static d(t,e,i){const r=Ui.g(t,e),n=Ui.h(t,e),s="Wow."+n+"_"+r;if(Be._GetProgram(s))return{name:s};const a={shaders:[Ui.e(n,i),Ui.c(n,r)],attributes:{position:"aPosition",normal:"aNormal",texcoord0:"aTexCoord0",texcoord1:"aTexCoord1"}};return Be.RegisterProgram(s,a),{name:s}}static a(t){const e={},i={texcoord1:function(t,e){t.INPUT_TEXCOORD1="aTexCoord"+e}};for(let r in t.options){const n=t.options[r];i[r](e,n)}return{name:"Wow."+t.name,config:e}}static b(t){var e="";if(e+="lTexCoord1 = (uTextureMatrix1 * vec4(vTexCoord1, 0, 1)).st;\n",e+="lTexCoord2 = (uTextureMatrix2 * vec4(vTexCoord2, 0, 1)).st;\n","VS"===t.slice(0,2)){let i=(t=t.slice(3)).split("_"),r=i[0];if("Diffuse"===r||"Color"===r){e="",i.splice(0,1);let r={T1:["uTextureMatrix1","vTexCoord1"],T2:["uTextureMatrix2","vTexCoord2"],T3:["","aTexCoord2"],Env:["","texEnv"]},n=1;for(let s in i)r[i[s]]?(r[i[s]][0]&&"texEnv"!=r[i[s]][1]?e+="lTexCoord"+n+" = ("+r[i[s]][0]+" * vec4("+r[i[s]][1]+", 0, 1)).st;\n":"texEnv"==r[i[s]][1]?e+="lTexCoord"+n+" = texEnv;\n":e+="lTexCoord"+n+" = (uTextureMatrix"+n+" * vec4("+r[i[s]][1]+", 0, 1)).st;\n",n++):WH.debug("Missing vertex shader def?",t)}}return e}static e(t,e,i=0){var r;return"attribute vec3 aPosition;\nattribute vec3 aNormal;\nattribute vec2 aTexCoord0;\nattribute vec2 aTexCoord1;\nattribute vec3 aColor;\n"+((r={SKINNING:e,DISSOLVE:!!(4&i)}).SKINNING?"attribute vec4 aBoneWeights;\nattribute vec4 aBones;\n":"")+"varying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vTexCoord1;\nvarying vec2 vTexCoord2;\n"+(r.DISSOLVE?"varying vec2 vDissolveTC;\nvarying vec3 vLocalPosition;\n":"")+"uniform mat4 uModelMatrix;\nuniform mat4 uPanningMatrix;\nuniform mat4 uViewMatrix;\nuniform mat4 uInvTranspViewModelMat;\nuniform mat4 uProjMatrix;\nuniform vec3 uCameraPos;\n"+(r.SKINNING?"uniform sampler2D uBoneMatricesTex;\n#define ROW0_U ((0.5 + 0.0) / 4.)\n#define ROW1_U ((0.5 + 1.0) / 4.)\n#define ROW2_U ((0.5 + 2.0) / 4.)\n#define ROW3_U ((0.5 + 3.0) / 4.)\nconst float numBones = 256.0;\nmat4 getBoneMatrix(float boneNdx) {\nfloat v = (boneNdx + 0.5) / numBones;\nreturn mat4(\ntexture2D(uBoneMatricesTex, vec2(ROW0_U, v)),\ntexture2D(uBoneMatricesTex, vec2(ROW1_U, v)),\ntexture2D(uBoneMatricesTex, vec2(ROW2_U, v)),\ntexture2D(uBoneMatricesTex, vec2(ROW3_U, v))\n);\n}\nhighp mat4 transpose(in highp mat4 inMatrix) {\nhighp vec4 i0 = inMatrix[0];\nhighp vec4 i1 = inMatrix[1];\nhighp vec4 i2 = inMatrix[2];\nhighp vec4 i3 = inMatrix[3];\nhighp mat4 outMatrix = mat4(\nvec4(i0.x, i1.x, i2.x, i3.x),\nvec4(i0.y, i1.y, i2.y, i3.y),\nvec4(i0.z, i1.z, i2.z, i3.z),\nvec4(i0.w, i1.w, i2.w, i3.w)\n);\nreturn outMatrix;\n}\nmat4 inverse(mat4 m) {\nfloat\na00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\na10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\na20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\na30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\nb00 = a00 * a11 - a01 * a10,\nb01 = a00 * a12 - a02 * a10,\nb02 = a00 * a13 - a03 * a10,\nb03 = a01 * a12 - a02 * a11,\nb04 = a01 * a13 - a03 * a11,\nb05 = a02 * a13 - a03 * a12,\nb06 = a20 * a31 - a21 * a30,\nb07 = a20 * a32 - a22 * a30,\nb08 = a20 * a33 - a23 * a30,\nb09 = a21 * a32 - a22 * a31,\nb10 = a21 * a33 - a23 * a31,\nb11 = a22 * a33 - a23 * a32,\ndet = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\nreturn mat4(\na11 * b11 - a12 * b10 + a13 * b09,\na02 * b10 - a01 * b11 - a03 * b09,\na31 * b05 - a32 * b04 + a33 * b03,\na22 * b04 - a21 * b05 - a23 * b03,\na12 * b08 - a10 * b11 - a13 * b07,\na00 * b11 - a02 * b08 + a03 * b07,\na32 * b02 - a30 * b05 - a33 * b01,\na20 * b05 - a22 * b02 + a23 * b01,\na10 * b10 - a11 * b08 + a13 * b06,\na01 * b08 - a00 * b10 - a03 * b06,\na30 * b04 - a31 * b02 + a33 * b00,\na21 * b02 - a20 * b04 - a23 * b00,\na11 * b07 - a10 * b09 - a12 * b06,\na00 * b09 - a01 * b07 + a02 * b06,\na31 * b01 - a30 * b03 - a32 * b00,\na20 * b03 - a21 * b01 + a22 * b00) / det;\n}\n":"")+"invariant gl_Position;\nvoid main(void) {\nmat4 boneTransformMat = mat4(1.0);\n"+(r.SKINNING?"if (length(aBoneWeights) > 0.0) {\nboneTransformMat = mat4(0.0);\nfor (int i = 0; i < 4; i++) {\nboneTransformMat += getBoneMatrix(aBones[i]) * aBoneWeights[i];\n}\n}\nmat4 viewModelMat = uViewMatrix * uModelMatrix * boneTransformMat;\nmat4 invTranspViewModelMat = transpose(inverse(viewModelMat));\n":"mat4 viewModelMat = uViewMatrix * uModelMatrix;\nmat4 invTranspViewModelMat = uInvTranspViewModelMat;\n")+"vec4 pos = viewModelMat * vec4(aPosition, 1);\nvPosition = pos.rgb;\ngl_Position = uProjMatrix * pos;\nvTexCoord1 = aTexCoord0;\nvTexCoord2 = aTexCoord1;\nvNormal = normalize((invTranspViewModelMat * vec4(aNormal, 0.0)).xyz);\n"+(r.DISSOLVE?"vLocalPosition = aPosition;\nvDissolveTC = aTexCoord0;\n":"")+"}\n"}static c(t,e,i=0){let r=Wi[e];r||(WH.debug("Missing pixel shader def",e),r=Wi[e="PS_Combiners_Opaque_Mod"]);let n="\t\t"+r.slice(1,r.length).join("\n\t\t");for(let t=0;t<r[0];t++){let e=t+1;n="vec4 tex"+t+" = texture2D(uTexture"+e+", lTexCoord"+e+".st);\n"+n}let s=this.b(t);var a;return"precision mediump float;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vTexCoord1;\nvarying vec2 vTexCoord2;\nvarying vec2 vTexCoord3;\nvarying vec2 vTexCoord4;\nuniform bool uHasAlpha;\nuniform bool uHasSpecEmiss;\nuniform bool uHasEmissiveGlowing;\nuniform int uBlendMode;\nuniform bool uUnlit;\nuniform vec4 uColor;\nuniform vec4 uAmbientColor;\nuniform vec4 uDiffuseColor;\nuniform vec4 uPrimaryColor;\nuniform vec4 uSecondaryColor;\nuniform vec3 uLightDir1;\nuniform vec3 uLightDir2;\nuniform vec3 uLightDir3;\nuniform mat4 uTextureMatrix1;\nuniform mat4 uTextureMatrix2;\nuniform mat4 uTextureMatrix3;\nuniform mat4 uTextureMatrix4;\nuniform sampler2D uTexture1;\nuniform sampler2D uTexture2;\nuniform sampler2D uTexture3;\nuniform sampler2D uTexture4;\nuniform sampler2D uAlpha;\nuniform vec4 uTexSampleAlpha;\n"+((a={EXCERPT_TEX_COORD:s,EXCERPT_BASE:n,GRADIENT:!!(1&i),SHADOWY:!!(2&i),DISSOLVE:!!(4&i)}).SHADOWY?"uniform vec4 u_shadowInnerColor;\nuniform vec4 u_shadowOuterColor;\n":"")+(a.GRADIENT?"uniform vec4 u_gradGradientColors_0;\nuniform vec4 u_gradGradientColors_1;\nuniform vec4 u_gradGradientColors_2;\nuniform vec4 u_gradEdgeColor;\nuniform vec4 u_gradBoundingBox;\nuniform vec4 u_gradUpVec;\nuniform vec4 u_gradFlags;\nuniform vec4 u_mulLum_OpaqMat;\n":"")+(a.DISSOLVE?"varying vec2 vDissolveTC;\nvarying vec3 vLocalPosition;\nuniform sampler2D uDissolveMask;\nuniform sampler2D uDissolveEdge1;\nuniform sampler2D uDissolveEdge2;\nuniform vec4 u_dissolveMisc;\nuniform vec4 u_dissolveTransform0;\nuniform vec4 u_dissolveTransform1;\nuniform vec4 u_dissolveTransform2;\nuniform vec4 u_dissolveProcParams;\nuniform vec4 u_dissolveModX;\nuniform vec4 u_dissolveSwizzle;\nuniform vec4 u_dissolveEdgeGlowColor;\nuniform vec4 u_dissolveEdgeGlowParams;\nuniform vec4 u_dissolveFlags;\nfloat dissolvePickChannel(vec4 src, float idx) {\nint i = int(idx);\nif (i == 0) return src.r;\nif (i == 1) return src.g;\nif (i == 2) return src.b;\nreturn src.a;\n}\nvec4 dissolveBlendTexture(vec4 inCol, vec4 colorMult, vec4 swizzle) {\nvec4 multCol = inCol * colorMult;\nreturn vec4(\ndissolvePickChannel(multCol, swizzle.x),\ndissolvePickChannel(multCol, swizzle.y),\ndissolvePickChannel(multCol, swizzle.z),\ndissolvePickChannel(multCol, swizzle.w)\n);\n}\nfloat dissolveFastFresnelRim(vec3 eyeVec, vec3 normal) {\nvec2 term = vec2(dot(eyeVec, normal),\ndot(normalize(eyeVec), normal * vec3(0.05, 0.05, 1.0)));\nvec2 invTerm = vec2(1.0) - clamp(term, 0.0, 1.0);\nvec2 f = invTerm * invTerm;\nreturn f.x + f.y;\n}\n":"")+"vec2 sphereMap(vec3 vertex, vec3 normal) {\nvec3 normPos = (normalize(vertex.xyz));\nvec3 reflection = reflect(normPos, normalize(normal));\nreflection = vec3(reflection.x, reflection.y, reflection.z + 1.0);\nvec2 texCoord = ((normalize(reflection).xy * 0.5) + vec2(0.5));\nreturn texCoord;\n}\nvoid main(void) {\nvec2 lTexCoord1 = vec2(0.0);\nvec2 lTexCoord2 = vec2(0.0);\nvec2 lTexCoord3 = vec2(0.0);\nvec4 _output = vec4(1.0);\nvec4 _input = uColor;\nvec3 _specular = vec3(0.0);\nvec2 texEnv = sphereMap(vPosition.xyz,normalize(vNormal.xyz));\n"+(a.EXCERPT_TEX_COORD?a.EXCERPT_TEX_COORD:"")+(a.EXCERPT_BASE?a.EXCERPT_BASE:"")+"_output.a = _output.a * uDiffuseColor.a;\nif (uBlendMode == 13) {\n_output.a = _output.a * _input.a;\n} else if (uBlendMode == 1) {\nif (_output.a < (128.0/255.0))\ndiscard;\n_output.a = _input.a;\n} else if (uBlendMode == 0) {\n_output.a = _input.a;\n} else {\n_output.a = _output.a * _input.a;\n}\nif (!uUnlit) {\nvec4 litColor = uAmbientColor;\nvec3 normal = normalize(vNormal);\nfloat dp = max(0.0, dot(normal, uLightDir1));\nlitColor += uPrimaryColor * dp;\ndp = max(0.0, dot(normal, uLightDir2));\nlitColor += uSecondaryColor * dp;\ndp = max(0.0, dot(normal, uLightDir3));\nlitColor += uSecondaryColor * dp;\nlitColor = clamp(litColor, vec4(0,0,0,0), vec4(1,1,1,1));\n_output.rgb *= (litColor * uDiffuseColor).rgb;\n}\n_output += vec4(_specular, 0.0);\n"+(a.GRADIENT?"float power = u_gradEdgeColor.w;\nfloat midValue = u_gradGradientColors_2.w;\nfloat opaqueMaterial = u_mulLum_OpaqMat.y;\nfloat lum = clamp(dot(_output.xyz, vec3(0.212599993, 0.715200007, 0.0722000003)), 0.0, 1.0);\nfloat val0 = 0.0;\nfloat val1 = midValue;\nif (lum > midValue) {\nval0 = midValue;\nval1 = 1.0;\n}\nfloat lerpValue = clamp(((lum - val0) / (val1 - val0)), 0.0, 1.0);\nvec3 gradColor0 = u_gradGradientColors_0.xyz;\nvec3 gradColor1 = u_gradGradientColors_1.xyz;\nif (lum > midValue) {\ngradColor0 = u_gradGradientColors_1.xyz;\ngradColor1 = u_gradGradientColors_2.xyz;\n}\nvec3 gradientColor = mix(gradColor0, gradColor1, vec3(lerpValue));\nbool flipNormal = ((u_gradGradientColors_0.w > 0.0) && (vNormal.z < 0.0));\nvec3 normal = flipNormal ? -vNormal.xyz : vNormal.xyz;\nvec2 term = vec2(dot(-(vPosition.xyz), normal), dot(normalize(-(vPosition.xyz)), (normal * vec3(0.05, 0.05, 1.0))));\nvec2 invTerm = (vec2(1.0) - clamp(term, 0.0, 1.0));\nvec2 f = (invTerm * invTerm);\nfloat fresnel_rim = pow((f.x + f.y), power);\nbool disableHeightFade = bool(u_gradFlags.x);\nfloat visMod = 1.0;\nvec4 res = _output;\nif (!(disableHeightFade))\n{\nvec3 distVec = (vPosition - u_gradBoundingBox.xyz);\nfloat _dot = dot(distVec, u_gradUpVec.xyz);\nfloat relHeight = (_dot * u_gradBoundingBox.w);\nbool invertHeightFade = bool(u_gradFlags.w);\nrelHeight = invertHeightFade ? clamp((1.0 - relHeight), 0.0, 1.0) : relHeight;\nvisMod = clamp((relHeight * 1.66666663), 0.0, 0.899999976);\nvisMod = (visMod * visMod);\nres = vec4(_output.r, _output.g, _output.b, (_output.w * visMod));\n}\nvec3 lerp = mix(gradientColor, u_gradEdgeColor.xyz, vec3(fresnel_rim));\nfloat multiplyLum = u_mulLum_OpaqMat.x;\nif (bool(multiplyLum))\n{\nres = vec4(lerp.xyz, (res.w * lum));\n}\nelse\n{\nres = vec4(lerp.xyz, res.w);\n}\n_output = mix(_output, res, vec4(u_gradFlags.y));\n":"")+(a.SHADOWY?"float sh_intensity = dot(_output.rgb, vec3(0.3, 0.59, 0.11));\nvec3 sh_inner = mix(_output.rgb, sh_intensity * mix(_output.rgb, u_shadowInnerColor.rgb, u_shadowInnerColor.w), 0.89);\nvec3 sh_normal = normalize(vNormal.xyz);\nvec2 sh_term = vec2(dot(-(vPosition.xyz), sh_normal), dot(normalize(-(vPosition.xyz)), sh_normal * vec3(0.05, 0.05, 1.0)));\nvec2 sh_invTerm = vec2(1.0) - clamp(sh_term, 0.0, 1.0);\nvec2 sh_f = sh_invTerm * sh_invTerm;\nfloat sh_fresnel = sh_f.x + sh_f.y;\nvec3 sh_outer = sh_intensity * 4.0 * sh_fresnel * mix(_output.rgb, u_shadowOuterColor.rgb, u_shadowOuterColor.w);\n_output.rgb = sh_inner + sh_outer;\n_output.a *= _output.a;\n":"")+(a.DISSOLVE?"vec4 c_misc = u_dissolveMisc;\nvec4 c_transform0 = u_dissolveTransform0;\nvec4 c_transform1 = u_dissolveTransform1;\nvec4 c_transform2 = u_dissolveTransform2;\nfloat value = c_misc.x;\nfloat gain = c_misc.y;\nvec2 dissolveOffset = c_misc.zw;\nfloat isBlendAdd = u_dissolveProcParams.x;\nvec3 m_emissive = vec3(0.0);\nfloat m_opacity = 0.0;\nint ds_method = int(u_dissolveFlags.y + 0.5);\nint ds_blendMode = int(u_dissolveFlags.x + 0.5);\nvec4 ds_originalMaterial = _output;\nif (ds_method == 0) {\nfloat alpha = texture2D(uDissolveMask,\nvDissolveTC * c_transform0.zw + c_transform0.xy + dissolveOffset).a;\nfloat dissolve = 1.0 + alpha * gain - value * (gain + 1.0);\nm_opacity = clamp(dissolve, 0.0, 1.0);\nif (ds_blendMode != 0) {\nm_emissive = ds_originalMaterial.rgb;\nm_opacity *= ds_originalMaterial.a;\nif (ds_blendMode == 1) {\n_output.rgb = ds_originalMaterial.rgb + m_emissive * m_opacity;\n_output.a = m_opacity;\ngl_FragColor = _output;\nreturn;\n}\n}\nconst float EDGE_WIDTH = 1.5;\nvec4 edge1 = texture2D(uDissolveEdge1, vDissolveTC * c_transform1.zw + c_transform1.xy);\nvec4 edge2 = texture2D(uDissolveEdge2, vDissolveTC * c_transform2.zw + c_transform2.xy);\nvec3 add = edge1.rgb * edge2.rgb * 4.0;\nm_emissive = add;\nif (isBlendAdd > 0.0) {\nm_emissive *= m_opacity;\n}\nif (dissolve < 1.0) {\nif (dissolve < 0.0) {\ndiscard;\n}\nm_emissive *= dissolve;\n} else if (dissolve < EDGE_WIDTH) {\nfloat blend = 1.0 - ((dissolve - 1.0) / (EDGE_WIDTH - 1.0));\nif (ds_blendMode != 2) {\nm_opacity = blend;\n}\nm_emissive *= blend;\n} else {\ndiscard;\n}\n_output.rgb = ds_originalMaterial.rgb * m_opacity + m_emissive;\n_output.a = m_opacity;\n} else {\nbool applyDissolve = (u_dissolveProcParams.w > 0.0);\nif (applyDissolve) {\nvec2 maskCoord;\nint shellMaskUVOption = int(u_dissolveProcParams.z + 0.5);\nif (shellMaskUVOption == 0) {\nmaskCoord = (vDissolveTC + c_transform0.xy) * c_transform0.zw;\nmaskCoord.y = 1.0 - maskCoord.y;\n} else if (shellMaskUVOption == 1) {\nmaskCoord = vDissolveTC * c_transform0.zw + c_transform0.xy;\n} else {\nmaskCoord = lTexCoord1;\n}\nfloat mask = texture2D(uDissolveMask, maskCoord).a;\nvec4 t1 = texture2D(uDissolveEdge1, vDissolveTC * c_transform1.zw + c_transform1.xy);\nvec4 t2 = texture2D(uDissolveEdge2, vDissolveTC * c_transform2.zw + c_transform2.xy);\nvec4 textureMod = t1 * t2;\nvec4 final = textureMod * 2.0 * value * mask;\nfinal = dissolveBlendTexture(final, u_dissolveModX, u_dissolveSwizzle);\nm_emissive = final.rgb * textureMod.a;\nm_opacity = final.a;\n} else {\nm_emissive = vec3(0.0);\nm_opacity = 0.0;\n}\nbool edgeGlow = u_dissolveEdgeGlowParams.x > 0.0;\nfloat fresnel_rim = 0.0;\nfloat fresnelIntensity = u_dissolveProcParams.y;\nbool fresnelMask = (fresnelIntensity > 0.0) && !edgeGlow;\nvec3 eyeVec = vPosition.xyz;\nvec3 normal = vNormal.xyz;\nif (fresnelMask || edgeGlow) {\nbool flipNormal = (u_dissolveEdgeGlowParams.y > 0.0) && (normal.z < 0.0);\nif (flipNormal) normal = -normal;\nfresnel_rim = dissolveFastFresnelRim(-eyeVec, normal);\n}\nif (fresnelMask) {\nm_emissive *= clamp(fresnel_rim * fresnelIntensity, 0.0, 1.0);\nm_opacity *= fresnel_rim;\n}\nif (edgeGlow) {\nfresnel_rim = pow(fresnel_rim, fresnelIntensity);\nfloat edgeGlowColorMult = u_dissolveEdgeGlowParams.z;\nvec4 edgeColor = u_dissolveEdgeGlowColor * edgeGlowColorMult;\nm_emissive += edgeColor.rgb * fresnel_rim;\nfloat finalOpacity = 1.0;\nif (ds_blendMode != 0) {\nfinalOpacity *= ds_originalMaterial.a;\n}\nif (ds_blendMode == 1) {\nvec3 diffuseRgb = ds_originalMaterial.rgb * ds_originalMaterial.a;\nif (dot(diffuseRgb, diffuseRgb) < 0.1) {\n_output.rgb = ds_originalMaterial.rgb;\n_output.a = 0.0;\ngl_FragColor = _output;\nreturn;\n}\n}\nm_opacity = max(m_opacity, finalOpacity * fresnel_rim * edgeColor.a);\n}\n_output.rgb = ds_originalMaterial.rgb + m_emissive;\n}\n":"")+"gl_FragColor = _output;\n}\n"}}const Oi=[["PS_Combiners_Opaque_Mod2xNA_Alpha","VS_Diffuse_T1_Env","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Opaque_AddAlpha","VS_Diffuse_T1_Env","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Opaque_AddAlpha_Alpha","VS_Diffuse_T1_Env","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Opaque_Mod2xNA_Alpha_Add","VS_Diffuse_T1_Env_T1","HS_T1_T2_T3","DS_T1_T2_T3"],["PS_Combiners_Mod_AddAlpha","VS_Diffuse_T1_Env","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Opaque_AddAlpha","VS_Diffuse_T1_T1","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Mod_AddAlpha","VS_Diffuse_T1_T1","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Mod_AddAlpha_Alpha","VS_Diffuse_T1_Env","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Opaque_Alpha_Alpha","VS_Diffuse_T1_Env","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Opaque_Mod2xNA_Alpha_3s","VS_Diffuse_T1_Env_T1","HS_T1_T2_T3","DS_T1_T2_T3"],["PS_Combiners_Opaque_AddAlpha_Wgt","VS_Diffuse_T1_T1","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Mod_Add_Alpha","VS_Diffuse_T1_Env","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Opaque_ModNA_Alpha","VS_Diffuse_T1_Env","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Mod_AddAlpha_Wgt","VS_Diffuse_T1_Env","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Mod_AddAlpha_Wgt","VS_Diffuse_T1_T1","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Opaque_AddAlpha_Wgt","VS_Diffuse_T1_T2","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Opaque_Mod_Add_Wgt","VS_Diffuse_T1_Env","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Opaque_Mod2xNA_Alpha_UnshAlpha","VS_Diffuse_T1_Env_T1","HS_T1_T2_T3","DS_T1_T2_T3"],["PS_Combiners_Mod_Dual_Crossfade","VS_Diffuse_T1","HS_T1","DS_T1"],["PS_Combiners_Mod_Depth","VS_Diffuse_EdgeFade_T1","HS_T1","DS_T1"],["PS_Combiners_Opaque_Mod2xNA_Alpha_Alpha","VS_Diffuse_T1_Env_T2","HS_T1_T2_T3","DS_T1_T2_T3"],["PS_Combiners_Mod_Mod","VS_Diffuse_EdgeFade_T1_T2","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Mod_Masked_Dual_Crossfade","VS_Diffuse_T1_T2","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Opaque_Alpha","VS_Diffuse_T1_T1","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Opaque_Mod2xNA_Alpha_UnshAlpha","VS_Diffuse_T1_Env_T2","HS_T1_T2_T3","DS_T1_T2_T3"],["PS_Combiners_Mod_Depth","VS_Diffuse_EdgeFade_Env","HS_T1","DS_T1"],["PS_Guild","VS_Diffuse_T1_T2_T1","HS_T1_T2_T3","DS_T1_T2"],["PS_Guild_NoBorder","VS_Diffuse_T1_T2","HS_T1_T2","DS_T1_T2_T3"],["PS_Guild_Opaque","VS_Diffuse_T1_T2_T1","HS_T1_T2_T3","DS_T1_T2"],["PS_Illum","VS_Diffuse_T1_T1","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Mod_Mod_Mod_Const","VS_Diffuse_T1_T2_T3","HS_T1_T2_T3","DS_T1_T2_T3"],["PS_Combiners_Mod_Mod_Mod_Const","VS_Color_T1_T2_T3","HS_T1_T2_T3","DS_T1_T2_T3"],["PS_Combiners_Opaque","VS_Diffuse_T1","HS_T1","DS_T1"],["PS_Combiners_Mod_Mod2x","VS_Diffuse_EdgeFade_T1_T2","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Mod","VS_Diffuse_EdgeFade_T1","HS_T1_T2","DS_T1_T2"],["PS_Combiners_Mod_Mod_Depth","VS_Diffuse_EdgeFade_T1_T2","HS_T1_T2","DS_T1_T2"]],Wi={PS_Combiners_Add:[1,"_output.rgb = _input.rgb + tex0.rgb;","_output.a = _input.a + tex0.a;"],PS_Combiners_Decal:[1,"_output.rgb = mix(_input.rgb, tex0.rgb, _input.a);","_output.a = _input.a;"],PS_Combiners_Fade:[1,"_output.rgb = mix(tex0.rgb, _input.rgb, _input.a);","_output.a = _input.a;"],PS_Combiners_Mod:[1,"_output.rgb = _input.rgb * tex0.rgb;","_output.a = tex0.a;"],PS_Combiners_Mod2x:[1,"_output.rgb = _input.rgb * tex0.rgb * 2.0;","_output.a = tex0.a * 2.0;"],PS_Combiners_Opaque:[1,"_output.rgb = _input.rgb * tex0.rgb;","_output.a = 1.0;"],PS_Combiners_Add_Add:[2,"_output.rgb = (_input.rgb + tex0.rgb) + tex1.rgb;","_output.a = (_input.a + tex0.a) + tex1.a;"],PS_Combiners_Add_Mod:[2,"_output.rgb = (_input.rgb + tex0.rgb) * tex1.rgb;","_output.a = (_input.a + tex0.a) * tex1.a;"],PS_Combiners_Add_Mod2x:[2,"_output.rgb = (_input.rgb + tex0.rgb) * tex1.rgb * 2.0;","_output.a = (_input.a + tex0.a) * tex1.a * 2.0;"],PS_Combiners_Add_Opaque:[2,"_output.rgb = (_input.rgb + tex0.rgb) * tex1.rgb;","_output.a = _input.a + tex0.a;"],PS_Combiners_Mod_AddNA:[2,"_output.rgb = (_input.rgb * tex0.rgb);","_output.a = tex0.a;","_specular = tex1.rgb;"],PS_Combiners_Mod_Mod:[2,"_output.rgb = (_input.rgb * tex0.rgb) * tex1.rgb;","_output.a = tex0.a * tex1.a;"],PS_Combiners_Mod_Mod2x:[2,"_output.rgb = (_input.rgb * tex0.rgb) * tex1.rgb * 2.0;","_output.a = tex0.a * tex1.a * 2.0;"],PS_Combiners_Mod_Add:[2,"_output.rgb = (_input.rgb * tex0.rgb);","_output.a = tex0.a + tex1.a;","_specular = tex1.rgb;"],PS_Combiners_Mod_Mod2xNA:[2,"_output.rgb = (_input.rgb * tex0.rgb) * tex1.rgb * 2.0;","_output.a = tex0.a;"],PS_Combiners_Mod_Opaque:[2,"_output.rgb = (_input.rgb * tex0.rgb) * tex1.rgb;","_output.a = tex0.a;"],PS_Combiners_Mod2x_Add:[2,"_output.rgb = (_input.rgb * tex0.rgb) * 2.0 + tex1.rgb;","_output.a = (tex0.a) * 2.0 + tex1.a;"],PS_Combiners_Mod2x_Mod2x:[2,"_output.rgb = (_input.rgb * tex0.rgb) * tex1.rgb * 4.0;","_output.a = (tex0.a) * tex1.a * 4.0;"],PS_Combiners_Mod2x_Opaque:[2,"_output.rgb = (_input.rgb * tex0.rgb) * tex1.rgb * 2.0;","_output.a = tex0.a * 2.0;"],PS_Combiners_Opaque_Add:[2,"_output.rgb = (_input.rgb * tex0.rgb) + tex1.rgb;","_output.a = _input.a + tex1.a;"],PS_Combiners_Opaque_AddAlpha:[2,"_output.rgb = (_input.rgb * tex0.rgb);","_specular = (tex1.rgb * tex1.a);"],PS_Combiners_Opaque_AddAlpha_Wgt:[2,"_output.rgb = (_input.rgb * tex0.rgb);","_specular = (tex1.rgb * tex1.a) * uTexSampleAlpha.g;"],PS_Combiners_Opaque_AddAlpha_Alpha:[2,"_output.rgb = (_input.rgb * tex0.rgb);","_specular = (tex1.rgb * tex1.a * (1.0 - tex0.a));"],PS_Combiners_Opaque_AddNA:[2,"_output.rgb = (_input.rgb * tex0.rgb) + tex1.rgb;","_output.a = _input.a;"],PS_Combiners_Opaque_Mod:[2,"_output.rgb = (_input.rgb * tex0.rgb) * tex1.rgb;","_output.a = tex1.a;"],PS_Combiners_Opaque_Mod2x:[2,"_output.rgb = (_input.rgb * tex0.rgb) * tex1.rgb * 2.0;","_output.a = tex1.a * 2.0;"],PS_Combiners_Opaque_Mod2xNA:[2,"_output.rgb = (_input.rgb * tex0.rgb) * tex1.rgb * 2.0;",""],PS_Combiners_Opaque_Mod2xNA_Alpha:[2,"_output.rgb = _input.rgb * mix(tex0.rgb * tex1.rgb * 2.0, tex0.rgb, vec3(tex0.a));",""],PS_Combiners_Opaque_Opaque:[2,"_output.rgb = (_input.rgb * tex0.rgb) * tex1.rgb;",""],PS_Combiners_Opaque_Mod2xNA_Alpha_Add:[3,"_output.rgb = _input.rgb * mix(tex0.rgb * tex1.rgb * 2.0, tex0.rgb, vec3(tex0.a));","_specular = tex2.rgb * tex2.a * uTexSampleAlpha.b;"],PS_Combiners_Mod_Mod_Mod_Const:[3,"_output.rgb = _input.rgb * (tex0 * tex1 * tex2).rgb;","_output.a = (tex0 * tex1 * tex2).a;"],PS_Combiners_Mod_AddAlpha:[2,"_output.rgb = (_input.rgb * tex0.rgb);","_output.a = tex0.a;","_specular = tex1.rgb * tex1.a;"],PS_Combiners_Mod_AddAlpha_Wgt:[2,"_output.rgb = (_input.rgb * tex0.rgb);","_output.a = tex0.a;","_specular = tex1.rgb * tex1.a * uTexSampleAlpha.g;"],PS_Combiners_Mod_AddAlpha_Alpha:[2,"_output.rgb = _input.rgb * tex0.rgb;","_output.a = (tex0.a + tex1.a * (0.3 * tex1.r + 0.59 * tex1.g + 0.11 * tex1.b));","_specular = tex1.rgb * tex1.a * (1.0 - tex0.a);"],PS_Combiners_Opaque_Mod_Add_Wgt:[2,"_output.rgb = _input.rgb * mix(tex0.rgb, tex1.rgb, vec3(tex1.a));","_specular = (tex0.rgb * tex0.a) * uTexSampleAlpha.r;"],PS_Guild:[3,"_output.rgb = _input.rgb * mix(tex0.rgb * mix(vec3(1.0, 1.0, 1.0), tex1.rgb * vec3(1.0, 1.0, 1.0), vec3(tex1.a)), tex2.rgb * vec3(1.0, 1.0, 1.0), vec3(tex2.a));","_output.a = tex0.a;"],PS_Guild_Opaque:[3,"_output.rgb = _input.rgb * mix(tex0.rgb * mix(vec3(1.0, 1.0, 1.0), tex1.rgb * vec3(1.0, 1.0, 1.0), vec3(tex1.a)), tex2.rgb * vec3(1.0, 1.0, 1.0), vec3(tex2.a));",""],PS_Guild_NoBorder:[2,"_output.rgb = _input.rgb * tex0.rgb * mix(vec3(1.0, 1.0, 1.0), tex1.rgb * vec3(1.0, 1.0, 1.0), vec3(tex1.a));","_output.a = tex0.a;"],PS_Combiners_Opaque_Alpha_Alpha:[2,"_output.rgb = _input.rgb * mix(mix(tex0.rgb, tex1.rgb, vec3(tex1.a)), tex0.rgb, vec3(tex0.a));",""],PS_Combiners_Opaque_Mod2xNA_Alpha_3s:[3,"_output.rgb = _input.rgb * mix(tex0.rgb * tex1.rgb * 2.0, tex2.rgb, vec3(tex2.a));"],PS_Combiners_Mod_Add_Alpha:[2,"_output.rgb = _input.rgb * tex0.rgb;","_output.a = (tex0.a + tex1.a);","_specular = tex1.rgb * (1.0 - tex0.a);"],PS_Combiners_Opaque_ModNA_Alpha:[2,"_output.rgb = _input.rgb * mix(tex0.rgb * tex1.rgb, tex0.rgb, vec3(tex0.a));",""],PS_Combiners_Opaque_Mod2xNA_Alpha_UnshAlpha:[3,"float glowOpacity = clamp((tex2.a * vec4(1.0, 1.0, 1.0, 1.0).z), 0.0, 1.0); _output.rgb = _input.rgb * mix(tex0.rgb * tex1.rgb * 2.000000, tex0.rgb, vec3(tex0.a)) * (1.0 - glowOpacity);","_specular = tex2.rgb * glowOpacity;"],PS_Combiners_Opaque_Mod2xNA_Alpha_Alpha:[3,"_output.rgb = _input.rgb * mix(mix(tex0.rgb * tex1.rgb * 2.000000, tex2.rgb, vec3(tex2.a)), tex0.rgb, vec3(tex0.a));",""],PS_Combiners_Mod_Depth:[1,"_output.rgb = _input.rgb * tex0.rgb;","_output.a = tex0.a;"],PS_Combiners_Opaque_Alpha:[2,"_output.rgb = _input.rgb * mix(tex0.rgb, tex1.rgb, vec3(tex1.a));",""],Skin:[3,"//Fresnel Rim\r\nif (uHasSpecEmiss) {\r\n vec3 emissiveColor = tex2.rgb;\r\n vec3 emissiveTerm = tex2.rgb;\r\n if (uHasEmissiveGlowing) {\r\n vec3 eyeVec_120 = vPosition.xyz;\r\n vec3 t121 = -(eyeVec_120);\r\n vec2 term_126 = vec2(dot(t121, vNormal), dot(normalize(t121), (vNormal * vec3(0.0500000007, 0.0500000007, 1.0))));\r\n vec2 invTerm_128 = (vec2(1.0) - clamp(term_126, 0.0, 1.0));\r\n vec2 f_129 = (invTerm_128 * invTerm_128);\r\n float fresnel_rim_133 = pow((f_129.x + f_129.y), 0.600000024);\r\n vec3 t136 = (tex2.rgb /*+ ((vec3(0.0500000007, 0.0, 0.400000006) * 1.0) * fresnel_rim_133)*/);\r\n emissiveColor = vec3(t136.r, tex2.g, t136.b);\r\n\r\n float t267 = dot(normalize(vNormal), normalize(-(vPosition.xyz)));\r\n emissiveTerm = mix(vec3(0.0), 2.0*emissiveColor, vec3(pow(clamp(t267, 0.0, 1.0), (( 128.0 * (tex2.a)) + 9.99999975e-006))));\r\n }\r\n\r\n _output.rgb = _input.rgb * tex0.rgb + tex1.rgb + emissiveTerm.rgb;\r\n} else {\r\n _output.rgb = _input.rgb * tex0.rgb;\r\n}\r\n_output.a = tex0.a; //\r\n"],PS_Combiners_Mod_Dual_Crossfade:[3,"_output.rgb = _input.rgb * mix(mix(tex0, texture2D(uTexture2,vTexCoord1), vec4(clamp(uTexSampleAlpha.g, 0.000000, 1.000000))), texture2D(uTexture3,vTexCoord1), vec4(clamp(uTexSampleAlpha.b, 0.000000, 1.000000))).rgb;","_output.a = mix(mix(tex0, texture2D(uTexture2,vTexCoord1), vec4(clamp(uTexSampleAlpha.g, 0.000000, 1.000000))), texture2D(uTexture3,vTexCoord1), vec4(clamp(uTexSampleAlpha.b, 0.000000, 1.000000))).a;"],PS_Combiners_Mod_Masked_Dual_Crossfade:[4,"_output.rgb = _input.rgb * mix(mix(tex0, texture2D(uTexture2,texCoord), vec4(clamp(uTexSampleAlpha.g, 0.000000, 1.000000))), texture2D(uTexture3,texCoord), vec4(clamp(uTexSampleAlpha.b, 0.000000, 1.000000))).rgb;","_output.a = mix(mix(tex0, texture2D(uTexture2,texCoord), vec4(clamp(uTexSampleAlpha.g, 0.000000, 1.000000))), texture2D(uTexture3,texCoord), vec4(clamp(uTexSampleAlpha.b, 0.000000, 1.000000))).a * texture(uTexture4,texCoord2).a;"],PS_Combiners_Mod_Mod_Depth:[2,"_output.rgb = (_input.rgb * tex0.rgb) * tex1.rgb;","_output.a = tex0.a * tex1.a;"]},Hi=Ui;const Gi=class{constructor(t){this.d=t,this.b=new Set}a(){const t=this.b;return this.b=new Set,t}e(t){this.b.has(t)||(this.d.enableVertexAttribArray(t),this.b.add(t))}c(t){const e=this.d;[...t].filter(t=>!this.b.has(t)).forEach(t=>e.disableVertexAttribArray(t))}};const ji=class{};const Ni=class{};const zi=class extends Ni{};function Vi(){var t=new Re(4);return Re!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function qi(t,e,i,r){var n=new Re(4);return n[0]=t,n[1]=e,n[2]=i,n[3]=r,n}function Xi(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Ji(t,e,i,r,n){return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t}function Yi(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t}function $i(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t}function Ki(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t}function Zi(t){var e=t[0],i=t[1],r=t[2],n=t[3];return Math.hypot(e,i,r,n)}function Qi(t,e){var i=e[0],r=e[1],n=e[2],s=e[3],a=i*i+r*r+n*n+s*s;return a>0&&(a=1/Math.sqrt(a)),t[0]=i*a,t[1]=r*a,t[2]=n*a,t[3]=s*a,t}function tr(t,e,i){var r=e[0],n=e[1],s=e[2],a=e[3];return t[0]=i[0]*r+i[4]*n+i[8]*s+i[12]*a,t[1]=i[1]*r+i[5]*n+i[9]*s+i[13]*a,t[2]=i[2]*r+i[6]*n+i[10]*s+i[14]*a,t[3]=i[3]*r+i[7]*n+i[11]*s+i[15]*a,t}var er=Zi;!function(){var t=Vi()}();const ir=class extends zi{constructor(t,e){super(),this.g=e,this.i=Le(),this.f=Ue(0,0,0),this.ed=Vi(),this.cba=qi(0,0,0,0),this.j=new xi(t,40*e.length/4,!0),this.ba(e)}dc(t,e){const i=this.h;let r=this.g.length;for(let n=0;n<r;++n){if(!e.has(n))continue;We(this.f,0,0,0),Ji(this.cba,0,0,0,0);const r=this.g[n];let s=!1;for(let e=0;e<4;++e){const i=r.f[e]/255;if(i>0){const n=t[r.d[e]];Qe(this.i,r.i,n.a),tr(this.ed,r.b,n.o),this.f[0]=this.f[0]+this.i[0]*i,this.f[1]=this.f[1]+this.i[1]*i,this.f[2]=this.f[2]+this.i[2]*i,this.cba[0]=this.cba[0]+this.ed[0]*i,this.cba[1]=this.cba[1]+this.ed[1]*i,this.cba[2]=this.cba[2]+this.ed[2]*i,s=!0}}if(s){let t=10*n;i[t++]=this.f[0],i[t++]=this.f[1],i[t++]=this.f[2],i[t++]=this.cba[0],i[t++]=this.cba[1],i[t++]=this.cba[2]}}this.j.c(this.h)}ba(t){const e=40*t.length/4;this.h=new Float32Array(e);const i=this.h,r=t;let n=0;for(let t=0;t<r.length;++t)i[n++]=r[t].i[0],i[n++]=r[t].i[1],i[n++]=r[t].i[2],i[n++]=r[t].b[0],i[n++]=r[t].b[1],i[n++]=r[t].b[2],i[n++]=r[t].a,i[n++]=r[t].c,i[n++]=r[t].h,i[n++]=r[t].e;this.j.c(this.h)}c(t){this.j.c(t)}a(){return this.j.a()}d(){this.j.d()}b(){this.j.b()}};const rr=class extends zi{constructor(t,e){super(),this.cba=e,this.ed=new xi(t,48*e.length,!0),this.ba(e)}dc(t,e){}ba(t){const e=48*t.length;this.f=new Uint8Array(e);let i=new DataView(this.f.buffer);const r=t;let n=0;for(let t=0;t<r.length;++t)i.setFloat32(n,r[t].i[0],!0),n+=4,i.setFloat32(n,r[t].i[1],!0),n+=4,i.setFloat32(n,r[t].i[2],!0),n+=4,i.setFloat32(n,r[t].b[0],!0),n+=4,i.setFloat32(n,r[t].b[1],!0),n+=4,i.setFloat32(n,r[t].b[2],!0),n+=4,i.setUint8(n,r[t].d[0]),n+=1,i.setUint8(n,r[t].d[1]),n+=1,i.setUint8(n,r[t].d[2]),n+=1,i.setUint8(n,r[t].d[3]),n+=1,i.setUint8(n,r[t].f[0]),n+=1,i.setUint8(n,r[t].f[1]),n+=1,i.setUint8(n,r[t].f[2]),n+=1,i.setUint8(n,r[t].f[3]),n+=1,i.setFloat32(n,r[t].a,!0),n+=4,i.setFloat32(n,r[t].c,!0),n+=4,i.setFloat32(n,r[t].h,!0),n+=4,i.setFloat32(n,r[t].e,!0),n+=4;this.ed.c(this.f)}c(t){this.ed.c(t)}a(){return this.ed.a()}d(){this.ed.d()}b(){this.ed.b()}};const nr=class{a(){return{}}b(t){}};const sr=class{constructor(t,e){this.e=t,this.d=e,this.d=256,this.c=new Float32Array(16*this.d),this.ba=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.ba),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.bindTexture(t.TEXTURE_2D,null)}a(){return{uBoneMatricesTex:this.ba}}b(t){const e=Math.min(256,t.length);for(let i=0;i<e;i++)this.c.set(t[i].a,16*i);const i=this.e;i.bindTexture(i.TEXTURE_2D,this.ba),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,4,this.d,0,i.RGBA,i.FLOAT,this.c),i.bindTexture(i.TEXTURE_2D,null)}};var ar;!function(t){t[t.aPosition=0]="aPosition",t[t.aNormal=1]="aNormal",t[t.aTexCoord0=2]="aTexCoord0",t[t.aTexCoord1=3]="aTexCoord1"}(ar||(ar={}));const or={aPosition:ar.aPosition,aNormal:ar.aNormal,aTexCoord0:ar.aTexCoord0,aTexCoord1:ar.aTexCoord1},lr=[new Ai(ar.aPosition,3,_i.GFLOAT,!1,40,0),new Ai(ar.aNormal,3,_i.GFLOAT,!1,40,12),new Ai(ar.aTexCoord0,2,_i.GFLOAT,!1,40,24),new Ai(ar.aTexCoord1,2,_i.GFLOAT,!1,40,32)];var hr;!function(t){t[t.aPosition=0]="aPosition",t[t.aNormal=1]="aNormal",t[t.aBones=2]="aBones",t[t.aBoneWeights=3]="aBoneWeights",t[t.aTexCoord0=4]="aTexCoord0",t[t.aTexCoord1=5]="aTexCoord1"}(hr||(hr={}));const ur={aPosition:hr.aPosition,aNormal:hr.aNormal,aBones:hr.aBones,aBoneWeights:hr.aBoneWeights,aTexCoord0:hr.aTexCoord0,aTexCoord1:hr.aTexCoord1},cr=[new Ai(hr.aPosition,3,_i.GFLOAT,!1,48,0),new Ai(hr.aNormal,3,_i.GFLOAT,!1,48,12),new Ai(hr.aBones,4,_i.GUNSIGNED_BYTE,!1,48,24),new Ai(hr.aBoneWeights,4,_i.GUNSIGNED_BYTE,!0,48,28),new Ai(hr.aTexCoord0,2,_i.GFLOAT,!1,48,32),new Ai(hr.aTexCoord1,2,_i.GFLOAT,!1,48,40)];var dr;!function(t){t[t.aPosition=0]="aPosition",t[t.aColor=1]="aColor",t[t.aTexcoord0=2]="aTexcoord0",t[t.aTexcoord1=3]="aTexcoord1",t[t.aTexcoord2=4]="aTexcoord2",t[t.aAlphaCutoff=5]="aAlphaCutoff"}(dr||(dr={}));const fr={[dr.aPosition]:dr.aPosition,[dr.aColor]:dr.aColor,[dr.aTexcoord0]:dr.aTexcoord0,[dr.aTexcoord1]:dr.aTexcoord1,[dr.aTexcoord2]:dr.aTexcoord2,[dr.aAlphaCutoff]:dr.aAlphaCutoff},gr=[new Ai(dr.aPosition,3,_i.GFLOAT,!1,56,0),new Ai(dr.aColor,4,_i.GFLOAT,!1,56,12),new Ai(dr.aTexcoord0,2,_i.GFLOAT,!1,56,28),new Ai(dr.aTexcoord1,2,_i.GFLOAT,!1,56,36),new Ai(dr.aTexcoord2,2,_i.GFLOAT,!1,56,44),new Ai(dr.aAlphaCutoff,1,_i.GFLOAT,!1,56,52)];var pr;!function(t){t[t.aPosition=0]="aPosition",t[t.aColor=1]="aColor",t[t.aTexcoord0=2]="aTexcoord0"}(pr||(pr={}));const mr={[pr.aPosition]:pr.aPosition,[pr.aColor]:pr.aColor,[pr.aTexcoord0]:pr.aTexcoord0},br=[new Ai(pr.aPosition,3,_i.GFLOAT,!1,36,0),new Ai(pr.aColor,4,_i.GFLOAT,!1,36,12),new Ai(pr.aTexcoord0,2,_i.GFLOAT,!1,36,28)];const yr=class{constructor(t,e){this.ji=t,this.fe=e,this.ba=new Map,this.lk=new Gi(t.g());const i=t.g();this.hg=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.hg),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array([0,0,0,0])),i.bindTexture(i.TEXTURE_2D,null)}dc(){throw new Error("Method not implemented.")}g(){return this.ji}e(t){return new Ti(this.ji.g(),t,!1)}i(t){return this.ji.h?new rr(this.ji.g(),t):new ir(this.ji.g(),t)}o(t){return new xi(this.ji.g(),t,!0)}h(t){return new xi(this.ji.g(),t,!0)}f(t,e){const i=this.ji.o(),r=i?new Ei(this.ji.g(),i):new Mi(this.ji.g(),this.lk),n=this.ji.h?cr:lr;return r.c(t,n),r.a(e),r}m(t,e){const i=this.ji.o(),r=i?new Ei(this.ji.g(),i):new Mi(this.ji.g(),this.lk);return r.a(e),r.c(t,gr),r}c(t,e){const i=this.ji.o(),r=i?new Ei(this.ji.g(),i):new Mi(this.ji.g(),this.lk);return r.a(e),r.c(t,br),r}a(t,e,i,r){return this.ji.h?new sr(this.ji.g(),t):new nr}j(t,e,i){const r=Hi.g(i.c,i.b.length),n=Hi.h(i.c,i.b.length),s="Wow."+n+"_"+r,a=i.a,o=s+(a?"_fx"+a:"");let l;this.ba.has(o)?l=this.ba.get(o):(l=new Ii(this.ji.g(),this.ji.h?ur:or,Hi.e(n,this.ji.h,a),Hi.c(n,r,a)),this.ba.set(o,l));const h=Object.assign(Object.assign(Object.assign({},this.fe),t.a()),i.d);for(let t=0;t<Math.max(i.b.length,4);t++){let e=t<i.b.length?i.b[t].l:this.hg;h["uTexture"+(t+1).toString()]=e}return new Li(this.ji.g(),l,e,h)}b(t,e,i){const r=Object.assign(Object.assign(Object.assign({},this.fe),t.a()),i.a);let n;const s="ParticleShader";this.ba.has(s)?n=this.ba.get(s):(n=new Ii(this.ji.g(),fr,"attribute vec3 aPosition;\r\nattribute vec4 aColor;\r\nattribute vec2 aTexcoord0;\r\nattribute vec2 aTexcoord1;\r\nattribute vec2 aTexcoord2;\r\nattribute float aAlphaCutoff;\r\n\r\nvarying vec4 vColor;\r\nvarying vec2 vTexcoord0;\r\nvarying vec2 vTexcoord1;\r\nvarying vec2 vTexcoord2;\r\nvarying float vAlphaCutoff;\r\n\r\nuniform mat4 uModelMatrix;\r\nuniform mat4 uViewMatrix;\r\nuniform mat4 uProjMatrix;\r\n\r\nvoid main(void) {\r\n vec4 pos = vec4(aPosition, 1);\r\n\r\n gl_Position = uProjMatrix * pos;\r\n\r\n vColor = aColor;\r\n vTexcoord0 = aTexcoord0;\r\n vTexcoord1 = aTexcoord1;\r\n vTexcoord2 = aTexcoord2;\r\n vAlphaCutoff = aAlphaCutoff;\r\n}","precision mediump float;\r\n\r\nvarying vec4 vColor;\r\nvarying vec2 vTexcoord0;\r\nvarying vec2 vTexcoord1;\r\nvarying vec2 vTexcoord2;\r\nvarying float vAlphaCutoff;\r\n\r\nuniform bool uHasTexture;\r\nuniform bool uHasTexture2;\r\nuniform bool uHasTexture3;\r\nuniform bool uHasAlpha;\r\nuniform int uBlendMode;\r\nuniform int uPixelShader;\r\nuniform sampler2D uTexture0;\r\nuniform sampler2D uTexture1;\r\nuniform sampler2D uTexture2;\r\nuniform float uAlphaTreshold;\r\n\r\nuniform float alphaMult;\r\nuniform float colorMult;\r\n\r\nvoid main(void) {\r\n float lo_thresh = 0.01;\r\n vec4 color = vec4(1, 1, 1, 1);\r\n vec4 tex = vec4(1, 1, 1, 1);\r\n vec4 tex2 = vec4(1, 1, 1, 1);\r\n vec4 tex3 = vec4(1, 1, 1, 1);\r\n if (uHasTexture) {\r\n tex = texture2D(uTexture0, vTexcoord0).rgba;\r\n }\r\n if (uHasTexture2) {\r\n tex2 = texture2D(uTexture1, vTexcoord1).rgba;\r\n }\r\n if (uHasTexture3) {\r\n tex3 = texture2D(uTexture2, vTexcoord2).rgba;\r\n }\r\n vec4 finalColor = vec4((tex * vColor ).rgb, tex.a*vColor.a );\r\n vec3 matDiffuse = vec3(1.0);\r\n float opacity = 1.0;\r\n if (uPixelShader == 0) {\r\n matDiffuse = vColor.xyz * tex.rgb;\r\n opacity = tex.a*vColor.a;\r\n } else if (uPixelShader == 1) {\r\n vec4 textureMod = tex*tex2;\r\n float texAlpha = (textureMod.w * tex3.w);\r\n opacity = texAlpha*vColor.a;\r\n matDiffuse = vColor.xyz * 4.0 * textureMod.rgb;\r\n } else if (uPixelShader == 2) {\r\n vec4 textureMod = tex*tex2*tex3;\r\n float texAlpha = (textureMod.w);\r\n opacity = texAlpha*vColor.a;\r\n matDiffuse = vColor.xyz * textureMod.rgb;\r\n } else if (uPixelShader == 3) {\r\n vec4 textureMod = tex*tex2*tex3;\r\n float texAlpha = (textureMod.w);\r\n opacity = texAlpha*vColor.a;\r\n\r\n matDiffuse = vColor.xyz * textureMod.rgb;\r\n } else if (uPixelShader == 4) {\r\n discard;\r\n }\r\n\r\n finalColor = vec4(matDiffuse.rgb * colorMult, opacity * alphaMult);\r\n\r\n if (finalColor.a < vAlphaCutoff ) discard;\r\n if (finalColor.a < uAlphaTreshold ) discard;\r\n gl_FragColor = finalColor;\r\n}\r\n"),this.ba.set(s,n));for(let t=0;t<i.b.length;t++)i.b[t]&&(r["uTexture"+t.toString()]=i.b[t].l);return new Li(this.ji.g(),n,e,r)}n(t,e,i){const r=Object.assign(Object.assign(Object.assign({},this.fe),t.a()),i.b);let n;const s="RibbonShader";return this.ba.has(s)?n=this.ba.get(s):(n=new Ii(this.ji.g(),mr,"attribute vec3 aPosition;\r\nattribute vec4 aColor;\r\nattribute vec2 aTexcoord0;\r\n\r\nuniform mat4 uViewMatrix;\r\nuniform mat4 uProjMatrix;\r\n\r\nvarying vec4 vColor;\r\nvarying vec2 vTexcoord0;\r\n\r\nvoid main() {\r\n vec4 aPositionVec4 = vec4(aPosition, 1);\r\n vColor = aColor;\r\n vTexcoord0 = aTexcoord0;\r\n\r\n gl_Position = uProjMatrix * uViewMatrix * aPositionVec4;\r\n}\r\n\r\n\r\n","precision mediump float;\r\n\r\nvarying vec4 vColor;\r\nvarying vec2 vTexcoord0;\r\nuniform sampler2D uTexture;\r\n\r\nvoid main() {\r\n vec4 tex = texture2D(uTexture, vTexcoord0).rgba;\r\n gl_FragColor = vec4((vColor.rgb*tex.rgb), tex.a * vColor.a );\r\n}\r\n"),this.ba.set(s,n)),r["uTexture".toString()]=i.a[0].l,new Li(this.ji.g(),n,e,r)}k(t,e,i,r){const n=this.ji.g();let s=new ji;return s.c=e,s.d=t.c,s.g=n.TRIANGLES,s.h=t.a,s.e=t.b,s.a=r,s.b=i,s}l(t,e,i,r){const n=this.ji.g();let s=new ji;return s.c=e,s.d=t.c,s.g=n.TRIANGLE_STRIP,s.h=t.a,s.e=t.b,s.a=r,s.b=i,s}d(t){const e=this.ji.g(),i=e.createTexture();function r(t){return!(t&t-1)}e.bindTexture(e.TEXTURE_2D,i),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),r(t.width)&&r(t.height)?e.generateMipmap(e.TEXTURE_2D):(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.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR));const n=this.ji.m;return n&&e.texParameteri(e.TEXTURE_2D,n.TEXTURE_MAX_ANISOTROPY_EXT,this.ji.k),i}};var Fr;!function(t){t[t.GxBlend_UNDEFINED=-1]="GxBlend_UNDEFINED",t[t.GxBlend_Opaque=0]="GxBlend_Opaque",t[t.GxBlend_AlphaKey=1]="GxBlend_AlphaKey",t[t.GxBlend_Alpha=2]="GxBlend_Alpha",t[t.GxBlend_Add=3]="GxBlend_Add",t[t.GxBlend_Mod=4]="GxBlend_Mod",t[t.GxBlend_Mod2x=5]="GxBlend_Mod2x",t[t.GxBlend_ModAdd=6]="GxBlend_ModAdd",t[t.GxBlend_InvSrcAlphaAdd=7]="GxBlend_InvSrcAlphaAdd",t[t.GxBlend_InvSrcAlphaOpaque=8]="GxBlend_InvSrcAlphaOpaque",t[t.GxBlend_SrcAlphaOpaque=9]="GxBlend_SrcAlphaOpaque",t[t.GxBlend_NoAlphaAdd=10]="GxBlend_NoAlphaAdd",t[t.GxBlend_ConstantAlpha=11]="GxBlend_ConstantAlpha",t[t.GxBlend_Screen=12]="GxBlend_Screen",t[t.GxBlend_BlendAdd=13]="GxBlend_BlendAdd",t[t.GxBlend_MAX=14]="GxBlend_MAX"}(Fr||(Fr={}));const vr=Fr;const Sr=class{constructor(t){this.n=t,this.r=-1,this.p=-1,this.hg=-1,this.l=-1,this.k=-1,this.ji=vr.GxBlend_UNDEFINED,this.fe=null,this.ba=null,this.m=null,this.t=null,this.s=null}dc(){this.r=-1,this.p=-1,this.hg=-1,this.l=-1,this.k=-1,this.ji=vr.GxBlend_UNDEFINED,this.fe=null,this.ba=null,this.m=null,this.t=null,this.s=null}g(t){this.ji!=t&&(this.o(t),this.ji=t)}j(t){const e=t?1:0;e!=this.r&&(this.n.depthMask(t),this.r=e)}b(t){const e=t?1:0;e!=this.p&&(t?this.n.enable(this.n.DEPTH_TEST):this.n.disable(this.n.DEPTH_TEST),this.p=e)}e(t){const e=t?1:0;e!=this.hg&&(t?this.n.enable(this.n.CULL_FACE):this.n.disable(this.n.CULL_FACE),this.hg=e)}a(t){const e=t?1:0;e!=this.l&&(t?this.n.frontFace(this.n.CCW):this.n.frontFace(this.n.CW),this.l=e)}c(t){this.k!=t&&(this.n.colorMask((1&t)>0,(2&t)>0,(4&t)>0,(8&t)>0),this.k=t)}f(t){this.ba!=t&&(t?t.d():t.b(),this.ba=t)}h(t){this.fe!=t&&(t?t.d():t.b(),this.fe=t)}i(t){this.m!=t&&(t?t.d():this.m.b(),this.m=t,this.fe=null,this.ba=null)}d(t){t!=this.t&&(t&&t.a(),this.t=t)}o(t){const e=this.n;switch(0==t?e.disable(e.BLEND):(e.enable(e.BLEND),e.blendEquation(e.FUNC_ADD)),t){case 0:break;case 1:e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ONE);break;case 2:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case 4:e.blendFuncSeparate(e.DST_COLOR,e.ZERO,e.ONE,e.ONE);break;case 5:e.blendFuncSeparate(e.DST_COLOR,e.SRC_COLOR,e.ONE,e.ONE);break;case 6:e.blendFuncSeparate(e.DST_COLOR,e.ONE,e.ONE,e.ONE);break;case 10:e.blendFunc(e.ONE,e.ONE);break;case 7:e.blendFuncSeparate(e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case 8:e.blendFuncSeparate(e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE,e.ONE);break;case 13:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE);break;default:throw 3735927486}}q(t){this.s!=t&&(t.b(this),this.s=t)}};const Cr=class{constructor(t,e){this.l=t,this.fe=e,this.ba=!1,this.h=!1,this.i=t.getExtension("OES_vertex_array_object"),this.m=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.m?(this.k=t.getParameter(this.m.MAX_TEXTURE_MAX_ANISOTROPY_EXT),WH.debug("Texture anisotropy enabled",this.k)):WH.debug("Texture anisotropy disabled (not supported)"),this.ba=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,this.n=t.getExtension("OES_texture_float"),this.h=this.ba&&null!=this.n,this.h?WH.debug("(float texture) Skinning in shader is supported"):WH.debug("(float texture) Skinning in shader is (not supported) "),this.j=new yr(this,e),this.dc=new Sr(t)}g(){return this.l}o(){return this.i}c(){return this.j}e(t){const e=this.dc,i=this.g();e.i(t.d),e.q(t.c),i.drawElements(t.g,t.e,i.UNSIGNED_SHORT,t.h)}a(){this.dc.dc()}d(){this.dc.i(null)}b(t){this.a(),t.forEach(t=>{this.e(t)}),this.d()}};const Tr=class{constructor(t,e){this.j=t,this.i=e,this.l=null,this.d=!1,this.a=0,this.k=0,0!=e&&(this.f=t.options.contentPath+"textures/"+e+WH.WebP.getImageExtension(),this.g=new Image,this.g.onload=()=>{this.e()},this.g.onerror=()=>{this.g=null},this.c(this.g,this.f))}c(t,e){var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=e=>{var r=new Blob([i.response]);t.src=window.URL.createObjectURL(r)},i.addEventListener("progress",t=>{const i=this.j;i&&t.lengthComputable&&(i.downloads[e]?i.downloads[e].loaded=t.loaded:i.downloads[e]={loaded:t.loaded,total:t.total},i.updateProgress())}),i.addEventListener("load",()=>{const t=this.j;t&&(delete t.downloads[e],t.updateProgress())}),i.send()}b(){return this.d}h(){this.l=null}e(){this.a=this.g.width,this.k=this.g.height,this.l=this.j.renderer.d(this.g),this.d=!0,this.g=null}},xr={147259:!0},_r=[1,1,1,1,1,1,1,2,1,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1,0,0,1,0,1,0,0,0,2,1,1,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1],Ar={2:{GeosetType:15,Original:2,Override:11},3:{GeosetType:15,Original:3,Override:12},4:{GeosetType:15,Original:4,Override:13},5:{GeosetType:15,Original:5,Override:14},6:{GeosetType:15,Original:6,Override:15},7:{GeosetType:15,Original:7,Override:16},8:{GeosetType:15,Original:8,Override:17},9:{GeosetType:15,Original:9,Override:18},10:{GeosetType:15,Original:10,Override:19},11:{GeosetType:12,Original:2,Override:0},12:{GeosetType:12,Original:3,Override:0},13:{GeosetType:12,Original:1,Override:5},14:{GeosetType:12,Original:2,Override:3},15:{GeosetType:12,Original:2,Override:2},16:{GeosetType:22,Original:2,Override:1},17:{GeosetType:22,Original:1,Override:2},18:{GeosetType:22,Original:1,Override:3},19:{GeosetType:22,Original:2,Override:3},20:{GeosetType:12,Original:1,Override:1},21:{GeosetType:12,Original:1,Override:9},22:{GeosetType:12,Original:2,Override:10},23:{GeosetType:12,Original:2,Override:6},24:{GeosetType:12,Original:1,Override:5},25:{GeosetType:27,Original:0,Override:1},26:{GeosetType:27,Original:0,Override:1},27:{GeosetType:27,Original:0,Override:1},28:{GeosetType:13,Original:1,Override:0},31:{GeosetType:12,Original:1,Override:13},32:{GeosetType:12,Original:2,Override:14},33:{GeosetType:42,Original:11,Override:1},38:{GeosetType:20,Original:1,Override:9}},wr={ITEM:1,HELM:2,SHOULDER:4,NPC:8,CHARACTER:16,HUMANOIDNPC:32,OBJECT:64,ARMOR:128,PATH:256,ITEMVISUAL:512,COLLECTION:1024},Er=[0,1,0,3,4,5,6,7,8,9,10,0,0,21,22,22,16,21,0,19,5,21,22,22,0,21,21,27],Mr=[0,16,0,15,1,7,10,5,6,6,8,0,0,17,18,19,14,20,0,9,7,21,22,23,0,24,25,0],Dr=[0,0,0,0,0,0,0,0,0,0,0,0,0,22,0,0,0,22,0,0,0,0,0,0,0,0,0,0],Br=[0,2,0,4,128,128,128,128,128,128,128,0,0,1,1,1,128,1,0,128,128,1,1,1,0,1,1,2],kr=[13,14,15,16,17,88,89],Pr=[8,9,10,11,12,86,87],Rr={86:[4,0,4,1,4,0,4,1],85:[84,0,84,1,84,0,84,1],84:[3,0,3,1,3,0,3,1],77:[5,1,0,-1,5,0,0,-1],76:[10,0,1,1,10,0,1,1],75:[10,0,1,1,10,0,1,1],74:[5,1,0,-1,5,0,0,-1],73:[5,1,0,-1,5,0,0,-1],72:[5,1,0,-1,5,0,0,-1],71:[5,1,0,-1,5,0,0,-1],37:[7,0,7,1,7,0,7,1],36:[2,0,2,1,2,0,2,1],34:[3,0,3,1,3,0,3,1],33:[5,1,0,-1,5,0,0,-1],31:[0,-1,8,1,0,-1,8,1],30:[11,0,11,1,11,0,11,1],29:[10,0,10,1,10,0,10,1],28:[6,0,6,1,6,0,6,1],27:[4,0,4,1,4,0,4,1],26:[24,0,24,1,24,0,24,1],25:[24,0,24,1,24,0,24,1],23:[1,0,1,1,1,0,1,1],15:[5,0,5,1,5,0,5,1],1:[0,-1,0,-1,0,-1,0,3]},Lr={21:26,22:27,15:28,17:26,25:32,13:32,23:33,14:28,26:26},Ir={0:{21:26,22:27},1:{21:26,22:27},2:{21:30,22:31},3:{21:32,22:33},4:{21:26,22:27,15:28},5:{21:26},6:{21:26,22:27},7:{21:26,22:27},8:{21:26,22:27},9:{21:33,22:28}},Ur=5300,Or="precision mediump float;\r\n\r\nuniform float x;\r\nuniform float y;\r\nuniform float width;\r\nuniform float height;\r\n\r\nattribute vec2 aTextCoord;\r\nvarying vec2 vTextCoords;\r\nvoid main() {\r\n vTextCoords = aTextCoord;\r\n\r\n vec2 pos = vec2(\r\n (x + aTextCoord.x*width)* 2.0 - 1.0,\r\n (y + aTextCoord.y*height)* 2.0 - 1.0\r\n );\r\n\r\n gl_Position = vec4(pos.x, pos.y, 0, 1);\r\n}";class Wr{constructor(){this.c=null,this.a=null,this.b=null}d(){null!=this.c&&this.c.h(),null!=this.a&&this.a.h(),null!=this.b&&this.b.h()}e(){return!(this.c&&!this.c.b())&&(!(this.a&&!this.a.b())&&!(this.b&&!this.b.b()))}}class Hr{constructor(){this.f=null,this.k=null,this.g=null,this.j={},this.d=new De,this.i=null,this.h=null}}const Gr={uDiffuseTexture:null,uSpecularTexture:null,uEmissiveTexture:null};class jr{constructor(t,e,i){this.m=e,this.k=i,this.j=null,this.h=null,this.p=null,this.a=null,this.u=null,this.n=!1,this.d=0,this.f="",this.c=t,this.u=function(t){let e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array([0,0,0,0])),t.bindTexture(t.TEXTURE_2D,null);let i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array([0,0,0,255])),t.bindTexture(t.TEXTURE_2D,null);let r=new Hr;return r.i=e,r.h=i,r.f=Fe(t,[Or,"precision mediump float;\r\n\r\nvarying vec2 vTextCoords;\r\nuniform sampler2D uDiffuseTexture;\r\nuniform sampler2D uSpecularTexture;\r\nuniform sampler2D uEmissiveTexture;\r\nuniform sampler2D renderResultTexture;\r\nuniform int uBlendMode;\r\nuniform vec2 screenResolution;\r\nuniform int layer;\r\n\r\nuniform float diffuseTexWidth;\r\nuniform float diffuseTexHeight;\r\n\r\nfloat overlayBlend(float a, float b) {\r\n if (b > 0.5) {\r\n return (1.0 - (1.0 - 2.0 * (a - 0.5)) * (1.0 - b));\r\n } else {\r\n return ((2.0 * a) * b);\r\n }\r\n}\r\n\r\nfloat alphaStraightBlend(float a, float b, float alpha) {\r\n return (a * alpha) + (b * (1.0 - alpha));\r\n}\r\n\r\nvoid main() {\r\n vec2 l_texCoord = vTextCoords.xy;\r\n\r\n\r\n l_texCoord.x = max(min(l_texCoord.x, (diffuseTexWidth-0.5)/diffuseTexWidth), 0.5/diffuseTexWidth);\r\n l_texCoord.y = max(min(l_texCoord.y, (diffuseTexHeight-0.5)/diffuseTexHeight), 0.5/diffuseTexHeight);\r\n\r\n vec4 diffuse = texture2D( uDiffuseTexture, l_texCoord );\r\n vec4 backGround = texture2D( renderResultTexture, gl_FragCoord.xy / screenResolution );\r\n\r\n if (uBlendMode == 1) {\r\n // Blit (we do nothing?)\r\n //if (diffuse.a < 0.001) discard;\r\n\r\n //vec4 finalColor = diffuse;\r\n\r\n //diffuse = vec4(finalColor.rgb, finalColor.a);\r\n } else if (uBlendMode == 2) {\r\n // Multiply\r\n if (diffuse.a < 0.001) discard;\r\n\r\n vec4 multTexture = diffuse;\r\n vec3 finalColor = (backGround.rgb * multTexture.rgb);\r\n\r\n diffuse = vec4(finalColor.rgb, 1.0);\r\n } else if (uBlendMode == 3) {\r\n // Overlay\r\n if (diffuse.a < 0.001) discard;\r\n\r\n vec4 overlayTex = diffuse;\r\n\r\n vec3 finalColor = vec3(\r\n overlayBlend(overlayTex.r, backGround.r),\r\n overlayBlend(overlayTex.g, backGround.g),\r\n overlayBlend(overlayTex.b, backGround.b)\r\n );\r\n\r\n vec3 mainTexVisible = backGround.rgb * (1.0 - overlayTex.a);\r\n vec3 overlayTexVisible = finalColor.rgb * (overlayTex.a);\r\n finalColor = (mainTexVisible + overlayTexVisible);\r\n\r\n diffuse = vec4(finalColor, backGround.a);\r\n } else if (uBlendMode == 5) {\r\n // AlphaStraight\r\n vec4 overlayTex = diffuse;\r\n\r\n //float alphaMult = 1.0;\r\n //vec3 finalColor = vec3(\r\n // alphaStraightBlend(overlayTex.r, backGround.r, alphaMult*overlayTex.a),\r\n // alphaStraightBlend(overlayTex.g, backGround.g, alphaMult*overlayTex.a),\r\n // alphaStraightBlend(overlayTex.b, backGround.b, alphaMult*overlayTex.a)\r\n //);\r\n vec3 finalColor = overlayTex.rgb * overlayTex.a + backGround.rgb * (1.0 - overlayTex.a);\r\n\r\n diffuse = vec4(finalColor.rgb, 1.0);\r\n } else if (uBlendMode == 0 || uBlendMode == 4 || uBlendMode == 6 || uBlendMode == 7) {\r\n // default, Screen, InferAlphaBlend, Unknown1\r\n if (diffuse.a < 0.001) discard;\r\n\r\n vec3 finalColor = mix(backGround.rgb, diffuse.rgb, diffuse.a);\r\n\r\n diffuse = vec4(finalColor.rgb, 1.0);\r\n }\r\n\r\n gl_FragColor = diffuse;\r\n}"],null,null),r.k=Fe(t,[Or,"precision mediump float;\r\n\r\nvarying vec2 vTextCoords;\r\nuniform sampler2D uDiffuseTexture;\r\nuniform sampler2D uSpecularTexture;\r\nuniform sampler2D uEmissiveTexture;\r\nuniform sampler2D renderResultTexture;\r\nuniform int uBlendMode;\r\n\r\nvoid main() {\r\n vec4 diffuse = texture2D( uDiffuseTexture, vTextCoords.xy );\r\n vec4 specular = texture2D( uSpecularTexture, vTextCoords.xy );\r\n if (diffuse.a < 0.001) discard;\r\n gl_FragColor = vec4(specular.rgb, 1.0);\r\n}"],null,null),r.g=Fe(t,[Or,"precision mediump float;\r\n\r\nvarying vec2 vTextCoords;\r\nuniform sampler2D uDiffuseTexture;\r\nuniform sampler2D uSpecularTexture;\r\nuniform sampler2D uEmissiveTexture;\r\nuniform sampler2D renderResultTexture;\r\nuniform int uBlendMode;\r\nuniform vec2 screenResolution;\r\nuniform float emissiveAlphaOverride;\r\nuniform int layer;\r\n\r\nvoid main() {\r\n vec4 diffuse = texture2D( uDiffuseTexture, vTextCoords.xy );\r\n vec4 emissive = texture2D( uEmissiveTexture, vTextCoords.xy );\r\n vec4 backGround = texture2D( renderResultTexture, gl_FragCoord.xy / screenResolution );\r\n\r\n if (diffuse.a < 0.001) discard;\r\n// if (emissive.a < 0.001) discard;\r\n\r\n //TODO: This is a hack from what was observed in Nightborne texture customization with tatoos.\r\n //TODO: But Maybe switch should be over layer or something else instead of blend\r\n float alpha = 1.0;\r\n\r\n if (emissiveAlphaOverride > -1.0) {\r\n alpha = emissiveAlphaOverride;\r\n } else if (layer <= 1) {\r\n alpha = 0.0;\r\n } else {\r\n alpha = emissive.a;\r\n }\r\n\r\n gl_FragColor = vec4(emissive.rgb, alpha);\r\n}"],null,null),r.j={},r.a=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,r.a),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,null),r.e=t.createBuffer(),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,r.e),t.bufferData(t.ELEMENT_ARRAY_BUFFER,new Int16Array([0,1,2,1,3,2]),t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null),r.b=t.createFramebuffer(),r.c={loc:t.getAttribLocation(r.f.program,"aTextCoord"),type:t.FLOAT,size:2,offset:0,stride:0},r}(t)}t(){const t=new Date,e=t.toISOString().split("T")[0],i=`${String(t.getHours()).padStart(2,"0")}-${String(t.getMinutes()).padStart(2,"0")}-${String(t.getSeconds()).padStart(2,"0")}`,r=65536*Math.random()|0;this.f=`${r}_${e}_${i}`,this.d=0;let n=this.c;this.a||(this.a=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.a),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,this.m,this.k,0,n.RGBA,n.UNSIGNED_BYTE,null),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR)),this.j||(this.j=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.j),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,this.m,this.k,0,n.RGBA,n.UNSIGNED_BYTE,null),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR)),this.h||(this.h=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.h),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,this.m,this.k,0,n.RGBA,n.UNSIGNED_BYTE,null),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR)),this.p||(this.p=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.p),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,this.m,this.k,0,n.RGBA,n.UNSIGNED_BYTE,null),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.bindTexture(n.TEXTURE_2D,null)),n.bindFramebuffer(n.FRAMEBUFFER,this.u.b),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,this.j,0),n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,this.h,0),n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,this.p,0),n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT),n.useProgram(this.u.k.program),n.bindBuffer(n.ARRAY_BUFFER,this.u.a),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,this.u.e),this.u.d.disableAll(),this.u.d.enable(n,[this.u.c]),n.viewport(0,0,this.m,this.k)}r(t,e,i,r,n,s,a,o){const l=this.c,h=this.u;h.j.x=e,h.j.y=i,h.j.width=r,h.j.height=n,h.j.diffuseTexWidth=t.c.a,h.j.diffuseTexHeight=t.c.k,null==t.a&&null==t.b||(this.n=!0);let u=0;1==s?u=1:4==s?u=2:6==s?u=3:7==s?u=4:9==s?u=5:15==s?u=6:16==s&&(u=7),h.j.uBlendMode=u,h.j.screenResolution=new Float32Array([this.m,this.k]),h.j.uDiffuseTexture=null!=t.c?t.c.l:h.i,h.j.uSpecularTexture=null!=t.a?t.a.l:h.i,h.j.uEmissiveTexture=null!=t.b?t.b.l:h.h,h.j.renderResultTexture=null!=this.a?this.a:h.i,h.j.layer=a,h.j.emissiveAlphaOverride=o,l.disable(l.CULL_FACE),l.disable(l.DEPTH_TEST),l.disable(l.BLEND),this.e(h.f,h.j,this.j),this.e(h.k,h.j,this.h),this.e(h.g,h.j,this.p),this.d++,l.useProgram(null)}s(){let t=this.c;t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindTexture(t.TEXTURE_2D,null),t.enable(t.CULL_FACE),t.enable(t.DEPTH_TEST)}e(t,e,i){let r=this.c;r.useProgram(t.program),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,i,0),r.bindTexture(r.TEXTURE_2D,this.a),r.copyTexImage2D(r.TEXTURE_2D,0,r.RGBA,0,0,this.m,this.k,0),r.bindTexture(r.TEXTURE_2D,null),pe(t,e),r.drawElements(r.TRIANGLES,6,r.UNSIGNED_SHORT,0),pe(t,Gr)}l(t){if(0==t)return this.j;if(1==t)return this.h;if(2==t)return this.p;throw new Error("unknown usage "+t)}b(t){let e=null;return e={l:t,a:this.m,k:this.k,d:!0},e}i(){let t=this.c;this.a&&t.deleteTexture(this.a),this.j&&t.deleteTexture(this.j),this.h&&t.deleteTexture(this.h),this.p&&t.deleteTexture(this.p),this.j=null,this.h=null,this.p=null,this.a=null,this.u=null,this.c=null}g(t){switch(t){case 0:return this.b(this.j);case 1:return this.b(this.h);case 2:return this.b(this.p);default:return null}}o(){}q(t){}}function Nr(){var t=new Re(2);return Re!=Float32Array&&(t[0]=0,t[1]=0),t}function zr(t,e){var i=new Re(2);return i[0]=t,i[1]=e,i}function Vr(t,e,i){return t[0]=e,t[1]=i,t}function qr(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t}function Xr(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t}function Jr(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t}!function(){var t=Nr()}();function Yr(){var t=new Re(9);return Re!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function $r(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function Kr(t,e,i){var r=e[0],n=e[1],s=e[2],a=e[3],o=e[4],l=e[5],h=e[6],u=e[7],c=e[8],d=i[0],f=i[1],g=i[2],p=i[3],m=i[4],b=i[5],y=i[6],F=i[7],v=i[8];return t[0]=d*r+f*a+g*h,t[1]=d*n+f*o+g*u,t[2]=d*s+f*l+g*c,t[3]=p*r+m*a+b*h,t[4]=p*n+m*o+b*u,t[5]=p*s+m*l+b*c,t[6]=y*r+F*a+v*h,t[7]=y*n+F*o+v*u,t[8]=y*s+F*l+v*c,t}function Zr(){var t=new Re(4);return Re!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Qr(t,e,i){i*=.5;var r=Math.sin(i);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(i),t}function tn(t,e,i,r){var n,s,a,o,l,h=e[0],u=e[1],c=e[2],d=e[3],f=i[0],g=i[1],p=i[2],m=i[3];return(s=h*f+u*g+c*p+d*m)<0&&(s=-s,f=-f,g=-g,p=-p,m=-m),1-s>Pe?(n=Math.acos(s),a=Math.sin(n),o=Math.sin((1-r)*n)/a,l=Math.sin(r*n)/a):(o=1-r,l=r),t[0]=o*h+l*f,t[1]=o*u+l*g,t[2]=o*c+l*p,t[3]=o*d+l*m,t}var en,rn,nn,sn,an,on,ln=Xi,hn=Ji,un=Qi;en=Le(),rn=Ue(1,0,0),nn=Ue(0,1,0),sn=Zr(),an=Zr(),on=Yr();const cn=class{constructor(t){this.buffer=new DataView(t),this.position=0}getBool(){var t=0!=this.buffer.getUint8(this.position);return this.position+=1,t}getUint8(){var t=this.buffer.getUint8(this.position);return this.position+=1,t}getInt8(){var t=this.buffer.getInt8(this.position);return this.position+=1,t}getUint16(){var t=this.buffer.getUint16(this.position,!0);return this.position+=2,t}getInt16(){var t=this.buffer.getInt16(this.position,!0);return this.position+=2,t}getUint32(){var t=this.buffer.getUint32(this.position,!0);return this.position+=4,t}getInt32(){var t=this.buffer.getInt32(this.position,!0);return this.position+=4,t}getFloat(){var t=this.buffer.getFloat32(this.position,!0);return this.position+=4,t}getString(t){void 0===t&&(t=this.getUint16());for(var e="",i=0;i<t;++i)e+=String.fromCharCode(this.getUint8());return e}setBool(t){this.buffer.setUint8(this.position,t?1:0),this.position+=1}setUint8(t){this.buffer.setUint8(this.position,t),this.position+=1}setInt8(t){this.buffer.setInt8(this.position,t),this.position+=1}setUint16(t){this.buffer.setUint16(this.position,t,!0),this.position+=2}setInt16(t){this.buffer.setInt16(this.position,t,!0),this.position+=2}setUint32(t){this.buffer.setUint32(this.position,t,!0),this.position+=4}setInt32(t){this.buffer.setInt32(this.position,t,!0),this.position+=4}setFloat(t){this.buffer.setFloat32(this.position,t,!0),this.position+=4}};class dn{constructor(){this.a=-1,this.e=null,this.c=0,this.d=-1,this.b=!1}}class fn{constructor(){this.e=new dn,this.d=new dn,this.b=new dn,this.a=0,this.f=1,this.c=!1}}class gn{constructor(){this.f=[],this.h=[],this.b=0,this.j=-1,this.k=!1,this.c=null}i(t,e){if(!this.c||!t)return!1;const i=this.c;if(i.timesOffset+4*i.timesCount>t.byteLength)return!1;const r=new cn(t);r.position=i.timesOffset,this.f=new Array(i.timesCount);for(let t=0;t<i.timesCount;t++)this.f[t]=r.getUint32();r.position=i.valuesOffset,this.h=new Array(i.valuesCount);for(let t=0;t<i.valuesCount;t++)this.h[t]=e(r);return this.k=!0,this.c=null,!0}e(){var t=this;if(t.h)for(var e=0;e<t.h.length;++e)t.h[e]=null;return t.f=null,t.h=null,null}l(t,e,i,r){let n=this;if(null==r&&(r=this.m()),this.j>=0&&(t=this.j<e.length?e[this.j]:e[0]),0!=n.b||n.h.length>1){if(n.f.length>1){for(var s=-1,a=n.f.length-1,o=0;o<a;++o)if(t>=n.f[o]&&t<=n.f[o+1]){s=o;break}if(-1==s)return r=t<n.f[0]?n.d(r,n.h[0]):n.d(r,n.h[n.h.length-1]);if(1==n.b){var l=n.f[s],h=n.f[s+1],u=0;return t>h?u=1:l!=h&&(u=(t-l)/(h-l)),u=Math.max(0,Math.min(1,u)),n.g(n.h[s],n.h[s+1],u,r)}return r=n.d(r,n.h[s])}return n.h.length>0?r=n.d(r,n.h[0]):i}return 0==n.h.length?null!=i?i:r:r=n.d(r,n.h[0])}}class pn extends gn{constructor(){super(),this.ba=Le()}m(){return Le()}g(t,e,i,r){return Ze(r,t,e,i)}d(t,e){return Oe(t,e),t}a(t){return We(Le(),t.getFloat(),t.getFloat(),t.getFloat())}}class mn extends gn{constructor(){super(),this.ba=Zr()}m(){return Zr()}g(t,e,i,r){return tn(r,t,e,i)}d(t,e){return ln(t,e),t}a(t){let e=t.getFloat(),i=t.getFloat(),r=t.getFloat(),n=t.getFloat();const s=hn(Zr(),e,i,r,n);return un(s,s),s}}class bn extends gn{constructor(){super(),this.ba=Zr()}m(){return Zr()}g(t,e,i,r){return tn(r,t,e,i)}d(t,e){return ln(t,e),t}a(t){let e=(t.getUint16()-32767)/32767,i=(t.getUint16()-32767)/32767,r=(t.getUint16()-32767)/32767,n=(t.getUint16()-32767)/32767;const s=hn(Zr(),e,i,r,n);return un(s,s),s}}class yn extends gn{constructor(){super()}a(t){return t.getUint16()}m(){return 0}g(t,e,i,r){return t+(e-t)*i}d(t,e){return e}}class Fn extends yn{a(t){return t.getFloat()}}class vn extends yn{a(t){return t.getUint8()}}class Sn{constructor(){this.i=[],this.c=[]}f(){var t=this;if(t.c)for(var e=0;e<t.c.length;++e)t.c[e]=null;return t.i=null,t.c=null,t.e=null,null}d(t,e,i,r){let n=this;i||(i=this.h());let s=r||n.c;if(n.c.length>1&&n.i.length>1){for(var a=-1,o=n.i.length,l=0;l<o-1;++l)if(t>=n.i[l]&&t<=n.i[l+1]){a=l;break}-1==a&&(a=n.i.length-1);var h=n.i[a],u=n.i[a+1],c=0;return h!=u&&(c=(t-h)/(u-h)),n.a(s[a],s[a+1],c,i)}return s.length>0?i=n.b(i,s[0]):e}}class Cn extends Sn{constructor(){super(),this.ba=Nr()}h(){return Nr()}a(t,e,i,r){return n=r,a=e,o=i,l=(s=t)[0],h=s[1],n[0]=l+o*(a[0]-l),n[1]=h+o*(a[1]-h),n;var n,s,a,o,l,h}b(t,e){var i,r;return r=e,(i=t)[0]=r[0],i[1]=r[1],t}g(t){return Vr(Nr(),t.getFloat(),t.getFloat())}}class Tn extends Sn{constructor(){super()}h(){return Le()}a(t,e,i,r){return Ze(r,t,e,i)}b(t,e){return Oe(t,e),t}g(t){return We(Le(),t.getFloat(),t.getFloat(),t.getFloat())}}class xn extends Sn{constructor(){super()}h(){return 0}a(t,e,i,r){return t+(e-t)*i}b(t,e){return e}g(t){return t.getUint16()}}function _n(t,e,i,r){const n=t.getInt32(),s=t.getInt32(),a=t.getInt32(),o=t.getInt32(),l=i();if(n>0){const t=new cn(e);t.position=s,l.i=new Array(n);for(let e=0;e<n;e++)l.i[e]=t.getInt16()/32767}if(a>0){const t=new cn(e);t.position=o,l.c=new Array(a);for(let e=0;e<a;e++)l.c[e]=r(t)}return l}class An{constructor(){this.e=null}static h(t,e,i,r,n=!0){const s=new An;return s.j=function(t,e,i,r,n=!0){const s=t.getInt16(),a=t.getInt16(),o=t.getInt32(),l=t.getInt32(),h=t.getInt32(),u=t.getInt32(),c=Math.min(o,h),d=new Array(c);for(let t=0;t<c;t++){const o=i();o.b=s,o.j=a,o.f=[],o.h=[],o.k=!1;{const i=new cn(e.chunkData);i.position=l+8*t;const s=i.getInt32(),a=i.getInt32();i.position=u+8*t;const h=i.getInt32(),c=i.getInt32();if(s>0&&h>0)if(!n||t<e.sequenceFlags.length&&32&e.sequenceFlags[t]){i.position=a,o.f=new Array(s);for(let t=0;t<s;t++)o.f[t]=i.getUint32();i.position=c,o.h=new Array(h);for(let t=0;t<h;t++)o.h[t]=r(i);o.k=!0}else o.c={timesCount:s,timesOffset:a,valuesCount:h,valuesOffset:c}}d[t]=o}return d}(t,e,i,r,n),s.e=r,s}static a(){const t=new An;return t.j=[],t}b(t){return!(!this.j||0==this.j.length)&&(t>=this.j.length&&(t=0),this.j[t].k)}g(t,e,i,r){if(!this.j||0==this.j.length)return i;let n=t.d.a;n>=this.j.length&&(n=0);let s=this.j[n].l(t.d.c,e,i,r);if(t.a>0&&t.a<1){let r=this.j[0].m(),n=t.b.a;n>=this.j.length&&(n=0);let a=this.j[n].l(t.b.c,e,i,r);a||(a=r),r=this.j[0].m(),s=this.j[0].g(a,s,t.a,r)}if(t.f>0&&t.f<=1&&t.e.a!=t.d.a&&-1!=t.e.a){let r=this.j[0].m(),n=t.e.a;n>=this.j.length&&(n=0);let a=this.j[n].l(t.e.c,e,i,r);a||(a=r),r=this.j[0].m(),s=this.j[0].g(a,s,1-t.f,r)}return s}d(t,e){if(!this.j||t<0||t>=this.j.length)return!1;const i=this.j[t];return!(!i.c||i.k)&&(!!this.e&&i.i(e,this.e))}c(t){return!(!this.j||t<0||t>=this.j.length)&&null!=this.j[t].c}i(t){if(!this.j||0===this.j.length)return 0;if(t<0||t>=this.j.length)return 0;const e=this.j[t];return e&&e.f&&0!==e.f.length?e.f[e.f.length-1]:0}f(){if(this.j&&0!=this.j.length){for(var t=0;t<this.j.length;++t)this.j[t].e(),this.j[t]=null;return null}}}function wn(){return new pn}function En(){return new mn}function Mn(){return new bn}function Dn(){return new yn}function Bn(){return new Fn}function kn(){return new vn}function Pn(t){return We(Le(),t.getFloat(),t.getFloat(),t.getFloat())}function Rn(t){let e=t.getFloat(),i=t.getFloat(),r=t.getFloat(),n=t.getFloat();const s=hn(Zr(),e,i,r,n);return un(s,s),s}function Ln(t){let e=(t.getUint16()-32767)/32767,i=(t.getUint16()-32767)/32767,r=(t.getUint16()-32767)/32767,n=(t.getUint16()-32767)/32767;const s=hn(Zr(),e,i,r,n);return un(s,s),s}function In(t){return t.getUint16()}function Un(t){return t.getFloat()}function On(t){return t.getUint8()}function Wn(){return new Cn}function Hn(){return new Tn}function Gn(){return new xn}function jn(t){return Vr(Nr(),t.getFloat(),t.getFloat())}function Nn(t,e,i=!0){return An.h(t,e,wn,Pn,i)}function zn(t,e,i=!0){return An.h(t,e,Dn,In,i)}function Vn(t,e,i=!0){return An.h(t,e,Bn,Un,i)}function qn(t,e,i=!0){return An.h(t,e,kn,On,i)}function Xn(t,e){return _n(t,e,Gn,In)}function Jn(t,e){return qi(t[4*e+0],t[4*e+1],t[4*e+2],0)}function Yn(t,e,i){for(let r=0;r<4;r++)t[4*e+r]=i[r]}const $n=class{constructor(t,e,i){this.r=t,this.b=i,this.y=null,this.i=null,this.s=null,this.p=ni(),this.u=ni(),this.x=ni();const r=this;r.l=e,r.e=Le(),r.a=ni(),r.g=ni(),r.o=ni(),r.q=Le(),r.h=Zr(),r.n=ni(),r.t=!1,r.d=!1,r.c=!1}j(){var t=this;t.e=null,t.a=null,t.q=null,t.h=null,t.n=null}v(){this.t=!0;for(var t=0;t<16;++t)this.a[t]=0}f(t){t?(null==this.y&&(this.y=new fn),this.r.am(t,this.y)):this.y=null;let e=this.r.af[this.l];for(let i=0;i<e.length;i++)this.r.aM[e[i]].f(t)}w(t){t?(null==this.i&&(this.i=new fn),this.r.am(t,this.i)):this.i=null;let e=this.r.af[this.l];for(let i=0;i<e.length;i++)this.r.aM[e[i]].w(t)}m(t){const e=this.b;var i=this;if(i.t)return void i.v();if(null!=this.y&&this.r.W(this.y,t),i.d||i.c)return;if(i.d=!0,!i.r)return;oi(i.a);var r=i.r.d;if(!r)return;let n=this.u;if(oi(n),ui(n,n,this.r.o.viewMatrix),ui(n,n,this.r.aQ),ui(i.a,i.a,n),e.d>-1){i.r.aM[e.d].m(t);let r=this.x;if(si(r,i.r.aM[e.d].a),ui(r,n,r),1&e.f||2&e.f||4&e.f){if(4&e.f&&2&e.f)Yn(r,0,Jn(n,0)),Yn(r,1,Jn(n,1)),Yn(r,2,Jn(n,2));else if(4&e.f){{let t=Jn(n,0),e=Zi(t);Ki(t,t,Zi(Jn(r,0))/e),Yn(r,0,t)}{let t=Jn(n,1),e=Zi(t);Ki(t,t,Zi(Jn(r,1))/e),Yn(r,1,t)}{let t=Jn(n,2),e=Zi(t);Ki(t,t,Zi(Jn(r,2))/e),Yn(r,2,t)}}else if(2&e.f){{let t=Jn(n,0);Ki(t,t,1/Zi(Jn(r,0))),Ki(t,t,Zi(Jn(n,0))),Yn(r,0,t)}{let t=Jn(n,1);Ki(t,t,1/Zi(Jn(r,1))),Ki(t,t,Zi(Jn(n,1))),Yn(r,1,t)}{let t=Jn(n,2);Ki(t,t,1/Zi(Jn(r,2))),Ki(t,t,Zi(Jn(n,2))),Yn(r,2,t)}}if(1&e.f)Yn(r,3,Jn(n,3));else{let t=qi(e.i[0],e.i[1],e.i[2],1),s=Vi();Xi(s,t),s[3]=0;let a=Vi(),o=Vi();tr(a,t,i.r.aM[i.b.d].a),tr(a,a,n),tr(o,s,r),$i(a,a,o),a[3]=1,Yn(r,3,a)}}let s=this.p;hi(s,n),ui(r,s,r),ui(i.a,i.a,r)}let s=null;if(null!=this.y){let t=this.z(this.y);this.r.a||(this.A=t),this.r.w||(s=this.r.a?this.A:t)}else{let t=this.z(r);this.r.a||(this.A=t),this.r.w||(s=this.r.a?this.A:t)}let a=null;if(null!=this.i){let t=this.z(this.i);this.r.a||(this.k=t),a=this.r.a?this.k:t}let o=null!=s||null!=a,l=ni();o&&(null!=s&&ui(l,l,s),null!=a&&ui(l,l,a)),null!=this.s&&(ci(l,l,this.b.i),ui(l,l,this.s),ci(l,l,Je(this.q,this.b.i))),ui(i.a,i.a,l);let h=120&e.f;if(h){let t=ni();si(t,i.a);let e=i.a,r=Le();bi(r,i.a);let n=Vi();if(16==h){let t=Jn(i.a,0);Ki(t,t,1/Ie(t)),Yn(i.a,0,t);let r=qi(e[4],-e[0],0,0);Yn(e,1,Qi(r,r)),Ke(n,r,t),n[3]=0,Yn(e,2,n)}else if(h>16){if(32==h){let t=Jn(e,1);Ki(t,t,1/Zi(t)),Yn(i.a,1,t);let r=qi(-e[5],e[1],0,0);Yn(e,0,Qi(r,r)),n[3]=0,Yn(e,2,n)}else if(64==h){let t=Jn(e,2);Qi(t,t),Yn(e,2,t);let i=qi(t[1],-t[0],0,0);Qi(i,i),Yn(e,1,i),Ke(n,t,i),n[3]=0,Yn(e,0,n)}}else if(8==h){let t=this.r.isMirrored;if(o){let i=Jn(l,0);i=qi(i[1],i[2],-i[0],0),Qi(i,i),Yn(e,0,i);let r=Jn(l,1);r=qi(t?-r[1]:r[1],t?-r[2]:r[2],t?r[0]:-r[0],0),Qi(r,r),Yn(e,1,r);let n=Jn(l,2);n=qi(n[1],n[2],-n[0],0),Qi(n,n),Yn(e,2,n)}else{Yn(e,0,qi(0,0,-1,0)),Yn(e,1,qi(t?-1:1,0,0,0)),Yn(e,2,qi(0,1,0,0))}}let s=qi(this.b.i[0],this.b.i[1],this.b.i[2],1),a=qi(this.b.i[0],this.b.i[1],this.b.i[2],0),u=Jn(e,0),c=Jn(e,1),d=Jn(e,2);Ki(u,u,r[0]),Ki(c,c,r[1]),Ki(d,d,r[2]),Yn(e,0,u),Yn(e,1,c),Yn(e,2,d),tr(s,s,t),tr(a,a,e);let f=Vi();$i(f,s,a),f[3]=1,Yn(e,3,f)}hi(n,n),ui(i.a,n,i.a),hi(i.g,i.a),li(i.o,i.g),Qe(i.e,i.b.i,i.a)}z(t){const e=this.b;if(!!(640&e.f)){let v=ni();return oi(v),ci(v,v,this.b.i),this.q=e.c.g(t,this.r.as,Le()),ci(v,v,this.q),this.h=e.b.g(t,this.r.as,Zr()),i=this.n,r=this.h,n=r[0],s=r[1],a=r[2],o=r[3],c=n*(l=n+n),d=s*l,f=s*(h=s+s),g=a*l,p=a*h,m=a*(u=a+a),b=o*l,y=o*h,F=o*u,i[0]=1-f-m,i[1]=d+F,i[2]=g-y,i[3]=0,i[4]=d-F,i[5]=1-c-m,i[6]=p+b,i[7]=0,i[8]=g+y,i[9]=p-b,i[10]=1-c-f,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,ui(v,v,this.n),this.q=e.a.g(t,this.r.as,Ue(1,1,1)),di(v,v,this.q),ci(v,v,Je(this.q,this.b.i)),v}var i,r,n,s,a,o,l,h,u,c,d,f,g,p,m,b,y,F;return null}};const Kn=class{constructor(t){this.a=t,this.c=267320826^t;let e=new ArrayBuffer(4);this.f=new DataView(e)}d(){let t=this.c;return t^=t<<13,t^=t>>17,t^=t<<5,this.c=t,t}e(){let t,e=this.d();return this.f.setInt32(0,1065353216|8388607&e),t=2147483648&e?2-this.f.getFloat32(0):this.f.getFloat32(0)-2,t}b(){let t=this.d();return this.f.setInt32(0,1065353216|8388607&t),this.f.getFloat32(0)-1}};const Zn=class{constructor(){this.g=0,this.a=0,this.j=0,this.e=0,this.d=Le(),this.i=0,this.c=0,this.b=0,this.h=0,this.f=0}};const Qn=class{constructor(t,e){this.k=t,this.e=e,this.j=new Zn}d(){return this.j.e+this.k.e()*this.e.R}a(){return this.j.e+this.e.R}f(){return this.j.j+this.e.w}b(t){return this.j.j+30518509e-12*t*this.e.w}c(){let t=this.j.g;return t*=1+this.j.a*this.k.e(),t}g(){return this.j}h(t){Oe(t,this.j.d)}};const ts=class extends Qn{i(t,e){let i,r=e*this.k.b(),n=this.k.e();i=n<1?n>-1?Math.trunc(32767*n+.5):-32767:32767,t.f=i;let s=this.b(i);s<.001&&(s=.001),t.g=function(t,e){let i=Math.abs(t),r=Math.abs(e);return Number((i-Math.floor(i/r)*r).toPrecision(8))*Math.sign(t)}(r,s),t.e=65535&this.k.d(),We(t.a,this.k.e()*this.j.c*.5,this.k.e()*this.j.b*.5,0);let a=this.c(),o=this.j.i;if(o<.001){let e=this.j.h*this.k.e(),i=this.j.f*this.k.e(),r=Math.sin(e),n=Math.sin(i),s=Math.cos(e),o=Math.cos(i);We(t.b,o*r*a,n*r*a,s*a)}else{let e=Le();Oe(e,t.a),e[2]=e[2]-o,Ie(e)>1e-4&&(Ye(e,e),Ve(t.b,e,a))}}};const es=class extends Qn{constructor(t,e,i){super(t,e),this.ba=i}i(t,e){let i,r=e*this.k.b(),n=this.k.e();i=n<1?n>-1?Math.trunc(32767*n+.5):-32767:32767,t.f=i;let s=this.b(i);s<.001&&(s=.001),t.g=function(t,e){let i=Math.abs(t),r=Math.abs(e);return Number((i-Math.floor(i/r)*r).toPrecision(8))*Math.sign(t)}(r,s),t.e=65535&this.k.d();let a=this.j.b-this.j.c,o=this.j.c+a*this.k.b(),l=this.j.h*this.k.e(),h=this.j.f*this.k.e(),u=Math.cos(l),c=Ue(u*Math.cos(h),u*Math.sin(h),Math.sin(l));Ve(t.a,c,o);let d=this.c(),f=this.j.i,g=Ue(.5,.5,.5);0==f?this.ba?We(g,0,0,1):We(g,u*Math.cos(h),u*Math.sin(h),Math.sin(l)):(We(g,0,0,f),Ge(g,t.a,g),Ie(g)>1e-4&&Ye(g,g)),Ve(t.b,g,d)}};const is=class{constructor(){this.a=Le(),this.g=0,this.b=Le(),this.f=0,this.e=2147483647*Math.random()|0,this.c=[Nr(),Nr()],this.d=[Nr(),Nr()]}};const rs=class{constructor(t,e,i,r,n,s){this.d=t,this.b=e,this.c=i,this.e=r,this.f=n,this.a=s}};const ns=class{constructor(t,e,i){this.c=t,this.a=e,this.b=i}};let ss=new Array(128);for(let t=0;t<128;t++)ss[t]=Math.random();const as=ai(0,1,0,0,-1,0,0,0,0,0,1,0,0,0,0,1),os=1e3;class ls{}class hs{constructor(){this.a=Le(),this.c=0,this.b={d:Nr(),c:Le(),a:0,e:0,f:1,b:0}}}function us(t){return qi((t>>16&255)/255,(t>>8&255)/255,(255&t)/255,(t>>24&255)/255)}const cs=[0,0,1,2,3,4];const ds=class{constructor(t,e){this.ag=t,this.E=e,this.af=null,this.O=0,this.ak=!0,this.i=null,this.P=(new Date).getTime(),this.ap=e,this.e=ni(),this.ah=ni(),this.aj=ni(),this.n=ni(),this.q=Vi(),this.R=Yr(),this.S=Le(),this.aq=1,this.t=Le(),this.ae=0,this.J=Le(),this.y=Le(),this.B=[],this.ac=Le(),this.an=0,this.v=0,this.at=0,this.x=0,this.m=Le(),this.aa=Le(),this.H=0,this.as=0,this.av=0,this.j=0,this.A=0,this.z=0,this.am=0,this.b=[],this.M=[];for(let t=0;t<os;t++)this.M.push(4*t+0),this.M.push(4*t+1),this.M.push(4*t+2),this.M.push(4*t+3),this.M.push(4*t+2),this.M.push(4*t+1);switch(this.L=new Kn(2147483647*Math.random()|0),this.ap.g){case 1:this.p=new ts(this.L,e);break;case 2:this.p=new es(this.L,e,!!(256&this.ap.l));break;default:this.p=null,WH.debug("Found unimplemented generator ",this.ap.g)}const i=this.ap.M-this.ap.c;0!=i?(this.v=(this.ap.v-this.ap.d)/i,this.at=this.ap.d-this.ap.c*this.v):(this.v=0,this.at=0);let r=this.ap.V;r<=0&&(r=1);let n=this.ap.f;n<=0&&(n=1),this.as=r*n-1,this.av=0;let s=r,a=-1;do{++a,s>>=1}while(s);if(this.j=a,this.A=r-1,this.av=0,(32768&this.ap.l)>0){let t=(this.as+1)*this.L.d();this.av=t/4294967296|0}this.z=1/r,this.am=1/n;let o=!1;(269484032&this.ap.l)>0?(o=!!(1&this.ap.l>>28),this.an=o?2:3):this.an=0;let l=!1,h=!1;(268435456&this.ap.l)>0?h=(1073741824&this.ap.l)>0:1048576&this.ap.l||(l=!(1&this.ap.l)),2==this.an||4==this.an&&o?this.s=h?3:2:3==this.an?this.s=5:this.s=l?1:0,this.K=e.E>1,this.V=this.ag.N.o(224e3),this.Q=this.ag.N.e(8e3),this.X=this.ag.N.m(this.V,this.Q)}N(){var t=this;t.ap.W=null,t.ap.B=null,t.ap.x=null,t.ap.n=t.ap.n.f(),t.ap.u=t.ap.u.f(),t.ap.e=t.ap.e.f(),t.ap.J=t.ap.J.f(),t.ap.y=t.ap.y.f(),t.ap.b=t.ap.b.f(),t.ap.r=t.ap.r.f(),t.ap.j=t.ap.j.f(),t.ap.N=t.ap.N.f(),t.ap.k=t.ap.k.f(),t.ap.t=t.ap.t.f(),t.ap.aa=t.ap.aa.f(),t.ap.A=t.ap.A.f(),t.ap.i=t.ap.i.f(),t.ap.K=t.ap.K.f(),t.ap.C=t.ap.C.f(),t.B=null}W(t){const e=this.E;e.a>=11&&e.a<=13&&t&&(this.d=[Vi(),Vi(),Vi()],Xi(this.d[0],us(t.Start[e.a-11])),Xi(this.d[1],us(t.Mid[e.a-11])),Xi(this.d[2],us(t.End[e.a-11])))}k(t){this.af=t}au(){if(this.i)return;this.ag.o.context;if(!this.Z)if(this.Z=[null,null,null],268435456&this.ap.l)for(let t=0;t<this.ap.h.length;t++){const e=this.ap.h[t];e>-1&&e<this.ag.aO.length&&(this.Z[t]=this.ag.aO[e])}else this.ap.o>-1&&this.ap.o<this.ag.aO.length&&(this.Z[0]=this.ag.aO[this.ap.o]);let t=!0;for(let e of this.Z)t=t&&(!e||e.a&&e.a.d);if(!t)return;const e=this.ag.N;let i=this.ap.E;4==i&&(i=3);let r={};r.uViewMatrix=this.ag.o.viewMatrix,r.uProjMatrix=this.ag.o.projMatrix,r.uBlendMode=this.ap.E,r.uPixelShader=cs[this.s],r.colorMult=this.af?this.af.c:1,r.alphaMult=this.af?this.af.b:1;let n=[this.Z[0]&&this.Z[0].a&&this.Z[0].a.d,this.Z[1]&&this.Z[1].a&&this.Z[1].a.d,this.Z[2]&&this.Z[2].a&&this.Z[2].a.d];r.uTexture=this.Z[0].a.l,r.uTexture2=n[1]?this.Z[1].a.l:null,r.uTexture3=n[2]?this.Z[2].a.l:null,r.uHasTexture=n[0]?1:0,r.uHasTexture2=n[1]?1:0,r.uHasTexture3=n[2]?1:0;let s=-1;1==i?s=.501960814:i>1&&(s=1/255),r.uAlphaTreshold=s;const a=e.b(this.ag.aS,new rs(!1,!this.ag.i,i,!0,!1,15),new ki(this.Z.map(t=>t&&t.a),r));this.i=e.k(new ns(this.X,0,0),a,0,this.ap.F)}Y(t,e){if(!this.p)return;let i=ni(),r=this.p.g(),n=!0;this.ap.t.b(t.d.a)&&(n=this.ap.t.g(t,this.ag.as)>0),this.F=n;Ue(0,0,0);if(n){r.g=this.ap.n.g(t,this.ag.as,0),r.a=this.ap.u.g(t,this.ag.as,0),r.h=this.ap.e.g(t,this.ag.as,0),r.f=this.ap.J.g(t,this.ag.as,0);const e=this.ap.y.g(t,this.ag.as,0);We(r.d,0,0,-e),r.j=this.ap.b.g(t,this.ag.as,0),r.e=this.ap.r.g(t,this.ag.as,0),r.b=this.ap.N.g(t,this.ag.as,0),r.c=this.ap.j.g(t,this.ag.as,0),this.af?r.i=this.af.a:r.i=this.ap.k.g(t,this.ag.as,0)}ui(i,i,this.ag.aQ),ui(i,i,this.ag.aM[this.ap.I].a);let s=ni();var a,o;a=s,o=Ue(this.ap.W[0],this.ap.W[1],this.ap.W[2]),a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=o[0],a[13]=o[1],a[14]=o[2],a[15]=1,ui(i,i,s),ui(i,i,as);let l=ni(),h=Le();hi(l,this.ag.o.viewMatrix),mi(h,l),this.ar(e,i,h,null,this.ag.o.viewMatrix),this.c(this.ag.o.viewMatrix),this.V.c(new Float32Array(this.b)),this.Q.c(new Uint16Array(this.M)),this.i&&(this.i.e=6*this.O|0,this.i.h=0)}U(t){if(this.B.length<=0)return;if(this.i||this.au(),!this.i)return;if(!t&&this.i.c.a()>vr.GxBlend_AlphaKey)return;this.ag.N.g().e(this.i)}a(t,e){if(!(16&this.ap.l))for(let i=0;i<this.B.length;i++){const r=this.B[i];Qe(r.a,r.a,t),ti(r.b,r.b,e)}}ar(t,e,i,r,n){if(null==this.p)return;if(this.ag.a)return;mi(this.t,this.e);let s=Vi();mi(s,e),s[3]=1,tr(s,s,n),this.ae=s[2];let a=Le();if(mi(a,n),this.ab(e,a,r),t>0){let e=Le();if(mi(e,this.e),16384&this.ap.l){Ge(this.y,e,this.t);let i=this.v*(Ie(this.y)/t)+this.at;i>=0&&(i=Math.min(i,1)),Ve(this.J,this.y,i)}if(64&this.ap.l){this.x+=t;let i=.03;if(this.x>i)if(this.x=0,0==this.B.length){let t=i/this.x,r=Le();Ge(r,e,this.t);let n=t*this.ap.p;je(this.m,r,Ue(n,n,n))}else We(this.m,0,0,0)}this.o(t)}}ab(t,e,i){if(Oe(this.aa,e),null==i||16&this.ap.l)si(this.e,t);else{let e=ni();hi(e,i),ui(this.e,e,t)}let r=Le();bi(r,t),this.aq=r[0]}o(t){if((t=Math.max(t,0))<.1)Oe(this.J,this.y);else{let e=Math.floor(t/.1);t=-.1*e+t;let i=Math.min(Math.floor(this.p.g().j/.1),e),r=i+1,n=1;n=r<0?(1&r|r>>1)+(1&r|r>>1):r,Ve(this.J,this.y,1/n);for(let t=0;t<i;t++)this.D(.1)}this.D(t)}D(t){let e=new ls;if(t<0)return;this.ap.l,this.g(e,t),this.f(t);let i=0;for(;i<this.B.length;){let r=this.B[i];r.g=r.g+t,r.g>Math.max(this.p.b(r.e),.001)?(this.ad(i),i--):this.l(r,t,e)||(this.ad(i),i--),i++}}g(t,e){t.a=Le(),t.b=Le(),t.c=Le(),t.d=0;let i=Ue(e,e,e),r=e*e*.5,n=Ue(r,r,r);je(t.a,this.ap.D,i);let s=Le();this.p.h(s),je(t.b,s,i),je(t.c,s,n),t.d=this.ap.s*e}f(t){if(!this.F)return;if(!this.ak)return;let e=this.p.d();for(this.H=this.H+t*e;this.H>1;)this.h(t),this.H-=1}h(t){let e=this.r();if(this.p.i(e,t),!(16&this.ap.l)){let t=qi(e.a[0],e.a[1],e.a[2],1),i=qi(e.b[0],e.b[1],e.b[2],0);tr(t,t,this.e),tr(i,i,this.e),Oe(e.a,t),Oe(e.b,i),8192&this.ap.l&&(e.a[2]=0)}if(64&this.ap.l){let t=1+this.p.g().a*this.L.e(),i=Le();Ve(i,this.m,t),He(e.b,e.b,i)}if(this.an>=2)for(let t=0;t<2;t++){e.c[t][0]=this.L.b(),e.c[t][1]=this.L.b();let i=Nr();Jr(i,this.ap.m[t],this.L.e()),qr(e.d[t],i,this.ap.Q[t])}}r(){let t=new is;return this.B.push(t),t}ad(t){this.B.splice(t,1)}l(t,e,i){if(this.an>=2)for(let i=0;i<2;i++){let r=t.c[i][0]+e*t.d[i][0];t.c[i][0]=r-Math.floor(r),r=t.c[i][1]+e*t.d[i][1],t.c[i][1]=r-Math.floor(r)}He(t.b,t.b,i.a),16384&this.ap.l&&2*e<t.g&&He(t.a,t.a,this.J);let r=Ue(e,e,e),n=Le();if(je(n,t.b,r),He(t.b,t.b,i.b),Ve(t.b,t.b,1-i.d),He(t.a,t.a,n),He(t.a,t.a,i.c),2==this.ap.g&&128&this.ap.l){let e=Le();if(Oe(e,t.a),16&this.ap.l){if($e(e,n)>0)return!1}else{let i=Le();if(mi(i,this.e),Ge(e,t.a,i),$e(e,n)>0)return!1}}return!0}c(t){if(this.b.length=0,0==this.B.length&&null!=this.p)return;hi(this.aj,t),$r(Yr(),t),this.T(null,t);let e=0;for(let t=0;t<this.B.length;t++){let i=this.B[t],r=new hs;if(this.w(i,r)&&(131072&this.ap.l&&(this.al(i,r),e++),262144&this.ap.l&&(this.G(i,r),e++)),e>=os)break}this.O=e}T(t,e){var i,r,n;16&this.ap.l?ui(this.n,e,this.e):null!=t?ui(this.n,e,t):si(this.n,e),mi(this.q,e),4096&this.ap.l&&($r(this.R,this.n),16&this.ap.l&&Math.abs(this.aq)>0&&(i=this.R,r=this.R,n=1/this.aq,i[0]=r[0]*n,i[1]=r[1]*n,i[2]=r[2]*n,i[3]=r[3]*n,i[4]=r[4]*n,i[5]=r[5]*n,i[6]=r[6]*n,i[7]=r[7]*n,i[8]=r[8]*n),We(this.S,this.R[6],this.R[7],this.R[8]),Xe(this.S)<=2.3841858e-7?We(this.S,0,0,1):Ye(this.S,this.S))}C(t){let e=0,i=0;if(0!=this.ap.Y||0!=this.ap.X){let r=new Kn(t.e);e=0==this.ap.L?this.ap.Y:this.ap.Y+r.e()*this.ap.L,i=0==this.ap.X?this.ap.z:this.ap.z+r.e()*this.ap.X}else e=this.ap.Y,i=this.ap.z;return{deltaSpin:i,baseSpin:e}}w(t,e){let i=this.ap.T,r=this.ap.P,n=r[0],s=r[1]-n,a=0,o=t.e,l=t.g;if((i<1||0!=s)&&(a=127&l*this.ap.G+o),i<ss[a])return 0;this.ai(t,e,o);let h=s*ss[a]+n;Jr(e.b.d,e.b.d,h),32&this.ap.l&&Jr(e.b.d,e.b.d,this.aq);let u=qi(t.a[0],t.a[1],t.a[2],1);return tr(u,u,this.n),Oe(e.a,u),e.c=1,1}ai(t,e,i){let r=t.g/this.p.f(),n=new Kn(i);Math.min(r,1)<=0?r=0:r>=1&&(r=1);let s=Ue(255,255,255),a=zr(1,1),o=1,l=e.b;this.ap.aa.d(r,s,l.c,this.d),this.d||Ve(l.c,l.c,1/255),this.ap.i.d(r,a,l.d),l.f=this.ap.A.d(r,32767)/32767,this.af?l.b=this.af.d.d(r,0)/32767:l.b=0;let h=0;this.ap.K.i.length>0?(o=0,l.a=this.ap.K.d(r,o),l.a=this.as&l.a+this.av):65536&this.ap.l?(h=(this.as+1)*n.d(),l.a=h/4294967296|0):l.a=0,o=0,l.e=this.ap.C.d(r,o),l.e=l.e+this.av&this.as;let u=1;524288&this.ap.l?(u=Math.max(1+n.e()*this.ap.O[1],99999997e-12),l.d[0]=Math.max(1+n.e()*this.ap.O[0],99999997e-12)*l.d[0]):(u=Math.max(1+n.e()*this.ap.O[0],99999997e-12),l.d[0]=u*l.d[0]),l.d[1]=u*l.d[1]}al(t,e){let i=zr((e.b.a&this.A)*this.z,(e.b.a>>this.j)*this.am),r=0,n=0,s=this.C(t);r=s.baseSpin,n=s.deltaSpin;let a=0,o=Ue(0,0,0),l=Ue(0,0,0),h=!1,u=!1;if(4&this.ap.l&&Xe(t.b)>2.3841858e-7)if(a=1,4096&this.ap.l)h=!0;else{let i=qi(-t.b[0],-t.b[1],-t.b[2],0);tr(i,i,this.n);let r=Le();Oe(r,i);let n=0,s=Xe(r);n=s<=2.3841858e-7?0:1/Math.sqrt(s);let a=Le();Oe(a,r),Ve(a,a,n),Oe(o,a),Ve(o,o,e.b.d[0]),l=Ue(a[1],-a[0],0),Ve(l,l,e.b.d[1]),u=!0,h=!1}if((4096&this.ap.l||h)&&!u){let i=Yr();c=i,d=this.R,c[0]=d[0],c[1]=d[1],c[2]=d[2],c[3]=d[3],c[4]=d[4],c[5]=d[5],c[6]=d[6],c[7]=d[7],c[8]=d[8];let s=e.b.d[0];if(a){let r=0,n=Ue(-t.b[0],-t.b[1],-t.b[2]),a=Xe(n);r=a<=2.3841858e-7?0:1/Math.sqrt(a),Kr(i,this.R,function(t,e,i,r,n,s,a,o,l){var h=new Re(9);return h[0]=t,h[1]=e,h[2]=i,h[3]=r,h[4]=n,h[5]=s,h[6]=a,h[7]=o,h[8]=l,h}(n[0]*r,n[1]*r,0,-n[1]*r,n[0]*r,0,0,0,1)),r>2.3841858e-7&&(s=e.b.d[0]*(1/Math.sqrt(Xe(t.b))/r))}if(this.an,We(o,i[0],i[1],i[2]),Ve(o,o,s),We(l,i[3],i[4],i[5]),Ve(l,l,e.b.d[1]),n=l[0],u=!0,0!=this.ap.z||0!=this.ap.X){let e=r+n*t.g;512&this.ap.l&&1&t.e&&(e=-e);let i=Le();Oe(i,this.S),this.an;let s=Yr(),a=Zr();Qr(a,i,e),function(t,e){var i=e[0],r=e[1],n=e[2],s=e[3],a=i+i,o=r+r,l=n+n,h=i*a,u=r*a,c=r*o,d=n*a,f=n*o,g=n*l,p=s*a,m=s*o,b=s*l;t[0]=1-c-g,t[3]=u-b,t[6]=d+m,t[1]=u+b,t[4]=1-h-g,t[7]=f-p,t[2]=d-m,t[5]=f+p,t[8]=1-h-c}(s,a),ti(o,o,s),We(l,n,l[1],l[2]),ti(l,l,s)}}var c,d;if(!u)if(0!=this.ap.z||0!=this.ap.X){let i=r+n*t.g;512&this.ap.l&&1&t.e&&(i=-i);let s=Math.cos(i),a=Math.sin(i);We(o,s,a,0),Ve(o,o,e.b.d[0]),We(l,-a,s,0),Ve(l,l,e.b.d[1]),134217728&this.ap.l&&He(e.a,e.a,Ue(l[0],l[1],0))}else We(o,e.b.d[0],0,0),We(l,0,e.b.d[1],0);return this.I(o,l,e.a,e.b.c,e.b.f,e.b.b,i[0],i[1],t.c),0}G(t,e){let i=zr((e.b.e&this.A)*this.z,(e.b.e>>this.j)*this.am),r=Ue(0,0,0),n=Ue(0,0,0),s=this.ap.Z;1024&this.ap.l&&(s=Math.min(t.g,s));let a=Vi();Ve(a,t.b,-1),a[3]=0,tr(a,a,this.n),Ve(a,a,s);let o=Ue(a[0],a[1],0);if($e(o,o)>1e-4){let t=1/Ie(o);Jr(e.b.d,e.b.d,t),Xr(o,o,e.b.d),n=Ue(-o[1],o[0],0),Ve(r,a,.5),He(e.a,e.a,r)}else r=Ue(.05*e.b.d[0],0,0),n=Ue(0,.05*e.b.d[1],0);return this.I(r,n,e.a,e.b.c,e.b.f,e.b.b,i[0],i[1],t.c),1}I(t,e,i,r,n,s,a,o,l){const h=[-1,-1,1,1],u=[1,-1,1,-1],c=[0,0,1,1],d=[0,1,0,1];let f=Le(),g=Nr(),p=Nr(),m=Nr();for(let b=0;b<4;b++)We(f,0,0,0),qe(f,f,t,h[b]),qe(f,f,e,u[b]),He(f,f,i),Vr(g,c[b]*this.z+a,d[b]*this.am+o),Vr(p,c[b]*this.ap.H[0]+l[0][0],d[b]*this.ap.H[0]+l[0][1]),Vr(m,c[b]*this.ap.H[1]+l[1][0],d[b]*this.ap.H[1]+l[1][1]),this.b.push(f[0]),this.b.push(f[1]),this.b.push(f[2]),this.b.push(r[0]),this.b.push(r[1]),this.b.push(r[2]),this.b.push(n),this.b.push(g[0]),this.b.push(g[1]),this.b.push(p[0]),this.b.push(p[1]),this.b.push(m[0]),this.b.push(m[1]),this.b.push(s)}};class fs{constructor(){this.a=Le(),this.b=Vi(),this.c=Nr()}}class gs{}const ps=[0,1,2,10,3,4,5,13];function ms(t,e){return Ue(t[4*e+0],t[4*e+1],t[4*e+2])}const bs=class{constructor(t,e){this.ap=t,this.l=e,this.Q=Le(),this.P=Le(),this.z=new gs,this.at=Le(),this.T=Le(),this.an=Le(),this.as=Le(),this.p=Le(),this.d=Le(),this.o=Le(),this.O=Le(),this.W=Le(),this.x=Le(),this.Z=Le(),this.am=Le(),this.m=Le(),this.R=t.o.context,this.av=new Array(e.i.length),this.ar=new Array(e.i.length);for(let i=0;i<e.i.length;i++)this.ar[i]=t.ai.aa[e.i[i]];let i=qi(255,255,255,255),r=new gs;r.c=0,r.d=0,r.b=1,r.a=1,this.q(e.o,e.d,i,r,e.q,e.e),this.g(e.a),this.U(!1)}U(t){this.aj=t,this.aj||(this.c=!1)}g(t){this.af=t}y(){return this.M==this.h}ak(t){this.ac=t}k(t){this.N=t}D(t){this.v[3]=Math.max(t,0)}I(){let t=Le();ii(t,this.Q,this.m);let e=Xe(t);Ve(t,this.at,this.ac),Ge(this.o,this.Q,t),Ve(t,this.T,this.ac),Ge(this.O,this.m,t),Ve(t,this.at,this.N),He(this.W,this.Q,t),Ve(t,this.T,this.N),He(this.x,this.m,t),Ve(this.p,this.an,e),Ve(this.d,this.as,e)}a(t,e,i){let r;if(this.K&&this.aj){r=t;let i=Le();mi(i,r),He(i,i,e),Oe(this.P,e),this.c?(Oe(this.Q,this.m),Oe(this.an,this.as),Oe(this.at,this.T)):(Oe(this.Q,i),this.an=ms(r,2),this.at=ms(r,1),this.i=0,this.c=!0),this.m=i,this.as=ms(r,2),this.T=ms(r,1)}}ai(t){var e=Yr();$r(e,t),this.an=ti(this.an,this.an,e),this.at=ti(this.at,this.at,e),this.as=ti(this.as,this.as,e),this.T=ti(this.T,this.T,e),this.Q=Qe(this.Q,this.Q,t),this.m=Qe(this.m,this.m,t);for(var i=0;i<this.C.length;i++)Qe(this.C[i].a,this.C[i].a,t)}J(t,e,i){this.v[2]=i,this.v[1]=e,this.v[0]=t}w(t){if(this.aa!=t){this.aa=t;let e=t%this.al,i=e;2147483648&e&&(i=(1&e|e>>1)+(1&e|e>>1));let r=i*this.j+this.S.d;this.z.d=r;let n=t/this.al,s=n;2147483648&n&&(n=1&n|n>>1,s=n+n,r=this.z.d);let a=s*this.H+this.S.c;this.z.c=a,this.z.a=r+this.j,this.z.b=a+this.H}}f(t,e,i){let r,n=this.C[2*this.h],s=this.C[2*this.h+1],a=Le();Ve(a,this.d,1-e),Ge(a,this.O,a),Ve(n.a,a,e),Ve(a,this.p,e),He(a,this.o,a),Ve(a,a,1-e),He(n.a,n.a,a),Ve(a,this.d,1-e),Ge(a,this.x,a),Ve(s.a,a,e),Ve(a,this.p,e),He(a,this.W,a),Ve(a,a,1-e),He(s.a,s.a,a),this.L[this.h]=t,r=i,this.h=this.h+r,this.h>=this.L.length&&(this.h-=this.L.length)}n(t,e){if(this.ap.a)return;let i=Le(),r=1;i=this.l.h.g(t,this.ap.as,i),r=this.l.m.g(t,this.ap.as),this.J(i[0],i[1],i[2]),this.D(r/32767);let n=this.l.r.g(t,this.ap.as);this.k(n);let s=this.l.c.g(t,this.ap.as);this.ak(s);let a=this.l.p.g(t,this.ap.as);this.w(a);let o=this.l.b.g(t,this.ap.as,1);this.U(0!=o);let l=ni();Fi(l,this.ap.aQ,this.ap.aM[this.l.k].a),ci(l,l,this.l.l);let h=Le();this.a(l,h,null),this.ae(e,!1)}ae(t,e){let i,r,n,s,a,o,l,h,u,c,d,f,g,p,m,b,y,F,v,S,C,T,x,_,A,w,E,M,D,B,k,P,R,L,I,U,O,W,H,G,j,N,z,V,q,X,J,Y;for(this.E||this.au>0&&(t=1/this.au+99999997e-12),t>=0?this.u<=t&&(t=this.u):t=0,F=this.M;F!=this.h&&!(t+this.L[F]<=this.u);F=this.M)this.M=this.F(this.M,1);if(!e&&this.K&&this.aj&&this.c){k=t*this.au+this.i,Y=this.v,this.I();let e=!1;if(L=0,k<1?e=!0:(J=this.i,R=1/(k-J),y=Math.floor(k-1),L=Math.ceil(Math.max(y,0))),-1==L||e);else for(P=1,F=1;B=this.h,W=this.C.length,this.C[2*B].b=Y,v=2*this.h+1,H=this.C.length,this.C[v].b=Y,this.f((F-J)*R*-t,(F-J)*R,1),-1!=--L;F=P)P+=1,J=this.i;S=Math.floor(k),this.i=k-S,this.f(0,1,0),D=this.h,G=this.C.length,C=this.C[2*D],T=this.z.d,C.c[1]=this.z.c,C.c[0]=T,x=2*this.h+1,j=this.C.length,_=this.C[x],A=this.z.d,_.c[1]=this.z.b,_.c[0]=A,M=this.h,N=this.C.length,this.C[2*M].b=Y,w=2*this.h+1,z=this.C.length,this.C[w].b=Y}this.Z[2]=34028235e31,this.Z[1]=34028235e31,this.Z[0]=34028235e31,this.am[2]=-34028235e31,this.am[1]=-34028235e31,this.am[0]=-34028235e31,I=this.M;for(let e=this.M;e!=this.h;I=e)b=2*e,X=this.C.length,E=I,O=this.C[2*e],i=b+1,r=this.C[2*e+1],n=(this.af+this.af)*this.L[E]*t+t*this.af*t,O.a[2]=O.a[2]+n,r.a[2]=n+r.a[2],s=O.a[0],a=this.Z[0],a>O.a[0]&&(a=O.a[0],this.Z[0]=s,s=O.a[0]),o=O.a[1],l=this.Z[1],l>o&&(l=O.a[1],this.Z[1]=o,o=O.a[1]),h=O.a[2],u=this.Z[2],u>h&&(u=O.a[2],this.Z[2]=h,h=O.a[2]),s>this.am[0]&&(this.am[0]=s),o>this.am[1]&&(this.am[1]=o),h>this.am[2]&&(this.am[2]=h),c=r.a[0],a>r.a[0]&&(this.Z[0]=c,c=r.a[0]),d=r.a[1],l>d&&(this.Z[1]=d,d=r.a[1]),f=r.a[2],u>f&&(this.Z[2]=f,f=r.a[2]),c>this.am[0]&&(this.am[0]=c),d>this.am[1]&&(this.am[1]=d),f>this.am[2]&&(this.am[2]=f),V=this.L.length,this.L[E]=t+this.L[E],g=this.j,q=this.L.length,p=g*this.L[E]*this.ao+this.z.d,O.c[1]=this.z.c,O.c[0]=p,r.c[1]=this.z.b,r.c[0]=p,m=this.L.length,U=I+1,e=U-m,m>U&&(e=U);this.E=!0}F(t,e){let i=e+t;t=i;let r=this.L.length;return i>=r&&(t=i-r),t}q(t,e,i,r,n,s){let a,o,l,h,u,c,d,f;d=Math.ceil(t),f=Math.max(.25,e),a=Math.ceil(f*d),o=Math.ceil(Math.max(a+1+1,0)),this.L=new Array(o),this.M=0,this.h=0,this.i=0,this.c=!1,this.C=new Array(2*o);for(let t=0;t<this.C.length;t++){this.C[t]=new fs;let e=this.C[t];e.a[0]=0,e.a[1]=0,e.a[2]=0,e.b=qi(0,0,0,0),e.c[0]=0,e.c[1]=0}this.ag=new Array(4*o);for(let t=0;t<this.ag.length;t++)this.ag[t]=t%(2*o);this.ao=1/f,l=s,2147483648&s&&(l=(1&s|s>>1)+(1&s|s>>1)),this.j=(r.a-r.d)/l,h=n,2147483648&n&&(h=(1&n|n>>1)+(1&n|n>>1)),this.H=(r.b-r.c)/h,this.b=1/this.j,this.X=1/this.H,this.au=d,this.u=f,Ki(i,i,1/255),this.v=i,this.S=r,this.e=n,this.al=s,this.aa=0,u=0*this.j+this.S.d,this.z.d=u,c=0*this.H+this.S.c,this.z.c=c,this.z.a=u+this.j,this.z.b=c+this.H,this.N=10,this.ac=10,this.af=0,this.K=!0,this.aj=!0,this.aq=!0,this.ab=this.ap.N.h(0),this.V=this.ap.N.e(0),this.B=this.ap.N.c(this.ab,this.V)}Y(){let t=new Array(this.C.length);for(let e=0,i=0;e<this.C.length;++e)t[i++]=this.C[e].a[0],t[i++]=this.C[e].a[1],t[i++]=this.C[e].a[2],t[i++]=this.C[e].b[0],t[i++]=this.C[e].b[1],t[i++]=this.C[e].b[2],t[i++]=this.C[e].b[3],t[i++]=this.C[e].c[0],t[i++]=this.C[e].c[1];this.y()||(this.ab.c(new Float32Array(t)),this.V.c(new Uint16Array(this.ag)))}ad(t){const e=this.ap.N;var i=this.l.j[t];if(i<=-1||i>this.ap.aO.length)return null;let r=this.ap.aO[i];if(!r.a||!r.a.d)return null;let n=t;n>=this.l.i.length&&(n=0);let s=this.ap.ai.aa[this.l.i[n]],a=Object.assign({},this.ap.aV);const o=e.n(this.ap.aS,new rs(!1,!this.ap.i,ps[s.a],!0,!1,15),new Pi([r.a],a));return e.l(new ns(this.B,0,0),o,0,0)}ah(t){if(this.y())return;const e=this.ap.N.g();for(let i=0;i<this.l.j.length;i++){if(this.av[i]||(this.av[i]=this.ad(i)),!this.av[i])continue;if(!t&&this.av[i].c.a()>vr.GxBlend_AlphaKey)continue;let r=this.h>this.M?2*(this.h-this.M)+2:2*(this.L.length+this.h-this.M)+2;this.av[i].e=r,this.av[i].h=2*this.M*2,e.e(this.av[i])}}};const ys=class{constructor(t){var e=this;e.i=Ue(t.getFloat(),t.getFloat(),t.getFloat()),e.f=[t.getUint8(),t.getUint8(),t.getUint8(),t.getUint8()],e.d=[t.getUint8(),t.getUint8(),t.getUint8(),t.getUint8()],e.b=qi(t.getFloat(),t.getFloat(),t.getFloat(),0),e.a=t.getFloat(),e.c=t.getFloat(),e.h=t.getFloat(),e.e=t.getFloat()}g(){var t=this;t.i=null,t.b=null,t.f=null,t.d=null}};const Fs=class{constructor(t){this.a=t.skinSectionId,this.h=t.level,this.d=t.vertexStart+(t.level<<16),this.g=t.vertexCount,this.c=t.indexStart+(t.level<<16),this.i=t.indexCount,this.e=t.centerBoneIndex,this.j=Ue(t.centerPosition[0],t.centerPosition[1],t.centerPosition[2]),this.k=Ue(t.sortCenterPosition[0],t.sortCenterPosition[1],t.sortCenterPosition[2]),this.b=t.sortRadius}f(){this.j=null,this.k=null}};const vs=class{constructor(t){this.c=t.getUint16(),this.a=t.getUint16()}static b(t){const e=t.q.ai,i=t.z;e.aa&&i.m<e.aa.length?t.n=e.aa[i.m]:t.n={c:0,a:0},t.G=!!(1&t.n.c),t.w=!(4&t.n.c),t.v=!!(16&t.n.c)}};const Ss=class{constructor(t,e){this.b=Nn(t,e,!1),this.a=function(t,e,i=!0){return An.h(t,e,En,Rn,i)}(t,e,!1),this.c=Nn(t,e,!1)}d(){var t=this;t.b&&(t.b.f(),t.b=null),t.a&&(t.a.f(),t.a=null),t.c&&(t.c.f(),t.c=null)}};const Cs=class{constructor(t){var e=this;e.a=t.getInt32(),e.d=t.getInt32(),e.b=Ue(t.getFloat(),t.getFloat(),t.getFloat()),e.e=-1,t.position+=20}c(){this.b=null}};const Ts=class{constructor(t,e){this.b=Nn(t,e,!1),this.f=zn(t,e,!1)}e(){var t=this;t.b&&t.b.f(),t.f&&t.f.f()}g(t){return!!this.b&&this.b.b(t)}c(t){return!!this.f&&this.f.b(t)}a(t){return this.g(t)||this.c(t)}d(t,e,i){var r=this;i?i[0]=i[1]=i[2]=i[3]=1:i=qi(1,1,1,1);let n=Ue(1,1,1);return r.g(t.d.a)&&r.b.g(t,e,n,n),r.c(t.d.a)&&(i[3]=r.f.g(t,e,32767)/32767),i[0]=n[0],i[1]=n[1],i[2]=n[2],i}};const xs=class{constructor(t,e){this.b=zn(t,e,!1)}c(){this.b.f(),this.b=null}d(t){return this.b.b(t)}a(t,e){var i=1;this.d(t.d.a)&&(i=this.b.g(t,e,i)/32767);return i>1?i=1:i<0&&(i=0),i}};const _s=class{constructor(t,e){var i=this;i.a=t.getFloat(),i.c=t.getFloat(),i.b=t.getFloat(),i.d=Xn(t,e)}};function As(t,e,i){return(!!(t&1<<e+i)?-1:1)*(((t&~(-1<<e)<<i)>>i)+(t&~(-1<<i))/(1<<i))}const ws=class{constructor(t,e){this.q=t.getUint32(),this.l=t.getUint32(),this.W=Ue(t.getFloat(),t.getFloat(),t.getFloat()),this.I=t.getUint16(),this.o=t.getUint16(),268435456&this.l&&(this.h=[0,0,0],this.h[0]=31&this.o,this.h[1]=this.o>>5&31,this.h[2]=this.o>>10&31),t.position+=16,this.E=t.getUint8(),this.g=t.getUint8(),this.a=t.getUint16();const i=t.getUint8(),r=t.getUint8();this.F=t.getUint16(),this.f=t.getUint16(),this.V=t.getUint16(),this.n=Vn(t,e,!1),this.u=Vn(t,e,!1),this.e=Vn(t,e,!1),this.J=Vn(t,e,!1),this.y=Vn(t,e,!1),this.b=Vn(t,e,!1),this.w=t.getFloat(),this.r=Vn(t,e,!1),this.R=t.getFloat(),this.j=Vn(t,e,!1),this.N=Vn(t,e,!1),this.k=Vn(t,e,!1),this.aa=function(t,e){return _n(t,e,Hn,Pn)}(t,e.chunkData),this.A=Xn(t,e.chunkData),this.i=function(t,e){return _n(t,e,Wn,jn)}(t,e.chunkData),this.O=[t.getFloat(),t.getFloat()],this.K=Xn(t,e.chunkData),this.C=Xn(t,e.chunkData),this.Z=t.getFloat(),this.G=t.getFloat(),this.T=t.getFloat(),this.P=[t.getFloat(),t.getFloat()],this.p=t.getFloat(),this.s=t.getFloat(),this.Y=t.getFloat(),this.L=t.getFloat(),this.z=t.getFloat(),this.X=t.getFloat(),this.B=Ue(t.getFloat(),t.getFloat(),t.getFloat()),this.x=Ue(t.getFloat(),t.getFloat(),t.getFloat()),this.D=Ue(t.getFloat(),t.getFloat(),t.getFloat()),this.U=t.getFloat(),this.c=t.getFloat(),this.d=t.getFloat(),this.M=t.getFloat(),this.v=t.getFloat();const n=t.getInt32(),s=t.getInt32();if(n>0){const t=new cn(e.chunkData);t.position=s,this.S=new Array(n);for(var a=0;a<n;a++)this.S[a]=Ue(t.getFloat(),t.getFloat(),t.getFloat())}else this.S=[];this.t=qn(t,e,!1);const o=t.getUint16(),l=t.getUint16(),h=t.getUint16(),u=t.getUint16(),c=t.getUint16(),d=t.getUint16(),f=t.getUint16(),g=t.getUint16();this.H=zr(As(i,2,5),As(r,2,5)),this.Q=[zr(As(o,6,9),As(l,6,9)),zr(As(h,6,9),As(u,6,9))],this.m=[zr(As(c,6,9),As(d,6,9)),zr(As(f,6,9),As(g,6,9))]}},Es={0:"Stand",1:"Death",2:"Spell",3:"Stop",4:"Walk",5:"Run",6:"Dead",7:"Rise",8:"StandWound",9:"CombatWound",10:"CombatCritical",11:"ShuffleLeft",12:"ShuffleRight",13:"Walkbackwards",14:"Stun",15:"HandsClosed",16:"AttackUnarmed",17:"Attack1H",18:"Attack2H",19:"Attack2HL",20:"ParryUnarmed",21:"Parry1H",22:"Parry2H",23:"Parry2HL",24:"ShieldBlock",25:"ReadyUnarmed",26:"Ready1H",27:"Ready2H",28:"Ready2HL",29:"ReadyBow",30:"Dodge",31:"SpellPrecast",32:"SpellCast",33:"SpellCastArea",34:"NPCWelcome",35:"NPCGoodbye",36:"Block",37:"JumpStart",38:"Jump",39:"JumpEnd",40:"Fall",41:"SwimIdle",42:"Swim",43:"SwimLeft",44:"SwimRight",45:"SwimBackwards",46:"AttackBow",47:"FireBow",48:"ReadyRifle",49:"AttackRifle",50:"Loot",51:"ReadySpellDirected",52:"ReadySpellOmni",53:"SpellCastDirected",54:"SpellCastOmni",55:"BattleRoar",56:"ReadyAbility",57:"Special1H",58:"Special2H",59:"ShieldBash",60:"EmoteTalk",61:"EmoteEat",62:"EmoteWork",63:"EmoteUseStanding",64:"EmoteTalkExclamation",65:"EmoteTalkQuestion",66:"EmoteBow",67:"EmoteWave",68:"EmoteCheer",69:"EmoteDance",70:"EmoteLaugh",71:"EmoteSleep",72:"EmoteSitGround",73:"EmoteRude",74:"EmoteRoar",75:"EmoteKneel",76:"EmoteKiss",77:"EmoteCry",78:"EmoteChicken",79:"EmoteBeg",80:"EmoteApplaud",81:"EmoteShout",82:"EmoteFlex",83:"EmoteShy",84:"EmotePoint",85:"Attack1HPierce",86:"Attack2HLoosePierce",87:"AttackOff",88:"AttackOffPierce",89:"Sheath",90:"HipSheath",91:"Mount",92:"RunRight",93:"RunLeft",94:"MountSpecial",95:"Kick",96:"SitGroundDown",97:"SitGround",98:"SitGroundUp",99:"SleepDown",100:"Sleep",101:"SleepUp",102:"SitChairLow",103:"SitChairMed",104:"SitChairHigh",105:"LoadBow",106:"LoadRifle",107:"AttackThrown",108:"ReadyThrown",109:"HoldBow",110:"HoldRifle",111:"HoldThrown",112:"LoadThrown",113:"EmoteSalute",114:"KneelStart",115:"KneelLoop",116:"KneelEnd",117:"AttackUnarmedOff",118:"SpecialUnarmed",119:"StealthWalk",120:"StealthStand",121:"Knockdown",122:"EatingLoop",123:"UseStandingLoop",124:"ChannelCastDirected",125:"ChannelCastOmni",126:"Whirlwind",127:"Birth",128:"UseStandingStart",129:"UseStandingEnd",130:"CreatureSpecial",131:"Drown",132:"Drowned",133:"FishingCast",134:"FishingLoop",135:"Fly",136:"EmoteWorkNoSheathe",137:"EmoteStunNoSheathe",138:"EmoteUseStandingNoSheathe",139:"SpellSleepDown",140:"SpellKneelStart",141:"SpellKneelLoop",142:"SpellKneelEnd",143:"Sprint",144:"InFlight",145:"Spawn",146:"Close",147:"Closed",148:"Open",149:"Opened",150:"Destroy",151:"Destroyed",152:"Rebuild",153:"Custom0",154:"Custom1",155:"Custom2",156:"Custom3",157:"Despawn",158:"Hold",159:"Decay",160:"BowPull",161:"BowRelease",162:"ShipStart",163:"ShipMoving",164:"ShipStop",165:"GroupArrow",166:"Arrow",167:"CorpseArrow",168:"GuideArrow",169:"Sway",170:"DruidCatPounce",171:"DruidCatRip",172:"DruidCatRake",173:"DruidCatRavage",174:"DruidCatClaw",175:"DruidCatCower",176:"DruidBearSwipe",177:"DruidBearBite",178:"DruidBearMaul",179:"DruidBearBash",180:"DragonTail",181:"DragonStomp",182:"DragonSpit",183:"DragonSpitHover",184:"DragonSpitFly",185:"EmoteYes",186:"EmoteNo",187:"JumpLandRun",188:"LootHold",189:"LootUp",190:"StandHigh",191:"Impact",192:"LiftOff",193:"Hover",194:"SuccubusEntice",195:"EmoteTrain",196:"EmoteDead",197:"EmoteDanceOnce",198:"Deflect",199:"EmoteEatNoSheathe",200:"Land",201:"Submerge",202:"Submerged",203:"Cannibalize",204:"ArrowBirth",205:"GroupArrowBirth",206:"CorpseArrowBirth",207:"GuideArrowBirth",208:"EmoteTalkNoSheathe",209:"EmotePointNoSheathe",210:"EmoteSaluteNoSheathe",211:"EmoteDanceSpecial",212:"Mutilate",213:"CustomSpell01",214:"CustomSpell02",215:"CustomSpell03",216:"CustomSpell04",217:"CustomSpell05",218:"CustomSpell06",219:"CustomSpell07",220:"CustomSpell08",221:"CustomSpell09",222:"CustomSpell10",223:"StealthRun",224:"Emerge",225:"Cower",226:"Grab",227:"GrabClosed",228:"GrabThrown",229:"FlyStand",230:"FlyDeath",231:"FlySpell",232:"FlyStop",233:"FlyWalk",234:"FlyRun",235:"FlyDead",236:"FlyRise",237:"FlyStandWound",238:"FlyCombatWound",239:"FlyCombatCritical",240:"FlyShuffleLeft",241:"FlyShuffleRight",242:"FlyWalkbackwards",243:"FlyStun",244:"FlyHandsClosed",245:"FlyAttackUnarmed",246:"FlyAttack1H",247:"FlyAttack2H",248:"FlyAttack2HL",249:"FlyParryUnarmed",250:"FlyParry1H",251:"FlyParry2H",252:"FlyParry2HL",253:"FlyShieldBlock",254:"FlyReadyUnarmed",255:"FlyReady1H",256:"FlyReady2H",257:"FlyReady2HL",258:"FlyReadyBow",259:"FlyDodge",260:"FlySpellPrecast",261:"FlySpellCast",262:"FlySpellCastArea",263:"FlyNPCWelcome",264:"FlyNPCGoodbye",265:"FlyBlock",266:"FlyJumpStart",267:"FlyJump",268:"FlyJumpEnd",269:"FlyFall",270:"FlySwimIdle",271:"FlySwim",272:"FlySwimLeft",273:"FlySwimRight",274:"FlySwimBackwards",275:"FlyAttackBow",276:"FlyFireBow",277:"FlyReadyRifle",278:"FlyAttackRifle",279:"FlyLoot",280:"FlyReadySpellDirected",281:"FlyReadySpellOmni",282:"FlySpellCastDirected",283:"FlySpellCastOmni",284:"FlyBattleRoar",285:"FlyReadyAbility",286:"FlySpecial1H",287:"FlySpecial2H",288:"FlyShieldBash",289:"FlyEmoteTalk",290:"FlyEmoteEat",291:"FlyEmoteWork",292:"FlyEmoteUseStanding",293:"FlyEmoteTalkExclamation",294:"FlyEmoteTalkQuestion",295:"FlyEmoteBow",296:"FlyEmoteWave",297:"FlyEmoteCheer",298:"FlyEmoteDance",299:"FlyEmoteLaugh",300:"FlyEmoteSleep",301:"FlyEmoteSitGround",302:"FlyEmoteRude",303:"FlyEmoteRoar",304:"FlyEmoteKneel",305:"FlyEmoteKiss",306:"FlyEmoteCry",307:"FlyEmoteChicken",308:"FlyEmoteBeg",309:"FlyEmoteApplaud",310:"FlyEmoteShout",311:"FlyEmoteFlex",312:"FlyEmoteShy",313:"FlyEmotePoint",314:"FlyAttack1HPierce",315:"FlyAttack2HLoosePierce",316:"FlyAttackOff",317:"FlyAttackOffPierce",318:"FlySheath",319:"FlyHipSheath",320:"FlyMount",321:"FlyRunRight",322:"FlyRunLeft",323:"FlyMountSpecial",324:"FlyKick",325:"FlySitGroundDown",326:"FlySitGround",327:"FlySitGroundUp",328:"FlySleepDown",329:"FlySleep",330:"FlySleepUp",331:"FlySitChairLow",332:"FlySitChairMed",333:"FlySitChairHigh",334:"FlyLoadBow",335:"FlyLoadRifle",336:"FlyAttackThrown",337:"FlyReadyThrown",338:"FlyHoldBow",339:"FlyHoldRifle",340:"FlyHoldThrown",341:"FlyLoadThrown",342:"FlyEmoteSalute",343:"FlyKneelStart",344:"FlyKneelLoop",345:"FlyKneelEnd",346:"FlyAttackUnarmedOff",347:"FlySpecialUnarmed",348:"FlyStealthWalk",349:"FlyStealthStand",350:"FlyKnockdown",351:"FlyEatingLoop",352:"FlyUseStandingLoop",353:"FlyChannelCastDirected",354:"FlyChannelCastOmni",355:"FlyWhirlwind",356:"FlyBirth",357:"FlyUseStandingStart",358:"FlyUseStandingEnd",359:"FlyCreatureSpecial",360:"FlyDrown",361:"FlyDrowned",362:"FlyFishingCast",363:"FlyFishingLoop",364:"FlyFly",365:"FlyEmoteWorkNoSheathe",366:"FlyEmoteStunNoSheathe",367:"FlyEmoteUseStandingNoSheathe",368:"FlySpellSleepDown",369:"FlySpellKneelStart",370:"FlySpellKneelLoop",371:"FlySpellKneelEnd",372:"FlySprint",373:"FlyInFlight",374:"FlySpawn",375:"FlyClose",376:"FlyClosed",377:"FlyOpen",378:"FlyOpened",379:"FlyDestroy",380:"FlyDestroyed",381:"FlyRebuild",382:"FlyCustom0",383:"FlyCustom1",384:"FlyCustom2",385:"FlyCustom3",386:"FlyDespawn",387:"FlyHold",388:"FlyDecay",389:"FlyBowPull",390:"FlyBowRelease",391:"FlyShipStart",392:"FlyShipMoving",393:"FlyShipStop",394:"FlyGroupArrow",395:"FlyArrow",396:"FlyCorpseArrow",397:"FlyGuideArrow",398:"FlySway",399:"FlyDruidCatPounce",400:"FlyDruidCatRip",401:"FlyDruidCatRake",402:"FlyDruidCatRavage",403:"FlyDruidCatClaw",404:"FlyDruidCatCower",405:"FlyDruidBearSwipe",406:"FlyDruidBearBite",407:"FlyDruidBearMaul",408:"FlyDruidBearBash",409:"FlyDragonTail",410:"FlyDragonStomp",411:"FlyDragonSpit",412:"FlyDragonSpitHover",413:"FlyDragonSpitFly",414:"FlyEmoteYes",415:"FlyEmoteNo",416:"FlyJumpLandRun",417:"FlyLootHold",418:"FlyLootUp",419:"FlyStandHigh",420:"FlyImpact",421:"FlyLiftOff",422:"FlyHover",423:"FlySuccubusEntice",424:"FlyEmoteTrain",425:"FlyEmoteDead",426:"FlyEmoteDanceOnce",427:"FlyDeflect",428:"FlyEmoteEatNoSheathe",429:"FlyLand",430:"FlySubmerge",431:"FlySubmerged",432:"FlyCannibalize",433:"FlyArrowBirth",434:"FlyGroupArrowBirth",435:"FlyCorpseArrowBirth",436:"FlyGuideArrowBirth",437:"FlyEmoteTalkNoSheathe",438:"FlyEmotePointNoSheathe",439:"FlyEmoteSaluteNoSheathe",440:"FlyEmoteDanceSpecial",441:"FlyMutilate",442:"FlyCustomSpell01",443:"FlyCustomSpell02",444:"FlyCustomSpell03",445:"FlyCustomSpell04",446:"FlyCustomSpell05",447:"FlyCustomSpell06",448:"FlyCustomSpell07",449:"FlyCustomSpell08",450:"FlyCustomSpell09",451:"FlyCustomSpell10",452:"FlyStealthRun",453:"FlyEmerge",454:"FlyCower",455:"FlyGrab",456:"FlyGrabClosed",457:"FlyGrabThrown",458:"ToFly",459:"ToHover",460:"ToGround",461:"FlyToFly",462:"FlyToHover",463:"FlyToGround",464:"Settle",465:"FlySettle",466:"DeathStart",467:"DeathLoop",468:"DeathEnd",469:"FlyDeathStart",470:"FlyDeathLoop",471:"FlyDeathEnd",472:"DeathEndHold",473:"FlyDeathEndHold",474:"Strangulate",475:"FlyStrangulate",476:"ReadyJoust",477:"LoadJoust",478:"HoldJoust",479:"FlyReadyJoust",480:"FlyLoadJoust",481:"FlyHoldJoust",482:"AttackJoust",483:"FlyAttackJoust",484:"ReclinedMount",485:"FlyReclinedMount",486:"ToAltered",487:"FromAltered",488:"FlyToAltered",489:"FlyFromAltered",490:"InStocks",491:"FlyInStocks",492:"VehicleGrab",493:"VehicleThrow",494:"FlyVehicleGrab",495:"FlyVehicleThrow",496:"ToAlteredPostSwap",497:"FromAlteredPostSwap",498:"FlyToAlteredPostSwap",499:"FlyFromAlteredPostSwap",500:"ReclinedMountPassenger",501:"FlyReclinedMountPassenger",502:"Carry2H",503:"Carried2H",504:"FlyCarry2H",505:"FlyCarried2H",506:"EmoteSniff",507:"EmoteFlySniff",508:"AttackFist1H",509:"FlyAttackFist1H",510:"AttackFist1HOff",511:"FlyAttackFist1HOff",512:"ParryFist1H",513:"FlyParryFist1H",514:"ReadyFist1H",515:"FlyReadyFist1H",516:"SpecialFist1H",517:"FlySpecialFist1H",518:"EmoteReadStart",519:"FlyEmoteReadStart",520:"EmoteReadLoop",521:"FlyEmoteReadLoop",522:"EmoteReadEnd",523:"FlyEmoteReadEnd",524:"SwimRun",525:"FlySwimRun",526:"SwimWalk",527:"FlySwimWalk",528:"SwimWalkBackwards",529:"FlySwimWalkBackwards",530:"SwimSprint",531:"FlySwimSprint",532:"MountSwimIdle",533:"FlyMountSwimIdle",534:"MountSwimBackwards",535:"FlyMountSwimBackwards",536:"MountSwimLeft",537:"FlyMountSwimLeft",538:"MountSwimRight",539:"FlyMountSwimRight",540:"MountSwimRun",541:"FlyMountSwimRun",542:"MountSwimSprint",543:"FlyMountSwimSprint",544:"MountSwimWalk",545:"FlyMountSwimWalk",546:"MountSwimWalkBackwards",547:"FlyMountSwimWalkBackwards",548:"MountFlightIdle",549:"FlyMountFlightIdle",550:"MountFlightBackwards",551:"FlyMountFlightBackwards",552:"MountFlightLeft",553:"FlyMountFlightLeft",554:"MountFlightRight",555:"FlyMountFlightRight",556:"MountFlightRun",557:"FlyMountFlightRun",558:"MountFlightSprint",559:"FlyMountFlightSprint",560:"MountFlightWalk",561:"FlyMountFlightWalk",562:"MountFlightWalkBackwards",563:"FlyMountFlightWalkBackwards",564:"MountFlightStart",565:"FlyMountFlightStart",566:"MountSwimStart",567:"FlyMountSwimStart",568:"MountSwimLand",569:"FlyMountSwimLand",570:"MountSwimLandRun",571:"FlyMountSwimLandRun",572:"MountFlightLand",573:"FlyMountFlightLand",574:"MountFlightLandRun",575:"FlyMountFlightLandRun",576:"ReadyBlowDart",577:"FlyReadyBlowDart",578:"LoadBlowDart",579:"FlyLoadBlowDart",580:"HoldBlowDart",581:"FlyHoldBlowDart",582:"AttackBlowDart",583:"FlyAttackBlowDart",584:"CarriageMount",585:"FlyCarriageMount",586:"CarriagePassengerMount",587:"FlyCarriagePassengerMount",588:"CarriageMountAttack",589:"FlyCarriageMountAttack",590:"BarTendStand",591:"FlyBarTendStand",592:"BarServerWalk",593:"FlyBarServerWalk",594:"BarServerRun",595:"FlyBarServerRun",596:"BarServerShuffleLeft",597:"FlyBarServerShuffleLeft",598:"BarServerShuffleRight",599:"FlyBarServerShuffleRight",600:"BarTendEmoteTalk",601:"FlyBarTendEmoteTalk",602:"BarTendEmotePoint",603:"FlyBarTendEmotePoint",604:"BarServerStand",605:"FlyBarServerStand",606:"BarSweepWalk",607:"FlyBarSweepWalk",608:"BarSweepRun",609:"FlyBarSweepRun",610:"BarSweepShuffleLeft",611:"FlyBarSweepShuffleLeft",612:"BarSweepShuffleRight",613:"FlyBarSweepShuffleRight",614:"BarSweepEmoteTalk",615:"FlyBarSweepEmoteTalk",616:"BarPatronSitEmotePoint",617:"FlyBarPatronSitEmotePoint",618:"MountSelfIdle",619:"FlyMountSelfIdle",620:"MountSelfWalk",621:"FlyMountSelfWalk",622:"MountSelfRun",623:"FlyMountSelfRun",624:"MountSelfSprint",625:"FlyMountSelfSprint",626:"MountSelfRunLeft",627:"FlyMountSelfRunLeft",628:"MountSelfRunRight",629:"FlyMountSelfRunRight",630:"MountSelfShuffleLeft",631:"FlyMountSelfShuffleLeft",632:"MountSelfShuffleRight",633:"FlyMountSelfShuffleRight",634:"MountSelfWalkBackwards",635:"FlyMountSelfWalkBackwards",636:"MountSelfSpecial",637:"FlyMountSelfSpecial",638:"MountSelfJump",639:"FlyMountSelfJump",640:"MountSelfJumpStart",641:"FlyMountSelfJumpStart",642:"MountSelfJumpEnd",643:"FlyMountSelfJumpEnd",644:"MountSelfJumpLandRun",645:"FlyMountSelfJumpLandRun",646:"MountSelfStart",647:"FlyMountSelfStart",648:"MountSelfFall",649:"FlyMountSelfFall",650:"Stormstrike",651:"FlyStormstrike",652:"ReadyJoustNoSheathe",653:"FlyReadyJoustNoSheathe",654:"Slam",655:"FlySlam",656:"DeathStrike",657:"FlyDeathStrike",658:"SwimAttackUnarmed",659:"FlySwimAttackUnarmed",660:"SpinningKick",661:"FlySpinningKick",662:"RoundHouseKick",663:"FlyRoundHouseKick",664:"RollStart",665:"FlyRollStart",666:"Roll",667:"FlyRoll",668:"RollEnd",669:"FlyRollEnd",670:"PalmStrike",671:"FlyPalmStrike",672:"MonkOffenseAttackUnarmed",673:"FlyMonkOffenseAttackUnarmed",674:"MonkOffenseAttackUnarmedOff",675:"FlyMonkOffenseAttackUnarmedOff",676:"MonkOffenseParryUnarmed",677:"FlyMonkOffenseParryUnarmed",678:"MonkOffenseReadyUnarmed",679:"FlyMonkOffenseReadyUnarmed",680:"MonkOffenseSpecialUnarmed",681:"FlyMonkOffenseSpecialUnarmed",682:"MonkDefenseAttackUnarmed",683:"FlyMonkDefenseAttackUnarmed",684:"MonkDefenseAttackUnarmedOff",685:"FlyMonkDefenseAttackUnarmedOff",686:"MonkDefenseParryUnarmed",687:"FlyMonkDefenseParryUnarmed",688:"MonkDefenseReadyUnarmed",689:"FlyMonkDefenseReadyUnarmed",690:"MonkDefenseSpecialUnarmed",691:"FlyMonkDefenseSpecialUnarmed",692:"MonkHealAttackUnarmed",693:"FlyMonkHealAttackUnarmed",694:"MonkHealAttackUnarmedOff",695:"FlyMonkHealAttackUnarmedOff",696:"MonkHealParryUnarmed",697:"FlyMonkHealParryUnarmed",698:"MonkHealReadyUnarmed",699:"FlyMonkHealReadyUnarmed",700:"MonkHealSpecialUnarmed",701:"FlyMonkHealSpecialUnarmed",702:"FlyingKick",703:"FlyFlyingKick",704:"FlyingKickStart",705:"FlyFlyingKickStart",706:"FlyingKickEnd",707:"FlyFlyingKickEnd",708:"CraneStart",709:"FlyCraneStart",710:"CraneLoop",711:"FlyCraneLoop",712:"CraneEnd",713:"FlyCraneEnd",714:"Despawned",715:"FlyDespawned",716:"ThousandFists",717:"FlyThousandFists",718:"MonkHealReadySpellDirected",719:"FlyMonkHealReadySpellDirected",720:"MonkHealReadySpellOmni",721:"FlyMonkHealReadySpellOmni",722:"MonkHealSpellCastDirected",723:"FlyMonkHealSpellCastDirected",724:"MonkHealSpellCastOmni",725:"FlyMonkHealSpellCastOmni",726:"MonkHealChannelCastDirected",727:"FlyMonkHealChannelCastDirected",728:"MonkHealChannelCastOmni",729:"FlyMonkHealChannelCastOmni",730:"Torpedo",731:"FlyTorpedo",732:"Meditate",733:"FlyMeditate",734:"BreathOfFire",735:"FlyBreathOfFire",736:"RisingSunKick",737:"FlyRisingSunKick",738:"GroundKick",739:"FlyGroundKick",740:"KickBack",741:"FlyKickBack",742:"PetBattleStand",743:"FlyPetBattleStand",744:"PetBattleDeath",745:"FlyPetBattleDeath",746:"PetBattleRun",747:"FlyPetBattleRun",748:"PetBattleWound",749:"FlyPetBattleWound",750:"PetBattleAttack",751:"FlyPetBattleAttack",752:"PetBattleReadySpell",753:"FlyPetBattleReadySpell",754:"PetBattleSpellCast",755:"FlyPetBattleSpellCast",756:"PetBattleCustom0",757:"FlyPetBattleCustom0",758:"PetBattleCustom1",759:"FlyPetBattleCustom1",760:"PetBattleCustom2",761:"FlyPetBattleCustom2",762:"PetBattleCustom3",763:"FlyPetBattleCustom3",764:"PetBattleVictory",765:"FlyPetBattleVictory",766:"PetBattleLoss",767:"FlyPetBattleLoss",768:"PetBattleStun",769:"FlyPetBattleStun",770:"PetBattleDead",771:"FlyPetBattleDead",772:"PetBattleFreeze",773:"FlyPetBattleFreeze",774:"MonkOffenseAttackWeapon",775:"FlyMonkOffenseAttackWeapon",776:"BarTendEmoteWave",777:"FlyBarTendEmoteWave",778:"BarServerEmoteTalk",779:"FlyBarServerEmoteTalk",780:"BarServerEmoteWave",781:"FlyBarServerEmoteWave",782:"BarServerPourDrinks",783:"FlyBarServerPourDrinks",784:"BarServerPickup",785:"FlyBarServerPickup",786:"BarServerPutDown",787:"FlyBarServerPutDown",788:"BarSweepStand",789:"FlyBarSweepStand",790:"BarPatronSit",791:"FlyBarPatronSit",792:"BarPatronSitEmoteTalk",793:"FlyBarPatronSitEmoteTalk",794:"BarPatronStand",795:"FlyBarPatronStand",796:"BarPatronStandEmoteTalk",797:"FlyBarPatronStandEmoteTalk",798:"BarPatronStandEmotePoint",799:"FlyBarPatronStandEmotePoint",800:"CarrionSwarm",801:"FlyCarrionSwarm",802:"WheelLoop",803:"FlyWheelLoop",804:"StandCharacterCreate",805:"FlyStandCharacterCreate",806:"MountChopper",807:"FlyMountChopper",808:"FacePose",809:"FlyFacePose",810:"CombatAbility2HBig01",811:"FlyCombatAbility2HBig01",812:"CombatAbility2H01",813:"FlyCombatAbility2H01",814:"CombatWhirlwind",815:"FlyCombatWhirlwind",816:"CombatChargeLoop",817:"FlyCombatChargeLoop",818:"CombatAbility1H01",819:"FlyCombatAbility1H01",820:"CombatChargeEnd",821:"FlyCombatChargeEnd",822:"CombatAbility1H02",823:"FlyCombatAbility1H02",824:"CombatAbility1HBig01",825:"FlyCombatAbility1HBig01",826:"CombatAbility2H02",827:"FlyCombatAbility2H02",828:"ShaSpellPrecastBoth",829:"FlyShaSpellPrecastBoth",830:"ShaSpellCastBothFront",831:"FlyShaSpellCastBothFront",832:"ShaSpellCastLeftFront",833:"FlyShaSpellCastLeftFront",834:"ShaSpellCastRightFront",835:"FlyShaSpellCastRightFront",836:"ReadyCrossbow",837:"FlyReadyCrossbow",838:"LoadCrossbow",839:"FlyLoadCrossbow",840:"AttackCrossbow",841:"FlyAttackCrossbow",842:"HoldCrossbow",843:"FlyHoldCrossbow",844:"CombatAbility2HL01",845:"FlyCombatAbility2HL01",846:"CombatAbility2HL02",847:"FlyCombatAbility2HL02",848:"CombatAbility2HLBig01",849:"FlyCombatAbility2HLBig01",850:"CombatUnarmed01",851:"FlyCombatUnarmed01",852:"CombatStompLeft",853:"FlyCombatStompLeft",854:"CombatStompRight",855:"FlyCombatStompRight",856:"CombatLeapLoop",857:"FlyCombatLeapLoop",858:"CombatLeapEnd",859:"FlyCombatLeapEnd",860:"ShaReadySpellCast",861:"FlyShaReadySpellCast",862:"ShaSpellPrecastBothChannel",863:"FlyShaSpellPrecastBothChannel",864:"ShaSpellCastBothUp",865:"FlyShaSpellCastBothUp",866:"ShaSpellCastBothUpChannel",867:"FlyShaSpellCastBothUpChannel",868:"ShaSpellCastBothFrontChannel",869:"FlyShaSpellCastBothFrontChannel",870:"ShaSpellCastLeftFrontChannel",871:"FlyShaSpellCastLeftFrontChannel",872:"ShaSpellCastRightFrontChannel",873:"FlyShaSpellCastRightFrontChannel",874:"PriReadySpellCast",875:"FlyPriReadySpellCast",876:"PriSpellPrecastBoth",877:"FlyPriSpellPrecastBoth",878:"PriSpellPrecastBothChannel",879:"FlyPriSpellPrecastBothChannel",880:"PriSpellCastBothUp",881:"FlyPriSpellCastBothUp",882:"PriSpellCastBothFront",883:"FlyPriSpellCastBothFront",884:"PriSpellCastLeftFront",885:"FlyPriSpellCastLeftFront",886:"PriSpellCastRightFront",887:"FlyPriSpellCastRightFront",888:"PriSpellCastBothUpChannel",889:"FlyPriSpellCastBothUpChannel",890:"PriSpellCastBothFrontChannel",891:"FlyPriSpellCastBothFrontChannel",892:"PriSpellCastLeftFrontChannel",893:"FlyPriSpellCastLeftFrontChannel",894:"PriSpellCastRightFrontChannel",895:"FlyPriSpellCastRightFrontChannel",896:"MagReadySpellCast",897:"FlyMagReadySpellCast",898:"MagSpellPrecastBoth",899:"FlyMagSpellPrecastBoth",900:"MagSpellPrecastBothChannel",901:"FlyMagSpellPrecastBothChannel",902:"MagSpellCastBothUp",903:"FlyMagSpellCastBothUp",904:"MagSpellCastBothFront",905:"FlyMagSpellCastBothFront",906:"MagSpellCastLeftFront",907:"FlyMagSpellCastLeftFront",908:"MagSpellCastRightFront",909:"FlyMagSpellCastRightFront",910:"MagSpellCastBothUpChannel",911:"FlyMagSpellCastBothUpChannel",912:"MagSpellCastBothFrontChannel",913:"FlyMagSpellCastBothFrontChannel",914:"MagSpellCastLeftFrontChannel",915:"FlyMagSpellCastLeftFrontChannel",916:"MagSpellCastRightFrontChannel",917:"FlyMagSpellCastRightFrontChannel",918:"LocReadySpellCast",919:"FlyLocReadySpellCast",920:"LocSpellPrecastBoth",921:"FlyLocSpellPrecastBoth",922:"LocSpellPrecastBothChannel",923:"FlyLocSpellPrecastBothChannel",924:"LocSpellCastBothUp",925:"FlyLocSpellCastBothUp",926:"LocSpellCastBothFront",927:"FlyLocSpellCastBothFront",928:"LocSpellCastLeftFront",929:"FlyLocSpellCastLeftFront",930:"LocSpellCastRightFront",931:"FlyLocSpellCastRightFront",932:"LocSpellCastBothUpChannel",933:"FlyLocSpellCastBothUpChannel",934:"LocSpellCastBothFrontChannel",935:"FlyLocSpellCastBothFrontChannel",936:"LocSpellCastLeftFrontChannel",937:"FlyLocSpellCastLeftFrontChannel",938:"LocSpellCastRightFrontChannel",939:"FlyLocSpellCastRightFrontChannel",940:"DruReadySpellCast",941:"FlyDruReadySpellCast",942:"DruSpellPrecastBoth",943:"FlyDruSpellPrecastBoth",944:"DruSpellPrecastBothChannel",945:"FlyDruSpellPrecastBothChannel",946:"DruSpellCastBothUp",947:"FlyDruSpellCastBothUp",948:"DruSpellCastBothFront",949:"FlyDruSpellCastBothFront",950:"DruSpellCastLeftFront",951:"FlyDruSpellCastLeftFront",952:"DruSpellCastRightFront",953:"FlyDruSpellCastRightFront",954:"DruSpellCastBothUpChannel",955:"FlyDruSpellCastBothUpChannel",956:"DruSpellCastBothFrontChannel",957:"FlyDruSpellCastBothFrontChannel",958:"DruSpellCastLeftFrontChannel",959:"FlyDruSpellCastLeftFrontChannel",960:"DruSpellCastRightFrontChannel",961:"FlyDruSpellCastRightFrontChannel",962:"ArtMainLoop",963:"FlyArtMainLoop",964:"ArtDualLoop",965:"FlyArtDualLoop",966:"ArtFistsLoop",967:"FlyArtFistsLoop",968:"ArtBowLoop",969:"FlyArtBowLoop",970:"CombatAbility1H01Off",971:"FlyCombatAbility1H01Off",972:"CombatAbility1H02Off",973:"FlyCombatAbility1H02Off",974:"CombatFuriousStrike01",975:"FlyCombatFuriousStrike01",976:"CombatFuriousStrike02",977:"FlyCombatFuriousStrike02",978:"CombatFuriousStrikes",979:"FlyCombatFuriousStrikes",980:"CombatReadySpellCast",981:"FlyCombatReadySpellCast",982:"CombatShieldThrow",983:"FlyCombatShieldThrow",984:"PalSpellCast1HUp",985:"FlyPalSpellCast1HUp",986:"CombatReadyPostSpellCast",987:"FlyCombatReadyPostSpellCast",988:"PriReadyPostSpellCast",989:"FlyPriReadyPostSpellCast",990:"DHCombatRun",991:"FlyDHCombatRun",992:"CombatShieldBash",993:"FlyCombatShieldBash",994:"CombatThrow",995:"FlyCombatThrow",996:"CombatAbility1HPierce",997:"FlyCombatAbility1HPierce",998:"CombatAbility1HOffPierce",999:"FlyCombatAbility1HOffPierce",1e3:"CombatMutilate",1001:"FlyCombatMutilate",1002:"CombatBladeStorm",1003:"FlyCombatBladeStorm",1004:"CombatFinishingMove",1005:"FlyCombatFinishingMove",1006:"CombatLeapStart",1007:"FlyCombatLeapStart",1008:"GlvThrowMain",1009:"FlyGlvThrowMain",1010:"GlvThrownOff",1011:"FlyGlvThrownOff",1012:"DHCombatSprint",1013:"FlyDHCombatSprint",1014:"CombatAbilityGlv01",1015:"FlyCombatAbilityGlv01",1016:"CombatAbilityGlv02",1017:"FlyCombatAbilityGlv02",1018:"CombatAbilityGlvOff01",1019:"FlyCombatAbilityGlvOff01",1020:"CombatAbilityGlvOff02",1021:"FlyCombatAbilityGlvOff02",1022:"CombatAbilityGlvBig01",1023:"FlyCombatAbilityGlvBig01",1024:"CombatAbilityGlvBig02",1025:"FlyCombatAbilityGlvBig02",1026:"ReadyGlv",1027:"FlyReadyGlv",1028:"CombatAbilityGlvBig03",1029:"FlyCombatAbilityGlvBig03",1030:"DoubleJumpStart",1031:"FlyDoubleJumpStart",1032:"DoubleJump",1033:"FlyDoubleJump",1034:"CombatEviscerate",1035:"FlyCombatEviscerate",1036:"DoubleJumpLandRun",1037:"FlyDoubleJumpLandRun",1038:"BackFlipStart",1039:"FlyBackFlipStart",1040:"BackFlipLoop",1041:"FlyBackFlipLoop",1042:"FelRushLoop",1043:"FlyFelRushLoop",1044:"FelRushEnd",1045:"FlyFelRushEnd",1046:"DHToAlteredStart",1047:"FlyDHToAlteredStart",1048:"DHToAlteredEnd",1049:"FlyDHToAlteredEnd",1050:"DHGlide",1051:"FlyDHGlide",1052:"FanOfKnives",1053:"FlyFanOfKnives",1054:"SingleJumpStart",1055:"FlySingleJumpStart",1056:"DHBladeDance1",1057:"FlyDHBladeDance1",1058:"DHBladeDance2",1059:"FlyDHBladeDance2",1060:"DHBladeDance3",1061:"FlyDHBladeDance3",1062:"DHMeteorStrike",1063:"FlyDHMeteorStrike",1064:"CombatExecute",1065:"FlyCombatExecute",1066:"ArtLoop",1067:"FlyArtLoop",1068:"ParryGlv",1069:"FlyParryGlv",1070:"CombatUnarmed02",1071:"FlyCombatUnarmed02",1072:"CombatPistolShot",1073:"FlyCombatPistolShot",1074:"CombatPistolShotOff",1075:"FlyCombatPistolShotOff",1076:"Monk2HLIdle",1077:"FlyMonk2HLIdle",1078:"ArtShieldLoop",1079:"FlyArtShieldLoop",1080:"CombatAbility2H03",1081:"FlyCombatAbility2H03",1082:"CombatStomp",1083:"FlyCombatStomp",1084:"CombatRoar",1085:"FlyCombatRoar",1086:"PalReadySpellCast",1087:"FlyPalReadySpellCast",1088:"PalSpellPrecastRight",1089:"FlyPalSpellPrecastRight",1090:"PalSpellPrecastRightChannel",1091:"FlyPalSpellPrecastRightChannel",1092:"PalSpellCastRightFront",1093:"FlyPalSpellCastRightFront",1094:"ShaSpellCastBothOut",1095:"FlyShaSpellCastBothOut",1096:"AttackWeapon",1097:"FlyAttackWeapon",1098:"ReadyWeapon",1099:"FlyReadyWeapon",1100:"AttackWeaponOff",1101:"FlyAttackWeaponOff",1102:"SpecialDual",1103:"FlySpecialDual",1104:"DkCast1HFront",1105:"FlyDkCast1HFront",1106:"CastStrongRight",1107:"FlyCastStrongRight",1108:"CastStrongLeft",1109:"FlyCastStrongLeft",1110:"CastCurseRight",1111:"FlyCastCurseRight",1112:"CastCurseLeft",1113:"FlyCastCurseLeft",1114:"CastSweepRight",1115:"FlyCastSweepRight",1116:"CastSweepLeft",1117:"FlyCastSweepLeft",1118:"CastStrongUpLeft",1119:"FlyCastStrongUpLeft",1120:"CastTwistUpBoth",1121:"FlyCastTwistUpBoth",1122:"CastOutStrong",1123:"FlyCastOutStrong",1124:"DrumLoop",1125:"FlyDrumLoop",1126:"ParryWeapon",1127:"FlyParryWeapon",1128:"ReadyFL",1129:"FlyReadyFL",1130:"AttackFL",1131:"FlyAttackFL",1132:"AttackFLOff",1133:"FlyAttackFLOff",1134:"ParryFL",1135:"FlyParryFL",1136:"SpecialFL",1137:"FlySpecialFL",1138:"PriHoverForward",1139:"FlyPriHoverForward",1140:"PriHoverBackward",1141:"FlyPriHoverBackward",1142:"PriHoverRight",1143:"FlyPriHoverRight",1144:"PriHoverLeft",1145:"FlyPriHoverLeft",1146:"RunBackwards",1147:"FlyRunBackwards",1148:"CastStrongUpRight",1149:"FlyCastStrongUpRight",1150:"WAWalk",1151:"FlyWAWalk",1152:"WARun",1153:"FlyWARun",1154:"WADrunkStand",1155:"FlyWADrunkStand",1156:"WADrunkShuffleLeft",1157:"FlyWADrunkShuffleLeft",1158:"WADrunkShuffleRight",1159:"FlyWADrunkShuffleRight",1160:"WADrunkWalk",1161:"FlyWADrunkWalk",1162:"WADrunkWalkBackwards",1163:"FlyWADrunkWalkBackwards",1164:"WADrunkWound",1165:"FlyWADrunkWound",1166:"WADrunkTalk",1167:"FlyWADrunkTalk",1168:"WATrance01",1169:"FlyWATrance01",1170:"WATrance02",1171:"FlyWATrance02",1172:"WAChant01",1173:"FlyWAChant01",1174:"WAChant02",1175:"FlyWAChant02",1176:"WAChant03",1177:"FlyWAChant03",1178:"WAHang01",1179:"FlyWAHang01",1180:"WAHang02",1181:"FlyWAHang02",1182:"WASummon01",1183:"FlyWASummon01",1184:"WASummon02",1185:"FlyWASummon02",1186:"WABeggarTalk",1187:"FlyWABeggarTalk",1188:"WABeggarStand",1189:"FlyWABeggarStand",1190:"WABeggarPoint",1191:"FlyWABeggarPoint",1192:"WABeggarBeg",1193:"FlyWABeggarBeg",1194:"WASit01",1195:"FlyWASit01",1196:"WASit02",1197:"FlyWASit02",1198:"WASit03",1199:"FlyWASit03",1200:"WACrierStand01",1201:"FlyWACrierStand01",1202:"WACrierStand02",1203:"FlyWACrierStand02",1204:"WACrierStand03",1205:"FlyWACrierStand03",1206:"WACrierTalk",1207:"FlyWACrierTalk",1208:"WACrateHold",1209:"FlyWACrateHold",1210:"WABarrelHold",1211:"FlyWABarrelHold",1212:"WASackHold",1213:"FlyWASackHold",1214:"WAWheelBarrowStand",1215:"FlyWAWheelBarrowStand",1216:"WAWheelBarrowWalk",1217:"FlyWAWheelBarrowWalk",1218:"WAWheelBarrowRun",1219:"FlyWAWheelBarrowRun",1220:"WAHammerLoop",1221:"FlyWAHammerLoop",1222:"WACrankLoop",1223:"FlyWACrankLoop",1224:"WAPourStart",1225:"FlyWAPourStart",1226:"WAPourLoop",1227:"FlyWAPourLoop",1228:"WAPourEnd",1229:"FlyWAPourEnd",1230:"WAEmotePour",1231:"FlyWAEmotePour",1232:"WARowingStandRight",1233:"FlyWARowingStandRight",1234:"WARowingStandLeft",1235:"FlyWARowingStandLeft",1236:"WARowingRight",1237:"FlyWARowingRight",1238:"WARowingLeft",1239:"FlyWARowingLeft",1240:"WAGuardStand01",1241:"FlyWAGuardStand01",1242:"WAGuardStand02",1243:"FlyWAGuardStand02",1244:"WAGuardStand03",1245:"FlyWAGuardStand03",1246:"WAGuardStand04",1247:"FlyWAGuardStand04",1248:"WAFreezing01",1249:"FlyWAFreezing01",1250:"WAFreezing02",1251:"FlyWAFreezing02",1252:"WAVendorStand01",1253:"FlyWAVendorStand01",1254:"WAVendorStand02",1255:"FlyWAVendorStand02",1256:"WAVendorStand03",1257:"FlyWAVendorStand03",1258:"WAVendorTalk",1259:"FlyWAVendorTalk",1260:"WALean01",1261:"FlyWALean01",1262:"WALean02",1263:"FlyWALean02",1264:"WALean03",1265:"FlyWALean03",1266:"WALeanTalk",1267:"FlyWALeanTalk",1268:"WABoatWheel",1269:"FlyWABoatWheel",1270:"WASmithLoop",1271:"FlyWASmithLoop",1272:"WAScrubbing",1273:"FlyWAScrubbing",1274:"WAWeaponSharpen",1275:"FlyWAWeaponSharpen",1276:"WAStirring",1277:"FlyWAStirring",1278:"WAPerch01",1279:"FlyWAPerch01",1280:"WAPerch02",1281:"FlyWAPerch02",1282:"HoldWeapon",1283:"FlyHoldWeapon",1284:"WABarrelWalk",1285:"FlyWABarrelWalk",1286:"WAPourHold",1287:"FlyWAPourHold",1288:"CastStrong",1289:"FlyCastStrong",1290:"CastCurse",1291:"FlyCastCurse",1292:"CastSweep",1293:"FlyCastSweep",1294:"CastStrongUp",1295:"FlyCastStrongUp",1296:"WABoatWheelStand",1297:"FlyWABoatWheelStand",1298:"WASmithStand",1299:"FlyWASmithStand",1300:"WACrankStand",1301:"FlyWACrankStand",1302:"WAPourWalk",1303:"FlyWAPourWalk",1304:"FalconeerStart",1305:"FlyFalconeerStart",1306:"FalconeerLoop",1307:"FlyFalconeerLoop",1308:"FalconeerEnd",1309:"FlyFalconeerEnd",1310:"WADrunkDrink",1311:"FlyWADrunkDrink",1312:"WAStandEat",1313:"FlyWAStandEat",1314:"WAStandDrink",1315:"FlyWAStandDrink",1316:"WABound01",1317:"FlyWABound01",1318:"WABound02",1319:"FlyWABound02",1320:"CombatAbility1H03Off",1321:"FlyCombatAbility1H03Off",1322:"CombatAbilityDualWield01",1323:"FlyCombatAbilityDualWield01",1324:"WACradle01",1325:"FlyWACradle01",1326:"LocSummon",1327:"FlyLocSummon",1328:"LoadWeapon",1329:"FlyLoadWeapon",1330:"ArtOffLoop",1331:"FlyArtOffLoop",1332:"WADead01",1333:"FlyWADead01",1334:"WADead02",1335:"FlyWADead02",1336:"WADead03",1337:"FlyWADead03",1338:"WADead04",1339:"FlyWADead04",1340:"WADead05",1341:"FlyWADead05",1342:"WADead06",1343:"FlyWADead06",1344:"WADead07",1345:"FlyWADead07",1346:"GiantRun",1347:"FlyGiantRun",1348:"BarTendEmoteCheer",1349:"FlyBarTendEmoteCheer",1350:"BarTendEmoteTalkQuestion",1351:"FlyBarTendEmoteTalkQuestion",1352:"BarTendEmoteTalkExclamation",1353:"FlyBarTendEmoteTalkExclamation",1354:"BarTendWalk",1355:"FlyBarTendWalk",1356:"BartendShuffleLeft",1357:"FlyBartendShuffleLeft",1358:"BarTendShuffleRight",1359:"FlyBarTendShuffleRight",1360:"BarTendCustomSpell01",1361:"FlyBarTendCustomSpell01",1362:"BarTendCustomSpell02",1363:"FlyBarTendCustomSpell02",1364:"BarTendCustomSpell03",1365:"FlyBarTendCustomSpell03",1366:"BarServerEmoteCheer",1367:"FlyBarServerEmoteCheer",1368:"BarServerEmoteTalkQuestion",1369:"FlyBarServerEmoteTalkQuestion",1370:"BarServerEmoteTalkExclamation",1371:"FlyBarServerEmoteTalkExclamation",1372:"BarServerCustomSpell01",1373:"FlyBarServerCustomSpell01",1374:"BarServerCustomSpell02",1375:"FlyBarServerCustomSpell02",1376:"BarServerCustomSpell03",1377:"FlyBarServerCustomSpell03",1378:"BarPatronEmoteDrink",1379:"FlyBarPatronEmoteDrink",1380:"BarPatronEmoteCheer",1381:"FlyBarPatronEmoteCheer",1382:"BarPatronCustomSpell01",1383:"FlyBarPatronCustomSpell01",1384:"BarPatronCustomSpell02",1385:"FlyBarPatronCustomSpell02",1386:"BarPatronCustomSpell03",1387:"FlyBarPatronCustomSpell03",1388:"HoldDart",1389:"FlyHoldDart",1390:"ReadyDart",1391:"FlyReadyDart",1392:"AttackDart",1393:"FlyAttackDart",1394:"LoadDart",1395:"FlyLoadDart",1396:"WADartTargetStand",1397:"FlyWADartTargetStand",1398:"WADartTargetEmoteTalk",1399:"FlyWADartTargetEmoteTalk",1400:"BarPatronSitEmoteCheer",1401:"FlyBarPatronSitEmoteCheer",1402:"BarPatronSitCustomSpell01",1403:"FlyBarPatronSitCustomSpell01",1404:"BarPatronSitCustomSpell02",1405:"FlyBarPatronSitCustomSpell02",1406:"BarPatronSitCustomSpell03",1407:"FlyBarPatronSitCustomSpell03",1408:"BarPianoStand",1409:"FlyBarPianoStand",1410:"BarPianoEmoteTalk",1411:"FlyBarPianoEmoteTalk",1412:"WAHearthSit",1413:"FlyWAHearthSit",1414:"WAHearthSitEmoteCry",1415:"FlyWAHearthSitEmoteCry",1416:"WAHearthSitEmoteCheer",1417:"FlyWAHearthSitEmoteCheer",1418:"WAHearthSitCustomSpell01",1419:"FlyWAHearthSitCustomSpell01",1420:"WAHearthSitCustomSpell02",1421:"FlyWAHearthSitCustomSpell02",1422:"WAHearthSitCustomSpell03",1423:"FlyWAHearthSitCustomSpell03",1424:"WAHearthStand",1425:"FlyWAHearthStand",1426:"WAHearthStandEmoteCheer",1427:"FlyWAHearthStandEmoteCheer",1428:"WAHearthStandEmoteTalk",1429:"FlyWAHearthStandEmoteTalk",1430:"WAHearthStandCustomSpell01",1431:"FlyWAHearthStandCustomSpell01",1432:"WAHearthStandCustomSpell02",1433:"FlyWAHearthStandCustomSpell02",1434:"WAHearthStandCustomSpell03",1435:"FlyWAHearthStandCustomSpell03",1436:"WAScribeStart",1437:"FlyWAScribeStart",1438:"WAScribeLoop",1439:"FlyWAScribeLoop",1440:"WAScribeEnd",1441:"FlyWAScribeEnd",1442:"WAEmoteScribe",1443:"FlyWAEmoteScribe",1444:"Haymaker",1445:"FlyHaymaker",1446:"HaymakerPrecast",1447:"FlyHaymakerPrecast",1448:"ChannelCastOmniUp",1449:"FlyChannelCastOmniUp",1450:"DHJumpLandRun",1451:"FlyDHJumpLandRun",1452:"Cinematic01",1453:"FlyCinematic01",1454:"Cinematic02",1455:"FlyCinematic02",1456:"Cinematic03",1457:"FlyCinematic03",1458:"Cinematic04",1459:"FlyCinematic04",1460:"Cinematic05",1461:"FlyCinematic05",1462:"Cinematic06",1463:"FlyCinematic06",1464:"Cinematic07",1465:"FlyCinematic07",1466:"Cinematic08",1467:"FlyCinematic08",1468:"Cinematic09",1469:"FlyCinematic09",1470:"Cinematic10",1471:"FlyCinematic10",1472:"TakeOffStart",1473:"FlyTakeOffStart",1474:"TakeOffFinish",1475:"FlyTakeOffFinish",1476:"LandStart",1477:"FlyLandStart",1478:"LandFinish",1479:"FlyLandFinish",1480:"WAWalkTalk",1481:"FlyWAWalkTalk",1482:"WAPerch03",1483:"FlyWAPerch03",1484:"CarriageMountMoving",1485:"FlyCarriageMountMoving",1486:"TakeOffFinishFly",1487:"FlyTakeOffFinishFly",1488:"CombatAbility2HBig02",1489:"FlyCombatAbility2HBig02",1490:"MountWide",1491:"FlyMountWide",1492:"EmoteTalkSubdued",1493:"FlyEmoteTalkSubdued",1494:"WASit04",1495:"FlyWASit04",1496:"MountSummon",1497:"FlyMountSummon",1498:"EmoteSelfie",1499:"FlyEmoteSelfie",1500:"CustomSpell11",1501:"FlyCustomSpell11",1502:"CustomSpell12",1503:"FlyCustomSpell12",1504:"CustomSpell13",1505:"FlyCustomSpell13",1506:"CustomSpell14",1507:"FlyCustomSpell14",1508:"CustomSpell15",1509:"FlyCustomSpell15",1510:"CustomSpell16",1511:"FlyCustomSpell16",1512:"CustomSpell17",1513:"FlyCustomSpell17",1514:"CustomSpell18",1515:"FlyCustomSpell18",1516:"CustomSpell19",1517:"FlyCustomSpell19",1518:"CustomSpell20",1519:"FlyCustomSpell20",1520:"AdvFlyLeft",1521:"FlyAdvFlyLeft",1522:"AdvFlyRight",1523:"FlyAdvFlyRight",1524:"AdvFlyForward",1525:"FlyAdvFlyForward",1526:"AdvFlyBackward",1527:"FlyAdvFlyBackward",1528:"AdvFlyUp",1529:"FlyAdvFlyUp",1530:"AdvFlyDown",1531:"FlyAdvFlyDown",1532:"AdvFlyForwardGlide",1533:"FlyAdvFlyForwardGlide",1534:"AdvFlyRoll",1535:"FlyAdvFlyRoll",1536:"ProfCookingLoop",1537:"FlyProfCookingLoop",1538:"ProfCookingStart",1539:"FlyProfCookingStart",1540:"ProfCookingEnd",1541:"FlyProfCookingEnd",1542:"WACurious",1543:"FlyWACurious",1544:"WAAlert",1545:"FlyWAAlert",1546:"WAInvestigate",1547:"FlyWAInvestigate",1548:"WAInteraction",1549:"FlyWAInteraction",1550:"WAThreaten",1551:"FlyWAThreaten",1552:"WAReact01",1553:"FlyWAReact01",1554:"WAReact02",1555:"FlyWAReact02",1556:"AdvFlyRollStart",1557:"FlyAdvFlyRollStart",1558:"AdvFlyRollEnd",1559:"FlyAdvFlyRollEnd",1560:"EmpBreathPrecast",1561:"FlyEmpBreathPrecast",1562:"EmpBreathPrecastChannel",1563:"FlyEmpBreathPrecastChannel",1564:"EmpBreathSpellCast",1565:"FlyEmpBreathSpellCast",1566:"EmpBreathSpellCastChannel",1567:"FlyEmpBreathSpellCastChannel",1568:"DracFlyBreathTakeoffStart",1569:"FlyDracFlyBreathTakeoffStart",1570:"DracFlyBreathTakeoffFinish",1571:"FlyDracFlyBreathTakeoffFinish",1572:"DracFlyBreath",1573:"FlyDracFlyBreath",1574:"DracFlyBreathLandStart",1575:"FlyDracFlyBreathLandStart",1576:"DracFlyBreathLandFinish",1577:"FlyDracFlyBreathLandFinish",1578:"DracAirDashLeft",1579:"FlyDracAirDashLeft",1580:"DracAirDashForward",1581:"FlyDracAirDashForward",1582:"DracAirDashBackward",1583:"FlyDracAirDashBackward",1584:"DracAirDashRight",1585:"FlyDracAirDashRight",1586:"LivingWorldProximityEnter",1587:"FlyLivingWorldProximityEnter",1588:"AdvFlyDownEnd",1589:"FlyAdvFlyDownEnd",1590:"LivingWorldProximityLoop",1591:"FlyLivingWorldProximityLoop",1592:"LivingWorldProximityLeave",1593:"FlyLivingWorldProximityLeave",1594:"EmpAirBarragePrecast",1595:"FlyEmpAirBarragePrecast",1596:"EmpAirBarragePrecastChannel",1597:"FlyEmpAirBarragePrecastChannel",1598:"EmpAirBarrageSpellCast",1599:"FlyEmpAirBarrageSpellCast",1600:"DracClawSwipeLeft",1601:"FlyDracClawSwipeLeft",1602:"DracClawSwipeRight",1603:"FlyDracClawSwipeRight",1604:"DracHoverIdle",1605:"FlyDracHoverIdle",1606:"DracHoverLeft",1607:"FlyDracHoverLeft",1608:"DracHoverRight",1609:"FlyDracHoverRight",1610:"DracHoverBackward",1611:"FlyDracHoverBackward",1612:"DracHoverForward",1613:"FlyDracHoverForward",1614:"DracAttackWings",1615:"FlyDracAttackWings",1616:"DracAttackTail",1617:"FlyDracAttackTail",1618:"AdvFlyStart",1619:"FlyAdvFlyStart",1620:"AdvFlyLand",1621:"FlyAdvFlyLand",1622:"AdvFlyLandRun",1623:"FlyAdvFlyLandRun",1624:"AdvFlyStrafeLeft",1625:"FlyAdvFlyStrafeLeft",1626:"AdvFlyStrafeRight",1627:"FlyAdvFlyStrafeRight",1628:"AdvFlyIdle",1629:"FlyAdvFlyIdle",1630:"AdvFlyRollRight",1631:"FlyAdvFlyRollRight",1632:"AdvFlyRollRightEnd",1633:"FlyAdvFlyRollRightEnd",1634:"AdvFlyRollLeft",1635:"FlyAdvFlyRollLeft",1636:"AdvFlyRollLeftEnd",1637:"FlyAdvFlyRollLeftEnd",1638:"AdvFlyFlap",1639:"FlyAdvFlyFlap",1640:"DracHoverDracClawSwipeLeft",1641:"FlyDracHoverDracClawSwipeLeft",1642:"DracHoverDracClawSwipeRight",1643:"FlyDracHoverDracClawSwipeRight",1644:"DracHoverDracAttackWings",1645:"FlyDracHoverDracAttackWings",1646:"DracHoverReadySpellOmni",1647:"FlyDracHoverReadySpellOmni",1648:"DracHoverSpellCastOmni",1649:"FlyDracHoverSpellCastOmni",1650:"DracHoverChannelSpellOmni",1651:"FlyDracHoverChannelSpellOmni",1652:"DracHoverReadySpellDirected",1653:"FlyDracHoverReadySpellDirected",1654:"DracHoverChannelSpellDirected",1655:"FlyDracHoverChannelSpellDirected",1656:"DracHoverSpellCastDirected",1657:"FlyDracHoverSpellCastDirected",1658:"DracHoverCastOutStrong",1659:"FlyDracHoverCastOutStrong",1660:"DracHoverBattleRoar",1661:"FlyDracHoverBattleRoar",1662:"DracHoverEmpBreathSpellCast",1663:"FlyDracHoverEmpBreathSpellCast",1664:"DracHoverEmpBreathSpellCastChannel",1665:"FlyDracHoverEmpBreathSpellCastChannel",1666:"LivingWorldTimeOfDayEnter",1667:"FlyLivingWorldTimeOfDayEnter",1668:"LivingWorldTimeOfDayLoop",1669:"FlyLivingWorldTimeOfDayLoop",1670:"LivingWorldTimeOfDayLeave",1671:"FlyLivingWorldTimeOfDayLeave",1672:"LivingWorldWeatherEnter",1673:"FlyLivingWorldWeatherEnter",1674:"LivingWorldWeatherLoop",1675:"FlyLivingWorldWeatherLoop",1676:"LivingWorldWeatherLeave",1677:"FlyLivingWorldWeatherLeave",1678:"AdvFlyDownStart",1679:"FlyAdvFlyDownStart",1680:"AdvFlyFlapBig",1681:"FlyAdvFlyFlapBig",1682:"DracHoverReadyUnarmed",1683:"FlyDracHoverReadyUnarmed",1684:"DracHoverAttackUnarmed",1685:"FlyDracHoverAttackUnarmed",1686:"DracHoverParryUnarmed",1687:"FlyDracHoverParryUnarmed",1688:"DracHoverCombatWound",1689:"FlyDracHoverCombatWound",1690:"DracHoverCombatCritical",1691:"FlyDracHoverCombatCritical",1692:"DracHoverAttackTail",1693:"FlyDracHoverAttackTail",1694:"Glide",1695:"FlyGlide",1696:"GlideEnd",1697:"FlyGlideEnd",1698:"DracClawSwipe",1699:"FlyDracClawSwipe",1700:"DracHoverDracClawSwipe",1701:"FlyDracHoverDracClawSwipe",1702:"AdvFlyFlapUp",1703:"FlyAdvFlyFlapUp",1704:"AdvFlySlowFall",1705:"FlyAdvFlySlowFall",1706:"AdvFlyFlapFoward",1707:"FlyAdvFlyFlapFoward",1708:"DracSpellCastWings",1709:"FlyDracSpellCastWings",1710:"DracHoverDracSpellCastWings",1711:"FlyDracHoverDracSpellCastWings",1712:"DracAirDashVertical",1713:"FlyDracAirDashVertical",1714:"DracAirDashRefresh",1715:"FlyDracAirDashRefresh",1716:"SkinningLoop",1717:"FlySkinningLoop",1718:"SkinningStart",1719:"FlySkinningStart",1720:"SkinningEnd",1721:"FlySkinningEnd",1722:"AdvFlyForwardGlideSlow",1723:"FlyAdvFlyForwardGlideSlow",1724:"AdvFlyForwardGlideFast",1725:"FlyAdvFlyForwardGlideFast",1726:"AdvFlySecondFlapUp",1727:"FlyAdvFlySecondFlapUp",1728:"FloatIdle",1729:"FlyFloatIdle",1730:"FloatWalk",1731:"FlyFloatWalk",1732:"CinematicTalk",1733:"FlyCinematicTalk",1734:"CinematicWAGuardEmoteSlam01",1735:"FlyCinematicWAGuardEmoteSlam01",1736:"WABlowHorn",1737:"FlyWABlowHorn",1738:"MountExtraWide",1739:"FlyMountExtraWide",1740:"WA2HIdle",1741:"FlyWA2HIdle",1742:"HerbalismLoop",1743:"FlyHerbalismLoop",1744:"CookingLoop",1745:"FlyCookingLoop",1746:"WAWeaponSharpenNoSheathe",1747:"FlyWAWeaponSharpenNoSheathe",1748:"CinematicDeath",1749:"FlyCinematicDeath",1750:"CinematicDeathPose",1751:"FlyCinematicDeathPose",1752:"EmpSlamPrecast",1753:"FlyEmpSlamPrecast",1754:"EmpSlamPrecastChannel",1755:"FlyEmpSlamPrecastChannel",1756:"EmpSlamSpellCast",1757:"FlyEmpSlamSpellCast",1758:"Climb",1759:"FlyClimb",1760:"ClimbStart",1761:"FlyClimbStart",1762:"ClimbEnd",1763:"FlyClimbEnd",1764:"MountLeanLeft",1765:"FlyMountLeanLeft",1766:"MountLeanRight",1767:"FlyMountLeanRight",1768:"MountDive",1769:"FlyMountDive",1770:"MountCrouch",1771:"FlyMountCrouch",1772:"WAShovelLoop",1773:"FlyWAShovelLoop",1774:"EmoteTalkFrustrated",1775:"FlyEmoteTalkFrustrated",1776:"MountMedium",1777:"FlyMountMedium",1778:"CombatAbilityBowUp",1779:"FlyCombatAbilityBowUp",1780:"CombatAbilityRifleUp",1781:"FlyCombatAbilityRifleUp",1782:"EmoteOfferStart",1783:"FlyEmoteOfferStart",1784:"EmoteOfferLoop",1785:"FlyEmoteOfferLoop",1786:"EmoteOfferEnd",1787:"FlyEmoteOfferEnd"};class Ms{constructor(t){var e,i=this;i.d=t.getUint16(),i.b=t.getUint16(),i.f=t.getUint32();t.getFloat();i.j=t.getUint32(),i.m=t.getUint16(),t.getUint16(),t.getUint32(),t.getUint32(),i.e=t.getUint16(),i.c=t.getUint16(),i.a=Ue(t.getFloat(),t.getFloat(),t.getFloat()),i.g=Ue(t.getFloat(),t.getFloat(),t.getFloat()),t.getFloat(),i.l=t.getInt16(),i.k=t.getInt16(),i.i=null!==(e=Es[i.d])&&void 0!==e?e:""}h(){}}class Ds{constructor(t,e){this.e=t.getInt32(),this.f=t.getUint32(),this.d=t.getInt16(),this.g=t.getUint16(),this.h=t.getUint32(),this.c=Nn(t,e),this.b=function(t,e,i=!0){return An.h(t,e,Mn,Ln,i)}(t,e),this.a=Nn(t,e),this.i=Ue(t.getFloat(),t.getFloat(),t.getFloat())}}class Bs{constructor(t,e){this.f=t.getUint32(),this.k=t.getUint32(),this.l=Ue(t.getFloat(),t.getFloat(),t.getFloat());const i=t.getInt32(),r=t.getInt32();if(i>0){const t=new cn(e.chunkData);t.position=r,this.j=new Array(i);for(let e=0;e<i;e++)this.j[e]=t.getInt16()}const n=t.getInt32(),s=t.getInt32();if(n>0){const t=new cn(e.chunkData);t.position=s,this.i=new Array(n);for(let e=0;e<n;e++)this.i[e]=t.getInt16()}this.h=Nn(t,e,!1),this.m=zn(t,e,!1),this.r=Vn(t,e,!1),this.c=Vn(t,e,!1),this.o=t.getFloat(),this.d=t.getFloat(),this.a=t.getFloat(),this.e=t.getInt16(),this.q=t.getInt16(),this.p=zn(t,e,!1),this.b=qn(t,e,!1),this.n=t.getInt16(),t.getUint16()}}class ks{constructor(t){this.a=t.getInt32(),this.c=t.getUint32(),t.getInt32(),t.getInt32()}}class Ps{constructor(t){this.l=t.flags,this.b=t.priorityPlane,this.i=t.shaderId,this.k=t.meshIndex,this.j=t.geosetIndex,this.e=t.colorIndex,this.m=t.renderFlagIndex,this.c=t.materialLayer,this.a=t.textureCount,this.g=t.materialIndex,this.d=t.texUnitIndex,this.f=t.alphaIndex,this.h=t.textureAnimIndex}}class Rs{constructor(t,e){this.a=t.getInt16(),this.d=t.getInt16(),this.g=Ue(t.getFloat(),t.getFloat(),t.getFloat()),this.e=Nn(t,e,!1),this.j=Vn(t,e,!1),this.c=Nn(t,e,!1),this.b=Vn(t,e,!1),this.h=Vn(t,e,!1),this.f=Vn(t,e,!1),this.i=qn(t,e,!1)}}const Ls=class{constructor(t){var e=this;e.d=t.getInt16(),e.e=t.getFloat(),e.c=t.getFloat(),e.b=t.getUint16(),e.a=t.getUint32()}};const Is=class{constructor(t){var e=this;e.c=t.getFloat(),e.b=t.getFloat(),e.d=t.getUint32(),e.a=t.getUint32()}};function Us(t){return{count:t.getInt32(),offset:t.getInt32()}}function Os(t){return new Float32Array([t.getFloat(),t.getFloat(),t.getFloat()])}class Ws{constructor(t){this.a=[],this.j=[],this.l=[],this.o=[],this.d=-1,this.b=[],this.e=[],this.g=null,this.m=null,this.p=null,this.n=null,this.k=null,this.i=null;const e=new cn(t),i=t.byteLength;for(;e.position<i&&!(e.position+8>i);){const r=e.getUint32(),n=e.getUint32();if(e.position+n>i)break;const s=e.position;switch(r){case 825377869:this.c=t.slice(s,s+n),this.f();break;case 1145652819:{const t=n/4;this.a=new Array(t);for(let i=0;i<t;i++)this.a[i]=e.getUint32();break}case 1145657428:{const t=n/4;this.j=new Array(t);for(let i=0;i<t;i++)this.j[i]=e.getUint32();break}case 1145652801:{const t=n/8;this.l=new Array(t);for(let i=0;i<t;i++)this.l[i]={animId:e.getUint16(),subAnimId:e.getUint16(),fileDataId:e.getUint32()};break}case 1145652802:{const t=n/4;this.o=new Array(t);for(let i=0;i<t;i++)this.o[i]=e.getUint32();break}case 1145654099:this.d=e.getUint32();break;case 844126277:this.g=t.slice(s,s+n);break;case 826558288:this.m=t.slice(s,s+n);break;case 1280591172:this.p=t.slice(s,s+n);break;case 1280262992:this.n=t.slice(s,s+n);break;case 1447645252:this.k=t.slice(s,s+n);break;case 1280853332:this.i=t.slice(s,s+n);break;case 1145655378:{const t=n/4;this.b=new Array(t);for(let i=0;i<t;i++)this.b[i]=e.getUint32();break}case 1145655367:{const t=n/4;this.e=new Array(t);for(let i=0;i<t;i++)this.e[i]=e.getUint32();break}}e.position=s+n}}f(){const t=new cn(this.c),e={};e.magic=t.getUint32(),e.version=t.getUint32(),e.name=Us(t),e.flags=t.getUint32(),e.globalLoops=Us(t),e.sequences=Us(t),e.sequenceLookup=Us(t),e.bones=Us(t),e.keyBoneLookup=Us(t),e.vertices=Us(t),e.numSkins=t.getUint32(),e.colors=Us(t),e.textures=Us(t),e.textureWeights=Us(t),e.textureTransforms=Us(t),e.replacableTextureLookup=Us(t),e.materials=Us(t),e.boneLookup=Us(t),e.textureLookup=Us(t),e.textureUnitLookup=Us(t),e.transparencyLookup=Us(t),e.textureTransformsLookup=Us(t),e.boundingBox1=Os(t),e.boundingBox2=Os(t),e.boundingSphereRadius=t.getFloat(),e.collisionBox1=Os(t),e.collisionBox2=Os(t),e.collisionSphereRadius=t.getFloat(),e.collisionTriangles=Us(t),e.collisionVertices=Us(t),e.collisionNormals=Us(t),e.attachments=Us(t),e.attachmentLookup=Us(t),e.events=Us(t),e.lights=Us(t),e.cameras=Us(t),e.cameraLookup=Us(t),e.ribbonEmitters=Us(t),e.particleEmitters=Us(t),8&e.flags&&(e.textureCombinerCombos=Us(t)),this.h=e}}function Hs(t,e,i){if(e.count<=0)return[];const r=new cn(t);r.position=e.offset;const n=new Array(e.count);for(let t=0;t<e.count;t++)n[t]=i(r);return n}function Gs(t,e){return Hs(t,e,t=>t.getInt16())}function js(t,e){return Hs(t,e,t=>t.getUint32())}var Ns=function(t,e,i,r){return new(i||(i=Promise))(function(n,s){function a(t){try{l(r.next(t))}catch(t){s(t)}}function o(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(a,o)}l((r=r.apply(t,e||[])).next())})};class zs{constructor(t,e){this.g=new Map,this.j=new Map,this.i=t,this.e=e}d(t,e){for(const i of this.e)if(i.animId===t&&i.subAnimId===e)return i.fileDataId;return 0}a(t){return this.g.has(t)}c(t){return this.g.get(t)||null}f(t){return Ns(this,void 0,void 0,function*(){if(t<=0)return null;if(this.g.has(t))return this.g.get(t);if(this.j.has(t))return this.j.get(t);const e=this.b(t);this.j.set(t,e);try{const i=yield e;return this.g.set(t,i),i}finally{this.j.delete(t)}})}b(t){return Ns(this,void 0,void 0,function*(){const e=this.i+"anim/"+t+".anim",i=yield fetch(e);if(!i.ok)return console.warn("Failed to fetch anim file:",e,i.status),{afsa:null,afsb:null,afm2:null,rawStream:null};const r=yield i.arrayBuffer();return this.h(r)})}h(t){const e={afsa:null,afsb:null,afm2:null,rawStream:t},i=new cn(t),r=t.byteLength;for(;i.position<r&&!(i.position+8>r);){const n=i.getUint32(),s=i.getUint32(),a=i.position;if(a+s>r)break;switch(n){case 1095976513:e.afsa=t.slice(a,a+s);break;case 1112753729:e.afsb=t.slice(a,a+s);break;case 843925057:e.afm2=t.slice(a,a+s)}i.position=a+s}return e}}var Vs=function(t,e,i,r){return new(i||(i=Promise))(function(n,s){function a(t){try{l(r.next(t))}catch(t){s(t)}}function o(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(a,o)}l((r=r.apply(t,e||[])).next())})};class qs{constructor(t,e,i){var r;if(this.T=[],this.M=[],this.h=[],this.P=[],this.V=[],this.n=[],this.G=[],this.o=[],this.B=[],this.C=[],this.W=[],this.v=[],this.x=[],this.c=[],this.i=[],this.O=[],this.Z=[],this.H=[],this.f=[],this.R=[],this.L=[],this.N=[],this.U=[],this.w=[],this.A=[],this.j=[],this.ab=[],this.k=[],this.D=[],this.b=[],this.E=[],this.y=[],this.ac=[],this.I=[],this.Y=[],this.d=[],this.a=null,this.t=[],!t||!t.c)return void console.error("Bad M2 file data");const n=t.h,s=t.c;this.Q=n.flags;const a=(null==i?void 0:i.skb1Data)||s,o=(null==i?void 0:i.bonesArr)||n.bones,l=(null==i?void 0:i.keyBoneLookupArr)||n.keyBoneLookup,h=(null==i?void 0:i.sks1Data)||s,u=(null==i?void 0:i.sequencesArr)||n.sequences,c=(null==i?void 0:i.sequenceLookupArr)||n.sequenceLookup,d=(null==i?void 0:i.globalLoopsArr)||n.globalLoops,f=(null==i?void 0:i.ska1Data)||s,g=(null==i?void 0:i.attachmentsArr)||n.attachments,p=(null==i?void 0:i.attachmentLookupArr)||n.attachmentLookup;this.h=js(h,d),u.count>0&&(this.P=Hs(h,u,t=>new Ms(t)));const m=this.P.map(t=>t.j);this.V=Gs(h,c);const b={chunkData:s,numSequences:this.P.length,sequenceFlags:m},y={chunkData:a,numSequences:this.P.length,sequenceFlags:m};if(n.vertices.count>0&&(this.T=Hs(s,n.vertices,t=>new ys(t))),this.M=e.a(),e.c.length>0&&(this.B=e.c.map(t=>new Fs(t))),e.e.length>0&&(this.C=e.e.map(t=>new Ps(t))),o.count>0){this.n=Hs(a,o,t=>new Ds(t,y));for(const t of this.n)this.t.push(t.c,t.b,t.a)}if((null===(r=null==i?void 0:i.boneOverrides)||void 0===r?void 0:r.length)>0&&this.J(i.boneOverrides),this.o=Gs(a,l),this.G=Gs(s,n.boneLookup),n.materials.count>0&&(this.aa=Hs(s,n.materials,t=>new vs(t))),n.textures.count>0){this.v=Hs(s,n.textures,t=>new ks(t));for(let e=0;e<this.v.length&&e<t.j.length;e++)this.v[e].b=t.j[e]}if(this.x=Gs(s,n.textureLookup),this.W=Gs(s,n.textureUnitLookup),this.f=Gs(s,n.replacableTextureLookup),this.w=Gs(s,n.transparencyLookup),this.H=Gs(s,n.textureTransformsLookup),n.textureTransforms.count>0&&(this.Z=Hs(s,n.textureTransforms,t=>new Ss(t,b))),n.colors.count>0&&(this.N=Hs(s,n.colors,t=>new Ts(t,b))),n.textureWeights.count>0&&(this.U=Hs(s,n.textureWeights,t=>new xs(t,b))),this.u=Ue(n.boundingBox1[0],n.boundingBox1[1],n.boundingBox1[2]),this.l=Ue(n.boundingBox2[0],n.boundingBox2[1],n.boundingBox2[2]),this.s=n.boundingSphereRadius,this.p=Ue(n.collisionBox1[0],n.collisionBox1[1],n.collisionBox1[2]),this.e=Ue(n.collisionBox2[0],n.collisionBox2[1],n.collisionBox2[2]),this.F=n.collisionSphereRadius,n.collisionTriangles.count>0&&(this.c=Hs(s,n.collisionTriangles,t=>t.getUint16())),n.collisionVertices.count>0&&(this.i=Hs(s,n.collisionVertices,t=>Ue(t.getFloat(),t.getFloat(),t.getFloat()))),n.collisionNormals.count>0&&(this.O=Hs(s,n.collisionNormals,t=>Ue(t.getFloat(),t.getFloat(),t.getFloat()))),g.count>0&&(this.R=Hs(f,g,t=>new Cs(t))),this.L=Gs(f,p),n.lights.count>0&&(this.A=Hs(s,n.lights,t=>new Rs(t,b))),n.particleEmitters.count>0&&(this.j=Hs(s,n.particleEmitters,t=>new ws(t,b))),n.ribbonEmitters.count>0&&(this.ab=Hs(s,n.ribbonEmitters,t=>new Bs(t,b))),t.g){const e=new cn(t.g),i={count:e.getInt32(),offset:e.getInt32()};i.count>0&&(this.k=Hs(t.g,i,e=>new _s(e,t.g)))}if(t.m){const e=new cn(t.m),i=t.m.byteLength/2;this.D=new Array(i);for(let t=0;t<i;t++)this.D[t]=e.getInt16()}if(t.p){const e=new cn(t.p),i=t.p.byteLength/16;this.b=new Array(i);for(let t=0;t<i;t++)this.b[t]=new Ls(e)}if(t.i){const e=new cn(t.i),i=t.i.byteLength/16;this.d=new Array(i);for(let t=0;t<i;t++)this.d[t]=new Is(e)}t.n&&this.q(t.n),t.k&&this.X(t.k)}J(t){for(const e of t){const t=Hs(e.sks1Data,e.sequencesArr,t=>new Ms(t)),i=new Map;for(let e=0;e<t.length;e++){const r=t[e];for(let t=0;t<this.P.length;t++)if(this.P[t].d===r.d&&this.P[t].b===r.b){i.set(t,e);break}}for(const[e,r]of i)t[r].f>this.P[e].f&&(this.P[e].f=t[r].f);const r=js(e.sks1Data,e.globalLoopsArr);r.length>this.h.length&&(this.h=r);const n={chunkData:e.skb1Data,numSequences:t.length,sequenceFlags:t.map(t=>t.j)},s=Hs(e.skb1Data,e.bonesArr,t=>new Ds(t,n)),a=Math.min(this.n.length,s.length);for(let t=0;t<a;t++){const e=this.n[t],r=s[t];for(const[t,n]of i)t<e.c.j.length&&n<r.c.j.length&&(e.c.j[t]=r.c.j[n]),t<e.b.j.length&&n<r.b.j.length&&(e.b.j[t]=r.b.j[n]),t<e.a.j.length&&n<r.a.j.length&&(e.a.j[t]=r.a.j[n])}}}q(t){const e=new cn(t),i=e.getInt32(),r=e.getInt32(),n=e.getInt32(),s=e.getInt32(),a=e.getInt32(),o=e.getInt32(),l=e.getInt32(),h=e.getInt32();if(i>0){e.position=r;for(let t=0;t<i;t++)this.E.push(Ue(e.getFloat(),e.getFloat(),e.getFloat()))}if(n>0){e.position=s;for(let t=0;t<n;t++)this.y.push(Ue(e.getFloat(),e.getFloat(),e.getFloat()))}if(a>0){e.position=o;for(let t=0;t<a;t++)this.ac.push(e.getUint16())}if(l>0){e.position=h;for(let t=0;t<l;t++)this.I.push(e.getUint16())}}X(t){const e=new cn(t);this.K=Ue(e.getFloat(),e.getFloat(),e.getFloat()),this.Y=[];for(let i=0;i<5&&e.position<t.byteLength;i++)this.Y.push(e.getInt32())}g(t,e){this.a=new zs(t,e)}r(t){for(const e of this.t)if(e.c(t))return!0;return!1}S(t){if(t<0||t>=this.P.length||!this.a)return 0;const e=this.P[t];return this.a.d(e.d,e.b)}m(t,e){const i=e.afsb||e.afm2||e.rawStream;if(i){for(const e of this.t)e.d(t,i);if(t>=0&&t<this.P.length){let e=0;for(const i of this.t){const r=i.i(t);r>e&&(e=r)}e>this.P[t].f&&(this.P[t].f=e)}}}z(t){return Vs(this,void 0,void 0,function*(){if(!this.a)return;if(!this.r(t))return;const e=this.S(t);if(e<=0)return;const i=yield this.a.f(e);i&&this.m(t,i);const r=this.P[t];if(r&&r.k>=0&&r.k<this.P.length){const t=r.k;this.r(t)&&(yield this.z(t))}})}}const Xs=class{constructor(t){this.z=t,this.t=new Float32Array([1,1,1,1]),this.y=!1,this.D=!0,this.q=null,this.x=null,this.u=0,this.n=null,this.a=[],this.E=[],this.A=new Array,this.c=null,this.B=[],this.l=t.i,this.k=t.a,this.G=!1,this.w=!1,this.v=!1,this.s=Vi(),this.H=Le(),this.r=Zr()}m(t){this.q=t;const e=t.ai,i=this.z;this.x=e.B[this.z.k],this.u=this.x.a,vs.b(this);let r=e.x[i.g];1==i.a&&r>-1&&1==e.v[r].a&&(this.l=-1e3,this.k=3);for(let r=0;r<this.k;r++){if(i.g>-1&&i.g<e.x.length){let n=e.x[i.g+r];n>-1&&n<e.v.length&&this.a.splice(r,0,t.aO[n])}if(i.h>-1&&i.h<e.H.length){let t=e.H[i.h+r];t>-1&&e.Z&&t<e.Z.length?this.E.splice(r,0,e.Z[t]):this.E.splice(r,0,null)}if(i.f>-1&&i.f<e.w.length){let t=e.w[i.f+r];t>-1&&t<e.U.length?this.B.splice(r,0,e.U[t]):this.B.splice(r,0,null)}}this.A=new Array(this.E.length);for(let t=0;t<this.A.length;t++)this.A[t]=ni();e.N&&i.e>-1&&i.e<e.N.length&&(this.c=e.N[i.e])}p(){this.q.ai;let t=qi(this.x.k[0],this.x.k[1],this.x.k[2],1),e=this.q.aM[this.x.e].a,i=ni();ui(i,i,this.q.o.viewMatrix),ui(i,i,this.q.aQ),ui(i,i,e),tr(t,t,i),t[3]=0;let r=er(t);if((3&this.z.l)>0){let e=Vi();r>0?Ki(e,t,1/r):Xi(e,t),Ki(e,e,Ie(Ue(i[8],i[9],i[10]))*this.x.b),1&this.z.l?$i(e,t,e):Yi(e,t,e),r=Zi(e)}return r}o(){this.q,this.q.o.context;const t=this.q.d;if(this.s[0]=this.s[1]=this.s[2]=this.s[3]=1,this.c&&this.c.d(t,this.q.as,this.s),this.B[0]&&(this.s[3]*=this.B[0].a(t,this.q.as)),this.s[3]*=this.q.A[3],!(this.s[3]<=.001)){for(let e=0;e<this.B.length;e++){const i=this.B[e];i&&(this.t[e]=i.a(t,this.q.as))}if(!this.y||this.q.Y){const t=this.e();let e=!0;for(const i of t){const t=i.l;e=e&&null!=t}if(this.q.dissolveEffect)for(const t of this.q.p)e=e&&null!=t&&null!=t.l;if(this.y=e,!e)return;this.d=this.f(!1,!1),this.i=this.f(!0,!1),this.g=this.f(!1,!0),this.q.shadowyEffect&&(this.F=this.b())}if(this.E.forEach((e,i)=>{if(!this.q.a&&(oi(this.A[i]),this.E[i])){let e=!1,r=!1;this.E[i].b&&this.E[i].b.b(t.d.a)?(this.H=this.E[i].b.g(t,this.q.as),r=!0):We(this.H,0,0,0),this.E[i].a&&this.E[i].a.b(t.d.a)?(this.r=this.E[i].a.g(t,this.q.as),e=!0):hn(this.r,0,0,0,1);let n,s=!1;if(this.E[i].c&&this.E[i].c.b(t.d.a)&&(n=this.E[i].c.g(t,this.q.as),s=!0),oi(this.A[i]),ci(this.A[i],this.A[i],Ue(.5,.5,0)),s&&di(this.A[i],this.A[i],n),e){let t=ni();pi(t,this.r,[0,0,0]),ui(this.A[i],this.A[i],t)}r&&ci(this.A[i],this.A[i],this.H),ci(this.A[i],this.A[i],Ue(-.5,-.5,0))}}),this.y){(this.s[3]<1?this.i:this.d).f=this.p()}}}j(t,e){if(!this.d)return;const i=this.q.N.g();if(e)i.e(this.g);else{const e=this.d.c.a()<=vr.GxBlend_AlphaKey,r=null!=this.q.gradientEffect,n=this.s[3]<1;this.F?t?i.e(this.F):i.e(this.g):t&&e&&(n||r)?(i.e(this.g),i.e(this.i)):(!t&&e||t&&!e)&&i.e(this.d)}}f(t,e){const i=this,r=t&&i.n.a<2?vr.GxBlend_Alpha:i.n.a,n=[0,1,2,10,3,4,5,13][r],s=this.q.N,a=this.q,o=Object.assign(Object.assign(Object.assign({},this.q.aV),this.q.ah),this.q.ap);for(let t=0;t<this.E.length;t++)o["uTextureMatrix"+(t+1).toString()]=this.A[t];o.uColor=this.s,o.uTexSampleAlpha=this.t,o.uBlendMode=n,o.uHasSpecEmiss=!!a.U[0]&&!!a.U[2],o.uHasEmissiveGlowing=a.aL,o.uUnlit=this.G?1:0,this.q.gradientEffect&&(o.u_mulLum_OpaqMat=[0,1,0,0]);const l=null!=this.q.dissolveEffect;if(l){const t=this.q.p;o.uDissolveMask=t[0]&&t[0].l?t[0].l:null,o.uDissolveEdge1=t[1]&&t[1].l?t[1].l:null,o.uDissolveEdge2=t[2]&&t[2].l?t[2].l:null;const e=this.q.ap.u_dissolveProcParams;e&&(e[0]=r>2?1:0,o.u_dissolveProcParams=e)}let h=!this.q.i,u=0;null!=this.q.gradientEffect&&r<=2&&(u|=1),l&&(u|=4);const c=s.j(this.q.aS,new rs(i.w,h,n,!0,!i.v,e?0:15),new Bi(this.l,i.e(),o,u));return s.k(new ns(a.j,2*i.x.c,i.x.i),c,this.z.c,this.z.b)}b(){const t=this,e=this.q.N,i=this.q,r=Object.assign(Object.assign({},this.q.aV),this.q.aT);for(let t=0;t<this.E.length;t++)r["uTextureMatrix"+(t+1).toString()]=this.A[t];r.uColor=this.s,r.uTexSampleAlpha=this.t,r.uBlendMode=10,r.uHasSpecEmiss=!1,r.uHasEmissiveGlowing=!1,r.uUnlit=1;let n=!this.q.i;const s=e.j(this.q.aS,new rs(t.w,n,10,!0,!1,15),new Bi(this.l,t.e(),r,2));return e.k(new ns(i.j,2*t.x.c,t.x.i),s,this.z.c,this.z.b)}C(){return this.a}e(){const t=[],e=this.q;return this.a.forEach((i,r)=>{let n=null;i&&(-1e3==this.l?e.U?(n=e.U[r],n||(n={l:null,d:!1})):n={l:null,d:!1}:n=0==i.e.a?i.a:i.e.a>0&&this.q.av[i.e.a]?this.q.av[i.e.a]:{l:null,d:!1},n||(this.a[r].c||(WH.debug("can't find texture for material",r,"type",this.a[r].type,"index",this.a[r].f),this.a[r].c=!0),n={l:this.q.o.greenPixelTexture})),t[r]=n}),t}get show(){return this.D}set show(t){this.D=t}get meshId(){return this.u}h(){this.q=null,this.x=null,this.n=null,this.a=null,this.E=null,this.c=null,this.B=null,this.s=null,this.A=null,this.H=null,this.r=null}};class Js{constructor(t,e){this.e=e,this.f=t,this.a=null,this.c=!1}d(){this.a&&this.a.h(),this.a=null}b(t){0!=this.e.b&&(this.a||(this.a=t.getTexture(this.e.b)))}get type(){return this.e.a}}class Ys{constructor(t){this.b=[],this.d=[],this.c=[],this.e=[];const e=new cn(t),i=e.getUint32();if(1313426259!==i)return void console.error("Bad skin file magic:",i.toString(16));const r={count:e.getInt32(),offset:e.getInt32()},n={count:e.getInt32(),offset:e.getInt32()},s=(e.getInt32(),e.getInt32(),{count:e.getInt32(),offset:e.getInt32()}),a={count:e.getInt32(),offset:e.getInt32()};e.getUint32();if(r.count>0){e.position=r.offset,this.b=new Array(r.count);for(let t=0;t<r.count;t++)this.b[t]=e.getUint16()}if(n.count>0){e.position=n.offset,this.d=new Array(n.count);for(let t=0;t<n.count;t++)this.d[t]=e.getUint16()}if(s.count>0){e.position=s.offset,this.c=new Array(s.count);for(let t=0;t<s.count;t++)this.c[t]={skinSectionId:e.getUint16(),level:e.getUint16(),vertexStart:e.getUint16(),vertexCount:e.getUint16(),indexStart:e.getUint16(),indexCount:e.getUint16(),boneCount:e.getUint16(),boneComboIndex:e.getUint16(),boneInfluences:e.getUint16(),centerBoneIndex:e.getUint16(),centerPosition:new Float32Array([e.getFloat(),e.getFloat(),e.getFloat()]),sortCenterPosition:new Float32Array([e.getFloat(),e.getFloat(),e.getFloat()]),sortRadius:e.getFloat()}}if(a.count>0){e.position=a.offset,this.e=new Array(a.count);for(let t=0;t<a.count;t++)this.e[t]={flags:e.getUint8(),priorityPlane:e.getInt8(),shaderId:e.getUint16(),meshIndex:e.getUint16(),geosetIndex:e.getUint16(),colorIndex:e.getInt16(),renderFlagIndex:e.getUint16(),materialLayer:e.getUint16(),textureCount:e.getUint16(),materialIndex:e.getInt16(),texUnitIndex:e.getUint16(),alphaIndex:e.getInt16(),textureAnimIndex:e.getInt16()}}}a(){const t=new Array(this.d.length);for(let e=0;e<this.d.length;e++)t[e]=this.b[this.d[e]];return t}}function $s(t){return{count:t.getInt32(),offset:t.getInt32()}}class Ks{constructor(t){this.g=null,this.j=null,this.h=null,this.a=null,this.c=null,this.f=null,this.d=null,this.n=null,this.i=null,this.m=null,this.e=-1,this.k=[],this.l=[];const e=new cn(t),i=t.byteLength;for(;e.position<i&&!(e.position+8>i);){const r=e.getUint32(),n=e.getUint32(),s=e.position;if(s+n>i)break;switch(r){case 827083603:break;case 827542355:{this.a=t.slice(s,s+n);const e=new cn(this.a);this.g=$s(e),this.j=$s(e),this.h=$s(e);break}case 826428243:{this.d=t.slice(s,s+n);const e=new cn(this.d);this.c=$s(e),this.f=$s(e);break}case 826362707:{this.m=t.slice(s,s+n);const e=new cn(this.m);this.n=$s(e),this.i=$s(e);break}case 1146112851:{const e=new cn(t);e.position=s,e.getInt32(),e.getInt32(),this.e=e.getInt32();break}case 1145652801:{const t=n/8;this.k=new Array(t);for(let i=0;i<t;i++)this.k[i]={animId:e.getUint16(),subAnimId:e.getUint16(),fileDataId:e.getUint32()};break}case 1145652802:{const t=n/4;this.l=new Array(t);for(let i=0;i<t;i++)this.l[i]=e.getUint32();break}}e.position=s+n}}b(){return{globalLoopsArr:this.g,sequencesArr:this.j,sequenceLookupArr:this.h,sks1Data:this.a,bonesArr:this.c,keyBoneLookupArr:this.f,skb1Data:this.d,attachmentsArr:this.n,attachmentLookupArr:this.i,ska1Data:this.m,afid:this.k,bfid:this.l,boneOverrides:[]}}}function Zs(t,e){if(0===e.length)return t;if(0===t.length)return e;const i=new Map;for(const e of t)i.set(`${e.animId}_${e.subAnimId}`,e);for(const t of e)i.set(`${t.animId}_${t.subAnimId}`,t);return Array.from(i.values())}var Qs=function(t,e,i,r){return new(i||(i=Promise))(function(n,s){function a(t){try{l(r.next(t))}catch(t){s(t)}}function o(t){try{l(r.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(a,o)}l((r=r.apply(t,e||[])).next())})};const ta=function(t,e){const i=Math.abs(t),r=Math.abs(e);return Number((i-Math.floor(i/r)*r).toPrecision(8))*Math.sign(t)},ea="DressingRoom",ia="Stand";class ra{constructor(){this.c=null,this.a=-1,this.b=ni(),this.d=1}}class na{constructor(t,e,i){this.o=t,this.N=e,this.aI=i,this.ac=!1,this.as=[],this.i=!1,this.ax=!0,this.aD=!0,this.a=!1,this.t=!1,this.d=new fn,this.n=null,this.az=0,this.J=null,this.B=null,this.av={},this.U=[],this.aL=!1,this.Y=!1,this.bZ=1,this.aK=Le(),this.aj=Le(),this.be=null,this.Z=null,this.T=new Set,this.j=null,this.aQ=ni(),this.bc=ni(),this.aN=ni(),this.c=ni(),this.A=qi(1,1,1,1),this.aE=null,this.ah={},this.g=null,this.aT={},this.bh=null,this.ap={},this.p=[],this.G=null,this.aX=-1,this.w=!1,this.E=ni(),this.ar=Le(),this.r=Le(),this.s=Vi(),this.aP=Vi(),this.aq=!1,this.C=!1,this.u=null,this.I=-1,this.h=[],this.y=0,this.d.a=0,this.d.d.a=-1,this.f(i)}ao(t){this.h.push(t)}f(t){return Qs(this,void 0,void 0,function*(){const e=this.o.options.contentPath;try{const i=yield this.at(e+"m2/"+t+".m2"),r=new Ws(i),n=r.a[0],s=yield this.at(e+"skin/"+n+".skin"),a=new Ys(s);let o=null;r.d>0&&(o=yield this.m(r.d,e));const l=this.bf(r.l,null==o?void 0:o.afid);this.ai=new qs(r,a,o),this.ai.g(e,l),this.L()}catch(e){console.error("Failed to load model",t,e)}})}at(t){return Qs(this,void 0,void 0,function*(){const e=yield fetch(t);if(!e.ok)throw new Error(`Failed to fetch ${t}: ${e.status}`);return e.arrayBuffer()})}m(t,e){return Qs(this,void 0,void 0,function*(){const i=yield this.at(e+"skel/"+t+".skel"),r=new Ks(i);if(r.e>0){return function(t,e){const i=t.globalLoopsArr,r=t.sequencesArr,n=t.sequenceLookupArr,s=t.sks1Data,a=[...t.boneOverrides];let o,l,h;return e.d?e.a?(o=t.bonesArr,l=t.keyBoneLookupArr,h=t.skb1Data,a.push({sks1Data:e.a,sequencesArr:e.j,globalLoopsArr:e.g,skb1Data:e.d,bonesArr:e.c})):(o=e.c,l=e.f,h=e.d):(o=t.bonesArr,l=t.keyBoneLookupArr,h=t.skb1Data),{globalLoopsArr:i,sequencesArr:r,sequenceLookupArr:n,sks1Data:s,bonesArr:o,keyBoneLookupArr:l,skb1Data:h,attachmentsArr:e.m?e.n:t.attachmentsArr,attachmentLookupArr:e.m?e.i:t.attachmentLookupArr,ska1Data:e.m||t.ska1Data,afid:Zs(t.afid,e.k),bfid:e.l.length>0?e.l:t.bfid,boneOverrides:a}}(yield this.m(r.e,e),r)}return r.b()})}bf(t,e){if(!e||0===e.length)return t||[];if(!t||0===t.length)return e;const i=new Map;for(const e of t)i.set(`${e.animId}_${e.subAnimId}`,e);for(const t of e)i.set(`${t.animId}_${t.subAnimId}`,t);return Array.from(i.values())}bg(t){this.bZ=t}L(){const t=this.ai,e=t.v.length,i=t.n.length,r=t.h.length,n=t.j.length,s=t.ab.length;this.as=new Array(r);for(let t=0;t<r;++t)this.as[t]=0;if(i>0){this.aM=new Array(i);for(let e=0;e<i;e++)this.aM[e]=new $n(this,e,t.n[e]);this.af=new Array(i);for(let e=0;e<i;e++){this.af[e]=[];for(let r=0;r<i;r++)t.n[r].d==e&&this.af[e].push(r)}}this.aO=new Array;for(let i=0;i<e;i++)this.aO[i]=new Js(i,t.v[i]),this.aO[i].b(this.o);this.F=new Array(n);for(let e=0;e<n;e++)this.F[e]=new ds(this,t.j[e]),t.k&&t.k.length&&e<t.k.length&&this.F[e].k(t.k[e]);this.R=new Array(s);for(let e=0;e<s;e++)this.R[e]=new bs(this,t.ab[e]);if(this.n&&this.V(this.n),t.C){const e=t.C.length;this.b=new Array(e);for(let i=0;i<e;++i)this.b[i]=new Xs(t.C[i]),this.b[i].m(this);this.bd=this.b.concat()}this.ai.T&&t.M&&(this.be=this.N.i(t.T),this.Z=this.N.e(t.M.length),this.j=this.N.f(this.be,this.Z),this.Z.c(new Uint16Array(t.M))),this.aS=this.N.a(t.n.length,t.N.length,t.U.length,t.Z.length),this.aV={uInvTranspViewModelMat:this.c,uModelMatrix:this.aQ,uDiffuseColor:this.A},this.l("Stand");for(let t of this.h)t();if(this.h=[],We(this.r,this.bZ,this.bZ,this.bZ),oi(this.aQ),this.aq&&gi(this.aQ,this.aQ,Math.PI/2),this.C){let t=Le();oi(ni()),We(t,1,-1,1),di(this.aQ,this.aQ,t)}di(this.aQ,this.aQ,this.r),this.o.doUpdateBounds=!0,this.ac=!0}q(){this.aq=!0}au(){this.C=!0}Q(t){const e=this.ai;return e&&e.P&&t>-1&&t<e.P.length?e.P[t].i:t==e.P.length?ea:""}aY(){this.l(ia)}get isMirrored(){return this.x}set isMirrored(t){this.Y=this.x!=t,this.x=t}aC(t,e,i,r=1){null!=t||null!=i?(this.u||(this.u=new ra),this.u.c=t,this.u.a=e,i?si(this.u.b,i):oi(this.u.b),this.u.d=r,this.o.doUpdateBounds=!0):this.u=null}k(){this.o.context;this.ai.T&&this.ai.M&&this.aX!=this.o.currFrame&&(this.be&&this.be.dc(this.aM,this.T),this.aS.b(this.aM),this.aX=this.o.currFrame)}ak(t,e,i){const r=[Ue(t[0],t[1],t[2]),Ue(t[0],t[1],e[2]),Ue(t[0],e[1],t[2]),Ue(t[0],e[1],e[2]),Ue(e[0],t[1],t[2]),Ue(e[0],t[1],e[2]),Ue(e[0],e[1],t[2]),Ue(e[0],e[1],e[2])].map(t=>{const e=Le();return Qe(e,t,i),e}),n=Ue(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),s=Ue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);return r.forEach(t=>{Ne(n,n,t),ze(s,s,t)}),[n,s]}aF(){var t,e,i,r,n,s;if(!this.b)return null;let a=this.aK,o=this.aj;return We(a,9999,9999,999),We(o,-9999,-9999,-9999),Ne(a,a,null===(i=null===(e=null===(t=this.d)||void 0===t?void 0:t.d)||void 0===e?void 0:e.e)||void 0===i?void 0:i.a),ze(o,o,null===(s=null===(n=null===(r=this.d)||void 0===r?void 0:r.d)||void 0===n?void 0:n.e)||void 0===s?void 0:s.g),this.ak(a,o,this.aQ)}X(){const t=this.ai;if(!this.ac)return;if(this.u){We(this.r,this.bZ,this.bZ,this.bZ);const t=this.u.c,r=this.u;if(!t.ac)return;Ve(this.r,this.r,r.d),e=this.aQ,i=this.r,e[0]=i[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=i[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,ui(this.aQ,r.b,this.aQ),r.a>=0&&r.a<t.aM.length&&ui(this.aQ,t.aM[r.a].a,this.aQ),ui(this.aQ,t.aQ,this.aQ)}var e,i;ui(this.bc,this.o.viewMatrix,this.aQ),hi(this.aN,this.bc),li(this.c,this.aN),this.gradientEffect&&this.aB(),this.dissolveEffect&&this.bb();let r=1e3*this.o.delta;if(!this.a&&this.d.d.a>-1){let e=r;for(let i=0;i<this.as.length;i++)this.as[i]+=e,t.h[i]>0&&(this.as[i]%=t.h[i]);this.W(this.d,e)}let n=this.b?this.b.length:0;this.T.clear();for(let t=0;t<n;++t){let e=this.b[t];if(!e.show)continue;let i=e.x.i,r=e.x.c;for(let t=0;t<i;++t)this.T.add(this.ai.M[r+t])}let s=t.n.length;if(this.aM){for(let t=0;t<s;++t)this.aM[t].d=!1;for(let t=0;t<s;++t)this.aM[t].m(r);this.k()}if(this.b&&this.b.forEach(t=>t.o()),this.bd&&this.bd.sort(function(t,e){return t.z.b!=e.z.b?t.z.b-e.z.b:t.meshId-e.meshId}),this.Y=!1,this.F&&this.ax)for(let t=0;t<this.F.length;++t)this.F[t].Y(this.d,this.o.delta);if(this.R&&this.aD)for(let t=0;t<this.R.length;++t)this.R[t].n(this.d,this.o.delta),this.R[t].Y()}aJ(t,e){this.av[t]=e,this.Y=!0}ab(t,e,i){this.U=[t,e,i],this.Y=!0}aU(t){this.aL=t}ba(t){this.t=!!t}H(t){this.ax=!!t}e(t){this.aD=!!t}aR(t,e){const i=this;if(!i.ac)return;let r=100*e,n=r+_r[e]+t,s=i.b.some(t=>t.meshId==n);n=s?n:100*e+1,i.aa(r,r+99,!1),i.aa(n,n,!0)}aa(t,e,i){const r=this.ai;if(!this.b||0==this.b.length)return!1;for(let r=0;r<this.b.length;++r){const n=this.b[r];n.meshId>=t&&n.meshId<=e&&(n.show=i)}if(r.D&&r.D.length>0&&this.F)for(let n=0;n<r.D.length&&n<this.F.length;++n){let s=r.D[n];s>=t&&s<=e&&(this.F[n].ak=i)}return!0}M(t,e){if(!this.b)return;const i=e+1;let r=t>0?e+t:-2==t?e+0:i,n=this.b.some(t=>t.meshId==r);r=n||-2==t?r:i,this.aa(r,r,!0)}S(t){this.a=t}ae(t){this.ai.P&&(this.am(t,this.d),this.d.c=!1,this.d.d.b=!1,this.d.d.c=0)}W(t,e){var i,r,n,s;const a=this.ai;if(t.d.c+=e,na.al&&this.aM&&this.aM.length>0&&(this.y+=e,this.y>=na.z)){this.y=0;const e=t.d,i=t.b,r=t.e,n=e.e?e.e.f:-1,s=e.e?e.e.i:"none";let a=0,o=0;for(let t=0;t<this.aM.length;t++){const i=this.aM[t].b.b;if(i&&i.j&&e.a<i.j.length){const t=i.j[e.a];if(t&&t.f&&t.f.length>1){o++;const e=t.f[t.f.length-1];e>a&&(a=e)}}}console.log(`[ANIM DEBUG] "${s}" time=${e.c.toFixed(1)} dur=${n} idx=${e.a} blend=${t.a.toFixed(3)} crossFade=${t.f.toFixed(3)} nextIdx=${i.a} prevIdx=${r.a} | bones=${this.aM.length} animated=${o} maxKF=${a.toFixed(1)}`)}if(t.b.a<0&&!this.t&&!t.c)if(t.d.e.l>-1){let e=32767*Math.random(),i=0,r=t.d.a,n=a.P[r];for(i+=n.m;i<e&&n.l>-1;)r=n.l,n=a.P[r],i+=n.m;t.b.a=r,t.b.e=a.P[r],t.b.c=0}else{let e=a.P.findIndex(e=>e.d==t.d.e.d&&0==e.b);e>=0&&(t.b.a=e,t.b.e=a.P[e],t.b.c=0)}let o=t.d,l=t.b,h=o.e.f-o.c,u=0,c=null;if(l.a>-1&&(c=a.P[l.a],u=c.e),u>0&&h<u&&c.f>0?(l.c=ta(u-h,c.f),t.a=h/u):t.a=1,t.f>0){let i=e/1e3;t.e.c+=e,t.f-=i/this.o.crossFadeDuration}if(o.c>=o.e.f){if(na.al&&(console.log(`[ANIM DEBUG] SWITCH: time=${o.c.toFixed(1)} >= dur=${o.e.f} | nextIdx=${l.a} nextName=${null!==(r=null===(i=l.e)||void 0===i?void 0:i.i)&&void 0!==r?r:"none"} freeze=${o.b}`),l.a>-1&&this.aM)){let t=l.a,e=o.a,i=[];for(let r=0;r<this.aM.length;r++){const a=this.aM[r],o=a.b.b;let l=o.b(e),h=o.b(t),u=o.b(0);l&&!h&&i.push(`bone[${r}] flags=0x${a.b.f.toString(16)} parent=${a.b.d} keyId=${a.b.e} fallback0=${u} dataLen=${null!==(s=null===(n=o.j)||void 0===n?void 0:n.length)&&void 0!==s?s:0}`)}i.length>0&&console.log(`[ANIM DEBUG] BONES LOSING DATA (${i.length}):`,i.join(" | "))}if(l.a>-1&&!o.b){if(l.a>-1&&a.r(l.a))for(;!(32&a.P[l.a].j)&&(64&a.P[l.a].j)>0;){const t=a.P[l.a].k;if(t<0||t>=a.P.length)break;l.a=t,l.e=a.P[t]}t.d=l,t.b=new dn,t.a=1,a.r(l.a)&&a.z(l.a)}else o.e.f>0&&(o.c=ta(o.c,o.e.f))}const d=t.d;isNaN(d.c)?d.c=0:d.e&&d.e.f>0&&d.c>=d.e.f&&(d.c=ta(d.c,d.e.f))}l(t,e=!0){this.am(t,this.d,e)}am(t,e,i=!0){const r=this.ai;let n=!1,s=!1;this.I=-1;const a=t==ea;a&&(t=ia,this.ba(!0));for(let o=0;o<r.P.length;++o){const l=r.P[o];if(l.i&&(l.i==t&&0==l.b)){if(n=!0,r.r(o))return this.I=o,r.z(o).then(()=>{this.I===o&&(this.I=-1,this.aH(o,l,e,i,a))}),!1;s=this.aH(o,l,e,i,a);break}}return t==ia||n?s:this.am(ia,e)}aH(t,e,i,r,n){r&&null!=i.d&&(null!=i.e&&(i.f=1),i.e=new dn,i.e.a=i.d.a,i.e.e=i.d.e,i.e.c=i.d.c);const s=i.d.a!=t;return i.d.a=t,i.d.e=e,i.d.c=0,i.b=new dn,i.a=0,i.c=n,s}ag(t){this.w=t}ad(t){const e=this.ai;let i=null;if(!e.L||!e.L.length)return null;if(t<e.L.length)i=e.R[e.L[t]];else for(let t=0;t<e.L.length;t++){const r=e.L[t];if(-1!=r){i=e.R[r];break}}return i}get gradientEffect(){return this.aE}set gradientEffect(t){this.Y=!0,this.aE=t,this.P()}get shadowyEffect(){return this.g}set shadowyEffect(t){this.Y=!0,this.g=t,this.aA()}get dissolveEffect(){return this.bh}set dissolveEffect(t){this.Y=!0,this.bh=t,this.v(),this.aw()}O(t){if(this.u){const t=this.u.c;if(t&&!t.ac)return}if(this.be&&this.bd){if(null!=this.gradientEffect){if(t)for(let t=0;t<this.bd.length;++t)this.bd[t].show&&this.bd[t].j(!1,!0);for(let e=0;e<this.bd.length;++e)this.bd[e].show&&this.bd[e].j(t,!1)}else for(let e=0;e<this.bd.length;++e)this.bd[e].show&&this.bd[e].j(t,!1)}if(this.F&&this.ax)for(let e=0;e<this.F.length;++e)this.F[e].U(t);if(this.R&&this.aD)for(let e=0;e<this.R.length;++e)this.R[e].ah(t)}D(t){if(this.az==t)return;if(this.ac)for(let t=0;t<this.aM.length;t++)this.aM[t].s=null;if(this.az=t,t<=0)return;let e=this.o.options.contentPath+"bone/"+t+".bone",i=this;$.ajax({url:e,type:"GET",dataType:"binary",responseType:"arraybuffer",processData:!1,renderer:this.o,success:function(t){i.K(t)},error:function(t,e,i){console.log(i)}})}K(t){let e=new cn(t);e.getInt32();for(;e.position<e.buffer.byteLength;){let t=String.fromCharCode(e.getUint8(),e.getUint8(),e.getUint8(),e.getUint8()),i=e.getUint32();if("BIDA"==t){let t=i/2;this.J=new Array(t);for(let i=0;i<t;i++)this.J[i]=e.getUint16()}if("BOMT"==t){let t=i/64;this.B=new Array(t);for(let i=0;i<t;i++){let t=ai(e.getFloat(),e.getFloat(),e.getFloat(),e.getFloat(),e.getFloat(),e.getFloat(),e.getFloat(),e.getFloat(),e.getFloat(),e.getFloat(),e.getFloat(),e.getFloat(),e.getFloat(),e.getFloat(),e.getFloat(),e.getFloat());this.B[i]=t}}}this.ac&&this.aG()}aG(){if(!(this.az<=0)&&this.J&&this.J.length)for(let t=0;t<this.J.length;t++)this.aM[this.J[t]].s=this.B[t]}P(){if(!this.gradientEffect)return;const t=this.gradientEffect,e=this.ah;e.u_gradGradientColors_0=[...t.GradientStart,1],e.u_gradGradientColors_1=[...t.GradientMid,0],e.u_gradGradientColors_2=[...t.GradientEnd,t.MidValue],e.u_gradEdgeColor=[...t.EdgeColor,t.FresnelPower],e.u_gradBoundingBox=[0,0,0,1],e.u_gradUpVec=[0,0,1,0],e.u_gradFlags=[(1&t.Flags)>0?1:0,1,(4&t.Flags)>0?1:0,(8&t.Flags)>0?1:0]}aB(){if(!this.gradientEffect)return;const t=this.ah,e=this.ai.u,i=this.ai.l,r=i[2]-e[2];Ji(this.s,.5*(e[0]+i[0]),.5*(e[1]+i[1]),e[2],1),tr(this.s,this.s,this.bc),Ji(this.aP,0,0,1,0),tr(this.aP,this.aP,this.c),We(this.r,this.aP[0],this.aP[1],this.aP[2]),Ye(this.r,this.r),t.u_gradBoundingBox[0]=this.s[0],t.u_gradBoundingBox[1]=this.s[1],t.u_gradBoundingBox[2]=this.s[2],t.u_gradBoundingBox[3]=r>0?1/r:1,t.u_gradUpVec[0]=this.r[0],t.u_gradUpVec[1]=this.r[1],t.u_gradUpVec[2]=this.r[2]}aA(){if(!this.shadowyEffect)return;const t=this.shadowyEffect,e=this.aT,i=t.PrimaryColor,r=(i>>16&255)/255,n=(i>>8&255)/255,s=(255&i)/255;let a,o,l;if(1&t.Flags){const e=t.SecondaryColor;a=(e>>16&255)/255,o=(e>>8&255)/255,l=(255&e)/255}else a=r,o=n,l=s;e.u_shadowInnerColor=[r,n,s,t.InnerStrength],e.u_shadowOuterColor=[a,o,l,t.OuterStrength]}v(){if(!this.dissolveEffect)return;const t=this.dissolveEffect,e=this.ap;e.u_dissolveMisc=[t.EndValue,t.Ramp,0,0];const i=t.TextureScrollRateU||[0,0,0],r=t.TextureScrollRateV||[0,0,0],n=t.TextureScaleU||[1,1,1],s=t.TextureScaleV||[1,1,1],a=t.Scale,o=a&&Math.abs(a)>4.7683716e-7?a:1,l=1/o;e.u_dissolveTransform0=[0,0,(n[0]||1)*o,(s[0]||1)*o],e.u_dissolveTransform1=[0,0,(n[1]||1)*o,(s[1]||1)*o],e.u_dissolveTransform2=[0,0,(n[2]||1)*o,(s[2]||1)*o],this.G=[[(i[0]||0)*l,(r[0]||0)*l],[(i[1]||0)*l,(r[1]||0)*l],[(i[2]||0)*l,(r[2]||0)*l]];const h=t.ModX||[1,1,1,1];e.u_dissolveModX=[h[1],h[2],h[3],h[0]];const u=t.BlendModes||[0,1,2,3];e.u_dissolveSwizzle=[u[0]||0,u[1]||1,u[2]||2,u[3]||3],e.u_dissolveProcParams=[0,t.FresnelIntensity||0,0,1];const c=t.EndValue;e.u_dissolveEdgeGlowColor=[(t.EdgeOverlayU||0)*c,(t.EdgeOverlayV||0)*c,(t.EdgeOverlayScale||0)*c,t.EdgeOverlayIntensity||0];const d=8192&(t.Flags||0)?1:0;e.u_dissolveEdgeGlowParams=[d,0,t.AlphaThreshold||1,0],e.u_dissolveFlags=[0,1,0,0]}bb(){if(!this.dissolveEffect||!this.G)return;const t=.001*this.o.time,e=this.G;for(let i=0;i<3;i++){const r=this.ap["u_dissolveTransform"+i];if(!r)continue;const n=t*e[i][0],s=t*e[i][1];r[0]=n-Math.floor(n),r[1]=s-Math.floor(s)}}aw(){if(!this.dissolveEffect)return void(this.p=[]);const t=this.dissolveEffect.Textures||[];this.p=t.slice(0,3).filter(t=>t>0).map(t=>this.o.getTexture(t))}ay(t){let e=Yr();if($r(e,t),this.F)for(let i=0;i<this.F.length;i++)this.F[i].a(t,e);if(this.R)for(let e=0;e<this.R.length;e++)this.R[e].ai(t)}aW(){return this.u}V(t){if(this.F)for(let e=0;e<this.F.length;e++)this.F[e].W(t);this.n=t}}na.al=!1,na.z=500;class sa{static c(t,e,i){const r=Rr[e];if(r){const e=i?4:0;return r.slice(2*t+e,2*t+e+2)}}static a(t,e,i,r){let 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];if(!t)return WH.debug("selectBestTexture:","textures are null"),null;for(let s=0;s<t.length;s++){let a=t[s],o=a.Gender,l=a.Class,h=a.Race,u=a.ExtraData,c=0;if(e>1||o!=e){if(o<2)continue;c=0}else c=2;let d=1;if(i>0&&l==i)d=0;else if(l>0)continue;let f=1;if(r>0&&h==r)f=0;else if(h>0)continue;n[u+3*(f+2*(c+d))]=a.FileDataId}for(let t=0;t<2;t++)for(let e=0;e<2;e++)for(let i=0;i<2;i++){let r=3*(t+2*(e+2*i));if(n[r]>0){let t;return t={a:n[r],c:n[r+1],b:n[r+2]},t}}const s=sa.c(e,r,!0);return s&&0!=s[0]?(r=s[0],e=s[1],sa.a(t,e,i,r)):null}static b(t,e,i,r,n){let s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(let a=0;a<t.length;a++){let o=t[a],l=o.Gender,h=o.Class,u=o.Race,c=o.ExtraData,d=0;if(i>1||l!=i){if(l<2)continue;d=0}else d=2;let f=1;if(r>0&&h==r)f=0;else if(h>0)continue;let g=1;if(n>0&&u==n)g=0;else if(u>0)continue;let p=1;if(-1==e||c!=e){if(-1!=c&&-1!=e)continue}else p=0;s[p+2*(g+2*(d+f))]=o.FileDataId}for(let t=0;t<2;t++)for(let e=0;e<2;e++)for(let i=0;i<2;i++)for(let r=0;r<2;r++){let n=r+2*(t+2*(e+2*i));if(s[n])return s[n]}const a=sa.c(i,n,!1);return a&&0!=a[0]?(n=a[0],i=a[1],sa.b(t,e,i,r,n)):0}}class aa{constructor(){this.a=!1,this.e=[]}get loaded(){let t=!!this.f&&this.f.ac;if(t&&this.e.length>0){for(let t of this.e)t();this.e=[]}return t}isLoaded(){return this.loaded}d(t){this.e.push(t)}c(){return this.f}b(t){t.b(this.f,this.a)}getNumAnimations(){var t;return(null===(t=this.f)||void 0===t?void 0:t.ac)?0==this.f.ai.P.length?0:this.f.ai.P.length+1:0}getAnimation(t){var e;return(null===(e=this.f)||void 0===e?void 0:e.ac)?this.f.Q(t):""}resetAnimation(){var t;if(null===(t=this.f)||void 0===t?void 0:t.ac)return this.f.aY()}setAnimPaused(t){var e;if(null===(e=this.f)||void 0===e?void 0:e.ac)return this.f.S(t)}setTPose(t){var e;if(null===(e=this.f)||void 0===e?void 0:e.ac)return this.f.ag(t)}setAnimation(t,e){var i;(null===(i=this.f)||void 0===i?void 0:i.ac)&&this.f.l(t,!!e)}setParticlesEnabled(t){var e;(null===(e=this.f)||void 0===e?void 0:e.ac)&&this.f.H(t)}setRibbonsEnabled(t){var e;(null===(e=this.f)||void 0===e?void 0:e.ac)&&this.f.e(t)}getTexUnits(){var t;return(null===(t=this.f)||void 0===t?void 0:t.ac)?this.f.b:null}setAnimNoSubAnim(t){this.f&&this.f.ba(t)}attachList(t){}setItems(t){}clearSlots(t){}setSheath(t,e){}setAppearance(t){}setShouldersOverride(t){}setCustomizationsLoadedCallback(t){}setModelLoadedCallback(t){throw new Error("Method not implemented.")}setAnimationOverride(t,e){throw new Error("Method not implemented.")}resetAnimationOverride(t){throw new Error("Method not implemented.")}getAnimationDuration(t){throw new Error("Method not implemented.")}getModelBounds(){throw new Error("Method not implemented.")}isRenderReady(){throw new Error("Method not implemented.")}}class oa extends aa{constructor(t,e,i,r,n,s){super(),this.hg=t,this.fe=e,this.i=i,this.ba=r,this.l=n,this.a=s}get fileDataId(){return this.f?this.f.aI:0}get modelInstance(){return this.f}j(){256&this.fe.Item.Flags&&(this.winding=!0,this.isMirrored=!0,this.f.au())}k(t,e,i){this.f&&this.f.aC(t,e,i)}dc(t,e){this.f&&this.f.aR(t,e)}m(t,e,i){this.f&&this.f.aa(t,e,i)}setParticlesEnabled(t){this.f&&this.f.H(t)}get winding(){return!!this.f&&this.f.i}set winding(t){this.f&&(this.f.i=t)}get isMirrored(){return!!this.f&&this.f.isMirrored}set isMirrored(t){this.f&&(this.f.isMirrored=t)}getBounds(){return this.modelInstance.ac?this.modelInstance.aF():[null,null]}g(){this.f&&this.f.X()}h(t){this.f&&this.f.O(t)}}class la extends oa{constructor(t,e,i,r){if(super(t,null,0,0,0,r),this.f=new na(t,t.renderer,e),i)for(let e in i)0!=i[e]&&this.f.aJ(+e,t.getTexture(i[e]))}}class ha{constructor(){this.c=!1,this.b=!1,this.d=null}}const ua=class{constructor(t,e){this.k=t,this.c=[],this.o=[],this.l=!1,this.h=!1;let i=0;if(e.proceduralEffects)for(const t of e.proceduralEffects)this.c.push({effectType:1,effect:t});if(e.modelAttachEffects)for(const t of e.modelAttachEffects)this.c.push({effectType:2,effect:t,modelIndex:i++});if(e.shadowyEffects)for(const t of e.shadowyEffects)this.c.push({effectType:7,effect:t});if(e.dissolveEffects)for(const t of e.dissolveEffects)this.c.push({effectType:11,effect:t});if(e.edgeGlowEffects)for(const t of e.edgeGlowEffects)this.c.push({effectType:12,effect:t});if(e.beamEffects)for(const t of e.beamEffects)this.c.push({effectType:13,effect:t});if(e.cloneEffects)for(const t of e.cloneEffects)this.c.push({effectType:15,effect:t});if(e.gradientEffects)for(const t of e.gradientEffects)this.c.push({effectType:16,effect:t})}i(t){for(const e of this.c){if(2!==e.effectType)continue;const i=e.modelIndex;this.o[i]&&this.o[i].e&&this.o[i].e.loaded&&this.o[i].e.c().l(t)}}n(t){this.l=t}d(){if(this.k.loaded)for(const t of this.c)switch(t.effectType){case 1:this.j(t.effect);break;case 2:this.f(t.effect,t.modelIndex);break;case 7:this.a(t.effect);break;case 11:this.g(t.effect);break;case 12:case 13:case 15:break;case 16:this.m(t.effect)}}j(t){let e=this.k.c();if(1==t.ProcEffectType){let i=t.Value[0];e.A=qi((i>>16&255)/255,(i>>8&255)/255,(255&i)/255,e.A[3])}else if(14==t.ProcEffectType){let i=Math.min(Math.max(t.Value[0],0),1);e.A[3]=i}else if(22==t.ProcEffectType){let i=t.Value[3];e.A=qi((i>>16&255)/255,(i>>8&255)/255,(255&i)/255,e.A[3])}}f(t,e){if(!this.k)return;if(!this.k.loaded)return;let i=this.k.c();if(!this.o[e]){const r=new ha;if(this.o[e]=r,0==t.ModelType){const e=new la(i.o,t.Model,{2:t.Texture},!1);r.e=e}else 1==t.ModelType||2==t.ModelType&&Ma.a(i.o,wr.NPC,t.Model).then(t=>{r.e=t})}const r=this.o[e];if(!r.c){if(!r.e&&!r.a)return;if(r.e&&!r.e.loaded)return;if(r.a&&!r.a.C)return;let b=t.AttachmentID;t.Positioner>-1&&(b=t.Positioner),b<0&&(b=19);let y=i.ad(b);const F=y?y.d:-1;let v=ni();if(y){let t=y.b;ci(v,v,Ue(t[0],t[1],t[2]))}if(ci(v,v,Ue(t.Offset[0],-t.Offset[1],t.Offset[2])),gi(v,v,-t.Yaw),n=v,s=v,a=t.Pitch,o=Math.sin(a),l=Math.cos(a),h=s[0],u=s[1],c=s[2],d=s[3],f=s[8],g=s[9],p=s[10],m=s[11],s!==n&&(n[4]=s[4],n[5]=s[5],n[6]=s[6],n[7]=s[7],n[12]=s[12],n[13]=s[13],n[14]=s[14],n[15]=s[15]),n[0]=h*l-f*o,n[1]=u*l-g*o,n[2]=c*l-p*o,n[3]=d*l-m*o,n[8]=h*o+f*l,n[9]=u*o+g*l,n[10]=c*o+p*l,n[11]=d*o+m*l,fi(v,v,t.Roll),di(v,v,[t.Scale1,t.Scale1,t.Scale1]),di(v,v,[t.Scale2,t.Scale2,t.Scale2]),r.e){const e=r.e.c();e.S(this.l),t.ModelAlpha&&(e.A[3]=t.ModelAlpha),2&t.Flags&&(r.b=!0),t.StartAnimID>0&&t.StartAnimName?(e.l(t.StartAnimName,!1),t.AnimID>0&&t.AnimName&&(r.d=t.AnimName)):t.AnimID>0&&t.AnimName&&e.l(t.AnimName,!1),e.aC(this.k.c(),F,v)}this.o[e].c=!0}var n,s,a,o,l,h,u,c,d,f,g,p,m;if(r.e){const t=r.e.c();if(r.b&&t.ac){const e=i.Q(i.d.d.a),r=t.Q(t.d.d.a);e&&e!==r&&t.l(e)}if(r.d&&t.ac){const e=t.d.d;e.e&&e.c>=e.e.f&&(t.l(r.d,!0),r.d=null)}r.e.g()}r.a&&r.a.b()}m(t){const e=this.k.c();e.gradientEffect||(e.gradientEffect=t)}a(t){const e=this.k.c();e.shadowyEffect||(e.shadowyEffect=t)}g(t){const e=this.k.c();e.dissolveEffect||(e.dissolveEffect=t)}e(t){for(const e of this.o)e&&e.c&&(e.e&&e.e.h(t),e.a&&e.a.h(t))}b(){for(const t of this.o)t&&(t.c=!1,t.e&&t.e.loaded&&t.e.c().aC(null,-1,null),t.a&&t.a&&t.a.K())}p(t){this.o.forEach(e=>{e.e&&e.e.b(t),e.a&&e.a.p(t)})}};class ca extends aa{constructor(t,e){super(),this.o=t,this.s=e,this.l=!1,this.m=!1,this.p=!1,this.ba=-1,this.y=-1,this.v=[],this.fe={},this.z=[],this.r=!1,this.B=null,this.C=0,this.n(e)}n(t){if(this.r)return;this.o.options;if(t.StateKits)for(const e of t.StateKits)this.z.push(new ua(this,e));if(t.Creature&&(this.B=t.Creature.CreatureGeosetData,this.C=t.Creature.CreatureGeosetDataID),t.Model&&(this.f=new na(this.o,this.o.renderer,t.Model),this.f.q(),t.Creature&&t.Creature.ParticleColor&&this.f.V(t.Creature.ParticleColor),t.Scale&&this.f.bg(t.Scale)),this.s.Creature&&this.s.Creature.Texture&&(this.t=this.i(-1,sa.a(this.s.TextureFiles[this.s.Creature.Texture],3,0,0)),this.f.ab(this.t.c,this.t.a,this.t.b)),t.Textures)for(let e in t.Textures)0!=t.Textures[e]&&this.f.aJ(+e,this.o.getTexture(t.Textures[e]));this.p=!0,this.x()}i(t,e){let i=new Wr;return e.a>0&&(i.c=this.o.getTexture(e.a)),e.c>0&&(i.a=this.o.getTexture(e.c)),e.b>0&&(i.b=this.o.getTexture(e.b)),i}x(){this.r||(this.p=!0,this.t||(this.m=!0))}u(t){this.hg=null,t<=0||(this.l=!1,Ma.a(this.o,wr.NPC,t).then(t=>{t instanceof ca&&(this.hg=t)}))}w(){this.f,this.hg}setAnimation(t,e=!0){this.hg&&(this.hg.setAnimation(t),t="Mount"),this.f?this.f.l(t,e):this.d(()=>{var i;null===(i=this.f)||void 0===i||i.l(t,e)})}j(){const t=this.f;if(t.aa(0,0,!0),0!=this.C&&(t.aa(1,1699,!1),this.B))for(let e of this.B){let i=100*(e.GeosetIndex+1),r=i+e.GeosetValue;t.aa(i,i+99,!1),t.aa(r,r,!0)}}q(){this.j()}A(){const t=this.f;t.ac&&this.p&&t.b&&0!=t.b.length&&(this.q(),this.p=!1)}setParticlesEnabled(t){this.f&&this.f.H(t)}getBounds(){if(this.f&&this.f.ac){const[t,e]=this.f.aF();if(this.hg&&this.hg.loaded&&this.l){const[i,r]=this.hg.getBounds();ze(i,i,Ue(0,0,0)),Ne(t,t,i),ze(e,e,r)}return[t,e]}return[null,null]}g(){if(!this.r&&this.loaded){if(!this.l&&this.f&&this.hg&&this.hg.loaded){const t=this.hg.f.ai,e=t.R[t.L[0]],i=ni();ci(i,i,e.b),this.f.aC(this.hg.f,e.d,i,1/this.hg.f.bZ),this.f.l("Mount",!1),this.l=!0}this.dc&&this.dc.g(),this.hg&&this.hg.g(),this.z&&this.z.forEach(t=>t.d()),this.A(),this.f.X()}}h(t){this.f.O(t),this.hg&&this.hg.h(t),this.z&&this.z.forEach(e=>e.e(t))}b(t){super.b(t),this.hg&&this.hg.b(t),this.dc&&this.dc.b(t),this.z&&this.z.forEach(e=>e.p(t))}}function da(t){return new Promise((e,i)=>{$.getJSON(t).done(function(t){e(t)}).fail(function(t,e,r){let n=e+", "+r;console.log("Error loading metadata: "+n),i(e)})})}function fa(t,e,i){let r;return e==wr.HELM?ga(t,1,i):e==wr.SHOULDER?ga(t,3,i):e==wr.ITEM?ga(t,-1,i):(e==wr.NPC||e==wr.HUMANOIDNPC?r="meta/npc/":e==wr.OBJECT?r="meta/object/":e==wr.CHARACTER?r="meta/character/":e==wr.ITEMVISUAL&&(r="meta/itemvisual/"),da(t+r+i+".json"))}function ga(t,e,i){let r="meta/item/";return 1!=e&&3!=e&&4!=e&&5!=e&&6!=e&&7!=e&&8!=e&&9!=e&&10!=e&&16!=e&&19!=e&&20!=e||(r="meta/armor/"+e+"/"),da(t+r+i+".json")}class pa{constructor(){this.e=null,this.d=1,this.b=0,this.a=-1,this.c=!1}}class ma{constructor(t,e){this.b=t,this.a=e}}class ba extends pa{constructor(){super(...arguments),this.ba=[]}}class ya{constructor(t,e){this.a=t,this.b=e}}function Fa(t,e){return t==e||!!t&&(!!e&&(t.b==e.b&&(t.a==e.a||!!t.a&&(!!e.a&&(t.a.a==e.a.a&&(t.a.b==e.a.b&&t.a.c==e.a.c))))))}class va{constructor(t,e){this.j=t,this.b=[],this.c=e,this.h={},this.f={}}a(){const t=[];for(let e of this.c.Options)for(let i of e.Choices)for(let e of i.Elements)e.SkinnedModel&&t.push(e.SkinnedModel.CollectionFileDataID);const e=new Set(t),i=this.j.o;i.renderer;if(0!=e.size)for(let t of e){const e=new ba;e.e=new la(i,t,{},!0),this.j.L[t]=e}}e(t){return sa.a(this.c.TextureFiles[t],this.j.gf,this.j.N,this.j.kj)}d(t){WH.debug("applyCustomization options",t),this.b=[],this.j.v=[];for(const t in this.j.L){this.j.L[t].ba=[]}let e=0,i={},r={};for(let n=0;n<t.length;n++){let s=this.c.Options.find(e=>e.Id==t[n].optionId);if(WH.debug("option",s),s){let a=s.Choices.find(e=>e.Id==t[n].choiceId);if(WH.debug("choice",a),a){let n=a.Elements.filter(e=>e.BoneSet&&e.BoneSet.BoneFileDataID&&(0==e.VariationChoiceID||t.some(t=>t.choiceId==e.VariationChoiceID)));n.length>0&&(e=n[0].BoneSet.BoneFileDataID);let o=a.Elements.filter(e=>e.Material&&(0==e.VariationChoiceID||t.some(t=>t.choiceId==e.VariationChoiceID)));o.sort((t,e)=>e.VariationChoiceID-t.VariationChoiceID),o.forEach(t=>{WH.debug("element material",t);let e=this.e(t.Material.MaterialResourcesID);if(!e)return void WH.debug("element material: can't get texture files for material",t);let n=this.c.TextureLayers.find(e=>e.ChrModelTextureTargetID==t.Material.TextureTarget);if(!n)return void WH.debug("element material: can't get texture layer for material",t);const s=new ya(e,n.TextureType);Fa(s,this.f[t.Material.TextureTarget])?(i[t.Material.TextureTarget]=this.h[t.Material.TextureTarget],r[t.Material.TextureTarget]=this.f[t.Material.TextureTarget]):(i[t.Material.TextureTarget]=this.j.i(n.TextureType,e),r[t.Material.TextureTarget]=s)}),a.Elements.filter(e=>e.Geoset&&(0==e.VariationChoiceID||t.some(t=>t.choiceId==e.VariationChoiceID))).sort((t,e)=>t.Geoset.GeosetType-e.Geoset.GeosetType||t.Geoset.GeosetID-e.Geoset.GeosetID).forEach(t=>{WH.debug("element geoset",t),this.b.push(100*t.Geoset.GeosetType+t.Geoset.GeosetID)}),a.Elements.filter(e=>e.SkinnedModel&&(0==e.VariationChoiceID||t.some(t=>t.choiceId==e.VariationChoiceID))).forEach(t=>{WH.debug("element skinnedmodel",t),t.ChrCustItemGeoModifyID;const e=this.j.L[t.SkinnedModel.CollectionFileDataID];t.SkinnedModel.GeosetID<100&&e.ba.push(new ma(100*t.SkinnedModel.GeosetType+t.SkinnedModel.GeosetID,(1&t.SkinnedModel.Flags)>0))});let l=a.Elements.find(e=>0!=e.CondModelFileDataId&&(0==e.VariationChoiceID||t.some(t=>t.choiceId==e.VariationChoiceID)));24!=s.Id&&353!=s.Id||(l&&!this.j.overrideModelFile?this.j.overrideModelFile=l.CondModelFileDataId:!l&&this.j.overrideModelFile&&(this.j.overrideModelFile=0)),a.Elements.filter(e=>e.ChrCustItemGeoModifyID&&(0==e.VariationChoiceID||t.some(t=>t.choiceId==e.VariationChoiceID))).forEach(t=>{WH.debug("element ChrCustItemGeoModify",t),this.j&&this.j.v.push(t.ChrCustItemGeoModifyID)})}}}if(!this.h[10]){let e=this.c.Options.find(t=>t.Id==this.c.HairStyleOptionId);if(e){let n=e.Choices[1];if(n){let e=n.Elements.filter(e=>e.Material&&10==e.Material.TextureTarget&&(0==e.VariationChoiceID||t.some(t=>t.choiceId==e.VariationChoiceID)));if(e.length>0){let t=this.e(e[0].Material.MaterialResourcesID);if(t){const n=new ya(t,0);Fa(n,this.f[e[0].Material.TextureTarget])?(i[e[0].Material.TextureTarget]=this.h[e[0].Material.TextureTarget],r[e[0].Material.TextureTarget]=this.f[e[0].Material.TextureTarget]):(i[e[0].Material.TextureTarget]=this.j.i(6,t),r[e[0].Material.TextureTarget]=n)}}}}}this.h=i,this.f=r,this.j.c().D(e),this.j.m=!0}i(){let t=[];for(let e=0;e<this.c.Options.length;e++){let i=this.c.Options[e];if(i){let e=i.Choices[0];e&&t.push({optionId:i.Id,choiceId:e.Id})}}this.d(t)}g(t){let e={options:t,sheathMain:-1,sheathOff:-1};for(let t of this.c.Options)e.options.some(e=>e.optionId==t.Id)||e.options.push({optionId:t.Id,choiceId:t.Choices[0].Id});return e}}class Sa{constructor(){this.b=null,this.a=1,this.c=!1}}const Ca=class{constructor(t,e,i){this.j=t,this.e=e,this.i=[],this.h=!1,this.d=[],i&&this.b(i)}a(){}b(t){this.g=t;fa(this.j.hg.options.contentPath,wr.ITEMVISUAL,t).then(t=>{this.c(t)})}c(t){if(this.i=new Array(7),t.ItemEffects)for(let e=0;e<t.ItemEffects.length;++e){let i=t.ItemEffects[e];if(-1==i.SubClass||this.e==i.SubClass){if(i.Model){const t=new Sa;this.i[i.Slot-1]=t,t.b=new na(this.j.hg,this.j.hg.renderer,i.Model),t.a=i.Scale&&1!=i.Scale?i.Scale:1}if(i.kit){const t=new ua(this.j,i.kit);this.d.push(t)}}}for(var e=0;e<this.i.length;++e)t.Equipment[e]&&null==this.i[e]&&(this.i[e]=new Sa,this.i[e].b=new na(this.j.hg,this.j.hg.renderer,t.Equipment[e]));this.h=!0}k(t){for(let e=0;e<this.i.length;e++){const i=this.i[e];i&&i.c&&i.b.O(t)}}f(t){for(let e=0;e<this.i.length;e++){const i=this.i[e];i&&i.c&&(i.b&&i.b.ac&&t.b(i.b,!1))}}m(t,e,i){if(t.c)return;if(!i.loaded)return;if(!t.b||!t.b.ac)return;const r=i.modelInstance.ai;let n=null;if(e<=8&&6!=e&&7!=e){if(!r.R[e])return;n=r.R[e]}else n=i.modelInstance.ad(19);let s=ni();ci(s,s,n.b),di(s,s,Ue(t.a,t.a,t.a)),t.b.aC(i.modelInstance,n.d,s),t.c=!0}l(){if(this.j.loaded){for(const t of this.d)t&&t.d();for(let t=0;t<this.i.length;t++){const e=this.i[t];e&&(this.m(e,t,this.j),e.b.X())}}}};class Ta{constructor(t,e,i){this.l=t,this.n=[],this.C=!1,this.k=null,this.y=[],this.a=ni(),WH.debug("Creating item",i),this.B=e,this.v=i,this.q=t.kj,this.i=t.gf,this.z=t.N,this.D=Er[e],this.L=Mr[e],this.J=null,this.e=null,this.s=null,this.F=0,this.A=0,this.C=!1,this.H=!1,this.x=0,this.f=3,this.j=0,i&&this.g()}d(){var t=this;if(t.n){for(let e=0;e<t.n.length;++e)t.n[e]&&(t.n[e].e=null,t.n[e]=null);t.n=null}if(t.J){for(let e=0;e<t.J.length;++e)t.J[e].texture&&t.J[e].texture.h(),t.J[e].texture=null,t.J[e]=null;t.J=null}if(t.e=null,t.s=null,t.y){for(let e=0;e<t.y.length;e++)t.y[e].a();t.y=null}t.C=!1,WH.debug("Destroyed item",this.v)}g(){let t=this,e=this.l.o.options;WH.debug("Loading item",this.v),ga(e.contentPath,this.B,this.v).then(t=>{this.E(t)}).catch(()=>{t.H=!0})}E(t){if(!this.l)return void WH.debug("Char model was destroyed before it was loaded",this.v);const e=this.l.o,i=(e.options,this.i),r=this.q,n=this.z;if(this.A=t.Item.Flags,this.F=t.Item.InventoryType,this.I=t.Item.ItemClass,this.G=t.Item.ItemSubClass,t.ComponentTextures){this.J=[];for(let s in t.ComponentTextures){const a=parseInt(s),o=sa.a(t.TextureFiles[t.ComponentTextures[s]],i,n,r);if(o){let t;t={region:a,gender:this.i,file:o.a,texture:null},12!=a?t.texture=e.getTexture(o.a):16==this.B&&this.l.c().aJ(2,e.getTexture(o.a)),this.J.push(t)}}}this.e=t.Item.GeosetGroup,this.s=t.Item.AttachGeosetGroup,this.j=t.Item.GeosetGroupOverride,1==this.B&&(0==i?this.w=t.Item.HideGeosetMale:this.c=t.Item.HideGeosetFemale);let s=0;if(3==this.B?s=2:Br[this.B]!=wr.ARMOR&&(s=1),s>0&&t.ComponentModels)for(let i=0;i<s;++i){let r=Ma.b(e,t,Br[this.B],this.q,this.i,this.z);if(3==this.B&&r.cba(i+1),null==r.modelInstance)continue;const n=new pa;n.e=r,n.b=i,t.Item&&t.Item.ParticleColor&&n.e.modelInstance.V(t.Item.ParticleColor),this.n.push(n)}if((6==this.B||16==this.B)&&t.ComponentModels){let s=0;if(16==this.B&&(s=1),t.ComponentModels[s]){const a=t.ComponentModels[s],o=sa.b(t.ModelFiles[a],-1,i,n,r),l=new pa,h=0==s?t.Textures:t.Textures2;l.e=new la(e,o,h,!1),this.n=[l]}}const a=this.B;if((4==a||5==a||20==a||6==a||7==a||10==a||8==a||1==a||9==a||19==a||16==a)&&t.ComponentModels){let s=0;if(1!=a&&6!=a||(s=1),t.ComponentModels[s]){const a=t.ComponentModels[s];if(a&&t.ModelFiles&&t.ModelFiles[a]){const o=sa.b(t.ModelFiles[a],-1,i,n,r);if(o){const i=0==s?t.Textures:t.Textures2;this.k=new pa,this.k.e=new la(e,o,i,!0),this.k.e.d(()=>{this.l.p=!0})}}}}7==a&&this.e[2]>0&&(this.L+=2);const o=0!=this.x?this.x:0!=t.Item.ItemVisual?t.Item.ItemVisual:0;if(0!=o){const t=2==this.I?this.G:-1;for(let e=0;e<this.n.length;e++)this.y.push(new Ca(this.n[e].e,t,o))}this.C=!0,WH.debug("Loaded item:","DisplayId",this.v,"InventoryType",this.F),this.l.p=!0}r(t){for(let t=0;t<this.y.length;t++)this.y[t].a();this.y=[],this.x=t}o(t){this.f=t}u(t){if(3==this.B){const e=t.e.shoulderIndex;if(1==e&&!(1&this.f))return!0;if(2==e&&!(2&this.f))return!0}return!1}h(t){for(let e=0;e<this.y.length;++e)this.y[e]&&this.y[e].k(t);for(let e=0;e<this.n.length;++e){const i=this.n[e];if(i&&i.e){if(this.u(i))continue;i.e.h(t)}}}K(){if(this.n)for(let t=0;t<this.n.length;++t)this.n[t].c=!1,this.n[t].e&&this.n[t].e.k(null,-1,null);this.k&&(this.k.c=!1)}m(t,e,i){if(!t)return;if(!t.e)return;if(!t.e.modelInstance.ac)return;const r=t.b;if(r<i.length){let n=e.R[i[r]];if(t.c&&n.d==t.a)return;let s=!1,a=xr[t.e.fileDataId],o=Le(),l=ni();if(oi(l),a&&(We(o,1,1,-1),di(l,l,o),s=!0),(22==this.B||23==this.B||22==this.D)&&256&this.A&&(We(o,1,-1,1),di(l,l,o),s=!0,t.e.isMirrored=!0),13==this.B&&1024&this.A&&(We(o,1,-1,1),di(l,l,o),s=!0,t.e.isMirrored=!0),t.e.winding=s,5==this.l.ba&&26==this.B&&2==this.I&&18==this.G&&(oi(l),fi(l,l,-Math.PI/2)),ci(l,l,n.b),ui(l,l,this.a),27==this.B){let e=t.e.fe.Scale;We(o,e,e,e),di(l,l,o)}t.e.k(this.l.c(),n.d,l),t.c=!0,t.a=n.d}t.c=!0}t(t){si(this.a,t);for(let t=0;t<this.n.length;++t)this.n[t].c=!1}b(){if(!this.l.loaded)return;const t=this.l.c().ai,e=this.l.I(this.D,this);for(let i=0;i<this.n.length;++i)this.m(this.n[i],t,e),this.y[i]&&this.y[i].l();this.k&&this.l.ut(this.k);for(let t=0;t<this.n.length;++t){const e=this.n[t];if(e&&e.e){if(this.u(e))continue;e.e.g()}}}p(t){this.n.forEach(e=>{e.e.b(t)}),this.k&&this.k.e.b(t)}}class xa extends ca{constructor(t,e){super(t,e),this.J=new Map,this.P=[],this.L={},this.D=null,t.options.charCustomization&&(this.H=t.options.charCustomization),this.wv=new Array(52);for(let t=0;t<52;t++)this.wv[t]=100*t+_r[t]}get overrideModelFile(){return this.yx}set overrideModelFile(t){const e=this.yx;this.yx=t,e!=t&&(this.on(),this.O(),this.p=!0)}on(){let t=this.yx?this.yx:this.cba.Model;this.f=new na(this.o,this.o.renderer,t),this.f.q(),this.f.aU(27==this.kj||30==this.kj),this.D=null,this.p=!0}n(t){const e=this.o.options;this.kj=t.Character.Race,this.gf=t.Character.Gender,this.N=e.cls?e.cls:0;const i=e&&e.items;fa(e.contentPath,wr.CHARACTER,t.Character.ChrModelId).then(r=>{var n,s;this.cba=r,this.on(),(n=e.contentPath,s=t.Character.ChrModelId,new Promise((t,e)=>{const i=n+"meta/charactercustomization/"+s+".json";$.getJSON(i,function(e){t(e)})})).then(e=>{var r,n;if(WH.debug("Got customization data v2",e),this.ml=new va(this,e),null===(r=this.sr)||void 0===r||r.call(this,this.ml.c),this.ml.a(),this.H)this.setAppearance(this.H);else if(t.Character.Race>0&&(null===(n=null==t?void 0:t.Creature)||void 0===n?void 0:n.CreatureCustomizations)){let e=this.ml.g(t.Creature.CreatureCustomizations);this.setAppearance(e)}else this.ml.i();this.m&&this.x(),t.Equipment&&this.E(t.Equipment),i&&this.E(i)})}),this.m=!0}O(){for(const[t,e]of this.J)e.K();for(const t in this.L){this.L[t].c=!1}for(const t of this.z)t.b()}F(t,e,i){if(!this.J)return;if(3==t&&this.P&&this.P[0])return;let r=new Ta(this,t,e);i&&r.r(i);let n=r.D,s=Dr[t];this.J.get(n)&&0!=s?(r.D=s,this.J.set(s,r)):this.J.set(n,r)}G(t){var e=this.J.get(t);e||(t=Er[t],e=this.J.get(t)),e&&(this.J.delete(t),e.d())}I(t,e){const i=this.f.ai,r=[],n={14:t=>[0],26:t=>2==t.I&&18==t.G?[1]:null};if(i.R&&i.L){const s={1:t=>[11],3:t=>[6,5],22:t=>{var e;return(null===(e=n[t.B])||void 0===e?void 0:e.call(n,t))||[2]},21:t=>[1],17:t=>[1],15:t=>[2],25:t=>[1],13:t=>[1],14:t=>[0],23:t=>[2],6:t=>[53],26:t=>[1],16:t=>[57],27:t=>[55]};if(s[t]){const n=s[t](e);for(let s=0;s<n.length;++s){let a=n[s];(this.ba>=0||this.y>=0||this.hg)&&Lr[t]&&(a=Lr[t]),this.ba>=0&&21==t&&Ir[this.ba][t]&&(a=Ir[this.ba][t]),this.y>=0&&22==t&&Ir[this.y][t]&&(a=Ir[this.y][t]),15==e.F&&this.y>=0&&22==t&&Ir[this.y][e.B]&&(a=Ir[this.y][e.B]),a>=i.L.length||-1==i.L[a]||r.push(i.L[a])}}}return r}E(t){if($.isArray(t))for(let e=0;e<t.length;++e)this.F(t[e][0],t[e][1],t[e][2]);else for(let e in t)this.F(parseInt(e),t[e]);this.p=!0,this.K()}M(t,e,i){for(const r in this.L){this.L[r].e.m(t,e,i)}}q(){var t,e,i,r;const n=this.f;for(let t=0;t<52;t++)this.wv[t]=100*t+_r[t];for(const e of(null===(t=this.ml)||void 0===t?void 0:t.b)||[])e>=0&&(this.wv[Math.floor(e/100)]=e);for(const t in this.L){const e=this.L[t].ba,i=this.L[t].e;i.m(0,Ur,!1);for(const t of e)i.m(t.b,t.b,!0),this.wv[Math.floor(t.b/100)]=t.b}n.aa(0,Ur,!1),n.aa(0,0,!0);for(let t=0;t<this.wv.length;t++)n.aa(this.wv[t],this.wv[t],!0);let s=this.J.get(1),a=this.J.get(3),o=this.J.get(4),l=this.J.get(5),h=this.J.get(6),u=this.J.get(7),c=this.J.get(8),d=this.J.get(9),f=this.J.get(10),g=this.J.get(19),p=this.J.get(16),m=!1,b=!1;l&&l.e&&l.e[2]?b=!0:u&&u.e&&u.e[2]&&(m=!0);let y=b||m;this.J.forEach(t=>{if(t&&t.C&&t.k){let e=t.k.e.modelInstance;if(!e.ac)return;e.aa(0,Ur,!1),1==t.B?(e.M(t.e[0],2700),e.M(t.e[1],2100)):3==t.B?e.M(t.e[0],2600):4==t.B?(e.M(t.e[0],800),e.M(t.e[1],1e3)):5==t.B||20==t.B?(f&&f.C&&f.e[0]?e.M(-2,800):e.M(t.e[0],800),e.M(t.e[1],1e3),y&&e.M(t.e[2],1300),e.M(t.e[3],2200),e.M(t.e[4],2800)):6==t.B?e.M(t.e[0],1800):7==t.B?(e.M(t.e[0],1100),e.M(t.e[1],900),y&&e.M(t.e[2],1300)):8==t.B?(e.M(t.e[0],500),e.M(t.e[1],2e3)):10==t.B?(0==t.e[0]&&l&&l.C&&l.e[0]?e.M(-2,400):e.M(t.e[0],400),e.M(t.e[1],2300)):16==t.B?e.M(t.e[0],1500):19==t.B?e.M(t.e[0],1200):9==t.B&&(f&&f.C&&f.e[0]||null!=(null==f?void 0:f.k)||l&&l.C&&l.e[2]&&l.e[0]>0?e.M(-2,2300):e.M(t.e[0],2300))}}),this.P.forEach(t=>{if(t&&t.k){const e=t.k.e.modelInstance;e.aa(0,Ur,!1),e.M(t.e[0],2600)}}),this.J.forEach(t=>{if(t&&t.C&&t.n)for(let e of t.n){if(!e)continue;let i=e.e;1==t.B?(i.dc(t.s[0],27),i.dc(t.s[1],21)):3==t.B?i.dc(t.s[0],26):4==t.B?(i.dc(t.s[0],8),i.dc(t.s[1],10)):5==t.B||20==t.B?(i.dc(t.s[0],8),i.dc(t.s[1],10),i.dc(t.s[2],13),i.dc(t.s[3],22),i.dc(t.s[4],28)):6==t.B?i.dc(t.s[0],18):7==t.B?(i.dc(t.s[0],11),i.dc(t.s[1],9),i.dc(t.s[2],13)):8==t.B?(i.dc(t.s[0],5),i.dc(t.s[1],20)):10==t.B?(i.dc(t.s[0],4),i.dc(t.s[1],23)):16==t.B?i.dc(t.s[0],15):19==t.B?i.dc(t.s[0],12):9==t.B&&i.dc(t.s[0],23)}}),this.P.forEach(t=>{if(t&&t.n)for(let e of t.n){let i=e.e;i.dc(t.s[0],26),t.j>0&&(i.m(2600,2699,!1),i.dc(t.j,26))}});if(s&&s.C){const t=s.k||s.n[0],e=this.kj,i=0==this.gf?s.w:s.c;if(t&&i)for(let t=0;t<i.length;t++)if(i[t].RaceId==e){const r=i[t].GeosetGroup;if(5==e&&(1==r||2==r))continue;if(r<52)if(0==r)n.aa(1,99,!1);else{const t=100*r;n.aa(t,t+99,!1)}}}if(s&&s.n&&s.j>0)for(let t of s.n){let e=t.e;e.m(2600,2799,!1),e.dc(s.j,27)}if(a&&a.n&&a.j>0)for(let t of a.n){let e=t.e;e.m(2600,2699,!1),e.dc(a.j,26)}if(h&&h.n&&h.j>0)for(let t of h.n){let e=t.e;e.m(1800,1899,!1),e.dc(h.j,18)}let F=0;if(g&&(F|=16),f&&f.C&&f.e&&f.e[0]){let t=401+f.e[0];n.aa(401,499,!1),n.aa(t,t,!0)}else if(l&&l.C&&l.e&&l.e[0]){let t=801+l.e[0];n.aa(t,t,!0),f&&f.e&&0==f.e[0]&&(f.L=7,l.L=8,WH.debug("updating sorting for chest/gloves"))}if(!(l||h||d)&&o&&o.C&&o.e&&o.e[0]){let t=801+o.e[0];n.aa(t,t,!0)}if(g&&g.C)1048576&g.A||(n.aa(2200,2299,!1),n.aa(2202,2202,!0));else if(l&&l.C&&l.e&&l.e[3]){let t=2201+l.e[3];n.aa(2200,2299,!1),n.aa(t,t,!0)}let v,S=!1;if(h&&h.C&&h.e&&h.e[0]&&(S=!!(512&h.A)),b){n.aa(501,599,!1),n.aa(902,999,!1),n.aa(1100,1199,!1),n.aa(1300,1399,!1);let t=1301+l.e[2];n.aa(t,t,!0)}else if(m){n.aa(501,599,!1),n.aa(902,999,!1),n.aa(1100,1199,!1),n.aa(1300,1399,!1);let t=1301+u.e[2];n.aa(t,t,!0)}else if(c&&c.C&&c.e&&c.e[0]){n.aa(501,599,!1),n.aa(901,901,!0);let t=501+c.e[0];n.aa(t,t,!0)}else{let t;t=u&&u.C&&u.e&&u.e[1]?901+u.e[1]:901,n.aa(t,t,!0)}if(c&&c.C&&c.e&&c.e[1]>0){const t=c.e[0],e=c.e[1];v=t>=5?2001+e:2e3+e}else if(c&&c.C&&c.e&&c.e[1]<0){const t=null===(i=null===(e=c.k)||void 0===e?void 0:e.e)||void 0===i?void 0:i.modelInstance;v=(null==t?void 0:t.ac)&&(null===(r=t.b)||void 0===r?void 0:r.some(t=>t.meshId>=2001&&t.meshId<=2099))?2002:1999}else v=!c||!c.C||1048576&c.A?2001:2002;n.aa(2001,2099,!1),n.aa(v,v,!0);let C=!1;if(!y&&g&&g.C&&g.e&&g.e[0]){let t;C=!1,S?(C=!0,t=1203):(C=!0,t=1201+g.e[0]),n.aa(t,t,!0)}else 16&F&&(n.aa(1201,1201,!0),y||(n.aa(1202,1202,!0),C=!0));if(!C&&!b)if(l&&l.C&&l.e&&l.e[1]){let t=1001+l.e[1];n.aa(t,t,!0)}else if(o&&o.C&&o.e&&o.e[1]){let t=1001+o.e[1];n.aa(t,t,!0)}if(!b&&u&&u.C&&u.e&&u.e[0]){let t=u.e[0],e=1101+t,i=n.b.some(t=>t.meshId==e);t>2?(n.aa(1300,1399,!1),i?n.aa(e,e,!0):n.aa(1301,1301,!0)):C||n.aa(e,e,!0)}if(g&&g.C&&g.e&&g.e[0]&&this.v.length>0)for(let t of this.v){const e=Ar[t];if(e&&12==e.GeosetType&&e.Original==g.e[0]+1){n.aa(1200,1299,!1);let t=1200+e.Override;n.aa(t,t,!0);break}}if(p&&p.C&&p.e&&p.e[0]){n.aa(1500,1599,!1);let t=1501+p.e[0];if(this.v.length>0)for(let e of this.v){const i=Ar[e];if(i&&15==i.GeosetType&&i.Original==p.e[0]+1){t=1500+i.Override;break}}n.aa(t,t,!0)}if(h&&h.C&&h.e&&h.e[0]){n.aa(1800,1899,!1);let t=1801+h.e[0];n.aa(t,t,!0)}u||b||m||C||S?n.aa(1400,1499,!1):n.aa(1401,1401,!0)}setParticlesEnabled(t){super.setParticlesEnabled(t),this.J.forEach(e=>{if(e.n)for(let i=0;i<e.n.length;++i)e.n[i]&&e.n[i].e.setParticlesEnabled(t)})}x(){}ed(){if(!this.m)return;let t=!1;if(this.J.forEach(e=>{if(e.C||e.H){if(e.J)for(let i=0;i<e.J.length;++i)if(e.J[i].texture&&!e.J[i].texture.b())return void(t=!0)}else t=!0}),t)return;if(!this.ml)return;const e=this.ml.c.Materials,i=this.ml.c.TextureLayers,r=this.ml.c.TextureSections;let n=!0,s=!0;15!=this.kj&&21!=this.kj||(s=!1),this.J.forEach(t=>{let e=t.D;4!=e&&5!=e&&19!=e||(n=!1,null==t.J&&(n=!0)),7==e&&(s=!1,null==t.J&&(s=!0))});let a=-1;if(27==this.kj)for(let t of i)9==t.BlendMode&&1==t.TextureType&&t.Layer>a&&(a=t.Layer);const o=(l=t=>t.TextureType,i.reduce((t,e)=>{var i;return(t[i=l(e)]||(t[i]=[])).push(e),t},{}));var l;for(const t in o){const e=o[t];for(const t of e){const e=this.ml.h[t.ChrModelTextureTargetID];if(e&&!e.e())return}}for(const t in o){const i=o[t],l=i[0].TextureType;if(!this.fe[t]){const i=e.find(t=>t.TextureType==l);if(!i){WH.debug("unable to find material info",l);continue}this.fe[t]=new jr(this.o.context,i.Width,i.Height)}const h=this.fe[t];h.t();for(const t of i){let e=-1;t.Layer==a&&(e=0);const i=this.ml.h[t.ChrModelTextureTargetID];if(!i)continue;const o=t.TextureSection;if(3!=o&&5!=o||n&&3==o||s&&5==o){let n=0,s=0,a=1,l=1;if(-1!=o&&r){const t=r.find(t=>t.SectionType==o);if(!t){WH.debug("can't find texture section data",o);continue}n=t.X,s=t.Y,a=t.Width,l=t.Height}h.r(i,n,s,a,l,t.BlendMode,t.Layer,e)}}1==l&&52!=this.kj&&70!=this.kj&&this.qp(h),26!=l||52!=this.kj&&70!=this.kj||this.qp(h),h.s()}this.Az(this.f);for(let t in this.L){const e=this.L[t];e.e&&e.e.loaded&&this.Az(e.e.c())}this.m=!1}Az(t){if(this.fe[1]){const e=this.fe[1];t.ab(e.g(0),e.g(1),e.g(2))}for(let e in this.fe){this.fe[e];t.aJ(e,this.fe[e].g(0))}}qp(t){const e=[];this.J.forEach(t=>{e.push(t)}),e.sort(function(t,e){return t.L-e.L});const i=this.ml.c.TextureSections;for(let r=0;r<e.length;r++){const n=e[r];if(n.J)for(let e=0;e<n.J.length;e++){const r=n.J[e];if(r.gender==this.gf&&r.texture&&r.texture.b()&&12!=r.region){if(1&this.s.Character.ChrModelFlags&&7==r.region)continue;const e=i.find(t=>t.SectionType==r.region);if(!e){WH.debug("can't find texture section data",r.region);continue}const n=new Wr;n.c=r.texture,t.r(n,e.X,e.Y,e.Width,e.Height,0,-1,-1)}}}}setAppearance(t){var e;this.H=t,this.ba=t.sheathMain,this.y=t.sheathOff,null===(e=this.ml)||void 0===e||e.d(t.options),this.m=!0,this.p=!0,this.x(),this.K()}setCustomizationsLoadedCallback(t){this.sr=t}setItems(t){const e=this.o.options;WH.debug("setItems",t);const i=[];for(let e=0;e<t.length;e++)i.push([t[e].slot,t[e].display,t[e].visual]);i.forEach(t=>{const i=[parseInt(t[0]),parseInt(t[1])];e.items.push(i)}),this.E(i),this.m=!0}attachList(t){const e=this.o.options;WH.debug("attachList",t);const i=t.split(","),r=[];for(let t=0;t<i.length;t+=2)r.push([i[t],i[t+1]]);r.forEach(t=>{const i=[parseInt(t[0]),parseInt(t[1])];e.items.push(i)}),this.E(r),this.m=!0}clearSlots(t){const e=this.o.options;WH.debug("clearSlots",t);const i=t.split(",");for(let t=0;t<i.length;++t){this.G(parseInt(i[t]));const r=[];e.items.forEach(i=>{0!=e.items[t].indexOf(parseInt(i))&&r.push(i)}),e.items=r}this.K(),this.m=!0}setShouldersOverride(t){if(WH.debug("setShouldersOverride",t),!t||2!=t.length)return;for(let t=0;t<2;t++){const e=this.P[t];e&&e.d(),this.P[t]=null}for(let e=0;e<2;e++)if(null!=t[e]){const i=new Ta(this,3,t[e]);let r=0;r=0==e?1:2,i.o(r),this.P[e]=i}const e=this.J.get(3);if(e){let t=3;for(let e=0;e<2;e++)this.P[e]&&(t&=~(1<<e));e.o(t)}this.P&&(this.P[0]||this.P[1])&&this.G(3)}setSheath(t,e){this.ba=t,this.y=e,this.K()}K(){if(!this.loaded)return;const t=this.f;let e=(-1==this.y||!this.y)&&null!=this.J.get(22),i=!(-1!=this.ba&&this.ba||null==this.J.get(13)&&null==this.J.get(21));for(let i of kr){let r=t.ai.o[i];r>0&&r<t.aM.length&&this.f.aM[r].f(e?"HandsClosed":"")}for(let e of Pr){let r=t.ai.o[e];r>0&&r<t.aM.length&&t.aM[r].f(i?"HandsClosed":"")}}ut(t){const e=this.f;if(!e.ac)return;const i=t.e.modelInstance;if(!i||!i.ac)return;t.c||(i.aC(e,-1,null),t.c=!0);let r=i.aM;if(r){for(let t=0;t<r.length;t++){let i=r[t],n=this.D[i.b.h];if("number"!=typeof n)continue;let s=r[t].a,a=e.aM[n].a;r[t].c=!0,si(s,a)}i.X()}}ih(){const t=this.f;let e={};for(let i=0;i<t.aM.length;i++)e[t.aM[i].b.h]=i;this.D=e}g(){if(this.f&&this.f.ac){this.D||(this.ih(),this.K()),super.g();for(const t in this.L){const e=this.L[t];this.ut(e)}this.J.forEach(t=>{if(t){if(2==t.I&&13==t.G){if(21==t.D&&-1!=this.ba)return;if(22==t.D&&-1!=this.y)return}t.b()}}),this.P.forEach(t=>{t&&t.n&&t.b()}),this.ed()}}static CB(t,e){const i=t.e;if(!i.loaded)return;const r=i.modelInstance;if(!r||!r.ac)return;r.aM&&r.O(e)}h(t){if(this.f&&this.f.ac){super.h(t);for(const e in this.L){const i=this.L[e];xa.CB(i,t)}if(this.J.forEach(e=>{if(e){if(2==e.I&&13==e.G){if(21==e.D&&-1!=this.ba)return;if(22==e.D&&-1!=this.y)return}e.h(t)}}),this.P.forEach(e=>{e&&e.n&&e.h(t)}),this.k)for(let e=0;e<this.k.length;e++){let i=this.k[e];i.ac&&i.O(t)}this.J.forEach(e=>{e&&e.k&&e.k.e&&e.k.c&&xa.CB(e.k,t)})}}b(t){super.b(t);for(const e in this.L){const i=this.L[e];i.c&&(i.e&&i.e.loaded&&i.e.b(t))}if(this.J.forEach(e=>{if(e){if(2==e.I&&13==e.G){if(21==e.D&&-1!=this.ba)return;if(22==e.D&&-1!=this.y)return}e.p(t)}}),this.P.forEach(e=>{e&&e.n&&e.p(t)}),this.k)for(let e=0;e<this.k.length;e++){let i=this.k[e];i.ac&&t.b(i,!1)}}}class _a extends oa{constructor(t,e,i,r,n,s){super(t,e,i,r,n,s),this.cba()}cba(){let t=this.i;const e=this.ba,i=this.l,r=this.fe;if(r.ComponentModels){let n=r.ComponentModels[0]||r.ComponentModels[1];n&&r.ModelFiles&&r.ModelFiles[n]&&(27==r.Item.InventoryType?this.f=new na(this.hg,this.hg.renderer,r.ModelFiles[n][0].FileDataId):this.f=new na(this.hg,this.hg.renderer,sa.b(r.ModelFiles[n],-1,e,i,t)),this.f.q()),this.f&&r.Item.AttachGeosetGroup&&(this.f.aR(r.Item.AttachGeosetGroup[0],27),this.f.aR(r.Item.AttachGeosetGroup[1],21))}if(r.Textures)for(let t in r.Textures)0!=r.Textures[t]&&this.f.aJ(parseInt(t),this.hg.getTexture(r.Textures[t]))}}class Aa extends oa{constructor(t,e,i,r,n,s){super(t,e,i,r,n,s),this.ed=0,this.gf()}get shoulderIndex(){return this.ed}cba(t){this.ed!=t&&(this.ed=t,this.gf())}gf(){this.f=null;let t=this.i;const e=this.ba,i=this.l,r=this.fe;if(r.ComponentModels){let n=r.ComponentModels[0],s=r.ComponentModels[1];if(!n||1!=this.ed&&0!=this.ed){if(s&&(2==this.ed||0==this.ed)&&(s&&r.ModelFiles[s]&&(this.f=new na(this.hg,this.hg.renderer,sa.b(r.ModelFiles[s],1,e,i,t)),this.f.q()),r.Textures2&&this.f))for(let t in r.Textures2)0!=r.Textures2[t]&&this.f.aJ(+t,this.hg.getTexture(r.Textures2[t]))}else if(n&&r.ModelFiles[n]&&(this.f=new na(this.hg,this.hg.renderer,sa.b(r.ModelFiles[n],0,e,i,t)),this.f.q()),this.f&&r.Textures)for(let t in r.Textures)0!=r.Textures[t]&&this.f.aJ(+t,this.hg.getTexture(r.Textures[t]))}this.f&&r.Item.AttachGeosetGroup&&this.f.aR(r.Item.AttachGeosetGroup[0],26)}g(){this.f.X()}h(t){this.f.O(t)}}class wa extends oa{constructor(t,e,i,r,n,s){super(t,e,i,r,n,s),this.cba()}cba(){let t=this.i;const e=this.ba,i=this.l,r=this.fe;if(r.ComponentModels){let n=r.ComponentModels[0];n&&r.ModelFiles&&r.ModelFiles[n]&&(this.f=new na(this.hg,this.hg.renderer,sa.b(r.ModelFiles[n],-1,e,i,t)))}if(this.f&&r.Textures)for(let t in r.Textures)0!=r.Textures[t]&&(this.f.av[+t]=this.hg.getTexture(r.Textures[t]))}isLoaded(){return!this.f&&!this.fe.ComponentModels||this.loaded}}class Ea extends aa{constructor(t,e){super(),this.dc=t,this.fe=e,this.ba()}ba(){this.f=new na(this.dc,this.dc.renderer,this.fe.Model),this.f.bg(1|this.fe.Scale)}g(){this.f&&this.f.X()}getBounds(){return this.f.ac?this.f.aF():[null,null]}h(t){this.f&&this.f.O(t)}}class Ma{static c(t,e,i){if(e.Character||i==wr.CHARACTER)return new xa(t,e);if(i==wr.NPC||i==wr.HUMANOIDNPC)return new ca(t,e);if(i==wr.HELM||i==wr.SHOULDER||i==wr.ITEM){const r=Ma.b(t,e,i,1,0,0);return r.j(),r}if(i==wr.OBJECT)return new Ea(t,e);throw"Couldn't create actor"}static b(t,e,i,r,n,s){if(i==wr.HELM)return new _a(t,e,r,n,s,!1);if(i==wr.SHOULDER)return new Aa(t,e,r,n,s,!1);if(i==wr.ITEM)return new wa(t,e,r,n,s,!1);throw"Couldn't create item actor"}static a(t,e,i){return e==wr.PATH?new Promise((e,r)=>{e(new la(t,i,{},!1))}):fa(t.options.contentPath,e,i).then(i=>Ma.c(t,i,e))}}const Da=class{constructor(t){this.currFrame=0,this.clearColor=Ue(0,0,0),this.addedCss=!1,this.progressShown=!1,this.doUpdateBounds=!1,this.attributeState=new De,this.gxDevice=null,this.textureCache=new Map,this.crossFadeDuration=.3,this.onContextMenu=function(t){return!1};var e=this;e.viewer=t,e.options=t.options,e.downloads={},e.context=null,e.bgImgLoaded=!1,e.width=0,e.height=0,e.time=0,e.delta=0,e.actors=[],e.screenshotDataURL=null,e.makeDataURL=!1,e.screenshotCallback=null,e.azimuth=1.5*Math.PI,e.zenith=Math.PI/2,e.distance=15,e.fov=30,e.zoom={rateStep:.1,rateAccelerationDecay:.4,interpolationRate:.3,range:[.3,4],rateCurrent:0,target:1,current:1},e.zoom.range=e.zoom.range.map(function(t){return Math.log(t)/Math.log(1+e.zoom.rateStep)}),e.translation=Ue(0,0,0),e.translationFromModel=Ue(0,0,0),e.target=Ue(0,0,0),e.eye=Ue(0,0,0),e.up=Ue(0,0,1),e.lookDir=Le(),e.fullscreen=!1,e.projMatrix=ni(),e.viewMatrix=ni(),e.panningMatrix=ni(),e.viewOffset=Le(),this.addedCss||(this.addedCss=!0,$("head").append('<link rel="stylesheet" href="//wow.zamimg.com/modelviewer/viewer/viewer.css" type="text/css" />'))}updateProgress(){if(!this.stop){var t=this,e=0,i=0;for(var r in t.downloads)e+=t.downloads[r].total,i+=t.downloads[r].loaded;if(e<=0)t.progressShown&&(t.progressBg.hide(),t.progressBar.hide(),t.progressShown=!1);else{t.progressShown||(t.progressBg.show(),t.progressBar.show(),t.progressShown=!0);var n=i/e;t.progressBar.width(Math.round(t.width*n)+"px")}}}destroy(){var t=this;t.stop=!0,t.canvas&&($(t.canvas).off(),t.canvas.detach(),t.progressBg.detach(),t.progressBar.detach(),t.canvas=t.progressBg=t.progressBar=null),t.clearBackground(),t.actors=[]}method(t,e){if("isBackgroundLoaded"===t)return this.bgImgLoaded;if("setBackground"!==t){if(this.actors.length>0&&this.actors[0]){const i=this.actors[0][t];return i?i.apply(this.actors[0],e):void WH.debug("Unknown viewer method",t,"args",e)}this.actorPromises.length>0&&this.actorPromises[0]&&(this.actorPromises[0]=this.actorPromises[0].then(i=>{const r=i[t];if(r)return r.apply(i,e),i;WH.debug("Unknown viewer method",t,"args",e)}))}else this.setBackground(e[0])}getTime(){return window.performance&&window.performance.now?window.performance.now():Date.now()}draw(t){var e,i=this,r=i.context;if(i.delta=.001*(t-i.time),i.time=t,i.currFrame++,this.doUpdateBounds&&i.actors.length>0){let[t,r]=[Le(),Le()];for(e=0;e<i.actors.length;++e){const[n,s]=i.actors[e].getBounds();n&&Ne(t,t,n),s&&ze(r,r,s)}const n=Le(),s=Le();Ge(n,r,t),qe(s,t,n,.5);let a=n[2],o=n[0],l=n[1];const h=this.width/this.height,u=2*Math.tan(this.fov/2*.0174532925),c=1.2*a/u,d=1.2*o/(u*h);this.distance=Math.max(Math.max(c,d),2*l),We(this.translationFromModel,s[0],-s[2],0),this.doUpdateBounds=!1}for(i.updateCamera(),r.bindFramebuffer(r.FRAMEBUFFER,null),r.viewport(0,0,i.width,i.height),r.clearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],0),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),i.bgTexture&&i.program&&(r.useProgram(i.program),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,i.bgTexture),r.uniform1i(i.uTexture,0),r.uniform4f(i.uBGTransform,i.viewer.options.bgPosition[0]||0,i.viewer.options.bgPosition[1]||0,i.viewer.options.bgScale[0]||1,i.viewer.options.bgScale[1]||1),i.options.backgroundRotatation&&(r.uniform1f(i.uRotation,i.options.backgroundRotatation),r.uniform2f(i.uResolution,i.width,i.height)),r.bindBuffer(r.ARRAY_BUFFER,i.vb),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,null),r.enableVertexAttribArray(i.aPosition),r.vertexAttribPointer(i.aPosition,2,r.FLOAT,!1,16,0),r.enableVertexAttribArray(i.aTexCoord),r.vertexAttribPointer(i.aTexCoord,2,r.FLOAT,!1,16,8),r.depthMask(!1),r.disable(r.CULL_FACE),r.blendFunc(r.ONE,r.ZERO),r.drawArrays(r.TRIANGLE_STRIP,0,4),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),r.enable(r.CULL_FACE),r.depthMask(!0),r.disableVertexAttribArray(i.aPosition),r.disableVertexAttribArray(i.aTexCoord)),e=0;e<i.actors.length;++e)i.actors[e].g();for(r.viewport(0,0,i.width,i.height),this.gxDevice.a(),e=0;e<i.actors.length;++e)i.actors[e].h(!1);for(e=0;e<i.actors.length;++e)i.actors[e].h(!0);this.gxDevice.d()}setAdaptiveMode(t){this.addaptiveMode=t,t&&$(window).trigger("resize")}setTranslation(t,e,i){this.translation=Ue(t,e,i)}setBackground(t){var e=this;e.bgImgLoaded=!1,e.options.background=t,e.clearBackground(),e.loadBackground()}clearBackground(){var t=this;if(t.context){var e=t.context;t.bgTexture&&e.deleteTexture(t.bgTexture),t.bgTexture=null,t.program&&e.deleteProgram(t.program),t.program=null,t.vb&&e.deleteBuffer(t.vb),t.vs&&e.deleteShader(t.vs),t.fs&&e.deleteShader(t.fs),t.vb=t.vs=t.fs=null}t.bgImg&&(t.bgImg=null)}updateCamera(){var t=this;t.zoom.target+=t.zoom.rateCurrent,t.zoom.rateCurrent*=1-t.zoom.rateAccelerationDecay,t.zoom.target=-Math.max(Math.min(-t.zoom.target,t.zoom.range[1]),t.zoom.range[0]),t.zoom.current+=(t.zoom.target-t.zoom.current)*t.zoom.interpolationRate;var e=t.distance*Math.pow(t.zoom.rateStep+1,-t.zoom.current),i=t.azimuth,r=t.zenith;1==t.up[2]?(t.eye[0]=-e*Math.sin(r)*Math.cos(i)+t.target[0],t.eye[1]=-e*Math.sin(r)*Math.sin(i)+t.target[1],t.eye[2]=-e*Math.cos(r)+t.target[2]):(t.eye[0]=-e*Math.sin(r)*Math.cos(i)+t.target[0],t.eye[1]=-e*Math.cos(r)+t.target[1],t.eye[2]=-e*Math.sin(r)*Math.sin(i)+t.target[2]),Ge(t.lookDir,t.target,t.eye),Ye(t.lookDir,t.lookDir),function(t,e,i,r){var n,s,a,o,l,h,u,c,d,f,g=e[0],p=e[1],m=e[2],b=r[0],y=r[1],F=r[2],v=i[0],S=i[1],C=i[2];Math.abs(g-v)<Pe&&Math.abs(p-S)<Pe&&Math.abs(m-C)<Pe?oi(t):(u=g-v,c=p-S,d=m-C,n=y*(d*=f=1/Math.hypot(u,c,d))-F*(c*=f),s=F*(u*=f)-b*d,a=b*c-y*u,(f=Math.hypot(n,s,a))?(n*=f=1/f,s*=f,a*=f):(n=0,s=0,a=0),o=c*a-d*s,l=d*n-u*a,h=u*s-c*n,(f=Math.hypot(o,l,h))?(o*=f=1/f,l*=f,h*=f):(o=0,l=0,h=0),t[0]=n,t[1]=o,t[2]=u,t[3]=0,t[4]=s,t[5]=l,t[6]=c,t[7]=0,t[8]=a,t[9]=h,t[10]=d,t[11]=0,t[12]=-(n*g+s*p+a*m),t[13]=-(o*g+l*p+h*m),t[14]=-(u*g+c*p+d*m),t[15]=1)}(t.viewMatrix,t.eye,t.target,t.up),oi(t.panningMatrix),1==t.up[2]?We(t.viewOffset,t.translation[0],-t.translation[1],0):We(t.viewOffset,t.translation[0],0,t.translation[1]),He(t.viewOffset,t.viewOffset,this.translationFromModel),ci(t.panningMatrix,t.panningMatrix,t.viewOffset),ui(t.viewMatrix,t.panningMatrix,t.viewMatrix)}init(){var t,e=this,i=e.context;if(this.blackPixelTexture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.blackPixelTexture),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array([0,0,0,255])),i.bindTexture(i.TEXTURE_2D,null),this.greenPixelTexture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.greenPixelTexture),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array([0,255,0,255])),i.bindTexture(i.TEXTURE_2D,null),yi(e.projMatrix,.0174532925*e.fov,e.viewer.aspect,.1,500),e.updateCamera(),i.clearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],0),i.enable(i.DEPTH_TEST),i.depthFunc(i.LEQUAL),i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA),i.enable(i.BLEND),e.options.models||e.options.items){e.actorPromises=[];var r=[].concat(e.options.models);if(r.length>0){const i=e.options.mount,n=e.options.shouldersOverride;for(t=0;t<r.length;++t){const s=Ma.a(this,r[t].type,r[t].id).then(t=>(i&&i.id&&t instanceof ca&&t.u(i.id),t instanceof xa&&t.setShouldersOverride(n),e.actors.push(t),t)).then(t=>t);e.actorPromises.push(s)}}}!function t(){if(!e.stop&&(window.requestAnimationFrame(t),e.gxDevice)){var r=e.getTime();if(!1!==e.makeDataURL){if(e.canvas[0].toDataURL){var n=e.clearColor,s=e.bgTexture;e.options.transparent&&(e.bgTexture=null,e.clearColor=Ue(0,0,0)),e.draw(r);var a=e.width*e.height*4,o=new Uint8Array(a);i.readPixels(0,0,e.width,e.height,i.RGBA,i.UNSIGNED_BYTE,o);let t=null;e.options.transparent?(e.clearColor=Ue(1,1,1),e.draw(r),t=new Uint8Array(a),i.readPixels(0,0,e.width,e.height,i.RGBA,i.UNSIGNED_BYTE,t)):t=o;for(var l=new Uint8Array(a),h=0,u=0;u<e.height;u++)for(var c=0;c<e.width;c++){h=4*(u*e.width+c);var d=4*((e.height-1-u)*e.width+c),f=o[h+0],g=o[h+1],p=o[h+2],m=t[h+0],b=t[h+1],y=t[h+2],F=.001,v=1-(m-f+F)/255,S=1-(b-g+F)/255,C=1-(y-p+F)/255,T=Math.max(0,Math.min(1,(v+S+C)/3));T<.05&&(f+g+p)/3<16&&(f=m,g=b,p=y,T=0),l[d+0]=f,l[d+1]=g,l[d+2]=p,l[d+3]=Math.round(255*T)}var x=document.createElement("canvas"),_=x.getContext("2d");x.width=e.width,x.height=e.height;var A=_.createImageData(e.width,e.height);A.data.set(l),_.putImageData(A,0,0),e.screenshotDataURL=x.toDataURL.apply(x,e.makeDataURL),e.screenshotCallback&&(e.screenshotCallback(),e.screenshotCallback=null),e.clearColor=n,e.bgTexture=s}e.makeDataURL=!1}e.draw(r)}}()}onDoubleClick(t){Ci.isFullscreen()?Ci.exitFullscreen():Ci.requestFullscreen(this.canvas[0])}onFullscreen(t){let e=this;if(e.viewer.container)if(!e.fullscreen&&Ci.isFullscreen()||this.addaptiveMode){if(e.restoreWidth=e.width,e.restoreHeight=e.height,e.fullscreen=!0,Ci.isFullscreen()){var i=$(window);let t=window.screen.width||i.width(),e=window.screen.height||i.height();this.onResize(t,e,t/e)}else if(this.addaptiveMode){var r=e.viewer.container;this.onResize(r.width(),r.height(),r.width()/r.height())}}else e.fullscreen&&!Ci.isFullscreen()&&(e.fullscreen=!1,this.onResize(e.restoreWidth,e.restoreHeight,e.viewer.aspect))}onResize(t,e,i){this.resize(t,e),yi(this.projMatrix,.0174532925*this.fov,i,.1,5e3)}onMouseDown(t){let e=this;3==t.which||t.ctrlKey?e.rightMouseDown=!0:e.mouseDown=!0,"touchstart"==t.type?(e.mouseX=t.originalEvent.touches[0].clientX,e.mouseY=t.originalEvent.touches[0].clientY):(e.mouseX=t.clientX,e.mouseY=t.clientY),$("body").addClass("unselectable"),t.preventDefault()}onMouseWheel(t){if(!this.options.wheelEventValidation||this.options.wheelEventValidation.call(this,t))return this.zoom.rateCurrent+=t.originalEvent.wheelDelta>0?1:-1,t.preventDefault(),!1}onMouseUp(t){let e=this;(e.mouseDown||e.rightMouseDown)&&($("body").removeClass("unselectable"),e.mouseDown=!1,e.rightMouseDown=!1)}onMouseMove(t){let e=this;if((e.mouseDown||e.rightMouseDown)&&void 0!==e.mouseX){var i,r;"touchmove"==t.type?(i=t.originalEvent.touches[0].clientX,r=t.originalEvent.touches[0].clientY):(i=t.clientX,r=t.clientY);var n=(i-e.mouseX)/e.width*Math.PI*2,s=(r-e.mouseY)/e.width*Math.PI*2;if(e.mouseDown){1==e.up[2]?e.azimuth-=n:e.azimuth+=n,e.zenith+=s;for(var a=2*Math.PI;e.azimuth<0;)e.azimuth+=a;for(;e.azimuth>a;)e.azimuth-=a;e.zenith<1e-4&&(e.zenith=1e-4),e.zenith>=Math.PI&&(e.zenith=Math.PI-1e-4)}else e.translation[0]+=n,e.translation[1]+=s;e.mouseX=i,e.mouseY=r,t.stopPropagation()}}resize(t,e){var i=this;if(i.width!==t||i.height!==e){if(i.fullscreen||i.viewer.container.css({height:e+"px",position:"relative"}),i.width=t,i.height=e,i.canvas)i.canvas.attr({width:t,height:e}),i.canvas.css({width:t+"px",height:e+"px"}),i.context.viewport(0,0,i.width,i.height);else{if(i.canvas=$("<canvas/>"),i.canvas.attr({width:t,height:e}),i.viewer.container.append(i.canvas),i.context=i.canvas[0].getContext("webgl",{alpha:!0,premultipliedAlpha:!1})||i.canvas[0].getContext("experimental-webgl",{alpha:!0,premultipliedAlpha:!1}),i.progressBg=$("<div/>",{css:{display:"none",position:"absolute",bottom:0,left:0,right:0,height:"10px",backgroundColor:"#000"}}),i.progressBar=$("<div/>",{css:{display:"none",position:"absolute",bottom:0,left:0,width:0,height:"10px",backgroundColor:"#ccc"}}),i.viewer.container.append(i.progressBg),i.viewer.container.append(i.progressBar),!i.context)return alert("No WebGL support, sorry! You should totally use Chrome."),i.canvas.detach(),void(i.canvas=null);const r=[.35,.35,.35,1],n=[1,1,1,1],s=[.35,.35,.35,1],a=Le(),o=Le(),l=Le();Ye(a,[5,-3,3]),Ye(o,[5,5,5]),Ye(l,[-5,-5,-5]);const h={uCameraPos:i.eye,uViewMatrix:i.viewMatrix,uProjMatrix:i.projMatrix,uAmbientColor:r,uPrimaryColor:n,uSecondaryColor:s,uLightDir1:a,uLightDir2:o,uLightDir3:l};this.gxDevice=new Cr(i.context,h),this.renderer=this.gxDevice.c(),i.canvas.off("mousedown.webgl touchstart.webgl").on("mousedown.webgl touchstart.webgl",i.onMouseDown.bind(i)).off("wheel.webgl").on("wheel.webgl",i.onMouseWheel.bind(i)).off("dblclick.webgl").on("dblclick.webgl",i.onDoubleClick.bind(i)).off("contextmenu.webgl").on("contextmenu.webgl",i.onContextMenu.bind(i));let u=0,c=0,d=0;i.canvas.off("touchend.webgl").on("touchend.webgl",function(t){const e=t.originalEvent;if(!e||1!==e.changedTouches.length)return;const r=e.changedTouches[0],n=(new Date).getTime(),s=n-u,a=r.clientX-c,o=r.clientY-d,l=Math.sqrt(a*a+o*o);u=n,c=r.clientX,d=r.clientY,s<300&&l<30&&(t.preventDefault(),i.onDoubleClick.call(i,e))}),$(window).off("resize.webgl").on("resize.webgl",i.onFullscreen.bind(i)),$(document).off("mouseup.webgl touchend.webgl").on("mouseup.webgl touchend.webgl",i.onMouseUp.bind(i)).off("mousemove.webgl touchmove.webgl").on("mousemove.webgl touchmove.webgl",i.onMouseMove.bind(i)),i.onFullscreen(null)}i.options.background&&i.loadBackground()}}loadBackground(){var t=this,e=t.context;const i=function(){t.vb=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,t.vb),e.bufferData(e.ARRAY_BUFFER,new Float32Array(16),e.DYNAMIC_DRAW);var i,r=t.compileShader(e.VERTEX_SHADER," attribute vec2 aPosition; attribute vec2 aTexCoord; varying vec2 vTexCoord; void main(void) { vTexCoord = aTexCoord; gl_Position = vec4(aPosition, 0, 1); } ");i=t.options.backgroundRotatation?t.compileShader(e.FRAGMENT_SHADER,"\tprecision mediump float; varying vec2 vTexCoord; uniform sampler2D uTexture; uniform vec2 uResolution; uniform vec4 uBGTransform; uniform float uRotation; mat3 getTransform(vec2 pos, vec2 scale, float rotation, vec2 center) { float c = cos(rotation); float s = sin(rotation); return mat3( scale.x * c, scale.x * s, - scale.x * ( c * center.x + s * center.y ) + center.x + pos.x, -scale.y * s, scale.y * c, - scale.y * ( - s * center.x + c * center.y ) + center.y + pos.y, 0.0, 0.0, 1.0 ); } void main(void) { vec2 uv = gl_FragCoord.xy / uResolution.xy; mat3 transform = getTransform(uBGTransform.xy, uBGTransform.zw, uRotation, vec2(0.5)); uv = (vec3(uv, 1.0) * transform).xy; gl_FragColor = texture2D(uTexture, uv);\t}"):t.compileShader(e.FRAGMENT_SHADER," precision mediump float; varying vec2 vTexCoord; uniform sampler2D uTexture; uniform vec4 uBGTransform; void main(void) { gl_FragColor = texture2D(uTexture, vTexCoord.xy * uBGTransform.zw + uBGTransform.xy); } ");var n=e.createProgram();e.attachShader(n,r),e.attachShader(n,i),e.linkProgram(n),e.getProgramParameter(n,e.LINK_STATUS)?(t.vs=r,t.fs=i,t.program=n,t.uTexture=e.getUniformLocation(n,"uTexture"),t.aPosition=e.getAttribLocation(n,"aPosition"),t.aTexCoord=e.getAttribLocation(n,"aTexCoord"),t.uBGTransform=e.getUniformLocation(n,"uBGTransform"),t.uRotation=e.getUniformLocation(n,"uRotation"),t.uResolution=e.getUniformLocation(n,"uResolution")):console.error("Error linking shaders")},r=function(){var i=t.width/t.bgImg.width,r=t.height/t.bgImg.height;const n=[-1,-1,0,r,1,-1,i,r,-1,1,0,0,1,1,i,0];e.bindBuffer(e.ARRAY_BUFFER,t.vb),e.bufferSubData(e.ARRAY_BUFFER,0,new Float32Array(n))};t.bgImg?t.bgImg.loaded&&(t.vb||i(),r()):(t.bgImg=new Image,t.bgImg.crossOrigin="",t.bgImg.onload=function(){var n;null===(n=t.bgImg)||void 0===n||(n.loaded=!0),t.bgImg&&(t.bgTexture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,t.bgTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.bgImg),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),t.vb||i(),r(),t.bgImgLoaded=!0)},t.bgImg.onerror=function(){t.bgImg=null},t.bgImg.src=t.options.contentPath+t.options.background,t.viewer.options.bgPosition=t.options.bgPosition||[0,0],t.viewer.options.bgScale=t.options.bgScale||[1,1])}compileShader(t,e){var i=this.context,r=i.createShader(t);if(i.shaderSource(r,e),i.compileShader(r),!i.getShaderParameter(r,i.COMPILE_STATUS))throw"Shader compile error: "+i.getShaderInfoLog(r);return r}getTexture(t){if(this.textureCache.has(t)){var e=this.textureCache.get(t);if(e.g||e.l)return e}const i=new Tr(this,t);return this.textureCache.set(t,i),i}};let Ba={Types:wr};const ka=Object.assign(Ci,{Tools:ke,WebGL:Da,WEBGL:1,WOW:2,FLASH:2,Wow:Ba});window.ZamModelViewer=ka})();
|
|
//# sourceMappingURL=viewer.min.js.map
|