TOPVERSE_Official/.output/public/_nuxt/loadFBX.c8104fa2.js

7 lines
70 KiB
JavaScript

import{y as Vn,a1 as Gn,a2 as jn,a3 as Te,a4 as Xn,a5 as bn,a6 as Ue,a7 as Ve,a8 as Ge,a9 as se,aa as Hn,ab as ct,ac as Ht,ad as Zn,a as U,G as je,ae as fe,af as Jt,O as le,ag as Kn,ah as Wn,ai as Xe,aj as it,ak as Yn,al as $n,am as qn,M as Qn,b as Jn,K as Nn,V as ft,an as _n,ao as tr,g as Zt,I as yt,ap as er,aq as nr,ar as ae,as as rr,X as Ft,at as ir,Q as Kt,au as ar,av as or,aw as sr,ax as be,ay as lr,az as cr,aA as ur}from"./model.vue.8f6f7b03.js";import"./entry.a42f0781.js";/*!
fflate - fast JavaScript compression/decompression
<https://101arrowz.github.io/fflate>
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
version 0.6.9
*/var He={},pe=function(r){return URL.createObjectURL(new Blob([r],{type:"text/javascript"}))},Ne=function(r){return new Worker(r)};try{URL.revokeObjectURL(pe(""))}catch{pe=function(t){return"data:application/javascript;charset=UTF-8,"+encodeURI(t)},Ne=function(t){return new Worker(t,{type:"module"})}}var hr=function(r,t,e,n,i){var a=Ne(He[t]||(He[t]=pe(r)));return a.onerror=function(o){return i(o.error,null)},a.onmessage=function(o){return i(null,o.data)},a.postMessage(e,n),a},C=Uint8Array,j=Uint16Array,st=Uint32Array,xt=new C([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Pt=new C([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),zt=new C([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_e=function(r,t){for(var e=new j(31),n=0;n<31;++n)e[n]=t+=1<<r[n-1];for(var i=new st(e[30]),n=1;n<30;++n)for(var a=e[n];a<e[n+1];++a)i[a]=a-e[n]<<5|n;return[e,i]},tn=_e(xt,2),Ie=tn[0],Nt=tn[1];Ie[28]=258,Nt[258]=28;var en=_e(Pt,0),nn=en[0],ve=en[1],Ot=new j(32768);for(var R=0;R<32768;++R){var ut=(R&43690)>>>1|(R&21845)<<1;ut=(ut&52428)>>>2|(ut&13107)<<2,ut=(ut&61680)>>>4|(ut&3855)<<4,Ot[R]=((ut&65280)>>>8|(ut&255)<<8)>>>1}var N=function(r,t,e){for(var n=r.length,i=0,a=new j(t);i<n;++i)++a[r[i]-1];var o=new j(t);for(i=0;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(e){s=new j(1<<t);var l=15-t;for(i=0;i<n;++i)if(r[i])for(var c=i<<4|r[i],h=t-r[i],u=o[r[i]-1]++<<h,f=u|(1<<h)-1;u<=f;++u)s[Ot[u]>>>l]=c}else for(s=new j(n),i=0;i<n;++i)r[i]&&(s[i]=Ot[o[r[i]-1]++]>>>15-r[i]);return s},lt=new C(288);for(var R=0;R<144;++R)lt[R]=8;for(var R=144;R<256;++R)lt[R]=9;for(var R=256;R<280;++R)lt[R]=7;for(var R=280;R<288;++R)lt[R]=8;var It=new C(32);for(var R=0;R<32;++R)It[R]=5;var rn=N(lt,9,0),an=N(lt,9,1),on=N(It,5,0),sn=N(It,5,1),$t=function(r){for(var t=r[0],e=1;e<r.length;++e)r[e]>t&&(t=r[e]);return t},J=function(r,t,e){var n=t/8|0;return(r[n]|r[n+1]<<8)>>(t&7)&e},qt=function(r,t){var e=t/8|0;return(r[e]|r[e+1]<<8|r[e+2]<<16)>>(t&7)},Vt=function(r){return(r/8|0)+(r&7&&1)},_=function(r,t,e){(t==null||t<0)&&(t=0),(e==null||e>r.length)&&(e=r.length);var n=new(r instanceof j?j:r instanceof st?st:C)(e-t);return n.set(r.subarray(t,e)),n},Gt=function(r,t,e){var n=r.length;if(!n||e&&!e.l&&n<5)return t||new C(0);var i=!t||e,a=!e||e.i;e||(e={}),t||(t=new C(n*3));var o=function(bt){var kt=t.length;if(bt>kt){var mt=new C(Math.max(kt*2,bt));mt.set(t),t=mt}},s=e.f||0,l=e.p||0,c=e.b||0,h=e.l,u=e.d,f=e.m,p=e.n,v=n*8;do{if(!h){e.f=s=J(r,l,1);var g=J(r,l+1,3);if(l+=3,g)if(g==1)h=an,u=sn,f=9,p=5;else if(g==2){var m=J(r,l,31)+257,I=J(r,l+10,15)+4,D=m+J(r,l+5,31)+1;l+=14;for(var x=new C(D),A=new C(19),w=0;w<I;++w)A[zt[w]]=J(r,l+w*3,7);l+=I*3;for(var z=$t(A),P=(1<<z)-1,X=N(A,z,1),w=0;w<D;){var k=X[J(r,l,P)];l+=k&15;var y=k>>>4;if(y<16)x[w++]=y;else{var E=0,L=0;for(y==16?(L=3+J(r,l,3),l+=2,E=x[w-1]):y==17?(L=3+J(r,l,7),l+=3):y==18&&(L=11+J(r,l,127),l+=7);L--;)x[w++]=E}}var B=x.subarray(0,m),F=x.subarray(m);f=$t(B),p=$t(F),h=N(B,f,1),u=N(F,p,1)}else throw"invalid block type";else{var y=Vt(l)+4,T=r[y-4]|r[y-3]<<8,d=y+T;if(d>n){if(a)throw"unexpected EOF";break}i&&o(c+T),t.set(r.subarray(y,d),c),e.b=c+=T,e.p=l=d*8;continue}if(l>v){if(a)throw"unexpected EOF";break}}i&&o(c+131072);for(var O=(1<<f)-1,H=(1<<p)-1,W=l;;W=l){var E=h[qt(r,l)&O],Q=E>>>4;if(l+=E&15,l>v){if(a)throw"unexpected EOF";break}if(!E)throw"invalid length/literal";if(Q<256)t[c++]=Q;else if(Q==256){W=l,h=null;break}else{var Z=Q-254;if(Q>264){var w=Q-257,et=xt[w];Z=J(r,l,(1<<et)-1)+Ie[w],l+=et}var nt=u[qt(r,l)&H],Y=nt>>>4;if(!nt)throw"invalid distance";l+=nt&15;var F=nn[Y];if(Y>3){var et=Pt[Y];F+=qt(r,l)&(1<<et)-1,l+=et}if(l>v){if(a)throw"unexpected EOF";break}i&&o(c+131072);for(var b=c+Z;c<b;c+=4)t[c]=t[c-F],t[c+1]=t[c+1-F],t[c+2]=t[c+2-F],t[c+3]=t[c+3-F];c=b}}e.l=h,e.p=W,e.b=c,h&&(s=1,e.m=f,e.d=u,e.n=p)}while(!s);return c==t.length?t:_(t,0,c)},rt=function(r,t,e){e<<=t&7;var n=t/8|0;r[n]|=e,r[n+1]|=e>>>8},dt=function(r,t,e){e<<=t&7;var n=t/8|0;r[n]|=e,r[n+1]|=e>>>8,r[n+2]|=e>>>16},Qt=function(r,t){for(var e=[],n=0;n<r.length;++n)r[n]&&e.push({s:n,f:r[n]});var i=e.length,a=e.slice();if(!i)return[ot,0];if(i==1){var o=new C(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort(function(D,x){return D.f-x.f}),e.push({s:-1,f:25001});var s=e[0],l=e[1],c=0,h=1,u=2;for(e[0]={s:-1,f:s.f+l.f,l:s,r:l};h!=i-1;)s=e[e[c].f<e[u].f?c++:u++],l=e[c!=h&&e[c].f<e[u].f?c++:u++],e[h++]={s:-1,f:s.f+l.f,l:s,r:l};for(var f=a[0].s,n=1;n<i;++n)a[n].s>f&&(f=a[n].s);var p=new j(f+1),v=_t(e[h-1],p,0);if(v>t){var n=0,g=0,y=v-t,T=1<<y;for(a.sort(function(x,A){return p[A.s]-p[x.s]||x.f-A.f});n<i;++n){var d=a[n].s;if(p[d]>t)g+=T-(1<<v-p[d]),p[d]=t;else break}for(g>>>=y;g>0;){var m=a[n].s;p[m]<t?g-=1<<t-p[m]++-1:++n}for(;n>=0&&g;--n){var I=a[n].s;p[I]==t&&(--p[I],++g)}v=t}return[new C(p),v]},_t=function(r,t,e){return r.s==-1?Math.max(_t(r.l,t,e+1),_t(r.r,t,e+1)):t[r.s]=e},ge=function(r){for(var t=r.length;t&&!r[--t];);for(var e=new j(++t),n=0,i=r[0],a=1,o=function(l){e[n++]=l},s=1;s<=t;++s)if(r[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=r[s]}return[e.subarray(0,n),t]},Tt=function(r,t){for(var e=0,n=0;n<t.length;++n)e+=r[n]*t[n];return e},Rt=function(r,t,e){var n=e.length,i=Vt(t+2);r[i]=n&255,r[i+1]=n>>>8,r[i+2]=r[i]^255,r[i+3]=r[i+1]^255;for(var a=0;a<n;++a)r[i+a+4]=e[a];return(i+4+n)*8},me=function(r,t,e,n,i,a,o,s,l,c,h){rt(t,h++,e),++i[256];for(var u=Qt(i,15),f=u[0],p=u[1],v=Qt(a,15),g=v[0],y=v[1],T=ge(f),d=T[0],m=T[1],I=ge(g),D=I[0],x=I[1],A=new j(19),w=0;w<d.length;++w)A[d[w]&31]++;for(var w=0;w<D.length;++w)A[D[w]&31]++;for(var z=Qt(A,7),P=z[0],X=z[1],k=19;k>4&&!P[zt[k-1]];--k);var E=c+5<<3,L=Tt(i,lt)+Tt(a,It)+o,B=Tt(i,f)+Tt(a,g)+o+14+3*k+Tt(A,P)+(2*A[16]+3*A[17]+7*A[18]);if(E<=L&&E<=B)return Rt(t,h,r.subarray(l,l+c));var F,O,H,W;if(rt(t,h,1+(B<L)),h+=2,B<L){F=N(f,p,0),O=f,H=N(g,y,0),W=g;var Q=N(P,X,0);rt(t,h,m-257),rt(t,h+5,x-1),rt(t,h+10,k-4),h+=14;for(var w=0;w<k;++w)rt(t,h+3*w,P[zt[w]]);h+=3*k;for(var Z=[d,D],et=0;et<2;++et)for(var nt=Z[et],w=0;w<nt.length;++w){var Y=nt[w]&31;rt(t,h,Q[Y]),h+=P[Y],Y>15&&(rt(t,h,nt[w]>>>5&127),h+=nt[w]>>>12)}}else F=rn,O=lt,H=on,W=It;for(var w=0;w<s;++w)if(n[w]>255){var Y=n[w]>>>18&31;dt(t,h,F[Y+257]),h+=O[Y+257],Y>7&&(rt(t,h,n[w]>>>23&31),h+=xt[Y]);var b=n[w]&31;dt(t,h,H[b]),h+=W[b],b>3&&(dt(t,h,n[w]>>>5&8191),h+=Pt[b])}else dt(t,h,F[n[w]]),h+=O[n[w]];return dt(t,h,F[256]),h+O[256]},ln=new st([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ot=new C(0),cn=function(r,t,e,n,i,a){var o=r.length,s=new C(n+o+5*(1+Math.ceil(o/7e3))+i),l=s.subarray(n,s.length-i),c=0;if(!t||o<8)for(var h=0;h<=o;h+=65535){var u=h+65535;u<o?c=Rt(l,c,r.subarray(h,u)):(l[h]=a,c=Rt(l,c,r.subarray(h,o)))}else{for(var f=ln[t-1],p=f>>>13,v=f&8191,g=(1<<e)-1,y=new j(32768),T=new j(g+1),d=Math.ceil(e/3),m=2*d,I=function(oe){return(r[oe]^r[oe+1]<<d^r[oe+2]<<m)&g},D=new st(25e3),x=new j(288),A=new j(32),w=0,z=0,h=0,P=0,X=0,k=0;h<o;++h){var E=I(h),L=h&32767,B=T[E];if(y[L]=B,T[E]=L,X<=h){var F=o-h;if((w>7e3||P>24576)&&F>423){c=me(r,l,0,D,x,A,z,P,k,h-k,c),P=w=z=0,k=h;for(var O=0;O<286;++O)x[O]=0;for(var O=0;O<30;++O)A[O]=0}var H=2,W=0,Q=v,Z=L-B&32767;if(F>2&&E==I(h-Z))for(var et=Math.min(p,F)-1,nt=Math.min(32767,h),Y=Math.min(258,F);Z<=nt&&--Q&&L!=B;){if(r[h+H]==r[h+H-Z]){for(var b=0;b<Y&&r[h+b]==r[h+b-Z];++b);if(b>H){if(H=b,W=Z,b>et)break;for(var bt=Math.min(Z,b-2),kt=0,O=0;O<bt;++O){var mt=h-Z+O+32768&32767,Un=y[mt],ze=mt-Un+32768&32767;ze>kt&&(kt=ze,B=mt)}}}L=B,B=y[L],Z+=L-B+32768&32767}if(W){D[P++]=268435456|Nt[H]<<18|ve[W];var Oe=Nt[H]&31,Be=ve[W]&31;z+=xt[Oe]+Pt[Be],++x[257+Oe],++A[Be],X=h+H,++w}else D[P++]=r[h],++x[r[h]]}}c=me(r,l,a,D,x,A,z,P,k,h-k,c),!a&&c&7&&(c=Rt(l,c+1,ot))}return _(s,0,n+Vt(c)+i)},un=function(){for(var r=new st(256),t=0;t<256;++t){for(var e=t,n=9;--n;)e=(e&1&&3988292384)^e>>>1;r[t]=e}return r}(),Dt=function(){var r=-1;return{p:function(t){for(var e=r,n=0;n<t.length;++n)e=un[e&255^t[n]]^e>>>8;r=e},d:function(){return~r}}},Ae=function(){var r=1,t=0;return{p:function(e){for(var n=r,i=t,a=e.length,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)i+=n+=e[o];n=(n&65535)+15*(n>>16),i=(i&65535)+15*(i>>16)}r=n,t=i},d:function(){return r%=65521,t%=65521,(r&255)<<24|r>>>8<<16|(t&255)<<8|t>>>8}}},gt=function(r,t,e,n,i){return cn(r,t.level==null?6:t.level,t.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(r.length)))*1.5):12+t.mem,e,n,!i)},jt=function(r,t){var e={};for(var n in r)e[n]=r[n];for(var n in t)e[n]=t[n];return e},Ze=function(r,t,e){for(var n=r(),i=r.toString(),a=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/ /g,"").split(","),o=0;o<n.length;++o){var s=n[o],l=a[o];if(typeof s=="function"){t+=";"+l+"=";var c=s.toString();if(s.prototype)if(c.indexOf("[native code]")!=-1){var h=c.indexOf(" ",8)+1;t+=c.slice(h,c.indexOf("(",h))}else{t+=c;for(var u in s.prototype)t+=";"+l+".prototype."+u+"="+s.prototype[u].toString()}else t+=c}else e[l]=s}return[t,e]},Wt=[],fr=function(r){var t=[];for(var e in r)(r[e]instanceof C||r[e]instanceof j||r[e]instanceof st)&&t.push((r[e]=new r[e].constructor(r[e])).buffer);return t},hn=function(r,t,e,n){var i;if(!Wt[e]){for(var a="",o={},s=r.length-1,l=0;l<s;++l)i=Ze(r[l],a,o),a=i[0],o=i[1];Wt[e]=Ze(r[s],a,o)}var c=jt({},Wt[e][1]);return hr(Wt[e][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",e,c,fr(c),n)},Mt=function(){return[C,j,st,xt,Pt,zt,Ie,nn,an,sn,Ot,N,$t,J,qt,Vt,_,Gt,Lt,vt,xe]},Ct=function(){return[C,j,st,xt,Pt,zt,Nt,ve,rn,lt,on,It,Ot,ln,ot,N,rt,dt,Qt,_t,ge,Tt,Rt,me,Vt,_,cn,gt,Xt,vt]},fn=function(){return[Pe,Me,S,Dt,un]},pn=function(){return[De,mn]},vn=function(){return[Ce,S,Ae]},gn=function(){return[yn]},vt=function(r){return postMessage(r,[r.buffer])},xe=function(r){return r&&r.size&&new C(r.size)},St=function(r,t,e,n,i,a){var o=hn(e,n,i,function(s,l){o.terminate(),a(s,l)});return o.postMessage([r,t],t.consume?[r.buffer]:[]),function(){o.terminate()}},tt=function(r){return r.ondata=function(t,e){return postMessage([t,e],[t.buffer])},function(t){return r.push(t.data[0],t.data[1])}},Et=function(r,t,e,n,i){var a,o=hn(r,n,i,function(s,l){s?(o.terminate(),t.ondata.call(t,s)):(l[1]&&o.terminate(),t.ondata.call(t,s,l[0],l[1]))});o.postMessage(e),t.push=function(s,l){if(a)throw"stream finished";if(!t.ondata)throw"no stream handler";o.postMessage([s,a=l],[s.buffer])},t.terminate=function(){o.terminate()}},K=function(r,t){return r[t]|r[t+1]<<8},G=function(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24)>>>0},ce=function(r,t){return G(r,t)+G(r,t+4)*4294967296},S=function(r,t,e){for(;e;++t)r[t]=e,e>>>=8},Pe=function(r,t){var e=t.filename;if(r[0]=31,r[1]=139,r[2]=8,r[8]=t.level<2?4:t.level==9?2:0,r[9]=3,t.mtime!=0&&S(r,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),e){r[3]=8;for(var n=0;n<=e.length;++n)r[n+10]=e.charCodeAt(n)}},De=function(r){if(r[0]!=31||r[1]!=139||r[2]!=8)throw"invalid gzip data";var t=r[3],e=10;t&4&&(e+=r[10]|(r[11]<<8)+2);for(var n=(t>>3&1)+(t>>4&1);n>0;n-=!r[e++]);return e+(t&2)},mn=function(r){var t=r.length;return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0},Me=function(r){return 10+(r.filename&&r.filename.length+1||0)},Ce=function(r,t){var e=t.level,n=e==0?0:e<6?1:e==9?3:2;r[0]=120,r[1]=n<<6|(n?32-2*n:1)},yn=function(r){if((r[0]&15)!=8||r[0]>>>4>7||(r[0]<<8|r[1])%31)throw"invalid zlib data";if(r[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function Se(r,t){return!t&&typeof r=="function"&&(t=r,r={}),this.ondata=t,r}var at=function(){function r(t,e){!e&&typeof t=="function"&&(e=t,t={}),this.ondata=e,this.o=t||{}}return r.prototype.p=function(t,e){this.ondata(gt(t,this.o,0,0,!e),e)},r.prototype.push=function(t,e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=e,this.p(t,e||!1)},r}(),wn=function(){function r(t,e){Et([Ct,function(){return[tt,at]}],this,Se.call(this,t,e),function(n){var i=new at(n.data);onmessage=tt(i)},6)}return r}();function dn(r,t,e){if(e||(e=t,t={}),typeof e!="function")throw"no callback";return St(r,t,[Ct],function(n){return vt(Xt(n.data[0],n.data[1]))},0,e)}function Xt(r,t){return gt(r,t||{},0,0)}var q=function(){function r(t){this.s={},this.p=new C(0),this.ondata=t}return r.prototype.e=function(t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var e=this.p.length,n=new C(e+t.length);n.set(this.p),n.set(t,e),this.p=n},r.prototype.c=function(t){this.d=this.s.i=t||!1;var e=this.s.b,n=Gt(this.p,this.o,this.s);this.ondata(_(n,e,this.s.b),this.d),this.o=_(n,this.s.b-32768),this.s.b=this.o.length,this.p=_(this.p,this.s.p/8|0),this.s.p&=7},r.prototype.push=function(t,e){this.e(t),this.c(e)},r}(),Ee=function(){function r(t){this.ondata=t,Et([Mt,function(){return[tt,q]}],this,0,function(){var e=new q;onmessage=tt(e)},7)}return r}();function Le(r,t,e){if(e||(e=t,t={}),typeof e!="function")throw"no callback";return St(r,t,[Mt],function(n){return vt(Lt(n.data[0],xe(n.data[1])))},1,e)}function Lt(r,t){return Gt(r,t)}var te=function(){function r(t,e){this.c=Dt(),this.l=0,this.v=1,at.call(this,t,e)}return r.prototype.push=function(t,e){at.prototype.push.call(this,t,e)},r.prototype.p=function(t,e){this.c.p(t),this.l+=t.length;var n=gt(t,this.o,this.v&&Me(this.o),e&&8,!e);this.v&&(Pe(n,this.o),this.v=0),e&&(S(n,n.length-8,this.c.d()),S(n,n.length-4,this.l)),this.ondata(n,e)},r}(),Ke=function(){function r(t,e){Et([Ct,fn,function(){return[tt,at,te]}],this,Se.call(this,t,e),function(n){var i=new te(n.data);onmessage=tt(i)},8)}return r}();function We(r,t,e){if(e||(e=t,t={}),typeof e!="function")throw"no callback";return St(r,t,[Ct,fn,function(){return[ee]}],function(n){return vt(ee(n.data[0],n.data[1]))},2,e)}function ee(r,t){t||(t={});var e=Dt(),n=r.length;e.p(r);var i=gt(r,t,Me(t),8),a=i.length;return Pe(i,t),S(i,a-8,e.d()),S(i,a-4,n),i}var ne=function(){function r(t){this.v=1,q.call(this,t)}return r.prototype.push=function(t,e){if(q.prototype.e.call(this,t),this.v){var n=this.p.length>3?De(this.p):4;if(n>=this.p.length&&!e)return;this.p=this.p.subarray(n),this.v=0}if(e){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}q.prototype.c.call(this,e)},r}(),Tn=function(){function r(t){this.ondata=t,Et([Mt,pn,function(){return[tt,q,ne]}],this,0,function(){var e=new ne;onmessage=tt(e)},9)}return r}();function In(r,t,e){if(e||(e=t,t={}),typeof e!="function")throw"no callback";return St(r,t,[Mt,pn,function(){return[re]}],function(n){return vt(re(n.data[0]))},3,e)}function re(r,t){return Gt(r.subarray(De(r),-8),t||new C(mn(r)))}var ye=function(){function r(t,e){this.c=Ae(),this.v=1,at.call(this,t,e)}return r.prototype.push=function(t,e){at.prototype.push.call(this,t,e)},r.prototype.p=function(t,e){this.c.p(t);var n=gt(t,this.o,this.v&&2,e&&4,!e);this.v&&(Ce(n,this.o),this.v=0),e&&S(n,n.length-4,this.c.d()),this.ondata(n,e)},r}(),pr=function(){function r(t,e){Et([Ct,vn,function(){return[tt,at,ye]}],this,Se.call(this,t,e),function(n){var i=new ye(n.data);onmessage=tt(i)},10)}return r}();function vr(r,t,e){if(e||(e=t,t={}),typeof e!="function")throw"no callback";return St(r,t,[Ct,vn,function(){return[we]}],function(n){return vt(we(n.data[0],n.data[1]))},4,e)}function we(r,t){t||(t={});var e=Ae();e.p(r);var n=gt(r,t,2,4);return Ce(n,t),S(n,n.length-4,e.d()),n}var ie=function(){function r(t){this.v=1,q.call(this,t)}return r.prototype.push=function(t,e){if(q.prototype.e.call(this,t),this.v){if(this.p.length<2&&!e)return;this.p=this.p.subarray(2),this.v=0}if(e){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}q.prototype.c.call(this,e)},r}(),An=function(){function r(t){this.ondata=t,Et([Mt,gn,function(){return[tt,q,ie]}],this,0,function(){var e=new ie;onmessage=tt(e)},11)}return r}();function xn(r,t,e){if(e||(e=t,t={}),typeof e!="function")throw"no callback";return St(r,t,[Mt,gn,function(){return[Bt]}],function(n){return vt(Bt(n.data[0],xe(n.data[1])))},5,e)}function Bt(r,t){return Gt((yn(r),r.subarray(2,-4)),t)}var Pn=function(){function r(t){this.G=ne,this.I=q,this.Z=ie,this.ondata=t}return r.prototype.push=function(t,e){if(!this.ondata)throw"no stream handler";if(this.s)this.s.push(t,e);else{if(this.p&&this.p.length){var n=new C(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length)}else this.p=t;if(this.p.length>2){var i=this,a=function(){i.ondata.apply(i,arguments)};this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(a):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(a):new this.Z(a),this.s.push(this.p,e),this.p=null}}},r}(),gr=function(){function r(t){this.G=Tn,this.I=Ee,this.Z=An,this.ondata=t}return r.prototype.push=function(t,e){Pn.prototype.push.call(this,t,e)},r}();function mr(r,t,e){if(e||(e=t,t={}),typeof e!="function")throw"no callback";return r[0]==31&&r[1]==139&&r[2]==8?In(r,t,e):(r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31?Le(r,t,e):xn(r,t,e)}function yr(r,t){return r[0]==31&&r[1]==139&&r[2]==8?re(r,t):(r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31?Lt(r,t):Bt(r,t)}var ke=function(r,t,e,n){for(var i in r){var a=r[i],o=t+i;a instanceof C?e[o]=[a,n]:Array.isArray(a)?e[o]=[a[0],jt(n,a[1])]:ke(a,o+"/",e,n)}},Ye=typeof TextEncoder<"u"&&new TextEncoder,de=typeof TextDecoder<"u"&&new TextDecoder,Dn=0;try{de.decode(ot,{stream:!0}),Dn=1}catch{}var Mn=function(r){for(var t="",e=0;;){var n=r[e++],i=(n>127)+(n>223)+(n>239);if(e+i>r.length)return[t,_(r,e-1)];i?i==3?(n=((n&15)<<18|(r[e++]&63)<<12|(r[e++]&63)<<6|r[e++]&63)-65536,t+=String.fromCharCode(55296|n>>10,56320|n&1023)):i&1?t+=String.fromCharCode((n&31)<<6|r[e++]&63):t+=String.fromCharCode((n&15)<<12|(r[e++]&63)<<6|r[e++]&63):t+=String.fromCharCode(n)}},wr=function(){function r(t){this.ondata=t,Dn?this.t=new TextDecoder:this.p=ot}return r.prototype.push=function(t,e){if(!this.ondata)throw"no callback";if(e=!!e,this.t){if(this.ondata(this.t.decode(t,{stream:!0}),e),e){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}return}if(!this.p)throw"stream finished";var n=new C(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length);var i=Mn(n),a=i[0],o=i[1];if(e){if(o.length)throw"invalid utf-8 data";this.p=null}else this.p=o;this.ondata(a,e)},r}(),dr=function(){function r(t){this.ondata=t}return r.prototype.push=function(t,e){if(!this.ondata)throw"no callback";if(this.d)throw"stream finished";this.ondata(pt(t),this.d=e||!1)},r}();function pt(r,t){if(t){for(var e=new C(r.length),n=0;n<r.length;++n)e[n]=r.charCodeAt(n);return e}if(Ye)return Ye.encode(r);for(var i=r.length,a=new C(r.length+(r.length>>1)),o=0,s=function(h){a[o++]=h},n=0;n<i;++n){if(o+5>a.length){var l=new C(o+8+(i-n<<1));l.set(a),a=l}var c=r.charCodeAt(n);c<128||t?s(c):c<2048?(s(192|c>>6),s(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|r.charCodeAt(++n)&1023,s(240|c>>18),s(128|c>>12&63),s(128|c>>6&63),s(128|c&63)):(s(224|c>>12),s(128|c>>6&63),s(128|c&63))}return _(a,0,o)}function Fe(r,t){if(t){for(var e="",n=0;n<r.length;n+=16384)e+=String.fromCharCode.apply(null,r.subarray(n,n+16384));return e}else{if(de)return de.decode(r);var i=Mn(r),a=i[0],o=i[1];if(o.length)throw"invalid utf-8 data";return a}}var Cn=function(r){return r==1?3:r<6?2:r==9?1:0},Sn=function(r,t){return t+30+K(r,t+26)+K(r,t+28)},En=function(r,t,e){var n=K(r,t+28),i=Fe(r.subarray(t+46,t+46+n),!(K(r,t+8)&2048)),a=t+46+n,o=G(r,t+20),s=e&&o==4294967295?Ln(r,a):[o,G(r,t+24),G(r,t+42)],l=s[0],c=s[1],h=s[2];return[K(r,t+10),l,c,i,a+K(r,t+30)+K(r,t+32),h]},Ln=function(r,t){for(;K(r,t)!=1;t+=4+K(r,t+2));return[ce(r,t+12),ce(r,t+4),ce(r,t+20)]},ht=function(r){var t=0;if(r)for(var e in r){var n=r[e].length;if(n>65535)throw"extra field too long";t+=n+4}return t},At=function(r,t,e,n,i,a,o,s){var l=n.length,c=e.extra,h=s&&s.length,u=ht(c);S(r,t,o!=null?33639248:67324752),t+=4,o!=null&&(r[t++]=20,r[t++]=e.os),r[t]=20,t+=2,r[t++]=e.flag<<1|(a==null&&8),r[t++]=i&&8,r[t++]=e.compression&255,r[t++]=e.compression>>8;var f=new Date(e.mtime==null?Date.now():e.mtime),p=f.getFullYear()-1980;if(p<0||p>119)throw"date not in range 1980-2099";if(S(r,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>>1),t+=4,a!=null&&(S(r,t,e.crc),S(r,t+4,a),S(r,t+8,e.size)),S(r,t+12,l),S(r,t+14,u),t+=16,o!=null&&(S(r,t,h),S(r,t+6,e.attrs),S(r,t+10,o),t+=14),r.set(n,t),t+=l,u)for(var v in c){var g=c[v],y=g.length;S(r,t,+v),S(r,t+2,y),r.set(g,t+4),t+=4+y}return h&&(r.set(s,t),t+=h),t},Re=function(r,t,e,n,i){S(r,t,101010256),S(r,t+8,e),S(r,t+10,e),S(r,t+12,n),S(r,t+16,i)},Ut=function(){function r(t){this.filename=t,this.c=Dt(),this.size=0,this.compression=0}return r.prototype.process=function(t,e){this.ondata(null,t,e)},r.prototype.push=function(t,e){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(t),this.size+=t.length,e&&(this.crc=this.c.d()),this.process(t,e||!1)},r}(),Tr=function(){function r(t,e){var n=this;e||(e={}),Ut.call(this,t),this.d=new at(e,function(i,a){n.ondata(null,i,a)}),this.compression=8,this.flag=Cn(e.level)}return r.prototype.process=function(t,e){try{this.d.push(t,e)}catch(n){this.ondata(n,null,e)}},r.prototype.push=function(t,e){Ut.prototype.push.call(this,t,e)},r}(),Ir=function(){function r(t,e){var n=this;e||(e={}),Ut.call(this,t),this.d=new wn(e,function(i,a,o){n.ondata(i,a,o)}),this.compression=8,this.flag=Cn(e.level),this.terminate=this.d.terminate}return r.prototype.process=function(t,e){this.d.push(t,e)},r.prototype.push=function(t,e){Ut.prototype.push.call(this,t,e)},r}(),Ar=function(){function r(t){this.ondata=t,this.u=[],this.d=1}return r.prototype.add=function(t){var e=this;if(this.d&2)throw"stream finished";var n=pt(t.filename),i=n.length,a=t.comment,o=a&&pt(a),s=i!=t.filename.length||o&&a.length!=o.length,l=i+ht(t.extra)+30;if(i>65535)throw"filename too long";var c=new C(l);At(c,0,t,n,s);var h=[c],u=function(){for(var y=0,T=h;y<T.length;y++){var d=T[y];e.ondata(null,d,!1)}h=[]},f=this.d;this.d=0;var p=this.u.length,v=jt(t,{f:n,u:s,o,t:function(){t.terminate&&t.terminate()},r:function(){if(u(),f){var y=e.u[p+1];y?y.r():e.d=1}f=1}}),g=0;t.ondata=function(y,T,d){if(y)e.ondata(y,T,d),e.terminate();else if(g+=T.length,h.push(T),d){var m=new C(16);S(m,0,134695760),S(m,4,t.crc),S(m,8,g),S(m,12,t.size),h.push(m),v.c=g,v.b=l+g+16,v.crc=t.crc,v.size=t.size,f&&v.r(),f=1}else f&&u()},this.u.push(v)},r.prototype.end=function(){var t=this;if(this.d&2)throw this.d&1?"stream finishing":"stream finished";this.d?this.e():this.u.push({r:function(){t.d&1&&(t.u.splice(-1,1),t.e())},t:function(){}}),this.d=3},r.prototype.e=function(){for(var t=0,e=0,n=0,i=0,a=this.u;i<a.length;i++){var o=a[i];n+=46+o.f.length+ht(o.extra)+(o.o?o.o.length:0)}for(var s=new C(n+22),l=0,c=this.u;l<c.length;l++){var o=c[l];At(s,t,o,o.f,o.u,o.c,e,o.o),t+=46+o.f.length+ht(o.extra)+(o.o?o.o.length:0),e+=o.b}Re(s,t,this.u.length,n,e),this.ondata(null,s,!0),this.d=2},r.prototype.terminate=function(){for(var t=0,e=this.u;t<e.length;t++){var n=e[t];n.t()}this.d=2},r}();function xr(r,t,e){if(e||(e=t,t={}),typeof e!="function")throw"no callback";var n={};ke(r,"",n,t);var i=Object.keys(n),a=i.length,o=0,s=0,l=a,c=new Array(a),h=[],u=function(){for(var g=0;g<h.length;++g)h[g]()},f=function(){var g=new C(s+22),y=o,T=s-o;s=0;for(var d=0;d<l;++d){var m=c[d];try{var I=m.c.length;At(g,s,m,m.f,m.u,I);var D=30+m.f.length+ht(m.extra),x=s+D;g.set(m.c,x),At(g,o,m,m.f,m.u,I,s,m.m),o+=16+D+(m.m?m.m.length:0),s=x+I}catch(A){return e(A,null)}}Re(g,o,c.length,T,y),e(null,g)};a||f();for(var p=function(g){var y=i[g],T=n[y],d=T[0],m=T[1],I=Dt(),D=d.length;I.p(d);var x=pt(y),A=x.length,w=m.comment,z=w&&pt(w),P=z&&z.length,X=ht(m.extra),k=m.level==0?0:8,E=function(L,B){if(L)u(),e(L,null);else{var F=B.length;c[g]=jt(m,{size:D,crc:I.d(),c:B,f:x,m:z,u:A!=y.length||z&&w.length!=P,compression:k}),o+=30+A+X+F,s+=76+2*(A+X)+(P||0)+F,--a||f()}};if(A>65535&&E("filename too long",null),!k)E(null,d);else if(D<16e4)try{E(null,Xt(d,m))}catch(L){E(L,null)}else h.push(dn(d,m,E))},v=0;v<l;++v)p(v);return u}function Pr(r,t){t||(t={});var e={},n=[];ke(r,"",e,t);var i=0,a=0;for(var o in e){var s=e[o],l=s[0],c=s[1],h=c.level==0?0:8,u=pt(o),f=u.length,p=c.comment,v=p&&pt(p),g=v&&v.length,y=ht(c.extra);if(f>65535)throw"filename too long";var T=h?Xt(l,c):l,d=T.length,m=Dt();m.p(l),n.push(jt(c,{size:l.length,crc:m.d(),c:T,f:u,m:v,u:f!=o.length||v&&p.length!=g,o:i,compression:h})),i+=30+f+y+d,a+=76+2*(f+y)+(g||0)+d}for(var I=new C(a+22),D=i,x=a-i,A=0;A<n.length;++A){var u=n[A];At(I,u.o,u,u.f,u.u,u.c.length);var w=30+u.f.length+ht(u.extra);I.set(u.c,u.o+w),At(I,i,u,u.f,u.u,u.c.length,u.o,u.m),i+=16+w+(u.m?u.m.length:0)}return Re(I,i,n.length,x,D),I}var kn=function(){function r(){}return r.prototype.push=function(t,e){this.ondata(null,t,e)},r.compression=0,r}(),Dr=function(){function r(){var t=this;this.i=new q(function(e,n){t.ondata(null,e,n)})}return r.prototype.push=function(t,e){try{this.i.push(t,e)}catch(n){this.ondata(n,t,e)}},r.compression=8,r}(),Mr=function(){function r(t,e){var n=this;e<32e4?this.i=new q(function(i,a){n.ondata(null,i,a)}):(this.i=new Ee(function(i,a,o){n.ondata(i,a,o)}),this.terminate=this.i.terminate)}return r.prototype.push=function(t,e){this.i.terminate&&(t=_(t,0)),this.i.push(t,e)},r.compression=8,r}(),Cr=function(){function r(t){this.onfile=t,this.k=[],this.o={0:kn},this.p=ot}return r.prototype.push=function(t,e){var n=this;if(!this.onfile)throw"no callback";if(!this.p)throw"stream finished";if(this.c>0){var i=Math.min(this.c,t.length),a=t.subarray(0,i);if(this.c-=i,this.d?this.d.push(a,!this.c):this.k[0].push(a),t=t.subarray(i),t.length)return this.push(t,e)}else{var o=0,s=0,l=void 0,c=void 0;this.p.length?t.length?(c=new C(this.p.length+t.length),c.set(this.p),c.set(t,this.p.length)):c=this.p:c=t;for(var h=c.length,u=this.c,f=u&&this.d,p=function(){var T,d=G(c,s);if(d==67324752){o=1,l=s,v.d=null,v.c=0;var m=K(c,s+6),I=K(c,s+8),D=m&2048,x=m&8,A=K(c,s+26),w=K(c,s+28);if(h>s+30+A+w){var z=[];v.k.unshift(z),o=2;var P=G(c,s+18),X=G(c,s+22),k=Fe(c.subarray(s+30,s+=30+A),!D);P==4294967295?(T=x?[-2]:Ln(c,s),P=T[0],X=T[1]):x&&(P=-1),s+=w,v.c=P;var E,L={name:k,compression:I,start:function(){if(!L.ondata)throw"no callback";if(!P)L.ondata(null,ot,!0);else{var B=n.o[I];if(!B)throw"unknown compression type "+I;E=P<0?new B(k):new B(k,P,X),E.ondata=function(W,Q,Z){L.ondata(W,Q,Z)};for(var F=0,O=z;F<O.length;F++){var H=O[F];E.push(H,!1)}n.k[0]==z&&n.c?n.d=E:E.push(ot,!0)}},terminate:function(){E&&E.terminate&&E.terminate()}};P>=0&&(L.size=P,L.originalSize=X),v.onfile(L)}return"break"}else if(u){if(d==134695760)return l=s+=12+(u==-2&&8),o=3,v.c=0,"break";if(d==33639248)return l=s-=4,o=3,v.c=0,"break"}},v=this;s<h-4;++s){var g=p();if(g==="break")break}if(this.p=ot,u<0){var y=o?c.subarray(0,l-12-(u==-2&&8)-(G(c,l-16)==134695760&&4)):c.subarray(0,s);f?f.push(y,!!o):this.k[+(o==2)].push(y)}if(o&2)return this.push(c.subarray(s),e);this.p=c.subarray(s)}if(e){if(this.c)throw"invalid zip file";this.p=null}},r.prototype.register=function(t){this.o[t.compression]=t},r}();function Sr(r,t){if(typeof t!="function")throw"no callback";for(var e=[],n=function(){for(var f=0;f<e.length;++f)e[f]()},i={},a=r.length-22;G(r,a)!=101010256;--a)if(!a||r.length-a>65558){t("invalid zip file",null);return}var o=K(r,a+8);o||t(null,{});var s=o,l=G(r,a+16),c=l==4294967295;if(c){if(a=G(r,a-12),G(r,a)!=101075792){t("invalid zip file",null);return}s=o=G(r,a+32),l=G(r,a+48)}for(var h=function(f){var p=En(r,l,c),v=p[0],g=p[1],y=p[2],T=p[3],d=p[4],m=p[5],I=Sn(r,m);l=d;var D=function(A,w){A?(n(),t(A,null)):(i[T]=w,--o||t(null,i))};if(!v)D(null,_(r,I,I+g));else if(v==8){var x=r.subarray(I,I+g);if(g<32e4)try{D(null,Lt(x,new C(y)))}catch(A){D(A,null)}else e.push(Le(x,{size:y},D))}else D("unknown compression type "+v,null)},u=0;u<s;++u)h();return n}function Er(r){for(var t={},e=r.length-22;G(r,e)!=101010256;--e)if(!e||r.length-e>65558)throw"invalid zip file";var n=K(r,e+8);if(!n)return{};var i=G(r,e+16),a=i==4294967295;if(a){if(e=G(r,e-12),G(r,e)!=101075792)throw"invalid zip file";n=G(r,e+32),i=G(r,e+48)}for(var o=0;o<n;++o){var s=En(r,i,a),l=s[0],c=s[1],h=s[2],u=s[3],f=s[4],p=s[5],v=Sn(r,p);if(i=f,!l)t[u]=_(r,v,v+c);else if(l==8)t[u]=Lt(r.subarray(v,v+c),new C(h));else throw"unknown compression type "+l}return t}var Lr=Object.freeze(Object.defineProperty({__proto__:null,Deflate:at,AsyncDeflate:wn,deflate:dn,deflateSync:Xt,Inflate:q,AsyncInflate:Ee,inflate:Le,inflateSync:Lt,Gzip:te,AsyncGzip:Ke,gzip:We,gzipSync:ee,Gunzip:ne,AsyncGunzip:Tn,gunzip:In,gunzipSync:re,Zlib:ye,AsyncZlib:pr,zlib:vr,zlibSync:we,Unzlib:ie,AsyncUnzlib:An,unzlib:xn,unzlibSync:Bt,compress:We,AsyncCompress:Ke,compressSync:ee,Compress:te,Decompress:Pn,AsyncDecompress:gr,decompress:mr,decompressSync:yr,DecodeUTF8:wr,EncodeUTF8:dr,strToU8:pt,strFromU8:Fe,ZipPassThrough:Ut,ZipDeflate:Tr,AsyncZipDeflate:Ir,Zip:Ar,zip:xr,zipSync:Pr,UnzipPassThrough:kn,UnzipInflate:Dr,AsyncUnzipInflate:Mr,Unzip:Cr,unzip:Sr,unzipSync:Er},Symbol.toStringTag,{value:"Module"}));function Fn(r,t,e){const n=e.length-r-1;if(t>=e[n])return n-1;if(t<=e[r])return r;let i=r,a=n,o=Math.floor((i+a)/2);for(;t<e[o]||t>=e[o+1];)t<e[o]?a=o:i=o,o=Math.floor((i+a)/2);return o}function kr(r,t,e,n){const i=[],a=[],o=[];i[0]=1;for(let s=1;s<=e;++s){a[s]=t-n[r+1-s],o[s]=n[r+s]-t;let l=0;for(let c=0;c<s;++c){const h=o[c+1],u=a[s-c],f=i[c]/(h+u);i[c]=l+h*f,l=u*f}i[s]=l}return i}function Fr(r,t,e,n){const i=Fn(r,n,t),a=kr(i,n,r,t),o=new ae(0,0,0,0);for(let s=0;s<=r;++s){const l=e[i-r+s],c=a[s],h=l.w*c;o.x+=l.x*h,o.y+=l.y*h,o.z+=l.z*h,o.w+=l.w*c}return o}function Rr(r,t,e,n,i){const a=[];for(let u=0;u<=e;++u)a[u]=0;const o=[];for(let u=0;u<=n;++u)o[u]=a.slice(0);const s=[];for(let u=0;u<=e;++u)s[u]=a.slice(0);s[0][0]=1;const l=a.slice(0),c=a.slice(0);for(let u=1;u<=e;++u){l[u]=t-i[r+1-u],c[u]=i[r+u]-t;let f=0;for(let p=0;p<u;++p){const v=c[p+1],g=l[u-p];s[u][p]=v+g;const y=s[p][u-1]/s[u][p];s[p][u]=f+v*y,f=g*y}s[u][u]=f}for(let u=0;u<=e;++u)o[0][u]=s[u][e];for(let u=0;u<=e;++u){let f=0,p=1;const v=[];for(let g=0;g<=e;++g)v[g]=a.slice(0);v[0][0]=1;for(let g=1;g<=n;++g){let y=0;const T=u-g,d=e-g;u>=g&&(v[p][0]=v[f][0]/s[d+1][T],y=v[p][0]*s[T][d]);const m=T>=-1?1:-T,I=u-1<=d?g-1:e-u;for(let x=m;x<=I;++x)v[p][x]=(v[f][x]-v[f][x-1])/s[d+1][T+x],y+=v[p][x]*s[T+x][d];u<=d&&(v[p][g]=-v[f][g-1]/s[d+1][u],y+=v[p][g]*s[u][d]),o[g][u]=y;const D=f;f=p,p=D}}let h=e;for(let u=1;u<=n;++u){for(let f=0;f<=e;++f)o[u][f]*=h;h*=e-u}return o}function zr(r,t,e,n,i){const a=i<r?i:r,o=[],s=Fn(r,n,t),l=Rr(s,n,r,a,t),c=[];for(let h=0;h<e.length;++h){const u=e[h].clone(),f=u.w;u.x*=f,u.y*=f,u.z*=f,c[h]=u}for(let h=0;h<=a;++h){const u=c[s-r].clone().multiplyScalar(l[h][0]);for(let f=1;f<=r;++f)u.add(c[s-r+f].clone().multiplyScalar(l[h][f]));o[h]=u}for(let h=a+1;h<=i+1;++h)o[h]=new ae(0,0,0);return o}function Or(r,t){let e=1;for(let i=2;i<=r;++i)e*=i;let n=1;for(let i=2;i<=t;++i)n*=i;for(let i=2;i<=r-t;++i)n*=i;return e/n}function Br(r){const t=r.length,e=[],n=[];for(let a=0;a<t;++a){const o=r[a];e[a]=new ft(o.x,o.y,o.z),n[a]=o.w}const i=[];for(let a=0;a<t;++a){const o=e[a].clone();for(let s=1;s<=a;++s)o.sub(i[a-s].clone().multiplyScalar(Or(a,s)*n[s]));i[a]=o.divideScalar(n[0])}return i}function Ur(r,t,e,n,i){const a=zr(r,t,e,n,i);return Br(a)}class $e extends ur{constructor(t,e,n,i,a){super(),this.degree=t,this.knots=e,this.controlPoints=[],this.startKnot=i||0,this.endKnot=a||this.knots.length-1;for(let o=0;o<n.length;++o){const s=n[o];this.controlPoints[o]=new ae(s.x,s.y,s.z,s.w)}}getPoint(t,e=new ft){const n=e,i=this.knots[this.startKnot]+t*(this.knots[this.endKnot]-this.knots[this.startKnot]),a=Fr(this.degree,this.knots,this.controlPoints,i);return a.w!==1&&a.divideScalar(a.w),n.set(a.x,a.y,a.z)}getTangent(t,e=new ft){const n=e,i=this.knots[0]+t*(this.knots[this.knots.length-1]-this.knots[0]),a=Ur(this.degree,this.knots,this.controlPoints,i,1);return n.copy(a[1]).normalize(),n}}let M,V,$;class Vr extends jn{constructor(t){super(t)}load(t,e,n,i){const a=this,o=a.path===""?Te.extractUrlBase(t):a.path,s=new Xn(this.manager);s.setPath(a.path),s.setResponseType("arraybuffer"),s.setRequestHeader(a.requestHeader),s.setWithCredentials(a.withCredentials),s.load(t,function(l){try{e(a.parse(l,o))}catch(c){i?i(c):console.error(c),a.manager.itemError(t)}},n,i)}parse(t,e){if(Zr(t))M=new Hr().parse(t);else{const i=Bn(t);if(!Kr(i))throw new Error("THREE.FBXLoader: Unknown format.");if(Qe(i)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Qe(i));M=new br().parse(i)}const n=new bn(this.manager).setPath(this.resourcePath||e).setCrossOrigin(this.crossOrigin);return new Gr(n,this.manager).parse(M)}}class Gr{constructor(t,e){this.textureLoader=t,this.manager=e}parse(){V=this.parseConnections();const t=this.parseImages(),e=this.parseTextures(t),n=this.parseMaterials(e),i=this.parseDeformers(),a=new jr().parse(i);return this.parseScene(i,a,n),$}parseConnections(){const t=new Map;return"Connections"in M&&M.Connections.connections.forEach(function(n){const i=n[0],a=n[1],o=n[2];t.has(i)||t.set(i,{parents:[],children:[]});const s={ID:a,relationship:o};t.get(i).parents.push(s),t.has(a)||t.set(a,{parents:[],children:[]});const l={ID:i,relationship:o};t.get(a).children.push(l)}),t}parseImages(){const t={},e={};if("Video"in M.Objects){const n=M.Objects.Video;for(const i in n){const a=n[i],o=parseInt(i);if(t[o]=a.RelativeFilename||a.Filename,"Content"in a){const s=a.Content instanceof ArrayBuffer&&a.Content.byteLength>0,l=typeof a.Content=="string"&&a.Content!=="";if(s||l){const c=this.parseImage(n[i]);e[a.RelativeFilename||a.Filename]=c}}}}for(const n in t){const i=t[n];e[i]!==void 0?t[n]=e[i]:t[n]=t[n].split("\\").pop()}return t}parseImage(t){const e=t.Content,n=t.RelativeFilename||t.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();let a;switch(i){case"bmp":a="image/bmp";break;case"jpg":case"jpeg":a="image/jpeg";break;case"png":a="image/png";break;case"tif":a="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),a="image/tga";break;default:console.warn('FBXLoader: Image type "'+i+'" is not supported.');return}if(typeof e=="string")return"data:"+a+";base64,"+e;{const o=new Uint8Array(e);return window.URL.createObjectURL(new Blob([o],{type:a}))}}parseTextures(t){const e=new Map;if("Texture"in M.Objects){const n=M.Objects.Texture;for(const i in n){const a=this.parseTexture(n[i],t);e.set(parseInt(i),a)}}return e}parseTexture(t,e){const n=this.loadTexture(t,e);n.ID=t.id,n.name=t.attrName;const i=t.WrapModeU,a=t.WrapModeV,o=i!==void 0?i.value:0,s=a!==void 0?a.value:0;if(n.wrapS=o===0?Ue:Ve,n.wrapT=s===0?Ue:Ve,"Scaling"in t){const l=t.Scaling.value;n.repeat.x=l[0],n.repeat.y=l[1]}if("Translation"in t){const l=t.Translation.value;n.offset.x=l[0],n.offset.y=l[1]}return n}loadTexture(t,e){let n;const i=this.textureLoader.path,a=V.get(t.id).children;a!==void 0&&a.length>0&&e[a[0].ID]!==void 0&&(n=e[a[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let o;const s=t.FileName.slice(-3).toLowerCase();if(s==="tga"){const l=this.manager.getHandler(".tga");l===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",t.RelativeFilename),o=new Ge):(l.setPath(this.textureLoader.path),o=l.load(n))}else s==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",t.RelativeFilename),o=new Ge):o=this.textureLoader.load(n);return this.textureLoader.setPath(i),o}parseMaterials(t){const e=new Map;if("Material"in M.Objects){const n=M.Objects.Material;for(const i in n){const a=this.parseMaterial(n[i],t);a!==null&&e.set(parseInt(i),a)}}return e}parseMaterial(t,e){const n=t.id,i=t.attrName;let a=t.ShadingModel;if(typeof a=="object"&&(a=a.value),!V.has(n))return null;const o=this.parseParameters(t,e,n);let s;switch(a.toLowerCase()){case"phong":s=new se;break;case"lambert":s=new Hn;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',a),s=new se;break}return s.setValues(o),s.name=i,s}parseParameters(t,e,n){const i={};t.BumpFactor&&(i.bumpScale=t.BumpFactor.value),t.Diffuse?i.color=new ct().fromArray(t.Diffuse.value):t.DiffuseColor&&(t.DiffuseColor.type==="Color"||t.DiffuseColor.type==="ColorRGB")&&(i.color=new ct().fromArray(t.DiffuseColor.value)),t.DisplacementFactor&&(i.displacementScale=t.DisplacementFactor.value),t.Emissive?i.emissive=new ct().fromArray(t.Emissive.value):t.EmissiveColor&&(t.EmissiveColor.type==="Color"||t.EmissiveColor.type==="ColorRGB")&&(i.emissive=new ct().fromArray(t.EmissiveColor.value)),t.EmissiveFactor&&(i.emissiveIntensity=parseFloat(t.EmissiveFactor.value)),t.Opacity&&(i.opacity=parseFloat(t.Opacity.value)),i.opacity<1&&(i.transparent=!0),t.ReflectionFactor&&(i.reflectivity=t.ReflectionFactor.value),t.Shininess&&(i.shininess=t.Shininess.value),t.Specular?i.specular=new ct().fromArray(t.Specular.value):t.SpecularColor&&t.SpecularColor.type==="Color"&&(i.specular=new ct().fromArray(t.SpecularColor.value));const a=this;return V.get(n).children.forEach(function(o){const s=o.relationship;switch(s){case"Bump":i.bumpMap=a.getTexture(e,o.ID);break;case"Maya|TEX_ao_map":i.aoMap=a.getTexture(e,o.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=a.getTexture(e,o.ID),i.map!==void 0&&(i.map.encoding=Ht);break;case"DisplacementColor":i.displacementMap=a.getTexture(e,o.ID);break;case"EmissiveColor":i.emissiveMap=a.getTexture(e,o.ID),i.emissiveMap!==void 0&&(i.emissiveMap.encoding=Ht);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=a.getTexture(e,o.ID);break;case"ReflectionColor":i.envMap=a.getTexture(e,o.ID),i.envMap!==void 0&&(i.envMap.mapping=Zn,i.envMap.encoding=Ht);break;case"SpecularColor":i.specularMap=a.getTexture(e,o.ID),i.specularMap!==void 0&&(i.specularMap.encoding=Ht);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=a.getTexture(e,o.ID),i.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",s);break}}),i}getTexture(t,e){return"LayeredTexture"in M.Objects&&e in M.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),e=V.get(e).children[0].ID),t.get(e)}parseDeformers(){const t={},e={};if("Deformer"in M.Objects){const n=M.Objects.Deformer;for(const i in n){const a=n[i],o=V.get(parseInt(i));if(a.attrType==="Skin"){const s=this.parseSkeleton(o,n);s.ID=i,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),s.geometryID=o.parents[0].ID,t[i]=s}else if(a.attrType==="BlendShape"){const s={id:i};s.rawTargets=this.parseMorphTargets(o,n),s.id=i,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),e[i]=s}}}return{skeletons:t,morphTargets:e}}parseSkeleton(t,e){const n=[];return t.children.forEach(function(i){const a=e[i.ID];if(a.attrType!=="Cluster")return;const o={ID:i.ID,indices:[],weights:[],transformLink:new U().fromArray(a.TransformLink.a)};"Indexes"in a&&(o.indices=a.Indexes.a,o.weights=a.Weights.a),n.push(o)}),{rawBones:n,bones:[]}}parseMorphTargets(t,e){const n=[];for(let i=0;i<t.children.length;i++){const a=t.children[i],o=e[a.ID],s={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if(o.attrType!=="BlendShapeChannel")return;s.geoID=V.get(parseInt(a.ID)).children.filter(function(l){return l.relationship===void 0})[0].ID,n.push(s)}return n}parseScene(t,e,n){$=new je;const i=this.parseModels(t.skeletons,e,n),a=M.Objects.Model,o=this;i.forEach(function(l){const c=a[l.ID];o.setLookAtProperties(l,c),V.get(l.ID).parents.forEach(function(u){const f=i.get(u.ID);f!==void 0&&f.add(l)}),l.parent===null&&$.add(l)}),this.bindSkeleton(t.skeletons,e,i),this.createAmbientLight(),$.traverse(function(l){if(l.userData.transformData){l.parent&&(l.userData.transformData.parentMatrix=l.parent.matrix,l.userData.transformData.parentMatrixWorld=l.parent.matrixWorld);const c=zn(l.userData.transformData);l.applyMatrix4(c),l.updateWorldMatrix()}});const s=new Xr().parse();$.children.length===1&&$.children[0].isGroup&&($.children[0].animations=s,$=$.children[0]),$.animations=s}parseModels(t,e,n){const i=new Map,a=M.Objects.Model;for(const o in a){const s=parseInt(o),l=a[o],c=V.get(s);let h=this.buildSkeleton(c,t,s,l.attrName);if(!h){switch(l.attrType){case"Camera":h=this.createCamera(c);break;case"Light":h=this.createLight(c);break;case"Mesh":h=this.createMesh(c,e,n);break;case"NurbsCurve":h=this.createCurve(c,e);break;case"LimbNode":case"Root":h=new fe;break;case"Null":default:h=new je;break}h.name=l.attrName?Jt.sanitizeNodeName(l.attrName):"",h.ID=s}this.getTransformData(h,l),i.set(s,h)}return i}buildSkeleton(t,e,n,i){let a=null;return t.parents.forEach(function(o){for(const s in e){const l=e[s];l.rawBones.forEach(function(c,h){if(c.ID===o.ID){const u=a;a=new fe,a.matrixWorld.copy(c.transformLink),a.name=i?Jt.sanitizeNodeName(i):"",a.ID=n,l.bones[h]=a,u!==null&&a.add(u)}})}}),a}createCamera(t){let e,n;if(t.children.forEach(function(i){const a=M.Objects.NodeAttribute[i.ID];a!==void 0&&(n=a)}),n===void 0)e=new le;else{let i=0;n.CameraProjectionType!==void 0&&n.CameraProjectionType.value===1&&(i=1);let a=1;n.NearPlane!==void 0&&(a=n.NearPlane.value/1e3);let o=1e3;n.FarPlane!==void 0&&(o=n.FarPlane.value/1e3);let s=window.innerWidth,l=window.innerHeight;n.AspectWidth!==void 0&&n.AspectHeight!==void 0&&(s=n.AspectWidth.value,l=n.AspectHeight.value);const c=s/l;let h=45;n.FieldOfView!==void 0&&(h=n.FieldOfView.value);const u=n.FocalLength?n.FocalLength.value:null;switch(i){case 0:e=new Wn(h,c,a,o),u!==null&&e.setFocalLength(u);break;case 1:e=new Kn(-s/2,s/2,l/2,-l/2,a,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+i+"."),e=new le;break}}return e}createLight(t){let e,n;if(t.children.forEach(function(i){const a=M.Objects.NodeAttribute[i.ID];a!==void 0&&(n=a)}),n===void 0)e=new le;else{let i;n.LightType===void 0?i=0:i=n.LightType.value;let a=16777215;n.Color!==void 0&&(a=new ct().fromArray(n.Color.value));let o=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&&n.CastLightOnObject.value===0&&(o=0);let s=0;n.FarAttenuationEnd!==void 0&&(n.EnableFarAttenuation!==void 0&&n.EnableFarAttenuation.value===0?s=0:s=n.FarAttenuationEnd.value);const l=1;switch(i){case 0:e=new Xe(a,o,s,l);break;case 1:e=new $n(a,o);break;case 2:let c=Math.PI/3;n.InnerAngle!==void 0&&(c=it.degToRad(n.InnerAngle.value));let h=0;n.OuterAngle!==void 0&&(h=it.degToRad(n.OuterAngle.value),h=Math.max(h,1)),e=new Yn(a,o,s,c,h,l);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),e=new Xe(a,o);break}n.CastShadows!==void 0&&n.CastShadows.value===1&&(e.castShadow=!0)}return e}createMesh(t,e,n){let i,a=null,o=null;const s=[];return t.children.forEach(function(l){e.has(l.ID)&&(a=e.get(l.ID)),n.has(l.ID)&&s.push(n.get(l.ID))}),s.length>1?o=s:s.length>0?o=s[0]:(o=new se({color:13421772}),s.push(o)),"color"in a.attributes&&s.forEach(function(l){l.vertexColors=!0}),a.FBX_Deformer?(i=new qn(a,o),i.normalizeSkinWeights()):i=new Qn(a,o),i}createCurve(t,e){const n=t.children.reduce(function(a,o){return e.has(o.ID)&&(a=e.get(o.ID)),a},null),i=new Jn({color:3342591,linewidth:1});return new Nn(n,i)}getTransformData(t,e){const n={};"InheritType"in e&&(n.inheritType=parseInt(e.InheritType.value)),"RotationOrder"in e?n.eulerOrder=On(e.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in e&&(n.translation=e.Lcl_Translation.value),"PreRotation"in e&&(n.preRotation=e.PreRotation.value),"Lcl_Rotation"in e&&(n.rotation=e.Lcl_Rotation.value),"PostRotation"in e&&(n.postRotation=e.PostRotation.value),"Lcl_Scaling"in e&&(n.scale=e.Lcl_Scaling.value),"ScalingOffset"in e&&(n.scalingOffset=e.ScalingOffset.value),"ScalingPivot"in e&&(n.scalingPivot=e.ScalingPivot.value),"RotationOffset"in e&&(n.rotationOffset=e.RotationOffset.value),"RotationPivot"in e&&(n.rotationPivot=e.RotationPivot.value),t.userData.transformData=n}setLookAtProperties(t,e){"LookAtProperty"in e&&V.get(t.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){const a=M.Objects.Model[i.ID];if("Lcl_Translation"in a){const o=a.Lcl_Translation.value;t.target!==void 0?(t.target.position.fromArray(o),$.add(t.target)):t.lookAt(new ft().fromArray(o))}}})}bindSkeleton(t,e,n){const i=this.parsePoseNodes();for(const a in t){const o=t[a];V.get(parseInt(o.ID)).parents.forEach(function(l){if(e.has(l.ID)){const c=l.ID;V.get(c).parents.forEach(function(u){n.has(u.ID)&&n.get(u.ID).bind(new _n(o.bones),i[u.ID])})}})}}parsePoseNodes(){const t={};if("Pose"in M.Objects){const e=M.Objects.Pose;for(const n in e)if(e[n].attrType==="BindPose"&&e[n].NbPoseNodes>0){const i=e[n].PoseNode;Array.isArray(i)?i.forEach(function(a){t[a.Node]=new U().fromArray(a.Matrix.a)}):t[i.Node]=new U().fromArray(i.Matrix.a)}}return t}createAmbientLight(){if("GlobalSettings"in M&&"AmbientColor"in M.GlobalSettings){const t=M.GlobalSettings.AmbientColor.value,e=t[0],n=t[1],i=t[2];if(e!==0||n!==0||i!==0){const a=new ct(e,n,i);$.add(new tr(a,1))}}}}class jr{parse(t){const e=new Map;if("Geometry"in M.Objects){const n=M.Objects.Geometry;for(const i in n){const a=V.get(parseInt(i)),o=this.parseGeometry(a,n[i],t);e.set(parseInt(i),o)}}return e}parseGeometry(t,e,n){switch(e.attrType){case"Mesh":return this.parseMeshGeometry(t,e,n);case"NurbsCurve":return this.parseNurbsGeometry(e)}}parseMeshGeometry(t,e,n){const i=n.skeletons,a=[],o=t.parents.map(function(u){return M.Objects.Model[u.ID]});if(o.length===0)return;const s=t.children.reduce(function(u,f){return i[f.ID]!==void 0&&(u=i[f.ID]),u},null);t.children.forEach(function(u){n.morphTargets[u.ID]!==void 0&&a.push(n.morphTargets[u.ID])});const l=o[0],c={};"RotationOrder"in l&&(c.eulerOrder=On(l.RotationOrder.value)),"InheritType"in l&&(c.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(c.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(c.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(c.scale=l.GeometricScaling.value);const h=zn(c);return this.genGeometry(e,s,a,h)}genGeometry(t,e,n,i){const a=new Zt;t.attrName&&(a.name=t.attrName);const o=this.parseGeoNode(t,e),s=this.genBuffers(o),l=new yt(s.vertex,3);if(l.applyMatrix4(i),a.setAttribute("position",l),s.colors.length>0&&a.setAttribute("color",new yt(s.colors,3)),e&&(a.setAttribute("skinIndex",new er(s.weightsIndices,4)),a.setAttribute("skinWeight",new yt(s.vertexWeights,4)),a.FBX_Deformer=e),s.normal.length>0){const c=new nr().getNormalMatrix(i),h=new yt(s.normal,3);h.applyNormalMatrix(c),a.setAttribute("normal",h)}if(s.uvs.forEach(function(c,h){let u="uv"+(h+1).toString();h===0&&(u="uv"),a.setAttribute(u,new yt(s.uvs[h],2))}),o.material&&o.material.mappingType!=="AllSame"){let c=s.materialIndex[0],h=0;if(s.materialIndex.forEach(function(u,f){u!==c&&(a.addGroup(h,f-h,c),c=u,h=f)}),a.groups.length>0){const u=a.groups[a.groups.length-1],f=u.start+u.count;f!==s.materialIndex.length&&a.addGroup(f,s.materialIndex.length-f,c)}a.groups.length===0&&a.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(a,t,n,i),a}parseGeoNode(t,e){const n={};if(n.vertexPositions=t.Vertices!==void 0?t.Vertices.a:[],n.vertexIndices=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(n.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(n.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(n.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){n.uv=[];let i=0;for(;t.LayerElementUV[i];)t.LayerElementUV[i].UV&&n.uv.push(this.parseUVs(t.LayerElementUV[i])),i++}return n.weightTable={},e!==null&&(n.skeleton=e,e.rawBones.forEach(function(i,a){i.indices.forEach(function(o,s){n.weightTable[o]===void 0&&(n.weightTable[o]=[]),n.weightTable[o].push({id:a,weight:i.weights[s]})})})),n}genBuffers(t){const e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,i=0,a=!1,o=[],s=[],l=[],c=[],h=[],u=[];const f=this;return t.vertexIndices.forEach(function(p,v){let g,y=!1;p<0&&(p=p^-1,y=!0);let T=[],d=[];if(o.push(p*3,p*3+1,p*3+2),t.color){const m=Yt(v,n,p,t.color);l.push(m[0],m[1],m[2])}if(t.skeleton){if(t.weightTable[p]!==void 0&&t.weightTable[p].forEach(function(m){d.push(m.weight),T.push(m.id)}),d.length>4){a||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),a=!0);const m=[0,0,0,0],I=[0,0,0,0];d.forEach(function(D,x){let A=D,w=T[x];I.forEach(function(z,P,X){if(A>z){X[P]=A,A=z;const k=m[P];m[P]=w,w=k}})}),T=m,d=I}for(;d.length<4;)d.push(0),T.push(0);for(let m=0;m<4;++m)h.push(d[m]),u.push(T[m])}if(t.normal){const m=Yt(v,n,p,t.normal);s.push(m[0],m[1],m[2])}t.material&&t.material.mappingType!=="AllSame"&&(g=Yt(v,n,p,t.material)[0]),t.uv&&t.uv.forEach(function(m,I){const D=Yt(v,n,p,m);c[I]===void 0&&(c[I]=[]),c[I].push(D[0]),c[I].push(D[1])}),i++,y&&(f.genFace(e,t,o,g,s,l,c,h,u,i),n++,i=0,o=[],s=[],l=[],c=[],h=[],u=[])}),e}genFace(t,e,n,i,a,o,s,l,c,h){for(let u=2;u<h;u++)t.vertex.push(e.vertexPositions[n[0]]),t.vertex.push(e.vertexPositions[n[1]]),t.vertex.push(e.vertexPositions[n[2]]),t.vertex.push(e.vertexPositions[n[(u-1)*3]]),t.vertex.push(e.vertexPositions[n[(u-1)*3+1]]),t.vertex.push(e.vertexPositions[n[(u-1)*3+2]]),t.vertex.push(e.vertexPositions[n[u*3]]),t.vertex.push(e.vertexPositions[n[u*3+1]]),t.vertex.push(e.vertexPositions[n[u*3+2]]),e.skeleton&&(t.vertexWeights.push(l[0]),t.vertexWeights.push(l[1]),t.vertexWeights.push(l[2]),t.vertexWeights.push(l[3]),t.vertexWeights.push(l[(u-1)*4]),t.vertexWeights.push(l[(u-1)*4+1]),t.vertexWeights.push(l[(u-1)*4+2]),t.vertexWeights.push(l[(u-1)*4+3]),t.vertexWeights.push(l[u*4]),t.vertexWeights.push(l[u*4+1]),t.vertexWeights.push(l[u*4+2]),t.vertexWeights.push(l[u*4+3]),t.weightsIndices.push(c[0]),t.weightsIndices.push(c[1]),t.weightsIndices.push(c[2]),t.weightsIndices.push(c[3]),t.weightsIndices.push(c[(u-1)*4]),t.weightsIndices.push(c[(u-1)*4+1]),t.weightsIndices.push(c[(u-1)*4+2]),t.weightsIndices.push(c[(u-1)*4+3]),t.weightsIndices.push(c[u*4]),t.weightsIndices.push(c[u*4+1]),t.weightsIndices.push(c[u*4+2]),t.weightsIndices.push(c[u*4+3])),e.color&&(t.colors.push(o[0]),t.colors.push(o[1]),t.colors.push(o[2]),t.colors.push(o[(u-1)*3]),t.colors.push(o[(u-1)*3+1]),t.colors.push(o[(u-1)*3+2]),t.colors.push(o[u*3]),t.colors.push(o[u*3+1]),t.colors.push(o[u*3+2])),e.material&&e.material.mappingType!=="AllSame"&&(t.materialIndex.push(i),t.materialIndex.push(i),t.materialIndex.push(i)),e.normal&&(t.normal.push(a[0]),t.normal.push(a[1]),t.normal.push(a[2]),t.normal.push(a[(u-1)*3]),t.normal.push(a[(u-1)*3+1]),t.normal.push(a[(u-1)*3+2]),t.normal.push(a[u*3]),t.normal.push(a[u*3+1]),t.normal.push(a[u*3+2])),e.uv&&e.uv.forEach(function(f,p){t.uvs[p]===void 0&&(t.uvs[p]=[]),t.uvs[p].push(s[p][0]),t.uvs[p].push(s[p][1]),t.uvs[p].push(s[p][(u-1)*2]),t.uvs[p].push(s[p][(u-1)*2+1]),t.uvs[p].push(s[p][u*2]),t.uvs[p].push(s[p][u*2+1])})}addMorphTargets(t,e,n,i){if(n.length===0)return;t.morphTargetsRelative=!0,t.morphAttributes.position=[];const a=this;n.forEach(function(o){o.rawTargets.forEach(function(s){const l=M.Objects.Geometry[s.geoID];l!==void 0&&a.genMorphGeometry(t,e,l,i,s.name)})})}genMorphGeometry(t,e,n,i,a){const o=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],s=n.Vertices!==void 0?n.Vertices.a:[],l=n.Indexes!==void 0?n.Indexes.a:[],c=t.attributes.position.count*3,h=new Float32Array(c);for(let v=0;v<l.length;v++){const g=l[v]*3;h[g]=s[v*3],h[g+1]=s[v*3+1],h[g+2]=s[v*3+2]}const u={vertexIndices:o,vertexPositions:h},f=this.genBuffers(u),p=new yt(f.vertex,3);p.name=a||n.attrName,p.applyMatrix4(i),t.morphAttributes.position.push(p)}parseNormals(t){const e=t.MappingInformationType,n=t.ReferenceInformationType,i=t.Normals.a;let a=[];return n==="IndexToDirect"&&("NormalIndex"in t?a=t.NormalIndex.a:"NormalsIndex"in t&&(a=t.NormalsIndex.a)),{dataSize:3,buffer:i,indices:a,mappingType:e,referenceType:n}}parseUVs(t){const e=t.MappingInformationType,n=t.ReferenceInformationType,i=t.UV.a;let a=[];return n==="IndexToDirect"&&(a=t.UVIndex.a),{dataSize:2,buffer:i,indices:a,mappingType:e,referenceType:n}}parseVertexColors(t){const e=t.MappingInformationType,n=t.ReferenceInformationType,i=t.Colors.a;let a=[];return n==="IndexToDirect"&&(a=t.ColorIndex.a),{dataSize:4,buffer:i,indices:a,mappingType:e,referenceType:n}}parseMaterialIndices(t){const e=t.MappingInformationType,n=t.ReferenceInformationType;if(e==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};const i=t.Materials.a,a=[];for(let o=0;o<i.length;++o)a.push(o);return{dataSize:1,buffer:i,indices:a,mappingType:e,referenceType:n}}parseNurbsGeometry(t){if($e===void 0)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new Zt;const e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new Zt;const n=e-1,i=t.KnotVector.a,a=[],o=t.Points.a;for(let u=0,f=o.length;u<f;u+=4)a.push(new ae().fromArray(o,u));let s,l;if(t.Form==="Closed")a.push(a[0]);else if(t.Form==="Periodic"){s=n,l=i.length-1-s;for(let u=0;u<n;++u)a.push(a[u])}const h=new $e(n,i,a,s,l).getPoints(a.length*12);return new Zt().setFromPoints(h)}}class Xr{parse(){const t=[],e=this.parseClips();if(e!==void 0)for(const n in e){const i=e[n],a=this.addClip(i);t.push(a)}return t}parseClips(){if(M.Objects.AnimationCurve===void 0)return;const t=this.parseAnimationCurveNodes();this.parseAnimationCurves(t);const e=this.parseAnimationLayers(t);return this.parseAnimStacks(e)}parseAnimationCurveNodes(){const t=M.Objects.AnimationCurveNode,e=new Map;for(const n in t){const i=t[n];if(i.attrName.match(/S|R|T|DeformPercent/)!==null){const a={id:i.id,attr:i.attrName,curves:{}};e.set(a.id,a)}}return e}parseAnimationCurves(t){const e=M.Objects.AnimationCurve;for(const n in e){const i={id:e[n].id,times:e[n].KeyTime.a.map(Wr),values:e[n].KeyValueFloat.a},a=V.get(i.id);if(a!==void 0){const o=a.parents[0].ID,s=a.parents[0].relationship;s.match(/X/)?t.get(o).curves.x=i:s.match(/Y/)?t.get(o).curves.y=i:s.match(/Z/)?t.get(o).curves.z=i:s.match(/d|DeformPercent/)&&t.has(o)&&(t.get(o).curves.morph=i)}}}parseAnimationLayers(t){const e=M.Objects.AnimationLayer,n=new Map;for(const i in e){const a=[],o=V.get(parseInt(i));o!==void 0&&(o.children.forEach(function(l,c){if(t.has(l.ID)){const h=t.get(l.ID);if(h.curves.x!==void 0||h.curves.y!==void 0||h.curves.z!==void 0){if(a[c]===void 0){const u=V.get(l.ID).parents.filter(function(f){return f.relationship!==void 0})[0].ID;if(u!==void 0){const f=M.Objects.Model[u.toString()];if(f===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",l);return}const p={modelName:f.attrName?Jt.sanitizeNodeName(f.attrName):"",ID:f.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};$.traverse(function(v){v.ID===f.id&&(p.transform=v.matrix,v.userData.transformData&&(p.eulerOrder=v.userData.transformData.eulerOrder))}),p.transform||(p.transform=new U),"PreRotation"in f&&(p.preRotation=f.PreRotation.value),"PostRotation"in f&&(p.postRotation=f.PostRotation.value),a[c]=p}}a[c]&&(a[c][h.attr]=h)}else if(h.curves.morph!==void 0){if(a[c]===void 0){const u=V.get(l.ID).parents.filter(function(T){return T.relationship!==void 0})[0].ID,f=V.get(u).parents[0].ID,p=V.get(f).parents[0].ID,v=V.get(p).parents[0].ID,g=M.Objects.Model[v],y={modelName:g.attrName?Jt.sanitizeNodeName(g.attrName):"",morphName:M.Objects.Deformer[u].attrName};a[c]=y}a[c][h.attr]=h}}}),n.set(parseInt(i),a))}return n}parseAnimStacks(t){const e=M.Objects.AnimationStack,n={};for(const i in e){const a=V.get(parseInt(i)).children;a.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const o=t.get(a[0].ID);n[i]={name:e[i].attrName,layer:o}}return n}addClip(t){let e=[];const n=this;return t.layer.forEach(function(i){e=e.concat(n.generateTracks(i))}),new rr(t.name,-1,e)}generateTracks(t){const e=[];let n=new ft,i=new Kt,a=new ft;if(t.transform&&t.transform.decompose(n,i,a),n=n.toArray(),i=new Ft().setFromQuaternion(i,t.eulerOrder).toArray(),a=a.toArray(),t.T!==void 0&&Object.keys(t.T.curves).length>0){const o=this.generateVectorTrack(t.modelName,t.T.curves,n,"position");o!==void 0&&e.push(o)}if(t.R!==void 0&&Object.keys(t.R.curves).length>0){const o=this.generateRotationTrack(t.modelName,t.R.curves,i,t.preRotation,t.postRotation,t.eulerOrder);o!==void 0&&e.push(o)}if(t.S!==void 0&&Object.keys(t.S.curves).length>0){const o=this.generateVectorTrack(t.modelName,t.S.curves,a,"scale");o!==void 0&&e.push(o)}if(t.DeformPercent!==void 0){const o=this.generateMorphTrack(t);o!==void 0&&e.push(o)}return e}generateVectorTrack(t,e,n,i){const a=this.getTimesForAllAxes(e),o=this.getKeyframeTrackValues(a,e,n);return new ir(t+"."+i,a,o)}generateRotationTrack(t,e,n,i,a,o){e.x!==void 0&&(this.interpolateRotations(e.x),e.x.values=e.x.values.map(it.degToRad)),e.y!==void 0&&(this.interpolateRotations(e.y),e.y.values=e.y.values.map(it.degToRad)),e.z!==void 0&&(this.interpolateRotations(e.z),e.z.values=e.z.values.map(it.degToRad));const s=this.getTimesForAllAxes(e),l=this.getKeyframeTrackValues(s,e,n);i!==void 0&&(i=i.map(it.degToRad),i.push(o),i=new Ft().fromArray(i),i=new Kt().setFromEuler(i)),a!==void 0&&(a=a.map(it.degToRad),a.push(o),a=new Ft().fromArray(a),a=new Kt().setFromEuler(a).invert());const c=new Kt,h=new Ft,u=[];for(let f=0;f<l.length;f+=3)h.set(l[f],l[f+1],l[f+2],o),c.setFromEuler(h),i!==void 0&&c.premultiply(i),a!==void 0&&c.multiply(a),c.toArray(u,f/3*4);return new ar(t+".quaternion",s,u)}generateMorphTrack(t){const e=t.DeformPercent.curves.morph,n=e.values.map(function(a){return a/100}),i=$.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new or(t.modelName+".morphTargetInfluences["+i+"]",e.times,n)}getTimesForAllAxes(t){let e=[];if(t.x!==void 0&&(e=e.concat(t.x.times)),t.y!==void 0&&(e=e.concat(t.y.times)),t.z!==void 0&&(e=e.concat(t.z.times)),e=e.sort(function(n,i){return n-i}),e.length>1){let n=1,i=e[0];for(let a=1;a<e.length;a++){const o=e[a];o!==i&&(e[n]=o,i=o,n++)}e=e.slice(0,n)}return e}getKeyframeTrackValues(t,e,n){const i=n,a=[];let o=-1,s=-1,l=-1;return t.forEach(function(c){if(e.x&&(o=e.x.times.indexOf(c)),e.y&&(s=e.y.times.indexOf(c)),e.z&&(l=e.z.times.indexOf(c)),o!==-1){const h=e.x.values[o];a.push(h),i[0]=h}else a.push(i[0]);if(s!==-1){const h=e.y.values[s];a.push(h),i[1]=h}else a.push(i[1]);if(l!==-1){const h=e.z.values[l];a.push(h),i[2]=h}else a.push(i[2])}),a}interpolateRotations(t){for(let e=1;e<t.values.length;e++){const n=t.values[e-1],i=t.values[e]-n,a=Math.abs(i);if(a>=180){const o=a/180,s=i/o;let l=n+s;const c=t.times[e-1],u=(t.times[e]-c)/o;let f=c+u;const p=[],v=[];for(;f<t.times[e];)p.push(f),f+=u,v.push(l),l+=s;t.times=Je(t.times,e,p),t.values=Je(t.values,e,v)}}}}class br{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(t){this.nodeStack.push(t),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(t,e){this.currentProp=t,this.currentPropName=e}parse(t){this.currentIndent=0,this.allNodes=new Rn,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const e=this,n=t.split(/[\r\n]+/);return n.forEach(function(i,a){const o=i.match(/^[\s\t]*;/),s=i.match(/^[\s\t]*$/);if(o||s)return;const l=i.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){",""),c=i.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),h=i.match("^\\t{"+(e.currentIndent-1)+"}}");l?e.parseNodeBegin(i,l):c?e.parseNodeProperty(i,c,n[++a]):h?e.popStack():i.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(i)}),this.allNodes}parseNodeBegin(t,e){const n=e[1].trim().replace(/^"/,"").replace(/"$/,""),i=e[2].split(",").map(function(l){return l.trim().replace(/^"/,"").replace(/"$/,"")}),a={name:n},o=this.parseNodeAttr(i),s=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,a):n in s?(n==="PoseNode"?s.PoseNode.push(a):s[n].id!==void 0&&(s[n]={},s[n][s[n].id]=s[n]),o.id!==""&&(s[n][o.id]=a)):typeof o.id=="number"?(s[n]={},s[n][o.id]=a):n!=="Properties70"&&(n==="PoseNode"?s[n]=[a]:s[n]=a),typeof o.id=="number"&&(a.id=o.id),o.name!==""&&(a.attrName=o.name),o.type!==""&&(a.attrType=o.type),this.pushStack(a)}parseNodeAttr(t){let e=t[0];t[0]!==""&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));let n="",i="";return t.length>1&&(n=t[1].replace(/^(\w+)::/,""),i=t[2]),{id:e,name:n,type:i}}parseNodeProperty(t,e,n){let i=e[1].replace(/^"/,"").replace(/"$/,"").trim(),a=e[2].replace(/^"/,"").replace(/"$/,"").trim();i==="Content"&&a===","&&(a=n.replace(/"/g,"").replace(/,$/,"").trim());const o=this.getCurrentNode();if(o.name==="Properties70"){this.parseNodeSpecialProperty(t,i,a);return}if(i==="C"){const l=a.split(",").slice(1),c=parseInt(l[0]),h=parseInt(l[1]);let u=a.split(",").slice(3);u=u.map(function(f){return f.trim().replace(/^"/,"")}),i="connections",a=[c,h],$r(a,u),o[i]===void 0&&(o[i]=[])}i==="Node"&&(o.id=a),i in o&&Array.isArray(o[i])?o[i].push(a):i!=="a"?o[i]=a:o.a=a,this.setCurrentProp(o,i),i==="a"&&a.slice(-1)!==","&&(o.a=he(a))}parseNodePropertyContinued(t){const e=this.getCurrentNode();e.a+=t,t.slice(-1)!==","&&(e.a=he(e.a))}parseNodeSpecialProperty(t,e,n){const i=n.split('",').map(function(h){return h.trim().replace(/^\"/,"").replace(/\s/,"_")}),a=i[0],o=i[1],s=i[2],l=i[3];let c=i[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":c=parseFloat(c);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":c=he(c);break}this.getPrevNode()[a]={type:o,type2:s,flag:l,value:c},this.setCurrentProp(this.getPrevNode(),a)}}class Hr{parse(t){const e=new qe(t);e.skip(23);const n=e.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const i=new Rn;for(;!this.endOfContent(e);){const a=this.parseNode(e,n);a!==null&&i.add(a.name,a)}return i}endOfContent(t){return t.size()%16===0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+16>=t.size()}parseNode(t,e){const n={},i=e>=7500?t.getUint64():t.getUint32(),a=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();const o=t.getUint8(),s=t.getString(o);if(i===0)return null;const l=[];for(let f=0;f<a;f++)l.push(this.parseProperty(t));const c=l.length>0?l[0]:"",h=l.length>1?l[1]:"",u=l.length>2?l[2]:"";for(n.singleProperty=a===1&&t.getOffset()===i;i>t.getOffset();){const f=this.parseNode(t,e);f!==null&&this.parseSubNode(s,n,f)}return n.propertyList=l,typeof c=="number"&&(n.id=c),h!==""&&(n.attrName=h),u!==""&&(n.attrType=u),s!==""&&(n.name=s),n}parseSubNode(t,e,n){if(n.singleProperty===!0){const i=n.propertyList[0];Array.isArray(i)?(e[n.name]=n,n.a=i):e[n.name]=i}else if(t==="Connections"&&n.name==="C"){const i=[];n.propertyList.forEach(function(a,o){o!==0&&i.push(a)}),e.connections===void 0&&(e.connections=[]),e.connections.push(i)}else if(n.name==="Properties70")Object.keys(n).forEach(function(a){e[a]=n[a]});else if(t==="Properties70"&&n.name==="P"){let i=n.propertyList[0],a=n.propertyList[1];const o=n.propertyList[2],s=n.propertyList[3];let l;i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),a.indexOf("Lcl ")===0&&(a=a.replace("Lcl ","Lcl_")),a==="Color"||a==="ColorRGB"||a==="Vector"||a==="Vector3D"||a.indexOf("Lcl_")===0?l=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:l=n.propertyList[4],e[i]={type:a,type2:o,flag:s,value:l}}else e[n.name]===void 0?typeof n.id=="number"?(e[n.name]={},e[n.name][n.id]=n):e[n.name]=n:n.name==="PoseNode"?(Array.isArray(e[n.name])||(e[n.name]=[e[n.name]]),e[n.name].push(n)):e[n.name][n.id]===void 0&&(e[n.name][n.id]=n)}parseProperty(t){const e=t.getString(1);let n;switch(e){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return n=t.getUint32(),t.getArrayBuffer(n);case"S":return n=t.getUint32(),t.getString(n);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=t.getUint32(),a=t.getUint32(),o=t.getUint32();if(a===0)switch(e){case"b":case"c":return t.getBooleanArray(i);case"d":return t.getFloat64Array(i);case"f":return t.getFloat32Array(i);case"i":return t.getInt32Array(i);case"l":return t.getInt64Array(i)}typeof Lr>"u"&&console.error("THREE.FBXLoader: External library fflate.min.js required.");const s=Bt(new Uint8Array(t.getArrayBuffer(o))),l=new qe(s.buffer);switch(e){case"b":case"c":return l.getBooleanArray(i);case"d":return l.getFloat64Array(i);case"f":return l.getFloat32Array(i);case"i":return l.getInt32Array(i);case"l":return l.getInt64Array(i)}default:throw new Error("THREE.FBXLoader: Unknown property type "+e)}}}class qe{constructor(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=e!==void 0?e:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(t){this.offset+=t}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(t){const e=[];for(let n=0;n<t;n++)e.push(this.getBoolean());return e}getUint8(){const t=this.dv.getUint8(this.offset);return this.offset+=1,t}getInt16(){const t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}getInt32(){const t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}getInt32Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getInt32());return e}getUint32(){const t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}getInt64(){let t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e&2147483648?(e=~e&4294967295,t=~t&4294967295,t===4294967295&&(e=e+1&4294967295),t=t+1&4294967295,-(e*4294967296+t)):e*4294967296+t}getInt64Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getInt64());return e}getUint64(){let t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),e*4294967296+t}getFloat32(){const t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}getFloat32Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getFloat32());return e}getFloat64(){const t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}getFloat64Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getFloat64());return e}getArrayBuffer(t){const e=this.dv.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}getString(t){let e=[];for(let i=0;i<t;i++)e[i]=this.getUint8();const n=e.indexOf(0);return n>=0&&(e=e.slice(0,n)),Te.decodeText(new Uint8Array(e))}}class Rn{add(t,e){this[t]=e}}function Zr(r){const t="Kaydara FBX Binary \0";return r.byteLength>=t.length&&t===Bn(r,0,t.length)}function Kr(r){const t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let e=0;function n(i){const a=r[i-1];return r=r.slice(e+i),e++,a}for(let i=0;i<t.length;++i)if(n(1)===t[i])return!1;return!0}function Qe(r){const t=/FBXVersion: (\d+)/,e=r.match(t);if(e)return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Wr(r){return r/46186158e3}const Yr=[];function Yt(r,t,e,n){let i;switch(n.mappingType){case"ByPolygonVertex":i=r;break;case"ByPolygon":i=t;break;case"ByVertice":i=e;break;case"AllSame":i=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}n.referenceType==="IndexToDirect"&&(i=n.indices[i]);const a=i*n.dataSize,o=a+n.dataSize;return qr(Yr,n.buffer,a,o)}const ue=new Ft,wt=new ft;function zn(r){const t=new U,e=new U,n=new U,i=new U,a=new U,o=new U,s=new U,l=new U,c=new U,h=new U,u=new U,f=new U,p=r.inheritType?r.inheritType:0;if(r.translation&&t.setPosition(wt.fromArray(r.translation)),r.preRotation){const P=r.preRotation.map(it.degToRad);P.push(r.eulerOrder),e.makeRotationFromEuler(ue.fromArray(P))}if(r.rotation){const P=r.rotation.map(it.degToRad);P.push(r.eulerOrder),n.makeRotationFromEuler(ue.fromArray(P))}if(r.postRotation){const P=r.postRotation.map(it.degToRad);P.push(r.eulerOrder),i.makeRotationFromEuler(ue.fromArray(P)),i.invert()}r.scale&&a.scale(wt.fromArray(r.scale)),r.scalingOffset&&s.setPosition(wt.fromArray(r.scalingOffset)),r.scalingPivot&&o.setPosition(wt.fromArray(r.scalingPivot)),r.rotationOffset&&l.setPosition(wt.fromArray(r.rotationOffset)),r.rotationPivot&&c.setPosition(wt.fromArray(r.rotationPivot)),r.parentMatrixWorld&&(u.copy(r.parentMatrix),h.copy(r.parentMatrixWorld));const v=e.clone().multiply(n).multiply(i),g=new U;g.extractRotation(h);const y=new U;y.copyPosition(h);const T=y.clone().invert().multiply(h),d=g.clone().invert().multiply(T),m=a,I=new U;if(p===0)I.copy(g).multiply(v).multiply(d).multiply(m);else if(p===1)I.copy(g).multiply(d).multiply(v).multiply(m);else{const X=new U().scale(new ft().setFromMatrixScale(u)).clone().invert(),k=d.clone().multiply(X);I.copy(g).multiply(v).multiply(k).multiply(m)}const D=c.clone().invert(),x=o.clone().invert();let A=t.clone().multiply(l).multiply(c).multiply(e).multiply(n).multiply(i).multiply(D).multiply(s).multiply(o).multiply(a).multiply(x);const w=new U().copyPosition(A),z=h.clone().multiply(w);return f.copyPosition(z),A=f.clone().multiply(I),A.premultiply(h.invert()),A}function On(r){r=r||0;const t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return r===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[r]}function he(r){return r.split(",").map(function(e){return parseFloat(e)})}function Bn(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=r.byteLength),Te.decodeText(new Uint8Array(r,t,e))}function $r(r,t){for(let e=0,n=r.length,i=t.length;e<i;e++,n++)r[n]=t[e]}function qr(r,t,e,n){for(let i=e,a=0;i<n;i++,a++)r[a]=t[i];return r}function Je(r,t,e){return r.slice(0,t).concat(e).concat(r.slice(t))}const Qr=new Map,Jr=new Vr;var ti=async(r,t)=>{const[e,n]=await Vn(Qr,r,()=>new Promise((i,a)=>{sr(),Jr.load(r,o=>{be();let s=!0;o.traverse(l=>{var c;s&&l instanceof fe&&(s=!1),!((c=l.material)===null||c===void 0)&&c.map&&(l.material.map.encoding=lr)}),i([o,s])},cr,()=>{be(),a()})}));return t?Gn(e,n):e};export{ti as default};