/* Face-API homepage: author: ' */ var _U=Object.create;var BC=Object.defineProperty;var EU=Object.getOwnPropertyDescriptor;var AU=Object.getOwnPropertyNames;var $U=Object.getPrototypeOf,DU=Object.prototype.hasOwnProperty;var Oe=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Zt=(r,t)=>{for(var e in t)BC(r,e,{get:t[e],enumerable:!0})},FU=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of AU(t))!DU.call(r,o)&&o!==e&&BC(r,o,{get:()=>t[o],enumerable:!(n=EU(t,o))||n.enumerable});return r};var Mu=(r,t,e)=>(e=r!=null?_U($U(r)):{},FU(t||!r||!r.__esModule?BC(e,"default",{value:r,enumerable:!0}):e,r));var H1=Oe((ilt,U1)=>{U1.exports=je;var po=null;try{po=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(r){}function je(r,t,e){this.low=r|0,this.high=t|0,this.unsigned=!!e}je.prototype.__isLong__;Object.defineProperty(je.prototype,"__isLong__",{value:!0});function zn(r){return(r&&r.__isLong__)===!0}je.isLong=zn;var O1={},M1={};function Wu(r,t){var e,n,o;return t?(r>>>=0,(o=0<=r&&r<256)&&(n=M1[r],n)?n:(e=Xe(r,(r|0)<0?-1:0,!0),o&&(M1[r]=e),e)):(r|=0,(o=-128<=r&&r<128)&&(n=O1[r],n)?n:(e=Xe(r,r<0?-1:0,!1),o&&(O1[r]=e),e))}je.fromInt=Wu;function mo(r,t){if(isNaN(r))return t?Gu:fo;if(t){if(r<0)return Gu;if(r>=B1)return W1}else{if(r<=-L1)return Ln;if(r+1>=L1)return G1}return r<0?mo(-r,t).neg():Xe(r%pm|0,r/pm|0,t)}je.fromNumber=mo;function Xe(r,t,e){return new je(r,t,e)}je.fromBits=Xe;var vx=Math.pow;function QC(r,t,e){if(r.length===0)throw Error("empty string");if(r==="NaN"||r==="Infinity"||r==="+Infinity"||r==="-Infinity")return fo;if(typeof t=="number"?(e=t,t=!1):t=!!t,e=e||10,e<2||360)throw Error("interior hyphen");if(n===0)return QC(r.substring(1),t,e).neg();for(var o=mo(vx(e,8)),s=fo,i=0;i>>0:this.low};yt.toNumber=function(){return this.unsigned?(this.high>>>0)*pm+(this.low>>>0):this.high*pm+(this.low>>>0)};yt.toString=function(t){if(t=t||10,t<2||36>>0,c=l.toString(t);if(i=u,i.isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}};yt.getHighBits=function(){return this.high};yt.getHighBitsUnsigned=function(){return this.high>>>0};yt.getLowBits=function(){return this.low};yt.getLowBitsUnsigned=function(){return this.low>>>0};yt.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Ln)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,e=31;e>0&&(t&1<=0};yt.isOdd=function(){return(this.low&1)===1};yt.isEven=function(){return(this.low&1)===0};yt.equals=function(t){return zn(t)||(t=qs(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};yt.eq=yt.equals;yt.notEquals=function(t){return!this.eq(t)};yt.neq=yt.notEquals;yt.ne=yt.notEquals;yt.lessThan=function(t){return this.comp(t)<0};yt.lt=yt.lessThan;yt.lessThanOrEqual=function(t){return this.comp(t)<=0};yt.lte=yt.lessThanOrEqual;yt.le=yt.lessThanOrEqual;yt.greaterThan=function(t){return this.comp(t)>0};yt.gt=yt.greaterThan;yt.greaterThanOrEqual=function(t){return this.comp(t)>=0};yt.gte=yt.greaterThanOrEqual;yt.ge=yt.greaterThanOrEqual;yt.compare=function(t){if(zn(t)||(t=qs(t)),this.eq(t))return 0;var e=this.isNegative(),n=t.isNegative();return e&&!n?-1:!e&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};yt.comp=yt.compare;yt.negate=function(){return!this.unsigned&&this.eq(Ln)?Ln:this.not().add(cm)};yt.neg=yt.negate;yt.add=function(t){zn(t)||(t=qs(t));var e=this.high>>>16,n=this.high&65535,o=this.low>>>16,s=this.low&65535,i=t.high>>>16,a=t.high&65535,u=t.low>>>16,l=t.low&65535,c=0,p=0,m=0,f=0;return f+=s+l,m+=f>>>16,f&=65535,m+=o+u,p+=m>>>16,m&=65535,p+=n+a,c+=p>>>16,p&=65535,c+=e+i,c&=65535,Xe(m<<16|f,c<<16|p,this.unsigned)};yt.subtract=function(t){return zn(t)||(t=qs(t)),this.add(t.neg())};yt.sub=yt.subtract;yt.multiply=function(t){if(this.isZero())return fo;if(zn(t)||(t=qs(t)),po){var e=po.mul(this.low,this.high,t.low,t.high);return Xe(e,po.get_high(),this.unsigned)}if(t.isZero())return fo;if(this.eq(Ln))return t.isOdd()?Ln:fo;if(t.eq(Ln))return this.isOdd()?Ln:fo;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(z1)&&t.lt(z1))return mo(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,o=this.high&65535,s=this.low>>>16,i=this.low&65535,a=t.high>>>16,u=t.high&65535,l=t.low>>>16,c=t.low&65535,p=0,m=0,f=0,d=0;return d+=i*c,f+=d>>>16,d&=65535,f+=s*c,m+=f>>>16,f&=65535,f+=i*l,m+=f>>>16,f&=65535,m+=o*c,p+=m>>>16,m&=65535,m+=s*l,p+=m>>>16,m&=65535,m+=i*u,p+=m>>>16,m&=65535,p+=n*c+o*l+s*u+i*a,p&=65535,Xe(f<<16|d,p<<16|m,this.unsigned)};yt.mul=yt.multiply;yt.divide=function(t){if(zn(t)||(t=qs(t)),t.isZero())throw Error("division by zero");if(po){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var e=(this.unsigned?po.div_u:po.div_s)(this.low,this.high,t.low,t.high);return Xe(e,po.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Gu:fo;var n,o,s;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return Gu;if(t.gt(this.shru(1)))return V1;s=Gu}else{if(this.eq(Ln)){if(t.eq(cm)||t.eq(JC))return Ln;if(t.eq(Ln))return cm;var i=this.shr(1);return n=i.div(t).shl(1),n.eq(fo)?t.isNegative()?cm:JC:(o=this.sub(t.mul(n)),s=n.add(o.div(t)),s)}else if(t.eq(Ln))return this.unsigned?Gu:fo;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();s=fo}for(o=this;o.gte(t);){n=Math.max(1,Math.floor(o.toNumber()/t.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),u=a<=48?1:vx(2,a-48),l=mo(n),c=l.mul(t);c.isNegative()||c.gt(o);)n-=u,l=mo(n,this.unsigned),c=l.mul(t);l.isZero()&&(l=cm),s=s.add(l),o=o.sub(c)}return s};yt.div=yt.divide;yt.modulo=function(t){if(zn(t)||(t=qs(t)),po){var e=(this.unsigned?po.rem_u:po.rem_s)(this.low,this.high,t.low,t.high);return Xe(e,po.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};yt.mod=yt.modulo;yt.rem=yt.modulo;yt.not=function(){return Xe(~this.low,~this.high,this.unsigned)};yt.and=function(t){return zn(t)||(t=qs(t)),Xe(this.low&t.low,this.high&t.high,this.unsigned)};yt.or=function(t){return zn(t)||(t=qs(t)),Xe(this.low|t.low,this.high|t.high,this.unsigned)};yt.xor=function(t){return zn(t)||(t=qs(t)),Xe(this.low^t.low,this.high^t.high,this.unsigned)};yt.shiftLeft=function(t){return zn(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?Xe(this.low<>>32-t,this.unsigned):Xe(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):Xe(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};yt.shr=yt.shiftRight;yt.shiftRightUnsigned=function(t){if(zn(t)&&(t=t.toInt()),t&=63,t===0)return this;var e=this.high;if(t<32){var n=this.low;return Xe(n>>>t|e<<32-t,e>>>t,this.unsigned)}else return t===32?Xe(e,0,this.unsigned):Xe(e>>>t-32,0,this.unsigned)};yt.shru=yt.shiftRightUnsigned;yt.shr_u=yt.shiftRightUnsigned;yt.toSigned=function(){return this.unsigned?Xe(this.low,this.high,!1):this};yt.toUnsigned=function(){return this.unsigned?this:Xe(this.low,this.high,!0)};yt.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};yt.toBytesLE=function(){var t=this.high,e=this.low;return[e&255,e>>>8&255,e>>>16&255,e>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};yt.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,e>>>24,e>>>16&255,e>>>8&255,e&255]};je.fromBytes=function(t,e,n){return n?je.fromBytesLE(t,e):je.fromBytesBE(t,e)};je.fromBytesLE=function(t,e){return new je(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,e)};je.fromBytesBE=function(t,e){return new je(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],e)}});var N_=Oe(()=>{});var T_=Oe(()=>{});var uE=Oe((lE,pS)=>{(function(r,t,e){function n(a){var u=this,l=i();u.next=function(){var c=2091639*u.s0+u.c*23283064365386963e-26;return u.s0=u.s1,u.s1=u.s2,u.s2=c-(u.c=c|0)},u.c=1,u.s0=l(" "),u.s1=l(" "),u.s2=l(" "),u.s0-=l(a),u.s0<0&&(u.s0+=1),u.s1-=l(a),u.s1<0&&(u.s1+=1),u.s2-=l(a),u.s2<0&&(u.s2+=1),l=null}function o(a,u){return u.c=a.c,u.s0=a.s0,u.s1=a.s1,u.s2=a.s2,u}function s(a,u){var l=new n(a),c=u&&u.state,p=l.next;return p.int32=function(){return l.next()*4294967296|0},p.double=function(){return p()+(p()*2097152|0)*11102230246251565e-32},p.quick=p,c&&(typeof c=="object"&&o(c,l),p.state=function(){return o(l,{})}),p}function i(){var a=4022871197,u=function(l){l=l.toString();for(var c=0;c>>0,p-=a,p*=a,a=p>>>0,p-=a,a+=p*4294967296}return(a>>>0)*23283064365386963e-26};return u}t&&t.exports?t.exports=s:e&&e.amd?e(function(){return s}):this.alea=s})(lE,typeof pS=="object"&&pS,typeof define=="function"&&define)});var pE=Oe((cE,mS)=>{(function(r,t,e){function n(i){var a=this,u="";a.x=0,a.y=0,a.z=0,a.w=0,a.next=function(){var c=a.x^a.x<<11;return a.x=a.y,a.y=a.z,a.z=a.w,a.w^=a.w>>>19^c^c>>>8},i===(i|0)?a.x=i:u+=i;for(var l=0;l>>0)/4294967296};return c.double=function(){do var p=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(p+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,l&&(typeof l=="object"&&o(l,u),c.state=function(){return o(u,{})}),c}t&&t.exports?t.exports=s:e&&e.amd?e(function(){return s}):this.xor128=s})(cE,typeof mS=="object"&&mS,typeof define=="function"&&define)});var fE=Oe((mE,fS)=>{(function(r,t,e){function n(i){var a=this,u="";a.next=function(){var c=a.x^a.x>>>2;return a.x=a.y,a.y=a.z,a.z=a.w,a.w=a.v,(a.d=a.d+362437|0)+(a.v=a.v^a.v<<4^(c^c<<1))|0},a.x=0,a.y=0,a.z=0,a.w=0,a.v=0,i===(i|0)?a.x=i:u+=i;for(var l=0;l>>4),a.next()}function o(i,a){return a.x=i.x,a.y=i.y,a.z=i.z,a.w=i.w,a.v=i.v,a.d=i.d,a}function s(i,a){var u=new n(i),l=a&&a.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var p=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(p+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,l&&(typeof l=="object"&&o(l,u),c.state=function(){return o(u,{})}),c}t&&t.exports?t.exports=s:e&&e.amd?e(function(){return s}):this.xorwow=s})(mE,typeof fS=="object"&&fS,typeof define=="function"&&define)});var hE=Oe((dE,dS)=>{(function(r,t,e){function n(i){var a=this;a.next=function(){var l=a.x,c=a.i,p,m,f;return p=l[c],p^=p>>>7,m=p^p<<24,p=l[c+1&7],m^=p^p>>>10,p=l[c+3&7],m^=p^p>>>3,p=l[c+4&7],m^=p^p<<7,p=l[c+7&7],p=p^p<<13,m^=p^p<<9,l[c]=m,a.i=c+1&7,m};function u(l,c){var p,m,f=[];if(c===(c|0))m=f[0]=c;else for(c=""+c,p=0;p0;--p)l.next()}u(a,i)}function o(i,a){return a.x=i.x.slice(),a.i=i.i,a}function s(i,a){i==null&&(i=+new Date);var u=new n(i),l=a&&a.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var p=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(p+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,l&&(l.x&&o(l,u),c.state=function(){return o(u,{})}),c}t&&t.exports?t.exports=s:e&&e.amd?e(function(){return s}):this.xorshift7=s})(dE,typeof dS=="object"&&dS,typeof define=="function"&&define)});var xE=Oe((gE,hS)=>{(function(r,t,e){function n(i){var a=this;a.next=function(){var l=a.w,c=a.X,p=a.i,m,f;return a.w=l=l+1640531527|0,f=c[p+34&127],m=c[p=p+1&127],f^=f<<13,m^=m<<17,f^=f>>>15,m^=m>>>12,f=c[p]=f^m,a.i=p,f+(l^l>>>16)|0};function u(l,c){var p,m,f,d,h,g=[],y=128;for(c===(c|0)?(m=c,c=null):(c=c+"\0",m=0,y=Math.max(y,c.length)),f=0,d=-32;d>>15,m^=m<<4,m^=m>>>13,d>=0&&(h=h+1640531527|0,p=g[d&127]^=m+h,f=p==0?f+1:0);for(f>=128&&(g[(c&&c.length||0)&127]=-1),f=127,d=4*128;d>0;--d)m=g[f+34&127],p=g[f=f+1&127],m^=m<<13,p^=p<<17,m^=m>>>15,p^=p>>>12,g[f]=m^p;l.w=h,l.X=g,l.i=f}u(a,i)}function o(i,a){return a.i=i.i,a.w=i.w,a.X=i.X.slice(),a}function s(i,a){i==null&&(i=+new Date);var u=new n(i),l=a&&a.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var p=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(p+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,l&&(l.X&&o(l,u),c.state=function(){return o(u,{})}),c}t&&t.exports?t.exports=s:e&&e.amd?e(function(){return s}):this.xor4096=s})(gE,typeof hS=="object"&&hS,typeof define=="function"&&define)});var bE=Oe((yE,gS)=>{(function(r,t,e){function n(i){var a=this,u="";a.next=function(){var c=a.b,p=a.c,m=a.d,f=a.a;return c=c<<25^c>>>7^p,p=p-m|0,m=m<<24^m>>>8^f,f=f-c|0,a.b=c=c<<20^c>>>12^p,a.c=p=p-m|0,a.d=m<<16^p>>>16^f,a.a=f-c|0},a.a=0,a.b=0,a.c=-1640531527,a.d=1367130551,i===Math.floor(i)?(a.a=i/4294967296|0,a.b=i|0):u+=i;for(var l=0;l>>0)/4294967296};return c.double=function(){do var p=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(p+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,l&&(typeof l=="object"&&o(l,u),c.state=function(){return o(u,{})}),c}t&&t.exports?t.exports=s:e&&e.amd?e(function(){return s}):this.tychei=s})(yE,typeof gS=="object"&&gS,typeof define=="function"&&define)});var xS=Oe(()=>{});var wE=Oe((ESt,Hx)=>{(function(r,t){var e=this,n=256,o=6,s=52,i="random",a=t.pow(n,o),u=t.pow(2,s),l=u*2,c=n-1,p;function m(w,v,k){var _=[];v=v==!0?{entropy:!0}:v||{};var $=g(h(v.entropy?[w,b(r)]:w==null?y():w,3),_),D=new f(_),F=function(){for(var P=D.g(o),B=a,U=0;P=l;)P/=2,B/=2,U>>>=1;return(P+U)/B};return F.int32=function(){return D.g(4)|0},F.quick=function(){return D.g(4)/4294967296},F.double=F,g(b(D.S),r),(v.pass||k||function(P,B,U,q){return q&&(q.S&&d(q,D),P.state=function(){return d(D,{})}),U?(t[i]=P,B):P})(F,$,"global"in v?v.global:this==t,v.state)}t["seed"+i]=m;function f(w){var v,k=w.length,_=this,$=0,D=_.i=_.j=0,F=_.S=[];for(k||(w=[k++]);${var uj=uE(),cj=pE(),pj=fE(),mj=hE(),fj=xE(),dj=bE(),lc=wE();lc.alea=uj;lc.xor128=cj;lc.xorwow=pj;lc.xorshift7=mj;lc.xor4096=fj;lc.tychei=dj;vE.exports=lc});var rF=Oe((eF,Tk)=>{(function(r,t,e){function n(a){var u=this,l=i();u.next=function(){var c=2091639*u.s0+u.c*23283064365386963e-26;return u.s0=u.s1,u.s1=u.s2,u.s2=c-(u.c=c|0)},u.c=1,u.s0=l(" "),u.s1=l(" "),u.s2=l(" "),u.s0-=l(a),u.s0<0&&(u.s0+=1),u.s1-=l(a),u.s1<0&&(u.s1+=1),u.s2-=l(a),u.s2<0&&(u.s2+=1),l=null}function o(a,u){return u.c=a.c,u.s0=a.s0,u.s1=a.s1,u.s2=a.s2,u}function s(a,u){var l=new n(a),c=u&&u.state,p=l.next;return p.int32=function(){return l.next()*4294967296|0},p.double=function(){return p()+(p()*2097152|0)*11102230246251565e-32},p.quick=p,c&&(typeof c=="object"&&o(c,l),p.state=function(){return o(l,{})}),p}function i(){var a=4022871197,u=function(l){l=String(l);for(var c=0;c>>0,p-=a,p*=a,a=p>>>0,p-=a,a+=p*4294967296}return(a>>>0)*23283064365386963e-26};return u}t&&t.exports?t.exports=s:e&&e.amd?e(function(){return s}):this.alea=s})(eF,typeof Tk=="object"&&Tk,typeof define=="function"&&define)});var oF=Oe((nF,_k)=>{(function(r,t,e){function n(i){var a=this,u="";a.x=0,a.y=0,a.z=0,a.w=0,a.next=function(){var c=a.x^a.x<<11;return a.x=a.y,a.y=a.z,a.z=a.w,a.w^=a.w>>>19^c^c>>>8},i===(i|0)?a.x=i:u+=i;for(var l=0;l>>0)/4294967296};return c.double=function(){do var p=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(p+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,l&&(typeof l=="object"&&o(l,u),c.state=function(){return o(u,{})}),c}t&&t.exports?t.exports=s:e&&e.amd?e(function(){return s}):this.xor128=s})(nF,typeof _k=="object"&&_k,typeof define=="function"&&define)});var iF=Oe((sF,Ek)=>{(function(r,t,e){function n(i){var a=this,u="";a.next=function(){var c=a.x^a.x>>>2;return a.x=a.y,a.y=a.z,a.z=a.w,a.w=a.v,(a.d=a.d+362437|0)+(a.v=a.v^a.v<<4^(c^c<<1))|0},a.x=0,a.y=0,a.z=0,a.w=0,a.v=0,i===(i|0)?a.x=i:u+=i;for(var l=0;l>>4),a.next()}function o(i,a){return a.x=i.x,a.y=i.y,a.z=i.z,a.w=i.w,a.v=i.v,a.d=i.d,a}function s(i,a){var u=new n(i),l=a&&a.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var p=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(p+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,l&&(typeof l=="object"&&o(l,u),c.state=function(){return o(u,{})}),c}t&&t.exports?t.exports=s:e&&e.amd?e(function(){return s}):this.xorwow=s})(sF,typeof Ek=="object"&&Ek,typeof define=="function"&&define)});var lF=Oe((aF,Ak)=>{(function(r,t,e){function n(i){var a=this;a.next=function(){var l=a.x,c=a.i,p,m,f;return p=l[c],p^=p>>>7,m=p^p<<24,p=l[c+1&7],m^=p^p>>>10,p=l[c+3&7],m^=p^p>>>3,p=l[c+4&7],m^=p^p<<7,p=l[c+7&7],p=p^p<<13,m^=p^p<<9,l[c]=m,a.i=c+1&7,m};function u(l,c){var p,m,f=[];if(c===(c|0))m=f[0]=c;else for(c=""+c,p=0;p0;--p)l.next()}u(a,i)}function o(i,a){return a.x=i.x.slice(),a.i=i.i,a}function s(i,a){i==null&&(i=+new Date);var u=new n(i),l=a&&a.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var p=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(p+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,l&&(l.x&&o(l,u),c.state=function(){return o(u,{})}),c}t&&t.exports?t.exports=s:e&&e.amd?e(function(){return s}):this.xorshift7=s})(aF,typeof Ak=="object"&&Ak,typeof define=="function"&&define)});var cF=Oe((uF,$k)=>{(function(r,t,e){function n(i){var a=this;a.next=function(){var l=a.w,c=a.X,p=a.i,m,f;return a.w=l=l+1640531527|0,f=c[p+34&127],m=c[p=p+1&127],f^=f<<13,m^=m<<17,f^=f>>>15,m^=m>>>12,f=c[p]=f^m,a.i=p,f+(l^l>>>16)|0};function u(l,c){var p,m,f,d,h,g=[],y=128;for(c===(c|0)?(m=c,c=null):(c=c+"\0",m=0,y=Math.max(y,c.length)),f=0,d=-32;d>>15,m^=m<<4,m^=m>>>13,d>=0&&(h=h+1640531527|0,p=g[d&127]^=m+h,f=p==0?f+1:0);for(f>=128&&(g[(c&&c.length||0)&127]=-1),f=127,d=4*128;d>0;--d)m=g[f+34&127],p=g[f=f+1&127],m^=m<<13,p^=p<<17,m^=m>>>15,p^=p>>>12,g[f]=m^p;l.w=h,l.X=g,l.i=f}u(a,i)}function o(i,a){return a.i=i.i,a.w=i.w,a.X=i.X.slice(),a}function s(i,a){i==null&&(i=+new Date);var u=new n(i),l=a&&a.state,c=function(){return(u.next()>>>0)/4294967296};return c.double=function(){do var p=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(p+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,l&&(l.X&&o(l,u),c.state=function(){return o(u,{})}),c}t&&t.exports?t.exports=s:e&&e.amd?e(function(){return s}):this.xor4096=s})(uF,typeof $k=="object"&&$k,typeof define=="function"&&define)});var mF=Oe((pF,Dk)=>{(function(r,t,e){function n(i){var a=this,u="";a.next=function(){var c=a.b,p=a.c,m=a.d,f=a.a;return c=c<<25^c>>>7^p,p=p-m|0,m=m<<24^m>>>8^f,f=f-c|0,a.b=c=c<<20^c>>>12^p,a.c=p=p-m|0,a.d=m<<16^p>>>16^f,a.a=f-c|0},a.a=0,a.b=0,a.c=-1640531527,a.d=1367130551,i===Math.floor(i)?(a.a=i/4294967296|0,a.b=i|0):u+=i;for(var l=0;l>>0)/4294967296};return c.double=function(){do var p=u.next()>>>11,m=(u.next()>>>0)/4294967296,f=(p+m)/(1<<21);while(f===0);return f},c.int32=u.next,c.quick=c,l&&(typeof l=="object"&&o(l,u),c.state=function(){return o(u,{})}),c}t&&t.exports?t.exports=s:e&&e.amd?e(function(){return s}):this.tychei=s})(pF,typeof Dk=="object"&&Dk,typeof define=="function"&&define)});var dF=Oe((fF,Rb)=>{(function(r,t,e){var n=256,o=6,s=52,i="random",a=e.pow(n,o),u=e.pow(2,s),l=u*2,c=n-1,p;function m(w,v,k){var _=[];v=v==!0?{entropy:!0}:v||{};var $=g(h(v.entropy?[w,b(t)]:w==null?y():w,3),_),D=new f(_),F=function(){for(var P=D.g(o),B=a,U=0;P=l;)P/=2,B/=2,U>>>=1;return(P+U)/B};return F.int32=function(){return D.g(4)|0},F.quick=function(){return D.g(4)/4294967296},F.double=F,g(b(D.S),t),(v.pass||k||function(P,B,U,q){return q&&(q.S&&d(q,D),P.state=function(){return d(D,{})}),U?(e[i]=P,B):P})(F,$,"global"in v?v.global:this==e,v.state)}function f(w){var v,k=w.length,_=this,$=0,D=_.i=_.j=0,F=_.S=[];for(k||(w=[k++]);${var AZ=rF(),$Z=oF(),DZ=iF(),FZ=lF(),RZ=cF(),OZ=mF(),Uc=dF();Uc.alea=AZ;Uc.xor128=$Z;Uc.xorwow=DZ;Uc.xorshift7=FZ;Uc.xor4096=RZ;Uc.tychei=OZ;hF.exports=Uc});var Rk=Oe(()=>{});var Ub=Oe(()=>{});var Og=Oe(()=>{});var kW=Oe(()=>{});var NW=Oe(()=>{});var TW=Oe(()=>{});var _W=Oe((i0,JT)=>{var ZT=(()=>{var r=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename!="undefined"&&(r=r||__filename),function(t){t=t||{};function e(){return Ot.buffer!=gr&&Wo(Ot.buffer),fp}function n(){return Ot.buffer!=gr&&Wo(Ot.buffer),dp}function o(){return Ot.buffer!=gr&&Wo(Ot.buffer),Ad}function s(){return Ot.buffer!=gr&&Wo(Ot.buffer),Bg}function i(){return Ot.buffer!=gr&&Wo(Ot.buffer),Vg}function a(){return Ot.buffer!=gr&&Wo(Ot.buffer),Gg}function u(){return Ot.buffer!=gr&&Wo(Ot.buffer),Wg}var l=typeof t!="undefined"?t:{},c,p;l.ready=new Promise(function(T,O){c=T,p=O});var m;typeof process!="undefined"&&process.listeners&&(m={uncaughtException:process.listeners("uncaughtException"),unhandledRejection:process.listeners("unhandledRejection")});var f=Object.assign({},l),d=[],h="./this.program",g=(T,O)=>{throw O},y=typeof window=="object",b=typeof importScripts=="function",w=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",v=l.ENVIRONMENT_IS_PTHREAD||!1,k="";function _(T){return l.locateFile?l.locateFile(T,k):k+T}var $,D,F,P;function B(T){if(T instanceof Bd)return;X("exiting due to exception: "+T)}var U,q,j;if(w){b?k=Og().dirname(k)+"/":k=__dirname+"/",j=()=>{q||(U=Ub(),q=Og())},$=function(W,Y){return j(),W=q.normalize(W),U.readFileSync(W,Y?void 0:"utf8")},F=O=>{var W=$(O,!0);return W.buffer||(W=new Uint8Array(W)),W},D=(O,W,Y)=>{j(),O=q.normalize(O),U.readFile(O,function(ht,wt){ht?Y(ht):W(wt.buffer)})},process.argv.length>1&&(h=process.argv[1].replace(/\\/g,"/")),d=process.argv.slice(2),process.on("uncaughtException",function(O){if(!(O instanceof Bd))throw O}),process.on("unhandledRejection",function(O){throw O}),g=(O,W)=>{if($u())throw process.exitCode=O,W;B(W),process.exit(O)},l.inspect=function(){return"[Emscripten Module object]"};let T;try{T=kW()}catch(O){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),O}global.Worker=T.Worker}else(y||b)&&(b?k=self.location.href:typeof document!="undefined"&&document.currentScript&&(k=document.currentScript.src),typeof r!="undefined"&&r&&(k=r),k.indexOf("blob:")!==0?k=k.substr(0,k.replace(/[?#].*/,"").lastIndexOf("/")+1):k="",w||($=T=>{var O=new XMLHttpRequest;return O.open("GET",T,!1),O.send(null),O.responseText},b&&(F=T=>{var O=new XMLHttpRequest;return O.open("GET",T,!1),O.responseType="arraybuffer",O.send(null),new Uint8Array(O.response)}),D=(T,O,W)=>{var Y=new XMLHttpRequest;Y.open("GET",T,!0),Y.responseType="arraybuffer",Y.onload=()=>{if(Y.status==200||Y.status==0&&Y.response){O(Y.response);return}W()},Y.onerror=W,Y.send(null)}),P=T=>document.title=T);w&&typeof performance=="undefined"&&(global.performance=NW().performance);var K=console.log.bind(console),Q=console.warn.bind(console);w&&(j(),K=T=>U.writeSync(1,T+` `),Q=T=>U.writeSync(2,T+` `));var rt=l.print||K,X=l.printErr||Q;Object.assign(l,f),f=null,l.arguments&&(d=l.arguments),l.thisProgram&&(h=l.thisProgram),l.quit&&(g=l.quit);var nt=4;function st(T){st.shown||(st.shown={}),st.shown[T]||(st.shown[T]=1,X(T))}function it(T,O){if(typeof WebAssembly.Function=="function"){for(var W={i:"i32",j:"i64",f:"f32",d:"f64"},Y={parameters:[],results:O[0]=="v"?[]:[W[O[0]]]},ht=1;ht{bt=T},At=Atomics.load,Dt=Atomics.store,Kt=Atomics.compareExchange,jt;l.wasmBinary&&(jt=l.wasmBinary);var ce=l.noExitRuntime||!0;typeof WebAssembly!="object"&&gp("no native wasm support detected");var Ot,$e,ke=!1,ae;function Ke(T,O){T||gp(O)}function Re(T){var O=l["_"+T];return O}function rn(T,O,W,Y,ht){var wt={string:function(Mn){var Np=0;if(Mn!=null&&Mn!==0){var S1=(Mn.length<<2)+1;Np=kp(S1),On(Mn,Np,S1)}return Np},array:function(Mn){var Np=kp(Mn.length);return Al(Mn,Np),Np}};function Tt(Mn){return O==="string"?jr(Mn):O==="boolean"?Boolean(Mn):Mn}var Gt=Re(T),sr=[],Ko=0;if(Y)for(var jo=0;jo(W.buffer instanceof SharedArrayBuffer&&(W=new Uint8Array(W)),O.decode.call(O,W))}var nn=typeof TextDecoder!="undefined"?new Rr("utf8"):void 0;function on(T,O,W){for(var Y=O+W,ht=O;T[ht]&&!(ht>=Y);)++ht;if(ht-O>16&&T.subarray&&nn)return nn.decode(T.subarray(O,ht));for(var wt="";O>10,56320|Ko&1023)}}return wt}function jr(T,O){return T?on(n(),T,O):""}function so(T,O,W,Y){if(!(Y>0))return 0;for(var ht=W,wt=W+Y-1,Tt=0;Tt=55296&&Gt<=57343){var sr=T.charCodeAt(++Tt);Gt=65536+((Gt&1023)<<10)|sr&1023}if(Gt<=127){if(W>=wt)break;O[W++]=Gt}else if(Gt<=2047){if(W+1>=wt)break;O[W++]=192|Gt>>6,O[W++]=128|Gt&63}else if(Gt<=65535){if(W+2>=wt)break;O[W++]=224|Gt>>12,O[W++]=128|Gt>>6&63,O[W++]=128|Gt&63}else{if(W+3>=wt)break;O[W++]=240|Gt>>18,O[W++]=128|Gt>>12&63,O[W++]=128|Gt>>6&63,O[W++]=128|Gt&63}}return O[W]=0,W-ht}function On(T,O,W){return so(T,n(),O,W)}function Go(T){for(var O=0,W=0;W=55296&&Y<=57343&&(Y=65536+((Y&1023)<<10)|T.charCodeAt(++W)&1023),Y<=127?++O:Y<=2047?O+=2:Y<=65535?O+=3:O+=4}return O}var io=typeof TextDecoder!="undefined"?new Rr("utf-16le"):void 0;function Al(T,O){e().set(T,O)}function Eu(T,O,W){for(var Y=0;Y>0]=T.charCodeAt(Y);W||(e()[O>>0]=0)}function mp(T,O){return T%O>0&&(T+=O-T%O),T}var gr,fp,dp,Ad,Bg,Vg,o1,Gg,Wg;v&&(gr=l.buffer);function Wo(T){gr=T,l.HEAP8=fp=new Int8Array(T),l.HEAP16=Ad=new Int16Array(T),l.HEAP32=Vg=new Int32Array(T),l.HEAPU8=dp=new Uint8Array(T),l.HEAPU16=Bg=new Uint16Array(T),l.HEAPU32=o1=new Uint32Array(T),l.HEAPF32=Gg=new Float32Array(T),l.HEAPF64=Wg=new Float64Array(T)}var Ug=l.INITIAL_MEMORY||16777216;if(v)Ot=l.wasmMemory,gr=l.buffer;else if(l.wasmMemory)Ot=l.wasmMemory;else if(Ot=new WebAssembly.Memory({initial:Ug/65536,maximum:32768,shared:!0}),!(Ot.buffer instanceof SharedArrayBuffer))throw X("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),w&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");Ot&&(gr=Ot.buffer),Ug=gr.byteLength,Wo(gr);var qn,hp=[],$l=[],u0=[],Hg=[],Au=!1,c0=!1,qg=0;function $u(){return ce||qg>0}function sn(){if(l.preRun)for(typeof l.preRun=="function"&&(l.preRun=[l.preRun]);l.preRun.length;)s1(l.preRun.shift());Yg(hp)}function $d(){Au=!0,!v&&Yg($l)}function p0(){v||(Ut.terminateAllThreads(),c0=!0)}function m0(){if(!v){if(l.postRun)for(typeof l.postRun=="function"&&(l.postRun=[l.postRun]);l.postRun.length;)Dd(l.postRun.shift());Yg(Hg)}}function s1(T){hp.unshift(T)}function i1(T){$l.unshift(T)}function Dd(T){Hg.unshift(T)}var Dl=0,Kg=null,Uo=null;function Fd(T){Dl++,l.monitorRunDependencies&&l.monitorRunDependencies(Dl)}function a1(T){if(Dl--,l.monitorRunDependencies&&l.monitorRunDependencies(Dl),Dl==0&&(Kg!==null&&(clearInterval(Kg),Kg=null),Uo)){var O=Uo;Uo=null,O()}}l.preloadedImages={},l.preloadedAudios={};function gp(T){v?postMessage({cmd:"onAbort",arg:T}):l.onAbort&&l.onAbort(T),T="Aborted("+T+")",X(T),ke=!0,ae=1,T+=". Build with -s ASSERTIONS=1 for more info.";var O=new WebAssembly.RuntimeError(T);throw p(O),O}var f0="data:application/octet-stream;base64,";function Rd(T){return T.startsWith(f0)}function jg(T){return T.startsWith("file://")}var an;an="tfjs-backend-wasm-threaded-simd.wasm",Rd(an)||(an=_(an));function Xg(T){try{if(T==an&&jt)return new Uint8Array(jt);if(F)return F(T);throw"both async and sync fetching of the wasm failed"}catch(O){gp(O)}}function xp(){if(!jt&&(y||b)){if(typeof fetch=="function"&&!jg(an))return fetch(an,{credentials:"same-origin"}).then(function(T){if(!T.ok)throw"failed to load wasm binary file at '"+an+"'";return T.arrayBuffer()}).catch(function(){return Xg(an)});if(D)return new Promise(function(T,O){D(an,function(W){T(new Uint8Array(W))},O)})}return Promise.resolve().then(function(){return Xg(an)})}function d0(){var T={env:lx,wasi_snapshot_preview1:lx};function O(Tt,Gt){var sr=Tt.exports;if(l.asm=sr,v0(l.asm.emscripten_tls_init),qn=l.asm.__indirect_function_table,i1(l.asm.__wasm_call_ctors),$e=Gt,!v){var Ko=Ut.unusedWorkers.length;Ut.unusedWorkers.forEach(function(jo){Ut.loadWasmModuleToWorker(jo,function(){--Ko||a1("wasm-instantiate")})})}}v||Fd("wasm-instantiate");function W(Tt){O(Tt.instance,Tt.module)}function Y(Tt){return xp().then(function(Gt){return WebAssembly.instantiate(Gt,T)}).then(function(Gt){return Gt}).then(Tt,function(Gt){X("failed to asynchronously prepare wasm: "+Gt),gp(Gt)})}function ht(){return!jt&&typeof WebAssembly.instantiateStreaming=="function"&&!Rd(an)&&!jg(an)&&typeof fetch=="function"?fetch(an,{credentials:"same-origin"}).then(function(Tt){var Gt=WebAssembly.instantiateStreaming(Tt,T);return Gt.then(W,function(sr){return X("wasm streaming compile failed: "+sr),X("falling back to ArrayBuffer instantiation"),Y(W)})}):Y(W)}if(l.instantiateWasm)try{var wt=l.instantiateWasm(T,O);return wt}catch(Tt){return X("Module.instantiateWasm callback failed with error: "+Tt),!1}return ht().catch(p),{}}var l1,u1,h0={};function Yg(T){for(;T.length>0;){var O=T.shift();if(typeof O=="function"){O(l);continue}var W=O.func;typeof W=="number"?O.arg===void 0?bp(W)():bp(W)(O.arg):W(O.arg===void 0?null:O.arg)}}function yp(T){var O=LC(),W=T();return fx(O),W}function OW(T){return T}function c1(T){var O=/\b_Z[\w\d_]+/g;return T.replace(O,function(W){var Y=W;return W===Y?W:Y+" ["+W+"]"})}function g0(T){i()[T>>2]=0;var O=Ut.pthreads[T];delete Ut.pthreads[T],O.worker.terminate(),PC(T),Ut.runningWorkers.splice(Ut.runningWorkers.indexOf(O.worker),1),O.worker.pthread=void 0}function x0(T){var O=Ut.pthreads[T];O.worker.postMessage({cmd:"cancel"})}function Zg(T){var O=Ut.pthreads[T];if(O){i()[T>>2]=0;var W=O.worker;Ut.returnWorkerToPool(W)}}function Jg(T){SU(T)}function y0(T){if(T instanceof Bd||T=="unwind")return ae;g(1,T)}var Ut={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],init:function(){v?Ut.initWorker():Ut.initMainThread()},initMainThread:function(){for(var T=8,O=0;O>2]=0;try{T()}finally{i()[I1>>2]=1}},receiveObjectTransfer:function(T){},threadInit:function(){for(var T in Ut.tlsInitFunctions)Ut.tlsInitFunctions[T]()},loadWasmModuleToWorker:function(T,O){T.onmessage=W=>{var Y=W.data,ht=Y.cmd;if(T.pthread&&(Ut.currentProxiedOperationCallerThread=T.pthread.threadInfoStruct),Y.targetThread&&Y.targetThread!=mx()){var wt=Ut.pthreads[Y.targetThread];wt?wt.worker.postMessage(Y,Y.transferList):X('Internal error! Worker sent a message "'+ht+'" to target pthread '+Y.targetThread+", but that thread no longer exists!"),Ut.currentProxiedOperationCallerThread=void 0;return}ht==="processQueuedMainThreadWork"?y1():ht==="spawnThread"?tx(Y):ht==="cleanupThread"?Zg(Y.thread):ht==="killThread"?g0(Y.thread):ht==="cancelThread"?x0(Y.thread):ht==="loaded"?(T.loaded=!0,O&&O(T),T.runPthread&&(T.runPthread(),delete T.runPthread)):ht==="print"?rt("Thread "+Y.threadId+": "+Y.text):ht==="printErr"?X("Thread "+Y.threadId+": "+Y.text):ht==="alert"?alert("Thread "+Y.threadId+": "+Y.text):Y.target==="setimmediate"?T.postMessage(Y):ht==="onAbort"?l.onAbort&&l.onAbort(Y.arg):X("worker sent an unknown command "+ht),Ut.currentProxiedOperationCallerThread=void 0},T.onerror=W=>{var Y="worker sent an error!";throw X(Y+" "+W.filename+":"+W.lineno+": "+W.message),W},w&&(T.on("message",function(W){T.onmessage({data:W})}),T.on("error",function(W){T.onerror(W)}),T.on("detachedExit",function(){})),T.postMessage({cmd:"load",urlOrBlob:l.mainScriptUrlOrBlob||r,wasmMemory:Ot,wasmModule:$e})},allocateUnusedWorker:function(){var T=_("tfjs-backend-wasm-threaded-simd.worker.js");Ut.unusedWorkers.push(new Worker(T))},getNewWorker:function(){return Ut.unusedWorkers.length==0&&(Ut.allocateUnusedWorker(),Ut.loadWasmModuleToWorker(Ut.unusedWorkers[0])),Ut.unusedWorkers.pop()}};function b0(){var T=mx(),O=i()[T+44>>2],W=i()[T+48>>2],Y=O-W;C1(O,Y),fx(O)}l.establishStackSpace=b0;function Qg(T){if(v)return Ru(1,0,T);try{Jg(T)}catch(O){y0(O)}}var Du=[];function bp(T){var O=Du[T];return O||(T>=Du.length&&(Du.length=T+1),Du[T]=O=qn.get(T)),O}function w0(T,O){return bp(T)(O)}l.invokeEntryPoint=w0;function p1(){var T=new Error;if(!T.stack){try{throw new Error}catch(O){T=O}if(!T.stack)return"(no stack trace available)"}return T.stack.toString()}function v0(T,O,W){Ut.tlsInitFunctions.push(T)}function m1(T,O){qn.set(T,O),Du[T]=O}var Fu;w?Fu=()=>{var T=process.hrtime();return T[0]*1e3+T[1]/1e6}:v?Fu=()=>performance.now()-l.__performance_now_clock_drift:Fu=()=>performance.now();var C0=!0;function I0(T){return i()[x1()>>2]=T,T}function S0(T,O){var W;if(T===0)W=Date.now();else if((T===1||T===4)&&C0)W=Fu();else return I0(28),-1;return i()[O>>2]=W/1e3|0,i()[O+4>>2]=W%1e3*1e3*1e3|0,0}function k0(T,O){return S0(T,O)}function N0(T){b1(T,!b,1,!y),Ut.threadInit()}function T0(T){v?postMessage({cmd:"cleanupThread",thread:T}):Zg(T)}function tx(T){var O=Ut.getNewWorker();if(!O)return 6;Ut.runningWorkers.push(O);var W=Ut.pthreads[T.pthread_ptr]={worker:O,threadInfoStruct:T.pthread_ptr};O.pthread=W;var Y={cmd:"run",start_routine:T.startRoutine,arg:T.arg,threadInfoStruct:T.pthread_ptr};return O.runPthread=()=>{Y.time=performance.now(),O.postMessage(Y,T.transferList)},O.loaded&&(O.runPthread(),delete O.runPthread),0}function _0(T,O,W,Y){if(typeof SharedArrayBuffer=="undefined")return X("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var ht=[],wt=0;if(v&&(ht.length===0||wt))return w1(687865856,T,O,W,Y);if(wt)return wt;var Tt={startRoutine:W,pthread_ptr:T,arg:Y,transferList:ht};return v?(Tt.cmd="spawnThread",postMessage(Tt,ht),0):tx(Tt)}function E0(){return 2097152}function A0(T,O){if(T==O)postMessage({cmd:"processQueuedMainThreadWork"});else if(v)postMessage({targetThread:T,cmd:"processThreadQueue"});else{var W=Ut.pthreads[T],Y=W&&W.worker;if(!Y)return;Y.postMessage({cmd:"processThreadQueue"})}return 1}function $0(){gp("")}function D0(){w||b||st("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread")}function ex(){return 2147483648}function F0(T,O,W){n().copyWithin(T,O,O+W)}function R0(){return w?TW().cpus().length:navigator.hardwareConcurrency}function Ru(T,O){var W=arguments.length-2,Y=arguments;return yp(function(){for(var ht=W,wt=kp(ht*8),Tt=wt>>3,Gt=0;Gt>3,ht=0;ht>>16),Wo(Ot.buffer),1}catch(O){}}function P0(T){var O=n().length;if(T=T>>>0,T<=O)return!1;var W=ex();if(T>W)return!1;for(var Y=1;Y<=4;Y*=2){var ht=O*(1+.2/Y);ht=Math.min(ht,T+100663296);var wt=Math.min(W,mp(Math.max(T,ht),65536)),Tt=M0(wt);if(Tt)return!0}return!1}var ne={inEventHandler:0,removeAllEventListeners:function(){for(var T=ne.eventHandlers.length-1;T>=0;--T)ne._removeHandler(T);ne.eventHandlers=[],ne.deferredCalls=[]},registerRemoveEventListeners:function(){ne.removeEventListenersRegistered||(u0.push(ne.removeAllEventListeners),ne.removeEventListenersRegistered=!0)},deferredCalls:[],deferCall:function(T,O,W){function Y(Tt,Gt){if(Tt.length!=Gt.length)return!1;for(var sr in Tt)if(Tt[sr]!=Gt[sr])return!1;return!0}for(var ht in ne.deferredCalls){var wt=ne.deferredCalls[ht];if(wt.targetFunction==T&&Y(wt.argsList,W))return}ne.deferredCalls.push({targetFunction:T,precedence:O,argsList:W}),ne.deferredCalls.sort(function(Tt,Gt){return Tt.precedence>2]=W,i()[wt+4>>2]=Y,i()[wt+8>>2]=ht,MC(T,637534208,O,Y,wt)})},getTargetThreadForEventCallback:function(T){switch(T){case 1:return 0;case 2:return Ut.currentProxiedOperationCallerThread;default:return T}},getNodeNameForTarget:function(T){return T?T==window?"#window":T==screen?"#screen":T&&T.nodeName?T.nodeName:"":""},fullscreenEnabled:function(){return document.fullscreenEnabled||document.webkitFullscreenEnabled}};function L0(T){var O=Go(T)+1,W=OC(O);return On(T,W,O),W}function z0(T,O,W,Y){yp(function(){var ht=kp(12),wt=0;O&&(wt=L0(O)),i()[ht>>2]=wt,i()[ht+4>>2]=W,i()[ht+8>>2]=Y,MC(T,657457152,0,wt,ht)})}function B0(T,O,W,Y){O=O?jr(O):"",z0(T,O,W,Y)}function V0(T){return T>2?jr(T):T}var G0=[0,typeof document!="undefined"?document:0,typeof window!="undefined"?window:0];function W0(T){T=V0(T);var O=G0[T]||(typeof document!="undefined"?document.querySelector(T):void 0);return O}function Md(T){return W0(T)}function rx(T,O,W){var Y=Md(T);if(!Y)return-4;if(Y.canvasSharedPtr&&(i()[Y.canvasSharedPtr>>2]=O,i()[Y.canvasSharedPtr+4>>2]=W),Y.offscreenCanvas||!Y.controlTransferredOffscreen){Y.offscreenCanvas&&(Y=Y.offscreenCanvas);var ht=!1;if(Y.GLctxObject&&Y.GLctxObject.GLctx){var wt=Y.GLctxObject.GLctx.getParameter(2978);ht=wt[0]===0&&wt[1]===0&&wt[2]===Y.width&&wt[3]===Y.height}Y.width=O,Y.height=W,ht&&Y.GLctxObject.GLctx.viewport(0,0,O,W)}else if(Y.canvasSharedPtr){var Tt=i()[Y.canvasSharedPtr+8>>2];return B0(Tt,T,O,W),1}else return-4;return 0}function nx(T,O,W){return v?Ru(2,1,T,O,W):rx(T,O,W)}function U0(T,O,W){var Y=Md(T);return Y?rx(T,O,W):nx(T,O,W)}function H0(){throw"unwind"}function q0(T){var O=T.getExtension("ANGLE_instanced_arrays");if(O)return T.vertexAttribDivisor=function(W,Y){O.vertexAttribDivisorANGLE(W,Y)},T.drawArraysInstanced=function(W,Y,ht,wt){O.drawArraysInstancedANGLE(W,Y,ht,wt)},T.drawElementsInstanced=function(W,Y,ht,wt,Tt){O.drawElementsInstancedANGLE(W,Y,ht,wt,Tt)},1}function K0(T){var O=T.getExtension("OES_vertex_array_object");if(O)return T.createVertexArray=function(){return O.createVertexArrayOES()},T.deleteVertexArray=function(W){O.deleteVertexArrayOES(W)},T.bindVertexArray=function(W){O.bindVertexArrayOES(W)},T.isVertexArray=function(W){return O.isVertexArrayOES(W)},1}function j0(T){var O=T.getExtension("WEBGL_draw_buffers");if(O)return T.drawBuffers=function(W,Y){O.drawBuffersWEBGL(W,Y)},1}function X0(T){return!!(T.multiDrawWebgl=T.getExtension("WEBGL_multi_draw"))}var or={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:{},offscreenCanvases:{},queries:[],stringCache:{},unpackAlignment:4,recordError:function(O){or.lastError||(or.lastError=O)},getNewId:function(T){for(var O=or.counter++,W=T.length;W>2]:-1;ht+=jr(i()[W+wt*4>>2],Tt<0?void 0:Tt)}return ht},createContext:function(T,O){T.getContextSafariWebGL2Fixed||(T.getContextSafariWebGL2Fixed=T.getContext,T.getContext=function(ht,wt){var Tt=T.getContextSafariWebGL2Fixed(ht,wt);return ht=="webgl"==Tt instanceof WebGLRenderingContext?Tt:null});var W=T.getContext("webgl",O);if(!W)return 0;var Y=or.registerContext(W,O);return Y},registerContext:function(T,O){var W=OC(8);i()[W+4>>2]=mx();var Y={handle:W,attributes:O,version:O.majorVersion,GLctx:T};return T.canvas&&(T.canvas.GLctxObject=Y),or.contexts[W]=Y,(typeof O.enableExtensionsByDefault=="undefined"||O.enableExtensionsByDefault)&&or.initExtensions(Y),W},makeContextCurrent:function(T){return or.currentContext=or.contexts[T],l.ctx=ax=or.currentContext&&or.currentContext.GLctx,!(T&&!ax)},getContext:function(T){return or.contexts[T]},deleteContext:function(T){or.currentContext===or.contexts[T]&&(or.currentContext=null),typeof ne=="object"&&ne.removeAllHandlersOnTarget(or.contexts[T].GLctx.canvas),or.contexts[T]&&or.contexts[T].GLctx.canvas&&(or.contexts[T].GLctx.canvas.GLctxObject=void 0),g1(or.contexts[T].handle),or.contexts[T]=null},initExtensions:function(T){if(T||(T=or.currentContext),!T.initExtensionsDone){T.initExtensionsDone=!0;var O=T.GLctx;q0(O),K0(O),j0(O),O.disjointTimerQueryExt=O.getExtension("EXT_disjoint_timer_query"),X0(O);var W=O.getSupportedExtensions()||[];W.forEach(function(Y){!Y.includes("lose_context")&&!Y.includes("debug")&&O.getExtension(Y)})}}},Y0=["default","low-power","high-performance"];function Z0(T,O){var W=O>>2,Y=i()[W+6],ht={alpha:!!i()[W+0],depth:!!i()[W+1],stencil:!!i()[W+2],antialias:!!i()[W+3],premultipliedAlpha:!!i()[W+4],preserveDrawingBuffer:!!i()[W+5],powerPreference:Y0[Y],failIfMajorPerformanceCaveat:!!i()[W+7],majorVersion:i()[W+8],minorVersion:i()[W+9],enableExtensionsByDefault:i()[W+10],explicitSwapControl:i()[W+11],proxyContextToMainThread:i()[W+12],renderViaOffscreenBackBuffer:i()[W+13]},wt=Md(T);if(!wt||ht.explicitSwapControl)return 0;var Tt=or.createContext(wt,ht);return Tt}function J0(T,O){return Z0(T,O)}var wp={mappings:{},buffers:[null,[],[]],printChar:function(T,O){var W=wp.buffers[T];O===0||O===10?((T===1?rt:X)(on(W,0)),W.length=0):W.push(O)},varargs:void 0,get:function(){wp.varargs+=4;var T=i()[wp.varargs-4>>2];return T},getStr:function(T){var O=jr(T);return O},get64:function(T,O){return T}};function ox(T){return v?Ru(3,1,T):0}function sx(T,O,W,Y,ht){if(v)return Ru(4,1,T,O,W,Y,ht)}function ix(T,O,W,Y){if(v)return Ru(5,1,T,O,W,Y);for(var ht=0,wt=0;wt>2],Gt=i()[O+4>>2];O+=8;for(var sr=0;sr>2]=ht,0}function Q0(T){kt(T)}Ut.init();var ax,tC=[null,Qg,nx,ox,sx,ix],f1=!1,lx={__clock_gettime:k0,__emscripten_init_main_thread_js:N0,__emscripten_thread_cleanup:T0,__pthread_create_js:_0,_emscripten_default_pthread_stack_size:E0,_emscripten_notify_thread_queue:A0,abort:$0,emscripten_check_blocking_allowed:D0,emscripten_get_heap_max:ex,emscripten_get_now:Fu,emscripten_memcpy_big:F0,emscripten_num_logical_cores:R0,emscripten_receive_on_main_thread_js:O0,emscripten_resize_heap:P0,emscripten_set_canvas_element_size:U0,emscripten_unwind_to_js_event_loop:H0,emscripten_webgl_create_context:J0,exit:Jg,fd_close:ox,fd_seek:sx,fd_write:ix,memory:Ot||l.wasmMemory,setTempRet0:Q0},d1=d0(),eC=l.___wasm_call_ctors=function(){return(eC=l.___wasm_call_ctors=l.asm.__wasm_call_ctors).apply(null,arguments)},rC=l._init=function(){return(rC=l._init=l.asm.init).apply(null,arguments)},nC=l._init_with_threads_count=function(){return(nC=l._init_with_threads_count=l.asm.init_with_threads_count).apply(null,arguments)},oC=l._get_threads_count=function(){return(oC=l._get_threads_count=l.asm.get_threads_count).apply(null,arguments)},sC=l._register_tensor=function(){return(sC=l._register_tensor=l.asm.register_tensor).apply(null,arguments)},iC=l._dispose_data=function(){return(iC=l._dispose_data=l.asm.dispose_data).apply(null,arguments)},aC=l._dispose=function(){return(aC=l._dispose=l.asm.dispose).apply(null,arguments)},lC=l._Abs=function(){return(lC=l._Abs=l.asm.Abs).apply(null,arguments)},uC=l._Add=function(){return(uC=l._Add=l.asm.Add).apply(null,arguments)},cC=l._AddN=function(){return(cC=l._AddN=l.asm.AddN).apply(null,arguments)},pC=l._All=function(){return(pC=l._All=l.asm.All).apply(null,arguments)},mC=l._Any=function(){return(mC=l._Any=l.asm.Any).apply(null,arguments)},fC=l._ArgMax=function(){return(fC=l._ArgMax=l.asm.ArgMax).apply(null,arguments)},dC=l._AvgPool=function(){return(dC=l._AvgPool=l.asm.AvgPool).apply(null,arguments)},hC=l._BatchMatMul=function(){return(hC=l._BatchMatMul=l.asm.BatchMatMul).apply(null,arguments)},gC=l._Ceil=function(){return(gC=l._Ceil=l.asm.Ceil).apply(null,arguments)},xC=l._ClipByValue=function(){return(xC=l._ClipByValue=l.asm.ClipByValue).apply(null,arguments)},yC=l._Conv2D=function(){return(yC=l._Conv2D=l.asm.Conv2D).apply(null,arguments)},bC=l._Conv2DBackpropInput=function(){return(bC=l._Conv2DBackpropInput=l.asm.Conv2DBackpropInput).apply(null,arguments)},wC=l._Cos=function(){return(wC=l._Cos=l.asm.Cos).apply(null,arguments)},vC=l._Cosh=function(){return(vC=l._Cosh=l.asm.Cosh).apply(null,arguments)},CC=l._CropAndResize=function(){return(CC=l._CropAndResize=l.asm.CropAndResize).apply(null,arguments)},IC=l._Cumprod=function(){return(IC=l._Cumprod=l.asm.Cumprod).apply(null,arguments)},SC=l._Cumsum=function(){return(SC=l._Cumsum=l.asm.Cumsum).apply(null,arguments)},kC=l._DepthToSpace=function(){return(kC=l._DepthToSpace=l.asm.DepthToSpace).apply(null,arguments)},NC=l._DepthwiseConv2dNative=function(){return(NC=l._DepthwiseConv2dNative=l.asm.DepthwiseConv2dNative).apply(null,arguments)},TC=l._Elu=function(){return(TC=l._Elu=l.asm.Elu).apply(null,arguments)},_C=l._Equal=function(){return(_C=l._Equal=l.asm.Equal).apply(null,arguments)},EC=l._Exp=function(){return(EC=l._Exp=l.asm.Exp).apply(null,arguments)},AC=l._FlipLeftRight=function(){return(AC=l._FlipLeftRight=l.asm.FlipLeftRight).apply(null,arguments)},ux=l._Floor=function(){return(ux=l._Floor=l.asm.Floor).apply(null,arguments)},cx=l._FloorDiv=function(){return(cx=l._FloorDiv=l.asm.FloorDiv).apply(null,arguments)},Pd=l._FusedBatchNorm=function(){return(Pd=l._FusedBatchNorm=l.asm.FusedBatchNorm).apply(null,arguments)},$C=l._FusedConv2D=function(){return($C=l._FusedConv2D=l.asm.FusedConv2D).apply(null,arguments)},DC=l._FusedDepthwiseConv2D=function(){return(DC=l._FusedDepthwiseConv2D=l.asm.FusedDepthwiseConv2D).apply(null,arguments)},vp=l._Gather=function(){return(vp=l._Gather=l.asm.Gather).apply(null,arguments)},Ld=l._GatherNd=function(){return(Ld=l._GatherNd=l.asm.GatherNd).apply(null,arguments)},zd=l._Greater=function(){return(zd=l._Greater=l.asm.Greater).apply(null,arguments)},h1=l._GreaterEqual=function(){return(h1=l._GreaterEqual=l.asm.GreaterEqual).apply(null,arguments)},Cp=l._LeakyRelu=function(){return(Cp=l._LeakyRelu=l.asm.LeakyRelu).apply(null,arguments)},Ip=l._Less=function(){return(Ip=l._Less=l.asm.Less).apply(null,arguments)},FC=l._LessEqual=function(){return(FC=l._LessEqual=l.asm.LessEqual).apply(null,arguments)},H=l._Log=function(){return(H=l._Log=l.asm.Log).apply(null,arguments)},tt=l._LogicalAnd=function(){return(tt=l._LogicalAnd=l.asm.LogicalAnd).apply(null,arguments)},gt=l._Max=function(){return(gt=l._Max=l.asm.Max).apply(null,arguments)},$t=l._MaxPool=function(){return($t=l._MaxPool=l.asm.MaxPool).apply(null,arguments)},de=l._Maximum=function(){return(de=l._Maximum=l.asm.Maximum).apply(null,arguments)},ge=l._Mean=function(){return(ge=l._Mean=l.asm.Mean).apply(null,arguments)},oe=l._Min=function(){return(oe=l._Min=l.asm.Min).apply(null,arguments)},ee=l._Minimum=function(){return(ee=l._Minimum=l.asm.Minimum).apply(null,arguments)},xr=l._MirrorPad=function(){return(xr=l._MirrorPad=l.asm.MirrorPad).apply(null,arguments)},Ho=l._Multiply=function(){return(Ho=l._Multiply=l.asm.Multiply).apply(null,arguments)},qo=l._Neg=function(){return(qo=l._Neg=l.asm.Neg).apply(null,arguments)},Sp=l._NonMaxSuppressionV3=function(){return(Sp=l._NonMaxSuppressionV3=l.asm.NonMaxSuppressionV3).apply(null,arguments)},Ou=l._NonMaxSuppressionV4=function(){return(Ou=l._NonMaxSuppressionV4=l.asm.NonMaxSuppressionV4).apply(null,arguments)},RC=l._NonMaxSuppressionV5=function(){return(RC=l._NonMaxSuppressionV5=l.asm.NonMaxSuppressionV5).apply(null,arguments)},ln=l._NotEqual=function(){return(ln=l._NotEqual=l.asm.NotEqual).apply(null,arguments)},Fl=l._OneHot=function(){return(Fl=l._OneHot=l.asm.OneHot).apply(null,arguments)},px=l._PadV2=function(){return(px=l._PadV2=l.asm.PadV2).apply(null,arguments)},MW=l._Pow=function(){return(MW=l._Pow=l.asm.Pow).apply(null,arguments)},PW=l._Prelu=function(){return(PW=l._Prelu=l.asm.Prelu).apply(null,arguments)},LW=l._Prod=function(){return(LW=l._Prod=l.asm.Prod).apply(null,arguments)},zW=l._RealDiv=function(){return(zW=l._RealDiv=l.asm.RealDiv).apply(null,arguments)},BW=l._Relu=function(){return(BW=l._Relu=l.asm.Relu).apply(null,arguments)},VW=l._Relu6=function(){return(VW=l._Relu6=l.asm.Relu6).apply(null,arguments)},GW=l._ResizeBilinear=function(){return(GW=l._ResizeBilinear=l.asm.ResizeBilinear).apply(null,arguments)},WW=l._Reverse=function(){return(WW=l._Reverse=l.asm.Reverse).apply(null,arguments)},UW=l._RotateWithOffset=function(){return(UW=l._RotateWithOffset=l.asm.RotateWithOffset).apply(null,arguments)},HW=l._Round=function(){return(HW=l._Round=l.asm.Round).apply(null,arguments)},qW=l._Rsqrt=function(){return(qW=l._Rsqrt=l.asm.Rsqrt).apply(null,arguments)},KW=l._ScatterNd=function(){return(KW=l._ScatterNd=l.asm.ScatterNd).apply(null,arguments)},jW=l._SelectV2=function(){return(jW=l._SelectV2=l.asm.SelectV2).apply(null,arguments)},XW=l._Sigmoid=function(){return(XW=l._Sigmoid=l.asm.Sigmoid).apply(null,arguments)},YW=l._Sin=function(){return(YW=l._Sin=l.asm.Sin).apply(null,arguments)},ZW=l._Softmax=function(){return(ZW=l._Softmax=l.asm.Softmax).apply(null,arguments)},JW=l._SparseFillEmptyRows=function(){return(JW=l._SparseFillEmptyRows=l.asm.SparseFillEmptyRows).apply(null,arguments)},QW=l._SparseReshape=function(){return(QW=l._SparseReshape=l.asm.SparseReshape).apply(null,arguments)},tU=l._SparseSegmentReduction=function(){return(tU=l._SparseSegmentReduction=l.asm.SparseSegmentReduction).apply(null,arguments)},eU=l._Sqrt=function(){return(eU=l._Sqrt=l.asm.Sqrt).apply(null,arguments)},rU=l._Square=function(){return(rU=l._Square=l.asm.Square).apply(null,arguments)},nU=l._SquaredDifference=function(){return(nU=l._SquaredDifference=l.asm.SquaredDifference).apply(null,arguments)},oU=l._Step=function(){return(oU=l._Step=l.asm.Step).apply(null,arguments)},sU=l._StridedSlice=function(){return(sU=l._StridedSlice=l.asm.StridedSlice).apply(null,arguments)},iU=l._Sub=function(){return(iU=l._Sub=l.asm.Sub).apply(null,arguments)},aU=l._Sum=function(){return(aU=l._Sum=l.asm.Sum).apply(null,arguments)},lU=l._Tan=function(){return(lU=l._Tan=l.asm.Tan).apply(null,arguments)},uU=l._Tanh=function(){return(uU=l._Tanh=l.asm.Tanh).apply(null,arguments)},cU=l._Tile=function(){return(cU=l._Tile=l.asm.Tile).apply(null,arguments)},pU=l._TopK=function(){return(pU=l._TopK=l.asm.TopK).apply(null,arguments)},mU=l._Transform=function(){return(mU=l._Transform=l.asm.Transform).apply(null,arguments)},fU=l._Transpose=function(){return(fU=l._Transpose=l.asm.Transpose).apply(null,arguments)},dU=l.__FusedMatMul=function(){return(dU=l.__FusedMatMul=l.asm._FusedMatMul).apply(null,arguments)},OC=l._malloc=function(){return(OC=l._malloc=l.asm.malloc).apply(null,arguments)},g1=l._free=function(){return(g1=l._free=l.asm.free).apply(null,arguments)},hU=l._emscripten_tls_init=function(){return(hU=l._emscripten_tls_init=l.asm.emscripten_tls_init).apply(null,arguments)},x1=l.___errno_location=function(){return(x1=l.___errno_location=l.asm.__errno_location).apply(null,arguments)},mx=l._pthread_self=function(){return(mx=l._pthread_self=l.asm.pthread_self).apply(null,arguments)},y1=l._emscripten_main_thread_process_queued_calls=function(){return(y1=l._emscripten_main_thread_process_queued_calls=l.asm.emscripten_main_thread_process_queued_calls).apply(null,arguments)},gU=l.__emscripten_thread_crashed=function(){return(gU=l.__emscripten_thread_crashed=l.asm._emscripten_thread_crashed).apply(null,arguments)},b1=l.__emscripten_thread_init=function(){return(b1=l.__emscripten_thread_init=l.asm._emscripten_thread_init).apply(null,arguments)},xU=l._emscripten_current_thread_process_queued_calls=function(){return(xU=l._emscripten_current_thread_process_queued_calls=l.asm.emscripten_current_thread_process_queued_calls).apply(null,arguments)},yU=l._emscripten_main_browser_thread_id=function(){return(yU=l._emscripten_main_browser_thread_id=l.asm.emscripten_main_browser_thread_id).apply(null,arguments)},bU=l._emscripten_sync_run_in_main_thread_2=function(){return(bU=l._emscripten_sync_run_in_main_thread_2=l.asm.emscripten_sync_run_in_main_thread_2).apply(null,arguments)},w1=l._emscripten_sync_run_in_main_thread_4=function(){return(w1=l._emscripten_sync_run_in_main_thread_4=l.asm.emscripten_sync_run_in_main_thread_4).apply(null,arguments)},v1=l._emscripten_run_in_main_runtime_thread_js=function(){return(v1=l._emscripten_run_in_main_runtime_thread_js=l.asm.emscripten_run_in_main_runtime_thread_js).apply(null,arguments)},MC=l._emscripten_dispatch_to_thread_=function(){return(MC=l._emscripten_dispatch_to_thread_=l.asm.emscripten_dispatch_to_thread_).apply(null,arguments)},PC=l.__emscripten_thread_free_data=function(){return(PC=l.__emscripten_thread_free_data=l.asm._emscripten_thread_free_data).apply(null,arguments)},wU=l.__emscripten_thread_exit=function(){return(wU=l.__emscripten_thread_exit=l.asm._emscripten_thread_exit).apply(null,arguments)},vU=l._memalign=function(){return(vU=l._memalign=l.asm.memalign).apply(null,arguments)},C1=l._emscripten_stack_set_limits=function(){return(C1=l._emscripten_stack_set_limits=l.asm.emscripten_stack_set_limits).apply(null,arguments)},LC=l.stackSave=function(){return(LC=l.stackSave=l.asm.stackSave).apply(null,arguments)},fx=l.stackRestore=function(){return(fx=l.stackRestore=l.asm.stackRestore).apply(null,arguments)},kp=l.stackAlloc=function(){return(kp=l.stackAlloc=l.asm.stackAlloc).apply(null,arguments)},CU=l.dynCall_iijjiiii=function(){return(CU=l.dynCall_iijjiiii=l.asm.dynCall_iijjiiii).apply(null,arguments)},IU=l.dynCall_jiji=function(){return(IU=l.dynCall_jiji=l.asm.dynCall_jiji).apply(null,arguments)},I1=l.__emscripten_allow_main_runtime_queued_calls=21464;l.cwrap=ze,l.keepRuntimeAlive=$u,l.PThread=Ut,l.PThread=Ut,l.wasmMemory=Ot,l.ExitStatus=Bd;var dx;function Bd(T){this.name="ExitStatus",this.message="Program terminated with exit("+T+")",this.status=T}Uo=function T(){dx||zC(),dx||(Uo=T)};function zC(T){if(T=T||d,Dl>0)return;if(v){c(l),$d(),postMessage({cmd:"loaded"});return}if(sn(),Dl>0)return;function O(){dx||(dx=!0,l.calledRun=!0,!ke&&($d(),c(l),l.onRuntimeInitialized&&l.onRuntimeInitialized(),m0()))}l.setStatus?(l.setStatus("Running..."),setTimeout(function(){setTimeout(function(){l.setStatus("")},1),O()},1)):O()}l.run=zC;function SU(T,O){if(ae=T,!O&&v)throw Qg(T),"unwind";$u()||p0(),kU(T)}function kU(T){ae=T,$u()||(Ut.terminateAllThreads(),l.onExit&&l.onExit(T),ke=!0),g(T,new Bd(T))}if(l.preInit)for(typeof l.preInit=="function"&&(l.preInit=[l.preInit]);l.preInit.length>0;)l.preInit.pop()();zC();var hx;m&&(hx={uncaughtException:process.listeners("uncaughtException").filter(function(T){return!m.uncaughtException.indexOf(T)>-1}),unhandledRejection:process.listeners("unhandledRejection").filter(function(T){return!m.unhandledRejection.indexOf(T)>-1})});var gx;if(typeof WasmBackendModule!="undefined")gx=WasmBackendModule;else if(typeof t!="undefined")gx=t;else throw new Error("Could not find wasm module in post.js");if(hx){var NU=gx._dispose;gx._dispose=function(){NU(),hx.uncaughtException.forEach(function(T){process.removeListener("uncaughtException",T)}),hx.unhandledRejection.forEach(function(T){process.removeListener("unhandledRejection",T)})}}return t.ready}})();typeof i0=="object"&&typeof JT=="object"?JT.exports=ZT:typeof define=="function"&&define.amd?define([],function(){return ZT}):typeof i0=="object"&&(i0.WasmBackendModuleThreadedSimd=ZT)});var AW=Oe((a0,t1)=>{var QT=(()=>{var r=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename!="undefined"&&(r=r||__filename),function(t){t=t||{};var e=typeof t!="undefined"?t:{},n,o;e.ready=new Promise(function(H,tt){n=H,o=tt});var s;typeof process!="undefined"&&process.listeners&&(s={uncaughtException:process.listeners("uncaughtException"),unhandledRejection:process.listeners("unhandledRejection")});var i=Object.assign({},e),a=[],u="./this.program",l=(H,tt)=>{throw tt},c=typeof window=="object",p=typeof importScripts=="function",m=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",f="";function d(H){return e.locateFile?e.locateFile(H,f):f+H}var h,g,y,b;function w(H){if(H instanceof Ld)return;D("exiting due to exception: "+H)}var v,k,_;m?(p?f=Og().dirname(f)+"/":f=__dirname+"/",_=()=>{k||(v=Ub(),k=Og())},h=function(tt,gt){return _(),tt=k.normalize(tt),v.readFileSync(tt,gt?void 0:"utf8")},y=H=>{var tt=h(H,!0);return tt.buffer||(tt=new Uint8Array(tt)),tt},g=(H,tt,gt)=>{_(),H=k.normalize(H),v.readFile(H,function($t,de){$t?gt($t):tt(de.buffer)})},process.argv.length>1&&(u=process.argv[1].replace(/\\/g,"/")),a=process.argv.slice(2),process.on("uncaughtException",function(H){if(!(H instanceof Ld))throw H}),process.on("unhandledRejection",function(H){throw H}),l=(H,tt)=>{if(Ad())throw process.exitCode=H,tt;w(tt),process.exit(H)},e.inspect=function(){return"[Emscripten Module object]"}):(c||p)&&(p?f=self.location.href:typeof document!="undefined"&&document.currentScript&&(f=document.currentScript.src),r&&(f=r),f.indexOf("blob:")!==0?f=f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):f="",h=H=>{var tt=new XMLHttpRequest;return tt.open("GET",H,!1),tt.send(null),tt.responseText},p&&(y=H=>{var tt=new XMLHttpRequest;return tt.open("GET",H,!1),tt.responseType="arraybuffer",tt.send(null),new Uint8Array(tt.response)}),g=(H,tt,gt)=>{var $t=new XMLHttpRequest;$t.open("GET",H,!0),$t.responseType="arraybuffer",$t.onload=()=>{if($t.status==200||$t.status==0&&$t.response){tt($t.response);return}gt()},$t.onerror=gt,$t.send(null)},b=H=>document.title=H);var $=e.print||console.log.bind(console),D=e.printErr||console.warn.bind(console);Object.assign(e,i),i=null,e.arguments&&(a=e.arguments),e.thisProgram&&(u=e.thisProgram),e.quit&&(l=e.quit);var F=4;function P(H){P.shown||(P.shown={}),P.shown[H]||(P.shown[H]=1,D(H))}function B(H,tt){if(typeof WebAssembly.Function=="function"){for(var gt={i:"i32",j:"i64",f:"f32",d:"f64"},$t={parameters:[],results:tt[0]=="v"?[]:[gt[tt[0]]]},de=1;de{Q=H},X;e.wasmBinary&&(X=e.wasmBinary);var nt=e.noExitRuntime||!0;typeof WebAssembly!="object"&&Au("no native wasm support detected");var st,it=!1,ft;function at(H,tt){H||Au(tt)}function xt(H){var tt=e["_"+H];return tt}function dt(H,tt,gt,$t,de){var ge={string:function(ln){var Fl=0;if(ln!=null&&ln!==0){var px=(ln.length<<2)+1;Fl=Pd(px),ce(ln,Fl,px)}return Fl},array:function(ln){var Fl=Pd(ln.length);return ke(ln,Fl),Fl}};function oe(ln){return tt==="string"?Kt(ln):tt==="boolean"?Boolean(ln):ln}var ee=xt(H),xr=[],Ho=0;if($t)for(var qo=0;qo<$t.length;qo++){var Sp=ge[gt[qo]];Sp?(Ho===0&&(Ho=ux()),xr[qo]=Sp($t[qo])):xr[qo]=$t[qo]}var Ou=ee.apply(null,xr);function RC(ln){return Ho!==0&&cx(Ho),oe(ln)}return Ou=RC(Ou),Ou}function bt(H,tt,gt,$t){gt=gt||[];var de=gt.every(function(oe){return oe==="number"}),ge=tt!=="string";return ge&&de&&!$t?xt(H):function(){return dt(H,tt,gt,arguments,$t)}}var kt=1,At=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0;function Dt(H,tt,gt){for(var $t=tt+gt,de=tt;H[de]&&!(de>=$t);)++de;if(de-tt>16&&H.subarray&&At)return At.decode(H.subarray(tt,de));for(var ge="";tt>10,56320|Ho&1023)}}return ge}function Kt(H,tt){return H?Dt(ze,H,tt):""}function jt(H,tt,gt,$t){if(!($t>0))return 0;for(var de=gt,ge=gt+$t-1,oe=0;oe=55296&&ee<=57343){var xr=H.charCodeAt(++oe);ee=65536+((ee&1023)<<10)|xr&1023}if(ee<=127){if(gt>=ge)break;tt[gt++]=ee}else if(ee<=2047){if(gt+1>=ge)break;tt[gt++]=192|ee>>6,tt[gt++]=128|ee&63}else if(ee<=65535){if(gt+2>=ge)break;tt[gt++]=224|ee>>12,tt[gt++]=128|ee>>6&63,tt[gt++]=128|ee&63}else{if(gt+3>=ge)break;tt[gt++]=240|ee>>18,tt[gt++]=128|ee>>12&63,tt[gt++]=128|ee>>6&63,tt[gt++]=128|ee&63}}return tt[gt]=0,gt-de}function ce(H,tt,gt){return jt(H,ze,tt,gt)}function Ot(H){for(var tt=0,gt=0;gt=55296&&$t<=57343&&($t=65536+(($t&1023)<<10)|H.charCodeAt(++gt)&1023),$t<=127?++tt:$t<=2047?tt+=2:$t<=65535?tt+=3:tt+=4}return tt}var $e=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):void 0;function ke(H,tt){rn.set(H,tt)}function ae(H,tt,gt){for(var $t=0;$t>0]=H.charCodeAt($t);gt||(rn[tt>>0]=0)}function Ke(H,tt){return H%tt>0&&(H+=tt-H%tt),H}var Re,rn,ze,Vo,Rr,nn,on,jr,so;function On(H){Re=H,e.HEAP8=rn=new Int8Array(H),e.HEAP16=Vo=new Int16Array(H),e.HEAP32=nn=new Int32Array(H),e.HEAPU8=ze=new Uint8Array(H),e.HEAPU16=Rr=new Uint16Array(H),e.HEAPU32=on=new Uint32Array(H),e.HEAPF32=jr=new Float32Array(H),e.HEAPF64=so=new Float64Array(H)}var Go=e.INITIAL_MEMORY||16777216,io,Al=[],Eu=[],mp=[],gr=!1,fp=!1,dp=0;function Ad(){return nt||dp>0}function Bg(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)Wg(e.preRun.shift());Dd(Al)}function Vg(){gr=!0,Dd(Eu)}function o1(){fp=!0}function Gg(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)Ug(e.postRun.shift());Dd(mp)}function Wg(H){Al.unshift(H)}function Wo(H){Eu.unshift(H)}function Ug(H){mp.unshift(H)}var qn=0,hp=null,$l=null;function u0(H){qn++,e.monitorRunDependencies&&e.monitorRunDependencies(qn)}function Hg(H){if(qn--,e.monitorRunDependencies&&e.monitorRunDependencies(qn),qn==0&&(hp!==null&&(clearInterval(hp),hp=null),$l)){var tt=$l;$l=null,tt()}}e.preloadedImages={},e.preloadedAudios={};function Au(H){e.onAbort&&e.onAbort(H),H="Aborted("+H+")",D(H),it=!0,ft=1,H+=". Build with -s ASSERTIONS=1 for more info.";var tt=new WebAssembly.RuntimeError(H);throw o(tt),tt}var c0="data:application/octet-stream;base64,";function qg(H){return H.startsWith(c0)}function $u(H){return H.startsWith("file://")}var sn;sn="tfjs-backend-wasm.wasm",qg(sn)||(sn=d(sn));function $d(H){try{if(H==sn&&X)return new Uint8Array(X);if(y)return y(H);throw"both async and sync fetching of the wasm failed"}catch(tt){Au(tt)}}function p0(){if(!X&&(c||p)){if(typeof fetch=="function"&&!$u(sn))return fetch(sn,{credentials:"same-origin"}).then(function(H){if(!H.ok)throw"failed to load wasm binary file at '"+sn+"'";return H.arrayBuffer()}).catch(function(){return $d(sn)});if(g)return new Promise(function(H,tt){g(sn,function(gt){H(new Uint8Array(gt))},tt)})}return Promise.resolve().then(function(){return $d(sn)})}function m0(){var H={env:yp,wasi_snapshot_preview1:yp};function tt(oe,ee){var xr=oe.exports;e.asm=xr,st=e.asm.memory,On(st.buffer),io=e.asm.__indirect_function_table,Wo(e.asm.__wasm_call_ctors),Hg("wasm-instantiate")}u0("wasm-instantiate");function gt(oe){tt(oe.instance)}function $t(oe){return p0().then(function(ee){return WebAssembly.instantiate(ee,H)}).then(function(ee){return ee}).then(oe,function(ee){D("failed to asynchronously prepare wasm: "+ee),Au(ee)})}function de(){return!X&&typeof WebAssembly.instantiateStreaming=="function"&&!qg(sn)&&!$u(sn)&&typeof fetch=="function"?fetch(sn,{credentials:"same-origin"}).then(function(oe){var ee=WebAssembly.instantiateStreaming(oe,H);return ee.then(gt,function(xr){return D("wasm streaming compile failed: "+xr),D("falling back to ArrayBuffer instantiation"),$t(gt)})}):$t(gt)}if(e.instantiateWasm)try{var ge=e.instantiateWasm(H,tt);return ge}catch(oe){return D("Module.instantiateWasm callback failed with error: "+oe),!1}return de().catch(o),{}}var s1,i1;function Dd(H){for(;H.length>0;){var tt=H.shift();if(typeof tt=="function"){tt(e);continue}var gt=tt.func;typeof gt=="number"?tt.arg===void 0?Fd(gt)():Fd(gt)(tt.arg):gt(tt.arg===void 0?null:tt.arg)}}function Dl(H){return H}function Kg(H){var tt=/\b_Z[\w\d_]+/g;return H.replace(tt,function(gt){var $t=gt;return gt===$t?gt:$t+" ["+gt+"]"})}var Uo=[];function Fd(H){var tt=Uo[H];return tt||(H>=Uo.length&&(Uo.length=H+1),Uo[H]=tt=io.get(H)),tt}function a1(){var H=new Error;if(!H.stack){try{throw new Error}catch(tt){H=tt}if(!H.stack)return"(no stack trace available)"}return H.stack.toString()}function gp(H,tt){io.set(H,tt),Uo[H]=tt}function f0(){Au("")}function Rd(){return 2147483648}function jg(H,tt,gt){ze.copyWithin(H,tt,tt+gt)}function an(H){try{return st.grow(H-Re.byteLength+65535>>>16),On(st.buffer),1}catch(tt){}}function Xg(H){var tt=ze.length;H=H>>>0;var gt=Rd();if(H>gt)return!1;for(var $t=1;$t<=4;$t*=2){var de=tt*(1+.2/$t);de=Math.min(de,H+100663296);var ge=Math.min(gt,Ke(Math.max(H,de),65536)),oe=an(ge);if(oe)return!0}return!1}var xp={mappings:{},buffers:[null,[],[]],printChar:function(H,tt){var gt=xp.buffers[H];tt===0||tt===10?((H===1?$:D)(Dt(gt,0)),gt.length=0):gt.push(tt)},varargs:void 0,get:function(){xp.varargs+=4;var H=nn[xp.varargs-4>>2];return H},getStr:function(H){var tt=Kt(H);return tt},get64:function(H,tt){return H}};function d0(H){return 0}function l1(H,tt,gt,$t,de){}function u1(H,tt,gt,$t){for(var de=0,ge=0;ge>2],ee=nn[tt+4>>2];tt+=8;for(var xr=0;xr>2]=de,0}function h0(H){rt(H)}var Yg=!1,yp={abort:f0,emscripten_get_heap_max:Rd,emscripten_memcpy_big:jg,emscripten_resize_heap:Xg,fd_close:d0,fd_seek:l1,fd_write:u1,setTempRet0:h0},OW=m0(),c1=e.___wasm_call_ctors=function(){return(c1=e.___wasm_call_ctors=e.asm.__wasm_call_ctors).apply(null,arguments)},g0=e._init=function(){return(g0=e._init=e.asm.init).apply(null,arguments)},x0=e._init_with_threads_count=function(){return(x0=e._init_with_threads_count=e.asm.init_with_threads_count).apply(null,arguments)},Zg=e._get_threads_count=function(){return(Zg=e._get_threads_count=e.asm.get_threads_count).apply(null,arguments)},Jg=e._register_tensor=function(){return(Jg=e._register_tensor=e.asm.register_tensor).apply(null,arguments)},y0=e._dispose_data=function(){return(y0=e._dispose_data=e.asm.dispose_data).apply(null,arguments)},Ut=e._dispose=function(){return(Ut=e._dispose=e.asm.dispose).apply(null,arguments)},b0=e._Abs=function(){return(b0=e._Abs=e.asm.Abs).apply(null,arguments)},Qg=e._Add=function(){return(Qg=e._Add=e.asm.Add).apply(null,arguments)},Du=e._AddN=function(){return(Du=e._AddN=e.asm.AddN).apply(null,arguments)},bp=e._All=function(){return(bp=e._All=e.asm.All).apply(null,arguments)},w0=e._Any=function(){return(w0=e._Any=e.asm.Any).apply(null,arguments)},p1=e._ArgMax=function(){return(p1=e._ArgMax=e.asm.ArgMax).apply(null,arguments)},v0=e._AvgPool=function(){return(v0=e._AvgPool=e.asm.AvgPool).apply(null,arguments)},m1=e._BatchMatMul=function(){return(m1=e._BatchMatMul=e.asm.BatchMatMul).apply(null,arguments)},Fu=e._Ceil=function(){return(Fu=e._Ceil=e.asm.Ceil).apply(null,arguments)},C0=e._ClipByValue=function(){return(C0=e._ClipByValue=e.asm.ClipByValue).apply(null,arguments)},I0=e._Conv2D=function(){return(I0=e._Conv2D=e.asm.Conv2D).apply(null,arguments)},S0=e._Conv2DBackpropInput=function(){return(S0=e._Conv2DBackpropInput=e.asm.Conv2DBackpropInput).apply(null,arguments)},k0=e._Cos=function(){return(k0=e._Cos=e.asm.Cos).apply(null,arguments)},N0=e._Cosh=function(){return(N0=e._Cosh=e.asm.Cosh).apply(null,arguments)},T0=e._CropAndResize=function(){return(T0=e._CropAndResize=e.asm.CropAndResize).apply(null,arguments)},tx=e._Cumprod=function(){return(tx=e._Cumprod=e.asm.Cumprod).apply(null,arguments)},_0=e._Cumsum=function(){return(_0=e._Cumsum=e.asm.Cumsum).apply(null,arguments)},E0=e._DepthToSpace=function(){return(E0=e._DepthToSpace=e.asm.DepthToSpace).apply(null,arguments)},A0=e._DepthwiseConv2dNative=function(){return(A0=e._DepthwiseConv2dNative=e.asm.DepthwiseConv2dNative).apply(null,arguments)},$0=e._Elu=function(){return($0=e._Elu=e.asm.Elu).apply(null,arguments)},D0=e._Equal=function(){return(D0=e._Equal=e.asm.Equal).apply(null,arguments)},ex=e._Exp=function(){return(ex=e._Exp=e.asm.Exp).apply(null,arguments)},F0=e._FlipLeftRight=function(){return(F0=e._FlipLeftRight=e.asm.FlipLeftRight).apply(null,arguments)},R0=e._Floor=function(){return(R0=e._Floor=e.asm.Floor).apply(null,arguments)},Ru=e._FloorDiv=function(){return(Ru=e._FloorDiv=e.asm.FloorDiv).apply(null,arguments)},Od=e._FusedBatchNorm=function(){return(Od=e._FusedBatchNorm=e.asm.FusedBatchNorm).apply(null,arguments)},O0=e._FusedConv2D=function(){return(O0=e._FusedConv2D=e.asm.FusedConv2D).apply(null,arguments)},M0=e._FusedDepthwiseConv2D=function(){return(M0=e._FusedDepthwiseConv2D=e.asm.FusedDepthwiseConv2D).apply(null,arguments)},P0=e._Gather=function(){return(P0=e._Gather=e.asm.Gather).apply(null,arguments)},ne=e._GatherNd=function(){return(ne=e._GatherNd=e.asm.GatherNd).apply(null,arguments)},L0=e._Greater=function(){return(L0=e._Greater=e.asm.Greater).apply(null,arguments)},z0=e._GreaterEqual=function(){return(z0=e._GreaterEqual=e.asm.GreaterEqual).apply(null,arguments)},B0=e._LeakyRelu=function(){return(B0=e._LeakyRelu=e.asm.LeakyRelu).apply(null,arguments)},V0=e._Less=function(){return(V0=e._Less=e.asm.Less).apply(null,arguments)},G0=e._LessEqual=function(){return(G0=e._LessEqual=e.asm.LessEqual).apply(null,arguments)},W0=e._Log=function(){return(W0=e._Log=e.asm.Log).apply(null,arguments)},Md=e._LogicalAnd=function(){return(Md=e._LogicalAnd=e.asm.LogicalAnd).apply(null,arguments)},rx=e._Max=function(){return(rx=e._Max=e.asm.Max).apply(null,arguments)},nx=e._MaxPool=function(){return(nx=e._MaxPool=e.asm.MaxPool).apply(null,arguments)},U0=e._Maximum=function(){return(U0=e._Maximum=e.asm.Maximum).apply(null,arguments)},H0=e._Mean=function(){return(H0=e._Mean=e.asm.Mean).apply(null,arguments)},q0=e._Min=function(){return(q0=e._Min=e.asm.Min).apply(null,arguments)},K0=e._Minimum=function(){return(K0=e._Minimum=e.asm.Minimum).apply(null,arguments)},j0=e._MirrorPad=function(){return(j0=e._MirrorPad=e.asm.MirrorPad).apply(null,arguments)},X0=e._Multiply=function(){return(X0=e._Multiply=e.asm.Multiply).apply(null,arguments)},or=e._Neg=function(){return(or=e._Neg=e.asm.Neg).apply(null,arguments)},Y0=e._NonMaxSuppressionV3=function(){return(Y0=e._NonMaxSuppressionV3=e.asm.NonMaxSuppressionV3).apply(null,arguments)},Z0=e._NonMaxSuppressionV4=function(){return(Z0=e._NonMaxSuppressionV4=e.asm.NonMaxSuppressionV4).apply(null,arguments)},J0=e._NonMaxSuppressionV5=function(){return(J0=e._NonMaxSuppressionV5=e.asm.NonMaxSuppressionV5).apply(null,arguments)},wp=e._NotEqual=function(){return(wp=e._NotEqual=e.asm.NotEqual).apply(null,arguments)},ox=e._OneHot=function(){return(ox=e._OneHot=e.asm.OneHot).apply(null,arguments)},sx=e._PadV2=function(){return(sx=e._PadV2=e.asm.PadV2).apply(null,arguments)},ix=e._Pow=function(){return(ix=e._Pow=e.asm.Pow).apply(null,arguments)},Q0=e._Prelu=function(){return(Q0=e._Prelu=e.asm.Prelu).apply(null,arguments)},ax=e._Prod=function(){return(ax=e._Prod=e.asm.Prod).apply(null,arguments)},tC=e._RealDiv=function(){return(tC=e._RealDiv=e.asm.RealDiv).apply(null,arguments)},f1=e._Relu=function(){return(f1=e._Relu=e.asm.Relu).apply(null,arguments)},lx=e._Relu6=function(){return(lx=e._Relu6=e.asm.Relu6).apply(null,arguments)},d1=e._ResizeBilinear=function(){return(d1=e._ResizeBilinear=e.asm.ResizeBilinear).apply(null,arguments)},eC=e._Reverse=function(){return(eC=e._Reverse=e.asm.Reverse).apply(null,arguments)},rC=e._RotateWithOffset=function(){return(rC=e._RotateWithOffset=e.asm.RotateWithOffset).apply(null,arguments)},nC=e._Round=function(){return(nC=e._Round=e.asm.Round).apply(null,arguments)},oC=e._Rsqrt=function(){return(oC=e._Rsqrt=e.asm.Rsqrt).apply(null,arguments)},sC=e._ScatterNd=function(){return(sC=e._ScatterNd=e.asm.ScatterNd).apply(null,arguments)},iC=e._SelectV2=function(){return(iC=e._SelectV2=e.asm.SelectV2).apply(null,arguments)},aC=e._Sigmoid=function(){return(aC=e._Sigmoid=e.asm.Sigmoid).apply(null,arguments)},lC=e._Sin=function(){return(lC=e._Sin=e.asm.Sin).apply(null,arguments)},uC=e._Softmax=function(){return(uC=e._Softmax=e.asm.Softmax).apply(null,arguments)},cC=e._SparseFillEmptyRows=function(){return(cC=e._SparseFillEmptyRows=e.asm.SparseFillEmptyRows).apply(null,arguments)},pC=e._SparseReshape=function(){return(pC=e._SparseReshape=e.asm.SparseReshape).apply(null,arguments)},mC=e._SparseSegmentReduction=function(){return(mC=e._SparseSegmentReduction=e.asm.SparseSegmentReduction).apply(null,arguments)},fC=e._Sqrt=function(){return(fC=e._Sqrt=e.asm.Sqrt).apply(null,arguments)},dC=e._Square=function(){return(dC=e._Square=e.asm.Square).apply(null,arguments)},hC=e._SquaredDifference=function(){return(hC=e._SquaredDifference=e.asm.SquaredDifference).apply(null,arguments)},gC=e._Step=function(){return(gC=e._Step=e.asm.Step).apply(null,arguments)},xC=e._StridedSlice=function(){return(xC=e._StridedSlice=e.asm.StridedSlice).apply(null,arguments)},yC=e._Sub=function(){return(yC=e._Sub=e.asm.Sub).apply(null,arguments)},bC=e._Sum=function(){return(bC=e._Sum=e.asm.Sum).apply(null,arguments)},wC=e._Tan=function(){return(wC=e._Tan=e.asm.Tan).apply(null,arguments)},vC=e._Tanh=function(){return(vC=e._Tanh=e.asm.Tanh).apply(null,arguments)},CC=e._Tile=function(){return(CC=e._Tile=e.asm.Tile).apply(null,arguments)},IC=e._TopK=function(){return(IC=e._TopK=e.asm.TopK).apply(null,arguments)},SC=e._Transform=function(){return(SC=e._Transform=e.asm.Transform).apply(null,arguments)},kC=e._Transpose=function(){return(kC=e._Transpose=e.asm.Transpose).apply(null,arguments)},NC=e.__FusedMatMul=function(){return(NC=e.__FusedMatMul=e.asm._FusedMatMul).apply(null,arguments)},TC=e._malloc=function(){return(TC=e._malloc=e.asm.malloc).apply(null,arguments)},_C=e._free=function(){return(_C=e._free=e.asm.free).apply(null,arguments)},EC=e.___errno_location=function(){return(EC=e.___errno_location=e.asm.__errno_location).apply(null,arguments)},AC=e._emscripten_main_thread_process_queued_calls=function(){return(AC=e._emscripten_main_thread_process_queued_calls=e.asm.emscripten_main_thread_process_queued_calls).apply(null,arguments)},ux=e.stackSave=function(){return(ux=e.stackSave=e.asm.stackSave).apply(null,arguments)},cx=e.stackRestore=function(){return(cx=e.stackRestore=e.asm.stackRestore).apply(null,arguments)},Pd=e.stackAlloc=function(){return(Pd=e.stackAlloc=e.asm.stackAlloc).apply(null,arguments)},$C=e.dynCall_iijjiiii=function(){return($C=e.dynCall_iijjiiii=e.asm.dynCall_iijjiiii).apply(null,arguments)},DC=e.dynCall_jiji=function(){return(DC=e.dynCall_jiji=e.asm.dynCall_jiji).apply(null,arguments)};e.cwrap=bt;var vp;function Ld(H){this.name="ExitStatus",this.message="Program terminated with exit("+H+")",this.status=H}$l=function H(){vp||zd(),vp||($l=H)};function zd(H){if(H=H||a,qn>0||(Bg(),qn>0))return;function tt(){vp||(vp=!0,e.calledRun=!0,!it&&(Vg(),n(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),Gg()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),tt()},1)):tt()}e.run=zd;function h1(H){ft=H,Ad()||(e.onExit&&e.onExit(H),it=!0),l(H,new Ld(H))}if(e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();zd();var Cp;s&&(Cp={uncaughtException:process.listeners("uncaughtException").filter(function(H){return!s.uncaughtException.indexOf(H)>-1}),unhandledRejection:process.listeners("unhandledRejection").filter(function(H){return!s.unhandledRejection.indexOf(H)>-1})});var Ip;if(typeof t!="undefined")Ip=t;else if(typeof WasmBackendModuleThreadedSimd!="undefined")Ip=WasmBackendModuleThreadedSimd;else throw new Error("Could not find wasm module in post.js");if(Cp){var FC=Ip._dispose;Ip._dispose=function(){FC(),Cp.uncaughtException.forEach(function(H){process.removeListener("uncaughtException",H)}),Cp.unhandledRejection.forEach(function(H){process.removeListener("unhandledRejection",H)})}}return t.ready}})();typeof a0=="object"&&typeof t1=="object"?t1.exports=QT:typeof define=="function"&&define.amd?define([],function(){return QT}):typeof a0=="object"&&(a0.WasmBackendModule=QT)});var ea=class{constructor(t,e){this.backend=t,this.dataMover=e,this.data=new WeakMap,this.dataIdsCount=0}get(t){return this.data.has(t)||this.dataMover.moveData(this.backend,t),this.data.get(t)}set(t,e){this.dataIdsCount++,this.data.set(t,e)}has(t){return this.data.has(t)}delete(t){return this.dataIdsCount--,this.data.delete(t)}numDataIds(){return this.dataIdsCount}},Xo=class{refCount(t){return Kn("refCount")}incRef(t){return Kn("incRef")}timerAvailable(){return!0}time(t){return Kn("time")}read(t){return Kn("read")}readSync(t){return Kn("readSync")}readToGPU(t,e){return Kn("readToGPU")}numDataIds(){return Kn("numDataIds")}disposeData(t,e){return Kn("disposeData")}write(t,e,n){return Kn("write")}move(t,e,n,o,s){return Kn("move")}memory(){return Kn("memory")}floatPrecision(){return Kn("floatPrecision")}epsilon(){return this.floatPrecision()===32?1e-7:1e-4}dispose(){return Kn("dispose")}};function Kn(r){throw new Error(`'${r}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}function k1(r){let t=r.length,e=0;for(;t>0;)e=Math.random()*t|0,t--,yx(r,t,e)}function RU(r,t){if(r.length!==t.length)throw new Error(`Array sizes must match to be shuffled together First array length was ${r.length}Second array length was ${t.length}`);let e=r.length,n=0;for(;e>0;)n=Math.random()*e|0,e--,yx(r,e,n),yx(t,e,n)}function Tp(r,t,e){return Math.max(r,Math.min(t,e))}function OU(r){return r%2===0?r:r+1}function yx(r,t,e){let n=r[t];r[t]=r[e],r[e]=n}function MU(r){let t=0;for(let e=0;ee+` Shapes ${r} and ${t} must match`)}function jn(r){A(r!=null,()=>"The input to the tensor constructor must be a non-null value.")}function Yo(r,t=[],e=!1){if(t==null&&(t=[]),Array.isArray(r)||yr(r)&&!e)for(let n=0;n0,e){return new Promise((n,o)=>{let s=0,i=()=>{if(r()){n();return}s++;let a=t(s);if(e!=null&&s>=e){o();return}setTimeout(i,a)};i()})}function UU(r,t){let e=1,n=-1;for(let s=0;s=0)e*=r[s];else if(r[s]===-1){if(n!==-1)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${n} and dim ${s}`);n=s}else if(r[s]<0)throw Error(`Shapes can not be < 0. Found ${r[s]} at dim ${s}`);if(n===-1){if(t>0&&t!==e)throw Error(`Size(${t}) must match the product of shape ${r}`);return r}if(e===0)throw Error(`Cannot infer the missing size in [${r}] when there are 0 elements`);if(t%e!==0)throw Error(`The implicit shape can't be a fractional number. Got ${t} / ${e}`);let o=r.slice();return o[n]=t/e,o}function mr(r,t){let e=t.length;return r=r==null?t.map((n,o)=>o):[].concat(r),A(r.every(n=>n>=-e&&n`All values in axis param must be in range [-${e}, ${e}) but got axis ${r}`),A(r.every(n=>ra(n)),()=>`All values in axis param must be integers but got axis ${r}`),r.map(n=>n<0?e+n:n)}function VC(r,t){let e=[],n=[],o=t!=null&&Array.isArray(t)&&t.length===0,s=t==null||o?null:mr(t,r).sort(),i=0;for(let a=0;aa)&&r[a]===1&&(e.push(r[a]),n.push(a)),s[i]<=a&&i++}r[a]!==1&&(e.push(r[a]),n.push(a))}return{newShape:e,keptDims:n}}function GC(r,t){let e=null;if(r==null||r==="float32")e=new Float32Array(t);else if(r==="int32")e=new Int32Array(t);else if(r==="bool")e=new Uint8Array(t);else throw new Error(`Unknown data type ${r}`);return e}function WC(r,t){let e=null;if(r==null||r==="float32")e=new Float32Array(t);else if(r==="int32")e=new Int32Array(t);else if(r==="bool")e=new Uint8Array(t);else if(r==="string")e=new Array(t);else throw new Error(`Unknown data type ${r}`);return e}function UC(r,t){for(let e=0;et+=e.length),t}function Zo(r){return typeof r=="string"||r instanceof String}function N1(r){return typeof r=="boolean"}function T1(r){return typeof r=="number"}function _p(r){return Array.isArray(r)?_p(r[0]):r instanceof Float32Array?"float32":r instanceof Int32Array||r instanceof Uint8Array||r instanceof Uint8ClampedArray?"int32":T1(r)?"float32":Zo(r)?"string":N1(r)?"bool":"float32"}function yi(r){return!!(r&&r.constructor&&r.call&&r.apply)}function Ep(r,t){for(let e=t;e=0;--n)e[n]=e[n+1]*r[n+1];return e}function _1(r,t,e,n=!1){let o=new Array;if(t.length===1){let s=t[0]*(n?2:1);for(let i=0;iu*l)*(n?2:1);for(let u=0;uo*s)*(e?2:1);if(n===0)return[];if(n!==t.length)throw new Error(`[${r}] does not match the input size ${t.length}${e?" for a complex tensor":""}.`);return _1(0,r,t,e)}function Gd(r,t){let e=Ap(r,t);for(let n=0;nn*o,1);if(t==null||t==="float32")return Pu(r,new Float32Array(e));if(t==="int32")return Pu(r,new Int32Array(e));if(t==="bool")return Pu(r,new Uint8Array(e));throw new Error(`Unknown data type ${t}`)}function Wd(r){r.forEach(t=>{A(Number.isInteger(t)&&t>=0,()=>`Tensor must have a shape comprised of positive integers but got shape [${r}].`)})}function KU(r,t,e){if(t===0)return 0;if(t===1)return r[0];let n=r[r.length-1];for(let o=0;o{let[o,s]=n.split(":");this.urlFlags[o]=JU(o,s)})}};function YU(r){let t={};return r.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(e,...n)=>(ZU(t,n[0],n[1]),n.join("="))),t}function ZU(r,t,e){r[decodeURIComponent(t)]=decodeURIComponent(e||"")}function JU(r,t){if(t=t.toLowerCase(),t==="true"||t==="false")return t==="true";if(`${+t}`===t)return+t;throw new Error(`Could not parse value flag value ${t} for flag ${r}.`)}function G(){return KC}var KC=null;function A1(r){KC=r}var jC;function XC(){if(jC==null){let r;if(typeof window!="undefined")r=window;else if(typeof global!="undefined")r=global;else if(typeof process!="undefined")r=process;else if(typeof self!="undefined")r=self;else throw new Error("Could not find a global object");jC=r}return jC}function QU(){let r=XC();return r._tfGlobals==null&&(r._tfGlobals=new Map),r._tfGlobals}function qd(r,t){let e=QU();if(e.has(r))return e.get(r);{let n=t();return e.set(r,n),e.get(r)}}var wi="Abs",na="Acos",oa="Acosh",Xn="Add",Jo="AddN",sa="All",ia="Any",Qo="ArgMax",Rl="ArgMin",aa="Asin",la="Asinh",ua="Atan",ca="Atanh",pa="Atan2",ts="AvgPool",$p="AvgPoolGrad",Ol="AvgPool3D",Dp="AvgPool3DGrad",es="BatchMatMul",vi="BatchToSpaceND",Fp="Bincount",$1="BroadcastTo",Rp="BroadcastArgs",ao="Cast",rs="Ceil",lo="ClipByValue",Op="Complex",Ml="ComplexAbs",Ci="Concat",ns="Conv2D",Mp="Conv2DBackpropFilter",os="Conv2DBackpropInput",Pl="Conv3D",Pp="Conv3DBackpropFilterV2",Lp="Conv3DBackpropInputV2",ss="Cos",is="Cosh",ma="Cumprod",as="Cumsum",fa="CropAndResize",zp="DenseBincount",da="DepthToSpace",ls="DepthwiseConv2dNative",Bp="DepthwiseConv2dNativeBackpropFilter",Vp="DepthwiseConv2dNativeBackpropInput",Gp="Diag",Ll="Dilation2D",Kd="Dilation2DBackpropInput",jd="Dilation2DBackpropFilter",us="RealDiv",Wp="Einsum",cs="Elu",Up="EluGrad",ha="Erf",ga="Equal",ps="Exp",Ii="ExpandDims",xa="Expm1",Hp="FFT",zl="Fill",ya="FlipLeftRight",ms="Floor",fs="FloorDiv",ds="FusedBatchNorm",Si="GatherV2",ba="GatherNd",wa="Greater",hs="GreaterEqual",uo="Identity",qp="IFFT",Kp="Imag",va="IsFinite",Ca="IsInf",Ia="IsNan",gs="LeakyRelu",Sa="Less",ka="LessEqual",jp="LinSpace",xs="Log",Na="Log1p",Ta="LogicalAnd",zu="LogicalNot",Bu="LogicalOr",D1="LogSoftmax",Xat="LowerBound",Bl="LRN",Xp="LRNGrad",ys="Max",bs="Maximum",ws="MaxPool",Yp="MaxPoolGrad",Vl="MaxPool3D",Zp="MaxPool3DGrad",Jp="MaxPoolWithArgmax",vs="Mean",Cs="Min",Is="Minimum",Ss="MirrorPad",_a="Mod",Qp="Multinomial",ks="Multiply",ki="Neg",Ea="NotEqual",Aa="NonMaxSuppressionV3",$a="NonMaxSuppressionV4",Da="NonMaxSuppressionV5",Ni="OnesLike",Ns="OneHot",Ti="Pack",Ts="PadV2",Yat="Pool",_s="Pow",Es="Prelu",As="Prod",Gl="Range",tm="Real",Fa="Reciprocal",$s="Relu",_i="Reshape",Wl="ResizeNearestNeighbor",em="ResizeNearestNeighborGrad",Ds="ResizeBilinear",rm="ResizeBilinearGrad",Fs="Relu6",Rs="Reverse",Os="Round",Ms="Rsqrt",Ra="ScatterNd",nm="SearchSorted",Ei="Select",Oa="Selu",Ai="Slice",Ps="Sin",Ma="Sinh",Pa="Sign",Ls="Sigmoid",La="Softplus",zs="Sqrt",Bs="Sum",$i="SpaceToBatchND",Di="SplitV",Vs="Softmax",Ul="SparseFillEmptyRows",za="SparseReshape",Hl="SparseSegmentMean",ql="SparseSegmentSum",om="SparseToDense",Gs="SquaredDifference",Kl="Square",Ba="StridedSlice",sm="StringNGrams",im="StringSplit",am="StringToHashBucketFast",Ws="Sub",Us="Tan",Hs="Tanh",Yn="Tile",Va="TopK",Ga="Transform",Zn="Transpose",lm="Unique",Fi="Unpack",jl="UnsortedSegmentSum",Zat="UpperBound",Ri="ZerosLike",co="Step",Xd="FromPixels",Wa="RotateWithOffset",Oi="_FusedMatMul",Mi="FusedConv2D",Pi="FusedDepthwiseConv2D";function Li(...r){G().getBool("IS_TEST")||G().getBool("PROD")||console.warn(...r)}function t4(...r){G().getBool("IS_TEST")||G().getBool("PROD")||console.log(...r)}var um=qd("kernelRegistry",()=>new Map),Yd=qd("gradRegistry",()=>new Map);function Zd(r,t){let e=ZC(r,t);return um.get(e)}function YC(r){return Yd.get(r)}function wx(r){let t=um.entries(),e=[];for(;;){let{done:n,value:o}=t.next();if(n)break;let[s,i]=o,[a]=s.split("_");a===r&&e.push(i)}return e}function Vu(r){let{kernelName:t,backendName:e}=r,n=ZC(t,e);um.has(n)&&Li(`The kernel '${t}' for backend '${e}' is already registered`),um.set(n,r)}function R1(r){let{kernelName:t}=r;Yd.has(t)&&G().getBool("DEBUG")&&Li(`Overriding the gradient for '${t}'`),Yd.set(t,r)}function rlt(r,t){let e=ZC(r,t);if(!um.has(e))throw new Error(`The kernel '${r}' for backend '${t}' is not registered`);um.delete(e)}function nlt(r){if(!Yd.has(r))throw new Error(`The gradient '${r}' for backend is not registered`);Yd.delete(r)}function olt(r,t){wx(r).forEach(n=>{let o=Object.assign({},n,{backendName:t});Vu(o)})}function ZC(r,t){return`${t}_${r}`}var x={};Zt(x,{arraysEqual:()=>Pn,assert:()=>A,assertNonNegativeIntegerDimensions:()=>Wd,assertNonNull:()=>jn,assertShapesMatch:()=>Me,bytesFromStringArray:()=>qC,bytesPerElement:()=>bx,checkConversionForErrors:()=>UC,clamp:()=>Tp,computeStrides:()=>bi,createScalarValue:()=>a4,createShuffledIndices:()=>GU,decodeString:()=>fm,distSquared:()=>LU,encodeString:()=>Yl,fetch:()=>u4,fingerPrint64:()=>i4,flatten:()=>Yo,getArrayFromDType:()=>WC,getTypedArrayFromDType:()=>GC,hasEncodingLoss:()=>HU,hexToLong:()=>Jd,indexToLoc:()=>jU,inferDtype:()=>_p,inferFromImplicitShape:()=>UU,isBoolean:()=>N1,isFunction:()=>yi,isInt:()=>ra,isNumber:()=>T1,isPromise:()=>Ud,isScalarShape:()=>zU,isString:()=>Zo,isTypedArray:()=>yr,isValidDtype:()=>HC,locToIndex:()=>KU,makeOnesTypedArray:()=>Gd,makeZerosNestedTypedArray:()=>qU,makeZerosTypedArray:()=>Ap,nearestDivisor:()=>Ep,nearestLargerEven:()=>OU,now:()=>qu,parseAxisParam:()=>mr,randUniform:()=>PU,repeatedTry:()=>WU,rightPad:()=>Lu,shuffle:()=>k1,shuffleCombo:()=>RU,sizeFromShape:()=>Qt,sizeToSquarishShape:()=>VU,squeezeShape:()=>VC,sum:()=>MU,swap:()=>yx,tanh:()=>BU,toNestedArray:()=>Pu,toTypedArray:()=>mm});var eI=Mu(H1());var Hu=eI.default||eI;function Jd(r){return Hu.fromString(r,!0,16)}var K1=Jd("c3a5c85c97cb3127"),Uu=Jd("b492b66fbe98f273"),un=Jd("9ae16a3b2f90404f");function tI(r){return r.xor(r.shru(47))}function j1(r,t,e){let n=r.slice(t,t+e);return Hu.fromBytes(Array.from(n),!0,!0)}function Be(r,t){return j1(r,t,8)}function q1(r,t){return j1(r,t,4)}function Er(r,t){return t===0?r:r.shru(t).or(r.shl(64-t))}function Xl(r,t,e=Jd("9ddfea08eb382d69")){let n=r.xor(t).mul(e);n=n.xor(n.shru(47));let o=t.xor(n).mul(e);return o=o.xor(o.shru(47)),o=o.mul(e),o}function r4(r,t,e,n,o,s){o=o.add(r),s=Er(s.add(o).add(n),21);let i=o;return o=o.add(t),o=o.add(e),s=s.add(Er(o,44)),[o.add(n),s.add(i)]}function Cx(r,t,e,n){return r4(Be(r,t),Be(r,t+8),Be(r,t+16),Be(r,t+24),e,n)}function n4(r,t=r.length){if(t>=8){let e=un.add(t*2),n=Be(r,0).add(un),o=Be(r,t-8),s=Er(o,37).mul(e).add(n),i=Er(n,25).add(o).mul(e);return Xl(s,i,e)}if(t>=4){let e=un.add(t*2),n=q1(r,0);return Xl(n.shl(3).add(t),q1(r,t-4),e)}if(t>0){let e=r[0],n=r[t>>1],o=r[t-1],s=e+(n<<8),i=t+(o<<2);return tI(un.mul(s).xor(K1.mul(i))).mul(un)}return un}function o4(r,t=r.length){let e=un.add(t*2),n=Be(r,0).mul(Uu),o=Be(r,8),s=Be(r,t-8).mul(e),i=Be(r,t-16).mul(un);return Xl(Er(n.add(o),43).add(Er(s,30)).add(i),n.add(Er(o.add(un),18)).add(s),e)}function s4(r,t=r.length){let e=un.add(t*2),n=Be(r,0).mul(un),o=Be(r,8),s=Be(r,t-8).mul(e),i=Be(r,t-16).mul(un),a=Er(n.add(o),43).add(Er(s,30)).add(i),u=Xl(a,n.add(Er(o.add(un),18)).add(s),e),l=Be(r,16).mul(e),c=Be(r,24),p=a.add(Be(r,t-32)).mul(e),m=u.add(Be(r,t-24)).mul(e);return Xl(Er(l.add(c),43).add(Er(p,30)).add(m),l.add(Er(c.add(n),18)).add(p),e)}function i4(r,t=r.length){let e=Hu.fromNumber(81,!0);if(t<=32)return t<=16?n4(r,t):o4(r,t);if(t<=64)return s4(r,t);let n=e,o=e.mul(Uu).add(113),s=tI(o.mul(un).add(113)).mul(un),i=[Hu.UZERO,Hu.UZERO],a=[Hu.UZERO,Hu.UZERO];n=n.mul(un).add(Be(r,0));let u=0,l=(t-1>>6)*64,c=l+(t-1&63)-63;do n=Er(n.add(o).add(i[0]).add(Be(r,u+8)),37).mul(Uu),o=Er(o.add(i[1]).add(Be(r,u+48)),42).mul(Uu),n=n.xor(a[1]),o=o.add(i[0]).add(Be(r,u+40)),s=Er(s.add(a[0]),33).mul(Uu),i=Cx(r,u,i[1].mul(Uu),n.add(a[0])),a=Cx(r,u+32,s.add(a[1]),o.add(Be(r,u+16))),[s,n]=[n,s],u+=64;while(u!==l);let p=Uu.add(s.and(255).shl(1));return u=c,a[0]=a[0].add(t-1&63),i[0]=i[0].add(a[0]),a[0]=a[0].add(i[0]),n=Er(n.add(o).add(i[0]).add(Be(r,u+8)),37).mul(p),o=Er(o.add(i[1]).add(Be(r,u+48)),42).mul(p),n=n.xor(a[1].mul(9)),o=o.add(i[0].mul(9).add(Be(r,u+40))),s=Er(s.add(a[0]),33).mul(p),i=Cx(r,u,i[1].mul(p),n.add(a[0])),a=Cx(r,u+32,s.add(a[1]),o.add(Be(r,u+16))),[s,n]=[n,s],Xl(Xl(i[0],a[0],p).add(tI(o).mul(K1)).add(s),Xl(i[1],a[1],p).add(n),p)}function a4(r,t){return t==="string"?Yl(r):mm([r],t)}function l4(r,t){return r instanceof Float32Array&&t==="float32"||r instanceof Int32Array&&t==="int32"||r instanceof Uint8Array&&t==="bool"}function mm(r,t){if(t==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(r)&&(r=Yo(r)),G().getBool("DEBUG")&&UC(r,t),l4(r,t))return r;if(t==null||t==="float32"||t==="complex64")return new Float32Array(r);if(t==="int32")return new Int32Array(r);if(t==="bool"){let e=new Uint8Array(r.length);for(let n=0;n{o=n()},i,a=qu();if(this.backendTimer.timerAvailable())i=this.backendTimer.time(s);else{s();for(let l of o)l.dataSync();i=Promise.resolve({kernelMs:qu()-a})}if(G().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let l=0;l{c4(p,c.dtype,t)})}return{kernelName:t,outputs:o,inputs:e,timeMs:i.then(l=>l.kernelMs),extraInfo:i.then(l=>l.getExtraProfileInfo!=null?l.getExtraProfileInfo():"")}}logKernelProfile(t){let{kernelName:e,outputs:n,timeMs:o,inputs:s,extraInfo:i}=t;n.forEach(a=>{Promise.all([a.data(),o,i]).then(u=>{this.logger.logKernelProfile(e,a,u[0],u[1],s,u[2])})})}};function c4(r,t,e){if(t!=="float32")return!1;for(let n=0;n0?h:""} `}}console.log(`%c${u} %c${a} %c${l}D ${p} %c${c} %c${m} %c${i}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}};function X1(r,t,e){let n={},o={};for(let u=0;un[h.id]=!0),f=!0,o[l.id]=!0;break}if(f)break}}let s={};s[e.id]=!0;let i={};for(let u=r.length-1;u>=0;u--){let l=r[u],c=l.inputs;for(let p=0;p=0;o--){let s=t[o],i=[];if(s.outputs.forEach(u=>{let l=r[u.id];l!=null?i.push(l):i.push(null)}),s.gradient==null)throw new Error(`Cannot compute gradient: gradient function not found for ${s.kernelName}.`);let a=s.gradient(i);for(let u in s.inputs){if(!(u in a))throw new Error(`Cannot backprop through input ${u}. Available gradients found: ${Object.keys(a)}.`);let l=e(()=>a[u]());if(l.dtype!=="float32")throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input ${u} must have 'float32' dtype, but has '${l.dtype}'`);let c=s.inputs[u];if(!Pn(l.shape,c.shape))throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input '${u}' has shape '${l.shape}', which does not match the shape of the input '${c.shape}'`);if(r[c.id]==null)r[c.id]=l;else{let p=r[c.id];r[c.id]=n(p,l),p.dispose()}}}}var Z1=20,Qd=3,nI=7;function J1(r,t,e,n){let o=bi(t),s=p4(r,t,e,o),i=t.length,a=Sx(r,t,e,o,s),u=["Tensor"];return n&&(u.push(` dtype: ${e}`),u.push(` rank: ${i}`),u.push(` shape: [${t}]`),u.push(" values:")),u.push(a.map(l=>" "+l).join(` `)),u.join(` `)}function p4(r,t,e,n){let o=Qt(t),s=n[n.length-1],i=new Array(s).fill(0),a=t.length,u=e==="complex64"?eh(r):r;if(a>1)for(let l=0;lZ1){let g=Qd*i,y=Array.from(r.slice(0,g)),b=Array.from(r.slice((a-Qd)*i,a*i));return e==="complex64"&&(y=eh(y),b=eh(b)),["["+y.map((w,v)=>th(w,o[v],e)).join(", ")+", ..., "+b.map((w,v)=>th(w,o[a-Qd+v],e)).join(", ")+"]"]}let h=e==="complex64"?eh(r):Array.from(r);return["["+h.map((g,y)=>th(g,o[y],e)).join(", ")+"]"]}let l=t.slice(1),c=n.slice(1),p=n[0]*i,m=[];if(a>Z1){for(let h=0;h`Length of values '${o}' does not match the size inferred by the shape '${this.size}'.`)}if(e==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||WC(e,this.size),this.strides=bi(t)}set(t,...e){e.length===0&&(e=[0]),A(e.length===this.rank,()=>`The number of provided coordinates (${e.length}) must match the rank (${this.rank})`);let n=this.locToIndex(e);this.values[n]=t}get(...t){t.length===0&&(t=[0]);let e=0;for(let o of t){if(o<0||o>=this.shape[e]){let s=`Requested out of range element at ${t}. Buffer shape=${this.shape}`;throw new Error(s)}e++}let n=t[t.length-1];for(let o=0;ofm(n))}catch(n){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return t}dataToGPU(t){return this.throwIfDisposed(),Ks().readToGPU(this.dataId,t)}dataSync(){this.throwIfDisposed();let t=Ks().readSync(this.dataId);if(this.dtype==="string")try{return t.map(e=>fm(e))}catch(e){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return t}async bytes(){this.throwIfDisposed();let t=await Ks().read(this.dataId);return this.dtype==="string"?t:new Uint8Array(t.buffer)}dispose(){this.isDisposed||(Ks().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(t=!1){return dm.print(this,t)}clone(){return this.throwIfDisposed(),dm.clone(this)}toString(t=!1){let e=this.dataSync();return J1(e,this.shape,this.dtype,t)}cast(t){return this.throwIfDisposed(),dm.cast(this,t)}variable(t=!0,e,n){return this.throwIfDisposed(),Ks().makeVariable(this,t,e,n)}};Object.defineProperty(zt,Symbol.hasInstance,{value:r=>!!r&&r.data!=null&&r.dataSync!=null&&r.throwIfDisposed!=null});function L(){return qd("Tensor",()=>zt)}L();var Ua=class extends zt{constructor(t,e,n,o){super(t.shape,t.dtype,t.dataId,o),this.trainable=e,this.name=n}assign(t){if(t.dtype!==this.dtype)throw new Error(`dtype of the new value (${t.dtype}) and previous value (${this.dtype}) must match`);if(!Pn(t.shape,this.shape))throw new Error(`shape of the new value (${t.shape}) and previous value (${this.shape}) must match`);Ks().disposeTensor(this),this.dataId=t.dataId,Ks().incRef(this,null)}dispose(){Ks().disposeVariable(this),this.isDisposedInternal=!0}};Object.defineProperty(Ua,Symbol.hasInstance,{value:r=>r instanceof zt&&r.assign!=null&&r.assign instanceof Function});var ho={};Zt(ho,{assertTypesMatch:()=>uI,getTensorsInContainer:()=>rh,isTensorInList:()=>d4,makeTypesMatch:()=>Xt});var oI;(function(r){r.R0="R0",r.R1="R1",r.R2="R2",r.R3="R3",r.R4="R4",r.R5="R5",r.R6="R6"})(oI||(oI={}));var sI;(function(r){r.float32="float32",r.int32="int32",r.bool="int32",r.complex64="complex64"})(sI||(sI={}));var iI;(function(r){r.float32="float32",r.int32="int32",r.bool="bool",r.complex64="complex64"})(iI||(iI={}));var aI;(function(r){r.float32="float32",r.int32="float32",r.bool="float32",r.complex64="complex64"})(aI||(aI={}));var lI;(function(r){r.float32="complex64",r.int32="complex64",r.bool="complex64",r.complex64="complex64"})(lI||(lI={}));var f4={float32:aI,int32:sI,bool:iI,complex64:lI};function ar(r,t){if(r==="string"||t==="string"){if(r==="string"&&t==="string")return"string";throw new Error(`Can not upcast ${r} with ${t}`)}return f4[r][t]}function Ku(r){return ar(r,"int32")}function Xt(r,t){if(r.dtype===t.dtype)return[r,t];let e=ar(r.dtype,t.dtype);return[r.cast(e),t.cast(e)]}function uI(r,t){A(r.dtype===t.dtype,()=>`The dtypes of the first(${r.dtype}) and second(${t.dtype}) input must match`)}function d4(r,t){return t.some(e=>e.id===r.id)}function rh(r){let t=[];return n_(r,t,new Set),t}function n_(r,t,e){if(r==null)return;if(r instanceof zt){t.push(r);return}if(!h4(r))return;let n=r;for(let o in n){let s=n[o];e.has(s)||(e.add(s),n_(s,t,e))}}function h4(r){return Array.isArray(r)||typeof r=="object"}function cI(r){return r.kernelName!=null}var kx=class{constructor(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map(t=>t.name)))}}}dispose(){for(let t in this.registeredVariables)this.registeredVariables[t].dispose()}},Zl=class{constructor(t){this.ENV=t,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new kx}async ready(){if(this.pendingBackendInit!=null)return this.pendingBackendInit.then(()=>{});if(this.backendInstance!=null)return;let t=this.getSortedBackends();for(let e=0;e{e.setupFunc!=null&&e.setupFunc(this.backendInstance)})}disposeRegisteredKernels(t){wx(t).forEach(n=>{n.disposeFunc!=null&&n.disposeFunc(this.registry[t])})}initializeBackend(t){let e=this.registryFactory[t];if(e==null)throw new Error(`Cannot initialize backend ${t}, no registration found.`);try{let n=e.factory();if(n&&!(n instanceof Xo)&&typeof n.then=="function"){let o=++this.pendingBackendInitId,s=n.then(i=>o(othis.registryFactory[e].priority-this.registryFactory[t].priority)}initializeBackendsAndReturnBest(){let t=this.getSortedBackends();for(let e=0;ethis.startScope(n),()=>this.endScope(o),()=>(o=e(),o instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),o))}scopedRun(t,e,n){t();try{let o=n();return e(),o}catch(o){throw e(),o}}nextTensorId(){return Zl.nextTensorId++}nextVariableId(){return Zl.nextVariableId++}clone(t){let e=E.runKernel(uo,{x:t}),n={x:t},o=i=>({x:()=>{let a="float32",u={x:i},l={dtype:a};return E.runKernel(ao,u,l)}}),s=[];return this.addTapeNode(this.state.activeScope.name,n,[e],o,s,{}),e}runKernel(t,e,n){if(this.backendName==null&&this.backend,!(Zd(t,this.backendName)!=null))throw new Error(`Kernel '${t}' not registered for backend '${this.backendName}'`);return this.runKernelFunc({kernelName:t,inputs:e,attrs:n})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(t,e,n){let o=this.backend.numDataIds(),s=0;n.forEach(u=>{s+=u.dtype==="complex64"?3:1});let i=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],a=o-e-s-i;if(a>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${a} data ids) after running '${t}'`)}runKernelFunc(t){let e,n=[],o=this.isTapeOn(),s=this.state.numBytes,i=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);let a;this.backendName==null&&this.backend;let u,l=cI(t)?t.kernelName:this.state.activeScope!=null?this.state.activeScope.name:"";if(cI(t)){let{kernelName:d,inputs:h,attrs:g}=t;this.backendName==null&&this.backend;let y=Zd(d,this.backendName);A(y!=null,()=>`Cannot find registered kernel '${d}' for backend '${this.backendName}'`),a=()=>{let b=this.backend.numDataIds();u=y.kernelFunc({inputs:h,attrs:g,backend:this.backend});let w=Array.isArray(u)?u:[u];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(d,b,w);let v=w.map(k=>k.rank!=null?k:this.makeTensorFromTensorInfo(k));if(o){let k=this.getTensorsForGradient(d,h,v);n=this.saveTensorsForBackwardMode(k)}return v}}else{let{forwardFunc:d}=t,h=g=>{!o||(n=g.map(y=>this.keep(this.clone(y))))};a=()=>{let g=this.backend.numDataIds();u=this.tidy(()=>d(this.backend,h));let y=Array.isArray(u)?u:[u];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(l,g,y),y}}let{inputs:c,attrs:p}=t,m=cI(t)?null:t.backwardsFunc,f;return this.scopedRun(()=>this.state.kernelDepth++,()=>this.state.kernelDepth--,()=>{!this.ENV.getBool("DEBUG")&&!this.state.profiling?e=a():(f=this.profiler.profileKernel(l,c,()=>a()),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(f),e=f.outputs)}),o&&this.addTapeNode(l,c,e,m,n,p),this.state.profiling&&this.state.activeProfile.kernels.push({name:l,bytesAdded:this.state.numBytes-s,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-i,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(c).map(d=>c[d]!=null?c[d].shape:null),outputShapes:e.map(d=>d.shape),kernelTimeMs:f.timeMs,extraInfo:f.extraInfo}),Array.isArray(u)?e:e[0]}saveTensorsForBackwardMode(t){return t.map(n=>this.keep(this.clone(n)))}getTensorsForGradient(t,e,n){let o=YC(t);if(o!=null){let s=o.inputsToSave||[],i=o.outputsToSave||[],a;o.saveAllInputs?(A(Array.isArray(e),()=>"saveAllInputs is true, expected inputs to be an array."),a=Object.keys(e).map(l=>e[l])):a=s.map(l=>e[l]);let u=n.filter((l,c)=>i[c]);return a.concat(u)}return[]}makeTensor(t,e,n,o){if(t==null)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",o=o||this.backend;let s=t;n==="string"&&Zo(t[0])&&(s=t.map(u=>Yl(u)));let i=o.write(s,e,n),a=new zt(e,n,i,this.nextTensorId());if(this.trackTensor(a,o),n==="string"){let u=this.state.tensorInfo.get(i),l=qC(s);this.state.numBytes+=l-u.bytes,u.bytes=l}return a}makeTensorFromDataId(t,e,n,o){n=n||"float32";let s={dataId:t,shape:e,dtype:n};return this.makeTensorFromTensorInfo(s,o)}makeTensorFromTensorInfo(t,e){let{dataId:n,shape:o,dtype:s}=t,i=new zt(o,s,n,this.nextTensorId());return this.trackTensor(i,e),i}makeVariable(t,e=!0,n,o){n=n||this.nextVariableId().toString(),o!=null&&o!==t.dtype&&(t=t.cast(o));let s=new Ua(t,e,n,this.nextTensorId());if(this.state.registeredVariables[s.name]!=null)throw new Error(`Variable with name ${s.name} was already registered`);return this.state.registeredVariables[s.name]=s,this.incRef(s,this.backend),s}trackTensor(t,e){this.state.numTensors++,t.dtype==="string"&&this.state.numStringTensors++;let n=0;t.dtype!=="complex64"&&t.dtype!=="string"&&(n=t.size*bx(t.dtype)),this.state.numBytes+=n,this.state.tensorInfo.has(t.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(t.dataId,{backend:e||this.backend,dtype:t.dtype,shape:t.shape,bytes:n})),t instanceof Ua||this.track(t)}incRef(t,e){this.trackTensor(t,e),this.backend.incRef(t.dataId)}removeDataId(t,e){this.state.tensorInfo.has(t)&&this.state.tensorInfo.get(t).backend===e&&(this.state.tensorInfo.delete(t),this.state.numDataBuffers--)}disposeTensor(t){if(!this.state.tensorInfo.has(t.dataId))return;let e=this.state.tensorInfo.get(t.dataId);if(this.state.numTensors--,t.dtype==="string"&&(this.state.numStringTensors--,this.state.numBytes-=e.bytes),t.dtype!=="complex64"&&t.dtype!=="string"){let n=t.size*bx(t.dtype);this.state.numBytes-=n}e.backend.disposeData(t.dataId)&&this.removeDataId(t.dataId,e.backend)}disposeVariables(){for(let t in this.state.registeredVariables){let e=this.state.registeredVariables[t];this.disposeVariable(e)}}disposeVariable(t){this.disposeTensor(t),this.state.registeredVariables[t.name]!=null&&delete this.state.registeredVariables[t.name]}memory(){let t=this.backend.memory();return t.numTensors=this.state.numTensors,t.numDataBuffers=this.state.numDataBuffers,t.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(t.unreliable=!0,t.reasons==null&&(t.reasons=[]),t.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),t}async profile(t){this.state.profiling=!0;let e=this.state.numBytes,n=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await t(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map(o=>o.totalBytesSnapshot)),this.state.activeProfile.newBytes=this.state.numBytes-e,this.state.activeProfile.newTensors=this.state.numTensors-n;for(let o of this.state.activeProfile.kernels)o.kernelTimeMs=await o.kernelTimeMs,o.extraInfo=await o.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&this.state.kernelDepth===0}addTapeNode(t,e,n,o,s,i){let a={id:this.state.nextTapeNodeId++,kernelName:t,inputs:e,outputs:n,saved:s},u=YC(t);u!=null&&(o=u.gradFunc),o!=null&&(a.gradient=l=>(l=l.map((c,p)=>{if(c==null){let m=n[p],f=Ap(m.size,m.dtype);return this.makeTensor(f,m.shape,m.dtype)}return c}),o(l.length>1?l:l[0],s,i))),this.state.activeTape.push(a)}keep(t){return t.kept=!0,t}startTape(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(t){let e={track:[],name:"unnamed scope",id:this.state.nextScopeId++};t&&(e.name=t),this.state.scopeStack.push(e),this.state.activeScope=e}endScope(t){let e=rh(t),n=new Set(e.map(s=>s.id));for(let s=0;s{!s.kept&&s.scopeId===o.id&&this.track(s)})}gradients(t,e,n,o=!1){if(A(e.length>0,()=>"gradients() received an empty list of xs."),n!=null&&n.dtype!=="float32")throw new Error(`dy must have 'float32' dtype, but has '${n.dtype}'`);let s=this.scopedRun(()=>this.startTape(),()=>this.endTape(),()=>this.tidy("forward",t));A(s instanceof zt,()=>"The result y returned by f() must be a tensor.");let i=X1(this.state.activeTape,e,s);if(!o&&i.length===0&&e.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",()=>{let a={};a[s.id]=n==null?g4(s.shape):n,Y1(a,i,l=>this.tidy(l),x4);let u=e.map(l=>a[l.id]);return this.state.gradientDepth===0&&(this.state.activeTape.forEach(l=>{for(let c of l.saved)c.dispose()}),this.state.activeTape=null),{value:s,grads:u}})}customGrad(t){return A(yi(t),()=>"The f passed in customGrad(f) must be a function."),(...e)=>{A(e.every(a=>a instanceof zt),()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors");let n,o={};e.forEach((a,u)=>{o[u]=a});let s=(a,u)=>(n=t(...e,u),A(n.value instanceof zt,()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),A(yi(n.gradFunc),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),n.value),i=(a,u)=>{let l=n.gradFunc(a,u),c=Array.isArray(l)?l:[l];A(c.length===e.length,()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."),A(c.every(m=>m instanceof zt),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.");let p={};return c.forEach((m,f)=>{p[f]=()=>m}),p};return this.runKernelFunc({forwardFunc:s,backwardsFunc:i,inputs:o})}}readSync(t){return this.state.tensorInfo.get(t).backend.readSync(t)}read(t){return this.state.tensorInfo.get(t).backend.read(t)}readToGPU(t,e){return this.state.tensorInfo.get(t).backend.readToGPU(t,e)}async time(t){let e=qu(),n=await this.backend.time(t);return n.wallMs=qu()-e,n}track(t){return this.state.activeScope!=null&&(t.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(t)),t}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new kx;for(let t in this.registry)this.disposeRegisteredKernels(t),this.registry[t].dispose(),delete this.registry[t];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}};Zl.nextTensorId=0;Zl.nextVariableId=0;function g4(r){let t=Gd(Qt(r),"float32");return E.makeTensor(t,r,"float32")}function pI(){let r=XC();if(r._tfengine==null){let t=new Hd(r);r._tfengine=new Zl(t)}return A1(r._tfengine.ENV),t_(()=>r._tfengine),r._tfengine}var E=pI();function x4(r,t){let e={a:r,b:t};return E.runKernel(Xn,e)}var Jl={};Zt(Jl,{isBrowser:()=>fI,isMobile:()=>w4,mockIsMobile:()=>b4});function y4(){return typeof navigator!="undefined"&&navigator!=null}var mI;function b4(r){mI=r}function w4(r){if(mI!==void 0)return mI;if(r||y4()){if(r||(r=navigator),r.product==="ReactNative")return!0;let t=r.userAgent||r.vendor||(typeof window!="undefined"?window.opera:"");if(!t){let e=r;return e.userAgentData&&e.userAgentData.mobile}return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))}return!1}function fI(){return typeof window!="undefined"&&window.document!=null||typeof WorkerGlobalScope!="undefined"}var go=G();go.registerFlag("DEBUG",()=>!1,r=>{r&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")});go.registerFlag("IS_BROWSER",()=>fI());go.registerFlag("IS_NODE",()=>typeof process!="undefined"&&typeof process.versions!="undefined"&&typeof process.versions.node!="undefined");go.registerFlag("IS_CHROME",()=>typeof navigator!="undefined"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor));go.registerFlag("PROD",()=>!1);go.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",()=>go.getBool("DEBUG"));go.registerFlag("DEPRECATION_WARNINGS_ENABLED",()=>!0);go.registerFlag("IS_TEST",()=>!1);go.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",()=>!0);go.registerFlag("WRAP_TO_IMAGEBITMAP",()=>!1);go.registerFlag("ENGINE_COMPILE_ONLY",()=>!1);function Or(r,t){let e=r;if(yr(r))return t==="string"?[]:[r.length];if(!Array.isArray(r))return[];let n=[];for(;Array.isArray(e)||yr(e)&&t!=="string";)n.push(e.length),e=e[0];return Array.isArray(r)&&G().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&s_(r,n,[]),n}function s_(r,t,e){if(e=e||[],!Array.isArray(r)&&!yr(r)){A(t.length===0,()=>`Element arr[${e.join("][")}] is a primitive, but should be an array/TypedArray of ${t[0]} elements`);return}A(t.length>0,()=>`Element arr[${e.join("][")}] should be a primitive, but is an array of ${r.length} elements`),A(r.length===t[0],()=>`Element arr[${e.join("][")}] should have ${t[0]} elements, but has ${r.length} elements`);let n=t.slice(1);for(let o=0;o=0&&(o=n),o_(n,o,t,e),r==null||!yr(r)&&!Array.isArray(r)&&typeof r!="number"&&typeof r!="boolean"&&typeof r!="string"){let u=r==null?"null":r.constructor.name;throw new Error(`Argument '${t}' passed to '${e}' must be a Tensor or TensorLike, but got '${u}'`)}let s=Or(r,o);!yr(r)&&!Array.isArray(r)&&(r=[r]);let a=o!=="string"?mm(r,o):Yo(r,[],!0);return E.makeTensor(a,s,o)}function Ha(r,t,e,n="numeric"){if(!Array.isArray(r))throw new Error(`Argument ${t} passed to ${e} must be a \`Tensor[]\` or \`TensorLike[]\``);return r.map((s,i)=>C(s,`${t}[${i}]`,e,n))}var i_="__op";function N(r){let t=Object.keys(r);if(t.length!==1)throw new Error(`Please provide an object with a single key (operation name) mapping to a function. Got an object with ${t.length} keys.`);let e=t[0],n=r[e];e.endsWith("_")&&(e=e.substring(0,e.length-1)),e=e+i_;let o=(...s)=>{E.startScope(e);try{let i=n(...s);return Ud(i)&&console.error("Cannot return a Promise inside of tidy."),E.endScope(i),i}catch(i){throw E.endScope(null),i}};return Object.defineProperty(o,"name",{value:e,configurable:!0}),o}function v4(r,t){let e=C(r,"real","complex"),n=C(t,"imag","complex");Me(e.shape,n.shape,`real and imag shapes, ${e.shape} and ${n.shape}, must match in call to tf.complex().`);let o={real:e,imag:n};return E.runKernel(Op,o)}var cn=N({complex_:v4});function pn(r,t,e,n){if(n==null&&(n=_p(r)),n==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!yr(r)&&!Array.isArray(r)&&typeof r!="number"&&typeof r!="boolean"&&typeof r!="string")throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(t!=null){Wd(t);let o=Qt(t),s=Qt(e);A(o===s,()=>`Based on the provided shape, [${t}], the tensor should have ${o} values but has ${s}`);for(let i=0;i`Error creating a new Tensor. Inferred shape (${e}) does not match the provided shape (${t}). `)}}return!yr(r)&&!Array.isArray(r)&&(r=[r]),t=t||e,r=n!=="string"?mm(r,n):Yo(r,[],!0),E.makeTensor(r,t,n)}function Ar(r,t,e){let n=Or(r,e);return pn(r,t,n,e)}var nh={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8};var Nx=4;async function l_(r,t){let e=[],n=[],o=Array.isArray(r)?r.map(i=>i.name):Object.keys(r);for(let i=0;i{let m=await u.bytes(),f=m.reduce((g,y)=>g+y.length,0)+Nx*m.length,d=new Uint8Array(f),h=0;for(let g=0;g{if(t+=s.byteLength,e.push(s.byteLength===s.buffer.byteLength?s:new s.constructor(s)),!(s instanceof Float32Array||s instanceof Int32Array||s instanceof Uint8Array))throw new Error(`Unsupported TypedArray subtype: ${s.constructor.name}`)});let n=new Uint8Array(t),o=0;return e.forEach(s=>{n.set(new Uint8Array(s.buffer),o),o+=s.byteLength}),n.buffer}var dI=typeof Buffer!="undefined"&&(typeof Blob=="undefined"||typeof atob=="undefined"||typeof btoa=="undefined");function a_(r){return dI?Buffer.byteLength(r):new Blob([r]).size}function u_(r){if(dI)return Buffer.from(r).toString("base64");let t=new Uint8Array(r),e="";for(let n=0,o=t.length;n{t+=o.byteLength});let e=new Uint8Array(t),n=0;return r.forEach(o=>{e.set(new Uint8Array(o),n),n+=o.byteLength}),e.buffer}function hI(r){let t="/";for(r=r.trim();r.endsWith(t);)r=r.slice(0,r.length-1);let e=r.split(t);return e[e.length-1]}function _x(r,t){let e={modelTopology:r.modelTopology,format:r.format,generatedBy:r.generatedBy,convertedBy:r.convertedBy,weightsManifest:t};return r.signature!=null&&(e.signature=r.signature),r.userDefinedMetadata!=null&&(e.userDefinedMetadata=r.userDefinedMetadata),r.modelInitializer!=null&&(e.modelInitializer=r.modelInitializer),r.trainingConfig!=null&&(e.trainingConfig=r.trainingConfig),e}async function gm(r,t){let e={modelTopology:r.modelTopology,format:r.format,generatedBy:r.generatedBy,convertedBy:r.convertedBy};if(r.trainingConfig!=null&&(e.trainingConfig=r.trainingConfig),r.weightsManifest!=null){let[n,o]=await t(r.weightsManifest);e.weightSpecs=n,e.weightData=o}return r.signature!=null&&(e.signature=r.signature),r.userDefinedMetadata!=null&&(e.userDefinedMetadata=r.userDefinedMetadata),r.modelInitializer!=null&&(e.modelInitializer=r.modelInitializer),e}function zi(r){if(r.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:r.modelTopology==null?0:a_(JSON.stringify(r.modelTopology)),weightSpecsBytes:r.weightSpecs==null?0:a_(JSON.stringify(r.weightSpecs)),weightDataBytes:r.weightData==null?0:r.weightData.byteLength}}function I4(){let r=e=>{let n=e<<13,o=0;for(;(n&8388608)===0;)o-=8388608,n<<=1;return n&=-8388609,o+=947912704,n|o},t=new Uint32Array(2048);t[0]=0;for(let e=1;e<1024;e++)t[e]=r(e);for(let e=1024;e<2048;e++)t[e]=939524096+(e-1024<<13);return t}function S4(){let r=new Uint32Array(64);r[0]=0,r[31]=1199570944,r[32]=2147483648,r[63]=3347054592;for(let t=1;t<31;t++)r[t]=t<<23;for(let t=33;t<63;t++)r[t]=2147483648+(t-32<<23);return r}function k4(){let r=new Uint32Array(64);for(let t=0;t<64;t++)r[t]=1024;return r[0]=r[32]=0,r}function N4(){let r=I4(),t=S4(),e=k4();return n=>{let o=new ArrayBuffer(4*n.length),s=new Uint32Array(o);for(let i=0;i>10]+(a&1023)]+t[a>>10];s[i]=u}return new Float32Array(o)}}var Ne=class{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return Ne.instance==null&&(Ne.instance=new Ne),Ne.instance}static registerSaveRouter(t){Ne.getInstance().saveRouters.push(t)}static registerLoadRouter(t){Ne.getInstance().loadRouters.push(t)}static getSaveHandlers(t){return Ne.getHandlers(t,"save")}static getLoadHandlers(t,e){return Ne.getHandlers(t,"load",e)}static getHandlers(t,e,n){let o=[];return(e==="load"?Ne.getInstance().loadRouters:Ne.getInstance().saveRouters).forEach(i=>{let a=i(t,n);a!==null&&o.push(a)}),o}},p_=r=>Ne.registerSaveRouter(r),m_=r=>Ne.registerLoadRouter(r),f_=r=>Ne.getSaveHandlers(r),d_=(r,t)=>Ne.getLoadHandlers(r,t);var gI="tensorflowjs",xI=1,ju="models_store",Ql="model_info_store";function h_(){if(!G().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");let r=typeof window=="undefined"?self:window,t=r.indexedDB||r.mozIndexedDB||r.webkitIndexedDB||r.msIndexedDB||r.shimIndexedDB;if(t==null)throw new Error("The current browser does not appear to support IndexedDB.");return t}function yI(r){let t=r.result;t.createObjectStore(ju,{keyPath:"modelPath"}),t.createObjectStore(Ql,{keyPath:"modelPath"})}var Bi=class{constructor(t){if(this.indexedDB=h_(),t==null||!t)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=t}async save(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,t)}async load(){return this.databaseAction(this.modelPath)}databaseAction(t,e){return new Promise((n,o)=>{let s=this.indexedDB.open(gI,xI);s.onupgradeneeded=()=>yI(s),s.onsuccess=()=>{let i=s.result;if(e==null){let a=i.transaction(ju,"readonly"),l=a.objectStore(ju).get(this.modelPath);l.onsuccess=()=>{if(l.result==null)return i.close(),o(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));n(l.result.modelArtifacts)},l.onerror=c=>(i.close(),o(l.error)),a.oncomplete=()=>i.close()}else{let a=zi(e),u=i.transaction(Ql,"readwrite"),l=u.objectStore(Ql),c=l.put({modelPath:this.modelPath,modelArtifactsInfo:a}),p;c.onsuccess=()=>{p=i.transaction(ju,"readwrite");let f=p.objectStore(ju).put({modelPath:this.modelPath,modelArtifacts:e,modelArtifactsInfo:a});f.onsuccess=()=>n({modelArtifactsInfo:a}),f.onerror=d=>{l=u.objectStore(Ql);let h=l.delete(this.modelPath);h.onsuccess=()=>(i.close(),o(f.error)),h.onerror=g=>(i.close(),o(f.error))}},c.onerror=m=>(i.close(),o(c.error)),u.oncomplete=()=>{p==null?i.close():p.oncomplete=()=>i.close()}}},s.onerror=i=>o(s.error)})}};Bi.URL_SCHEME="indexeddb://";var g_=r=>G().getBool("IS_BROWSER")&&!Array.isArray(r)&&r.startsWith(Bi.URL_SCHEME)?T4(r.slice(Bi.URL_SCHEME.length)):null;Ne.registerSaveRouter(g_);Ne.registerLoadRouter(g_);function T4(r){return new Bi(r)}function _4(r){return r.startsWith(Bi.URL_SCHEME)?r.slice(Bi.URL_SCHEME.length):r}var Ex=class{constructor(){this.indexedDB=h_()}async listModels(){return new Promise((t,e)=>{let n=this.indexedDB.open(gI,xI);n.onupgradeneeded=()=>yI(n),n.onsuccess=()=>{let o=n.result,s=o.transaction(Ql,"readonly"),a=s.objectStore(Ql).getAll();a.onsuccess=()=>{let u={};for(let l of a.result)u[l.modelPath]=l.modelArtifactsInfo;t(u)},a.onerror=u=>(o.close(),e(a.error)),s.oncomplete=()=>o.close()},n.onerror=o=>e(n.error)})}async removeModel(t){return t=_4(t),new Promise((e,n)=>{let o=this.indexedDB.open(gI,xI);o.onupgradeneeded=()=>yI(o),o.onsuccess=()=>{let s=o.result,i=s.transaction(Ql,"readwrite"),a=i.objectStore(Ql),u=a.get(t),l;u.onsuccess=()=>{if(u.result==null)return s.close(),n(new Error(`Cannot find model with path '${t}' in IndexedDB.`));{let c=a.delete(t),p=()=>{l=s.transaction(ju,"readwrite");let f=l.objectStore(ju).delete(t);f.onsuccess=()=>e(u.result.modelArtifactsInfo),f.onerror=d=>n(u.error)};c.onsuccess=p,c.onerror=m=>(p(),s.close(),n(u.error))}},u.onerror=c=>(s.close(),n(u.error)),i.oncomplete=()=>{l==null?s.close():l.oncomplete=()=>s.close()}},o.onerror=s=>n(o.error)})}};var qa="/",xm="tensorflowjs_models",x_="info",E4="model_topology",A4="weight_specs",$4="weight_data",D4="model_metadata";function y_(r){return{info:[xm,r,x_].join(qa),topology:[xm,r,E4].join(qa),weightSpecs:[xm,r,A4].join(qa),weightData:[xm,r,$4].join(qa),modelMetadata:[xm,r,D4].join(qa)}}function b_(r){for(let t of Object.values(r))window.localStorage.removeItem(t)}function F4(r){let t=r.split(qa);if(t.length<3)throw new Error(`Invalid key format: ${r}`);return t.slice(1,t.length-1).join(qa)}function R4(r){return r.startsWith(Vi.URL_SCHEME)?r.slice(Vi.URL_SCHEME.length):r}var Vi=class{constructor(t){if(!G().getBool("IS_BROWSER")||typeof window=="undefined"||typeof window.localStorage=="undefined")throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,t==null||!t)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=t,this.keys=y_(this.modelPath)}async save(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{let e=JSON.stringify(t.modelTopology),n=JSON.stringify(t.weightSpecs),o=zi(t);try{this.LS.setItem(this.keys.info,JSON.stringify(o)),this.LS.setItem(this.keys.topology,e),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,u_(t.weightData));let s={format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,signature:t.signature!=null?t.signature:void 0,userDefinedMetadata:t.userDefinedMetadata!=null?t.userDefinedMetadata:void 0,modelInitializer:t.modelInitializer!=null?t.modelInitializer:void 0,trainingConfig:t.trainingConfig!=null?t.trainingConfig:void 0};return this.LS.setItem(this.keys.modelMetadata,JSON.stringify(s)),{modelArtifactsInfo:o}}catch(s){throw b_(this.keys),new Error(`Failed to save model '${this.modelPath}' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes=${o.modelTopologyBytes}, weightSpecsBytes=${o.weightSpecsBytes}, weightDataBytes=${o.weightDataBytes}.`)}}}async load(){let t=JSON.parse(this.LS.getItem(this.keys.info));if(t==null)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if(t.modelTopologyType!=="JSON")throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");let e={},n=JSON.parse(this.LS.getItem(this.keys.topology));if(n==null)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);e.modelTopology=n;let o=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(o==null)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);e.weightSpecs=o;let s=this.LS.getItem(this.keys.modelMetadata);if(s!=null){let a=JSON.parse(s);e.format=a.format,e.generatedBy=a.generatedBy,e.convertedBy=a.convertedBy,a.signature!=null&&(e.signature=a.signature),a.userDefinedMetadata!=null&&(e.userDefinedMetadata=a.userDefinedMetadata),a.modelInitializer!=null&&(e.modelInitializer=a.modelInitializer),a.trainingConfig!=null&&(e.trainingConfig=a.trainingConfig)}let i=this.LS.getItem(this.keys.weightData);if(i==null)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);return e.weightData=c_(i),e}};Vi.URL_SCHEME="localstorage://";var w_=r=>G().getBool("IS_BROWSER")&&!Array.isArray(r)&&r.startsWith(Vi.URL_SCHEME)?O4(r.slice(Vi.URL_SCHEME.length)):null;Ne.registerSaveRouter(w_);Ne.registerLoadRouter(w_);function O4(r){return new Vi(r)}var Ax=class{constructor(){A(G().getBool("IS_BROWSER"),()=>"Current environment is not a web browser"),A(typeof window=="undefined"||typeof window.localStorage!="undefined",()=>"Current browser does not appear to support localStorage"),this.LS=window.localStorage}async listModels(){let t={},e=xm+qa,n=qa+x_;for(let o=0;o"scheme must not be undefined or null."),t.endsWith(ym)&&(t=t.slice(0,t.indexOf(ym))),A(t.length>0,()=>"scheme must not be an empty string.");let n=Xr.getInstance();A(n.managers[t]==null,()=>`A model store manager is already registered for scheme '${t}'.`),n.managers[t]=e}static getManager(t){let e=this.getInstance().managers[t];if(e==null)throw new Error(`Cannot find model manager for scheme '${t}'`);return e}static getSchemes(){return Object.keys(this.getInstance().managers)}};function $x(r){if(r.indexOf(ym)===-1)throw new Error(`The url string provided does not contain a scheme. Supported schemes are: ${Xr.getSchemes().join(",")}`);return{scheme:r.split(ym)[0],path:r.split(ym)[1]}}async function v_(r,t,e=!1){A(r!==t,()=>`Old path and new path are the same: '${r}'`);let n=Ne.getLoadHandlers(r);A(n.length>0,()=>`Copying failed because no load handler is found for source URL ${r}.`),A(n.length<2,()=>`Copying failed because more than one (${n.length}) load handlers for source URL ${r}.`);let o=n[0],s=Ne.getSaveHandlers(t);A(s.length>0,()=>`Copying failed because no save handler is found for destination URL ${t}.`),A(s.length<2,()=>`Copying failed because more than one (${n.length}) save handlers for destination URL ${t}.`);let i=s[0],a=$x(r).scheme,u=$x(r).path,l=a===$x(r).scheme,c=await o.load();e&&l&&await Xr.getManager(a).removeModel(u);let p=await i.save(c);return e&&!l&&await Xr.getManager(a).removeModel(u),p.modelArtifactsInfo}async function C_(){let r=Xr.getSchemes(),t={};for(let e of r){let n=await Xr.getManager(e).listModels();for(let o in n){let s=e+ym+o;t[s]=n[o]}}return t}async function I_(r){let t=$x(r);return Xr.getManager(t.scheme).removeModel(t.path)}async function S_(r,t){return v_(r,t,!1)}async function k_(r,t){return v_(r,t,!0)}var bI=class{fetch(t,e){return fetch(t,e)}now(){return performance.now()}encode(t,e){if(e!=="utf-8"&&e!=="utf8")throw new Error(`Browser's encoder only supports utf-8, but got ${e}`);return this.textEncoder==null&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(t)}decode(t,e){return new TextDecoder(e).decode(t)}};if(G().get("IS_BROWSER")){G().setPlatform("browser",new bI);try{Xr.registerManager(Vi.URL_SCHEME,new Ax)}catch(r){}try{Xr.registerManager(Bi.URL_SCHEME,new Ex)}catch(r){}}var M4={importFetch:()=>N_()},wI;var vI=class{constructor(){this.util=T_(),this.textEncoder=new this.util.TextEncoder}fetch(t,e){return G().global.fetch!=null?G().global.fetch(t,e):(wI==null&&(wI=M4.importFetch()),wI(t,e))}now(){let t=process.hrtime();return t[0]*1e3+t[1]/1e6}encode(t,e){if(e!=="utf-8"&&e!=="utf8")throw new Error(`Node built-in encoder only supports utf-8, but got ${e}`);return this.textEncoder.encode(t)}decode(t,e){return t.length===0?"":new this.util.TextDecoder(e).decode(t)}};G().get("IS_NODE")&&!G().get("IS_BROWSER")&&G().setPlatform("node",new vI);function Ct(r,t="float32",e){return t=t||"float32",Wd(r),new pe(r,t,e)}function P4(r,t){let e=C(r,"x","cast");if(!HC(t))throw new Error(`Failed to cast to unknown dtype ${t}`);if(t==="string"&&e.dtype!=="string"||t!=="string"&&e.dtype==="string")throw new Error("Only strings can be casted to strings");let n={x:e},o={dtype:t};return E.runKernel(ao,n,o)}var Z=N({cast_:P4});function L4(r){let e={x:C(r,"x","clone","string_or_numeric")};return E.runKernel(uo,e)}var Nn=N({clone_:L4});function CI(r,t=!1){console.log(r.toString(t))}pI();var z4={buffer:Ct,cast:Z,clone:Nn,print:CI};e_(z4);var Mr={};Zt(Mr,{browserFiles:()=>E_,browserHTTPRequest:()=>D_,concatenateArrayBuffers:()=>hm,copyModel:()=>S_,decodeWeights:()=>Tx,encodeWeights:()=>l_,fromMemory:()=>F_,fromMemorySync:()=>_I,getLoadHandlers:()=>d_,getModelArtifactsForJSON:()=>gm,getModelArtifactsInfoForJSON:()=>zi,getSaveHandlers:()=>f_,http:()=>Fx,isHTTPScheme:()=>Dx,listModels:()=>C_,loadWeights:()=>A_,moveModel:()=>k_,registerLoadRouter:()=>m_,registerSaveRouter:()=>p_,removeModel:()=>I_,weightsLoaderFactory:()=>NI,withSaveHandler:()=>R_,withSaveHandlerSync:()=>O_});var B4="model",V4=".json",G4=".weights.bin";function __(r){return new Promise(t=>setTimeout(t)).then(r)}var Ka=class{constructor(t){if(!G().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");t.startsWith(Ka.URL_SCHEME)&&(t=t.slice(Ka.URL_SCHEME.length)),(t==null||t.length===0)&&(t=B4),this.modelJsonFileName=t+V4,this.weightDataFileName=t+G4}async save(t){if(typeof document=="undefined")throw new Error("Browser downloads are not supported in this environment since `document` is not present");let e=window.URL.createObjectURL(new Blob([t.weightData],{type:"application/octet-stream"}));if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");{let n=[{paths:["./"+this.weightDataFileName],weights:t.weightSpecs}],o=_x(t,n),s=window.URL.createObjectURL(new Blob([JSON.stringify(o)],{type:"application/json"})),i=this.modelJsonAnchor==null?document.createElement("a"):this.modelJsonAnchor;if(i.download=this.modelJsonFileName,i.href=s,await __(()=>i.dispatchEvent(new MouseEvent("click"))),t.weightData!=null){let a=this.weightDataAnchor==null?document.createElement("a"):this.weightDataAnchor;a.download=this.weightDataFileName,a.href=e,await __(()=>a.dispatchEvent(new MouseEvent("click")))}return{modelArtifactsInfo:zi(t)}}}};Ka.URL_SCHEME="downloads://";var II=class{constructor(t){if(t==null||t.length<1)throw new Error(`When calling browserFiles, at least 1 file is required, but received ${t}`);this.jsonFile=t[0],this.weightsFiles=t.slice(1)}async load(){return new Promise((t,e)=>{let n=new FileReader;n.onload=o=>{let s=JSON.parse(o.target.result),i=s.modelTopology;if(i==null){e(new Error(`modelTopology field is missing from file ${this.jsonFile.name}`));return}if(s.weightsManifest==null){e(new Error(`weightManifest field is missing from file ${this.jsonFile.name}`));return}if(this.weightsFiles.length===0){t({modelTopology:i});return}let u=gm(s,l=>this.loadWeights(l));t(u)},n.onerror=o=>e(`Failed to read model topology and weights manifest JSON from file '${this.jsonFile.name}'. BrowserFiles supports loading Keras-style tf.Model artifacts only.`),n.readAsText(this.jsonFile)})}loadWeights(t){let e=[],n=[];for(let i of t)e.push(...i.weights),n.push(...i.paths);let o=this.checkManifestAndWeightFiles(t),s=n.map(i=>this.loadWeightsFile(i,o[i]));return Promise.all(s).then(i=>[e,hm(i)])}loadWeightsFile(t,e){return new Promise((n,o)=>{let s=new FileReader;s.onload=i=>{let a=i.target.result;n(a)},s.onerror=i=>o(`Failed to weights data from file of path '${t}'.`),s.readAsArrayBuffer(e)})}checkManifestAndWeightFiles(t){let e=[],n=this.weightsFiles.map(s=>hI(s.name)),o={};for(let s of t)s.paths.forEach(i=>{let a=hI(i);if(e.indexOf(a)!==-1)throw new Error(`Duplicate file basename found in weights manifest: '${a}'`);if(e.push(a),n.indexOf(a)===-1)throw new Error(`Weight file with basename '${a}' is not provided.`);o[i]=this.weightsFiles[n.indexOf(a)]});if(e.length!==this.weightsFiles.length)throw new Error(`Mismatch in the number of files in weights manifest (${e.length}) and the number of weight files provided (${this.weightsFiles.length}).`);return o}},W4=r=>G().getBool("IS_BROWSER")&&!Array.isArray(r)&&r.startsWith(Ka.URL_SCHEME)?U4(r.slice(Ka.URL_SCHEME.length)):null;Ne.registerSaveRouter(W4);function U4(r="model"){return new Ka(r)}function E_(r){return new II(r)}function SI(r,t,e,n){i(r),e=e==null?0:e,n=n==null?1:n,a(e,n);let o=0,s=u=>(u.then(l=>{let c=e+ ++o/r.length*(n-e);return t(c),l}),u);function i(u){A(u!=null&&Array.isArray(u)&&u.length>0,()=>"promises must be a none empty array")}function a(u,l){A(u>=0&&u<=1,()=>`Progress fraction must be in range [0, 1], but got startFraction ${u}`),A(l>=0&&l<=1,()=>`Progress fraction must be in range [0, 1], but got endFraction ${l}`),A(l>=u,()=>`startFraction must be no more than endFraction, but got startFraction ${u} and endFraction ${l}`)}return Promise.all(r.map(s))}async function kI(r,t){t==null&&(t={});let e=t.fetchFunc==null?G().platform.fetch:t.fetchFunc,n=r.map(p=>e(p,t.requestInit,{isBinary:!0})),o=0,s=.5,a=(t.onProgress==null?await Promise.all(n):await SI(n,t.onProgress,o,s)).map(p=>p.arrayBuffer()),u=.5,l=1;return t.onProgress==null?await Promise.all(a):await SI(a,t.onProgress,u,l)}async function A_(r,t="",e,n){return NI(i=>kI(i,{requestInit:n}))(r,t,e)}function NI(r){return async(t,e="",n)=>{let o=t.map(()=>!1),s={},i=n!=null?n.map(()=>!1):[],a=[];if(t.forEach((f,d)=>{let h=0;f.weights.forEach(g=>{let y="quantization"in g?g.quantization.dtype:g.dtype,b=nh[y]*Qt(g.shape),w=()=>{o[d]=!0,s[d]==null&&(s[d]=[]),s[d].push({manifestEntry:g,groupOffset:h,sizeBytes:b})};n!=null?n.forEach((v,k)=>{v===g.name&&(w(),i[k]=!0)}):w(),a.push(g.name),h+=b})}),!i.every(f=>f)){let f=n.filter((d,h)=>!i[h]);throw new Error(`Could not find weights in manifest with names: ${f.join(", ")}. Manifest JSON has weights with names: ${a.join(", ")}.`)}let u=o.reduce((f,d,h)=>(d&&f.push(h),f),[]),l=[];u.forEach(f=>{t[f].paths.forEach(d=>{let h=e+(e.endsWith("/")?"":"/")+d;l.push(h)})});let c=await r(l),p={},m=0;return u.forEach(f=>{let d=t[f].paths.length,h=0;for(let v=0;v{let k=g.slice(v.groupOffset,v.groupOffset+v.sizeBytes),_=Tx(k,[v.manifestEntry]);for(let $ in _)p[$]=_[$]}),m+=d}),p}}var H4="application/octet-stream",q4="application/json",oh=class{constructor(t,e){if(this.DEFAULT_METHOD="POST",e==null&&(e={}),this.weightPathPrefix=e.weightPathPrefix,this.onProgress=e.onProgress,this.weightUrlConverter=e.weightUrlConverter,e.fetchFunc!=null?(A(typeof e.fetchFunc=="function",()=>"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"),this.fetch=e.fetchFunc):this.fetch=G().platform.fetch,A(t!=null&&t.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(t)&&A(t.length===2,()=>`URL paths for http must have a length of 2, (actual length is ${t.length}).`),this.path=t,e.requestInit!=null&&e.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=e.requestInit||{}}async save(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");let e=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);e.body=new FormData;let n=[{paths:["./model.weights.bin"],weights:t.weightSpecs}],o=_x(t,n);e.body.append("model.json",new Blob([JSON.stringify(o)],{type:q4}),"model.json"),t.weightData!=null&&e.body.append("model.weights.bin",new Blob([t.weightData],{type:H4}),"model.weights.bin");let s=await this.fetch(this.path,e);if(s.ok)return{modelArtifactsInfo:zi(t),responses:[s]};throw new Error(`BrowserHTTPRequest.save() failed due to HTTP response status ${s.status}.`)}async load(){let t=await this.fetch(this.path,this.requestInit);if(!t.ok)throw new Error(`Request to ${this.path} failed with status code ${t.status}. Please verify this URL points to the model JSON of the model to load.`);let e;try{e=await t.json()}catch(s){let i=`Failed to parse model JSON of response from ${this.path}.`;throw this.path.endsWith(".pb")?i+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":i+=" Please make sure the server is serving valid JSON for this request.",new Error(i)}let n=e.modelTopology,o=e.weightsManifest;if(n==null&&o==null)throw new Error(`The JSON from HTTP path ${this.path} contains neither model topology or manifest for weights.`);return gm(e,s=>this.loadWeights(s))}async loadWeights(t){let e=Array.isArray(this.path)?this.path[1]:this.path,[n,o]=K4(e),s=this.weightPathPrefix||n,i=[];for(let c of t)i.push(...c.weights);let a=[],u=[];for(let c of t)for(let p of c.paths)this.weightUrlConverter!=null?u.push(this.weightUrlConverter(p)):a.push(s+p+o);this.weightUrlConverter&&a.push(...await Promise.all(u));let l=await kI(a,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress});return[i,hm(l)]}};oh.URL_SCHEME_REGEX=/^https?:\/\//;function K4(r){let t=r.lastIndexOf("/"),e=r.lastIndexOf("?"),n=r.substring(0,t),o=e>t?r.substring(e):"";return[n+"/",o]}function Dx(r){return r.match(oh.URL_SCHEME_REGEX)!=null}var $_=(r,t)=>{if(typeof fetch=="undefined"&&(t==null||t.fetchFunc==null))return null;{let e=!0;if(Array.isArray(r)?e=r.every(n=>Dx(n)):e=Dx(r),e)return Fx(r,t)}return null};Ne.registerSaveRouter($_);Ne.registerLoadRouter($_);function Fx(r,t){return new oh(r,t)}function D_(r,t){return Fx(r,t)}var sh=class{constructor(t){this.modelArtifacts=t}load(){return this.modelArtifacts}},Rx=class{constructor(t){this.saveHandler=t}save(t){return this.saveHandler(t)}},TI=class{constructor(t){t.load&&(this.load=()=>Promise.resolve(t.load())),t.save&&(this.save=e=>Promise.resolve(t.save(e)))}};function F_(r,t,e,n){let o=arguments;return new TI(_I(...o))}function _I(r,t,e,n){return arguments.length===1?r.modelTopology!=null||r.weightSpecs!=null?new sh(r):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new sh({modelTopology:r})):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new sh({modelTopology:r,weightSpecs:t,weightData:e,trainingConfig:n}))}function R_(r){return new Rx(r)}function O_(r){return new Rx(r)}var L_={};Zt(L_,{confusionMatrix:()=>P_});function j4(r,t,e=!1,n=!1){let o=C(r,"a","matMul"),s=C(t,"b","matMul");[o,s]=Xt(o,s);let i={a:o,b:s},a={transposeA:e,transposeB:n};return E.runKernel(es,i,a)}var Bt=N({matMul_:j4});function X4(r,t,e=1,n=0){if(t<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${t}`);let s={indices:C(r,"indices","oneHot","int32")},i={depth:t,onValue:e,offValue:n};return E.runKernel(Ns,s,i)}var js=N({oneHot_:X4});function qct(){G().set("PROD",!0)}function Kct(){G().set("DEBUG",!0)}function jct(){G().set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")}function EI(r){G().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(r+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}r_(EI);function Xct(){E.disposeVariables()}function xo(){return E}function ih(){return E.memory()}function Yct(r){return E.profile(r)}function V(r,t){return E.tidy(r,t)}function _t(r){rh(r).forEach(e=>e.dispose())}function Pe(r){return E.keep(r)}function Zct(r){return E.time(r)}function Y4(r){return E.setBackend(r)}function Jct(){return E.ready()}function Qct(){return E.backendName}function tpt(r){E.removeBackend(r)}function ept(r){return E.findBackend(r)}function rpt(r){return E.findBackendFactory(r)}function bm(r,t,e=1){return E.registerBackend(r,t,e)}function M_(){return E.backend}function npt(r,t){G().setPlatform(r,t)}function Z4(r){let e={input:C(r,"input","imag")};return E.runKernel(Kp,e)}var ja=N({imag_:Z4});function J4(r){let e={x:C(r,"x","neg")};return E.runKernel(ki,e)}var qt=N({neg_:J4});function Q4(r){let e={input:C(r,"input","real")};return E.runKernel(tm,e)}var Gi=N({real_:Q4});function tH(r,t,e){let n=C(r,"x","transpose");if(t==null&&(t=n.shape.map((i,a)=>a).reverse()),A(n.rank===t.length,()=>`Error in transpose: rank of input ${n.rank} must match length of perm ${t}.`),t.forEach(i=>{A(i>=0&&i`All entries in 'perm' must be between 0 and ${n.rank-1} but got ${t}`)}),n.rank<=1)return n.clone();let o={x:n},s={perm:t};return n.dtype==="complex64"?V(()=>{let i=Gi(n),a=ja(n);return i=E.runKernel(Zn,{x:i},s),a=E.runKernel(Zn,{x:a},s),e&&(a=qt(a)),cn(i,a)}):E.runKernel(Zn,o,s)}var Mt=N({transpose_:tH});function eH(r,t,e){let n=C(r,"labels","confusionMatrix"),o=C(t,"predictions","confusionMatrix");A(e==null||e>0&&Number.isInteger(e),()=>`If provided, numClasses must be a positive integer, but got ${e}`),A(n.rank===1,()=>`Expected the rank of labels to be 1, but got ${n.rank}`),A(o.rank===1,()=>`Expected the rank of predictions to be 1, but got ${o.rank}`),A(n.shape[0]===o.shape[0],()=>`Mismatch in the number of examples: ${n.shape[0]} vs. ${o.shape[0]}. Labels and predictions should have the same number of elements.`),A(e>0&&Number.isInteger(e),()=>`numClasses is required to be a positive integer, but got ${e}`);let s=js(Z(n,"int32"),e),i=js(Z(o,"int32"),e),a=Mt(s),u=Bt(a,i);return Z(u,"int32")}var P_=N({confusionMatrix_:eH});var Pr={};Zt(Pr,{assertAndGetBroadcastShape:()=>Lt,getBroadcastDims:()=>z_,getReductionAxes:()=>xe});function z_(r,t){let e=r.length,n=[];for(let o=0;o1&&i===1&&n.unshift(s)}return n}function xe(r,t){let e=[];for(let n=0;n1)&&e.unshift(s)}return e}function Lt(r,t){let e=[],n=Math.max(r.length,t.length);for(let o=0;olH,fromPixelsAsync:()=>iH,toPixels:()=>aH});function AI(r,t,e){if(jn(r),t!=null&&t.length!==3)throw new Error("tensor3d() requires shape to have three numbers");let n=Or(r,e);if(n.length!==3&&n.length!==1)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(n.length===1&&t==null)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return pn(r,t,n,e)}var Xu;function B_(r,t=3){if(t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(r==null)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");let e=!1,n=!1,o=!1,s=!1,i=!1,a=!1;if(r.data instanceof Uint8Array)e=!0;else if(typeof ImageData!="undefined"&&r instanceof ImageData)n=!0;else if(typeof HTMLVideoElement!="undefined"&&r instanceof HTMLVideoElement)o=!0;else if(typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement)s=!0;else if(r.getContext!=null)i=!0;else if(typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap)a=!0;else throw new Error(`pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, but was ${r.constructor.name}`);if(o&&o&&r.readyState<2)throw new Error("The video element has not loaded data yet. Please wait for `loadeddata` event on the