/* Human homepage: author: ' */ var Human=(()=>{var Gc=Object.defineProperty;var LE=Object.getOwnPropertyDescriptor;var BE=Object.getOwnPropertyNames;var WE=Object.prototype.hasOwnProperty;var VE=(e,t,r)=>t in e?Gc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ks=(e,t)=>{for(var r in t)Gc(e,r,{get:t[r],enumerable:!0})},UE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of BE(t))!WE.call(e,a)&&a!==r&&Gc(e,a,{get:()=>t[a],enumerable:!(n=LE(t,a))||n.enumerable});return e};var GE=e=>UE(Gc({},"__esModule",{value:!0}),e);var fe=(e,t,r)=>(VE(e,typeof t!="symbol"?t+"":t,r),r),$b=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var cp=(e,t,r)=>($b(e,t,"read from private field"),r?r.call(e):t.get(e)),fp=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},mp=(e,t,r,n)=>($b(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var fxe={};ks(fxe,{Human:()=>ub,default:()=>ub,defaults:()=>Is,draw:()=>rb,env:()=>he,match:()=>lb,models:()=>c1});function se(...e){let t=new Date,r=`${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}:${t.getSeconds().toString().padStart(2,"0")}.${t.getMilliseconds().toString().padStart(3,"0")}`;e&&console.log(r,"Human:",...e)}function Mb(e,t){let r=e.endsWith("/")?"":"/",a=t.startsWith(".")||t.startsWith("/")||t.startsWith("http:")||t.startsWith("https:")||t.startsWith("file:")?`${t}`:`${e}${r}${t}`;if(!a.toLocaleLowerCase().includes(".json"))throw new Error(`modelpath error: expecting json file: ${a}`);return a}var oe=()=>typeof performance!="undefined"?performance.now():parseInt((Number(process.hrtime.bigint())/1e3/1e3).toString());function X2(e,t,r="config",n=[]){for(let a of Object.keys(t))if(typeof t[a]=="object")X2(e[a],t[a],a,n);else{let s=e&&typeof e[a]!="undefined";s||n.push({reason:"unknown property",where:`${r}.${a} = ${t[a]}`});let i=e&&typeof e[a]==typeof t[a];s&&!i&&n.push({reason:"property type mismatch",where:`${r}.${a} = ${t[a]}`,expected:typeof e[a]})}return t.debug&&r==="config"&&n.length>0&&se("invalid configuration",n),n}function Gt(...e){let t=r=>r&&typeof r=="object";return e.reduce((r,n)=>(Object.keys(n||{}).forEach(a=>{let s=r[a],i=n[a];Array.isArray(s)&&Array.isArray(i)?r[a]=s.concat(...i):t(s)&&t(i)?r[a]=Gt(s,i):r[a]=i}),r),{})}var Is={backend:"",modelBasePath:"",cacheModels:!0,wasmPath:"",wasmPlatformFetch:!1,debug:!0,async:!0,warmup:"full",cacheSensitivity:.7,skipAllowed:!1,deallocate:!1,filter:{enabled:!0,equalization:!1,width:0,height:0,flip:!1,return:!0,brightness:0,contrast:0,sharpness:0,blur:0,saturation:0,hue:0,negative:!1,sepia:!1,vintage:!1,kodachrome:!1,technicolor:!1,polaroid:!1,pixelate:0},gesture:{enabled:!0},face:{enabled:!0,detector:{modelPath:"blazeface.json",rotation:!0,maxDetected:1,skipFrames:99,skipTime:2500,minConfidence:.2,iouThreshold:.1,mask:!1,return:!1},mesh:{enabled:!0,modelPath:"facemesh.json"},attention:{enabled:!1,modelPath:"facemesh-attention.json"},iris:{enabled:!0,modelPath:"iris.json"},emotion:{enabled:!0,minConfidence:.1,skipFrames:99,skipTime:1500,modelPath:"emotion.json"},description:{enabled:!0,modelPath:"faceres.json",skipFrames:99,skipTime:3e3,minConfidence:.1},antispoof:{enabled:!1,skipFrames:99,skipTime:4e3,modelPath:"antispoof.json"},liveness:{enabled:!1,skipFrames:99,skipTime:4e3,modelPath:"liveness.json"}},body:{enabled:!0,modelPath:"movenet-lightning.json",maxDetected:-1,minConfidence:.3,skipFrames:1,skipTime:200},hand:{enabled:!0,rotation:!0,skipFrames:99,skipTime:1e3,minConfidence:.5,iouThreshold:.2,maxDetected:-1,landmarks:!0,detector:{modelPath:"handtrack.json"},skeleton:{modelPath:"handlandmark-full.json"}},object:{enabled:!1,modelPath:"mb3-centernet.json",minConfidence:.2,iouThreshold:.4,maxDetected:10,skipFrames:99,skipTime:2e3},segmentation:{enabled:!1,modelPath:"selfie.json",blur:8}};var Ue={};ks(Ue,{Abs:()=>jo,Acos:()=>Ou,Acosh:()=>Du,AdadeltaOptimizer:()=>Uf,AdagradOptimizer:()=>Gf,AdamOptimizer:()=>jf,AdamaxOptimizer:()=>Hf,Add:()=>Qa,AddN:()=>Ys,All:()=>Lu,Any:()=>Bu,ArgMax:()=>Js,ArgMin:()=>Wu,Asin:()=>Vu,Asinh:()=>Uu,Atan:()=>Gu,Atan2:()=>Hu,Atanh:()=>ju,AvgPool:()=>Qs,AvgPool3D:()=>Zp,AvgPool3DGrad:()=>Z0,AvgPoolGrad:()=>X0,BackendWasm:()=>uC,BatchMatMul:()=>ei,BatchToSpaceND:()=>Ho,Bincount:()=>Y0,BroadcastArgs:()=>J0,BroadcastTo:()=>Pv,Callback:()=>lk,CallbackList:()=>l6,Cast:()=>ti,Ceil:()=>ri,ClipByValue:()=>es,Complex:()=>Yp,ComplexAbs:()=>Jp,Concat:()=>qo,Conv2D:()=>ni,Conv2DBackpropFilter:()=>Q0,Conv2DBackpropInput:()=>ai,Conv3D:()=>Qp,Conv3DBackpropFilterV2:()=>ef,Conv3DBackpropInputV2:()=>tf,Cos:()=>si,Cosh:()=>ii,CropAndResize:()=>Xo,Cumprod:()=>Ko,Cumsum:()=>oi,CustomCallback:()=>d6,DataStorage:()=>Xp,DenseBincount:()=>rf,DepthToSpace:()=>Zo,DepthwiseConv2dNative:()=>li,DepthwiseConv2dNativeBackpropFilter:()=>nf,DepthwiseConv2dNativeBackpropInput:()=>af,Diag:()=>sf,Dilation2D:()=>eh,Dilation2DBackpropFilter:()=>y0,Dilation2DBackpropInput:()=>g0,ENV:()=>ba,EarlyStopping:()=>uk,Einsum:()=>th,Elu:()=>di,EluGrad:()=>of,Environment:()=>Mv,Equal:()=>Yo,Erf:()=>qu,Exp:()=>pi,ExpandDims:()=>Jo,Expm1:()=>Qo,FFT:()=>lf,Fill:()=>Ku,FlipLeftRight:()=>el,Floor:()=>hi,FloorDiv:()=>ci,FromPixels:()=>zp,FusedBatchNorm:()=>fi,FusedConv2D:()=>zs,FusedDepthwiseConv2D:()=>Os,GPGPUContext:()=>bu,GatherNd:()=>rl,GatherV2:()=>tl,GraphModel:()=>ym,Greater:()=>nl,GreaterEqual:()=>mi,History:()=>u6,IFFT:()=>uf,Identity:()=>gi,Imag:()=>rh,InputSpec:()=>Xt,IsFinite:()=>Xu,IsInf:()=>Zu,IsNan:()=>Yu,KernelBackend:()=>_u,LRN:()=>ah,LRNGrad:()=>pf,LayerVariable:()=>Qw,LayersModel:()=>Za,LeakyRelu:()=>yi,Less:()=>al,LessEqual:()=>sl,LinSpace:()=>df,Log:()=>Ai,Log1p:()=>Ju,LogSoftmax:()=>_v,LogicalAnd:()=>il,LogicalNot:()=>Qu,LogicalOr:()=>nh,MathBackendCPU:()=>Xx,MathBackendWebGL:()=>Lh,Max:()=>xi,MaxPool:()=>vi,MaxPool3D:()=>sh,MaxPool3DGrad:()=>cf,MaxPoolGrad:()=>hf,MaxPoolWithArgmax:()=>ff,Maximum:()=>bi,Mean:()=>wi,Min:()=>ki,Minimum:()=>Ii,MirrorPad:()=>Si,Mod:()=>ed,MomentumOptimizer:()=>qf,Multinomial:()=>mf,Multiply:()=>Ci,Neg:()=>ol,NonMaxSuppressionV3:()=>ul,NonMaxSuppressionV4:()=>td,NonMaxSuppressionV5:()=>dl,NotEqual:()=>ll,OP_SCOPE_SUFFIX:()=>Zv,OneHot:()=>hl,OnesLike:()=>pl,Optimizer:()=>as,OptimizerConstructors:()=>Cs,Pack:()=>cl,PadV2:()=>Ti,Pool:()=>_R,Pow:()=>Ni,Prelu:()=>Ei,Prod:()=>Ri,RMSPropOptimizer:()=>Kf,RNN:()=>ss,Range:()=>rd,Rank:()=>Bv,Real:()=>ih,RealDiv:()=>ui,Reciprocal:()=>nd,Reduction:()=>Ow,Relu:()=>$i,Relu6:()=>Fi,Reshape:()=>fl,ResizeBilinear:()=>Mi,ResizeBilinearGrad:()=>yf,ResizeNearestNeighbor:()=>ad,ResizeNearestNeighborGrad:()=>gf,Reverse:()=>ml,RotateWithOffset:()=>El,Round:()=>gl,Rsqrt:()=>Pi,SGDOptimizer:()=>Sh,ScatterNd:()=>yl,Select:()=>Al,Selu:()=>sd,Sequential:()=>lm,Sigmoid:()=>zi,Sign:()=>id,Sin:()=>_i,Sinh:()=>bl,Slice:()=>xl,Softmax:()=>Li,Softplus:()=>od,SpaceToBatchND:()=>vl,SparseFillEmptyRows:()=>oh,SparseReshape:()=>ld,SparseSegmentMean:()=>lh,SparseSegmentSum:()=>uh,SparseToDense:()=>dh,SplitV:()=>wl,Sqrt:()=>Oi,Square:()=>ud,SquaredDifference:()=>Bi,Step:()=>Gi,StridedSlice:()=>kl,StringNGrams:()=>ph,StringSplit:()=>Af,StringToHashBucketFast:()=>xf,Sub:()=>Wi,Sum:()=>Di,SymbolicTensor:()=>pa,Tan:()=>Il,Tanh:()=>Vi,Tensor:()=>nt,TensorBuffer:()=>ir,Tile:()=>ts,TopK:()=>Sl,Transform:()=>Cl,Transpose:()=>Ui,Unique:()=>bf,Unpack:()=>Tl,UnsortedSegmentSum:()=>hh,Variable:()=>Lp,ZerosLike:()=>Nl,_FusedMatMul:()=>_s,abs:()=>nr,acos:()=>E7,acosh:()=>R7,add:()=>le,addN:()=>wf,all:()=>_y,any:()=>k0,argMax:()=>Rn,argMin:()=>$7,asin:()=>M7,asinh:()=>F7,atan:()=>P7,atan2:()=>_7,atanh:()=>z7,avgPool:()=>kf,avgPool3d:()=>Oy,backend:()=>Dn,backend_util:()=>C,basicLSTMCell:()=>wF,batchNorm:()=>Iu,batchNorm2d:()=>B7,batchNorm3d:()=>W7,batchNorm4d:()=>V7,batchToSpaceND:()=>If,bincount:()=>Dy,booleanMaskAsync:()=>_z,broadcastArgs:()=>U7,broadcastTo:()=>$p,broadcast_util:()=>Rl,browser:()=>On,buffer:()=>We,callbacks:()=>cj,cast:()=>me,ceil:()=>G7,clipByValue:()=>cn,clone:()=>Br,complex:()=>Ds,concat:()=>It,concat1d:()=>j7,concat2d:()=>pd,concat3d:()=>H7,concat4d:()=>q7,constraints:()=>a6,conv1d:()=>Ly,conv2d:()=>Bs,conv2dTranspose:()=>Wy,conv3d:()=>Vy,conv3dTranspose:()=>X7,copyRegisteredKernels:()=>LR,cos:()=>Sf,cosh:()=>Uy,cosineWindow:()=>cA,cumprod:()=>S0,cumsum:()=>Gy,customGrad:()=>Pa,data:()=>Pk,denseBincount:()=>Z7,deprecationWarn:()=>My,depthToSpace:()=>Y7,depthwiseConv2d:()=>bh,deregisterOp:()=>gj,device_util:()=>gh,diag:()=>QF,dilation2d:()=>J7,disableDeprecationWarnings:()=>DM,dispose:()=>re,disposeVariables:()=>LM,div:()=>pe,divNoNan:()=>Q7,dot:()=>iP,dropout:()=>Nw,einsum:()=>ew,elu:()=>vh,enableDebugMode:()=>OM,enableProdMode:()=>$y,enclosingPowerOfTwo:()=>Ew,engine:()=>ar,env:()=>Z,equal:()=>$n,erf:()=>tw,exp:()=>Mn,expandDims:()=>Kt,expm1:()=>rw,eye:()=>jy,fft:()=>zf,fill:()=>hd,findBackend:()=>Py,findBackendFactory:()=>UM,floor:()=>wh,floorDiv:()=>Ah,forceHalfFloat:()=>rS,fused:()=>Us,gather:()=>Su,gatherND:()=>Tw,gather_util:()=>Iy,getBackend:()=>Gr,getGradient:()=>pg,getKernel:()=>A0,getKernelsForBackend:()=>Ma,getThreadsCount:()=>xye,gpgpu_util:()=>FI,grad:()=>$P,grads:()=>MP,greater:()=>mn,greaterEqual:()=>Ml,ifft:()=>Up,imag:()=>Cf,image:()=>Ie,inTopKAsync:()=>Hz,initializers:()=>s6,input:()=>I6,io:()=>Sr,irfft:()=>lA,isFinite:()=>vP,isInf:()=>kP,isNaN:()=>nw,keep:()=>mr,kernel_impls:()=>Xn,layers:()=>i6,leakyRelu:()=>Tf,less:()=>Hy,lessEqual:()=>Fl,linalg:()=>Dw,linspace:()=>aw,loadGraphModel:()=>xH,loadLayersModel:()=>IU,localResponseNormalization:()=>sw,log:()=>Fn,log1p:()=>Nf,logSigmoid:()=>DP,logSoftmax:()=>qy,logSumExp:()=>dw,logicalAnd:()=>ga,logicalNot:()=>Rf,logicalOr:()=>Zy,logicalXor:()=>ZP,losses:()=>RD,matMul:()=>Je,math:()=>d7,max:()=>yr,maxPool:()=>$f,maxPool3d:()=>Yy,maxPoolWithArgmax:()=>pw,maximum:()=>rs,mean:()=>Vt,memory:()=>w0,meshgrid:()=>r_,metrics:()=>sk,min:()=>Ws,minimum:()=>kh,mirrorPad:()=>hw,mod:()=>fd,model:()=>wU,models:()=>ik,moments:()=>Mf,movingAverage:()=>Dz,mul:()=>L,multiRNNCell:()=>d_,multinomial:()=>cw,neg:()=>Dt,nextFrame:()=>gA,norm:()=>pA,notEqual:()=>Cu,oneHot:()=>Wp,ones:()=>hn,onesLike:()=>Pn,op:()=>W,outerProduct:()=>m_,pad:()=>Kn,pad1d:()=>A_,pad2d:()=>b_,pad3d:()=>w_,pad4d:()=>I_,pool:()=>E_,pow:()=>Vs,prelu:()=>Pf,print:()=>i7,prod:()=>Jy,profile:()=>BM,rand:()=>P_,randomGamma:()=>D_,randomNormal:()=>fw,randomUniform:()=>md,range:()=>Tu,ready:()=>dd,real:()=>Vp,reciprocal:()=>mw,registerBackend:()=>$l,registerCallbackConstructor:()=>SU,registerGradient:()=>zv,registerKernel:()=>qn,registerOp:()=>mj,regularizers:()=>ok,relu:()=>Oa,relu6:()=>tA,removeBackend:()=>VM,reshape:()=>G,reverse:()=>_n,reverse1d:()=>q_,reverse2d:()=>X_,reverse3d:()=>Y_,reverse4d:()=>Q_,rfft:()=>Of,round:()=>rA,rsqrt:()=>nA,scalar:()=>Se,scatterND:()=>Cw,scatter_util:()=>Sy,selu:()=>aA,separableConv2d:()=>gw,sequential:()=>kU,serialization:()=>ue,setBackend:()=>Fy,setPlatform:()=>GM,setThreadsCount:()=>Aye,setWasmPath:()=>yye,setWasmPaths:()=>$5,setWebGLContext:()=>bm,setdiff1dAsync:()=>yw,shared:()=>Am,sigmoid:()=>Cr,sign:()=>Aw,signal:()=>ED,sin:()=>sA,sinh:()=>iA,slice:()=>Pe,slice1d:()=>_f,slice2d:()=>oA,slice3d:()=>Pl,slice4d:()=>zo,slice_util:()=>Ot,softmax:()=>gd,softplus:()=>cd,spaceToBatchND:()=>Ff,sparse:()=>wp,sparseToDense:()=>hA,spectral:()=>ND,split:()=>Zt,sqrt:()=>Nr,square:()=>At,squaredDifference:()=>uA,squeeze:()=>rt,stack:()=>ur,step:()=>Ih,stridedSlice:()=>xw,string:()=>a0,sub:()=>ce,sum:()=>ke,sumOutType:()=>mh,tan:()=>bw,tanh:()=>ku,tensor:()=>ft,tensor1d:()=>Ct,tensor2d:()=>ca,tensor3d:()=>h7,tensor4d:()=>Sz,tensor5d:()=>Cz,tensor6d:()=>Tz,tensor_util:()=>ha,test_util:()=>C7,tidy:()=>K,tile:()=>Gn,time:()=>WM,topk:()=>vw,train:()=>xo,transpose:()=>tt,truncatedNormal:()=>Df,unique:()=>Ig,unregisterGradient:()=>DR,unregisterKernel:()=>OR,unsortedSegmentSum:()=>ww,unstack:()=>nn,upcastType:()=>Tr,util:()=>w,valueAndGrad:()=>FP,valueAndGrads:()=>PP,variable:()=>kw,variableGrads:()=>iw,version:()=>Kh,version_converter:()=>bH,version_core:()=>Ry,version_cpu:()=>iK,version_layers:()=>LA,version_wasm:()=>bye,version_webgl:()=>Rte,webgl:()=>$te,webgl_util:()=>nI,webgpu:()=>a9,where:()=>Wr,whereAsync:()=>dA,zeros:()=>_t,zerosLike:()=>at});var jE=Object.create,j0=Object.defineProperty,HE=Object.getOwnPropertyDescriptor,bv=Object.getOwnPropertyNames,qE=Object.getPrototypeOf,KE=Object.prototype.hasOwnProperty,XE=e=>j0(e,"__esModule",{value:!0}),dr=(e,t)=>function(){return t||(0,e[bv(e)[0]])((t={exports:{}}).exports,t),t.exports},Le=(e,t)=>{for(var r in t)j0(e,r,{get:t[r],enumerable:!0})},ZE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of bv(t))!KE.call(e,a)&&(r||a!=="default")&&j0(e,a,{get:()=>t[a],enumerable:!(n=HE(t,a))||n.enumerable});return e},Uo=(e,t)=>ZE(XE(j0(e!=null?jE(qE(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),YE=dr({"src/node_modules/long/src/long.js"(e,t){t.exports=n;var r=null;try{r=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(I){}function n(I,_,O){this.low=I|0,this.high=_|0,this.unsigned=!!O}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0});function a(I){return(I&&I.__isLong__)===!0}n.isLong=a;var s={},i={};function o(I,_){var O,j,X;return _?(I>>>=0,(X=0<=I&&I<256)&&(j=i[I],j)?j:(O=u(I,(I|0)<0?-1:0,!0),X&&(i[I]=O),O)):(I|=0,(X=-128<=I&&I<128)&&(j=s[I],j)?j:(O=u(I,I<0?-1:0,!1),X&&(s[I]=O),O))}n.fromInt=o;function l(I,_){if(isNaN(I))return _?b:x;if(_){if(I<0)return b;if(I>=g)return R}else{if(I<=-y)return z;if(I+1>=y)return E}return I<0?l(-I,_).neg():u(I%f|0,I/f|0,_)}n.fromNumber=l;function u(I,_,O){return new n(I,_,O)}n.fromBits=u;var d=Math.pow;function h(I,_,O){if(I.length===0)throw Error("empty string");if(I==="NaN"||I==="Infinity"||I==="+Infinity"||I==="-Infinity")return x;if(typeof _=="number"?(O=_,_=!1):_=!!_,O=O||10,O<2||360)throw Error("interior hyphen");if(j===0)return h(I.substring(1),_,O).neg();for(var X=l(d(O,8)),D=x,J=0;J>>0:this.low},$.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},$.toString=function(I){if(I=I||10,I<2||36>>0,Q=ee.toString(I);if(D=V,D.isZero())return Q+J;for(;Q.length<6;)Q="0"+Q;J=""+Q+J}},$.getHighBits=function(){return this.high},$.getHighBitsUnsigned=function(){return this.high>>>0},$.getLowBits=function(){return this.low},$.getLowBitsUnsigned=function(){return this.low>>>0},$.getNumBitsAbs=function(){if(this.isNegative())return this.eq(z)?64:this.neg().getNumBitsAbs();for(var I=this.high!=0?this.high:this.low,_=31;_>0&&(I&1<<_)==0;_--);return this.high!=0?_+33:_+1},$.isZero=function(){return this.high===0&&this.low===0},$.eqz=$.isZero,$.isNegative=function(){return!this.unsigned&&this.high<0},$.isPositive=function(){return this.unsigned||this.high>=0},$.isOdd=function(){return(this.low&1)===1},$.isEven=function(){return(this.low&1)===0},$.equals=function(I){return a(I)||(I=p(I)),this.unsigned!==I.unsigned&&this.high>>>31===1&&I.high>>>31===1?!1:this.high===I.high&&this.low===I.low},$.eq=$.equals,$.notEquals=function(I){return!this.eq(I)},$.neq=$.notEquals,$.ne=$.notEquals,$.lessThan=function(I){return this.comp(I)<0},$.lt=$.lessThan,$.lessThanOrEqual=function(I){return this.comp(I)<=0},$.lte=$.lessThanOrEqual,$.le=$.lessThanOrEqual,$.greaterThan=function(I){return this.comp(I)>0},$.gt=$.greaterThan,$.greaterThanOrEqual=function(I){return this.comp(I)>=0},$.gte=$.greaterThanOrEqual,$.ge=$.greaterThanOrEqual,$.compare=function(I){if(a(I)||(I=p(I)),this.eq(I))return 0;var _=this.isNegative(),O=I.isNegative();return _&&!O?-1:!_&&O?1:this.unsigned?I.high>>>0>this.high>>>0||I.high===this.high&&I.low>>>0>this.low>>>0?-1:1:this.sub(I).isNegative()?-1:1},$.comp=$.compare,$.negate=function(){return!this.unsigned&&this.eq(z)?z:this.not().add(v)},$.neg=$.negate,$.add=function(I){a(I)||(I=p(I));var _=this.high>>>16,O=this.high&65535,j=this.low>>>16,X=this.low&65535,D=I.high>>>16,J=I.high&65535,V=I.low>>>16,ee=I.low&65535,Q=0,ie=0,Y=0,ae=0;return ae+=X+ee,Y+=ae>>>16,ae&=65535,Y+=j+V,ie+=Y>>>16,Y&=65535,ie+=O+J,Q+=ie>>>16,ie&=65535,Q+=_+D,Q&=65535,u(Y<<16|ae,Q<<16|ie,this.unsigned)},$.subtract=function(I){return a(I)||(I=p(I)),this.add(I.neg())},$.sub=$.subtract,$.multiply=function(I){if(this.isZero())return x;if(a(I)||(I=p(I)),r){var _=r.mul(this.low,this.high,I.low,I.high);return u(_,r.get_high(),this.unsigned)}if(I.isZero())return x;if(this.eq(z))return I.isOdd()?z:x;if(I.eq(z))return this.isOdd()?z:x;if(this.isNegative())return I.isNegative()?this.neg().mul(I.neg()):this.neg().mul(I).neg();if(I.isNegative())return this.mul(I.neg()).neg();if(this.lt(A)&&I.lt(A))return l(this.toNumber()*I.toNumber(),this.unsigned);var O=this.high>>>16,j=this.high&65535,X=this.low>>>16,D=this.low&65535,J=I.high>>>16,V=I.high&65535,ee=I.low>>>16,Q=I.low&65535,ie=0,Y=0,ae=0,de=0;return de+=D*Q,ae+=de>>>16,de&=65535,ae+=X*Q,Y+=ae>>>16,ae&=65535,ae+=D*ee,Y+=ae>>>16,ae&=65535,Y+=j*Q,ie+=Y>>>16,Y&=65535,Y+=X*ee,ie+=Y>>>16,Y&=65535,Y+=D*V,ie+=Y>>>16,Y&=65535,ie+=O*Q+j*ee+X*V+D*J,ie&=65535,u(ae<<16|de,ie<<16|Y,this.unsigned)},$.mul=$.multiply,$.divide=function(I){if(a(I)||(I=p(I)),I.isZero())throw Error("division by zero");if(r){if(!this.unsigned&&this.high===-2147483648&&I.low===-1&&I.high===-1)return this;var _=(this.unsigned?r.div_u:r.div_s)(this.low,this.high,I.low,I.high);return u(_,r.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?b:x;var O,j,X;if(this.unsigned){if(I.unsigned||(I=I.toUnsigned()),I.gt(this))return b;if(I.gt(this.shru(1)))return S;X=b}else{if(this.eq(z)){if(I.eq(v)||I.eq(N))return z;if(I.eq(z))return v;var D=this.shr(1);return O=D.div(I).shl(1),O.eq(x)?I.isNegative()?v:N:(j=this.sub(I.mul(O)),X=O.add(j.div(I)),X)}else if(I.eq(z))return this.unsigned?b:x;if(this.isNegative())return I.isNegative()?this.neg().div(I.neg()):this.neg().div(I).neg();if(I.isNegative())return this.div(I.neg()).neg();X=x}for(j=this;j.gte(I);){O=Math.max(1,Math.floor(j.toNumber()/I.toNumber()));for(var J=Math.ceil(Math.log(O)/Math.LN2),V=J<=48?1:d(2,J-48),ee=l(O),Q=ee.mul(I);Q.isNegative()||Q.gt(j);)O-=V,ee=l(O,this.unsigned),Q=ee.mul(I);ee.isZero()&&(ee=v),X=X.add(ee),j=j.sub(Q)}return X},$.div=$.divide,$.modulo=function(I){if(a(I)||(I=p(I)),r){var _=(this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,I.low,I.high);return u(_,r.get_high(),this.unsigned)}return this.sub(this.div(I).mul(I))},$.mod=$.modulo,$.rem=$.modulo,$.not=function(){return u(~this.low,~this.high,this.unsigned)},$.and=function(I){return a(I)||(I=p(I)),u(this.low&I.low,this.high&I.high,this.unsigned)},$.or=function(I){return a(I)||(I=p(I)),u(this.low|I.low,this.high|I.high,this.unsigned)},$.xor=function(I){return a(I)||(I=p(I)),u(this.low^I.low,this.high^I.high,this.unsigned)},$.shiftLeft=function(I){return a(I)&&(I=I.toInt()),(I&=63)===0?this:I<32?u(this.low<>>32-I,this.unsigned):u(0,this.low<>>I|this.high<<32-I,this.high>>I,this.unsigned):u(this.high>>I-32,this.high>=0?0:-1,this.unsigned)},$.shr=$.shiftRight,$.shiftRightUnsigned=function(I){if(a(I)&&(I=I.toInt()),I&=63,I===0)return this;var _=this.high;if(I<32){var O=this.low;return u(O>>>I|_<<32-I,_>>>I,this.unsigned)}else return I===32?u(_,0,this.unsigned):u(_>>>I-32,0,this.unsigned)},$.shru=$.shiftRightUnsigned,$.shr_u=$.shiftRightUnsigned,$.toSigned=function(){return this.unsigned?u(this.low,this.high,!1):this},$.toUnsigned=function(){return this.unsigned?this:u(this.low,this.high,!0)},$.toBytes=function(I){return I?this.toBytesLE():this.toBytesBE()},$.toBytesLE=function(){var I=this.high,_=this.low;return[_&255,_>>>8&255,_>>>16&255,_>>>24,I&255,I>>>8&255,I>>>16&255,I>>>24]},$.toBytesBE=function(){var I=this.high,_=this.low;return[I>>>24,I>>>16&255,I>>>8&255,I&255,_>>>24,_>>>16&255,_>>>8&255,_&255]},n.fromBytes=function(I,_,O){return O?n.fromBytesLE(I,_):n.fromBytesBE(I,_)},n.fromBytesLE=function(I,_){return new n(I[0]|I[1]<<8|I[2]<<16|I[3]<<24,I[4]|I[5]<<8|I[6]<<16|I[7]<<24,_)},n.fromBytesBE=function(I,_){return new n(I[4]<<24|I[5]<<16|I[6]<<8|I[7],I[0]<<24|I[1]<<16|I[2]<<8|I[3],_)}}}),JE=dr({"(disabled):src/node_modules/node-fetch/browser.js"(){}}),QE=dr({"(disabled):util"(){}}),eR=dr({"src/node_modules/seedrandom/lib/alea.js"(e,t){(function(r,n,a){function s(u){var d=this,h=l();d.next=function(){var p=2091639*d.s0+d.c*23283064365386963e-26;return d.s0=d.s1,d.s1=d.s2,d.s2=p-(d.c=p|0)},d.c=1,d.s0=h(" "),d.s1=h(" "),d.s2=h(" "),d.s0-=h(u),d.s0<0&&(d.s0+=1),d.s1-=h(u),d.s1<0&&(d.s1+=1),d.s2-=h(u),d.s2<0&&(d.s2+=1),h=null}function i(u,d){return d.c=u.c,d.s0=u.s0,d.s1=u.s1,d.s2=u.s2,d}function o(u,d){var h=new s(u),p=d&&d.state,c=h.next;return c.int32=function(){return h.next()*4294967296|0},c.double=function(){return c()+(c()*2097152|0)*11102230246251565e-32},c.quick=c,p&&(typeof p=="object"&&i(p,h),c.state=function(){return i(h,{})}),c}function l(){var u=4022871197,d=function(h){h=String(h);for(var p=0;p>>0,c-=u,c*=u,u=c>>>0,c-=u,u+=c*4294967296}return(u>>>0)*23283064365386963e-26};return d}n&&n.exports?n.exports=o:a&&a.amd?a(function(){return o}):this.alea=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),tR=dr({"src/node_modules/seedrandom/lib/xor128.js"(e,t){(function(r,n,a){function s(l){var u=this,d="";u.x=0,u.y=0,u.z=0,u.w=0,u.next=function(){var p=u.x^u.x<<11;return u.x=u.y,u.y=u.z,u.z=u.w,u.w^=u.w>>>19^p^p>>>8},l===(l|0)?u.x=l:d+=l;for(var h=0;h>>0)/4294967296};return p.double=function(){do var c=d.next()>>>11,m=(d.next()>>>0)/4294967296,f=(c+m)/(1<<21);while(f===0);return f},p.int32=d.next,p.quick=p,h&&(typeof h=="object"&&i(h,d),p.state=function(){return i(d,{})}),p}n&&n.exports?n.exports=o:a&&a.amd?a(function(){return o}):this.xor128=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),rR=dr({"src/node_modules/seedrandom/lib/xorwow.js"(e,t){(function(r,n,a){function s(l){var u=this,d="";u.next=function(){var p=u.x^u.x>>>2;return u.x=u.y,u.y=u.z,u.z=u.w,u.w=u.v,(u.d=u.d+362437|0)+(u.v=u.v^u.v<<4^(p^p<<1))|0},u.x=0,u.y=0,u.z=0,u.w=0,u.v=0,l===(l|0)?u.x=l:d+=l;for(var h=0;h>>4),u.next()}function i(l,u){return u.x=l.x,u.y=l.y,u.z=l.z,u.w=l.w,u.v=l.v,u.d=l.d,u}function o(l,u){var d=new s(l),h=u&&u.state,p=function(){return(d.next()>>>0)/4294967296};return p.double=function(){do var c=d.next()>>>11,m=(d.next()>>>0)/4294967296,f=(c+m)/(1<<21);while(f===0);return f},p.int32=d.next,p.quick=p,h&&(typeof h=="object"&&i(h,d),p.state=function(){return i(d,{})}),p}n&&n.exports?n.exports=o:a&&a.amd?a(function(){return o}):this.xorwow=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),nR=dr({"src/node_modules/seedrandom/lib/xorshift7.js"(e,t){(function(r,n,a){function s(l){var u=this;u.next=function(){var h=u.x,p=u.i,c,m,f;return c=h[p],c^=c>>>7,m=c^c<<24,c=h[p+1&7],m^=c^c>>>10,c=h[p+3&7],m^=c^c>>>3,c=h[p+4&7],m^=c^c<<7,c=h[p+7&7],c=c^c<<13,m^=c^c<<9,h[p]=m,u.i=p+1&7,m};function d(h,p){var c,m,f=[];if(p===(p|0))m=f[0]=p;else for(p=""+p,c=0;c0;--c)h.next()}d(u,l)}function i(l,u){return u.x=l.x.slice(),u.i=l.i,u}function o(l,u){l==null&&(l=+new Date);var d=new s(l),h=u&&u.state,p=function(){return(d.next()>>>0)/4294967296};return p.double=function(){do var c=d.next()>>>11,m=(d.next()>>>0)/4294967296,f=(c+m)/(1<<21);while(f===0);return f},p.int32=d.next,p.quick=p,h&&(h.x&&i(h,d),p.state=function(){return i(d,{})}),p}n&&n.exports?n.exports=o:a&&a.amd?a(function(){return o}):this.xorshift7=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),aR=dr({"src/node_modules/seedrandom/lib/xor4096.js"(e,t){(function(r,n,a){function s(l){var u=this;u.next=function(){var h=u.w,p=u.X,c=u.i,m,f;return u.w=h=h+1640531527|0,f=p[c+34&127],m=p[c=c+1&127],f^=f<<13,m^=m<<17,f^=f>>>15,m^=m>>>12,f=p[c]=f^m,u.i=c,f+(h^h>>>16)|0};function d(h,p){var c,m,f,g,y,A=[],x=128;for(p===(p|0)?(m=p,p=null):(p=p+"\0",m=0,x=Math.max(x,p.length)),f=0,g=-32;g>>15,m^=m<<4,m^=m>>>13,g>=0&&(y=y+1640531527|0,c=A[g&127]^=m+y,f=c==0?f+1:0);for(f>=128&&(A[(p&&p.length||0)&127]=-1),f=127,g=4*128;g>0;--g)m=A[f+34&127],c=A[f=f+1&127],m^=m<<13,c^=c<<17,m^=m>>>15,c^=c>>>12,A[f]=m^c;h.w=y,h.X=A,h.i=f}d(u,l)}function i(l,u){return u.i=l.i,u.w=l.w,u.X=l.X.slice(),u}function o(l,u){l==null&&(l=+new Date);var d=new s(l),h=u&&u.state,p=function(){return(d.next()>>>0)/4294967296};return p.double=function(){do var c=d.next()>>>11,m=(d.next()>>>0)/4294967296,f=(c+m)/(1<<21);while(f===0);return f},p.int32=d.next,p.quick=p,h&&(h.X&&i(h,d),p.state=function(){return i(d,{})}),p}n&&n.exports?n.exports=o:a&&a.amd?a(function(){return o}):this.xor4096=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),sR=dr({"src/node_modules/seedrandom/lib/tychei.js"(e,t){(function(r,n,a){function s(l){var u=this,d="";u.next=function(){var p=u.b,c=u.c,m=u.d,f=u.a;return p=p<<25^p>>>7^c,c=c-m|0,m=m<<24^m>>>8^f,f=f-p|0,u.b=p=p<<20^p>>>12^c,u.c=c=c-m|0,u.d=m<<16^c>>>16^f,u.a=f-p|0},u.a=0,u.b=0,u.c=-1640531527,u.d=1367130551,l===Math.floor(l)?(u.a=l/4294967296|0,u.b=l|0):d+=l;for(var h=0;h>>0)/4294967296};return p.double=function(){do var c=d.next()>>>11,m=(d.next()>>>0)/4294967296,f=(c+m)/(1<<21);while(f===0);return f},p.int32=d.next,p.quick=p,h&&(typeof h=="object"&&i(h,d),p.state=function(){return i(d,{})}),p}n&&n.exports?n.exports=o:a&&a.amd?a(function(){return o}):this.tychei=o})(e,typeof t=="object"&&t,typeof define=="function"&&define)}}),iR=dr({"(disabled):crypto"(){}}),oR=dr({"src/node_modules/seedrandom/seedrandom.js"(e,t){(function(r,n,a){var s=256,i=6,o=52,l="random",u=a.pow(s,i),d=a.pow(2,o),h=d*2,p=s-1,c;function m(v,S,N){var E=[];S=S==!0?{entropy:!0}:S||{};var R=A(y(S.entropy?[v,b(n)]:v==null?x():v,3),E),z=new f(E),$=function(){for(var I=z.g(i),_=u,O=0;I=h;)I/=2,_/=2,O>>>=1;return(I+O)/_};return $.int32=function(){return z.g(4)|0},$.quick=function(){return z.g(4)/4294967296},$.double=$,A(b(z.S),n),(S.pass||N||function(I,_,O,j){return j&&(j.S&&g(j,z),I.state=function(){return g(z,{})}),O?(a[l]=I,_):I})($,R,"global"in S?S.global:this==a,S.state)}function f(v){var S,N=v.length,E=this,R=0,z=E.i=E.j=0,$=E.S=[];for(N||(v=[N++]);R{var n=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename!="undefined"&&(n=n||__filename),function(a){a=a||{};function s(){return Fe.buffer!=Pr&&ra(Fe.buffer),uc}function i(){return Fe.buffer!=Pr&&ra(Fe.buffer),dc}function o(){return Fe.buffer!=Pr&&ra(Fe.buffer),rp}function l(){return Fe.buffer!=Pr&&ra(Fe.buffer),pc}function u(){return Fe.buffer!=Pr&&ra(Fe.buffer),hc}function d(){return Fe.buffer!=Pr&&ra(Fe.buffer),cc}function h(){return Fe.buffer!=Pr&&ra(Fe.buffer),fc}var p=typeof a!="undefined"?a:{},c,m;p.ready=new Promise(function(T,F){c=T,m=F});var f;typeof process!="undefined"&&process.listeners&&(f={uncaughtException:process.listeners("uncaughtException"),unhandledRejection:process.listeners("unhandledRejection")});var g=Object.assign({},p),y=[],A="./this.program",x=(T,F)=>{throw F},b=typeof window=="object",v=typeof importScripts=="function",S=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",N=p.ENVIRONMENT_IS_PTHREAD||!1,E="";function R(T){return p.locateFile?p.locateFile(T,E):E+T}var z,$,I,_;function O(T){T instanceof pp||Q("exiting due to exception: "+T)}var j,X,D;if(S){v?E=c0().dirname(E)+"/":E=__dirname+"/",D=()=>{X||(j=py(),X=c0())},z=function(F,U){return D(),F=X.normalize(F),j.readFileSync(F,U?void 0:"utf8")},I=F=>{var U=z(F,!0);return U.buffer||(U=new Uint8Array(U)),U},$=(F,U,te)=>{D(),F=X.normalize(F),j.readFile(F,function(ge,xe){ge?te(ge):U(xe.buffer)})},process.argv.length>1&&(A=process.argv[1].replace(/\\/g,"/")),y=process.argv.slice(2),process.on("uncaughtException",function(F){if(!(F instanceof pp))throw F}),process.on("unhandledRejection",function(F){throw F}),x=(F,U)=>{if(po())throw process.exitCode=F,U;O(U),process.exit(F)},p.inspect=function(){return"[Emscripten Module object]"};let T;try{T=lR()}catch(F){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),F}global.Worker=T.Worker}else(b||v)&&(v?E=self.location.href:typeof document!="undefined"&&document.currentScript&&(E=document.currentScript.src),typeof n!="undefined"&&n&&(E=n),E.indexOf("blob:")!==0?E=E.substr(0,E.replace(/[?#].*/,"").lastIndexOf("/")+1):E="",S||(z=T=>{var F=new XMLHttpRequest;return F.open("GET",T,!1),F.send(null),F.responseText},v&&(I=T=>{var F=new XMLHttpRequest;return F.open("GET",T,!1),F.responseType="arraybuffer",F.send(null),new Uint8Array(F.response)}),$=(T,F,U)=>{var te=new XMLHttpRequest;te.open("GET",T,!0),te.responseType="arraybuffer",te.onload=()=>{if(te.status==200||te.status==0&&te.response){F(te.response);return}U()},te.onerror=U,te.send(null)}),_=T=>document.title=T);S&&typeof performance=="undefined"&&(global.performance=uR().performance);var J=console.log.bind(console),V=console.warn.bind(console);S&&(D(),J=T=>j.writeSync(1,T+` `),V=T=>j.writeSync(2,T+` `));var ee=p.print||J,Q=p.printErr||V;Object.assign(p,g),g=null,p.arguments&&(y=p.arguments),p.thisProgram&&(A=p.thisProgram),p.quit&&(x=p.quit);var ie=4;function Y(T){Y.shown||(Y.shown={}),Y.shown[T]||(Y.shown[T]=1,Q(T))}function ae(T,F){if(typeof WebAssembly.Function=="function"){for(var U={i:"i32",j:"i64",f:"f32",d:"f64"},te={parameters:[],results:F[0]=="v"?[]:[U[F[0]]]},ge=1;ge{$e=T},Be=Atomics.load,Ze=Atomics.store,ot=Atomics.compareExchange,pt;p.wasmBinary&&(pt=p.wasmBinary);var ht=p.noExitRuntime||!0;typeof WebAssembly!="object"&&Yl("no native wasm support detected");var Fe,wt,yt=!1,Fr;function hr(T,F){T||Yl(F)}function Jr(T){var F=p["_"+T];return F}function tr(T,F,U,te,ge){var xe={string:function(Cn){var ou=0;if(Cn!=null&&Cn!==0){var Rb=(Cn.length<<2)+1;ou=iu(Rb),lo(Cn,ou,Rb)}return ou},array:function(Cn){var ou=iu(Cn.length);return Ga(Cn,ou),ou}};function Te(Cn){return F==="string"?In(Cn):F==="boolean"?Boolean(Cn):Cn}var _e=Jr(T),Pt=[],ia=0;if(te)for(var oa=0;oa(U.buffer instanceof SharedArrayBuffer&&(U=new Uint8Array(U)),F.decode.call(F,U))}var rr=typeof TextDecoder!="undefined"?new Qr("utf8"):void 0;function kn(T,F,U){for(var te=F+U,ge=F;T[ge]&&!(ge>=te);)++ge;if(ge-F>16&&T.subarray&&rr)return rr.decode(T.subarray(F,ge));for(var xe="";F>10,56320|ia&1023)}}return xe}function In(T,F){return T?kn(i(),T,F):""}function As(T,F,U,te){if(!(te>0))return 0;for(var ge=U,xe=U+te-1,Te=0;Te=55296&&_e<=57343){var Pt=T.charCodeAt(++Te);_e=65536+((_e&1023)<<10)|Pt&1023}if(_e<=127){if(U>=xe)break;F[U++]=_e}else if(_e<=2047){if(U+1>=xe)break;F[U++]=192|_e>>6,F[U++]=128|_e&63}else if(_e<=65535){if(U+2>=xe)break;F[U++]=224|_e>>12,F[U++]=128|_e>>6&63,F[U++]=128|_e&63}else{if(U+3>=xe)break;F[U++]=240|_e>>18,F[U++]=128|_e>>12&63,F[U++]=128|_e>>6&63,F[U++]=128|_e&63}}return F[U]=0,U-ge}function lo(T,F,U){return As(T,i(),F,U)}function lc(T){for(var F=0,U=0;U=55296&&te<=57343&&(te=65536+((te&1023)<<10)|T.charCodeAt(++U)&1023),te<=127?++F:te<=2047?F+=2:te<=65535?F+=3:F+=4}return F}var xs=typeof TextDecoder!="undefined"?new Qr("utf-16le"):void 0;function Ga(T,F){s().set(T,F)}function tp(T,F,U){for(var te=0;te>0]=T.charCodeAt(te);U||(s()[F>>0]=0)}function Xl(T,F){return T%F>0&&(T+=F-T%F),T}var Pr,uc,dc,rp,pc,hc,db,cc,fc;N&&(Pr=p.buffer);function ra(T){Pr=T,p.HEAP8=uc=new Int8Array(T),p.HEAP16=rp=new Int16Array(T),p.HEAP32=hc=new Int32Array(T),p.HEAPU8=dc=new Uint8Array(T),p.HEAPU16=pc=new Uint16Array(T),p.HEAPU32=db=new Uint32Array(T),p.HEAPF32=cc=new Float32Array(T),p.HEAPF64=fc=new Float64Array(T)}var mc=p.INITIAL_MEMORY||16777216;if(N)Fe=p.wasmMemory,Pr=p.buffer;else if(p.wasmMemory)Fe=p.wasmMemory;else if(Fe=new WebAssembly.Memory({initial:mc/65536,maximum:32768,shared:!0}),!(Fe.buffer instanceof SharedArrayBuffer))throw Q("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"),S&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");Fe&&(Pr=Fe.buffer),mc=Pr.byteLength,ra(Pr);var Sn,Zl=[],bs=[],A1=[],gc=[],uo=!1,x1=!1,yc=0;function po(){return ht||yc>0}function _r(){if(p.preRun)for(typeof p.preRun=="function"&&(p.preRun=[p.preRun]);p.preRun.length;)pb(p.preRun.shift());wc(Zl)}function np(){uo=!0,!N&&wc(bs)}function b1(){N||(Oe.terminateAllThreads(),x1=!0)}function v1(){if(!N){if(p.postRun)for(typeof p.postRun=="function"&&(p.postRun=[p.postRun]);p.postRun.length;)ap(p.postRun.shift());wc(gc)}}function pb(T){Zl.unshift(T)}function hb(T){bs.unshift(T)}function ap(T){gc.unshift(T)}var vs=0,Ac=null,na=null;function sp(T){vs++,p.monitorRunDependencies&&p.monitorRunDependencies(vs)}function cb(T){if(vs--,p.monitorRunDependencies&&p.monitorRunDependencies(vs),vs==0&&(Ac!==null&&(clearInterval(Ac),Ac=null),na)){var F=na;na=null,F()}}p.preloadedImages={},p.preloadedAudios={};function Yl(T){N?postMessage({cmd:"onAbort",arg:T}):p.onAbort&&p.onAbort(T),T="Aborted("+T+")",Q(T),yt=!0,Fr=1,T+=". Build with -s ASSERTIONS=1 for more info.";var F=new WebAssembly.RuntimeError(T);throw m(F),F}var w1="data:application/octet-stream;base64,";function xc(T){return T.startsWith(w1)}function bc(T){return T.startsWith("file://")}var zr;zr="tfjs-backend-wasm-threaded-simd.wasm",xc(zr)||(zr=R(zr));function vc(T){try{if(T==zr&&pt)return new Uint8Array(pt);if(I)return I(T);throw"both async and sync fetching of the wasm failed"}catch(F){Yl(F)}}function Jl(){if(!pt&&(b||v)){if(typeof fetch=="function"&&!bc(zr))return fetch(zr,{credentials:"same-origin"}).then(function(T){if(!T.ok)throw"failed to load wasm binary file at '"+zr+"'";return T.arrayBuffer()}).catch(function(){return vc(zr)});if($)return new Promise(function(T,F){$(zr,function(U){T(new Uint8Array(U))},F)})}return Promise.resolve().then(function(){return vc(zr)})}function k1(){var T={env:Pc,wasi_snapshot_preview1:Pc};function F(Te,_e){var Pt=Te.exports;if(p.asm=Pt,R1(p.asm.emscripten_tls_init),Sn=p.asm.__indirect_function_table,hb(p.asm.__wasm_call_ctors),wt=_e,!N){var ia=Oe.unusedWorkers.length;Oe.unusedWorkers.forEach(function(oa){Oe.loadWasmModuleToWorker(oa,function(){--ia||cb("wasm-instantiate")})})}}N||sp("wasm-instantiate");function U(Te){F(Te.instance,Te.module)}function te(Te){return Jl().then(function(_e){return WebAssembly.instantiate(_e,T)}).then(function(_e){return _e}).then(Te,function(_e){Q("failed to asynchronously prepare wasm: "+_e),Yl(_e)})}function ge(){return!pt&&typeof WebAssembly.instantiateStreaming=="function"&&!xc(zr)&&!bc(zr)&&typeof fetch=="function"?fetch(zr,{credentials:"same-origin"}).then(function(Te){var _e=WebAssembly.instantiateStreaming(Te,T);return _e.then(U,function(Pt){return Q("wasm streaming compile failed: "+Pt),Q("falling back to ArrayBuffer instantiation"),te(U)})}):te(U)}if(p.instantiateWasm)try{var xe=p.instantiateWasm(T,F);return xe}catch(Te){return Q("Module.instantiateWasm callback failed with error: "+Te),!1}return ge().catch(m),{}}var fb,mb,I1={};function wc(T){for(;T.length>0;){var F=T.shift();if(typeof F=="function"){F(p);continue}var U=F.func;typeof U=="number"?F.arg===void 0?eu(U)():eu(U)(F.arg):U(F.arg===void 0?null:F.arg)}}function Ql(T){var F=q2(),U=T();return Lc(F),U}function HN(T){return T}function gb(T){var F=/\b_Z[\w\d_]+/g;return T.replace(F,function(U){var te=U;return U===te?U:te+" ["+U+"]"})}function S1(T){u()[T>>2]=0;var F=Oe.pthreads[T];delete Oe.pthreads[T],F.worker.terminate(),H2(T),Oe.runningWorkers.splice(Oe.runningWorkers.indexOf(F.worker),1),F.worker.pthread=void 0}function C1(T){var F=Oe.pthreads[T];F.worker.postMessage({cmd:"cancel"})}function kc(T){var F=Oe.pthreads[T];if(F){u()[T>>2]=0;var U=F.worker;Oe.returnWorkerToPool(U)}}function Ic(T){_E(T)}function T1(T){if(T instanceof pp||T=="unwind")return Fr;x(1,T)}var Oe={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],init:function(){N?Oe.initWorker():Oe.initMainThread()},initMainThread:function(){for(var T=8,F=0;F>2]=0;try{T()}finally{u()[Eb>>2]=1}},receiveObjectTransfer:function(T){},threadInit:function(){for(var T in Oe.tlsInitFunctions)Oe.tlsInitFunctions[T]()},loadWasmModuleToWorker:function(T,F){T.onmessage=U=>{var te=U.data,ge=te.cmd;if(T.pthread&&(Oe.currentProxiedOperationCallerThread=T.pthread.threadInfoStruct),te.targetThread&&te.targetThread!=Dc()){var xe=Oe.pthreads[te.targetThread];xe?xe.worker.postMessage(te,te.transferList):Q('Internal error! Worker sent a message "'+ge+'" to target pthread '+te.targetThread+", but that thread no longer exists!"),Oe.currentProxiedOperationCallerThread=void 0;return}ge==="processQueuedMainThreadWork"?Ib():ge==="spawnThread"?Cc(te):ge==="cleanupThread"?kc(te.thread):ge==="killThread"?S1(te.thread):ge==="cancelThread"?C1(te.thread):ge==="loaded"?(T.loaded=!0,F&&F(T),T.runPthread&&(T.runPthread(),delete T.runPthread)):ge==="print"?ee("Thread "+te.threadId+": "+te.text):ge==="printErr"?Q("Thread "+te.threadId+": "+te.text):ge==="alert"?alert("Thread "+te.threadId+": "+te.text):te.target==="setimmediate"?T.postMessage(te):ge==="onAbort"?p.onAbort&&p.onAbort(te.arg):Q("worker sent an unknown command "+ge),Oe.currentProxiedOperationCallerThread=void 0},T.onerror=U=>{var te="worker sent an error!";throw Q(te+" "+U.filename+":"+U.lineno+": "+U.message),U},S&&(T.on("message",function(U){T.onmessage({data:U})}),T.on("error",function(U){T.onerror(U)}),T.on("detachedExit",function(){})),T.postMessage({cmd:"load",urlOrBlob:p.mainScriptUrlOrBlob||n,wasmMemory:Fe,wasmModule:wt})},allocateUnusedWorker:function(){var T=R("tfjs-backend-wasm-threaded-simd.worker.js");Oe.unusedWorkers.push(new Worker(T))},getNewWorker:function(){return Oe.unusedWorkers.length==0&&(Oe.allocateUnusedWorker(),Oe.loadWasmModuleToWorker(Oe.unusedWorkers[0])),Oe.unusedWorkers.pop()}};function N1(){var T=Dc(),F=u()[T+44>>2],U=u()[T+48>>2],te=F-U;Nb(F,te),Lc(F)}p.establishStackSpace=N1;function Sc(T){if(N)return fo(1,0,T);try{Ic(T)}catch(F){T1(F)}}var ho=[];function eu(T){var F=ho[T];return F||(T>=ho.length&&(ho.length=T+1),ho[T]=F=Sn.get(T)),F}function E1(T,F){return eu(T)(F)}p.invokeEntryPoint=E1;function yb(){var T=new Error;if(!T.stack){try{throw new Error}catch(F){T=F}if(!T.stack)return"(no stack trace available)"}return T.stack.toString()}function R1(T,F,U){Oe.tlsInitFunctions.push(T)}function Ab(T,F){Sn.set(T,F),ho[T]=F}var co;S?co=()=>{var T=process.hrtime();return T[0]*1e3+T[1]/1e6}:N?co=()=>performance.now()-p.__performance_now_clock_drift:co=()=>performance.now();var $1=!0;function M1(T){return u()[kb()>>2]=T,T}function F1(T,F){var U;if(T===0)U=Date.now();else if((T===1||T===4)&&$1)U=co();else return M1(28),-1;return u()[F>>2]=U/1e3|0,u()[F+4>>2]=U%1e3*1e3*1e3|0,0}function P1(T,F){return F1(T,F)}function _1(T){Sb(T,!v,1,!b),Oe.threadInit()}function z1(T){N?postMessage({cmd:"cleanupThread",thread:T}):kc(T)}function Cc(T){var F=Oe.getNewWorker();if(!F)return 6;Oe.runningWorkers.push(F);var U=Oe.pthreads[T.pthread_ptr]={worker:F,threadInfoStruct:T.pthread_ptr};F.pthread=U;var te={cmd:"run",start_routine:T.startRoutine,arg:T.arg,threadInfoStruct:T.pthread_ptr};return F.runPthread=()=>{te.time=performance.now(),F.postMessage(te,T.transferList)},F.loaded&&(F.runPthread(),delete F.runPthread),0}function O1(T,F,U,te){if(typeof SharedArrayBuffer=="undefined")return Q("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var ge=[],xe=0;if(N&&(ge.length===0||xe))return Cb(687865856,T,F,U,te);if(xe)return xe;var Te={startRoutine:U,pthread_ptr:T,arg:te,transferList:ge};return N?(Te.cmd="spawnThread",postMessage(Te,ge),0):Cc(Te)}function D1(){return 2097152}function L1(T,F){if(T==F)postMessage({cmd:"processQueuedMainThreadWork"});else if(N)postMessage({targetThread:T,cmd:"processThreadQueue"});else{var U=Oe.pthreads[T],te=U&&U.worker;if(!te)return;te.postMessage({cmd:"processThreadQueue"})}return 1}function B1(){Yl("")}function W1(){S||v||Y("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread")}function Tc(){return 2147483648}function V1(T,F,U){i().copyWithin(T,F,F+U)}function U1(){return S?dR().cpus().length:navigator.hardwareConcurrency}function fo(T,F){var U=arguments.length-2,te=arguments;return Ql(function(){for(var ge=U,xe=iu(ge*8),Te=xe>>3,_e=0;_e>3,ge=0;ge>>16),ra(Fe.buffer),1}catch(F){}}function H1(T){var F=i().length;if(T=T>>>0,T<=F)return!1;var U=Tc();if(T>U)return!1;for(var te=1;te<=4;te*=2){var ge=F*(1+.2/te);ge=Math.min(ge,T+100663296);var xe=Math.min(U,Xl(Math.max(T,ge),65536)),Te=j1(xe);if(Te)return!0}return!1}var Xe={inEventHandler:0,removeAllEventListeners:function(){for(var T=Xe.eventHandlers.length-1;T>=0;--T)Xe._removeHandler(T);Xe.eventHandlers=[],Xe.deferredCalls=[]},registerRemoveEventListeners:function(){Xe.removeEventListenersRegistered||(A1.push(Xe.removeAllEventListeners),Xe.removeEventListenersRegistered=!0)},deferredCalls:[],deferCall:function(T,F,U){function te(Te,_e){if(Te.length!=_e.length)return!1;for(var Pt in Te)if(Te[Pt]!=_e[Pt])return!1;return!0}for(var ge in Xe.deferredCalls){var xe=Xe.deferredCalls[ge];if(xe.targetFunction==T&&te(xe.argsList,U))return}Xe.deferredCalls.push({targetFunction:T,precedence:F,argsList:U}),Xe.deferredCalls.sort(function(Te,_e){return Te.precedence<_e.precedence})},removeDeferredCalls:function(T){for(var F=0;F>2]=U,u()[xe+4>>2]=te,u()[xe+8>>2]=ge,j2(T,637534208,F,te,xe)})},getTargetThreadForEventCallback:function(T){switch(T){case 1:return 0;case 2:return Oe.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 q1(T){var F=lc(T)+1,U=G2(F);return lo(T,U,F),U}function K1(T,F,U,te){Ql(function(){var ge=iu(12),xe=0;F&&(xe=q1(F)),u()[ge>>2]=xe,u()[ge+4>>2]=U,u()[ge+8>>2]=te,j2(T,657457152,0,xe,ge)})}function X1(T,F,U,te){F=F?In(F):"",K1(T,F,U,te)}function Z1(T){return T>2?In(T):T}var Y1=[0,typeof document!="undefined"?document:0,typeof window!="undefined"?window:0];function J1(T){T=Z1(T);var F=Y1[T]||(typeof document!="undefined"?document.querySelector(T):void 0);return F}function op(T){return J1(T)}function Nc(T,F,U){var te=op(T);if(!te)return-4;if(te.canvasSharedPtr&&(u()[te.canvasSharedPtr>>2]=F,u()[te.canvasSharedPtr+4>>2]=U),te.offscreenCanvas||!te.controlTransferredOffscreen){te.offscreenCanvas&&(te=te.offscreenCanvas);var ge=!1;if(te.GLctxObject&&te.GLctxObject.GLctx){var xe=te.GLctxObject.GLctx.getParameter(2978);ge=xe[0]===0&&xe[1]===0&&xe[2]===te.width&&xe[3]===te.height}te.width=F,te.height=U,ge&&te.GLctxObject.GLctx.viewport(0,0,F,U)}else if(te.canvasSharedPtr){var Te=u()[te.canvasSharedPtr+8>>2];return X1(Te,T,F,U),1}else return-4;return 0}function Ec(T,F,U){return N?fo(2,1,T,F,U):Nc(T,F,U)}function Q1(T,F,U){var te=op(T);return te?Nc(T,F,U):Ec(T,F,U)}function e2(){throw"unwind"}function t2(T){var F=T.getExtension("ANGLE_instanced_arrays");if(F)return T.vertexAttribDivisor=function(U,te){F.vertexAttribDivisorANGLE(U,te)},T.drawArraysInstanced=function(U,te,ge,xe){F.drawArraysInstancedANGLE(U,te,ge,xe)},T.drawElementsInstanced=function(U,te,ge,xe,Te){F.drawElementsInstancedANGLE(U,te,ge,xe,Te)},1}function r2(T){var F=T.getExtension("OES_vertex_array_object");if(F)return T.createVertexArray=function(){return F.createVertexArrayOES()},T.deleteVertexArray=function(U){F.deleteVertexArrayOES(U)},T.bindVertexArray=function(U){F.bindVertexArrayOES(U)},T.isVertexArray=function(U){return F.isVertexArrayOES(U)},1}function n2(T){var F=T.getExtension("WEBGL_draw_buffers");if(F)return T.drawBuffers=function(U,te){F.drawBuffersWEBGL(U,te)},1}function a2(T){return!!(T.multiDrawWebgl=T.getExtension("WEBGL_multi_draw"))}var Ft={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:{},offscreenCanvases:{},queries:[],stringCache:{},unpackAlignment:4,recordError:function(T){Ft.lastError||(Ft.lastError=T)},getNewId:function(T){for(var F=Ft.counter++,U=T.length;U>2]:-1;ge+=In(u()[U+xe*4>>2],Te<0?void 0:Te)}return ge},createContext:function(T,F){T.getContextSafariWebGL2Fixed||(T.getContextSafariWebGL2Fixed=T.getContext,T.getContext=function(ge,xe){var Te=T.getContextSafariWebGL2Fixed(ge,xe);return ge=="webgl"==Te instanceof WebGLRenderingContext?Te:null});var U=T.getContext("webgl",F);if(!U)return 0;var te=Ft.registerContext(U,F);return te},registerContext:function(T,F){var U=G2(8);u()[U+4>>2]=Dc();var te={handle:U,attributes:F,version:F.majorVersion,GLctx:T};return T.canvas&&(T.canvas.GLctxObject=te),Ft.contexts[U]=te,(typeof F.enableExtensionsByDefault=="undefined"||F.enableExtensionsByDefault)&&Ft.initExtensions(te),U},makeContextCurrent:function(T){return Ft.currentContext=Ft.contexts[T],p.ctx=Fc=Ft.currentContext&&Ft.currentContext.GLctx,!(T&&!Fc)},getContext:function(T){return Ft.contexts[T]},deleteContext:function(T){Ft.currentContext===Ft.contexts[T]&&(Ft.currentContext=null),typeof Xe=="object"&&Xe.removeAllHandlersOnTarget(Ft.contexts[T].GLctx.canvas),Ft.contexts[T]&&Ft.contexts[T].GLctx.canvas&&(Ft.contexts[T].GLctx.canvas.GLctxObject=void 0),wb(Ft.contexts[T].handle),Ft.contexts[T]=null},initExtensions:function(T){if(T||(T=Ft.currentContext),!T.initExtensionsDone){T.initExtensionsDone=!0;var F=T.GLctx;t2(F),r2(F),n2(F),F.disjointTimerQueryExt=F.getExtension("EXT_disjoint_timer_query"),a2(F);var U=F.getSupportedExtensions()||[];U.forEach(function(te){!te.includes("lose_context")&&!te.includes("debug")&&F.getExtension(te)})}}},s2=["default","low-power","high-performance"];function i2(T,F){var U=F>>2,te=u()[U+6],ge={alpha:!!u()[U+0],depth:!!u()[U+1],stencil:!!u()[U+2],antialias:!!u()[U+3],premultipliedAlpha:!!u()[U+4],preserveDrawingBuffer:!!u()[U+5],powerPreference:s2[te],failIfMajorPerformanceCaveat:!!u()[U+7],majorVersion:u()[U+8],minorVersion:u()[U+9],enableExtensionsByDefault:u()[U+10],explicitSwapControl:u()[U+11],proxyContextToMainThread:u()[U+12],renderViaOffscreenBackBuffer:u()[U+13]},xe=op(T);if(!xe||ge.explicitSwapControl)return 0;var Te=Ft.createContext(xe,ge);return Te}function o2(T,F){return i2(T,F)}var tu={mappings:{},buffers:[null,[],[]],printChar:function(T,F){var U=tu.buffers[T];F===0||F===10?((T===1?ee:Q)(kn(U,0)),U.length=0):U.push(F)},varargs:void 0,get:function(){tu.varargs+=4;var T=u()[tu.varargs-4>>2];return T},getStr:function(T){var F=In(T);return F},get64:function(T,F){return T}};function Rc(T){return N?fo(3,1,T):0}function $c(T,F,U,te,ge){if(N)return fo(4,1,T,F,U,te,ge)}function Mc(T,F,U,te){if(N)return fo(5,1,T,F,U,te);for(var ge=0,xe=0;xe>2],_e=u()[F+4>>2];F+=8;for(var Pt=0;Pt<_e;Pt++)tu.printChar(T,i()[Te+Pt]);ge+=_e}return u()[te>>2]=ge,0}function l2(T){De(T)}Oe.init();var Fc,u2=[null,Sc,Ec,Rc,$c,Mc],xb=!1,Pc={__clock_gettime:P1,__emscripten_init_main_thread_js:_1,__emscripten_thread_cleanup:z1,__pthread_create_js:O1,_emscripten_default_pthread_stack_size:D1,_emscripten_notify_thread_queue:L1,abort:B1,emscripten_check_blocking_allowed:W1,emscripten_get_heap_max:Tc,emscripten_get_now:co,emscripten_memcpy_big:V1,emscripten_num_logical_cores:U1,emscripten_receive_on_main_thread_js:G1,emscripten_resize_heap:H1,emscripten_set_canvas_element_size:Q1,emscripten_unwind_to_js_event_loop:e2,emscripten_webgl_create_context:o2,exit:Ic,fd_close:Rc,fd_seek:$c,fd_write:Mc,memory:Fe||p.wasmMemory,setTempRet0:l2},bb=k1(),d2=p.___wasm_call_ctors=function(){return(d2=p.___wasm_call_ctors=p.asm.__wasm_call_ctors).apply(null,arguments)},p2=p._init=function(){return(p2=p._init=p.asm.init).apply(null,arguments)},h2=p._init_with_threads_count=function(){return(h2=p._init_with_threads_count=p.asm.init_with_threads_count).apply(null,arguments)},c2=p._get_threads_count=function(){return(c2=p._get_threads_count=p.asm.get_threads_count).apply(null,arguments)},f2=p._register_tensor=function(){return(f2=p._register_tensor=p.asm.register_tensor).apply(null,arguments)},m2=p._dispose_data=function(){return(m2=p._dispose_data=p.asm.dispose_data).apply(null,arguments)},g2=p._dispose=function(){return(g2=p._dispose=p.asm.dispose).apply(null,arguments)},y2=p._Abs=function(){return(y2=p._Abs=p.asm.Abs).apply(null,arguments)},A2=p._Add=function(){return(A2=p._Add=p.asm.Add).apply(null,arguments)},x2=p._AddN=function(){return(x2=p._AddN=p.asm.AddN).apply(null,arguments)},b2=p._All=function(){return(b2=p._All=p.asm.All).apply(null,arguments)},v2=p._Any=function(){return(v2=p._Any=p.asm.Any).apply(null,arguments)},w2=p._ArgMax=function(){return(w2=p._ArgMax=p.asm.ArgMax).apply(null,arguments)},k2=p._AvgPool=function(){return(k2=p._AvgPool=p.asm.AvgPool).apply(null,arguments)},I2=p._BatchMatMul=function(){return(I2=p._BatchMatMul=p.asm.BatchMatMul).apply(null,arguments)},S2=p._Ceil=function(){return(S2=p._Ceil=p.asm.Ceil).apply(null,arguments)},C2=p._ClipByValue=function(){return(C2=p._ClipByValue=p.asm.ClipByValue).apply(null,arguments)},T2=p._Conv2D=function(){return(T2=p._Conv2D=p.asm.Conv2D).apply(null,arguments)},N2=p._Conv2DBackpropInput=function(){return(N2=p._Conv2DBackpropInput=p.asm.Conv2DBackpropInput).apply(null,arguments)},E2=p._Cos=function(){return(E2=p._Cos=p.asm.Cos).apply(null,arguments)},R2=p._Cosh=function(){return(R2=p._Cosh=p.asm.Cosh).apply(null,arguments)},$2=p._CropAndResize=function(){return($2=p._CropAndResize=p.asm.CropAndResize).apply(null,arguments)},M2=p._Cumprod=function(){return(M2=p._Cumprod=p.asm.Cumprod).apply(null,arguments)},F2=p._Cumsum=function(){return(F2=p._Cumsum=p.asm.Cumsum).apply(null,arguments)},P2=p._DepthToSpace=function(){return(P2=p._DepthToSpace=p.asm.DepthToSpace).apply(null,arguments)},_2=p._DepthwiseConv2dNative=function(){return(_2=p._DepthwiseConv2dNative=p.asm.DepthwiseConv2dNative).apply(null,arguments)},z2=p._Elu=function(){return(z2=p._Elu=p.asm.Elu).apply(null,arguments)},O2=p._Equal=function(){return(O2=p._Equal=p.asm.Equal).apply(null,arguments)},D2=p._Exp=function(){return(D2=p._Exp=p.asm.Exp).apply(null,arguments)},L2=p._FlipLeftRight=function(){return(L2=p._FlipLeftRight=p.asm.FlipLeftRight).apply(null,arguments)},_c=p._Floor=function(){return(_c=p._Floor=p.asm.Floor).apply(null,arguments)},zc=p._FloorDiv=function(){return(zc=p._FloorDiv=p.asm.FloorDiv).apply(null,arguments)},lp=p._FusedBatchNorm=function(){return(lp=p._FusedBatchNorm=p.asm.FusedBatchNorm).apply(null,arguments)},B2=p._FusedConv2D=function(){return(B2=p._FusedConv2D=p.asm.FusedConv2D).apply(null,arguments)},W2=p._FusedDepthwiseConv2D=function(){return(W2=p._FusedDepthwiseConv2D=p.asm.FusedDepthwiseConv2D).apply(null,arguments)},ru=p._Gather=function(){return(ru=p._Gather=p.asm.Gather).apply(null,arguments)},up=p._GatherNd=function(){return(up=p._GatherNd=p.asm.GatherNd).apply(null,arguments)},dp=p._Greater=function(){return(dp=p._Greater=p.asm.Greater).apply(null,arguments)},vb=p._GreaterEqual=function(){return(vb=p._GreaterEqual=p.asm.GreaterEqual).apply(null,arguments)},nu=p._LeakyRelu=function(){return(nu=p._LeakyRelu=p.asm.LeakyRelu).apply(null,arguments)},au=p._Less=function(){return(au=p._Less=p.asm.Less).apply(null,arguments)},V2=p._LessEqual=function(){return(V2=p._LessEqual=p.asm.LessEqual).apply(null,arguments)},H=p._Log=function(){return(H=p._Log=p.asm.Log).apply(null,arguments)},ne=p._LogicalAnd=function(){return(ne=p._LogicalAnd=p.asm.LogicalAnd).apply(null,arguments)},ye=p._Max=function(){return(ye=p._Max=p.asm.Max).apply(null,arguments)},Re=p._MaxPool=function(){return(Re=p._MaxPool=p.asm.MaxPool).apply(null,arguments)},lt=p._Maximum=function(){return(lt=p._Maximum=p.asm.Maximum).apply(null,arguments)},ct=p._Mean=function(){return(ct=p._Mean=p.asm.Mean).apply(null,arguments)},Ye=p._Min=function(){return(Ye=p._Min=p.asm.Min).apply(null,arguments)},He=p._Minimum=function(){return(He=p._Minimum=p.asm.Minimum).apply(null,arguments)},qt=p._MirrorPad=function(){return(qt=p._MirrorPad=p.asm.MirrorPad).apply(null,arguments)},aa=p._Multiply=function(){return(aa=p._Multiply=p.asm.Multiply).apply(null,arguments)},sa=p._Neg=function(){return(sa=p._Neg=p.asm.Neg).apply(null,arguments)},su=p._NonMaxSuppressionV3=function(){return(su=p._NonMaxSuppressionV3=p.asm.NonMaxSuppressionV3).apply(null,arguments)},mo=p._NonMaxSuppressionV4=function(){return(mo=p._NonMaxSuppressionV4=p.asm.NonMaxSuppressionV4).apply(null,arguments)},U2=p._NonMaxSuppressionV5=function(){return(U2=p._NonMaxSuppressionV5=p.asm.NonMaxSuppressionV5).apply(null,arguments)},en=p._NotEqual=function(){return(en=p._NotEqual=p.asm.NotEqual).apply(null,arguments)},ws=p._OneHot=function(){return(ws=p._OneHot=p.asm.OneHot).apply(null,arguments)},Oc=p._PadV2=function(){return(Oc=p._PadV2=p.asm.PadV2).apply(null,arguments)},qN=p._Pow=function(){return(qN=p._Pow=p.asm.Pow).apply(null,arguments)},KN=p._Prelu=function(){return(KN=p._Prelu=p.asm.Prelu).apply(null,arguments)},XN=p._Prod=function(){return(XN=p._Prod=p.asm.Prod).apply(null,arguments)},ZN=p._RealDiv=function(){return(ZN=p._RealDiv=p.asm.RealDiv).apply(null,arguments)},YN=p._Relu=function(){return(YN=p._Relu=p.asm.Relu).apply(null,arguments)},JN=p._Relu6=function(){return(JN=p._Relu6=p.asm.Relu6).apply(null,arguments)},QN=p._ResizeBilinear=function(){return(QN=p._ResizeBilinear=p.asm.ResizeBilinear).apply(null,arguments)},eE=p._Reverse=function(){return(eE=p._Reverse=p.asm.Reverse).apply(null,arguments)},tE=p._RotateWithOffset=function(){return(tE=p._RotateWithOffset=p.asm.RotateWithOffset).apply(null,arguments)},rE=p._Round=function(){return(rE=p._Round=p.asm.Round).apply(null,arguments)},nE=p._Rsqrt=function(){return(nE=p._Rsqrt=p.asm.Rsqrt).apply(null,arguments)},aE=p._ScatterNd=function(){return(aE=p._ScatterNd=p.asm.ScatterNd).apply(null,arguments)},sE=p._SelectV2=function(){return(sE=p._SelectV2=p.asm.SelectV2).apply(null,arguments)},iE=p._Sigmoid=function(){return(iE=p._Sigmoid=p.asm.Sigmoid).apply(null,arguments)},oE=p._Sin=function(){return(oE=p._Sin=p.asm.Sin).apply(null,arguments)},lE=p._Softmax=function(){return(lE=p._Softmax=p.asm.Softmax).apply(null,arguments)},uE=p._SparseFillEmptyRows=function(){return(uE=p._SparseFillEmptyRows=p.asm.SparseFillEmptyRows).apply(null,arguments)},dE=p._SparseReshape=function(){return(dE=p._SparseReshape=p.asm.SparseReshape).apply(null,arguments)},pE=p._SparseSegmentReduction=function(){return(pE=p._SparseSegmentReduction=p.asm.SparseSegmentReduction).apply(null,arguments)},hE=p._Sqrt=function(){return(hE=p._Sqrt=p.asm.Sqrt).apply(null,arguments)},cE=p._Square=function(){return(cE=p._Square=p.asm.Square).apply(null,arguments)},fE=p._SquaredDifference=function(){return(fE=p._SquaredDifference=p.asm.SquaredDifference).apply(null,arguments)},mE=p._Step=function(){return(mE=p._Step=p.asm.Step).apply(null,arguments)},gE=p._StridedSlice=function(){return(gE=p._StridedSlice=p.asm.StridedSlice).apply(null,arguments)},yE=p._Sub=function(){return(yE=p._Sub=p.asm.Sub).apply(null,arguments)},AE=p._Sum=function(){return(AE=p._Sum=p.asm.Sum).apply(null,arguments)},xE=p._Tan=function(){return(xE=p._Tan=p.asm.Tan).apply(null,arguments)},bE=p._Tanh=function(){return(bE=p._Tanh=p.asm.Tanh).apply(null,arguments)},vE=p._Tile=function(){return(vE=p._Tile=p.asm.Tile).apply(null,arguments)},wE=p._TopK=function(){return(wE=p._TopK=p.asm.TopK).apply(null,arguments)},kE=p._Transform=function(){return(kE=p._Transform=p.asm.Transform).apply(null,arguments)},IE=p._Transpose=function(){return(IE=p._Transpose=p.asm.Transpose).apply(null,arguments)},SE=p.__FusedMatMul=function(){return(SE=p.__FusedMatMul=p.asm._FusedMatMul).apply(null,arguments)},G2=p._malloc=function(){return(G2=p._malloc=p.asm.malloc).apply(null,arguments)},wb=p._free=function(){return(wb=p._free=p.asm.free).apply(null,arguments)},CE=p._emscripten_tls_init=function(){return(CE=p._emscripten_tls_init=p.asm.emscripten_tls_init).apply(null,arguments)},kb=p.___errno_location=function(){return(kb=p.___errno_location=p.asm.__errno_location).apply(null,arguments)},Dc=p._pthread_self=function(){return(Dc=p._pthread_self=p.asm.pthread_self).apply(null,arguments)},Ib=p._emscripten_main_thread_process_queued_calls=function(){return(Ib=p._emscripten_main_thread_process_queued_calls=p.asm.emscripten_main_thread_process_queued_calls).apply(null,arguments)},TE=p.__emscripten_thread_crashed=function(){return(TE=p.__emscripten_thread_crashed=p.asm._emscripten_thread_crashed).apply(null,arguments)},Sb=p.__emscripten_thread_init=function(){return(Sb=p.__emscripten_thread_init=p.asm._emscripten_thread_init).apply(null,arguments)},NE=p._emscripten_current_thread_process_queued_calls=function(){return(NE=p._emscripten_current_thread_process_queued_calls=p.asm.emscripten_current_thread_process_queued_calls).apply(null,arguments)},EE=p._emscripten_main_browser_thread_id=function(){return(EE=p._emscripten_main_browser_thread_id=p.asm.emscripten_main_browser_thread_id).apply(null,arguments)},RE=p._emscripten_sync_run_in_main_thread_2=function(){return(RE=p._emscripten_sync_run_in_main_thread_2=p.asm.emscripten_sync_run_in_main_thread_2).apply(null,arguments)},Cb=p._emscripten_sync_run_in_main_thread_4=function(){return(Cb=p._emscripten_sync_run_in_main_thread_4=p.asm.emscripten_sync_run_in_main_thread_4).apply(null,arguments)},Tb=p._emscripten_run_in_main_runtime_thread_js=function(){return(Tb=p._emscripten_run_in_main_runtime_thread_js=p.asm.emscripten_run_in_main_runtime_thread_js).apply(null,arguments)},j2=p._emscripten_dispatch_to_thread_=function(){return(j2=p._emscripten_dispatch_to_thread_=p.asm.emscripten_dispatch_to_thread_).apply(null,arguments)},H2=p.__emscripten_thread_free_data=function(){return(H2=p.__emscripten_thread_free_data=p.asm._emscripten_thread_free_data).apply(null,arguments)},$E=p.__emscripten_thread_exit=function(){return($E=p.__emscripten_thread_exit=p.asm._emscripten_thread_exit).apply(null,arguments)},ME=p._memalign=function(){return(ME=p._memalign=p.asm.memalign).apply(null,arguments)},Nb=p._emscripten_stack_set_limits=function(){return(Nb=p._emscripten_stack_set_limits=p.asm.emscripten_stack_set_limits).apply(null,arguments)},q2=p.stackSave=function(){return(q2=p.stackSave=p.asm.stackSave).apply(null,arguments)},Lc=p.stackRestore=function(){return(Lc=p.stackRestore=p.asm.stackRestore).apply(null,arguments)},iu=p.stackAlloc=function(){return(iu=p.stackAlloc=p.asm.stackAlloc).apply(null,arguments)},FE=p.dynCall_iijjiiii=function(){return(FE=p.dynCall_iijjiiii=p.asm.dynCall_iijjiiii).apply(null,arguments)},PE=p.dynCall_jiji=function(){return(PE=p.dynCall_jiji=p.asm.dynCall_jiji).apply(null,arguments)},Eb=p.__emscripten_allow_main_runtime_queued_calls=21456;p.cwrap=cr,p.keepRuntimeAlive=po,p.PThread=Oe,p.PThread=Oe,p.wasmMemory=Fe,p.ExitStatus=pp;var Bc;function pp(T){this.name="ExitStatus",this.message="Program terminated with exit("+T+")",this.status=T}na=function T(){Bc||K2(),Bc||(na=T)};function K2(T){if(T=T||y,vs>0)return;if(N){c(p),np(),postMessage({cmd:"loaded"});return}if(_r(),vs>0)return;function F(){Bc||(Bc=!0,p.calledRun=!0,!yt&&(np(),c(p),p.onRuntimeInitialized&&p.onRuntimeInitialized(),v1()))}p.setStatus?(p.setStatus("Running..."),setTimeout(function(){setTimeout(function(){p.setStatus("")},1),F()},1)):F()}p.run=K2;function _E(T,F){if(Fr=T,!F&&N)throw Sc(T),"unwind";po()||b1(),zE(T)}function zE(T){Fr=T,po()||(Oe.terminateAllThreads(),p.onExit&&p.onExit(T),yt=!0),x(T,new pp(T))}if(p.preInit)for(typeof p.preInit=="function"&&(p.preInit=[p.preInit]);p.preInit.length>0;)p.preInit.pop()();K2();var Wc;f&&(Wc={uncaughtException:process.listeners("uncaughtException").filter(function(T){return!f.uncaughtException.indexOf(T)>-1}),unhandledRejection:process.listeners("unhandledRejection").filter(function(T){return!f.unhandledRejection.indexOf(T)>-1})});var Vc;if(typeof WasmBackendModule!="undefined")Vc=WasmBackendModule;else if(typeof a!="undefined")Vc=a;else throw new Error("Could not find wasm module in post.js");if(Wc){var OE=Vc._dispose;Vc._dispose=function(){OE(),Wc.uncaughtException.forEach(function(T){process.removeListener("uncaughtException",T)}),Wc.unhandledRejection.forEach(function(T){process.removeListener("unhandledRejection",T)})}}return a.ready}})();typeof e=="object"&&typeof t=="object"?t.exports=r:typeof define=="function"&&define.amd?define([],function(){return r}):typeof e=="object"&&(e.WasmBackendModuleThreadedSimd=r)}}),hR=dr({"src/tfjs-backend-wasm/wasm-out/tfjs-backend-wasm.js"(e,t){var r=(()=>{var n=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename!="undefined"&&(n=n||__filename),function(a){a=a||{};var s=typeof a!="undefined"?a:{},i,o;s.ready=new Promise(function(H,ne){i=H,o=ne});var l;typeof process!="undefined"&&process.listeners&&(l={uncaughtException:process.listeners("uncaughtException"),unhandledRejection:process.listeners("unhandledRejection")});var u=Object.assign({},s),d=[],h="./this.program",p=(H,ne)=>{throw ne},c=typeof window=="object",m=typeof importScripts=="function",f=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",g="";function y(H){return s.locateFile?s.locateFile(H,g):g+H}var A,x,b,v;function S(H){H instanceof up||$("exiting due to exception: "+H)}var N,E,R;f?(m?g=c0().dirname(g)+"/":g=__dirname+"/",R=()=>{E||(N=py(),E=c0())},A=function(H,ne){return R(),H=E.normalize(H),N.readFileSync(H,ne?void 0:"utf8")},b=H=>{var ne=A(H,!0);return ne.buffer||(ne=new Uint8Array(ne)),ne},x=(H,ne,ye)=>{R(),H=E.normalize(H),N.readFile(H,function(Re,lt){Re?ye(Re):ne(lt.buffer)})},process.argv.length>1&&(h=process.argv[1].replace(/\\/g,"/")),d=process.argv.slice(2),process.on("uncaughtException",function(H){if(!(H instanceof up))throw H}),process.on("unhandledRejection",function(H){throw H}),p=(H,ne)=>{if(rp())throw process.exitCode=H,ne;S(ne),process.exit(H)},s.inspect=function(){return"[Emscripten Module object]"}):(c||m)&&(m?g=self.location.href:typeof document!="undefined"&&document.currentScript&&(g=document.currentScript.src),n&&(g=n),g.indexOf("blob:")!==0?g=g.substr(0,g.replace(/[?#].*/,"").lastIndexOf("/")+1):g="",A=H=>{var ne=new XMLHttpRequest;return ne.open("GET",H,!1),ne.send(null),ne.responseText},m&&(b=H=>{var ne=new XMLHttpRequest;return ne.open("GET",H,!1),ne.responseType="arraybuffer",ne.send(null),new Uint8Array(ne.response)}),x=(H,ne,ye)=>{var Re=new XMLHttpRequest;Re.open("GET",H,!0),Re.responseType="arraybuffer",Re.onload=()=>{if(Re.status==200||Re.status==0&&Re.response){ne(Re.response);return}ye()},Re.onerror=ye,Re.send(null)},v=H=>document.title=H);var z=s.print||console.log.bind(console),$=s.printErr||console.warn.bind(console);Object.assign(s,u),u=null,s.arguments&&(d=s.arguments),s.thisProgram&&(h=s.thisProgram),s.quit&&(p=s.quit);var I=4;function _(H){_.shown||(_.shown={}),_.shown[H]||(_.shown[H]=1,$(H))}function O(H,ne){if(typeof WebAssembly.Function=="function"){for(var ye={i:"i32",j:"i64",f:"f32",d:"f64"},Re={parameters:[],results:ne[0]=="v"?[]:[ye[ne[0]]]},lt=1;lt{V=H},Q;s.wasmBinary&&(Q=s.wasmBinary);var ie=s.noExitRuntime||!0;typeof WebAssembly!="object"&&uo("no native wasm support detected");var Y,ae=!1,de;function Ae(H,ne){H||uo(ne)}function be(H){var ne=s["_"+H];return ne}function Ee(H,ne,ye,Re,lt){var ct={string:function(en){var ws=0;if(en!=null&&en!==0){var Oc=(en.length<<2)+1;ws=lp(Oc),ht(en,ws,Oc)}return ws},array:function(en){var ws=lp(en.length);return yt(en,ws),ws}};function Ye(en){return ne==="string"?ot(en):ne==="boolean"?Boolean(en):en}var He=be(H),qt=[],aa=0;if(Re)for(var sa=0;sa=Re);)++lt;if(lt-ne>16&&H.subarray&&Be)return Be.decode(H.subarray(ne,lt));for(var ct="";ne>10,56320|aa&1023)}}return ct}function ot(H,ne){return H?Ze(cr,H,ne):""}function pt(H,ne,ye,Re){if(!(Re>0))return 0;for(var lt=ye,ct=ye+Re-1,Ye=0;Ye=55296&&He<=57343){var qt=H.charCodeAt(++Ye);He=65536+((He&1023)<<10)|qt&1023}if(He<=127){if(ye>=ct)break;ne[ye++]=He}else if(He<=2047){if(ye+1>=ct)break;ne[ye++]=192|He>>6,ne[ye++]=128|He&63}else if(He<=65535){if(ye+2>=ct)break;ne[ye++]=224|He>>12,ne[ye++]=128|He>>6&63,ne[ye++]=128|He&63}else{if(ye+3>=ct)break;ne[ye++]=240|He>>18,ne[ye++]=128|He>>12&63,ne[ye++]=128|He>>6&63,ne[ye++]=128|He&63}}return ne[ye]=0,ye-lt}function ht(H,ne,ye){return pt(H,cr,ne,ye)}function Fe(H){for(var ne=0,ye=0;ye=55296&&Re<=57343&&(Re=65536+((Re&1023)<<10)|H.charCodeAt(++ye)&1023),Re<=127?++ne:Re<=2047?ne+=2:Re<=65535?ne+=3:ne+=4}return ne}var wt=typeof TextDecoder!="undefined"?new TextDecoder("utf-16le"):void 0;function yt(H,ne){tr.set(H,ne)}function Fr(H,ne,ye){for(var Re=0;Re>0]=H.charCodeAt(Re);ye||(tr[ne>>0]=0)}function hr(H,ne){return H%ne>0&&(H+=ne-H%ne),H}var Jr,tr,cr,ta,Qr,rr,kn,In,As;function lo(H){Jr=H,s.HEAP8=tr=new Int8Array(H),s.HEAP16=ta=new Int16Array(H),s.HEAP32=rr=new Int32Array(H),s.HEAPU8=cr=new Uint8Array(H),s.HEAPU16=Qr=new Uint16Array(H),s.HEAPU32=kn=new Uint32Array(H),s.HEAPF32=In=new Float32Array(H),s.HEAPF64=As=new Float64Array(H)}var lc=s.INITIAL_MEMORY||16777216,xs,Ga=[],tp=[],Xl=[],Pr=!1,uc=!1,dc=0;function rp(){return ie||dc>0}function pc(){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)fc(s.preRun.shift());ap(Ga)}function hc(){Pr=!0,ap(tp)}function db(){uc=!0}function cc(){if(s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;)mc(s.postRun.shift());ap(Xl)}function fc(H){Ga.unshift(H)}function ra(H){tp.unshift(H)}function mc(H){Xl.unshift(H)}var Sn=0,Zl=null,bs=null;function A1(H){Sn++,s.monitorRunDependencies&&s.monitorRunDependencies(Sn)}function gc(H){if(Sn--,s.monitorRunDependencies&&s.monitorRunDependencies(Sn),Sn==0&&(Zl!==null&&(clearInterval(Zl),Zl=null),bs)){var ne=bs;bs=null,ne()}}s.preloadedImages={},s.preloadedAudios={};function uo(H){s.onAbort&&s.onAbort(H),H="Aborted("+H+")",$(H),ae=!0,de=1,H+=". Build with -s ASSERTIONS=1 for more info.";var ne=new WebAssembly.RuntimeError(H);throw o(ne),ne}var x1="data:application/octet-stream;base64,";function yc(H){return H.startsWith(x1)}function po(H){return H.startsWith("file://")}var _r;_r="tfjs-backend-wasm.wasm",yc(_r)||(_r=y(_r));function np(H){try{if(H==_r&&Q)return new Uint8Array(Q);if(b)return b(H);throw"both async and sync fetching of the wasm failed"}catch(ne){uo(ne)}}function b1(){if(!Q&&(c||m)){if(typeof fetch=="function"&&!po(_r))return fetch(_r,{credentials:"same-origin"}).then(function(H){if(!H.ok)throw"failed to load wasm binary file at '"+_r+"'";return H.arrayBuffer()}).catch(function(){return np(_r)});if(x)return new Promise(function(H,ne){x(_r,function(ye){H(new Uint8Array(ye))},ne)})}return Promise.resolve().then(function(){return np(_r)})}function v1(){var H={env:Ql,wasi_snapshot_preview1:Ql};function ne(Ye,He){var qt=Ye.exports;s.asm=qt,Y=s.asm.memory,lo(Y.buffer),xs=s.asm.__indirect_function_table,ra(s.asm.__wasm_call_ctors),gc("wasm-instantiate")}A1("wasm-instantiate");function ye(Ye){ne(Ye.instance)}function Re(Ye){return b1().then(function(He){return WebAssembly.instantiate(He,H)}).then(function(He){return He}).then(Ye,function(He){$("failed to asynchronously prepare wasm: "+He),uo(He)})}function lt(){return!Q&&typeof WebAssembly.instantiateStreaming=="function"&&!yc(_r)&&!po(_r)&&typeof fetch=="function"?fetch(_r,{credentials:"same-origin"}).then(function(Ye){var He=WebAssembly.instantiateStreaming(Ye,H);return He.then(ye,function(qt){return $("wasm streaming compile failed: "+qt),$("falling back to ArrayBuffer instantiation"),Re(ye)})}):Re(ye)}if(s.instantiateWasm)try{var ct=s.instantiateWasm(H,ne);return ct}catch(Ye){return $("Module.instantiateWasm callback failed with error: "+Ye),!1}return lt().catch(o),{}}var pb,hb;function ap(H){for(;H.length>0;){var ne=H.shift();if(typeof ne=="function"){ne(s);continue}var ye=ne.func;typeof ye=="number"?ne.arg===void 0?sp(ye)():sp(ye)(ne.arg):ye(ne.arg===void 0?null:ne.arg)}}function vs(H){return H}function Ac(H){var ne=/\b_Z[\w\d_]+/g;return H.replace(ne,function(ye){var Re=ye;return ye===Re?ye:Re+" ["+ye+"]"})}var na=[];function sp(H){var ne=na[H];return ne||(H>=na.length&&(na.length=H+1),na[H]=ne=xs.get(H)),ne}function cb(){var H=new Error;if(!H.stack){try{throw new Error}catch(ne){H=ne}if(!H.stack)return"(no stack trace available)"}return H.stack.toString()}function Yl(H,ne){xs.set(H,ne),na[H]=ne}function w1(){uo("")}function xc(H,ne,ye){cr.copyWithin(H,ne,ne+ye)}function bc(){return 2147483648}function zr(H){try{return Y.grow(H-Jr.byteLength+65535>>>16),lo(Y.buffer),1}catch(ne){}}function vc(H){var ne=cr.length;H=H>>>0;var ye=bc();if(H>ye)return!1;for(var Re=1;Re<=4;Re*=2){var lt=ne*(1+.2/Re);lt=Math.min(lt,H+100663296);var ct=Math.min(ye,hr(Math.max(H,lt),65536)),Ye=zr(ct);if(Ye)return!0}return!1}var Jl={mappings:{},buffers:[null,[],[]],printChar:function(H,ne){var ye=Jl.buffers[H];ne===0||ne===10?((H===1?z:$)(Ze(ye,0)),ye.length=0):ye.push(ne)},varargs:void 0,get:function(){Jl.varargs+=4;var H=rr[Jl.varargs-4>>2];return H},getStr:function(H){var ne=ot(H);return ne},get64:function(H,ne){return H}};function k1(H){return 0}function fb(H,ne,ye,Re,lt){}function mb(H,ne,ye,Re){for(var lt=0,ct=0;ct>2],He=rr[ne+4>>2];ne+=8;for(var qt=0;qt>2]=lt,0}function I1(H){ee(H)}var wc=!1,Ql={abort:w1,emscripten_memcpy_big:xc,emscripten_resize_heap:vc,fd_close:k1,fd_seek:fb,fd_write:mb,setTempRet0:I1},HN=v1(),gb=s.___wasm_call_ctors=function(){return(gb=s.___wasm_call_ctors=s.asm.__wasm_call_ctors).apply(null,arguments)},S1=s._init=function(){return(S1=s._init=s.asm.init).apply(null,arguments)},C1=s._init_with_threads_count=function(){return(C1=s._init_with_threads_count=s.asm.init_with_threads_count).apply(null,arguments)},kc=s._get_threads_count=function(){return(kc=s._get_threads_count=s.asm.get_threads_count).apply(null,arguments)},Ic=s._register_tensor=function(){return(Ic=s._register_tensor=s.asm.register_tensor).apply(null,arguments)},T1=s._dispose_data=function(){return(T1=s._dispose_data=s.asm.dispose_data).apply(null,arguments)},Oe=s._dispose=function(){return(Oe=s._dispose=s.asm.dispose).apply(null,arguments)},N1=s._Abs=function(){return(N1=s._Abs=s.asm.Abs).apply(null,arguments)},Sc=s._Add=function(){return(Sc=s._Add=s.asm.Add).apply(null,arguments)},ho=s._AddN=function(){return(ho=s._AddN=s.asm.AddN).apply(null,arguments)},eu=s._All=function(){return(eu=s._All=s.asm.All).apply(null,arguments)},E1=s._Any=function(){return(E1=s._Any=s.asm.Any).apply(null,arguments)},yb=s._ArgMax=function(){return(yb=s._ArgMax=s.asm.ArgMax).apply(null,arguments)},R1=s._AvgPool=function(){return(R1=s._AvgPool=s.asm.AvgPool).apply(null,arguments)},Ab=s._BatchMatMul=function(){return(Ab=s._BatchMatMul=s.asm.BatchMatMul).apply(null,arguments)},co=s._Ceil=function(){return(co=s._Ceil=s.asm.Ceil).apply(null,arguments)},$1=s._ClipByValue=function(){return($1=s._ClipByValue=s.asm.ClipByValue).apply(null,arguments)},M1=s._Conv2D=function(){return(M1=s._Conv2D=s.asm.Conv2D).apply(null,arguments)},F1=s._Conv2DBackpropInput=function(){return(F1=s._Conv2DBackpropInput=s.asm.Conv2DBackpropInput).apply(null,arguments)},P1=s._Cos=function(){return(P1=s._Cos=s.asm.Cos).apply(null,arguments)},_1=s._Cosh=function(){return(_1=s._Cosh=s.asm.Cosh).apply(null,arguments)},z1=s._CropAndResize=function(){return(z1=s._CropAndResize=s.asm.CropAndResize).apply(null,arguments)},Cc=s._Cumprod=function(){return(Cc=s._Cumprod=s.asm.Cumprod).apply(null,arguments)},O1=s._Cumsum=function(){return(O1=s._Cumsum=s.asm.Cumsum).apply(null,arguments)},D1=s._DepthToSpace=function(){return(D1=s._DepthToSpace=s.asm.DepthToSpace).apply(null,arguments)},L1=s._DepthwiseConv2dNative=function(){return(L1=s._DepthwiseConv2dNative=s.asm.DepthwiseConv2dNative).apply(null,arguments)},B1=s._Elu=function(){return(B1=s._Elu=s.asm.Elu).apply(null,arguments)},W1=s._Equal=function(){return(W1=s._Equal=s.asm.Equal).apply(null,arguments)},Tc=s._Exp=function(){return(Tc=s._Exp=s.asm.Exp).apply(null,arguments)},V1=s._FlipLeftRight=function(){return(V1=s._FlipLeftRight=s.asm.FlipLeftRight).apply(null,arguments)},U1=s._Floor=function(){return(U1=s._Floor=s.asm.Floor).apply(null,arguments)},fo=s._FloorDiv=function(){return(fo=s._FloorDiv=s.asm.FloorDiv).apply(null,arguments)},ip=s._FusedBatchNorm=function(){return(ip=s._FusedBatchNorm=s.asm.FusedBatchNorm).apply(null,arguments)},G1=s._FusedConv2D=function(){return(G1=s._FusedConv2D=s.asm.FusedConv2D).apply(null,arguments)},j1=s._FusedDepthwiseConv2D=function(){return(j1=s._FusedDepthwiseConv2D=s.asm.FusedDepthwiseConv2D).apply(null,arguments)},H1=s._Gather=function(){return(H1=s._Gather=s.asm.Gather).apply(null,arguments)},Xe=s._GatherNd=function(){return(Xe=s._GatherNd=s.asm.GatherNd).apply(null,arguments)},q1=s._Greater=function(){return(q1=s._Greater=s.asm.Greater).apply(null,arguments)},K1=s._GreaterEqual=function(){return(K1=s._GreaterEqual=s.asm.GreaterEqual).apply(null,arguments)},X1=s._LeakyRelu=function(){return(X1=s._LeakyRelu=s.asm.LeakyRelu).apply(null,arguments)},Z1=s._Less=function(){return(Z1=s._Less=s.asm.Less).apply(null,arguments)},Y1=s._LessEqual=function(){return(Y1=s._LessEqual=s.asm.LessEqual).apply(null,arguments)},J1=s._Log=function(){return(J1=s._Log=s.asm.Log).apply(null,arguments)},op=s._LogicalAnd=function(){return(op=s._LogicalAnd=s.asm.LogicalAnd).apply(null,arguments)},Nc=s._Max=function(){return(Nc=s._Max=s.asm.Max).apply(null,arguments)},Ec=s._MaxPool=function(){return(Ec=s._MaxPool=s.asm.MaxPool).apply(null,arguments)},Q1=s._Maximum=function(){return(Q1=s._Maximum=s.asm.Maximum).apply(null,arguments)},e2=s._Mean=function(){return(e2=s._Mean=s.asm.Mean).apply(null,arguments)},t2=s._Min=function(){return(t2=s._Min=s.asm.Min).apply(null,arguments)},r2=s._Minimum=function(){return(r2=s._Minimum=s.asm.Minimum).apply(null,arguments)},n2=s._MirrorPad=function(){return(n2=s._MirrorPad=s.asm.MirrorPad).apply(null,arguments)},a2=s._Multiply=function(){return(a2=s._Multiply=s.asm.Multiply).apply(null,arguments)},Ft=s._Neg=function(){return(Ft=s._Neg=s.asm.Neg).apply(null,arguments)},s2=s._NonMaxSuppressionV3=function(){return(s2=s._NonMaxSuppressionV3=s.asm.NonMaxSuppressionV3).apply(null,arguments)},i2=s._NonMaxSuppressionV4=function(){return(i2=s._NonMaxSuppressionV4=s.asm.NonMaxSuppressionV4).apply(null,arguments)},o2=s._NonMaxSuppressionV5=function(){return(o2=s._NonMaxSuppressionV5=s.asm.NonMaxSuppressionV5).apply(null,arguments)},tu=s._NotEqual=function(){return(tu=s._NotEqual=s.asm.NotEqual).apply(null,arguments)},Rc=s._OneHot=function(){return(Rc=s._OneHot=s.asm.OneHot).apply(null,arguments)},$c=s._PadV2=function(){return($c=s._PadV2=s.asm.PadV2).apply(null,arguments)},Mc=s._Pow=function(){return(Mc=s._Pow=s.asm.Pow).apply(null,arguments)},l2=s._Prelu=function(){return(l2=s._Prelu=s.asm.Prelu).apply(null,arguments)},Fc=s._Prod=function(){return(Fc=s._Prod=s.asm.Prod).apply(null,arguments)},u2=s._RealDiv=function(){return(u2=s._RealDiv=s.asm.RealDiv).apply(null,arguments)},xb=s._Relu=function(){return(xb=s._Relu=s.asm.Relu).apply(null,arguments)},Pc=s._Relu6=function(){return(Pc=s._Relu6=s.asm.Relu6).apply(null,arguments)},bb=s._ResizeBilinear=function(){return(bb=s._ResizeBilinear=s.asm.ResizeBilinear).apply(null,arguments)},d2=s._Reverse=function(){return(d2=s._Reverse=s.asm.Reverse).apply(null,arguments)},p2=s._RotateWithOffset=function(){return(p2=s._RotateWithOffset=s.asm.RotateWithOffset).apply(null,arguments)},h2=s._Round=function(){return(h2=s._Round=s.asm.Round).apply(null,arguments)},c2=s._Rsqrt=function(){return(c2=s._Rsqrt=s.asm.Rsqrt).apply(null,arguments)},f2=s._ScatterNd=function(){return(f2=s._ScatterNd=s.asm.ScatterNd).apply(null,arguments)},m2=s._SelectV2=function(){return(m2=s._SelectV2=s.asm.SelectV2).apply(null,arguments)},g2=s._Sigmoid=function(){return(g2=s._Sigmoid=s.asm.Sigmoid).apply(null,arguments)},y2=s._Sin=function(){return(y2=s._Sin=s.asm.Sin).apply(null,arguments)},A2=s._Softmax=function(){return(A2=s._Softmax=s.asm.Softmax).apply(null,arguments)},x2=s._SparseFillEmptyRows=function(){return(x2=s._SparseFillEmptyRows=s.asm.SparseFillEmptyRows).apply(null,arguments)},b2=s._SparseReshape=function(){return(b2=s._SparseReshape=s.asm.SparseReshape).apply(null,arguments)},v2=s._SparseSegmentReduction=function(){return(v2=s._SparseSegmentReduction=s.asm.SparseSegmentReduction).apply(null,arguments)},w2=s._Sqrt=function(){return(w2=s._Sqrt=s.asm.Sqrt).apply(null,arguments)},k2=s._Square=function(){return(k2=s._Square=s.asm.Square).apply(null,arguments)},I2=s._SquaredDifference=function(){return(I2=s._SquaredDifference=s.asm.SquaredDifference).apply(null,arguments)},S2=s._Step=function(){return(S2=s._Step=s.asm.Step).apply(null,arguments)},C2=s._StridedSlice=function(){return(C2=s._StridedSlice=s.asm.StridedSlice).apply(null,arguments)},T2=s._Sub=function(){return(T2=s._Sub=s.asm.Sub).apply(null,arguments)},N2=s._Sum=function(){return(N2=s._Sum=s.asm.Sum).apply(null,arguments)},E2=s._Tan=function(){return(E2=s._Tan=s.asm.Tan).apply(null,arguments)},R2=s._Tanh=function(){return(R2=s._Tanh=s.asm.Tanh).apply(null,arguments)},$2=s._Tile=function(){return($2=s._Tile=s.asm.Tile).apply(null,arguments)},M2=s._TopK=function(){return(M2=s._TopK=s.asm.TopK).apply(null,arguments)},F2=s._Transform=function(){return(F2=s._Transform=s.asm.Transform).apply(null,arguments)},P2=s._Transpose=function(){return(P2=s._Transpose=s.asm.Transpose).apply(null,arguments)},_2=s.__FusedMatMul=function(){return(_2=s.__FusedMatMul=s.asm._FusedMatMul).apply(null,arguments)},z2=s._malloc=function(){return(z2=s._malloc=s.asm.malloc).apply(null,arguments)},O2=s._free=function(){return(O2=s._free=s.asm.free).apply(null,arguments)},D2=s.___errno_location=function(){return(D2=s.___errno_location=s.asm.__errno_location).apply(null,arguments)},L2=s._emscripten_main_thread_process_queued_calls=function(){return(L2=s._emscripten_main_thread_process_queued_calls=s.asm.emscripten_main_thread_process_queued_calls).apply(null,arguments)},_c=s.stackSave=function(){return(_c=s.stackSave=s.asm.stackSave).apply(null,arguments)},zc=s.stackRestore=function(){return(zc=s.stackRestore=s.asm.stackRestore).apply(null,arguments)},lp=s.stackAlloc=function(){return(lp=s.stackAlloc=s.asm.stackAlloc).apply(null,arguments)},B2=s.dynCall_iijjiiii=function(){return(B2=s.dynCall_iijjiiii=s.asm.dynCall_iijjiiii).apply(null,arguments)},W2=s.dynCall_jiji=function(){return(W2=s.dynCall_jiji=s.asm.dynCall_jiji).apply(null,arguments)};s.cwrap=$e;var ru;function up(H){this.name="ExitStatus",this.message="Program terminated with exit("+H+")",this.status=H}bs=function H(){ru||dp(),ru||(bs=H)};function dp(H){if(H=H||d,Sn>0||(pc(),Sn>0))return;function ne(){ru||(ru=!0,s.calledRun=!0,!ae&&(hc(),i(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),cc()))}s.setStatus?(s.setStatus("Running..."),setTimeout(function(){setTimeout(function(){s.setStatus("")},1),ne()},1)):ne()}s.run=dp;function vb(H){de=H,rp()||(s.onExit&&s.onExit(H),ae=!0),p(H,new up(H))}if(s.preInit)for(typeof s.preInit=="function"&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();dp();var nu;l&&(nu={uncaughtException:process.listeners("uncaughtException").filter(function(H){return!l.uncaughtException.indexOf(H)>-1}),unhandledRejection:process.listeners("unhandledRejection").filter(function(H){return!l.unhandledRejection.indexOf(H)>-1})});var au;if(typeof a!="undefined")au=a;else if(typeof WasmBackendModuleThreadedSimd!="undefined")au=WasmBackendModuleThreadedSimd;else throw new Error("Could not find wasm module in post.js");if(nu){var V2=au._dispose;au._dispose=function(){V2(),nu.uncaughtException.forEach(function(H){process.removeListener("uncaughtException",H)}),nu.unhandledRejection.forEach(function(H){process.removeListener("unhandledRejection",H)})}}return a.ready}})();typeof e=="object"&&typeof t=="object"?t.exports=r:typeof define=="function"&&define.amd?define([],function(){return r}):typeof e=="object"&&(e.WasmBackendModule=r)}}),cR=1e-7,fR=1e-4,Xp=class{constructor(e,t){this.backend=e,this.dataMover=t,this.data=new WeakMap,this.dataIdsCount=0}get(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}set(e,t){this.dataIdsCount++,this.data.set(e,t)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}},_u=class{refCount(e){return Tn("refCount")}incRef(e){return Tn("incRef")}timerAvailable(){return!0}time(e){return Tn("time")}read(e){return Tn("read")}readSync(e){return Tn("readSync")}readToGPU(e,t){return Tn("readToGPU")}numDataIds(){return Tn("numDataIds")}disposeData(e,t){return Tn("disposeData")}write(e,t,r){return Tn("write")}move(e,t,r,n,a){return Tn("move")}memory(){return Tn("memory")}floatPrecision(){return Tn("floatPrecision")}epsilon(){return this.floatPrecision()===32?cR:fR}dispose(){return Tn("dispose")}};function Tn(e){throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}function wv(e){let t=e.length,r=0;for(;t>0;)r=Math.random()*t|0,t--,f0(e,t,r)}function mR(e,t){if(e.length!==t.length)throw new Error(`Array sizes must match to be shuffled together First array length was ${e.length}Second array length was ${t.length}`);let r=e.length,n=0;for(;r>0;)n=Math.random()*r|0,r--,f0(e,r,n),f0(t,r,n)}function _p(e,t,r){return Math.max(e,Math.min(t,r))}function gR(e){return e%2===0?e:e+1}function f0(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function yR(e){let t=0;for(let r=0;rr+` Shapes ${e} and ${t} must match`)}function Go(e){P(e!=null,()=>"The input to the tensor constructor must be a non-null value.")}function Mo(e,t=[],r=!1){if(t==null&&(t=[]),Array.isArray(e)||Ir(e)&&!r)for(let n=0;n0,r){return new Promise((n,a)=>{let s=0,i=()=>{if(e()){n();return}s++;let o=t(s);if(r!=null&&s>=r){a();return}setTimeout(i,o)};i()})}function SR(e,t){let r=1,n=-1;for(let s=0;s=0)r*=e[s];else if(e[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(e[s]<0)throw Error(`Shapes can not be < 0. Found ${e[s]} at dim ${s}`);if(n===-1){if(t>0&&t!==r)throw Error(`Size(${t}) must match the product of shape ${e}`);return e}if(r===0)throw Error(`Cannot infer the missing size in [${e}] when there are 0 elements`);if(t%r!==0)throw Error(`The implicit shape can't be a fractional number. Got ${t} / ${r}`);let a=e.slice();return a[n]=t/r,a}function Hn(e,t){let r=t.length;return e=e==null?t.map((n,a)=>a):[].concat(e),P(e.every(n=>n>=-r&&n`All values in axis param must be in range [-${r}, ${r}) but got axis ${e}`),P(e.every(n=>vu(n)),()=>`All values in axis param must be integers but got axis ${e}`),e.map(n=>n<0?r+n:n)}function kv(e,t){let r=[],n=[],a=t!=null&&Array.isArray(t)&&t.length===0,s=t==null||a?null:Hn(t,e).sort(),i=0;for(let o=0;oo)&&e[o]===1&&(r.push(e[o]),n.push(o)),s[i]<=o&&i++}e[o]!==1&&(r.push(e[o]),n.push(o))}return{newShape:r,keptDims:n}}function Iv(e,t){let r=null;if(e==null||e==="float32")r=new Float32Array(t);else if(e==="int32")r=new Int32Array(t);else if(e==="bool")r=new Uint8Array(t);else throw new Error(`Unknown data type ${e}`);return r}function Sv(e,t){let r=null;if(e==null||e==="float32")r=new Float32Array(t);else if(e==="int32")r=new Int32Array(t);else if(e==="bool")r=new Uint8Array(t);else if(e==="string")r=new Array(t);else throw new Error(`Unknown data type ${e}`);return r}function Cv(e,t){for(let r=0;rt+=r.length),t}function Es(e){return typeof e=="string"||e instanceof String}function Ev(e){return typeof e=="boolean"}function Rv(e){return typeof e=="number"}function q0(e){return Array.isArray(e)?q0(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray?"int32":Rv(e)?"float32":Es(e)?"string":Ev(e)?"bool":"float32"}function Ps(e){return!!(e&&e.constructor&&e.call&&e.apply)}function m0(e,t){for(let r=t;r=0;--n)r[n]=r[n+1]*e[n+1];return r}function $v(e,t,r,n=!1){let a=new Array;if(t.length===1){let s=t[0]*(n?2:1);for(let i=0;il*u)*(n?2:1);for(let l=0;la*s)*(r?2:1);if(n===0)return[];if(n!==t.length)throw new Error(`[${e}] does not match the input size ${t.length}${r?" for a complex tensor":""}.`);return $v(0,e,t,r)}function hy(e,t){let r=K0(e,t);for(let n=0;nn*a,1);if(t==null||t==="float32")return gu(e,new Float32Array(r));if(t==="int32")return gu(e,new Int32Array(r));if(t==="bool")return gu(e,new Uint8Array(r));throw new Error(`Unknown data type ${t}`)}function cy(e){e.forEach(t=>{P(Number.isInteger(t)&&t>=0,()=>`Tensor must have a shape comprised of positive integers but got shape [${e}].`)})}function NR(e,t,r){if(t===0)return 0;if(t===1)return e[0];let n=e[e.length-1];for(let a=0;a{let[r,n]=t.split(":");this.urlFlags[r]=MR(r,n)})}};function RR(e){let t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(r,...n)=>($R(t,n[0],n[1]),n.join("="))),t}function $R(e,t,r){e[decodeURIComponent(t)]=decodeURIComponent(r||"")}function MR(e,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 ${e}.`)}function Z(){return ba}var ba=null;function FR(e){ba=e}var Z2;function Fv(){if(Z2==null){let e;if(typeof window!="undefined")e=window;else if(typeof global!="undefined")e=global;else if(typeof process!="undefined")e=process;else if(typeof self!="undefined")e=self;else throw new Error("Could not find a global object");Z2=e}return Z2}function PR(){let e=Fv();return e._tfGlobals==null&&(e._tfGlobals=new Map),e._tfGlobals}function my(e,t){let r=PR();if(r.has(e))return r.get(e);{let n=t();return r.set(e,n),r.get(e)}}var jo="Abs",Ou="Acos",Du="Acosh",Qa="Add",Ys="AddN",Lu="All",Bu="Any",Js="ArgMax",Wu="ArgMin",Vu="Asin",Uu="Asinh",Gu="Atan",ju="Atanh",Hu="Atan2",Qs="AvgPool",X0="AvgPoolGrad",Zp="AvgPool3D",Z0="AvgPool3DGrad",ei="BatchMatMul",Ho="BatchToSpaceND",Y0="Bincount",Pv="BroadcastTo",J0="BroadcastArgs",ti="Cast",ri="Ceil",es="ClipByValue",Yp="Complex",Jp="ComplexAbs",qo="Concat",ni="Conv2D",Q0="Conv2DBackpropFilter",ai="Conv2DBackpropInput",Qp="Conv3D",ef="Conv3DBackpropFilterV2",tf="Conv3DBackpropInputV2",si="Cos",ii="Cosh",Ko="Cumprod",oi="Cumsum",Xo="CropAndResize",rf="DenseBincount",Zo="DepthToSpace",li="DepthwiseConv2dNative",nf="DepthwiseConv2dNativeBackpropFilter",af="DepthwiseConv2dNativeBackpropInput",sf="Diag",eh="Dilation2D",g0="Dilation2DBackpropInput",y0="Dilation2DBackpropFilter",ui="RealDiv",th="Einsum",di="Elu",of="EluGrad",qu="Erf",Yo="Equal",pi="Exp",Jo="ExpandDims",Qo="Expm1",lf="FFT",Ku="Fill",el="FlipLeftRight",hi="Floor",ci="FloorDiv",fi="FusedBatchNorm",tl="GatherV2",rl="GatherNd",nl="Greater",mi="GreaterEqual",gi="Identity",uf="IFFT",rh="Imag",Xu="IsFinite",Zu="IsInf",Yu="IsNan",yi="LeakyRelu",al="Less",sl="LessEqual",df="LinSpace",Ai="Log",Ju="Log1p",il="LogicalAnd",Qu="LogicalNot",nh="LogicalOr",_v="LogSoftmax",ah="LRN",pf="LRNGrad",xi="Max",bi="Maximum",vi="MaxPool",hf="MaxPoolGrad",sh="MaxPool3D",cf="MaxPool3DGrad",ff="MaxPoolWithArgmax",wi="Mean",ki="Min",Ii="Minimum",Si="MirrorPad",ed="Mod",mf="Multinomial",Ci="Multiply",ol="Neg",ll="NotEqual",ul="NonMaxSuppressionV3",td="NonMaxSuppressionV4",dl="NonMaxSuppressionV5",pl="OnesLike",hl="OneHot",cl="Pack",Ti="PadV2",_R="Pool",Ni="Pow",Ei="Prelu",Ri="Prod",rd="Range",ih="Real",nd="Reciprocal",$i="Relu",fl="Reshape",ad="ResizeNearestNeighbor",gf="ResizeNearestNeighborGrad",Mi="ResizeBilinear",yf="ResizeBilinearGrad",Fi="Relu6",ml="Reverse",gl="Round",Pi="Rsqrt",yl="ScatterNd",Al="Select",sd="Selu",xl="Slice",_i="Sin",bl="Sinh",id="Sign",zi="Sigmoid",od="Softplus",Oi="Sqrt",Di="Sum",vl="SpaceToBatchND",wl="SplitV",Li="Softmax",oh="SparseFillEmptyRows",ld="SparseReshape",lh="SparseSegmentMean",uh="SparseSegmentSum",dh="SparseToDense",Bi="SquaredDifference",ud="Square",kl="StridedSlice",ph="StringNGrams",Af="StringSplit",xf="StringToHashBucketFast",Wi="Sub",Il="Tan",Vi="Tanh",ts="Tile",Sl="TopK",Cl="Transform",Ui="Transpose",bf="Unique",Tl="Unpack",hh="UnsortedSegmentSum",Nl="ZerosLike",Gi="Step",zp="FromPixels",El="RotateWithOffset",_s="_FusedMatMul",zs="FusedConv2D",Os="FusedDepthwiseConv2D";function Ns(...e){Z().getBool("IS_TEST")||Z().getBool("PROD")||console.warn(...e)}function zR(...e){Z().getBool("IS_TEST")||Z().getBool("PROD")||console.log(...e)}var wu=my("kernelRegistry",()=>new Map),Op=my("gradRegistry",()=>new Map);function A0(e,t){let r=gy(e,t);return wu.get(r)}function pg(e){return Op.get(e)}function Ma(e){let t=wu.entries(),r=[];for(;;){let{done:n,value:a}=t.next();if(n)break;let[s,i]=a,[o]=s.split("_");o===e&&r.push(i)}return r}function qn(e){let{kernelName:t,backendName:r}=e,n=gy(t,r);wu.has(n)&&Ns(`The kernel '${t}' for backend '${r}' is already registered`),wu.set(n,e)}function zv(e){let{kernelName:t}=e;Op.has(t)&&Z().getBool("DEBUG")&&Ns(`Overriding the gradient for '${t}'`),Op.set(t,e)}function OR(e,t){let r=gy(e,t);if(!wu.has(r))throw new Error(`The kernel '${e}' for backend '${t}' is not registered`);wu.delete(r)}function DR(e){if(!Op.has(e))throw new Error(`The gradient '${e}' for backend is not registered`);Op.delete(e)}function LR(e,t){Ma(e).forEach(r=>{let n=Object.assign({},r,{backendName:t});qn(n)})}function gy(e,t){return`${t}_${e}`}var w={};Le(w,{arraysEqual:()=>Zs,assert:()=>P,assertNonNegativeIntegerDimensions:()=>cy,assertNonNull:()=>Go,assertShapesMatch:()=>Ur,bytesFromStringArray:()=>Nv,bytesPerElement:()=>dg,checkConversionForErrors:()=>Cv,clamp:()=>_p,computeStrides:()=>zu,createScalarValue:()=>jR,createShuffledIndices:()=>kR,decodeString:()=>x0,distSquared:()=>xR,encodeString:()=>fh,fetch:()=>qR,fingerPrint64:()=>GR,flatten:()=>Mo,getArrayFromDType:()=>Sv,getTypedArrayFromDType:()=>Iv,hasEncodingLoss:()=>CR,hexToLong:()=>ch,indexToLoc:()=>ER,inferDtype:()=>q0,inferFromImplicitShape:()=>SR,isBoolean:()=>Ev,isFunction:()=>Ps,isInt:()=>vu,isNumber:()=>Rv,isPromise:()=>fy,isScalarShape:()=>bR,isString:()=>Es,isTypedArray:()=>Ir,isValidDtype:()=>Tv,locToIndex:()=>NR,makeOnesTypedArray:()=>hy,makeZerosNestedTypedArray:()=>TR,makeZerosTypedArray:()=>K0,nearestDivisor:()=>m0,nearestLargerEven:()=>gR,now:()=>Dp,parseAxisParam:()=>Hn,randUniform:()=>AR,repeatedTry:()=>IR,rightPad:()=>Rp,shuffle:()=>wv,shuffleCombo:()=>mR,sizeFromShape:()=>Tt,sizeToSquarishShape:()=>wR,squeezeShape:()=>kv,sum:()=>yR,swap:()=>f0,tanh:()=>vR,toNestedArray:()=>gu,toTypedArray:()=>vf});var Pb=Uo(YE()),vo=Pb.default||Pb;function ch(e){return vo.fromString(e,!0,16)}var Ov=ch("c3a5c85c97cb3127"),Ao=ch("b492b66fbe98f273"),Or=ch("9ae16a3b2f90404f");function hg(e){return e.xor(e.shru(47))}function Dv(e,t,r){let n=e.slice(t,t+r);return vo.fromBytes(Array.from(n),!0,!0)}function kt(e,t){return Dv(e,t,8)}function _b(e,t){return Dv(e,t,4)}function fr(e,t){return t===0?e:e.shru(t).or(e.shl(64-t))}function $s(e,t,r=ch("9ddfea08eb382d69")){let n=e.xor(t).mul(r);n=n.xor(n.shru(47));let a=t.xor(n).mul(r);return a=a.xor(a.shru(47)),a=a.mul(r),a}function BR(e,t,r,n,a,s){a=a.add(e),s=fr(s.add(a).add(n),21);let i=a;return a=a.add(t),a=a.add(r),s=s.add(fr(a,44)),[a.add(n),s.add(i)]}function jc(e,t,r,n){return BR(kt(e,t),kt(e,t+8),kt(e,t+16),kt(e,t+24),r,n)}function WR(e,t=e.length){if(t>=8){let r=Or.add(t*2),n=kt(e,0).add(Or),a=kt(e,t-8),s=fr(a,37).mul(r).add(n),i=fr(n,25).add(a).mul(r);return $s(s,i,r)}if(t>=4){let r=Or.add(t*2),n=_b(e,0);return $s(n.shl(3).add(t),_b(e,t-4),r)}if(t>0){let r=e[0],n=e[t>>1],a=e[t-1],s=r+(n<<8),i=t+(a<<2);return hg(Or.mul(s).xor(Ov.mul(i))).mul(Or)}return Or}function VR(e,t=e.length){let r=Or.add(t*2),n=kt(e,0).mul(Ao),a=kt(e,8),s=kt(e,t-8).mul(r),i=kt(e,t-16).mul(Or);return $s(fr(n.add(a),43).add(fr(s,30)).add(i),n.add(fr(a.add(Or),18)).add(s),r)}function UR(e,t=e.length){let r=Or.add(t*2),n=kt(e,0).mul(Or),a=kt(e,8),s=kt(e,t-8).mul(r),i=kt(e,t-16).mul(Or),o=fr(n.add(a),43).add(fr(s,30)).add(i),l=$s(o,n.add(fr(a.add(Or),18)).add(s),r),u=kt(e,16).mul(r),d=kt(e,24),h=o.add(kt(e,t-32)).mul(r),p=l.add(kt(e,t-24)).mul(r);return $s(fr(u.add(d),43).add(fr(h,30)).add(p),u.add(fr(d.add(n),18)).add(h),r)}function GR(e,t=e.length){let r=vo.fromNumber(81,!0);if(t<=32)return t<=16?WR(e,t):VR(e,t);if(t<=64)return UR(e,t);let n=r,a=r.mul(Ao).add(113),s=hg(a.mul(Or).add(113)).mul(Or),i=[vo.UZERO,vo.UZERO],o=[vo.UZERO,vo.UZERO];n=n.mul(Or).add(kt(e,0));let l=0,u=(t-1>>6)*64,d=u+(t-1&63)-63;do n=fr(n.add(a).add(i[0]).add(kt(e,l+8)),37).mul(Ao),a=fr(a.add(i[1]).add(kt(e,l+48)),42).mul(Ao),n=n.xor(o[1]),a=a.add(i[0]).add(kt(e,l+40)),s=fr(s.add(o[0]),33).mul(Ao),i=jc(e,l,i[1].mul(Ao),n.add(o[0])),o=jc(e,l+32,s.add(o[1]),a.add(kt(e,l+16))),[s,n]=[n,s],l+=64;while(l!==u);let h=Ao.add(s.and(255).shl(1));return l=d,o[0]=o[0].add(t-1&63),i[0]=i[0].add(o[0]),o[0]=o[0].add(i[0]),n=fr(n.add(a).add(i[0]).add(kt(e,l+8)),37).mul(h),a=fr(a.add(i[1]).add(kt(e,l+48)),42).mul(h),n=n.xor(o[1].mul(9)),a=a.add(i[0].mul(9).add(kt(e,l+40))),s=fr(s.add(o[0]),33).mul(h),i=jc(e,l,i[1].mul(h),n.add(o[0])),o=jc(e,l+32,s.add(o[1]),a.add(kt(e,l+16))),[s,n]=[n,s],$s($s(i[0],o[0],h).add(hg(a).mul(Ov)).add(s),$s(i[1],o[1],h).add(n),h)}function jR(e,t){return t==="string"?fh(e):vf([e],t)}function HR(e,t){return e instanceof Float32Array&&t==="float32"||e instanceof Int32Array&&t==="int32"||e instanceof Uint8Array&&t==="bool"}function vf(e,t){if(t==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=Mo(e)),Z().getBool("DEBUG")&&Cv(e,t),HR(e,t))return e;if(t==null||t==="float32"||t==="complex64")return new Float32Array(e);if(t==="int32")return new Int32Array(e);if(t==="bool"){let r=new Uint8Array(e.length);for(let n=0;n{n=r()},s,i=Dp();if(this.backendTimer.timerAvailable())s=this.backendTimer.time(a);else{a();for(let o of n)o.dataSync();s=Promise.resolve({kernelMs:Dp()-i})}if(Z().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let o=0;o{XR(u,l.dtype,e)})}return{kernelName:e,outputs:n,inputs:t,timeMs:s.then(o=>o.kernelMs),extraInfo:s.then(o=>o.getExtraProfileInfo!=null?o.getExtraProfileInfo():"")}}logKernelProfile(e){let{kernelName:t,outputs:r,timeMs:n,inputs:a,extraInfo:s}=e;r.forEach(i=>{Promise.all([i.data(),n,s]).then(o=>{this.logger.logKernelProfile(t,i,o[0],o[1],a,o[2])})})}};function XR(e,t,r){if(t!=="float32")return!1;for(let n=0;n0?m:""} `}}console.log(`%c${o} %c${i} %c${l}D ${d} %c${u} %c${h} %c${s}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}};function YR(e,t,r){let n={},a={};for(let l=0;ln[f.id]=!0),c=!0,a[u.id]=!0;break}if(c)break}}let s={};s[r.id]=!0;let i={};for(let l=e.length-1;l>=0;l--){let u=e[l],d=u.inputs;for(let h=0;h=0;a--){let s=t[a],i=[];if(s.outputs.forEach(l=>{let u=e[l.id];u!=null?i.push(u):i.push(null)}),s.gradient==null)throw new Error(`Cannot compute gradient: gradient function not found for ${s.kernelName}.`);let o=s.gradient(i);for(let l in s.inputs){if(!(l in o))throw new Error(`Cannot backprop through input ${l}. Available gradients found: ${Object.keys(o)}.`);let u=r(()=>o[l]());if(u.dtype!=="float32")throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input ${l} must have 'float32' dtype, but has '${u.dtype}'`);let d=s.inputs[l];if(!Zs(u.shape,d.shape))throw new Error(`Error in gradient for op ${s.kernelName}. The gradient of input '${l}' has shape '${u.shape}', which does not match the shape of the input '${d.shape}'`);if(e[d.id]==null)e[d.id]=u;else{let h=e[d.id];e[d.id]=n(h,u),h.dispose()}}}}var zb=20,gp=3,Y2=7;function QR(e,t,r,n){let a=zu(t),s=e$(e,t,r,a),i=t.length,o=r0(e,t,r,a,s),l=["Tensor"];return n&&(l.push(` dtype: ${r}`),l.push(` rank: ${i}`),l.push(` shape: [${t}]`),l.push(" values:")),l.push(o.map(u=>" "+u).join(` `)),l.join(` `)}function e$(e,t,r,n){let a=Tt(t),s=n[n.length-1],i=new Array(s).fill(0),o=t.length,l=r==="complex64"?vp(e):e;if(o>1)for(let u=0;uzb){let g=gp*i,y=Array.from(e.slice(0,g)),A=Array.from(e.slice((o-gp)*i,o*i));return r==="complex64"&&(y=vp(y),A=vp(A)),["["+y.map((x,b)=>bp(x,a[b],r)).join(", ")+", ..., "+A.map((x,b)=>bp(x,a[o-gp+b],r)).join(", ")+"]"]}let f=r==="complex64"?vp(e):Array.from(e);return["["+f.map((g,y)=>bp(g,a[y],r)).join(", ")+"]"]}let u=t.slice(1),d=n.slice(1),h=n[0]*i,p=[];if(o>zb){for(let f=0;f`Length of values '${n}' does not match the size inferred by the shape '${this.size}'.`)}if(t==="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=r||Sv(t,this.size),this.strides=zu(e)}set(e,...t){t.length===0&&(t=[0]),P(t.length===this.rank,()=>`The number of provided coordinates (${t.length}) must match the rank (${this.rank})`);let r=this.locToIndex(t);this.values[r]=e}get(...e){e.length===0&&(e=[0]);let t=0;for(let n of e){if(n<0||n>=this.shape[t]){let a=`Requested out of range element at ${e}. Buffer shape=${this.shape}`;throw new Error(a)}t++}let r=e[e.length-1];for(let n=0;nx0(r))}catch(r){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataToGPU(e){return this.throwIfDisposed(),la().readToGPU(this.dataId,e)}dataSync(){this.throwIfDisposed();let e=la().readSync(this.dataId);if(this.dtype==="string")try{return e.map(t=>x0(t))}catch(t){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return e}async bytes(){this.throwIfDisposed();let e=await la().read(this.dataId);return this.dtype==="string"?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(la().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return cu.print(this,e)}clone(){return this.throwIfDisposed(),cu.clone(this)}toString(e=!1){let t=this.dataSync();return QR(t,this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),cu.cast(this,e)}variable(e=!0,t,r){return this.throwIfDisposed(),la().makeVariable(this,e,t,r)}};Object.defineProperty(nt,Symbol.hasInstance,{value:e=>!!e&&e.data!=null&&e.dataSync!=null&&e.throwIfDisposed!=null});function s$(){return my("Tensor",()=>nt)}s$();var Lp=class extends nt{constructor(e,t,r,n){super(e.shape,e.dtype,e.dataId,n),this.trainable=t,this.name=r}assign(e){if(e.dtype!==this.dtype)throw new Error(`dtype of the new value (${e.dtype}) and previous value (${this.dtype}) must match`);if(!Zs(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);la().disposeTensor(this),this.dataId=e.dataId,la().incRef(this,null)}dispose(){la().disposeVariable(this),this.isDisposedInternal=!0}};Object.defineProperty(Lp,Symbol.hasInstance,{value:e=>e instanceof nt&&e.assign!=null&&e.assign instanceof Function});var ha={};Le(ha,{assertTypesMatch:()=>jv,getTensorsInContainer:()=>yy,isTensorInList:()=>o$,makeTypesMatch:()=>Lt});var Bv=(e=>(e.R0="R0",e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.R5="R5",e.R6="R6",e))(Bv||{}),Wv=(e=>(e.float32="float32",e.int32="int32",e.bool="int32",e.complex64="complex64",e))(Wv||{}),Vv=(e=>(e.float32="float32",e.int32="int32",e.bool="bool",e.complex64="complex64",e))(Vv||{}),Uv=(e=>(e.float32="float32",e.int32="float32",e.bool="float32",e.complex64="complex64",e))(Uv||{}),Gv=(e=>(e.float32="complex64",e.int32="complex64",e.bool="complex64",e.complex64="complex64",e))(Gv||{}),i$={float32:Uv,int32:Wv,bool:Vv,complex64:Gv};function Tr(e,t){if(e==="string"||t==="string"){if(e==="string"&&t==="string")return"string";throw new Error(`Can not upcast ${e} with ${t}`)}return i$[e][t]}function mh(e){return Tr(e,"int32")}function Lt(e,t){if(e.dtype===t.dtype)return[e,t];let r=Tr(e.dtype,t.dtype);return[e.cast(r),t.cast(r)]}function jv(e,t){P(e.dtype===t.dtype,()=>`The dtypes of the first(${e.dtype}) and second(${t.dtype}) input must match`)}function o$(e,t){return t.some(r=>r.id===e.id)}function yy(e){let t=[];return Hv(e,t,new Set),t}function Hv(e,t,r){if(e==null)return;if(e instanceof nt){t.push(e);return}if(!l$(e))return;let n=e;for(let a in n){let s=n[a];r.has(s)||(r.add(s),Hv(s,t,r))}}function l$(e){return Array.isArray(e)||typeof e=="object"}function J2(e){return e.kernelName!=null}var Ob=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(e=>e.name)))}}}dispose(){for(let e in this.registeredVariables)this.registeredVariables[e].dispose()}},cg=class{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new Ob}async ready(){if(this.pendingBackendInit!=null)return this.pendingBackendInit.then(()=>{});if(this.backendInstance!=null)return;let e=this.getSortedBackends();for(let t=0;t{e.setupFunc!=null&&e.setupFunc(this.backendInstance)})}disposeRegisteredKernels(e){Ma(e).forEach(t=>{t.disposeFunc!=null&&t.disposeFunc(this.registry[e])})}initializeBackend(e){let t=this.registryFactory[e];if(t==null)throw new Error(`Cannot initialize backend ${e}, no registration found.`);try{let r=t.factory();if(r&&!(r instanceof _u)&&typeof r.then=="function"){let n=++this.pendingBackendInitId,a=r.then(s=>n(nthis.registryFactory[t].priority-this.registryFactory[e].priority)}initializeBackendsAndReturnBest(){let e=this.getSortedBackends();for(let t=0;tthis.startScope(r),()=>this.endScope(n),()=>(n=t(),n instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),n))}scopedRun(e,t,r){e();try{let n=r();return t(),n}catch(n){throw t(),n}}nextTensorId(){return cg.nextTensorId++}nextVariableId(){return cg.nextVariableId++}clone(e){let t=B.runKernel(gi,{x:e}),r={x:e},n=s=>({x:()=>{let i="float32",o={x:s},l={dtype:i};return B.runKernel(ti,o,l)}}),a=[];return this.addTapeNode(this.state.activeScope.name,r,[t],n,a,{}),t}runKernel(e,t,r){if(this.backendName==null&&this.backend,A0(e,this.backendName)==null)throw new Error(`Kernel '${e}' not registered for backend '${this.backendName}'`);return this.runKernelFunc({kernelName:e,inputs:t,attrs:r})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(e,t,r){let n=this.backend.numDataIds(),a=0;r.forEach(o=>{a+=o.dtype==="complex64"?3:1});let s=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],i=n-t-a-s;if(i>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${i} data ids) after running '${e}'`)}runKernelFunc(e){let t,r=[],n=this.isTapeOn(),a=this.state.numBytes,s=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);let i;this.backendName==null&&this.backend;let o,l=J2(e)?e.kernelName:this.state.activeScope!=null?this.state.activeScope.name:"";if(J2(e)){let{kernelName:c,inputs:m,attrs:f}=e;this.backendName==null&&this.backend;let g=A0(c,this.backendName);P(g!=null,()=>`Cannot find registered kernel '${c}' for backend '${this.backendName}'`),i=()=>{let y=this.backend.numDataIds();o=g.kernelFunc({inputs:m,attrs:f,backend:this.backend});let A=Array.isArray(o)?o:[o];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(c,y,A);let x=A.map(b=>{if(b.rank!=null)return b;let{dataId:v,shape:S,dtype:N}=b;return this.makeTensorFromDataId(v,S,N)});if(n){let b=this.getTensorsForGradient(c,m,x);r=this.saveTensorsForBackwardMode(b)}return x}}else{let{forwardFunc:c}=e,m=f=>{!n||(r=f.map(g=>this.keep(this.clone(g))))};i=()=>{let f=this.backend.numDataIds();o=this.tidy(()=>c(this.backend,m));let g=Array.isArray(o)?o:[o];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(l,f,g),g}}let{inputs:u,attrs:d}=e,h=J2(e)?null:e.backwardsFunc,p;return this.scopedRun(()=>this.state.kernelDepth++,()=>this.state.kernelDepth--,()=>{!this.ENV.getBool("DEBUG")&&!this.state.profiling?t=i():(p=this.profiler.profileKernel(l,u,()=>i()),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(p),t=p.outputs)}),n&&this.addTapeNode(l,u,t,h,r,d),this.state.profiling&&this.state.activeProfile.kernels.push({name:l,bytesAdded:this.state.numBytes-a,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-s,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(u).map(c=>u[c]!=null?u[c].shape:null),outputShapes:t.map(c=>c.shape),kernelTimeMs:p.timeMs,extraInfo:p.extraInfo}),Array.isArray(o)?t:t[0]}saveTensorsForBackwardMode(e){return e.map(t=>this.keep(this.clone(t)))}getTensorsForGradient(e,t,r){let n=pg(e);if(n!=null){let a=n.inputsToSave||[],s=n.outputsToSave||[],i;n.saveAllInputs?(P(Array.isArray(t),()=>"saveAllInputs is true, expected inputs to be an array."),i=Object.keys(t).map(l=>t[l])):i=a.map(l=>t[l]);let o=r.filter((l,u)=>s[u]);return i.concat(o)}return[]}makeTensor(e,t,r,n){if(e==null)throw new Error("Values passed to engine.makeTensor() are null");r=r||"float32",n=n||this.backend;let a=e;r==="string"&&Es(e[0])&&(a=e.map(o=>fh(o)));let s=n.write(a,t,r),i=new nt(t,r,s,this.nextTensorId());if(this.trackTensor(i,n),r==="string"){let o=this.state.tensorInfo.get(s),l=Nv(a);this.state.numBytes+=l-o.bytes,o.bytes=l}return i}makeTensorFromDataId(e,t,r,n){r=r||"float32";let a=new nt(t,r,e,this.nextTensorId());return this.trackTensor(a,n),a}makeVariable(e,t=!0,r,n){r=r||this.nextVariableId().toString(),n!=null&&n!==e.dtype&&(e=e.cast(n));let a=new Lp(e,t,r,this.nextTensorId());if(this.state.registeredVariables[a.name]!=null)throw new Error(`Variable with name ${a.name} was already registered`);return this.state.registeredVariables[a.name]=a,this.incRef(a,this.backend),a}trackTensor(e,t){this.state.numTensors++,e.dtype==="string"&&this.state.numStringTensors++;let r=0;e.dtype!=="complex64"&&e.dtype!=="string"&&(r=e.size*dg(e.dtype)),this.state.numBytes+=r,this.state.tensorInfo.has(e.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(e.dataId,{backend:t||this.backend,dtype:e.dtype,shape:e.shape,bytes:r})),e instanceof Lp||this.track(e)}incRef(e,t){this.trackTensor(e,t),this.backend.incRef(e.dataId)}removeDataId(e,t){this.state.tensorInfo.has(e)&&this.state.tensorInfo.get(e).backend===t&&(this.state.tensorInfo.delete(e),this.state.numDataBuffers--)}disposeTensor(e){if(!this.state.tensorInfo.has(e.dataId))return;let t=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,e.dtype==="string"&&(this.state.numStringTensors--,this.state.numBytes-=t.bytes),e.dtype!=="complex64"&&e.dtype!=="string"){let r=e.size*dg(e.dtype);this.state.numBytes-=r}t.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,t.backend)}disposeVariables(){for(let e in this.state.registeredVariables){let t=this.state.registeredVariables[e];this.disposeVariable(t)}}disposeVariable(e){this.disposeTensor(e),this.state.registeredVariables[e.name]!=null&&delete this.state.registeredVariables[e.name]}memory(){let e=this.backend.memory();return e.numTensors=this.state.numTensors,e.numDataBuffers=this.state.numDataBuffers,e.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(e.unreliable=!0,e.reasons==null&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}async profile(e){this.state.profiling=!0;let t=this.state.numBytes,r=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await e(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map(n=>n.totalBytesSnapshot)),this.state.activeProfile.newBytes=this.state.numBytes-t,this.state.activeProfile.newTensors=this.state.numTensors-r;for(let n of this.state.activeProfile.kernels)n.kernelTimeMs=await n.kernelTimeMs,n.extraInfo=await n.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&this.state.kernelDepth===0}addTapeNode(e,t,r,n,a,s){let i={id:this.state.nextTapeNodeId++,kernelName:e,inputs:t,outputs:r,saved:a},o=pg(e);o!=null&&(n=o.gradFunc),n!=null&&(i.gradient=l=>(l=l.map((u,d)=>{if(u==null){let h=r[d],p=K0(h.size,h.dtype);return this.makeTensor(p,h.shape,h.dtype)}return u}),n(l.length>1?l:l[0],a,s))),this.state.activeTape.push(i)}keep(e){return e.kept=!0,e}startTape(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(e){let t={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(t.name=e),this.state.scopeStack.push(t),this.state.activeScope=t}endScope(e){let t=yy(e),r=new Set(t.map(a=>a.id));for(let a=0;a{!a.kept&&a.scopeId===n.id&&this.track(a)})}gradients(e,t,r,n=!1){if(P(t.length>0,()=>"gradients() received an empty list of xs."),r!=null&&r.dtype!=="float32")throw new Error(`dy must have 'float32' dtype, but has '${r.dtype}'`);let a=this.scopedRun(()=>this.startTape(),()=>this.endTape(),()=>this.tidy("forward",e));P(a instanceof nt,()=>"The result y returned by f() must be a tensor.");let s=YR(this.state.activeTape,t,a);if(!n&&s.length===0&&t.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 i={};i[a.id]=r==null?u$(a.shape):r,JR(i,s,l=>this.tidy(l),d$);let o=t.map(l=>i[l.id]);return this.state.gradientDepth===0&&(this.state.activeTape.forEach(l=>{for(let u of l.saved)u.dispose()}),this.state.activeTape=null),{value:a,grads:o}})}customGrad(e){return P(Ps(e),()=>"The f passed in customGrad(f) must be a function."),(...t)=>{P(t.every(i=>i instanceof nt),()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors");let r,n={};t.forEach((i,o)=>{n[o]=i});let a=(i,o)=>(r=e(...t,o),P(r.value instanceof nt,()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),P(Ps(r.gradFunc),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),r.value),s=(i,o)=>{let l=r.gradFunc(i,o),u=Array.isArray(l)?l:[l];P(u.length===t.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(...)."),P(u.every(h=>h instanceof nt),()=>"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 d={};return u.forEach((h,p)=>{d[p]=()=>h}),d};return this.runKernelFunc({forwardFunc:a,backwardsFunc:s,inputs:n})}}readSync(e){return this.state.tensorInfo.get(e).backend.readSync(e)}read(e){return this.state.tensorInfo.get(e).backend.read(e)}readToGPU(e,t){return this.state.tensorInfo.get(e).backend.readToGPU(e,t)}async time(e){let t=Dp(),r=await this.backend.time(e);return r.wallMs=Dp()-t,r}track(e){return this.state.activeScope!=null&&(e.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(e)),e}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new Ob;for(let e in this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}},Ay=cg;Ay.nextTensorId=0;Ay.nextVariableId=0;function u$(e){let t=hy(Tt(e),"float32");return B.makeTensor(t,e,"float32")}function qv(){let e=Fv();if(e._tfengine==null){let t=new Mv(e);e._tfengine=new Ay(t)}return FR(e._tfengine.ENV),r$(()=>e._tfengine),e._tfengine}var B=qv();function d$(e,t){let r={a:e,b:t};return B.runKernel(Qa,r)}var gh={};Le(gh,{isBrowser:()=>Kv,isMobile:()=>c$,mockIsMobile:()=>h$});function p$(){return typeof navigator!="undefined"&&navigator!=null}var fg;function h$(e){fg=e}function c$(e){if(fg!==void 0)return fg;if(e||p$()){if(e||(e=navigator),e.product==="ReactNative")return!0;let t=e.userAgent||e.vendor||(typeof window!="undefined"?window.opera:"");if(!t){let r=e;return r.userAgentData&&r.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 Kv(){return typeof window!="undefined"&&window.document!=null||typeof WorkerGlobalScope!="undefined"}var jn=Z();jn.registerFlag("DEBUG",()=>!1,e=>{e&&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.")});jn.registerFlag("IS_BROWSER",()=>Kv());jn.registerFlag("IS_NODE",()=>typeof process!="undefined"&&typeof process.versions!="undefined"&&typeof process.versions.node!="undefined");jn.registerFlag("IS_CHROME",()=>typeof navigator!="undefined"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor));jn.registerFlag("PROD",()=>!1);jn.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",()=>jn.getBool("DEBUG"));jn.registerFlag("DEPRECATION_WARNINGS_ENABLED",()=>!0);jn.registerFlag("IS_TEST",()=>!1);jn.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",()=>!0);jn.registerFlag("WRAP_TO_IMAGEBITMAP",()=>!1);jn.registerFlag("ENGINE_COMPILE_ONLY",()=>!1);function Fa(e,t){let r=e;if(Ir(e))return t==="string"?[]:[e.length];if(!Array.isArray(e))return[];let n=[];for(;Array.isArray(r)||Ir(r)&&t!=="string";)n.push(r.length),r=r[0];return Array.isArray(e)&&Z().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&Xv(e,n,[]),n}function Xv(e,t,r){if(r=r||[],!Array.isArray(e)&&!Ir(e)){P(t.length===0,()=>`Element arr[${r.join("][")}] is a primitive, but should be an array/TypedArray of ${t[0]} elements`);return}P(t.length>0,()=>`Element arr[${r.join("][")}] should be a primitive, but is an array of ${e.length} elements`),P(e.length===t[0],()=>`Element arr[${r.join("][")}] should have ${t[0]} elements, but has ${e.length} elements`);let n=t.slice(1);for(let a=0;a=0&&(a=n),Db(n,a,t,r),e==null||!Ir(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="string"){let o=e==null?"null":e.constructor.name;throw new Error(`Argument '${t}' passed to '${r}' must be a Tensor or TensorLike, but got '${o}'`)}let s=Fa(e,a);!Ir(e)&&!Array.isArray(e)&&(e=[e]);let i=a!=="string"?vf(e,a):Mo(e,[],!0);return B.makeTensor(i,s,a)}function Bp(e,t,r,n="numeric"){if(!Array.isArray(e))throw new Error(`Argument ${t} passed to ${r} must be a \`Tensor[]\` or \`TensorLike[]\``);return e.map((a,s)=>M(a,`${t}[${s}]`,r,n))}var Zv="__op";function W(e){let t=Object.keys(e);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 r=t[0],n=e[r];r.endsWith("_")&&(r=r.substring(0,r.length-1)),r=r+Zv;let a=(...s)=>{B.startScope(r);try{let i=n(...s);return fy(i)&&console.error("Cannot return a Promise inside of tidy."),B.endScope(i),i}catch(i){throw B.endScope(null),i}};return Object.defineProperty(a,"name",{value:r,configurable:!0}),a}function f$(e,t){let r=M(e,"real","complex"),n=M(t,"imag","complex");Ur(r.shape,n.shape,`real and imag shapes, ${r.shape} and ${n.shape}, must match in call to tf.complex().`);let a={real:r,imag:n};return B.runKernel(Yp,a)}var Ds=W({complex_:f$});function ji(e,t,r,n){if(n==null&&(n=q0(e)),n==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!Ir(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="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){cy(t);let a=Tt(t),s=Tt(r);P(a===s,()=>`Based on the provided shape, [${t}], the tensor should have ${a} values but has ${s}`);for(let i=0;i`Error creating a new Tensor. Inferred shape (${r}) does not match the provided shape (${t}). `)}}return!Ir(e)&&!Array.isArray(e)&&(e=[e]),t=t||r,e=n!=="string"?vf(e,n):Mo(e,[],!0),B.makeTensor(e,t,n)}function ft(e,t,r){let n=Fa(e,r);return ji(e,t,n,r)}var mg={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8},b0=4;async function m$(e,t){let r=[],n=[],a=Array.isArray(e)?e.map(i=>i.name):Object.keys(e);for(let i=0;i{let p=await l.bytes(),c=p.reduce((g,y)=>g+y.length,0)+b0*p.length,m=new Uint8Array(c),f=0;for(let g=0;g{if(t+=s.byteLength,r.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),a=0;return r.forEach(s=>{n.set(new Uint8Array(s.buffer),a),a+=s.byteLength}),n.buffer}var xy=typeof Buffer!="undefined"&&(typeof Blob=="undefined"||typeof atob=="undefined"||typeof btoa=="undefined");function Lb(e){return xy?Buffer.byteLength(e):new Blob([e]).size}function y$(e){if(xy)return Buffer.from(e).toString("base64");let t=new Uint8Array(e),r="";for(let n=0,a=t.length;n{t+=a.byteLength});let r=new Uint8Array(t),n=0;return e.forEach(a=>{r.set(new Uint8Array(a),n),n+=a.byteLength}),r.buffer}function Bb(e){let t="/";for(e=e.trim();e.endsWith(t);)e=e.slice(0,e.length-1);let r=e.split(t);return r[r.length-1]}function Jv(e,t){let r={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:t};return e.signature!=null&&(r.signature=e.signature),e.userDefinedMetadata!=null&&(r.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(r.modelInitializer=e.modelInitializer),e.trainingConfig!=null&&(r.trainingConfig=e.trainingConfig),r}async function vy(e,t){let r={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy};if(e.trainingConfig!=null&&(r.trainingConfig=e.trainingConfig),e.weightsManifest!=null){let[n,a]=await t(e.weightsManifest);r.weightSpecs=n,r.weightData=a}return e.signature!=null&&(r.signature=e.signature),e.userDefinedMetadata!=null&&(r.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(r.modelInitializer=e.modelInitializer),r}function yh(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:e.modelTopology==null?0:Lb(JSON.stringify(e.modelTopology)),weightSpecsBytes:e.weightSpecs==null?0:Lb(JSON.stringify(e.weightSpecs)),weightDataBytes:e.weightData==null?0:e.weightData.byteLength}}function x$(){let e=r=>{let n=r<<13,a=0;for(;(n&8388608)===0;)a-=8388608,n<<=1;return n&=-8388609,a+=947912704,n|a},t=new Uint32Array(2048);t[0]=0;for(let r=1;r<1024;r++)t[r]=e(r);for(let r=1024;r<2048;r++)t[r]=939524096+(r-1024<<13);return t}function b$(){let e=new Uint32Array(64);e[0]=0,e[31]=1199570944,e[32]=2147483648,e[63]=3347054592;for(let t=1;t<31;t++)e[t]=t<<23;for(let t=33;t<63;t++)e[t]=2147483648+(t-32<<23);return e}function v$(){let e=new Uint32Array(64);for(let t=0;t<64;t++)e[t]=1024;return e[0]=e[32]=0,e}function w$(){let e=x$(),t=b$(),r=v$();return n=>{let a=new ArrayBuffer(4*n.length),s=new Uint32Array(a);for(let i=0;i>10]+(o&1023)]+t[o>>10];s[i]=l}return new Float32Array(a)}}var Wt=class{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return Wt.instance==null&&(Wt.instance=new Wt),Wt.instance}static registerSaveRouter(e){Wt.getInstance().saveRouters.push(e)}static registerLoadRouter(e){Wt.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return Wt.getHandlers(e,"save")}static getLoadHandlers(e,t){return Wt.getHandlers(e,"load",t)}static getHandlers(e,t,r){let n=[];return(t==="load"?Wt.getInstance().loadRouters:Wt.getInstance().saveRouters).forEach(a=>{let s=a(e,r);s!==null&&n.push(s)}),n}},k$=e=>Wt.registerSaveRouter(e),I$=e=>Wt.registerLoadRouter(e),S$=e=>Wt.getSaveHandlers(e),C$=(e,t)=>Wt.getLoadHandlers(e,t),gg="tensorflowjs",yg=1,So="models_store",Rs="model_info_store";function Qv(){if(!Z().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");let e=typeof window=="undefined"?self:window,t=e.indexedDB||e.mozIndexedDB||e.webkitIndexedDB||e.msIndexedDB||e.shimIndexedDB;if(t==null)throw new Error("The current browser does not appear to support IndexedDB.");return t}function Ag(e){let t=e.result;t.createObjectStore(So,{keyPath:"modelPath"}),t.createObjectStore(Rs,{keyPath:"modelPath"})}var Fo=class{constructor(e){if(this.indexedDB=Qv(),e==null||!e)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=e}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,e)}async load(){return this.databaseAction(this.modelPath)}databaseAction(e,t){return new Promise((r,n)=>{let a=this.indexedDB.open(gg,yg);a.onupgradeneeded=()=>Ag(a),a.onsuccess=()=>{let s=a.result;if(t==null){let i=s.transaction(So,"readonly"),o=i.objectStore(So).get(this.modelPath);o.onsuccess=()=>{if(o.result==null)return s.close(),n(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));r(o.result.modelArtifacts)},o.onerror=l=>(s.close(),n(o.error)),i.oncomplete=()=>s.close()}else{let i=yh(t),o=s.transaction(Rs,"readwrite"),l=o.objectStore(Rs),u=l.put({modelPath:this.modelPath,modelArtifactsInfo:i}),d;u.onsuccess=()=>{d=s.transaction(So,"readwrite");let h=d.objectStore(So).put({modelPath:this.modelPath,modelArtifacts:t,modelArtifactsInfo:i});h.onsuccess=()=>r({modelArtifactsInfo:i}),h.onerror=p=>{l=o.objectStore(Rs);let c=l.delete(this.modelPath);c.onsuccess=()=>(s.close(),n(h.error)),c.onerror=m=>(s.close(),n(h.error))}},u.onerror=h=>(s.close(),n(u.error)),o.oncomplete=()=>{d==null?s.close():d.oncomplete=()=>s.close()}}},a.onerror=s=>n(a.error)})}};Fo.URL_SCHEME="indexeddb://";var e7=e=>Z().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Fo.URL_SCHEME)?T$(e.slice(Fo.URL_SCHEME.length)):null;Wt.registerSaveRouter(e7);Wt.registerLoadRouter(e7);function T$(e){return new Fo(e)}function N$(e){return e.startsWith(Fo.URL_SCHEME)?e.slice(Fo.URL_SCHEME.length):e}var E$=class{constructor(){this.indexedDB=Qv()}async listModels(){return new Promise((e,t)=>{let r=this.indexedDB.open(gg,yg);r.onupgradeneeded=()=>Ag(r),r.onsuccess=()=>{let n=r.result,a=n.transaction(Rs,"readonly"),s=a.objectStore(Rs).getAll();s.onsuccess=()=>{let i={};for(let o of s.result)i[o.modelPath]=o.modelArtifactsInfo;e(i)},s.onerror=i=>(n.close(),t(s.error)),a.oncomplete=()=>n.close()},r.onerror=n=>t(r.error)})}async removeModel(e){return e=N$(e),new Promise((t,r)=>{let n=this.indexedDB.open(gg,yg);n.onupgradeneeded=()=>Ag(n),n.onsuccess=()=>{let a=n.result,s=a.transaction(Rs,"readwrite"),i=s.objectStore(Rs),o=i.get(e),l;o.onsuccess=()=>{if(o.result==null)return a.close(),r(new Error(`Cannot find model with path '${e}' in IndexedDB.`));{let u=i.delete(e),d=()=>{l=a.transaction(So,"readwrite");let h=l.objectStore(So).delete(e);h.onsuccess=()=>t(o.result.modelArtifactsInfo),h.onerror=p=>r(o.error)};u.onsuccess=d,u.onerror=h=>(d(),a.close(),r(o.error))}},o.onerror=u=>(a.close(),r(o.error)),s.oncomplete=()=>{l==null?a.close():l.oncomplete=()=>a.close()}},n.onerror=a=>r(n.error)})}},Ka="/",fu="tensorflowjs_models",t7="info",R$="model_topology",$$="weight_specs",M$="weight_data",F$="model_metadata";function r7(e){return{info:[fu,e,t7].join(Ka),topology:[fu,e,R$].join(Ka),weightSpecs:[fu,e,$$].join(Ka),weightData:[fu,e,M$].join(Ka),modelMetadata:[fu,e,F$].join(Ka)}}function n7(e){for(let t of Object.values(e))window.localStorage.removeItem(t)}function P$(e){let t=e.split(Ka);if(t.length<3)throw new Error(`Invalid key format: ${e}`);return t.slice(1,t.length-1).join(Ka)}function _$(e){return e.startsWith(Po.URL_SCHEME)?e.slice(Po.URL_SCHEME.length):e}var Po=class{constructor(e){if(!Z().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,e==null||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=r7(this.modelPath)}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{let t=JSON.stringify(e.modelTopology),r=JSON.stringify(e.weightSpecs),n=yh(e);try{this.LS.setItem(this.keys.info,JSON.stringify(n)),this.LS.setItem(this.keys.topology,t),this.LS.setItem(this.keys.weightSpecs,r),this.LS.setItem(this.keys.weightData,y$(e.weightData));let a={format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,signature:e.signature!=null?e.signature:void 0,userDefinedMetadata:e.userDefinedMetadata!=null?e.userDefinedMetadata:void 0,modelInitializer:e.modelInitializer!=null?e.modelInitializer:void 0,trainingConfig:e.trainingConfig!=null?e.trainingConfig:void 0};return this.LS.setItem(this.keys.modelMetadata,JSON.stringify(a)),{modelArtifactsInfo:n}}catch(a){throw n7(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=${n.modelTopologyBytes}, weightSpecsBytes=${n.weightSpecsBytes}, weightDataBytes=${n.weightDataBytes}.`)}}}async load(){let e=JSON.parse(this.LS.getItem(this.keys.info));if(e==null)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if(e.modelTopologyType!=="JSON")throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");let t={},r=JSON.parse(this.LS.getItem(this.keys.topology));if(r==null)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);t.modelTopology=r;let n=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(n==null)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);t.weightSpecs=n;let a=this.LS.getItem(this.keys.modelMetadata);if(a!=null){let i=JSON.parse(a);t.format=i.format,t.generatedBy=i.generatedBy,t.convertedBy=i.convertedBy,i.signature!=null&&(t.signature=i.signature),i.userDefinedMetadata!=null&&(t.userDefinedMetadata=i.userDefinedMetadata),i.modelInitializer!=null&&(t.modelInitializer=i.modelInitializer),i.trainingConfig!=null&&(t.trainingConfig=i.trainingConfig)}let s=this.LS.getItem(this.keys.weightData);if(s==null)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);return t.weightData=A$(s),t}};Po.URL_SCHEME="localstorage://";var a7=e=>Z().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Po.URL_SCHEME)?z$(e.slice(Po.URL_SCHEME.length)):null;Wt.registerSaveRouter(a7);Wt.registerLoadRouter(a7);function z$(e){return new Po(e)}var O$=class{constructor(){P(Z().getBool("IS_BROWSER"),()=>"Current environment is not a web browser"),P(typeof window=="undefined"||typeof window.localStorage!="undefined",()=>"Current browser does not appear to support localStorage"),this.LS=window.localStorage}async listModels(){let e={},t=fu+Ka,r=Ka+t7;for(let n=0;n"scheme must not be undefined or null."),e.endsWith(yu)&&(e=e.slice(0,e.indexOf(yu))),P(e.length>0,()=>"scheme must not be an empty string.");let r=Nn.getInstance();P(r.managers[e]==null,()=>`A model store manager is already registered for scheme '${e}'.`),r.managers[e]=t}static getManager(e){let t=this.getInstance().managers[e];if(t==null)throw new Error(`Cannot find model manager for scheme '${e}'`);return t}static getSchemes(){return Object.keys(this.getInstance().managers)}};function n0(e){if(e.indexOf(yu)===-1)throw new Error(`The url string provided does not contain a scheme. Supported schemes are: ${Nn.getSchemes().join(",")}`);return{scheme:e.split(yu)[0],path:e.split(yu)[1]}}async function s7(e,t,r=!1){P(e!==t,()=>`Old path and new path are the same: '${e}'`);let n=Wt.getLoadHandlers(e);P(n.length>0,()=>`Copying failed because no load handler is found for source URL ${e}.`),P(n.length<2,()=>`Copying failed because more than one (${n.length}) load handlers for source URL ${e}.`);let a=n[0],s=Wt.getSaveHandlers(t);P(s.length>0,()=>`Copying failed because no save handler is found for destination URL ${t}.`),P(s.length<2,()=>`Copying failed because more than one (${n.length}) save handlers for destination URL ${t}.`);let i=s[0],o=n0(e).scheme,l=n0(e).path,u=o===n0(e).scheme,d=await a.load();r&&u&&await Nn.getManager(o).removeModel(l);let h=await i.save(d);return r&&!u&&await Nn.getManager(o).removeModel(l),h.modelArtifactsInfo}async function D$(){let e=Nn.getSchemes(),t={};for(let r of e){let n=await Nn.getManager(r).listModels();for(let a in n){let s=r+yu+a;t[s]=n[a]}}return t}async function L$(e){let t=n0(e);return Nn.getManager(t.scheme).removeModel(t.path)}async function B$(e,t){return s7(e,t,!1)}async function W$(e,t){return s7(e,t,!0)}var V$=class{fetch(e,t){return fetch(e,t)}now(){return performance.now()}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Browser's encoder only supports utf-8, but got ${t}`);return this.textEncoder==null&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,t){return new TextDecoder(t).decode(e)}};if(Z().get("IS_BROWSER")){Z().setPlatform("browser",new V$);try{Nn.registerManager(Po.URL_SCHEME,new O$)}catch(e){}try{Nn.registerManager(Fo.URL_SCHEME,new E$)}catch(e){}}var U$={importFetch:()=>JE()},Q2,G$=class{constructor(){this.util=QE(),this.textEncoder=new this.util.TextEncoder}fetch(e,t){return Z().global.fetch!=null?Z().global.fetch(e,t):(Q2==null&&(Q2=U$.importFetch()),Q2(e,t))}now(){let e=process.hrtime();return e[0]*1e3+e[1]/1e6}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Node built-in encoder only supports utf-8, but got ${t}`);return this.textEncoder.encode(e)}decode(e,t){return e.length===0?"":new this.util.TextDecoder(t).decode(e)}};Z().get("IS_NODE")&&!Z().get("IS_BROWSER")&&Z().setPlatform("node",new G$);function We(e,t="float32",r){return t=t||"float32",cy(e),new ir(e,t,r)}function j$(e,t){let r=M(e,"x","cast");if(!Tv(t))throw new Error(`Failed to cast to unknown dtype ${t}`);if(t==="string"&&r.dtype!=="string"||t!=="string"&&r.dtype==="string")throw new Error("Only strings can be casted to strings");let n={x:r},a={dtype:t};return B.runKernel(ti,n,a)}var me=W({cast_:j$});function H$(e){let t={x:M(e,"x","clone","string_or_numeric")};return B.runKernel(gi,t)}var Br=W({clone_:H$});function i7(e,t=!1){console.log(e.toString(t))}qv();var q$={buffer:We,cast:me,clone:Br,print:i7};n$(q$);var Sr={};Le(Sr,{browserFiles:()=>eM,browserHTTPRequest:()=>sM,concatenateArrayBuffers:()=>by,copyModel:()=>B$,decodeWeights:()=>Yv,encodeWeights:()=>m$,fromMemory:()=>oM,getLoadHandlers:()=>C$,getModelArtifactsForJSON:()=>vy,getModelArtifactsInfoForJSON:()=>yh,getSaveHandlers:()=>S$,http:()=>ky,isHTTPScheme:()=>bg,listModels:()=>D$,loadWeights:()=>tM,moveModel:()=>W$,registerLoadRouter:()=>I$,registerSaveRouter:()=>k$,removeModel:()=>L$,weightsLoaderFactory:()=>l7,withSaveHandler:()=>lM});var K$="model",X$=".json",Z$=".weights.bin";function Wb(e){return new Promise(t=>setTimeout(t)).then(e)}var xg=class{constructor(e){if(!Z().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");e.startsWith(xg.URL_SCHEME)&&(e=e.slice(xg.URL_SCHEME.length)),(e==null||e.length===0)&&(e=K$),this.modelJsonFileName=e+X$,this.weightDataFileName=e+Z$}async save(e){if(typeof document=="undefined")throw new Error("Browser downloads are not supported in this environment since `document` is not present");let t=window.URL.createObjectURL(new Blob([e.weightData],{type:"application/octet-stream"}));if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");{let r=[{paths:["./"+this.weightDataFileName],weights:e.weightSpecs}],n=Jv(e,r),a=window.URL.createObjectURL(new Blob([JSON.stringify(n)],{type:"application/json"})),s=this.modelJsonAnchor==null?document.createElement("a"):this.modelJsonAnchor;if(s.download=this.modelJsonFileName,s.href=a,await Wb(()=>s.dispatchEvent(new MouseEvent("click"))),e.weightData!=null){let i=this.weightDataAnchor==null?document.createElement("a"):this.weightDataAnchor;i.download=this.weightDataFileName,i.href=t,await Wb(()=>i.dispatchEvent(new MouseEvent("click")))}return{modelArtifactsInfo:yh(e)}}}},v0=xg;v0.URL_SCHEME="downloads://";var Y$=class{constructor(e){if(e==null||e.length<1)throw new Error(`When calling browserFiles, at least 1 file is required, but received ${e}`);this.jsonFile=e[0],this.weightsFiles=e.slice(1)}async load(){return new Promise((e,t)=>{let r=new FileReader;r.onload=n=>{let a=JSON.parse(n.target.result),s=a.modelTopology;if(s==null){t(new Error(`modelTopology field is missing from file ${this.jsonFile.name}`));return}if(a.weightsManifest==null){t(new Error(`weightManifest field is missing from file ${this.jsonFile.name}`));return}if(this.weightsFiles.length===0){e({modelTopology:s});return}let i=vy(a,o=>this.loadWeights(o));e(i)},r.onerror=n=>t(`Failed to read model topology and weights manifest JSON from file '${this.jsonFile.name}'. BrowserFiles supports loading Keras-style tf.Model artifacts only.`),r.readAsText(this.jsonFile)})}loadWeights(e){let t=[],r=[];for(let s of e)t.push(...s.weights),r.push(...s.paths);let n=this.checkManifestAndWeightFiles(e),a=r.map(s=>this.loadWeightsFile(s,n[s]));return Promise.all(a).then(s=>[t,by(s)])}loadWeightsFile(e,t){return new Promise((r,n)=>{let a=new FileReader;a.onload=s=>{let i=s.target.result;r(i)},a.onerror=s=>n(`Failed to weights data from file of path '${e}'.`),a.readAsArrayBuffer(t)})}checkManifestAndWeightFiles(e){let t=[],r=this.weightsFiles.map(a=>Bb(a.name)),n={};for(let a of e)a.paths.forEach(s=>{let i=Bb(s);if(t.indexOf(i)!==-1)throw new Error(`Duplicate file basename found in weights manifest: '${i}'`);if(t.push(i),r.indexOf(i)===-1)throw new Error(`Weight file with basename '${i}' is not provided.`);n[s]=this.weightsFiles[r.indexOf(i)]});if(t.length!==this.weightsFiles.length)throw new Error(`Mismatch in the number of files in weights manifest (${t.length}) and the number of weight files provided (${this.weightsFiles.length}).`);return n}},J$=e=>Z().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(v0.URL_SCHEME)?Q$(e.slice(v0.URL_SCHEME.length)):null;Wt.registerSaveRouter(J$);function Q$(e="model"){return new v0(e)}function eM(e){return new Y$(e)}function Vb(e,t,r,n){i(e),r=r==null?0:r,n=n==null?1:n,o(r,n);let a=0,s=l=>(l.then(u=>{let d=r+ ++a/e.length*(n-r);return t(d),u}),l);function i(l){P(l!=null&&Array.isArray(l)&&l.length>0,()=>"promises must be a none empty array")}function o(l,u){P(l>=0&&l<=1,()=>`Progress fraction must be in range [0, 1], but got startFraction ${l}`),P(u>=0&&u<=1,()=>`Progress fraction must be in range [0, 1], but got endFraction ${u}`),P(u>=l,()=>`startFraction must be no more than endFraction, but got startFraction ${l} and endFraction ${u}`)}return Promise.all(e.map(s))}async function o7(e,t){t==null&&(t={});let r=t.fetchFunc==null?Z().platform.fetch:t.fetchFunc,n=e.map(u=>r(u,t.requestInit,{isBinary:!0})),a=0,s=.5,i=(t.onProgress==null?await Promise.all(n):await Vb(n,t.onProgress,a,s)).map(u=>u.arrayBuffer()),o=.5,l=1;return t.onProgress==null?await Promise.all(i):await Vb(i,t.onProgress,o,l)}async function tM(e,t="",r,n){return l7(a=>o7(a,{requestInit:n}))(e,t,r)}function l7(e){return async(t,r="",n)=>{let a=t.map(()=>!1),s={},i=n!=null?n.map(()=>!1):[],o=[];if(t.forEach((c,m)=>{let f=0;c.weights.forEach(g=>{let y="quantization"in g?g.quantization.dtype:g.dtype,A=mg[y]*Tt(g.shape),x=()=>{a[m]=!0,s[m]==null&&(s[m]=[]),s[m].push({manifestEntry:g,groupOffset:f,sizeBytes:A})};n!=null?n.forEach((b,v)=>{b===g.name&&(x(),i[v]=!0)}):x(),o.push(g.name),f+=A})}),!i.every(c=>c)){let c=n.filter((m,f)=>!i[f]);throw new Error(`Could not find weights in manifest with names: ${c.join(", ")}. Manifest JSON has weights with names: ${o.join(", ")}.`)}let l=a.reduce((c,m,f)=>(m&&c.push(f),c),[]),u=[];l.forEach(c=>{t[c].paths.forEach(m=>{let f=r+(r.endsWith("/")?"":"/")+m;u.push(f)})});let d=await e(u),h={},p=0;return l.forEach(c=>{let m=t[c].paths.length,f=0;for(let x=0;x{let b=g.slice(x.groupOffset,x.groupOffset+x.sizeBytes),v=Yv(b,[x.manifestEntry]);for(let S in v)h[S]=v[S]}),p+=m}),h}}var rM="application/octet-stream",nM="application/json",wy=class{constructor(e,t){if(this.DEFAULT_METHOD="POST",t==null&&(t={}),this.weightPathPrefix=t.weightPathPrefix,this.onProgress=t.onProgress,this.weightUrlConverter=t.weightUrlConverter,t.fetchFunc!=null?(P(typeof t.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=t.fetchFunc):this.fetch=Z().platform.fetch,P(e!=null&&e.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(e)&&P(e.length===2,()=>`URL paths for http must have a length of 2, (actual length is ${e.length}).`),this.path=e,t.requestInit!=null&&t.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t.requestInit||{}}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");let t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);t.body=new FormData;let r=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],n=Jv(e,r);t.body.append("model.json",new Blob([JSON.stringify(n)],{type:nM}),"model.json"),e.weightData!=null&&t.body.append("model.weights.bin",new Blob([e.weightData],{type:rM}),"model.weights.bin");let a=await this.fetch(this.path,t);if(a.ok)return{modelArtifactsInfo:yh(e),responses:[a]};throw new Error(`BrowserHTTPRequest.save() failed due to HTTP response status ${a.status}.`)}async load(){let e=await this.fetch(this.path,this.requestInit);if(!e.ok)throw new Error(`Request to ${this.path} failed with status code ${e.status}. Please verify this URL points to the model JSON of the model to load.`);let t;try{t=await e.json()}catch(a){let s=`Failed to parse model JSON of response from ${this.path}.`;throw this.path.endsWith(".pb")?s+=" 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.":s+=" Please make sure the server is serving valid JSON for this request.",new Error(s)}let r=t.modelTopology,n=t.weightsManifest;if(r==null&&n==null)throw new Error(`The JSON from HTTP path ${this.path} contains neither model topology or manifest for weights.`);return vy(t,a=>this.loadWeights(a))}async loadWeights(e){let t=Array.isArray(this.path)?this.path[1]:this.path,[r,n]=aM(t),a=this.weightPathPrefix||r,s=[];for(let u of e)s.push(...u.weights);let i=[],o=[];for(let u of e)for(let d of u.paths)this.weightUrlConverter!=null?o.push(this.weightUrlConverter(d)):i.push(a+d+n);this.weightUrlConverter&&i.push(...await Promise.all(o));let l=await o7(i,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress});return[s,by(l)]}};wy.URL_SCHEME_REGEX=/^https?:\/\//;function aM(e){let t=e.lastIndexOf("/"),r=e.lastIndexOf("?"),n=e.substring(0,t),a=r>t?e.substring(r):"";return[n+"/",a]}function bg(e){return e.match(wy.URL_SCHEME_REGEX)!=null}var u7=(e,t)=>{if(typeof fetch=="undefined"&&(t==null||t.fetchFunc==null))return null;{let r=!0;if(Array.isArray(e)?r=e.every(n=>bg(n)):r=bg(e),r)return ky(e,t)}return null};Wt.registerSaveRouter(u7);Wt.registerLoadRouter(u7);function ky(e,t){return new wy(e,t)}function sM(e,t){return ky(e,t)}var eg=class{constructor(e){this.modelArtifacts=e}async load(){return this.modelArtifacts}},iM=class{constructor(e){this.saveHandler=e}async save(e){return this.saveHandler(e)}};function oM(e,t,r,n){return arguments.length===1?e.modelTopology!=null||e.weightSpecs!=null?new eg(e):(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 eg({modelTopology:e})):(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 eg({modelTopology:e,weightSpecs:t,weightData:r,trainingConfig:n}))}function lM(e){return new iM(e)}var d7={};Le(d7,{confusionMatrix:()=>cM});function uM(e,t,r=!1,n=!1){let a=M(e,"a","matMul"),s=M(t,"b","matMul");[a,s]=Lt(a,s);let i={a,b:s},o={transposeA:r,transposeB:n};return B.runKernel(ei,i,o)}var Je=W({matMul_:uM});function dM(e,t,r=1,n=0){if(t<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${t}`);let a={indices:M(e,"indices","oneHot","int32")},s={depth:t,onValue:r,offValue:n};return B.runKernel(hl,a,s)}var Wp=W({oneHot_:dM});function pM(e,t){let r=M(e,"x","transpose");if(t==null&&(t=r.shape.map((s,i)=>i).reverse()),P(r.rank===t.length,()=>`Error in transpose: rank of input ${r.rank} must match length of perm ${t}.`),t.forEach(s=>{P(s>=0&&s`All entries in 'perm' must be between 0 and ${r.rank-1} but got ${t}`)}),r.rank<=1)return r.clone();let n={x:r},a={perm:t};return B.runKernel(Ui,n,a)}var tt=W({transpose_:pM});function hM(e,t,r){let n=M(e,"labels","confusionMatrix"),a=M(t,"predictions","confusionMatrix");P(r==null||r>0&&Number.isInteger(r),()=>`If provided, numClasses must be a positive integer, but got ${r}`),P(n.rank===1,()=>`Expected the rank of labels to be 1, but got ${n.rank}`),P(a.rank===1,()=>`Expected the rank of predictions to be 1, but got ${a.rank}`),P(n.shape[0]===a.shape[0],()=>`Mismatch in the number of examples: ${n.shape[0]} vs. ${a.shape[0]}. Labels and predictions should have the same number of elements.`),P(r>0&&Number.isInteger(r),()=>`numClasses is required to be a positive integer, but got ${r}`);let s=Wp(me(n,"int32"),r),i=Wp(me(a,"int32"),r),o=tt(s),l=Je(o,i);return me(l,"int32")}var cM=W({confusionMatrix_:hM}),Rl={};Le(Rl,{assertAndGetBroadcastShape:()=>bt,getBroadcastDims:()=>p7,getReductionAxes:()=>Yt});function p7(e,t){let r=e.length,n=[];for(let a=0;a1&&i===1&&n.unshift(s)}return n}function Yt(e,t){let r=[];for(let n=0;n1)&&r.unshift(s)}return r}function bt(e,t){let r=[],n=Math.max(e.length,t.length);for(let a=0;abM,fromPixelsAsync:()=>AM,toPixels:()=>xM});function h7(e,t,r){if(Go(e),t!=null&&t.length!==3)throw new Error("tensor3d() requires shape to have three numbers");let n=Fa(e,r);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 ji(e,t,n,r)}var go;function c7(e,t=3){if(t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(e==null)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");let r=!1,n=!1,a=!1,s=!1,i=!1,o=!1;if(e.data instanceof Uint8Array)r=!0;else if(typeof ImageData!="undefined"&&e instanceof ImageData)n=!0;else if(typeof HTMLVideoElement!="undefined"&&e instanceof HTMLVideoElement)a=!0;else if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement)s=!0;else if(e.getContext!=null)i=!0;else if(typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap)o=!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 ${e.constructor.name}`);if(a&&a&&e.readyState<2)throw new Error("The video element has not loaded data yet. Please wait for `loadeddata` event on the