You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__Classrooms__Lists__Exerc...

3923 lines
1.1 MiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

(window.webpackJsonp=window.webpackJsonp||[]).push([[61],{"1uat":function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("MlIO"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.Hasher,D=d.x64,E=D.Word,g=D.WordArray,h=d.algo;function b(){return E.create.apply(E,arguments)}var p=[b(1116352408,3609767458),b(1899447441,602891725),b(3049323471,3964484399),b(3921009573,2173295548),b(961987163,4081628472),b(1508970993,3053834265),b(2453635748,2937671579),b(2870763221,3664609560),b(3624381080,2734883394),b(310598401,1164996542),b(607225278,1323610764),b(1426881987,3590304994),b(1925078388,4068182383),b(2162078206,991336113),b(2614888103,633803317),b(3248222580,3479774868),b(3835390401,2666613458),b(4022224774,944711139),b(264347078,2341262773),b(604807628,2007800933),b(770255983,1495990901),b(1249150122,1856431235),b(1555081692,3175218132),b(1996064986,2198950837),b(2554220882,3999719339),b(2821834349,766784016),b(2952996808,2566594879),b(3210313671,3203337956),b(3336571891,1034457026),b(3584528711,2466948901),b(113926993,3758326383),b(338241895,168717936),b(666307205,1188179964),b(773529912,1546045734),b(1294757372,1522805485),b(1396182291,2643833823),b(1695183700,2343527390),b(1986661051,1014477480),b(2177026350,1206759142),b(2456956037,344077627),b(2730485921,1290863460),b(2820302411,3158454273),b(3259730800,3505952657),b(3345764771,106217008),b(3516065817,3606008344),b(3600352804,1432725776),b(4094571909,1467031594),b(275423344,851169720),b(430227734,3100823752),b(506948616,1363258195),b(659060556,3750685593),b(883997877,3785050280),b(958139571,3318307427),b(1322822218,3812723403),b(1537002063,2003034995),b(1747873779,3602036899),b(1955562222,1575990012),b(2024104815,1125592928),b(2227730452,2716904306),b(2361852424,442776044),b(2428436474,593698344),b(2756734187,3733110249),b(3204031479,2999351573),b(3329325298,3815920427),b(3391569614,3928383900),b(3515267271,566280711),b(3940187606,3454069534),b(4118630271,4000239992),b(116418474,1914138554),b(174292421,2731055270),b(289380356,3203993006),b(460393269,320620315),b(685471733,587496836),b(852142971,1086792851),b(1017036298,365543100),b(1126000580,2618297676),b(1288033470,3409855158),b(1501505948,4234509866),b(1607167915,987167468),b(1816402316,1246189591)],v=[];(function(){for(var x=0;x<80;x++)v[x]=b()})();var I=h.SHA512=M.extend({_doReset:function(){this._hash=new g.init([new E.init(1779033703,4089235720),new E.init(3144134277,2227873595),new E.init(1013904242,4271175723),new E.init(2773480762,1595750129),new E.init(1359893119,2917565137),new E.init(2600822924,725511199),new E.init(528734635,4215389547),new E.init(1541459225,327033209)])},_doProcessBlock:function(x,S){for(var H=this._hash.words,B=H[0],Q=H[1],z=H[2],K=H[3],J=H[4],U=H[5],j=H[6],T=H[7],te=B.high,Z=B.low,_=Q.high,Y=Q.low,re=z.high,pe=z.low,le=K.high,_e=K.low,me=J.high,ke=J.low,$=U.high,ne=U.low,W=j.high,ie=j.low,de=T.high,ee=T.low,Ce=te,De=Z,Le=_,Ye=Y,et=re,Ae=pe,ct=le,$e=_e,Fe=me,Pe=ke,He=$,ot=ne,ye=W,be=ie,Ke=de,q=ee,m=0;m<80;m++){var c,R,fe=v[m];if(m<16)R=fe.high=x[S+m*2]|0,c=fe.low=x[S+m*2+1]|0;else{var ve=v[m-15],Re=ve.high,qe=ve.low,nt=(Re>>>1|qe<<31)^(Re>>>8|qe<<24)^Re>>>7,st=(qe>>>1|Re<<31)^(qe>>>8|Re<<24)^(qe>>>7|Re<<25),bt=v[m-2],dt=bt.high,Et=bt.low,It=(dt>>>19|Et<<13)^(dt<<3|Et>>>29)^dt>>>6,at=(Et>>>19|dt<<13)^(Et<<3|dt>>>29)^(Et>>>6|dt<<26),Bt=v[m-7],mr=Bt.high,rr=Bt.low,Sr=v[m-16],Fr=Sr.high,Nr=Sr.low;c=st+rr,R=nt+mr+(c>>>0<st>>>0?1:0),c=c+at,R=R+It+(c>>>0<at>>>0?1:0),c=c+Nr,R=R+Fr+(c>>>0<Nr>>>0?1:0),fe.high=R,fe.low=c}var Ar=Fe&He^~Fe&ye,tt=Pe&ot^~Pe&be,Xn=Ce&Le^Ce&et^Le&et,Dr=De&Ye^De&Ae^Ye&Ae,Do=(Ce>>>28|De<<4)^(Ce<<30|De>>>2)^(Ce<<25|De>>>7),Kn=(De>>>28|Ce<<4)^(De<<30|Ce>>>2)^(De<<25|Ce>>>7),co=(Fe>>>14|Pe<<18)^(Fe>>>18|Pe<<14)^(Fe<<23|Pe>>>9),Cr=(Pe>>>14|Fe<<18)^(Pe>>>18|Fe<<14)^(Pe<<23|Fe>>>9),lo=p[m],_n=lo.high,fo=lo.low,nr=q+Cr,hr=Ke+co+(nr>>>0<q>>>0?1:0),nr=nr+tt,hr=hr+Ar+(nr>>>0<tt>>>0?1:0),nr=nr+fo,hr=hr+_n+(nr>>>0<fo>>>0?1:0),nr=nr+c,hr=hr+R+(nr>>>0<c>>>0?1:0),cr=Kn+Dr,nn=Do+Xn+(cr>>>0<Kn>>>0?1:0);Ke=ye,q=be,ye=He,be=ot,He=Fe,ot=Pe,Pe=$e+nr|0,Fe=ct+hr+(Pe>>>0<$e>>>0?1:0)|0,ct=et,$e=Ae,et=Le,Ae=Ye,Le=Ce,Ye=De,De=nr+cr|0,Ce=hr+nn+(De>>>0<nr>>>0?1:0)|0}Z=B.low=Z+De,B.high=te+Ce+(Z>>>0<De>>>0?1:0),Y=Q.low=Y+Ye,Q.high=_+Le+(Y>>>0<Ye>>>0?1:0),pe=z.low=pe+Ae,z.high=re+et+(pe>>>0<Ae>>>0?1:0),_e=K.low=_e+$e,K.high=le+ct+(_e>>>0<$e>>>0?1:0),ke=J.low=ke+Pe,J.high=me+Fe+(ke>>>0<Pe>>>0?1:0),ne=U.low=ne+ot,U.high=$+He+(ne>>>0<ot>>>0?1:0),ie=j.low=ie+be,j.high=W+ye+(ie>>>0<be>>>0?1:0),ee=T.low=ee+q,T.high=de+Ke+(ee>>>0<q>>>0?1:0)},_doFinalize:function(){var x=this._data,S=x.words,H=this._nDataBytes*8,B=x.sigBytes*8;S[B>>>5]|=128<<24-B%32,S[(B+128>>>10<<5)+30]=Math.floor(H/4294967296),S[(B+128>>>10<<5)+31]=H,x.sigBytes=S.length*4,this._process();var Q=this._hash.toX32();return Q},clone:function(){var x=M.clone.call(this);return x._hash=this._hash.clone(),x},blockSize:1024/32});d.SHA512=M._createHelper(I),d.HmacSHA512=M._createHmacHelper(I)}(),y.SHA512})},"2LEM":function(l,G,N){l.exports=N.p+"static/checkPeople.d3191bb4.jpg"},"2U/9":function(l,G,N){"use strict";var y=N("VTBJ"),d=N("rePB"),F=N("Ff2n"),M=N("1OyB"),D=N("vuIU"),E=N("Ji7U"),g=N("LK+K"),h=N("q1tI"),b=N.n(h),p=N("Zm9Q"),v=N("TSYQ"),I=N.n(v),x=["className","prefixCls","style","active","status","iconPrefix","icon","wrapperStyle","stepNumber","disabled","description","title","subTitle","progressDot","stepIcon","tailContent","icons","stepIndex","onStepClick","onClick"];function S(K){return typeof K=="string"}var H=function(K){Object(E.a)(U,K);var J=Object(g.a)(U);function U(){var j;return Object(M.a)(this,U),j=J.apply(this,arguments),j.onClick=function(){var T=j.props,te=T.onClick,Z=T.onStepClick,_=T.stepIndex;te&&te.apply(void 0,arguments),Z(_)},j}return Object(D.a)(U,[{key:"renderIconNode",value:function(){var T,te=this.props,Z=te.prefixCls,_=te.progressDot,Y=te.stepIcon,re=te.stepNumber,pe=te.status,le=te.title,_e=te.description,me=te.icon,ke=te.iconPrefix,$=te.icons,ne,W=I()("".concat(Z,"-icon"),"".concat(ke,"icon"),(T={},Object(d.a)(T,"".concat(ke,"icon-").concat(me),me&&S(me)),Object(d.a)(T,"".concat(ke,"icon-check"),!me&&pe==="finish"&&($&&!$.finish||!$)),Object(d.a)(T,"".concat(ke,"icon-cross"),!me&&pe==="error"&&($&&!$.error||!$)),T)),ie=h.createElement("span",{className:"".concat(Z,"-icon-dot")});return _?typeof _=="function"?ne=h.createElement("span",{className:"".concat(Z,"-icon")},_(ie,{index:re-1,status:pe,title:le,description:_e})):ne=h.createElement("span",{className:"".concat(Z,"-icon")},ie):me&&!S(me)?ne=h.createElement("span",{className:"".concat(Z,"-icon")},me):$&&$.finish&&pe==="finish"?ne=h.createElement("span",{className:"".concat(Z,"-icon")},$.finish):$&&$.error&&pe==="error"?ne=h.createElement("span",{className:"".concat(Z,"-icon")},$.error):me||pe==="finish"||pe==="error"?ne=h.createElement("span",{className:W}):ne=h.createElement("span",{className:"".concat(Z,"-icon")},re),Y&&(ne=Y({index:re-1,status:pe,title:le,description:_e,node:ne})),ne}},{key:"render",value:function(){var T,te=this.props,Z=te.className,_=te.prefixCls,Y=te.style,re=te.active,pe=te.status,le=pe===void 0?"wait":pe,_e=te.iconPrefix,me=te.icon,ke=te.wrapperStyle,$=te.stepNumber,ne=te.disabled,W=te.description,ie=te.title,de=te.subTitle,ee=te.progressDot,Ce=te.stepIcon,De=te.tailContent,Le=te.icons,Ye=te.stepIndex,et=te.onStepClick,Ae=te.onClick,ct=Object(F.a)(te,x),$e=I()("".concat(_,"-item"),"".concat(_,"-item-").concat(le),Z,(T={},Object(d.a)(T,"".concat(_,"-item-custom"),me),Object(d.a)(T,"".concat(_,"-item-active"),re),Object(d.a)(T,"".concat(_,"-item-disabled"),ne===!0),T)),Fe=Object(y.a)({},Y),Pe={};return et&&!ne&&(Pe.role="button",Pe.tabIndex=0,Pe.onClick=this.onClick),h.createElement("div",Object.assign({},ct,{className:$e,style:Fe}),h.createElement("div",Object.assign({onClick:Ae},Pe,{className:"".concat(_,"-item-container")}),h.createElement("div",{className:"".concat(_,"-item-tail")},De),h.createElement("div",{className:"".concat(_,"-item-icon")},this.renderIconNode()),h.createElement("div",{className:"".concat(_,"-item-content")},h.createElement("div",{className:"".concat(_,"-item-title")},ie,de&&h.createElement("div",{title:typeof de=="string"?de:void 0,className:"".concat(_,"-item-subtitle")},de)),W&&h.createElement("div",{className:"".concat(_,"-item-description")},W))))}}]),U}(h.Component),B=["prefixCls","style","className","children","direction","type","labelPlacement","iconPrefix","status","size","current","progressDot","stepIcon","initial","icons","onChange"],Q=function(K){Object(E.a)(U,K);var J=Object(g.a)(U);function U(){var j;return Object(M.a)(this,U),j=J.apply(this,arguments),j.onStepClick=function(T){var te=j.props,Z=te.onChange,_=te.current;Z&&_!==T&&Z(T)},j}return Object(D.a)(U,[{key:"render",value:function(){var T,te=this,Z=this.props,_=Z.prefixCls,Y=Z.style,re=Y===void 0?{}:Y,pe=Z.className,le=Z.children,_e=Z.direction,me=Z.type,ke=Z.labelPlacement,$=Z.iconPrefix,ne=Z.status,W=Z.size,ie=Z.current,de=Z.progressDot,ee=Z.stepIcon,Ce=Z.initial,De=Z.icons,Le=Z.onChange,Ye=Object(F.a)(Z,B),et=me==="navigation",Ae=de?"vertical":ke,ct=I()(_,"".concat(_,"-").concat(_e),pe,(T={},Object(d.a)(T,"".concat(_,"-").concat(W),W),Object(d.a)(T,"".concat(_,"-label-").concat(Ae),_e==="horizontal"),Object(d.a)(T,"".concat(_,"-dot"),!!de),Object(d.a)(T,"".concat(_,"-navigation"),et),T));return b.a.createElement("div",Object.assign({className:ct,style:re},Ye),Object(p.a)(le).map(function($e,Fe){var Pe=Ce+Fe,He=Object(y.a)({stepNumber:"".concat(Pe+1),stepIndex:Pe,key:Pe,prefixCls:_,iconPrefix:$,wrapperStyle:re,progressDot:de,stepIcon:ee,icons:De,onStepClick:Le&&te.onStepClick},$e.props);return ne==="error"&&Fe===ie-1&&(He.className="".concat(_,"-next-error")),$e.props.status||(Pe===ie?He.status=ne:Pe<ie?He.status="finish":He.status="wait"),He.active=Pe===ie,Object(h.cloneElement)($e,He)}))}}]),U}(b.a.Component);Q.Step=H,Q.defaultProps={type:"default",prefixCls:"rc-steps",iconPrefix:"rc",direction:"horizontal",labelPlacement:"horizontal",initial:0,current:0,status:"process",size:"",progressDot:!1};var z=G.a=Q},"3y9D":function(l,G,N){(function(y,d){l.exports=G=d(N("Ib8C"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.WordArray,D=F.Hasher,E=d.algo,g=[],h=E.SHA1=D.extend({_doReset:function(){this._hash=new M.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(b,p){for(var v=this._hash.words,I=v[0],x=v[1],S=v[2],H=v[3],B=v[4],Q=0;Q<80;Q++){if(Q<16)g[Q]=b[p+Q]|0;else{var z=g[Q-3]^g[Q-8]^g[Q-14]^g[Q-16];g[Q]=z<<1|z>>>31}var K=(I<<5|I>>>27)+B+g[Q];Q<20?K+=(x&S|~x&H)+1518500249:Q<40?K+=(x^S^H)+1859775393:Q<60?K+=(x&S|x&H|S&H)-1894007588:K+=(x^S^H)-899497514,B=H,H=S,S=x<<30|x>>>2,x=I,I=K}v[0]=v[0]+I|0,v[1]=v[1]+x|0,v[2]=v[2]+S|0,v[3]=v[3]+H|0,v[4]=v[4]+B|0},_doFinalize:function(){var b=this._data,p=b.words,v=this._nDataBytes*8,I=b.sigBytes*8;return p[I>>>5]|=128<<24-I%32,p[(I+64>>>9<<4)+14]=Math.floor(v/4294967296),p[(I+64>>>9<<4)+15]=v,b.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var b=D.clone.call(this);return b._hash=this._hash.clone(),b}});d.SHA1=D._createHelper(h),d.HmacSHA1=D._createHmacHelper(h)}(),y.SHA1})},4:function(l,G){},"49sm":function(l,G){var N={}.toString;l.exports=Array.isArray||function(y){return N.call(y)=="[object Array]"}},5:function(l,G){},"5hvy":function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("MlIO"))})(this,function(y){return function(d){var F=y,M=F.lib,D=M.WordArray,E=M.Hasher,g=F.x64,h=g.Word,b=F.algo,p=[],v=[],I=[];(function(){for(var H=1,B=0,Q=0;Q<24;Q++){p[H+5*B]=(Q+1)*(Q+2)/2%64;var z=B%5,K=(2*H+3*B)%5;H=z,B=K}for(var H=0;H<5;H++)for(var B=0;B<5;B++)v[H+5*B]=B+(2*H+3*B)%5*5;for(var J=1,U=0;U<24;U++){for(var j=0,T=0,te=0;te<7;te++){if(J&1){var Z=(1<<te)-1;Z<32?T^=1<<Z:j^=1<<Z-32}J&128?J=J<<1^113:J<<=1}I[U]=h.create(j,T)}})();var x=[];(function(){for(var H=0;H<25;H++)x[H]=h.create()})();var S=b.SHA3=E.extend({cfg:E.cfg.extend({outputLength:512}),_doReset:function(){for(var H=this._state=[],B=0;B<25;B++)H[B]=new h.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(H,B){for(var Q=this._state,z=this.blockSize/2,K=0;K<z;K++){var J=H[B+2*K],U=H[B+2*K+1];J=(J<<8|J>>>24)&16711935|(J<<24|J>>>8)&4278255360,U=(U<<8|U>>>24)&16711935|(U<<24|U>>>8)&4278255360;var j=Q[K];j.high^=U,j.low^=J}for(var T=0;T<24;T++){for(var te=0;te<5;te++){for(var Z=0,_=0,Y=0;Y<5;Y++){var j=Q[te+5*Y];Z^=j.high,_^=j.low}var re=x[te];re.high=Z,re.low=_}for(var te=0;te<5;te++)for(var pe=x[(te+4)%5],le=x[(te+1)%5],_e=le.high,me=le.low,Z=pe.high^(_e<<1|me>>>31),_=pe.low^(me<<1|_e>>>31),Y=0;Y<5;Y++){var j=Q[te+5*Y];j.high^=Z,j.low^=_}for(var ke=1;ke<25;ke++){var Z,_,j=Q[ke],$=j.high,ne=j.low,W=p[ke];W<32?(Z=$<<W|ne>>>32-W,_=ne<<W|$>>>32-W):(Z=ne<<W-32|$>>>64-W,_=$<<W-32|ne>>>64-W);var ie=x[v[ke]];ie.high=Z,ie.low=_}var de=x[0],ee=Q[0];de.high=ee.high,de.low=ee.low;for(var te=0;te<5;te++)for(var Y=0;Y<5;Y++){var ke=te+5*Y,j=Q[ke],Ce=x[ke],De=x[(te+1)%5+5*Y],Le=x[(te+2)%5+5*Y];j.high=Ce.high^~De.high&Le.high,j.low=Ce.low^~De.low&Le.low}var j=Q[0],Ye=I[T];j.high^=Ye.high,j.low^=Ye.low}},_doFinalize:function(){var H=this._data,B=H.words,Q=this._nDataBytes*8,z=H.sigBytes*8,K=this.blockSize*32;B[z>>>5]|=1<<24-z%32,B[(d.ceil((z+1)/K)*K>>>5)-1]|=128,H.sigBytes=B.length*4,this._process();for(var J=this._state,U=this.cfg.outputLength/8,j=U/8,T=[],te=0;te<j;te++){var Z=J[te],_=Z.high,Y=Z.low;_=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,Y=(Y<<8|Y>>>24)&16711935|(Y<<24|Y>>>8)&4278255360,T.push(Y),T.push(_)}return new D.init(T,U)},clone:function(){for(var H=E.clone.call(this),B=H._state=this._state.slice(0),Q=0;Q<25;Q++)B[Q]=B[Q].clone();return H}});F.SHA3=E._createHelper(S),F.HmacSHA3=E._createHmacHelper(S)}(Math),y.SHA3})},6:function(l,G){},7:function(l,G){},"7Cbv":function(l,G,N){"use strict";var y=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),d=new Uint8Array(16);function F(){if(!y)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return y(d)}var M=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function D(x){return typeof x=="string"&&M.test(x)}for(var E=D,g=[],h=0;h<256;++h)g.push((h+256).toString(16).substr(1));function b(x){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,H=(g[x[S+0]]+g[x[S+1]]+g[x[S+2]]+g[x[S+3]]+"-"+g[x[S+4]]+g[x[S+5]]+"-"+g[x[S+6]]+g[x[S+7]]+"-"+g[x[S+8]]+g[x[S+9]]+"-"+g[x[S+10]]+g[x[S+11]]+g[x[S+12]]+g[x[S+13]]+g[x[S+14]]+g[x[S+15]]).toLowerCase();if(!E(H))throw TypeError("Stringified UUID is invalid");return H}var p=b;function v(x,S,H){x=x||{};var B=x.random||(x.rng||F)();if(B[6]=B[6]&15|64,B[8]=B[8]&63|128,S){H=H||0;for(var Q=0;Q<16;++Q)S[H+Q]=B[Q];return S}return p(B)}var I=G.a=v},"7ixt":function(l,G,N){"use strict";N.d(G,"a",function(){return F});var y={adjustX:1,adjustY:1},d=[0,0],F={left:{points:["cr","cl"],overflow:y,offset:[-4,0],targetOffset:d},right:{points:["cl","cr"],overflow:y,offset:[4,0],targetOffset:d},top:{points:["bc","tc"],overflow:y,offset:[0,-4],targetOffset:d},bottom:{points:["tc","bc"],overflow:y,offset:[0,4],targetOffset:d},topLeft:{points:["bl","tl"],overflow:y,offset:[0,-4],targetOffset:d},leftTop:{points:["tr","tl"],overflow:y,offset:[-4,0],targetOffset:d},topRight:{points:["br","tr"],overflow:y,offset:[0,-4],targetOffset:d},rightTop:{points:["tl","tr"],overflow:y,offset:[4,0],targetOffset:d},bottomRight:{points:["tr","br"],overflow:y,offset:[0,4],targetOffset:d},rightBottom:{points:["bl","br"],overflow:y,offset:[4,0],targetOffset:d},bottomLeft:{points:["tl","bl"],overflow:y,offset:[0,4],targetOffset:d},leftBottom:{points:["br","bl"],overflow:y,offset:[-4,0],targetOffset:d}},M=F},"8KZw":function(l,G,N){"use strict";(function(y,d){N.d(G,"a",function(){return F});function F(){return typeof y=="object"&&!0&&typeof l!="undefined"&&typeof d!="undefined"&&!!d.version}}).call(this,N("IyRk"),N("Q2Ig"))},"9OqN":function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.mode.CTR=function(){var d=y.lib.BlockCipherMode.extend(),F=d.Encryptor=d.extend({processBlock:function(M,D){var E=this._cipher,g=E.blockSize,h=this._iv,b=this._counter;h&&(b=this._counter=h.slice(0),this._iv=void 0);var p=b.slice(0);E.encryptBlock(p,0),b[g-1]=b[g-1]+1|0;for(var v=0;v<g;v++)M[D+v]^=p[v]}});return d.Decryptor=F,d}(),y.mode.CTR})},ALsQ:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.mode.CFB=function(){var d=y.lib.BlockCipherMode.extend();d.Encryptor=d.extend({processBlock:function(M,D){var E=this._cipher,g=E.blockSize;F.call(this,M,D,g,E),this._prevBlock=M.slice(D,D+g)}}),d.Decryptor=d.extend({processBlock:function(M,D){var E=this._cipher,g=E.blockSize,h=M.slice(D,D+g);F.call(this,M,D,g,E),this._prevBlock=h}});function F(M,D,E,g){var h,b=this._iv;b?(h=b.slice(0),this._iv=void 0):h=this._prevBlock,g.encryptBlock(h,0);for(var p=0;p<E;p++)M[D+p]^=h[p]}return d}(),y.mode.CFB})},E4JC:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("ETIr"),N("cv67"),N("K3mO"),N("OLod"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.StreamCipher,D=d.algo,E=[],g=[],h=[],b=D.Rabbit=M.extend({_doReset:function(){for(var v=this._key.words,I=this.cfg.iv,x=0;x<4;x++)v[x]=(v[x]<<8|v[x]>>>24)&16711935|(v[x]<<24|v[x]>>>8)&4278255360;var S=this._X=[v[0],v[3]<<16|v[2]>>>16,v[1],v[0]<<16|v[3]>>>16,v[2],v[1]<<16|v[0]>>>16,v[3],v[2]<<16|v[1]>>>16],H=this._C=[v[2]<<16|v[2]>>>16,v[0]&4294901760|v[1]&65535,v[3]<<16|v[3]>>>16,v[1]&4294901760|v[2]&65535,v[0]<<16|v[0]>>>16,v[2]&4294901760|v[3]&65535,v[1]<<16|v[1]>>>16,v[3]&4294901760|v[0]&65535];this._b=0;for(var x=0;x<4;x++)p.call(this);for(var x=0;x<8;x++)H[x]^=S[x+4&7];if(I){var B=I.words,Q=B[0],z=B[1],K=(Q<<8|Q>>>24)&16711935|(Q<<24|Q>>>8)&4278255360,J=(z<<8|z>>>24)&16711935|(z<<24|z>>>8)&4278255360,U=K>>>16|J&4294901760,j=J<<16|K&65535;H[0]^=K,H[1]^=U,H[2]^=J,H[3]^=j,H[4]^=K,H[5]^=U,H[6]^=J,H[7]^=j;for(var x=0;x<4;x++)p.call(this)}},_doProcessBlock:function(v,I){var x=this._X;p.call(this),E[0]=x[0]^x[5]>>>16^x[3]<<16,E[1]=x[2]^x[7]>>>16^x[5]<<16,E[2]=x[4]^x[1]>>>16^x[7]<<16,E[3]=x[6]^x[3]>>>16^x[1]<<16;for(var S=0;S<4;S++)E[S]=(E[S]<<8|E[S]>>>24)&16711935|(E[S]<<24|E[S]>>>8)&4278255360,v[I+S]^=E[S]},blockSize:128/32,ivSize:64/32});function p(){for(var v=this._X,I=this._C,x=0;x<8;x++)g[x]=I[x];I[0]=I[0]+1295307597+this._b|0,I[1]=I[1]+3545052371+(I[0]>>>0<g[0]>>>0?1:0)|0,I[2]=I[2]+886263092+(I[1]>>>0<g[1]>>>0?1:0)|0,I[3]=I[3]+1295307597+(I[2]>>>0<g[2]>>>0?1:0)|0,I[4]=I[4]+3545052371+(I[3]>>>0<g[3]>>>0?1:0)|0,I[5]=I[5]+886263092+(I[4]>>>0<g[4]>>>0?1:0)|0,I[6]=I[6]+1295307597+(I[5]>>>0<g[5]>>>0?1:0)|0,I[7]=I[7]+3545052371+(I[6]>>>0<g[6]>>>0?1:0)|0,this._b=I[7]>>>0<g[7]>>>0?1:0;for(var x=0;x<8;x++){var S=v[x]+I[x],H=S&65535,B=S>>>16,Q=((H*H>>>17)+H*B>>>15)+B*B,z=((S&4294901760)*S|0)+((S&65535)*S|0);h[x]=Q^z}v[0]=h[0]+(h[7]<<16|h[7]>>>16)+(h[6]<<16|h[6]>>>16)|0,v[1]=h[1]+(h[0]<<8|h[0]>>>24)+h[7]|0,v[2]=h[2]+(h[1]<<16|h[1]>>>16)+(h[0]<<16|h[0]>>>16)|0,v[3]=h[3]+(h[2]<<8|h[2]>>>24)+h[1]|0,v[4]=h[4]+(h[3]<<16|h[3]>>>16)+(h[2]<<16|h[2]>>>16)|0,v[5]=h[5]+(h[4]<<8|h[4]>>>24)+h[3]|0,v[6]=h[6]+(h[5]<<16|h[5]>>>16)+(h[4]<<16|h[4]>>>16)|0,v[7]=h[7]+(h[6]<<8|h[6]>>>24)+h[5]|0}d.Rabbit=M._createHelper(b)}(),y.Rabbit})},ELcG:function(l,G,N){(function(y,d){l.exports=G=d(N("Ib8C"))})(this,function(y){/** @preserve
(c) 2012 by Cédric Mesnil. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/return function(d){var F=y,M=F.lib,D=M.WordArray,E=M.Hasher,g=F.algo,h=D.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),b=D.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),p=D.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),v=D.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),I=D.create([0,1518500249,1859775393,2400959708,2840853838]),x=D.create([1352829926,1548603684,1836072691,2053994217,0]),S=g.RIPEMD160=E.extend({_doReset:function(){this._hash=D.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(U,j){for(var T=0;T<16;T++){var te=j+T,Z=U[te];U[te]=(Z<<8|Z>>>24)&16711935|(Z<<24|Z>>>8)&4278255360}var _=this._hash.words,Y=I.words,re=x.words,pe=h.words,le=b.words,_e=p.words,me=v.words,ke,$,ne,W,ie,de,ee,Ce,De,Le;de=ke=_[0],ee=$=_[1],Ce=ne=_[2],De=W=_[3],Le=ie=_[4];for(var Ye,T=0;T<80;T+=1)Ye=ke+U[j+pe[T]]|0,T<16?Ye+=H($,ne,W)+Y[0]:T<32?Ye+=B($,ne,W)+Y[1]:T<48?Ye+=Q($,ne,W)+Y[2]:T<64?Ye+=z($,ne,W)+Y[3]:Ye+=K($,ne,W)+Y[4],Ye=Ye|0,Ye=J(Ye,_e[T]),Ye=Ye+ie|0,ke=ie,ie=W,W=J(ne,10),ne=$,$=Ye,Ye=de+U[j+le[T]]|0,T<16?Ye+=K(ee,Ce,De)+re[0]:T<32?Ye+=z(ee,Ce,De)+re[1]:T<48?Ye+=Q(ee,Ce,De)+re[2]:T<64?Ye+=B(ee,Ce,De)+re[3]:Ye+=H(ee,Ce,De)+re[4],Ye=Ye|0,Ye=J(Ye,me[T]),Ye=Ye+Le|0,de=Le,Le=De,De=J(Ce,10),Ce=ee,ee=Ye;Ye=_[1]+ne+De|0,_[1]=_[2]+W+Le|0,_[2]=_[3]+ie+de|0,_[3]=_[4]+ke+ee|0,_[4]=_[0]+$+Ce|0,_[0]=Ye},_doFinalize:function(){var U=this._data,j=U.words,T=this._nDataBytes*8,te=U.sigBytes*8;j[te>>>5]|=128<<24-te%32,j[(te+64>>>9<<4)+14]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,U.sigBytes=(j.length+1)*4,this._process();for(var Z=this._hash,_=Z.words,Y=0;Y<5;Y++){var re=_[Y];_[Y]=(re<<8|re>>>24)&16711935|(re<<24|re>>>8)&4278255360}return Z},clone:function(){var U=E.clone.call(this);return U._hash=this._hash.clone(),U}});function H(U,j,T){return U^j^T}function B(U,j,T){return U&j|~U&T}function Q(U,j,T){return(U|~j)^T}function z(U,j,T){return U&T|j&~T}function K(U,j,T){return U^(j|~T)}function J(U,j){return U<<j|U>>>32-j}F.RIPEMD160=E._createHelper(S),F.HmacRIPEMD160=E._createHmacHelper(S)}(Math),y.RIPEMD160})},ETIr:function(l,G,N){(function(y,d){l.exports=G=d(N("Ib8C"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.WordArray,D=d.enc,E=D.Base64={stringify:function(h){var b=h.words,p=h.sigBytes,v=this._map;h.clamp();for(var I=[],x=0;x<p;x+=3)for(var S=b[x>>>2]>>>24-x%4*8&255,H=b[x+1>>>2]>>>24-(x+1)%4*8&255,B=b[x+2>>>2]>>>24-(x+2)%4*8&255,Q=S<<16|H<<8|B,z=0;z<4&&x+z*.75<p;z++)I.push(v.charAt(Q>>>6*(3-z)&63));var K=v.charAt(64);if(K)for(;I.length%4;)I.push(K);return I.join("")},parse:function(h){var b=h.length,p=this._map,v=this._reverseMap;if(!v){v=this._reverseMap=[];for(var I=0;I<p.length;I++)v[p.charCodeAt(I)]=I}var x=p.charAt(64);if(x){var S=h.indexOf(x);S!==-1&&(b=S)}return g(h,b,v)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function g(h,b,p){for(var v=[],I=0,x=0;x<b;x++)if(x%4){var S=p[h.charCodeAt(x-1)]<<x%4*2,H=p[h.charCodeAt(x)]>>>6-x%4*2,B=S|H;v[I>>>2]|=B<<24-I%4*8,I++}return M.create(v,I)}}(),y.enc.Base64})},"F+F2":function(l,G,N){(function(y,d){l.exports=G=d(N("Ib8C"))})(this,function(y){return function(){if(typeof ArrayBuffer!="function")return;var d=y,F=d.lib,M=F.WordArray,D=M.init,E=M.init=function(g){if(g instanceof ArrayBuffer&&(g=new Uint8Array(g)),(g instanceof Int8Array||typeof Uint8ClampedArray!="undefined"&&g instanceof Uint8ClampedArray||g instanceof Int16Array||g instanceof Uint16Array||g instanceof Int32Array||g instanceof Uint32Array||g instanceof Float32Array||g instanceof Float64Array)&&(g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength)),g instanceof Uint8Array){for(var h=g.byteLength,b=[],p=0;p<h;p++)b[p>>>2]|=g[p]<<24-p%4*8;D.call(this,b,h)}else D.apply(this,arguments)};E.prototype=M}(),y.lib.WordArray})},GRuw:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("lPiR"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.WordArray,D=d.algo,E=D.SHA256,g=D.SHA224=E.extend({_doReset:function(){this._hash=new M.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var h=E._doFinalize.call(this);return h.sigBytes-=4,h}});d.SHA224=E._createHelper(g),d.HmacSHA224=E._createHmacHelper(g)}(),y.SHA224})},GfqC:function(l,G,N){"use strict";var y=N("q1tI"),d=N.n(y),F=N("TSYQ"),M=N.n(F);function D(W,ie){var de="cannot "+W.method+" "+W.action+" "+ie.status+"'",ee=new Error(de);return ee.status=ie.status,ee.method=W.method,ee.url=W.action,ee}function E(W){var ie=W.responseText||W.response;if(!ie)return ie;try{return JSON.parse(ie)}catch(de){return ie}}function g(W){var ie=new XMLHttpRequest;W.onProgress&&ie.upload&&(ie.upload.onprogress=function(De){De.total>0&&(De.percent=De.loaded/De.total*100),W.onProgress(De)});var de=new FormData;W.data&&Object.keys(W.data).forEach(function(Ce){var De=W.data[Ce];if(Array.isArray(De)){De.forEach(function(Le){de.append(Ce+"[]",Le)});return}de.append(Ce,W.data[Ce])}),W.file instanceof Blob?de.append(W.filename,W.file,W.file.name):de.append(W.filename,W.file),ie.onerror=function(De){W.onError(De)},ie.onload=function(){return ie.status<200||ie.status>=300?W.onError(D(W,ie),E(ie)):W.onSuccess(E(ie),ie)},ie.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in ie&&(ie.withCredentials=!0);var ee=W.headers||{};return ee["X-Requested-With"]!==null&&ie.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(ee).forEach(function(Ce){ee[Ce]!==null&&ie.setRequestHeader(Ce,ee[Ce])}),ie.send(de),{abort:function(){ie.abort()}}}var h=+new Date,b=0;function p(){return"rc-upload-"+h+"-"+ ++b}function v(W,ie){return W.indexOf(ie,W.length-ie.length)!==-1}var I=function(W,ie){if(W&&ie){var de=Array.isArray(ie)?ie:ie.split(","),ee=W.name||"",Ce=W.type||"",De=Ce.replace(/\/.*$/,"");return de.some(function(Le){var Ye=Le.trim();return Ye.charAt(0)==="."?v(ee.toLowerCase(),Ye.toLowerCase()):/\/\*$/.test(Ye)?De===Ye.replace(/\/.*$/,""):Ce===Ye})}return!0};function x(W,ie){var de=W.createReader(),ee=[];function Ce(){de.readEntries(function(De){var Le=Array.prototype.slice.apply(De);ee=ee.concat(Le);var Ye=!Le.length;Ye?ie(ee):Ce()})}Ce()}var S=function(ie,de,ee){var Ce=function De(Le,Ye){Ye=Ye||"",Le.isFile?Le.file(function(et){ee(et)&&(Le.fullPath&&!et.webkitRelativePath&&(Object.defineProperties(et,{webkitRelativePath:{writable:!0}}),et.webkitRelativePath=Le.fullPath.replace(/^\//,""),Object.defineProperties(et,{webkitRelativePath:{writable:!1}})),de([et]))}):Le.isDirectory&&x(Le,function(et){et.forEach(function(Ae){De(Ae,""+Ye+Le.name+"/")})})};ie.forEach(function(De){Ce(De.webkitGetAsEntry())})},H=S,B=Object.assign||function(W){for(var ie=1;ie<arguments.length;ie++){var de=arguments[ie];for(var ee in de)Object.prototype.hasOwnProperty.call(de,ee)&&(W[ee]=de[ee])}return W},Q=function(){function W(ie,de){var ee=[],Ce=!0,De=!1,Le=void 0;try{for(var Ye=ie[Symbol.iterator](),et;!(Ce=(et=Ye.next()).done)&&!(ee.push(et.value),de&&ee.length===de);Ce=!0);}catch(Ae){De=!0,Le=Ae}finally{try{!Ce&&Ye.return&&Ye.return()}finally{if(De)throw Le}}return ee}return function(ie,de){if(Array.isArray(ie))return ie;if(Symbol.iterator in Object(ie))return W(ie,de);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),z=function(){function W(ie,de){for(var ee=0;ee<de.length;ee++){var Ce=de[ee];Ce.enumerable=Ce.enumerable||!1,Ce.configurable=!0,"value"in Ce&&(Ce.writable=!0),Object.defineProperty(ie,Ce.key,Ce)}}return function(ie,de,ee){return de&&W(ie.prototype,de),ee&&W(ie,ee),ie}}();function K(W,ie,de){return ie in W?Object.defineProperty(W,ie,{value:de,enumerable:!0,configurable:!0,writable:!0}):W[ie]=de,W}function J(W,ie){var de={};for(var ee in W){if(ie.indexOf(ee)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,ee))continue;de[ee]=W[ee]}return de}function U(W,ie){if(!(W instanceof ie))throw new TypeError("Cannot call a class as a function")}function j(W,ie){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ie&&(typeof ie=="object"||typeof ie=="function")?ie:W}function T(W,ie){if(typeof ie!="function"&&ie!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof ie);W.prototype=Object.create(ie&&ie.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),ie&&(Object.setPrototypeOf?Object.setPrototypeOf(W,ie):W.__proto__=ie)}var te=function(ie){return Object.keys(ie).reduce(function(de,ee){return(ee.substr(0,5)==="data-"||ee.substr(0,5)==="aria-"||ee==="role")&&(de[ee]=ie[ee]),de},{})},Z=function(W){T(ie,W);function ie(){var de,ee,Ce,De;U(this,ie);for(var Le=arguments.length,Ye=Array(Le),et=0;et<Le;et++)Ye[et]=arguments[et];return De=(ee=(Ce=j(this,(de=ie.__proto__||Object.getPrototypeOf(ie)).call.apply(de,[this].concat(Ye))),Ce),Ce.state={uid:p()},Ce.reqs={},Ce.onChange=function(Ae){var ct=Ae.target.files;Ce.uploadFiles(ct),Ce.reset()},Ce.onClick=function(Ae){var ct=Ce.fileInput;if(!ct)return;var $e=Ce.props,Fe=$e.children,Pe=$e.onClick;Fe&&Fe.type==="button"&&(ct.parentNode.focus(),ct.parentNode.querySelector("button").blur()),ct.click(),Pe&&Pe(Ae)},Ce.onKeyDown=function(Ae){Ae.key==="Enter"&&Ce.onClick()},Ce.onFileDrop=function(Ae){var ct=Ce.props.multiple;if(Ae.preventDefault(),Ae.type==="dragover")return;if(Ce.props.directory)H(Array.prototype.slice.call(Ae.dataTransfer.items),Ce.uploadFiles,function(Fe){return I(Fe,Ce.props.accept)});else{var $e=Array.prototype.slice.call(Ae.dataTransfer.files).filter(function(Fe){return I(Fe,Ce.props.accept)});ct===!1&&($e=$e.slice(0,1)),Ce.uploadFiles($e)}},Ce.uploadFiles=function(Ae){var ct=Array.prototype.slice.call(Ae);ct.map(function($e){return $e.uid=p(),$e}).forEach(function($e){Ce.upload($e,ct)})},Ce.saveFileInput=function(Ae){Ce.fileInput=Ae},ee),j(Ce,De)}return z(ie,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(ee,Ce){var De=this,Le=this.props;if(!Le.beforeUpload)return setTimeout(function(){return De.post(ee)},0);var Ye=Le.beforeUpload(ee,Ce);Ye&&Ye.then?Ye.then(function(et){var Ae=Object.prototype.toString.call(et);return Ae==="[object File]"||Ae==="[object Blob]"?De.post(et):De.post(ee)}).catch(function(et){console.log(et)}):Ye!==!1&&setTimeout(function(){return De.post(ee)},0);return}},{key:"post",value:function(ee){var Ce=this;if(!this._isMounted)return;var De=this.props,Le=De.onStart,Ye=De.onProgress,et=De.transformFile,Ae=et===void 0?function(ct){return ct}:et;new Promise(function(ct){var $e=De.action;return typeof $e=="function"&&($e=$e(ee)),ct($e)}).then(function(ct){var $e=ee.uid,Fe=De.customRequest||g,Pe=Promise.resolve(Ae(ee)).then(function(He){var ot=De.data;return typeof ot=="function"&&(ot=ot(He)),Promise.all([He,ot])}).catch(function(He){console.error(He)});Pe.then(function(He){var ot=Q(He,2),ye=ot[0],be=ot[1],Ke={action:ct,filename:De.name,data:be,file:ye,headers:De.headers,withCredentials:De.withCredentials,method:De.method||"post",onProgress:Ye?function(q){Ye(q,ee)}:null,onSuccess:function(m,c){delete Ce.reqs[$e],De.onSuccess(m,ee,c)},onError:function(m,c){delete Ce.reqs[$e],De.onError(m,c,ee)}};Le(ee),Ce.reqs[$e]=Fe(Ke)})})}},{key:"reset",value:function(){this.setState({uid:p()})}},{key:"abort",value:function(ee){var Ce=this.reqs;if(ee){var De=ee;ee&&ee.uid&&(De=ee.uid),Ce[De]&&Ce[De].abort&&Ce[De].abort(),delete Ce[De]}else Object.keys(Ce).forEach(function(Le){Ce[Le]&&Ce[Le].abort&&Ce[Le].abort(),delete Ce[Le]})}},{key:"render",value:function(){var ee,Ce=this.props,De=Ce.component,Le=Ce.prefixCls,Ye=Ce.className,et=Ce.disabled,Ae=Ce.id,ct=Ce.style,$e=Ce.multiple,Fe=Ce.accept,Pe=Ce.children,He=Ce.directory,ot=Ce.openFileDialogOnClick,ye=Ce.onMouseEnter,be=Ce.onMouseLeave,Ke=J(Ce,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),q=M()((ee={},K(ee,Le,!0),K(ee,Le+"-disabled",et),K(ee,Ye,Ye),ee)),m=et?{}:{onClick:ot?this.onClick:function(){},onKeyDown:ot?this.onKeyDown:function(){},onMouseEnter:ye,onMouseLeave:be,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return d.a.createElement(De,B({},m,{className:q,role:"button",style:ct}),d.a.createElement("input",B({},te(Ke),{id:Ae,type:"file",ref:this.saveFileInput,onClick:function(R){return R.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:Fe,directory:He?"directory":null,webkitdirectory:He?"webkitdirectory":null,multiple:$e,onChange:this.onChange})),Pe)}}]),ie}(y.Component),_=Z,Y=Object.assign||function(W){for(var ie=1;ie<arguments.length;ie++){var de=arguments[ie];for(var ee in de)Object.prototype.hasOwnProperty.call(de,ee)&&(W[ee]=de[ee])}return W},re=function(){function W(ie,de){for(var ee=0;ee<de.length;ee++){var Ce=de[ee];Ce.enumerable=Ce.enumerable||!1,Ce.configurable=!0,"value"in Ce&&(Ce.writable=!0),Object.defineProperty(ie,Ce.key,Ce)}}return function(ie,de,ee){return de&&W(ie.prototype,de),ee&&W(ie,ee),ie}}();function pe(W,ie){if(!(W instanceof ie))throw new TypeError("Cannot call a class as a function")}function le(W,ie){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ie&&(typeof ie=="object"||typeof ie=="function")?ie:W}function _e(W,ie){if(typeof ie!="function"&&ie!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof ie);W.prototype=Object.create(ie&&ie.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),ie&&(Object.setPrototypeOf?Object.setPrototypeOf(W,ie):W.__proto__=ie)}function me(){}var ke=function(W){_e(ie,W);function ie(){var de,ee,Ce,De;pe(this,ie);for(var Le=arguments.length,Ye=Array(Le),et=0;et<Le;et++)Ye[et]=arguments[et];return De=(ee=(Ce=le(this,(de=ie.__proto__||Object.getPrototypeOf(ie)).call.apply(de,[this].concat(Ye))),Ce),Ce.saveUploader=function(Ae){Ce.uploader=Ae},ee),le(Ce,De)}return re(ie,[{key:"abort",value:function(ee){this.uploader.abort(ee)}},{key:"render",value:function(){return d.a.createElement(_,Y({},this.props,{ref:this.saveUploader}))}}]),ie}(y.Component);ke.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:me,onError:me,onSuccess:me,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var $=ke,ne=G.a=$},H7XF:function(l,G,N){"use strict";G.byteLength=h,G.toByteArray=p,G.fromByteArray=x;for(var y=[],d=[],F=typeof Uint8Array!="undefined"?Uint8Array:Array,M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",D=0,E=M.length;D<E;++D)y[D]=M[D],d[M.charCodeAt(D)]=D;d["-".charCodeAt(0)]=62,d["_".charCodeAt(0)]=63;function g(S){var H=S.length;if(H%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var B=S.indexOf("=");B===-1&&(B=H);var Q=B===H?0:4-B%4;return[B,Q]}function h(S){var H=g(S),B=H[0],Q=H[1];return(B+Q)*3/4-Q}function b(S,H,B){return(H+B)*3/4-B}function p(S){var H,B=g(S),Q=B[0],z=B[1],K=new F(b(S,Q,z)),J=0,U=z>0?Q-4:Q,j;for(j=0;j<U;j+=4)H=d[S.charCodeAt(j)]<<18|d[S.charCodeAt(j+1)]<<12|d[S.charCodeAt(j+2)]<<6|d[S.charCodeAt(j+3)],K[J++]=H>>16&255,K[J++]=H>>8&255,K[J++]=H&255;return z===2&&(H=d[S.charCodeAt(j)]<<2|d[S.charCodeAt(j+1)]>>4,K[J++]=H&255),z===1&&(H=d[S.charCodeAt(j)]<<10|d[S.charCodeAt(j+1)]<<4|d[S.charCodeAt(j+2)]>>2,K[J++]=H>>8&255,K[J++]=H&255),K}function v(S){return y[S>>18&63]+y[S>>12&63]+y[S>>6&63]+y[S&63]}function I(S,H,B){for(var Q,z=[],K=H;K<B;K+=3)Q=(S[K]<<16&16711680)+(S[K+1]<<8&65280)+(S[K+2]&255),z.push(v(Q));return z.join("")}function x(S){for(var H,B=S.length,Q=B%3,z=[],K=16383,J=0,U=B-Q;J<U;J+=K)z.push(I(S,J,J+K>U?U:J+K));return Q===1?(H=S[B-1],z.push(y[H>>2]+y[H<<4&63]+"==")):Q===2&&(H=(S[B-2]<<8)+S[B-1],z.push(y[H>>10]+y[H>>4&63]+y[H<<2&63]+"=")),z.join("")}},HDXh:function(l,G,N){"use strict";(function(y){/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/var d=N("H7XF"),F=N("kVK+"),M=N("49sm");G.Buffer=h,G.SlowBuffer=z,G.INSPECT_MAX_BYTES=50,h.TYPED_ARRAY_SUPPORT=y.TYPED_ARRAY_SUPPORT!==void 0?y.TYPED_ARRAY_SUPPORT:D(),G.kMaxLength=E();function D(){try{var q=new Uint8Array(1);return q.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},q.foo()===42&&typeof q.subarray=="function"&&q.subarray(1,1).byteLength===0}catch(m){return!1}}function E(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function g(q,m){if(E()<m)throw new RangeError("Invalid typed array length");return h.TYPED_ARRAY_SUPPORT?(q=new Uint8Array(m),q.__proto__=h.prototype):(q===null&&(q=new h(m)),q.length=m),q}function h(q,m,c){if(!h.TYPED_ARRAY_SUPPORT&&!(this instanceof h))return new h(q,m,c);if(typeof q=="number"){if(typeof m=="string")throw new Error("If encoding is specified then the first argument must be a string");return I(this,q)}return b(this,q,m,c)}h.poolSize=8192,h._augment=function(q){return q.__proto__=h.prototype,q};function b(q,m,c,R){if(typeof m=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&m instanceof ArrayBuffer?H(q,m,c,R):typeof m=="string"?x(q,m,c):B(q,m)}h.from=function(q,m,c){return b(null,q,m,c)},h.TYPED_ARRAY_SUPPORT&&(h.prototype.__proto__=Uint8Array.prototype,h.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&h[Symbol.species]===h&&Object.defineProperty(h,Symbol.species,{value:null,configurable:!0}));function p(q){if(typeof q!="number")throw new TypeError('"size" argument must be a number');if(q<0)throw new RangeError('"size" argument must not be negative')}function v(q,m,c,R){return p(m),m<=0?g(q,m):c!==void 0?typeof R=="string"?g(q,m).fill(c,R):g(q,m).fill(c):g(q,m)}h.alloc=function(q,m,c){return v(null,q,m,c)};function I(q,m){if(p(m),q=g(q,m<0?0:Q(m)|0),!h.TYPED_ARRAY_SUPPORT)for(var c=0;c<m;++c)q[c]=0;return q}h.allocUnsafe=function(q){return I(null,q)},h.allocUnsafeSlow=function(q){return I(null,q)};function x(q,m,c){if((typeof c!="string"||c==="")&&(c="utf8"),!h.isEncoding(c))throw new TypeError('"encoding" must be a valid string encoding');var R=K(m,c)|0;q=g(q,R);var fe=q.write(m,c);return fe!==R&&(q=q.slice(0,fe)),q}function S(q,m){var c=m.length<0?0:Q(m.length)|0;q=g(q,c);for(var R=0;R<c;R+=1)q[R]=m[R]&255;return q}function H(q,m,c,R){if(m.byteLength,c<0||m.byteLength<c)throw new RangeError("'offset' is out of bounds");if(m.byteLength<c+(R||0))throw new RangeError("'length' is out of bounds");return c===void 0&&R===void 0?m=new Uint8Array(m):R===void 0?m=new Uint8Array(m,c):m=new Uint8Array(m,c,R),h.TYPED_ARRAY_SUPPORT?(q=m,q.__proto__=h.prototype):q=S(q,m),q}function B(q,m){if(h.isBuffer(m)){var c=Q(m.length)|0;return q=g(q,c),q.length===0||m.copy(q,0,0,c),q}if(m){if(typeof ArrayBuffer!="undefined"&&m.buffer instanceof ArrayBuffer||"length"in m)return typeof m.length!="number"||Ke(m.length)?g(q,0):S(q,m);if(m.type==="Buffer"&&M(m.data))return S(q,m.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Q(q){if(q>=E())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+E().toString(16)+" bytes");return q|0}function z(q){return+q!=q&&(q=0),h.alloc(+q)}h.isBuffer=function(m){return!!(m!=null&&m._isBuffer)},h.compare=function(m,c){if(!h.isBuffer(m)||!h.isBuffer(c))throw new TypeError("Arguments must be Buffers");if(m===c)return 0;for(var R=m.length,fe=c.length,ve=0,Re=Math.min(R,fe);ve<Re;++ve)if(m[ve]!==c[ve]){R=m[ve],fe=c[ve];break}return R<fe?-1:fe<R?1:0},h.isEncoding=function(m){switch(String(m).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},h.concat=function(m,c){if(!M(m))throw new TypeError('"list" argument must be an Array of Buffers');if(m.length===0)return h.alloc(0);var R;if(c===void 0)for(c=0,R=0;R<m.length;++R)c+=m[R].length;var fe=h.allocUnsafe(c),ve=0;for(R=0;R<m.length;++R){var Re=m[R];if(!h.isBuffer(Re))throw new TypeError('"list" argument must be an Array of Buffers');Re.copy(fe,ve),ve+=Re.length}return fe};function K(q,m){if(h.isBuffer(q))return q.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(q)||q instanceof ArrayBuffer))return q.byteLength;typeof q!="string"&&(q=""+q);var c=q.length;if(c===0)return 0;for(var R=!1;;)switch(m){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":case void 0:return Pe(q).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return ye(q).length;default:if(R)return Pe(q).length;m=(""+m).toLowerCase(),R=!0}}h.byteLength=K;function J(q,m,c){var R=!1;if((m===void 0||m<0)&&(m=0),m>this.length)return"";if((c===void 0||c>this.length)&&(c=this.length),c<=0)return"";if(c>>>=0,m>>>=0,c<=m)return"";for(q||(q="utf8");;)switch(q){case"hex":return W(this,m,c);case"utf8":case"utf-8":return _e(this,m,c);case"ascii":return $(this,m,c);case"latin1":case"binary":return ne(this,m,c);case"base64":return le(this,m,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ie(this,m,c);default:if(R)throw new TypeError("Unknown encoding: "+q);q=(q+"").toLowerCase(),R=!0}}h.prototype._isBuffer=!0;function U(q,m,c){var R=q[m];q[m]=q[c],q[c]=R}h.prototype.swap16=function(){var m=this.length;if(m%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var c=0;c<m;c+=2)U(this,c,c+1);return this},h.prototype.swap32=function(){var m=this.length;if(m%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var c=0;c<m;c+=4)U(this,c,c+3),U(this,c+1,c+2);return this},h.prototype.swap64=function(){var m=this.length;if(m%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var c=0;c<m;c+=8)U(this,c,c+7),U(this,c+1,c+6),U(this,c+2,c+5),U(this,c+3,c+4);return this},h.prototype.toString=function(){var m=this.length|0;return m===0?"":arguments.length===0?_e(this,0,m):J.apply(this,arguments)},h.prototype.equals=function(m){if(!h.isBuffer(m))throw new TypeError("Argument must be a Buffer");return this===m?!0:h.compare(this,m)===0},h.prototype.inspect=function(){var m="",c=G.INSPECT_MAX_BYTES;return this.length>0&&(m=this.toString("hex",0,c).match(/.{2}/g).join(" "),this.length>c&&(m+=" ... ")),"<Buffer "+m+">"},h.prototype.compare=function(m,c,R,fe,ve){if(!h.isBuffer(m))throw new TypeError("Argument must be a Buffer");if(c===void 0&&(c=0),R===void 0&&(R=m?m.length:0),fe===void 0&&(fe=0),ve===void 0&&(ve=this.length),c<0||R>m.length||fe<0||ve>this.length)throw new RangeError("out of range index");if(fe>=ve&&c>=R)return 0;if(fe>=ve)return-1;if(c>=R)return 1;if(c>>>=0,R>>>=0,fe>>>=0,ve>>>=0,this===m)return 0;for(var Re=ve-fe,qe=R-c,nt=Math.min(Re,qe),st=this.slice(fe,ve),bt=m.slice(c,R),dt=0;dt<nt;++dt)if(st[dt]!==bt[dt]){Re=st[dt],qe=bt[dt];break}return Re<qe?-1:qe<Re?1:0};function j(q,m,c,R,fe){if(q.length===0)return-1;if(typeof c=="string"?(R=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,isNaN(c)&&(c=fe?0:q.length-1),c<0&&(c=q.length+c),c>=q.length){if(fe)return-1;c=q.length-1}else if(c<0)if(fe)c=0;else return-1;if(typeof m=="string"&&(m=h.from(m,R)),h.isBuffer(m))return m.length===0?-1:T(q,m,c,R,fe);if(typeof m=="number")return m=m&255,h.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?fe?Uint8Array.prototype.indexOf.call(q,m,c):Uint8Array.prototype.lastIndexOf.call(q,m,c):T(q,[m],c,R,fe);throw new TypeError("val must be string, number or Buffer")}function T(q,m,c,R,fe){var ve=1,Re=q.length,qe=m.length;if(R!==void 0&&(R=String(R).toLowerCase(),R==="ucs2"||R==="ucs-2"||R==="utf16le"||R==="utf-16le")){if(q.length<2||m.length<2)return-1;ve=2,Re/=2,qe/=2,c/=2}function nt(It,at){return ve===1?It[at]:It.readUInt16BE(at*ve)}var st;if(fe){var bt=-1;for(st=c;st<Re;st++)if(nt(q,st)===nt(m,bt===-1?0:st-bt)){if(bt===-1&&(bt=st),st-bt+1===qe)return bt*ve}else bt!==-1&&(st-=st-bt),bt=-1}else for(c+qe>Re&&(c=Re-qe),st=c;st>=0;st--){for(var dt=!0,Et=0;Et<qe;Et++)if(nt(q,st+Et)!==nt(m,Et)){dt=!1;break}if(dt)return st}return-1}h.prototype.includes=function(m,c,R){return this.indexOf(m,c,R)!==-1},h.prototype.indexOf=function(m,c,R){return j(this,m,c,R,!0)},h.prototype.lastIndexOf=function(m,c,R){return j(this,m,c,R,!1)};function te(q,m,c,R){c=Number(c)||0;var fe=q.length-c;R?(R=Number(R),R>fe&&(R=fe)):R=fe;var ve=m.length;if(ve%2!==0)throw new TypeError("Invalid hex string");R>ve/2&&(R=ve/2);for(var Re=0;Re<R;++Re){var qe=parseInt(m.substr(Re*2,2),16);if(isNaN(qe))return Re;q[c+Re]=qe}return Re}function Z(q,m,c,R){return be(Pe(m,q.length-c),q,c,R)}function _(q,m,c,R){return be(He(m),q,c,R)}function Y(q,m,c,R){return _(q,m,c,R)}function re(q,m,c,R){return be(ye(m),q,c,R)}function pe(q,m,c,R){return be(ot(m,q.length-c),q,c,R)}h.prototype.write=function(m,c,R,fe){if(c===void 0)fe="utf8",R=this.length,c=0;else if(R===void 0&&typeof c=="string")fe=c,R=this.length,c=0;else if(isFinite(c))c=c|0,isFinite(R)?(R=R|0,fe===void 0&&(fe="utf8")):(fe=R,R=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var ve=this.length-c;if((R===void 0||R>ve)&&(R=ve),m.length>0&&(R<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");fe||(fe="utf8");for(var Re=!1;;)switch(fe){case"hex":return te(this,m,c,R);case"utf8":case"utf-8":return Z(this,m,c,R);case"ascii":return _(this,m,c,R);case"latin1":case"binary":return Y(this,m,c,R);case"base64":return re(this,m,c,R);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pe(this,m,c,R);default:if(Re)throw new TypeError("Unknown encoding: "+fe);fe=(""+fe).toLowerCase(),Re=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function le(q,m,c){return m===0&&c===q.length?d.fromByteArray(q):d.fromByteArray(q.slice(m,c))}function _e(q,m,c){c=Math.min(q.length,c);for(var R=[],fe=m;fe<c;){var ve=q[fe],Re=null,qe=ve>239?4:ve>223?3:ve>191?2:1;if(fe+qe<=c){var nt,st,bt,dt;switch(qe){case 1:ve<128&&(Re=ve);break;case 2:nt=q[fe+1],(nt&192)===128&&(dt=(ve&31)<<6|nt&63,dt>127&&(Re=dt));break;case 3:nt=q[fe+1],st=q[fe+2],(nt&192)===128&&(st&192)===128&&(dt=(ve&15)<<12|(nt&63)<<6|st&63,dt>2047&&(dt<55296||dt>57343)&&(Re=dt));break;case 4:nt=q[fe+1],st=q[fe+2],bt=q[fe+3],(nt&192)===128&&(st&192)===128&&(bt&192)===128&&(dt=(ve&15)<<18|(nt&63)<<12|(st&63)<<6|bt&63,dt>65535&&dt<1114112&&(Re=dt))}}Re===null?(Re=65533,qe=1):Re>65535&&(Re-=65536,R.push(Re>>>10&1023|55296),Re=56320|Re&1023),R.push(Re),fe+=qe}return ke(R)}var me=4096;function ke(q){var m=q.length;if(m<=me)return String.fromCharCode.apply(String,q);for(var c="",R=0;R<m;)c+=String.fromCharCode.apply(String,q.slice(R,R+=me));return c}function $(q,m,c){var R="";c=Math.min(q.length,c);for(var fe=m;fe<c;++fe)R+=String.fromCharCode(q[fe]&127);return R}function ne(q,m,c){var R="";c=Math.min(q.length,c);for(var fe=m;fe<c;++fe)R+=String.fromCharCode(q[fe]);return R}function W(q,m,c){var R=q.length;(!m||m<0)&&(m=0),(!c||c<0||c>R)&&(c=R);for(var fe="",ve=m;ve<c;++ve)fe+=Fe(q[ve]);return fe}function ie(q,m,c){for(var R=q.slice(m,c),fe="",ve=0;ve<R.length;ve+=2)fe+=String.fromCharCode(R[ve]+R[ve+1]*256);return fe}h.prototype.slice=function(m,c){var R=this.length;m=~~m,c=c===void 0?R:~~c,m<0?(m+=R,m<0&&(m=0)):m>R&&(m=R),c<0?(c+=R,c<0&&(c=0)):c>R&&(c=R),c<m&&(c=m);var fe;if(h.TYPED_ARRAY_SUPPORT)fe=this.subarray(m,c),fe.__proto__=h.prototype;else{var ve=c-m;fe=new h(ve,void 0);for(var Re=0;Re<ve;++Re)fe[Re]=this[Re+m]}return fe};function de(q,m,c){if(q%1!==0||q<0)throw new RangeError("offset is not uint");if(q+m>c)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUIntLE=function(m,c,R){m=m|0,c=c|0,R||de(m,c,this.length);for(var fe=this[m],ve=1,Re=0;++Re<c&&(ve*=256);)fe+=this[m+Re]*ve;return fe},h.prototype.readUIntBE=function(m,c,R){m=m|0,c=c|0,R||de(m,c,this.length);for(var fe=this[m+--c],ve=1;c>0&&(ve*=256);)fe+=this[m+--c]*ve;return fe},h.prototype.readUInt8=function(m,c){return c||de(m,1,this.length),this[m]},h.prototype.readUInt16LE=function(m,c){return c||de(m,2,this.length),this[m]|this[m+1]<<8},h.prototype.readUInt16BE=function(m,c){return c||de(m,2,this.length),this[m]<<8|this[m+1]},h.prototype.readUInt32LE=function(m,c){return c||de(m,4,this.length),(this[m]|this[m+1]<<8|this[m+2]<<16)+this[m+3]*16777216},h.prototype.readUInt32BE=function(m,c){return c||de(m,4,this.length),this[m]*16777216+(this[m+1]<<16|this[m+2]<<8|this[m+3])},h.prototype.readIntLE=function(m,c,R){m=m|0,c=c|0,R||de(m,c,this.length);for(var fe=this[m],ve=1,Re=0;++Re<c&&(ve*=256);)fe+=this[m+Re]*ve;return ve*=128,fe>=ve&&(fe-=Math.pow(2,8*c)),fe},h.prototype.readIntBE=function(m,c,R){m=m|0,c=c|0,R||de(m,c,this.length);for(var fe=c,ve=1,Re=this[m+--fe];fe>0&&(ve*=256);)Re+=this[m+--fe]*ve;return ve*=128,Re>=ve&&(Re-=Math.pow(2,8*c)),Re},h.prototype.readInt8=function(m,c){return c||de(m,1,this.length),this[m]&128?(255-this[m]+1)*-1:this[m]},h.prototype.readInt16LE=function(m,c){c||de(m,2,this.length);var R=this[m]|this[m+1]<<8;return R&32768?R|4294901760:R},h.prototype.readInt16BE=function(m,c){c||de(m,2,this.length);var R=this[m+1]|this[m]<<8;return R&32768?R|4294901760:R},h.prototype.readInt32LE=function(m,c){return c||de(m,4,this.length),this[m]|this[m+1]<<8|this[m+2]<<16|this[m+3]<<24},h.prototype.readInt32BE=function(m,c){return c||de(m,4,this.length),this[m]<<24|this[m+1]<<16|this[m+2]<<8|this[m+3]},h.prototype.readFloatLE=function(m,c){return c||de(m,4,this.length),F.read(this,m,!0,23,4)},h.prototype.readFloatBE=function(m,c){return c||de(m,4,this.length),F.read(this,m,!1,23,4)},h.prototype.readDoubleLE=function(m,c){return c||de(m,8,this.length),F.read(this,m,!0,52,8)},h.prototype.readDoubleBE=function(m,c){return c||de(m,8,this.length),F.read(this,m,!1,52,8)};function ee(q,m,c,R,fe,ve){if(!h.isBuffer(q))throw new TypeError('"buffer" argument must be a Buffer instance');if(m>fe||m<ve)throw new RangeError('"value" argument is out of bounds');if(c+R>q.length)throw new RangeError("Index out of range")}h.prototype.writeUIntLE=function(m,c,R,fe){if(m=+m,c=c|0,R=R|0,!fe){var ve=Math.pow(2,8*R)-1;ee(this,m,c,R,ve,0)}var Re=1,qe=0;for(this[c]=m&255;++qe<R&&(Re*=256);)this[c+qe]=m/Re&255;return c+R},h.prototype.writeUIntBE=function(m,c,R,fe){if(m=+m,c=c|0,R=R|0,!fe){var ve=Math.pow(2,8*R)-1;ee(this,m,c,R,ve,0)}var Re=R-1,qe=1;for(this[c+Re]=m&255;--Re>=0&&(qe*=256);)this[c+Re]=m/qe&255;return c+R},h.prototype.writeUInt8=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,1,255,0),h.TYPED_ARRAY_SUPPORT||(m=Math.floor(m)),this[c]=m&255,c+1};function Ce(q,m,c,R){m<0&&(m=65535+m+1);for(var fe=0,ve=Math.min(q.length-c,2);fe<ve;++fe)q[c+fe]=(m&255<<8*(R?fe:1-fe))>>>(R?fe:1-fe)*8}h.prototype.writeUInt16LE=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[c]=m&255,this[c+1]=m>>>8):Ce(this,m,c,!0),c+2},h.prototype.writeUInt16BE=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[c]=m>>>8,this[c+1]=m&255):Ce(this,m,c,!1),c+2};function De(q,m,c,R){m<0&&(m=4294967295+m+1);for(var fe=0,ve=Math.min(q.length-c,4);fe<ve;++fe)q[c+fe]=m>>>(R?fe:3-fe)*8&255}h.prototype.writeUInt32LE=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[c+3]=m>>>24,this[c+2]=m>>>16,this[c+1]=m>>>8,this[c]=m&255):De(this,m,c,!0),c+4},h.prototype.writeUInt32BE=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[c]=m>>>24,this[c+1]=m>>>16,this[c+2]=m>>>8,this[c+3]=m&255):De(this,m,c,!1),c+4},h.prototype.writeIntLE=function(m,c,R,fe){if(m=+m,c=c|0,!fe){var ve=Math.pow(2,8*R-1);ee(this,m,c,R,ve-1,-ve)}var Re=0,qe=1,nt=0;for(this[c]=m&255;++Re<R&&(qe*=256);)m<0&&nt===0&&this[c+Re-1]!==0&&(nt=1),this[c+Re]=(m/qe>>0)-nt&255;return c+R},h.prototype.writeIntBE=function(m,c,R,fe){if(m=+m,c=c|0,!fe){var ve=Math.pow(2,8*R-1);ee(this,m,c,R,ve-1,-ve)}var Re=R-1,qe=1,nt=0;for(this[c+Re]=m&255;--Re>=0&&(qe*=256);)m<0&&nt===0&&this[c+Re+1]!==0&&(nt=1),this[c+Re]=(m/qe>>0)-nt&255;return c+R},h.prototype.writeInt8=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,1,127,-128),h.TYPED_ARRAY_SUPPORT||(m=Math.floor(m)),m<0&&(m=255+m+1),this[c]=m&255,c+1},h.prototype.writeInt16LE=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[c]=m&255,this[c+1]=m>>>8):Ce(this,m,c,!0),c+2},h.prototype.writeInt16BE=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[c]=m>>>8,this[c+1]=m&255):Ce(this,m,c,!1),c+2},h.prototype.writeInt32LE=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[c]=m&255,this[c+1]=m>>>8,this[c+2]=m>>>16,this[c+3]=m>>>24):De(this,m,c,!0),c+4},h.prototype.writeInt32BE=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,4,2147483647,-2147483648),m<0&&(m=4294967295+m+1),h.TYPED_ARRAY_SUPPORT?(this[c]=m>>>24,this[c+1]=m>>>16,this[c+2]=m>>>8,this[c+3]=m&255):De(this,m,c,!1),c+4};function Le(q,m,c,R,fe,ve){if(c+R>q.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function Ye(q,m,c,R,fe){return fe||Le(q,m,c,4,34028234663852886e22,-34028234663852886e22),F.write(q,m,c,R,23,4),c+4}h.prototype.writeFloatLE=function(m,c,R){return Ye(this,m,c,!0,R)},h.prototype.writeFloatBE=function(m,c,R){return Ye(this,m,c,!1,R)};function et(q,m,c,R,fe){return fe||Le(q,m,c,8,17976931348623157e292,-17976931348623157e292),F.write(q,m,c,R,52,8),c+8}h.prototype.writeDoubleLE=function(m,c,R){return et(this,m,c,!0,R)},h.prototype.writeDoubleBE=function(m,c,R){return et(this,m,c,!1,R)},h.prototype.copy=function(m,c,R,fe){if(R||(R=0),!fe&&fe!==0&&(fe=this.length),c>=m.length&&(c=m.length),c||(c=0),fe>0&&fe<R&&(fe=R),fe===R)return 0;if(m.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(R<0||R>=this.length)throw new RangeError("sourceStart out of bounds");if(fe<0)throw new RangeError("sourceEnd out of bounds");fe>this.length&&(fe=this.length),m.length-c<fe-R&&(fe=m.length-c+R);var ve=fe-R,Re;if(this===m&&R<c&&c<fe)for(Re=ve-1;Re>=0;--Re)m[Re+c]=this[Re+R];else if(ve<1e3||!h.TYPED_ARRAY_SUPPORT)for(Re=0;Re<ve;++Re)m[Re+c]=this[Re+R];else Uint8Array.prototype.set.call(m,this.subarray(R,R+ve),c);return ve},h.prototype.fill=function(m,c,R,fe){if(typeof m=="string"){if(typeof c=="string"?(fe=c,c=0,R=this.length):typeof R=="string"&&(fe=R,R=this.length),m.length===1){var ve=m.charCodeAt(0);ve<256&&(m=ve)}if(fe!==void 0&&typeof fe!="string")throw new TypeError("encoding must be a string");if(typeof fe=="string"&&!h.isEncoding(fe))throw new TypeError("Unknown encoding: "+fe)}else typeof m=="number"&&(m=m&255);if(c<0||this.length<c||this.length<R)throw new RangeError("Out of range index");if(R<=c)return this;c=c>>>0,R=R===void 0?this.length:R>>>0,m||(m=0);var Re;if(typeof m=="number")for(Re=c;Re<R;++Re)this[Re]=m;else{var qe=h.isBuffer(m)?m:Pe(new h(m,fe).toString()),nt=qe.length;for(Re=0;Re<R-c;++Re)this[Re+c]=qe[Re%nt]}return this};var Ae=/[^+\/0-9A-Za-z-_]/g;function ct(q){if(q=$e(q).replace(Ae,""),q.length<2)return"";for(;q.length%4!==0;)q=q+"=";return q}function $e(q){return q.trim?q.trim():q.replace(/^\s+|\s+$/g,"")}function Fe(q){return q<16?"0"+q.toString(16):q.toString(16)}function Pe(q,m){m=m||Infinity;for(var c,R=q.length,fe=null,ve=[],Re=0;Re<R;++Re){if(c=q.charCodeAt(Re),c>55295&&c<57344){if(!fe){if(c>56319){(m-=3)>-1&&ve.push(239,191,189);continue}else if(Re+1===R){(m-=3)>-1&&ve.push(239,191,189);continue}fe=c;continue}if(c<56320){(m-=3)>-1&&ve.push(239,191,189),fe=c;continue}c=(fe-55296<<10|c-56320)+65536}else fe&&((m-=3)>-1&&ve.push(239,191,189));if(fe=null,c<128){if((m-=1)<0)break;ve.push(c)}else if(c<2048){if((m-=2)<0)break;ve.push(c>>6|192,c&63|128)}else if(c<65536){if((m-=3)<0)break;ve.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((m-=4)<0)break;ve.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return ve}function He(q){for(var m=[],c=0;c<q.length;++c)m.push(q.charCodeAt(c)&255);return m}function ot(q,m){for(var c,R,fe,ve=[],Re=0;Re<q.length&&!((m-=2)<0);++Re)c=q.charCodeAt(Re),R=c>>8,fe=c%256,ve.push(fe),ve.push(R);return ve}function ye(q){return d.toByteArray(ct(q))}function be(q,m,c,R){for(var fe=0;fe<R&&!(fe+c>=m.length||fe>=q.length);++fe)m[fe+c]=q[fe];return fe}function Ke(q){return q!==q}}).call(this,N("IyRk"))},IO3U:function(l,G,N){l.exports={wrp:"wrp___1U2de"}},Ib8C:function(l,G,N){(function(y){(function(d,F){l.exports=G=F()})(this,function(){var d=d||function(F,M){var D;if(typeof window!="undefined"&&window.crypto&&(D=window.crypto),typeof self!="undefined"&&self.crypto&&(D=self.crypto),typeof globalThis!="undefined"&&globalThis.crypto&&(D=globalThis.crypto),!D&&typeof window!="undefined"&&window.msCrypto&&(D=window.msCrypto),!D&&typeof y!="undefined"&&y.crypto&&(D=y.crypto),!D&&!0)try{D=N(4)}catch(K){}var E=function(){if(D){if(typeof D.getRandomValues=="function")try{return D.getRandomValues(new Uint32Array(1))[0]}catch(K){}if(typeof D.randomBytes=="function")try{return D.randomBytes(4).readInt32LE()}catch(K){}}throw new Error("Native crypto module could not be used to get secure random number.")},g=Object.create||function(){function K(){}return function(J){var U;return K.prototype=J,U=new K,K.prototype=null,U}}(),h={},b=h.lib={},p=b.Base=function(){return{extend:function(K){var J=g(this);return K&&J.mixIn(K),(!J.hasOwnProperty("init")||this.init===J.init)&&(J.init=function(){J.$super.init.apply(this,arguments)}),J.init.prototype=J,J.$super=this,J},create:function(){var K=this.extend();return K.init.apply(K,arguments),K},init:function(){},mixIn:function(K){for(var J in K)K.hasOwnProperty(J)&&(this[J]=K[J]);K.hasOwnProperty("toString")&&(this.toString=K.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),v=b.WordArray=p.extend({init:function(K,J){K=this.words=K||[],J!=M?this.sigBytes=J:this.sigBytes=K.length*4},toString:function(K){return(K||x).stringify(this)},concat:function(K){var J=this.words,U=K.words,j=this.sigBytes,T=K.sigBytes;if(this.clamp(),j%4)for(var te=0;te<T;te++){var Z=U[te>>>2]>>>24-te%4*8&255;J[j+te>>>2]|=Z<<24-(j+te)%4*8}else for(var _=0;_<T;_+=4)J[j+_>>>2]=U[_>>>2];return this.sigBytes+=T,this},clamp:function(){var K=this.words,J=this.sigBytes;K[J>>>2]&=4294967295<<32-J%4*8,K.length=F.ceil(J/4)},clone:function(){var K=p.clone.call(this);return K.words=this.words.slice(0),K},random:function(K){for(var J=[],U=0;U<K;U+=4)J.push(E());return new v.init(J,K)}}),I=h.enc={},x=I.Hex={stringify:function(K){for(var J=K.words,U=K.sigBytes,j=[],T=0;T<U;T++){var te=J[T>>>2]>>>24-T%4*8&255;j.push((te>>>4).toString(16)),j.push((te&15).toString(16))}return j.join("")},parse:function(K){for(var J=K.length,U=[],j=0;j<J;j+=2)U[j>>>3]|=parseInt(K.substr(j,2),16)<<24-j%8*4;return new v.init(U,J/2)}},S=I.Latin1={stringify:function(K){for(var J=K.words,U=K.sigBytes,j=[],T=0;T<U;T++){var te=J[T>>>2]>>>24-T%4*8&255;j.push(String.fromCharCode(te))}return j.join("")},parse:function(K){for(var J=K.length,U=[],j=0;j<J;j++)U[j>>>2]|=(K.charCodeAt(j)&255)<<24-j%4*8;return new v.init(U,J)}},H=I.Utf8={stringify:function(K){try{return decodeURIComponent(escape(S.stringify(K)))}catch(J){throw new Error("Malformed UTF-8 data")}},parse:function(K){return S.parse(unescape(encodeURIComponent(K)))}},B=b.BufferedBlockAlgorithm=p.extend({reset:function(){this._data=new v.init,this._nDataBytes=0},_append:function(K){typeof K=="string"&&(K=H.parse(K)),this._data.concat(K),this._nDataBytes+=K.sigBytes},_process:function(K){var J,U=this._data,j=U.words,T=U.sigBytes,te=this.blockSize,Z=te*4,_=T/Z;K?_=F.ceil(_):_=F.max((_|0)-this._minBufferSize,0);var Y=_*te,re=F.min(Y*4,T);if(Y){for(var pe=0;pe<Y;pe+=te)this._doProcessBlock(j,pe);J=j.splice(0,Y),U.sigBytes-=re}return new v.init(J,re)},clone:function(){var K=p.clone.call(this);return K._data=this._data.clone(),K},_minBufferSize:0}),Q=b.Hasher=B.extend({cfg:p.extend(),init:function(K){this.cfg=this.cfg.extend(K),this.reset()},reset:function(){B.reset.call(this),this._doReset()},update:function(K){return this._append(K),this._process(),this},finalize:function(K){K&&this._append(K);var J=this._doFinalize();return J},blockSize:512/32,_createHelper:function(K){return function(J,U){return new K.init(U).finalize(J)}},_createHmacHelper:function(K){return function(J,U){return new z.HMAC.init(K,U).finalize(J)}}}),z=h.algo={};return h}(Math);return d})}).call(this,N("IyRk"))},K3mO:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("3y9D"),N("WYAk"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.Base,D=F.WordArray,E=d.algo,g=E.MD5,h=E.EvpKDF=M.extend({cfg:M.extend({keySize:128/32,hasher:g,iterations:1}),init:function(b){this.cfg=this.cfg.extend(b)},compute:function(b,p){for(var v,I=this.cfg,x=I.hasher.create(),S=D.create(),H=S.words,B=I.keySize,Q=I.iterations;H.length<B;){v&&x.update(v),v=x.update(b).finalize(p),x.reset();for(var z=1;z<Q;z++)v=x.finalize(v),x.reset();S.concat(v)}return S.sigBytes=B*4,S}});d.EvpKDF=function(b,p,v){return h.create(v).compute(b,p)}}(),y.EvpKDF})},KhGG:function(l,G,N){"use strict";N.d(G,"a",function(){return T}),N.d(G,"c",function(){return _});var y=N("0Owb"),d=N("miYZ"),F=N("tsqr"),M=N("oBTY"),D=N("tJVT"),E=N("PpiC"),g=N("k1fw"),h=N("9og8"),b=N("DZo9"),p=N("8z0m"),v=N("WmNS"),I=N.n(v),x=N("q1tI"),S=N.n(x),H=N("ErOA"),B=N("NFKh"),Q=N.n(B),z=N("7Cbv"),K=N("9kvl"),J=N("mxV5"),U=N.n(J),j=p.a.Dragger,T=function(pe){var le="bf3c199c2470cb477d907b1e0917c17b",_e="5183666c72eec9e4",me=Q.a.enc.Utf8.parse(le),ke=Q.a.enc.Utf8.parse(_e),$=Q.a.AES.decrypt(pe,me,{iv:ke,mode:Q.a.mode.CBC});return $.toString(Q.a.enc.Utf8)},te,Z=function(){var re=Object(h.a)(I.a.mark(function pe(le){var _e,me,ke,$,ne,W,ie,de,ee,Ce,De;return I.a.wrap(function(Ye){for(;;)switch(Ye.prev=Ye.next){case 0:return ie=le.identifier,de=le.oldFilename,ee=le.newFilename,Ye.next=3,Object(H.a)("/api/buckets/get_upload_token_for_big_files.json",{method:"get"});case 3:return Ce=Ye.sent,Ce.data=JSON.parse(T(Ce.data)),De=new U.a({endpoint:Ce==null||((_e=Ce.data)===null||_e===void 0)?void 0:_e.end_point,region:Ce==null||((me=Ce.data)===null||me===void 0)?void 0:me.region,accessKeyId:Ce==null||((ke=Ce.data)===null||ke===void 0)?void 0:ke.access_key_id,accessKeySecret:Ce==null||(($=Ce.data)===null||$===void 0)?void 0:$.access_key_secret,bucket:Ce==null||((ne=Ce.data)===null||ne===void 0)?void 0:ne.bucket,stsToken:Ce==null||((W=Ce.data)===null||W===void 0)?void 0:W.security_token}),Ye.abrupt("return",new Promise(function(et,Ae){console.log(11111,"".concat(ie,"/").concat(de),"".concat(ie,"/").concat(ee),Ce.data),De.copy("/".concat(ie,"/").concat(de),"/".concat(ie,"/").concat(ee)).then(function(ct){console.log("\u62F7\u8D1D\u6210\u529F",ct)}).catch(function(ct){console.log(ct)})}));case 7:case"end":return Ye.stop()}},pe)}));return function(le){return re.apply(this,arguments)}}(),_=function(){var re=Object(h.a)(I.a.mark(function pe(le,_e,me){var ke,$,ne,W,ie,de,ee,Ce,De,Le;return I.a.wrap(function(et){for(;;)switch(et.prev=et.next){case 0:return _e.file_name=le.name,et.next=3,Object(H.a)("/api/buckets/get_upload_token.json",{method:"get"});case 3:return ee=et.sent,console.log("decrypt(res.data):",T(ee.data)),ee.data=JSON.parse(T(ee.data)),Ce=le.name.split("."),Ce.pop(),De=_e.realFileName?Ce:Object(z.a)(),Le=new U.a({endpoint:ee==null||((ke=ee.data)===null||ke===void 0)?void 0:ke.end_point,region:ee==null||(($=ee.data)===null||$===void 0)?void 0:$.region,accessKeyId:ee==null||((ne=ee.data)===null||ne===void 0)?void 0:ne.access_key_id,accessKeySecret:ee==null||((W=ee.data)===null||W===void 0)?void 0:W.access_key_secret,bucket:ee==null||((ie=ee.data)===null||ie===void 0)?void 0:ie.bucket,stsToken:ee==null||((de=ee.data)===null||de===void 0)?void 0:de.security_token}),et.abrupt("return",new Promise(function(Ae,ct){var $e;Le.multipartUpload("".concat(De),new Blob([le],{type:le.type}),Object(g.a)(Object(g.a)({timeout:200*1e3,partSize:102400},me),{},{callback:{url:ee==null||(($e=ee.data)===null||$e===void 0)?void 0:$e.callback_url,host:ee==null?void 0:ee.data.bucket_host,body:"bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&my_var=${x:my_var}&"+Object(H.e)(_e)}})).then(function(Fe){var Pe;le.response=(Pe=Fe.data)===null||Pe===void 0?void 0:Pe.data,Ae(Fe==null?void 0:Fe.data)}).catch(function(Fe){ct(Fe),console.log("err:",Fe)})}));case 11:case"end":return et.stop()}},pe)}));return function(le,_e,me){return re.apply(this,arguments)}}(),Y=function(pe){var le=pe.user,_e=pe.cancelUpload,me=Object(E.a)(pe,["user","cancelUpload"]),ke=Object(x.useState)([]),$=Object(D.a)(ke,2),ne=$[0],W=$[1],ie=Object(x.useState)(),de=Object(D.a)(ie,2),ee=de[0],Ce=de[1],De={onRemove:function(et){W(Object(M.a)(ne.filter(function(Ae){return Ae.name!==et.name}))),me.onChange(ne.filter(function(Ae){return Ae.name!==et.name}))},disabled:me.disabled,multiple:!0,fileList:ne==null?void 0:ne.map(function(Ye){return Ye.file}),customRequest:function(){},beforeUpload:function(){var Ye=Object(h.a)(I.a.mark(function Ae(ct){var $e;return I.a.wrap(function(Pe){for(;;)switch(Pe.prev=Pe.next){case 0:if($e=me.maxSize||1024*1024*1024*1,!ne.filter(function(He){return He.name===ct.name}).length){Pe.next=4;break}return F.b.info("".concat(ct.name,"\u5DF2\u5B58\u5728\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9")),Pe.abrupt("return");case 4:if(!((ct==null?void 0:ct.size)>$e)){Pe.next=7;break}return F.b.info("\u6587\u4EF6\u8D85\u8FC7".concat($e/1024/1024/1024,"GB\uFF0C\u4E0D\u7B26\u5408\u4E0A\u4F20\u8981\u6C42")),Pe.abrupt("return",!1);case 7:return ne.push({name:ct.name,file:ct}),W(Object(M.a)(ne)),me.onChange(ne),Pe.abrupt("return",!1);case 11:case"end":return Pe.stop()}},Ae)}));function et(Ae){return Ye.apply(this,arguments)}return et}()},Le=function(){var Ye=Object(h.a)(I.a.mark(function et(Ae,ct){var $e,Fe,Pe,He,ot,ye,be,Ke,q,m;return I.a.wrap(function(R){for(;;)switch(R.prev=R.next){case 0:return ct.file_name=Ae.name,be=Ae.name,R.next=4,Object(H.a)("/api/buckets/get_upload_token_for_big_files.json",{method:"get"});case 4:if(Ke=R.sent,Ke.data=JSON.parse(T(Ke.data)),!((Ke==null?void 0:Ke.status)!==0)){R.next=12;break}return ne[ne.findIndex(function(fe){return fe.name===be})].status="error",ne[ne.findIndex(function(fe){return fe.name===be})].file.status="error",me.onChange(ne),F.b.warn("\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u5C1D\u8BD5"),R.abrupt("return");case 12:return ee=new U.a({endpoint:Ke==null||(($e=Ke.data)===null||$e===void 0)?void 0:$e.end_point,region:Ke==null||((Fe=Ke.data)===null||Fe===void 0)?void 0:Fe.region,accessKeyId:Ke==null||((Pe=Ke.data)===null||Pe===void 0)?void 0:Pe.access_key_id,accessKeySecret:Ke==null||((He=Ke.data)===null||He===void 0)?void 0:He.access_key_secret,bucket:Ke==null||((ot=Ke.data)===null||ot===void 0)?void 0:ot.bucket,stsToken:Ke==null||((ye=Ke.data)===null||ye===void 0)?void 0:ye.security_token}),console.log(Ae,"file"),Ce(ee),q=Ae.name.split("."),q.pop(),m=ct.realFileName?q:Object(z.a)(),R.abrupt("return",new Promise(function(fe,ve){try{var Re;ee.multipartUpload("".concat(me.identifier,"/").concat(m).concat(be.indexOf(".")>-1?"."+be.split(".").pop():""),new Blob([Ae.file],{type:Ae.file.type}),{timeout:3600*1e3,partSize:1002400,progress:function(nt,st,bt){try{console.log("\u8FDB\u5EA6",nt,st,bt);var dt=ne.findIndex(function(Et){return Et.name===be});ne[dt].file.percent=nt*100,ne[dt].tempCheckpoint=st,W(Object(M.a)(ne))}catch(Et){}},checkpoint:ne[ne.findIndex(function(qe){return qe.name===be})].tempCheckpoint,callback:{customValue:{id:be+""},url:Ke==null||((Re=Ke.data)===null||Re===void 0)?void 0:Re.callback_url,host:Ke==null?void 0:Ke.data.bucket_host,body:"bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&my_var=${x:my_var}&"+Object(H.e)(ct)}}).then(function(qe){var nt,st=ne.findIndex(function(at){return at.name===be}),bt="done";if(((nt=qe.data)===null||nt===void 0?void 0:nt.status)===0){var dt;Ae.response=(dt=qe.data)===null||dt===void 0?void 0:dt.data;var Et=ne.findIndex(function(at){return at.name===be});ne[Et].status="done",ne[Et].file.status="done"}else{var It;F.b.warn((It=qe.data)===null||It===void 0?void 0:It.message),bt="error"}ne[st].status=bt,ne[st].file.status=bt,me.onChange(ne),fe(qe==null?void 0:qe.data)}).catch(function(qe){ne[ne.findIndex(function(nt){return nt.name===be})].status="error",ne[ne.findIndex(function(nt){return nt.name===be})].file.status="error",F.b.warn("\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u5C1D\u8BD5"),W(Object(M.a)(ne)),me.onChange(ne),ve(qe),console.log("err:",qe)})}catch(qe){}}));case 19:case"end":return R.stop()}},et)}));return function(Ae,ct){return Ye.apply(this,arguments)}}();return Object(x.useEffect)(function(){ne.every(function(Ye){return Ye==="done"||Ye==="error"})&&me.onComplete(ne)},[ne]),Object(x.useEffect)(function(){if(_e){var Ye;(Ye=ee)===null||Ye===void 0||Ye.cancel()}},[_e]),Object(x.useEffect)(function(){me.uploading&&ne.map(function(){var Ye=Object(h.a)(I.a.mark(function et(Ae){var ct,$e;return I.a.wrap(function(Pe){for(;;)switch(Pe.prev=Pe.next){case 0:if(!((!Ae.status||Ae.status==="error")&&!_e)){Pe.next=6;break}return Ae.status="uploading",Ae.file.status="uploading",Pe.next=5,Le(Ae,{login:le==null||((ct=le.userInfo)===null||ct===void 0)?void 0:ct.login,container_type:me.container_type,container_id:me.container_id,description:me.description,realFileName:me.realFileName});case 5:$e=Pe.sent;case 6:case"end":return Pe.stop()}},et)}));return function(et){return Ye.apply(this,arguments)}}())},[me.uploading]),S.a.createElement(j,Object(y.a)({},De,{height:me.height,className:me.className}),S.a.createElement("p",{className:"ant-upload-hint"},me.text||"\u62D6\u62FD\u6587\u4EF6\u6216\u8005\u70B9\u51FB\u4E0A\u4F20"))};G.b=Object(K.a)(function(re){var pe=re.loading,le=re.globalSetting,_e=re.user;return{globalSetting:le,loading:pe.models.competitions,user:_e}})(Y)},KmYQ:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.pad.ZeroPadding={pad:function(d,F){var M=F*4;d.clamp(),d.sigBytes+=M-(d.sigBytes%M||M)},unpad:function(d){for(var F=d.words,M=d.sigBytes-1,M=d.sigBytes-1;M>=0;M--)if(F[M>>>2]>>>24-M%4*8&255){d.sigBytes=M+1;break}}},y.pad.ZeroPadding})},MlIO:function(l,G,N){(function(y,d){l.exports=G=d(N("Ib8C"))})(this,function(y){return function(d){var F=y,M=F.lib,D=M.Base,E=M.WordArray,g=F.x64={},h=g.Word=D.extend({init:function(p,v){this.high=p,this.low=v}}),b=g.WordArray=D.extend({init:function(p,v){p=this.words=p||[],v!=d?this.sigBytes=v:this.sigBytes=p.length*8},toX32:function(){for(var p=this.words,v=p.length,I=[],x=0;x<v;x++){var S=p[x];I.push(S.high),I.push(S.low)}return E.create(I,this.sigBytes)},clone:function(){for(var p=D.clone.call(this),v=p.words=this.words.slice(0),I=v.length,x=0;x<I;x++)v[x]=v[x].clone();return p}})}(),y})},NFKh:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("MlIO"),N("F+F2"),N("qM6L"),N("ETIr"),N("wbyO"),N("cv67"),N("3y9D"),N("lPiR"),N("GRuw"),N("1uat"),N("uGsb"),N("5hvy"),N("ELcG"),N("WYAk"),N("e7zE"),N("K3mO"),N("OLod"),N("ALsQ"),N("9OqN"),N("qu8F"),N("S6kV"),N("gb/T"),N("qBft"),N("oRuE"),N("jO9C"),N("KmYQ"),N("uGxW"),N("bQjk"),N("wZgz"),N("pA7S"),N("w7YG"),N("E4JC"),N("PVpz"))})(this,function(y){return y})},OLES:function(l,G,N){"use strict";var y=N("U8pU"),d=N("VTBJ"),F=N("Ff2n"),M=N("q1tI"),D=N("uciX"),E=N("7ixt"),g=function(x){var S=x.overlay,H=x.prefixCls,B=x.id,Q=x.overlayInnerStyle;return M.createElement("div",{className:"".concat(H,"-inner"),id:B,role:"tooltip",style:Q},typeof S=="function"?S():S)},h=g,b=function(x,S){var H=x.overlayClassName,B=x.trigger,Q=B===void 0?["hover"]:B,z=x.mouseEnterDelay,K=z===void 0?0:z,J=x.mouseLeaveDelay,U=J===void 0?.1:J,j=x.overlayStyle,T=x.prefixCls,te=T===void 0?"rc-tooltip":T,Z=x.children,_=x.onVisibleChange,Y=x.afterVisibleChange,re=x.transitionName,pe=x.animation,le=x.placement,_e=le===void 0?"right":le,me=x.align,ke=me===void 0?{}:me,$=x.destroyTooltipOnHide,ne=$===void 0?!1:$,W=x.defaultVisible,ie=x.getTooltipContainer,de=x.overlayInnerStyle,ee=Object(F.a)(x,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),Ce=Object(M.useRef)(null);Object(M.useImperativeHandle)(S,function(){return Ce.current});var De=Object(d.a)({},ee);"visible"in x&&(De.popupVisible=x.visible);var Le=function(){var $e=x.arrowContent,Fe=$e===void 0?null:$e,Pe=x.overlay,He=x.id;return[M.createElement("div",{className:"".concat(te,"-arrow"),key:"arrow"},Fe),M.createElement(h,{key:"content",prefixCls:te,id:He,overlay:Pe,overlayInnerStyle:de})]},Ye=!1,et=!1;if(typeof ne=="boolean")Ye=ne;else if(ne&&Object(y.a)(ne)==="object"){var Ae=ne.keepParent;Ye=Ae===!0,et=Ae===!1}return M.createElement(D.a,Object.assign({popupClassName:H,prefixCls:te,popup:Le,action:Q,builtinPlacements:E.a,popupPlacement:_e,ref:Ce,popupAlign:ke,getPopupContainer:ie,onPopupVisibleChange:_,afterPopupVisibleChange:Y,popupTransitionName:re,popupAnimation:pe,defaultPopupVisible:W,destroyPopupOnHide:Ye,autoDestroy:et,mouseLeaveDelay:U,popupStyle:j,mouseEnterDelay:K},De),Z)},p=Object(M.forwardRef)(b),v=G.a=p},OLod:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("K3mO"))})(this,function(y){y.lib.Cipher||function(d){var F=y,M=F.lib,D=M.Base,E=M.WordArray,g=M.BufferedBlockAlgorithm,h=F.enc,b=h.Utf8,p=h.Base64,v=F.algo,I=v.EvpKDF,x=M.Cipher=g.extend({cfg:D.extend(),createEncryptor:function(re,pe){return this.create(this._ENC_XFORM_MODE,re,pe)},createDecryptor:function(re,pe){return this.create(this._DEC_XFORM_MODE,re,pe)},init:function(re,pe,le){this.cfg=this.cfg.extend(le),this._xformMode=re,this._key=pe,this.reset()},reset:function(){g.reset.call(this),this._doReset()},process:function(re){return this._append(re),this._process()},finalize:function(re){re&&this._append(re);var pe=this._doFinalize();return pe},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function re(pe){return typeof pe=="string"?Y:te}return function(pe){return{encrypt:function(le,_e,me){return re(_e).encrypt(pe,le,_e,me)},decrypt:function(le,_e,me){return re(_e).decrypt(pe,le,_e,me)}}}}()}),S=M.StreamCipher=x.extend({_doFinalize:function(){var re=this._process(!0);return re},blockSize:1}),H=F.mode={},B=M.BlockCipherMode=D.extend({createEncryptor:function(re,pe){return this.Encryptor.create(re,pe)},createDecryptor:function(re,pe){return this.Decryptor.create(re,pe)},init:function(re,pe){this._cipher=re,this._iv=pe}}),Q=H.CBC=function(){var re=B.extend();re.Encryptor=re.extend({processBlock:function(le,_e){var me=this._cipher,ke=me.blockSize;pe.call(this,le,_e,ke),me.encryptBlock(le,_e),this._prevBlock=le.slice(_e,_e+ke)}}),re.Decryptor=re.extend({processBlock:function(le,_e){var me=this._cipher,ke=me.blockSize,$=le.slice(_e,_e+ke);me.decryptBlock(le,_e),pe.call(this,le,_e,ke),this._prevBlock=$}});function pe(le,_e,me){var ke,$=this._iv;$?(ke=$,this._iv=d):ke=this._prevBlock;for(var ne=0;ne<me;ne++)le[_e+ne]^=ke[ne]}return re}(),z=F.pad={},K=z.Pkcs7={pad:function(re,pe){for(var le=pe*4,_e=le-re.sigBytes%le,me=_e<<24|_e<<16|_e<<8|_e,ke=[],$=0;$<_e;$+=4)ke.push(me);var ne=E.create(ke,_e);re.concat(ne)},unpad:function(re){var pe=re.words[re.sigBytes-1>>>2]&255;re.sigBytes-=pe}},J=M.BlockCipher=x.extend({cfg:x.cfg.extend({mode:Q,padding:K}),reset:function(){var re;x.reset.call(this);var pe=this.cfg,le=pe.iv,_e=pe.mode;this._xformMode==this._ENC_XFORM_MODE?re=_e.createEncryptor:(re=_e.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==re?this._mode.init(this,le&&le.words):(this._mode=re.call(_e,this,le&&le.words),this._mode.__creator=re)},_doProcessBlock:function(re,pe){this._mode.processBlock(re,pe)},_doFinalize:function(){var re,pe=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(pe.pad(this._data,this.blockSize),re=this._process(!0)):(re=this._process(!0),pe.unpad(re)),re},blockSize:128/32}),U=M.CipherParams=D.extend({init:function(re){this.mixIn(re)},toString:function(re){return(re||this.formatter).stringify(this)}}),j=F.format={},T=j.OpenSSL={stringify:function(re){var pe,le=re.ciphertext,_e=re.salt;return _e?pe=E.create([1398893684,1701076831]).concat(_e).concat(le):pe=le,pe.toString(p)},parse:function(re){var pe,le=p.parse(re),_e=le.words;return _e[0]==1398893684&&_e[1]==1701076831&&(pe=E.create(_e.slice(2,4)),_e.splice(0,4),le.sigBytes-=16),U.create({ciphertext:le,salt:pe})}},te=M.SerializableCipher=D.extend({cfg:D.extend({format:T}),encrypt:function(re,pe,le,_e){_e=this.cfg.extend(_e);var me=re.createEncryptor(le,_e),ke=me.finalize(pe),$=me.cfg;return U.create({ciphertext:ke,key:le,iv:$.iv,algorithm:re,mode:$.mode,padding:$.padding,blockSize:re.blockSize,formatter:_e.format})},decrypt:function(re,pe,le,_e){_e=this.cfg.extend(_e),pe=this._parse(pe,_e.format);var me=re.createDecryptor(le,_e).finalize(pe.ciphertext);return me},_parse:function(re,pe){return typeof re=="string"?pe.parse(re,this):re}}),Z=F.kdf={},_=Z.OpenSSL={execute:function(re,pe,le,_e){_e||(_e=E.random(64/8));var me=I.create({keySize:pe+le}).compute(re,_e),ke=E.create(me.words.slice(pe),le*4);return me.sigBytes=pe*4,U.create({key:me,iv:ke,salt:_e})}},Y=M.PasswordBasedCipher=te.extend({cfg:te.cfg.extend({kdf:_}),encrypt:function(re,pe,le,_e){_e=this.cfg.extend(_e);var me=_e.kdf.execute(le,re.keySize,re.ivSize);_e.iv=me.iv;var ke=te.encrypt.call(this,re,pe,me.key,_e);return ke.mixIn(me),ke},decrypt:function(re,pe,le,_e){_e=this.cfg.extend(_e),pe=this._parse(pe,_e.format);var me=_e.kdf.execute(le,re.keySize,re.ivSize,pe.salt);_e.iv=me.iv;var ke=te.decrypt.call(this,re,pe,me.key,_e);return ke}})}()})},Og1z:function(l,G){(function(N){l.exports=function(){var y={887:function(){}},d={};function F(M){if(d[M])return d[M].exports;var D=d[M]={exports:{}},E=!0;try{y[M](D,D.exports,F),E=!1}finally{E&&delete d[M]}return D.exports}return F.ab=N+"/",F(887)}()}).call(this,"/")},PVpz:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("ETIr"),N("cv67"),N("K3mO"),N("OLod"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.StreamCipher,D=d.algo,E=[],g=[],h=[],b=D.RabbitLegacy=M.extend({_doReset:function(){var v=this._key.words,I=this.cfg.iv,x=this._X=[v[0],v[3]<<16|v[2]>>>16,v[1],v[0]<<16|v[3]>>>16,v[2],v[1]<<16|v[0]>>>16,v[3],v[2]<<16|v[1]>>>16],S=this._C=[v[2]<<16|v[2]>>>16,v[0]&4294901760|v[1]&65535,v[3]<<16|v[3]>>>16,v[1]&4294901760|v[2]&65535,v[0]<<16|v[0]>>>16,v[2]&4294901760|v[3]&65535,v[1]<<16|v[1]>>>16,v[3]&4294901760|v[0]&65535];this._b=0;for(var H=0;H<4;H++)p.call(this);for(var H=0;H<8;H++)S[H]^=x[H+4&7];if(I){var B=I.words,Q=B[0],z=B[1],K=(Q<<8|Q>>>24)&16711935|(Q<<24|Q>>>8)&4278255360,J=(z<<8|z>>>24)&16711935|(z<<24|z>>>8)&4278255360,U=K>>>16|J&4294901760,j=J<<16|K&65535;S[0]^=K,S[1]^=U,S[2]^=J,S[3]^=j,S[4]^=K,S[5]^=U,S[6]^=J,S[7]^=j;for(var H=0;H<4;H++)p.call(this)}},_doProcessBlock:function(v,I){var x=this._X;p.call(this),E[0]=x[0]^x[5]>>>16^x[3]<<16,E[1]=x[2]^x[7]>>>16^x[5]<<16,E[2]=x[4]^x[1]>>>16^x[7]<<16,E[3]=x[6]^x[3]>>>16^x[1]<<16;for(var S=0;S<4;S++)E[S]=(E[S]<<8|E[S]>>>24)&16711935|(E[S]<<24|E[S]>>>8)&4278255360,v[I+S]^=E[S]},blockSize:128/32,ivSize:64/32});function p(){for(var v=this._X,I=this._C,x=0;x<8;x++)g[x]=I[x];I[0]=I[0]+1295307597+this._b|0,I[1]=I[1]+3545052371+(I[0]>>>0<g[0]>>>0?1:0)|0,I[2]=I[2]+886263092+(I[1]>>>0<g[1]>>>0?1:0)|0,I[3]=I[3]+1295307597+(I[2]>>>0<g[2]>>>0?1:0)|0,I[4]=I[4]+3545052371+(I[3]>>>0<g[3]>>>0?1:0)|0,I[5]=I[5]+886263092+(I[4]>>>0<g[4]>>>0?1:0)|0,I[6]=I[6]+1295307597+(I[5]>>>0<g[5]>>>0?1:0)|0,I[7]=I[7]+3545052371+(I[6]>>>0<g[6]>>>0?1:0)|0,this._b=I[7]>>>0<g[7]>>>0?1:0;for(var x=0;x<8;x++){var S=v[x]+I[x],H=S&65535,B=S>>>16,Q=((H*H>>>17)+H*B>>>15)+B*B,z=((S&4294901760)*S|0)+((S&65535)*S|0);h[x]=Q^z}v[0]=h[0]+(h[7]<<16|h[7]>>>16)+(h[6]<<16|h[6]>>>16)|0,v[1]=h[1]+(h[0]<<8|h[0]>>>24)+h[7]|0,v[2]=h[2]+(h[1]<<16|h[1]>>>16)+(h[0]<<16|h[0]>>>16)|0,v[3]=h[3]+(h[2]<<8|h[2]>>>24)+h[1]|0,v[4]=h[4]+(h[3]<<16|h[3]>>>16)+(h[2]<<16|h[2]>>>16)|0,v[5]=h[5]+(h[4]<<8|h[4]>>>24)+h[3]|0,v[6]=h[6]+(h[5]<<16|h[5]>>>16)+(h[4]<<16|h[4]>>>16)|0,v[7]=h[7]+(h[6]<<8|h[6]>>>24)+h[5]|0}d.RabbitLegacy=M._createHelper(b)}(),y.RabbitLegacy})},"Re/O":function(l,G,N){"use strict";(function(y,d,F){N.d(G,"a",function(){return Dr}),N.d(G,"b",function(){return _n}),N.d(G,"c",function(){return qo}),N.d(G,"d",function(){return vl}),N.d(G,"e",function(){return qc}),N.d(G,"f",function(){return zp}),N.d(G,"g",function(){return Gc}),N.d(G,"h",function(){return hn}),N.d(G,"i",function(){return Na}),N.d(G,"j",function(){return ps}),N.d(G,"k",function(){return fs}),N.d(G,"l",function(){return Vc}),N.d(G,"m",function(){return On}),N.d(G,"n",function(){return ei}),N.d(G,"o",function(){return Nl}),N.d(G,"p",function(){return Up}),N.d(G,"q",function(){return yu}),N.d(G,"r",function(){return bl}),N.d(G,"s",function(){return ml}),N.d(G,"t",function(){return Qo}),N.d(G,"u",function(){return hu}),N.d(G,"v",function(){return Fn}),N.d(G,"w",function(){return bu}),N.d(G,"x",function(){return ba}),N.d(G,"y",function(){return Nt}),N.d(G,"z",function(){return fl}),N.d(G,"A",function(){return Kc}),N.d(G,"B",function(){return no}),N.d(G,"C",function(){return gl}),N.d(G,"D",function(){return zo}),N.d(G,"E",function(){return Ln}),N.d(G,"F",function(){return Ao}),N.d(G,"G",function(){return Ur}),N.d(G,"H",function(){return Qn}),N.d(G,"I",function(){return Zn}),N.d(G,"J",function(){return Za}),N.d(G,"K",function(){return kn}),N.d(G,"L",function(){return Rr}),N.d(G,"M",function(){return eo}),N.d(G,"N",function(){return Cl}),N.d(G,"O",function(){return xa}),N.d(G,"P",function(){return Tr});/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/var M=function(n,r){return(M=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(n,r)};function D(n,r){function e(){this.constructor=n}M(n,r),n.prototype=r===null?Object.create(r):(e.prototype=r.prototype,new e)}function E(n,r,e,t){return new(e||(e=Promise))(function(o,a){function i(f){try{u(t.next(f))}catch(C){a(C)}}function s(f){try{u(t.throw(f))}catch(C){a(C)}}function u(f){f.done?o(f.value):new e(function(C){C(f.value)}).then(i,s)}u((t=t.apply(n,r||[])).next())})}function g(n,r){var e,t,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(f){return function(C){if(e)throw new TypeError("Generator is already executing.");for(;i;)try{if(e=1,t&&(o=2&C[0]?t.return:C[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,C[1])).done)return o;switch(t=0,o&&(C=[2&C[0],o.value]),C[0]){case 0:case 1:o=C;break;case 4:return i.label++,{value:C[1],done:!1};case 5:i.label++,t=C[1],C=[0];continue;case 7:C=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(C[0]===6||C[0]===2)){i=0;continue}if(C[0]===3&&(!o||C[1]>o[0]&&C[1]<o[3])){i.label=C[1];break}if(C[0]===6&&i.label<o[1]){i.label=o[1],o=C;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(C);break}o[2]&&i.ops.pop(),i.trys.pop();continue}C=r.call(n,i)}catch(k){C=[6,k],t=0}finally{e=o=0}if(5&C[0])throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}([u,f])}}}var h=function(){function n(r){this.global=r,this.flags={},this.flagRegistry={},this.urlFlags={},this.populateURLFlags()}return n.prototype.setPlatform=function(r,e){this.platform!=null&&console.warn("Platform "+this.platformName+" has already been set. Overwriting the platform with "+e+"."),this.platformName=r,this.platform=e},n.prototype.registerFlag=function(r,e,t){if(this.flagRegistry[r]={evaluationFn:e,setHook:t},this.urlFlags[r]!=null){var o=this.urlFlags[r];console.warn("Setting feature override from URL "+r+": "+o+"."),this.set(r,o)}},n.prototype.get=function(r){return r in this.flags?this.flags[r]:(this.flags[r]=this.evaluateFlag(r),this.flags[r])},n.prototype.getNumber=function(r){return this.get(r)},n.prototype.getBool=function(r){return this.get(r)},n.prototype.getFlags=function(){return this.flags},Object.defineProperty(n.prototype,"features",{get:function(){return this.flags},enumerable:!0,configurable:!0}),n.prototype.set=function(r,e){if(this.flagRegistry[r]==null)throw new Error("Cannot set flag "+r+" as it has not been registered.");this.flags[r]=e,this.flagRegistry[r].setHook!=null&&this.flagRegistry[r].setHook(e)},n.prototype.evaluateFlag=function(r){if(this.flagRegistry[r]==null)throw new Error("Cannot evaluate flag '"+r+"': no evaluation function found.");return this.flagRegistry[r].evaluationFn()},n.prototype.setFlags=function(r){this.flags=Object.assign({},r)},n.prototype.reset=function(){this.flags={},this.urlFlags={},this.populateURLFlags()},n.prototype.populateURLFlags=function(){var r=this;if(this.global!==void 0&&this.global.location!==void 0&&this.global.location.search!==void 0){var e,t,o=(e=this.global.location.search,t={},e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,function(a){for(var i=[],s=1;s<arguments.length;s++)i[s-1]=arguments[s];return b(t,i[0],i[1]),i.join("=")}),t);"tfjsflags"in o&&o.tfjsflags.split(",").forEach(function(a){var i=a.split(":"),s=i[0],u=i[1];r.urlFlags[s]=function(f,C){if((C=C.toLowerCase())==="true"||C==="false")return C==="true";if(""+ +C===C)return+C;throw new Error("Could not parse value flag value "+C+" for flag "+f+".")}(s,u)})}},n}();function b(n,r,e){n[decodeURIComponent(r)]=decodeURIComponent(e||"")}function p(){return v}var v=null,I=new Map,x=new Map;function S(n,r){var e=U(n,r);return I.get(e)}function H(n){return x.get(n)}function B(n){for(var r=I.entries(),e=[];;){var t=r.next(),o=t.done,a=t.value;if(o)break;var i=a[0],s=a[1];i.split("_")[0]===n&&e.push(s)}return e}function Q(n){var r=n.kernelName,e=n.backendName,t=U(r,e);if(I.has(t))throw new Error("The kernel '"+r+"' for backend '"+e+"' is already registered");I.set(t,n)}function z(n){var r=n.kernelName;x.has(r)&&console.warn("Overriding the gradient for '"+r+"'"),x.set(r,n)}function K(n,r){var e=U(n,r);if(!I.has(e))throw new Error("The kernel '"+n+"' for backend '"+r+"' is not registered");I.delete(e)}function J(n){if(!x.has(n))throw new Error("The gradient '"+n+"' for backend is not registered");x.delete(n)}function U(n,r){return r+"_"+n}function j(n){for(var r=n.length,e=0,t=0;r>0;)t=Math.random()*r|0,e=n[--r],n[r]=n[t],n[t]=e}function T(n,r,e){return Math.max(n,Math.min(r,e))}function te(n){return n%2==0?n:n+1}function Z(n){for(var r=0,e=0;e<n.length;e++)r+=n[e];return r}function _(n,r){if(!n)throw new Error(typeof r=="string"?r:r())}function Y(n,r,e){e===void 0&&(e=""),_(_e(n,r),function(){return e+" Shapes "+n+" and "+r+" must match"})}function re(n){_(n!=null,function(){return"The input to the tensor constructor must be a non-null value."})}function pe(n,r,e){if(r===void 0&&(r=[]),e===void 0&&(e=!1),r==null&&(r=[]),Array.isArray(n)||Ae(n)&&!e)for(var t=0;t<n.length;++t)pe(n[t],r,e);else r.push(n);return r}function le(n){if(n.length===0)return 1;for(var r=n[0],e=1;e<n.length;e++)r*=n[e];return r}function _e(n,r){if(n===r)return!0;if(n==null||r==null)return!1;if(n.length!==r.length)return!1;for(var e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}function me(n){return n%1==0}function ke(n){if(Math.tanh!=null)return Math.tanh(n);if(n===1/0)return 1;if(n===-1/0)return-1;var r=Math.exp(2*n);return(r-1)/(r+1)}function $(n){var r=Math.ceil(Math.sqrt(n));return[r,Math.ceil(n/r)]}function ne(n,r){return r<=n.length?n:n+" ".repeat(r-n.length)}function W(n,r,e){return r===void 0&&(r=function(t){return 0}),new Promise(function(t,o){var a=0,i=function(){if(n())t();else{a++;var s=r(a);e!=null&&a>=e?o():setTimeout(i,s)}};i()})}function ie(n,r){for(var e=1,t=-1,o=0;o<n.length;++o)if(n[o]>=0)e*=n[o];else if(n[o]===-1){if(t!==-1)throw Error("Shapes can only have 1 implicit size. Found -1 at dim "+t+" and dim "+o);t=o}else if(n[o]<0)throw Error("Shapes can not be < 0. Found "+n[o]+" at dim "+o);if(t===-1){if(r>0&&r!==e)throw Error("Size("+r+") must match the product of shape "+n);return n}if(e===0)throw Error("Cannot infer the missing size in ["+n+"] when there are 0 elements");if(r%e!=0)throw Error("The implicit shape can't be a fractional number. Got "+r+" / "+e);var a=n.slice();return a[t]=r/e,a}function de(n,r){var e=r.length;return _((n=n==null?r.map(function(t,o){return o}):[].concat(n)).every(function(t){return t>=-e&&t<e}),function(){return"All values in axis param must be in range [-"+e+", "+e+") but got axis "+n}),_(n.every(function(t){return me(t)}),function(){return"All values in axis param must be integers but got axis "+n}),n.map(function(t){return t<0?e+t:t})}function ee(n,r){for(var e=[],t=[],o=r!=null&&Array.isArray(r)&&r.length===0,a=r==null||o?null:de(r,n).sort(),i=0,s=0;s<n.length;++s){if(a!=null){if(a[i]===s&&n[s]!==1)throw new Error("Can't squeeze axis "+s+" since its dim '"+n[s]+"' is not 1");(a[i]==null||a[i]>s)&&n[s]===1&&(e.push(n[s]),t.push(s)),a[i]<=s&&i++}n[s]!==1&&(e.push(n[s]),t.push(s))}return{newShape:e,keptDims:t}}function Ce(n,r){var e=null;if(n==null||n==="float32")e=new Float32Array(r);else if(n==="int32")e=new Int32Array(r);else{if(n!=="bool")throw new Error("Unknown data type "+n);e=new Uint8Array(r)}return e}function De(n,r){var e=null;if(n==null||n==="float32")e=new Float32Array(r);else if(n==="int32")e=new Int32Array(r);else if(n==="bool")e=new Uint8Array(r);else{if(n!=="string")throw new Error("Unknown data type "+n);e=new Array(r)}return e}function Le(n,r){for(var e=0;e<n.length;e++){var t=n[e];if(isNaN(t)||!isFinite(t))throw Error("A tensor of type "+r+" being uploaded contains "+t+".")}}function Ye(n){return n==="bool"||n==="complex64"||n==="float32"||n==="int32"||n==="string"}function et(n,r){return r!=="complex64"&&((r!=="float32"||n==="complex64")&&(r!=="int32"||n==="float32"||n==="complex64"))&&(r!=="bool"||n!=="bool")}function Ae(n){return n instanceof Float32Array||n instanceof Int32Array||n instanceof Uint8Array}function ct(n){if(n==="float32"||n==="int32")return 4;if(n==="complex64")return 8;if(n==="bool")return 1;throw new Error("Unknown dtype "+n)}function $e(n){if(n==null)return 0;var r=0;return n.forEach(function(e){return r+=e.length}),r}function Fe(n){return typeof n=="string"||n instanceof String}function Pe(n){return typeof n=="boolean"}function He(n){return typeof n=="number"}function ot(n){return Array.isArray(n)?ot(n[0]):n instanceof Float32Array?"float32":n instanceof Int32Array||n instanceof Uint8Array?"int32":He(n)?"float32":Fe(n)?"string":Pe(n)?"bool":"float32"}function ye(n){return!!(n&&n.constructor&&n.call&&n.apply)}function be(n,r){for(var e=r;e<n;++e)if(n%e==0)return e;return n}function Ke(n){var r=n.length;if(r<2)return[];var e=new Array(r-1);e[r-2]=n[r-1];for(var t=r-3;t>=0;--t)e[t]=e[t+1]*n[t+1];return e}function q(n,r,e){if(r==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(n)&&(n=pe(n)),e&&Le(n,r),function(a,i){return a instanceof Float32Array&&i==="float32"||a instanceof Int32Array&&i==="int32"||a instanceof Uint8Array&&i==="bool"}(n,r))return n;if(r==null||r==="float32"||r==="complex64")return new Float32Array(n);if(r==="int32")return new Int32Array(n);if(r==="bool"){for(var t=new Uint8Array(n.length),o=0;o<t.length;++o)Math.round(n[o])!==0&&(t[o]=1);return t}throw new Error("Unknown data type "+r)}function m(n,r){if(n.length===0)return r[0];var e=n.reduce(function(t,o){return t*o});if(e===0)return[];if(e!==r.length)throw new Error("["+n+"] does not match the input size.");return function t(o,a,i){var s=new Array;if(a.length===1)for(var u=a[0],f=0;f<u;f++)s[f]=i[o+f];else{u=a[0];var C=a.slice(1),k=C.reduce(function(L,X){return L*X});for(f=0;f<u;f++)s[f]=t(o+f*k,C,i)}return s}(0,n,r)}function c(n,r){for(var e=R(n,r),t=0;t<e.length;t++)e[t]=1;return e}function R(n,r){if(r==null||r==="float32"||r==="complex64")return new Float32Array(n);if(r==="int32")return new Int32Array(n);if(r==="bool")return new Uint8Array(n);throw new Error("Unknown data type "+r)}function fe(){return p().platform.now()}function ve(n){n.forEach(function(r){_(Number.isInteger(r)&&r>=0,function(){return"Tensor must have a shape comprised of positive integers but got shape ["+n+"]."})})}function Re(n,r){return r===void 0&&(r="utf-8"),r=r||"utf-8",p().platform.encode(n,r)}function qe(n,r){return r===void 0&&(r="utf-8"),r=r||"utf-8",p().platform.decode(n,r)}function nt(n,r,e){if(r===0)return 0;if(r===1)return n[0];for(var t=n[n.length-1],o=0;o<n.length-1;++o)t+=e[o]*n[o];return t}function st(n,r,e){if(r===0)return[];if(r===1)return[n];for(var t=new Array(r),o=0;o<t.length-1;++o)t[o]=Math.floor(n/e[o]),n-=t[o]*e[o];return t[t.length-1]=n,t}var bt=Object.freeze({shuffle:j,clamp:T,nearestLargerEven:te,sum:Z,randUniform:function(n,r){var e=Math.random();return r*e+(1-e)*n},distSquared:function(n,r){for(var e=0,t=0;t<n.length;t++){var o=Number(n[t])-Number(r[t]);e+=o*o}return e},assert:_,assertShapesMatch:Y,assertNonNull:re,flatten:pe,sizeFromShape:le,isScalarShape:function(n){return n.length===0},arraysEqual:_e,isInt:me,tanh:ke,sizeToSquarishShape:$,createShuffledIndices:function(n){for(var r=new Uint32Array(n),e=0;e<n;++e)r[e]=e;return j(r),r},rightPad:ne,repeatedTry:W,inferFromImplicitShape:ie,parseAxisParam:de,squeezeShape:ee,getTypedArrayFromDType:Ce,getArrayFromDType:De,checkConversionForErrors:Le,isValidDtype:Ye,hasEncodingLoss:et,isTypedArray:Ae,bytesPerElement:ct,bytesFromStringArray:$e,isString:Fe,isBoolean:Pe,isNumber:He,inferDtype:ot,isFunction:ye,nearestDivisor:be,computeStrides:Ke,toTypedArray:q,toNestedArray:m,makeOnesTypedArray:c,makeZerosTypedArray:R,now:fe,assertNonNegativeIntegerDimensions:ve,fetch:function(n,r){return p().platform.fetch(n,r)},encodeString:Re,decodeString:qe,locToIndex:nt,indexToLoc:st}),dt=function(){function n(r,e){this.backendTimer=r,this.logger=e,e==null&&(this.logger=new Et)}return n.prototype.profileKernel=function(r,e,t){var o,a=this,i=this.backendTimer.time(function(){o=t()});return o.forEach(function(s){s.data().then(function(u){!function(f,C,k){if(C!=="float32")return!1;for(var L=0;L<f.length;L++){var X=f[L];if(isNaN(X)||!isFinite(X))return console.warn("Found "+X+" in the result of '"+k+"'"),!0}}(u,s.dtype,r),i.then(function(f){var C="";f.getExtraProfileInfo!=null&&(C=f.getExtraProfileInfo()),a.logger.logKernelProfile(r,s,u,f.kernelMs,e,C)})})}),o},n}(),Et=function(){function n(){}return n.prototype.logKernelProfile=function(r,e,t,o,a,i){var s=typeof o=="number"?ne(o+"ms",9):o.error,u=ne(r,25),f=e.rank,C=e.size,k=ne(e.shape.toString(),14),L="";for(var X in a){var oe=a[X].shape||e.shape,ue=oe.length;L+=X+": "+ue+"D "+(ue>0?oe:"")+" "}console.log("%c"+u+" %c"+s+" %c"+f+"D "+k+" %c"+C+" %c"+L+" %c"+i,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")},n}(),It=20,at=3,Bt=7;function mr(n,r,e,t){var o=Ke(r),a=function(f,C,k,L){var X=le(C),oe=L[L.length-1],ue=new Array(oe).fill(0),se=C.length,ce=k==="complex64"?Fr(f):f;if(se>1)for(var xe=0;xe<X/oe;xe++)for(var we=xe*oe,Ee=0;Ee<oe;Ee++)ue[Ee]=Math.max(ue[Ee],rr(ce[we+Ee],0,k).length);return ue}(n,r,e,o),i=r.length,s=function f(C,k,L,X,oe,ue){ue===void 0&&(ue=!0);var se=L==="complex64"?2:1,ce=k[0],xe=k.length;if(xe===0)return L==="complex64"?[rr(Fr(C)[0],0,L)]:L==="bool"?[Sr(C[0])]:[C[0].toString()];if(xe===1){if(ce>It){var we=at*se,Ee=Array.from(C.slice(0,we)),Se=Array.from(C.slice((ce-at)*se,ce*se));return L==="complex64"&&(Ee=Fr(Ee),Se=Fr(Se)),["["+Ee.map(function(ut,vt){return rr(ut,oe[vt],L)}).join(", ")+", ..., "+Se.map(function(ut,vt){return rr(ut,oe[ce-at+vt],L)}).join(", ")+"]"]}return["["+(L==="complex64"?Fr(C):Array.from(C)).map(function(ut,vt){return rr(ut,oe[vt],L)}).join(", ")+"]"]}var Me=k.slice(1),ze=X.slice(1),Be=X[0]*se,je=[];if(ce>It){for(var Ue=0;Ue<at;Ue++){var Ze=(Je=Ue*Be)+Be;je.push.apply(je,f(C.slice(Je,Ze),Me,L,ze,oe,!1))}for(je.push("..."),Ue=ce-at;Ue<ce;Ue++)Ze=(Je=Ue*Be)+Be,je.push.apply(je,f(C.slice(Je,Ze),Me,L,ze,oe,Ue===ce-1))}else for(Ue=0;Ue<ce;Ue++){var Je;Ze=(Je=Ue*Be)+Be,je.push.apply(je,f(C.slice(Je,Ze),Me,L,ze,oe,Ue===ce-1))}var ht=xe===2?",":"";for(je[0]="["+je[0]+ht,Ue=1;Ue<je.length-1;Ue++)je[Ue]=" "+je[Ue]+ht;var ft=`,
`;for(Ue=2;Ue<xe;Ue++)ft+=`
`;return je[je.length-1]=" "+je[je.length-1]+"]"+(ue?"":ft),je}(n,r,e,o,a),u=["Tensor"];return t&&(u.push(" dtype: "+e),u.push(" rank: "+i),u.push(" shape: ["+r+"]"),u.push(" values:")),u.push(s.map(function(f){return" "+f}).join(`
`)),u.join(`
`)}function rr(n,r,e){return ne(Array.isArray(n)?parseFloat(n[0].toFixed(Bt))+" + "+parseFloat(n[1].toFixed(Bt))+"j":Fe(n)?"'"+n+"'":e==="bool"?Sr(n):parseFloat(n.toFixed(Bt)).toString(),r)}function Sr(n){return n===0?"false":"true"}function Fr(n){for(var r=[],e=0;e<n.length;e+=2)r.push([n[e],n[e+1]]);return r}var Nr=function(){function n(r,e,t){var o=this;if(this.dtype=e,this.shape=r.slice(),this.size=le(r),t!=null){var a=t.length;_(a===this.size,function(){return"Length of values '"+a+"' does not match the size inferred by the shape '"+o.size+"'."})}if(e==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=t||De(e,this.size),this.strides=Ke(r)}return n.prototype.set=function(r){for(var e=this,t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];t.length===0&&(t=[0]),_(t.length===this.rank,function(){return"The number of provided coordinates ("+t.length+") must match the rank ("+e.rank+")"});var a=this.locToIndex(t);this.values[a]=r},n.prototype.get=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];r.length===0&&(r=[0]);for(var t=0,o=0,a=r;o<a.length;o++){var i=a[o];if(i<0||i>=this.shape[t]){var s="Requested out of range element at "+r+". Buffer shape="+this.shape;throw new Error(s)}t++}for(var u=r[r.length-1],f=0;f<r.length-1;++f)u+=this.strides[f]*r[f];return this.values[u]},n.prototype.locToIndex=function(r){if(this.rank===0)return 0;if(this.rank===1)return r[0];for(var e=r[r.length-1],t=0;t<r.length-1;++t)e+=this.strides[t]*r[t];return e},n.prototype.indexToLoc=function(r){if(this.rank===0)return[];if(this.rank===1)return[r];for(var e=new Array(this.shape.length),t=0;t<e.length-1;++t)e[t]=Math.floor(r/this.strides[t]),r-=e[t]*this.strides[t];return e[e.length-1]=r,e},Object.defineProperty(n.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),n.prototype.toTensor=function(){return Ar().makeTensor(this.values,this.shape,this.dtype)},n}(),Ar=null,tt=null,Xn=null,Dr=function(){function n(r,e,t,o){this.kept=!1,this.isDisposedInternal=!1,this.shape=r.slice(),this.dtype=e||"float32",this.size=le(r),this.strides=Ke(r),this.dataId=t,this.id=o,this.rankType=this.rank<5?this.rank.toString():"higher"}return n.prototype.flatten=function(){return this.throwIfDisposed(),this.as1D()},n.prototype.asScalar=function(){return this.throwIfDisposed(),_(this.size===1,function(){return"The array must have only 1 element."}),this.reshape([])},n.prototype.as1D=function(){return this.throwIfDisposed(),this.reshape([this.size])},n.prototype.as2D=function(r,e){return this.throwIfDisposed(),this.reshape([r,e])},n.prototype.as3D=function(r,e,t){return this.throwIfDisposed(),this.reshape([r,e,t])},n.prototype.as4D=function(r,e,t,o){return this.throwIfDisposed(),this.reshape([r,e,t,o])},n.prototype.as5D=function(r,e,t,o,a){return this.throwIfDisposed(),this.reshape([r,e,t,o,a])},n.prototype.asType=function(r){return this.throwIfDisposed(),tt.cast(this,r)},Object.defineProperty(n.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),n.prototype.buffer=function(){return E(this,void 0,void 0,function(){var r;return g(this,function(e){switch(e.label){case 0:return[4,this.data()];case 1:return r=e.sent(),[2,tt.buffer(this.shape,this.dtype,r)]}})})},n.prototype.bufferSync=function(){return tt.buffer(this.shape,this.dtype,this.dataSync())},n.prototype.array=function(){return E(this,void 0,void 0,function(){var r;return g(this,function(e){switch(e.label){case 0:return[4,this.data()];case 1:return r=e.sent(),[2,m(this.shape,r)]}})})},n.prototype.arraySync=function(){return m(this.shape,this.dataSync())},n.prototype.data=function(){return E(this,void 0,void 0,function(){var r,e;return g(this,function(t){switch(t.label){case 0:return this.throwIfDisposed(),r=Ar().read(this.dataId),this.dtype!=="string"?[3,2]:[4,r];case 1:e=t.sent();try{return[2,e.map(function(o){return qe(o)})]}catch(o){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}t.label=2;case 2:return[2,r]}})})},n.prototype.dataSync=function(){this.throwIfDisposed();var r=Ar().readSync(this.dataId);if(this.dtype==="string")try{return r.map(function(e){return qe(e)})}catch(e){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return r},n.prototype.bytes=function(){return E(this,void 0,void 0,function(){var r;return g(this,function(e){switch(e.label){case 0:return this.throwIfDisposed(),[4,Ar().read(this.dataId)];case 1:return r=e.sent(),this.dtype==="string"?[2,r]:[2,new Uint8Array(r.buffer)]}})})},n.prototype.dispose=function(){this.isDisposed||(Ar().disposeTensor(this),this.isDisposedInternal=!0)},Object.defineProperty(n.prototype,"isDisposed",{get:function(){return this.isDisposedInternal},enumerable:!0,configurable:!0}),n.prototype.throwIfDisposed=function(){if(this.isDisposed)throw new Error("Tensor is disposed.")},n.prototype.toFloat=function(){return this.asType("float32")},n.prototype.toInt=function(){return this.asType("int32")},n.prototype.toBool=function(){return this.asType("bool")},n.prototype.print=function(r){return r===void 0&&(r=!1),tt.print(this,r)},n.prototype.reshape=function(r){return this.throwIfDisposed(),tt.reshape(this,r)},n.prototype.reshapeAs=function(r){return this.throwIfDisposed(),this.reshape(r.shape)},n.prototype.expandDims=function(r){return r===void 0&&(r=0),tt.expandDims(this,r)},n.prototype.cumsum=function(r,e,t){return r===void 0&&(r=0),e===void 0&&(e=!1),t===void 0&&(t=!1),tt.cumsum(this,r,e,t)},n.prototype.squeeze=function(r){return this.throwIfDisposed(),tt.squeeze(this,r)},n.prototype.clone=function(){return this.throwIfDisposed(),tt.clone(this)},n.prototype.oneHot=function(r,e,t){return this.throwIfDisposed(),tt.oneHot(this,r,e,t)},n.prototype.toString=function(r){return r===void 0&&(r=!1),mr(this.dataSync(),this.shape,this.dtype,r)},n.prototype.tile=function(r){return this.throwIfDisposed(),tt.tile(this,r)},n.prototype.gather=function(r,e){return e===void 0&&(e=0),this.throwIfDisposed(),tt.gather(this,r,e)},n.prototype.matMul=function(r,e,t){return e===void 0&&(e=!1),t===void 0&&(t=!1),this.throwIfDisposed(),tt.matMul(this,r,e,t)},n.prototype.dot=function(r){return this.throwIfDisposed(),tt.dot(this,r)},n.prototype.norm=function(r,e,t){return r===void 0&&(r="euclidean"),e===void 0&&(e=null),t===void 0&&(t=!1),this.throwIfDisposed(),tt.norm(this,r,e,t)},n.prototype.slice=function(r,e){return this.throwIfDisposed(),tt.slice(this,r,e)},n.prototype.reverse=function(r){return this.throwIfDisposed(),tt.reverse(this,r)},n.prototype.concat=function(r,e){return e===void 0&&(e=0),this.throwIfDisposed(),r instanceof n&&(r=[r]),tt.concat([this].concat(r),e)},n.prototype.split=function(r,e){return e===void 0&&(e=0),this.throwIfDisposed(),tt.split(this,r,e)},n.prototype.stack=function(r,e){return e===void 0&&(e=0),tt.stack([this,r],e)},n.prototype.unstack=function(r){return r===void 0&&(r=0),tt.unstack(this,r)},n.prototype.pad=function(r,e){return e===void 0&&(e=0),tt.pad(this,r,e)},n.prototype.batchNormalization=function(r,e,t,o,a){return t===void 0&&(t=.001),Xn("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon"),this.batchNorm(r,e,a,o,t)},n.prototype.batchNorm=function(r,e,t,o,a){return a===void 0&&(a=.001),this.throwIfDisposed(),tt.batchNorm(this,r,e,t,o,a)},n.prototype.all=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),tt.all(this,r,e)},n.prototype.any=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),tt.any(this,r,e)},n.prototype.logSumExp=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),tt.logSumExp(this,r,e)},n.prototype.sum=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),tt.sum(this,r,e)},n.prototype.prod=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),tt.prod(this,r,e)},n.prototype.mean=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),tt.mean(this,r,e)},n.prototype.min=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),tt.min(this,r,e)},n.prototype.max=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),tt.max(this,r,e)},n.prototype.argMin=function(r){return r===void 0&&(r=null),this.throwIfDisposed(),tt.argMin(this,r)},n.prototype.argMax=function(r){return r===void 0&&(r=null),this.throwIfDisposed(),tt.argMax(this,r)},n.prototype.cast=function(r){return this.throwIfDisposed(),tt.cast(this,r)},n.prototype.add=function(r){return this.throwIfDisposed(),tt.add(this,r)},n.prototype.addStrict=function(r){return this.throwIfDisposed(),tt.addStrict(this,r)},n.prototype.atan2=function(r){return this.throwIfDisposed(),tt.atan2(this,r)},n.prototype.sub=function(r){return this.throwIfDisposed(),tt.sub(this,r)},n.prototype.subStrict=function(r){return this.throwIfDisposed(),tt.subStrict(this,r)},n.prototype.pow=function(r){return this.throwIfDisposed(),tt.pow(this,r)},n.prototype.powStrict=function(r){return this.throwIfDisposed(),tt.powStrict(this,r)},n.prototype.mul=function(r){return this.throwIfDisposed(),tt.mul(this,r)},n.prototype.mulStrict=function(r){return this.throwIfDisposed(),tt.mulStrict(this,r)},n.prototype.div=function(r){return this.throwIfDisposed(),tt.div(this,r)},n.prototype.divNoNan=function(r){return this.throwIfDisposed(),tt.divNoNan(this,r)},n.prototype.floorDiv=function(r){return this.throwIfDisposed(),tt.floorDiv(this,r)},n.prototype.divStrict=function(r){return this.throwIfDisposed(),tt.divStrict(this,r)},n.prototype.minimum=function(r){return this.throwIfDisposed(),tt.minimum(this,r)},n.prototype.minimumStrict=function(r){return this.throwIfDisposed(),tt.minimumStrict(this,r)},n.prototype.maximum=function(r){return this.throwIfDisposed(),tt.maximum(this,r)},n.prototype.maximumStrict=function(r){return this.throwIfDisposed(),tt.maximumStrict(this,r)},n.prototype.mod=function(r){return this.throwIfDisposed(),tt.mod(this,r)},n.prototype.modStrict=function(r){return this.throwIfDisposed(),tt.modStrict(this,r)},n.prototype.squaredDifferenceStrict=function(r){return this.throwIfDisposed(),tt.squaredDifferenceStrict(this,r)},n.prototype.transpose=function(r){return this.throwIfDisposed(),tt.transpose(this,r)},n.prototype.notEqual=function(r){return this.throwIfDisposed(),tt.notEqual(this,r)},n.prototype.notEqualStrict=function(r){return this.throwIfDisposed(),tt.notEqualStrict(this,r)},n.prototype.less=function(r){return this.throwIfDisposed(),tt.less(this,r)},n.prototype.lessStrict=function(r){return this.throwIfDisposed(),tt.lessStrict(this,r)},n.prototype.equal=function(r){return this.throwIfDisposed(),tt.equal(this,r)},n.prototype.equalStrict=function(r){return this.throwIfDisposed(),tt.equalStrict(this,r)},n.prototype.lessEqual=function(r){return this.throwIfDisposed(),tt.lessEqual(this,r)},n.prototype.lessEqualStrict=function(r){return this.throwIfDisposed(),tt.lessEqualStrict(this,r)},n.prototype.greater=function(r){return this.throwIfDisposed(),tt.greater(this,r)},n.prototype.greaterStrict=function(r){return this.throwIfDisposed(),tt.greaterStrict(this,r)},n.prototype.greaterEqual=function(r){return this.throwIfDisposed(),tt.greaterEqual(this,r)},n.prototype.greaterEqualStrict=function(r){return this.throwIfDisposed(),tt.greaterEqualStrict(this,r)},n.prototype.logicalAnd=function(r){return this.throwIfDisposed(),tt.logicalAnd(this,r)},n.prototype.logicalOr=function(r){return this.throwIfDisposed(),tt.logicalOr(this,r)},n.prototype.logicalNot=function(){return this.throwIfDisposed(),tt.logicalNot(this)},n.prototype.logicalXor=function(r){return this.throwIfDisposed(),tt.logicalXor(this,r)},n.prototype.where=function(r,e){return this.throwIfDisposed(),tt.where(r,this,e)},n.prototype.neg=function(){return this.throwIfDisposed(),tt.neg(this)},n.prototype.ceil=function(){return this.throwIfDisposed(),tt.ceil(this)},n.prototype.floor=function(){return this.throwIfDisposed(),tt.floor(this)},n.prototype.sign=function(){return this.throwIfDisposed(),tt.sign(this)},n.prototype.isNaN=function(){return this.throwIfDisposed(),tt.isNaN(this)},n.prototype.isInf=function(){return this.throwIfDisposed(),tt.isInf(this)},n.prototype.isFinite=function(){return this.throwIfDisposed(),tt.isFinite(this)},n.prototype.exp=function(){return this.throwIfDisposed(),tt.exp(this)},n.prototype.expm1=function(){return this.throwIfDisposed(),tt.expm1(this)},n.prototype.log=function(){return this.throwIfDisposed(),tt.log(this)},n.prototype.log1p=function(){return this.throwIfDisposed(),tt.log1p(this)},n.prototype.sqrt=function(){return this.throwIfDisposed(),tt.sqrt(this)},n.prototype.rsqrt=function(){return this.throwIfDisposed(),tt.rsqrt(this)},n.prototype.square=function(){return this.throwIfDisposed(),tt.square(this)},n.prototype.reciprocal=function(){return this.throwIfDisposed(),tt.reciprocal(this)},n.prototype.abs=function(){return this.throwIfDisposed(),tt.abs(this)},n.prototype.clipByValue=function(r,e){return this.throwIfDisposed(),tt.clipByValue(this,r,e)},n.prototype.relu=function(){return this.throwIfDisposed(),tt.relu(this)},n.prototype.relu6=function(){return this.throwIfDisposed(),tt.relu6(this)},n.prototype.elu=function(){return this.throwIfDisposed(),tt.elu(this)},n.prototype.selu=function(){return this.throwIfDisposed(),tt.selu(this)},n.prototype.leakyRelu=function(r){return r===void 0&&(r=.2),this.throwIfDisposed(),tt.leakyRelu(this,r)},n.prototype.prelu=function(r){return this.throwIfDisposed(),tt.prelu(this,r)},n.prototype.sigmoid=function(){return this.throwIfDisposed(),tt.sigmoid(this)},n.prototype.logSigmoid=function(){return this.throwIfDisposed(),tt.logSigmoid(this)},n.prototype.softplus=function(){return this.throwIfDisposed(),tt.softplus(this)},n.prototype.zerosLike=function(){return this.throwIfDisposed(),tt.zerosLike(this)},n.prototype.onesLike=function(){return this.throwIfDisposed(),tt.onesLike(this)},n.prototype.sin=function(){return this.throwIfDisposed(),tt.sin(this)},n.prototype.cos=function(){return this.throwIfDisposed(),tt.cos(this)},n.prototype.tan=function(){return this.throwIfDisposed(),tt.tan(this)},n.prototype.asin=function(){return this.throwIfDisposed(),tt.asin(this)},n.prototype.acos=function(){return this.throwIfDisposed(),tt.acos(this)},n.prototype.atan=function(){return this.throwIfDisposed(),tt.atan(this)},n.prototype.sinh=function(){return this.throwIfDisposed(),tt.sinh(this)},n.prototype.cosh=function(){return this.throwIfDisposed(),tt.cosh(this)},n.prototype.tanh=function(){return this.throwIfDisposed(),tt.tanh(this)},n.prototype.asinh=function(){return this.throwIfDisposed(),tt.asinh(this)},n.prototype.acosh=function(){return this.throwIfDisposed(),tt.acosh(this)},n.prototype.atanh=function(){return this.throwIfDisposed(),tt.atanh(this)},n.prototype.erf=function(){return this.throwIfDisposed(),tt.erf(this)},n.prototype.round=function(){return this.throwIfDisposed(),tt.round(this)},n.prototype.step=function(r){return r===void 0&&(r=0),this.throwIfDisposed(),tt.step(this,r)},n.prototype.softmax=function(r){return r===void 0&&(r=-1),this.throwIfDisposed(),tt.softmax(this,r)},n.prototype.logSoftmax=function(r){return r===void 0&&(r=-1),this.throwIfDisposed(),tt.logSoftmax(this,r)},n.prototype.resizeBilinear=function(r,e){return e===void 0&&(e=!1),this.throwIfDisposed(),tt.image.resizeBilinear(this,r,e)},n.prototype.resizeNearestNeighbor=function(r,e){return e===void 0&&(e=!1),this.throwIfDisposed(),tt.image.resizeNearestNeighbor(this,r,e)},n.prototype.conv1d=function(r,e,t,o,a,i){return o===void 0&&(o="NWC"),a===void 0&&(a=1),this.throwIfDisposed(),tt.conv1d(this,r,e,t,o,a,i)},n.prototype.conv2d=function(r,e,t,o,a,i){return o===void 0&&(o="NHWC"),a===void 0&&(a=[1,1]),this.throwIfDisposed(),tt.conv2d(this,r,e,t,o,a,i)},n.prototype.conv2dTranspose=function(r,e,t,o,a){return this.throwIfDisposed(),tt.conv2dTranspose(this,r,e,t,o,a)},n.prototype.depthwiseConv2D=function(r,e,t,o,a,i){return o===void 0&&(o="NHWC"),a===void 0&&(a=[1,1]),this.throwIfDisposed(),tt.depthwiseConv2d(this,r,e,t,o,a,i)},n.prototype.separableConv2d=function(r,e,t,o,a,i){return a===void 0&&(a=[1,1]),i===void 0&&(i="NHWC"),this.throwIfDisposed(),tt.separableConv2d(this,r,e,t,o,a,i)},n.prototype.avgPool=function(r,e,t,o){return this.throwIfDisposed(),tt.avgPool(this,r,e,t,o)},n.prototype.maxPool=function(r,e,t,o){return this.throwIfDisposed(),tt.maxPool(this,r,e,t,o)},n.prototype.localResponseNormalization=function(r,e,t,o){return r===void 0&&(r=5),e===void 0&&(e=1),t===void 0&&(t=1),o===void 0&&(o=.5),tt.localResponseNormalization(this,r,e,t,o)},n.prototype.pool=function(r,e,t,o,a){return this.throwIfDisposed(),tt.pool(this,r,e,t,o,a)},n.prototype.variable=function(r,e,t){return r===void 0&&(r=!0),this.throwIfDisposed(),Ar().makeVariable(this,r,e,t)},n.prototype.unsortedSegmentSum=function(r,e){return this.throwIfDisposed(),tt.unsortedSegmentSum(this,r,e)},n.prototype.batchToSpaceND=function(r,e){return this.throwIfDisposed(),tt.batchToSpaceND(this,r,e)},n.prototype.spaceToBatchND=function(r,e){return this.throwIfDisposed(),tt.spaceToBatchND(this,r,e)},n.prototype.topk=function(r,e){return r===void 0&&(r=1),e===void 0&&(e=!0),this.throwIfDisposed(),tt.topk(this,r,e)},n.prototype.stridedSlice=function(r,e,t,o,a,i,s,u){return o===void 0&&(o=0),a===void 0&&(a=0),i===void 0&&(i=0),s===void 0&&(s=0),u===void 0&&(u=0),this.throwIfDisposed(),tt.stridedSlice(this,r,e,t,o,a,i,s,u)},n.prototype.depthToSpace=function(r,e){return this.throwIfDisposed(),tt.depthToSpace(this,r,e)},n.prototype.fft=function(){return this.throwIfDisposed(),tt.spectral.fft(this)},n.prototype.ifft=function(){return this.throwIfDisposed(),tt.spectral.ifft(this)},n.prototype.rfft=function(){return this.throwIfDisposed(),tt.spectral.rfft(this)},n.prototype.irfft=function(){return this.throwIfDisposed(),tt.spectral.irfft(this)},n}();Object.defineProperty(Dr,Symbol.hasInstance,{value:function(n){return!!n&&n.dataId!=null&&n.shape!=null&&n.dtype!=null}});var Do,Kn,co,Cr,lo,_n=function(n){function r(e,t,o,a){var i=n.call(this,e.shape,e.dtype,e.dataId,a)||this;return i.trainable=t,i.name=o,i}return D(r,n),r.prototype.assign=function(e){if(e.dtype!==this.dtype)throw new Error("dtype of the new value ("+e.dtype+") and previous value ("+this.dtype+") must match");if(!_e(e.shape,this.shape))throw new Error("shape of the new value ("+e.shape+") and previous value ("+this.shape+") must match");Ar().disposeTensor(this),this.dataId=e.dataId,Ar().incRef(this,null)},r.prototype.dispose=function(){Ar().disposeVariable(this),this.isDisposedInternal=!0},r}(Dr);Object.defineProperty(_n,Symbol.hasInstance,{value:function(n){return n instanceof Dr&&n.assign!=null&&n.assign instanceof Function}}),function(n){n.R0="R0",n.R1="R1",n.R2="R2",n.R3="R3",n.R4="R4",n.R5="R5",n.R6="R6"}(Do||(Do={})),function(n){n.float32="float32",n.int32="int32",n.bool="int32",n.complex64="complex64"}(Kn||(Kn={})),function(n){n.float32="float32",n.int32="int32",n.bool="bool",n.complex64="complex64"}(co||(co={})),function(n){n.float32="float32",n.int32="float32",n.bool="float32",n.complex64="complex64"}(Cr||(Cr={})),function(n){n.float32="complex64",n.int32="complex64",n.bool="complex64",n.complex64="complex64"}(lo||(lo={}));var fo={float32:Cr,int32:Kn,bool:co,complex64:lo};function nr(n,r){if(n==="string"||r==="string"){if(n==="string"&&r==="string")return"string";throw new Error("Can not upcast "+n+" with "+r)}return fo[n][r]}function hr(n){return nr(n,"int32")}function cr(n,r){if(n.dtype===r.dtype)return[n,r];var e=nr(n.dtype,r.dtype);return[n.cast(e),r.cast(e)]}function nn(n,r){_(n.dtype===r.dtype,function(){return"The dtypes of the first("+n.dtype+") and second("+r.dtype+") input must match"})}function cn(n){var r=[];return function e(t,o,a){if(t==null)return;if(t instanceof Dr)return void o.push(t);if(i=t,!Array.isArray(i)&&typeof i!="object")return;var i,s=t;for(var u in s){var f=s[u];a.has(f)||(a.add(f),e(f,o,a))}}(n,r,new Set),r}var ko,Ti=Object.freeze({makeTypesMatch:cr,assertTypesMatch:nn,isTensorInList:function(n,r){return r.some(function(e){return e.id===n.id})},getTensorsInContainer:cn}),Wa=function(){function n(){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}}return n.prototype.dispose=function(){for(var r in this.registeredVariables)this.registeredVariables[r].dispose()},n}(),Si=function(){function n(r){this.ENV=r,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new Wa}return n.prototype.ready=function(){return E(this,void 0,void 0,function(){var r,e,t;return g(this,function(o){switch(o.label){case 0:if(this.pendingBackendInit!=null)return[2,this.pendingBackendInit.then(function(){})];if(this.backendInstance!=null)return[2];r=this.getSortedBackends(),e=0,o.label=1;case 1:return e<r.length?(t=r[e],[4,this.initializeBackend(t).success]):[3,5];case 2:return o.sent()?[4,this.setBackend(t)]:[3,4];case 3:return o.sent(),[2];case 4:return e++,[3,1];case 5:throw new Error("Could not initialize any backends, all backend initializations failed.")}})})},Object.defineProperty(n.prototype,"backend",{get:function(){if(this.pendingBackendInit!=null)throw new Error("Backend '"+this.backendName+"' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");if(this.backendInstance==null){var r=this.initializeBackendsAndReturnBest(),e=r.name;if(r.asyncInit)throw new Error("The highest priority backend '"+e+"' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");this.setBackend(e)}return this.backendInstance},enumerable:!0,configurable:!0}),n.prototype.backendNames=function(){return Object.keys(this.registryFactory)},n.prototype.findBackend=function(r){if(!(r in this.registry)){if(!(r in this.registryFactory))return null;if(this.initializeBackend(r).asyncInit)return null}return this.registry[r]},n.prototype.findBackendFactory=function(r){return r in this.registryFactory?this.registryFactory[r].factory:null},n.prototype.registerBackend=function(r,e,t){return t===void 0&&(t=1),r in this.registryFactory?(console.warn(r+" backend was already registered. Reusing existing backend factory."),!1):(this.registryFactory[r]={factory:e,priority:t},!0)},n.prototype.setBackend=function(r){return E(this,void 0,void 0,function(){var e,t,o;return g(this,function(a){switch(a.label){case 0:if(this.registryFactory[r]==null)throw new Error("Backend name '"+r+"' not found in registry");return this.backendName=r,this.registry[r]!=null?[3,4]:(this.backendInstance=null,e=this.initializeBackend(r),t=e.success,e.asyncInit?[4,t]:[3,2]);case 1:return o=a.sent(),[3,3];case 2:o=t,a.label=3;case 3:if(!o)return[2,!1];a.label=4;case 4:return this.backendInstance=this.registry[r],this.setupRegisteredKernels(),this.profiler=new dt(this.backendInstance),[2,!0]}})})},n.prototype.setupRegisteredKernels=function(){var r=this;B(this.backendName).forEach(function(e){e.setupFunc!=null&&e.setupFunc(r.backendInstance)})},n.prototype.disposeRegisteredKernels=function(r){var e=this;B(r).forEach(function(t){t.disposeFunc!=null&&t.disposeFunc(e.registry[r])})},n.prototype.initializeBackend=function(r){var e=this,t=this.registryFactory[r];if(t==null)throw new Error("Cannot initialize backend "+r+", no registration found.");try{var o=t.factory();if(Promise.resolve(o)===o){var a=++this.pendingBackendInitId,i=o.then(function(s){return!(a<e.pendingBackendInitId)&&(e.registry[r]=s,e.pendingBackendInit=null,!0)}).catch(function(s){return!(a<e.pendingBackendInitId)&&(e.pendingBackendInit=null,console.warn("Initialization of backend "+r+" failed"),console.warn(s.stack||s.message),!1)});return this.pendingBackendInit=i,{success:i,asyncInit:!0}}return this.registry[r]=o,{success:!0,asyncInit:!1}}catch(s){return console.warn("Initialization of backend "+r+" failed"),console.warn(s.stack||s.message),{success:!1,asyncInit:!1}}},n.prototype.removeBackend=function(r){if(!(r in this.registryFactory))throw new Error(r+" backend not found in registry");this.backendName===r&&this.pendingBackendInit!=null&&this.pendingBackendInitId++,r in this.registry&&(this.disposeRegisteredKernels(r),this.registry[r].dispose(),delete this.registry[r]),delete this.registryFactory[r],this.backendName===r&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)},n.prototype.getSortedBackends=function(){var r=this;if(Object.keys(this.registryFactory).length===0)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort(function(e,t){return r.registryFactory[t].priority-r.registryFactory[e].priority})},n.prototype.initializeBackendsAndReturnBest=function(){for(var r=this.getSortedBackends(),e=0;e<r.length;e++){var t=r[e],o=this.initializeBackend(t),a=o.success,i=o.asyncInit;if(i||a)return{name:t,asyncInit:i}}throw new Error("Could not initialize any backends, all backend initializations failed.")},n.prototype.moveData=function(r,e){var t=this.state.tensorInfo.get(e),o=t.backend,a=this.readSync(e);o.disposeData(e),t.backend=r,r.move(e,a,t.shape,t.dtype),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++},n.prototype.tidy=function(r,e){var t,o=this,a=null;if(e==null){if(typeof r!="function")throw new Error("Please provide a function to tidy()");e=r}else{if(typeof r!="string"&&!(r instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if(typeof e!="function")throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");a=r}return this.scopedRun(function(){return o.startScope(a)},function(){return o.endScope(t)},function(){return(t=e())instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),t})},n.prototype.scopedRun=function(r,e,t){r();try{var o=t();return e(),o}catch(a){throw e(),a}},n.prototype.nextTensorId=function(){return n.nextTensorId++},n.prototype.nextVariableId=function(){return n.nextVariableId++},n.prototype.clone=function(r){var e=this.makeTensorFromDataId(r.dataId,r.shape,r.dtype),t={x:r};return this.addTapeNode(this.state.activeScope.name,t,[e],function(o){return{x:function(){return o.toFloat()}}},[]),e},n.prototype.runKernel=function(r,e,t,o,a){return this.runKernelFunc(null,e,null,r,t,o,a)},n.prototype.shouldCheckForMemLeaks=function(){return this.ENV.getBool("IS_TEST")},n.prototype.checkKernelForMemLeak=function(r,e,t){var o=this.backend.numDataIds(),a=0;t.forEach(function(u){a+=u.dtype==="complex64"?3:1});var i=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],s=o-e-a-i;if(s>0)throw new Error("Backend '"+this.backendName+"' has an internal memory leak ("+s+" data ids) after running '"+r+"'")},n.prototype.runKernelFunc=function(r,e,t,o,a,i,s){var u,f=this;i===void 0&&(i=[]),s===void 0&&(s=[]);var C=[],k=this.isTapeOn();o==null&&(o=this.state.activeScope!=null?this.state.activeScope.name:"");var L,X=function(xe){k&&(C=xe.map(function(we){return f.keep(f.clone(we))}))},oe=this.state.numBytes,ue=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);var se,ce=S(o,this.backendName);return L=ce!=null?function(){var xe=f.backend.numDataIds();se=ce.kernelFunc({inputs:e,attrs:a,backend:f.backend});var we=Array.isArray(se)?se:[se];f.shouldCheckForMemLeaks()&&f.checkKernelForMemLeak(o,xe,we);var Ee=we.map(function(Me){var ze=Me.dataId,Be=Me.shape,je=Me.dtype;return f.makeTensorFromDataId(ze,Be,je)}),Se=Ee.filter(function(Me,ze){return s[ze]});return X((i||[]).slice().concat(Se)),Ee}:function(){var xe=f.backend.numDataIds();se=f.tidy(function(){return r(f.backend,X)});var we=Array.isArray(se)?se:[se];return f.shouldCheckForMemLeaks()&&f.checkKernelForMemLeak(o,xe,we),we},this.scopedRun(function(){return f.state.kernelDepth++},function(){return f.state.kernelDepth--},function(){u=f.ENV.getBool("DEBUG")?f.profiler.profileKernel(o,e,function(){return L()}):L()}),k&&this.addTapeNode(o,e,u,t,C),this.state.profiling&&this.state.activeProfile.kernels.push({name:o,bytesAdded:this.state.numBytes-oe,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-ue,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(e).map(function(xe){return e[xe].shape}),outputShapes:u.map(function(xe){return xe.shape})}),Array.isArray(se)?u:u[0]},n.prototype.makeTensor=function(r,e,t,o){if(r==null)throw new Error("Values passed to engine.makeTensor() are null");t=t||"float32",o=o||this.backend;var a=r;t==="string"&&Fe(r[0])&&(a=r.map(function(C){return Re(C)}));var i=o.write(a,e,t),s=new Dr(e,t,i,this.nextTensorId());if(this.incRef(s,o),t==="string"){var u=this.state.tensorInfo.get(i),f=$e(a);this.state.numBytes+=f-u.bytes,u.bytes=f}return s},n.prototype.makeTensorFromDataId=function(r,e,t,o){var a=new Dr(e,t=t||"float32",r,this.nextTensorId());return this.incRef(a,o),a},n.prototype.makeVariable=function(r,e,t,o){e===void 0&&(e=!0),t=t||this.nextVariableId().toString(),o!=null&&o!==r.dtype&&(r=r.asType(o));var a=new _n(r,e,t,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},n.prototype.incRef=function(r,e){var t=this.state.tensorInfo.has(r.dataId)?this.state.tensorInfo.get(r.dataId).refCount:0;if(this.state.numTensors++,r.dtype==="string"&&this.state.numStringTensors++,t===0){this.state.numDataBuffers++;var o=0;r.dtype!=="complex64"&&r.dtype!=="string"&&(o=r.size*ct(r.dtype)),this.state.tensorInfo.set(r.dataId,{backend:e||this.backend,dtype:r.dtype,shape:r.shape,bytes:o,refCount:0}),this.state.numBytes+=o}this.state.tensorInfo.get(r.dataId).refCount++,r instanceof _n||this.track(r)},n.prototype.disposeTensor=function(r){if(this.state.tensorInfo.has(r.dataId)){this.state.numTensors--,r.dtype==="string"&&this.state.numStringTensors--;var e=this.state.tensorInfo.get(r.dataId);e.refCount<=1?(r.dtype!=="complex64"&&(this.state.numBytes-=e.bytes),this.state.numDataBuffers--,e.backend.disposeData(r.dataId),this.state.tensorInfo.delete(r.dataId)):this.state.tensorInfo.get(r.dataId).refCount--}},n.prototype.disposeVariables=function(){for(var r in this.state.registeredVariables){var e=this.state.registeredVariables[r];this.disposeVariable(e)}},n.prototype.disposeVariable=function(r){this.disposeTensor(r),this.state.registeredVariables[r.name]!=null&&delete this.state.registeredVariables[r.name]},n.prototype.memory=function(){var r=this.backend.memory();return r.numTensors=this.state.numTensors,r.numDataBuffers=this.state.numDataBuffers,r.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(r.unreliable=!0,r.reasons==null&&(r.reasons=[]),r.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),r},n.prototype.profile=function(r){return E(this,void 0,void 0,function(){var e,t;return g(this,function(o){return this.state.profiling=!0,e=this.state.numBytes,t=this.state.numTensors,this.state.activeProfile.kernels=[],this.state.activeProfile.result=r(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max.apply(Math,this.state.activeProfile.kernels.map(function(a){return a.totalBytesSnapshot})),this.state.activeProfile.newBytes=this.state.numBytes-e,this.state.activeProfile.newTensors=this.state.numTensors-t,[2,this.state.activeProfile]})})},n.prototype.isTapeOn=function(){return this.state.gradientDepth>0&&this.state.kernelDepth===0},n.prototype.addTapeNode=function(r,e,t,o,a){var i=this,s={id:this.state.nextTapeNodeId++,kernelName:r,inputs:e,outputs:t,saved:a},u=H(r);u!=null&&(o=u.gradFunc),o!=null&&(s.gradient=function(f){return f=f.map(function(C,k){if(C==null){var L=t[k],X=R(L.size,L.dtype);return i.makeTensor(X,L.shape,L.dtype)}return C}),o(f.length>1?f:f[0],a)}),this.state.activeTape.push(s)},n.prototype.keep=function(r){return r.kept=!0,r},n.prototype.startTape=function(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++},n.prototype.endTape=function(){this.state.gradientDepth--},n.prototype.startScope=function(r){var e={track:[],name:"unnamed scope",id:this.state.nextScopeId++};r&&(e.name=r),this.state.scopeStack.push(e),this.state.activeScope=e},n.prototype.endScope=function(r){for(var e=this,t=cn(r),o=new Set(t.map(function(u){return u.id})),a=0;a<this.state.activeScope.track.length;a++){var i=this.state.activeScope.track[a];i.kept||o.has(i.id)||i.dispose()}var s=this.state.scopeStack.pop();this.state.activeScope=this.state.scopeStack.length===0?null:this.state.scopeStack[this.state.scopeStack.length-1],t.forEach(function(u){u.kept||u.scopeId!==s.id||e.track(u)})},n.prototype.gradients=function(r,e,t,o){var a=this;if(o===void 0&&(o=!1),_(e.length>0,function(){return"gradients() received an empty list of xs."}),t!=null&&t.dtype!=="float32")throw new Error("dy must have 'float32' dtype, but has '"+t.dtype+"'");var i=this.scopedRun(function(){return a.startTape()},function(){return a.endTape()},function(){return a.tidy("forward",r)});_(i instanceof Dr,function(){return"The result y returned by f() must be a tensor."});var s=function(u,f,C){for(var k={},L={},X=0;X<f.length;X++)k[f[X].id]=!0;for(X=0;X<u.length;X++){var oe=(Me=u[X]).inputs;for(var ue in oe){for(var se=oe[ue],ce=!1,xe=0;xe<f.length;xe++)if(k[se.id]){Me.outputs.forEach(function(Ue){return k[Ue.id]=!0}),ce=!0,L[Me.id]=!0;break}if(ce)break}}var we={};we[C.id]=!0;var Ee={};for(X=u.length-1;X>=0;X--)for(oe=(Me=u[X]).inputs,xe=0;xe<Me.outputs.length;xe++)if(we[Me.outputs[xe].id]){for(var ue in oe)we[oe[ue].id]=!0,Ee[Me.id]=!0;break}var Se=[];for(X=0;X<u.length;X++){var Me;if(L[(Me=u[X]).id]&&Ee[Me.id]){var ze={};for(var ue in Me.inputs){var Be=Me.inputs[ue];k[Be.id]&&(ze[ue]=Be)}var je=Object.assign({},Me);je.inputs=ze,je.outputs=Me.outputs,Se.push(je)}}return Se}(this.state.activeTape,e,i);if(!o&&s.length===0&&e.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",function(){var u,f,C={};C[i.id]=t==null?(u=i.shape,f=c(le(u),"float32"),Ve.makeTensor(f,u,"float32")):t,function(L,X,oe){for(var ue=function(ce){var xe=X[ce],we=[];if(xe.outputs.forEach(function(ze){var Be=L[ze.id];Be!=null?we.push(Be):we.push(null)}),xe.gradient==null)throw new Error("Cannot compute gradient: gradient function not found for "+xe.kernelName+".");var Ee=xe.gradient(we),Se=function(ze){if(!(ze in Ee))throw new Error("Cannot backprop through input "+ze+". Available gradients found: "+Object.keys(Ee)+".");var Be=oe(function(){return Ee[ze]()});if(Be.dtype!=="float32")throw new Error("Error in gradient for op "+xe.kernelName+". The gradient of input "+ze+" must have 'float32' dtype, but has '"+Be.dtype+"'");var je=xe.inputs[ze];if(!_e(Be.shape,je.shape))throw new Error("Error in gradient for op "+xe.kernelName+". The gradient of input '"+ze+"' has shape '"+Be.shape+"', which does not match the shape of the input '"+je.shape+"'");if(L[je.id]==null)L[je.id]=Be;else{var Ue=L[je.id];L[je.id]=Ue.add(Be),Ue.dispose()}};for(var Me in xe.inputs)Se(Me)},se=X.length-1;se>=0;se--)ue(se)}(C,s,function(L){return a.tidy(L)});var k=e.map(function(L){return C[L.id]});return a.state.gradientDepth===0&&(a.state.activeTape.forEach(function(L){for(var X=0,oe=L.saved;X<oe.length;X++)oe[X].dispose()}),a.state.activeTape=null),{value:i,grads:k}})},n.prototype.customGrad=function(r){var e=this;return _(ye(r),function(){return"The f passed in customGrad(f) must be a function."}),function(){for(var t,o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];_(o.every(function(s){return s instanceof Dr}),function(){return"The args passed in customGrad(f)(x1, x2,...) must all be tensors"});var i={};return o.forEach(function(s,u){i[u]=s}),e.runKernelFunc(function(s,u){return _((t=r.apply(void 0,o.concat([u]))).value instanceof Dr,function(){return"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"}),_(ye(t.gradFunc),function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."}),t.value},i,function(s,u){var f=t.gradFunc(s,u),C=Array.isArray(f)?f:[f];_(C.length===o.length,function(){return"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(...)."}),_(C.every(function(L){return L instanceof Dr}),function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors."});var k={};return C.forEach(function(L,X){k[X]=function(){return L}}),k})}},n.prototype.readSync=function(r){return this.state.tensorInfo.get(r).backend.readSync(r)},n.prototype.read=function(r){return this.state.tensorInfo.get(r).backend.read(r)},n.prototype.time=function(r){return E(this,void 0,void 0,function(){var e,t;return g(this,function(o){switch(o.label){case 0:return e=fe(),[4,this.backend.time(r)];case 1:return(t=o.sent()).wallMs=fe()-e,[2,t]}})})},n.prototype.track=function(r){return this.state.activeScope!=null&&(r.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(r)),r},Object.defineProperty(n.prototype,"registeredVariables",{get:function(){return this.state.registeredVariables},enumerable:!0,configurable:!0}),n.prototype.reset=function(){for(var r in this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new Wa,this.registry)this.disposeRegisteredKernels(r),this.registry[r].dispose(),delete this.registry[r];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null},n.nextTensorId=0,n.nextVariableId=0,n}(),Ve=function(){var n=function(){if(ko==null){var e=void 0;if(typeof window!="undefined")e=window;else if(typeof y!="undefined")e=y;else if(typeof d!="undefined")e=d;else{if(typeof self=="undefined")throw new Error("Could not find a global object");e=self}ko=e}return ko}();if(n._tfengine==null){var r=new h(n);n._tfengine=new Si(r)}return function(e){v=e}(n._tfengine.ENV),Ar=function(){return n._tfengine},n._tfengine}();function Ha(){return typeof window!="undefined"&&window.document!=null||typeof WorkerGlobalScope!="undefined"}var Cn=p();Cn.registerFlag("DEBUG",function(){return!1},function(n){n&&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.")}),Cn.registerFlag("IS_BROWSER",function(){return Ha()}),Cn.registerFlag("IS_NODE",function(){return typeof d!="undefined"&&d.versions!==void 0&&d.versions.node!==void 0}),Cn.registerFlag("IS_CHROME",function(){return typeof navigator!="undefined"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}),Cn.registerFlag("PROD",function(){return!1}),Cn.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",function(){return Cn.getBool("DEBUG")}),Cn.registerFlag("DEPRECATION_WARNINGS_ENABLED",function(){return!0}),Cn.registerFlag("IS_TEST",function(){return!1});var Mo,Wr,Hr,Tn={},za={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function Ga(n,r){Tn[n]=r}function vn(n){n in Tn||(Tn[n]=function(e){if(e!==1&&e!==2)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");var t=function(o){if(typeof OffscreenCanvas!="undefined"&&o===2)return new OffscreenCanvas(300,150);if(typeof document!="undefined")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}(e);return t.addEventListener("webglcontextlost",function(o){o.preventDefault(),delete Tn[e]},!1),e===1?t.getContext("webgl",za)||t.getContext("experimental-webgl",za):t.getContext("webgl2",za)}(n));var r=Tn[n];return r.isContextLost()?(delete Tn[n],vn(n)):(r.disable(r.DEPTH_TEST),r.disable(r.STENCIL_TEST),r.disable(r.BLEND),r.disable(r.DITHER),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SAMPLE_COVERAGE),r.enable(r.SCISSOR_TEST),r.enable(r.CULL_FACE),r.cullFace(r.BACK),Tn[n])}function Yn(n,r){return[r,n]}function Or(n){var r=le(n);return $(Math.ceil(r/4))}function $n(n,r){return[Math.max(1,Math.ceil(r/2)),Math.max(1,Math.ceil(n/2))]}function Po(n,r){var e,t,o,a,i,s,u,f,C,k=n;return p().getNumber("WEBGL_VERSION")===2?(e=k.R32F,t=k.R16F,o=k.RGBA16F,a=k.RGBA32F,i=k.RED,s=4,u=1,f=k.HALF_FLOAT,C=k.FLOAT):(e=n.RGBA,t=n.RGBA,o=n.RGBA,a=k.RGBA,i=n.RGBA,s=4,u=4,f=r!=null?r.HALF_FLOAT_OES:null,C=n.FLOAT),{internalFormatFloat:e,internalFormatHalfFloat:t,internalFormatPackedHalfFloat:o,internalFormatPackedFloat:a,textureFormatFloat:i,downloadTextureFormat:n.RGBA,downloadUnpackNumChannels:s,defaultNumChannels:u,textureTypeHalfFloat:f,textureTypeFloat:C}}function St(n,r,e){var t=e();return r&&function(o){var a=o.getError();if(a!==o.NO_ERROR)throw new Error("WebGL Error: "+Va(o,a))}(n),t}!function(n){n[n.DENSE=0]="DENSE",n[n.SHARED_BATCH=1]="SHARED_BATCH"}(Mo||(Mo={})),function(n){n[n.RENDER=0]="RENDER",n[n.UPLOAD=1]="UPLOAD",n[n.PIXELS=2]="PIXELS",n[n.DOWNLOAD=3]="DOWNLOAD"}(Wr||(Wr={})),function(n){n[n.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",n[n.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",n[n.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",n[n.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32",n[n.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16"}(Hr||(Hr={}));var Ju=596e-10,bs=65504;function xs(n){return!!(p().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||n===0||Ju<Math.abs(n)&&Math.abs(n)<bs)}function Va(n,r){switch(r){case n.NO_ERROR:return"NO_ERROR";case n.INVALID_ENUM:return"INVALID_ENUM";case n.INVALID_VALUE:return"INVALID_VALUE";case n.INVALID_OPERATION:return"INVALID_OPERATION";case n.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case n.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case n.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return"Unknown error code "+r}}function Fo(n,r,e){return An(n,r,function(){return n.getExtension(e)},'Extension "'+e+'" not supported on this browser.')}function ws(n,r,e){var t=An(n,r,function(){return n.createShader(n.VERTEX_SHADER)},"Unable to create vertex WebGLShader.");if(St(n,r,function(){return n.shaderSource(t,e)}),St(n,r,function(){return n.compileShader(t)}),n.getShaderParameter(t,n.COMPILE_STATUS)===!1)throw console.log(n.getShaderInfoLog(t)),new Error("Failed to compile vertex shader.");return t}function gn(n,r,e){var t=An(n,r,function(){return n.createShader(n.FRAGMENT_SHADER)},"Unable to create fragment WebGLShader.");if(St(n,r,function(){return n.shaderSource(t,e)}),St(n,r,function(){return n.compileShader(t)}),n.getShaderParameter(t,n.COMPILE_STATUS)===!1)throw function(o,a){var i=ra.exec(a);if(i==null)return console.log("Couldn't parse line number in error: "+a),void console.log(o);for(var s=+i[1],u=o.split(`
`),f=u.length.toString().length+2,C=u.map(function(se,ce){return ne((ce+1).toString(),f)+se}),k=0,L=0;L<C.length;L++)k=Math.max(C[L].length,k);var X=C.slice(0,s-1),oe=C.slice(s-1,s),ue=C.slice(s);console.log(X.join(`
`)),console.log(a.split(`
`)[0]),console.log("%c "+ne(oe[0],k),"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(ue.join(`
`))}(e,n.getShaderInfoLog(t)),new Error("Failed to compile fragment shader.");return t}var zr,ho,ra=/ERROR: [0-9]+:([0-9]+):/g;function an(n,r){return An(n,r,function(){return n.createProgram()},"Unable to create WebGLProgram.")}function yn(n,r,e){if(St(n,r,function(){return n.linkProgram(e)}),n.getProgramParameter(e,n.LINK_STATUS)===!1)throw console.log(n.getProgramInfoLog(e)),new Error("Failed to link vertex and fragment shaders.")}function Jn(n,r,e){if(St(n,r,function(){return n.validateProgram(e)}),n.getProgramParameter(e,n.VALIDATE_STATUS)===!1)throw console.log(n.getProgramInfoLog(e)),new Error("Shader program validation failed.")}function na(n,r,e){var t=An(n,r,function(){return n.createBuffer()},"Unable to create WebGLBuffer");return St(n,r,function(){return n.bindBuffer(n.ARRAY_BUFFER,t)}),St(n,r,function(){return n.bufferData(n.ARRAY_BUFFER,e,n.STATIC_DRAW)}),t}function Xa(n,r,e){var t=An(n,r,function(){return n.createBuffer()},"Unable to create WebGLBuffer");return St(n,r,function(){return n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t)}),St(n,r,function(){return n.bufferData(n.ELEMENT_ARRAY_BUFFER,e,n.STATIC_DRAW)}),t}function oa(n,r){return An(n,r,function(){return n.createTexture()},"Unable to create WebGLTexture.")}function aa(n,r){var e=p().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(n<=0||r<=0){var t="["+n+"x"+r+"]";throw new Error("Requested texture size "+t+" is invalid.")}if(n>e||r>e)throw t="["+n+"x"+r+"]",new Error("Requested texture size "+t+" greater than WebGL maximum on this browser / GPU "+("["+e+"x"+e+"]")+".")}function Sn(n,r){return An(n,r,function(){return n.createFramebuffer()},"Unable to create WebGLFramebuffer.")}function ln(n,r,e,t,o,a,i,s){var u=n.getAttribLocation(e,t);return u!==-1&&(St(n,r,function(){return n.bindBuffer(n.ARRAY_BUFFER,o)}),St(n,r,function(){return n.vertexAttribPointer(u,a,n.FLOAT,!1,i,s)}),St(n,r,function(){return n.enableVertexAttribArray(u)}),!0)}function Ka(n,r,e,t){Ja(n,t),St(n,r,function(){return n.activeTexture(n.TEXTURE0+t)}),St(n,r,function(){return n.bindTexture(n.TEXTURE_2D,e)})}function Ai(n,r,e,t){return An(n,r,function(){return n.getUniformLocation(e,t)},'uniform "'+t+'" not present in program.')}function Ya(n,r,e){return n.getUniformLocation(r,e)}function $a(n,r,e,t,o,a){St(n,r,function(){return Ka(n,r,t,a)}),St(n,r,function(){return n.uniform1i(o,a)})}function ia(n,r,e,t){St(n,r,function(){return n.bindFramebuffer(n.FRAMEBUFFER,t)}),St(n,r,function(){return n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e,0)})}function sa(n,r,e){St(n,r,function(){return n.bindFramebuffer(n.FRAMEBUFFER,e)}),St(n,r,function(){return n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,null,0)})}function $r(n){var r=n.checkFramebufferStatus(n.FRAMEBUFFER);if(r!==n.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+Oi(n,r))}function Oi(n,r){switch(r){case n.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case n.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case n.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case n.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return"unknown error "+r}}function An(n,r,e,t){var o=St(n,r,function(){return e()});if(o==null)throw new Error(t);return o}function Ja(n,r){var e=n.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,t=r+n.TEXTURE0;if(t<n.TEXTURE0||t>e)throw new Error("textureUnit must be in "+("[gl.TEXTURE0, gl.TEXTURE"+e+"]")+".")}function po(n,r){return r===void 0&&(r=2),le(n.slice(0,n.length-r))}function mo(n){if(n.length===0)throw Error("Cannot get rows and columns of an empty shape array.");return[n.length>1?n[n.length-2]:1,n[n.length-1]]}function vo(n){var r=[1,1,1];return n.length===0||n.length===1&&n[0]===1||(r=[po(n)].concat(mo(n))),r}function Ri(n,r){var e;r===void 0&&(r=!1);var t=p().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(r&&(t*=2,(n=n.map(function(f,C){return C>=n.length-2?te(n[C]):n[C]})).length===1&&(n=[2,n[0]])),n.length!==2){var o=ee(n);n=o.newShape}var a=le(n);if(n.length<=1&&a<=t)return[1,a];if(n.length===2&&n[0]<=t&&n[1]<=t)return n;if(n.length===3&&n[0]*n[1]<=t&&n[2]<=t)return[n[0]*n[1],n[2]];if(n.length===3&&n[0]<=t&&n[1]*n[2]<=t)return[n[0],n[1]*n[2]];if(n.length===4&&n[0]*n[1]*n[2]<=t&&n[3]<=t)return[n[0]*n[1]*n[2],n[3]];if(n.length===4&&n[0]<=t&&n[1]*n[2]*n[3]<=t)return[n[0],n[1]*n[2]*n[3]];if(r){var i=po(n),s=2,u=2;return n.length&&(s=(e=mo(n))[0],u=e[1]),$(a=i*(s/2)*(u/2)).map(function(f){return 2*f})}return $(a)}function ua(n){return n%2==0}function go(n,r){if(_e(n=n.slice(-2),r=r.slice(-2)))return!0;if(!n.length||!r.length)return!0;if(n[0]===0||n[1]===0||r[0]===0||r[1]===0)return!0;if(n.length!==r.length){var e=n.slice(-1)[0],t=r.slice(-1)[0];if(e===t)return!0;if(ua(e)&&ua(t)&&(n[0]===1||r[0]===1))return!0}return n[1]===r[1]&&ua(n[0])&&ua(r[0])}function Ii(n){if(zr==null){var r=vn(n);zr=r.getParameter(r.MAX_TEXTURE_SIZE)}return zr}function ca(n){if(ho==null){var r=vn(n);ho=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,ho)}function Lo(n){if(n===0)return 0;var r=vn(n);return Jr(r,"EXT_disjoint_timer_query_webgl2")&&n===2?2:Jr(r,"EXT_disjoint_timer_query")?1:0}function Jr(n,r){return n.getExtension(r)!=null}function la(n){try{if(vn(n)!=null)return!0}catch(r){return!1}return!1}function Ni(n){if(n===0)return!1;var r=vn(n);if(n===1){if(!Jr(r,"OES_texture_float"))return!1}else if(!Jr(r,"EXT_color_buffer_float"))return!1;return qa(r)}function Di(n){if(n===0)return!1;var r=vn(n);if(n!==1){if(Jr(r,"EXT_color_buffer_float"))return qa(r);if(Jr(r,"EXT_color_buffer_half_float")){var e=r.getExtension("EXT_color_buffer_half_float");return function(t,o){var a=Po(t,o),i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,a.internalFormatHalfFloat,1,1,0,a.textureFormatFloat,a.textureTypeHalfFloat,null);var s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0);var u=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;return t.bindTexture(t.TEXTURE_2D,null),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteTexture(i),t.deleteFramebuffer(s),u}(r,e)}return!1}return!!Jr(r,"OES_texture_float")&&!!Jr(r,"WEBGL_color_buffer_float")&&qa(r)}function qa(n){var r=Po(n),e=n.createTexture();n.bindTexture(n.TEXTURE_2D,e),n.texImage2D(n.TEXTURE_2D,0,r.internalFormatFloat,1,1,0,r.textureFormatFloat,r.textureTypeFloat,null);var t=n.createFramebuffer();n.bindFramebuffer(n.FRAMEBUFFER,t),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e,0);var o=n.checkFramebufferStatus(n.FRAMEBUFFER)===n.FRAMEBUFFER_COMPLETE;return n.bindTexture(n.TEXTURE_2D,null),n.bindFramebuffer(n.FRAMEBUFFER,null),n.deleteTexture(e),n.deleteFramebuffer(t),o}function ki(n){return n===2&&vn(n).fenceSync!=null}var Es=Object.freeze({callAndCheck:St,canBeRepresented:xs,getWebGLErrorMessage:Va,getExtensionOrThrow:Fo,createVertexShader:ws,createFragmentShader:gn,createProgram:an,linkProgram:yn,validateProgram:Jn,createStaticVertexBuffer:na,createStaticIndexBuffer:Xa,getNumChannels:function(){return p().getNumber("WEBGL_VERSION")===2?1:4},createTexture:oa,validateTextureSize:aa,createFramebuffer:Sn,bindVertexBufferToProgramAttribute:ln,bindTextureUnit:Ka,unbindTextureUnit:function(n,r,e){Ja(n,e),St(n,r,function(){return n.activeTexture(n.TEXTURE0+e)}),St(n,r,function(){return n.bindTexture(n.TEXTURE_2D,null)})},getProgramUniformLocationOrThrow:Ai,getProgramUniformLocation:Ya,bindTextureToProgramUniformSampler:$a,bindCanvasToFramebuffer:function(n,r){St(n,r,function(){return n.bindFramebuffer(n.FRAMEBUFFER,null)}),St(n,r,function(){return n.viewport(0,0,n.canvas.width,n.canvas.height)}),St(n,r,function(){return n.scissor(0,0,n.canvas.width,n.canvas.height)})},bindColorTextureToFramebuffer:ia,unbindColorTextureFromFramebuffer:sa,validateFramebuffer:$r,getFramebufferErrorMessage:Oi,getBatchDim:po,getRowsCols:mo,getShapeAs3D:vo,getTextureShapeFromLogicalShape:Ri,isReshapeFree:go,getWebGLMaxTextureSize:Ii,resetMaxTextureSize:function(){zr=null},resetMaxTexturesInShader:function(){ho=null},getMaxTexturesInShader:ca,getWebGLDisjointQueryTimerVersion:Lo,hasExtension:Jr,isWebGLVersionEnabled:la,isCapableOfRenderingToFloatTexture:Ni,isDownloadFloatTextureEnabled:Di,isWebGLFenceEnabled:ki}),Ft=p();function Mi(){p().set("PROD",!0)}function qu(){p().set("DEBUG",!0)}function Qu(){p().set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")}function Pi(n){p().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(n+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}function Zu(){Ve.disposeVariables()}function jo(){return Ve}function ec(){return Ve.memory()}function _s(n){return Ve.profile(n)}function Rr(n,r){return Ve.tidy(n,r)}function qr(n){cn(n).forEach(function(r){return r.dispose()})}function Cs(n){return Ve.keep(n)}function tc(n){return Ve.time(n)}function rc(n){return Ve.setBackend(n)}function ad(){return Ve.ready()}function nc(){return Ve.backendName}function Fi(n){Ve.removeBackend(n)}function oc(n){return Ve.findBackend(n)}function Ts(n){return Ve.findBackendFactory(n)}function Ss(n,r,e){return e===void 0&&(e=1),Ve.registerBackend(n,r,e)}function ac(){return Ve.backend}function ic(n,r){p().setPlatform(n,r)}function da(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];p().getBool("IS_TEST")||console.warn.apply(console,n)}function bn(n,r){var e=n;if(Ae(n))return r==="string"?[]:[n.length];if(!Array.isArray(n))return[];for(var t=[];Array.isArray(e)||Ae(e)&&r!=="string";)t.push(e.length),e=e[0];return Array.isArray(n)&&p().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&function o(a,i,s){if(s=s||[],!Array.isArray(a)&&!Ae(a))return void _(i.length===0,function(){return"Element arr["+s.join("][")+"] is a primitive, but should be an array/TypedArray of "+i[0]+" elements"});_(i.length>0,function(){return"Element arr["+s.join("][")+"] should be a primitive, but is an array of "+a.length+" elements"}),_(a.length===i[0],function(){return"Element arr["+s.join("][")+"] should have "+i[0]+" elements, but has "+a.length+" elements"});for(var u=i.slice(1),f=0;f<a.length;++f)o(a[f],u,s.concat(f))}(n,t,[]),t}function dn(n,r,e,t){if(n!=null&&(n!=="numeric"&&n!==r||n==="numeric"&&r==="string"))throw new Error("Argument '"+e+"' passed to '"+t+"' must be "+n+" tensor, but got "+r+" tensor")}function Oe(n,r,e,t){if(t===void 0&&(t="numeric"),n instanceof Dr)return dn(t,n.dtype,r,e),n;var o=ot(n);if(o!=="string"&&["bool","int32","float32"].indexOf(t)>=0&&(o=t),dn(t,o,r,e),n==null||!Ae(n)&&!Array.isArray(n)&&typeof n!="number"&&typeof n!="boolean"&&typeof n!="string"){var a=n==null?"null":n.constructor.name;throw new Error("Argument '"+r+"' passed to '"+e+"' must be a Tensor or TensorLike, but got '"+a+"'")}var i=bn(n,o);Ae(n)||Array.isArray(n)||(n=[n]);var s=o!=="string"?q(n,o,p().getBool("DEBUG")):pe(n,[],!0);return Ve.makeTensor(s,i,o)}function yo(n,r,e,t){if(t===void 0&&(t="numeric"),!Array.isArray(n))throw new Error("Argument "+r+" passed to "+e+" must be a `Tensor[]` or `TensorLike[]`");return n.map(function(o,a){return Oe(o,r+"["+a+"]",e)},t)}function Li(n,r){for(var e=0;e<n.length;++e)if(n[n.length-e-1]!==r-1-e)return!1;return!0}function Qa(n,r,e){for(var t=n.length+r.length,o=[],a=0,i=0,s=0;s<t;s++)e.indexOf(s)===-1?o.push(n[a++]):o.push(r[i++]);return o}function Gr(n,r){for(var e=[],t=n.length,o=0;o<t;o++)r.indexOf(o)===-1&&e.push(n[o]);return[e,r.map(function(a){return n[a]})]}function Vr(n,r){return Qa(n,r.map(function(e){return 1}),r)}function on(n,r,e){_(Li(r,e),function(){return n+" supports only inner-most axes for now. Got axes "+r+" and rank-"+e+" input."})}function sn(n,r){if(Li(n,r))return null;for(var e=[],t=0;t<r;++t)n.indexOf(t)===-1&&e.push(t);return n.forEach(function(o){return e.push(o)}),e}function bo(n){return n.map(function(r,e){return[e,r]}).sort(function(r,e){return r[1]-e[1]}).map(function(r){return r[0]})}function fn(n,r){for(var e=[],t=r-n;t<r;++t)e.push(t);return e}function ji(n,r){var e=n[0].length;n.forEach(function(o,a){_(o.length===e,function(){return"Error in concat"+e+"D: rank of tensors["+a+"] must be the same as the rank of the rest ("+e+")"})}),_(r>=0&&r<e,function(){return"Error in concat"+e+"D: axis must be between 0 and "+(e-1)+"."});var t=n[0];n.forEach(function(o,a){for(var i=0;i<e;i++)_(i===r||o[i]===t[i],function(){return"Error in concat"+e+"D: Shape of tensors["+a+"] ("+o+") does not match the shape of the rest ("+t+") along the non-concatenated axis "+a+"."})})}function qn(n,r){for(var e=n[0].slice(),t=1;t<n.length;t++)e[r]+=n[t][r];return e}function Xe(n){var r=Object.keys(n);if(r.length!==1)throw new Error("Please provide an object with a single key (operation name) mapping to a function. Got an object with "+r.length+" keys.");var e=r[0],t=n[e];e.endsWith("_")&&(e=e.substring(0,e.length-1));var o=function(){for(var a=[],i=0;i<arguments.length;i++)a[i]=arguments[i];Ve.startScope(e);try{var s=t.apply(void 0,a);return s instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),Ve.endScope(s),s}catch(u){throw Ve.endScope(null),u}};return Object.defineProperty(o,"name",{value:e,configurable:!0}),o}Ft.registerFlag("HAS_WEBGL",function(){return Ft.getNumber("WEBGL_VERSION")>0}),Ft.registerFlag("WEBGL_VERSION",function(){return la(2)?2:la(1)?1:0}),Ft.registerFlag("WEBGL_BUFFER_SUPPORTED",function(){return Ft.get("WEBGL_VERSION")===2}),Ft.registerFlag("WEBGL_CPU_FORWARD",function(){return!0}),Ft.registerFlag("WEBGL_FORCE_F16_TEXTURES",function(){return!1}),Ft.registerFlag("WEBGL_PACK",function(){return Ft.getBool("HAS_WEBGL")}),Ft.registerFlag("WEBGL_PACK_NORMALIZATION",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_PACK_CLIP",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_PACK_DEPTHWISECONV",function(){return!1}),Ft.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_PACK_REDUCE",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_LAZILY_UNPACK",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_CONV_IM2COL",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_MAX_TEXTURE_SIZE",function(){return Ii(Ft.getNumber("WEBGL_VERSION"))}),Ft.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",function(){return ca(Ft.getNumber("WEBGL_VERSION"))}),Ft.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",function(){var n=Ft.getNumber("WEBGL_VERSION");return n===0?0:Lo(n)}),Ft.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",function(){return Ft.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&(n=navigator.userAgent||navigator.vendor||window.opera,!(/(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(n)||/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(n.substr(0,4))));var n}),Ft.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",function(){return Ni(Ft.getNumber("WEBGL_VERSION"))}),Ft.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",function(){return!Ft.getBool("WEBGL_FORCE_F16_TEXTURES")&&Ft.getBool("WEBGL_RENDER_FLOAT32_CAPABLE")}),Ft.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",function(){return Di(Ft.getNumber("WEBGL_VERSION"))}),Ft.registerFlag("WEBGL_FENCE_API_ENABLED",function(){return ki(Ft.getNumber("WEBGL_VERSION"))}),Ft.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",function(){return Ft.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0}),Xn=Pi;var xr=Xe({complex_:function(n,r){var e=Oe(n,"real","complex"),t=Oe(r,"imag","complex");return Y(e.shape,t.shape,"real and imag shapes, "+e.shape+" and "+t.shape+", must match in call to tf.complex()."),Ve.runKernelFunc(function(o){return o.complex(e,t)},{$real:e,$imag:t})}}),un=Xe({real_:function(n){var r=Oe(n,"input","real");return Ve.runKernelFunc(function(e){return e.real(r)},{$input:r})}}),xn=Xe({imag_:function(n){var r=Oe(n,"input","imag");return Ve.runKernelFunc(function(e){return e.imag(r)},{$input:r})}});function Ur(n,r,e){return Dn(n,r,bn(n,e),e)}function Dn(n,r,e,t){if(t==null&&(t=ot(n)),t==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!Ae(n)&&!Array.isArray(n)&&typeof n!="number"&&typeof n!="boolean"&&typeof n!="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(r!=null){ve(r);var o=le(r),a=le(e);_(o===a,function(){return"Based on the provided shape, ["+r+"], the tensor should have "+o+" values but has "+a});for(var i=0;i<e.length;++i){var s=e[i],u=i!==e.length-1||s!==le(r.slice(i));_(e[i]===r[i]||!u,function(){return"Error creating a new Tensor. Inferred shape ("+e+") does not match the provided shape ("+r+"). "})}}return Ae(n)||Array.isArray(n)||(n=[n]),r=r||e,n=t!=="string"?q(n,t,p().getBool("DEBUG")):pe(n,[],!0),Ve.makeTensor(n,r,t)}function Nt(n,r){if((Ae(n)&&r!=="string"||Array.isArray(n))&&r!=="complex64")throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if(r==="string"&&Ae(n)&&!(n instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return Dn(n,[],[],r)}function Qn(n,r){re(n);var e=bn(n,r);if(e.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return Dn(n,null,e,r)}function Zn(n,r,e){if(re(n),r!=null&&r.length!==2)throw new Error("tensor2d() requires shape to have two numbers");var t=bn(n,e);if(t.length!==2&&t.length!==1)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(t.length===1&&r==null)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return Dn(n,r,t,e)}function Za(n,r,e){if(re(n),r!=null&&r.length!==3)throw new Error("tensor3d() requires shape to have three numbers");var t=bn(n,e);if(t.length!==3&&t.length!==1)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(t.length===1&&r==null)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return Dn(n,r,t,e)}function kn(n,r,e){if(re(n),r!=null&&r.length!==4)throw new Error("tensor4d() requires shape to have four numbers");var t=bn(n,e);if(t.length!==4&&t.length!==1)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(t.length===1&&r==null)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return Dn(n,r,t,e)}function xo(n,r,e){if(re(n),r!=null&&r.length!==5)throw new Error("tensor5d() requires shape to have five numbers");var t=bn(n,e);if(t.length!==5&&t.length!==1)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(t.length===1&&r==null)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return Dn(n,r,t,e)}function As(n,r,e){if(re(n),r!=null&&r.length!==6)throw new Error("tensor6d() requires shape to have six numbers");var t=bn(n,e);if(t.length!==6&&t.length!==1)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(t.length===1&&r==null)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return Dn(n,r=r||t,t,e)}function wo(n,r,e,t){return r===void 0&&(r=!0),Ve.makeVariable(n,r,e,t)}function Mn(n,r){if(r===void 0&&(r="float32"),r==="complex64"){var e=Mn(n,"float32"),t=Tr(n,"float32");return xr(e,t)}var o=c(le(n),r);return Ve.makeTensor(o,n,r)}function Tr(n,r){if(r===void 0&&(r="float32"),r==="complex64"){var e=Tr(n,"float32"),t=Tr(n,"float32");return xr(e,t)}var o=R(le(n),r);return Ve.makeTensor(o,n,r)}function ei(n,r,e){return Ve.runKernelFunc(function(t){return t.fill(n,r,e)},{})}function sc(n,r,e){if(e<=0)throw new Error("The number of values should be positive.");return Ve.runKernelFunc(function(t){return t.linspace(n,r,e)},{})}function fa(n,r,e,t){if(e===void 0&&(e=1),t===void 0&&(t="float32"),e===0)throw new Error("Cannot have a step of zero");if(n===r||n<r&&e<0||r<n&&e>1)return Tr([0],t);var o=R(Math.abs(Math.ceil((r-n)/e)),t);r<n&&e===1&&(e=-1),o[0]=n;for(var a=1;a<o.length;a++)o[a]=o[a-1]+e;return Qn(o,t)}var Bi=Xe({onesLike_:function(n){var r=Oe(n,"x","onesLike");if(r.dtype==="complex64"){var e=Bi(un(r)),t=Jt(xn(r));return xr(e,t)}return Ve.runKernelFunc(function(o){return o.onesLike(r)},{$x:r},function(o,a){return{$x:function(){return Jt(o)}}})}}),Jt=Xe({zerosLike_:function(n){var r=Oe(n,"x","zerosLike");return Ve.runKernelFunc(function(e){return e.zerosLike(r)},{$x:r},function(e,t){return{$x:function(){return Jt(e)}}})}}),hn=Xe({concat_:function(n,r){r===void 0&&(r=0),_(n.length>=1,function(){return"Pass at least one tensor to concat"});var e=yo(n,"tensors","concat");e[0].dtype==="complex64"&&e.forEach(function(s){if(s.dtype!=="complex64")throw new Error(`Cannot concatenate complex64 tensors with a tensor
with dtype `+s.dtype+". ")}),r=de(r,e[0].shape)[0];var t=qn(e.map(function(s){return s.shape}),r);if(le(t)===0)return Ur([],t);if((e=e.filter(function(s){return s.size>0})).length===1)return e[0];var o=e.map(function(s){return s.shape});ji(o,r);var a=e,i={axis:r};return Ve.runKernelFunc(function(s){return s.concat(e,r)},a,function(s){var u=o.map(function(f){return f[r]});return Bo(s,u,r).map(function(f){return function(){return f}})},"Concat",i)}}),Os=Xe({concat1d_:function(n){return hn(n,0)}}),Rs=Xe({concat2d_:function(n,r){return hn(n,r)}}),ha=Xe({concat3d_:function(n,r){return hn(n,r)}}),Is=Xe({concat4d_:function(n,r){return hn(n,r)}}),Bo=Xe({split_:function(n,r,e){e===void 0&&(e=0);var t,o=Oe(n,"x","split");return e=de(e,o.shape)[0],typeof r=="number"?(_(o.shape[e]%r==0,function(){return"Number of splits must evenly divide the axis."}),t=new Array(r).fill(o.shape[e]/r)):(_(o.shape[e]===r.reduce(function(a,i){return a+i}),function(){return"The sum of sizes must match the size of the axis dimension."}),t=r),Ve.runKernelFunc(function(a){return a.split(o,t,e)},{$x:o},function(a){return{$x:function(){return hn(a,e)}}})}});typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof y!="undefined"||typeof self!="undefined"&&self;function Qr(n,r){return n(r={exports:{}},r.exports),r.exports}var Pn=Qr(function(n){!function(r,e,t){function o(s){var u,f=this,C=(u=4022871197,function(k){k=k.toString();for(var L=0;L<k.length;L++){var X=.02519603282416938*(u+=k.charCodeAt(L));X-=u=X>>>0,u=(X*=u)>>>0,u+=4294967296*(X-=u)}return 23283064365386963e-26*(u>>>0)});f.next=function(){var k=2091639*f.s0+23283064365386963e-26*f.c;return f.s0=f.s1,f.s1=f.s2,f.s2=k-(f.c=0|k)},f.c=1,f.s0=C(" "),f.s1=C(" "),f.s2=C(" "),f.s0-=C(s),f.s0<0&&(f.s0+=1),f.s1-=C(s),f.s1<0&&(f.s1+=1),f.s2-=C(s),f.s2<0&&(f.s2+=1),C=null}function a(s,u){return u.c=s.c,u.s0=s.s0,u.s1=s.s1,u.s2=s.s2,u}function i(s,u){var f=new o(s),C=u&&u.state,k=f.next;return k.int32=function(){return 4294967296*f.next()|0},k.double=function(){return k()+11102230246251565e-32*(2097152*k()|0)},k.quick=k,C&&(typeof C=="object"&&a(C,f),k.state=function(){return a(f,{})}),k}e&&e.exports?e.exports=i:t&&t.amd?t(function(){return i}):this.alea=i}(0,n,!1)}),Ns=Qr(function(n){!function(r,e,t){function o(s){var u=this,f="";u.x=0,u.y=0,u.z=0,u.w=0,u.next=function(){var k=u.x^u.x<<11;return u.x=u.y,u.y=u.z,u.z=u.w,u.w^=u.w>>>19^k^k>>>8},s===(0|s)?u.x=s:f+=s;for(var C=0;C<f.length+64;C++)u.x^=0|f.charCodeAt(C),u.next()}function a(s,u){return u.x=s.x,u.y=s.y,u.z=s.z,u.w=s.w,u}function i(s,u){var f=new o(s),C=u&&u.state,k=function(){return(f.next()>>>0)/4294967296};return k.double=function(){do var L=((f.next()>>>11)+(f.next()>>>0)/4294967296)/(1<<21);while(L===0);return L},k.int32=f.next,k.quick=k,C&&(typeof C=="object"&&a(C,f),k.state=function(){return a(f,{})}),k}e&&e.exports?e.exports=i:t&&t.amd?t(function(){return i}):this.xor128=i}(0,n,!1)}),Ds=Qr(function(n){!function(r,e,t){function o(s){var u=this,f="";u.next=function(){var k=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^k^k<<1)|0},u.x=0,u.y=0,u.z=0,u.w=0,u.v=0,s===(0|s)?u.x=s:f+=s;for(var C=0;C<f.length+64;C++)u.x^=0|f.charCodeAt(C),C==f.length&&(u.d=u.x<<10^u.x>>>4),u.next()}function a(s,u){return u.x=s.x,u.y=s.y,u.z=s.z,u.w=s.w,u.v=s.v,u.d=s.d,u}function i(s,u){var f=new o(s),C=u&&u.state,k=function(){return(f.next()>>>0)/4294967296};return k.double=function(){do var L=((f.next()>>>11)+(f.next()>>>0)/4294967296)/(1<<21);while(L===0);return L},k.int32=f.next,k.quick=k,C&&(typeof C=="object"&&a(C,f),k.state=function(){return a(f,{})}),k}e&&e.exports?e.exports=i:t&&t.amd?t(function(){return i}):this.xorwow=i}(0,n,!1)}),ks=Qr(function(n){!function(r,e,t){function o(s){var u=this;u.next=function(){var f,C,k=u.x,L=u.i;return f=k[L],C=(f^=f>>>7)^f<<24,C^=(f=k[L+1&7])^f>>>10,C^=(f=k[L+3&7])^f>>>3,C^=(f=k[L+4&7])^f<<7,f=k[L+7&7],C^=(f^=f<<13)^f<<9,k[L]=C,u.i=L+1&7,C},function(f,C){var k,L=[];if(C===(0|C))L[0]=C;else for(C=""+C,k=0;k<C.length;++k)L[7&k]=L[7&k]<<15^C.charCodeAt(k)+L[k+1&7]<<13;for(;L.length<8;)L.push(0);for(k=0;k<8&&L[k]===0;++k);for(k==8?L[7]=-1:L[k],f.x=L,f.i=0,k=256;k>0;--k)f.next()}(u,s)}function a(s,u){return u.x=s.x.slice(),u.i=s.i,u}function i(s,u){s==null&&(s=+new Date);var f=new o(s),C=u&&u.state,k=function(){return(f.next()>>>0)/4294967296};return k.double=function(){do var L=((f.next()>>>11)+(f.next()>>>0)/4294967296)/(1<<21);while(L===0);return L},k.int32=f.next,k.quick=k,C&&(C.x&&a(C,f),k.state=function(){return a(f,{})}),k}e&&e.exports?e.exports=i:t&&t.amd?t(function(){return i}):this.xorshift7=i}(0,n,!1)}),Ms=Qr(function(n){!function(r,e,t){function o(s){var u=this;u.next=function(){var f,C,k=u.w,L=u.X,X=u.i;return u.w=k=k+1640531527|0,C=L[X+34&127],f=L[X=X+1&127],C^=C<<13,f^=f<<17,C^=C>>>15,f^=f>>>12,C=L[X]=C^f,u.i=X,C+(k^k>>>16)|0},function(f,C){var k,L,X,oe,ue,se=[],ce=128;for(C===(0|C)?(L=C,C=null):(C+="\0",L=0,ce=Math.max(ce,C.length)),X=0,oe=-32;oe<ce;++oe)C&&(L^=C.charCodeAt((oe+32)%C.length)),oe===0&&(ue=L),L^=L<<10,L^=L>>>15,L^=L<<4,L^=L>>>13,oe>=0&&(ue=ue+1640531527|0,X=(k=se[127&oe]^=L+ue)==0?X+1:0);for(X>=128&&(se[127&(C&&C.length||0)]=-1),X=127,oe=512;oe>0;--oe)L=se[X+34&127],k=se[X=X+1&127],L^=L<<13,k^=k<<17,L^=L>>>15,k^=k>>>12,se[X]=L^k;f.w=ue,f.X=se,f.i=X}(u,s)}function a(s,u){return u.i=s.i,u.w=s.w,u.X=s.X.slice(),u}function i(s,u){s==null&&(s=+new Date);var f=new o(s),C=u&&u.state,k=function(){return(f.next()>>>0)/4294967296};return k.double=function(){do var L=((f.next()>>>11)+(f.next()>>>0)/4294967296)/(1<<21);while(L===0);return L},k.int32=f.next,k.quick=k,C&&(C.X&&a(C,f),k.state=function(){return a(f,{})}),k}e&&e.exports?e.exports=i:t&&t.amd?t(function(){return i}):this.xor4096=i}(0,n,!1)}),Ui=Qr(function(n){!function(r,e,t){function o(s){var u=this,f="";u.next=function(){var k=u.b,L=u.c,X=u.d,oe=u.a;return k=k<<25^k>>>7^L,L=L-X|0,X=X<<24^X>>>8^oe,oe=oe-k|0,u.b=k=k<<20^k>>>12^L,u.c=L=L-X|0,u.d=X<<16^L>>>16^oe,u.a=oe-k|0},u.a=0,u.b=0,u.c=-1640531527,u.d=1367130551,s===Math.floor(s)?(u.a=s/4294967296|0,u.b=0|s):f+=s;for(var C=0;C<f.length+20;C++)u.b^=0|f.charCodeAt(C),u.next()}function a(s,u){return u.a=s.a,u.b=s.b,u.c=s.c,u.d=s.d,u}function i(s,u){var f=new o(s),C=u&&u.state,k=function(){return(f.next()>>>0)/4294967296};return k.double=function(){do var L=((f.next()>>>11)+(f.next()>>>0)/4294967296)/(1<<21);while(L===0);return L},k.int32=f.next,k.quick=k,C&&(typeof C=="object"&&a(C,f),k.state=function(){return a(f,{})}),k}e&&e.exports?e.exports=i:t&&t.amd?t(function(){return i}):this.tychei=i}(0,n,!1)}),wn=Qr(function(n){!function(r,e){var t,o=this,a=256,i=6,s="random",u=e.pow(a,i),f=e.pow(2,52),C=2*f,k=a-1;function L(ce,xe,we){var Ee=[],Se=ue(function Be(je,Ue){var Ze,Je=[],ht=typeof je;if(Ue&&ht=="object")for(Ze in je)try{Je.push(Be(je[Ze],Ue-1))}catch(ft){}return Je.length?Je:ht=="string"?je:je+"\0"}((xe=xe==1?{entropy:!0}:xe||{}).entropy?[ce,se(r)]:ce==null?function(){try{var Be;return t&&(Be=t.randomBytes)?Be=Be(a):(Be=new Uint8Array(a),(o.crypto||o.msCrypto).getRandomValues(Be)),se(Be)}catch(Ze){var je=o.navigator,Ue=je&&je.plugins;return[+new Date,o,Ue,o.screen,se(r)]}}():ce,3),Ee),Me=new X(Ee),ze=function(){for(var Be=Me.g(i),je=u,Ue=0;Be<f;)Be=(Be+Ue)*a,je*=a,Ue=Me.g(1);for(;Be>=C;)Be/=2,je/=2,Ue>>>=1;return(Be+Ue)/je};return ze.int32=function(){return 0|Me.g(4)},ze.quick=function(){return Me.g(4)/4294967296},ze.double=ze,ue(se(Me.S),r),(xe.pass||we||function(Be,je,Ue,Ze){return Ze&&(Ze.S&&oe(Ze,Me),Be.state=function(){return oe(Me,{})}),Ue?(e[s]=Be,je):Be})(ze,Se,"global"in xe?xe.global:this==e,xe.state)}function X(ce){var xe,we=ce.length,Ee=this,Se=0,Me=Ee.i=Ee.j=0,ze=Ee.S=[];for(we||(ce=[we++]);Se<a;)ze[Se]=Se++;for(Se=0;Se<a;Se++)ze[Se]=ze[Me=k&Me+ce[Se%we]+(xe=ze[Se])],ze[Me]=xe;(Ee.g=function(Be){for(var je,Ue=0,Ze=Ee.i,Je=Ee.j,ht=Ee.S;Be--;)je=ht[Ze=k&Ze+1],Ue=Ue*a+ht[k&(ht[Ze]=ht[Je=k&Je+je])+(ht[Je]=je)];return Ee.i=Ze,Ee.j=Je,Ue})(a)}function oe(ce,xe){return xe.i=ce.i,xe.j=ce.j,xe.S=ce.S.slice(),xe}function ue(ce,xe){for(var we,Ee=ce+"",Se=0;Se<Ee.length;)xe[k&Se]=k&(we^=19*xe[k&Se])+Ee.charCodeAt(Se++);return se(xe)}function se(ce){return String.fromCharCode.apply(0,ce)}if(e["seed"+s]=L,ue(e.random(),r),n.exports){n.exports=L;try{t=N(5)}catch(ce){}}}([],Math)});wn.alea=Pn,wn.xor128=Ns,wn.xorwow=Ds,wn.xorshift7=ks,wn.xor4096=Ms,wn.tychei=Ui;var Uo=wn.alea,pa=function(){function n(r,e,t,o,a){this.mean=r,this.stdDev=e,this.dtype=t,this.nextVal=NaN,this.truncated=o,this.truncated&&(this.upper=this.mean+2*this.stdDev,this.lower=this.mean-2*this.stdDev);var i=a||Math.random();this.random=Uo(i.toString())}return n.prototype.nextValue=function(){if(!isNaN(this.nextVal)){var r=this.nextVal;return this.nextVal=NaN,r}for(var e,t,o=!1;!o;){var a=void 0,i=void 0,s=void 0;do s=(a=2*this.random()-1)*a+(i=2*this.random()-1)*i;while(s>=1||s===0);var u=Math.sqrt(-2*Math.log(s)/s);e=this.mean+this.stdDev*a*u,t=this.mean+this.stdDev*i*u,this.truncated&&!this.isValidTruncated(e)||(o=!0)}return this.truncated&&!this.isValidTruncated(t)||(this.nextVal=this.convertValue(t)),this.convertValue(e)},n.prototype.convertValue=function(r){return this.dtype==null||this.dtype==="float32"?r:Math.round(r)},n.prototype.isValidTruncated=function(r){return r<=this.upper&&r>=this.lower},n}(),uc=function(){function n(r,e,t,o){this.alpha=r,this.beta=1/e,this.dtype=t;var a=o||Math.random();this.randu=Uo(a.toString()),this.randn=new pa(0,1,t,!1,this.randu()),this.d=r<1?r+2/3:r-1/3,this.c=1/Math.sqrt(9*this.d)}return n.prototype.nextValue=function(){for(var r,e,t,o,a,i;;){do o=this.randn.nextValue(),i=1+this.c*o;while(i<=0);if(i*=i*i,e=1-.331*(r=o*o)*r,t=.5*r+this.d*(1-i+Math.log(i)),(a=this.randu())<e||Math.log(a)<t)break}return i=1/this.beta*this.d*i,this.alpha<1&&(i*=Math.pow(this.randu(),1/this.alpha)),this.convertValue(i)},n.prototype.convertValue=function(r){return this.dtype==="float32"?r:Math.round(r)},n}(),Wi=function(){function n(r,e,t,o){var a=this;if(r===void 0&&(r=0),e===void 0&&(e=1),this.canReturnFloat=function(){return a.dtype==null||a.dtype==="float32"},this.min=r,this.range=e-r,this.dtype=t,o==null&&(o=Math.random()),typeof o=="number"&&(o=o.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error("The difference between "+r+" - "+e+" <= 1 and dtype is not float");this.random=Uo(o)}return n.prototype.convertValue=function(r){return this.canReturnFloat()?r:Math.round(r)},n.prototype.nextValue=function(){return this.convertValue(this.min+this.range*this.random())},n}();function Lt(n,r,e){return r===void 0&&(r="float32"),r=r||"float32",ve(n),new Nr(n,r,e)}function ma(n,r){r===void 0&&(r=!1),console.log(n.toString(r))}var va=Xe({batchToSpaceND_:function(n,r,e){var t=Oe(n,"x","batchToSpaceND"),o=r.reduce(function(a,i){return a*i});return _(t.rank>=1+r.length,function(){return"input rank is "+t.rank+" but should be > than blockShape.length "+r.length}),_(e.length===r.length,function(){return"crops.length is "+e.length+" but should be equal to blockShape.length "+r.length}),_(t.shape[0]%o==0,function(){return"input tensor batch is "+t.shape[0]+" but is not divisible by the product of the elements of blockShape "+r.join(" * ")+" === "+o}),Ve.runKernelFunc(function(a){return a.batchToSpaceND(t,r,e)},{$x:t},function(a){return{$x:function(){return a.spaceToBatchND(r,e)}}})}}),Ps=Xe({broadcastTo_:function(n,r){var e=Oe(n,"broadcastTo","x"),t=e.shape;if(r.some(function(u){return!(u>0)||u%1!=0}))throw new Error("broadcastTo(): Invalid broadcast shape ["+r+"].");if(r.length<e.rank)throw new Error("broadcastTo(): shape.length="+r.length+" < input.rank="+e.rank+".");if(r.length>e.rank){for(var o=e.shape.slice();o.length<r.length;)o.unshift(1);e=e.reshape(o)}for(var a=Array.from(r),i=r.length-1;i>=0;i--)if(e.shape[i]===r[i])a[i]=1;else if(e.shape[i]!==1)throw new Error("broadcastTo(): ["+t+"] cannot be broadcast to ["+r+"].");var s=a.map(function(u,f){return u>1?f:-1}).filter(function(u){return u>=0});return s.length===0?e.clone():Ve.runKernelFunc(function(u){return u.tile(e,a)},{input:e},function(u){return{input:function(){return u.sum(s,!0)}}})}}),ga=Xe({cast_:function(n,r){var e=Oe(n,"x","cast");if(!Ye(r))throw new Error("Failed to cast to unknown dtype "+r);if(r==="string"&&e.dtype!=="string"||r!=="string"&&e.dtype==="string")throw new Error("Only strings can be casted to strings");var t={dtype:r};return Ve.runKernelFunc(function(o){return o.cast(e,r)},{x:e},function(o){return{x:function(){return o.clone()}}},"Cast",t)}}),ya=Xe({clone_:function(n){var r=Oe(n,"x","clone",null);return Ve.runKernelFunc(function(){return Ve.makeTensorFromDataId(r.dataId,r.shape,r.dtype)},{$x:r},function(e){return{$x:function(){return e.toFloat()}}})}}),Fs=Xe({cumsum_:function(n,r,e,t){r===void 0&&(r=0),e===void 0&&(e=!1),t===void 0&&(t=!1);var o=Oe(n,"x","cumsum"),a=sn([r|=0],o.rank),i=o;a!=null&&(i=o.transpose(a));var s=fn(1,o.rank)[0],u=Ve.runKernelFunc(function(f){return f.cumsum(i,s,e,t)},{permutedX:i},function(f){return{permutedX:function(){return f.cumsum(r,e,!t)}}});return a!=null&&(u=u.transpose(a)),u}}),Ls=Xe({depthToSpace_:function(n,r,e){e===void 0&&(e="NHWC");var t=Oe(n,"x","depthToSpace"),o=e==="NHWC"?t.shape[1]:t.shape[2],a=e==="NHWC"?t.shape[2]:t.shape[3],i=e==="NHWC"?t.shape[3]:t.shape[1];return _(o*r>=0,function(){return`Negative dimension size caused by overflow when multiplying
`+o+" and "+r+` for depthToSpace with input shape
`+t.shape}),_(a*r>=0,function(){return`Negative dimension size caused by overflow when multiplying
`+a+" and "+r+` for depthToSpace with input shape
`+t.shape}),_(i%(r*r)==0,function(){return"Dimension size must be evenly divisible by "+r*r+" but is "+i+" for depthToSpace with input shape "+t.shape}),Ve.runKernelFunc(function(s){return s.depthToSpace(t,r,e)},{$x:t})}}),On=Xe({expandDims_:function(n,r){r===void 0&&(r=0);var e=Oe(n,"x","expandDims",null);_(r<=e.rank,function(){return"Axis must be <= rank of the tensor"});var t=e.shape.slice();return r<0&&(_(-(e.rank+1)<=r,function(){return"Axis must be in the interval ["+-(e.rank+1)+", "+e.rank+"]"}),r=e.rank+r+1),t.splice(r,0,1),ba(e,t)}}),Hi=Xe({eye_:function(n,r,e,t){t===void 0&&(t="float32"),r==null&&(r=n);for(var o=Lt([n,r],t),a=n<=r?n:r,i=0;i<a;++i)o.set(1,i,i);var s=o.toTensor().as2D(n,r);if(e==null)return s;if(e.length===1)return eo(On(s,0),[e[0],1,1]);if(e.length===2)return eo(On(On(s,0),0),[e[0],e[1],1,1]);if(e.length===3)return eo(On(On(On(s,0),0),0),[e[0],e[1],e[2],1,1]);throw new Error("eye() currently supports only 1D and 2D batchShapes, but received "+e.length+"D.")}}),ti=Xe({multinomial_:function(n,r,e,t){t===void 0&&(t=!1);var o=Oe(n,"logits","multinomial"),a=o.size,i=o.rank;if(a<2)throw new Error("Error in multinomial: you need at least 2 outcomes, but got "+a+".");if(i>2)throw new Error("Rank of probabilities must be 1 or 2, but is "+i);e=e||Math.random();var s=i===1?o.as2D(1,-1):o,u=Ve.runKernelFunc(function(f){return f.multinomial(s,t,r,e)},{logits2D:s});return i===1?u.as1D():u}}),ri=Xe({oneHot_:function(n,r,e,t){if(e===void 0&&(e=1),t===void 0&&(t=0),r<2)throw new Error("Error in oneHot: depth must be >=2, but it is "+r);var o=Oe(n,"indices","oneHot","int32"),a=o.shape.concat([r]);return o=o.flatten(),Ve.runKernelFunc(function(i){return i.oneHot(o,r,e,t)},{$indices:o},function(i){return{$indices:function(){return Tr(o.shape,"float32")}}}).reshape(a)}}),Fn=Xe({pad_:function(n,r,e){e===void 0&&(e=0);var t=Oe(n,"x","pad");if(t.rank===0)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");var o={paddings:r,constantValue:e};return Ve.runKernelFunc(function(a){return a.pad(t,r,e)},{x:t},function(a){var i=r.map(function(s){return s[0]});return{x:function(){return a.slice(i,t.shape)}}},"PadV2",o)}}),zi=Xe({pad1d_:function(n,r,e){return e===void 0&&(e=0),_(r.length===2,function(){return"Invalid number of paddings. Must be length of 2."}),Fn(n,[r],e)}}),Eo=Xe({pad2d_:function(n,r,e){return e===void 0&&(e=0),_(r.length===2&&r[0].length===2&&r[1].length===2,function(){return"Invalid number of paddings. Must be length of 2 each."}),Fn(n,r,e)}}),ni=Xe({pad3d_:function(n,r,e){return e===void 0&&(e=0),_(r.length===3&&r[0].length===2&&r[1].length===2&&r[2].length===2,function(){return"Invalid number of paddings. Must be length of 2 each."}),Fn(n,r,e)}}),js=Xe({pad4d_:function(n,r,e){return e===void 0&&(e=0),_(r.length===4&&r[0].length===2&&r[1].length===2&&r[2].length===2&&r[3].length===2,function(){return"Invalid number of paddings. Must be length of 2 each."}),Fn(n,r,e)}}),Bs=Xe({rand_:function(n,r,e){var t=le(n),o=null;if(e==null||e==="float32")o=new Float32Array(t);else if(e==="int32")o=new Int32Array(t);else{if(e!=="bool")throw new Error("Unknown data type "+e);o=new Uint8Array(t)}for(var a=0;a<t;a++)o[a]=r();return Ve.makeTensor(o,n,e)}}),Us=Xe({randomNormal_:function(n,r,e,t,o){if(r===void 0&&(r=0),e===void 0&&(e=1),t!=null&&t==="bool")throw new Error("Unsupported data type "+t);for(var a=new pa(r,e,t,!1,o),i=Lt(n,t),s=0;s<i.values.length;s++)i.values[s]=a.nextValue();return i.toTensor()}}),Ws=Xe({randomGamma_:function(n,r,e,t,o){if(e===void 0&&(e=1),t===void 0&&(t="float32"),e==null&&(e=1),t==null&&(t="float32"),t!=="float32"&&t!=="int32")throw new Error("Unsupported data type "+t);for(var a=new uc(r,e,t,o),i=Lt(n,t),s=0;s<i.values.length;s++)i.values[s]=a.nextValue();return i.toTensor()}}),oi=Xe({randomUniform_:function(n,r,e,t,o){r===void 0&&(r=0),e===void 0&&(e=1),t===void 0&&(t="float32");for(var a=Lt(n,t),i=new Wi(r,e,null,o),s=0;s<a.values.length;s++)a.values[s]=i.nextValue();return a.toTensor()}}),ba=Xe({reshape_:function(n,r){var e=Oe(n,"x","reshape",null);r=ie(r,e.size),_(e.size===le(r),function(){return"new shape and old shape must have the same number of elements."});var t={shape:r};return Ve.runKernelFunc(function(o){return o.reshape(e,r)},{x:e},function(o){return{x:function(){return o.reshape(e.shape)}}},"Reshape",t)}}),Gi=Xe({spaceToBatchND_:function(n,r,e){var t=Oe(n,"x","spaceToBatchND");return _(t.rank>=1+r.length,function(){return"input rank "+t.rank+" should be > than [blockShape] "+r.length}),_(e.length===r.length,function(){return"paddings.shape[0] "+e.length+" must be equal to [blockShape] "+r.length}),_(t.shape.reduce(function(o,a,i){return i>0&&i<=r.length?o&&(a+e[i-1][0]+e[i-1][1])%r[i-1]==0:o},!0),function(){return"input spatial dimensions "+t.shape.slice(1)+" with paddings "+e.toString()+" must be divisible by blockShapes "+r.toString()}),Ve.runKernelFunc(function(o){return o.spaceToBatchND(t,r,e)},{$x:t},function(o){return{$x:function(){return o.batchToSpaceND(r,e)}}})}}),Vi=Xe({squeeze_:function(n,r){var e=Oe(n,"x","squeeze");return ba(e,ee(e.shape,r).newShape)}}),Ln=Xe({stack_:function(n,r){r===void 0&&(r=0);var e=yo(n,"tensors","stack");if(_(e.length>=1,function(){return"Pass at least one tensor to tf.stack"}),e.length===1)return e[0].expandDims(r);var t=e[0].rank,o=e[0].shape,a=e[0].dtype;_(r<=t,function(){return"Axis must be <= rank of the tensor"}),e.forEach(function(s){Y(o,s.shape,"All tensors passed to stack must have matching shapes")}),e.forEach(function(s){_(a===s.dtype,function(){return"All tensors passed to stack must have matching dtypes"})});var i=e.map(function(s){return s.expandDims(r)});return hn(i,r)}}),eo=Xe({tile_:function(n,r){var e=Oe(n,"x","tile",null);_(e.rank===r.length,function(){return"Error in transpose: rank of input "+e.rank+" must match length of reps "+r+"."});var t=[e],o={reps:r};return Ve.runKernelFunc(function(a,i){var s=a.tile(e,r);return i([e]),s},{x:e},function(a,i){var s=i[0];return{x:function(){var u=Jt(s);if(s.rank===1)for(var f=0;f<r[0];++f)u=u.add(a.slice([f*s.shape[0]],[s.shape[0]]));else if(s.rank===2)for(f=0;f<r[0];++f)for(var C=0;C<r[1];++C)u=u.add(a.slice([f*s.shape[0],C*s.shape[1]],[s.shape[0],s.shape[1]]));else if(s.rank===3)for(f=0;f<r[0];++f)for(C=0;C<r[1];++C)for(var k=0;k<r[2];++k)u=u.add(a.slice([f*s.shape[0],C*s.shape[1],k*s.shape[2]],[s.shape[0],s.shape[1],s.shape[2]]));else{if(s.rank!==4)throw new Error("Gradient for tile operation is not implemented for rank-"+s.rank+" tensors yet.");for(f=0;f<r[0];++f)for(C=0;C<r[1];++C)for(k=0;k<r[2];++k)for(var L=0;L<r[3];++L)u=u.add(a.slice([f*s.shape[0],C*s.shape[1],k*s.shape[2],L*s.shape[3]],[s.shape[0],s.shape[1],s.shape[2],s.shape[3]]))}return u}}},"Tile",o,t)}}),Hs=Xe({truncatedNormal_:function(n,r,e,t,o){if(r===void 0&&(r=0),e===void 0&&(e=1),t!=null&&t==="bool")throw new Error("Unsupported data type "+t);for(var a=new pa(r,e,t,!0,o),i=Lt(n,t),s=0;s<i.values.length;s++)i.values[s]=a.nextValue();return i.toTensor()}}),xa=Xe({unstack_:function(n,r){r===void 0&&(r=0),r=r||0;var e=Oe(n,"x","unstack");_(r>=-e.shape.length&&r<e.shape.length,function(){return"Axis = "+r+" is not in [-"+e.shape.length+", "+e.shape.length+")"}),r<0&&(r+=e.shape.length);var t={axis:r};return Ve.runKernelFunc(function(o){return o.unstack(e,r)},{x:e},function(o){return{x:function(){return Ln(o,r)}}},"Unpack",t)}}),zs=function(n,r){return E(this,void 0,void 0,function(){var e,t,o,a,i,s,u,f,C,k;return g(this,function(L){switch(L.label){case 0:return e=Oe(n,"x","setdiff1d"),t=Oe(r,"y","setdiff1d"),_(e.dtype===t.dtype,function(){return"x and y should have the same dtype, but got x ("+e.dtype+") and y ("+t.dtype+")."}),_(e.rank===1,function(){return"x should be 1D tensor, but got x ("+e.shape+")."}),_(t.rank===1,function(){return"y should be 1D tensor, but got y ("+t.shape+")."}),[4,e.data()];case 1:return o=L.sent(),[4,t.data()];case 2:for(a=L.sent(),i=new Set(a),s=0,C=0;C<o.length;C++)i.has(o[C])||s++;for(u=new Nr([s],e.dtype),f=new Nr([s],"int32"),C=0,k=0;C<o.length;C++)i.has(o[C])||(u.values[k]=o[C],f.values[k]=C,k++);return[2,[u.toTensor(),f.toTensor()]]}})})};function Wo(n,r,e,t){t===void 0&&(t=!0);var o=[];if(t)(o=o.concat(r.slice(0))).push(n[0]/e),o=o.concat(n.slice(1));else{o=o.concat(n[0]);for(var a=r.length,i=0;i<a;++i)o=o.concat([n[i+1]/r[i],r[i]]);o=o.concat(n.slice(a+1))}return o}function qt(n,r,e){e===void 0&&(e=!0);var t=[];if(e){t.push(r);for(var o=r+1;o<n;++o)o<=2*r?(t.push(o),t.push(o-(r+1))):t.push(o)}else{var a=[],i=[];for(o=1;o<n;++o)o>=2*r+1||o%2==1?i.push(o):a.push(o);t.push.apply(t,a),t.push(0),t.push.apply(t,i)}return t}function wa(n,r,e,t){t===void 0&&(t=!0);var o=[];t?o.push(n[0]/e):o.push(n[0]*e);for(var a=1;a<n.length;++a)a<=r.length?t?o.push(r[a-1]*n[a]):o.push(n[a]/r[a-1]):o.push(n[a]);return o}function Gs(n,r){for(var e=[0],t=0;t<r;++t)e.push(n[t][0]);return e}function Vs(n,r,e){for(var t=n.slice(0,1),o=0;o<e;++o)t.push(n[o+1]-r[o][0]-r[o][1]);return t}function Xi(n,r){if(n.rank<1)throw new Error("tf.gatherND() expects the input to be rank 1 or higher, but the rank was "+n.rank+".");if(r.rank<1)throw new Error("tf.gatherND() expects the indices to be rank 1 or higher, but the rank was "+r.rank+".");if(r.dtype!=="int32")throw new Error("tf.gatherND() expects the indices to be int32 type, but the dtype was "+r.dtype+".");if(r.shape[r.rank-1]>n.rank)throw new Error("index innermost dimension length must be <= tensor rank; saw: "+r.shape[r.rank-1]+" vs. "+n.rank);if(n.size===0)throw new Error("Requested more than 0 entries, but input is empty. Input shape: "+n.shape+".");for(var e=r.shape,t=e[e.length-1],o=1,a=0;a<e.length-1;++a)o*=e[a];var i=n.shape,s=e.slice();s.pop();var u=1;for(a=t;a<n.rank;++a)u*=i[a],s.push(i[a]);var f=Ke(n.shape).map(function(C){return C/u}).concat([1]).slice(0,t);return[s,o,u,f]}var cc=Object.freeze({prepareAndValidate:Xi}),Ki=30;function ai(n){return n<=Ki?n:be(n,Math.floor(Math.sqrt(n)))}function Xs(n,r,e){var t=r.rank>1?r.shape[r.rank-1]:1,o=r.rank>1?r.rank-1:1,a="Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: "+e.shape+", indices.shape: "+r.shape+", shape: "+n+", sliceDim: "+t+", and batchDim: "+o+".";if(e.rank<o)throw new Error(a+" update.rank < "+o+". ");if(n.length<t+(e.rank-o))throw new Error(a+" Output shape length < "+(t+(e.rank-o)));if(e.rank!==o+n.length-t)throw new Error(a+" update.rank != "+(o+n.length-t));for(var i=0;i<o;++i)if(e.shape[i]!==r.shape[i])throw new Error(a+" updates.shape["+i+"] ("+e.shape[i]+") != indices.shape["+i+"] ("+r.shape[i]+").");for(i=0;i<e.rank-o;++i)if(e.shape[i+o]!==n[i+t])throw new Error(a+" updates.shape["+(i+o)+"] ("+e.shape[i+o]+") != shape["+(i+o)+"] ("+n[i+o]+")")}function Ks(n,r,e){if(r.rank<1)throw new Error("tf.scatterND() expects the indices to be rank 1 or higher, but the rank was "+r.rank+".");if(n.rank<1)throw new Error("tf.scatterND() expects the updates to be rank 1 or higher, but the rank was "+n.rank+".");if(r.dtype!=="int32")throw new Error("The dtype of 'indices' should be int32, but got dtype: "+r.dtype);if(e.length<1)throw new Error("Output rank must be greater or equal to 1, but got shape: "+e);if(e.length===0){if(r.size===0)throw new Error("Indices specified for empty output. indices shape: "+r.shape);if(n.size===0)throw new Error("Updates specified for empty output. updates shape: "+n.shape)}Xs(e,r,n)}function Ho(n,r,e){for(var t=r.shape.length,o=t>1?r.shape[t-1]:1,a=e.length,i=1,s=o;s<a;++s)i*=e[s];var u=o<1?1:o;return{sliceRank:o,numUpdates:le(r.shape)/u,sliceSize:i,strides:Ke(e.slice(0,o)).concat([1]),outputSize:le(e)}}var lc=Object.freeze({validateUpdateShape:Xs,validateInput:Ks,calculateShapes:Ho});function Ys(n,r,e){_(n.rank===r.length,function(){return"Error in slice"+n.rank+"D: Length of begin "+r+" must match the rank of the array ("+n.rank+")."}),_(n.rank===e.length,function(){return"Error in slice"+n.rank+"D: Length of size "+e+" must match the rank of the array ("+n.rank+")."});for(var t=function(a){_(r[a]+e[a]<=n.shape[a],function(){return"Error in slice"+n.rank+"D: begin["+a+"] + size["+a+"] ("+(r[a]+e[a])+") would overflow input.shape["+a+"] ("+n.shape[a]+")"})},o=0;o<n.rank;++o)t(o)}function Yi(n){for(var r=[],e=0;n>0;)1&n&&r.push(e),n/=2,e++;return r}function Ea(n,r,e){for(var t=[],o=0;o<n.length;o++)t[o]=Math.ceil((r[o]-n[o])/e[o]);return t}function $s(n,r,e,t,o){var a=r[o],i=e[o]||1;(n&1<<o||a==null)&&(a=i>0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);var s=t[o];return a<0&&(a+=s),a=T(0,a,s-1)}function $i(n,r,e,t,o){var a=r[o],i=e[o]||1;(n&1<<o||a==null)&&(a=i>0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);var s=t[o];return a<0&&(a+=s),a=i>0?T(0,a,s):T(-1,a,s-1)}function Ji(n,r,e){for(var t=e.length,o=0;o<e.length;o++)if(e[o]>1){t=o;break}for(o=t+1;o<e.length;o++)if(r[o]>0||e[o]!==n[o])return!1;return!0}function qi(n,r){for(var e=n.length>0?n[n.length-1]:1,t=0;t<n.length-1;t++)e+=n[t]*r[t];return e}var id=Object.freeze({assertParamsValid:Ys,maskToAxes:Yi,computeOutShape:Ea,startForAxis:$s,stopForAxis:$i,isSliceContinous:Ji,computeFlatOffset:qi});function sd(n){return _(ye(n),function(){return"The f passed in grad(f) must be a function"}),function(r,e){var t=Oe(r,"x","tf.grad",null),o=e!=null?Oe(e,"dy","tf.grad"):null;return Ve.tidy(function(){var a=Ve.gradients(function(){return n(t)},[t],o),i=a.value,s=a.grads;return o!=null&&Y(i.shape,o.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),Co(s),s[0]})}}function ud(n){return _(ye(n),function(){return"The f passed in grads(f) must be a function"}),function(r,e){_(Array.isArray(r),function(){return"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s"});var t=yo(r,"args","tf.grads",null),o=e!=null?Oe(e,"dy","tf.grads"):null;return Ve.tidy(function(){var a=Ve.gradients(function(){return n.apply(void 0,t)},t,o),i=a.value,s=a.grads;return o!=null&&Y(i.shape,o.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Co(s),s})}}function Js(n){return _(ye(n),function(){return"The f passed in valueAndGrad(f) must be a function"}),function(r,e){_(r instanceof Dr,function(){return"The x passed in valueAndGrad(f)(x) must be a tensor"}),_(e==null||e instanceof Dr,function(){return"The dy passed in valueAndGrad(f)(x, dy) must be a tensor"});var t=Ve.gradients(function(){return n(r)},[r],e),o=t.grads,a=t.value;return Co(o),{grad:o[0],value:a}}}function Qi(n){return _(ye(n),function(){return"The f passed in valueAndGrads(f) must be a function"}),function(r,e){_(Array.isArray(r)&&r.every(function(o){return o instanceof Dr}),function(){return"The args passed in valueAndGrads(f)(args) must be array of tensors"}),_(e==null||e instanceof Dr,function(){return"The dy passed in valueAndGrads(f)(args, dy) must be a tensor"});var t=Ve.gradients(function(){return n.apply(void 0,r)},r,e);return e!=null&&Y(t.value.shape,e.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Co(t.grads),t}}function ii(n,r){_(ye(n),function(){return"The f passed in variableGrads(f) must be a function"}),_(r==null||Array.isArray(r)&&r.every(function(C){return C instanceof _n}),function(){return"The varList passed in variableGrads(f, varList) must be an array of variables"});var e=r!=null;if(!e)for(var t in r=[],Ve.registeredVariables)r.push(Ve.registeredVariables[t]);var o=e?r.filter(function(C){return!C.trainable}):null,a=r.length;_((r=r.filter(function(C){return C.trainable})).length>0,function(){return"variableGrads() expects at least one of the input variables to be trainable, but none of the "+a+" variables is trainable."});var i=Ve.gradients(n,r,null,!0),s=i.value,u=i.grads;_(u.some(function(C){return C!=null}),function(){return"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."}),_(s.rank===0,function(){return"The f passed in variableGrads(f) must return a scalar, but it returned a rank-"+s.rank+" tensor"});var f={};return r.forEach(function(C,k){u[k]!=null&&(f[C.name]=u[k])}),o!=null&&o.forEach(function(C){return f[C.name]=null}),{value:s,grads:f}}function _o(n){return Ve.customGrad(n)}function Co(n){if(n.filter(function(r){return r==null}).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.`)}var zo=Xe({softmax_:function(n,r){r===void 0&&(r=-1);var e=Oe(n,"logits","softmax","float32");if(r===-1&&(r=e.rank-1),r!==e.rank-1)throw Error("Softmax along a non-last dimension is not yet supported. Logits was rank "+e.rank+" and dim was "+r);return Ve.runKernelFunc(function(t,o){var a=t.softmax(e,r);return o([a]),a},{logits:e},function(t,o){var a=o[0],i=t.mul(a);return{logits:function(){return i.sub(i.sum([r],!0).mul(a))}}},"Softmax",{dim:r},[],[!0])}}),si=Xe({logSoftmax_:function(n,r){r===void 0&&(r=-1);var e=Oe(n,"logits","logSoftmax");if(r===-1&&(r=e.rank-1),r!==e.rank-1)throw Error("Log Softmax along a non-last dimension is not yet supported. Logits was rank "+e.rank+" and axis was "+r);return _o(function(t,o){var a=t.max(r,!0),i=t.sub(a),s=i.toFloat().sub(i.exp().sum(r,!0).log());return o([s]),{value:s,gradFunc:function(u,f){var C=f[0].exp();return u.sub(u.sum(r,!0).mul(C))}}})(e)}}),_a=function(){function n(r,e){this.backend=r,this.dataMover=e,this.data=new WeakMap,this.dataIdsCount=0}return n.prototype.get=function(r){return this.data.has(r)||this.dataMover.moveData(this.backend,r),this.data.get(r)},n.prototype.set=function(r,e){this.dataIdsCount++,this.data.set(r,e)},n.prototype.has=function(r){return this.data.has(r)},n.prototype.delete=function(r){return this.dataIdsCount--,this.data.delete(r)},n.prototype.numDataIds=function(){return this.dataIdsCount},n}(),Ca=function(){function n(){}return n.prototype.time=function(r){return rt("time")},n.prototype.read=function(r){return rt("read")},n.prototype.readSync=function(r){return rt("readSync")},n.prototype.numDataIds=function(){return rt("numDataIds")},n.prototype.disposeData=function(r){return rt("disposeData")},n.prototype.write=function(r,e,t){return rt("write")},n.prototype.move=function(r,e,t,o){return rt("move")},n.prototype.memory=function(){return rt("memory")},n.prototype.floatPrecision=function(){return rt("floatPrecision")},n.prototype.epsilon=function(){return this.floatPrecision()===32?1e-7:1e-4},n.prototype.batchMatMul=function(r,e,t,o){return rt("batchMatMul")},n.prototype.fusedBatchMatMul=function(r){return r.a,r.b,r.transposeA,r.transposeB,r.bias,r.activation,r.preluActivationWeights,rt("fusedBatchMatMul")},n.prototype.slice=function(r,e,t){return rt("slice")},n.prototype.stridedSlice=function(r,e,t,o){return rt("stridedSlice")},n.prototype.unstack=function(r,e){return rt("unstack")},n.prototype.reverse=function(r,e){return rt("reverse")},n.prototype.concat=function(r,e){return rt("concat")},n.prototype.neg=function(r){return rt("neg")},n.prototype.add=function(r,e){return rt("add")},n.prototype.addN=function(r){return rt("addN")},n.prototype.subtract=function(r,e){return rt("subtract")},n.prototype.multiply=function(r,e){return rt("multiply")},n.prototype.realDivide=function(r,e){return rt("realDivide")},n.prototype.floorDiv=function(r,e){return rt("floorDiv")},n.prototype.sum=function(r,e){return rt("sum")},n.prototype.prod=function(r,e){return rt("prod")},n.prototype.unsortedSegmentSum=function(r,e,t){return rt("unsortedSegmentSum")},n.prototype.argMin=function(r,e){return rt("argMin")},n.prototype.argMax=function(r,e){return rt("argMax")},n.prototype.equal=function(r,e){return rt("equal")},n.prototype.notEqual=function(r,e){return rt("notEqual")},n.prototype.less=function(r,e){return rt("less")},n.prototype.lessEqual=function(r,e){return rt("lessEqual")},n.prototype.greater=function(r,e){return rt("greater")},n.prototype.greaterEqual=function(r,e){return rt("greaterEqual")},n.prototype.logicalNot=function(r){return rt("logicalNot")},n.prototype.logicalAnd=function(r,e){return rt("logicalAnd")},n.prototype.logicalOr=function(r,e){return rt("logicalOr")},n.prototype.where=function(r){return rt("where")},n.prototype.select=function(r,e,t){return rt("select")},n.prototype.topk=function(r,e,t){return rt("topk")},n.prototype.min=function(r,e){return rt("min")},n.prototype.minimum=function(r,e){return rt("minimum")},n.prototype.mod=function(r,e){return rt("mod")},n.prototype.max=function(r,e){return rt("max")},n.prototype.maximum=function(r,e){return rt("maximum")},n.prototype.all=function(r,e){return rt("all")},n.prototype.any=function(r,e){return rt("any")},n.prototype.squaredDifference=function(r,e){return rt("squaredDifference")},n.prototype.ceil=function(r){return rt("ceil")},n.prototype.floor=function(r){return rt("floor")},n.prototype.round=function(r){return rt("round")},n.prototype.sign=function(r){return rt("sign")},n.prototype.isNaN=function(r){return rt("isNaN")},n.prototype.isInf=function(r){return rt("isInf")},n.prototype.isFinite=function(r){return rt("isFinite")},n.prototype.pow=function(r,e){return rt("pow")},n.prototype.exp=function(r){return rt("exp")},n.prototype.expm1=function(r){return rt("expm1")},n.prototype.softmax=function(r,e){return rt("softmax")},n.prototype.log=function(r){return rt("log")},n.prototype.log1p=function(r){return rt("log1p")},n.prototype.sqrt=function(r){return rt("sqrt")},n.prototype.rsqrt=function(r){return rt("rsqrt")},n.prototype.square=function(r){return rt("square")},n.prototype.reciprocal=function(r){return rt("reciprocal")},n.prototype.relu=function(r){return rt("relu")},n.prototype.relu6=function(r){return rt("relu6")},n.prototype.prelu=function(r,e){return rt("prelu")},n.prototype.elu=function(r){return rt("elu")},n.prototype.eluDer=function(r,e){return rt("eluDer")},n.prototype.selu=function(r){return rt("selu")},n.prototype.int=function(r){return rt("int")},n.prototype.clip=function(r,e,t){return rt("clip")},n.prototype.abs=function(r){return rt("abs")},n.prototype.complexAbs=function(r){return rt("complexAbs")},n.prototype.sigmoid=function(r){return rt("sigmoid")},n.prototype.softplus=function(r){return rt("softplus")},n.prototype.sin=function(r){return rt("sin")},n.prototype.cos=function(r){return rt("cos")},n.prototype.tan=function(r){return rt("tan")},n.prototype.asin=function(r){return rt("asin")},n.prototype.acos=function(r){return rt("acos")},n.prototype.atan=function(r){return rt("atan")},n.prototype.atan2=function(r,e){return rt("atan2")},n.prototype.sinh=function(r){return rt("sinh")},n.prototype.cosh=function(r){return rt("cosh")},n.prototype.tanh=function(r){return rt("tanh")},n.prototype.asinh=function(r){return rt("asinh")},n.prototype.acosh=function(r){return rt("acosh")},n.prototype.atanh=function(r){return rt("atanh")},n.prototype.erf=function(r){return rt("erf")},n.prototype.step=function(r,e){return rt("step")},n.prototype.fusedConv2d=function(r){return r.input,r.filter,r.convInfo,r.bias,r.activation,r.preluActivationWeights,rt("fusedConv2d")},n.prototype.conv2d=function(r,e,t){return rt("conv2d")},n.prototype.conv2dDerInput=function(r,e,t){return rt("conv2dDerInput")},n.prototype.conv2dDerFilter=function(r,e,t){return rt("conv2dDerFilter")},n.prototype.fusedDepthwiseConv2D=function(r){return r.input,r.filter,r.convInfo,r.bias,r.activation,r.preluActivationWeights,rt("fusedDepthwiseConv2D")},n.prototype.depthwiseConv2D=function(r,e,t){return rt("depthwiseConv2D")},n.prototype.depthwiseConv2DDerInput=function(r,e,t){return rt("depthwiseConv2DDerInput")},n.prototype.depthwiseConv2DDerFilter=function(r,e,t){return rt("depthwiseConv2DDerFilter")},n.prototype.conv3d=function(r,e,t){return rt("conv3d")},n.prototype.conv3dDerInput=function(r,e,t){return rt("conv3dDerInput")},n.prototype.conv3dDerFilter=function(r,e,t){return rt("conv3dDerFilter")},n.prototype.maxPool=function(r,e){return rt("maxPool")},n.prototype.maxPoolBackprop=function(r,e,t,o){return rt("maxPoolBackprop")},n.prototype.avgPool=function(r,e){return rt("avgPool")},n.prototype.avgPoolBackprop=function(r,e,t){return rt("avgPoolBackprop")},n.prototype.avgPool3d=function(r,e){return rt("avgPool3d")},n.prototype.avgPool3dBackprop=function(r,e,t){return rt("avgPool3dBackprop")},n.prototype.maxPool3d=function(r,e){return rt("maxPool3d")},n.prototype.maxPool3dBackprop=function(r,e,t,o){return rt("maxPool3dBackprop")},n.prototype.reshape=function(r,e){return rt("reshape")},n.prototype.cast=function(r,e){return rt("cast")},n.prototype.tile=function(r,e){return rt("tile")},n.prototype.pad=function(r,e,t){return rt("pad")},n.prototype.transpose=function(r,e){return rt("transpose")},n.prototype.gather=function(r,e,t){return rt("gather")},n.prototype.gatherND=function(r,e){return rt("gatherND")},n.prototype.scatterND=function(r,e,t){return rt("scatterND")},n.prototype.batchToSpaceND=function(r,e,t){return rt("batchToSpaceND")},n.prototype.spaceToBatchND=function(r,e,t){return rt("spaceToBatchND")},n.prototype.resizeBilinear=function(r,e,t,o){return rt("resizeBilinear")},n.prototype.resizeBilinearBackprop=function(r,e,t){return rt("resizeBilinearBackprop")},n.prototype.resizeNearestNeighbor=function(r,e,t,o){return rt("resizeNearestNeighbor")},n.prototype.resizeNearestNeighborBackprop=function(r,e,t){return rt("resizeNearestNeighborBackprop")},n.prototype.batchNormalization=function(r,e,t,o,a,i){return rt("batchNormalization")},n.prototype.localResponseNormalization4D=function(r,e,t,o,a){return rt("localResponseNormalization4D")},n.prototype.LRNGrad=function(r,e,t,o,a,i,s){return rt("LRNGrad")},n.prototype.multinomial=function(r,e,t,o){return rt("multinomial")},n.prototype.oneHot=function(r,e,t,o){return rt("oneHot")},n.prototype.cumsum=function(r,e,t,o){return rt("cumsum")},n.prototype.nonMaxSuppression=function(r,e,t,o,a){return rt("nonMaxSuppression")},n.prototype.fft=function(r){return rt("fft")},n.prototype.ifft=function(r){return rt("ifft")},n.prototype.complex=function(r,e){return rt("complex")},n.prototype.real=function(r){return rt("real")},n.prototype.imag=function(r){return rt("imag")},n.prototype.cropAndResize=function(r,e,t,o,a,i){return rt("cropAndResize")},n.prototype.depthToSpace=function(r,e,t){return rt("depthToSpace")},n.prototype.split=function(r,e,t){return rt("split")},n.prototype.sparseToDense=function(r,e,t,o){return rt("sparseToDense")},n.prototype.diag=function(r){return rt("diag")},n.prototype.fill=function(r,e,t){return rt("fill")},n.prototype.onesLike=function(r){return rt("onesLike")},n.prototype.zerosLike=function(r){return rt("zerosLike")},n.prototype.linspace=function(r,e,t){return rt("linspace")},n.prototype.dispose=function(){return rt("dispose")},n}();function rt(n){throw new Error("'"+n+"' not yet implemented or not found in the registry. Did you forget to import the kernel?")}function En(n,r){for(var e=n.length,t=[],o=0;o<e;o++){var a=e-1-o,i=n[a]||1;(r[r.length-1-o]||1)>1&&i===1&&t.unshift(a)}return t}function Ir(n,r){for(var e=[],t=0;t<r.length;t++){var o=n[n.length-t-1],a=r.length-t-1,i=r[a];(o==null||o===1&&i>1)&&e.unshift(a)}return e}function Ht(n,r){for(var e=[],t=Math.max(n.length,r.length),o=0;o<t;o++){var a=n[n.length-o-1];a==null&&(a=1);var i=r[r.length-o-1];if(i==null&&(i=1),a===1)e.unshift(i);else if(i===1)e.unshift(a);else{if(a!==i)throw Error("Operands could not be broadcast together with shapes "+n+" and "+r+".");e.unshift(a)}}return e}function to(n,r,e,t,o,a,i){i===void 0&&(i="channelsLast");var s,u=Sa(r),f=u[0],C=u[1];if(i==="channelsLast")s=[f,C,n[3],n[3]];else{if(i!=="channelsFirst")throw new Error("Unknown dataFormat "+i);s=[f,C,n[1],n[1]]}return jn(n,s,e,t,o,a,!1,i)}function Go(n,r,e,t,o,a,i){i===void 0&&(i="NDHWC");var s,u,f=Vo(r),C=f[0],k=f[1],L=f[2];if(i==="NDHWC")u="channelsLast",s=[C,k,L,n[4],n[4]];else{if(i!=="NCDHW")throw new Error("Unknown dataFormat "+i);u="channelsFirst",s=[C,k,L,n[1],n[1]]}return To(n,s,e,t,o,!1,u,a)}function jn(n,r,e,t,o,a,i,s){i===void 0&&(i=!1),s===void 0&&(s="channelsLast");var u=[-1,-1,-1,-1],f=u[0],C=u[1],k=u[2],L=u[3];if(s==="channelsLast")f=n[0],C=n[1],k=n[2],L=n[3];else{if(s!=="channelsFirst")throw new Error("Unknown dataFormat "+s);f=n[0],L=n[1],C=n[2],k=n[3]}var X,oe=r[0],ue=r[1],se=r[3],ce=Sa(e),xe=ce[0],we=ce[1],Ee=Sa(t),Se=Ee[0],Me=Ee[1],ze=Bn(oe,Se),Be=Bn(ue,Me),je=function(ft,ut,vt,mt,lt,xt,wt,Ot){var Mt,Pt,Kt;if(typeof ft=="number"){Mt={top:ft,bottom:ft,left:ft,right:ft,type:ft===0?"VALID":"NUMBER"};var Yt=function(tr,Er,fr,Lr,Mr){Lr==null&&(Lr=Ta(tr,Er,fr));var Pr=tr[0],zn=tr[1],Gn=Xo((Pr-Er+2*Lr)/fr+1,Mr);_(me(Gn),function(){return"The output # of rows ("+Gn+") must be an integer. Change the stride and/or zero pad parameters"});var mn=Xo((zn-Er+2*Lr)/fr+1,Mr);return _(me(mn),function(){return"The output # of columns ("+mn+") must be an integer. Change the stride and/or zero pad parameters"}),[Gn,mn]}([ut,vt],xt,mt,ft,Ot);Pt=Yt[0],Kt=Yt[1]}else if(ft==="same"){Pt=Math.ceil(ut/mt),Kt=Math.ceil(vt/lt);var $t=Math.max(0,(Pt-1)*mt+xt-ut),ar=Math.max(0,(Kt-1)*lt+wt-vt),er=Math.floor($t/2),ir=$t-er,jr=Math.floor(ar/2);Mt={top:er,bottom:ir,left:jr,right:ar-jr,type:"SAME"}}else{if(ft!=="valid")throw Error("Unknown padding parameter: "+ft);Mt={top:0,bottom:0,left:0,right:0,type:"VALID"},Pt=Math.ceil((ut-xt+1)/mt),Kt=Math.ceil((vt-wt+1)/lt)}return{padInfo:Mt,outHeight:Pt,outWidth:Kt}}(o,C,k,xe,we,ze,Be,a),Ue=je.padInfo,Ze=je.outHeight,Je=je.outWidth,ht=i?se*L:se;return s==="channelsFirst"?X=[f,ht,Ze,Je]:s==="channelsLast"&&(X=[f,Ze,Je,ht]),{batchSize:f,dataFormat:s,inHeight:C,inWidth:k,inChannels:L,outHeight:Ze,outWidth:Je,outChannels:ht,padInfo:Ue,strideHeight:xe,strideWidth:we,filterHeight:oe,filterWidth:ue,effectiveFilterHeight:ze,effectiveFilterWidth:Be,dilationHeight:Se,dilationWidth:Me,inShape:n,outShape:X,filterShape:r}}function To(n,r,e,t,o,a,i,s){a===void 0&&(a=!1),i===void 0&&(i="channelsLast");var u=[-1,-1,-1,-1,-1],f=u[0],C=u[1],k=u[2],L=u[3],X=u[4];if(i==="channelsLast")f=n[0],C=n[1],k=n[2],L=n[3],X=n[4];else{if(i!=="channelsFirst")throw new Error("Unknown dataFormat "+i);f=n[0],X=n[1],C=n[2],k=n[3],L=n[4]}var oe,ue=r[0],se=r[1],ce=r[2],xe=r[4],we=Vo(e),Ee=we[0],Se=we[1],Me=we[2],ze=Vo(t),Be=ze[0],je=ze[1],Ue=ze[2],Ze=Bn(ue,Be),Je=Bn(se,je),ht=Bn(ce,Ue),ft=function(wt,Ot,Mt,Pt,Kt,Yt,$t,ar,er,ir,jr){var tr,Er,fr,Lr;if(typeof wt=="number"){tr={top:wt,bottom:wt,left:wt,right:wt,front:wt,back:wt,type:wt===0?"VALID":"NUMBER"};var Mr=function(Ba,uo,Vu,Ua,Vn,Xu){Vn==null&&(Vn=Ta(Ba,uo,Ua));var Xp=Ba[0],Kp=Ba[1],Yp=Ba[2],Ku=Xo((Xp-uo+2*Vn)/Ua+1,Xu);_(me(Ku),function(){return"The output # of depths ("+Ku+") must be an integer. Change the stride and/or zero pad parameters"});var Yu=Xo((Kp-uo+2*Vn)/Ua+1,Xu);_(me(Yu),function(){return"The output # of rows ("+Yu+") must be an integer. Change the stride and/or zero pad parameters"});var $u=Xo((Yp-uo+2*Vn)/Ua+1,Xu);return _(me($u),function(){return"The output # of columns ("+$u+") must be an integer. Change the stride and/or zero pad parameters"}),[Ku,Yu,$u,Vu]}([Ot,Mt,Pt,1],ar,1,Kt,wt,jr);Er=Mr[0],fr=Mr[1],Lr=Mr[2]}else if(wt==="same"){Er=Math.ceil(Ot/Kt),fr=Math.ceil(Mt/Yt),Lr=Math.ceil(Pt/$t);var Pr=(Er-1)*Kt+ar-Ot,zn=(fr-1)*Yt+er-Mt,Gn=(Lr-1)*$t+ir-Pt,mn=Math.floor(Pr/2),ja=Pr-mn,io=Math.floor(zn/2),No=zn-io,so=Math.floor(Gn/2);tr={top:io,bottom:No,left:so,right:Gn-so,front:mn,back:ja,type:"SAME"}}else{if(wt!=="valid")throw Error("Unknown padding parameter: "+wt);tr={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},Er=Math.ceil((Ot-ar+1)/Kt),fr=Math.ceil((Mt-er+1)/Yt),Lr=Math.ceil((Pt-ir+1)/$t)}return{padInfo:tr,outDepth:Er,outHeight:fr,outWidth:Lr}}(o,C,k,L,Ee,Se,Me,Ze,Je,ht,s),ut=ft.padInfo,vt=ft.outDepth,mt=ft.outHeight,lt=ft.outWidth,xt=a?xe*X:xe;return i==="channelsFirst"?oe=[f,xt,vt,mt,lt]:i==="channelsLast"&&(oe=[f,vt,mt,lt,xt]),{batchSize:f,dataFormat:i,inDepth:C,inHeight:k,inWidth:L,inChannels:X,outDepth:vt,outHeight:mt,outWidth:lt,outChannels:xt,padInfo:ut,strideDepth:Ee,strideHeight:Se,strideWidth:Me,filterDepth:ue,filterHeight:se,filterWidth:ce,effectiveFilterDepth:Ze,effectiveFilterHeight:Je,effectiveFilterWidth:ht,dilationDepth:Be,dilationHeight:je,dilationWidth:Ue,inShape:n,outShape:oe,filterShape:r}}function Ta(n,r,e,t){t===void 0&&(t=1);var o=Bn(r,t);return Math.floor((n[0]*(e-1)-e+o)/2)}function Sa(n){return typeof n=="number"?[n,n,n]:n.length===2?[n[0],n[1],1]:n}function Vo(n){return typeof n=="number"?[n,n,n]:n}function Bn(n,r){return r<=1?n:n+(n-1)*(r-1)}function Xo(n,r){if(!r)return n;switch(r){case"round":return Math.round(n);case"ceil":return Math.ceil(n);case"floor":return Math.floor(n);default:throw new Error("Unknown roundingMode "+r)}}function So(n){var r=Sa(n),e=r[0],t=r[1],o=r[2];return e===1&&t===1&&o===1}function Zr(n,r){return So(n)||So(r)}function ui(n){if(n==="NHWC")return"channelsLast";if(n==="NCHW")return"channelsFirst";throw new Error("Unknown dataFormat "+n)}function ci(n,r,e){if(r==="complex64"){if(n.dtype==="complex64")return n.clone();var t=Tr(n.shape),o=n.toFloat(),a=e.complex(o,t);return t.dispose(),o.dispose(),a}if(!et(n.dtype,r))return Ve.makeTensorFromDataId(n.dataId,n.shape,r);if(n.dtype==="complex64"){var i=e.real(n);return a=i.cast(r),i.dispose(),a}if(r==="int32")return e.int(n);if(r==="bool"){var s=Nt(0,n.dtype);return a=e.notEqual(n,s),s.dispose(),a}throw new Error("Error in Cast: failed to cast "+n.dtype+" to "+r)}function Aa(n,r){return Ve.makeTensorFromDataId(n.dataId,r,n.dtype)}function Zi(n,r,e){var t=(r-n)/(e-1),o=R(e,"float32");o[0]=n;for(var a=1;a<o.length;a++)o[a]=o[a-1]+t;return Qn(o,"float32")}var cd=Object.freeze({castTensor:ci,reshapeTensor:Aa,linspaceImpl:Zi,upcastType:nr,axesAreInnerMostDims:Li,combineLocations:Qa,computeOutAndReduceShapes:Gr,expandShapeToKeepDim:Vr,assertAxesAreInnerMostDims:on,getAxesPermutation:sn,getUndoAxesPermutation:bo,getInnerMostAxes:fn,getBroadcastDims:En,getReductionAxes:Ir,assertAndGetBroadcastShape:Ht,assertParamsConsistent:ji,computeOutShape:qn,computePool2DInfo:to,computePool3DInfo:Go,computeConv2DInfo:jn,computeConv3DInfo:To,computeDefaultPad:Ta,tupleValuesAreOne:So,eitherStridesOrDilationsAreOne:Zr,convertConv2DDataFormat:ui,PARALLELIZE_THRESHOLD:Ki,computeOptimalWindowSize:ai});function Oa(n,r){if(n.length!==r.length)throw new Error("Cannot merge real and imag arrays of different lengths. real:"+n.length+", imag: "+r.length+".");for(var e=new Float32Array(2*n.length),t=0;t<e.length;t+=2)e[t]=n[t/2],e[t+1]=r[t/2];return e}function es(n,r){return{real:n[2*r],imag:n[2*r+1]}}function Qs(n,r,e,t){n[2*t]=r,n[2*t+1]=e}function Zs(n,r,e){var t=(e?2:-2)*Math.PI*(n/r);return{real:Math.cos(t),imag:Math.sin(t)}}function eu(n,r,e){var t=function(a,i,s){return function(u,f,C){for(var k=0,L=u.length,X=0,oe=!1;k<L;){var ue=C(f,u[X=k+(L-k>>>1)]);ue>0?k=X+1:(L=X,oe=!ue)}return oe?k:-k-1}(a,i,s||tu)}(n,r,e),o=t<0?-(t+1):t;n.splice(o,0,r)}function tu(n,r){return n>r?1:n<r?-1:0}function li(n,r,e,t,o){return ts(n,r,e,t,o,0).selectedIndices}function di(n,r,e,t,o,a){var i=ts(n,r,e,t,o,a,!0);return i.numValidOutputs.dispose(),{selectedIndices:i.selectedIndices,selectedScores:i.selectedScores}}function ts(n,r,e,t,o,a,i,s){i===void 0&&(i=!1),s===void 0&&(s=!1);for(var u=Array.from(r).map(function(Ee,Se){return{score:Ee,boxIndex:Se,suppressBeginIndex:0}}).filter(function(Ee){return Ee.score>o}).sort(rs),f=a>0?-.5/a:0,C=[],k=[];C.length<e&&u.length>0;){var L=u.pop(),X=L.score,oe=L.boxIndex,ue=L.suppressBeginIndex;if(X<o)break;for(var se=!1,ce=C.length-1;ce>=ue;--ce){var xe=ru(n,oe,C[ce]);if(xe>=t){se=!0;break}if(L.score=L.score*nu(t,f,xe),L.score<=o)break}L.suppressBeginIndex=C.length,se||(L.score===X?(C.push(oe),k.push(L.score)):L.score>o&&eu(u,L,rs))}var we=C.length;return s&&(C.fill(0,we),k.fill(0,we)),{selectedIndices:Qn(C,"int32"),selectedScores:Qn(k,"float32"),numValidOutputs:Nt(we,"int32")}}function ru(n,r,e){var t=n.subarray(4*r,4*r+4),o=n.subarray(4*e,4*e+4),a=Math.min(t[0],t[2]),i=Math.min(t[1],t[3]),s=Math.max(t[0],t[2]),u=Math.max(t[1],t[3]),f=Math.min(o[0],o[2]),C=Math.min(o[1],o[3]),k=Math.max(o[0],o[2]),L=Math.max(o[1],o[3]),X=(s-a)*(u-i),oe=(k-f)*(L-C);if(X<=0||oe<=0)return 0;var ue=Math.max(a,f),se=Math.max(i,C),ce=Math.min(s,k),xe=Math.min(u,L),we=Math.max(ce-ue,0)*Math.max(xe-se,0);return we/(X+oe-we)}function nu(n,r,e){var t=Math.exp(r*e*e);return e<=n?t:0}function rs(n,r){return n.score-r.score||n.score===r.score&&r.boxIndex-n.boxIndex}function ns(n,r,e){var t=new Array(n.rank).fill(0),o=n.shape.slice();return r.map(function(a){o[e]=a;var i=n.slice(t,o);return t[e]+=a,i})}function os(n,r){for(var e=new Array(n.rank),t=0;t<e.length;t++)e[t]=n.shape[t]*r[t];var o=Lt(e,n.dtype);for(t=0;t<o.values.length;++t){for(var a=o.indexToLoc(t),i=new Array(n.rank),s=0;s<i.length;s++)i[s]=a[s]%n.shape[s];var u=n.locToIndex(i);o.values[t]=n.values[u]}return o.toTensor()}function as(n,r,e,t,o){for(var a=r[r.length-1],i=[n.length/a,a],s=i[0],u=i[1],f=Ce(e,s*t),C=Ce("int32",s*t),k=0;k<s;k++){for(var L=k*u,X=n.subarray(L,L+u),oe=[],ue=0;ue<X.length;ue++)oe.push({value:X[ue],index:ue});oe.sort(function(Ee,Se){return Se.value-Ee.value});var se=k*t,ce=f.subarray(se,se+t),xe=C.subarray(se,se+t);for(ue=0;ue<t;ue++)ce[ue]=oe[ue].value,xe[ue]=oe[ue].index}var we=r.slice();return we[we.length-1]=t,[Ur(f,we,e),Ur(C,we,"int32")]}function fi(n,r){for(var e=[],t=0;t<r.length;t++)r[t]&&e.push(t);var o=Lt(n,"int32"),a=Lt([e.length,n.length],"int32");for(t=0;t<e.length;t++){var i=o.indexToLoc(e[t]),s=t*n.length;a.values.set(i,s)}return a.toTensor()}var ou=function(n,r){this.outputShape=[],this.outputShape=n,this.variableNames=r.map(function(o,a){return"T"+a});var e=[];this.variableNames.forEach(function(o){e.push("float v"+o+" = get"+o+"AtOutCoords();")});var t=this.variableNames.map(function(o){return"v"+o}).join(" + ");this.userCode=`
void main() {
`+e.join(`
`)+`
float result = `+t+`;
setOutput(result);
}
`},dc=function(n,r){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n,this.variableNames=r.map(function(o,a){return"T"+a});var e=[];this.variableNames.forEach(function(o){e.push("vec4 v"+o+" = get"+o+"AtOutCoords();")});var t=this.variableNames.map(function(o){return"v"+o}).join(" + ");this.userCode=`
void main() {
`+e.join(`
`)+`
vec4 result = `+t+`;
setOutput(result);
}
`},fc=function(n,r,e){this.variableNames=["A"];var t=n.windowSize,o=n.batchSize,a=n.inSize,i=Math.ceil(a/t);e||this.variableNames.push("bestIndicesA"),this.outputShape=[o,i];var s=r==="max"?">":"<",u=e?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode=`
void main() {
ivec2 coords = getOutputCoords();
int batch = coords[0];
int outIdx = coords[1];
int inOffset = outIdx * `+t+`;
int bestIndex = inOffset;
float bestValue = getA(batch, bestIndex);
for (int i = 0; i < `+t+`; i++) {
int inIdx = `+u+`;
float candidate = getA(batch, inIdx);
if (candidate `+s+` bestValue) {
bestValue = candidate;
bestIndex = inIdx;
}
}
setOutput(float(bestIndex));
}
`};function au(n,r){return["x","y","z","w","u","v"].slice(0,r).map(function(e){return n+"."+e})}function en(n,r){return r===1?[n]:au(n,r)}function Kr(){var n,r,e,t,o,a,i,s,u,f;return p().getNumber("WEBGL_VERSION")===2?(n="#version 300 es",r="in",e="out",t="in",o="texture",a="outputColor",i="out vec4 outputColor;",s=`
bool isnan_custom(float val) {
return (val > 0.0 || val < 0.0) ? false : val != 0.0;
}
bvec4 isnan_custom(vec4 val) {
return bvec4(isnan_custom(val.x),
isnan_custom(val.y), isnan_custom(val.z), isnan_custom(val.w));
}
#define isnan(value) isnan_custom(value)
`,u="",f=`
#define round(value) newRound(value)
int newRound(float value) {
return int(floor(value + 0.5));
}
ivec4 newRound(vec4 value) {
return ivec4(floor(value + vec4(0.5)));
}
`):(n="",r="attribute",e="varying",t="varying",o="texture2D",a="gl_FragColor",i="",s=`
#define isnan(value) isnan_custom(value)
bool isnan_custom(float val) {
return (val > 0. || val < 1. || val == 0.) ? false : true;
}
bvec4 isnan_custom(vec4 val) {
return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w));
}
`,u=`
uniform float INFINITY;
bool isinf(float val) {
return abs(val) == INFINITY;
}
bvec4 isinf(vec4 val) {
return equal(abs(val), vec4(INFINITY));
}
`,f=`
int round(float value) {
return int(floor(value + 0.5));
}
ivec4 round(vec4 value) {
return ivec4(floor(value + vec4(0.5)));
}
`),{version:n,attribute:r,varyingVs:e,varyingFs:t,texture2D:o,output:a,defineOutput:i,defineSpecialNaN:s,defineSpecialInf:u,defineRound:f}}function O(n,r,e){e===void 0&&(e="index");var t=Ke(r);return t.map(function(o,a){return"int "+n[a]+" = "+e+" / "+o+"; "+(a===t.length-1?"int "+n[a+1]+" = "+e+" - "+n[a]+" * "+o:"index -= "+n[a]+" * "+o)+";"}).join("")}function w(n){var r=Ke(n).map(function(e){return e.toString()});return`
int getFlatIndex(ivec3 coords) {
return coords.x * `+r[0]+" + coords.y * "+r[1]+` + coords.z;
}
`}var A=`
const float FLOAT_MAX = 1.70141184e38;
const float FLOAT_MIN = 1.17549435e-38;
lowp vec4 encode_float(highp float v) {
if (isnan(v)) {
return vec4(255, 255, 255, 255);
}
highp float av = abs(v);
if(av < FLOAT_MIN) {
return vec4(0.0, 0.0, 0.0, 0.0);
} else if(v > FLOAT_MAX) {
return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;
} else if(v < -FLOAT_MAX) {
return vec4(0.0, 0.0, 128.0, 255.0) / 255.0;
}
highp vec4 c = vec4(0,0,0,0);
highp float e = floor(log2(av));
highp float m = exp2(fract(log2(av))) - 1.0;
c[2] = floor(128.0 * m);
m -= c[2] / 128.0;
c[1] = floor(32768.0 * m);
m -= c[1] / 32768.0;
c[0] = floor(8388608.0 * m);
highp float ebias = e + 127.0;
c[3] = floor(ebias / 2.0);
ebias -= c[3] * 2.0;
c[2] += floor(ebias) * 128.0;
c[3] += 128.0 * step(0.0, -v);
return c / 255.0;
}
`;function P(n,r,e,t){var o=[];n.forEach(function(X){var oe=le(X.shapeInfo.logicalShape);X.shapeInfo.isUniform?o.push("uniform float "+X.name+(oe>1?"["+oe+"]":"")+";"):(o.push("uniform sampler2D "+X.name+";"),o.push("uniform int offset"+X.name+";"))});var a,i,s=o.join(`
`),u=n.map(function(X){return function(oe,ue,se){se===void 0&&(se=!1);var ce="";ce+=se?ae(oe):V(oe);var xe=oe.shapeInfo.logicalShape,we=ue.logicalShape;return xe.length<=we.length&&(ce+=se?function(Ee,Se){var Me,ze=Ee.name,Be=ze.charAt(0).toUpperCase()+ze.slice(1),je="get"+Be+"AtOutCoords",Ue=Ee.shapeInfo.logicalShape.length,Ze=Se.logicalShape.length,Je=En(Ee.shapeInfo.logicalShape,Se.logicalShape),ht=Ge(Ze),ft=Ze-Ue,ut=["x","y","z","w","u","v"];Me=Ue===0?"":Ze<2&&Je.length>=1?"coords = 0;":Je.map(function(Mt){return"coords."+ut[Mt+ft]+" = 0;"}).join(`
`);var vt="";vt=Ze<2&&Ue>0?"coords":Ee.shapeInfo.logicalShape.map(function(Mt,Pt){return"coords."+ut[Pt+ft]}).join(", ");var mt="return outputValue;",lt=le(Ee.shapeInfo.logicalShape)===1,xt=le(Se.logicalShape)===1;if(Ue!==1||lt||xt){if(lt&&!xt)mt=Ze===1?`
return vec4(outputValue.x, outputValue.x, 0., 0.);
`:`
return vec4(outputValue.x);
`;else if(Je.length){var wt=Ue-2,Ot=Ue-1;Je.indexOf(wt)>-1&&Je.indexOf(Ot)>-1?mt="return vec4(outputValue.x);":Je.indexOf(wt)>-1?mt="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":Je.indexOf(Ot)>-1&&(mt="return vec4(outputValue.xx, outputValue.zz);")}}else mt=`
return vec4(outputValue.xy, outputValue.xy);
`;return`
vec4 `+je+`() {
`+ht+` coords = getOutputCoords();
`+Me+`
vec4 outputValue = get`+Be+"("+vt+`);
`+mt+`
}
`}(oe,ue):function(Ee,Se){var Me=Ee.name,ze=Me.charAt(0).toUpperCase()+Me.slice(1),Be="get"+ze+"AtOutCoords",je=Se.texShape,Ue=Ee.shapeInfo.texShape,Ze=Ee.shapeInfo.logicalShape.length,Je=Se.logicalShape.length;if(!Ee.shapeInfo.isUniform&&Ze===Je&&Ee.shapeInfo.flatOffset==null&&_e(Ue,je))return`
float `+Be+`() {
return sampleTexture(`+Me+`, resultUV);
}
`;var ht,ft=Ge(Je),ut=En(Ee.shapeInfo.logicalShape,Se.logicalShape),vt=Je-Ze,mt=["x","y","z","w","u","v"];ht=Ze===0?"":Je<2&&ut.length>=1?"coords = 0;":ut.map(function(xt){return"coords."+mt[xt+vt]+" = 0;"}).join(`
`);var lt="";return lt=Je<2&&Ze>0?"coords":Ee.shapeInfo.logicalShape.map(function(xt,wt){return"coords."+mt[wt+vt]}).join(", "),`
float `+Be+`() {
`+ft+` coords = getOutputCoords();
`+ht+`
return get`+ze+"("+lt+`);
}
`}(oe,ue)),ce}(X,r,t)}).join(`
`),f=r.texShape,C=Kr(),k=function(X){return`
float sampleTexture(sampler2D textureSampler, vec2 uv) {
return `+X.texture2D+`(textureSampler, uv).r;
}
`}(C),L=function(X){return X.version+`
precision highp float;
precision highp int;
precision highp sampler2D;
`+X.varyingFs+` vec2 resultUV;
`+X.defineOutput+`
const vec2 halfCR = vec2(0.5, 0.5);
struct ivec5
{
int x;
int y;
int z;
int w;
int u;
};
struct ivec6
{
int x;
int y;
int z;
int w;
int u;
int v;
};
uniform float NAN;
`+X.defineSpecialNaN+`
`+X.defineSpecialInf+`
`+X.defineRound+`
int imod(int x, int y) {
return x - y * (x / y);
}
int idiv(int a, int b, float sign) {
int res = a / b;
int mod = imod(a, b);
if (sign < 0. && mod != 0) {
res -= 1;
}
return res;
}
//Based on the work of Dave Hoskins
//https://www.shadertoy.com/view/4djSRW
#define HASHSCALE1 443.8975
float random(float seed){
vec2 p = resultUV * seed;
vec3 p3 = fract(vec3(p.xyx) * HASHSCALE1);
p3 += dot(p3, p3.yzx + 19.19);
return fract((p3.x + p3.y) * p3.z);
}
`+ge+`
`+he+`
`+Te+`
`}(C);return r.isPacked?(a=function(X,oe){switch(X.length){case 0:return`
int getOutputCoords() {
return 0;
}
`;case 1:return function(Ee,Se){var Me=[Math.ceil(Se[0]/2),Math.ceil(Se[1]/2)];return Me[0]===1?`
int getOutputCoords() {
return 2 * int(resultUV.x * `+Me[1]+`.0);
}
`:Me[1]===1?`
int getOutputCoords() {
return 2 * int(resultUV.y * `+Me[0]+`.0);
}
`:`
int getOutputCoords() {
ivec2 resTexRC = ivec2(resultUV.yx *
vec2(`+Me[0]+", "+Me[1]+`));
return 2 * (resTexRC.x * `+Me[1]+` + resTexRC.y);
}
`}(0,oe);case 2:return function(Ee,Se){var Me=[Math.ceil(Se[0]/2),Math.ceil(Se[1]/2)];if(_e(Ee,Se))return`
ivec2 getOutputCoords() {
return 2 * ivec2(resultUV.yx * vec2(`+Me[0]+", "+Me[1]+`));
}
`;var ze=Math.ceil(Ee[1]/2);return`
ivec2 getOutputCoords() {
ivec2 resTexRC = ivec2(resultUV.yx *
vec2(`+Me[0]+", "+Me[1]+`));
int index = resTexRC.x * `+Me[1]+` + resTexRC.y;
int r = 2 * (index / `+ze+`);
int c = imod(index, `+ze+`) * 2;
return ivec2(r, c);
}
`}(X,oe);case 3:return ue=X,se=oe,ce=[Math.ceil(se[0]/2),Math.ceil(se[1]/2)],xe=Math.ceil(ue[2]/2),we=xe*Math.ceil(ue[1]/2),`
ivec3 getOutputCoords() {
ivec2 resTexRC = ivec2(resultUV.yx *
vec2(`+ce[0]+", "+ce[1]+`));
int index = resTexRC.x * `+ce[1]+` + resTexRC.y;
int b = index / `+we+`;
index -= b * `+we+`;
int r = 2 * (index / `+xe+`);
int c = imod(index, `+xe+`) * 2;
return ivec3(b, r, c);
}
`;default:return function(Ee,Se){for(var Me=[Math.ceil(Se[0]/2),Math.ceil(Se[1]/2)],ze=Math.ceil(Ee[Ee.length-1]/2),Be=ze*Math.ceil(Ee[Ee.length-2]/2),je=Be,Ue="",Ze="b, r, c",Je=2;Je<Ee.length-1;Je++)je*=Ee[Ee.length-Je-1],Ue=`
int b`+Je+" = index / "+je+`;
index -= b`+Je+" * "+je+`;
`+Ue,Ze="b"+Je+", "+Ze;return`
ivec`+Ee.length+` getOutputCoords() {
ivec2 resTexRC = ivec2(resultUV.yx *
vec2(`+Me[0]+", "+Me[1]+`));
int index = resTexRC.x * `+Me[1]+` + resTexRC.y;
`+Ue+`
int b = index / `+Be+`;
index -= b * `+Be+`;
int r = 2 * (index / `+ze+`);
int c = imod(index, `+ze+`) * 2;
return ivec`+Ee.length+"("+Ze+`);
}
`}(X,oe)}var ue,se,ce,xe,we}(r.logicalShape,f),i=function(X){return`
void setOutput(vec4 val) {
`+X.output+` = val;
}
`}(C)):(a=function(X,oe){switch(X.length){case 0:return`
int getOutputCoords() {
return 0;
}
`;case 1:return function(ce,xe){return xe[0]===1?`
int getOutputCoords() {
return int(resultUV.x * `+xe[1]+`.0);
}
`:xe[1]===1?`
int getOutputCoords() {
return int(resultUV.y * `+xe[0]+`.0);
}
`:`
int getOutputCoords() {
ivec2 resTexRC = ivec2(resultUV.yx *
vec2(`+xe[0]+", "+xe[1]+`));
return resTexRC.x * `+xe[1]+` + resTexRC.y;
}
`}(0,oe);case 2:return function(ce,xe){return _e(ce,xe)?`
ivec2 getOutputCoords() {
return ivec2(resultUV.yx * vec2(`+xe[0]+", "+xe[1]+`));
}
`:ce[1]===1?`
ivec2 getOutputCoords() {
ivec2 resTexRC = ivec2(resultUV.yx *
vec2(`+xe[0]+", "+xe[1]+`));
int index = resTexRC.x * `+xe[1]+` + resTexRC.y;
return ivec2(index, 0);
}
`:ce[0]===1?`
ivec2 getOutputCoords() {
ivec2 resTexRC = ivec2(resultUV.yx *
vec2(`+xe[0]+", "+xe[1]+`));
int index = resTexRC.x * `+xe[1]+` + resTexRC.y;
return ivec2(0, index);
}
`:`
ivec2 getOutputCoords() {
ivec2 resTexRC = ivec2(resultUV.yx *
vec2(`+xe[0]+", "+xe[1]+`));
int index = resTexRC.x * `+xe[1]+` + resTexRC.y;
int r = index / `+ce[1]+`;
int c = index - r * `+ce[1]+`;
return ivec2(r, c);
}
`}(X,oe);case 3:return ue=oe,se=O(["r","c","d"],X),`
ivec3 getOutputCoords() {
ivec2 resTexRC = ivec2(resultUV.yx *
vec2(`+ue[0]+", "+ue[1]+`));
int index = resTexRC.x * `+ue[1]+` + resTexRC.y;
`+se+`
return ivec3(r, c, d);
}
`;case 4:return function(ce,xe){var we=O(["r","c","d","d2"],ce);return`
ivec4 getOutputCoords() {
ivec2 resTexRC = ivec2(resultUV.yx *
vec2(`+xe[0]+", "+xe[1]+`));
int index = resTexRC.x * `+xe[1]+` + resTexRC.y;
`+we+`
return ivec4(r, c, d, d2);
}
`}(X,oe);case 5:return function(ce,xe){var we=O(["r","c","d","d2","d3"],ce);return`
ivec5 getOutputCoords() {
ivec2 resTexRC = ivec2(resultUV.yx * vec2(`+xe[0]+`,
`+xe[1]+`));
int index = resTexRC.x * `+xe[1]+` + resTexRC.y;
`+we+`
ivec5 outShape = ivec5(r, c, d, d2, d3);
return outShape;
}
`}(X,oe);case 6:return function(ce,xe){var we=O(["r","c","d","d2","d3","d4"],ce);return`
ivec6 getOutputCoords() {
ivec2 resTexRC = ivec2(resultUV.yx *
vec2(`+xe[0]+", "+xe[1]+`));
int index = resTexRC.x * `+xe[1]+` + resTexRC.y;
`+we+`
ivec6 result = ivec6(r, c, d, d2, d3, d4);
return result;
}
`}(X,oe);default:throw new Error(X.length+"-D output sampling is not yet supported")}var ue,se}(r.logicalShape,f),i=function(X){return`
void setOutput(float val) {
`+X.output+` = vec4(val, 0, 0, 0);
}
`}(C)),t&&(L+=Ie),[L,k,i,s,a,u,e].join(`
`)}function V(n){var r=n.shapeInfo.logicalShape;switch(r.length){case 0:return function(e){var t=e.name,o="get"+t.charAt(0).toUpperCase()+t.slice(1);if(e.shapeInfo.isUniform)return"float "+o+"() {return "+t+";}";var a=e.shapeInfo.texShape,i=a[0],s=a[1];if(i===1&&s===1)return`
float `+o+`() {
return sampleTexture(`+t+`, halfCR);
}
`;var u=e.shapeInfo.texShape,f=u[0],C=u[1],k=Ne(t);return`
float `+o+`() {
vec2 uv = uvFromFlat(`+f+", "+C+", "+k+`);
return sampleTexture(`+t+`, uv);
}
`}(n);case 1:return function(e){var t=e.name,o="get"+t.charAt(0).toUpperCase()+t.slice(1);if(e.shapeInfo.isUniform)return`
float `+o+`(int index) {
`+We(e)+`
}
`;var a=e.shapeInfo.texShape,i=a[0],s=a[1];if(s===1&&i===1)return`
float `+o+`(int index) {
return sampleTexture(`+t+`, halfCR);
}
`;var u=Ne(t);return s===1?`
float `+o+`(int index) {
vec2 uv = vec2(0.5, (float(index + `+u+") + 0.5) / "+i+`.0);
return sampleTexture(`+t+`, uv);
}
`:i===1?`
float `+o+`(int index) {
vec2 uv = vec2((float(index + `+u+") + 0.5) / "+s+`.0, 0.5);
return sampleTexture(`+t+`, uv);
}
`:`
float `+o+`(int index) {
vec2 uv = uvFromFlat(`+i+", "+s+", index + "+u+`);
return sampleTexture(`+t+`, uv);
}
`}(n);case 2:return function(e){var t=e.shapeInfo.logicalShape,o=e.name,a="get"+o.charAt(0).toUpperCase()+o.slice(1),i=e.shapeInfo.texShape;if(i!=null&&_e(t,i)){var s=i[0],u=i[1];return`
float `+a+`(int row, int col) {
vec2 uv = (vec2(col, row) + halfCR) / vec2(`+u+".0, "+s+`.0);
return sampleTexture(`+o+`, uv);
}
`}var f=ee(t),C=f.newShape,k=f.keptDims,L=C;if(L.length<t.length){var X=Qe(e,L);return`
`+V(X)+`
float `+a+`(int row, int col) {
return `+a+"("+it(["row","col"],k)+`);
}
`}if(e.shapeInfo.isUniform)return`
float `+a+`(int row, int col) {
int index = round(dot(vec2(row, col), vec2(`+t[1]+`, 1)));
`+We(e)+`
}
`;var oe=i[0],ue=i[1],se=Ne(o);return ue===1?`
float `+a+`(int row, int col) {
float index = dot(vec3(row, col, `+se+"), vec3("+t[1]+`, 1, 1));
vec2 uv = vec2(0.5, (index + 0.5) / `+oe+`.0);
return sampleTexture(`+o+`, uv);
}
`:oe===1?`
float `+a+`(int row, int col) {
float index = dot(vec3(row, col, `+se+"), vec3("+t[1]+`, 1, 1));
vec2 uv = vec2((index + 0.5) / `+ue+`.0, 0.5);
return sampleTexture(`+o+`, uv);
}
`:`
float `+a+`(int row, int col) {
// Explicitly use integer operations as dot() only works on floats.
int index = row * `+t[1]+" + col + "+se+`;
vec2 uv = uvFromFlat(`+oe+", "+ue+`, index);
return sampleTexture(`+o+`, uv);
}
`}(n);case 3:return function(e){var t=e.shapeInfo.logicalShape,o=e.name,a="get"+o.charAt(0).toUpperCase()+o.slice(1),i=t[1]*t[2],s=t[2],u=ee(t),f=u.newShape,C=u.keptDims,k=f;if(k.length<t.length){var L=Qe(e,k);return`
`+V(L)+`
float `+a+`(int row, int col, int depth) {
return `+a+"("+it(["row","col","depth"],C)+`);
}
`}if(e.shapeInfo.isUniform)return`
float `+a+`(int row, int col, int depth) {
int index = round(dot(vec3(row, col, depth),
vec3(`+i+", "+s+`, 1)));
`+We(e)+`
}
`;var X=e.shapeInfo.texShape,oe=X[0],ue=X[1],se=e.shapeInfo.flatOffset;if(ue===i&&se==null)return`
float `+a+`(int row, int col, int depth) {
float texR = float(row);
float texC = dot(vec2(col, depth), vec2(`+s+`, 1));
vec2 uv = (vec2(texC, texR) + halfCR) /
vec2(`+ue+".0, "+oe+`.0);
return sampleTexture(`+o+`, uv);
}
`;if(ue===s&&se==null)return`
float `+a+`(int row, int col, int depth) {
float texR = dot(vec2(row, col), vec2(`+t[1]+`, 1));
float texC = float(depth);
vec2 uv = (vec2(texC, texR) + halfCR) / vec2(`+ue+".0, "+oe+`.0);
return sampleTexture(`+o+`, uv);
}
`;var ce=Ne(o);return`
float `+a+`(int row, int col, int depth) {
// Explicitly use integer operations as dot() only works on floats.
int index = row * `+i+" + col * "+s+" + depth + "+ce+`;
vec2 uv = uvFromFlat(`+oe+", "+ue+`, index);
return sampleTexture(`+o+`, uv);
}
`}(n);case 4:return function(e){var t=e.shapeInfo.logicalShape,o=e.name,a="get"+o.charAt(0).toUpperCase()+o.slice(1),i=t[3],s=t[2]*i,u=t[1]*s,f=ee(t),C=f.newShape,k=f.keptDims;if(C.length<t.length){var L=Qe(e,C);return`
`+V(L)+`
float `+a+`(int row, int col, int depth, int depth2) {
return `+a+"("+it(["row","col","depth","depth2"],k)+`);
}
`}if(e.shapeInfo.isUniform)return`
float `+a+`(int row, int col, int depth, int depth2) {
int index = round(dot(vec4(row, col, depth, depth2),
vec4(`+u+", "+s+", "+i+`, 1)));
`+We(e)+`
}
`;var X=e.shapeInfo.flatOffset,oe=e.shapeInfo.texShape,ue=oe[0],se=oe[1];if(se===u&&X==null)return`
float `+a+`(int row, int col, int depth, int depth2) {
float texR = float(row);
float texC =
dot(vec3(col, depth, depth2),
vec3(`+s+", "+i+`, 1));
vec2 uv = (vec2(texC, texR) + halfCR) /
vec2(`+se+".0, "+ue+`.0);
return sampleTexture(`+o+`, uv);
}
`;if(se===i&&X==null)return`
float `+a+`(int row, int col, int depth, int depth2) {
float texR = dot(vec3(row, col, depth),
vec3(`+t[1]*t[2]+", "+t[2]+`, 1));
float texC = float(depth2);
vec2 uv = (vec2(texC, texR) + halfCR) /
vec2(`+se+".0, "+ue+`.0);
return sampleTexture(`+o+`, uv);
}
`;var ce=Ne(o);return`
float `+a+`(int row, int col, int depth, int depth2) {
// Explicitly use integer operations as dot() only works on floats.
int index = row * `+u+" + col * "+s+` +
depth * `+i+` + depth2;
vec2 uv = uvFromFlat(`+ue+", "+se+", index + "+ce+`);
return sampleTexture(`+o+`, uv);
}
`}(n);case 5:return function(e){var t=e.shapeInfo.logicalShape,o=e.name,a="get"+o.charAt(0).toUpperCase()+o.slice(1),i=t[4],s=t[3]*i,u=t[2]*s,f=t[1]*u,C=ee(t),k=C.newShape,L=C.keptDims;if(k.length<t.length){var X=Qe(e,k);return`
`+V(X)+`
float `+a+`(int row, int col, int depth, int depth2, int depth3) {
return `+a+"("+it(["row","col","depth","depth2","depth3"],L)+`);
}
`}if(e.shapeInfo.isUniform)return`
float `+a+`(int row, int col, int depth, int depth2, int depth3) {
float index = dot(
vec4(row, col, depth, depth2),
vec4(`+f+", "+u+", "+s+", "+i+`)) +
depth3;
`+We(e)+`
}
`;var oe=e.shapeInfo.flatOffset,ue=e.shapeInfo.texShape,se=ue[0],ce=ue[1];if(ce===f&&oe==null)return`
float `+a+`(int row, int col, int depth, int depth2, int depth3) {
int texR = row;
float texC = dot(vec4(col, depth, depth2, depth3),
vec4(`+u+", "+s+", "+i+`, 1));
vec2 uv = (vec2(texC, texR) + halfCR) /
vec2(`+ce+".0, "+se+`.0);
return sampleTexture(`+o+`, uv);
}
`;if(ce===i&&oe==null)return`
float `+a+`(int row, int col, int depth, int depth2, int depth3) {
float texR = dot(
vec4(row, col, depth, depth2),
vec4(`+t[1]*t[2]*t[3]+`,
`+t[2]*t[3]+", "+t[3]+`, 1));
int texC = depth3;
vec2 uv = (vec2(texC, texR) + halfCR) /
vec2(`+ce+".0, "+se+`.0);
return sampleTexture(`+o+`, uv);
}
`;var xe=Ne(o);return`
float `+a+`(int row, int col, int depth, int depth2, int depth3) {
// Explicitly use integer operations as dot() only works on floats.
int index = row * `+f+" + col * "+u+" + depth * "+s+` +
depth2 * `+i+" + depth3 + "+xe+`;
vec2 uv = uvFromFlat(`+se+", "+ce+`, index);
return sampleTexture(`+o+`, uv);
}
`}(n);case 6:return function(e){var t=e.shapeInfo.logicalShape,o=e.name,a="get"+o.charAt(0).toUpperCase()+o.slice(1),i=ee(t),s=i.newShape,u=i.keptDims;if(s.length<t.length){var f=Qe(e,s);return`
`+V(f)+`
float `+a+`(int row, int col, int depth,
int depth2, int depth3, int depth4) {
return `+a+"("+it(["row","col","depth","depth2","depth3","depth4"],u)+`);
}
`}var C=t[5],k=t[4]*C,L=t[3]*k,X=t[2]*L,oe=t[1]*X;if(e.shapeInfo.isUniform)return`
float `+a+`(int row, int col, int depth,
int depth2, int depth3, int depth4) {
int index = round(dot(
vec4(row, col, depth, depth2),
vec4(`+oe+", "+X+", "+L+", "+k+`)) +
dot(
vec2(depth3, depth4),
vec2(`+C+`, 1)));
`+We(e)+`
}
`;var ue=e.shapeInfo.flatOffset,se=e.shapeInfo.texShape,ce=se[0],xe=se[1];if(xe===oe&&ue==null)return`
float `+a+`(int row, int col, int depth,
int depth2, int depth3, int depth4) {
int texR = row;
float texC = dot(vec4(col, depth, depth2, depth3),
vec4(`+X+", "+L+", "+k+", "+C+`)) +
float(depth4);
vec2 uv = (vec2(texC, texR) + halfCR) /
vec2(`+xe+".0, "+ce+`.0);
return sampleTexture(`+o+`, uv);
}
`;if(xe===C&&ue==null)return`
float `+a+`(int row, int col, int depth,
int depth2, int depth3, int depth4) {
float texR = dot(vec4(row, col, depth, depth2),
vec4(`+t[1]*t[2]*t[3]*t[4]+`,
`+t[2]*t[3]*t[4]+`,
`+t[3]*t[4]+`,
`+t[4]+`)) + float(depth3);
int texC = depth4;
vec2 uv = (vec2(texC, texR) + halfCR) /
vec2(`+xe+".0, "+ce+`.0);
return sampleTexture(`+o+`, uv);
}
`;var we=Ne(o);return`
float `+a+`(int row, int col, int depth,
int depth2, int depth3, int depth4) {
// Explicitly use integer operations as dot() only works on floats.
int index = row * `+oe+" + col * "+X+" + depth * "+L+` +
depth2 * `+k+" + depth3 * "+C+" + depth4 + "+we+`;
vec2 uv = uvFromFlat(`+ce+", "+xe+`, index);
return sampleTexture(`+o+`, uv);
}
`}(n);default:throw new Error(r.length+"-D input sampling is not yet supported")}}function ae(n){var r,e,t;switch(n.shapeInfo.logicalShape.length){case 0:return r=n.name,e="get"+r.charAt(0).toUpperCase()+r.slice(1),t=Kr(),`
vec4 `+e+`() {
return `+t.texture2D+"("+r+`, halfCR);
}
`;case 1:return function(o){var a=o.name,i="get"+a.charAt(0).toUpperCase()+a.slice(1),s=o.shapeInfo.texShape,u=[Math.ceil(s[0]/2),Math.ceil(s[1]/2)],f=Kr();return`
vec4 `+i+`(int index) {
vec2 uv = packedUVfrom1D(
`+u[0]+", "+u[1]+`, index);
return `+f.texture2D+"("+a+`, uv);
}
`}(n);case 2:return function(o){var a=o.shapeInfo.logicalShape,i=o.name,s="get"+i.charAt(0).toUpperCase()+i.slice(1),u=o.shapeInfo.texShape,f=u[0],C=u[1],k=Kr();if(u!=null&&_e(a,u))return`
vec4 `+s+`(int row, int col) {
vec2 uv = (vec2(col, row) + halfCR) / vec2(`+C+".0, "+f+`.0);
return `+k.texture2D+"("+i+`, uv);
}
`;var L=[Math.ceil(u[0]/2),Math.ceil(u[1]/2)],X=Math.ceil(a[1]/2);return`
vec4 `+s+`(int row, int col) {
vec2 uv = packedUVfrom2D(`+X+", "+L[0]+", "+L[1]+`, row, col);
return `+k.texture2D+"("+i+`, uv);
}
`}(n);case 3:return function(o){var a=o.shapeInfo.logicalShape,i=o.name,s="get"+i.charAt(0).toUpperCase()+i.slice(1),u=o.shapeInfo.texShape,f=[Math.ceil(u[0]/2),Math.ceil(u[1]/2)];if(a[0]===1){var C=a.slice(1),k=Qe(o,C);return`
`+ae(k)+`
vec4 `+s+`(int b, int row, int col) {
return `+s+"("+it(["b","row","col"],[1,2])+`);
}
`}var L=f[0],X=f[1],oe=Math.ceil(a[2]/2),ue=oe*Math.ceil(a[1]/2),se=Kr();return`
vec4 `+s+`(int b, int row, int col) {
vec2 uv = packedUVfrom3D(
`+L+", "+X+", "+ue+", "+oe+`, b, row, col);
return `+se.texture2D+"("+i+`, uv);
}
`}(n);default:return function(o){for(var a=o.shapeInfo.logicalShape,i=a.length,s=o.name,u="get"+s.charAt(0).toUpperCase()+s.slice(1),f=o.shapeInfo.texShape,C=[Math.ceil(f[0]/2),Math.ceil(f[1]/2)],k=C[0],L=C[1],X=Math.ceil(a[i-1]/2),oe=X*Math.ceil(a[i-2]/2),ue="int b, int row, int col",se="b * "+oe+" + (row / 2) * "+X+" + (col / 2)",ce=2;ce<i-1;ce++)ue="int b"+ce+", "+ue,oe*=a[i-ce-1],se="b"+ce+" * "+oe+" + "+se;var xe=Kr();return`
vec4 `+u+"("+ue+`) {
int index = `+se+`;
int texR = index / `+L+`;
int texC = index - texR * `+L+`;
vec2 uv = (vec2(texC, texR) + halfCR) / vec2(`+L+", "+k+`);
return `+xe.texture2D+"("+s+`, uv);
}
`}(n)}}var ge=`
vec2 uvFromFlat(int texNumR, int texNumC, int index) {
int texR = index / texNumC;
int texC = index - texR * texNumC;
return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
}
vec2 packedUVfrom1D(int texNumR, int texNumC, int index) {
int texelIndex = index / 2;
int texR = texelIndex / texNumC;
int texC = texelIndex - texR * texNumC;
return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
}
`,he=`
vec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR,
int texNumC, int row, int col) {
int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);
int texR = texelIndex / texNumC;
int texC = texelIndex - texR * texNumC;
return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
}
`,Te=`
vec2 packedUVfrom3D(int texNumR, int texNumC,
int texelsInBatch, int texelsInLogicalRow, int b,
int row, int col) {
int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);
int texR = index / texNumC;
int texC = index - texR * texNumC;
return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
}
`,Ie=`
float getChannel(vec4 frag, vec2 innerDims) {
vec2 modCoord = mod(innerDims, 2.);
return modCoord.x == 0. ?
(modCoord.y == 0. ? frag.r : frag.g) :
(modCoord.y == 0. ? frag.b : frag.a);
}
float getChannel(vec4 frag, int dim) {
float modCoord = mod(float(dim), 2.);
return modCoord == 0. ? frag.r : frag.g;
}
`;function Ne(n){return"offset"+n}function We(n){var r=n.name,e=le(n.shapeInfo.logicalShape);return e<2?"return "+r+";":`
for (int i = 0; i < `+e+`; i++) {
if (i == index) {
return `+r+`[i];
}
}
`}function Ge(n){if(n<=1)return"int";if(n===2)return"ivec2";if(n===3)return"ivec3";if(n===4)return"ivec4";if(n===5)return"ivec5";if(n===6)return"ivec6";throw Error("GPU for rank "+n+" is not yet supported")}function Qe(n,r){var e=JSON.parse(JSON.stringify(n));return e.shapeInfo.logicalShape=r,e}function it(n,r){return r.map(function(e){return n[e]}).join(", ")}var yt=function(n,r,e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,_(n.length>2,function(){return"Packed arg"+(e.charAt(0).toUpperCase()+e.slice(1))+" supports only inputs with rank above 2."});var o=n[n.length-1],a=Math.ceil(o/r);this.outputShape=n.slice(0,-1),a>1&&this.outputShape.push(a),t||this.variableNames.push("bestIndicesA");var i,s,u=this.outputShape,f=u.length,C=Ge(f),k=en("coords",f);if(a===1){var L=Ge(s=f+1);i=`
`+L+" sourceLocR = "+L+"("+k.join()+`, 0);
++`+k[f-1]+`;
`+L+" sourceLocG = "+L+"("+k.join()+`, 0);
++`+k[f-2]+`;
`+L+" sourceLocA = "+L+"("+k.join()+`, 0);
--`+k[f-1]+`;
`+L+" sourceLocB = "+L+"("+k.join()+`, 0);
--`+k[f-2]+";"}else s=f,i=`
`+C+` sourceLocR = coords;
++`+k[f-1]+`;
`+C+` sourceLocG = coords;
++`+k[f-2]+`;
`+C+` sourceLocA = coords;
--`+k[f-1]+`;
`+C+` sourceLocB = coords;
--`+k[f-2]+";";var X=["x","y","z","w","u","v"].slice(0,s),oe="."+X[s-1],ue=X.map(function(Be){return"int "+Be}),se=en("sourceLocR",s-1).concat("inIdx.r"),ce=en("sourceLocG",s-1).concat("inIdx.g"),xe=en("sourceLocB",s-1).concat("inIdx.b"),we=en("sourceLocA",s-1).concat("inIdx.a"),Ee=e==="max"?"greaterThan":"lessThan",Se=t?"":`
inIdx = round(vec4(getBestIndicesAChannel(`+se.join()+`),
getBestIndicesAChannel(`+ce.join()+`),
getBestIndicesAChannel(`+xe.join()+`),
getBestIndicesAChannel(`+we.join()+")));",Me=`vec4(
getAChannel(`+se.join()+`),
hasNextCol ? getAChannel(`+ce.join()+`) : 0.,
hasNextRow ? getAChannel(`+xe.join()+`) : 0.,
hasNextRow && hasNextCol ? getAChannel(`+we.join()+") : 0.)",ze=t?"":`
float getBestIndicesAChannel(`+ue.join()+`) {
return getChannel(getBestIndicesA(`+X.join()+`),
vec2(`+X.slice(-2).join()+`));
}`;this.userCode=`
float getAChannel(`+ue.join()+`) {
return getChannel(getA(`+X.join()+`),
vec2(`+X.slice(-2).join()+`));
}
`+ze+`
void main() {
`+C+` coords = getOutputCoords();
bool hasNextCol = `+k[f-1]+" < "+(u[f-1]-1)+`;
bool hasNextRow = `+k[f-2]+" < "+(u[f-2]-1)+`;
`+i+`
ivec4 srcIdx = ivec4(sourceLocR`+oe+", sourceLocG"+oe+`,
sourceLocB`+oe+", sourceLocA"+oe+") * "+r+`;
ivec4 inIdx = srcIdx;
vec4 bestIndex = vec4(inIdx);
vec4 bestValue = `+Me+`;
for (int i = 0; i < `+r+`; i++) {
inIdx = srcIdx;
`+Se+`
vec4 candidate = `+Me+`;
bvec4 nan = isnan(candidate);
bvec4 replace = bvec4(
vec4(`+Ee+`(candidate, bestValue)) * (vec4(1.0) - vec4(nan)));
bestValue = vec4(replace.x ? candidate.x : bestValue.x,
replace.y ? candidate.y : bestValue.y,
replace.z ? candidate.z : bestValue.z,
replace.w ? candidate.w : bestValue.w);
bestIndex = mix(bestIndex, vec4(inIdx), vec4(replace));
srcIdx++;
}
setOutput(bestIndex);
}
`},_t=function(n){this.variableNames=["dy"],this.outputShape=n.inShape;var r=n.filterHeight,e=n.filterWidth,t=n.strideHeight,o=n.strideWidth,a=n.dilationHeight,i=n.dilationWidth,s=n.effectiveFilterHeight,u=n.effectiveFilterWidth,f=s-1-n.padInfo.top,C=u-1-n.padInfo.left,k=1/(r*e);this.userCode=`
const ivec2 pads = ivec2(`+f+", "+C+`);
const float avgMultiplier = float(`+k+`);
void main() {
ivec4 coords = getOutputCoords();
int b = coords[0];
int d = coords[3];
ivec2 dyRCCorner = coords.yz - pads;
int dyRCorner = dyRCCorner.x;
int dyCCorner = dyRCCorner.y;
// Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).
// ? = to be determined. : = across all values in that axis.
float dotProd = 0.0;
for (int wR = 0; wR < `+s+`;
wR += `+a+`) {
float dyR = float(dyRCorner + wR) / `+t+`.0;
if (dyR < 0.0 || dyR >= `+n.outHeight+`.0 || fract(dyR) > 0.0) {
continue;
}
int idyR = int(dyR);
for (int wC = 0; wC < `+u+`;
wC+= `+i+`) {
float dyC = float(dyCCorner + wC) / `+o+`.0;
if (dyC < 0.0 || dyC >= `+n.outWidth+`.0 ||
fract(dyC) > 0.0) {
continue;
}
int idyC = int(dyC);
float dyValue = getDy(b, idyR, idyC, d);
dotProd += dyValue * avgMultiplier;
}
}
setOutput(dotProd);
}
`},Tt=function(n){this.variableNames=["dy"],this.outputShape=n.inShape;var r=n.filterDepth,e=n.filterHeight,t=n.filterWidth,o=n.strideDepth,a=n.strideHeight,i=n.strideWidth,s=n.dilationDepth,u=n.dilationHeight,f=n.dilationWidth,C=n.effectiveFilterDepth,k=n.effectiveFilterHeight,L=n.effectiveFilterWidth,X=C-1-n.padInfo.front,oe=k-1-n.padInfo.top,ue=L-1-n.padInfo.left,se=1/(r*e*t);this.userCode=`
const ivec3 pads = ivec3(`+X+", "+oe+", "+ue+`);
const float avgMultiplier = float(`+se+`);
void main() {
ivec5 coords = getOutputCoords();
int batch = coords.x;
int ch = coords.u;
ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;
int dyDCorner = dyCorner.x;
int dyRCorner = dyCorner.y;
int dyCCorner = dyCorner.z;
// Convolve dy(?, ?, ?, d) with pos mask(:, :, :, ch) to get
// dx(xD, xR, xC, ch).
// ? = to be determined. : = across all values in that axis.
float dotProd = 0.0;
for (int wD = 0; wD < `+C+`;
wD += `+s+`) {
float dyD = float(dyDCorner + wD) / `+o+`.0;
if (dyD < 0.0 || dyD >= `+n.outDepth+`.0 || fract(dyD) > 0.0) {
continue;
}
int idyD = int(dyD);
for (int wR = 0; wR < `+k+`;
wR += `+u+`) {
float dyR = float(dyRCorner + wR) / `+a+`.0;
if (dyR < 0.0 || dyR >= `+n.outHeight+`.0 ||
fract(dyR) > 0.0) {
continue;
}
int idyR = int(dyR);
for (int wC = 0; wC < `+L+`;
wC += `+f+`) {
float dyC = float(dyCCorner + wC) / `+i+`.0;
if (dyC < 0.0 || dyC >= `+n.outWidth+`.0 ||
fract(dyC) > 0.0) {
continue;
}
int idyC = int(dyC);
float dyValue = getDy(batch, idyD, idyR, idyC, ch);
dotProd += dyValue * avgMultiplier;
}
}
}
setOutput(dotProd);
}
`},Dt=function(n,r,e,t,o,a){this.outputShape=[],this.variableNames=["x","mean","variance"],Ht(n,r),Ht(n,e);var i="0.0";t!=null&&(Ht(n,t),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");var s="1.0";o!=null&&(Ht(n,o),this.variableNames.push("scale"),s="getScaleAtOutCoords()"),this.outputShape=n,this.userCode=`
void main() {
float x = getXAtOutCoords();
float mean = getMeanAtOutCoords();
float variance = getVarianceAtOutCoords();
float offset = `+i+`;
float scale = `+s+`;
float inv = scale * inversesqrt(variance + float(`+a+`));
setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));
}
`},At=function(n,r,e,t,o,a){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],Ht(n,r),Ht(n,e);var i="vec4(0.0)";t!=null&&(Ht(n,t),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");var s="vec4(1.0)";o!=null&&(Ht(n,o),this.variableNames.push("scale"),s="getScaleAtOutCoords()"),this.outputShape=n,this.userCode=`
void main() {
vec4 offset = `+i+`;
vec4 scale = `+s+`;
vec4 x = getXAtOutCoords();
vec4 mean = getMeanAtOutCoords();
vec4 variance = getVarianceAtOutCoords();
vec4 inv = scale * inversesqrt(variance + vec4(`+a+`));
setOutput((x - mean) * inv + offset);
}
`},gt="return areal * breal - aimag * bimag;",Ct="return areal * bimag + aimag * breal;",Wt=function(n,r,e){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=Ht(r,e),this.userCode=`
float binaryOpComplex(
float areal, float aimag, float breal, float bimag) {
`+n+`
}
void main() {
float areal = getARealAtOutCoords();
float aimag = getAImagAtOutCoords();
float breal = getBRealAtOutCoords();
float bimag = getBImagAtOutCoords();
setOutput(binaryOpComplex(areal, aimag, breal, bimag));
}
`},sr="return a + b;",vr="return a - b;",or="return a * b;",Gt="return (a < 0.) ? b * a : a;",Ut=function(n,r,e){this.variableNames=["A","B"],this.outputShape=Ht(r,e),this.userCode=`
float binaryOperation(float a, float b) {
`+n+`
}
void main() {
float a = getAAtOutCoords();
float b = getBAtOutCoords();
setOutput(binaryOperation(a, b));
}
`},kr=`
vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));
return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);
`,lr=function(n,r,e,t){t===void 0&&(t=!1),this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=Ht(r,e);var o=this.outputShape.length,a="";if(t)if(o===0||le(this.outputShape)===1)a=`
result.y = 0.;
result.z = 0.;
result.w = 0.;
`;else if(a=`
`+Ge(o)+` coords = getOutputCoords();
`,o===1)a+=`
result.y = (coords + 1) >= `+this.outputShape[0]+` ? 0. : result.y;
result.z = 0.;
result.w = 0.;
`;else{var i=en("coords",o);a+=`
bool nextRowOutOfBounds =
(`+i[o-2]+" + 1) >= "+this.outputShape[o-2]+`;
bool nextColOutOfBounds =
(`+i[o-1]+" + 1) >= "+this.outputShape[o-1]+`;
result.y = nextColOutOfBounds ? 0. : result.y;
result.z = nextRowOutOfBounds ? 0. : result.z;
result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;
`}this.userCode=`
vec4 binaryOperation(vec4 a, vec4 b) {
`+n+`
}
void main() {
vec4 a = getAAtOutCoords();
vec4 b = getBAtOutCoords();
vec4 result = binaryOperation(a, b);
`+a+`
setOutput(result);
}
`},Xr=function(){function n(r){this.variableNames=["A"],this.outputShape=r,this.userCode=`
uniform float minVal;
uniform float maxVal;
void main() {
float value = getAAtOutCoords();
if (isnan(value)) {
setOutput(value);
return;
}
setOutput(clamp(value, minVal, maxVal));
}
`}return n.prototype.getCustomSetupFunc=function(r,e){var t=this;return function(o,a){t.minLoc==null&&(t.minLoc=o.getUniformLocationNoThrow(a,"minVal"),t.maxLoc=o.getUniformLocationNoThrow(a,"maxVal")),o.gl.uniform1f(t.minLoc,r),o.gl.uniform1f(t.maxLoc,e)}},n}(),Yr=function(){function n(r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=r,this.userCode=`
uniform float minVal;
uniform float maxVal;
void main() {
vec4 value = getAAtOutCoords();
if (any(isnan(value))) {
setOutput(value);
return;
}
setOutput(clamp(value, vec4(minVal), vec4(maxVal)));
}
`}return n.prototype.getCustomSetupFunc=function(r,e){var t=this;return function(o,a){t.minLoc==null&&(t.minLoc=o.getUniformLocationNoThrow(a,"minVal"),t.maxLoc=o.getUniformLocationNoThrow(a,"maxVal")),o.gl.uniform1f(t.minLoc,r),o.gl.uniform1f(t.maxLoc,e)}},n}(),Rt=function(n){this.variableNames=["real","imag"],this.outputShape=n,this.userCode=`
void main() {
float re = abs(getRealAtOutCoords());
float im = abs(getImagAtOutCoords());
float mx = max(re, im);
// sadly the length function in glsl is not underflow-safe
// (at least not on Intel GPUs). So the safe solution is
// to ensure underflow-safety in all cases.
setOutput(
mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx))
);
}
`},tn=function(n){this.outputShape=[],this.outputShape=qn(n,1),this.variableNames=n.map(function(s,u){return"T"+u});var r=new Array(n.length-1);r[0]=n[0][1];for(var e=1;e<r.length;e++)r[e]=r[e-1]+n[e][1];var t=["if (yC < "+r[0]+") setOutput(getT0(yR, yC));"];for(e=1;e<r.length;e++){var o=r[e-1];t.push("else if (yC < "+r[e]+") setOutput(getT"+e+"(yR, yC-"+o+"));")}var a=r.length,i=r[r.length-1];t.push("else setOutput(getT"+a+"(yR, yC-"+i+"));"),this.userCode=`
void main() {
ivec2 coords = getOutputCoords();
int yR = coords.x;
int yC = coords.y;
`+t.join(`
`)+`
}
`},ur=function(n,r){this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[],this.outputShape=qn(n,r);var e=this.outputShape,t=e.length,o=Ge(t),a=en("coords",t),i=["x","y","z","w","u","v"].slice(0,t);this.variableNames=n.map(function(se,ce){return"T"+ce});var s=new Array(n.length-1);s[0]=n[0][r];for(var u=1;u<s.length;u++)s[u]=s[u-1]+n[u][r];var f=i[r],C=i.slice(-2),k=i.join(),L="if ("+f+" < "+s[0]+`) {
return getChannel(
getT0(`+k+"), vec2("+C.join()+`));
}`;for(u=1;u<s.length;u++){var X=s[u-1];L+=`
if (`+f+" < "+s[u]+" && "+f+" >= "+s[u-1]+`) {
return getChannel(
getT`+u+"("+_r(i,f,X)+`),
vec2(`+_r(C,f,X)+`));
}`}var oe=s.length,ue=s[s.length-1];L+=`
return getChannel(
getT`+oe+"("+_r(i,f,ue)+`),
vec2(`+_r(C,f,ue)+"));",this.userCode=`
float getValue(`+i.map(function(se){return"int "+se})+`) {
`+L+`
}
void main() {
`+o+` coords = getOutputCoords();
vec4 result = vec4(getValue(`+a+`), 0., 0., 0.);
`+a[t-1]+" = "+a[t-1]+` + 1;
if (`+a[t-1]+" < "+e[t-1]+`) {
result.g = getValue(`+a+`);
}
`+a[t-2]+" = "+a[t-2]+` + 1;
if (`+a[t-2]+" < "+e[t-2]+`) {
result.a = getValue(`+a+`);
}
`+a[t-1]+" = "+a[t-1]+` - 1;
if (`+a[t-2]+" < "+e[t-2]+` &&
`+a[t-1]+" < "+e[t-1]+`) {
result.b = getValue(`+a+`);
}
setOutput(result);
}
`};function _r(n,r,e){var t=n.indexOf(r);return n.map(function(o,a){return a===t?o+" - "+e:o}).join()}var Un=function(n){this.variableNames=["x","dy"],this.outputShape=n.filterShape;var r=n.strideHeight,e=n.strideWidth,t=n.padInfo.top,o=n.padInfo.left,a=n.dataFormat==="channelsLast";this.userCode=`
void main() {
ivec4 coords = getOutputCoords();
int wR = coords.x;
int wC = coords.y;
int d1 = coords.z;
int d2 = coords.w;
// Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2).
// ? = to be determined. : = across all values in that axis.
float dotProd = 0.0;
for (int b = 0; b < `+n.batchSize+`; b++) {
for (int yR = 0; yR < `+n.outHeight+`; yR++) {
int xR = wR + yR * `+r+" - "+t+`;
if (xR < 0 || xR >= `+n.inHeight+`) {
continue;
}
for (int yC = 0; yC < `+n.outWidth+`; yC++) {
int xC = wC + yC * `+e+" - "+o+`;
if (xC < 0 || xC >= `+n.inWidth+`) {
continue;
}
if (`+a+`) {
float dyValue = getDy(b, yR, yC, d2);
float xValue = getX(b, xR, xC, d1);
dotProd += (xValue * dyValue);
} else {
float dyValue = getDy(b, d2, yR, yC);
float xValue = getX(b, d1, xR, xC);
dotProd += (xValue * dyValue);
}
}
}
}
setOutput(dotProd);
}
`},Rn=function(n){this.variableNames=["dy","W"],this.outputShape=n.inShape;var r=n.filterHeight,e=n.filterWidth,t=n.strideHeight,o=n.strideWidth,a=n.dataFormat==="channelsLast",i=r-1-n.padInfo.top,s=e-1-n.padInfo.left,u=a?1:2,f=a?2:3,C=a?3:1;this.userCode=`
const ivec2 pads = ivec2(`+i+", "+s+`);
void main() {
ivec4 coords = getOutputCoords();
int batch = coords[0];
int d1 = coords[`+C+`];
ivec2 dyCorner = ivec2(coords[`+u+"], coords["+f+`]) - pads;
int dyRCorner = dyCorner.x;
int dyCCorner = dyCorner.y;
// Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).
// ? = to be determined. : = across all values in that axis.
float dotProd = 0.0;
for (int wR = 0; wR < `+r+`; wR++) {
float dyR = float(dyRCorner + wR) / `+t+`.0;
if (dyR < 0.0 || dyR >= `+n.outHeight+`.0 || fract(dyR) > 0.0) {
continue;
}
int idyR = int(dyR);
int wRPerm = `+r+` - 1 - wR;
for (int wC = 0; wC < `+e+`; wC++) {
float dyC = float(dyCCorner + wC) / `+o+`.0;
if (dyC < 0.0 || dyC >= `+n.outWidth+`.0 ||
fract(dyC) > 0.0) {
continue;
}
int idyC = int(dyC);
int wCPerm = `+e+` - 1 - wC;
for (int d2 = 0; d2 < `+n.outChannels+`; d2++) {
if (`+a+`) {
float xValue = getDy(batch, idyR, idyC, d2);
float wValue = getW(wRPerm, wCPerm, d1, d2);
dotProd += xValue * wValue;
} else {
float xValue = getDy(batch, d2, idyR, idyC);
float wValue = getW(wRPerm, wCPerm, d1, d2);
dotProd += xValue * wValue;
}
}
}
}
setOutput(dotProd);
}
`},Ko=function(n){this.variableNames=["x","dy"],this.outputShape=n.filterShape;var r=n.strideDepth,e=n.strideHeight,t=n.strideWidth,o=n.padInfo.front,a=n.padInfo.top,i=n.padInfo.left;this.userCode=`
void main() {
ivec5 coords = getOutputCoords();
int wF = coords.x;
int wR = coords.y;
int wC = coords.z;
int d1 = coords.w;
int d2 = coords.u;
float dotProd = 0.0;
for (int b = 0; b < `+n.batchSize+`; b++) {
for (int yF = 0; yF < `+n.outDepth+`; yF++) {
int xF = wF + yF * `+r+" - "+o+`;
if (xF < 0 || xF >= `+n.inDepth+`) {
continue;
}
for (int yR = 0; yR < `+n.outHeight+`; yR++) {
int xR = wR + yR * `+e+" - "+a+`;
if (xR < 0 || xR >= `+n.inHeight+`) {
continue;
}
for (int yC = 0; yC < `+n.outWidth+`; yC++) {
int xC = wC + yC * `+t+" - "+i+`;
if (xC < 0 || xC >= `+n.inWidth+`) {
continue;
}
float dyValue = getDy(b, yF, yR, yC, d2);
float xValue = getX(b, xF, xR, xC, d1);
dotProd += (xValue * dyValue);
}
}
}
}
setOutput(dotProd);
}
`},Wn=function(n){this.variableNames=["dy","W"],this.outputShape=n.inShape;var r=n.filterDepth,e=n.filterHeight,t=n.filterWidth,o=n.strideDepth,a=n.strideHeight,i=n.strideWidth,s=r-1-n.padInfo.front,u=e-1-n.padInfo.top,f=t-1-n.padInfo.left;this.userCode=`
const ivec3 pads = ivec3(`+s+", "+u+", "+f+`);
void main() {
ivec5 coords = getOutputCoords();
int batch = coords.x;
int d1 = coords.u;
ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;
int dyFCorner = dyCorner.x;
int dyRCorner = dyCorner.y;
int dyCCorner = dyCorner.z;
float dotProd = 0.0;
for (int wF = 0; wF < `+r+`; wF++) {
float dyF = float(dyFCorner + wF) / `+o+`.0;
if (dyF < 0.0 || dyF >= `+n.outDepth+`.0 || fract(dyF) > 0.0) {
continue;
}
int idyF = int(dyF);
int wFPerm = `+r+` - 1 - wF;
for (int wR = 0; wR < `+e+`; wR++) {
float dyR = float(dyRCorner + wR) / `+a+`.0;
if (dyR < 0.0 || dyR >= `+n.outHeight+`.0 ||
fract(dyR) > 0.0) {
continue;
}
int idyR = int(dyR);
int wRPerm = `+e+` - 1 - wR;
for (int wC = 0; wC < `+t+`; wC++) {
float dyC = float(dyCCorner + wC) / `+i+`.0;
if (dyC < 0.0 || dyC >= `+n.outWidth+`.0 ||
fract(dyC) > 0.0) {
continue;
}
int idyC = int(dyC);
int wCPerm = `+t+` - 1 - wC;
for (int d2 = 0; d2 < `+n.outChannels+`; d2++) {
float xValue = getDy(batch, idyF, idyR, idyC, d2);
float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2);
dotProd += xValue * wValue;
}
}
}
}
setOutput(dotProd);
}
`},hi=function(n){this.variableNames=["x","dy"],this.outputShape=n.filterShape;var r=n.strideHeight,e=n.strideWidth,t=n.padInfo.top,o=n.padInfo.left,a=n.outChannels/n.inChannels;this.userCode=`
void main() {
ivec4 coords = getOutputCoords();
int wR = coords.x;
int wC = coords.y;
int d1 = coords.z;
int dm = coords.w;
int d2 = d1 * `+a+` + dm;
float dotProd = 0.0;
// TO DO: Vec4 over the batch size
for (int b = 0; b < `+n.batchSize+`; b++) {
for (int yR = 0; yR < `+n.outHeight+`; yR++) {
int xR = wR + yR * `+r+" - "+t+`;
if (xR < 0 || xR >= `+n.inHeight+`) {
continue;
}
for (int yC = 0; yC < `+n.outWidth+`; yC++) {
int xC = wC + yC * `+e+" - "+o+`;
if (xC < 0 || xC >= `+n.inWidth+`) {
continue;
}
float dyValue = getDy(b, yR, yC, d2);
float xValue = getX(b, xR, xC, d1);
dotProd += (xValue * dyValue);
}
}
}
setOutput(dotProd);
}
`},gr=function(n){this.variableNames=["dy","W"],this.outputShape=n.inShape;var r=n.filterHeight,e=n.filterWidth,t=n.strideHeight,o=n.strideWidth,a=r-1-n.padInfo.top,i=e-1-n.padInfo.left,s=n.outChannels/n.inChannels;this.userCode=`
const ivec2 pads = ivec2(`+a+", "+i+`);
void main() {
ivec4 coords = getOutputCoords();
int batch = coords[0];
int d1 = coords[3];
ivec2 dyCorner = coords.yz - pads;
int dyRCorner = dyCorner.x;
int dyCCorner = dyCorner.y;
float dotProd = 0.0;
for (int wR = 0; wR < `+r+`; wR++) {
float dyR = float(dyRCorner + wR) / `+t+`.0;
if (dyR < 0.0 || dyR >= `+n.outHeight+`.0 || fract(dyR) > 0.0) {
continue;
}
int idyR = int(dyR);
int wRPerm = `+r+` - 1 - wR;
for (int wC = 0; wC < `+e+`; wC++) {
float dyC = float(dyCCorner + wC) / `+o+`.0;
if (dyC < 0.0 || dyC >= `+n.outWidth+`.0 ||
fract(dyC) > 0.0) {
continue;
}
int idyC = int(dyC);
int wCPerm = `+e+` - 1 - wC;
// TO DO: Vec4 over the channelMul
for (int dm = 0; dm < `+s+`; dm++) {
int d2 = d1 * `+s+` + dm;
float xValue = getDy(batch, idyR, idyC, d2);
float wValue = getW(wRPerm, wCPerm, d1, dm);
dotProd += xValue * wValue;
}
}
}
setOutput(dotProd);
}
`},kt=function(n,r,e,t){r===void 0&&(r=!1),e===void 0&&(e=null),t===void 0&&(t=!1),this.variableNames=["x","W"],this.outputShape=n.outShape;var o=n.padInfo.top,a=n.padInfo.left,i=n.strideHeight,s=n.strideWidth,u=n.dilationHeight,f=n.dilationWidth,C=n.filterHeight,k=n.filterWidth,L=4*Math.floor(n.inChannels/4),X=n.inChannels%4,oe=n.dataFormat==="channelsLast",ue=oe?1:2,se=oe?2:3,ce=oe?3:1,xe="",we="";e&&(xe=t?`float activation(float a) {
float b = getPreluActivationWeightsAtOutCoords();
`+e+`
}`:`
float activation(float x) {
`+e+`
}
`,we="result = activation(result);");var Ee=r?"result += getBiasAtOutCoords();":"";r&&this.variableNames.push("bias"),t&&this.variableNames.push("preluActivationWeights"),this.userCode=`
`+xe+`
const ivec2 strides = ivec2(`+i+", "+s+`);
const ivec2 pads = ivec2(`+o+", "+a+`);
void main() {
ivec4 coords = getOutputCoords();
int batch = coords[0];
int d2 = coords[`+ce+`];
ivec2 xRCCorner =
ivec2(coords[`+ue+"], coords["+se+`]) * strides - pads;
int xRCorner = xRCCorner.x;
int xCCorner = xRCCorner.y;
// Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).
// ? = to be determined. : = across all values in that axis.
float dotProd = 0.0;
for (int wR = 0; wR < `+C+`; wR++) {
int xR = xRCorner + wR * `+u+`;
if (xR < 0 || xR >= `+n.inHeight+`) {
continue;
}
for (int wC = 0; wC < `+k+`; wC++) {
int xC = xCCorner + wC * `+f+`;
if (xC < 0 || xC >= `+n.inWidth+`) {
continue;
}
for (int d1 = 0; d1 < `+L+`; d1 += 4) {
vec4 wValues = vec4(
getW(wR, wC, d1, d2),
getW(wR, wC, d1 + 1, d2),
getW(wR, wC, d1 + 2, d2),
getW(wR, wC, d1 + 3, d2)
);
if (`+oe+`) {
vec4 xValues = vec4(
getX(batch, xR, xC, d1),
getX(batch, xR, xC, d1 + 1),
getX(batch, xR, xC, d1 + 2),
getX(batch, xR, xC, d1 + 3)
);
dotProd += dot(xValues, wValues);
} else {
vec4 xValues = vec4(
getX(batch, d1, xR, xC),
getX(batch, d1 + 1, xR, xC),
getX(batch, d1 + 2, xR, xC),
getX(batch, d1 + 3, xR, xC)
);
dotProd += dot(xValues, wValues);
}
}
if (`+(X===1)+`) {
if (`+oe+`) {
dotProd +=
getX(batch, xR, xC, `+L+`) *
getW(wR, wC, `+L+`, d2);
} else {
dotProd +=
getX(batch, `+L+`, xR, xC) *
getW(wR, wC, `+L+`, d2);
}
} else if (`+(X===2)+`) {
vec2 wValues = vec2(
getW(wR, wC, `+L+`, d2),
getW(wR, wC, `+L+` + 1, d2)
);
if (`+oe+`) {
vec2 xValues = vec2(
getX(batch, xR, xC, `+L+`),
getX(batch, xR, xC, `+L+` + 1)
);
dotProd += dot(xValues, wValues);
} else {
vec2 xValues = vec2(
getX(batch, `+L+`, xR, xC),
getX(batch, `+L+` + 1, xR, xC)
);
dotProd += dot(xValues, wValues);
}
} else if (`+(X===3)+`) {
vec3 wValues = vec3(
getW(wR, wC, `+L+`, d2),
getW(wR, wC, `+L+` + 1, d2),
getW(wR, wC, `+L+` + 2, d2)
);
if (`+oe+`) {
vec3 xValues = vec3(
getX(batch, xR, xC, `+L+`),
getX(batch, xR, xC, `+L+` + 1),
getX(batch, xR, xC, `+L+` + 2)
);
dotProd += dot(xValues, wValues);
} else {
vec3 xValues = vec3(
getX(batch, `+L+`, xR, xC),
getX(batch, `+L+` + 1, xR, xC),
getX(batch, `+L+` + 2, xR, xC)
);
dotProd += dot(xValues, wValues);
}
}
}
}
float result = dotProd;
`+Ee+`
`+we+`
setOutput(result);
}
`},Vt=function(n){this.variableNames=["x","W"],this.outputShape=n.outShape;var r=n.padInfo.front,e=n.padInfo.top,t=n.padInfo.left,o=n.strideDepth,a=n.strideHeight,i=n.strideWidth,s=n.dilationDepth,u=n.dilationHeight,f=n.dilationWidth,C=n.filterDepth,k=n.filterHeight,L=n.filterWidth,X=4*Math.floor(n.inChannels/4),oe=n.inChannels%4;this.userCode=`
const ivec3 strides = ivec3(`+o+", "+a+", "+i+`);
const ivec3 pads = ivec3(`+r+", "+e+", "+t+`);
void main() {
ivec5 coords = getOutputCoords();
int batch = coords.x;
int d2 = coords.u;
ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;
int xFCorner = xFRCCorner.x;
int xRCorner = xFRCCorner.y;
int xCCorner = xFRCCorner.z;
// Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get
// y(yF, yR, yC, d2). ? = to be determined. : = across all
// values in that axis.
float dotProd = 0.0;
for (int wF = 0; wF < `+C+`; wF++) {
int xF = xFCorner + wF * `+s+`;
if (xF < 0 || xF >= `+n.inDepth+`) {
continue;
}
for (int wR = 0; wR < `+k+`; wR++) {
int xR = xRCorner + wR * `+u+`;
if (xR < 0 || xR >= `+n.inHeight+`) {
continue;
}
for (int wC = 0; wC < `+L+`; wC++) {
int xC = xCCorner + wC * `+f+`;
if (xC < 0 || xC >= `+n.inWidth+`) {
continue;
}
for (int d1 = 0; d1 < `+X+`; d1 += 4) {
vec4 xValues = vec4(
getX(batch, xF, xR, xC, d1),
getX(batch, xF, xR, xC, d1 + 1),
getX(batch, xF, xR, xC, d1 + 2),
getX(batch, xF, xR, xC, d1 + 3)
);
vec4 wValues = vec4(
getW(wF, wR, wC, d1, d2),
getW(wF, wR, wC, d1 + 1, d2),
getW(wF, wR, wC, d1 + 2, d2),
getW(wF, wR, wC, d1 + 3, d2)
);
dotProd += dot(xValues, wValues);
}
if (`+(oe===1)+`) {
dotProd +=
getX(batch, xF, xR, xC, `+X+`) *
getW(wF, wR, wC, `+X+`, d2);
} else if (`+(oe===2)+`) {
vec2 xValues = vec2(
getX(batch, xF, xR, xC, `+X+`),
getX(batch, xF, xR, xC, `+X+` + 1)
);
vec2 wValues = vec2(
getW(wF, wR, wC, `+X+`, d2),
getW(wF, wR, wC, `+X+` + 1, d2)
);
dotProd += dot(xValues, wValues);
} else if (`+(oe===3)+`) {
vec3 xValues = vec3(
getX(batch, xF, xR, xC, `+X+`),
getX(batch, xF, xR, xC, `+X+` + 1),
getX(batch, xF, xR, xC, `+X+` + 2)
);
vec3 wValues = vec3(
getW(wF, wR, wC, `+X+`, d2),
getW(wF, wR, wC, `+X+` + 1, d2),
getW(wF, wR, wC, `+X+` + 2, d2)
);
dotProd += dot(xValues, wValues);
}
}
}
}
setOutput(dotProd);
}
`},yr=function(n,r,e,t){r===void 0&&(r=!1),e===void 0&&(e=null),t===void 0&&(t=!1),this.variableNames=["x","W"],this.outputShape=n.outShape;var o=n.inHeight,a=n.inWidth,i=n.padInfo.top,s=n.padInfo.left,u=n.strideHeight,f=n.strideWidth,C=n.dilationHeight,k=n.dilationWidth,L=n.filterHeight,X=n.filterWidth,oe=n.outChannels/n.inChannels,ue="",se="";e&&(ue=t?`float activation(float a) {
float b = getPreluActivationWeightsAtOutCoords();
`+e+`
}`:`
float activation(float x) {
`+e+`
}
`,se="result = activation(result);");var ce=r?"result += getBiasAtOutCoords();":"";r&&this.variableNames.push("bias"),t&&this.variableNames.push("preluActivationWeights"),this.userCode=`
`+ue+`
const ivec2 strides = ivec2(`+u+", "+f+`);
const ivec2 pads = ivec2(`+i+", "+s+`);
void main() {
ivec4 coords = getOutputCoords();
int batch = coords.x;
ivec2 xRCCorner = coords.yz * strides - pads;
int d2 = coords.w;
int d1 = d2 / `+oe+`;
int q = d2 - d1 * `+oe+`;
int xRCorner = xRCCorner.x;
int xCCorner = xRCCorner.y;
// Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).
// ? = to be determined. : = across all values in that axis.
float dotProd = 0.0;
// TO DO(dsmilkov): Flatten the two for loops and vec4 the operations.
for (int wR = 0; wR < `+L+`; wR++) {
int xR = xRCorner + wR * `+C+`;
if (xR < 0 || xR >= `+o+`) {
continue;
}
for (int wC = 0; wC < `+X+`; wC++) {
int xC = xCCorner + wC * `+k+`;
if (xC < 0 || xC >= `+a+`) {
continue;
}
float xVal = getX(batch, xR, xC, d1);
float wVal = getW(wR, wC, d1, q);
dotProd += xVal * wVal;
}
}
float result = dotProd;
`+ce+`
`+se+`
setOutput(result);
}
`},dr=function(n,r,e,t){r===void 0&&(r=!1),e===void 0&&(e=null),t===void 0&&(t=!1),this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n.outShape;for(var o=n.inHeight,a=n.inWidth,i=n.padInfo.top,s=n.padInfo.left,u=n.strideHeight,f=n.strideWidth,C=n.dilationHeight,k=n.dilationWidth,L=n.filterHeight,X=n.filterWidth,oe=X,ue="int xR; int xC; int xCOffset;",se=0;se<L;se++)for(var ce=0;ce<X;ce++)ue+=`
vec4 xTexelR`+se+"C"+2*ce+` = vec4(0.);
vec4 wR`+se+"C"+ce+` = vec4(0.);
vec4 xR`+se+"C"+ce+" = vec4(0.);";for(se=0;se<L;se++)for(var xe=0;xe<oe;xe++){if(ue+=`
xR = xRCorner + `+se*C+`;
xC = xCCorner + `+(ce=2*xe)*k+`;
`,f===1){if(ce<X&&(ue+=s%2==1?`
xCOffset = xC + 1;
if(xR >= 0 && xR < `+o+" && xCOffset >= 0 && xCOffset < "+a+`) {
xTexelR`+se+"C"+ce+` = getX(batch, xR, xCOffset, d1);
// Need to manually clear unused channels in case
// we're reading from recycled texture.
if(xCOffset + 1 >= `+a+`) {
xTexelR`+se+"C"+ce+`.zw = vec2(0.);
}
} else {
xTexelR`+se+"C"+ce+` = vec4(0.);
}
xCOffset = xC + 1 - 2;
if(xR >= 0 && xR < `+o+" && xCOffset >= 0 && xCOffset < "+a+`) {
vec4 previous = getX(batch, xR, xCOffset, d1);
// Need to manually clear unused channels in case
// we're reading from recycled texture.
if(xCOffset + 1 >= `+a+`) {
previous.zw = vec2(0.);
}
xR`+se+"C"+ce+" = vec4(previous.zw, xTexelR"+se+"C"+ce+`.xy);
} else {
xR`+se+"C"+ce+" = vec4(0, 0, xTexelR"+se+"C"+ce+`.xy);
}
`:`
if(xR >= 0 && xR < `+o+" && xC >= 0 && xC < "+a+`) {
xTexelR`+se+"C"+ce+` = getX(batch, xR, xC, d1);
} else {
xTexelR`+se+"C"+ce+` = vec4(0.);
}
xR`+se+"C"+ce+" = xTexelR"+se+"C"+ce+`;
`,ce+1<X)){var we=s%2==0?te(k):k;k%2==0&&s%2==1||k%2!=0&&s%2!=1?(ue+=`
xCOffset = xC + `+s%2+" + "+we+`;
if(xR >= 0 && xR < `+o+` &&
xCOffset >= 0 && xCOffset < `+a+`) {
xTexelR`+se+"C"+(ce+2)+` = getX(batch, xR, xCOffset, d1);
}
`,k>1&&(ue+=`
xCOffset -= 2;
if(xR >= 0 && xR < `+o+` &&
xCOffset >= 0 && xCOffset < `+a+`) {
xTexelR`+se+"C"+ce+` = getX(batch, xR, xCOffset, d1);
} else {
xTexelR`+se+"C"+ce+` = vec4(0.);
}
`),ue+=`
xR`+se+"C"+(ce+1)+` = vec4(
xTexelR`+se+"C"+ce+".zw, xTexelR"+se+"C"+(ce+2)+`.xy);
`):ue+=`
xCOffset = xC + `+we+`;
if(xR >= 0 && xR < `+o+` &&
xCOffset >= 0 && xCOffset < `+a+`) {
xTexelR`+se+"C"+(ce+2)+` = getX(batch, xR, xCOffset, d1);
}
xR`+se+"C"+(ce+1)+" = xTexelR"+se+"C"+(ce+2)+`;
`}}else ce<X&&(ue+=`
if(xR >= 0 && xR < `+o+`) {
`,s%2==1?(ue+=`
xCOffset = xC + 1 - `+f+`;
if(xCOffset >= 0 && xCOffset < `+a+`) {
xTexelR`+se+"C"+ce+` = getX(batch, xR, xCOffset, d1);
} else {
xTexelR`+se+"C"+ce+` = vec4(0.);
}
if(xC + 1 >= 0 && xC + 1 < `+a+`) {
xTexelR`+se+"C"+(ce+2)+` = getX(batch, xR, xC + 1, d1);
} else {
xTexelR`+se+"C"+(ce+2)+` = vec4(0.);
}
xR`+se+"C"+ce+` = vec4(
xTexelR`+se+"C"+ce+".zw, xTexelR"+se+"C"+(ce+2)+`.zw);
`,ce+1<X&&(ue+=`
vec4 final = vec4(0.);
xCOffset = xC + 1 + `+f+`;
if(xCOffset >= 0 && xCOffset < `+a+`) {
final = getX(batch, xR, xCOffset, d1);
}
xR`+se+"C"+(ce+1)+" = vec4(xTexelR"+se+"C"+(ce+2)+`.xy, final.xy);
`)):(ue+=`
if(xC >= 0 && xC < `+a+`) {
xTexelR`+se+"C"+ce+` = getX(batch, xR, xC, d1);
} else {
xTexelR`+se+"C"+ce+` = vec4(0.);
}
xCOffset = xC + `+f+`;
if(xCOffset >= 0 && xCOffset < `+a+`) {
xTexelR`+se+"C"+(ce+2)+` = getX(batch, xR, xCOffset, d1);
} else {
xTexelR`+se+"C"+(ce+2)+` = vec4(0.);
}
xR`+se+"C"+ce+` = vec4(
xTexelR`+se+"C"+ce+".xy, xTexelR"+se+"C"+(ce+2)+`.xy);
`,ce+1<X&&(ue+=`
xR`+se+"C"+(ce+1)+` = vec4(
xTexelR`+se+"C"+ce+".zw, xTexelR"+se+"C"+(ce+2)+`.zw);
`)),ue+="}");ce<X&&(ue+=`
vec4 wTexelR`+se+"C"+ce+" = getW("+se+", "+ce+`, d1, q);
wR`+se+"C"+ce+" = vec4(wTexelR"+se+"C"+ce+".xz, wTexelR"+se+"C"+ce+`.xz);
`,ce+1<X&&(ue+=`
vec4 wTexelR`+se+"C"+(ce+1)+" = getW("+se+", "+(ce+1)+`, d1, q);
wR`+se+"C"+(ce+1)+` =
vec4(wTexelR`+se+"C"+(ce+1)+".xz, wTexelR"+se+"C"+(ce+1)+".xz);"))}for(se=0;se<L;se++)for(ce=0;ce<X;ce++)ue+="dotProd += xR"+se+"C"+ce+" * wR"+se+"C"+ce+";";var Ee="",Se="";e&&(Ee=t?`vec4 activation(vec4 a) {
vec4 b = getPreluActivationWeightsAtOutCoords();
`+e+`
}`:`vec4 activation(vec4 x) {
`+e+`
}`,Se="result = activation(result);");var Me=r?"result += getBiasAtOutCoords();":"";r&&this.variableNames.push("bias"),t&&this.variableNames.push("preluActivationWeights"),this.userCode=`
`+Ee+`
const ivec2 strides = ivec2(`+u+", "+f+`);
const ivec2 pads = ivec2(`+i+", "+s+`);
void main() {
ivec4 coords = getOutputCoords();
int batch = coords.x;
ivec2 xRCCorner = coords.yz * strides - pads;
int d2 = coords.w;
int d1 = d2;
int q = 0;
int xRCorner = xRCCorner.x;
int xCCorner = xRCCorner.y;
vec4 dotProd = vec4(0.);
`+ue+`
vec4 result = dotProd;
`+Me+`
`+Se+`
setOutput(result);
}
`},jt=function(n,r,e,t,o){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];var a=n[0],i=n[1],s=n[2],u=n[3],f=r[0],C=e[0],k=e[1];this.outputShape=[f,C,k,u];var L=t==="bilinear"?1:0,X=[i-1+".0",s-1+".0"],oe=X[0],ue=X[1],se=C>1?[""+(i-1)/(C-1),"(y2-y1) * height_ratio","y1*"+oe+" + float(y)*(height_scale)"]:["0.0","0.0","0.5 * (y1+y2) * "+oe],ce=se[0],xe=se[1],we=se[2],Ee=k>1?[""+(s-1)/(k-1),"(x2-x1) * width_ratio","x1*"+ue+" + float(x)*(width_scale)"]:["0.0","0.0","0.5 * (x1+x2) * "+ue],Se=Ee[0],Me=Ee[1],ze=Ee[2];this.userCode=`
const float height_ratio = float(`+ce+`);
const float width_ratio = float(`+Se+`);
void main() {
ivec4 coords = getOutputCoords();
int b = coords[0];
int y = coords[1];
int x = coords[2];
int d = coords[3];
// get box vals
float y1 = getBoxes(b,0);
float x1 = getBoxes(b,1);
float y2 = getBoxes(b,2);
float x2 = getBoxes(b,3);
// get image in batch index
int bInd = round(getBoxInd(b));
if(bInd < 0 || bInd >= `+a+`) {
return;
}
float height_scale = `+xe+`;
float width_scale = `+Me+`;
float in_y = `+we+`;
if( in_y < 0.0 || in_y > `+oe+` ) {
setOutput(float(`+o+`));
return;
}
float in_x = `+ze+`;
if( in_x < 0.0 || in_x > `+ue+` ) {
setOutput(float(`+o+`));
return;
}
vec2 sourceFracIndexCR = vec2(in_x,in_y);
if(`+L+` == 1) {
// Compute the four integer indices.
ivec2 sourceFloorCR = ivec2(sourceFracIndexCR);
ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR));
float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d);
float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d);
float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d);
float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d);
vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR);
float top = topLeft + (topRight - topLeft) * fracCR.x;
float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;
float newValue = top + (bottom - top) * fracCR.y;
setOutput(newValue);
} else {
// Compute the coordinators of nearest neighbor point.
ivec2 sourceNearestCR = ivec2(floor(
sourceFracIndexCR + vec2(0.5,0.5)));
float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d);
setOutput(newValue);
}
}
`},Zt=function(n,r,e){this.variableNames=["x"],this.outputShape=n;var t=n.length,o=n[n.length-1],a=e?"<":">";this.userCode=`
int getIndex(int i) {
`+(e?"return "+o+" -i - 1;":"return i;")+`
}
void main() {
`+Ge(t)+` coords = getOutputCoords();
int end = `+Qt(t,"coords")+`;
float val = 0.0;
for (int i = `+o+` - 1; i >= 0; i -= 1) {
int idx = getIndex(i);
if (idx `+a+` end) {
continue;
}
if (idx == end && `+r+`) {
continue;
}
`+Qt(t,"coords")+` = idx;
val += getX(`+function(i,s){if(i===1)return""+s;if(i===2)return s+".x, "+s+".y";if(i===3)return s+".x, "+s+".y, "+s+".z";if(i===4)return s+".x, "+s+".y, "+s+".z, "+s+".w";throw Error("Cumulative sum for rank "+i+" is not yet supported")}(t,"coords")+`);
}
setOutput(val);
}
`};function Qt(n,r){if(n===1)return""+r;if(n===2)return r+".y";if(n===3)return r+".z";if(n===4)return r+".w";throw Error("Cumulative sum for rank "+n+" is not yet supported")}var pr=function(n){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=Mo.DENSE;var r=Or(n),e=Kr();this.outputShape=n,this.userCode=`
ivec3 outCoordsFromFlatIndex(int index) {
`+O(["r","c","d"],n)+`
return ivec3(r, c, d);
}
void main() {
ivec2 resTexRC = ivec2(resultUV.yx *
vec2(`+r[0]+", "+r[1]+`));
int index = 4 * (resTexRC.x * `+r[1]+` + resTexRC.y);
vec4 result = vec4(0.);
for (int i=0; i<4; i++) {
int flatIndex = index + i;
ivec3 rc = outCoordsFromFlatIndex(flatIndex);
result[i] = getA(rc.x, rc.y, rc.z);
}
`+e.output+` = result;
}
`},Xt=function(n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=Mo.DENSE;var r=Or(n),e=Kr();this.outputShape=n,this.userCode=`
ivec3 outCoordsFromFlatIndex(int index) {
`+O(["r","c","d"],n)+`
return ivec3(r, c, d);
}
void main() {
ivec2 resTexRC = ivec2(resultUV.yx *
vec2(`+r[0]+", "+r[1]+`));
int index = 4 * (resTexRC.x * `+r[1]+` + resTexRC.y);
vec4 result = vec4(0.);
for (int i=0; i<4; i++) {
int flatIndex = index + i;
ivec3 rc = outCoordsFromFlatIndex(flatIndex);
result[i] = getChannel(getA(rc.x, rc.y, rc.z), vec2(rc.y, rc.z));
}
`+e.output+` = result;
}
`},wr=function(){function n(r,e,t){this.variableNames=["x"],this.outputShape=[],this.outputShape=r,this.blockSize=e,this.dataFormat=t,this.userCode=`
void main() {
ivec4 coords = getOutputCoords();
int b = coords[0];
int h = `+this.getHeightCoordString()+`;
int w = `+this.getWidthCoordString()+`;
int d = `+this.getDepthCoordString()+`;
int in_h = h / `+e+`;
int offset_h = imod(h, `+e+`);
int in_w = w / `+e+`;
int offset_w = imod(w, `+e+`);
int offset_d = (offset_h * `+e+` + offset_w) *
`+this.getOutputDepthSize()+`;
int in_d = d + offset_d;
float result = `+this.getInputSamplingString()+`;
setOutput(result);
}
`}return n.prototype.getHeightCoordString=function(){return this.dataFormat==="NHWC"?"coords[1]":"coords[2]"},n.prototype.getWidthCoordString=function(){return this.dataFormat==="NHWC"?"coords[2]":"coords[3]"},n.prototype.getDepthCoordString=function(){return this.dataFormat==="NHWC"?"coords[3]":"coords[1]"},n.prototype.getOutputDepthSize=function(){return this.dataFormat==="NHWC"?this.outputShape[3]:this.outputShape[1]},n.prototype.getInputSamplingString=function(){return this.dataFormat==="NHWC"?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"},n}(),ro=function(n){this.variableNames=["X"],this.outputShape=[n,n],this.userCode=`
void main() {
ivec2 coords = getOutputCoords();
float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0;
setOutput(val);
}
`},Hn=function(n){this.variableNames=["A"],this.outTexUsage=Wr.DOWNLOAD;var r=Kr();this.outputShape=n,this.userCode=`
`+A+`
void main() {
float x = getAAtOutCoords();
`+r.output+` = encode_float(x);
}
`},Yo=function(n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=Wr.DOWNLOAD;var r=Kr();this.outputShape=n,this.userCode=`
`+A+`
void main() {
ivec3 coords = getOutputCoords();
float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z));
`+r.output+` = encode_float(x);
}
`},Br=function(n,r,e){e===void 0&&(e=!1),this.variableNames=["A"];var t=Kr(),o=r[0],a=r[1];this.outputShape=n;var i="result";e&&(i="floor(result * 255. + 0.5)"),this.userCode=`
`+w(n)+`
void main() {
ivec3 coords = getOutputCoords();
int flatIndex = getFlatIndex(coords);
int offset = imod(flatIndex, 4);
flatIndex = idiv(flatIndex, 4, 1.);
int r = flatIndex / `+a+`;
int c = imod(flatIndex, `+a+`);
vec2 uv = (vec2(c, r) + halfCR) / vec2(`+a+".0, "+o+`.0);
vec4 values = `+t.texture2D+`(A, uv);
float result;
if(offset == 0) {
result = values[0];
} else if(offset == 1) {
result = values[1];
} else if(offset == 2) {
result = values[2];
} else {
result = values[3];
}
`+t.output+" = vec4("+i+`, 0., 0., 0.);
}
`},Ra=function(n,r,e){e===void 0&&(e=!1),this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;var t=Kr(),o=r[0],a=r[1];this.outputShape=n;var i="",s="result";e&&(s="floor(result * 255. + 0.5)");for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){var C=2*u+f;i+=`
localCoords = coords;
if(localCoords[2] + `+f+" < "+n[2]+`) {
localCoords[2] += `+f+`;
if(localCoords[1] + `+u+" < "+n[1]+`) {
localCoords[1] += `+u+`;
flatIndex = getFlatIndex(localCoords);
offset = imod(flatIndex, 4);
flatIndex = idiv(flatIndex, 4, 1.);
r = flatIndex / `+a+`;
c = imod(flatIndex, `+a+`);
uv = (vec2(c, r) + halfCR) / vec2(`+a+".0, "+o+`.0);
values = `+t.texture2D+`(A, uv);
if(offset == 0) {
result[`+C+`] = values[0];
} else if(offset == 1) {
result[`+C+`] = values[1];
} else if(offset == 2) {
result[`+C+`] = values[2];
} else {
result[`+C+`] = values[3];
}
}
}
`}this.userCode=`
`+w(n)+`
void main() {
ivec3 coords = getOutputCoords();
vec4 result = vec4(0.);
int flatIndex, r, c, offset;
ivec3 localCoords;
vec2 uv;
vec4 values;
`+i+`
`+t.output+" = "+s+`;
}
`},pi="return real * expR - imag * expI;",mi="return real * expI + imag * expR;",Ia=function(n,r,e){this.variableNames=["real","imag"];var t=r[1];this.outputShape=r;var o=e?"2.0 * "+Math.PI:"-2.0 * "+Math.PI,a=e?t+".0":"1.0";this.userCode=`
const float exponentMultiplier = `+o+`;
float unaryOpComplex(float real, float expR, float imag, float expI) {
`+n+`
}
float mulMatDFT(int batch, int index) {
float indexRatio = float(index) / float(`+t+`);
float exponentMultiplierTimesIndexRatio =
exponentMultiplier * indexRatio;
float result = 0.0;
for (int i = 0; i < `+t+`; i++) {
// x = (-2|2 * PI / N) * index * i;
float x = exponentMultiplierTimesIndexRatio * float(i);
float expR = cos(x);
float expI = sin(x);
float real = getReal(batch, i);
float imag = getImag(batch, i);
result +=
unaryOpComplex(real, expR, imag, expI) / `+a+`;
}
return result;
}
void main() {
ivec2 coords = getOutputCoords();
setOutput(mulMatDFT(coords[0], coords[1]));
}
`},vi=function(){function n(r,e){this.outputShape=[],this.variableNames=["x"],this.outputShape=r,this.userCode=`
uniform float value;
void main() {
// Input can be obtained from uniform value.
setOutput(value);
}
`}return n.prototype.getCustomSetupFunc=function(r){var e=this;return function(t,o){e.valueLoc==null&&(e.valueLoc=t.getUniformLocationNoThrow(o,"value")),t.gl.uniform1f(e.valueLoc,r)}},n}(),br=function(n,r,e){this.variableNames=["A","indices"];var t=n.slice();t[e]=r,this.outputShape=t,this.rank=t.length;var o=Ge(this.rank),a=function(i,s){var u=i.length;if(u>4)throw Error("Gather for rank "+u+" is not yet supported");if(u===1)return"int(getIndices(resRC))";for(var f=["resRC.x","resRC.y","resRC.z","resRC.w"],C=[],k=0;k<i.length;k++)k===s?C.push("int(getIndices("+f[k]+"))"):C.push(""+f[k]);return C.join()}(n,e);this.userCode=`
void main() {
`+o+` resRC = getOutputCoords();
setOutput(getA(`+a+`));
}
`},gi=function(n,r,e){this.sliceDim=n,this.strides=r,this.variableNames=["x","indices"],this.outputShape=e;var t=Ge(r.length),o=Ge(e.length),a=this.sliceDim>1?"strides[j]":"strides";this.userCode=`
`+t+" strides = "+t+"("+this.strides+`);
void main() {
`+o+` coords = getOutputCoords();
int flattenIndex = 0;
for (int j = 0; j < `+this.sliceDim+`; j++) {
int index = round(getIndices(coords[0], j));
flattenIndex += index * `+a+`;
}
setOutput(getX(flattenIndex, coords[1]));
}
`};function yi(n,r){var e=Kr();return ws(n,r,e.version+`
precision highp float;
`+e.attribute+` vec3 clipSpacePos;
`+e.attribute+` vec2 uv;
`+e.varyingVs+` vec2 resultUV;
void main() {
gl_Position = vec4(clipSpacePos, 1);
resultUV = uv;
}`)}function bi(n,r){return na(n,r,new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]))}function iu(n,r){return Xa(n,r,new Uint16Array([0,1,2,2,1,3]))}function In(n,r,e,t,o,a,i){aa(e,t);var s=oa(n,r),u=n.TEXTURE_2D;return St(n,r,function(){return n.bindTexture(u,s)}),St(n,r,function(){return n.texParameteri(u,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE)}),St(n,r,function(){return n.texParameteri(u,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE)}),St(n,r,function(){return n.texParameteri(u,n.TEXTURE_MIN_FILTER,n.NEAREST)}),St(n,r,function(){return n.texParameteri(u,n.TEXTURE_MAG_FILTER,n.NEAREST)}),St(n,r,function(){return n.texImage2D(u,0,o,e,t,0,a,i,null)}),St(n,r,function(){return n.bindTexture(n.TEXTURE_2D,null)}),s}function $o(n,r,e,t,o){var a=Yn(e,t);return In(n,r,a[0],a[1],o.internalFormatFloat,o.textureFormatFloat,n.FLOAT)}function hc(n,r,e,t,o){var a=Yn(e,t);return In(n,r,a[0],a[1],o.internalFormatHalfFloat,o.textureFormatFloat,o.textureTypeHalfFloat)}function pc(n,r,e,t,o){var a=Yn(e,t);return In(n,r,a[0],a[1],n.RGBA,n.RGBA,n.UNSIGNED_BYTE)}function mc(n,r,e,t,o){var a=$n(e,t);return In(n,r,a[0],a[1],o.internalFormatPackedFloat,n.RGBA,n.FLOAT)}function vc(n,r,e,t,o){var a=$n(e,t);return In(n,r,a[0],a[1],o.internalFormatPackedHalfFloat,n.RGBA,o.textureTypeHalfFloat)}function gc(n,r,e,t){return St(n,r,function(){return n.bindBuffer(n.ARRAY_BUFFER,t)}),ln(n,r,e,"clipSpacePos",t,3,20,0)&&ln(n,r,e,"uv",t,2,20,12)}function yc(n,r,e,t,o,a,i){var s,u,f;St(n,r,function(){return n.bindTexture(n.TEXTURE_2D,e)}),a instanceof Uint8Array?(s=new Uint8Array(t*o*4),u=n.UNSIGNED_BYTE,f=n.RGBA):(s=new Float32Array(t*o*4),u=n.FLOAT,f=i.internalFormatPackedFloat),s.set(a),St(n,r,function(){return n.texImage2D(n.TEXTURE_2D,0,f,t,o,0,n.RGBA,u,s)}),St(n,r,function(){return n.bindTexture(n.TEXTURE_2D,null)})}function bc(n,r,e,t){St(n,r,function(){return n.bindTexture(n.TEXTURE_2D,e)}),t.data instanceof Uint8Array?St(n,r,function(){return n.texImage2D(n.TEXTURE_2D,0,n.RGBA,t.width,t.height,0,n.RGBA,n.UNSIGNED_BYTE,t.data)}):St(n,r,function(){return n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t)}),St(n,r,function(){return n.bindTexture(n.TEXTURE_2D,null)})}function xc(n,r,e,t,o){var a=n.createBuffer();St(n,r,function(){return n.bindBuffer(n.PIXEL_PACK_BUFFER,a)});var i=16*e*t;return St(n,r,function(){return n.bufferData(n.PIXEL_PACK_BUFFER,i,n.STREAM_READ)}),St(n,r,function(){return n.readPixels(0,0,t,e,n.RGBA,n.FLOAT,0)}),St(n,r,function(){return n.bindBuffer(n.PIXEL_PACK_BUFFER,null)}),a}function wc(n,r,e){var t=n,o=new Float32Array(e);return t.bindBuffer(t.PIXEL_PACK_BUFFER,r),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,o),t.bindBuffer(t.PIXEL_PACK_BUFFER,null),o}function Ec(n,r,e,t,o){var a=Yn(e,t),i=a[0],s=a[1],u=new Uint8Array(e*t*4);return St(n,r,function(){return n.readPixels(0,0,i,s,o.downloadTextureFormat,n.UNSIGNED_BYTE,u)}),new Float32Array(u.buffer)}function _c(n,r,e,t,o,a,i,s){var u=n,f=new Float32Array(function(C,k){var L=$n(C,k);return L[0]*L[1]*4}(a,i));return u.bindBuffer(u.PIXEL_PACK_BUFFER,r),u.getBufferSubData(u.PIXEL_PACK_BUFFER,0,f),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),f}function Cc(n,r,e,t){var o=new Float32Array(e*t*4);return St(n,r,function(){return n.readPixels(0,0,t,e,n.RGBA,n.FLOAT,o)}),o}var ld=Object.freeze({createVertexShader:yi,createVertexBuffer:bi,createIndexBuffer:iu,createFloat32MatrixTexture:$o,createFloat16MatrixTexture:hc,createUnsignedBytesMatrixTexture:pc,createPackedMatrixTexture:mc,createFloat16PackedMatrixTexture:vc,bindVertexProgramAttributeStreams:gc,uploadDenseMatrixToTexture:yc,uploadPixelDataToTexture:bc,createBufferFromOutputTexture:xc,downloadFloat32MatrixFromBuffer:wc,downloadByteEncodedFloatMatrixFromOutputTexture:Ec,downloadPackedMatrixFromBuffer:_c,downloadMatrixFromPackedOutputTexture:Cc}),Tc=function(){function n(r){this.outputTexture=null,this.program=null,this.disposed=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[];var e=p().getNumber("WEBGL_VERSION");r!=null?(this.gl=r,Ga(e,r)):this.gl=vn(e);var t="WEBGL_color_buffer_float";if(p().getNumber("WEBGL_VERSION")===1){if(this.textureFloatExtension=Fo(this.gl,this.debug,"OES_texture_float"),Jr(this.gl,"OES_texture_half_float"))this.textureHalfFloatExtension=Fo(this.gl,this.debug,"OES_texture_half_float");else if(p().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");if(this.colorBufferFloatExtension=this.gl.getExtension(t),Jr(this.gl,"EXT_color_buffer_half_float"))this.colorBufferHalfFloatExtension=Fo(this.gl,this.debug,"EXT_color_buffer_half_float");else if(p().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.")}else if(t="EXT_color_buffer_float",Jr(this.gl,t))this.colorBufferFloatExtension=this.gl.getExtension(t);else{if(!Jr(this.gl,"EXT_color_buffer_half_float"))throw new Error("GL context does not support color renderable floats");this.colorBufferHalfFloatExtension=this.gl.getExtension("EXT_color_buffer_half_float")}this.vertexBuffer=bi(this.gl,this.debug),this.indexBuffer=iu(this.gl,this.debug),this.framebuffer=Sn(this.gl,this.debug),this.textureConfig=Po(this.gl,this.textureHalfFloatExtension)}return Object.defineProperty(n.prototype,"debug",{get:function(){return p().getBool("DEBUG")},enumerable:!0,configurable:!0}),n.prototype.dispose=function(){var r=this;if(!this.disposed){this.program!=null&&console.warn("Disposing a GPGPUContext that still has a bound WebGLProgram. This is probably a resource leak, delete the program with GPGPUContext.deleteProgram before disposing."),this.outputTexture!=null&&console.warn("Disposing a GPGPUContext that still has a bound output matrix texture. This is probably a resource leak, delete the output matrix texture with GPGPUContext.deleteMatrixTexture before disposing.");var e=this.gl;St(e,this.debug,function(){return e.finish()}),St(e,this.debug,function(){return e.bindFramebuffer(e.FRAMEBUFFER,null)}),St(e,this.debug,function(){return e.deleteFramebuffer(r.framebuffer)}),St(e,this.debug,function(){return e.bindBuffer(e.ARRAY_BUFFER,null)}),St(e,this.debug,function(){return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)}),St(e,this.debug,function(){return e.deleteBuffer(r.indexBuffer)}),this.disposed=!0}},n.prototype.createFloat32MatrixTexture=function(r,e){return this.throwIfDisposed(),$o(this.gl,this.debug,r,e,this.textureConfig)},n.prototype.createFloat16MatrixTexture=function(r,e){return this.throwIfDisposed(),hc(this.gl,this.debug,r,e,this.textureConfig)},n.prototype.createUnsignedBytesMatrixTexture=function(r,e){return this.throwIfDisposed(),pc(this.gl,this.debug,r,e,this.textureConfig)},n.prototype.uploadPixelDataToTexture=function(r,e){this.throwIfDisposed(),bc(this.gl,this.debug,r,e)},n.prototype.uploadDenseMatrixToTexture=function(r,e,t,o){this.throwIfDisposed(),yc(this.gl,this.debug,r,e,t,o,this.textureConfig)},n.prototype.createFloat16PackedMatrixTexture=function(r,e){return this.throwIfDisposed(),vc(this.gl,this.debug,r,e,this.textureConfig)},n.prototype.createPackedMatrixTexture=function(r,e){return this.throwIfDisposed(),mc(this.gl,this.debug,r,e,this.textureConfig)},n.prototype.deleteMatrixTexture=function(r){var e=this;this.throwIfDisposed(),this.outputTexture===r&&(sa(this.gl,this.debug,this.framebuffer),this.outputTexture=null),St(this.gl,this.debug,function(){return e.gl.deleteTexture(r)})},n.prototype.downloadByteEncodedFloatMatrixFromOutputTexture=function(r,e,t){var o=this;return this.downloadMatrixDriver(r,function(){return Ec(o.gl,o.debug,e,t,o.textureConfig)})},n.prototype.downloadPackedMatrixFromBuffer=function(r,e,t,o,a,i){return _c(this.gl,r,0,0,0,a,i,this.textureConfig)},n.prototype.downloadFloat32MatrixFromBuffer=function(r,e){return wc(this.gl,r,e)},n.prototype.createBufferFromTexture=function(r,e,t){this.bindTextureToFrameBuffer(r);var o=xc(this.gl,this.debug,e,t,this.textureConfig);return this.unbindTextureToFrameBuffer(),o},n.prototype.createAndWaitForFence=function(){var r=this.createFence(this.gl);return this.pollFence(r)},n.prototype.createFence=function(r){var e,t,o=this;if(p().getBool("WEBGL_FENCE_API_ENABLED")){var a=r,i=a.fenceSync(a.SYNC_GPU_COMMANDS_COMPLETE,0);r.flush(),t=function(){var s=a.clientWaitSync(i,0,0);return s===a.ALREADY_SIGNALED||s===a.CONDITION_SATISFIED},e=i}else p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(e=this.beginQuery(),this.endQuery(),t=function(){return o.isQueryAvailable(e,p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}):t=function(){return!0};return{query:e,isFencePassed:t}},n.prototype.downloadMatrixFromPackedTexture=function(r,e,t){var o=this;return this.downloadMatrixDriver(r,function(){return Cc(o.gl,o.debug,e,t)})},n.prototype.createProgram=function(r){this.throwIfDisposed();var e=this.gl,t=gn(e,this.debug,r),o=yi(e,this.debug),a=an(e,this.debug);return St(e,this.debug,function(){return e.attachShader(a,o)}),St(e,this.debug,function(){return e.attachShader(a,t)}),yn(e,this.debug,a),this.debug&&Jn(e,this.debug,a),this.vertexAttrsAreBound||(this.setProgram(a),this.vertexAttrsAreBound=gc(e,this.debug,this.program,this.vertexBuffer)),a},n.prototype.deleteProgram=function(r){var e=this;this.throwIfDisposed(),r===this.program&&(this.program=null),r!=null&&St(this.gl,this.debug,function(){return e.gl.deleteProgram(r)})},n.prototype.setProgram=function(r){var e=this;this.throwIfDisposed(),this.program=r,this.program!=null&&this.debug&&Jn(this.gl,this.debug,this.program),St(this.gl,this.debug,function(){return e.gl.useProgram(r)})},n.prototype.getUniformLocation=function(r,e,t){return t===void 0&&(t=!0),this.throwIfDisposed(),t?Ai(this.gl,this.debug,r,e):Ya(this.gl,r,e)},n.prototype.getAttributeLocation=function(r,e){var t=this;return this.throwIfDisposed(),St(this.gl,this.debug,function(){return t.gl.getAttribLocation(r,e)})},n.prototype.getUniformLocationNoThrow=function(r,e){return this.throwIfDisposed(),this.gl.getUniformLocation(r,e)},n.prototype.setInputMatrixTexture=function(r,e,t){this.throwIfDisposed(),this.throwIfNoProgram(),$a(this.gl,this.debug,this.program,r,e,t)},n.prototype.setOutputMatrixTexture=function(r,e,t){this.setOutputMatrixTextureDriver(r,t,e)},n.prototype.setOutputPackedMatrixTexture=function(r,e,t){this.throwIfDisposed();var o=$n(e,t),a=o[0],i=o[1];this.setOutputMatrixTextureDriver(r,a,i)},n.prototype.setOutputMatrixWriteRegion=function(r,e,t,o){this.setOutputMatrixWriteRegionDriver(t,r,o,e)},n.prototype.setOutputPackedMatrixWriteRegion=function(r,e,t,o){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")},n.prototype.debugValidate=function(){this.program!=null&&Jn(this.gl,this.debug,this.program),$r(this.gl)},n.prototype.executeProgram=function(){this.throwIfDisposed(),this.throwIfNoProgram();var r=this.gl;this.debug&&this.debugValidate(),St(r,this.debug,function(){return r.drawElements(r.TRIANGLES,6,r.UNSIGNED_SHORT,0)})},n.prototype.blockUntilAllProgramsCompleted=function(){var r=this;this.throwIfDisposed(),St(this.gl,this.debug,function(){return r.gl.finish()})},n.prototype.getQueryTimerExtension=function(){return this.disjointQueryTimerExtension==null&&(this.disjointQueryTimerExtension=Fo(this.gl,this.debug,p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension},n.prototype.getQueryTimerExtensionWebGL2=function(){return this.getQueryTimerExtension()},n.prototype.getQueryTimerExtensionWebGL1=function(){return this.getQueryTimerExtension()},n.prototype.beginQuery=function(){if(p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){var r=this.gl,e=this.getQueryTimerExtensionWebGL2(),t=r.createQuery();return r.beginQuery(e.TIME_ELAPSED_EXT,t),t}var o=this.getQueryTimerExtensionWebGL1(),a=o.createQueryEXT();return o.beginQueryEXT(o.TIME_ELAPSED_EXT,a),a},n.prototype.endQuery=function(){if(p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")!==2){var r=this.getQueryTimerExtensionWebGL1();r.endQueryEXT(r.TIME_ELAPSED_EXT)}else{var e=this.gl,t=this.getQueryTimerExtensionWebGL2();e.endQuery(t.TIME_ELAPSED_EXT)}},n.prototype.waitForQueryAndGetTime=function(r){return E(this,void 0,void 0,function(){var e=this;return g(this,function(t){switch(t.label){case 0:return[4,W(function(){return e.disposed||e.isQueryAvailable(r,p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))})];case 1:return t.sent(),[2,this.getQueryTime(r,p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))]}})})},n.prototype.getQueryTime=function(r,e){if(e===0)return null;if(e===2){var t=this.gl;return t.getQueryParameter(r,t.QUERY_RESULT)/1e6}var o=this.getQueryTimerExtensionWebGL1();return o.getQueryObjectEXT(r,o.QUERY_RESULT_EXT)/1e6},n.prototype.isQueryAvailable=function(r,e){if(e===0)return!0;if(e===2){var t=this.gl,o=this.getQueryTimerExtensionWebGL2(),a=t.getQueryParameter(r,t.QUERY_RESULT_AVAILABLE);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(o.GPU_DISJOINT_EXT)),a&&!this.disjoint}return a=(o=this.getQueryTimerExtensionWebGL1()).getQueryObjectEXT(r,o.QUERY_RESULT_AVAILABLE_EXT),this.disjoint==null&&(this.disjoint=this.gl.getParameter(o.GPU_DISJOINT_EXT)),a&&!this.disjoint},n.prototype.pollFence=function(r){var e=this;return new Promise(function(t){e.addItemToPoll(function(){return r.isFencePassed()},function(){return t()})})},n.prototype.pollItems=function(){for(var r=function(t){for(var o=0;o<t.length&&t[o]();++o);return o-1}(this.itemsToPoll.map(function(t){return t.isDoneFn})),e=0;e<=r;++e)(0,this.itemsToPoll[e].resolveFn)();this.itemsToPoll=this.itemsToPoll.slice(r+1)},n.prototype.addItemToPoll=function(r,e){var t=this;this.itemsToPoll.push({isDoneFn:r,resolveFn:e}),this.itemsToPoll.length>1||W(function(){return t.pollItems(),t.itemsToPoll.length===0})},n.prototype.bindTextureToFrameBuffer=function(r){this.throwIfDisposed(),ia(this.gl,this.debug,r,this.framebuffer),this.debug&&$r(this.gl)},n.prototype.unbindTextureToFrameBuffer=function(){this.outputTexture!=null?(ia(this.gl,this.debug,this.outputTexture,this.framebuffer),this.debug&&$r(this.gl)):sa(this.gl,this.debug,this.framebuffer)},n.prototype.downloadMatrixDriver=function(r,e){this.bindTextureToFrameBuffer(r);var t=e();return this.unbindTextureToFrameBuffer(),t},n.prototype.setOutputMatrixTextureDriver=function(r,e,t){this.throwIfDisposed();var o=this.gl;ia(o,this.debug,r,this.framebuffer),this.debug&&$r(o),this.outputTexture=r,St(o,this.debug,function(){return o.viewport(0,0,e,t)}),St(o,this.debug,function(){return o.scissor(0,0,e,t)})},n.prototype.setOutputMatrixWriteRegionDriver=function(r,e,t,o){var a=this;this.throwIfDisposed(),St(this.gl,this.debug,function(){return a.gl.scissor(r,e,t,o)})},n.prototype.throwIfDisposed=function(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")},n.prototype.throwIfNoProgram=function(){if(this.program==null)throw new Error("No GPU program is currently set.")},n}();function Sc(n,r){if(n.length!==r.length)throw Error("Binary was compiled with "+n.length+" inputs, but was executed with "+r.length+" inputs");n.forEach(function(e,t){var o=e.logicalShape,a=r[t],i=a.shape;if(!_e(o,i))throw Error("Binary was compiled with different shapes than the current args. Shapes "+o+" and "+i+" must match");if(!e.isUniform||!a.isUniform){var s=e.texShape,u=a.isUniform?null:a.texData.texShape;if(!_e(s,u))throw Error("Binary was compiled with different texture shapes than the current args. Shape "+s+" and "+u+" must match")}})}var dd=function(n,r,e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n;for(var t=e.filterWidth,o=e.inChannels,a=e.strideWidth,i=e.strideHeight,s=e.padInfo,u=e.outWidth,f=e.dilationWidth,C=e.dilationHeight,k=e.dataFormat,L=s.left,X=s.top,oe=o*t,ue=Kr(),se=k==="channelsLast",ce=se?0:1,xe=se?1:2,we="",Ee=0;Ee<=1;Ee++)for(var Se=0;Se<=1;Se++)we+=`
blockIndex = rc.y + `+Se+`;
pos = rc.x + `+Ee+`;
if(blockIndex < `+n[1]+" && pos < "+n[0]+`) {
offsetY = int(blockIndex / (`+u+")) * "+i+" - "+X+`;
d0 = offsetY + `+C+" * (pos / "+oe+`);
if(d0 < `+r[ce]+` && d0 >= 0) {
offsetX = int(mod(float(blockIndex), `+u+".) * "+a+". - "+L+`.);
d1 = offsetX + `+f+" * (int(mod(float(pos), "+oe+".) / "+o+`.));
if(d1 < `+r[xe]+` && d1 >= 0) {
ch = int(mod(float(pos), `+o+`.));
if (`+se+`) {
innerDims = vec2(d1, ch);
result[`+(2*Ee+Se)+`] = getChannel(
getA(d0, int(innerDims.x),
int(innerDims.y)), innerDims);
} else {
innerDims = vec2(d0, d1);
result[`+(2*Ee+Se)+`] = getChannel(
getA(ch, int(innerDims.x),
int(innerDims.y)), innerDims);
}
}
}
}
`;this.userCode=`
void main() {
ivec2 rc = getOutputCoords();
vec4 result = vec4(0);
int blockIndex, pos, offsetY, d0, offsetX, d1, ch;
vec2 innerDims;
`+we+`
`+ue.output+` = result;
}
`},fd=function(n,r,e,t,o){this.variableNames=["x"],this.outputShape=[];var a,i=r,s=n[3]-1;this.outputShape=n;var u="float("+e+") + float("+t+") * sum";a=o===.5?"inversesqrt("+u+")":o===1?"1.0/("+u+")":"exp(log("+u+") * float(-"+o+"));",this.userCode=`
void main() {
ivec4 coords = getOutputCoords();
int b = coords[0];
int r = coords[1];
int c = coords[2];
int d = coords[3];
float x = getX(b, r, c, d);
float sum = 0.0;
for (int j = -`+i+"; j <= "+i+`; j++) {
int idx = d + j;
if (idx >= 0 && idx <= `+s+`) {
float z = getX(b, r, c, idx);
sum += z * z;
}
}
float val = x * `+a+`;
setOutput(val);
}
`},hd=function(n,r,e,t,o){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=n,this.depth=n[3],this.depthRadius=r,this.bias=e,this.alpha=t,this.beta=o,this.userCode=`
void main() {
ivec4 coords = getOutputCoords();
int b = coords[0];
int r = coords[1];
int c = coords[2];
float result = 0.0;
for (int d = 0; d < `+this.depth+`; ++d) {
int depthBegin = int(max(0.0, float(d - `+r+`)));
int depthEnd = int(min(float(`+this.depth+`),
float(d + `+r+` + 1)));
const int MIN_DEPTH_BEGIN = 0;
const int MAX_DEPTH_END = `+this.depth+`;
float norm = 0.0;
for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) {
if (k < depthBegin){
continue;
}
else if (k >= depthBegin && k < depthEnd) {
norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);
}
else {
break;
}
}
norm = float(`+t+") * norm + float("+e+`);
for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){
if (k < depthBegin){
continue;
}
else if (k >= depthBegin && k < depthEnd){
float dyi = -2.0 * float(`+t+`)
* float(`+o+`)
* getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d)
/ norm;
if (k == d) {
dyi += pow(norm, -1.0 * `+o+`);
}
if (k == coords[3]) {
dyi *= getDy(b, r, c, d);
result += dyi;
}
}
else {
break;
}
}
}
setOutput(result);
}
`},pd=function(n,r,e,t,o){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;var a,i=r,s=n[3]-1;this.outputShape=n;var u="float("+e+") + float("+t+") * sum";a=o===.5?"inversesqrt("+u+")":o===1?"1.0/("+u+")":"exp(log("+u+") * float(-"+o+"));",this.userCode=`
void main() {
ivec4 coords = getOutputCoords();
int b = coords.x;
int r = coords.y;
int c = coords.z;
int d = coords.w;
bool hasNextCol = d < `+this.outputShape[3]+`;
bool hasNextRow = c < `+this.outputShape[2]+`;
vec4 sum = vec4(0.);
vec4 xFragAtOutputCoords = getX(b, r, c, d);
vec4 xAtOutputCoords = vec4(
getChannel(xFragAtOutputCoords, vec2(c, d)),
hasNextCol ?
getChannel(xFragAtOutputCoords, vec2(c, d + 1)) : 0.0,
hasNextRow ?
getChannel(xFragAtOutputCoords , vec2(c + 1, d)) : 0.0,
(hasNextRow && hasNextCol) ?
getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0
);
int firstChannel = d - `+i+`;
vec2 cache = vec2(0.);
if(firstChannel >= 0){
vec4 firstChannelFrag = getX(b, r, c, firstChannel);
cache.x = getChannel(firstChannelFrag, vec2(c, firstChannel));
if(hasNextRow){
cache.y = getChannel(firstChannelFrag, vec2(c + 1, firstChannel));
}
}
ivec2 depth = ivec2(d, d + 1);
for (int j = - `+i+"; j <= "+i+`; j++) {
ivec2 idx = depth + j;
bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0));
bvec2 belowUpperBound = lessThanEqual(idx, ivec2(`+s+`));
bool depthInRange = aboveLowerBound.x && belowUpperBound.x;
bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y;
if(depthInRange || depthPlusOneInRange){
vec4 z = vec4(0.);
vec4 xFragAtCurrentDepth;
z.xz = cache.xy;
if(depthPlusOneInRange && hasNextCol){
xFragAtCurrentDepth = idx.y != d ?
getX(b, r, c, idx.y) : xFragAtOutputCoords;
z.y = getChannel(xFragAtCurrentDepth, vec2(c, idx.y));
if(hasNextRow){
z.w = getChannel(xFragAtCurrentDepth, vec2(c + 1, idx.y));
}
}
cache.xy = z.yw;
sum += z * z;
}
}
vec4 result = xAtOutputCoords * `+a+`;
setOutput(result);
}
`},md=function(n){this.variableNames=["dy","maxPos"],this.outputShape=n.inShape;var r=n.strideHeight,e=n.strideWidth,t=n.dilationHeight,o=n.effectiveFilterHeight,a=n.effectiveFilterWidth,i=o-1-n.padInfo.top,s=a-1-n.padInfo.left,u=o*a-1;this.userCode=`
const ivec2 pads = ivec2(`+i+", "+s+`);
void main() {
ivec4 coords = getOutputCoords();
int b = coords[0];
int d = coords[3];
ivec2 dyRCCorner = coords.yz - pads;
int dyRCorner = dyRCCorner.x;
int dyCCorner = dyRCCorner.y;
// Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).
// ? = to be determined. : = across all values in that axis.
float dotProd = 0.0;
for (int wR = 0; wR < `+o+`;
wR += `+t+`) {
float dyR = float(dyRCorner + wR) / `+r+`.0;
if (dyR < 0.0 || dyR >= `+n.outHeight+`.0 || fract(dyR) > 0.0) {
continue;
}
int idyR = int(dyR);
for (int wC = 0; wC < `+a+`; wC++) {
float dyC = float(dyCCorner + wC) / `+e+`.0;
if (dyC < 0.0 || dyC >= `+n.outWidth+`.0 ||
fract(dyC) > 0.0) {
continue;
}
int idyC = int(dyC);
float dyValue = getDy(b, idyR, idyC, d);
int maxPosValue = `+u+` - int(getMaxPos(b, idyR, idyC, d));
// Get the current value, check it against the value from the
// position matrix.
int curPosValue = wR * `+a+` + wC;
float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);
dotProd += dyValue * mask;
}
}
setOutput(dotProd);
}
`},vd=function(n){this.variableNames=["dy","maxPos"],this.outputShape=n.inShape;var r=n.strideDepth,e=n.strideHeight,t=n.strideWidth,o=n.dilationDepth,a=n.dilationHeight,i=n.dilationWidth,s=n.effectiveFilterDepth,u=n.effectiveFilterHeight,f=n.effectiveFilterWidth,C=s-1-n.padInfo.front,k=u-1-n.padInfo.top,L=f-1-n.padInfo.left,X=s*u*f-1;this.userCode=`
const ivec3 pads = ivec3(`+C+", "+k+", "+L+`);
void main() {
ivec5 coords = getOutputCoords();
int batch = coords.x;
int ch = coords.u;
ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;
int dyDCorner = dyCorner.x;
int dyRCorner = dyCorner.y;
int dyCCorner = dyCorner.z;
// Convolve dy(?, ?, ?, ch) with pos mask(:, :, :, d) to get
// dx(xD, xR, xC, ch).
// ? = to be determined. : = across all values in that axis.
float dotProd = 0.0;
for (int wD = 0; wD < `+s+`;
wD += `+o+`) {
float dyD = float(dyDCorner + wD) / `+r+`.0;
if (dyD < 0.0 || dyD >= `+n.outDepth+`.0 || fract(dyD) > 0.0) {
continue;
}
int idyD = int(dyD);
for (int wR = 0; wR < `+u+`;
wR += `+a+`) {
float dyR = float(dyRCorner + wR) / `+e+`.0;
if (dyR < 0.0 || dyR >= `+n.outHeight+`.0 ||
fract(dyR) > 0.0) {
continue;
}
int idyR = int(dyR);
for (int wC = 0; wC < `+f+`;
wC += `+i+`) {
float dyC = float(dyCCorner + wC) / `+t+`.0;
if (dyC < 0.0 || dyC >= `+n.outWidth+`.0 ||
fract(dyC) > 0.0) {
continue;
}
int idyC = int(dyC);
float dyValue = getDy(batch, idyD, idyR, idyC, ch);
int maxPosValue = `+X+` -
int(getMaxPos(batch, idyD, idyR, idyC, ch));
// Get the current value, check it against the value from the
// position matrix.
int curPosValue =
wD * `+u+" * "+f+` +
wR * `+f+` + wC;
float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);
dotProd += dyValue * mask;
}
}
}
setOutput(dotProd);
}
`},su=function(n,r,e,t,o,a,i){e===void 0&&(e=!1),t===void 0&&(t=!1),o===void 0&&(o=!1),a===void 0&&(a=null),i===void 0&&(i=!1),this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=r;var s=e?n[1]:n[2],u=Math.ceil(s/2),f=e?"i * 2, rc.y":"rc.y, i * 2",C=t?"rc.z, i * 2":"i * 2, rc.z",k=e?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],L=t?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],X="",oe="";a&&(X=i?`vec4 activation(vec4 a) {
vec4 b = getPreluActivationWeightsAtOutCoords();
`+a+`
}`:`vec4 activation(vec4 x) {
`+a+`
}`,oe="result = activation(result);");var ue=o?"result += getBiasAtOutCoords();":"";o&&this.variableNames.push("bias"),i&&this.variableNames.push("preluActivationWeights"),this.userCode=`
`+X+`
const float sharedDimension = `+u+`.0;
vec4 dot2x2ARowBCol(ivec3 rc) {
vec4 result = vec4(0);
for (int i = 0; i < `+u+`; i++) {
vec4 a = getMatrixA(rc.x, `+f+`);
vec4 b = getMatrixB(rc.x, `+C+`);
// These swizzled products need to be separately added.
// See: https://github.com/tensorflow/tfjs/issues/1735
result += (`+k[0]+" * "+L[0]+`);
result += (`+k[1]+" * "+L[1]+`);
}
return result;
}
void main() {
ivec3 rc = getOutputCoords();
vec4 result = dot2x2ARowBCol(rc);
`+ue+`
`+oe+`
setOutput(result);
}
`},gd=function(){function n(r,e,t){this.variableNames=["probs"],this.outputShape=[r,t],this.userCode=`
uniform float seed;
void main() {
ivec2 coords = getOutputCoords();
int batch = coords[0];
float r = random(seed);
float cdf = 0.0;
for (int i = 0; i < `+(e-1)+`; i++) {
cdf += getProbs(batch, i);
if (r < cdf) {
setOutput(float(i));
return;
}
}
// If no other event happened, last event happened.
setOutput(float(`+(e-1)+`));
}
`}return n.prototype.getCustomSetupFunc=function(r){var e=this;return function(t,o){e.seedLoc==null&&(e.seedLoc=t.getUniformLocation(o,"seed")),t.gl.uniform1f(e.seedLoc,r)}},n}(),yd=function(n,r,e,t){this.variableNames=["indices"],this.outputShape=[n,r],this.userCode=`
void main() {
ivec2 coords = getOutputCoords();
int index = round(getIndices(coords.x));
setOutput(mix(float(`+t+"), float("+e+`),
float(index == coords.y)));
}
`},bd=function(n){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outputShape=n;var r=n.length;if(r===0)this.userCode=`
void main() {
setOutput(vec4(getA(), 0., 0., 0.));
}
`;else{var e=en("rc",r),t=Ge(r),o=function(s,u,f){if(s===1)return"rc > "+u[0];for(var C="",k=s-2;k<s;k++)C+=f[k]+" >= "+u[k],k<s-1&&(C+="||");return C}(r,n,e),a=function(s,u,f,C){if(s===1)return"";var k=C.slice(-2);return`
int r = `+k[0]+`;
int c = `+k[1]+`;
int rp1 = r + 1;
int cp1 = c + 1;
bool cEdge = cp1 >= `+u+`;
bool rEdge = rp1 >= `+f+`;
`}(r,n[n.length-1],n[n.length-2],e),i=function(s,u){var f=s.length,C=function(k,L){for(var X=[],oe=0;oe<=1;oe++)for(var ue=0;ue<=1;ue++){for(var se=(oe===0?"r":"rp1")+", "+(ue===0?"c":"cp1"),ce=2;ce<k;ce++)se=L[L.length-1-ce]+","+se;X.push(se)}return X}(f,u);return f===1?`getA(rc),
rc + 1 >= `+s[0]+` ? 0. : getA(rc + 1),
0, 0`:"getA("+C[0]+`),
cEdge ? 0. : getA(`+C[1]+`),
rEdge ? 0. : getA(`+C[2]+`),
rEdge || cEdge ? 0. : getA(`+C[3]+")"}(n,e);this.userCode=`
void main() {
`+t+` rc = getOutputCoords();
if(`+o+`) {
setOutput(vec4(0));
} else {
`+a+`
setOutput(vec4(`+i+`));
}
}
`}},xd=function(n,r,e){this.variableNames=["x"],this.outputShape=r.map(function(u,f){return u[0]+n[f]+u[1]});var t=n.length,o=Ge(t),a=r.map(function(u){return u[0]}).join(","),i=r.map(function(u,f){return u[0]+n[f]}).join(","),s=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,t);this.userCode=t!==1?`
`+o+" start = "+o+"("+a+`);
`+o+" end = "+o+"("+i+`);
void main() {
`+o+` outC = getOutputCoords();
if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {
setOutput(float(`+e+`));
} else {
`+o+` coords = outC - start;
setOutput(getX(`+s+`));
}
}
`:`
int start = `+a+`;
int end = `+i+`;
void main() {
int outC = getOutputCoords();
if (outC < start || outC >= end) {
setOutput(float(`+e+`));
} else {
setOutput(getX(outC - start));
}
}
`},wd=function(n,r,e){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=r.map(function(se,ce){return se[0]+n[ce]+se[1]});for(var t=n.length,o=Ge(t),a=r.map(function(se){return se[0]}).join(","),i=r.map(function(se,ce){return se[0]+n[ce]}).join(","),s=en("rc",t),u=en("source",t),f=s[t-1]+" < "+this.outputShape[t-1],C=t===1?"source":"vec2("+u.slice(-2).join()+")",k=[o+" rc = outputLoc;",s[t-1]+` += 1;
if(`+f+`) {
`,t===1?"":`}
rc = outputLoc;
`+s[t-2]+` += 1;
if(`+s[t-2]+" < "+this.outputShape[t-2]+") {",t===1?"":" "+s[t-1]+` += 1;
if(`+f+") {"],L=t===1?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))",X="",oe=0,ue=t===1?2:4;oe<ue;oe++)X+=`
`+k[oe]+`
if (`+L+`) {
result[`+oe+"] = float("+e+`);
} else {
`+o+` source = rc - start;
result[`+oe+"] = getChannel(getX("+u.join()+"), "+C+`);
}
`;X+=t===1?"} ":"}}",this.userCode=`
const `+o+" start = "+o+"("+a+`);
const `+o+" end = "+o+"("+i+`);
void main() {
`+o+` outputLoc = getOutputCoords();
vec4 result = vec4(0.);
`+X+`
setOutput(result);
}
`},uu=function(n,r,e){if(this.variableNames=["x"],r==="avg"&&e)throw new Error("Cannot compute positions for average pool.");var t=n.filterWidth,o=n.strideHeight,a=n.strideWidth,i=n.dilationHeight,s=n.dilationWidth,u=n.effectiveFilterHeight,f=n.effectiveFilterWidth,C=n.padInfo.top,k=n.padInfo.left;this.outputShape=n.outShape;var L=r==="avg",X="0.0";if(L||(X="-1.0 / 1e-20"),e)this.userCode=`
const ivec2 strides = ivec2(`+o+", "+a+`);
const ivec2 pads = ivec2(`+C+", "+k+`);
void main() {
ivec4 coords = getOutputCoords();
int batch = coords[0];
int d = coords[3];
ivec2 xRCCorner = coords.yz * strides - pads;
int xRCorner = xRCCorner.x;
int xCCorner = xRCCorner.y;
// max/min x(?, ?, d) to get y(yR, yC, d).
// ? = to be determined
float minMaxValue = 0.0;
float minMaxValueFound = 0.0;
int minMaxPosition = 0;
float avgValue = 0.0;
for (int wR = 0; wR < `+u+`;
wR += `+i+`) {
int xR = xRCorner + wR;
if (xR < 0 || xR >= `+n.inHeight+`) {
continue;
}
for (int wC = 0; wC < `+f+`;
wC += `+s+`) {
int xC = xCCorner + wC;
if (xC < 0 || xC >= `+n.inWidth+`) {
continue;
}
float value = getX(batch, xR, xC, d);
// If a min / max value has already been found, use it. If not,
// use the current value.
float currMinMaxValue = mix(
value, minMaxValue, minMaxValueFound);
if (value >= currMinMaxValue) {
minMaxValue = value;
minMaxValueFound = 1.0;
minMaxPosition = wR * `+f+` + wC;
}
}
}
setOutput(float(minMaxPosition));
}
`;else{var oe=r+"("+r+"("+r+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";r==="avg"&&(oe="avgValue / count");var ue=4*Math.floor(t/4),se=t%4,ce=`
if (`+L+`) {
avgValue += dot(values, ones);
} else {
minMaxValue = max(values, minMaxValue);
}
`;this.userCode=`
const ivec2 strides = ivec2(`+o+", "+a+`);
const ivec2 pads = ivec2(`+C+", "+k+`);
const float initializationValue = `+X+`;
const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);
float count = 0.0;
float getValue(int batch, int xR, int xC, int d) {
if (xC < 0 || xC >= `+n.inWidth+`) {
return initializationValue;
}
count += 1.0;
return getX(batch, xR, xC, d);
}
void main() {
ivec4 coords = getOutputCoords();
int batch = coords[0];
int d = coords[3];
ivec2 xRCCorner = coords.yz * strides - pads;
int xRCorner = xRCCorner.x;
int xCCorner = xRCCorner.y;
// max/min x(?, ?, d) to get y(yR, yC, d).
// ? = to be determined
vec4 minMaxValue = vec4(`+X+`);
float avgValue = 0.0;
count = 0.0;
for (int wR = 0; wR < `+u+`;
wR += `+i+`) {
int xR = xRCorner + wR;
if (xR < 0 || xR >= `+n.inHeight+`) {
continue;
}
for (int wC = 0; wC < `+ue+`; wC += 4) {
int xC = xCCorner + wC * `+s+`;
vec4 values = vec4(
getValue(batch, xR, xC, d),
getValue(batch, xR, xC + `+s+`, d),
getValue(batch, xR, xC + 2 * `+s+`, d),
getValue(batch, xR, xC + 3 * `+s+`, d)
);
`+ce+`
}
int xC = xCCorner + `+ue+`;
if (`+(se===1)+`) {
vec4 values = vec4(
getValue(batch, xR, xC, d),
initializationValue,
initializationValue,
initializationValue
);
`+ce+`
} else if (`+(se===2)+`) {
vec4 values = vec4(
getValue(batch, xR, xC, d),
getValue(batch, xR, xC + `+s+`, d),
initializationValue,
initializationValue
);
`+ce+`
} else if (`+(se===3)+`) {
vec4 values = vec4(
getValue(batch, xR, xC, d),
getValue(batch, xR, xC + `+s+`, d),
getValue(batch, xR, xC + 2 * `+s+`, d),
initializationValue
);
`+ce+`
}
}
setOutput(`+oe+`);
}
`}},cu=function(n,r,e){if(this.variableNames=["x"],r==="avg"&&e)throw new Error("Cannot compute positions for average pool.");var t=n.filterWidth,o=n.strideDepth,a=n.strideHeight,i=n.strideWidth,s=n.dilationDepth,u=n.dilationHeight,f=n.dilationWidth,C=n.effectiveFilterDepth,k=n.effectiveFilterHeight,L=n.effectiveFilterWidth,X=n.padInfo.front,oe=n.padInfo.top,ue=n.padInfo.left;this.outputShape=n.outShape;var se=r==="avg",ce="0.0";if(se||(ce="-1.0 / 1e-20"),e)this.userCode=`
const ivec3 strides =
ivec3(`+o+", "+a+", "+i+`);
const ivec3 pads = ivec3(`+X+", "+oe+", "+ue+`);
void main() {
ivec5 coords = getOutputCoords();
int batch = coords.x;
int ch = coords.u;
ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;
int xDCorner = xCorner.x;
int xRCorner = xCorner.y;
int xCCorner = xCorner.z;
// max/min x(?, ?, ?, ch) to get y(yD, yR, yC, ch).
// ? = to be determined
float minMaxValue = 0.0;
float minMaxValueFound = 0.0;
int minMaxPosition = 0;
for (int wD = 0; wD < `+C+`;
wD += `+s+`) {
int xD = xDCorner + wD;
if (xD < 0 || xD >= `+n.inDepth+`) {
continue;
}
for (int wR = 0; wR < `+k+`;
wR += `+u+`) {
int xR = xRCorner + wR;
if (xR < 0 || xR >= `+n.inHeight+`) {
continue;
}
for (int wC = 0; wC < `+L+`;
wC += `+f+`) {
int xC = xCCorner + wC;
if (xC < 0 || xC >= `+n.inWidth+`) {
continue;
}
float value = getX(batch, xD, xR, xC, ch);
// If a min / max value has already been found, use it. If not,
// use the current value.
float currMinMaxValue = mix(
value, minMaxValue, minMaxValueFound);
if (value >= currMinMaxValue) {
minMaxValue = value;
minMaxValueFound = 1.0;
minMaxPosition =
wD * `+k+" * "+L+` +
wR * `+L+` + wC;;
}
}
}
}
setOutput(float(minMaxPosition));
}
`;else{var xe=r+"("+r+"("+r+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";r==="avg"&&(xe="avgValue / count");var we=4*Math.floor(t/4),Ee=t%4,Se=`
if (`+se+`) {
avgValue += dot(values, ones);
} else {
minMaxValue = max(values, minMaxValue);
}
`;this.userCode=`
const ivec3 strides =
ivec3(`+o+", "+a+", "+i+`);
const ivec3 pads = ivec3(`+X+", "+oe+", "+ue+`);
const float initializationValue = `+ce+`;
const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);
float count = 0.0;
float getValue(int batch, int xD, int xR, int xC, int ch) {
if (xC < 0 || xC >= `+n.inWidth+`) {
return initializationValue;
}
count += 1.0;
return getX(batch, xD, xR, xC, ch);
}
void main() {
ivec5 coords = getOutputCoords();
int batch = coords.x;
int ch = coords.u;
ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;
int xDCorner = xCorner.x;
int xRCorner = xCorner.y;
int xCCorner = xCorner.z;
// max/min x(?, ?, ?, d) to get y(yD, yR, yC, ch).
// ? = to be determined
vec4 minMaxValue = vec4(`+ce+`);
float avgValue = 0.0;
count = 0.0;
for (int wD = 0; wD < `+C+`;
wD += `+s+`) {
int xD = xDCorner + wD;
if (xD < 0 || xD >= `+n.inDepth+`) {
continue;
}
for (int wR = 0; wR < `+k+`;
wR += `+u+`) {
int xR = xRCorner + wR;
if (xR < 0 || xR >= `+n.inHeight+`) {
continue;
}
for (int wC = 0; wC < `+we+`; wC += 4) {
int xC = xCCorner + wC * `+f+`;
vec4 values = vec4(
getValue(batch, xD, xR, xC, ch),
getValue(batch, xD, xR, xC + `+f+`, ch),
getValue(batch, xD, xR, xC + 2 * `+f+`, ch),
getValue(batch, xD, xR, xC + 3 * `+f+`, ch)
);
`+Se+`
}
int xC = xCCorner + `+we+`;
if (`+(Ee===1)+`) {
vec4 values = vec4(
getValue(batch, xD, xR, xC, ch),
initializationValue,
initializationValue,
initializationValue
);
`+Se+`
} else if (`+(Ee===2)+`) {
vec4 values = vec4(
getValue(batch, xD, xR, xC, ch),
getValue(batch, xD, xR, xC + `+f+`, ch),
initializationValue,
initializationValue
);
`+Se+`
} else if (`+(Ee===3)+`) {
vec4 values = vec4(
getValue(batch, xD, xR, xC, ch),
getValue(batch, xD, xR, xC + `+f+`, ch),
getValue(batch, xD, xR, xC + 2 * `+f+`, ch),
initializationValue
);
`+Se+`
}
}
setOutput(`+xe+`);
}
}
`}},Ed=function(n,r){this.variableNames=["x"];var e=n.windowSize,t=n.batchSize,o=n.inSize,a=Math.ceil(o/e);this.outputShape=[t,a];var i="0.0",s="";r==="prod"?i="1.0":r==="min"?(i="1.0 / 1e-20",s="min"):r==="max"&&(i="-1.0 / 1e-20",s="max");var u=r+"("+r+"("+r+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";r==="sum"?u="sumValue":r==="prod"?u="prodValue":r==="all"?u="allValue":r==="any"&&(u="anyValue");var f=4*Math.floor(e/4),C=e%4,k=`
if (`+(r==="sum")+`) {
sumValue += dot(values, ones);
} else if (`+(r==="prod")+`) {
vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);
prodValue *= tmp[0] * tmp[1];
} else {
minMaxValue = `+s+`(values, minMaxValue);
}
`,L="vec4";r==="all"?(i="1.0",k=`
bool reducedAllValue = all(values);
float floatedReducedAllValue = float(reducedAllValue);
allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);
`,L="bvec4"):r==="any"&&(i="0.0",k=`
bool reducedAnyValue = any(values);
float floatedReducedAnyValue = float(reducedAnyValue);
anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);
`,L="bvec4");var X="";o%e>0&&(X=`
if (inIdx < 0 || inIdx >= `+o+`) {
return initializationValue;
}
`),this.userCode=`
const float initializationValue = `+i+`;
const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);
float getValue(int batch, int inIdx) {
`+X+`
return getX(batch, inIdx);
}
void main() {
ivec2 coords = getOutputCoords();
int batch = coords[0];
int outIdx = coords[1];
int inOffset = outIdx * `+e+`;
vec4 minMaxValue = vec4(`+i+`);
float prodValue = 1.0;
float sumValue = 0.0;
float allValue = 1.0;
float anyValue = 0.0;
for (int i = 0; i < `+f+`; i += 4) {
int inIdx = inOffset + i;
`+L+" values = "+L+`(
getValue(batch, inIdx),
getValue(batch, inIdx + 1),
getValue(batch, inIdx + 2),
getValue(batch, inIdx + 3)
);
`+k+`
}
int inIdx = inOffset + `+f+`;
if (`+(C===1)+`) {
`+L+" values = "+L+`(
getValue(batch, inIdx),
initializationValue,
initializationValue,
initializationValue
);
`+k+`
} else if (`+(C===2)+`) {
`+L+" values = "+L+`(
getValue(batch, inIdx),
getValue(batch, inIdx + 1),
initializationValue,
initializationValue
);
`+k+`
} else if (`+(C===3)+`) {
`+L+" values = "+L+`(
getValue(batch, inIdx),
getValue(batch, inIdx + 1),
getValue(batch, inIdx + 2),
initializationValue
);
`+k+`
}
setOutput(`+u+`);
}
`},_d=function(n,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n;for(var e="",t=0;t<4;t++){var o="thisRC = rc;";t%2==1&&(o+="thisRC.z += 1;"),t>1&&(o+="thisRC.y += 1;"),e+=`
`+o+`
`+(t>0?"if(thisRC.y < rows && thisRC.z < cols){":"")+`
int flatIndex = getFlatIndex(thisRC);
ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);
vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));
result[`+t+`] =
getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);
`+(t>0?"}":"")+`
`}this.userCode=`
ivec3 inputCoordsFromReshapedOutCoords(int index) {
`+O(["r","c","d"],r)+`
return ivec3(r, c, d);
}
`+w(n)+`
void main() {
ivec3 rc = getOutputCoords();
vec4 result = vec4(0.);
ivec3 thisRC;
int rows = `+n[1]+`;
int cols = `+n[2]+`;
`+e+`
setOutput(result);
}
`},Cd=function(n,r,e){this.variableNames=["dy"],this.outputShape=[],this.outputShape=r.shape;var t=r.shape,o=t[1],a=t[2],i=n.shape,s=i[1],u=i[2],f=[e&&s>1?o-1:o,e&&u>1?a-1:a],C=[e&&s>1?s-1:s,e&&u>1?u-1:u],k=f[0]/C[0],L=f[1]/C[1],X=1/k,oe=1/L,ue=2*Math.ceil(X)+2,se=2*Math.ceil(oe)+2;this.userCode=`
void main() {
ivec4 coords = getOutputCoords();
int b = coords[0];
int d = coords[3];
int r = coords[1];
int c = coords[2];
float accumulator = 0.0;
const float heightScale = float(`+k+`);
const float widthScale = float(`+L+`);
const float invHeightScale = float(`+X+`);
const float invWidthScale = float(`+oe+`);
const int winHeight = int(`+ue+`);
const int winWidth = int(`+se+`);
// Compute bounds for where in dy we will look
float startRLerp = floor(float(r) * invHeightScale);
int startDyR = int(startRLerp - float(winHeight / 2));
float startCLerp = floor(float(c) * invWidthScale);
int startDyC = int(startCLerp - float(winWidth / 2));
// Loop over dy
for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {
int dyR = dyROffset + startDyR;
// Guard against the window exceeding the bounds of dy
if (dyR < 0 || dyR >= `+s+`) {
continue;
}
for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {
int dyC = dyCOffset + startDyC;
// Guard against the window exceeding the bounds of dy
if (dyC < 0 || dyC >= `+u+`) {
continue;
}
float dxR = float(dyR) * heightScale;
int topDxRIndex = int(floor(dxR));
int bottomDxRIndex = int(min(ceil(dxR), `+(o-1)+`.0));
float dxRLerp = dxR - float(topDxRIndex);
float inverseDxRLerp = 1.0 - dxRLerp;
float dxC = float(dyC) * widthScale;
int leftDxCIndex = int(floor(dxC));
int rightDxCIndex = int(min(ceil(dxC), `+(a-1)+`.0));
float dxCLerp = dxC - float(leftDxCIndex);
float inverseDxCLerp = 1.0 - dxCLerp;
if (r == topDxRIndex && c == leftDxCIndex) {
// topLeft
accumulator +=
getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;
}
if (r == topDxRIndex && c == rightDxCIndex) {
// topRight
accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;
}
if (r == bottomDxRIndex && c == leftDxCIndex) {
// bottomLeft
accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;
}
if (r == bottomDxRIndex && c == rightDxCIndex) {
// bottomRight
accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;
}
}
}
// End loop over dy
setOutput(accumulator);
}
`},Td=function(n,r,e,t){this.variableNames=["A"],this.outputShape=[];var o=n[0],a=n[1],i=n[2],s=n[3];this.outputShape=[o,r,e,s];var u=[t&&r>1?a-1:a,t&&e>1?i-1:i],f=[t&&r>1?r-1:r,t&&e>1?e-1:e];this.userCode=`
const vec2 effectiveInputOverOutputRatioRC = vec2(
`+u[0]/f[0]+`,
`+u[1]/f[1]+`);
const vec2 inputShapeRC = vec2(`+a+".0, "+i+`.0);
void main() {
ivec4 coords = getOutputCoords();
int b = coords[0];
int d = coords[3];
ivec2 yRC = coords.yz;
// Fractional source index.
vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;
// Compute the four integer indices.
ivec2 sourceFloorRC = ivec2(sourceFracIndexRC);
ivec2 sourceCeilRC = ivec2(
min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));
float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d);
float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d);
float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d);
float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d);
vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);
float top = topLeft + (topRight - topLeft) * fracRC.y;
float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;
float newValue = top + (bottom - top) * fracRC.x;
setOutput(newValue);
}
`},Sd=function(n,r,e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];var o=n[0],a=n[1],i=n[2],s=n[3];this.outputShape=[o,r,e,s];var u=[t&&r>1?a-1:a,t&&e>1?i-1:i],f=[t&&r>1?r-1:r,t&&e>1?e-1:e];this.userCode=`
const vec3 effectiveInputOverOutputRatioRC = vec3(
`+u[0]/f[0]+`,
`+u[1]/f[1]+`,
`+u[1]/f[1]+`);
const vec3 inputShapeRC = vec3(`+a+".0, "+i+`.0,
`+i+`.0);
float getAValue(int b, int r, int c, int d) {
return getChannel(getA(b, r, c, d), vec2(c, d));
}
void main() {
ivec4 coords = getOutputCoords();
int b = coords[0];
int d = coords[3];
// Calculate values for next column in yRC.z.
ivec3 yRC = coords.yzz + ivec3(0, 0, 1);
// Fractional source index.
vec3 sourceFracIndexRC = vec3(yRC) * effectiveInputOverOutputRatioRC;
// Compute the four integer indices.
ivec3 sourceFloorRC = ivec3(sourceFracIndexRC);
ivec3 sourceCeilRC = ivec3(
min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));
// Should we calculate next column and row elements in 2x2 packed cell.
bool hasNextCol = d < `+(s-1)+`;
bool hasNextRow = coords.z < `+(e-1)+`;
// In parallel, construct four corners for all four components in
// packed 2x2 cell.
vec4 topLeft = vec4(
getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d),
hasNextCol ? getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d + 1)
: 0.0,
hasNextRow ? getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d)
: 0.0,
(hasNextRow && hasNextCol) ?
getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d + 1) : 0.0);
vec4 bottomLeft = vec4(
getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d),
hasNextCol ? getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d + 1)
: 0.0,
hasNextRow ? getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d)
: 0.0,
(hasNextRow && hasNextCol) ?
getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d + 1) : 0.0);
vec4 topRight = vec4(
getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d),
hasNextCol ? getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d + 1)
: 0.0,
hasNextRow ? getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d)
: 0.0,
(hasNextRow && hasNextCol) ?
getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d + 1) : 0.0);
vec4 bottomRight = vec4(
getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d),
hasNextCol ? getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d + 1)
: 0.0,
hasNextRow ? getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d)
: 0.0,
(hasNextRow && hasNextCol) ?
getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d + 1) : 0.0);
vec3 fracRC = sourceFracIndexRC - vec3(sourceFloorRC);
vec4 top = mix(topLeft, topRight, fracRC.yyzz);
vec4 bottom = mix(bottomLeft, bottomRight, fracRC.yyzz);
vec4 newValue = mix(top, bottom, fracRC.x);
setOutput(newValue);
}
`},Ad=function(n,r,e){this.variableNames=["dy"],this.outputShape=[],this.outputShape=r.shape;var t=r.shape,o=t[1],a=t[2],i=n.shape,s=i[1],u=i[2],f=[e&&s>1?o-1:o,e&&u>1?a-1:a],C=[e&&s>1?s-1:s,e&&u>1?u-1:u],k=f[0]/C[0],L=f[1]/C[1],X=1/k,oe=1/L,ue=2*Math.ceil(X)+2,se=2*Math.ceil(oe)+2;this.userCode=`
void main() {
ivec4 coords = getOutputCoords();
int b = coords[0];
int d = coords[3];
int r = coords[1];
int c = coords[2];
float accumulator = 0.0;
const float heightScale = float(`+k+`);
const float widthScale = float(`+L+`);
const float invHeightScale = float(`+X+`);
const float invWidthScale = float(`+oe+`);
const int winHeight = int(`+ue+`);
const int winWidth = int(`+se+`);
// Compute bounds for where in dy we will look
float startRLerp = floor(float(r) * invHeightScale);
int startDyR = int(floor(startRLerp - float(winHeight / 2)));
float startCLerp = floor(float(c) * invWidthScale);
int startDyC = int(floor(startCLerp - float(winWidth / 2)));
// Loop over dy
for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {
int dyR = dyROffset + startDyR;
// Guard against the window exceeding the bounds of dy
if (dyR < 0 || dyR >= `+s+`) {
continue;
}
for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {
int dyC = dyCOffset + startDyC;
// Guard against the window exceeding the bounds of dy
if (dyC < 0 || dyC >= `+u+`) {
continue;
}
float sourceFracRow =
float(`+f[0]+`) *
(float(dyR) / float(`+C[0]+`));
float sourceFracCol =
float(`+f[1]+`) *
(float(dyC) / float(`+C[1]+`));
int sourceNearestRow = int(min(
float(int(`+o+`) - 1),
`+e+` ? float(round(sourceFracRow)) :
float(floor(sourceFracRow))));
int sourceNearestCol = int(min(
float(int(`+a+`) - 1),
`+e+` ? float(round(sourceFracCol)) :
float(floor(sourceFracCol))));
if (r == sourceNearestRow && c == sourceNearestCol) {
accumulator += getDy(b, dyR, dyC, d);
}
}
}
// End loop over dy
setOutput(accumulator);
}
`},Od=function(n,r,e,t){this.variableNames=["A"],this.outputShape=[];var o=n[0],a=n[1],i=n[2],s=n[3];this.outputShape=[o,r,e,s];var u=[t&&r>1?a-1:a,t&&e>1?i-1:i],f=[t&&r>1?r-1:r,t&&e>1?e-1:e],C=t?"0.5":"0.0";this.userCode=`
const vec2 effectiveInputOverOutputRatioRC = vec2(
`+u[0]/f[0]+`,
`+u[1]/f[1]+`);
const vec2 inputShapeRC = vec2(`+a+".0, "+i+`.0);
void main() {
ivec4 coords = getOutputCoords();
int b = coords[0];
int d = coords[3];
ivec2 yRC = coords.yz;
// Fractional source index.
vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;
// Compute the coordinators of nearest neighbor point.
ivec2 sourceNearestRC = ivec2(
min(inputShapeRC - 1.0, floor(sourceFracIndexRC + `+C+`)));
float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);
setOutput(newValue);
}
`},Rd=function(n,r){this.variableNames=["x"];var e=n.length;if(e>4)throw new Error("WebGL backend: Reverse of rank-"+e+" tensor is not yet supported");if(this.outputShape=n,e!==1){var t=n.map(function(a,i){return function(s){return r.indexOf(s)!==-1&&n[s]!==1?n[s]+" - coords["+s+"] - 1":"coords["+s+"]"}(i)}).join(","),o=Ge(e);this.userCode=`
void main() {
`+o+` coords = getOutputCoords();
setOutput(getX(`+t+`));
}
`}else this.userCode=`
void main() {
int coord = getOutputCoords();
setOutput(getX(`+n[0]+` - coord - 1));
}
`},Id=function(n,r){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;var e=n.length;if(e>4)throw new Error("WebGL backend: Reverse of rank-"+e+" tensor is not yet supported");this.outputShape=n;var t=en("rc",e),o=t[e-1]+" + 1 < "+this.outputShape[e-1],a=t[e-2]+" + 1 < "+this.outputShape[e-2],i=Ge(e);function s(u){var f=n.map(function(C,k){return function(L,X){return r.indexOf(L)!==-1&&n[L]!==1?n[L]+" - "+X[L]+" - 1":""+X[L]}(k,u)});return"getChannel(getX("+f.join(",")+"), vec2("+f.slice(-2).join(",")+"))"}this.userCode=e===1?`
void main(){
int rc = getOutputCoords();
vec4 result = vec4(0.);
result.r = getChannel(getX(`+n[0]+` - rc - 1),
`+n[0]+` - rc - 1);
if(`+o+`){
result.g = getChannel(getX(`+n[0]+` - (rc + 1) - 1),
`+n[0]+` - (rc + 1) - 1);
}
setOutput(result);
}
`:`
void main() {
`+i+` rc = getOutputCoords();
vec4 result = vec4(0.);
result.r = `+function(u){return s(u)}(t.slice())+`;
if(`+o+`){
result.g = `+function(u){return u[e-1]="("+u[e-1]+" + 1)",s(u)}(t.slice())+`;
}
if(`+a+`) {
result.b = `+function(u){return u[e-2]="("+u[e-2]+" + 1)",s(u)}(t.slice())+`;
if(`+o+`) {
result.a = `+function(u){return u[e-1]="("+u[e-1]+" + 1)",u[e-2]="("+u[e-2]+" + 1)",s(u)}(t.slice())+`;
}
}
setOutput(result);
}
`},Ac=function(n,r,e,t,o,a,i){i===void 0&&(i=!0),this.variableNames=["updates","indices","defaultValue"],this.outputShape=a;var s=Ge(o.length),u=Ge(a.length),f="";e===1?f="i":e===2&&(f="i, j");var C="getIndices("+f+")",k="";t===1?k="i":t===2&&(k="i, coords[1]");var L="getUpdates("+k+")",X=r>1?"strides[j]":"strides";this.userCode=`
`+s+" strides = "+s+"("+o+`);
void main() {
`+u+` coords = getOutputCoords();
float sum = 0.0;
bool found = false;
for (int i = 0; i < `+n+`; i++) {
int flattenedIndex = 0;
for (int j = 0; j < `+r+`; j++) {
int index = round(`+C+`);
flattenedIndex += index * `+X+`;
}
if (flattenedIndex == coords[0]) {
sum += `+L+`;
found = true;
}
}
setOutput(mix(getDefaultValue(), sum, float(found)));
}
`},Nd=function(n,r){this.variableNames=["x","segmentIds"];var e=n.windowSize,t=n.batchSize,o=n.inSize,a=n.numSegments,i=a*Math.ceil(o/e);this.outputShape=[t,i];var s=4*Math.floor(e/4),u=e%4,f=`
sumValue += dot(values, segFilter);
`,C="";o%e>0&&(C=`
if (inIdx < 0 || inIdx >= `+o+`) {
return initializationValue;
}
`);var k="";o%e>0&&(k=`
if (inIdx < 0 || inIdx >= `+o+`) {
return -1.0;
}
`),this.userCode=`
const float initializationValue = 0.0;
float getValue(int batch, int inIdx) {
`+C+`
return getX(batch, inIdx);
}
float getSegmentIdAtIndex(int inIdx) {
`+k+`
return getSegmentIds(inIdx);
}
void main() {
ivec2 coords = getOutputCoords();
int batch = coords[0];
int outIdx = coords[1];
int inOffset = int(floor(float(outIdx) / float(
`+a+")) * float("+e+`));
int currentSeg = int(mod(float(outIdx), float(`+a+`)));
float sumValue = 0.0;
for (int i = 0; i < `+s+`; i += 4) {
int inIdx = inOffset + i;
vec4 values = vec4(
getValue(batch, inIdx),
getValue(batch, inIdx + 1),
getValue(batch, inIdx + 2),
getValue(batch, inIdx + 3)
);
vec4 segFilter = vec4(
int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,
int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,
int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0
);
`+f+`
}
int inIdx = inOffset + `+s+`;
if (`+(u===1)+`) {
vec4 values = vec4(
getValue(batch, inIdx),
initializationValue,
initializationValue,
initializationValue
);
int inIdxSeg = int(getSegmentIdAtIndex(inIdx));
vec4 segFilter = vec4(
int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
0,
0,
0
);
`+f+`
} else if (`+(u===2)+`) {
vec4 values = vec4(
getValue(batch, inIdx),
getValue(batch, inIdx + 1),
initializationValue,
initializationValue
);
vec4 segFilter = vec4(
int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,
0,
0
);
`+f+`
} else if (`+(u===3)+`) {
vec4 values = vec4(
getValue(batch, inIdx),
getValue(batch, inIdx + 1),
getValue(batch, inIdx + 2),
initializationValue
);
vec4 segFilter = vec4(
int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,
int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,
0
);
`+f+`
}
setOutput(sumValue);
}
`},Dd=function(n,r,e){var t,o;if(this.variableNames=["c","a","b"],this.outputShape=r,e>4)throw Error("Where for rank "+e+" is not yet supported");if(e===1)o="resRC",t="resRC";else{for(var a=["resRC.x","resRC.y","resRC.z","resRC.w"],i=[],s=[],u=0;u<r.length;u++)s.push(""+a[u]),u<n&&i.push(""+a[u]);t=i.join(),o=s.join()}var f=Ge(e);this.userCode=`
void main() {
`+f+` resRC = getOutputCoords();
float cVal = getC(`+t+`);
if (cVal >= 1.0) {
setOutput(getA(`+o+`));
} else {
setOutput(getB(`+o+`));
}
}
`},kd=function(){function n(r){this.variableNames=["source"],this.outputShape=r,this.rank=r.length;var e,t=Ge(this.rank),o="uniform int start["+this.rank+"];",a=function(i){if(i===1)return"sourceLoc";if(i<=6)return lu.slice(0,i).map(function(s){return"sourceLoc."+s}).join(",");throw Error("Slicing for rank "+i+" is not yet supported")}(this.rank);e=`
`+t+` sourceLoc;
`+t+` coords = getOutputCoords();
`+r.map(function(i,s){return"sourceLoc."+lu[s]+" = start["+s+"] + coords."+lu[s]+";"}).join(`
`)+`
`,this.userCode=`
`+o+`
void main() {
`+e+`
setOutput(getSource(`+a+`));
}
`}return n.prototype.getCustomSetupFunc=function(r){var e=this;if(r.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+r.length+")");return function(t,o){e.startLoc==null&&(e.startLoc=t.getUniformLocationNoThrow(o,"start"),e.startLoc==null)||t.gl.uniform1iv(e.startLoc,r)}},n}(),lu=["x","y","z","w","u","v"],Md=function(){function n(r){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=r,this.rank=r.length;var e=Ge(this.rank),t=en("coords",this.rank),o=en("sourceLoc",this.rank),a=this.rank===1?"sourceLoc":"vec2("+o.slice(-2).join()+")",i="getChannel(getSource("+o.join()+"), "+a+")",s=`
result.x = `+i+`;
if (++`+t[this.rank-1]+" < "+r[this.rank-1]+`) {
++`+o[this.rank-1]+`;
result.y = `+i+`;
--`+o[this.rank-1]+`;
}
`,u=this.rank===1?"":`
--`+t[this.rank-1]+`;
if (++`+t[this.rank-2]+" < "+r[this.rank-2]+`) {
++`+o[this.rank-2]+`;
result.z = `+i+`;
if (++`+t[this.rank-1]+" < "+r[this.rank-1]+`) {
++`+o[this.rank-1]+`;
result.w = `+i+`;
}
}
`,f=this.rank<=4?`sourceLoc = coords +
`+e+"("+r.map(function(C,k){return"start["+k+"]"}).join()+");":r.map(function(C,k){return o[k]+" = "+t[k]+" + start["+k+"];"}).join(`
`);this.userCode=`
uniform int start[`+this.rank+`];
void main() {
`+e+` coords = getOutputCoords();
`+e+` sourceLoc;
`+f+`
vec4 result = vec4(0.);
`+s+`
`+u+`
setOutput(result);
}
`}return n.prototype.getCustomSetupFunc=function(r){var e=this;if(r.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+r.length+")");return function(t,o){e.startLoc==null&&(e.startLoc=t.getUniformLocationNoThrow(o,"start"),e.startLoc==null)||t.gl.uniform1iv(e.startLoc,r)}},n}(),Pd=function(n,r,e){this.variableNames=["x"],this.outputShape=e;var t=e.length,o=Ge(e.length),a=Ge(e.length),i="";if(t===1)i="coords * strides + begin";else{var s=0;i=e.map(function(u,f){return s++,e.length===1?"coords * strides["+f+"] + begin["+f+"]":"coords["+(s-1)+"] * strides["+f+"] + begin["+f+"]"}).join(",")}this.userCode=`
`+o+" begin = "+o+"("+n+`);
`+o+" strides = "+o+"("+r+`);
void main() {
`+a+` coords = getOutputCoords();
setOutput(getX(`+i+`));
}
`},Fd=function(){function n(r){this.gpgpu=r,this.numUsedTextures=0,this.numFreeTextures=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}return n.prototype.acquireTexture=function(r,e,t){var o,a=Oc(e,t),i=Rc(r,a,t);if(i in this.freeTextures||(this.freeTextures[i]=[]),i in this.usedTextures||(this.usedTextures[i]=[]),this.freeTextures[i].length>0){this.numFreeTextures--,this.numUsedTextures++,this.log();var s=this.freeTextures[i].shift();return this.usedTextures[i].push(s),s}return this.numUsedTextures++,this.log(),a===Hr.PACKED_2X2_FLOAT32?o=this.gpgpu.createPackedMatrixTexture(r[0],r[1]):a===Hr.PACKED_2X2_FLOAT16?o=this.gpgpu.createFloat16PackedMatrixTexture(r[0],r[1]):a===Hr.UNPACKED_FLOAT32?o=this.gpgpu.createFloat32MatrixTexture(r[0],r[1]):a===Hr.UNPACKED_FLOAT16?o=this.gpgpu.createFloat16MatrixTexture(r[0],r[1]):a===Hr.PACKED_4X1_UNSIGNED_BYTE&&(o=this.gpgpu.createUnsignedBytesMatrixTexture(r[0],r[1])),this.usedTextures[i].push(o),o},n.prototype.releaseTexture=function(r,e,t,o){if(this.freeTextures!=null){var a=Rc(e,Oc(t,o),o);a in this.freeTextures||(this.freeTextures[a]=[]),this.freeTextures[a].push(r),this.numFreeTextures++,this.numUsedTextures--;var i=this.usedTextures[a],s=i.indexOf(r);if(s<0)throw new Error("Cannot release a texture that was never provided by this texture manager");i.splice(s,1),this.log()}},n.prototype.log=function(){if(this.logEnabled){var r=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",this.numFreeTextures+" / "+this.numUsedTextures,"("+r+")")}},n.prototype.getNumUsedTextures=function(){return this.numUsedTextures},n.prototype.getNumFreeTextures=function(){return this.numFreeTextures},n.prototype.dispose=function(){var r=this;if(this.freeTextures!=null){for(var e in this.freeTextures)this.freeTextures[e].forEach(function(t){r.gpgpu.deleteMatrixTexture(t)});for(var e in this.usedTextures)this.usedTextures[e].forEach(function(o){r.gpgpu.deleteMatrixTexture(o)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0}},n}();function Oc(n,r){if(n===Wr.UPLOAD)return Hr.PACKED_2X2_FLOAT32;if(n===Wr.RENDER||n==null)return function(e){return p().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?e?Hr.PACKED_2X2_FLOAT32:Hr.UNPACKED_FLOAT32:e?Hr.PACKED_2X2_FLOAT16:Hr.UNPACKED_FLOAT16}(r);if(n===Wr.DOWNLOAD||n===Wr.PIXELS)return Hr.PACKED_4X1_UNSIGNED_BYTE;throw new Error("Unknown logical texture type "+n)}function Rc(n,r,e){return n[0]+"_"+n[1]+"_"+r+"_"+e}var Ld=function(n,r){this.variableNames=["A"];for(var e=new Array(n.length),t=0;t<e.length;t++)e[t]=n[t]*r[t];this.outputShape=e,this.rank=e.length;var o=Ge(this.rank),a=function(i){var s=i.length;if(s>5)throw Error("Tile for rank "+s+" is not yet supported");if(s===1)return"imod(resRC, "+i[0]+")";for(var u=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],f=[],C=0;C<i.length;C++)f.push("imod("+u[C]+", "+i[C]+")");return f.join()}(n);this.userCode=`
void main() {
`+o+` resRC = getOutputCoords();
setOutput(getA(`+a+`));
}
`},jd=function(n,r){this.variableNames=["A"];for(var e=new Array(n.length),t=0;t<e.length;t++)e[t]=n[r[t]];this.outputShape=e,this.rank=e.length;var o=Ge(this.rank),a=function(i){var s=i.length;if(s>6)throw Error("Transpose for rank "+s+" is not yet supported");for(var u=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],f=new Array(s),C=0;C<i.length;C++)f[i[C]]=u[C];return f.join()}(r);this.userCode=`
void main() {
`+o+` resRC = getOutputCoords();
setOutput(getA(`+a+`));
}
`},Bd=function(n,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0;for(var e=new Array(n.length),t=0;t<e.length;t++)e[t]=n[r[t]];if(this.outputShape=e,this.rank=e.length,this.rank>6)throw Error("Packed transpose for rank "+this.rank+" is not yet supported.");var o=Ge(this.rank),a=au("rc",this.rank),i=new Array(this.rank);for(t=0;t<r.length;t++)i[r[t]]=a[t];var s="vec2("+i.slice(-2).join()+")",u="++"+a[this.rank-1]+" < "+e[this.rank-1],f="getChannel(getA("+i.join()+"), "+s+")";this.userCode=`
void main() {
`+o+` rc = getOutputCoords();
vec4 result = vec4(0.);
result[0] = `+f+`;
if(`+u+`) {
result[1] = `+f+`;
}
--`+a[this.rank-1]+`;
if(++`+a[this.rank-2]+" < "+e[this.rank-2]+`) {
result[2] = `+f+`;
if(`+u+`) {
result[3] = `+f+`;
}
}
setOutput(result);
}
`},du=1.7580993408473768,fu=1.0507009873554805,zt=function(n,r){this.variableNames=["A"],this.outputShape=n,this.userCode=`
float unaryOperation(float x) {
`+r+`
}
void main() {
float x = getAAtOutCoords();
float y = unaryOperation(x);
setOutput(y);
}
`},Nn="if (isnan(x)) return x;",Ud="return x;",Ic="return abs(x);",Nc=Nn+`
return (x < 0.0) ? 0.0 : x;
`,Dc=Nn+`
return (x < 0.0) ? 0.0 : min(6.0, x);
`,kc="return (x >= 0.0) ? x : (exp(x) - 1.0);",Wd=`
// Stable and Attracting Fixed Point (0, 1) for Normalized Weights.
// see: https://arxiv.org/abs/1706.02515
float scaleAlpha = `+du+`;
float scale = `+fu+`;
return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);
`,Mc="return -x;",Pc="return ceil(x);",Fc="return floor(x);",Lc="return exp(x);",jc="return exp(x) - 1.0;",Hd=Nn+`
return sin(x);
`,zd=Nn+`
return cos(x);
`,Gd=Nn+`
if (abs(x) > 1.) {
return NAN;
}
return asin(x);
`,Vd=Nn+`
if (abs(x) > 1.) {
return NAN;
}
return acos(x);
`,Xd=Nn+`
return atan(x);
`,Kd=Nn+"return log(x + sqrt(x * x + 1.0));",Yd=Nn+`
if (x < 1.0) return NAN;
return log(x + sqrt(x * x - 1.0));`,$d=Nn+`
if ((x < -1.0) || (x > 1.0)) return NAN;
return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,is="return x;",Jd="return x;",Bc=`
vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));
bvec4 isNaN = isnan(x);
result.r = isNaN.r ? x.r : result.r;
result.g = isNaN.g ? x.g : result.g;
result.b = isNaN.b ? x.b : result.b;
result.a = isNaN.a ? x.a : result.a;
return result;
`,Uc=`
vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));
bvec4 isNaN = isnan(x);
result.r = isNaN.r ? x.r : result.r;
result.g = isNaN.g ? x.g : result.g;
result.b = isNaN.b ? x.b : result.b;
result.a = isNaN.a ? x.a : result.a;
return result;
`,Wc=`
vec4 result;
result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);
result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);
result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);
result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);
return result;
`,xi=function(n,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n,this.userCode=`
vec4 unaryOperation(vec4 x) {
`+r+`
}
void main() {
vec4 x = getAAtOutCoords();
vec4 y = unaryOperation(x);
setOutput(y);
}
`},qd=function(n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=n;var r=n.length,e=en("rc",r),t=Ge(r),o=function(s,u){if(s===1)return"rc";for(var f="",C=0;C<s;C++)f+=u[C],C<s-1&&(f+=",");return f}(r,e),a=e.slice(-2),i=r<=1?"rc":"vec2("+a.join(",")+")";this.userCode=`
void main() {
`+t+` rc = getOutputCoords();
vec4 packedInput = getA(`+o+`);
setOutput(getChannel(packedInput, `+i+`));
}
`},ss={};function us(n,r){if(r===void 0&&(r=!1),n==="linear")return r?Jd:Ud;if(n==="relu")return r?Bc:Nc;if(n==="elu")return r?Wc:kc;if(n==="relu6")return r?Uc:Dc;if(n==="prelu")return r?kr:Gt;throw new Error("Activation "+n+" has not been implemented for the WebGL backend.")}var Qd=600,Hc=function(n){function r(e){var t,o=n.call(this)||this;if(o.pendingRead=new WeakMap,o.pendingDisposal=new WeakSet,o.dataRefCount=new WeakMap,o.numBytesInGPU=0,o.uploadWaitMs=0,o.downloadWaitMs=0,o.warnedAboutMemory=!1,o.pendingDeletes=0,o.disposed=!1,!p().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");if(e==null){var a=vn(p().getNumber("WEBGL_VERSION"));o.binaryCache=((t=p().getNumber("WEBGL_VERSION"))in ss||(ss[t]={}),ss[t]),o.gpgpu=new Tc(a),o.canvas=a.canvas,o.gpgpuCreatedLocally=!0}else o.gpgpu=e,o.binaryCache={},o.gpgpuCreatedLocally=!1,o.canvas=e.gl.canvas;return o.textureManager=new Fd(o.gpgpu),o.numMBBeforeWarning=p().global.screen==null?1024:p().global.screen.height*p().global.screen.width*window.devicePixelRatio*Qd/1024/1024,o.texData=new _a(o,Ve),o}return D(r,n),r.prototype.numDataIds=function(){return this.texData.numDataIds()+(this.cpuBackend?this.cpuBackend.numDataIds():0)-this.pendingDeletes},r.prototype.write=function(e,t,o){if(p().getBool("DEBUG")&&this.checkNumericalProblems(e),o==="complex64"&&e!=null)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");var a={};return this.texData.set(a,{shape:t,dtype:o,values:e,usage:Wr.UPLOAD}),a},r.prototype.move=function(e,t,o,a){if(p().getBool("DEBUG")&&this.checkNumericalProblems(t),a==="complex64")throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(e,{shape:o,dtype:a,values:t,usage:Wr.UPLOAD})},r.prototype.readSync=function(e){var t=this.texData.get(e),o=t.values,a=t.dtype,i=t.complexTensors,s=t.slice,u=t.shape,f=t.isPacked;if(s!=null){var C=void 0;C=f?new xi(u,is):new zt(u,is);var k=this.runWebGLProgram(C,[{dataId:e,shape:u,dtype:a}],a),L=this.readSync(k.dataId);return this.disposeData(k.dataId),L}if(o!=null)return this.convertAndCacheOnCPU(e);if(a==="string")return o;var X,oe,ue=this.activeTimers!=null;return(ue&&(X=fe()),a==="complex64")?oe=Oa(i.real.dataSync(),i.imag.dataSync()):oe=this.getValuesFromTexture(e),ue&&(this.downloadWaitMs+=fe()-X),this.convertAndCacheOnCPU(e,oe)},r.prototype.read=function(e){return E(this,void 0,void 0,function(){var t,o,a,i,s,u,f,C,k,L,X,oe,ue,se,ce,xe,we,Ee,Se,Me,ze,Be;return g(this,function(je){switch(je.label){case 0:if(this.pendingRead.has(e))return t=this.pendingRead.get(e),[2,new Promise(function(Ue){return t.push(Ue)})];if(o=this.texData.get(e),a=o.values,i=o.shape,s=o.slice,u=o.dtype,f=o.complexTensors,C=o.isPacked,s!=null)return k=void 0,k=C?new xi(i,is):new zt(i,is),L=this.runWebGLProgram(k,[{dataId:e,shape:i,dtype:u}],u),X=this.read(L.dataId),this.disposeData(L.dataId),[2,X];if(a!=null)return[2,this.convertAndCacheOnCPU(e)];if(!p().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&p().getNumber("WEBGL_VERSION")===2)throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");return oe=null,u!=="complex64"&&p().get("WEBGL_BUFFER_SUPPORTED")&&(ue=this.decode(e),se=this.texData.get(ue.dataId),oe=(Be=this.gpgpu).createBufferFromTexture.apply(Be,[se.texture].concat(Or(i)))),this.pendingRead.set(e,[]),u==="complex64"?[3,2]:[4,this.gpgpu.createAndWaitForFence()];case 1:je.sent(),je.label=2;case 2:return u!=="complex64"?[3,4]:[4,Promise.all([f.real.data(),f.imag.data()])];case 3:return xe=je.sent(),we=xe[0],Ee=xe[1],ce=Oa(we,Ee),[3,5];case 4:oe==null?ce=this.getValuesFromTexture(e):(Se=le(i),ce=this.gpgpu.downloadFloat32MatrixFromBuffer(oe,Se)),je.label=5;case 5:return ue!=null&&this.disposeData(ue.dataId),Me=this.convertAndCacheOnCPU(e,ce),ze=this.pendingRead.get(e),this.pendingRead.delete(e),ze.forEach(function(Ue){return Ue(Me)}),this.pendingDisposal.has(e)&&(this.pendingDisposal.delete(e),this.disposeData(e),this.pendingDeletes--),[2,Me]}})})},r.prototype.checkNumericalProblems=function(e){if(e!=null)for(var t=0;t<e.length;t++){var o=e[t];if(!xs(o))throw p().getBool("WEBGL_RENDER_FLOAT32_CAPABLE")?Error("The value "+o+" cannot be represented with your current settings. Consider enabling float32 rendering: 'tf.env().set('WEBGL_RENDER_FLOAT32_ENABLED', true);'"):Error("The value "+o+" cannot be represented on this device.")}},r.prototype.getValuesFromTexture=function(e){var t,o=this.texData.get(e),a=o.shape,i=o.dtype,s=o.isPacked,u=le(a);if(p().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")){var f=this.decode(e),C=this.texData.get(f.dataId),k=(t=this.gpgpu).downloadMatrixFromPackedTexture.apply(t,[C.texture].concat(Or(a))).subarray(0,u);return this.disposeData(f.dataId),k}var L=p().getBool("WEBGL_PACK")&&s===!0,X=L?vo(a):a,oe=L?new Yo(X):new Hn(X),ue=this.runWebGLProgram(oe,[{shape:X,dtype:i,dataId:e}],"float32"),se=this.texData.get(ue.dataId),ce=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(se.texture,se.texShape[0],se.texShape[1]).subarray(0,u);return this.disposeData(ue.dataId),ce},r.prototype.time=function(e){return E(this,void 0,void 0,function(){var t,o,a,i,s,u,f;return g(this,function(C){switch(C.label){case 0:return t=this.activeTimers,o=[],a=!1,this.programTimersStack==null?(this.programTimersStack=o,a=!0):this.activeTimers.push(o),this.activeTimers=o,e(),i=pe(this.activeTimers.map(function(k){return k.query})).filter(function(k){return k!=null}),s=pe(this.activeTimers.map(function(k){return k.name})).filter(function(k){return k!=null}),this.activeTimers=t,a&&(this.programTimersStack=null),u={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null},p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?[4,Promise.all(i)]:[3,2];case 1:return f=C.sent(),u.kernelMs=Z(f),u.getExtraProfileInfo=function(){return f.map(function(k,L){return{name:s[L],ms:k}}).map(function(k){return k.name+": "+k.ms}).join(", ")},[3,3];case 2:u.kernelMs={error:"WebGL query timers are not supported in this environment."},C.label=3;case 3:return this.uploadWaitMs=0,this.downloadWaitMs=0,[2,u]}})})},r.prototype.memory=function(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU}},r.prototype.startTimer=function(){return p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:fe(),endMs:null}},r.prototype.endTimer=function(e){return p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),e):(e.endMs=fe(),e)},r.prototype.getQueryTime=function(e){return E(this,void 0,void 0,function(){var t;return g(this,function(o){return p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?[2,this.gpgpu.waitForQueryAndGetTime(e)]:[2,(t=e).endMs-t.startMs]})})},r.prototype.disposeData=function(e){if(!this.pendingDisposal.has(e)){if(this.pendingRead.has(e))return this.pendingDisposal.add(e),void this.pendingDeletes++;if(this.texData.has(e)){this.releaseGPUData(e);var t=this.texData.get(e).complexTensors;t!=null&&(t.real.dispose(),t.imag.dispose()),this.texData.delete(e)}}},r.prototype.releaseGPUData=function(e){var t=this.texData.get(e),o=t.texture,a=t.dtype,i=t.texShape,s=t.usage,u=t.isPacked,f=t.slice,C=f&&f.origDataId||e,k=this.dataRefCount.get(C);k>1?this.dataRefCount.set(C,k-1):(this.dataRefCount.delete(C),o!=null&&(this.numBytesInGPU-=this.computeBytes(i,a),this.textureManager.releaseTexture(o,i,s,u)));var L=this.texData.get(e);L.texture=null,L.texShape=null,L.isPacked=!1,L.slice=null},r.prototype.getTexture=function(e){return this.uploadToGPU(e),this.texData.get(e).texture},r.prototype.getDataInfo=function(e){return this.texData.get(e)},r.prototype.getCPUBackend=function(){return p().getBool("WEBGL_CPU_FORWARD")?(this.cpuBackend==null&&(this.cpuBackend=Ve.findBackend("cpu")),this.cpuBackend):null},r.prototype.shouldExecuteOnCPU=function(e,t){var o=this;return t===void 0&&(t=128),this.getCPUBackend()!=null&&e.every(function(a){return o.texData.get(a.dataId).texture==null&&a.size<t})},r.prototype.getGPGPUContext=function(){return this.gpgpu},r.prototype.complex=function(e,t){var o=this.makeOutput(e.shape,"complex64");return this.texData.get(o.dataId).complexTensors={real:Ve.keep(e.clone()),imag:Ve.keep(t.clone())},o},r.prototype.real=function(e){return this.texData.get(e.dataId).complexTensors.real.clone()},r.prototype.imag=function(e){return this.texData.get(e.dataId).complexTensors.imag.clone()},r.prototype.slice=function(e,t,o){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.slice(e,t,o);if(le(o)===0)return Ur([],o,e.dtype);var a=this.texData.get(e.dataId).isPacked,i=Ji(e.shape,t,o);if(a||!i){var s=p().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Md(o):new kd(o),u=s.getCustomSetupFunc(t);return this.compileAndRun(s,[e],null,u)}return this.uploadToGPU(e.dataId),this.shallowSlice(e,t,o)},r.prototype.shallowSlice=function(e,t,o){var a=this.texData.get(e.dataId),i=this.makeOutput(o,e.dtype),s=this.texData.get(i.dataId);Object.assign(s,a),s.shape=o,s.dtype=e.dtype;var u=qi(t,e.strides);a.slice&&(u+=a.slice.flatOffset),s.slice={flatOffset:u,origDataId:a.slice&&a.slice.origDataId||e.dataId};var f=this.dataRefCount.get(s.slice.origDataId)||1;return this.dataRefCount.set(s.slice.origDataId,f+1),i},r.prototype.stridedSlice=function(e,t,o,a){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.stridedSlice(e,t,o,a);var i=Ea(t,o,a);if(i.some(function(u){return u===0}))return Ur([],i);var s=new Pd(t,a,i);return this.compileAndRun(s,[e])},r.prototype.reverse=function(e,t){var o=p().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Id(e.shape,t):new Rd(e.shape,t);return this.compileAndRun(o,[e])},r.prototype.concat=function(e,t){if(e[0].dtype==="complex64"){var o=e.map(function(X){return un(X)}),a=e.map(function(X){return xn(X)});return xr(this.concat(o,t),this.concat(a,t))}if(this.shouldExecuteOnCPU(e))return this.cpuBackend.concat(e,t);if(e.length===1)return e[0];if(e.length>p().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){var i=Math.floor(e.length/2),s=this.concat(e.slice(0,i),t),u=this.concat(e.slice(i),t);return this.concat([s,u],t)}if(p().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&e[0].rank>1){var f=new ur(e.map(function(X){return X.shape}),t);return this.compileAndRun(f,e)}var C=qn(e.map(function(X){return X.shape}),t),k=e.map(function(X){return X.as2D(-1,le(X.shape.slice(t)))}),L=new tn(k.map(function(X){return X.shape}));return this.compileAndRun(L,k).reshape(C)},r.prototype.neg=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.neg(e);if(p().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,Mc,e.dtype);var t=new zt(e.shape,Mc);return this.compileAndRun(t,[e])},r.prototype.batchMatMul=function(e,t,o,a){var i=o?e.shape[2]:e.shape[1],s=a?t.shape[1]:t.shape[2],u=o?e.shape[1]:e.shape[2],f=e.shape[0];if((i===1||s===1)&&u>1e3){o&&(e=e.transpose([0,2,1])),a&&(t=t.transpose([0,2,1]));var C=s===1?e:e.as3D(f,u,1),k=s===1?2:1,L=s===1?t.as3D(f,1,u):t;return this.multiply(C,L).sum(k,!0)}var X=nr(e.dtype,t.dtype),oe=new su(e.shape,[f,i,s],o,a);return this.compileAndRun(oe,[e,t],X)},r.prototype.fusedBatchMatMul=function(e){var t=e.a,o=e.b,a=e.transposeA,i=e.transposeB,s=e.bias,u=e.activation,f=e.preluActivationWeights,C=a?t.shape[2]:t.shape[1],k=i?o.shape[1]:o.shape[2],L=t.shape[0],X=nr(t.dtype,o.dtype),oe=s!=null,ue=f!=null,se=u?us(u,!0):null,ce=new su(t.shape,[L,C,k],a,i,oe,se,ue),xe=[t,o];return s&&xe.push(s),f&&xe.push(f),this.compileAndRun(ce,xe,X)},r.prototype.multiply=function(e,t){if(e.dtype==="complex64"){var o=this.texData.get(e.dataId),a=this.texData.get(t.dataId),i=new Wt(gt,e.shape,t.shape),s=new Wt(Ct,e.shape,t.shape),u=[this.makeComplexComponentTensorInfo(e,o.complexTensors.real),this.makeComplexComponentTensorInfo(e,o.complexTensors.imag),this.makeComplexComponentTensorInfo(t,a.complexTensors.real),this.makeComplexComponentTensorInfo(t,a.complexTensors.imag)],f=this.compileAndRun(i,u),C=this.compileAndRun(s,u),k=this.complex(f,C);return f.dispose(),C.dispose(),k}if(this.shouldExecuteOnCPU([e,t]))return this.cpuBackend.multiply(e,t);if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,or,e.dtype);var L=new Ut(or,e.shape,t.shape);return this.compileAndRun(L,[e,t],e.dtype)},r.prototype.batchNormalization=function(e,t,o,a,i,s){var u=[e,t,o],f=null;s!=null&&(f=s.shape,u.push(s));var C=null;if(i!=null&&(C=i.shape,u.push(i)),p().getBool("WEBGL_PACK_NORMALIZATION")){var k=new At(e.shape,t.shape,o.shape,f,C,a);return this.compileAndRun(k,u)}var L=new Dt(e.shape,t.shape,o.shape,f,C,a);return this.compileAndRun(L,u)},r.prototype.localResponseNormalization4D=function(e,t,o,a,i){var s=p().getBool("WEBGL_PACK_NORMALIZATION")?new pd(e.shape,t,o,a,i):new fd(e.shape,t,o,a,i);return this.compileAndRun(s,[e])},r.prototype.LRNGrad=function(e,t,o,a,i,s,u){var f=new hd(t.shape,a,i,s,u);return this.compileAndRun(f,[t,o,e])},r.prototype.tile=function(e,t){if(e.dtype==="string"){var o=this.readSync(e.dataId).map(function(i){return qe(i)});return os(Lt(e.shape,e.dtype,o),t)}var a=new Ld(e.shape,t);return this.compileAndRun(a,[e])},r.prototype.pad=function(e,t,o){var a=p().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new wd(e.shape,t,o):new xd(e.shape,t,o);return this.compileAndRun(a,[e])},r.prototype.transpose=function(e,t){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.transpose(e,t);var o=p().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Bd(e.shape,t):new jd(e.shape,t);return this.compileAndRun(o,[e])},r.prototype.gather=function(e,t,o){if(this.shouldExecuteOnCPU([e,t]))return this.cpuBackend.gather(e,t,o);var a=new br(e.shape,t.size,o);return this.compileAndRun(a,[e,t])},r.prototype.batchToSpaceND=function(e,t,o){_(e.rank<=4,function(){return"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet"});var a=t.reduce(function(k,L){return k*L}),i=Wo(e.shape,t,a),s=qt(i.length,t.length),u=wa(e.shape,t,a),f=Gs(o,t.length),C=Vs(u,o,t.length);return e.reshape(i).transpose(s).reshape(u).slice(f,C)},r.prototype.spaceToBatchND=function(e,t,o){_(e.rank<=4,function(){return"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet"});var a=t.reduce(function(L,X){return L*X}),i=[[0,0]];i.push.apply(i,o);for(var s=1+t.length;s<e.shape.length;++s)i.push([0,0]);var u=e.pad(i),f=Wo(u.shape,t,a,!1),C=qt(f.length,t.length,!1),k=wa(u.shape,t,a,!1);return u.reshape(f).transpose(C).reshape(k)},r.prototype.reduce=function(e,t,o){var a=e.shape[0],i=e.shape[1],s=ai(i),u=new Ed({windowSize:s,inSize:i,batchSize:a},t),f=this.compileAndRun(u,[e],o);return f.shape[1]===1?f:this.reduce(f,t,o)},r.prototype.argReduce=function(e,t,o){o===void 0&&(o=null);var a=e.shape[0],i=e.shape[1];o!=null&&(a=o.shape[0],i=o.shape[1]);var s=ai(i),u=new fc({windowSize:s,inSize:i,batchSize:a},t,o==null),f=[e];o!=null&&f.push(o);var C=this.compileAndRun(u,f,"int32");return C.shape[1]===1?C:this.argReduce(e,t,C)},r.prototype.argReducePacked=function(e,t,o){o===void 0&&(o=null);var a=o!=null?o.shape:e.shape,i=ai(a[a.length-1]),s=new yt(a,i,t,o==null),u=o==null?[e]:[e,o],f=this.compileAndRun(s,u,"int32");return f.rank===e.rank?this.argReducePacked(e,t,f):f},r.prototype.sum=function(e,t){on("sum",t,e.rank);var o=Gr(e.shape,t),a=o[0],i=le(o[1]),s=e.as2D(-1,i),u=hr(e.dtype);return this.reduce(s,"sum",u).reshape(a)},r.prototype.prod=function(e,t){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.prod(e,t);var o=Gr(e.shape,t),a=o[0],i=le(o[1]),s=e.as2D(-1,i),u=hr(e.dtype);return this.reduce(s,"prod",u).reshape(a)},r.prototype.unsortedSegmentSum=function(e,t,o){var a=0,i=sn([a],e.rank),s=e;i!=null&&(s=e.transpose(i),a=fn(1,e.rank)[0]);var u=function(X,oe,ue){for(var se=[],ce=X.length,xe=0;xe<ce;xe++)xe!==oe?se.push(X[xe]):se.push(ue);return se}(s.shape,a,o),f=le([s.shape[a]]),C=s.as2D(-1,f),k=hr(e.dtype),L=this.segOpCompute(C,"unsortedSegmentSum",t,k,o).reshape(u);return i!=null&&(L=L.transpose(bo(i))),L},r.prototype.segOpCompute=function(e,t,o,a,i){var s=e.shape[0],u=e.shape[1],f=function(L,X){var oe,ue=!1;for(L<=Ki?(oe=L,ue=!0):oe=be(L,Math.floor(Math.sqrt(L)));!ue;)oe>X||oe===L?ue=!0:oe=be(L,oe+1);return oe}(u,i),C=new Nd({windowSize:f,inSize:u,batchSize:s,numSegments:i},t),k=this.compileAndRun(C,[e,o],a);return k.shape[1]===i?k:(o=fa(0,i).tile([u/f]),this.segOpCompute(k,t,o,a,i))},r.prototype.argMinMaxReduce=function(e,t,o){var a=[t];if(on("arg"+o.charAt(0).toUpperCase()+o.slice(1),a,e.rank),!p().getBool("WEBGL_PACK_REDUCE")||e.rank<=2){var i=Gr(e.shape,a),s=i[0],u=le(i[1]),f=e.as2D(-1,u);return this.argReduce(f,o).reshape(s)}return this.argReducePacked(e,o)},r.prototype.argMin=function(e,t){return this.argMinMaxReduce(e,t,"min")},r.prototype.argMax=function(e,t){return this.argMinMaxReduce(e,t,"max")},r.prototype.cumsum=function(e,t,o,a){if(t!==e.rank-1)throw new Error("WebGL cumsum shader expects an inner-most axis="+(e.rank-1)+" but got axis="+t);var i=new Zt(e.shape,o,a);return this.compileAndRun(i,[e])},r.prototype.equal=function(e,t){if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
return vec4(equal(a, b));
`,"bool");var o=new Ut("return float(a == b);",e.shape,t.shape);return this.compileAndRun(o,[e,t],"bool")},r.prototype.notEqual=function(e,t){if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
return vec4(notEqual(a, b));
`,"bool");var o=new Ut("return float(a != b);",e.shape,t.shape);return this.compileAndRun(o,[e,t],"bool")},r.prototype.less=function(e,t){if(this.shouldExecuteOnCPU([e,t]))return this.cpuBackend.less(e,t);if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
return vec4(lessThan(a, b));
`,"bool");var o=new Ut("return float(a < b);",e.shape,t.shape);return this.compileAndRun(o,[e,t],"bool")},r.prototype.lessEqual=function(e,t){if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
return vec4(lessThanEqual(a, b));
`,"bool");var o=new Ut("return float(a <= b);",e.shape,t.shape);return this.compileAndRun(o,[e,t],"bool")},r.prototype.greater=function(e,t){if(this.shouldExecuteOnCPU([e,t]))return this.cpuBackend.greater(e,t);if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
return vec4(greaterThan(a, b));
`,"bool");var o=new Ut("return float(a > b);",e.shape,t.shape);return this.compileAndRun(o,[e,t],"bool")},r.prototype.greaterEqual=function(e,t){if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
return vec4(greaterThanEqual(a, b));
`,"bool");var o=new Ut("return float(a >= b);",e.shape,t.shape);return this.compileAndRun(o,[e,t],"bool")},r.prototype.logicalNot=function(e){var t=new zt(e.shape,"return float(!(x >= 1.0));");return this.compileAndRun(t,[e])},r.prototype.logicalAnd=function(e,t){if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
return vec4(
vec4(greaterThanEqual(a, vec4(1.0))) *
vec4(greaterThanEqual(b, vec4(1.0))));
`,"bool");var o=new Ut("return float(a >= 1.0 && b >= 1.0);",e.shape,t.shape);return this.compileAndRun(o,[e,t],"bool")},r.prototype.logicalOr=function(e,t){if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
return min(
vec4(greaterThanEqual(a, vec4(1.0))) +
vec4(greaterThanEqual(b, vec4(1.0))),
vec4(1.0));
`,"bool");var o=new Ut("return float(a >= 1.0 || b >= 1.0);",e.shape,t.shape);return this.compileAndRun(o,[e,t],"bool")},r.prototype.select=function(e,t,o){var a=new Dd(e.rank,t.shape,t.rank);return this.compileAndRun(a,[e,t,o],nr(t.dtype,o.dtype))},r.prototype.where=function(e){da("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");var t=e.dataSync();return fi(e.shape,t)},r.prototype.topk=function(e,t,o){return as(e.dataSync(),e.shape,e.dtype,t)},r.prototype.min=function(e,t){on("min",t,e.rank);var o=Gr(e.shape,t),a=o[0],i=le(o[1]),s=e.as2D(-1,i);return this.reduce(s,"min",s.dtype).reshape(a)},r.prototype.minimum=function(e,t){if(this.shouldExecuteOnCPU([e,t]))return this.cpuBackend.minimum(e,t);var o=p().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new lr(`
vec4 result = vec4(min(a, b));
vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));
result.r = isNaN.r > 0. ? NAN : result.r;
result.g = isNaN.g > 0. ? NAN : result.g;
result.b = isNaN.b > 0. ? NAN : result.b;
result.a = isNaN.a > 0. ? NAN : result.a;
return result;
`,e.shape,t.shape):new Ut(`
if (isnan(a)) return a;
if (isnan(b)) return b;
return min(a, b);
`,e.shape,t.shape);return this.compileAndRun(o,[e,t])},r.prototype.mod=function(e,t){var o=p().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new lr(`
vec4 result = mod(a, b);
vec4 isNaN = vec4(equal(b, vec4(0.0)));
result.r = isNaN.r > 0. ? NAN : result.r;
result.g = isNaN.g > 0. ? NAN : result.g;
result.b = isNaN.b > 0. ? NAN : result.b;
result.a = isNaN.a > 0. ? NAN : result.a;
return result;
`,e.shape,t.shape):new Ut(`if (b == 0.0) return NAN;
return mod(a, b);`,e.shape,t.shape);return this.compileAndRun(o,[e,t])},r.prototype.max=function(e,t){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.max(e,t);on("max",t,e.rank);var o=Gr(e.shape,t),a=o[0],i=le(o[1]),s=e.as2D(-1,i);return this.reduce(s,"max",s.dtype).reshape(a)},r.prototype.maximum=function(e,t){if(this.shouldExecuteOnCPU([e,t]))return this.cpuBackend.maximum(e,t);var o=p().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new lr(`
vec4 result = vec4(max(a, b));
vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));
result.r = isNaN.r > 0. ? NAN : result.r;
result.g = isNaN.g > 0. ? NAN : result.g;
result.b = isNaN.b > 0. ? NAN : result.b;
result.a = isNaN.a > 0. ? NAN : result.a;
return result;
`,e.shape,t.shape):new Ut(`
if (isnan(a)) return a;
if (isnan(b)) return b;
return max(a, b);
`,e.shape,t.shape);return this.compileAndRun(o,[e,t])},r.prototype.all=function(e,t){on("all",t,e.rank);var o=Gr(e.shape,t),a=o[0],i=le(o[1]),s=e.as2D(-1,i);return this.reduce(s,"all",s.dtype).reshape(a)},r.prototype.any=function(e,t){on("any",t,e.rank);var o=Gr(e.shape,t),a=o[0],i=le(o[1]),s=e.as2D(-1,i);return this.reduce(s,"any",s.dtype).reshape(a)},r.prototype.realDivide=function(e,t){if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
// vec4 one = vec4(equal(a, b));
// return one + (vec4(1.0) - one) * a / b;
vec4 result = a / b;
if(a.x == b.x) {
result.x = 1.;
}
if(a.y == b.y) {
result.y = 1.;
}
if(a.z == b.z) {
result.z = 1.;
}
if(a.w == b.w) {
result.w = 1.;
}
return result;
`,"float32",!0);var o=new Ut(`
if (a == b) {
return 1.0;
};
return a / b;`,e.shape,t.shape);return this.compileAndRun(o,[e,t],"float32")},r.prototype.floorDiv=function(e,t){if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
ivec4 ia = round(a);
ivec4 ib = round(b);
bvec4 cond = notEqual(ib, ivec4(0));
ivec4 result = ivec4(0);
vec4 s = sign(a) * sign(b);
// Windows (D3D) wants guaranteed non-zero int division at compile-time.
if (cond[0]) {
result[0] = idiv(ia[0], ib[0], s[0]);
}
if (cond[1]) {
result[1] = idiv(ia[1], ib[1], s[1]);
}
if (cond[2]) {
result[2] = idiv(ia[2], ib[2], s[2]);
}
if (cond[3]) {
result[3] = idiv(ia[3], ib[3], s[3]);
}
return vec4(result);
`,"int32");var o=new Ut(`
float s = sign(a) * sign(b);
int ia = round(a);
int ib = round(b);
if (ib != 0) {
// Windows (D3D) wants guaranteed non-zero int division at compile-time.
return float(idiv(ia, ib, s));
} else {
return NAN;
}
`,e.shape,t.shape);return this.compileAndRun(o,[e,t],"int32")},r.prototype.add=function(e,t){if(e.dtype==="complex64"&&t.dtype==="complex64")return this.complexSeparableBinaryOp(e,t,sr);if(this.shouldExecuteOnCPU([e,t]))return this.cpuBackend.add(e,t);var o=nr(e.dtype,t.dtype);if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,sr,o);var a=new Ut(sr,e.shape,t.shape);return this.compileAndRun(a,[e,t],o)},r.prototype.packedUnaryOp=function(e,t,o){var a=new xi(e.shape,t);return this.compileAndRun(a,[e],o)},r.prototype.packedBinaryOp=function(e,t,o,a,i){i===void 0&&(i=!1);var s=new lr(o,e.shape,t.shape,i);return this.compileAndRun(s,[e,t],a)},r.prototype.complexSeparableBinaryOp=function(e,t,o){var a=this,i=this.texData.get(e.dataId),s=this.texData.get(t.dataId),u=[[i.complexTensors.real,s.complexTensors.real],[i.complexTensors.imag,s.complexTensors.imag]].map(function(L){var X=L[0],oe=L[1],ue=a.makeComplexComponentTensorInfo(e,X),se=a.makeComplexComponentTensorInfo(t,oe),ce=new Ut(o,e.shape,t.shape);return a.compileAndRun(ce,[ue,se],nr(X.dtype,oe.dtype))}),f=u[0],C=u[1],k=this.complex(f,C);return f.dispose(),C.dispose(),k},r.prototype.makeComplexComponentTensorInfo=function(e,t){return{dataId:t.dataId,dtype:t.dtype,shape:e.shape}},r.prototype.addN=function(e){if(e.length===1)return e[0];if(e.length>p().get("WEBGL_MAX_TEXTURES_IN_SHADER")){var t=Math.floor(e.length/2),o=this.addN(e.slice(0,t)),a=this.addN(e.slice(t));return this.addN([o,a])}var i=e.map(function(f){return f.dtype}).reduce(function(f,C){return nr(f,C)}),s=e.map(function(f){return f.shape}),u=p().getBool("WEBGL_PACK")?new dc(e[0].shape,s):new ou(e[0].shape,s);return this.compileAndRun(u,e,i)},r.prototype.subtract=function(e,t){if(e.dtype==="complex64"&&t.dtype==="complex64")return this.complexSeparableBinaryOp(e,t,vr);if(this.shouldExecuteOnCPU([e,t]))return this.cpuBackend.subtract(e,t);var o=nr(e.dtype,t.dtype);if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,vr,e.dtype);var a=new Ut(vr,e.shape,t.shape);return this.compileAndRun(a,[e,t],o)},r.prototype.pow=function(e,t){var o=p().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new lr(`
// isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.
vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1)));
vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);
vec4 result = multiplier * pow(abs(a), b);
// Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS
bvec4 isExpZero = equal(b, vec4(0.0));
result.r = isExpZero.r ? 1.0 : result.r;
result.g = isExpZero.g ? 1.0 : result.g;
result.b = isExpZero.b ? 1.0 : result.b;
result.a = isExpZero.a ? 1.0 : result.a;
vec4 isNaN = vec4(lessThan(a, vec4(0.0))) * vec4(lessThan(floor(b), b));
result.r = isNaN.r > 0. ? NAN : result.r;
result.g = isNaN.g > 0. ? NAN : result.g;
result.b = isNaN.b > 0. ? NAN : result.b;
result.a = isNaN.a > 0. ? NAN : result.a;
return result;
`,e.shape,t.shape):new Ut(`
if(a < 0.0 && floor(b) < b){
return NAN;
}
if (b == 0.0) {
return 1.0;
}
return (round(mod(b, 2.0)) != 1) ?
pow(abs(a), b) : sign(a) * pow(abs(a), b);
`,e.shape,t.shape),a=nr(e.dtype,t.dtype);return this.compileAndRun(o,[e,t],a)},r.prototype.ceil=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.ceil(e);if(p().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,Pc,e.dtype);var t=new zt(e.shape,Pc);return this.compileAndRun(t,[e])},r.prototype.floor=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.floor(e);if(p().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,Fc,e.dtype);var t=new zt(e.shape,Fc);return this.compileAndRun(t,[e])},r.prototype.sign=function(e){var t=new zt(e.shape,`
if (isnan(x)) { return 0.0; }
return sign(x);
`);return this.compileAndRun(t,[e])},r.prototype.isNaN=function(e){var t=new zt(e.shape,"return float(isnan(x));");return this.compileAndRun(t,[e],"bool")},r.prototype.isInf=function(e){var t=new zt(e.shape,"return float(isinf(x));");return this.compileAndRun(t,[e],"bool")},r.prototype.isFinite=function(e){var t=new zt(e.shape,"return float(!isnan(x) && !isinf(x));");return this.compileAndRun(t,[e],"bool")},r.prototype.round=function(e){var t=new zt(e.shape,`
// OpenGL ES does not support round function.
// The algorithm is based on banker's rounding.
float base = floor(x);
if ((x - base) < 0.5) {
return floor(x);
} else if ((x - base) > 0.5) {
return ceil(x);
} else {
if (mod(base, 2.0) == 0.0) {
return base;
} else {
return base + 1.0;
}
}
`);return this.compileAndRun(t,[e])},r.prototype.exp=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.exp(e);if(p().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,Lc,e.dtype);var t=new zt(e.shape,Lc);return this.compileAndRun(t,[e])},r.prototype.expm1=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.expm1(e);if(p().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,jc,e.dtype);var t=new zt(e.shape,jc);return this.compileAndRun(t,[e])},r.prototype.softmax=function(e,t){var o=de([t],e.shape),a=this.max(e,o),i=Vr(a.shape,o),s=this.subtract(e,a.reshape(i)),u=this.exp(s),f=this.sum(u,o).reshape(i);return this.realDivide(u,f)},r.prototype.log=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.log(e);if(p().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,`
vec4 result = log(x);
vec4 isNaN = vec4(lessThan(x, vec4(0.0)));
result.r = isNaN.r == 1.0 ? NAN : result.r;
result.g = isNaN.g == 1.0 ? NAN : result.g;
result.b = isNaN.b == 1.0 ? NAN : result.b;
result.a = isNaN.a == 1.0 ? NAN : result.a;
return result;
`,e.dtype);var t=new zt(e.shape,`if (x < 0.0) return NAN;
return log(x);`);return this.compileAndRun(t,[e])},r.prototype.log1p=function(e){var t=new zt(e.shape,"return log(1.0 + x);");return this.compileAndRun(t,[e])},r.prototype.sqrt=function(e){var t=new zt(e.shape,"return sqrt(x);");return this.compileAndRun(t,[e])},r.prototype.rsqrt=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.rsqrt(e);var t=new zt(e.shape,"return inversesqrt(x);");return this.compileAndRun(t,[e])},r.prototype.reciprocal=function(e){var t=new zt(e.shape,"return 1.0 / x;");return this.compileAndRun(t,[e])},r.prototype.relu=function(e){var t;return t=p().getBool("WEBGL_PACK")?new xi(e.shape,Bc):new zt(e.shape,Nc),this.compileAndRun(t,[e])},r.prototype.relu6=function(e){var t;return t=p().getBool("WEBGL_PACK")?new xi(e.shape,Uc):new zt(e.shape,Dc),this.compileAndRun(t,[e])},r.prototype.prelu=function(e,t){var o=p().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new lr(kr,e.shape,t.shape):new Ut(Gt,e.shape,t.shape);return this.compileAndRun(o,[e,t])},r.prototype.elu=function(e){if(p().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,Wc,e.dtype);var t=new zt(e.shape,kc);return this.compileAndRun(t,[e])},r.prototype.eluDer=function(e,t){var o=p().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new lr(`
vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));
return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));
`,e.shape,t.shape):new Ut("return (b >= 1.0) ? a : a * (b + 1.0);",e.shape,t.shape);return this.compileAndRun(o,[e,t])},r.prototype.selu=function(e){var t=new zt(e.shape,Wd);return this.compileAndRun(t,[e])},r.prototype.int=function(e){var t=new zt(e.shape,"return float(int(x));");return this.compileAndRun(t,[e],"int32")},r.prototype.clip=function(e,t,o){var a,i=(a=p().getBool("WEBGL_PACK_CLIP")?new Yr(e.shape):new Xr(e.shape)).getCustomSetupFunc(t,o);return this.compileAndRun(a,[e],null,i)},r.prototype.abs=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.abs(e);if(p().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,Ic,e.dtype);var t=new zt(e.shape,Ic);return this.compileAndRun(t,[e])},r.prototype.complexAbs=function(e){var t=this.texData.get(e.dataId),o=new Rt(e.shape),a=[this.makeComplexComponentTensorInfo(e,t.complexTensors.real),this.makeComplexComponentTensorInfo(e,t.complexTensors.imag)];return this.compileAndRun(o,a)},r.prototype.sigmoid=function(e){var t=new zt(e.shape,"return 1.0 / (1.0 + exp(-1.0 * x));");return this.compileAndRun(t,[e])},r.prototype.softplus=function(e){var t=new zt(e.shape,`
float epsilon = 1.1920928955078125e-7;
float threshold = log(epsilon) + 2.0;
bool too_large = x > -threshold;
bool too_small = x < threshold;
float result;
float exp_x = exp(x);
if (too_large){
result = x;
}
else if (too_small){
result = exp_x;
}
else{
result = log(exp_x + 1.0);
}
return result;
`);return this.compileAndRun(t,[e])},r.prototype.sin=function(e){var t=new zt(e.shape,Hd);return this.compileAndRun(t,[e])},r.prototype.cos=function(e){var t=new zt(e.shape,zd);return this.compileAndRun(t,[e])},r.prototype.tan=function(e){var t=new zt(e.shape,"return tan(x);");return this.compileAndRun(t,[e])},r.prototype.asin=function(e){var t=new zt(e.shape,Gd);return this.compileAndRun(t,[e])},r.prototype.acos=function(e){var t=new zt(e.shape,Vd);return this.compileAndRun(t,[e])},r.prototype.atan=function(e){var t=new zt(e.shape,Xd);return this.compileAndRun(t,[e])},r.prototype.atan2=function(e,t){var o=p().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new lr(`
vec4 result = atan(a, b);
vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));
result.r = isNaN.r > 0. ? NAN : result.r;
result.g = isNaN.g > 0. ? NAN : result.g;
result.b = isNaN.b > 0. ? NAN : result.b;
result.a = isNaN.a > 0. ? NAN : result.a;
return result;
`,e.shape,t.shape):new Ut(`
if (isnan(a)) return a;
if (isnan(b)) return b;
return atan(a, b);
`,e.shape,t.shape);return this.compileAndRun(o,[e,t])},r.prototype.sinh=function(e){var t=new zt(e.shape,`
float e2x = exp(x);
return (e2x - 1.0 / e2x) / 2.0;
`);return this.compileAndRun(t,[e])},r.prototype.cosh=function(e){var t=new zt(e.shape,`
float e2x = exp(-x);
return (e2x + 1.0 / e2x) / 2.0;
`);return this.compileAndRun(t,[e])},r.prototype.tanh=function(e){var t=new zt(e.shape,`
float e2x = exp(-2.0 * abs(x));
return sign(x) * (1.0 - e2x) / (1.0 + e2x);
`);return this.compileAndRun(t,[e])},r.prototype.asinh=function(e){var t=new zt(e.shape,Kd);return this.compileAndRun(t,[e])},r.prototype.acosh=function(e){var t=new zt(e.shape,Yd);return this.compileAndRun(t,[e])},r.prototype.atanh=function(e){var t=new zt(e.shape,$d);return this.compileAndRun(t,[e])},r.prototype.erf=function(e){var t=new zt(e.shape,`
// Error function is calculated approximately with elementary function.
// See "Handbook of Mathematical Functions with Formulas,
// Graphs, and Mathematical Tables", Abramowitz and Stegun.
float p = 0.3275911;
float a1 = 0.254829592;
float a2 = -0.284496736;
float a3 = 1.421413741;
float a4 = -1.453152027;
float a5 = 1.061405429;
float sign = sign(x);
x = abs(x);
float t = 1.0 / (1.0 + p * x);
return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x));
`);return this.compileAndRun(t,[e])},r.prototype.step=function(e,t){var o=new zt(e.shape,function(a){return a===void 0&&(a=0),Nn+`
return x > 0.0 ? 1.0 : float(`+a+`);
`}(t));return this.compileAndRun(o,[e])},r.prototype.conv2dByMatMul=function(e,t,o,a,i,s){var u=e.shape,f=this.texData.get(e.dataId),C=o.inChannels,k=u[0]*u[1]*u[2],L=o.outChannels,X=o.dataFormat==="channelsLast",oe=(k===1||L===1)&&C>1e3,ue=u[2]%2!=0&&!!f.isPacked;if(oe||!p().getBool("WEBGL_LAZILY_UNPACK")||!p().getBool("WEBGL_PACK_BINARY_OPERATIONS")||!ue){var se=X?u[0]*u[1]*u[2]:u[0]*u[2]*u[3],ce=this.reshape(e,[1,se,o.inChannels]),xe=this.reshape(t,[1,o.inChannels,o.outChannels]);return this.reshape(this.fusedBatchMatMul({a:ce,b:xe,transposeA:!1,transposeB:!1,bias:a,activation:i,preluActivationWeights:s}),o.outShape)}var we=X?u[0]*u[1]*(u[2]+1):u[0]*u[2]*(u[3]+1),Ee={dataId:e.dataId,shape:[1,we,o.inChannels],dtype:e.dtype},Se=f.shape;f.shape=f.shape.slice(),f.shape[f.shape.length-2]++,_(go(f.shape,Ee.shape),function(){return"packed reshape "+f.shape+" to "+Ee.shape+" isn't free"});var Me=this.reshape(t,[1,o.inChannels,o.outChannels]),ze=this.fusedBatchMatMul({a:Ee,b:Me,transposeA:!1,transposeB:!1,bias:a,activation:i,preluActivationWeights:s}),Be=this.texData.get(ze.dataId);return _(Be.isPacked,function(){return"batchMatMul result is expected to be packed"}),f.shape=Se,Be.shape=o.outShape,Ve.makeTensorFromDataId(ze.dataId,o.outShape,ze.dtype)},r.prototype.conv2dWithIm2Row=function(e,t,o,a,i,s){var u=o.filterWidth,f=o.filterHeight,C=o.inChannels,k=o.outWidth,L=o.outHeight,X=o.dataFormat==="channelsLast",oe=u*f*C,ue=L*k,se=[oe,ue],ce=e.squeeze([0]),xe=t.reshape([1,oe,-1]),we=new dd(se,ce.shape,o),Ee=this.compileAndRun(we,[ce]).reshape([1,se[0],se[1]]),Se=a!=null,Me=s!=null,ze=i?us(i,!0):null,Be=new su(Ee.shape,[1,ue,o.outChannels],!0,!1,Se,ze,Me),je=[Ee,xe];a&&je.push(a),Me&&je.push(s);var Ue=this.compileAndRun(Be,je);return X?Ue.reshape([1,L,k,o.outChannels]):Ue.reshape([1,o.outChannels,L,k])},r.prototype.fusedConv2d=function(e){var t=e.input,o=e.filter,a=e.convInfo,i=e.bias,s=e.activation,u=e.preluActivationWeights;if(a.filterHeight===1&&a.filterWidth===1&&a.dilationHeight===1&&a.dilationWidth===1&&a.strideHeight===1&&a.strideWidth===1&&(a.padInfo.type==="SAME"||a.padInfo.type==="VALID"))return this.conv2dByMatMul(t,o,a,i,s,u);if(p().getBool("WEBGL_CONV_IM2COL")&&t.shape[0]===1)return this.conv2dWithIm2Row(t,o,a,i,s,u);var f=i!=null,C=u!=null,k=s?us(s,!1):null,L=new kt(a,f,k,C),X=[t,o];return i&&X.push(i),u&&X.push(u),this.compileAndRun(L,X)},r.prototype.conv2d=function(e,t,o){if(o.filterHeight===1&&o.filterWidth===1&&o.dilationHeight===1&&o.dilationWidth===1&&o.strideHeight===1&&o.strideWidth===1&&(o.padInfo.type==="SAME"||o.padInfo.type==="VALID"))return this.conv2dByMatMul(e,t,o);if(p().getBool("WEBGL_CONV_IM2COL")&&e.shape[0]===1)return this.conv2dWithIm2Row(e,t,o);var a=new kt(o);return this.compileAndRun(a,[e,t])},r.prototype.conv2dDerInput=function(e,t,o){var a=new Rn(o);return this.compileAndRun(a,[e,t])},r.prototype.conv2dDerFilter=function(e,t,o){var a=new Un(o);return this.compileAndRun(a,[e,t])},r.prototype.fusedDepthwiseConv2D=function(e){var t,o=e.input,a=e.filter,i=e.convInfo,s=e.bias,u=e.activation,f=e.preluActivationWeights,C=p().getBool("WEBGL_PACK_DEPTHWISECONV")&&i.strideWidth<=2&&i.outChannels/i.inChannels==1,k=u?us(u,C):null,L=[o,a],X=s!=null,oe=f!=null;return X&&L.push(s),oe&&L.push(f),C?(t=new dr(i,X,k,oe),this.compileAndRun(t,L)):(t=new yr(i,X,k,oe),this.compileAndRun(t,L))},r.prototype.depthwiseConv2D=function(e,t,o){var a;return p().getBool("WEBGL_PACK_DEPTHWISECONV")&&o.strideWidth<=2&&o.outChannels/o.inChannels==1?(a=new dr(o),this.compileAndRun(a,[e,t])):(a=new yr(o),this.compileAndRun(a,[e,t]))},r.prototype.depthwiseConv2DDerInput=function(e,t,o){var a=new gr(o);return this.compileAndRun(a,[e,t])},r.prototype.depthwiseConv2DDerFilter=function(e,t,o){var a=new hi(o);return this.compileAndRun(a,[e,t])},r.prototype.conv3d=function(e,t,o){var a=new Vt(o);return this.compileAndRun(a,[e,t])},r.prototype.conv3dDerInput=function(e,t,o){var a=new Wn(o);return this.compileAndRun(a,[e,t])},r.prototype.conv3dDerFilter=function(e,t,o){var a=new Ko(o);return this.compileAndRun(a,[e,t])},r.prototype.maxPool=function(e,t){var o=new uu(t,"max",!1);return this.compileAndRun(o,[e])},r.prototype.avgPool=function(e,t){var o=new uu(t,"avg",!1);return this.compileAndRun(o,[e],"float32")},r.prototype.maxPoolBackprop=function(e,t,o,a){var i=new uu(a,"max",!0),s=this.compileAndRun(i,[t]),u=new md(a),f=this.compileAndRun(u,[e,s],t.dtype);return s.dispose(),f},r.prototype.avgPoolBackprop=function(e,t,o){var a=new _t(o);return this.compileAndRun(a,[e],t.dtype)},r.prototype.cast=function(e,t){return ci(e,t,this)},r.prototype.unstack=function(e,t){for(var o=e.shape[t],a=new Array(e.rank-1),i=0,s=0;s<e.rank;s++)s!==t&&(a[i++]=e.shape[s]);var u=new Array(e.rank).fill(0),f=e.shape.slice();f[t]=1;var C=new Array(o);for(s=0;s<C.length;s++)u[t]=s,C[s]=this.slice(e,u,f).reshape(a);return C},r.prototype.avgPool3d=function(e,t){var o=new cu(t,"avg",!1);return this.compileAndRun(o,[e],"float32")},r.prototype.avgPool3dBackprop=function(e,t,o){var a=new Tt(o);return this.compileAndRun(a,[e],t.dtype)},r.prototype.maxPool3d=function(e,t){var o=new cu(t,"max",!1);return this.compileAndRun(o,[e],"float32")},r.prototype.maxPool3dBackprop=function(e,t,o,a){var i=new cu(a,"max",!0),s=this.compileAndRun(i,[t]),u=new vd(a),f=this.compileAndRun(u,[e,s],t.dtype);return s.dispose(),f},r.prototype.reshape=function(e,t){var o=this.texData.get(e.dataId);if(o.isPacked&&!go(e.shape,t)&&(o.texture===null||!go(o.shape,t))){var a=this.packedReshape(e,t);return Ve.makeTensorFromDataId(a.dataId,a.shape,a.dtype)}return Aa(e,t)},r.prototype.resizeBilinear=function(e,t,o,a){var i=p().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new Sd(e.shape,t,o,a):new Td(e.shape,t,o,a);return this.compileAndRun(i,[e],"float32")},r.prototype.resizeBilinearBackprop=function(e,t,o){var a=new Cd(e,t,o);return this.compileAndRun(a,[e])},r.prototype.resizeNearestNeighbor=function(e,t,o,a){var i=new Od(e.shape,t,o,a);return this.compileAndRun(i,[e])},r.prototype.resizeNearestNeighborBackprop=function(e,t,o){var a=new Ad(e,t,o);return this.compileAndRun(a,[e])},r.prototype.multinomial=function(e,t,o,a){var i=t?e:zo(e),s=i.shape[0],u=i.shape[1],f=new gd(s,u,o),C=f.getCustomSetupFunc(a);return this.compileAndRun(f,[i],"int32",C)},r.prototype.oneHot=function(e,t,o,a){var i=new yd(e.size,t,o,a);return this.compileAndRun(i,[e])},r.prototype.diag=function(e){var t=new ro(e.size);return this.compileAndRun(t,[e])},r.prototype.nonMaxSuppression=function(e,t,o,a,i){return da("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead"),li(e.dataSync(),t.dataSync(),o,a,i)},r.prototype.cropAndResize=function(e,t,o,a,i,s){var u=new jt(e.shape,t.shape,a,i,s);return this.compileAndRun(u,[e,t,o],"float32")},r.prototype.depthToSpace=function(e,t,o){_(t>1,function(){return"blockSize should be > 1 for depthToSpace, but was: "+t});var a=e.shape[0],i=o==="NHWC"?e.shape[1]:e.shape[2],s=o==="NHWC"?e.shape[2]:e.shape[3],u=o==="NHWC"?e.shape[3]:e.shape[1],f=i*t,C=s*t,k=u/(t*t),L=new wr(o==="NHWC"?[a,f,C,k]:[a,k,f,C],t,o);return this.compileAndRun(L,[e])},r.prototype.split=function(e,t,o){return ns(e,t,o)},r.prototype.scatterND=function(e,t,o){var a=Ho(0,e,o),i=a.sliceRank,s=a.numUpdates,u=a.sliceSize,f=a.strides,C=a.outputSize,k=[C/u,u],L=e.reshape([s,i]),X=t.reshape([s,u]);if(C===0)return Aa(Ur([]),o);var oe=Nt(0),ue=new Ac(s,i,L.rank,X.rank,f,k);return this.compileAndRun(ue,[X,L,oe]).reshape(o)},r.prototype.sparseToDense=function(e,t,o,a){var i=Ho(0,e,o),s=i.sliceRank,u=i.numUpdates,f=i.strides,C=i.outputSize,k=new Ac(u,s,e.rank,t.rank,f,[C,1],!1);return this.compileAndRun(k,[t,e,a]).reshape(o)},r.prototype.fft=function(e){return this.fftImpl(e,!1)},r.prototype.ifft=function(e){return this.fftImpl(e,!0)},r.prototype.fftImpl=function(e,t){var o=this.texData.get(e.dataId),a=new Ia(pi,e.shape,t),i=new Ia(mi,e.shape,t),s=[this.makeComplexComponentTensorInfo(e,o.complexTensors.real),this.makeComplexComponentTensorInfo(e,o.complexTensors.imag)],u=this.compileAndRun(a,s),f=this.compileAndRun(i,s),C=this.complex(u,f).as2D(e.shape[0],e.shape[1]);return u.dispose(),f.dispose(),C},r.prototype.gatherND=function(e,t){var o=t.shape,a=o[o.length-1],i=Xi(e,t),s=i[0],u=i[1],f=i[2],C=i[3],k=t.reshape([u,a]),L=e.reshape([e.size/f,f]),X=new gi(a,C,[u,f]);return this.compileAndRun(X,[L,k]).reshape(s)},r.prototype.fill=function(e,t,o){if((o=o||ot(t))==="string"){var a=De(o,le(e));return a.fill(t),Ve.makeTensor(a,e,o,this)}var i=new vi(e,t),s=i.getCustomSetupFunc(t);return this.compileAndRun(i,[],o,s)},r.prototype.onesLike=function(e){if(e.dtype==="string")throw new Error("onesLike is not supported under string dtype");return this.fill(e.shape,1,e.dtype)},r.prototype.zerosLike=function(e){return this.fill(e.shape,e.dtype==="string"?"":0,e.dtype)},r.prototype.linspace=function(e,t,o){return Zi(e,t,o)},r.prototype.makeTensorInfo=function(e,t){var o=this.write(null,e,t);return this.texData.get(o).usage=null,{dataId:o,shape:e,dtype:t}},r.prototype.makeOutput=function(e,t){var o=this.makeTensorInfo(e,t).dataId;return Ve.makeTensorFromDataId(o,e,t,this)},r.prototype.unpackTensor=function(e){var t=new qd(e.shape);return this.runWebGLProgram(t,[e],e.dtype)},r.prototype.packTensor=function(e){var t=new bd(e.shape);return this.runWebGLProgram(t,[e],e.dtype,null,!0)},r.prototype.packedReshape=function(e,t){var o=[po(e.shape)].concat(mo(e.shape)),a={dtype:e.dtype,shape:o,dataId:e.dataId},i=[po(t)].concat(mo(t)),s=new _d(i,o),u=this.runWebGLProgram(s,[a],e.dtype,null,!0);return{dataId:u.dataId,shape:t,dtype:u.dtype}},r.prototype.decode=function(e){var t,o=this.texData.get(e),a=o.isPacked,i=o.shape,s=o.dtype,u=vo(i);return t=a?new Xt(u):new pr(u),{dtype:s,shape:i,dataId:this.runWebGLProgram(t,[{shape:u,dtype:s,dataId:e}],s,null,!0).dataId}},r.prototype.runWebGLProgram=function(e,t,o,a,i){var s=this;i===void 0&&(i=!1);var u=this.makeTensorInfo(e.outputShape,o),f=this.texData.get(u.dataId);if(e.packedOutput&&(f.isPacked=!0),e.outPackingScheme===Mo.DENSE){var C=Or(e.outputShape);f.texShape=C.map(function(we){return 2*we})}if(e.outTexUsage!=null&&(f.usage=e.outTexUsage),le(u.shape)===0)return f.values=Ce(u.dtype,0),u;var k=[],L=t.map(function(we){if(we.dtype==="complex64")throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");var Ee=s.texData.get(we.dataId);if(Ee.texture==null){if(!e.packedInputs&&le(we.shape)<=p().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:we.shape,texData:null,isUniform:!0,uniformValues:Ee.values};e.packedInputs&&(Ee.isPacked=!0,Ee.shape=we.shape)}else if(!!Ee.isPacked!=!!e.packedInputs)we=Ee.isPacked?s.unpackTensor(we):s.packTensor(we),k.push(we),Ee=s.texData.get(we.dataId);else if(Ee.isPacked&&!go(Ee.shape,we.shape)){var Se=we,Me=we.shape;we.shape=Ee.shape,we=s.packedReshape(we,Me),k.push(we),Ee=s.texData.get(we.dataId),Se.shape=Me}return s.uploadToGPU(we.dataId),{shape:we.shape,texData:Ee,isUniform:!1}});this.uploadToGPU(u.dataId);var X,oe={shape:u.shape,texData:f,isUniform:!1},ue=function(we,Ee,Se){var Me="";Ee.concat(Se).forEach(function(je){var Ue=je.texData!=null&&je.texData.slice!=null&&je.texData.slice.flatOffset>0,Ze=je.isUniform?"uniform":je.texData.texShape;Me+=je.shape+"_"+Ze+"_"+Ue});var ze=we.userCode,Be=we.constructor.name;return Be+="_"+Me+"_"+ze}(e,L,oe),se=this.getAndSaveBinary(ue,function(){return function(we,Ee,Se,Me){var ze=Ee.userCode,Be=Se.map(function(lt,xt){var wt={logicalShape:lt.shape,texShape:lt.isUniform?null:lt.texData.texShape,isUniform:lt.isUniform,isPacked:!lt.isUniform&&lt.texData.isPacked,flatOffset:null};return lt.texData!=null&&lt.texData.slice!=null&&lt.texData.slice.flatOffset>0&&(wt.flatOffset=lt.texData.slice.flatOffset),{name:Ee.variableNames[xt],shapeInfo:wt}}),je=Be.map(function(lt){return lt.shapeInfo}),Ue={logicalShape:Me.shape,texShape:Me.texData.texShape,isUniform:!1,isPacked:Me.texData.isPacked,flatOffset:null},Ze=P(Be,Ue,ze,Ee.packedInputs),Je=we.createProgram(Ze),ht=null,ft=we.getUniformLocation(Je,"NAN",!1);p().getNumber("WEBGL_VERSION")===1&&(ht=we.getUniformLocation(Je,"INFINITY",!1));for(var ut={},vt=0;vt<Ee.variableNames.length;vt++){var mt=Ee.variableNames[vt];ut[mt]=we.getUniformLocation(Je,mt,!1),ut["offset"+mt]=we.getUniformLocation(Je,"offset"+mt,!1)}return{program:Ee,source:Ze,webGLProgram:Je,uniformLocations:ut,inShapeInfos:je,outShapeInfo:Ue,infLoc:ht,nanLoc:ft}}(s.gpgpu,e,L,oe)}),ce=this.activeTimers!=null;if(ce&&(X=this.startTimer()),function(we,Ee,Se,Me,ze){Sc(Ee.inShapeInfos,Se),Sc([Ee.outShapeInfo],[Me]);var Be=Me.texData.texture,je=Me.texData.texShape;Me.texData.isPacked?we.setOutputPackedMatrixTexture(Be,je[0],je[1]):we.setOutputMatrixTexture(Be,je[0],je[1]),we.setProgram(Ee.webGLProgram),p().getNumber("WEBGL_VERSION")===1&&Ee.infLoc!==null&&we.gl.uniform1f(Ee.infLoc,1/0),Ee.nanLoc!==null&&we.gl.uniform1f(Ee.nanLoc,NaN),Se.forEach(function(Ue,Ze){var Je=Ee.program.variableNames[Ze],ht=Ee.uniformLocations[Je],ft=Ee.uniformLocations["offset"+Je];if(ht!=null)if(Ue.isUniform)if(le(Ue.shape)<2)we.gl.uniform1f(ht,Ue.uniformValues[0]);else{var ut=Ue.uniformValues;ut instanceof Float32Array||(ut=new Float32Array(ut)),we.gl.uniform1fv(ht,ut)}else Ue.texData.slice!=null&&ft!=null&&we.gl.uniform1i(ft,Ue.texData.slice.flatOffset),we.setInputMatrixTexture(Ue.texData.texture,ht,Ze)}),ze!=null&&ze(we,Ee.webGLProgram),we.executeProgram()}(this.gpgpu,se,L,oe,a),k.forEach(function(we){return s.disposeData(we.dataId)}),ce&&(X=this.endTimer(X),this.activeTimers.push({name:e.constructor.name,query:this.getQueryTime(X)})),!p().getBool("WEBGL_LAZILY_UNPACK")&&f.isPacked&&i===!1){var xe=this.unpackTensor(u);return this.disposeData(u.dataId),xe}return u},r.prototype.compileAndRun=function(e,t,o,a,i){i===void 0&&(i=!1),o=o||t[0].dtype;var s=this.runWebGLProgram(e,t,o,a,i);return Ve.makeTensorFromDataId(s.dataId,s.shape,s.dtype)},r.prototype.getAndSaveBinary=function(e,t){return e in this.binaryCache||(this.binaryCache[e]=t()),this.binaryCache[e]},r.prototype.getTextureManager=function(){return this.textureManager},r.prototype.dispose=function(){var e=this;this.disposed||(p().getBool("IS_TEST")||Object.keys(this.binaryCache).forEach(function(t){e.gpgpu.deleteProgram(e.binaryCache[t].webGLProgram),delete e.binaryCache[t]}),this.textureManager.dispose(),this.canvas!=null&&typeof HTMLCanvasElement!="undefined"&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0)},r.prototype.floatPrecision=function(){var e=this;return this.floatPrecisionValue==null&&(this.floatPrecisionValue=Rr(function(){if(!p().get("WEBGL_RENDER_FLOAT32_ENABLED")){var t=p().getBool("DEBUG");p().set("DEBUG",!1);var o=e.abs(Nt(1e-8)).dataSync()[0];if(p().set("DEBUG",t),o>0)return 32}return 16})),this.floatPrecisionValue},r.prototype.epsilon=function(){return this.floatPrecision()===32?1e-7:1e-4},r.prototype.uploadToGPU=function(e){var t,o=this.texData.get(e),a=o.shape,i=o.dtype,s=o.values,u=o.texture,f=o.usage,C=o.isPacked;if(u==null){var k,L=this.activeTimers!=null;L&&(k=fe());var X=o.texShape;if(X==null&&(X=Ri(a,C),o.texShape=X),s!=null){var oe=vo(a),ue=void 0,se=X[1],ce=X[0],xe=s instanceof Uint8Array;C?(se=(t=$n(X[0],X[1]))[0],ce=t[1],ue=new Ra(oe,[ce,se],xe)):ue=new Br(oe,[ce,se],xe);var we=this.makeTensorInfo([ce,se],i);this.texData.get(we.dataId).usage=xe?Wr.PIXELS:Wr.UPLOAD,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(we.dataId),se,ce,s);var Ee=this.runWebGLProgram(ue,[we],i,null,!0),Se=this.texData.get(Ee.dataId);o.texture=Se.texture,o.texShape=Se.texShape,o.isPacked=Se.isPacked,o.usage=Se.usage,this.disposeData(we.dataId),this.texData.delete(Ee.dataId),o.values=null,L&&(this.uploadWaitMs+=fe()-k)}else{var Me=this.acquireTexture(X,f,i,C);o.texture=Me}}},r.prototype.convertAndCacheOnCPU=function(e,t){var o=this.texData.get(e),a=o.dtype;return this.releaseGPUData(e),t!=null&&(o.values=function(i,s){if(s==="float32"||s==="complex64")return i;if(s==="int32"||s==="bool"){for(var u=s==="int32"?new Int32Array(i.length):new Uint8Array(i.length),f=0;f<u.length;++f)u[f]=Math.round(i[f]);return u}throw new Error("Unknown dtype "+s)}(t,a)),o.values},r.prototype.acquireTexture=function(e,t,o,a){if(this.numBytesInGPU+=this.computeBytes(e,o),!this.warnedAboutMemory&&this.numBytesInGPU>1024*this.numMBBeforeWarning*1024){var i=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn("High memory usage in GPU: "+i+" MB, most likely due to a memory leak")}return this.textureManager.acquireTexture(e,t,a)},r.prototype.computeBytes=function(e,t){return e[0]*e[1]*ct(t)},r}(Ca);Ha()&&Ve.registerBackend("webgl",function(){return new Hc},2);var Zd=Xe({square_:function(n){var r=Oe(n,"x","square"),e=[r];return Ve.runKernelFunc(function(t,o){return o([r]),t.square(r)},{x:r},null,"Square",{},e,[])}}),wi="SquaredDifference",zc=Xe({squaredDifference_:function(n,r){var e,t=Oe(n,"a","squaredDifference"),o=Oe(r,"b","squaredDifference");e=cr(t,o),t=e[0],o=e[1],Ht(t.shape,o.shape);var a={a:t,b:o},i=[t,o];return Ve.runKernelFunc(function(s,u){var f=s.squaredDifference(t,o);return u([t,o]),f},a,function(s,u){var f=u[0],C=u[1],k=Nt(2);return{a:function(){return s.mul(f.sub(C).mul(k))},b:function(){return s.mul(C.sub(f).mul(k))}}},wi,{},i,[])}}),ef=Xe({abs_:function(n){var r=Oe(n,"x","abs");return r.dtype==="complex64"?Ve.runKernelFunc(function(e){return e.complexAbs(r)},{$x:r}):Ve.runKernelFunc(function(e,t){var o=e.abs(r);return t([r]),o},{x:r},function(e,t){var o=t[0];return{x:function(){return e.mul(o.toFloat().step(-1))}}},"Abs")}}),tf=Xe({acos_:function(n){var r=Oe(n,"x","acos");return Ve.runKernelFunc(function(e,t){var o=e.acos(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.divStrict(Nt(1).sub(o.toFloat().square()).sqrt()).neg()}}})}}),rf=Xe({acosh_:function(n){var r=Oe(n,"x","acosh");return Ve.runKernelFunc(function(e,t){var o=e.acosh(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.divStrict(o.toFloat().square().sub(1).sqrt())}}})}}),nf=Xe({asin_:function(n){var r=Oe(n,"x","asin");return Ve.runKernelFunc(function(e,t){var o=e.asin(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.divStrict(Nt(1).sub(o.toFloat().square()).sqrt())}}})}}),of=Xe({asinh_:function(n){var r=Oe(n,"x","asinh");return Ve.runKernelFunc(function(e,t){var o=e.asinh(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.divStrict(Nt(1).add(o.toFloat().square()).sqrt())}}})}}),af=Xe({atan_:function(n){var r=Oe(n,"x","atan");return Ve.runKernelFunc(function(e,t){var o=e.atan(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.div(o.toFloat().square().add(1))}}})}}),sf=Xe({atanh_:function(n){var r=Oe(n,"x","atanh");return Ve.runKernelFunc(function(e,t){var o=e.atanh(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.div(Nt(1).sub(o.toFloat().square()))}}})}}),uf=Xe({ceil_:function(n){var r=Oe(n,"x","ceil");return Ve.runKernelFunc(function(e){return e.ceil(r)},{$x:r},function(e){return{$x:function(){return Jt(e)}}})}}),Gc=Xe({clipByValue_:function(n,r,e){var t=Oe(n,"x","clipByValue");_(r<=e,function(){return"Error in clip: min ("+r+") must be less than or equal to max ("+e+")."});var o=[t],a={min:r,max:e};return Ve.runKernelFunc(function(i,s){var u=i.clip(t,r,e);return s([t]),u},{x:t},function(i,s){var u=s[0];return{x:function(){return i.where(u.greaterEqual(r).logicalAnd(u.lessEqual(e)),Jt(i))}}},"ClipByValue",a,o)}}),cf=Xe({cos_:function(n){var r=Oe(n,"x","cos"),e=[r];return Ve.runKernelFunc(function(t,o){var a=t.cos(r);return o([r]),a},{x:r},function(t,o){var a=o[0];return{x:function(){return a.toFloat().sin().neg().mul(t)}}},"Cos",{},e)}}),lf=Xe({cosh_:function(n){var r=Oe(n,"x","cosh");return Ve.runKernelFunc(function(e,t){var o=e.cosh(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return o.toFloat().sinh().mulStrict(e)}}})}}),df=Xe({erf_:function(n){var r=Oe(n,"x","erf");return _(r.dtype==="int32"||r.dtype==="float32",function(){return"Input dtype must be `int32` or `float32`."}),r.dtype==="int32"&&(r=r.toFloat()),Ve.runKernelFunc(function(e,t){var o=e.erf(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.mul(o.square().neg().exp().mul(2/Math.sqrt(Math.PI)))}}})}}),Vc=Xe({exp_:function(n){var r=Oe(n,"x","exp");return Ve.runKernelFunc(function(e,t){var o=e.exp(r);return t([o]),o},{x:r},function(e,t){return{x:function(){return e.mulStrict(t[0])}}},"Exp",{},[],[!0])}}),ff=Xe({expm1_:function(n){var r=Oe(n,"x","expm1");return Ve.runKernelFunc(function(e,t){var o=e.expm1(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.mul(o.exp())}}})}}),hf=Xe({floor_:function(n){var r=Oe(n,"x","floor");return Ve.runKernelFunc(function(e){return e.floor(r)},{$x:r},function(e){return{$x:function(){return Jt(e)}}})}}),pf=Xe({log_:function(n){var r=Oe(n,"x","log"),e=[r];return Ve.runKernelFunc(function(t,o){var a=t.log(r);return o([r]),a},{x:r},function(t,o){var a=o[0];return{x:function(){return t.div(a.toFloat())}}},"Log",{},e)}}),mf=Xe({log1p_:function(n){var r=Oe(n,"x","log1p");return Ve.runKernelFunc(function(e,t){var o=e.log1p(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.div(o.add(1))}}})}}),vf=Xe({logSigmoid_:function(n){var r=Oe(n,"x","logSigmoid");return Ve.runKernelFunc(function(e,t){var o=e.softplus(r.neg()).neg();return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.mul(o.neg().sigmoid())}}})}}),hu=Xe({neg_:function(n){var r=Oe(n,"x","neg"),e=[r];return Ve.runKernelFunc(function(t){return t.neg(r)},{x:r},function(t){return{x:function(){return t.neg()}}},"Neg",{},e)}}),gf=Xe({reciprocal_:function(n){var r=Oe(n,"x","reciprocal");return Ve.runKernelFunc(function(e,t){var o=e.reciprocal(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.div(o.square().neg())}}})}}),yf=Xe({round_:function(n){var r=Oe(n,"x","round");return Ve.runKernelFunc(function(e){return e.round(r)},{$x:r},function(e){return{$x:function(){return Jt(e)}}})}}),Xc=Xe({rsqrt_:function(n){var r=Oe(n,"x","rsqrt"),e=[r];return Ve.runKernelFunc(function(t,o){var a=t.rsqrt(r);return o([r]),a},{x:r},function(t,o){var a=o[0];return{x:function(){return t.div(a.pow(1.5).mul(2)).neg()}}},"Rsqrt",{},e)}}),Kc=Xe({sigmoid_:function(n){var r=Oe(n,"x","sigmoid");return Ve.runKernelFunc(function(e,t){var o=e.sigmoid(r);return t([o]),o},{x:r},function(e,t){var o=t[0];return{x:function(){return e.mul(o.mul(Nt(1).sub(o)))}}},"Sigmoid")}}),bf=Xe({sign_:function(n){var r=Oe(n,"x","sign");return Ve.runKernelFunc(function(e){return e.sign(r)},{$x:r},function(e){return{$x:function(){return Jt(e)}}})}}),xf=Xe({isNaN_:function(n){var r=Oe(n,"x","isNaN");return Ve.runKernelFunc(function(e){return e.isNaN(r)},{$x:r},function(e){return{$x:function(){return Jt(e)}}})}}),wf=Xe({isInf_:function(n){var r=Oe(n,"x","isInf");return Ve.runKernelFunc(function(e){return e.isInf(r)},{$x:r},function(e){return{$x:function(){return Jt(e)}}})}}),Ef=Xe({isFinite_:function(n){var r=Oe(n,"x","isFinite");return Ve.runKernelFunc(function(e){return e.isFinite(r)},{$x:r},function(e){return{$x:function(){return Jt(e)}}})}}),_f=Xe({sin_:function(n){var r=Oe(n,"x","sin"),e=[r];return Ve.runKernelFunc(function(t,o){var a=t.sin(r);return o([r]),a},{x:r},function(t,o){var a=o[0];return{x:function(){return a.toFloat().cos().mul(t)}}},"Sin",{},e)}}),Cf=Xe({sinh_:function(n){var r=Oe(n,"x","sinh");return Ve.runKernelFunc(function(e,t){var o=e.sinh(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return o.toFloat().cosh().mulStrict(e)}}})}}),Tf=Xe({softplus_:function(n){var r=Oe(n,"x","softplus");return Ve.runKernelFunc(function(e,t){var o=e.softplus(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.mul(o.sigmoid())}}})}}),Sf=Xe({sqrt_:function(n){var r=Oe(n,"x","sqrt");return Ve.runKernelFunc(function(e,t){var o=e.sqrt(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.div(o.toFloat().sqrt().mul(2))}}})}}),Af=Xe({step_:function(n,r){r===void 0&&(r=0);var e=Oe(n,"x","step");return Ve.runKernelFunc(function(t){return t.step(e,r)},{$x:e},function(t){return{$x:function(){return Jt(t)}}})}}),Of=Xe({tan_:function(n){var r=Oe(n,"x","tan");return Ve.runKernelFunc(function(e,t){var o=e.tan(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.div(o.cos().square())}}})}}),Rf=Xe({tanh_:function(n){var r=Oe(n,"x","tanh");return Ve.runKernelFunc(function(e,t){var o=e.tanh(r);return t([o]),o},{x:r},function(e,t){var o=t[0];return{x:function(){return Nt(1).sub(o.square()).mulStrict(e)}}},"Tanh",{},null,[!0])}});function Yc(n,r,e,t,o,a){var i,s,u=Oe(n,"x","batchNorm"),f=Oe(r,"mean","batchNorm"),C=Oe(e,"variance","batchNorm");return o!=null&&(i=Oe(o,"scale","batchNorm")),t!=null&&(s=Oe(t,"offset","batchNorm")),_(u.rank===2,function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+u.rank+"."}),_(f.rank===2||f.rank===1,function(){return"Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank "+f.rank+"."}),_(C.rank===2||C.rank===1,function(){return"Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank "+C.rank+"."}),i!=null&&_(i.rank===2||i.rank===1,function(){return"Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank "+i.rank+"."}),s!=null&&_(s.rank===2||s.rank===1,function(){return"Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank "+s.rank+"."}),Ei(u,f,C,s,i,a)}function $c(n,r,e,t,o,a){var i,s,u=Oe(n,"x","batchNorm"),f=Oe(r,"mean","batchNorm"),C=Oe(e,"variance","batchNorm");return o!=null&&(i=Oe(o,"scale","batchNorm")),t!=null&&(s=Oe(t,"offset","batchNorm")),_(u.rank===3,function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+u.rank+"."}),_(f.rank===3||f.rank===1,function(){return"Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank "+f.rank+"."}),_(C.rank===3||C.rank===1,function(){return"Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank "+C.rank+"."}),i!=null&&_(i.rank===3||i.rank===1,function(){return"Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank "+i.rank+"."}),s!=null&&_(s.rank===3||s.rank===1,function(){return"Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank "+s.rank+"."}),Ei(u,f,C,s,i,a)}function Jc(n,r,e,t,o,a){var i,s,u=Oe(n,"x","batchNorm"),f=Oe(r,"mean","batchNorm"),C=Oe(e,"variance","batchNorm");return o!=null&&(i=Oe(o,"scale","batchNorm")),t!=null&&(s=Oe(t,"offset","batchNorm")),_(u.rank===4,function(){return"Error in batchNorm4D: x must be rank 4 but got rank "+u.rank+"."}),_(f.rank===4||f.rank===1,function(){return"Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank "+f.rank+"."}),_(C.rank===4||C.rank===1,function(){return"Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank "+C.rank+"."}),i!=null&&_(i.rank===4||i.rank===1,function(){return"Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank "+i.rank+"."}),s!=null&&_(s.rank===4||s.rank===1,function(){return"Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank "+s.rank+"."}),Ei(u,f,C,s,i,a)}function Ei(n,r,e,t,o,a){a==null&&(a=.001);var i,s,u,f=Oe(n,"x","batchNorm"),C=Oe(r,"mean","batchNorm"),k=Oe(e,"variance","batchNorm");o!=null&&(i=Oe(o,"scale","batchNorm")),t!=null&&(s=Oe(t,"offset","batchNorm")),_(C.rank===k.rank,function(){return"Batch normalization gradient requires mean and variance to have equal ranks."}),_(s==null||C.rank===s.rank,function(){return"Batch normalization gradient requires mean and offset to have equal ranks."}),_(i==null||C.rank===i.rank,function(){return"Batch normalization gradient requires mean and scale to have equal ranks."}),u=f.rank===0||f.rank===1?f.as4D(1,1,1,f.size):f.rank===2?f.as4D(1,1,f.shape[0],f.shape[1]):f.rank===3?f.as4D(1,f.shape[0],f.shape[1],f.shape[2]):f;var L=[f,C,k,i];return Ve.runKernelFunc(function(X,oe){var ue=X.batchNormalization(u,cs(C),cs(k),a,cs(i),cs(s));return oe([f,C,k,i]),ue},{x:f,mean:C,variance:k,scale:i,offset:s},function(X,oe){var ue=oe,se=ue[0],ce=ue[1],xe=ue[2],we=ue[3],Ee=we==null?Nt(1):we,Se=Ir(ce.shape,u.shape),Me=[];if(ce.rank===1){for(var ze=0;ze<u.shape.length-1;++ze)Me.push(u.shape[ze]);Me.push(1)}var Be=se.sub(ce),je=X.mul(Ee),Ue=Xc(xe.add(Nt(a))),Ze=Ue.mul(Ue).mul(Ue).mul(Nt(-.5));return{x:function(){return ce.rank===1?X.mul(eo(Ue.as4D(1,1,1,ce.shape[0]),Me)).mul(Ee).reshape(se.shape):X.mul(Ue).mul(Ee).reshape(se.shape)},mean:function(){var Je=Ue.mul(Nt(-1)).mul(je);return ce.rank===1&&(Je=Je.sum(Se)),Je.reshape(ce.shape)},variance:function(){var Je=Ze.mul(Be).mul(je);return ce.rank===1&&(Je=Je.sum(Se)),Je.reshape(ce.shape)},scale:function(){var Je=Be.mul(Ue),ht=X.mul(Je);return ce.rank===1&&(ht=ht.sum(Se)),ht.reshape(ce.shape)},offset:function(){var Je=X;return ce.rank===1&&(Je=Je.sum(Se)),Je.reshape(ce.shape)}}},"BatchNormalization",{varianceEpsilon:a},L).reshape(f.shape)}function cs(n){return n==null?null:n.rank===0?n.as1D():n.rank===1?n:n.rank===2?n.as4D(1,1,n.shape[0],n.shape[1]):n.rank===3?n.as4D(1,n.shape[0],n.shape[1],n.shape[2]):n}function ls(){Pi("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon")}var If=Xe({batchNormalization2d_:function(n,r,e,t,o,a){return t===void 0&&(t=.001),ls(),Yc(n,r,e,a,o,t)}}),Nf=Xe({batchNormalization3d_:function(n,r,e,t,o,a){return t===void 0&&(t=.001),ls(),$c(n,r,e,a,o,t)}}),Df=Xe({batchNormalization4d_:function(n,r,e,t,o,a){return t===void 0&&(t=.001),ls(),Jc(n,r,e,a,o,t)}}),kf=Xe({batchNormalization_:function(n,r,e,t,o,a){return t===void 0&&(t=.001),ls(),Ei(n,r,e,a,o,t)}}),qc=Xe({batchNorm_:Ei}),Mf=Xe({batchNorm2d_:Yc}),Pf=Xe({batchNorm3d_:$c}),Ff=Xe({batchNorm4d_:Jc}),ds=Xe({logicalAnd_:function(n,r){var e=Oe(n,"a","logicalAnd","bool"),t=Oe(r,"b","logicalAnd","bool");return Ht(e.shape,t.shape),Ve.runKernelFunc(function(o){return o.logicalAnd(e,t)},{a:e,b:t},null,"LogicalAnd")}}),Lf=Xe({logicalNot_:function(n){var r=Oe(n,"x","logicalNot","bool");return Ve.runKernelFunc(function(e){return e.logicalNot(r)},{$x:r})}}),Qc=Xe({logicalOr_:function(n,r){var e=Oe(n,"a","logicalOr","bool"),t=Oe(r,"b","logicalOr","bool");return Ht(e.shape,t.shape),Ve.runKernelFunc(function(o){return o.logicalOr(e,t)},{$a:e,$b:t})}}),jf=Xe({logicalXor_:function(n,r){var e=Oe(n,"a","logicalXor","bool"),t=Oe(r,"b","logicalXor","bool");return Ht(e.shape,t.shape),Qc(n,r).logicalAnd(ds(n,r).logicalNot())}}),Jo=Xe({where_:function(n,r,e){var t=Oe(r,"a","where"),o=Oe(e,"b","where"),a=Oe(n,"condition","where","bool");return Y(t.shape,o.shape,"Error in where: "),a.rank===1?_(a.shape[0]===t.shape[0],function(){return"The first dimension of `a` must match the size of `condition`."}):Y(a.shape,o.shape,"Error in where: "),Ve.runKernelFunc(function(i,s){var u=i.select(a,t,o);return s([a]),u},{$condition:a,$a:t,$b:o},function(i,s){var u=s[0];return{$condition:function(){return Jt(u).toFloat()},$a:function(){return i.mul(u.cast(i.dtype))},$b:function(){return i.mul(u.logicalNot().cast(i.dtype))}}})}}),Zc=function(n){return E(this,void 0,void 0,function(){var r,e,t;return g(this,function(o){switch(o.label){case 0:return[4,(r=Oe(n,"condition","whereAsync","bool")).data()];case 1:return e=o.sent(),t=fi(r.shape,e),n!==r&&r.dispose(),[2,t]}})})},qo=Xe({add_:function(n,r){var e,t=Oe(n,"a","add"),o=Oe(r,"b","add");e=cr(t,o),t=e[0],o=e[1];var a=Ht(t.shape,o.shape);return Ve.runKernelFunc(function(i){return i.add(t,o)},{a:t,b:o},function(i){return{a:function(){var s=i,u=Ir(t.shape,a);return u.length>0&&(s=s.sum(u)),s.reshape(t.shape)},b:function(){var s=i,u=Ir(o.shape,a);return u.length>0&&(s=s.sum(u)),s.reshape(o.shape)}}},"Add")}}),Bf=Xe({addN_:function(n){_(Array.isArray(n),function(){return"The argument passed to tf.addN() must be a list of tensors"}),_(n.length>=1,function(){return"Must pass at least one tensor to tf.addN(), but got "+n.length});var r=n.map(function(o,a){return Oe(o,"tensors"+a,"addN")}),e=r[0];r.forEach(function(o){if(o.dtype!==e.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),r.forEach(function(o){if(!_e(o.shape,e.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});var t=r;return Ve.runKernelFunc(function(o){return o.addN(r)},t,function(o){var a={};return r.forEach(function(i,s){a[s]=function(){return o.clone()}}),a},"AddN")}}),Uf=Xe({addStrict_:function(n,r){var e=Oe(n,"a","addStrict"),t=Oe(r,"b","addStrict");return Y(e.shape,t.shape,"Error in addStrict: "),e.add(t)}}),Wf=Xe({atan2_:function(n,r){var e,t=Oe(n,"a","atan2"),o=Oe(r,"b","atan2");e=cr(t,o),t=e[0],o=e[1];var a=Ht(t.shape,o.shape);return Ve.runKernelFunc(function(i,s){var u=i.atan2(t,o);return s([t,o]),u},{$a:t,$b:o},function(i,s){var u=s[0],f=s[1];return{$a:function(){var C=qo(u.square(),f.square()),k=i.mul(f.div(C)),L=Ir(u.shape,a);return L.length>0&&(k=k.sum(L)),k.reshape(u.shape)},$b:function(){var C=qo(u.square(),f.square()),k=hu(i.mul(u.div(C))),L=Ir(f.shape,a);return L.length>0&&(k=k.sum(L)),k.reshape(f.shape)}}})}}),fs=Xe({div_:function(n,r){var e,t=Oe(n,"a","div"),o=Oe(r,"b","div");if(e=cr(t,o),t=e[0],o=e[1],t.dtype==="int32"&&o.dtype==="int32")return el(t,o);var a=Ht(t.shape,o.shape);return Ve.runKernelFunc(function(i,s){var u=i.realDivide(t,o);return s([t,o]),u},{a:t,b:o},function(i,s){var u=s[0],f=s[1];return{a:function(){var C=i.div(f.toFloat()),k=Ir(u.shape,a);return k.length>0?C.sum(k).reshape(u.shape):C},b:function(){var C=i.mul(u.toFloat()),k=Ir(f.shape,a);k.length>0&&(C=C.sum(k).reshape(f.shape));var L=f.square();return C.div(L.toFloat()).neg()}}},"Div")}}),Hf=Xe({divNoNan_:function(n,r){var e,t=Oe(n,"a","div"),o=Oe(r,"b","div");t=(e=cr(t,o))[0],o=e[1];var a=fs(t,o),i=Jt(a),s=o.equal(i);return Jo(s,i,a)}}),zf=Xe({divStrict_:function(n,r){var e=Oe(n,"a","div"),t=Oe(r,"b","div");return Y(e.shape,t.shape,"Error in divideStrict: "),e.div(t)}}),el=Xe({floorDiv_:function(n,r){var e,t=Oe(n,"a","floorDiv"),o=Oe(r,"b","floorDiv");e=cr(t,o),t=e[0],o=e[1];var a=Ht(t.shape,o.shape);return Ve.runKernelFunc(function(i,s){var u=i.floorDiv(t,o);return s([t,o]),u},{a:t,b:o},function(i,s){var u=s[0],f=s[1];return{a:function(){var C=i.div(f.toFloat()),k=Ir(u.shape,a);return k.length>0?C.sum(k).reshape(u.shape):C},b:function(){var C=i.mul(u.toFloat()),k=Ir(f.shape,a);k.length>0&&(C=C.sum(k).reshape(f.shape));var L=f.square();return C.div(L.toFloat()).neg()}}},"FloorDiv")}}),pu=Xe({maximum_:function(n,r){var e,t=Oe(n,"a","maximum"),o=Oe(r,"b","maximum");return e=cr(t,o),t=e[0],o=e[1],t.dtype==="bool"&&(t=t.toInt(),o=o.toInt()),Ht(t.shape,o.shape),Ve.runKernelFunc(function(a,i){var s=a.maximum(t,o);return i([t,o]),s},{a:t,b:o},function(a,i){var s=i[0],u=i[1];return{a:function(){return a.mul(s.greaterEqual(u).toFloat())},b:function(){return a.mul(s.less(u).toFloat())}}},"Maximum")}}),Gf=Xe({maximumStrict_:function(n,r){var e=Oe(n,"a","maximumStrict"),t=Oe(r,"b","maximumStrict");return Y(e.shape,t.shape,"Error in maximumStrict: "),e.maximum(t)}}),tl=Xe({minimum_:function(n,r){var e,t=Oe(n,"a","minimum"),o=Oe(r,"b","minimum");return e=cr(t,o),t=e[0],o=e[1],t.dtype==="bool"&&(t=t.toInt(),o=o.toInt()),Ht(t.shape,o.shape),Ve.runKernelFunc(function(a,i){var s=a.minimum(t,o);return i([t,o]),s},{a:t,b:o},function(a,i){var s=i[0],u=i[1];return{a:function(){return a.mul(s.lessEqual(u).toFloat())},b:function(){return a.mul(s.greater(u).toFloat())}}},"Minimum")}}),Vf=Xe({minimumStrict_:function(n,r){var e=Oe(n,"a","minimumStrict"),t=Oe(r,"b","minimumStrict");return Y(e.shape,t.shape,"Error in minimumStrict: "),e.minimum(t)}}),Xf=Xe({mod_:function(n,r){var e,t=Oe(n,"a","mod"),o=Oe(r,"b","mod");e=cr(t,o),t=e[0],o=e[1];var a=Ht(t.shape,o.shape);return Ve.runKernelFunc(function(i,s){var u=i.mod(t,o);return s([t,o]),u},{$a:t,$b:o},function(i,s){var u=s[0],f=s[1];return{$a:function(){var C=Ir(u.shape,a);return C.length>0?i.sum(C).reshape(u.shape):i},$b:function(){var C=i.mul(u.div(f).floor().neg()),k=Ir(f.shape,a);return k.length>0?C.sum(k).reshape(f.shape):C}}})}}),Kf=Xe({modStrict_:function(n,r){var e=Oe(n,"a","modStrict"),t=Oe(r,"b","modStrict");return Y(e.shape,t.shape,"Error in modStrict: "),e.mod(t)}}),Qo=Xe({mul_:function(n,r){var e,t=Oe(n,"a","mul"),o=Oe(r,"b","mul");e=cr(t,o),t=e[0],o=e[1];var a=Ht(t.shape,o.shape);return Ve.runKernelFunc(function(i,s){var u=i.multiply(t,o);return s([t,o]),u},{a:t,b:o},function(i,s){var u=s[0],f=s[1];return{a:function(){var C=i.mul(f.toFloat()),k=Ir(u.shape,a);return k.length>0?C.sum(k).reshape(u.shape):C},b:function(){var C=i.mul(u.toFloat()),k=Ir(f.shape,a);return k.length>0?C.sum(k).reshape(f.shape):C}}},"Mul")}}),Yf=Xe({mulStrict_:function(n,r){var e=Oe(n,"a","mul"),t=Oe(r,"b","mul");return Y(e.shape,t.shape,"Error in multiplyStrict: "),e.mul(t)}}),hs=Xe({pow_:function(n,r){var e,t=Oe(n,"base","pow"),o=Oe(r,"exp","pow");e=cr(t,o),t=e[0],o=e[1];var a=Ht(t.shape,o.shape),i=[t,o];return Ve.runKernelFunc(function(s,u){var f=s.pow(t,o);return u([t,o,f]),f},{a:t,b:o},function(s,u){var f=u[0],C=u[1],k=u[2];return{a:function(){var L=C.toFloat(),X=s.mul(L.mul(f.pow(L.sub(Nt(1))))),oe=Ir(f.shape,a);return oe.length>0&&(X=X.sum(oe)),X.reshape(f.shape)},b:function(){var L=f.greater(0),X=f.log().where(L,Jt(f)),oe=s.mul(k.mul(X)),ue=Ir(C.shape,a);return ue.length>0&&(oe=oe.sum(ue)),oe.reshape(C.shape)}}},"Pow",{},i,[!0])}}),$f=Xe({powStrict_:function(n,r){return Y(n.shape,r.shape,"Error in powStrict: "),n.pow(r)}}),Jf=Xe({squaredDifferenceStrict_:function(n,r){var e=Oe(n,"a","squaredDifferenceStrict"),t=Oe(r,"b","squaredDifferenceStrict");return Y(e.shape,t.shape,"Error in squaredDifferenceStrict: "),e.squaredDifference(t)}}),Ao=Xe({sub_:function(n,r){var e,t=Oe(n,"a","sub"),o=Oe(r,"b","sub");e=cr(t,o),t=e[0],o=e[1];var a=Ht(t.shape,o.shape);return Ve.runKernelFunc(function(i){return i.subtract(t,o)},{a:t,b:o},function(i){return{a:function(){var s=i,u=Ir(t.shape,a);return u.length>0&&(s=s.sum(u)),s.reshape(t.shape)},b:function(){var s=i,u=Ir(o.shape,a);return u.length>0&&(s=s.sum(u)),s.neg().reshape(o.shape)}}},"Sub")}}),qf=Xe({subStrict_:function(n,r){var e=Oe(n,"a","subStrict"),t=Oe(r,"b","subStrict");return Y(e.shape,t.shape,"Error in subStrict: "),e.sub(t)}}),rl=Xe({equal_:function(n,r){var e,t=Oe(n,"a","equal"),o=Oe(r,"b","equal");return e=cr(t,o),t=e[0],o=e[1],Ht(t.shape,o.shape),Ve.runKernelFunc(function(a){return a.equal(t,o)},{$a:t,$b:o})}}),Qf=Xe({equalStrict_:function(n,r){var e=Oe(n,"a","equalStrict"),t=Oe(r,"b","equalStrict");return Y(e.shape,t.shape,"Error in equalStrict: "),e.equal(t)}}),Zf=Xe({greater_:function(n,r){var e,t=Oe(n,"a","greater"),o=Oe(r,"b","greater");return e=cr(t,o),t=e[0],o=e[1],Ht(t.shape,o.shape),Ve.runKernelFunc(function(a){return a.greater(t,o)},{a:t,b:o},null,"Greater")}}),nl=Xe({greaterEqual_:function(n,r){var e,t=Oe(n,"a","greaterEqual"),o=Oe(r,"b","greaterEqual");return e=cr(t,o),t=e[0],o=e[1],Ht(t.shape,o.shape),Ve.runKernelFunc(function(a,i){var s=a.greaterEqual(t,o);return i([t,o]),s},{a:t,b:o},function(a,i){var s=i[0],u=i[1];return{a:function(){return Jt(s)},b:function(){return Jt(u)}}},"GreaterEqual")}}),eh=Xe({greaterEqualStrict_:function(n,r){var e=Oe(n,"a","greaterEqualStrict"),t=Oe(r,"b","greaterEqualStrict");return Y(e.shape,t.shape,"Error in greaterEqualStrict: "),e.greaterEqual(t)}}),th=Xe({greaterStrict_:function(n,r){var e=Oe(n,"a","greaterStrict"),t=Oe(r,"b","greaterStrict");return Y(e.shape,t.shape,"Error in greaterStrict: "),e.greater(t)}}),rh=Xe({less_:function(n,r){var e,t=Oe(n,"a","less"),o=Oe(r,"b","less");return e=cr(t,o),t=e[0],o=e[1],Ht(t.shape,o.shape),Ve.runKernelFunc(function(a){return a.less(t,o)},{a:t,b:o},null,"Less")}}),nh=Xe({lessEqual_:function(n,r){var e,t=Oe(n,"a","lessEqual"),o=Oe(r,"b","lessEqual");return e=cr(t,o),t=e[0],o=e[1],Ht(t.shape,o.shape),Ve.runKernelFunc(function(a,i){var s=a.lessEqual(t,o);return i([t,o]),s},{a:t,b:o},null,"LessEqual")}}),oh=Xe({lessEqualStrict_:function(n,r){var e=Oe(n,"a","lessEqualStrict"),t=Oe(r,"b","lessEqualStrict");return Y(e.shape,t.shape,"Error in lessEqualStrict: "),e.lessEqual(t)}}),ah=Xe({lessStrict_:function(n,r){var e=Oe(n,"a","lessStrict"),t=Oe(r,"b","lessStrict");return Y(e.shape,t.shape,"Error in lessStrict: "),e.less(t)}}),ih=Xe({notEqual_:function(n,r){var e,t=Oe(n,"a","notEqual"),o=Oe(r,"b","notEqual");return e=cr(t,o),t=e[0],o=e[1],Ht(t.shape,o.shape),Ve.runKernelFunc(function(a){return a.notEqual(t,o)},{a:t,b:o},null,"NotEqual")}}),sh=Xe({notEqualStrict_:function(n,r){var e=Oe(n,"a","notEqualStrict"),t=Oe(r,"b","notEqualStrict");return Y(e.shape,t.shape,"Error in notEqualStrict: "),e.notEqual(t)}});function ol(n,r){for(var e=[],t=n;t<r;++t)e.push(t);return e}function al(n){for(var r=[],e=0;e<n.length;++e)for(var t=0;t<n[e].length;++t)r.push(n[e][t]);return r}var mu=Xe({gather_:function(n,r,e){e===void 0&&(e=0);var t=Oe(n,"x","gather"),o=Oe(r,"indices","gather","int32");e=de(e,t.shape)[0];var a=function(i,s,u){for(var f=i.shape[u],C=[],k=1,L=1,X=0;X<u;X++)C.push(i.shape[X]),k*=i.shape[X];for(X=0;X<s.rank;X++)C.push(s.shape[X]);for(X=u+1;X<i.rank;X++)C.push(i.shape[X]),L*=i.shape[X];return{batchSize:k,sliceSize:L,dimSize:f,outputShape:C}}(t,o,e);return Ve.runKernelFunc(function(i,s){var u=i.gather(t,o.flatten(),e);return s([o]),u},{x:t,indices:o},function(i,s){var u=s[0];return{x:function(){var f=t.shape,C=u.size,k=f.slice(0,e),L=k.length,X=f.slice(e,f.length).slice(1),oe=X.length,ue=ol(0,L),se=ol(L+1,L+1+oe),ce=al([k,[C],X]),xe=i.reshape(ce),we=u.reshape([C]),Ee=al([[L],ue,se]),Se=xe.transpose(Ee),Me=il(Se,we,t.shape[e]),ze=bo(Ee);return Me=Me.transpose(ze)},indices:function(){return u}}},"Gather",{axis:e}).reshape(a.outputShape)}}),il=Xe({unsortedSegmentSum_:function(n,r,e){var t=Oe(n,"x","unsortedSegmentSum"),o=Oe(r,"segmentIds","unsortedSegmentSum","int32");return _(me(e),function(){return"numSegments must be of dtype int"}),Ve.runKernelFunc(function(a,i){var s=a.unsortedSegmentSum(t,o,e);return i([o]),s},{$x:t},function(a,i){var s=i[0];return{$x:function(){return function(u,f){for(var C=pu(f,Jt(f)),k=mu(u,C),L=nl(f,Nt(0,"int32")),X=k.rank-L.rank,oe=0;oe<X;++oe)L=On(L,oe+1);L=ds(L,Mn(k.shape,"bool"));var ue=Jt(k);return Jo(L,k,ue)}(a,s)}}})}}),uh=function(n,r,e){return E(this,void 0,void 0,function(){var t,o,a,i,s,u,f,C,k,L,X,oe,ue;return g(this,function(se){switch(se.label){case 0:for(t=Oe(n,"tensor","boolMask"),o=Oe(r,"mask","boolMask","bool"),a=e==null?0:e,i=o.rank,s=t.shape,_(i>0,function(){return"mask cannot be scalar"}),Y(s.slice(a,a+i),o.shape,"mask's shape must match the first K dimensions of tensor's shape,"),u=1,f=a;f<a+i;f++)u*=s[f];return C=s.slice(0,a).concat([u],s.slice(a+i)),k=t.reshape(C),L=o.reshape([-1]),[4,Zc(L)];case 1:return X=se.sent(),oe=X.squeeze([1]),ue=mu(k,oe,a),n!==t&&t.dispose(),r!==o&&o.dispose(),oe.dispose(),k.dispose(),L.dispose(),X.dispose(),[2,ue]}})})};function sl(n,r,e,t,o,a,i){a===void 0&&(a="NHWC"),_(n.length===r.rank,function(){return"Length of inShape ("+n.length+") and rank of dy ("+r.rank+") must match"});var s=n,u=r,f=!1;r.rank===3&&(f=!0,u=r.as4D(1,r.shape[0],r.shape[1],r.shape[2]),s=[1,n[0],n[1],n[2]]),_(s.length===4,function(){return"Error in conv2dDerInput: inShape must be length 4, but got length "+s.length+"."}),_(u.rank===4,function(){return"Error in conv2dDerInput: dy must be rank 4, but got rank "+u.rank}),_(e.rank===4,function(){return"Error in conv2dDerInput: filter must be rank 4, but got rank "+e.rank});var C=a==="NHWC"?s[3]:s[1],k=a==="NHWC"?u.shape[3]:u.shape[1];_(C===e.shape[2],function(){return"Error in conv2dDerInput: depth of input ("+C+") must match input depth for filter "+e.shape[2]+"."}),_(k===e.shape[3],function(){return"Error in conv2dDerInput: depth of output ("+k+") must match output depth for filter "+e.shape[3]+"."}),i!=null&&_(me(o),function(){return"Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+o+"."});var L=ui(a),X=jn(s,e.shape,t,1,o,i,!1,L),oe=Ve.runKernelFunc(function(ue,se){var ce=ue.conv2dDerInput(u,e,X);return se([e,u]),ce},{dy4D:u,filter:e},function(ue,se){var ce=se[0],xe=se[1];return{dy4D:function(){return Na(ue,ce,t,o,a,1,i)},filter:function(){return gu(ue,xe,ce.shape,t,o,a,i)}}});return f?oe.as3D(oe.shape[1],oe.shape[2],oe.shape[3]):oe}function vu(n){var r=function(a){return typeof a=="number"?[a,a,a]:a.length===2?[a[0],a[1],1]:a}(n),e=r[0],t=r[1],o=r[2];return e===1&&t===1&&o===1}function ul(n,r,e,t,o){_(n.length===r.rank,function(){return"Length of inShape ("+n.length+") and rank of dy ("+r.rank+") must match"});var a=n,i=r,s=!1;r.rank===4&&(s=!0,i=r.as5D(1,r.shape[0],r.shape[1],r.shape[2],r.shape[3]),a=[1,n[0],n[1],n[2],n[3]]);var u=a[4],f=i.shape[4];_(a.length===5,function(){return"Error in conv3dDerInput: inShape must be length 5, but got length "+a.length+"."}),_(i.rank===5,function(){return"Error in conv3dDerInput: dy must be rank 5, but got rank "+i.rank}),_(e.rank===5,function(){return"Error in conv3dDerInput: filter must be rank 5, but got rank "+e.rank}),_(u===e.shape[3],function(){return"Error in conv3dDerInput: depth of input ("+u+") must match input depth for filter "+e.shape[3]+"."}),_(f===e.shape[4],function(){return"Error in conv3dDerInput: depth of output ("+f+") must match output depth for filter "+e.shape[4]+"."});var C=To(a,e.shape,t,1,o),k=Ve.runKernelFunc(function(L){return L.conv3dDerInput(i,e,C)},{dy5D:i});return s?k.as4D(k.shape[1],k.shape[2],k.shape[3],k.shape[4]):k}var ch=Xe({conv1d_:function(n,r,e,t,o,a,i){o===void 0&&(o="NWC"),a===void 0&&(a=1);var s=Oe(n,"x","conv1d"),u=Oe(r,"filter","conv1d"),f=s,C=!1;s.rank===2&&(C=!0,f=s.as3D(1,s.shape[0],s.shape[1])),_(f.rank===3,function(){return"Error in conv1d: input must be rank 3, but got rank "+f.rank+"."}),_(u.rank===3,function(){return"Error in conv1d: filter must be rank 3, but got rank "+u.rank+"."}),i!=null&&_(me(t),function(){return"Error in conv1d: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+t+"."}),_(f.shape[2]===u.shape[1],function(){return"Error in conv1d: depth of input ("+f.shape[2]+") must match input depth for filter "+u.shape[1]+"."}),_(Zr(e,a),function(){return"Error in conv1D: Either stride or dilation must be 1. Got stride "+e+" and dilation '"+a+"'"}),_(o==="NWC",function(){return"Error in conv1d: got dataFormat of "+o+" but only NWC is currently supported."});var k=u.as4D(1,u.shape[0],u.shape[1],u.shape[2]),L=f.as4D(f.shape[0],1,f.shape[1],f.shape[2]),X=Na(L,k,[1,e],t,"NHWC",[1,a],i);return C?X.as2D(X.shape[2],X.shape[3]):X.as3D(X.shape[0],X.shape[2],X.shape[3])}}),Na=Xe({conv2d_:function(n,r,e,t,o,a,i){o===void 0&&(o="NHWC"),a===void 0&&(a=[1,1]);var s=Oe(n,"x","conv2d"),u=Oe(r,"filter","conv2d"),f=s,C=!1;s.rank===3&&(C=!0,f=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),_(f.rank===4,function(){return"Error in conv2d: input must be rank 4, but got rank "+f.rank+"."}),_(u.rank===4,function(){return"Error in conv2d: filter must be rank 4, but got rank "+u.rank+"."}),i!=null&&_(me(t),function(){return"Error in conv2d: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+t+"."});var k=o==="NHWC"?f.shape[3]:f.shape[1];_(k===u.shape[2],function(){return"Error in conv2d: depth of input ("+k+") must match input depth for filter "+u.shape[2]+"."}),_(Zr(e,a),function(){return"Error in conv2D: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+a+"'"});var L=ui(o),X=jn(f.shape,u.shape,e,a,t,i,!1,L),oe=[u,f],ue=Ve.runKernelFunc(function(se,ce){var xe=se.conv2d(f,u,X);return ce([u,f]),xe},{x:f,filter:u},function(se,ce){var xe=ce,we=xe[0],Ee=xe[1];return _(So(a),function(){return"Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+a+"'"}),{x:function(){return cl(Ee.shape,se,we,e,t,o)},filter:function(){return gu(Ee,se,we.shape,e,t,o)}}},"Conv2D",X,oe);return C?ue.as3D(ue.shape[1],ue.shape[2],ue.shape[3]):ue}}),lh=Xe({conv3d_:function(n,r,e,t,o,a){o===void 0&&(o="NDHWC"),a===void 0&&(a=[1,1,1]);var i=Oe(n,"x","conv3d"),s=Oe(r,"filter","conv3d"),u=i,f=!1;i.rank===4&&(f=!0,u=i.as5D(1,i.shape[0],i.shape[1],i.shape[2],i.shape[3])),_(u.rank===5,function(){return"Error in conv3d: input must be rank 5, but got rank "+u.rank+"."}),_(s.rank===5,function(){return"Error in conv3d: filter must be rank 5, but got rank "+s.rank+"."}),_(u.shape[4]===s.shape[3],function(){return"Error in conv3d: depth of input ("+u.shape[4]+") must match input depth for filter "+s.shape[3]+"."}),_(function(L,X){return vu(L)||vu(X)}(e,a),function(){return"Error in conv3D: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+a+"'"}),_(o==="NDHWC",function(){return"Error in conv3d: got dataFormat of "+o+" but only NDHWC is currently supported."});var C=To(u.shape,s.shape,e,a,t),k=Ve.runKernelFunc(function(L,X){var oe=L.conv3d(u,s,C);return X([u,s]),oe},{x:u,$filter:s},function(L,X){_(vu(a),function(){return"Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+a+"'"});var oe=X[0],ue=X[1];return{x:function(){return ul(oe.shape,L,ue,e,t)},$filter:function(){return function(se,ce,xe,we,Ee){var Se=se;se.rank===4&&(Se=se.as5D(1,se.shape[0],se.shape[1],se.shape[2],se.shape[3]));var Me=ce;Me.rank===4&&(Me=ce.as5D(1,ce.shape[0],ce.shape[1],ce.shape[2],ce.shape[3])),_(Se.rank===5,function(){return"Error in conv3dDerFilter: input must be rank 5, but got shape "+Se.shape+"."}),_(Me.rank===5,function(){return"Error in conv3dDerFilter: dy must be rank 5, but got shape "+Me.shape+"."}),_(xe.length===5,function(){return"Error in conv3dDerFilter: filterShape must be length 5, but got "+xe+"."}),_(Se.shape[4]===xe[3],function(){return"Error in conv3dDerFilter: depth of input "+Se.shape[4]+") must match input depth in filter ("+xe[3]+"."}),_(Me.shape[4]===xe[4],function(){return"Error in conv3dDerFilter: depth of dy ("+Me.shape[4]+") must match output depth for filter ("+xe[4]+")."});var ze=To(Se.shape,xe,we,1,Ee);return Ve.runKernelFunc(function(Be){return Be.conv3dDerFilter(Se,Me,ze)},{x5D:Se,dy5D:Me})}(oe,L,ue.shape,e,t)}}});return f?k.as4D(k.shape[1],k.shape[2],k.shape[3],k.shape[4]):k}}),gu=Xe({conv2dDerFilter_:function(n,r,e,t,o,a,i){a===void 0&&(a="NHWC");var s=n;n.rank===3&&(s=n.as4D(1,n.shape[0],n.shape[1],n.shape[2]));var u=r;u.rank===3&&(u=r.as4D(1,r.shape[0],r.shape[1],r.shape[2])),_(s.rank===4,function(){return"Error in conv2dDerFilter: input must be rank 4, but got shape "+s.shape+"."}),_(u.rank===4,function(){return"Error in conv2dDerFilter: dy must be rank 4, but got shape "+u.shape+"."}),_(e.length===4,function(){return"Error in conv2dDerFilter: filterShape must be length 4, but got "+e+"."});var f=a==="NHWC"?s.shape[3]:s.shape[1],C=a==="NHWC"?u.shape[3]:u.shape[1];_(f===e[2],function(){return"Error in conv2dDerFilter: depth of input "+f+") must match input depth in filter ("+e[2]+"."}),_(C===e[3],function(){return"Error in conv2dDerFilter: depth of dy ("+C+") must match output depth for filter ("+e[3]+")."}),i!=null&&_(me(o),function(){return"Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+o+"."});var k=ui(a),L=jn(s.shape,e,t,1,o,i,!1,k);return Ve.runKernelFunc(function(X){return X.conv2dDerFilter(s,u,L)},{x4D:s,dy4D:u})}}),cl=Xe({conv2dDerInput_:sl}),ps=Xe({depthwiseConv2d_:function(n,r,e,t,o,a,i){o===void 0&&(o="NHWC"),a===void 0&&(a=[1,1]);var s=Oe(n,"x","depthwiseConv2d"),u=Oe(r,"filter","depthwiseConv2d"),f=s,C=!1;s.rank===3&&(C=!0,f=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),_(f.rank===4,function(){return"Error in depthwiseConv2d: input must be rank 4, but got rank "+f.rank+"."}),_(u.rank===4,function(){return"Error in depthwiseConv2d: filter must be rank 4, but got rank "+u.rank+"."}),_(f.shape[3]===u.shape[2],function(){return"Error in depthwiseConv2d: number of input channels ("+f.shape[3]+") must match the inChannels dimension in filter "+u.shape[2]+"."}),a==null&&(a=[1,1]),_(Zr(e,a),function(){return"Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+a+"'"}),i!=null&&_(me(t),function(){return"Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+t+"."});var k=jn(f.shape,u.shape,e,a,t,i,!0),L=[f,u],X=Ve.runKernelFunc(function(oe,ue){var se=oe.depthwiseConv2D(f,u,k);return ue([f,u]),se},{x:f,filter:u},function(oe,ue){_(So(a),function(){return"Error in gradient of depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+a+"'"});var se=ue[0],ce=ue[1];return{x:function(){return ll(se.shape,oe,ce,k)},filter:function(){return dl(se,oe,ce.shape,k)}}},"DepthwiseConv2dNative",k,L);return C?X.as3D(X.shape[1],X.shape[2],X.shape[3]):X}}),ll=Xe({depthwiseConv2dDerInput_:function(n,r,e,t){var o=r,a=!1;r.rank===3&&(a=!0,o=r.as4D(1,r.shape[0],r.shape[1],r.shape[2]));var i=Ve.runKernelFunc(function(s){return s.depthwiseConv2DDerInput(o,e,t)},{dy4D:o});return a?i.as3D(i.shape[1],i.shape[2],i.shape[3]):i}}),dl=Xe({depthwiseConv2dDerFilter_:function(n,r,e,t){var o=n;n.rank===3&&(o=n.as4D(1,n.shape[0],n.shape[1],n.shape[2]));var a=r;return a.rank===3&&(a=r.as4D(1,r.shape[0],r.shape[1],r.shape[2])),Ve.runKernelFunc(function(i){return i.depthwiseConv2DDerFilter(o,a,t)},{x4D:o,dy4D:a})}}),fl=Xe({separableConv2d_:function(n,r,e,t,o,a,i){a===void 0&&(a=[1,1]),i===void 0&&(i="NHWC");var s=Oe(n,"x","separableConv2d"),u=Oe(r,"depthwiseFilter","separableConv2d"),f=Oe(e,"pointwiseFilter","separableConv2d"),C=s,k=!1;if(s.rank===3&&(k=!0,C=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),i==="NCHW")throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");_(C.rank===4,function(){return"Error in separableConv2d: input must be rank 4, but got rank "+C.rank+"."}),_(u.rank===4,function(){return"Error in separableConv2d: depthwise filter must be rank 4, but got rank "+u.rank+"."}),_(f.rank===4,function(){return"Error in separableConv2d: pointwise filter must be rank 4, but got rank "+u.rank+"."}),_(f.shape[0]===1,function(){return"Error in separableConv2d: the first dimension of pointwise filter must be 1, but got "+f.shape[0]+"."}),_(f.shape[1]===1,function(){return"Error in separableConv2d: the second dimension of pointwise filter must be 1, but got "+f.shape[1]+"."});var L=u.shape[2],X=u.shape[3];_(f.shape[2]===L*X,function(){return"Error in separableConv2d: the third dimension of pointwise filter must be "+L*X+", but got "+f.shape[2]+"."});var oe=ps(C,u,t,o,i,a),ue=Na(oe,f,1,"valid",i);return k?ue.as3D(ue.shape[1],ue.shape[2],ue.shape[3]):ue}}),dh=Xe({conv2dTranspose_:function(n,r,e,t,o,a){return sl(e,Oe(n,"x","conv2dTranspose"),Oe(r,"filter","conv2dTranspose"),t,o,"NHWC",a)}}),fh=Xe({conv3dTranspose_:function(n,r,e,t,o){return ul(e,Oe(n,"x","conv3dTranspose"),Oe(r,"filter","conv3dTranspose"),t,o)}}),yu=Xe({matMul_:function(n,r,e,t){var o;e===void 0&&(e=!1),t===void 0&&(t=!1);var a=Oe(n,"a","matMul"),i=Oe(r,"b","matMul");o=cr(a,i),a=o[0],i=o[1];var s=e?a.shape[a.rank-2]:a.shape[a.rank-1],u=t?i.shape[i.rank-1]:i.shape[i.rank-2],f=e?a.shape[a.rank-1]:a.shape[a.rank-2],C=t?i.shape[i.rank-2]:i.shape[i.rank-1],k=a.shape.slice(0,-2),L=i.shape.slice(0,-2),X=le(k),oe=le(L);_(a.rank>=2&&i.rank>=2&&a.rank===i.rank,function(){return"Error in matMul: inputs must have the same rank of at least 2, got ranks "+a.rank+" and "+i.rank+"."}),_(_e(k,L),function(){return"Error in matMul: outer dimensions ("+k+") and ("+L+") of Tensors with shapes "+a.shape+" and "+i.shape+" must match."}),_(s===u,function(){return"Error in matMul: inner shapes ("+s+") and ("+u+") of Tensors with shapes "+a.shape+" and "+i.shape+" and transposeA="+e+" and transposeB="+t+" must match."});var ue=a.shape.slice(0,-2).concat([f,C]),se=e?a.as3D(X,s,f):a.as3D(X,f,s),ce=t?i.as3D(oe,C,u):i.as3D(oe,u,C),xe={transposeA:e,transposeB:t};return Ve.runKernelFunc(function(we,Ee){var Se=we.batchMatMul(se,ce,e,t);return Ee([se,ce]),Se},{a:se,b:ce},function(we,Ee){var Se=Ee,Me=Se[0],ze=Se[1];return e||t?!e&&t?{a:function(){return we.matMul(ze,!1,!1)},b:function(){return we.matMul(Me,!0,!1)}}:e&&!t?{a:function(){return ze.matMul(we,!1,!0)},b:function(){return Me.matMul(we,!1,!1)}}:{a:function(){return ze.matMul(we,!0,!0)},b:function(){return we.matMul(Me,!0,!0)}}:{a:function(){return we.matMul(ze,!1,!0)},b:function(){return Me.matMul(we,!0,!1)}}},"BatchMatMul",xe).reshape(ue)}}),hh=Xe({dot_:function(n,r){var e=Oe(n,"t1","dot"),t=Oe(r,"t2","dot");_(!(e.rank!==1&&e.rank!==2||t.rank!==1&&t.rank!==2),function(){return"Error in dot: inputs must all be rank 1 or 2, but got ranks "+e.rank+" and "+t.rank+"."});var o=e.rank===1?e.size:e.shape[1],a=t.rank===1?t.size:t.shape[0];return _(o===a,function(){return"Error in dot: inner dimensions of inputs must match, but got "+o+" and "+a+"."}),e.rank===1&&t.rank===1?e.as2D(1,-1).matMul(t.as2D(-1,1)).asScalar():e.rank===1&&t.rank===2?e.as2D(1,-1).matMul(t.as2D(t.shape[0],t.shape[1])).as1D():e.rank===2&&t.rank===1?e.matMul(t.as2D(-1,1)).as1D():e.matMul(t.as2D(t.shape[0],t.shape[1]))}}),ph=Xe({outerProduct_:function(n,r){var e=Oe(n,"v1","outerProduct"),t=Oe(r,"v2","outerProduct");return _(e.rank===1&&t.rank===1,function(){return"Error in outerProduct: inputs must be rank 1, but got ranks "+e.rank+" and "+t.rank+"."}),e.as2D(-1,1).matMul(t.as2D(1,-1))}}),_i=Xe({reverse_:function(n,r){var e=Oe(n,"x","reverse");if(e.rank===0)return e.clone();var t=de(r,e.shape);return Ve.runKernelFunc(function(o){return o.reverse(e,t)},{$x:e},function(o){return{$x:function(){return o.reverse(t)}}}).reshapeAs(e)}}),mh=Xe({reverse1d_:function(n){var r=Oe(n,"x","reverse");return _(r.rank===1,function(){return"Error in reverse1D: x must be rank 1 but got rank "+r.rank+"."}),_i(r,0)}}),vh=Xe({reverse2d_:function(n,r){var e=Oe(n,"x","reverse");return _(e.rank===2,function(){return"Error in reverse2D: x must be rank 2 but got rank "+e.rank+"."}),_i(e,r)}}),gh=Xe({reverse3d_:function(n,r){var e=Oe(n,"x","reverse");return _(e.rank===3,function(){return"Error in reverse3D: x must be rank 3 but got rank "+e.rank+"."}),_i(e,r)}}),yh=Xe({reverse4d_:function(n,r){var e=Oe(n,"x","reverse");return _(e.rank===4,function(){return"Error in reverse4D: x must be rank 4 but got rank "+e.rank+"."}),_i(e,r)}});function hl(n,r,e,t,o,a){var i=Oe(n,"x","maxPool"),s=i,u=!1;i.rank===3&&(u=!0,s=i.as4D(1,i.shape[0],i.shape[1],i.shape[2])),t==null&&(t=[1,1]),_(s.rank===4,function(){return"Error in maxPool: input must be rank 4 but got rank "+s.rank+"."}),_(Zr(e,t),function(){return"Error in maxPool: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+t+"'"}),a!=null&&_(me(o),function(){return"Error in maxPool: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+o+"."});var f=to(s.shape,r,e,t,o,a);if(f.filterWidth===1&&f.filterHeight===1&&_e(f.inShape,f.outShape))return i.clone();var C=[s],k=Ve.runKernelFunc(function(L,X){var oe=L.maxPool(s,f);return X([s,oe]),oe},{x:s},function(L,X){var oe=X[0],ue=X[1];return{x:function(){return function(se,ce,xe,we,Ee,Se,Me,ze){var Be=Oe(se,"dy","maxPoolBackprop"),je=Oe(ce,"input","maxPoolBackprop"),Ue=Oe(xe,"output","maxPoolBackprop");_(je.rank===Be.rank,function(){return"Rank of input ("+je.rank+") does not match rank of dy ("+Be.rank+")"}),Se==null&&(Se=[1,1]),_(Zr(Ee,Se),function(){return"Error in maxPoolBackProp: Either strides or dilations must be 1. Got strides "+Ee+" and dilations '"+Se+"'"}),_(Be.rank===4,function(){return"Error in maxPoolBackprop: dy must be rank 4 but got rank "+Be.rank+"."}),_(je.rank===4,function(){return"Error in maxPoolBackprop: input must be rank 4 but got rank "+je.rank+"."}),ze!=null&&_(me(Me),function(){return"Error in maxPoolBackprop: pad must be an integer when using, dimRoundingMode "+ze+" but got pad "+Me+"."});var Ze=to(je.shape,we,Ee,Se,Me,ze);return Ve.runKernelFunc(function(Je){return Je.maxPoolBackprop(Be,je,Ue,Ze)},{$dy:Be,$input:je})}(L,oe,ue,r,e,t,o)}}},"MaxPool",f,C);return u?k.as3D(k.shape[1],k.shape[2],k.shape[3]):k}function pl(n,r,e,t,o,a){var i=Oe(n,"x","avgPool","float32");t==null&&(t=[1,1]),_(Zr(e,t),function(){return"Error in avgPool: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+t+"'"});var s=i,u=!1;i.rank===3&&(u=!0,s=i.as4D(1,i.shape[0],i.shape[1],i.shape[2])),_(s.rank===4,function(){return"Error in avgPool: x must be rank 4 but got rank "+s.rank+"."}),a!=null&&_(me(o),function(){return"Error in avgPool: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+o+"."});var f=to(s.shape,r,e,t,o,a);if(f.filterWidth===1&&f.filterHeight===1&&_e(f.inShape,f.outShape))return i.clone();var C=Ve.runKernelFunc(function(k){return k.avgPool(s,f)},{x:s},function(k){return{x:function(){return function(L,X,oe,ue,se,ce){var xe=Oe(L,"dy","avgPoolBackprop"),we=Oe(X,"input","avgPoolBackprop");_(we.rank===xe.rank,function(){return"Rank of input ("+we.rank+") does not match rank of dy ("+xe.rank+")"}),se==null&&(se=[1,1]),_(Zr(ue,se),function(){return"Error in avgPoolBackprop: Either strides or dilations must be 1. Got strides "+ue+" and dilations '"+se+"'"});var Ee=we,Se=xe,Me=!1;we.rank===3&&(Me=!0,Ee=we.as4D(1,we.shape[0],we.shape[1],we.shape[2]),Se=xe.as4D(1,xe.shape[0],xe.shape[1],xe.shape[2])),_(Se.rank===4,function(){return"Error in avgPoolBackprop: dy must be rank 4 but got rank "+Se.rank+"."}),_(Ee.rank===4,function(){return"Error in avgPoolBackprop: input must be rank 4 but got rank "+Ee.rank+"."});var ze=to(Ee.shape,oe,ue,se,ce),Be=Ve.runKernelFunc(function(je){return je.avgPoolBackprop(Se,Ee,ze)},{dy4D:Se,input4D:Ee});return Me?Be.as3D(Be.shape[1],Be.shape[2],Be.shape[3]):Be}(k,s,r,e,t,o)}}},"AvgPool",f);return C=C.cast(i.dtype),u?C.as3D(C.shape[1],C.shape[2],C.shape[3]):C}var ml=Xe({maxPool_:function(n,r,e,t,o){return hl(n,r,e,1,t,o)}}),vl=Xe({avgPool_:function(n,r,e,t,o){return pl(n,r,e,1,t,o)}}),bh=Xe({pool_:function(n,r,e,t,o,a){o==null&&(o=[1,1]),a==null&&(a=1),t===0&&(t="valid");var i=Oe(n,"x","maxPool"),s=i,u=!1;i.rank===3&&(u=!0,s=i.as4D(1,i.shape[0],i.shape[1],i.shape[2])),_(Zr(a,o),function(){return"Error in pool: Either strides or dilations must be 1. Got strides "+a+" and dilations '"+o+"'"});var f,C=to(s.shape,r,a,o,t),k=[C.dilationHeight,C.dilationWidth];f=t==="same"?function(Ee,Se){var Me=Ee.map(function(je,Ue){return je+(je-1)*(Se[Ue]-1)}).map(function(je){return je-1}),ze=Me.map(function(je){return Math.floor(je/2)}),Be=Me.map(function(je,Ue){return je-ze[Ue]});return Me.map(function(je,Ue){return[ze[Ue],Be[Ue]]})}([C.filterHeight,C.filterWidth],k):[[0,0],[0,0]];var L=k[0]===1&&k[1]===1,X=function(Ee,Se,Me){var ze=Me.map(function(ft){return ft[0]}),Be=Me.map(function(ft){return ft[1]}),je=Ee.concat(ze,Be),Ue=Se.map(function(ft,ut){return(ft-je[ut]%ft)%ft}),Ze=Be.map(function(ft,ut){return ft+Ue[ut]}),Je=Se.map(function(ft,ut){return[ze[ut],Ze[ut]]}),ht=Se.map(function(ft,ut){return[0,Ue[ut]]});return[Je,ht]}([C.inHeight,C.inWidth],k,f),oe=X[0],ue=X[1],se=L?t:"valid",ce=L?s:Gi(s,k,oe),xe=(e==="avg"?function(){return pl(ce,r,a,1,se)}:function(){return hl(ce,r,a,1,se)})(),we=L?xe:va(xe,k,ue);return u?we.as3D(we.shape[1],we.shape[2],we.shape[3]):we}}),xh=Xe({maxPool3d_:function(n,r,e,t,o,a,i){a===void 0&&(a="NDHWC");var s=Oe(n,"x","maxPool3d"),u=s,f=!1;s.rank===4&&(f=!0,u=s.as5D(1,s.shape[0],s.shape[1],s.shape[2],s.shape[3])),i==null&&(i=[1,1,1]),_(u.rank===5,function(){return"Error in maxPool3d: x must be rank 5 but got rank "+u.rank+"."}),_(a==="NDHWC",function(){return"Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of "+a}),_(Zr(e,i),function(){return"Error in maxPool3d: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+i+"'"}),o!=null&&_(me(t),function(){return"Error in maxPool3d: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+t+"."});var C=Go(u.shape,r,e,i,t,o,a),k=Ve.runKernelFunc(function(L,X){var oe=L.maxPool3d(u,C);return X([u,oe]),oe},{x:u},function(L,X){var oe=X[0],ue=X[1];return{x:function(){return function(se,ce,xe,we,Ee,Se,Me,ze){var Be=Oe(se,"dy","maxPool3dBackprop"),je=Oe(ce,"input","maxPool3dBackprop"),Ue=Oe(xe,"output","maxPool3dBackprop"),Ze=Be,Je=je,ht=Ue,ft=!1;je.rank===4&&(ft=!0,Ze=Be.as5D(1,Be.shape[0],Be.shape[1],Be.shape[2],Be.shape[3]),Je=je.as5D(1,je.shape[0],je.shape[1],je.shape[2],je.shape[3]),ht=Ue.as5D(1,Ue.shape[0],Ue.shape[1],Ue.shape[2],Ue.shape[3])),_(Ze.rank===5,function(){return"Error in maxPool3dBackprop: dy must be rank 5 but got rank "+Ze.rank+"."}),_(Je.rank===5,function(){return"Error in maxPool3dBackprop: input must be rank 5 but got rank "+Je.rank+"."}),_(ht.rank===5,function(){return"Error in maxPool3dBackprop: output must be rank 5 but got rank "+ht.rank+"."}),Se==null&&(Se=[1,1,1]),_(Zr(Ee,Se),function(){return"Error in maxPool3dBackprop: Either strides or dilations must be 1. Got strides "+Ee+" and dilations '"+Se+"'"}),ze!=null&&_(me(Me),function(){return"Error in maxPool3dBackprop: pad must be an integer when using, dimRoundingMode "+ze+" but got pad "+Me+"."});var ut=Go(Je.shape,we,Ee,Se,Me,ze),vt=Ve.runKernelFunc(function(mt){return mt.maxPool3dBackprop(Ze,Je,ht,ut)},{dy5D:Ze,input5D:Je});return ft?vt.as4D(vt.shape[1],vt.shape[2],vt.shape[3],vt.shape[4]):vt}(L,oe,ue,r,e,i,t,o)}}});return f?k.as4D(k.shape[1],k.shape[2],k.shape[3],k.shape[4]):k}}),wh=Xe({avgPool3d_:function(n,r,e,t,o,a,i){a===void 0&&(a="NDHWC");var s=Oe(n,"x","avgPool3d","float32"),u=s,f=!1;s.rank===4&&(f=!0,u=s.as5D(1,s.shape[0],s.shape[1],s.shape[2],s.shape[3])),i==null&&(i=[1,1,1]),_(u.rank===5,function(){return"Error in avgPool3d: x must be rank 5 but got rank "+u.rank+"."}),_(a==="NDHWC",function(){return"Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of "+a}),_(Zr(e,i),function(){return"Error in avgPool3d: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+i+"'"}),o!=null&&_(me(t),function(){return"Error in avgPool3d: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+t+"."});var C=Go(u.shape,r,e,i,t,o,a),k=Ve.runKernelFunc(function(L){return L.avgPool3d(u,C)},{x:u},function(L){return{x:function(){return function(X,oe,ue,se,ce,xe,we){var Ee=Oe(X,"dy","avgPool3dBackprop"),Se=Oe(oe,"input","avgPool3dBackprop"),Me=Ee,ze=Se,Be=!1;Se.rank===4&&(Be=!0,Me=Ee.as5D(1,Ee.shape[0],Ee.shape[1],Ee.shape[2],Ee.shape[3]),ze=Se.as5D(1,Se.shape[0],Se.shape[1],Se.shape[2],Se.shape[3])),_(Me.rank===5,function(){return"Error in avgPool3dBackprop: dy must be rank 5 but got rank "+Me.rank+"."}),_(ze.rank===5,function(){return"Error in avgPool3dBackprop: input must be rank 5 but got rank "+ze.rank+"."}),ce==null&&(ce=[1,1,1]),_(Zr(se,ce),function(){return"Error in avgPool3dBackprop: Either strides or dilations must be 1. Got strides "+se+" and dilations '"+ce+"'"}),we!=null&&_(me(xe),function(){return"Error in maxPool3dBackprop: pad must be an integer when using, dimRoundingMode "+we+" but got pad "+xe+"."});var je=Go(ze.shape,ue,se,ce,xe,we),Ue=Ve.runKernelFunc(function(Ze){return Ze.avgPool3dBackprop(Me,ze,je)},{dy5D:Me,input5D:ze});return Be?Ue.as4D(Ue.shape[1],Ue.shape[2],Ue.shape[3],Ue.shape[4]):Ue}(L,u,r,e,i,t,o)}}});return k=k.cast(u.dtype),f?k.as4D(k.shape[1],k.shape[2],k.shape[3],k.shape[4]):k}}),no=Xe({slice_:function(n,r,e){var t,o,a=Oe(n,"x","slice");if(a.rank===0)throw new Error("Slicing scalar is not possible");(t=typeof r=="number"?[r].concat(new Array(a.rank-1).fill(0)):r.length<a.rank?r.concat(new Array(a.rank-r.length).fill(0)):r.slice()).forEach(function(u){_(u!==-1,function(){return"slice() does not support negative begin indexing."})}),o=(o=e==null?new Array(a.rank).fill(-1):typeof e=="number"?[e].concat(new Array(a.rank-1).fill(-1)):e.length<a.rank?e.concat(new Array(a.rank-e.length).fill(-1)):e).map(function(u,f){return u>=0?u:(_(u===-1,function(){return"Negative size values should be exactly -1 but got "+u+" for the slice() size at index "+f+"."}),a.shape[f]-t[f])}),Ys(a,t,o);var i=a.shape,s={begin:t,size:o};return Ve.runKernelFunc(function(u){return u.slice(a,t,o)},{x:a},function(u){for(var f=[],C=0;C<u.rank;C++)f.push([t[C],i[C]-t[C]-o[C]]);return{x:function(){return u.pad(f)}}},"Slice",s)}}),Eh=Xe({slice1d_:function(n,r,e){var t=Oe(n,"x","slice1d");return _(t.rank===1,function(){return"slice1d expects a rank-1 tensor, but got a rank-"+t.rank+" tensor"}),no(t,[r],[e])}}),_h=Xe({slice2d_:function(n,r,e){var t=Oe(n,"x","slice2d");return _(t.rank===2,function(){return"slice2d expects a rank-2 tensor, but got a rank-"+t.rank+" tensor"}),no(t,r,e)}}),gl=Xe({slice3d_:function(n,r,e){var t=Oe(n,"x","slice3d");return _(t.rank===3,function(){return"slice3d expects a rank-3 tensor, but got a rank-"+t.rank+" tensor"}),no(t,r,e)}}),Ch=Xe({slice4d_:function(n,r,e){var t=Oe(n,"x","slice4d");return _(t.rank===4,function(){return"slice4d expects a rank-4 tensor, but got a rank-"+t.rank+" tensor"}),no(t,r,e)}});function yl(n,r,e,t,o){return r.rank<e.rank&&(r=r.reshape(Vr(r.shape,t))),n.rank<e.rank&&(n=n.reshape(Vr(n.shape,t))),{x:function(){var a=n.mul(e.equal(r).cast(n.dtype));return o==null?a:a.transpose(o)}}}var Th=Xe({all_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=Oe(n,"x","all","bool"),o=de(r,t.shape),a=o,i=sn(a,t.rank);i!=null&&(t=t.transpose(i),a=fn(a.length,t.rank));var s=Ve.runKernelFunc(function(f){return f.all(t,a)},{$x:t});if(e){var u=Vr(s.shape,o);return s.reshape(u)}return s}}),Sh=Xe({any_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=Oe(n,"x","any","bool"),o=de(r,t.shape),a=o,i=sn(a,t.rank);i!=null&&(t=t.transpose(i),a=fn(a.length,t.rank));var s=Ve.runKernelFunc(function(f){return f.any(t,a)},{$x:t});if(e){var u=Vr(s.shape,o);return s.reshape(u)}return s}}),Ah=Xe({argMax_:function(n,r){r===void 0&&(r=0);var e=Oe(n,"x","argMax");r==null&&(r=0);var t=de(r,e.shape),o=sn(t,e.rank);o!=null&&(e=e.transpose(o),t=fn(t.length,e.rank));var a={axis:t[0]},i=[e];return Ve.runKernelFunc(function(s,u){var f=s.argMax(e,t[0]);return u([e]),f},{x:e},function(s,u){var f=u[0];return{x:function(){return Jt(f)}}},"ArgMax",a,i)}}),Oh=Xe({argMin_:function(n,r){r===void 0&&(r=0);var e=Oe(n,"x","argMin");r==null&&(r=0);var t=de(r,e.shape),o=sn(t,e.rank);return o!=null&&(e=e.transpose(o),t=fn(t.length,e.rank)),Ve.runKernelFunc(function(a,i){var s=a.argMin(e,t[0]);return i([e]),s},{$x:e},function(a,i){var s=i[0];return{$x:function(){return Jt(s)}}})}}),Rh=Xe({logSumExp_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=Oe(n,"x","logSumExp"),o=de(r,t.shape),a=t.max(o,!0),i=t.sub(a).exp().sum(o).log(),s=a.reshape(i.shape).add(i);if(e){var u=Vr(s.shape,o);return s.reshape(u)}return s}}),bl=Xe({max_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=Oe(n,"x","max"),o=t,a=de(r,t.shape),i=a,s=sn(i,t.rank);s!=null&&(t=t.transpose(s),i=fn(i.length,t.rank));var u=[t],f=Ve.runKernelFunc(function(k,L){var X=k.max(t,i);return L([o,X]),X},{x:t},function(k,L){return yl(k,L[1],L[0],a,s)},"Max",{axes:i},u,[!0]);if(e){var C=Vr(f.shape,a);f=f.reshape(C)}return f}}),Ih=Xe({mean_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=Oe(n,"x","mean"),o=de(r,t.shape),a=le(Gr(t.shape,o)[1]);return _o(function(i){var s=Nt(a);return{value:(s.dtype===i.dtype?i:i.cast(s.dtype)).div(s).sum(r,e),gradFunc:function(u){var f=i.shape.slice();return o.forEach(function(C){f[C]=1}),u.reshape(f).mul(Mn(i.shape,"float32")).div(a)}}})(t)}}),Nh=Xe({min_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=Oe(n,"x","min"),o=t,a=de(r,t.shape),i=a,s=sn(i,t.rank);s!=null&&(t=t.transpose(s),i=fn(i.length,t.rank));var u=[t],f=Ve.runKernelFunc(function(k,L){var X=k.min(t,i);return L([o,X]),X},{x:t},function(k,L){return yl(k,L[1],L[0],a,s)},"Min",{axes:i},u,[!0]);if(e){var C=Vr(f.shape,a);f=f.reshape(C)}return f}}),Dh=Xe({moments_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=de(r,(n=Oe(n,"x","moments")).shape),o=n.mean(t,e),a=o.shape;e||(a=Vr(o.shape,t));var i=n.toFloat().sub(o.reshape(a)).square();return{mean:o,variance:i.mean(t,e)}}}),xl=Xe({sum_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=Oe(n,"x","sum");t.dtype==="bool"&&(t=t.toInt());var o=de(r,t.shape);return _o(function(a){var i=sn(o,a.rank),s=o,u=a;i!=null&&(u=a.transpose(i),s=fn(s.length,a.rank));var f=function(X){var oe=a.shape.slice();return o.forEach(function(ue){oe[ue]=1}),X.reshape(oe).mul(Mn(a.shape,"float32"))},C={axes:s},k=Ve.runKernelFunc(function(X){return X.sum(u,s)},{x:u},function(X){return{x:function(){return f(X)}}},"Sum",C);if(e){var L=Vr(k.shape,o);k=k.reshape(L)}return{value:k,gradFunc:f}})(t)}}),kh=Xe({prod_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=Oe(n,"x","prod");t.dtype==="bool"&&(t=t.toInt());var o=de(r,t.shape),a=sn(o,t.rank),i=o,s=t;a!=null&&(s=t.transpose(a),i=fn(i.length,t.rank));var u=Ve.runKernelFunc(function(C){return C.prod(s,i)},{permutedX:s});if(e){var f=Vr(u.shape,o);u=u.reshape(f)}return u}}),wl=Xe({elu_:function(n){var r=Oe(n,"x","elu");return Ve.runKernelFunc(function(e,t){var o=e.elu(r);return t([o]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return Ve.runKernelFunc(function(a){return a.eluDer(e,o)},{dy:e,y:o})}}})}}),Mh=Xe({leakyRelu_:function(n,r){r===void 0&&(r=.2);var e=Oe(n,"x","leakyRelu");return pu(Nt(r).mul(e),e)}}),El=Xe({prelu_:function(n,r){var e=Oe(n,"x","prelu"),t=Oe(r,"alpha","prelu");return Ve.runKernelFunc(function(o,a){var i=o.prelu(e,t);return a([e,t]),i},{x:e,alpha:t},function(o,a){var i=a[0],s=a[1],u=i.greater(0);return{x:function(){return Jo(u,o,o.mul(s))},alpha:function(){var f=Jo(u,Jt(o),o.mul(i)),C=Ir(s.shape,o.shape);return C.length>0&&(f=f.sum(C)),f.reshape(s.shape)}}},"Prelu")}}),bu=Xe({relu_:function(n){var r=Oe(n,"x","relu");return r.dtype==="bool"?r.toInt():Ve.runKernelFunc(function(e,t){var o=e.relu(r);return t([r]),o},{x:r},function(e,t){var o=t[0];return{x:function(){return e.mulStrict(o.step().toFloat())}}},"Relu")}}),_l=Xe({relu6_:function(n){var r=Oe(n,"x","relu6");return r.dtype==="bool"?r.toInt():Ve.runKernelFunc(function(e,t){var o=e.relu6(r);return t([r]),o},{x:r},function(e,t){var o=t[0],a=o.lessEqual(6).mul(o.step());return{x:function(){return e.mulStrict(a.toFloat())}}},"Relu6")}}),Ph=Xe({selu_:function(n){var r=Oe(n,"x","selu");return Ve.runKernelFunc(function(e,t){var o=e.selu(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){var a=o.greater(Nt(0)),i=Nt(du),s=Nt(fu),u=e.mul(s),f=e.mul(i).mul(o.toFloat().exp());return Jo(a,u,f)}}})}}),Cl=Xe({transpose_:function(n,r){var e=Oe(n,"x","transpose");if(r==null&&(r=e.shape.map(function(o,a){return a}).reverse()),_(e.rank===r.length,function(){return"Error in transpose: rank of input "+e.rank+" must match length of perm "+r+"."}),r.forEach(function(o){_(o>=0&&o<e.rank,function(){return"All entries in 'perm' must be between 0 and "+(e.rank-1)+" but got "+r})}),e.rank<=1)return e.clone();var t={perm:r};return Ve.runKernelFunc(function(o){return o.transpose(e,r)},{x:e},function(o){var a=bo(r);return{x:function(){return o.transpose(a)}}},"Transpose",t)}}),Fh=Xe({localResponseNormalization_:function(n,r,e,t,o){r===void 0&&(r=5),e===void 0&&(e=1),t===void 0&&(t=1),o===void 0&&(o=.5);var a=Oe(n,"x","localResponseNormalization");_(a.rank===4||a.rank===3,function(){return`Error in localResponseNormalization: x must be rank 3 or 4 but got
rank `+a.rank+"."}),_(me(r),function(){return"Error in localResponseNormalization: depthRadius must be an integer but got depthRadius "+r+"."});var i=a,s=!1;a.rank===3&&(s=!0,i=a.as4D(1,a.shape[0],a.shape[1],a.shape[2]));var u=Ve.runKernelFunc(function(f,C){var k=f.localResponseNormalization4D(i,r,e,t,o);return C([i,k]),k},{x4D:i},function(f,C){var k=C[0],L=C[1];return{x4D:function(){return Ve.runKernelFunc(function(X){return X.LRNGrad(f,k,L,r,e,t,o)},{})}}});return s?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),Tl=Xe({norm_:function(n,r,e,t){r===void 0&&(r="euclidean"),e===void 0&&(e=null),t===void 0&&(t=!1);var o=function s(u,f,C){if(C===void 0&&(C=null),u.rank===0)return u.abs();if(u.rank!==1&&C===null)return s(u.reshape([-1]),f,C);if(u.rank===1||typeof C=="number"||Array.isArray(C)&&C.length===1){if(f===1)return u.abs().sum(C);if(f===1/0)return u.abs().max(C);if(f===-1/0)return u.abs().min(C);if(f==="euclidean"||f===2)return u.abs().pow(Nt(2,"int32")).sum(C).sqrt();throw new Error("Error in norm: invalid ord value: "+f)}if(Array.isArray(C)&&C.length===2){if(f===1)return u.abs().sum(C[0]).max(C[1]-1);if(f===1/0)return u.abs().sum(C[1]).max(C[0]);if(f===-1/0)return u.abs().sum(C[1]).min(C[0]);if(f==="fro"||f==="euclidean")return u.square().sum(C).sqrt();throw new Error("Error in norm: invalid ord value: "+f)}throw new Error("Error in norm: invalid axis: "+C)}(n=Oe(n,"x","norm"),r,e),a=o.shape;if(t){var i=de(e,n.shape);a=Vr(o.shape,i)}return o.reshape(a)}}),Lh=Xe({basicLSTMCell_:function(n,r,e,t,o,a){var i=Oe(n,"forgetBias","basicLSTMCell"),s=Oe(r,"lstmKernel","basicLSTMCell"),u=Oe(e,"lstmBias","basicLSTMCell"),f=Oe(t,"data","basicLSTMCell"),C=Oe(o,"c","basicLSTMCell"),k=Oe(a,"h","basicLSTMCell"),L=f.concat(k,1).matMul(s).add(u),X=L.shape[0],oe=L.shape[1]/4,ue=[X,oe],se=L.slice([0,0],ue),ce=L.slice([0,oe],ue),xe=L.slice([0,2*oe],ue),we=L.slice([0,3*oe],ue),Ee=se.sigmoid().mulStrict(ce.tanh()).addStrict(C.mulStrict(i.add(xe).sigmoid())),Se=Ee.tanh().mulStrict(we.sigmoid());return[Ee,Se]}}),jh=Xe({multiRNNCell_:function(n,r,e,t){for(var o=Oe(r,"data","multiRNNCell"),a=yo(e,"c","multiRNNCell"),i=yo(t,"h","multiRNNCell"),s=o,u=[],f=0;f<n.length;f++){var C=n[f](s,a[f],i[f]);u.push(C[0]),u.push(C[1]),s=C[1]}var k=[],L=[];for(f=0;f<u.length;f+=2)k.push(u[f]),L.push(u[f+1]);return[k,L]}}),Bh=Xe({movingAverage_:function(n,r,e,t,o){o===void 0&&(o=!0);var a=Oe(n,"v","movingAverage"),i=Oe(r,"x","movingAverage"),s=Oe(e,"decay","movingAverage");nn(a,i),_(_e(a.shape,i.shape),function(){return"Shape mismatch in v and x"});var u=Nt(1),f=u.sub(s),C=i.sub(a).mul(f);if(o){_(t!=null,function(){return"When using zeroDebias: true, step is required."});var k=Oe(t,"step","movingAverage");C=C.div(u.sub(hs(s,k)))}return a.add(C)}}),Uh=Xe({stridedSlice_:function(n,r,e,t,o,a,i,s,u){if(o===void 0&&(o=0),a===void 0&&(a=0),i===void 0&&(i=0),s===void 0&&(s=0),u===void 0&&(u=0),t==null&&(t=new Array(r.length)),i!==0)throw new Error("ellipsis mask is not yet supported");var f=Oe(n,"x","stridedSlice"),C=Yi(s),k=f.shape.slice();C.forEach(function(se){r[se]=0,e[se]=1,k.splice(se,0,1)}),f=f.reshape(k);for(var L=0;L<f.rank;L++)r[L]=$s(o,r,t,f.shape,L),e[L]=$i(a,e,t,f.shape,L),t[L]=t[L]||1;var X=Yi(u);X.forEach(function(se){e[se]=r[se]+1,t[se]=1});var oe=Ea(r,e,t),ue=oe.filter(function(se,ce){return X.indexOf(ce)===-1});return t.every(function(se){return se===1})?no(f,r,oe).reshape(ue):Ve.runKernelFunc(function(se){return se.stridedSlice(f,r,e,t)},{$x:f}).reshape(ue)}}),Wh=Xe({topk_:function(n,r,e){r===void 0&&(r=1),e===void 0&&(e=!0);var t=Oe(n,"x","topk");if(t.rank===0)throw new Error("topk() expects the input to be of rank 1 or higher");var o=t.shape[t.shape.length-1];if(r>o)throw new Error("'k' passed to topk() must be <= the last dimension ("+o+") but got "+r);var a=Ve.runKernelFunc(function(i){return i.topk(t,r,e)},{$x:t});return{values:a[0],indices:a[1]}}}),Hh=Xe({scatterND_:function(n,r,e){var t=Oe(n,"indices","scatterND","int32"),o=Oe(r,"updates","scatterND");return Ks(o,t,e),Ve.runKernelFunc(function(a){return a.scatterND(t,o,e)},{indices:t,updates:o},null,"ScatterNd",{shape:e})}}),xu=Xe({fft_:function(n){_(n.dtype==="complex64",function(){return"The dtype for tf.spectral.fft() must be complex64 but got "+n.dtype+"."});var r=n.shape[n.shape.length-1],e=n.size/r,t=n.as2D(e,r);return Ve.runKernelFunc(function(o){return o.fft(t)},{input:n}).reshape(n.shape)}}),ms=Xe({ifft_:function(n){_(n.dtype==="complex64",function(){return"The dtype for tf.spectral.ifft() must be complex64 but got "+n.dtype+"."});var r=n.shape[n.shape.length-1],e=n.size/r,t=n.as2D(e,r);return Ve.runKernelFunc(function(o){return o.ifft(t)},{input:n}).reshape(n.shape)}}),wu=Xe({rfft_:function(n,r){_(n.dtype==="float32",function(){return"The dtype for rfft() must be real value but got "+n.dtype});var e,t=n.shape[n.shape.length-1],o=n.size/t;if(r!=null&&r<t){var a=n.shape.map(function(ce){return 0}),i=n.shape.map(function(ce){return ce});i[n.shape.length-1]=r,e=n.slice(a,i),t=r}else if(r!=null&&r>t){var s=n.shape.map(function(ce){return ce});s[n.shape.length-1]=r-t,e=n.concat(Tr(s),n.shape.length-1),t=r}else e=n;var u=e.zerosLike(),f=xr(e,u).as2D(o,t),C=xu(f),k=Math.floor(t/2)+1,L=un(C),X=xn(C),oe=L.split([k,t-k],L.shape.length-1),ue=X.split([k,t-k],X.shape.length-1),se=e.shape.slice();return se[e.shape.length-1]=k,xr(oe[0],ue[0]).reshape(se)}}),Sl=Xe({irfft_:function(n){var r=n.shape[n.shape.length-1],e=n.size/r;if(r<=2){var t=n.as2D(e,r),o=ms(t);return un(o)}var a=[e,2*(r-1)],i=un(n).as2D(e,r),s=xn(n).as2D(e,r),u=i.slice([0,1],[e,r-2]).reverse(1),f=s.slice([0,1],[e,r-2]).reverse(1).mul(Nt(-1)),C=i.concat(u,1),k=s.concat(f,1);return t=xr(C,k).as2D(a[0],a[1]),o=ms(t),un(o)}}),zh=Object.freeze({fft:xu,ifft:ms,rfft:wu,irfft:Sl}),Gh=Xe({sparseToDense_:function(n,r,e,t){t===void 0&&(t=0);var o=Oe(n,"sparseIndices","sparseToDense","int32"),a=Oe(r,"sparseValues","sparseToDense"),i=Oe(t,"defaultValue","sparseToDense",a.dtype);return function(s,u,f,C){if(s.dtype!=="int32")throw new Error("tf.sparseToDense() expects the indices to be int32 type, but the dtype was "+s.dtype+".");if(s.rank>2)throw new Error("sparseIndices should be a scalar, vector, or matrix, but got shape "+s.shape+".");var k=s.rank>0?s.shape[0]:1,L=s.rank>1?s.shape[1]:1;if(f.length!==L)throw new Error("outputShape has incorrect number of elements:, "+f.length+", should be: "+L+".");var X=u.size;if(u.rank!==0&&(u.rank!==1||X!==k))throw new Error("sparseValues has incorrect shape "+u.shape+", should be [] or ["+k+"]");if(u.dtype!==C.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}(o,a,e,i),Ve.runKernelFunc(function(s){return s.sparseToDense(o,a,e,i)},{$sparseIndices:o,$sparseValues:a,$defaultValue:i})}}),Vh=Xe({gatherND_:function(n,r){var e=Oe(r,"indices","gatherND","int32"),t=Oe(n,"x","gatherND");return Ve.runKernelFunc(function(o){return o.gatherND(t,e)},{x:t,indices:e},null,"GatherNd")}}),Xh=Xe({diag_:function(n){var r=Oe(n,"x","diag").flatten(),e=n.shape.concat(n.shape);return Ve.runKernelFunc(function(t){return t.diag(r)},{$x:r}).reshape(e)}}),Kh=Xe({dropout_:function(n,r,e,t){var o=Oe(n,"x","dropout");if(_(o.dtype==="float32",function(){return"x has to be a floating point tensor since it's going to be scaled, but got a "+o.dtype+" tensor instead."}),_(r>=0&&r<1,function(){return"rate must be a float in the range [0, 1), but got "+r+"."}),r===0)return n instanceof Dr?o.clone():o;var a=function(u,f){if(f==null)return u.shape.slice();if(_e(u.shape,f))return f;if(u.shape.length===f.length){for(var C=[],k=0;k<u.shape.length;k++)f[k]==null&&u.shape[k]!=null?C.push(u.shape[k]):C.push(f[k]);return C}return f}(o,e),i=1-r,s=oi(a,0,1,"float32",t).add(i).floor().div(i);return o.mul(s)}});function Al(n,r,e){for(var t=1-n%2,o=new Float32Array(n),a=0;a<n;++a){var i=2*Math.PI*a/(n+t-1);o[a]=r-e*Math.cos(i)}return Qn(o,"float32")}var Eu=Xe({hannWindow_:function(n){return Al(n,.5,.5)}}),Ol=Xe({hammingWindow_:function(n){return Al(n,.54,.46)}}),_u=Xe({frame_:function(n,r,e,t,o){t===void 0&&(t=!1),o===void 0&&(o=0);for(var a=0,i=[];a+r<=n.size;)i.push(no(n,a,r)),a+=e;if(t)for(;a<n.size;){var s=a+r-n.size,u=hn([no(n,a,r-s),ei([s],o)]);i.push(u),a+=e}return i.length===0?Zn([],[0,r]):hn(i).as2D(i.length,r)}}),Rl=Xe({stft_:function(n,r,e,t,o){var a;o===void 0&&(o=Eu),t==null&&(a=r,t=Math.floor(Math.pow(2,Math.ceil(Math.log(a)/Math.log(2)))));for(var i=_u(n,r,e),s=Qo(i,o(r)),u=[],f=0;f<i.shape[0];f++)u.push(wu(s.slice([f,0],[1,r]),t));return hn(u)}}),Yh=Object.freeze({hannWindow:Eu,hammingWindow:Ol,frame:_u,stft:Rl}),rn,$h=function(n,r,e){return e===void 0&&(e=1),E(this,void 0,void 0,function(){var t,o,a,i,s,u,f,C,k,L,X,oe,ue,se;return g(this,function(ce){switch(ce.label){case 0:return t=Oe(n,"predictions","inTopK"),o=Oe(r,"targets","inTopK"),_(t.rank>1,function(){return"inTopK() expects the predictions to be of rank 2 or higher, but got "+t.rank}),_(t.rank-1===o.rank,function(){return"predictions rank should be 1 larger than targets rank, but got predictions rank "+t.rank+" and targets rank "+o.rank}),Y(t.shape.slice(0,t.shape.length-1),o.shape,"predictions's shape should be align with the targets' shape, except the last dimension."),a=t.shape[t.shape.length-1],_(e>0&&e<=a,function(){return"'k' passed to inTopK() must be > 0 && <= the predictions last dimension ("+a+"), but got "+e}),[4,t.data()];case 1:return i=ce.sent(),[4,o.data()];case 2:for(s=ce.sent(),u=[i.length/a,a],C=u[1],k=Ce("bool",f=u[0]),L=0;L<f;L++){for(X=L*C,oe=i.subarray(X,X+C),ue=[],se=0;se<oe.length;se++)ue.push({value:oe[se],index:se});for(ue.sort(function(xe,we){return we.value-xe.value}),k[L]=0,se=0;se<e;se++)if(ue[se].index===s[L]){k[L]=1;break}}return n!==t&&t.dispose(),r!==o&&o.dispose(),[2,Ur(k,o.shape,"bool")]}})})};!function(n){n[n.NONE=0]="NONE",n[n.MEAN=1]="MEAN",n[n.SUM=2]="SUM",n[n.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"}(rn||(rn={}));var Jh=Xe({absoluteDifference_:function(n,r,e,t){t===void 0&&(t=rn.SUM_BY_NONZERO_WEIGHTS);var o=Oe(n,"labels","absoluteDifference"),a=Oe(r,"predictions","absoluteDifference"),i=null;e!=null&&(i=Oe(e,"weights","absoluteDifference")),Y(o.shape,a.shape,"Error in absoluteDifference: ");var s=o.sub(a).abs();return oo(s,i,t)}}),oo=Xe({computeWeightedLoss_:function(n,r,e){e===void 0&&(e=rn.SUM_BY_NONZERO_WEIGHTS);var t=Oe(n,"losses","computeWeightedLoss"),o=null;r!=null&&(o=Oe(r,"weights","computeWeightedLoss"));var a=o==null?t:t.mul(o);if(e===rn.NONE)return a;if(e===rn.SUM)return a.sum();if(e===rn.MEAN){if(o==null)return a.mean();var i=t.size/o.size,s=a.sum().div(o.sum());return i>1?s.div(Nt(i)):s}if(e===rn.SUM_BY_NONZERO_WEIGHTS){if(o==null)return a.sum().div(Nt(t.size));var u=o.mul(Mn(t.shape)).notEqual(Nt(0)).sum().toFloat();return a.sum().div(u)}throw Error("Unknown reduction: "+e)}}),qh=Xe({cosineDistance_:function(n,r,e,t,o){o===void 0&&(o=rn.SUM_BY_NONZERO_WEIGHTS);var a=Oe(n,"labels","cosineDistance"),i=Oe(r,"predictions","cosineDistance"),s=null;t!=null&&(s=Oe(t,"weights","cosineDistance")),Y(a.shape,i.shape,"Error in cosineDistance: ");var u=Nt(1).sub(a.mul(i).sum(e,!0));return oo(u,s,o)}}),Qh=Xe({hingeLoss_:function(n,r,e,t){t===void 0&&(t=rn.SUM_BY_NONZERO_WEIGHTS);var o=Oe(n,"labels","hingeLoss"),a=Oe(r,"predictions","hingeLoss"),i=null;e!=null&&(i=Oe(e,"weights","hingeLoss")),Y(o.shape,a.shape,"Error in hingeLoss: ");var s=Nt(1);o=Nt(2).mul(o).sub(s);var u=s.sub(o.mul(a)).relu();return oo(u,i,t)}}),Zh=Xe({huberLoss_:function(n,r,e,t,o){t===void 0&&(t=1),o===void 0&&(o=rn.SUM_BY_NONZERO_WEIGHTS);var a=Oe(n,"labels","huberLoss"),i=Oe(r,"predictions","huberLoss"),s=null;e!=null&&(s=Oe(e,"weights","huberLoss")),Y(a.shape,i.shape,"Error in huberLoss: ");var u=Nt(t),f=i.sub(a).abs(),C=tl(f,u),k=f.sub(C),L=Nt(.5).mul(C.square()).add(u.mul(k));return oo(L,s,o)}}),ep=Xe({logLoss_:function(n,r,e,t,o){t===void 0&&(t=1e-7),o===void 0&&(o=rn.SUM_BY_NONZERO_WEIGHTS);var a=Oe(n,"labels","logLoss"),i=Oe(r,"predictions","logLoss"),s=null;e!=null&&(s=Oe(e,"weights","logLoss")),Y(a.shape,i.shape,"Error in logLoss: ");var u=Nt(1),f=Nt(t),C=a.mul(i.add(f).log()).neg().sub(u.sub(a).mul(u.sub(i).add(f).log()));return oo(C,s,o)}}),tp=Xe({meanSquaredError_:function(n,r,e,t){t===void 0&&(t=rn.SUM_BY_NONZERO_WEIGHTS);var o=Oe(n,"labels","meanSquaredError"),a=Oe(r,"predictions","meanSquaredError"),i=null;e!=null&&(i=Oe(e,"weights","meanSquaredError")),Y(o.shape,a.shape,"Error in meanSquaredError: ");var s=o.squaredDifference(a);return oo(s,i,t)}}),rp=Xe({sigmoidCrossEntropy_:function(n,r,e,t,o){t===void 0&&(t=0),o===void 0&&(o=rn.SUM_BY_NONZERO_WEIGHTS);var a=Oe(n,"multiClassLabels","sigmoidCrossEntropy"),i=Oe(r,"logits","sigmoidCrossEntropy"),s=null;if(e!=null&&(s=Oe(e,"weights","sigmoidCrossEntropy")),Y(a.shape,i.shape,"Error in sigmoidCrossEntropy: "),t>0){var u=Nt(t),f=Nt(1),C=Nt(.5);a=a.mul(f.sub(u)).add(C.mul(u))}var k=function(L,X){var oe=Oe(L,"labels","sigmoidCrossEntropyWithLogits"),ue=Oe(X,"logits","sigmoidCrossEntropyWithLogits");Y(oe.shape,ue.shape,"Error in sigmoidCrossEntropyWithLogits: ");var se=ue.relu(),ce=ue.mul(oe),xe=ue.abs().neg().exp().log1p();return se.sub(ce).add(xe)}(a,i);return oo(k,s,o)}}),np=Xe({softmaxCrossEntropy_:function(n,r,e,t,o){t===void 0&&(t=0),o===void 0&&(o=rn.SUM_BY_NONZERO_WEIGHTS);var a=Oe(n,"onehotLabels","softmaxCrossEntropy"),i=Oe(r,"logits","softmaxCrossEntropy"),s=null;if(e!=null&&(s=Oe(e,"weights","softmaxCrossEntropy")),Y(a.shape,i.shape,"Error in softmaxCrossEntropy: "),t>0){var u=Nt(t),f=Nt(1),C=Nt(a.shape[1]);a=a.mul(f.sub(u)).add(u.div(C))}var k=function(L,X,oe){if(oe===void 0&&(oe=-1),oe===-1&&(oe=X.rank-1),oe!==X.rank-1)throw Error("Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank "+X.rank+" and dim was "+oe);return _o(function(ue,se,ce){var xe=se.logSumExp([oe],!0),we=se.toFloat().sub(xe);return ce([ue,we]),{value:we.mul(ue).neg().sum([oe]),gradFunc:function(Ee,Se){var Me=Se[0],ze=Se[1],Be=Vr(Ee.shape,[oe]);return[Ee.reshape(Be).mul(Me.toFloat().sub(ze.exp())),Ee.reshape(Be).mul(ze.exp().sub(Me.toFloat()))]}}})(L,X)}(a,i);return oo(k,s,o)}}),op=Object.freeze({get Reduction(){return rn},absoluteDifference:Jh,computeWeightedLoss:oo,cosineDistance:qh,hingeLoss:Qh,huberLoss:Zh,logLoss:ep,meanSquaredError:tp,sigmoidCrossEntropy:rp,softmaxCrossEntropy:np});function Il(n,r){return r===void 0&&(r=!1),Ve.tidy(function(){if(n.shape.length!==2)throw new Error("qr2d() requires a 2D Tensor, but got a "+n.shape.length+"D Tensor.");for(var e=n.shape[0],t=n.shape[1],o=Hi(e),a=n.clone(),i=Zn([[1]],[1,1]),s=i.clone(),u=e>=t?t:e,f=function(k){var L,X=a,oe=s,ue=o;L=Ve.tidy(function(){var se=a.slice([k,k],[e-k,1]),ce=se.norm(),xe=a.slice([k,k],[1,1]),we=Zn([[-1]]).where(xe.greater(0),Zn([[1]])),Ee=xe.sub(we.mul(ce)),Se=se.div(Ee);s=Se.shape[0]===1?i.clone():i.concat(Se.slice([1,0],[Se.shape[0]-1,Se.shape[1]]),0);var Me=we.matMul(Ee).div(ce).neg(),ze=a.slice([k,0],[e-k,t]),Be=Me.mul(s);if(k===0)a=ze.sub(Be.matMul(s.transpose().matMul(ze)));else{var je=ze.sub(Be.matMul(s.transpose().matMul(ze)));a=a.slice([0,0],[k,t]).concat(je,0)}var Ue=o.slice([0,k],[e,o.shape[1]-k]);if(k===0)o=Ue.sub(Ue.matMul(s).matMul(Be.transpose()));else{var Ze=Ue.sub(Ue.matMul(s).matMul(Be.transpose()));o=o.slice([0,0],[e,k]).concat(Ze,1)}return[s,a,o]}),s=L[0],a=L[1],o=L[2],qr([X,oe,ue])},C=0;C<u;++C)f(C);return!r&&e>t&&(o=o.slice([0,0],[e,t]),a=a.slice([0,0],[t,t])),[o,a]})}var ap=Xe({bandPart_:function(n,r,e){if(r%1!=0)throw new Error("bandPart(): numLower must be an integer, got "+r+".");if(e%1!=0)throw new Error("bandPart(): numUpper must be an integer, got "+e+".");var t=Oe(n,"a","bandPart");if(t.rank<2)throw new Error("bandPart(): Rank must be at least 2, got "+t.rank+".");var o=t.shape,a=t.shape.slice(-2),i=a[0],s=a[1];if(!(r<=i))throw new Error("bandPart(): numLower ("+r+") must not be greater than the number of rows ("+i+").");if(!(e<=s))throw new Error("bandPart(): numUpper ("+e+") must not be greater than the number of columns ("+s+").");r<0&&(r=i),e<0&&(e=s);var u=fa(0,i,1,"int32").reshape([-1,1]),f=fa(0,s,1,"int32"),C=Ao(u,f),k=ds(C.lessEqual(Nt(+r,"int32")),C.greaterEqual(Nt(-e,"int32"))),L=Tr([i,s],t.dtype);return Ln(xa(t.reshape([-1,i,s])).map(function(X){return Jo(k,X,L)})).reshape(o)}}),ip=Xe({gramSchmidt_:function(n){var r;if(Array.isArray(n)){r=!1,_(n!=null&&n.length>0,function(){return"Gram-Schmidt process: input must not be null, undefined, or empty"});for(var e=n[0].shape[0],t=function(u){_(n[u].shape[0]===e,function(){return"Gram-Schmidt: Non-unique lengths found in the input vectors: ("+n[u].shape[0]+" vs. "+e+")"})},o=1;o<n.length;++o)t(o)}else r=!0,n=Bo(n,n.shape[0],0).map(function(u){return Vi(u,[0])});_(n.length<=n[0].shape[0],function(){return"Gram-Schmidt: Number of vectors ("+n.length+") exceeds number of dimensions ("+n[0].shape[0]+")."});var a=[],i=n,s=function(u){a.push(Ve.tidy(function(){var f=i[u];if(u>0)for(var C=0;C<u;++C){var k=xl(a[C].mulStrict(f)).mul(a[C]);f=f.sub(k)}return f.div(Tl(f,"euclidean"))}))};for(o=0;o<n.length;++o)s(o);return r?Ln(a,0):a}}),sp=Xe({qr_:function(n,r){if(r===void 0&&(r=!1),n.rank<2)throw new Error("qr() requires input tensor to have a rank >= 2, but got rank "+n.rank);if(n.rank===2)return Il(n,r);var e=n.shape.slice(0,n.shape.length-2).reduce(function(i,s){return i*s}),t=xa(n.reshape([e,n.shape[n.shape.length-2],n.shape[n.shape.length-1]]),0),o=[],a=[];return t.forEach(function(i){var s=Il(i,r),u=s[0],f=s[1];o.push(u),a.push(f)}),[Ln(o,0).reshape(n.shape),Ln(a,0).reshape(n.shape)]}}),up=Object.freeze({bandPart:ap,gramSchmidt:ip,qr:sp});function vs(n,r,e,t,o,a){t==null&&(t=.5),o==null&&(o=Number.NEGATIVE_INFINITY),a==null&&(a=0);var i=n.shape[0];return e=Math.min(e,i),_(0<=t&&t<=1,function(){return"iouThreshold must be in [0, 1], but was '"+t+"'"}),_(n.rank===2,function(){return"boxes must be a 2D tensor, but was of rank '"+n.rank+"'"}),_(n.shape[1]===4,function(){return"boxes must have 4 columns, but 2nd dimension was "+n.shape[1]}),_(r.rank===1,function(){return"scores must be a 1D tensor"}),_(r.shape[0]===i,function(){return"scores has incompatible shape with boxes. Expected "+i+", but was "+r.shape[0]}),_(0<=a&&a<=1,function(){return"softNmsSigma must be in [0, 1], but was '"+a+"'"}),{maxOutputSize:e,iouThreshold:t,scoreThreshold:o,softNmsSigma:a}}var cp=Xe({resizeBilinear_:function(n,r,e){e===void 0&&(e=!1);var t=Oe(n,"images","resizeBilinear");_(t.rank===3||t.rank===4,function(){return"Error in resizeBilinear: x must be rank 3 or 4, but got rank "+t.rank+"."}),_(r.length===2,function(){return"Error in resizeBilinear: new shape must 2D, but got shape "+r+"."});var o=t,a=!1;t.rank===3&&(a=!0,o=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var i=r[0],s=r[1],u=Ve.runKernelFunc(function(f,C){return C([o]),f.resizeBilinear(o,i,s,e)},{x:o},function(f,C){return{x:function(){return Ve.runKernelFunc(function(k){return k.resizeBilinearBackprop(f,C[0],e)},{})}}},"ResizeBilinear",{alignCorners:e,newHeight:i,newWidth:s});return a?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),lp=Xe({resizeNearestNeighbor_:function(n,r,e){e===void 0&&(e=!1);var t=Oe(n,"images","resizeNearestNeighbor");_(t.rank===3||t.rank===4,function(){return"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank "+t.rank+"."}),_(r.length===2,function(){return"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+r+"."}),_(t.dtype==="float32"||t.dtype==="int32",function(){return"`images` must have `int32` or `float32` as dtype"});var o=t,a=!1;t.rank===3&&(a=!0,o=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var i=r[0],s=r[1],u=Ve.runKernelFunc(function(f,C){return C([o]),f.resizeNearestNeighbor(o,i,s,e)},{batchImages:o},function(f,C){return{batchImages:function(){return Ve.runKernelFunc(function(k){return k.resizeNearestNeighborBackprop(f,C[0],e)},{})}}});return a?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),dp=Xe({nonMaxSuppression_:function(n,r,e,t,o){t===void 0&&(t=.5),o===void 0&&(o=Number.NEGATIVE_INFINITY);var a=Oe(n,"boxes","nonMaxSuppression"),i=Oe(r,"scores","nonMaxSuppression"),s=vs(a,i,e,t,o);e=s.maxOutputSize,t=s.iouThreshold,o=s.scoreThreshold;var u={maxOutputSize:e,iouThreshold:t,scoreThreshold:o};return Ve.runKernelFunc(function(f){return f.nonMaxSuppression(a,i,e,t,o)},{boxes:a,scores:i},null,"NonMaxSuppressionV3",u)}}),fp=function(n,r,e,t,o){return t===void 0&&(t=.5),o===void 0&&(o=Number.NEGATIVE_INFINITY),E(this,void 0,void 0,function(){var a,i,s,u,f,C,k;return g(this,function(L){switch(L.label){case 0:return a=Oe(n,"boxes","nonMaxSuppressionAsync"),i=Oe(r,"scores","nonMaxSuppressionAsync"),s=vs(a,i,e,t,o),e=s.maxOutputSize,t=s.iouThreshold,o=s.scoreThreshold,[4,Promise.all([a.data(),i.data()])];case 1:return u=L.sent(),f=u[0],C=u[1],k=li(f,C,e,t,o),a!==n&&a.dispose(),i!==r&&i.dispose(),[2,k]}})})},hp=Xe({nonMaxSuppressionWithScore_:function(n,r,e,t,o,a){t===void 0&&(t=.5),o===void 0&&(o=Number.NEGATIVE_INFINITY),a===void 0&&(a=0);var i=Oe(n,"boxes","nonMaxSuppression"),s=Oe(r,"scores","nonMaxSuppression"),u=vs(i,s,e,t,o,a),f={maxOutputSize:e=u.maxOutputSize,iouThreshold:t=u.iouThreshold,scoreThreshold:o=u.scoreThreshold,softNmsSigma:a=u.softNmsSigma},C=Ve.runKernel("NonMaxSuppressionV5",{boxes:i,scores:s},f);return{selectedIndices:C[0],selectedScores:C[1]}}}),pp=function(n,r,e,t,o,a){return t===void 0&&(t=.5),o===void 0&&(o=Number.NEGATIVE_INFINITY),a===void 0&&(a=0),E(this,void 0,void 0,function(){var i,s,u,f,C,k,L;return g(this,function(X){switch(X.label){case 0:return i=Oe(n,"boxes","nonMaxSuppressionAsync"),s=Oe(r,"scores","nonMaxSuppressionAsync"),u=vs(i,s,e,t,o,a),e=u.maxOutputSize,t=u.iouThreshold,o=u.scoreThreshold,a=u.softNmsSigma,[4,Promise.all([i.data(),s.data()])];case 1:return f=X.sent(),C=f[0],k=f[1],L=di(C,k,e,t,o,a),i!==n&&i.dispose(),s!==r&&s.dispose(),[2,L]}})})},mp=Xe({cropAndResize_:function(n,r,e,t,o,a){var i=Oe(n,"image","cropAndResize"),s=Oe(r,"boxes","cropAndResize","float32"),u=Oe(e,"boxInd","cropAndResize","int32");o=o||"bilinear",a=a||0;var f=s.shape[0];return _(i.rank===4,function(){return"Error in cropAndResize: image must be rank 4,but got rank "+i.rank+"."}),_(s.rank===2&&s.shape[1]===4,function(){return"Error in cropAndResize: boxes must be have size ["+f+",4] but had shape "+s.shape+"."}),_(u.rank===1&&u.shape[0]===f,function(){return"Error in cropAndResize: boxInd must be have size ["+f+"] but had shape "+s.shape+"."}),_(t.length===2,function(){return"Error in cropAndResize: cropSize must be of length 2, but got length "+t.length+"."}),_(t[0]>=1&&t[1]>=1,function(){return"cropSize must be atleast [1,1], but was "+t}),_(o==="bilinear"||o==="nearest",function(){return"method must be bilinear or nearest, but was "+o}),Ve.runKernelFunc(function(C,k){return C.cropAndResize(i,s,u,t,o,a)},{images:i,boxes:s,boxInd:u},null,"CropAndResize",{method:o,extrapolationValue:a,cropSize:t})}}),Nl=Object.freeze({resizeBilinear:cp,resizeNearestNeighbor:lp,nonMaxSuppression:dp,nonMaxSuppressionAsync:fp,nonMaxSuppressionWithScore:hp,nonMaxSuppressionWithScoreAsync:pp,cropAndResize:mp}),Cu=function(n,r){return!(n>0)||r==="linear"},Tu=function(n,r,e){if(e==null||e==="linear")return n;if(e==="relu")return n.mul(r.step());throw new Error("Gradient for activation "+e+" has not been implemented yet.")},Su=function(n,r){var e=r,t=Ir(n.shape,r.shape);return t.length>0&&(e=e.sum(t)),e.reshape(n.shape)},Au=function(n,r,e){if(r==="linear")return n;if(r==="relu")return bu(n);if(r==="elu")return wl(n);if(r==="relu6")return _l(n);if(r==="prelu")return El(n,e);throw new Error("Unknown fused activation "+r+".")},vp=Xe({fusedMatMul_:function(n){var r,e=n.a,t=n.b,o=n.transposeA,a=o!==void 0&&o,i=n.transposeB,s=i!==void 0&&i,u=n.bias,f=n.activation,C=f===void 0?"linear":f,k=n.preluActivationWeights;if(Cu(Ve.state.gradientDepth,C)===!1){var L=yu(e,t,a,s);return u!=null&&(L=qo(L,u)),Au(L,C,k)}var X=Oe(e,"a","fused matMul"),oe=Oe(t,"b","fused matMul");r=cr(X,oe),X=r[0],oe=r[1];var ue=a?X.shape[X.rank-2]:X.shape[X.rank-1],se=s?oe.shape[oe.rank-1]:oe.shape[oe.rank-2],ce=a?X.shape[X.rank-1]:X.shape[X.rank-2],xe=s?oe.shape[oe.rank-2]:oe.shape[oe.rank-1],we=X.shape.slice(0,-2),Ee=oe.shape.slice(0,-2),Se=le(we),Me=le(Ee);_(X.rank>=2&&oe.rank>=2&&X.rank===oe.rank,function(){return"Error in fused matMul: inputs must have the same rank of at least 2, got ranks "+X.rank+" and "+oe.rank+"."}),_(_e(we,Ee),function(){return"Error in fused matMul: outer dimensions ("+we+") and ("+Ee+") of Tensors with shapes "+X.shape+" and "+oe.shape+" must match."}),_(ue===se,function(){return"Error in fused matMul: inner shapes ("+ue+") and ("+se+") of Tensors with shapes "+X.shape+" and "+oe.shape+" and transposeA="+a+" and transposeB="+s+" must match."});var ze,Be,je=X.shape.slice(0,-2).concat([ce,xe]),Ue=a?X.as3D(Se,ue,ce):X.as3D(Se,ce,ue),Ze=s?oe.as3D(Me,xe,se):oe.as3D(Me,se,xe);u!=null&&Ht(je,(ze=cr(ze=Oe(u,"bias","fused matMul"),X)[0]).shape),k!=null&&(Be=Oe(k,"prelu weights","fused matMul"));var Je={a:Ue,b:Ze};u!=null&&(Je.bias=ze),k!=null&&(Je.preluActivationWeights=Be);var ht=[Ue,Ze];return Ve.runKernelFunc(function(ft,ut){var vt=ft.fusedBatchMatMul({a:Ue,b:Ze,transposeA:a,transposeB:s,bias:ze,activation:C,preluActivationWeights:Be});return ut([Ue,Ze,vt]),vt},Je,function(ft,ut){var vt=ut[0],mt=ut[1],lt=ut[2],xt=Tu(ft,lt,C),wt={};return u!=null&&(wt={bias:function(){return Su(ze,xt)}}),a||s?!a&&s?Object.assign({a:function(){return xt.matMul(mt,!1,!1)},b:function(){return xt.matMul(vt,!0,!1)}},wt):a&&!s?Object.assign({a:function(){return mt.matMul(xt,!1,!0)},b:function(){return vt.matMul(xt,!1,!1)}},wt):Object.assign({a:function(){return mt.matMul(xt,!0,!0)},b:function(){return xt.matMul(vt,!0,!0)}},wt):Object.assign({a:function(){return xt.matMul(mt,!1,!0)},b:function(){return vt.matMul(xt,!0,!1)}},wt)},"_FusedMatMul",{transposeA:a,transposeB:s,activation:C},ht,[!0]).reshape(je)}}),gp=Xe({fusedConv2d_:function(n){var r=n.x,e=n.filter,t=n.strides,o=n.pad,a=n.dataFormat,i=a===void 0?"NHWC":a,s=n.dilations,u=s===void 0?[1,1]:s,f=n.dimRoundingMode,C=n.bias,k=n.activation,L=k===void 0?"linear":k,X=n.preluActivationWeights;if(L=L||"linear",Cu(Ve.state.gradientDepth,L)===!1){var oe=Na(r,e,t,o,i,u,f);return C!=null&&(oe=qo(oe,C)),Au(oe,L,X)}var ue=Oe(r,"x","conv2d"),se=Oe(e,"filter","conv2d"),ce=ue,xe=!1;ue.rank===3&&(xe=!0,ce=ue.as4D(1,ue.shape[0],ue.shape[1],ue.shape[2])),_(ce.rank===4,function(){return"Error in fused conv2d: input must be rank 4, but got rank "+ce.rank+"."}),_(se.rank===4,function(){return"Error in fused conv2d: filter must be rank 4, but got rank "+se.rank+"."}),f!=null&&_(me(o),function(){return"Error in fused conv2d: pad must be an integer when using, dimRoundingMode "+f+" but got pad "+o+"."}),_(ce.shape[3]===se.shape[2],function(){return"Error in conv2d: depth of input ("+ce.shape[3]+") must match input depth for filter "+se.shape[2]+"."}),_(Zr(t,u),function(){return"Error in conv2D: Either strides or dilations must be 1. Got strides "+t+" and dilations '"+u+"'"}),_(i==="NHWC",function(){return"Error in conv2d: got dataFormat of "+i+" but only NHWC is currently supported."});var we,Ee,Se=jn(ce.shape,se.shape,t,u,o,f);C!=null&&(we=cr(we=Oe(C,"bias","fused conv2d"),ue)[0],Ht(Se.outShape,we.shape)),X!=null&&(Ee=Oe(X,"prelu weights","fused conv2d"));var Me={x:ce,filter:se};C!=null&&(Me.bias=we),X!=null&&(Me.preluActivationWeights=Ee);var ze=[se,ce],Be=Ve.runKernelFunc(function(je,Ue){var Ze=je.fusedConv2d({input:ce,filter:se,convInfo:Se,bias:we,activation:L,preluActivationWeights:Ee});return Ue([se,ce,Ze]),Ze},Me,function(je,Ue){var Ze=Ue,Je=Ze[0],ht=Ze[1],ft=Ze[2],ut=Tu(je,ft,L);_(So(u),function(){return"Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+u+"'"});var vt={};return C!=null&&(vt={bias:function(){return Su(we,ut)}}),Object.assign({x:function(){return cl(ht.shape,ut,Je,t,o)},filter:function(){return gu(ht,ut,Je.shape,t,o)}},vt)},"FusedConv2D",{convInfo:Se,activation:L},ze,[!0]);return xe?Be.as3D(Be.shape[1],Be.shape[2],Be.shape[3]):Be}}),yp=Xe({fusedDepthwiseConv2d_:function(n){var r=n.x,e=n.filter,t=n.strides,o=n.pad,a=n.dataFormat,i=a===void 0?"NHWC":a,s=n.dilations,u=s===void 0?[1,1]:s,f=n.dimRoundingMode,C=n.bias,k=n.activation,L=k===void 0?"linear":k,X=n.preluActivationWeights;if(Cu(Ve.state.gradientDepth,L)===!1){var oe=ps(r,e,t,o,i,u,f);return C!=null&&(oe=qo(oe,C)),Au(oe,L,X)}var ue=Oe(r,"x","depthwiseConv2d"),se=Oe(e,"filter","depthwiseConv2d"),ce=ue,xe=!1;ue.rank===3&&(xe=!0,ce=ue.as4D(1,ue.shape[0],ue.shape[1],ue.shape[2])),_(ce.rank===4,function(){return"Error in fused depthwiseConv2d: input must be rank 4, but got rank "+ce.rank+"."}),_(se.rank===4,function(){return"Error in fused depthwiseConv2d: filter must be rank 4, but got rank "+se.rank+"."}),_(ce.shape[3]===se.shape[2],function(){return"Error in fused depthwiseConv2d: number of input channels ("+ce.shape[3]+") must match the inChannels dimension in filter "+se.shape[2]+"."}),u==null&&(u=[1,1]),_(Zr(t,u),function(){return"Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides "+t+" and dilations '"+u+"'"}),f!=null&&_(me(o),function(){return"Error in fused depthwiseConv2d: pad must be an integer when using dimRoundingMode "+f+" but got pad "+o+"."});var we,Ee,Se=jn(ce.shape,se.shape,t,u,o,f,!0);C!=null&&(we=cr(we=Oe(C,"bias","fused conv2d"),ue)[0],Ht(Se.outShape,we.shape)),X!=null&&(Ee=Oe(X,"prelu weights","fused depthwiseConv2d"));var Me={x:ce,filter:se};C!=null&&(Me.bias=we),X!=null&&(Me.preluActivationWeights=Ee);var ze=[se,ce],Be=Ve.runKernelFunc(function(je,Ue){var Ze=je.fusedDepthwiseConv2D({input:ce,filter:se,convInfo:Se,bias:we,activation:L,preluActivationWeights:Ee});return Ue([se,ce,Ze]),Ze},Me,function(je,Ue){_(So(u),function(){return"Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+u+"'"});var Ze=Ue[0],Je=Ue[1],ht=Ue[2],ft=Tu(je,ht,L),ut={};return C!=null&&(ut={bias:function(){return Su(we,ft)}}),Object.assign({x:function(){return ll(Je.shape,ft,Ze,Se)},filter:function(){return dl(Je,ft,Ze.shape,Se)}},ut)},"FusedDepthwiseConv2D",{convInfo:Se,activation:L},ze,[!0]);return xe?Be.as3D(Be.shape[1],Be.shape[2],Be.shape[3]):Be}}),bp=Object.freeze({matMul:vp,conv2d:gp,depthwiseConv2d:yp}),xp=Object.freeze({image:Nl,linalg:up,losses:op,spectral:zh,fused:bp,signal:Yh,square:Zd,squaredDifference:zc,conv1d:ch,conv2d:Na,conv3d:lh,depthwiseConv2d:ps,separableConv2d:fl,conv2dTranspose:dh,conv3dTranspose:fh,op:Xe,batchNormalization2d:If,batchNormalization3d:Nf,batchNormalization4d:Df,batchNormalization:kf,batchNorm:qc,batchNorm2d:Mf,batchNorm3d:Pf,batchNorm4d:Ff,booleanMaskAsync:uh,complex:xr,real:un,imag:xn,concat:hn,concat1d:Os,concat2d:Rs,concat3d:ha,concat4d:Is,split:Bo,matMul:yu,dot:hh,outerProduct:ph,reverse:_i,reverse1d:mh,reverse2d:vh,reverse3d:gh,reverse4d:yh,maxPool:ml,avgPool:vl,pool:bh,maxPool3d:xh,avgPool3d:wh,slice:no,slice1d:Eh,slice2d:_h,slice3d:gl,slice4d:Ch,abs:ef,acos:tf,acosh:rf,asin:nf,asinh:of,atan:af,atanh:sf,ceil:uf,clipByValue:Gc,cos:cf,cosh:lf,erf:df,exp:Vc,expm1:ff,floor:hf,log:pf,log1p:mf,logSigmoid:vf,neg:hu,reciprocal:gf,round:yf,rsqrt:Xc,sigmoid:Kc,sign:bf,isNaN:xf,isInf:wf,isFinite:Ef,sin:_f,sinh:Cf,softplus:Tf,sqrt:Sf,step:Af,tan:Of,tanh:Rf,all:Th,any:Sh,argMax:Ah,argMin:Oh,logSumExp:Rh,max:bl,mean:Ih,min:Nh,moments:Dh,sum:xl,prod:kh,equal:rl,equalStrict:Qf,greater:Zf,greaterEqual:nl,greaterEqualStrict:eh,greaterStrict:th,less:rh,lessEqual:nh,lessEqualStrict:oh,lessStrict:ah,notEqual:ih,notEqualStrict:sh,add:qo,addN:Bf,addStrict:Uf,atan2:Wf,div:fs,divNoNan:Hf,divStrict:zf,floorDiv:el,maximum:pu,maximumStrict:Gf,minimum:tl,minimumStrict:Vf,mod:Xf,modStrict:Kf,mul:Qo,mulStrict:Yf,pow:hs,powStrict:$f,squaredDifferenceStrict:Jf,sub:Ao,subStrict:qf,elu:wl,leakyRelu:Mh,prelu:El,relu:bu,relu6:_l,selu:Ph,logicalAnd:ds,logicalNot:Lf,logicalOr:Qc,logicalXor:jf,where:Jo,whereAsync:Zc,buffer:Lt,print:ma,batchToSpaceND:va,broadcastTo:Ps,cast:ga,clone:ya,cumsum:Fs,depthToSpace:Ls,expandDims:On,eye:Hi,multinomial:ti,oneHot:ri,pad:Fn,pad1d:zi,pad2d:Eo,pad3d:ni,pad4d:js,rand:Bs,randomNormal:Us,randomGamma:Ws,randomUniform:oi,reshape:ba,spaceToBatchND:Gi,squeeze:Vi,stack:Ln,tile:eo,truncatedNormal:Hs,unstack:xa,setdiff1dAsync:zs,fill:ei,linspace:sc,ones:Mn,range:fa,scalar:Nt,tensor:Ur,tensor1d:Qn,tensor2d:Zn,tensor3d:Za,tensor4d:kn,tensor5d:xo,tensor6d:As,variable:wo,zeros:Tr,onesLike:Bi,zerosLike:Jt,transpose:Cl,softmax:zo,logSoftmax:si,localResponseNormalization:Fh,norm:Tl,gather:mu,unsortedSegmentSum:il,basicLSTMCell:Lh,multiRNNCell:jh,movingAverage:Bh,stridedSlice:Uh,topk:Wh,scatterND:Hh,fft:xu,ifft:ms,rfft:wu,irfft:Sl,sparseToDense:Gh,gatherND:Vh,diag:Xh,dropout:Kh,hannWindow:Eu,hammingWindow:Ol,frame:_u,stft:Rl,inTopKAsync:$h});function pt(n,r){Array.isArray(n)||(n=[n]),n.forEach(function(e){e!=null&&_(e.dtype!=="complex64",function(){return r+" does not support complex64 tensors."})})}function Ou(n,r,e,t){if(e==="linear")return n.linear(r);if(e==="relu")return n.relu(r);if(e==="elu")return n.elu(r);if(e==="relu6")return n.relu6(r);if(e==="prelu")return n.prelu(r,t);throw new Error("Activation "+e+" has not been implemented for the CPU backend.")}var wp=function(n){function r(){var e=n.call(this)||this;return e.blockSize=48,e.firstUse=!0,e.data=new _a(e,Ve),e}return D(r,n),r.prototype.write=function(e,t,o){this.firstUse&&(this.firstUse=!1,p().get("IS_NODE")&&da(`
============================
Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, which binds to TensorFlow C++, by running npm i @tensorflow/tfjs-node, or npm i @tensorflow/tfjs-node-gpu if you have CUDA. Then call require('@tensorflow/tfjs-node'); (-gpu suffix for CUDA) at the start of your program. Visit https://github.com/tensorflow/tfjs-node for more details.
============================`));var a={};return this.data.set(a,{values:e,dtype:o}),a},r.prototype.move=function(e,t,o,a){this.data.set(e,{values:t,dtype:a})},r.prototype.numDataIds=function(){return this.data.numDataIds()},r.prototype.read=function(e){return E(this,void 0,void 0,function(){return g(this,function(t){return[2,this.readSync(e)]})})},r.prototype.readSync=function(e){var t=this.data.get(e),o=t.dtype,a=t.complexTensors;return o==="complex64"?Oa(this.readSync(a.real.dataId),this.readSync(a.imag.dataId)):this.data.get(e).values},r.prototype.bufferSync=function(e){var t=this.readSync(e.dataId),o=t;if(e.dtype==="string")try{o=t.map(function(a){return qe(a)})}catch(a){throw new Error("Failed to decode encoded string bytes into utf-8")}return Lt(e.shape,e.dtype,o)},r.prototype.makeOutput=function(e,t,o){var a=this.write(e,t,o);return Ve.makeTensorFromDataId(a,t,o,this)},r.prototype.disposeData=function(e){if(this.data.has(e)){var t=this.data.get(e).complexTensors;t!=null&&(t.real.dispose(),t.imag.dispose()),this.data.delete(e)}},r.prototype.time=function(e){return E(this,void 0,void 0,function(){var t;return g(this,function(o){return t=fe(),e(),[2,{kernelMs:fe()-t}]})})},r.prototype.memory=function(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}},r.prototype.complex=function(e,t){var o=this.makeOutput(null,e.shape,"complex64");return this.data.get(o.dataId).complexTensors={real:Ve.keep(e.clone()),imag:Ve.keep(t.clone())},o},r.prototype.real=function(e){return this.data.get(e.dataId).complexTensors.real.clone()},r.prototype.imag=function(e){return this.data.get(e.dataId).complexTensors.imag.clone()},r.prototype.slice=function(e,t,o){if(pt(e,"slice"),Ji(e.shape,t,o)){var a=qi(t,e.strides),i=le(o);return Ur(this.readSync(e.dataId).subarray(a,a+i),o,e.dtype)}for(var s=Lt(o,e.dtype),u=this.bufferSync(e),f=0;f<s.size;++f){var C=s.indexToLoc(f).map(function(k,L){return k+t[L]});s.values[f]=u.get.apply(u,C)}return s.toTensor()},r.prototype.stridedSlice=function(e,t,o,a){pt(e,"stridedSlice");var i=Ea(t,o,a);if(i.some(function(X){return X===0}))return Ur([],i);for(var s=Lt(i,e.dtype),u=this.bufferSync(e),f=0;f<s.size;f++){for(var C=s.indexToLoc(f),k=new Array(C.length),L=0;L<k.length;L++)k[L]=C[L]*a[L]+t[L];s.set.apply(s,[u.get.apply(u,k)].concat(C))}return s.toTensor()},r.prototype.diag=function(e){for(var t=this.readSync(e.dataId),o=Lt([e.size,e.size],e.dtype),a=o.values,i=0;i<t.length;i++)a[i*e.size+i]=t[i];return o.toTensor()},r.prototype.unstack=function(e,t){for(var o=e.shape[t],a=new Array(e.rank-1),i=0,s=0;s<e.rank;s++)s!==t&&(a[i++]=e.shape[s]);var u=new Array(e.rank).fill(0),f=e.shape.slice();f[t]=1;var C=new Array(o);for(s=0;s<C.length;s++)u[t]=s,C[s]=this.slice(e,u,f).reshape(a);return C},r.prototype.reverse=function(e,t){pt(e,"reverse");for(var o=Lt(e.shape,e.dtype),a=this.bufferSync(e),i=function(u){var f=o.indexToLoc(u),C=f.slice();t.forEach(function(k){return C[k]=e.shape[k]-1-C[k]}),o.set.apply(o,[a.get.apply(a,C)].concat(f))},s=0;s<o.size;s++)i(s);return o.toTensor()},r.prototype.concat=function(e,t){var o=this;if(e[0].dtype==="complex64"){var a=e.map(function(X){return un(X)}),i=e.map(function(X){return xn(X)});return xr(this.concat(a,t),this.concat(i,t))}var s=e.map(function(X){var oe=le(X.shape.slice(t));return X.as2D(-1,oe)}),u=qn(s.map(function(X){return X.shape}),1),f=Lt(u,e[0].dtype).values;if(s[0].shape[0]===1){var C=0;s.forEach(function(X){f.set(o.readSync(X.dataId),C),C+=X.size})}else{var k=0;s.forEach(function(X){for(var oe=o.readSync(X.dataId),ue=0,se=0;se<X.shape[0];++se)for(var ce=se*u[1]+k,xe=0;xe<X.shape[1];++xe)f[ce+xe]=oe[ue++];k+=X.shape[1]})}var L=qn(e.map(function(X){return X.shape}),t);return Ur(f,L,e[0].dtype)},r.prototype.neg=function(e){return pt(e,"neg"),this.multiply(Nt(-1),e)},r.prototype.add=function(e,t){return e.dtype==="complex64"||t.dtype==="complex64"?this.broadcastedBinaryComplexOp(e.cast("complex64"),t.cast("complex64"),function(o,a,i,s){return{real:o+i,imag:a+s}}):this.broadcastedBinaryOp(e,t,nr(e.dtype,t.dtype),function(o,a){return o+a})},r.prototype.addN=function(e){var t=this;pt(e,"addN");for(var o=e.map(function(C){return t.readSync(C.dataId)}),a=Lt(e[0].shape,e[0].dtype),i=a.values,s=0;s<e.length;s++)for(var u=o[s],f=0;f<i.length;f++)i[f]+=u[f];return a.toTensor()},r.prototype.softmax=function(e,t){var o=de([t],e.shape),a=this.max(e,o),i=Vr(a.shape,o),s=this.subtract(e,a.reshape(i)),u=this.exp(s),f=this.sum(u,o).reshape(i);return this.realDivide(u,f)},r.prototype.subtract=function(e,t){return e.dtype==="complex64"||t.dtype==="complex64"?this.broadcastedBinaryComplexOp(e.cast("complex64"),t.cast("complex64"),function(o,a,i,s){return{real:o-i,imag:a-s}}):this.broadcastedBinaryOp(e,t,nr(e.dtype,t.dtype),function(o,a){return o-a})},r.prototype.pow=function(e,t){return pt([e,t],"pow"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){return Math.pow(o,a)})},r.prototype.batchMatMul=function(e,t,o,a){pt([e,t],"matMul");for(var i=o?e.shape[1]:e.shape[2],s=o?e.shape[2]:e.shape[1],u=a?t.shape[1]:t.shape[2],f=e.shape[0],C=this.readSync(e.dataId),k=this.readSync(t.dataId),L=o?[e.strides[0],1,e.strides[1]]:[e.strides[0],e.strides[1],1],X=L[0],oe=L[1],ue=L[2],se=a?[1,t.strides[1],t.strides[0]]:[t.strides[1],1,t.strides[0]],ce=se[0],xe=se[1],we=se[2],Ee=s*u,Se=Lt([f,s,u],e.dtype),Me=Se.values,ze=this.blockSize,Be=0;Be<f;Be++)for(var je=0;je<s;je+=ze)for(var Ue=0;Ue<u;Ue+=ze)for(var Ze=0;Ze<i;Ze+=ze)for(var Je=Math.min(je+ze,s),ht=Math.min(Ue+ze,u),ft=Math.min(Ze+ze,i),ut=je;ut<Je;ut++)for(var vt=Ue;vt<ht;vt++){for(var mt=0,lt=Ze;lt<ft;lt++)mt+=C[Be*X+ut*oe+lt*ue]*k[lt*ce+vt*xe+Be*we];Me[Be*Ee+(ut*u+vt)]+=mt}return Se.toTensor()},r.prototype.fusedBatchMatMul=function(e){var t=e.a,o=e.b,a=e.transposeA,i=e.transposeB,s=e.bias,u=e.activation,f=e.preluActivationWeights,C=this.batchMatMul(t,o,a,i);return s&&(C=this.add(C,s)),u&&(C=Ou(this,C,u,f)),C},r.prototype.multiply=function(e,t){return e.dtype==="complex64"||t.dtype==="complex64"?this.broadcastedBinaryComplexOp(e.cast("complex64"),t.cast("complex64"),function(o,a,i,s){return{real:o*i-a*s,imag:o*s+a*i}}):this.broadcastedBinaryOp(e,t,nr(e.dtype,t.dtype),function(o,a){return o*a})},r.prototype.realDivide=function(e,t){return pt([e,t],"realDivide"),this.broadcastedBinaryOp(e,t,"float32",function(o,a){return o/a})},r.prototype.floorDiv=function(e,t){return pt([e,t],"floorDiv"),this.broadcastedBinaryOp(e,t,"int32",function(o,a){return Math.floor(o/a)})},r.prototype.sum=function(e,t){pt(e,"sum"),on("sum",t,e.rank);for(var o=Gr(e.shape,t),a=o[0],i=o[1],s=Tr(a,nr(e.dtype,"int32")),u=le(i),f=this.readSync(s.dataId),C=this.readSync(e.dataId),k=0;k<f.length;++k){for(var L=k*u,X=0,oe=0;oe<u;++oe)X+=C[L+oe];f[k]=X}return s},r.prototype.prod=function(e,t){pt(e,"sum");for(var o=Gr(e.shape,t),a=o[0],i=o[1],s=Tr(a,nr(e.dtype,"int32")),u=le(i),f=this.readSync(s.dataId),C=this.readSync(e.dataId),k=0;k<f.length;++k){for(var L=k*u,X=1,oe=0;oe<u;++oe)X*=C[L+oe];f[k]=X}return s},r.prototype.unsortedSegmentSum=function(e,t,o){pt(e,"unsortedSegmentSum");for(var a=[],i=e.rank-t.rank,s=0;s<i;++s)t=t.expandDims(s+1);for(s=0;s<o;++s){var u=Nt(s,"int32"),f=rl(u,t).asType("float32").mul(e).sum(0);a.push(f)}return Ln(a)},r.prototype.argMin=function(e,t){pt(e,"argMin");var o=[t];on("argMin",o,e.rank);for(var a=Gr(e.shape,o),i=a[0],s=a[1],u=Tr(i,"int32"),f=le(s),C=this.readSync(u.dataId),k=this.readSync(e.dataId),L=0;L<C.length;++L){for(var X=L*f,oe=k[X],ue=0,se=0;se<f;++se){var ce=k[X+se];ce<oe&&(oe=ce,ue=se)}C[L]=ue}return u},r.prototype.argMax=function(e,t){pt(e,"argMax");var o=[t];on("argMax",o,e.rank);for(var a=Gr(e.shape,o),i=a[0],s=a[1],u=Tr(i,"int32"),f=le(s),C=this.readSync(u.dataId),k=this.readSync(e.dataId),L=0;L<C.length;++L){for(var X=L*f,oe=k[X],ue=0,se=0;se<f;++se){var ce=k[X+se];ce>oe&&(oe=ce,ue=se)}C[L]=ue}return u},r.prototype.cumsum=function(e,t,o,a){if(pt(e,"cumsum"),t!==e.rank-1)throw new Error("backend.cumsum in CPU expects an inner-most axis="+(e.rank-1)+" but got axis="+t);for(var i=nr(e.dtype,"int32"),s=Tr(e.shape,i),u=this.readSync(s.dataId),f=this.readSync(e.dataId),C=e.shape[e.rank-1],k=a?function(se,ce){return se+C-ce-1}:function(se,ce){return se+ce},L=0;L<f.length;L+=C)for(var X=0;X<C;X++){var oe=k(L,X);if(X===0)u[oe]=o?0:f[oe];else{var ue=k(L,X-1);u[oe]=o?f[ue]+u[ue]:f[oe]+u[ue]}}return s},r.prototype.equal=function(e,t){return pt([e,t],"equal"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o===a?1:0})},r.prototype.notEqual=function(e,t){return pt([e,t],"notEqual"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o!==a?1:0})},r.prototype.less=function(e,t){return pt([e,t],"less"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o<a?1:0})},r.prototype.lessEqual=function(e,t){return pt([e,t],"lessEqual"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o<=a?1:0})},r.prototype.greater=function(e,t){return pt([e,t],"greater"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o>a?1:0})},r.prototype.greaterEqual=function(e,t){return pt([e,t],"greaterEqual"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o>=a?1:0})},r.prototype.logicalNot=function(e){pt(e,"logicalNot");for(var t=this.readSync(e.dataId),o=new Uint8Array(t.length),a=0;a<t.length;++a)o[a]=t[a]?0:1;return this.makeOutput(o,e.shape,"bool")},r.prototype.logicalAnd=function(e,t){return pt([e,t],"logicalAnd"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o&&a})},r.prototype.logicalOr=function(e,t){return pt([e,t],"logicalOr"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o||a})},r.prototype.select=function(e,t,o){pt([e,t,o],"select");for(var a=this.readSync(e.dataId),i=this.readSync(t.dataId),s=this.readSync(o.dataId),u=Tr(t.shape,nr(t.dtype,o.dtype)),f=this.readSync(u.dataId),C=0,k=e.rank===0||e.rank>1||t.rank===1?1:le(t.shape.slice(1)),L=0;L<a.length;L++)for(var X=0;X<k;X++)a[L]===1?f[C++]=i[L]:f[C++]=s[L];return u},r.prototype.where=function(e){pt([e],"where");var t=this.readSync(e.dataId);return fi(e.shape,t)},r.prototype.topk=function(e,t,o){return pt(e,"topk"),as(this.readSync(e.dataId),e.shape,e.dtype,t)},r.prototype.min=function(e,t){pt(e,"min"),on("min",t,e.rank);for(var o=Gr(e.shape,t),a=o[0],i=o[1],s=Tr(a,e.dtype),u=le(i),f=this.readSync(s.dataId),C=this.readSync(e.dataId),k=0;k<f.length;++k){for(var L=k*u,X=C[L],oe=0;oe<u;++oe){var ue=C[L+oe];ue<X&&(X=ue)}f[k]=X}return s},r.prototype.minimum=function(e,t){return pt([e,t],"minimum"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){return Math.min(o,a)})},r.prototype.mod=function(e,t){return pt([e,t],"mod"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){var i=o%a;return o<0&&a<0||o>=0&&a>=0?i:(i+a)%a})},r.prototype.max=function(e,t){pt(e,"max"),on("max",t,e.rank);for(var o=Gr(e.shape,t),a=o[0],i=o[1],s=Tr(a,e.dtype),u=le(i),f=this.readSync(s.dataId),C=this.readSync(e.dataId),k=0;k<f.length;++k){for(var L=k*u,X=C[L],oe=0;oe<u;++oe){var ue=C[L+oe];ue>X&&(X=ue)}f[k]=X}return s},r.prototype.maximum=function(e,t){return pt([e,t],"maximum"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){return Math.max(o,a)})},r.prototype.all=function(e,t){pt(e,"all"),on("all",t,e.rank);for(var o=Gr(e.shape,t),a=o[0],i=o[1],s=Tr(a,e.dtype),u=le(i),f=this.readSync(s.dataId),C=this.readSync(e.dataId),k=0;k<f.length;++k){for(var L=k*u,X=C[L],oe=0;oe<u;++oe){var ue=C[L+oe];X=X&&ue}f[k]=X}return s},r.prototype.any=function(e,t){pt(e,"any"),on("any",t,e.rank);for(var o=Gr(e.shape,t),a=o[0],i=o[1],s=Tr(a,e.dtype),u=le(i),f=this.readSync(s.dataId),C=this.readSync(e.dataId),k=0;k<f.length;++k){for(var L=k*u,X=C[L],oe=0;oe<u;++oe){var ue=C[L+oe];X=X||ue}f[k]=X}return s},r.prototype.squaredDifference=function(e,t){return pt([e,t],"squaredDifference"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){var i=o-a;return i*i})},r.prototype.ceil=function(e){pt(e,"ceil");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a)o[a]=Math.ceil(t[a]);return this.makeOutput(o,e.shape,"float32")},r.prototype.floor=function(e){pt(e,"floor");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a)o[a]=Math.floor(t[a]);return this.makeOutput(o,e.shape,"float32")},r.prototype.sign=function(e){pt(e,"x");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a)t[a]<0?o[a]=-1:t[a]>0?o[a]=1:o[a]=0;return this.makeOutput(o,e.shape,"float32")},r.prototype.isNaN=function(e){pt(e,"x");for(var t=this.readSync(e.dataId),o=new Uint8Array(t.length),a=0;a<t.length;++a)Number.isNaN(t[a])&&(o[a]=1);return this.makeOutput(o,e.shape,"bool")},r.prototype.isInf=function(e){pt(e,"x");for(var t=this.readSync(e.dataId),o=new Uint8Array(t.length),a=0;a<t.length;++a)Math.abs(t[a])===1/0&&(o[a]=1);return this.makeOutput(o,e.shape,"bool")},r.prototype.isFinite=function(e){pt(e,"x");for(var t=this.readSync(e.dataId),o=new Uint8Array(t.length),a=0;a<t.length;++a)Number.isFinite(t[a])&&(o[a]=1);return this.makeOutput(o,e.shape,"bool")},r.prototype.round=function(e){pt(e,"round");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a){var i=Math.floor(t[a]);t[a]-i<.5?o[a]=Math.floor(t[a]):t[a]-i>.5?o[a]=Math.ceil(t[a]):o[a]=i%2==0?i:i+1}return this.makeOutput(o,e.shape,"float32")},r.prototype.exp=function(e){pt(e,"exp");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a)o[a]=Math.exp(t[a]);return this.makeOutput(o,e.shape,"float32")},r.prototype.expm1=function(e){pt(e,"expm1");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a)o[a]=Math.expm1(t[a]);return this.makeOutput(o,e.shape,"float32")},r.prototype.log=function(e){pt(e,"log");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a){var i=t[a];o[a]=Math.log(i)}return this.makeOutput(o,e.shape,"float32")},r.prototype.log1p=function(e){pt(e,"log1p");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a){var i=t[a];o[a]=Math.log1p(i)}return this.makeOutput(o,e.shape,"float32")},r.prototype.sqrt=function(e){pt(e,"sqrt");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a){var i=t[a];o[a]=Math.sqrt(i)}return this.makeOutput(o,e.shape,"float32")},r.prototype.rsqrt=function(e){pt(e,"rsqrt");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a){var i=t[a];o[a]=1/Math.sqrt(i)}return this.makeOutput(o,e.shape,"float32")},r.prototype.reciprocal=function(e){pt(e,"reciprocal");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a)o[a]=1/t[a];return this.makeOutput(o,e.shape,"float32")},r.prototype.linear=function(e){return e},r.prototype.relu=function(e){pt(e,"relu");for(var t=Tr(e.shape,e.dtype),o=this.readSync(t.dataId),a=this.readSync(e.dataId),i=0;i<a.length;++i)o[i]=Math.max(0,a[i]);return t},r.prototype.relu6=function(e){pt(e,"relu");for(var t=Tr(e.shape,e.dtype),o=this.readSync(t.dataId),a=this.readSync(e.dataId),i=0;i<a.length;++i)o[i]=Math.min(Math.max(0,a[i]),6);return t},r.prototype.prelu=function(e,t){return pt([e,t],"prelu"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){return o<0?a*o:o})},r.prototype.elu=function(e){pt(e,"elu");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a){var i=o[a];t[a]=i>=0?i:Math.exp(i)-1}return this.makeOutput(t,e.shape,"float32")},r.prototype.eluDer=function(e,t){pt([e,t],"eluDer");for(var o=new Float32Array(t.size),a=this.readSync(t.dataId),i=this.readSync(e.dataId),s=0;s<a.length;++s){var u=a[s];o[s]=u>=1?i[s]:i[s]*(u+1)}return this.makeOutput(o,t.shape,"float32")},r.prototype.selu=function(e){pt(e,"selu");for(var t=du,o=fu,a=new Float32Array(e.size),i=this.readSync(e.dataId),s=0;s<i.length;++s){var u=i[s];a[s]=u>=0?o*u:t*(Math.exp(u)-1)}return this.makeOutput(a,e.shape,"float32")},r.prototype.clip=function(e,t,o){pt(e,"clip");for(var a=new Float32Array(e.size),i=this.readSync(e.dataId),s=0;s<i.length;++s){var u=i[s];a[s]=u>o?o:u<t?t:u}return this.makeOutput(a,e.shape,"float32")},r.prototype.abs=function(e){for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.abs(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.complexAbs=function(e){for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<e.size;++a){var i=o[2*a],s=o[2*a+1];t[a]=Math.hypot(i,s)}return this.makeOutput(t,e.shape,"float32")},r.prototype.int=function(e){pt(e,"int");for(var t=new Int32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=o[a];return this.makeOutput(t,e.shape,"int32")},r.prototype.sigmoid=function(e){pt(e,"sigmoid");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=1/(1+Math.exp(-o[a]));return this.makeOutput(t,e.shape,"float32")},r.prototype.softplus=function(e){pt(e,"softplus");for(var t=Math.log(11920928955078125e-23)+2,o=new Float32Array(e.size),a=this.readSync(e.dataId),i=0;i<a.length;++i){var s=a[i]>-t,u=a[i]<t,f=Math.exp(a[i]),C=void 0;C=u?f:s?a[i]:Math.log(1+f),o[i]=C}return this.makeOutput(o,e.shape,"float32")},r.prototype.sin=function(e){pt(e,"sin");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.sin(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.cos=function(e){pt(e,"cos");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.cos(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.tan=function(e){pt(e,"tan");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.tan(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.asin=function(e){pt(e,"asin");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.asin(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.acos=function(e){pt(e,"acos");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.acos(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.atan=function(e){pt(e,"atan");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.atan(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.atan2=function(e,t){return pt([e,t],"atan2"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){return Math.atan2(o,a)})},r.prototype.sinh=function(e){pt(e,"sinh");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.sinh(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.cosh=function(e){pt(e,"cosh");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.cosh(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.tanh=function(e){pt(e,"tanh");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=ke(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.asinh=function(e){pt(e,"asinh");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.asinh(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.acosh=function(e){pt(e,"acosh");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.acosh(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.atanh=function(e){pt(e,"atanh");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.atanh(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.erf=function(e){pt(e,"erf");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a){var i=Math.sign(o[a]),s=Math.abs(o[a]),u=1/(1+.3275911*s);t[a]=i*(1-((((1.061405429*u-1.453152027)*u+1.421413741)*u-.284496736)*u+.254829592)*u*Math.exp(-s*s))}return this.makeOutput(t,e.shape,"float32")},r.prototype.step=function(e,t){t===void 0&&(t=0),pt(e,"step");for(var o=new Float32Array(e.size),a=this.readSync(e.dataId),i=0;i<a.length;++i){var s=a[i];isNaN(s)?o[i]=NaN:o[i]=s>0?1:t}return this.makeOutput(o,e.shape,"float32")},r.prototype.fusedConv2d=function(e){var t=e.input,o=e.filter,a=e.convInfo,i=e.bias,s=e.activation,u=e.preluActivationWeights,f=this.conv2d(t,o,a);return i&&(f=this.add(f,i)),s&&(f=Ou(this,f,s,u)),f},r.prototype.conv2d=function(e,t,o){pt([e,t],"conv2d");for(var a=o.filterHeight,i=o.filterWidth,s=o.dilationHeight,u=o.dilationWidth,f=o.padInfo.left,C=o.padInfo.top,k=o.dataFormat==="channelsLast",L=Lt(o.outShape,e.dtype),X=e.strides[0],oe=k?e.strides[1]:e.strides[2],ue=k?e.strides[2]:1,se=k?1:e.strides[1],ce=L.strides[0],xe=k?L.strides[1]:L.strides[2],we=k?L.strides[2]:1,Ee=k?1:L.strides[1],Se=this.readSync(e.dataId),Me=this.readSync(t.dataId),ze=L.values,Be=0;Be<o.batchSize;++Be)for(var je=Be*X,Ue=Be*ce,Ze=0;Ze<o.outHeight;++Ze)for(var Je=Ue+Ze*xe,ht=Ze*o.strideHeight-C,ft=0;ft<a;ft++){var ut=ht+ft*s;if(!(ut<0||ut>=o.inHeight))for(var vt=ft*t.strides[0],mt=je+ut*oe,lt=0;lt<o.outWidth;++lt)for(var xt=Je+lt*we,wt=lt*o.strideWidth-f,Ot=0;Ot<i;Ot++){var Mt=wt+Ot*u;if(!(Mt<0||Mt>=o.inWidth))for(var Pt=mt+Mt*ue,Kt=vt+Ot*t.strides[1],Yt=0;Yt<o.inChannels;++Yt){for(var $t=Se[Pt+Yt*se],ar=0;ar<o.outChannels;++ar)ze[xt+ar*Ee]+=$t*Me[Kt+ar];Kt+=o.outChannels}}}return L.toTensor()},r.prototype.conv3d=function(e,t,o){for(var a=o.filterDepth,i=o.filterHeight,s=o.filterWidth,u=o.dilationDepth,f=o.dilationHeight,C=o.dilationWidth,k=o.padInfo.front,L=o.padInfo.left,X=o.padInfo.top,oe=Lt(o.outShape,e.dtype),ue=this.readSync(e.dataId),se=this.readSync(t.dataId),ce=oe.values,xe=0;xe<o.batchSize;++xe)for(var we=xe*e.strides[0],Ee=xe*oe.strides[0],Se=0;Se<o.outDepth;++Se)for(var Me=Ee+Se*oe.strides[1],ze=Se*o.strideDepth-k,Be=0;Be<a;Be++){var je=ze+Be*u;if(!(je<0||je>=o.inDepth))for(var Ue=Be*t.strides[0],Ze=we+je*e.strides[1],Je=0;Je<o.outHeight;++Je)for(var ht=Me+Je*oe.strides[2],ft=Je*o.strideHeight-X,ut=0;ut<i;ut++){var vt=ft+ut*f;if(!(vt<0||vt>=o.inHeight))for(var mt=Ue+ut*t.strides[1],lt=Ze+vt*e.strides[2],xt=0;xt<o.outWidth;++xt)for(var wt=ht+xt*o.outChannels,Ot=xt*o.strideWidth-L,Mt=0;Mt<s;Mt++){var Pt=Ot+Mt*C;if(!(Pt<0||Pt>=o.inWidth))for(var Kt=mt+Mt*t.strides[2],Yt=lt+Pt*o.inChannels,$t=Kt,ar=0;ar<o.inChannels;++ar){for(var er=ue[Yt+ar],ir=0;ir<o.outChannels;++ir)ce[wt+ir]+=er*se[$t+ir];$t+=o.outChannels}}}}return oe.toTensor()},r.prototype.conv2dDerInput=function(e,t,o){pt([e,t],"conv2dDerInput");for(var a=Lt(o.inShape,"float32"),i=a.values,s=this.readSync(e.dataId),u=this.readSync(t.dataId),f=t.strides,C=f[0],k=f[1],L=f[2],X=o.batchSize,oe=o.filterHeight,ue=o.filterWidth,se=o.inChannels,ce=o.inHeight,xe=o.inWidth,we=o.outChannels,Ee=o.outHeight,Se=o.outWidth,Me=o.strideHeight,ze=o.strideWidth,Be=o.dataFormat,je=oe-1-o.padInfo.top,Ue=ue-1-o.padInfo.left,Ze=Be==="channelsLast",Je=a.strides[0],ht=Ze?a.strides[1]:a.strides[2],ft=Ze?a.strides[2]:1,ut=Ze?1:a.strides[1],vt=e.strides[0],mt=Ze?e.strides[1]:e.strides[2],lt=Ze?e.strides[2]:1,xt=Ze?1:e.strides[1],wt=0;wt<X;++wt)for(var Ot=0;Ot<se;++Ot)for(var Mt=0;Mt<ce;++Mt)for(var Pt=Mt-je,Kt=Math.max(0,Math.ceil(Pt/Me)),Yt=Math.min(Ee,(oe+Pt)/Me),$t=0;$t<xe;++$t){for(var ar=$t-Ue,er=Math.max(0,Math.ceil(ar/ze)),ir=Math.min(Se,(ue+ar)/ze),jr=0,tr=Kt;tr<Yt;++tr)for(var Er=tr*Me-Pt,fr=er;fr<ir;++fr)for(var Lr=vt*wt+mt*tr+lt*fr,Mr=C*(oe-1-Er)+k*(ue-1-(fr*ze-ar))+L*Ot,Pr=0;Pr<we;++Pr)jr+=s[Lr+xt*Pr]*u[Mr+Pr];i[Je*wt+ht*Mt+ft*$t+ut*Ot]=jr}return a.toTensor()},r.prototype.conv3dDerInput=function(e,t,o){for(var a=Lt(o.inShape,"float32"),i=a.values,s=a.strides,u=s[0],f=s[1],C=s[2],k=s[3],L=this.readSync(e.dataId),X=e.strides,oe=X[0],ue=X[1],se=X[2],ce=X[3],xe=this.readSync(t.dataId),we=t.strides,Ee=we[0],Se=we[1],Me=we[2],ze=we[3],Be=o.batchSize,je=o.filterDepth,Ue=o.filterHeight,Ze=o.filterWidth,Je=o.inChannels,ht=o.inDepth,ft=o.inHeight,ut=o.inWidth,vt=o.outChannels,mt=o.outDepth,lt=o.outHeight,xt=o.outWidth,wt=o.strideDepth,Ot=o.strideHeight,Mt=o.strideWidth,Pt=je-1-o.padInfo.front,Kt=Ue-1-o.padInfo.top,Yt=Ze-1-o.padInfo.left,$t=0;$t<Be;++$t)for(var ar=0;ar<Je;++ar)for(var er=0;er<ht;++er)for(var ir=er-Pt,jr=Math.max(0,Math.ceil(ir/wt)),tr=Math.min(mt,(je+ir)/wt),Er=0;Er<ft;++Er)for(var fr=Er-Kt,Lr=Math.max(0,Math.ceil(fr/Ot)),Mr=Math.min(lt,(Ue+fr)/Ot),Pr=0;Pr<ut;++Pr){for(var zn=Pr-Yt,Gn=Math.max(0,Math.ceil(zn/Mt)),mn=Math.min(xt,(Ze+zn)/Mt),ja=0,io=jr;io<tr;++io)for(var No=io*wt-ir,so=Lr;so<Mr;++so)for(var Ba=so*Ot-fr,uo=Gn;uo<mn;++uo)for(var Vu=oe*$t+ue*io+se*so+ce*uo,Ua=Ee*(je-1-No)+Se*(Ue-1-Ba)+Me*(Ze-1-(uo*Mt-zn))+ze*ar,Vn=0;Vn<vt;++Vn)ja+=L[Vu+Vn]*xe[Ua+Vn];i[u*$t+f*er+C*Er+k*Pr+ar]=ja}return a.toTensor()},r.prototype.conv2dDerFilter=function(e,t,o){pt([e,t],"conv2dDerFilter");for(var a=o.strideHeight,i=o.strideWidth,s=o.filterHeight,u=o.filterWidth,f=o.dataFormat==="channelsLast",C=Lt(o.filterShape,"float32"),k=o.padInfo.left,L=o.padInfo.top,X=this.bufferSync(e),oe=this.bufferSync(t),ue=0;ue<s;++ue)for(var se=Math.max(0,Math.ceil((L-ue)/a)),ce=Math.min(o.outHeight,(o.inHeight+L-ue)/a),xe=0;xe<u;++xe)for(var we=Math.max(0,Math.ceil((k-xe)/i)),Ee=Math.min(o.outWidth,(o.inWidth+k-xe)/i),Se=0;Se<o.inChannels;++Se)for(var Me=0;Me<o.outChannels;++Me){for(var ze=0,Be=0;Be<o.batchSize;++Be)for(var je=se;je<ce;++je)for(var Ue=ue+je*a-L,Ze=we;Ze<Ee;++Ze){var Je=xe+Ze*i-k;ze+=f?X.get(Be,Ue,Je,Se)*oe.get(Be,je,Ze,Me):X.get(Be,Se,Ue,Je)*oe.get(Be,Me,je,Ze)}C.set(ze,ue,xe,Se,Me)}return C.toTensor()},r.prototype.conv3dDerFilter=function(e,t,o){for(var a=o.strideDepth,i=o.strideHeight,s=o.strideWidth,u=o.filterDepth,f=o.filterHeight,C=o.filterWidth,k=Lt(o.filterShape,"float32"),L=k.values,X=k.strides,oe=X[0],ue=X[1],se=X[2],ce=X[3],xe=this.readSync(t.dataId),we=t.strides,Ee=we[0],Se=we[1],Me=we[2],ze=we[3],Be=this.readSync(e.dataId),je=e.strides,Ue=je[0],Ze=je[1],Je=je[2],ht=je[3],ft=o.padInfo.front,ut=o.padInfo.left,vt=o.padInfo.top,mt=0;mt<u;++mt)for(var lt=Math.max(0,Math.ceil((ft-mt)/a)),xt=Math.min(o.outDepth,(o.inDepth+ft-mt)/a),wt=mt*oe,Ot=0;Ot<f;++Ot)for(var Mt=Math.max(0,Math.ceil((vt-Ot)/i)),Pt=Math.min(o.outHeight,(o.inHeight+vt-Ot)/i),Kt=Ot*ue+wt,Yt=0;Yt<C;++Yt)for(var $t=Math.max(0,Math.ceil((ut-Yt)/s)),ar=Math.min(o.outWidth,(o.inWidth+ut-Yt)/s),er=Yt*se+Kt,ir=0;ir<o.inChannels;++ir)for(var jr=ir*ce+er,tr=0;tr<o.outChannels;++tr){for(var Er=0,fr=0;fr<o.batchSize;++fr)for(var Lr=fr*Ue,Mr=fr*Ee,Pr=lt;Pr<xt;++Pr)for(var zn=(mt+Pr*a-ft)*Ze+Lr,Gn=Pr*Se+Mr,mn=Mt;mn<Pt;++mn)for(var ja=(Ot+mn*i-vt)*Je+zn,io=mn*Me+Gn,No=$t;No<ar;++No){var so=No*ze+io;Er+=Be[(Yt+No*s-ut)*ht+ja+ir]*xe[so+tr]}L[jr+tr]=Er}return k.toTensor()},r.prototype.fusedDepthwiseConv2D=function(e){var t=e.input,o=e.filter,a=e.convInfo,i=e.bias,s=e.activation,u=e.preluActivationWeights,f=this.depthwiseConv2D(t,o,a);return i&&(f=this.add(f,i)),s&&(f=Ou(this,f,s,u)),f},r.prototype.depthwiseConv2D=function(e,t,o){pt([e,t],"depthwiseConv2D");for(var a=o.filterHeight,i=o.filterWidth,s=o.dilationHeight,u=o.dilationWidth,f=o.padInfo.left,C=o.padInfo.top,k=o.outChannels/o.inChannels,L=Lt(o.outShape,e.dtype),X=this.readSync(e.dataId),oe=this.readSync(t.dataId),ue=L.values,se=0;se<o.batchSize;++se)for(var ce=se*e.strides[0],xe=se*L.strides[0],we=0;we<o.outHeight;++we)for(var Ee=xe+we*L.strides[1],Se=we*o.strideHeight-f,Me=0;Me<a;++Me){var ze=Se+Me*s;if(!(ze<0||ze>=o.inHeight))for(var Be=Me*t.strides[0],je=ce+ze*e.strides[1],Ue=0;Ue<o.outWidth;++Ue)for(var Ze=Ee+Ue*L.strides[2],Je=Ue*o.strideWidth-C,ht=0;ht<i;++ht){var ft=Je+ht*u;if(!(ft<0||ft>=o.inWidth))for(var ut=Be+ht*t.strides[1],vt=je+ft*o.inChannels,mt=Ze,lt=ut,xt=0;xt<o.inChannels;++xt){for(var wt=X[vt+xt],Ot=0;Ot<k;++Ot)ue[mt+Ot]+=wt*oe[lt+Ot];mt+=k,lt+=k}}}return L.toTensor()},r.prototype.depthwiseConv2DDerInput=function(e,t,o){pt([e,t],"depthwiseConv2DDerInput");for(var a=Lt(o.inShape,"float32"),i=a.values,s=a.strides,u=s[0],f=s[1],C=s[2],k=this.readSync(e.dataId),L=e.strides,X=L[0],oe=L[1],ue=L[2],se=this.readSync(t.dataId),ce=t.strides,xe=ce[0],we=ce[1],Ee=ce[2],Se=o.batchSize,Me=o.filterHeight,ze=o.filterWidth,Be=o.inChannels,je=o.inHeight,Ue=o.inWidth,Ze=o.outChannels,Je=o.outHeight,ht=o.outWidth,ft=o.strideHeight,ut=o.strideWidth,vt=Me-1-o.padInfo.top,mt=ze-1-o.padInfo.left,lt=Ze/Be,xt=0;xt<Se;++xt)for(var wt=0;wt<Be;++wt)for(var Ot=0;Ot<je;++Ot)for(var Mt=Ot-vt,Pt=Math.max(0,Math.ceil(Mt/ft)),Kt=Math.min(Je,(Me+Mt)/ft),Yt=0;Yt<Ue;++Yt){for(var $t=Yt-mt,ar=Math.max(0,Math.ceil($t/ut)),er=Math.min(ht,(ze+$t)/ut),ir=0,jr=Pt;jr<Kt;++jr)for(var tr=jr*ft-Mt,Er=ar;Er<er;++Er)for(var fr=X*xt+oe*jr+ue*Er,Lr=xe*(Me-1-tr)+we*(ze-1-(Er*ut-$t))+Ee*wt,Mr=0;Mr<lt;++Mr)ir+=k[fr+(wt*lt+Mr)]*se[Lr+Mr];i[u*xt+f*Ot+C*Yt+wt]=ir}return a.toTensor()},r.prototype.depthwiseConv2DDerFilter=function(e,t,o){pt([e,t],"depthwiseConv2DDerFilter");for(var a=o.strideHeight,i=o.strideWidth,s=o.filterHeight,u=o.filterWidth,f=Lt(o.filterShape,"float32"),C=o.padInfo.left,k=o.padInfo.top,L=o.outChannels/o.inChannels,X=this.bufferSync(e),oe=this.bufferSync(t),ue=0;ue<s;++ue)for(var se=Math.max(0,Math.ceil((k-ue)/a)),ce=Math.min(o.outHeight,(o.inHeight+k-ue)/a),xe=0;xe<u;++xe)for(var we=Math.max(0,Math.ceil((C-xe)/i)),Ee=Math.min(o.outWidth,(o.inWidth+C-xe)/i),Se=0;Se<o.outChannels;++Se){for(var Me=Math.trunc(Se/L),ze=Se%L,Be=0,je=0;je<o.batchSize;++je)for(var Ue=se;Ue<ce;++Ue)for(var Ze=ue+Ue*a-k,Je=we;Je<Ee;++Je){var ht=xe+Je*i-C;Be+=X.get(je,Ze,ht,Me)*oe.get(je,Ue,Je,Se)}f.set(Be,ue,xe,Me,ze)}return f.toTensor()},r.prototype.tile=function(e,t){return pt(e,"tile"),os(this.bufferSync(e),t)},r.prototype.pad=function(e,t,o){pt(e,"pad");var a=t.map(function(L,X){return L[0]+e.shape[X]+L[1]}),i=t.map(function(L){return L[0]}),s=this.bufferSync(e),u=Lt(a,e.dtype);o!==0&&u.values.fill(o);for(var f=0;f<e.size;f++){var C=s.indexToLoc(f),k=C.map(function(L,X){return L+i[X]});u.set.apply(u,[s.get.apply(s,C)].concat(k))}return u.toTensor()},r.prototype.transpose=function(e,t){pt(e,"transpose");for(var o=new Array(e.rank),a=0;a<o.length;a++)o[a]=e.shape[t[a]];var i=this.readSync(e.dataId),s=Lt(o,e.dtype),u=this.bufferSync(e);for(a=0;a<e.size;++a){for(var f=u.indexToLoc(a),C=new Array(f.length),k=0;k<C.length;k++)C[k]=f[t[k]];var L=s.locToIndex(C);s.values[L]=i[a]}return s.toTensor()},r.prototype.gather=function(e,t,o){pt([e,t],"gather");var a=e.shape.slice(),i=this.readSync(t.dataId);a[o]=i.length;for(var s=Lt(a,e.dtype),u=this.bufferSync(e),f=0;f<s.size;++f){var C=s.indexToLoc(f),k=C.slice();k[o]=i[C[o]];var L=u.locToIndex(k);s.values[f]=u.values[L]}return s.toTensor()},r.prototype.batchToSpaceND=function(e,t,o){pt([e],"batchToSpaceND");var a=t.reduce(function(k,L){return k*L}),i=Wo(e.shape,t,a),s=qt(i.length,t.length),u=wa(e.shape,t,a),f=Gs(o,t.length),C=Vs(u,o,t.length);return e.reshape(i).transpose(s).reshape(u).slice(f,C)},r.prototype.spaceToBatchND=function(e,t,o){pt([e],"spaceToBatchND");var a=t.reduce(function(L,X){return L*X}),i=[[0,0]];i.push.apply(i,o);for(var s=1+t.length;s<e.shape.length;++s)i.push([0,0]);var u=e.pad(i),f=Wo(u.shape,t,a,!1),C=qt(f.length,t.length,!1),k=wa(u.shape,t,a,!1);return u.reshape(f).transpose(C).reshape(k)},r.prototype.pool=function(e,t,o){pt(e,"pool");for(var a=t.strideHeight,i=t.strideWidth,s=t.dilationHeight,u=t.dilationWidth,f=t.effectiveFilterHeight,C=t.effectiveFilterWidth,k=t.padInfo.top,L=t.padInfo.left,X=o==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,oe=this.readSync(e.dataId),ue=Lt(t.outShape,e.dtype),se=ue.values,ce=t.outShape[1]*t.outShape[2]*t.outShape[3],xe=t.outShape[2]*t.outShape[3],we=t.outShape[3],Ee=0;Ee<t.batchSize;++Ee)for(var Se=Ee*ce,Me=Ee*e.strides[0],ze=0;ze<t.inChannels;++ze)for(var Be=0;Be<t.outHeight;++Be)for(var je=Be*a-k,Ue=Math.max(0,je),Ze=Math.min(t.inHeight,f+je),Je=Se+Be*xe,ht=0;ht<t.outWidth;++ht){for(var ft=ht*i-L,ut=Math.max(0,ft),vt=Math.min(t.inWidth,C+ft),mt=X,lt=0,xt=0,wt=Ue;wt<Ze;wt+=s){for(var Ot=Me+wt*e.strides[1],Mt=ut;Mt<vt;Mt+=u){var Pt=oe[Ot+Mt*e.strides[2]+ze];o==="max"&&Pt>mt?mt=Pt:o==="avg"&&(lt+=Pt,xt++)}if(isNaN(mt))break}se[Je+ht*we+ze]=o==="avg"?lt/xt:mt}return ue.toTensor()},r.prototype.maxPool=function(e,t){return this.pool(e,t,"max")},r.prototype.maxPoolPositions=function(e,t){for(var o=Lt(t.outShape,"int32"),a=t.strideHeight,i=t.strideWidth,s=t.dilationHeight,u=t.dilationWidth,f=t.effectiveFilterHeight,C=t.effectiveFilterWidth,k=t.padInfo.top,L=t.padInfo.left,X=this.bufferSync(e),oe=0;oe<t.batchSize;++oe)for(var ue=0;ue<t.inChannels;++ue)for(var se=0;se<t.outHeight;++se){for(var ce=se*a-k,xe=ce;xe<0;)xe+=s;for(var we=Math.min(t.inHeight,f+ce),Ee=0;Ee<t.outWidth;++Ee){for(var Se=Ee*i-L,Me=Se;Me<0;)Me+=u;for(var ze=Math.min(t.inWidth,C+Se),Be=Number.NEGATIVE_INFINITY,je=-1,Ue=xe;Ue<we;Ue+=s)for(var Ze=Ue-ce,Je=Me;Je<ze;Je+=u){var ht=Je-Se,ft=X.get(oe,Ue,Je,ue);ft>Be&&(Be=ft,je=Ze*C+ht)}o.set(je,oe,se,Ee,ue)}}return o.toTensor()},r.prototype.maxPoolBackprop=function(e,t,o,a){pt([t,o],"maxPoolBackprop");for(var i=this.maxPoolPositions(t,a),s=a.strideHeight,u=a.strideWidth,f=a.dilationHeight,C=a.dilationWidth,k=a.effectiveFilterHeight,L=a.effectiveFilterWidth,X=L-1-a.padInfo.left,oe=k-1-a.padInfo.top,ue=Lt(t.shape,"float32"),se=this.bufferSync(i),ce=this.bufferSync(e),xe=0;xe<a.batchSize;++xe)for(var we=0;we<a.inChannels;++we)for(var Ee=0;Ee<a.inHeight;++Ee)for(var Se=0;Se<a.inWidth;++Se){for(var Me=Ee-oe,ze=Se-X,Be=0,je=0;je<k;je+=f){var Ue=(Me+je)/s;if(!(Ue<0||Ue>=a.outHeight||Math.floor(Ue)!==Ue))for(var Ze=0;Ze<L;Ze+=C){var Je=(ze+Ze)/u;if(!(Je<0||Je>=a.outWidth||Math.floor(Je)!==Je)){var ht=k*L-1-se.get(xe,Ue,Je,we)===je*L+Ze?1:0;ht!==0&&(Be+=ce.get(xe,Ue,Je,we)*ht)}}}ue.set(Be,xe,Ee,Se,we)}return ue.toTensor()},r.prototype.avgPoolBackprop=function(e,t,o){pt([e,t],"avgPoolBackprop");for(var a=o.strideHeight,i=o.strideWidth,s=o.filterHeight,u=o.filterWidth,f=o.dilationHeight,C=o.dilationWidth,k=o.effectiveFilterHeight,L=o.effectiveFilterWidth,X=L-1-o.padInfo.left,oe=k-1-o.padInfo.top,ue=Lt(t.shape,"float32"),se=1/(s*u),ce=this.bufferSync(e),xe=0;xe<o.batchSize;++xe)for(var we=0;we<o.inChannels;++we)for(var Ee=0;Ee<o.inHeight;++Ee)for(var Se=0;Se<o.inWidth;++Se){for(var Me=Ee-oe,ze=Se-X,Be=0,je=0;je<k;je+=f){var Ue=(Me+je)/a;if(!(Ue<0||Ue>=o.outHeight||Math.floor(Ue)!==Ue))for(var Ze=0;Ze<L;Ze+=C){var Je=(ze+Ze)/i;Je<0||Je>=o.outWidth||Math.floor(Je)!==Je||(Be+=ce.get(xe,Ue,Je,we))}}ue.set(Be*se,xe,Ee,Se,we)}return ue.toTensor()},r.prototype.pool3d=function(e,t,o){pt(e,"pool3d");for(var a=t.strideDepth,i=t.strideHeight,s=t.strideWidth,u=t.dilationDepth,f=t.dilationHeight,C=t.dilationWidth,k=t.effectiveFilterDepth,L=t.effectiveFilterHeight,X=t.effectiveFilterWidth,oe=t.padInfo.front,ue=t.padInfo.top,se=t.padInfo.left,ce=o==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,xe=this.readSync(e.dataId),we=Lt(t.outShape,e.dtype),Ee=we.values,Se=t.outShape[1]*t.outShape[2]*t.outShape[3]*t.outShape[4],Me=t.outShape[2]*t.outShape[3]*t.outShape[4],ze=t.outShape[3]*t.outShape[4],Be=t.outShape[4],je=0;je<t.batchSize;++je)for(var Ue=je*Se,Ze=je*e.strides[0],Je=0;Je<t.inChannels;++Je)for(var ht=0;ht<t.outDepth;++ht){for(var ft=ht*a-oe,ut=ft;ut<0;)ut+=u;for(var vt=Math.min(t.inDepth,k+ft),mt=Ue+ht*Me,lt=0;lt<t.outHeight;++lt){for(var xt=lt*i-ue,wt=xt;wt<0;)wt+=f;for(var Ot=Math.min(t.inHeight,L+xt),Mt=mt+lt*ze,Pt=0;Pt<t.outWidth;++Pt){for(var Kt=Pt*s-se,Yt=Kt;Yt<0;)Yt+=C;for(var $t=Math.min(t.inWidth,X+Kt),ar=Mt+Pt*Be,er=ce,ir=0,jr=0,tr=ut;tr<vt;tr+=u){for(var Er=Ze+tr*e.strides[1],fr=wt;fr<Ot;fr+=f){for(var Lr=Er+fr*e.strides[2],Mr=Yt;Mr<$t;Mr+=C){var Pr=xe[Lr+Mr*e.strides[3]+Je];if(o==="max"&&Pr>er?er=Pr:o==="avg"&&(ir+=Pr,jr++),isNaN(er))break}if(isNaN(er))break}if(isNaN(er))break}Ee[ar+Je]=o==="avg"?ir/jr:er}}}return we.toTensor()},r.prototype.avgPool3d=function(e,t){return pt(e,"avgPool3d"),this.pool3d(e,t,"avg").toFloat()},r.prototype.avgPool3dBackprop=function(e,t,o){pt([e,t],"avgPool3dBackprop");for(var a=o.strideDepth,i=o.strideHeight,s=o.strideWidth,u=o.filterDepth,f=o.filterHeight,C=o.filterWidth,k=o.dilationDepth,L=o.dilationHeight,X=o.dilationWidth,oe=o.effectiveFilterDepth,ue=o.effectiveFilterHeight,se=o.effectiveFilterWidth,ce=oe-1-o.padInfo.front,xe=se-1-o.padInfo.left,we=ue-1-o.padInfo.top,Ee=Lt(t.shape,"float32"),Se=1/(u*f*C),Me=this.bufferSync(e),ze=0;ze<o.batchSize;++ze)for(var Be=0;Be<o.inChannels;++Be)for(var je=0;je<o.inDepth;++je)for(var Ue=0;Ue<o.inHeight;++Ue)for(var Ze=0;Ze<o.inWidth;++Ze){for(var Je=je-ce,ht=Ue-we,ft=Ze-xe,ut=0,vt=0;vt<oe;vt+=k){var mt=(Je+vt)/a;if(!(mt<0||mt>=o.outDepth||Math.floor(mt)!==mt))for(var lt=0;lt<ue;lt+=L){var xt=(ht+lt)/i;if(!(xt<0||xt>=o.outHeight||Math.floor(xt)!==xt))for(var wt=0;wt<se;wt+=X){var Ot=(ft+wt)/s;Ot<0||Ot>=o.outWidth||Math.floor(Ot)!==Ot||(ut+=Me.get(ze,mt,xt,Ot,Be))}}}Ee.set(ut*Se,ze,je,Ue,Ze,Be)}return Ee.toTensor()},r.prototype.maxPool3d=function(e,t){return pt(e,"maxPool3d"),this.pool3d(e,t,"max").toFloat()},r.prototype.maxPool3dPositions=function(e,t){for(var o=Lt(t.outShape,"int32"),a=t.strideDepth,i=t.strideHeight,s=t.strideWidth,u=t.dilationDepth,f=t.dilationHeight,C=t.dilationWidth,k=t.effectiveFilterDepth,L=t.effectiveFilterHeight,X=t.effectiveFilterWidth,oe=t.padInfo.front,ue=t.padInfo.top,se=t.padInfo.left,ce=this.bufferSync(e),xe=0;xe<t.batchSize;++xe)for(var we=0;we<t.inChannels;++we)for(var Ee=0;Ee<t.outDepth;++Ee){for(var Se=Ee*a-oe,Me=Se;Me<0;)Me+=u;for(var ze=Math.min(t.inDepth,k+Se),Be=0;Be<t.outHeight;++Be){for(var je=Be*i-ue,Ue=je;Ue<0;)Ue+=f;for(var Ze=Math.min(t.inHeight,L+je),Je=0;Je<t.outWidth;++Je){for(var ht=Je*s-se,ft=ht;ft<0;)ft+=C;for(var ut=Math.min(t.inWidth,X+ht),vt=Number.NEGATIVE_INFINITY,mt=-1,lt=Me;lt<ze;lt+=u)for(var xt=lt-Se,wt=Ue;wt<Ze;wt+=f)for(var Ot=wt-je,Mt=ft;Mt<ut;Mt+=C){var Pt=Mt-ht,Kt=ce.get(xe,lt,wt,Mt,we);Kt>=vt&&(vt=Kt,mt=xt*L*X+Ot*L+Pt)}o.set(mt,xe,Ee,Be,Je,we)}}}return o.toTensor()},r.prototype.maxPool3dBackprop=function(e,t,o,a){pt([t,o],"maxPool3dBackprop");for(var i=this.maxPool3dPositions(t,a),s=a.strideDepth,u=a.strideHeight,f=a.strideWidth,C=a.dilationDepth,k=a.dilationHeight,L=a.dilationWidth,X=a.effectiveFilterDepth,oe=a.effectiveFilterHeight,ue=a.effectiveFilterWidth,se=X-1-a.padInfo.front,ce=ue-1-a.padInfo.left,xe=oe-1-a.padInfo.top,we=Lt(t.shape,"float32"),Ee=this.bufferSync(i),Se=this.bufferSync(e),Me=0;Me<a.batchSize;++Me)for(var ze=0;ze<a.inChannels;++ze)for(var Be=0;Be<a.inDepth;++Be)for(var je=0;je<a.inHeight;++je)for(var Ue=0;Ue<a.inWidth;++Ue){for(var Ze=Be-se,Je=je-xe,ht=Ue-ce,ft=0,ut=0;ut<X;ut+=C){var vt=(Ze+ut)/s;if(!(vt<0||vt>=a.outDepth||Math.floor(vt)!==vt))for(var mt=0;mt<oe;mt+=k){var lt=(Je+mt)/u;if(!(lt<0||lt>=a.outHeight||Math.floor(lt)!==lt))for(var xt=0;xt<ue;xt+=L){var wt=(ht+xt)/f;if(!(wt<0||wt>=a.outWidth||Math.floor(wt)!==wt)){var Ot=X*oe*ue-1-Ee.get(Me,vt,lt,wt,ze)===ut*oe*ue+mt*ue+xt?1:0;Ot!==0&&(ft+=Se.get(Me,vt,lt,wt,ze)*Ot)}}}}we.set(ft,Me,Be,je,Ue,ze)}return we.toTensor()},r.prototype.cast=function(e,t){return ci(e,t,this)},r.prototype.reshape=function(e,t){return Aa(e,t)},r.prototype.avgPool=function(e,t){return pt(e,"avgPool"),this.pool(e,t,"avg").toFloat()},r.prototype.resizeBilinear=function(e,t,o,a){pt(e,"resizeBilinear");for(var i=e.shape,s=i[0],u=i[1],f=i[2],C=i[3],k=this.readSync(e.dataId),L=new Float32Array(le([s,t,o,C])),X=[a&&t>1?u-1:u,a&&o>1?f-1:f],oe=[a&&t>1?t-1:t,a&&o>1?o-1:o],ue=0,se=X[0]/oe[0],ce=X[1]/oe[1],xe=0;xe<s;xe++)for(var we=0;we<t;we++)for(var Ee=se*we,Se=Math.floor(Ee),Me=Ee-Se,ze=Math.min(u-1,Math.ceil(Ee)),Be=xe*e.strides[0]+Se*e.strides[1],je=xe*e.strides[0]+ze*e.strides[1],Ue=0;Ue<o;Ue++)for(var Ze=ce*Ue,Je=Math.floor(Ze),ht=Ze-Je,ft=Math.min(f-1,Math.ceil(Ze)),ut=Be+Je*e.strides[2],vt=je+Je*e.strides[2],mt=Be+ft*e.strides[2],lt=je+ft*e.strides[2],xt=0;xt<C;xt++){var wt=k[ut+xt],Ot=k[vt+xt],Mt=wt+(k[mt+xt]-wt)*ht,Pt=Mt+(Ot+(k[lt+xt]-Ot)*ht-Mt)*Me;L[ue++]=Pt}return Ur(L,[s,t,o,C])},r.prototype.resizeBilinearBackprop=function(e,t,o){pt([e,t],"resizeBilinearBackprop");for(var a=t.shape,i=a[0],s=a[1],u=a[2],f=a[3],C=e.shape,k=C[1],L=C[2],X=new Float32Array(i*s*u*f),oe=[o&&k>1?s-1:s,o&&L>1?u-1:u],ue=[o&&k>1?k-1:k,o&&L>1?L-1:L],se=oe[0]/ue[0],ce=oe[1]/ue[1],xe=this.readSync(e.dataId),we=0,Ee=0;Ee<i;Ee++)for(var Se=Ee*t.strides[0],Me=0;Me<k;Me++)for(var ze=Me*se,Be=Math.floor(ze),je=Math.min(Math.ceil(ze),s-1),Ue=Se+Be*t.strides[1],Ze=Se+je*t.strides[1],Je=ze-Be,ht=1-Je,ft=0;ft<L;ft++)for(var ut=ft*ce,vt=Math.floor(ut),mt=Math.min(Math.ceil(ut),u-1),lt=ut-vt,xt=1-lt,wt=Ue+vt*t.strides[2],Ot=Ue+mt*t.strides[2],Mt=Ze+vt*t.strides[2],Pt=Ze+mt*t.strides[2],Kt=ht*xt,Yt=ht*lt,$t=Je*xt,ar=Je*lt,er=0;er<f;er++){var ir=xe[we++];X[wt+er]+=ir*Kt,X[Ot+er]+=ir*Yt,X[Mt+er]+=ir*$t,X[Pt+er]+=ir*ar}return kn(X,[i,u,s,f],t.dtype)},r.prototype.resizeNearestNeighbor=function(e,t,o,a){pt(e,"resizeNearestNeighbor");for(var i=e.shape,s=i[0],u=i[1],f=i[2],C=i[3],k=this.readSync(e.dataId),L=new Float32Array(s*t*o*C),X=[a&&t>1?u-1:u,a&&o>1?f-1:f],oe=[a&&t>1?t-1:t,a&&o>1?o-1:o],ue=X[0]/oe[0],se=X[1]/oe[1],ce=0,xe=0;xe<s;xe++)for(var we=xe*e.strides[0],Ee=0;Ee<t;Ee++)for(var Se=ue*Ee,Me=we+Math.min(u-1,a?Math.round(Se):Math.floor(Se))*e.strides[1],ze=0;ze<o;ze++)for(var Be=se*ze,je=Me+Math.min(f-1,a?Math.round(Be):Math.floor(Be))*e.strides[2],Ue=0;Ue<C;Ue++){var Ze=k[je+Ue];L[ce++]=Ze}return Ur(L,[s,t,o,C],e.dtype)},r.prototype.resizeNearestNeighborBackprop=function(e,t,o){pt([e,t],"resizeNearestNeighborBackprop");for(var a=t.shape,i=a[0],s=a[1],u=a[2],f=a[3],C=e.shape,k=C[1],L=C[2],X=new Float32Array(i*s*u*f),oe=this.readSync(e.dataId),ue=[o&&k>1?s-1:s,o&&L>1?u-1:u],se=[o&&k>1?k-1:k,o&&L>1?L-1:L],ce=ue[0]/se[0],xe=ue[1]/se[1],we=1/ce,Ee=1/xe,Se=2*Math.ceil(we)+2,Me=2*Math.ceil(Ee)+2,ze=0;ze<i;ze++)for(var Be=ze*t.strides[0],je=0;je<s;je++)for(var Ue=Be+je*t.strides[1],Ze=Math.floor(je*we),Je=Math.floor(Ze-Se/2),ht=0;ht<u;ht++)for(var ft=Ue+ht*t.strides[2],ut=Math.floor(ht*Ee),vt=Math.floor(ut-Me/2),mt=0;mt<f;mt++){for(var lt=0,xt=0;xt<Se;xt++){var wt=xt+Je;if(!(wt<0||wt>=k)){var Ot=Be+wt*e.strides[1],Mt=wt*ce;if(je===Math.min(s-1,o?Math.round(Mt):Math.floor(Mt)))for(var Pt=0;Pt<Me;Pt++){var Kt=Pt+vt;if(!(Kt<0||Kt>=L)){var Yt=Ot+Kt*e.strides[2],$t=Kt*xe;ht===Math.min(u-1,o?Math.round($t):Math.floor($t))&&(lt+=oe[Yt+mt])}}}}X[ft+mt]=lt}return kn(X,t.shape,t.dtype)},r.prototype.batchNormalization=function(e,t,o,a,i,s){pt([e,t,o,i,s],"batchNorm");for(var u=this.readSync(e.dataId),f=this.readSync(t.dataId),C=this.readSync(o.dataId),k=i?this.readSync(i.dataId):new Float32Array([1]),L=s?this.readSync(s.dataId):new Float32Array([0]),X=new Float32Array(u.length),oe=L.length,ue=k.length,se=C.length,ce=f.length,xe=0,we=0,Ee=0,Se=0,Me=0;Me<u.length;++Me)X[Me]=L[xe++]+(u[Me]-f[we++])*k[Ee++]/Math.sqrt(C[Se++]+a),xe>=oe&&(xe=0),we>=ce&&(we=0),Ee>=ue&&(Ee=0),Se>=se&&(Se=0);return kn(X,e.shape)},r.prototype.localResponseNormalization4D=function(e,t,o,a,i){pt(e,"localResponseNormalization4D");var s=e.shape[3],u=s-1,f=this.readSync(e.dataId),C=e.size,k=new Float32Array(C);function L(se){for(var ce=se%s,xe=se-ce+Math.max(0,ce-t),we=se-ce+Math.min(ce+t,u),Ee=0;xe<=we;xe++){var Se=f[xe];Ee+=Se*Se}return Ee}for(var X=0;X<C;X++){var oe=L(X),ue=f[X]*Math.pow(o+a*oe,-i);k[X]=ue}return kn(k,e.shape)},r.prototype.LRNGrad=function(e,t,o,a,i,s,u){pt(e,"LRNGrad");for(var f=e.shape[3],C=this.readSync(e.dataId),k=this.readSync(t.dataId),L=this.readSync(o.dataId),X=new Float32Array(e.size),oe=e.size,ue=0;ue<oe;ue++){for(var se=ue%f,ce=ue-se+Math.max(0,se-a),xe=ue-se+Math.min(f,se+a+1),we=0,Ee=ce;Ee<xe;Ee++)we+=Math.pow(k[Ee],2);for(we=s*we+i,Ee=ce;Ee<xe;Ee++){var Se=-2*s*u*k[Ee]*L[ue]/we;ue===Ee&&(Se+=Math.pow(we,-u)),Se*=C[ue],X[Ee]+=Se}}return kn(X,e.shape)},r.prototype.multinomial=function(e,t,o,a){pt(e,"multinomial");for(var i=t?e:zo(e),s=i.shape[0],u=i.shape[1],f=Tr([s,o],"int32"),C=this.readSync(f.dataId),k=this.readSync(i.dataId),L=0;L<s;++L){var X=L*u,oe=new Float32Array(u-1);oe[0]=k[X];for(var ue=1;ue<oe.length;++ue)oe[ue]=oe[ue-1]+k[X+ue];for(var se=Uo(a.toString()),ce=L*o,xe=0;xe<o;++xe){var we=se();C[ce+xe]=oe.length;for(var Ee=0;Ee<oe.length;Ee++)if(we<oe[Ee]){C[ce+xe]=Ee;break}}}return f},r.prototype.oneHot=function(e,t,o,a){pt(e,"oneHot");var i=new Float32Array(e.size*t);i.fill(a);for(var s=this.readSync(e.dataId),u=0;u<e.size;++u)s[u]>=0&&s[u]<t&&(i[u*t+s[u]]=o);return Zn(i,[e.size,t],"int32")},r.prototype.nonMaxSuppression=function(e,t,o,a,i){return pt(e,"nonMaxSuppression"),li(this.readSync(e.dataId),this.readSync(t.dataId),o,a,i)},r.prototype.fft=function(e){return this.fftBatch(e,!1)},r.prototype.ifft=function(e){return this.fftBatch(e,!0)},r.prototype.fftBatch=function(e,t){for(var o=e.shape[0],a=e.shape[1],i=Lt(e.shape,"float32"),s=Lt(e.shape,"float32"),u=un(e).as2D(o,a),f=xn(e).as2D(o,a),C=0;C<o;C++)for(var k=u.slice([C,0],[1,a]),L=f.slice([C,0],[1,a]),X=xr(k,L),oe=this.readSync(this.fftImpl(X,t).dataId),ue=0;ue<a;ue++){var se=es(oe,ue);i.values[C*a+ue]=se.real,s.values[C*a+ue]=se.imag}return xr(i.toTensor(),s.toTensor()).as2D(o,a)},r.prototype.fftImpl=function(e,t){var o=e.as1D(),a=o.size;if(this.isExponentOf2(a)){var i=this.fftRadix2(o,a,t).as2D(e.shape[0],e.shape[1]);return t&&(i=xr(un(i).div(Nt(a)),xn(i).div(Nt(a)))),i}var s=this.readSync(e.dataId),u=function(f){for(var C=new Float32Array(f.length/2),k=new Float32Array(f.length/2),L=0;L<f.length;L+=2)C[L/2]=f[L],k[L/2]=f[L+1];return{real:C,imag:k}}(this.fourierTransformByMatmul(s,a,t));return xr(u.real,u.imag).as2D(e.shape[0],e.shape[1])},r.prototype.isExponentOf2=function(e){return(e&e-1)==0},r.prototype.fftRadix2=function(e,t,o){if(t===1)return e;var a=this.readSync(e.dataId),i=t/2,s=function(ce){for(var xe=Math.ceil(ce.length/4),we=new Float32Array(xe),Ee=new Float32Array(xe),Se=0;Se<ce.length;Se+=4)we[Math.floor(Se/4)]=ce[Se],Ee[Math.floor(Se/4)]=ce[Se+1];return{real:we,imag:Ee}}(a),u=xr(s.real,s.imag).as1D(),f=function(ce){for(var xe=Math.floor(ce.length/4),we=new Float32Array(xe),Ee=new Float32Array(xe),Se=2;Se<ce.length;Se+=4)we[Math.floor(Se/4)]=ce[Se],Ee[Math.floor(Se/4)]=ce[Se+1];return{real:we,imag:Ee}}(a),C=xr(f.real,f.imag).as1D();u=this.fftRadix2(u,i,o),C=this.fftRadix2(C,i,o);var k=function(ce,xe){for(var we=new Float32Array(ce/2),Ee=new Float32Array(ce/2),Se=0;Se<Math.ceil(ce/2);Se++){var Me=(xe?2:-2)*Math.PI*(Se/ce);we[Se]=Math.cos(Me),Ee[Se]=Math.sin(Me)}return{real:we,imag:Ee}}(t,o),L=xr(k.real,k.imag).mul(C),X=u.add(L),oe=u.sub(L),ue=un(X).concat(un(oe)),se=xn(X).concat(xn(oe));return xr(ue,se).as1D()},r.prototype.fourierTransformByMatmul=function(e,t,o){for(var a=new Float32Array(2*t),i=0;i<t;i++){for(var s=0,u=0,f=0;f<t;f++){var C=Zs(i*f,t,o),k=es(e,f);s+=k.real*C.real-k.imag*C.imag,u+=k.real*C.imag+k.imag*C.real}o&&(s/=t,u/=t),Qs(a,s,u,i)}return a},r.prototype.depthToSpace=function(e,t,o){_(o==="NHWC",function(){return"Only NHWC dataFormat supported on CPU for depthToSpace. Got "+o}),_(t>1,function(){return"blockSize should be > 1 for depthToSpace, but was: "+t});for(var a=e.shape[0],i=e.shape[1],s=e.shape[2],u=e.shape[3],f=i*t,C=s*t,k=u/(t*t),L=this.readSync(e.dataId),X=new Float32Array(a*f*C*k),oe=0,ue=0;ue<a;++ue)for(var se=0;se<f;++se)for(var ce=Math.floor(se/t),xe=se%t,we=0;we<C;++we)for(var Ee=Math.floor(we/t),Se=(xe*t+we%t)*k,Me=0;Me<k;++Me){var ze=Me+Se+u*(Ee+s*(ce+i*ue));X[oe++]=L[ze]}return kn(X,[a,f,C,k])},r.prototype.broadcastedBinaryOp=function(e,t,o,a){var i=Ht(e.shape,t.shape),s=Lt(i,o),u=this.readSync(e.dataId),f=this.readSync(t.dataId),C=En(e.shape,i),k=En(t.shape,i),L=s.values;if(C.length+k.length===0)for(var X=0;X<L.length;++X)L[X]=a(u[X%u.length],f[X%f.length]);else{var oe=this.bufferSync(e),ue=this.bufferSync(t),se=function(ce){var xe=s.indexToLoc(ce),we=xe.slice(-e.rank);C.forEach(function(ze){return we[ze]=0});var Ee=oe.locToIndex(we),Se=xe.slice(-t.rank);k.forEach(function(ze){return Se[ze]=0});var Me=ue.locToIndex(Se);L[ce]=a(u[Ee],f[Me])};for(X=0;X<L.length;++X)se(X)}return s.toTensor()},r.prototype.broadcastedBinaryComplexOp=function(e,t,o){var a=Ht(e.shape,t.shape),i=Lt(a,"float32"),s=Lt(a,"float32"),u=this.readSync(e.dataId),f=this.readSync(t.dataId),C=En(e.shape,a),k=En(t.shape,a),L=i.values,X=s.values;if(C.length+k.length===0)for(var oe=0;oe<L.length;oe++){var ue=oe%u.length,se=oe%f.length,ce=o(u[2*ue],u[2*ue+1],f[2*se],f[2*se+1]);L[oe]=ce.real,X[oe]=ce.imag}else{var xe=this.bufferSync(this.data.get(e.dataId).complexTensors.real),we=this.bufferSync(this.data.get(t.dataId).complexTensors.real),Ee=function(Se){var Me=i.indexToLoc(Se),ze=Me.slice(-e.rank);C.forEach(function(Je){return ze[Je]=0});var Be=xe.locToIndex(ze),je=Me.slice(-t.rank);k.forEach(function(Je){return je[Je]=0});var Ue=we.locToIndex(je),Ze=o(u[2*Be],u[2*Be+1],f[2*Ue],f[2*Ue+1]);L[Se]=Ze.real,X[Se]=Ze.imag};for(oe=0;oe<L.length;oe++)Ee(oe)}return this.complex(i.toTensor(),s.toTensor())},r.prototype.split=function(e,t,o){return ns(e,t,o)},r.prototype.dispose=function(){},r.prototype.floatPrecision=function(){return 32},r.prototype.epsilon=function(){return 1e-7},r.prototype.cropAndResize=function(e,t,o,a,i,s){for(var u=e.shape,f=u[0],C=u[1],k=u[2],L=u[3],X=t.shape[0],oe=a[0],ue=a[1],se=Lt([X,oe,ue,L],"float32"),ce=this.readSync(t.dataId),xe=this.readSync(o.dataId),we=this.readSync(e.dataId),Ee=e.strides,Se=se.strides,Me=0;Me<X;Me++){var ze=4*Me,Be=ce[ze],je=ce[ze+1],Ue=ce[ze+2],Ze=ce[ze+3],Je=xe[Me];if(!(Je>=f))for(var ht=oe>1?(Ue-Be)*(C-1)/(oe-1):0,ft=ue>1?(Ze-je)*(k-1)/(ue-1):0,ut=0;ut<oe;ut++){var vt=oe>1?Be*(C-1)+ut*ht:.5*(Be+Ue)*(C-1);if(vt<0||vt>C-1)for(var mt=0;mt<ue;mt++)for(var lt=0;lt<L;lt++){var xt=lt+mt*Se[2]+ut*Se[1]+Me*Se[0];se.values[xt]=s}else if(i==="bilinear"){var wt=Math.floor(vt),Ot=Math.ceil(vt),Mt=vt-wt;for(mt=0;mt<ue;mt++)if((tr=ue>1?je*(k-1)+mt*ft:.5*(je+Ze)*(k-1))<0||tr>k-1)for(lt=0;lt<L;lt++)xt=lt+mt*Se[2]+ut*Se[1]+Me*Se[0],se.values[xt]=s;else{var Pt=Math.floor(tr),Kt=Math.ceil(tr),Yt=tr-Pt;for(lt=0;lt<L;lt++){var $t=we[xt=lt+Pt*Ee[2]+wt*Ee[1]+Je*Ee[0]],ar=we[xt=lt+Kt*Ee[2]+wt*Ee[1]+Je*Ee[0]],er=we[xt=lt+Pt*Ee[2]+Ot*Ee[1]+Je*Ee[0]],ir=$t+(ar-$t)*Yt,jr=er+(we[xt=lt+Kt*Ee[2]+Ot*Ee[1]+Je*Ee[0]]-er)*Yt;xt=lt+mt*Se[2]+ut*Se[1]+Me*Se[0],se.values[xt]=ir+(jr-ir)*Mt}}}else for(mt=0;mt<ue;++mt){var tr;if((tr=ue>1?je*(k-1)+mt*ft:.5*(je+Ze)*(k-1))<0||tr>k-1)for(lt=0;lt<L;lt++)xt=lt+mt*Se[2]+ut*Se[1]+Me*Se[0],se.values[xt]=s;else{var Er=Math.round(tr),fr=Math.round(vt);for(lt=0;lt<L;lt++){var Lr=lt+Er*Ee[2]+fr*Ee[1]+Je*Ee[0],Mr=lt+mt*Se[2]+ut*Se[1]+Me*Se[0];se.values[Mr]=we[Lr]}}}}}return se.toTensor()},r.prototype.sparseToDense=function(e,t,o,a){var i=Ho(0,e,o),s=i.sliceRank,u=i.numUpdates,f=i.sliceSize,C=i.strides,k=i.outputSize;return this.scatter(e,t,o,k,f,u,s,C,a,!1)},r.prototype.gatherND=function(e,t){var o=t.shape,a=o[o.length-1],i=Xi(e,t),s=i[0],u=i[1],f=i[2],C=i[3];if(u===0)return Ur([],s,e.dtype);for(var k=new Nr([u,f],e.dtype),L=this.readSync(t.dataId),X=this.readSync(e.dataId),oe=0;oe<u;oe++){for(var ue=[],se=0,ce=0;ce<a;ce++){var xe=L[oe*a+ce];se+=xe*C[ce],ue.push(xe)}if(se<0||se>=e.size/f)throw new Error("Invalid indices: "+ue+" does not index into "+e.shape);for(var we=0;we<f;we++)k.values[oe*f+we]=X[se*f+we]}return k.toTensor().reshape(s)},r.prototype.scatterND=function(e,t,o){var a=Ho(0,e,o),i=a.sliceRank,s=a.numUpdates,u=a.sliceSize,f=a.strides,C=a.outputSize,k=Nt(0);return this.scatter(e,t,o,C,u,s,i,f,k,!0)},r.prototype.fill=function(e,t,o){var a=De(o=o||ot(t),le(e));return a.fill(t),Ve.makeTensor(a,e,o,this)},r.prototype.onesLike=function(e){if(e.dtype==="string")throw new Error("onesLike is not supported for string tensors");return this.fill(e.shape,1,e.dtype)},r.prototype.zerosLike=function(e){var t=De(e.dtype,le(e.shape));return this.makeOutput(t,e.shape,e.dtype)},r.prototype.linspace=function(e,t,o){return Zi(e,t,o)},r.prototype.scatter=function(e,t,o,a,i,s,u,f,C,k){var L=[a/i,i],X=this.readSync(e.dataId),oe=this.readSync(t.dataId);if(a===0)return Ur([],o,t.dtype);var ue=new Nr(L,t.dtype);ue.values.fill(this.readSync(C.dataId)[0]);for(var se=0;se<s;se++){for(var ce=[],xe=0,we=0;we<u;we++){var Ee=X[se*u+we];ce.push(Ee),xe+=Ee*f[we]}if(xe<0||xe>=a/i)throw new Error("Invalid indices: "+ce+" does not index into "+o);for(var Se=0;Se<i;Se++)k?ue.values[xe*i+Se]+=oe[se*i+Se]:ue.values[xe*i+Se]=t.rank===0?oe[0]:oe[se*i+Se]}return ue.toTensor().reshape(o)},r}(Ca);Ve.registerBackend("cpu",function(){return new wp},1);for(var Ru=0,Dl=[{kernelName:"NonMaxSuppressionV5",backendName:"cpu",kernelFunc:function(n){var r=n.inputs,e=n.backend,t=n.attrs,o=r,a=o.boxes,i=o.scores,s=t,u=s.maxOutputSize,f=s.iouThreshold,C=s.scoreThreshold,k=s.softNmsSigma,L=e;pt(a,"NonMaxSuppressionWithScore");var X=di(L.data.get(a.dataId).values,L.data.get(i.dataId).values,u,f,C,k);return[X.selectedIndices,X.selectedScores]}},{kernelName:"Square",backendName:"cpu",kernelFunc:function(n){var r=n.inputs,e=n.backend,t=r.x,o=e;pt(t,"square");for(var a=o.data.get(t.dataId).values,i=new Float32Array(a.length),s=0;s<a.length;++s){var u=a[s];i[s]=u*u}return{dataId:o.write(i,t.shape,t.dtype),shape:t.shape,dtype:t.dtype}}},{kernelName:wi,backendName:"cpu",kernelFunc:function(n){var r=n.inputs,e=n.backend,t=r,o=t.a,a=t.b,i=e;pt([o,a],wi);var s=i.data.get(o.dataId).values,u=i.data.get(a.dataId).values,f=function(L,X,oe,ue,se,ce){var xe=Ht(L,X),we=xe.length,Ee=Ke(xe),Se=Ce(se,le(xe)),Me=L.length,ze=X.length,Be=Ke(L),je=Ke(X),Ue=En(L,xe),Ze=En(X,xe);if(Ue.length+Ze.length===0)for(var Je=0;Je<Se.length;++Je)Se[Je]=ce(oe[Je%oe.length],ue[Je%ue.length]);else{var ht=function(ft){var ut=st(ft,we,Ee),vt=ut.slice(-Me);Ue.forEach(function(wt){return vt[wt]=0});var mt=nt(vt,Me,Be),lt=ut.slice(-ze);Ze.forEach(function(wt){return lt[wt]=0});var xt=nt(lt,ze,je);Se[ft]=ce(oe[mt],ue[xt])};for(Je=0;Je<Se.length;++Je)ht(Je)}return[Se,xe]}(o.shape,a.shape,s,u,o.dtype,function(L,X){var oe=L-X;return oe*oe}),C=f[0],k=f[1];return{dataId:i.write(C,k,o.dtype),shape:k,dtype:o.dtype}}}];Ru<Dl.length;Ru++)Q(Dl[Ru]);for(var Da,Ep=function(n){this.variableNames=["A"];var r=Kr(),e=n[0],t=n[1];this.outputShape=n,this.userCode=`
void main() {
ivec3 coords = getOutputCoords();
int texR = coords[0];
int texC = coords[1];
int depth = coords[2];
vec2 uv = (vec2(texC, texR) + halfCR) / vec2(`+t+".0, "+e+`.0);
vec4 values = `+r.texture2D+`(A, uv);
float value;
if (depth == 0) {
value = values.r;
} else if (depth == 1) {
value = values.g;
} else if (depth == 2) {
value = values.b;
} else if (depth == 3) {
value = values.a;
}
setOutput(floor(value * 255.0 + 0.5));
}
`},_p=function(n){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;var r=Kr(),e=n[0],t=n[1];this.outputShape=n,this.userCode=`
void main() {
ivec3 coords = getOutputCoords();
int texR = coords[0];
int texC = coords[1];
int depth = coords[2];
vec4 result = vec4(0.);
for(int row=0; row<=1; row++) {
for(int col=0; col<=1; col++) {
texC = coords[1] + row;
depth = coords[2] + col;
vec2 uv = (vec2(texC, texR) + halfCR) /
vec2(`+t+".0, "+e+`.0);
vec4 values = `+r.texture2D+`(A, uv);
float value;
if (depth == 0) {
value = values.r;
} else if (depth == 1) {
value = values.g;
} else if (depth == 2) {
value = values.b;
} else if (depth == 3) {
value = values.a;
}
result[row * 2 + col] = floor(value * 255.0 + 0.5);
}
}
`+r.output+` = result;
}
`},Iu=0,kl=[{kernelName:"FromPixels",backendName:"webgl",kernelFunc:function(n){var r=n.inputs,e=n.backend,t=n.attrs,o=r.pixels,a=t.numChannels,i=typeof HTMLVideoElement!="undefined"&&o instanceof HTMLVideoElement,s=typeof HTMLImageElement!="undefined"&&o instanceof HTMLImageElement,u=i?[o.videoWidth,o.videoHeight]:[o.width,o.height],f=u[0],C=u[1],k=[C,f],L=[C,f,a];(s||i)&&(Da==null&&(Da=document.createElement("canvas").getContext("2d")),Da.canvas.width=f,Da.canvas.height=C,Da.drawImage(o,0,0,f,C),o=Da.canvas);var X=e.makeTensorInfo(k,"int32");e.texData.get(X.dataId).usage=Wr.PIXELS,e.gpgpu.uploadPixelDataToTexture(e.getTexture(X.dataId),o);var oe=p().getBool("WEBGL_PACK")?new _p(L):new Ep(L),ue=e.runWebGLProgram(oe,[X],"int32");return e.disposeData(X.dataId),ue}},{kernelName:"NonMaxSuppressionV5",backendName:"webgl",kernelFunc:function(n){var r=n.inputs,e=n.backend,t=n.attrs;da("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");var o=r,a=o.boxes,i=o.scores,s=t,u=s.maxOutputSize,f=s.iouThreshold,C=s.scoreThreshold,k=s.softNmsSigma,L=e,X=di(L.readSync(a.dataId),L.readSync(i.dataId),u,f,C,k);return[X.selectedIndices,X.selectedScores]}},{kernelName:"Square",backendName:"webgl",kernelFunc:function(n){var r=n.inputs,e=n.backend,t=r.x,o=e,a=new zt(t.shape,"return x * x;");return o.runWebGLProgram(a,[t],t.dtype)}},{kernelName:wi,backendName:"webgl",kernelFunc:function(n){var r=n.inputs,e=n.backend,t=r,o=t.a,a=t.b,i=e,s=p().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new lr("return (a - b) * (a - b);",o.shape,a.shape):new Ut("return (a - b) * (a - b);",o.shape,a.shape);return i.compileAndRun(s,[o,a])}}];Iu<kl.length;Iu++)Q(kl[Iu]);for(var Nu=0,Ml=[{kernelName:"Square",gradFunc:function(n,r){var e=r[0];return{x:function(){return n.mul(e.toFloat().mul(2))}}}},{kernelName:wi,gradFunc:function(n,r){var e=r[0],t=r[1],o=Nt(2);return{a:function(){return Qo(n,Qo(o,Ao(e,t)))},b:function(){return Qo(n,Qo(o,Ao(t,e)))}}}}];Nu<Ml.length;Nu++)z(Ml[Nu]);var Cp=function(){function n(){}return n.prototype.fetch=function(r,e){return fetch(r,e)},n.prototype.now=function(){return performance.now()},n.prototype.encode=function(r,e){if(e!=="utf-8"&&e!=="utf8")throw new Error("Browser's encoder only supports utf-8, but got "+e);return this.textEncoder==null&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(r)},n.prototype.decode=function(r,e){return new TextDecoder(e).decode(r)},n}();p().get("IS_BROWSER")&&p().setPlatform("browser",new Cp);var Du,Tp=function(){return N(6)},Sp=function(){function n(){this.util=N(7),this.textEncoder=new this.util.TextEncoder}return n.prototype.fetch=function(r,e){return p().global.fetch!=null?p().global.fetch(r,e):(Du==null&&(Du=Tp()),Du(r,e))},n.prototype.now=function(){var r=d.hrtime();return 1e3*r[0]+r[1]/1e6},n.prototype.encode=function(r,e){if(e!=="utf-8"&&e!=="utf8")throw new Error("Node built-in encoder only supports utf-8, but got "+e);return this.textEncoder.encode(r)},n.prototype.decode=function(r,e){return r.length===0?"":new this.util.TextDecoder(e).decode(r)},n}();p().get("IS_NODE")&&p().setPlatform("node",new Sp);var ku={float32:4,int32:4,uint16:2,uint8:1,bool:1},gs=4;function Pl(n,r){for(var e={},t=0,o=function(s){var u=s.name,f=s.dtype,C=s.shape,k=le(C),L=void 0;if("quantization"in s){var X=s.quantization;if(X.dtype!=="uint8"&&X.dtype!=="uint16")throw new Error("Weight "+s.name+" has unknown quantization dtype "+X.dtype+". Supported quantization dtypes are: 'uint8' and 'uint16'.");var oe=ku[X.dtype],ue=n.slice(t,t+k*oe),se=X.dtype==="uint8"?new Uint8Array(ue):new Uint16Array(ue);if(f==="float32")L=Float32Array.from(se,function(Me){return Me*X.scale+X.min});else{if(f!=="int32")throw new Error("Unsupported dtype in weight '"+u+"': "+f);L=Int32Array.from(se,function(Me){return Math.round(Me*X.scale+X.min)})}t+=k*oe}else if(f==="string"){var ce=le(s.shape);L=[];for(var xe=0;xe<ce;xe++){var we=new Uint32Array(n.slice(t,t+gs))[0];t+=gs;var Ee=new Uint8Array(n.slice(t,t+we));L.push(Ee),t+=we}}else{var Se=ku[f];if(ue=n.slice(t,t+k*Se),f==="float32")L=new Float32Array(ue);else if(f==="int32")L=new Int32Array(ue);else{if(f!=="bool")throw new Error("Unsupported dtype in weight '"+u+"': "+f);L=new Uint8Array(ue)}t+=k*Se}e[u]=Ur(L,C,f)},a=0,i=r;a<i.length;a++)o(i[a]);return e}function Ap(n){if(n===null)throw new Error("Invalid input value: "+JSON.stringify(n));var r=0,e=[];n.forEach(function(a){if(r+=a.byteLength,e.push(a.byteLength===a.buffer.byteLength?a:new a.constructor(a)),!(a instanceof Float32Array||a instanceof Int32Array||a instanceof Uint8Array))throw new Error("Unsupported TypedArray subtype: "+a.constructor.name)});var t=new Uint8Array(r),o=0;return e.forEach(function(a){t.set(new Uint8Array(a.buffer),o),o+=a.byteLength}),t.buffer}var Mu=typeof F!="undefined"&&(typeof Blob=="undefined"||typeof atob=="undefined"||typeof btoa=="undefined");function Fl(n){return Mu?F.byteLength(n):new Blob([n]).size}function Pu(n){var r=0;n.forEach(function(o){r+=o.byteLength});var e=new Uint8Array(r),t=0;return n.forEach(function(o){e.set(new Uint8Array(o),t),t+=o.byteLength}),e.buffer}function Ll(n){for(n=n.trim();n.endsWith("/");)n=n.slice(0,n.length-1);var r=n.split("/");return r[r.length-1]}function Ci(n){if(n.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:n.modelTopology==null?0:Fl(JSON.stringify(n.modelTopology)),weightSpecsBytes:n.weightSpecs==null?0:Fl(JSON.stringify(n.weightSpecs)),weightDataBytes:n.weightData==null?0:n.weightData.byteLength}}var pn=function(){function n(){this.saveRouters=[],this.loadRouters=[]}return n.getInstance=function(){return n.instance==null&&(n.instance=new n),n.instance},n.registerSaveRouter=function(r){n.getInstance().saveRouters.push(r)},n.registerLoadRouter=function(r){n.getInstance().loadRouters.push(r)},n.getSaveHandlers=function(r){return n.getHandlers(r,"save")},n.getLoadHandlers=function(r,e){return n.getHandlers(r,"load",e)},n.getHandlers=function(r,e,t){var o=[];return(e==="load"?n.getInstance().loadRouters:n.getInstance().saveRouters).forEach(function(a){var i=a(r,t);i!==null&&o.push(i)}),o},n}(),ka="://",Oo=function(){function n(){this.managers={}}return n.getInstance=function(){return n.instance==null&&(n.instance=new n),n.instance},n.registerManager=function(r,e){_(r!=null,function(){return"scheme must not be undefined or null."}),r.endsWith(ka)&&(r=r.slice(0,r.indexOf(ka))),_(r.length>0,function(){return"scheme must not be an empty string."});var t=n.getInstance();_(t.managers[r]==null,function(){return"A model store manager is already registered for scheme '"+r+"'."}),t.managers[r]=e},n.getManager=function(r){var e=this.getInstance().managers[r];if(e==null)throw new Error("Cannot find model manager for scheme '"+r+"'");return e},n.getSchemes=function(){return Object.keys(this.getInstance().managers)},n}();function ys(n){if(n.indexOf(ka)===-1)throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+Oo.getSchemes().join(","));return{scheme:n.split(ka)[0],path:n.split(ka)[1]}}function jl(n,r,e){return e===void 0&&(e=!1),E(this,void 0,void 0,function(){var t,o,a,i,s,u,f,C,k;return g(this,function(L){switch(L.label){case 0:return _(n!==r,function(){return"Old path and new path are the same: '"+n+"'"}),_((t=pn.getLoadHandlers(n)).length>0,function(){return"Copying failed because no load handler is found for source URL "+n+"."}),_(t.length<2,function(){return"Copying failed because more than one ("+t.length+") load handlers for source URL "+n+"."}),o=t[0],_((a=pn.getSaveHandlers(r)).length>0,function(){return"Copying failed because no save handler is found for destination URL "+r+"."}),_(a.length<2,function(){return"Copying failed because more than one ("+t.length+") save handlers for destination URL "+r+"."}),i=a[0],s=ys(n).scheme,u=ys(n).path,f=s===ys(n).scheme,[4,o.load()];case 1:return C=L.sent(),e&&f?[4,Oo.getManager(s).removeModel(u)]:[3,3];case 2:L.sent(),L.label=3;case 3:return[4,i.save(C)];case 4:return k=L.sent(),!e||f?[3,6]:[4,Oo.getManager(s).removeModel(u)];case 5:L.sent(),L.label=6;case 6:return[2,k.modelArtifactsInfo]}})})}var Zo="models_store",Ro="model_info_store";function Bl(){if(!p().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");var n=window||self,r=n.indexedDB||n.mozIndexedDB||n.webkitIndexedDB||n.msIndexedDB||n.shimIndexedDB;if(r==null)throw new Error("The current browser does not appear to support IndexedDB.");return r}function Fu(n){var r=n.result;r.createObjectStore(Zo,{keyPath:"modelPath"}),r.createObjectStore(Ro,{keyPath:"modelPath"})}var Ma=function(){function n(r){if(this.indexedDB=Bl(),r==null||!r)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=r}return n.prototype.save=function(r){return E(this,void 0,void 0,function(){return g(this,function(e){if(r.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return[2,this.databaseAction(this.modelPath,r)]})})},n.prototype.load=function(){return E(this,void 0,void 0,function(){return g(this,function(r){return[2,this.databaseAction(this.modelPath)]})})},n.prototype.databaseAction=function(r,e){var t=this;return new Promise(function(o,a){var i=t.indexedDB.open("tensorflowjs",1);i.onupgradeneeded=function(){return Fu(i)},i.onsuccess=function(){var s=i.result;if(e==null){var u=s.transaction(Zo,"readonly"),f=u.objectStore(Zo).get(t.modelPath);f.onsuccess=function(){if(f.result==null)return s.close(),a(new Error("Cannot find model with path '"+t.modelPath+"' in IndexedDB."));o(f.result.modelArtifacts)},f.onerror=function(ue){return s.close(),a(f.error)},u.oncomplete=function(){return s.close()}}else{var C,k=Ci(e),L=s.transaction(Ro,"readwrite"),X=L.objectStore(Ro),oe=X.put({modelPath:t.modelPath,modelArtifactsInfo:k});oe.onsuccess=function(){var ue=(C=s.transaction(Zo,"readwrite")).objectStore(Zo).put({modelPath:t.modelPath,modelArtifacts:e,modelArtifactsInfo:k});ue.onsuccess=function(){return o({modelArtifactsInfo:k})},ue.onerror=function(se){var ce=(X=L.objectStore(Ro)).delete(t.modelPath);ce.onsuccess=function(){return s.close(),a(ue.error)},ce.onerror=function(xe){return s.close(),a(ue.error)}}},oe.onerror=function(ue){return s.close(),a(oe.error)},L.oncomplete=function(){C==null?s.close():C.oncomplete=function(){return s.close()}}}},i.onerror=function(s){return a(i.error)}})},n.URL_SCHEME="indexeddb://",n}(),Ul=function(n){return p().getBool("IS_BROWSER")&&!Array.isArray(n)&&n.startsWith(Ma.URL_SCHEME)?(r=n.slice(Ma.URL_SCHEME.length),new Ma(r)):null;var r};pn.registerSaveRouter(Ul),pn.registerLoadRouter(Ul);var Op=function(){function n(){this.indexedDB=Bl()}return n.prototype.listModels=function(){return E(this,void 0,void 0,function(){var r=this;return g(this,function(e){return[2,new Promise(function(t,o){var a=r.indexedDB.open("tensorflowjs",1);a.onupgradeneeded=function(){return Fu(a)},a.onsuccess=function(){var i=a.result,s=i.transaction(Ro,"readonly"),u=s.objectStore(Ro).getAll();u.onsuccess=function(){for(var f={},C=0,k=u.result;C<k.length;C++){var L=k[C];f[L.modelPath]=L.modelArtifactsInfo}t(f)},u.onerror=function(f){return i.close(),o(u.error)},s.oncomplete=function(){return i.close()}},a.onerror=function(i){return o(a.error)}})]})})},n.prototype.removeModel=function(r){return E(this,void 0,void 0,function(){var e=this;return g(this,function(t){var o;return r=(o=r).startsWith(Ma.URL_SCHEME)?o.slice(Ma.URL_SCHEME.length):o,[2,new Promise(function(a,i){var s=e.indexedDB.open("tensorflowjs",1);s.onupgradeneeded=function(){return Fu(s)},s.onsuccess=function(){var u,f=s.result,C=f.transaction(Ro,"readwrite"),k=C.objectStore(Ro),L=k.get(r);L.onsuccess=function(){if(L.result==null)return f.close(),i(new Error("Cannot find model with path '"+r+"' in IndexedDB."));var X=k.delete(r),oe=function(){var ue=(u=f.transaction(Zo,"readwrite")).objectStore(Zo).delete(r);ue.onsuccess=function(){return a(L.result.modelArtifactsInfo)},ue.onerror=function(se){return i(L.error)}};X.onsuccess=oe,X.onerror=function(ue){return oe(),f.close(),i(L.error)}},L.onerror=function(X){return f.close(),i(L.error)},C.oncomplete=function(){u==null?f.close():u.oncomplete=function(){return f.close()}}},s.onerror=function(u){return i(s.error)}})]})})},n}();if(p().getBool("IS_BROWSER"))try{Oo.registerManager(Ma.URL_SCHEME,new Op)}catch(n){}var ao="/",Pa="tensorflowjs_models",Wl="info",Rp="model_topology",Ip="weight_specs",Np="weight_data",Dp="model_metadata";function Hl(n){return{info:[Pa,n,Wl].join(ao),topology:[Pa,n,Rp].join(ao),weightSpecs:[Pa,n,Ip].join(ao),weightData:[Pa,n,Np].join(ao),modelMetadata:[Pa,n,Dp].join(ao)}}function kp(n){var r=n.split(ao);if(r.length<3)throw new Error("Invalid key format: "+n);return r.slice(1,r.length-1).join(ao)}var Fa=function(){function n(r){if(!p().getBool("IS_BROWSER")||typeof window=="undefined"||window.localStorage===void 0)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,r==null||!r)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=r,this.keys=Hl(this.modelPath)}return n.prototype.save=function(r){return E(this,void 0,void 0,function(){var e,t,o;return g(this,function(a){if(r.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");e=JSON.stringify(r.modelTopology),t=JSON.stringify(r.weightSpecs),o=Ci(r);try{return this.LS.setItem(this.keys.info,JSON.stringify(o)),this.LS.setItem(this.keys.topology,e),this.LS.setItem(this.keys.weightSpecs,t),this.LS.setItem(this.keys.weightData,function(i){if(Mu)return F.from(i).toString("base64");for(var s=new Uint8Array(i),u="",f=0,C=s.length;f<C;f++)u+=String.fromCharCode(s[f]);return btoa(u)}(r.weightData)),this.LS.setItem(this.keys.modelMetadata,JSON.stringify({format:r.format,generatedBy:r.generatedBy,convertedBy:r.convertedBy,userDefinedMetadata:r.userDefinedMetadata})),[2,{modelArtifactsInfo:o}]}catch(i){throw this.LS.removeItem(this.keys.info),this.LS.removeItem(this.keys.topology),this.LS.removeItem(this.keys.weightSpecs),this.LS.removeItem(this.keys.weightData),this.LS.removeItem(this.keys.modelMetadata),new Error("Failed to save model '"+this.modelPath+"' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes="+o.modelTopologyBytes+", weightSpecsBytes="+o.weightSpecsBytes+", weightDataBytes="+o.weightDataBytes+".")}return[2]})})},n.prototype.load=function(){return E(this,void 0,void 0,function(){var r,e,t,o,a,i,s;return g(this,function(u){if((r=JSON.parse(this.LS.getItem(this.keys.info)))==null)throw new Error("In local storage, there is no model with name '"+this.modelPath+"'");if(r.modelTopologyType!=="JSON")throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");if(e={},(t=JSON.parse(this.LS.getItem(this.keys.topology)))==null)throw new Error("In local storage, the topology of model '"+this.modelPath+"' is missing.");if(e.modelTopology=t,(o=JSON.parse(this.LS.getItem(this.keys.weightSpecs)))==null)throw new Error("In local storage, the weight specs of model '"+this.modelPath+"' are missing.");if(e.weightSpecs=o,(a=this.LS.getItem(this.keys.modelMetadata))!=null&&(i=JSON.parse(a),e.format=i.format,e.generatedBy=i.generatedBy,e.convertedBy=i.convertedBy,e.userDefinedMetadata=i.userDefinedMetadata),(s=this.LS.getItem(this.keys.weightData))==null)throw new Error("In local storage, the binary weight values of model '"+this.modelPath+"' are missing.");return e.weightData=function(f){if(Mu){var C=F.from(f,"base64");return C.buffer.slice(C.byteOffset,C.byteOffset+C.byteLength)}for(var k=atob(f),L=new Uint8Array(k.length),X=0;X<k.length;++X)L.set([k.charCodeAt(X)],X);return L.buffer}(s),[2,e]})})},n.URL_SCHEME="localstorage://",n}(),zl=function(n){return p().getBool("IS_BROWSER")&&!Array.isArray(n)&&n.startsWith(Fa.URL_SCHEME)?(r=n.slice(Fa.URL_SCHEME.length),new Fa(r)):null;var r};pn.registerSaveRouter(zl),pn.registerLoadRouter(zl);var Mp=function(){function n(){_(p().getBool("IS_BROWSER"),function(){return"Current environment is not a web browser"}),_(typeof window=="undefined"||window.localStorage!==void 0,function(){return"Current browser does not appear to support localStorage"}),this.LS=window.localStorage}return n.prototype.listModels=function(){return E(this,void 0,void 0,function(){var r,e,t,o,a,i;return g(this,function(s){for(r={},e=Pa+ao,t=ao+Wl,o=0;o<this.LS.length;++o)(a=this.LS.key(o)).startsWith(e)&&a.endsWith(t)&&(i=kp(a),r[i]=JSON.parse(this.LS.getItem(a)));return[2,r]})})},n.prototype.removeModel=function(r){return E(this,void 0,void 0,function(){var e,t;return g(this,function(o){var a;if(r=(a=r).startsWith(Fa.URL_SCHEME)?a.slice(Fa.URL_SCHEME.length):a,e=Hl(r),this.LS.getItem(e.info)==null)throw new Error("Cannot find model at path '"+r+"'");return t=JSON.parse(this.LS.getItem(e.info)),this.LS.removeItem(e.info),this.LS.removeItem(e.topology),this.LS.removeItem(e.weightSpecs),this.LS.removeItem(e.weightData),[2,t]})})},n}();if(p().getBool("IS_BROWSER"))try{Oo.registerManager(Fa.URL_SCHEME,new Mp)}catch(n){}var Pp="model",Fp=".json",Lp=".weights.bin";function Gl(n){return new Promise(function(r){return setTimeout(r)}).then(n)}var Lu=function(){function n(r){if(!p().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");r.startsWith(n.URL_SCHEME)&&(r=r.slice(n.URL_SCHEME.length)),r!=null&&r.length!==0||(r=Pp),this.modelTopologyFileName=r+Fp,this.weightDataFileName=r+Lp}return n.prototype.save=function(r){return E(this,void 0,void 0,function(){var e,t,o,a,i,s;return g(this,function(u){switch(u.label){case 0:if(typeof document=="undefined")throw new Error("Browser downloads are not supported in this environment since `document` is not present");if(e=window.URL.createObjectURL(new Blob([r.weightData],{type:"application/octet-stream"})),!(r.modelTopology instanceof ArrayBuffer))return[3,1];throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");case 1:return t=[{paths:["./"+this.weightDataFileName],weights:r.weightSpecs}],o={modelTopology:r.modelTopology,format:r.format,generatedBy:r.generatedBy,convertedBy:r.convertedBy,weightsManifest:t},a=window.URL.createObjectURL(new Blob([JSON.stringify(o)],{type:"application/json"})),(i=this.jsonAnchor==null?document.createElement("a"):this.jsonAnchor).download=this.modelTopologyFileName,i.href=a,[4,Gl(function(){return i.dispatchEvent(new MouseEvent("click"))})];case 2:return u.sent(),r.weightData==null?[3,4]:((s=this.weightDataAnchor==null?document.createElement("a"):this.weightDataAnchor).download=this.weightDataFileName,s.href=e,[4,Gl(function(){return s.dispatchEvent(new MouseEvent("click"))})]);case 3:u.sent(),u.label=4;case 4:return[2,{modelArtifactsInfo:Ci(r)}]}})})},n.URL_SCHEME="downloads://",n}(),jp=function(){function n(r){if(r==null||r.length<1)throw new Error("When calling browserFiles, at least 1 file is required, but received "+r);this.files=r}return n.prototype.load=function(){return E(this,void 0,void 0,function(){var r,e,t=this;return g(this,function(o){return r=this.files[0],e=this.files.slice(1),[2,new Promise(function(a,i){var s=new FileReader;s.onload=function(u){var f=JSON.parse(u.target.result),C=f.modelTopology;if(C!=null){e.length===0&&a({modelTopology:C});var k=f.weightsManifest;if(k!=null){var L;try{L=t.checkManifestAndWeightFiles(k,e)}catch(se){return void i(se)}var X=[],oe=[],ue=[];k.forEach(function(se){se.paths.forEach(function(ce){oe.push(ce),ue.push(null)}),X.push.apply(X,se.weights)}),k.forEach(function(se){se.paths.forEach(function(ce){var xe=new FileReader;xe.onload=function(we){var Ee=we.target.result,Se=oe.indexOf(ce);ue[Se]=Ee,ue.indexOf(null)===-1&&a({modelTopology:C,weightSpecs:X,weightData:Pu(ue),format:f.format,generatedBy:f.generatedBy,convertedBy:f.convertedBy,userDefinedMetadata:f.userDefinedMetadata})},xe.onerror=function(we){return i("Failed to weights data from file of path '"+ce+"'.")},xe.readAsArrayBuffer(L[ce])})})}else i(new Error("weightManifest field is missing from file "+r.name))}else i(new Error("modelTopology field is missing from file "+r.name))},s.onerror=function(u){return i("Failed to read model topology and weights manifest JSON from file '"+r.name+"'. BrowserFiles supports loading Keras-style tf.Model artifacts only.")},s.readAsText(r)})]})})},n.prototype.checkManifestAndWeightFiles=function(r,e){for(var t=[],o=e.map(function(u){return Ll(u.name)}),a={},i=0,s=r;i<s.length;i++)s[i].paths.forEach(function(u){var f=Ll(u);if(t.indexOf(f)!==-1)throw new Error("Duplicate file basename found in weights manifest: '"+f+"'");if(t.push(f),o.indexOf(f)===-1)throw new Error("Weight file with basename '"+f+"' is not provided.");a[u]=e[o.indexOf(f)]});if(t.length!==e.length)throw new Error("Mismatch in the number of files in weights manifest ("+t.length+") and the number of weight files provided ("+e.length+").");return a},n}();function Vl(n,r,e,t){!function(a){_(a!=null&&Array.isArray(a)&&a.length>0,function(){return"promises must be a none empty array"})}(n),function(a,i){_(a>=0&&a<=1,function(){return"Progress fraction must be in range [0, 1], but got startFraction "+a}),_(i>=0&&i<=1,function(){return"Progress fraction must be in range [0, 1], but got endFraction "+i}),_(i>=a,function(){return"startFraction must be no more than endFraction, but got startFraction "+a+" and endFraction "+i})}(e=e==null?0:e,t=t==null?1:t);var o=0;return Promise.all(n.map(function(a){return a.then(function(i){var s=e+ ++o/n.length*(t-e);return r(s),i}),a}))}function Xl(n,r){return E(this,void 0,void 0,function(){var e,t,o,a,i,s,u,f,C;return g(this,function(k){switch(k.label){case 0:return r==null&&(r={}),e=r.fetchFunc==null?p().platform.fetch:r.fetchFunc,t=n.map(function(L){return e(L,r.requestInit,{isBinary:!0})}),o=0,a=.5,r.onProgress!=null?[3,2]:[4,Promise.all(t)];case 1:return i=k.sent(),[3,4];case 2:return[4,Vl(t,r.onProgress,o,a)];case 3:i=k.sent(),k.label=4;case 4:return s=i.map(function(L){return L.arrayBuffer()}),u=.5,f=1,r.onProgress!=null?[3,6]:[4,Promise.all(s)];case 5:return C=k.sent(),[3,8];case 6:return[4,Vl(s,r.onProgress,u,f)];case 7:C=k.sent(),k.label=8;case 8:return[2,C]}})})}function Kl(n){var r=this;return function(e,t,o){return t===void 0&&(t=""),E(r,void 0,void 0,function(){var a,i,s,u,f,C,k,L,X,oe;return g(this,function(ue){switch(ue.label){case 0:if(a=e.map(function(){return!1}),i={},s=o!=null?o.map(function(){return!1}):[],u=[],e.forEach(function(se,ce){var xe=0;se.weights.forEach(function(we){var Ee="quantization"in we?we.quantization.dtype:we.dtype,Se=ku[Ee]*le(we.shape),Me=function(){a[ce]=!0,i[ce]==null&&(i[ce]=[]),i[ce].push({manifestEntry:we,groupOffset:xe,sizeBytes:Se})};o!=null?o.forEach(function(ze,Be){ze===we.name&&(Me(),s[Be]=!0)}):Me(),u.push(we.name),xe+=Se})}),!s.every(function(se){return se}))throw f=o.filter(function(se,ce){return!s[ce]}),new Error("Could not find weights in manifest with names: "+f.join(", ")+`.
Manifest JSON has weights with names: `+u.join(", ")+".");return C=a.reduce(function(se,ce,xe){return ce&&se.push(xe),se},[]),k=[],C.forEach(function(se){e[se].paths.forEach(function(ce){var xe=t+(t.endsWith("/")?"":"/")+ce;k.push(xe)})}),[4,n(k)];case 1:return L=ue.sent(),X={},oe=0,C.forEach(function(se){for(var ce=e[se].paths.length,xe=0,we=0;we<ce;we++)xe+=L[oe+we].byteLength;for(var Ee=new ArrayBuffer(xe),Se=new Uint8Array(Ee),Me=0,ze=0;ze<ce;ze++){var Be=new Uint8Array(L[oe+ze]);Se.set(Be,Me),Me+=Be.byteLength}i[se].forEach(function(je){var Ue=Pl(Ee.slice(je.groupOffset,je.groupOffset+je.sizeBytes),[je.manifestEntry]);for(var Ze in Ue)X[Ze]=Ue[Ze]}),oe+=ce}),[2,X]}})})}}pn.registerSaveRouter(function(n){return p().getBool("IS_BROWSER")&&!Array.isArray(n)&&n.startsWith(Lu.URL_SCHEME)?function(r){return r===void 0&&(r="model"),new Lu(r)}(n.slice(Lu.URL_SCHEME.length)):null});var Yl=function(){function n(r,e){if(this.DEFAULT_METHOD="POST",e==null&&(e={}),this.weightPathPrefix=e.weightPathPrefix,this.onProgress=e.onProgress,e.fetchFunc!=null?(_(typeof e.fetchFunc=="function",function(){return"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"}),this.fetch=e.fetchFunc):this.fetch=p().platform.fetch,_(r!=null&&r.length>0,function(){return"URL path for http must not be null, undefined or empty."}),Array.isArray(r)&&_(r.length===2,function(){return"URL paths for http must have a length of 2, (actual length is "+r.length+")."}),this.path=r,e.requestInit!=null&&e.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=e.requestInit||{}}return n.prototype.save=function(r){return E(this,void 0,void 0,function(){var e,t,o,a;return g(this,function(i){switch(i.label){case 0:if(r.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");return(e=Object.assign({method:this.DEFAULT_METHOD},this.requestInit)).body=new FormData,t=[{paths:["./model.weights.bin"],weights:r.weightSpecs}],o={modelTopology:r.modelTopology,format:r.format,generatedBy:r.generatedBy,convertedBy:r.convertedBy,userDefinedMetadata:r.userDefinedMetadata,weightsManifest:t},e.body.append("model.json",new Blob([JSON.stringify(o)],{type:"application/json"}),"model.json"),r.weightData!=null&&e.body.append("model.weights.bin",new Blob([r.weightData],{type:"application/octet-stream"}),"model.weights.bin"),[4,this.fetch(this.path,e)];case 1:if((a=i.sent()).ok)return[2,{modelArtifactsInfo:Ci(r),responses:[a]}];throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+a.status+".")}})})},n.prototype.load=function(){return E(this,void 0,void 0,function(){var r,e,t,o,a,i,s,u,f,C,k,L;return g(this,function(X){switch(X.label){case 0:return[4,this.fetch(this.path,this.requestInit)];case 1:if(!(r=X.sent()).ok)throw new Error("Request to "+this.path+" failed with status code "+r.status+". Please verify this URL points to the model JSON of the model to load.");X.label=2;case 2:return X.trys.push([2,4,,5]),[4,r.json()];case 3:return e=X.sent(),[3,5];case 4:throw X.sent(),t="Failed to parse model JSON of response from "+this.path+".",this.path.endsWith(".pb")?t+=" 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.":t+=" Please make sure the server is serving valid JSON for this request.",new Error(t);case 5:if(o=e.modelTopology,a=e.weightsManifest,i=e.generatedBy,s=e.convertedBy,u=e.format,f=e.userDefinedMetadata,o==null&&a==null)throw new Error("The JSON from HTTP path "+this.path+" contains neither model topology or manifest for weights.");return a==null?[3,7]:[4,this.loadWeights(a)];case 6:L=X.sent(),C=L[0],k=L[1],X.label=7;case 7:return[2,{modelTopology:o,weightSpecs:C,weightData:k,userDefinedMetadata:f,generatedBy:i,convertedBy:s,format:u}]}})})},n.prototype.loadWeights=function(r){return E(this,void 0,void 0,function(){var e,t,o,a,i,s,u,f,C,k,L;return g(this,function(X){switch(X.label){case 0:for(e=Array.isArray(this.path)?this.path[1]:this.path,t=function(oe){var ue=oe.lastIndexOf("/"),se=oe.lastIndexOf("?"),ce=oe.substring(0,ue),xe=se>ue?oe.substring(se):"";return[ce+"/",xe]}(e),o=t[0],a=t[1],i=this.weightPathPrefix||o,s=[],u=0,f=r;u<f.length;u++)C=f[u],s.push.apply(s,C.weights);return k=[],r.forEach(function(oe){oe.paths.forEach(function(ue){k.push(i+ue+a)})}),[4,Xl(k,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress})];case 1:return L=X.sent(),[2,[s,Pu(L)]]}})})},n.URL_SCHEME_REGEX=/^https?:\/\//,n}();function ju(n){return n.match(Yl.URL_SCHEME_REGEX)!=null}var $l=function(n,r){return typeof fetch=="undefined"?null:(Array.isArray(n)?n.every(function(e){return ju(e)}):ju(n))?Bu(n,{onProgress:r}):null};function Bu(n,r){return new Yl(n,r)}pn.registerSaveRouter($l),pn.registerLoadRouter($l);var Uu=function(){function n(r){this.modelArtifacts=r}return n.prototype.load=function(){return E(this,void 0,void 0,function(){return g(this,function(r){return[2,this.modelArtifacts]})})},n}(),Bp=function(){function n(r){this.saveHandler=r}return n.prototype.save=function(r){return E(this,void 0,void 0,function(){return g(this,function(e){return[2,this.saveHandler(r)]})})},n}(),Up=Object.freeze({browserFiles:function(n){return new jp(n)},browserHTTPRequest:function(n,r){return Bu(n,r)},concatenateArrayBuffers:Pu,decodeWeights:Pl,encodeWeights:function(n,r){return E(this,void 0,void 0,function(){var e,t,o,a,i,s=this;return g(this,function(u){switch(u.label){case 0:for(e=[],t=[],o=Array.isArray(n)?n.map(function(f){return f.name}):Object.keys(n),a=function(f){var C=o[f],k=Array.isArray(n)?n[f].tensor:n[C];if(k.dtype!=="float32"&&k.dtype!=="int32"&&k.dtype!=="bool"&&k.dtype!=="string")throw new Error("Unsupported dtype in weight '"+C+"': "+k.dtype);var L={name:C,shape:k.shape,dtype:k.dtype};if(k.dtype==="string"){var X=new Promise(function(oe){return E(s,void 0,void 0,function(){var ue,se,ce,xe,we,Ee,Se;return g(this,function(Me){switch(Me.label){case 0:return[4,k.bytes()];case 1:for(ue=Me.sent(),se=ue.reduce(function(ze,Be){return ze+Be.length},0)+gs*ue.length,ce=new Uint8Array(se),xe=0,we=0;we<ue.length;we++)Ee=ue[we],Se=new Uint8Array(new Uint32Array([Ee.length]).buffer),ce.set(Se,xe),xe+=gs,ce.set(Ee,xe),xe+=Ee.length;return oe(ce),[2]}})})});t.push(X)}else t.push(k.data());r!=null&&(L.group=r),e.push(L)},i=0;i<o.length;++i)a(i);return[4,Promise.all(t)];case 1:return[2,{data:Ap(u.sent()),specs:e}]}})})},fromMemory:function(n,r,e,t){return arguments.length===1?n.modelTopology!=null||n.weightSpecs!=null?new Uu(n):(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 Uu({modelTopology:n})):(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 Uu({modelTopology:n,weightSpecs:r,weightData:e,trainingConfig:t}))},getLoadHandlers:function(n,r){return pn.getLoadHandlers(n,r)},getModelArtifactsInfoForJSON:Ci,getSaveHandlers:function(n){return pn.getSaveHandlers(n)},http:Bu,isHTTPScheme:ju,loadWeights:function(n,r,e,t){return r===void 0&&(r=""),E(this,void 0,void 0,function(){return g(this,function(o){return[2,Kl(function(a){return Xl(a,{requestInit:t})})(n,r,e)]})})},registerLoadRouter:function(n){return pn.registerLoadRouter(n)},registerSaveRouter:function(n){return pn.registerSaveRouter(n)},weightsLoaderFactory:Kl,withSaveHandler:function(n){return new Bp(n)},copyModel:function(n,r){return E(this,void 0,void 0,function(){return g(this,function(e){return[2,jl(n,r,!1)]})})},listModels:function(){return E(this,void 0,void 0,function(){var n,r,e,t,o,a,i;return g(this,function(s){switch(s.label){case 0:n=Oo.getSchemes(),r={},e=0,t=n,s.label=1;case 1:return e<t.length?(o=t[e],[4,Oo.getManager(o).listModels()]):[3,4];case 2:for(i in a=s.sent())r[o+ka+i]=a[i];s.label=3;case 3:return e++,[3,1];case 4:return[2,r]}})})},moveModel:function(n,r){return E(this,void 0,void 0,function(){return g(this,function(e){return[2,jl(n,r,!0)]})})},removeModel:function(n){return E(this,void 0,void 0,function(){var r;return g(this,function(e){return r=ys(n),[2,Oo.getManager(r.scheme).removeModel(r.path)]})})}}),La,Wp=Xe({confusionMatrix_:function(n,r,e){var t=Oe(n,"labels","confusionMatrix"),o=Oe(r,"predictions","confusionMatrix");_(e==null||e>0&&Number.isInteger(e),function(){return"If provided, numClasses must be a positive integer, but got "+e}),_(t.rank===1,function(){return"Expected the rank of labels to be 1, but got "+t.rank}),_(o.rank===1,function(){return"Expected the rank of predictions to be 1, but got "+o.rank}),_(t.shape[0]===o.shape[0],function(){return"Mismatch in the number of examples: "+t.shape[0]+" vs. "+o.shape[0]+". Labels and predictions should have the same number of elements."}),_(e>0&&Number.isInteger(e),function(){return"numClasses is required to be a positive integer, but got "+e});var a=ri(t.asType("int32"),e),i=ri(o.asType("int32"),e);return a.transpose().matMul(i).asType("int32")}}),$p=Object.freeze({confusionMatrix:Wp}),Hp=Xe({fromPixels_:function(n,r){if(r===void 0&&(r=3),r>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(n==null)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");var e=!1,t=!1,o=!1,a=!1,i=!1;if(n.data instanceof Uint8Array)e=!0;else if(typeof ImageData!="undefined"&&n instanceof ImageData)t=!0;else if(typeof HTMLVideoElement!="undefined"&&n instanceof HTMLVideoElement)o=!0;else if(typeof HTMLImageElement!="undefined"&&n instanceof HTMLImageElement)a=!0;else{if(n.getContext==null)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 "+n.constructor.name);i=!0}if(o&&(o&&n.readyState<2))throw new Error("The video element has not loaded data yet. Please wait for `loadeddata` event on the <video> element.");if(S("FromPixels",Ve.backendName)!=null)return Ve.runKernel("FromPixels",{pixels:n},{numChannels:r});var s,u,f=o?[n.videoWidth,n.videoHeight]:[n.width,n.height],C=f[0],k=f[1];if(i?s=n.getContext("2d").getImageData(0,0,C,k).data:t||e?s=n.data:(a||o)&&(La==null&&(La=document.createElement("canvas").getContext("2d")),La.canvas.width=C,La.canvas.height=k,La.drawImage(n,0,0,C,k),s=La.getImageData(0,0,C,k).data),r===4)u=new Int32Array(s);else{var L=C*k;u=new Int32Array(L*r);for(var X=0;X<L;X++)for(var oe=0;oe<r;++oe)u[X*r+oe]=s[4*X+oe]}return Za(u,[k,C,r],"int32")}}),zp=Object.freeze({toPixels:function(n,r){return E(this,void 0,void 0,function(){var e,t,o,a,i,s,u,f,C,k,L,X,oe,ue,se,ce,xe,we,Ee,Se,Me,ze,Be;return g(this,function(je){switch(je.label){case 0:if(e=Oe(n,"img","toPixels"),n instanceof Dr||(e=e.toInt()),e.rank!==2&&e.rank!==3)throw new Error("toPixels only supports rank 2 or 3 tensors, got rank "+e.rank+".");if(t=e.shape.slice(0,2),o=t[0],a=t[1],(i=e.rank===2?1:e.shape[2])>4||i===2)throw new Error("toPixels only supports depth of size 1, 3 or 4 but got "+i);return[4,e.data()];case 1:return s=je.sent(),u=e.min(),f=e.max(),[4,Promise.all([u.data(),f.data()])];case 2:if(C=je.sent(),k=C[0],L=C[1],X=k[0],oe=L[0],u.dispose(),f.dispose(),e.dtype==="float32"){if(X<0||oe>1)throw new Error("Tensor values for a float32 Tensor must be in the range [0 - 1] but got range ["+X+" - "+oe+"].")}else{if(e.dtype!=="int32")throw new Error("Unsupported type for toPixels: "+e.dtype+". Please use float32 or int32 tensors.");if(X<0||oe>255)throw new Error("Tensor values for a int32 Tensor must be in the range [0 - 255] but got range ["+X+" - "+oe+"].")}for(ue=e.dtype==="float32"?255:1,se=new Uint8ClampedArray(a*o*4),ce=0;ce<o*a;++ce)xe=void 0,we=void 0,Ee=void 0,Se=void 0,i===1?(xe=s[ce]*ue,we=s[ce]*ue,Ee=s[ce]*ue,Se=255):i===3?(xe=s[3*ce]*ue,we=s[3*ce+1]*ue,Ee=s[3*ce+2]*ue,Se=255):i===4&&(xe=s[4*ce]*ue,we=s[4*ce+1]*ue,Ee=s[4*ce+2]*ue,Se=s[4*ce+3]*ue),se[(Me=4*ce)+0]=Math.round(xe),se[Me+1]=Math.round(we),se[Me+2]=Math.round(Ee),se[Me+3]=Math.round(Se);return r!=null&&(r.width=a,r.height=o,ze=r.getContext("2d"),Be=new ImageData(se,a,o),ze.putImageData(Be,0,0)),e!==n&&e.dispose(),[2,se]}})})},fromPixels:Hp}),Jl=function(){function n(){}return n.prototype.getClassName=function(){return this.constructor.className},n.fromConfig=function(r,e){return new r(e)},n}(),ql=function(){function n(){this.classNameMap={}}return n.getMap=function(){return n.instance==null&&(n.instance=new n),n.instance},n.register=function(r){n.getMap().classNameMap[r.className]=[r,r.fromConfig]},n}();function Io(n){_(n.className!=null,function(){return"Class being registered does not have the static className property defined."}),_(typeof n.className=="string",function(){return"className is required to be a string, but got type "+typeof n.className}),_(n.className.length>0,function(){return"Class being registered has an empty-string as its className, which is disallowed."}),ql.register(n)}var Jp=Object.freeze({Serializable:Jl,SerializationMap:ql,registerClass:Io}),Gp=.001,Ql=.1;function Wu(){return Ve.backend.floatPrecision()===32?Gp:Ql}function Hu(n,r,e){var t=!0;if((Ae(n)||Ae(r))&&(t=!1),Ae(n)&&Ae(r)&&(t=!0),t){var o=n.constructor.name,a=r.constructor.name;if(o!==a)throw new Error("Arrays are of different type. Actual: "+o+". Expected: "+a)}if(Array.isArray(n)&&Array.isArray(r)){var i=bn(n),s=bn(r);if(!_e(i,s))throw new Error("Arrays have different shapes. Actual: ["+i+"]. Expected: ["+s+"]")}var u=Ae(n)?n:pe(n),f=Ae(r)?r:pe(r);if(u.length!==f.length)throw new Error("Arrays have different lengths actual: "+u.length+" vs expected: "+f.length+`.
Actual: `+u+`.
Expected: `+f+".");for(var C=0;C<f.length;++C){var k=u[C],L=f[C];if(!e(k,L))throw new Error("Arrays differ: actual["+C+"] = "+k+", expected["+C+"] = "+L+`.
Actual: `+u+`.
Expected: `+f+".")}}function zu(n,r,e){return!isFinite(n)&&!isFinite(r)||!(isNaN(n)||isNaN(r)||Math.abs(n-r)>e)}var qp=Object.freeze({TEST_EPSILON_FLOAT16:Ql,expectArraysClose:function(n,r,e){return e==null&&(e=Wu()),Hu(n,r,function(t,o){return zu(t,o,e)})},testEpsilon:Wu,expectPromiseToFail:function(n,r){n().then(function(){return r.fail()},function(){return r()})},expectArraysEqual:function(n,r){var e=typeof r=="string"||typeof r=="number"||typeof r=="boolean"?[r]:r;return Fe(n)||Fe(n[0])||Fe(r)||Fe(r[0])?Hu(n,e,function(t,o){return t==o}):Hu(n,r,function(t,o){return zu(t,o,0)})},expectNumbersClose:function(n,r,e){if(e==null&&(e=Wu()),!zu(n,r,e))throw new Error("Numbers differ: actual === "+n+", expected === "+r)},expectValuesInRange:function(n,r,e){for(var t=0;t<n.length;t++)if(n[t]<r||n[t]>e)throw new Error("Value out of range:"+n[t]+" low: "+r+", high: "+e)},expectArrayBuffersEqual:function(n,r){expect(new Float32Array(n)).toEqual(new Float32Array(r))}}),Qp="1.7.0",Zp=Object.freeze({gpgpu_util:ld,webgl_util:Es,forceHalfFloat:function(){p().set("WEBGL_FORCE_F16_TEXTURES",!0)},MathBackendWebGL:Hc,setWebGLContext:Ga,GPGPUContext:Tc}),ea=function(n){function r(){return n!==null&&n.apply(this,arguments)||this}return D(r,n),r.prototype.minimize=function(e,t,o){t===void 0&&(t=!1);var a=this.computeGradients(e,o),i=a.value,s=a.grads;if(o!=null){var u=o.map(function(f){return{name:f.name,tensor:s[f.name]}});this.applyGradients(u)}else this.applyGradients(s);return qr(s),t?i:(i.dispose(),null)},Object.defineProperty(r.prototype,"iterations",{get:function(){return this.iterations_==null&&(this.iterations_=0),this.iterations_},enumerable:!0,configurable:!0}),r.prototype.incrementIterations=function(){this.iterations_=this.iterations+1},r.prototype.computeGradients=function(e,t){return ii(e,t)},r.prototype.dispose=function(){this.iterations_!=null&&qr(this.iterations_)},r.prototype.saveIterations=function(){return E(this,void 0,void 0,function(){return g(this,function(e){return this.iterations_==null&&(this.iterations_=0),[2,{name:"iter",tensor:Nt(this.iterations_,"int32")}]})})},r.prototype.getWeights=function(){return E(this,void 0,void 0,function(){return g(this,function(e){throw new Error("getWeights() is not implemented for this optimizer yet.")})})},r.prototype.setWeights=function(e){return E(this,void 0,void 0,function(){return g(this,function(t){throw new Error("setWeights() is not implemented for this optimizer class "+this.getClassName())})})},r.prototype.extractIterations=function(e){return E(this,void 0,void 0,function(){var t;return g(this,function(o){switch(o.label){case 0:return t=this,[4,e[0].tensor.data()];case 1:return t.iterations_=o.sent()[0],[2,e.slice(1)]}})})},r}(Jl);Object.defineProperty(ea,Symbol.hasInstance,{value:function(n){return n.minimize!=null&&n.computeGradients!=null&&n.applyGradients!=null}});var Zl=function(n){function r(e,t,o){o===void 0&&(o=null);var a=n.call(this)||this;return a.learningRate=e,a.rho=t,a.epsilon=o,a.accumulatedGrads=[],a.accumulatedUpdates=[],o==null&&(a.epsilon=Ve.backend.epsilon()),a}return D(r,n),r.prototype.applyGradients=function(e){var t=this;(Array.isArray(e)?e.map(function(o){return o.name}):Object.keys(e)).forEach(function(o,a){var i=Ve.registeredVariables[o];t.accumulatedGrads[a]==null&&(t.accumulatedGrads[a]={originalName:o+"/accum_grad",variable:Rr(function(){return Jt(i).variable(!1)})}),t.accumulatedUpdates[a]==null&&(t.accumulatedUpdates[a]={originalName:o+"/accum_var",variable:Rr(function(){return Jt(i).variable(!1)})});var s=Array.isArray(e)?e[a].tensor:e[o];if(s!=null){var u=t.accumulatedGrads[a].variable,f=t.accumulatedUpdates[a].variable;Rr(function(){var C=u.mul(t.rho).add(s.square().mul(1-t.rho)),k=f.add(t.epsilon).sqrt().div(u.add(t.epsilon).sqrt()).mul(s),L=f.mul(t.rho).add(k.square().mul(1-t.rho));u.assign(C),f.assign(L);var X=k.mul(-t.learningRate).add(i);i.assign(X)})}}),this.incrementIterations()},r.prototype.dispose=function(){this.accumulatedUpdates!=null&&(qr(this.accumulatedGrads.map(function(e){return e.variable})),qr(this.accumulatedUpdates.map(function(e){return e.variable})))},r.prototype.getWeights=function(){return E(this,void 0,void 0,function(){var e;return g(this,function(t){switch(t.label){case 0:return e=this.accumulatedGrads.concat(this.accumulatedUpdates),[4,this.saveIterations()];case 1:return[2,[t.sent()].concat(e.map(function(o){return{name:o.originalName,tensor:o.variable}}))]}})})},r.prototype.setWeights=function(e){return E(this,void 0,void 0,function(){var t;return g(this,function(o){switch(o.label){case 0:return[4,this.extractIterations(e)];case 1:return e=o.sent(),t=e.length/2,this.accumulatedGrads=e.slice(0,t).map(function(a){return{originalName:a.name,variable:a.tensor.variable(!1)}}),this.accumulatedUpdates=e.slice(t,2*t).map(function(a){return{originalName:a.name,variable:a.tensor.variable(!1)}}),[2]}})})},r.prototype.getConfig=function(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}},r.fromConfig=function(e,t){return new e(t.learningRate,t.rho,t.epsilon)},r.className="Adadelta",r}(ea);Io(Zl);var ed=function(n){function r(e,t){t===void 0&&(t=.1);var o=n.call(this)||this;return o.learningRate=e,o.initialAccumulatorValue=t,o.accumulatedGrads=[],o}return D(r,n),r.prototype.applyGradients=function(e){var t=this;(Array.isArray(e)?e.map(function(o){return o.name}):Object.keys(e)).forEach(function(o,a){var i=Ve.registeredVariables[o];t.accumulatedGrads[a]==null&&(t.accumulatedGrads[a]={originalName:o+"/accumulator",variable:Rr(function(){return ei(i.shape,t.initialAccumulatorValue).variable(!1)})});var s=Array.isArray(e)?e[a].tensor:e[o];if(s!=null){var u=t.accumulatedGrads[a].variable;Rr(function(){var f=u.add(s.square());u.assign(f);var C=s.div(f.add(Ve.backend.epsilon()).sqrt()).mul(-t.learningRate).add(i);i.assign(C)})}}),this.incrementIterations()},r.prototype.dispose=function(){this.accumulatedGrads!=null&&qr(this.accumulatedGrads.map(function(e){return e.variable}))},r.prototype.getWeights=function(){return E(this,void 0,void 0,function(){return g(this,function(e){switch(e.label){case 0:return[4,this.saveIterations()];case 1:return[2,[e.sent()].concat(this.accumulatedGrads.map(function(t){return{name:t.originalName,tensor:t.variable}}))]}})})},r.prototype.setWeights=function(e){return E(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this.extractIterations(e)];case 1:return e=t.sent(),this.accumulatedGrads=e.map(function(o){return{originalName:o.name,variable:o.tensor.variable(!1)}}),[2]}})})},r.prototype.getConfig=function(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}},r.fromConfig=function(e,t){return new e(t.learningRate,t.initialAccumulatorValue)},r.className="Adagrad",r}(ea);Io(ed);var td=function(n){function r(e,t,o,a){a===void 0&&(a=null);var i=n.call(this)||this;return i.learningRate=e,i.beta1=t,i.beta2=o,i.epsilon=a,i.accumulatedFirstMoment=[],i.accumulatedSecondMoment=[],Rr(function(){i.accBeta1=Nt(t).variable(),i.accBeta2=Nt(o).variable()}),a==null&&(i.epsilon=Ve.backend.epsilon()),i}return D(r,n),r.prototype.applyGradients=function(e){var t=this,o=Array.isArray(e)?e.map(function(a){return a.name}):Object.keys(e);Rr(function(){var a=Ao(1,t.accBeta1),i=Ao(1,t.accBeta2);o.forEach(function(s,u){var f=Ve.registeredVariables[s];t.accumulatedFirstMoment[u]==null&&(t.accumulatedFirstMoment[u]={originalName:s+"/m",variable:Rr(function(){return Jt(f).variable(!1)})}),t.accumulatedSecondMoment[u]==null&&(t.accumulatedSecondMoment[u]={originalName:s+"/v",variable:Rr(function(){return Jt(f).variable(!1)})});var C=Array.isArray(e)?e[u].tensor:e[s];if(C!=null){var k=t.accumulatedFirstMoment[u].variable,L=t.accumulatedSecondMoment[u].variable,X=k.mul(t.beta1).add(C.mul(1-t.beta1)),oe=L.mul(t.beta2).add(C.square().mul(1-t.beta2)),ue=X.div(a),se=oe.div(i);k.assign(X),L.assign(oe);var ce=ue.div(se.sqrt().add(t.epsilon)).mul(-t.learningRate).add(f);f.assign(ce)}}),t.accBeta1.assign(t.accBeta1.mul(t.beta1)),t.accBeta2.assign(t.accBeta2.mul(t.beta2))}),this.incrementIterations()},r.prototype.dispose=function(){this.accBeta1.dispose(),this.accBeta2.dispose(),this.accumulatedFirstMoment!=null&&qr(this.accumulatedFirstMoment.map(function(e){return e.variable})),this.accumulatedSecondMoment!=null&&qr(this.accumulatedSecondMoment.map(function(e){return e.variable}))},r.prototype.getWeights=function(){return E(this,void 0,void 0,function(){var e;return g(this,function(t){switch(t.label){case 0:return e=this.accumulatedFirstMoment.concat(this.accumulatedSecondMoment),[4,this.saveIterations()];case 1:return[2,[t.sent()].concat(e.map(function(o){return{name:o.originalName,tensor:o.variable}}))]}})})},r.prototype.setWeights=function(e){return E(this,void 0,void 0,function(){var t,o=this;return g(this,function(a){switch(a.label){case 0:return[4,this.extractIterations(e)];case 1:return e=a.sent(),Rr(function(){o.accBeta1.assign(hs(o.beta1,o.iterations_+1)),o.accBeta2.assign(hs(o.beta2,o.iterations_+1))}),t=e.length/2,this.accumulatedFirstMoment=e.slice(0,t).map(function(i){return{originalName:i.name,variable:i.tensor.variable(!1)}}),this.accumulatedSecondMoment=e.slice(t,2*t).map(function(i){return{originalName:i.name,variable:i.tensor.variable(!1)}}),[2]}})})},r.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}},r.fromConfig=function(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)},r.className="Adam",r}(ea);Io(td);var rd=function(n){function r(e,t,o,a,i){a===void 0&&(a=null),i===void 0&&(i=0);var s=n.call(this)||this;return s.learningRate=e,s.beta1=t,s.beta2=o,s.epsilon=a,s.decay=i,s.accumulatedFirstMoment=[],s.accumulatedWeightedInfNorm=[],Rr(function(){s.iteration=Nt(0).variable(),s.accBeta1=Nt(t).variable()}),a==null&&(s.epsilon=Ve.backend.epsilon()),s}return D(r,n),r.prototype.applyGradients=function(e){var t=this,o=Array.isArray(e)?e.map(function(a){return a.name}):Object.keys(e);Rr(function(){var a=Ao(1,t.accBeta1),i=fs(-t.learningRate,t.iteration.mul(t.decay).add(1));o.forEach(function(s,u){var f=Ve.registeredVariables[s];t.accumulatedFirstMoment[u]==null&&(t.accumulatedFirstMoment[u]={originalName:s+"/m",variable:Jt(f).variable(!1)}),t.accumulatedWeightedInfNorm[u]==null&&(t.accumulatedWeightedInfNorm[u]={originalName:s+"/v",variable:Jt(f).variable(!1)});var C=Array.isArray(e)?e[u].tensor:e[s];if(C!=null){var k=t.accumulatedFirstMoment[u].variable,L=t.accumulatedWeightedInfNorm[u].variable,X=k.mul(t.beta1).add(C.mul(1-t.beta1)),oe=L.mul(t.beta2),ue=C.abs(),se=oe.maximum(ue);k.assign(X),L.assign(se);var ce=i.div(a).mul(X.div(se.add(t.epsilon))).add(f);f.assign(ce)}}),t.iteration.assign(t.iteration.add(1)),t.accBeta1.assign(t.accBeta1.mul(t.beta1))}),this.incrementIterations()},r.prototype.dispose=function(){this.accBeta1.dispose(),this.iteration.dispose(),this.accumulatedFirstMoment!=null&&qr(this.accumulatedFirstMoment.map(function(e){return e.variable})),this.accumulatedWeightedInfNorm!=null&&qr(this.accumulatedWeightedInfNorm.map(function(e){return e.variable}))},r.prototype.getWeights=function(){return E(this,void 0,void 0,function(){return g(this,function(e){throw new Error("getWeights() is not implemented for Adamax yet.")})})},r.prototype.setWeights=function(e){return E(this,void 0,void 0,function(){return g(this,function(t){throw new Error("setWeights() is not implemented for Adamax yet.")})})},r.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}},r.fromConfig=function(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)},r.className="Adamax",r}(ea);Io(rd);var Gu=function(n){function r(e){var t=n.call(this)||this;return t.learningRate=e,t.setLearningRate(e),t}return D(r,n),r.prototype.applyGradients=function(e){var t=this;(Array.isArray(e)?e.map(function(o){return o.name}):Object.keys(e)).forEach(function(o,a){var i=Array.isArray(e)?e[a].tensor:e[o];if(i!=null){var s=Ve.registeredVariables[o];Rr(function(){var u=t.c.mul(i).add(s);s.assign(u)})}}),this.incrementIterations()},r.prototype.setLearningRate=function(e){this.learningRate=e,this.c!=null&&this.c.dispose(),this.c=Cs(Nt(-e))},r.prototype.dispose=function(){this.c.dispose()},r.prototype.getWeights=function(){return E(this,void 0,void 0,function(){return g(this,function(e){switch(e.label){case 0:return[4,this.saveIterations()];case 1:return[2,[e.sent()]]}})})},r.prototype.setWeights=function(e){return E(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this.extractIterations(e)];case 1:if((e=t.sent()).length!==0)throw new Error("SGD optimizer does not have settable weights.");return[2]}})})},r.prototype.getConfig=function(){return{learningRate:this.learningRate}},r.fromConfig=function(e,t){return new e(t.learningRate)},r.className="SGD",r}(ea);Io(Gu);var nd=function(n){function r(e,t,o){o===void 0&&(o=!1);var a=n.call(this,e)||this;return a.learningRate=e,a.momentum=t,a.useNesterov=o,a.accumulations=[],a.m=Nt(a.momentum),a}return D(r,n),r.prototype.applyGradients=function(e){var t=this;(Array.isArray(e)?e.map(function(o){return o.name}):Object.keys(e)).forEach(function(o,a){var i=Ve.registeredVariables[o];t.accumulations[a]==null&&(t.accumulations[a]={originalName:o+"/momentum",variable:Rr(function(){return Jt(i).variable(!1)})});var s=t.accumulations[a].variable,u=Array.isArray(e)?e[a].tensor:e[o];u!=null&&Rr(function(){var f,C=t.m.mul(s).add(u);f=t.useNesterov?t.c.mul(u.add(C.mul(t.m))).add(i):t.c.mul(C).add(i),s.assign(C),i.assign(f)})}),this.incrementIterations()},r.prototype.dispose=function(){this.m.dispose(),this.accumulations!=null&&qr(this.accumulations.map(function(e){return e.variable}))},r.prototype.setMomentum=function(e){this.momentum=e},r.prototype.getWeights=function(){return E(this,void 0,void 0,function(){return g(this,function(e){switch(e.label){case 0:return[4,this.saveIterations()];case 1:return[2,[e.sent()].concat(this.accumulations.map(function(t){return{name:t.originalName,tensor:t.variable}}))]}})})},r.prototype.setWeights=function(e){return E(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this.extractIterations(e)];case 1:return e=t.sent(),this.accumulations=e.map(function(o){return{originalName:o.name,variable:o.tensor.variable(!1)}}),[2]}})})},r.prototype.getConfig=function(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}},r.fromConfig=function(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)},r.className="Momentum",r}(Gu);Io(nd);var od=function(n){function r(e,t,o,a,i){t===void 0&&(t=.9),o===void 0&&(o=0),a===void 0&&(a=null),i===void 0&&(i=!1);var s=n.call(this)||this;if(s.learningRate=e,s.decay=t,s.momentum=o,s.epsilon=a,s.accumulatedMeanSquares=[],s.accumulatedMoments=[],s.accumulatedMeanGrads=[],s.centered=i,a==null&&(s.epsilon=Ve.backend.epsilon()),e==null)throw new Error("learningRate for RMSPropOptimizer must be defined.");return s}return D(r,n),r.prototype.applyGradients=function(e){var t=this;(Array.isArray(e)?e.map(function(o){return o.name}):Object.keys(e)).forEach(function(o,a){var i=Ve.registeredVariables[o];t.accumulatedMeanSquares[a]==null&&(t.accumulatedMeanSquares[a]={originalName:o+"/rms",variable:Rr(function(){return Jt(i).variable(!1)})}),t.accumulatedMoments[a]==null&&(t.accumulatedMoments[a]={originalName:o+"/momentum",variable:Rr(function(){return Jt(i).variable(!1)})}),t.accumulatedMeanGrads[a]==null&&t.centered&&(t.accumulatedMeanGrads[a]={originalName:o+"/mg",variable:Rr(function(){return Jt(i).variable(!1)})});var s=Array.isArray(e)?e[a].tensor:e[o];if(s!=null){var u=t.accumulatedMeanSquares[a].variable,f=t.accumulatedMoments[a].variable;Rr(function(){var C=u.mul(t.decay).add(s.square().mul(1-t.decay));if(t.centered){var k=t.accumulatedMeanGrads[a].variable,L=k.mul(t.decay).add(s.mul(1-t.decay)),X=f.mul(t.momentum).add(s.mul(t.learningRate).div(C.sub(L.square().add(t.epsilon)).sqrt()));u.assign(C),k.assign(L),f.assign(X);var oe=i.sub(X);i.assign(oe)}else{var ue=u.mul(t.decay).add(s.square().mul(1-t.decay));X=f.mul(t.momentum).add(s.mul(t.learningRate).div(ue.add(t.epsilon).sqrt())),u.assign(ue),f.assign(X),oe=i.sub(X),i.assign(oe)}})}}),this.incrementIterations()},r.prototype.dispose=function(){this.accumulatedMeanSquares!=null&&qr(this.accumulatedMeanSquares.map(function(e){return e.variable})),this.accumulatedMeanGrads!=null&&this.centered&&qr(this.accumulatedMeanGrads.map(function(e){return e.variable})),this.accumulatedMoments!=null&&qr(this.accumulatedMoments.map(function(e){return e.variable}))},r.prototype.getWeights=function(){return E(this,void 0,void 0,function(){var e;return g(this,function(t){switch(t.label){case 0:return e=this.accumulatedMeanSquares.concat(this.accumulatedMoments),this.centered&&e.push.apply(e,this.accumulatedMeanGrads),[4,this.saveIterations()];case 1:return[2,[t.sent()].concat(e.map(function(o){return{name:o.originalName,tensor:o.variable}}))]}})})},r.prototype.setWeights=function(e){return E(this,void 0,void 0,function(){var t;return g(this,function(o){switch(o.label){case 0:return[4,this.extractIterations(e)];case 1:return e=o.sent(),t=this.centered?e.length/3:e.length/2,this.accumulatedMeanSquares=e.slice(0,t).map(function(a){return{originalName:a.name,variable:a.tensor.variable(!1)}}),this.accumulatedMoments=e.slice(t,2*t).map(function(a){return{originalName:a.name,variable:a.tensor.variable(!1)}}),this.centered&&(this.accumulatedMeanGrads=e.slice(2*t,3*t).map(function(a){return{originalName:a.name,variable:a.tensor.variable(!1)}})),[2]}})})},r.prototype.getConfig=function(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}},r.fromConfig=function(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)},r.className="RMSProp",r}(ea);Io(od);var ta=function(){function n(){}return n.sgd=function(r){return new Gu(r)},n.momentum=function(r,e,t){return t===void 0&&(t=!1),new nd(r,e,t)},n.rmsprop=function(r,e,t,o,a){return e===void 0&&(e=.9),t===void 0&&(t=0),o===void 0&&(o=null),a===void 0&&(a=!1),new od(r,e,t,o,a)},n.adam=function(r,e,t,o){return r===void 0&&(r=.001),e===void 0&&(e=.9),t===void 0&&(t=.999),o===void 0&&(o=null),new td(r,e,t,o)},n.adadelta=function(r,e,t){return r===void 0&&(r=.001),e===void 0&&(e=.95),t===void 0&&(t=null),new Zl(r,e,t)},n.adamax=function(r,e,t,o,a){return r===void 0&&(r=.002),e===void 0&&(e=.9),t===void 0&&(t=.999),o===void 0&&(o=null),a===void 0&&(a=0),new rd(r,e,t,o,a)},n.adagrad=function(r,e){return e===void 0&&(e=.1),new ed(r,e)},n}(),em={sgd:ta.sgd,momentum:ta.momentum,adadelta:ta.adadelta,adagrad:ta.adagrad,rmsprop:ta.rmsprop,adamax:ta.adamax,adam:ta.adam},Vp=typeof requestAnimationFrame!="undefined"?requestAnimationFrame:typeof setImmediate!="undefined"?setImmediate:function(n){return n()};function tm(){return new Promise(function(n){return Vp(function(){return n()})})}Dr.prototype.squaredDifference=function(n){return zc(this,n)},tt=xp}).call(this,N("IyRk"),N("Q2Ig"),N("HDXh").Buffer)},S6kV:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.mode.OFB=function(){var d=y.lib.BlockCipherMode.extend(),F=d.Encryptor=d.extend({processBlock:function(M,D){var E=this._cipher,g=E.blockSize,h=this._iv,b=this._keystream;h&&(b=this._keystream=h.slice(0),this._iv=void 0),E.encryptBlock(b,0);for(var p=0;p<g;p++)M[D+p]^=b[p]}});return d.Decryptor=F,d}(),y.mode.OFB})},WYAk:function(l,G,N){(function(y,d){l.exports=G=d(N("Ib8C"))})(this,function(y){(function(){var d=y,F=d.lib,M=F.Base,D=d.enc,E=D.Utf8,g=d.algo,h=g.HMAC=M.extend({init:function(b,p){b=this._hasher=new b.init,typeof p=="string"&&(p=E.parse(p));var v=b.blockSize,I=v*4;p.sigBytes>I&&(p=b.finalize(p)),p.clamp();for(var x=this._oKey=p.clone(),S=this._iKey=p.clone(),H=x.words,B=S.words,Q=0;Q<v;Q++)H[Q]^=1549556828,B[Q]^=909522486;x.sigBytes=S.sigBytes=I,this.reset()},reset:function(){var b=this._hasher;b.reset(),b.update(this._iKey)},update:function(b){return this._hasher.update(b),this},finalize:function(b){var p=this._hasher,v=p.finalize(b);p.reset();var I=p.finalize(this._oKey.clone().concat(v));return I}})})()})},bQjk:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("OLod"))})(this,function(y){return function(d){var F=y,M=F.lib,D=M.CipherParams,E=F.enc,g=E.Hex,h=F.format,b=h.Hex={stringify:function(p){return p.ciphertext.toString(g)},parse:function(p){var v=g.parse(p);return D.create({ciphertext:v})}}}(),y.format.Hex})},cv67:function(l,G,N){(function(y,d){l.exports=G=d(N("Ib8C"))})(this,function(y){return function(d){var F=y,M=F.lib,D=M.WordArray,E=M.Hasher,g=F.algo,h=[];(function(){for(var S=0;S<64;S++)h[S]=d.abs(d.sin(S+1))*4294967296|0})();var b=g.MD5=E.extend({_doReset:function(){this._hash=new D.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(S,H){for(var B=0;B<16;B++){var Q=H+B,z=S[Q];S[Q]=(z<<8|z>>>24)&16711935|(z<<24|z>>>8)&4278255360}var K=this._hash.words,J=S[H+0],U=S[H+1],j=S[H+2],T=S[H+3],te=S[H+4],Z=S[H+5],_=S[H+6],Y=S[H+7],re=S[H+8],pe=S[H+9],le=S[H+10],_e=S[H+11],me=S[H+12],ke=S[H+13],$=S[H+14],ne=S[H+15],W=K[0],ie=K[1],de=K[2],ee=K[3];W=p(W,ie,de,ee,J,7,h[0]),ee=p(ee,W,ie,de,U,12,h[1]),de=p(de,ee,W,ie,j,17,h[2]),ie=p(ie,de,ee,W,T,22,h[3]),W=p(W,ie,de,ee,te,7,h[4]),ee=p(ee,W,ie,de,Z,12,h[5]),de=p(de,ee,W,ie,_,17,h[6]),ie=p(ie,de,ee,W,Y,22,h[7]),W=p(W,ie,de,ee,re,7,h[8]),ee=p(ee,W,ie,de,pe,12,h[9]),de=p(de,ee,W,ie,le,17,h[10]),ie=p(ie,de,ee,W,_e,22,h[11]),W=p(W,ie,de,ee,me,7,h[12]),ee=p(ee,W,ie,de,ke,12,h[13]),de=p(de,ee,W,ie,$,17,h[14]),ie=p(ie,de,ee,W,ne,22,h[15]),W=v(W,ie,de,ee,U,5,h[16]),ee=v(ee,W,ie,de,_,9,h[17]),de=v(de,ee,W,ie,_e,14,h[18]),ie=v(ie,de,ee,W,J,20,h[19]),W=v(W,ie,de,ee,Z,5,h[20]),ee=v(ee,W,ie,de,le,9,h[21]),de=v(de,ee,W,ie,ne,14,h[22]),ie=v(ie,de,ee,W,te,20,h[23]),W=v(W,ie,de,ee,pe,5,h[24]),ee=v(ee,W,ie,de,$,9,h[25]),de=v(de,ee,W,ie,T,14,h[26]),ie=v(ie,de,ee,W,re,20,h[27]),W=v(W,ie,de,ee,ke,5,h[28]),ee=v(ee,W,ie,de,j,9,h[29]),de=v(de,ee,W,ie,Y,14,h[30]),ie=v(ie,de,ee,W,me,20,h[31]),W=I(W,ie,de,ee,Z,4,h[32]),ee=I(ee,W,ie,de,re,11,h[33]),de=I(de,ee,W,ie,_e,16,h[34]),ie=I(ie,de,ee,W,$,23,h[35]),W=I(W,ie,de,ee,U,4,h[36]),ee=I(ee,W,ie,de,te,11,h[37]),de=I(de,ee,W,ie,Y,16,h[38]),ie=I(ie,de,ee,W,le,23,h[39]),W=I(W,ie,de,ee,ke,4,h[40]),ee=I(ee,W,ie,de,J,11,h[41]),de=I(de,ee,W,ie,T,16,h[42]),ie=I(ie,de,ee,W,_,23,h[43]),W=I(W,ie,de,ee,pe,4,h[44]),ee=I(ee,W,ie,de,me,11,h[45]),de=I(de,ee,W,ie,ne,16,h[46]),ie=I(ie,de,ee,W,j,23,h[47]),W=x(W,ie,de,ee,J,6,h[48]),ee=x(ee,W,ie,de,Y,10,h[49]),de=x(de,ee,W,ie,$,15,h[50]),ie=x(ie,de,ee,W,Z,21,h[51]),W=x(W,ie,de,ee,me,6,h[52]),ee=x(ee,W,ie,de,T,10,h[53]),de=x(de,ee,W,ie,le,15,h[54]),ie=x(ie,de,ee,W,U,21,h[55]),W=x(W,ie,de,ee,re,6,h[56]),ee=x(ee,W,ie,de,ne,10,h[57]),de=x(de,ee,W,ie,_,15,h[58]),ie=x(ie,de,ee,W,ke,21,h[59]),W=x(W,ie,de,ee,te,6,h[60]),ee=x(ee,W,ie,de,_e,10,h[61]),de=x(de,ee,W,ie,j,15,h[62]),ie=x(ie,de,ee,W,pe,21,h[63]),K[0]=K[0]+W|0,K[1]=K[1]+ie|0,K[2]=K[2]+de|0,K[3]=K[3]+ee|0},_doFinalize:function(){var S=this._data,H=S.words,B=this._nDataBytes*8,Q=S.sigBytes*8;H[Q>>>5]|=128<<24-Q%32;var z=d.floor(B/4294967296),K=B;H[(Q+64>>>9<<4)+15]=(z<<8|z>>>24)&16711935|(z<<24|z>>>8)&4278255360,H[(Q+64>>>9<<4)+14]=(K<<8|K>>>24)&16711935|(K<<24|K>>>8)&4278255360,S.sigBytes=(H.length+1)*4,this._process();for(var J=this._hash,U=J.words,j=0;j<4;j++){var T=U[j];U[j]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360}return J},clone:function(){var S=E.clone.call(this);return S._hash=this._hash.clone(),S}});function p(S,H,B,Q,z,K,J){var U=S+(H&B|~H&Q)+z+J;return(U<<K|U>>>32-K)+H}function v(S,H,B,Q,z,K,J){var U=S+(H&Q|B&~Q)+z+J;return(U<<K|U>>>32-K)+H}function I(S,H,B,Q,z,K,J){var U=S+(H^B^Q)+z+J;return(U<<K|U>>>32-K)+H}function x(S,H,B,Q,z,K,J){var U=S+(B^(H|~Q))+z+J;return(U<<K|U>>>32-K)+H}F.MD5=E._createHelper(b),F.HmacMD5=E._createHmacHelper(b)}(Math),y.MD5})},e7zE:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("3y9D"),N("WYAk"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.Base,D=F.WordArray,E=d.algo,g=E.SHA1,h=E.HMAC,b=E.PBKDF2=M.extend({cfg:M.extend({keySize:128/32,hasher:g,iterations:1}),init:function(p){this.cfg=this.cfg.extend(p)},compute:function(p,v){for(var I=this.cfg,x=h.create(I.hasher,p),S=D.create(),H=D.create([1]),B=S.words,Q=H.words,z=I.keySize,K=I.iterations;B.length<z;){var J=x.update(v).finalize(H);x.reset();for(var U=J.words,j=U.length,T=J,te=1;te<K;te++){T=x.finalize(T),x.reset();for(var Z=T.words,_=0;_<j;_++)U[_]^=Z[_]}S.concat(J),Q[0]++}return S.sigBytes=z*4,S}});d.PBKDF2=function(p,v,I){return b.create(I).compute(p,v)}}(),y.PBKDF2})},"gb/T":function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.mode.ECB=function(){var d=y.lib.BlockCipherMode.extend();return d.Encryptor=d.extend({processBlock:function(F,M){this._cipher.encryptBlock(F,M)}}),d.Decryptor=d.extend({processBlock:function(F,M){this._cipher.decryptBlock(F,M)}}),d}(),y.mode.ECB})},gctT:function(l,G,N){"use strict";N.r(G);var y={};N.r(y),N.d(y,"drawContour",function(){return ne}),N.d(y,"drawDetections",function(){return Ve}),N.d(y,"drawFaceExpressions",function(){return Ii}),N.d(y,"DrawBoxOptions",function(){return Wa}),N.d(y,"DrawBox",function(){return Si}),N.d(y,"DrawFaceLandmarksOptions",function(){return Jr}),N.d(y,"DrawFaceLandmarks",function(){return la}),N.d(y,"drawFaceLandmarks",function(){return Ni}),N.d(y,"AnchorPosition",function(){return cn}),N.d(y,"DrawTextFieldOptions",function(){return ko}),N.d(y,"DrawTextField",function(){return Ti});var d=N("2qtc"),F=N("kLXV"),M=N("14J3"),D=N("BMrR"),E=N("jCWc"),g=N("kPKH"),h=N("+L6B"),b=N("2/Rp"),p=N("miYZ"),v=N("tsqr"),I=N("k1fw"),x=N("9og8"),S=N("tJVT"),H=N("PpiC"),B=N("FJo9"),Q=N("L41K"),z=N("aHsQ"),K=N("sGsY"),J=N("WmNS"),U=N.n(J),j=N("q1tI"),T=N.n(j),te=N("Ty5D"),Z=N("9kvl"),_=N("yPBj"),Y=N.n(_),re=N("1vsH"),pe=N("V0Rq"),le=N("D1Df"),_e=N.n(le),me=N("T2oS"),ke=N("W9HT"),$=N("Re/O");function ne(O,w,A){if(A===void 0&&(A=!1),O.beginPath(),w.slice(1).forEach(function(ae,ge){var he=ae.x,Te=ae.y,Ie=w[ge];O.moveTo(Ie.x,Ie.y),O.lineTo(he,Te)}),A){var P=w[w.length-1],V=w[0];if(!P||!V)return;O.moveTo(P.x,P.y),O.lineTo(V.x,V.y)}O.stroke()}var W=N("mrSG"),ie=function(){function O(w,A){if(!He(w)||!He(A))throw new Error("Dimensions.constructor - expected width and height to be valid numbers, instead have "+JSON.stringify({width:w,height:A}));this._width=w,this._height=A}return Object.defineProperty(O.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),O.prototype.reverse=function(){return new O(1/this.width,1/this.height)},O}();function de(O,w){return O instanceof $.a&&O.shape.length===w}function ee(O){return de(O,1)}function Ce(O){return de(O,2)}function De(O){return de(O,3)}function Le(O){return de(O,4)}function Ye(O){return O%1!==0}function et(O){return O%2===0}function Ae(O,w){w===void 0&&(w=2);var A=Math.pow(10,w);return Math.floor(O*A)/A}function ct(O){return O&&O.width&&O.height}function $e(O,w){var A=O.width,P=O.height,V=w/Math.max(P,A);return new ie(Math.round(A*V),Math.round(P*V))}function Fe(O){return O.reduce(function(w,A){return w.add(A)},new ye(0,0)).div(new ye(O.length,O.length))}function Pe(O,w,A){return Array(O).fill(0).map(function(P,V){return w+V*A})}function He(O){return!!O&&O!==Infinity&&O!==-Infinity&&!isNaN(O)||O===0}function ot(O){return He(O)&&0<=O&&O<=1}var ye=function(){function O(w,A){this._x=w,this._y=A}return Object.defineProperty(O.prototype,"x",{get:function(){return this._x},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"y",{get:function(){return this._y},enumerable:!0,configurable:!0}),O.prototype.add=function(w){return new O(this.x+w.x,this.y+w.y)},O.prototype.sub=function(w){return new O(this.x-w.x,this.y-w.y)},O.prototype.mul=function(w){return new O(this.x*w.x,this.y*w.y)},O.prototype.div=function(w){return new O(this.x/w.x,this.y/w.y)},O.prototype.abs=function(){return new O(Math.abs(this.x),Math.abs(this.y))},O.prototype.magnitude=function(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))},O.prototype.floor=function(){return new O(Math.floor(this.x),Math.floor(this.y))},O}(),be=function(){function O(w,A){A===void 0&&(A=!0);var P=w||{},V=[P.left,P.top,P.right,P.bottom].every(He),ae=[P.x,P.y,P.width,P.height].every(He);if(!ae&&!V)throw new Error("Box.constructor - expected box to be IBoundingBox | IRect, instead have "+JSON.stringify(P));var ge=ae?[P.x,P.y,P.width,P.height]:[P.left,P.top,P.right-P.left,P.bottom-P.top],he=ge[0],Te=ge[1],Ie=ge[2],Ne=ge[3];O.assertIsValidBox({x:he,y:Te,width:Ie,height:Ne},"Box.constructor",A),this._x=he,this._y=Te,this._width=Ie,this._height=Ne}return O.isRect=function(w){return!!w&&[w.x,w.y,w.width,w.height].every(He)},O.assertIsValidBox=function(w,A,P){if(P===void 0&&(P=!1),!O.isRect(w))throw new Error(A+" - invalid box: "+JSON.stringify(w)+", expected object with properties x, y, width, height");if(!P&&(w.width<0||w.height<0))throw new Error(A+" - width ("+w.width+") and height ("+w.height+") must be positive numbers")},Object.defineProperty(O.prototype,"x",{get:function(){return this._x},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"y",{get:function(){return this._y},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"left",{get:function(){return this.x},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"top",{get:function(){return this.y},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"right",{get:function(){return this.x+this.width},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"area",{get:function(){return this.width*this.height},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"topLeft",{get:function(){return new ye(this.left,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"topRight",{get:function(){return new ye(this.right,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"bottomLeft",{get:function(){return new ye(this.left,this.bottom)},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"bottomRight",{get:function(){return new ye(this.right,this.bottom)},enumerable:!0,configurable:!0}),O.prototype.round=function(){var w=[this.x,this.y,this.width,this.height].map(function(ge){return Math.round(ge)}),A=w[0],P=w[1],V=w[2],ae=w[3];return new O({x:A,y:P,width:V,height:ae})},O.prototype.floor=function(){var w=[this.x,this.y,this.width,this.height].map(function(ge){return Math.floor(ge)}),A=w[0],P=w[1],V=w[2],ae=w[3];return new O({x:A,y:P,width:V,height:ae})},O.prototype.toSquare=function(){var w=this,A=w.x,P=w.y,V=w.width,ae=w.height,ge=Math.abs(V-ae);return V<ae&&(A-=ge/2,V+=ge),ae<V&&(P-=ge/2,ae+=ge),new O({x:A,y:P,width:V,height:ae})},O.prototype.rescale=function(w){var A=ct(w)?w.width:w,P=ct(w)?w.height:w;return new O({x:this.x*A,y:this.y*P,width:this.width*A,height:this.height*P})},O.prototype.pad=function(w,A){var P=[this.x-w/2,this.y-A/2,this.width+w,this.height+A],V=P[0],ae=P[1],ge=P[2],he=P[3];return new O({x:V,y:ae,width:ge,height:he})},O.prototype.clipAtImageBorders=function(w,A){var P=this,V=P.x,ae=P.y,ge=P.right,he=P.bottom,Te=Math.max(V,0),Ie=Math.max(ae,0),Ne=ge-Te,We=he-Ie,Ge=Math.min(Ne,w-Te),Qe=Math.min(We,A-Ie);return new O({x:Te,y:Ie,width:Ge,height:Qe}).floor()},O.prototype.shift=function(w,A){var P=this,V=P.width,ae=P.height,ge=this.x+w,he=this.y+A;return new O({x:ge,y:he,width:V,height:ae})},O.prototype.padAtBorders=function(w,A){var P=this.width+1,V=this.height+1,ae=1,ge=1,he=P,Te=V,Ie=this.left,Ne=this.top,We=this.right,Ge=this.bottom;return We>A&&(he=-We+A+P,We=A),Ge>w&&(Te=-Ge+w+V,Ge=w),Ie<1&&(Te=2-Ie,Ie=1),Ne<1&&(Te=2-Ne,Ne=1),{dy:ge,edy:Te,dx:ae,edx:he,y:Ne,ey:Ge,x:Ie,ex:We,w:P,h:V}},O.prototype.calibrate=function(w){return new O({left:this.left+w.left*this.width,top:this.top+w.top*this.height,right:this.right+w.right*this.width,bottom:this.bottom+w.bottom*this.height}).toSquare().round()},O}(),Ke=function(O){Object(W.c)(w,O);function w(A,P,V,ae,ge){return ge===void 0&&(ge=!1),O.call(this,{left:A,top:P,right:V,bottom:ae},ge)||this}return w}(be),q=function(){function O(w,A,P,V,ae){this._imageDims=new ie(ae.width,ae.height),this._score=w,this._classScore=A,this._className=P,this._box=new be(V).rescale(this._imageDims)}return Object.defineProperty(O.prototype,"score",{get:function(){return this._score},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"classScore",{get:function(){return this._classScore},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"className",{get:function(){return this._className},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"box",{get:function(){return this._box},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"imageDims",{get:function(){return this._imageDims},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"imageWidth",{get:function(){return this.imageDims.width},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"imageHeight",{get:function(){return this.imageDims.height},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"relativeBox",{get:function(){return new be(this._box).rescale(this.imageDims.reverse())},enumerable:!0,configurable:!0}),O.prototype.forSize=function(w,A){return new O(this.score,this.classScore,this.className,this.relativeBox,{width:w,height:A})},O}(),m=function(O){Object(W.c)(w,O);function w(A,P,V){return O.call(this,A,A,"",P,V)||this}return w.prototype.forSize=function(A,P){var V=O.prototype.forSize.call(this,A,P),ae=V.score,ge=V.relativeBox,he=V.imageDims;return new w(ae,ge,he)},w}(q);function c(O,w,A){A===void 0&&(A=!0);var P=Math.max(0,Math.min(O.right,w.right)-Math.max(O.left,w.left)),V=Math.max(0,Math.min(O.bottom,w.bottom)-Math.max(O.top,w.top)),ae=P*V;return A?ae/(O.area+w.area-ae):ae/Math.min(O.area,w.area)}function R(O){var w=O.map(function(he){return he.x}),A=O.map(function(he){return he.y}),P=w.reduce(function(he,Te){return Te<he?Te:he},Infinity),V=A.reduce(function(he,Te){return Te<he?Te:he},Infinity),ae=w.reduce(function(he,Te){return he<Te?Te:he},0),ge=A.reduce(function(he,Te){return he<Te?Te:he},0);return new Ke(P,V,ae,ge)}function fe(O,w,A,P){P===void 0&&(P=!0);for(var V=w.map(function(he,Te){return{score:he,boxIndex:Te}}).sort(function(he,Te){return he.score-Te.score}).map(function(he){return he.boxIndex}),ae=[],ge=function(){var he=V.pop();ae.push(he);for(var Te=V,Ie=[],Ne=0;Ne<Te.length;Ne++){var We=Te[Ne],Ge=O[he],Qe=O[We];Ie.push(c(Ge,Qe,P))}V=V.filter(function(it,yt){return Ie[yt]<=A})};V.length>0;)ge();return ae}function ve(O,w){return $.L(function(){var A=w[0],P=w[1],V=w[2],ae=$.n(Object(W.e)(O.shape.slice(0,3),[1]),A),ge=$.n(Object(W.e)(O.shape.slice(0,3),[1]),P),he=$.n(Object(W.e)(O.shape.slice(0,3),[1]),V),Te=$.h([ae,ge,he],3);return $.F(O,Te)})}function Re(O,w){return w===void 0&&(w=!1),$.L(function(){var A=O.shape.slice(1),P=A[0],V=A[1];if(P===V)return O;var ae=Math.abs(P-V),ge=Math.round(ae*(w?.5:1)),he=P>V?2:1,Te=function(Qe){var it=O.shape.slice();return it[he]=Qe,$.n(it,0)},Ie=Te(ge),Ne=ae-Ie.shape[he],We=w&&Ne?Te(Ne):null,Ge=[We,O,Ie].filter(function(Qe){return!!Qe}).map(function(Qe){return Qe.toFloat()});return $.h(Ge,he)})}function qe(O){for(var w=O.slice(),A=w.length-1;A>0;A--){var P=Math.floor(Math.random()*(A+1)),V=w[A];w[A]=w[P],w[P]=V}return w}function nt(O){return 1/(1+Math.exp(-O))}function st(O){return Math.log(O/(1-O))}var bt=function(O){Object(W.c)(w,O);function w(A,P,V,ae,ge){return ge===void 0&&(ge=!1),O.call(this,{x:A,y:P,width:V,height:ae},ge)||this}return w}(be),dt=.5,Et=.43,It=.45,at=function(){function O(w,A,P){P===void 0&&(P=new ye(0,0));var V=A.width,ae=A.height;this._imgDims=new ie(V,ae),this._shift=P,this._positions=w.map(function(ge){return ge.mul(new ye(V,ae)).add(P)})}return Object.defineProperty(O.prototype,"shift",{get:function(){return new ye(this._shift.x,this._shift.y)},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"imageWidth",{get:function(){return this._imgDims.width},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"imageHeight",{get:function(){return this._imgDims.height},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"positions",{get:function(){return this._positions},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"relativePositions",{get:function(){var w=this;return this._positions.map(function(A){return A.sub(w._shift).div(new ye(w.imageWidth,w.imageHeight))})},enumerable:!0,configurable:!0}),O.prototype.forSize=function(w,A){return new this.constructor(this.relativePositions,{width:w,height:A})},O.prototype.shiftBy=function(w,A){return new this.constructor(this.relativePositions,this._imgDims,new ye(w,A))},O.prototype.shiftByPoint=function(w){return this.shiftBy(w.x,w.y)},O.prototype.align=function(w,A){if(A===void 0&&(A={}),w){var P=w instanceof m?w.box.floor():new be(w);return this.shiftBy(P.x,P.y).align(null,A)}var V=Object.assign({},{useDlibAlignment:!1,minBoxPadding:.2},A),ae=V.useDlibAlignment,ge=V.minBoxPadding;return ae?this.alignDlib():this.alignMinBbox(ge)},O.prototype.alignDlib=function(){var w=this.getRefPointsForAlignment(),A=w[0],P=w[1],V=w[2],ae=function(We){return V.sub(We).magnitude()},ge=(ae(A)+ae(P))/2,he=Math.floor(ge/It),Te=Fe(w),Ie=Math.floor(Math.max(0,Te.x-dt*he)),Ne=Math.floor(Math.max(0,Te.y-Et*he));return new bt(Ie,Ne,Math.min(he,this.imageWidth+Ie),Math.min(he,this.imageHeight+Ne))},O.prototype.alignMinBbox=function(w){var A=R(this.positions);return A.pad(A.width*w,A.height*w)},O.prototype.getRefPointsForAlignment=function(){throw new Error("getRefPointsForAlignment not implemented by base class")},O}(),Bt=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.getRefPointsForAlignment=function(){var A=this.positions;return[A[0],A[1],Fe([A[3],A[4]])]},w}(at),mr=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.getJawOutline=function(){return this.positions.slice(0,17)},w.prototype.getLeftEyeBrow=function(){return this.positions.slice(17,22)},w.prototype.getRightEyeBrow=function(){return this.positions.slice(22,27)},w.prototype.getNose=function(){return this.positions.slice(27,36)},w.prototype.getLeftEye=function(){return this.positions.slice(36,42)},w.prototype.getRightEye=function(){return this.positions.slice(42,48)},w.prototype.getMouth=function(){return this.positions.slice(48,68)},w.prototype.getRefPointsForAlignment=function(){return[this.getLeftEye(),this.getRightEye(),this.getMouth()].map(Fe)},w}(at),rr=function(){function O(w,A){this._label=w,this._distance=A}return Object.defineProperty(O.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"distance",{get:function(){return this._distance},enumerable:!0,configurable:!0}),O.prototype.toString=function(w){return w===void 0&&(w=!0),""+this.label+(w?" ("+Ae(this.distance)+")":"")},O}(),Sr=function(O){Object(W.c)(w,O);function w(A,P){var V=O.call(this,A)||this;return V._label=P,V}return w.assertIsValidLabeledBox=function(A,P){if(be.assertIsValidBox(A,P),!He(A.label))throw new Error(P+" - expected property label ("+A.label+") to be a number")},Object.defineProperty(w.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),w}(be),Fr=function(){function O(w,A){if(!(typeof w=="string"))throw new Error("LabeledFaceDescriptors - constructor expected label to be a string");if(!Array.isArray(A)||A.some(function(P){return!(P instanceof Float32Array)}))throw new Error("LabeledFaceDescriptors - constructor expected descriptors to be an array of Float32Array");this._label=w,this._descriptors=A}return Object.defineProperty(O.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"descriptors",{get:function(){return this._descriptors},enumerable:!0,configurable:!0}),O.prototype.toJSON=function(){return{label:this.label,descriptors:this.descriptors.map(function(w){return Array.from(w)})}},O.fromJSON=function(w){var A=w.descriptors.map(function(P){return new Float32Array(P)});return new O(w.label,A)},O}(),Nr=function(O){Object(W.c)(w,O);function w(A,P,V,ae){var ge=O.call(this,A,P)||this;return ge._score=V,ge._classScore=ae,ge}return w.assertIsValidPredictedBox=function(A,P){if(Sr.assertIsValidLabeledBox(A,P),!ot(A.score)||!ot(A.classScore))throw new Error(P+" - expected properties score ("+A.score+") and ("+A.classScore+") to be a number between [0, 1]")},Object.defineProperty(w.prototype,"score",{get:function(){return this._score},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"classScore",{get:function(){return this._classScore},enumerable:!0,configurable:!0}),w}(Sr);function Ar(O){return O.detection instanceof m}function tt(O,w){var A={detection:w};return Object.assign({},O,A)}function Xn(){var O=window.fetch||function(){throw new Error("fetch - missing fetch implementation for browser environment")},w=function(){throw new Error("readFile - filesystem not available for browser environment")};return{Canvas:HTMLCanvasElement,CanvasRenderingContext2D,Image:HTMLImageElement,ImageData,Video:HTMLVideoElement,createCanvasElement:function(){return document.createElement("canvas")},createImageElement:function(){return document.createElement("img")},fetch:O,readFile:w}}var Dr=N("rOjP"),Do=N("oX8U");function Kn(){return typeof window=="object"&&typeof document!="undefined"&&typeof HTMLImageElement!="undefined"&&typeof HTMLCanvasElement!="undefined"&&typeof HTMLVideoElement!="undefined"&&typeof ImageData!="undefined"&&typeof CanvasRenderingContext2D!="undefined"}var co=N("8KZw"),Cr;function lo(){if(!Cr)throw new Error("getEnv - environment is not defined, check isNodejs() and isBrowser()");return Cr}function _n(O){Cr=O}function fo(){Kn()&&_n(Xn()),Object(co.a)()&&_n(Object(Do.a)())}function nr(O){if(Cr||fo(),!Cr)throw new Error("monkeyPatch - environment is not defined, check isNodejs() and isBrowser()");var w=O.Canvas,A=w===void 0?Cr.Canvas:w,P=O.Image,V=P===void 0?Cr.Image:P;Cr.Canvas=A,Cr.Image=V,Cr.createCanvasElement=O.createCanvasElement||function(){return new A},Cr.createImageElement=O.createImageElement||function(){return new V},Cr.ImageData=O.ImageData||Cr.ImageData,Cr.Video=O.Video||Cr.Video,Cr.fetch=O.fetch||Cr.fetch,Cr.readFile=O.readFile||Cr.readFile}var hr={getEnv:lo,setEnv:_n,initialize:fo,createBrowserEnv:Xn,createFileSystem:Dr.a,createNodejsEnv:Do.a,monkeyPatch:nr,isBrowser:Kn,isNodejs:co.a};fo();function cr(O){return!hr.isNodejs()&&typeof O=="string"?document.getElementById(O):O}function nn(O){var w=hr.getEnv(),A=w.Canvas,P=w.CanvasRenderingContext2D;if(O instanceof P)return O;var V=cr(O);if(!(V instanceof A))throw new Error("resolveContext2d - expected canvas to be of instance of Canvas");var ae=V.getContext("2d");if(!ae)throw new Error("resolveContext2d - canvas 2d context is null");return ae}var cn;(function(O){O.TOP_LEFT="TOP_LEFT",O.TOP_RIGHT="TOP_RIGHT",O.BOTTOM_LEFT="BOTTOM_LEFT",O.BOTTOM_RIGHT="BOTTOM_RIGHT"})(cn||(cn={}));var ko=function(){function O(w){w===void 0&&(w={});var A=w.anchorPosition,P=w.backgroundColor,V=w.fontColor,ae=w.fontSize,ge=w.fontStyle,he=w.padding;this.anchorPosition=A||cn.TOP_LEFT,this.backgroundColor=P||"rgba(0, 0, 0, 0.5)",this.fontColor=V||"rgba(255, 255, 255, 1)",this.fontSize=ae||14,this.fontStyle=ge||"Georgia",this.padding=he||4}return O}(),Ti=function(){function O(w,A,P){P===void 0&&(P={}),this.text=typeof w=="string"?[w]:w instanceof O?w.text:w,this.anchor=A,this.options=new ko(P)}return O.prototype.measureWidth=function(w){var A=this.options.padding;return this.text.map(function(P){return w.measureText(P).width}).reduce(function(P,V){return P<V?V:P},0)+2*A},O.prototype.measureHeight=function(){var w=this.options,A=w.fontSize,P=w.padding;return this.text.length*A+2*P},O.prototype.getUpperLeft=function(w,A){var P=this.options.anchorPosition,V=P===cn.BOTTOM_RIGHT||P===cn.TOP_RIGHT,ae=P===cn.BOTTOM_LEFT||P===cn.BOTTOM_RIGHT,ge=this.measureWidth(w),he=this.measureHeight(),Te=V?this.anchor.x-ge:this.anchor.x,Ie=ae?this.anchor.y-he:this.anchor.y;if(A){var Ne=A.width,We=A.height,Ge=Math.max(Math.min(Te,Ne-ge),0),Qe=Math.max(Math.min(Ie,We-he),0);return{x:Ge,y:Qe}}return{x:Te,y:Ie}},O.prototype.draw=function(w){var A=cr(w),P=nn(A),V=this.options,ae=V.backgroundColor,ge=V.fontColor,he=V.fontSize,Te=V.fontStyle,Ie=V.padding;P.font=he+"px "+Te;var Ne=this.measureWidth(P),We=this.measureHeight();P.fillStyle=ae;var Ge=this.getUpperLeft(P,A);P.fillRect(Ge.x,Ge.y,Ne,We),P.fillStyle=ge,this.text.forEach(function(Qe,it){var yt=Ie+Ge.x,_t=Ie+Ge.y+(it+1)*he;P.fillText(Qe,yt,_t)})},O}(),Wa=function(){function O(w){w===void 0&&(w={});var A=w.boxColor,P=w.lineWidth,V=w.label,ae=w.drawLabelOptions;this.boxColor=A||"rgba(0, 0, 255, 1)",this.lineWidth=P||2,this.label=V;var ge={anchorPosition:cn.BOTTOM_LEFT,backgroundColor:this.boxColor};this.drawLabelOptions=new ko(Object.assign({},ge,ae))}return O}(),Si=function(){function O(w,A){A===void 0&&(A={}),this.box=new be(w),this.options=new Wa(A)}return O.prototype.draw=function(w){var A=nn(w),P=this.options,V=P.boxColor,ae=P.lineWidth,ge=this.box,he=ge.x,Te=ge.y,Ie=ge.width,Ne=ge.height;A.strokeStyle=V,A.lineWidth=ae,A.strokeRect(he,Te,Ie,Ne);var We=this.options.label;We&&new Ti([We],{x:he-ae/2,y:Te},this.options.drawLabelOptions).draw(w)},O}();function Ve(O,w){var A=Array.isArray(w)?w:[w];A.forEach(function(P){var V=P instanceof m?P.score:Ar(P)?P.detection.score:void 0,ae=P instanceof m?P.box:Ar(P)?P.detection.box:new be(P),ge=V?""+Ae(V):void 0;new Si(ae,{label:ge}).draw(O)})}function Ha(O){var w=hr.getEnv(),A=w.Image,P=w.Video;return O instanceof A&&O.complete||O instanceof P&&O.readyState>=3}function Cn(O){return new Promise(function(w,A){if(O instanceof hr.getEnv().Canvas||Ha(O))return w();function P(ae){if(!ae.currentTarget)return;ae.currentTarget.removeEventListener("load",P),ae.currentTarget.removeEventListener("error",V),w(ae)}function V(ae){if(!ae.currentTarget)return;ae.currentTarget.removeEventListener("load",P),ae.currentTarget.removeEventListener("error",V),A(ae)}O.addEventListener("load",P),O.addEventListener("error",V)})}function Mo(O){return new Promise(function(w,A){if(!(O instanceof Blob))return A("bufferToImage - expected buf to be of type: Blob");var P=new FileReader;P.onload=function(){if(typeof P.result!="string")return A("bufferToImage - expected reader.result to be a string, in onload");var V=hr.getEnv().createImageElement();V.onload=function(){return w(V)},V.onerror=A,V.src=P.result},P.onerror=A,P.readAsDataURL(O)})}function Wr(O){var w=hr.getEnv(),A=w.Image,P=w.Video;return O instanceof A?new ie(O.naturalWidth,O.naturalHeight):O instanceof P?new ie(O.videoWidth,O.videoHeight):new ie(O.width,O.height)}function Hr(O){var w=O.width,A=O.height,P=hr.getEnv().createCanvasElement,V=P();return V.width=w,V.height=A,V}function Tn(O,w){var A=hr.getEnv().ImageData;if(!(O instanceof A)&&!Ha(O))throw new Error("createCanvasFromMedia - media has not finished loading yet");var P=w||Wr(O),V=P.width,ae=P.height,ge=Hr({width:V,height:ae});return O instanceof A?nn(ge).putImageData(O,0,0):nn(ge).drawImage(O,0,0,V,ae),ge}function za(O,w){return Object(W.b)(this,void 0,void 0,function(){var A,P,V,ae,ge,he;return Object(W.d)(this,function(Te){switch(Te.label){case 0:return A=w||hr.getEnv().createCanvasElement(),P=O.shape.slice(Le(O)?1:0),V=P[0],ae=P[1],ge=P[2],he=$.L(function(){return O.as3D(V,ae,ge).toInt()}),[4,$.f.toPixels(he,A)];case 1:return Te.sent(),he.dispose(),[2,A]}})})}function Ga(O){var w=hr.getEnv(),A=w.Image,P=w.Canvas,V=w.Video;return O instanceof A||O instanceof P||O instanceof V}function vn(O,w,A){A===void 0&&(A=!1);var P=hr.getEnv(),V=P.Image,ae=P.Canvas;if(!(O instanceof V||O instanceof ae))throw new Error("imageToSquare - expected arg0 to be HTMLImageElement | HTMLCanvasElement");var ge=Wr(O),he=w/Math.max(ge.height,ge.width),Te=he*ge.width,Ie=he*ge.height,Ne=Hr({width:w,height:w}),We=O instanceof ae?O:Tn(O),Ge=Math.abs(Te-Ie)/2,Qe=A&&Te<Ie?Ge:0,it=A&&Ie<Te?Ge:0;return nn(Ne).drawImage(We,Qe,it,Te,Ie),Ne}var Yn=function(){function O(w,A){var P=this;if(A===void 0&&(A=!1),this._imageTensors=[],this._canvases=[],this._treatAsBatchInput=!1,this._inputDimensions=[],!Array.isArray(w))throw new Error("NetInput.constructor - expected inputs to be an Array of TResolvedNetInput or to be instanceof tf.Tensor4D, instead have "+w);this._treatAsBatchInput=A,this._batchSize=w.length,w.forEach(function(V,ae){if(De(V)){P._imageTensors[ae]=V,P._inputDimensions[ae]=V.shape;return}if(Le(V)){var ge=V.shape[0];if(ge!==1)throw new Error("NetInput - tf.Tensor4D with batchSize "+ge+" passed, but not supported in input array");P._imageTensors[ae]=V,P._inputDimensions[ae]=V.shape.slice(1);return}var he=V instanceof hr.getEnv().Canvas?V:Tn(V);P._canvases[ae]=he,P._inputDimensions[ae]=[he.height,he.width,3]})}return Object.defineProperty(O.prototype,"imageTensors",{get:function(){return this._imageTensors},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"canvases",{get:function(){return this._canvases},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"isBatchInput",{get:function(){return this.batchSize>1||this._treatAsBatchInput},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"batchSize",{get:function(){return this._batchSize},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"inputDimensions",{get:function(){return this._inputDimensions},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"inputSize",{get:function(){return this._inputSize},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"reshapedInputDimensions",{get:function(){var w=this;return Pe(this.batchSize,0,1).map(function(A,P){return w.getReshapedInputDimensions(P)})},enumerable:!0,configurable:!0}),O.prototype.getInput=function(w){return this.canvases[w]||this.imageTensors[w]},O.prototype.getInputDimensions=function(w){return this._inputDimensions[w]},O.prototype.getInputHeight=function(w){return this._inputDimensions[w][0]},O.prototype.getInputWidth=function(w){return this._inputDimensions[w][1]},O.prototype.getReshapedInputDimensions=function(w){if(typeof this.inputSize!="number")throw new Error("getReshapedInputDimensions - inputSize not set, toBatchTensor has not been called yet");var A=this.getInputWidth(w),P=this.getInputHeight(w);return $e({width:A,height:P},this.inputSize)},O.prototype.toBatchTensor=function(w,A){var P=this;return A===void 0&&(A=!0),this._inputSize=w,$.L(function(){var V=Pe(P.batchSize,0,1).map(function(ge){var he=P.getInput(ge);if(he instanceof $.a){var Te=Le(he)?he:he.expandDims();return Te=Re(Te,A),(Te.shape[1]!==w||Te.shape[2]!==w)&&(Te=$.o.resizeBilinear(Te,[w,w])),Te.as3D(w,w,3)}if(he instanceof hr.getEnv().Canvas)return $.f.fromPixels(vn(he,w,A));throw new Error("toBatchTensor - at batchIdx "+ge+", expected input to be instanceof tf.Tensor or instanceof HTMLCanvasElement, instead have "+he)}),ae=$.E(V.map(function(ge){return ge.toFloat()})).as4D(P.batchSize,w,w,3);return ae})},O}();function Or(O){return Object(W.b)(this,void 0,void 0,function(){var w,A,P;return Object(W.d)(this,function(V){switch(V.label){case 0:if(O instanceof Yn)return[2,O];if(w=Array.isArray(O)?O:[O],!w.length)throw new Error("toNetInput - empty array passed as input");return A=function(ae){return Array.isArray(O)?" at input index "+ae+":":""},P=w.map(cr),P.forEach(function(ae,ge){if(!Ga(ae)&&!De(ae)&&!Le(ae))throw typeof w[ge]=="string"?new Error("toNetInput -"+A(ge)+" string passed, but could not resolve HTMLElement for element id "+w[ge]):new Error("toNetInput -"+A(ge)+" expected media to be of type HTMLImageElement | HTMLVideoElement | HTMLCanvasElement | tf.Tensor3D, or to be an element id");if(Le(ae)){var he=ae.shape[0];if(he!==1)throw new Error("toNetInput -"+A(ge)+" tf.Tensor4D with batchSize "+he+" passed, but not supported in input array")}}),[4,Promise.all(P.map(function(ae){return Ga(ae)&&Cn(ae)}))];case 1:return V.sent(),[2,new Yn(P,Array.isArray(O))]}})})}function $n(O,w){return Object(W.b)(this,void 0,void 0,function(){var A,P,V,ae,ge,he,Te;return Object(W.d)(this,function(Ie){switch(Ie.label){case 0:return A=hr.getEnv().Canvas,P=O,O instanceof A?[3,5]:[4,Or(O)];case 1:if(V=Ie.sent(),V.batchSize>1)throw new Error("extractFaces - batchSize > 1 not supported");return ae=V.getInput(0),ae instanceof A?(ge=ae,[3,4]):[3,2];case 2:return[4,za(ae)];case 3:ge=Ie.sent(),Ie.label=4;case 4:P=ge,Ie.label=5;case 5:return he=nn(P),Te=w.map(function(Ne){return Ne instanceof m?Ne.forSize(P.width,P.height).box.floor():Ne}).map(function(Ne){return Ne.clipAtImageBorders(P.width,P.height)}),[2,Te.map(function(Ne){var We=Ne.x,Ge=Ne.y,Qe=Ne.width,it=Ne.height,yt=Hr({width:Qe,height:it});return nn(yt).putImageData(he.getImageData(We,Ge,Qe,it),0,0),yt})]}})})}function Po(O,w){return Object(W.b)(this,void 0,void 0,function(){return Object(W.d)(this,function(A){if(!De(O)&&!Le(O))throw new Error("extractFaceTensors - expected image tensor to be 3D or 4D");if(Le(O)&&O.shape[0]>1)throw new Error("extractFaceTensors - batchSize > 1 not supported");return[2,$.L(function(){var P=O.shape.slice(Le(O)?1:0),V=P[0],ae=P[1],ge=P[2],he=w.map(function(Ie){return Ie instanceof m?Ie.forSize(ae,V).box:Ie}).map(function(Ie){return Ie.clipAtImageBorders(ae,V)}),Te=he.map(function(Ie){var Ne=Ie.x,We=Ie.y,Ge=Ie.width,Qe=Ie.height;return $.C(O.as3D(V,ae,ge),[We,Ne,0],[Qe,Ge,ge])});return Te})]})})}function St(O,w){return Object(W.b)(this,void 0,void 0,function(){var A,P;return Object(W.d)(this,function(V){switch(V.label){case 0:return A=hr.getEnv().fetch,[4,A(O,w)];case 1:if(P=V.sent(),!(P.status<400))throw new Error("failed to fetch: ("+P.status+") "+P.statusText+", from url: "+P.url);return[2,P]}})})}function Ju(O){return Object(W.b)(this,void 0,void 0,function(){var w,A;return Object(W.d)(this,function(P){switch(P.label){case 0:return[4,St(O)];case 1:return w=P.sent(),[4,w.blob()];case 2:if(A=P.sent(),!A.type.startsWith("image/"))throw new Error("fetchImage - expected blob type to be of type image/*, instead have: "+A.type+", for url: "+w.url);return[2,Mo(A)]}})})}function bs(O){return Object(W.b)(this,void 0,void 0,function(){return Object(W.d)(this,function(w){switch(w.label){case 0:return[4,St(O)];case 1:return[2,w.sent().json()]}})})}function xs(O){return Object(W.b)(this,void 0,void 0,function(){var w;return Object(W.d)(this,function(A){switch(A.label){case 0:return w=Float32Array.bind,[4,St(O)];case 1:return[4,A.sent().arrayBuffer()];case 2:return[2,new(w.apply(Float32Array,[void 0,A.sent()]))]}})})}function Va(O,w){var A=w+"-weights_manifest.json";if(!O)return{modelBaseUri:"",manifestUri:A};if(O==="/")return{modelBaseUri:"/",manifestUri:"/"+A};var P=O.startsWith("http://")?"http://":O.startsWith("https://")?"https://":"";O=O.replace(P,"");var V=O.split("/").filter(function(he){return he}),ae=O.endsWith(".json")?V[V.length-1]:A,ge=P+(O.endsWith(".json")?V.slice(0,V.length-1):V).join("/");return ge=O.startsWith("/")?"/"+ge:ge,{modelBaseUri:ge,manifestUri:ge==="/"?"/"+ae:ge+"/"+ae}}function Fo(O,w){return Object(W.b)(this,void 0,void 0,function(){var A,P,V,ae;return Object(W.d)(this,function(ge){switch(ge.label){case 0:return A=Va(O,w),P=A.manifestUri,V=A.modelBaseUri,[4,bs(P)];case 1:return ae=ge.sent(),[2,$.p.loadWeights(ae,V)]}})})}function ws(O,w,A){A===void 0&&(A=!1);var P=A?Wr(w):w,V=P.width,ae=P.height;return O.width=V,O.height=ae,{width:V,height:ae}}var gn=function(){function O(w){this._name=w,this._params=void 0,this._paramMappings=[]}return Object.defineProperty(O.prototype,"params",{get:function(){return this._params},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"paramMappings",{get:function(){return this._paramMappings},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"isLoaded",{get:function(){return!!this.params},enumerable:!0,configurable:!0}),O.prototype.getParamFromPath=function(w){var A=this.traversePropertyPath(w),P=A.obj,V=A.objProp;return P[V]},O.prototype.reassignParamFromPath=function(w,A){var P=this.traversePropertyPath(w),V=P.obj,ae=P.objProp;V[ae].dispose(),V[ae]=A},O.prototype.getParamList=function(){var w=this;return this._paramMappings.map(function(A){var P=A.paramPath;return{path:P,tensor:w.getParamFromPath(P)}})},O.prototype.getTrainableParams=function(){return this.getParamList().filter(function(w){return w.tensor instanceof $.b})},O.prototype.getFrozenParams=function(){return this.getParamList().filter(function(w){return!(w.tensor instanceof $.b)})},O.prototype.variable=function(){var w=this;this.getFrozenParams().forEach(function(A){var P=A.path,V=A.tensor;w.reassignParamFromPath(P,V.variable())})},O.prototype.freeze=function(){var w=this;this.getTrainableParams().forEach(function(A){var P=A.path,V=A.tensor,ae=$.G(V.dataSync());V.dispose(),w.reassignParamFromPath(P,ae)})},O.prototype.dispose=function(w){w===void 0&&(w=!0),this.getParamList().forEach(function(A){if(w&&A.tensor.isDisposed)throw new Error("param tensor has already been disposed for path "+A.path);A.tensor.dispose()}),this._params=void 0},O.prototype.serializeParams=function(){return new Float32Array(this.getParamList().map(function(w){var A=w.tensor;return Array.from(A.dataSync())}).reduce(function(w,A){return w.concat(A)}))},O.prototype.load=function(w){return Object(W.b)(this,void 0,void 0,function(){return Object(W.d)(this,function(A){switch(A.label){case 0:return w instanceof Float32Array?(this.extractWeights(w),[2]):[4,this.loadFromUri(w)];case 1:return A.sent(),[2]}})})},O.prototype.loadFromUri=function(w){return Object(W.b)(this,void 0,void 0,function(){var A;return Object(W.d)(this,function(P){switch(P.label){case 0:if(w&&typeof w!="string")throw new Error(this._name+".loadFromUri - expected model uri");return[4,Fo(w,this.getDefaultModelName())];case 1:return A=P.sent(),this.loadFromWeightMap(A),[2]}})})},O.prototype.loadFromDisk=function(w){return Object(W.b)(this,void 0,void 0,function(){var A,P,V,ae,ge,he,Te,Ie,Ne,We;return Object(W.d)(this,function(Ge){switch(Ge.label){case 0:if(w&&typeof w!="string")throw new Error(this._name+".loadFromDisk - expected model file path");return A=hr.getEnv().readFile,P=Va(w,this.getDefaultModelName()),V=P.manifestUri,ae=P.modelBaseUri,ge=function(Qe){return Promise.all(Qe.map(function(it){return A(it).then(function(yt){return yt.buffer})}))},he=$.p.weightsLoaderFactory(ge),Ne=(Ie=JSON).parse,[4,A(V)];case 1:return Te=Ne.apply(Ie,[Ge.sent().toString()]),[4,he(Te,ae)];case 2:return We=Ge.sent(),this.loadFromWeightMap(We),[2]}})})},O.prototype.loadFromWeightMap=function(w){var A=this.extractParamsFromWeigthMap(w),P=A.paramMappings,V=A.params;this._paramMappings=P,this._params=V},O.prototype.extractWeights=function(w){var A=this.extractParams(w),P=A.paramMappings,V=A.params;this._paramMappings=P,this._params=V},O.prototype.traversePropertyPath=function(w){if(!this.params)throw new Error("traversePropertyPath - model has no loaded params");var A=w.split("/").reduce(function(ae,ge){if(!ae.nextObj.hasOwnProperty(ge))throw new Error("traversePropertyPath - object does not have property "+ge+", for path "+w);return{obj:ae.nextObj,objProp:ge,nextObj:ae.nextObj[ge]}},{nextObj:this.params}),P=A.obj,V=A.objProp;if(!P||!V||!(P[V]instanceof $.a))throw new Error("traversePropertyPath - parameter is not a tensor, for path "+w);return{obj:P,objProp:V}},O}();function zr(O,w,A){return $.L(function(){var P=$.z(O,w.depthwise_filter,w.pointwise_filter,A,"same");return P=$.c(P,w.bias),P})}function ho(O,w,A){return A===void 0&&(A=!1),$.L(function(){var P=$.w(A?$.c($.i(O,w.conv0.filters,[2,2],"same"),w.conv0.bias):zr(O,w.conv0,[2,2])),V=zr(P,w.conv1,[1,1]),ae=$.w($.c(P,V)),ge=zr(ae,w.conv2,[1,1]);return $.w($.c(P,$.c(V,ge)))})}function ra(O,w,A,P){return A===void 0&&(A=!1),P===void 0&&(P=!0),$.L(function(){var V=$.w(A?$.c($.i(O,w.conv0.filters,P?[2,2]:[1,1],"same"),w.conv0.bias):zr(O,w.conv0,P?[2,2]:[1,1])),ae=zr(V,w.conv1,[1,1]),ge=$.w($.c(V,ae)),he=zr(ge,w.conv2,[1,1]),Te=$.w($.c(V,$.c(ae,he))),Ie=zr(Te,w.conv3,[1,1]);return $.w($.c(V,$.c(ae,$.c(he,Ie))))})}function an(O,w,A,P){return A===void 0&&(A="same"),P===void 0&&(P=!1),$.L(function(){var V=$.c($.i(O,w.filters,[1,1],A),w.bias);return P?$.w(V):V})}function yn(O,w){Object.keys(O).forEach(function(A){w.some(function(P){return P.originalPath===A})||O[A].dispose()})}function Jn(O,w){return function(A,P,V,ae){var ge=$.K(O(A*P*V*V),[V,V,A,P]),he=$.H(O(P));return w.push({paramPath:ae+"/filters"},{paramPath:ae+"/bias"}),{filters:ge,bias:he}}}function na(O,w){return function(A,P,V){var ae=$.I(O(A*P),[A,P]),ge=$.H(O(P));return w.push({paramPath:V+"/weights"},{paramPath:V+"/bias"}),{weights:ae,bias:ge}}}var Xa=function(){function O(w,A,P){this.depthwise_filter=w,this.pointwise_filter=A,this.bias=P}return O}();function oa(O,w){return function(A,P,V){var ae=$.K(O(3*3*A),[3,3,A,1]),ge=$.K(O(A*P),[1,1,A,P]),he=$.H(O(P));return w.push({paramPath:V+"/depthwise_filter"},{paramPath:V+"/pointwise_filter"},{paramPath:V+"/bias"}),new Xa(ae,ge,he)}}function aa(O){return function(w){var A=O(w+"/depthwise_filter",4),P=O(w+"/pointwise_filter",4),V=O(w+"/bias",1);return new Xa(A,P,V)}}function Sn(O,w){return function(A,P,V){var ae=O[A];if(!de(ae,P))throw new Error("expected weightMap["+A+"] to be a Tensor"+P+"D, instead have "+ae);return w.push({originalPath:A,paramPath:V||A}),ae}}function ln(O){var w=O;function A(V){var ae=w.slice(0,V);return w=w.slice(V),ae}function P(){return w}return{extractWeights:A,getRemainingWeights:P}}function Ka(O,w){var A=Jn(O,w),P=oa(O,w);function V(ge,he,Te,Ie){Ie===void 0&&(Ie=!1);var Ne=Ie?A(ge,he,3,Te+"/conv0"):P(ge,he,Te+"/conv0"),We=P(he,he,Te+"/conv1"),Ge=P(he,he,Te+"/conv2");return{conv0:Ne,conv1:We,conv2:Ge}}function ae(ge,he,Te,Ie){Ie===void 0&&(Ie=!1);var Ne=V(ge,he,Te,Ie),We=Ne.conv0,Ge=Ne.conv1,Qe=Ne.conv2,it=P(he,he,Te+"/conv3");return{conv0:We,conv1:Ge,conv2:Qe,conv3:it}}return{extractDenseBlock3Params:V,extractDenseBlock4Params:ae}}function Ai(O){var w=[],A=ln(O),P=A.extractWeights,V=A.getRemainingWeights,ae=Ka(P,w).extractDenseBlock4Params,ge=ae(3,32,"dense0",!0),he=ae(32,64,"dense1"),Te=ae(64,128,"dense2"),Ie=ae(128,256,"dense3");if(V().length!==0)throw new Error("weights remaing after extract: "+V().length);return{paramMappings:w,params:{dense0:ge,dense1:he,dense2:Te,dense3:Ie}}}function Ya(O){return function(w){var A=O(w+"/filters",4),P=O(w+"/bias",1);return{filters:A,bias:P}}}function $a(O,w){var A=Sn(O,w),P=Ya(A),V=aa(A);function ae(he,Te){Te===void 0&&(Te=!1);var Ie=Te?P(he+"/conv0"):V(he+"/conv0"),Ne=V(he+"/conv1"),We=V(he+"/conv2");return{conv0:Ie,conv1:Ne,conv2:We}}function ge(he,Te){Te===void 0&&(Te=!1);var Ie=Te?P(he+"/conv0"):V(he+"/conv0"),Ne=V(he+"/conv1"),We=V(he+"/conv2"),Ge=V(he+"/conv3");return{conv0:Ie,conv1:Ne,conv2:We,conv3:Ge}}return{extractDenseBlock3Params:ae,extractDenseBlock4Params:ge}}function ia(O){var w=[],A=$a(O,w).extractDenseBlock4Params,P={dense0:A("dense0",!0),dense1:A("dense1"),dense2:A("dense2"),dense3:A("dense3")};return yn(O,w),{params:P,paramMappings:w}}var sa=function(O){Object(W.c)(w,O);function w(){return O.call(this,"FaceFeatureExtractor")||this}return w.prototype.forwardInput=function(A){var P=this.params;if(!P)throw new Error("FaceFeatureExtractor - load model before inference");return $.L(function(){var V=A.toBatchTensor(112,!0),ae=[122.782,117.001,104.298],ge=ve(V,ae).div($.y(255)),he=ra(ge,P.dense0,!0);return he=ra(he,P.dense1),he=ra(he,P.dense2),he=ra(he,P.dense3),he=$.d(he,[7,7],[2,2],"valid"),he})},w.prototype.forward=function(A){return Object(W.b)(this,void 0,void 0,function(){var P;return Object(W.d)(this,function(V){switch(V.label){case 0:return P=this.forwardInput,[4,Or(A)];case 1:return[2,P.apply(this,[V.sent()])]}})})},w.prototype.getDefaultModelName=function(){return"face_feature_extractor_model"},w.prototype.extractParamsFromWeigthMap=function(A){return ia(A)},w.prototype.extractParams=function(A){return Ai(A)},w}(gn);function $r(O,w){return $.L(function(){return $.c($.q(O,w.weights),w.bias)})}function Oi(O,w,A){var P=[],V=ln(O),ae=V.extractWeights,ge=V.getRemainingWeights,he=na(ae,P),Te=he(w,A,"fc");if(ge().length!==0)throw new Error("weights remaing after extract: "+ge().length);return{paramMappings:P,params:{fc:Te}}}function An(O){var w=[],A=Sn(O,w);function P(ae){var ge=A(ae+"/weights",2),he=A(ae+"/bias",1);return{weights:ge,bias:he}}var V={fc:P("fc")};return yn(O,w),{params:V,paramMappings:w}}function Ja(O){var w={},A={};return Object.keys(O).forEach(function(P){var V=P.startsWith("fc")?A:w;V[P]=O[P]}),{featureExtractorMap:w,classifierMap:A}}var po=function(O){Object(W.c)(w,O);function w(A,P){var V=O.call(this,A)||this;return V._faceFeatureExtractor=P,V}return Object.defineProperty(w.prototype,"faceFeatureExtractor",{get:function(){return this._faceFeatureExtractor},enumerable:!0,configurable:!0}),w.prototype.runNet=function(A){var P=this,V=this.params;if(!V)throw new Error(this._name+" - load model before inference");return $.L(function(){var ae=A instanceof Yn?P.faceFeatureExtractor.forwardInput(A):A;return $r(ae.as2D(ae.shape[0],-1),V.fc)})},w.prototype.dispose=function(A){A===void 0&&(A=!0),this.faceFeatureExtractor.dispose(A),O.prototype.dispose.call(this,A)},w.prototype.loadClassifierParams=function(A){var P=this.extractClassifierParams(A),V=P.params,ae=P.paramMappings;this._params=V,this._paramMappings=ae},w.prototype.extractClassifierParams=function(A){return Oi(A,this.getClassifierChannelsIn(),this.getClassifierChannelsOut())},w.prototype.extractParamsFromWeigthMap=function(A){var P=Ja(A),V=P.featureExtractorMap,ae=P.classifierMap;return this.faceFeatureExtractor.loadFromWeightMap(V),An(ae)},w.prototype.extractParams=function(A){var P=this.getClassifierChannelsIn(),V=this.getClassifierChannelsOut(),ae=V*P+V,ge=A.slice(0,A.length-ae),he=A.slice(A.length-ae);return this.faceFeatureExtractor.extractWeights(ge),this.extractClassifierParams(he)},w}(gn),mo=["neutral","happy","sad","angry","fearful","disgusted","surprised"],vo=function(){function O(w){var A=this;if(w.length!==7)throw new Error("FaceExpressions.constructor - expected probabilities.length to be 7, have: "+w.length);mo.forEach(function(P,V){A[P]=w[V]})}return O.prototype.asSortedArray=function(){var w=this;return mo.map(function(A){return{expression:A,probability:w[A]}}).sort(function(A,P){return P.probability-A.probability})},O}(),Ri=function(O){Object(W.c)(w,O);function w(A){return A===void 0&&(A=new sa),O.call(this,"FaceExpressionNet",A)||this}return w.prototype.forwardInput=function(A){var P=this;return $.L(function(){return $.D(P.runNet(A))})},w.prototype.forward=function(A){return Object(W.b)(this,void 0,void 0,function(){var P;return Object(W.d)(this,function(V){switch(V.label){case 0:return P=this.forwardInput,[4,Or(A)];case 1:return[2,P.apply(this,[V.sent()])]}})})},w.prototype.predictExpressions=function(A){return Object(W.b)(this,void 0,void 0,function(){var P,V,ae,ge,he=this;return Object(W.d)(this,function(Te){switch(Te.label){case 0:return[4,Or(A)];case 1:return P=Te.sent(),[4,this.forwardInput(P)];case 2:return V=Te.sent(),[4,Promise.all($.O(V).map(function(Ie){return Object(W.b)(he,void 0,void 0,function(){var Ne;return Object(W.d)(this,function(We){switch(We.label){case 0:return[4,Ie.data()];case 1:return Ne=We.sent(),Ie.dispose(),[2,Ne]}})})}))];case 3:return ae=Te.sent(),V.dispose(),ge=ae.map(function(Ie){return new vo(Ie)}),[2,P.isBatchInput?ge:ge[0]]}})})},w.prototype.getDefaultModelName=function(){return"face_expression_model"},w.prototype.getClassifierChannelsIn=function(){return 256},w.prototype.getClassifierChannelsOut=function(){return 7},w}(po);function ua(O){return O.expressions instanceof vo}function go(O,w){var A={expressions:w};return Object.assign({},O,A)}function Ii(O,w,A,P){A===void 0&&(A=.1);var V=Array.isArray(w)?w:[w];V.forEach(function(ae){var ge=ae instanceof vo?ae:ua(ae)?ae.expressions:void 0;if(!ge)throw new Error("drawFaceExpressions - expected faceExpressions to be FaceExpressions | WithFaceExpressions<{}> or array thereof");var he=ge.asSortedArray(),Te=he.filter(function(We){return We.probability>A}),Ie=Ar(ae)?ae.detection.box.bottomLeft:P||new ye(0,0),Ne=new Ti(Te.map(function(We){return We.expression+" ("+Ae(We.probability)+")"}),Ie);Ne.draw(O)})}function ca(O){return Ar(O)&&O.landmarks instanceof at&&O.unshiftedLandmarks instanceof at&&O.alignedRect instanceof m}function Lo(O,w){var A=O.detection.box,P=w.shiftBy(A.x,A.y),V=P.align(),ae=O.detection.imageDims,ge=new m(O.detection.score,V.rescale(ae.reverse()),ae),he={landmarks:P,unshiftedLandmarks:w,alignedRect:ge};return Object.assign({},O,he)}var Jr=function(){function O(w){w===void 0&&(w={});var A=w.drawLines,P=A===void 0?!0:A,V=w.drawPoints,ae=V===void 0?!0:V,ge=w.lineWidth,he=w.lineColor,Te=w.pointSize,Ie=w.pointColor;this.drawLines=P,this.drawPoints=ae,this.lineWidth=ge||1,this.pointSize=Te||2,this.lineColor=he||"rgba(0, 255, 255, 1)",this.pointColor=Ie||"rgba(255, 0, 255, 1)"}return O}(),la=function(){function O(w,A){A===void 0&&(A={}),this.faceLandmarks=w,this.options=new Jr(A)}return O.prototype.draw=function(w){var A=nn(w),P=this.options,V=P.drawLines,ae=P.drawPoints,ge=P.lineWidth,he=P.lineColor,Te=P.pointSize,Ie=P.pointColor;if(V&&this.faceLandmarks instanceof mr&&(A.strokeStyle=he,A.lineWidth=ge,ne(A,this.faceLandmarks.getJawOutline()),ne(A,this.faceLandmarks.getLeftEyeBrow()),ne(A,this.faceLandmarks.getRightEyeBrow()),ne(A,this.faceLandmarks.getNose()),ne(A,this.faceLandmarks.getLeftEye(),!0),ne(A,this.faceLandmarks.getRightEye(),!0),ne(A,this.faceLandmarks.getMouth(),!0)),ae){A.strokeStyle=Ie,A.fillStyle=Ie;var Ne=function(We){A.beginPath(),A.arc(We.x,We.y,Te,0,2*Math.PI),A.fill()};this.faceLandmarks.positions.forEach(Ne)}},O}();function Ni(O,w){var A=Array.isArray(w)?w:[w];A.forEach(function(P){var V=P instanceof at?P:ca(P)?P.landmarks:void 0;if(!V)throw new Error("drawFaceLandmarks - expected faceExpressions to be FaceLandmarks | WithFaceLandmarks<WithFaceDetection<{}>> or array thereof");new la(V).draw(O)})}function Di(O,w){var A=Jn(O,w),P=oa(O,w);function V(ge,he,Te){var Ie=P(ge,he,Te+"/separable_conv0"),Ne=P(he,he,Te+"/separable_conv1"),We=A(ge,he,1,Te+"/expansion_conv");return{separable_conv0:Ie,separable_conv1:Ne,expansion_conv:We}}function ae(ge,he){var Te=P(ge,ge,he+"/separable_conv0"),Ie=P(ge,ge,he+"/separable_conv1"),Ne=P(ge,ge,he+"/separable_conv2");return{separable_conv0:Te,separable_conv1:Ie,separable_conv2:Ne}}return{extractConvParams:A,extractSeparableConvParams:P,extractReductionBlockParams:V,extractMainBlockParams:ae}}function qa(O,w){var A=[],P=ln(O),V=P.extractWeights,ae=P.getRemainingWeights,ge=Di(V,A),he=ge.extractConvParams,Te=ge.extractSeparableConvParams,Ie=ge.extractReductionBlockParams,Ne=ge.extractMainBlockParams,We=he(3,32,3,"entry_flow/conv_in"),Ge=Ie(32,64,"entry_flow/reduction_block_0"),Qe=Ie(64,128,"entry_flow/reduction_block_1"),it={conv_in:We,reduction_block_0:Ge,reduction_block_1:Qe},yt={};Pe(w,0,1).forEach(function(At){yt["main_block_"+At]=Ne(128,"middle_flow/main_block_"+At)});var _t=Ie(128,256,"exit_flow/reduction_block"),Tt=Te(256,512,"exit_flow/separable_conv"),Dt={reduction_block:_t,separable_conv:Tt};if(ae().length!==0)throw new Error("weights remaing after extract: "+ae().length);return{paramMappings:A,params:{entry_flow:it,middle_flow:yt,exit_flow:Dt}}}function ki(O,w){var A=Sn(O,w),P=Ya(A),V=aa(A);function ae(he){var Te=V(he+"/separable_conv0"),Ie=V(he+"/separable_conv1"),Ne=P(he+"/expansion_conv");return{separable_conv0:Te,separable_conv1:Ie,expansion_conv:Ne}}function ge(he){var Te=V(he+"/separable_conv0"),Ie=V(he+"/separable_conv1"),Ne=V(he+"/separable_conv2");return{separable_conv0:Te,separable_conv1:Ie,separable_conv2:Ne}}return{extractConvParams:P,extractSeparableConvParams:V,extractReductionBlockParams:ae,extractMainBlockParams:ge}}function Es(O,w){var A=[],P=ki(O,A),V=P.extractConvParams,ae=P.extractSeparableConvParams,ge=P.extractReductionBlockParams,he=P.extractMainBlockParams,Te=V("entry_flow/conv_in"),Ie=ge("entry_flow/reduction_block_0"),Ne=ge("entry_flow/reduction_block_1"),We={conv_in:Te,reduction_block_0:Ie,reduction_block_1:Ne},Ge={};Pe(w,0,1).forEach(function(_t){Ge["main_block_"+_t]=he("middle_flow/main_block_"+_t)});var Qe=ge("exit_flow/reduction_block"),it=ae("exit_flow/separable_conv"),yt={reduction_block:Qe,separable_conv:it};return yn(O,A),{params:{entry_flow:We,middle_flow:Ge,exit_flow:yt},paramMappings:A}}function Ft(O,w,A){return $.c($.i(O,w.filters,A,"same"),w.bias)}function Mi(O,w,A){A===void 0&&(A=!0);var P=A?$.w(O):O;return P=zr(P,w.separable_conv0,[1,1]),P=zr($.w(P),w.separable_conv1,[1,1]),P=$.s(P,[3,3],[2,2],"same"),P=$.c(P,Ft(O,w.expansion_conv,[2,2])),P}function qu(O,w){var A=zr($.w(O),w.separable_conv0,[1,1]);return A=zr($.w(A),w.separable_conv1,[1,1]),A=zr($.w(A),w.separable_conv2,[1,1]),A=$.c(A,O),A}var Qu=function(O){Object(W.c)(w,O);function w(A){var P=O.call(this,"TinyXception")||this;return P._numMainBlocks=A,P}return w.prototype.forwardInput=function(A){var P=this,V=this.params;if(!V)throw new Error("TinyXception - load model before inference");return $.L(function(){var ae=A.toBatchTensor(112,!0),ge=[122.782,117.001,104.298],he=ve(ae,ge).div($.y(256)),Te=$.w(Ft(he,V.entry_flow.conv_in,[2,2]));return Te=Mi(Te,V.entry_flow.reduction_block_0,!1),Te=Mi(Te,V.entry_flow.reduction_block_1),Pe(P._numMainBlocks,0,1).forEach(function(Ie){Te=qu(Te,V.middle_flow["main_block_"+Ie])}),Te=Mi(Te,V.exit_flow.reduction_block),Te=$.w(zr(Te,V.exit_flow.separable_conv,[1,1])),Te})},w.prototype.forward=function(A){return Object(W.b)(this,void 0,void 0,function(){var P;return Object(W.d)(this,function(V){switch(V.label){case 0:return P=this.forwardInput,[4,Or(A)];case 1:return[2,P.apply(this,[V.sent()])]}})})},w.prototype.getDefaultModelName=function(){return"tiny_xception_model"},w.prototype.extractParamsFromWeigthMap=function(A){return Es(A,this._numMainBlocks)},w.prototype.extractParams=function(A){return qa(A,this._numMainBlocks)},w}(gn);function Pi(O){var w=[],A=ln(O),P=A.extractWeights,V=A.getRemainingWeights,ae=na(P,w),ge=ae(512,1,"fc/age"),he=ae(512,2,"fc/gender");if(V().length!==0)throw new Error("weights remaing after extract: "+V().length);return{paramMappings:w,params:{fc:{age:ge,gender:he}}}}function Zu(O){var w=[],A=Sn(O,w);function P(ae){var ge=A(ae+"/weights",2),he=A(ae+"/bias",1);return{weights:ge,bias:he}}var V={fc:{age:P("fc/age"),gender:P("fc/gender")}};return yn(O,w),{params:V,paramMappings:w}}var jo;(function(O){O.FEMALE="female",O.MALE="male"})(jo||(jo={}));var ec=function(O){Object(W.c)(w,O);function w(A){A===void 0&&(A=new Qu(2));var P=O.call(this,"AgeGenderNet")||this;return P._faceFeatureExtractor=A,P}return Object.defineProperty(w.prototype,"faceFeatureExtractor",{get:function(){return this._faceFeatureExtractor},enumerable:!0,configurable:!0}),w.prototype.runNet=function(A){var P=this,V=this.params;if(!V)throw new Error(this._name+" - load model before inference");return $.L(function(){var ae=A instanceof Yn?P.faceFeatureExtractor.forwardInput(A):A,ge=$.d(ae,[7,7],[2,2],"valid").as2D(ae.shape[0],-1),he=$r(ge,V.fc.age).as1D(),Te=$r(ge,V.fc.gender);return{age:he,gender:Te}})},w.prototype.forwardInput=function(A){var P=this;return $.L(function(){var V=P.runNet(A),ae=V.age,ge=V.gender;return{age:ae,gender:$.D(ge)}})},w.prototype.forward=function(A){return Object(W.b)(this,void 0,void 0,function(){var P;return Object(W.d)(this,function(V){switch(V.label){case 0:return P=this.forwardInput,[4,Or(A)];case 1:return[2,P.apply(this,[V.sent()])]}})})},w.prototype.predictAgeAndGender=function(A){return Object(W.b)(this,void 0,void 0,function(){var P,V,ae,ge,he,Te,Ie=this;return Object(W.d)(this,function(Ne){switch(Ne.label){case 0:return[4,Or(A)];case 1:return P=Ne.sent(),[4,this.forwardInput(P)];case 2:return V=Ne.sent(),ae=$.O(V.age),ge=$.O(V.gender),he=ae.map(function(We,Ge){return{ageTensor:We,genderTensor:ge[Ge]}}),[4,Promise.all(he.map(function(We){var Ge=We.ageTensor,Qe=We.genderTensor;return Object(W.b)(Ie,void 0,void 0,function(){var it,yt,_t,Tt,Dt;return Object(W.d)(this,function(At){switch(At.label){case 0:return[4,Ge.data()];case 1:return it=At.sent()[0],[4,Qe.data()];case 2:return yt=At.sent()[0],_t=yt>.5,Tt=_t?jo.MALE:jo.FEMALE,Dt=_t?yt:1-yt,Ge.dispose(),Qe.dispose(),[2,{age:it,gender:Tt,genderProbability:Dt}]}})})}))];case 3:return Te=Ne.sent(),V.age.dispose(),V.gender.dispose(),[2,P.isBatchInput?Te:Te[0]]}})})},w.prototype.getDefaultModelName=function(){return"age_gender_model"},w.prototype.dispose=function(A){A===void 0&&(A=!0),this.faceFeatureExtractor.dispose(A),O.prototype.dispose.call(this,A)},w.prototype.loadClassifierParams=function(A){var P=this.extractClassifierParams(A),V=P.params,ae=P.paramMappings;this._params=V,this._paramMappings=ae},w.prototype.extractClassifierParams=function(A){return Pi(A)},w.prototype.extractParamsFromWeigthMap=function(A){var P=Ja(A),V=P.featureExtractorMap,ae=P.classifierMap;return this.faceFeatureExtractor.loadFromWeightMap(V),Zu(ae)},w.prototype.extractParams=function(A){var P=512*1+1+(512*2+2),V=A.slice(0,A.length-P),ae=A.slice(A.length-P);return this.faceFeatureExtractor.extractWeights(V),this.extractClassifierParams(ae)},w}(gn),_s=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.postProcess=function(A,P,V){var ae=V.map(function(he){var Te=he.width,Ie=he.height,Ne=P/Math.max(Ie,Te);return{width:Te*Ne,height:Ie*Ne}}),ge=ae.length;return $.L(function(){var he=function(Ge,Qe){return $.E([$.n([68],Ge),$.n([68],Qe)],1).as2D(1,136).as1D()},Te=function(Ge,Qe){var it=ae[Ge],yt=it.width,_t=it.height;return Qe(yt,_t)?Math.abs(yt-_t)/2:0},Ie=function(Ge){return Te(Ge,function(Qe,it){return Qe<it})},Ne=function(Ge){return Te(Ge,function(Qe,it){return it<Qe})},We=A.mul($.n([ge,136],P)).sub($.E(Array.from(Array(ge),function(Ge,Qe){return he(Ie(Qe),Ne(Qe))}))).div($.E(Array.from(Array(ge),function(Ge,Qe){return he(ae[Qe].width,ae[Qe].height)})));return We})},w.prototype.forwardInput=function(A){var P=this;return $.L(function(){var V=P.runNet(A);return P.postProcess(V,A.inputSize,A.inputDimensions.map(function(ae){var ge=ae[0],he=ae[1];return{height:ge,width:he}}))})},w.prototype.forward=function(A){return Object(W.b)(this,void 0,void 0,function(){var P;return Object(W.d)(this,function(V){switch(V.label){case 0:return P=this.forwardInput,[4,Or(A)];case 1:return[2,P.apply(this,[V.sent()])]}})})},w.prototype.detectLandmarks=function(A){return Object(W.b)(this,void 0,void 0,function(){var P,V,ae,ge=this;return Object(W.d)(this,function(he){switch(he.label){case 0:return[4,Or(A)];case 1:return P=he.sent(),V=$.L(function(){return $.O(ge.forwardInput(P))}),[4,Promise.all(V.map(function(Te,Ie){return Object(W.b)(ge,void 0,void 0,function(){var Ne,We,Ge,Qe,it;return Object(W.d)(this,function(yt){switch(yt.label){case 0:return Ge=(We=Array).from,[4,Te.data()];case 1:return Ne=Ge.apply(We,[yt.sent()]),Qe=Ne.filter(function(_t,Tt){return et(Tt)}),it=Ne.filter(function(_t,Tt){return!et(Tt)}),[2,new mr(Array(68).fill(0).map(function(_t,Tt){return new ye(Qe[Tt],it[Tt])}),{height:P.getInputHeight(Ie),width:P.getInputWidth(Ie)})]}})})}))];case 2:return ae=he.sent(),V.forEach(function(Te){return Te.dispose()}),[2,P.isBatchInput?ae:ae[0]]}})})},w.prototype.getClassifierChannelsOut=function(){return 136},w}(po),Rr=function(O){Object(W.c)(w,O);function w(A){return A===void 0&&(A=new sa),O.call(this,"FaceLandmark68Net",A)||this}return w.prototype.getDefaultModelName=function(){return"face_landmark_68_model"},w.prototype.getClassifierChannelsIn=function(){return 256},w}(_s);function qr(O){var w=[],A=$a(O,w).extractDenseBlock3Params,P={dense0:A("dense0",!0),dense1:A("dense1"),dense2:A("dense2")};return yn(O,w),{params:P,paramMappings:w}}function Cs(O){var w=[],A=ln(O),P=A.extractWeights,V=A.getRemainingWeights,ae=Ka(P,w).extractDenseBlock3Params,ge=ae(3,32,"dense0",!0),he=ae(32,64,"dense1"),Te=ae(64,128,"dense2");if(V().length!==0)throw new Error("weights remaing after extract: "+V().length);return{paramMappings:w,params:{dense0:ge,dense1:he,dense2:Te}}}var tc=function(O){Object(W.c)(w,O);function w(){return O.call(this,"TinyFaceFeatureExtractor")||this}return w.prototype.forwardInput=function(A){var P=this.params;if(!P)throw new Error("TinyFaceFeatureExtractor - load model before inference");return $.L(function(){var V=A.toBatchTensor(112,!0),ae=[122.782,117.001,104.298],ge=ve(V,ae).div($.y(255)),he=ho(ge,P.dense0,!0);return he=ho(he,P.dense1),he=ho(he,P.dense2),he=$.d(he,[14,14],[2,2],"valid"),he})},w.prototype.forward=function(A){return Object(W.b)(this,void 0,void 0,function(){var P;return Object(W.d)(this,function(V){switch(V.label){case 0:return P=this.forwardInput,[4,Or(A)];case 1:return[2,P.apply(this,[V.sent()])]}})})},w.prototype.getDefaultModelName=function(){return"face_feature_extractor_tiny_model"},w.prototype.extractParamsFromWeigthMap=function(A){return qr(A)},w.prototype.extractParams=function(A){return Cs(A)},w}(gn),rc=function(O){Object(W.c)(w,O);function w(A){return A===void 0&&(A=new tc),O.call(this,"FaceLandmark68TinyNet",A)||this}return w.prototype.getDefaultModelName=function(){return"face_landmark_68_tiny_model"},w.prototype.getClassifierChannelsIn=function(){return 128},w}(_s),ad=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w}(Rr);function nc(O,w){return $.c($.t(O,w.weights),w.biases)}function Fi(O,w,A,P,V){V===void 0&&(V="same");var ae=w.conv,ge=ae.filters,he=ae.bias,Te=$.i(O,ge,A,V);return Te=$.c(Te,he),Te=nc(Te,w.scale),P?$.w(Te):Te}function oc(O,w){return Fi(O,w,[1,1],!0)}function Ts(O,w){return Fi(O,w,[1,1],!1)}function Ss(O,w){return Fi(O,w,[2,2],!0,"valid")}function ac(O,w){function A(he,Te,Ie){var Ne=O(he),We=Ne.length/(Te*Ie*Ie);if(Ye(We))throw new Error("depth has to be an integer: "+We+", weights.length: "+Ne.length+", numFilters: "+Te+", filterSize: "+Ie);return $.L(function(){return $.N($.K(Ne,[Te,We,Ie,Ie]),[2,3,1,0])})}function P(he,Te,Ie,Ne){var We=A(he,Te,Ie),Ge=$.H(O(Te));return w.push({paramPath:Ne+"/filters"},{paramPath:Ne+"/bias"}),{filters:We,bias:Ge}}function V(he,Te){var Ie=$.H(O(he)),Ne=$.H(O(he));return w.push({paramPath:Te+"/weights"},{paramPath:Te+"/biases"}),{weights:Ie,biases:Ne}}function ae(he,Te,Ie,Ne){var We=P(he,Te,Ie,Ne+"/conv"),Ge=V(Te,Ne+"/scale");return{conv:We,scale:Ge}}function ge(he,Te,Ie,Ne,We){We===void 0&&(We=!1);var Ge=ae((We?.5:1)*he,Te,Ie,Ne+"/conv1"),Qe=ae(he,Te,Ie,Ne+"/conv2");return{conv1:Ge,conv2:Qe}}return{extractConvLayerParams:ae,extractResidualLayerParams:ge}}function ic(O){var w=ln(O),A=w.extractWeights,P=w.getRemainingWeights,V=[],ae=ac(A,V),ge=ae.extractConvLayerParams,he=ae.extractResidualLayerParams,Te=ge(4704,32,7,"conv32_down"),Ie=he(9216,32,3,"conv32_1"),Ne=he(9216,32,3,"conv32_2"),We=he(9216,32,3,"conv32_3"),Ge=he(36864,64,3,"conv64_down",!0),Qe=he(36864,64,3,"conv64_1"),it=he(36864,64,3,"conv64_2"),yt=he(36864,64,3,"conv64_3"),_t=he(147456,128,3,"conv128_down",!0),Tt=he(147456,128,3,"conv128_1"),Dt=he(147456,128,3,"conv128_2"),At=he(589824,256,3,"conv256_down",!0),gt=he(589824,256,3,"conv256_1"),Ct=he(589824,256,3,"conv256_2"),Wt=he(589824,256,3,"conv256_down_out"),sr=$.L(function(){return $.N($.I(A(256*128),[128,256]),[1,0])});if(V.push({paramPath:"fc"}),P().length!==0)throw new Error("weights remaing after extract: "+P().length);var vr={conv32_down:Te,conv32_1:Ie,conv32_2:Ne,conv32_3:We,conv64_down:Ge,conv64_1:Qe,conv64_2:it,conv64_3:yt,conv128_down:_t,conv128_1:Tt,conv128_2:Dt,conv256_down:At,conv256_1:gt,conv256_2:Ct,conv256_down_out:Wt,fc:sr};return{params:vr,paramMappings:V}}function da(O,w){var A=Sn(O,w);function P(ge){var he=A(ge+"/scale/weights",1),Te=A(ge+"/scale/biases",1);return{weights:he,biases:Te}}function V(ge){var he=A(ge+"/conv/filters",4),Te=A(ge+"/conv/bias",1),Ie=P(ge);return{conv:{filters:he,bias:Te},scale:Ie}}function ae(ge){return{conv1:V(ge+"/conv1"),conv2:V(ge+"/conv2")}}return{extractConvLayerParams:V,extractResidualLayerParams:ae}}function bn(O){var w=[],A=da(O,w),P=A.extractConvLayerParams,V=A.extractResidualLayerParams,ae=P("conv32_down"),ge=V("conv32_1"),he=V("conv32_2"),Te=V("conv32_3"),Ie=V("conv64_down"),Ne=V("conv64_1"),We=V("conv64_2"),Ge=V("conv64_3"),Qe=V("conv128_down"),it=V("conv128_1"),yt=V("conv128_2"),_t=V("conv256_down"),Tt=V("conv256_1"),Dt=V("conv256_2"),At=V("conv256_down_out"),gt=O.fc;if(w.push({originalPath:"fc",paramPath:"fc"}),!Ce(gt))throw new Error("expected weightMap[fc] to be a Tensor2D, instead have "+gt);var Ct={conv32_down:ae,conv32_1:ge,conv32_2:he,conv32_3:Te,conv64_down:Ie,conv64_1:Ne,conv64_2:We,conv64_3:Ge,conv128_down:Qe,conv128_1:it,conv128_2:yt,conv256_down:_t,conv256_1:Tt,conv256_2:Dt,conv256_down_out:At,fc:gt};return yn(O,w),{params:Ct,paramMappings:w}}function dn(O,w){var A=oc(O,w.conv1);return A=Ts(A,w.conv2),A=$.c(A,O),A=$.w(A),A}function Oe(O,w){var A=Ss(O,w.conv1);A=Ts(A,w.conv2);var P=$.d(O,2,2,"valid"),V=$.P(P.shape),ae=P.shape[3]!==A.shape[3],ge=P.shape[1]!==A.shape[1]||P.shape[2]!==A.shape[2];if(ge){var he=Object(W.e)(A.shape);he[1]=1;var Te=$.P(he);A=$.h([A,Te],1);var Ie=Object(W.e)(A.shape);Ie[2]=1;var Ne=$.P(Ie);A=$.h([A,Ne],2)}return P=ae?$.h([P,V],3):P,A=$.c(P,A),A=$.w(A),A}var yo=function(O){Object(W.c)(w,O);function w(){return O.call(this,"FaceRecognitionNet")||this}return w.prototype.forwardInput=function(A){var P=this.params;if(!P)throw new Error("FaceRecognitionNet - load model before inference");return $.L(function(){var V=A.toBatchTensor(150,!0).toFloat(),ae=[122.782,117.001,104.298],ge=ve(V,ae).div($.y(256)),he=Ss(ge,P.conv32_down);he=$.s(he,3,2,"valid"),he=dn(he,P.conv32_1),he=dn(he,P.conv32_2),he=dn(he,P.conv32_3),he=Oe(he,P.conv64_down),he=dn(he,P.conv64_1),he=dn(he,P.conv64_2),he=dn(he,P.conv64_3),he=Oe(he,P.conv128_down),he=dn(he,P.conv128_1),he=dn(he,P.conv128_2),he=Oe(he,P.conv256_down),he=dn(he,P.conv256_1),he=dn(he,P.conv256_2),he=Oe(he,P.conv256_down_out);var Te=he.mean([1,2]),Ie=$.q(Te,P.fc);return Ie})},w.prototype.forward=function(A){return Object(W.b)(this,void 0,void 0,function(){var P;return Object(W.d)(this,function(V){switch(V.label){case 0:return P=this.forwardInput,[4,Or(A)];case 1:return[2,P.apply(this,[V.sent()])]}})})},w.prototype.computeFaceDescriptor=function(A){return Object(W.b)(this,void 0,void 0,function(){var P,V,ae,ge=this;return Object(W.d)(this,function(he){switch(he.label){case 0:return[4,Or(A)];case 1:return P=he.sent(),V=$.L(function(){return $.O(ge.forwardInput(P))}),[4,Promise.all(V.map(function(Te){return Te.data()}))];case 2:return ae=he.sent(),V.forEach(function(Te){return Te.dispose()}),[2,P.isBatchInput?ae:ae[0]]}})})},w.prototype.getDefaultModelName=function(){return"face_recognition_model"},w.prototype.extractParamsFromWeigthMap=function(A){return bn(A)},w.prototype.extractParams=function(A){return ic(A)},w}(gn);function Li(O){var w=new yo;return w.extractWeights(O),w}function Qa(O,w){var A={descriptor:w};return Object.assign({},O,A)}function Gr(O){return typeof O.age=="number"}function Vr(O,w){var A={age:w};return Object.assign({},O,A)}function on(O){return(O.gender===jo.MALE||O.gender===jo.FEMALE)&&ot(O.genderProbability)}function sn(O,w,A){var P={gender:w,genderProbability:A};return Object.assign({},O,P)}var bo=function(){function O(w){var A=w===void 0?{}:w,P=A.minFaceSize,V=A.scaleFactor,ae=A.maxNumScales,ge=A.scoreThresholds,he=A.scaleSteps;if(this._name="MtcnnOptions",this._minFaceSize=P||20,this._scaleFactor=V||.709,this._maxNumScales=ae||10,this._scoreThresholds=ge||[.6,.7,.7],this._scaleSteps=he,typeof this._minFaceSize!="number"||this._minFaceSize<0)throw new Error(this._name+" - expected minFaceSize to be a number > 0");if(typeof this._scaleFactor!="number"||this._scaleFactor<=0||this._scaleFactor>=1)throw new Error(this._name+" - expected scaleFactor to be a number between 0 and 1");if(typeof this._maxNumScales!="number"||this._maxNumScales<0)throw new Error(this._name+" - expected maxNumScales to be a number > 0");if(!Array.isArray(this._scoreThresholds)||this._scoreThresholds.length!==3||this._scoreThresholds.some(function(Te){return typeof Te!="number"}))throw new Error(this._name+" - expected scoreThresholds to be an array of numbers of length 3");if(this._scaleSteps&&(!Array.isArray(this._scaleSteps)||this._scaleSteps.some(function(Te){return typeof Te!="number"})))throw new Error(this._name+" - expected scaleSteps to be an array of numbers")}return Object.defineProperty(O.prototype,"minFaceSize",{get:function(){return this._minFaceSize},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"scaleFactor",{get:function(){return this._scaleFactor},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"maxNumScales",{get:function(){return this._maxNumScales},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"scoreThresholds",{get:function(){return this._scoreThresholds},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"scaleSteps",{get:function(){return this._scaleSteps},enumerable:!0,configurable:!0}),O}();function fn(O,w){function A(Te,Ie){var Ne=$.K(O(3*3*Te),[3,3,Te,1]),We=$.H(O(Te)),Ge=$.H(O(Te)),Qe=$.H(O(Te)),it=$.H(O(Te));return w.push({paramPath:Ie+"/filters"},{paramPath:Ie+"/batch_norm_scale"},{paramPath:Ie+"/batch_norm_offset"},{paramPath:Ie+"/batch_norm_mean"},{paramPath:Ie+"/batch_norm_variance"}),{filters:Ne,batch_norm_scale:We,batch_norm_offset:Ge,batch_norm_mean:Qe,batch_norm_variance:it}}function P(Te,Ie,Ne,We,Ge){var Qe=$.K(O(Te*Ie*Ne*Ne),[Ne,Ne,Te,Ie]),it=$.H(O(Ie));return w.push({paramPath:We+"/filters"},{paramPath:We+"/"+(Ge?"batch_norm_offset":"bias")}),{filters:Qe,bias:it}}function V(Te,Ie,Ne,We){var Ge=P(Te,Ie,Ne,We,!0),Qe=Ge.filters,it=Ge.bias;return{filters:Qe,batch_norm_offset:it}}function ae(Te,Ie,Ne){var We=A(Te,Ne+"/depthwise_conv"),Ge=V(Te,Ie,1,Ne+"/pointwise_conv");return{depthwise_conv:We,pointwise_conv:Ge}}function ge(){var Te=V(3,32,3,"mobilenetv1/conv_0"),Ie=ae(32,64,"mobilenetv1/conv_1"),Ne=ae(64,128,"mobilenetv1/conv_2"),We=ae(128,128,"mobilenetv1/conv_3"),Ge=ae(128,256,"mobilenetv1/conv_4"),Qe=ae(256,256,"mobilenetv1/conv_5"),it=ae(256,512,"mobilenetv1/conv_6"),yt=ae(512,512,"mobilenetv1/conv_7"),_t=ae(512,512,"mobilenetv1/conv_8"),Tt=ae(512,512,"mobilenetv1/conv_9"),Dt=ae(512,512,"mobilenetv1/conv_10"),At=ae(512,512,"mobilenetv1/conv_11"),gt=ae(512,1024,"mobilenetv1/conv_12"),Ct=ae(1024,1024,"mobilenetv1/conv_13");return{conv_0:Te,conv_1:Ie,conv_2:Ne,conv_3:We,conv_4:Ge,conv_5:Qe,conv_6:it,conv_7:yt,conv_8:_t,conv_9:Tt,conv_10:Dt,conv_11:At,conv_12:gt,conv_13:Ct}}function he(){var Te=V(1024,256,1,"prediction_layer/conv_0"),Ie=V(256,512,3,"prediction_layer/conv_1"),Ne=V(512,128,1,"prediction_layer/conv_2"),We=V(128,256,3,"prediction_layer/conv_3"),Ge=V(256,128,1,"prediction_layer/conv_4"),Qe=V(128,256,3,"prediction_layer/conv_5"),it=V(256,64,1,"prediction_layer/conv_6"),yt=V(64,128,3,"prediction_layer/conv_7"),_t=P(512,12,1,"prediction_layer/box_predictor_0/box_encoding_predictor"),Tt=P(512,9,1,"prediction_layer/box_predictor_0/class_predictor"),Dt=P(1024,24,1,"prediction_layer/box_predictor_1/box_encoding_predictor"),At=P(1024,18,1,"prediction_layer/box_predictor_1/class_predictor"),gt=P(512,24,1,"prediction_layer/box_predictor_2/box_encoding_predictor"),Ct=P(512,18,1,"prediction_layer/box_predictor_2/class_predictor"),Wt=P(256,24,1,"prediction_layer/box_predictor_3/box_encoding_predictor"),sr=P(256,18,1,"prediction_layer/box_predictor_3/class_predictor"),vr=P(256,24,1,"prediction_layer/box_predictor_4/box_encoding_predictor"),or=P(256,18,1,"prediction_layer/box_predictor_4/class_predictor"),Gt=P(128,24,1,"prediction_layer/box_predictor_5/box_encoding_predictor"),Ut=P(128,18,1,"prediction_layer/box_predictor_5/class_predictor"),kr={box_encoding_predictor:_t,class_predictor:Tt},lr={box_encoding_predictor:Dt,class_predictor:At},Xr={box_encoding_predictor:gt,class_predictor:Ct},Yr={box_encoding_predictor:Wt,class_predictor:sr},Rt={box_encoding_predictor:vr,class_predictor:or},tn={box_encoding_predictor:Gt,class_predictor:Ut};return{conv_0:Te,conv_1:Ie,conv_2:Ne,conv_3:We,conv_4:Ge,conv_5:Qe,conv_6:it,conv_7:yt,box_predictor_0:kr,box_predictor_1:lr,box_predictor_2:Xr,box_predictor_3:Yr,box_predictor_4:Rt,box_predictor_5:tn}}return{extractMobilenetV1Params:ge,extractPredictionLayerParams:he}}function ji(O){var w=[],A=ln(O),P=A.extractWeights,V=A.getRemainingWeights,ae=fn(P,w),ge=ae.extractMobilenetV1Params,he=ae.extractPredictionLayerParams,Te=ge(),Ie=he(),Ne=$.J(P(5118*4),[1,5118,4]),We={extra_dim:Ne};if(w.push({paramPath:"output_layer/extra_dim"}),V().length!==0)throw new Error("weights remaing after extract: "+V().length);return{params:{mobilenetv1:Te,prediction_layer:Ie,output_layer:We},paramMappings:w}}function qn(O,w){var A=Sn(O,w);function P(Ie,Ne,We){var Ge=A(Ie+"/Conv2d_"+Ne+"_pointwise/weights",4,We+"/filters"),Qe=A(Ie+"/Conv2d_"+Ne+"_pointwise/convolution_bn_offset",1,We+"/batch_norm_offset");return{filters:Ge,batch_norm_offset:Qe}}function V(Ie){var Ne="mobilenetv1/conv_"+Ie,We="MobilenetV1/Conv2d_"+Ie+"_depthwise",Ge=Ne+"/depthwise_conv",Qe=Ne+"/pointwise_conv",it=A(We+"/depthwise_weights",4,Ge+"/filters"),yt=A(We+"/BatchNorm/gamma",1,Ge+"/batch_norm_scale"),_t=A(We+"/BatchNorm/beta",1,Ge+"/batch_norm_offset"),Tt=A(We+"/BatchNorm/moving_mean",1,Ge+"/batch_norm_mean"),Dt=A(We+"/BatchNorm/moving_variance",1,Ge+"/batch_norm_variance");return{depthwise_conv:{filters:it,batch_norm_scale:yt,batch_norm_offset:_t,batch_norm_mean:Tt,batch_norm_variance:Dt},pointwise_conv:P("MobilenetV1",Ie,Qe)}}function ae(){return{conv_0:P("MobilenetV1",0,"mobilenetv1/conv_0"),conv_1:V(1),conv_2:V(2),conv_3:V(3),conv_4:V(4),conv_5:V(5),conv_6:V(6),conv_7:V(7),conv_8:V(8),conv_9:V(9),conv_10:V(10),conv_11:V(11),conv_12:V(12),conv_13:V(13)}}function ge(Ie,Ne){var We=A(Ie+"/weights",4,Ne+"/filters"),Ge=A(Ie+"/biases",1,Ne+"/bias");return{filters:We,bias:Ge}}function he(Ie){var Ne=ge("Prediction/BoxPredictor_"+Ie+"/BoxEncodingPredictor","prediction_layer/box_predictor_"+Ie+"/box_encoding_predictor"),We=ge("Prediction/BoxPredictor_"+Ie+"/ClassPredictor","prediction_layer/box_predictor_"+Ie+"/class_predictor");return{box_encoding_predictor:Ne,class_predictor:We}}function Te(){return{conv_0:P("Prediction",0,"prediction_layer/conv_0"),conv_1:P("Prediction",1,"prediction_layer/conv_1"),conv_2:P("Prediction",2,"prediction_layer/conv_2"),conv_3:P("Prediction",3,"prediction_layer/conv_3"),conv_4:P("Prediction",4,"prediction_layer/conv_4"),conv_5:P("Prediction",5,"prediction_layer/conv_5"),conv_6:P("Prediction",6,"prediction_layer/conv_6"),conv_7:P("Prediction",7,"prediction_layer/conv_7"),box_predictor_0:he(0),box_predictor_1:he(1),box_predictor_2:he(2),box_predictor_3:he(3),box_predictor_4:he(4),box_predictor_5:he(5)}}return{extractMobilenetV1Params:ae,extractPredictionLayerParams:Te}}function Xe(O){var w=[],A=qn(O,w),P=A.extractMobilenetV1Params,V=A.extractPredictionLayerParams,ae=O["Output/extra_dim"];if(w.push({originalPath:"Output/extra_dim",paramPath:"output_layer/extra_dim"}),!De(ae))throw new Error("expected weightMap['Output/extra_dim'] to be a Tensor3D, instead have "+ae);var ge={mobilenetv1:P(),prediction_layer:V(),output_layer:{extra_dim:ae}};return yn(O,w),{params:ge,paramMappings:w}}function xr(O,w,A){return $.L(function(){var P=$.i(O,w.filters,A,"same");return P=$.c(P,w.batch_norm_offset),$.g(P,0,6)})}var un=.0010000000474974513;function xn(O,w,A){return $.L(function(){var P=$.j(O,w.filters,A,"same");return P=$.e(P,w.batch_norm_mean,w.batch_norm_variance,w.batch_norm_offset,w.batch_norm_scale,un),$.g(P,0,6)})}function Ur(O){return[2,4,6,12].some(function(w){return w===O})?[2,2]:[1,1]}function Dn(O,w){return $.L(function(){var A=null,P=xr(O,w.conv_0,[2,2]),V=[w.conv_1,w.conv_2,w.conv_3,w.conv_4,w.conv_5,w.conv_6,w.conv_7,w.conv_8,w.conv_9,w.conv_10,w.conv_11,w.conv_12,w.conv_13];if(V.forEach(function(ae,ge){var he=ge+1,Te=Ur(he);P=xn(P,ae.depthwise_conv,Te),P=xr(P,ae.pointwise_conv,[1,1]),he===11&&(A=P)}),A===null)throw new Error("mobileNetV1 - output of conv layer 11 is null");return{out:P,conv11:A}})}function Nt(O,w,A,P,V){var ae=O.shape[0],ge=Math.min(A,ae),he=w.map(function(Ne,We){return{score:Ne,boxIndex:We}}).filter(function(Ne){return Ne.score>V}).sort(function(Ne,We){return We.score-Ne.score}),Te=function(Ne){return Ne<=P?1:0},Ie=[];return he.forEach(function(Ne){if(Ie.length>=ge)return;for(var We=Ne.score,Ge=Ie.length-1;Ge>=0;--Ge){var Qe=Qn(O,Ne.boxIndex,Ie[Ge]);if(Qe===0)continue;if(Ne.score*=Te(Qe),Ne.score<=V)break}We===Ne.score&&Ie.push(Ne.boxIndex)}),Ie}function Qn(O,w,A){var P=O.arraySync(),V=Math.min(P[w][0],P[w][2]),ae=Math.min(P[w][1],P[w][3]),ge=Math.max(P[w][0],P[w][2]),he=Math.max(P[w][1],P[w][3]),Te=Math.min(P[A][0],P[A][2]),Ie=Math.min(P[A][1],P[A][3]),Ne=Math.max(P[A][0],P[A][2]),We=Math.max(P[A][1],P[A][3]),Ge=(ge-V)*(he-ae),Qe=(Ne-Te)*(We-Ie);if(Ge<=0||Qe<=0)return 0;var it=Math.max(V,Te),yt=Math.max(ae,Ie),_t=Math.min(ge,Ne),Tt=Math.min(he,We),Dt=Math.max(_t-it,0)*Math.max(Tt-yt,0);return Dt/(Ge+Qe-Dt)}function Zn(O){var w=$.O($.N(O,[1,0])),A=[$.F(w[2],w[0]),$.F(w[3],w[1])],P=[$.c(w[0],$.k(A[0],$.y(2))),$.c(w[1],$.k(A[1],$.y(2)))];return{sizes:A,centers:P}}function Za(O,w){var A=Zn(O),P=A.sizes,V=A.centers,ae=$.O($.N(w,[1,0])),ge=$.k($.t($.l($.k(ae[2],$.y(5))),P[0]),$.y(2)),he=$.c($.t($.k(ae[0],$.y(10)),P[0]),V[0]),Te=$.k($.t($.l($.k(ae[3],$.y(5))),P[1]),$.y(2)),Ie=$.c($.t($.k(ae[1],$.y(10)),P[1]),V[1]);return $.N($.E([$.F(he,ge),$.F(Ie,Te),$.c(he,ge),$.c(Ie,Te)]),[1,0])}function kn(O,w,A){return $.L(function(){var P=O.shape[0],V=Za($.x($.M(A.extra_dim,[P,1,1]),[-1,4]),$.x(O,[-1,4]));V=$.x(V,[P,V.shape[0]/P,4]);var ae=$.A($.B(w,[0,0,1],[-1,-1,-1])),ge=$.B(ae,[0,0,0],[-1,-1,1]);ge=$.x(ge,[P,ge.shape[1]]);var he=$.O(V),Te=$.O(ge);return{boxes:he,scores:Te}})}function xo(O,w){return $.L(function(){var A=O.shape[0],P=$.x(an(O,w.box_encoding_predictor),[A,-1,1,4]),V=$.x(an(O,w.class_predictor),[A,-1,3]);return{boxPredictionEncoding:P,classPrediction:V}})}function As(O,w,A){return $.L(function(){var P=xr(O,A.conv_0,[1,1]),V=xr(P,A.conv_1,[2,2]),ae=xr(V,A.conv_2,[1,1]),ge=xr(ae,A.conv_3,[2,2]),he=xr(ge,A.conv_4,[1,1]),Te=xr(he,A.conv_5,[2,2]),Ie=xr(Te,A.conv_6,[1,1]),Ne=xr(Ie,A.conv_7,[2,2]),We=xo(w,A.box_predictor_0),Ge=xo(O,A.box_predictor_1),Qe=xo(V,A.box_predictor_2),it=xo(ge,A.box_predictor_3),yt=xo(Te,A.box_predictor_4),_t=xo(Ne,A.box_predictor_5),Tt=$.h([We.boxPredictionEncoding,Ge.boxPredictionEncoding,Qe.boxPredictionEncoding,it.boxPredictionEncoding,yt.boxPredictionEncoding,_t.boxPredictionEncoding],1),Dt=$.h([We.classPrediction,Ge.classPrediction,Qe.classPrediction,it.classPrediction,yt.classPrediction,_t.classPrediction],1);return{boxPredictions:Tt,classPredictions:Dt}})}var wo=function(){function O(w){var A=w===void 0?{}:w,P=A.minConfidence,V=A.maxResults;if(this._name="SsdMobilenetv1Options",this._minConfidence=P||.5,this._maxResults=V||100,typeof this._minConfidence!="number"||this._minConfidence<=0||this._minConfidence>=1)throw new Error(this._name+" - expected minConfidence to be a number between 0 and 1");if(typeof this._maxResults!="number")throw new Error(this._name+" - expected maxResults to be a number")}return Object.defineProperty(O.prototype,"minConfidence",{get:function(){return this._minConfidence},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"maxResults",{get:function(){return this._maxResults},enumerable:!0,configurable:!0}),O}(),Mn=function(O){Object(W.c)(w,O);function w(){return O.call(this,"SsdMobilenetv1")||this}return w.prototype.forwardInput=function(A){var P=this.params;if(!P)throw new Error("SsdMobilenetv1 - load model before inference");return $.L(function(){var V=A.toBatchTensor(512,!1).toFloat(),ae=$.F($.t(V,$.y(.007843137718737125)),$.y(1)),ge=Dn(ae,P.mobilenetv1),he=As(ge.out,ge.conv11,P.prediction_layer),Te=he.boxPredictions,Ie=he.classPredictions;return kn(Te,Ie,P.output_layer)})},w.prototype.forward=function(A){return Object(W.b)(this,void 0,void 0,function(){var P;return Object(W.d)(this,function(V){switch(V.label){case 0:return P=this.forwardInput,[4,Or(A)];case 1:return[2,P.apply(this,[V.sent()])]}})})},w.prototype.locateFaces=function(A,P){return P===void 0&&(P={}),Object(W.b)(this,void 0,void 0,function(){var V,ae,ge,he,Te,Ie,Ne,We,Ge,Qe,it,yt,_t,Tt,Dt,At,gt,Ct,Wt,sr,vr;return Object(W.d)(this,function(or){switch(or.label){case 0:return V=new wo(P),ae=V.maxResults,ge=V.minConfidence,[4,Or(A)];case 1:for(he=or.sent(),Te=this.forwardInput(he),Ie=Te.boxes,Ne=Te.scores,We=Ie[0],Ge=Ne[0],Qe=1;Qe<Ie.length;Qe++)Ie[Qe].dispose(),Ne[Qe].dispose();return _t=(yt=Array).from,[4,Ge.data()];case 2:return it=_t.apply(yt,[or.sent()]),Tt=.5,Dt=Nt(We,it,ae,Tt,ge),At=he.getReshapedInputDimensions(0),gt=he.inputSize,Ct=gt/At.width,Wt=gt/At.height,sr=We.arraySync(),vr=Dt.map(function(Gt){var Ut=[Math.max(0,sr[Gt][0]),Math.min(1,sr[Gt][2])].map(function(tn){return tn*Wt}),kr=Ut[0],lr=Ut[1],Xr=[Math.max(0,sr[Gt][1]),Math.min(1,sr[Gt][3])].map(function(tn){return tn*Ct}),Yr=Xr[0],Rt=Xr[1];return new m(it[Gt],new bt(Yr,kr,Rt-Yr,lr-kr),{height:he.getInputHeight(0),width:he.getInputWidth(0)})}),We.dispose(),Ge.dispose(),[2,vr]}})})},w.prototype.getDefaultModelName=function(){return"ssd_mobilenetv1_model"},w.prototype.extractParamsFromWeigthMap=function(A){return Xe(A)},w.prototype.extractParams=function(A){return ji(A)},w}(gn);function Tr(O){var w=new Mn;return w.extractWeights(O),w}function ei(O){return Tr(O)}var sc=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w}(Mn),fa=.4,Bi=[new ye(.738768,.874946),new ye(2.42204,2.65704),new ye(4.30971,7.04493),new ye(10.246,4.59428),new ye(12.6868,11.8741)],Jt=[new ye(1.603231,2.094468),new ye(6.041143,7.080126),new ye(2.882459,3.518061),new ye(4.266906,5.178857),new ye(9.041765,10.66308)],hn=[117.001,114.697,97.404],Os="tiny_yolov2_model",Rs="tiny_yolov2_separable_conv_model",ha=function(O){return typeof O=="number"};function Is(O){if(!O)throw new Error("invalid config: "+O);if(typeof O.withSeparableConvs!="boolean")throw new Error("config.withSeparableConvs has to be a boolean, have: "+O.withSeparableConvs);if(!ha(O.iouThreshold)||O.iouThreshold<0||O.iouThreshold>1)throw new Error("config.iouThreshold has to be a number between [0, 1], have: "+O.iouThreshold);if(!Array.isArray(O.classes)||!O.classes.length||!O.classes.every(function(w){return typeof w=="string"}))throw new Error("config.classes has to be an array class names: string[], have: "+JSON.stringify(O.classes));if(!Array.isArray(O.anchors)||!O.anchors.length||!O.anchors.map(function(w){return w||{}}).every(function(w){return ha(w.x)&&ha(w.y)}))throw new Error("config.anchors has to be an array of { x: number, y: number }, have: "+JSON.stringify(O.anchors));if(O.meanRgb&&(!Array.isArray(O.meanRgb)||O.meanRgb.length!==3||!O.meanRgb.every(ha)))throw new Error("config.meanRgb has to be an array of shape [number, number, number], have: "+JSON.stringify(O.meanRgb))}function Bo(O){return $.L(function(){var w=$.t(O,$.y(.10000000149011612));return $.c($.w($.F(O,w)),w)})}function Qr(O,w){return $.L(function(){var A=$.v(O,[[0,0],[1,1],[1,1],[0,0]]);return A=$.i(A,w.conv.filters,[1,1],"valid"),A=$.F(A,w.bn.sub),A=$.t(A,w.bn.truediv),A=$.c(A,w.conv.bias),Bo(A)})}function Pn(O,w){return $.L(function(){var A=$.v(O,[[0,0],[1,1],[1,1],[0,0]]);return A=$.z(A,w.depthwise_filter,w.pointwise_filter,[1,1],"valid"),A=$.c(A,w.bias),Bo(A)})}function Ns(O,w){var A=Jn(O,w);function P(ge,he){var Te=$.H(O(ge)),Ie=$.H(O(ge));return w.push({paramPath:he+"/sub"},{paramPath:he+"/truediv"}),{sub:Te,truediv:Ie}}function V(ge,he,Te){var Ie=A(ge,he,3,Te+"/conv"),Ne=P(he,Te+"/bn");return{conv:Ie,bn:Ne}}var ae=oa(O,w);return{extractConvParams:A,extractConvWithBatchNormParams:V,extractSeparableConvParams:ae}}function Ds(O,w,A,P){var V=ln(O),ae=V.extractWeights,ge=V.getRemainingWeights,he=[],Te=Ns(ae,he),Ie=Te.extractConvParams,Ne=Te.extractConvWithBatchNormParams,We=Te.extractSeparableConvParams,Ge;if(w.withSeparableConvs){var Qe=P[0],it=P[1],yt=P[2],_t=P[3],Tt=P[4],Dt=P[5],At=P[6],gt=P[7],Ct=P[8],Wt=w.isFirstLayerConv2d?Ie(Qe,it,3,"conv0"):We(Qe,it,"conv0"),sr=We(it,yt,"conv1"),vr=We(yt,_t,"conv2"),or=We(_t,Tt,"conv3"),Gt=We(Tt,Dt,"conv4"),Ut=We(Dt,At,"conv5"),kr=gt?We(At,gt,"conv6"):void 0,lr=Ct?We(gt,Ct,"conv7"):void 0,Xr=Ie(Ct||gt||At,5*A,1,"conv8");Ge={conv0:Wt,conv1:sr,conv2:vr,conv3:or,conv4:Gt,conv5:Ut,conv6:kr,conv7:lr,conv8:Xr}}else{var Qe=P[0],it=P[1],yt=P[2],_t=P[3],Tt=P[4],Dt=P[5],At=P[6],gt=P[7],Ct=P[8],Wt=Ne(Qe,it,"conv0"),sr=Ne(it,yt,"conv1"),vr=Ne(yt,_t,"conv2"),or=Ne(_t,Tt,"conv3"),Gt=Ne(Tt,Dt,"conv4"),Ut=Ne(Dt,At,"conv5"),kr=Ne(At,gt,"conv6"),lr=Ne(gt,Ct,"conv7"),Xr=Ie(Ct,5*A,1,"conv8");Ge={conv0:Wt,conv1:sr,conv2:vr,conv3:or,conv4:Gt,conv5:Ut,conv6:kr,conv7:lr,conv8:Xr}}if(ge().length!==0)throw new Error("weights remaing after extract: "+ge().length);return{params:Ge,paramMappings:he}}function ks(O,w){var A=Sn(O,w);function P(he){var Te=A(he+"/sub",1),Ie=A(he+"/truediv",1);return{sub:Te,truediv:Ie}}function V(he){var Te=A(he+"/filters",4),Ie=A(he+"/bias",1);return{filters:Te,bias:Ie}}function ae(he){var Te=V(he+"/conv"),Ie=P(he+"/bn");return{conv:Te,bn:Ie}}var ge=aa(A);return{extractConvParams:V,extractConvWithBatchNormParams:ae,extractSeparableConvParams:ge}}function Ms(O,w){var A=[],P=ks(O,A),V=P.extractConvParams,ae=P.extractConvWithBatchNormParams,ge=P.extractSeparableConvParams,he;if(w.withSeparableConvs){var Te=w.filterSizes&&w.filterSizes.length||9;he={conv0:w.isFirstLayerConv2d?V("conv0"):ge("conv0"),conv1:ge("conv1"),conv2:ge("conv2"),conv3:ge("conv3"),conv4:ge("conv4"),conv5:ge("conv5"),conv6:Te>7?ge("conv6"):void 0,conv7:Te>8?ge("conv7"):void 0,conv8:V("conv8")}}else he={conv0:ae("conv0"),conv1:ae("conv1"),conv2:ae("conv2"),conv3:ae("conv3"),conv4:ae("conv4"),conv5:ae("conv5"),conv6:ae("conv6"),conv7:ae("conv7"),conv8:V("conv8")};return yn(O,A),{params:he,paramMappings:A}}var Ui;(function(O){O[O.XS=224]="XS",O[O.SM=320]="SM",O[O.MD=416]="MD",O[O.LG=608]="LG"})(Ui||(Ui={}));var wn=function(){function O(w){var A=w===void 0?{}:w,P=A.inputSize,V=A.scoreThreshold;if(this._name="TinyYolov2Options",this._inputSize=P||416,this._scoreThreshold=V||.5,typeof this._inputSize!="number"||this._inputSize%32!==0)throw new Error(this._name+" - expected inputSize to be a number divisible by 32");if(typeof this._scoreThreshold!="number"||this._scoreThreshold<=0||this._scoreThreshold>=1)throw new Error(this._name+" - expected scoreThreshold to be a number between 0 and 1")}return Object.defineProperty(O.prototype,"inputSize",{get:function(){return this._inputSize},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"scoreThreshold",{get:function(){return this._scoreThreshold},enumerable:!0,configurable:!0}),O}(),Uo=function(O){Object(W.c)(w,O);function w(A){var P=O.call(this,"TinyYolov2")||this;return Is(A),P._config=A,P}return Object.defineProperty(w.prototype,"config",{get:function(){return this._config},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"withClassScores",{get:function(){return this.config.withClassScores||this.config.classes.length>1},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"boxEncodingSize",{get:function(){return 5+(this.withClassScores?this.config.classes.length:0)},enumerable:!0,configurable:!0}),w.prototype.runTinyYolov2=function(A,P){var V=Qr(A,P.conv0);return V=$.s(V,[2,2],[2,2],"same"),V=Qr(V,P.conv1),V=$.s(V,[2,2],[2,2],"same"),V=Qr(V,P.conv2),V=$.s(V,[2,2],[2,2],"same"),V=Qr(V,P.conv3),V=$.s(V,[2,2],[2,2],"same"),V=Qr(V,P.conv4),V=$.s(V,[2,2],[2,2],"same"),V=Qr(V,P.conv5),V=$.s(V,[2,2],[1,1],"same"),V=Qr(V,P.conv6),V=Qr(V,P.conv7),an(V,P.conv8,"valid",!1)},w.prototype.runMobilenet=function(A,P){var V=this.config.isFirstLayerConv2d?Bo(an(A,P.conv0,"valid",!1)):Pn(A,P.conv0);return V=$.s(V,[2,2],[2,2],"same"),V=Pn(V,P.conv1),V=$.s(V,[2,2],[2,2],"same"),V=Pn(V,P.conv2),V=$.s(V,[2,2],[2,2],"same"),V=Pn(V,P.conv3),V=$.s(V,[2,2],[2,2],"same"),V=Pn(V,P.conv4),V=$.s(V,[2,2],[2,2],"same"),V=Pn(V,P.conv5),V=$.s(V,[2,2],[1,1],"same"),V=P.conv6?Pn(V,P.conv6):V,V=P.conv7?Pn(V,P.conv7):V,an(V,P.conv8,"valid",!1)},w.prototype.forwardInput=function(A,P){var V=this,ae=this.params;if(!ae)throw new Error("TinyYolov2 - load model before inference");return $.L(function(){var ge=A.toBatchTensor(P,!1).toFloat();return ge=V.config.meanRgb?ve(ge,V.config.meanRgb):ge,ge=ge.div($.y(256)),V.config.withSeparableConvs?V.runMobilenet(ge,ae):V.runTinyYolov2(ge,ae)})},w.prototype.forward=function(A,P){return Object(W.b)(this,void 0,void 0,function(){var V;return Object(W.d)(this,function(ae){switch(ae.label){case 0:return V=this.forwardInput,[4,Or(A)];case 1:return[4,V.apply(this,[ae.sent(),P])];case 2:return[2,ae.sent()]}})})},w.prototype.detect=function(A,P){return P===void 0&&(P={}),Object(W.b)(this,void 0,void 0,function(){var V,ae,ge,he,Te,Ie,Ne,We,Ge,Qe,it,yt,_t,Tt,Dt=this;return Object(W.d)(this,function(At){switch(At.label){case 0:return V=new wn(P),ae=V.inputSize,ge=V.scoreThreshold,[4,Or(A)];case 1:return he=At.sent(),[4,this.forwardInput(he,ae)];case 2:return Te=At.sent(),Ie=$.L(function(){return $.O(Te)[0].expandDims()}),Ne={width:he.getInputWidth(0),height:he.getInputHeight(0)},[4,this.extractBoxes(Ie,he.getReshapedInputDimensions(0),ge)];case 3:return We=At.sent(),Te.dispose(),Ie.dispose(),Ge=We.map(function(gt){return gt.box}),Qe=We.map(function(gt){return gt.score}),it=We.map(function(gt){return gt.classScore}),yt=We.map(function(gt){return Dt.config.classes[gt.label]}),_t=fe(Ge.map(function(gt){return gt.rescale(ae)}),Qe,this.config.iouThreshold,!0),Tt=_t.map(function(gt){return new q(Qe[gt],it[gt],yt[gt],Ge[gt],Ne)}),[2,Tt]}})})},w.prototype.getDefaultModelName=function(){return""},w.prototype.extractParamsFromWeigthMap=function(A){return Ms(A,this.config)},w.prototype.extractParams=function(A){var P=this.config.filterSizes||w.DEFAULT_FILTER_SIZES,V=P?P.length:void 0;if(V!==7&&V!==8&&V!==9)throw new Error("TinyYolov2 - expected 7 | 8 | 9 convolutional filters, but found "+V+" filterSizes in config");return Ds(A,this.config,this.boxEncodingSize,P)},w.prototype.extractBoxes=function(A,P,V){return Object(W.b)(this,void 0,void 0,function(){var ae,ge,he,Te,Ie,Ne,We,Ge,Qe,it,yt,_t,Tt,Dt,At,gt,Ct,Wt,sr,vr,or,Gt,Ut,kr,lr,Xr,Yr,Rt,tn,ur=this;return Object(W.d)(this,function(_r){switch(_r.label){case 0:return ae=P.width,ge=P.height,he=Math.max(ae,ge),Te=he/ae,Ie=he/ge,Ne=A.shape[1],We=this.config.anchors.length,Ge=$.L(function(){var Un=A.reshape([Ne,Ne,We,ur.boxEncodingSize]),Rn=Un.slice([0,0,0,0],[Ne,Ne,We,4]),Ko=Un.slice([0,0,0,4],[Ne,Ne,We,1]),Wn=ur.withClassScores?$.D(Un.slice([0,0,0,5],[Ne,Ne,We,ur.config.classes.length]),3):$.y(0);return[Rn,Ko,Wn]}),Qe=Ge[0],it=Ge[1],yt=Ge[2],_t=[],[4,it.array()];case 1:return Tt=_r.sent(),[4,Qe.array()];case 2:Dt=_r.sent(),At=0,_r.label=3;case 3:if(!(At<Ne))return[3,12];gt=0,_r.label=4;case 4:if(!(gt<Ne))return[3,11];Ct=0,_r.label=5;case 5:return Ct<We?(Wt=nt(Tt[At][gt][Ct][0]),!V||Wt>V?(sr=(gt+nt(Dt[At][gt][Ct][0]))/Ne*Te,vr=(At+nt(Dt[At][gt][Ct][1]))/Ne*Ie,or=Math.exp(Dt[At][gt][Ct][2])*this.config.anchors[Ct].x/Ne*Te,Gt=Math.exp(Dt[At][gt][Ct][3])*this.config.anchors[Ct].y/Ne*Ie,Ut=sr-or/2,kr=vr-Gt/2,lr={row:At,col:gt,anchor:Ct},this.withClassScores?[4,this.extractPredictedClass(yt,lr)]:[3,7]):[3,9]):[3,10];case 6:return tn=_r.sent(),[3,8];case 7:tn={classScore:1,label:0},_r.label=8;case 8:Xr=tn,Yr=Xr.classScore,Rt=Xr.label,_t.push(Object(W.a)({box:new Ke(Ut,kr,Ut+or,kr+Gt),score:Wt,classScore:Wt*Yr,label:Rt},lr)),_r.label=9;case 9:return Ct++,[3,5];case 10:return gt++,[3,4];case 11:return At++,[3,3];case 12:return Qe.dispose(),it.dispose(),yt.dispose(),[2,_t]}})})},w.prototype.extractPredictedClass=function(A,P){return Object(W.b)(this,void 0,void 0,function(){var V,ae,ge,he;return Object(W.d)(this,function(Te){switch(Te.label){case 0:return V=P.row,ae=P.col,ge=P.anchor,[4,A.array()];case 1:return he=Te.sent(),[2,Array(this.config.classes.length).fill(0).map(function(Ie,Ne){return he[V][ae][ge][Ne]}).map(function(Ie,Ne){return{classScore:Ie,label:Ne}}).reduce(function(Ie,Ne){return Ie.classScore>Ne.classScore?Ie:Ne})]}})})},w.DEFAULT_FILTER_SIZES=[3,16,32,64,128,256,512,1024,1024],w}(gn),pa=function(O){Object(W.c)(w,O);function w(A){A===void 0&&(A=!0);var P=this,V=Object.assign({},{withSeparableConvs:A,iouThreshold:fa,classes:["face"]},A?{anchors:Jt,meanRgb:hn}:{anchors:Bi,withClassScores:!0});return P=O.call(this,V)||this,P}return Object.defineProperty(w.prototype,"withSeparableConvs",{get:function(){return this.config.withSeparableConvs},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"anchors",{get:function(){return this.config.anchors},enumerable:!0,configurable:!0}),w.prototype.locateFaces=function(A,P){return Object(W.b)(this,void 0,void 0,function(){var V;return Object(W.d)(this,function(ae){switch(ae.label){case 0:return[4,this.detect(A,P)];case 1:return V=ae.sent(),[2,V.map(function(ge){return new m(ge.score,ge.relativeBox,{width:ge.imageWidth,height:ge.imageHeight})})]}})})},w.prototype.getDefaultModelName=function(){return this.withSeparableConvs?Rs:Os},w.prototype.extractParamsFromWeigthMap=function(A){return O.prototype.extractParamsFromWeigthMap.call(this,A)},w}(Uo);function uc(O,w){w===void 0&&(w=!0);var A=new pa(w);return A.extractWeights(O),A}var Wi=function(O){Object(W.c)(w,O);function w(){var A=O!==null&&O.apply(this,arguments)||this;return A._name="TinyFaceDetectorOptions",A}return w}(wn),Lt=function(){function O(){}return O.prototype.then=function(w){return Object(W.b)(this,void 0,void 0,function(){var A;return Object(W.d)(this,function(P){switch(P.label){case 0:return A=w,[4,this.run()];case 1:return[2,A.apply(void 0,[P.sent()])]}})})},O.prototype.run=function(){return Object(W.b)(this,void 0,void 0,function(){return Object(W.d)(this,function(w){throw new Error("ComposableTask - run is not implemented")})})},O}();function ma(O,w,A,P,V){return V===void 0&&(V=function(ae){var ge=ae.alignedRect;return ge}),Object(W.b)(this,void 0,void 0,function(){var ae,ge,he,Te,Ie;return Object(W.d)(this,function(Ne){switch(Ne.label){case 0:return ae=O.map(function(We){return ca(We)?V(We):We.detection}),he=P,he?[3,5]:w instanceof $.a?[4,Po(w,ae)]:[3,2];case 1:return Te=Ne.sent(),[3,4];case 2:return[4,$n(w,ae)];case 3:Te=Ne.sent(),Ne.label=4;case 4:he=Te,Ne.label=5;case 5:return ge=he,[4,A(ge)];case 6:return Ie=Ne.sent(),ge.forEach(function(We){return We instanceof $.a&&We.dispose()}),[2,Ie]}})})}function va(O,w,A,P,V){return Object(W.b)(this,void 0,void 0,function(){var ae=this;return Object(W.d)(this,function(ge){return[2,ma([O],w,function(he){return Object(W.b)(ae,void 0,void 0,function(){return Object(W.d)(this,function(Te){return[2,A(he[0])]})})},P,V)]})})}function Ps(O){return $.L(function(){return $.E($.O(O,3).reverse(),3)})}var ga=2,ya=12;function Fs(O,w){var A=Jn(O,w),P=na(O,w);function V(Ie,Ne){var We=$.H(O(Ie));return w.push({paramPath:Ne}),We}function ae(Ie,Ne,We){We===void 0&&(We=!1);var Ge=A(Ie[0],Ie[1],3,Ne+"/conv1"),Qe=V(Ie[1],Ne+"/prelu1_alpha"),it=A(Ie[1],Ie[2],3,Ne+"/conv2"),yt=V(Ie[2],Ne+"/prelu2_alpha"),_t=A(Ie[2],Ie[3],We?2:3,Ne+"/conv3"),Tt=V(Ie[3],Ne+"/prelu3_alpha");return{conv1:Ge,prelu1_alpha:Qe,conv2:it,prelu2_alpha:yt,conv3:_t,prelu3_alpha:Tt}}function ge(){var Ie=ae([3,10,16,32],"pnet"),Ne=A(32,2,1,"pnet/conv4_1"),We=A(32,4,1,"pnet/conv4_2");return Object(W.a)(Object(W.a)({},Ie),{conv4_1:Ne,conv4_2:We})}function he(){var Ie=ae([3,28,48,64],"rnet",!0),Ne=P(576,128,"rnet/fc1"),We=V(128,"rnet/prelu4_alpha"),Ge=P(128,2,"rnet/fc2_1"),Qe=P(128,4,"rnet/fc2_2");return Object(W.a)(Object(W.a)({},Ie),{fc1:Ne,prelu4_alpha:We,fc2_1:Ge,fc2_2:Qe})}function Te(){var Ie=ae([3,32,64,64],"onet"),Ne=A(64,128,2,"onet/conv4"),We=V(128,"onet/prelu4_alpha"),Ge=P(1152,256,"onet/fc1"),Qe=V(256,"onet/prelu5_alpha"),it=P(256,2,"onet/fc2_1"),yt=P(256,4,"onet/fc2_2"),_t=P(256,10,"onet/fc2_3");return Object(W.a)(Object(W.a)({},Ie),{conv4:Ne,prelu4_alpha:We,fc1:Ge,prelu5_alpha:Qe,fc2_1:it,fc2_2:yt,fc2_3:_t})}return{extractPNetParams:ge,extractRNetParams:he,extractONetParams:Te}}function Ls(O){var w=ln(O),A=w.extractWeights,P=w.getRemainingWeights,V=[],ae=Fs(A,V),ge=ae.extractPNetParams,he=ae.extractRNetParams,Te=ae.extractONetParams,Ie=ge(),Ne=he(),We=Te();if(P().length!==0)throw new Error("weights remaing after extract: "+P().length);return{params:{pnet:Ie,rnet:Ne,onet:We},paramMappings:V}}function On(O,w){var A=Sn(O,w);function P(Ne){var We=A(Ne+"/weights",4,Ne+"/filters"),Ge=A(Ne+"/bias",1);return{filters:We,bias:Ge}}function V(Ne){var We=A(Ne+"/weights",2),Ge=A(Ne+"/bias",1);return{weights:We,bias:Ge}}function ae(Ne){return A(Ne,1)}function ge(Ne){var We=P(Ne+"/conv1"),Ge=ae(Ne+"/prelu1_alpha"),Qe=P(Ne+"/conv2"),it=ae(Ne+"/prelu2_alpha"),yt=P(Ne+"/conv3"),_t=ae(Ne+"/prelu3_alpha");return{conv1:We,prelu1_alpha:Ge,conv2:Qe,prelu2_alpha:it,conv3:yt,prelu3_alpha:_t}}function he(){var Ne=ge("pnet"),We=P("pnet/conv4_1"),Ge=P("pnet/conv4_2");return Object(W.a)(Object(W.a)({},Ne),{conv4_1:We,conv4_2:Ge})}function Te(){var Ne=ge("rnet"),We=V("rnet/fc1"),Ge=ae("rnet/prelu4_alpha"),Qe=V("rnet/fc2_1"),it=V("rnet/fc2_2");return Object(W.a)(Object(W.a)({},Ne),{fc1:We,prelu4_alpha:Ge,fc2_1:Qe,fc2_2:it})}function Ie(){var Ne=ge("onet"),We=P("onet/conv4"),Ge=ae("onet/prelu4_alpha"),Qe=V("onet/fc1"),it=ae("onet/prelu5_alpha"),yt=V("onet/fc2_1"),_t=V("onet/fc2_2"),Tt=V("onet/fc2_3");return Object(W.a)(Object(W.a)({},Ne),{conv4:We,prelu4_alpha:Ge,fc1:Qe,prelu5_alpha:it,fc2_1:yt,fc2_2:_t,fc2_3:Tt})}return{extractPNetParams:he,extractRNetParams:Te,extractONetParams:Ie}}function Hi(O){var w=[],A=On(O,w),P=A.extractPNetParams,V=A.extractRNetParams,ae=A.extractONetParams,ge=P(),he=V(),Te=ae();return yn(O,w),{params:{pnet:ge,rnet:he,onet:Te},paramMappings:w}}function ti(O,w){var A=w[0],P=w[1];return{height:Math.floor(A*O),width:Math.floor(P*O)}}function ri(O,w,A){for(var P=A[0],V=A[1],ae=ya/O,ge=[],he=Math.min(P,V)*ae,Te=0;he>=12;)ge.push(ae*Math.pow(w,Te)),he=he*w,Te+=1;return ge}var Fn=function(O){Object(W.c)(w,O);function w(A,P,V,ae){return O.call(this,{left:A,top:P,right:V,bottom:ae},!0)||this}return w}(be);function zi(O){return $.L(function(){return $.t($.F(O,$.y(127.5)),$.y(.0078125))})}function Eo(O,w){return $.L(function(){return $.c($.w(O),$.t(w,$.u($.w($.u(O)))))})}function ni(O,w,A){return A===void 0&&(A=!1),$.L(function(){var P=an(O,w.conv1,"valid");return P=Eo(P,w.prelu1_alpha),P=$.s(P,A?[2,2]:[3,3],[2,2],"same"),P=an(P,w.conv2,"valid"),P=Eo(P,w.prelu2_alpha),P=A?P:$.s(P,[3,3],[2,2],"valid"),P=an(P,w.conv3,"valid"),P=Eo(P,w.prelu3_alpha),P})}function js(O,w){return $.L(function(){var A=ni(O,w,!0),P=an(A,w.conv4_1,"valid"),V=$.m($.r(P,3),3),ae=$.D($.F(P,V),3),ge=an(A,w.conv4_2,"valid");return{prob:ae,regions:ge}})}function Bs(O,w){return $.L(function(){var A=ti(w,O.shape.slice(1)),P=A.height,V=A.width,ae=$.o.resizeBilinear(O,[P,V]),ge=zi(ae);return $.N(ge,[0,2,1,3])})}function Us(O,w,A,P){for(var V=[],ae=O.arraySync(),ge=0;ge<O.shape[0];ge++)for(var he=0;he<O.shape[1];he++)ae[ge][he]>=P&&V.push(new ye(he,ge));var Te=V.map(function(Ie){var Ne=new Ke(Math.round((Ie.y*ga+1)/A),Math.round((Ie.x*ga+1)/A),Math.round((Ie.y*ga+ya)/A),Math.round((Ie.x*ga+ya)/A)),We=ae[Ie.y][Ie.x],Ge=w.arraySync(),Qe=new Fn(Ge[Ie.y][Ie.x][0],Ge[Ie.y][Ie.x][1],Ge[Ie.y][Ie.x][2],Ge[Ie.y][Ie.x][3]);return{cell:Ne,score:We,region:Qe}});return Te}function Ws(O,w,A,P,V){V.stage1=[];var ae=w.map(function(Ge){return $.L(function(){var Qe={scale:Ge},it=Bs(O,Ge),yt=Date.now(),_t=js(it,P),Tt=_t.prob,Dt=_t.regions;Qe.pnet=Date.now()-yt;var At=$.O($.O(Tt,3)[1])[0],gt=$.O(Dt)[0];return{scoresTensor:At,regionsTensor:gt,scale:Ge,statsForScale:Qe}})}),ge=ae.map(function(Ge){var Qe=Ge.scoresTensor,it=Ge.regionsTensor,yt=Ge.scale,_t=Ge.statsForScale,Tt=Us(Qe,it,yt,A);if(Qe.dispose(),it.dispose(),!Tt.length)return V.stage1.push(_t),[];var Dt=Date.now(),At=fe(Tt.map(function(gt){return gt.cell}),Tt.map(function(gt){return gt.score}),.5);return _t.nms=Date.now()-Dt,_t.numBoxes=At.length,V.stage1.push(_t),At.map(function(gt){return Tt[gt]})}),he=ge.reduce(function(Ge,Qe){return Ge.concat(Qe)},[]),Te=[],Ie=[];if(he.length>0){var Ne=Date.now(),We=fe(he.map(function(Ge){return Ge.cell}),he.map(function(Ge){return Ge.score}),.7);V.stage1_nms=Date.now()-Ne,Ie=We.map(function(Ge){return he[Ge].score}),Te=We.map(function(Ge){return he[Ge]}).map(function(Ge){var Qe=Ge.cell,it=Ge.region;return new Ke(Qe.left+it.left*Qe.width,Qe.top+it.top*Qe.height,Qe.right+it.right*Qe.width,Qe.bottom+it.bottom*Qe.height).toSquare().round()})}return{boxes:Te,scores:Ie}}function oi(O,w,A){var P=A.width,V=A.height;return Object(W.b)(this,void 0,void 0,function(){var ae,ge,he,Te=this;return Object(W.d)(this,function(Ie){switch(Ie.label){case 0:return ae=nn(O),[4,Promise.all(w.map(function(Ne){return Object(W.b)(Te,void 0,void 0,function(){var We,Ge,Qe,it,yt,_t,Tt,Dt;return Object(W.d)(this,function(At){return We=Ne.padAtBorders(O.height,O.width),Ge=We.y,Qe=We.ey,it=We.x,yt=We.ex,_t=it-1,Tt=Ge-1,Dt=ae.getImageData(_t,Tt,yt-_t,Qe-Tt),[2,hr.isNodejs()?Tn(Dt):createImageBitmap(Dt)]})})}))];case 1:return ge=Ie.sent(),he=[],ge.forEach(function(Ne){var We=Hr({width:P,height:V}),Ge=nn(We);Ge.drawImage(Ne,0,0,P,V);for(var Qe=Ge.getImageData(0,0,P,V).data,it=[],yt=0;yt<Qe.length;yt+=4)it.push(Qe[yt+2]),it.push(Qe[yt+1]),it.push(Qe[yt]);he.push(it)}),[2,he.map(function(Ne){var We=$.L(function(){var Ge=$.N($.K(Ne,[1,P,V,3]),[0,2,1,3]).toFloat();return zi(Ge)});return We})]}})})}function ba(O,w){return $.L(function(){var A=ni(O,w),P=$.x(A,[A.shape[0],w.fc1.weights.shape[0]]),V=$r(P,w.fc1),ae=Eo(V,w.prelu4_alpha),ge=$r(ae,w.fc2_1),he=$.m($.r(ge,1),1),Te=$.D($.F(ge,he),1),Ie=$r(ae,w.fc2_2),Ne=$.O(Te,1)[1];return{scores:Ne,regions:Ie}})}function Gi(O,w,A,P,V){return Object(W.b)(this,void 0,void 0,function(){var ae,ge,he,Te,Ie,Ne,We,Ge,Qe,it,yt,_t,Tt,Dt;return Object(W.d)(this,function(At){switch(At.label){case 0:return ae=Date.now(),[4,oi(O,w,{width:24,height:24})];case 1:return ge=At.sent(),V.stage2_extractImagePatches=Date.now()-ae,ae=Date.now(),he=ge.map(function(gt){var Ct=ba(gt,P);return gt.dispose(),Ct}),V.stage2_rnet=Date.now()-ae,Te=he.length>1?$.h(he.map(function(gt){return gt.scores})):he[0].scores,We=(Ne=Array).from,[4,Te.data()];case 2:return Ie=We.apply(Ne,[At.sent()]),Te.dispose(),Ge=Ie.map(function(gt,Ct){return{score:gt,idx:Ct}}).filter(function(gt){return gt.score>A}).map(function(gt){var Ct=gt.idx;return Ct}),Qe=Ge.map(function(gt){return w[gt]}),it=Ge.map(function(gt){return Ie[gt]}),yt=[],_t=[],Qe.length>0&&(ae=Date.now(),Tt=fe(Qe,it,.7),V.stage2_nms=Date.now()-ae,Dt=Tt.map(function(gt){var Ct=he[Ge[gt]].regions.arraySync();return new Fn(Ct[0][0],Ct[0][1],Ct[0][2],Ct[0][3])}),_t=Tt.map(function(gt){return it[gt]}),yt=Tt.map(function(gt,Ct){return Qe[gt].calibrate(Dt[Ct])})),he.forEach(function(gt){gt.regions.dispose(),gt.scores.dispose()}),[2,{boxes:yt,scores:_t}]}})})}function Vi(O,w){return $.L(function(){var A=ni(O,w);A=$.s(A,[2,2],[2,2],"same"),A=an(A,w.conv4,"valid"),A=Eo(A,w.prelu4_alpha);var P=$.x(A,[A.shape[0],w.fc1.weights.shape[0]]),V=$r(P,w.fc1),ae=Eo(V,w.prelu5_alpha),ge=$r(ae,w.fc2_1),he=$.m($.r(ge,1),1),Te=$.D($.F(ge,he),1),Ie=$r(ae,w.fc2_2),Ne=$r(ae,w.fc2_3),We=$.O(Te,1)[1];return{scores:We,regions:Ie,points:Ne}})}function Ln(O,w,A,P,V){return Object(W.b)(this,void 0,void 0,function(){var ae,ge,he,Te,Ie,Ne,We,Ge,Qe,it,yt,_t,Tt,Dt,At;return Object(W.d)(this,function(gt){switch(gt.label){case 0:return ae=Date.now(),[4,oi(O,w,{width:48,height:48})];case 1:return ge=gt.sent(),V.stage3_extractImagePatches=Date.now()-ae,ae=Date.now(),he=ge.map(function(Ct){var Wt=Vi(Ct,P);return Ct.dispose(),Wt}),V.stage3_onet=Date.now()-ae,Te=he.length>1?$.h(he.map(function(Ct){return Ct.scores})):he[0].scores,We=(Ne=Array).from,[4,Te.data()];case 2:return Ie=We.apply(Ne,[gt.sent()]),Te.dispose(),Ge=Ie.map(function(Ct,Wt){return{score:Ct,idx:Wt}}).filter(function(Ct){return Ct.score>A}).map(function(Ct){var Wt=Ct.idx;return Wt}),Qe=Ge.map(function(Ct){var Wt=he[Ct].regions.arraySync();return new Fn(Wt[0][0],Wt[0][1],Wt[0][2],Wt[0][3])}),it=Ge.map(function(Ct,Wt){return w[Ct].calibrate(Qe[Wt])}),yt=Ge.map(function(Ct){return Ie[Ct]}),_t=[],Tt=[],Dt=[],it.length>0&&(ae=Date.now(),At=fe(it,yt,.7,!1),V.stage3_nms=Date.now()-ae,_t=At.map(function(Ct){return it[Ct]}),Tt=At.map(function(Ct){return yt[Ct]}),Dt=At.map(function(Ct,Wt){return Array(5).fill(0).map(function(sr,vr){var or=he[Ct].points.arraySync();return new ye(or[0][vr]*(_t[Wt].width+1)+_t[Wt].left,or[0][vr+5]*(_t[Wt].height+1)+_t[Wt].top)})})),he.forEach(function(Ct){Ct.regions.dispose(),Ct.scores.dispose(),Ct.points.dispose()}),[2,{boxes:_t,scores:Tt,points:Dt}]}})})}var eo=function(O){Object(W.c)(w,O);function w(){return O.call(this,"Mtcnn")||this}return w.prototype.load=function(A){return Object(W.b)(this,void 0,void 0,function(){return Object(W.d)(this,function(P){return console.warn("mtcnn is deprecated and will be removed soon"),[2,O.prototype.load.call(this,A)]})})},w.prototype.loadFromDisk=function(A){return Object(W.b)(this,void 0,void 0,function(){return Object(W.d)(this,function(P){return console.warn("mtcnn is deprecated and will be removed soon"),[2,O.prototype.loadFromDisk.call(this,A)]})})},w.prototype.forwardInput=function(A,P){return P===void 0&&(P={}),Object(W.b)(this,void 0,void 0,function(){var V,ae,ge,he,Te,Ie,Ne,We,Ge,Qe,it,yt,_t,Tt,Dt,At,gt,Ct,Wt,sr,vr;return Object(W.d)(this,function(or){switch(or.label){case 0:if(V=this.params,!V)throw new Error("Mtcnn - load model before inference");if(ae=A.canvases[0],!ae)throw new Error("Mtcnn - inputCanvas is not defined, note that passing tensors into Mtcnn.forwardInput is not supported yet.");return ge={},he=Date.now(),Te=$.L(function(){return Ps($.m($.f.fromPixels(ae)).toFloat())}),Ie=function(Gt){return Te.dispose(),ge.total=Date.now()-he,Gt},Ne=Te.shape.slice(1),We=Ne[0],Ge=Ne[1],Qe=new bo(P),it=Qe.minFaceSize,yt=Qe.scaleFactor,_t=Qe.maxNumScales,Tt=Qe.scoreThresholds,Dt=Qe.scaleSteps,At=(Dt||ri(it,yt,[We,Ge])).filter(function(Gt){var Ut=ti(Gt,[We,Ge]);return Math.min(Ut.width,Ut.height)>ya}).slice(0,_t),ge.scales=At,ge.pyramid=At.map(function(Gt){return ti(Gt,[We,Ge])}),gt=Date.now(),[4,Ws(Te,At,Tt[0],V.pnet,ge)];case 1:return Ct=or.sent(),ge.total_stage1=Date.now()-gt,Ct.boxes.length?(ge.stage2_numInputBoxes=Ct.boxes.length,gt=Date.now(),[4,Gi(ae,Ct.boxes,Tt[1],V.rnet,ge)]):[2,Ie({results:[],stats:ge})];case 2:return Wt=or.sent(),ge.total_stage2=Date.now()-gt,Wt.boxes.length?(ge.stage3_numInputBoxes=Wt.boxes.length,gt=Date.now(),[4,Ln(ae,Wt.boxes,Tt[2],V.onet,ge)]):[2,Ie({results:[],stats:ge})];case 3:return sr=or.sent(),ge.total_stage3=Date.now()-gt,vr=sr.boxes.map(function(Gt,Ut){return Lo(tt({},new m(sr.scores[Ut],new bt(Gt.left/Ge,Gt.top/We,Gt.width/Ge,Gt.height/We),{height:We,width:Ge})),new Bt(sr.points[Ut].map(function(kr){return kr.sub(new ye(Gt.left,Gt.top)).div(new ye(Gt.width,Gt.height))}),{width:Gt.width,height:Gt.height}))}),[2,Ie({results:vr,stats:ge})]}})})},w.prototype.forward=function(A,P){return P===void 0&&(P={}),Object(W.b)(this,void 0,void 0,function(){var V;return Object(W.d)(this,function(ae){switch(ae.label){case 0:return V=this.forwardInput,[4,Or(A)];case 1:return[4,V.apply(this,[ae.sent(),P])];case 2:return[2,ae.sent().results]}})})},w.prototype.forwardWithStats=function(A,P){return P===void 0&&(P={}),Object(W.b)(this,void 0,void 0,function(){var V;return Object(W.d)(this,function(ae){switch(ae.label){case 0:return V=this.forwardInput,[4,Or(A)];case 1:return[2,V.apply(this,[ae.sent(),P])]}})})},w.prototype.getDefaultModelName=function(){return"mtcnn_model"},w.prototype.extractParamsFromWeigthMap=function(A){return Hi(A)},w.prototype.extractParams=function(A){return Ls(A)},w}(gn),Hs=.4,xa=[new ye(1.603231,2.094468),new ye(6.041143,7.080126),new ye(2.882459,3.518061),new ye(4.266906,5.178857),new ye(9.041765,10.66308)],zs=[117.001,114.697,97.404],Wo=function(O){Object(W.c)(w,O);function w(){var A=this,P={withSeparableConvs:!0,iouThreshold:Hs,classes:["face"],anchors:xa,meanRgb:zs,isFirstLayerConv2d:!0,filterSizes:[3,16,32,64,128,256,512]};return A=O.call(this,P)||this,A}return Object.defineProperty(w.prototype,"anchors",{get:function(){return this.config.anchors},enumerable:!0,configurable:!0}),w.prototype.locateFaces=function(A,P){return Object(W.b)(this,void 0,void 0,function(){var V;return Object(W.d)(this,function(ae){switch(ae.label){case 0:return[4,this.detect(A,P)];case 1:return V=ae.sent(),[2,V.map(function(ge){return new m(ge.score,ge.relativeBox,{width:ge.imageWidth,height:ge.imageHeight})})]}})})},w.prototype.getDefaultModelName=function(){return"tiny_face_detector_model"},w.prototype.extractParamsFromWeigthMap=function(A){return O.prototype.extractParamsFromWeigthMap.call(this,A)},w}(Uo),qt={ssdMobilenetv1:new Mn,tinyFaceDetector:new Wo,tinyYolov2:new pa,mtcnn:new eo,faceLandmark68Net:new Rr,faceLandmark68TinyNet:new rc,faceRecognitionNet:new yo,faceExpressionNet:new Ri,ageGenderNet:new ec},wa=function(O,w){return qt.ssdMobilenetv1.locateFaces(O,w)},Gs=function(O,w){return qt.tinyFaceDetector.locateFaces(O,w)},Vs=function(O,w){return qt.tinyYolov2.locateFaces(O,w)},Xi=function(O,w){return qt.mtcnn.forward(O,w)},cc=function(O){return qt.faceLandmark68Net.detectLandmarks(O)},Ki=function(O){return qt.faceLandmark68TinyNet.detectLandmarks(O)},ai=function(O){return qt.faceRecognitionNet.computeFaceDescriptor(O)},Xs=function(O){return qt.faceExpressionNet.predictExpressions(O)},Ks=function(O){return qt.ageGenderNet.predictAgeAndGender(O)},Ho=function(O){return qt.ssdMobilenetv1.load(O)},lc=function(O){return qt.tinyFaceDetector.load(O)},Ys=function(O){return qt.mtcnn.load(O)},Yi=function(O){return qt.tinyYolov2.load(O)},Ea=function(O){return qt.faceLandmark68Net.load(O)},$s=function(O){return qt.faceLandmark68TinyNet.load(O)},$i=function(O){return qt.faceRecognitionNet.load(O)},Ji=function(O){return qt.faceExpressionNet.load(O)},qi=function(O){return qt.ageGenderNet.load(O)},id=Ho,sd=wa,ud=cc,Js=function(O){Object(W.c)(w,O);function w(A,P,V){var ae=O.call(this)||this;return ae.parentTask=A,ae.input=P,ae.extractedFaces=V,ae}return w}(Lt),Qi=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(W.b)(this,void 0,void 0,function(){var A,P,V=this;return Object(W.d)(this,function(ae){switch(ae.label){case 0:return[4,this.parentTask];case 1:return A=ae.sent(),[4,ma(A,this.input,function(ge){return Object(W.b)(V,void 0,void 0,function(){return Object(W.d)(this,function(he){switch(he.label){case 0:return[4,Promise.all(ge.map(function(Te){return qt.faceExpressionNet.predictExpressions(Te)}))];case 1:return[2,he.sent()]}})})},this.extractedFaces)];case 2:return P=ae.sent(),[2,A.map(function(ge,he){return go(ge,P[he])})]}})})},w.prototype.withAgeAndGender=function(){return new si(this,this.input)},w}(Js),ii=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(W.b)(this,void 0,void 0,function(){var A,P;return Object(W.d)(this,function(V){switch(V.label){case 0:return[4,this.parentTask];case 1:return A=V.sent(),A?[4,va(A,this.input,function(ae){return qt.faceExpressionNet.predictExpressions(ae)},this.extractedFaces)]:[2];case 2:return P=V.sent(),[2,go(A,P)]}})})},w.prototype.withAgeAndGender=function(){return new _a(this,this.input)},w}(Js),_o=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.withAgeAndGender=function(){return new Ca(this,this.input)},w.prototype.withFaceDescriptors=function(){return new Ir(this,this.input)},w}(Qi),Co=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.withAgeAndGender=function(){return new rt(this,this.input)},w.prototype.withFaceDescriptor=function(){return new Ht(this,this.input)},w}(ii),zo=function(O){Object(W.c)(w,O);function w(A,P,V){var ae=O.call(this)||this;return ae.parentTask=A,ae.input=P,ae.extractedFaces=V,ae}return w}(Lt),si=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(W.b)(this,void 0,void 0,function(){var A,P,V=this;return Object(W.d)(this,function(ae){switch(ae.label){case 0:return[4,this.parentTask];case 1:return A=ae.sent(),[4,ma(A,this.input,function(ge){return Object(W.b)(V,void 0,void 0,function(){return Object(W.d)(this,function(he){switch(he.label){case 0:return[4,Promise.all(ge.map(function(Te){return qt.ageGenderNet.predictAgeAndGender(Te)}))];case 1:return[2,he.sent()]}})})},this.extractedFaces)];case 2:return P=ae.sent(),[2,A.map(function(ge,he){var Te=P[he],Ie=Te.age,Ne=Te.gender,We=Te.genderProbability;return Vr(sn(ge,Ne,We),Ie)})]}})})},w.prototype.withFaceExpressions=function(){return new Qi(this,this.input)},w}(zo),_a=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(W.b)(this,void 0,void 0,function(){var A,P,V,ae,ge;return Object(W.d)(this,function(he){switch(he.label){case 0:return[4,this.parentTask];case 1:return A=he.sent(),A?[4,va(A,this.input,function(Te){return qt.ageGenderNet.predictAgeAndGender(Te)},this.extractedFaces)]:[2];case 2:return P=he.sent(),V=P.age,ae=P.gender,ge=P.genderProbability,[2,Vr(sn(A,ae,ge),V)]}})})},w.prototype.withFaceExpressions=function(){return new ii(this,this.input)},w}(zo),Ca=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.withFaceExpressions=function(){return new _o(this,this.input)},w.prototype.withFaceDescriptors=function(){return new Ir(this,this.input)},w}(si),rt=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.withFaceExpressions=function(){return new Co(this,this.input)},w.prototype.withFaceDescriptor=function(){return new Ht(this,this.input)},w}(_a),En=function(O){Object(W.c)(w,O);function w(A,P){var V=O.call(this)||this;return V.parentTask=A,V.input=P,V}return w}(Lt),Ir=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(W.b)(this,void 0,void 0,function(){var A,P;return Object(W.d)(this,function(V){switch(V.label){case 0:return[4,this.parentTask];case 1:return A=V.sent(),[4,ma(A,this.input,function(ae){return Promise.all(ae.map(function(ge){return qt.faceRecognitionNet.computeFaceDescriptor(ge)}))},null,function(ae){return ae.landmarks.align(null,{useDlibAlignment:!0})})];case 2:return P=V.sent(),[2,P.map(function(ae,ge){return Qa(A[ge],ae)})]}})})},w.prototype.withFaceExpressions=function(){return new _o(this,this.input)},w.prototype.withAgeAndGender=function(){return new Ca(this,this.input)},w}(En),Ht=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(W.b)(this,void 0,void 0,function(){var A,P;return Object(W.d)(this,function(V){switch(V.label){case 0:return[4,this.parentTask];case 1:return A=V.sent(),A?[4,va(A,this.input,function(ae){return qt.faceRecognitionNet.computeFaceDescriptor(ae)},null,function(ae){return ae.landmarks.align(null,{useDlibAlignment:!0})})]:[2];case 2:return P=V.sent(),[2,Qa(A,P)]}})})},w.prototype.withFaceExpressions=function(){return new Co(this,this.input)},w.prototype.withAgeAndGender=function(){return new rt(this,this.input)},w}(En),to=function(O){Object(W.c)(w,O);function w(A,P,V){var ae=O.call(this)||this;return ae.parentTask=A,ae.input=P,ae.useTinyLandmarkNet=V,ae}return Object.defineProperty(w.prototype,"landmarkNet",{get:function(){return this.useTinyLandmarkNet?qt.faceLandmark68TinyNet:qt.faceLandmark68Net},enumerable:!0,configurable:!0}),w}(Lt),Go=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(W.b)(this,void 0,void 0,function(){var A,P,V,ae,ge,he=this;return Object(W.d)(this,function(Te){switch(Te.label){case 0:return[4,this.parentTask];case 1:return A=Te.sent(),P=A.map(function(Ie){return Ie.detection}),this.input instanceof $.a?[4,Po(this.input,P)]:[3,3];case 2:return ae=Te.sent(),[3,5];case 3:return[4,$n(this.input,P)];case 4:ae=Te.sent(),Te.label=5;case 5:return V=ae,[4,Promise.all(V.map(function(Ie){return he.landmarkNet.detectLandmarks(Ie)}))];case 6:return ge=Te.sent(),V.forEach(function(Ie){return Ie instanceof $.a&&Ie.dispose()}),[2,A.map(function(Ie,Ne){return Lo(Ie,ge[Ne])})]}})})},w.prototype.withFaceExpressions=function(){return new _o(this,this.input)},w.prototype.withAgeAndGender=function(){return new Ca(this,this.input)},w.prototype.withFaceDescriptors=function(){return new Ir(this,this.input)},w}(to),jn=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(W.b)(this,void 0,void 0,function(){var A,P,V,ae,ge;return Object(W.d)(this,function(he){switch(he.label){case 0:return[4,this.parentTask];case 1:return A=he.sent(),A?(P=A.detection,this.input instanceof $.a?[4,Po(this.input,[P])]:[3,3]):[2];case 2:return ae=he.sent(),[3,5];case 3:return[4,$n(this.input,[P])];case 4:ae=he.sent(),he.label=5;case 5:return V=ae,[4,this.landmarkNet.detectLandmarks(V[0])];case 6:return ge=he.sent(),V.forEach(function(Te){return Te instanceof $.a&&Te.dispose()}),[2,Lo(A,ge)]}})})},w.prototype.withFaceExpressions=function(){return new Co(this,this.input)},w.prototype.withAgeAndGender=function(){return new rt(this,this.input)},w.prototype.withFaceDescriptor=function(){return new Ht(this,this.input)},w}(to),To=function(O){Object(W.c)(w,O);function w(A,P){P===void 0&&(P=new wo);var V=O.call(this)||this;return V.input=A,V.options=P,V}return w}(Lt),Ta=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(W.b)(this,void 0,void 0,function(){var A,P,V,ae;return Object(W.d)(this,function(ge){switch(ge.label){case 0:return A=this,P=A.input,V=A.options,V instanceof bo?[4,qt.mtcnn.forward(P,V)]:[3,2];case 1:return[2,ge.sent().map(function(he){return he.detection})];case 2:if(ae=V instanceof Wi?function(he){return qt.tinyFaceDetector.locateFaces(he,V)}:V instanceof wo?function(he){return qt.ssdMobilenetv1.locateFaces(he,V)}:V instanceof wn?function(he){return qt.tinyYolov2.locateFaces(he,V)}:null,!ae)throw new Error("detectFaces - expected options to be instance of TinyFaceDetectorOptions | SsdMobilenetv1Options | MtcnnOptions | TinyYolov2Options");return[2,ae(P)]}})})},w.prototype.runAndExtendWithFaceDetections=function(){var A=this;return new Promise(function(P){return Object(W.b)(A,void 0,void 0,function(){var V;return Object(W.d)(this,function(ae){switch(ae.label){case 0:return[4,this.run()];case 1:return V=ae.sent(),[2,P(V.map(function(ge){return tt({},ge)}))]}})})})},w.prototype.withFaceLandmarks=function(A){return A===void 0&&(A=!1),new Go(this.runAndExtendWithFaceDetections(),this.input,A)},w.prototype.withFaceExpressions=function(){return new Qi(this.runAndExtendWithFaceDetections(),this.input)},w.prototype.withAgeAndGender=function(){return new si(this.runAndExtendWithFaceDetections(),this.input)},w}(To),Sa=function(O){Object(W.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(W.b)(this,void 0,void 0,function(){var A,P;return Object(W.d)(this,function(V){switch(V.label){case 0:return[4,new Ta(this.input,this.options)];case 1:return A=V.sent(),P=A[0],A.forEach(function(ae){ae.score>P.score&&(P=ae)}),[2,P]}})})},w.prototype.runAndExtendWithFaceDetection=function(){var A=this;return new Promise(function(P){return Object(W.b)(A,void 0,void 0,function(){var V;return Object(W.d)(this,function(ae){switch(ae.label){case 0:return[4,this.run()];case 1:return V=ae.sent(),[2,P(V?tt({},V):void 0)]}})})})},w.prototype.withFaceLandmarks=function(A){return A===void 0&&(A=!1),new jn(this.runAndExtendWithFaceDetection(),this.input,A)},w.prototype.withFaceExpressions=function(){return new ii(this.runAndExtendWithFaceDetection(),this.input)},w.prototype.withAgeAndGender=function(){return new _a(this.runAndExtendWithFaceDetection(),this.input)},w}(To);function Vo(O,w){return w===void 0&&(w=new wo),new Sa(O,w)}function Bn(O,w){return w===void 0&&(w=new wo),new Ta(O,w)}function Xo(O,w){return Object(W.b)(this,void 0,void 0,function(){return Object(W.d)(this,function(A){switch(A.label){case 0:return console.warn("allFacesSsdMobilenetv1 is deprecated and will be removed soon, use the high level api instead"),[4,Bn(O,new wo(w?{minConfidence:w}:{})).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,A.sent()]}})})}function So(O,w){return w===void 0&&(w={}),Object(W.b)(this,void 0,void 0,function(){return Object(W.d)(this,function(A){switch(A.label){case 0:return console.warn("allFacesTinyYolov2 is deprecated and will be removed soon, use the high level api instead"),[4,Bn(O,new wn(w)).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,A.sent()]}})})}function Zr(O,w){return w===void 0&&(w={}),Object(W.b)(this,void 0,void 0,function(){return Object(W.d)(this,function(A){switch(A.label){case 0:return console.warn("allFacesMtcnn is deprecated and will be removed soon, use the high level api instead"),[4,Bn(O,new bo(w)).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,A.sent()]}})})}var ui=Xo;function ci(O,w){if(O.length!==w.length)throw new Error("euclideanDistance: arr1.length !== arr2.length");var A=Array.from(O),P=Array.from(w);return Math.sqrt(A.map(function(V,ae){return V-P[ae]}).reduce(function(V,ae){return V+Math.pow(ae,2)},0))}var Aa=function(){function O(w,A){A===void 0&&(A=.6),this._distanceThreshold=A;var P=Array.isArray(w)?w:[w];if(!P.length)throw new Error("FaceRecognizer.constructor - expected atleast one input");var V=1,ae=function(){return"person "+V++};this._labeledDescriptors=P.map(function(ge){if(ge instanceof Fr)return ge;if(ge instanceof Float32Array)return new Fr(ae(),[ge]);if(ge.descriptor&&ge.descriptor instanceof Float32Array)return new Fr(ae(),[ge.descriptor]);throw new Error("FaceRecognizer.constructor - expected inputs to be of type LabeledFaceDescriptors | WithFaceDescriptor<any> | Float32Array | Array<LabeledFaceDescriptors | WithFaceDescriptor<any> | Float32Array>")})}return Object.defineProperty(O.prototype,"labeledDescriptors",{get:function(){return this._labeledDescriptors},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"distanceThreshold",{get:function(){return this._distanceThreshold},enumerable:!0,configurable:!0}),O.prototype.computeMeanDistance=function(w,A){return A.map(function(P){return ci(P,w)}).reduce(function(P,V){return P+V},0)/(A.length||1)},O.prototype.matchDescriptor=function(w){var A=this;return this.labeledDescriptors.map(function(P){var V=P.descriptors,ae=P.label;return new rr(ae,A.computeMeanDistance(w,V))}).reduce(function(P,V){return P.distance<V.distance?P:V})},O.prototype.findBestMatch=function(w){var A=this.matchDescriptor(w);return A.distance<this.distanceThreshold?A:new rr("unknown",A.distance)},O.prototype.toJSON=function(){return{distanceThreshold:this.distanceThreshold,labeledDescriptors:this.labeledDescriptors.map(function(w){return w.toJSON()})}},O.fromJSON=function(w){var A=w.labeledDescriptors.map(function(P){return Fr.fromJSON(P)});return new O(A,w.distanceThreshold)},O}();function Zi(O){var w=new eo;return w.extractWeights(O),w}function cd(O){var w=new Wo;return w.extractWeights(O),w}function Oa(O,w){var A=new ie(w.width,w.height),P=A.width,V=A.height;if(P<=0||V<=0)throw new Error("resizeResults - invalid dimensions: "+JSON.stringify({width:P,height:V}));if(Array.isArray(O))return O.map(function(he){return Oa(he,{width:P,height:V})});if(ca(O)){var ae=O.detection.forSize(P,V),ge=O.unshiftedLandmarks.forSize(ae.box.width,ae.box.height);return Lo(tt(O,ae),ge)}return Ar(O)?tt(O,O.detection.forSize(P,V)):O instanceof at||O instanceof m?O.forSize(P,V):O}var es=N("mxV5"),Qs=N.n(es),Zs=N("7Cbv"),eu=N("KhGG"),tu=N("ErOA"),li=N("IO3U"),di=N.n(li),ts=function(w,A){for(var P=w.split(","),V=P[0].match(/:(.*?);/)[1],ae=atob(P[1]),ge=ae.length,he=new Uint8Array(ge);ge--;)he[ge]=ae.charCodeAt(ge);return new Blob([he],{type:V})},ru=function(){var O=Object(x.a)(U.a.mark(function w(A){return U.a.wrap(function(V){for(;;)switch(V.prev=V.next){case 0:return V.abrupt("return",new Promise(function(ae,ge){var he=new Image;(A==null?void 0:A.indexOf("educoder.net"))>-1?he.setAttribute("crossOrigin","educoder.net"):he.setAttribute("crossOrigin","aliyuncs.com"),he.onload=function(){var Te=document.createElement("canvas");Te.width=this.naturalWidth,Te.height=this.naturalHeight,Te.getContext("2d").drawImage(he,0,0);var Ie=Te.toDataURL("image/png");ae(Ie)},he.src=A,he.onerror=function(){ge(new Error("\u56FE\u7247\u6D41\u5F02\u5E38")),v.b.error("\u60A8\u7684\u8EAB\u4EFD\u7167\u7247\u5F02\u5E38\uFF0C\u8BF7\u62CD\u7167\u540E\u63D0\u4EA4\u81F3\u4EBA\u5DE5\u5BA1\u6838")}}));case 1:case"end":return V.stop()}},w)}));return function(A){return O.apply(this,arguments)}}(),nu=Object(j.forwardRef)(function(O,w){var A=O.outputResult,P=O.identity_url,V=O.onCameraReady,ae=O.defaultOpen,ge=Object(te.i)(),he=Object(j.useRef)(),Te=Object(j.useRef)(),Ie=Object(j.useRef)(),Ne=Object(j.useRef)(!1),We=Object(j.useRef)(),Ge=Object(j.useState)(!0),Qe=Object(S.a)(Ge,2),it=Qe[0],yt=Qe[1],_t=Object(j.useState)(""),Tt=Object(S.a)(_t,2),Dt=Tt[0],At=Tt[1],gt=Object(j.useState)(""),Ct=Object(S.a)(gt,2),Wt=Ct[0],sr=Ct[1],vr=Object(j.useRef)(!1),or=Object(j.useRef)(""),Gt=Object(j.useState)(!0),Ut=Object(S.a)(Gt,1),kr=Ut[0],lr=.5,Xr=224,Yr="\u5BA1\u6838\u5931\u8D25",Rt=Object(j.useMemo)(function(){return new Wi({inputSize:Xr,scoreThreshold:lr})},[]),tn=function(){var dr=Object(x.a)(U.a.mark(function jt(){return U.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:return Qt.next=2,qt.ssdMobilenetv1.loadFromUri("https://www-cdn.educoder.net/weights/");case 2:return Qt.next=4,lc("https://www-cdn.educoder.net/weights/");case 4:return Qt.next=6,Ea("https://www-cdn.educoder.net/weights/");case 6:return Qt.next=8,$i("https://www-cdn.educoder.net/weights/");case 8:kt(!0);case 9:case"end":return Qt.stop()}},jt)}));return function(){return dr.apply(this,arguments)}}();Object(j.useEffect)(function(){ae&&tn()},[ae]),Object(j.useImperativeHandle)(w,function(){return{handleStop:gr,handleRemove:hi,handlePlay:kt,startDiscern:Ko,handleUploadImage:Rn}});var ur=function(){var dr=Object(x.a)(U.a.mark(function jt(Zt){return U.a.wrap(function(pr){for(;;)switch(pr.prev=pr.next){case 0:if(he.current){pr.next=3;break}return setTimeout(function(){return ur(Zt)}),pr.abrupt("return");case 3:navigator.mediaDevices.getUserMedia({video:{width:640,height:360}}).then(function(){var Xt=Object(x.a)(U.a.mark(function wr(ro){var Hn;return U.a.wrap(function(Br){for(;;)switch(Br.prev=Br.next){case 0:if("srcObject"in he.current?he.current.srcObject=ro:he.current.src=window.URL.createObjectURL(ro),he.current.onloadedmetadata=function(Ra){yt(!1),he.current.play()},!Zt){Br.next=10;break}return Hn=document.createElement("img"),Br.next=6,ru(P+"?t="+new Date().getTime());case 6:return Hn.src=Br.sent,Br.next=9,Vo(Hn,Rt).withFaceLandmarks().withFaceDescriptor();case 9:We.current=Br.sent;case 10:case"end":return Br.stop()}},wr)}));return function(wr){return Xt.apply(this,arguments)}}()).catch(function(Xt){console.log("err:",Xt,Xt.message),Xt.message==="Permission denied"||Xt.name==="NotAllowedError"?v.b.error("\u60A8\u5DF2\u62D2\u7EDD\u4E86\u83B7\u53D6\u6444\u50CF\u5934"):Xt.message!="\u56FE\u7247\u6D41\u5F02\u5E38"&&v.b.error("\u6444\u50CF\u5934\u83B7\u53D6\u5931\u8D25\uFF0C\u6216\u60A8\u5DF2\u62D2\u7EDD\u4E86\u83B7\u53D6\u6444\u50CF\u5934")});case 4:case"end":return pr.stop()}},jt)}));return function(Zt){return dr.apply(this,arguments)}}(),_r=function(){var dr=Object(x.a)(U.a.mark(function jt(Zt,Qt){return U.a.wrap(function(Xt){for(;;)switch(Xt.prev=Xt.next){case 0:return Xt.abrupt("return",new Promise(function(){var wr=Object(x.a)(U.a.mark(function ro(Hn){var Yo,Br,Ra,pi,mi,Ia,vi,br,gi,yi,bi;return U.a.wrap(function(In){for(;;)switch(In.prev=In.next){case 0:return In.next=2,Object(tu.a)("/api/buckets/get_upload_token.json",{method:"get"});case 2:br=In.sent,br.data=JSON.parse(Object(eu.a)(br.data)),gi=Object(Zs.a)(),yi=new Qs.a({endpoint:br==null||((Yo=br.data)===null||Yo===void 0)?void 0:Yo.end_point,region:br==null||((Br=br.data)===null||Br===void 0)?void 0:Br.region,accessKeyId:br==null||((Ra=br.data)===null||Ra===void 0)?void 0:Ra.access_key_id,accessKeySecret:br==null||((pi=br.data)===null||pi===void 0)?void 0:pi.access_key_secret,bucket:br==null||((mi=br.data)===null||mi===void 0)?void 0:mi.bucket,stsToken:br==null||((Ia=br.data)===null||Ia===void 0)?void 0:Ia.security_token}),bi=ts(Zt,gi),yi.multipartUpload("".concat(gi,".png"),bi,{timeout:10*1e3,partSize:10485760,callback:{url:br==null||((vi=br.data)===null||vi===void 0)?void 0:vi.callback_url,host:br==null?void 0:br.data.bucket_host,body:"bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&my_var=${x:my_var}&login="+ge.login+"&container_id="+ge.categoryId+"&container_type=ExerciseIdentity&p="+Qt}}).then(function($o){Hn($o),console.log("result:",$o)}).catch(function($o){console.log("err:",$o)});case 8:case"end":return In.stop()}},ro)}));return function(ro){return wr.apply(this,arguments)}}()));case 1:case"end":return Xt.stop()}},jt)}));return function(Zt,Qt){return dr.apply(this,arguments)}}(),Un=function(){var dr=Object(x.a)(U.a.mark(function jt(Zt){var Qt;return U.a.wrap(function(Xt){for(;;)switch(Xt.prev=Xt.next){case 0:return Xt.prev=0,Te.current.width=he.current.videoWidth,Te.current.height=360,Qt=Te.current.getContext("2d"),Xt.next=6,Qt.drawImage(he.current,0,0,Te.current.width,Te.current.height);case 6:or.current=Te.current.toDataURL("image/png"),Zt===1&&_r(or.current,Zt),Xt.next=12;break;case 10:Xt.prev=10,Xt.t0=Xt.catch(0);case 12:case"end":return Xt.stop()}},jt,null,[[0,10]])}));return function(Zt){return dr.apply(this,arguments)}}(),Rn=function(){var dr=Object(x.a)(U.a.mark(function jt(Zt){return U.a.wrap(function(pr){for(;;)switch(pr.prev=pr.next){case 0:return pr.abrupt("return",new Promise(function(){var Xt=Object(x.a)(U.a.mark(function wr(ro){var Hn;return U.a.wrap(function(Br){for(;;)switch(Br.prev=Br.next){case 0:return Hn=Te.current.getContext("2d"),Br.next=3,Hn.drawImage(he.current,0,0,Te.current.width,Te.current.height);case 3:return Br.next=5,_r(or.current,Zt);case 5:ro();case 6:case"end":return Br.stop()}},wr)}));return function(wr){return Xt.apply(this,arguments)}}()));case 1:case"end":return pr.stop()}},jt)}));return function(Zt){return dr.apply(this,arguments)}}(),Ko=function(){var dr=Object(x.a)(U.a.mark(function jt(){var Zt,Qt,pr;return U.a.wrap(function(wr){for(;;)switch(wr.prev=wr.next){case 0:return Ne.current=!0,wr.next=3,Vo(he.current,Rt).withFaceLandmarks().withFaceDescriptor();case 3:Zt=wr.sent,Zt&&We.current?(Qt=new Aa(Zt),pr=Qt.findBestMatch(We.current.descriptor),At(pr._distance<.4?"\u8BC6\u522B\u6210\u529F":Yr),Un(pr._distance<.4?1:0),setTimeout(function(){A==null||A({content:pr._distance<.4?"\u8BC6\u522B\u6210\u529F":Yr,success:pr._distance<.4})},1e3),vr.current=!0):(Un(0),At(Yr),setTimeout(function(){A==null||A({content:Yr,success:!1})},1e3)),setTimeout(function(){he.current.pause()},600);case 6:case"end":return wr.stop()}},jt)}));return function(){return dr.apply(this,arguments)}}(),Wn=function(){var dr=Object(x.a)(U.a.mark(function jt(){var Zt,Qt,pr;return U.a.wrap(function(wr){for(;;)switch(wr.prev=wr.next){case 0:if(!((Zt=he.current)!==null&&Zt!==void 0&&Zt.paused||(Qt=he.current)!==null&&Qt!==void 0&&Qt.ended)){wr.next=2;break}return wr.abrupt("return",setTimeout(function(){return Wn()}));case 2:return wr.next=4,Vo(he.current,Rt).withFaceLandmarks().withFaceDescriptor();case 4:pr=wr.sent,Ne.current||(Ne.current=!0,V(!0)),pr&&he.current?(sr(""),Vt(he.current,Ie.current,[pr],kr)):sr("\u8BF7\u5C06\u8138\u90E8\u79FB\u52A8\u81F3\u53D6\u666F\u6846\u5185"),vr.current||setTimeout(function(){return Wn()});case 8:case"end":return wr.stop()}},jt)}));return function(){return dr.apply(this,arguments)}}(),hi=function(){try{var jt=he.current.srcObject,Zt=jt.getTracks();Zt.forEach(function(Qt){Qt.stop()}),Ne.current=!1}catch(Qt){}},gr=function(){yt(!1);try{Ne.current=!1}catch(jt){}},kt=function(jt){Ne.current=!1,vr.current=!1,Te.current.getContext("2d").clearRect(0,0,640,480),At(""),yt(!0);try{ur(jt||!1)}catch(Zt){}},Vt=function(jt,Zt,Qt){var pr=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,Xt=yr(jt,Zt,Qt);pr&&y.drawDetections(Zt,Xt.map(function(wr){return wr.detection}))},yr=function(jt,Zt,Qt){var pr=jt instanceof HTMLVideoElement?Wr(jt):jt,Xt=pr.width,wr=pr.height;return Zt.width=Xt,Zt.height=wr,Oa(Qt,{width:Xt,height:wr})};return T.a.createElement("div",{className:di.a.wrp},T.a.createElement(ke.a,{spinning:it,tip:"\u6B63\u5728\u542F\u52A8\u6444\u50CF\u5934\uFF0C\u8BF7\u7A0D\u540E..."},T.a.createElement("video",{onPlay:Wn,ref:he,id:"inputVideo",autoPlay:!0,muted:!0}),T.a.createElement("canvas",{style:{zIndex:2},ref:Ie}),T.a.createElement("canvas",{ref:Te}),T.a.createElement("div",{className:"c-red mt5 tc",style:{height:22}},Dt," ",Wt)))}),rs=nu,ns=N("2LEM"),os=N.n(ns),as=N("LvDl"),fi=K.a.Countdown,ou=Q.a.Step,dc=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],fc={0:"c-red-ee4",1:"c-green"},au=["\u5355\u9009\u9898","\u591A\u9009\u9898","\u5224\u65AD\u9898","\u586B\u7A7A\u9898","\u7B80\u7B54\u9898","\u5B9E\u8BAD\u9898","\u7F16\u7A0B\u9898"],en=function(w){var A,P=w.globalSetting,V=w.loading,ae=w.user,ge=w.exercise,he=w.dispatch,Te=Object(H.a)(w,["globalSetting","loading","user","exercise","dispatch"]),Ie=Object(te.i)(),Ne=Object(j.useState)(0),We=Object(S.a)(Ne,2),Ge=We[0],Qe=We[1],it=Object(j.useState)(!1),yt=Object(S.a)(it,2),_t=yt[0],Tt=yt[1],Dt=Object(j.useState)(!1),At=Object(S.a)(Dt,2),gt=At[0],Ct=At[1],Wt=Object(j.useState)(!1),sr=Object(S.a)(Wt,2),vr=sr[0],or=sr[1],Gt=Object(j.useState)(0),Ut=Object(S.a)(Gt,2),kr=Ut[0],lr=Ut[1],Xr=Object(j.useState)({}),Yr=Object(S.a)(Xr,2),Rt=Yr[0],tn=Yr[1],ur=Object(j.useRef)(),_r=Object(j.useRef)(!0),Un=[{title:"\u91C7\u96C6\u7167\u7247",content:"First-content"},{title:"\u5BA1\u6838\u7ED3\u679C",content:"Second-content"},{title:"\u5F00\u542F\u624B\u673A\u5F55\u5236",content:"Last-content"}].filter(function(gr){return Rt!=null&&Rt.open_phone_video_recording?!0:gr.content!=="Last-content"}),Rn=function(){var gr=Object(x.a)(U.a.mark(function kt(){return U.a.wrap(function(yr){for(;;)switch(yr.prev=yr.next){case 0:return yr.abrupt("return",new Promise(function(){var dr=Object(x.a)(U.a.mark(function jt(Zt){var Qt;return U.a.wrap(function(Xt){for(;;)switch(Xt.prev=Xt.next){case 0:return Xt.next=2,Object(pe.Q)(Object(I.a)({},Ie));case 2:Qt=Xt.sent,tn(Object(I.a)({},Qt)),Zt(Qt);case 5:case"end":return Xt.stop()}},jt)}));return function(jt){return dr.apply(this,arguments)}}()));case 1:case"end":return yr.stop()}},kt)}));return function(){return gr.apply(this,arguments)}}(),Ko=function(){var gr=Object(x.a)(U.a.mark(function kt(){var Vt,yr;return U.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:return jt.next=2,Rn();case 2:Vt=jt.sent,Vt!=null&&Vt.identity_verify||Qe(2),Vt!=null&&Vt.can_start&&Vt.countdown_time===0?Qe(2):(Vt==null?void 0:Vt.identity_photo_state)==="rejected"?(_r.current=!1,lr(1)):(Vt==null?void 0:Vt.identity_photo_state)==="passed"&&(_r.current=!1,ur==null||((yr=ur.current)===null||yr===void 0)||yr.handleStop(),Rt!=null&&Rt.open_phone_video_recording||Qe(2));case 5:case"end":return jt.stop()}},kt)}));return function(){return gr.apply(this,arguments)}}(),Wn=function(){var gr=Object(x.a)(U.a.mark(function kt(){var Vt,yr;return U.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:return jt.next=2,Rn();case 2:Vt=jt.sent,(Vt==null?void 0:Vt.identity_photo_state)==="submitted"||((Vt==null?void 0:Vt.identity_photo_state)==="rejected"?(_r.current=!1,lr(2)):(Vt==null?void 0:Vt.identity_photo_state)==="passed"&&(_r.current=!1,ur==null||((yr=ur.current)===null||yr===void 0)||yr.handleStop(),lr(1),Rt!=null&&Rt.open_phone_video_recording||Qe(2))),(Vt==null?void 0:Vt.identity_photo_state)!=="passed"&&_r.current&&setTimeout(function(){Wn()},30*1e3);case 5:case"end":return jt.stop()}},kt)}));return function(){return gr.apply(this,arguments)}}(),hi=function(){var kt;Tt(!1),ur==null||((kt=ur.current)===null||kt===void 0)||kt.startDiscern()};return Object(j.useEffect)(function(){return Ko(),console.log("captureRef:",ur),function(){lr(0),or(!1),Ct(!1),Qe(0)}},[]),T.a.createElement("div",{className:"p30 bg-white minHb100 edu-container mt20"},(Rt==null?void 0:Rt.identity_verify)&&T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{className:"tc font16 blod"},"\u8EAB\u4EFD\u9A8C\u8BC1"),T.a.createElement("div",{className:Y.a.steps},T.a.createElement(Q.a,{current:Ge},Un.map(function(gr){return T.a.createElement(ou,{key:gr.title,title:gr.title})})))),T.a.createElement("div",{className:Ge===0?"":"hide"},T.a.createElement("div",{className:"tc mt50"},"\u8BF7\u4FDD\u8BC1\u5468\u56F4\u5149\u7EBF\u5145\u8DB3\uFF0C\u4E94\u5B98\u6E05\u6670\u53EF\u89C1\uFF01"),!gt&&T.a.createElement("div",{className:"tc"},T.a.createElement("img",{width:536,src:os.a,className:"mt30"})),T.a.createElement("div",{className:gt?"":"hide"},T.a.createElement(rs,{ref:ur,onCameraReady:function(kt){Tt(kt)},defaultOpen:Rt==null?void 0:Rt.identity_verify,identity_url:Object(re.i)(ae==null||((A=ae.userInfo)===null||A===void 0)?void 0:A.identity_url),outputResult:function(kt){kt.success?(v.b.success({content:"\u4EBA\u8138\u8BC6\u522B\u6210\u529F",key:"checkapi"}),Qe(2)):or(!0),Tt(!1)}})),gt&&T.a.createElement(T.a.Fragment,null,vr?T.a.createElement("div",{className:"tc mb30 mt15"},T.a.createElement(b.a,{type:"primary",onClick:function(){var kt;ur==null||((kt=ur.current)===null||kt===void 0)||kt.handlePlay(),tn(Object(I.a)({},{})),or(!1)}},"\u91CD\u65B0\u8BC6\u522B"),T.a.createElement(b.a,{type:"primary",className:"ml90",onClick:Object(x.a)(U.a.mark(function gr(){var kt;return U.a.wrap(function(yr){for(;;)switch(yr.prev=yr.next){case 0:return yr.next=2,ur==null||((kt=ur.current)===null||kt===void 0)?void 0:kt.handleUploadImage(0);case 2:_r.current=!0,Qe(1),lr(0),or(!1),Wn();case 7:case"end":return yr.stop()}},gr)}))},"\u4EBA\u5DE5\u5BA1\u6838")):_t&&T.a.createElement("div",{className:"tc mb30 mt15"},T.a.createElement(b.a,{type:"primary",onClick:Object(as.throttle)(hi,2e3)},"\u5F00\u59CB\u8BC6\u522B"))),!gt&&T.a.createElement("div",{className:"tc mb30 mt15"},T.a.createElement(b.a,{type:"primary",onClick:function(){Ct(!0)}},"\u5F00\u59CB\u91C7\u96C6"))),Ge===1&&T.a.createElement("div",{className:"tc"},kr===0&&T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{className:"tc mt50"},T.a.createElement("span",{className:"c-blue font50 iconfont icon-dengdaishenhe"}),T.a.createElement("br",null),"\u4EBA\u5DE5\u5BA1\u6838\u4E2D...",T.a.createElement("br",null),"\u7533\u8BF7\u5DF2\u63D0\u4EA4\uFF0C\u76D1\u63A7\u8001\u5E08\u5BA1\u6838\u4E2D\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85\uFF01"),T.a.createElement(b.a,{type:"primary",className:"mt50",onClick:Object(x.a)(U.a.mark(function gr(){var kt;return U.a.wrap(function(yr){for(;;)switch(yr.prev=yr.next){case 0:return yr.next=2,Rn();case 2:kt=yr.sent,(kt==null?void 0:kt.identity_photo_state)==="submitted"?v.b.warn({content:"\u6B63\u5728\u7B49\u5F85\u8001\u5E08\u5BA1\u6838\u4E2D\uFF0C\u8BF7\u7A0D\u540E...",key:"sh1"}):(kt==null?void 0:kt.identity_photo_state)==="rejected"?(lr(2),_r.current=!1):(kt==null?void 0:kt.identity_photo_state)==="passed"&&(_r.current=!1,lr(1),Rt!=null&&Rt.open_phone_video_recording||Qe(2));case 4:case"end":return yr.stop()}},gr)}))},"\u67E5\u770B\u5BA1\u6838\u7ED3\u679C")),kr===1&&T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{className:"tc mt50"},T.a.createElement("span",{className:"c-green font50 iconfont icon-tongguo"}),T.a.createElement("br",null),"\u8EAB\u4EFD\u9A8C\u8BC1\u5BA1\u6838\u901A\u8FC7\u3002"),(Rt==null?void 0:Rt.open_phone_video_recording)&&T.a.createElement(b.a,{type:"primary",className:"mt50",onClick:function(){return Qe(2)}},"\u4E0B\u4E00\u6B65")),kr===2&&T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{className:"tc mt50"},T.a.createElement("span",{className:"c-red font50 iconfont icon-hongsejingshi"}),T.a.createElement("br",null),"\u8EAB\u4EFD\u9A8C\u8BC1\u5BA1\u6838\u4E0D\u901A\u8FC7\u3002\u8BF7\u91CD\u65B0\u62CD\u7167\u9A8C\u8BC1\u3002"),T.a.createElement("div",{className:"mt20"},T.a.createElement(D.a,null,T.a.createElement(g.a,{className:"tr",flex:"430px"},"\u5931\u8D25\u539F\u56E0\uFF1A"),T.a.createElement(g.a,null,Rt==null?void 0:Rt.identity_photo_comment)),T.a.createElement(D.a,{className:"mt30"},T.a.createElement(g.a,{className:"tr",flex:"430px"},"\u91C7\u96C6\u7167\u7247\uFF1A"),T.a.createElement(g.a,null,T.a.createElement("img",{src:Object(re.i)(Rt==null?void 0:Rt.identity_photo_url),width:200}))),T.a.createElement(D.a,null,T.a.createElement(g.a,{className:"tr",flex:"430px"}),T.a.createElement(g.a,null,T.a.createElement(b.a,{type:"primary",className:"mt50",onClick:function(){var kt;Qe(0),Tt(!1),or(!1),Ct(!1),ur==null||((kt=ur.current)===null||kt===void 0)||kt.handlePlay()}},"\u91CD\u65B0\u8BA4\u8BC1")))))),Ge===2&&T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{className:"tc mt50"},!(Rt!=null&&Rt.open_phone_video_recording)&&T.a.createElement(T.a.Fragment,null,(Rt==null?void 0:Rt.countdown_time)<=0?T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{className:"tc mt50"},T.a.createElement("span",{className:"c-green font50 iconfont icon-tongguo"}),T.a.createElement("br",null),"\u8EAB\u4EFD\u9A8C\u8BC1\u5BA1\u6838\u901A\u8FC7\u3002")):"\u8003\u8BD5\u5373\u5C06\u5F00\u59CB\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..."),(Rt==null?void 0:Rt.open_phone_video_recording)&&T.a.createElement(T.a.Fragment,null,(Rt==null?void 0:Rt.countdown_time)<=0?T.a.createElement("div",{className:"tc"},"\u6839\u636E\u8003\u8BD5\u89C4\u5B9A\uFF0C\u8BF7\u6253\u5F00\u5FAE\u4FE1\u626B\u4E00\u626B\uFF0C\u626B\u7801\u4E0B\u9762\u7684\u4E8C\u7EF4\u7801\u5F00\u542F\u624B\u673A\u5F55\u5236\u89C6\u9891",T.a.createElement("br",null),T.a.createElement("span",{className:"c-blue",style:{cursor:"default"},onClick:function(){F.a.info({icon:null,title:"\u67E5\u770B\u64CD\u4F5C\u6307\u5F15",className:"custom-modal-divider",width:540,content:T.a.createElement(D.a,null,T.a.createElement(g.a,{flex:"178px"},T.a.createElement("img",{width:148,src:"/images/operation_guidance.png"})),T.a.createElement(g.a,{flex:"1"},"\u8BF7\u70B9\u51FB\u53F3\u4E0A\u89D2\u201C\u2026\u201D\uFF0C\u9009\u62E9",T.a.createElement("span",{className:"c-orange"},"Safari\u4E2D\u6253\u5F00"),"\u6216\u8005",T.a.createElement("span",{className:"c-orange"},"\u201C\u5728\u9ED8\u8BA4\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00\u201D"),"\u540E\uFF0C\u6D4F\u89C8\u5668\u6253\u5F00\u540E\u8BF7\u70B9\u51FB\u5F00\u59CB\u5F55\u5236\u6309\u94AE\uFF0C\u53EF\u4EE5\u5F00\u542F\u624B\u673A\u5F55\u5236\u89C6\u9891\u3002"))})}},"\u5982\u82F9\u679C\u624B\u673A\u5FAE\u4FE1\u626B\u63CF\u4E8C\u7EF4\u7801\u540E\uFF0C\u51FA\u73B0\u70B9\u51FB\u5F00\u59CB\u5F55\u5236\u65E0\u54CD\u5E94\uFF0C\u8BF7\u67E5\u770B\u64CD\u4F5C\u6307\u5F15\u3002")):"\u8003\u8BD5\u5373\u5C06\u5F00\u59CB\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85...")),(Rt==null?void 0:Rt.open_phone_video_recording)&&T.a.createElement("div",{className:Y.a.qrcode},T.a.createElement(_e.a,{value:"https://".concat(document.domain,"/live-push.html?id=").concat(Ie.categoryId,"&login=").concat(Ie.login,"&cookie=").concat(Object(re.F)("_educoder_session"))})),(Rt==null?void 0:Rt.countdown_time)>0&&T.a.createElement("div",{className:"tc mt20"},T.a.createElement(fi,{value:Date.now()+(Rt==null?void 0:Rt.countdown_time)*1e3,valueStyle:{color:"#cf1322",fontSize:40},onFinish:function(){Rn()}})),T.a.createElement("div",{className:"tc mb30 mt50"},T.a.createElement(b.a,{type:"primary",onClick:Object(x.a)(U.a.mark(function gr(){var kt,Vt;return U.a.wrap(function(dr){for(;;)switch(dr.prev=dr.next){case 0:return dr.next=2,Rn();case 2:kt=dr.sent,kt!=null&&kt.can_start&&(kt==null?void 0:kt.countdown_time)<=0?(ur==null||((Vt=ur.current)===null||Vt===void 0)||Vt.handleRemove(),Rt!=null&&Rt.open_phone_video_recording?kt!=null&&kt.video_url&&setTimeout(function(){location.href="/classrooms/".concat(Ie.coursesId,"/exercise/").concat(Ie.categoryId,"/users/").concat(Ie.login)},300):setTimeout(function(){location.href="/classrooms/".concat(Ie.coursesId,"/exercise/").concat(Ie.categoryId,"/users/").concat(Ie.login)},300)):(kt==null?void 0:kt.countdown_time)>0?v.b.warn({content:"\u8003\u8BD5\u6682\u672A\u5F00\u59CB\uFF0C\u8BF7\u7A0D\u540E..."}):v.b.warn({content:"\u8BF7\u6253\u5F00\u5FAE\u4FE1\u626B\u4E00\u626B\uFF0C\u5F00\u542F\u624B\u673A\u89C6\u9891\u5F55\u5236"});case 4:case"end":return dr.stop()}},gr)}))},"\u5F00\u59CB\u8003\u8BD5"))))},Kr=G.default=Object(Z.a)(function(O){var w=O.loading,A=O.user,P=O.exercise,V=O.globalSetting;return{globalSetting:V,user:A,exercise:P,loading:w.effects}})(en)},jO9C:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.pad.Iso97971={pad:function(d,F){d.concat(y.lib.WordArray.create([2147483648],1)),y.pad.ZeroPadding.pad(d,F)},unpad:function(d){y.pad.ZeroPadding.unpad(d),d.sigBytes--}},y.pad.Iso97971})},"kVK+":function(l,G){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */G.read=function(N,y,d,F,M){var D,E,g=M*8-F-1,h=(1<<g)-1,b=h>>1,p=-7,v=d?M-1:0,I=d?-1:1,x=N[y+v];for(v+=I,D=x&(1<<-p)-1,x>>=-p,p+=g;p>0;D=D*256+N[y+v],v+=I,p-=8);for(E=D&(1<<-p)-1,D>>=-p,p+=F;p>0;E=E*256+N[y+v],v+=I,p-=8);if(D===0)D=1-b;else{if(D===h)return E?NaN:(x?-1:1)*Infinity;E=E+Math.pow(2,F),D=D-b}return(x?-1:1)*E*Math.pow(2,D-F)},G.write=function(N,y,d,F,M,D){var E,g,h,b=D*8-M-1,p=(1<<b)-1,v=p>>1,I=M===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=F?0:D-1,S=F?1:-1,H=y<0||y===0&&1/y<0?1:0;for(y=Math.abs(y),isNaN(y)||y===Infinity?(g=isNaN(y)?1:0,E=p):(E=Math.floor(Math.log(y)/Math.LN2),y*(h=Math.pow(2,-E))<1&&(E--,h*=2),E+v>=1?y+=I/h:y+=I*Math.pow(2,1-v),y*h>=2&&(E++,h/=2),E+v>=p?(g=0,E=p):E+v>=1?(g=(y*h-1)*Math.pow(2,M),E=E+v):(g=y*Math.pow(2,v-1)*Math.pow(2,M),E=0));M>=8;N[d+x]=g&255,x+=S,g/=256,M-=8);for(E=E<<M|g,b+=M;b>0;N[d+x]=E&255,x+=S,E/=256,b-=8);N[d+x-S]|=H*128}},lPiR:function(l,G,N){(function(y,d){l.exports=G=d(N("Ib8C"))})(this,function(y){return function(d){var F=y,M=F.lib,D=M.WordArray,E=M.Hasher,g=F.algo,h=[],b=[];(function(){function I(B){for(var Q=d.sqrt(B),z=2;z<=Q;z++)if(!(B%z))return!1;return!0}function x(B){return(B-(B|0))*4294967296|0}for(var S=2,H=0;H<64;)I(S)&&(H<8&&(h[H]=x(d.pow(S,1/2))),b[H]=x(d.pow(S,1/3)),H++),S++})();var p=[],v=g.SHA256=E.extend({_doReset:function(){this._hash=new D.init(h.slice(0))},_doProcessBlock:function(I,x){for(var S=this._hash.words,H=S[0],B=S[1],Q=S[2],z=S[3],K=S[4],J=S[5],U=S[6],j=S[7],T=0;T<64;T++){if(T<16)p[T]=I[x+T]|0;else{var te=p[T-15],Z=(te<<25|te>>>7)^(te<<14|te>>>18)^te>>>3,_=p[T-2],Y=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;p[T]=Z+p[T-7]+Y+p[T-16]}var re=K&J^~K&U,pe=H&B^H&Q^B&Q,le=(H<<30|H>>>2)^(H<<19|H>>>13)^(H<<10|H>>>22),_e=(K<<26|K>>>6)^(K<<21|K>>>11)^(K<<7|K>>>25),me=j+_e+re+b[T]+p[T],ke=le+pe;j=U,U=J,J=K,K=z+me|0,z=Q,Q=B,B=H,H=me+ke|0}S[0]=S[0]+H|0,S[1]=S[1]+B|0,S[2]=S[2]+Q|0,S[3]=S[3]+z|0,S[4]=S[4]+K|0,S[5]=S[5]+J|0,S[6]=S[6]+U|0,S[7]=S[7]+j|0},_doFinalize:function(){var I=this._data,x=I.words,S=this._nDataBytes*8,H=I.sigBytes*8;return x[H>>>5]|=128<<24-H%32,x[(H+64>>>9<<4)+14]=d.floor(S/4294967296),x[(H+64>>>9<<4)+15]=S,I.sigBytes=x.length*4,this._process(),this._hash},clone:function(){var I=E.clone.call(this);return I._hash=this._hash.clone(),I}});F.SHA256=E._createHelper(v),F.HmacSHA256=E._createHmacHelper(v)}(Math),y.SHA256})},mrSG:function(l,G,N){"use strict";N.d(G,"c",function(){return d}),N.d(G,"a",function(){return F}),N.d(G,"b",function(){return h}),N.d(G,"d",function(){return b}),N.d(G,"e",function(){return H});/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var y=function(_,Y){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(re,pe){re.__proto__=pe}||function(re,pe){for(var le in pe)pe.hasOwnProperty(le)&&(re[le]=pe[le])},y(_,Y)};function d(Z,_){y(Z,_);function Y(){this.constructor=Z}Z.prototype=_===null?Object.create(_):(Y.prototype=_.prototype,new Y)}var F=function(){return F=Object.assign||function(Y){for(var re,pe=1,le=arguments.length;pe<le;pe++){re=arguments[pe];for(var _e in re)Object.prototype.hasOwnProperty.call(re,_e)&&(Y[_e]=re[_e])}return Y},F.apply(this,arguments)};function M(Z,_){var Y={};for(var re in Z)Object.prototype.hasOwnProperty.call(Z,re)&&_.indexOf(re)<0&&(Y[re]=Z[re]);if(Z!=null&&typeof Object.getOwnPropertySymbols=="function")for(var pe=0,re=Object.getOwnPropertySymbols(Z);pe<re.length;pe++)_.indexOf(re[pe])<0&&Object.prototype.propertyIsEnumerable.call(Z,re[pe])&&(Y[re[pe]]=Z[re[pe]]);return Y}function D(Z,_,Y,re){var pe=arguments.length,le=pe<3?_:re===null?re=Object.getOwnPropertyDescriptor(_,Y):re,_e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")le=Reflect.decorate(Z,_,Y,re);else for(var me=Z.length-1;me>=0;me--)(_e=Z[me])&&(le=(pe<3?_e(le):pe>3?_e(_,Y,le):_e(_,Y))||le);return pe>3&&le&&Object.defineProperty(_,Y,le),le}function E(Z,_){return function(Y,re){_(Y,re,Z)}}function g(Z,_){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(Z,_)}function h(Z,_,Y,re){function pe(le){return le instanceof Y?le:new Y(function(_e){_e(le)})}return new(Y||(Y=Promise))(function(le,_e){function me(ne){try{$(re.next(ne))}catch(W){_e(W)}}function ke(ne){try{$(re.throw(ne))}catch(W){_e(W)}}function $(ne){ne.done?le(ne.value):pe(ne.value).then(me,ke)}$((re=re.apply(Z,_||[])).next())})}function b(Z,_){var Y={label:0,sent:function(){if(le[0]&1)throw le[1];return le[1]},trys:[],ops:[]},re,pe,le,_e;return _e={next:me(0),throw:me(1),return:me(2)},typeof Symbol=="function"&&(_e[Symbol.iterator]=function(){return this}),_e;function me($){return function(ne){return ke([$,ne])}}function ke($){if(re)throw new TypeError("Generator is already executing.");for(;Y;)try{if(re=1,pe&&(le=$[0]&2?pe.return:$[0]?pe.throw||((le=pe.return)&&le.call(pe),0):pe.next)&&!(le=le.call(pe,$[1])).done)return le;(pe=0,le)&&($=[$[0]&2,le.value]);switch($[0]){case 0:case 1:le=$;break;case 4:return Y.label++,{value:$[1],done:!1};case 5:Y.label++,pe=$[1],$=[0];continue;case 7:$=Y.ops.pop(),Y.trys.pop();continue;default:if(!(le=Y.trys,le=le.length>0&&le[le.length-1])&&($[0]===6||$[0]===2)){Y=0;continue}if($[0]===3&&(!le||$[1]>le[0]&&$[1]<le[3])){Y.label=$[1];break}if($[0]===6&&Y.label<le[1]){Y.label=le[1],le=$;break}if(le&&Y.label<le[2]){Y.label=le[2],Y.ops.push($);break}le[2]&&Y.ops.pop(),Y.trys.pop();continue}$=_.call(Z,Y)}catch(ne){$=[6,ne],pe=0}finally{re=le=0}if($[0]&5)throw $[1];return{value:$[0]?$[1]:void 0,done:!0}}}function p(Z,_,Y,re){re===void 0&&(re=Y),Z[re]=_[Y]}function v(Z,_){for(var Y in Z)Y!=="default"&&!_.hasOwnProperty(Y)&&(_[Y]=Z[Y])}function I(Z){var _=typeof Symbol=="function"&&Symbol.iterator,Y=_&&Z[_],re=0;if(Y)return Y.call(Z);if(Z&&typeof Z.length=="number")return{next:function(){return Z&&re>=Z.length&&(Z=void 0),{value:Z&&Z[re++],done:!Z}}};throw new TypeError(_?"Object is not iterable.":"Symbol.iterator is not defined.")}function x(Z,_){var Y=typeof Symbol=="function"&&Z[Symbol.iterator];if(!Y)return Z;var re=Y.call(Z),pe,le=[],_e;try{for(;(_===void 0||_-- >0)&&!(pe=re.next()).done;)le.push(pe.value)}catch(me){_e={error:me}}finally{try{pe&&!pe.done&&(Y=re.return)&&Y.call(re)}finally{if(_e)throw _e.error}}return le}function S(){for(var Z=[],_=0;_<arguments.length;_++)Z=Z.concat(x(arguments[_]));return Z}function H(){for(var Z=0,_=0,Y=arguments.length;_<Y;_++)Z+=arguments[_].length;for(var re=Array(Z),pe=0,_=0;_<Y;_++)for(var le=arguments[_],_e=0,me=le.length;_e<me;_e++,pe++)re[pe]=le[_e];return re}function B(Z){return this instanceof B?(this.v=Z,this):new B(Z)}function Q(Z,_,Y){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var re=Y.apply(Z,_||[]),pe,le=[];return pe={},_e("next"),_e("throw"),_e("return"),pe[Symbol.asyncIterator]=function(){return this},pe;function _e(ie){re[ie]&&(pe[ie]=function(de){return new Promise(function(ee,Ce){le.push([ie,de,ee,Ce])>1||me(ie,de)})})}function me(ie,de){try{ke(re[ie](de))}catch(ee){W(le[0][3],ee)}}function ke(ie){ie.value instanceof B?Promise.resolve(ie.value.v).then($,ne):W(le[0][2],ie)}function $(ie){me("next",ie)}function ne(ie){me("throw",ie)}function W(ie,de){(ie(de),le.shift(),le.length)&&me(le[0][0],le[0][1])}}function z(Z){var _,Y;return _={},re("next"),re("throw",function(pe){throw pe}),re("return"),_[Symbol.iterator]=function(){return this},_;function re(pe,le){_[pe]=Z[pe]?function(_e){return(Y=!Y)?{value:B(Z[pe](_e)),done:pe==="return"}:le?le(_e):_e}:le}}function K(Z){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var _=Z[Symbol.asyncIterator],Y;return _?_.call(Z):(Z=typeof I=="function"?I(Z):Z[Symbol.iterator](),Y={},re("next"),re("throw"),re("return"),Y[Symbol.asyncIterator]=function(){return this},Y);function re(le){Y[le]=Z[le]&&function(_e){return new Promise(function(me,ke){_e=Z[le](_e),pe(me,ke,_e.done,_e.value)})}}function pe(le,_e,me,ke){Promise.resolve(ke).then(function($){le({value:$,done:me})},_e)}}function J(Z,_){return Object.defineProperty?Object.defineProperty(Z,"raw",{value:_}):Z.raw=_,Z}function U(Z){if(Z&&Z.__esModule)return Z;var _={};if(Z!=null)for(var Y in Z)Object.hasOwnProperty.call(Z,Y)&&(_[Y]=Z[Y]);return _.default=Z,_}function j(Z){return Z&&Z.__esModule?Z:{default:Z}}function T(Z,_){if(!_.has(Z))throw new TypeError("attempted to get private field on non-instance");return _.get(Z)}function te(Z,_,Y){if(!_.has(Z))throw new TypeError("attempted to set private field on non-instance");return _.set(Z,Y),Y}},mxV5:function(module,exports,__webpack_require__){(function(global){var require,require;(function(l){if(!0)module.exports=l();else var G})(function(){var define,module,exports;return function(){function l(G,N,y){function d(D,E){if(!N[D]){if(!G[D]){var g=typeof require=="function"&&require;if(!E&&g)return require(D,!0);if(F)return F(D,!0);var h=new Error("Cannot find module '"+D+"'");throw h.code="MODULE_NOT_FOUND",h}var b=N[D]={exports:{}};G[D][0].call(b.exports,function(p){var v=G[D][1][p];return d(v||p)},b,b.exports,l,G,N,y)}return N[D].exports}for(var F=typeof require=="function"&&require,M=0;M<y.length;M++)d(y[M]);return d}return l}()({1:[function(l,G,N){"use strict";var y=l("./browser/client");y.Buffer=l("buffer").Buffer,y.urllib=l("../shims/xhr"),y.version=l("./browser/version").version,G.exports=y},{"../shims/xhr":291,"./browser/client":2,"./browser/version":5,buffer:73}],2:[function(l,G,N){(function(y,d){"use strict";var F=l("babel-runtime/core-js/promise"),M=b(F),D=l("babel-runtime/regenerator"),E=b(D),g=l("babel-runtime/core-js/object/assign"),h=b(g);function b(ke){return ke&&ke.__esModule?ke:{default:ke}}var p=l("debug")("ali-oss"),v=l("copy-to"),I=l("xml2js"),x=l("agentkeepalive"),S=l("merge-descriptors"),H=l("url"),B=l("is-type-of"),Q=l("platform"),z=l("utility"),K=l("urllib"),J=l("./version"),U=l("bowser"),j=l("../common/signUtils"),T=l("../common/utils/isIP"),te=T.isIP,Z=l("../common/client/initOptions"),_=l("../common/utils/createRequest"),Y=_.createRequest,re=new x;function pe(){var ke=Q.name,$=Q.version;ke&&ke.toLowerCase&&ke.toLowerCase()==="ie"&&$.split(".")[0]<10&&console.warn("ali-oss does not support the current browser")}function le(){return location&&location.protocol==="https:"}function _e(ke,$){if(pe(),!(this instanceof _e))return new _e(ke,$);ke&&ke.inited?this.options=ke:this.options=_e.initOptions(ke),this.options.cancelFlag=!1,this.options.urllib?this.urllib=this.options.urllib:(this.urllib=K,this.agent=this.options.agent||re),this.ctx=$,this.userAgent=this._getUserAgent(),this.options.amendTimeSkewed=0}G.exports=_e,_e.initOptions=function($){$.stsToken||console.warn("Please use STS Token for safety, see more details at https://help.aliyun.com/document_detail/32077.html");var ne=(0,h.default)({secure:le(),useFetch:!1},$);return Z(ne)};var me=_e.prototype;me.debug=p,S(me,l("./object")),S(me,l("../common/bucket/getBucketWebsite")),S(me,l("../common/bucket/putBucketWebsite")),S(me,l("../common/bucket/deleteBucketWebsite")),S(me,l("../common/bucket/getBucketLifecycle")),S(me,l("../common/bucket/putBucketLifecycle")),S(me,l("../common/bucket/deleteBucketLifecycle")),S(me,l("../common/bucket/putBucketVersioning")),S(me,l("../common/bucket/getBucketVersioning")),S(me,l("./managed-upload")),S(me,l("../common/multipart")),S(me,l("../common/parallel")),me.signature=function($){return this.debug("authorization stringToSign: %s",$,"info"),j.computeSignature(this.options.accessKeySecret,$)},me.authorization=function($,ne,W,ie){var de=j.buildCanonicalString($.toUpperCase(),ne,{headers:ie,parameters:W});return j.authorization(this.options.accessKeyId,this.options.accessKeySecret,de)},me.request=function($){var ne,W,ie,de,ee,Ce;return E.default.async(function(Le){for(;;)switch(Le.prev=Le.next){case 0:return ne=Y.call(this,$),this.options.useFetch||(ne.params.mode="disable-fetch"),W=void 0,ie=void 0,de=!!$.stream,Le.prev=5,Le.next=8,E.default.awrap(this.urllib.request(ne.url,ne.params));case 8:W=Le.sent,this.debug("response %s %s, got %s, headers: %j",$.method,ne.url,W.status,W.headers,"info"),Le.next=15;break;case 12:Le.prev=12,Le.t0=Le.catch(5),ie=Le.t0;case 15:if(ee=void 0,!(W&&$.successStatuses&&$.successStatuses.indexOf(W.status)===-1)){Le.next=28;break}return Le.next=19,E.default.awrap(this.requestError(W));case 19:if(ee=Le.sent,!(ee.code==="RequestTimeTooSkewed"&&!de)){Le.next=25;break}return this.options.amendTimeSkewed=+new Date(ee.serverTime)-new Date,Le.next=24,E.default.awrap(this.request($));case 24:return Le.abrupt("return",Le.sent);case 25:ee.params=$,Le.next=32;break;case 28:if(!ie){Le.next=32;break}return Le.next=31,E.default.awrap(this.requestError(ie));case 31:ee=Le.sent;case 32:if(!ee){Le.next=34;break}throw ee;case 34:if(!$.xmlResponse){Le.next=39;break}return Le.next=37,E.default.awrap(this.parseXML(W.data));case 37:Ce=Le.sent,W.data=Ce;case 39:return Le.abrupt("return",W);case 40:case"end":return Le.stop()}},null,this,[[5,12]])},me._getResource=function($){var ne="/";return $.bucket&&(ne+=$.bucket+"/"),$.object&&(ne+=$.object),ne},me._isIP=te,me._escape=function($){return z.encodeURIComponent($).replace(/%2F/g,"/")},me._getReqUrl=function($){var ne={};v(this.options.endpoint).to(ne);var W=this._isIP(ne.hostname),ie=this.options.cname;$.bucket&&!ie&&!W&&(ne.host=$.bucket+"."+ne.host);var de="/";$.bucket&&W&&(de+=$.bucket+"/"),$.object&&(de+=this._escape($.object).replace(/\+/g,"%2B")),ne.pathname=de;var ee={};if($.query&&S(ee,$.query),$.subres){var Ce={};B.string($.subres)?Ce[$.subres]="":B.array($.subres)?$.subres.forEach(function(De){Ce[De]=""}):Ce=$.subres,S(ee,Ce)}return ne.query=ee,H.format(ne)},me._getUserAgent=function(){var $=d&&d.browser?"js":"nodejs",ne="aliyun-sdk-"+$+"/"+J.version,W=Q.description;return!W&&d&&(W="Node.js "+d.version.slice(1)+" on "+d.platform+" "+d.arch),this._checkUserAgent(ne+" "+W)},me._checkUserAgent=function($){var ne=$.replace(/\u03b1/,"alpha").replace(/\u03b2/,"beta");return ne},me.checkBrowserAndVersion=function($,ne){return U.name===$&&U.version.split(".")[0]===ne},me.parseXML=function($){return new M.default(function(ne,W){y.isBuffer($)&&($=$.toString()),I.parseString($,{explicitRoot:!1,explicitArray:!1},function(ie,de){ie?W(ie):ne(de)})})},me.requestError=function($){var ne,W,ie,de;return E.default.async(function(Ce){for(;;)switch(Ce.prev=Ce.next){case 0:if(ne=null,!(!$.data||!$.data.length)){Ce.next=5;break}$.status===-1||$.status===-2?(ne=new Error($.message),ne.name=$.name,ne.status=$.status,ne.code=$.name):($.status===404?(ne=new Error("Object not exists"),ne.name="NoSuchKeyError",ne.status=404,ne.code="NoSuchKey"):$.status===412?(ne=new Error("Pre condition failed"),ne.name="PreconditionFailedError",ne.status=412,ne.code="PreconditionFailed"):(ne=new Error("Unknow error, status: "+$.status),ne.name="UnknowError",ne.status=$.status),ne.requestId=$.headers["x-oss-request-id"],ne.host=""),Ce.next=33;break;case 5:return W=String($.data),this.debug("request response error data: %s",W,"error"),ie=void 0,Ce.prev=8,Ce.next=11,E.default.awrap(this.parseXML(W));case 11:if(Ce.t0=Ce.sent,Ce.t0){Ce.next=14;break}Ce.t0={};case 14:ie=Ce.t0,Ce.next=24;break;case 17:return Ce.prev=17,Ce.t1=Ce.catch(8),this.debug(W,"error"),Ce.t1.message+=`
raw xml: `+W,Ce.t1.status=$.status,Ce.t1.requestId=$.headers["x-oss-request-id"],Ce.abrupt("return",Ce.t1);case 24:de=ie.Message||"unknow request error, status: "+$.status,ie.Condition&&(de+=" (condition: "+ie.Condition+")"),ne=new Error(de),ne.name=ie.Code?ie.Code+"Error":"UnknowError",ne.status=$.status,ne.code=ie.Code,ne.requestId=ie.RequestId,ne.hostId=ie.HostId,ne.serverTime=ie.ServerTime;case 33:return this.debug("generate error %j",ne,"error"),Ce.abrupt("return",ne);case 35:case"end":return Ce.stop()}},null,this,[[8,17]])}}).call(this,{isBuffer:l("../../node_modules/is-buffer/index.js")},l("_process"))},{"../../node_modules/is-buffer/index.js":197,"../common/bucket/deleteBucketLifecycle":6,"../common/bucket/deleteBucketWebsite":7,"../common/bucket/getBucketLifecycle":8,"../common/bucket/getBucketVersioning":9,"../common/bucket/getBucketWebsite":10,"../common/bucket/putBucketLifecycle":11,"../common/bucket/putBucketVersioning":12,"../common/bucket/putBucketWebsite":13,"../common/client/initOptions":15,"../common/multipart":18,"../common/parallel":33,"../common/signUtils":34,"../common/utils/createRequest":38,"../common/utils/isIP":45,"./managed-upload":3,"./object":4,"./version":5,_process:208,agentkeepalive:48,"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/promise":61,"babel-runtime/regenerator":68,bowser:70,"copy-to":76,debug:288,"is-type-of":289,"merge-descriptors":200,platform:206,url:238,urllib:291,utility:290,xml2js:249}],3:[function(l,G,N){(function(y){"use strict";var d=l("babel-runtime/core-js/array/from"),F=h(d),M=l("babel-runtime/core-js/promise"),D=h(M),E=l("babel-runtime/regenerator"),g=h(E);function h(j){return j&&j.__esModule?j:{default:j}}var b=l("is-type-of"),p=l("util"),v=l("path"),I=l("mime"),x=l("copy-to"),S=l("../common/utils/isBlob"),H=S.isBlob,B=l("../common/utils/isFile"),Q=B.isFile,z=N;z.multipartUpload=function(T,te,Z){var _,Y,re,pe,le,_e,me,ke,$;return g.default.async(function(W){for(;;)switch(W.prev=W.next){case 0:if(this.resetCancelFlag(),Z=Z||{},!(Z.checkpoint&&Z.checkpoint.uploadId)){W.next=6;break}return W.next=5,g.default.awrap(this._resumeMultipart(Z.checkpoint,Z));case 5:return W.abrupt("return",W.sent);case 6:return _=100*1024,Z.mime||(Q(te)?Z.mime=I.getType(v.extname(te.name)):H(te)?Z.mime=te.type:Z.mime=I.getType(v.extname(te))),Z.headers=Z.headers||{},this._convertMetaToHeaders(Z.meta,Z.headers),W.next=12,g.default.awrap(this._getFileSize(te));case 12:if(Y=W.sent,!(Y<_)){W.next=25;break}return re=this._createStream(te,0,Y),Z.contentLength=Y,W.next=18,g.default.awrap(this.putStream(T,re,Z));case 18:if(pe=W.sent,!(Z&&Z.progress)){W.next=22;break}return W.next=22,g.default.awrap(Z.progress(1));case 22:return le={res:pe.res,bucket:this.options.bucket,name:T,etag:pe.res.headers.etag},(Z.headers&&Z.headers["x-oss-callback"]||Z.callback)&&(le.data=pe.data),W.abrupt("return",le);case 25:if(!(Z.partSize&&!(parseInt(Z.partSize,10)===Z.partSize))){W.next=27;break}throw new Error("partSize must be int number");case 27:if(!(Z.partSize&&Z.partSize<_)){W.next=29;break}throw new Error("partSize must not be smaller than "+_);case 29:return W.next=31,g.default.awrap(this.initMultipartUpload(T,Z));case 31:if(_e=W.sent,me=_e.uploadId,ke=this._getPartSize(Y,Z.partSize),$={file:te,name:T,fileSize:Y,partSize:ke,uploadId:me,doneParts:[]},!(Z&&Z.progress)){W.next=38;break}return W.next=38,g.default.awrap(Z.progress(0,$,_e.res));case 38:return W.next=40,g.default.awrap(this._resumeMultipart($,Z));case 40:return W.abrupt("return",W.sent);case 41:case"end":return W.stop()}},null,this)},z._resumeMultipart=function(T,te){var Z,_,Y,re,pe,le,_e,me,ke,$,ne,W,ie,de,ee,Ce,De,Le;return g.default.async(function(et){for(;;)switch(et.prev=et.next){case 0:if(Z=this,!this.isCancel()){et.next=3;break}throw this._makeCancelEvent();case 3:return _=T.file,Y=T.fileSize,re=T.partSize,pe=T.uploadId,le=T.doneParts,_e=T.name,me=[],le.length>0&&x(le).to(me),ke=this._divideParts(Y,re),$=ke.length,ne=!1,W=function(ct,$e){var Fe=this;return new D.default(function(He,ot){var ye,be,Ke,q;return g.default.async(function(c){for(;;)switch(c.prev=c.next){case 0:if(c.prev=0,ct.isCancel()){c.next=18;break}return ye=ke[$e-1],be={stream:ct._createStream(_,ye.start,ye.end),size:ye.end-ye.start},c.next=6,g.default.awrap(ct._uploadPart(_e,pe,$e,be));case 6:if(Ke=c.sent,!(!ct.isCancel()&&!ne)){c.next=15;break}if(T.doneParts.push({number:$e,etag:Ke.res.headers.etag}),!te.progress){c.next=12;break}return c.next=12,g.default.awrap(te.progress(le.length/$,T,Ke.res));case 12:He({number:$e,etag:Ke.res.headers.etag}),c.next=16;break;case 15:He();case 16:c.next=19;break;case 18:He();case 19:c.next=30;break;case 21:c.prev=21,c.t0=c.catch(0),q=new Error,q.name=c.t0.name,q.message=c.t0.message,q.stack=c.t0.stack,q.partNum=$e,x(c.t0).to(q),ot(q);case 30:case"end":return c.stop()}},null,Fe,[[0,21]])})},ie=(0,F.default)(new Array($),function(Ae,ct){return ct+1}),de=me.map(function(Ae){return Ae.number}),ee=ie.filter(function(Ae){return de.indexOf(Ae)<0}),Ce=5,De=te.parallel||Ce,et.next=17,g.default.awrap(this._parallel(ee,De,function(Ae){return new D.default(function(ct,$e){W(Z,Ae).then(function(Fe){Fe&&me.push(Fe),ct()}).catch(function(Fe){$e(Fe)})})}));case 17:if(Le=et.sent,ne=!0,!this.isCancel()){et.next=22;break}throw W=null,this._makeCancelEvent();case 22:if(!(Le&&Le.length>0)){et.next=25;break}throw Le[0].message="Failed to upload some parts with error: "+Le[0].toString()+" part_num: "+Le[0].partNum,Le[0];case 25:return et.next=27,g.default.awrap(this.completeMultipartUpload(_e,pe,me,te));case 27:return et.abrupt("return",et.sent);case 28:case"end":return et.stop()}},null,this)},z._getFileSize=function(T){return g.default.async(function(Z){for(;;)switch(Z.prev=Z.next){case 0:if(!b.buffer(T)){Z.next=4;break}return Z.abrupt("return",T.length);case 4:if(!(H(T)||Q(T))){Z.next=6;break}return Z.abrupt("return",T.size);case 6:throw new Error("_getFileSize requires Buffer/File/Blob.");case 7:case"end":return Z.stop()}},null,this)};var K=l("stream"),J=K.Readable;function U(j,T){if(!(this instanceof U))return new U(j,T);J.call(this,T),this.file=j,this.reader=new FileReader,this.start=0,this.finish=!1,this.fileBuffer=null}p.inherits(U,J),U.prototype.readFileAndPush=function(T){if(this.fileBuffer)for(var te=!0;te&&this.fileBuffer&&this.start<this.fileBuffer.length;){var Z=this.start,_=Z+T;_=_>this.fileBuffer.length?this.fileBuffer.length:_,this.start=_,te=this.push(this.fileBuffer.slice(Z,_))}},U.prototype._read=function(T){if(this.file&&this.start>=this.file.size||this.fileBuffer&&this.start>=this.fileBuffer.length||this.finish||this.start===0&&!this.file){this.finish||(this.fileBuffer=null,this.finish=!0),this.push(null);return}var te=16*1024;T=T||te;var Z=this;this.reader.onload=function(Y){Z.fileBuffer=y.from(new Uint8Array(Y.target.result)),Z.file=null,Z.readFileAndPush(T)},this.start===0?this.reader.readAsArrayBuffer(this.file):this.readFileAndPush(T)},z._createStream=function(T,te,Z){if(H(T)||Q(T))return new U(T.slice(te,Z));throw new Error("_createStream requires File/Blob.")},z._getPartSize=function(T,te){var Z=10*1e3,_=1024*1024;return te?Math.max(Math.ceil(T/Z),te):_},z._divideParts=function(T,te){for(var Z=Math.ceil(T/te),_=[],Y=0;Y<Z;Y++){var re=te*Y,pe=Math.min(re+te,T);_.push({start:re,end:pe})}return _}}).call(this,l("buffer").Buffer)},{"../common/utils/isBlob":43,"../common/utils/isFile":44,"babel-runtime/core-js/array/from":52,"babel-runtime/core-js/promise":61,"babel-runtime/regenerator":68,buffer:73,"copy-to":76,"is-type-of":289,mime:202,path:205,stream:230,util:243}],4:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/promise"),d=b(y),F=l("babel-runtime/core-js/object/keys"),M=b(F),D=l("babel-runtime/core-js/object/assign"),E=b(D),g=l("babel-runtime/regenerator"),h=b(g);function b(Z){return Z&&Z.__esModule?Z:{default:Z}}var p=l("utility"),v=l("fs"),I=l("is-type-of"),x=l("url"),S=l("copy-to"),H=l("path"),B=l("mime"),Q=l("../common/callback"),z=l("../common/signUtils"),K=l("merge-descriptors"),J=l("../common/utils/isBlob"),U=J.isBlob,j=l("../common/utils/isFile"),T=j.isFile,te=N;te.append=function(_,Y,re){var pe;return h.default.async(function(_e){for(;;)switch(_e.prev=_e.next){case 0:return re=re||{},re.position===void 0&&(re.position="0"),re.subres={append:"",position:re.position},re.method="POST",_e.next=6,h.default.awrap(this.put(_,Y,re));case 6:return pe=_e.sent,pe.nextAppendPosition=pe.res.headers["x-oss-next-append-position"],_e.abrupt("return",pe);case 9:case"end":return _e.stop()}},null,this)},te.put=function(_,Y,re){var pe,le,_e,me,ke,$,ne;return h.default.async(function(ie){for(;;)switch(ie.prev=ie.next){case 0:if(pe=void 0,re=re||{},_=this._objectName(_),!I.buffer(Y)){ie.next=7;break}pe=Y,ie.next=33;break;case 7:if(!(U(Y)||T(Y))){ie.next=32;break}return re.mime||(T(Y)?re.mime=B.getType(H.extname(Y.name)):re.mime=Y.type),le=this._createStream(Y,0,Y.size),ie.next=12,h.default.awrap(this._getFileSize(Y));case 12:return re.contentLength=ie.sent,ie.prev=13,ie.next=16,h.default.awrap(this.putStream(_,le,re));case 16:return _e=ie.sent,ie.abrupt("return",_e);case 20:if(ie.prev=20,ie.t0=ie.catch(13),!(ie.t0.code==="RequestTimeTooSkewed")){ie.next=29;break}return this.options.amendTimeSkewed=+new Date(ie.t0.serverTime)-new Date,ie.next=26,h.default.awrap(this.put(_,Y,re));case 26:return ie.abrupt("return",ie.sent);case 29:throw ie.t0;case 30:ie.next=33;break;case 32:throw new TypeError("Must provide Buffer/Blob/File for put.");case 33:return re.headers=re.headers||{},this._convertMetaToHeaders(re.meta,re.headers),me=re.method||"PUT",ke=this._objectRequestParams(me,_,re),Q.encodeCallback(ke,re),ke.mime=re.mime,ke.content=pe,ke.successStatuses=[200],ie.next=43,h.default.awrap(this.request(ke));case 43:return $=ie.sent,ne={name:_,url:this._objectUrl(_),res:$.res},ke.headers&&ke.headers["x-oss-callback"]&&(ne.data=JSON.parse($.data.toString())),ie.abrupt("return",ne);case 47:case"end":return ie.stop()}},null,this,[[13,20]])},te.putStream=function(_,Y,re){var pe,le,_e,me;return h.default.async(function($){for(;;)switch($.prev=$.next){case 0:return re=re||{},re.headers=re.headers||{},_=this._objectName(_),re.contentLength?re.headers["Content-Length"]=re.contentLength:re.headers["Transfer-Encoding"]="chunked",this._convertMetaToHeaders(re.meta,re.headers),pe=re.method||"PUT",le=this._objectRequestParams(pe,_,re),Q.encodeCallback(le,re),le.mime=re.mime,le.stream=Y,le.successStatuses=[200],$.next=13,h.default.awrap(this.request(le));case 13:return _e=$.sent,me={name:_,url:this._objectUrl(_),res:_e.res},le.headers&&le.headers["x-oss-callback"]&&(me.data=JSON.parse(_e.data.toString())),$.abrupt("return",me);case 17:case"end":return $.stop()}},null,this)},K(te,l("../common/object/copyObject")),K(te,l("../common/object/getObjectTagging")),K(te,l("../common/object/putObjectTagging")),K(te,l("../common/object/deleteObjectTagging")),K(te,l("../common/image")),K(te,l("../common/object/getBucketVersions")),K(te,l("../common/object/getACL")),K(te,l("../common/object/putACL")),K(te,l("../common/object/head")),K(te,l("../common/object/delete")),K(te,l("../common/object/get")),K(te,l("../common/object/putSymlink")),K(te,l("../common/object/getSymlink")),K(te,l("../common/object/deleteMulti")),K(te,l("../common/object/getObjectMeta")),te.putMeta=function(_,Y,re){var pe;return h.default.async(function(_e){for(;;)switch(_e.prev=_e.next){case 0:return _e.next=2,h.default.awrap(this.copy(_,_,{meta:Y||{},timeout:re&&re.timeout,ctx:re&&re.ctx}));case 2:return pe=_e.sent,_e.abrupt("return",pe);case 4:case"end":return _e.stop()}},null,this)},te.list=function(_,Y){var re,pe,le,_e,me;return h.default.async(function($){for(;;)switch($.prev=$.next){case 0:return re=this._objectRequestParams("GET","",Y),re.query=_,re.xmlResponse=!0,re.successStatuses=[200],$.next=6,h.default.awrap(this.request(re));case 6:return pe=$.sent,le=pe.data.Contents,_e=this,le&&(Array.isArray(le)||(le=[le]),le=le.map(function(ne){return{name:ne.Key,url:_e._objectUrl(ne.Key),lastModified:ne.LastModified,etag:ne.ETag,type:ne.Type,size:Number(ne.Size),storageClass:ne.StorageClass,owner:{id:ne.Owner.ID,displayName:ne.Owner.DisplayName}}})),me=pe.data.CommonPrefixes||null,me&&(Array.isArray(me)||(me=[me]),me=me.map(function(ne){return ne.Prefix})),$.abrupt("return",{res:pe.res,objects:le,prefixes:me,nextMarker:pe.data.NextMarker||null,isTruncated:pe.data.IsTruncated==="true"});case 13:case"end":return $.stop()}},null,this)},te.restore=function(_,Y){var re,pe;return h.default.async(function(_e){for(;;)switch(_e.prev=_e.next){case 0:return Y=Y||{},Y.subres=(0,E.default)({restore:""},Y.subres),Y.versionId&&(Y.subres.versionId=Y.versionId),re=this._objectRequestParams("POST",_,Y),re.successStatuses=[202],_e.next=7,h.default.awrap(this.request(re));case 7:return pe=_e.sent,_e.abrupt("return",{res:pe.res});case 9:case"end":return _e.stop()}},null,this)},te.signatureUrl=function(_,Y){Y=Y||{},_=this._objectName(_),Y.method=Y.method||"GET";var re=p.timestamp()+(Y.expires||1800),pe={bucket:this.options.bucket,object:_},le=this._getResource(pe);this.options.stsToken&&(Y["security-token"]=this.options.stsToken);var _e=z._signatureForURL(this.options.accessKeySecret,Y,le,re),me=x.parse(this._getReqUrl(pe));return me.query={OSSAccessKeyId:this.options.accessKeyId,Expires:re,Signature:_e.Signature},S(_e.subResource).to(me.query),me.format()},te.getObjectUrl=function(_,Y){return Y?Y[Y.length-1]!=="/"&&(Y+="/"):Y=this.options.endpoint.format(),Y+this._escape(this._objectName(_))},te._objectUrl=function(_){return this._getReqUrl({bucket:this.options.bucket,object:_})},te.generateObjectUrl=function(Z,_){if(_)_[_.length-1]!=="/"&&(_+="/");else{_=this.options.endpoint.format();var Y=x.parse(_),re=this.options.bucket;Y.hostname=re+"."+Y.hostname,Y.host=re+"."+Y.host,_=Y.format()}return _+this._escape(this._objectName(Z))},te._objectRequestParams=function(_,Y,re){if(!this.options.bucket)throw new Error("Please create a bucket first");re=re||{},Y=this._objectName(Y);var pe={object:Y,bucket:this.options.bucket,method:_,subres:re&&re.subres,timeout:re&&re.timeout,ctx:re&&re.ctx};return re.headers&&(pe.headers={},S(re.headers).to(pe.headers)),pe},te._objectName=function(_){return _.replace(/^\/+/,"")},te._convertMetaToHeaders=function(_,Y){if(!_)return;(0,M.default)(_).forEach(function(re){Y["x-oss-meta-"+re]=_[re]})},te._deleteFileSafe=function(_){var Y=this;return new d.default(function(re){v.exists(_,function(pe){pe?v.unlink(_,function(le){le&&Y.debug("unlink %j error: %s",_,le,"error"),re()}):re()})})}},{"../common/callback":14,"../common/image":16,"../common/object/copyObject":19,"../common/object/delete":20,"../common/object/deleteMulti":21,"../common/object/deleteObjectTagging":22,"../common/object/get":23,"../common/object/getACL":24,"../common/object/getBucketVersions":25,"../common/object/getObjectMeta":26,"../common/object/getObjectTagging":27,"../common/object/getSymlink":28,"../common/object/head":29,"../common/object/putACL":30,"../common/object/putObjectTagging":31,"../common/object/putSymlink":32,"../common/signUtils":34,"../common/utils/isBlob":43,"../common/utils/isFile":44,"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/object/keys":60,"babel-runtime/core-js/promise":61,"babel-runtime/regenerator":68,"copy-to":76,fs:71,"is-type-of":289,"merge-descriptors":200,mime:202,path:205,url:238,utility:290}],5:[function(l,G,N){"use strict";N.version="6.10.0"},{}],6:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(g){return g&&g.__esModule?g:{default:g}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=N;E.deleteBucketLifecycle=function(h,b){var p,v;return d.default.async(function(x){for(;;)switch(x.prev=x.next){case 0:return D(h),p=this._bucketRequestParams("DELETE",h,"lifecycle",b),p.successStatuses=[204],x.next=5,d.default.awrap(this.request(p));case 5:return v=x.sent,x.abrupt("return",{res:v.res});case 7:case"end":return x.stop()}},null,this)}},{"../utils/checkBucketName":35,"babel-runtime/regenerator":68}],7:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(g){return g&&g.__esModule?g:{default:g}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=N;E.deleteBucketWebsite=function(h,b){var p,v;return d.default.async(function(x){for(;;)switch(x.prev=x.next){case 0:return D(h),p=this._bucketRequestParams("DELETE",h,"website",b),p.successStatuses=[204],x.next=5,d.default.awrap(this.request(p));case 5:return v=x.sent,x.abrupt("return",{res:v.res});case 7:case"end":return x.stop()}},null,this)}},{"../utils/checkBucketName":35,"babel-runtime/regenerator":68}],8:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(v){return v&&v.__esModule?v:{default:v}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=l("../utils/isArray"),g=E.isArray,h=l("../utils/formatObjKey"),b=h.formatObjKey,p=N;p.getBucketLifecycle=function(I,x){var S,H,B;return d.default.async(function(z){for(;;)switch(z.prev=z.next){case 0:return D(I),S=this._bucketRequestParams("GET",I,"lifecycle",x),S.successStatuses=[200],S.xmlResponse=!0,z.next=6,d.default.awrap(this.request(S));case 6:return H=z.sent,B=H.data.Rule||null,B&&(g(B)||(B=[B]),B=B.map(function(K){return K.ID&&(K.id=K.ID,delete K.ID),K.Tag&&!g(K.Tag)&&(K.Tag=[K.Tag]),b(K,"firstLowerCase")})),z.abrupt("return",{rules:B,res:H.res});case 10:case"end":return z.stop()}},null,this)}},{"../utils/checkBucketName":35,"../utils/formatObjKey":40,"../utils/isArray":42,"babel-runtime/regenerator":68}],9:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(g){return g&&g.__esModule?g:{default:g}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=N;E.getBucketVersioning=function(h,b){var p,v,I;return d.default.async(function(S){for(;;)switch(S.prev=S.next){case 0:return D(h),p=this._bucketRequestParams("GET",h,"versioning",b),p.xmlResponse=!0,p.successStatuses=[200],S.next=6,d.default.awrap(this.request(p));case 6:return v=S.sent,I=v.data.Status,S.abrupt("return",{status:v.status,versionStatus:I,res:v.res});case 9:case"end":return S.stop()}},null,this)}},{"../utils/checkBucketName":35,"babel-runtime/regenerator":68}],10:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(b){return b&&b.__esModule?b:{default:b}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=l("../utils/isObject"),g=E.isObject,h=N;h.getBucketWebsite=function(p,v){var I,x,S;return d.default.async(function(B){for(;;)switch(B.prev=B.next){case 0:return D(p),I=this._bucketRequestParams("GET",p,"website",v),I.successStatuses=[200],I.xmlResponse=!0,B.next=6,d.default.awrap(this.request(I));case 6:return x=B.sent,S=[],x.data.RoutingRules&&x.data.RoutingRules.RoutingRule&&(g(x.data.RoutingRules.RoutingRule)?S=[x.data.RoutingRules.RoutingRule]:S=x.data.RoutingRules.RoutingRule),B.abrupt("return",{index:x.data.IndexDocument&&x.data.IndexDocument.Suffix||"",supportSubDir:x.data.IndexDocument&&x.data.IndexDocument.SupportSubDir||"false",type:x.data.IndexDocument&&x.data.IndexDocument.Type,routingRules:S,error:x.data.ErrorDocument&&x.data.ErrorDocument.Key||null,res:x.res});case 10:case"end":return B.stop()}},null,this)}},{"../utils/checkBucketName":35,"../utils/isObject":46,"babel-runtime/regenerator":68}],11:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(T){return T&&T.__esModule?T:{default:T}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=l("../utils/isArray"),g=E.isArray,h=l("../utils/deepCopy"),b=h.deepCopy,p=l("../utils/isObject"),v=p.isObject,I=l("../utils/obj2xml"),x=I.obj2xml,S=l("../utils/checkObjectTag"),H=S.checkObjectTag,B=l("../utils/getStrBytesCount"),Q=B.getStrBytesCount,z=N;z.putBucketLifecycle=function(te,Z,_){var Y,re,pe,le,_e;return d.default.async(function(ke){for(;;)switch(ke.prev=ke.next){case 0:if(D(te),g(Z)){ke.next=3;break}throw new Error("rules must be Array");case 3:return Y=this._bucketRequestParams("PUT",te,"lifecycle",_),re=[],pe={LifecycleConfiguration:{Rule:re}},Z.forEach(function($){K($),j($),$.id&&($.ID=$.id,delete $.id),re.push($)}),le=x(pe,{headers:!0,firstUpperCase:!0}),Y.content=le,Y.mime="xml",Y.successStatuses=[200],ke.next=13,d.default.awrap(this.request(Y));case 13:return _e=ke.sent,ke.abrupt("return",{res:_e.res});case 15:case"end":return ke.stop()}},null,this)};function K(T){T.days&&(T.expiration={days:T.days}),T.date&&(T.expiration={createdBeforeDate:T.date})}function J(T,te){var Z=T.days,_=T.createdBeforeDate;if(!Z&&!_)throw new Error(te+" must includes days or createdBeforeDate");if(Z&&!/^[1-9][0-9]*$/.test(Z))throw new Error("days must be a positive integer");if(_&&!/\d{4}-\d{2}-\d{2}T00:00:00.000Z/.test(_))throw new Error("createdBeforeDate must be date and conform to iso8601 format")}function U(T){if(!g(T)&&!v(T))throw new Error("tag must be Object or Array");T=v(T)?[T]:T;var te={},Z=b(T);Z.forEach(function(_){te[_.key]=_.value}),H(te)}function j(T){if(T.id&&Q(T.id)>255)throw new Error("ID is composed of 255 bytes at most");if(T.prefix===""||T.prefix===void 0)throw new Error("Rule must includes prefix");if(!["Enabled","Disabled"].includes(T.status))throw new Error("Status must be Enabled or Disabled");if(T.transition){if(!["IA","Archive"].includes(T.transition.storageClass))throw new Error("StorageClass must be IA or Archive");J(T.transition,"Transition")}if(T.expiration){if(!T.expiration.expiredObjectDeleteMarker)J(T.expiration,"Expiration");else if(T.expiration.days||T.expiration.createdBeforeDate)throw new Error("expiredObjectDeleteMarker cannot be used with days or createdBeforeDate")}if(T.abortMultipartUpload&&J(T.abortMultipartUpload,"AbortMultipartUpload"),!T.expiration&&!T.abortMultipartUpload&&!T.transition&&!T.noncurrentVersionTransition)throw new Error("Rule must includes expiration or abortMultipartUpload or transition or noncurrentVersionTransition");if(T.tag){if(T.abortMultipartUpload)throw new Error("Tag cannot be used with abortMultipartUpload");U(T.tag)}}},{"../utils/checkBucketName":35,"../utils/checkObjectTag":36,"../utils/deepCopy":39,"../utils/getStrBytesCount":41,"../utils/isArray":42,"../utils/isObject":46,"../utils/obj2xml":47,"babel-runtime/regenerator":68}],12:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(b){return b&&b.__esModule?b:{default:b}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=l("../utils/obj2xml"),g=E.obj2xml,h=N;h.putBucketVersioning=function(p,v){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},x,S,H;return d.default.async(function(Q){for(;;)switch(Q.prev=Q.next){case 0:if(D(p),["Enabled","Suspended"].includes(v)){Q.next=3;break}throw new Error("status must be Enabled or Suspended");case 3:return x=this._bucketRequestParams("PUT",p,"versioning",I),S={VersioningConfiguration:{Status:v}},x.mime="xml",x.content=g(S,{headers:!0}),Q.next=9,d.default.awrap(this.request(x));case 9:return H=Q.sent,Q.abrupt("return",{res:H.res,status:H.status});case 11:case"end":return Q.stop()}},null,this)}},{"../utils/checkBucketName":35,"../utils/obj2xml":47,"babel-runtime/regenerator":68}],13:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(v){return v&&v.__esModule?v:{default:v}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=l("../utils/obj2xml"),g=E.obj2xml,h=l("../utils/isArray"),b=h.isArray,p=N;p.putBucketWebsite=function(I){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=arguments[2],H,B,Q,z,K;return d.default.async(function(U){for(;;)switch(U.prev=U.next){case 0:if(D(I),H=this._bucketRequestParams("PUT",I,"website",S),B={Suffix:x.index||"index.html"},Q={IndexDocument:B},z={WebsiteConfiguration:Q},x.supportSubDir&&(B.SupportSubDir=x.supportSubDir),x.type&&(B.Type=x.type),x.error&&(Q.ErrorDocument={Key:x.error}),!(x.routingRules!==void 0)){U.next=12;break}if(b(x.routingRules)){U.next=11;break}throw new Error("RoutingRules must be Array");case 11:Q.RoutingRules={RoutingRule:x.routingRules};case 12:return z=g(z),H.content=z,H.mime="xml",H.successStatuses=[200],U.next=18,d.default.awrap(this.request(H));case 18:return K=U.sent,U.abrupt("return",{res:K.res});case 20:case"end":return U.stop()}},null,this)}},{"../utils/checkBucketName":35,"../utils/isArray":42,"../utils/obj2xml":47,"babel-runtime/regenerator":68}],14:[function(l,G,N){(function(y){"use strict";var d=l("babel-runtime/core-js/object/keys"),F=E(d),M=l("babel-runtime/core-js/json/stringify"),D=E(M);function E(g){return g&&g.__esModule?g:{default:g}}N.encodeCallback=function(h,b){if(h.headers=h.headers||{},!Object.prototype.hasOwnProperty.call(h.headers,"x-oss-callback")&&b.callback){var p={callbackUrl:encodeURI(b.callback.url),callbackBody:b.callback.body};b.callback.host&&(p.callbackHost=b.callback.host),b.callback.contentType&&(p.callbackBodyType=b.callback.contentType);var v=y.from((0,D.default)(p)).toString("base64");if(h.headers["x-oss-callback"]=v,b.callback.customValue){var I={};(0,F.default)(b.callback.customValue).forEach(function(x){I["x:"+x]=b.callback.customValue[x]}),h.headers["x-oss-callback-var"]=y.from((0,D.default)(I)).toString("base64")}}}}).call(this,l("buffer").Buffer)},{"babel-runtime/core-js/json/stringify":53,"babel-runtime/core-js/object/keys":60,buffer:73}],15:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/assign"),d=F(y);function F(p){return p&&p.__esModule?p:{default:p}}var M=l("humanize-ms"),D=l("url"),E=l("../utils/checkBucketName"),g=E.checkBucketName;function h(p,v){var I=D.parse(p);if(I.protocol||(I=D.parse("http"+(v?"s":"")+"://"+p)),I.protocol!=="http:"&&I.protocol!=="https:")throw new Error("Endpoint protocol must be http or https.");return I}function b(p,v,I){var x=I?"https://":"http://",S=v?"-internal.aliyuncs.com":".aliyuncs.com",H="vpc100-oss-cn-";return p.substr(0,H.length)===H&&(S=".aliyuncs.com"),D.parse(x+p+S)}G.exports=function(p){if(!p||!p.accessKeyId||!p.accessKeySecret)throw new Error("require accessKeyId, accessKeySecret");p.bucket&&g(p.bucket);var v=(0,d.default)({region:"oss-cn-hangzhou",internal:!1,secure:!1,timeout:6e4,bucket:null,endpoint:null,cname:!1,isRequestPay:!1,sldEnable:!1},p);if(v.accessKeyId=v.accessKeyId.trim(),v.accessKeySecret=v.accessKeySecret.trim(),v.timeout&&(v.timeout=M(v.timeout)),v.endpoint)v.endpoint=h(v.endpoint,v.secure);else if(v.region)v.endpoint=b(v.region,v.internal,v.secure);else throw new Error("require options.endpoint or options.region");return v.inited=!0,v}},{"../utils/checkBucketName":35,"babel-runtime/core-js/object/assign":54,"humanize-ms":194,url:238}],16:[function(l,G,N){"use strict";var y=l("merge-descriptors"),d=N;y(d,l("./processObjectSave"))},{"./processObjectSave":17,"merge-descriptors":200}],17:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(v){return v&&v.__esModule?v:{default:v}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=l("querystring"),g=l("js-base64"),h=g.Base64.encode,b=N;b.processObjectSave=function(I,x,S,H){var B,Q,z,K;return d.default.async(function(U){for(;;)switch(U.prev=U.next){case 0:return p(I,"sourceObject"),p(x,"targetObject"),p(S,"process"),x=this._objectName(x),H&&D(H),B=this._objectRequestParams("POST",I,{subres:"x-oss-process"}),Q=H?",b_"+h(H):"",x=h(x),z={"x-oss-process":S+"|sys/saveas,o_"+x+Q},B.content=E.stringify(z),U.next=12,d.default.awrap(this.request(B));case 12:return K=U.sent,U.abrupt("return",{res:K.res,status:K.res.status});case 14:case"end":return U.stop()}},null,this)};function p(v,I){if(!v)throw new Error(I+" is required");if(typeof v!="string")throw new Error(I+" must be String")}},{"../utils/checkBucketName":35,"babel-runtime/regenerator":68,"js-base64":199,querystring:212}],18:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(b){return b&&b.__esModule?b:{default:b}}var M=l("copy-to"),D=l("./callback"),E=l("./utils/deepCopy"),g=E.deepCopy,h=N;h.listUploads=function(p,v){var I,x,S,H;return d.default.async(function(Q){for(;;)switch(Q.prev=Q.next){case 0:return v=v||{},I={},M(v).to(I),I.subres="uploads",x=this._objectRequestParams("GET","",I),x.query=p,x.xmlResponse=!0,x.successStatuses=[200],Q.next=10,d.default.awrap(this.request(x));case 10:return S=Q.sent,H=S.data.Upload||[],Array.isArray(H)||(H=[H]),H=H.map(function(z){return{name:z.Key,uploadId:z.UploadId,initiated:z.Initiated}}),Q.abrupt("return",{res:S.res,uploads:H,bucket:S.data.Bucket,nextKeyMarker:S.data.NextKeyMarker,nextUploadIdMarker:S.data.NextUploadIdMarker,isTruncated:S.data.IsTruncated==="true"});case 15:case"end":return Q.stop()}},null,this)},h.listParts=function(p,v,I,x){var S,H,B;return d.default.async(function(z){for(;;)switch(z.prev=z.next){case 0:return x=x||{},S={},M(x).to(S),S.subres={uploadId:v},H=this._objectRequestParams("GET",p,S),H.query=I,H.xmlResponse=!0,H.successStatuses=[200],z.next=10,d.default.awrap(this.request(H));case 10:return B=z.sent,z.abrupt("return",{res:B.res,uploadId:B.data.UploadId,bucket:B.data.Bucket,name:B.data.Key,partNumberMarker:B.data.PartNumberMarker,nextPartNumberMarker:B.data.NextPartNumberMarker,maxParts:B.data.MaxParts,isTruncated:B.data.IsTruncated,parts:B.data.Part||[]});case 12:case"end":return z.stop()}},null,this)},h.abortMultipartUpload=function(p,v,I){var x,S,H;return d.default.async(function(Q){for(;;)switch(Q.prev=Q.next){case 0:return this._stop(),I=I||{},x={},M(I).to(x),x.subres={uploadId:v},S=this._objectRequestParams("DELETE",p,x),S.successStatuses=[204],Q.next=9,d.default.awrap(this.request(S));case 9:return H=Q.sent,Q.abrupt("return",{res:H.res});case 11:case"end":return Q.stop()}},null,this)},h.initMultipartUpload=function(p,v){var I,x,S;return d.default.async(function(B){for(;;)switch(B.prev=B.next){case 0:return v=v||{},I={},M(v).to(I),I.headers=I.headers||{},this._convertMetaToHeaders(v.meta,I.headers),I.subres="uploads",x=this._objectRequestParams("POST",p,I),x.mime=v.mime,x.xmlResponse=!0,x.successStatuses=[200],B.next=12,d.default.awrap(this.request(x));case 12:return S=B.sent,B.abrupt("return",{res:S.res,bucket:S.data.Bucket,name:S.data.Key,uploadId:S.data.UploadId});case 14:case"end":return B.stop()}},null,this)},h.uploadPart=function(p,v,I,x,S,H,B){var Q;return d.default.async(function(K){for(;;)switch(K.prev=K.next){case 0:return Q={stream:this._createStream(x,S,H),size:H-S},K.next=3,d.default.awrap(this._uploadPart(p,v,I,Q,B));case 3:return K.abrupt("return",K.sent);case 4:case"end":return K.stop()}},null,this)},h.completeMultipartUpload=function(p,v,I,x){var S,H,B,Q,z,K,J,U;return d.default.async(function(T){for(;;)switch(T.prev=T.next){case 0:for(S=I.concat().sort(function(te,Z){return te.number-Z.number}).filter(function(te,Z,_){return!Z||te.number!==_[Z-1].number}),H=`<?xml version="1.0" encoding="UTF-8"?>
<CompleteMultipartUpload>
`,B=0;B<S.length;B++)Q=S[B],H+=`<Part>
`,H+="<PartNumber>"+Q.number+`</PartNumber>
`,H+="<ETag>"+Q.etag+`</ETag>
`,H+=`</Part>
`;return H+="</CompleteMultipartUpload>",x=x||{},z={},z=g(x),z.headers&&delete z.headers["x-oss-server-side-encryption"],z.subres={uploadId:v},K=this._objectRequestParams("POST",p,z),D.encodeCallback(K,z),K.mime="xml",K.content=H,K.headers&&K.headers["x-oss-callback"]||(K.xmlResponse=!0),K.successStatuses=[200],T.next=17,d.default.awrap(this.request(K));case 17:return J=T.sent,U={res:J.res,bucket:K.bucket,name:p,etag:J.res.headers.etag},K.headers&&K.headers["x-oss-callback"]&&(U.data=JSON.parse(J.data.toString())),T.abrupt("return",U);case 21:case"end":return T.stop()}},null,this)},h._uploadPart=function(p,v,I,x,S){var H,B,Q;return d.default.async(function(K){for(;;)switch(K.prev=K.next){case 0:return S=S||{},H={},M(S).to(H),H.headers={"Content-Length":x.size},H.subres={partNumber:I,uploadId:v},B=this._objectRequestParams("PUT",p,H),B.mime=H.mime,B.stream=x.stream,B.successStatuses=[200],K.next=11,d.default.awrap(this.request(B));case 11:if(Q=K.sent,Q.res.headers.etag){K.next=14;break}throw new Error(`Please set the etag of expose-headers in OSS
https://help.aliyun.com/document_detail/32069.html`);case 14:return x.stream=null,B.stream=null,K.abrupt("return",{name:p,etag:Q.res.headers.etag,res:Q.res});case 17:case"end":return K.stop()}},null,this)}},{"./callback":14,"./utils/deepCopy":39,"babel-runtime/regenerator":68,"copy-to":76}],19:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=g(y),F=l("babel-runtime/core-js/object/keys"),M=g(F),D=l("babel-runtime/helpers/typeof"),E=g(D);function g(v){return v&&v.__esModule?v:{default:v}}var h=l("../utils/checkBucketName"),b=h.checkBucketName,p=N;p.copy=function(I,x,S,H){var B,Q,z;return d.default.async(function(J){for(;;)switch(J.prev=J.next){case 0:return(typeof S=="undefined"?"undefined":(0,E.default)(S))==="object"&&(H=S),H=H||{},H.headers=H.headers||{},(0,M.default)(H.headers).forEach(function(U){H.headers["x-oss-copy-source-"+U.toLowerCase()]=H.headers[U]}),H.meta&&(H.headers["x-oss-metadata-directive"]="REPLACE"),this._convertMetaToHeaders(H.meta,H.headers),x=this._getSourceName(x,S),H.versionId&&(x=x+"?versionId="+H.versionId),H.headers["x-oss-copy-source"]=x,B=this._objectRequestParams("PUT",I,H),B.xmlResponse=!0,B.successStatuses=[200,304],J.next=14,d.default.awrap(this.request(B));case 14:return Q=J.sent,z=Q.data,z&&(z={etag:z.ETag,lastModified:z.LastModified}),J.abrupt("return",{data:z,res:Q.res});case 18:case"end":return J.stop()}},null,this)},p._getSourceName=function(I,x){return typeof x=="string"?I=this._objectName(I):I[0]!=="/"?x=this.options.bucket:(x=I.replace(/\/(.+?)(\/.*)/,"$1"),I=I.replace(/(\/.+?\/)(.*)/,"$2")),b(x),I=encodeURI(I),I="/"+x+"/"+I,I}},{"../utils/checkBucketName":35,"babel-runtime/core-js/object/keys":60,"babel-runtime/helpers/typeof":67,"babel-runtime/regenerator":68}],20:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(g){return g&&g.__esModule?g:{default:g}}var E=N;E.delete=function(h){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p,v;return d.default.async(function(x){for(;;)switch(x.prev=x.next){case 0:return b.subres=(0,M.default)({},b.subres),b.versionId&&(b.subres.versionId=b.versionId),p=this._objectRequestParams("DELETE",h,b),p.successStatuses=[204],x.next=6,d.default.awrap(this.request(p));case 6:return v=x.sent,x.abrupt("return",{res:v.res});case 8:case"end":return x.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],21:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(p){return p&&p.__esModule?p:{default:p}}var E=l("utility"),g=l("../utils/obj2xml"),h=g.obj2xml,b=N;b.deleteMulti=function(v){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x,S,H,B,Q,z,K,J,U,j,T,te;return d.default.async(function(_){for(;;)switch(_.prev=_.next){case 0:if(x=[],!(!v||!v.length)){_.next=3;break}throw new Error("names is required");case 3:for(S=0;S<v.length;S++)H={},typeof v[S]=="string"?H.Key=E.escape(this._objectName(v[S])):(B=v[S],Q=B.key,z=B.versionId,H.Key=E.escape(this._objectName(Q)),H.VersionId=z),x.push(H);return K={Delete:{Quiet:!!I.quiet,Object:x}},J=h(K,{headers:!0}),I.subres=(0,M.default)({delete:""},I.subres),I.versionId&&(I.subres.versionId=I.versionId),U=this._objectRequestParams("POST","",I),U.mime="xml",U.content=J,U.xmlResponse=!0,U.successStatuses=[200],_.next=15,d.default.awrap(this.request(U));case 15:return j=_.sent,T=j.data,te=T&&T.Deleted||null,te&&(Array.isArray(te)||(te=[te])),_.abrupt("return",{res:j.res,deleted:te||[]});case 20:case"end":return _.stop()}},null,this)}},{"../utils/obj2xml":47,"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68,utility:290}],22:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(g){return g&&g.__esModule?g:{default:g}}var E=N;E.deleteObjectTagging=function(h){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p,v;return d.default.async(function(x){for(;;)switch(x.prev=x.next){case 0:return b.subres=(0,M.default)({tagging:""},b.subres),b.versionId&&(b.subres.versionId=b.versionId),h=this._objectName(h),p=this._objectRequestParams("DELETE",h,b),p.successStatuses=[204],x.next=7,d.default.awrap(this.request(p));case 7:return v=x.sent,x.abrupt("return",{status:v.status,res:v.res});case 9:case"end":return x.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],23:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(b){return b&&b.__esModule?b:{default:b}}var E=l("fs"),g=l("is-type-of"),h=N;h.get=function(p,v){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},x,S,H,B;return d.default.async(function(z){for(;;)switch(z.prev=z.next){case 0:return x=null,S=!1,g.writableStream(v)?x=v:g.string(v)?(x=E.createWriteStream(v),S=!0):I=v,I=I||{},I.subres=(0,M.default)({},I.subres),I.versionId&&(I.subres.versionId=I.versionId),I.process&&(I.subres["x-oss-process"]=I.process),H=void 0,z.prev=8,B=this._objectRequestParams("GET",p,I),B.writeStream=x,B.successStatuses=[200,206,304],z.next=14,d.default.awrap(this.request(B));case 14:H=z.sent,S&&x.destroy(),z.next=25;break;case 18:if(z.prev=18,z.t0=z.catch(8),!S){z.next=24;break}return x.destroy(),z.next=24,d.default.awrap(this._deleteFileSafe(v));case 24:throw z.t0;case 25:return z.abrupt("return",{res:H.res,content:H.data});case 26:case"end":return z.stop()}},null,this,[[8,18]])}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68,fs:71,"is-type-of":289}],24:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(g){return g&&g.__esModule?g:{default:g}}var E=N;E.getACL=function(h){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p,v;return d.default.async(function(x){for(;;)switch(x.prev=x.next){case 0:return b.subres=(0,M.default)({acl:""},b.subres),b.versionId&&(b.subres.versionId=b.versionId),h=this._objectName(h),p=this._objectRequestParams("GET",h,b),p.successStatuses=[200],p.xmlResponse=!0,x.next=8,d.default.awrap(this.request(p));case 8:return v=x.sent,x.abrupt("return",{acl:v.data.AccessControlList.Grant,owner:{id:v.data.Owner.ID,displayName:v.data.Owner.DisplayName},res:v.res});case 10:case"end":return x.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],25:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/keys"),d=g(y),F=l("babel-runtime/regenerator"),M=g(F),D=l("babel-runtime/core-js/object/assign"),E=g(D);function g(B){return B&&B.__esModule?B:{default:B}}var h=N,b=l("../utils/isObject"),p=b.isObject,v=l("../utils/isArray"),I=v.isArray;h.getBucketVersions=x,h.listObjectVersions=x;function x(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},z,K,J,U,j,T;return M.default.async(function(Z){for(;;)switch(Z.prev=Z.next){case 0:if(!(B.versionIdMarker&&B.keyMarker===void 0)){Z.next=2;break}throw new Error("A version-id marker cannot be specified without a key marker");case 2:return Q.subres=(0,E.default)({versions:""},Q.subres),Q.versionId&&(Q.subres.versionId=Q.versionId),z=this._objectRequestParams("GET","",Q),z.xmlResponse=!0,z.successStatuses=[200],z.query=H(B),Z.next=10,M.default.awrap(this.request(z));case 10:return K=Z.sent,J=K.data.Version||[],U=K.data.DeleteMarker||[],j=this,J&&(Array.isArray(J)||(J=[J]),J=J.map(function(_){return{name:_.Key,url:j._objectUrl(_.Key),lastModified:_.LastModified,isLatest:_.IsLatest==="true",versionId:_.VersionId,etag:_.ETag,type:_.Type,size:Number(_.Size),storageClass:_.StorageClass,owner:{id:_.Owner.ID,displayName:_.Owner.DisplayName}}})),U&&(I(U)||(U=[U]),U=U.map(function(_){return{name:_.Key,lastModified:_.LastModified,versionId:_.VersionId,owner:{id:_.Owner.ID,displayName:_.Owner.DisplayName}}})),T=K.data.CommonPrefixes||null,T&&(I(T)||(T=[T]),T=T.map(function(_){return _.Prefix})),Z.abrupt("return",{res:K.res,objects:J,deleteMarker:U,prefixes:T,nextMarker:K.data.NextMarker||null,NextVersionIdMarker:K.data.NextVersionIdMarker||null,isTruncated:K.data.IsTruncated==="true"});case 19:case"end":return Z.stop()}},null,this)}function S(B){return B.replace(/([A-Z])/g,"-$1").toLowerCase()}function H(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Q={};return p(B)&&(0,d.default)(B).forEach(function(z){Q[S(z)]=B[z]}),Q}},{"../utils/isArray":42,"../utils/isObject":46,"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/object/keys":60,"babel-runtime/regenerator":68}],26:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(g){return g&&g.__esModule?g:{default:g}}var E=N;E.getObjectMeta=function(h,b){var p,v;return d.default.async(function(x){for(;;)switch(x.prev=x.next){case 0:return b=b||{},h=this._objectName(h),b.subres=(0,M.default)({objectMeta:""},b.subres),b.versionId&&(b.subres.versionId=b.versionId),p=this._objectRequestParams("HEAD",h,b),p.successStatuses=[200],x.next=8,d.default.awrap(this.request(p));case 8:return v=x.sent,x.abrupt("return",{status:v.status,res:v.res});case 10:case"end":return x.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],27:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(b){return b&&b.__esModule?b:{default:b}}var E=N,g=l("../utils/isObject"),h=g.isObject;E.getObjectTagging=function(p){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I,x,S,H,B;return d.default.async(function(z){for(;;)switch(z.prev=z.next){case 0:return v.subres=(0,M.default)({tagging:""},v.subres),v.versionId&&(v.subres.versionId=v.versionId),p=this._objectName(p),I=this._objectRequestParams("GET",p,v),I.successStatuses=[200],z.next=7,d.default.awrap(this.request(I));case 7:return x=z.sent,z.next=10,d.default.awrap(this.parseXML(x.data));case 10:return S=z.sent,H=S.TagSet.Tag,H=H&&h(H)?[H]:H||[],B={},H.forEach(function(K){B[K.Key]=K.Value}),z.abrupt("return",{status:x.status,res:x.res,tag:B});case 16:case"end":return z.stop()}},null,this)}},{"../utils/isObject":46,"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],28:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(g){return g&&g.__esModule?g:{default:g}}var E=N;E.getSymlink=function(h){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p,v,I;return d.default.async(function(S){for(;;)switch(S.prev=S.next){case 0:return b.subres=(0,M.default)({symlink:""},b.subres),b.versionId&&(b.subres.versionId=b.versionId),h=this._objectName(h),p=this._objectRequestParams("GET",h,b),p.successStatuses=[200],S.next=7,d.default.awrap(this.request(p));case 7:return v=S.sent,I=v.res.headers["x-oss-symlink-target"],S.abrupt("return",{targetName:decodeURIComponent(I),res:v.res});case 10:case"end":return S.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],29:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=g(y),F=l("babel-runtime/core-js/object/keys"),M=g(F),D=l("babel-runtime/core-js/object/assign"),E=g(D);function g(b){return b&&b.__esModule?b:{default:b}}var h=N;h.head=function(p){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I,x,S;return d.default.async(function(B){for(;;)switch(B.prev=B.next){case 0:return v.subres=(0,E.default)({},v.subres),v.versionId&&(v.subres.versionId=v.versionId),I=this._objectRequestParams("HEAD",p,v),I.successStatuses=[200,304],B.next=6,d.default.awrap(this.request(I));case 6:return x=B.sent,S={meta:null,res:x.res,status:x.status},x.status===200&&(0,M.default)(x.headers).forEach(function(Q){Q.indexOf("x-oss-meta-")===0&&(S.meta||(S.meta={}),S.meta[Q.substring(11)]=x.headers[Q])}),B.abrupt("return",S);case 10:case"end":return B.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/object/keys":60,"babel-runtime/regenerator":68}],30:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(g){return g&&g.__esModule?g:{default:g}}var E=N;E.putACL=function(h,b,p){var v,I;return d.default.async(function(S){for(;;)switch(S.prev=S.next){case 0:return p=p||{},p.subres=(0,M.default)({acl:""},p.subres),p.versionId&&(p.subres.versionId=p.versionId),p.headers=p.headers||{},p.headers["x-oss-object-acl"]=b,h=this._objectName(h),v=this._objectRequestParams("PUT",h,p),v.successStatuses=[200],S.next=10,d.default.awrap(this.request(v));case 10:return I=S.sent,S.abrupt("return",{res:I.res});case 12:case"end":return S.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],31:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=g(y),F=l("babel-runtime/core-js/object/keys"),M=g(F),D=l("babel-runtime/core-js/object/assign"),E=g(D);function g(x){return x&&x.__esModule?x:{default:x}}var h=l("../utils/obj2xml"),b=h.obj2xml,p=l("../utils/checkObjectTag"),v=p.checkObjectTag,I=N;I.putObjectTagging=function(S,H){var B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},Q,z,K;return d.default.async(function(U){for(;;)switch(U.prev=U.next){case 0:return v(H),B.subres=(0,E.default)({tagging:""},B.subres),B.versionId&&(B.subres.versionId=B.versionId),S=this._objectName(S),Q=this._objectRequestParams("PUT",S,B),Q.successStatuses=[200],H=(0,M.default)(H).map(function(j){return{Key:j,Value:H[j]}}),z={Tagging:{TagSet:{Tag:H}}},Q.mime="xml",Q.content=b(z),U.next=12,d.default.awrap(this.request(Q));case 12:return K=U.sent,U.abrupt("return",{res:K.res,status:K.status});case 14:case"end":return U.stop()}},null,this)}},{"../utils/checkObjectTag":36,"../utils/obj2xml":47,"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/object/keys":60,"babel-runtime/regenerator":68}],32:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(g){return g&&g.__esModule?g:{default:g}}var E=N;E.putSymlink=function(h,b,p){var v,I;return d.default.async(function(S){for(;;)switch(S.prev=S.next){case 0:return p=p||{},p.headers=p.headers||{},b=this._escape(this._objectName(b)),this._convertMetaToHeaders(p.meta,p.headers),p.headers["x-oss-symlink-target"]=b,p.subres=(0,M.default)({symlink:""},p.subres),p.versionId&&(p.subres.versionId=p.versionId),p.storageClass&&(p.headers["x-oss-storage-class"]=p.storageClass),h=this._objectName(h),v=this._objectRequestParams("PUT",h,p),v.successStatuses=[200],S.next=13,d.default.awrap(this.request(v));case 13:return I=S.sent,S.abrupt("return",{res:I.res});case 15:case"end":return S.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],33:[function(l,G,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/promise"),M=D(F);function D(g){return g&&g.__esModule?g:{default:g}}var E=N;E._parallelNode=function(h,b,p,v){var I,x,S,H,B,Q,z,K;return d.default.async(function(U){for(;;)switch(U.prev=U.next){case 0:I=this,x=[],S=[],H=h.length/b,B=h.length%b,Q=B===0?H:(h.length-B)/b+1,z=1,K=0;case 8:if(!(K<h.length)){U.next=26;break}if(!I.isCancel()){U.next=11;break}return U.abrupt("break",26);case 11:if(v?S.push(p(I,h[K],v)):S.push(p(I,h[K])),!(S.length===b||z===Q&&K===h.length-1)){U.next=23;break}return U.prev=13,z+=1,U.next=17,d.default.awrap(M.default.all(S));case 17:U.next=22;break;case 19:U.prev=19,U.t0=U.catch(13),x.push(U.t0);case 22:S=[];case 23:K++,U.next=8;break;case 26:return U.abrupt("return",x);case 27:case"end":return U.stop()}},null,this,[[13,19]])},E._parallel=function(h,b,p){var v=this;return new M.default(function(I){var x=[];if(b<=0||!h){I(x);return}function S(T){return function(){if(T===null)throw new Error("Callback was already called.");var te=T;T=null;for(var Z=arguments.length,_=Array(Z),Y=0;Y<Z;Y++)_[Y]=arguments[Y];te.apply(this,_)}}function H(T){var te=-1,Z=T.length;return function(){return++te<Z&&!v.isCancel()?{value:T[te],key:te}:null}}var B=H(h),Q=!1,z=0,K=!1;function J(T,te){z-=1,T?(Q=!0,x.push(T),I(x)):te==={}||Q&&z<=0?(Q=!0,I(x)):K||(v.isCancel()?I(x):j())}function U(T,te){p(T).then(function(Z){te(null,Z)}).catch(function(Z){te(Z)})}function j(){for(K=!0;z<b&&!Q&&!v.isCancel();){var T=B();if(T===null||x.length>0){Q=!0,z<=0&&I(x);return}z+=1,U(T.value,S(J))}K=!1}j()})},E.cancel=function(h){this.options.cancelFlag=!0,h&&this.abortMultipartUpload(h.name,h.uploadId,h.options)},E.isCancel=function(){return this.options.cancelFlag},E.resetCancelFlag=function(){this.options.cancelFlag=!1},E._stop=function(){this.options.cancelFlag=!0},E._makeCancelEvent=function(){var h={status:0,name:"cancel"};return h}},{"babel-runtime/core-js/promise":61,"babel-runtime/regenerator":68}],34:[function(l,G,N){(function(y){"use strict";var d=l("babel-runtime/core-js/json/stringify"),F=E(d),M=l("babel-runtime/core-js/object/keys"),D=E(M);function E(b){return b&&b.__esModule?b:{default:b}}var g=l("./../../shims/crypto/crypto.js"),h=l("is-type-of");N.buildCanonicalizedResource=function(p,v){var I=""+p,x="?";if(h.string(v)&&v.trim()!=="")I+=x+v;else if(h.array(v))v.sort(),I+=x+v.join("&");else if(v){var S=function(Q,z){return Q[0]>z[0]?1:Q[0]<z[0]?-1:0},H=function(Q){I+=x+Q,v[Q]&&(I+="="+v[Q]),x="&"};(0,D.default)(v).sort(S).forEach(H)}return I},N.buildCanonicalString=function(p,v,I,x){I=I||{};var S=I.headers||{},H="x-oss-",B=[],Q={},z=[p.toUpperCase(),S["Content-Md5"]||"",S["Content-Type"]||S["Content-Type".toLowerCase()],x||S["x-oss-date"]];return(0,D.default)(S).forEach(function(K){var J=K.toLowerCase();J.indexOf(H)===0&&(Q[J]=String(S[K]).trim())}),(0,D.default)(Q).sort().forEach(function(K){B.push(K+":"+Q[K])}),z=z.concat(B),z.push(this.buildCanonicalizedResource(v,I.parameters)),z.join(`
`)},N.computeSignature=function(p,v){var I=g.createHmac("sha1",p);return I.update(y.from(v,"utf8")).digest("base64")},N.authorization=function(p,v,I){return"OSS "+p+":"+this.computeSignature(v,I)},N._signatureForURL=function(p){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=arguments[2],x=arguments[3],S={},H=v.subResource,B=H===void 0?{}:H;if(v.process){var Q="x-oss-process";B[Q]=v.process}if(v.trafficLimit){var z="x-oss-traffic-limit";B[z]=v.trafficLimit}if(v.response&&(0,D.default)(v.response).forEach(function(j){var T="response-"+j.toLowerCase();B[T]=v.response[j]}),(0,D.default)(v).forEach(function(j){var T=j.toLowerCase(),te=v[j];T.indexOf("x-oss-")===0?S[T]=te:(T.indexOf("content-md5")===0||T.indexOf("content-type")===0)&&(S[j]=te)}),Object.prototype.hasOwnProperty.call(v,"security-token")&&(B["security-token"]=v["security-token"]),Object.prototype.hasOwnProperty.call(v,"callback")){var K={callbackUrl:encodeURI(v.callback.url),callbackBody:v.callback.body};if(v.callback.host&&(K.callbackHost=v.callback.host),v.callback.contentType&&(K.callbackBodyType=v.callback.contentType),B.callback=y.from((0,F.default)(K)).toString("base64"),v.callback.customValue){var J={};(0,D.default)(v.callback.customValue).forEach(function(j){J["x:"+j]=v.callback.customValue[j]}),B["callback-var"]=y.from((0,F.default)(J)).toString("base64")}}var U=this.buildCanonicalString(v.method,I,{headers:S,parameters:B},x.toString());return{Signature:this.computeSignature(p,U),subResource:B}}}).call(this,l("buffer").Buffer)},{"./../../shims/crypto/crypto.js":284,"babel-runtime/core-js/json/stringify":53,"babel-runtime/core-js/object/keys":60,buffer:73,"is-type-of":289}],35:[function(l,G,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.checkBucketName=void 0,N.checkBucketName=function(y,d){var F=d?/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/:/^[a-z0-9_][a-z0-9-_]{1,61}[a-z0-9_]$/;if(!F.test(y))throw new Error("The bucket must be conform to the specifications")}},{}],36:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/entries"),d=F(y);function F(v){return v&&v.__esModule?v:{default:v}}Object.defineProperty(N,"__esModule",{value:!0}),N.checkObjectTag=void 0;var M=l("./checkValid"),D=M.checkValid,E=l("./isObject"),g=E.isObject,h=[{validator:function(I){if(typeof I!="string")throw new Error("the key and value of the tag must be String")}},{pattern:/^[a-zA-Z0-9 +-=._:/]+$/,msg:"tag can contain letters, numbers, spaces, and the following symbols: plus sign (+), hyphen (-), equal sign (=), period (.), underscore (_), colon (:), and forward slash (/)"}],b={key:[].concat(h,[{pattern:/^.{1,128}$/,msg:"tag key can be a maximum of 128 bytes in length"}]),value:[].concat(h,[{pattern:/^.{0,256}$/,msg:"tag value can be a maximum of 256 bytes in length"}])};function p(v){if(!g(v))throw new Error("tag must be Object");var I=(0,d.default)(v);if(I.length>10)throw new Error("maximum of 10 tags for a object");var x=["key","value"];I.forEach(function(S){S.forEach(function(H,B){D(H,b[x[B]])})})}N.checkObjectTag=p},{"./checkValid":37,"./isObject":46,"babel-runtime/core-js/object/entries":57}],37:[function(l,G,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.checkValid=void 0;function y(d,F){F.forEach(function(M){if(M.validator)M.validator(d);else if(M.pattern&&!M.pattern.test(d))throw new Error(M.msg)})}N.checkValid=y},{}],38:[function(l,G,N){(function(y){"use strict";var d=l("babel-runtime/core-js/object/assign"),F=M(d);function M(S){return S&&S.__esModule?S:{default:S}}Object.defineProperty(N,"__esModule",{value:!0}),N.createRequest=void 0;var D=l("./../../../shims/crypto/crypto.js"),E=l("debug")("ali-oss"),g=l("mime"),h=l("dateformat"),b=l("copy-to"),p=l("path");function v(S,H){return S[H]||S[H.toLowerCase()]}function I(S,H){delete S[H],delete S[H.toLowerCase()]}function x(S){var H=new Date;this.options.amendTimeSkewed&&(H=+new Date+this.options.amendTimeSkewed);var B={"x-oss-date":h(H,"UTC:ddd, dd mmm yyyy HH:MM:ss 'GMT'"),"x-oss-user-agent":this.userAgent};this.userAgent.includes("nodejs")&&(B["User-Agent"]=this.userAgent),this.options.isRequestPay&&(0,F.default)(B,{"x-oss-request-payer":"requester"}),this.options.stsToken&&(B["x-oss-security-token"]=this.options.stsToken),b(S.headers).to(B),v(B,"Content-Type")||(S.mime&&S.mime.indexOf("/")>0?B["Content-Type"]=S.mime:B["Content-Type"]=g.getType(S.mime||p.extname(S.object||""))),v(B,"Content-Type")||I(B,"Content-Type"),S.content&&(B["Content-Md5"]=D.createHash("md5").update(y.from(S.content,"utf8")).digest("base64"),B["Content-Length"]||(B["Content-Length"]=S.content.length));var Q=this._getResource(S);B.authorization=this.authorization(S.method,Q,S.subres,B);var z=this._getReqUrl(S);E("request %s %s, with headers %j, !!stream: %s",S.method,z,B,!!S.stream);var K=S.timeout||this.options.timeout,J={method:S.method,content:S.content,stream:S.stream,headers:B,timeout:K,writeStream:S.writeStream,customResponse:S.customResponse,ctx:S.ctx||this.ctx};return this.agent&&(J.agent=this.agent),this.httpsAgent&&(J.httpsAgent=this.httpsAgent),{url:z,params:J}}N.createRequest=x}).call(this,l("buffer").Buffer)},{"./../../../shims/crypto/crypto.js":284,"babel-runtime/core-js/object/assign":54,buffer:73,"copy-to":76,dateformat:190,debug:288,mime:202,path:205}],39:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/keys"),d=D(y),F=l("babel-runtime/helpers/typeof"),M=D(F);function D(E){return E&&E.__esModule?E:{default:E}}Object.defineProperty(N,"__esModule",{value:!0}),N.deepCopy=void 0,N.deepCopy=function(E){if(E===null||(typeof E=="undefined"?"undefined":(0,M.default)(E))!=="object")return E;var g=Array.isArray(E)?[]:{};return(0,d.default)(E).forEach(function(h){g[h]=N.deepCopy(E[h])}),g}},{"babel-runtime/core-js/object/keys":60,"babel-runtime/helpers/typeof":67}],40:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/keys"),d=D(y),F=l("babel-runtime/helpers/typeof"),M=D(F);function D(h){return h&&h.__esModule?h:{default:h}}Object.defineProperty(N,"__esModule",{value:!0}),N.formatObjKey=void 0;function E(h,b){if(h===null||(typeof h=="undefined"?"undefined":(0,M.default)(h))!=="object")return h;var p=void 0;if(Array.isArray(h)){p=[];for(var v=0;v<h.length;v++)p.push(E(h[v],b))}else p={},(0,d.default)(h).forEach(function(I){p[g(I,b)]=E(h[I],b)});return p}N.formatObjKey=E;function g(h,b){return b==="firstUpperCase"?h=h.replace(/^./,function(p){return p.toUpperCase()}):b==="firstLowerCase"&&(h=h.replace(/^./,function(p){return p.toLowerCase()})),h}},{"babel-runtime/core-js/object/keys":60,"babel-runtime/helpers/typeof":67}],41:[function(l,G,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.getStrBytesCount=void 0;function y(d){for(var F=0,M=0;M<d.length;M++){var D=d.charAt(M);/^[\u00-\uff]$/.test(D)?F+=1:F+=2}return F}N.getStrBytesCount=y},{}],42:[function(l,G,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.isArray=void 0,N.isArray=function(y){return Object.prototype.toString.call(y)==="[object Array]"}},{}],43:[function(l,G,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.isBlob=void 0;function y(d){return typeof Blob!="undefined"&&d instanceof Blob}N.isBlob=y},{}],44:[function(l,G,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.isFile=void 0,N.isFile=function(y){return typeof File!="undefined"&&y instanceof File}},{}],45:[function(l,G,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.isIP=void 0,N.isIP=function(y){var d=/^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}$/,F=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/;return d.test(y)||F.test(y)}},{}],46:[function(l,G,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.isObject=void 0,N.isObject=function(y){return Object.prototype.toString.call(y)==="[object Object]"}},{}],47:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/keys"),d=F(y);function F(g){return g&&g.__esModule?g:{default:g}}Object.defineProperty(N,"__esModule",{value:!0}),N.obj2xml=void 0;var M=l("./formatObjKey");function D(g){return Object.prototype.toString.call(g).replace(/(.*? |])/g,"").toLowerCase()}function E(g,h){var b="";return h&&h.headers&&(b=`<?xml version="1.0" encoding="UTF-8"?>
`),h&&h.firstUpperCase&&(g=M.formatObjKey(g,"firstUpperCase")),D(g)==="object"?(0,d.default)(g).forEach(function(p){D(g[p])==="string"||D(g[p])==="number"?b+="<"+p+">"+g[p]+"</"+p+">":D(g[p])==="object"?b+="<"+p+">"+E(g[p])+"</"+p+">":D(g[p])==="array"?b+=g[p].map(function(v){return"<"+p+">"+E(v)+"</"+p+">"}).join(""):b+="<"+p+">"+g[p].toString()+"</"+p+">"}):b+=g.toString(),b}N.obj2xml=E},{"./formatObjKey":40,"babel-runtime/core-js/object/keys":60}],48:[function(l,G,N){G.exports=y,G.exports.HttpsAgent=y;function y(){}},{}],49:[function(l,G,N){G.exports=l("./register")().Promise},{"./register":51}],50:[function(l,G,N){"use strict";var y="@@any-promise/REGISTRATION",d=null;G.exports=function(F,M){return function(E,g){E=E||null,g=g||{};var h=g.global!==!1;if(d===null&&h&&(d=F[y]||null),d!==null&&E!==null&&d.implementation!==E)throw new Error('any-promise already defined as "'+d.implementation+'". You can only register an implementation before the first call to require("any-promise") and an implementation cannot be changed');return d===null&&(E!==null&&typeof g.Promise!="undefined"?d={Promise:g.Promise,implementation:E}:d=M(E),h&&(F[y]=d)),d}}},{}],51:[function(l,G,N){"use strict";G.exports=l("./loader")(window,y);function y(){if(typeof window.Promise=="undefined")throw new Error("any-promise browser requires a polyfill or explicit registration e.g: require('any-promise/register/bluebird')");return{Promise:window.Promise,implementation:"window.Promise"}}},{"./loader":50}],52:[function(l,G,N){G.exports={default:l("core-js/library/fn/array/from"),__esModule:!0}},{"core-js/library/fn/array/from":77}],53:[function(l,G,N){G.exports={default:l("core-js/library/fn/json/stringify"),__esModule:!0}},{"core-js/library/fn/json/stringify":78}],54:[function(l,G,N){G.exports={default:l("core-js/library/fn/object/assign"),__esModule:!0}},{"core-js/library/fn/object/assign":79}],55:[function(l,G,N){G.exports={default:l("core-js/library/fn/object/create"),__esModule:!0}},{"core-js/library/fn/object/create":80}],56:[function(l,G,N){G.exports={default:l("core-js/library/fn/object/define-property"),__esModule:!0}},{"core-js/library/fn/object/define-property":81}],57:[function(l,G,N){G.exports={default:l("core-js/library/fn/object/entries"),__esModule:!0}},{"core-js/library/fn/object/entries":82}],58:[function(l,G,N){G.exports={default:l("core-js/library/fn/object/get-own-property-names"),__esModule:!0}},{"core-js/library/fn/object/get-own-property-names":83}],59:[function(l,G,N){G.exports={default:l("core-js/library/fn/object/get-prototype-of"),__esModule:!0}},{"core-js/library/fn/object/get-prototype-of":84}],60:[function(l,G,N){G.exports={default:l("core-js/library/fn/object/keys"),__esModule:!0}},{"core-js/library/fn/object/keys":85}],61:[function(l,G,N){G.exports={default:l("core-js/library/fn/promise"),__esModule:!0}},{"core-js/library/fn/promise":86}],62:[function(l,G,N){G.exports={default:l("core-js/library/fn/set-immediate"),__esModule:!0}},{"core-js/library/fn/set-immediate":87}],63:[function(l,G,N){G.exports={default:l("core-js/library/fn/string/from-code-point"),__esModule:!0}},{"core-js/library/fn/string/from-code-point":88}],64:[function(l,G,N){G.exports={default:l("core-js/library/fn/symbol"),__esModule:!0}},{"core-js/library/fn/symbol":90}],65:[function(l,G,N){G.exports={default:l("core-js/library/fn/symbol/has-instance"),__esModule:!0}},{"core-js/library/fn/symbol/has-instance":89}],66:[function(l,G,N){G.exports={default:l("core-js/library/fn/symbol/iterator"),__esModule:!0}},{"core-js/library/fn/symbol/iterator":91}],67:[function(l,G,N){"use strict";N.__esModule=!0;var y=l("../core-js/symbol/iterator"),d=E(y),F=l("../core-js/symbol"),M=E(F),D=typeof M.default=="function"&&typeof d.default=="symbol"?function(g){return typeof g}:function(g){return g&&typeof M.default=="function"&&g.constructor===M.default&&g!==M.default.prototype?"symbol":typeof g};function E(g){return g&&g.__esModule?g:{default:g}}N.default=typeof M.default=="function"&&D(d.default)==="symbol"?function(g){return typeof g=="undefined"?"undefined":D(g)}:function(g){return g&&typeof M.default=="function"&&g.constructor===M.default&&g!==M.default.prototype?"symbol":typeof g=="undefined"?"undefined":D(g)}},{"../core-js/symbol":64,"../core-js/symbol/iterator":66}],68:[function(l,G,N){G.exports=l("regenerator-runtime")},{"regenerator-runtime":226}],69:[function(l,G,N){"use strict";N.byteLength=h,N.toByteArray=p,N.fromByteArray=x;for(var y=[],d=[],F=typeof Uint8Array!="undefined"?Uint8Array:Array,M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",D=0,E=M.length;D<E;++D)y[D]=M[D],d[M.charCodeAt(D)]=D;d["-".charCodeAt(0)]=62,d["_".charCodeAt(0)]=63;function g(S){var H=S.length;if(H%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var B=S.indexOf("=");B===-1&&(B=H);var Q=B===H?0:4-B%4;return[B,Q]}function h(S){var H=g(S),B=H[0],Q=H[1];return(B+Q)*3/4-Q}function b(S,H,B){return(H+B)*3/4-B}function p(S){var H,B=g(S),Q=B[0],z=B[1],K=new F(b(S,Q,z)),J=0,U=z>0?Q-4:Q,j;for(j=0;j<U;j+=4)H=d[S.charCodeAt(j)]<<18|d[S.charCodeAt(j+1)]<<12|d[S.charCodeAt(j+2)]<<6|d[S.charCodeAt(j+3)],K[J++]=H>>16&255,K[J++]=H>>8&255,K[J++]=H&255;return z===2&&(H=d[S.charCodeAt(j)]<<2|d[S.charCodeAt(j+1)]>>4,K[J++]=H&255),z===1&&(H=d[S.charCodeAt(j)]<<10|d[S.charCodeAt(j+1)]<<4|d[S.charCodeAt(j+2)]>>2,K[J++]=H>>8&255,K[J++]=H&255),K}function v(S){return y[S>>18&63]+y[S>>12&63]+y[S>>6&63]+y[S&63]}function I(S,H,B){for(var Q,z=[],K=H;K<B;K+=3)Q=(S[K]<<16&16711680)+(S[K+1]<<8&65280)+(S[K+2]&255),z.push(v(Q));return z.join("")}function x(S){for(var H,B=S.length,Q=B%3,z=[],K=16383,J=0,U=B-Q;J<U;J+=K)z.push(I(S,J,J+K>U?U:J+K));return Q===1?(H=S[B-1],z.push(y[H>>2]+y[H<<4&63]+"==")):Q===2&&(H=(S[B-2]<<8)+S[B-1],z.push(y[H>>10]+y[H>>4&63]+y[H<<2&63]+"=")),z.join("")}},{}],70:[function(l,G,N){/*!
* Bowser - a browser detector
* https://github.com/ded/bowser
* MIT License | (c) Dustin Diaz 2015
*/!function(y,d,F){typeof G!="undefined"&&G.exports?G.exports=F():typeof define=="function"&&define.amd?define(d,F):y[d]=F()}(this,"bowser",function(){var y=!0;function d(b){function p(W){var ie=b.match(W);return ie&&ie.length>1&&ie[1]||""}function v(W){var ie=b.match(W);return ie&&ie.length>1&&ie[2]||""}var I=p(/(ipod|iphone|ipad)/i).toLowerCase(),x=/like android/i.test(b),S=!x&&/android/i.test(b),H=/nexus\s*[0-6]\s*/i.test(b),B=!H&&/nexus\s*[0-9]+/i.test(b),Q=/CrOS/.test(b),z=/silk/i.test(b),K=/sailfish/i.test(b),J=/tizen/i.test(b),U=/(web|hpw)(o|0)s/i.test(b),j=/windows phone/i.test(b),T=/SamsungBrowser/i.test(b),te=!j&&/windows/i.test(b),Z=!I&&!z&&/macintosh/i.test(b),_=!S&&!K&&!J&&!U&&/linux/i.test(b),Y=v(/edg([ea]|ios)\/(\d+(\.\d+)?)/i),re=p(/version\/(\d+(\.\d+)?)/i),pe=/tablet/i.test(b)&&!/tablet pc/i.test(b),le=!pe&&/[^-]mobi/i.test(b),_e=/xbox/i.test(b),me;/opera/i.test(b)?me={name:"Opera",opera:y,version:re||p(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)}:/opr\/|opios/i.test(b)?me={name:"Opera",opera:y,version:p(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i)||re}:/SamsungBrowser/i.test(b)?me={name:"Samsung Internet for Android",samsungBrowser:y,version:re||p(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)}:/Whale/i.test(b)?me={name:"NAVER Whale browser",whale:y,version:p(/(?:whale)[\s\/](\d+(?:\.\d+)+)/i)}:/MZBrowser/i.test(b)?me={name:"MZ Browser",mzbrowser:y,version:p(/(?:MZBrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/coast/i.test(b)?me={name:"Opera Coast",coast:y,version:re||p(/(?:coast)[\s\/](\d+(\.\d+)?)/i)}:/focus/i.test(b)?me={name:"Focus",focus:y,version:p(/(?:focus)[\s\/](\d+(?:\.\d+)+)/i)}:/yabrowser/i.test(b)?me={name:"Yandex Browser",yandexbrowser:y,version:re||p(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:/ucbrowser/i.test(b)?me={name:"UC Browser",ucbrowser:y,version:p(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/mxios/i.test(b)?me={name:"Maxthon",maxthon:y,version:p(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)}:/epiphany/i.test(b)?me={name:"Epiphany",epiphany:y,version:p(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)}:/puffin/i.test(b)?me={name:"Puffin",puffin:y,version:p(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)}:/sleipnir/i.test(b)?me={name:"Sleipnir",sleipnir:y,version:p(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)}:/k-meleon/i.test(b)?me={name:"K-Meleon",kMeleon:y,version:p(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)}:j?(me={name:"Windows Phone",osname:"Windows Phone",windowsphone:y},Y?(me.msedge=y,me.version=Y):(me.msie=y,me.version=p(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(b)?me={name:"Internet Explorer",msie:y,version:p(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:Q?me={name:"Chrome",osname:"Chrome OS",chromeos:y,chromeBook:y,chrome:y,version:p(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/edg([ea]|ios)/i.test(b)?me={name:"Microsoft Edge",msedge:y,version:Y}:/vivaldi/i.test(b)?me={name:"Vivaldi",vivaldi:y,version:p(/vivaldi\/(\d+(\.\d+)?)/i)||re}:K?me={name:"Sailfish",osname:"Sailfish OS",sailfish:y,version:p(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(b)?me={name:"SeaMonkey",seamonkey:y,version:p(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel|fxios/i.test(b)?(me={name:"Firefox",firefox:y,version:p(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(b)&&(me.firefoxos=y,me.osname="Firefox OS")):z?me={name:"Amazon Silk",silk:y,version:p(/silk\/(\d+(\.\d+)?)/i)}:/phantom/i.test(b)?me={name:"PhantomJS",phantom:y,version:p(/phantomjs\/(\d+(\.\d+)?)/i)}:/slimerjs/i.test(b)?me={name:"SlimerJS",slimer:y,version:p(/slimerjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(b)||/rim\stablet/i.test(b)?me={name:"BlackBerry",osname:"BlackBerry OS",blackberry:y,version:re||p(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:U?(me={name:"WebOS",osname:"WebOS",webos:y,version:re||p(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(b)&&(me.touchpad=y)):/bada/i.test(b)?me={name:"Bada",osname:"Bada",bada:y,version:p(/dolfin\/(\d+(\.\d+)?)/i)}:J?me={name:"Tizen",osname:"Tizen",tizen:y,version:p(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||re}:/qupzilla/i.test(b)?me={name:"QupZilla",qupzilla:y,version:p(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i)||re}:/chromium/i.test(b)?me={name:"Chromium",chromium:y,version:p(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i)||re}:/chrome|crios|crmo/i.test(b)?me={name:"Chrome",chrome:y,version:p(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:S?me={name:"Android",version:re}:/safari|applewebkit/i.test(b)?(me={name:"Safari",safari:y},re&&(me.version=re)):I?(me={name:I=="iphone"?"iPhone":I=="ipad"?"iPad":"iPod"},re&&(me.version=re)):/googlebot/i.test(b)?me={name:"Googlebot",googlebot:y,version:p(/googlebot\/(\d+(\.\d+))/i)||re}:me={name:p(/^(.*)\/(.*) /),version:v(/^(.*)\/(.*) /)},!me.msedge&&/(apple)?webkit/i.test(b)?(/(apple)?webkit\/537\.36/i.test(b)?(me.name=me.name||"Blink",me.blink=y):(me.name=me.name||"Webkit",me.webkit=y),!me.version&&re&&(me.version=re)):!me.opera&&/gecko\//i.test(b)&&(me.name=me.name||"Gecko",me.gecko=y,me.version=me.version||p(/gecko\/(\d+(\.\d+)?)/i)),!me.windowsphone&&(S||me.silk)?(me.android=y,me.osname="Android"):!me.windowsphone&&I?(me[I]=y,me.ios=y,me.osname="iOS"):Z?(me.mac=y,me.osname="macOS"):_e?(me.xbox=y,me.osname="Xbox"):te?(me.windows=y,me.osname="Windows"):_&&(me.linux=y,me.osname="Linux");function ke(W){switch(W){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}var $="";me.windows?$=ke(p(/Windows ((NT|XP)( \d\d?.\d)?)/i)):me.windowsphone?$=p(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):me.mac?($=p(/Mac OS X (\d+([_\.\s]\d+)*)/i),$=$.replace(/[_\s]/g,".")):I?($=p(/os (\d+([_\s]\d+)*) like mac os x/i),$=$.replace(/[_\s]/g,".")):S?$=p(/android[ \/-](\d+(\.\d+)*)/i):me.webos?$=p(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):me.blackberry?$=p(/rim\stablet\sos\s(\d+(\.\d+)*)/i):me.bada?$=p(/bada\/(\d+(\.\d+)*)/i):me.tizen&&($=p(/tizen[\/\s](\d+(\.\d+)*)/i)),$&&(me.osversion=$);var ne=!me.windows&&$.split(".")[0];return pe||B||I=="ipad"||S&&(ne==3||ne>=4&&!le)||me.silk?me.tablet=y:(le||I=="iphone"||I=="ipod"||S||H||me.blackberry||me.webos||me.bada)&&(me.mobile=y),me.msedge||me.msie&&me.version>=10||me.yandexbrowser&&me.version>=15||me.vivaldi&&me.version>=1||me.chrome&&me.version>=20||me.samsungBrowser&&me.version>=4||me.whale&&E([me.version,"1.0"])===1||me.mzbrowser&&E([me.version,"6.0"])===1||me.focus&&E([me.version,"1.0"])===1||me.firefox&&me.version>=20||me.safari&&me.version>=6||me.opera&&me.version>=10||me.ios&&me.osversion&&me.osversion.split(".")[0]>=6||me.blackberry&&me.version>=10.1||me.chromium&&me.version>=20?me.a=y:me.msie&&me.version<10||me.chrome&&me.version<20||me.firefox&&me.version<20||me.safari&&me.version<6||me.opera&&me.version<10||me.ios&&me.osversion&&me.osversion.split(".")[0]<6||me.chromium&&me.version<20?me.c=y:me.x=y,me}var F=d(typeof navigator!="undefined"&&navigator.userAgent||"");F.test=function(b){for(var p=0;p<b.length;++p){var v=b[p];if(typeof v=="string"&&v in F)return!0}return!1};function M(b){return b.split(".").length}function D(b,p){var v=[],I;if(Array.prototype.map)return Array.prototype.map.call(b,p);for(I=0;I<b.length;I++)v.push(p(b[I]));return v}function E(b){for(var p=Math.max(M(b[0]),M(b[1])),v=D(b,function(I){var x=p-M(I);return I=I+new Array(x+1).join(".0"),D(I.split("."),function(S){return new Array(20-S.length).join("0")+S}).reverse()});--p>=0;){if(v[0][p]>v[1][p])return 1;if(v[0][p]===v[1][p]){if(p===0)return 0}else return-1}}function g(b,p,v){var I=F;typeof p=="string"&&(v=p,p=void 0),p===void 0&&(p=!1),v&&(I=d(v));var x=""+I.version;for(var S in b)if(b.hasOwnProperty(S)&&I[S]){if(typeof b[S]!="string")throw new Error("Browser version in the minVersion map should be a string: "+S+": "+String(b));return E([x,b[S]])<0}return p}function h(b,p,v){return!g(b,p,v)}return F.isUnsupportedBrowser=g,F.compareVersions=E,F.check=h,F._detect=d,F.detect=d,F})},{}],71:[function(l,G,N){},{}],72:[function(l,G,N){var y=l("buffer").Buffer,d=y.isEncoding||function(h){switch(h&&h.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function F(h){if(h&&!d(h))throw new Error("Unknown encoding: "+h)}var M=N.StringDecoder=function(h){this.encoding=(h||"utf8").toLowerCase().replace(/[-_]/,""),F(h);switch(this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=E;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=g;break;default:this.write=D;return}this.charBuffer=new y(6),this.charReceived=0,this.charLength=0};M.prototype.write=function(h){for(var b="";this.charLength;){var p=h.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:h.length;if(h.copy(this.charBuffer,this.charReceived,0,p),this.charReceived+=p,this.charReceived<this.charLength)return"";h=h.slice(p,h.length),b=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var I=b.charCodeAt(b.length-1);if(I>=55296&&I<=56319){this.charLength+=this.surrogateSize,b="";continue}if(this.charReceived=this.charLength=0,h.length===0)return b;break}this.detectIncompleteChar(h);var v=h.length;this.charLength&&(h.copy(this.charBuffer,0,h.length-this.charReceived,v),v-=this.charReceived),b+=h.toString(this.encoding,0,v);var v=b.length-1,I=b.charCodeAt(v);if(I>=55296&&I<=56319){var x=this.surrogateSize;return this.charLength+=x,this.charReceived+=x,this.charBuffer.copy(this.charBuffer,x,0,x),h.copy(this.charBuffer,0,0,x),b.substring(0,v)}return b},M.prototype.detectIncompleteChar=function(h){for(var b=h.length>=3?3:h.length;b>0;b--){var p=h[h.length-b];if(b==1&&p>>5==6){this.charLength=2;break}if(b<=2&&p>>4==14){this.charLength=3;break}if(b<=3&&p>>3==30){this.charLength=4;break}}this.charReceived=b},M.prototype.end=function(h){var b="";if(h&&h.length&&(b=this.write(h)),this.charReceived){var p=this.charReceived,v=this.charBuffer,I=this.encoding;b+=v.slice(0,p).toString(I)}return b};function D(h){return h.toString(this.encoding)}function E(h){this.charReceived=h.length%2,this.charLength=this.charReceived?2:0}function g(h){this.charReceived=h.length%3,this.charLength=this.charReceived?3:0}},{buffer:73}],73:[function(l,G,N){(function(y,d){/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/"use strict";var F=l("base64-js"),M=l("ieee754"),D=l("isarray");N.Buffer=d,N.SlowBuffer=z,N.INSPECT_MAX_BYTES=50,d.TYPED_ARRAY_SUPPORT=y.TYPED_ARRAY_SUPPORT!==void 0?y.TYPED_ARRAY_SUPPORT:E(),N.kMaxLength=g();function E(){try{var q=new Uint8Array(1);return q.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},q.foo()===42&&typeof q.subarray=="function"&&q.subarray(1,1).byteLength===0}catch(m){return!1}}function g(){return d.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function h(q,m){if(g()<m)throw new RangeError("Invalid typed array length");return d.TYPED_ARRAY_SUPPORT?(q=new Uint8Array(m),q.__proto__=d.prototype):(q===null&&(q=new d(m)),q.length=m),q}function d(q,m,c){if(!d.TYPED_ARRAY_SUPPORT&&!(this instanceof d))return new d(q,m,c);if(typeof q=="number"){if(typeof m=="string")throw new Error("If encoding is specified then the first argument must be a string");return I(this,q)}return b(this,q,m,c)}d.poolSize=8192,d._augment=function(q){return q.__proto__=d.prototype,q};function b(q,m,c,R){if(typeof m=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&m instanceof ArrayBuffer?H(q,m,c,R):typeof m=="string"?x(q,m,c):B(q,m)}d.from=function(q,m,c){return b(null,q,m,c)},d.TYPED_ARRAY_SUPPORT&&(d.prototype.__proto__=Uint8Array.prototype,d.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&d[Symbol.species]===d&&Object.defineProperty(d,Symbol.species,{value:null,configurable:!0}));function p(q){if(typeof q!="number")throw new TypeError('"size" argument must be a number');if(q<0)throw new RangeError('"size" argument must not be negative')}function v(q,m,c,R){return p(m),m<=0?h(q,m):c!==void 0?typeof R=="string"?h(q,m).fill(c,R):h(q,m).fill(c):h(q,m)}d.alloc=function(q,m,c){return v(null,q,m,c)};function I(q,m){if(p(m),q=h(q,m<0?0:Q(m)|0),!d.TYPED_ARRAY_SUPPORT)for(var c=0;c<m;++c)q[c]=0;return q}d.allocUnsafe=function(q){return I(null,q)},d.allocUnsafeSlow=function(q){return I(null,q)};function x(q,m,c){if((typeof c!="string"||c==="")&&(c="utf8"),!d.isEncoding(c))throw new TypeError('"encoding" must be a valid string encoding');var R=K(m,c)|0;q=h(q,R);var fe=q.write(m,c);return fe!==R&&(q=q.slice(0,fe)),q}function S(q,m){var c=m.length<0?0:Q(m.length)|0;q=h(q,c);for(var R=0;R<c;R+=1)q[R]=m[R]&255;return q}function H(q,m,c,R){if(m.byteLength,c<0||m.byteLength<c)throw new RangeError("'offset' is out of bounds");if(m.byteLength<c+(R||0))throw new RangeError("'length' is out of bounds");return c===void 0&&R===void 0?m=new Uint8Array(m):R===void 0?m=new Uint8Array(m,c):m=new Uint8Array(m,c,R),d.TYPED_ARRAY_SUPPORT?(q=m,q.__proto__=d.prototype):q=S(q,m),q}function B(q,m){if(d.isBuffer(m)){var c=Q(m.length)|0;return q=h(q,c),q.length===0||m.copy(q,0,0,c),q}if(m){if(typeof ArrayBuffer!="undefined"&&m.buffer instanceof ArrayBuffer||"length"in m)return typeof m.length!="number"||Ke(m.length)?h(q,0):S(q,m);if(m.type==="Buffer"&&D(m.data))return S(q,m.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Q(q){if(q>=g())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+g().toString(16)+" bytes");return q|0}function z(q){return+q!=q&&(q=0),d.alloc(+q)}d.isBuffer=function(m){return!!(m!=null&&m._isBuffer)},d.compare=function(m,c){if(!d.isBuffer(m)||!d.isBuffer(c))throw new TypeError("Arguments must be Buffers");if(m===c)return 0;for(var R=m.length,fe=c.length,ve=0,Re=Math.min(R,fe);ve<Re;++ve)if(m[ve]!==c[ve]){R=m[ve],fe=c[ve];break}return R<fe?-1:fe<R?1:0},d.isEncoding=function(m){switch(String(m).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.concat=function(m,c){if(!D(m))throw new TypeError('"list" argument must be an Array of Buffers');if(m.length===0)return d.alloc(0);var R;if(c===void 0)for(c=0,R=0;R<m.length;++R)c+=m[R].length;var fe=d.allocUnsafe(c),ve=0;for(R=0;R<m.length;++R){var Re=m[R];if(!d.isBuffer(Re))throw new TypeError('"list" argument must be an Array of Buffers');Re.copy(fe,ve),ve+=Re.length}return fe};function K(q,m){if(d.isBuffer(q))return q.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(q)||q instanceof ArrayBuffer))return q.byteLength;typeof q!="string"&&(q=""+q);var c=q.length;if(c===0)return 0;for(var R=!1;;)switch(m){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":case void 0:return Pe(q).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return ye(q).length;default:if(R)return Pe(q).length;m=(""+m).toLowerCase(),R=!0}}d.byteLength=K;function J(q,m,c){var R=!1;if((m===void 0||m<0)&&(m=0),m>this.length)return"";if((c===void 0||c>this.length)&&(c=this.length),c<=0)return"";if(c>>>=0,m>>>=0,c<=m)return"";for(q||(q="utf8");;)switch(q){case"hex":return W(this,m,c);case"utf8":case"utf-8":return _e(this,m,c);case"ascii":return $(this,m,c);case"latin1":case"binary":return ne(this,m,c);case"base64":return le(this,m,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ie(this,m,c);default:if(R)throw new TypeError("Unknown encoding: "+q);q=(q+"").toLowerCase(),R=!0}}d.prototype._isBuffer=!0;function U(q,m,c){var R=q[m];q[m]=q[c],q[c]=R}d.prototype.swap16=function(){var m=this.length;if(m%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var c=0;c<m;c+=2)U(this,c,c+1);return this},d.prototype.swap32=function(){var m=this.length;if(m%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var c=0;c<m;c+=4)U(this,c,c+3),U(this,c+1,c+2);return this},d.prototype.swap64=function(){var m=this.length;if(m%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var c=0;c<m;c+=8)U(this,c,c+7),U(this,c+1,c+6),U(this,c+2,c+5),U(this,c+3,c+4);return this},d.prototype.toString=function(){var m=this.length|0;return m===0?"":arguments.length===0?_e(this,0,m):J.apply(this,arguments)},d.prototype.equals=function(m){if(!d.isBuffer(m))throw new TypeError("Argument must be a Buffer");return this===m?!0:d.compare(this,m)===0},d.prototype.inspect=function(){var m="",c=N.INSPECT_MAX_BYTES;return this.length>0&&(m=this.toString("hex",0,c).match(/.{2}/g).join(" "),this.length>c&&(m+=" ... ")),"<Buffer "+m+">"},d.prototype.compare=function(m,c,R,fe,ve){if(!d.isBuffer(m))throw new TypeError("Argument must be a Buffer");if(c===void 0&&(c=0),R===void 0&&(R=m?m.length:0),fe===void 0&&(fe=0),ve===void 0&&(ve=this.length),c<0||R>m.length||fe<0||ve>this.length)throw new RangeError("out of range index");if(fe>=ve&&c>=R)return 0;if(fe>=ve)return-1;if(c>=R)return 1;if(c>>>=0,R>>>=0,fe>>>=0,ve>>>=0,this===m)return 0;for(var Re=ve-fe,qe=R-c,nt=Math.min(Re,qe),st=this.slice(fe,ve),bt=m.slice(c,R),dt=0;dt<nt;++dt)if(st[dt]!==bt[dt]){Re=st[dt],qe=bt[dt];break}return Re<qe?-1:qe<Re?1:0};function j(q,m,c,R,fe){if(q.length===0)return-1;if(typeof c=="string"?(R=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,isNaN(c)&&(c=fe?0:q.length-1),c<0&&(c=q.length+c),c>=q.length){if(fe)return-1;c=q.length-1}else if(c<0)if(fe)c=0;else return-1;if(typeof m=="string"&&(m=d.from(m,R)),d.isBuffer(m))return m.length===0?-1:T(q,m,c,R,fe);if(typeof m=="number")return m=m&255,d.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?fe?Uint8Array.prototype.indexOf.call(q,m,c):Uint8Array.prototype.lastIndexOf.call(q,m,c):T(q,[m],c,R,fe);throw new TypeError("val must be string, number or Buffer")}function T(q,m,c,R,fe){var ve=1,Re=q.length,qe=m.length;if(R!==void 0&&(R=String(R).toLowerCase(),R==="ucs2"||R==="ucs-2"||R==="utf16le"||R==="utf-16le")){if(q.length<2||m.length<2)return-1;ve=2,Re/=2,qe/=2,c/=2}function nt(It,at){return ve===1?It[at]:It.readUInt16BE(at*ve)}var st;if(fe){var bt=-1;for(st=c;st<Re;st++)if(nt(q,st)===nt(m,bt===-1?0:st-bt)){if(bt===-1&&(bt=st),st-bt+1===qe)return bt*ve}else bt!==-1&&(st-=st-bt),bt=-1}else for(c+qe>Re&&(c=Re-qe),st=c;st>=0;st--){for(var dt=!0,Et=0;Et<qe;Et++)if(nt(q,st+Et)!==nt(m,Et)){dt=!1;break}if(dt)return st}return-1}d.prototype.includes=function(m,c,R){return this.indexOf(m,c,R)!==-1},d.prototype.indexOf=function(m,c,R){return j(this,m,c,R,!0)},d.prototype.lastIndexOf=function(m,c,R){return j(this,m,c,R,!1)};function te(q,m,c,R){c=Number(c)||0;var fe=q.length-c;R?(R=Number(R),R>fe&&(R=fe)):R=fe;var ve=m.length;if(ve%2!==0)throw new TypeError("Invalid hex string");R>ve/2&&(R=ve/2);for(var Re=0;Re<R;++Re){var qe=parseInt(m.substr(Re*2,2),16);if(isNaN(qe))return Re;q[c+Re]=qe}return Re}function Z(q,m,c,R){return be(Pe(m,q.length-c),q,c,R)}function _(q,m,c,R){return be(He(m),q,c,R)}function Y(q,m,c,R){return _(q,m,c,R)}function re(q,m,c,R){return be(ye(m),q,c,R)}function pe(q,m,c,R){return be(ot(m,q.length-c),q,c,R)}d.prototype.write=function(m,c,R,fe){if(c===void 0)fe="utf8",R=this.length,c=0;else if(R===void 0&&typeof c=="string")fe=c,R=this.length,c=0;else if(isFinite(c))c=c|0,isFinite(R)?(R=R|0,fe===void 0&&(fe="utf8")):(fe=R,R=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var ve=this.length-c;if((R===void 0||R>ve)&&(R=ve),m.length>0&&(R<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");fe||(fe="utf8");for(var Re=!1;;)switch(fe){case"hex":return te(this,m,c,R);case"utf8":case"utf-8":return Z(this,m,c,R);case"ascii":return _(this,m,c,R);case"latin1":case"binary":return Y(this,m,c,R);case"base64":return re(this,m,c,R);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pe(this,m,c,R);default:if(Re)throw new TypeError("Unknown encoding: "+fe);fe=(""+fe).toLowerCase(),Re=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function le(q,m,c){return m===0&&c===q.length?F.fromByteArray(q):F.fromByteArray(q.slice(m,c))}function _e(q,m,c){c=Math.min(q.length,c);for(var R=[],fe=m;fe<c;){var ve=q[fe],Re=null,qe=ve>239?4:ve>223?3:ve>191?2:1;if(fe+qe<=c){var nt,st,bt,dt;switch(qe){case 1:ve<128&&(Re=ve);break;case 2:nt=q[fe+1],(nt&192)===128&&(dt=(ve&31)<<6|nt&63,dt>127&&(Re=dt));break;case 3:nt=q[fe+1],st=q[fe+2],(nt&192)===128&&(st&192)===128&&(dt=(ve&15)<<12|(nt&63)<<6|st&63,dt>2047&&(dt<55296||dt>57343)&&(Re=dt));break;case 4:nt=q[fe+1],st=q[fe+2],bt=q[fe+3],(nt&192)===128&&(st&192)===128&&(bt&192)===128&&(dt=(ve&15)<<18|(nt&63)<<12|(st&63)<<6|bt&63,dt>65535&&dt<1114112&&(Re=dt))}}Re===null?(Re=65533,qe=1):Re>65535&&(Re-=65536,R.push(Re>>>10&1023|55296),Re=56320|Re&1023),R.push(Re),fe+=qe}return ke(R)}var me=4096;function ke(q){var m=q.length;if(m<=me)return String.fromCharCode.apply(String,q);for(var c="",R=0;R<m;)c+=String.fromCharCode.apply(String,q.slice(R,R+=me));return c}function $(q,m,c){var R="";c=Math.min(q.length,c);for(var fe=m;fe<c;++fe)R+=String.fromCharCode(q[fe]&127);return R}function ne(q,m,c){var R="";c=Math.min(q.length,c);for(var fe=m;fe<c;++fe)R+=String.fromCharCode(q[fe]);return R}function W(q,m,c){var R=q.length;(!m||m<0)&&(m=0),(!c||c<0||c>R)&&(c=R);for(var fe="",ve=m;ve<c;++ve)fe+=Fe(q[ve]);return fe}function ie(q,m,c){for(var R=q.slice(m,c),fe="",ve=0;ve<R.length;ve+=2)fe+=String.fromCharCode(R[ve]+R[ve+1]*256);return fe}d.prototype.slice=function(m,c){var R=this.length;m=~~m,c=c===void 0?R:~~c,m<0?(m+=R,m<0&&(m=0)):m>R&&(m=R),c<0?(c+=R,c<0&&(c=0)):c>R&&(c=R),c<m&&(c=m);var fe;if(d.TYPED_ARRAY_SUPPORT)fe=this.subarray(m,c),fe.__proto__=d.prototype;else{var ve=c-m;fe=new d(ve,void 0);for(var Re=0;Re<ve;++Re)fe[Re]=this[Re+m]}return fe};function de(q,m,c){if(q%1!==0||q<0)throw new RangeError("offset is not uint");if(q+m>c)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUIntLE=function(m,c,R){m=m|0,c=c|0,R||de(m,c,this.length);for(var fe=this[m],ve=1,Re=0;++Re<c&&(ve*=256);)fe+=this[m+Re]*ve;return fe},d.prototype.readUIntBE=function(m,c,R){m=m|0,c=c|0,R||de(m,c,this.length);for(var fe=this[m+--c],ve=1;c>0&&(ve*=256);)fe+=this[m+--c]*ve;return fe},d.prototype.readUInt8=function(m,c){return c||de(m,1,this.length),this[m]},d.prototype.readUInt16LE=function(m,c){return c||de(m,2,this.length),this[m]|this[m+1]<<8},d.prototype.readUInt16BE=function(m,c){return c||de(m,2,this.length),this[m]<<8|this[m+1]},d.prototype.readUInt32LE=function(m,c){return c||de(m,4,this.length),(this[m]|this[m+1]<<8|this[m+2]<<16)+this[m+3]*16777216},d.prototype.readUInt32BE=function(m,c){return c||de(m,4,this.length),this[m]*16777216+(this[m+1]<<16|this[m+2]<<8|this[m+3])},d.prototype.readIntLE=function(m,c,R){m=m|0,c=c|0,R||de(m,c,this.length);for(var fe=this[m],ve=1,Re=0;++Re<c&&(ve*=256);)fe+=this[m+Re]*ve;return ve*=128,fe>=ve&&(fe-=Math.pow(2,8*c)),fe},d.prototype.readIntBE=function(m,c,R){m=m|0,c=c|0,R||de(m,c,this.length);for(var fe=c,ve=1,Re=this[m+--fe];fe>0&&(ve*=256);)Re+=this[m+--fe]*ve;return ve*=128,Re>=ve&&(Re-=Math.pow(2,8*c)),Re},d.prototype.readInt8=function(m,c){return c||de(m,1,this.length),this[m]&128?(255-this[m]+1)*-1:this[m]},d.prototype.readInt16LE=function(m,c){c||de(m,2,this.length);var R=this[m]|this[m+1]<<8;return R&32768?R|4294901760:R},d.prototype.readInt16BE=function(m,c){c||de(m,2,this.length);var R=this[m+1]|this[m]<<8;return R&32768?R|4294901760:R},d.prototype.readInt32LE=function(m,c){return c||de(m,4,this.length),this[m]|this[m+1]<<8|this[m+2]<<16|this[m+3]<<24},d.prototype.readInt32BE=function(m,c){return c||de(m,4,this.length),this[m]<<24|this[m+1]<<16|this[m+2]<<8|this[m+3]},d.prototype.readFloatLE=function(m,c){return c||de(m,4,this.length),M.read(this,m,!0,23,4)},d.prototype.readFloatBE=function(m,c){return c||de(m,4,this.length),M.read(this,m,!1,23,4)},d.prototype.readDoubleLE=function(m,c){return c||de(m,8,this.length),M.read(this,m,!0,52,8)},d.prototype.readDoubleBE=function(m,c){return c||de(m,8,this.length),M.read(this,m,!1,52,8)};function ee(q,m,c,R,fe,ve){if(!d.isBuffer(q))throw new TypeError('"buffer" argument must be a Buffer instance');if(m>fe||m<ve)throw new RangeError('"value" argument is out of bounds');if(c+R>q.length)throw new RangeError("Index out of range")}d.prototype.writeUIntLE=function(m,c,R,fe){if(m=+m,c=c|0,R=R|0,!fe){var ve=Math.pow(2,8*R)-1;ee(this,m,c,R,ve,0)}var Re=1,qe=0;for(this[c]=m&255;++qe<R&&(Re*=256);)this[c+qe]=m/Re&255;return c+R},d.prototype.writeUIntBE=function(m,c,R,fe){if(m=+m,c=c|0,R=R|0,!fe){var ve=Math.pow(2,8*R)-1;ee(this,m,c,R,ve,0)}var Re=R-1,qe=1;for(this[c+Re]=m&255;--Re>=0&&(qe*=256);)this[c+Re]=m/qe&255;return c+R},d.prototype.writeUInt8=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,1,255,0),d.TYPED_ARRAY_SUPPORT||(m=Math.floor(m)),this[c]=m&255,c+1};function Ce(q,m,c,R){m<0&&(m=65535+m+1);for(var fe=0,ve=Math.min(q.length-c,2);fe<ve;++fe)q[c+fe]=(m&255<<8*(R?fe:1-fe))>>>(R?fe:1-fe)*8}d.prototype.writeUInt16LE=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,2,65535,0),d.TYPED_ARRAY_SUPPORT?(this[c]=m&255,this[c+1]=m>>>8):Ce(this,m,c,!0),c+2},d.prototype.writeUInt16BE=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,2,65535,0),d.TYPED_ARRAY_SUPPORT?(this[c]=m>>>8,this[c+1]=m&255):Ce(this,m,c,!1),c+2};function De(q,m,c,R){m<0&&(m=4294967295+m+1);for(var fe=0,ve=Math.min(q.length-c,4);fe<ve;++fe)q[c+fe]=m>>>(R?fe:3-fe)*8&255}d.prototype.writeUInt32LE=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,4,4294967295,0),d.TYPED_ARRAY_SUPPORT?(this[c+3]=m>>>24,this[c+2]=m>>>16,this[c+1]=m>>>8,this[c]=m&255):De(this,m,c,!0),c+4},d.prototype.writeUInt32BE=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,4,4294967295,0),d.TYPED_ARRAY_SUPPORT?(this[c]=m>>>24,this[c+1]=m>>>16,this[c+2]=m>>>8,this[c+3]=m&255):De(this,m,c,!1),c+4},d.prototype.writeIntLE=function(m,c,R,fe){if(m=+m,c=c|0,!fe){var ve=Math.pow(2,8*R-1);ee(this,m,c,R,ve-1,-ve)}var Re=0,qe=1,nt=0;for(this[c]=m&255;++Re<R&&(qe*=256);)m<0&&nt===0&&this[c+Re-1]!==0&&(nt=1),this[c+Re]=(m/qe>>0)-nt&255;return c+R},d.prototype.writeIntBE=function(m,c,R,fe){if(m=+m,c=c|0,!fe){var ve=Math.pow(2,8*R-1);ee(this,m,c,R,ve-1,-ve)}var Re=R-1,qe=1,nt=0;for(this[c+Re]=m&255;--Re>=0&&(qe*=256);)m<0&&nt===0&&this[c+Re+1]!==0&&(nt=1),this[c+Re]=(m/qe>>0)-nt&255;return c+R},d.prototype.writeInt8=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,1,127,-128),d.TYPED_ARRAY_SUPPORT||(m=Math.floor(m)),m<0&&(m=255+m+1),this[c]=m&255,c+1},d.prototype.writeInt16LE=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,2,32767,-32768),d.TYPED_ARRAY_SUPPORT?(this[c]=m&255,this[c+1]=m>>>8):Ce(this,m,c,!0),c+2},d.prototype.writeInt16BE=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,2,32767,-32768),d.TYPED_ARRAY_SUPPORT?(this[c]=m>>>8,this[c+1]=m&255):Ce(this,m,c,!1),c+2},d.prototype.writeInt32LE=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,4,2147483647,-2147483648),d.TYPED_ARRAY_SUPPORT?(this[c]=m&255,this[c+1]=m>>>8,this[c+2]=m>>>16,this[c+3]=m>>>24):De(this,m,c,!0),c+4},d.prototype.writeInt32BE=function(m,c,R){return m=+m,c=c|0,R||ee(this,m,c,4,2147483647,-2147483648),m<0&&(m=4294967295+m+1),d.TYPED_ARRAY_SUPPORT?(this[c]=m>>>24,this[c+1]=m>>>16,this[c+2]=m>>>8,this[c+3]=m&255):De(this,m,c,!1),c+4};function Le(q,m,c,R,fe,ve){if(c+R>q.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function Ye(q,m,c,R,fe){return fe||Le(q,m,c,4,34028234663852886e22,-34028234663852886e22),M.write(q,m,c,R,23,4),c+4}d.prototype.writeFloatLE=function(m,c,R){return Ye(this,m,c,!0,R)},d.prototype.writeFloatBE=function(m,c,R){return Ye(this,m,c,!1,R)};function et(q,m,c,R,fe){return fe||Le(q,m,c,8,17976931348623157e292,-17976931348623157e292),M.write(q,m,c,R,52,8),c+8}d.prototype.writeDoubleLE=function(m,c,R){return et(this,m,c,!0,R)},d.prototype.writeDoubleBE=function(m,c,R){return et(this,m,c,!1,R)},d.prototype.copy=function(m,c,R,fe){if(R||(R=0),!fe&&fe!==0&&(fe=this.length),c>=m.length&&(c=m.length),c||(c=0),fe>0&&fe<R&&(fe=R),fe===R)return 0;if(m.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(R<0||R>=this.length)throw new RangeError("sourceStart out of bounds");if(fe<0)throw new RangeError("sourceEnd out of bounds");fe>this.length&&(fe=this.length),m.length-c<fe-R&&(fe=m.length-c+R);var ve=fe-R,Re;if(this===m&&R<c&&c<fe)for(Re=ve-1;Re>=0;--Re)m[Re+c]=this[Re+R];else if(ve<1e3||!d.TYPED_ARRAY_SUPPORT)for(Re=0;Re<ve;++Re)m[Re+c]=this[Re+R];else Uint8Array.prototype.set.call(m,this.subarray(R,R+ve),c);return ve},d.prototype.fill=function(m,c,R,fe){if(typeof m=="string"){if(typeof c=="string"?(fe=c,c=0,R=this.length):typeof R=="string"&&(fe=R,R=this.length),m.length===1){var ve=m.charCodeAt(0);ve<256&&(m=ve)}if(fe!==void 0&&typeof fe!="string")throw new TypeError("encoding must be a string");if(typeof fe=="string"&&!d.isEncoding(fe))throw new TypeError("Unknown encoding: "+fe)}else typeof m=="number"&&(m=m&255);if(c<0||this.length<c||this.length<R)throw new RangeError("Out of range index");if(R<=c)return this;c=c>>>0,R=R===void 0?this.length:R>>>0,m||(m=0);var Re;if(typeof m=="number")for(Re=c;Re<R;++Re)this[Re]=m;else{var qe=d.isBuffer(m)?m:Pe(new d(m,fe).toString()),nt=qe.length;for(Re=0;Re<R-c;++Re)this[Re+c]=qe[Re%nt]}return this};var Ae=/[^+\/0-9A-Za-z-_]/g;function ct(q){if(q=$e(q).replace(Ae,""),q.length<2)return"";for(;q.length%4!==0;)q=q+"=";return q}function $e(q){return q.trim?q.trim():q.replace(/^\s+|\s+$/g,"")}function Fe(q){return q<16?"0"+q.toString(16):q.toString(16)}function Pe(q,m){m=m||Infinity;for(var c,R=q.length,fe=null,ve=[],Re=0;Re<R;++Re){if(c=q.charCodeAt(Re),c>55295&&c<57344){if(!fe){if(c>56319){(m-=3)>-1&&ve.push(239,191,189);continue}else if(Re+1===R){(m-=3)>-1&&ve.push(239,191,189);continue}fe=c;continue}if(c<56320){(m-=3)>-1&&ve.push(239,191,189),fe=c;continue}c=(fe-55296<<10|c-56320)+65536}else fe&&((m-=3)>-1&&ve.push(239,191,189));if(fe=null,c<128){if((m-=1)<0)break;ve.push(c)}else if(c<2048){if((m-=2)<0)break;ve.push(c>>6|192,c&63|128)}else if(c<65536){if((m-=3)<0)break;ve.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((m-=4)<0)break;ve.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return ve}function He(q){for(var m=[],c=0;c<q.length;++c)m.push(q.charCodeAt(c)&255);return m}function ot(q,m){for(var c,R,fe,ve=[],Re=0;Re<q.length&&!((m-=2)<0);++Re)c=q.charCodeAt(Re),R=c>>8,fe=c%256,ve.push(fe),ve.push(R);return ve}function ye(q){return F.toByteArray(ct(q))}function be(q,m,c,R){for(var fe=0;fe<R&&!(fe+c>=m.length||fe>=q.length);++fe)m[fe+c]=q[fe];return fe}function Ke(q){return q!==q}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{},l("buffer").Buffer)},{"base64-js":69,buffer:73,ieee754:195,isarray:198}],74:[function(l,G,N){G.exports={"100":"Continue","101":"Switching Protocols","102":"Processing","200":"OK","201":"Created","202":"Accepted","203":"Non-Authoritative Information","204":"No Content","205":"Reset Content","206":"Partial Content","207":"Multi-Status","208":"Already Reported","226":"IM Used","300":"Multiple Choices","301":"Moved Permanently","302":"Found","303":"See Other","304":"Not Modified","305":"Use Proxy","307":"Temporary Redirect","308":"Permanent Redirect","400":"Bad Request","401":"Unauthorized","402":"Payment Required","403":"Forbidden","404":"Not Found","405":"Method Not Allowed","406":"Not Acceptable","407":"Proxy Authentication Required","408":"Request Timeout","409":"Conflict","410":"Gone","411":"Length Required","412":"Precondition Failed","413":"Payload Too Large","414":"URI Too Long","415":"Unsupported Media Type","416":"Range Not Satisfiable","417":"Expectation Failed","418":"I'm a teapot","421":"Misdirected Request","422":"Unprocessable Entity","423":"Locked","424":"Failed Dependency","425":"Unordered Collection","426":"Upgrade Required","428":"Precondition Required","429":"Too Many Requests","431":"Request Header Fields Too Large","451":"Unavailable For Legal Reasons","500":"Internal Server Error","501":"Not Implemented","502":"Bad Gateway","503":"Service Unavailable","504":"Gateway Timeout","505":"HTTP Version Not Supported","506":"Variant Also Negotiates","507":"Insufficient Storage","508":"Loop Detected","509":"Bandwidth Limit Exceeded","510":"Not Extended","511":"Network Authentication Required"}},{}],75:[function(l,G,N){G.exports={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:512,O_EXCL:2048,O_NOCTTY:131072,O_TRUNC:1024,O_APPEND:8,O_DIRECTORY:1048576,O_NOFOLLOW:256,O_SYNC:128,O_SYMLINK:2097152,O_NONBLOCK:4,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,E2BIG:7,EACCES:13,EADDRINUSE:48,EADDRNOTAVAIL:49,EAFNOSUPPORT:47,EAGAIN:35,EALREADY:37,EBADF:9,EBADMSG:94,EBUSY:16,ECANCELED:89,ECHILD:10,ECONNABORTED:53,ECONNREFUSED:61,ECONNRESET:54,EDEADLK:11,EDESTADDRREQ:39,EDOM:33,EDQUOT:69,EEXIST:17,EFAULT:14,EFBIG:27,EHOSTUNREACH:65,EIDRM:90,EILSEQ:92,EINPROGRESS:36,EINTR:4,EINVAL:22,EIO:5,EISCONN:56,EISDIR:21,ELOOP:62,EMFILE:24,EMLINK:31,EMSGSIZE:40,EMULTIHOP:95,ENAMETOOLONG:63,ENETDOWN:50,ENETRESET:52,ENETUNREACH:51,ENFILE:23,ENOBUFS:55,ENODATA:96,ENODEV:19,ENOENT:2,ENOEXEC:8,ENOLCK:77,ENOLINK:97,ENOMEM:12,ENOMSG:91,ENOPROTOOPT:42,ENOSPC:28,ENOSR:98,ENOSTR:99,ENOSYS:78,ENOTCONN:57,ENOTDIR:20,ENOTEMPTY:66,ENOTSOCK:38,ENOTSUP:45,ENOTTY:25,ENXIO:6,EOPNOTSUPP:102,EOVERFLOW:84,EPERM:1,EPIPE:32,EPROTO:100,EPROTONOSUPPORT:43,EPROTOTYPE:41,ERANGE:34,EROFS:30,ESPIPE:29,ESRCH:3,ESTALE:70,ETIME:101,ETIMEDOUT:60,ETXTBSY:26,EWOULDBLOCK:35,EXDEV:18,SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGTRAP:5,SIGABRT:6,SIGIOT:6,SIGBUS:10,SIGFPE:8,SIGKILL:9,SIGUSR1:30,SIGSEGV:11,SIGUSR2:31,SIGPIPE:13,SIGALRM:14,SIGTERM:15,SIGCHLD:20,SIGCONT:19,SIGSTOP:17,SIGTSTP:18,SIGTTIN:21,SIGTTOU:22,SIGURG:16,SIGXCPU:24,SIGXFSZ:25,SIGVTALRM:26,SIGPROF:27,SIGWINCH:28,SIGIO:23,SIGSYS:12,SSL_OP_ALL:2147486719,SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION:262144,SSL_OP_CIPHER_SERVER_PREFERENCE:4194304,SSL_OP_CISCO_ANYCONNECT:32768,SSL_OP_COOKIE_EXCHANGE:8192,SSL_OP_CRYPTOPRO_TLSEXT_BUG:2147483648,SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS:2048,SSL_OP_EPHEMERAL_RSA:0,SSL_OP_LEGACY_SERVER_CONNECT:4,SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER:32,SSL_OP_MICROSOFT_SESS_ID_BUG:1,SSL_OP_MSIE_SSLV2_RSA_PADDING:0,SSL_OP_NETSCAPE_CA_DN_BUG:536870912,SSL_OP_NETSCAPE_CHALLENGE_BUG:2,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG:1073741824,SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG:8,SSL_OP_NO_COMPRESSION:131072,SSL_OP_NO_QUERY_MTU:4096,SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION:65536,SSL_OP_NO_SSLv2:16777216,SSL_OP_NO_SSLv3:33554432,SSL_OP_NO_TICKET:16384,SSL_OP_NO_TLSv1:67108864,SSL_OP_NO_TLSv1_1:268435456,SSL_OP_NO_TLSv1_2:134217728,SSL_OP_PKCS1_CHECK_1:0,SSL_OP_PKCS1_CHECK_2:0,SSL_OP_SINGLE_DH_USE:1048576,SSL_OP_SINGLE_ECDH_USE:524288,SSL_OP_SSLEAY_080_CLIENT_DH_BUG:128,SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG:0,SSL_OP_TLS_BLOCK_PADDING_BUG:512,SSL_OP_TLS_D5_BUG:256,SSL_OP_TLS_ROLLBACK_BUG:8388608,ENGINE_METHOD_DSA:2,ENGINE_METHOD_DH:4,ENGINE_METHOD_RAND:8,ENGINE_METHOD_ECDH:16,ENGINE_METHOD_ECDSA:32,ENGINE_METHOD_CIPHERS:64,ENGINE_METHOD_DIGESTS:128,ENGINE_METHOD_STORE:256,ENGINE_METHOD_PKEY_METHS:512,ENGINE_METHOD_PKEY_ASN1_METHS:1024,ENGINE_METHOD_ALL:65535,ENGINE_METHOD_NONE:0,DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_UDP_REUSEADDR:4}},{}],76:[function(l,G,N){/*!
* copy-to - index.js
* Copyright(c) 2014 dead_horse <dead_horse@qq.com>
* MIT Licensed
*/"use strict";var y=Array.prototype.slice;G.exports=d;function d(M,D){if(!(this instanceof d))return new d(M,D);this.src=M,this._withAccess=D}d.prototype.withAccess=function(M){return this._withAccess=M!==!1,this},d.prototype.pick=function(M){return Array.isArray(M)||(M=y.call(arguments)),M.length&&(this.keys=M),this},d.prototype.to=function(M){if(M=M||{},!this.src)return M;var D=this.keys||Object.keys(this.src);if(!this._withAccess){for(var E=0;E<D.length;E++){if(g=D[E],M[g]!==void 0)continue;M[g]=this.src[g]}return M}for(var E=0;E<D.length;E++){var g=D[E];if(!F(M,g))continue;var h=this.src.__lookupGetter__(g),b=this.src.__lookupSetter__(g);h&&M.__defineGetter__(g,h),b&&M.__defineSetter__(g,b),!h&&!b&&(M[g]=this.src[g])}return M},d.prototype.toCover=function(M){for(var D=this.keys||Object.keys(this.src),E=0;E<D.length;E++){var g=D[E];delete M[g];var h=this.src.__lookupGetter__(g),b=this.src.__lookupSetter__(g);h&&M.__defineGetter__(g,h),b&&M.__defineSetter__(g,b),!h&&!b&&(M[g]=this.src[g])}},d.prototype.override=d.prototype.toCover,d.prototype.and=function(M){var D={};return this.to(D),this.src=M,this.to(D),this.src=D,this};function F(M,D){return M[D]===void 0&&M.__lookupGetter__(D)===void 0&&M.__lookupSetter__(D)===void 0}},{}],77:[function(l,G,N){l("../../modules/es6.string.iterator"),l("../../modules/es6.array.from"),G.exports=l("../../modules/_core").Array.from},{"../../modules/_core":99,"../../modules/es6.array.from":168,"../../modules/es6.string.iterator":180}],78:[function(l,G,N){var y=l("../../modules/_core"),d=y.JSON||(y.JSON={stringify:JSON.stringify});G.exports=function(M){return d.stringify.apply(d,arguments)}},{"../../modules/_core":99}],79:[function(l,G,N){l("../../modules/es6.object.assign"),G.exports=l("../../modules/_core").Object.assign},{"../../modules/_core":99,"../../modules/es6.object.assign":171}],80:[function(l,G,N){l("../../modules/es6.object.create");var y=l("../../modules/_core").Object;G.exports=function(F,M){return y.create(F,M)}},{"../../modules/_core":99,"../../modules/es6.object.create":172}],81:[function(l,G,N){l("../../modules/es6.object.define-property");var y=l("../../modules/_core").Object;G.exports=function(F,M,D){return y.defineProperty(F,M,D)}},{"../../modules/_core":99,"../../modules/es6.object.define-property":173}],82:[function(l,G,N){l("../../modules/es7.object.entries"),G.exports=l("../../modules/_core").Object.entries},{"../../modules/_core":99,"../../modules/es7.object.entries":182}],83:[function(l,G,N){l("../../modules/es6.object.get-own-property-names");var y=l("../../modules/_core").Object;G.exports=function(F){return y.getOwnPropertyNames(F)}},{"../../modules/_core":99,"../../modules/es6.object.get-own-property-names":174}],84:[function(l,G,N){l("../../modules/es6.object.get-prototype-of"),G.exports=l("../../modules/_core").Object.getPrototypeOf},{"../../modules/_core":99,"../../modules/es6.object.get-prototype-of":175}],85:[function(l,G,N){l("../../modules/es6.object.keys"),G.exports=l("../../modules/_core").Object.keys},{"../../modules/_core":99,"../../modules/es6.object.keys":176}],86:[function(l,G,N){l("../modules/es6.object.to-string"),l("../modules/es6.string.iterator"),l("../modules/web.dom.iterable"),l("../modules/es6.promise"),l("../modules/es7.promise.finally"),l("../modules/es7.promise.try"),G.exports=l("../modules/_core").Promise},{"../modules/_core":99,"../modules/es6.object.to-string":177,"../modules/es6.promise":178,"../modules/es6.string.iterator":180,"../modules/es7.promise.finally":183,"../modules/es7.promise.try":184,"../modules/web.dom.iterable":187}],87:[function(l,G,N){l("../modules/web.immediate"),G.exports=l("../modules/_core").setImmediate},{"../modules/_core":99,"../modules/web.immediate":188}],88:[function(l,G,N){l("../../modules/es6.string.from-code-point"),G.exports=l("../../modules/_core").String.fromCodePoint},{"../../modules/_core":99,"../../modules/es6.string.from-code-point":179}],89:[function(l,G,N){l("../../modules/es6.function.has-instance"),G.exports=l("../../modules/_wks-ext").f("hasInstance")},{"../../modules/_wks-ext":165,"../../modules/es6.function.has-instance":170}],90:[function(l,G,N){l("../../modules/es6.symbol"),l("../../modules/es6.object.to-string"),l("../../modules/es7.symbol.async-iterator"),l("../../modules/es7.symbol.observable"),G.exports=l("../../modules/_core").Symbol},{"../../modules/_core":99,"../../modules/es6.object.to-string":177,"../../modules/es6.symbol":181,"../../modules/es7.symbol.async-iterator":185,"../../modules/es7.symbol.observable":186}],91:[function(l,G,N){l("../../modules/es6.string.iterator"),l("../../modules/web.dom.iterable"),G.exports=l("../../modules/_wks-ext").f("iterator")},{"../../modules/_wks-ext":165,"../../modules/es6.string.iterator":180,"../../modules/web.dom.iterable":187}],92:[function(l,G,N){G.exports=function(y){if(typeof y!="function")throw TypeError(y+" is not a function!");return y}},{}],93:[function(l,G,N){G.exports=function(){}},{}],94:[function(l,G,N){G.exports=function(y,d,F,M){if(!(y instanceof d)||M!==void 0&&M in y)throw TypeError(F+": incorrect invocation!");return y}},{}],95:[function(l,G,N){var y=l("./_is-object");G.exports=function(d){if(!y(d))throw TypeError(d+" is not an object!");return d}},{"./_is-object":119}],96:[function(l,G,N){var y=l("./_to-iobject"),d=l("./_to-length"),F=l("./_to-absolute-index");G.exports=function(M){return function(D,E,g){var h=y(D),b=d(h.length),p=F(g,b),v;if(M&&E!=E){for(;b>p;)if(v=h[p++],v!=v)return!0}else for(;b>p;p++)if((M||p in h)&&h[p]===E)return M||p||0;return!M&&-1}}},{"./_to-absolute-index":156,"./_to-iobject":158,"./_to-length":159}],97:[function(l,G,N){var y=l("./_cof"),d=l("./_wks")("toStringTag"),F=y(function(){return arguments}())=="Arguments",M=function(D,E){try{return D[E]}catch(g){}};G.exports=function(D){var E,g,h;return D===void 0?"Undefined":D===null?"Null":typeof(g=M(E=Object(D),d))=="string"?g:F?y(E):(h=y(E))=="Object"&&typeof E.callee=="function"?"Arguments":h}},{"./_cof":98,"./_wks":166}],98:[function(l,G,N){var y={}.toString;G.exports=function(d){return y.call(d).slice(8,-1)}},{}],99:[function(l,G,N){var y=G.exports={version:"2.6.11"};typeof __e=="number"&&(__e=y)},{}],100:[function(l,G,N){"use strict";var y=l("./_object-dp"),d=l("./_property-desc");G.exports=function(F,M,D){M in F?y.f(F,M,d(0,D)):F[M]=D}},{"./_object-dp":132,"./_property-desc":146}],101:[function(l,G,N){var y=l("./_a-function");G.exports=function(d,F,M){if(y(d),F===void 0)return d;switch(M){case 1:return function(D){return d.call(F,D)};case 2:return function(D,E){return d.call(F,D,E)};case 3:return function(D,E,g){return d.call(F,D,E,g)}}return function(){return d.apply(F,arguments)}}},{"./_a-function":92}],102:[function(l,G,N){G.exports=function(y){if(y==null)throw TypeError("Can't call method on "+y);return y}},{}],103:[function(l,G,N){G.exports=!l("./_fails")(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},{"./_fails":108}],104:[function(l,G,N){var y=l("./_is-object"),d=l("./_global").document,F=y(d)&&y(d.createElement);G.exports=function(M){return F?d.createElement(M):{}}},{"./_global":110,"./_is-object":119}],105:[function(l,G,N){G.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},{}],106:[function(l,G,N){var y=l("./_object-keys"),d=l("./_object-gops"),F=l("./_object-pie");G.exports=function(M){var D=y(M),E=d.f;if(E)for(var g=E(M),h=F.f,b=0,p;g.length>b;)h.call(M,p=g[b++])&&D.push(p);return D}},{"./_object-gops":137,"./_object-keys":140,"./_object-pie":141}],107:[function(l,G,N){var y=l("./_global"),d=l("./_core"),F=l("./_ctx"),M=l("./_hide"),D=l("./_has"),E="prototype",g=function(h,b,p){var v=h&g.F,I=h&g.G,x=h&g.S,S=h&g.P,H=h&g.B,B=h&g.W,Q=I?d:d[b]||(d[b]={}),z=Q[E],K=I?y:x?y[b]:(y[b]||{})[E],J,U,j;I&&(p=b);for(J in p){if(U=!v&&K&&K[J]!==void 0,U&&D(Q,J))continue;j=U?K[J]:p[J],Q[J]=I&&typeof K[J]!="function"?p[J]:H&&U?F(j,y):B&&K[J]==j?function(T){var te=function(Z,_,Y){if(this instanceof T){switch(arguments.length){case 0:return new T;case 1:return new T(Z);case 2:return new T(Z,_)}return new T(Z,_,Y)}return T.apply(this,arguments)};return te[E]=T[E],te}(j):S&&typeof j=="function"?F(Function.call,j):j,S&&((Q.virtual||(Q.virtual={}))[J]=j,h&g.R&&z&&!z[J]&&M(z,J,j))}};g.F=1,g.G=2,g.S=4,g.P=8,g.B=16,g.W=32,g.U=64,g.R=128,G.exports=g},{"./_core":99,"./_ctx":101,"./_global":110,"./_has":111,"./_hide":112}],108:[function(l,G,N){G.exports=function(y){try{return!!y()}catch(d){return!0}}},{}],109:[function(l,G,N){var y=l("./_ctx"),d=l("./_iter-call"),F=l("./_is-array-iter"),M=l("./_an-object"),D=l("./_to-length"),E=l("./core.get-iterator-method"),g={},h={},N=G.exports=function(b,p,v,I,x){var S=x?function(){return b}:E(b),H=y(v,I,p?2:1),B=0,Q,z,K,J;if(typeof S!="function")throw TypeError(b+" is not iterable!");if(F(S)){for(Q=D(b.length);Q>B;B++)if(J=p?H(M(z=b[B])[0],z[1]):H(b[B]),J===g||J===h)return J}else for(K=S.call(b);!(z=K.next()).done;)if(J=d(K,H,z.value,p),J===g||J===h)return J};N.BREAK=g,N.RETURN=h},{"./_an-object":95,"./_ctx":101,"./_is-array-iter":117,"./_iter-call":120,"./_to-length":159,"./core.get-iterator-method":167}],110:[function(l,G,N){var y=G.exports=typeof window!="undefined"&&window.Math==Math?window:typeof self!="undefined"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=y)},{}],111:[function(l,G,N){var y={}.hasOwnProperty;G.exports=function(d,F){return y.call(d,F)}},{}],112:[function(l,G,N){var y=l("./_object-dp"),d=l("./_property-desc");G.exports=l("./_descriptors")?function(F,M,D){return y.f(F,M,d(1,D))}:function(F,M,D){return F[M]=D,F}},{"./_descriptors":103,"./_object-dp":132,"./_property-desc":146}],113:[function(l,G,N){var y=l("./_global").document;G.exports=y&&y.documentElement},{"./_global":110}],114:[function(l,G,N){G.exports=!l("./_descriptors")&&!l("./_fails")(function(){return Object.defineProperty(l("./_dom-create")("div"),"a",{get:function(){return 7}}).a!=7})},{"./_descriptors":103,"./_dom-create":104,"./_fails":108}],115:[function(l,G,N){G.exports=function(y,d,F){var M=F===void 0;switch(d.length){case 0:return M?y():y.call(F);case 1:return M?y(d[0]):y.call(F,d[0]);case 2:return M?y(d[0],d[1]):y.call(F,d[0],d[1]);case 3:return M?y(d[0],d[1],d[2]):y.call(F,d[0],d[1],d[2]);case 4:return M?y(d[0],d[1],d[2],d[3]):y.call(F,d[0],d[1],d[2],d[3])}return y.apply(F,d)}},{}],116:[function(l,G,N){var y=l("./_cof");G.exports=Object("z").propertyIsEnumerable(0)?Object:function(d){return y(d)=="String"?d.split(""):Object(d)}},{"./_cof":98}],117:[function(l,G,N){var y=l("./_iterators"),d=l("./_wks")("iterator"),F=Array.prototype;G.exports=function(M){return M!==void 0&&(y.Array===M||F[d]===M)}},{"./_iterators":125,"./_wks":166}],118:[function(l,G,N){var y=l("./_cof");G.exports=Array.isArray||function(F){return y(F)=="Array"}},{"./_cof":98}],119:[function(l,G,N){G.exports=function(y){return typeof y=="object"?y!==null:typeof y=="function"}},{}],120:[function(l,G,N){var y=l("./_an-object");G.exports=function(d,F,M,D){try{return D?F(y(M)[0],M[1]):F(M)}catch(g){var E=d.return;throw E!==void 0&&y(E.call(d)),g}}},{"./_an-object":95}],121:[function(l,G,N){"use strict";var y=l("./_object-create"),d=l("./_property-desc"),F=l("./_set-to-string-tag"),M={};l("./_hide")(M,l("./_wks")("iterator"),function(){return this}),G.exports=function(D,E,g){D.prototype=y(M,{next:d(1,g)}),F(D,E+" Iterator")}},{"./_hide":112,"./_object-create":131,"./_property-desc":146,"./_set-to-string-tag":150,"./_wks":166}],122:[function(l,G,N){"use strict";var y=l("./_library"),d=l("./_export"),F=l("./_redefine"),M=l("./_hide"),D=l("./_iterators"),E=l("./_iter-create"),g=l("./_set-to-string-tag"),h=l("./_object-gpo"),b=l("./_wks")("iterator"),p=!([].keys&&"next"in[].keys()),v="@@iterator",I="keys",x="values",S=function(){return this};G.exports=function(H,B,Q,z,K,J,U){E(Q,B,z);var j=function($){if(!p&&$ in _)return _[$];switch($){case I:return function(){return new Q(this,$)};case x:return function(){return new Q(this,$)}}return function(){return new Q(this,$)}},T=B+" Iterator",te=K==x,Z=!1,_=H.prototype,Y=_[b]||_[v]||K&&_[K],re=Y||j(K),pe=K?te?j("entries"):re:void 0,le=B=="Array"&&_.entries||Y,_e,me,ke;if(le&&(ke=h(le.call(new H)),ke!==Object.prototype&&ke.next&&(g(ke,T,!0),!y&&typeof ke[b]!="function"&&M(ke,b,S))),te&&Y&&Y.name!==x&&(Z=!0,re=function(){return Y.call(this)}),(!y||U)&&(p||Z||!_[b])&&M(_,b,re),D[B]=re,D[T]=S,K)if(_e={values:te?re:j(x),keys:J?re:j(I),entries:pe},U)for(me in _e)me in _||F(_,me,_e[me]);else d(d.P+d.F*(p||Z),B,_e);return _e}},{"./_export":107,"./_hide":112,"./_iter-create":121,"./_iterators":125,"./_library":126,"./_object-gpo":138,"./_redefine":148,"./_set-to-string-tag":150,"./_wks":166}],123:[function(l,G,N){var y=l("./_wks")("iterator"),d=!1;try{var F=[7][y]();F.return=function(){d=!0},Array.from(F,function(){throw 2})}catch(M){}G.exports=function(M,D){if(!D&&!d)return!1;var E=!1;try{var g=[7],h=g[y]();h.next=function(){return{done:E=!0}},g[y]=function(){return h},M(g)}catch(b){}return E}},{"./_wks":166}],124:[function(l,G,N){G.exports=function(y,d){return{value:d,done:!!y}}},{}],125:[function(l,G,N){G.exports={}},{}],126:[function(l,G,N){G.exports=!0},{}],127:[function(l,G,N){var y=l("./_uid")("meta"),d=l("./_is-object"),F=l("./_has"),M=l("./_object-dp").f,D=0,E=Object.isExtensible||function(){return!0},g=!l("./_fails")(function(){return E(Object.preventExtensions({}))}),h=function(x){M(x,y,{value:{i:"O"+ ++D,w:{}}})},b=function(x,S){if(!d(x))return typeof x=="symbol"?x:(typeof x=="string"?"S":"P")+x;if(!F(x,y)){if(!E(x))return"F";if(!S)return"E";h(x)}return x[y].i},p=function(x,S){if(!F(x,y)){if(!E(x))return!0;if(!S)return!1;h(x)}return x[y].w},v=function(x){return g&&I.NEED&&E(x)&&!F(x,y)&&h(x),x},I=G.exports={KEY:y,NEED:!1,fastKey:b,getWeak:p,onFreeze:v}},{"./_fails":108,"./_has":111,"./_is-object":119,"./_object-dp":132,"./_uid":162}],128:[function(l,G,N){var y=l("./_global"),d=l("./_task").set,F=y.MutationObserver||y.WebKitMutationObserver,M=y.process,D=y.Promise,E=l("./_cof")(M)=="process";G.exports=function(){var g,h,b,p=function(){var S,H;for(E&&(S=M.domain)&&S.exit();g;){H=g.fn,g=g.next;try{H()}catch(B){throw g?b():h=void 0,B}}h=void 0,S&&S.enter()};if(E)b=function(){M.nextTick(p)};else if(F&&!(y.navigator&&y.navigator.standalone)){var v=!0,I=document.createTextNode("");new F(p).observe(I,{characterData:!0}),b=function(){I.data=v=!v}}else if(D&&D.resolve){var x=D.resolve(void 0);b=function(){x.then(p)}}else b=function(){d.call(y,p)};return function(S){var H={fn:S,next:void 0};h&&(h.next=H),g||(g=H,b()),h=H}}},{"./_cof":98,"./_global":110,"./_task":155}],129:[function(l,G,N){"use strict";var y=l("./_a-function");function d(F){var M,D;this.promise=new F(function(E,g){if(M!==void 0||D!==void 0)throw TypeError("Bad Promise constructor");M=E,D=g}),this.resolve=y(M),this.reject=y(D)}G.exports.f=function(F){return new d(F)}},{"./_a-function":92}],130:[function(l,G,N){"use strict";var y=l("./_descriptors"),d=l("./_object-keys"),F=l("./_object-gops"),M=l("./_object-pie"),D=l("./_to-object"),E=l("./_iobject"),g=Object.assign;G.exports=!g||l("./_fails")(function(){var h={},b={},p=Symbol(),v="abcdefghijklmnopqrst";return h[p]=7,v.split("").forEach(function(I){b[I]=I}),g({},h)[p]!=7||Object.keys(g({},b)).join("")!=v})?function(b,p){for(var v=D(b),I=arguments.length,x=1,S=F.f,H=M.f;I>x;)for(var B=E(arguments[x++]),Q=S?d(B).concat(S(B)):d(B),z=Q.length,K=0,J;z>K;)J=Q[K++],(!y||H.call(B,J))&&(v[J]=B[J]);return v}:g},{"./_descriptors":103,"./_fails":108,"./_iobject":116,"./_object-gops":137,"./_object-keys":140,"./_object-pie":141,"./_to-object":160}],131:[function(l,G,N){var y=l("./_an-object"),d=l("./_object-dps"),F=l("./_enum-bug-keys"),M=l("./_shared-key")("IE_PROTO"),D=function(){},E="prototype",g=function(){var h=l("./_dom-create")("iframe"),b=F.length,p="<",v=">",I;for(h.style.display="none",l("./_html").appendChild(h),h.src="javascript:",I=h.contentWindow.document,I.open(),I.write(p+"script"+v+"document.F=Object"+p+"/script"+v),I.close(),g=I.F;b--;)delete g[E][F[b]];return g()};G.exports=Object.create||function(b,p){var v;return b!==null?(D[E]=y(b),v=new D,D[E]=null,v[M]=b):v=g(),p===void 0?v:d(v,p)}},{"./_an-object":95,"./_dom-create":104,"./_enum-bug-keys":105,"./_html":113,"./_object-dps":133,"./_shared-key":151}],132:[function(l,G,N){var y=l("./_an-object"),d=l("./_ie8-dom-define"),F=l("./_to-primitive"),M=Object.defineProperty;N.f=l("./_descriptors")?Object.defineProperty:function(E,g,h){if(y(E),g=F(g,!0),y(h),d)try{return M(E,g,h)}catch(b){}if("get"in h||"set"in h)throw TypeError("Accessors not supported!");return"value"in h&&(E[g]=h.value),E}},{"./_an-object":95,"./_descriptors":103,"./_ie8-dom-define":114,"./_to-primitive":161}],133:[function(l,G,N){var y=l("./_object-dp"),d=l("./_an-object"),F=l("./_object-keys");G.exports=l("./_descriptors")?Object.defineProperties:function(D,E){d(D);for(var g=F(E),h=g.length,b=0,p;h>b;)y.f(D,p=g[b++],E[p]);return D}},{"./_an-object":95,"./_descriptors":103,"./_object-dp":132,"./_object-keys":140}],134:[function(l,G,N){var y=l("./_object-pie"),d=l("./_property-desc"),F=l("./_to-iobject"),M=l("./_to-primitive"),D=l("./_has"),E=l("./_ie8-dom-define"),g=Object.getOwnPropertyDescriptor;N.f=l("./_descriptors")?g:function(b,p){if(b=F(b),p=M(p,!0),E)try{return g(b,p)}catch(v){}if(D(b,p))return d(!y.f.call(b,p),b[p])}},{"./_descriptors":103,"./_has":111,"./_ie8-dom-define":114,"./_object-pie":141,"./_property-desc":146,"./_to-iobject":158,"./_to-primitive":161}],135:[function(l,G,N){var y=l("./_to-iobject"),d=l("./_object-gopn").f,F={}.toString,M=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],D=function(E){try{return d(E)}catch(g){return M.slice()}};G.exports.f=function(g){return M&&F.call(g)=="[object Window]"?D(g):d(y(g))}},{"./_object-gopn":136,"./_to-iobject":158}],136:[function(l,G,N){var y=l("./_object-keys-internal"),d=l("./_enum-bug-keys").concat("length","prototype");N.f=Object.getOwnPropertyNames||function(M){return y(M,d)}},{"./_enum-bug-keys":105,"./_object-keys-internal":139}],137:[function(l,G,N){N.f=Object.getOwnPropertySymbols},{}],138:[function(l,G,N){var y=l("./_has"),d=l("./_to-object"),F=l("./_shared-key")("IE_PROTO"),M=Object.prototype;G.exports=Object.getPrototypeOf||function(D){return D=d(D),y(D,F)?D[F]:typeof D.constructor=="function"&&D instanceof D.constructor?D.constructor.prototype:D instanceof Object?M:null}},{"./_has":111,"./_shared-key":151,"./_to-object":160}],139:[function(l,G,N){var y=l("./_has"),d=l("./_to-iobject"),F=l("./_array-includes")(!1),M=l("./_shared-key")("IE_PROTO");G.exports=function(D,E){var g=d(D),h=0,b=[],p;for(p in g)p!=M&&(y(g,p)&&b.push(p));for(;E.length>h;)y(g,p=E[h++])&&(~F(b,p)||b.push(p));return b}},{"./_array-includes":96,"./_has":111,"./_shared-key":151,"./_to-iobject":158}],140:[function(l,G,N){var y=l("./_object-keys-internal"),d=l("./_enum-bug-keys");G.exports=Object.keys||function(M){return y(M,d)}},{"./_enum-bug-keys":105,"./_object-keys-internal":139}],141:[function(l,G,N){N.f={}.propertyIsEnumerable},{}],142:[function(l,G,N){var y=l("./_export"),d=l("./_core"),F=l("./_fails");G.exports=function(M,D){var E=(d.Object||{})[M]||Object[M],g={};g[M]=D(E),y(y.S+y.F*F(function(){E(1)}),"Object",g)}},{"./_core":99,"./_export":107,"./_fails":108}],143:[function(l,G,N){var y=l("./_descriptors"),d=l("./_object-keys"),F=l("./_to-iobject"),M=l("./_object-pie").f;G.exports=function(D){return function(E){for(var g=F(E),h=d(g),b=h.length,p=0,v=[],I;b>p;)I=h[p++],(!y||M.call(g,I))&&v.push(D?[I,g[I]]:g[I]);return v}}},{"./_descriptors":103,"./_object-keys":140,"./_object-pie":141,"./_to-iobject":158}],144:[function(l,G,N){G.exports=function(y){try{return{e:!1,v:y()}}catch(d){return{e:!0,v:d}}}},{}],145:[function(l,G,N){var y=l("./_an-object"),d=l("./_is-object"),F=l("./_new-promise-capability");G.exports=function(M,D){if(y(M),d(D)&&D.constructor===M)return D;var E=F.f(M),g=E.resolve;return g(D),E.promise}},{"./_an-object":95,"./_is-object":119,"./_new-promise-capability":129}],146:[function(l,G,N){G.exports=function(y,d){return{enumerable:!(y&1),configurable:!(y&2),writable:!(y&4),value:d}}},{}],147:[function(l,G,N){var y=l("./_hide");G.exports=function(d,F,M){for(var D in F)M&&d[D]?d[D]=F[D]:y(d,D,F[D]);return d}},{"./_hide":112}],148:[function(l,G,N){G.exports=l("./_hide")},{"./_hide":112}],149:[function(l,G,N){"use strict";var y=l("./_global"),d=l("./_core"),F=l("./_object-dp"),M=l("./_descriptors"),D=l("./_wks")("species");G.exports=function(E){var g=typeof d[E]=="function"?d[E]:y[E];M&&g&&!g[D]&&F.f(g,D,{configurable:!0,get:function(){return this}})}},{"./_core":99,"./_descriptors":103,"./_global":110,"./_object-dp":132,"./_wks":166}],150:[function(l,G,N){var y=l("./_object-dp").f,d=l("./_has"),F=l("./_wks")("toStringTag");G.exports=function(M,D,E){M&&!d(M=E?M:M.prototype,F)&&y(M,F,{configurable:!0,value:D})}},{"./_has":111,"./_object-dp":132,"./_wks":166}],151:[function(l,G,N){var y=l("./_shared")("keys"),d=l("./_uid");G.exports=function(F){return y[F]||(y[F]=d(F))}},{"./_shared":152,"./_uid":162}],152:[function(l,G,N){var y=l("./_core"),d=l("./_global"),F="__core-js_shared__",M=d[F]||(d[F]={});(G.exports=function(D,E){return M[D]||(M[D]=E!==void 0?E:{})})("versions",[]).push({version:y.version,mode:l("./_library")?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})},{"./_core":99,"./_global":110,"./_library":126}],153:[function(l,G,N){var y=l("./_an-object"),d=l("./_a-function"),F=l("./_wks")("species");G.exports=function(M,D){var E=y(M).constructor,g;return E===void 0||(g=y(E)[F])==null?D:d(g)}},{"./_a-function":92,"./_an-object":95,"./_wks":166}],154:[function(l,G,N){var y=l("./_to-integer"),d=l("./_defined");G.exports=function(F){return function(M,D){var E=String(d(M)),g=y(D),h=E.length,b,p;return g<0||g>=h?F?"":void 0:(b=E.charCodeAt(g),b<55296||b>56319||g+1===h||(p=E.charCodeAt(g+1))<56320||p>57343?F?E.charAt(g):b:F?E.slice(g,g+2):(b-55296<<10)+(p-56320)+65536)}}},{"./_defined":102,"./_to-integer":157}],155:[function(l,G,N){var y=l("./_ctx"),d=l("./_invoke"),F=l("./_html"),M=l("./_dom-create"),D=l("./_global"),E=D.process,g=D.setImmediate,h=D.clearImmediate,b=D.MessageChannel,p=D.Dispatch,v=0,I={},x="onreadystatechange",S,H,B,Q=function(){var K=+this;if(I.hasOwnProperty(K)){var J=I[K];delete I[K],J()}},z=function(K){Q.call(K.data)};(!g||!h)&&(g=function(J){for(var U=[],j=1;arguments.length>j;)U.push(arguments[j++]);return I[++v]=function(){d(typeof J=="function"?J:Function(J),U)},S(v),v},h=function(J){delete I[J]},l("./_cof")(E)=="process"?S=function(K){E.nextTick(y(Q,K,1))}:p&&p.now?S=function(K){p.now(y(Q,K,1))}:b?(H=new b,B=H.port2,H.port1.onmessage=z,S=y(B.postMessage,B,1)):D.addEventListener&&typeof postMessage=="function"&&!D.importScripts?(S=function(K){D.postMessage(K+"","*")},D.addEventListener("message",z,!1)):x in M("script")?S=function(K){F.appendChild(M("script"))[x]=function(){F.removeChild(this),Q.call(K)}}:S=function(K){setTimeout(y(Q,K,1),0)}),G.exports={set:g,clear:h}},{"./_cof":98,"./_ctx":101,"./_dom-create":104,"./_global":110,"./_html":113,"./_invoke":115}],156:[function(l,G,N){var y=l("./_to-integer"),d=Math.max,F=Math.min;G.exports=function(M,D){return M=y(M),M<0?d(M+D,0):F(M,D)}},{"./_to-integer":157}],157:[function(l,G,N){var y=Math.ceil,d=Math.floor;G.exports=function(F){return isNaN(F=+F)?0:(F>0?d:y)(F)}},{}],158:[function(l,G,N){var y=l("./_iobject"),d=l("./_defined");G.exports=function(F){return y(d(F))}},{"./_defined":102,"./_iobject":116}],159:[function(l,G,N){var y=l("./_to-integer"),d=Math.min;G.exports=function(F){return F>0?d(y(F),9007199254740991):0}},{"./_to-integer":157}],160:[function(l,G,N){var y=l("./_defined");G.exports=function(d){return Object(y(d))}},{"./_defined":102}],161:[function(l,G,N){var y=l("./_is-object");G.exports=function(d,F){if(!y(d))return d;var M,D;if(F&&typeof(M=d.toString)=="function"&&!y(D=M.call(d)))return D;if(typeof(M=d.valueOf)=="function"&&!y(D=M.call(d)))return D;if(!F&&typeof(M=d.toString)=="function"&&!y(D=M.call(d)))return D;throw TypeError("Can't convert object to primitive value")}},{"./_is-object":119}],162:[function(l,G,N){var y=0,d=Math.random();G.exports=function(F){return"Symbol(".concat(F===void 0?"":F,")_",(++y+d).toString(36))}},{}],163:[function(l,G,N){var y=l("./_global"),d=y.navigator;G.exports=d&&d.userAgent||""},{"./_global":110}],164:[function(l,G,N){var y=l("./_global"),d=l("./_core"),F=l("./_library"),M=l("./_wks-ext"),D=l("./_object-dp").f;G.exports=function(E){var g=d.Symbol||(d.Symbol=F?{}:y.Symbol||{});E.charAt(0)!="_"&&!(E in g)&&D(g,E,{value:M.f(E)})}},{"./_core":99,"./_global":110,"./_library":126,"./_object-dp":132,"./_wks-ext":165}],165:[function(l,G,N){N.f=l("./_wks")},{"./_wks":166}],166:[function(l,G,N){var y=l("./_shared")("wks"),d=l("./_uid"),F=l("./_global").Symbol,M=typeof F=="function",D=G.exports=function(E){return y[E]||(y[E]=M&&F[E]||(M?F:d)("Symbol."+E))};D.store=y},{"./_global":110,"./_shared":152,"./_uid":162}],167:[function(l,G,N){var y=l("./_classof"),d=l("./_wks")("iterator"),F=l("./_iterators");G.exports=l("./_core").getIteratorMethod=function(M){if(M!=null)return M[d]||M["@@iterator"]||F[y(M)]}},{"./_classof":97,"./_core":99,"./_iterators":125,"./_wks":166}],168:[function(l,G,N){"use strict";var y=l("./_ctx"),d=l("./_export"),F=l("./_to-object"),M=l("./_iter-call"),D=l("./_is-array-iter"),E=l("./_to-length"),g=l("./_create-property"),h=l("./core.get-iterator-method");d(d.S+d.F*!l("./_iter-detect")(function(b){Array.from(b)}),"Array",{from:function(p){var v=F(p),I=typeof this=="function"?this:Array,x=arguments.length,S=x>1?arguments[1]:void 0,H=S!==void 0,B=0,Q=h(v),z,K,J,U;if(H&&(S=y(S,x>2?arguments[2]:void 0,2)),Q!=null&&!(I==Array&&D(Q)))for(U=Q.call(v),K=new I;!(J=U.next()).done;B++)g(K,B,H?M(U,S,[J.value,B],!0):J.value);else for(z=E(v.length),K=new I(z);z>B;B++)g(K,B,H?S(v[B],B):v[B]);return K.length=B,K}})},{"./_create-property":100,"./_ctx":101,"./_export":107,"./_is-array-iter":117,"./_iter-call":120,"./_iter-detect":123,"./_to-length":159,"./_to-object":160,"./core.get-iterator-method":167}],169:[function(l,G,N){"use strict";var y=l("./_add-to-unscopables"),d=l("./_iter-step"),F=l("./_iterators"),M=l("./_to-iobject");G.exports=l("./_iter-define")(Array,"Array",function(D,E){this._t=M(D),this._i=0,this._k=E},function(){var D=this._t,E=this._k,g=this._i++;return!D||g>=D.length?(this._t=void 0,d(1)):E=="keys"?d(0,g):E=="values"?d(0,D[g]):d(0,[g,D[g]])},"values"),F.Arguments=F.Array,y("keys"),y("values"),y("entries")},{"./_add-to-unscopables":93,"./_iter-define":122,"./_iter-step":124,"./_iterators":125,"./_to-iobject":158}],170:[function(l,G,N){"use strict";var y=l("./_is-object"),d=l("./_object-gpo"),F=l("./_wks")("hasInstance"),M=Function.prototype;F in M||l("./_object-dp").f(M,F,{value:function(D){if(typeof this!="function"||!y(D))return!1;if(!y(this.prototype))return D instanceof this;for(;D=d(D);)if(this.prototype===D)return!0;return!1}})},{"./_is-object":119,"./_object-dp":132,"./_object-gpo":138,"./_wks":166}],171:[function(l,G,N){var y=l("./_export");y(y.S+y.F,"Object",{assign:l("./_object-assign")})},{"./_export":107,"./_object-assign":130}],172:[function(l,G,N){var y=l("./_export");y(y.S,"Object",{create:l("./_object-create")})},{"./_export":107,"./_object-create":131}],173:[function(l,G,N){var y=l("./_export");y(y.S+y.F*!l("./_descriptors"),"Object",{defineProperty:l("./_object-dp").f})},{"./_descriptors":103,"./_export":107,"./_object-dp":132}],174:[function(l,G,N){l("./_object-sap")("getOwnPropertyNames",function(){return l("./_object-gopn-ext").f})},{"./_object-gopn-ext":135,"./_object-sap":142}],175:[function(l,G,N){var y=l("./_to-object"),d=l("./_object-gpo");l("./_object-sap")("getPrototypeOf",function(){return function(M){return d(y(M))}})},{"./_object-gpo":138,"./_object-sap":142,"./_to-object":160}],176:[function(l,G,N){var y=l("./_to-object"),d=l("./_object-keys");l("./_object-sap")("keys",function(){return function(M){return d(y(M))}})},{"./_object-keys":140,"./_object-sap":142,"./_to-object":160}],177:[function(l,G,N){arguments[4][71][0].apply(N,arguments)},{dup:71}],178:[function(l,G,N){"use strict";var y=l("./_library"),d=l("./_global"),F=l("./_ctx"),M=l("./_classof"),D=l("./_export"),E=l("./_is-object"),g=l("./_a-function"),h=l("./_an-instance"),b=l("./_for-of"),p=l("./_species-constructor"),v=l("./_task").set,I=l("./_microtask")(),x=l("./_new-promise-capability"),S=l("./_perform"),H=l("./_user-agent"),B=l("./_promise-resolve"),Q="Promise",z=d.TypeError,K=d.process,J=K&&K.versions,U=J&&J.v8||"",j=d[Q],T=M(K)=="process",te=function(){},Z,_,Y,re,pe=_=x.f,le=!!function(){try{var de=j.resolve(1),ee=(de.constructor={})[l("./_wks")("species")]=function(Ce){Ce(te,te)};return(T||typeof PromiseRejectionEvent=="function")&&de.then(te)instanceof ee&&U.indexOf("6.6")!==0&&H.indexOf("Chrome/66")===-1}catch(Ce){}}(),_e=function(de){var ee;return E(de)&&typeof(ee=de.then)=="function"?ee:!1},me=function(de,ee){if(de._n)return;de._n=!0;var Ce=de._c;I(function(){for(var De=de._v,Le=de._s==1,Ye=0,et=function(Ae){var ct=Le?Ae.ok:Ae.fail,$e=Ae.resolve,Fe=Ae.reject,Pe=Ae.domain,He,ot,ye;try{ct?(Le||(de._h==2&&ne(de),de._h=1),ct===!0?He=De:(Pe&&Pe.enter(),He=ct(De),Pe&&(Pe.exit(),ye=!0)),He===Ae.promise?Fe(z("Promise-chain cycle")):(ot=_e(He))?ot.call(He,$e,Fe):$e(He)):Fe(De)}catch(be){Pe&&!ye&&Pe.exit(),Fe(be)}};Ce.length>Ye;)et(Ce[Ye++]);de._c=[],de._n=!1,ee&&!de._h&&ke(de)})},ke=function(de){v.call(d,function(){var ee=de._v,Ce=$(de),De,Le,Ye;if(Ce&&(De=S(function(){T?K.emit("unhandledRejection",ee,de):(Le=d.onunhandledrejection)?Le({promise:de,reason:ee}):(Ye=d.console)&&Ye.error&&Ye.error("Unhandled promise rejection",ee)}),de._h=T||$(de)?2:1),de._a=void 0,Ce&&De.e)throw De.v})},$=function(de){return de._h!==1&&(de._a||de._c).length===0},ne=function(de){v.call(d,function(){var ee;T?K.emit("rejectionHandled",de):(ee=d.onrejectionhandled)&&ee({promise:de,reason:de._v})})},W=function(de){var ee=this;if(ee._d)return;ee._d=!0,ee=ee._w||ee,ee._v=de,ee._s=2,ee._a||(ee._a=ee._c.slice()),me(ee,!0)},ie=function(de){var ee=this,Ce;if(ee._d)return;ee._d=!0,ee=ee._w||ee;try{if(ee===de)throw z("Promise can't be resolved itself");(Ce=_e(de))?I(function(){var De={_w:ee,_d:!1};try{Ce.call(de,F(ie,De,1),F(W,De,1))}catch(Le){W.call(De,Le)}}):(ee._v=de,ee._s=1,me(ee,!1))}catch(De){W.call({_w:ee,_d:!1},De)}};le||(j=function(ee){h(this,j,Q,"_h"),g(ee),Z.call(this);try{ee(F(ie,this,1),F(W,this,1))}catch(Ce){W.call(this,Ce)}},Z=function(ee){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},Z.prototype=l("./_redefine-all")(j.prototype,{then:function(ee,Ce){var De=pe(p(this,j));return De.ok=typeof ee=="function"?ee:!0,De.fail=typeof Ce=="function"&&Ce,De.domain=T?K.domain:void 0,this._c.push(De),this._a&&this._a.push(De),this._s&&me(this,!1),De.promise},catch:function(de){return this.then(void 0,de)}}),Y=function(){var de=new Z;this.promise=de,this.resolve=F(ie,de,1),this.reject=F(W,de,1)},x.f=pe=function(de){return de===j||de===re?new Y(de):_(de)}),D(D.G+D.W+D.F*!le,{Promise:j}),l("./_set-to-string-tag")(j,Q),l("./_set-species")(Q),re=l("./_core")[Q],D(D.S+D.F*!le,Q,{reject:function(ee){var Ce=pe(this),De=Ce.reject;return De(ee),Ce.promise}}),D(D.S+D.F*(y||!le),Q,{resolve:function(ee){return B(y&&this===re?j:this,ee)}}),D(D.S+D.F*!(le&&l("./_iter-detect")(function(de){j.all(de).catch(te)})),Q,{all:function(ee){var Ce=this,De=pe(Ce),Le=De.resolve,Ye=De.reject,et=S(function(){var Ae=[],ct=0,$e=1;b(ee,!1,function(Fe){var Pe=ct++,He=!1;Ae.push(void 0),$e++,Ce.resolve(Fe).then(function(ot){if(He)return;He=!0,Ae[Pe]=ot,--$e||Le(Ae)},Ye)}),--$e||Le(Ae)});return et.e&&Ye(et.v),De.promise},race:function(ee){var Ce=this,De=pe(Ce),Le=De.reject,Ye=S(function(){b(ee,!1,function(et){Ce.resolve(et).then(De.resolve,Le)})});return Ye.e&&Le(Ye.v),De.promise}})},{"./_a-function":92,"./_an-instance":94,"./_classof":97,"./_core":99,"./_ctx":101,"./_export":107,"./_for-of":109,"./_global":110,"./_is-object":119,"./_iter-detect":123,"./_library":126,"./_microtask":128,"./_new-promise-capability":129,"./_perform":144,"./_promise-resolve":145,"./_redefine-all":147,"./_set-species":149,"./_set-to-string-tag":150,"./_species-constructor":153,"./_task":155,"./_user-agent":163,"./_wks":166}],179:[function(l,G,N){var y=l("./_export"),d=l("./_to-absolute-index"),F=String.fromCharCode,M=String.fromCodePoint;y(y.S+y.F*(!!M&&M.length!=1),"String",{fromCodePoint:function(E){for(var g=[],h=arguments.length,b=0,p;h>b;){if(p=+arguments[b++],d(p,1114111)!==p)throw RangeError(p+" is not a valid code point");g.push(p<65536?F(p):F(((p-=65536)>>10)+55296,p%1024+56320))}return g.join("")}})},{"./_export":107,"./_to-absolute-index":156}],180:[function(l,G,N){"use strict";var y=l("./_string-at")(!0);l("./_iter-define")(String,"String",function(d){this._t=String(d),this._i=0},function(){var d=this._t,F=this._i,M;return F>=d.length?{value:void 0,done:!0}:(M=y(d,F),this._i+=M.length,{value:M,done:!1})})},{"./_iter-define":122,"./_string-at":154}],181:[function(l,G,N){"use strict";var y=l("./_global"),d=l("./_has"),F=l("./_descriptors"),M=l("./_export"),D=l("./_redefine"),E=l("./_meta").KEY,g=l("./_fails"),h=l("./_shared"),b=l("./_set-to-string-tag"),p=l("./_uid"),v=l("./_wks"),I=l("./_wks-ext"),x=l("./_wks-define"),S=l("./_enum-keys"),H=l("./_is-array"),B=l("./_an-object"),Q=l("./_is-object"),z=l("./_to-object"),K=l("./_to-iobject"),J=l("./_to-primitive"),U=l("./_property-desc"),j=l("./_object-create"),T=l("./_object-gopn-ext"),te=l("./_object-gopd"),Z=l("./_object-gops"),_=l("./_object-dp"),Y=l("./_object-keys"),re=te.f,pe=_.f,le=T.f,_e=y.Symbol,me=y.JSON,ke=me&&me.stringify,$="prototype",ne=v("_hidden"),W=v("toPrimitive"),ie={}.propertyIsEnumerable,de=h("symbol-registry"),ee=h("symbols"),Ce=h("op-symbols"),De=Object[$],Le=typeof _e=="function"&&!!Z.f,Ye=y.QObject,et=!Ye||!Ye[$]||!Ye[$].findChild,Ae=F&&g(function(){return j(pe({},"a",{get:function(){return pe(this,"a",{value:7}).a}})).a!=7})?function(ve,Re,qe){var nt=re(De,Re);nt&&delete De[Re],pe(ve,Re,qe),nt&&ve!==De&&pe(De,Re,nt)}:pe,ct=function(ve){var Re=ee[ve]=j(_e[$]);return Re._k=ve,Re},$e=Le&&typeof _e.iterator=="symbol"?function(ve){return typeof ve=="symbol"}:function(ve){return ve instanceof _e},Fe=function(Re,qe,nt){return Re===De&&Fe(Ce,qe,nt),B(Re),qe=J(qe,!0),B(nt),d(ee,qe)?(nt.enumerable?(d(Re,ne)&&Re[ne][qe]&&(Re[ne][qe]=!1),nt=j(nt,{enumerable:U(0,!1)})):(d(Re,ne)||pe(Re,ne,U(1,{})),Re[ne][qe]=!0),Ae(Re,qe,nt)):pe(Re,qe,nt)},Pe=function(Re,qe){B(Re);for(var nt=S(qe=K(qe)),st=0,bt=nt.length,dt;bt>st;)Fe(Re,dt=nt[st++],qe[dt]);return Re},He=function(Re,qe){return qe===void 0?j(Re):Pe(j(Re),qe)},ot=function(Re){var qe=ie.call(this,Re=J(Re,!0));return this===De&&d(ee,Re)&&!d(Ce,Re)?!1:qe||!d(this,Re)||!d(ee,Re)||d(this,ne)&&this[ne][Re]?qe:!0},ye=function(Re,qe){if(Re=K(Re),qe=J(qe,!0),Re===De&&d(ee,qe)&&!d(Ce,qe))return;var nt=re(Re,qe);return nt&&d(ee,qe)&&!(d(Re,ne)&&Re[ne][qe])&&(nt.enumerable=!0),nt},be=function(Re){for(var qe=le(K(Re)),nt=[],st=0,bt;qe.length>st;)!d(ee,bt=qe[st++])&&bt!=ne&&bt!=E&&nt.push(bt);return nt},Ke=function(Re){for(var qe=Re===De,nt=le(qe?Ce:K(Re)),st=[],bt=0,dt;nt.length>bt;)d(ee,dt=nt[bt++])&&(qe?d(De,dt):!0)&&st.push(ee[dt]);return st};Le||(_e=function(){if(this instanceof _e)throw TypeError("Symbol is not a constructor!");var Re=p(arguments.length>0?arguments[0]:void 0),qe=function(nt){this===De&&qe.call(Ce,nt),d(this,ne)&&d(this[ne],Re)&&(this[ne][Re]=!1),Ae(this,Re,U(1,nt))};return F&&et&&Ae(De,Re,{configurable:!0,set:qe}),ct(Re)},D(_e[$],"toString",function(){return this._k}),te.f=ye,_.f=Fe,l("./_object-gopn").f=T.f=be,l("./_object-pie").f=ot,Z.f=Ke,F&&!l("./_library")&&D(De,"propertyIsEnumerable",ot,!0),I.f=function(ve){return ct(v(ve))}),M(M.G+M.W+M.F*!Le,{Symbol:_e});for(var q="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),m=0;q.length>m;)v(q[m++]);for(var c=Y(v.store),R=0;c.length>R;)x(c[R++]);M(M.S+M.F*!Le,"Symbol",{for:function(ve){return d(de,ve+="")?de[ve]:de[ve]=_e(ve)},keyFor:function(Re){if(!$e(Re))throw TypeError(Re+" is not a symbol!");for(var qe in de)if(de[qe]===Re)return qe},useSetter:function(){et=!0},useSimple:function(){et=!1}}),M(M.S+M.F*!Le,"Object",{create:He,defineProperty:Fe,defineProperties:Pe,getOwnPropertyDescriptor:ye,getOwnPropertyNames:be,getOwnPropertySymbols:Ke});var fe=g(function(){Z.f(1)});M(M.S+M.F*fe,"Object",{getOwnPropertySymbols:function(Re){return Z.f(z(Re))}}),me&&M(M.S+M.F*(!Le||g(function(){var ve=_e();return ke([ve])!="[null]"||ke({a:ve})!="{}"||ke(Object(ve))!="{}"})),"JSON",{stringify:function(Re){for(var qe=[Re],nt=1,st,bt;arguments.length>nt;)qe.push(arguments[nt++]);return bt=st=qe[1],!Q(st)&&Re===void 0||$e(Re)?void 0:(H(st)||(st=function(dt,Et){if(typeof bt=="function"&&(Et=bt.call(this,dt,Et)),!$e(Et))return Et}),qe[1]=st,ke.apply(me,qe))}}),_e[$][W]||l("./_hide")(_e[$],W,_e[$].valueOf),b(_e,"Symbol"),b(Math,"Math",!0),b(y.JSON,"JSON",!0)},{"./_an-object":95,"./_descriptors":103,"./_enum-keys":106,"./_export":107,"./_fails":108,"./_global":110,"./_has":111,"./_hide":112,"./_is-array":118,"./_is-object":119,"./_library":126,"./_meta":127,"./_object-create":131,"./_object-dp":132,"./_object-gopd":134,"./_object-gopn":136,"./_object-gopn-ext":135,"./_object-gops":137,"./_object-keys":140,"./_object-pie":141,"./_property-desc":146,"./_redefine":148,"./_set-to-string-tag":150,"./_shared":152,"./_to-iobject":158,"./_to-object":160,"./_to-primitive":161,"./_uid":162,"./_wks":166,"./_wks-define":164,"./_wks-ext":165}],182:[function(l,G,N){var y=l("./_export"),d=l("./_object-to-array")(!0);y(y.S,"Object",{entries:function(M){return d(M)}})},{"./_export":107,"./_object-to-array":143}],183:[function(l,G,N){"use strict";var y=l("./_export"),d=l("./_core"),F=l("./_global"),M=l("./_species-constructor"),D=l("./_promise-resolve");y(y.P+y.R,"Promise",{finally:function(E){var g=M(this,d.Promise||F.Promise),h=typeof E=="function";return this.then(h?function(b){return D(g,E()).then(function(){return b})}:E,h?function(b){return D(g,E()).then(function(){throw b})}:E)}})},{"./_core":99,"./_export":107,"./_global":110,"./_promise-resolve":145,"./_species-constructor":153}],184:[function(l,G,N){"use strict";var y=l("./_export"),d=l("./_new-promise-capability"),F=l("./_perform");y(y.S,"Promise",{try:function(M){var D=d.f(this),E=F(M);return(E.e?D.reject:D.resolve)(E.v),D.promise}})},{"./_export":107,"./_new-promise-capability":129,"./_perform":144}],185:[function(l,G,N){l("./_wks-define")("asyncIterator")},{"./_wks-define":164}],186:[function(l,G,N){l("./_wks-define")("observable")},{"./_wks-define":164}],187:[function(l,G,N){l("./es6.array.iterator");for(var y=l("./_global"),d=l("./_hide"),F=l("./_iterators"),M=l("./_wks")("toStringTag"),D="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),E=0;E<D.length;E++){var g=D[E],h=y[g],b=h&&h.prototype;b&&!b[M]&&d(b,M,g),F[g]=F.Array}},{"./_global":110,"./_hide":112,"./_iterators":125,"./_wks":166,"./es6.array.iterator":169}],188:[function(l,G,N){var y=l("./_export"),d=l("./_task");y(y.G+y.B,{setImmediate:d.set,clearImmediate:d.clear})},{"./_export":107,"./_task":155}],189:[function(l,G,N){(function(y){"use strict";var d=l("babel-runtime/helpers/typeof"),F=M(d);function M(J){return J&&J.__esModule?J:{default:J}}function D(J){return Array.isArray?Array.isArray(J):K(J)==="[object Array]"}N.isArray=D;function E(J){return typeof J=="boolean"}N.isBoolean=E;function g(J){return J===null}N.isNull=g;function h(J){return J==null}N.isNullOrUndefined=h;function b(J){return typeof J=="number"}N.isNumber=b;function p(J){return typeof J=="string"}N.isString=p;function v(J){return(typeof J=="undefined"?"undefined":(0,F.default)(J))==="symbol"}N.isSymbol=v;function I(J){return J===void 0}N.isUndefined=I;function x(J){return K(J)==="[object RegExp]"}N.isRegExp=x;function S(J){return(typeof J=="undefined"?"undefined":(0,F.default)(J))==="object"&&J!==null}N.isObject=S;function H(J){return K(J)==="[object Date]"}N.isDate=H;function B(J){return K(J)==="[object Error]"||J instanceof Error}N.isError=B;function Q(J){return typeof J=="function"}N.isFunction=Q;function z(J){return J===null||typeof J=="boolean"||typeof J=="number"||typeof J=="string"||(typeof J=="undefined"?"undefined":(0,F.default)(J))==="symbol"||typeof J=="undefined"}N.isPrimitive=z,N.isBuffer=y.isBuffer;function K(J){return Object.prototype.toString.call(J)}}).call(this,{isBuffer:l("../../is-buffer/index.js")})},{"../../is-buffer/index.js":197,"babel-runtime/helpers/typeof":67}],190:[function(l,G,N){"use strict";var y=l("babel-runtime/helpers/typeof"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(M){"use strict";var D=function(){var p=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|'[^']*'|'[^']*'/g,v=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,I=/[^-+\dA-Z]/g;return function(x,S,H,B){if(arguments.length===1&&b(x)==="string"&&!/\d/.test(x)&&(S=x,x=void 0),x=x||new Date,x instanceof Date||(x=new Date(x)),isNaN(x))throw TypeError("Invalid date");S=String(D.masks[S]||S||D.masks.default);var Q=S.slice(0,4);(Q==="UTC:"||Q==="GMT:")&&(S=S.slice(4),H=!0,Q==="GMT:"&&(B=!0));var z=H?"getUTC":"get",K=x[z+"Date"](),J=x[z+"Day"](),U=x[z+"Month"](),j=x[z+"FullYear"](),T=x[z+"Hours"](),te=x[z+"Minutes"](),Z=x[z+"Seconds"](),_=x[z+"Milliseconds"](),Y=H?0:x.getTimezoneOffset(),re=g(x),pe=h(x),le={d:K,dd:E(K),ddd:D.i18n.dayNames[J],dddd:D.i18n.dayNames[J+7],m:U+1,mm:E(U+1),mmm:D.i18n.monthNames[U],mmmm:D.i18n.monthNames[U+12],yy:String(j).slice(2),yyyy:j,h:T%12||12,hh:E(T%12||12),H:T,HH:E(T),M:te,MM:E(te),s:Z,ss:E(Z),l:E(_,3),L:E(Math.round(_/10)),t:T<12?"a":"p",tt:T<12?"am":"pm",T:T<12?"A":"P",TT:T<12?"AM":"PM",Z:B?"GMT":H?"UTC":(String(x).match(v)||[""]).pop().replace(I,""),o:(Y>0?"-":"+")+E(Math.floor(Math.abs(Y)/60)*100+Math.abs(Y)%60,4),S:["th","st","nd","rd"][K%10>3?0:(K%100-K%10!=10)*K%10],W:re,N:pe};return S.replace(p,function(_e){return _e in le?le[_e]:_e.slice(1,_e.length-1)})}}();D.masks={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},D.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};function E(p,v){for(p=String(p),v=v||2;p.length<v;)p="0"+p;return p}function g(p){var v=new Date(p.getFullYear(),p.getMonth(),p.getDate());v.setDate(v.getDate()-(v.getDay()+6)%7+3);var I=new Date(v.getFullYear(),0,4);I.setDate(I.getDate()-(I.getDay()+6)%7+3);var x=v.getTimezoneOffset()-I.getTimezoneOffset();v.setHours(v.getHours()-x);var S=(v-I)/(864e5*7);return 1+Math.floor(S)}function h(p){var v=p.getDay();return v===0&&(v=7),v}function b(p){return p===null?"null":p===void 0?"undefined":(typeof p=="undefined"?"undefined":(0,d.default)(p))!=="object"?typeof p=="undefined"?"undefined":(0,d.default)(p):Array.isArray(p)?"array":{}.toString.call(p).slice(8,-1).toLowerCase()}typeof define=="function"&&define.amd?define(function(){return D}):(typeof N=="undefined"?"undefined":(0,d.default)(N))==="object"?G.exports=D:M.dateFormat=D})(void 0)},{"babel-runtime/helpers/typeof":67}],191:[function(l,G,N){/*!
* escape-html
* Copyright(c) 2012-2013 TJ Holowaychuk
* Copyright(c) 2015 Andreas Lubbe
* Copyright(c) 2015 Tiancheng "Timothy" Gu
* MIT Licensed
*/"use strict";var y=/["'&<>]/;G.exports=d;function d(F){var M=""+F,D=y.exec(M);if(!D)return M;var E,g="",h=0,b=0;for(h=D.index;h<M.length;h++){switch(M.charCodeAt(h)){case 34:E="&quot;";break;case 38:E="&amp;";break;case 39:E="&#39;";break;case 60:E="&lt;";break;case 62:E="&gt;";break;default:continue}b!==h&&(g+=M.substring(b,h)),b=h+1,g+=E}return b!==h?g+M.substring(b,h):g}},{}],192:[function(l,G,N){function y(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}G.exports=y,y.EventEmitter=y,y.prototype._events=void 0,y.prototype._maxListeners=void 0,y.defaultMaxListeners=10,y.prototype.setMaxListeners=function(E){if(!F(E)||E<0||isNaN(E))throw TypeError("n must be a positive number");return this._maxListeners=E,this},y.prototype.emit=function(E){var g,h,b,p,v,I;if(this._events||(this._events={}),E==="error"&&(!this._events.error||M(this._events.error)&&!this._events.error.length)){if(g=arguments[1],g instanceof Error)throw g;var x=new Error('Uncaught, unspecified "error" event. ('+g+")");throw x.context=g,x}if(h=this._events[E],D(h))return!1;if(d(h))switch(arguments.length){case 1:h.call(this);break;case 2:h.call(this,arguments[1]);break;case 3:h.call(this,arguments[1],arguments[2]);break;default:p=Array.prototype.slice.call(arguments,1),h.apply(this,p)}else if(M(h))for(p=Array.prototype.slice.call(arguments,1),I=h.slice(),b=I.length,v=0;v<b;v++)I[v].apply(this,p);return!0},y.prototype.addListener=function(E,g){var h;if(!d(g))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",E,d(g.listener)?g.listener:g),this._events[E]?M(this._events[E])?this._events[E].push(g):this._events[E]=[this._events[E],g]:this._events[E]=g,M(this._events[E])&&!this._events[E].warned&&(D(this._maxListeners)?h=y.defaultMaxListeners:h=this._maxListeners,h&&h>0&&this._events[E].length>h&&(this._events[E].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[E].length),typeof console.trace=="function"&&console.trace())),this},y.prototype.on=y.prototype.addListener,y.prototype.once=function(E,g){if(!d(g))throw TypeError("listener must be a function");var h=!1;function b(){this.removeListener(E,b),h||(h=!0,g.apply(this,arguments))}return b.listener=g,this.on(E,b),this},y.prototype.removeListener=function(E,g){var h,b,p,v;if(!d(g))throw TypeError("listener must be a function");if(!this._events||!this._events[E])return this;if(h=this._events[E],p=h.length,b=-1,h===g||d(h.listener)&&h.listener===g)delete this._events[E],this._events.removeListener&&this.emit("removeListener",E,g);else if(M(h)){for(v=p;v-- >0;)if(h[v]===g||h[v].listener&&h[v].listener===g){b=v;break}if(b<0)return this;h.length===1?(h.length=0,delete this._events[E]):h.splice(b,1),this._events.removeListener&&this.emit("removeListener",E,g)}return this},y.prototype.removeAllListeners=function(E){var g,h;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[E]&&delete this._events[E],this;if(arguments.length===0){for(g in this._events){if(g==="removeListener")continue;this.removeAllListeners(g)}return this.removeAllListeners("removeListener"),this._events={},this}if(h=this._events[E],d(h))this.removeListener(E,h);else if(h)for(;h.length;)this.removeListener(E,h[h.length-1]);return delete this._events[E],this},y.prototype.listeners=function(E){var g;return!this._events||!this._events[E]?g=[]:d(this._events[E])?g=[this._events[E]]:g=this._events[E].slice(),g},y.prototype.listenerCount=function(E){if(this._events){var g=this._events[E];if(d(g))return 1;if(g)return g.length}return 0},y.listenerCount=function(E,g){return E.listenerCount(g)};function d(E){return typeof E=="function"}function F(E){return typeof E=="number"}function M(E){return typeof E=="object"&&E!==null}function D(E){return E===void 0}},{}],193:[function(l,G,N){var y=l("http"),d=G.exports;for(var F in y)y.hasOwnProperty(F)&&(d[F]=y[F]);d.request=function(M,D){return M||(M={}),M.scheme="https",M.protocol="https:",y.request.call(this,M,D)}},{http:231}],194:[function(l,G,N){/*!
* humanize-ms - index.js
* Copyright(c) 2014 dead_horse <dead_horse@qq.com>
* MIT Licensed
*/"use strict";var y=l("util"),d=l("ms");G.exports=function(F){if(typeof F=="number")return F;var M=d(F);if(M===void 0){var D=new Error(y.format("humanize-ms(%j) result undefined",F));console.warn(D.stack)}return M}},{ms:204,util:243}],195:[function(l,G,N){N.read=function(y,d,F,M,D){var E,g,h=D*8-M-1,b=(1<<h)-1,p=b>>1,v=-7,I=F?D-1:0,x=F?-1:1,S=y[d+I];for(I+=x,E=S&(1<<-v)-1,S>>=-v,v+=h;v>0;E=E*256+y[d+I],I+=x,v-=8);for(g=E&(1<<-v)-1,E>>=-v,v+=M;v>0;g=g*256+y[d+I],I+=x,v-=8);if(E===0)E=1-p;else{if(E===b)return g?NaN:(S?-1:1)*Infinity;g=g+Math.pow(2,M),E=E-p}return(S?-1:1)*g*Math.pow(2,E-M)},N.write=function(y,d,F,M,D,E){var g,h,b,p=E*8-D-1,v=(1<<p)-1,I=v>>1,x=D===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=M?0:E-1,H=M?1:-1,B=d<0||d===0&&1/d<0?1:0;for(d=Math.abs(d),isNaN(d)||d===Infinity?(h=isNaN(d)?1:0,g=v):(g=Math.floor(Math.log(d)/Math.LN2),d*(b=Math.pow(2,-g))<1&&(g--,b*=2),g+I>=1?d+=x/b:d+=x*Math.pow(2,1-I),d*b>=2&&(g++,b/=2),g+I>=v?(h=0,g=v):g+I>=1?(h=(d*b-1)*Math.pow(2,D),g=g+I):(h=d*Math.pow(2,I-1)*Math.pow(2,D),g=0));D>=8;y[F+S]=h&255,S+=H,h/=256,D-=8);for(g=g<<D|h,p+=D;p>0;y[F+S]=g&255,S+=H,g/=256,p-=8);y[F+S-H]|=B*128}},{}],196:[function(l,G,N){typeof Object.create=="function"?G.exports=function(d,F){F&&(d.super_=F,d.prototype=Object.create(F.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}))}:G.exports=function(d,F){if(F){d.super_=F;var M=function(){};M.prototype=F.prototype,d.prototype=new M,d.prototype.constructor=d}}},{}],197:[function(l,G,N){/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/G.exports=function(F){return F!=null&&(y(F)||d(F)||!!F._isBuffer)};function y(F){return!!F.constructor&&typeof F.constructor.isBuffer=="function"&&F.constructor.isBuffer(F)}function d(F){return typeof F.readFloatLE=="function"&&typeof F.slice=="function"&&y(F.slice(0,0))}},{}],198:[function(l,G,N){var y={}.toString;G.exports=Array.isArray||function(d){return y.call(d)=="[object Array]"}},{}],199:[function(require,module,exports){(function(global){(function(l,G){typeof exports=="object"&&typeof module!="undefined"?module.exports=G(l):typeof define=="function"&&define.amd?define(G):G(l)})(typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:this,function(global){"use strict";global=global||{};var _Base64=global.Base64,version="2.5.2",buffer;if(typeof module!="undefined"&&module.exports)try{buffer=eval("require('buffer').Buffer")}catch(l){buffer=void 0}var b64chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b64tab=function(l){for(var G={},N=0,y=l.length;N<y;N++)G[l.charAt(N)]=N;return G}(b64chars),fromCharCode=String.fromCharCode,cb_utob=function(l){if(l.length<2){var G=l.charCodeAt(0);return G<128?l:G<2048?fromCharCode(192|G>>>6)+fromCharCode(128|G&63):fromCharCode(224|G>>>12&15)+fromCharCode(128|G>>>6&63)+fromCharCode(128|G&63)}else{var G=65536+(l.charCodeAt(0)-55296)*1024+(l.charCodeAt(1)-56320);return fromCharCode(240|G>>>18&7)+fromCharCode(128|G>>>12&63)+fromCharCode(128|G>>>6&63)+fromCharCode(128|G&63)}},re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,utob=function(l){return l.replace(re_utob,cb_utob)},cb_encode=function(l){var G=[0,2,1][l.length%3],N=l.charCodeAt(0)<<16|(l.length>1?l.charCodeAt(1):0)<<8|(l.length>2?l.charCodeAt(2):0),y=[b64chars.charAt(N>>>18),b64chars.charAt(N>>>12&63),G>=2?"=":b64chars.charAt(N>>>6&63),G>=1?"=":b64chars.charAt(N&63)];return y.join("")},btoa=global.btoa?function(l){return global.btoa(l)}:function(l){return l.replace(/[\s\S]{1,3}/g,cb_encode)},_encode=function(l){var G=Object.prototype.toString.call(l)==="[object Uint8Array]";return G?l.toString("base64"):btoa(utob(String(l)))},encode=function(l,G){return G?_encode(String(l)).replace(/[+\/]/g,function(N){return N=="+"?"-":"_"}).replace(/=/g,""):_encode(l)},encodeURI=function(l){return encode(l,!0)},re_btou=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,cb_btou=function(l){switch(l.length){case 4:var G=(7&l.charCodeAt(0))<<18|(63&l.charCodeAt(1))<<12|(63&l.charCodeAt(2))<<6|63&l.charCodeAt(3),N=G-65536;return fromCharCode((N>>>10)+55296)+fromCharCode((N&1023)+56320);case 3:return fromCharCode((15&l.charCodeAt(0))<<12|(63&l.charCodeAt(1))<<6|63&l.charCodeAt(2));default:return fromCharCode((31&l.charCodeAt(0))<<6|63&l.charCodeAt(1))}},btou=function(l){return l.replace(re_btou,cb_btou)},cb_decode=function(l){var G=l.length,N=G%4,y=(G>0?b64tab[l.charAt(0)]<<18:0)|(G>1?b64tab[l.charAt(1)]<<12:0)|(G>2?b64tab[l.charAt(2)]<<6:0)|(G>3?b64tab[l.charAt(3)]:0),d=[fromCharCode(y>>>16),fromCharCode(y>>>8&255),fromCharCode(y&255)];return d.length-=[0,0,2,1][N],d.join("")},_atob=global.atob?function(l){return global.atob(l)}:function(l){return l.replace(/\S{1,4}/g,cb_decode)},atob=function(l){return _atob(String(l).replace(/[^A-Za-z0-9\+\/]/g,""))},_decode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(l){return(l.constructor===buffer.constructor?l:buffer.from(l,"base64")).toString()}:function(l){return(l.constructor===buffer.constructor?l:new buffer(l,"base64")).toString()}:function(l){return btou(_atob(l))},decode=function(l){return _decode(String(l).replace(/[-_]/g,function(G){return G=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))},noConflict=function(){var l=global.Base64;return global.Base64=_Base64,l};if(global.Base64={VERSION:version,atob,btoa,fromBase64:decode,toBase64:encode,utob,encode,encodeURI,btou,decode,noConflict,__buffer__:buffer},typeof Object.defineProperty=="function"){var noEnum=function(l){return{value:l,enumerable:!1,writable:!0,configurable:!0}};global.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",noEnum(function(){return decode(this)})),Object.defineProperty(String.prototype,"toBase64",noEnum(function(l){return encode(this,l)})),Object.defineProperty(String.prototype,"toBase64URI",noEnum(function(){return encode(this,!0)}))}}return global.Meteor&&(Base64=global.Base64),typeof module!="undefined"&&module.exports?module.exports.Base64=global.Base64:typeof define=="function"&&define.amd&&define([],function(){return global.Base64}),{Base64:global.Base64}})}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],200:[function(l,G,N){/*!
* merge-descriptors
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/"use strict";G.exports=d;var y=Object.prototype.hasOwnProperty;function d(F,M,D){if(!F)throw new TypeError("argument dest is required");if(!M)throw new TypeError("argument src is required");return D===void 0&&(D=!0),Object.getOwnPropertyNames(M).forEach(function(g){if(!D&&y.call(F,g))return;var h=Object.getOwnPropertyDescriptor(M,g);Object.defineProperty(F,g,h)}),F}},{}],201:[function(l,G,N){"use strict";function y(){this._types=Object.create(null),this._extensions=Object.create(null);for(var d=0;d<arguments.length;d++)this.define(arguments[d]);this.define=this.define.bind(this),this.getType=this.getType.bind(this),this.getExtension=this.getExtension.bind(this)}y.prototype.define=function(d,F){for(var M in d){var D=d[M].map(function(h){return h.toLowerCase()});M=M.toLowerCase();for(var E=0;E<D.length;E++){var g=D[E];if(g[0]=="*")continue;if(!F&&g in this._types)throw new Error('Attempt to change mapping for "'+g+'" extension from "'+this._types[g]+'" to "'+M+'". Pass `force=true` to allow this, otherwise remove "'+g+'" from the list of extensions for "'+M+'".');this._types[g]=M}if(F||!this._extensions[M]){var g=D[0];this._extensions[M]=g[0]!="*"?g:g.substr(1)}}},y.prototype.getType=function(d){d=String(d);var F=d.replace(/^.*[/\\]/,"").toLowerCase(),M=F.replace(/^.*\./,"").toLowerCase(),D=F.length<d.length,E=M.length<F.length-1;return(E||!D)&&this._types[M]||null},y.prototype.getExtension=function(d){return d=/^\s*([^;\s]*)/.test(d)&&RegExp.$1,d&&this._extensions[d.toLowerCase()]||null},G.exports=y},{}],202:[function(l,G,N){"use strict";var y=l("./Mime");G.exports=new y(l("./types/standard"))},{"./Mime":201,"./types/standard":203}],203:[function(l,G,N){G.exports={"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma","es"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/mrb-consumer+xml":["*xdf"],"application/mrb-publish+xml":["*xdf"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["*xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/ttml+xml":["ttml"],"application/urc-ressheet+xml":["rsheet"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-error+xml":["xer"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]}},{}],204:[function(l,G,N){var y=1e3,d=y*60,F=d*60,M=F*24,D=M*7,E=M*365.25;G.exports=function(v,I){I=I||{};var x=typeof v;if(x==="string"&&v.length>0)return g(v);if(x==="number"&&isFinite(v))return I.long?b(v):h(v);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(v))};function g(v){if(v=String(v),v.length>100)return;var I=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(v);if(!I)return;var x=parseFloat(I[1]),S=(I[2]||"ms").toLowerCase();switch(S){case"years":case"year":case"yrs":case"yr":case"y":return x*E;case"weeks":case"week":case"w":return x*D;case"days":case"day":case"d":return x*M;case"hours":case"hour":case"hrs":case"hr":case"h":return x*F;case"minutes":case"minute":case"mins":case"min":case"m":return x*d;case"seconds":case"second":case"secs":case"sec":case"s":return x*y;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return x;default:return}}function h(v){var I=Math.abs(v);return I>=M?Math.round(v/M)+"d":I>=F?Math.round(v/F)+"h":I>=d?Math.round(v/d)+"m":I>=y?Math.round(v/y)+"s":v+"ms"}function b(v){var I=Math.abs(v);return I>=M?p(v,I,M,"day"):I>=F?p(v,I,F,"hour"):I>=d?p(v,I,d,"minute"):I>=y?p(v,I,y,"second"):v+" ms"}function p(v,I,x,S){var H=I>=x*1.5;return Math.round(v/x)+" "+S+(H?"s":"")}},{}],205:[function(l,G,N){(function(y){function d(E,g){for(var h=0,b=E.length-1;b>=0;b--){var p=E[b];p==="."?E.splice(b,1):p===".."?(E.splice(b,1),h++):h&&(E.splice(b,1),h--)}if(g)for(;h--;h)E.unshift("..");return E}N.resolve=function(){for(var E="",g=!1,h=arguments.length-1;h>=-1&&!g;h--){var b=h>=0?arguments[h]:y.cwd();if(typeof b!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!b)continue;E=b+"/"+E,g=b.charAt(0)==="/"}return E=d(M(E.split("/"),function(p){return!!p}),!g).join("/"),(g?"/":"")+E||"."},N.normalize=function(E){var g=N.isAbsolute(E),h=D(E,-1)==="/";return E=d(M(E.split("/"),function(b){return!!b}),!g).join("/"),!E&&!g&&(E="."),E&&h&&(E+="/"),(g?"/":"")+E},N.isAbsolute=function(E){return E.charAt(0)==="/"},N.join=function(){var E=Array.prototype.slice.call(arguments,0);return N.normalize(M(E,function(g,h){if(typeof g!="string")throw new TypeError("Arguments to path.join must be strings");return g}).join("/"))},N.relative=function(E,g){E=N.resolve(E).substr(1),g=N.resolve(g).substr(1);function h(H){for(var B=0;B<H.length&&!(H[B]!=="");B++);for(var Q=H.length-1;Q>=0&&!(H[Q]!=="");Q--);return B>Q?[]:H.slice(B,Q-B+1)}for(var b=h(E.split("/")),p=h(g.split("/")),v=Math.min(b.length,p.length),I=v,x=0;x<v;x++)if(b[x]!==p[x]){I=x;break}for(var S=[],x=I;x<b.length;x++)S.push("..");return S=S.concat(p.slice(I)),S.join("/")},N.sep="/",N.delimiter=":",N.dirname=function(E){if(typeof E!="string"&&(E=E+""),E.length===0)return".";for(var g=E.charCodeAt(0),h=g===47,b=-1,p=!0,v=E.length-1;v>=1;--v)if(g=E.charCodeAt(v),g===47){if(!p){b=v;break}}else p=!1;return b===-1?h?"/":".":h&&b===1?"/":E.slice(0,b)};function F(E){typeof E!="string"&&(E=E+"");var g=0,h=-1,b=!0,p;for(p=E.length-1;p>=0;--p)if(E.charCodeAt(p)===47){if(!b){g=p+1;break}}else h===-1&&(b=!1,h=p+1);return h===-1?"":E.slice(g,h)}N.basename=function(E,g){var h=F(E);return g&&h.substr(-1*g.length)===g&&(h=h.substr(0,h.length-g.length)),h},N.extname=function(E){typeof E!="string"&&(E=E+"");for(var g=-1,h=0,b=-1,p=!0,v=0,I=E.length-1;I>=0;--I){var x=E.charCodeAt(I);if(x===47){if(!p){h=I+1;break}continue}b===-1&&(p=!1,b=I+1),x===46?g===-1?g=I:v!==1&&(v=1):g!==-1&&(v=-1)}return g===-1||b===-1||v===0||v===1&&g===b-1&&g===h+1?"":E.slice(g,b)};function M(E,g){if(E.filter)return E.filter(g);for(var h=[],b=0;b<E.length;b++)g(E[b],b,E)&&h.push(E[b]);return h}var D="ab".substr(-1)==="b"?function(E,g,h){return E.substr(g,h)}:function(E,g,h){return g<0&&(g=E.length+g),E.substr(g,h)}}).call(this,l("_process"))},{_process:208}],206:[function(l,G,N){(function(y){/*!
* Platform.js <https://mths.be/platform>
* Copyright 2014-2018 Benjamin Tan <https://bnjmnt4n.now.sh/>
* Copyright 2011-2013 John-David Dalton <http://allyoucanleet.com/>
* Available under MIT license <https://mths.be/mit>
*/(function(){"use strict";var d={function:!0,object:!0},F=d[typeof window]&&window||this,M=F,D=d[typeof N]&&N,E=d[typeof G]&&G&&!G.nodeType&&G,g=D&&E&&typeof y=="object"&&y;g&&(g.global===g||g.window===g||g.self===g)&&(F=g);var h=Math.pow(2,53)-1,b=/\bOpera/,p=this,v=Object.prototype,I=v.hasOwnProperty,x=v.toString;function S(_){return _=String(_),_.charAt(0).toUpperCase()+_.slice(1)}function H(_,Y,re){var pe={"10.0":"10","6.4":"10 Technical Preview","6.3":"8.1","6.2":"8","6.1":"Server 2008 R2 / 7","6.0":"Server 2008 / Vista","5.2":"Server 2003 / XP 64-bit","5.1":"XP","5.01":"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};return Y&&re&&/^Win/i.test(_)&&!/^Windows Phone /i.test(_)&&(pe=pe[/[\d.]+$/.exec(_)])&&(_="Windows "+pe),_=String(_),Y&&re&&(_=_.replace(RegExp(Y,"i"),re)),_=Q(_.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/," $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0]),_}function B(_,Y){var re=-1,pe=_?_.length:0;if(typeof pe=="number"&&pe>-1&&pe<=h)for(;++re<pe;)Y(_[re],re,_);else z(_,Y)}function Q(_){return _=T(_),/^(?:webOS|i(?:OS|P))/.test(_)?_:S(_)}function z(_,Y){for(var re in _)I.call(_,re)&&Y(_[re],re,_)}function K(_){return _==null?S(_):x.call(_).slice(8,-1)}function J(_,Y){var re=_!=null?typeof _[Y]:"number";return!/^(?:boolean|number|string|undefined)$/.test(re)&&(re=="object"?!!_[Y]:!0)}function U(_){return String(_).replace(/([ -])(?!$)/g,"$1?")}function j(_,Y){var re=null;return B(_,function(pe,le){re=Y(re,pe,le,_)}),re}function T(_){return String(_).replace(/^ +| +$/g,"")}function te(_){var Y=F,re=_&&typeof _=="object"&&K(_)!="String";re&&(Y=_,_=null);var pe=Y.navigator||{},le=pe.userAgent||"";_||(_=le);var _e=re||p==M,me=re?!!pe.likeChrome:/\bChrome\b/.test(_)&&!/internal|\n/i.test(x.toString()),ke="Object",$=re?ke:"ScriptBridgingProxyObject",ne=re?ke:"Environment",W=re&&Y.java?"JavaPackage":K(Y.java),ie=re?ke:"RuntimeObject",de=/\bJava/.test(W)&&Y.java,ee=de&&K(Y.environment)==ne,Ce=de?"a":"\u03B1",De=de?"b":"\u03B2",Le=Y.document||{},Ye=Y.operamini||Y.opera,et=b.test(et=re&&Ye?Ye["[[Class]]"]:K(Ye))?et:Ye=null,Ae,ct=_,$e=[],Fe=null,Pe=_==le,He=Pe&&Ye&&typeof Ye.version=="function"&&Ye.version(),ot,ye=c([{label:"EdgeHTML",pattern:"Edge"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"]),be=fe(["Adobe AIR","Arora","Avant Browser","Breach","Camino","Electron","Epiphany","Fennec","Flock","Galeon","GreenBrowser","iCab","Iceweasel","K-Meleon","Konqueror","Lunascape","Maxthon",{label:"Microsoft Edge",pattern:"Edge"},"Midori","Nook Browser","PaleMoon","PhantomJS","Raven","Rekonq","RockMelt",{label:"Samsung Internet",pattern:"SamsungBrowser"},"SeaMonkey",{label:"Silk",pattern:"(?:Cloud9|Silk-Accelerated)"},"Sleipnir","SlimBrowser",{label:"SRWare Iron",pattern:"Iron"},"Sunrise","Swiftfox","Waterfox","WebPositive","Opera Mini",{label:"Opera Mini",pattern:"OPiOS"},"Opera",{label:"Opera",pattern:"OPR"},"Chrome",{label:"Chrome Mobile",pattern:"(?:CriOS|CrMo)"},{label:"Firefox",pattern:"(?:Firefox|Minefield)"},{label:"Firefox for iOS",pattern:"FxiOS"},{label:"IE",pattern:"IEMobile"},{label:"IE",pattern:"MSIE"},"Safari"]),Ke=Re([{label:"BlackBerry",pattern:"BB10"},"BlackBerry",{label:"Galaxy S",pattern:"GT-I9000"},{label:"Galaxy S2",pattern:"GT-I9100"},{label:"Galaxy S3",pattern:"GT-I9300"},{label:"Galaxy S4",pattern:"GT-I9500"},{label:"Galaxy S5",pattern:"SM-G900"},{label:"Galaxy S6",pattern:"SM-G920"},{label:"Galaxy S6 Edge",pattern:"SM-G925"},{label:"Galaxy S7",pattern:"SM-G930"},{label:"Galaxy S7 Edge",pattern:"SM-G935"},"Google TV","Lumia","iPad","iPod","iPhone","Kindle",{label:"Kindle Fire",pattern:"(?:Cloud9|Silk-Accelerated)"},"Nexus","Nook","PlayBook","PlayStation Vita","PlayStation","TouchPad","Transformer",{label:"Wii U",pattern:"WiiU"},"Wii","Xbox One",{label:"Xbox 360",pattern:"Xbox"},"Xoom"]),q=R({Apple:{iPad:1,iPhone:1,iPod:1},Archos:{},Amazon:{Kindle:1,"Kindle Fire":1},Asus:{Transformer:1},"Barnes & Noble":{Nook:1},BlackBerry:{PlayBook:1},Google:{"Google TV":1,Nexus:1},HP:{TouchPad:1},HTC:{},LG:{},Microsoft:{Xbox:1,"Xbox One":1},Motorola:{Xoom:1},Nintendo:{"Wii U":1,Wii:1},Nokia:{Lumia:1},Samsung:{"Galaxy S":1,"Galaxy S2":1,"Galaxy S3":1,"Galaxy S4":1},Sony:{PlayStation:1,"PlayStation Vita":1}}),m=ve(["Windows Phone","Android","CentOS",{label:"Chrome OS",pattern:"CrOS"},"Debian","Fedora","FreeBSD","Gentoo","Haiku","Kubuntu","Linux Mint","OpenBSD","Red Hat","SuSE","Ubuntu","Xubuntu","Cygwin","Symbian OS","hpwOS","webOS ","webOS","Tablet OS","Tizen","Linux","Mac OS X","Macintosh","Mac","Windows 98;","Windows "]);function c(bt){return j(bt,function(dt,Et){return dt||RegExp("\\b"+(Et.pattern||U(Et))+"\\b","i").exec(_)&&(Et.label||Et)})}function R(bt){return j(bt,function(dt,Et,It){return dt||(Et[Ke]||Et[/^[a-z]+(?: +[a-z]+\b)*/i.exec(Ke)]||RegExp("\\b"+U(It)+"(?:\\b|\\w*\\d)","i").exec(_))&&It})}function fe(bt){return j(bt,function(dt,Et){return dt||RegExp("\\b"+(Et.pattern||U(Et))+"\\b","i").exec(_)&&(Et.label||Et)})}function ve(bt){return j(bt,function(dt,Et){var It=Et.pattern||U(Et);return!dt&&(dt=RegExp("\\b"+It+"(?:/[\\d.]+|[ \\w.]*)","i").exec(_))&&(dt=H(dt,It,Et.label||Et)),dt})}function Re(bt){return j(bt,function(dt,Et){var It=Et.pattern||U(Et);return!dt&&(dt=RegExp("\\b"+It+" *\\d+[.\\w_]*","i").exec(_)||RegExp("\\b"+It+" *\\w+-[\\w]*","i").exec(_)||RegExp("\\b"+It+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(_))&&((dt=String(Et.label&&!RegExp(It,"i").test(Et.label)?Et.label:dt).split("/"))[1]&&!/[\d.]+/.test(dt[0])&&(dt[0]+=" "+dt[1]),Et=Et.label||Et,dt=Q(dt[0].replace(RegExp(It,"i"),Et).replace(RegExp("; *(?:"+Et+"[_-])?","i")," ").replace(RegExp("("+Et+")[-_.]?(\\w)","i"),"$1 $2"))),dt})}function qe(bt){return j(bt,function(dt,Et){return dt||(RegExp(Et+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(_)||0)[1]||null})}function nt(){return this.description||""}if(ye&&(ye=[ye]),q&&!Ke&&(Ke=Re([q])),(Ae=/\bGoogle TV\b/.exec(Ke))&&(Ke=Ae[0]),/\bSimulator\b/i.test(_)&&(Ke=(Ke?Ke+" ":"")+"Simulator"),be=="Opera Mini"&&/\bOPiOS\b/.test(_)&&$e.push("running in Turbo/Uncompressed mode"),be=="IE"&&/\blike iPhone OS\b/.test(_)?(Ae=te(_.replace(/like iPhone OS/,"")),q=Ae.manufacturer,Ke=Ae.product):/^iP/.test(Ke)?(be||(be="Safari"),m="iOS"+((Ae=/ OS ([\d_]+)/i.exec(_))?" "+Ae[1].replace(/_/g,"."):"")):be=="Konqueror"&&!/buntu/i.test(m)?m="Kubuntu":q&&q!="Google"&&(/Chrome/.test(be)&&!/\bMobile Safari\b/i.test(_)||/\bVita\b/.test(Ke))||/\bAndroid\b/.test(m)&&/^Chrome/.test(be)&&/\bVersion\//i.test(_)?(be="Android Browser",m=/\bAndroid\b/.test(m)?m:"Android"):be=="Silk"?(/\bMobi/i.test(_)||(m="Android",$e.unshift("desktop mode")),/Accelerated *= *true/i.test(_)&&$e.unshift("accelerated")):be=="PaleMoon"&&(Ae=/\bFirefox\/([\d.]+)\b/.exec(_))?$e.push("identifying as Firefox "+Ae[1]):be=="Firefox"&&(Ae=/\b(Mobile|Tablet|TV)\b/i.exec(_))?(m||(m="Firefox OS"),Ke||(Ke=Ae[1])):!be||(Ae=!/\bMinefield\b/i.test(_)&&/\b(?:Firefox|Safari)\b/.exec(be))?(be&&!Ke&&/[\/,]|^[^(]+?\)/.test(_.slice(_.indexOf(Ae+"/")+8))&&(be=null),(Ae=Ke||q||m)&&(Ke||q||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(m))&&(be=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(m)?m:Ae)+" Browser")):be=="Electron"&&(Ae=(/\bChrome\/([\d.]+)\b/.exec(_)||0)[1])&&$e.push("Chromium "+Ae),He||(He=qe(["(?:Cloud9|CriOS|CrMo|Edge|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$))","Version",U(be),"(?:Firefox|Minefield|NetFront)"])),(Ae=ye=="iCab"&&parseFloat(He)>3&&"WebKit"||/\bOpera\b/.test(be)&&(/\bOPR\b/.test(_)?"Blink":"Presto")||/\b(?:Midori|Nook|Safari)\b/i.test(_)&&!/^(?:Trident|EdgeHTML)$/.test(ye)&&"WebKit"||!ye&&/\bMSIE\b/i.test(_)&&(m=="Mac OS"?"Tasman":"Trident")||ye=="WebKit"&&/\bPlayStation\b(?! Vita\b)/i.test(be)&&"NetFront")&&(ye=[Ae]),be=="IE"&&(Ae=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(_)||0)[1])?(be+=" Mobile",m="Windows Phone "+(/\+$/.test(Ae)?Ae:Ae+".x"),$e.unshift("desktop mode")):/\bWPDesktop\b/i.test(_)?(be="IE Mobile",m="Windows Phone 8.x",$e.unshift("desktop mode"),He||(He=(/\brv:([\d.]+)/.exec(_)||0)[1])):be!="IE"&&ye=="Trident"&&(Ae=/\brv:([\d.]+)/.exec(_))&&(be&&$e.push("identifying as "+be+(He?" "+He:"")),be="IE",He=Ae[1]),Pe){if(J(Y,"global"))if(de&&(Ae=de.lang.System,ct=Ae.getProperty("os.arch"),m=m||Ae.getProperty("os.name")+" "+Ae.getProperty("os.version")),ee){try{He=Y.require("ringo/engine").version.join("."),be="RingoJS"}catch(bt){(Ae=Y.system)&&Ae.global.system==Y.system&&(be="Narwhal",m||(m=Ae[0].os||null))}be||(be="Rhino")}else typeof Y.process=="object"&&!Y.process.browser&&(Ae=Y.process)&&(typeof Ae.versions=="object"&&(typeof Ae.versions.electron=="string"?($e.push("Node "+Ae.versions.node),be="Electron",He=Ae.versions.electron):typeof Ae.versions.nw=="string"&&($e.push("Chromium "+He,"Node "+Ae.versions.node),be="NW.js",He=Ae.versions.nw)),be||(be="Node.js",ct=Ae.arch,m=Ae.platform,He=/[\d.]+/.exec(Ae.version),He=He?He[0]:null));else K(Ae=Y.runtime)==$?(be="Adobe AIR",m=Ae.flash.system.Capabilities.os):K(Ae=Y.phantom)==ie?(be="PhantomJS",He=(Ae=Ae.version||null)&&Ae.major+"."+Ae.minor+"."+Ae.patch):typeof Le.documentMode=="number"&&(Ae=/\bTrident\/(\d+)/i.exec(_))?(He=[He,Le.documentMode],(Ae=+Ae[1]+4)!=He[1]&&($e.push("IE "+He[1]+" mode"),ye&&(ye[1]=""),He[1]=Ae),He=be=="IE"?String(He[1].toFixed(1)):He[0]):typeof Le.documentMode=="number"&&/^(?:Chrome|Firefox)\b/.test(be)&&($e.push("masking as "+be+" "+He),be="IE",He="11.0",ye=["Trident"],m="Windows");m=m&&Q(m)}if(He&&(Ae=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(He)||/(?:alpha|beta)(?: ?\d)?/i.exec(_+";"+(Pe&&pe.appMinorVersion))||/\bMinefield\b/i.test(_)&&"a")&&(Fe=/b/i.test(Ae)?"beta":"alpha",He=He.replace(RegExp(Ae+"\\+?$"),"")+(Fe=="beta"?De:Ce)+(/\d+\+?/.exec(Ae)||"")),be=="Fennec"||be=="Firefox"&&/\b(?:Android|Firefox OS)\b/.test(m))be="Firefox Mobile";else if(be=="Maxthon"&&He)He=He.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(Ke))Ke=="Xbox 360"&&(m=null),Ke=="Xbox 360"&&/\bIEMobile\b/.test(_)&&$e.unshift("mobile mode");else if((/^(?:Chrome|IE|Opera)$/.test(be)||be&&!Ke&&!/Browser|Mobi/.test(be))&&(m=="Windows CE"||/Mobi/i.test(_)))be+=" Mobile";else if(be=="IE"&&Pe)try{Y.external===null&&$e.unshift("platform preview")}catch(bt){$e.unshift("embedded")}else(/\bBlackBerry\b/.test(Ke)||/\bBB10\b/.test(_))&&(Ae=(RegExp(Ke.replace(/ +/g," *")+"/([.\\d]+)","i").exec(_)||0)[1]||He)?(Ae=[Ae,/BB10/.test(_)],m=(Ae[1]?(Ke=null,q="BlackBerry"):"Device Software")+" "+Ae[0],He=null):this!=z&&Ke!="Wii"&&(Pe&&Ye||/Opera/.test(be)&&/\b(?:MSIE|Firefox)\b/i.test(_)||be=="Firefox"&&/\bOS X (?:\d+\.){2,}/.test(m)||be=="IE"&&(m&&!/^Win/.test(m)&&He>5.5||/\bWindows XP\b/.test(m)&&He>8||He==8&&!/\bTrident\b/.test(_)))&&!b.test(Ae=te.call(z,_.replace(b,"")+";"))&&Ae.name&&(Ae="ing as "+Ae.name+((Ae=Ae.version)?" "+Ae:""),b.test(be)?(/\bIE\b/.test(Ae)&&m=="Mac OS"&&(m=null),Ae="identify"+Ae):(Ae="mask"+Ae,et?be=Q(et.replace(/([a-z])([A-Z])/g,"$1 $2")):be="Opera",/\bIE\b/.test(Ae)&&(m=null),Pe||(He=null)),ye=["Presto"],$e.push(Ae));(Ae=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(_)||0)[1])&&(Ae=[parseFloat(Ae.replace(/\.(\d)$/,".0$1")),Ae],be=="Safari"&&Ae[1].slice(-1)=="+"?(be="WebKit Nightly",Fe="alpha",He=Ae[1].slice(0,-1)):(He==Ae[1]||He==(Ae[2]=(/\bSafari\/([\d.]+\+?)/i.exec(_)||0)[1]))&&(He=null),Ae[1]=(/\bChrome\/([\d.]+)/i.exec(_)||0)[1],Ae[0]==537.36&&Ae[2]==537.36&&parseFloat(Ae[1])>=28&&ye=="WebKit"&&(ye=["Blink"]),!Pe||!me&&!Ae[1]?(ye&&(ye[1]="like Safari"),Ae=(Ae=Ae[0],Ae<400?1:Ae<500?2:Ae<526?3:Ae<533?4:Ae<534?"4+":Ae<535?5:Ae<537?6:Ae<538?7:Ae<601?8:"8")):(ye&&(ye[1]="like Chrome"),Ae=Ae[1]||(Ae=Ae[0],Ae<530?1:Ae<532?2:Ae<532.05?3:Ae<533?4:Ae<534.03?5:Ae<534.07?6:Ae<534.1?7:Ae<534.13?8:Ae<534.16?9:Ae<534.24?10:Ae<534.3?11:Ae<535.01?12:Ae<535.02?"13+":Ae<535.07?15:Ae<535.11?16:Ae<535.19?17:Ae<536.05?18:Ae<536.1?19:Ae<537.01?20:Ae<537.11?"21+":Ae<537.13?23:Ae<537.18?24:Ae<537.24?25:Ae<537.36?26:ye!="Blink"?"27":"28")),ye&&(ye[1]+=" "+(Ae+=typeof Ae=="number"?".x":/[.+]/.test(Ae)?"":"+")),be=="Safari"&&(!He||parseInt(He)>45)&&(He=Ae)),be=="Opera"&&(Ae=/\bzbov|zvav$/.exec(m))?(be+=" ",$e.unshift("desktop mode"),Ae=="zvav"?(be+="Mini",He=null):be+="Mobile",m=m.replace(RegExp(" *"+Ae+"$"),"")):be=="Safari"&&/\bChrome\b/.exec(ye&&ye[1])&&($e.unshift("desktop mode"),be="Chrome Mobile",He=null,/\bOS X\b/.test(m)?(q="Apple",m="iOS 4.3+"):m=null),He&&He.indexOf(Ae=/[\d.]+$/.exec(m))==0&&_.indexOf("/"+Ae+"-")>-1&&(m=T(m.replace(Ae,""))),ye&&!/\b(?:Avant|Nook)\b/.test(be)&&(/Browser|Lunascape|Maxthon/.test(be)||be!="Safari"&&/^iOS/.test(m)&&/\bSafari\b/.test(ye[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|Web)/.test(be)&&ye[1])&&((Ae=ye[ye.length-1])&&$e.push(Ae)),$e.length&&($e=["("+$e.join("; ")+")"]),q&&Ke&&Ke.indexOf(q)<0&&$e.push("on "+q),Ke&&$e.push((/^on /.test($e[$e.length-1])?"":"on ")+Ke),m&&(Ae=/ ([\d.+]+)$/.exec(m),ot=Ae&&m.charAt(m.length-Ae[0].length-1)=="/",m={architecture:32,family:Ae&&!ot?m.replace(Ae[0],""):m,version:Ae?Ae[1]:null,toString:function(){var bt=this.version;return this.family+(bt&&!ot?" "+bt:"")+(this.architecture==64?" 64-bit":"")}}),(Ae=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(ct))&&!/\bi686\b/i.test(ct)?(m&&(m.architecture=64,m.family=m.family.replace(RegExp(" *"+Ae),"")),be&&(/\bWOW64\b/i.test(_)||Pe&&/\w(?:86|32)$/.test(pe.cpuClass||pe.platform)&&!/\bWin64; x64\b/i.test(_))&&$e.unshift("32-bit")):m&&/^OS X/.test(m.family)&&be=="Chrome"&&parseFloat(He)>=39&&(m.architecture=64),_||(_=null);var st={};return st.description=_,st.layout=ye&&ye[0],st.manufacturer=q,st.name=be,st.prerelease=Fe,st.product=Ke,st.ua=_,st.version=be&&He,st.os=m||{architecture:null,family:null,version:null,toString:function(){return"null"}},st.parse=te,st.toString=nt,st.version&&$e.unshift(He),st.name&&$e.unshift(be),m&&be&&!(m==String(m).split(" ")[0]&&(m==be.split(" ")[0]||Ke))&&$e.push(Ke?"("+m+")":"on "+m),$e.length&&(st.description=$e.join(" ")),st}var Z=te();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(F.platform=Z,define(function(){return Z})):D&&E?z(Z,function(_,Y){D[Y]=_}):F.platform=Z}).call(this)}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],207:[function(l,G,N){(function(y){"use strict";typeof y=="undefined"||!y.version||y.version.indexOf("v0.")===0||y.version.indexOf("v1.")===0&&y.version.indexOf("v1.8.")!==0?G.exports={nextTick:d}:G.exports=y;function d(F,M,D,E){if(typeof F!="function")throw new TypeError('"callback" argument must be a function');var g=arguments.length,h,b;switch(g){case 0:case 1:return y.nextTick(F);case 2:return y.nextTick(function(){F.call(null,M)});case 3:return y.nextTick(function(){F.call(null,M,D)});case 4:return y.nextTick(function(){F.call(null,M,D,E)});default:for(h=new Array(g-1),b=0;b<h.length;)h[b++]=arguments[b];return y.nextTick(function(){F.apply(null,h)})}}}).call(this,l("_process"))},{_process:208}],208:[function(l,G,N){var y=G.exports={},d,F;function M(){throw new Error("setTimeout has not been defined")}function D(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?d=setTimeout:d=M}catch(B){d=M}try{typeof clearTimeout=="function"?F=clearTimeout:F=D}catch(B){F=D}})();function E(B){if(d===setTimeout)return setTimeout(B,0);if((d===M||!d)&&setTimeout)return d=setTimeout,setTimeout(B,0);try{return d(B,0)}catch(Q){try{return d.call(null,B,0)}catch(z){return d.call(this,B,0)}}}function g(B){if(F===clearTimeout)return clearTimeout(B);if((F===D||!F)&&clearTimeout)return F=clearTimeout,clearTimeout(B);try{return F(B)}catch(Q){try{return F.call(null,B)}catch(z){return F.call(this,B)}}}var h=[],b=!1,p,v=-1;function I(){if(!b||!p)return;b=!1,p.length?h=p.concat(h):v=-1,h.length&&x()}function x(){if(b)return;var B=E(I);b=!0;for(var Q=h.length;Q;){for(p=h,h=[];++v<Q;)p&&p[v].run();v=-1,Q=h.length}p=null,b=!1,g(B)}y.nextTick=function(B){var Q=new Array(arguments.length-1);if(arguments.length>1)for(var z=1;z<arguments.length;z++)Q[z-1]=arguments[z];h.push(new S(B,Q)),h.length===1&&!b&&E(x)};function S(B,Q){this.fun=B,this.array=Q}S.prototype.run=function(){this.fun.apply(null,this.array)},y.title="browser",y.browser=!0,y.env={},y.argv=[],y.version="",y.versions={};function H(){}y.on=H,y.addListener=H,y.once=H,y.off=H,y.removeListener=H,y.removeAllListeners=H,y.emit=H,y.prependListener=H,y.prependOnceListener=H,y.listeners=function(B){return[]},y.binding=function(B){throw new Error("process.binding is not supported")},y.cwd=function(){return"/"},y.chdir=function(B){throw new Error("process.chdir is not supported")},y.umask=function(){return 0}},{}],209:[function(l,G,N){(function(y){/*! https://mths.be/punycode v1.4.1 by @mathias */(function(d){var F=typeof N=="object"&&N&&!N.nodeType&&N,M=typeof G=="object"&&G&&!G.nodeType&&G,D=typeof y=="object"&&y;(D.global===D||D.window===D||D.self===D)&&(d=D);var E,g=2147483647,h=36,b=1,p=26,v=38,I=700,x=72,S=128,H="-",B=/^xn--/,Q=/[^\x20-\x7E]/,z=/[\x2E\u3002\uFF0E\uFF61]/g,K={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},J=h-b,U=Math.floor,j=String.fromCharCode,T;function te(W){throw new RangeError(K[W])}function Z(W,ie){for(var de=W.length,ee=[];de--;)ee[de]=ie(W[de]);return ee}function _(W,ie){var de=W.split("@"),ee="";de.length>1&&(ee=de[0]+"@",W=de[1]),W=W.replace(z,".");var Ce=W.split("."),De=Z(Ce,ie).join(".");return ee+De}function Y(W){for(var ie=[],de=0,ee=W.length,Ce,De;de<ee;)Ce=W.charCodeAt(de++),Ce>=55296&&Ce<=56319&&de<ee?(De=W.charCodeAt(de++),(De&64512)==56320?ie.push(((Ce&1023)<<10)+(De&1023)+65536):(ie.push(Ce),de--)):ie.push(Ce);return ie}function re(W){return Z(W,function(ie){var de="";return ie>65535&&(ie-=65536,de+=j(ie>>>10&1023|55296),ie=56320|ie&1023),de+=j(ie),de}).join("")}function pe(W){return W-48<10?W-22:W-65<26?W-65:W-97<26?W-97:h}function le(W,ie){return W+22+75*(W<26)-((ie!=0)<<5)}function _e(W,ie,de){var ee=0;for(W=de?U(W/I):W>>1,W+=U(W/ie);W>J*p>>1;ee+=h)W=U(W/J);return U(ee+(J+1)*W/(W+v))}function me(W){var ie=[],de=W.length,ee,Ce=0,De=S,Le=x,Ye,et,Ae,ct,$e,Fe,Pe,He,ot;for(Ye=W.lastIndexOf(H),Ye<0&&(Ye=0),et=0;et<Ye;++et)W.charCodeAt(et)>=128&&te("not-basic"),ie.push(W.charCodeAt(et));for(Ae=Ye>0?Ye+1:0;Ae<de;){for(ct=Ce,$e=1,Fe=h;!(Ae>=de&&te("invalid-input"),Pe=pe(W.charCodeAt(Ae++)),(Pe>=h||Pe>U((g-Ce)/$e))&&te("overflow"),Ce+=Pe*$e,He=Fe<=Le?b:Fe>=Le+p?p:Fe-Le,Pe<He);Fe+=h)ot=h-He,$e>U(g/ot)&&te("overflow"),$e*=ot;ee=ie.length+1,Le=_e(Ce-ct,ee,ct==0),U(Ce/ee)>g-De&&te("overflow"),De+=U(Ce/ee),Ce%=ee,ie.splice(Ce++,0,De)}return re(ie)}function ke(W){var ie,de,ee,Ce,De,Le,Ye,et,Ae,ct,$e,Fe=[],Pe,He,ot,ye;for(W=Y(W),Pe=W.length,ie=S,de=0,De=x,Le=0;Le<Pe;++Le)$e=W[Le],$e<128&&Fe.push(j($e));for(ee=Ce=Fe.length,Ce&&Fe.push(H);ee<Pe;){for(Ye=g,Le=0;Le<Pe;++Le)$e=W[Le],$e>=ie&&$e<Ye&&(Ye=$e);for(He=ee+1,Ye-ie>U((g-de)/He)&&te("overflow"),de+=(Ye-ie)*He,ie=Ye,Le=0;Le<Pe;++Le)if($e=W[Le],$e<ie&&++de>g&&te("overflow"),$e==ie){for(et=de,Ae=h;!(ct=Ae<=De?b:Ae>=De+p?p:Ae-De,et<ct);Ae+=h)ye=et-ct,ot=h-ct,Fe.push(j(le(ct+ye%ot,0))),et=U(ye/ot);Fe.push(j(le(et,0))),De=_e(de,He,ee==Ce),de=0,++ee}++de,++ie}return Fe.join("")}function $(W){return _(W,function(ie){return B.test(ie)?me(ie.slice(4).toLowerCase()):ie})}function ne(W){return _(W,function(ie){return Q.test(ie)?"xn--"+ke(ie):ie})}if(E={version:"1.4.1",ucs2:{decode:Y,encode:re},decode:me,encode:ke,toASCII:ne,toUnicode:$},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return E});else if(F&&M)if(G.exports==F)M.exports=E;else for(T in E)E.hasOwnProperty(T)&&(F[T]=E[T]);else d.punycode=E})(this)}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],210:[function(l,G,N){"use strict";function y(F,M){return Object.prototype.hasOwnProperty.call(F,M)}G.exports=function(F,M,D,E){M=M||"&",D=D||"=";var g={};if(typeof F!="string"||F.length===0)return g;var h=/\+/g;F=F.split(M);var b=1e3;E&&typeof E.maxKeys=="number"&&(b=E.maxKeys);var p=F.length;b>0&&p>b&&(p=b);for(var v=0;v<p;++v){var I=F[v].replace(h,"%20"),x=I.indexOf(D),S,H,B,Q;x>=0?(S=I.substr(0,x),H=I.substr(x+1)):(S=I,H=""),B=decodeURIComponent(S),Q=decodeURIComponent(H),y(g,B)?d(g[B])?g[B].push(Q):g[B]=[g[B],Q]:g[B]=Q}return g};var d=Array.isArray||function(F){return Object.prototype.toString.call(F)==="[object Array]"}},{}],211:[function(l,G,N){"use strict";var y=function(D){switch(typeof D){case"string":return D;case"boolean":return D?"true":"false";case"number":return isFinite(D)?D:"";default:return""}};G.exports=function(D,E,g,h){return E=E||"&",g=g||"=",D===null&&(D=void 0),typeof D=="object"?F(M(D),function(b){var p=encodeURIComponent(y(b))+g;return d(D[b])?F(D[b],function(v){return p+encodeURIComponent(y(v))}).join(E):p+encodeURIComponent(y(D[b]))}).join(E):h?encodeURIComponent(y(h))+g+encodeURIComponent(y(D)):""};var d=Array.isArray||function(D){return Object.prototype.toString.call(D)==="[object Array]"};function F(D,E){if(D.map)return D.map(E);for(var g=[],h=0;h<D.length;h++)g.push(E(D[h],h));return g}var M=Object.keys||function(D){var E=[];for(var g in D)Object.prototype.hasOwnProperty.call(D,g)&&E.push(g);return E}},{}],212:[function(l,G,N){"use strict";N.decode=N.parse=l("./decode"),N.encode=N.stringify=l("./encode")},{"./decode":210,"./encode":211}],213:[function(l,G,N){G.exports=l("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":214}],214:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=D(y),F=l("babel-runtime/core-js/object/keys"),M=D(F);function D(Q){return Q&&Q.__esModule?Q:{default:Q}}var E=l("process-nextick-args"),g=M.default||function(Q){var z=[];for(var K in Q)z.push(K);return z};G.exports=S;var h=(0,d.default)(l("core-util-is"));h.inherits=l("inherits");var b=l("./_stream_readable"),p=l("./_stream_writable");h.inherits(S,b);for(var v=g(p.prototype),I=0;I<v.length;I++){var x=v[I];S.prototype[x]||(S.prototype[x]=p.prototype[x])}function S(Q){if(!(this instanceof S))return new S(Q);b.call(this,Q),p.call(this,Q),Q&&Q.readable===!1&&(this.readable=!1),Q&&Q.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,Q&&Q.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",H)}Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function H(){if(this.allowHalfOpen||this._writableState.ended)return;E.nextTick(B,this)}function B(Q){Q.end()}Object.defineProperty(S.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(z){if(this._readableState===void 0||this._writableState===void 0)return;this._readableState.destroyed=z,this._writableState.destroyed=z}}),S.prototype._destroy=function(Q,z){this.push(null),this.end(),E.nextTick(z,Q)}},{"./_stream_readable":216,"./_stream_writable":218,"babel-runtime/core-js/object/create":55,"babel-runtime/core-js/object/keys":60,"core-util-is":189,inherits:196,"process-nextick-args":207}],215:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(g){return g&&g.__esModule?g:{default:g}}G.exports=E;var M=l("./_stream_transform"),D=(0,d.default)(l("core-util-is"));D.inherits=l("inherits"),D.inherits(E,M);function E(g){if(!(this instanceof E))return new E(g);M.call(this,g)}E.prototype._transform=function(g,h,b){b(null,g)}},{"./_stream_transform":217,"babel-runtime/core-js/object/create":55,"core-util-is":189,inherits:196}],216:[function(l,G,N){(function(y,d){"use strict";var F=l("babel-runtime/core-js/object/get-prototype-of"),M=g(F),D=l("babel-runtime/core-js/object/create"),E=g(D);function g(ye){return ye&&ye.__esModule?ye:{default:ye}}var h=l("process-nextick-args");G.exports=Y;var b=l("isarray"),p;Y.ReadableState=_;var v=l("events").EventEmitter,I=function(be,Ke){return be.listeners(Ke).length},x=l("./internal/streams/stream"),S=l("safe-buffer").Buffer,H=d.Uint8Array||function(){};function B(ye){return S.from(ye)}function Q(ye){return S.isBuffer(ye)||ye instanceof H}var z=(0,E.default)(l("core-util-is"));z.inherits=l("inherits");var K=l("util"),J=void 0;K&&K.debuglog?J=K.debuglog("stream"):J=function(){};var U=l("./internal/streams/BufferList"),j=l("./internal/streams/destroy"),T;z.inherits(Y,x);var te=["error","close","destroy","pause","resume"];function Z(ye,be,Ke){if(typeof ye.prependListener=="function")return ye.prependListener(be,Ke);!ye._events||!ye._events[be]?ye.on(be,Ke):b(ye._events[be])?ye._events[be].unshift(Ke):ye._events[be]=[Ke,ye._events[be]]}function _(ye,be){p=p||l("./_stream_duplex"),ye=ye||{};var Ke=be instanceof p;this.objectMode=!!ye.objectMode,Ke&&(this.objectMode=this.objectMode||!!ye.readableObjectMode);var q=ye.highWaterMark,m=ye.readableHighWaterMark,c=this.objectMode?16:16*1024;q||q===0?this.highWaterMark=q:Ke&&(m||m===0)?this.highWaterMark=m:this.highWaterMark=c,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new U,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=ye.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,ye.encoding&&(T||(T=l("string_decoder/").StringDecoder),this.decoder=new T(ye.encoding),this.encoding=ye.encoding)}function Y(ye){if(p=p||l("./_stream_duplex"),!(this instanceof Y))return new Y(ye);this._readableState=new _(ye,this),this.readable=!0,ye&&(typeof ye.read=="function"&&(this._read=ye.read),typeof ye.destroy=="function"&&(this._destroy=ye.destroy)),x.call(this)}Object.defineProperty(Y.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(be){if(!this._readableState)return;this._readableState.destroyed=be}}),Y.prototype.destroy=j.destroy,Y.prototype._undestroy=j.undestroy,Y.prototype._destroy=function(ye,be){this.push(null),be(ye)},Y.prototype.push=function(ye,be){var Ke=this._readableState,q;return Ke.objectMode?q=!0:typeof ye=="string"&&(be=be||Ke.defaultEncoding,be!==Ke.encoding&&(ye=S.from(ye,be),be=""),q=!0),re(this,ye,be,!1,q)},Y.prototype.unshift=function(ye){return re(this,ye,null,!0,!1)};function re(ye,be,Ke,q,m){var c=ye._readableState;if(be===null)c.reading=!1,ne(ye,c);else{var R;m||(R=le(c,be)),R?ye.emit("error",R):c.objectMode||be&&be.length>0?(typeof be!="string"&&!c.objectMode&&(0,M.default)(be)!==S.prototype&&(be=B(be)),q?c.endEmitted?ye.emit("error",new Error("stream.unshift() after end event")):pe(ye,c,be,!0):c.ended?ye.emit("error",new Error("stream.push() after EOF")):(c.reading=!1,c.decoder&&!Ke?(be=c.decoder.write(be),c.objectMode||be.length!==0?pe(ye,c,be,!1):de(ye,c)):pe(ye,c,be,!1))):q||(c.reading=!1)}return _e(c)}function pe(ye,be,Ke,q){be.flowing&&be.length===0&&!be.sync?(ye.emit("data",Ke),ye.read(0)):(be.length+=be.objectMode?1:Ke.length,q?be.buffer.unshift(Ke):be.buffer.push(Ke),be.needReadable&&W(ye)),de(ye,be)}function le(ye,be){var Ke;return!Q(be)&&typeof be!="string"&&be!==void 0&&!ye.objectMode&&(Ke=new TypeError("Invalid non-string/buffer chunk")),Ke}function _e(ye){return!ye.ended&&(ye.needReadable||ye.length<ye.highWaterMark||ye.length===0)}Y.prototype.isPaused=function(){return this._readableState.flowing===!1},Y.prototype.setEncoding=function(ye){return T||(T=l("string_decoder/").StringDecoder),this._readableState.decoder=new T(ye),this._readableState.encoding=ye,this};var me=8388608;function ke(ye){return ye>=me?ye=me:(ye--,ye|=ye>>>1,ye|=ye>>>2,ye|=ye>>>4,ye|=ye>>>8,ye|=ye>>>16,ye++),ye}function $(ye,be){return ye<=0||be.length===0&&be.ended?0:be.objectMode?1:ye!==ye?be.flowing&&be.length?be.buffer.head.data.length:be.length:(ye>be.highWaterMark&&(be.highWaterMark=ke(ye)),ye<=be.length?ye:be.ended?be.length:(be.needReadable=!0,0))}Y.prototype.read=function(ye){J("read",ye),ye=parseInt(ye,10);var be=this._readableState,Ke=ye;if(ye!==0&&(be.emittedReadable=!1),ye===0&&be.needReadable&&(be.length>=be.highWaterMark||be.ended))return J("read: emitReadable",be.length,be.ended),be.length===0&&be.ended?Pe(this):W(this),null;if(ye=$(ye,be),ye===0&&be.ended)return be.length===0&&Pe(this),null;var q=be.needReadable;J("need readable",q),(be.length===0||be.length-ye<be.highWaterMark)&&(q=!0,J("length less than watermark",q)),be.ended||be.reading?(q=!1,J("reading or ended",q)):q&&(J("do read"),be.reading=!0,be.sync=!0,be.length===0&&(be.needReadable=!0),this._read(be.highWaterMark),be.sync=!1,be.reading||(ye=$(Ke,be)));var m;return ye>0?m=Ae(ye,be):m=null,m===null?(be.needReadable=!0,ye=0):be.length-=ye,be.length===0&&(be.ended||(be.needReadable=!0),Ke!==ye&&be.ended&&Pe(this)),m!==null&&this.emit("data",m),m};function ne(ye,be){if(be.ended)return;if(be.decoder){var Ke=be.decoder.end();Ke&&Ke.length&&(be.buffer.push(Ke),be.length+=be.objectMode?1:Ke.length)}be.ended=!0,W(ye)}function W(ye){var be=ye._readableState;be.needReadable=!1,be.emittedReadable||(J("emitReadable",be.flowing),be.emittedReadable=!0,be.sync?h.nextTick(ie,ye):ie(ye))}function ie(ye){J("emit readable"),ye.emit("readable"),et(ye)}function de(ye,be){be.readingMore||(be.readingMore=!0,h.nextTick(ee,ye,be))}function ee(ye,be){for(var Ke=be.length;!be.reading&&!be.flowing&&!be.ended&&be.length<be.highWaterMark&&!(J("maybeReadMore read 0"),ye.read(0),Ke===be.length);)Ke=be.length;be.readingMore=!1}Y.prototype._read=function(ye){this.emit("error",new Error("_read() is not implemented"))},Y.prototype.pipe=function(ye,be){var Ke=this,q=this._readableState;switch(q.pipesCount){case 0:q.pipes=ye;break;case 1:q.pipes=[q.pipes,ye];break;default:q.pipes.push(ye);break}q.pipesCount+=1,J("pipe count=%d opts=%j",q.pipesCount,be);var m=(!be||be.end!==!1)&&ye!==y.stdout&&ye!==y.stderr,c=m?fe:It;q.endEmitted?h.nextTick(c):Ke.once("end",c),ye.on("unpipe",R);function R(at,Bt){J("onunpipe"),at===Ke&&(Bt&&Bt.hasUnpiped===!1&&(Bt.hasUnpiped=!0,qe()))}function fe(){J("onend"),ye.end()}var ve=Ce(Ke);ye.on("drain",ve);var Re=!1;function qe(){J("cleanup"),ye.removeListener("close",dt),ye.removeListener("finish",Et),ye.removeListener("drain",ve),ye.removeListener("error",bt),ye.removeListener("unpipe",R),Ke.removeListener("end",fe),Ke.removeListener("end",It),Ke.removeListener("data",st),Re=!0,q.awaitDrain&&(!ye._writableState||ye._writableState.needDrain)&&ve()}var nt=!1;Ke.on("data",st);function st(at){J("ondata"),nt=!1;var Bt=ye.write(at);Bt===!1&&!nt&&((q.pipesCount===1&&q.pipes===ye||q.pipesCount>1&&ot(q.pipes,ye)!==-1)&&!Re&&(J("false write response, pause",Ke._readableState.awaitDrain),Ke._readableState.awaitDrain++,nt=!0),Ke.pause())}function bt(at){J("onerror",at),It(),ye.removeListener("error",bt),I(ye,"error")===0&&ye.emit("error",at)}Z(ye,"error",bt);function dt(){ye.removeListener("finish",Et),It()}ye.once("close",dt);function Et(){J("onfinish"),ye.removeListener("close",dt),It()}ye.once("finish",Et);function It(){J("unpipe"),Ke.unpipe(ye)}return ye.emit("pipe",Ke),q.flowing||(J("pipe resume"),Ke.resume()),ye};function Ce(ye){return function(){var be=ye._readableState;J("pipeOnDrain",be.awaitDrain),be.awaitDrain&&be.awaitDrain--,be.awaitDrain===0&&I(ye,"data")&&(be.flowing=!0,et(ye))}}Y.prototype.unpipe=function(ye){var be=this._readableState,Ke={hasUnpiped:!1};if(be.pipesCount===0)return this;if(be.pipesCount===1)return ye&&ye!==be.pipes?this:(ye||(ye=be.pipes),be.pipes=null,be.pipesCount=0,be.flowing=!1,ye&&ye.emit("unpipe",this,Ke),this);if(!ye){var q=be.pipes,m=be.pipesCount;be.pipes=null,be.pipesCount=0,be.flowing=!1;for(var c=0;c<m;c++)q[c].emit("unpipe",this,Ke);return this}var R=ot(be.pipes,ye);return R===-1?this:(be.pipes.splice(R,1),be.pipesCount-=1,be.pipesCount===1&&(be.pipes=be.pipes[0]),ye.emit("unpipe",this,Ke),this)},Y.prototype.on=function(ye,be){var Ke=x.prototype.on.call(this,ye,be);if(ye==="data")this._readableState.flowing!==!1&&this.resume();else if(ye==="readable"){var q=this._readableState;!q.endEmitted&&!q.readableListening&&(q.readableListening=q.needReadable=!0,q.emittedReadable=!1,q.reading?q.length&&W(this):h.nextTick(De,this))}return Ke},Y.prototype.addListener=Y.prototype.on;function De(ye){J("readable nexttick read 0"),ye.read(0)}Y.prototype.resume=function(){var ye=this._readableState;return ye.flowing||(J("resume"),ye.flowing=!0,Le(this,ye)),this};function Le(ye,be){be.resumeScheduled||(be.resumeScheduled=!0,h.nextTick(Ye,ye,be))}function Ye(ye,be){be.reading||(J("resume read 0"),ye.read(0)),be.resumeScheduled=!1,be.awaitDrain=0,ye.emit("resume"),et(ye),be.flowing&&!be.reading&&ye.read(0)}Y.prototype.pause=function(){return J("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(J("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function et(ye){var be=ye._readableState;for(J("flow",be.flowing);be.flowing&&ye.read()!==null;);}Y.prototype.wrap=function(ye){var be=this,Ke=this._readableState,q=!1;ye.on("end",function(){if(J("wrapped end"),Ke.decoder&&!Ke.ended){var R=Ke.decoder.end();R&&R.length&&be.push(R)}be.push(null)}),ye.on("data",function(R){if(J("wrapped data"),Ke.decoder&&(R=Ke.decoder.write(R)),Ke.objectMode&&R==null)return;if(!Ke.objectMode&&(!R||!R.length))return;var fe=be.push(R);fe||(q=!0,ye.pause())});for(var m in ye)this[m]===void 0&&typeof ye[m]=="function"&&(this[m]=function(R){return function(){return ye[R].apply(ye,arguments)}}(m));for(var c=0;c<te.length;c++)ye.on(te[c],this.emit.bind(this,te[c]));return this._read=function(R){J("wrapped _read",R),q&&(q=!1,ye.resume())},this},Object.defineProperty(Y.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Y._fromList=Ae;function Ae(ye,be){if(be.length===0)return null;var Ke;return be.objectMode?Ke=be.buffer.shift():!ye||ye>=be.length?(be.decoder?Ke=be.buffer.join(""):be.buffer.length===1?Ke=be.buffer.head.data:Ke=be.buffer.concat(be.length),be.buffer.clear()):Ke=ct(ye,be.buffer,be.decoder),Ke}function ct(ye,be,Ke){var q;return ye<be.head.data.length?(q=be.head.data.slice(0,ye),be.head.data=be.head.data.slice(ye)):ye===be.head.data.length?q=be.shift():q=Ke?$e(ye,be):Fe(ye,be),q}function $e(ye,be){var Ke=be.head,q=1,m=Ke.data;for(ye-=m.length;Ke=Ke.next;){var c=Ke.data,R=ye>c.length?c.length:ye;if(R===c.length?m+=c:m+=c.slice(0,ye),ye-=R,ye===0){R===c.length?(++q,Ke.next?be.head=Ke.next:be.head=be.tail=null):(be.head=Ke,Ke.data=c.slice(R));break}++q}return be.length-=q,m}function Fe(ye,be){var Ke=S.allocUnsafe(ye),q=be.head,m=1;for(q.data.copy(Ke),ye-=q.data.length;q=q.next;){var c=q.data,R=ye>c.length?c.length:ye;if(c.copy(Ke,Ke.length-ye,0,R),ye-=R,ye===0){R===c.length?(++m,q.next?be.head=q.next:be.head=be.tail=null):(be.head=q,q.data=c.slice(R));break}++m}return be.length-=m,Ke}function Pe(ye){var be=ye._readableState;if(be.length>0)throw new Error('"endReadable()" called on non-empty stream');be.endEmitted||(be.ended=!0,h.nextTick(He,be,ye))}function He(ye,be){!ye.endEmitted&&ye.length===0&&(ye.endEmitted=!0,be.readable=!1,be.emit("end"))}function ot(ye,be){for(var Ke=0,q=ye.length;Ke<q;Ke++)if(ye[Ke]===be)return Ke;return-1}}).call(this,l("_process"),typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./_stream_duplex":214,"./internal/streams/BufferList":219,"./internal/streams/destroy":220,"./internal/streams/stream":221,_process:208,"babel-runtime/core-js/object/create":55,"babel-runtime/core-js/object/get-prototype-of":59,"core-util-is":189,events:192,inherits:196,isarray:198,"process-nextick-args":207,"safe-buffer":228,"string_decoder/":235,util:71}],217:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(p){return p&&p.__esModule?p:{default:p}}G.exports=g;var M=l("./_stream_duplex"),D=(0,d.default)(l("core-util-is"));D.inherits=l("inherits"),D.inherits(g,M);function E(p,v){var I=this._transformState;I.transforming=!1;var x=I.writecb;if(!x)return this.emit("error",new Error("write callback called multiple times"));I.writechunk=null,I.writecb=null,v!=null&&this.push(v),x(p);var S=this._readableState;S.reading=!1,(S.needReadable||S.length<S.highWaterMark)&&this._read(S.highWaterMark)}function g(p){if(!(this instanceof g))return new g(p);M.call(this,p),this._transformState={afterTransform:E.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,p&&(typeof p.transform=="function"&&(this._transform=p.transform),typeof p.flush=="function"&&(this._flush=p.flush)),this.on("prefinish",h)}function h(){var p=this;typeof this._flush=="function"?this._flush(function(v,I){b(p,v,I)}):b(this,null,null)}g.prototype.push=function(p,v){return this._transformState.needTransform=!1,M.prototype.push.call(this,p,v)},g.prototype._transform=function(p,v,I){throw new Error("_transform() is not implemented")},g.prototype._write=function(p,v,I){var x=this._transformState;if(x.writecb=I,x.writechunk=p,x.writeencoding=v,!x.transforming){var S=this._readableState;(x.needTransform||S.needReadable||S.length<S.highWaterMark)&&this._read(S.highWaterMark)}},g.prototype._read=function(p){var v=this._transformState;v.writechunk!==null&&v.writecb&&!v.transforming?(v.transforming=!0,this._transform(v.writechunk,v.writeencoding,v.afterTransform)):v.needTransform=!0},g.prototype._destroy=function(p,v){var I=this;M.prototype._destroy.call(this,p,function(x){v(x),I.emit("close")})};function b(p,v,I){if(v)return p.emit("error",v);if(I!=null&&p.push(I),p._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(p._transformState.transforming)throw new Error("Calling transform done when still transforming");return p.push(null)}},{"./_stream_duplex":214,"babel-runtime/core-js/object/create":55,"core-util-is":189,inherits:196}],218:[function(l,G,N){(function(y,d){"use strict";var F=l("babel-runtime/core-js/object/define-property"),M=x(F),D=l("babel-runtime/core-js/symbol/has-instance"),E=x(D),g=l("babel-runtime/core-js/symbol"),h=x(g),b=l("babel-runtime/core-js/object/create"),p=x(b),v=l("babel-runtime/core-js/set-immediate"),I=x(v);function x(Fe){return Fe&&Fe.__esModule?Fe:{default:Fe}}var S=l("process-nextick-args");G.exports=le;function H(Fe,Pe,He){this.chunk=Fe,this.encoding=Pe,this.callback=He,this.next=null}function B(Fe){var Pe=this;this.next=null,this.entry=null,this.finish=function(){$e(Pe,Fe)}}var Q=!y.browser&&["v0.10","v0.9."].indexOf(y.version.slice(0,5))>-1?I.default:S.nextTick,z;le.WritableState=re;var K=(0,p.default)(l("core-util-is"));K.inherits=l("inherits");var J={deprecate:l("util-deprecate")},U=l("./internal/streams/stream"),j=l("safe-buffer").Buffer,T=d.Uint8Array||function(){};function te(Fe){return j.from(Fe)}function Z(Fe){return j.isBuffer(Fe)||Fe instanceof T}var _=l("./internal/streams/destroy");K.inherits(le,U);function Y(){}function re(Fe,Pe){z=z||l("./_stream_duplex"),Fe=Fe||{};var He=Pe instanceof z;this.objectMode=!!Fe.objectMode,He&&(this.objectMode=this.objectMode||!!Fe.writableObjectMode);var ot=Fe.highWaterMark,ye=Fe.writableHighWaterMark,be=this.objectMode?16:16*1024;ot||ot===0?this.highWaterMark=ot:He&&(ye||ye===0)?this.highWaterMark=ye:this.highWaterMark=be,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Ke=Fe.decodeStrings===!1;this.decodeStrings=!Ke,this.defaultEncoding=Fe.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(q){de(Pe,q)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new B(this)}re.prototype.getBuffer=function(){for(var Pe=this.bufferedRequest,He=[];Pe;)He.push(Pe),Pe=Pe.next;return He},function(){try{Object.defineProperty(re.prototype,"buffer",{get:J.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(Fe){}}();var pe;typeof h.default=="function"&&E.default&&typeof Function.prototype[E.default]=="function"?(pe=Function.prototype[E.default],(0,M.default)(le,E.default,{value:function(Pe){return pe.call(this,Pe)?!0:this!==le?!1:Pe&&Pe._writableState instanceof re}})):pe=function(Pe){return Pe instanceof this};function le(Fe){if(z=z||l("./_stream_duplex"),!pe.call(le,this)&&!(this instanceof z))return new le(Fe);this._writableState=new re(Fe,this),this.writable=!0,Fe&&(typeof Fe.write=="function"&&(this._write=Fe.write),typeof Fe.writev=="function"&&(this._writev=Fe.writev),typeof Fe.destroy=="function"&&(this._destroy=Fe.destroy),typeof Fe.final=="function"&&(this._final=Fe.final)),U.call(this)}le.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function _e(Fe,Pe){var He=new Error("write after end");Fe.emit("error",He),S.nextTick(Pe,He)}function me(Fe,Pe,He,ot){var ye=!0,be=!1;return He===null?be=new TypeError("May not write null values to stream"):typeof He!="string"&&He!==void 0&&!Pe.objectMode&&(be=new TypeError("Invalid non-string/buffer chunk")),be&&(Fe.emit("error",be),S.nextTick(ot,be),ye=!1),ye}le.prototype.write=function(Fe,Pe,He){var ot=this._writableState,ye=!1,be=!ot.objectMode&&Z(Fe);return be&&!j.isBuffer(Fe)&&(Fe=te(Fe)),typeof Pe=="function"&&(He=Pe,Pe=null),be?Pe="buffer":Pe||(Pe=ot.defaultEncoding),typeof He!="function"&&(He=Y),ot.ended?_e(this,He):(be||me(this,ot,Fe,He))&&(ot.pendingcb++,ye=$(this,ot,be,Fe,Pe,He)),ye},le.prototype.cork=function(){var Fe=this._writableState;Fe.corked++},le.prototype.uncork=function(){var Fe=this._writableState;Fe.corked&&(Fe.corked--,!Fe.writing&&!Fe.corked&&!Fe.finished&&!Fe.bufferProcessing&&Fe.bufferedRequest&&De(this,Fe))},le.prototype.setDefaultEncoding=function(Pe){if(typeof Pe=="string"&&(Pe=Pe.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Pe+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+Pe);return this._writableState.defaultEncoding=Pe,this};function ke(Fe,Pe,He){return!Fe.objectMode&&Fe.decodeStrings!==!1&&typeof Pe=="string"&&(Pe=j.from(Pe,He)),Pe}Object.defineProperty(le.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function $(Fe,Pe,He,ot,ye,be){if(!He){var Ke=ke(Pe,ot,ye);ot!==Ke&&(He=!0,ye="buffer",ot=Ke)}var q=Pe.objectMode?1:ot.length;Pe.length+=q;var m=Pe.length<Pe.highWaterMark;if(m||(Pe.needDrain=!0),Pe.writing||Pe.corked){var c=Pe.lastBufferedRequest;Pe.lastBufferedRequest={chunk:ot,encoding:ye,isBuf:He,callback:be,next:null},c?c.next=Pe.lastBufferedRequest:Pe.bufferedRequest=Pe.lastBufferedRequest,Pe.bufferedRequestCount+=1}else ne(Fe,Pe,!1,q,ot,ye,be);return m}function ne(Fe,Pe,He,ot,ye,be,Ke){Pe.writelen=ot,Pe.writecb=Ke,Pe.writing=!0,Pe.sync=!0,He?Fe._writev(ye,Pe.onwrite):Fe._write(ye,be,Pe.onwrite),Pe.sync=!1}function W(Fe,Pe,He,ot,ye){--Pe.pendingcb,He?(S.nextTick(ye,ot),S.nextTick(Ae,Fe,Pe),Fe._writableState.errorEmitted=!0,Fe.emit("error",ot)):(ye(ot),Fe._writableState.errorEmitted=!0,Fe.emit("error",ot),Ae(Fe,Pe))}function ie(Fe){Fe.writing=!1,Fe.writecb=null,Fe.length-=Fe.writelen,Fe.writelen=0}function de(Fe,Pe){var He=Fe._writableState,ot=He.sync,ye=He.writecb;if(ie(He),Pe)W(Fe,He,ot,Pe,ye);else{var be=Le(He);!be&&!He.corked&&!He.bufferProcessing&&He.bufferedRequest&&De(Fe,He),ot?Q(ee,Fe,He,be,ye):ee(Fe,He,be,ye)}}function ee(Fe,Pe,He,ot){He||Ce(Fe,Pe),Pe.pendingcb--,ot(),Ae(Fe,Pe)}function Ce(Fe,Pe){Pe.length===0&&Pe.needDrain&&(Pe.needDrain=!1,Fe.emit("drain"))}function De(Fe,Pe){Pe.bufferProcessing=!0;var He=Pe.bufferedRequest;if(Fe._writev&&He&&He.next){var ot=Pe.bufferedRequestCount,ye=new Array(ot),be=Pe.corkedRequestsFree;be.entry=He;for(var Ke=0,q=!0;He;)ye[Ke]=He,He.isBuf||(q=!1),He=He.next,Ke+=1;ye.allBuffers=q,ne(Fe,Pe,!0,Pe.length,ye,"",be.finish),Pe.pendingcb++,Pe.lastBufferedRequest=null,be.next?(Pe.corkedRequestsFree=be.next,be.next=null):Pe.corkedRequestsFree=new B(Pe),Pe.bufferedRequestCount=0}else{for(;He;){var m=He.chunk,c=He.encoding,R=He.callback,fe=Pe.objectMode?1:m.length;if(ne(Fe,Pe,!1,fe,m,c,R),He=He.next,Pe.bufferedRequestCount--,Pe.writing)break}He===null&&(Pe.lastBufferedRequest=null)}Pe.bufferedRequest=He,Pe.bufferProcessing=!1}le.prototype._write=function(Fe,Pe,He){He(new Error("_write() is not implemented"))},le.prototype._writev=null,le.prototype.end=function(Fe,Pe,He){var ot=this._writableState;typeof Fe=="function"?(He=Fe,Fe=null,Pe=null):typeof Pe=="function"&&(He=Pe,Pe=null),Fe!=null&&this.write(Fe,Pe),ot.corked&&(ot.corked=1,this.uncork()),!ot.ending&&!ot.finished&&ct(this,ot,He)};function Le(Fe){return Fe.ending&&Fe.length===0&&Fe.bufferedRequest===null&&!Fe.finished&&!Fe.writing}function Ye(Fe,Pe){Fe._final(function(He){Pe.pendingcb--,He&&Fe.emit("error",He),Pe.prefinished=!0,Fe.emit("prefinish"),Ae(Fe,Pe)})}function et(Fe,Pe){!Pe.prefinished&&!Pe.finalCalled&&(typeof Fe._final=="function"?(Pe.pendingcb++,Pe.finalCalled=!0,S.nextTick(Ye,Fe,Pe)):(Pe.prefinished=!0,Fe.emit("prefinish")))}function Ae(Fe,Pe){var He=Le(Pe);return He&&(et(Fe,Pe),Pe.pendingcb===0&&(Pe.finished=!0,Fe.emit("finish"))),He}function ct(Fe,Pe,He){Pe.ending=!0,Ae(Fe,Pe),He&&(Pe.finished?S.nextTick(He):Fe.once("finish",He)),Pe.ended=!0,Fe.writable=!1}function $e(Fe,Pe,He){var ot=Fe.entry;for(Fe.entry=null;ot;){var ye=ot.callback;Pe.pendingcb--,ye(He),ot=ot.next}Pe.corkedRequestsFree?Pe.corkedRequestsFree.next=Fe:Pe.corkedRequestsFree=Fe}Object.defineProperty(le.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(Pe){if(!this._writableState)return;this._writableState.destroyed=Pe}}),le.prototype.destroy=_.destroy,le.prototype._undestroy=_.undestroy,le.prototype._destroy=function(Fe,Pe){this.end(),Pe(Fe)}}).call(this,l("_process"),typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./_stream_duplex":214,"./internal/streams/destroy":220,"./internal/streams/stream":221,_process:208,"babel-runtime/core-js/object/create":55,"babel-runtime/core-js/object/define-property":56,"babel-runtime/core-js/set-immediate":62,"babel-runtime/core-js/symbol":64,"babel-runtime/core-js/symbol/has-instance":65,"core-util-is":189,inherits:196,"process-nextick-args":207,"safe-buffer":228,"util-deprecate":240}],219:[function(l,G,N){"use strict";function y(D,E){if(!(D instanceof E))throw new TypeError("Cannot call a class as a function")}var d=l("safe-buffer").Buffer,F=l("util");function M(D,E,g){D.copy(E,g)}G.exports=function(){function D(){y(this,D),this.head=null,this.tail=null,this.length=0}return D.prototype.push=function(g){var h={data:g,next:null};this.length>0?this.tail.next=h:this.head=h,this.tail=h,++this.length},D.prototype.unshift=function(g){var h={data:g,next:this.head};this.length===0&&(this.tail=h),this.head=h,++this.length},D.prototype.shift=function(){if(this.length===0)return;var g=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,g},D.prototype.clear=function(){this.head=this.tail=null,this.length=0},D.prototype.join=function(g){if(this.length===0)return"";for(var h=this.head,b=""+h.data;h=h.next;)b+=g+h.data;return b},D.prototype.concat=function(g){if(this.length===0)return d.alloc(0);if(this.length===1)return this.head.data;for(var h=d.allocUnsafe(g>>>0),b=this.head,p=0;b;)M(b.data,h,p),p+=b.data.length,b=b.next;return h},D}(),F&&F.inspect&&F.inspect.custom&&(G.exports.prototype[F.inspect.custom]=function(){var D=F.inspect({length:this.length});return this.constructor.name+" "+D})},{"safe-buffer":228,util:71}],220:[function(l,G,N){"use strict";var y=l("process-nextick-args");function d(D,E){var g=this,h=this._readableState&&this._readableState.destroyed,b=this._writableState&&this._writableState.destroyed;return h||b?(E?E(D):D&&(!this._writableState||!this._writableState.errorEmitted)&&y.nextTick(M,this,D),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(D||null,function(p){!E&&p?(y.nextTick(M,g,p),g._writableState&&(g._writableState.errorEmitted=!0)):E&&E(p)}),this)}function F(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function M(D,E){D.emit("error",E)}G.exports={destroy:d,undestroy:F}},{"process-nextick-args":207}],221:[function(l,G,N){"use strict";G.exports=l("events").EventEmitter},{events:192}],222:[function(l,G,N){G.exports=l("./readable").PassThrough},{"./readable":223}],223:[function(l,G,N){N=G.exports=l("./lib/_stream_readable.js"),N.Stream=N,N.Readable=N,N.Writable=l("./lib/_stream_writable.js"),N.Duplex=l("./lib/_stream_duplex.js"),N.Transform=l("./lib/_stream_transform.js"),N.PassThrough=l("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":214,"./lib/_stream_passthrough.js":215,"./lib/_stream_readable.js":216,"./lib/_stream_transform.js":217,"./lib/_stream_writable.js":218}],224:[function(l,G,N){G.exports=l("./readable").Transform},{"./readable":223}],225:[function(l,G,N){G.exports=l("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":218}],226:[function(l,G,N){var y=function(){return this}()||Function("return this")(),d=y.regeneratorRuntime&&Object.getOwnPropertyNames(y).indexOf("regeneratorRuntime")>=0,F=d&&y.regeneratorRuntime;if(y.regeneratorRuntime=void 0,G.exports=l("./runtime"),d)y.regeneratorRuntime=F;else try{delete y.regeneratorRuntime}catch(M){y.regeneratorRuntime=void 0}},{"./runtime":227}],227:[function(l,G,N){!function(y){"use strict";var d=Object.prototype,F=d.hasOwnProperty,M,D=typeof Symbol=="function"?Symbol:{},E=D.iterator||"@@iterator",g=D.asyncIterator||"@@asyncIterator",h=D.toStringTag||"@@toStringTag",b=typeof G=="object",p=y.regeneratorRuntime;if(p){b&&(G.exports=p);return}p=y.regeneratorRuntime=b?G.exports:{};function v($,ne,W,ie){var de=ne&&ne.prototype instanceof z?ne:z,ee=Object.create(de.prototype),Ce=new _e(ie||[]);return ee._invoke=Y($,W,Ce),ee}p.wrap=v;function I($,ne,W){try{return{type:"normal",arg:$.call(ne,W)}}catch(ie){return{type:"throw",arg:ie}}}var x="suspendedStart",S="suspendedYield",H="executing",B="completed",Q={};function z(){}function K(){}function J(){}var U={};U[E]=function(){return this};var j=Object.getPrototypeOf,T=j&&j(j(me([])));T&&T!==d&&F.call(T,E)&&(U=T);var te=J.prototype=z.prototype=Object.create(U);K.prototype=te.constructor=J,J.constructor=K,J[h]=K.displayName="GeneratorFunction";function Z($){["next","throw","return"].forEach(function(ne){$[ne]=function(W){return this._invoke(ne,W)}})}p.isGeneratorFunction=function($){var ne=typeof $=="function"&&$.constructor;return ne?ne===K||(ne.displayName||ne.name)==="GeneratorFunction":!1},p.mark=function($){return Object.setPrototypeOf?Object.setPrototypeOf($,J):($.__proto__=J,h in $||($[h]="GeneratorFunction")),$.prototype=Object.create(te),$},p.awrap=function($){return{__await:$}};function _($){function ne(de,ee,Ce,De){var Le=I($[de],$,ee);if(Le.type==="throw")De(Le.arg);else{var Ye=Le.arg,et=Ye.value;return et&&typeof et=="object"&&F.call(et,"__await")?Promise.resolve(et.__await).then(function(Ae){ne("next",Ae,Ce,De)},function(Ae){ne("throw",Ae,Ce,De)}):Promise.resolve(et).then(function(Ae){Ye.value=Ae,Ce(Ye)},De)}}var W;function ie(de,ee){function Ce(){return new Promise(function(De,Le){ne(de,ee,De,Le)})}return W=W?W.then(Ce,Ce):Ce()}this._invoke=ie}Z(_.prototype),_.prototype[g]=function(){return this},p.AsyncIterator=_,p.async=function($,ne,W,ie){var de=new _(v($,ne,W,ie));return p.isGeneratorFunction(ne)?de:de.next().then(function(ee){return ee.done?ee.value:de.next()})};function Y($,ne,W){var ie=x;return function(ee,Ce){if(ie===H)throw new Error("Generator is already running");if(ie===B){if(ee==="throw")throw Ce;return ke()}for(W.method=ee,W.arg=Ce;;){var De=W.delegate;if(De){var Le=re(De,W);if(Le){if(Le===Q)continue;return Le}}if(W.method==="next")W.sent=W._sent=W.arg;else if(W.method==="throw"){if(ie===x)throw ie=B,W.arg;W.dispatchException(W.arg)}else W.method==="return"&&W.abrupt("return",W.arg);ie=H;var Ye=I($,ne,W);if(Ye.type==="normal"){if(ie=W.done?B:S,Ye.arg===Q)continue;return{value:Ye.arg,done:W.done}}else Ye.type==="throw"&&(ie=B,W.method="throw",W.arg=Ye.arg)}}}function re($,ne){var W=$.iterator[ne.method];if(W===M){if(ne.delegate=null,ne.method==="throw"){if($.iterator.return&&(ne.method="return",ne.arg=M,re($,ne),ne.method==="throw"))return Q;ne.method="throw",ne.arg=new TypeError("The iterator does not provide a 'throw' method")}return Q}var ie=I(W,$.iterator,ne.arg);if(ie.type==="throw")return ne.method="throw",ne.arg=ie.arg,ne.delegate=null,Q;var de=ie.arg;if(!de)return ne.method="throw",ne.arg=new TypeError("iterator result is not an object"),ne.delegate=null,Q;if(de.done)ne[$.resultName]=de.value,ne.next=$.nextLoc,ne.method!=="return"&&(ne.method="next",ne.arg=M);else return de;return ne.delegate=null,Q}Z(te),te[h]="Generator",te[E]=function(){return this},te.toString=function(){return"[object Generator]"};function pe($){var ne={tryLoc:$[0]};1 in $&&(ne.catchLoc=$[1]),2 in $&&(ne.finallyLoc=$[2],ne.afterLoc=$[3]),this.tryEntries.push(ne)}function le($){var ne=$.completion||{};ne.type="normal",delete ne.arg,$.completion=ne}function _e($){this.tryEntries=[{tryLoc:"root"}],$.forEach(pe,this),this.reset(!0)}p.keys=function($){var ne=[];for(var W in $)ne.push(W);return ne.reverse(),function ie(){for(;ne.length;){var de=ne.pop();if(de in $)return ie.value=de,ie.done=!1,ie}return ie.done=!0,ie}};function me($){if($){var ne=$[E];if(ne)return ne.call($);if(typeof $.next=="function")return $;if(!isNaN($.length)){var W=-1,ie=function de(){for(;++W<$.length;)if(F.call($,W))return de.value=$[W],de.done=!1,de;return de.value=M,de.done=!0,de};return ie.next=ie}}return{next:ke}}p.values=me;function ke(){return{value:M,done:!0}}_e.prototype={constructor:_e,reset:function($){if(this.prev=0,this.next=0,this.sent=this._sent=M,this.done=!1,this.delegate=null,this.method="next",this.arg=M,this.tryEntries.forEach(le),!$)for(var ne in this)ne.charAt(0)==="t"&&F.call(this,ne)&&!isNaN(+ne.slice(1))&&(this[ne]=M)},stop:function(){this.done=!0;var $=this.tryEntries[0],ne=$.completion;if(ne.type==="throw")throw ne.arg;return this.rval},dispatchException:function($){if(this.done)throw $;var ne=this;function W(Le,Ye){return ee.type="throw",ee.arg=$,ne.next=Le,Ye&&(ne.method="next",ne.arg=M),!!Ye}for(var ie=this.tryEntries.length-1;ie>=0;--ie){var de=this.tryEntries[ie],ee=de.completion;if(de.tryLoc==="root")return W("end");if(de.tryLoc<=this.prev){var Ce=F.call(de,"catchLoc"),De=F.call(de,"finallyLoc");if(Ce&&De){if(this.prev<de.catchLoc)return W(de.catchLoc,!0);if(this.prev<de.finallyLoc)return W(de.finallyLoc)}else if(Ce){if(this.prev<de.catchLoc)return W(de.catchLoc,!0)}else if(De){if(this.prev<de.finallyLoc)return W(de.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function($,ne){for(var W=this.tryEntries.length-1;W>=0;--W){var ie=this.tryEntries[W];if(ie.tryLoc<=this.prev&&F.call(ie,"finallyLoc")&&this.prev<ie.finallyLoc){var de=ie;break}}de&&($==="break"||$==="continue")&&de.tryLoc<=ne&&ne<=de.finallyLoc&&(de=null);var ee=de?de.completion:{};return ee.type=$,ee.arg=ne,de?(this.method="next",this.next=de.finallyLoc,Q):this.complete(ee)},complete:function($,ne){if($.type==="throw")throw $.arg;return $.type==="break"||$.type==="continue"?this.next=$.arg:$.type==="return"?(this.rval=this.arg=$.arg,this.method="return",this.next="end"):$.type==="normal"&&ne&&(this.next=ne),Q},finish:function($){for(var ne=this.tryEntries.length-1;ne>=0;--ne){var W=this.tryEntries[ne];if(W.finallyLoc===$)return this.complete(W.completion,W.afterLoc),le(W),Q}},catch:function($){for(var ne=this.tryEntries.length-1;ne>=0;--ne){var W=this.tryEntries[ne];if(W.tryLoc===$){var ie=W.completion;if(ie.type==="throw"){var de=ie.arg;le(W)}return de}}throw new Error("illegal catch attempt")},delegateYield:function($,ne,W){return this.delegate={iterator:me($),resultName:ne,nextLoc:W},this.method==="next"&&(this.arg=M),Q}}}(function(){return this}()||Function("return this")())},{}],228:[function(l,G,N){var y=l("buffer"),d=y.Buffer;function F(D,E){for(var g in D)E[g]=D[g]}d.from&&d.alloc&&d.allocUnsafe&&d.allocUnsafeSlow?G.exports=y:(F(y,N),N.Buffer=M);function M(D,E,g){return d(D,E,g)}F(d,M),M.from=function(D,E,g){if(typeof D=="number")throw new TypeError("Argument must not be a number");return d(D,E,g)},M.alloc=function(D,E,g){if(typeof D!="number")throw new TypeError("Argument must be a number");var h=d(D);return E!==void 0?typeof g=="string"?h.fill(E,g):h.fill(E):h.fill(0),h},M.allocUnsafe=function(D){if(typeof D!="number")throw new TypeError("Argument must be a number");return d(D)},M.allocUnsafeSlow=function(D){if(typeof D!="number")throw new TypeError("Argument must be a number");return y.SlowBuffer(D)}},{buffer:73}],229:[function(l,G,N){(function(y){"use strict";var d=l("babel-runtime/core-js/string/from-code-point"),F=S(d),M=l("babel-runtime/core-js/json/stringify"),D=S(M),E=l("babel-runtime/helpers/typeof"),g=S(E),h=l("babel-runtime/core-js/object/define-property"),b=S(h),p=l("babel-runtime/core-js/object/keys"),v=S(p),I=l("babel-runtime/core-js/object/create"),x=S(I);function S(H){return H&&H.__esModule?H:{default:H}}(function(H){H.parser=function(c,R){return new Q(c,R)},H.SAXParser=Q,H.SAXStream=te,H.createStream=T,H.MAX_BUFFER_LENGTH=64*1024;var B=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];H.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function Q(c,R){if(!(this instanceof Q))return new Q(c,R);var fe=this;K(fe),fe.q=fe.c="",fe.bufferCheckPosition=H.MAX_BUFFER_LENGTH,fe.opt=R||{},fe.opt.lowercase=fe.opt.lowercase||fe.opt.lowercasetags,fe.looseCase=fe.opt.lowercase?"toLowerCase":"toUpperCase",fe.tags=[],fe.closed=fe.closedRoot=fe.sawRoot=!1,fe.tag=fe.error=null,fe.strict=!!c,fe.noscript=!!(c||fe.opt.noscript),fe.state=ee.BEGIN,fe.strictEntities=fe.opt.strictEntities,fe.ENTITIES=fe.strictEntities?(0,x.default)(H.XML_ENTITIES):(0,x.default)(H.ENTITIES),fe.attribList=[],fe.opt.xmlns&&(fe.ns=(0,x.default)(pe)),fe.trackPosition=fe.opt.position!==!1,fe.trackPosition&&(fe.position=fe.line=fe.column=0),De(fe,"onready")}x.default||(Object.create=function(c){function R(){}R.prototype=c;var fe=new R;return fe}),v.default||(Object.keys=function(c){var R=[];for(var fe in c)c.hasOwnProperty(fe)&&R.push(fe);return R});function z(c){for(var R=Math.max(H.MAX_BUFFER_LENGTH,10),fe=0,ve=0,Re=B.length;ve<Re;ve++){var qe=c[B[ve]].length;if(qe>R)switch(B[ve]){case"textNode":Ye(c);break;case"cdata":Le(c,"oncdata",c.cdata),c.cdata="";break;case"script":Le(c,"onscript",c.script),c.script="";break;default:Ae(c,"Max buffer length exceeded: "+B[ve])}fe=Math.max(fe,qe)}var nt=H.MAX_BUFFER_LENGTH-fe;c.bufferCheckPosition=nt+c.position}function K(c){for(var R=0,fe=B.length;R<fe;R++)c[B[R]]=""}function J(c){Ye(c),c.cdata!==""&&(Le(c,"oncdata",c.cdata),c.cdata=""),c.script!==""&&(Le(c,"onscript",c.script),c.script="")}Q.prototype={end:function(){ct(this)},write:m,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){J(this)}};var U;try{U=l("stream").Stream}catch(c){U=function(){}}var j=H.EVENTS.filter(function(c){return c!=="error"&&c!=="end"});function T(c,R){return new te(c,R)}function te(c,R){if(!(this instanceof te))return new te(c,R);U.apply(this),this._parser=new Q(c,R),this.writable=!0,this.readable=!0;var fe=this;this._parser.onend=function(){fe.emit("end")},this._parser.onerror=function(ve){fe.emit("error",ve),fe._parser.error=null},this._decoder=null,j.forEach(function(ve){(0,b.default)(fe,"on"+ve,{get:function(){return fe._parser["on"+ve]},set:function(qe){if(!qe)return fe.removeAllListeners(ve),fe._parser["on"+ve]=qe,qe;fe.on(ve,qe)},enumerable:!0,configurable:!1})})}te.prototype=(0,x.default)(U.prototype,{constructor:{value:te}}),te.prototype.write=function(c){if(typeof y=="function"&&typeof y.isBuffer=="function"&&y.isBuffer(c)){if(!this._decoder){var R=l("string_decoder").StringDecoder;this._decoder=new R("utf8")}c=this._decoder.write(c)}return this._parser.write(c.toString()),this.emit("data",c),!0},te.prototype.end=function(c){return c&&c.length&&this.write(c),this._parser.end(),!0},te.prototype.on=function(c,R){var fe=this;return!fe._parser["on"+c]&&j.indexOf(c)!==-1&&(fe._parser["on"+c]=function(){var ve=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);ve.splice(0,0,c),fe.emit.apply(fe,ve)}),U.prototype.on.call(fe,c,R)};var Z="[CDATA[",_="DOCTYPE",Y="http://www.w3.org/XML/1998/namespace",re="http://www.w3.org/2000/xmlns/",pe={xml:Y,xmlns:re},le=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,_e=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,me=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,ke=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function $(c){return c===" "||c===`
`||c==="\r"||c===" "}function ne(c){return c==='"'||c==="'"}function W(c){return c===">"||$(c)}function ie(c,R){return c.test(R)}function de(c,R){return!ie(c,R)}var ee=0;H.STATE={BEGIN:ee++,BEGIN_WHITESPACE:ee++,TEXT:ee++,TEXT_ENTITY:ee++,OPEN_WAKA:ee++,SGML_DECL:ee++,SGML_DECL_QUOTED:ee++,DOCTYPE:ee++,DOCTYPE_QUOTED:ee++,DOCTYPE_DTD:ee++,DOCTYPE_DTD_QUOTED:ee++,COMMENT_STARTING:ee++,COMMENT:ee++,COMMENT_ENDING:ee++,COMMENT_ENDED:ee++,CDATA:ee++,CDATA_ENDING:ee++,CDATA_ENDING_2:ee++,PROC_INST:ee++,PROC_INST_BODY:ee++,PROC_INST_ENDING:ee++,OPEN_TAG:ee++,OPEN_TAG_SLASH:ee++,ATTRIB:ee++,ATTRIB_NAME:ee++,ATTRIB_NAME_SAW_WHITE:ee++,ATTRIB_VALUE:ee++,ATTRIB_VALUE_QUOTED:ee++,ATTRIB_VALUE_CLOSED:ee++,ATTRIB_VALUE_UNQUOTED:ee++,ATTRIB_VALUE_ENTITY_Q:ee++,ATTRIB_VALUE_ENTITY_U:ee++,CLOSE_TAG:ee++,CLOSE_TAG_SAW_WHITE:ee++,SCRIPT:ee++,SCRIPT_ENDING:ee++},H.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},H.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},(0,v.default)(H.ENTITIES).forEach(function(c){var R=H.ENTITIES[c],fe=typeof R=="number"?String.fromCharCode(R):R;H.ENTITIES[c]=fe});for(var Ce in H.STATE)H.STATE[H.STATE[Ce]]=Ce;ee=H.STATE;function De(c,R,fe){c[R]&&c[R](fe)}function Le(c,R,fe){c.textNode&&Ye(c),De(c,R,fe)}function Ye(c){c.textNode=et(c.opt,c.textNode),c.textNode&&De(c,"ontext",c.textNode),c.textNode=""}function et(c,R){return c.trim&&(R=R.trim()),c.normalize&&(R=R.replace(/\s+/g," ")),R}function Ae(c,R){return Ye(c),c.trackPosition&&(R+=`
Line: `+c.line+`
Column: `+c.column+`
Char: `+c.c),R=new Error(R),c.error=R,De(c,"onerror",R),c}function ct(c){return c.sawRoot&&!c.closedRoot&&$e(c,"Unclosed root tag"),c.state!==ee.BEGIN&&c.state!==ee.BEGIN_WHITESPACE&&c.state!==ee.TEXT&&Ae(c,"Unexpected end"),Ye(c),c.c="",c.closed=!0,De(c,"onend"),Q.call(c,c.strict,c.opt),c}function $e(c,R){if((typeof c=="undefined"?"undefined":(0,g.default)(c))!=="object"||!(c instanceof Q))throw new Error("bad call to strictFail");c.strict&&Ae(c,R)}function Fe(c){c.strict||(c.tagName=c.tagName[c.looseCase]());var R=c.tags[c.tags.length-1]||c,fe=c.tag={name:c.tagName,attributes:{}};c.opt.xmlns&&(fe.ns=R.ns),c.attribList.length=0,Le(c,"onopentagstart",fe)}function Pe(c,R){var fe=c.indexOf(":"),ve=fe<0?["",c]:c.split(":"),Re=ve[0],qe=ve[1];return R&&c==="xmlns"&&(Re="xmlns",qe=""),{prefix:Re,local:qe}}function He(c){if(c.strict||(c.attribName=c.attribName[c.looseCase]()),c.attribList.indexOf(c.attribName)!==-1||c.tag.attributes.hasOwnProperty(c.attribName)){c.attribName=c.attribValue="";return}if(c.opt.xmlns){var R=Pe(c.attribName,!0),fe=R.prefix,ve=R.local;if(fe==="xmlns")if(ve==="xml"&&c.attribValue!==Y)$e(c,"xml: prefix must be bound to "+Y+`
Actual: `+c.attribValue);else if(ve==="xmlns"&&c.attribValue!==re)$e(c,"xmlns: prefix must be bound to "+re+`
Actual: `+c.attribValue);else{var Re=c.tag,qe=c.tags[c.tags.length-1]||c;Re.ns===qe.ns&&(Re.ns=(0,x.default)(qe.ns)),Re.ns[ve]=c.attribValue}c.attribList.push([c.attribName,c.attribValue])}else c.tag.attributes[c.attribName]=c.attribValue,Le(c,"onattribute",{name:c.attribName,value:c.attribValue});c.attribName=c.attribValue=""}function ot(c,R){if(c.opt.xmlns){var fe=c.tag,ve=Pe(c.tagName);fe.prefix=ve.prefix,fe.local=ve.local,fe.uri=fe.ns[ve.prefix]||"",fe.prefix&&!fe.uri&&($e(c,"Unbound namespace prefix: "+(0,D.default)(c.tagName)),fe.uri=ve.prefix);var Re=c.tags[c.tags.length-1]||c;fe.ns&&Re.ns!==fe.ns&&(0,v.default)(fe.ns).forEach(function(rr){Le(c,"onopennamespace",{prefix:rr,uri:fe.ns[rr]})});for(var qe=0,nt=c.attribList.length;qe<nt;qe++){var st=c.attribList[qe],bt=st[0],dt=st[1],Et=Pe(bt,!0),It=Et.prefix,at=Et.local,Bt=It===""?"":fe.ns[It]||"",mr={name:bt,value:dt,prefix:It,local:at,uri:Bt};It&&It!=="xmlns"&&!Bt&&($e(c,"Unbound namespace prefix: "+(0,D.default)(It)),mr.uri=It),c.tag.attributes[bt]=mr,Le(c,"onattribute",mr)}c.attribList.length=0}c.tag.isSelfClosing=!!R,c.sawRoot=!0,c.tags.push(c.tag),Le(c,"onopentag",c.tag),R||(!c.noscript&&c.tagName.toLowerCase()==="script"?c.state=ee.SCRIPT:c.state=ee.TEXT,c.tag=null,c.tagName=""),c.attribName=c.attribValue="",c.attribList.length=0}function ye(c){if(!c.tagName){$e(c,"Weird empty close tag."),c.textNode+="</>",c.state=ee.TEXT;return}if(c.script){if(c.tagName!=="script"){c.script+="</"+c.tagName+">",c.tagName="",c.state=ee.SCRIPT;return}Le(c,"onscript",c.script),c.script=""}var R=c.tags.length,fe=c.tagName;c.strict||(fe=fe[c.looseCase]());for(var ve=fe;R--;){var Re=c.tags[R];if(Re.name!==ve)$e(c,"Unexpected close tag");else break}if(R<0){$e(c,"Unmatched closing tag: "+c.tagName),c.textNode+="</"+c.tagName+">",c.state=ee.TEXT;return}c.tagName=fe;for(var qe=c.tags.length;qe-- >R;){var nt=c.tag=c.tags.pop();c.tagName=c.tag.name,Le(c,"onclosetag",c.tagName);var st={};for(var bt in nt.ns)st[bt]=nt.ns[bt];var dt=c.tags[c.tags.length-1]||c;c.opt.xmlns&&nt.ns!==dt.ns&&(0,v.default)(nt.ns).forEach(function(Et){var It=nt.ns[Et];Le(c,"onclosenamespace",{prefix:Et,uri:It})})}R===0&&(c.closedRoot=!0),c.tagName=c.attribValue=c.attribName="",c.attribList.length=0,c.state=ee.TEXT}function be(c){var R=c.entity,fe=R.toLowerCase(),ve,Re="";return c.ENTITIES[R]?c.ENTITIES[R]:c.ENTITIES[fe]?c.ENTITIES[fe]:(R=fe,R.charAt(0)==="#"&&(R.charAt(1)==="x"?(R=R.slice(2),ve=parseInt(R,16),Re=ve.toString(16)):(R=R.slice(1),ve=parseInt(R,10),Re=ve.toString(10))),R=R.replace(/^0+/,""),isNaN(ve)||Re.toLowerCase()!==R?($e(c,"Invalid character entity"),"&"+c.entity+";"):(0,F.default)(ve))}function Ke(c,R){R==="<"?(c.state=ee.OPEN_WAKA,c.startTagPosition=c.position):$(R)||($e(c,"Non-whitespace before first tag."),c.textNode=R,c.state=ee.TEXT)}function q(c,R){var fe="";return R<c.length&&(fe=c.charAt(R)),fe}function m(c){var R=this;if(this.error)throw this.error;if(R.closed)return Ae(R,"Cannot write after close. Assign an onready handler.");if(c===null)return ct(R);(typeof c=="undefined"?"undefined":(0,g.default)(c))==="object"&&(c=c.toString());for(var fe=0,ve="";!(ve=q(c,fe++),R.c=ve,!ve);){R.trackPosition&&(R.position++,ve===`
`?(R.line++,R.column=0):R.column++);switch(R.state){case ee.BEGIN:if(R.state=ee.BEGIN_WHITESPACE,ve==="\uFEFF")continue;Ke(R,ve);continue;case ee.BEGIN_WHITESPACE:Ke(R,ve);continue;case ee.TEXT:if(R.sawRoot&&!R.closedRoot){for(var Re=fe-1;ve&&ve!=="<"&&ve!=="&";)ve=q(c,fe++),ve&&R.trackPosition&&(R.position++,ve===`
`?(R.line++,R.column=0):R.column++);R.textNode+=c.substring(Re,fe-1)}ve==="<"&&!(R.sawRoot&&R.closedRoot&&!R.strict)?(R.state=ee.OPEN_WAKA,R.startTagPosition=R.position):(!$(ve)&&(!R.sawRoot||R.closedRoot)&&$e(R,"Text data outside of root node."),ve==="&"?R.state=ee.TEXT_ENTITY:R.textNode+=ve);continue;case ee.SCRIPT:ve==="<"?R.state=ee.SCRIPT_ENDING:R.script+=ve;continue;case ee.SCRIPT_ENDING:ve==="/"?R.state=ee.CLOSE_TAG:(R.script+="<"+ve,R.state=ee.SCRIPT);continue;case ee.OPEN_WAKA:if(ve==="!")R.state=ee.SGML_DECL,R.sgmlDecl="";else if(!$(ve))if(ie(le,ve))R.state=ee.OPEN_TAG,R.tagName=ve;else if(ve==="/")R.state=ee.CLOSE_TAG,R.tagName="";else if(ve==="?")R.state=ee.PROC_INST,R.procInstName=R.procInstBody="";else{if($e(R,"Unencoded <"),R.startTagPosition+1<R.position){var qe=R.position-R.startTagPosition;ve=new Array(qe).join(" ")+ve}R.textNode+="<"+ve,R.state=ee.TEXT}continue;case ee.SGML_DECL:(R.sgmlDecl+ve).toUpperCase()===Z?(Le(R,"onopencdata"),R.state=ee.CDATA,R.sgmlDecl="",R.cdata=""):R.sgmlDecl+ve==="--"?(R.state=ee.COMMENT,R.comment="",R.sgmlDecl=""):(R.sgmlDecl+ve).toUpperCase()===_?(R.state=ee.DOCTYPE,(R.doctype||R.sawRoot)&&$e(R,"Inappropriately located doctype declaration"),R.doctype="",R.sgmlDecl=""):ve===">"?(Le(R,"onsgmldeclaration",R.sgmlDecl),R.sgmlDecl="",R.state=ee.TEXT):(ne(ve)&&(R.state=ee.SGML_DECL_QUOTED),R.sgmlDecl+=ve);continue;case ee.SGML_DECL_QUOTED:ve===R.q&&(R.state=ee.SGML_DECL,R.q=""),R.sgmlDecl+=ve;continue;case ee.DOCTYPE:ve===">"?(R.state=ee.TEXT,Le(R,"ondoctype",R.doctype),R.doctype=!0):(R.doctype+=ve,ve==="["?R.state=ee.DOCTYPE_DTD:ne(ve)&&(R.state=ee.DOCTYPE_QUOTED,R.q=ve));continue;case ee.DOCTYPE_QUOTED:R.doctype+=ve,ve===R.q&&(R.q="",R.state=ee.DOCTYPE);continue;case ee.DOCTYPE_DTD:R.doctype+=ve,ve==="]"?R.state=ee.DOCTYPE:ne(ve)&&(R.state=ee.DOCTYPE_DTD_QUOTED,R.q=ve);continue;case ee.DOCTYPE_DTD_QUOTED:R.doctype+=ve,ve===R.q&&(R.state=ee.DOCTYPE_DTD,R.q="");continue;case ee.COMMENT:ve==="-"?R.state=ee.COMMENT_ENDING:R.comment+=ve;continue;case ee.COMMENT_ENDING:ve==="-"?(R.state=ee.COMMENT_ENDED,R.comment=et(R.opt,R.comment),R.comment&&Le(R,"oncomment",R.comment),R.comment=""):(R.comment+="-"+ve,R.state=ee.COMMENT);continue;case ee.COMMENT_ENDED:ve!==">"?($e(R,"Malformed comment"),R.comment+="--"+ve,R.state=ee.COMMENT):R.state=ee.TEXT;continue;case ee.CDATA:ve==="]"?R.state=ee.CDATA_ENDING:R.cdata+=ve;continue;case ee.CDATA_ENDING:ve==="]"?R.state=ee.CDATA_ENDING_2:(R.cdata+="]"+ve,R.state=ee.CDATA);continue;case ee.CDATA_ENDING_2:ve===">"?(R.cdata&&Le(R,"oncdata",R.cdata),Le(R,"onclosecdata"),R.cdata="",R.state=ee.TEXT):ve==="]"?R.cdata+="]":(R.cdata+="]]"+ve,R.state=ee.CDATA);continue;case ee.PROC_INST:ve==="?"?R.state=ee.PROC_INST_ENDING:$(ve)?R.state=ee.PROC_INST_BODY:R.procInstName+=ve;continue;case ee.PROC_INST_BODY:if(!R.procInstBody&&$(ve))continue;ve==="?"?R.state=ee.PROC_INST_ENDING:R.procInstBody+=ve;continue;case ee.PROC_INST_ENDING:ve===">"?(Le(R,"onprocessinginstruction",{name:R.procInstName,body:R.procInstBody}),R.procInstName=R.procInstBody="",R.state=ee.TEXT):(R.procInstBody+="?"+ve,R.state=ee.PROC_INST_BODY);continue;case ee.OPEN_TAG:ie(_e,ve)?R.tagName+=ve:(Fe(R),ve===">"?ot(R):ve==="/"?R.state=ee.OPEN_TAG_SLASH:($(ve)||$e(R,"Invalid character in tag name"),R.state=ee.ATTRIB));continue;case ee.OPEN_TAG_SLASH:ve===">"?(ot(R,!0),ye(R)):($e(R,"Forward-slash in opening tag not followed by >"),R.state=ee.ATTRIB);continue;case ee.ATTRIB:if($(ve))continue;ve===">"?ot(R):ve==="/"?R.state=ee.OPEN_TAG_SLASH:ie(le,ve)?(R.attribName=ve,R.attribValue="",R.state=ee.ATTRIB_NAME):$e(R,"Invalid attribute name");continue;case ee.ATTRIB_NAME:ve==="="?R.state=ee.ATTRIB_VALUE:ve===">"?($e(R,"Attribute without value"),R.attribValue=R.attribName,He(R),ot(R)):$(ve)?R.state=ee.ATTRIB_NAME_SAW_WHITE:ie(_e,ve)?R.attribName+=ve:$e(R,"Invalid attribute name");continue;case ee.ATTRIB_NAME_SAW_WHITE:if(ve==="=")R.state=ee.ATTRIB_VALUE;else{if($(ve))continue;$e(R,"Attribute without value"),R.tag.attributes[R.attribName]="",R.attribValue="",Le(R,"onattribute",{name:R.attribName,value:""}),R.attribName="",ve===">"?ot(R):ie(le,ve)?(R.attribName=ve,R.state=ee.ATTRIB_NAME):($e(R,"Invalid attribute name"),R.state=ee.ATTRIB)}continue;case ee.ATTRIB_VALUE:if($(ve))continue;ne(ve)?(R.q=ve,R.state=ee.ATTRIB_VALUE_QUOTED):($e(R,"Unquoted attribute value"),R.state=ee.ATTRIB_VALUE_UNQUOTED,R.attribValue=ve);continue;case ee.ATTRIB_VALUE_QUOTED:if(ve!==R.q){ve==="&"?R.state=ee.ATTRIB_VALUE_ENTITY_Q:R.attribValue+=ve;continue}He(R),R.q="",R.state=ee.ATTRIB_VALUE_CLOSED;continue;case ee.ATTRIB_VALUE_CLOSED:$(ve)?R.state=ee.ATTRIB:ve===">"?ot(R):ve==="/"?R.state=ee.OPEN_TAG_SLASH:ie(le,ve)?($e(R,"No whitespace between attributes"),R.attribName=ve,R.attribValue="",R.state=ee.ATTRIB_NAME):$e(R,"Invalid attribute name");continue;case ee.ATTRIB_VALUE_UNQUOTED:if(!W(ve)){ve==="&"?R.state=ee.ATTRIB_VALUE_ENTITY_U:R.attribValue+=ve;continue}He(R),ve===">"?ot(R):R.state=ee.ATTRIB;continue;case ee.CLOSE_TAG:if(R.tagName)ve===">"?ye(R):ie(_e,ve)?R.tagName+=ve:R.script?(R.script+="</"+R.tagName,R.tagName="",R.state=ee.SCRIPT):($(ve)||$e(R,"Invalid tagname in closing tag"),R.state=ee.CLOSE_TAG_SAW_WHITE);else{if($(ve))continue;de(le,ve)?R.script?(R.script+="</"+ve,R.state=ee.SCRIPT):$e(R,"Invalid tagname in closing tag."):R.tagName=ve}continue;case ee.CLOSE_TAG_SAW_WHITE:if($(ve))continue;ve===">"?ye(R):$e(R,"Invalid characters in closing tag");continue;case ee.TEXT_ENTITY:case ee.ATTRIB_VALUE_ENTITY_Q:case ee.ATTRIB_VALUE_ENTITY_U:var nt,st;switch(R.state){case ee.TEXT_ENTITY:nt=ee.TEXT,st="textNode";break;case ee.ATTRIB_VALUE_ENTITY_Q:nt=ee.ATTRIB_VALUE_QUOTED,st="attribValue";break;case ee.ATTRIB_VALUE_ENTITY_U:nt=ee.ATTRIB_VALUE_UNQUOTED,st="attribValue";break}ve===";"?(R[st]+=be(R),R.entity="",R.state=nt):ie(R.entity.length?ke:me,ve)?R.entity+=ve:($e(R,"Invalid character in entity name"),R[st]+="&"+R.entity+ve,R.entity="",R.state=nt);continue;default:throw new Error(R,"Unknown state: "+R.state)}}return R.position>=R.bufferCheckPosition&&z(R),R}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */F.default||function(){var c=String.fromCharCode,R=Math.floor,fe=function(){var Re=16384,qe=[],nt,st,bt=-1,dt=arguments.length;if(!dt)return"";for(var Et="";++bt<dt;){var It=Number(arguments[bt]);if(!isFinite(It)||It<0||It>1114111||R(It)!==It)throw RangeError("Invalid code point: "+It);It<=65535?qe.push(It):(It-=65536,nt=(It>>10)+55296,st=It%1024+56320,qe.push(nt,st)),(bt+1===dt||qe.length>Re)&&(Et+=c.apply(null,qe),qe.length=0)}return Et};b.default?Object.defineProperty(String,"fromCodePoint",{value:fe,configurable:!0,writable:!0}):String.fromCodePoint=fe}()})(typeof N=="undefined"?(void 0).sax={}:N)}).call(this,l("buffer").Buffer)},{"babel-runtime/core-js/json/stringify":53,"babel-runtime/core-js/object/create":55,"babel-runtime/core-js/object/define-property":56,"babel-runtime/core-js/object/keys":60,"babel-runtime/core-js/string/from-code-point":63,"babel-runtime/helpers/typeof":67,buffer:73,stream:230,string_decoder:72}],230:[function(l,G,N){G.exports=F;var y=l("events").EventEmitter,d=l("inherits");d(F,y),F.Readable=l("readable-stream/readable.js"),F.Writable=l("readable-stream/writable.js"),F.Duplex=l("readable-stream/duplex.js"),F.Transform=l("readable-stream/transform.js"),F.PassThrough=l("readable-stream/passthrough.js"),F.Stream=F;function F(){y.call(this)}F.prototype.pipe=function(M,D){var E=this;function g(S){M.writable&&(M.write(S)===!1&&E.pause&&E.pause())}E.on("data",g);function h(){E.readable&&E.resume&&E.resume()}M.on("drain",h),!M._isStdio&&(!D||D.end!==!1)&&(E.on("end",p),E.on("close",v));var b=!1;function p(){if(b)return;b=!0,M.end()}function v(){if(b)return;b=!0,typeof M.destroy=="function"&&M.destroy()}function I(S){if(x(),y.listenerCount(this,"error")===0)throw S}E.on("error",I),M.on("error",I);function x(){E.removeListener("data",g),M.removeListener("drain",h),E.removeListener("end",p),E.removeListener("close",v),E.removeListener("error",I),M.removeListener("error",I),E.removeListener("end",x),E.removeListener("close",x),M.removeListener("close",x)}return E.on("end",x),E.on("close",x),M.on("close",x),M.emit("pipe",E),M}},{events:192,inherits:196,"readable-stream/duplex.js":213,"readable-stream/passthrough.js":222,"readable-stream/readable.js":223,"readable-stream/transform.js":224,"readable-stream/writable.js":225}],231:[function(l,G,N){(function(y){var d=l("./lib/request"),F=l("./lib/response"),M=l("xtend"),D=l("builtin-status-codes"),E=l("url"),g=N;g.request=function(h,b){typeof h=="string"?h=E.parse(h):h=M(h);var p=y.location.protocol.search(/^https?:$/)===-1?"http:":"",v=h.protocol||p,I=h.hostname||h.host,x=h.port,S=h.path||"/";I&&I.indexOf(":")!==-1&&(I="["+I+"]"),h.url=(I?v+"//"+I:"")+(x?":"+x:"")+S,h.method=(h.method||"GET").toUpperCase(),h.headers=h.headers||{};var H=new d(h);return b&&H.on("response",b),H},g.get=function(b,p){var v=g.request(b,p);return v.end(),v},g.ClientRequest=d,g.IncomingMessage=F.IncomingMessage,g.Agent=function(){},g.Agent.defaultMaxSockets=4,g.globalAgent=new g.Agent,g.STATUS_CODES=D,g.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./lib/request":233,"./lib/response":234,"builtin-status-codes":74,url:238,xtend:283}],232:[function(l,G,N){(function(y){"use strict";N.fetch=g(y.fetch)&&g(y.ReadableStream),N.writableStream=g(y.WritableStream),N.abortController=g(y.AbortController),N.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),N.blobConstructor=!0}catch(h){}var d;function F(){if(d!==void 0)return d;if(y.XMLHttpRequest){d=new y.XMLHttpRequest;try{d.open("GET",y.XDomainRequest?"/":"https://example.com")}catch(h){d=null}}else d=null;return d}function M(h){var b=F();if(!b)return!1;try{return b.responseType=h,b.responseType===h}catch(p){}return!1}var D=typeof y.ArrayBuffer!="undefined",E=D&&g(y.ArrayBuffer.prototype.slice);N.arraybuffer=N.fetch||D&&M("arraybuffer"),N.msstream=!N.fetch&&E&&M("ms-stream"),N.mozchunkedarraybuffer=!N.fetch&&D&&M("moz-chunked-arraybuffer"),N.overrideMimeType=N.fetch||(F()?g(F().overrideMimeType):!1),N.vbArray=g(y.VBArray);function g(h){return typeof h=="function"}d=null}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],233:[function(l,G,N){(function(y,d,F){"use strict";var M=l("babel-runtime/core-js/object/keys"),D=E(M);function E(z){return z&&z.__esModule?z:{default:z}}var g=l("./capability"),h=l("inherits"),b=l("./response"),p=l("readable-stream"),v=l("to-arraybuffer"),I=b.IncomingMessage,x=b.readyStates;function S(z,K){return g.fetch&&K?"fetch":g.mozchunkedarraybuffer?"moz-chunked-arraybuffer":g.msstream?"ms-stream":g.arraybuffer&&z?"arraybuffer":g.vbArray&&z?"text:vbarray":"text"}var H=G.exports=function(z){var K=this;p.Writable.call(K),K._opts=z,K._body=[],K._headers={},z.auth&&K.setHeader("Authorization","Basic "+new F(z.auth).toString("base64")),(0,D.default)(z.headers).forEach(function(j){K.setHeader(j,z.headers[j])});var J,U=!0;if(z.mode==="disable-fetch"||"requestTimeout"in z&&!g.abortController)U=!1,J=!0;else if(z.mode==="prefer-streaming")J=!1;else if(z.mode==="allow-wrong-content-type")J=!g.overrideMimeType;else if(!z.mode||z.mode==="default"||z.mode==="prefer-fast")J=!0;else throw new Error("Invalid value for opts.mode");K._mode=S(J,U),K._fetchTimer=null,K.on("finish",function(){K._onFinish()})};h(H,p.Writable),H.prototype.setHeader=function(z,K){var J=this,U=z.toLowerCase();if(Q.indexOf(U)!==-1)return;J._headers[U]={name:z,value:K}},H.prototype.getHeader=function(z){var K=this._headers[z.toLowerCase()];return K?K.value:null},H.prototype.removeHeader=function(z){var K=this;delete K._headers[z.toLowerCase()]},H.prototype._onFinish=function(){var z=this;if(z._destroyed)return;var K=z._opts,J=z._headers,U=null;K.method!=="GET"&&K.method!=="HEAD"&&(g.arraybuffer?U=v(F.concat(z._body)):g.blobConstructor?U=new d.Blob(z._body.map(function(Y){return v(Y)}),{type:(J["content-type"]||{}).value||""}):U=F.concat(z._body).toString());var j=[];if((0,D.default)(J).forEach(function(Y){var re=J[Y].name,pe=J[Y].value;Array.isArray(pe)?pe.forEach(function(le){j.push([re,le])}):j.push([re,pe])}),z._mode==="fetch"){var T=null,te=null;if(g.abortController){var Z=new AbortController;T=Z.signal,z._fetchAbortController=Z,"requestTimeout"in K&&K.requestTimeout!==0&&(z._fetchTimer=d.setTimeout(function(){z.emit("requestTimeout"),z._fetchAbortController&&z._fetchAbortController.abort()},K.requestTimeout))}d.fetch(z._opts.url,{method:z._opts.method,headers:j,body:U||void 0,mode:"cors",credentials:K.withCredentials?"include":"same-origin",signal:T}).then(function(Y){z._fetchResponse=Y,z._connect()},function(Y){d.clearTimeout(z._fetchTimer),z._destroyed||z.emit("error",Y)})}else{var _=z._xhr=new d.XMLHttpRequest;try{_.open(z._opts.method,z._opts.url,!0)}catch(Y){y.nextTick(function(){z.emit("error",Y)});return}"responseType"in _&&(_.responseType=z._mode.split(":")[0]),"withCredentials"in _&&(_.withCredentials=!!K.withCredentials),z._mode==="text"&&"overrideMimeType"in _&&_.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in K&&(_.timeout=K.requestTimeout,_.ontimeout=function(){z.emit("requestTimeout")}),j.forEach(function(Y){_.setRequestHeader(Y[0],Y[1])}),z._response=null,_.onreadystatechange=function(){switch(_.readyState){case x.LOADING:case x.DONE:z._onXHRProgress();break}},z._mode==="moz-chunked-arraybuffer"&&(_.onprogress=function(){z._onXHRProgress()}),_.onerror=function(){if(z._destroyed)return;z.emit("error",new Error("XHR error"))};try{_.send(U)}catch(Y){y.nextTick(function(){z.emit("error",Y)});return}}};function B(z){try{var K=z.status;return K!==null&&K!==0}catch(J){return!1}}H.prototype._onXHRProgress=function(){var z=this;if(!B(z._xhr)||z._destroyed)return;z._response||z._connect(),z._response._onXHRProgress()},H.prototype._connect=function(){var z=this;if(z._destroyed)return;z._response=new I(z._xhr,z._fetchResponse,z._mode,z._fetchTimer),z._response.on("error",function(K){z.emit("error",K)}),z.emit("response",z._response)},H.prototype._write=function(z,K,J){var U=this;U._body.push(z),J()},H.prototype.abort=H.prototype.destroy=function(){var z=this;z._destroyed=!0,d.clearTimeout(z._fetchTimer),z._response&&(z._response._destroyed=!0),z._xhr?z._xhr.abort():z._fetchAbortController&&z._fetchAbortController.abort()},H.prototype.end=function(z,K,J){var U=this;typeof z=="function"&&(J=z,z=void 0),p.Writable.prototype.end.call(U,z,K,J)},H.prototype.flushHeaders=function(){},H.prototype.setTimeout=function(){},H.prototype.setNoDelay=function(){},H.prototype.setSocketKeepAlive=function(){};var Q=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"]}).call(this,l("_process"),typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{},l("buffer").Buffer)},{"./capability":232,"./response":234,_process:208,"babel-runtime/core-js/object/keys":60,buffer:73,inherits:196,"readable-stream":223,"to-arraybuffer":237}],234:[function(l,G,N){(function(y,d,F){"use strict";var M=l("babel-runtime/core-js/promise"),D=E(M);function E(I){return I&&I.__esModule?I:{default:I}}var g=l("./capability"),h=l("inherits"),b=l("readable-stream"),p=N.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},v=N.IncomingMessage=function(I,x,S,H){var B=this;if(b.Readable.call(B),B._mode=S,B.headers={},B.rawHeaders=[],B.trailers={},B.rawTrailers=[],B.on("end",function(){y.nextTick(function(){B.emit("close")})}),S==="fetch"){var Q=function T(){K.read().then(function(te){if(B._destroyed)return;if(te.done){d.clearTimeout(H),B.push(null);return}B.push(new F(te.value)),T()}).catch(function(te){d.clearTimeout(H),B._destroyed||B.emit("error",te)})};if(B._fetchResponse=x,B.url=x.url,B.statusCode=x.status,B.statusMessage=x.statusText,x.headers.forEach(function(T,te){B.headers[te.toLowerCase()]=T,B.rawHeaders.push(te,T)}),g.writableStream){var z=new WritableStream({write:function(te){return new D.default(function(Z,_){B._destroyed?_():B.push(new F(te))?Z():B._resumeFetch=Z})},close:function(){d.clearTimeout(H),B._destroyed||B.push(null)},abort:function(te){B._destroyed||B.emit("error",te)}});try{x.body.pipeTo(z).catch(function(T){d.clearTimeout(H),B._destroyed||B.emit("error",T)});return}catch(T){}}var K=x.body.getReader();Q()}else{B._xhr=I,B._pos=0,B.url=I.responseURL,B.statusCode=I.status,B.statusMessage=I.statusText;var J=I.getAllResponseHeaders().split(/\r?\n/);if(J.forEach(function(T){var te=T.match(/^([^:]+):\s*(.*)/);if(te){var Z=te[1].toLowerCase();Z==="set-cookie"?(B.headers[Z]===void 0&&(B.headers[Z]=[]),B.headers[Z].push(te[2])):B.headers[Z]!==void 0?B.headers[Z]+=", "+te[2]:B.headers[Z]=te[2],B.rawHeaders.push(te[1],te[2])}}),B._charset="x-user-defined",!g.overrideMimeType){var U=B.rawHeaders["mime-type"];if(U){var j=U.match(/;\s*charset=([^;])(;|$)/);j&&(B._charset=j[1].toLowerCase())}B._charset||(B._charset="utf-8")}}};h(v,b.Readable),v.prototype._read=function(){var I=this,x=I._resumeFetch;x&&(I._resumeFetch=null,x())},v.prototype._onXHRProgress=function(){var I=this,x=I._xhr,S=null;switch(I._mode){case"text:vbarray":if(x.readyState!==p.DONE)break;try{S=new d.VBArray(x.responseBody).toArray()}catch(K){}if(S!==null){I.push(new F(S));break}case"text":try{S=x.responseText}catch(K){I._mode="text:vbarray";break}if(S.length>I._pos){var H=S.substr(I._pos);if(I._charset==="x-user-defined"){for(var B=new F(H.length),Q=0;Q<H.length;Q++)B[Q]=H.charCodeAt(Q)&255;I.push(B)}else I.push(H,I._charset);I._pos=S.length}break;case"arraybuffer":if(x.readyState!==p.DONE||!x.response)break;S=x.response,I.push(new F(new Uint8Array(S)));break;case"moz-chunked-arraybuffer":if(S=x.response,x.readyState!==p.LOADING||!S)break;I.push(new F(new Uint8Array(S)));break;case"ms-stream":if(S=x.response,x.readyState!==p.LOADING)break;var z=new d.MSStreamReader;z.onprogress=function(){z.result.byteLength>I._pos&&(I.push(new F(new Uint8Array(z.result.slice(I._pos)))),I._pos=z.result.byteLength)},z.onload=function(){I.push(null)},z.readAsArrayBuffer(S);break}I._xhr.readyState===p.DONE&&I._mode!=="ms-stream"&&I.push(null)}}).call(this,l("_process"),typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{},l("buffer").Buffer)},{"./capability":232,_process:208,"babel-runtime/core-js/promise":61,buffer:73,inherits:196,"readable-stream":223}],235:[function(l,G,N){"use strict";var y=l("safe-buffer").Buffer,d=y.isEncoding||function(z){z=""+z;switch(z&&z.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function F(z){if(!z)return"utf8";for(var K;;)switch(z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return z;default:if(K)return;z=(""+z).toLowerCase(),K=!0}}function M(z){var K=F(z);if(typeof K!="string"&&(y.isEncoding===d||!d(z)))throw new Error("Unknown encoding: "+z);return K||z}N.StringDecoder=D;function D(z){this.encoding=M(z);var K;switch(this.encoding){case"utf16le":this.text=I,this.end=x,K=4;break;case"utf8":this.fillLast=b,K=4;break;case"base64":this.text=S,this.end=H,K=3;break;default:this.write=B,this.end=Q;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=y.allocUnsafe(K)}D.prototype.write=function(z){if(z.length===0)return"";var K,J;if(this.lastNeed){if(K=this.fillLast(z),K===void 0)return"";J=this.lastNeed,this.lastNeed=0}else J=0;return J<z.length?K?K+this.text(z,J):this.text(z,J):K||""},D.prototype.end=v,D.prototype.text=p,D.prototype.fillLast=function(z){if(this.lastNeed<=z.length)return z.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,this.lastTotal-this.lastNeed,0,z.length),this.lastNeed-=z.length};function E(z){return z<=127?0:z>>5===6?2:z>>4===14?3:z>>3===30?4:z>>6===2?-1:-2}function g(z,K,J){var U=K.length-1;if(U<J)return 0;var j=E(K[U]);return j>=0?(j>0&&(z.lastNeed=j-1),j):--U<J||j===-2?0:(j=E(K[U]),j>=0?(j>0&&(z.lastNeed=j-2),j):--U<J||j===-2?0:(j=E(K[U]),j>=0?(j>0&&(j===2?j=0:z.lastNeed=j-3),j):0))}function h(z,K,J){if((K[0]&192)!==128)return z.lastNeed=0,"\uFFFD";if(z.lastNeed>1&&K.length>1){if((K[1]&192)!==128)return z.lastNeed=1,"\uFFFD";if(z.lastNeed>2&&K.length>2&&(K[2]&192)!==128)return z.lastNeed=2,"\uFFFD"}}function b(z){var K=this.lastTotal-this.lastNeed,J=h(this,z,K);if(J!==void 0)return J;if(this.lastNeed<=z.length)return z.copy(this.lastChar,K,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);z.copy(this.lastChar,K,0,z.length),this.lastNeed-=z.length}function p(z,K){var J=g(this,z,K);if(!this.lastNeed)return z.toString("utf8",K);this.lastTotal=J;var U=z.length-(J-this.lastNeed);return z.copy(this.lastChar,0,U),z.toString("utf8",K,U)}function v(z){var K=z&&z.length?this.write(z):"";return this.lastNeed?K+"\uFFFD":K}function I(z,K){if((z.length-K)%2===0){var J=z.toString("utf16le",K);if(J){var U=J.charCodeAt(J.length-1);if(U>=55296&&U<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1],J.slice(0,-1)}return J}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=z[z.length-1],z.toString("utf16le",K,z.length-1)}function x(z){var K=z&&z.length?this.write(z):"";if(this.lastNeed){var J=this.lastTotal-this.lastNeed;return K+this.lastChar.toString("utf16le",0,J)}return K}function S(z,K){var J=(z.length-K)%3;return J===0?z.toString("base64",K):(this.lastNeed=3-J,this.lastTotal=3,J===1?this.lastChar[0]=z[z.length-1]:(this.lastChar[0]=z[z.length-2],this.lastChar[1]=z[z.length-1]),z.toString("base64",K,z.length-J))}function H(z){var K=z&&z.length?this.write(z):"";return this.lastNeed?K+this.lastChar.toString("base64",0,3-this.lastNeed):K}function B(z){return z.toString(this.encoding)}function Q(z){return z&&z.length?this.write(z):""}},{"safe-buffer":228}],236:[function(l,G,N){(function(y,d){var F=l("process/browser.js").nextTick,M=Function.prototype.apply,D=Array.prototype.slice,E={},g=0;N.setTimeout=function(){return new h(M.call(setTimeout,window,arguments),clearTimeout)},N.setInterval=function(){return new h(M.call(setInterval,window,arguments),clearInterval)},N.clearTimeout=N.clearInterval=function(b){b.close()};function h(b,p){this._id=b,this._clearFn=p}h.prototype.unref=h.prototype.ref=function(){},h.prototype.close=function(){this._clearFn.call(window,this._id)},N.enroll=function(b,p){clearTimeout(b._idleTimeoutId),b._idleTimeout=p},N.unenroll=function(b){clearTimeout(b._idleTimeoutId),b._idleTimeout=-1},N._unrefActive=N.active=function(b){clearTimeout(b._idleTimeoutId);var p=b._idleTimeout;p>=0&&(b._idleTimeoutId=setTimeout(function(){b._onTimeout&&b._onTimeout()},p))},N.setImmediate=typeof y=="function"?y:function(b){var p=g++,v=arguments.length<2?!1:D.call(arguments,1);return E[p]=!0,F(function(){E[p]&&(v?b.apply(null,v):b.call(null),N.clearImmediate(p))}),p},N.clearImmediate=typeof d=="function"?d:function(b){delete E[b]}}).call(this,l("timers").setImmediate,l("timers").clearImmediate)},{"process/browser.js":208,timers:236}],237:[function(l,G,N){var y=l("buffer").Buffer;G.exports=function(d){if(d instanceof Uint8Array){if(d.byteOffset===0&&d.byteLength===d.buffer.byteLength)return d.buffer;if(typeof d.buffer.slice=="function")return d.buffer.slice(d.byteOffset,d.byteOffset+d.byteLength)}if(y.isBuffer(d)){for(var F=new Uint8Array(d.length),M=d.length,D=0;D<M;D++)F[D]=d[D];return F.buffer}else throw new Error("Argument must be a Buffer")}},{buffer:73}],238:[function(l,G,N){"use strict";var y=l("punycode"),d=l("./util");N.parse=K,N.resolve=U,N.resolveObject=j,N.format=J,N.Url=F;function F(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var M=/^([a-z0-9.+-]+:)/i,D=/:[0-9]*$/,E=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,g=["<",">",'"',"`"," ","\r",`
`," "],h=["{","}","|","\\","^","`"].concat(g),b=["'"].concat(h),p=["%","/","?",";","#"].concat(b),v=["/","?","#"],I=255,x=/^[+a-z0-9A-Z_-]{0,63}$/,S=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,H={javascript:!0,"javascript:":!0},B={javascript:!0,"javascript:":!0},Q={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},z=l("querystring");function K(T,te,Z){if(T&&d.isObject(T)&&T instanceof F)return T;var _=new F;return _.parse(T,te,Z),_}F.prototype.parse=function(T,te,Z){if(!d.isString(T))throw new TypeError("Parameter 'url' must be a string, not "+typeof T);var _=T.indexOf("?"),Y=_!==-1&&_<T.indexOf("#")?"?":"#",re=T.split(Y),pe=/\\/g;re[0]=re[0].replace(pe,"/"),T=re.join(Y);var le=T;if(le=le.trim(),!Z&&T.split("#").length===1){var _e=E.exec(le);if(_e)return this.path=le,this.href=le,this.pathname=_e[1],_e[2]?(this.search=_e[2],te?this.query=z.parse(this.search.substr(1)):this.query=this.search.substr(1)):te&&(this.search="",this.query={}),this}var me=M.exec(le);if(me){me=me[0];var ke=me.toLowerCase();this.protocol=ke,le=le.substr(me.length)}if(Z||me||le.match(/^\/\/[^@\/]+@[^@\/]+/)){var $=le.substr(0,2)==="//";$&&!(me&&B[me])&&(le=le.substr(2),this.slashes=!0)}if(!B[me]&&($||me&&!Q[me])){for(var ne=-1,W=0;W<v.length;W++){var ie=le.indexOf(v[W]);ie!==-1&&(ne===-1||ie<ne)&&(ne=ie)}var de,ee;ne===-1?ee=le.lastIndexOf("@"):ee=le.lastIndexOf("@",ne),ee!==-1&&(de=le.slice(0,ee),le=le.slice(ee+1),this.auth=decodeURIComponent(de)),ne=-1;for(var W=0;W<p.length;W++){var ie=le.indexOf(p[W]);ie!==-1&&(ne===-1||ie<ne)&&(ne=ie)}ne===-1&&(ne=le.length),this.host=le.slice(0,ne),le=le.slice(ne),this.parseHost(),this.hostname=this.hostname||"";var Ce=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!Ce)for(var De=this.hostname.split(/\./),W=0,Le=De.length;W<Le;W++){var Ye=De[W];if(!Ye)continue;if(!Ye.match(x)){for(var et="",Ae=0,ct=Ye.length;Ae<ct;Ae++)Ye.charCodeAt(Ae)>127?et+="x":et+=Ye[Ae];if(!et.match(x)){var $e=De.slice(0,W),Fe=De.slice(W+1),Pe=Ye.match(S);Pe&&($e.push(Pe[1]),Fe.unshift(Pe[2])),Fe.length&&(le="/"+Fe.join(".")+le),this.hostname=$e.join(".");break}}}this.hostname.length>I?this.hostname="":this.hostname=this.hostname.toLowerCase(),Ce||(this.hostname=y.toASCII(this.hostname));var He=this.port?":"+this.port:"",ot=this.hostname||"";this.host=ot+He,this.href+=this.host,Ce&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),le[0]!=="/"&&(le="/"+le))}if(!H[ke])for(var W=0,Le=b.length;W<Le;W++){var ye=b[W];if(le.indexOf(ye)===-1)continue;var be=encodeURIComponent(ye);be===ye&&(be=escape(ye)),le=le.split(ye).join(be)}var Ke=le.indexOf("#");Ke!==-1&&(this.hash=le.substr(Ke),le=le.slice(0,Ke));var q=le.indexOf("?");if(q!==-1?(this.search=le.substr(q),this.query=le.substr(q+1),te&&(this.query=z.parse(this.query)),le=le.slice(0,q)):te&&(this.search="",this.query={}),le&&(this.pathname=le),Q[ke]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var He=this.pathname||"",m=this.search||"";this.path=He+m}return this.href=this.format(),this};function J(T){return d.isString(T)&&(T=K(T)),T instanceof F?T.format():F.prototype.format.call(T)}F.prototype.format=function(){var T=this.auth||"";T&&(T=encodeURIComponent(T),T=T.replace(/%3A/i,":"),T+="@");var te=this.protocol||"",Z=this.pathname||"",_=this.hash||"",Y=!1,re="";this.host?Y=T+this.host:this.hostname&&(Y=T+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(Y+=":"+this.port)),this.query&&d.isObject(this.query)&&Object.keys(this.query).length&&(re=z.stringify(this.query));var pe=this.search||re&&"?"+re||"";return te&&te.substr(-1)!==":"&&(te+=":"),this.slashes||(!te||Q[te])&&Y!==!1?(Y="//"+(Y||""),Z&&Z.charAt(0)!=="/"&&(Z="/"+Z)):Y||(Y=""),_&&_.charAt(0)!=="#"&&(_="#"+_),pe&&pe.charAt(0)!=="?"&&(pe="?"+pe),Z=Z.replace(/[?#]/g,function(le){return encodeURIComponent(le)}),pe=pe.replace("#","%23"),te+Y+Z+pe+_};function U(T,te){return K(T,!1,!0).resolve(te)}F.prototype.resolve=function(T){return this.resolveObject(K(T,!1,!0)).format()};function j(T,te){return T?K(T,!1,!0).resolveObject(te):te}F.prototype.resolveObject=function(T){if(d.isString(T)){var te=new F;te.parse(T,!1,!0),T=te}for(var Z=new F,_=Object.keys(this),Y=0;Y<_.length;Y++){var re=_[Y];Z[re]=this[re]}if(Z.hash=T.hash,T.href==="")return Z.href=Z.format(),Z;if(T.slashes&&!T.protocol){for(var pe=Object.keys(T),le=0;le<pe.length;le++){var _e=pe[le];_e!=="protocol"&&(Z[_e]=T[_e])}return Q[Z.protocol]&&Z.hostname&&!Z.pathname&&(Z.path=Z.pathname="/"),Z.href=Z.format(),Z}if(T.protocol&&T.protocol!==Z.protocol){if(!Q[T.protocol]){for(var me=Object.keys(T),ke=0;ke<me.length;ke++){var $=me[ke];Z[$]=T[$]}return Z.href=Z.format(),Z}if(Z.protocol=T.protocol,!T.host&&!B[T.protocol]){for(var Le=(T.pathname||"").split("/");Le.length&&!(T.host=Le.shift()););T.host||(T.host=""),T.hostname||(T.hostname=""),Le[0]!==""&&Le.unshift(""),Le.length<2&&Le.unshift(""),Z.pathname=Le.join("/")}else Z.pathname=T.pathname;if(Z.search=T.search,Z.query=T.query,Z.host=T.host||"",Z.auth=T.auth,Z.hostname=T.hostname||T.host,Z.port=T.port,Z.pathname||Z.search){var ne=Z.pathname||"",W=Z.search||"";Z.path=ne+W}return Z.slashes=Z.slashes||T.slashes,Z.href=Z.format(),Z}var ie=Z.pathname&&Z.pathname.charAt(0)==="/",de=T.host||T.pathname&&T.pathname.charAt(0)==="/",ee=de||ie||Z.host&&T.pathname,Ce=ee,De=Z.pathname&&Z.pathname.split("/")||[],Le=T.pathname&&T.pathname.split("/")||[],Ye=Z.protocol&&!Q[Z.protocol];if(Ye&&(Z.hostname="",Z.port=null,Z.host&&(De[0]===""?De[0]=Z.host:De.unshift(Z.host)),Z.host="",T.protocol&&(T.hostname=null,T.port=null,T.host&&(Le[0]===""?Le[0]=T.host:Le.unshift(T.host)),T.host=null),ee=ee&&(Le[0]===""||De[0]==="")),de)Z.host=T.host||T.host===""?T.host:Z.host,Z.hostname=T.hostname||T.hostname===""?T.hostname:Z.hostname,Z.search=T.search,Z.query=T.query,De=Le;else if(Le.length)De||(De=[]),De.pop(),De=De.concat(Le),Z.search=T.search,Z.query=T.query;else if(!d.isNullOrUndefined(T.search)){if(Ye){Z.hostname=Z.host=De.shift();var et=Z.host&&Z.host.indexOf("@")>0?Z.host.split("@"):!1;et&&(Z.auth=et.shift(),Z.host=Z.hostname=et.shift())}return Z.search=T.search,Z.query=T.query,(!d.isNull(Z.pathname)||!d.isNull(Z.search))&&(Z.path=(Z.pathname?Z.pathname:"")+(Z.search?Z.search:"")),Z.href=Z.format(),Z}if(!De.length)return Z.pathname=null,Z.search?Z.path="/"+Z.search:Z.path=null,Z.href=Z.format(),Z;for(var Ae=De.slice(-1)[0],ct=(Z.host||T.host||De.length>1)&&(Ae==="."||Ae==="..")||Ae==="",$e=0,Fe=De.length;Fe>=0;Fe--)Ae=De[Fe],Ae==="."?De.splice(Fe,1):Ae===".."?(De.splice(Fe,1),$e++):$e&&(De.splice(Fe,1),$e--);if(!ee&&!Ce)for(;$e--;$e)De.unshift("..");ee&&De[0]!==""&&(!De[0]||De[0].charAt(0)!=="/")&&De.unshift(""),ct&&De.join("/").substr(-1)!=="/"&&De.push("");var Pe=De[0]===""||De[0]&&De[0].charAt(0)==="/";if(Ye){Z.hostname=Z.host=Pe?"":De.length?De.shift():"";var et=Z.host&&Z.host.indexOf("@")>0?Z.host.split("@"):!1;et&&(Z.auth=et.shift(),Z.host=Z.hostname=et.shift())}return ee=ee||Z.host&&De.length,ee&&!Pe&&De.unshift(""),De.length?Z.pathname=De.join("/"):(Z.pathname=null,Z.path=null),(!d.isNull(Z.pathname)||!d.isNull(Z.search))&&(Z.path=(Z.pathname?Z.pathname:"")+(Z.search?Z.search:"")),Z.auth=T.auth||Z.auth,Z.slashes=Z.slashes||T.slashes,Z.href=Z.format(),Z},F.prototype.parseHost=function(){var T=this.host,te=D.exec(T);te&&(te=te[0],te!==":"&&(this.port=te.substr(1)),T=T.substr(0,T.length-te.length)),T&&(this.hostname=T)}},{"./util":239,punycode:209,querystring:212}],239:[function(l,G,N){"use strict";G.exports={isString:function(y){return typeof y=="string"},isObject:function(y){return typeof y=="object"&&y!==null},isNull:function(y){return y===null},isNullOrUndefined:function(y){return y==null}}},{}],240:[function(l,G,N){(function(y){G.exports=d;function d(M,D){if(F("noDeprecation"))return M;var E=!1;function g(){if(!E){if(F("throwDeprecation"))throw new Error(D);F("traceDeprecation")?console.trace(D):console.warn(D),E=!0}return M.apply(this,arguments)}return g}function F(M){try{if(!y.localStorage)return!1}catch(E){return!1}var D=y.localStorage[M];return D==null?!1:String(D).toLowerCase()==="true"}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],241:[function(l,G,N){typeof Object.create=="function"?G.exports=function(d,F){d.super_=F,d.prototype=Object.create(F.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}})}:G.exports=function(d,F){d.super_=F;var M=function(){};M.prototype=F.prototype,d.prototype=new M,d.prototype.constructor=d}},{}],242:[function(l,G,N){G.exports=function(d){return d&&typeof d=="object"&&typeof d.copy=="function"&&typeof d.fill=="function"&&typeof d.readUInt8=="function"}},{}],243:[function(l,G,N){(function(y,d){var F=/%[sdj%]/g;N.format=function(ne){if(!U(ne)){for(var W=[],ie=0;ie<arguments.length;ie++)W.push(E(arguments[ie]));return W.join(" ")}for(var ie=1,de=arguments,ee=de.length,Ce=String(ne).replace(F,function(Le){if(Le==="%%")return"%";if(ie>=ee)return Le;switch(Le){case"%s":return String(de[ie++]);case"%d":return Number(de[ie++]);case"%j":try{return JSON.stringify(de[ie++])}catch(Ye){return"[Circular]"}default:return Le}}),De=de[ie];ie<ee;De=de[++ie])z(De)||!Z(De)?Ce+=" "+De:Ce+=" "+E(De);return Ce},N.deprecate=function(ne,W){if(T(d.process))return function(){return N.deprecate(ne,W).apply(this,arguments)};if(y.noDeprecation===!0)return ne;var ie=!1;function de(){if(!ie){if(y.throwDeprecation)throw new Error(W);y.traceDeprecation?console.trace(W):console.error(W),ie=!0}return ne.apply(this,arguments)}return de};var M={},D;N.debuglog=function(ne){if(T(D)&&(D=y.env.NODE_DEBUG||""),ne=ne.toUpperCase(),!M[ne])if(new RegExp("\\b"+ne+"\\b","i").test(D)){var W=y.pid;M[ne]=function(){var ie=N.format.apply(N,arguments);console.error("%s %d: %s",ne,W,ie)}}else M[ne]=function(){};return M[ne]};function E(ne,W){var ie={seen:[],stylize:h};return arguments.length>=3&&(ie.depth=arguments[2]),arguments.length>=4&&(ie.colors=arguments[3]),Q(W)?ie.showHidden=W:W&&N._extend(ie,W),T(ie.showHidden)&&(ie.showHidden=!1),T(ie.depth)&&(ie.depth=2),T(ie.colors)&&(ie.colors=!1),T(ie.customInspect)&&(ie.customInspect=!0),ie.colors&&(ie.stylize=g),p(ie,ne,ie.depth)}N.inspect=E,E.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},E.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function g(ne,W){var ie=E.styles[W];return ie?"["+E.colors[ie][0]+"m"+ne+"["+E.colors[ie][1]+"m":ne}function h(ne,W){return ne}function b(ne){var W={};return ne.forEach(function(ie,de){W[ie]=!0}),W}function p(ne,W,ie){if(ne.customInspect&&W&&re(W.inspect)&&W.inspect!==N.inspect&&!(W.constructor&&W.constructor.prototype===W)){var de=W.inspect(ie,ne);return U(de)||(de=p(ne,de,ie)),de}var ee=v(ne,W);if(ee)return ee;var Ce=Object.keys(W),De=b(Ce);if(ne.showHidden&&(Ce=Object.getOwnPropertyNames(W)),Y(W)&&(Ce.indexOf("message")>=0||Ce.indexOf("description")>=0))return I(W);if(Ce.length===0){if(re(W)){var Le=W.name?": "+W.name:"";return ne.stylize("[Function"+Le+"]","special")}if(te(W))return ne.stylize(RegExp.prototype.toString.call(W),"regexp");if(_(W))return ne.stylize(Date.prototype.toString.call(W),"date");if(Y(W))return I(W)}var Ye="",et=!1,Ae=["{","}"];if(B(W)&&(et=!0,Ae=["[","]"]),re(W)){var ct=W.name?": "+W.name:"";Ye=" [Function"+ct+"]"}if(te(W)&&(Ye=" "+RegExp.prototype.toString.call(W)),_(W)&&(Ye=" "+Date.prototype.toUTCString.call(W)),Y(W)&&(Ye=" "+I(W)),Ce.length===0&&(!et||W.length==0))return Ae[0]+Ye+Ae[1];if(ie<0)return te(W)?ne.stylize(RegExp.prototype.toString.call(W),"regexp"):ne.stylize("[Object]","special");ne.seen.push(W);var $e;return et?$e=x(ne,W,ie,De,Ce):$e=Ce.map(function(Fe){return S(ne,W,ie,De,Fe,et)}),ne.seen.pop(),H($e,Ye,Ae)}function v(ne,W){if(T(W))return ne.stylize("undefined","undefined");if(U(W)){var ie="'"+JSON.stringify(W).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ne.stylize(ie,"string")}if(J(W))return ne.stylize(""+W,"number");if(Q(W))return ne.stylize(""+W,"boolean");if(z(W))return ne.stylize("null","null")}function I(ne){return"["+Error.prototype.toString.call(ne)+"]"}function x(ne,W,ie,de,ee){for(var Ce=[],De=0,Le=W.length;De<Le;++De)$(W,String(De))?Ce.push(S(ne,W,ie,de,String(De),!0)):Ce.push("");return ee.forEach(function(Ye){Ye.match(/^\d+$/)||Ce.push(S(ne,W,ie,de,Ye,!0))}),Ce}function S(ne,W,ie,de,ee,Ce){var De,Le,Ye;if(Ye=Object.getOwnPropertyDescriptor(W,ee)||{value:W[ee]},Ye.get?Ye.set?Le=ne.stylize("[Getter/Setter]","special"):Le=ne.stylize("[Getter]","special"):Ye.set&&(Le=ne.stylize("[Setter]","special")),$(de,ee)||(De="["+ee+"]"),Le||(ne.seen.indexOf(Ye.value)<0?(z(ie)?Le=p(ne,Ye.value,null):Le=p(ne,Ye.value,ie-1),Le.indexOf(`
`)>-1&&(Ce?Le=Le.split(`
`).map(function(et){return" "+et}).join(`
`).substr(2):Le=`
`+Le.split(`
`).map(function(et){return" "+et}).join(`
`))):Le=ne.stylize("[Circular]","special")),T(De)){if(Ce&&ee.match(/^\d+$/))return Le;De=JSON.stringify(""+ee),De.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(De=De.substr(1,De.length-2),De=ne.stylize(De,"name")):(De=De.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),De=ne.stylize(De,"string"))}return De+": "+Le}function H(ne,W,ie){var de=0,ee=ne.reduce(function(Ce,De){return de++,De.indexOf(`
`)>=0&&de++,Ce+De.replace(/\u001b\[\d\d?m/g,"").length+1},0);return ee>60?ie[0]+(W===""?"":W+`
`)+" "+ne.join(`,
`)+" "+ie[1]:ie[0]+W+" "+ne.join(", ")+" "+ie[1]}function B(ne){return Array.isArray(ne)}N.isArray=B;function Q(ne){return typeof ne=="boolean"}N.isBoolean=Q;function z(ne){return ne===null}N.isNull=z;function K(ne){return ne==null}N.isNullOrUndefined=K;function J(ne){return typeof ne=="number"}N.isNumber=J;function U(ne){return typeof ne=="string"}N.isString=U;function j(ne){return typeof ne=="symbol"}N.isSymbol=j;function T(ne){return ne===void 0}N.isUndefined=T;function te(ne){return Z(ne)&&le(ne)==="[object RegExp]"}N.isRegExp=te;function Z(ne){return typeof ne=="object"&&ne!==null}N.isObject=Z;function _(ne){return Z(ne)&&le(ne)==="[object Date]"}N.isDate=_;function Y(ne){return Z(ne)&&(le(ne)==="[object Error]"||ne instanceof Error)}N.isError=Y;function re(ne){return typeof ne=="function"}N.isFunction=re;function pe(ne){return ne===null||typeof ne=="boolean"||typeof ne=="number"||typeof ne=="string"||typeof ne=="symbol"||typeof ne=="undefined"}N.isPrimitive=pe,N.isBuffer=l("./support/isBuffer");function le(ne){return Object.prototype.toString.call(ne)}function _e(ne){return ne<10?"0"+ne.toString(10):ne.toString(10)}var me=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ke(){var ne=new Date,W=[_e(ne.getHours()),_e(ne.getMinutes()),_e(ne.getSeconds())].join(":");return[ne.getDate(),me[ne.getMonth()],W].join(" ")}N.log=function(){console.log("%s - %s",ke(),N.format.apply(N,arguments))},N.inherits=l("inherits"),N._extend=function(ne,W){if(!W||!Z(W))return ne;for(var ie=Object.keys(W),de=ie.length;de--;)ne[ie[de]]=W[ie[de]];return ne};function $(ne,W){return Object.prototype.hasOwnProperty.call(ne,W)}}).call(this,l("_process"),typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./support/isBuffer":242,_process:208,inherits:241}],244:[function(l,G,N){"use strict";(function(){"use strict";N.stripBOM=function(y){return y[0]==="\uFEFF"?y.substring(1):y}}).call(void 0)},{}],245:[function(l,G,N){"use strict";var y=l("babel-runtime/helpers/typeof"),d=D(y),F=l("babel-runtime/core-js/object/keys"),M=D(F);function D(E){return E&&E.__esModule?E:{default:E}}(function(){"use strict";var E,g,h,b,p,v={}.hasOwnProperty;E=l("xmlbuilder"),g=l("./defaults").defaults,b=function(x){return typeof x=="string"&&(x.indexOf("&")>=0||x.indexOf(">")>=0||x.indexOf("<")>=0)},p=function(x){return"<![CDATA["+h(x)+"]]>"},h=function(x){return x.replace("]]>","]]]]><![CDATA[>")},N.Builder=function(){function I(x){var S,H,B;this.options={},H=g["0.2"];for(S in H){if(!v.call(H,S))continue;B=H[S],this.options[S]=B}for(S in x){if(!v.call(x,S))continue;B=x[S],this.options[S]=B}}return I.prototype.buildObject=function(x){var S,H,B,Q,z;return S=this.options.attrkey,H=this.options.charkey,(0,M.default)(x).length===1&&this.options.rootName===g["0.2"].rootName?(z=(0,M.default)(x)[0],x=x[z]):z=this.options.rootName,B=function(K){return function(J,U){var j,T,te,Z,_,Y;if((typeof U=="undefined"?"undefined":(0,d.default)(U))!=="object")K.options.cdata&&b(U)?J.raw(p(U)):J.txt(U);else if(Array.isArray(U))for(Z in U){if(!v.call(U,Z))continue;T=U[Z];for(_ in T)te=T[_],J=B(J.ele(_),te).up()}else for(_ in U){if(!v.call(U,_))continue;if(T=U[_],_===S){if((typeof T=="undefined"?"undefined":(0,d.default)(T))==="object")for(j in T)Y=T[j],J=J.att(j,Y)}else if(_===H)K.options.cdata&&b(T)?J=J.raw(p(T)):J=J.txt(T);else if(Array.isArray(T))for(Z in T){if(!v.call(T,Z))continue;te=T[Z],typeof te=="string"?K.options.cdata&&b(te)?J=J.ele(_).raw(p(te)).up():J=J.ele(_,te).up():J=B(J.ele(_),te).up()}else(typeof T=="undefined"?"undefined":(0,d.default)(T))==="object"?J=B(J.ele(_),T).up():typeof T=="string"&&K.options.cdata&&b(T)?J=J.ele(_).raw(p(T)).up():(T==null&&(T=""),J=J.ele(_,T.toString()).up())}return J}}(this),Q=E.create(z,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),B(Q,x).end(this.options.renderOpts)},I}()}).call(void 0)},{"./defaults":246,"babel-runtime/core-js/object/keys":60,"babel-runtime/helpers/typeof":67,xmlbuilder:282}],246:[function(l,G,N){"use strict";(function(){N.defaults={"0.1":{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},"0.2":{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:`
`},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(void 0)},{}],247:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/promise"),d=b(y),F=l("babel-runtime/core-js/object/get-own-property-names"),M=b(F),D=l("babel-runtime/core-js/object/keys"),E=b(D),g=l("babel-runtime/helpers/typeof"),h=b(g);function b(p){return p&&p.__esModule?p:{default:p}}(function(){"use strict";var p,v,I,x,S,H,B,Q,z=function(j,T){return function(){return j.apply(T,arguments)}},K=function(j,T){for(var te in T)J.call(T,te)&&(j[te]=T[te]);function Z(){this.constructor=j}return Z.prototype=T.prototype,j.prototype=new Z,j.__super__=T.prototype,j},J={}.hasOwnProperty;B=l("sax"),I=l("events"),p=l("./bom"),H=l("./processors"),Q=l("timers").setImmediate,v=l("./defaults").defaults,x=function(j){return(typeof j=="undefined"?"undefined":(0,h.default)(j))==="object"&&j!=null&&(0,E.default)(j).length===0},S=function(j,T,te){var Z,_,Y;for(Z=0,_=j.length;Z<_;Z++)Y=j[Z],T=Y(T,te);return T},N.Parser=function(U){K(j,U);function j(T){this.parseStringPromise=z(this.parseStringPromise,this),this.parseString=z(this.parseString,this),this.reset=z(this.reset,this),this.assignOrPush=z(this.assignOrPush,this),this.processAsync=z(this.processAsync,this);var te,Z,_;if(!(this instanceof N.Parser))return new N.Parser(T);this.options={},Z=v["0.2"];for(te in Z){if(!J.call(Z,te))continue;_=Z[te],this.options[te]=_}for(te in T){if(!J.call(T,te))continue;_=T[te],this.options[te]=_}this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(H.normalize)),this.reset()}return j.prototype.processAsync=function(){var T,te;try{return this.remaining.length<=this.options.chunkSize?(T=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(T),this.saxParser.close()):(T=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(T),Q(this.processAsync))}catch(Z){if(te=Z,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(te)}},j.prototype.assignOrPush=function(T,te,Z){return te in T?(T[te]instanceof Array||(T[te]=[T[te]]),T[te].push(Z)):this.options.explicitArray?T[te]=[Z]:T[te]=Z},j.prototype.reset=function(){var T,te,Z,_;return this.removeAllListeners(),this.saxParser=B.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(Y){return function(re){if(Y.saxParser.resume(),!Y.saxParser.errThrown)return Y.saxParser.errThrown=!0,Y.emit("error",re)}}(this),this.saxParser.onend=function(Y){return function(){if(!Y.saxParser.ended)return Y.saxParser.ended=!0,Y.emit("end",Y.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,_=[],T=this.options.attrkey,te=this.options.charkey,this.saxParser.onopentag=function(Y){return function(re){var pe,le,_e,me,ke;if(_e={},_e[te]="",!Y.options.ignoreAttrs){ke=re.attributes;for(pe in ke){if(!J.call(ke,pe))continue;!(T in _e)&&!Y.options.mergeAttrs&&(_e[T]={}),le=Y.options.attrValueProcessors?S(Y.options.attrValueProcessors,re.attributes[pe],pe):re.attributes[pe],me=Y.options.attrNameProcessors?S(Y.options.attrNameProcessors,pe):pe,Y.options.mergeAttrs?Y.assignOrPush(_e,me,le):_e[T][me]=le}}return _e["#name"]=Y.options.tagNameProcessors?S(Y.options.tagNameProcessors,re.name):re.name,Y.options.xmlns&&(_e[Y.options.xmlnskey]={uri:re.uri,local:re.local}),_.push(_e)}}(this),this.saxParser.onclosetag=function(Y){return function(){var re,pe,le,_e,me,ke,$,ne,W,ie;if(ke=_.pop(),me=ke["#name"],(!Y.options.explicitChildren||!Y.options.preserveChildrenOrder)&&delete ke["#name"],ke.cdata===!0&&(re=ke.cdata,delete ke.cdata),W=_[_.length-1],ke[te].match(/^\s*$/)&&!re?(pe=ke[te],delete ke[te]):(Y.options.trim&&(ke[te]=ke[te].trim()),Y.options.normalize&&(ke[te]=ke[te].replace(/\s{2,}/g," ").trim()),ke[te]=Y.options.valueProcessors?S(Y.options.valueProcessors,ke[te],me):ke[te],(0,E.default)(ke).length===1&&te in ke&&!Y.EXPLICIT_CHARKEY&&(ke=ke[te])),x(ke)&&(ke=Y.options.emptyTag!==""?Y.options.emptyTag:pe),Y.options.validator!=null&&(ie="/"+function(){var de,ee,Ce;for(Ce=[],de=0,ee=_.length;de<ee;de++)_e=_[de],Ce.push(_e["#name"]);return Ce}().concat(me).join("/"),function(){var de;try{return ke=Y.options.validator(ie,W&&W[me],ke)}catch(ee){return de=ee,Y.emit("error",de)}}()),Y.options.explicitChildren&&!Y.options.mergeAttrs&&(typeof ke=="undefined"?"undefined":(0,h.default)(ke))==="object"){if(!Y.options.preserveChildrenOrder)_e={},Y.options.attrkey in ke&&(_e[Y.options.attrkey]=ke[Y.options.attrkey],delete ke[Y.options.attrkey]),!Y.options.charsAsChildren&&Y.options.charkey in ke&&(_e[Y.options.charkey]=ke[Y.options.charkey],delete ke[Y.options.charkey]),(0,M.default)(ke).length>0&&(_e[Y.options.childkey]=ke),ke=_e;else if(W){W[Y.options.childkey]=W[Y.options.childkey]||[],$={};for(le in ke){if(!J.call(ke,le))continue;$[le]=ke[le]}W[Y.options.childkey].push($),delete ke["#name"],(0,E.default)(ke).length===1&&te in ke&&!Y.EXPLICIT_CHARKEY&&(ke=ke[te])}}return _.length>0?Y.assignOrPush(W,me,ke):(Y.options.explicitRoot&&(ne=ke,ke={},ke[me]=ne),Y.resultObject=ke,Y.saxParser.ended=!0,Y.emit("end",Y.resultObject))}}(this),Z=function(Y){return function(re){var pe,le;if(le=_[_.length-1],le)return le[te]+=re,Y.options.explicitChildren&&Y.options.preserveChildrenOrder&&Y.options.charsAsChildren&&(Y.options.includeWhiteChars||re.replace(/\\n/g,"").trim()!=="")&&(le[Y.options.childkey]=le[Y.options.childkey]||[],pe={"#name":"__text__"},pe[te]=re,Y.options.normalize&&(pe[te]=pe[te].replace(/\s{2,}/g," ").trim()),le[Y.options.childkey].push(pe)),le}}(this),this.saxParser.ontext=Z,this.saxParser.oncdata=function(Y){return function(re){var pe;if(pe=Z(re),pe)return pe.cdata=!0}}(this)},j.prototype.parseString=function(T,te){var Z;te!=null&&typeof te=="function"&&(this.on("end",function(_){return this.reset(),te(null,_)}),this.on("error",function(_){return this.reset(),te(_)}));try{return T=T.toString(),T.trim()===""?(this.emit("end",null),!0):(T=p.stripBOM(T),this.options.async?(this.remaining=T,Q(this.processAsync),this.saxParser):this.saxParser.write(T).close())}catch(_){if(Z=_,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw Z}else return this.emit("error",Z),this.saxParser.errThrown=!0}},j.prototype.parseStringPromise=function(T){return new d.default(function(te){return function(Z,_){return te.parseString(T,function(Y,re){return Y?_(Y):Z(re)})}}(this))},j}(I),N.parseString=function(U,j,T){var te,Z,_;return T!=null?(typeof T=="function"&&(te=T),(typeof j=="undefined"?"undefined":(0,h.default)(j))==="object"&&(Z=j)):(typeof j=="function"&&(te=j),Z={}),_=new N.Parser(Z),_.parseString(U,te)},N.parseStringPromise=function(U,j){var T,te;return(typeof j=="undefined"?"undefined":(0,h.default)(j))==="object"&&(T=j),te=new N.Parser(T),te.parseStringPromise(U)}}).call(void 0)},{"./bom":244,"./defaults":246,"./processors":248,"babel-runtime/core-js/object/get-own-property-names":58,"babel-runtime/core-js/object/keys":60,"babel-runtime/core-js/promise":61,"babel-runtime/helpers/typeof":67,events:192,sax:229,timers:236}],248:[function(l,G,N){"use strict";(function(){"use strict";var y;y=new RegExp(/(?!xmlns)^.*:/),N.normalize=function(d){return d.toLowerCase()},N.firstCharLowerCase=function(d){return d.charAt(0).toLowerCase()+d.slice(1)},N.stripPrefix=function(d){return d.replace(y,"")},N.parseNumbers=function(d){return isNaN(d)||(d=d%1===0?parseInt(d,10):parseFloat(d)),d},N.parseBooleans=function(d){return/^(?:true|false)$/i.test(d)&&(d=d.toLowerCase()==="true"),d}}).call(void 0)},{}],249:[function(l,G,N){"use strict";(function(){"use strict";var y,d,F,M,D=function(h,b){for(var p in b)E.call(b,p)&&(h[p]=b[p]);function v(){this.constructor=h}return v.prototype=b.prototype,h.prototype=new v,h.__super__=b.prototype,h},E={}.hasOwnProperty;d=l("./defaults"),y=l("./builder"),F=l("./parser"),M=l("./processors"),N.defaults=d.defaults,N.processors=M,N.ValidationError=function(g){D(h,g);function h(b){this.message=b}return h}(Error),N.Builder=y.Builder,N.Parser=F.Parser,N.parseString=F.parseString,N.parseStringPromise=F.parseStringPromise}).call(void 0)},{"./builder":245,"./defaults":246,"./parser":247,"./processors":248}],250:[function(l,G,N){"use strict";(function(){G.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(void 0)},{}],251:[function(l,G,N){"use strict";(function(){G.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}).call(void 0)},{}],252:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/get-prototype-of"),d=g(y),F=l("babel-runtime/helpers/typeof"),M=g(F),D=l("babel-runtime/core-js/object/assign"),E=g(D);function g(h){return h&&h.__esModule?h:{default:h}}(function(){var h,b,p,v,I,x,S,H=[].slice,B={}.hasOwnProperty;h=function(){var z,K,J,U,j,T;if(T=arguments[0],j=2<=arguments.length?H.call(arguments,1):[],I(E.default))E.default.apply(null,arguments);else for(z=0,J=j.length;z<J;z++)if(U=j[z],U!=null)for(K in U){if(!B.call(U,K))continue;T[K]=U[K]}return T},I=function(z){return!!z&&Object.prototype.toString.call(z)==="[object Function]"},x=function(z){var K;return!!z&&((K=typeof z=="undefined"?"undefined":(0,M.default)(z))==="function"||K==="object")},p=function(z){return I(Array.isArray)?Array.isArray(z):Object.prototype.toString.call(z)==="[object Array]"},v=function(z){var K;if(p(z))return!z.length;for(K in z){if(!B.call(z,K))continue;return!1}return!0},S=function(z){var K,J;return x(z)&&(J=(0,d.default)(z))&&(K=J.constructor)&&typeof K=="function"&&K instanceof K&&Function.prototype.toString.call(K)===Function.prototype.toString.call(Object)},b=function(z){return I(z.valueOf)?z.valueOf():z},G.exports.assign=h,G.exports.isFunction=I,G.exports.isObject=x,G.exports.isArray=p,G.exports.isEmpty=v,G.exports.isPlainObject=S,G.exports.getValue=b}).call(void 0)},{"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/object/get-prototype-of":59,"babel-runtime/helpers/typeof":67}],253:[function(l,G,N){"use strict";(function(){G.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(void 0)},{}],254:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E;M=l("./NodeType"),E=l("./XMLNode"),G.exports=D=function(){function g(h,b,p){if(this.parent=h,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),b==null)throw new Error("Missing attribute name. "+this.debugInfo(b));this.name=this.stringify.name(b),this.value=this.stringify.attValue(p),this.type=M.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(g.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(g.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(g.prototype,"textContent",{get:function(){return this.value},set:function(b){return this.value=b||""}}),Object.defineProperty(g.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(g.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(g.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(g.prototype,"specified",{get:function(){return!0}}),g.prototype.clone=function(){return(0,d.default)(this)},g.prototype.toString=function(h){return this.options.writer.attribute(this,this.options.writer.filterOptions(h))},g.prototype.debugInfo=function(h){return h=h||this.name,h==null?"parent: <"+this.parent.name+">":"attribute: {"+h+"}, parent: <"+this.parent.name+">"},g.prototype.isEqualNode=function(h){return h.namespaceURI!==this.namespaceURI||(h.prefix!==this.prefix||h.localName!==this.localName)?!1:!(h.value!==this.value)},g}()}).call(void 0)},{"./NodeType":251,"./XMLNode":273,"babel-runtime/core-js/object/create":55}],255:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E,g=function(p,v){for(var I in v)h.call(v,I)&&(p[I]=v[I]);function x(){this.constructor=p}return x.prototype=v.prototype,p.prototype=new x,p.__super__=v.prototype,p},h={}.hasOwnProperty;M=l("./NodeType"),E=l("./XMLCharacterData"),G.exports=D=function(b){g(p,b);function p(v,I){if(p.__super__.constructor.call(this,v),I==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=M.CData,this.value=this.stringify.cdata(I)}return p.prototype.clone=function(){return(0,d.default)(this)},p.prototype.toString=function(v){return this.options.writer.cdata(this,this.options.writer.filterOptions(v))},p}(E)}).call(void 0)},{"./NodeType":251,"./XMLCharacterData":256,"babel-runtime/core-js/object/create":55}],256:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E=function(b,p){for(var v in p)g.call(p,v)&&(b[v]=p[v]);function I(){this.constructor=b}return I.prototype=p.prototype,b.prototype=new I,b.__super__=p.prototype,b},g={}.hasOwnProperty;D=l("./XMLNode"),G.exports=M=function(h){E(b,h);function b(p){b.__super__.constructor.call(this,p),this.value=""}return Object.defineProperty(b.prototype,"data",{get:function(){return this.value},set:function(v){return this.value=v||""}}),Object.defineProperty(b.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(b.prototype,"textContent",{get:function(){return this.value},set:function(v){return this.value=v||""}}),b.prototype.clone=function(){return(0,d.default)(this)},b.prototype.substringData=function(p,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.appendData=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.insertData=function(p,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.deleteData=function(p,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.replaceData=function(p,v,I){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.isEqualNode=function(p){return b.__super__.isEqualNode.apply(this,arguments).isEqualNode(p)?!(p.data!==this.data):!1},b}(D)}).call(void 0)},{"./XMLNode":273,"babel-runtime/core-js/object/create":55}],257:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E,g=function(p,v){for(var I in v)h.call(v,I)&&(p[I]=v[I]);function x(){this.constructor=p}return x.prototype=v.prototype,p.prototype=new x,p.__super__=v.prototype,p},h={}.hasOwnProperty;M=l("./NodeType"),D=l("./XMLCharacterData"),G.exports=E=function(b){g(p,b);function p(v,I){if(p.__super__.constructor.call(this,v),I==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=M.Comment,this.value=this.stringify.comment(I)}return p.prototype.clone=function(){return(0,d.default)(this)},p.prototype.toString=function(v){return this.options.writer.comment(this,this.options.writer.filterOptions(v))},p}(D)}).call(void 0)},{"./NodeType":251,"./XMLCharacterData":256,"babel-runtime/core-js/object/create":55}],258:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/keys"),d=D(y),F=l("babel-runtime/core-js/object/create"),M=D(F);function D(E){return E&&E.__esModule?E:{default:E}}(function(){var E,g,h;g=l("./XMLDOMErrorHandler"),h=l("./XMLDOMStringList"),G.exports=E=function(){function b(){var p;this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new g,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=p=(0,M.default)(this.defaultParams)}return Object.defineProperty(b.prototype,"parameterNames",{get:function(){return new h((0,d.default)(this.defaultParams))}}),b.prototype.getParameter=function(p){return this.params.hasOwnProperty(p)?this.params[p]:null},b.prototype.canSetParameter=function(p,v){return!0},b.prototype.setParameter=function(p,v){return v!=null?this.params[p]=v:delete this.params[p]},b}()}).call(void 0)},{"./XMLDOMErrorHandler":259,"./XMLDOMStringList":261,"babel-runtime/core-js/object/create":55,"babel-runtime/core-js/object/keys":60}],259:[function(l,G,N){"use strict";(function(){var y;G.exports=y=function(){function d(){}return d.prototype.handleError=function(F){throw new Error(F)},d}()}).call(void 0)},{}],260:[function(l,G,N){"use strict";(function(){var y;G.exports=y=function(){function d(){}return d.prototype.hasFeature=function(F,M){return!0},d.prototype.createDocumentType=function(F,M,D){throw new Error("This DOM method is not implemented.")},d.prototype.createDocument=function(F,M,D){throw new Error("This DOM method is not implemented.")},d.prototype.createHTMLDocument=function(F){throw new Error("This DOM method is not implemented.")},d.prototype.getFeature=function(F,M){throw new Error("This DOM method is not implemented.")},d}()}).call(void 0)},{}],261:[function(l,G,N){"use strict";(function(){var y;G.exports=y=function(){function d(F){this.arr=F||[]}return Object.defineProperty(d.prototype,"length",{get:function(){return this.arr.length}}),d.prototype.item=function(F){return this.arr[F]||null},d.prototype.contains=function(F){return this.arr.indexOf(F)!==-1},d}()}).call(void 0)},{}],262:[function(l,G,N){"use strict";(function(){var y,d,F,M=function(g,h){for(var b in h)D.call(h,b)&&(g[b]=h[b]);function p(){this.constructor=g}return p.prototype=h.prototype,g.prototype=new p,g.__super__=h.prototype,g},D={}.hasOwnProperty;F=l("./XMLNode"),y=l("./NodeType"),G.exports=d=function(E){M(g,E);function g(h,b,p,v,I,x){if(g.__super__.constructor.call(this,h),b==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(p==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(b));if(!v)throw new Error("Missing DTD attribute type. "+this.debugInfo(b));if(!I)throw new Error("Missing DTD attribute default. "+this.debugInfo(b));if(I.indexOf("#")!==0&&(I="#"+I),!I.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(b));if(x&&!I.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(b));this.elementName=this.stringify.name(b),this.type=y.AttributeDeclaration,this.attributeName=this.stringify.name(p),this.attributeType=this.stringify.dtdAttType(v),x&&(this.defaultValue=this.stringify.dtdAttDefault(x)),this.defaultValueType=I}return g.prototype.toString=function(h){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(h))},g}(F)}).call(void 0)},{"./NodeType":251,"./XMLNode":273}],263:[function(l,G,N){"use strict";(function(){var y,d,F,M=function(g,h){for(var b in h)D.call(h,b)&&(g[b]=h[b]);function p(){this.constructor=g}return p.prototype=h.prototype,g.prototype=new p,g.__super__=h.prototype,g},D={}.hasOwnProperty;F=l("./XMLNode"),y=l("./NodeType"),G.exports=d=function(E){M(g,E);function g(h,b,p){if(g.__super__.constructor.call(this,h),b==null)throw new Error("Missing DTD element name. "+this.debugInfo());p||(p="(#PCDATA)"),Array.isArray(p)&&(p="("+p.join(",")+")"),this.name=this.stringify.name(b),this.type=y.ElementDeclaration,this.value=this.stringify.dtdElementValue(p)}return g.prototype.toString=function(h){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(h))},g}(F)}).call(void 0)},{"./NodeType":251,"./XMLNode":273}],264:[function(l,G,N){"use strict";(function(){var y,d,F,M,D=function(h,b){for(var p in b)E.call(b,p)&&(h[p]=b[p]);function v(){this.constructor=h}return v.prototype=b.prototype,h.prototype=new v,h.__super__=b.prototype,h},E={}.hasOwnProperty;M=l("./Utility").isObject,F=l("./XMLNode"),y=l("./NodeType"),G.exports=d=function(g){D(h,g);function h(b,p,v,I){if(h.__super__.constructor.call(this,b),v==null)throw new Error("Missing DTD entity name. "+this.debugInfo(v));if(I==null)throw new Error("Missing DTD entity value. "+this.debugInfo(v));if(this.pe=!!p,this.name=this.stringify.name(v),this.type=y.EntityDeclaration,!M(I))this.value=this.stringify.dtdEntityValue(I),this.internal=!0;else{if(!I.pubID&&!I.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(v));if(I.pubID&&!I.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(v));if(this.internal=!1,I.pubID!=null&&(this.pubID=this.stringify.dtdPubID(I.pubID)),I.sysID!=null&&(this.sysID=this.stringify.dtdSysID(I.sysID)),I.nData!=null&&(this.nData=this.stringify.dtdNData(I.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(v))}}return Object.defineProperty(h.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(h.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(h.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(h.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(h.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(h.prototype,"xmlVersion",{get:function(){return null}}),h.prototype.toString=function(b){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(b))},h}(F)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLNode":273}],265:[function(l,G,N){"use strict";(function(){var y,d,F,M=function(g,h){for(var b in h)D.call(h,b)&&(g[b]=h[b]);function p(){this.constructor=g}return p.prototype=h.prototype,g.prototype=new p,g.__super__=h.prototype,g},D={}.hasOwnProperty;F=l("./XMLNode"),y=l("./NodeType"),G.exports=d=function(E){M(g,E);function g(h,b,p){if(g.__super__.constructor.call(this,h),b==null)throw new Error("Missing DTD notation name. "+this.debugInfo(b));if(!p.pubID&&!p.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(b));this.name=this.stringify.name(b),this.type=y.NotationDeclaration,p.pubID!=null&&(this.pubID=this.stringify.dtdPubID(p.pubID)),p.sysID!=null&&(this.sysID=this.stringify.dtdSysID(p.sysID))}return Object.defineProperty(g.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(g.prototype,"systemId",{get:function(){return this.sysID}}),g.prototype.toString=function(h){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(h))},g}(F)}).call(void 0)},{"./NodeType":251,"./XMLNode":273}],266:[function(l,G,N){"use strict";(function(){var y,d,F,M,D=function(h,b){for(var p in b)E.call(b,p)&&(h[p]=b[p]);function v(){this.constructor=h}return v.prototype=b.prototype,h.prototype=new v,h.__super__=b.prototype,h},E={}.hasOwnProperty;M=l("./Utility").isObject,F=l("./XMLNode"),y=l("./NodeType"),G.exports=d=function(g){D(h,g);function h(b,p,v,I){var x;h.__super__.constructor.call(this,b),M(p)&&(x=p,p=x.version,v=x.encoding,I=x.standalone),p||(p="1.0"),this.type=y.Declaration,this.version=this.stringify.xmlVersion(p),v!=null&&(this.encoding=this.stringify.xmlEncoding(v)),I!=null&&(this.standalone=this.stringify.xmlStandalone(I))}return h.prototype.toString=function(b){return this.options.writer.declaration(this,this.options.writer.filterOptions(b))},h}(F)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLNode":273}],267:[function(l,G,N){"use strict";(function(){var y,d,F,M,D,E,g,h,b,p=function(x,S){for(var H in S)v.call(S,H)&&(x[H]=S[H]);function B(){this.constructor=x}return B.prototype=S.prototype,x.prototype=new B,x.__super__=S.prototype,x},v={}.hasOwnProperty;b=l("./Utility").isObject,h=l("./XMLNode"),y=l("./NodeType"),d=l("./XMLDTDAttList"),M=l("./XMLDTDEntity"),F=l("./XMLDTDElement"),D=l("./XMLDTDNotation"),g=l("./XMLNamedNodeMap"),G.exports=E=function(I){p(x,I);function x(S,H,B){var Q,z,K,J,U,j;if(x.__super__.constructor.call(this,S),this.type=y.DocType,S.children){for(J=S.children,z=0,K=J.length;z<K;z++)if(Q=J[z],Q.type===y.Element){this.name=Q.name;break}}this.documentObject=S,b(H)&&(U=H,H=U.pubID,B=U.sysID),B==null&&(j=[H,B],B=j[0],H=j[1]),H!=null&&(this.pubID=this.stringify.dtdPubID(H)),B!=null&&(this.sysID=this.stringify.dtdSysID(B))}return Object.defineProperty(x.prototype,"entities",{get:function(){var H,B,Q,z,K;for(z={},K=this.children,B=0,Q=K.length;B<Q;B++)H=K[B],H.type===y.EntityDeclaration&&!H.pe&&(z[H.name]=H);return new g(z)}}),Object.defineProperty(x.prototype,"notations",{get:function(){var H,B,Q,z,K;for(z={},K=this.children,B=0,Q=K.length;B<Q;B++)H=K[B],H.type===y.NotationDeclaration&&(z[H.name]=H);return new g(z)}}),Object.defineProperty(x.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(x.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(x.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),x.prototype.element=function(S,H){var B;return B=new F(this,S,H),this.children.push(B),this},x.prototype.attList=function(S,H,B,Q,z){var K;return K=new d(this,S,H,B,Q,z),this.children.push(K),this},x.prototype.entity=function(S,H){var B;return B=new M(this,!1,S,H),this.children.push(B),this},x.prototype.pEntity=function(S,H){var B;return B=new M(this,!0,S,H),this.children.push(B),this},x.prototype.notation=function(S,H){var B;return B=new D(this,S,H),this.children.push(B),this},x.prototype.toString=function(S){return this.options.writer.docType(this,this.options.writer.filterOptions(S))},x.prototype.ele=function(S,H){return this.element(S,H)},x.prototype.att=function(S,H,B,Q,z){return this.attList(S,H,B,Q,z)},x.prototype.ent=function(S,H){return this.entity(S,H)},x.prototype.pent=function(S,H){return this.pEntity(S,H)},x.prototype.not=function(S,H){return this.notation(S,H)},x.prototype.up=function(){return this.root()||this.documentObject},x.prototype.isEqualNode=function(S){return x.__super__.isEqualNode.apply(this,arguments).isEqualNode(S)?S.name!==this.name||S.publicId!==this.publicId?!1:!(S.systemId!==this.systemId):!1},x}(h)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLDTDAttList":262,"./XMLDTDElement":263,"./XMLDTDEntity":264,"./XMLDTDNotation":265,"./XMLNamedNodeMap":272,"./XMLNode":273}],268:[function(l,G,N){"use strict";(function(){var y,d,F,M,D,E,g,h,b=function(I,x){for(var S in x)p.call(x,S)&&(I[S]=x[S]);function H(){this.constructor=I}return H.prototype=x.prototype,I.prototype=new H,I.__super__=x.prototype,I},p={}.hasOwnProperty;h=l("./Utility").isPlainObject,F=l("./XMLDOMImplementation"),d=l("./XMLDOMConfiguration"),D=l("./XMLNode"),y=l("./NodeType"),g=l("./XMLStringifier"),E=l("./XMLStringWriter"),G.exports=M=function(v){b(I,v);function I(x){I.__super__.constructor.call(this,null),this.name="#document",this.type=y.Document,this.documentURI=null,this.domConfig=new d,x||(x={}),x.writer||(x.writer=new E),this.options=x,this.stringify=new g(x)}return Object.defineProperty(I.prototype,"implementation",{value:new F}),Object.defineProperty(I.prototype,"doctype",{get:function(){var S,H,B,Q;for(Q=this.children,H=0,B=Q.length;H<B;H++)if(S=Q[H],S.type===y.DocType)return S;return null}}),Object.defineProperty(I.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(I.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(I.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(I.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===y.Declaration?this.children[0].encoding:null}}),Object.defineProperty(I.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===y.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(I.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===y.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(I.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(I.prototype,"origin",{get:function(){return null}}),Object.defineProperty(I.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(I.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(I.prototype,"contentType",{get:function(){return null}}),I.prototype.end=function(x){var S;return S={},x?h(x)&&(S=x,x=this.options.writer):x=this.options.writer,x.document(this,x.filterOptions(S))},I.prototype.toString=function(x){return this.options.writer.document(this,this.options.writer.filterOptions(x))},I.prototype.createElement=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createTextNode=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createComment=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createCDATASection=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createProcessingInstruction=function(x,S){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createAttribute=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createEntityReference=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.getElementsByTagName=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.importNode=function(x,S){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createElementNS=function(x,S){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createAttributeNS=function(x,S){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.getElementsByTagNameNS=function(x,S){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.getElementById=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.adoptNode=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.renameNode=function(x,S,H){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.getElementsByClassName=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createEvent=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createNodeIterator=function(x,S,H){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createTreeWalker=function(x,S,H){throw new Error("This DOM method is not implemented."+this.debugInfo())},I}(D)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLDOMConfiguration":258,"./XMLDOMImplementation":260,"./XMLNode":273,"./XMLStringWriter":278,"./XMLStringifier":279}],269:[function(l,G,N){"use strict";(function(){var y,d,F,M,D,E,g,h,b,p,v,I,x,S,H,B,Q,z,K,J,U,j,T,te,Z={}.hasOwnProperty;te=l("./Utility"),j=te.isObject,U=te.isFunction,T=te.isPlainObject,J=te.getValue,y=l("./NodeType"),I=l("./XMLDocument"),S=l("./XMLElement"),M=l("./XMLCData"),D=l("./XMLComment"),B=l("./XMLRaw"),K=l("./XMLText"),H=l("./XMLProcessingInstruction"),p=l("./XMLDeclaration"),v=l("./XMLDocType"),E=l("./XMLDTDAttList"),h=l("./XMLDTDEntity"),g=l("./XMLDTDElement"),b=l("./XMLDTDNotation"),F=l("./XMLAttribute"),z=l("./XMLStringifier"),Q=l("./XMLStringWriter"),d=l("./WriterState"),G.exports=x=function(){function _(Y,re,pe){var le;this.name="?xml",this.type=y.Document,Y||(Y={}),le={},Y.writer?T(Y.writer)&&(le=Y.writer,Y.writer=new Q):Y.writer=new Q,this.options=Y,this.writer=Y.writer,this.writerOptions=this.writer.filterOptions(le),this.stringify=new z(Y),this.onDataCallback=re||function(){},this.onEndCallback=pe||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return _.prototype.createChildNode=function(Y){var re,pe,le,_e,me,ke,$,ne;switch(Y.type){case y.CData:this.cdata(Y.value);break;case y.Comment:this.comment(Y.value);break;case y.Element:le={},$=Y.attribs;for(pe in $){if(!Z.call($,pe))continue;re=$[pe],le[pe]=re.value}this.node(Y.name,le);break;case y.Dummy:this.dummy();break;case y.Raw:this.raw(Y.value);break;case y.Text:this.text(Y.value);break;case y.ProcessingInstruction:this.instruction(Y.target,Y.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+Y.constructor.name)}for(ne=Y.children,me=0,ke=ne.length;me<ke;me++)_e=ne[me],this.createChildNode(_e),_e.type===y.Element&&this.up();return this},_.prototype.dummy=function(){return this},_.prototype.node=function(Y,re,pe){var le;if(Y==null)throw new Error("Missing node name.");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node. "+this.debugInfo(Y));return this.openCurrent(),Y=J(Y),re==null&&(re={}),re=J(re),j(re)||(le=[re,pe],pe=le[0],re=le[1]),this.currentNode=new S(this,Y,re),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,pe!=null&&this.text(pe),this},_.prototype.element=function(Y,re,pe){var le,_e,me,ke,$,ne;if(this.currentNode&&this.currentNode.type===y.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(Y)||j(Y)||U(Y))for(ke=this.options.noValidation,this.options.noValidation=!0,ne=new I(this.options).element("TEMP_ROOT"),ne.element(Y),this.options.noValidation=ke,$=ne.children,_e=0,me=$.length;_e<me;_e++)le=$[_e],this.createChildNode(le),le.type===y.Element&&this.up();else this.node(Y,re,pe);return this},_.prototype.attribute=function(Y,re){var pe,le;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(Y));if(Y!=null&&(Y=J(Y)),j(Y))for(pe in Y){if(!Z.call(Y,pe))continue;le=Y[pe],this.attribute(pe,le)}else U(re)&&(re=re.apply()),this.options.keepNullAttributes&&re==null?this.currentNode.attribs[Y]=new F(this,Y,""):re!=null&&(this.currentNode.attribs[Y]=new F(this,Y,re));return this},_.prototype.text=function(Y){var re;return this.openCurrent(),re=new K(this,Y),this.onData(this.writer.text(re,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.cdata=function(Y){var re;return this.openCurrent(),re=new M(this,Y),this.onData(this.writer.cdata(re,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.comment=function(Y){var re;return this.openCurrent(),re=new D(this,Y),this.onData(this.writer.comment(re,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.raw=function(Y){var re;return this.openCurrent(),re=new B(this,Y),this.onData(this.writer.raw(re,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.instruction=function(Y,re){var pe,le,_e,me,ke;if(this.openCurrent(),Y!=null&&(Y=J(Y)),re!=null&&(re=J(re)),Array.isArray(Y))for(pe=0,me=Y.length;pe<me;pe++)le=Y[pe],this.instruction(le);else if(j(Y))for(le in Y){if(!Z.call(Y,le))continue;_e=Y[le],this.instruction(le,_e)}else U(re)&&(re=re.apply()),ke=new H(this,Y,re),this.onData(this.writer.processingInstruction(ke,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},_.prototype.declaration=function(Y,re,pe){var le;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return le=new p(this,Y,re,pe),this.onData(this.writer.declaration(le,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.doctype=function(Y,re,pe){if(this.openCurrent(),Y==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new v(this,re,pe),this.currentNode.rootNodeName=Y,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},_.prototype.dtdElement=function(Y,re){var pe;return this.openCurrent(),pe=new g(this,Y,re),this.onData(this.writer.dtdElement(pe,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.attList=function(Y,re,pe,le,_e){var me;return this.openCurrent(),me=new E(this,Y,re,pe,le,_e),this.onData(this.writer.dtdAttList(me,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.entity=function(Y,re){var pe;return this.openCurrent(),pe=new h(this,!1,Y,re),this.onData(this.writer.dtdEntity(pe,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.pEntity=function(Y,re){var pe;return this.openCurrent(),pe=new h(this,!0,Y,re),this.onData(this.writer.dtdEntity(pe,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.notation=function(Y,re){var pe;return this.openCurrent(),pe=new b(this,Y,re),this.onData(this.writer.dtdNotation(pe,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},_.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},_.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},_.prototype.openNode=function(Y){var re,pe,le,_e;if(!Y.isOpen){if(!this.root&&this.currentLevel===0&&Y.type===y.Element&&(this.root=Y),pe="",Y.type===y.Element){this.writerOptions.state=d.OpenTag,pe=this.writer.indent(Y,this.writerOptions,this.currentLevel)+"<"+Y.name,_e=Y.attribs;for(le in _e){if(!Z.call(_e,le))continue;re=_e[le],pe+=this.writer.attribute(re,this.writerOptions,this.currentLevel)}pe+=(Y.children?">":"/>")+this.writer.endline(Y,this.writerOptions,this.currentLevel),this.writerOptions.state=d.InsideTag}else this.writerOptions.state=d.OpenTag,pe=this.writer.indent(Y,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+Y.rootNodeName,Y.pubID&&Y.sysID?pe+=' PUBLIC "'+Y.pubID+'" "'+Y.sysID+'"':Y.sysID&&(pe+=' SYSTEM "'+Y.sysID+'"'),Y.children?(pe+=" [",this.writerOptions.state=d.InsideTag):(this.writerOptions.state=d.CloseTag,pe+=">"),pe+=this.writer.endline(Y,this.writerOptions,this.currentLevel);return this.onData(pe,this.currentLevel),Y.isOpen=!0}},_.prototype.closeNode=function(Y){var re;if(!Y.isClosed)return re="",this.writerOptions.state=d.CloseTag,Y.type===y.Element?re=this.writer.indent(Y,this.writerOptions,this.currentLevel)+"</"+Y.name+">"+this.writer.endline(Y,this.writerOptions,this.currentLevel):re=this.writer.indent(Y,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(Y,this.writerOptions,this.currentLevel),this.writerOptions.state=d.None,this.onData(re,this.currentLevel),Y.isClosed=!0},_.prototype.onData=function(Y,re){return this.documentStarted=!0,this.onDataCallback(Y,re+1)},_.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},_.prototype.debugInfo=function(Y){return Y==null?"":"node: <"+Y+">"},_.prototype.ele=function(){return this.element.apply(this,arguments)},_.prototype.nod=function(Y,re,pe){return this.node(Y,re,pe)},_.prototype.txt=function(Y){return this.text(Y)},_.prototype.dat=function(Y){return this.cdata(Y)},_.prototype.com=function(Y){return this.comment(Y)},_.prototype.ins=function(Y,re){return this.instruction(Y,re)},_.prototype.dec=function(Y,re,pe){return this.declaration(Y,re,pe)},_.prototype.dtd=function(Y,re,pe){return this.doctype(Y,re,pe)},_.prototype.e=function(Y,re,pe){return this.element(Y,re,pe)},_.prototype.n=function(Y,re,pe){return this.node(Y,re,pe)},_.prototype.t=function(Y){return this.text(Y)},_.prototype.d=function(Y){return this.cdata(Y)},_.prototype.c=function(Y){return this.comment(Y)},_.prototype.r=function(Y){return this.raw(Y)},_.prototype.i=function(Y,re){return this.instruction(Y,re)},_.prototype.att=function(){return this.currentNode&&this.currentNode.type===y.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},_.prototype.a=function(){return this.currentNode&&this.currentNode.type===y.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},_.prototype.ent=function(Y,re){return this.entity(Y,re)},_.prototype.pent=function(Y,re){return this.pEntity(Y,re)},_.prototype.not=function(Y,re){return this.notation(Y,re)},_}()}).call(void 0)},{"./NodeType":251,"./Utility":252,"./WriterState":253,"./XMLAttribute":254,"./XMLCData":255,"./XMLComment":257,"./XMLDTDAttList":262,"./XMLDTDElement":263,"./XMLDTDEntity":264,"./XMLDTDNotation":265,"./XMLDeclaration":266,"./XMLDocType":267,"./XMLDocument":268,"./XMLElement":271,"./XMLProcessingInstruction":275,"./XMLRaw":276,"./XMLStringWriter":278,"./XMLStringifier":279,"./XMLText":280}],270:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E,g=function(p,v){for(var I in v)h.call(v,I)&&(p[I]=v[I]);function x(){this.constructor=p}return x.prototype=v.prototype,p.prototype=new x,p.__super__=v.prototype,p},h={}.hasOwnProperty;E=l("./XMLNode"),M=l("./NodeType"),G.exports=D=function(b){g(p,b);function p(v){p.__super__.constructor.call(this,v),this.type=M.Dummy}return p.prototype.clone=function(){return(0,d.default)(this)},p.prototype.toString=function(v){return""},p}(E)}).call(void 0)},{"./NodeType":251,"./XMLNode":273,"babel-runtime/core-js/object/create":55}],271:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E,g,h,b,p,v,I,x=function(B,Q){for(var z in Q)S.call(Q,z)&&(B[z]=Q[z]);function K(){this.constructor=B}return K.prototype=Q.prototype,B.prototype=new K,B.__super__=Q.prototype,B},S={}.hasOwnProperty;I=l("./Utility"),v=I.isObject,p=I.isFunction,b=I.getValue,h=l("./XMLNode"),M=l("./NodeType"),D=l("./XMLAttribute"),g=l("./XMLNamedNodeMap"),G.exports=E=function(H){x(B,H);function B(Q,z,K){var J,U,j,T;if(B.__super__.constructor.call(this,Q),z==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(z),this.type=M.Element,this.attribs={},this.schemaTypeInfo=null,K!=null&&this.attribute(K),Q.type===M.Document&&(this.isRoot=!0,this.documentObject=Q,Q.rootObject=this,Q.children)){for(T=Q.children,U=0,j=T.length;U<j;U++)if(J=T[U],J.type===M.DocType){J.name=this.name;break}}}return Object.defineProperty(B.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(B.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(B.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(B.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(B.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(B.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(B.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(B.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new g(this.attribs)),this.attributeMap}}),B.prototype.clone=function(){var Q,z,K,J;K=(0,d.default)(this),K.isRoot&&(K.documentObject=null),K.attribs={},J=this.attribs;for(z in J){if(!S.call(J,z))continue;Q=J[z],K.attribs[z]=Q.clone()}return K.children=[],this.children.forEach(function(U){var j;return j=U.clone(),j.parent=K,K.children.push(j)}),K},B.prototype.attribute=function(Q,z){var K,J;if(Q!=null&&(Q=b(Q)),v(Q))for(K in Q){if(!S.call(Q,K))continue;J=Q[K],this.attribute(K,J)}else p(z)&&(z=z.apply()),this.options.keepNullAttributes&&z==null?this.attribs[Q]=new D(this,Q,""):z!=null&&(this.attribs[Q]=new D(this,Q,z));return this},B.prototype.removeAttribute=function(Q){var z,K,J;if(Q==null)throw new Error("Missing attribute name. "+this.debugInfo());if(Q=b(Q),Array.isArray(Q))for(K=0,J=Q.length;K<J;K++)z=Q[K],delete this.attribs[z];else delete this.attribs[Q];return this},B.prototype.toString=function(Q){return this.options.writer.element(this,this.options.writer.filterOptions(Q))},B.prototype.att=function(Q,z){return this.attribute(Q,z)},B.prototype.a=function(Q,z){return this.attribute(Q,z)},B.prototype.getAttribute=function(Q){return this.attribs.hasOwnProperty(Q)?this.attribs[Q].value:null},B.prototype.setAttribute=function(Q,z){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.getAttributeNode=function(Q){return this.attribs.hasOwnProperty(Q)?this.attribs[Q]:null},B.prototype.setAttributeNode=function(Q){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.removeAttributeNode=function(Q){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.getElementsByTagName=function(Q){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.getAttributeNS=function(Q,z){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.setAttributeNS=function(Q,z,K){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.removeAttributeNS=function(Q,z){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.getAttributeNodeNS=function(Q,z){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.setAttributeNodeNS=function(Q){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.getElementsByTagNameNS=function(Q,z){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.hasAttribute=function(Q){return this.attribs.hasOwnProperty(Q)},B.prototype.hasAttributeNS=function(Q,z){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.setIdAttribute=function(Q,z){return this.attribs.hasOwnProperty(Q)?this.attribs[Q].isId:z},B.prototype.setIdAttributeNS=function(Q,z,K){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.setIdAttributeNode=function(Q,z){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.getElementsByTagName=function(Q){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.getElementsByTagNameNS=function(Q,z){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.getElementsByClassName=function(Q){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.isEqualNode=function(Q){var z,K,J;if(!B.__super__.isEqualNode.apply(this,arguments).isEqualNode(Q))return!1;if(Q.namespaceURI!==this.namespaceURI)return!1;if(Q.prefix!==this.prefix)return!1;if(Q.localName!==this.localName)return!1;if(Q.attribs.length!==this.attribs.length)return!1;for(z=K=0,J=this.attribs.length-1;0<=J?K<=J:K>=J;z=0<=J?++K:--K)if(!this.attribs[z].isEqualNode(Q.attribs[z]))return!1;return!0},B}(h)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLAttribute":254,"./XMLNamedNodeMap":272,"./XMLNode":273,"babel-runtime/core-js/object/create":55}],272:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/keys"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M;G.exports=M=function(){function D(E){this.nodes=E}return Object.defineProperty(D.prototype,"length",{get:function(){return(0,d.default)(this.nodes).length||0}}),D.prototype.clone=function(){return this.nodes=null},D.prototype.getNamedItem=function(E){return this.nodes[E]},D.prototype.setNamedItem=function(E){var g;return g=this.nodes[E.nodeName],this.nodes[E.nodeName]=E,g||null},D.prototype.removeNamedItem=function(E){var g;return g=this.nodes[E],delete this.nodes[E],g||null},D.prototype.item=function(E){return this.nodes[(0,d.default)(this.nodes)[E]]||null},D.prototype.getNamedItemNS=function(E,g){throw new Error("This DOM method is not implemented.")},D.prototype.setNamedItemNS=function(E){throw new Error("This DOM method is not implemented.")},D.prototype.removeNamedItemNS=function(E,g){throw new Error("This DOM method is not implemented.")},D}()}).call(void 0)},{"babel-runtime/core-js/object/keys":60}],273:[function(l,G,N){"use strict";(function(){var y,d,F,M,D,E,g,h,b,p,v,I,x,S,H,B,Q,z,K,J={}.hasOwnProperty;K=l("./Utility"),z=K.isObject,Q=K.isFunction,B=K.isEmpty,H=K.getValue,h=null,F=null,M=null,D=null,E=null,x=null,S=null,I=null,g=null,d=null,v=null,b=null,y=null,G.exports=p=function(){function U(j){this.parent=j,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,h||(h=l("./XMLElement"),F=l("./XMLCData"),M=l("./XMLComment"),D=l("./XMLDeclaration"),E=l("./XMLDocType"),x=l("./XMLRaw"),S=l("./XMLText"),I=l("./XMLProcessingInstruction"),g=l("./XMLDummy"),d=l("./NodeType"),v=l("./XMLNodeList"),b=l("./XMLNamedNodeMap"),y=l("./DocumentPosition"))}return Object.defineProperty(U.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(U.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(U.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(U.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(U.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new v(this.children)),this.childNodeList}}),Object.defineProperty(U.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(U.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(U.prototype,"previousSibling",{get:function(){var T;return T=this.parent.children.indexOf(this),this.parent.children[T-1]||null}}),Object.defineProperty(U.prototype,"nextSibling",{get:function(){var T;return T=this.parent.children.indexOf(this),this.parent.children[T+1]||null}}),Object.defineProperty(U.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(U.prototype,"textContent",{get:function(){var T,te,Z,_,Y;if(this.nodeType===d.Element||this.nodeType===d.DocumentFragment){for(Y="",_=this.children,te=0,Z=_.length;te<Z;te++)T=_[te],T.textContent&&(Y+=T.textContent);return Y}else return null},set:function(T){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),U.prototype.setParent=function(j){var T,te,Z,_,Y;for(this.parent=j,j&&(this.options=j.options,this.stringify=j.stringify),_=this.children,Y=[],te=0,Z=_.length;te<Z;te++)T=_[te],Y.push(T.setParent(this));return Y},U.prototype.element=function(j,T,te){var Z,_,Y,re,pe,le,_e,me,ke,$,ne;if(le=null,T===null&&te==null&&(ke=[{},null],T=ke[0],te=ke[1]),T==null&&(T={}),T=H(T),z(T)||($=[T,te],te=$[0],T=$[1]),j!=null&&(j=H(j)),Array.isArray(j))for(Y=0,_e=j.length;Y<_e;Y++)_=j[Y],le=this.element(_);else if(Q(j))le=this.element(j.apply());else if(z(j))for(pe in j){if(!J.call(j,pe))continue;if(ne=j[pe],Q(ne)&&(ne=ne.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&pe.indexOf(this.stringify.convertAttKey)===0)le=this.attribute(pe.substr(this.stringify.convertAttKey.length),ne);else if(!this.options.separateArrayItems&&Array.isArray(ne)&&B(ne))le=this.dummy();else if(z(ne)&&B(ne))le=this.element(pe);else if(!this.options.keepNullNodes&&ne==null)le=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(ne))for(re=0,me=ne.length;re<me;re++)_=ne[re],Z={},Z[pe]=_,le=this.element(Z);else z(ne)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&pe.indexOf(this.stringify.convertTextKey)===0?le=this.element(ne):(le=this.element(pe),le.element(ne)):le=this.element(pe,ne)}else!this.options.keepNullNodes&&te===null?le=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&j.indexOf(this.stringify.convertTextKey)===0?le=this.text(te):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&j.indexOf(this.stringify.convertCDataKey)===0?le=this.cdata(te):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&j.indexOf(this.stringify.convertCommentKey)===0?le=this.comment(te):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&j.indexOf(this.stringify.convertRawKey)===0?le=this.raw(te):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&j.indexOf(this.stringify.convertPIKey)===0?le=this.instruction(j.substr(this.stringify.convertPIKey.length),te):le=this.node(j,T,te);if(le==null)throw new Error("Could not create any elements with: "+j+". "+this.debugInfo());return le},U.prototype.insertBefore=function(j,T,te){var Z,_,Y,re,pe;if(j!=null?j.type:void 0)return Y=j,re=T,Y.setParent(this),re?(_=children.indexOf(re),pe=children.splice(_),children.push(Y),Array.prototype.push.apply(children,pe)):children.push(Y),Y;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(j));return _=this.parent.children.indexOf(this),pe=this.parent.children.splice(_),Z=this.parent.element(j,T,te),Array.prototype.push.apply(this.parent.children,pe),Z},U.prototype.insertAfter=function(j,T,te){var Z,_,Y;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(j));return _=this.parent.children.indexOf(this),Y=this.parent.children.splice(_+1),Z=this.parent.element(j,T,te),Array.prototype.push.apply(this.parent.children,Y),Z},U.prototype.remove=function(){var j,T;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return j=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[j,j-j+1].concat(T=[])),this.parent},U.prototype.node=function(j,T,te){var Z,_;return j!=null&&(j=H(j)),T||(T={}),T=H(T),z(T)||(_=[T,te],te=_[0],T=_[1]),Z=new h(this,j,T),te!=null&&Z.text(te),this.children.push(Z),Z},U.prototype.text=function(j){var T;return z(j)&&this.element(j),T=new S(this,j),this.children.push(T),this},U.prototype.cdata=function(j){var T;return T=new F(this,j),this.children.push(T),this},U.prototype.comment=function(j){var T;return T=new M(this,j),this.children.push(T),this},U.prototype.commentBefore=function(j){var T,te,Z;return te=this.parent.children.indexOf(this),Z=this.parent.children.splice(te),T=this.parent.comment(j),Array.prototype.push.apply(this.parent.children,Z),this},U.prototype.commentAfter=function(j){var T,te,Z;return te=this.parent.children.indexOf(this),Z=this.parent.children.splice(te+1),T=this.parent.comment(j),Array.prototype.push.apply(this.parent.children,Z),this},U.prototype.raw=function(j){var T;return T=new x(this,j),this.children.push(T),this},U.prototype.dummy=function(){var j;return j=new g(this),j},U.prototype.instruction=function(j,T){var te,Z,_,Y,re;if(j!=null&&(j=H(j)),T!=null&&(T=H(T)),Array.isArray(j))for(Y=0,re=j.length;Y<re;Y++)te=j[Y],this.instruction(te);else if(z(j))for(te in j){if(!J.call(j,te))continue;Z=j[te],this.instruction(te,Z)}else Q(T)&&(T=T.apply()),_=new I(this,j,T),this.children.push(_);return this},U.prototype.instructionBefore=function(j,T){var te,Z,_;return Z=this.parent.children.indexOf(this),_=this.parent.children.splice(Z),te=this.parent.instruction(j,T),Array.prototype.push.apply(this.parent.children,_),this},U.prototype.instructionAfter=function(j,T){var te,Z,_;return Z=this.parent.children.indexOf(this),_=this.parent.children.splice(Z+1),te=this.parent.instruction(j,T),Array.prototype.push.apply(this.parent.children,_),this},U.prototype.declaration=function(j,T,te){var Z,_;return Z=this.document(),_=new D(Z,j,T,te),Z.children.length===0?Z.children.unshift(_):Z.children[0].type===d.Declaration?Z.children[0]=_:Z.children.unshift(_),Z.root()||Z},U.prototype.dtd=function(j,T){var te,Z,_,Y,re,pe,le,_e,me,ke;for(Z=this.document(),_=new E(Z,j,T),me=Z.children,Y=re=0,le=me.length;re<le;Y=++re)if(te=me[Y],te.type===d.DocType)return Z.children[Y]=_,_;for(ke=Z.children,Y=pe=0,_e=ke.length;pe<_e;Y=++pe)if(te=ke[Y],te.isRoot)return Z.children.splice(Y,0,_),_;return Z.children.push(_),_},U.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},U.prototype.root=function(){var j;for(j=this;j;){if(j.type===d.Document)return j.rootObject;if(j.isRoot)return j;j=j.parent}},U.prototype.document=function(){var j;for(j=this;j;){if(j.type===d.Document)return j;j=j.parent}},U.prototype.end=function(j){return this.document().end(j)},U.prototype.prev=function(){var j;if(j=this.parent.children.indexOf(this),j<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[j-1]},U.prototype.next=function(){var j;if(j=this.parent.children.indexOf(this),j===-1||j===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[j+1]},U.prototype.importDocument=function(j){var T;return T=j.root().clone(),T.parent=this,T.isRoot=!1,this.children.push(T),this},U.prototype.debugInfo=function(j){var T,te;return j=j||this.name,j==null&&!((T=this.parent)!=null?T.name:void 0)?"":j==null?"parent: <"+this.parent.name+">":((te=this.parent)!=null?te.name:void 0)?"node: <"+j+">, parent: <"+this.parent.name+">":"node: <"+j+">"},U.prototype.ele=function(j,T,te){return this.element(j,T,te)},U.prototype.nod=function(j,T,te){return this.node(j,T,te)},U.prototype.txt=function(j){return this.text(j)},U.prototype.dat=function(j){return this.cdata(j)},U.prototype.com=function(j){return this.comment(j)},U.prototype.ins=function(j,T){return this.instruction(j,T)},U.prototype.doc=function(){return this.document()},U.prototype.dec=function(j,T,te){return this.declaration(j,T,te)},U.prototype.e=function(j,T,te){return this.element(j,T,te)},U.prototype.n=function(j,T,te){return this.node(j,T,te)},U.prototype.t=function(j){return this.text(j)},U.prototype.d=function(j){return this.cdata(j)},U.prototype.c=function(j){return this.comment(j)},U.prototype.r=function(j){return this.raw(j)},U.prototype.i=function(j,T){return this.instruction(j,T)},U.prototype.u=function(){return this.up()},U.prototype.importXMLBuilder=function(j){return this.importDocument(j)},U.prototype.replaceChild=function(j,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.removeChild=function(j){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.appendChild=function(j){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.hasChildNodes=function(){return this.children.length!==0},U.prototype.cloneNode=function(j){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.isSupported=function(j,T){return!0},U.prototype.hasAttributes=function(){return this.attribs.length!==0},U.prototype.compareDocumentPosition=function(j){var T,te;return T=this,T===j?0:this.document()!==j.document()?(te=y.Disconnected|y.ImplementationSpecific,Math.random()<.5?te|=y.Preceding:te|=y.Following,te):T.isAncestor(j)?y.Contains|y.Preceding:T.isDescendant(j)?y.Contains|y.Following:T.isPreceding(j)?y.Preceding:y.Following},U.prototype.isSameNode=function(j){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.lookupPrefix=function(j){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.isDefaultNamespace=function(j){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.lookupNamespaceURI=function(j){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.isEqualNode=function(j){var T,te,Z;if(j.nodeType!==this.nodeType)return!1;if(j.children.length!==this.children.length)return!1;for(T=te=0,Z=this.children.length-1;0<=Z?te<=Z:te>=Z;T=0<=Z?++te:--te)if(!this.children[T].isEqualNode(j.children[T]))return!1;return!0},U.prototype.getFeature=function(j,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.setUserData=function(j,T,te){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.getUserData=function(j){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.contains=function(j){return j?j===this||this.isDescendant(j):!1},U.prototype.isDescendant=function(j){var T,te,Z,_,Y;for(Y=this.children,Z=0,_=Y.length;Z<_;Z++){if(T=Y[Z],j===T)return!0;if(te=T.isDescendant(j),te)return!0}return!1},U.prototype.isAncestor=function(j){return j.isDescendant(this)},U.prototype.isPreceding=function(j){var T,te;return T=this.treePosition(j),te=this.treePosition(this),T===-1||te===-1?!1:T<te},U.prototype.isFollowing=function(j){var T,te;return T=this.treePosition(j),te=this.treePosition(this),T===-1||te===-1?!1:T>te},U.prototype.treePosition=function(j){var T,te;return te=0,T=!1,this.foreachTreeNode(this.document(),function(Z){if(te++,!T&&Z===j)return T=!0}),T?te:-1},U.prototype.foreachTreeNode=function(j,T){var te,Z,_,Y,re;for(j||(j=this.document()),Y=j.children,Z=0,_=Y.length;Z<_;Z++){if(te=Y[Z],re=T(te))return re;if(re=this.foreachTreeNode(te,T),re)return re}},U}()}).call(void 0)},{"./DocumentPosition":250,"./NodeType":251,"./Utility":252,"./XMLCData":255,"./XMLComment":257,"./XMLDeclaration":266,"./XMLDocType":267,"./XMLDummy":270,"./XMLElement":271,"./XMLNamedNodeMap":272,"./XMLNodeList":274,"./XMLProcessingInstruction":275,"./XMLRaw":276,"./XMLText":280}],274:[function(l,G,N){"use strict";(function(){var y;G.exports=y=function(){function d(F){this.nodes=F}return Object.defineProperty(d.prototype,"length",{get:function(){return this.nodes.length||0}}),d.prototype.clone=function(){return this.nodes=null},d.prototype.item=function(F){return this.nodes[F]||null},d}()}).call(void 0)},{}],275:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E,g=function(p,v){for(var I in v)h.call(v,I)&&(p[I]=v[I]);function x(){this.constructor=p}return x.prototype=v.prototype,p.prototype=new x,p.__super__=v.prototype,p},h={}.hasOwnProperty;M=l("./NodeType"),D=l("./XMLCharacterData"),G.exports=E=function(b){g(p,b);function p(v,I,x){if(p.__super__.constructor.call(this,v),I==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=M.ProcessingInstruction,this.target=this.stringify.insTarget(I),this.name=this.target,x&&(this.value=this.stringify.insValue(x))}return p.prototype.clone=function(){return(0,d.default)(this)},p.prototype.toString=function(v){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(v))},p.prototype.isEqualNode=function(v){return p.__super__.isEqualNode.apply(this,arguments).isEqualNode(v)?!(v.target!==this.target):!1},p}(D)}).call(void 0)},{"./NodeType":251,"./XMLCharacterData":256,"babel-runtime/core-js/object/create":55}],276:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E,g=function(p,v){for(var I in v)h.call(v,I)&&(p[I]=v[I]);function x(){this.constructor=p}return x.prototype=v.prototype,p.prototype=new x,p.__super__=v.prototype,p},h={}.hasOwnProperty;M=l("./NodeType"),D=l("./XMLNode"),G.exports=E=function(b){g(p,b);function p(v,I){if(p.__super__.constructor.call(this,v),I==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=M.Raw,this.value=this.stringify.raw(I)}return p.prototype.clone=function(){return(0,d.default)(this)},p.prototype.toString=function(v){return this.options.writer.raw(this,this.options.writer.filterOptions(v))},p}(D)}).call(void 0)},{"./NodeType":251,"./XMLNode":273,"babel-runtime/core-js/object/create":55}],277:[function(l,G,N){"use strict";(function(){var y,d,F,M,D=function(h,b){for(var p in b)E.call(b,p)&&(h[p]=b[p]);function v(){this.constructor=h}return v.prototype=b.prototype,h.prototype=new v,h.__super__=b.prototype,h},E={}.hasOwnProperty;y=l("./NodeType"),M=l("./XMLWriterBase"),d=l("./WriterState"),G.exports=F=function(g){D(h,g);function h(b,p){this.stream=b,h.__super__.constructor.call(this,p)}return h.prototype.endline=function(b,p,v){return b.isLastRootNode&&p.state===d.CloseTag?"":h.__super__.endline.call(this,b,p,v)},h.prototype.document=function(b,p){var v,I,x,S,H,B,Q,z,K;for(Q=b.children,I=x=0,H=Q.length;x<H;I=++x)v=Q[I],v.isLastRootNode=I===b.children.length-1;for(p=this.filterOptions(p),z=b.children,K=[],S=0,B=z.length;S<B;S++)v=z[S],K.push(this.writeChildNode(v,p,0));return K},h.prototype.attribute=function(b,p,v){return this.stream.write(h.__super__.attribute.call(this,b,p,v))},h.prototype.cdata=function(b,p,v){return this.stream.write(h.__super__.cdata.call(this,b,p,v))},h.prototype.comment=function(b,p,v){return this.stream.write(h.__super__.comment.call(this,b,p,v))},h.prototype.declaration=function(b,p,v){return this.stream.write(h.__super__.declaration.call(this,b,p,v))},h.prototype.docType=function(b,p,v){var I,x,S,H;if(v||(v=0),this.openNode(b,p,v),p.state=d.OpenTag,this.stream.write(this.indent(b,p,v)),this.stream.write("<!DOCTYPE "+b.root().name),b.pubID&&b.sysID?this.stream.write(' PUBLIC "'+b.pubID+'" "'+b.sysID+'"'):b.sysID&&this.stream.write(' SYSTEM "'+b.sysID+'"'),b.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(b,p,v)),p.state=d.InsideTag,H=b.children,x=0,S=H.length;x<S;x++)I=H[x],this.writeChildNode(I,p,v+1);p.state=d.CloseTag,this.stream.write("]")}return p.state=d.CloseTag,this.stream.write(p.spaceBeforeSlash+">"),this.stream.write(this.endline(b,p,v)),p.state=d.None,this.closeNode(b,p,v)},h.prototype.element=function(b,p,v){var I,x,S,H,B,Q,z,K,J,U;v||(v=0),this.openNode(b,p,v),p.state=d.OpenTag,this.stream.write(this.indent(b,p,v)+"<"+b.name),J=b.attribs;for(z in J){if(!E.call(J,z))continue;I=J[z],this.attribute(I,p,v)}if(S=b.children.length,H=S===0?null:b.children[0],S===0||b.children.every(function(j){return(j.type===y.Text||j.type===y.Raw)&&j.value===""}))p.allowEmpty?(this.stream.write(">"),p.state=d.CloseTag,this.stream.write("</"+b.name+">")):(p.state=d.CloseTag,this.stream.write(p.spaceBeforeSlash+"/>"));else if(p.pretty&&S===1&&(H.type===y.Text||H.type===y.Raw)&&H.value!=null)this.stream.write(">"),p.state=d.InsideTag,p.suppressPrettyCount++,K=!0,this.writeChildNode(H,p,v+1),p.suppressPrettyCount--,K=!1,p.state=d.CloseTag,this.stream.write("</"+b.name+">");else{for(this.stream.write(">"+this.endline(b,p,v)),p.state=d.InsideTag,U=b.children,B=0,Q=U.length;B<Q;B++)x=U[B],this.writeChildNode(x,p,v+1);p.state=d.CloseTag,this.stream.write(this.indent(b,p,v)+"</"+b.name+">")}return this.stream.write(this.endline(b,p,v)),p.state=d.None,this.closeNode(b,p,v)},h.prototype.processingInstruction=function(b,p,v){return this.stream.write(h.__super__.processingInstruction.call(this,b,p,v))},h.prototype.raw=function(b,p,v){return this.stream.write(h.__super__.raw.call(this,b,p,v))},h.prototype.text=function(b,p,v){return this.stream.write(h.__super__.text.call(this,b,p,v))},h.prototype.dtdAttList=function(b,p,v){return this.stream.write(h.__super__.dtdAttList.call(this,b,p,v))},h.prototype.dtdElement=function(b,p,v){return this.stream.write(h.__super__.dtdElement.call(this,b,p,v))},h.prototype.dtdEntity=function(b,p,v){return this.stream.write(h.__super__.dtdEntity.call(this,b,p,v))},h.prototype.dtdNotation=function(b,p,v){return this.stream.write(h.__super__.dtdNotation.call(this,b,p,v))},h}(M)}).call(void 0)},{"./NodeType":251,"./WriterState":253,"./XMLWriterBase":281}],278:[function(l,G,N){"use strict";(function(){var y,d,F=function(E,g){for(var h in g)M.call(g,h)&&(E[h]=g[h]);function b(){this.constructor=E}return b.prototype=g.prototype,E.prototype=new b,E.__super__=g.prototype,E},M={}.hasOwnProperty;d=l("./XMLWriterBase"),G.exports=y=function(D){F(E,D);function E(g){E.__super__.constructor.call(this,g)}return E.prototype.document=function(g,h){var b,p,v,I,x;for(h=this.filterOptions(h),I="",x=g.children,p=0,v=x.length;p<v;p++)b=x[p],I+=this.writeChildNode(b,h,0);return h.pretty&&I.slice(-h.newline.length)===h.newline&&(I=I.slice(0,-h.newline.length)),I},E}(d)}).call(void 0)},{"./XMLWriterBase":281}],279:[function(l,G,N){"use strict";(function(){var y,d=function(D,E){return function(){return D.apply(E,arguments)}},F={}.hasOwnProperty;G.exports=y=function(){function M(D){this.assertLegalName=d(this.assertLegalName,this),this.assertLegalChar=d(this.assertLegalChar,this);var E,g,h;D||(D={}),this.options=D,this.options.version||(this.options.version="1.0"),g=D.stringify||{};for(E in g){if(!F.call(g,E))continue;h=g[E],this[E]=h}}return M.prototype.name=function(D){return this.options.noValidation?D:this.assertLegalName(""+D||"")},M.prototype.text=function(D){return this.options.noValidation?D:this.assertLegalChar(this.textEscape(""+D||""))},M.prototype.cdata=function(D){return this.options.noValidation?D:(D=""+D||"",D=D.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(D))},M.prototype.comment=function(D){if(this.options.noValidation)return D;if(D=""+D||"",D.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+D);return this.assertLegalChar(D)},M.prototype.raw=function(D){return this.options.noValidation?D:""+D||""},M.prototype.attValue=function(D){return this.options.noValidation?D:this.assertLegalChar(this.attEscape(D=""+D||""))},M.prototype.insTarget=function(D){return this.options.noValidation?D:this.assertLegalChar(""+D||"")},M.prototype.insValue=function(D){if(this.options.noValidation)return D;if(D=""+D||"",D.match(/\?>/))throw new Error("Invalid processing instruction value: "+D);return this.assertLegalChar(D)},M.prototype.xmlVersion=function(D){if(this.options.noValidation)return D;if(D=""+D||"",!D.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+D);return D},M.prototype.xmlEncoding=function(D){if(this.options.noValidation)return D;if(D=""+D||"",!D.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+D);return this.assertLegalChar(D)},M.prototype.xmlStandalone=function(D){return this.options.noValidation?D:D?"yes":"no"},M.prototype.dtdPubID=function(D){return this.options.noValidation?D:this.assertLegalChar(""+D||"")},M.prototype.dtdSysID=function(D){return this.options.noValidation?D:this.assertLegalChar(""+D||"")},M.prototype.dtdElementValue=function(D){return this.options.noValidation?D:this.assertLegalChar(""+D||"")},M.prototype.dtdAttType=function(D){return this.options.noValidation?D:this.assertLegalChar(""+D||"")},M.prototype.dtdAttDefault=function(D){return this.options.noValidation?D:this.assertLegalChar(""+D||"")},M.prototype.dtdEntityValue=function(D){return this.options.noValidation?D:this.assertLegalChar(""+D||"")},M.prototype.dtdNData=function(D){return this.options.noValidation?D:this.assertLegalChar(""+D||"")},M.prototype.convertAttKey="@",M.prototype.convertPIKey="?",M.prototype.convertTextKey="#text",M.prototype.convertCDataKey="#cdata",M.prototype.convertCommentKey="#comment",M.prototype.convertRawKey="#raw",M.prototype.assertLegalChar=function(D){var E,g;if(this.options.noValidation)return D;if(E="",this.options.version==="1.0"){if(E=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,g=D.match(E))throw new Error("Invalid character in string: "+D+" at index "+g.index)}else if(this.options.version==="1.1"&&(E=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,g=D.match(E)))throw new Error("Invalid character in string: "+D+" at index "+g.index);return D},M.prototype.assertLegalName=function(D){var E;if(this.options.noValidation)return D;if(this.assertLegalChar(D),E=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!D.match(E))throw new Error("Invalid character in name");return D},M.prototype.textEscape=function(D){var E;return this.options.noValidation?D:(E=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,D.replace(E,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#xD;"))},M.prototype.attEscape=function(D){var E;return this.options.noValidation?D:(E=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,D.replace(E,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;"))},M}()}).call(void 0)},{}],280:[function(l,G,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E,g=function(p,v){for(var I in v)h.call(v,I)&&(p[I]=v[I]);function x(){this.constructor=p}return x.prototype=v.prototype,p.prototype=new x,p.__super__=v.prototype,p},h={}.hasOwnProperty;M=l("./NodeType"),D=l("./XMLCharacterData"),G.exports=E=function(b){g(p,b);function p(v,I){if(p.__super__.constructor.call(this,v),I==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=M.Text,this.value=this.stringify.text(I)}return Object.defineProperty(p.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(p.prototype,"wholeText",{get:function(){var I,x,S;for(S="",x=this.previousSibling;x;)S=x.data+S,x=x.previousSibling;for(S+=this.data,I=this.nextSibling;I;)S=S+I.data,I=I.nextSibling;return S}}),p.prototype.clone=function(){return(0,d.default)(this)},p.prototype.toString=function(v){return this.options.writer.text(this,this.options.writer.filterOptions(v))},p.prototype.splitText=function(v){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.replaceWholeText=function(v){throw new Error("This DOM method is not implemented."+this.debugInfo())},p}(D)}).call(void 0)},{"./NodeType":251,"./XMLCharacterData":256,"babel-runtime/core-js/object/create":55}],281:[function(l,G,N){"use strict";(function(){var y,d,F,M,D,E,g,h,b,p,v,I,x,S,H,B,Q,z={}.hasOwnProperty;Q=l("./Utility").assign,y=l("./NodeType"),b=l("./XMLDeclaration"),p=l("./XMLDocType"),F=l("./XMLCData"),M=l("./XMLComment"),I=l("./XMLElement"),S=l("./XMLRaw"),H=l("./XMLText"),x=l("./XMLProcessingInstruction"),v=l("./XMLDummy"),D=l("./XMLDTDAttList"),E=l("./XMLDTDElement"),g=l("./XMLDTDEntity"),h=l("./XMLDTDNotation"),d=l("./WriterState"),G.exports=B=function(){function K(J){var U,j,T;J||(J={}),this.options=J,j=J.writer||{};for(U in j){if(!z.call(j,U))continue;T=j[U],this["_"+U]=this[U],this[U]=T}}return K.prototype.filterOptions=function(J){var U,j,T,te,Z,_,Y,re;return J||(J={}),J=Q({},this.options,J),U={writer:this},U.pretty=J.pretty||!1,U.allowEmpty=J.allowEmpty||!1,U.indent=(j=J.indent)!=null?j:" ",U.newline=(T=J.newline)!=null?T:`
`,U.offset=(te=J.offset)!=null?te:0,U.dontPrettyTextNodes=(Z=(_=J.dontPrettyTextNodes)!=null?_:J.dontprettytextnodes)!=null?Z:0,U.spaceBeforeSlash=(Y=(re=J.spaceBeforeSlash)!=null?re:J.spacebeforeslash)!=null?Y:"",U.spaceBeforeSlash===!0&&(U.spaceBeforeSlash=" "),U.suppressPrettyCount=0,U.user={},U.state=d.None,U},K.prototype.indent=function(J,U,j){var T;return!U.pretty||U.suppressPrettyCount?"":U.pretty&&(T=(j||0)+U.offset+1,T>0)?new Array(T).join(U.indent):""},K.prototype.endline=function(J,U,j){return!U.pretty||U.suppressPrettyCount?"":U.newline},K.prototype.attribute=function(J,U,j){var T;return this.openAttribute(J,U,j),T=" "+J.name+'="'+J.value+'"',this.closeAttribute(J,U,j),T},K.prototype.cdata=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j)+"<![CDATA[",U.state=d.InsideTag,T+=J.value,U.state=d.CloseTag,T+="]]>"+this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},K.prototype.comment=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j)+"<!-- ",U.state=d.InsideTag,T+=J.value,U.state=d.CloseTag,T+=" -->"+this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},K.prototype.declaration=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j)+"<?xml",U.state=d.InsideTag,T+=' version="'+J.version+'"',J.encoding!=null&&(T+=' encoding="'+J.encoding+'"'),J.standalone!=null&&(T+=' standalone="'+J.standalone+'"'),U.state=d.CloseTag,T+=U.spaceBeforeSlash+"?>",T+=this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},K.prototype.docType=function(J,U,j){var T,te,Z,_,Y;if(j||(j=0),this.openNode(J,U,j),U.state=d.OpenTag,_=this.indent(J,U,j),_+="<!DOCTYPE "+J.root().name,J.pubID&&J.sysID?_+=' PUBLIC "'+J.pubID+'" "'+J.sysID+'"':J.sysID&&(_+=' SYSTEM "'+J.sysID+'"'),J.children.length>0){for(_+=" [",_+=this.endline(J,U,j),U.state=d.InsideTag,Y=J.children,te=0,Z=Y.length;te<Z;te++)T=Y[te],_+=this.writeChildNode(T,U,j+1);U.state=d.CloseTag,_+="]"}return U.state=d.CloseTag,_+=U.spaceBeforeSlash+">",_+=this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),_},K.prototype.element=function(J,U,j){var T,te,Z,_,Y,re,pe,le,_e,me,ke,$,ne,W;j||(j=0),me=!1,ke="",this.openNode(J,U,j),U.state=d.OpenTag,ke+=this.indent(J,U,j)+"<"+J.name,$=J.attribs;for(_e in $){if(!z.call($,_e))continue;T=$[_e],ke+=this.attribute(T,U,j)}if(Z=J.children.length,_=Z===0?null:J.children[0],Z===0||J.children.every(function(ie){return(ie.type===y.Text||ie.type===y.Raw)&&ie.value===""}))U.allowEmpty?(ke+=">",U.state=d.CloseTag,ke+="</"+J.name+">"+this.endline(J,U,j)):(U.state=d.CloseTag,ke+=U.spaceBeforeSlash+"/>"+this.endline(J,U,j));else if(U.pretty&&Z===1&&(_.type===y.Text||_.type===y.Raw)&&_.value!=null)ke+=">",U.state=d.InsideTag,U.suppressPrettyCount++,me=!0,ke+=this.writeChildNode(_,U,j+1),U.suppressPrettyCount--,me=!1,U.state=d.CloseTag,ke+="</"+J.name+">"+this.endline(J,U,j);else{if(U.dontPrettyTextNodes){for(ne=J.children,Y=0,pe=ne.length;Y<pe;Y++)if(te=ne[Y],(te.type===y.Text||te.type===y.Raw)&&te.value!=null){U.suppressPrettyCount++,me=!0;break}}for(ke+=">"+this.endline(J,U,j),U.state=d.InsideTag,W=J.children,re=0,le=W.length;re<le;re++)te=W[re],ke+=this.writeChildNode(te,U,j+1);U.state=d.CloseTag,ke+=this.indent(J,U,j)+"</"+J.name+">",me&&U.suppressPrettyCount--,ke+=this.endline(J,U,j),U.state=d.None}return this.closeNode(J,U,j),ke},K.prototype.writeChildNode=function(J,U,j){switch(J.type){case y.CData:return this.cdata(J,U,j);case y.Comment:return this.comment(J,U,j);case y.Element:return this.element(J,U,j);case y.Raw:return this.raw(J,U,j);case y.Text:return this.text(J,U,j);case y.ProcessingInstruction:return this.processingInstruction(J,U,j);case y.Dummy:return"";case y.Declaration:return this.declaration(J,U,j);case y.DocType:return this.docType(J,U,j);case y.AttributeDeclaration:return this.dtdAttList(J,U,j);case y.ElementDeclaration:return this.dtdElement(J,U,j);case y.EntityDeclaration:return this.dtdEntity(J,U,j);case y.NotationDeclaration:return this.dtdNotation(J,U,j);default:throw new Error("Unknown XML node type: "+J.constructor.name)}},K.prototype.processingInstruction=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j)+"<?",U.state=d.InsideTag,T+=J.target,J.value&&(T+=" "+J.value),U.state=d.CloseTag,T+=U.spaceBeforeSlash+"?>",T+=this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},K.prototype.raw=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j),U.state=d.InsideTag,T+=J.value,U.state=d.CloseTag,T+=this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},K.prototype.text=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j),U.state=d.InsideTag,T+=J.value,U.state=d.CloseTag,T+=this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},K.prototype.dtdAttList=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j)+"<!ATTLIST",U.state=d.InsideTag,T+=" "+J.elementName+" "+J.attributeName+" "+J.attributeType,J.defaultValueType!=="#DEFAULT"&&(T+=" "+J.defaultValueType),J.defaultValue&&(T+=' "'+J.defaultValue+'"'),U.state=d.CloseTag,T+=U.spaceBeforeSlash+">"+this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},K.prototype.dtdElement=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j)+"<!ELEMENT",U.state=d.InsideTag,T+=" "+J.name+" "+J.value,U.state=d.CloseTag,T+=U.spaceBeforeSlash+">"+this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},K.prototype.dtdEntity=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j)+"<!ENTITY",U.state=d.InsideTag,J.pe&&(T+=" %"),T+=" "+J.name,J.value?T+=' "'+J.value+'"':(J.pubID&&J.sysID?T+=' PUBLIC "'+J.pubID+'" "'+J.sysID+'"':J.sysID&&(T+=' SYSTEM "'+J.sysID+'"'),J.nData&&(T+=" NDATA "+J.nData)),U.state=d.CloseTag,T+=U.spaceBeforeSlash+">"+this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},K.prototype.dtdNotation=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j)+"<!NOTATION",U.state=d.InsideTag,T+=" "+J.name,J.pubID&&J.sysID?T+=' PUBLIC "'+J.pubID+'" "'+J.sysID+'"':J.pubID?T+=' PUBLIC "'+J.pubID+'"':J.sysID&&(T+=' SYSTEM "'+J.sysID+'"'),U.state=d.CloseTag,T+=U.spaceBeforeSlash+">"+this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},K.prototype.openNode=function(J,U,j){},K.prototype.closeNode=function(J,U,j){},K.prototype.openAttribute=function(J,U,j){},K.prototype.closeAttribute=function(J,U,j){},K}()}).call(void 0)},{"./NodeType":251,"./Utility":252,"./WriterState":253,"./XMLCData":255,"./XMLComment":257,"./XMLDTDAttList":262,"./XMLDTDElement":263,"./XMLDTDEntity":264,"./XMLDTDNotation":265,"./XMLDeclaration":266,"./XMLDocType":267,"./XMLDummy":270,"./XMLElement":271,"./XMLProcessingInstruction":275,"./XMLRaw":276,"./XMLText":280}],282:[function(l,G,N){"use strict";(function(){var y,d,F,M,D,E,g,h,b,p;p=l("./Utility"),h=p.assign,b=p.isFunction,F=l("./XMLDOMImplementation"),M=l("./XMLDocument"),D=l("./XMLDocumentCB"),g=l("./XMLStringWriter"),E=l("./XMLStreamWriter"),y=l("./NodeType"),d=l("./WriterState"),G.exports.create=function(v,I,x,S){var H,B;if(v==null)throw new Error("Root element needs a name.");return S=h({},I,x,S),H=new M(S),B=H.element(v),S.headless||(H.declaration(S),(S.pubID!=null||S.sysID!=null)&&H.dtd(S)),B},G.exports.begin=function(v,I,x){var S;return b(v)&&(S=[v,I],I=S[0],x=S[1],v={}),I?new D(v,I,x):new M(v)},G.exports.stringWriter=function(v){return new g(v)},G.exports.streamWriter=function(v,I){return new E(v,I)},G.exports.implementation=new F,G.exports.nodeType=y,G.exports.writerState=d}).call(void 0)},{"./NodeType":251,"./Utility":252,"./WriterState":253,"./XMLDOMImplementation":260,"./XMLDocument":268,"./XMLDocumentCB":269,"./XMLStreamWriter":277,"./XMLStringWriter":278}],283:[function(l,G,N){G.exports=d;var y=Object.prototype.hasOwnProperty;function d(){for(var F={},M=0;M<arguments.length;M++){var D=arguments[M];for(var E in D)y.call(D,E)&&(F[E]=D[E])}return F}},{}],284:[function(l,G,N){"use strict";var y=l("buffer").Buffer,d=l("./sha"),F=l("./md5"),M={sha1:d,md5:F},D=64,E=y.alloc(D);E.fill(0);function g(p,v,I){y.isBuffer(v)||(v=y.from(v)),y.isBuffer(I)||(I=y.from(I)),v.length>D?v=p(v):v.length<D&&(v=y.concat([v,E],D));for(var x=y.alloc(D),S=y.alloc(D),H=0;H<D;H++)x[H]=v[H]^54,S[H]=v[H]^92;var B=p(y.concat([x,I]));return p(y.concat([S,B]))}function h(p,v){p=p||"sha1";var I=M[p],x=[],S=0;return I||b("algorithm:",p,"is not yet supported"),{update:function(B){return y.isBuffer(B)||(B=y.from(B)),x.push(B),S+=B.length,this},digest:function(B){var Q=y.concat(x),z=v?g(I,v,Q):I(Q);return x=null,B?z.toString(B):z}}}function b(){var p=[].slice.call(arguments).join(" ");throw new Error([p,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(`
`))}N.createHash=function(p){return h(p)},N.createHmac=function(p,v){return h(p,v)},N.createCredentials=function(){b("sorry,createCredentials is not implemented yet")},N.createCipher=function(){b("sorry,createCipher is not implemented yet")},N.createCipheriv=function(){b("sorry,createCipheriv is not implemented yet")},N.createDecipher=function(){b("sorry,createDecipher is not implemented yet")},N.createDecipheriv=function(){b("sorry,createDecipheriv is not implemented yet")},N.createSign=function(){b("sorry,createSign is not implemented yet")},N.createVerify=function(){b("sorry,createVerify is not implemented yet")},N.createDiffieHellman=function(){b("sorry,createDiffieHellman is not implemented yet")},N.pbkdf2=function(){b("sorry,pbkdf2 is not implemented yet")}},{"./md5":286,"./sha":287,buffer:73}],285:[function(l,G,N){"use strict";var y=l("buffer").Buffer,d=4,F=y.alloc(d);F.fill(0);var M=8;function D(h,b){if(h.length%d!==0){var p=h.length+(d-h.length%d);h=y.concat([h,F],p)}for(var v=[],I=b?h.readInt32BE:h.readInt32LE,x=0;x<h.length;x+=d)v.push(I.call(h,x));return v}function E(h,b,p){for(var v=y.alloc(b),I=p?v.writeInt32BE:v.writeInt32LE,x=0;x<h.length;x++)I.call(v,h[x],x*4,!0);return v}function g(h,b,p,v){y.isBuffer(h)||(h=y.from(h));var I=b(D(h,v),h.length*M);return E(I,p,v)}G.exports={hash:g}},{buffer:73}],286:[function(l,G,N){"use strict";var y=l("./helpers");function d(){return hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72"}function F(v,I){v[I>>5]|=128<<I%32,v[(I+64>>>9<<4)+14]=I;for(var x=1732584193,S=-271733879,H=-1732584194,B=271733878,Q=0;Q<v.length;Q+=16){var z=x,K=S,J=H,U=B;x=D(x,S,H,B,v[Q+0],7,-680876936),B=D(B,x,S,H,v[Q+1],12,-389564586),H=D(H,B,x,S,v[Q+2],17,606105819),S=D(S,H,B,x,v[Q+3],22,-1044525330),x=D(x,S,H,B,v[Q+4],7,-176418897),B=D(B,x,S,H,v[Q+5],12,1200080426),H=D(H,B,x,S,v[Q+6],17,-1473231341),S=D(S,H,B,x,v[Q+7],22,-45705983),x=D(x,S,H,B,v[Q+8],7,1770035416),B=D(B,x,S,H,v[Q+9],12,-1958414417),H=D(H,B,x,S,v[Q+10],17,-42063),S=D(S,H,B,x,v[Q+11],22,-1990404162),x=D(x,S,H,B,v[Q+12],7,1804603682),B=D(B,x,S,H,v[Q+13],12,-40341101),H=D(H,B,x,S,v[Q+14],17,-1502002290),S=D(S,H,B,x,v[Q+15],22,1236535329),x=E(x,S,H,B,v[Q+1],5,-165796510),B=E(B,x,S,H,v[Q+6],9,-1069501632),H=E(H,B,x,S,v[Q+11],14,643717713),S=E(S,H,B,x,v[Q+0],20,-373897302),x=E(x,S,H,B,v[Q+5],5,-701558691),B=E(B,x,S,H,v[Q+10],9,38016083),H=E(H,B,x,S,v[Q+15],14,-660478335),S=E(S,H,B,x,v[Q+4],20,-405537848),x=E(x,S,H,B,v[Q+9],5,568446438),B=E(B,x,S,H,v[Q+14],9,-1019803690),H=E(H,B,x,S,v[Q+3],14,-187363961),S=E(S,H,B,x,v[Q+8],20,1163531501),x=E(x,S,H,B,v[Q+13],5,-1444681467),B=E(B,x,S,H,v[Q+2],9,-51403784),H=E(H,B,x,S,v[Q+7],14,1735328473),S=E(S,H,B,x,v[Q+12],20,-1926607734),x=g(x,S,H,B,v[Q+5],4,-378558),B=g(B,x,S,H,v[Q+8],11,-2022574463),H=g(H,B,x,S,v[Q+11],16,1839030562),S=g(S,H,B,x,v[Q+14],23,-35309556),x=g(x,S,H,B,v[Q+1],4,-1530992060),B=g(B,x,S,H,v[Q+4],11,1272893353),H=g(H,B,x,S,v[Q+7],16,-155497632),S=g(S,H,B,x,v[Q+10],23,-1094730640),x=g(x,S,H,B,v[Q+13],4,681279174),B=g(B,x,S,H,v[Q+0],11,-358537222),H=g(H,B,x,S,v[Q+3],16,-722521979),S=g(S,H,B,x,v[Q+6],23,76029189),x=g(x,S,H,B,v[Q+9],4,-640364487),B=g(B,x,S,H,v[Q+12],11,-421815835),H=g(H,B,x,S,v[Q+15],16,530742520),S=g(S,H,B,x,v[Q+2],23,-995338651),x=h(x,S,H,B,v[Q+0],6,-198630844),B=h(B,x,S,H,v[Q+7],10,1126891415),H=h(H,B,x,S,v[Q+14],15,-1416354905),S=h(S,H,B,x,v[Q+5],21,-57434055),x=h(x,S,H,B,v[Q+12],6,1700485571),B=h(B,x,S,H,v[Q+3],10,-1894986606),H=h(H,B,x,S,v[Q+10],15,-1051523),S=h(S,H,B,x,v[Q+1],21,-2054922799),x=h(x,S,H,B,v[Q+8],6,1873313359),B=h(B,x,S,H,v[Q+15],10,-30611744),H=h(H,B,x,S,v[Q+6],15,-1560198380),S=h(S,H,B,x,v[Q+13],21,1309151649),x=h(x,S,H,B,v[Q+4],6,-145523070),B=h(B,x,S,H,v[Q+11],10,-1120210379),H=h(H,B,x,S,v[Q+2],15,718787259),S=h(S,H,B,x,v[Q+9],21,-343485551),x=b(x,z),S=b(S,K),H=b(H,J),B=b(B,U)}return Array(x,S,H,B)}function M(v,I,x,S,H,B){return b(p(b(b(I,v),b(S,B)),H),x)}function D(v,I,x,S,H,B,Q){return M(I&x|~I&S,v,I,H,B,Q)}function E(v,I,x,S,H,B,Q){return M(I&S|x&~S,v,I,H,B,Q)}function g(v,I,x,S,H,B,Q){return M(I^x^S,v,I,H,B,Q)}function h(v,I,x,S,H,B,Q){return M(x^(I|~S),v,I,H,B,Q)}function b(v,I){var x=(v&65535)+(I&65535),S=(v>>16)+(I>>16)+(x>>16);return S<<16|x&65535}function p(v,I){return v<<I|v>>>32-I}G.exports=function(I){return y.hash(I,F,16)}},{"./helpers":285}],287:[function(l,G,N){"use strict";var y=l("./helpers");function d(g,h){g[h>>5]|=128<<24-h%32,g[(h+64>>9<<4)+15]=h;for(var b=Array(80),p=1732584193,v=-271733879,I=-1732584194,x=271733878,S=-1009589776,H=0;H<g.length;H+=16){for(var B=p,Q=v,z=I,K=x,J=S,U=0;U<80;U++){U<16?b[U]=g[H+U]:b[U]=E(b[U-3]^b[U-8]^b[U-14]^b[U-16],1);var j=D(D(E(p,5),F(U,v,I,x)),D(D(S,b[U]),M(U)));S=x,x=I,I=E(v,30),v=p,p=j}p=D(p,B),v=D(v,Q),I=D(I,z),x=D(x,K),S=D(S,J)}return Array(p,v,I,x,S)}function F(g,h,b,p){return g<20?h&b|~h&p:g<40?h^b^p:g<60?h&b|h&p|b&p:h^b^p}function M(g){return g<20?1518500249:g<40?1859775393:g<60?-1894007588:-899497514}function D(g,h){var b=(g&65535)+(h&65535),p=(g>>16)+(h>>16)+(b>>16);return p<<16|b&65535}function E(g,h){return g<<h|g>>>32-h}G.exports=function(h){return y.hash(h,d,20,!0)}},{"./helpers":285}],288:[function(l,G,N){"use strict";G.exports=function(){return function(){}}},{}],289:[function(l,G,N){(function(y){"use strict";var d=l("babel-runtime/helpers/typeof"),F=M(d);function M(p){return p&&p.__esModule?p:{default:p}}var D=l("stream"),E=D.Stream,g=l("../lib/common/utils/isArray"),h=g.isArray;G.exports.string=function(v){return typeof v=="string"},G.exports.array=h,G.exports.buffer=y.isBuffer;function b(p){return p instanceof E}G.exports.writableStream=function(v){return b(v)&&typeof v._write=="function"&&(0,F.default)(v._writableState)==="object"}}).call(this,{isBuffer:l("../node_modules/is-buffer/index.js")})},{"../lib/common/utils/isArray":42,"../node_modules/is-buffer/index.js":197,"babel-runtime/helpers/typeof":67,stream:230}],290:[function(l,G,N){"use strict";N.encodeURIComponent=function(y){try{return encodeURIComponent(y)}catch(d){return y}},N.escape=l("escape-html"),N.timestamp=function(d){if(d){var F=d;return typeof F=="string"&&(F=Number(F)),String(d).length===10&&(F*=1e3),new Date(F)}return Math.round(Date.now()/1e3)}},{"escape-html":191}],291:[function(l,G,N){(function(y,d){"use strict";var F=l("babel-runtime/core-js/json/stringify"),M=g(F),D=l("babel-runtime/helpers/typeof"),E=g(D);function g(U){return U&&U.__esModule?U:{default:U}}var h=l("util"),b=l("url"),p=l("http"),v=l("https"),I=l("debug")("urllib"),x=l("humanize-ms"),S,H=0,B=Math.pow(2,31)-10,Q=/^https?:\/\//i;function z(U,j){return U===void 0?j:U}function K(U,j){return function(T,te,Z){if(T)return j(T);U({data:te,status:Z.statusCode,headers:Z.headers,res:Z})}}N.TIMEOUTS=[x("300s"),x("300s")];var J=["json","text"];N.request=function(j,T,te){return arguments.length===2&&typeof T=="function"&&(te=T,T=null),typeof te=="function"?N.requestWithCallback(j,T,te):(S||(S=l("any-promise")),new S(function(Z,_){N.requestWithCallback(j,T,K(Z,_))}))},N.requestWithCallback=function(j,T,te){if(!j||typeof j!="string"&&(typeof j=="undefined"?"undefined":(0,E.default)(j))!=="object"){var Z=h.format("expect request url to be a string or a http request options, but got %j",j);throw new Error(Z)}arguments.length===2&&typeof T=="function"&&(te=T,T=null),T=T||{},H>=B&&(H=0);var _=++H;T.requestUrls=T.requestUrls||[];var Y={requestId:_,url:j,args:T,ctx:T.ctx};T.emitter&&T.emitter.emit("request",Y),T.timeout=T.timeout||N.TIMEOUTS,T.maxRedirects=T.maxRedirects||10,T.streaming=T.streaming||T.customResponse;var re=Date.now(),pe;typeof j=="string"?(Q.test(j)||(j="http://"+j),pe=b.parse(j)):pe=j;var le=(T.type||T.method||pe.method||"GET").toUpperCase(),_e=pe.port||80,me=p,ke=z(T.agent,N.agent),$=T.fixJSONCtlChars;pe.protocol==="https:"&&(me=v,ke=z(T.httpsAgent,N.httpsAgent),pe.port||(_e=443));var ne={host:pe.hostname||pe.host||"localhost",path:pe.path||"/",method:le,port:_e,agent:ke,headers:T.headers||{},lookup:T.lookup};Array.isArray(T.timeout)?ne.requestTimeout=T.timeout[T.timeout.length-1]:typeof T.timeout!="undefined"&&(ne.requestTimeout=T.timeout);for(var W=["pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","secureProtocol","secureOptions"],ie=0;ie<W.length;ie++){var de=W[ie];T.hasOwnProperty(de)&&(ne[de]=T[de])}ne.rejectUnauthorized===!1&&!ne.hasOwnProperty("secureOptions")&&(ne.secureOptions=l("constants").SSL_OP_NO_TLSv1_2);var ee=T.auth||pe.auth;ee&&(ne.auth=ee);var Ce=T.content||T.data,De=le==="GET"||le==="HEAD"||T.dataAsQueryString;if(!T.content&&(Ce&&!(typeof Ce=="string"||d.isBuffer(Ce))))if(De)Ce=T.nestedQuerystring?qs.stringify(Ce):querystring.stringify(Ce);else{var Le=ne.headers["Content-Type"]||ne.headers["content-type"];Le||(T.contentType==="json"?Le="application/json":Le="application/x-www-form-urlencoded",ne.headers["Content-Type"]=Le),parseContentType(Le).type==="application/json"?Ce=(0,M.default)(Ce):Ce=T.nestedQuerystring?qs.stringify(Ce):querystring.stringify(Ce)}De&&Ce&&(ne.path+=(pe.query?"&":"?")+Ce,Ce=null);var Ye=0;if(Ce){var et=Ce.length;d.isBuffer(Ce)||(et=d.byteLength(Ce)),Ye=ne.headers["Content-Length"]=et}T.dataType==="json"&&(ne.headers.Accept="application/json"),typeof T.beforeRequest=="function"&&T.beforeRequest(ne);var Ae=null,ct=null,$e=null,Fe=!1,Pe=!1,He=0,ot=-1,ye=!1,be="",Ke="",q=null;T.timing&&(q={queuing:0,dnslookup:0,connected:0,requestSent:0,waiting:0,contentDownload:0});function m(){Ae&&(clearTimeout(Ae),Ae=null)}function c(){ct&&(clearTimeout(ct),ct=null)}function R(at,Bt,mr){if(c(),!te){console.warn("[urllib:warn] [%s] [%s] [worker:%s] %s %s callback twice!!!",Date(),_,y.pid,ne.method,j),at&&console.warn(`[urllib:warn] [%s] [%s] [worker:%s] %s: %s
stack: %s`,Date(),_,y.pid,at.name,at.message,at.stack);return}var rr=te;te=null;var Sr={};if(mr&&(ot=mr.statusCode,Sr=mr.headers),ot===401&&Sr["www-authenticate"]&&(!T.headers||!T.headers.Authorization)&&T.digestAuth){var Fr=Sr["www-authenticate"];if(Fr.indexOf("Digest ")>=0)return I("Request#%d %s: got digest auth header WWW-Authenticate: %s",_,j,Fr),T.headers=T.headers||{},T.headers.Authorization=digestAuthHeader(ne.method,ne.path,Fr,T.digestAuth),I("Request#%d %s: auth with digest header: %s",_,j,T.headers.Authorization),mr.headers["set-cookie"]&&(T.headers.Cookie=mr.headers["set-cookie"].join(";")),N.requestWithCallback(j,T,rr)}var Nr=Date.now()-re;q&&(q.contentDownload=Nr),I("[%sms] done, %s bytes HTTP %s %s %s %s, keepAliveSocket: %s, timing: %j",Nr,He,ot,ne.method,ne.host,ne.path,Pe,q);var Ar={status:ot,statusCode:ot,headers:Sr,size:He,aborted:ye,rt:Nr,keepAliveSocket:Pe,data:Bt,requestUrls:T.requestUrls,timing:q,remoteAddress:be,remotePort:Ke};if(at){var tt="";ke&&typeof ke.getCurrentStatus=="function"&&(tt=", agent status: "+(0,M.default)(ke.getCurrentStatus())),at.message+=", "+ne.method+" "+j+" "+ot+" (connected: "+Fe+", keepalive socket: "+Pe+tt+`)
headers: `+(0,M.default)(Sr),at.data=Bt,at.path=ne.path,at.status=ot,at.headers=Sr,at.res=Ar}rr(at,Bt,T.streaming?mr:Ar),T.emitter&&(Y.url=j,Y.socket=Et&&Et.connection,Y.options=ne,Y.size=Ye,T.emitter.emit("response",{requestId:_,error:at,ctx:T.ctx,req:Y,res:Ar}))}function fe(at){var Bt=null;if(T.followRedirect&&statuses.redirect[at.statusCode]){T._followRedirectCount=(T._followRedirectCount||0)+1;var mr=at.headers.location;if(!mr)Bt=new Error("Got statusCode "+at.statusCode+" but cannot resolve next location from headers"),Bt.name="FollowRedirectError";else if(T._followRedirectCount>T.maxRedirects)Bt=new Error("Exceeded maxRedirects. Probably stuck in a redirect loop "+j),Bt.name="MaxRedirectError";else{var rr=T.formatRedirectUrl?T.formatRedirectUrl(j,mr):b.resolve(j,mr);I("Request#%d %s: `redirected` from %s to %s",_,ne.path,j,rr),c(),T.headers&&T.headers.Host&&Q.test(mr)&&(T.headers.Host=null);var Sr=te;return te=null,N.requestWithCallback(rr,T,Sr),{redirect:!0,error:null}}}return{redirect:!1,error:Bt}}!ne.headers["User-Agent"]&&!ne.headers["user-agent"]&&(ne.headers["User-Agent"]=navigator.userAgent),T.gzip&&(!ne.headers["Accept-Encoding"]&&!ne.headers["accept-encoding"]&&(ne.headers["Accept-Encoding"]="gzip"));function ve(at,Bt,mr){var rr=at.headers["content-encoding"];return mr(null,Bt,rr)}var Re=T.writeStream;I("Request#%d %s %s with headers %j, options.path: %s",_,le,j,ne.headers,ne.path),T.requestUrls.push(j);function qe(at){if(q&&(q.waiting=Date.now()-re),I("Request#%d %s `req response` event emit: status %d, headers: %j",_,j,at.statusCode,at.headers),T.streaming){var Bt=fe(at);if(Bt.redirect){at.resume();return}return Bt.error?(at.resume(),R(Bt.error,null,at)):R(null,null,at)}if(at.on("close",function(){I("Request#%d %s: `res close` event emit, total size %d",_,j,He)}),at.on("error",function(){I("Request#%d %s: `res error` event emit, total size %d",_,j,He)}),at.on("aborted",function(){ye=!0,I("Request#%d %s: `res aborted` event emit, total size %d",_,j,He)}),Re){var Bt=fe(at);if(Bt.redirect){at.resume();return}return Bt.error?(at.resume(),Re.end(),R(Bt.error,null,at)):(T.consumeWriteStream===!1?at.on("end",R.bind(null,null,null,at)):isNode010||isNode012?first([[Re,"close"],[at,"aborted"]],function(Sr,Fr,Nr){I("Request#%d %s: writeStream or res %s event emitted",_,j,Nr),R($e||null,null,at)}):Re.on("close",function(){I("Request#%d %s: writeStream close event emitted",_,j),R($e||null,null,at)}),at.pipe(Re))}var mr=[];at.on("data",function(rr){I("Request#%d %s: `res data` event emit, size %d",_,j,rr.length),He+=rr.length,mr.push(rr)}),at.on("end",function(){var rr=d.concat(mr,He);if(I("Request#%d %s: `res end` event emit, total size %d, _dumped: %s",_,j,He,at._dumped),$e)return R($e,rr,at);var Sr=fe(at);if(Sr.error)return R(Sr.error,rr,at);if(Sr.redirect)return;ve(at,rr,function(Fr,Nr,Ar){if(Fr)return R(Fr,rr,at);if(!Ar&&J.indexOf(T.dataType)>=0){try{Nr=decodeBodyByCharset(Nr,at)}catch(Xn){return I("decodeBodyByCharset error: %s",Xn),R(null,Nr,at)}if(T.dataType==="json")if(He===0)Nr=null;else{var tt=parseJSON(Nr,$);tt.error?Fr=tt.error:Nr=tt.data}}ye&&I("Request#%d %s: Remote socket was terminated before `response.end()` was called",_,j),R(Fr,Nr,at)})})}var nt,st;Array.isArray(T.timeout)?(nt=x(T.timeout[0]),st=x(T.timeout[1])):nt=st=x(T.timeout),I("ConnectTimeout: %d, ResponseTimeout: %d",nt,st);function bt(){I("Connect timer ticking, timeout: %d",nt),Ae=setTimeout(function(){Ae=null,ot===-1&&(ot=-2);var at="Connect timeout for "+nt+"ms",Bt="ConnectionTimeoutError";Et.socket||(Bt="SocketAssignTimeoutError",at+=", working sockets is full"),$e=new Error(at),$e.name=Bt,$e.requestId=_,I("ConnectTimeout: Request#%d %s %s: %s, connected: %s",_,j,$e.name,at,Fe),It()},nt)}function dt(){I("Response timer ticking, timeout: %d",st),ct=setTimeout(function(){ct=null;var at="Response timeout for "+st+"ms",Bt="ResponseTimeoutError";$e=new Error(at),$e.name=Bt,$e.requestId=_,I("ResponseTimeout: Request#%d %s %s: %s, connected: %s",_,j,$e.name,at,Fe),It()},st)}var Et;ne.mode=T.mode?T.mode:"";try{Et=me.request(ne,qe)}catch(at){return R(at)}typeof window=="undefined"?bt():Et.on("requestTimeout",function(){ot===-1&&(ot=-2);var at="Connect timeout for "+nt+"ms",Bt="ConnectionTimeoutError";$e=new Error(at),$e.name=Bt,$e.requestId=_,It()});function It(){I("Request#%d %s abort, connected: %s",_,j,Fe),Et.socket||($e.noSocket=!0,R($e)),Et.abort()}return q&&Et.on("finish",function(){q.requestSent=Date.now()-re}),Et.once("socket",function(at){q&&(q.queuing=Date.now()-re),isNode010&&at.socket&&(at=at.socket);var Bt=at.readyState;if(Bt==="opening"){at.once("lookup",function(mr,rr,Sr){I("Request#%d %s lookup: %s, %s, %s",_,j,mr,rr,Sr),q&&(q.dnslookup=Date.now()-re),rr&&(be=rr)}),at.once("connect",function(){q&&(q.connected=Date.now()-re),m(),dt(),I("Request#%d %s new socket connected",_,j),Fe=!0,be||(be=at.remoteAddress),Ke=at.remotePort});return}I("Request#%d %s reuse socket connected, readyState: %s",_,j,Bt),Fe=!0,Pe=!0,be||(be=at.remoteAddress),Ke=at.remotePort,m(),dt()}),Et.on("error",function(at){(at.name==="Error"||at.name==="TypeError")&&(at.name=Fe?"ResponseError":"RequestError"),at.message+=' (req "error")',I("Request#%d %s `req error` event emit, %s: %s",_,j,at.name,at.message),R($e||at)}),Re&&Re.once("error",function(at){at.message+=' (writeStream "error")',$e=at,I("Request#%d %s `writeStream error` event emit, %s: %s",_,j,at.name,at.message),It()}),T.stream?(T.stream.pipe(Et),T.stream.once("error",function(at){at.message+=' (stream "error")',$e=at,I("Request#%d %s `readStream error` event emit, %s: %s",_,j,at.name,at.message),It()})):Et.end(Ce),Et.requestId=_,Et}}).call(this,l("_process"),l("buffer").Buffer)},{_process:208,"any-promise":49,"babel-runtime/core-js/json/stringify":53,"babel-runtime/helpers/typeof":67,buffer:73,constants:75,debug:288,http:231,https:193,"humanize-ms":194,url:238,util:243}]},{},[1])(1)})}).call(this,__webpack_require__("IyRk"))},oRuE:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.pad.Iso10126={pad:function(d,F){var M=F*4,D=M-d.sigBytes%M;d.concat(y.lib.WordArray.random(D-1)).concat(y.lib.WordArray.create([D<<24],1))},unpad:function(d){var F=d.words[d.sigBytes-1>>>2]&255;d.sigBytes-=F}},y.pad.Iso10126})},oX8U:function(l,G,N){"use strict";(function(y){N.d(G,"a",function(){return M});var d=N("mrSG"),F=N("rOjP");function M(){var D=y.Canvas||y.HTMLCanvasElement,E=y.Image||y.HTMLImageElement,g=function(){if(D)return new D;throw new Error("createCanvasElement - missing Canvas implementation for nodejs environment")},h=function(){if(E)return new E;throw new Error("createImageElement - missing Image implementation for nodejs environment")},b=y.fetch||function(){throw new Error("fetch - missing fetch implementation for nodejs environment")},p=Object(F.a)();return Object(d.a)({Canvas:D||function(){function v(){}return v}(),CanvasRenderingContext2D:y.CanvasRenderingContext2D||function(){function v(){}return v}(),Image:E||function(){function v(){}return v}(),ImageData:y.ImageData||function(){function v(){}return v}(),Video:y.HTMLVideoElement||function(){function v(){}return v}(),createCanvasElement:g,createImageElement:h,fetch:b},p)}}).call(this,N("IyRk"))},pA7S:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("ETIr"),N("cv67"),N("K3mO"),N("OLod"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.WordArray,D=F.BlockCipher,E=d.algo,g=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],h=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],b=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],p=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],v=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],I=E.DES=D.extend({_doReset:function(){for(var B=this._key,Q=B.words,z=[],K=0;K<56;K++){var J=g[K]-1;z[K]=Q[J>>>5]>>>31-J%32&1}for(var U=this._subKeys=[],j=0;j<16;j++){for(var T=U[j]=[],te=b[j],K=0;K<24;K++)T[K/6|0]|=z[(h[K]-1+te)%28]<<31-K%6,T[4+(K/6|0)]|=z[28+(h[K+24]-1+te)%28]<<31-K%6;T[0]=T[0]<<1|T[0]>>>31;for(var K=1;K<7;K++)T[K]=T[K]>>>(K-1)*4+3;T[7]=T[7]<<5|T[7]>>>27}for(var Z=this._invSubKeys=[],K=0;K<16;K++)Z[K]=U[15-K]},encryptBlock:function(B,Q){this._doCryptBlock(B,Q,this._subKeys)},decryptBlock:function(B,Q){this._doCryptBlock(B,Q,this._invSubKeys)},_doCryptBlock:function(B,Q,z){this._lBlock=B[Q],this._rBlock=B[Q+1],x.call(this,4,252645135),x.call(this,16,65535),S.call(this,2,858993459),S.call(this,8,16711935),x.call(this,1,1431655765);for(var K=0;K<16;K++){for(var J=z[K],U=this._lBlock,j=this._rBlock,T=0,te=0;te<8;te++)T|=p[te][((j^J[te])&v[te])>>>0];this._lBlock=j,this._rBlock=U^T}var Z=this._lBlock;this._lBlock=this._rBlock,this._rBlock=Z,x.call(this,1,1431655765),S.call(this,8,16711935),S.call(this,2,858993459),x.call(this,16,65535),x.call(this,4,252645135),B[Q]=this._lBlock,B[Q+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function x(B,Q){var z=(this._lBlock>>>B^this._rBlock)&Q;this._rBlock^=z,this._lBlock^=z<<B}function S(B,Q){var z=(this._rBlock>>>B^this._lBlock)&Q;this._lBlock^=z,this._rBlock^=z<<B}d.DES=D._createHelper(I);var H=E.TripleDES=D.extend({_doReset:function(){var B=this._key,Q=B.words;if(Q.length!==2&&Q.length!==4&&Q.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var z=Q.slice(0,2),K=Q.length<4?Q.slice(0,2):Q.slice(2,4),J=Q.length<6?Q.slice(0,2):Q.slice(4,6);this._des1=I.createEncryptor(M.create(z)),this._des2=I.createEncryptor(M.create(K)),this._des3=I.createEncryptor(M.create(J))},encryptBlock:function(B,Q){this._des1.encryptBlock(B,Q),this._des2.decryptBlock(B,Q),this._des3.encryptBlock(B,Q)},decryptBlock:function(B,Q){this._des3.decryptBlock(B,Q),this._des2.encryptBlock(B,Q),this._des1.decryptBlock(B,Q)},keySize:192/32,ivSize:64/32,blockSize:64/32});d.TripleDES=D._createHelper(H)}(),y.TripleDES})},qBft:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.pad.AnsiX923={pad:function(d,F){var M=d.sigBytes,D=F*4,E=D-M%D,g=M+E-1;d.clamp(),d.words[g>>>2]|=E<<24-g%4*8,d.sigBytes+=E},unpad:function(d){var F=d.words[d.sigBytes-1>>>2]&255;d.sigBytes-=F}},y.pad.Ansix923})},qM6L:function(l,G,N){(function(y,d){l.exports=G=d(N("Ib8C"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.WordArray,D=d.enc,E=D.Utf16=D.Utf16BE={stringify:function(h){for(var b=h.words,p=h.sigBytes,v=[],I=0;I<p;I+=2){var x=b[I>>>2]>>>16-I%4*8&65535;v.push(String.fromCharCode(x))}return v.join("")},parse:function(h){for(var b=h.length,p=[],v=0;v<b;v++)p[v>>>1]|=h.charCodeAt(v)<<16-v%2*16;return M.create(p,b*2)}};D.Utf16LE={stringify:function(h){for(var b=h.words,p=h.sigBytes,v=[],I=0;I<p;I+=2){var x=g(b[I>>>2]>>>16-I%4*8&65535);v.push(String.fromCharCode(x))}return v.join("")},parse:function(h){for(var b=h.length,p=[],v=0;v<b;v++)p[v>>>1]|=g(h.charCodeAt(v)<<16-v%2*16);return M.create(p,b*2)}};function g(h){return h<<8&4278255360|h>>>8&16711935}}(),y.enc.Utf16})},qu8F:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("OLod"))})(this,function(y){/** @preserve
* Counter block mode compatible with Dr Brian Gladman fileenc.c
* derived from CryptoJS.mode.CTR
* Jan Hruby jhruby.web@gmail.com
*/return y.mode.CTRGladman=function(){var d=y.lib.BlockCipherMode.extend();function F(E){if((E>>24&255)===255){var g=E>>16&255,h=E>>8&255,b=E&255;g===255?(g=0,h===255?(h=0,b===255?b=0:++b):++h):++g,E=0,E+=g<<16,E+=h<<8,E+=b}else E+=1<<24;return E}function M(E){return(E[0]=F(E[0]))===0&&(E[1]=F(E[1])),E}var D=d.Encryptor=d.extend({processBlock:function(E,g){var h=this._cipher,b=h.blockSize,p=this._iv,v=this._counter;p&&(v=this._counter=p.slice(0),this._iv=void 0),M(v);var I=v.slice(0);h.encryptBlock(I,0);for(var x=0;x<b;x++)E[g+x]^=I[x]}});return d.Decryptor=D,d}(),y.mode.CTRGladman})},rOjP:function(l,G,N){"use strict";N.d(G,"a",function(){return y});function y(d){var F="";if(!d)try{d=N("Og1z")}catch(D){F=D.toString()}var M=d?function(D){return new Promise(function(E,g){d.readFile(D,function(h,b){return h?g(h):E(b)})})}:function(){throw new Error("readFile - failed to require fs in nodejs environment with error: "+F)};return{readFile:M}}},uGsb:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("MlIO"),N("1uat"))})(this,function(y){return function(){var d=y,F=d.x64,M=F.Word,D=F.WordArray,E=d.algo,g=E.SHA512,h=E.SHA384=g.extend({_doReset:function(){this._hash=new D.init([new M.init(3418070365,3238371032),new M.init(1654270250,914150663),new M.init(2438529370,812702999),new M.init(355462360,4144912697),new M.init(1731405415,4290775857),new M.init(2394180231,1750603025),new M.init(3675008525,1694076839),new M.init(1203062813,3204075428)])},_doFinalize:function(){var b=g._doFinalize.call(this);return b.sigBytes-=16,b}});d.SHA384=g._createHelper(h),d.HmacSHA384=g._createHmacHelper(h)}(),y.SHA384})},uGxW:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.pad.NoPadding={pad:function(){},unpad:function(){}},y.pad.NoPadding})},w7YG:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("ETIr"),N("cv67"),N("K3mO"),N("OLod"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.StreamCipher,D=d.algo,E=D.RC4=M.extend({_doReset:function(){for(var b=this._key,p=b.words,v=b.sigBytes,I=this._S=[],x=0;x<256;x++)I[x]=x;for(var x=0,S=0;x<256;x++){var H=x%v,B=p[H>>>2]>>>24-H%4*8&255;S=(S+I[x]+B)%256;var Q=I[x];I[x]=I[S],I[S]=Q}this._i=this._j=0},_doProcessBlock:function(b,p){b[p]^=g.call(this)},keySize:256/32,ivSize:0});function g(){for(var b=this._S,p=this._i,v=this._j,I=0,x=0;x<4;x++){p=(p+1)%256,v=(v+b[p])%256;var S=b[p];b[p]=b[v],b[v]=S,I|=b[(b[p]+b[v])%256]<<24-x*8}return this._i=p,this._j=v,I}d.RC4=M._createHelper(E);var h=D.RC4Drop=E.extend({cfg:E.cfg.extend({drop:192}),_doReset:function(){E._doReset.call(this);for(var b=this.cfg.drop;b>0;b--)g.call(this)}});d.RC4Drop=M._createHelper(h)}(),y.RC4})},wZgz:function(l,G,N){(function(y,d,F){l.exports=G=d(N("Ib8C"),N("ETIr"),N("cv67"),N("K3mO"),N("OLod"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.BlockCipher,D=d.algo,E=[],g=[],h=[],b=[],p=[],v=[],I=[],x=[],S=[],H=[];(function(){for(var z=[],K=0;K<256;K++)K<128?z[K]=K<<1:z[K]=K<<1^283;for(var J=0,U=0,K=0;K<256;K++){var j=U^U<<1^U<<2^U<<3^U<<4;j=j>>>8^j&255^99,E[J]=j,g[j]=J;var T=z[J],te=z[T],Z=z[te],_=z[j]*257^j*16843008;h[J]=_<<24|_>>>8,b[J]=_<<16|_>>>16,p[J]=_<<8|_>>>24,v[J]=_;var _=Z*16843009^te*65537^T*257^J*16843008;I[j]=_<<24|_>>>8,x[j]=_<<16|_>>>16,S[j]=_<<8|_>>>24,H[j]=_,J?(J=T^z[z[z[Z^T]]],U^=z[z[U]]):J=U=1}})();var B=[0,1,2,4,8,16,32,64,128,27,54],Q=D.AES=M.extend({_doReset:function(){var z;if(this._nRounds&&this._keyPriorReset===this._key)return;for(var K=this._keyPriorReset=this._key,J=K.words,U=K.sigBytes/4,j=this._nRounds=U+6,T=(j+1)*4,te=this._keySchedule=[],Z=0;Z<T;Z++)Z<U?te[Z]=J[Z]:(z=te[Z-1],Z%U?U>6&&Z%U==4&&(z=E[z>>>24]<<24|E[z>>>16&255]<<16|E[z>>>8&255]<<8|E[z&255]):(z=z<<8|z>>>24,z=E[z>>>24]<<24|E[z>>>16&255]<<16|E[z>>>8&255]<<8|E[z&255],z^=B[Z/U|0]<<24),te[Z]=te[Z-U]^z);for(var _=this._invKeySchedule=[],Y=0;Y<T;Y++){var Z=T-Y;if(Y%4)var z=te[Z];else var z=te[Z-4];Y<4||Z<=4?_[Y]=z:_[Y]=I[E[z>>>24]]^x[E[z>>>16&255]]^S[E[z>>>8&255]]^H[E[z&255]]}},encryptBlock:function(z,K){this._doCryptBlock(z,K,this._keySchedule,h,b,p,v,E)},decryptBlock:function(z,K){var J=z[K+1];z[K+1]=z[K+3],z[K+3]=J,this._doCryptBlock(z,K,this._invKeySchedule,I,x,S,H,g);var J=z[K+1];z[K+1]=z[K+3],z[K+3]=J},_doCryptBlock:function(z,K,J,U,j,T,te,Z){for(var _=this._nRounds,Y=z[K]^J[0],re=z[K+1]^J[1],pe=z[K+2]^J[2],le=z[K+3]^J[3],_e=4,me=1;me<_;me++){var ke=U[Y>>>24]^j[re>>>16&255]^T[pe>>>8&255]^te[le&255]^J[_e++],$=U[re>>>24]^j[pe>>>16&255]^T[le>>>8&255]^te[Y&255]^J[_e++],ne=U[pe>>>24]^j[le>>>16&255]^T[Y>>>8&255]^te[re&255]^J[_e++],W=U[le>>>24]^j[Y>>>16&255]^T[re>>>8&255]^te[pe&255]^J[_e++];Y=ke,re=$,pe=ne,le=W}var ke=(Z[Y>>>24]<<24|Z[re>>>16&255]<<16|Z[pe>>>8&255]<<8|Z[le&255])^J[_e++],$=(Z[re>>>24]<<24|Z[pe>>>16&255]<<16|Z[le>>>8&255]<<8|Z[Y&255])^J[_e++],ne=(Z[pe>>>24]<<24|Z[le>>>16&255]<<16|Z[Y>>>8&255]<<8|Z[re&255])^J[_e++],W=(Z[le>>>24]<<24|Z[Y>>>16&255]<<16|Z[re>>>8&255]<<8|Z[pe&255])^J[_e++];z[K]=ke,z[K+1]=$,z[K+2]=ne,z[K+3]=W},keySize:256/32});d.AES=M._createHelper(Q)}(),y.AES})},wbyO:function(l,G,N){(function(y,d){l.exports=G=d(N("Ib8C"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.WordArray,D=d.enc,E=D.Base64url={stringify:function(h,b=!0){var p=h.words,v=h.sigBytes,I=b?this._safe_map:this._map;h.clamp();for(var x=[],S=0;S<v;S+=3)for(var H=p[S>>>2]>>>24-S%4*8&255,B=p[S+1>>>2]>>>24-(S+1)%4*8&255,Q=p[S+2>>>2]>>>24-(S+2)%4*8&255,z=H<<16|B<<8|Q,K=0;K<4&&S+K*.75<v;K++)x.push(I.charAt(z>>>6*(3-K)&63));var J=I.charAt(64);if(J)for(;x.length%4;)x.push(J);return x.join("")},parse:function(h,b=!0){var p=h.length,v=b?this._safe_map:this._map,I=this._reverseMap;if(!I){I=this._reverseMap=[];for(var x=0;x<v.length;x++)I[v.charCodeAt(x)]=x}var S=v.charAt(64);if(S){var H=h.indexOf(S);H!==-1&&(p=H)}return g(h,p,I)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function g(h,b,p){for(var v=[],I=0,x=0;x<b;x++)if(x%4){var S=p[h.charCodeAt(x-1)]<<x%4*2,H=p[h.charCodeAt(x)]>>>6-x%4*2,B=S|H;v[I>>>2]|=B<<24-I%4*8,I++}return M.create(v,I)}}(),y.enc.Base64url})},yPBj:function(l,G,N){l.exports={flex_box_center:"flex_box_center___3-ehW",flex_space_between:"flex_space_between___1gePc",flex_box_vertical_center:"flex_box_vertical_center___2IxJA",flex_box_center_end:"flex_box_center_end___2Bh1H",flex_box_column:"flex_box_column___35awp",bg:"bg___CQ173",steps:"steps___upu0k",qrcode:"qrcode___25DP3"}}}]);