|
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[61],{"1uat":function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("MlIO"))})(this,function(y){return function(){var l=y,M=l.lib,D=M.Hasher,A=l.x64,x=A.Word,v=A.WordArray,h=l.algo;function p(){return x.create.apply(x,arguments)}var c=[p(1116352408,3609767458),p(1899447441,602891725),p(3049323471,3964484399),p(3921009573,2173295548),p(961987163,4081628472),p(1508970993,3053834265),p(2453635748,2937671579),p(2870763221,3664609560),p(3624381080,2734883394),p(310598401,1164996542),p(607225278,1323610764),p(1426881987,3590304994),p(1925078388,4068182383),p(2162078206,991336113),p(2614888103,633803317),p(3248222580,3479774868),p(3835390401,2666613458),p(4022224774,944711139),p(264347078,2341262773),p(604807628,2007800933),p(770255983,1495990901),p(1249150122,1856431235),p(1555081692,3175218132),p(1996064986,2198950837),p(2554220882,3999719339),p(2821834349,766784016),p(2952996808,2566594879),p(3210313671,3203337956),p(3336571891,1034457026),p(3584528711,2466948901),p(113926993,3758326383),p(338241895,168717936),p(666307205,1188179964),p(773529912,1546045734),p(1294757372,1522805485),p(1396182291,2643833823),p(1695183700,2343527390),p(1986661051,1014477480),p(2177026350,1206759142),p(2456956037,344077627),p(2730485921,1290863460),p(2820302411,3158454273),p(3259730800,3505952657),p(3345764771,106217008),p(3516065817,3606008344),p(3600352804,1432725776),p(4094571909,1467031594),p(275423344,851169720),p(430227734,3100823752),p(506948616,1363258195),p(659060556,3750685593),p(883997877,3785050280),p(958139571,3318307427),p(1322822218,3812723403),p(1537002063,2003034995),p(1747873779,3602036899),p(1955562222,1575990012),p(2024104815,1125592928),p(2227730452,2716904306),p(2361852424,442776044),p(2428436474,593698344),p(2756734187,3733110249),p(3204031479,2999351573),p(3329325298,3815920427),p(3391569614,3928383900),p(3515267271,566280711),p(3940187606,3454069534),p(4118630271,4000239992),p(116418474,1914138554),p(174292421,2731055270),p(289380356,3203993006),p(460393269,320620315),p(685471733,587496836),p(852142971,1086792851),p(1017036298,365543100),p(1126000580,2618297676),p(1288033470,3409855158),p(1501505948,4234509866),p(1607167915,987167468),p(1816402316,1246189591)],m=[];(function(){for(var g=0;g<80;g++)m[g]=p()})();var C=h.SHA512=D.extend({_doReset:function(){this._hash=new v.init([new x.init(1779033703,4089235720),new x.init(3144134277,2227873595),new x.init(1013904242,4271175723),new x.init(2773480762,1595750129),new x.init(1359893119,2917565137),new x.init(2600822924,725511199),new x.init(528734635,4215389547),new x.init(1541459225,327033209)])},_doProcessBlock:function(g,T){for(var B=this._hash.words,F=B[0],J=B[1],H=B[2],K=B[3],Y=B[4],W=B[5],U=B[6],_=B[7],te=F.high,q=F.low,w=J.high,X=J.low,ne=H.high,he=H.low,le=K.high,_e=K.low,se=Y.high,be=Y.low,j=W.high,Q=W.low,L=U.high,re=U.low,de=_.high,ee=_.low,xe=te,Ne=q,Le=w,Ge=X,Qe=ne,Te=he,nt=le,Ye=_e,Pe=se,ke=be,Be=j,ot=Q,ve=L,ge=re,$e=de,pe=ee,Z=0;Z<80;Z++){var k,$,Re=m[Z];if(Z<16)$=Re.high=g[T+Z*2]|0,k=Re.low=g[T+Z*2+1]|0;else{var Ae=m[Z-15],Xe=Ae.high,rt=Ae.low,lt=(Xe>>>1|rt<<31)^(Xe>>>8|rt<<24)^Xe>>>7,bt=(rt>>>1|Xe<<31)^(rt>>>8|Xe<<24)^(rt>>>7|Xe<<25),Tt=m[Z-2],xt=Tt.high,Et=Tt.low,Nt=(xt>>>19|Et<<13)^(xt<<3|Et>>>29)^xt>>>6,at=(Et>>>19|xt<<13)^(Et<<3|xt>>>29)^(Et>>>6|xt<<26),Bt=m[Z-7],mr=Bt.high,rr=Bt.low,Sr=m[Z-16],Lr=Sr.high,Dr=Sr.low;k=bt+rr,$=lt+mr+(k>>>0<bt>>>0?1:0),k=k+at,$=$+Nt+(k>>>0<at>>>0?1:0),k=k+Dr,$=$+Lr+(k>>>0<Dr>>>0?1:0),Re.high=$,Re.low=k}var Ar=Pe&Be^~Pe&ve,et=ke&ot^~ke&ge,Xn=xe&Le^xe&Qe^Le&Qe,Nr=Ne&Ge^Ne&Te^Ge&Te,No=(xe>>>28|Ne<<4)^(xe<<30|Ne>>>2)^(xe<<25|Ne>>>7),Kn=(Ne>>>28|xe<<4)^(Ne<<30|xe>>>2)^(Ne<<25|xe>>>7),co=(Pe>>>14|ke<<18)^(Pe>>>18|ke<<14)^(Pe<<23|ke>>>9),Cr=(ke>>>14|Pe<<18)^(ke>>>18|Pe<<14)^(ke<<23|Pe>>>9),lo=c[Z],_n=lo.high,fo=lo.low,nr=pe+Cr,hr=$e+co+(nr>>>0<pe>>>0?1:0),nr=nr+et,hr=hr+Ar+(nr>>>0<et>>>0?1:0),nr=nr+fo,hr=hr+_n+(nr>>>0<fo>>>0?1:0),nr=nr+k,hr=hr+$+(nr>>>0<k>>>0?1:0),cr=Kn+Nr,nn=No+Xn+(cr>>>0<Kn>>>0?1:0);$e=ve,pe=ge,ve=Be,ge=ot,Be=Pe,ot=ke,ke=Ye+nr|0,Pe=nt+hr+(ke>>>0<Ye>>>0?1:0)|0,nt=Qe,Ye=Te,Qe=Le,Te=Ge,Le=xe,Ge=Ne,Ne=nr+cr|0,xe=hr+nn+(Ne>>>0<nr>>>0?1:0)|0}q=F.low=q+Ne,F.high=te+xe+(q>>>0<Ne>>>0?1:0),X=J.low=X+Ge,J.high=w+Le+(X>>>0<Ge>>>0?1:0),he=H.low=he+Te,H.high=ne+Qe+(he>>>0<Te>>>0?1:0),_e=K.low=_e+Ye,K.high=le+nt+(_e>>>0<Ye>>>0?1:0),be=Y.low=be+ke,Y.high=se+Pe+(be>>>0<ke>>>0?1:0),Q=W.low=Q+ot,W.high=j+Be+(Q>>>0<ot>>>0?1:0),re=U.low=re+ge,U.high=L+ve+(re>>>0<ge>>>0?1:0),ee=_.low=ee+pe,_.high=de+$e+(ee>>>0<pe>>>0?1:0)},_doFinalize:function(){var g=this._data,T=g.words,B=this._nDataBytes*8,F=g.sigBytes*8;T[F>>>5]|=128<<24-F%32,T[(F+128>>>10<<5)+30]=Math.floor(B/4294967296),T[(F+128>>>10<<5)+31]=B,g.sigBytes=T.length*4,this._process();var J=this._hash.toX32();return J},clone:function(){var g=D.clone.call(this);return g._hash=this._hash.clone(),g},blockSize:1024/32});l.SHA512=D._createHelper(C),l.HmacSHA512=D._createHmacHelper(C)}(),y.SHA512})},"2LEM":function(d,V,O){d.exports=O.p+"static/checkPeople.d3191bb4.jpg"},"2U/9":function(d,V,O){"use strict";var y=O("VTBJ"),l=O("rePB"),M=O("Ff2n"),D=O("1OyB"),A=O("vuIU"),x=O("Ji7U"),v=O("LK+K"),h=O("q1tI"),p=O.n(h),c=O("Zm9Q"),m=O("TSYQ"),C=O.n(m),g=["className","prefixCls","style","active","status","iconPrefix","icon","wrapperStyle","stepNumber","disabled","description","title","subTitle","progressDot","stepIcon","tailContent","icons","stepIndex","onStepClick","onClick"];function T(K){return typeof K=="string"}var B=function(K){Object(x.a)(W,K);var Y=Object(v.a)(W);function W(){var U;return Object(D.a)(this,W),U=Y.apply(this,arguments),U.onClick=function(){var _=U.props,te=_.onClick,q=_.onStepClick,w=_.stepIndex;te&&te.apply(void 0,arguments),q(w)},U}return Object(A.a)(W,[{key:"renderIconNode",value:function(){var _,te=this.props,q=te.prefixCls,w=te.progressDot,X=te.stepIcon,ne=te.stepNumber,he=te.status,le=te.title,_e=te.description,se=te.icon,be=te.iconPrefix,j=te.icons,Q,L=C()("".concat(q,"-icon"),"".concat(be,"icon"),(_={},Object(l.a)(_,"".concat(be,"icon-").concat(se),se&&T(se)),Object(l.a)(_,"".concat(be,"icon-check"),!se&&he==="finish"&&(j&&!j.finish||!j)),Object(l.a)(_,"".concat(be,"icon-cross"),!se&&he==="error"&&(j&&!j.error||!j)),_)),re=h.createElement("span",{className:"".concat(q,"-icon-dot")});return w?typeof w=="function"?Q=h.createElement("span",{className:"".concat(q,"-icon")},w(re,{index:ne-1,status:he,title:le,description:_e})):Q=h.createElement("span",{className:"".concat(q,"-icon")},re):se&&!T(se)?Q=h.createElement("span",{className:"".concat(q,"-icon")},se):j&&j.finish&&he==="finish"?Q=h.createElement("span",{className:"".concat(q,"-icon")},j.finish):j&&j.error&&he==="error"?Q=h.createElement("span",{className:"".concat(q,"-icon")},j.error):se||he==="finish"||he==="error"?Q=h.createElement("span",{className:L}):Q=h.createElement("span",{className:"".concat(q,"-icon")},ne),X&&(Q=X({index:ne-1,status:he,title:le,description:_e,node:Q})),Q}},{key:"render",value:function(){var _,te=this.props,q=te.className,w=te.prefixCls,X=te.style,ne=te.active,he=te.status,le=he===void 0?"wait":he,_e=te.iconPrefix,se=te.icon,be=te.wrapperStyle,j=te.stepNumber,Q=te.disabled,L=te.description,re=te.title,de=te.subTitle,ee=te.progressDot,xe=te.stepIcon,Ne=te.tailContent,Le=te.icons,Ge=te.stepIndex,Qe=te.onStepClick,Te=te.onClick,nt=Object(M.a)(te,g),Ye=C()("".concat(w,"-item"),"".concat(w,"-item-").concat(le),q,(_={},Object(l.a)(_,"".concat(w,"-item-custom"),se),Object(l.a)(_,"".concat(w,"-item-active"),ne),Object(l.a)(_,"".concat(w,"-item-disabled"),Q===!0),_)),Pe=Object(y.a)({},X),ke={};return Qe&&!Q&&(ke.role="button",ke.tabIndex=0,ke.onClick=this.onClick),h.createElement("div",Object.assign({},nt,{className:Ye,style:Pe}),h.createElement("div",Object.assign({onClick:Te},ke,{className:"".concat(w,"-item-container")}),h.createElement("div",{className:"".concat(w,"-item-tail")},Ne),h.createElement("div",{className:"".concat(w,"-item-icon")},this.renderIconNode()),h.createElement("div",{className:"".concat(w,"-item-content")},h.createElement("div",{className:"".concat(w,"-item-title")},re,de&&h.createElement("div",{title:typeof de=="string"?de:void 0,className:"".concat(w,"-item-subtitle")},de)),L&&h.createElement("div",{className:"".concat(w,"-item-description")},L))))}}]),W}(h.Component),F=["prefixCls","style","className","children","direction","type","labelPlacement","iconPrefix","status","size","current","progressDot","stepIcon","initial","icons","onChange"],J=function(K){Object(x.a)(W,K);var Y=Object(v.a)(W);function W(){var U;return Object(D.a)(this,W),U=Y.apply(this,arguments),U.onStepClick=function(_){var te=U.props,q=te.onChange,w=te.current;q&&w!==_&&q(_)},U}return Object(A.a)(W,[{key:"render",value:function(){var _,te=this,q=this.props,w=q.prefixCls,X=q.style,ne=X===void 0?{}:X,he=q.className,le=q.children,_e=q.direction,se=q.type,be=q.labelPlacement,j=q.iconPrefix,Q=q.status,L=q.size,re=q.current,de=q.progressDot,ee=q.stepIcon,xe=q.initial,Ne=q.icons,Le=q.onChange,Ge=Object(M.a)(q,F),Qe=se==="navigation",Te=de?"vertical":be,nt=C()(w,"".concat(w,"-").concat(_e),he,(_={},Object(l.a)(_,"".concat(w,"-").concat(L),L),Object(l.a)(_,"".concat(w,"-label-").concat(Te),_e==="horizontal"),Object(l.a)(_,"".concat(w,"-dot"),!!de),Object(l.a)(_,"".concat(w,"-navigation"),Qe),_));return p.a.createElement("div",Object.assign({className:nt,style:ne},Ge),Object(c.a)(le).map(function(Ye,Pe){var ke=xe+Pe,Be=Object(y.a)({stepNumber:"".concat(ke+1),stepIndex:ke,key:ke,prefixCls:w,iconPrefix:j,wrapperStyle:ne,progressDot:de,stepIcon:ee,icons:Ne,onStepClick:Le&&te.onStepClick},Ye.props);return Q==="error"&&Pe===re-1&&(Be.className="".concat(w,"-next-error")),Ye.props.status||(ke===re?Be.status=Q:ke<re?Be.status="finish":Be.status="wait"),Be.active=ke===re,Object(h.cloneElement)(Ye,Be)}))}}]),W}(p.a.Component);J.Step=B,J.defaultProps={type:"default",prefixCls:"rc-steps",iconPrefix:"rc",direction:"horizontal",labelPlacement:"horizontal",initial:0,current:0,status:"process",size:"",progressDot:!1};var H=V.a=J},"3y9D":function(d,V,O){(function(y,l){d.exports=V=l(O("Ib8C"))})(this,function(y){return function(){var l=y,M=l.lib,D=M.WordArray,A=M.Hasher,x=l.algo,v=[],h=x.SHA1=A.extend({_doReset:function(){this._hash=new D.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(p,c){for(var m=this._hash.words,C=m[0],g=m[1],T=m[2],B=m[3],F=m[4],J=0;J<80;J++){if(J<16)v[J]=p[c+J]|0;else{var H=v[J-3]^v[J-8]^v[J-14]^v[J-16];v[J]=H<<1|H>>>31}var K=(C<<5|C>>>27)+F+v[J];J<20?K+=(g&T|~g&B)+1518500249:J<40?K+=(g^T^B)+1859775393:J<60?K+=(g&T|g&B|T&B)-1894007588:K+=(g^T^B)-899497514,F=B,B=T,T=g<<30|g>>>2,g=C,C=K}m[0]=m[0]+C|0,m[1]=m[1]+g|0,m[2]=m[2]+T|0,m[3]=m[3]+B|0,m[4]=m[4]+F|0},_doFinalize:function(){var p=this._data,c=p.words,m=this._nDataBytes*8,C=p.sigBytes*8;return c[C>>>5]|=128<<24-C%32,c[(C+64>>>9<<4)+14]=Math.floor(m/4294967296),c[(C+64>>>9<<4)+15]=m,p.sigBytes=c.length*4,this._process(),this._hash},clone:function(){var p=A.clone.call(this);return p._hash=this._hash.clone(),p}});l.SHA1=A._createHelper(h),l.HmacSHA1=A._createHmacHelper(h)}(),y.SHA1})},4:function(d,V){},5:function(d,V){},"5hvy":function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("MlIO"))})(this,function(y){return function(l){var M=y,D=M.lib,A=D.WordArray,x=D.Hasher,v=M.x64,h=v.Word,p=M.algo,c=[],m=[],C=[];(function(){for(var B=1,F=0,J=0;J<24;J++){c[B+5*F]=(J+1)*(J+2)/2%64;var H=F%5,K=(2*B+3*F)%5;B=H,F=K}for(var B=0;B<5;B++)for(var F=0;F<5;F++)m[B+5*F]=F+(2*B+3*F)%5*5;for(var Y=1,W=0;W<24;W++){for(var U=0,_=0,te=0;te<7;te++){if(Y&1){var q=(1<<te)-1;q<32?_^=1<<q:U^=1<<q-32}Y&128?Y=Y<<1^113:Y<<=1}C[W]=h.create(U,_)}})();var g=[];(function(){for(var B=0;B<25;B++)g[B]=h.create()})();var T=p.SHA3=x.extend({cfg:x.cfg.extend({outputLength:512}),_doReset:function(){for(var B=this._state=[],F=0;F<25;F++)B[F]=new h.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(B,F){for(var J=this._state,H=this.blockSize/2,K=0;K<H;K++){var Y=B[F+2*K],W=B[F+2*K+1];Y=(Y<<8|Y>>>24)&16711935|(Y<<24|Y>>>8)&4278255360,W=(W<<8|W>>>24)&16711935|(W<<24|W>>>8)&4278255360;var U=J[K];U.high^=W,U.low^=Y}for(var _=0;_<24;_++){for(var te=0;te<5;te++){for(var q=0,w=0,X=0;X<5;X++){var U=J[te+5*X];q^=U.high,w^=U.low}var ne=g[te];ne.high=q,ne.low=w}for(var te=0;te<5;te++)for(var he=g[(te+4)%5],le=g[(te+1)%5],_e=le.high,se=le.low,q=he.high^(_e<<1|se>>>31),w=he.low^(se<<1|_e>>>31),X=0;X<5;X++){var U=J[te+5*X];U.high^=q,U.low^=w}for(var be=1;be<25;be++){var q,w,U=J[be],j=U.high,Q=U.low,L=c[be];L<32?(q=j<<L|Q>>>32-L,w=Q<<L|j>>>32-L):(q=Q<<L-32|j>>>64-L,w=j<<L-32|Q>>>64-L);var re=g[m[be]];re.high=q,re.low=w}var de=g[0],ee=J[0];de.high=ee.high,de.low=ee.low;for(var te=0;te<5;te++)for(var X=0;X<5;X++){var be=te+5*X,U=J[be],xe=g[be],Ne=g[(te+1)%5+5*X],Le=g[(te+2)%5+5*X];U.high=xe.high^~Ne.high&Le.high,U.low=xe.low^~Ne.low&Le.low}var U=J[0],Ge=C[_];U.high^=Ge.high,U.low^=Ge.low}},_doFinalize:function(){var B=this._data,F=B.words,J=this._nDataBytes*8,H=B.sigBytes*8,K=this.blockSize*32;F[H>>>5]|=1<<24-H%32,F[(l.ceil((H+1)/K)*K>>>5)-1]|=128,B.sigBytes=F.length*4,this._process();for(var Y=this._state,W=this.cfg.outputLength/8,U=W/8,_=[],te=0;te<U;te++){var q=Y[te],w=q.high,X=q.low;w=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,X=(X<<8|X>>>24)&16711935|(X<<24|X>>>8)&4278255360,_.push(X),_.push(w)}return new A.init(_,W)},clone:function(){for(var B=x.clone.call(this),F=B._state=this._state.slice(0),J=0;J<25;J++)F[J]=F[J].clone();return B}});M.SHA3=x._createHelper(T),M.HmacSHA3=x._createHmacHelper(T)}(Math),y.SHA3})},6:function(d,V){},7:function(d,V){},"7Cbv":function(d,V,O){"use strict";var y=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),l=new Uint8Array(16);function M(){if(!y)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return y(l)}var D=/^(?:[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 A(g){return typeof g=="string"&&D.test(g)}for(var x=A,v=[],h=0;h<256;++h)v.push((h+256).toString(16).substr(1));function p(g){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,B=(v[g[T+0]]+v[g[T+1]]+v[g[T+2]]+v[g[T+3]]+"-"+v[g[T+4]]+v[g[T+5]]+"-"+v[g[T+6]]+v[g[T+7]]+"-"+v[g[T+8]]+v[g[T+9]]+"-"+v[g[T+10]]+v[g[T+11]]+v[g[T+12]]+v[g[T+13]]+v[g[T+14]]+v[g[T+15]]).toLowerCase();if(!x(B))throw TypeError("Stringified UUID is invalid");return B}var c=p;function m(g,T,B){g=g||{};var F=g.random||(g.rng||M)();if(F[6]=F[6]&15|64,F[8]=F[8]&63|128,T){B=B||0;for(var J=0;J<16;++J)T[B+J]=F[J];return T}return c(F)}var C=V.a=m},"7ixt":function(d,V,O){"use strict";O.d(V,"a",function(){return M});var y={adjustX:1,adjustY:1},l=[0,0],M={left:{points:["cr","cl"],overflow:y,offset:[-4,0],targetOffset:l},right:{points:["cl","cr"],overflow:y,offset:[4,0],targetOffset:l},top:{points:["bc","tc"],overflow:y,offset:[0,-4],targetOffset:l},bottom:{points:["tc","bc"],overflow:y,offset:[0,4],targetOffset:l},topLeft:{points:["bl","tl"],overflow:y,offset:[0,-4],targetOffset:l},leftTop:{points:["tr","tl"],overflow:y,offset:[-4,0],targetOffset:l},topRight:{points:["br","tr"],overflow:y,offset:[0,-4],targetOffset:l},rightTop:{points:["tl","tr"],overflow:y,offset:[4,0],targetOffset:l},bottomRight:{points:["tr","br"],overflow:y,offset:[0,4],targetOffset:l},rightBottom:{points:["bl","br"],overflow:y,offset:[4,0],targetOffset:l},bottomLeft:{points:["tl","bl"],overflow:y,offset:[0,4],targetOffset:l},leftBottom:{points:["br","bl"],overflow:y,offset:[-4,0],targetOffset:l}},D=M},"8KZw":function(d,V,O){"use strict";(function(y,l){O.d(V,"a",function(){return M});function M(){return typeof y=="object"&&!0&&typeof d!="undefined"&&typeof l!="undefined"&&!!l.version}}).call(this,O("IyRk"),O("Q2Ig"))},"9OqN":function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("OLod"))})(this,function(y){return y.mode.CTR=function(){var l=y.lib.BlockCipherMode.extend(),M=l.Encryptor=l.extend({processBlock:function(D,A){var x=this._cipher,v=x.blockSize,h=this._iv,p=this._counter;h&&(p=this._counter=h.slice(0),this._iv=void 0);var c=p.slice(0);x.encryptBlock(c,0),p[v-1]=p[v-1]+1|0;for(var m=0;m<v;m++)D[A+m]^=c[m]}});return l.Decryptor=M,l}(),y.mode.CTR})},ALsQ:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("OLod"))})(this,function(y){return y.mode.CFB=function(){var l=y.lib.BlockCipherMode.extend();l.Encryptor=l.extend({processBlock:function(D,A){var x=this._cipher,v=x.blockSize;M.call(this,D,A,v,x),this._prevBlock=D.slice(A,A+v)}}),l.Decryptor=l.extend({processBlock:function(D,A){var x=this._cipher,v=x.blockSize,h=D.slice(A,A+v);M.call(this,D,A,v,x),this._prevBlock=h}});function M(D,A,x,v){var h,p=this._iv;p?(h=p.slice(0),this._iv=void 0):h=this._prevBlock,v.encryptBlock(h,0);for(var c=0;c<x;c++)D[A+c]^=h[c]}return l}(),y.mode.CFB})},D1Df:function(d,V,O){"use strict";function y(se){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?y=function(j){return typeof j}:y=function(j){return j&&typeof Symbol=="function"&&j.constructor===Symbol&&j!==Symbol.prototype?"symbol":typeof j},y(se)}function l(){return l=Object.assign||function(se){for(var be=1;be<arguments.length;be++){var j=arguments[be];for(var Q in j)Object.prototype.hasOwnProperty.call(j,Q)&&(se[Q]=j[Q])}return se},l.apply(this,arguments)}function M(se,be){var j=Object.keys(se);if(Object.getOwnPropertySymbols){var Q=Object.getOwnPropertySymbols(se);be&&(Q=Q.filter(function(L){return Object.getOwnPropertyDescriptor(se,L).enumerable})),j.push.apply(j,Q)}return j}function D(se){for(var be=1;be<arguments.length;be++){var j=arguments[be]!=null?arguments[be]:{};be%2?M(j,!0).forEach(function(Q){B(se,Q,j[Q])}):Object.getOwnPropertyDescriptors?Object.defineProperties(se,Object.getOwnPropertyDescriptors(j)):M(j).forEach(function(Q){Object.defineProperty(se,Q,Object.getOwnPropertyDescriptor(j,Q))})}return se}function A(se,be){if(se==null)return{};var j=x(se,be),Q,L;if(Object.getOwnPropertySymbols){var re=Object.getOwnPropertySymbols(se);for(L=0;L<re.length;L++){if(Q=re[L],be.indexOf(Q)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(se,Q))continue;j[Q]=se[Q]}}return j}function x(se,be){if(se==null)return{};var j={},Q=Object.keys(se),L,re;for(re=0;re<Q.length;re++){if(L=Q[re],be.indexOf(L)>=0)continue;j[L]=se[L]}return j}function v(se,be){if(!(se instanceof be))throw new TypeError("Cannot call a class as a function")}function h(se,be){for(var j=0;j<be.length;j++){var Q=be[j];Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(se,Q.key,Q)}}function p(se,be,j){return be&&h(se.prototype,be),j&&h(se,j),se}function c(se,be){return be&&(y(be)==="object"||typeof be=="function")?be:C(se)}function m(se){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(j){return j.__proto__||Object.getPrototypeOf(j)},m(se)}function C(se){if(se===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return se}function g(se,be){if(typeof be!="function"&&be!==null)throw new TypeError("Super expression must either be null or a function");se.prototype=Object.create(be&&be.prototype,{constructor:{value:se,writable:!0,configurable:!0}}),be&&T(se,be)}function T(se,be){return T=Object.setPrototypeOf||function(Q,L){return Q.__proto__=L,Q},T(se,be)}function B(se,be,j){return be in se?Object.defineProperty(se,be,{value:j,enumerable:!0,configurable:!0,writable:!0}):se[be]=j,se}var F=O("q1tI"),J=O("17x9"),H=O("H38U"),K=O("aRTE");function Y(se){for(var be="",j=0;j<se.length;j++){var Q=se.charCodeAt(j);Q<128?be+=String.fromCharCode(Q):Q<2048?(be+=String.fromCharCode(192|Q>>6),be+=String.fromCharCode(128|Q&63)):Q<55296||Q>=57344?(be+=String.fromCharCode(224|Q>>12),be+=String.fromCharCode(128|Q>>6&63),be+=String.fromCharCode(128|Q&63)):(j++,Q=65536+((Q&1023)<<10|se.charCodeAt(j)&1023),be+=String.fromCharCode(240|Q>>18),be+=String.fromCharCode(128|Q>>12&63),be+=String.fromCharCode(128|Q>>6&63),be+=String.fromCharCode(128|Q&63))}return be}var W={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},U={},_=4,te=.1;function q(se){var be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,j=[];return se.forEach(function(Q,L){var re=null;Q.forEach(function(de,ee){if(!de&&re!==null){j.push("M".concat(re+be," ").concat(L+be,"h").concat(ee-re,"v1H").concat(re+be,"z")),re=null;return}if(ee===Q.length-1){if(!de)return;re===null?j.push("M".concat(ee+be,",").concat(L+be," h1v1H").concat(ee+be,"z")):j.push("M".concat(re+be,",").concat(L+be," h").concat(ee+1-re,"v1H").concat(re+be,"z"));return}de&&re===null&&(re=ee)})}),j.join("")}function w(se,be){return se.slice().map(function(j,Q){return Q<be.y||Q>=be.y+be.h?j:j.map(function(L,re){return re<be.x||re>=be.x+be.w?L:!1})})}function X(se,be){var j=se.imageSettings,Q=se.size,L=se.includeMargin;if(j==null)return null;var re=L?_:0,de=be.length+re*2,ee=Math.floor(Q*te),xe=de/Q,Ne=(j.width||ee)*xe,Le=(j.height||ee)*xe,Ge=j.x==null?be.length/2-Ne/2:j.x*xe,Qe=j.y==null?be.length/2-Le/2:j.y*xe,Te=null;if(j.excavate){var nt=Math.floor(Ge),Ye=Math.floor(Qe),Pe=Math.ceil(Ne+Ge-nt),ke=Math.ceil(Le+Qe-Ye);Te={x:nt,y:Ye,w:Pe,h:ke}}return{x:Ge,y:Qe,h:Le,w:Ne,excavation:Te}}var ne=function(){try{new Path2D().addPath(new Path2D)}catch(se){return!1}return!0}(),he=function(se){g(be,se);function be(){var j,Q;v(this,be);for(var L=arguments.length,re=new Array(L),de=0;de<L;de++)re[de]=arguments[de];return Q=c(this,(j=m(be)).call.apply(j,[this].concat(re))),B(C(Q),"_canvas",void 0),B(C(Q),"_image",void 0),B(C(Q),"state",{imgLoaded:!1}),B(C(Q),"handleImageLoad",function(){Q.setState({imgLoaded:!0})}),Q}return p(be,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var Q=this.props,L=Q.value,re=Q.size,de=Q.level,ee=Q.bgColor,xe=Q.fgColor,Ne=Q.includeMargin,Le=Q.imageSettings,Ge=new H(-1,K[de]);if(Ge.addData(Y(L)),Ge.make(),this._canvas!=null){var Qe=this._canvas,Te=Qe.getContext("2d");if(!Te)return;var nt=Ge.modules;if(nt===null)return;var Ye=Ne?_:0,Pe=nt.length+Ye*2,ke=X(this.props,nt);Le!=null&&ke!=null&&(ke.excavation!=null&&(nt=w(nt,ke.excavation)));var Be=window.devicePixelRatio||1;Qe.height=Qe.width=re*Be;var ot=re/Pe*Be;Te.scale(ot,ot),Te.fillStyle=ee,Te.fillRect(0,0,Pe,Pe),Te.fillStyle=xe,ne?Te.fill(new Path2D(q(nt,Ye))):nt.forEach(function(ve,ge){ve.forEach(function($e,pe){$e&&Te.fillRect(pe+Ye,ge+Ye,1,1)})}),this.state.imgLoaded&&this._image&&ke!=null&&Te.drawImage(this._image,ke.x+Ye,ke.y+Ye,ke.w,ke.h)}}},{key:"render",value:function(){var Q=this,L=this.props,re=L.value,de=L.size,ee=L.level,xe=L.bgColor,Ne=L.fgColor,Le=L.style,Ge=L.includeMargin,Qe=L.imageSettings,Te=A(L,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),nt=D({height:de,width:de},Le),Ye=null,Pe=Qe&&Qe.src;return Qe!=null&&Pe!=null&&(Ye=F.createElement("img",{src:Pe,style:{display:"none"},onLoad:this.handleImageLoad,ref:function(Be){return Q._image=Be}})),F.createElement(F.Fragment,null,F.createElement("canvas",l({style:nt,height:de,width:de,ref:function(Be){return Q._canvas=Be}},Te)),Ye)}}]),be}(F.PureComponent);B(he,"defaultProps",W);var le=function(se){g(be,se);function be(){return v(this,be),c(this,m(be).apply(this,arguments))}return p(be,[{key:"render",value:function(){var Q=this.props,L=Q.value,re=Q.size,de=Q.level,ee=Q.bgColor,xe=Q.fgColor,Ne=Q.includeMargin,Le=Q.imageSettings,Ge=A(Q,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),Qe=new H(-1,K[de]);Qe.addData(Y(L)),Qe.make();var Te=Qe.modules;if(Te===null)return null;var nt=Ne?_:0,Ye=Te.length+nt*2,Pe=X(this.props,Te),ke=null;Le!=null&&Pe!=null&&(Pe.excavation!=null&&(Te=w(Te,Pe.excavation)),ke=F.createElement("image",{xlinkHref:Le.src,height:Pe.h,width:Pe.w,x:Pe.x+nt,y:Pe.y+nt,preserveAspectRatio:"none"}));var Be=q(Te,nt);return F.createElement("svg",l({shapeRendering:"crispEdges",height:re,width:re,viewBox:"0 0 ".concat(Ye," ").concat(Ye)},Ge),F.createElement("path",{fill:ee,d:"M0,0 h".concat(Ye,"v").concat(Ye,"H0z")}),F.createElement("path",{fill:xe,d:Be}),ke)}}]),be}(F.PureComponent);B(le,"defaultProps",W);var _e=function(be){var j=be.renderAs,Q=A(be,["renderAs"]),L=j==="svg"?le:he;return F.createElement(L,Q)};_e.defaultProps=D({renderAs:"canvas"},W),d.exports=_e},E4JC:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("ETIr"),O("cv67"),O("K3mO"),O("OLod"))})(this,function(y){return function(){var l=y,M=l.lib,D=M.StreamCipher,A=l.algo,x=[],v=[],h=[],p=A.Rabbit=D.extend({_doReset:function(){for(var m=this._key.words,C=this.cfg.iv,g=0;g<4;g++)m[g]=(m[g]<<8|m[g]>>>24)&16711935|(m[g]<<24|m[g]>>>8)&4278255360;var T=this._X=[m[0],m[3]<<16|m[2]>>>16,m[1],m[0]<<16|m[3]>>>16,m[2],m[1]<<16|m[0]>>>16,m[3],m[2]<<16|m[1]>>>16],B=this._C=[m[2]<<16|m[2]>>>16,m[0]&4294901760|m[1]&65535,m[3]<<16|m[3]>>>16,m[1]&4294901760|m[2]&65535,m[0]<<16|m[0]>>>16,m[2]&4294901760|m[3]&65535,m[1]<<16|m[1]>>>16,m[3]&4294901760|m[0]&65535];this._b=0;for(var g=0;g<4;g++)c.call(this);for(var g=0;g<8;g++)B[g]^=T[g+4&7];if(C){var F=C.words,J=F[0],H=F[1],K=(J<<8|J>>>24)&16711935|(J<<24|J>>>8)&4278255360,Y=(H<<8|H>>>24)&16711935|(H<<24|H>>>8)&4278255360,W=K>>>16|Y&4294901760,U=Y<<16|K&65535;B[0]^=K,B[1]^=W,B[2]^=Y,B[3]^=U,B[4]^=K,B[5]^=W,B[6]^=Y,B[7]^=U;for(var g=0;g<4;g++)c.call(this)}},_doProcessBlock:function(m,C){var g=this._X;c.call(this),x[0]=g[0]^g[5]>>>16^g[3]<<16,x[1]=g[2]^g[7]>>>16^g[5]<<16,x[2]=g[4]^g[1]>>>16^g[7]<<16,x[3]=g[6]^g[3]>>>16^g[1]<<16;for(var T=0;T<4;T++)x[T]=(x[T]<<8|x[T]>>>24)&16711935|(x[T]<<24|x[T]>>>8)&4278255360,m[C+T]^=x[T]},blockSize:128/32,ivSize:64/32});function c(){for(var m=this._X,C=this._C,g=0;g<8;g++)v[g]=C[g];C[0]=C[0]+1295307597+this._b|0,C[1]=C[1]+3545052371+(C[0]>>>0<v[0]>>>0?1:0)|0,C[2]=C[2]+886263092+(C[1]>>>0<v[1]>>>0?1:0)|0,C[3]=C[3]+1295307597+(C[2]>>>0<v[2]>>>0?1:0)|0,C[4]=C[4]+3545052371+(C[3]>>>0<v[3]>>>0?1:0)|0,C[5]=C[5]+886263092+(C[4]>>>0<v[4]>>>0?1:0)|0,C[6]=C[6]+1295307597+(C[5]>>>0<v[5]>>>0?1:0)|0,C[7]=C[7]+3545052371+(C[6]>>>0<v[6]>>>0?1:0)|0,this._b=C[7]>>>0<v[7]>>>0?1:0;for(var g=0;g<8;g++){var T=m[g]+C[g],B=T&65535,F=T>>>16,J=((B*B>>>17)+B*F>>>15)+F*F,H=((T&4294901760)*T|0)+((T&65535)*T|0);h[g]=J^H}m[0]=h[0]+(h[7]<<16|h[7]>>>16)+(h[6]<<16|h[6]>>>16)|0,m[1]=h[1]+(h[0]<<8|h[0]>>>24)+h[7]|0,m[2]=h[2]+(h[1]<<16|h[1]>>>16)+(h[0]<<16|h[0]>>>16)|0,m[3]=h[3]+(h[2]<<8|h[2]>>>24)+h[1]|0,m[4]=h[4]+(h[3]<<16|h[3]>>>16)+(h[2]<<16|h[2]>>>16)|0,m[5]=h[5]+(h[4]<<8|h[4]>>>24)+h[3]|0,m[6]=h[6]+(h[5]<<16|h[5]>>>16)+(h[4]<<16|h[4]>>>16)|0,m[7]=h[7]+(h[6]<<8|h[6]>>>24)+h[5]|0}l.Rabbit=D._createHelper(p)}(),y.Rabbit})},ELcG:function(d,V,O){(function(y,l){d.exports=V=l(O("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(l){var M=y,D=M.lib,A=D.WordArray,x=D.Hasher,v=M.algo,h=A.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]),p=A.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]),c=A.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]),m=A.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]),C=A.create([0,1518500249,1859775393,2400959708,2840853838]),g=A.create([1352829926,1548603684,1836072691,2053994217,0]),T=v.RIPEMD160=x.extend({_doReset:function(){this._hash=A.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(W,U){for(var _=0;_<16;_++){var te=U+_,q=W[te];W[te]=(q<<8|q>>>24)&16711935|(q<<24|q>>>8)&4278255360}var w=this._hash.words,X=C.words,ne=g.words,he=h.words,le=p.words,_e=c.words,se=m.words,be,j,Q,L,re,de,ee,xe,Ne,Le;de=be=w[0],ee=j=w[1],xe=Q=w[2],Ne=L=w[3],Le=re=w[4];for(var Ge,_=0;_<80;_+=1)Ge=be+W[U+he[_]]|0,_<16?Ge+=B(j,Q,L)+X[0]:_<32?Ge+=F(j,Q,L)+X[1]:_<48?Ge+=J(j,Q,L)+X[2]:_<64?Ge+=H(j,Q,L)+X[3]:Ge+=K(j,Q,L)+X[4],Ge=Ge|0,Ge=Y(Ge,_e[_]),Ge=Ge+re|0,be=re,re=L,L=Y(Q,10),Q=j,j=Ge,Ge=de+W[U+le[_]]|0,_<16?Ge+=K(ee,xe,Ne)+ne[0]:_<32?Ge+=H(ee,xe,Ne)+ne[1]:_<48?Ge+=J(ee,xe,Ne)+ne[2]:_<64?Ge+=F(ee,xe,Ne)+ne[3]:Ge+=B(ee,xe,Ne)+ne[4],Ge=Ge|0,Ge=Y(Ge,se[_]),Ge=Ge+Le|0,de=Le,Le=Ne,Ne=Y(xe,10),xe=ee,ee=Ge;Ge=w[1]+Q+Ne|0,w[1]=w[2]+L+Le|0,w[2]=w[3]+re+de|0,w[3]=w[4]+be+ee|0,w[4]=w[0]+j+xe|0,w[0]=Ge},_doFinalize:function(){var W=this._data,U=W.words,_=this._nDataBytes*8,te=W.sigBytes*8;U[te>>>5]|=128<<24-te%32,U[(te+64>>>9<<4)+14]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,W.sigBytes=(U.length+1)*4,this._process();for(var q=this._hash,w=q.words,X=0;X<5;X++){var ne=w[X];w[X]=(ne<<8|ne>>>24)&16711935|(ne<<24|ne>>>8)&4278255360}return q},clone:function(){var W=x.clone.call(this);return W._hash=this._hash.clone(),W}});function B(W,U,_){return W^U^_}function F(W,U,_){return W&U|~W&_}function J(W,U,_){return(W|~U)^_}function H(W,U,_){return W&_|U&~_}function K(W,U,_){return W^(U|~_)}function Y(W,U){return W<<U|W>>>32-U}M.RIPEMD160=x._createHelper(T),M.HmacRIPEMD160=x._createHmacHelper(T)}(Math),y.RIPEMD160})},ETIr:function(d,V,O){(function(y,l){d.exports=V=l(O("Ib8C"))})(this,function(y){return function(){var l=y,M=l.lib,D=M.WordArray,A=l.enc,x=A.Base64={stringify:function(h){var p=h.words,c=h.sigBytes,m=this._map;h.clamp();for(var C=[],g=0;g<c;g+=3)for(var T=p[g>>>2]>>>24-g%4*8&255,B=p[g+1>>>2]>>>24-(g+1)%4*8&255,F=p[g+2>>>2]>>>24-(g+2)%4*8&255,J=T<<16|B<<8|F,H=0;H<4&&g+H*.75<c;H++)C.push(m.charAt(J>>>6*(3-H)&63));var K=m.charAt(64);if(K)for(;C.length%4;)C.push(K);return C.join("")},parse:function(h){var p=h.length,c=this._map,m=this._reverseMap;if(!m){m=this._reverseMap=[];for(var C=0;C<c.length;C++)m[c.charCodeAt(C)]=C}var g=c.charAt(64);if(g){var T=h.indexOf(g);T!==-1&&(p=T)}return v(h,p,m)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function v(h,p,c){for(var m=[],C=0,g=0;g<p;g++)if(g%4){var T=c[h.charCodeAt(g-1)]<<g%4*2,B=c[h.charCodeAt(g)]>>>6-g%4*2,F=T|B;m[C>>>2]|=F<<24-C%4*8,C++}return D.create(m,C)}}(),y.enc.Base64})},"F+F2":function(d,V,O){(function(y,l){d.exports=V=l(O("Ib8C"))})(this,function(y){return function(){if(typeof ArrayBuffer!="function")return;var l=y,M=l.lib,D=M.WordArray,A=D.init,x=D.init=function(v){if(v instanceof ArrayBuffer&&(v=new Uint8Array(v)),(v instanceof Int8Array||typeof Uint8ClampedArray!="undefined"&&v instanceof Uint8ClampedArray||v instanceof Int16Array||v instanceof Uint16Array||v instanceof Int32Array||v instanceof Uint32Array||v instanceof Float32Array||v instanceof Float64Array)&&(v=new Uint8Array(v.buffer,v.byteOffset,v.byteLength)),v instanceof Uint8Array){for(var h=v.byteLength,p=[],c=0;c<h;c++)p[c>>>2]|=v[c]<<24-c%4*8;A.call(this,p,h)}else A.apply(this,arguments)};x.prototype=D}(),y.lib.WordArray})},GRuw:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("lPiR"))})(this,function(y){return function(){var l=y,M=l.lib,D=M.WordArray,A=l.algo,x=A.SHA256,v=A.SHA224=x.extend({_doReset:function(){this._hash=new D.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var h=x._doFinalize.call(this);return h.sigBytes-=4,h}});l.SHA224=x._createHelper(v),l.HmacSHA224=x._createHmacHelper(v)}(),y.SHA224})},GfqC:function(d,V,O){"use strict";var y=O("q1tI"),l=O.n(y),M=O("TSYQ"),D=O.n(M);function A(L,re){var de="cannot "+L.method+" "+L.action+" "+re.status+"'",ee=new Error(de);return ee.status=re.status,ee.method=L.method,ee.url=L.action,ee}function x(L){var re=L.responseText||L.response;if(!re)return re;try{return JSON.parse(re)}catch(de){return re}}function v(L){var re=new XMLHttpRequest;L.onProgress&&re.upload&&(re.upload.onprogress=function(Ne){Ne.total>0&&(Ne.percent=Ne.loaded/Ne.total*100),L.onProgress(Ne)});var de=new FormData;L.data&&Object.keys(L.data).forEach(function(xe){var Ne=L.data[xe];if(Array.isArray(Ne)){Ne.forEach(function(Le){de.append(xe+"[]",Le)});return}de.append(xe,L.data[xe])}),L.file instanceof Blob?de.append(L.filename,L.file,L.file.name):de.append(L.filename,L.file),re.onerror=function(Ne){L.onError(Ne)},re.onload=function(){return re.status<200||re.status>=300?L.onError(A(L,re),x(re)):L.onSuccess(x(re),re)},re.open(L.method,L.action,!0),L.withCredentials&&"withCredentials"in re&&(re.withCredentials=!0);var ee=L.headers||{};return ee["X-Requested-With"]!==null&&re.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(ee).forEach(function(xe){ee[xe]!==null&&re.setRequestHeader(xe,ee[xe])}),re.send(de),{abort:function(){re.abort()}}}var h=+new Date,p=0;function c(){return"rc-upload-"+h+"-"+ ++p}function m(L,re){return L.indexOf(re,L.length-re.length)!==-1}var C=function(L,re){if(L&&re){var de=Array.isArray(re)?re:re.split(","),ee=L.name||"",xe=L.type||"",Ne=xe.replace(/\/.*$/,"");return de.some(function(Le){var Ge=Le.trim();return Ge.charAt(0)==="."?m(ee.toLowerCase(),Ge.toLowerCase()):/\/\*$/.test(Ge)?Ne===Ge.replace(/\/.*$/,""):xe===Ge})}return!0};function g(L,re){var de=L.createReader(),ee=[];function xe(){de.readEntries(function(Ne){var Le=Array.prototype.slice.apply(Ne);ee=ee.concat(Le);var Ge=!Le.length;Ge?re(ee):xe()})}xe()}var T=function(re,de,ee){var xe=function Ne(Le,Ge){Ge=Ge||"",Le.isFile?Le.file(function(Qe){ee(Qe)&&(Le.fullPath&&!Qe.webkitRelativePath&&(Object.defineProperties(Qe,{webkitRelativePath:{writable:!0}}),Qe.webkitRelativePath=Le.fullPath.replace(/^\//,""),Object.defineProperties(Qe,{webkitRelativePath:{writable:!1}})),de([Qe]))}):Le.isDirectory&&g(Le,function(Qe){Qe.forEach(function(Te){Ne(Te,""+Ge+Le.name+"/")})})};re.forEach(function(Ne){xe(Ne.webkitGetAsEntry())})},B=T,F=Object.assign||function(L){for(var re=1;re<arguments.length;re++){var de=arguments[re];for(var ee in de)Object.prototype.hasOwnProperty.call(de,ee)&&(L[ee]=de[ee])}return L},J=function(){function L(re,de){var ee=[],xe=!0,Ne=!1,Le=void 0;try{for(var Ge=re[Symbol.iterator](),Qe;!(xe=(Qe=Ge.next()).done)&&!(ee.push(Qe.value),de&&ee.length===de);xe=!0);}catch(Te){Ne=!0,Le=Te}finally{try{!xe&&Ge.return&&Ge.return()}finally{if(Ne)throw Le}}return ee}return function(re,de){if(Array.isArray(re))return re;if(Symbol.iterator in Object(re))return L(re,de);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),H=function(){function L(re,de){for(var ee=0;ee<de.length;ee++){var xe=de[ee];xe.enumerable=xe.enumerable||!1,xe.configurable=!0,"value"in xe&&(xe.writable=!0),Object.defineProperty(re,xe.key,xe)}}return function(re,de,ee){return de&&L(re.prototype,de),ee&&L(re,ee),re}}();function K(L,re,de){return re in L?Object.defineProperty(L,re,{value:de,enumerable:!0,configurable:!0,writable:!0}):L[re]=de,L}function Y(L,re){var de={};for(var ee in L){if(re.indexOf(ee)>=0)continue;if(!Object.prototype.hasOwnProperty.call(L,ee))continue;de[ee]=L[ee]}return de}function W(L,re){if(!(L instanceof re))throw new TypeError("Cannot call a class as a function")}function U(L,re){if(!L)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return re&&(typeof re=="object"||typeof re=="function")?re:L}function _(L,re){if(typeof re!="function"&&re!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof re);L.prototype=Object.create(re&&re.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),re&&(Object.setPrototypeOf?Object.setPrototypeOf(L,re):L.__proto__=re)}var te=function(re){return Object.keys(re).reduce(function(de,ee){return(ee.substr(0,5)==="data-"||ee.substr(0,5)==="aria-"||ee==="role")&&(de[ee]=re[ee]),de},{})},q=function(L){_(re,L);function re(){var de,ee,xe,Ne;W(this,re);for(var Le=arguments.length,Ge=Array(Le),Qe=0;Qe<Le;Qe++)Ge[Qe]=arguments[Qe];return Ne=(ee=(xe=U(this,(de=re.__proto__||Object.getPrototypeOf(re)).call.apply(de,[this].concat(Ge))),xe),xe.state={uid:c()},xe.reqs={},xe.onChange=function(Te){var nt=Te.target.files;xe.uploadFiles(nt),xe.reset()},xe.onClick=function(Te){var nt=xe.fileInput;if(!nt)return;var Ye=xe.props,Pe=Ye.children,ke=Ye.onClick;Pe&&Pe.type==="button"&&(nt.parentNode.focus(),nt.parentNode.querySelector("button").blur()),nt.click(),ke&&ke(Te)},xe.onKeyDown=function(Te){Te.key==="Enter"&&xe.onClick()},xe.onFileDrop=function(Te){var nt=xe.props.multiple;if(Te.preventDefault(),Te.type==="dragover")return;if(xe.props.directory)B(Array.prototype.slice.call(Te.dataTransfer.items),xe.uploadFiles,function(Pe){return C(Pe,xe.props.accept)});else{var Ye=Array.prototype.slice.call(Te.dataTransfer.files).filter(function(Pe){return C(Pe,xe.props.accept)});nt===!1&&(Ye=Ye.slice(0,1)),xe.uploadFiles(Ye)}},xe.uploadFiles=function(Te){var nt=Array.prototype.slice.call(Te);nt.map(function(Ye){return Ye.uid=c(),Ye}).forEach(function(Ye){xe.upload(Ye,nt)})},xe.saveFileInput=function(Te){xe.fileInput=Te},ee),U(xe,Ne)}return H(re,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(ee,xe){var Ne=this,Le=this.props;if(!Le.beforeUpload)return setTimeout(function(){return Ne.post(ee)},0);var Ge=Le.beforeUpload(ee,xe);Ge&&Ge.then?Ge.then(function(Qe){var Te=Object.prototype.toString.call(Qe);return Te==="[object File]"||Te==="[object Blob]"?Ne.post(Qe):Ne.post(ee)}).catch(function(Qe){console.log(Qe)}):Ge!==!1&&setTimeout(function(){return Ne.post(ee)},0);return}},{key:"post",value:function(ee){var xe=this;if(!this._isMounted)return;var Ne=this.props,Le=Ne.onStart,Ge=Ne.onProgress,Qe=Ne.transformFile,Te=Qe===void 0?function(nt){return nt}:Qe;new Promise(function(nt){var Ye=Ne.action;return typeof Ye=="function"&&(Ye=Ye(ee)),nt(Ye)}).then(function(nt){var Ye=ee.uid,Pe=Ne.customRequest||v,ke=Promise.resolve(Te(ee)).then(function(Be){var ot=Ne.data;return typeof ot=="function"&&(ot=ot(Be)),Promise.all([Be,ot])}).catch(function(Be){console.error(Be)});ke.then(function(Be){var ot=J(Be,2),ve=ot[0],ge=ot[1],$e={action:nt,filename:Ne.name,data:ge,file:ve,headers:Ne.headers,withCredentials:Ne.withCredentials,method:Ne.method||"post",onProgress:Ge?function(pe){Ge(pe,ee)}:null,onSuccess:function(Z,k){delete xe.reqs[Ye],Ne.onSuccess(Z,ee,k)},onError:function(Z,k){delete xe.reqs[Ye],Ne.onError(Z,k,ee)}};Le(ee),xe.reqs[Ye]=Pe($e)})})}},{key:"reset",value:function(){this.setState({uid:c()})}},{key:"abort",value:function(ee){var xe=this.reqs;if(ee){var Ne=ee;ee&&ee.uid&&(Ne=ee.uid),xe[Ne]&&xe[Ne].abort&&xe[Ne].abort(),delete xe[Ne]}else Object.keys(xe).forEach(function(Le){xe[Le]&&xe[Le].abort&&xe[Le].abort(),delete xe[Le]})}},{key:"render",value:function(){var ee,xe=this.props,Ne=xe.component,Le=xe.prefixCls,Ge=xe.className,Qe=xe.disabled,Te=xe.id,nt=xe.style,Ye=xe.multiple,Pe=xe.accept,ke=xe.children,Be=xe.directory,ot=xe.openFileDialogOnClick,ve=xe.onMouseEnter,ge=xe.onMouseLeave,$e=Y(xe,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),pe=D()((ee={},K(ee,Le,!0),K(ee,Le+"-disabled",Qe),K(ee,Ge,Ge),ee)),Z=Qe?{}:{onClick:ot?this.onClick:function(){},onKeyDown:ot?this.onKeyDown:function(){},onMouseEnter:ve,onMouseLeave:ge,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return l.a.createElement(Ne,F({},Z,{className:pe,role:"button",style:nt}),l.a.createElement("input",F({},te($e),{id:Te,type:"file",ref:this.saveFileInput,onClick:function($){return $.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:Pe,directory:Be?"directory":null,webkitdirectory:Be?"webkitdirectory":null,multiple:Ye,onChange:this.onChange})),ke)}}]),re}(y.Component),w=q,X=Object.assign||function(L){for(var re=1;re<arguments.length;re++){var de=arguments[re];for(var ee in de)Object.prototype.hasOwnProperty.call(de,ee)&&(L[ee]=de[ee])}return L},ne=function(){function L(re,de){for(var ee=0;ee<de.length;ee++){var xe=de[ee];xe.enumerable=xe.enumerable||!1,xe.configurable=!0,"value"in xe&&(xe.writable=!0),Object.defineProperty(re,xe.key,xe)}}return function(re,de,ee){return de&&L(re.prototype,de),ee&&L(re,ee),re}}();function he(L,re){if(!(L instanceof re))throw new TypeError("Cannot call a class as a function")}function le(L,re){if(!L)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return re&&(typeof re=="object"||typeof re=="function")?re:L}function _e(L,re){if(typeof re!="function"&&re!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof re);L.prototype=Object.create(re&&re.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),re&&(Object.setPrototypeOf?Object.setPrototypeOf(L,re):L.__proto__=re)}function se(){}var be=function(L){_e(re,L);function re(){var de,ee,xe,Ne;he(this,re);for(var Le=arguments.length,Ge=Array(Le),Qe=0;Qe<Le;Qe++)Ge[Qe]=arguments[Qe];return Ne=(ee=(xe=le(this,(de=re.__proto__||Object.getPrototypeOf(re)).call.apply(de,[this].concat(Ge))),xe),xe.saveUploader=function(Te){xe.uploader=Te},ee),le(xe,Ne)}return ne(re,[{key:"abort",value:function(ee){this.uploader.abort(ee)}},{key:"render",value:function(){return l.a.createElement(w,X({},this.props,{ref:this.saveUploader}))}}]),re}(y.Component);be.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:se,onError:se,onSuccess:se,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var j=be,Q=V.a=j},H38U:function(d,V,O){var y=O("f4xo"),l=O("rcnY"),M=O("wU8J"),D=O("Iq15"),A=O("dWSS");function x(h,p){this.typeNumber=h,this.errorCorrectLevel=p,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var v=x.prototype;v.addData=function(h){var p=new y(h);this.dataList.push(p),this.dataCache=null},v.isDark=function(h,p){if(h<0||this.moduleCount<=h||p<0||this.moduleCount<=p)throw new Error(h+","+p);return this.modules[h][p]},v.getModuleCount=function(){return this.moduleCount},v.make=function(){if(this.typeNumber<1){var h=1;for(h=1;h<40;h++){for(var p=l.getRSBlocks(h,this.errorCorrectLevel),c=new M,m=0,C=0;C<p.length;C++)m+=p[C].dataCount;for(var C=0;C<this.dataList.length;C++){var g=this.dataList[C];c.put(g.mode,4),c.put(g.getLength(),D.getLengthInBits(g.mode,h)),g.write(c)}if(c.getLengthInBits()<=m*8)break}this.typeNumber=h}this.makeImpl(!1,this.getBestMaskPattern())},v.makeImpl=function(h,p){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var c=0;c<this.moduleCount;c++){this.modules[c]=new Array(this.moduleCount);for(var m=0;m<this.moduleCount;m++)this.modules[c][m]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(h,p),this.typeNumber>=7&&this.setupTypeNumber(h),this.dataCache==null&&(this.dataCache=x.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,p)},v.setupPositionProbePattern=function(h,p){for(var c=-1;c<=7;c++){if(h+c<=-1||this.moduleCount<=h+c)continue;for(var m=-1;m<=7;m++){if(p+m<=-1||this.moduleCount<=p+m)continue;0<=c&&c<=6&&(m==0||m==6)||0<=m&&m<=6&&(c==0||c==6)||2<=c&&c<=4&&2<=m&&m<=4?this.modules[h+c][p+m]=!0:this.modules[h+c][p+m]=!1}}},v.getBestMaskPattern=function(){for(var h=0,p=0,c=0;c<8;c++){this.makeImpl(!0,c);var m=D.getLostPoint(this);(c==0||h>m)&&(h=m,p=c)}return p},v.createMovieClip=function(h,p,c){var m=h.createEmptyMovieClip(p,c),C=1;this.make();for(var g=0;g<this.modules.length;g++)for(var T=g*C,B=0;B<this.modules[g].length;B++){var F=B*C,J=this.modules[g][B];J&&(m.beginFill(0,100),m.moveTo(F,T),m.lineTo(F+C,T),m.lineTo(F+C,T+C),m.lineTo(F,T+C),m.endFill())}return m},v.setupTimingPattern=function(){for(var h=8;h<this.moduleCount-8;h++){if(this.modules[h][6]!=null)continue;this.modules[h][6]=h%2==0}for(var p=8;p<this.moduleCount-8;p++){if(this.modules[6][p]!=null)continue;this.modules[6][p]=p%2==0}},v.setupPositionAdjustPattern=function(){for(var h=D.getPatternPosition(this.typeNumber),p=0;p<h.length;p++)for(var c=0;c<h.length;c++){var m=h[p],C=h[c];if(this.modules[m][C]!=null)continue;for(var g=-2;g<=2;g++)for(var T=-2;T<=2;T++)g==-2||g==2||T==-2||T==2||g==0&&T==0?this.modules[m+g][C+T]=!0:this.modules[m+g][C+T]=!1}},v.setupTypeNumber=function(h){for(var p=D.getBCHTypeNumber(this.typeNumber),c=0;c<18;c++){var m=!h&&(p>>c&1)==1;this.modules[Math.floor(c/3)][c%3+this.moduleCount-8-3]=m}for(var c=0;c<18;c++){var m=!h&&(p>>c&1)==1;this.modules[c%3+this.moduleCount-8-3][Math.floor(c/3)]=m}},v.setupTypeInfo=function(h,p){for(var c=this.errorCorrectLevel<<3|p,m=D.getBCHTypeInfo(c),C=0;C<15;C++){var g=!h&&(m>>C&1)==1;C<6?this.modules[C][8]=g:C<8?this.modules[C+1][8]=g:this.modules[this.moduleCount-15+C][8]=g}for(var C=0;C<15;C++){var g=!h&&(m>>C&1)==1;C<8?this.modules[8][this.moduleCount-C-1]=g:C<9?this.modules[8][15-C-1+1]=g:this.modules[8][15-C-1]=g}this.modules[this.moduleCount-8][8]=!h},v.mapData=function(h,p){for(var c=-1,m=this.moduleCount-1,C=7,g=0,T=this.moduleCount-1;T>0;T-=2)for(T==6&&T--;;){for(var B=0;B<2;B++)if(this.modules[m][T-B]==null){var F=!1;g<h.length&&(F=(h[g]>>>C&1)==1);var J=D.getMask(p,m,T-B);J&&(F=!F),this.modules[m][T-B]=F,C--,C==-1&&(g++,C=7)}if(m+=c,m<0||this.moduleCount<=m){m-=c,c=-c;break}}},x.PAD0=236,x.PAD1=17,x.createData=function(h,p,c){for(var m=l.getRSBlocks(h,p),C=new M,g=0;g<c.length;g++){var T=c[g];C.put(T.mode,4),C.put(T.getLength(),D.getLengthInBits(T.mode,h)),T.write(C)}for(var B=0,g=0;g<m.length;g++)B+=m[g].dataCount;if(C.getLengthInBits()>B*8)throw new Error("code length overflow. ("+C.getLengthInBits()+">"+B*8+")");for(C.getLengthInBits()+4<=B*8&&C.put(0,4);C.getLengthInBits()%8!=0;)C.putBit(!1);for(;!(C.getLengthInBits()>=B*8);){if(C.put(x.PAD0,8),C.getLengthInBits()>=B*8)break;C.put(x.PAD1,8)}return x.createBytes(C,m)},x.createBytes=function(h,p){for(var c=0,m=0,C=0,g=new Array(p.length),T=new Array(p.length),B=0;B<p.length;B++){var F=p[B].dataCount,J=p[B].totalCount-F;m=Math.max(m,F),C=Math.max(C,J),g[B]=new Array(F);for(var H=0;H<g[B].length;H++)g[B][H]=255&h.buffer[H+c];c+=F;var K=D.getErrorCorrectPolynomial(J),Y=new A(g[B],K.getLength()-1),W=Y.mod(K);T[B]=new Array(K.getLength()-1);for(var H=0;H<T[B].length;H++){var U=H+W.getLength()-T[B].length;T[B][H]=U>=0?W.get(U):0}}for(var _=0,H=0;H<p.length;H++)_+=p[H].totalCount;for(var te=new Array(_),q=0,H=0;H<m;H++)for(var B=0;B<p.length;B++)H<g[B].length&&(te[q++]=g[B][H]);for(var H=0;H<C;H++)for(var B=0;B<p.length;B++)H<T[B].length&&(te[q++]=T[B][H]);return te},d.exports=x},IO3U:function(d,V,O){d.exports={wrp:"wrp___1U2de"}},Ib8C:function(d,V,O){(function(y){(function(l,M){d.exports=V=M()})(this,function(){var l=l||function(M,D){var A;if(typeof window!="undefined"&&window.crypto&&(A=window.crypto),typeof self!="undefined"&&self.crypto&&(A=self.crypto),typeof globalThis!="undefined"&&globalThis.crypto&&(A=globalThis.crypto),!A&&typeof window!="undefined"&&window.msCrypto&&(A=window.msCrypto),!A&&typeof y!="undefined"&&y.crypto&&(A=y.crypto),!A&&!0)try{A=O(4)}catch(K){}var x=function(){if(A){if(typeof A.getRandomValues=="function")try{return A.getRandomValues(new Uint32Array(1))[0]}catch(K){}if(typeof A.randomBytes=="function")try{return A.randomBytes(4).readInt32LE()}catch(K){}}throw new Error("Native crypto module could not be used to get secure random number.")},v=Object.create||function(){function K(){}return function(Y){var W;return K.prototype=Y,W=new K,K.prototype=null,W}}(),h={},p=h.lib={},c=p.Base=function(){return{extend:function(K){var Y=v(this);return K&&Y.mixIn(K),(!Y.hasOwnProperty("init")||this.init===Y.init)&&(Y.init=function(){Y.$super.init.apply(this,arguments)}),Y.init.prototype=Y,Y.$super=this,Y},create:function(){var K=this.extend();return K.init.apply(K,arguments),K},init:function(){},mixIn:function(K){for(var Y in K)K.hasOwnProperty(Y)&&(this[Y]=K[Y]);K.hasOwnProperty("toString")&&(this.toString=K.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),m=p.WordArray=c.extend({init:function(K,Y){K=this.words=K||[],Y!=D?this.sigBytes=Y:this.sigBytes=K.length*4},toString:function(K){return(K||g).stringify(this)},concat:function(K){var Y=this.words,W=K.words,U=this.sigBytes,_=K.sigBytes;if(this.clamp(),U%4)for(var te=0;te<_;te++){var q=W[te>>>2]>>>24-te%4*8&255;Y[U+te>>>2]|=q<<24-(U+te)%4*8}else for(var w=0;w<_;w+=4)Y[U+w>>>2]=W[w>>>2];return this.sigBytes+=_,this},clamp:function(){var K=this.words,Y=this.sigBytes;K[Y>>>2]&=4294967295<<32-Y%4*8,K.length=M.ceil(Y/4)},clone:function(){var K=c.clone.call(this);return K.words=this.words.slice(0),K},random:function(K){for(var Y=[],W=0;W<K;W+=4)Y.push(x());return new m.init(Y,K)}}),C=h.enc={},g=C.Hex={stringify:function(K){for(var Y=K.words,W=K.sigBytes,U=[],_=0;_<W;_++){var te=Y[_>>>2]>>>24-_%4*8&255;U.push((te>>>4).toString(16)),U.push((te&15).toString(16))}return U.join("")},parse:function(K){for(var Y=K.length,W=[],U=0;U<Y;U+=2)W[U>>>3]|=parseInt(K.substr(U,2),16)<<24-U%8*4;return new m.init(W,Y/2)}},T=C.Latin1={stringify:function(K){for(var Y=K.words,W=K.sigBytes,U=[],_=0;_<W;_++){var te=Y[_>>>2]>>>24-_%4*8&255;U.push(String.fromCharCode(te))}return U.join("")},parse:function(K){for(var Y=K.length,W=[],U=0;U<Y;U++)W[U>>>2]|=(K.charCodeAt(U)&255)<<24-U%4*8;return new m.init(W,Y)}},B=C.Utf8={stringify:function(K){try{return decodeURIComponent(escape(T.stringify(K)))}catch(Y){throw new Error("Malformed UTF-8 data")}},parse:function(K){return T.parse(unescape(encodeURIComponent(K)))}},F=p.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new m.init,this._nDataBytes=0},_append:function(K){typeof K=="string"&&(K=B.parse(K)),this._data.concat(K),this._nDataBytes+=K.sigBytes},_process:function(K){var Y,W=this._data,U=W.words,_=W.sigBytes,te=this.blockSize,q=te*4,w=_/q;K?w=M.ceil(w):w=M.max((w|0)-this._minBufferSize,0);var X=w*te,ne=M.min(X*4,_);if(X){for(var he=0;he<X;he+=te)this._doProcessBlock(U,he);Y=U.splice(0,X),W.sigBytes-=ne}return new m.init(Y,ne)},clone:function(){var K=c.clone.call(this);return K._data=this._data.clone(),K},_minBufferSize:0}),J=p.Hasher=F.extend({cfg:c.extend(),init:function(K){this.cfg=this.cfg.extend(K),this.reset()},reset:function(){F.reset.call(this),this._doReset()},update:function(K){return this._append(K),this._process(),this},finalize:function(K){K&&this._append(K);var Y=this._doFinalize();return Y},blockSize:512/32,_createHelper:function(K){return function(Y,W){return new K.init(W).finalize(Y)}},_createHmacHelper:function(K){return function(Y,W){return new H.HMAC.init(K,W).finalize(Y)}}}),H=h.algo={};return h}(Math);return l})}).call(this,O("IyRk"))},Iq15:function(d,V,O){var y=O("nVVt"),l=O("dWSS"),M=O("dQei"),D={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},A={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,G18:1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,G15_MASK:1<<14|1<<12|1<<10|1<<4|1<<1,getBCHTypeInfo:function(x){for(var v=x<<10;A.getBCHDigit(v)-A.getBCHDigit(A.G15)>=0;)v^=A.G15<<A.getBCHDigit(v)-A.getBCHDigit(A.G15);return(x<<10|v)^A.G15_MASK},getBCHTypeNumber:function(x){for(var v=x<<12;A.getBCHDigit(v)-A.getBCHDigit(A.G18)>=0;)v^=A.G18<<A.getBCHDigit(v)-A.getBCHDigit(A.G18);return x<<12|v},getBCHDigit:function(x){for(var v=0;x!=0;)v++,x>>>=1;return v},getPatternPosition:function(x){return A.PATTERN_POSITION_TABLE[x-1]},getMask:function(x,v,h){switch(x){case D.PATTERN000:return(v+h)%2==0;case D.PATTERN001:return v%2==0;case D.PATTERN010:return h%3==0;case D.PATTERN011:return(v+h)%3==0;case D.PATTERN100:return(Math.floor(v/2)+Math.floor(h/3))%2==0;case D.PATTERN101:return v*h%2+v*h%3==0;case D.PATTERN110:return(v*h%2+v*h%3)%2==0;case D.PATTERN111:return(v*h%3+(v+h)%2)%2==0;default:throw new Error("bad maskPattern:"+x)}},getErrorCorrectPolynomial:function(x){for(var v=new l([1],0),h=0;h<x;h++)v=v.multiply(new l([1,M.gexp(h)],0));return v},getLengthInBits:function(x,v){if(1<=v&&v<10)switch(x){case y.MODE_NUMBER:return 10;case y.MODE_ALPHA_NUM:return 9;case y.MODE_8BIT_BYTE:return 8;case y.MODE_KANJI:return 8;default:throw new Error("mode:"+x)}else if(v<27)switch(x){case y.MODE_NUMBER:return 12;case y.MODE_ALPHA_NUM:return 11;case y.MODE_8BIT_BYTE:return 16;case y.MODE_KANJI:return 10;default:throw new Error("mode:"+x)}else if(v<41)switch(x){case y.MODE_NUMBER:return 14;case y.MODE_ALPHA_NUM:return 13;case y.MODE_8BIT_BYTE:return 16;case y.MODE_KANJI:return 12;default:throw new Error("mode:"+x)}else throw new Error("type:"+v)},getLostPoint:function(x){for(var v=x.getModuleCount(),h=0,p=0;p<v;p++)for(var c=0;c<v;c++){for(var m=0,C=x.isDark(p,c),g=-1;g<=1;g++){if(p+g<0||v<=p+g)continue;for(var T=-1;T<=1;T++){if(c+T<0||v<=c+T)continue;if(g==0&&T==0)continue;C==x.isDark(p+g,c+T)&&m++}}m>5&&(h+=3+m-5)}for(var p=0;p<v-1;p++)for(var c=0;c<v-1;c++){var B=0;x.isDark(p,c)&&B++,x.isDark(p+1,c)&&B++,x.isDark(p,c+1)&&B++,x.isDark(p+1,c+1)&&B++,(B==0||B==4)&&(h+=3)}for(var p=0;p<v;p++)for(var c=0;c<v-6;c++)x.isDark(p,c)&&!x.isDark(p,c+1)&&x.isDark(p,c+2)&&x.isDark(p,c+3)&&x.isDark(p,c+4)&&!x.isDark(p,c+5)&&x.isDark(p,c+6)&&(h+=40);for(var c=0;c<v;c++)for(var p=0;p<v-6;p++)x.isDark(p,c)&&!x.isDark(p+1,c)&&x.isDark(p+2,c)&&x.isDark(p+3,c)&&x.isDark(p+4,c)&&!x.isDark(p+5,c)&&x.isDark(p+6,c)&&(h+=40);for(var F=0,c=0;c<v;c++)for(var p=0;p<v;p++)x.isDark(p,c)&&F++;var J=Math.abs(100*F/v/v-50)/5;return h+=J*10,h}};d.exports=A},K3mO:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("3y9D"),O("WYAk"))})(this,function(y){return function(){var l=y,M=l.lib,D=M.Base,A=M.WordArray,x=l.algo,v=x.MD5,h=x.EvpKDF=D.extend({cfg:D.extend({keySize:128/32,hasher:v,iterations:1}),init:function(p){this.cfg=this.cfg.extend(p)},compute:function(p,c){for(var m,C=this.cfg,g=C.hasher.create(),T=A.create(),B=T.words,F=C.keySize,J=C.iterations;B.length<F;){m&&g.update(m),m=g.update(p).finalize(c),g.reset();for(var H=1;H<J;H++)m=g.finalize(m),g.reset();T.concat(m)}return T.sigBytes=F*4,T}});l.EvpKDF=function(p,c,m){return h.create(m).compute(p,c)}}(),y.EvpKDF})},KhGG:function(d,V,O){"use strict";O.d(V,"a",function(){return _}),O.d(V,"c",function(){return w});var y=O("0Owb"),l=O("miYZ"),M=O("tsqr"),D=O("oBTY"),A=O("tJVT"),x=O("PpiC"),v=O("k1fw"),h=O("9og8"),p=O("DZo9"),c=O("8z0m"),m=O("WmNS"),C=O.n(m),g=O("q1tI"),T=O.n(g),B=O("ErOA"),F=O("NFKh"),J=O.n(F),H=O("7Cbv"),K=O("9kvl"),Y=O("mxV5"),W=O.n(Y),U=c.a.Dragger,_=function(he){var le="bf3c199c2470cb477d907b1e0917c17b",_e="5183666c72eec9e4",se=J.a.enc.Utf8.parse(le),be=J.a.enc.Utf8.parse(_e),j=J.a.AES.decrypt(he,se,{iv:be,mode:J.a.mode.CBC});return j.toString(J.a.enc.Utf8)},te,q=function(){var ne=Object(h.a)(C.a.mark(function he(le){var _e,se,be,j,Q,L,re,de,ee,xe,Ne;return C.a.wrap(function(Ge){for(;;)switch(Ge.prev=Ge.next){case 0:return re=le.identifier,de=le.oldFilename,ee=le.newFilename,Ge.next=3,Object(B.a)("/api/buckets/get_upload_token_for_big_files.json",{method:"get"});case 3:return xe=Ge.sent,xe.data=JSON.parse(_(xe.data)),Ne=new W.a({endpoint:xe==null||((_e=xe.data)===null||_e===void 0)?void 0:_e.end_point,region:xe==null||((se=xe.data)===null||se===void 0)?void 0:se.region,accessKeyId:xe==null||((be=xe.data)===null||be===void 0)?void 0:be.access_key_id,accessKeySecret:xe==null||((j=xe.data)===null||j===void 0)?void 0:j.access_key_secret,bucket:xe==null||((Q=xe.data)===null||Q===void 0)?void 0:Q.bucket,stsToken:xe==null||((L=xe.data)===null||L===void 0)?void 0:L.security_token}),Ge.abrupt("return",new Promise(function(Qe,Te){console.log(11111,"".concat(re,"/").concat(de),"".concat(re,"/").concat(ee),xe.data),Ne.copy("/".concat(re,"/").concat(de),"/".concat(re,"/").concat(ee)).then(function(nt){console.log("\u62F7\u8D1D\u6210\u529F",nt)}).catch(function(nt){console.log(nt)})}));case 7:case"end":return Ge.stop()}},he)}));return function(le){return ne.apply(this,arguments)}}(),w=function(){var ne=Object(h.a)(C.a.mark(function he(le,_e,se){var be,j,Q,L,re,de,ee,xe,Ne,Le;return C.a.wrap(function(Qe){for(;;)switch(Qe.prev=Qe.next){case 0:return _e.file_name=le.name,Qe.next=3,Object(B.a)("/api/buckets/get_upload_token.json",{method:"get"});case 3:return ee=Qe.sent,console.log("decrypt(res.data):",_(ee.data)),ee.data=JSON.parse(_(ee.data)),xe=le.name.split("."),xe.pop(),Ne=_e.realFileName?xe:Object(H.a)(),Le=new W.a({endpoint:ee==null||((be=ee.data)===null||be===void 0)?void 0:be.end_point,region:ee==null||((j=ee.data)===null||j===void 0)?void 0:j.region,accessKeyId:ee==null||((Q=ee.data)===null||Q===void 0)?void 0:Q.access_key_id,accessKeySecret:ee==null||((L=ee.data)===null||L===void 0)?void 0:L.access_key_secret,bucket:ee==null||((re=ee.data)===null||re===void 0)?void 0:re.bucket,stsToken:ee==null||((de=ee.data)===null||de===void 0)?void 0:de.security_token}),Qe.abrupt("return",new Promise(function(Te,nt){var Ye;Le.multipartUpload("".concat(Ne),new Blob([le],{type:le.type}),Object(v.a)(Object(v.a)({timeout:200*1e3,partSize:102400},se),{},{callback:{url:ee==null||((Ye=ee.data)===null||Ye===void 0)?void 0:Ye.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(B.e)(_e)}})).then(function(Pe){var ke;le.response=(ke=Pe.data)===null||ke===void 0?void 0:ke.data,Te(Pe==null?void 0:Pe.data)}).catch(function(Pe){nt(Pe),console.log("err:",Pe)})}));case 11:case"end":return Qe.stop()}},he)}));return function(le,_e,se){return ne.apply(this,arguments)}}(),X=function(he){var le=he.user,_e=he.cancelUpload,se=Object(x.a)(he,["user","cancelUpload"]),be=Object(g.useState)([]),j=Object(A.a)(be,2),Q=j[0],L=j[1],re=Object(g.useState)(),de=Object(A.a)(re,2),ee=de[0],xe=de[1],Ne={onRemove:function(Qe){L(Object(D.a)(Q.filter(function(Te){return Te.name!==Qe.name}))),se.onChange(Q.filter(function(Te){return Te.name!==Qe.name}))},disabled:se.disabled,multiple:!0,fileList:Q==null?void 0:Q.map(function(Ge){return Ge.file}),customRequest:function(){},beforeUpload:function(){var Ge=Object(h.a)(C.a.mark(function Te(nt){var Ye;return C.a.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:if(Ye=se.maxSize||1024*1024*1024*1,!Q.filter(function(Be){return Be.name===nt.name}).length){ke.next=4;break}return M.b.info("".concat(nt.name,"\u5DF2\u5B58\u5728\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9")),ke.abrupt("return");case 4:if(!((nt==null?void 0:nt.size)>Ye)){ke.next=7;break}return M.b.info("\u6587\u4EF6\u8D85\u8FC7".concat(Ye/1024/1024/1024,"GB\uFF0C\u4E0D\u7B26\u5408\u4E0A\u4F20\u8981\u6C42")),ke.abrupt("return",!1);case 7:return Q.push({name:nt.name,file:nt}),L(Object(D.a)(Q)),se.onChange(Q),ke.abrupt("return",!1);case 11:case"end":return ke.stop()}},Te)}));function Qe(Te){return Ge.apply(this,arguments)}return Qe}()},Le=function(){var Ge=Object(h.a)(C.a.mark(function Qe(Te,nt){var Ye,Pe,ke,Be,ot,ve,ge,$e,pe,Z;return C.a.wrap(function($){for(;;)switch($.prev=$.next){case 0:return nt.file_name=Te.name,ge=Te.name,$.next=4,Object(B.a)("/api/buckets/get_upload_token_for_big_files.json",{method:"get"});case 4:if($e=$.sent,$e.data=JSON.parse(_($e.data)),!(($e==null?void 0:$e.status)!==0)){$.next=12;break}return Q[Q.findIndex(function(Re){return Re.name===ge})].status="error",Q[Q.findIndex(function(Re){return Re.name===ge})].file.status="error",se.onChange(Q),M.b.warn("\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u5C1D\u8BD5"),$.abrupt("return");case 12:return ee=new W.a({endpoint:$e==null||((Ye=$e.data)===null||Ye===void 0)?void 0:Ye.end_point,region:$e==null||((Pe=$e.data)===null||Pe===void 0)?void 0:Pe.region,accessKeyId:$e==null||((ke=$e.data)===null||ke===void 0)?void 0:ke.access_key_id,accessKeySecret:$e==null||((Be=$e.data)===null||Be===void 0)?void 0:Be.access_key_secret,bucket:$e==null||((ot=$e.data)===null||ot===void 0)?void 0:ot.bucket,stsToken:$e==null||((ve=$e.data)===null||ve===void 0)?void 0:ve.security_token}),console.log(Te,"file"),xe(ee),pe=Te.name.split("."),pe.pop(),Z=nt.realFileName?pe:Object(H.a)(),$.abrupt("return",new Promise(function(Re,Ae){try{var Xe;ee.multipartUpload("".concat(se.identifier,"/").concat(Z).concat(ge.indexOf(".")>-1?"."+ge.split(".").pop():""),new Blob([Te.file],{type:Te.file.type}),{timeout:3600*1e3,partSize:1002400,progress:function(lt,bt,Tt){try{console.log("\u8FDB\u5EA6",lt,bt,Tt);var xt=Q.findIndex(function(Et){return Et.name===ge});Q[xt].file.percent=lt*100,Q[xt].tempCheckpoint=bt,L(Object(D.a)(Q))}catch(Et){}},checkpoint:Q[Q.findIndex(function(rt){return rt.name===ge})].tempCheckpoint,callback:{customValue:{id:ge+""},url:$e==null||((Xe=$e.data)===null||Xe===void 0)?void 0:Xe.callback_url,host:$e==null?void 0:$e.data.bucket_host,body:"bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&my_var=${x:my_var}&"+Object(B.e)(nt)}}).then(function(rt){var lt,bt=Q.findIndex(function(at){return at.name===ge}),Tt="done";if(((lt=rt.data)===null||lt===void 0?void 0:lt.status)===0){var xt;Te.response=(xt=rt.data)===null||xt===void 0?void 0:xt.data;var Et=Q.findIndex(function(at){return at.name===ge});Q[Et].status="done",Q[Et].file.status="done"}else{var Nt;M.b.warn((Nt=rt.data)===null||Nt===void 0?void 0:Nt.message),Tt="error"}Q[bt].status=Tt,Q[bt].file.status=Tt,se.onChange(Q),Re(rt==null?void 0:rt.data)}).catch(function(rt){Q[Q.findIndex(function(lt){return lt.name===ge})].status="error",Q[Q.findIndex(function(lt){return lt.name===ge})].file.status="error",M.b.warn("\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u5C1D\u8BD5"),L(Object(D.a)(Q)),se.onChange(Q),Ae(rt),console.log("err:",rt)})}catch(rt){}}));case 19:case"end":return $.stop()}},Qe)}));return function(Te,nt){return Ge.apply(this,arguments)}}();return Object(g.useEffect)(function(){Q.every(function(Ge){return Ge==="done"||Ge==="error"})&&se.onComplete(Q)},[Q]),Object(g.useEffect)(function(){if(_e){var Ge;(Ge=ee)===null||Ge===void 0||Ge.cancel()}},[_e]),Object(g.useEffect)(function(){se.uploading&&Q.map(function(){var Ge=Object(h.a)(C.a.mark(function Qe(Te){var nt,Ye;return C.a.wrap(function(ke){for(;;)switch(ke.prev=ke.next){case 0:if(!((!Te.status||Te.status==="error")&&!_e)){ke.next=6;break}return Te.status="uploading",Te.file.status="uploading",ke.next=5,Le(Te,{login:le==null||((nt=le.userInfo)===null||nt===void 0)?void 0:nt.login,container_type:se.container_type,container_id:se.container_id,description:se.description,realFileName:se.realFileName});case 5:Ye=ke.sent;case 6:case"end":return ke.stop()}},Qe)}));return function(Qe){return Ge.apply(this,arguments)}}())},[se.uploading]),T.a.createElement(U,Object(y.a)({},Ne,{height:se.height,className:se.className}),T.a.createElement("p",{className:"ant-upload-hint"},se.text||"\u62D6\u62FD\u6587\u4EF6\u6216\u8005\u70B9\u51FB\u4E0A\u4F20"))};V.b=Object(K.a)(function(ne){var he=ne.loading,le=ne.globalSetting,_e=ne.user;return{globalSetting:le,loading:he.models.competitions,user:_e}})(X)},KmYQ:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("OLod"))})(this,function(y){return y.pad.ZeroPadding={pad:function(l,M){var D=M*4;l.clamp(),l.sigBytes+=D-(l.sigBytes%D||D)},unpad:function(l){for(var M=l.words,D=l.sigBytes-1,D=l.sigBytes-1;D>=0;D--)if(M[D>>>2]>>>24-D%4*8&255){l.sigBytes=D+1;break}}},y.pad.ZeroPadding})},MlIO:function(d,V,O){(function(y,l){d.exports=V=l(O("Ib8C"))})(this,function(y){return function(l){var M=y,D=M.lib,A=D.Base,x=D.WordArray,v=M.x64={},h=v.Word=A.extend({init:function(c,m){this.high=c,this.low=m}}),p=v.WordArray=A.extend({init:function(c,m){c=this.words=c||[],m!=l?this.sigBytes=m:this.sigBytes=c.length*8},toX32:function(){for(var c=this.words,m=c.length,C=[],g=0;g<m;g++){var T=c[g];C.push(T.high),C.push(T.low)}return x.create(C,this.sigBytes)},clone:function(){for(var c=A.clone.call(this),m=c.words=this.words.slice(0),C=m.length,g=0;g<C;g++)m[g]=m[g].clone();return c}})}(),y})},NFKh:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("MlIO"),O("F+F2"),O("qM6L"),O("ETIr"),O("wbyO"),O("cv67"),O("3y9D"),O("lPiR"),O("GRuw"),O("1uat"),O("uGsb"),O("5hvy"),O("ELcG"),O("WYAk"),O("e7zE"),O("K3mO"),O("OLod"),O("ALsQ"),O("9OqN"),O("qu8F"),O("S6kV"),O("gb/T"),O("qBft"),O("oRuE"),O("jO9C"),O("KmYQ"),O("uGxW"),O("bQjk"),O("wZgz"),O("pA7S"),O("w7YG"),O("E4JC"),O("PVpz"))})(this,function(y){return y})},OLES:function(d,V,O){"use strict";var y=O("U8pU"),l=O("VTBJ"),M=O("Ff2n"),D=O("q1tI"),A=O("uciX"),x=O("7ixt"),v=function(g){var T=g.overlay,B=g.prefixCls,F=g.id,J=g.overlayInnerStyle;return D.createElement("div",{className:"".concat(B,"-inner"),id:F,role:"tooltip",style:J},typeof T=="function"?T():T)},h=v,p=function(g,T){var B=g.overlayClassName,F=g.trigger,J=F===void 0?["hover"]:F,H=g.mouseEnterDelay,K=H===void 0?0:H,Y=g.mouseLeaveDelay,W=Y===void 0?.1:Y,U=g.overlayStyle,_=g.prefixCls,te=_===void 0?"rc-tooltip":_,q=g.children,w=g.onVisibleChange,X=g.afterVisibleChange,ne=g.transitionName,he=g.animation,le=g.placement,_e=le===void 0?"right":le,se=g.align,be=se===void 0?{}:se,j=g.destroyTooltipOnHide,Q=j===void 0?!1:j,L=g.defaultVisible,re=g.getTooltipContainer,de=g.overlayInnerStyle,ee=Object(M.a)(g,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),xe=Object(D.useRef)(null);Object(D.useImperativeHandle)(T,function(){return xe.current});var Ne=Object(l.a)({},ee);"visible"in g&&(Ne.popupVisible=g.visible);var Le=function(){var Ye=g.arrowContent,Pe=Ye===void 0?null:Ye,ke=g.overlay,Be=g.id;return[D.createElement("div",{className:"".concat(te,"-arrow"),key:"arrow"},Pe),D.createElement(h,{key:"content",prefixCls:te,id:Be,overlay:ke,overlayInnerStyle:de})]},Ge=!1,Qe=!1;if(typeof Q=="boolean")Ge=Q;else if(Q&&Object(y.a)(Q)==="object"){var Te=Q.keepParent;Ge=Te===!0,Qe=Te===!1}return D.createElement(A.a,Object.assign({popupClassName:B,prefixCls:te,popup:Le,action:J,builtinPlacements:x.a,popupPlacement:_e,ref:xe,popupAlign:be,getPopupContainer:re,onPopupVisibleChange:w,afterPopupVisibleChange:X,popupTransitionName:ne,popupAnimation:he,defaultPopupVisible:L,destroyPopupOnHide:Ge,autoDestroy:Qe,mouseLeaveDelay:W,popupStyle:U,mouseEnterDelay:K},Ne),q)},c=Object(D.forwardRef)(p),m=V.a=c},OLod:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("K3mO"))})(this,function(y){y.lib.Cipher||function(l){var M=y,D=M.lib,A=D.Base,x=D.WordArray,v=D.BufferedBlockAlgorithm,h=M.enc,p=h.Utf8,c=h.Base64,m=M.algo,C=m.EvpKDF,g=D.Cipher=v.extend({cfg:A.extend(),createEncryptor:function(ne,he){return this.create(this._ENC_XFORM_MODE,ne,he)},createDecryptor:function(ne,he){return this.create(this._DEC_XFORM_MODE,ne,he)},init:function(ne,he,le){this.cfg=this.cfg.extend(le),this._xformMode=ne,this._key=he,this.reset()},reset:function(){v.reset.call(this),this._doReset()},process:function(ne){return this._append(ne),this._process()},finalize:function(ne){ne&&this._append(ne);var he=this._doFinalize();return he},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function ne(he){return typeof he=="string"?X:te}return function(he){return{encrypt:function(le,_e,se){return ne(_e).encrypt(he,le,_e,se)},decrypt:function(le,_e,se){return ne(_e).decrypt(he,le,_e,se)}}}}()}),T=D.StreamCipher=g.extend({_doFinalize:function(){var ne=this._process(!0);return ne},blockSize:1}),B=M.mode={},F=D.BlockCipherMode=A.extend({createEncryptor:function(ne,he){return this.Encryptor.create(ne,he)},createDecryptor:function(ne,he){return this.Decryptor.create(ne,he)},init:function(ne,he){this._cipher=ne,this._iv=he}}),J=B.CBC=function(){var ne=F.extend();ne.Encryptor=ne.extend({processBlock:function(le,_e){var se=this._cipher,be=se.blockSize;he.call(this,le,_e,be),se.encryptBlock(le,_e),this._prevBlock=le.slice(_e,_e+be)}}),ne.Decryptor=ne.extend({processBlock:function(le,_e){var se=this._cipher,be=se.blockSize,j=le.slice(_e,_e+be);se.decryptBlock(le,_e),he.call(this,le,_e,be),this._prevBlock=j}});function he(le,_e,se){var be,j=this._iv;j?(be=j,this._iv=l):be=this._prevBlock;for(var Q=0;Q<se;Q++)le[_e+Q]^=be[Q]}return ne}(),H=M.pad={},K=H.Pkcs7={pad:function(ne,he){for(var le=he*4,_e=le-ne.sigBytes%le,se=_e<<24|_e<<16|_e<<8|_e,be=[],j=0;j<_e;j+=4)be.push(se);var Q=x.create(be,_e);ne.concat(Q)},unpad:function(ne){var he=ne.words[ne.sigBytes-1>>>2]&255;ne.sigBytes-=he}},Y=D.BlockCipher=g.extend({cfg:g.cfg.extend({mode:J,padding:K}),reset:function(){var ne;g.reset.call(this);var he=this.cfg,le=he.iv,_e=he.mode;this._xformMode==this._ENC_XFORM_MODE?ne=_e.createEncryptor:(ne=_e.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==ne?this._mode.init(this,le&&le.words):(this._mode=ne.call(_e,this,le&&le.words),this._mode.__creator=ne)},_doProcessBlock:function(ne,he){this._mode.processBlock(ne,he)},_doFinalize:function(){var ne,he=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(he.pad(this._data,this.blockSize),ne=this._process(!0)):(ne=this._process(!0),he.unpad(ne)),ne},blockSize:128/32}),W=D.CipherParams=A.extend({init:function(ne){this.mixIn(ne)},toString:function(ne){return(ne||this.formatter).stringify(this)}}),U=M.format={},_=U.OpenSSL={stringify:function(ne){var he,le=ne.ciphertext,_e=ne.salt;return _e?he=x.create([1398893684,1701076831]).concat(_e).concat(le):he=le,he.toString(c)},parse:function(ne){var he,le=c.parse(ne),_e=le.words;return _e[0]==1398893684&&_e[1]==1701076831&&(he=x.create(_e.slice(2,4)),_e.splice(0,4),le.sigBytes-=16),W.create({ciphertext:le,salt:he})}},te=D.SerializableCipher=A.extend({cfg:A.extend({format:_}),encrypt:function(ne,he,le,_e){_e=this.cfg.extend(_e);var se=ne.createEncryptor(le,_e),be=se.finalize(he),j=se.cfg;return W.create({ciphertext:be,key:le,iv:j.iv,algorithm:ne,mode:j.mode,padding:j.padding,blockSize:ne.blockSize,formatter:_e.format})},decrypt:function(ne,he,le,_e){_e=this.cfg.extend(_e),he=this._parse(he,_e.format);var se=ne.createDecryptor(le,_e).finalize(he.ciphertext);return se},_parse:function(ne,he){return typeof ne=="string"?he.parse(ne,this):ne}}),q=M.kdf={},w=q.OpenSSL={execute:function(ne,he,le,_e){_e||(_e=x.random(64/8));var se=C.create({keySize:he+le}).compute(ne,_e),be=x.create(se.words.slice(he),le*4);return se.sigBytes=he*4,W.create({key:se,iv:be,salt:_e})}},X=D.PasswordBasedCipher=te.extend({cfg:te.cfg.extend({kdf:w}),encrypt:function(ne,he,le,_e){_e=this.cfg.extend(_e);var se=_e.kdf.execute(le,ne.keySize,ne.ivSize);_e.iv=se.iv;var be=te.encrypt.call(this,ne,he,se.key,_e);return be.mixIn(se),be},decrypt:function(ne,he,le,_e){_e=this.cfg.extend(_e),he=this._parse(he,_e.format);var se=_e.kdf.execute(le,ne.keySize,ne.ivSize,he.salt);_e.iv=se.iv;var be=te.decrypt.call(this,ne,he,se.key,_e);return be}})}()})},Og1z:function(d,V){(function(O){d.exports=function(){var y={887:function(){}},l={};function M(D){if(l[D])return l[D].exports;var A=l[D]={exports:{}},x=!0;try{y[D](A,A.exports,M),x=!1}finally{x&&delete l[D]}return A.exports}return M.ab=O+"/",M(887)}()}).call(this,"/")},PVpz:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("ETIr"),O("cv67"),O("K3mO"),O("OLod"))})(this,function(y){return function(){var l=y,M=l.lib,D=M.StreamCipher,A=l.algo,x=[],v=[],h=[],p=A.RabbitLegacy=D.extend({_doReset:function(){var m=this._key.words,C=this.cfg.iv,g=this._X=[m[0],m[3]<<16|m[2]>>>16,m[1],m[0]<<16|m[3]>>>16,m[2],m[1]<<16|m[0]>>>16,m[3],m[2]<<16|m[1]>>>16],T=this._C=[m[2]<<16|m[2]>>>16,m[0]&4294901760|m[1]&65535,m[3]<<16|m[3]>>>16,m[1]&4294901760|m[2]&65535,m[0]<<16|m[0]>>>16,m[2]&4294901760|m[3]&65535,m[1]<<16|m[1]>>>16,m[3]&4294901760|m[0]&65535];this._b=0;for(var B=0;B<4;B++)c.call(this);for(var B=0;B<8;B++)T[B]^=g[B+4&7];if(C){var F=C.words,J=F[0],H=F[1],K=(J<<8|J>>>24)&16711935|(J<<24|J>>>8)&4278255360,Y=(H<<8|H>>>24)&16711935|(H<<24|H>>>8)&4278255360,W=K>>>16|Y&4294901760,U=Y<<16|K&65535;T[0]^=K,T[1]^=W,T[2]^=Y,T[3]^=U,T[4]^=K,T[5]^=W,T[6]^=Y,T[7]^=U;for(var B=0;B<4;B++)c.call(this)}},_doProcessBlock:function(m,C){var g=this._X;c.call(this),x[0]=g[0]^g[5]>>>16^g[3]<<16,x[1]=g[2]^g[7]>>>16^g[5]<<16,x[2]=g[4]^g[1]>>>16^g[7]<<16,x[3]=g[6]^g[3]>>>16^g[1]<<16;for(var T=0;T<4;T++)x[T]=(x[T]<<8|x[T]>>>24)&16711935|(x[T]<<24|x[T]>>>8)&4278255360,m[C+T]^=x[T]},blockSize:128/32,ivSize:64/32});function c(){for(var m=this._X,C=this._C,g=0;g<8;g++)v[g]=C[g];C[0]=C[0]+1295307597+this._b|0,C[1]=C[1]+3545052371+(C[0]>>>0<v[0]>>>0?1:0)|0,C[2]=C[2]+886263092+(C[1]>>>0<v[1]>>>0?1:0)|0,C[3]=C[3]+1295307597+(C[2]>>>0<v[2]>>>0?1:0)|0,C[4]=C[4]+3545052371+(C[3]>>>0<v[3]>>>0?1:0)|0,C[5]=C[5]+886263092+(C[4]>>>0<v[4]>>>0?1:0)|0,C[6]=C[6]+1295307597+(C[5]>>>0<v[5]>>>0?1:0)|0,C[7]=C[7]+3545052371+(C[6]>>>0<v[6]>>>0?1:0)|0,this._b=C[7]>>>0<v[7]>>>0?1:0;for(var g=0;g<8;g++){var T=m[g]+C[g],B=T&65535,F=T>>>16,J=((B*B>>>17)+B*F>>>15)+F*F,H=((T&4294901760)*T|0)+((T&65535)*T|0);h[g]=J^H}m[0]=h[0]+(h[7]<<16|h[7]>>>16)+(h[6]<<16|h[6]>>>16)|0,m[1]=h[1]+(h[0]<<8|h[0]>>>24)+h[7]|0,m[2]=h[2]+(h[1]<<16|h[1]>>>16)+(h[0]<<16|h[0]>>>16)|0,m[3]=h[3]+(h[2]<<8|h[2]>>>24)+h[1]|0,m[4]=h[4]+(h[3]<<16|h[3]>>>16)+(h[2]<<16|h[2]>>>16)|0,m[5]=h[5]+(h[4]<<8|h[4]>>>24)+h[3]|0,m[6]=h[6]+(h[5]<<16|h[5]>>>16)+(h[4]<<16|h[4]>>>16)|0,m[7]=h[7]+(h[6]<<8|h[6]>>>24)+h[5]|0}l.RabbitLegacy=D._createHelper(p)}(),y.RabbitLegacy})},"Re/O":function(d,V,O){"use strict";(function(y,l,M){O.d(V,"a",function(){return Nr}),O.d(V,"b",function(){return _n}),O.d(V,"c",function(){return qo}),O.d(V,"d",function(){return vl}),O.d(V,"e",function(){return qc}),O.d(V,"f",function(){return zp}),O.d(V,"g",function(){return Gc}),O.d(V,"h",function(){return hn}),O.d(V,"i",function(){return Da}),O.d(V,"j",function(){return ps}),O.d(V,"k",function(){return fs}),O.d(V,"l",function(){return Vc}),O.d(V,"m",function(){return On}),O.d(V,"n",function(){return ei}),O.d(V,"o",function(){return Dl}),O.d(V,"p",function(){return Up}),O.d(V,"q",function(){return yu}),O.d(V,"r",function(){return bl}),O.d(V,"s",function(){return ml}),O.d(V,"t",function(){return Qo}),O.d(V,"u",function(){return hu}),O.d(V,"v",function(){return Ln}),O.d(V,"w",function(){return bu}),O.d(V,"x",function(){return ba}),O.d(V,"y",function(){return It}),O.d(V,"z",function(){return fl}),O.d(V,"A",function(){return Kc}),O.d(V,"B",function(){return no}),O.d(V,"C",function(){return gl}),O.d(V,"D",function(){return zo}),O.d(V,"E",function(){return jn}),O.d(V,"F",function(){return Ao}),O.d(V,"G",function(){return Ur}),O.d(V,"H",function(){return Qn}),O.d(V,"I",function(){return Zn}),O.d(V,"J",function(){return Za}),O.d(V,"K",function(){return kn}),O.d(V,"L",function(){return Rr}),O.d(V,"M",function(){return eo}),O.d(V,"N",function(){return Cl}),O.d(V,"O",function(){return xa}),O.d(V,"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 D=function(n,r){return(D=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 A(n,r){function e(){this.constructor=n}D(n,r),n.prototype=r===null?Object.create(r):(e.prototype=r.prototype,new e)}function x(n,r,e,t){return new(e||(e=Promise))(function(o,a){function i(f){try{u(t.next(f))}catch(E){a(E)}}function s(f){try{u(t.throw(f))}catch(E){a(E)}}function u(f){f.done?o(f.value):new e(function(E){E(f.value)}).then(i,s)}u((t=t.apply(n,r||[])).next())})}function v(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(E){if(e)throw new TypeError("Generator is already executing.");for(;i;)try{if(e=1,t&&(o=2&E[0]?t.return:E[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,E[1])).done)return o;switch(t=0,o&&(E=[2&E[0],o.value]),E[0]){case 0:case 1:o=E;break;case 4:return i.label++,{value:E[1],done:!1};case 5:i.label++,t=E[1],E=[0];continue;case 7:E=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(E[0]===6||E[0]===2)){i=0;continue}if(E[0]===3&&(!o||E[1]>o[0]&&E[1]<o[3])){i.label=E[1];break}if(E[0]===6&&i.label<o[1]){i.label=o[1],o=E;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(E);break}o[2]&&i.ops.pop(),i.trys.pop();continue}E=r.call(n,i)}catch(I){E=[6,I],t=0}finally{e=o=0}if(5&E[0])throw E[1];return{value:E[0]?E[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 p(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,E){if((E=E.toLowerCase())==="true"||E==="false")return E==="true";if(""+ +E===E)return+E;throw new Error("Could not parse value flag value "+E+" for flag "+f+".")}(s,u)})}},n}();function p(n,r,e){n[decodeURIComponent(r)]=decodeURIComponent(e||"")}function c(){return m}var m=null,C=new Map,g=new Map;function T(n,r){var e=W(n,r);return C.get(e)}function B(n){return g.get(n)}function F(n){for(var r=C.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 J(n){var r=n.kernelName,e=n.backendName,t=W(r,e);if(C.has(t))throw new Error("The kernel '"+r+"' for backend '"+e+"' is already registered");C.set(t,n)}function H(n){var r=n.kernelName;g.has(r)&&console.warn("Overriding the gradient for '"+r+"'"),g.set(r,n)}function K(n,r){var e=W(n,r);if(!C.has(e))throw new Error("The kernel '"+n+"' for backend '"+r+"' is not registered");C.delete(e)}function Y(n){if(!g.has(n))throw new Error("The gradient '"+n+"' for backend is not registered");g.delete(n)}function W(n,r){return r+"_"+n}function U(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 _(n,r,e){return Math.max(n,Math.min(r,e))}function te(n){return n%2==0?n:n+1}function q(n){for(var r=0,e=0;e<n.length;e++)r+=n[e];return r}function w(n,r){if(!n)throw new Error(typeof r=="string"?r:r())}function X(n,r,e){e===void 0&&(e=""),w(_e(n,r),function(){return e+" Shapes "+n+" and "+r+" must match"})}function ne(n){w(n!=null,function(){return"The input to the tensor constructor must be a non-null value."})}function he(n,r,e){if(r===void 0&&(r=[]),e===void 0&&(e=!1),r==null&&(r=[]),Array.isArray(n)||Te(n)&&!e)for(var t=0;t<n.length;++t)he(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 se(n){return n%1==0}function be(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 j(n){var r=Math.ceil(Math.sqrt(n));return[r,Math.ceil(n/r)]}function Q(n,r){return r<=n.length?n:n+" ".repeat(r-n.length)}function L(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 re(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 w((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}),w(n.every(function(t){return se(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 xe(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 Ne(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 Ge(n){return n==="bool"||n==="complex64"||n==="float32"||n==="int32"||n==="string"}function Qe(n,r){return r!=="complex64"&&((r!=="float32"||n==="complex64")&&(r!=="int32"||n==="float32"||n==="complex64"))&&(r!=="bool"||n!=="bool")}function Te(n){return n instanceof Float32Array||n instanceof Int32Array||n instanceof Uint8Array}function nt(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 Ye(n){if(n==null)return 0;var r=0;return n.forEach(function(e){return r+=e.length}),r}function Pe(n){return typeof n=="string"||n instanceof String}function ke(n){return typeof n=="boolean"}function Be(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":Be(n)?"float32":Pe(n)?"string":ke(n)?"bool":"float32"}function ve(n){return!!(n&&n.constructor&&n.call&&n.apply)}function ge(n,r){for(var e=r;e<n;++e)if(n%e==0)return e;return n}function $e(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 pe(n,r,e){if(r==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(n)&&(n=he(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 Z(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 E=a.slice(1),I=E.reduce(function(P,G){return P*G});for(f=0;f<u;f++)s[f]=t(o+f*I,E,i)}return s}(0,n,r)}function k(n,r){for(var e=$(n,r),t=0;t<e.length;t++)e[t]=1;return e}function $(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 Re(){return c().platform.now()}function Ae(n){n.forEach(function(r){w(Number.isInteger(r)&&r>=0,function(){return"Tensor must have a shape comprised of positive integers but got shape ["+n+"]."})})}function Xe(n,r){return r===void 0&&(r="utf-8"),r=r||"utf-8",c().platform.encode(n,r)}function rt(n,r){return r===void 0&&(r="utf-8"),r=r||"utf-8",c().platform.decode(n,r)}function lt(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 bt(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 Tt=Object.freeze({shuffle:U,clamp:_,nearestLargerEven:te,sum:q,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:w,assertShapesMatch:X,assertNonNull:ne,flatten:he,sizeFromShape:le,isScalarShape:function(n){return n.length===0},arraysEqual:_e,isInt:se,tanh:be,sizeToSquarishShape:j,createShuffledIndices:function(n){for(var r=new Uint32Array(n),e=0;e<n;++e)r[e]=e;return U(r),r},rightPad:Q,repeatedTry:L,inferFromImplicitShape:re,parseAxisParam:de,squeezeShape:ee,getTypedArrayFromDType:xe,getArrayFromDType:Ne,checkConversionForErrors:Le,isValidDtype:Ge,hasEncodingLoss:Qe,isTypedArray:Te,bytesPerElement:nt,bytesFromStringArray:Ye,isString:Pe,isBoolean:ke,isNumber:Be,inferDtype:ot,isFunction:ve,nearestDivisor:ge,computeStrides:$e,toTypedArray:pe,toNestedArray:Z,makeOnesTypedArray:k,makeZerosTypedArray:$,now:Re,assertNonNegativeIntegerDimensions:Ae,fetch:function(n,r){return c().platform.fetch(n,r)},encodeString:Xe,decodeString:rt,locToIndex:lt,indexToLoc:bt}),xt=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,E,I){if(E!=="float32")return!1;for(var P=0;P<f.length;P++){var G=f[P];if(isNaN(G)||!isFinite(G))return console.warn("Found "+G+" in the result of '"+I+"'"),!0}}(u,s.dtype,r),i.then(function(f){var E="";f.getExtraProfileInfo!=null&&(E=f.getExtraProfileInfo()),a.logger.logKernelProfile(r,s,u,f.kernelMs,e,E)})})}),o},n}(),Et=function(){function n(){}return n.prototype.logKernelProfile=function(r,e,t,o,a,i){var s=typeof o=="number"?Q(o+"ms",9):o.error,u=Q(r,25),f=e.rank,E=e.size,I=Q(e.shape.toString(),14),P="";for(var G in a){var oe=a[G].shape||e.shape,ue=oe.length;P+=G+": "+ue+"D "+(ue>0?oe:"")+" "}console.log("%c"+u+" %c"+s+" %c"+f+"D "+I+" %c"+E+" %c"+P+" %c"+i,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")},n}(),Nt=20,at=3,Bt=7;function mr(n,r,e,t){var o=$e(r),a=function(f,E,I,P){var G=le(E),oe=P[P.length-1],ue=new Array(oe).fill(0),ie=E.length,ce=I==="complex64"?Lr(f):f;if(ie>1)for(var ye=0;ye<G/oe;ye++)for(var we=ye*oe,Ee=0;Ee<oe;Ee++)ue[Ee]=Math.max(ue[Ee],rr(ce[we+Ee],0,I).length);return ue}(n,r,e,o),i=r.length,s=function f(E,I,P,G,oe,ue){ue===void 0&&(ue=!0);var ie=P==="complex64"?2:1,ce=I[0],ye=I.length;if(ye===0)return P==="complex64"?[rr(Lr(E)[0],0,P)]:P==="bool"?[Sr(E[0])]:[E[0].toString()];if(ye===1){if(ce>Nt){var we=at*ie,Ee=Array.from(E.slice(0,we)),Se=Array.from(E.slice((ce-at)*ie,ce*ie));return P==="complex64"&&(Ee=Lr(Ee),Se=Lr(Se)),["["+Ee.map(function(st,pt){return rr(st,oe[pt],P)}).join(", ")+", ..., "+Se.map(function(st,pt){return rr(st,oe[ce-at+pt],P)}).join(", ")+"]"]}return["["+(P==="complex64"?Lr(E):Array.from(E)).map(function(st,pt){return rr(st,oe[pt],P)}).join(", ")+"]"]}var Me=I.slice(1),He=G.slice(1),Fe=G[0]*ie,je=[];if(ce>Nt){for(var Ue=0;Ue<at;Ue++){var Ze=(Je=Ue*Fe)+Fe;je.push.apply(je,f(E.slice(Je,Ze),Me,P,He,oe,!1))}for(je.push("..."),Ue=ce-at;Ue<ce;Ue++)Ze=(Je=Ue*Fe)+Fe,je.push.apply(je,f(E.slice(Je,Ze),Me,P,He,oe,Ue===ce-1))}else for(Ue=0;Ue<ce;Ue++){var Je;Ze=(Je=Ue*Fe)+Fe,je.push.apply(je,f(E.slice(Je,Ze),Me,P,He,oe,Ue===ce-1))}var dt=ye===2?",":"";for(je[0]="["+je[0]+dt,Ue=1;Ue<je.length-1;Ue++)je[Ue]=" "+je[Ue]+dt;var ct=`,
|
|
|
`;for(Ue=2;Ue<ye;Ue++)ct+=`
|
|
|
`;return je[je.length-1]=" "+je[je.length-1]+"]"+(ue?"":ct),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 Q(Array.isArray(n)?parseFloat(n[0].toFixed(Bt))+" + "+parseFloat(n[1].toFixed(Bt))+"j":Pe(n)?"'"+n+"'":e==="bool"?Sr(n):parseFloat(n.toFixed(Bt)).toString(),r)}function Sr(n){return n===0?"false":"true"}function Lr(n){for(var r=[],e=0;e<n.length;e+=2)r.push([n[e],n[e+1]]);return r}var Dr=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;w(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||Ne(e,this.size),this.strides=$e(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]),w(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,et=null,Xn=null,Nr=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=$e(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(),w(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(),et.cast(this,r)},Object.defineProperty(n.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),n.prototype.buffer=function(){return x(this,void 0,void 0,function(){var r;return v(this,function(e){switch(e.label){case 0:return[4,this.data()];case 1:return r=e.sent(),[2,et.buffer(this.shape,this.dtype,r)]}})})},n.prototype.bufferSync=function(){return et.buffer(this.shape,this.dtype,this.dataSync())},n.prototype.array=function(){return x(this,void 0,void 0,function(){var r;return v(this,function(e){switch(e.label){case 0:return[4,this.data()];case 1:return r=e.sent(),[2,Z(this.shape,r)]}})})},n.prototype.arraySync=function(){return Z(this.shape,this.dataSync())},n.prototype.data=function(){return x(this,void 0,void 0,function(){var r,e;return v(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 rt(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 rt(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 x(this,void 0,void 0,function(){var r;return v(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),et.print(this,r)},n.prototype.reshape=function(r){return this.throwIfDisposed(),et.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),et.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),et.cumsum(this,r,e,t)},n.prototype.squeeze=function(r){return this.throwIfDisposed(),et.squeeze(this,r)},n.prototype.clone=function(){return this.throwIfDisposed(),et.clone(this)},n.prototype.oneHot=function(r,e,t){return this.throwIfDisposed(),et.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(),et.tile(this,r)},n.prototype.gather=function(r,e){return e===void 0&&(e=0),this.throwIfDisposed(),et.gather(this,r,e)},n.prototype.matMul=function(r,e,t){return e===void 0&&(e=!1),t===void 0&&(t=!1),this.throwIfDisposed(),et.matMul(this,r,e,t)},n.prototype.dot=function(r){return this.throwIfDisposed(),et.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(),et.norm(this,r,e,t)},n.prototype.slice=function(r,e){return this.throwIfDisposed(),et.slice(this,r,e)},n.prototype.reverse=function(r){return this.throwIfDisposed(),et.reverse(this,r)},n.prototype.concat=function(r,e){return e===void 0&&(e=0),this.throwIfDisposed(),r instanceof n&&(r=[r]),et.concat([this].concat(r),e)},n.prototype.split=function(r,e){return e===void 0&&(e=0),this.throwIfDisposed(),et.split(this,r,e)},n.prototype.stack=function(r,e){return e===void 0&&(e=0),et.stack([this,r],e)},n.prototype.unstack=function(r){return r===void 0&&(r=0),et.unstack(this,r)},n.prototype.pad=function(r,e){return e===void 0&&(e=0),et.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(),et.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(),et.all(this,r,e)},n.prototype.any=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),et.any(this,r,e)},n.prototype.logSumExp=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),et.logSumExp(this,r,e)},n.prototype.sum=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),et.sum(this,r,e)},n.prototype.prod=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),et.prod(this,r,e)},n.prototype.mean=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),et.mean(this,r,e)},n.prototype.min=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),et.min(this,r,e)},n.prototype.max=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),et.max(this,r,e)},n.prototype.argMin=function(r){return r===void 0&&(r=null),this.throwIfDisposed(),et.argMin(this,r)},n.prototype.argMax=function(r){return r===void 0&&(r=null),this.throwIfDisposed(),et.argMax(this,r)},n.prototype.cast=function(r){return this.throwIfDisposed(),et.cast(this,r)},n.prototype.add=function(r){return this.throwIfDisposed(),et.add(this,r)},n.prototype.addStrict=function(r){return this.throwIfDisposed(),et.addStrict(this,r)},n.prototype.atan2=function(r){return this.throwIfDisposed(),et.atan2(this,r)},n.prototype.sub=function(r){return this.throwIfDisposed(),et.sub(this,r)},n.prototype.subStrict=function(r){return this.throwIfDisposed(),et.subStrict(this,r)},n.prototype.pow=function(r){return this.throwIfDisposed(),et.pow(this,r)},n.prototype.powStrict=function(r){return this.throwIfDisposed(),et.powStrict(this,r)},n.prototype.mul=function(r){return this.throwIfDisposed(),et.mul(this,r)},n.prototype.mulStrict=function(r){return this.throwIfDisposed(),et.mulStrict(this,r)},n.prototype.div=function(r){return this.throwIfDisposed(),et.div(this,r)},n.prototype.divNoNan=function(r){return this.throwIfDisposed(),et.divNoNan(this,r)},n.prototype.floorDiv=function(r){return this.throwIfDisposed(),et.floorDiv(this,r)},n.prototype.divStrict=function(r){return this.throwIfDisposed(),et.divStrict(this,r)},n.prototype.minimum=function(r){return this.throwIfDisposed(),et.minimum(this,r)},n.prototype.minimumStrict=function(r){return this.throwIfDisposed(),et.minimumStrict(this,r)},n.prototype.maximum=function(r){return this.throwIfDisposed(),et.maximum(this,r)},n.prototype.maximumStrict=function(r){return this.throwIfDisposed(),et.maximumStrict(this,r)},n.prototype.mod=function(r){return this.throwIfDisposed(),et.mod(this,r)},n.prototype.modStrict=function(r){return this.throwIfDisposed(),et.modStrict(this,r)},n.prototype.squaredDifferenceStrict=function(r){return this.throwIfDisposed(),et.squaredDifferenceStrict(this,r)},n.prototype.transpose=function(r){return this.throwIfDisposed(),et.transpose(this,r)},n.prototype.notEqual=function(r){return this.throwIfDisposed(),et.notEqual(this,r)},n.prototype.notEqualStrict=function(r){return this.throwIfDisposed(),et.notEqualStrict(this,r)},n.prototype.less=function(r){return this.throwIfDisposed(),et.less(this,r)},n.prototype.lessStrict=function(r){return this.throwIfDisposed(),et.lessStrict(this,r)},n.prototype.equal=function(r){return this.throwIfDisposed(),et.equal(this,r)},n.prototype.equalStrict=function(r){return this.throwIfDisposed(),et.equalStrict(this,r)},n.prototype.lessEqual=function(r){return this.throwIfDisposed(),et.lessEqual(this,r)},n.prototype.lessEqualStrict=function(r){return this.throwIfDisposed(),et.lessEqualStrict(this,r)},n.prototype.greater=function(r){return this.throwIfDisposed(),et.greater(this,r)},n.prototype.greaterStrict=function(r){return this.throwIfDisposed(),et.greaterStrict(this,r)},n.prototype.greaterEqual=function(r){return this.throwIfDisposed(),et.greaterEqual(this,r)},n.prototype.greaterEqualStrict=function(r){return this.throwIfDisposed(),et.greaterEqualStrict(this,r)},n.prototype.logicalAnd=function(r){return this.throwIfDisposed(),et.logicalAnd(this,r)},n.prototype.logicalOr=function(r){return this.throwIfDisposed(),et.logicalOr(this,r)},n.prototype.logicalNot=function(){return this.throwIfDisposed(),et.logicalNot(this)},n.prototype.logicalXor=function(r){return this.throwIfDisposed(),et.logicalXor(this,r)},n.prototype.where=function(r,e){return this.throwIfDisposed(),et.where(r,this,e)},n.prototype.neg=function(){return this.throwIfDisposed(),et.neg(this)},n.prototype.ceil=function(){return this.throwIfDisposed(),et.ceil(this)},n.prototype.floor=function(){return this.throwIfDisposed(),et.floor(this)},n.prototype.sign=function(){return this.throwIfDisposed(),et.sign(this)},n.prototype.isNaN=function(){return this.throwIfDisposed(),et.isNaN(this)},n.prototype.isInf=function(){return this.throwIfDisposed(),et.isInf(this)},n.prototype.isFinite=function(){return this.throwIfDisposed(),et.isFinite(this)},n.prototype.exp=function(){return this.throwIfDisposed(),et.exp(this)},n.prototype.expm1=function(){return this.throwIfDisposed(),et.expm1(this)},n.prototype.log=function(){return this.throwIfDisposed(),et.log(this)},n.prototype.log1p=function(){return this.throwIfDisposed(),et.log1p(this)},n.prototype.sqrt=function(){return this.throwIfDisposed(),et.sqrt(this)},n.prototype.rsqrt=function(){return this.throwIfDisposed(),et.rsqrt(this)},n.prototype.square=function(){return this.throwIfDisposed(),et.square(this)},n.prototype.reciprocal=function(){return this.throwIfDisposed(),et.reciprocal(this)},n.prototype.abs=function(){return this.throwIfDisposed(),et.abs(this)},n.prototype.clipByValue=function(r,e){return this.throwIfDisposed(),et.clipByValue(this,r,e)},n.prototype.relu=function(){return this.throwIfDisposed(),et.relu(this)},n.prototype.relu6=function(){return this.throwIfDisposed(),et.relu6(this)},n.prototype.elu=function(){return this.throwIfDisposed(),et.elu(this)},n.prototype.selu=function(){return this.throwIfDisposed(),et.selu(this)},n.prototype.leakyRelu=function(r){return r===void 0&&(r=.2),this.throwIfDisposed(),et.leakyRelu(this,r)},n.prototype.prelu=function(r){return this.throwIfDisposed(),et.prelu(this,r)},n.prototype.sigmoid=function(){return this.throwIfDisposed(),et.sigmoid(this)},n.prototype.logSigmoid=function(){return this.throwIfDisposed(),et.logSigmoid(this)},n.prototype.softplus=function(){return this.throwIfDisposed(),et.softplus(this)},n.prototype.zerosLike=function(){return this.throwIfDisposed(),et.zerosLike(this)},n.prototype.onesLike=function(){return this.throwIfDisposed(),et.onesLike(this)},n.prototype.sin=function(){return this.throwIfDisposed(),et.sin(this)},n.prototype.cos=function(){return this.throwIfDisposed(),et.cos(this)},n.prototype.tan=function(){return this.throwIfDisposed(),et.tan(this)},n.prototype.asin=function(){return this.throwIfDisposed(),et.asin(this)},n.prototype.acos=function(){return this.throwIfDisposed(),et.acos(this)},n.prototype.atan=function(){return this.throwIfDisposed(),et.atan(this)},n.prototype.sinh=function(){return this.throwIfDisposed(),et.sinh(this)},n.prototype.cosh=function(){return this.throwIfDisposed(),et.cosh(this)},n.prototype.tanh=function(){return this.throwIfDisposed(),et.tanh(this)},n.prototype.asinh=function(){return this.throwIfDisposed(),et.asinh(this)},n.prototype.acosh=function(){return this.throwIfDisposed(),et.acosh(this)},n.prototype.atanh=function(){return this.throwIfDisposed(),et.atanh(this)},n.prototype.erf=function(){return this.throwIfDisposed(),et.erf(this)},n.prototype.round=function(){return this.throwIfDisposed(),et.round(this)},n.prototype.step=function(r){return r===void 0&&(r=0),this.throwIfDisposed(),et.step(this,r)},n.prototype.softmax=function(r){return r===void 0&&(r=-1),this.throwIfDisposed(),et.softmax(this,r)},n.prototype.logSoftmax=function(r){return r===void 0&&(r=-1),this.throwIfDisposed(),et.logSoftmax(this,r)},n.prototype.resizeBilinear=function(r,e){return e===void 0&&(e=!1),this.throwIfDisposed(),et.image.resizeBilinear(this,r,e)},n.prototype.resizeNearestNeighbor=function(r,e){return e===void 0&&(e=!1),this.throwIfDisposed(),et.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(),et.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(),et.conv2d(this,r,e,t,o,a,i)},n.prototype.conv2dTranspose=function(r,e,t,o,a){return this.throwIfDisposed(),et.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(),et.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(),et.separableConv2d(this,r,e,t,o,a,i)},n.prototype.avgPool=function(r,e,t,o){return this.throwIfDisposed(),et.avgPool(this,r,e,t,o)},n.prototype.maxPool=function(r,e,t,o){return this.throwIfDisposed(),et.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),et.localResponseNormalization(this,r,e,t,o)},n.prototype.pool=function(r,e,t,o,a){return this.throwIfDisposed(),et.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(),et.unsortedSegmentSum(this,r,e)},n.prototype.batchToSpaceND=function(r,e){return this.throwIfDisposed(),et.batchToSpaceND(this,r,e)},n.prototype.spaceToBatchND=function(r,e){return this.throwIfDisposed(),et.spaceToBatchND(this,r,e)},n.prototype.topk=function(r,e){return r===void 0&&(r=1),e===void 0&&(e=!0),this.throwIfDisposed(),et.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(),et.stridedSlice(this,r,e,t,o,a,i,s,u)},n.prototype.depthToSpace=function(r,e){return this.throwIfDisposed(),et.depthToSpace(this,r,e)},n.prototype.fft=function(){return this.throwIfDisposed(),et.spectral.fft(this)},n.prototype.ifft=function(){return this.throwIfDisposed(),et.spectral.ifft(this)},n.prototype.rfft=function(){return this.throwIfDisposed(),et.spectral.rfft(this)},n.prototype.irfft=function(){return this.throwIfDisposed(),et.spectral.irfft(this)},n}();Object.defineProperty(Nr,Symbol.hasInstance,{value:function(n){return!!n&&n.dataId!=null&&n.shape!=null&&n.dtype!=null}});var No,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 A(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}(Nr);Object.defineProperty(_n,Symbol.hasInstance,{value:function(n){return n instanceof Nr&&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"}(No||(No={})),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){w(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 Nr)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 x(this,void 0,void 0,function(){var r,e,t;return v(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 x(this,void 0,void 0,function(){var e,t,o;return v(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 xt(this.backendInstance),[2,!0]}})})},n.prototype.setupRegisteredKernels=function(){var r=this;F(this.backendName).forEach(function(e){e.setupFunc!=null&&e.setupFunc(r.backendInstance)})},n.prototype.disposeRegisteredKernels=function(r){var e=this;F(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 E=[],I=this.isTapeOn();o==null&&(o=this.state.activeScope!=null?this.state.activeScope.name:"");var P,G=function(ye){I&&(E=ye.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 ie,ce=T(o,this.backendName);return P=ce!=null?function(){var ye=f.backend.numDataIds();ie=ce.kernelFunc({inputs:e,attrs:a,backend:f.backend});var we=Array.isArray(ie)?ie:[ie];f.shouldCheckForMemLeaks()&&f.checkKernelForMemLeak(o,ye,we);var Ee=we.map(function(Me){var He=Me.dataId,Fe=Me.shape,je=Me.dtype;return f.makeTensorFromDataId(He,Fe,je)}),Se=Ee.filter(function(Me,He){return s[He]});return G((i||[]).slice().concat(Se)),Ee}:function(){var ye=f.backend.numDataIds();ie=f.tidy(function(){return r(f.backend,G)});var we=Array.isArray(ie)?ie:[ie];return f.shouldCheckForMemLeaks()&&f.checkKernelForMemLeak(o,ye,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 P()}):P()}),I&&this.addTapeNode(o,e,u,t,E),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(ye){return e[ye].shape}),outputShapes:u.map(function(ye){return ye.shape})}),Array.isArray(ie)?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"&&Pe(r[0])&&(a=r.map(function(E){return Xe(E)}));var i=o.write(a,e,t),s=new Nr(e,t,i,this.nextTensorId());if(this.incRef(s,o),t==="string"){var u=this.state.tensorInfo.get(i),f=Ye(a);this.state.numBytes+=f-u.bytes,u.bytes=f}return s},n.prototype.makeTensorFromDataId=function(r,e,t,o){var a=new Nr(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*nt(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 x(this,void 0,void 0,function(){var e,t;return v(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=B(r);u!=null&&(o=u.gradFunc),o!=null&&(s.gradient=function(f){return f=f.map(function(E,I){if(E==null){var P=t[I],G=$(P.size,P.dtype);return i.makeTensor(G,P.shape,P.dtype)}return E}),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),w(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)});w(i instanceof Nr,function(){return"The result y returned by f() must be a tensor."});var s=function(u,f,E){for(var I={},P={},G=0;G<f.length;G++)I[f[G].id]=!0;for(G=0;G<u.length;G++){var oe=(Me=u[G]).inputs;for(var ue in oe){for(var ie=oe[ue],ce=!1,ye=0;ye<f.length;ye++)if(I[ie.id]){Me.outputs.forEach(function(Ue){return I[Ue.id]=!0}),ce=!0,P[Me.id]=!0;break}if(ce)break}}var we={};we[E.id]=!0;var Ee={};for(G=u.length-1;G>=0;G--)for(oe=(Me=u[G]).inputs,ye=0;ye<Me.outputs.length;ye++)if(we[Me.outputs[ye].id]){for(var ue in oe)we[oe[ue].id]=!0,Ee[Me.id]=!0;break}var Se=[];for(G=0;G<u.length;G++){var Me;if(P[(Me=u[G]).id]&&Ee[Me.id]){var He={};for(var ue in Me.inputs){var Fe=Me.inputs[ue];I[Fe.id]&&(He[ue]=Fe)}var je=Object.assign({},Me);je.inputs=He,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,E={};E[i.id]=t==null?(u=i.shape,f=k(le(u),"float32"),Ve.makeTensor(f,u,"float32")):t,function(P,G,oe){for(var ue=function(ce){var ye=G[ce],we=[];if(ye.outputs.forEach(function(He){var Fe=P[He.id];Fe!=null?we.push(Fe):we.push(null)}),ye.gradient==null)throw new Error("Cannot compute gradient: gradient function not found for "+ye.kernelName+".");var Ee=ye.gradient(we),Se=function(He){if(!(He in Ee))throw new Error("Cannot backprop through input "+He+". Available gradients found: "+Object.keys(Ee)+".");var Fe=oe(function(){return Ee[He]()});if(Fe.dtype!=="float32")throw new Error("Error in gradient for op "+ye.kernelName+". The gradient of input "+He+" must have 'float32' dtype, but has '"+Fe.dtype+"'");var je=ye.inputs[He];if(!_e(Fe.shape,je.shape))throw new Error("Error in gradient for op "+ye.kernelName+". The gradient of input '"+He+"' has shape '"+Fe.shape+"', which does not match the shape of the input '"+je.shape+"'");if(P[je.id]==null)P[je.id]=Fe;else{var Ue=P[je.id];P[je.id]=Ue.add(Fe),Ue.dispose()}};for(var Me in ye.inputs)Se(Me)},ie=G.length-1;ie>=0;ie--)ue(ie)}(E,s,function(P){return a.tidy(P)});var I=e.map(function(P){return E[P.id]});return a.state.gradientDepth===0&&(a.state.activeTape.forEach(function(P){for(var G=0,oe=P.saved;G<oe.length;G++)oe[G].dispose()}),a.state.activeTape=null),{value:i,grads:I}})},n.prototype.customGrad=function(r){var e=this;return w(ve(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];w(o.every(function(s){return s instanceof Nr}),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 w((t=r.apply(void 0,o.concat([u]))).value instanceof Nr,function(){return"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"}),w(ve(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),E=Array.isArray(f)?f:[f];w(E.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(...)."}),w(E.every(function(P){return P instanceof Nr}),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 I={};return E.forEach(function(P,G){I[G]=function(){return P}}),I})}},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 x(this,void 0,void 0,function(){var e,t;return v(this,function(o){switch(o.label){case 0:return e=Re(),[4,this.backend.time(r)];case 1:return(t=o.sent()).wallMs=Re()-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 l!="undefined")e=l;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){m=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=c();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 l!="undefined"&&l.versions!==void 0&&l.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 j(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,E,I=n;return c().getNumber("WEBGL_VERSION")===2?(e=I.R32F,t=I.R16F,o=I.RGBA16F,a=I.RGBA32F,i=I.RED,s=4,u=1,f=I.HALF_FLOAT,E=I.FLOAT):(e=n.RGBA,t=n.RGBA,o=n.RGBA,a=I.RGBA,i=n.RGBA,s=4,u=4,f=r!=null?r.HALF_FLOAT_OES:null,E=n.FLOAT),{internalFormatFloat:e,internalFormatHalfFloat:t,internalFormatPackedHalfFloat:o,internalFormatPackedFloat:a,textureFormatFloat:i,downloadTextureFormat:n.RGBA,downloadUnpackNumChannels:s,defaultNumChannels:u,textureTypeHalfFloat:f,textureTypeFloat:E}}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!!(c().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 Lo(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,E=u.map(function(ie,ce){return Q((ce+1).toString(),f)+ie}),I=0,P=0;P<E.length;P++)I=Math.max(E[P].length,I);var G=E.slice(0,s-1),oe=E.slice(s-1,s),ue=E.slice(s);console.log(G.join(`
|
|
|
`)),console.log(a.split(`
|
|
|
`)[0]),console.log("%c "+Q(oe[0],I),"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=c().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=c().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(r&&(t*=2,(n=n.map(function(f,E){return E>=n.length-2?te(n[E]):n[E]})).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]),j(a=i*(s/2)*(u/2)).map(function(f){return 2*f})}return j(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 jo(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 Di(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 Ni(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:Lo,createVertexShader:ws,createFragmentShader:gn,createProgram:an,linkProgram:yn,validateProgram:Jn,createStaticVertexBuffer:na,createStaticIndexBuffer:Xa,getNumChannels:function(){return c().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:jo,hasExtension:Jr,isWebGLVersionEnabled:la,isCapableOfRenderingToFloatTexture:Di,isDownloadFloatTextureEnabled:Ni,isWebGLFenceEnabled:ki}),Lt=c();function Mi(){c().set("PROD",!0)}function qu(){c().set("DEBUG",!0)}function Qu(){c().set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")}function Pi(n){c().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(n+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}function Zu(){Ve.disposeVariables()}function Fo(){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 Li(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){c().setPlatform(n,r)}function da(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];c().getBool("IS_TEST")||console.warn.apply(console,n)}function bn(n,r){var e=n;if(Te(n))return r==="string"?[]:[n.length];if(!Array.isArray(n))return[];for(var t=[];Array.isArray(e)||Te(e)&&r!=="string";)t.push(e.length),e=e[0];return Array.isArray(n)&&c().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&function o(a,i,s){if(s=s||[],!Array.isArray(a)&&!Te(a))return void w(i.length===0,function(){return"Element arr["+s.join("][")+"] is a primitive, but should be an array/TypedArray of "+i[0]+" elements"});w(i.length>0,function(){return"Element arr["+s.join("][")+"] should be a primitive, but is an array of "+a.length+" elements"}),w(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 Nr)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||!Te(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);Te(n)||Array.isArray(n)||(n=[n]);var s=o!=="string"?pe(n,o,c().getBool("DEBUG")):he(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 ji(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){w(ji(r,e),function(){return n+" supports only inner-most axes for now. Got axes "+r+" and rank-"+e+" input."})}function sn(n,r){if(ji(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 Fi(n,r){var e=n[0].length;n.forEach(function(o,a){w(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+")"})}),w(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++)w(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 Ke(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}Lt.registerFlag("HAS_WEBGL",function(){return Lt.getNumber("WEBGL_VERSION")>0}),Lt.registerFlag("WEBGL_VERSION",function(){return la(2)?2:la(1)?1:0}),Lt.registerFlag("WEBGL_BUFFER_SUPPORTED",function(){return Lt.get("WEBGL_VERSION")===2}),Lt.registerFlag("WEBGL_CPU_FORWARD",function(){return!0}),Lt.registerFlag("WEBGL_FORCE_F16_TEXTURES",function(){return!1}),Lt.registerFlag("WEBGL_PACK",function(){return Lt.getBool("HAS_WEBGL")}),Lt.registerFlag("WEBGL_PACK_NORMALIZATION",function(){return Lt.getBool("WEBGL_PACK")}),Lt.registerFlag("WEBGL_PACK_CLIP",function(){return Lt.getBool("WEBGL_PACK")}),Lt.registerFlag("WEBGL_PACK_DEPTHWISECONV",function(){return!1}),Lt.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",function(){return Lt.getBool("WEBGL_PACK")}),Lt.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",function(){return Lt.getBool("WEBGL_PACK")}),Lt.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",function(){return Lt.getBool("WEBGL_PACK")}),Lt.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",function(){return Lt.getBool("WEBGL_PACK")}),Lt.registerFlag("WEBGL_PACK_REDUCE",function(){return Lt.getBool("WEBGL_PACK")}),Lt.registerFlag("WEBGL_LAZILY_UNPACK",function(){return Lt.getBool("WEBGL_PACK")}),Lt.registerFlag("WEBGL_CONV_IM2COL",function(){return Lt.getBool("WEBGL_PACK")}),Lt.registerFlag("WEBGL_MAX_TEXTURE_SIZE",function(){return Ii(Lt.getNumber("WEBGL_VERSION"))}),Lt.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",function(){return ca(Lt.getNumber("WEBGL_VERSION"))}),Lt.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",function(){var n=Lt.getNumber("WEBGL_VERSION");return n===0?0:jo(n)}),Lt.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",function(){return Lt.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}),Lt.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",function(){return Di(Lt.getNumber("WEBGL_VERSION"))}),Lt.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",function(){return!Lt.getBool("WEBGL_FORCE_F16_TEXTURES")&&Lt.getBool("WEBGL_RENDER_FLOAT32_CAPABLE")}),Lt.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",function(){return Ni(Lt.getNumber("WEBGL_VERSION"))}),Lt.registerFlag("WEBGL_FENCE_API_ENABLED",function(){return ki(Lt.getNumber("WEBGL_VERSION"))}),Lt.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",function(){return Lt.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0}),Xn=Pi;var xr=Ke({complex_:function(n,r){var e=Oe(n,"real","complex"),t=Oe(r,"imag","complex");return X(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=Ke({real_:function(n){var r=Oe(n,"input","real");return Ve.runKernelFunc(function(e){return e.real(r)},{$input:r})}}),xn=Ke({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 Nn(n,r,bn(n,e),e)}function Nn(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(!Te(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){Ae(r);var o=le(r),a=le(e);w(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));w(e[i]===r[i]||!u,function(){return"Error creating a new Tensor. Inferred shape ("+e+") does not match the provided shape ("+r+"). "})}}return Te(n)||Array.isArray(n)||(n=[n]),r=r||e,n=t!=="string"?pe(n,t,c().getBool("DEBUG")):he(n,[],!0),Ve.makeTensor(n,r,t)}function It(n,r){if((Te(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"&&Te(n)&&!(n instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return Nn(n,[],[],r)}function Qn(n,r){ne(n);var e=bn(n,r);if(e.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return Nn(n,null,e,r)}function Zn(n,r,e){if(ne(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 Nn(n,r,t,e)}function Za(n,r,e){if(ne(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 Nn(n,r,t,e)}function kn(n,r,e){if(ne(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 Nn(n,r,t,e)}function xo(n,r,e){if(ne(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 Nn(n,r,t,e)}function As(n,r,e){if(ne(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 Nn(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=k(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=$(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=$(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=Ke({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=Ke({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=Ke({concat_:function(n,r){r===void 0&&(r=0),w(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});Fi(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=Ke({concat1d_:function(n){return hn(n,0)}}),Rs=Ke({concat2d_:function(n,r){return hn(n,r)}}),ha=Ke({concat3d_:function(n,r){return hn(n,r)}}),Is=Ke({concat4d_:function(n,r){return hn(n,r)}}),Bo=Ke({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"?(w(o.shape[e]%r==0,function(){return"Number of splits must evenly divide the axis."}),t=new Array(r).fill(o.shape[e]/r)):(w(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,E=(u=4022871197,function(I){I=I.toString();for(var P=0;P<I.length;P++){var G=.02519603282416938*(u+=I.charCodeAt(P));G-=u=G>>>0,u=(G*=u)>>>0,u+=4294967296*(G-=u)}return 23283064365386963e-26*(u>>>0)});f.next=function(){var I=2091639*f.s0+23283064365386963e-26*f.c;return f.s0=f.s1,f.s1=f.s2,f.s2=I-(f.c=0|I)},f.c=1,f.s0=E(" "),f.s1=E(" "),f.s2=E(" "),f.s0-=E(s),f.s0<0&&(f.s0+=1),f.s1-=E(s),f.s1<0&&(f.s1+=1),f.s2-=E(s),f.s2<0&&(f.s2+=1),E=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),E=u&&u.state,I=f.next;return I.int32=function(){return 4294967296*f.next()|0},I.double=function(){return I()+11102230246251565e-32*(2097152*I()|0)},I.quick=I,E&&(typeof E=="object"&&a(E,f),I.state=function(){return a(f,{})}),I}e&&e.exports?e.exports=i:t&&t.amd?t(function(){return i}):this.alea=i}(0,n,!1)}),Ds=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 I=u.x^u.x<<11;return u.x=u.y,u.y=u.z,u.z=u.w,u.w^=u.w>>>19^I^I>>>8},s===(0|s)?u.x=s:f+=s;for(var E=0;E<f.length+64;E++)u.x^=0|f.charCodeAt(E),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),E=u&&u.state,I=function(){return(f.next()>>>0)/4294967296};return I.double=function(){do var P=((f.next()>>>11)+(f.next()>>>0)/4294967296)/(1<<21);while(P===0);return P},I.int32=f.next,I.quick=I,E&&(typeof E=="object"&&a(E,f),I.state=function(){return a(f,{})}),I}e&&e.exports?e.exports=i:t&&t.amd?t(function(){return i}):this.xor128=i}(0,n,!1)}),Ns=Qr(function(n){!function(r,e,t){function o(s){var u=this,f="";u.next=function(){var I=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^I^I<<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 E=0;E<f.length+64;E++)u.x^=0|f.charCodeAt(E),E==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),E=u&&u.state,I=function(){return(f.next()>>>0)/4294967296};return I.double=function(){do var P=((f.next()>>>11)+(f.next()>>>0)/4294967296)/(1<<21);while(P===0);return P},I.int32=f.next,I.quick=I,E&&(typeof E=="object"&&a(E,f),I.state=function(){return a(f,{})}),I}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,E,I=u.x,P=u.i;return f=I[P],E=(f^=f>>>7)^f<<24,E^=(f=I[P+1&7])^f>>>10,E^=(f=I[P+3&7])^f>>>3,E^=(f=I[P+4&7])^f<<7,f=I[P+7&7],E^=(f^=f<<13)^f<<9,I[P]=E,u.i=P+1&7,E},function(f,E){var I,P=[];if(E===(0|E))P[0]=E;else for(E=""+E,I=0;I<E.length;++I)P[7&I]=P[7&I]<<15^E.charCodeAt(I)+P[I+1&7]<<13;for(;P.length<8;)P.push(0);for(I=0;I<8&&P[I]===0;++I);for(I==8?P[7]=-1:P[I],f.x=P,f.i=0,I=256;I>0;--I)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),E=u&&u.state,I=function(){return(f.next()>>>0)/4294967296};return I.double=function(){do var P=((f.next()>>>11)+(f.next()>>>0)/4294967296)/(1<<21);while(P===0);return P},I.int32=f.next,I.quick=I,E&&(E.x&&a(E,f),I.state=function(){return a(f,{})}),I}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,E,I=u.w,P=u.X,G=u.i;return u.w=I=I+1640531527|0,E=P[G+34&127],f=P[G=G+1&127],E^=E<<13,f^=f<<17,E^=E>>>15,f^=f>>>12,E=P[G]=E^f,u.i=G,E+(I^I>>>16)|0},function(f,E){var I,P,G,oe,ue,ie=[],ce=128;for(E===(0|E)?(P=E,E=null):(E+="\0",P=0,ce=Math.max(ce,E.length)),G=0,oe=-32;oe<ce;++oe)E&&(P^=E.charCodeAt((oe+32)%E.length)),oe===0&&(ue=P),P^=P<<10,P^=P>>>15,P^=P<<4,P^=P>>>13,oe>=0&&(ue=ue+1640531527|0,G=(I=ie[127&oe]^=P+ue)==0?G+1:0);for(G>=128&&(ie[127&(E&&E.length||0)]=-1),G=127,oe=512;oe>0;--oe)P=ie[G+34&127],I=ie[G=G+1&127],P^=P<<13,I^=I<<17,P^=P>>>15,I^=I>>>12,ie[G]=P^I;f.w=ue,f.X=ie,f.i=G}(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),E=u&&u.state,I=function(){return(f.next()>>>0)/4294967296};return I.double=function(){do var P=((f.next()>>>11)+(f.next()>>>0)/4294967296)/(1<<21);while(P===0);return P},I.int32=f.next,I.quick=I,E&&(E.X&&a(E,f),I.state=function(){return a(f,{})}),I}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 I=u.b,P=u.c,G=u.d,oe=u.a;return I=I<<25^I>>>7^P,P=P-G|0,G=G<<24^G>>>8^oe,oe=oe-I|0,u.b=I=I<<20^I>>>12^P,u.c=P=P-G|0,u.d=G<<16^P>>>16^oe,u.a=oe-I|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 E=0;E<f.length+20;E++)u.b^=0|f.charCodeAt(E),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),E=u&&u.state,I=function(){return(f.next()>>>0)/4294967296};return I.double=function(){do var P=((f.next()>>>11)+(f.next()>>>0)/4294967296)/(1<<21);while(P===0);return P},I.int32=f.next,I.quick=I,E&&(typeof E=="object"&&a(E,f),I.state=function(){return a(f,{})}),I}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),E=2*f,I=a-1;function P(ce,ye,we){var Ee=[],Se=ue(function Fe(je,Ue){var Ze,Je=[],dt=typeof je;if(Ue&&dt=="object")for(Ze in je)try{Je.push(Fe(je[Ze],Ue-1))}catch(ct){}return Je.length?Je:dt=="string"?je:je+"\0"}((ye=ye==1?{entropy:!0}:ye||{}).entropy?[ce,ie(r)]:ce==null?function(){try{var Fe;return t&&(Fe=t.randomBytes)?Fe=Fe(a):(Fe=new Uint8Array(a),(o.crypto||o.msCrypto).getRandomValues(Fe)),ie(Fe)}catch(Ze){var je=o.navigator,Ue=je&&je.plugins;return[+new Date,o,Ue,o.screen,ie(r)]}}():ce,3),Ee),Me=new G(Ee),He=function(){for(var Fe=Me.g(i),je=u,Ue=0;Fe<f;)Fe=(Fe+Ue)*a,je*=a,Ue=Me.g(1);for(;Fe>=E;)Fe/=2,je/=2,Ue>>>=1;return(Fe+Ue)/je};return He.int32=function(){return 0|Me.g(4)},He.quick=function(){return Me.g(4)/4294967296},He.double=He,ue(ie(Me.S),r),(ye.pass||we||function(Fe,je,Ue,Ze){return Ze&&(Ze.S&&oe(Ze,Me),Fe.state=function(){return oe(Me,{})}),Ue?(e[s]=Fe,je):Fe})(He,Se,"global"in ye?ye.global:this==e,ye.state)}function G(ce){var ye,we=ce.length,Ee=this,Se=0,Me=Ee.i=Ee.j=0,He=Ee.S=[];for(we||(ce=[we++]);Se<a;)He[Se]=Se++;for(Se=0;Se<a;Se++)He[Se]=He[Me=I&Me+ce[Se%we]+(ye=He[Se])],He[Me]=ye;(Ee.g=function(Fe){for(var je,Ue=0,Ze=Ee.i,Je=Ee.j,dt=Ee.S;Fe--;)je=dt[Ze=I&Ze+1],Ue=Ue*a+dt[I&(dt[Ze]=dt[Je=I&Je+je])+(dt[Je]=je)];return Ee.i=Ze,Ee.j=Je,Ue})(a)}function oe(ce,ye){return ye.i=ce.i,ye.j=ce.j,ye.S=ce.S.slice(),ye}function ue(ce,ye){for(var we,Ee=ce+"",Se=0;Se<Ee.length;)ye[I&Se]=I&(we^=19*ye[I&Se])+Ee.charCodeAt(Se++);return ie(ye)}function ie(ce){return String.fromCharCode.apply(0,ce)}if(e["seed"+s]=P,ue(e.random(),r),n.exports){n.exports=P;try{t=O(5)}catch(ce){}}}([],Math)});wn.alea=Pn,wn.xor128=Ds,wn.xorwow=Ns,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 jt(n,r,e){return r===void 0&&(r="float32"),r=r||"float32",Ae(n),new Dr(n,r,e)}function ma(n,r){r===void 0&&(r=!1),console.log(n.toString(r))}var va=Ke({batchToSpaceND_:function(n,r,e){var t=Oe(n,"x","batchToSpaceND"),o=r.reduce(function(a,i){return a*i});return w(t.rank>=1+r.length,function(){return"input rank is "+t.rank+" but should be > than blockShape.length "+r.length}),w(e.length===r.length,function(){return"crops.length is "+e.length+" but should be equal to blockShape.length "+r.length}),w(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=Ke({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=Ke({cast_:function(n,r){var e=Oe(n,"x","cast");if(!Ge(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=Ke({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()}}})}}),Ls=Ke({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}}),js=Ke({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 w(o*r>=0,function(){return`Negative dimension size caused by overflow when multiplying
|
|
|
`+o+" and "+r+` for depthToSpace with input shape
|
|
|
`+t.shape}),w(a*r>=0,function(){return`Negative dimension size caused by overflow when multiplying
|
|
|
`+a+" and "+r+` for depthToSpace with input shape
|
|
|
`+t.shape}),w(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=Ke({expandDims_:function(n,r){r===void 0&&(r=0);var e=Oe(n,"x","expandDims",null);w(r<=e.rank,function(){return"Axis must be <= rank of the tensor"});var t=e.shape.slice();return r<0&&(w(-(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=Ke({eye_:function(n,r,e,t){t===void 0&&(t="float32"),r==null&&(r=n);for(var o=jt([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=Ke({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=Ke({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)}}),Ln=Ke({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=Ke({pad1d_:function(n,r,e){return e===void 0&&(e=0),w(r.length===2,function(){return"Invalid number of paddings. Must be length of 2."}),Ln(n,[r],e)}}),Eo=Ke({pad2d_:function(n,r,e){return e===void 0&&(e=0),w(r.length===2&&r[0].length===2&&r[1].length===2,function(){return"Invalid number of paddings. Must be length of 2 each."}),Ln(n,r,e)}}),ni=Ke({pad3d_:function(n,r,e){return e===void 0&&(e=0),w(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."}),Ln(n,r,e)}}),Fs=Ke({pad4d_:function(n,r,e){return e===void 0&&(e=0),w(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."}),Ln(n,r,e)}}),Bs=Ke({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=Ke({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=jt(n,t),s=0;s<i.values.length;s++)i.values[s]=a.nextValue();return i.toTensor()}}),Ws=Ke({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=jt(n,t),s=0;s<i.values.length;s++)i.values[s]=a.nextValue();return i.toTensor()}}),oi=Ke({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=jt(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=Ke({reshape_:function(n,r){var e=Oe(n,"x","reshape",null);r=re(r,e.size),w(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=Ke({spaceToBatchND_:function(n,r,e){var t=Oe(n,"x","spaceToBatchND");return w(t.rank>=1+r.length,function(){return"input rank "+t.rank+" should be > than [blockShape] "+r.length}),w(e.length===r.length,function(){return"paddings.shape[0] "+e.length+" must be equal to [blockShape] "+r.length}),w(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=Ke({squeeze_:function(n,r){var e=Oe(n,"x","squeeze");return ba(e,ee(e.shape,r).newShape)}}),jn=Ke({stack_:function(n,r){r===void 0&&(r=0);var e=yo(n,"tensors","stack");if(w(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;w(r<=t,function(){return"Axis must be <= rank of the tensor"}),e.forEach(function(s){X(o,s.shape,"All tensors passed to stack must have matching shapes")}),e.forEach(function(s){w(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=Ke({tile_:function(n,r){var e=Oe(n,"x","tile",null);w(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 E=0;E<r[1];++E)u=u.add(a.slice([f*s.shape[0],E*s.shape[1]],[s.shape[0],s.shape[1]]));else if(s.rank===3)for(f=0;f<r[0];++f)for(E=0;E<r[1];++E)for(var I=0;I<r[2];++I)u=u.add(a.slice([f*s.shape[0],E*s.shape[1],I*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(E=0;E<r[1];++E)for(I=0;I<r[2];++I)for(var P=0;P<r[3];++P)u=u.add(a.slice([f*s.shape[0],E*s.shape[1],I*s.shape[2],P*s.shape[3]],[s.shape[0],s.shape[1],s.shape[2],s.shape[3]]))}return u}}},"Tile",o,t)}}),Hs=Ke({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=jt(n,t),s=0;s<i.values.length;s++)i.values[s]=a.nextValue();return i.toTensor()}}),xa=Ke({unstack_:function(n,r){r===void 0&&(r=0),r=r||0;var e=Oe(n,"x","unstack");w(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 jn(o,r)}}},"Unpack",t)}}),zs=function(n,r){return x(this,void 0,void 0,function(){var e,t,o,a,i,s,u,f,E,I;return v(this,function(P){switch(P.label){case 0:return e=Oe(n,"x","setdiff1d"),t=Oe(r,"y","setdiff1d"),w(e.dtype===t.dtype,function(){return"x and y should have the same dtype, but got x ("+e.dtype+") and y ("+t.dtype+")."}),w(e.rank===1,function(){return"x should be 1D tensor, but got x ("+e.shape+")."}),w(t.rank===1,function(){return"y should be 1D tensor, but got y ("+t.shape+")."}),[4,e.data()];case 1:return o=P.sent(),[4,t.data()];case 2:for(a=P.sent(),i=new Set(a),s=0,E=0;E<o.length;E++)i.has(o[E])||s++;for(u=new Dr([s],e.dtype),f=new Dr([s],"int32"),E=0,I=0;E<o.length;E++)i.has(o[E])||(u.values[I]=o[E],f.values[I]=E,I++);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=$e(n.shape).map(function(E){return E/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:ge(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:$e(e.slice(0,o)).concat([1]),outputSize:le(e)}}var lc=Object.freeze({validateUpdateShape:Xs,validateInput:Ks,calculateShapes:Ho});function Ys(n,r,e){w(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+")."}),w(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){w(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=_(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?_(0,a,s):_(-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 w(ve(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&&X(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 w(ve(n),function(){return"The f passed in grads(f) must be a function"}),function(r,e){w(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&&X(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 w(ve(n),function(){return"The f passed in valueAndGrad(f) must be a function"}),function(r,e){w(r instanceof Nr,function(){return"The x passed in valueAndGrad(f)(x) must be a tensor"}),w(e==null||e instanceof Nr,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 w(ve(n),function(){return"The f passed in valueAndGrads(f) must be a function"}),function(r,e){w(Array.isArray(r)&&r.every(function(o){return o instanceof Nr}),function(){return"The args passed in valueAndGrads(f)(args) must be array of tensors"}),w(e==null||e instanceof Nr,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&&X(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){w(ve(n),function(){return"The f passed in variableGrads(f) must be a function"}),w(r==null||Array.isArray(r)&&r.every(function(E){return E 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(E){return!E.trainable}):null,a=r.length;w((r=r.filter(function(E){return E.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;w(u.some(function(E){return E!=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()."}),w(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(E,I){u[I]!=null&&(f[E.name]=u[I])}),o!=null&&o.forEach(function(E){return f[E.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=Ke({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=Ke({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 E=f[0].exp();return u.sub(u.sum(r,!0).mul(E))}}})(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 tt("time")},n.prototype.read=function(r){return tt("read")},n.prototype.readSync=function(r){return tt("readSync")},n.prototype.numDataIds=function(){return tt("numDataIds")},n.prototype.disposeData=function(r){return tt("disposeData")},n.prototype.write=function(r,e,t){return tt("write")},n.prototype.move=function(r,e,t,o){return tt("move")},n.prototype.memory=function(){return tt("memory")},n.prototype.floatPrecision=function(){return tt("floatPrecision")},n.prototype.epsilon=function(){return this.floatPrecision()===32?1e-7:1e-4},n.prototype.batchMatMul=function(r,e,t,o){return tt("batchMatMul")},n.prototype.fusedBatchMatMul=function(r){return r.a,r.b,r.transposeA,r.transposeB,r.bias,r.activation,r.preluActivationWeights,tt("fusedBatchMatMul")},n.prototype.slice=function(r,e,t){return tt("slice")},n.prototype.stridedSlice=function(r,e,t,o){return tt("stridedSlice")},n.prototype.unstack=function(r,e){return tt("unstack")},n.prototype.reverse=function(r,e){return tt("reverse")},n.prototype.concat=function(r,e){return tt("concat")},n.prototype.neg=function(r){return tt("neg")},n.prototype.add=function(r,e){return tt("add")},n.prototype.addN=function(r){return tt("addN")},n.prototype.subtract=function(r,e){return tt("subtract")},n.prototype.multiply=function(r,e){return tt("multiply")},n.prototype.realDivide=function(r,e){return tt("realDivide")},n.prototype.floorDiv=function(r,e){return tt("floorDiv")},n.prototype.sum=function(r,e){return tt("sum")},n.prototype.prod=function(r,e){return tt("prod")},n.prototype.unsortedSegmentSum=function(r,e,t){return tt("unsortedSegmentSum")},n.prototype.argMin=function(r,e){return tt("argMin")},n.prototype.argMax=function(r,e){return tt("argMax")},n.prototype.equal=function(r,e){return tt("equal")},n.prototype.notEqual=function(r,e){return tt("notEqual")},n.prototype.less=function(r,e){return tt("less")},n.prototype.lessEqual=function(r,e){return tt("lessEqual")},n.prototype.greater=function(r,e){return tt("greater")},n.prototype.greaterEqual=function(r,e){return tt("greaterEqual")},n.prototype.logicalNot=function(r){return tt("logicalNot")},n.prototype.logicalAnd=function(r,e){return tt("logicalAnd")},n.prototype.logicalOr=function(r,e){return tt("logicalOr")},n.prototype.where=function(r){return tt("where")},n.prototype.select=function(r,e,t){return tt("select")},n.prototype.topk=function(r,e,t){return tt("topk")},n.prototype.min=function(r,e){return tt("min")},n.prototype.minimum=function(r,e){return tt("minimum")},n.prototype.mod=function(r,e){return tt("mod")},n.prototype.max=function(r,e){return tt("max")},n.prototype.maximum=function(r,e){return tt("maximum")},n.prototype.all=function(r,e){return tt("all")},n.prototype.any=function(r,e){return tt("any")},n.prototype.squaredDifference=function(r,e){return tt("squaredDifference")},n.prototype.ceil=function(r){return tt("ceil")},n.prototype.floor=function(r){return tt("floor")},n.prototype.round=function(r){return tt("round")},n.prototype.sign=function(r){return tt("sign")},n.prototype.isNaN=function(r){return tt("isNaN")},n.prototype.isInf=function(r){return tt("isInf")},n.prototype.isFinite=function(r){return tt("isFinite")},n.prototype.pow=function(r,e){return tt("pow")},n.prototype.exp=function(r){return tt("exp")},n.prototype.expm1=function(r){return tt("expm1")},n.prototype.softmax=function(r,e){return tt("softmax")},n.prototype.log=function(r){return tt("log")},n.prototype.log1p=function(r){return tt("log1p")},n.prototype.sqrt=function(r){return tt("sqrt")},n.prototype.rsqrt=function(r){return tt("rsqrt")},n.prototype.square=function(r){return tt("square")},n.prototype.reciprocal=function(r){return tt("reciprocal")},n.prototype.relu=function(r){return tt("relu")},n.prototype.relu6=function(r){return tt("relu6")},n.prototype.prelu=function(r,e){return tt("prelu")},n.prototype.elu=function(r){return tt("elu")},n.prototype.eluDer=function(r,e){return tt("eluDer")},n.prototype.selu=function(r){return tt("selu")},n.prototype.int=function(r){return tt("int")},n.prototype.clip=function(r,e,t){return tt("clip")},n.prototype.abs=function(r){return tt("abs")},n.prototype.complexAbs=function(r){return tt("complexAbs")},n.prototype.sigmoid=function(r){return tt("sigmoid")},n.prototype.softplus=function(r){return tt("softplus")},n.prototype.sin=function(r){return tt("sin")},n.prototype.cos=function(r){return tt("cos")},n.prototype.tan=function(r){return tt("tan")},n.prototype.asin=function(r){return tt("asin")},n.prototype.acos=function(r){return tt("acos")},n.prototype.atan=function(r){return tt("atan")},n.prototype.atan2=function(r,e){return tt("atan2")},n.prototype.sinh=function(r){return tt("sinh")},n.prototype.cosh=function(r){return tt("cosh")},n.prototype.tanh=function(r){return tt("tanh")},n.prototype.asinh=function(r){return tt("asinh")},n.prototype.acosh=function(r){return tt("acosh")},n.prototype.atanh=function(r){return tt("atanh")},n.prototype.erf=function(r){return tt("erf")},n.prototype.step=function(r,e){return tt("step")},n.prototype.fusedConv2d=function(r){return r.input,r.filter,r.convInfo,r.bias,r.activation,r.preluActivationWeights,tt("fusedConv2d")},n.prototype.conv2d=function(r,e,t){return tt("conv2d")},n.prototype.conv2dDerInput=function(r,e,t){return tt("conv2dDerInput")},n.prototype.conv2dDerFilter=function(r,e,t){return tt("conv2dDerFilter")},n.prototype.fusedDepthwiseConv2D=function(r){return r.input,r.filter,r.convInfo,r.bias,r.activation,r.preluActivationWeights,tt("fusedDepthwiseConv2D")},n.prototype.depthwiseConv2D=function(r,e,t){return tt("depthwiseConv2D")},n.prototype.depthwiseConv2DDerInput=function(r,e,t){return tt("depthwiseConv2DDerInput")},n.prototype.depthwiseConv2DDerFilter=function(r,e,t){return tt("depthwiseConv2DDerFilter")},n.prototype.conv3d=function(r,e,t){return tt("conv3d")},n.prototype.conv3dDerInput=function(r,e,t){return tt("conv3dDerInput")},n.prototype.conv3dDerFilter=function(r,e,t){return tt("conv3dDerFilter")},n.prototype.maxPool=function(r,e){return tt("maxPool")},n.prototype.maxPoolBackprop=function(r,e,t,o){return tt("maxPoolBackprop")},n.prototype.avgPool=function(r,e){return tt("avgPool")},n.prototype.avgPoolBackprop=function(r,e,t){return tt("avgPoolBackprop")},n.prototype.avgPool3d=function(r,e){return tt("avgPool3d")},n.prototype.avgPool3dBackprop=function(r,e,t){return tt("avgPool3dBackprop")},n.prototype.maxPool3d=function(r,e){return tt("maxPool3d")},n.prototype.maxPool3dBackprop=function(r,e,t,o){return tt("maxPool3dBackprop")},n.prototype.reshape=function(r,e){return tt("reshape")},n.prototype.cast=function(r,e){return tt("cast")},n.prototype.tile=function(r,e){return tt("tile")},n.prototype.pad=function(r,e,t){return tt("pad")},n.prototype.transpose=function(r,e){return tt("transpose")},n.prototype.gather=function(r,e,t){return tt("gather")},n.prototype.gatherND=function(r,e){return tt("gatherND")},n.prototype.scatterND=function(r,e,t){return tt("scatterND")},n.prototype.batchToSpaceND=function(r,e,t){return tt("batchToSpaceND")},n.prototype.spaceToBatchND=function(r,e,t){return tt("spaceToBatchND")},n.prototype.resizeBilinear=function(r,e,t,o){return tt("resizeBilinear")},n.prototype.resizeBilinearBackprop=function(r,e,t){return tt("resizeBilinearBackprop")},n.prototype.resizeNearestNeighbor=function(r,e,t,o){return tt("resizeNearestNeighbor")},n.prototype.resizeNearestNeighborBackprop=function(r,e,t){return tt("resizeNearestNeighborBackprop")},n.prototype.batchNormalization=function(r,e,t,o,a,i){return tt("batchNormalization")},n.prototype.localResponseNormalization4D=function(r,e,t,o,a){return tt("localResponseNormalization4D")},n.prototype.LRNGrad=function(r,e,t,o,a,i,s){return tt("LRNGrad")},n.prototype.multinomial=function(r,e,t,o){return tt("multinomial")},n.prototype.oneHot=function(r,e,t,o){return tt("oneHot")},n.prototype.cumsum=function(r,e,t,o){return tt("cumsum")},n.prototype.nonMaxSuppression=function(r,e,t,o,a){return tt("nonMaxSuppression")},n.prototype.fft=function(r){return tt("fft")},n.prototype.ifft=function(r){return tt("ifft")},n.prototype.complex=function(r,e){return tt("complex")},n.prototype.real=function(r){return tt("real")},n.prototype.imag=function(r){return tt("imag")},n.prototype.cropAndResize=function(r,e,t,o,a,i){return tt("cropAndResize")},n.prototype.depthToSpace=function(r,e,t){return tt("depthToSpace")},n.prototype.split=function(r,e,t){return tt("split")},n.prototype.sparseToDense=function(r,e,t,o){return tt("sparseToDense")},n.prototype.diag=function(r){return tt("diag")},n.prototype.fill=function(r,e,t){return tt("fill")},n.prototype.onesLike=function(r){return tt("onesLike")},n.prototype.zerosLike=function(r){return tt("zerosLike")},n.prototype.linspace=function(r,e,t){return tt("linspace")},n.prototype.dispose=function(){return tt("dispose")},n}();function tt(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],E=u[1];if(i==="channelsLast")s=[f,E,n[3],n[3]];else{if(i!=="channelsFirst")throw new Error("Unknown dataFormat "+i);s=[f,E,n[1],n[1]]}return Fn(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),E=f[0],I=f[1],P=f[2];if(i==="NDHWC")u="channelsLast",s=[E,I,P,n[4],n[4]];else{if(i!=="NCDHW")throw new Error("Unknown dataFormat "+i);u="channelsFirst",s=[E,I,P,n[1],n[1]]}return To(n,s,e,t,o,!1,u,a)}function Fn(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],E=u[1],I=u[2],P=u[3];if(s==="channelsLast")f=n[0],E=n[1],I=n[2],P=n[3];else{if(s!=="channelsFirst")throw new Error("Unknown dataFormat "+s);f=n[0],P=n[1],E=n[2],I=n[3]}var G,oe=r[0],ue=r[1],ie=r[3],ce=Sa(e),ye=ce[0],we=ce[1],Ee=Sa(t),Se=Ee[0],Me=Ee[1],He=Bn(oe,Se),Fe=Bn(ue,Me),je=function(ct,st,pt,ht,ut,gt,yt,Ot){var Mt,Pt,Kt;if(typeof ct=="number"){Mt={top:ct,bottom:ct,left:ct,right:ct,type:ct===0?"VALID":"NUMBER"};var Yt=function(tr,Er,fr,jr,Mr){jr==null&&(jr=Ta(tr,Er,fr));var Pr=tr[0],zn=tr[1],Gn=Xo((Pr-Er+2*jr)/fr+1,Mr);w(se(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*jr)/fr+1,Mr);return w(se(mn),function(){return"The output # of columns ("+mn+") must be an integer. Change the stride and/or zero pad parameters"}),[Gn,mn]}([st,pt],gt,ht,ct,Ot);Pt=Yt[0],Kt=Yt[1]}else if(ct==="same"){Pt=Math.ceil(st/ht),Kt=Math.ceil(pt/ut);var $t=Math.max(0,(Pt-1)*ht+gt-st),ar=Math.max(0,(Kt-1)*ut+yt-pt),er=Math.floor($t/2),ir=$t-er,Fr=Math.floor(ar/2);Mt={top:er,bottom:ir,left:Fr,right:ar-Fr,type:"SAME"}}else{if(ct!=="valid")throw Error("Unknown padding parameter: "+ct);Mt={top:0,bottom:0,left:0,right:0,type:"VALID"},Pt=Math.ceil((st-gt+1)/ht),Kt=Math.ceil((pt-yt+1)/ut)}return{padInfo:Mt,outHeight:Pt,outWidth:Kt}}(o,E,I,ye,we,He,Fe,a),Ue=je.padInfo,Ze=je.outHeight,Je=je.outWidth,dt=i?ie*P:ie;return s==="channelsFirst"?G=[f,dt,Ze,Je]:s==="channelsLast"&&(G=[f,Ze,Je,dt]),{batchSize:f,dataFormat:s,inHeight:E,inWidth:I,inChannels:P,outHeight:Ze,outWidth:Je,outChannels:dt,padInfo:Ue,strideHeight:ye,strideWidth:we,filterHeight:oe,filterWidth:ue,effectiveFilterHeight:He,effectiveFilterWidth:Fe,dilationHeight:Se,dilationWidth:Me,inShape:n,outShape:G,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],E=u[1],I=u[2],P=u[3],G=u[4];if(i==="channelsLast")f=n[0],E=n[1],I=n[2],P=n[3],G=n[4];else{if(i!=="channelsFirst")throw new Error("Unknown dataFormat "+i);f=n[0],G=n[1],E=n[2],I=n[3],P=n[4]}var oe,ue=r[0],ie=r[1],ce=r[2],ye=r[4],we=Vo(e),Ee=we[0],Se=we[1],Me=we[2],He=Vo(t),Fe=He[0],je=He[1],Ue=He[2],Ze=Bn(ue,Fe),Je=Bn(ie,je),dt=Bn(ce,Ue),ct=function(yt,Ot,Mt,Pt,Kt,Yt,$t,ar,er,ir,Fr){var tr,Er,fr,jr;if(typeof yt=="number"){tr={top:yt,bottom:yt,left:yt,right:yt,front:yt,back:yt,type:yt===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);w(se(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);w(se(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 w(se($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,yt,Fr);Er=Mr[0],fr=Mr[1],jr=Mr[2]}else if(yt==="same"){Er=Math.ceil(Ot/Kt),fr=Math.ceil(Mt/Yt),jr=Math.ceil(Pt/$t);var Pr=(Er-1)*Kt+ar-Ot,zn=(fr-1)*Yt+er-Mt,Gn=(jr-1)*$t+ir-Pt,mn=Math.floor(Pr/2),Fa=Pr-mn,io=Math.floor(zn/2),Do=zn-io,so=Math.floor(Gn/2);tr={top:io,bottom:Do,left:so,right:Gn-so,front:mn,back:Fa,type:"SAME"}}else{if(yt!=="valid")throw Error("Unknown padding parameter: "+yt);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),jr=Math.ceil((Pt-ir+1)/$t)}return{padInfo:tr,outDepth:Er,outHeight:fr,outWidth:jr}}(o,E,I,P,Ee,Se,Me,Ze,Je,dt,s),st=ct.padInfo,pt=ct.outDepth,ht=ct.outHeight,ut=ct.outWidth,gt=a?ye*G:ye;return i==="channelsFirst"?oe=[f,gt,pt,ht,ut]:i==="channelsLast"&&(oe=[f,pt,ht,ut,gt]),{batchSize:f,dataFormat:i,inDepth:E,inHeight:I,inWidth:P,inChannels:G,outDepth:pt,outHeight:ht,outWidth:ut,outChannels:gt,padInfo:st,strideDepth:Ee,strideHeight:Se,strideWidth:Me,filterDepth:ue,filterHeight:ie,filterWidth:ce,effectiveFilterDepth:Ze,effectiveFilterHeight:Je,effectiveFilterWidth:dt,dilationDepth:Fe,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(!Qe(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=It(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=$(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:ji,combineLocations:Qa,computeOutAndReduceShapes:Gr,expandShapeToKeepDim:Vr,assertAxesAreInnerMostDims:on,getAxesPermutation:sn,getUndoAxesPermutation:bo,getInnerMostAxes:fn,getBroadcastDims:En,getReductionAxes:Ir,assertAndGetBroadcastShape:Ht,assertParamsConsistent:Fi,computeOutShape:qn,computePool2DInfo:to,computePool3DInfo:Go,computeConv2DInfo:Fn,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,E){for(var I=0,P=u.length,G=0,oe=!1;I<P;){var ue=E(f,u[G=I+(P-I>>>1)]);ue>0?I=G+1:(P=G,oe=!ue)}return oe?I:-I-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,E=[],I=[];E.length<e&&u.length>0;){var P=u.pop(),G=P.score,oe=P.boxIndex,ue=P.suppressBeginIndex;if(G<o)break;for(var ie=!1,ce=E.length-1;ce>=ue;--ce){var ye=ru(n,oe,E[ce]);if(ye>=t){ie=!0;break}if(P.score=P.score*nu(t,f,ye),P.score<=o)break}P.suppressBeginIndex=E.length,ie||(P.score===G?(E.push(oe),I.push(P.score)):P.score>o&&eu(u,P,rs))}var we=E.length;return s&&(E.fill(0,we),I.fill(0,we)),{selectedIndices:Qn(E,"int32"),selectedScores:Qn(I,"float32"),numValidOutputs:It(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]),E=Math.min(o[1],o[3]),I=Math.max(o[0],o[2]),P=Math.max(o[1],o[3]),G=(s-a)*(u-i),oe=(I-f)*(P-E);if(G<=0||oe<=0)return 0;var ue=Math.max(a,f),ie=Math.max(i,E),ce=Math.min(s,I),ye=Math.min(u,P),we=Math.max(ce-ue,0)*Math.max(ye-ie,0);return we/(G+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=jt(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=xe(e,s*t),E=xe("int32",s*t),I=0;I<s;I++){for(var P=I*u,G=n.subarray(P,P+u),oe=[],ue=0;ue<G.length;ue++)oe.push({value:G[ue],index:ue});oe.sort(function(Ee,Se){return Se.value-Ee.value});var ie=I*t,ce=f.subarray(ie,ie+t),ye=E.subarray(ie,ie+t);for(ue=0;ue<t;ue++)ce[ue]=oe[ue].value,ye[ue]=oe[ue].index}var we=r.slice();return we[we.length-1]=t,[Ur(f,we,e),Ur(E,we,"int32")]}function fi(n,r){for(var e=[],t=0;t<r.length;t++)r[t]&&e.push(t);var o=jt(n,"int32"),a=jt([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 c().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 R(n,r,e){e===void 0&&(e="index");var t=$e(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 b(n){var r=$e(n).map(function(e){return e.toString()});return`
|
|
|
int getFlatIndex(ivec3 coords) {
|
|
|
return coords.x * `+r[0]+" + coords.y * "+r[1]+` + coords.z;
|
|
|
}
|
|
|
`}var S=`
|
|
|
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 N(n,r,e,t){var o=[];n.forEach(function(G){var oe=le(G.shapeInfo.logicalShape);G.shapeInfo.isUniform?o.push("uniform float "+G.name+(oe>1?"["+oe+"]":"")+";"):(o.push("uniform sampler2D "+G.name+";"),o.push("uniform int offset"+G.name+";"))});var a,i,s=o.join(`
|
|
|
`),u=n.map(function(G){return function(oe,ue,ie){ie===void 0&&(ie=!1);var ce="";ce+=ie?ae(oe):z(oe);var ye=oe.shapeInfo.logicalShape,we=ue.logicalShape;return ye.length<=we.length&&(ce+=ie?function(Ee,Se){var Me,He=Ee.name,Fe=He.charAt(0).toUpperCase()+He.slice(1),je="get"+Fe+"AtOutCoords",Ue=Ee.shapeInfo.logicalShape.length,Ze=Se.logicalShape.length,Je=En(Ee.shapeInfo.logicalShape,Se.logicalShape),dt=ze(Ze),ct=Ze-Ue,st=["x","y","z","w","u","v"];Me=Ue===0?"":Ze<2&&Je.length>=1?"coords = 0;":Je.map(function(Mt){return"coords."+st[Mt+ct]+" = 0;"}).join(`
|
|
|
`);var pt="";pt=Ze<2&&Ue>0?"coords":Ee.shapeInfo.logicalShape.map(function(Mt,Pt){return"coords."+st[Pt+ct]}).join(", ");var ht="return outputValue;",ut=le(Ee.shapeInfo.logicalShape)===1,gt=le(Se.logicalShape)===1;if(Ue!==1||ut||gt){if(ut&&!gt)ht=Ze===1?`
|
|
|
return vec4(outputValue.x, outputValue.x, 0., 0.);
|
|
|
`:`
|
|
|
return vec4(outputValue.x);
|
|
|
`;else if(Je.length){var yt=Ue-2,Ot=Ue-1;Je.indexOf(yt)>-1&&Je.indexOf(Ot)>-1?ht="return vec4(outputValue.x);":Je.indexOf(yt)>-1?ht="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":Je.indexOf(Ot)>-1&&(ht="return vec4(outputValue.xx, outputValue.zz);")}}else ht=`
|
|
|
return vec4(outputValue.xy, outputValue.xy);
|
|
|
`;return`
|
|
|
vec4 `+je+`() {
|
|
|
`+dt+` coords = getOutputCoords();
|
|
|
`+Me+`
|
|
|
vec4 outputValue = get`+Fe+"("+pt+`);
|
|
|
`+ht+`
|
|
|
}
|
|
|
`}(oe,ue):function(Ee,Se){var Me=Ee.name,He=Me.charAt(0).toUpperCase()+Me.slice(1),Fe="get"+He+"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 `+Fe+`() {
|
|
|
return sampleTexture(`+Me+`, resultUV);
|
|
|
}
|
|
|
`;var dt,ct=ze(Je),st=En(Ee.shapeInfo.logicalShape,Se.logicalShape),pt=Je-Ze,ht=["x","y","z","w","u","v"];dt=Ze===0?"":Je<2&&st.length>=1?"coords = 0;":st.map(function(gt){return"coords."+ht[gt+pt]+" = 0;"}).join(`
|
|
|
`);var ut="";return ut=Je<2&&Ze>0?"coords":Ee.shapeInfo.logicalShape.map(function(gt,yt){return"coords."+ht[yt+pt]}).join(", "),`
|
|
|
float `+Fe+`() {
|
|
|
`+ct+` coords = getOutputCoords();
|
|
|
`+dt+`
|
|
|
return get`+He+"("+ut+`);
|
|
|
}
|
|
|
`}(oe,ue)),ce}(G,r,t)}).join(`
|
|
|
`),f=r.texShape,E=Kr(),I=function(G){return`
|
|
|
float sampleTexture(sampler2D textureSampler, vec2 uv) {
|
|
|
return `+G.texture2D+`(textureSampler, uv).r;
|
|
|
}
|
|
|
`}(E),P=function(G){return G.version+`
|
|
|
precision highp float;
|
|
|
precision highp int;
|
|
|
precision highp sampler2D;
|
|
|
`+G.varyingFs+` vec2 resultUV;
|
|
|
`+G.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;
|
|
|
`+G.defineSpecialNaN+`
|
|
|
`+G.defineSpecialInf+`
|
|
|
`+G.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);
|
|
|
}
|
|
|
|
|
|
`+me+`
|
|
|
`+fe+`
|
|
|
`+Ce+`
|
|
|
`}(E);return r.isPacked?(a=function(G,oe){switch(G.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 He=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 / `+He+`);
|
|
|
int c = imod(index, `+He+`) * 2;
|
|
|
|
|
|
return ivec2(r, c);
|
|
|
}
|
|
|
`}(G,oe);case 3:return ue=G,ie=oe,ce=[Math.ceil(ie[0]/2),Math.ceil(ie[1]/2)],ye=Math.ceil(ue[2]/2),we=ye*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 / `+ye+`);
|
|
|
int c = imod(index, `+ye+`) * 2;
|
|
|
|
|
|
return ivec3(b, r, c);
|
|
|
}
|
|
|
`;default:return function(Ee,Se){for(var Me=[Math.ceil(Se[0]/2),Math.ceil(Se[1]/2)],He=Math.ceil(Ee[Ee.length-1]/2),Fe=He*Math.ceil(Ee[Ee.length-2]/2),je=Fe,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 / `+Fe+`;
|
|
|
index -= b * `+Fe+`;
|
|
|
|
|
|
int r = 2 * (index / `+He+`);
|
|
|
int c = imod(index, `+He+`) * 2;
|
|
|
|
|
|
return ivec`+Ee.length+"("+Ze+`);
|
|
|
}
|
|
|
`}(G,oe)}var ue,ie,ce,ye,we}(r.logicalShape,f),i=function(G){return`
|
|
|
void setOutput(vec4 val) {
|
|
|
`+G.output+` = val;
|
|
|
}
|
|
|
`}(E)):(a=function(G,oe){switch(G.length){case 0:return`
|
|
|
int getOutputCoords() {
|
|
|
return 0;
|
|
|
}
|
|
|
`;case 1:return function(ce,ye){return ye[0]===1?`
|
|
|
int getOutputCoords() {
|
|
|
return int(resultUV.x * `+ye[1]+`.0);
|
|
|
}
|
|
|
`:ye[1]===1?`
|
|
|
int getOutputCoords() {
|
|
|
return int(resultUV.y * `+ye[0]+`.0);
|
|
|
}
|
|
|
`:`
|
|
|
int getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+ye[0]+", "+ye[1]+`));
|
|
|
return resTexRC.x * `+ye[1]+` + resTexRC.y;
|
|
|
}
|
|
|
`}(0,oe);case 2:return function(ce,ye){return _e(ce,ye)?`
|
|
|
ivec2 getOutputCoords() {
|
|
|
return ivec2(resultUV.yx * vec2(`+ye[0]+", "+ye[1]+`));
|
|
|
}
|
|
|
`:ce[1]===1?`
|
|
|
ivec2 getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+ye[0]+", "+ye[1]+`));
|
|
|
int index = resTexRC.x * `+ye[1]+` + resTexRC.y;
|
|
|
return ivec2(index, 0);
|
|
|
}
|
|
|
`:ce[0]===1?`
|
|
|
ivec2 getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+ye[0]+", "+ye[1]+`));
|
|
|
int index = resTexRC.x * `+ye[1]+` + resTexRC.y;
|
|
|
return ivec2(0, index);
|
|
|
}
|
|
|
`:`
|
|
|
ivec2 getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+ye[0]+", "+ye[1]+`));
|
|
|
int index = resTexRC.x * `+ye[1]+` + resTexRC.y;
|
|
|
int r = index / `+ce[1]+`;
|
|
|
int c = index - r * `+ce[1]+`;
|
|
|
return ivec2(r, c);
|
|
|
}
|
|
|
`}(G,oe);case 3:return ue=oe,ie=R(["r","c","d"],G),`
|
|
|
ivec3 getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+ue[0]+", "+ue[1]+`));
|
|
|
int index = resTexRC.x * `+ue[1]+` + resTexRC.y;
|
|
|
`+ie+`
|
|
|
return ivec3(r, c, d);
|
|
|
}
|
|
|
`;case 4:return function(ce,ye){var we=R(["r","c","d","d2"],ce);return`
|
|
|
ivec4 getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+ye[0]+", "+ye[1]+`));
|
|
|
int index = resTexRC.x * `+ye[1]+` + resTexRC.y;
|
|
|
`+we+`
|
|
|
return ivec4(r, c, d, d2);
|
|
|
}
|
|
|
`}(G,oe);case 5:return function(ce,ye){var we=R(["r","c","d","d2","d3"],ce);return`
|
|
|
ivec5 getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx * vec2(`+ye[0]+`,
|
|
|
`+ye[1]+`));
|
|
|
|
|
|
int index = resTexRC.x * `+ye[1]+` + resTexRC.y;
|
|
|
|
|
|
`+we+`
|
|
|
|
|
|
ivec5 outShape = ivec5(r, c, d, d2, d3);
|
|
|
return outShape;
|
|
|
}
|
|
|
`}(G,oe);case 6:return function(ce,ye){var we=R(["r","c","d","d2","d3","d4"],ce);return`
|
|
|
ivec6 getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+ye[0]+", "+ye[1]+`));
|
|
|
int index = resTexRC.x * `+ye[1]+` + resTexRC.y;
|
|
|
|
|
|
`+we+`
|
|
|
|
|
|
ivec6 result = ivec6(r, c, d, d2, d3, d4);
|
|
|
return result;
|
|
|
}
|
|
|
`}(G,oe);default:throw new Error(G.length+"-D output sampling is not yet supported")}var ue,ie}(r.logicalShape,f),i=function(G){return`
|
|
|
void setOutput(float val) {
|
|
|
`+G.output+` = vec4(val, 0, 0, 0);
|
|
|
}
|
|
|
`}(E)),t&&(P+=Ie),[P,I,i,s,a,u,e].join(`
|
|
|
`)}function z(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],E=u[1],I=De(t);return`
|
|
|
float `+o+`() {
|
|
|
vec2 uv = uvFromFlat(`+f+", "+E+", "+I+`);
|
|
|
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=De(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),E=f.newShape,I=f.keptDims,P=E;if(P.length<t.length){var G=qe(e,P);return`
|
|
|
`+z(G)+`
|
|
|
float `+a+`(int row, int col) {
|
|
|
return `+a+"("+it(["row","col"],I)+`);
|
|
|
}
|
|
|
`}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],ie=De(o);return ue===1?`
|
|
|
float `+a+`(int row, int col) {
|
|
|
float index = dot(vec3(row, col, `+ie+"), 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, `+ie+"), 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 + "+ie+`;
|
|
|
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,E=u.keptDims,I=f;if(I.length<t.length){var P=qe(e,I);return`
|
|
|
`+z(P)+`
|
|
|
float `+a+`(int row, int col, int depth) {
|
|
|
return `+a+"("+it(["row","col","depth"],E)+`);
|
|
|
}
|
|
|
`}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 G=e.shapeInfo.texShape,oe=G[0],ue=G[1],ie=e.shapeInfo.flatOffset;if(ue===i&&ie==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&&ie==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=De(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),E=f.newShape,I=f.keptDims;if(E.length<t.length){var P=qe(e,E);return`
|
|
|
`+z(P)+`
|
|
|
float `+a+`(int row, int col, int depth, int depth2) {
|
|
|
return `+a+"("+it(["row","col","depth","depth2"],I)+`);
|
|
|
}
|
|
|
`}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 G=e.shapeInfo.flatOffset,oe=e.shapeInfo.texShape,ue=oe[0],ie=oe[1];if(ie===u&&G==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(`+ie+".0, "+ue+`.0);
|
|
|
return sampleTexture(`+o+`, uv);
|
|
|
}
|
|
|
`;if(ie===i&&G==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(`+ie+".0, "+ue+`.0);
|
|
|
return sampleTexture(`+o+`, uv);
|
|
|
}
|
|
|
`;var ce=De(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+", "+ie+", 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,E=ee(t),I=E.newShape,P=E.keptDims;if(I.length<t.length){var G=qe(e,I);return`
|
|
|
`+z(G)+`
|
|
|
float `+a+`(int row, int col, int depth, int depth2, int depth3) {
|
|
|
return `+a+"("+it(["row","col","depth","depth2","depth3"],P)+`);
|
|
|
}
|
|
|
`}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,ie=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, "+ie+`.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, "+ie+`.0);
|
|
|
return sampleTexture(`+o+`, uv);
|
|
|
}
|
|
|
`;var ye=De(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 + "+ye+`;
|
|
|
vec2 uv = uvFromFlat(`+ie+", "+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`
|
|
|
`+z(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 E=t[5],I=t[4]*E,P=t[3]*I,G=t[2]*P,oe=t[1]*G;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+", "+G+", "+P+", "+I+`)) +
|
|
|
dot(
|
|
|
vec2(depth3, depth4),
|
|
|
vec2(`+E+`, 1)));
|
|
|
`+We(e)+`
|
|
|
}
|
|
|
`;var ue=e.shapeInfo.flatOffset,ie=e.shapeInfo.texShape,ce=ie[0],ye=ie[1];if(ye===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(`+G+", "+P+", "+I+", "+E+`)) +
|
|
|
float(depth4);
|
|
|
vec2 uv = (vec2(texC, texR) + halfCR) /
|
|
|
vec2(`+ye+".0, "+ce+`.0);
|
|
|
return sampleTexture(`+o+`, uv);
|
|
|
}
|
|
|
`;if(ye===E&&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(`+ye+".0, "+ce+`.0);
|
|
|
return sampleTexture(`+o+`, uv);
|
|
|
}
|
|
|
`;var we=De(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 * "+G+" + depth * "+P+` +
|
|
|
depth2 * `+I+" + depth3 * "+E+" + depth4 + "+we+`;
|
|
|
vec2 uv = uvFromFlat(`+ce+", "+ye+`, 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],E=u[1],I=Kr();if(u!=null&&_e(a,u))return`
|
|
|
vec4 `+s+`(int row, int col) {
|
|
|
vec2 uv = (vec2(col, row) + halfCR) / vec2(`+E+".0, "+f+`.0);
|
|
|
|
|
|
return `+I.texture2D+"("+i+`, uv);
|
|
|
}
|
|
|
`;var P=[Math.ceil(u[0]/2),Math.ceil(u[1]/2)],G=Math.ceil(a[1]/2);return`
|
|
|
vec4 `+s+`(int row, int col) {
|
|
|
vec2 uv = packedUVfrom2D(`+G+", "+P[0]+", "+P[1]+`, row, col);
|
|
|
return `+I.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 E=a.slice(1),I=qe(o,E);return`
|
|
|
`+ae(I)+`
|
|
|
vec4 `+s+`(int b, int row, int col) {
|
|
|
return `+s+"("+it(["b","row","col"],[1,2])+`);
|
|
|
}
|
|
|
`}var P=f[0],G=f[1],oe=Math.ceil(a[2]/2),ue=oe*Math.ceil(a[1]/2),ie=Kr();return`
|
|
|
vec4 `+s+`(int b, int row, int col) {
|
|
|
vec2 uv = packedUVfrom3D(
|
|
|
`+P+", "+G+", "+ue+", "+oe+`, b, row, col);
|
|
|
return `+ie.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,E=[Math.ceil(f[0]/2),Math.ceil(f[1]/2)],I=E[0],P=E[1],G=Math.ceil(a[i-1]/2),oe=G*Math.ceil(a[i-2]/2),ue="int b, int row, int col",ie="b * "+oe+" + (row / 2) * "+G+" + (col / 2)",ce=2;ce<i-1;ce++)ue="int b"+ce+", "+ue,oe*=a[i-ce-1],ie="b"+ce+" * "+oe+" + "+ie;var ye=Kr();return`
|
|
|
vec4 `+u+"("+ue+`) {
|
|
|
int index = `+ie+`;
|
|
|
int texR = index / `+P+`;
|
|
|
int texC = index - texR * `+P+`;
|
|
|
vec2 uv = (vec2(texC, texR) + halfCR) / vec2(`+P+", "+I+`);
|
|
|
return `+ye.texture2D+"("+s+`, uv);
|
|
|
}
|
|
|
`}(n)}}var me=`
|
|
|
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);
|
|
|
}
|
|
|
`,fe=`
|
|
|
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);
|
|
|
}
|
|
|
`,Ce=`
|
|
|
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 De(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 ze(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 vt=function(n,r,e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,w(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,E=ze(f),I=en("coords",f);if(a===1){var P=ze(s=f+1);i=`
|
|
|
`+P+" sourceLocR = "+P+"("+I.join()+`, 0);
|
|
|
++`+I[f-1]+`;
|
|
|
`+P+" sourceLocG = "+P+"("+I.join()+`, 0);
|
|
|
++`+I[f-2]+`;
|
|
|
`+P+" sourceLocA = "+P+"("+I.join()+`, 0);
|
|
|
--`+I[f-1]+`;
|
|
|
`+P+" sourceLocB = "+P+"("+I.join()+`, 0);
|
|
|
--`+I[f-2]+";"}else s=f,i=`
|
|
|
`+E+` sourceLocR = coords;
|
|
|
++`+I[f-1]+`;
|
|
|
`+E+` sourceLocG = coords;
|
|
|
++`+I[f-2]+`;
|
|
|
`+E+` sourceLocA = coords;
|
|
|
--`+I[f-1]+`;
|
|
|
`+E+` sourceLocB = coords;
|
|
|
--`+I[f-2]+";";var G=["x","y","z","w","u","v"].slice(0,s),oe="."+G[s-1],ue=G.map(function(Fe){return"int "+Fe}),ie=en("sourceLocR",s-1).concat("inIdx.r"),ce=en("sourceLocG",s-1).concat("inIdx.g"),ye=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(`+ie.join()+`),
|
|
|
getBestIndicesAChannel(`+ce.join()+`),
|
|
|
getBestIndicesAChannel(`+ye.join()+`),
|
|
|
getBestIndicesAChannel(`+we.join()+")));",Me=`vec4(
|
|
|
getAChannel(`+ie.join()+`),
|
|
|
hasNextCol ? getAChannel(`+ce.join()+`) : 0.,
|
|
|
hasNextRow ? getAChannel(`+ye.join()+`) : 0.,
|
|
|
hasNextRow && hasNextCol ? getAChannel(`+we.join()+") : 0.)",He=t?"":`
|
|
|
float getBestIndicesAChannel(`+ue.join()+`) {
|
|
|
return getChannel(getBestIndicesA(`+G.join()+`),
|
|
|
vec2(`+G.slice(-2).join()+`));
|
|
|
}`;this.userCode=`
|
|
|
float getAChannel(`+ue.join()+`) {
|
|
|
return getChannel(getA(`+G.join()+`),
|
|
|
vec2(`+G.slice(-2).join()+`));
|
|
|
}
|
|
|
`+He+`
|
|
|
void main() {
|
|
|
`+E+` coords = getOutputCoords();
|
|
|
bool hasNextCol = `+I[f-1]+" < "+(u[f-1]-1)+`;
|
|
|
bool hasNextRow = `+I[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);
|
|
|
}
|
|
|
`},wt=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,E=u-1-n.padInfo.left,I=1/(r*e);this.userCode=`
|
|
|
const ivec2 pads = ivec2(`+f+", "+E+`);
|
|
|
const float avgMultiplier = float(`+I+`);
|
|
|
|
|
|
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);
|
|
|
}
|
|
|
`},Ct=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,E=n.effectiveFilterDepth,I=n.effectiveFilterHeight,P=n.effectiveFilterWidth,G=E-1-n.padInfo.front,oe=I-1-n.padInfo.top,ue=P-1-n.padInfo.left,ie=1/(r*e*t);this.userCode=`
|
|
|
const ivec3 pads = ivec3(`+G+", "+oe+", "+ue+`);
|
|
|
const float avgMultiplier = float(`+ie+`);
|
|
|
|
|
|
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 < `+E+`;
|
|
|
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 < `+I+`;
|
|
|
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 < `+P+`;
|
|
|
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);
|
|
|
}
|
|
|
`},mt="return areal * breal - aimag * bimag;",_t="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=`
|
|
|
`+ze(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=ze(t),a=en("coords",t),i=["x","y","z","w","u","v"].slice(0,t);this.variableNames=n.map(function(ie,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],E=i.slice(-2),I=i.join(),P="if ("+f+" < "+s[0]+`) {
|
|
|
return getChannel(
|
|
|
getT0(`+I+"), vec2("+E.join()+`));
|
|
|
}`;for(u=1;u<s.length;u++){var G=s[u-1];P+=`
|
|
|
if (`+f+" < "+s[u]+" && "+f+" >= "+s[u-1]+`) {
|
|
|
return getChannel(
|
|
|
getT`+u+"("+_r(i,f,G)+`),
|
|
|
vec2(`+_r(E,f,G)+`));
|
|
|
}`}var oe=s.length,ue=s[s.length-1];P+=`
|
|
|
return getChannel(
|
|
|
getT`+oe+"("+_r(i,f,ue)+`),
|
|
|
vec2(`+_r(E,f,ue)+"));",this.userCode=`
|
|
|
float getValue(`+i.map(function(ie){return"int "+ie})+`) {
|
|
|
`+P+`
|
|
|
}
|
|
|
|
|
|
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,E=a?3:1;this.userCode=`
|
|
|
const ivec2 pads = ivec2(`+i+", "+s+`);
|
|
|
|
|
|
void main() {
|
|
|
ivec4 coords = getOutputCoords();
|
|
|
int batch = coords[0];
|
|
|
int d1 = coords[`+E+`];
|
|
|
|
|
|
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,E=n.filterHeight,I=n.filterWidth,P=4*Math.floor(n.inChannels/4),G=n.inChannels%4,oe=n.dataFormat==="channelsLast",ue=oe?1:2,ie=oe?2:3,ce=oe?3:1,ye="",we="";e&&(ye=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=`
|
|
|
`+ye+`
|
|
|
|
|
|
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["+ie+`]) * 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 < `+E+`; wR++) {
|
|
|
int xR = xRCorner + wR * `+u+`;
|
|
|
|
|
|
if (xR < 0 || xR >= `+n.inHeight+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int wC = 0; wC < `+I+`; wC++) {
|
|
|
int xC = xCCorner + wC * `+f+`;
|
|
|
|
|
|
if (xC < 0 || xC >= `+n.inWidth+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int d1 = 0; d1 < `+P+`; 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 (`+(G===1)+`) {
|
|
|
|
|
|
if (`+oe+`) {
|
|
|
dotProd +=
|
|
|
getX(batch, xR, xC, `+P+`) *
|
|
|
getW(wR, wC, `+P+`, d2);
|
|
|
} else {
|
|
|
dotProd +=
|
|
|
getX(batch, `+P+`, xR, xC) *
|
|
|
getW(wR, wC, `+P+`, d2);
|
|
|
}
|
|
|
|
|
|
} else if (`+(G===2)+`) {
|
|
|
vec2 wValues = vec2(
|
|
|
getW(wR, wC, `+P+`, d2),
|
|
|
getW(wR, wC, `+P+` + 1, d2)
|
|
|
);
|
|
|
|
|
|
if (`+oe+`) {
|
|
|
vec2 xValues = vec2(
|
|
|
getX(batch, xR, xC, `+P+`),
|
|
|
getX(batch, xR, xC, `+P+` + 1)
|
|
|
);
|
|
|
dotProd += dot(xValues, wValues);
|
|
|
} else {
|
|
|
vec2 xValues = vec2(
|
|
|
getX(batch, `+P+`, xR, xC),
|
|
|
getX(batch, `+P+` + 1, xR, xC)
|
|
|
);
|
|
|
dotProd += dot(xValues, wValues);
|
|
|
}
|
|
|
|
|
|
} else if (`+(G===3)+`) {
|
|
|
vec3 wValues = vec3(
|
|
|
getW(wR, wC, `+P+`, d2),
|
|
|
getW(wR, wC, `+P+` + 1, d2),
|
|
|
getW(wR, wC, `+P+` + 2, d2)
|
|
|
);
|
|
|
|
|
|
if (`+oe+`) {
|
|
|
vec3 xValues = vec3(
|
|
|
getX(batch, xR, xC, `+P+`),
|
|
|
getX(batch, xR, xC, `+P+` + 1),
|
|
|
getX(batch, xR, xC, `+P+` + 2)
|
|
|
);
|
|
|
dotProd += dot(xValues, wValues);
|
|
|
} else {
|
|
|
vec3 xValues = vec3(
|
|
|
getX(batch, `+P+`, xR, xC),
|
|
|
getX(batch, `+P+` + 1, xR, xC),
|
|
|
getX(batch, `+P+` + 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,E=n.filterDepth,I=n.filterHeight,P=n.filterWidth,G=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 < `+E+`; wF++) {
|
|
|
int xF = xFCorner + wF * `+s+`;
|
|
|
|
|
|
if (xF < 0 || xF >= `+n.inDepth+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int wR = 0; wR < `+I+`; wR++) {
|
|
|
int xR = xRCorner + wR * `+u+`;
|
|
|
|
|
|
if (xR < 0 || xR >= `+n.inHeight+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int wC = 0; wC < `+P+`; wC++) {
|
|
|
int xC = xCCorner + wC * `+f+`;
|
|
|
|
|
|
if (xC < 0 || xC >= `+n.inWidth+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int d1 = 0; d1 < `+G+`; 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, `+G+`) *
|
|
|
getW(wF, wR, wC, `+G+`, d2);
|
|
|
} else if (`+(oe===2)+`) {
|
|
|
vec2 xValues = vec2(
|
|
|
getX(batch, xF, xR, xC, `+G+`),
|
|
|
getX(batch, xF, xR, xC, `+G+` + 1)
|
|
|
);
|
|
|
vec2 wValues = vec2(
|
|
|
getW(wF, wR, wC, `+G+`, d2),
|
|
|
getW(wF, wR, wC, `+G+` + 1, d2)
|
|
|
);
|
|
|
dotProd += dot(xValues, wValues);
|
|
|
} else if (`+(oe===3)+`) {
|
|
|
vec3 xValues = vec3(
|
|
|
getX(batch, xF, xR, xC, `+G+`),
|
|
|
getX(batch, xF, xR, xC, `+G+` + 1),
|
|
|
getX(batch, xF, xR, xC, `+G+` + 2)
|
|
|
);
|
|
|
vec3 wValues = vec3(
|
|
|
getW(wF, wR, wC, `+G+`, d2),
|
|
|
getW(wF, wR, wC, `+G+` + 1, d2),
|
|
|
getW(wF, wR, wC, `+G+` + 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,E=n.dilationHeight,I=n.dilationWidth,P=n.filterHeight,G=n.filterWidth,oe=n.outChannels/n.inChannels,ue="",ie="";e&&(ue=t?`float activation(float a) {
|
|
|
float b = getPreluActivationWeightsAtOutCoords();
|
|
|
`+e+`
|
|
|
}`:`
|
|
|
float activation(float x) {
|
|
|
`+e+`
|
|
|
}
|
|
|
`,ie="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 < `+P+`; wR++) {
|
|
|
int xR = xRCorner + wR * `+E+`;
|
|
|
|
|
|
if (xR < 0 || xR >= `+o+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int wC = 0; wC < `+G+`; wC++) {
|
|
|
int xC = xCCorner + wC * `+I+`;
|
|
|
|
|
|
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+`
|
|
|
`+ie+`
|
|
|
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,E=n.dilationHeight,I=n.dilationWidth,P=n.filterHeight,G=n.filterWidth,oe=G,ue="int xR; int xC; int xCOffset;",ie=0;ie<P;ie++)for(var ce=0;ce<G;ce++)ue+=`
|
|
|
vec4 xTexelR`+ie+"C"+2*ce+` = vec4(0.);
|
|
|
vec4 wR`+ie+"C"+ce+` = vec4(0.);
|
|
|
vec4 xR`+ie+"C"+ce+" = vec4(0.);";for(ie=0;ie<P;ie++)for(var ye=0;ye<oe;ye++){if(ue+=`
|
|
|
xR = xRCorner + `+ie*E+`;
|
|
|
xC = xCCorner + `+(ce=2*ye)*I+`;
|
|
|
`,f===1){if(ce<G&&(ue+=s%2==1?`
|
|
|
xCOffset = xC + 1;
|
|
|
if(xR >= 0 && xR < `+o+" && xCOffset >= 0 && xCOffset < "+a+`) {
|
|
|
xTexelR`+ie+"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`+ie+"C"+ce+`.zw = vec2(0.);
|
|
|
}
|
|
|
} else {
|
|
|
xTexelR`+ie+"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`+ie+"C"+ce+" = vec4(previous.zw, xTexelR"+ie+"C"+ce+`.xy);
|
|
|
} else {
|
|
|
xR`+ie+"C"+ce+" = vec4(0, 0, xTexelR"+ie+"C"+ce+`.xy);
|
|
|
}
|
|
|
`:`
|
|
|
if(xR >= 0 && xR < `+o+" && xC >= 0 && xC < "+a+`) {
|
|
|
xTexelR`+ie+"C"+ce+` = getX(batch, xR, xC, d1);
|
|
|
} else {
|
|
|
xTexelR`+ie+"C"+ce+` = vec4(0.);
|
|
|
}
|
|
|
|
|
|
xR`+ie+"C"+ce+" = xTexelR"+ie+"C"+ce+`;
|
|
|
`,ce+1<G)){var we=s%2==0?te(I):I;I%2==0&&s%2==1||I%2!=0&&s%2!=1?(ue+=`
|
|
|
xCOffset = xC + `+s%2+" + "+we+`;
|
|
|
|
|
|
if(xR >= 0 && xR < `+o+` &&
|
|
|
xCOffset >= 0 && xCOffset < `+a+`) {
|
|
|
xTexelR`+ie+"C"+(ce+2)+` = getX(batch, xR, xCOffset, d1);
|
|
|
}
|
|
|
`,I>1&&(ue+=`
|
|
|
xCOffset -= 2;
|
|
|
if(xR >= 0 && xR < `+o+` &&
|
|
|
xCOffset >= 0 && xCOffset < `+a+`) {
|
|
|
xTexelR`+ie+"C"+ce+` = getX(batch, xR, xCOffset, d1);
|
|
|
} else {
|
|
|
xTexelR`+ie+"C"+ce+` = vec4(0.);
|
|
|
}
|
|
|
`),ue+=`
|
|
|
xR`+ie+"C"+(ce+1)+` = vec4(
|
|
|
xTexelR`+ie+"C"+ce+".zw, xTexelR"+ie+"C"+(ce+2)+`.xy);
|
|
|
`):ue+=`
|
|
|
xCOffset = xC + `+we+`;
|
|
|
|
|
|
if(xR >= 0 && xR < `+o+` &&
|
|
|
xCOffset >= 0 && xCOffset < `+a+`) {
|
|
|
xTexelR`+ie+"C"+(ce+2)+` = getX(batch, xR, xCOffset, d1);
|
|
|
}
|
|
|
|
|
|
xR`+ie+"C"+(ce+1)+" = xTexelR"+ie+"C"+(ce+2)+`;
|
|
|
`}}else ce<G&&(ue+=`
|
|
|
if(xR >= 0 && xR < `+o+`) {
|
|
|
`,s%2==1?(ue+=`
|
|
|
xCOffset = xC + 1 - `+f+`;
|
|
|
if(xCOffset >= 0 && xCOffset < `+a+`) {
|
|
|
xTexelR`+ie+"C"+ce+` = getX(batch, xR, xCOffset, d1);
|
|
|
} else {
|
|
|
xTexelR`+ie+"C"+ce+` = vec4(0.);
|
|
|
}
|
|
|
|
|
|
if(xC + 1 >= 0 && xC + 1 < `+a+`) {
|
|
|
xTexelR`+ie+"C"+(ce+2)+` = getX(batch, xR, xC + 1, d1);
|
|
|
} else {
|
|
|
xTexelR`+ie+"C"+(ce+2)+` = vec4(0.);
|
|
|
}
|
|
|
|
|
|
xR`+ie+"C"+ce+` = vec4(
|
|
|
xTexelR`+ie+"C"+ce+".zw, xTexelR"+ie+"C"+(ce+2)+`.zw);
|
|
|
`,ce+1<G&&(ue+=`
|
|
|
vec4 final = vec4(0.);
|
|
|
xCOffset = xC + 1 + `+f+`;
|
|
|
if(xCOffset >= 0 && xCOffset < `+a+`) {
|
|
|
final = getX(batch, xR, xCOffset, d1);
|
|
|
}
|
|
|
xR`+ie+"C"+(ce+1)+" = vec4(xTexelR"+ie+"C"+(ce+2)+`.xy, final.xy);
|
|
|
`)):(ue+=`
|
|
|
if(xC >= 0 && xC < `+a+`) {
|
|
|
xTexelR`+ie+"C"+ce+` = getX(batch, xR, xC, d1);
|
|
|
} else {
|
|
|
xTexelR`+ie+"C"+ce+` = vec4(0.);
|
|
|
}
|
|
|
|
|
|
xCOffset = xC + `+f+`;
|
|
|
if(xCOffset >= 0 && xCOffset < `+a+`) {
|
|
|
xTexelR`+ie+"C"+(ce+2)+` = getX(batch, xR, xCOffset, d1);
|
|
|
} else {
|
|
|
xTexelR`+ie+"C"+(ce+2)+` = vec4(0.);
|
|
|
}
|
|
|
|
|
|
xR`+ie+"C"+ce+` = vec4(
|
|
|
xTexelR`+ie+"C"+ce+".xy, xTexelR"+ie+"C"+(ce+2)+`.xy);
|
|
|
`,ce+1<G&&(ue+=`
|
|
|
xR`+ie+"C"+(ce+1)+` = vec4(
|
|
|
xTexelR`+ie+"C"+ce+".zw, xTexelR"+ie+"C"+(ce+2)+`.zw);
|
|
|
`)),ue+="}");ce<G&&(ue+=`
|
|
|
vec4 wTexelR`+ie+"C"+ce+" = getW("+ie+", "+ce+`, d1, q);
|
|
|
wR`+ie+"C"+ce+" = vec4(wTexelR"+ie+"C"+ce+".xz, wTexelR"+ie+"C"+ce+`.xz);
|
|
|
`,ce+1<G&&(ue+=`
|
|
|
vec4 wTexelR`+ie+"C"+(ce+1)+" = getW("+ie+", "+(ce+1)+`, d1, q);
|
|
|
wR`+ie+"C"+(ce+1)+` =
|
|
|
vec4(wTexelR`+ie+"C"+(ce+1)+".xz, wTexelR"+ie+"C"+(ce+1)+".xz);"))}for(ie=0;ie<P;ie++)for(ce=0;ce<G;ce++)ue+="dotProd += xR"+ie+"C"+ce+" * wR"+ie+"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);
|
|
|
}
|
|
|
`},Ft=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],E=e[0],I=e[1];this.outputShape=[f,E,I,u];var P=t==="bilinear"?1:0,G=[i-1+".0",s-1+".0"],oe=G[0],ue=G[1],ie=E>1?[""+(i-1)/(E-1),"(y2-y1) * height_ratio","y1*"+oe+" + float(y)*(height_scale)"]:["0.0","0.0","0.5 * (y1+y2) * "+oe],ce=ie[0],ye=ie[1],we=ie[2],Ee=I>1?[""+(s-1)/(I-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],He=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 = `+ye+`;
|
|
|
float width_scale = `+Me+`;
|
|
|
|
|
|
float in_y = `+we+`;
|
|
|
if( in_y < 0.0 || in_y > `+oe+` ) {
|
|
|
setOutput(float(`+o+`));
|
|
|
return;
|
|
|
}
|
|
|
float in_x = `+He+`;
|
|
|
if( in_x < 0.0 || in_x > `+ue+` ) {
|
|
|
setOutput(float(`+o+`));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
vec2 sourceFracIndexCR = vec2(in_x,in_y);
|
|
|
if(`+P+` == 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() {
|
|
|
`+ze(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) {
|
|
|
`+R(["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) {
|
|
|
`+R(["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=`
|
|
|
`+S+`
|
|
|
|
|
|
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=`
|
|
|
`+S+`
|
|
|
|
|
|
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=`
|
|
|
`+b(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 E=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[`+E+`] = values[0];
|
|
|
} else if(offset == 1) {
|
|
|
result[`+E+`] = values[1];
|
|
|
} else if(offset == 2) {
|
|
|
result[`+E+`] = values[2];
|
|
|
} else {
|
|
|
result[`+E+`] = values[3];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
`}this.userCode=`
|
|
|
`+b(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=ze(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"],E=[],I=0;I<i.length;I++)I===s?E.push("int(getIndices("+f[I]+"))"):E.push(""+f[I]);return E.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=ze(r.length),o=ze(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(E,I){var P=$n(E,I);return P[0]*P[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=c().getNumber("WEBGL_VERSION");r!=null?(this.gl=r,Ga(e,r)):this.gl=vn(e);var t="WEBGL_color_buffer_float";if(c().getNumber("WEBGL_VERSION")===1){if(this.textureFloatExtension=Lo(this.gl,this.debug,"OES_texture_float"),Jr(this.gl,"OES_texture_half_float"))this.textureHalfFloatExtension=Lo(this.gl,this.debug,"OES_texture_half_float");else if(c().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=Lo(this.gl,this.debug,"EXT_color_buffer_half_float");else if(c().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 c().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(c().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 c().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(e=this.beginQuery(),this.endQuery(),t=function(){return o.isQueryAvailable(e,c().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=Lo(this.gl,this.debug,c().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(c().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(c().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 x(this,void 0,void 0,function(){var e=this;return v(this,function(t){switch(t.label){case 0:return[4,L(function(){return e.disposed||e.isQueryAvailable(r,c().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))})];case 1:return t.sent(),[2,this.getQueryTime(r,c().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||L(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,E=e.dilationHeight,I=e.dataFormat,P=s.left,G=s.top,oe=o*t,ue=Kr(),ie=I==="channelsLast",ce=ie?0:1,ye=ie?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+" - "+G+`;
|
|
|
d0 = offsetY + `+E+" * (pos / "+oe+`);
|
|
|
|
|
|
if(d0 < `+r[ce]+` && d0 >= 0) {
|
|
|
|
|
|
offsetX = int(mod(float(blockIndex), `+u+".) * "+a+". - "+P+`.);
|
|
|
d1 = offsetX + `+f+" * (int(mod(float(pos), "+oe+".) / "+o+`.));
|
|
|
|
|
|
if(d1 < `+r[ye]+` && d1 >= 0) {
|
|
|
|
|
|
ch = int(mod(float(pos), `+o+`.));
|
|
|
|
|
|
if (`+ie+`) {
|
|
|
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,E=s-1-n.padInfo.front,I=u-1-n.padInfo.top,P=f-1-n.padInfo.left,G=s*u*f-1;this.userCode=`
|
|
|
const ivec3 pads = ivec3(`+E+", "+I+", "+P+`);
|
|
|
|
|
|
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 = `+G+` -
|
|
|
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",E=t?"rc.z, i * 2":"i * 2, rc.z",I=e?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],P=t?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],G="",oe="";a&&(G=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=`
|
|
|
`+G+`
|
|
|
|
|
|
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, `+E+`);
|
|
|
|
|
|
// These swizzled products need to be separately added.
|
|
|
// See: https://github.com/tensorflow/tfjs/issues/1735
|
|
|
result += (`+I[0]+" * "+P[0]+`);
|
|
|
result += (`+I[1]+" * "+P[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=ze(r),o=function(s,u,f){if(s===1)return"rc > "+u[0];for(var E="",I=s-2;I<s;I++)E+=f[I]+" >= "+u[I],I<s-1&&(E+="||");return E}(r,n,e),a=function(s,u,f,E){if(s===1)return"";var I=E.slice(-2);return`
|
|
|
int r = `+I[0]+`;
|
|
|
int c = `+I[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,E=function(I,P){for(var G=[],oe=0;oe<=1;oe++)for(var ue=0;ue<=1;ue++){for(var ie=(oe===0?"r":"rp1")+", "+(ue===0?"c":"cp1"),ce=2;ce<I;ce++)ie=P[P.length-1-ce]+","+ie;G.push(ie)}return G}(f,u);return f===1?`getA(rc),
|
|
|
rc + 1 >= `+s[0]+` ? 0. : getA(rc + 1),
|
|
|
0, 0`:"getA("+E[0]+`),
|
|
|
cEdge ? 0. : getA(`+E[1]+`),
|
|
|
rEdge ? 0. : getA(`+E[2]+`),
|
|
|
rEdge || cEdge ? 0. : getA(`+E[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=ze(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(ie,ce){return ie[0]+n[ce]+ie[1]});for(var t=n.length,o=ze(t),a=r.map(function(ie){return ie[0]}).join(","),i=r.map(function(ie,ce){return ie[0]+n[ce]}).join(","),s=en("rc",t),u=en("source",t),f=s[t-1]+" < "+this.outputShape[t-1],E=t===1?"source":"vec2("+u.slice(-2).join()+")",I=[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+") {"],P=t===1?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))",G="",oe=0,ue=t===1?2:4;oe<ue;oe++)G+=`
|
|
|
`+I[oe]+`
|
|
|
if (`+P+`) {
|
|
|
result[`+oe+"] = float("+e+`);
|
|
|
} else {
|
|
|
`+o+` source = rc - start;
|
|
|
result[`+oe+"] = getChannel(getX("+u.join()+"), "+E+`);
|
|
|
}
|
|
|
`;G+=t===1?"} ":"}}",this.userCode=`
|
|
|
const `+o+" start = "+o+"("+a+`);
|
|
|
const `+o+" end = "+o+"("+i+`);
|
|
|
|
|
|
void main() {
|
|
|
`+o+` outputLoc = getOutputCoords();
|
|
|
vec4 result = vec4(0.);
|
|
|
`+G+`
|
|
|
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,E=n.padInfo.top,I=n.padInfo.left;this.outputShape=n.outShape;var P=r==="avg",G="0.0";if(P||(G="-1.0 / 1e-20"),e)this.userCode=`
|
|
|
const ivec2 strides = ivec2(`+o+", "+a+`);
|
|
|
const ivec2 pads = ivec2(`+E+", "+I+`);
|
|
|
|
|
|
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),ie=t%4,ce=`
|
|
|
if (`+P+`) {
|
|
|
avgValue += dot(values, ones);
|
|
|
} else {
|
|
|
minMaxValue = max(values, minMaxValue);
|
|
|
}
|
|
|
`;this.userCode=`
|
|
|
const ivec2 strides = ivec2(`+o+", "+a+`);
|
|
|
const ivec2 pads = ivec2(`+E+", "+I+`);
|
|
|
const float initializationValue = `+G+`;
|
|
|
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(`+G+`);
|
|
|
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 (`+(ie===1)+`) {
|
|
|
vec4 values = vec4(
|
|
|
getValue(batch, xR, xC, d),
|
|
|
initializationValue,
|
|
|
initializationValue,
|
|
|
initializationValue
|
|
|
);
|
|
|
|
|
|
`+ce+`
|
|
|
} else if (`+(ie===2)+`) {
|
|
|
vec4 values = vec4(
|
|
|
getValue(batch, xR, xC, d),
|
|
|
getValue(batch, xR, xC + `+s+`, d),
|
|
|
initializationValue,
|
|
|
initializationValue
|
|
|
);
|
|
|
|
|
|
`+ce+`
|
|
|
} else if (`+(ie===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,E=n.effectiveFilterDepth,I=n.effectiveFilterHeight,P=n.effectiveFilterWidth,G=n.padInfo.front,oe=n.padInfo.top,ue=n.padInfo.left;this.outputShape=n.outShape;var ie=r==="avg",ce="0.0";if(ie||(ce="-1.0 / 1e-20"),e)this.userCode=`
|
|
|
const ivec3 strides =
|
|
|
ivec3(`+o+", "+a+", "+i+`);
|
|
|
const ivec3 pads = ivec3(`+G+", "+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 < `+E+`;
|
|
|
wD += `+s+`) {
|
|
|
int xD = xDCorner + wD;
|
|
|
|
|
|
if (xD < 0 || xD >= `+n.inDepth+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int wR = 0; wR < `+I+`;
|
|
|
wR += `+u+`) {
|
|
|
int xR = xRCorner + wR;
|
|
|
|
|
|
if (xR < 0 || xR >= `+n.inHeight+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int wC = 0; wC < `+P+`;
|
|
|
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 * `+I+" * "+P+` +
|
|
|
wR * `+P+` + wC;;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
setOutput(float(minMaxPosition));
|
|
|
}
|
|
|
`;else{var ye=r+"("+r+"("+r+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";r==="avg"&&(ye="avgValue / count");var we=4*Math.floor(t/4),Ee=t%4,Se=`
|
|
|
if (`+ie+`) {
|
|
|
avgValue += dot(values, ones);
|
|
|
} else {
|
|
|
minMaxValue = max(values, minMaxValue);
|
|
|
}
|
|
|
`;this.userCode=`
|
|
|
const ivec3 strides =
|
|
|
ivec3(`+o+", "+a+", "+i+`);
|
|
|
const ivec3 pads = ivec3(`+G+", "+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 < `+E+`;
|
|
|
wD += `+s+`) {
|
|
|
int xD = xDCorner + wD;
|
|
|
|
|
|
if (xD < 0 || xD >= `+n.inDepth+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int wR = 0; wR < `+I+`;
|
|
|
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(`+ye+`);
|
|
|
}
|
|
|
}
|
|
|
`}},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),E=e%4,I=`
|
|
|
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);
|
|
|
}
|
|
|
`,P="vec4";r==="all"?(i="1.0",I=`
|
|
|
bool reducedAllValue = all(values);
|
|
|
float floatedReducedAllValue = float(reducedAllValue);
|
|
|
allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);
|
|
|
`,P="bvec4"):r==="any"&&(i="0.0",I=`
|
|
|
bool reducedAnyValue = any(values);
|
|
|
float floatedReducedAnyValue = float(reducedAnyValue);
|
|
|
anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);
|
|
|
`,P="bvec4");var G="";o%e>0&&(G=`
|
|
|
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) {
|
|
|
`+G+`
|
|
|
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;
|
|
|
`+P+" values = "+P+`(
|
|
|
getValue(batch, inIdx),
|
|
|
getValue(batch, inIdx + 1),
|
|
|
getValue(batch, inIdx + 2),
|
|
|
getValue(batch, inIdx + 3)
|
|
|
);
|
|
|
|
|
|
`+I+`
|
|
|
}
|
|
|
|
|
|
int inIdx = inOffset + `+f+`;
|
|
|
if (`+(E===1)+`) {
|
|
|
`+P+" values = "+P+`(
|
|
|
getValue(batch, inIdx),
|
|
|
initializationValue,
|
|
|
initializationValue,
|
|
|
initializationValue
|
|
|
);
|
|
|
|
|
|
`+I+`
|
|
|
} else if (`+(E===2)+`) {
|
|
|
`+P+" values = "+P+`(
|
|
|
getValue(batch, inIdx),
|
|
|
getValue(batch, inIdx + 1),
|
|
|
initializationValue,
|
|
|
initializationValue
|
|
|
);
|
|
|
|
|
|
`+I+`
|
|
|
} else if (`+(E===3)+`) {
|
|
|
`+P+" values = "+P+`(
|
|
|
getValue(batch, inIdx),
|
|
|
getValue(batch, inIdx + 1),
|
|
|
getValue(batch, inIdx + 2),
|
|
|
initializationValue
|
|
|
);
|
|
|
|
|
|
`+I+`
|
|
|
}
|
|
|
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) {
|
|
|
`+R(["r","c","d"],r)+`
|
|
|
return ivec3(r, c, d);
|
|
|
}
|
|
|
|
|
|
`+b(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],E=[e&&s>1?s-1:s,e&&u>1?u-1:u],I=f[0]/E[0],P=f[1]/E[1],G=1/I,oe=1/P,ue=2*Math.ceil(G)+2,ie=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(`+I+`);
|
|
|
const float widthScale = float(`+P+`);
|
|
|
|
|
|
const float invHeightScale = float(`+G+`);
|
|
|
const float invWidthScale = float(`+oe+`);
|
|
|
|
|
|
const int winHeight = int(`+ue+`);
|
|
|
const int winWidth = int(`+ie+`);
|
|
|
|
|
|
// 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],E=[e&&s>1?s-1:s,e&&u>1?u-1:u],I=f[0]/E[0],P=f[1]/E[1],G=1/I,oe=1/P,ue=2*Math.ceil(G)+2,ie=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(`+I+`);
|
|
|
const float widthScale = float(`+P+`);
|
|
|
|
|
|
const float invHeightScale = float(`+G+`);
|
|
|
const float invWidthScale = float(`+oe+`);
|
|
|
|
|
|
const int winHeight = int(`+ue+`);
|
|
|
const int winWidth = int(`+ie+`);
|
|
|
|
|
|
// 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(`+E[0]+`));
|
|
|
|
|
|
float sourceFracCol =
|
|
|
float(`+f[1]+`) *
|
|
|
(float(dyC) / float(`+E[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],E=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 + `+E+`)));
|
|
|
|
|
|
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=ze(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=ze(e);function s(u){var f=n.map(function(E,I){return function(P,G){return r.indexOf(P)!==-1&&n[P]!==1?n[P]+" - "+G[P]+" - 1":""+G[P]}(I,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=ze(o.length),u=ze(a.length),f="";e===1?f="i":e===2&&(f="i, j");var E="getIndices("+f+")",I="";t===1?I="i":t===2&&(I="i, coords[1]");var P="getUpdates("+I+")",G=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(`+E+`);
|
|
|
flattenedIndex += index * `+G+`;
|
|
|
}
|
|
|
if (flattenedIndex == coords[0]) {
|
|
|
sum += `+P+`;
|
|
|
found = true;
|
|
|
}
|
|
|
}
|
|
|
setOutput(mix(getDefaultValue(), sum, float(found)));
|
|
|
}
|
|
|
`},Dd=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);
|
|
|
`,E="";o%e>0&&(E=`
|
|
|
if (inIdx < 0 || inIdx >= `+o+`) {
|
|
|
return initializationValue;
|
|
|
}
|
|
|
`);var I="";o%e>0&&(I=`
|
|
|
if (inIdx < 0 || inIdx >= `+o+`) {
|
|
|
return -1.0;
|
|
|
}
|
|
|
`),this.userCode=`
|
|
|
const float initializationValue = 0.0;
|
|
|
|
|
|
float getValue(int batch, int inIdx) {
|
|
|
`+E+`
|
|
|
return getX(batch, inIdx);
|
|
|
}
|
|
|
|
|
|
float getSegmentIdAtIndex(int inIdx) {
|
|
|
`+I+`
|
|
|
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);
|
|
|
}
|
|
|
`},Nd=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=ze(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=ze(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=ze(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(E,I){return"start["+I+"]"}).join()+");":r.map(function(E,I){return o[I]+" = "+t[I]+" + start["+I+"];"}).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=ze(e.length),a=ze(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+`));
|
|
|
}
|
|
|
`},Ld=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 c().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 jd=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=ze(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=[],E=0;E<i.length;E++)f.push("imod("+u[E]+", "+i[E]+")");return f.join()}(n);this.userCode=`
|
|
|
void main() {
|
|
|
`+o+` resRC = getOutputCoords();
|
|
|
setOutput(getA(`+a+`));
|
|
|
}
|
|
|
`},Fd=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=ze(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),E=0;E<i.length;E++)f[i[E]]=u[E];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=ze(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);
|
|
|
}
|
|
|
`},Dn="if (isnan(x)) return x;",Ud="return x;",Ic="return abs(x);",Dc=Dn+`
|
|
|
return (x < 0.0) ? 0.0 : x;
|
|
|
`,Nc=Dn+`
|
|
|
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);",Lc="return floor(x);",jc="return exp(x);",Fc="return exp(x) - 1.0;",Hd=Dn+`
|
|
|
return sin(x);
|
|
|
`,zd=Dn+`
|
|
|
return cos(x);
|
|
|
`,Gd=Dn+`
|
|
|
if (abs(x) > 1.) {
|
|
|
return NAN;
|
|
|
}
|
|
|
return asin(x);
|
|
|
`,Vd=Dn+`
|
|
|
if (abs(x) > 1.) {
|
|
|
return NAN;
|
|
|
}
|
|
|
return acos(x);
|
|
|
`,Xd=Dn+`
|
|
|
return atan(x);
|
|
|
`,Kd=Dn+"return log(x + sqrt(x * x + 1.0));",Yd=Dn+`
|
|
|
if (x < 1.0) return NAN;
|
|
|
return log(x + sqrt(x * x - 1.0));`,$d=Dn+`
|
|
|
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=ze(r),o=function(s,u){if(s===1)return"rc";for(var f="",E=0;E<s;E++)f+=u[E],E<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:Dc;if(n==="elu")return r?Wc:kc;if(n==="relu6")return r?Uc:Nc;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,!c().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");if(e==null){var a=vn(c().getNumber("WEBGL_VERSION"));o.binaryCache=((t=c().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 Ld(o.gpgpu),o.numMBBeforeWarning=c().global.screen==null?1024:c().global.screen.height*c().global.screen.width*window.devicePixelRatio*Qd/1024/1024,o.texData=new _a(o,Ve),o}return A(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(c().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(c().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 E=void 0;E=f?new xi(u,is):new zt(u,is);var I=this.runWebGLProgram(E,[{dataId:e,shape:u,dtype:a}],a),P=this.readSync(I.dataId);return this.disposeData(I.dataId),P}if(o!=null)return this.convertAndCacheOnCPU(e);if(a==="string")return o;var G,oe,ue=this.activeTimers!=null;return(ue&&(G=Re()),a==="complex64")?oe=Oa(i.real.dataSync(),i.imag.dataSync()):oe=this.getValuesFromTexture(e),ue&&(this.downloadWaitMs+=Re()-G),this.convertAndCacheOnCPU(e,oe)},r.prototype.read=function(e){return x(this,void 0,void 0,function(){var t,o,a,i,s,u,f,E,I,P,G,oe,ue,ie,ce,ye,we,Ee,Se,Me,He,Fe;return v(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,E=o.isPacked,s!=null)return I=void 0,I=E?new xi(i,is):new zt(i,is),P=this.runWebGLProgram(I,[{dataId:e,shape:i,dtype:u}],u),G=this.read(P.dataId),this.disposeData(P.dataId),[2,G];if(a!=null)return[2,this.convertAndCacheOnCPU(e)];if(!c().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&c().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"&&c().get("WEBGL_BUFFER_SUPPORTED")&&(ue=this.decode(e),ie=this.texData.get(ue.dataId),oe=(Fe=this.gpgpu).createBufferFromTexture.apply(Fe,[ie.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 ye=je.sent(),we=ye[0],Ee=ye[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),He=this.pendingRead.get(e),this.pendingRead.delete(e),He.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 c().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(c().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")){var f=this.decode(e),E=this.texData.get(f.dataId),I=(t=this.gpgpu).downloadMatrixFromPackedTexture.apply(t,[E.texture].concat(Or(a))).subarray(0,u);return this.disposeData(f.dataId),I}var P=c().getBool("WEBGL_PACK")&&s===!0,G=P?vo(a):a,oe=P?new Yo(G):new Hn(G),ue=this.runWebGLProgram(oe,[{shape:G,dtype:i,dataId:e}],"float32"),ie=this.texData.get(ue.dataId),ce=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(ie.texture,ie.texShape[0],ie.texShape[1]).subarray(0,u);return this.disposeData(ue.dataId),ce},r.prototype.time=function(e){return x(this,void 0,void 0,function(){var t,o,a,i,s,u,f;return v(this,function(E){switch(E.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=he(this.activeTimers.map(function(I){return I.query})).filter(function(I){return I!=null}),s=he(this.activeTimers.map(function(I){return I.name})).filter(function(I){return I!=null}),this.activeTimers=t,a&&(this.programTimersStack=null),u={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null},c().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?[4,Promise.all(i)]:[3,2];case 1:return f=E.sent(),u.kernelMs=q(f),u.getExtraProfileInfo=function(){return f.map(function(I,P){return{name:s[P],ms:I}}).map(function(I){return I.name+": "+I.ms}).join(", ")},[3,3];case 2:u.kernelMs={error:"WebGL query timers are not supported in this environment."},E.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 c().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:Re(),endMs:null}},r.prototype.endTimer=function(e){return c().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),e):(e.endMs=Re(),e)},r.prototype.getQueryTime=function(e){return x(this,void 0,void 0,function(){var t;return v(this,function(o){return c().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,E=f&&f.origDataId||e,I=this.dataRefCount.get(E);I>1?this.dataRefCount.set(E,I-1):(this.dataRefCount.delete(E),o!=null&&(this.numBytesInGPU-=this.computeBytes(i,a),this.textureManager.releaseTexture(o,i,s,u)));var P=this.texData.get(e);P.texture=null,P.texShape=null,P.isPacked=!1,P.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 c().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=c().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=c().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(G){return un(G)}),a=e.map(function(G){return xn(G)});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>c().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(c().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&e[0].rank>1){var f=new ur(e.map(function(G){return G.shape}),t);return this.compileAndRun(f,e)}var E=qn(e.map(function(G){return G.shape}),t),I=e.map(function(G){return G.as2D(-1,le(G.shape.slice(t)))}),P=new tn(I.map(function(G){return G.shape}));return this.compileAndRun(P,I).reshape(E)},r.prototype.neg=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.neg(e);if(c().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 E=s===1?e:e.as3D(f,u,1),I=s===1?2:1,P=s===1?t.as3D(f,1,u):t;return this.multiply(E,P).sum(I,!0)}var G=nr(e.dtype,t.dtype),oe=new su(e.shape,[f,i,s],o,a);return this.compileAndRun(oe,[e,t],G)},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,E=a?t.shape[2]:t.shape[1],I=i?o.shape[1]:o.shape[2],P=t.shape[0],G=nr(t.dtype,o.dtype),oe=s!=null,ue=f!=null,ie=u?us(u,!0):null,ce=new su(t.shape,[P,E,I],a,i,oe,ie,ue),ye=[t,o];return s&&ye.push(s),f&&ye.push(f),this.compileAndRun(ce,ye,G)},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(mt,e.shape,t.shape),s=new Wt(_t,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),E=this.compileAndRun(s,u),I=this.complex(f,E);return f.dispose(),E.dispose(),I}if(this.shouldExecuteOnCPU([e,t]))return this.cpuBackend.multiply(e,t);if(c().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,or,e.dtype);var P=new Ut(or,e.shape,t.shape);return this.compileAndRun(P,[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 E=null;if(i!=null&&(E=i.shape,u.push(i)),c().getBool("WEBGL_PACK_NORMALIZATION")){var I=new At(e.shape,t.shape,o.shape,f,E,a);return this.compileAndRun(I,u)}var P=new Dt(e.shape,t.shape,o.shape,f,E,a);return this.compileAndRun(P,u)},r.prototype.localResponseNormalization4D=function(e,t,o,a,i){var s=c().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 rt(i)});return os(jt(e.shape,e.dtype,o),t)}var a=new jd(e.shape,t);return this.compileAndRun(a,[e])},r.prototype.pad=function(e,t,o){var a=c().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=c().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Bd(e.shape,t):new Fd(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){w(e.rank<=4,function(){return"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet"});var a=t.reduce(function(I,P){return I*P}),i=Wo(e.shape,t,a),s=qt(i.length,t.length),u=wa(e.shape,t,a),f=Gs(o,t.length),E=Vs(u,o,t.length);return e.reshape(i).transpose(s).reshape(u).slice(f,E)},r.prototype.spaceToBatchND=function(e,t,o){w(e.rank<=4,function(){return"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet"});var a=t.reduce(function(P,G){return P*G}),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),E=qt(f.length,t.length,!1),I=wa(u.shape,t,a,!1);return u.reshape(f).transpose(E).reshape(I)},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 E=this.compileAndRun(u,f,"int32");return E.shape[1]===1?E:this.argReduce(e,t,E)},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 vt(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(G,oe,ue){for(var ie=[],ce=G.length,ye=0;ye<ce;ye++)ye!==oe?ie.push(G[ye]):ie.push(ue);return ie}(s.shape,a,o),f=le([s.shape[a]]),E=s.as2D(-1,f),I=hr(e.dtype),P=this.segOpCompute(E,"unsortedSegmentSum",t,I,o).reshape(u);return i!=null&&(P=P.transpose(bo(i))),P},r.prototype.segOpCompute=function(e,t,o,a,i){var s=e.shape[0],u=e.shape[1],f=function(P,G){var oe,ue=!1;for(P<=Ki?(oe=P,ue=!0):oe=ge(P,Math.floor(Math.sqrt(P)));!ue;)oe>G||oe===P?ue=!0:oe=ge(P,oe+1);return oe}(u,i),E=new Dd({windowSize:f,inSize:u,batchSize:s,numSegments:i},t),I=this.compileAndRun(E,[e,o],a);return I.shape[1]===i?I:(o=fa(0,i).tile([u/f]),this.segOpCompute(I,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),!c().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(c().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(c().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(c().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(c().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(c().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(c().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(c().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(c().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 Nd(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=c().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=c().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=c().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(c().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(c().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(c().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(P){var G=P[0],oe=P[1],ue=a.makeComplexComponentTensorInfo(e,G),ie=a.makeComplexComponentTensorInfo(t,oe),ce=new Ut(o,e.shape,t.shape);return a.compileAndRun(ce,[ue,ie],nr(G.dtype,oe.dtype))}),f=u[0],E=u[1],I=this.complex(f,E);return f.dispose(),E.dispose(),I},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>c().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,E){return nr(f,E)}),s=e.map(function(f){return f.shape}),u=c().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(c().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=c().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(c().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(c().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.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(c().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.expm1=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.expm1(e);if(c().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.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(c().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=c().getBool("WEBGL_PACK")?new xi(e.shape,Bc):new zt(e.shape,Dc),this.compileAndRun(t,[e])},r.prototype.relu6=function(e){var t;return t=c().getBool("WEBGL_PACK")?new xi(e.shape,Uc):new zt(e.shape,Nc),this.compileAndRun(t,[e])},r.prototype.prelu=function(e,t){var o=c().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(c().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=c().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=c().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(c().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=c().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),Dn+`
|
|
|
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),E=o.inChannels,I=u[0]*u[1]*u[2],P=o.outChannels,G=o.dataFormat==="channelsLast",oe=(I===1||P===1)&&E>1e3,ue=u[2]%2!=0&&!!f.isPacked;if(oe||!c().getBool("WEBGL_LAZILY_UNPACK")||!c().getBool("WEBGL_PACK_BINARY_OPERATIONS")||!ue){var ie=G?u[0]*u[1]*u[2]:u[0]*u[2]*u[3],ce=this.reshape(e,[1,ie,o.inChannels]),ye=this.reshape(t,[1,o.inChannels,o.outChannels]);return this.reshape(this.fusedBatchMatMul({a:ce,b:ye,transposeA:!1,transposeB:!1,bias:a,activation:i,preluActivationWeights:s}),o.outShape)}var we=G?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]++,w(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]),He=this.fusedBatchMatMul({a:Ee,b:Me,transposeA:!1,transposeB:!1,bias:a,activation:i,preluActivationWeights:s}),Fe=this.texData.get(He.dataId);return w(Fe.isPacked,function(){return"batchMatMul result is expected to be packed"}),f.shape=Se,Fe.shape=o.outShape,Ve.makeTensorFromDataId(He.dataId,o.outShape,He.dtype)},r.prototype.conv2dWithIm2Row=function(e,t,o,a,i,s){var u=o.filterWidth,f=o.filterHeight,E=o.inChannels,I=o.outWidth,P=o.outHeight,G=o.dataFormat==="channelsLast",oe=u*f*E,ue=P*I,ie=[oe,ue],ce=e.squeeze([0]),ye=t.reshape([1,oe,-1]),we=new dd(ie,ce.shape,o),Ee=this.compileAndRun(we,[ce]).reshape([1,ie[0],ie[1]]),Se=a!=null,Me=s!=null,He=i?us(i,!0):null,Fe=new su(Ee.shape,[1,ue,o.outChannels],!0,!1,Se,He,Me),je=[Ee,ye];a&&je.push(a),Me&&je.push(s);var Ue=this.compileAndRun(Fe,je);return G?Ue.reshape([1,P,I,o.outChannels]):Ue.reshape([1,o.outChannels,P,I])},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(c().getBool("WEBGL_CONV_IM2COL")&&t.shape[0]===1)return this.conv2dWithIm2Row(t,o,a,i,s,u);var f=i!=null,E=u!=null,I=s?us(s,!1):null,P=new kt(a,f,I,E),G=[t,o];return i&&G.push(i),u&&G.push(u),this.compileAndRun(P,G)},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(c().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,E=c().getBool("WEBGL_PACK_DEPTHWISECONV")&&i.strideWidth<=2&&i.outChannels/i.inChannels==1,I=u?us(u,E):null,P=[o,a],G=s!=null,oe=f!=null;return G&&P.push(s),oe&&P.push(f),E?(t=new dr(i,G,I,oe),this.compileAndRun(t,P)):(t=new yr(i,G,I,oe),this.compileAndRun(t,P))},r.prototype.depthwiseConv2D=function(e,t,o){var a;return c().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 wt(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 E=new Array(o);for(s=0;s<E.length;s++)u[t]=s,E[s]=this.slice(e,u,f).reshape(a);return E},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 Ct(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=c().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),E=f.getCustomSetupFunc(a);return this.compileAndRun(f,[i],"int32",E)},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 Ft(e.shape,t.shape,a,i,s);return this.compileAndRun(u,[e,t,o],"float32")},r.prototype.depthToSpace=function(e,t,o){w(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,E=s*t,I=u/(t*t),P=new wr(o==="NHWC"?[a,f,E,I]:[a,I,f,E],t,o);return this.compileAndRun(P,[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,E=a.outputSize,I=[E/u,u],P=e.reshape([s,i]),G=t.reshape([s,u]);if(E===0)return Aa(Ur([]),o);var oe=It(0),ue=new Ac(s,i,P.rank,G.rank,f,I);return this.compileAndRun(ue,[G,P,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,E=i.outputSize,I=new Ac(u,s,e.rank,t.rank,f,[E,1],!1);return this.compileAndRun(I,[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),E=this.complex(u,f).as2D(e.shape[0],e.shape[1]);return u.dispose(),f.dispose(),E},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],E=i[3],I=t.reshape([u,a]),P=e.reshape([e.size/f,f]),G=new gi(a,E,[u,f]);return this.compileAndRun(G,[P,I]).reshape(s)},r.prototype.fill=function(e,t,o){if((o=o||ot(t))==="string"){var a=Ne(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 E=Or(e.outputShape);f.texShape=E.map(function(we){return 2*we})}if(e.outTexUsage!=null&&(f.usage=e.outTexUsage),le(u.shape)===0)return f.values=xe(u.dtype,0),u;var I=[],P=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)<=c().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),I.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),I.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 G,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 He=we.userCode,Fe=we.constructor.name;return Fe+="_"+Me+"_"+He}(e,P,oe),ie=this.getAndSaveBinary(ue,function(){return function(we,Ee,Se,Me){var He=Ee.userCode,Fe=Se.map(function(ut,gt){var yt={logicalShape:ut.shape,texShape:ut.isUniform?null:ut.texData.texShape,isUniform:ut.isUniform,isPacked:!ut.isUniform&&ut.texData.isPacked,flatOffset:null};return ut.texData!=null&&ut.texData.slice!=null&&ut.texData.slice.flatOffset>0&&(yt.flatOffset=ut.texData.slice.flatOffset),{name:Ee.variableNames[gt],shapeInfo:yt}}),je=Fe.map(function(ut){return ut.shapeInfo}),Ue={logicalShape:Me.shape,texShape:Me.texData.texShape,isUniform:!1,isPacked:Me.texData.isPacked,flatOffset:null},Ze=N(Fe,Ue,He,Ee.packedInputs),Je=we.createProgram(Ze),dt=null,ct=we.getUniformLocation(Je,"NAN",!1);c().getNumber("WEBGL_VERSION")===1&&(dt=we.getUniformLocation(Je,"INFINITY",!1));for(var st={},pt=0;pt<Ee.variableNames.length;pt++){var ht=Ee.variableNames[pt];st[ht]=we.getUniformLocation(Je,ht,!1),st["offset"+ht]=we.getUniformLocation(Je,"offset"+ht,!1)}return{program:Ee,source:Ze,webGLProgram:Je,uniformLocations:st,inShapeInfos:je,outShapeInfo:Ue,infLoc:dt,nanLoc:ct}}(s.gpgpu,e,P,oe)}),ce=this.activeTimers!=null;if(ce&&(G=this.startTimer()),function(we,Ee,Se,Me,He){Sc(Ee.inShapeInfos,Se),Sc([Ee.outShapeInfo],[Me]);var Fe=Me.texData.texture,je=Me.texData.texShape;Me.texData.isPacked?we.setOutputPackedMatrixTexture(Fe,je[0],je[1]):we.setOutputMatrixTexture(Fe,je[0],je[1]),we.setProgram(Ee.webGLProgram),c().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],dt=Ee.uniformLocations[Je],ct=Ee.uniformLocations["offset"+Je];if(dt!=null)if(Ue.isUniform)if(le(Ue.shape)<2)we.gl.uniform1f(dt,Ue.uniformValues[0]);else{var st=Ue.uniformValues;st instanceof Float32Array||(st=new Float32Array(st)),we.gl.uniform1fv(dt,st)}else Ue.texData.slice!=null&&ct!=null&&we.gl.uniform1i(ct,Ue.texData.slice.flatOffset),we.setInputMatrixTexture(Ue.texData.texture,dt,Ze)}),He!=null&&He(we,Ee.webGLProgram),we.executeProgram()}(this.gpgpu,ie,P,oe,a),I.forEach(function(we){return s.disposeData(we.dataId)}),ce&&(G=this.endTimer(G),this.activeTimers.push({name:e.constructor.name,query:this.getQueryTime(G)})),!c().getBool("WEBGL_LAZILY_UNPACK")&&f.isPacked&&i===!1){var ye=this.unpackTensor(u);return this.disposeData(u.dataId),ye}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||(c().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(!c().get("WEBGL_RENDER_FLOAT32_ENABLED")){var t=c().getBool("DEBUG");c().set("DEBUG",!1);var o=e.abs(It(1e-8)).dataSync()[0];if(c().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,E=o.isPacked;if(u==null){var I,P=this.activeTimers!=null;P&&(I=Re());var G=o.texShape;if(G==null&&(G=Ri(a,E),o.texShape=G),s!=null){var oe=vo(a),ue=void 0,ie=G[1],ce=G[0],ye=s instanceof Uint8Array;E?(ie=(t=$n(G[0],G[1]))[0],ce=t[1],ue=new Ra(oe,[ce,ie],ye)):ue=new Br(oe,[ce,ie],ye);var we=this.makeTensorInfo([ce,ie],i);this.texData.get(we.dataId).usage=ye?Wr.PIXELS:Wr.UPLOAD,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(we.dataId),ie,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,P&&(this.uploadWaitMs+=Re()-I)}else{var Me=this.acquireTexture(G,f,i,E);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]*nt(t)},r}(Ca);Ha()&&Ve.registerBackend("webgl",function(){return new Hc},2);var Zd=Ke({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=Ke({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],E=u[1],I=It(2);return{a:function(){return s.mul(f.sub(E).mul(I))},b:function(){return s.mul(E.sub(f).mul(I))}}},wi,{},i,[])}}),ef=Ke({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=Ke({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(It(1).sub(o.toFloat().square()).sqrt()).neg()}}})}}),rf=Ke({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=Ke({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(It(1).sub(o.toFloat().square()).sqrt())}}})}}),of=Ke({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(It(1).add(o.toFloat().square()).sqrt())}}})}}),af=Ke({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=Ke({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(It(1).sub(o.toFloat().square()))}}})}}),uf=Ke({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=Ke({clipByValue_:function(n,r,e){var t=Oe(n,"x","clipByValue");w(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=Ke({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=Ke({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=Ke({erf_:function(n){var r=Oe(n,"x","erf");return w(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=Ke({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=Ke({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=Ke({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=Ke({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=Ke({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=Ke({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=Ke({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=Ke({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=Ke({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=Ke({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=Ke({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(It(1).sub(o)))}}},"Sigmoid")}}),bf=Ke({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=Ke({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=Ke({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=Ke({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=Ke({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=Ke({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=Ke({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=Ke({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=Ke({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=Ke({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=Ke({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 It(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"),E=Oe(e,"variance","batchNorm");return o!=null&&(i=Oe(o,"scale","batchNorm")),t!=null&&(s=Oe(t,"offset","batchNorm")),w(u.rank===2,function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+u.rank+"."}),w(f.rank===2||f.rank===1,function(){return"Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank "+f.rank+"."}),w(E.rank===2||E.rank===1,function(){return"Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank "+E.rank+"."}),i!=null&&w(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&&w(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,E,s,i,a)}function $c(n,r,e,t,o,a){var i,s,u=Oe(n,"x","batchNorm"),f=Oe(r,"mean","batchNorm"),E=Oe(e,"variance","batchNorm");return o!=null&&(i=Oe(o,"scale","batchNorm")),t!=null&&(s=Oe(t,"offset","batchNorm")),w(u.rank===3,function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+u.rank+"."}),w(f.rank===3||f.rank===1,function(){return"Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank "+f.rank+"."}),w(E.rank===3||E.rank===1,function(){return"Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank "+E.rank+"."}),i!=null&&w(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&&w(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,E,s,i,a)}function Jc(n,r,e,t,o,a){var i,s,u=Oe(n,"x","batchNorm"),f=Oe(r,"mean","batchNorm"),E=Oe(e,"variance","batchNorm");return o!=null&&(i=Oe(o,"scale","batchNorm")),t!=null&&(s=Oe(t,"offset","batchNorm")),w(u.rank===4,function(){return"Error in batchNorm4D: x must be rank 4 but got rank "+u.rank+"."}),w(f.rank===4||f.rank===1,function(){return"Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank "+f.rank+"."}),w(E.rank===4||E.rank===1,function(){return"Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank "+E.rank+"."}),i!=null&&w(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&&w(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,E,s,i,a)}function Ei(n,r,e,t,o,a){a==null&&(a=.001);var i,s,u,f=Oe(n,"x","batchNorm"),E=Oe(r,"mean","batchNorm"),I=Oe(e,"variance","batchNorm");o!=null&&(i=Oe(o,"scale","batchNorm")),t!=null&&(s=Oe(t,"offset","batchNorm")),w(E.rank===I.rank,function(){return"Batch normalization gradient requires mean and variance to have equal ranks."}),w(s==null||E.rank===s.rank,function(){return"Batch normalization gradient requires mean and offset to have equal ranks."}),w(i==null||E.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 P=[f,E,I,i];return Ve.runKernelFunc(function(G,oe){var ue=G.batchNormalization(u,cs(E),cs(I),a,cs(i),cs(s));return oe([f,E,I,i]),ue},{x:f,mean:E,variance:I,scale:i,offset:s},function(G,oe){var ue=oe,ie=ue[0],ce=ue[1],ye=ue[2],we=ue[3],Ee=we==null?It(1):we,Se=Ir(ce.shape,u.shape),Me=[];if(ce.rank===1){for(var He=0;He<u.shape.length-1;++He)Me.push(u.shape[He]);Me.push(1)}var Fe=ie.sub(ce),je=G.mul(Ee),Ue=Xc(ye.add(It(a))),Ze=Ue.mul(Ue).mul(Ue).mul(It(-.5));return{x:function(){return ce.rank===1?G.mul(eo(Ue.as4D(1,1,1,ce.shape[0]),Me)).mul(Ee).reshape(ie.shape):G.mul(Ue).mul(Ee).reshape(ie.shape)},mean:function(){var Je=Ue.mul(It(-1)).mul(je);return ce.rank===1&&(Je=Je.sum(Se)),Je.reshape(ce.shape)},variance:function(){var Je=Ze.mul(Fe).mul(je);return ce.rank===1&&(Je=Je.sum(Se)),Je.reshape(ce.shape)},scale:function(){var Je=Fe.mul(Ue),dt=G.mul(Je);return ce.rank===1&&(dt=dt.sum(Se)),dt.reshape(ce.shape)},offset:function(){var Je=G;return ce.rank===1&&(Je=Je.sum(Se)),Je.reshape(ce.shape)}}},"BatchNormalization",{varianceEpsilon:a},P).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=Ke({batchNormalization2d_:function(n,r,e,t,o,a){return t===void 0&&(t=.001),ls(),Yc(n,r,e,a,o,t)}}),Df=Ke({batchNormalization3d_:function(n,r,e,t,o,a){return t===void 0&&(t=.001),ls(),$c(n,r,e,a,o,t)}}),Nf=Ke({batchNormalization4d_:function(n,r,e,t,o,a){return t===void 0&&(t=.001),ls(),Jc(n,r,e,a,o,t)}}),kf=Ke({batchNormalization_:function(n,r,e,t,o,a){return t===void 0&&(t=.001),ls(),Ei(n,r,e,a,o,t)}}),qc=Ke({batchNorm_:Ei}),Mf=Ke({batchNorm2d_:Yc}),Pf=Ke({batchNorm3d_:$c}),Lf=Ke({batchNorm4d_:Jc}),ds=Ke({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")}}),jf=Ke({logicalNot_:function(n){var r=Oe(n,"x","logicalNot","bool");return Ve.runKernelFunc(function(e){return e.logicalNot(r)},{$x:r})}}),Qc=Ke({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})}}),Ff=Ke({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=Ke({where_:function(n,r,e){var t=Oe(r,"a","where"),o=Oe(e,"b","where"),a=Oe(n,"condition","where","bool");return X(t.shape,o.shape,"Error in where: "),a.rank===1?w(a.shape[0]===t.shape[0],function(){return"The first dimension of `a` must match the size of `condition`."}):X(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 x(this,void 0,void 0,function(){var r,e,t;return v(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=Ke({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=Ke({addN_:function(n){w(Array.isArray(n),function(){return"The argument passed to tf.addN() must be a list of tensors"}),w(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=Ke({addStrict_:function(n,r){var e=Oe(n,"a","addStrict"),t=Oe(r,"b","addStrict");return X(e.shape,t.shape,"Error in addStrict: "),e.add(t)}}),Wf=Ke({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 E=qo(u.square(),f.square()),I=i.mul(f.div(E)),P=Ir(u.shape,a);return P.length>0&&(I=I.sum(P)),I.reshape(u.shape)},$b:function(){var E=qo(u.square(),f.square()),I=hu(i.mul(u.div(E))),P=Ir(f.shape,a);return P.length>0&&(I=I.sum(P)),I.reshape(f.shape)}}})}}),fs=Ke({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 E=i.div(f.toFloat()),I=Ir(u.shape,a);return I.length>0?E.sum(I).reshape(u.shape):E},b:function(){var E=i.mul(u.toFloat()),I=Ir(f.shape,a);I.length>0&&(E=E.sum(I).reshape(f.shape));var P=f.square();return E.div(P.toFloat()).neg()}}},"Div")}}),Hf=Ke({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=Ke({divStrict_:function(n,r){var e=Oe(n,"a","div"),t=Oe(r,"b","div");return X(e.shape,t.shape,"Error in divideStrict: "),e.div(t)}}),el=Ke({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 E=i.div(f.toFloat()),I=Ir(u.shape,a);return I.length>0?E.sum(I).reshape(u.shape):E},b:function(){var E=i.mul(u.toFloat()),I=Ir(f.shape,a);I.length>0&&(E=E.sum(I).reshape(f.shape));var P=f.square();return E.div(P.toFloat()).neg()}}},"FloorDiv")}}),pu=Ke({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=Ke({maximumStrict_:function(n,r){var e=Oe(n,"a","maximumStrict"),t=Oe(r,"b","maximumStrict");return X(e.shape,t.shape,"Error in maximumStrict: "),e.maximum(t)}}),tl=Ke({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=Ke({minimumStrict_:function(n,r){var e=Oe(n,"a","minimumStrict"),t=Oe(r,"b","minimumStrict");return X(e.shape,t.shape,"Error in minimumStrict: "),e.minimum(t)}}),Xf=Ke({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 E=Ir(u.shape,a);return E.length>0?i.sum(E).reshape(u.shape):i},$b:function(){var E=i.mul(u.div(f).floor().neg()),I=Ir(f.shape,a);return I.length>0?E.sum(I).reshape(f.shape):E}}})}}),Kf=Ke({modStrict_:function(n,r){var e=Oe(n,"a","modStrict"),t=Oe(r,"b","modStrict");return X(e.shape,t.shape,"Error in modStrict: "),e.mod(t)}}),Qo=Ke({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 E=i.mul(f.toFloat()),I=Ir(u.shape,a);return I.length>0?E.sum(I).reshape(u.shape):E},b:function(){var E=i.mul(u.toFloat()),I=Ir(f.shape,a);return I.length>0?E.sum(I).reshape(f.shape):E}}},"Mul")}}),Yf=Ke({mulStrict_:function(n,r){var e=Oe(n,"a","mul"),t=Oe(r,"b","mul");return X(e.shape,t.shape,"Error in multiplyStrict: "),e.mul(t)}}),hs=Ke({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],E=u[1],I=u[2];return{a:function(){var P=E.toFloat(),G=s.mul(P.mul(f.pow(P.sub(It(1))))),oe=Ir(f.shape,a);return oe.length>0&&(G=G.sum(oe)),G.reshape(f.shape)},b:function(){var P=f.greater(0),G=f.log().where(P,Jt(f)),oe=s.mul(I.mul(G)),ue=Ir(E.shape,a);return ue.length>0&&(oe=oe.sum(ue)),oe.reshape(E.shape)}}},"Pow",{},i,[!0])}}),$f=Ke({powStrict_:function(n,r){return X(n.shape,r.shape,"Error in powStrict: "),n.pow(r)}}),Jf=Ke({squaredDifferenceStrict_:function(n,r){var e=Oe(n,"a","squaredDifferenceStrict"),t=Oe(r,"b","squaredDifferenceStrict");return X(e.shape,t.shape,"Error in squaredDifferenceStrict: "),e.squaredDifference(t)}}),Ao=Ke({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=Ke({subStrict_:function(n,r){var e=Oe(n,"a","subStrict"),t=Oe(r,"b","subStrict");return X(e.shape,t.shape,"Error in subStrict: "),e.sub(t)}}),rl=Ke({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=Ke({equalStrict_:function(n,r){var e=Oe(n,"a","equalStrict"),t=Oe(r,"b","equalStrict");return X(e.shape,t.shape,"Error in equalStrict: "),e.equal(t)}}),Zf=Ke({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=Ke({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=Ke({greaterEqualStrict_:function(n,r){var e=Oe(n,"a","greaterEqualStrict"),t=Oe(r,"b","greaterEqualStrict");return X(e.shape,t.shape,"Error in greaterEqualStrict: "),e.greaterEqual(t)}}),th=Ke({greaterStrict_:function(n,r){var e=Oe(n,"a","greaterStrict"),t=Oe(r,"b","greaterStrict");return X(e.shape,t.shape,"Error in greaterStrict: "),e.greater(t)}}),rh=Ke({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=Ke({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=Ke({lessEqualStrict_:function(n,r){var e=Oe(n,"a","lessEqualStrict"),t=Oe(r,"b","lessEqualStrict");return X(e.shape,t.shape,"Error in lessEqualStrict: "),e.lessEqual(t)}}),ah=Ke({lessStrict_:function(n,r){var e=Oe(n,"a","lessStrict"),t=Oe(r,"b","lessStrict");return X(e.shape,t.shape,"Error in lessStrict: "),e.less(t)}}),ih=Ke({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=Ke({notEqualStrict_:function(n,r){var e=Oe(n,"a","notEqualStrict"),t=Oe(r,"b","notEqualStrict");return X(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=Ke({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],E=[],I=1,P=1,G=0;G<u;G++)E.push(i.shape[G]),I*=i.shape[G];for(G=0;G<s.rank;G++)E.push(s.shape[G]);for(G=u+1;G<i.rank;G++)E.push(i.shape[G]),P*=i.shape[G];return{batchSize:I,sliceSize:P,dimSize:f,outputShape:E}}(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,E=u.size,I=f.slice(0,e),P=I.length,G=f.slice(e,f.length).slice(1),oe=G.length,ue=ol(0,P),ie=ol(P+1,P+1+oe),ce=al([I,[E],G]),ye=i.reshape(ce),we=u.reshape([E]),Ee=al([[P],ue,ie]),Se=ye.transpose(Ee),Me=il(Se,we,t.shape[e]),He=bo(Ee);return Me=Me.transpose(He)},indices:function(){return u}}},"Gather",{axis:e}).reshape(a.outputShape)}}),il=Ke({unsortedSegmentSum_:function(n,r,e){var t=Oe(n,"x","unsortedSegmentSum"),o=Oe(r,"segmentIds","unsortedSegmentSum","int32");return w(se(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 E=pu(f,Jt(f)),I=mu(u,E),P=nl(f,It(0,"int32")),G=I.rank-P.rank,oe=0;oe<G;++oe)P=On(P,oe+1);P=ds(P,Mn(I.shape,"bool"));var ue=Jt(I);return Jo(P,I,ue)}(a,s)}}})}}),uh=function(n,r,e){return x(this,void 0,void 0,function(){var t,o,a,i,s,u,f,E,I,P,G,oe,ue;return v(this,function(ie){switch(ie.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,w(i>0,function(){return"mask cannot be scalar"}),X(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 E=s.slice(0,a).concat([u],s.slice(a+i)),I=t.reshape(E),P=o.reshape([-1]),[4,Zc(P)];case 1:return G=ie.sent(),oe=G.squeeze([1]),ue=mu(I,oe,a),n!==t&&t.dispose(),r!==o&&o.dispose(),oe.dispose(),I.dispose(),P.dispose(),G.dispose(),[2,ue]}})})};function sl(n,r,e,t,o,a,i){a===void 0&&(a="NHWC"),w(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]]),w(s.length===4,function(){return"Error in conv2dDerInput: inShape must be length 4, but got length "+s.length+"."}),w(u.rank===4,function(){return"Error in conv2dDerInput: dy must be rank 4, but got rank "+u.rank}),w(e.rank===4,function(){return"Error in conv2dDerInput: filter must be rank 4, but got rank "+e.rank});var E=a==="NHWC"?s[3]:s[1],I=a==="NHWC"?u.shape[3]:u.shape[1];w(E===e.shape[2],function(){return"Error in conv2dDerInput: depth of input ("+E+") must match input depth for filter "+e.shape[2]+"."}),w(I===e.shape[3],function(){return"Error in conv2dDerInput: depth of output ("+I+") must match output depth for filter "+e.shape[3]+"."}),i!=null&&w(se(o),function(){return"Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+o+"."});var P=ui(a),G=Fn(s,e.shape,t,1,o,i,!1,P),oe=Ve.runKernelFunc(function(ue,ie){var ce=ue.conv2dDerInput(u,e,G);return ie([e,u]),ce},{dy4D:u,filter:e},function(ue,ie){var ce=ie[0],ye=ie[1];return{dy4D:function(){return Da(ue,ce,t,o,a,1,i)},filter:function(){return gu(ue,ye,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){w(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];w(a.length===5,function(){return"Error in conv3dDerInput: inShape must be length 5, but got length "+a.length+"."}),w(i.rank===5,function(){return"Error in conv3dDerInput: dy must be rank 5, but got rank "+i.rank}),w(e.rank===5,function(){return"Error in conv3dDerInput: filter must be rank 5, but got rank "+e.rank}),w(u===e.shape[3],function(){return"Error in conv3dDerInput: depth of input ("+u+") must match input depth for filter "+e.shape[3]+"."}),w(f===e.shape[4],function(){return"Error in conv3dDerInput: depth of output ("+f+") must match output depth for filter "+e.shape[4]+"."});var E=To(a,e.shape,t,1,o),I=Ve.runKernelFunc(function(P){return P.conv3dDerInput(i,e,E)},{dy5D:i});return s?I.as4D(I.shape[1],I.shape[2],I.shape[3],I.shape[4]):I}var ch=Ke({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,E=!1;s.rank===2&&(E=!0,f=s.as3D(1,s.shape[0],s.shape[1])),w(f.rank===3,function(){return"Error in conv1d: input must be rank 3, but got rank "+f.rank+"."}),w(u.rank===3,function(){return"Error in conv1d: filter must be rank 3, but got rank "+u.rank+"."}),i!=null&&w(se(t),function(){return"Error in conv1d: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+t+"."}),w(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]+"."}),w(Zr(e,a),function(){return"Error in conv1D: Either stride or dilation must be 1. Got stride "+e+" and dilation '"+a+"'"}),w(o==="NWC",function(){return"Error in conv1d: got dataFormat of "+o+" but only NWC is currently supported."});var I=u.as4D(1,u.shape[0],u.shape[1],u.shape[2]),P=f.as4D(f.shape[0],1,f.shape[1],f.shape[2]),G=Da(P,I,[1,e],t,"NHWC",[1,a],i);return E?G.as2D(G.shape[2],G.shape[3]):G.as3D(G.shape[0],G.shape[2],G.shape[3])}}),Da=Ke({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,E=!1;s.rank===3&&(E=!0,f=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),w(f.rank===4,function(){return"Error in conv2d: input must be rank 4, but got rank "+f.rank+"."}),w(u.rank===4,function(){return"Error in conv2d: filter must be rank 4, but got rank "+u.rank+"."}),i!=null&&w(se(t),function(){return"Error in conv2d: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+t+"."});var I=o==="NHWC"?f.shape[3]:f.shape[1];w(I===u.shape[2],function(){return"Error in conv2d: depth of input ("+I+") must match input depth for filter "+u.shape[2]+"."}),w(Zr(e,a),function(){return"Error in conv2D: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+a+"'"});var P=ui(o),G=Fn(f.shape,u.shape,e,a,t,i,!1,P),oe=[u,f],ue=Ve.runKernelFunc(function(ie,ce){var ye=ie.conv2d(f,u,G);return ce([u,f]),ye},{x:f,filter:u},function(ie,ce){var ye=ce,we=ye[0],Ee=ye[1];return w(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,ie,we,e,t,o)},filter:function(){return gu(Ee,ie,we.shape,e,t,o)}}},"Conv2D",G,oe);return E?ue.as3D(ue.shape[1],ue.shape[2],ue.shape[3]):ue}}),lh=Ke({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])),w(u.rank===5,function(){return"Error in conv3d: input must be rank 5, but got rank "+u.rank+"."}),w(s.rank===5,function(){return"Error in conv3d: filter must be rank 5, but got rank "+s.rank+"."}),w(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]+"."}),w(function(P,G){return vu(P)||vu(G)}(e,a),function(){return"Error in conv3D: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+a+"'"}),w(o==="NDHWC",function(){return"Error in conv3d: got dataFormat of "+o+" but only NDHWC is currently supported."});var E=To(u.shape,s.shape,e,a,t),I=Ve.runKernelFunc(function(P,G){var oe=P.conv3d(u,s,E);return G([u,s]),oe},{x:u,$filter:s},function(P,G){w(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=G[0],ue=G[1];return{x:function(){return ul(oe.shape,P,ue,e,t)},$filter:function(){return function(ie,ce,ye,we,Ee){var Se=ie;ie.rank===4&&(Se=ie.as5D(1,ie.shape[0],ie.shape[1],ie.shape[2],ie.shape[3]));var Me=ce;Me.rank===4&&(Me=ce.as5D(1,ce.shape[0],ce.shape[1],ce.shape[2],ce.shape[3])),w(Se.rank===5,function(){return"Error in conv3dDerFilter: input must be rank 5, but got shape "+Se.shape+"."}),w(Me.rank===5,function(){return"Error in conv3dDerFilter: dy must be rank 5, but got shape "+Me.shape+"."}),w(ye.length===5,function(){return"Error in conv3dDerFilter: filterShape must be length 5, but got "+ye+"."}),w(Se.shape[4]===ye[3],function(){return"Error in conv3dDerFilter: depth of input "+Se.shape[4]+") must match input depth in filter ("+ye[3]+"."}),w(Me.shape[4]===ye[4],function(){return"Error in conv3dDerFilter: depth of dy ("+Me.shape[4]+") must match output depth for filter ("+ye[4]+")."});var He=To(Se.shape,ye,we,1,Ee);return Ve.runKernelFunc(function(Fe){return Fe.conv3dDerFilter(Se,Me,He)},{x5D:Se,dy5D:Me})}(oe,P,ue.shape,e,t)}}});return f?I.as4D(I.shape[1],I.shape[2],I.shape[3],I.shape[4]):I}}),gu=Ke({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])),w(s.rank===4,function(){return"Error in conv2dDerFilter: input must be rank 4, but got shape "+s.shape+"."}),w(u.rank===4,function(){return"Error in conv2dDerFilter: dy must be rank 4, but got shape "+u.shape+"."}),w(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],E=a==="NHWC"?u.shape[3]:u.shape[1];w(f===e[2],function(){return"Error in conv2dDerFilter: depth of input "+f+") must match input depth in filter ("+e[2]+"."}),w(E===e[3],function(){return"Error in conv2dDerFilter: depth of dy ("+E+") must match output depth for filter ("+e[3]+")."}),i!=null&&w(se(o),function(){return"Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+o+"."});var I=ui(a),P=Fn(s.shape,e,t,1,o,i,!1,I);return Ve.runKernelFunc(function(G){return G.conv2dDerFilter(s,u,P)},{x4D:s,dy4D:u})}}),cl=Ke({conv2dDerInput_:sl}),ps=Ke({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,E=!1;s.rank===3&&(E=!0,f=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),w(f.rank===4,function(){return"Error in depthwiseConv2d: input must be rank 4, but got rank "+f.rank+"."}),w(u.rank===4,function(){return"Error in depthwiseConv2d: filter must be rank 4, but got rank "+u.rank+"."}),w(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]),w(Zr(e,a),function(){return"Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+a+"'"}),i!=null&&w(se(t),function(){return"Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+t+"."});var I=Fn(f.shape,u.shape,e,a,t,i,!0),P=[f,u],G=Ve.runKernelFunc(function(oe,ue){var ie=oe.depthwiseConv2D(f,u,I);return ue([f,u]),ie},{x:f,filter:u},function(oe,ue){w(So(a),function(){return"Error in gradient of depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+a+"'"});var ie=ue[0],ce=ue[1];return{x:function(){return ll(ie.shape,oe,ce,I)},filter:function(){return dl(ie,oe,ce.shape,I)}}},"DepthwiseConv2dNative",I,P);return E?G.as3D(G.shape[1],G.shape[2],G.shape[3]):G}}),ll=Ke({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=Ke({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=Ke({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"),E=s,I=!1;if(s.rank===3&&(I=!0,E=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");w(E.rank===4,function(){return"Error in separableConv2d: input must be rank 4, but got rank "+E.rank+"."}),w(u.rank===4,function(){return"Error in separableConv2d: depthwise filter must be rank 4, but got rank "+u.rank+"."}),w(f.rank===4,function(){return"Error in separableConv2d: pointwise filter must be rank 4, but got rank "+u.rank+"."}),w(f.shape[0]===1,function(){return"Error in separableConv2d: the first dimension of pointwise filter must be 1, but got "+f.shape[0]+"."}),w(f.shape[1]===1,function(){return"Error in separableConv2d: the second dimension of pointwise filter must be 1, but got "+f.shape[1]+"."});var P=u.shape[2],G=u.shape[3];w(f.shape[2]===P*G,function(){return"Error in separableConv2d: the third dimension of pointwise filter must be "+P*G+", but got "+f.shape[2]+"."});var oe=ps(E,u,t,o,i,a),ue=Da(oe,f,1,"valid",i);return I?ue.as3D(ue.shape[1],ue.shape[2],ue.shape[3]):ue}}),dh=Ke({conv2dTranspose_:function(n,r,e,t,o,a){return sl(e,Oe(n,"x","conv2dTranspose"),Oe(r,"filter","conv2dTranspose"),t,o,"NHWC",a)}}),fh=Ke({conv3dTranspose_:function(n,r,e,t,o){return ul(e,Oe(n,"x","conv3dTranspose"),Oe(r,"filter","conv3dTranspose"),t,o)}}),yu=Ke({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],E=t?i.shape[i.rank-2]:i.shape[i.rank-1],I=a.shape.slice(0,-2),P=i.shape.slice(0,-2),G=le(I),oe=le(P);w(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+"."}),w(_e(I,P),function(){return"Error in matMul: outer dimensions ("+I+") and ("+P+") of Tensors with shapes "+a.shape+" and "+i.shape+" must match."}),w(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,E]),ie=e?a.as3D(G,s,f):a.as3D(G,f,s),ce=t?i.as3D(oe,E,u):i.as3D(oe,u,E),ye={transposeA:e,transposeB:t};return Ve.runKernelFunc(function(we,Ee){var Se=we.batchMatMul(ie,ce,e,t);return Ee([ie,ce]),Se},{a:ie,b:ce},function(we,Ee){var Se=Ee,Me=Se[0],He=Se[1];return e||t?!e&&t?{a:function(){return we.matMul(He,!1,!1)},b:function(){return we.matMul(Me,!0,!1)}}:e&&!t?{a:function(){return He.matMul(we,!1,!0)},b:function(){return Me.matMul(we,!1,!1)}}:{a:function(){return He.matMul(we,!0,!0)},b:function(){return we.matMul(Me,!0,!0)}}:{a:function(){return we.matMul(He,!1,!0)},b:function(){return Me.matMul(we,!0,!1)}}},"BatchMatMul",ye).reshape(ue)}}),hh=Ke({dot_:function(n,r){var e=Oe(n,"t1","dot"),t=Oe(r,"t2","dot");w(!(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 w(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=Ke({outerProduct_:function(n,r){var e=Oe(n,"v1","outerProduct"),t=Oe(r,"v2","outerProduct");return w(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=Ke({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=Ke({reverse1d_:function(n){var r=Oe(n,"x","reverse");return w(r.rank===1,function(){return"Error in reverse1D: x must be rank 1 but got rank "+r.rank+"."}),_i(r,0)}}),vh=Ke({reverse2d_:function(n,r){var e=Oe(n,"x","reverse");return w(e.rank===2,function(){return"Error in reverse2D: x must be rank 2 but got rank "+e.rank+"."}),_i(e,r)}}),gh=Ke({reverse3d_:function(n,r){var e=Oe(n,"x","reverse");return w(e.rank===3,function(){return"Error in reverse3D: x must be rank 3 but got rank "+e.rank+"."}),_i(e,r)}}),yh=Ke({reverse4d_:function(n,r){var e=Oe(n,"x","reverse");return w(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]),w(s.rank===4,function(){return"Error in maxPool: input must be rank 4 but got rank "+s.rank+"."}),w(Zr(e,t),function(){return"Error in maxPool: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+t+"'"}),a!=null&&w(se(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 E=[s],I=Ve.runKernelFunc(function(P,G){var oe=P.maxPool(s,f);return G([s,oe]),oe},{x:s},function(P,G){var oe=G[0],ue=G[1];return{x:function(){return function(ie,ce,ye,we,Ee,Se,Me,He){var Fe=Oe(ie,"dy","maxPoolBackprop"),je=Oe(ce,"input","maxPoolBackprop"),Ue=Oe(ye,"output","maxPoolBackprop");w(je.rank===Fe.rank,function(){return"Rank of input ("+je.rank+") does not match rank of dy ("+Fe.rank+")"}),Se==null&&(Se=[1,1]),w(Zr(Ee,Se),function(){return"Error in maxPoolBackProp: Either strides or dilations must be 1. Got strides "+Ee+" and dilations '"+Se+"'"}),w(Fe.rank===4,function(){return"Error in maxPoolBackprop: dy must be rank 4 but got rank "+Fe.rank+"."}),w(je.rank===4,function(){return"Error in maxPoolBackprop: input must be rank 4 but got rank "+je.rank+"."}),He!=null&&w(se(Me),function(){return"Error in maxPoolBackprop: pad must be an integer when using, dimRoundingMode "+He+" but got pad "+Me+"."});var Ze=to(je.shape,we,Ee,Se,Me,He);return Ve.runKernelFunc(function(Je){return Je.maxPoolBackprop(Fe,je,Ue,Ze)},{$dy:Fe,$input:je})}(P,oe,ue,r,e,t,o)}}},"MaxPool",f,E);return u?I.as3D(I.shape[1],I.shape[2],I.shape[3]):I}function pl(n,r,e,t,o,a){var i=Oe(n,"x","avgPool","float32");t==null&&(t=[1,1]),w(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])),w(s.rank===4,function(){return"Error in avgPool: x must be rank 4 but got rank "+s.rank+"."}),a!=null&&w(se(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 E=Ve.runKernelFunc(function(I){return I.avgPool(s,f)},{x:s},function(I){return{x:function(){return function(P,G,oe,ue,ie,ce){var ye=Oe(P,"dy","avgPoolBackprop"),we=Oe(G,"input","avgPoolBackprop");w(we.rank===ye.rank,function(){return"Rank of input ("+we.rank+") does not match rank of dy ("+ye.rank+")"}),ie==null&&(ie=[1,1]),w(Zr(ue,ie),function(){return"Error in avgPoolBackprop: Either strides or dilations must be 1. Got strides "+ue+" and dilations '"+ie+"'"});var Ee=we,Se=ye,Me=!1;we.rank===3&&(Me=!0,Ee=we.as4D(1,we.shape[0],we.shape[1],we.shape[2]),Se=ye.as4D(1,ye.shape[0],ye.shape[1],ye.shape[2])),w(Se.rank===4,function(){return"Error in avgPoolBackprop: dy must be rank 4 but got rank "+Se.rank+"."}),w(Ee.rank===4,function(){return"Error in avgPoolBackprop: input must be rank 4 but got rank "+Ee.rank+"."});var He=to(Ee.shape,oe,ue,ie,ce),Fe=Ve.runKernelFunc(function(je){return je.avgPoolBackprop(Se,Ee,He)},{dy4D:Se,input4D:Ee});return Me?Fe.as3D(Fe.shape[1],Fe.shape[2],Fe.shape[3]):Fe}(I,s,r,e,t,o)}}},"AvgPool",f);return E=E.cast(i.dtype),u?E.as3D(E.shape[1],E.shape[2],E.shape[3]):E}var ml=Ke({maxPool_:function(n,r,e,t,o){return hl(n,r,e,1,t,o)}}),vl=Ke({avgPool_:function(n,r,e,t,o){return pl(n,r,e,1,t,o)}}),bh=Ke({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])),w(Zr(a,o),function(){return"Error in pool: Either strides or dilations must be 1. Got strides "+a+" and dilations '"+o+"'"});var f,E=to(s.shape,r,a,o,t),I=[E.dilationHeight,E.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}),He=Me.map(function(je){return Math.floor(je/2)}),Fe=Me.map(function(je,Ue){return je-He[Ue]});return Me.map(function(je,Ue){return[He[Ue],Fe[Ue]]})}([E.filterHeight,E.filterWidth],I):[[0,0],[0,0]];var P=I[0]===1&&I[1]===1,G=function(Ee,Se,Me){var He=Me.map(function(ct){return ct[0]}),Fe=Me.map(function(ct){return ct[1]}),je=Ee.concat(He,Fe),Ue=Se.map(function(ct,st){return(ct-je[st]%ct)%ct}),Ze=Fe.map(function(ct,st){return ct+Ue[st]}),Je=Se.map(function(ct,st){return[He[st],Ze[st]]}),dt=Se.map(function(ct,st){return[0,Ue[st]]});return[Je,dt]}([E.inHeight,E.inWidth],I,f),oe=G[0],ue=G[1],ie=P?t:"valid",ce=P?s:Gi(s,I,oe),ye=(e==="avg"?function(){return pl(ce,r,a,1,ie)}:function(){return hl(ce,r,a,1,ie)})(),we=P?ye:va(ye,I,ue);return u?we.as3D(we.shape[1],we.shape[2],we.shape[3]):we}}),xh=Ke({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]),w(u.rank===5,function(){return"Error in maxPool3d: x must be rank 5 but got rank "+u.rank+"."}),w(a==="NDHWC",function(){return"Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of "+a}),w(Zr(e,i),function(){return"Error in maxPool3d: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+i+"'"}),o!=null&&w(se(t),function(){return"Error in maxPool3d: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+t+"."});var E=Go(u.shape,r,e,i,t,o,a),I=Ve.runKernelFunc(function(P,G){var oe=P.maxPool3d(u,E);return G([u,oe]),oe},{x:u},function(P,G){var oe=G[0],ue=G[1];return{x:function(){return function(ie,ce,ye,we,Ee,Se,Me,He){var Fe=Oe(ie,"dy","maxPool3dBackprop"),je=Oe(ce,"input","maxPool3dBackprop"),Ue=Oe(ye,"output","maxPool3dBackprop"),Ze=Fe,Je=je,dt=Ue,ct=!1;je.rank===4&&(ct=!0,Ze=Fe.as5D(1,Fe.shape[0],Fe.shape[1],Fe.shape[2],Fe.shape[3]),Je=je.as5D(1,je.shape[0],je.shape[1],je.shape[2],je.shape[3]),dt=Ue.as5D(1,Ue.shape[0],Ue.shape[1],Ue.shape[2],Ue.shape[3])),w(Ze.rank===5,function(){return"Error in maxPool3dBackprop: dy must be rank 5 but got rank "+Ze.rank+"."}),w(Je.rank===5,function(){return"Error in maxPool3dBackprop: input must be rank 5 but got rank "+Je.rank+"."}),w(dt.rank===5,function(){return"Error in maxPool3dBackprop: output must be rank 5 but got rank "+dt.rank+"."}),Se==null&&(Se=[1,1,1]),w(Zr(Ee,Se),function(){return"Error in maxPool3dBackprop: Either strides or dilations must be 1. Got strides "+Ee+" and dilations '"+Se+"'"}),He!=null&&w(se(Me),function(){return"Error in maxPool3dBackprop: pad must be an integer when using, dimRoundingMode "+He+" but got pad "+Me+"."});var st=Go(Je.shape,we,Ee,Se,Me,He),pt=Ve.runKernelFunc(function(ht){return ht.maxPool3dBackprop(Ze,Je,dt,st)},{dy5D:Ze,input5D:Je});return ct?pt.as4D(pt.shape[1],pt.shape[2],pt.shape[3],pt.shape[4]):pt}(P,oe,ue,r,e,i,t,o)}}});return f?I.as4D(I.shape[1],I.shape[2],I.shape[3],I.shape[4]):I}}),wh=Ke({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]),w(u.rank===5,function(){return"Error in avgPool3d: x must be rank 5 but got rank "+u.rank+"."}),w(a==="NDHWC",function(){return"Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of "+a}),w(Zr(e,i),function(){return"Error in avgPool3d: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+i+"'"}),o!=null&&w(se(t),function(){return"Error in avgPool3d: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+t+"."});var E=Go(u.shape,r,e,i,t,o,a),I=Ve.runKernelFunc(function(P){return P.avgPool3d(u,E)},{x:u},function(P){return{x:function(){return function(G,oe,ue,ie,ce,ye,we){var Ee=Oe(G,"dy","avgPool3dBackprop"),Se=Oe(oe,"input","avgPool3dBackprop"),Me=Ee,He=Se,Fe=!1;Se.rank===4&&(Fe=!0,Me=Ee.as5D(1,Ee.shape[0],Ee.shape[1],Ee.shape[2],Ee.shape[3]),He=Se.as5D(1,Se.shape[0],Se.shape[1],Se.shape[2],Se.shape[3])),w(Me.rank===5,function(){return"Error in avgPool3dBackprop: dy must be rank 5 but got rank "+Me.rank+"."}),w(He.rank===5,function(){return"Error in avgPool3dBackprop: input must be rank 5 but got rank "+He.rank+"."}),ce==null&&(ce=[1,1,1]),w(Zr(ie,ce),function(){return"Error in avgPool3dBackprop: Either strides or dilations must be 1. Got strides "+ie+" and dilations '"+ce+"'"}),we!=null&&w(se(ye),function(){return"Error in maxPool3dBackprop: pad must be an integer when using, dimRoundingMode "+we+" but got pad "+ye+"."});var je=Go(He.shape,ue,ie,ce,ye,we),Ue=Ve.runKernelFunc(function(Ze){return Ze.avgPool3dBackprop(Me,He,je)},{dy5D:Me,input5D:He});return Fe?Ue.as4D(Ue.shape[1],Ue.shape[2],Ue.shape[3],Ue.shape[4]):Ue}(P,u,r,e,i,t,o)}}});return I=I.cast(u.dtype),f?I.as4D(I.shape[1],I.shape[2],I.shape[3],I.shape[4]):I}}),no=Ke({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){w(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:(w(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=[],E=0;E<u.rank;E++)f.push([t[E],i[E]-t[E]-o[E]]);return{x:function(){return u.pad(f)}}},"Slice",s)}}),Eh=Ke({slice1d_:function(n,r,e){var t=Oe(n,"x","slice1d");return w(t.rank===1,function(){return"slice1d expects a rank-1 tensor, but got a rank-"+t.rank+" tensor"}),no(t,[r],[e])}}),_h=Ke({slice2d_:function(n,r,e){var t=Oe(n,"x","slice2d");return w(t.rank===2,function(){return"slice2d expects a rank-2 tensor, but got a rank-"+t.rank+" tensor"}),no(t,r,e)}}),gl=Ke({slice3d_:function(n,r,e){var t=Oe(n,"x","slice3d");return w(t.rank===3,function(){return"slice3d expects a rank-3 tensor, but got a rank-"+t.rank+" tensor"}),no(t,r,e)}}),Ch=Ke({slice4d_:function(n,r,e){var t=Oe(n,"x","slice4d");return w(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=Ke({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=Ke({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=Ke({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=Ke({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=Ke({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=Ke({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(I,P){var G=I.max(t,i);return P([o,G]),G},{x:t},function(I,P){return yl(I,P[1],P[0],a,s)},"Max",{axes:i},u,[!0]);if(e){var E=Vr(f.shape,a);f=f.reshape(E)}return f}}),Ih=Ke({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=It(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(E){f[E]=1}),u.reshape(f).mul(Mn(i.shape,"float32")).div(a)}}})(t)}}),Dh=Ke({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(I,P){var G=I.min(t,i);return P([o,G]),G},{x:t},function(I,P){return yl(I,P[1],P[0],a,s)},"Min",{axes:i},u,[!0]);if(e){var E=Vr(f.shape,a);f=f.reshape(E)}return f}}),Nh=Ke({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=Ke({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(G){var oe=a.shape.slice();return o.forEach(function(ue){oe[ue]=1}),G.reshape(oe).mul(Mn(a.shape,"float32"))},E={axes:s},I=Ve.runKernelFunc(function(G){return G.sum(u,s)},{x:u},function(G){return{x:function(){return f(G)}}},"Sum",E);if(e){var P=Vr(I.shape,o);I=I.reshape(P)}return{value:I,gradFunc:f}})(t)}}),kh=Ke({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(E){return E.prod(s,i)},{permutedX:s});if(e){var f=Vr(u.shape,o);u=u.reshape(f)}return u}}),wl=Ke({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=Ke({leakyRelu_:function(n,r){r===void 0&&(r=.2);var e=Oe(n,"x","leakyRelu");return pu(It(r).mul(e),e)}}),El=Ke({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)),E=Ir(s.shape,o.shape);return E.length>0&&(f=f.sum(E)),f.reshape(s.shape)}}},"Prelu")}}),bu=Ke({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=Ke({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=Ke({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(It(0)),i=It(du),s=It(fu),u=e.mul(s),f=e.mul(i).mul(o.toFloat().exp());return Jo(a,u,f)}}})}}),Cl=Ke({transpose_:function(n,r){var e=Oe(n,"x","transpose");if(r==null&&(r=e.shape.map(function(o,a){return a}).reverse()),w(e.rank===r.length,function(){return"Error in transpose: rank of input "+e.rank+" must match length of perm "+r+"."}),r.forEach(function(o){w(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)}}),Lh=Ke({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");w(a.rank===4||a.rank===3,function(){return`Error in localResponseNormalization: x must be rank 3 or 4 but got
|
|
|
rank `+a.rank+"."}),w(se(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,E){var I=f.localResponseNormalization4D(i,r,e,t,o);return E([i,I]),I},{x4D:i},function(f,E){var I=E[0],P=E[1];return{x4D:function(){return Ve.runKernelFunc(function(G){return G.LRNGrad(f,I,P,r,e,t,o)},{})}}});return s?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),Tl=Ke({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,E){if(E===void 0&&(E=null),u.rank===0)return u.abs();if(u.rank!==1&&E===null)return s(u.reshape([-1]),f,E);if(u.rank===1||typeof E=="number"||Array.isArray(E)&&E.length===1){if(f===1)return u.abs().sum(E);if(f===1/0)return u.abs().max(E);if(f===-1/0)return u.abs().min(E);if(f==="euclidean"||f===2)return u.abs().pow(It(2,"int32")).sum(E).sqrt();throw new Error("Error in norm: invalid ord value: "+f)}if(Array.isArray(E)&&E.length===2){if(f===1)return u.abs().sum(E[0]).max(E[1]-1);if(f===1/0)return u.abs().sum(E[1]).max(E[0]);if(f===-1/0)return u.abs().sum(E[1]).min(E[0]);if(f==="fro"||f==="euclidean")return u.square().sum(E).sqrt();throw new Error("Error in norm: invalid ord value: "+f)}throw new Error("Error in norm: invalid axis: "+E)}(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)}}),jh=Ke({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"),E=Oe(o,"c","basicLSTMCell"),I=Oe(a,"h","basicLSTMCell"),P=f.concat(I,1).matMul(s).add(u),G=P.shape[0],oe=P.shape[1]/4,ue=[G,oe],ie=P.slice([0,0],ue),ce=P.slice([0,oe],ue),ye=P.slice([0,2*oe],ue),we=P.slice([0,3*oe],ue),Ee=ie.sigmoid().mulStrict(ce.tanh()).addStrict(E.mulStrict(i.add(ye).sigmoid())),Se=Ee.tanh().mulStrict(we.sigmoid());return[Ee,Se]}}),Fh=Ke({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 E=n[f](s,a[f],i[f]);u.push(E[0]),u.push(E[1]),s=E[1]}var I=[],P=[];for(f=0;f<u.length;f+=2)I.push(u[f]),P.push(u[f+1]);return[I,P]}}),Bh=Ke({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),w(_e(a.shape,i.shape),function(){return"Shape mismatch in v and x"});var u=It(1),f=u.sub(s),E=i.sub(a).mul(f);if(o){w(t!=null,function(){return"When using zeroDebias: true, step is required."});var I=Oe(t,"step","movingAverage");E=E.div(u.sub(hs(s,I)))}return a.add(E)}}),Uh=Ke({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"),E=Yi(s),I=f.shape.slice();E.forEach(function(ie){r[ie]=0,e[ie]=1,I.splice(ie,0,1)}),f=f.reshape(I);for(var P=0;P<f.rank;P++)r[P]=$s(o,r,t,f.shape,P),e[P]=$i(a,e,t,f.shape,P),t[P]=t[P]||1;var G=Yi(u);G.forEach(function(ie){e[ie]=r[ie]+1,t[ie]=1});var oe=Ea(r,e,t),ue=oe.filter(function(ie,ce){return G.indexOf(ce)===-1});return t.every(function(ie){return ie===1})?no(f,r,oe).reshape(ue):Ve.runKernelFunc(function(ie){return ie.stridedSlice(f,r,e,t)},{$x:f}).reshape(ue)}}),Wh=Ke({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=Ke({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=Ke({fft_:function(n){w(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=Ke({ifft_:function(n){w(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=Ke({rfft_:function(n,r){w(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),E=xu(f),I=Math.floor(t/2)+1,P=un(E),G=xn(E),oe=P.split([I,t-I],P.shape.length-1),ue=G.split([I,t-I],G.shape.length-1),ie=e.shape.slice();return ie[e.shape.length-1]=I,xr(oe[0],ue[0]).reshape(ie)}}),Sl=Ke({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(It(-1)),E=i.concat(u,1),I=s.concat(f,1);return t=xr(E,I).as2D(a[0],a[1]),o=ms(t),un(o)}}),zh=Object.freeze({fft:xu,ifft:ms,rfft:wu,irfft:Sl}),Gh=Ke({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,E){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 I=s.rank>0?s.shape[0]:1,P=s.rank>1?s.shape[1]:1;if(f.length!==P)throw new Error("outputShape has incorrect number of elements:, "+f.length+", should be: "+P+".");var G=u.size;if(u.rank!==0&&(u.rank!==1||G!==I))throw new Error("sparseValues has incorrect shape "+u.shape+", should be [] or ["+I+"]");if(u.dtype!==E.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=Ke({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=Ke({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=Ke({dropout_:function(n,r,e,t){var o=Oe(n,"x","dropout");if(w(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."}),w(r>=0&&r<1,function(){return"rate must be a float in the range [0, 1), but got "+r+"."}),r===0)return n instanceof Nr?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 E=[],I=0;I<u.shape.length;I++)f[I]==null&&u.shape[I]!=null?E.push(u.shape[I]):E.push(f[I]);return E}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=Ke({hannWindow_:function(n){return Al(n,.5,.5)}}),Ol=Ke({hammingWindow_:function(n){return Al(n,.54,.46)}}),_u=Ke({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=Ke({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),x(this,void 0,void 0,function(){var t,o,a,i,s,u,f,E,I,P,G,oe,ue,ie;return v(this,function(ce){switch(ce.label){case 0:return t=Oe(n,"predictions","inTopK"),o=Oe(r,"targets","inTopK"),w(t.rank>1,function(){return"inTopK() expects the predictions to be of rank 2 or higher, but got "+t.rank}),w(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}),X(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],w(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],E=u[1],I=xe("bool",f=u[0]),P=0;P<f;P++){for(G=P*E,oe=i.subarray(G,G+E),ue=[],ie=0;ie<oe.length;ie++)ue.push({value:oe[ie],index:ie});for(ue.sort(function(ye,we){return we.value-ye.value}),I[P]=0,ie=0;ie<e;ie++)if(ue[ie].index===s[P]){I[P]=1;break}}return n!==t&&t.dispose(),r!==o&&o.dispose(),[2,Ur(I,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=Ke({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")),X(o.shape,a.shape,"Error in absoluteDifference: ");var s=o.sub(a).abs();return oo(s,i,t)}}),oo=Ke({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(It(i)):s}if(e===rn.SUM_BY_NONZERO_WEIGHTS){if(o==null)return a.sum().div(It(t.size));var u=o.mul(Mn(t.shape)).notEqual(It(0)).sum().toFloat();return a.sum().div(u)}throw Error("Unknown reduction: "+e)}}),qh=Ke({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")),X(a.shape,i.shape,"Error in cosineDistance: ");var u=It(1).sub(a.mul(i).sum(e,!0));return oo(u,s,o)}}),Qh=Ke({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")),X(o.shape,a.shape,"Error in hingeLoss: ");var s=It(1);o=It(2).mul(o).sub(s);var u=s.sub(o.mul(a)).relu();return oo(u,i,t)}}),Zh=Ke({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")),X(a.shape,i.shape,"Error in huberLoss: ");var u=It(t),f=i.sub(a).abs(),E=tl(f,u),I=f.sub(E),P=It(.5).mul(E.square()).add(u.mul(I));return oo(P,s,o)}}),ep=Ke({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")),X(a.shape,i.shape,"Error in logLoss: ");var u=It(1),f=It(t),E=a.mul(i.add(f).log()).neg().sub(u.sub(a).mul(u.sub(i).add(f).log()));return oo(E,s,o)}}),tp=Ke({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")),X(o.shape,a.shape,"Error in meanSquaredError: ");var s=o.squaredDifference(a);return oo(s,i,t)}}),rp=Ke({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")),X(a.shape,i.shape,"Error in sigmoidCrossEntropy: "),t>0){var u=It(t),f=It(1),E=It(.5);a=a.mul(f.sub(u)).add(E.mul(u))}var I=function(P,G){var oe=Oe(P,"labels","sigmoidCrossEntropyWithLogits"),ue=Oe(G,"logits","sigmoidCrossEntropyWithLogits");X(oe.shape,ue.shape,"Error in sigmoidCrossEntropyWithLogits: ");var ie=ue.relu(),ce=ue.mul(oe),ye=ue.abs().neg().exp().log1p();return ie.sub(ce).add(ye)}(a,i);return oo(I,s,o)}}),np=Ke({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")),X(a.shape,i.shape,"Error in softmaxCrossEntropy: "),t>0){var u=It(t),f=It(1),E=It(a.shape[1]);a=a.mul(f.sub(u)).add(u.div(E))}var I=function(P,G,oe){if(oe===void 0&&(oe=-1),oe===-1&&(oe=G.rank-1),oe!==G.rank-1)throw Error("Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank "+G.rank+" and dim was "+oe);return _o(function(ue,ie,ce){var ye=ie.logSumExp([oe],!0),we=ie.toFloat().sub(ye);return ce([ue,we]),{value:we.mul(ue).neg().sum([oe]),gradFunc:function(Ee,Se){var Me=Se[0],He=Se[1],Fe=Vr(Ee.shape,[oe]);return[Ee.reshape(Fe).mul(Me.toFloat().sub(He.exp())),Ee.reshape(Fe).mul(He.exp().sub(Me.toFloat()))]}}})(P,G)}(a,i);return oo(I,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(I){var P,G=a,oe=s,ue=o;P=Ve.tidy(function(){var ie=a.slice([I,I],[e-I,1]),ce=ie.norm(),ye=a.slice([I,I],[1,1]),we=Zn([[-1]]).where(ye.greater(0),Zn([[1]])),Ee=ye.sub(we.mul(ce)),Se=ie.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(),He=a.slice([I,0],[e-I,t]),Fe=Me.mul(s);if(I===0)a=He.sub(Fe.matMul(s.transpose().matMul(He)));else{var je=He.sub(Fe.matMul(s.transpose().matMul(He)));a=a.slice([0,0],[I,t]).concat(je,0)}var Ue=o.slice([0,I],[e,o.shape[1]-I]);if(I===0)o=Ue.sub(Ue.matMul(s).matMul(Fe.transpose()));else{var Ze=Ue.sub(Ue.matMul(s).matMul(Fe.transpose()));o=o.slice([0,0],[e,I]).concat(Ze,1)}return[s,a,o]}),s=P[0],a=P[1],o=P[2],qr([G,oe,ue])},E=0;E<u;++E)f(E);return!r&&e>t&&(o=o.slice([0,0],[e,t]),a=a.slice([0,0],[t,t])),[o,a]})}var ap=Ke({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"),E=Ao(u,f),I=ds(E.lessEqual(It(+r,"int32")),E.greaterEqual(It(-e,"int32"))),P=Tr([i,s],t.dtype);return jn(xa(t.reshape([-1,i,s])).map(function(G){return Jo(I,G,P)})).reshape(o)}}),ip=Ke({gramSchmidt_:function(n){var r;if(Array.isArray(n)){r=!1,w(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){w(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])});w(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 E=0;E<u;++E){var I=xl(a[E].mulStrict(f)).mul(a[E]);f=f.sub(I)}return f.div(Tl(f,"euclidean"))}))};for(o=0;o<n.length;++o)s(o);return r?jn(a,0):a}}),sp=Ke({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)}),[jn(o,0).reshape(n.shape),jn(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),w(0<=t&&t<=1,function(){return"iouThreshold must be in [0, 1], but was '"+t+"'"}),w(n.rank===2,function(){return"boxes must be a 2D tensor, but was of rank '"+n.rank+"'"}),w(n.shape[1]===4,function(){return"boxes must have 4 columns, but 2nd dimension was "+n.shape[1]}),w(r.rank===1,function(){return"scores must be a 1D tensor"}),w(r.shape[0]===i,function(){return"scores has incompatible shape with boxes. Expected "+i+", but was "+r.shape[0]}),w(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=Ke({resizeBilinear_:function(n,r,e){e===void 0&&(e=!1);var t=Oe(n,"images","resizeBilinear");w(t.rank===3||t.rank===4,function(){return"Error in resizeBilinear: x must be rank 3 or 4, but got rank "+t.rank+"."}),w(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,E){return E([o]),f.resizeBilinear(o,i,s,e)},{x:o},function(f,E){return{x:function(){return Ve.runKernelFunc(function(I){return I.resizeBilinearBackprop(f,E[0],e)},{})}}},"ResizeBilinear",{alignCorners:e,newHeight:i,newWidth:s});return a?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),lp=Ke({resizeNearestNeighbor_:function(n,r,e){e===void 0&&(e=!1);var t=Oe(n,"images","resizeNearestNeighbor");w(t.rank===3||t.rank===4,function(){return"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank "+t.rank+"."}),w(r.length===2,function(){return"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+r+"."}),w(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,E){return E([o]),f.resizeNearestNeighbor(o,i,s,e)},{batchImages:o},function(f,E){return{batchImages:function(){return Ve.runKernelFunc(function(I){return I.resizeNearestNeighborBackprop(f,E[0],e)},{})}}});return a?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),dp=Ke({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),x(this,void 0,void 0,function(){var a,i,s,u,f,E,I;return v(this,function(P){switch(P.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=P.sent(),f=u[0],E=u[1],I=li(f,E,e,t,o),a!==n&&a.dispose(),i!==r&&i.dispose(),[2,I]}})})},hp=Ke({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},E=Ve.runKernel("NonMaxSuppressionV5",{boxes:i,scores:s},f);return{selectedIndices:E[0],selectedScores:E[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),x(this,void 0,void 0,function(){var i,s,u,f,E,I,P;return v(this,function(G){switch(G.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=G.sent(),E=f[0],I=f[1],P=di(E,I,e,t,o,a),i!==n&&i.dispose(),s!==r&&s.dispose(),[2,P]}})})},mp=Ke({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 w(i.rank===4,function(){return"Error in cropAndResize: image must be rank 4,but got rank "+i.rank+"."}),w(s.rank===2&&s.shape[1]===4,function(){return"Error in cropAndResize: boxes must be have size ["+f+",4] but had shape "+s.shape+"."}),w(u.rank===1&&u.shape[0]===f,function(){return"Error in cropAndResize: boxInd must be have size ["+f+"] but had shape "+s.shape+"."}),w(t.length===2,function(){return"Error in cropAndResize: cropSize must be of length 2, but got length "+t.length+"."}),w(t[0]>=1&&t[1]>=1,function(){return"cropSize must be atleast [1,1], but was "+t}),w(o==="bilinear"||o==="nearest",function(){return"method must be bilinear or nearest, but was "+o}),Ve.runKernelFunc(function(E,I){return E.cropAndResize(i,s,u,t,o,a)},{images:i,boxes:s,boxInd:u},null,"CropAndResize",{method:o,extrapolationValue:a,cropSize:t})}}),Dl=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=Ke({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,E=f===void 0?"linear":f,I=n.preluActivationWeights;if(Cu(Ve.state.gradientDepth,E)===!1){var P=yu(e,t,a,s);return u!=null&&(P=qo(P,u)),Au(P,E,I)}var G=Oe(e,"a","fused matMul"),oe=Oe(t,"b","fused matMul");r=cr(G,oe),G=r[0],oe=r[1];var ue=a?G.shape[G.rank-2]:G.shape[G.rank-1],ie=s?oe.shape[oe.rank-1]:oe.shape[oe.rank-2],ce=a?G.shape[G.rank-1]:G.shape[G.rank-2],ye=s?oe.shape[oe.rank-2]:oe.shape[oe.rank-1],we=G.shape.slice(0,-2),Ee=oe.shape.slice(0,-2),Se=le(we),Me=le(Ee);w(G.rank>=2&&oe.rank>=2&&G.rank===oe.rank,function(){return"Error in fused matMul: inputs must have the same rank of at least 2, got ranks "+G.rank+" and "+oe.rank+"."}),w(_e(we,Ee),function(){return"Error in fused matMul: outer dimensions ("+we+") and ("+Ee+") of Tensors with shapes "+G.shape+" and "+oe.shape+" must match."}),w(ue===ie,function(){return"Error in fused matMul: inner shapes ("+ue+") and ("+ie+") of Tensors with shapes "+G.shape+" and "+oe.shape+" and transposeA="+a+" and transposeB="+s+" must match."});var He,Fe,je=G.shape.slice(0,-2).concat([ce,ye]),Ue=a?G.as3D(Se,ue,ce):G.as3D(Se,ce,ue),Ze=s?oe.as3D(Me,ye,ie):oe.as3D(Me,ie,ye);u!=null&&Ht(je,(He=cr(He=Oe(u,"bias","fused matMul"),G)[0]).shape),I!=null&&(Fe=Oe(I,"prelu weights","fused matMul"));var Je={a:Ue,b:Ze};u!=null&&(Je.bias=He),I!=null&&(Je.preluActivationWeights=Fe);var dt=[Ue,Ze];return Ve.runKernelFunc(function(ct,st){var pt=ct.fusedBatchMatMul({a:Ue,b:Ze,transposeA:a,transposeB:s,bias:He,activation:E,preluActivationWeights:Fe});return st([Ue,Ze,pt]),pt},Je,function(ct,st){var pt=st[0],ht=st[1],ut=st[2],gt=Tu(ct,ut,E),yt={};return u!=null&&(yt={bias:function(){return Su(He,gt)}}),a||s?!a&&s?Object.assign({a:function(){return gt.matMul(ht,!1,!1)},b:function(){return gt.matMul(pt,!0,!1)}},yt):a&&!s?Object.assign({a:function(){return ht.matMul(gt,!1,!0)},b:function(){return pt.matMul(gt,!1,!1)}},yt):Object.assign({a:function(){return ht.matMul(gt,!0,!0)},b:function(){return gt.matMul(pt,!0,!0)}},yt):Object.assign({a:function(){return gt.matMul(ht,!1,!0)},b:function(){return pt.matMul(gt,!0,!1)}},yt)},"_FusedMatMul",{transposeA:a,transposeB:s,activation:E},dt,[!0]).reshape(je)}}),gp=Ke({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,E=n.bias,I=n.activation,P=I===void 0?"linear":I,G=n.preluActivationWeights;if(P=P||"linear",Cu(Ve.state.gradientDepth,P)===!1){var oe=Da(r,e,t,o,i,u,f);return E!=null&&(oe=qo(oe,E)),Au(oe,P,G)}var ue=Oe(r,"x","conv2d"),ie=Oe(e,"filter","conv2d"),ce=ue,ye=!1;ue.rank===3&&(ye=!0,ce=ue.as4D(1,ue.shape[0],ue.shape[1],ue.shape[2])),w(ce.rank===4,function(){return"Error in fused conv2d: input must be rank 4, but got rank "+ce.rank+"."}),w(ie.rank===4,function(){return"Error in fused conv2d: filter must be rank 4, but got rank "+ie.rank+"."}),f!=null&&w(se(o),function(){return"Error in fused conv2d: pad must be an integer when using, dimRoundingMode "+f+" but got pad "+o+"."}),w(ce.shape[3]===ie.shape[2],function(){return"Error in conv2d: depth of input ("+ce.shape[3]+") must match input depth for filter "+ie.shape[2]+"."}),w(Zr(t,u),function(){return"Error in conv2D: Either strides or dilations must be 1. Got strides "+t+" and dilations '"+u+"'"}),w(i==="NHWC",function(){return"Error in conv2d: got dataFormat of "+i+" but only NHWC is currently supported."});var we,Ee,Se=Fn(ce.shape,ie.shape,t,u,o,f);E!=null&&(we=cr(we=Oe(E,"bias","fused conv2d"),ue)[0],Ht(Se.outShape,we.shape)),G!=null&&(Ee=Oe(G,"prelu weights","fused conv2d"));var Me={x:ce,filter:ie};E!=null&&(Me.bias=we),G!=null&&(Me.preluActivationWeights=Ee);var He=[ie,ce],Fe=Ve.runKernelFunc(function(je,Ue){var Ze=je.fusedConv2d({input:ce,filter:ie,convInfo:Se,bias:we,activation:P,preluActivationWeights:Ee});return Ue([ie,ce,Ze]),Ze},Me,function(je,Ue){var Ze=Ue,Je=Ze[0],dt=Ze[1],ct=Ze[2],st=Tu(je,ct,P);w(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 pt={};return E!=null&&(pt={bias:function(){return Su(we,st)}}),Object.assign({x:function(){return cl(dt.shape,st,Je,t,o)},filter:function(){return gu(dt,st,Je.shape,t,o)}},pt)},"FusedConv2D",{convInfo:Se,activation:P},He,[!0]);return ye?Fe.as3D(Fe.shape[1],Fe.shape[2],Fe.shape[3]):Fe}}),yp=Ke({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,E=n.bias,I=n.activation,P=I===void 0?"linear":I,G=n.preluActivationWeights;if(Cu(Ve.state.gradientDepth,P)===!1){var oe=ps(r,e,t,o,i,u,f);return E!=null&&(oe=qo(oe,E)),Au(oe,P,G)}var ue=Oe(r,"x","depthwiseConv2d"),ie=Oe(e,"filter","depthwiseConv2d"),ce=ue,ye=!1;ue.rank===3&&(ye=!0,ce=ue.as4D(1,ue.shape[0],ue.shape[1],ue.shape[2])),w(ce.rank===4,function(){return"Error in fused depthwiseConv2d: input must be rank 4, but got rank "+ce.rank+"."}),w(ie.rank===4,function(){return"Error in fused depthwiseConv2d: filter must be rank 4, but got rank "+ie.rank+"."}),w(ce.shape[3]===ie.shape[2],function(){return"Error in fused depthwiseConv2d: number of input channels ("+ce.shape[3]+") must match the inChannels dimension in filter "+ie.shape[2]+"."}),u==null&&(u=[1,1]),w(Zr(t,u),function(){return"Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides "+t+" and dilations '"+u+"'"}),f!=null&&w(se(o),function(){return"Error in fused depthwiseConv2d: pad must be an integer when using dimRoundingMode "+f+" but got pad "+o+"."});var we,Ee,Se=Fn(ce.shape,ie.shape,t,u,o,f,!0);E!=null&&(we=cr(we=Oe(E,"bias","fused conv2d"),ue)[0],Ht(Se.outShape,we.shape)),G!=null&&(Ee=Oe(G,"prelu weights","fused depthwiseConv2d"));var Me={x:ce,filter:ie};E!=null&&(Me.bias=we),G!=null&&(Me.preluActivationWeights=Ee);var He=[ie,ce],Fe=Ve.runKernelFunc(function(je,Ue){var Ze=je.fusedDepthwiseConv2D({input:ce,filter:ie,convInfo:Se,bias:we,activation:P,preluActivationWeights:Ee});return Ue([ie,ce,Ze]),Ze},Me,function(je,Ue){w(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],dt=Ue[2],ct=Tu(je,dt,P),st={};return E!=null&&(st={bias:function(){return Su(we,ct)}}),Object.assign({x:function(){return ll(Je.shape,ct,Ze,Se)},filter:function(){return dl(Je,ct,Ze.shape,Se)}},st)},"FusedDepthwiseConv2D",{convInfo:Se,activation:P},He,[!0]);return ye?Fe.as3D(Fe.shape[1],Fe.shape[2],Fe.shape[3]):Fe}}),bp=Object.freeze({matMul:vp,conv2d:gp,depthwiseConv2d:yp}),xp=Object.freeze({image:Dl,linalg:up,losses:op,spectral:zh,fused:bp,signal:Yh,square:Zd,squaredDifference:zc,conv1d:ch,conv2d:Da,conv3d:lh,depthwiseConv2d:ps,separableConv2d:fl,conv2dTranspose:dh,conv3dTranspose:fh,op:Ke,batchNormalization2d:If,batchNormalization3d:Df,batchNormalization4d:Nf,batchNormalization:kf,batchNorm:qc,batchNorm2d:Mf,batchNorm3d:Pf,batchNorm4d:Lf,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:Dh,moments:Nh,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:jf,logicalOr:Qc,logicalXor:Ff,where:Jo,whereAsync:Zc,buffer:jt,print:ma,batchToSpaceND:va,broadcastTo:Ps,cast:ga,clone:ya,cumsum:Ls,depthToSpace:js,expandDims:On,eye:Hi,multinomial:ti,oneHot:ri,pad:Ln,pad1d:zi,pad2d:Eo,pad3d:ni,pad4d:Fs,rand:Bs,randomNormal:Us,randomGamma:Ws,randomUniform:oi,reshape:ba,spaceToBatchND:Gi,squeeze:Vi,stack:jn,tile:eo,truncatedNormal:Hs,unstack:xa,setdiff1dAsync:zs,fill:ei,linspace:sc,ones:Mn,range:fa,scalar:It,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:Lh,norm:Tl,gather:mu,unsortedSegmentSum:il,basicLSTMCell:jh,multiRNNCell:Fh,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 ft(n,r){Array.isArray(n)||(n=[n]),n.forEach(function(e){e!=null&&w(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 A(r,n),r.prototype.write=function(e,t,o){this.firstUse&&(this.firstUse=!1,c().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 x(this,void 0,void 0,function(){return v(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 rt(a)})}catch(a){throw new Error("Failed to decode encoded string bytes into utf-8")}return jt(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 x(this,void 0,void 0,function(){var t;return v(this,function(o){return t=Re(),e(),[2,{kernelMs:Re()-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(ft(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=jt(o,e.dtype),u=this.bufferSync(e),f=0;f<s.size;++f){var E=s.indexToLoc(f).map(function(I,P){return I+t[P]});s.values[f]=u.get.apply(u,E)}return s.toTensor()},r.prototype.stridedSlice=function(e,t,o,a){ft(e,"stridedSlice");var i=Ea(t,o,a);if(i.some(function(G){return G===0}))return Ur([],i);for(var s=jt(i,e.dtype),u=this.bufferSync(e),f=0;f<s.size;f++){for(var E=s.indexToLoc(f),I=new Array(E.length),P=0;P<I.length;P++)I[P]=E[P]*a[P]+t[P];s.set.apply(s,[u.get.apply(u,I)].concat(E))}return s.toTensor()},r.prototype.diag=function(e){for(var t=this.readSync(e.dataId),o=jt([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 E=new Array(o);for(s=0;s<E.length;s++)u[t]=s,E[s]=this.slice(e,u,f).reshape(a);return E},r.prototype.reverse=function(e,t){ft(e,"reverse");for(var o=jt(e.shape,e.dtype),a=this.bufferSync(e),i=function(u){var f=o.indexToLoc(u),E=f.slice();t.forEach(function(I){return E[I]=e.shape[I]-1-E[I]}),o.set.apply(o,[a.get.apply(a,E)].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(G){return un(G)}),i=e.map(function(G){return xn(G)});return xr(this.concat(a,t),this.concat(i,t))}var s=e.map(function(G){var oe=le(G.shape.slice(t));return G.as2D(-1,oe)}),u=qn(s.map(function(G){return G.shape}),1),f=jt(u,e[0].dtype).values;if(s[0].shape[0]===1){var E=0;s.forEach(function(G){f.set(o.readSync(G.dataId),E),E+=G.size})}else{var I=0;s.forEach(function(G){for(var oe=o.readSync(G.dataId),ue=0,ie=0;ie<G.shape[0];++ie)for(var ce=ie*u[1]+I,ye=0;ye<G.shape[1];++ye)f[ce+ye]=oe[ue++];I+=G.shape[1]})}var P=qn(e.map(function(G){return G.shape}),t);return Ur(f,P,e[0].dtype)},r.prototype.neg=function(e){return ft(e,"neg"),this.multiply(It(-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;ft(e,"addN");for(var o=e.map(function(E){return t.readSync(E.dataId)}),a=jt(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 ft([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){ft([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],E=this.readSync(e.dataId),I=this.readSync(t.dataId),P=o?[e.strides[0],1,e.strides[1]]:[e.strides[0],e.strides[1],1],G=P[0],oe=P[1],ue=P[2],ie=a?[1,t.strides[1],t.strides[0]]:[t.strides[1],1,t.strides[0]],ce=ie[0],ye=ie[1],we=ie[2],Ee=s*u,Se=jt([f,s,u],e.dtype),Me=Se.values,He=this.blockSize,Fe=0;Fe<f;Fe++)for(var je=0;je<s;je+=He)for(var Ue=0;Ue<u;Ue+=He)for(var Ze=0;Ze<i;Ze+=He)for(var Je=Math.min(je+He,s),dt=Math.min(Ue+He,u),ct=Math.min(Ze+He,i),st=je;st<Je;st++)for(var pt=Ue;pt<dt;pt++){for(var ht=0,ut=Ze;ut<ct;ut++)ht+=E[Fe*G+st*oe+ut*ue]*I[ut*ce+pt*ye+Fe*we];Me[Fe*Ee+(st*u+pt)]+=ht}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,E=this.batchMatMul(t,o,a,i);return s&&(E=this.add(E,s)),u&&(E=Ou(this,E,u,f)),E},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 ft([e,t],"realDivide"),this.broadcastedBinaryOp(e,t,"float32",function(o,a){return o/a})},r.prototype.floorDiv=function(e,t){return ft([e,t],"floorDiv"),this.broadcastedBinaryOp(e,t,"int32",function(o,a){return Math.floor(o/a)})},r.prototype.sum=function(e,t){ft(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),E=this.readSync(e.dataId),I=0;I<f.length;++I){for(var P=I*u,G=0,oe=0;oe<u;++oe)G+=E[P+oe];f[I]=G}return s},r.prototype.prod=function(e,t){ft(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),E=this.readSync(e.dataId),I=0;I<f.length;++I){for(var P=I*u,G=1,oe=0;oe<u;++oe)G*=E[P+oe];f[I]=G}return s},r.prototype.unsortedSegmentSum=function(e,t,o){ft(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=It(s,"int32"),f=rl(u,t).asType("float32").mul(e).sum(0);a.push(f)}return jn(a)},r.prototype.argMin=function(e,t){ft(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),E=this.readSync(u.dataId),I=this.readSync(e.dataId),P=0;P<E.length;++P){for(var G=P*f,oe=I[G],ue=0,ie=0;ie<f;++ie){var ce=I[G+ie];ce<oe&&(oe=ce,ue=ie)}E[P]=ue}return u},r.prototype.argMax=function(e,t){ft(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),E=this.readSync(u.dataId),I=this.readSync(e.dataId),P=0;P<E.length;++P){for(var G=P*f,oe=I[G],ue=0,ie=0;ie<f;++ie){var ce=I[G+ie];ce>oe&&(oe=ce,ue=ie)}E[P]=ue}return u},r.prototype.cumsum=function(e,t,o,a){if(ft(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),E=e.shape[e.rank-1],I=a?function(ie,ce){return ie+E-ce-1}:function(ie,ce){return ie+ce},P=0;P<f.length;P+=E)for(var G=0;G<E;G++){var oe=I(P,G);if(G===0)u[oe]=o?0:f[oe];else{var ue=I(P,G-1);u[oe]=o?f[ue]+u[ue]:f[oe]+u[ue]}}return s},r.prototype.equal=function(e,t){return ft([e,t],"equal"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o===a?1:0})},r.prototype.notEqual=function(e,t){return ft([e,t],"notEqual"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o!==a?1:0})},r.prototype.less=function(e,t){return ft([e,t],"less"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o<a?1:0})},r.prototype.lessEqual=function(e,t){return ft([e,t],"lessEqual"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o<=a?1:0})},r.prototype.greater=function(e,t){return ft([e,t],"greater"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o>a?1:0})},r.prototype.greaterEqual=function(e,t){return ft([e,t],"greaterEqual"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o>=a?1:0})},r.prototype.logicalNot=function(e){ft(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 ft([e,t],"logicalAnd"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o&&a})},r.prototype.logicalOr=function(e,t){return ft([e,t],"logicalOr"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o||a})},r.prototype.select=function(e,t,o){ft([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),E=0,I=e.rank===0||e.rank>1||t.rank===1?1:le(t.shape.slice(1)),P=0;P<a.length;P++)for(var G=0;G<I;G++)a[P]===1?f[E++]=i[P]:f[E++]=s[P];return u},r.prototype.where=function(e){ft([e],"where");var t=this.readSync(e.dataId);return fi(e.shape,t)},r.prototype.topk=function(e,t,o){return ft(e,"topk"),as(this.readSync(e.dataId),e.shape,e.dtype,t)},r.prototype.min=function(e,t){ft(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),E=this.readSync(e.dataId),I=0;I<f.length;++I){for(var P=I*u,G=E[P],oe=0;oe<u;++oe){var ue=E[P+oe];ue<G&&(G=ue)}f[I]=G}return s},r.prototype.minimum=function(e,t){return ft([e,t],"minimum"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){return Math.min(o,a)})},r.prototype.mod=function(e,t){return ft([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){ft(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),E=this.readSync(e.dataId),I=0;I<f.length;++I){for(var P=I*u,G=E[P],oe=0;oe<u;++oe){var ue=E[P+oe];ue>G&&(G=ue)}f[I]=G}return s},r.prototype.maximum=function(e,t){return ft([e,t],"maximum"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){return Math.max(o,a)})},r.prototype.all=function(e,t){ft(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),E=this.readSync(e.dataId),I=0;I<f.length;++I){for(var P=I*u,G=E[P],oe=0;oe<u;++oe){var ue=E[P+oe];G=G&&ue}f[I]=G}return s},r.prototype.any=function(e,t){ft(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),E=this.readSync(e.dataId),I=0;I<f.length;++I){for(var P=I*u,G=E[P],oe=0;oe<u;++oe){var ue=E[P+oe];G=G||ue}f[I]=G}return s},r.prototype.squaredDifference=function(e,t){return ft([e,t],"squaredDifference"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){var i=o-a;return i*i})},r.prototype.ceil=function(e){ft(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){ft(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){ft(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){ft(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){ft(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){ft(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){ft(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){ft(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){ft(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){ft(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){ft(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){ft(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){ft(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){ft(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){ft(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){ft(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 ft([e,t],"prelu"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){return o<0?a*o:o})},r.prototype.elu=function(e){ft(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){ft([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){ft(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){ft(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){ft(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){ft(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){ft(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]),E=void 0;E=u?f:s?a[i]:Math.log(1+f),o[i]=E}return this.makeOutput(o,e.shape,"float32")},r.prototype.sin=function(e){ft(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){ft(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){ft(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){ft(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){ft(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){ft(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 ft([e,t],"atan2"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){return Math.atan2(o,a)})},r.prototype.sinh=function(e){ft(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){ft(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){ft(e,"tanh");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=be(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.asinh=function(e){ft(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){ft(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){ft(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){ft(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),ft(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){ft([e,t],"conv2d");for(var a=o.filterHeight,i=o.filterWidth,s=o.dilationHeight,u=o.dilationWidth,f=o.padInfo.left,E=o.padInfo.top,I=o.dataFormat==="channelsLast",P=jt(o.outShape,e.dtype),G=e.strides[0],oe=I?e.strides[1]:e.strides[2],ue=I?e.strides[2]:1,ie=I?1:e.strides[1],ce=P.strides[0],ye=I?P.strides[1]:P.strides[2],we=I?P.strides[2]:1,Ee=I?1:P.strides[1],Se=this.readSync(e.dataId),Me=this.readSync(t.dataId),He=P.values,Fe=0;Fe<o.batchSize;++Fe)for(var je=Fe*G,Ue=Fe*ce,Ze=0;Ze<o.outHeight;++Ze)for(var Je=Ue+Ze*ye,dt=Ze*o.strideHeight-E,ct=0;ct<a;ct++){var st=dt+ct*s;if(!(st<0||st>=o.inHeight))for(var pt=ct*t.strides[0],ht=je+st*oe,ut=0;ut<o.outWidth;++ut)for(var gt=Je+ut*we,yt=ut*o.strideWidth-f,Ot=0;Ot<i;Ot++){var Mt=yt+Ot*u;if(!(Mt<0||Mt>=o.inWidth))for(var Pt=ht+Mt*ue,Kt=pt+Ot*t.strides[1],Yt=0;Yt<o.inChannels;++Yt){for(var $t=Se[Pt+Yt*ie],ar=0;ar<o.outChannels;++ar)He[gt+ar*Ee]+=$t*Me[Kt+ar];Kt+=o.outChannels}}}return P.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,E=o.dilationWidth,I=o.padInfo.front,P=o.padInfo.left,G=o.padInfo.top,oe=jt(o.outShape,e.dtype),ue=this.readSync(e.dataId),ie=this.readSync(t.dataId),ce=oe.values,ye=0;ye<o.batchSize;++ye)for(var we=ye*e.strides[0],Ee=ye*oe.strides[0],Se=0;Se<o.outDepth;++Se)for(var Me=Ee+Se*oe.strides[1],He=Se*o.strideDepth-I,Fe=0;Fe<a;Fe++){var je=He+Fe*u;if(!(je<0||je>=o.inDepth))for(var Ue=Fe*t.strides[0],Ze=we+je*e.strides[1],Je=0;Je<o.outHeight;++Je)for(var dt=Me+Je*oe.strides[2],ct=Je*o.strideHeight-G,st=0;st<i;st++){var pt=ct+st*f;if(!(pt<0||pt>=o.inHeight))for(var ht=Ue+st*t.strides[1],ut=Ze+pt*e.strides[2],gt=0;gt<o.outWidth;++gt)for(var yt=dt+gt*o.outChannels,Ot=gt*o.strideWidth-P,Mt=0;Mt<s;Mt++){var Pt=Ot+Mt*E;if(!(Pt<0||Pt>=o.inWidth))for(var Kt=ht+Mt*t.strides[2],Yt=ut+Pt*o.inChannels,$t=Kt,ar=0;ar<o.inChannels;++ar){for(var er=ue[Yt+ar],ir=0;ir<o.outChannels;++ir)ce[yt+ir]+=er*ie[$t+ir];$t+=o.outChannels}}}}return oe.toTensor()},r.prototype.conv2dDerInput=function(e,t,o){ft([e,t],"conv2dDerInput");for(var a=jt(o.inShape,"float32"),i=a.values,s=this.readSync(e.dataId),u=this.readSync(t.dataId),f=t.strides,E=f[0],I=f[1],P=f[2],G=o.batchSize,oe=o.filterHeight,ue=o.filterWidth,ie=o.inChannels,ce=o.inHeight,ye=o.inWidth,we=o.outChannels,Ee=o.outHeight,Se=o.outWidth,Me=o.strideHeight,He=o.strideWidth,Fe=o.dataFormat,je=oe-1-o.padInfo.top,Ue=ue-1-o.padInfo.left,Ze=Fe==="channelsLast",Je=a.strides[0],dt=Ze?a.strides[1]:a.strides[2],ct=Ze?a.strides[2]:1,st=Ze?1:a.strides[1],pt=e.strides[0],ht=Ze?e.strides[1]:e.strides[2],ut=Ze?e.strides[2]:1,gt=Ze?1:e.strides[1],yt=0;yt<G;++yt)for(var Ot=0;Ot<ie;++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<ye;++$t){for(var ar=$t-Ue,er=Math.max(0,Math.ceil(ar/He)),ir=Math.min(Se,(ue+ar)/He),Fr=0,tr=Kt;tr<Yt;++tr)for(var Er=tr*Me-Pt,fr=er;fr<ir;++fr)for(var jr=pt*yt+ht*tr+ut*fr,Mr=E*(oe-1-Er)+I*(ue-1-(fr*He-ar))+P*Ot,Pr=0;Pr<we;++Pr)Fr+=s[jr+gt*Pr]*u[Mr+Pr];i[Je*yt+dt*Mt+ct*$t+st*Ot]=Fr}return a.toTensor()},r.prototype.conv3dDerInput=function(e,t,o){for(var a=jt(o.inShape,"float32"),i=a.values,s=a.strides,u=s[0],f=s[1],E=s[2],I=s[3],P=this.readSync(e.dataId),G=e.strides,oe=G[0],ue=G[1],ie=G[2],ce=G[3],ye=this.readSync(t.dataId),we=t.strides,Ee=we[0],Se=we[1],Me=we[2],He=we[3],Fe=o.batchSize,je=o.filterDepth,Ue=o.filterHeight,Ze=o.filterWidth,Je=o.inChannels,dt=o.inDepth,ct=o.inHeight,st=o.inWidth,pt=o.outChannels,ht=o.outDepth,ut=o.outHeight,gt=o.outWidth,yt=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<Fe;++$t)for(var ar=0;ar<Je;++ar)for(var er=0;er<dt;++er)for(var ir=er-Pt,Fr=Math.max(0,Math.ceil(ir/yt)),tr=Math.min(ht,(je+ir)/yt),Er=0;Er<ct;++Er)for(var fr=Er-Kt,jr=Math.max(0,Math.ceil(fr/Ot)),Mr=Math.min(ut,(Ue+fr)/Ot),Pr=0;Pr<st;++Pr){for(var zn=Pr-Yt,Gn=Math.max(0,Math.ceil(zn/Mt)),mn=Math.min(gt,(Ze+zn)/Mt),Fa=0,io=Fr;io<tr;++io)for(var Do=io*yt-ir,so=jr;so<Mr;++so)for(var Ba=so*Ot-fr,uo=Gn;uo<mn;++uo)for(var Vu=oe*$t+ue*io+ie*so+ce*uo,Ua=Ee*(je-1-Do)+Se*(Ue-1-Ba)+Me*(Ze-1-(uo*Mt-zn))+He*ar,Vn=0;Vn<pt;++Vn)Fa+=P[Vu+Vn]*ye[Ua+Vn];i[u*$t+f*er+E*Er+I*Pr+ar]=Fa}return a.toTensor()},r.prototype.conv2dDerFilter=function(e,t,o){ft([e,t],"conv2dDerFilter");for(var a=o.strideHeight,i=o.strideWidth,s=o.filterHeight,u=o.filterWidth,f=o.dataFormat==="channelsLast",E=jt(o.filterShape,"float32"),I=o.padInfo.left,P=o.padInfo.top,G=this.bufferSync(e),oe=this.bufferSync(t),ue=0;ue<s;++ue)for(var ie=Math.max(0,Math.ceil((P-ue)/a)),ce=Math.min(o.outHeight,(o.inHeight+P-ue)/a),ye=0;ye<u;++ye)for(var we=Math.max(0,Math.ceil((I-ye)/i)),Ee=Math.min(o.outWidth,(o.inWidth+I-ye)/i),Se=0;Se<o.inChannels;++Se)for(var Me=0;Me<o.outChannels;++Me){for(var He=0,Fe=0;Fe<o.batchSize;++Fe)for(var je=ie;je<ce;++je)for(var Ue=ue+je*a-P,Ze=we;Ze<Ee;++Ze){var Je=ye+Ze*i-I;He+=f?G.get(Fe,Ue,Je,Se)*oe.get(Fe,je,Ze,Me):G.get(Fe,Se,Ue,Je)*oe.get(Fe,Me,je,Ze)}E.set(He,ue,ye,Se,Me)}return E.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,E=o.filterWidth,I=jt(o.filterShape,"float32"),P=I.values,G=I.strides,oe=G[0],ue=G[1],ie=G[2],ce=G[3],ye=this.readSync(t.dataId),we=t.strides,Ee=we[0],Se=we[1],Me=we[2],He=we[3],Fe=this.readSync(e.dataId),je=e.strides,Ue=je[0],Ze=je[1],Je=je[2],dt=je[3],ct=o.padInfo.front,st=o.padInfo.left,pt=o.padInfo.top,ht=0;ht<u;++ht)for(var ut=Math.max(0,Math.ceil((ct-ht)/a)),gt=Math.min(o.outDepth,(o.inDepth+ct-ht)/a),yt=ht*oe,Ot=0;Ot<f;++Ot)for(var Mt=Math.max(0,Math.ceil((pt-Ot)/i)),Pt=Math.min(o.outHeight,(o.inHeight+pt-Ot)/i),Kt=Ot*ue+yt,Yt=0;Yt<E;++Yt)for(var $t=Math.max(0,Math.ceil((st-Yt)/s)),ar=Math.min(o.outWidth,(o.inWidth+st-Yt)/s),er=Yt*ie+Kt,ir=0;ir<o.inChannels;++ir)for(var Fr=ir*ce+er,tr=0;tr<o.outChannels;++tr){for(var Er=0,fr=0;fr<o.batchSize;++fr)for(var jr=fr*Ue,Mr=fr*Ee,Pr=ut;Pr<gt;++Pr)for(var zn=(ht+Pr*a-ct)*Ze+jr,Gn=Pr*Se+Mr,mn=Mt;mn<Pt;++mn)for(var Fa=(Ot+mn*i-pt)*Je+zn,io=mn*Me+Gn,Do=$t;Do<ar;++Do){var so=Do*He+io;Er+=Fe[(Yt+Do*s-st)*dt+Fa+ir]*ye[so+tr]}P[Fr+tr]=Er}return I.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){ft([e,t],"depthwiseConv2D");for(var a=o.filterHeight,i=o.filterWidth,s=o.dilationHeight,u=o.dilationWidth,f=o.padInfo.left,E=o.padInfo.top,I=o.outChannels/o.inChannels,P=jt(o.outShape,e.dtype),G=this.readSync(e.dataId),oe=this.readSync(t.dataId),ue=P.values,ie=0;ie<o.batchSize;++ie)for(var ce=ie*e.strides[0],ye=ie*P.strides[0],we=0;we<o.outHeight;++we)for(var Ee=ye+we*P.strides[1],Se=we*o.strideHeight-f,Me=0;Me<a;++Me){var He=Se+Me*s;if(!(He<0||He>=o.inHeight))for(var Fe=Me*t.strides[0],je=ce+He*e.strides[1],Ue=0;Ue<o.outWidth;++Ue)for(var Ze=Ee+Ue*P.strides[2],Je=Ue*o.strideWidth-E,dt=0;dt<i;++dt){var ct=Je+dt*u;if(!(ct<0||ct>=o.inWidth))for(var st=Fe+dt*t.strides[1],pt=je+ct*o.inChannels,ht=Ze,ut=st,gt=0;gt<o.inChannels;++gt){for(var yt=G[pt+gt],Ot=0;Ot<I;++Ot)ue[ht+Ot]+=yt*oe[ut+Ot];ht+=I,ut+=I}}}return P.toTensor()},r.prototype.depthwiseConv2DDerInput=function(e,t,o){ft([e,t],"depthwiseConv2DDerInput");for(var a=jt(o.inShape,"float32"),i=a.values,s=a.strides,u=s[0],f=s[1],E=s[2],I=this.readSync(e.dataId),P=e.strides,G=P[0],oe=P[1],ue=P[2],ie=this.readSync(t.dataId),ce=t.strides,ye=ce[0],we=ce[1],Ee=ce[2],Se=o.batchSize,Me=o.filterHeight,He=o.filterWidth,Fe=o.inChannels,je=o.inHeight,Ue=o.inWidth,Ze=o.outChannels,Je=o.outHeight,dt=o.outWidth,ct=o.strideHeight,st=o.strideWidth,pt=Me-1-o.padInfo.top,ht=He-1-o.padInfo.left,ut=Ze/Fe,gt=0;gt<Se;++gt)for(var yt=0;yt<Fe;++yt)for(var Ot=0;Ot<je;++Ot)for(var Mt=Ot-pt,Pt=Math.max(0,Math.ceil(Mt/ct)),Kt=Math.min(Je,(Me+Mt)/ct),Yt=0;Yt<Ue;++Yt){for(var $t=Yt-ht,ar=Math.max(0,Math.ceil($t/st)),er=Math.min(dt,(He+$t)/st),ir=0,Fr=Pt;Fr<Kt;++Fr)for(var tr=Fr*ct-Mt,Er=ar;Er<er;++Er)for(var fr=G*gt+oe*Fr+ue*Er,jr=ye*(Me-1-tr)+we*(He-1-(Er*st-$t))+Ee*yt,Mr=0;Mr<ut;++Mr)ir+=I[fr+(yt*ut+Mr)]*ie[jr+Mr];i[u*gt+f*Ot+E*Yt+yt]=ir}return a.toTensor()},r.prototype.depthwiseConv2DDerFilter=function(e,t,o){ft([e,t],"depthwiseConv2DDerFilter");for(var a=o.strideHeight,i=o.strideWidth,s=o.filterHeight,u=o.filterWidth,f=jt(o.filterShape,"float32"),E=o.padInfo.left,I=o.padInfo.top,P=o.outChannels/o.inChannels,G=this.bufferSync(e),oe=this.bufferSync(t),ue=0;ue<s;++ue)for(var ie=Math.max(0,Math.ceil((I-ue)/a)),ce=Math.min(o.outHeight,(o.inHeight+I-ue)/a),ye=0;ye<u;++ye)for(var we=Math.max(0,Math.ceil((E-ye)/i)),Ee=Math.min(o.outWidth,(o.inWidth+E-ye)/i),Se=0;Se<o.outChannels;++Se){for(var Me=Math.trunc(Se/P),He=Se%P,Fe=0,je=0;je<o.batchSize;++je)for(var Ue=ie;Ue<ce;++Ue)for(var Ze=ue+Ue*a-I,Je=we;Je<Ee;++Je){var dt=ye+Je*i-E;Fe+=G.get(je,Ze,dt,Me)*oe.get(je,Ue,Je,Se)}f.set(Fe,ue,ye,Me,He)}return f.toTensor()},r.prototype.tile=function(e,t){return ft(e,"tile"),os(this.bufferSync(e),t)},r.prototype.pad=function(e,t,o){ft(e,"pad");var a=t.map(function(P,G){return P[0]+e.shape[G]+P[1]}),i=t.map(function(P){return P[0]}),s=this.bufferSync(e),u=jt(a,e.dtype);o!==0&&u.values.fill(o);for(var f=0;f<e.size;f++){var E=s.indexToLoc(f),I=E.map(function(P,G){return P+i[G]});u.set.apply(u,[s.get.apply(s,E)].concat(I))}return u.toTensor()},r.prototype.transpose=function(e,t){ft(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=jt(o,e.dtype),u=this.bufferSync(e);for(a=0;a<e.size;++a){for(var f=u.indexToLoc(a),E=new Array(f.length),I=0;I<E.length;I++)E[I]=f[t[I]];var P=s.locToIndex(E);s.values[P]=i[a]}return s.toTensor()},r.prototype.gather=function(e,t,o){ft([e,t],"gather");var a=e.shape.slice(),i=this.readSync(t.dataId);a[o]=i.length;for(var s=jt(a,e.dtype),u=this.bufferSync(e),f=0;f<s.size;++f){var E=s.indexToLoc(f),I=E.slice();I[o]=i[E[o]];var P=u.locToIndex(I);s.values[f]=u.values[P]}return s.toTensor()},r.prototype.batchToSpaceND=function(e,t,o){ft([e],"batchToSpaceND");var a=t.reduce(function(I,P){return I*P}),i=Wo(e.shape,t,a),s=qt(i.length,t.length),u=wa(e.shape,t,a),f=Gs(o,t.length),E=Vs(u,o,t.length);return e.reshape(i).transpose(s).reshape(u).slice(f,E)},r.prototype.spaceToBatchND=function(e,t,o){ft([e],"spaceToBatchND");var a=t.reduce(function(P,G){return P*G}),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),E=qt(f.length,t.length,!1),I=wa(u.shape,t,a,!1);return u.reshape(f).transpose(E).reshape(I)},r.prototype.pool=function(e,t,o){ft(e,"pool");for(var a=t.strideHeight,i=t.strideWidth,s=t.dilationHeight,u=t.dilationWidth,f=t.effectiveFilterHeight,E=t.effectiveFilterWidth,I=t.padInfo.top,P=t.padInfo.left,G=o==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,oe=this.readSync(e.dataId),ue=jt(t.outShape,e.dtype),ie=ue.values,ce=t.outShape[1]*t.outShape[2]*t.outShape[3],ye=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],He=0;He<t.inChannels;++He)for(var Fe=0;Fe<t.outHeight;++Fe)for(var je=Fe*a-I,Ue=Math.max(0,je),Ze=Math.min(t.inHeight,f+je),Je=Se+Fe*ye,dt=0;dt<t.outWidth;++dt){for(var ct=dt*i-P,st=Math.max(0,ct),pt=Math.min(t.inWidth,E+ct),ht=G,ut=0,gt=0,yt=Ue;yt<Ze;yt+=s){for(var Ot=Me+yt*e.strides[1],Mt=st;Mt<pt;Mt+=u){var Pt=oe[Ot+Mt*e.strides[2]+He];o==="max"&&Pt>ht?ht=Pt:o==="avg"&&(ut+=Pt,gt++)}if(isNaN(ht))break}ie[Je+dt*we+He]=o==="avg"?ut/gt:ht}return ue.toTensor()},r.prototype.maxPool=function(e,t){return this.pool(e,t,"max")},r.prototype.maxPoolPositions=function(e,t){for(var o=jt(t.outShape,"int32"),a=t.strideHeight,i=t.strideWidth,s=t.dilationHeight,u=t.dilationWidth,f=t.effectiveFilterHeight,E=t.effectiveFilterWidth,I=t.padInfo.top,P=t.padInfo.left,G=this.bufferSync(e),oe=0;oe<t.batchSize;++oe)for(var ue=0;ue<t.inChannels;++ue)for(var ie=0;ie<t.outHeight;++ie){for(var ce=ie*a-I,ye=ce;ye<0;)ye+=s;for(var we=Math.min(t.inHeight,f+ce),Ee=0;Ee<t.outWidth;++Ee){for(var Se=Ee*i-P,Me=Se;Me<0;)Me+=u;for(var He=Math.min(t.inWidth,E+Se),Fe=Number.NEGATIVE_INFINITY,je=-1,Ue=ye;Ue<we;Ue+=s)for(var Ze=Ue-ce,Je=Me;Je<He;Je+=u){var dt=Je-Se,ct=G.get(oe,Ue,Je,ue);ct>Fe&&(Fe=ct,je=Ze*E+dt)}o.set(je,oe,ie,Ee,ue)}}return o.toTensor()},r.prototype.maxPoolBackprop=function(e,t,o,a){ft([t,o],"maxPoolBackprop");for(var i=this.maxPoolPositions(t,a),s=a.strideHeight,u=a.strideWidth,f=a.dilationHeight,E=a.dilationWidth,I=a.effectiveFilterHeight,P=a.effectiveFilterWidth,G=P-1-a.padInfo.left,oe=I-1-a.padInfo.top,ue=jt(t.shape,"float32"),ie=this.bufferSync(i),ce=this.bufferSync(e),ye=0;ye<a.batchSize;++ye)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,He=Se-G,Fe=0,je=0;je<I;je+=f){var Ue=(Me+je)/s;if(!(Ue<0||Ue>=a.outHeight||Math.floor(Ue)!==Ue))for(var Ze=0;Ze<P;Ze+=E){var Je=(He+Ze)/u;if(!(Je<0||Je>=a.outWidth||Math.floor(Je)!==Je)){var dt=I*P-1-ie.get(ye,Ue,Je,we)===je*P+Ze?1:0;dt!==0&&(Fe+=ce.get(ye,Ue,Je,we)*dt)}}}ue.set(Fe,ye,Ee,Se,we)}return ue.toTensor()},r.prototype.avgPoolBackprop=function(e,t,o){ft([e,t],"avgPoolBackprop");for(var a=o.strideHeight,i=o.strideWidth,s=o.filterHeight,u=o.filterWidth,f=o.dilationHeight,E=o.dilationWidth,I=o.effectiveFilterHeight,P=o.effectiveFilterWidth,G=P-1-o.padInfo.left,oe=I-1-o.padInfo.top,ue=jt(t.shape,"float32"),ie=1/(s*u),ce=this.bufferSync(e),ye=0;ye<o.batchSize;++ye)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,He=Se-G,Fe=0,je=0;je<I;je+=f){var Ue=(Me+je)/a;if(!(Ue<0||Ue>=o.outHeight||Math.floor(Ue)!==Ue))for(var Ze=0;Ze<P;Ze+=E){var Je=(He+Ze)/i;Je<0||Je>=o.outWidth||Math.floor(Je)!==Je||(Fe+=ce.get(ye,Ue,Je,we))}}ue.set(Fe*ie,ye,Ee,Se,we)}return ue.toTensor()},r.prototype.pool3d=function(e,t,o){ft(e,"pool3d");for(var a=t.strideDepth,i=t.strideHeight,s=t.strideWidth,u=t.dilationDepth,f=t.dilationHeight,E=t.dilationWidth,I=t.effectiveFilterDepth,P=t.effectiveFilterHeight,G=t.effectiveFilterWidth,oe=t.padInfo.front,ue=t.padInfo.top,ie=t.padInfo.left,ce=o==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,ye=this.readSync(e.dataId),we=jt(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],He=t.outShape[3]*t.outShape[4],Fe=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 dt=0;dt<t.outDepth;++dt){for(var ct=dt*a-oe,st=ct;st<0;)st+=u;for(var pt=Math.min(t.inDepth,I+ct),ht=Ue+dt*Me,ut=0;ut<t.outHeight;++ut){for(var gt=ut*i-ue,yt=gt;yt<0;)yt+=f;for(var Ot=Math.min(t.inHeight,P+gt),Mt=ht+ut*He,Pt=0;Pt<t.outWidth;++Pt){for(var Kt=Pt*s-ie,Yt=Kt;Yt<0;)Yt+=E;for(var $t=Math.min(t.inWidth,G+Kt),ar=Mt+Pt*Fe,er=ce,ir=0,Fr=0,tr=st;tr<pt;tr+=u){for(var Er=Ze+tr*e.strides[1],fr=yt;fr<Ot;fr+=f){for(var jr=Er+fr*e.strides[2],Mr=Yt;Mr<$t;Mr+=E){var Pr=ye[jr+Mr*e.strides[3]+Je];if(o==="max"&&Pr>er?er=Pr:o==="avg"&&(ir+=Pr,Fr++),isNaN(er))break}if(isNaN(er))break}if(isNaN(er))break}Ee[ar+Je]=o==="avg"?ir/Fr:er}}}return we.toTensor()},r.prototype.avgPool3d=function(e,t){return ft(e,"avgPool3d"),this.pool3d(e,t,"avg").toFloat()},r.prototype.avgPool3dBackprop=function(e,t,o){ft([e,t],"avgPool3dBackprop");for(var a=o.strideDepth,i=o.strideHeight,s=o.strideWidth,u=o.filterDepth,f=o.filterHeight,E=o.filterWidth,I=o.dilationDepth,P=o.dilationHeight,G=o.dilationWidth,oe=o.effectiveFilterDepth,ue=o.effectiveFilterHeight,ie=o.effectiveFilterWidth,ce=oe-1-o.padInfo.front,ye=ie-1-o.padInfo.left,we=ue-1-o.padInfo.top,Ee=jt(t.shape,"float32"),Se=1/(u*f*E),Me=this.bufferSync(e),He=0;He<o.batchSize;++He)for(var Fe=0;Fe<o.inChannels;++Fe)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,dt=Ue-we,ct=Ze-ye,st=0,pt=0;pt<oe;pt+=I){var ht=(Je+pt)/a;if(!(ht<0||ht>=o.outDepth||Math.floor(ht)!==ht))for(var ut=0;ut<ue;ut+=P){var gt=(dt+ut)/i;if(!(gt<0||gt>=o.outHeight||Math.floor(gt)!==gt))for(var yt=0;yt<ie;yt+=G){var Ot=(ct+yt)/s;Ot<0||Ot>=o.outWidth||Math.floor(Ot)!==Ot||(st+=Me.get(He,ht,gt,Ot,Fe))}}}Ee.set(st*Se,He,je,Ue,Ze,Fe)}return Ee.toTensor()},r.prototype.maxPool3d=function(e,t){return ft(e,"maxPool3d"),this.pool3d(e,t,"max").toFloat()},r.prototype.maxPool3dPositions=function(e,t){for(var o=jt(t.outShape,"int32"),a=t.strideDepth,i=t.strideHeight,s=t.strideWidth,u=t.dilationDepth,f=t.dilationHeight,E=t.dilationWidth,I=t.effectiveFilterDepth,P=t.effectiveFilterHeight,G=t.effectiveFilterWidth,oe=t.padInfo.front,ue=t.padInfo.top,ie=t.padInfo.left,ce=this.bufferSync(e),ye=0;ye<t.batchSize;++ye)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 He=Math.min(t.inDepth,I+Se),Fe=0;Fe<t.outHeight;++Fe){for(var je=Fe*i-ue,Ue=je;Ue<0;)Ue+=f;for(var Ze=Math.min(t.inHeight,P+je),Je=0;Je<t.outWidth;++Je){for(var dt=Je*s-ie,ct=dt;ct<0;)ct+=E;for(var st=Math.min(t.inWidth,G+dt),pt=Number.NEGATIVE_INFINITY,ht=-1,ut=Me;ut<He;ut+=u)for(var gt=ut-Se,yt=Ue;yt<Ze;yt+=f)for(var Ot=yt-je,Mt=ct;Mt<st;Mt+=E){var Pt=Mt-dt,Kt=ce.get(ye,ut,yt,Mt,we);Kt>=pt&&(pt=Kt,ht=gt*P*G+Ot*P+Pt)}o.set(ht,ye,Ee,Fe,Je,we)}}}return o.toTensor()},r.prototype.maxPool3dBackprop=function(e,t,o,a){ft([t,o],"maxPool3dBackprop");for(var i=this.maxPool3dPositions(t,a),s=a.strideDepth,u=a.strideHeight,f=a.strideWidth,E=a.dilationDepth,I=a.dilationHeight,P=a.dilationWidth,G=a.effectiveFilterDepth,oe=a.effectiveFilterHeight,ue=a.effectiveFilterWidth,ie=G-1-a.padInfo.front,ce=ue-1-a.padInfo.left,ye=oe-1-a.padInfo.top,we=jt(t.shape,"float32"),Ee=this.bufferSync(i),Se=this.bufferSync(e),Me=0;Me<a.batchSize;++Me)for(var He=0;He<a.inChannels;++He)for(var Fe=0;Fe<a.inDepth;++Fe)for(var je=0;je<a.inHeight;++je)for(var Ue=0;Ue<a.inWidth;++Ue){for(var Ze=Fe-ie,Je=je-ye,dt=Ue-ce,ct=0,st=0;st<G;st+=E){var pt=(Ze+st)/s;if(!(pt<0||pt>=a.outDepth||Math.floor(pt)!==pt))for(var ht=0;ht<oe;ht+=I){var ut=(Je+ht)/u;if(!(ut<0||ut>=a.outHeight||Math.floor(ut)!==ut))for(var gt=0;gt<ue;gt+=P){var yt=(dt+gt)/f;if(!(yt<0||yt>=a.outWidth||Math.floor(yt)!==yt)){var Ot=G*oe*ue-1-Ee.get(Me,pt,ut,yt,He)===st*oe*ue+ht*ue+gt?1:0;Ot!==0&&(ct+=Se.get(Me,pt,ut,yt,He)*Ot)}}}}we.set(ct,Me,Fe,je,Ue,He)}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 ft(e,"avgPool"),this.pool(e,t,"avg").toFloat()},r.prototype.resizeBilinear=function(e,t,o,a){ft(e,"resizeBilinear");for(var i=e.shape,s=i[0],u=i[1],f=i[2],E=i[3],I=this.readSync(e.dataId),P=new Float32Array(le([s,t,o,E])),G=[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,ie=G[0]/oe[0],ce=G[1]/oe[1],ye=0;ye<s;ye++)for(var we=0;we<t;we++)for(var Ee=ie*we,Se=Math.floor(Ee),Me=Ee-Se,He=Math.min(u-1,Math.ceil(Ee)),Fe=ye*e.strides[0]+Se*e.strides[1],je=ye*e.strides[0]+He*e.strides[1],Ue=0;Ue<o;Ue++)for(var Ze=ce*Ue,Je=Math.floor(Ze),dt=Ze-Je,ct=Math.min(f-1,Math.ceil(Ze)),st=Fe+Je*e.strides[2],pt=je+Je*e.strides[2],ht=Fe+ct*e.strides[2],ut=je+ct*e.strides[2],gt=0;gt<E;gt++){var yt=I[st+gt],Ot=I[pt+gt],Mt=yt+(I[ht+gt]-yt)*dt,Pt=Mt+(Ot+(I[ut+gt]-Ot)*dt-Mt)*Me;P[ue++]=Pt}return Ur(P,[s,t,o,E])},r.prototype.resizeBilinearBackprop=function(e,t,o){ft([e,t],"resizeBilinearBackprop");for(var a=t.shape,i=a[0],s=a[1],u=a[2],f=a[3],E=e.shape,I=E[1],P=E[2],G=new Float32Array(i*s*u*f),oe=[o&&I>1?s-1:s,o&&P>1?u-1:u],ue=[o&&I>1?I-1:I,o&&P>1?P-1:P],ie=oe[0]/ue[0],ce=oe[1]/ue[1],ye=this.readSync(e.dataId),we=0,Ee=0;Ee<i;Ee++)for(var Se=Ee*t.strides[0],Me=0;Me<I;Me++)for(var He=Me*ie,Fe=Math.floor(He),je=Math.min(Math.ceil(He),s-1),Ue=Se+Fe*t.strides[1],Ze=Se+je*t.strides[1],Je=He-Fe,dt=1-Je,ct=0;ct<P;ct++)for(var st=ct*ce,pt=Math.floor(st),ht=Math.min(Math.ceil(st),u-1),ut=st-pt,gt=1-ut,yt=Ue+pt*t.strides[2],Ot=Ue+ht*t.strides[2],Mt=Ze+pt*t.strides[2],Pt=Ze+ht*t.strides[2],Kt=dt*gt,Yt=dt*ut,$t=Je*gt,ar=Je*ut,er=0;er<f;er++){var ir=ye[we++];G[yt+er]+=ir*Kt,G[Ot+er]+=ir*Yt,G[Mt+er]+=ir*$t,G[Pt+er]+=ir*ar}return kn(G,[i,u,s,f],t.dtype)},r.prototype.resizeNearestNeighbor=function(e,t,o,a){ft(e,"resizeNearestNeighbor");for(var i=e.shape,s=i[0],u=i[1],f=i[2],E=i[3],I=this.readSync(e.dataId),P=new Float32Array(s*t*o*E),G=[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=G[0]/oe[0],ie=G[1]/oe[1],ce=0,ye=0;ye<s;ye++)for(var we=ye*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],He=0;He<o;He++)for(var Fe=ie*He,je=Me+Math.min(f-1,a?Math.round(Fe):Math.floor(Fe))*e.strides[2],Ue=0;Ue<E;Ue++){var Ze=I[je+Ue];P[ce++]=Ze}return Ur(P,[s,t,o,E],e.dtype)},r.prototype.resizeNearestNeighborBackprop=function(e,t,o){ft([e,t],"resizeNearestNeighborBackprop");for(var a=t.shape,i=a[0],s=a[1],u=a[2],f=a[3],E=e.shape,I=E[1],P=E[2],G=new Float32Array(i*s*u*f),oe=this.readSync(e.dataId),ue=[o&&I>1?s-1:s,o&&P>1?u-1:u],ie=[o&&I>1?I-1:I,o&&P>1?P-1:P],ce=ue[0]/ie[0],ye=ue[1]/ie[1],we=1/ce,Ee=1/ye,Se=2*Math.ceil(we)+2,Me=2*Math.ceil(Ee)+2,He=0;He<i;He++)for(var Fe=He*t.strides[0],je=0;je<s;je++)for(var Ue=Fe+je*t.strides[1],Ze=Math.floor(je*we),Je=Math.floor(Ze-Se/2),dt=0;dt<u;dt++)for(var ct=Ue+dt*t.strides[2],st=Math.floor(dt*Ee),pt=Math.floor(st-Me/2),ht=0;ht<f;ht++){for(var ut=0,gt=0;gt<Se;gt++){var yt=gt+Je;if(!(yt<0||yt>=I)){var Ot=Fe+yt*e.strides[1],Mt=yt*ce;if(je===Math.min(s-1,o?Math.round(Mt):Math.floor(Mt)))for(var Pt=0;Pt<Me;Pt++){var Kt=Pt+pt;if(!(Kt<0||Kt>=P)){var Yt=Ot+Kt*e.strides[2],$t=Kt*ye;dt===Math.min(u-1,o?Math.round($t):Math.floor($t))&&(ut+=oe[Yt+ht])}}}}G[ct+ht]=ut}return kn(G,t.shape,t.dtype)},r.prototype.batchNormalization=function(e,t,o,a,i,s){ft([e,t,o,i,s],"batchNorm");for(var u=this.readSync(e.dataId),f=this.readSync(t.dataId),E=this.readSync(o.dataId),I=i?this.readSync(i.dataId):new Float32Array([1]),P=s?this.readSync(s.dataId):new Float32Array([0]),G=new Float32Array(u.length),oe=P.length,ue=I.length,ie=E.length,ce=f.length,ye=0,we=0,Ee=0,Se=0,Me=0;Me<u.length;++Me)G[Me]=P[ye++]+(u[Me]-f[we++])*I[Ee++]/Math.sqrt(E[Se++]+a),ye>=oe&&(ye=0),we>=ce&&(we=0),Ee>=ue&&(Ee=0),Se>=ie&&(Se=0);return kn(G,e.shape)},r.prototype.localResponseNormalization4D=function(e,t,o,a,i){ft(e,"localResponseNormalization4D");var s=e.shape[3],u=s-1,f=this.readSync(e.dataId),E=e.size,I=new Float32Array(E);function P(ie){for(var ce=ie%s,ye=ie-ce+Math.max(0,ce-t),we=ie-ce+Math.min(ce+t,u),Ee=0;ye<=we;ye++){var Se=f[ye];Ee+=Se*Se}return Ee}for(var G=0;G<E;G++){var oe=P(G),ue=f[G]*Math.pow(o+a*oe,-i);I[G]=ue}return kn(I,e.shape)},r.prototype.LRNGrad=function(e,t,o,a,i,s,u){ft(e,"LRNGrad");for(var f=e.shape[3],E=this.readSync(e.dataId),I=this.readSync(t.dataId),P=this.readSync(o.dataId),G=new Float32Array(e.size),oe=e.size,ue=0;ue<oe;ue++){for(var ie=ue%f,ce=ue-ie+Math.max(0,ie-a),ye=ue-ie+Math.min(f,ie+a+1),we=0,Ee=ce;Ee<ye;Ee++)we+=Math.pow(I[Ee],2);for(we=s*we+i,Ee=ce;Ee<ye;Ee++){var Se=-2*s*u*I[Ee]*P[ue]/we;ue===Ee&&(Se+=Math.pow(we,-u)),Se*=E[ue],G[Ee]+=Se}}return kn(G,e.shape)},r.prototype.multinomial=function(e,t,o,a){ft(e,"multinomial");for(var i=t?e:zo(e),s=i.shape[0],u=i.shape[1],f=Tr([s,o],"int32"),E=this.readSync(f.dataId),I=this.readSync(i.dataId),P=0;P<s;++P){var G=P*u,oe=new Float32Array(u-1);oe[0]=I[G];for(var ue=1;ue<oe.length;++ue)oe[ue]=oe[ue-1]+I[G+ue];for(var ie=Uo(a.toString()),ce=P*o,ye=0;ye<o;++ye){var we=ie();E[ce+ye]=oe.length;for(var Ee=0;Ee<oe.length;Ee++)if(we<oe[Ee]){E[ce+ye]=Ee;break}}}return f},r.prototype.oneHot=function(e,t,o,a){ft(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 ft(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=jt(e.shape,"float32"),s=jt(e.shape,"float32"),u=un(e).as2D(o,a),f=xn(e).as2D(o,a),E=0;E<o;E++)for(var I=u.slice([E,0],[1,a]),P=f.slice([E,0],[1,a]),G=xr(I,P),oe=this.readSync(this.fftImpl(G,t).dataId),ue=0;ue<a;ue++){var ie=es(oe,ue);i.values[E*a+ue]=ie.real,s.values[E*a+ue]=ie.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(It(a)),xn(i).div(It(a)))),i}var s=this.readSync(e.dataId),u=function(f){for(var E=new Float32Array(f.length/2),I=new Float32Array(f.length/2),P=0;P<f.length;P+=2)E[P/2]=f[P],I[P/2]=f[P+1];return{real:E,imag:I}}(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 ye=Math.ceil(ce.length/4),we=new Float32Array(ye),Ee=new Float32Array(ye),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 ye=Math.floor(ce.length/4),we=new Float32Array(ye),Ee=new Float32Array(ye),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),E=xr(f.real,f.imag).as1D();u=this.fftRadix2(u,i,o),E=this.fftRadix2(E,i,o);var I=function(ce,ye){for(var we=new Float32Array(ce/2),Ee=new Float32Array(ce/2),Se=0;Se<Math.ceil(ce/2);Se++){var Me=(ye?2:-2)*Math.PI*(Se/ce);we[Se]=Math.cos(Me),Ee[Se]=Math.sin(Me)}return{real:we,imag:Ee}}(t,o),P=xr(I.real,I.imag).mul(E),G=u.add(P),oe=u.sub(P),ue=un(G).concat(un(oe)),ie=xn(G).concat(xn(oe));return xr(ue,ie).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 E=Zs(i*f,t,o),I=es(e,f);s+=I.real*E.real-I.imag*E.imag,u+=I.real*E.imag+I.imag*E.real}o&&(s/=t,u/=t),Qs(a,s,u,i)}return a},r.prototype.depthToSpace=function(e,t,o){w(o==="NHWC",function(){return"Only NHWC dataFormat supported on CPU for depthToSpace. Got "+o}),w(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,E=s*t,I=u/(t*t),P=this.readSync(e.dataId),G=new Float32Array(a*f*E*I),oe=0,ue=0;ue<a;++ue)for(var ie=0;ie<f;++ie)for(var ce=Math.floor(ie/t),ye=ie%t,we=0;we<E;++we)for(var Ee=Math.floor(we/t),Se=(ye*t+we%t)*I,Me=0;Me<I;++Me){var He=Me+Se+u*(Ee+s*(ce+i*ue));G[oe++]=P[He]}return kn(G,[a,f,E,I])},r.prototype.broadcastedBinaryOp=function(e,t,o,a){var i=Ht(e.shape,t.shape),s=jt(i,o),u=this.readSync(e.dataId),f=this.readSync(t.dataId),E=En(e.shape,i),I=En(t.shape,i),P=s.values;if(E.length+I.length===0)for(var G=0;G<P.length;++G)P[G]=a(u[G%u.length],f[G%f.length]);else{var oe=this.bufferSync(e),ue=this.bufferSync(t),ie=function(ce){var ye=s.indexToLoc(ce),we=ye.slice(-e.rank);E.forEach(function(He){return we[He]=0});var Ee=oe.locToIndex(we),Se=ye.slice(-t.rank);I.forEach(function(He){return Se[He]=0});var Me=ue.locToIndex(Se);P[ce]=a(u[Ee],f[Me])};for(G=0;G<P.length;++G)ie(G)}return s.toTensor()},r.prototype.broadcastedBinaryComplexOp=function(e,t,o){var a=Ht(e.shape,t.shape),i=jt(a,"float32"),s=jt(a,"float32"),u=this.readSync(e.dataId),f=this.readSync(t.dataId),E=En(e.shape,a),I=En(t.shape,a),P=i.values,G=s.values;if(E.length+I.length===0)for(var oe=0;oe<P.length;oe++){var ue=oe%u.length,ie=oe%f.length,ce=o(u[2*ue],u[2*ue+1],f[2*ie],f[2*ie+1]);P[oe]=ce.real,G[oe]=ce.imag}else{var ye=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),He=Me.slice(-e.rank);E.forEach(function(Je){return He[Je]=0});var Fe=ye.locToIndex(He),je=Me.slice(-t.rank);I.forEach(function(Je){return je[Je]=0});var Ue=we.locToIndex(je),Ze=o(u[2*Fe],u[2*Fe+1],f[2*Ue],f[2*Ue+1]);P[Se]=Ze.real,G[Se]=Ze.imag};for(oe=0;oe<P.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],E=u[1],I=u[2],P=u[3],G=t.shape[0],oe=a[0],ue=a[1],ie=jt([G,oe,ue,P],"float32"),ce=this.readSync(t.dataId),ye=this.readSync(o.dataId),we=this.readSync(e.dataId),Ee=e.strides,Se=ie.strides,Me=0;Me<G;Me++){var He=4*Me,Fe=ce[He],je=ce[He+1],Ue=ce[He+2],Ze=ce[He+3],Je=ye[Me];if(!(Je>=f))for(var dt=oe>1?(Ue-Fe)*(E-1)/(oe-1):0,ct=ue>1?(Ze-je)*(I-1)/(ue-1):0,st=0;st<oe;st++){var pt=oe>1?Fe*(E-1)+st*dt:.5*(Fe+Ue)*(E-1);if(pt<0||pt>E-1)for(var ht=0;ht<ue;ht++)for(var ut=0;ut<P;ut++){var gt=ut+ht*Se[2]+st*Se[1]+Me*Se[0];ie.values[gt]=s}else if(i==="bilinear"){var yt=Math.floor(pt),Ot=Math.ceil(pt),Mt=pt-yt;for(ht=0;ht<ue;ht++)if((tr=ue>1?je*(I-1)+ht*ct:.5*(je+Ze)*(I-1))<0||tr>I-1)for(ut=0;ut<P;ut++)gt=ut+ht*Se[2]+st*Se[1]+Me*Se[0],ie.values[gt]=s;else{var Pt=Math.floor(tr),Kt=Math.ceil(tr),Yt=tr-Pt;for(ut=0;ut<P;ut++){var $t=we[gt=ut+Pt*Ee[2]+yt*Ee[1]+Je*Ee[0]],ar=we[gt=ut+Kt*Ee[2]+yt*Ee[1]+Je*Ee[0]],er=we[gt=ut+Pt*Ee[2]+Ot*Ee[1]+Je*Ee[0]],ir=$t+(ar-$t)*Yt,Fr=er+(we[gt=ut+Kt*Ee[2]+Ot*Ee[1]+Je*Ee[0]]-er)*Yt;gt=ut+ht*Se[2]+st*Se[1]+Me*Se[0],ie.values[gt]=ir+(Fr-ir)*Mt}}}else for(ht=0;ht<ue;++ht){var tr;if((tr=ue>1?je*(I-1)+ht*ct:.5*(je+Ze)*(I-1))<0||tr>I-1)for(ut=0;ut<P;ut++)gt=ut+ht*Se[2]+st*Se[1]+Me*Se[0],ie.values[gt]=s;else{var Er=Math.round(tr),fr=Math.round(pt);for(ut=0;ut<P;ut++){var jr=ut+Er*Ee[2]+fr*Ee[1]+Je*Ee[0],Mr=ut+ht*Se[2]+st*Se[1]+Me*Se[0];ie.values[Mr]=we[jr]}}}}}return ie.toTensor()},r.prototype.sparseToDense=function(e,t,o,a){var i=Ho(0,e,o),s=i.sliceRank,u=i.numUpdates,f=i.sliceSize,E=i.strides,I=i.outputSize;return this.scatter(e,t,o,I,f,u,s,E,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],E=i[3];if(u===0)return Ur([],s,e.dtype);for(var I=new Dr([u,f],e.dtype),P=this.readSync(t.dataId),G=this.readSync(e.dataId),oe=0;oe<u;oe++){for(var ue=[],ie=0,ce=0;ce<a;ce++){var ye=P[oe*a+ce];ie+=ye*E[ce],ue.push(ye)}if(ie<0||ie>=e.size/f)throw new Error("Invalid indices: "+ue+" does not index into "+e.shape);for(var we=0;we<f;we++)I.values[oe*f+we]=G[ie*f+we]}return I.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,E=a.outputSize,I=It(0);return this.scatter(e,t,o,E,u,s,i,f,I,!0)},r.prototype.fill=function(e,t,o){var a=Ne(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=Ne(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,E,I){var P=[a/i,i],G=this.readSync(e.dataId),oe=this.readSync(t.dataId);if(a===0)return Ur([],o,t.dtype);var ue=new Dr(P,t.dtype);ue.values.fill(this.readSync(E.dataId)[0]);for(var ie=0;ie<s;ie++){for(var ce=[],ye=0,we=0;we<u;we++){var Ee=G[ie*u+we];ce.push(Ee),ye+=Ee*f[we]}if(ye<0||ye>=a/i)throw new Error("Invalid indices: "+ce+" does not index into "+o);for(var Se=0;Se<i;Se++)I?ue.values[ye*i+Se]+=oe[ie*i+Se]:ue.values[ye*i+Se]=t.rank===0?oe[0]:oe[ie*i+Se]}return ue.toTensor().reshape(o)},r}(Ca);Ve.registerBackend("cpu",function(){return new wp},1);for(var Ru=0,Nl=[{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,E=s.scoreThreshold,I=s.softNmsSigma,P=e;ft(a,"NonMaxSuppressionWithScore");var G=di(P.data.get(a.dataId).values,P.data.get(i.dataId).values,u,f,E,I);return[G.selectedIndices,G.selectedScores]}},{kernelName:"Square",backendName:"cpu",kernelFunc:function(n){var r=n.inputs,e=n.backend,t=r.x,o=e;ft(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;ft([o,a],wi);var s=i.data.get(o.dataId).values,u=i.data.get(a.dataId).values,f=function(P,G,oe,ue,ie,ce){var ye=Ht(P,G),we=ye.length,Ee=$e(ye),Se=xe(ie,le(ye)),Me=P.length,He=G.length,Fe=$e(P),je=$e(G),Ue=En(P,ye),Ze=En(G,ye);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 dt=function(ct){var st=bt(ct,we,Ee),pt=st.slice(-Me);Ue.forEach(function(yt){return pt[yt]=0});var ht=lt(pt,Me,Fe),ut=st.slice(-He);Ze.forEach(function(yt){return ut[yt]=0});var gt=lt(ut,He,je);Se[ct]=ce(oe[ht],ue[gt])};for(Je=0;Je<Se.length;++Je)dt(Je)}return[Se,ye]}(o.shape,a.shape,s,u,o.dtype,function(P,G){var oe=P-G;return oe*oe}),E=f[0],I=f[1];return{dataId:i.write(E,I,o.dtype),shape:I,dtype:o.dtype}}}];Ru<Nl.length;Ru++)J(Nl[Ru]);for(var Na,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],E=u[1],I=[E,f],P=[E,f,a];(s||i)&&(Na==null&&(Na=document.createElement("canvas").getContext("2d")),Na.canvas.width=f,Na.canvas.height=E,Na.drawImage(o,0,0,f,E),o=Na.canvas);var G=e.makeTensorInfo(I,"int32");e.texData.get(G.dataId).usage=Wr.PIXELS,e.gpgpu.uploadPixelDataToTexture(e.getTexture(G.dataId),o);var oe=c().getBool("WEBGL_PACK")?new _p(P):new Ep(P),ue=e.runWebGLProgram(oe,[G],"int32");return e.disposeData(G.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,E=s.scoreThreshold,I=s.softNmsSigma,P=e,G=di(P.readSync(a.dataId),P.readSync(i.dataId),u,f,E,I);return[G.selectedIndices,G.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=c().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++)J(kl[Iu]);for(var Du=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=It(2);return{a:function(){return Qo(n,Qo(o,Ao(e,t)))},b:function(){return Qo(n,Qo(o,Ao(t,e)))}}}}];Du<Ml.length;Du++)H(Ml[Du]);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}();c().get("IS_BROWSER")&&c().setPlatform("browser",new Cp);var Nu,Tp=function(){return O(6)},Sp=function(){function n(){this.util=O(7),this.textEncoder=new this.util.TextEncoder}return n.prototype.fetch=function(r,e){return c().global.fetch!=null?c().global.fetch(r,e):(Nu==null&&(Nu=Tp()),Nu(r,e))},n.prototype.now=function(){var r=l.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}();c().get("IS_NODE")&&c().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,E=s.shape,I=le(E),P=void 0;if("quantization"in s){var G=s.quantization;if(G.dtype!=="uint8"&&G.dtype!=="uint16")throw new Error("Weight "+s.name+" has unknown quantization dtype "+G.dtype+". Supported quantization dtypes are: 'uint8' and 'uint16'.");var oe=ku[G.dtype],ue=n.slice(t,t+I*oe),ie=G.dtype==="uint8"?new Uint8Array(ue):new Uint16Array(ue);if(f==="float32")P=Float32Array.from(ie,function(Me){return Me*G.scale+G.min});else{if(f!=="int32")throw new Error("Unsupported dtype in weight '"+u+"': "+f);P=Int32Array.from(ie,function(Me){return Math.round(Me*G.scale+G.min)})}t+=I*oe}else if(f==="string"){var ce=le(s.shape);P=[];for(var ye=0;ye<ce;ye++){var we=new Uint32Array(n.slice(t,t+gs))[0];t+=gs;var Ee=new Uint8Array(n.slice(t,t+we));P.push(Ee),t+=we}}else{var Se=ku[f];if(ue=n.slice(t,t+I*Se),f==="float32")P=new Float32Array(ue);else if(f==="int32")P=new Int32Array(ue);else{if(f!=="bool")throw new Error("Unsupported dtype in weight '"+u+"': "+f);P=new Uint8Array(ue)}t+=I*Se}e[u]=Ur(P,E,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 M!="undefined"&&(typeof Blob=="undefined"||typeof atob=="undefined"||typeof btoa=="undefined");function Ll(n){return Mu?M.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 jl(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:Ll(JSON.stringify(n.modelTopology)),weightSpecsBytes:n.weightSpecs==null?0:Ll(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){w(r!=null,function(){return"scheme must not be undefined or null."}),r.endsWith(ka)&&(r=r.slice(0,r.indexOf(ka))),w(r.length>0,function(){return"scheme must not be an empty string."});var t=n.getInstance();w(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 Fl(n,r,e){return e===void 0&&(e=!1),x(this,void 0,void 0,function(){var t,o,a,i,s,u,f,E,I;return v(this,function(P){switch(P.label){case 0:return w(n!==r,function(){return"Old path and new path are the same: '"+n+"'"}),w((t=pn.getLoadHandlers(n)).length>0,function(){return"Copying failed because no load handler is found for source URL "+n+"."}),w(t.length<2,function(){return"Copying failed because more than one ("+t.length+") load handlers for source URL "+n+"."}),o=t[0],w((a=pn.getSaveHandlers(r)).length>0,function(){return"Copying failed because no save handler is found for destination URL "+r+"."}),w(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 E=P.sent(),e&&f?[4,Oo.getManager(s).removeModel(u)]:[3,3];case 2:P.sent(),P.label=3;case 3:return[4,i.save(E)];case 4:return I=P.sent(),!e||f?[3,6]:[4,Oo.getManager(s).removeModel(u)];case 5:P.sent(),P.label=6;case 6:return[2,I.modelArtifactsInfo]}})})}var Zo="models_store",Ro="model_info_store";function Bl(){if(!c().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 Lu(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 x(this,void 0,void 0,function(){return v(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 x(this,void 0,void 0,function(){return v(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 Lu(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 E,I=Ci(e),P=s.transaction(Ro,"readwrite"),G=P.objectStore(Ro),oe=G.put({modelPath:t.modelPath,modelArtifactsInfo:I});oe.onsuccess=function(){var ue=(E=s.transaction(Zo,"readwrite")).objectStore(Zo).put({modelPath:t.modelPath,modelArtifacts:e,modelArtifactsInfo:I});ue.onsuccess=function(){return o({modelArtifactsInfo:I})},ue.onerror=function(ie){var ce=(G=P.objectStore(Ro)).delete(t.modelPath);ce.onsuccess=function(){return s.close(),a(ue.error)},ce.onerror=function(ye){return s.close(),a(ue.error)}}},oe.onerror=function(ue){return s.close(),a(oe.error)},P.oncomplete=function(){E==null?s.close():E.oncomplete=function(){return s.close()}}}},i.onerror=function(s){return a(i.error)}})},n.URL_SCHEME="indexeddb://",n}(),Ul=function(n){return c().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 x(this,void 0,void 0,function(){var r=this;return v(this,function(e){return[2,new Promise(function(t,o){var a=r.indexedDB.open("tensorflowjs",1);a.onupgradeneeded=function(){return Lu(a)},a.onsuccess=function(){var i=a.result,s=i.transaction(Ro,"readonly"),u=s.objectStore(Ro).getAll();u.onsuccess=function(){for(var f={},E=0,I=u.result;E<I.length;E++){var P=I[E];f[P.modelPath]=P.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 x(this,void 0,void 0,function(){var e=this;return v(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 Lu(s)},s.onsuccess=function(){var u,f=s.result,E=f.transaction(Ro,"readwrite"),I=E.objectStore(Ro),P=I.get(r);P.onsuccess=function(){if(P.result==null)return f.close(),i(new Error("Cannot find model with path '"+r+"' in IndexedDB."));var G=I.delete(r),oe=function(){var ue=(u=f.transaction(Zo,"readwrite")).objectStore(Zo).delete(r);ue.onsuccess=function(){return a(P.result.modelArtifactsInfo)},ue.onerror=function(ie){return i(P.error)}};G.onsuccess=oe,G.onerror=function(ue){return oe(),f.close(),i(P.error)}},P.onerror=function(G){return f.close(),i(P.error)},E.oncomplete=function(){u==null?f.close():u.oncomplete=function(){return f.close()}}},s.onerror=function(u){return i(s.error)}})]})})},n}();if(c().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",Dp="weight_data",Np="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,Dp].join(ao),modelMetadata:[Pa,n,Np].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 La=function(){function n(r){if(!c().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 x(this,void 0,void 0,function(){var e,t,o;return v(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 M.from(i).toString("base64");for(var s=new Uint8Array(i),u="",f=0,E=s.length;f<E;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 x(this,void 0,void 0,function(){var r,e,t,o,a,i,s;return v(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 E=M.from(f,"base64");return E.buffer.slice(E.byteOffset,E.byteOffset+E.byteLength)}for(var I=atob(f),P=new Uint8Array(I.length),G=0;G<I.length;++G)P.set([I.charCodeAt(G)],G);return P.buffer}(s),[2,e]})})},n.URL_SCHEME="localstorage://",n}(),zl=function(n){return c().getBool("IS_BROWSER")&&!Array.isArray(n)&&n.startsWith(La.URL_SCHEME)?(r=n.slice(La.URL_SCHEME.length),new La(r)):null;var r};pn.registerSaveRouter(zl),pn.registerLoadRouter(zl);var Mp=function(){function n(){w(c().getBool("IS_BROWSER"),function(){return"Current environment is not a web browser"}),w(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 x(this,void 0,void 0,function(){var r,e,t,o,a,i;return v(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 x(this,void 0,void 0,function(){var e,t;return v(this,function(o){var a;if(r=(a=r).startsWith(La.URL_SCHEME)?a.slice(La.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(c().getBool("IS_BROWSER"))try{Oo.registerManager(La.URL_SCHEME,new Mp)}catch(n){}var Pp="model",Lp=".json",jp=".weights.bin";function Gl(n){return new Promise(function(r){return setTimeout(r)}).then(n)}var ju=function(){function n(r){if(!c().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+Lp,this.weightDataFileName=r+jp}return n.prototype.save=function(r){return x(this,void 0,void 0,function(){var e,t,o,a,i,s;return v(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}(),Fp=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 x(this,void 0,void 0,function(){var r,e,t=this;return v(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),E=f.modelTopology;if(E!=null){e.length===0&&a({modelTopology:E});var I=f.weightsManifest;if(I!=null){var P;try{P=t.checkManifestAndWeightFiles(I,e)}catch(ie){return void i(ie)}var G=[],oe=[],ue=[];I.forEach(function(ie){ie.paths.forEach(function(ce){oe.push(ce),ue.push(null)}),G.push.apply(G,ie.weights)}),I.forEach(function(ie){ie.paths.forEach(function(ce){var ye=new FileReader;ye.onload=function(we){var Ee=we.target.result,Se=oe.indexOf(ce);ue[Se]=Ee,ue.indexOf(null)===-1&&a({modelTopology:E,weightSpecs:G,weightData:Pu(ue),format:f.format,generatedBy:f.generatedBy,convertedBy:f.convertedBy,userDefinedMetadata:f.userDefinedMetadata})},ye.onerror=function(we){return i("Failed to weights data from file of path '"+ce+"'.")},ye.readAsArrayBuffer(P[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 jl(u.name)}),a={},i=0,s=r;i<s.length;i++)s[i].paths.forEach(function(u){var f=jl(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){w(a!=null&&Array.isArray(a)&&a.length>0,function(){return"promises must be a none empty array"})}(n),function(a,i){w(a>=0&&a<=1,function(){return"Progress fraction must be in range [0, 1], but got startFraction "+a}),w(i>=0&&i<=1,function(){return"Progress fraction must be in range [0, 1], but got endFraction "+i}),w(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 x(this,void 0,void 0,function(){var e,t,o,a,i,s,u,f,E;return v(this,function(I){switch(I.label){case 0:return r==null&&(r={}),e=r.fetchFunc==null?c().platform.fetch:r.fetchFunc,t=n.map(function(P){return e(P,r.requestInit,{isBinary:!0})}),o=0,a=.5,r.onProgress!=null?[3,2]:[4,Promise.all(t)];case 1:return i=I.sent(),[3,4];case 2:return[4,Vl(t,r.onProgress,o,a)];case 3:i=I.sent(),I.label=4;case 4:return s=i.map(function(P){return P.arrayBuffer()}),u=.5,f=1,r.onProgress!=null?[3,6]:[4,Promise.all(s)];case 5:return E=I.sent(),[3,8];case 6:return[4,Vl(s,r.onProgress,u,f)];case 7:E=I.sent(),I.label=8;case 8:return[2,E]}})})}function Kl(n){var r=this;return function(e,t,o){return t===void 0&&(t=""),x(r,void 0,void 0,function(){var a,i,s,u,f,E,I,P,G,oe;return v(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(ie,ce){var ye=0;ie.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:ye,sizeBytes:Se})};o!=null?o.forEach(function(He,Fe){He===we.name&&(Me(),s[Fe]=!0)}):Me(),u.push(we.name),ye+=Se})}),!s.every(function(ie){return ie}))throw f=o.filter(function(ie,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 E=a.reduce(function(ie,ce,ye){return ce&&ie.push(ye),ie},[]),I=[],E.forEach(function(ie){e[ie].paths.forEach(function(ce){var ye=t+(t.endsWith("/")?"":"/")+ce;I.push(ye)})}),[4,n(I)];case 1:return P=ue.sent(),G={},oe=0,E.forEach(function(ie){for(var ce=e[ie].paths.length,ye=0,we=0;we<ce;we++)ye+=P[oe+we].byteLength;for(var Ee=new ArrayBuffer(ye),Se=new Uint8Array(Ee),Me=0,He=0;He<ce;He++){var Fe=new Uint8Array(P[oe+He]);Se.set(Fe,Me),Me+=Fe.byteLength}i[ie].forEach(function(je){var Ue=Pl(Ee.slice(je.groupOffset,je.groupOffset+je.sizeBytes),[je.manifestEntry]);for(var Ze in Ue)G[Ze]=Ue[Ze]}),oe+=ce}),[2,G]}})})}}pn.registerSaveRouter(function(n){return c().getBool("IS_BROWSER")&&!Array.isArray(n)&&n.startsWith(ju.URL_SCHEME)?function(r){return r===void 0&&(r="model"),new ju(r)}(n.slice(ju.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?(w(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=c().platform.fetch,w(r!=null&&r.length>0,function(){return"URL path for http must not be null, undefined or empty."}),Array.isArray(r)&&w(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 x(this,void 0,void 0,function(){var e,t,o,a;return v(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 x(this,void 0,void 0,function(){var r,e,t,o,a,i,s,u,f,E,I,P;return v(this,function(G){switch(G.label){case 0:return[4,this.fetch(this.path,this.requestInit)];case 1:if(!(r=G.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.");G.label=2;case 2:return G.trys.push([2,4,,5]),[4,r.json()];case 3:return e=G.sent(),[3,5];case 4:throw G.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:P=G.sent(),E=P[0],I=P[1],G.label=7;case 7:return[2,{modelTopology:o,weightSpecs:E,weightData:I,userDefinedMetadata:f,generatedBy:i,convertedBy:s,format:u}]}})})},n.prototype.loadWeights=function(r){return x(this,void 0,void 0,function(){var e,t,o,a,i,s,u,f,E,I,P;return v(this,function(G){switch(G.label){case 0:for(e=Array.isArray(this.path)?this.path[1]:this.path,t=function(oe){var ue=oe.lastIndexOf("/"),ie=oe.lastIndexOf("?"),ce=oe.substring(0,ue),ye=ie>ue?oe.substring(ie):"";return[ce+"/",ye]}(e),o=t[0],a=t[1],i=this.weightPathPrefix||o,s=[],u=0,f=r;u<f.length;u++)E=f[u],s.push.apply(s,E.weights);return I=[],r.forEach(function(oe){oe.paths.forEach(function(ue){I.push(i+ue+a)})}),[4,Xl(I,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress})];case 1:return P=G.sent(),[2,[s,Pu(P)]]}})})},n.URL_SCHEME_REGEX=/^https?:\/\//,n}();function Fu(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 Fu(e)}):Fu(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 x(this,void 0,void 0,function(){return v(this,function(r){return[2,this.modelArtifacts]})})},n}(),Bp=function(){function n(r){this.saveHandler=r}return n.prototype.save=function(r){return x(this,void 0,void 0,function(){return v(this,function(e){return[2,this.saveHandler(r)]})})},n}(),Up=Object.freeze({browserFiles:function(n){return new Fp(n)},browserHTTPRequest:function(n,r){return Bu(n,r)},concatenateArrayBuffers:Pu,decodeWeights:Pl,encodeWeights:function(n,r){return x(this,void 0,void 0,function(){var e,t,o,a,i,s=this;return v(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 E=o[f],I=Array.isArray(n)?n[f].tensor:n[E];if(I.dtype!=="float32"&&I.dtype!=="int32"&&I.dtype!=="bool"&&I.dtype!=="string")throw new Error("Unsupported dtype in weight '"+E+"': "+I.dtype);var P={name:E,shape:I.shape,dtype:I.dtype};if(I.dtype==="string"){var G=new Promise(function(oe){return x(s,void 0,void 0,function(){var ue,ie,ce,ye,we,Ee,Se;return v(this,function(Me){switch(Me.label){case 0:return[4,I.bytes()];case 1:for(ue=Me.sent(),ie=ue.reduce(function(He,Fe){return He+Fe.length},0)+gs*ue.length,ce=new Uint8Array(ie),ye=0,we=0;we<ue.length;we++)Ee=ue[we],Se=new Uint8Array(new Uint32Array([Ee.length]).buffer),ce.set(Se,ye),ye+=gs,ce.set(Ee,ye),ye+=Ee.length;return oe(ce),[2]}})})});t.push(G)}else t.push(I.data());r!=null&&(P.group=r),e.push(P)},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:Fu,loadWeights:function(n,r,e,t){return r===void 0&&(r=""),x(this,void 0,void 0,function(){return v(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 x(this,void 0,void 0,function(){return v(this,function(e){return[2,Fl(n,r,!1)]})})},listModels:function(){return x(this,void 0,void 0,function(){var n,r,e,t,o,a,i;return v(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 x(this,void 0,void 0,function(){return v(this,function(e){return[2,Fl(n,r,!0)]})})},removeModel:function(n){return x(this,void 0,void 0,function(){var r;return v(this,function(e){return r=ys(n),[2,Oo.getManager(r.scheme).removeModel(r.path)]})})}}),ja,Wp=Ke({confusionMatrix_:function(n,r,e){var t=Oe(n,"labels","confusionMatrix"),o=Oe(r,"predictions","confusionMatrix");w(e==null||e>0&&Number.isInteger(e),function(){return"If provided, numClasses must be a positive integer, but got "+e}),w(t.rank===1,function(){return"Expected the rank of labels to be 1, but got "+t.rank}),w(o.rank===1,function(){return"Expected the rank of predictions to be 1, but got "+o.rank}),w(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."}),w(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=Ke({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(T("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],E=f[0],I=f[1];if(i?s=n.getContext("2d").getImageData(0,0,E,I).data:t||e?s=n.data:(a||o)&&(ja==null&&(ja=document.createElement("canvas").getContext("2d")),ja.canvas.width=E,ja.canvas.height=I,ja.drawImage(n,0,0,E,I),s=ja.getImageData(0,0,E,I).data),r===4)u=new Int32Array(s);else{var P=E*I;u=new Int32Array(P*r);for(var G=0;G<P;G++)for(var oe=0;oe<r;++oe)u[G*r+oe]=s[4*G+oe]}return Za(u,[I,E,r],"int32")}}),zp=Object.freeze({toPixels:function(n,r){return x(this,void 0,void 0,function(){var e,t,o,a,i,s,u,f,E,I,P,G,oe,ue,ie,ce,ye,we,Ee,Se,Me,He,Fe;return v(this,function(je){switch(je.label){case 0:if(e=Oe(n,"img","toPixels"),n instanceof Nr||(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(E=je.sent(),I=E[0],P=E[1],G=I[0],oe=P[0],u.dispose(),f.dispose(),e.dtype==="float32"){if(G<0||oe>1)throw new Error("Tensor values for a float32 Tensor must be in the range [0 - 1] but got range ["+G+" - "+oe+"].")}else{if(e.dtype!=="int32")throw new Error("Unsupported type for toPixels: "+e.dtype+". Please use float32 or int32 tensors.");if(G<0||oe>255)throw new Error("Tensor values for a int32 Tensor must be in the range [0 - 255] but got range ["+G+" - "+oe+"].")}for(ue=e.dtype==="float32"?255:1,ie=new Uint8ClampedArray(a*o*4),ce=0;ce<o*a;++ce)ye=void 0,we=void 0,Ee=void 0,Se=void 0,i===1?(ye=s[ce]*ue,we=s[ce]*ue,Ee=s[ce]*ue,Se=255):i===3?(ye=s[3*ce]*ue,we=s[3*ce+1]*ue,Ee=s[3*ce+2]*ue,Se=255):i===4&&(ye=s[4*ce]*ue,we=s[4*ce+1]*ue,Ee=s[4*ce+2]*ue,Se=s[4*ce+3]*ue),ie[(Me=4*ce)+0]=Math.round(ye),ie[Me+1]=Math.round(we),ie[Me+2]=Math.round(Ee),ie[Me+3]=Math.round(Se);return r!=null&&(r.width=a,r.height=o,He=r.getContext("2d"),Fe=new ImageData(ie,a,o),He.putImageData(Fe,0,0)),e!==n&&e.dispose(),[2,ie]}})})},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){w(n.className!=null,function(){return"Class being registered does not have the static className property defined."}),w(typeof n.className=="string",function(){return"className is required to be a string, but got type "+typeof n.className}),w(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((Te(n)||Te(r))&&(t=!1),Te(n)&&Te(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=Te(n)?n:he(n),f=Te(r)?r:he(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 E=0;E<f.length;++E){var I=u[E],P=f[E];if(!e(I,P))throw new Error("Arrays differ: actual["+E+"] = "+I+", expected["+E+"] = "+P+`.
|
|
|
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 Pe(n)||Pe(n[0])||Pe(r)||Pe(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(){c().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 A(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 x(this,void 0,void 0,function(){return v(this,function(e){return this.iterations_==null&&(this.iterations_=0),[2,{name:"iter",tensor:It(this.iterations_,"int32")}]})})},r.prototype.getWeights=function(){return x(this,void 0,void 0,function(){return v(this,function(e){throw new Error("getWeights() is not implemented for this optimizer yet.")})})},r.prototype.setWeights=function(e){return x(this,void 0,void 0,function(){return v(this,function(t){throw new Error("setWeights() is not implemented for this optimizer class "+this.getClassName())})})},r.prototype.extractIterations=function(e){return x(this,void 0,void 0,function(){var t;return v(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 A(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 E=u.mul(t.rho).add(s.square().mul(1-t.rho)),I=f.add(t.epsilon).sqrt().div(u.add(t.epsilon).sqrt()).mul(s),P=f.mul(t.rho).add(I.square().mul(1-t.rho));u.assign(E),f.assign(P);var G=I.mul(-t.learningRate).add(i);i.assign(G)})}}),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 x(this,void 0,void 0,function(){var e;return v(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 x(this,void 0,void 0,function(){var t;return v(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 A(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 E=s.div(f.add(Ve.backend.epsilon()).sqrt()).mul(-t.learningRate).add(i);i.assign(E)})}}),this.incrementIterations()},r.prototype.dispose=function(){this.accumulatedGrads!=null&&qr(this.accumulatedGrads.map(function(e){return e.variable}))},r.prototype.getWeights=function(){return x(this,void 0,void 0,function(){return v(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 x(this,void 0,void 0,function(){return v(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=It(t).variable(),i.accBeta2=It(o).variable()}),a==null&&(i.epsilon=Ve.backend.epsilon()),i}return A(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 E=Array.isArray(e)?e[u].tensor:e[s];if(E!=null){var I=t.accumulatedFirstMoment[u].variable,P=t.accumulatedSecondMoment[u].variable,G=I.mul(t.beta1).add(E.mul(1-t.beta1)),oe=P.mul(t.beta2).add(E.square().mul(1-t.beta2)),ue=G.div(a),ie=oe.div(i);I.assign(G),P.assign(oe);var ce=ue.div(ie.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 x(this,void 0,void 0,function(){var e;return v(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 x(this,void 0,void 0,function(){var t,o=this;return v(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=It(0).variable(),s.accBeta1=It(t).variable()}),a==null&&(s.epsilon=Ve.backend.epsilon()),s}return A(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 E=Array.isArray(e)?e[u].tensor:e[s];if(E!=null){var I=t.accumulatedFirstMoment[u].variable,P=t.accumulatedWeightedInfNorm[u].variable,G=I.mul(t.beta1).add(E.mul(1-t.beta1)),oe=P.mul(t.beta2),ue=E.abs(),ie=oe.maximum(ue);I.assign(G),P.assign(ie);var ce=i.div(a).mul(G.div(ie.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 x(this,void 0,void 0,function(){return v(this,function(e){throw new Error("getWeights() is not implemented for Adamax yet.")})})},r.prototype.setWeights=function(e){return x(this,void 0,void 0,function(){return v(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 A(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(It(-e))},r.prototype.dispose=function(){this.c.dispose()},r.prototype.getWeights=function(){return x(this,void 0,void 0,function(){return v(this,function(e){switch(e.label){case 0:return[4,this.saveIterations()];case 1:return[2,[e.sent()]]}})})},r.prototype.setWeights=function(e){return x(this,void 0,void 0,function(){return v(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=It(a.momentum),a}return A(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,E=t.m.mul(s).add(u);f=t.useNesterov?t.c.mul(u.add(E.mul(t.m))).add(i):t.c.mul(E).add(i),s.assign(E),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 x(this,void 0,void 0,function(){return v(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 x(this,void 0,void 0,function(){return v(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 A(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 E=u.mul(t.decay).add(s.square().mul(1-t.decay));if(t.centered){var I=t.accumulatedMeanGrads[a].variable,P=I.mul(t.decay).add(s.mul(1-t.decay)),G=f.mul(t.momentum).add(s.mul(t.learningRate).div(E.sub(P.square().add(t.epsilon)).sqrt()));u.assign(E),I.assign(P),f.assign(G);var oe=i.sub(G);i.assign(oe)}else{var ue=u.mul(t.decay).add(s.square().mul(1-t.decay));G=f.mul(t.momentum).add(s.mul(t.learningRate).div(ue.add(t.epsilon).sqrt())),u.assign(ue),f.assign(G),oe=i.sub(G),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 x(this,void 0,void 0,function(){var e;return v(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 x(this,void 0,void 0,function(){var t;return v(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()})})}Nr.prototype.squaredDifference=function(n){return zc(this,n)},et=xp}).call(this,O("IyRk"),O("Q2Ig"),O("HDXh").Buffer)},S6kV:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("OLod"))})(this,function(y){return y.mode.OFB=function(){var l=y.lib.BlockCipherMode.extend(),M=l.Encryptor=l.extend({processBlock:function(D,A){var x=this._cipher,v=x.blockSize,h=this._iv,p=this._keystream;h&&(p=this._keystream=h.slice(0),this._iv=void 0),x.encryptBlock(p,0);for(var c=0;c<v;c++)D[A+c]^=p[c]}});return l.Decryptor=M,l}(),y.mode.OFB})},WYAk:function(d,V,O){(function(y,l){d.exports=V=l(O("Ib8C"))})(this,function(y){(function(){var l=y,M=l.lib,D=M.Base,A=l.enc,x=A.Utf8,v=l.algo,h=v.HMAC=D.extend({init:function(p,c){p=this._hasher=new p.init,typeof c=="string"&&(c=x.parse(c));var m=p.blockSize,C=m*4;c.sigBytes>C&&(c=p.finalize(c)),c.clamp();for(var g=this._oKey=c.clone(),T=this._iKey=c.clone(),B=g.words,F=T.words,J=0;J<m;J++)B[J]^=1549556828,F[J]^=909522486;g.sigBytes=T.sigBytes=C,this.reset()},reset:function(){var p=this._hasher;p.reset(),p.update(this._iKey)},update:function(p){return this._hasher.update(p),this},finalize:function(p){var c=this._hasher,m=c.finalize(p);c.reset();var C=c.finalize(this._oKey.clone().concat(m));return C}})})()})},aRTE:function(d,V){d.exports={L:1,M:0,Q:3,H:2}},bQjk:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("OLod"))})(this,function(y){return function(l){var M=y,D=M.lib,A=D.CipherParams,x=M.enc,v=x.Hex,h=M.format,p=h.Hex={stringify:function(c){return c.ciphertext.toString(v)},parse:function(c){var m=v.parse(c);return A.create({ciphertext:m})}}}(),y.format.Hex})},cv67:function(d,V,O){(function(y,l){d.exports=V=l(O("Ib8C"))})(this,function(y){return function(l){var M=y,D=M.lib,A=D.WordArray,x=D.Hasher,v=M.algo,h=[];(function(){for(var T=0;T<64;T++)h[T]=l.abs(l.sin(T+1))*4294967296|0})();var p=v.MD5=x.extend({_doReset:function(){this._hash=new A.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(T,B){for(var F=0;F<16;F++){var J=B+F,H=T[J];T[J]=(H<<8|H>>>24)&16711935|(H<<24|H>>>8)&4278255360}var K=this._hash.words,Y=T[B+0],W=T[B+1],U=T[B+2],_=T[B+3],te=T[B+4],q=T[B+5],w=T[B+6],X=T[B+7],ne=T[B+8],he=T[B+9],le=T[B+10],_e=T[B+11],se=T[B+12],be=T[B+13],j=T[B+14],Q=T[B+15],L=K[0],re=K[1],de=K[2],ee=K[3];L=c(L,re,de,ee,Y,7,h[0]),ee=c(ee,L,re,de,W,12,h[1]),de=c(de,ee,L,re,U,17,h[2]),re=c(re,de,ee,L,_,22,h[3]),L=c(L,re,de,ee,te,7,h[4]),ee=c(ee,L,re,de,q,12,h[5]),de=c(de,ee,L,re,w,17,h[6]),re=c(re,de,ee,L,X,22,h[7]),L=c(L,re,de,ee,ne,7,h[8]),ee=c(ee,L,re,de,he,12,h[9]),de=c(de,ee,L,re,le,17,h[10]),re=c(re,de,ee,L,_e,22,h[11]),L=c(L,re,de,ee,se,7,h[12]),ee=c(ee,L,re,de,be,12,h[13]),de=c(de,ee,L,re,j,17,h[14]),re=c(re,de,ee,L,Q,22,h[15]),L=m(L,re,de,ee,W,5,h[16]),ee=m(ee,L,re,de,w,9,h[17]),de=m(de,ee,L,re,_e,14,h[18]),re=m(re,de,ee,L,Y,20,h[19]),L=m(L,re,de,ee,q,5,h[20]),ee=m(ee,L,re,de,le,9,h[21]),de=m(de,ee,L,re,Q,14,h[22]),re=m(re,de,ee,L,te,20,h[23]),L=m(L,re,de,ee,he,5,h[24]),ee=m(ee,L,re,de,j,9,h[25]),de=m(de,ee,L,re,_,14,h[26]),re=m(re,de,ee,L,ne,20,h[27]),L=m(L,re,de,ee,be,5,h[28]),ee=m(ee,L,re,de,U,9,h[29]),de=m(de,ee,L,re,X,14,h[30]),re=m(re,de,ee,L,se,20,h[31]),L=C(L,re,de,ee,q,4,h[32]),ee=C(ee,L,re,de,ne,11,h[33]),de=C(de,ee,L,re,_e,16,h[34]),re=C(re,de,ee,L,j,23,h[35]),L=C(L,re,de,ee,W,4,h[36]),ee=C(ee,L,re,de,te,11,h[37]),de=C(de,ee,L,re,X,16,h[38]),re=C(re,de,ee,L,le,23,h[39]),L=C(L,re,de,ee,be,4,h[40]),ee=C(ee,L,re,de,Y,11,h[41]),de=C(de,ee,L,re,_,16,h[42]),re=C(re,de,ee,L,w,23,h[43]),L=C(L,re,de,ee,he,4,h[44]),ee=C(ee,L,re,de,se,11,h[45]),de=C(de,ee,L,re,Q,16,h[46]),re=C(re,de,ee,L,U,23,h[47]),L=g(L,re,de,ee,Y,6,h[48]),ee=g(ee,L,re,de,X,10,h[49]),de=g(de,ee,L,re,j,15,h[50]),re=g(re,de,ee,L,q,21,h[51]),L=g(L,re,de,ee,se,6,h[52]),ee=g(ee,L,re,de,_,10,h[53]),de=g(de,ee,L,re,le,15,h[54]),re=g(re,de,ee,L,W,21,h[55]),L=g(L,re,de,ee,ne,6,h[56]),ee=g(ee,L,re,de,Q,10,h[57]),de=g(de,ee,L,re,w,15,h[58]),re=g(re,de,ee,L,be,21,h[59]),L=g(L,re,de,ee,te,6,h[60]),ee=g(ee,L,re,de,_e,10,h[61]),de=g(de,ee,L,re,U,15,h[62]),re=g(re,de,ee,L,he,21,h[63]),K[0]=K[0]+L|0,K[1]=K[1]+re|0,K[2]=K[2]+de|0,K[3]=K[3]+ee|0},_doFinalize:function(){var T=this._data,B=T.words,F=this._nDataBytes*8,J=T.sigBytes*8;B[J>>>5]|=128<<24-J%32;var H=l.floor(F/4294967296),K=F;B[(J+64>>>9<<4)+15]=(H<<8|H>>>24)&16711935|(H<<24|H>>>8)&4278255360,B[(J+64>>>9<<4)+14]=(K<<8|K>>>24)&16711935|(K<<24|K>>>8)&4278255360,T.sigBytes=(B.length+1)*4,this._process();for(var Y=this._hash,W=Y.words,U=0;U<4;U++){var _=W[U];W[U]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360}return Y},clone:function(){var T=x.clone.call(this);return T._hash=this._hash.clone(),T}});function c(T,B,F,J,H,K,Y){var W=T+(B&F|~B&J)+H+Y;return(W<<K|W>>>32-K)+B}function m(T,B,F,J,H,K,Y){var W=T+(B&J|F&~J)+H+Y;return(W<<K|W>>>32-K)+B}function C(T,B,F,J,H,K,Y){var W=T+(B^F^J)+H+Y;return(W<<K|W>>>32-K)+B}function g(T,B,F,J,H,K,Y){var W=T+(F^(B|~J))+H+Y;return(W<<K|W>>>32-K)+B}M.MD5=x._createHelper(p),M.HmacMD5=x._createHmacHelper(p)}(Math),y.MD5})},dQei:function(d,V){for(var O={glog:function(l){if(l<1)throw new Error("glog("+l+")");return O.LOG_TABLE[l]},gexp:function(l){for(;l<0;)l+=255;for(;l>=256;)l-=255;return O.EXP_TABLE[l]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},y=0;y<8;y++)O.EXP_TABLE[y]=1<<y;for(var y=8;y<256;y++)O.EXP_TABLE[y]=O.EXP_TABLE[y-4]^O.EXP_TABLE[y-5]^O.EXP_TABLE[y-6]^O.EXP_TABLE[y-8];for(var y=0;y<255;y++)O.LOG_TABLE[O.EXP_TABLE[y]]=y;d.exports=O},dWSS:function(d,V,O){var y=O("dQei");function l(M,D){if(M.length==null)throw new Error(M.length+"/"+D);for(var A=0;A<M.length&&M[A]==0;)A++;this.num=new Array(M.length-A+D);for(var x=0;x<M.length-A;x++)this.num[x]=M[x+A]}l.prototype={get:function(M){return this.num[M]},getLength:function(){return this.num.length},multiply:function(M){for(var D=new Array(this.getLength()+M.getLength()-1),A=0;A<this.getLength();A++)for(var x=0;x<M.getLength();x++)D[A+x]^=y.gexp(y.glog(this.get(A))+y.glog(M.get(x)));return new l(D,0)},mod:function(M){if(this.getLength()-M.getLength()<0)return this;for(var D=y.glog(this.get(0))-y.glog(M.get(0)),A=new Array(this.getLength()),x=0;x<this.getLength();x++)A[x]=this.get(x);for(var x=0;x<M.getLength();x++)A[x]^=y.gexp(y.glog(M.get(x))+D);return new l(A,0).mod(M)}},d.exports=l},e7zE:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("3y9D"),O("WYAk"))})(this,function(y){return function(){var l=y,M=l.lib,D=M.Base,A=M.WordArray,x=l.algo,v=x.SHA1,h=x.HMAC,p=x.PBKDF2=D.extend({cfg:D.extend({keySize:128/32,hasher:v,iterations:1}),init:function(c){this.cfg=this.cfg.extend(c)},compute:function(c,m){for(var C=this.cfg,g=h.create(C.hasher,c),T=A.create(),B=A.create([1]),F=T.words,J=B.words,H=C.keySize,K=C.iterations;F.length<H;){var Y=g.update(m).finalize(B);g.reset();for(var W=Y.words,U=W.length,_=Y,te=1;te<K;te++){_=g.finalize(_),g.reset();for(var q=_.words,w=0;w<U;w++)W[w]^=q[w]}T.concat(Y),J[0]++}return T.sigBytes=H*4,T}});l.PBKDF2=function(c,m,C){return p.create(C).compute(c,m)}}(),y.PBKDF2})},f4xo:function(d,V,O){var y=O("nVVt");function l(M){this.mode=y.MODE_8BIT_BYTE,this.data=M}l.prototype={getLength:function(M){return this.data.length},write:function(M){for(var D=0;D<this.data.length;D++)M.put(this.data.charCodeAt(D),8)}},d.exports=l},"gb/T":function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("OLod"))})(this,function(y){return y.mode.ECB=function(){var l=y.lib.BlockCipherMode.extend();return l.Encryptor=l.extend({processBlock:function(M,D){this._cipher.encryptBlock(M,D)}}),l.Decryptor=l.extend({processBlock:function(M,D){this._cipher.decryptBlock(M,D)}}),l}(),y.mode.ECB})},gctT:function(d,V,O){"use strict";O.r(V);var y={};O.r(y),O.d(y,"drawContour",function(){return Q}),O.d(y,"drawDetections",function(){return Ve}),O.d(y,"drawFaceExpressions",function(){return Ii}),O.d(y,"DrawBoxOptions",function(){return Wa}),O.d(y,"DrawBox",function(){return Si}),O.d(y,"DrawFaceLandmarksOptions",function(){return Jr}),O.d(y,"DrawFaceLandmarks",function(){return la}),O.d(y,"drawFaceLandmarks",function(){return Di}),O.d(y,"AnchorPosition",function(){return cn}),O.d(y,"DrawTextFieldOptions",function(){return ko}),O.d(y,"DrawTextField",function(){return Ti});var l=O("2qtc"),M=O("kLXV"),D=O("14J3"),A=O("BMrR"),x=O("jCWc"),v=O("kPKH"),h=O("+L6B"),p=O("2/Rp"),c=O("miYZ"),m=O("tsqr"),C=O("k1fw"),g=O("9og8"),T=O("tJVT"),B=O("PpiC"),F=O("FJo9"),J=O("L41K"),H=O("aHsQ"),K=O("sGsY"),Y=O("WmNS"),W=O.n(Y),U=O("q1tI"),_=O.n(U),te=O("Ty5D"),q=O("9kvl"),w=O("yPBj"),X=O.n(w),ne=O("1vsH"),he=O("V0Rq"),le=O("D1Df"),_e=O.n(le),se=O("T2oS"),be=O("W9HT"),j=O("Re/O");function Q(R,b,S){if(S===void 0&&(S=!1),R.beginPath(),b.slice(1).forEach(function(ae,me){var fe=ae.x,Ce=ae.y,Ie=b[me];R.moveTo(Ie.x,Ie.y),R.lineTo(fe,Ce)}),S){var N=b[b.length-1],z=b[0];if(!N||!z)return;R.moveTo(N.x,N.y),R.lineTo(z.x,z.y)}R.stroke()}var L=O("mrSG"),re=function(){function R(b,S){if(!Be(b)||!Be(S))throw new Error("Dimensions.constructor - expected width and height to be valid numbers, instead have "+JSON.stringify({width:b,height:S}));this._width=b,this._height=S}return Object.defineProperty(R.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),R.prototype.reverse=function(){return new R(1/this.width,1/this.height)},R}();function de(R,b){return R instanceof j.a&&R.shape.length===b}function ee(R){return de(R,1)}function xe(R){return de(R,2)}function Ne(R){return de(R,3)}function Le(R){return de(R,4)}function Ge(R){return R%1!==0}function Qe(R){return R%2===0}function Te(R,b){b===void 0&&(b=2);var S=Math.pow(10,b);return Math.floor(R*S)/S}function nt(R){return R&&R.width&&R.height}function Ye(R,b){var S=R.width,N=R.height,z=b/Math.max(N,S);return new re(Math.round(S*z),Math.round(N*z))}function Pe(R){return R.reduce(function(b,S){return b.add(S)},new ve(0,0)).div(new ve(R.length,R.length))}function ke(R,b,S){return Array(R).fill(0).map(function(N,z){return b+z*S})}function Be(R){return!!R&&R!==Infinity&&R!==-Infinity&&!isNaN(R)||R===0}function ot(R){return Be(R)&&0<=R&&R<=1}var ve=function(){function R(b,S){this._x=b,this._y=S}return Object.defineProperty(R.prototype,"x",{get:function(){return this._x},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"y",{get:function(){return this._y},enumerable:!0,configurable:!0}),R.prototype.add=function(b){return new R(this.x+b.x,this.y+b.y)},R.prototype.sub=function(b){return new R(this.x-b.x,this.y-b.y)},R.prototype.mul=function(b){return new R(this.x*b.x,this.y*b.y)},R.prototype.div=function(b){return new R(this.x/b.x,this.y/b.y)},R.prototype.abs=function(){return new R(Math.abs(this.x),Math.abs(this.y))},R.prototype.magnitude=function(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))},R.prototype.floor=function(){return new R(Math.floor(this.x),Math.floor(this.y))},R}(),ge=function(){function R(b,S){S===void 0&&(S=!0);var N=b||{},z=[N.left,N.top,N.right,N.bottom].every(Be),ae=[N.x,N.y,N.width,N.height].every(Be);if(!ae&&!z)throw new Error("Box.constructor - expected box to be IBoundingBox | IRect, instead have "+JSON.stringify(N));var me=ae?[N.x,N.y,N.width,N.height]:[N.left,N.top,N.right-N.left,N.bottom-N.top],fe=me[0],Ce=me[1],Ie=me[2],De=me[3];R.assertIsValidBox({x:fe,y:Ce,width:Ie,height:De},"Box.constructor",S),this._x=fe,this._y=Ce,this._width=Ie,this._height=De}return R.isRect=function(b){return!!b&&[b.x,b.y,b.width,b.height].every(Be)},R.assertIsValidBox=function(b,S,N){if(N===void 0&&(N=!1),!R.isRect(b))throw new Error(S+" - invalid box: "+JSON.stringify(b)+", expected object with properties x, y, width, height");if(!N&&(b.width<0||b.height<0))throw new Error(S+" - width ("+b.width+") and height ("+b.height+") must be positive numbers")},Object.defineProperty(R.prototype,"x",{get:function(){return this._x},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"y",{get:function(){return this._y},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"left",{get:function(){return this.x},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"top",{get:function(){return this.y},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"right",{get:function(){return this.x+this.width},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"area",{get:function(){return this.width*this.height},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"topLeft",{get:function(){return new ve(this.left,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"topRight",{get:function(){return new ve(this.right,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"bottomLeft",{get:function(){return new ve(this.left,this.bottom)},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"bottomRight",{get:function(){return new ve(this.right,this.bottom)},enumerable:!0,configurable:!0}),R.prototype.round=function(){var b=[this.x,this.y,this.width,this.height].map(function(me){return Math.round(me)}),S=b[0],N=b[1],z=b[2],ae=b[3];return new R({x:S,y:N,width:z,height:ae})},R.prototype.floor=function(){var b=[this.x,this.y,this.width,this.height].map(function(me){return Math.floor(me)}),S=b[0],N=b[1],z=b[2],ae=b[3];return new R({x:S,y:N,width:z,height:ae})},R.prototype.toSquare=function(){var b=this,S=b.x,N=b.y,z=b.width,ae=b.height,me=Math.abs(z-ae);return z<ae&&(S-=me/2,z+=me),ae<z&&(N-=me/2,ae+=me),new R({x:S,y:N,width:z,height:ae})},R.prototype.rescale=function(b){var S=nt(b)?b.width:b,N=nt(b)?b.height:b;return new R({x:this.x*S,y:this.y*N,width:this.width*S,height:this.height*N})},R.prototype.pad=function(b,S){var N=[this.x-b/2,this.y-S/2,this.width+b,this.height+S],z=N[0],ae=N[1],me=N[2],fe=N[3];return new R({x:z,y:ae,width:me,height:fe})},R.prototype.clipAtImageBorders=function(b,S){var N=this,z=N.x,ae=N.y,me=N.right,fe=N.bottom,Ce=Math.max(z,0),Ie=Math.max(ae,0),De=me-Ce,We=fe-Ie,ze=Math.min(De,b-Ce),qe=Math.min(We,S-Ie);return new R({x:Ce,y:Ie,width:ze,height:qe}).floor()},R.prototype.shift=function(b,S){var N=this,z=N.width,ae=N.height,me=this.x+b,fe=this.y+S;return new R({x:me,y:fe,width:z,height:ae})},R.prototype.padAtBorders=function(b,S){var N=this.width+1,z=this.height+1,ae=1,me=1,fe=N,Ce=z,Ie=this.left,De=this.top,We=this.right,ze=this.bottom;return We>S&&(fe=-We+S+N,We=S),ze>b&&(Ce=-ze+b+z,ze=b),Ie<1&&(Ce=2-Ie,Ie=1),De<1&&(Ce=2-De,De=1),{dy:me,edy:Ce,dx:ae,edx:fe,y:De,ey:ze,x:Ie,ex:We,w:N,h:z}},R.prototype.calibrate=function(b){return new R({left:this.left+b.left*this.width,top:this.top+b.top*this.height,right:this.right+b.right*this.width,bottom:this.bottom+b.bottom*this.height}).toSquare().round()},R}(),$e=function(R){Object(L.c)(b,R);function b(S,N,z,ae,me){return me===void 0&&(me=!1),R.call(this,{left:S,top:N,right:z,bottom:ae},me)||this}return b}(ge),pe=function(){function R(b,S,N,z,ae){this._imageDims=new re(ae.width,ae.height),this._score=b,this._classScore=S,this._className=N,this._box=new ge(z).rescale(this._imageDims)}return Object.defineProperty(R.prototype,"score",{get:function(){return this._score},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"classScore",{get:function(){return this._classScore},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"className",{get:function(){return this._className},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"box",{get:function(){return this._box},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"imageDims",{get:function(){return this._imageDims},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"imageWidth",{get:function(){return this.imageDims.width},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"imageHeight",{get:function(){return this.imageDims.height},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"relativeBox",{get:function(){return new ge(this._box).rescale(this.imageDims.reverse())},enumerable:!0,configurable:!0}),R.prototype.forSize=function(b,S){return new R(this.score,this.classScore,this.className,this.relativeBox,{width:b,height:S})},R}(),Z=function(R){Object(L.c)(b,R);function b(S,N,z){return R.call(this,S,S,"",N,z)||this}return b.prototype.forSize=function(S,N){var z=R.prototype.forSize.call(this,S,N),ae=z.score,me=z.relativeBox,fe=z.imageDims;return new b(ae,me,fe)},b}(pe);function k(R,b,S){S===void 0&&(S=!0);var N=Math.max(0,Math.min(R.right,b.right)-Math.max(R.left,b.left)),z=Math.max(0,Math.min(R.bottom,b.bottom)-Math.max(R.top,b.top)),ae=N*z;return S?ae/(R.area+b.area-ae):ae/Math.min(R.area,b.area)}function $(R){var b=R.map(function(fe){return fe.x}),S=R.map(function(fe){return fe.y}),N=b.reduce(function(fe,Ce){return Ce<fe?Ce:fe},Infinity),z=S.reduce(function(fe,Ce){return Ce<fe?Ce:fe},Infinity),ae=b.reduce(function(fe,Ce){return fe<Ce?Ce:fe},0),me=S.reduce(function(fe,Ce){return fe<Ce?Ce:fe},0);return new $e(N,z,ae,me)}function Re(R,b,S,N){N===void 0&&(N=!0);for(var z=b.map(function(fe,Ce){return{score:fe,boxIndex:Ce}}).sort(function(fe,Ce){return fe.score-Ce.score}).map(function(fe){return fe.boxIndex}),ae=[],me=function(){var fe=z.pop();ae.push(fe);for(var Ce=z,Ie=[],De=0;De<Ce.length;De++){var We=Ce[De],ze=R[fe],qe=R[We];Ie.push(k(ze,qe,N))}z=z.filter(function(it,vt){return Ie[vt]<=S})};z.length>0;)me();return ae}function Ae(R,b){return j.L(function(){var S=b[0],N=b[1],z=b[2],ae=j.n(Object(L.e)(R.shape.slice(0,3),[1]),S),me=j.n(Object(L.e)(R.shape.slice(0,3),[1]),N),fe=j.n(Object(L.e)(R.shape.slice(0,3),[1]),z),Ce=j.h([ae,me,fe],3);return j.F(R,Ce)})}function Xe(R,b){return b===void 0&&(b=!1),j.L(function(){var S=R.shape.slice(1),N=S[0],z=S[1];if(N===z)return R;var ae=Math.abs(N-z),me=Math.round(ae*(b?.5:1)),fe=N>z?2:1,Ce=function(qe){var it=R.shape.slice();return it[fe]=qe,j.n(it,0)},Ie=Ce(me),De=ae-Ie.shape[fe],We=b&&De?Ce(De):null,ze=[We,R,Ie].filter(function(qe){return!!qe}).map(function(qe){return qe.toFloat()});return j.h(ze,fe)})}function rt(R){for(var b=R.slice(),S=b.length-1;S>0;S--){var N=Math.floor(Math.random()*(S+1)),z=b[S];b[S]=b[N],b[N]=z}return b}function lt(R){return 1/(1+Math.exp(-R))}function bt(R){return Math.log(R/(1-R))}var Tt=function(R){Object(L.c)(b,R);function b(S,N,z,ae,me){return me===void 0&&(me=!1),R.call(this,{x:S,y:N,width:z,height:ae},me)||this}return b}(ge),xt=.5,Et=.43,Nt=.45,at=function(){function R(b,S,N){N===void 0&&(N=new ve(0,0));var z=S.width,ae=S.height;this._imgDims=new re(z,ae),this._shift=N,this._positions=b.map(function(me){return me.mul(new ve(z,ae)).add(N)})}return Object.defineProperty(R.prototype,"shift",{get:function(){return new ve(this._shift.x,this._shift.y)},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"imageWidth",{get:function(){return this._imgDims.width},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"imageHeight",{get:function(){return this._imgDims.height},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"positions",{get:function(){return this._positions},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"relativePositions",{get:function(){var b=this;return this._positions.map(function(S){return S.sub(b._shift).div(new ve(b.imageWidth,b.imageHeight))})},enumerable:!0,configurable:!0}),R.prototype.forSize=function(b,S){return new this.constructor(this.relativePositions,{width:b,height:S})},R.prototype.shiftBy=function(b,S){return new this.constructor(this.relativePositions,this._imgDims,new ve(b,S))},R.prototype.shiftByPoint=function(b){return this.shiftBy(b.x,b.y)},R.prototype.align=function(b,S){if(S===void 0&&(S={}),b){var N=b instanceof Z?b.box.floor():new ge(b);return this.shiftBy(N.x,N.y).align(null,S)}var z=Object.assign({},{useDlibAlignment:!1,minBoxPadding:.2},S),ae=z.useDlibAlignment,me=z.minBoxPadding;return ae?this.alignDlib():this.alignMinBbox(me)},R.prototype.alignDlib=function(){var b=this.getRefPointsForAlignment(),S=b[0],N=b[1],z=b[2],ae=function(We){return z.sub(We).magnitude()},me=(ae(S)+ae(N))/2,fe=Math.floor(me/Nt),Ce=Pe(b),Ie=Math.floor(Math.max(0,Ce.x-xt*fe)),De=Math.floor(Math.max(0,Ce.y-Et*fe));return new Tt(Ie,De,Math.min(fe,this.imageWidth+Ie),Math.min(fe,this.imageHeight+De))},R.prototype.alignMinBbox=function(b){var S=$(this.positions);return S.pad(S.width*b,S.height*b)},R.prototype.getRefPointsForAlignment=function(){throw new Error("getRefPointsForAlignment not implemented by base class")},R}(),Bt=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b.prototype.getRefPointsForAlignment=function(){var S=this.positions;return[S[0],S[1],Pe([S[3],S[4]])]},b}(at),mr=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b.prototype.getJawOutline=function(){return this.positions.slice(0,17)},b.prototype.getLeftEyeBrow=function(){return this.positions.slice(17,22)},b.prototype.getRightEyeBrow=function(){return this.positions.slice(22,27)},b.prototype.getNose=function(){return this.positions.slice(27,36)},b.prototype.getLeftEye=function(){return this.positions.slice(36,42)},b.prototype.getRightEye=function(){return this.positions.slice(42,48)},b.prototype.getMouth=function(){return this.positions.slice(48,68)},b.prototype.getRefPointsForAlignment=function(){return[this.getLeftEye(),this.getRightEye(),this.getMouth()].map(Pe)},b}(at),rr=function(){function R(b,S){this._label=b,this._distance=S}return Object.defineProperty(R.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"distance",{get:function(){return this._distance},enumerable:!0,configurable:!0}),R.prototype.toString=function(b){return b===void 0&&(b=!0),""+this.label+(b?" ("+Te(this.distance)+")":"")},R}(),Sr=function(R){Object(L.c)(b,R);function b(S,N){var z=R.call(this,S)||this;return z._label=N,z}return b.assertIsValidLabeledBox=function(S,N){if(ge.assertIsValidBox(S,N),!Be(S.label))throw new Error(N+" - expected property label ("+S.label+") to be a number")},Object.defineProperty(b.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),b}(ge),Lr=function(){function R(b,S){if(!(typeof b=="string"))throw new Error("LabeledFaceDescriptors - constructor expected label to be a string");if(!Array.isArray(S)||S.some(function(N){return!(N instanceof Float32Array)}))throw new Error("LabeledFaceDescriptors - constructor expected descriptors to be an array of Float32Array");this._label=b,this._descriptors=S}return Object.defineProperty(R.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"descriptors",{get:function(){return this._descriptors},enumerable:!0,configurable:!0}),R.prototype.toJSON=function(){return{label:this.label,descriptors:this.descriptors.map(function(b){return Array.from(b)})}},R.fromJSON=function(b){var S=b.descriptors.map(function(N){return new Float32Array(N)});return new R(b.label,S)},R}(),Dr=function(R){Object(L.c)(b,R);function b(S,N,z,ae){var me=R.call(this,S,N)||this;return me._score=z,me._classScore=ae,me}return b.assertIsValidPredictedBox=function(S,N){if(Sr.assertIsValidLabeledBox(S,N),!ot(S.score)||!ot(S.classScore))throw new Error(N+" - expected properties score ("+S.score+") and ("+S.classScore+") to be a number between [0, 1]")},Object.defineProperty(b.prototype,"score",{get:function(){return this._score},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"classScore",{get:function(){return this._classScore},enumerable:!0,configurable:!0}),b}(Sr);function Ar(R){return R.detection instanceof Z}function et(R,b){var S={detection:b};return Object.assign({},R,S)}function Xn(){var R=window.fetch||function(){throw new Error("fetch - missing fetch implementation for browser environment")},b=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:R,readFile:b}}var Nr=O("rOjP"),No=O("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=O("8KZw"),Cr;function lo(){if(!Cr)throw new Error("getEnv - environment is not defined, check isNodejs() and isBrowser()");return Cr}function _n(R){Cr=R}function fo(){Kn()&&_n(Xn()),Object(co.a)()&&_n(Object(No.a)())}function nr(R){if(Cr||fo(),!Cr)throw new Error("monkeyPatch - environment is not defined, check isNodejs() and isBrowser()");var b=R.Canvas,S=b===void 0?Cr.Canvas:b,N=R.Image,z=N===void 0?Cr.Image:N;Cr.Canvas=S,Cr.Image=z,Cr.createCanvasElement=R.createCanvasElement||function(){return new S},Cr.createImageElement=R.createImageElement||function(){return new z},Cr.ImageData=R.ImageData||Cr.ImageData,Cr.Video=R.Video||Cr.Video,Cr.fetch=R.fetch||Cr.fetch,Cr.readFile=R.readFile||Cr.readFile}var hr={getEnv:lo,setEnv:_n,initialize:fo,createBrowserEnv:Xn,createFileSystem:Nr.a,createNodejsEnv:No.a,monkeyPatch:nr,isBrowser:Kn,isNodejs:co.a};fo();function cr(R){return!hr.isNodejs()&&typeof R=="string"?document.getElementById(R):R}function nn(R){var b=hr.getEnv(),S=b.Canvas,N=b.CanvasRenderingContext2D;if(R instanceof N)return R;var z=cr(R);if(!(z instanceof S))throw new Error("resolveContext2d - expected canvas to be of instance of Canvas");var ae=z.getContext("2d");if(!ae)throw new Error("resolveContext2d - canvas 2d context is null");return ae}var cn;(function(R){R.TOP_LEFT="TOP_LEFT",R.TOP_RIGHT="TOP_RIGHT",R.BOTTOM_LEFT="BOTTOM_LEFT",R.BOTTOM_RIGHT="BOTTOM_RIGHT"})(cn||(cn={}));var ko=function(){function R(b){b===void 0&&(b={});var S=b.anchorPosition,N=b.backgroundColor,z=b.fontColor,ae=b.fontSize,me=b.fontStyle,fe=b.padding;this.anchorPosition=S||cn.TOP_LEFT,this.backgroundColor=N||"rgba(0, 0, 0, 0.5)",this.fontColor=z||"rgba(255, 255, 255, 1)",this.fontSize=ae||14,this.fontStyle=me||"Georgia",this.padding=fe||4}return R}(),Ti=function(){function R(b,S,N){N===void 0&&(N={}),this.text=typeof b=="string"?[b]:b instanceof R?b.text:b,this.anchor=S,this.options=new ko(N)}return R.prototype.measureWidth=function(b){var S=this.options.padding;return this.text.map(function(N){return b.measureText(N).width}).reduce(function(N,z){return N<z?z:N},0)+2*S},R.prototype.measureHeight=function(){var b=this.options,S=b.fontSize,N=b.padding;return this.text.length*S+2*N},R.prototype.getUpperLeft=function(b,S){var N=this.options.anchorPosition,z=N===cn.BOTTOM_RIGHT||N===cn.TOP_RIGHT,ae=N===cn.BOTTOM_LEFT||N===cn.BOTTOM_RIGHT,me=this.measureWidth(b),fe=this.measureHeight(),Ce=z?this.anchor.x-me:this.anchor.x,Ie=ae?this.anchor.y-fe:this.anchor.y;if(S){var De=S.width,We=S.height,ze=Math.max(Math.min(Ce,De-me),0),qe=Math.max(Math.min(Ie,We-fe),0);return{x:ze,y:qe}}return{x:Ce,y:Ie}},R.prototype.draw=function(b){var S=cr(b),N=nn(S),z=this.options,ae=z.backgroundColor,me=z.fontColor,fe=z.fontSize,Ce=z.fontStyle,Ie=z.padding;N.font=fe+"px "+Ce;var De=this.measureWidth(N),We=this.measureHeight();N.fillStyle=ae;var ze=this.getUpperLeft(N,S);N.fillRect(ze.x,ze.y,De,We),N.fillStyle=me,this.text.forEach(function(qe,it){var vt=Ie+ze.x,wt=Ie+ze.y+(it+1)*fe;N.fillText(qe,vt,wt)})},R}(),Wa=function(){function R(b){b===void 0&&(b={});var S=b.boxColor,N=b.lineWidth,z=b.label,ae=b.drawLabelOptions;this.boxColor=S||"rgba(0, 0, 255, 1)",this.lineWidth=N||2,this.label=z;var me={anchorPosition:cn.BOTTOM_LEFT,backgroundColor:this.boxColor};this.drawLabelOptions=new ko(Object.assign({},me,ae))}return R}(),Si=function(){function R(b,S){S===void 0&&(S={}),this.box=new ge(b),this.options=new Wa(S)}return R.prototype.draw=function(b){var S=nn(b),N=this.options,z=N.boxColor,ae=N.lineWidth,me=this.box,fe=me.x,Ce=me.y,Ie=me.width,De=me.height;S.strokeStyle=z,S.lineWidth=ae,S.strokeRect(fe,Ce,Ie,De);var We=this.options.label;We&&new Ti([We],{x:fe-ae/2,y:Ce},this.options.drawLabelOptions).draw(b)},R}();function Ve(R,b){var S=Array.isArray(b)?b:[b];S.forEach(function(N){var z=N instanceof Z?N.score:Ar(N)?N.detection.score:void 0,ae=N instanceof Z?N.box:Ar(N)?N.detection.box:new ge(N),me=z?""+Te(z):void 0;new Si(ae,{label:me}).draw(R)})}function Ha(R){var b=hr.getEnv(),S=b.Image,N=b.Video;return R instanceof S&&R.complete||R instanceof N&&R.readyState>=3}function Cn(R){return new Promise(function(b,S){if(R instanceof hr.getEnv().Canvas||Ha(R))return b();function N(ae){if(!ae.currentTarget)return;ae.currentTarget.removeEventListener("load",N),ae.currentTarget.removeEventListener("error",z),b(ae)}function z(ae){if(!ae.currentTarget)return;ae.currentTarget.removeEventListener("load",N),ae.currentTarget.removeEventListener("error",z),S(ae)}R.addEventListener("load",N),R.addEventListener("error",z)})}function Mo(R){return new Promise(function(b,S){if(!(R instanceof Blob))return S("bufferToImage - expected buf to be of type: Blob");var N=new FileReader;N.onload=function(){if(typeof N.result!="string")return S("bufferToImage - expected reader.result to be a string, in onload");var z=hr.getEnv().createImageElement();z.onload=function(){return b(z)},z.onerror=S,z.src=N.result},N.onerror=S,N.readAsDataURL(R)})}function Wr(R){var b=hr.getEnv(),S=b.Image,N=b.Video;return R instanceof S?new re(R.naturalWidth,R.naturalHeight):R instanceof N?new re(R.videoWidth,R.videoHeight):new re(R.width,R.height)}function Hr(R){var b=R.width,S=R.height,N=hr.getEnv().createCanvasElement,z=N();return z.width=b,z.height=S,z}function Tn(R,b){var S=hr.getEnv().ImageData;if(!(R instanceof S)&&!Ha(R))throw new Error("createCanvasFromMedia - media has not finished loading yet");var N=b||Wr(R),z=N.width,ae=N.height,me=Hr({width:z,height:ae});return R instanceof S?nn(me).putImageData(R,0,0):nn(me).drawImage(R,0,0,z,ae),me}function za(R,b){return Object(L.b)(this,void 0,void 0,function(){var S,N,z,ae,me,fe;return Object(L.d)(this,function(Ce){switch(Ce.label){case 0:return S=b||hr.getEnv().createCanvasElement(),N=R.shape.slice(Le(R)?1:0),z=N[0],ae=N[1],me=N[2],fe=j.L(function(){return R.as3D(z,ae,me).toInt()}),[4,j.f.toPixels(fe,S)];case 1:return Ce.sent(),fe.dispose(),[2,S]}})})}function Ga(R){var b=hr.getEnv(),S=b.Image,N=b.Canvas,z=b.Video;return R instanceof S||R instanceof N||R instanceof z}function vn(R,b,S){S===void 0&&(S=!1);var N=hr.getEnv(),z=N.Image,ae=N.Canvas;if(!(R instanceof z||R instanceof ae))throw new Error("imageToSquare - expected arg0 to be HTMLImageElement | HTMLCanvasElement");var me=Wr(R),fe=b/Math.max(me.height,me.width),Ce=fe*me.width,Ie=fe*me.height,De=Hr({width:b,height:b}),We=R instanceof ae?R:Tn(R),ze=Math.abs(Ce-Ie)/2,qe=S&&Ce<Ie?ze:0,it=S&&Ie<Ce?ze:0;return nn(De).drawImage(We,qe,it,Ce,Ie),De}var Yn=function(){function R(b,S){var N=this;if(S===void 0&&(S=!1),this._imageTensors=[],this._canvases=[],this._treatAsBatchInput=!1,this._inputDimensions=[],!Array.isArray(b))throw new Error("NetInput.constructor - expected inputs to be an Array of TResolvedNetInput or to be instanceof tf.Tensor4D, instead have "+b);this._treatAsBatchInput=S,this._batchSize=b.length,b.forEach(function(z,ae){if(Ne(z)){N._imageTensors[ae]=z,N._inputDimensions[ae]=z.shape;return}if(Le(z)){var me=z.shape[0];if(me!==1)throw new Error("NetInput - tf.Tensor4D with batchSize "+me+" passed, but not supported in input array");N._imageTensors[ae]=z,N._inputDimensions[ae]=z.shape.slice(1);return}var fe=z instanceof hr.getEnv().Canvas?z:Tn(z);N._canvases[ae]=fe,N._inputDimensions[ae]=[fe.height,fe.width,3]})}return Object.defineProperty(R.prototype,"imageTensors",{get:function(){return this._imageTensors},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"canvases",{get:function(){return this._canvases},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"isBatchInput",{get:function(){return this.batchSize>1||this._treatAsBatchInput},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"batchSize",{get:function(){return this._batchSize},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"inputDimensions",{get:function(){return this._inputDimensions},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"inputSize",{get:function(){return this._inputSize},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"reshapedInputDimensions",{get:function(){var b=this;return ke(this.batchSize,0,1).map(function(S,N){return b.getReshapedInputDimensions(N)})},enumerable:!0,configurable:!0}),R.prototype.getInput=function(b){return this.canvases[b]||this.imageTensors[b]},R.prototype.getInputDimensions=function(b){return this._inputDimensions[b]},R.prototype.getInputHeight=function(b){return this._inputDimensions[b][0]},R.prototype.getInputWidth=function(b){return this._inputDimensions[b][1]},R.prototype.getReshapedInputDimensions=function(b){if(typeof this.inputSize!="number")throw new Error("getReshapedInputDimensions - inputSize not set, toBatchTensor has not been called yet");var S=this.getInputWidth(b),N=this.getInputHeight(b);return Ye({width:S,height:N},this.inputSize)},R.prototype.toBatchTensor=function(b,S){var N=this;return S===void 0&&(S=!0),this._inputSize=b,j.L(function(){var z=ke(N.batchSize,0,1).map(function(me){var fe=N.getInput(me);if(fe instanceof j.a){var Ce=Le(fe)?fe:fe.expandDims();return Ce=Xe(Ce,S),(Ce.shape[1]!==b||Ce.shape[2]!==b)&&(Ce=j.o.resizeBilinear(Ce,[b,b])),Ce.as3D(b,b,3)}if(fe instanceof hr.getEnv().Canvas)return j.f.fromPixels(vn(fe,b,S));throw new Error("toBatchTensor - at batchIdx "+me+", expected input to be instanceof tf.Tensor or instanceof HTMLCanvasElement, instead have "+fe)}),ae=j.E(z.map(function(me){return me.toFloat()})).as4D(N.batchSize,b,b,3);return ae})},R}();function Or(R){return Object(L.b)(this,void 0,void 0,function(){var b,S,N;return Object(L.d)(this,function(z){switch(z.label){case 0:if(R instanceof Yn)return[2,R];if(b=Array.isArray(R)?R:[R],!b.length)throw new Error("toNetInput - empty array passed as input");return S=function(ae){return Array.isArray(R)?" at input index "+ae+":":""},N=b.map(cr),N.forEach(function(ae,me){if(!Ga(ae)&&!Ne(ae)&&!Le(ae))throw typeof b[me]=="string"?new Error("toNetInput -"+S(me)+" string passed, but could not resolve HTMLElement for element id "+b[me]):new Error("toNetInput -"+S(me)+" expected media to be of type HTMLImageElement | HTMLVideoElement | HTMLCanvasElement | tf.Tensor3D, or to be an element id");if(Le(ae)){var fe=ae.shape[0];if(fe!==1)throw new Error("toNetInput -"+S(me)+" tf.Tensor4D with batchSize "+fe+" passed, but not supported in input array")}}),[4,Promise.all(N.map(function(ae){return Ga(ae)&&Cn(ae)}))];case 1:return z.sent(),[2,new Yn(N,Array.isArray(R))]}})})}function $n(R,b){return Object(L.b)(this,void 0,void 0,function(){var S,N,z,ae,me,fe,Ce;return Object(L.d)(this,function(Ie){switch(Ie.label){case 0:return S=hr.getEnv().Canvas,N=R,R instanceof S?[3,5]:[4,Or(R)];case 1:if(z=Ie.sent(),z.batchSize>1)throw new Error("extractFaces - batchSize > 1 not supported");return ae=z.getInput(0),ae instanceof S?(me=ae,[3,4]):[3,2];case 2:return[4,za(ae)];case 3:me=Ie.sent(),Ie.label=4;case 4:N=me,Ie.label=5;case 5:return fe=nn(N),Ce=b.map(function(De){return De instanceof Z?De.forSize(N.width,N.height).box.floor():De}).map(function(De){return De.clipAtImageBorders(N.width,N.height)}),[2,Ce.map(function(De){var We=De.x,ze=De.y,qe=De.width,it=De.height,vt=Hr({width:qe,height:it});return nn(vt).putImageData(fe.getImageData(We,ze,qe,it),0,0),vt})]}})})}function Po(R,b){return Object(L.b)(this,void 0,void 0,function(){return Object(L.d)(this,function(S){if(!Ne(R)&&!Le(R))throw new Error("extractFaceTensors - expected image tensor to be 3D or 4D");if(Le(R)&&R.shape[0]>1)throw new Error("extractFaceTensors - batchSize > 1 not supported");return[2,j.L(function(){var N=R.shape.slice(Le(R)?1:0),z=N[0],ae=N[1],me=N[2],fe=b.map(function(Ie){return Ie instanceof Z?Ie.forSize(ae,z).box:Ie}).map(function(Ie){return Ie.clipAtImageBorders(ae,z)}),Ce=fe.map(function(Ie){var De=Ie.x,We=Ie.y,ze=Ie.width,qe=Ie.height;return j.C(R.as3D(z,ae,me),[We,De,0],[qe,ze,me])});return Ce})]})})}function St(R,b){return Object(L.b)(this,void 0,void 0,function(){var S,N;return Object(L.d)(this,function(z){switch(z.label){case 0:return S=hr.getEnv().fetch,[4,S(R,b)];case 1:if(N=z.sent(),!(N.status<400))throw new Error("failed to fetch: ("+N.status+") "+N.statusText+", from url: "+N.url);return[2,N]}})})}function Ju(R){return Object(L.b)(this,void 0,void 0,function(){var b,S;return Object(L.d)(this,function(N){switch(N.label){case 0:return[4,St(R)];case 1:return b=N.sent(),[4,b.blob()];case 2:if(S=N.sent(),!S.type.startsWith("image/"))throw new Error("fetchImage - expected blob type to be of type image/*, instead have: "+S.type+", for url: "+b.url);return[2,Mo(S)]}})})}function bs(R){return Object(L.b)(this,void 0,void 0,function(){return Object(L.d)(this,function(b){switch(b.label){case 0:return[4,St(R)];case 1:return[2,b.sent().json()]}})})}function xs(R){return Object(L.b)(this,void 0,void 0,function(){var b;return Object(L.d)(this,function(S){switch(S.label){case 0:return b=Float32Array.bind,[4,St(R)];case 1:return[4,S.sent().arrayBuffer()];case 2:return[2,new(b.apply(Float32Array,[void 0,S.sent()]))]}})})}function Va(R,b){var S=b+"-weights_manifest.json";if(!R)return{modelBaseUri:"",manifestUri:S};if(R==="/")return{modelBaseUri:"/",manifestUri:"/"+S};var N=R.startsWith("http://")?"http://":R.startsWith("https://")?"https://":"";R=R.replace(N,"");var z=R.split("/").filter(function(fe){return fe}),ae=R.endsWith(".json")?z[z.length-1]:S,me=N+(R.endsWith(".json")?z.slice(0,z.length-1):z).join("/");return me=R.startsWith("/")?"/"+me:me,{modelBaseUri:me,manifestUri:me==="/"?"/"+ae:me+"/"+ae}}function Lo(R,b){return Object(L.b)(this,void 0,void 0,function(){var S,N,z,ae;return Object(L.d)(this,function(me){switch(me.label){case 0:return S=Va(R,b),N=S.manifestUri,z=S.modelBaseUri,[4,bs(N)];case 1:return ae=me.sent(),[2,j.p.loadWeights(ae,z)]}})})}function ws(R,b,S){S===void 0&&(S=!1);var N=S?Wr(b):b,z=N.width,ae=N.height;return R.width=z,R.height=ae,{width:z,height:ae}}var gn=function(){function R(b){this._name=b,this._params=void 0,this._paramMappings=[]}return Object.defineProperty(R.prototype,"params",{get:function(){return this._params},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"paramMappings",{get:function(){return this._paramMappings},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"isLoaded",{get:function(){return!!this.params},enumerable:!0,configurable:!0}),R.prototype.getParamFromPath=function(b){var S=this.traversePropertyPath(b),N=S.obj,z=S.objProp;return N[z]},R.prototype.reassignParamFromPath=function(b,S){var N=this.traversePropertyPath(b),z=N.obj,ae=N.objProp;z[ae].dispose(),z[ae]=S},R.prototype.getParamList=function(){var b=this;return this._paramMappings.map(function(S){var N=S.paramPath;return{path:N,tensor:b.getParamFromPath(N)}})},R.prototype.getTrainableParams=function(){return this.getParamList().filter(function(b){return b.tensor instanceof j.b})},R.prototype.getFrozenParams=function(){return this.getParamList().filter(function(b){return!(b.tensor instanceof j.b)})},R.prototype.variable=function(){var b=this;this.getFrozenParams().forEach(function(S){var N=S.path,z=S.tensor;b.reassignParamFromPath(N,z.variable())})},R.prototype.freeze=function(){var b=this;this.getTrainableParams().forEach(function(S){var N=S.path,z=S.tensor,ae=j.G(z.dataSync());z.dispose(),b.reassignParamFromPath(N,ae)})},R.prototype.dispose=function(b){b===void 0&&(b=!0),this.getParamList().forEach(function(S){if(b&&S.tensor.isDisposed)throw new Error("param tensor has already been disposed for path "+S.path);S.tensor.dispose()}),this._params=void 0},R.prototype.serializeParams=function(){return new Float32Array(this.getParamList().map(function(b){var S=b.tensor;return Array.from(S.dataSync())}).reduce(function(b,S){return b.concat(S)}))},R.prototype.load=function(b){return Object(L.b)(this,void 0,void 0,function(){return Object(L.d)(this,function(S){switch(S.label){case 0:return b instanceof Float32Array?(this.extractWeights(b),[2]):[4,this.loadFromUri(b)];case 1:return S.sent(),[2]}})})},R.prototype.loadFromUri=function(b){return Object(L.b)(this,void 0,void 0,function(){var S;return Object(L.d)(this,function(N){switch(N.label){case 0:if(b&&typeof b!="string")throw new Error(this._name+".loadFromUri - expected model uri");return[4,Lo(b,this.getDefaultModelName())];case 1:return S=N.sent(),this.loadFromWeightMap(S),[2]}})})},R.prototype.loadFromDisk=function(b){return Object(L.b)(this,void 0,void 0,function(){var S,N,z,ae,me,fe,Ce,Ie,De,We;return Object(L.d)(this,function(ze){switch(ze.label){case 0:if(b&&typeof b!="string")throw new Error(this._name+".loadFromDisk - expected model file path");return S=hr.getEnv().readFile,N=Va(b,this.getDefaultModelName()),z=N.manifestUri,ae=N.modelBaseUri,me=function(qe){return Promise.all(qe.map(function(it){return S(it).then(function(vt){return vt.buffer})}))},fe=j.p.weightsLoaderFactory(me),De=(Ie=JSON).parse,[4,S(z)];case 1:return Ce=De.apply(Ie,[ze.sent().toString()]),[4,fe(Ce,ae)];case 2:return We=ze.sent(),this.loadFromWeightMap(We),[2]}})})},R.prototype.loadFromWeightMap=function(b){var S=this.extractParamsFromWeigthMap(b),N=S.paramMappings,z=S.params;this._paramMappings=N,this._params=z},R.prototype.extractWeights=function(b){var S=this.extractParams(b),N=S.paramMappings,z=S.params;this._paramMappings=N,this._params=z},R.prototype.traversePropertyPath=function(b){if(!this.params)throw new Error("traversePropertyPath - model has no loaded params");var S=b.split("/").reduce(function(ae,me){if(!ae.nextObj.hasOwnProperty(me))throw new Error("traversePropertyPath - object does not have property "+me+", for path "+b);return{obj:ae.nextObj,objProp:me,nextObj:ae.nextObj[me]}},{nextObj:this.params}),N=S.obj,z=S.objProp;if(!N||!z||!(N[z]instanceof j.a))throw new Error("traversePropertyPath - parameter is not a tensor, for path "+b);return{obj:N,objProp:z}},R}();function zr(R,b,S){return j.L(function(){var N=j.z(R,b.depthwise_filter,b.pointwise_filter,S,"same");return N=j.c(N,b.bias),N})}function ho(R,b,S){return S===void 0&&(S=!1),j.L(function(){var N=j.w(S?j.c(j.i(R,b.conv0.filters,[2,2],"same"),b.conv0.bias):zr(R,b.conv0,[2,2])),z=zr(N,b.conv1,[1,1]),ae=j.w(j.c(N,z)),me=zr(ae,b.conv2,[1,1]);return j.w(j.c(N,j.c(z,me)))})}function ra(R,b,S,N){return S===void 0&&(S=!1),N===void 0&&(N=!0),j.L(function(){var z=j.w(S?j.c(j.i(R,b.conv0.filters,N?[2,2]:[1,1],"same"),b.conv0.bias):zr(R,b.conv0,N?[2,2]:[1,1])),ae=zr(z,b.conv1,[1,1]),me=j.w(j.c(z,ae)),fe=zr(me,b.conv2,[1,1]),Ce=j.w(j.c(z,j.c(ae,fe))),Ie=zr(Ce,b.conv3,[1,1]);return j.w(j.c(z,j.c(ae,j.c(fe,Ie))))})}function an(R,b,S,N){return S===void 0&&(S="same"),N===void 0&&(N=!1),j.L(function(){var z=j.c(j.i(R,b.filters,[1,1],S),b.bias);return N?j.w(z):z})}function yn(R,b){Object.keys(R).forEach(function(S){b.some(function(N){return N.originalPath===S})||R[S].dispose()})}function Jn(R,b){return function(S,N,z,ae){var me=j.K(R(S*N*z*z),[z,z,S,N]),fe=j.H(R(N));return b.push({paramPath:ae+"/filters"},{paramPath:ae+"/bias"}),{filters:me,bias:fe}}}function na(R,b){return function(S,N,z){var ae=j.I(R(S*N),[S,N]),me=j.H(R(N));return b.push({paramPath:z+"/weights"},{paramPath:z+"/bias"}),{weights:ae,bias:me}}}var Xa=function(){function R(b,S,N){this.depthwise_filter=b,this.pointwise_filter=S,this.bias=N}return R}();function oa(R,b){return function(S,N,z){var ae=j.K(R(3*3*S),[3,3,S,1]),me=j.K(R(S*N),[1,1,S,N]),fe=j.H(R(N));return b.push({paramPath:z+"/depthwise_filter"},{paramPath:z+"/pointwise_filter"},{paramPath:z+"/bias"}),new Xa(ae,me,fe)}}function aa(R){return function(b){var S=R(b+"/depthwise_filter",4),N=R(b+"/pointwise_filter",4),z=R(b+"/bias",1);return new Xa(S,N,z)}}function Sn(R,b){return function(S,N,z){var ae=R[S];if(!de(ae,N))throw new Error("expected weightMap["+S+"] to be a Tensor"+N+"D, instead have "+ae);return b.push({originalPath:S,paramPath:z||S}),ae}}function ln(R){var b=R;function S(z){var ae=b.slice(0,z);return b=b.slice(z),ae}function N(){return b}return{extractWeights:S,getRemainingWeights:N}}function Ka(R,b){var S=Jn(R,b),N=oa(R,b);function z(me,fe,Ce,Ie){Ie===void 0&&(Ie=!1);var De=Ie?S(me,fe,3,Ce+"/conv0"):N(me,fe,Ce+"/conv0"),We=N(fe,fe,Ce+"/conv1"),ze=N(fe,fe,Ce+"/conv2");return{conv0:De,conv1:We,conv2:ze}}function ae(me,fe,Ce,Ie){Ie===void 0&&(Ie=!1);var De=z(me,fe,Ce,Ie),We=De.conv0,ze=De.conv1,qe=De.conv2,it=N(fe,fe,Ce+"/conv3");return{conv0:We,conv1:ze,conv2:qe,conv3:it}}return{extractDenseBlock3Params:z,extractDenseBlock4Params:ae}}function Ai(R){var b=[],S=ln(R),N=S.extractWeights,z=S.getRemainingWeights,ae=Ka(N,b).extractDenseBlock4Params,me=ae(3,32,"dense0",!0),fe=ae(32,64,"dense1"),Ce=ae(64,128,"dense2"),Ie=ae(128,256,"dense3");if(z().length!==0)throw new Error("weights remaing after extract: "+z().length);return{paramMappings:b,params:{dense0:me,dense1:fe,dense2:Ce,dense3:Ie}}}function Ya(R){return function(b){var S=R(b+"/filters",4),N=R(b+"/bias",1);return{filters:S,bias:N}}}function $a(R,b){var S=Sn(R,b),N=Ya(S),z=aa(S);function ae(fe,Ce){Ce===void 0&&(Ce=!1);var Ie=Ce?N(fe+"/conv0"):z(fe+"/conv0"),De=z(fe+"/conv1"),We=z(fe+"/conv2");return{conv0:Ie,conv1:De,conv2:We}}function me(fe,Ce){Ce===void 0&&(Ce=!1);var Ie=Ce?N(fe+"/conv0"):z(fe+"/conv0"),De=z(fe+"/conv1"),We=z(fe+"/conv2"),ze=z(fe+"/conv3");return{conv0:Ie,conv1:De,conv2:We,conv3:ze}}return{extractDenseBlock3Params:ae,extractDenseBlock4Params:me}}function ia(R){var b=[],S=$a(R,b).extractDenseBlock4Params,N={dense0:S("dense0",!0),dense1:S("dense1"),dense2:S("dense2"),dense3:S("dense3")};return yn(R,b),{params:N,paramMappings:b}}var sa=function(R){Object(L.c)(b,R);function b(){return R.call(this,"FaceFeatureExtractor")||this}return b.prototype.forwardInput=function(S){var N=this.params;if(!N)throw new Error("FaceFeatureExtractor - load model before inference");return j.L(function(){var z=S.toBatchTensor(112,!0),ae=[122.782,117.001,104.298],me=Ae(z,ae).div(j.y(255)),fe=ra(me,N.dense0,!0);return fe=ra(fe,N.dense1),fe=ra(fe,N.dense2),fe=ra(fe,N.dense3),fe=j.d(fe,[7,7],[2,2],"valid"),fe})},b.prototype.forward=function(S){return Object(L.b)(this,void 0,void 0,function(){var N;return Object(L.d)(this,function(z){switch(z.label){case 0:return N=this.forwardInput,[4,Or(S)];case 1:return[2,N.apply(this,[z.sent()])]}})})},b.prototype.getDefaultModelName=function(){return"face_feature_extractor_model"},b.prototype.extractParamsFromWeigthMap=function(S){return ia(S)},b.prototype.extractParams=function(S){return Ai(S)},b}(gn);function $r(R,b){return j.L(function(){return j.c(j.q(R,b.weights),b.bias)})}function Oi(R,b,S){var N=[],z=ln(R),ae=z.extractWeights,me=z.getRemainingWeights,fe=na(ae,N),Ce=fe(b,S,"fc");if(me().length!==0)throw new Error("weights remaing after extract: "+me().length);return{paramMappings:N,params:{fc:Ce}}}function An(R){var b=[],S=Sn(R,b);function N(ae){var me=S(ae+"/weights",2),fe=S(ae+"/bias",1);return{weights:me,bias:fe}}var z={fc:N("fc")};return yn(R,b),{params:z,paramMappings:b}}function Ja(R){var b={},S={};return Object.keys(R).forEach(function(N){var z=N.startsWith("fc")?S:b;z[N]=R[N]}),{featureExtractorMap:b,classifierMap:S}}var po=function(R){Object(L.c)(b,R);function b(S,N){var z=R.call(this,S)||this;return z._faceFeatureExtractor=N,z}return Object.defineProperty(b.prototype,"faceFeatureExtractor",{get:function(){return this._faceFeatureExtractor},enumerable:!0,configurable:!0}),b.prototype.runNet=function(S){var N=this,z=this.params;if(!z)throw new Error(this._name+" - load model before inference");return j.L(function(){var ae=S instanceof Yn?N.faceFeatureExtractor.forwardInput(S):S;return $r(ae.as2D(ae.shape[0],-1),z.fc)})},b.prototype.dispose=function(S){S===void 0&&(S=!0),this.faceFeatureExtractor.dispose(S),R.prototype.dispose.call(this,S)},b.prototype.loadClassifierParams=function(S){var N=this.extractClassifierParams(S),z=N.params,ae=N.paramMappings;this._params=z,this._paramMappings=ae},b.prototype.extractClassifierParams=function(S){return Oi(S,this.getClassifierChannelsIn(),this.getClassifierChannelsOut())},b.prototype.extractParamsFromWeigthMap=function(S){var N=Ja(S),z=N.featureExtractorMap,ae=N.classifierMap;return this.faceFeatureExtractor.loadFromWeightMap(z),An(ae)},b.prototype.extractParams=function(S){var N=this.getClassifierChannelsIn(),z=this.getClassifierChannelsOut(),ae=z*N+z,me=S.slice(0,S.length-ae),fe=S.slice(S.length-ae);return this.faceFeatureExtractor.extractWeights(me),this.extractClassifierParams(fe)},b}(gn),mo=["neutral","happy","sad","angry","fearful","disgusted","surprised"],vo=function(){function R(b){var S=this;if(b.length!==7)throw new Error("FaceExpressions.constructor - expected probabilities.length to be 7, have: "+b.length);mo.forEach(function(N,z){S[N]=b[z]})}return R.prototype.asSortedArray=function(){var b=this;return mo.map(function(S){return{expression:S,probability:b[S]}}).sort(function(S,N){return N.probability-S.probability})},R}(),Ri=function(R){Object(L.c)(b,R);function b(S){return S===void 0&&(S=new sa),R.call(this,"FaceExpressionNet",S)||this}return b.prototype.forwardInput=function(S){var N=this;return j.L(function(){return j.D(N.runNet(S))})},b.prototype.forward=function(S){return Object(L.b)(this,void 0,void 0,function(){var N;return Object(L.d)(this,function(z){switch(z.label){case 0:return N=this.forwardInput,[4,Or(S)];case 1:return[2,N.apply(this,[z.sent()])]}})})},b.prototype.predictExpressions=function(S){return Object(L.b)(this,void 0,void 0,function(){var N,z,ae,me,fe=this;return Object(L.d)(this,function(Ce){switch(Ce.label){case 0:return[4,Or(S)];case 1:return N=Ce.sent(),[4,this.forwardInput(N)];case 2:return z=Ce.sent(),[4,Promise.all(j.O(z).map(function(Ie){return Object(L.b)(fe,void 0,void 0,function(){var De;return Object(L.d)(this,function(We){switch(We.label){case 0:return[4,Ie.data()];case 1:return De=We.sent(),Ie.dispose(),[2,De]}})})}))];case 3:return ae=Ce.sent(),z.dispose(),me=ae.map(function(Ie){return new vo(Ie)}),[2,N.isBatchInput?me:me[0]]}})})},b.prototype.getDefaultModelName=function(){return"face_expression_model"},b.prototype.getClassifierChannelsIn=function(){return 256},b.prototype.getClassifierChannelsOut=function(){return 7},b}(po);function ua(R){return R.expressions instanceof vo}function go(R,b){var S={expressions:b};return Object.assign({},R,S)}function Ii(R,b,S,N){S===void 0&&(S=.1);var z=Array.isArray(b)?b:[b];z.forEach(function(ae){var me=ae instanceof vo?ae:ua(ae)?ae.expressions:void 0;if(!me)throw new Error("drawFaceExpressions - expected faceExpressions to be FaceExpressions | WithFaceExpressions<{}> or array thereof");var fe=me.asSortedArray(),Ce=fe.filter(function(We){return We.probability>S}),Ie=Ar(ae)?ae.detection.box.bottomLeft:N||new ve(0,0),De=new Ti(Ce.map(function(We){return We.expression+" ("+Te(We.probability)+")"}),Ie);De.draw(R)})}function ca(R){return Ar(R)&&R.landmarks instanceof at&&R.unshiftedLandmarks instanceof at&&R.alignedRect instanceof Z}function jo(R,b){var S=R.detection.box,N=b.shiftBy(S.x,S.y),z=N.align(),ae=R.detection.imageDims,me=new Z(R.detection.score,z.rescale(ae.reverse()),ae),fe={landmarks:N,unshiftedLandmarks:b,alignedRect:me};return Object.assign({},R,fe)}var Jr=function(){function R(b){b===void 0&&(b={});var S=b.drawLines,N=S===void 0?!0:S,z=b.drawPoints,ae=z===void 0?!0:z,me=b.lineWidth,fe=b.lineColor,Ce=b.pointSize,Ie=b.pointColor;this.drawLines=N,this.drawPoints=ae,this.lineWidth=me||1,this.pointSize=Ce||2,this.lineColor=fe||"rgba(0, 255, 255, 1)",this.pointColor=Ie||"rgba(255, 0, 255, 1)"}return R}(),la=function(){function R(b,S){S===void 0&&(S={}),this.faceLandmarks=b,this.options=new Jr(S)}return R.prototype.draw=function(b){var S=nn(b),N=this.options,z=N.drawLines,ae=N.drawPoints,me=N.lineWidth,fe=N.lineColor,Ce=N.pointSize,Ie=N.pointColor;if(z&&this.faceLandmarks instanceof mr&&(S.strokeStyle=fe,S.lineWidth=me,Q(S,this.faceLandmarks.getJawOutline()),Q(S,this.faceLandmarks.getLeftEyeBrow()),Q(S,this.faceLandmarks.getRightEyeBrow()),Q(S,this.faceLandmarks.getNose()),Q(S,this.faceLandmarks.getLeftEye(),!0),Q(S,this.faceLandmarks.getRightEye(),!0),Q(S,this.faceLandmarks.getMouth(),!0)),ae){S.strokeStyle=Ie,S.fillStyle=Ie;var De=function(We){S.beginPath(),S.arc(We.x,We.y,Ce,0,2*Math.PI),S.fill()};this.faceLandmarks.positions.forEach(De)}},R}();function Di(R,b){var S=Array.isArray(b)?b:[b];S.forEach(function(N){var z=N instanceof at?N:ca(N)?N.landmarks:void 0;if(!z)throw new Error("drawFaceLandmarks - expected faceExpressions to be FaceLandmarks | WithFaceLandmarks<WithFaceDetection<{}>> or array thereof");new la(z).draw(R)})}function Ni(R,b){var S=Jn(R,b),N=oa(R,b);function z(me,fe,Ce){var Ie=N(me,fe,Ce+"/separable_conv0"),De=N(fe,fe,Ce+"/separable_conv1"),We=S(me,fe,1,Ce+"/expansion_conv");return{separable_conv0:Ie,separable_conv1:De,expansion_conv:We}}function ae(me,fe){var Ce=N(me,me,fe+"/separable_conv0"),Ie=N(me,me,fe+"/separable_conv1"),De=N(me,me,fe+"/separable_conv2");return{separable_conv0:Ce,separable_conv1:Ie,separable_conv2:De}}return{extractConvParams:S,extractSeparableConvParams:N,extractReductionBlockParams:z,extractMainBlockParams:ae}}function qa(R,b){var S=[],N=ln(R),z=N.extractWeights,ae=N.getRemainingWeights,me=Ni(z,S),fe=me.extractConvParams,Ce=me.extractSeparableConvParams,Ie=me.extractReductionBlockParams,De=me.extractMainBlockParams,We=fe(3,32,3,"entry_flow/conv_in"),ze=Ie(32,64,"entry_flow/reduction_block_0"),qe=Ie(64,128,"entry_flow/reduction_block_1"),it={conv_in:We,reduction_block_0:ze,reduction_block_1:qe},vt={};ke(b,0,1).forEach(function(At){vt["main_block_"+At]=De(128,"middle_flow/main_block_"+At)});var wt=Ie(128,256,"exit_flow/reduction_block"),Ct=Ce(256,512,"exit_flow/separable_conv"),Dt={reduction_block:wt,separable_conv:Ct};if(ae().length!==0)throw new Error("weights remaing after extract: "+ae().length);return{paramMappings:S,params:{entry_flow:it,middle_flow:vt,exit_flow:Dt}}}function ki(R,b){var S=Sn(R,b),N=Ya(S),z=aa(S);function ae(fe){var Ce=z(fe+"/separable_conv0"),Ie=z(fe+"/separable_conv1"),De=N(fe+"/expansion_conv");return{separable_conv0:Ce,separable_conv1:Ie,expansion_conv:De}}function me(fe){var Ce=z(fe+"/separable_conv0"),Ie=z(fe+"/separable_conv1"),De=z(fe+"/separable_conv2");return{separable_conv0:Ce,separable_conv1:Ie,separable_conv2:De}}return{extractConvParams:N,extractSeparableConvParams:z,extractReductionBlockParams:ae,extractMainBlockParams:me}}function Es(R,b){var S=[],N=ki(R,S),z=N.extractConvParams,ae=N.extractSeparableConvParams,me=N.extractReductionBlockParams,fe=N.extractMainBlockParams,Ce=z("entry_flow/conv_in"),Ie=me("entry_flow/reduction_block_0"),De=me("entry_flow/reduction_block_1"),We={conv_in:Ce,reduction_block_0:Ie,reduction_block_1:De},ze={};ke(b,0,1).forEach(function(wt){ze["main_block_"+wt]=fe("middle_flow/main_block_"+wt)});var qe=me("exit_flow/reduction_block"),it=ae("exit_flow/separable_conv"),vt={reduction_block:qe,separable_conv:it};return yn(R,S),{params:{entry_flow:We,middle_flow:ze,exit_flow:vt},paramMappings:S}}function Lt(R,b,S){return j.c(j.i(R,b.filters,S,"same"),b.bias)}function Mi(R,b,S){S===void 0&&(S=!0);var N=S?j.w(R):R;return N=zr(N,b.separable_conv0,[1,1]),N=zr(j.w(N),b.separable_conv1,[1,1]),N=j.s(N,[3,3],[2,2],"same"),N=j.c(N,Lt(R,b.expansion_conv,[2,2])),N}function qu(R,b){var S=zr(j.w(R),b.separable_conv0,[1,1]);return S=zr(j.w(S),b.separable_conv1,[1,1]),S=zr(j.w(S),b.separable_conv2,[1,1]),S=j.c(S,R),S}var Qu=function(R){Object(L.c)(b,R);function b(S){var N=R.call(this,"TinyXception")||this;return N._numMainBlocks=S,N}return b.prototype.forwardInput=function(S){var N=this,z=this.params;if(!z)throw new Error("TinyXception - load model before inference");return j.L(function(){var ae=S.toBatchTensor(112,!0),me=[122.782,117.001,104.298],fe=Ae(ae,me).div(j.y(256)),Ce=j.w(Lt(fe,z.entry_flow.conv_in,[2,2]));return Ce=Mi(Ce,z.entry_flow.reduction_block_0,!1),Ce=Mi(Ce,z.entry_flow.reduction_block_1),ke(N._numMainBlocks,0,1).forEach(function(Ie){Ce=qu(Ce,z.middle_flow["main_block_"+Ie])}),Ce=Mi(Ce,z.exit_flow.reduction_block),Ce=j.w(zr(Ce,z.exit_flow.separable_conv,[1,1])),Ce})},b.prototype.forward=function(S){return Object(L.b)(this,void 0,void 0,function(){var N;return Object(L.d)(this,function(z){switch(z.label){case 0:return N=this.forwardInput,[4,Or(S)];case 1:return[2,N.apply(this,[z.sent()])]}})})},b.prototype.getDefaultModelName=function(){return"tiny_xception_model"},b.prototype.extractParamsFromWeigthMap=function(S){return Es(S,this._numMainBlocks)},b.prototype.extractParams=function(S){return qa(S,this._numMainBlocks)},b}(gn);function Pi(R){var b=[],S=ln(R),N=S.extractWeights,z=S.getRemainingWeights,ae=na(N,b),me=ae(512,1,"fc/age"),fe=ae(512,2,"fc/gender");if(z().length!==0)throw new Error("weights remaing after extract: "+z().length);return{paramMappings:b,params:{fc:{age:me,gender:fe}}}}function Zu(R){var b=[],S=Sn(R,b);function N(ae){var me=S(ae+"/weights",2),fe=S(ae+"/bias",1);return{weights:me,bias:fe}}var z={fc:{age:N("fc/age"),gender:N("fc/gender")}};return yn(R,b),{params:z,paramMappings:b}}var Fo;(function(R){R.FEMALE="female",R.MALE="male"})(Fo||(Fo={}));var ec=function(R){Object(L.c)(b,R);function b(S){S===void 0&&(S=new Qu(2));var N=R.call(this,"AgeGenderNet")||this;return N._faceFeatureExtractor=S,N}return Object.defineProperty(b.prototype,"faceFeatureExtractor",{get:function(){return this._faceFeatureExtractor},enumerable:!0,configurable:!0}),b.prototype.runNet=function(S){var N=this,z=this.params;if(!z)throw new Error(this._name+" - load model before inference");return j.L(function(){var ae=S instanceof Yn?N.faceFeatureExtractor.forwardInput(S):S,me=j.d(ae,[7,7],[2,2],"valid").as2D(ae.shape[0],-1),fe=$r(me,z.fc.age).as1D(),Ce=$r(me,z.fc.gender);return{age:fe,gender:Ce}})},b.prototype.forwardInput=function(S){var N=this;return j.L(function(){var z=N.runNet(S),ae=z.age,me=z.gender;return{age:ae,gender:j.D(me)}})},b.prototype.forward=function(S){return Object(L.b)(this,void 0,void 0,function(){var N;return Object(L.d)(this,function(z){switch(z.label){case 0:return N=this.forwardInput,[4,Or(S)];case 1:return[2,N.apply(this,[z.sent()])]}})})},b.prototype.predictAgeAndGender=function(S){return Object(L.b)(this,void 0,void 0,function(){var N,z,ae,me,fe,Ce,Ie=this;return Object(L.d)(this,function(De){switch(De.label){case 0:return[4,Or(S)];case 1:return N=De.sent(),[4,this.forwardInput(N)];case 2:return z=De.sent(),ae=j.O(z.age),me=j.O(z.gender),fe=ae.map(function(We,ze){return{ageTensor:We,genderTensor:me[ze]}}),[4,Promise.all(fe.map(function(We){var ze=We.ageTensor,qe=We.genderTensor;return Object(L.b)(Ie,void 0,void 0,function(){var it,vt,wt,Ct,Dt;return Object(L.d)(this,function(At){switch(At.label){case 0:return[4,ze.data()];case 1:return it=At.sent()[0],[4,qe.data()];case 2:return vt=At.sent()[0],wt=vt>.5,Ct=wt?Fo.MALE:Fo.FEMALE,Dt=wt?vt:1-vt,ze.dispose(),qe.dispose(),[2,{age:it,gender:Ct,genderProbability:Dt}]}})})}))];case 3:return Ce=De.sent(),z.age.dispose(),z.gender.dispose(),[2,N.isBatchInput?Ce:Ce[0]]}})})},b.prototype.getDefaultModelName=function(){return"age_gender_model"},b.prototype.dispose=function(S){S===void 0&&(S=!0),this.faceFeatureExtractor.dispose(S),R.prototype.dispose.call(this,S)},b.prototype.loadClassifierParams=function(S){var N=this.extractClassifierParams(S),z=N.params,ae=N.paramMappings;this._params=z,this._paramMappings=ae},b.prototype.extractClassifierParams=function(S){return Pi(S)},b.prototype.extractParamsFromWeigthMap=function(S){var N=Ja(S),z=N.featureExtractorMap,ae=N.classifierMap;return this.faceFeatureExtractor.loadFromWeightMap(z),Zu(ae)},b.prototype.extractParams=function(S){var N=512*1+1+(512*2+2),z=S.slice(0,S.length-N),ae=S.slice(S.length-N);return this.faceFeatureExtractor.extractWeights(z),this.extractClassifierParams(ae)},b}(gn),_s=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b.prototype.postProcess=function(S,N,z){var ae=z.map(function(fe){var Ce=fe.width,Ie=fe.height,De=N/Math.max(Ie,Ce);return{width:Ce*De,height:Ie*De}}),me=ae.length;return j.L(function(){var fe=function(ze,qe){return j.E([j.n([68],ze),j.n([68],qe)],1).as2D(1,136).as1D()},Ce=function(ze,qe){var it=ae[ze],vt=it.width,wt=it.height;return qe(vt,wt)?Math.abs(vt-wt)/2:0},Ie=function(ze){return Ce(ze,function(qe,it){return qe<it})},De=function(ze){return Ce(ze,function(qe,it){return it<qe})},We=S.mul(j.n([me,136],N)).sub(j.E(Array.from(Array(me),function(ze,qe){return fe(Ie(qe),De(qe))}))).div(j.E(Array.from(Array(me),function(ze,qe){return fe(ae[qe].width,ae[qe].height)})));return We})},b.prototype.forwardInput=function(S){var N=this;return j.L(function(){var z=N.runNet(S);return N.postProcess(z,S.inputSize,S.inputDimensions.map(function(ae){var me=ae[0],fe=ae[1];return{height:me,width:fe}}))})},b.prototype.forward=function(S){return Object(L.b)(this,void 0,void 0,function(){var N;return Object(L.d)(this,function(z){switch(z.label){case 0:return N=this.forwardInput,[4,Or(S)];case 1:return[2,N.apply(this,[z.sent()])]}})})},b.prototype.detectLandmarks=function(S){return Object(L.b)(this,void 0,void 0,function(){var N,z,ae,me=this;return Object(L.d)(this,function(fe){switch(fe.label){case 0:return[4,Or(S)];case 1:return N=fe.sent(),z=j.L(function(){return j.O(me.forwardInput(N))}),[4,Promise.all(z.map(function(Ce,Ie){return Object(L.b)(me,void 0,void 0,function(){var De,We,ze,qe,it;return Object(L.d)(this,function(vt){switch(vt.label){case 0:return ze=(We=Array).from,[4,Ce.data()];case 1:return De=ze.apply(We,[vt.sent()]),qe=De.filter(function(wt,Ct){return Qe(Ct)}),it=De.filter(function(wt,Ct){return!Qe(Ct)}),[2,new mr(Array(68).fill(0).map(function(wt,Ct){return new ve(qe[Ct],it[Ct])}),{height:N.getInputHeight(Ie),width:N.getInputWidth(Ie)})]}})})}))];case 2:return ae=fe.sent(),z.forEach(function(Ce){return Ce.dispose()}),[2,N.isBatchInput?ae:ae[0]]}})})},b.prototype.getClassifierChannelsOut=function(){return 136},b}(po),Rr=function(R){Object(L.c)(b,R);function b(S){return S===void 0&&(S=new sa),R.call(this,"FaceLandmark68Net",S)||this}return b.prototype.getDefaultModelName=function(){return"face_landmark_68_model"},b.prototype.getClassifierChannelsIn=function(){return 256},b}(_s);function qr(R){var b=[],S=$a(R,b).extractDenseBlock3Params,N={dense0:S("dense0",!0),dense1:S("dense1"),dense2:S("dense2")};return yn(R,b),{params:N,paramMappings:b}}function Cs(R){var b=[],S=ln(R),N=S.extractWeights,z=S.getRemainingWeights,ae=Ka(N,b).extractDenseBlock3Params,me=ae(3,32,"dense0",!0),fe=ae(32,64,"dense1"),Ce=ae(64,128,"dense2");if(z().length!==0)throw new Error("weights remaing after extract: "+z().length);return{paramMappings:b,params:{dense0:me,dense1:fe,dense2:Ce}}}var tc=function(R){Object(L.c)(b,R);function b(){return R.call(this,"TinyFaceFeatureExtractor")||this}return b.prototype.forwardInput=function(S){var N=this.params;if(!N)throw new Error("TinyFaceFeatureExtractor - load model before inference");return j.L(function(){var z=S.toBatchTensor(112,!0),ae=[122.782,117.001,104.298],me=Ae(z,ae).div(j.y(255)),fe=ho(me,N.dense0,!0);return fe=ho(fe,N.dense1),fe=ho(fe,N.dense2),fe=j.d(fe,[14,14],[2,2],"valid"),fe})},b.prototype.forward=function(S){return Object(L.b)(this,void 0,void 0,function(){var N;return Object(L.d)(this,function(z){switch(z.label){case 0:return N=this.forwardInput,[4,Or(S)];case 1:return[2,N.apply(this,[z.sent()])]}})})},b.prototype.getDefaultModelName=function(){return"face_feature_extractor_tiny_model"},b.prototype.extractParamsFromWeigthMap=function(S){return qr(S)},b.prototype.extractParams=function(S){return Cs(S)},b}(gn),rc=function(R){Object(L.c)(b,R);function b(S){return S===void 0&&(S=new tc),R.call(this,"FaceLandmark68TinyNet",S)||this}return b.prototype.getDefaultModelName=function(){return"face_landmark_68_tiny_model"},b.prototype.getClassifierChannelsIn=function(){return 128},b}(_s),ad=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b}(Rr);function nc(R,b){return j.c(j.t(R,b.weights),b.biases)}function Li(R,b,S,N,z){z===void 0&&(z="same");var ae=b.conv,me=ae.filters,fe=ae.bias,Ce=j.i(R,me,S,z);return Ce=j.c(Ce,fe),Ce=nc(Ce,b.scale),N?j.w(Ce):Ce}function oc(R,b){return Li(R,b,[1,1],!0)}function Ts(R,b){return Li(R,b,[1,1],!1)}function Ss(R,b){return Li(R,b,[2,2],!0,"valid")}function ac(R,b){function S(fe,Ce,Ie){var De=R(fe),We=De.length/(Ce*Ie*Ie);if(Ge(We))throw new Error("depth has to be an integer: "+We+", weights.length: "+De.length+", numFilters: "+Ce+", filterSize: "+Ie);return j.L(function(){return j.N(j.K(De,[Ce,We,Ie,Ie]),[2,3,1,0])})}function N(fe,Ce,Ie,De){var We=S(fe,Ce,Ie),ze=j.H(R(Ce));return b.push({paramPath:De+"/filters"},{paramPath:De+"/bias"}),{filters:We,bias:ze}}function z(fe,Ce){var Ie=j.H(R(fe)),De=j.H(R(fe));return b.push({paramPath:Ce+"/weights"},{paramPath:Ce+"/biases"}),{weights:Ie,biases:De}}function ae(fe,Ce,Ie,De){var We=N(fe,Ce,Ie,De+"/conv"),ze=z(Ce,De+"/scale");return{conv:We,scale:ze}}function me(fe,Ce,Ie,De,We){We===void 0&&(We=!1);var ze=ae((We?.5:1)*fe,Ce,Ie,De+"/conv1"),qe=ae(fe,Ce,Ie,De+"/conv2");return{conv1:ze,conv2:qe}}return{extractConvLayerParams:ae,extractResidualLayerParams:me}}function ic(R){var b=ln(R),S=b.extractWeights,N=b.getRemainingWeights,z=[],ae=ac(S,z),me=ae.extractConvLayerParams,fe=ae.extractResidualLayerParams,Ce=me(4704,32,7,"conv32_down"),Ie=fe(9216,32,3,"conv32_1"),De=fe(9216,32,3,"conv32_2"),We=fe(9216,32,3,"conv32_3"),ze=fe(36864,64,3,"conv64_down",!0),qe=fe(36864,64,3,"conv64_1"),it=fe(36864,64,3,"conv64_2"),vt=fe(36864,64,3,"conv64_3"),wt=fe(147456,128,3,"conv128_down",!0),Ct=fe(147456,128,3,"conv128_1"),Dt=fe(147456,128,3,"conv128_2"),At=fe(589824,256,3,"conv256_down",!0),mt=fe(589824,256,3,"conv256_1"),_t=fe(589824,256,3,"conv256_2"),Wt=fe(589824,256,3,"conv256_down_out"),sr=j.L(function(){return j.N(j.I(S(256*128),[128,256]),[1,0])});if(z.push({paramPath:"fc"}),N().length!==0)throw new Error("weights remaing after extract: "+N().length);var vr={conv32_down:Ce,conv32_1:Ie,conv32_2:De,conv32_3:We,conv64_down:ze,conv64_1:qe,conv64_2:it,conv64_3:vt,conv128_down:wt,conv128_1:Ct,conv128_2:Dt,conv256_down:At,conv256_1:mt,conv256_2:_t,conv256_down_out:Wt,fc:sr};return{params:vr,paramMappings:z}}function da(R,b){var S=Sn(R,b);function N(me){var fe=S(me+"/scale/weights",1),Ce=S(me+"/scale/biases",1);return{weights:fe,biases:Ce}}function z(me){var fe=S(me+"/conv/filters",4),Ce=S(me+"/conv/bias",1),Ie=N(me);return{conv:{filters:fe,bias:Ce},scale:Ie}}function ae(me){return{conv1:z(me+"/conv1"),conv2:z(me+"/conv2")}}return{extractConvLayerParams:z,extractResidualLayerParams:ae}}function bn(R){var b=[],S=da(R,b),N=S.extractConvLayerParams,z=S.extractResidualLayerParams,ae=N("conv32_down"),me=z("conv32_1"),fe=z("conv32_2"),Ce=z("conv32_3"),Ie=z("conv64_down"),De=z("conv64_1"),We=z("conv64_2"),ze=z("conv64_3"),qe=z("conv128_down"),it=z("conv128_1"),vt=z("conv128_2"),wt=z("conv256_down"),Ct=z("conv256_1"),Dt=z("conv256_2"),At=z("conv256_down_out"),mt=R.fc;if(b.push({originalPath:"fc",paramPath:"fc"}),!xe(mt))throw new Error("expected weightMap[fc] to be a Tensor2D, instead have "+mt);var _t={conv32_down:ae,conv32_1:me,conv32_2:fe,conv32_3:Ce,conv64_down:Ie,conv64_1:De,conv64_2:We,conv64_3:ze,conv128_down:qe,conv128_1:it,conv128_2:vt,conv256_down:wt,conv256_1:Ct,conv256_2:Dt,conv256_down_out:At,fc:mt};return yn(R,b),{params:_t,paramMappings:b}}function dn(R,b){var S=oc(R,b.conv1);return S=Ts(S,b.conv2),S=j.c(S,R),S=j.w(S),S}function Oe(R,b){var S=Ss(R,b.conv1);S=Ts(S,b.conv2);var N=j.d(R,2,2,"valid"),z=j.P(N.shape),ae=N.shape[3]!==S.shape[3],me=N.shape[1]!==S.shape[1]||N.shape[2]!==S.shape[2];if(me){var fe=Object(L.e)(S.shape);fe[1]=1;var Ce=j.P(fe);S=j.h([S,Ce],1);var Ie=Object(L.e)(S.shape);Ie[2]=1;var De=j.P(Ie);S=j.h([S,De],2)}return N=ae?j.h([N,z],3):N,S=j.c(N,S),S=j.w(S),S}var yo=function(R){Object(L.c)(b,R);function b(){return R.call(this,"FaceRecognitionNet")||this}return b.prototype.forwardInput=function(S){var N=this.params;if(!N)throw new Error("FaceRecognitionNet - load model before inference");return j.L(function(){var z=S.toBatchTensor(150,!0).toFloat(),ae=[122.782,117.001,104.298],me=Ae(z,ae).div(j.y(256)),fe=Ss(me,N.conv32_down);fe=j.s(fe,3,2,"valid"),fe=dn(fe,N.conv32_1),fe=dn(fe,N.conv32_2),fe=dn(fe,N.conv32_3),fe=Oe(fe,N.conv64_down),fe=dn(fe,N.conv64_1),fe=dn(fe,N.conv64_2),fe=dn(fe,N.conv64_3),fe=Oe(fe,N.conv128_down),fe=dn(fe,N.conv128_1),fe=dn(fe,N.conv128_2),fe=Oe(fe,N.conv256_down),fe=dn(fe,N.conv256_1),fe=dn(fe,N.conv256_2),fe=Oe(fe,N.conv256_down_out);var Ce=fe.mean([1,2]),Ie=j.q(Ce,N.fc);return Ie})},b.prototype.forward=function(S){return Object(L.b)(this,void 0,void 0,function(){var N;return Object(L.d)(this,function(z){switch(z.label){case 0:return N=this.forwardInput,[4,Or(S)];case 1:return[2,N.apply(this,[z.sent()])]}})})},b.prototype.computeFaceDescriptor=function(S){return Object(L.b)(this,void 0,void 0,function(){var N,z,ae,me=this;return Object(L.d)(this,function(fe){switch(fe.label){case 0:return[4,Or(S)];case 1:return N=fe.sent(),z=j.L(function(){return j.O(me.forwardInput(N))}),[4,Promise.all(z.map(function(Ce){return Ce.data()}))];case 2:return ae=fe.sent(),z.forEach(function(Ce){return Ce.dispose()}),[2,N.isBatchInput?ae:ae[0]]}})})},b.prototype.getDefaultModelName=function(){return"face_recognition_model"},b.prototype.extractParamsFromWeigthMap=function(S){return bn(S)},b.prototype.extractParams=function(S){return ic(S)},b}(gn);function ji(R){var b=new yo;return b.extractWeights(R),b}function Qa(R,b){var S={descriptor:b};return Object.assign({},R,S)}function Gr(R){return typeof R.age=="number"}function Vr(R,b){var S={age:b};return Object.assign({},R,S)}function on(R){return(R.gender===Fo.MALE||R.gender===Fo.FEMALE)&&ot(R.genderProbability)}function sn(R,b,S){var N={gender:b,genderProbability:S};return Object.assign({},R,N)}var bo=function(){function R(b){var S=b===void 0?{}:b,N=S.minFaceSize,z=S.scaleFactor,ae=S.maxNumScales,me=S.scoreThresholds,fe=S.scaleSteps;if(this._name="MtcnnOptions",this._minFaceSize=N||20,this._scaleFactor=z||.709,this._maxNumScales=ae||10,this._scoreThresholds=me||[.6,.7,.7],this._scaleSteps=fe,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(Ce){return typeof Ce!="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(Ce){return typeof Ce!="number"})))throw new Error(this._name+" - expected scaleSteps to be an array of numbers")}return Object.defineProperty(R.prototype,"minFaceSize",{get:function(){return this._minFaceSize},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"scaleFactor",{get:function(){return this._scaleFactor},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"maxNumScales",{get:function(){return this._maxNumScales},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"scoreThresholds",{get:function(){return this._scoreThresholds},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"scaleSteps",{get:function(){return this._scaleSteps},enumerable:!0,configurable:!0}),R}();function fn(R,b){function S(Ce,Ie){var De=j.K(R(3*3*Ce),[3,3,Ce,1]),We=j.H(R(Ce)),ze=j.H(R(Ce)),qe=j.H(R(Ce)),it=j.H(R(Ce));return b.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:De,batch_norm_scale:We,batch_norm_offset:ze,batch_norm_mean:qe,batch_norm_variance:it}}function N(Ce,Ie,De,We,ze){var qe=j.K(R(Ce*Ie*De*De),[De,De,Ce,Ie]),it=j.H(R(Ie));return b.push({paramPath:We+"/filters"},{paramPath:We+"/"+(ze?"batch_norm_offset":"bias")}),{filters:qe,bias:it}}function z(Ce,Ie,De,We){var ze=N(Ce,Ie,De,We,!0),qe=ze.filters,it=ze.bias;return{filters:qe,batch_norm_offset:it}}function ae(Ce,Ie,De){var We=S(Ce,De+"/depthwise_conv"),ze=z(Ce,Ie,1,De+"/pointwise_conv");return{depthwise_conv:We,pointwise_conv:ze}}function me(){var Ce=z(3,32,3,"mobilenetv1/conv_0"),Ie=ae(32,64,"mobilenetv1/conv_1"),De=ae(64,128,"mobilenetv1/conv_2"),We=ae(128,128,"mobilenetv1/conv_3"),ze=ae(128,256,"mobilenetv1/conv_4"),qe=ae(256,256,"mobilenetv1/conv_5"),it=ae(256,512,"mobilenetv1/conv_6"),vt=ae(512,512,"mobilenetv1/conv_7"),wt=ae(512,512,"mobilenetv1/conv_8"),Ct=ae(512,512,"mobilenetv1/conv_9"),Dt=ae(512,512,"mobilenetv1/conv_10"),At=ae(512,512,"mobilenetv1/conv_11"),mt=ae(512,1024,"mobilenetv1/conv_12"),_t=ae(1024,1024,"mobilenetv1/conv_13");return{conv_0:Ce,conv_1:Ie,conv_2:De,conv_3:We,conv_4:ze,conv_5:qe,conv_6:it,conv_7:vt,conv_8:wt,conv_9:Ct,conv_10:Dt,conv_11:At,conv_12:mt,conv_13:_t}}function fe(){var Ce=z(1024,256,1,"prediction_layer/conv_0"),Ie=z(256,512,3,"prediction_layer/conv_1"),De=z(512,128,1,"prediction_layer/conv_2"),We=z(128,256,3,"prediction_layer/conv_3"),ze=z(256,128,1,"prediction_layer/conv_4"),qe=z(128,256,3,"prediction_layer/conv_5"),it=z(256,64,1,"prediction_layer/conv_6"),vt=z(64,128,3,"prediction_layer/conv_7"),wt=N(512,12,1,"prediction_layer/box_predictor_0/box_encoding_predictor"),Ct=N(512,9,1,"prediction_layer/box_predictor_0/class_predictor"),Dt=N(1024,24,1,"prediction_layer/box_predictor_1/box_encoding_predictor"),At=N(1024,18,1,"prediction_layer/box_predictor_1/class_predictor"),mt=N(512,24,1,"prediction_layer/box_predictor_2/box_encoding_predictor"),_t=N(512,18,1,"prediction_layer/box_predictor_2/class_predictor"),Wt=N(256,24,1,"prediction_layer/box_predictor_3/box_encoding_predictor"),sr=N(256,18,1,"prediction_layer/box_predictor_3/class_predictor"),vr=N(256,24,1,"prediction_layer/box_predictor_4/box_encoding_predictor"),or=N(256,18,1,"prediction_layer/box_predictor_4/class_predictor"),Gt=N(128,24,1,"prediction_layer/box_predictor_5/box_encoding_predictor"),Ut=N(128,18,1,"prediction_layer/box_predictor_5/class_predictor"),kr={box_encoding_predictor:wt,class_predictor:Ct},lr={box_encoding_predictor:Dt,class_predictor:At},Xr={box_encoding_predictor:mt,class_predictor:_t},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:Ce,conv_1:Ie,conv_2:De,conv_3:We,conv_4:ze,conv_5:qe,conv_6:it,conv_7:vt,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:me,extractPredictionLayerParams:fe}}function Fi(R){var b=[],S=ln(R),N=S.extractWeights,z=S.getRemainingWeights,ae=fn(N,b),me=ae.extractMobilenetV1Params,fe=ae.extractPredictionLayerParams,Ce=me(),Ie=fe(),De=j.J(N(5118*4),[1,5118,4]),We={extra_dim:De};if(b.push({paramPath:"output_layer/extra_dim"}),z().length!==0)throw new Error("weights remaing after extract: "+z().length);return{params:{mobilenetv1:Ce,prediction_layer:Ie,output_layer:We},paramMappings:b}}function qn(R,b){var S=Sn(R,b);function N(Ie,De,We){var ze=S(Ie+"/Conv2d_"+De+"_pointwise/weights",4,We+"/filters"),qe=S(Ie+"/Conv2d_"+De+"_pointwise/convolution_bn_offset",1,We+"/batch_norm_offset");return{filters:ze,batch_norm_offset:qe}}function z(Ie){var De="mobilenetv1/conv_"+Ie,We="MobilenetV1/Conv2d_"+Ie+"_depthwise",ze=De+"/depthwise_conv",qe=De+"/pointwise_conv",it=S(We+"/depthwise_weights",4,ze+"/filters"),vt=S(We+"/BatchNorm/gamma",1,ze+"/batch_norm_scale"),wt=S(We+"/BatchNorm/beta",1,ze+"/batch_norm_offset"),Ct=S(We+"/BatchNorm/moving_mean",1,ze+"/batch_norm_mean"),Dt=S(We+"/BatchNorm/moving_variance",1,ze+"/batch_norm_variance");return{depthwise_conv:{filters:it,batch_norm_scale:vt,batch_norm_offset:wt,batch_norm_mean:Ct,batch_norm_variance:Dt},pointwise_conv:N("MobilenetV1",Ie,qe)}}function ae(){return{conv_0:N("MobilenetV1",0,"mobilenetv1/conv_0"),conv_1:z(1),conv_2:z(2),conv_3:z(3),conv_4:z(4),conv_5:z(5),conv_6:z(6),conv_7:z(7),conv_8:z(8),conv_9:z(9),conv_10:z(10),conv_11:z(11),conv_12:z(12),conv_13:z(13)}}function me(Ie,De){var We=S(Ie+"/weights",4,De+"/filters"),ze=S(Ie+"/biases",1,De+"/bias");return{filters:We,bias:ze}}function fe(Ie){var De=me("Prediction/BoxPredictor_"+Ie+"/BoxEncodingPredictor","prediction_layer/box_predictor_"+Ie+"/box_encoding_predictor"),We=me("Prediction/BoxPredictor_"+Ie+"/ClassPredictor","prediction_layer/box_predictor_"+Ie+"/class_predictor");return{box_encoding_predictor:De,class_predictor:We}}function Ce(){return{conv_0:N("Prediction",0,"prediction_layer/conv_0"),conv_1:N("Prediction",1,"prediction_layer/conv_1"),conv_2:N("Prediction",2,"prediction_layer/conv_2"),conv_3:N("Prediction",3,"prediction_layer/conv_3"),conv_4:N("Prediction",4,"prediction_layer/conv_4"),conv_5:N("Prediction",5,"prediction_layer/conv_5"),conv_6:N("Prediction",6,"prediction_layer/conv_6"),conv_7:N("Prediction",7,"prediction_layer/conv_7"),box_predictor_0:fe(0),box_predictor_1:fe(1),box_predictor_2:fe(2),box_predictor_3:fe(3),box_predictor_4:fe(4),box_predictor_5:fe(5)}}return{extractMobilenetV1Params:ae,extractPredictionLayerParams:Ce}}function Ke(R){var b=[],S=qn(R,b),N=S.extractMobilenetV1Params,z=S.extractPredictionLayerParams,ae=R["Output/extra_dim"];if(b.push({originalPath:"Output/extra_dim",paramPath:"output_layer/extra_dim"}),!Ne(ae))throw new Error("expected weightMap['Output/extra_dim'] to be a Tensor3D, instead have "+ae);var me={mobilenetv1:N(),prediction_layer:z(),output_layer:{extra_dim:ae}};return yn(R,b),{params:me,paramMappings:b}}function xr(R,b,S){return j.L(function(){var N=j.i(R,b.filters,S,"same");return N=j.c(N,b.batch_norm_offset),j.g(N,0,6)})}var un=.0010000000474974513;function xn(R,b,S){return j.L(function(){var N=j.j(R,b.filters,S,"same");return N=j.e(N,b.batch_norm_mean,b.batch_norm_variance,b.batch_norm_offset,b.batch_norm_scale,un),j.g(N,0,6)})}function Ur(R){return[2,4,6,12].some(function(b){return b===R})?[2,2]:[1,1]}function Nn(R,b){return j.L(function(){var S=null,N=xr(R,b.conv_0,[2,2]),z=[b.conv_1,b.conv_2,b.conv_3,b.conv_4,b.conv_5,b.conv_6,b.conv_7,b.conv_8,b.conv_9,b.conv_10,b.conv_11,b.conv_12,b.conv_13];if(z.forEach(function(ae,me){var fe=me+1,Ce=Ur(fe);N=xn(N,ae.depthwise_conv,Ce),N=xr(N,ae.pointwise_conv,[1,1]),fe===11&&(S=N)}),S===null)throw new Error("mobileNetV1 - output of conv layer 11 is null");return{out:N,conv11:S}})}function It(R,b,S,N,z){var ae=R.shape[0],me=Math.min(S,ae),fe=b.map(function(De,We){return{score:De,boxIndex:We}}).filter(function(De){return De.score>z}).sort(function(De,We){return We.score-De.score}),Ce=function(De){return De<=N?1:0},Ie=[];return fe.forEach(function(De){if(Ie.length>=me)return;for(var We=De.score,ze=Ie.length-1;ze>=0;--ze){var qe=Qn(R,De.boxIndex,Ie[ze]);if(qe===0)continue;if(De.score*=Ce(qe),De.score<=z)break}We===De.score&&Ie.push(De.boxIndex)}),Ie}function Qn(R,b,S){var N=R.arraySync(),z=Math.min(N[b][0],N[b][2]),ae=Math.min(N[b][1],N[b][3]),me=Math.max(N[b][0],N[b][2]),fe=Math.max(N[b][1],N[b][3]),Ce=Math.min(N[S][0],N[S][2]),Ie=Math.min(N[S][1],N[S][3]),De=Math.max(N[S][0],N[S][2]),We=Math.max(N[S][1],N[S][3]),ze=(me-z)*(fe-ae),qe=(De-Ce)*(We-Ie);if(ze<=0||qe<=0)return 0;var it=Math.max(z,Ce),vt=Math.max(ae,Ie),wt=Math.min(me,De),Ct=Math.min(fe,We),Dt=Math.max(wt-it,0)*Math.max(Ct-vt,0);return Dt/(ze+qe-Dt)}function Zn(R){var b=j.O(j.N(R,[1,0])),S=[j.F(b[2],b[0]),j.F(b[3],b[1])],N=[j.c(b[0],j.k(S[0],j.y(2))),j.c(b[1],j.k(S[1],j.y(2)))];return{sizes:S,centers:N}}function Za(R,b){var S=Zn(R),N=S.sizes,z=S.centers,ae=j.O(j.N(b,[1,0])),me=j.k(j.t(j.l(j.k(ae[2],j.y(5))),N[0]),j.y(2)),fe=j.c(j.t(j.k(ae[0],j.y(10)),N[0]),z[0]),Ce=j.k(j.t(j.l(j.k(ae[3],j.y(5))),N[1]),j.y(2)),Ie=j.c(j.t(j.k(ae[1],j.y(10)),N[1]),z[1]);return j.N(j.E([j.F(fe,me),j.F(Ie,Ce),j.c(fe,me),j.c(Ie,Ce)]),[1,0])}function kn(R,b,S){return j.L(function(){var N=R.shape[0],z=Za(j.x(j.M(S.extra_dim,[N,1,1]),[-1,4]),j.x(R,[-1,4]));z=j.x(z,[N,z.shape[0]/N,4]);var ae=j.A(j.B(b,[0,0,1],[-1,-1,-1])),me=j.B(ae,[0,0,0],[-1,-1,1]);me=j.x(me,[N,me.shape[1]]);var fe=j.O(z),Ce=j.O(me);return{boxes:fe,scores:Ce}})}function xo(R,b){return j.L(function(){var S=R.shape[0],N=j.x(an(R,b.box_encoding_predictor),[S,-1,1,4]),z=j.x(an(R,b.class_predictor),[S,-1,3]);return{boxPredictionEncoding:N,classPrediction:z}})}function As(R,b,S){return j.L(function(){var N=xr(R,S.conv_0,[1,1]),z=xr(N,S.conv_1,[2,2]),ae=xr(z,S.conv_2,[1,1]),me=xr(ae,S.conv_3,[2,2]),fe=xr(me,S.conv_4,[1,1]),Ce=xr(fe,S.conv_5,[2,2]),Ie=xr(Ce,S.conv_6,[1,1]),De=xr(Ie,S.conv_7,[2,2]),We=xo(b,S.box_predictor_0),ze=xo(R,S.box_predictor_1),qe=xo(z,S.box_predictor_2),it=xo(me,S.box_predictor_3),vt=xo(Ce,S.box_predictor_4),wt=xo(De,S.box_predictor_5),Ct=j.h([We.boxPredictionEncoding,ze.boxPredictionEncoding,qe.boxPredictionEncoding,it.boxPredictionEncoding,vt.boxPredictionEncoding,wt.boxPredictionEncoding],1),Dt=j.h([We.classPrediction,ze.classPrediction,qe.classPrediction,it.classPrediction,vt.classPrediction,wt.classPrediction],1);return{boxPredictions:Ct,classPredictions:Dt}})}var wo=function(){function R(b){var S=b===void 0?{}:b,N=S.minConfidence,z=S.maxResults;if(this._name="SsdMobilenetv1Options",this._minConfidence=N||.5,this._maxResults=z||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(R.prototype,"minConfidence",{get:function(){return this._minConfidence},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"maxResults",{get:function(){return this._maxResults},enumerable:!0,configurable:!0}),R}(),Mn=function(R){Object(L.c)(b,R);function b(){return R.call(this,"SsdMobilenetv1")||this}return b.prototype.forwardInput=function(S){var N=this.params;if(!N)throw new Error("SsdMobilenetv1 - load model before inference");return j.L(function(){var z=S.toBatchTensor(512,!1).toFloat(),ae=j.F(j.t(z,j.y(.007843137718737125)),j.y(1)),me=Nn(ae,N.mobilenetv1),fe=As(me.out,me.conv11,N.prediction_layer),Ce=fe.boxPredictions,Ie=fe.classPredictions;return kn(Ce,Ie,N.output_layer)})},b.prototype.forward=function(S){return Object(L.b)(this,void 0,void 0,function(){var N;return Object(L.d)(this,function(z){switch(z.label){case 0:return N=this.forwardInput,[4,Or(S)];case 1:return[2,N.apply(this,[z.sent()])]}})})},b.prototype.locateFaces=function(S,N){return N===void 0&&(N={}),Object(L.b)(this,void 0,void 0,function(){var z,ae,me,fe,Ce,Ie,De,We,ze,qe,it,vt,wt,Ct,Dt,At,mt,_t,Wt,sr,vr;return Object(L.d)(this,function(or){switch(or.label){case 0:return z=new wo(N),ae=z.maxResults,me=z.minConfidence,[4,Or(S)];case 1:for(fe=or.sent(),Ce=this.forwardInput(fe),Ie=Ce.boxes,De=Ce.scores,We=Ie[0],ze=De[0],qe=1;qe<Ie.length;qe++)Ie[qe].dispose(),De[qe].dispose();return wt=(vt=Array).from,[4,ze.data()];case 2:return it=wt.apply(vt,[or.sent()]),Ct=.5,Dt=It(We,it,ae,Ct,me),At=fe.getReshapedInputDimensions(0),mt=fe.inputSize,_t=mt/At.width,Wt=mt/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*_t}),Yr=Xr[0],Rt=Xr[1];return new Z(it[Gt],new Tt(Yr,kr,Rt-Yr,lr-kr),{height:fe.getInputHeight(0),width:fe.getInputWidth(0)})}),We.dispose(),ze.dispose(),[2,vr]}})})},b.prototype.getDefaultModelName=function(){return"ssd_mobilenetv1_model"},b.prototype.extractParamsFromWeigthMap=function(S){return Ke(S)},b.prototype.extractParams=function(S){return Fi(S)},b}(gn);function Tr(R){var b=new Mn;return b.extractWeights(R),b}function ei(R){return Tr(R)}var sc=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b}(Mn),fa=.4,Bi=[new ve(.738768,.874946),new ve(2.42204,2.65704),new ve(4.30971,7.04493),new ve(10.246,4.59428),new ve(12.6868,11.8741)],Jt=[new ve(1.603231,2.094468),new ve(6.041143,7.080126),new ve(2.882459,3.518061),new ve(4.266906,5.178857),new ve(9.041765,10.66308)],hn=[117.001,114.697,97.404],Os="tiny_yolov2_model",Rs="tiny_yolov2_separable_conv_model",ha=function(R){return typeof R=="number"};function Is(R){if(!R)throw new Error("invalid config: "+R);if(typeof R.withSeparableConvs!="boolean")throw new Error("config.withSeparableConvs has to be a boolean, have: "+R.withSeparableConvs);if(!ha(R.iouThreshold)||R.iouThreshold<0||R.iouThreshold>1)throw new Error("config.iouThreshold has to be a number between [0, 1], have: "+R.iouThreshold);if(!Array.isArray(R.classes)||!R.classes.length||!R.classes.every(function(b){return typeof b=="string"}))throw new Error("config.classes has to be an array class names: string[], have: "+JSON.stringify(R.classes));if(!Array.isArray(R.anchors)||!R.anchors.length||!R.anchors.map(function(b){return b||{}}).every(function(b){return ha(b.x)&&ha(b.y)}))throw new Error("config.anchors has to be an array of { x: number, y: number }, have: "+JSON.stringify(R.anchors));if(R.meanRgb&&(!Array.isArray(R.meanRgb)||R.meanRgb.length!==3||!R.meanRgb.every(ha)))throw new Error("config.meanRgb has to be an array of shape [number, number, number], have: "+JSON.stringify(R.meanRgb))}function Bo(R){return j.L(function(){var b=j.t(R,j.y(.10000000149011612));return j.c(j.w(j.F(R,b)),b)})}function Qr(R,b){return j.L(function(){var S=j.v(R,[[0,0],[1,1],[1,1],[0,0]]);return S=j.i(S,b.conv.filters,[1,1],"valid"),S=j.F(S,b.bn.sub),S=j.t(S,b.bn.truediv),S=j.c(S,b.conv.bias),Bo(S)})}function Pn(R,b){return j.L(function(){var S=j.v(R,[[0,0],[1,1],[1,1],[0,0]]);return S=j.z(S,b.depthwise_filter,b.pointwise_filter,[1,1],"valid"),S=j.c(S,b.bias),Bo(S)})}function Ds(R,b){var S=Jn(R,b);function N(me,fe){var Ce=j.H(R(me)),Ie=j.H(R(me));return b.push({paramPath:fe+"/sub"},{paramPath:fe+"/truediv"}),{sub:Ce,truediv:Ie}}function z(me,fe,Ce){var Ie=S(me,fe,3,Ce+"/conv"),De=N(fe,Ce+"/bn");return{conv:Ie,bn:De}}var ae=oa(R,b);return{extractConvParams:S,extractConvWithBatchNormParams:z,extractSeparableConvParams:ae}}function Ns(R,b,S,N){var z=ln(R),ae=z.extractWeights,me=z.getRemainingWeights,fe=[],Ce=Ds(ae,fe),Ie=Ce.extractConvParams,De=Ce.extractConvWithBatchNormParams,We=Ce.extractSeparableConvParams,ze;if(b.withSeparableConvs){var qe=N[0],it=N[1],vt=N[2],wt=N[3],Ct=N[4],Dt=N[5],At=N[6],mt=N[7],_t=N[8],Wt=b.isFirstLayerConv2d?Ie(qe,it,3,"conv0"):We(qe,it,"conv0"),sr=We(it,vt,"conv1"),vr=We(vt,wt,"conv2"),or=We(wt,Ct,"conv3"),Gt=We(Ct,Dt,"conv4"),Ut=We(Dt,At,"conv5"),kr=mt?We(At,mt,"conv6"):void 0,lr=_t?We(mt,_t,"conv7"):void 0,Xr=Ie(_t||mt||At,5*S,1,"conv8");ze={conv0:Wt,conv1:sr,conv2:vr,conv3:or,conv4:Gt,conv5:Ut,conv6:kr,conv7:lr,conv8:Xr}}else{var qe=N[0],it=N[1],vt=N[2],wt=N[3],Ct=N[4],Dt=N[5],At=N[6],mt=N[7],_t=N[8],Wt=De(qe,it,"conv0"),sr=De(it,vt,"conv1"),vr=De(vt,wt,"conv2"),or=De(wt,Ct,"conv3"),Gt=De(Ct,Dt,"conv4"),Ut=De(Dt,At,"conv5"),kr=De(At,mt,"conv6"),lr=De(mt,_t,"conv7"),Xr=Ie(_t,5*S,1,"conv8");ze={conv0:Wt,conv1:sr,conv2:vr,conv3:or,conv4:Gt,conv5:Ut,conv6:kr,conv7:lr,conv8:Xr}}if(me().length!==0)throw new Error("weights remaing after extract: "+me().length);return{params:ze,paramMappings:fe}}function ks(R,b){var S=Sn(R,b);function N(fe){var Ce=S(fe+"/sub",1),Ie=S(fe+"/truediv",1);return{sub:Ce,truediv:Ie}}function z(fe){var Ce=S(fe+"/filters",4),Ie=S(fe+"/bias",1);return{filters:Ce,bias:Ie}}function ae(fe){var Ce=z(fe+"/conv"),Ie=N(fe+"/bn");return{conv:Ce,bn:Ie}}var me=aa(S);return{extractConvParams:z,extractConvWithBatchNormParams:ae,extractSeparableConvParams:me}}function Ms(R,b){var S=[],N=ks(R,S),z=N.extractConvParams,ae=N.extractConvWithBatchNormParams,me=N.extractSeparableConvParams,fe;if(b.withSeparableConvs){var Ce=b.filterSizes&&b.filterSizes.length||9;fe={conv0:b.isFirstLayerConv2d?z("conv0"):me("conv0"),conv1:me("conv1"),conv2:me("conv2"),conv3:me("conv3"),conv4:me("conv4"),conv5:me("conv5"),conv6:Ce>7?me("conv6"):void 0,conv7:Ce>8?me("conv7"):void 0,conv8:z("conv8")}}else fe={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:z("conv8")};return yn(R,S),{params:fe,paramMappings:S}}var Ui;(function(R){R[R.XS=224]="XS",R[R.SM=320]="SM",R[R.MD=416]="MD",R[R.LG=608]="LG"})(Ui||(Ui={}));var wn=function(){function R(b){var S=b===void 0?{}:b,N=S.inputSize,z=S.scoreThreshold;if(this._name="TinyYolov2Options",this._inputSize=N||416,this._scoreThreshold=z||.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(R.prototype,"inputSize",{get:function(){return this._inputSize},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"scoreThreshold",{get:function(){return this._scoreThreshold},enumerable:!0,configurable:!0}),R}(),Uo=function(R){Object(L.c)(b,R);function b(S){var N=R.call(this,"TinyYolov2")||this;return Is(S),N._config=S,N}return Object.defineProperty(b.prototype,"config",{get:function(){return this._config},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"withClassScores",{get:function(){return this.config.withClassScores||this.config.classes.length>1},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"boxEncodingSize",{get:function(){return 5+(this.withClassScores?this.config.classes.length:0)},enumerable:!0,configurable:!0}),b.prototype.runTinyYolov2=function(S,N){var z=Qr(S,N.conv0);return z=j.s(z,[2,2],[2,2],"same"),z=Qr(z,N.conv1),z=j.s(z,[2,2],[2,2],"same"),z=Qr(z,N.conv2),z=j.s(z,[2,2],[2,2],"same"),z=Qr(z,N.conv3),z=j.s(z,[2,2],[2,2],"same"),z=Qr(z,N.conv4),z=j.s(z,[2,2],[2,2],"same"),z=Qr(z,N.conv5),z=j.s(z,[2,2],[1,1],"same"),z=Qr(z,N.conv6),z=Qr(z,N.conv7),an(z,N.conv8,"valid",!1)},b.prototype.runMobilenet=function(S,N){var z=this.config.isFirstLayerConv2d?Bo(an(S,N.conv0,"valid",!1)):Pn(S,N.conv0);return z=j.s(z,[2,2],[2,2],"same"),z=Pn(z,N.conv1),z=j.s(z,[2,2],[2,2],"same"),z=Pn(z,N.conv2),z=j.s(z,[2,2],[2,2],"same"),z=Pn(z,N.conv3),z=j.s(z,[2,2],[2,2],"same"),z=Pn(z,N.conv4),z=j.s(z,[2,2],[2,2],"same"),z=Pn(z,N.conv5),z=j.s(z,[2,2],[1,1],"same"),z=N.conv6?Pn(z,N.conv6):z,z=N.conv7?Pn(z,N.conv7):z,an(z,N.conv8,"valid",!1)},b.prototype.forwardInput=function(S,N){var z=this,ae=this.params;if(!ae)throw new Error("TinyYolov2 - load model before inference");return j.L(function(){var me=S.toBatchTensor(N,!1).toFloat();return me=z.config.meanRgb?Ae(me,z.config.meanRgb):me,me=me.div(j.y(256)),z.config.withSeparableConvs?z.runMobilenet(me,ae):z.runTinyYolov2(me,ae)})},b.prototype.forward=function(S,N){return Object(L.b)(this,void 0,void 0,function(){var z;return Object(L.d)(this,function(ae){switch(ae.label){case 0:return z=this.forwardInput,[4,Or(S)];case 1:return[4,z.apply(this,[ae.sent(),N])];case 2:return[2,ae.sent()]}})})},b.prototype.detect=function(S,N){return N===void 0&&(N={}),Object(L.b)(this,void 0,void 0,function(){var z,ae,me,fe,Ce,Ie,De,We,ze,qe,it,vt,wt,Ct,Dt=this;return Object(L.d)(this,function(At){switch(At.label){case 0:return z=new wn(N),ae=z.inputSize,me=z.scoreThreshold,[4,Or(S)];case 1:return fe=At.sent(),[4,this.forwardInput(fe,ae)];case 2:return Ce=At.sent(),Ie=j.L(function(){return j.O(Ce)[0].expandDims()}),De={width:fe.getInputWidth(0),height:fe.getInputHeight(0)},[4,this.extractBoxes(Ie,fe.getReshapedInputDimensions(0),me)];case 3:return We=At.sent(),Ce.dispose(),Ie.dispose(),ze=We.map(function(mt){return mt.box}),qe=We.map(function(mt){return mt.score}),it=We.map(function(mt){return mt.classScore}),vt=We.map(function(mt){return Dt.config.classes[mt.label]}),wt=Re(ze.map(function(mt){return mt.rescale(ae)}),qe,this.config.iouThreshold,!0),Ct=wt.map(function(mt){return new pe(qe[mt],it[mt],vt[mt],ze[mt],De)}),[2,Ct]}})})},b.prototype.getDefaultModelName=function(){return""},b.prototype.extractParamsFromWeigthMap=function(S){return Ms(S,this.config)},b.prototype.extractParams=function(S){var N=this.config.filterSizes||b.DEFAULT_FILTER_SIZES,z=N?N.length:void 0;if(z!==7&&z!==8&&z!==9)throw new Error("TinyYolov2 - expected 7 | 8 | 9 convolutional filters, but found "+z+" filterSizes in config");return Ns(S,this.config,this.boxEncodingSize,N)},b.prototype.extractBoxes=function(S,N,z){return Object(L.b)(this,void 0,void 0,function(){var ae,me,fe,Ce,Ie,De,We,ze,qe,it,vt,wt,Ct,Dt,At,mt,_t,Wt,sr,vr,or,Gt,Ut,kr,lr,Xr,Yr,Rt,tn,ur=this;return Object(L.d)(this,function(_r){switch(_r.label){case 0:return ae=N.width,me=N.height,fe=Math.max(ae,me),Ce=fe/ae,Ie=fe/me,De=S.shape[1],We=this.config.anchors.length,ze=j.L(function(){var Un=S.reshape([De,De,We,ur.boxEncodingSize]),Rn=Un.slice([0,0,0,0],[De,De,We,4]),Ko=Un.slice([0,0,0,4],[De,De,We,1]),Wn=ur.withClassScores?j.D(Un.slice([0,0,0,5],[De,De,We,ur.config.classes.length]),3):j.y(0);return[Rn,Ko,Wn]}),qe=ze[0],it=ze[1],vt=ze[2],wt=[],[4,it.array()];case 1:return Ct=_r.sent(),[4,qe.array()];case 2:Dt=_r.sent(),At=0,_r.label=3;case 3:if(!(At<De))return[3,12];mt=0,_r.label=4;case 4:if(!(mt<De))return[3,11];_t=0,_r.label=5;case 5:return _t<We?(Wt=lt(Ct[At][mt][_t][0]),!z||Wt>z?(sr=(mt+lt(Dt[At][mt][_t][0]))/De*Ce,vr=(At+lt(Dt[At][mt][_t][1]))/De*Ie,or=Math.exp(Dt[At][mt][_t][2])*this.config.anchors[_t].x/De*Ce,Gt=Math.exp(Dt[At][mt][_t][3])*this.config.anchors[_t].y/De*Ie,Ut=sr-or/2,kr=vr-Gt/2,lr={row:At,col:mt,anchor:_t},this.withClassScores?[4,this.extractPredictedClass(vt,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,wt.push(Object(L.a)({box:new $e(Ut,kr,Ut+or,kr+Gt),score:Wt,classScore:Wt*Yr,label:Rt},lr)),_r.label=9;case 9:return _t++,[3,5];case 10:return mt++,[3,4];case 11:return At++,[3,3];case 12:return qe.dispose(),it.dispose(),vt.dispose(),[2,wt]}})})},b.prototype.extractPredictedClass=function(S,N){return Object(L.b)(this,void 0,void 0,function(){var z,ae,me,fe;return Object(L.d)(this,function(Ce){switch(Ce.label){case 0:return z=N.row,ae=N.col,me=N.anchor,[4,S.array()];case 1:return fe=Ce.sent(),[2,Array(this.config.classes.length).fill(0).map(function(Ie,De){return fe[z][ae][me][De]}).map(function(Ie,De){return{classScore:Ie,label:De}}).reduce(function(Ie,De){return Ie.classScore>De.classScore?Ie:De})]}})})},b.DEFAULT_FILTER_SIZES=[3,16,32,64,128,256,512,1024,1024],b}(gn),pa=function(R){Object(L.c)(b,R);function b(S){S===void 0&&(S=!0);var N=this,z=Object.assign({},{withSeparableConvs:S,iouThreshold:fa,classes:["face"]},S?{anchors:Jt,meanRgb:hn}:{anchors:Bi,withClassScores:!0});return N=R.call(this,z)||this,N}return Object.defineProperty(b.prototype,"withSeparableConvs",{get:function(){return this.config.withSeparableConvs},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"anchors",{get:function(){return this.config.anchors},enumerable:!0,configurable:!0}),b.prototype.locateFaces=function(S,N){return Object(L.b)(this,void 0,void 0,function(){var z;return Object(L.d)(this,function(ae){switch(ae.label){case 0:return[4,this.detect(S,N)];case 1:return z=ae.sent(),[2,z.map(function(me){return new Z(me.score,me.relativeBox,{width:me.imageWidth,height:me.imageHeight})})]}})})},b.prototype.getDefaultModelName=function(){return this.withSeparableConvs?Rs:Os},b.prototype.extractParamsFromWeigthMap=function(S){return R.prototype.extractParamsFromWeigthMap.call(this,S)},b}(Uo);function uc(R,b){b===void 0&&(b=!0);var S=new pa(b);return S.extractWeights(R),S}var Wi=function(R){Object(L.c)(b,R);function b(){var S=R!==null&&R.apply(this,arguments)||this;return S._name="TinyFaceDetectorOptions",S}return b}(wn),jt=function(){function R(){}return R.prototype.then=function(b){return Object(L.b)(this,void 0,void 0,function(){var S;return Object(L.d)(this,function(N){switch(N.label){case 0:return S=b,[4,this.run()];case 1:return[2,S.apply(void 0,[N.sent()])]}})})},R.prototype.run=function(){return Object(L.b)(this,void 0,void 0,function(){return Object(L.d)(this,function(b){throw new Error("ComposableTask - run is not implemented")})})},R}();function ma(R,b,S,N,z){return z===void 0&&(z=function(ae){var me=ae.alignedRect;return me}),Object(L.b)(this,void 0,void 0,function(){var ae,me,fe,Ce,Ie;return Object(L.d)(this,function(De){switch(De.label){case 0:return ae=R.map(function(We){return ca(We)?z(We):We.detection}),fe=N,fe?[3,5]:b instanceof j.a?[4,Po(b,ae)]:[3,2];case 1:return Ce=De.sent(),[3,4];case 2:return[4,$n(b,ae)];case 3:Ce=De.sent(),De.label=4;case 4:fe=Ce,De.label=5;case 5:return me=fe,[4,S(me)];case 6:return Ie=De.sent(),me.forEach(function(We){return We instanceof j.a&&We.dispose()}),[2,Ie]}})})}function va(R,b,S,N,z){return Object(L.b)(this,void 0,void 0,function(){var ae=this;return Object(L.d)(this,function(me){return[2,ma([R],b,function(fe){return Object(L.b)(ae,void 0,void 0,function(){return Object(L.d)(this,function(Ce){return[2,S(fe[0])]})})},N,z)]})})}function Ps(R){return j.L(function(){return j.E(j.O(R,3).reverse(),3)})}var ga=2,ya=12;function Ls(R,b){var S=Jn(R,b),N=na(R,b);function z(Ie,De){var We=j.H(R(Ie));return b.push({paramPath:De}),We}function ae(Ie,De,We){We===void 0&&(We=!1);var ze=S(Ie[0],Ie[1],3,De+"/conv1"),qe=z(Ie[1],De+"/prelu1_alpha"),it=S(Ie[1],Ie[2],3,De+"/conv2"),vt=z(Ie[2],De+"/prelu2_alpha"),wt=S(Ie[2],Ie[3],We?2:3,De+"/conv3"),Ct=z(Ie[3],De+"/prelu3_alpha");return{conv1:ze,prelu1_alpha:qe,conv2:it,prelu2_alpha:vt,conv3:wt,prelu3_alpha:Ct}}function me(){var Ie=ae([3,10,16,32],"pnet"),De=S(32,2,1,"pnet/conv4_1"),We=S(32,4,1,"pnet/conv4_2");return Object(L.a)(Object(L.a)({},Ie),{conv4_1:De,conv4_2:We})}function fe(){var Ie=ae([3,28,48,64],"rnet",!0),De=N(576,128,"rnet/fc1"),We=z(128,"rnet/prelu4_alpha"),ze=N(128,2,"rnet/fc2_1"),qe=N(128,4,"rnet/fc2_2");return Object(L.a)(Object(L.a)({},Ie),{fc1:De,prelu4_alpha:We,fc2_1:ze,fc2_2:qe})}function Ce(){var Ie=ae([3,32,64,64],"onet"),De=S(64,128,2,"onet/conv4"),We=z(128,"onet/prelu4_alpha"),ze=N(1152,256,"onet/fc1"),qe=z(256,"onet/prelu5_alpha"),it=N(256,2,"onet/fc2_1"),vt=N(256,4,"onet/fc2_2"),wt=N(256,10,"onet/fc2_3");return Object(L.a)(Object(L.a)({},Ie),{conv4:De,prelu4_alpha:We,fc1:ze,prelu5_alpha:qe,fc2_1:it,fc2_2:vt,fc2_3:wt})}return{extractPNetParams:me,extractRNetParams:fe,extractONetParams:Ce}}function js(R){var b=ln(R),S=b.extractWeights,N=b.getRemainingWeights,z=[],ae=Ls(S,z),me=ae.extractPNetParams,fe=ae.extractRNetParams,Ce=ae.extractONetParams,Ie=me(),De=fe(),We=Ce();if(N().length!==0)throw new Error("weights remaing after extract: "+N().length);return{params:{pnet:Ie,rnet:De,onet:We},paramMappings:z}}function On(R,b){var S=Sn(R,b);function N(De){var We=S(De+"/weights",4,De+"/filters"),ze=S(De+"/bias",1);return{filters:We,bias:ze}}function z(De){var We=S(De+"/weights",2),ze=S(De+"/bias",1);return{weights:We,bias:ze}}function ae(De){return S(De,1)}function me(De){var We=N(De+"/conv1"),ze=ae(De+"/prelu1_alpha"),qe=N(De+"/conv2"),it=ae(De+"/prelu2_alpha"),vt=N(De+"/conv3"),wt=ae(De+"/prelu3_alpha");return{conv1:We,prelu1_alpha:ze,conv2:qe,prelu2_alpha:it,conv3:vt,prelu3_alpha:wt}}function fe(){var De=me("pnet"),We=N("pnet/conv4_1"),ze=N("pnet/conv4_2");return Object(L.a)(Object(L.a)({},De),{conv4_1:We,conv4_2:ze})}function Ce(){var De=me("rnet"),We=z("rnet/fc1"),ze=ae("rnet/prelu4_alpha"),qe=z("rnet/fc2_1"),it=z("rnet/fc2_2");return Object(L.a)(Object(L.a)({},De),{fc1:We,prelu4_alpha:ze,fc2_1:qe,fc2_2:it})}function Ie(){var De=me("onet"),We=N("onet/conv4"),ze=ae("onet/prelu4_alpha"),qe=z("onet/fc1"),it=ae("onet/prelu5_alpha"),vt=z("onet/fc2_1"),wt=z("onet/fc2_2"),Ct=z("onet/fc2_3");return Object(L.a)(Object(L.a)({},De),{conv4:We,prelu4_alpha:ze,fc1:qe,prelu5_alpha:it,fc2_1:vt,fc2_2:wt,fc2_3:Ct})}return{extractPNetParams:fe,extractRNetParams:Ce,extractONetParams:Ie}}function Hi(R){var b=[],S=On(R,b),N=S.extractPNetParams,z=S.extractRNetParams,ae=S.extractONetParams,me=N(),fe=z(),Ce=ae();return yn(R,b),{params:{pnet:me,rnet:fe,onet:Ce},paramMappings:b}}function ti(R,b){var S=b[0],N=b[1];return{height:Math.floor(S*R),width:Math.floor(N*R)}}function ri(R,b,S){for(var N=S[0],z=S[1],ae=ya/R,me=[],fe=Math.min(N,z)*ae,Ce=0;fe>=12;)me.push(ae*Math.pow(b,Ce)),fe=fe*b,Ce+=1;return me}var Ln=function(R){Object(L.c)(b,R);function b(S,N,z,ae){return R.call(this,{left:S,top:N,right:z,bottom:ae},!0)||this}return b}(ge);function zi(R){return j.L(function(){return j.t(j.F(R,j.y(127.5)),j.y(.0078125))})}function Eo(R,b){return j.L(function(){return j.c(j.w(R),j.t(b,j.u(j.w(j.u(R)))))})}function ni(R,b,S){return S===void 0&&(S=!1),j.L(function(){var N=an(R,b.conv1,"valid");return N=Eo(N,b.prelu1_alpha),N=j.s(N,S?[2,2]:[3,3],[2,2],"same"),N=an(N,b.conv2,"valid"),N=Eo(N,b.prelu2_alpha),N=S?N:j.s(N,[3,3],[2,2],"valid"),N=an(N,b.conv3,"valid"),N=Eo(N,b.prelu3_alpha),N})}function Fs(R,b){return j.L(function(){var S=ni(R,b,!0),N=an(S,b.conv4_1,"valid"),z=j.m(j.r(N,3),3),ae=j.D(j.F(N,z),3),me=an(S,b.conv4_2,"valid");return{prob:ae,regions:me}})}function Bs(R,b){return j.L(function(){var S=ti(b,R.shape.slice(1)),N=S.height,z=S.width,ae=j.o.resizeBilinear(R,[N,z]),me=zi(ae);return j.N(me,[0,2,1,3])})}function Us(R,b,S,N){for(var z=[],ae=R.arraySync(),me=0;me<R.shape[0];me++)for(var fe=0;fe<R.shape[1];fe++)ae[me][fe]>=N&&z.push(new ve(fe,me));var Ce=z.map(function(Ie){var De=new $e(Math.round((Ie.y*ga+1)/S),Math.round((Ie.x*ga+1)/S),Math.round((Ie.y*ga+ya)/S),Math.round((Ie.x*ga+ya)/S)),We=ae[Ie.y][Ie.x],ze=b.arraySync(),qe=new Ln(ze[Ie.y][Ie.x][0],ze[Ie.y][Ie.x][1],ze[Ie.y][Ie.x][2],ze[Ie.y][Ie.x][3]);return{cell:De,score:We,region:qe}});return Ce}function Ws(R,b,S,N,z){z.stage1=[];var ae=b.map(function(ze){return j.L(function(){var qe={scale:ze},it=Bs(R,ze),vt=Date.now(),wt=Fs(it,N),Ct=wt.prob,Dt=wt.regions;qe.pnet=Date.now()-vt;var At=j.O(j.O(Ct,3)[1])[0],mt=j.O(Dt)[0];return{scoresTensor:At,regionsTensor:mt,scale:ze,statsForScale:qe}})}),me=ae.map(function(ze){var qe=ze.scoresTensor,it=ze.regionsTensor,vt=ze.scale,wt=ze.statsForScale,Ct=Us(qe,it,vt,S);if(qe.dispose(),it.dispose(),!Ct.length)return z.stage1.push(wt),[];var Dt=Date.now(),At=Re(Ct.map(function(mt){return mt.cell}),Ct.map(function(mt){return mt.score}),.5);return wt.nms=Date.now()-Dt,wt.numBoxes=At.length,z.stage1.push(wt),At.map(function(mt){return Ct[mt]})}),fe=me.reduce(function(ze,qe){return ze.concat(qe)},[]),Ce=[],Ie=[];if(fe.length>0){var De=Date.now(),We=Re(fe.map(function(ze){return ze.cell}),fe.map(function(ze){return ze.score}),.7);z.stage1_nms=Date.now()-De,Ie=We.map(function(ze){return fe[ze].score}),Ce=We.map(function(ze){return fe[ze]}).map(function(ze){var qe=ze.cell,it=ze.region;return new $e(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:Ce,scores:Ie}}function oi(R,b,S){var N=S.width,z=S.height;return Object(L.b)(this,void 0,void 0,function(){var ae,me,fe,Ce=this;return Object(L.d)(this,function(Ie){switch(Ie.label){case 0:return ae=nn(R),[4,Promise.all(b.map(function(De){return Object(L.b)(Ce,void 0,void 0,function(){var We,ze,qe,it,vt,wt,Ct,Dt;return Object(L.d)(this,function(At){return We=De.padAtBorders(R.height,R.width),ze=We.y,qe=We.ey,it=We.x,vt=We.ex,wt=it-1,Ct=ze-1,Dt=ae.getImageData(wt,Ct,vt-wt,qe-Ct),[2,hr.isNodejs()?Tn(Dt):createImageBitmap(Dt)]})})}))];case 1:return me=Ie.sent(),fe=[],me.forEach(function(De){var We=Hr({width:N,height:z}),ze=nn(We);ze.drawImage(De,0,0,N,z);for(var qe=ze.getImageData(0,0,N,z).data,it=[],vt=0;vt<qe.length;vt+=4)it.push(qe[vt+2]),it.push(qe[vt+1]),it.push(qe[vt]);fe.push(it)}),[2,fe.map(function(De){var We=j.L(function(){var ze=j.N(j.K(De,[1,N,z,3]),[0,2,1,3]).toFloat();return zi(ze)});return We})]}})})}function ba(R,b){return j.L(function(){var S=ni(R,b),N=j.x(S,[S.shape[0],b.fc1.weights.shape[0]]),z=$r(N,b.fc1),ae=Eo(z,b.prelu4_alpha),me=$r(ae,b.fc2_1),fe=j.m(j.r(me,1),1),Ce=j.D(j.F(me,fe),1),Ie=$r(ae,b.fc2_2),De=j.O(Ce,1)[1];return{scores:De,regions:Ie}})}function Gi(R,b,S,N,z){return Object(L.b)(this,void 0,void 0,function(){var ae,me,fe,Ce,Ie,De,We,ze,qe,it,vt,wt,Ct,Dt;return Object(L.d)(this,function(At){switch(At.label){case 0:return ae=Date.now(),[4,oi(R,b,{width:24,height:24})];case 1:return me=At.sent(),z.stage2_extractImagePatches=Date.now()-ae,ae=Date.now(),fe=me.map(function(mt){var _t=ba(mt,N);return mt.dispose(),_t}),z.stage2_rnet=Date.now()-ae,Ce=fe.length>1?j.h(fe.map(function(mt){return mt.scores})):fe[0].scores,We=(De=Array).from,[4,Ce.data()];case 2:return Ie=We.apply(De,[At.sent()]),Ce.dispose(),ze=Ie.map(function(mt,_t){return{score:mt,idx:_t}}).filter(function(mt){return mt.score>S}).map(function(mt){var _t=mt.idx;return _t}),qe=ze.map(function(mt){return b[mt]}),it=ze.map(function(mt){return Ie[mt]}),vt=[],wt=[],qe.length>0&&(ae=Date.now(),Ct=Re(qe,it,.7),z.stage2_nms=Date.now()-ae,Dt=Ct.map(function(mt){var _t=fe[ze[mt]].regions.arraySync();return new Ln(_t[0][0],_t[0][1],_t[0][2],_t[0][3])}),wt=Ct.map(function(mt){return it[mt]}),vt=Ct.map(function(mt,_t){return qe[mt].calibrate(Dt[_t])})),fe.forEach(function(mt){mt.regions.dispose(),mt.scores.dispose()}),[2,{boxes:vt,scores:wt}]}})})}function Vi(R,b){return j.L(function(){var S=ni(R,b);S=j.s(S,[2,2],[2,2],"same"),S=an(S,b.conv4,"valid"),S=Eo(S,b.prelu4_alpha);var N=j.x(S,[S.shape[0],b.fc1.weights.shape[0]]),z=$r(N,b.fc1),ae=Eo(z,b.prelu5_alpha),me=$r(ae,b.fc2_1),fe=j.m(j.r(me,1),1),Ce=j.D(j.F(me,fe),1),Ie=$r(ae,b.fc2_2),De=$r(ae,b.fc2_3),We=j.O(Ce,1)[1];return{scores:We,regions:Ie,points:De}})}function jn(R,b,S,N,z){return Object(L.b)(this,void 0,void 0,function(){var ae,me,fe,Ce,Ie,De,We,ze,qe,it,vt,wt,Ct,Dt,At;return Object(L.d)(this,function(mt){switch(mt.label){case 0:return ae=Date.now(),[4,oi(R,b,{width:48,height:48})];case 1:return me=mt.sent(),z.stage3_extractImagePatches=Date.now()-ae,ae=Date.now(),fe=me.map(function(_t){var Wt=Vi(_t,N);return _t.dispose(),Wt}),z.stage3_onet=Date.now()-ae,Ce=fe.length>1?j.h(fe.map(function(_t){return _t.scores})):fe[0].scores,We=(De=Array).from,[4,Ce.data()];case 2:return Ie=We.apply(De,[mt.sent()]),Ce.dispose(),ze=Ie.map(function(_t,Wt){return{score:_t,idx:Wt}}).filter(function(_t){return _t.score>S}).map(function(_t){var Wt=_t.idx;return Wt}),qe=ze.map(function(_t){var Wt=fe[_t].regions.arraySync();return new Ln(Wt[0][0],Wt[0][1],Wt[0][2],Wt[0][3])}),it=ze.map(function(_t,Wt){return b[_t].calibrate(qe[Wt])}),vt=ze.map(function(_t){return Ie[_t]}),wt=[],Ct=[],Dt=[],it.length>0&&(ae=Date.now(),At=Re(it,vt,.7,!1),z.stage3_nms=Date.now()-ae,wt=At.map(function(_t){return it[_t]}),Ct=At.map(function(_t){return vt[_t]}),Dt=At.map(function(_t,Wt){return Array(5).fill(0).map(function(sr,vr){var or=fe[_t].points.arraySync();return new ve(or[0][vr]*(wt[Wt].width+1)+wt[Wt].left,or[0][vr+5]*(wt[Wt].height+1)+wt[Wt].top)})})),fe.forEach(function(_t){_t.regions.dispose(),_t.scores.dispose(),_t.points.dispose()}),[2,{boxes:wt,scores:Ct,points:Dt}]}})})}var eo=function(R){Object(L.c)(b,R);function b(){return R.call(this,"Mtcnn")||this}return b.prototype.load=function(S){return Object(L.b)(this,void 0,void 0,function(){return Object(L.d)(this,function(N){return console.warn("mtcnn is deprecated and will be removed soon"),[2,R.prototype.load.call(this,S)]})})},b.prototype.loadFromDisk=function(S){return Object(L.b)(this,void 0,void 0,function(){return Object(L.d)(this,function(N){return console.warn("mtcnn is deprecated and will be removed soon"),[2,R.prototype.loadFromDisk.call(this,S)]})})},b.prototype.forwardInput=function(S,N){return N===void 0&&(N={}),Object(L.b)(this,void 0,void 0,function(){var z,ae,me,fe,Ce,Ie,De,We,ze,qe,it,vt,wt,Ct,Dt,At,mt,_t,Wt,sr,vr;return Object(L.d)(this,function(or){switch(or.label){case 0:if(z=this.params,!z)throw new Error("Mtcnn - load model before inference");if(ae=S.canvases[0],!ae)throw new Error("Mtcnn - inputCanvas is not defined, note that passing tensors into Mtcnn.forwardInput is not supported yet.");return me={},fe=Date.now(),Ce=j.L(function(){return Ps(j.m(j.f.fromPixels(ae)).toFloat())}),Ie=function(Gt){return Ce.dispose(),me.total=Date.now()-fe,Gt},De=Ce.shape.slice(1),We=De[0],ze=De[1],qe=new bo(N),it=qe.minFaceSize,vt=qe.scaleFactor,wt=qe.maxNumScales,Ct=qe.scoreThresholds,Dt=qe.scaleSteps,At=(Dt||ri(it,vt,[We,ze])).filter(function(Gt){var Ut=ti(Gt,[We,ze]);return Math.min(Ut.width,Ut.height)>ya}).slice(0,wt),me.scales=At,me.pyramid=At.map(function(Gt){return ti(Gt,[We,ze])}),mt=Date.now(),[4,Ws(Ce,At,Ct[0],z.pnet,me)];case 1:return _t=or.sent(),me.total_stage1=Date.now()-mt,_t.boxes.length?(me.stage2_numInputBoxes=_t.boxes.length,mt=Date.now(),[4,Gi(ae,_t.boxes,Ct[1],z.rnet,me)]):[2,Ie({results:[],stats:me})];case 2:return Wt=or.sent(),me.total_stage2=Date.now()-mt,Wt.boxes.length?(me.stage3_numInputBoxes=Wt.boxes.length,mt=Date.now(),[4,jn(ae,Wt.boxes,Ct[2],z.onet,me)]):[2,Ie({results:[],stats:me})];case 3:return sr=or.sent(),me.total_stage3=Date.now()-mt,vr=sr.boxes.map(function(Gt,Ut){return jo(et({},new Z(sr.scores[Ut],new Tt(Gt.left/ze,Gt.top/We,Gt.width/ze,Gt.height/We),{height:We,width:ze})),new Bt(sr.points[Ut].map(function(kr){return kr.sub(new ve(Gt.left,Gt.top)).div(new ve(Gt.width,Gt.height))}),{width:Gt.width,height:Gt.height}))}),[2,Ie({results:vr,stats:me})]}})})},b.prototype.forward=function(S,N){return N===void 0&&(N={}),Object(L.b)(this,void 0,void 0,function(){var z;return Object(L.d)(this,function(ae){switch(ae.label){case 0:return z=this.forwardInput,[4,Or(S)];case 1:return[4,z.apply(this,[ae.sent(),N])];case 2:return[2,ae.sent().results]}})})},b.prototype.forwardWithStats=function(S,N){return N===void 0&&(N={}),Object(L.b)(this,void 0,void 0,function(){var z;return Object(L.d)(this,function(ae){switch(ae.label){case 0:return z=this.forwardInput,[4,Or(S)];case 1:return[2,z.apply(this,[ae.sent(),N])]}})})},b.prototype.getDefaultModelName=function(){return"mtcnn_model"},b.prototype.extractParamsFromWeigthMap=function(S){return Hi(S)},b.prototype.extractParams=function(S){return js(S)},b}(gn),Hs=.4,xa=[new ve(1.603231,2.094468),new ve(6.041143,7.080126),new ve(2.882459,3.518061),new ve(4.266906,5.178857),new ve(9.041765,10.66308)],zs=[117.001,114.697,97.404],Wo=function(R){Object(L.c)(b,R);function b(){var S=this,N={withSeparableConvs:!0,iouThreshold:Hs,classes:["face"],anchors:xa,meanRgb:zs,isFirstLayerConv2d:!0,filterSizes:[3,16,32,64,128,256,512]};return S=R.call(this,N)||this,S}return Object.defineProperty(b.prototype,"anchors",{get:function(){return this.config.anchors},enumerable:!0,configurable:!0}),b.prototype.locateFaces=function(S,N){return Object(L.b)(this,void 0,void 0,function(){var z;return Object(L.d)(this,function(ae){switch(ae.label){case 0:return[4,this.detect(S,N)];case 1:return z=ae.sent(),[2,z.map(function(me){return new Z(me.score,me.relativeBox,{width:me.imageWidth,height:me.imageHeight})})]}})})},b.prototype.getDefaultModelName=function(){return"tiny_face_detector_model"},b.prototype.extractParamsFromWeigthMap=function(S){return R.prototype.extractParamsFromWeigthMap.call(this,S)},b}(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(R,b){return qt.ssdMobilenetv1.locateFaces(R,b)},Gs=function(R,b){return qt.tinyFaceDetector.locateFaces(R,b)},Vs=function(R,b){return qt.tinyYolov2.locateFaces(R,b)},Xi=function(R,b){return qt.mtcnn.forward(R,b)},cc=function(R){return qt.faceLandmark68Net.detectLandmarks(R)},Ki=function(R){return qt.faceLandmark68TinyNet.detectLandmarks(R)},ai=function(R){return qt.faceRecognitionNet.computeFaceDescriptor(R)},Xs=function(R){return qt.faceExpressionNet.predictExpressions(R)},Ks=function(R){return qt.ageGenderNet.predictAgeAndGender(R)},Ho=function(R){return qt.ssdMobilenetv1.load(R)},lc=function(R){return qt.tinyFaceDetector.load(R)},Ys=function(R){return qt.mtcnn.load(R)},Yi=function(R){return qt.tinyYolov2.load(R)},Ea=function(R){return qt.faceLandmark68Net.load(R)},$s=function(R){return qt.faceLandmark68TinyNet.load(R)},$i=function(R){return qt.faceRecognitionNet.load(R)},Ji=function(R){return qt.faceExpressionNet.load(R)},qi=function(R){return qt.ageGenderNet.load(R)},id=Ho,sd=wa,ud=cc,Js=function(R){Object(L.c)(b,R);function b(S,N,z){var ae=R.call(this)||this;return ae.parentTask=S,ae.input=N,ae.extractedFaces=z,ae}return b}(jt),Qi=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b.prototype.run=function(){return Object(L.b)(this,void 0,void 0,function(){var S,N,z=this;return Object(L.d)(this,function(ae){switch(ae.label){case 0:return[4,this.parentTask];case 1:return S=ae.sent(),[4,ma(S,this.input,function(me){return Object(L.b)(z,void 0,void 0,function(){return Object(L.d)(this,function(fe){switch(fe.label){case 0:return[4,Promise.all(me.map(function(Ce){return qt.faceExpressionNet.predictExpressions(Ce)}))];case 1:return[2,fe.sent()]}})})},this.extractedFaces)];case 2:return N=ae.sent(),[2,S.map(function(me,fe){return go(me,N[fe])})]}})})},b.prototype.withAgeAndGender=function(){return new si(this,this.input)},b}(Js),ii=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b.prototype.run=function(){return Object(L.b)(this,void 0,void 0,function(){var S,N;return Object(L.d)(this,function(z){switch(z.label){case 0:return[4,this.parentTask];case 1:return S=z.sent(),S?[4,va(S,this.input,function(ae){return qt.faceExpressionNet.predictExpressions(ae)},this.extractedFaces)]:[2];case 2:return N=z.sent(),[2,go(S,N)]}})})},b.prototype.withAgeAndGender=function(){return new _a(this,this.input)},b}(Js),_o=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b.prototype.withAgeAndGender=function(){return new Ca(this,this.input)},b.prototype.withFaceDescriptors=function(){return new Ir(this,this.input)},b}(Qi),Co=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b.prototype.withAgeAndGender=function(){return new tt(this,this.input)},b.prototype.withFaceDescriptor=function(){return new Ht(this,this.input)},b}(ii),zo=function(R){Object(L.c)(b,R);function b(S,N,z){var ae=R.call(this)||this;return ae.parentTask=S,ae.input=N,ae.extractedFaces=z,ae}return b}(jt),si=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b.prototype.run=function(){return Object(L.b)(this,void 0,void 0,function(){var S,N,z=this;return Object(L.d)(this,function(ae){switch(ae.label){case 0:return[4,this.parentTask];case 1:return S=ae.sent(),[4,ma(S,this.input,function(me){return Object(L.b)(z,void 0,void 0,function(){return Object(L.d)(this,function(fe){switch(fe.label){case 0:return[4,Promise.all(me.map(function(Ce){return qt.ageGenderNet.predictAgeAndGender(Ce)}))];case 1:return[2,fe.sent()]}})})},this.extractedFaces)];case 2:return N=ae.sent(),[2,S.map(function(me,fe){var Ce=N[fe],Ie=Ce.age,De=Ce.gender,We=Ce.genderProbability;return Vr(sn(me,De,We),Ie)})]}})})},b.prototype.withFaceExpressions=function(){return new Qi(this,this.input)},b}(zo),_a=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b.prototype.run=function(){return Object(L.b)(this,void 0,void 0,function(){var S,N,z,ae,me;return Object(L.d)(this,function(fe){switch(fe.label){case 0:return[4,this.parentTask];case 1:return S=fe.sent(),S?[4,va(S,this.input,function(Ce){return qt.ageGenderNet.predictAgeAndGender(Ce)},this.extractedFaces)]:[2];case 2:return N=fe.sent(),z=N.age,ae=N.gender,me=N.genderProbability,[2,Vr(sn(S,ae,me),z)]}})})},b.prototype.withFaceExpressions=function(){return new ii(this,this.input)},b}(zo),Ca=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b.prototype.withFaceExpressions=function(){return new _o(this,this.input)},b.prototype.withFaceDescriptors=function(){return new Ir(this,this.input)},b}(si),tt=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b.prototype.withFaceExpressions=function(){return new Co(this,this.input)},b.prototype.withFaceDescriptor=function(){return new Ht(this,this.input)},b}(_a),En=function(R){Object(L.c)(b,R);function b(S,N){var z=R.call(this)||this;return z.parentTask=S,z.input=N,z}return b}(jt),Ir=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b.prototype.run=function(){return Object(L.b)(this,void 0,void 0,function(){var S,N;return Object(L.d)(this,function(z){switch(z.label){case 0:return[4,this.parentTask];case 1:return S=z.sent(),[4,ma(S,this.input,function(ae){return Promise.all(ae.map(function(me){return qt.faceRecognitionNet.computeFaceDescriptor(me)}))},null,function(ae){return ae.landmarks.align(null,{useDlibAlignment:!0})})];case 2:return N=z.sent(),[2,N.map(function(ae,me){return Qa(S[me],ae)})]}})})},b.prototype.withFaceExpressions=function(){return new _o(this,this.input)},b.prototype.withAgeAndGender=function(){return new Ca(this,this.input)},b}(En),Ht=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b.prototype.run=function(){return Object(L.b)(this,void 0,void 0,function(){var S,N;return Object(L.d)(this,function(z){switch(z.label){case 0:return[4,this.parentTask];case 1:return S=z.sent(),S?[4,va(S,this.input,function(ae){return qt.faceRecognitionNet.computeFaceDescriptor(ae)},null,function(ae){return ae.landmarks.align(null,{useDlibAlignment:!0})})]:[2];case 2:return N=z.sent(),[2,Qa(S,N)]}})})},b.prototype.withFaceExpressions=function(){return new Co(this,this.input)},b.prototype.withAgeAndGender=function(){return new tt(this,this.input)},b}(En),to=function(R){Object(L.c)(b,R);function b(S,N,z){var ae=R.call(this)||this;return ae.parentTask=S,ae.input=N,ae.useTinyLandmarkNet=z,ae}return Object.defineProperty(b.prototype,"landmarkNet",{get:function(){return this.useTinyLandmarkNet?qt.faceLandmark68TinyNet:qt.faceLandmark68Net},enumerable:!0,configurable:!0}),b}(jt),Go=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b.prototype.run=function(){return Object(L.b)(this,void 0,void 0,function(){var S,N,z,ae,me,fe=this;return Object(L.d)(this,function(Ce){switch(Ce.label){case 0:return[4,this.parentTask];case 1:return S=Ce.sent(),N=S.map(function(Ie){return Ie.detection}),this.input instanceof j.a?[4,Po(this.input,N)]:[3,3];case 2:return ae=Ce.sent(),[3,5];case 3:return[4,$n(this.input,N)];case 4:ae=Ce.sent(),Ce.label=5;case 5:return z=ae,[4,Promise.all(z.map(function(Ie){return fe.landmarkNet.detectLandmarks(Ie)}))];case 6:return me=Ce.sent(),z.forEach(function(Ie){return Ie instanceof j.a&&Ie.dispose()}),[2,S.map(function(Ie,De){return jo(Ie,me[De])})]}})})},b.prototype.withFaceExpressions=function(){return new _o(this,this.input)},b.prototype.withAgeAndGender=function(){return new Ca(this,this.input)},b.prototype.withFaceDescriptors=function(){return new Ir(this,this.input)},b}(to),Fn=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b.prototype.run=function(){return Object(L.b)(this,void 0,void 0,function(){var S,N,z,ae,me;return Object(L.d)(this,function(fe){switch(fe.label){case 0:return[4,this.parentTask];case 1:return S=fe.sent(),S?(N=S.detection,this.input instanceof j.a?[4,Po(this.input,[N])]:[3,3]):[2];case 2:return ae=fe.sent(),[3,5];case 3:return[4,$n(this.input,[N])];case 4:ae=fe.sent(),fe.label=5;case 5:return z=ae,[4,this.landmarkNet.detectLandmarks(z[0])];case 6:return me=fe.sent(),z.forEach(function(Ce){return Ce instanceof j.a&&Ce.dispose()}),[2,jo(S,me)]}})})},b.prototype.withFaceExpressions=function(){return new Co(this,this.input)},b.prototype.withAgeAndGender=function(){return new tt(this,this.input)},b.prototype.withFaceDescriptor=function(){return new Ht(this,this.input)},b}(to),To=function(R){Object(L.c)(b,R);function b(S,N){N===void 0&&(N=new wo);var z=R.call(this)||this;return z.input=S,z.options=N,z}return b}(jt),Ta=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b.prototype.run=function(){return Object(L.b)(this,void 0,void 0,function(){var S,N,z,ae;return Object(L.d)(this,function(me){switch(me.label){case 0:return S=this,N=S.input,z=S.options,z instanceof bo?[4,qt.mtcnn.forward(N,z)]:[3,2];case 1:return[2,me.sent().map(function(fe){return fe.detection})];case 2:if(ae=z instanceof Wi?function(fe){return qt.tinyFaceDetector.locateFaces(fe,z)}:z instanceof wo?function(fe){return qt.ssdMobilenetv1.locateFaces(fe,z)}:z instanceof wn?function(fe){return qt.tinyYolov2.locateFaces(fe,z)}:null,!ae)throw new Error("detectFaces - expected options to be instance of TinyFaceDetectorOptions | SsdMobilenetv1Options | MtcnnOptions | TinyYolov2Options");return[2,ae(N)]}})})},b.prototype.runAndExtendWithFaceDetections=function(){var S=this;return new Promise(function(N){return Object(L.b)(S,void 0,void 0,function(){var z;return Object(L.d)(this,function(ae){switch(ae.label){case 0:return[4,this.run()];case 1:return z=ae.sent(),[2,N(z.map(function(me){return et({},me)}))]}})})})},b.prototype.withFaceLandmarks=function(S){return S===void 0&&(S=!1),new Go(this.runAndExtendWithFaceDetections(),this.input,S)},b.prototype.withFaceExpressions=function(){return new Qi(this.runAndExtendWithFaceDetections(),this.input)},b.prototype.withAgeAndGender=function(){return new si(this.runAndExtendWithFaceDetections(),this.input)},b}(To),Sa=function(R){Object(L.c)(b,R);function b(){return R!==null&&R.apply(this,arguments)||this}return b.prototype.run=function(){return Object(L.b)(this,void 0,void 0,function(){var S,N;return Object(L.d)(this,function(z){switch(z.label){case 0:return[4,new Ta(this.input,this.options)];case 1:return S=z.sent(),N=S[0],S.forEach(function(ae){ae.score>N.score&&(N=ae)}),[2,N]}})})},b.prototype.runAndExtendWithFaceDetection=function(){var S=this;return new Promise(function(N){return Object(L.b)(S,void 0,void 0,function(){var z;return Object(L.d)(this,function(ae){switch(ae.label){case 0:return[4,this.run()];case 1:return z=ae.sent(),[2,N(z?et({},z):void 0)]}})})})},b.prototype.withFaceLandmarks=function(S){return S===void 0&&(S=!1),new Fn(this.runAndExtendWithFaceDetection(),this.input,S)},b.prototype.withFaceExpressions=function(){return new ii(this.runAndExtendWithFaceDetection(),this.input)},b.prototype.withAgeAndGender=function(){return new _a(this.runAndExtendWithFaceDetection(),this.input)},b}(To);function Vo(R,b){return b===void 0&&(b=new wo),new Sa(R,b)}function Bn(R,b){return b===void 0&&(b=new wo),new Ta(R,b)}function Xo(R,b){return Object(L.b)(this,void 0,void 0,function(){return Object(L.d)(this,function(S){switch(S.label){case 0:return console.warn("allFacesSsdMobilenetv1 is deprecated and will be removed soon, use the high level api instead"),[4,Bn(R,new wo(b?{minConfidence:b}:{})).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,S.sent()]}})})}function So(R,b){return b===void 0&&(b={}),Object(L.b)(this,void 0,void 0,function(){return Object(L.d)(this,function(S){switch(S.label){case 0:return console.warn("allFacesTinyYolov2 is deprecated and will be removed soon, use the high level api instead"),[4,Bn(R,new wn(b)).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,S.sent()]}})})}function Zr(R,b){return b===void 0&&(b={}),Object(L.b)(this,void 0,void 0,function(){return Object(L.d)(this,function(S){switch(S.label){case 0:return console.warn("allFacesMtcnn is deprecated and will be removed soon, use the high level api instead"),[4,Bn(R,new bo(b)).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,S.sent()]}})})}var ui=Xo;function ci(R,b){if(R.length!==b.length)throw new Error("euclideanDistance: arr1.length !== arr2.length");var S=Array.from(R),N=Array.from(b);return Math.sqrt(S.map(function(z,ae){return z-N[ae]}).reduce(function(z,ae){return z+Math.pow(ae,2)},0))}var Aa=function(){function R(b,S){S===void 0&&(S=.6),this._distanceThreshold=S;var N=Array.isArray(b)?b:[b];if(!N.length)throw new Error("FaceRecognizer.constructor - expected atleast one input");var z=1,ae=function(){return"person "+z++};this._labeledDescriptors=N.map(function(me){if(me instanceof Lr)return me;if(me instanceof Float32Array)return new Lr(ae(),[me]);if(me.descriptor&&me.descriptor instanceof Float32Array)return new Lr(ae(),[me.descriptor]);throw new Error("FaceRecognizer.constructor - expected inputs to be of type LabeledFaceDescriptors | WithFaceDescriptor<any> | Float32Array | Array<LabeledFaceDescriptors | WithFaceDescriptor<any> | Float32Array>")})}return Object.defineProperty(R.prototype,"labeledDescriptors",{get:function(){return this._labeledDescriptors},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"distanceThreshold",{get:function(){return this._distanceThreshold},enumerable:!0,configurable:!0}),R.prototype.computeMeanDistance=function(b,S){return S.map(function(N){return ci(N,b)}).reduce(function(N,z){return N+z},0)/(S.length||1)},R.prototype.matchDescriptor=function(b){var S=this;return this.labeledDescriptors.map(function(N){var z=N.descriptors,ae=N.label;return new rr(ae,S.computeMeanDistance(b,z))}).reduce(function(N,z){return N.distance<z.distance?N:z})},R.prototype.findBestMatch=function(b){var S=this.matchDescriptor(b);return S.distance<this.distanceThreshold?S:new rr("unknown",S.distance)},R.prototype.toJSON=function(){return{distanceThreshold:this.distanceThreshold,labeledDescriptors:this.labeledDescriptors.map(function(b){return b.toJSON()})}},R.fromJSON=function(b){var S=b.labeledDescriptors.map(function(N){return Lr.fromJSON(N)});return new R(S,b.distanceThreshold)},R}();function Zi(R){var b=new eo;return b.extractWeights(R),b}function cd(R){var b=new Wo;return b.extractWeights(R),b}function Oa(R,b){var S=new re(b.width,b.height),N=S.width,z=S.height;if(N<=0||z<=0)throw new Error("resizeResults - invalid dimensions: "+JSON.stringify({width:N,height:z}));if(Array.isArray(R))return R.map(function(fe){return Oa(fe,{width:N,height:z})});if(ca(R)){var ae=R.detection.forSize(N,z),me=R.unshiftedLandmarks.forSize(ae.box.width,ae.box.height);return jo(et(R,ae),me)}return Ar(R)?et(R,R.detection.forSize(N,z)):R instanceof at||R instanceof Z?R.forSize(N,z):R}var es=O("mxV5"),Qs=O.n(es),Zs=O("7Cbv"),eu=O("KhGG"),tu=O("ErOA"),li=O("IO3U"),di=O.n(li),ts=function(b,S){for(var N=b.split(","),z=N[0].match(/:(.*?);/)[1],ae=atob(N[1]),me=ae.length,fe=new Uint8Array(me);me--;)fe[me]=ae.charCodeAt(me);return new Blob([fe],{type:z})},ru=function(){var R=Object(g.a)(W.a.mark(function b(S){return W.a.wrap(function(z){for(;;)switch(z.prev=z.next){case 0:return z.abrupt("return",new Promise(function(ae,me){var fe=new Image;(S==null?void 0:S.indexOf("educoder.net"))>-1?fe.setAttribute("crossOrigin","educoder.net"):fe.setAttribute("crossOrigin","aliyuncs.com"),fe.onload=function(){var Ce=document.createElement("canvas");Ce.width=this.naturalWidth,Ce.height=this.naturalHeight,Ce.getContext("2d").drawImage(fe,0,0);var Ie=Ce.toDataURL("image/png");ae(Ie)},fe.src=S,fe.onerror=function(){me(new Error("\u56FE\u7247\u6D41\u5F02\u5E38")),m.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 z.stop()}},b)}));return function(S){return R.apply(this,arguments)}}(),nu=Object(U.forwardRef)(function(R,b){var S=R.outputResult,N=R.identity_url,z=R.onCameraReady,ae=R.defaultOpen,me=Object(te.i)(),fe=Object(U.useRef)(),Ce=Object(U.useRef)(),Ie=Object(U.useRef)(),De=Object(U.useRef)(!1),We=Object(U.useRef)(),ze=Object(U.useState)(!0),qe=Object(T.a)(ze,2),it=qe[0],vt=qe[1],wt=Object(U.useState)(""),Ct=Object(T.a)(wt,2),Dt=Ct[0],At=Ct[1],mt=Object(U.useState)(""),_t=Object(T.a)(mt,2),Wt=_t[0],sr=_t[1],vr=Object(U.useRef)(!1),or=Object(U.useRef)(""),Gt=Object(U.useState)(!0),Ut=Object(T.a)(Gt,1),kr=Ut[0],lr=.5,Xr=224,Yr="\u5BA1\u6838\u5931\u8D25",Rt=Object(U.useMemo)(function(){return new Wi({inputSize:Xr,scoreThreshold:lr})},[]),tn=function(){var dr=Object(g.a)(W.a.mark(function Ft(){return W.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()}},Ft)}));return function(){return dr.apply(this,arguments)}}();Object(U.useEffect)(function(){ae&&tn()},[ae]),Object(U.useImperativeHandle)(b,function(){return{handleStop:gr,handleRemove:hi,handlePlay:kt,startDiscern:Ko,handleUploadImage:Rn}});var ur=function(){var dr=Object(g.a)(W.a.mark(function Ft(Zt){return W.a.wrap(function(pr){for(;;)switch(pr.prev=pr.next){case 0:if(fe.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(g.a)(W.a.mark(function wr(ro){var Hn;return W.a.wrap(function(Br){for(;;)switch(Br.prev=Br.next){case 0:if("srcObject"in fe.current?fe.current.srcObject=ro:fe.current.src=window.URL.createObjectURL(ro),fe.current.onloadedmetadata=function(Ra){vt(!1),fe.current.play()},!Zt){Br.next=10;break}return Hn=document.createElement("img"),Br.next=6,ru(N+"?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"?m.b.error("\u60A8\u5DF2\u62D2\u7EDD\u4E86\u83B7\u53D6\u6444\u50CF\u5934"):Xt.message!="\u56FE\u7247\u6D41\u5F02\u5E38"&&m.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()}},Ft)}));return function(Zt){return dr.apply(this,arguments)}}(),_r=function(){var dr=Object(g.a)(W.a.mark(function Ft(Zt,Qt){return W.a.wrap(function(Xt){for(;;)switch(Xt.prev=Xt.next){case 0:return Xt.abrupt("return",new Promise(function(){var wr=Object(g.a)(W.a.mark(function ro(Hn){var Yo,Br,Ra,pi,mi,Ia,vi,br,gi,yi,bi;return W.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="+me.login+"&container_id="+me.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()}},Ft)}));return function(Zt,Qt){return dr.apply(this,arguments)}}(),Un=function(){var dr=Object(g.a)(W.a.mark(function Ft(Zt){var Qt;return W.a.wrap(function(Xt){for(;;)switch(Xt.prev=Xt.next){case 0:return Xt.prev=0,Ce.current.width=fe.current.videoWidth,Ce.current.height=360,Qt=Ce.current.getContext("2d"),Xt.next=6,Qt.drawImage(fe.current,0,0,Ce.current.width,Ce.current.height);case 6:or.current=Ce.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()}},Ft,null,[[0,10]])}));return function(Zt){return dr.apply(this,arguments)}}(),Rn=function(){var dr=Object(g.a)(W.a.mark(function Ft(Zt){return W.a.wrap(function(pr){for(;;)switch(pr.prev=pr.next){case 0:return pr.abrupt("return",new Promise(function(){var Xt=Object(g.a)(W.a.mark(function wr(ro){var Hn;return W.a.wrap(function(Br){for(;;)switch(Br.prev=Br.next){case 0:return Hn=Ce.current.getContext("2d"),Br.next=3,Hn.drawImage(fe.current,0,0,Ce.current.width,Ce.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()}},Ft)}));return function(Zt){return dr.apply(this,arguments)}}(),Ko=function(){var dr=Object(g.a)(W.a.mark(function Ft(){var Zt,Qt,pr;return W.a.wrap(function(wr){for(;;)switch(wr.prev=wr.next){case 0:return De.current=!0,wr.next=3,Vo(fe.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(){S==null||S({content:pr._distance<.4?"\u8BC6\u522B\u6210\u529F":Yr,success:pr._distance<.4})},1e3),vr.current=!0):(Un(0),At(Yr),setTimeout(function(){S==null||S({content:Yr,success:!1})},1e3)),setTimeout(function(){fe.current.pause()},600);case 6:case"end":return wr.stop()}},Ft)}));return function(){return dr.apply(this,arguments)}}(),Wn=function(){var dr=Object(g.a)(W.a.mark(function Ft(){var Zt,Qt,pr;return W.a.wrap(function(wr){for(;;)switch(wr.prev=wr.next){case 0:if(!((Zt=fe.current)!==null&&Zt!==void 0&&Zt.paused||(Qt=fe.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(fe.current,Rt).withFaceLandmarks().withFaceDescriptor();case 4:pr=wr.sent,De.current||(De.current=!0,z(!0)),pr&&fe.current?(sr(""),Vt(fe.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()}},Ft)}));return function(){return dr.apply(this,arguments)}}(),hi=function(){try{var Ft=fe.current.srcObject,Zt=Ft.getTracks();Zt.forEach(function(Qt){Qt.stop()}),De.current=!1}catch(Qt){}},gr=function(){vt(!1);try{De.current=!1}catch(Ft){}},kt=function(Ft){De.current=!1,vr.current=!1,Ce.current.getContext("2d").clearRect(0,0,640,480),At(""),vt(!0);try{ur(Ft||!1)}catch(Zt){}},Vt=function(Ft,Zt,Qt){var pr=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,Xt=yr(Ft,Zt,Qt);pr&&y.drawDetections(Zt,Xt.map(function(wr){return wr.detection}))},yr=function(Ft,Zt,Qt){var pr=Ft instanceof HTMLVideoElement?Wr(Ft):Ft,Xt=pr.width,wr=pr.height;return Zt.width=Xt,Zt.height=wr,Oa(Qt,{width:Xt,height:wr})};return _.a.createElement("div",{className:di.a.wrp},_.a.createElement(be.a,{spinning:it,tip:"\u6B63\u5728\u542F\u52A8\u6444\u50CF\u5934\uFF0C\u8BF7\u7A0D\u540E..."},_.a.createElement("video",{onPlay:Wn,ref:fe,id:"inputVideo",autoPlay:!0,muted:!0}),_.a.createElement("canvas",{style:{zIndex:2},ref:Ie}),_.a.createElement("canvas",{ref:Ce}),_.a.createElement("div",{className:"c-red mt5 tc",style:{height:22}},Dt," ",Wt)))}),rs=nu,ns=O("2LEM"),os=O.n(ns),as=O("LvDl"),fi=K.a.Countdown,ou=J.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(b){var S,N=b.globalSetting,z=b.loading,ae=b.user,me=b.exercise,fe=b.dispatch,Ce=Object(B.a)(b,["globalSetting","loading","user","exercise","dispatch"]),Ie=Object(te.i)(),De=Object(U.useState)(0),We=Object(T.a)(De,2),ze=We[0],qe=We[1],it=Object(U.useState)(!1),vt=Object(T.a)(it,2),wt=vt[0],Ct=vt[1],Dt=Object(U.useState)(!1),At=Object(T.a)(Dt,2),mt=At[0],_t=At[1],Wt=Object(U.useState)(!1),sr=Object(T.a)(Wt,2),vr=sr[0],or=sr[1],Gt=Object(U.useState)(0),Ut=Object(T.a)(Gt,2),kr=Ut[0],lr=Ut[1],Xr=Object(U.useState)({}),Yr=Object(T.a)(Xr,2),Rt=Yr[0],tn=Yr[1],ur=Object(U.useRef)(),_r=Object(U.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(g.a)(W.a.mark(function kt(){return W.a.wrap(function(yr){for(;;)switch(yr.prev=yr.next){case 0:return yr.abrupt("return",new Promise(function(){var dr=Object(g.a)(W.a.mark(function Ft(Zt){var Qt;return W.a.wrap(function(Xt){for(;;)switch(Xt.prev=Xt.next){case 0:return Xt.next=2,Object(he.Q)(Object(C.a)({},Ie));case 2:Qt=Xt.sent,tn(Object(C.a)({},Qt)),Zt(Qt);case 5:case"end":return Xt.stop()}},Ft)}));return function(Ft){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(g.a)(W.a.mark(function kt(){var Vt,yr;return W.a.wrap(function(Ft){for(;;)switch(Ft.prev=Ft.next){case 0:return Ft.next=2,Rn();case 2:Vt=Ft.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 Ft.stop()}},kt)}));return function(){return gr.apply(this,arguments)}}(),Wn=function(){var gr=Object(g.a)(W.a.mark(function kt(){var Vt,yr;return W.a.wrap(function(Ft){for(;;)switch(Ft.prev=Ft.next){case 0:return Ft.next=2,Rn();case 2:Vt=Ft.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 Ft.stop()}},kt)}));return function(){return gr.apply(this,arguments)}}(),hi=function(){var kt;Ct(!1),ur==null||((kt=ur.current)===null||kt===void 0)||kt.startDiscern()};return Object(U.useEffect)(function(){return Ko(),console.log("captureRef:",ur),function(){lr(0),or(!1),_t(!1),qe(0)}},[]),_.a.createElement("div",{className:"p30 bg-white minHb100 edu-container mt20"},(Rt==null?void 0:Rt.identity_verify)&&_.a.createElement(_.a.Fragment,null,_.a.createElement("div",{className:"tc font16 blod"},"\u8EAB\u4EFD\u9A8C\u8BC1"),_.a.createElement("div",{className:X.a.steps},_.a.createElement(J.a,{current:ze},Un.map(function(gr){return _.a.createElement(ou,{key:gr.title,title:gr.title})})))),_.a.createElement("div",{className:ze===0?"":"hide"},_.a.createElement("div",{className:"tc mt50"},"\u8BF7\u4FDD\u8BC1\u5468\u56F4\u5149\u7EBF\u5145\u8DB3\uFF0C\u4E94\u5B98\u6E05\u6670\u53EF\u89C1\uFF01"),!mt&&_.a.createElement("div",{className:"tc"},_.a.createElement("img",{width:536,src:os.a,className:"mt30"})),_.a.createElement("div",{className:mt?"":"hide"},_.a.createElement(rs,{ref:ur,onCameraReady:function(kt){Ct(kt)},defaultOpen:Rt==null?void 0:Rt.identity_verify,identity_url:Object(ne.i)(ae==null||((S=ae.userInfo)===null||S===void 0)?void 0:S.identity_url),outputResult:function(kt){kt.success?(m.b.success({content:"\u4EBA\u8138\u8BC6\u522B\u6210\u529F",key:"checkapi"}),qe(2)):or(!0),Ct(!1)}})),mt&&_.a.createElement(_.a.Fragment,null,vr?_.a.createElement("div",{className:"tc mb30 mt15"},_.a.createElement(p.a,{type:"primary",onClick:function(){var kt;ur==null||((kt=ur.current)===null||kt===void 0)||kt.handlePlay(),tn(Object(C.a)({},{})),or(!1)}},"\u91CD\u65B0\u8BC6\u522B"),_.a.createElement(p.a,{type:"primary",className:"ml90",onClick:Object(g.a)(W.a.mark(function gr(){var kt;return W.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")):wt&&_.a.createElement("div",{className:"tc mb30 mt15"},_.a.createElement(p.a,{type:"primary",onClick:Object(as.throttle)(hi,2e3)},"\u5F00\u59CB\u8BC6\u522B"))),!mt&&_.a.createElement("div",{className:"tc mb30 mt15"},_.a.createElement(p.a,{type:"primary",onClick:function(){_t(!0)}},"\u5F00\u59CB\u91C7\u96C6"))),ze===1&&_.a.createElement("div",{className:"tc"},kr===0&&_.a.createElement(_.a.Fragment,null,_.a.createElement("div",{className:"tc mt50"},_.a.createElement("span",{className:"c-blue font50 iconfont icon-dengdaishenhe"}),_.a.createElement("br",null),"\u4EBA\u5DE5\u5BA1\u6838\u4E2D...",_.a.createElement("br",null),"\u7533\u8BF7\u5DF2\u63D0\u4EA4\uFF0C\u76D1\u63A7\u8001\u5E08\u5BA1\u6838\u4E2D\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85\uFF01"),_.a.createElement(p.a,{type:"primary",className:"mt50",onClick:Object(g.a)(W.a.mark(function gr(){var kt;return W.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"?m.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&&_.a.createElement(_.a.Fragment,null,_.a.createElement("div",{className:"tc mt50"},_.a.createElement("span",{className:"c-green font50 iconfont icon-tongguo"}),_.a.createElement("br",null),"\u8EAB\u4EFD\u9A8C\u8BC1\u5BA1\u6838\u901A\u8FC7\u3002"),(Rt==null?void 0:Rt.open_phone_video_recording)&&_.a.createElement(p.a,{type:"primary",className:"mt50",onClick:function(){return qe(2)}},"\u4E0B\u4E00\u6B65")),kr===2&&_.a.createElement(_.a.Fragment,null,_.a.createElement("div",{className:"tc mt50"},_.a.createElement("span",{className:"c-red font50 iconfont icon-hongsejingshi"}),_.a.createElement("br",null),"\u8EAB\u4EFD\u9A8C\u8BC1\u5BA1\u6838\u4E0D\u901A\u8FC7\u3002\u8BF7\u91CD\u65B0\u62CD\u7167\u9A8C\u8BC1\u3002"),_.a.createElement("div",{className:"mt20"},_.a.createElement(A.a,null,_.a.createElement(v.a,{className:"tr",flex:"430px"},"\u5931\u8D25\u539F\u56E0\uFF1A"),_.a.createElement(v.a,null,Rt==null?void 0:Rt.identity_photo_comment)),_.a.createElement(A.a,{className:"mt30"},_.a.createElement(v.a,{className:"tr",flex:"430px"},"\u91C7\u96C6\u7167\u7247\uFF1A"),_.a.createElement(v.a,null,_.a.createElement("img",{src:Object(ne.i)(Rt==null?void 0:Rt.identity_photo_url),width:200}))),_.a.createElement(A.a,null,_.a.createElement(v.a,{className:"tr",flex:"430px"}),_.a.createElement(v.a,null,_.a.createElement(p.a,{type:"primary",className:"mt50",onClick:function(){var kt;qe(0),Ct(!1),or(!1),_t(!1),ur==null||((kt=ur.current)===null||kt===void 0)||kt.handlePlay()}},"\u91CD\u65B0\u8BA4\u8BC1")))))),ze===2&&_.a.createElement(_.a.Fragment,null,_.a.createElement("div",{className:"tc mt50"},!(Rt!=null&&Rt.open_phone_video_recording)&&_.a.createElement(_.a.Fragment,null,(Rt==null?void 0:Rt.countdown_time)<=0?_.a.createElement(_.a.Fragment,null,_.a.createElement("div",{className:"tc mt50"},_.a.createElement("span",{className:"c-green font50 iconfont icon-tongguo"}),_.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)&&_.a.createElement(_.a.Fragment,null,(Rt==null?void 0:Rt.countdown_time)<=0?_.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",_.a.createElement("br",null),_.a.createElement("span",{className:"c-blue",style:{cursor:"default"},onClick:function(){M.a.info({icon:null,title:"\u67E5\u770B\u64CD\u4F5C\u6307\u5F15",className:"custom-modal-divider",width:540,content:_.a.createElement(A.a,null,_.a.createElement(v.a,{flex:"178px"},_.a.createElement("img",{width:148,src:"/images/operation_guidance.png"})),_.a.createElement(v.a,{flex:"1"},"\u8BF7\u70B9\u51FB\u53F3\u4E0A\u89D2\u201C\u2026\u201D\uFF0C\u9009\u62E9",_.a.createElement("span",{className:"c-orange"},"Safari\u4E2D\u6253\u5F00"),"\u6216\u8005",_.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)&&_.a.createElement("div",{className:X.a.qrcode},_.a.createElement(_e.a,{value:"https://".concat(document.domain,"/live-push.html?id=").concat(Ie.categoryId,"&login=").concat(Ie.login,"&cookie=").concat(Object(ne.F)("_educoder_session"))})),(Rt==null?void 0:Rt.countdown_time)>0&&_.a.createElement("div",{className:"tc mt20"},_.a.createElement(fi,{value:Date.now()+(Rt==null?void 0:Rt.countdown_time)*1e3,valueStyle:{color:"#cf1322",fontSize:40},onFinish:function(){Rn()}})),_.a.createElement("div",{className:"tc mb30 mt50"},_.a.createElement(p.a,{type:"primary",onClick:Object(g.a)(W.a.mark(function gr(){var kt,Vt;return W.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?m.b.warn({content:"\u8003\u8BD5\u6682\u672A\u5F00\u59CB\uFF0C\u8BF7\u7A0D\u540E..."}):m.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=V.default=Object(q.a)(function(R){var b=R.loading,S=R.user,N=R.exercise,z=R.globalSetting;return{globalSetting:z,user:S,exercise:N,loading:b.effects}})(en)},jO9C:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("OLod"))})(this,function(y){return y.pad.Iso97971={pad:function(l,M){l.concat(y.lib.WordArray.create([2147483648],1)),y.pad.ZeroPadding.pad(l,M)},unpad:function(l){y.pad.ZeroPadding.unpad(l),l.sigBytes--}},y.pad.Iso97971})},lPiR:function(d,V,O){(function(y,l){d.exports=V=l(O("Ib8C"))})(this,function(y){return function(l){var M=y,D=M.lib,A=D.WordArray,x=D.Hasher,v=M.algo,h=[],p=[];(function(){function C(F){for(var J=l.sqrt(F),H=2;H<=J;H++)if(!(F%H))return!1;return!0}function g(F){return(F-(F|0))*4294967296|0}for(var T=2,B=0;B<64;)C(T)&&(B<8&&(h[B]=g(l.pow(T,1/2))),p[B]=g(l.pow(T,1/3)),B++),T++})();var c=[],m=v.SHA256=x.extend({_doReset:function(){this._hash=new A.init(h.slice(0))},_doProcessBlock:function(C,g){for(var T=this._hash.words,B=T[0],F=T[1],J=T[2],H=T[3],K=T[4],Y=T[5],W=T[6],U=T[7],_=0;_<64;_++){if(_<16)c[_]=C[g+_]|0;else{var te=c[_-15],q=(te<<25|te>>>7)^(te<<14|te>>>18)^te>>>3,w=c[_-2],X=(w<<15|w>>>17)^(w<<13|w>>>19)^w>>>10;c[_]=q+c[_-7]+X+c[_-16]}var ne=K&Y^~K&W,he=B&F^B&J^F&J,le=(B<<30|B>>>2)^(B<<19|B>>>13)^(B<<10|B>>>22),_e=(K<<26|K>>>6)^(K<<21|K>>>11)^(K<<7|K>>>25),se=U+_e+ne+p[_]+c[_],be=le+he;U=W,W=Y,Y=K,K=H+se|0,H=J,J=F,F=B,B=se+be|0}T[0]=T[0]+B|0,T[1]=T[1]+F|0,T[2]=T[2]+J|0,T[3]=T[3]+H|0,T[4]=T[4]+K|0,T[5]=T[5]+Y|0,T[6]=T[6]+W|0,T[7]=T[7]+U|0},_doFinalize:function(){var C=this._data,g=C.words,T=this._nDataBytes*8,B=C.sigBytes*8;return g[B>>>5]|=128<<24-B%32,g[(B+64>>>9<<4)+14]=l.floor(T/4294967296),g[(B+64>>>9<<4)+15]=T,C.sigBytes=g.length*4,this._process(),this._hash},clone:function(){var C=x.clone.call(this);return C._hash=this._hash.clone(),C}});M.SHA256=x._createHelper(m),M.HmacSHA256=x._createHmacHelper(m)}(Math),y.SHA256})},mrSG:function(d,V,O){"use strict";O.d(V,"c",function(){return l}),O.d(V,"a",function(){return M}),O.d(V,"b",function(){return h}),O.d(V,"d",function(){return p}),O.d(V,"e",function(){return B});/*! *****************************************************************************
|
|
|
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(w,X){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ne,he){ne.__proto__=he}||function(ne,he){for(var le in he)he.hasOwnProperty(le)&&(ne[le]=he[le])},y(w,X)};function l(q,w){y(q,w);function X(){this.constructor=q}q.prototype=w===null?Object.create(w):(X.prototype=w.prototype,new X)}var M=function(){return M=Object.assign||function(X){for(var ne,he=1,le=arguments.length;he<le;he++){ne=arguments[he];for(var _e in ne)Object.prototype.hasOwnProperty.call(ne,_e)&&(X[_e]=ne[_e])}return X},M.apply(this,arguments)};function D(q,w){var X={};for(var ne in q)Object.prototype.hasOwnProperty.call(q,ne)&&w.indexOf(ne)<0&&(X[ne]=q[ne]);if(q!=null&&typeof Object.getOwnPropertySymbols=="function")for(var he=0,ne=Object.getOwnPropertySymbols(q);he<ne.length;he++)w.indexOf(ne[he])<0&&Object.prototype.propertyIsEnumerable.call(q,ne[he])&&(X[ne[he]]=q[ne[he]]);return X}function A(q,w,X,ne){var he=arguments.length,le=he<3?w:ne===null?ne=Object.getOwnPropertyDescriptor(w,X):ne,_e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")le=Reflect.decorate(q,w,X,ne);else for(var se=q.length-1;se>=0;se--)(_e=q[se])&&(le=(he<3?_e(le):he>3?_e(w,X,le):_e(w,X))||le);return he>3&&le&&Object.defineProperty(w,X,le),le}function x(q,w){return function(X,ne){w(X,ne,q)}}function v(q,w){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(q,w)}function h(q,w,X,ne){function he(le){return le instanceof X?le:new X(function(_e){_e(le)})}return new(X||(X=Promise))(function(le,_e){function se(Q){try{j(ne.next(Q))}catch(L){_e(L)}}function be(Q){try{j(ne.throw(Q))}catch(L){_e(L)}}function j(Q){Q.done?le(Q.value):he(Q.value).then(se,be)}j((ne=ne.apply(q,w||[])).next())})}function p(q,w){var X={label:0,sent:function(){if(le[0]&1)throw le[1];return le[1]},trys:[],ops:[]},ne,he,le,_e;return _e={next:se(0),throw:se(1),return:se(2)},typeof Symbol=="function"&&(_e[Symbol.iterator]=function(){return this}),_e;function se(j){return function(Q){return be([j,Q])}}function be(j){if(ne)throw new TypeError("Generator is already executing.");for(;X;)try{if(ne=1,he&&(le=j[0]&2?he.return:j[0]?he.throw||((le=he.return)&&le.call(he),0):he.next)&&!(le=le.call(he,j[1])).done)return le;(he=0,le)&&(j=[j[0]&2,le.value]);switch(j[0]){case 0:case 1:le=j;break;case 4:return X.label++,{value:j[1],done:!1};case 5:X.label++,he=j[1],j=[0];continue;case 7:j=X.ops.pop(),X.trys.pop();continue;default:if(!(le=X.trys,le=le.length>0&&le[le.length-1])&&(j[0]===6||j[0]===2)){X=0;continue}if(j[0]===3&&(!le||j[1]>le[0]&&j[1]<le[3])){X.label=j[1];break}if(j[0]===6&&X.label<le[1]){X.label=le[1],le=j;break}if(le&&X.label<le[2]){X.label=le[2],X.ops.push(j);break}le[2]&&X.ops.pop(),X.trys.pop();continue}j=w.call(q,X)}catch(Q){j=[6,Q],he=0}finally{ne=le=0}if(j[0]&5)throw j[1];return{value:j[0]?j[1]:void 0,done:!0}}}function c(q,w,X,ne){ne===void 0&&(ne=X),q[ne]=w[X]}function m(q,w){for(var X in q)X!=="default"&&!w.hasOwnProperty(X)&&(w[X]=q[X])}function C(q){var w=typeof Symbol=="function"&&Symbol.iterator,X=w&&q[w],ne=0;if(X)return X.call(q);if(q&&typeof q.length=="number")return{next:function(){return q&&ne>=q.length&&(q=void 0),{value:q&&q[ne++],done:!q}}};throw new TypeError(w?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(q,w){var X=typeof Symbol=="function"&&q[Symbol.iterator];if(!X)return q;var ne=X.call(q),he,le=[],_e;try{for(;(w===void 0||w-- >0)&&!(he=ne.next()).done;)le.push(he.value)}catch(se){_e={error:se}}finally{try{he&&!he.done&&(X=ne.return)&&X.call(ne)}finally{if(_e)throw _e.error}}return le}function T(){for(var q=[],w=0;w<arguments.length;w++)q=q.concat(g(arguments[w]));return q}function B(){for(var q=0,w=0,X=arguments.length;w<X;w++)q+=arguments[w].length;for(var ne=Array(q),he=0,w=0;w<X;w++)for(var le=arguments[w],_e=0,se=le.length;_e<se;_e++,he++)ne[he]=le[_e];return ne}function F(q){return this instanceof F?(this.v=q,this):new F(q)}function J(q,w,X){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var ne=X.apply(q,w||[]),he,le=[];return he={},_e("next"),_e("throw"),_e("return"),he[Symbol.asyncIterator]=function(){return this},he;function _e(re){ne[re]&&(he[re]=function(de){return new Promise(function(ee,xe){le.push([re,de,ee,xe])>1||se(re,de)})})}function se(re,de){try{be(ne[re](de))}catch(ee){L(le[0][3],ee)}}function be(re){re.value instanceof F?Promise.resolve(re.value.v).then(j,Q):L(le[0][2],re)}function j(re){se("next",re)}function Q(re){se("throw",re)}function L(re,de){(re(de),le.shift(),le.length)&&se(le[0][0],le[0][1])}}function H(q){var w,X;return w={},ne("next"),ne("throw",function(he){throw he}),ne("return"),w[Symbol.iterator]=function(){return this},w;function ne(he,le){w[he]=q[he]?function(_e){return(X=!X)?{value:F(q[he](_e)),done:he==="return"}:le?le(_e):_e}:le}}function K(q){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var w=q[Symbol.asyncIterator],X;return w?w.call(q):(q=typeof C=="function"?C(q):q[Symbol.iterator](),X={},ne("next"),ne("throw"),ne("return"),X[Symbol.asyncIterator]=function(){return this},X);function ne(le){X[le]=q[le]&&function(_e){return new Promise(function(se,be){_e=q[le](_e),he(se,be,_e.done,_e.value)})}}function he(le,_e,se,be){Promise.resolve(be).then(function(j){le({value:j,done:se})},_e)}}function Y(q,w){return Object.defineProperty?Object.defineProperty(q,"raw",{value:w}):q.raw=w,q}function W(q){if(q&&q.__esModule)return q;var w={};if(q!=null)for(var X in q)Object.hasOwnProperty.call(q,X)&&(w[X]=q[X]);return w.default=q,w}function U(q){return q&&q.__esModule?q:{default:q}}function _(q,w){if(!w.has(q))throw new TypeError("attempted to get private field on non-instance");return w.get(q)}function te(q,w,X){if(!w.has(q))throw new TypeError("attempted to set private field on non-instance");return w.set(q,X),X}},mxV5:function(module,exports,__webpack_require__){(function(global){var require,require;(function(d){if(!0)module.exports=d();else var V})(function(){var define,module,exports;return function(){function d(V,O,y){function l(A,x){if(!O[A]){if(!V[A]){var v=typeof require=="function"&&require;if(!x&&v)return require(A,!0);if(M)return M(A,!0);var h=new Error("Cannot find module '"+A+"'");throw h.code="MODULE_NOT_FOUND",h}var p=O[A]={exports:{}};V[A][0].call(p.exports,function(c){var m=V[A][1][c];return l(m||c)},p,p.exports,d,V,O,y)}return O[A].exports}for(var M=typeof require=="function"&&require,D=0;D<y.length;D++)l(y[D]);return l}return d}()({1:[function(d,V,O){"use strict";var y=d("./browser/client");y.Buffer=d("buffer").Buffer,y.urllib=d("../shims/xhr"),y.version=d("./browser/version").version,V.exports=y},{"../shims/xhr":291,"./browser/client":2,"./browser/version":5,buffer:73}],2:[function(d,V,O){(function(y,l){"use strict";var M=d("babel-runtime/core-js/promise"),D=p(M),A=d("babel-runtime/regenerator"),x=p(A),v=d("babel-runtime/core-js/object/assign"),h=p(v);function p(be){return be&&be.__esModule?be:{default:be}}var c=d("debug")("ali-oss"),m=d("copy-to"),C=d("xml2js"),g=d("agentkeepalive"),T=d("merge-descriptors"),B=d("url"),F=d("is-type-of"),J=d("platform"),H=d("utility"),K=d("urllib"),Y=d("./version"),W=d("bowser"),U=d("../common/signUtils"),_=d("../common/utils/isIP"),te=_.isIP,q=d("../common/client/initOptions"),w=d("../common/utils/createRequest"),X=w.createRequest,ne=new g;function he(){var be=J.name,j=J.version;be&&be.toLowerCase&&be.toLowerCase()==="ie"&&j.split(".")[0]<10&&console.warn("ali-oss does not support the current browser")}function le(){return location&&location.protocol==="https:"}function _e(be,j){if(he(),!(this instanceof _e))return new _e(be,j);be&&be.inited?this.options=be:this.options=_e.initOptions(be),this.options.cancelFlag=!1,this.options.urllib?this.urllib=this.options.urllib:(this.urllib=K,this.agent=this.options.agent||ne),this.ctx=j,this.userAgent=this._getUserAgent(),this.options.amendTimeSkewed=0}V.exports=_e,_e.initOptions=function(j){j.stsToken||console.warn("Please use STS Token for safety, see more details at https://help.aliyun.com/document_detail/32077.html");var Q=(0,h.default)({secure:le(),useFetch:!1},j);return q(Q)};var se=_e.prototype;se.debug=c,T(se,d("./object")),T(se,d("../common/bucket/getBucketWebsite")),T(se,d("../common/bucket/putBucketWebsite")),T(se,d("../common/bucket/deleteBucketWebsite")),T(se,d("../common/bucket/getBucketLifecycle")),T(se,d("../common/bucket/putBucketLifecycle")),T(se,d("../common/bucket/deleteBucketLifecycle")),T(se,d("../common/bucket/putBucketVersioning")),T(se,d("../common/bucket/getBucketVersioning")),T(se,d("./managed-upload")),T(se,d("../common/multipart")),T(se,d("../common/parallel")),se.signature=function(j){return this.debug("authorization stringToSign: %s",j,"info"),U.computeSignature(this.options.accessKeySecret,j)},se.authorization=function(j,Q,L,re){var de=U.buildCanonicalString(j.toUpperCase(),Q,{headers:re,parameters:L});return U.authorization(this.options.accessKeyId,this.options.accessKeySecret,de)},se.request=function(j){var Q,L,re,de,ee,xe;return x.default.async(function(Le){for(;;)switch(Le.prev=Le.next){case 0:return Q=X.call(this,j),this.options.useFetch||(Q.params.mode="disable-fetch"),L=void 0,re=void 0,de=!!j.stream,Le.prev=5,Le.next=8,x.default.awrap(this.urllib.request(Q.url,Q.params));case 8:L=Le.sent,this.debug("response %s %s, got %s, headers: %j",j.method,Q.url,L.status,L.headers,"info"),Le.next=15;break;case 12:Le.prev=12,Le.t0=Le.catch(5),re=Le.t0;case 15:if(ee=void 0,!(L&&j.successStatuses&&j.successStatuses.indexOf(L.status)===-1)){Le.next=28;break}return Le.next=19,x.default.awrap(this.requestError(L));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,x.default.awrap(this.request(j));case 24:return Le.abrupt("return",Le.sent);case 25:ee.params=j,Le.next=32;break;case 28:if(!re){Le.next=32;break}return Le.next=31,x.default.awrap(this.requestError(re));case 31:ee=Le.sent;case 32:if(!ee){Le.next=34;break}throw ee;case 34:if(!j.xmlResponse){Le.next=39;break}return Le.next=37,x.default.awrap(this.parseXML(L.data));case 37:xe=Le.sent,L.data=xe;case 39:return Le.abrupt("return",L);case 40:case"end":return Le.stop()}},null,this,[[5,12]])},se._getResource=function(j){var Q="/";return j.bucket&&(Q+=j.bucket+"/"),j.object&&(Q+=j.object),Q},se._isIP=te,se._escape=function(j){return H.encodeURIComponent(j).replace(/%2F/g,"/")},se._getReqUrl=function(j){var Q={};m(this.options.endpoint).to(Q);var L=this._isIP(Q.hostname),re=this.options.cname;j.bucket&&!re&&!L&&(Q.host=j.bucket+"."+Q.host);var de="/";j.bucket&&L&&(de+=j.bucket+"/"),j.object&&(de+=this._escape(j.object).replace(/\+/g,"%2B")),Q.pathname=de;var ee={};if(j.query&&T(ee,j.query),j.subres){var xe={};F.string(j.subres)?xe[j.subres]="":F.array(j.subres)?j.subres.forEach(function(Ne){xe[Ne]=""}):xe=j.subres,T(ee,xe)}return Q.query=ee,B.format(Q)},se._getUserAgent=function(){var j=l&&l.browser?"js":"nodejs",Q="aliyun-sdk-"+j+"/"+Y.version,L=J.description;return!L&&l&&(L="Node.js "+l.version.slice(1)+" on "+l.platform+" "+l.arch),this._checkUserAgent(Q+" "+L)},se._checkUserAgent=function(j){var Q=j.replace(/\u03b1/,"alpha").replace(/\u03b2/,"beta");return Q},se.checkBrowserAndVersion=function(j,Q){return W.name===j&&W.version.split(".")[0]===Q},se.parseXML=function(j){return new D.default(function(Q,L){y.isBuffer(j)&&(j=j.toString()),C.parseString(j,{explicitRoot:!1,explicitArray:!1},function(re,de){re?L(re):Q(de)})})},se.requestError=function(j){var Q,L,re,de;return x.default.async(function(xe){for(;;)switch(xe.prev=xe.next){case 0:if(Q=null,!(!j.data||!j.data.length)){xe.next=5;break}j.status===-1||j.status===-2?(Q=new Error(j.message),Q.name=j.name,Q.status=j.status,Q.code=j.name):(j.status===404?(Q=new Error("Object not exists"),Q.name="NoSuchKeyError",Q.status=404,Q.code="NoSuchKey"):j.status===412?(Q=new Error("Pre condition failed"),Q.name="PreconditionFailedError",Q.status=412,Q.code="PreconditionFailed"):(Q=new Error("Unknow error, status: "+j.status),Q.name="UnknowError",Q.status=j.status),Q.requestId=j.headers["x-oss-request-id"],Q.host=""),xe.next=33;break;case 5:return L=String(j.data),this.debug("request response error data: %s",L,"error"),re=void 0,xe.prev=8,xe.next=11,x.default.awrap(this.parseXML(L));case 11:if(xe.t0=xe.sent,xe.t0){xe.next=14;break}xe.t0={};case 14:re=xe.t0,xe.next=24;break;case 17:return xe.prev=17,xe.t1=xe.catch(8),this.debug(L,"error"),xe.t1.message+=`
|
|
|
raw xml: `+L,xe.t1.status=j.status,xe.t1.requestId=j.headers["x-oss-request-id"],xe.abrupt("return",xe.t1);case 24:de=re.Message||"unknow request error, status: "+j.status,re.Condition&&(de+=" (condition: "+re.Condition+")"),Q=new Error(de),Q.name=re.Code?re.Code+"Error":"UnknowError",Q.status=j.status,Q.code=re.Code,Q.requestId=re.RequestId,Q.hostId=re.HostId,Q.serverTime=re.ServerTime;case 33:return this.debug("generate error %j",Q,"error"),xe.abrupt("return",Q);case 35:case"end":return xe.stop()}},null,this,[[8,17]])}}).call(this,{isBuffer:d("../../node_modules/is-buffer/index.js")},d("_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(d,V,O){(function(y){"use strict";var l=d("babel-runtime/core-js/array/from"),M=h(l),D=d("babel-runtime/core-js/promise"),A=h(D),x=d("babel-runtime/regenerator"),v=h(x);function h(U){return U&&U.__esModule?U:{default:U}}var p=d("is-type-of"),c=d("util"),m=d("path"),C=d("mime"),g=d("copy-to"),T=d("../common/utils/isBlob"),B=T.isBlob,F=d("../common/utils/isFile"),J=F.isFile,H=O;H.multipartUpload=function(_,te,q){var w,X,ne,he,le,_e,se,be,j;return v.default.async(function(L){for(;;)switch(L.prev=L.next){case 0:if(this.resetCancelFlag(),q=q||{},!(q.checkpoint&&q.checkpoint.uploadId)){L.next=6;break}return L.next=5,v.default.awrap(this._resumeMultipart(q.checkpoint,q));case 5:return L.abrupt("return",L.sent);case 6:return w=100*1024,q.mime||(J(te)?q.mime=C.getType(m.extname(te.name)):B(te)?q.mime=te.type:q.mime=C.getType(m.extname(te))),q.headers=q.headers||{},this._convertMetaToHeaders(q.meta,q.headers),L.next=12,v.default.awrap(this._getFileSize(te));case 12:if(X=L.sent,!(X<w)){L.next=25;break}return ne=this._createStream(te,0,X),q.contentLength=X,L.next=18,v.default.awrap(this.putStream(_,ne,q));case 18:if(he=L.sent,!(q&&q.progress)){L.next=22;break}return L.next=22,v.default.awrap(q.progress(1));case 22:return le={res:he.res,bucket:this.options.bucket,name:_,etag:he.res.headers.etag},(q.headers&&q.headers["x-oss-callback"]||q.callback)&&(le.data=he.data),L.abrupt("return",le);case 25:if(!(q.partSize&&!(parseInt(q.partSize,10)===q.partSize))){L.next=27;break}throw new Error("partSize must be int number");case 27:if(!(q.partSize&&q.partSize<w)){L.next=29;break}throw new Error("partSize must not be smaller than "+w);case 29:return L.next=31,v.default.awrap(this.initMultipartUpload(_,q));case 31:if(_e=L.sent,se=_e.uploadId,be=this._getPartSize(X,q.partSize),j={file:te,name:_,fileSize:X,partSize:be,uploadId:se,doneParts:[]},!(q&&q.progress)){L.next=38;break}return L.next=38,v.default.awrap(q.progress(0,j,_e.res));case 38:return L.next=40,v.default.awrap(this._resumeMultipart(j,q));case 40:return L.abrupt("return",L.sent);case 41:case"end":return L.stop()}},null,this)},H._resumeMultipart=function(_,te){var q,w,X,ne,he,le,_e,se,be,j,Q,L,re,de,ee,xe,Ne,Le;return v.default.async(function(Qe){for(;;)switch(Qe.prev=Qe.next){case 0:if(q=this,!this.isCancel()){Qe.next=3;break}throw this._makeCancelEvent();case 3:return w=_.file,X=_.fileSize,ne=_.partSize,he=_.uploadId,le=_.doneParts,_e=_.name,se=[],le.length>0&&g(le).to(se),be=this._divideParts(X,ne),j=be.length,Q=!1,L=function(nt,Ye){var Pe=this;return new A.default(function(Be,ot){var ve,ge,$e,pe;return v.default.async(function(k){for(;;)switch(k.prev=k.next){case 0:if(k.prev=0,nt.isCancel()){k.next=18;break}return ve=be[Ye-1],ge={stream:nt._createStream(w,ve.start,ve.end),size:ve.end-ve.start},k.next=6,v.default.awrap(nt._uploadPart(_e,he,Ye,ge));case 6:if($e=k.sent,!(!nt.isCancel()&&!Q)){k.next=15;break}if(_.doneParts.push({number:Ye,etag:$e.res.headers.etag}),!te.progress){k.next=12;break}return k.next=12,v.default.awrap(te.progress(le.length/j,_,$e.res));case 12:Be({number:Ye,etag:$e.res.headers.etag}),k.next=16;break;case 15:Be();case 16:k.next=19;break;case 18:Be();case 19:k.next=30;break;case 21:k.prev=21,k.t0=k.catch(0),pe=new Error,pe.name=k.t0.name,pe.message=k.t0.message,pe.stack=k.t0.stack,pe.partNum=Ye,g(k.t0).to(pe),ot(pe);case 30:case"end":return k.stop()}},null,Pe,[[0,21]])})},re=(0,M.default)(new Array(j),function(Te,nt){return nt+1}),de=se.map(function(Te){return Te.number}),ee=re.filter(function(Te){return de.indexOf(Te)<0}),xe=5,Ne=te.parallel||xe,Qe.next=17,v.default.awrap(this._parallel(ee,Ne,function(Te){return new A.default(function(nt,Ye){L(q,Te).then(function(Pe){Pe&&se.push(Pe),nt()}).catch(function(Pe){Ye(Pe)})})}));case 17:if(Le=Qe.sent,Q=!0,!this.isCancel()){Qe.next=22;break}throw L=null,this._makeCancelEvent();case 22:if(!(Le&&Le.length>0)){Qe.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 Qe.next=27,v.default.awrap(this.completeMultipartUpload(_e,he,se,te));case 27:return Qe.abrupt("return",Qe.sent);case 28:case"end":return Qe.stop()}},null,this)},H._getFileSize=function(_){return v.default.async(function(q){for(;;)switch(q.prev=q.next){case 0:if(!p.buffer(_)){q.next=4;break}return q.abrupt("return",_.length);case 4:if(!(B(_)||J(_))){q.next=6;break}return q.abrupt("return",_.size);case 6:throw new Error("_getFileSize requires Buffer/File/Blob.");case 7:case"end":return q.stop()}},null,this)};var K=d("stream"),Y=K.Readable;function W(U,_){if(!(this instanceof W))return new W(U,_);Y.call(this,_),this.file=U,this.reader=new FileReader,this.start=0,this.finish=!1,this.fileBuffer=null}c.inherits(W,Y),W.prototype.readFileAndPush=function(_){if(this.fileBuffer)for(var te=!0;te&&this.fileBuffer&&this.start<this.fileBuffer.length;){var q=this.start,w=q+_;w=w>this.fileBuffer.length?this.fileBuffer.length:w,this.start=w,te=this.push(this.fileBuffer.slice(q,w))}},W.prototype._read=function(_){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;_=_||te;var q=this;this.reader.onload=function(X){q.fileBuffer=y.from(new Uint8Array(X.target.result)),q.file=null,q.readFileAndPush(_)},this.start===0?this.reader.readAsArrayBuffer(this.file):this.readFileAndPush(_)},H._createStream=function(_,te,q){if(B(_)||J(_))return new W(_.slice(te,q));throw new Error("_createStream requires File/Blob.")},H._getPartSize=function(_,te){var q=10*1e3,w=1024*1024;return te?Math.max(Math.ceil(_/q),te):w},H._divideParts=function(_,te){for(var q=Math.ceil(_/te),w=[],X=0;X<q;X++){var ne=te*X,he=Math.min(ne+te,_);w.push({start:ne,end:he})}return w}}).call(this,d("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(d,V,O){"use strict";var y=d("babel-runtime/core-js/promise"),l=p(y),M=d("babel-runtime/core-js/object/keys"),D=p(M),A=d("babel-runtime/core-js/object/assign"),x=p(A),v=d("babel-runtime/regenerator"),h=p(v);function p(q){return q&&q.__esModule?q:{default:q}}var c=d("utility"),m=d("fs"),C=d("is-type-of"),g=d("url"),T=d("copy-to"),B=d("path"),F=d("mime"),J=d("../common/callback"),H=d("../common/signUtils"),K=d("merge-descriptors"),Y=d("../common/utils/isBlob"),W=Y.isBlob,U=d("../common/utils/isFile"),_=U.isFile,te=O;te.append=function(w,X,ne){var he;return h.default.async(function(_e){for(;;)switch(_e.prev=_e.next){case 0:return ne=ne||{},ne.position===void 0&&(ne.position="0"),ne.subres={append:"",position:ne.position},ne.method="POST",_e.next=6,h.default.awrap(this.put(w,X,ne));case 6:return he=_e.sent,he.nextAppendPosition=he.res.headers["x-oss-next-append-position"],_e.abrupt("return",he);case 9:case"end":return _e.stop()}},null,this)},te.put=function(w,X,ne){var he,le,_e,se,be,j,Q;return h.default.async(function(re){for(;;)switch(re.prev=re.next){case 0:if(he=void 0,ne=ne||{},w=this._objectName(w),!C.buffer(X)){re.next=7;break}he=X,re.next=33;break;case 7:if(!(W(X)||_(X))){re.next=32;break}return ne.mime||(_(X)?ne.mime=F.getType(B.extname(X.name)):ne.mime=X.type),le=this._createStream(X,0,X.size),re.next=12,h.default.awrap(this._getFileSize(X));case 12:return ne.contentLength=re.sent,re.prev=13,re.next=16,h.default.awrap(this.putStream(w,le,ne));case 16:return _e=re.sent,re.abrupt("return",_e);case 20:if(re.prev=20,re.t0=re.catch(13),!(re.t0.code==="RequestTimeTooSkewed")){re.next=29;break}return this.options.amendTimeSkewed=+new Date(re.t0.serverTime)-new Date,re.next=26,h.default.awrap(this.put(w,X,ne));case 26:return re.abrupt("return",re.sent);case 29:throw re.t0;case 30:re.next=33;break;case 32:throw new TypeError("Must provide Buffer/Blob/File for put.");case 33:return ne.headers=ne.headers||{},this._convertMetaToHeaders(ne.meta,ne.headers),se=ne.method||"PUT",be=this._objectRequestParams(se,w,ne),J.encodeCallback(be,ne),be.mime=ne.mime,be.content=he,be.successStatuses=[200],re.next=43,h.default.awrap(this.request(be));case 43:return j=re.sent,Q={name:w,url:this._objectUrl(w),res:j.res},be.headers&&be.headers["x-oss-callback"]&&(Q.data=JSON.parse(j.data.toString())),re.abrupt("return",Q);case 47:case"end":return re.stop()}},null,this,[[13,20]])},te.putStream=function(w,X,ne){var he,le,_e,se;return h.default.async(function(j){for(;;)switch(j.prev=j.next){case 0:return ne=ne||{},ne.headers=ne.headers||{},w=this._objectName(w),ne.contentLength?ne.headers["Content-Length"]=ne.contentLength:ne.headers["Transfer-Encoding"]="chunked",this._convertMetaToHeaders(ne.meta,ne.headers),he=ne.method||"PUT",le=this._objectRequestParams(he,w,ne),J.encodeCallback(le,ne),le.mime=ne.mime,le.stream=X,le.successStatuses=[200],j.next=13,h.default.awrap(this.request(le));case 13:return _e=j.sent,se={name:w,url:this._objectUrl(w),res:_e.res},le.headers&&le.headers["x-oss-callback"]&&(se.data=JSON.parse(_e.data.toString())),j.abrupt("return",se);case 17:case"end":return j.stop()}},null,this)},K(te,d("../common/object/copyObject")),K(te,d("../common/object/getObjectTagging")),K(te,d("../common/object/putObjectTagging")),K(te,d("../common/object/deleteObjectTagging")),K(te,d("../common/image")),K(te,d("../common/object/getBucketVersions")),K(te,d("../common/object/getACL")),K(te,d("../common/object/putACL")),K(te,d("../common/object/head")),K(te,d("../common/object/delete")),K(te,d("../common/object/get")),K(te,d("../common/object/putSymlink")),K(te,d("../common/object/getSymlink")),K(te,d("../common/object/deleteMulti")),K(te,d("../common/object/getObjectMeta")),te.putMeta=function(w,X,ne){var he;return h.default.async(function(_e){for(;;)switch(_e.prev=_e.next){case 0:return _e.next=2,h.default.awrap(this.copy(w,w,{meta:X||{},timeout:ne&&ne.timeout,ctx:ne&&ne.ctx}));case 2:return he=_e.sent,_e.abrupt("return",he);case 4:case"end":return _e.stop()}},null,this)},te.list=function(w,X){var ne,he,le,_e,se;return h.default.async(function(j){for(;;)switch(j.prev=j.next){case 0:return ne=this._objectRequestParams("GET","",X),ne.query=w,ne.xmlResponse=!0,ne.successStatuses=[200],j.next=6,h.default.awrap(this.request(ne));case 6:return he=j.sent,le=he.data.Contents,_e=this,le&&(Array.isArray(le)||(le=[le]),le=le.map(function(Q){return{name:Q.Key,url:_e._objectUrl(Q.Key),lastModified:Q.LastModified,etag:Q.ETag,type:Q.Type,size:Number(Q.Size),storageClass:Q.StorageClass,owner:{id:Q.Owner.ID,displayName:Q.Owner.DisplayName}}})),se=he.data.CommonPrefixes||null,se&&(Array.isArray(se)||(se=[se]),se=se.map(function(Q){return Q.Prefix})),j.abrupt("return",{res:he.res,objects:le,prefixes:se,nextMarker:he.data.NextMarker||null,isTruncated:he.data.IsTruncated==="true"});case 13:case"end":return j.stop()}},null,this)},te.restore=function(w,X){var ne,he;return h.default.async(function(_e){for(;;)switch(_e.prev=_e.next){case 0:return X=X||{},X.subres=(0,x.default)({restore:""},X.subres),X.versionId&&(X.subres.versionId=X.versionId),ne=this._objectRequestParams("POST",w,X),ne.successStatuses=[202],_e.next=7,h.default.awrap(this.request(ne));case 7:return he=_e.sent,_e.abrupt("return",{res:he.res});case 9:case"end":return _e.stop()}},null,this)},te.signatureUrl=function(w,X){X=X||{},w=this._objectName(w),X.method=X.method||"GET";var ne=c.timestamp()+(X.expires||1800),he={bucket:this.options.bucket,object:w},le=this._getResource(he);this.options.stsToken&&(X["security-token"]=this.options.stsToken);var _e=H._signatureForURL(this.options.accessKeySecret,X,le,ne),se=g.parse(this._getReqUrl(he));return se.query={OSSAccessKeyId:this.options.accessKeyId,Expires:ne,Signature:_e.Signature},T(_e.subResource).to(se.query),se.format()},te.getObjectUrl=function(w,X){return X?X[X.length-1]!=="/"&&(X+="/"):X=this.options.endpoint.format(),X+this._escape(this._objectName(w))},te._objectUrl=function(w){return this._getReqUrl({bucket:this.options.bucket,object:w})},te.generateObjectUrl=function(q,w){if(w)w[w.length-1]!=="/"&&(w+="/");else{w=this.options.endpoint.format();var X=g.parse(w),ne=this.options.bucket;X.hostname=ne+"."+X.hostname,X.host=ne+"."+X.host,w=X.format()}return w+this._escape(this._objectName(q))},te._objectRequestParams=function(w,X,ne){if(!this.options.bucket)throw new Error("Please create a bucket first");ne=ne||{},X=this._objectName(X);var he={object:X,bucket:this.options.bucket,method:w,subres:ne&&ne.subres,timeout:ne&&ne.timeout,ctx:ne&&ne.ctx};return ne.headers&&(he.headers={},T(ne.headers).to(he.headers)),he},te._objectName=function(w){return w.replace(/^\/+/,"")},te._convertMetaToHeaders=function(w,X){if(!w)return;(0,D.default)(w).forEach(function(ne){X["x-oss-meta-"+ne]=w[ne]})},te._deleteFileSafe=function(w){var X=this;return new l.default(function(ne){m.exists(w,function(he){he?m.unlink(w,function(le){le&&X.debug("unlink %j error: %s",w,le,"error"),ne()}):ne()})})}},{"../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(d,V,O){"use strict";O.version="6.10.0"},{}],6:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=M(y);function M(v){return v&&v.__esModule?v:{default:v}}var D=d("../utils/checkBucketName"),A=D.checkBucketName,x=O;x.deleteBucketLifecycle=function(h,p){var c,m;return l.default.async(function(g){for(;;)switch(g.prev=g.next){case 0:return A(h),c=this._bucketRequestParams("DELETE",h,"lifecycle",p),c.successStatuses=[204],g.next=5,l.default.awrap(this.request(c));case 5:return m=g.sent,g.abrupt("return",{res:m.res});case 7:case"end":return g.stop()}},null,this)}},{"../utils/checkBucketName":35,"babel-runtime/regenerator":68}],7:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=M(y);function M(v){return v&&v.__esModule?v:{default:v}}var D=d("../utils/checkBucketName"),A=D.checkBucketName,x=O;x.deleteBucketWebsite=function(h,p){var c,m;return l.default.async(function(g){for(;;)switch(g.prev=g.next){case 0:return A(h),c=this._bucketRequestParams("DELETE",h,"website",p),c.successStatuses=[204],g.next=5,l.default.awrap(this.request(c));case 5:return m=g.sent,g.abrupt("return",{res:m.res});case 7:case"end":return g.stop()}},null,this)}},{"../utils/checkBucketName":35,"babel-runtime/regenerator":68}],8:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=M(y);function M(m){return m&&m.__esModule?m:{default:m}}var D=d("../utils/checkBucketName"),A=D.checkBucketName,x=d("../utils/isArray"),v=x.isArray,h=d("../utils/formatObjKey"),p=h.formatObjKey,c=O;c.getBucketLifecycle=function(C,g){var T,B,F;return l.default.async(function(H){for(;;)switch(H.prev=H.next){case 0:return A(C),T=this._bucketRequestParams("GET",C,"lifecycle",g),T.successStatuses=[200],T.xmlResponse=!0,H.next=6,l.default.awrap(this.request(T));case 6:return B=H.sent,F=B.data.Rule||null,F&&(v(F)||(F=[F]),F=F.map(function(K){return K.ID&&(K.id=K.ID,delete K.ID),K.Tag&&!v(K.Tag)&&(K.Tag=[K.Tag]),p(K,"firstLowerCase")})),H.abrupt("return",{rules:F,res:B.res});case 10:case"end":return H.stop()}},null,this)}},{"../utils/checkBucketName":35,"../utils/formatObjKey":40,"../utils/isArray":42,"babel-runtime/regenerator":68}],9:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=M(y);function M(v){return v&&v.__esModule?v:{default:v}}var D=d("../utils/checkBucketName"),A=D.checkBucketName,x=O;x.getBucketVersioning=function(h,p){var c,m,C;return l.default.async(function(T){for(;;)switch(T.prev=T.next){case 0:return A(h),c=this._bucketRequestParams("GET",h,"versioning",p),c.xmlResponse=!0,c.successStatuses=[200],T.next=6,l.default.awrap(this.request(c));case 6:return m=T.sent,C=m.data.Status,T.abrupt("return",{status:m.status,versionStatus:C,res:m.res});case 9:case"end":return T.stop()}},null,this)}},{"../utils/checkBucketName":35,"babel-runtime/regenerator":68}],10:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=M(y);function M(p){return p&&p.__esModule?p:{default:p}}var D=d("../utils/checkBucketName"),A=D.checkBucketName,x=d("../utils/isObject"),v=x.isObject,h=O;h.getBucketWebsite=function(c,m){var C,g,T;return l.default.async(function(F){for(;;)switch(F.prev=F.next){case 0:return A(c),C=this._bucketRequestParams("GET",c,"website",m),C.successStatuses=[200],C.xmlResponse=!0,F.next=6,l.default.awrap(this.request(C));case 6:return g=F.sent,T=[],g.data.RoutingRules&&g.data.RoutingRules.RoutingRule&&(v(g.data.RoutingRules.RoutingRule)?T=[g.data.RoutingRules.RoutingRule]:T=g.data.RoutingRules.RoutingRule),F.abrupt("return",{index:g.data.IndexDocument&&g.data.IndexDocument.Suffix||"",supportSubDir:g.data.IndexDocument&&g.data.IndexDocument.SupportSubDir||"false",type:g.data.IndexDocument&&g.data.IndexDocument.Type,routingRules:T,error:g.data.ErrorDocument&&g.data.ErrorDocument.Key||null,res:g.res});case 10:case"end":return F.stop()}},null,this)}},{"../utils/checkBucketName":35,"../utils/isObject":46,"babel-runtime/regenerator":68}],11:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=M(y);function M(_){return _&&_.__esModule?_:{default:_}}var D=d("../utils/checkBucketName"),A=D.checkBucketName,x=d("../utils/isArray"),v=x.isArray,h=d("../utils/deepCopy"),p=h.deepCopy,c=d("../utils/isObject"),m=c.isObject,C=d("../utils/obj2xml"),g=C.obj2xml,T=d("../utils/checkObjectTag"),B=T.checkObjectTag,F=d("../utils/getStrBytesCount"),J=F.getStrBytesCount,H=O;H.putBucketLifecycle=function(te,q,w){var X,ne,he,le,_e;return l.default.async(function(be){for(;;)switch(be.prev=be.next){case 0:if(A(te),v(q)){be.next=3;break}throw new Error("rules must be Array");case 3:return X=this._bucketRequestParams("PUT",te,"lifecycle",w),ne=[],he={LifecycleConfiguration:{Rule:ne}},q.forEach(function(j){K(j),U(j),j.id&&(j.ID=j.id,delete j.id),ne.push(j)}),le=g(he,{headers:!0,firstUpperCase:!0}),X.content=le,X.mime="xml",X.successStatuses=[200],be.next=13,l.default.awrap(this.request(X));case 13:return _e=be.sent,be.abrupt("return",{res:_e.res});case 15:case"end":return be.stop()}},null,this)};function K(_){_.days&&(_.expiration={days:_.days}),_.date&&(_.expiration={createdBeforeDate:_.date})}function Y(_,te){var q=_.days,w=_.createdBeforeDate;if(!q&&!w)throw new Error(te+" must includes days or createdBeforeDate");if(q&&!/^[1-9][0-9]*$/.test(q))throw new Error("days must be a positive integer");if(w&&!/\d{4}-\d{2}-\d{2}T00:00:00.000Z/.test(w))throw new Error("createdBeforeDate must be date and conform to iso8601 format")}function W(_){if(!v(_)&&!m(_))throw new Error("tag must be Object or Array");_=m(_)?[_]:_;var te={},q=p(_);q.forEach(function(w){te[w.key]=w.value}),B(te)}function U(_){if(_.id&&J(_.id)>255)throw new Error("ID is composed of 255 bytes at most");if(_.prefix===""||_.prefix===void 0)throw new Error("Rule must includes prefix");if(!["Enabled","Disabled"].includes(_.status))throw new Error("Status must be Enabled or Disabled");if(_.transition){if(!["IA","Archive"].includes(_.transition.storageClass))throw new Error("StorageClass must be IA or Archive");Y(_.transition,"Transition")}if(_.expiration){if(!_.expiration.expiredObjectDeleteMarker)Y(_.expiration,"Expiration");else if(_.expiration.days||_.expiration.createdBeforeDate)throw new Error("expiredObjectDeleteMarker cannot be used with days or createdBeforeDate")}if(_.abortMultipartUpload&&Y(_.abortMultipartUpload,"AbortMultipartUpload"),!_.expiration&&!_.abortMultipartUpload&&!_.transition&&!_.noncurrentVersionTransition)throw new Error("Rule must includes expiration or abortMultipartUpload or transition or noncurrentVersionTransition");if(_.tag){if(_.abortMultipartUpload)throw new Error("Tag cannot be used with abortMultipartUpload");W(_.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(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=M(y);function M(p){return p&&p.__esModule?p:{default:p}}var D=d("../utils/checkBucketName"),A=D.checkBucketName,x=d("../utils/obj2xml"),v=x.obj2xml,h=O;h.putBucketVersioning=function(c,m){var C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},g,T,B;return l.default.async(function(J){for(;;)switch(J.prev=J.next){case 0:if(A(c),["Enabled","Suspended"].includes(m)){J.next=3;break}throw new Error("status must be Enabled or Suspended");case 3:return g=this._bucketRequestParams("PUT",c,"versioning",C),T={VersioningConfiguration:{Status:m}},g.mime="xml",g.content=v(T,{headers:!0}),J.next=9,l.default.awrap(this.request(g));case 9:return B=J.sent,J.abrupt("return",{res:B.res,status:B.status});case 11:case"end":return J.stop()}},null,this)}},{"../utils/checkBucketName":35,"../utils/obj2xml":47,"babel-runtime/regenerator":68}],13:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=M(y);function M(m){return m&&m.__esModule?m:{default:m}}var D=d("../utils/checkBucketName"),A=D.checkBucketName,x=d("../utils/obj2xml"),v=x.obj2xml,h=d("../utils/isArray"),p=h.isArray,c=O;c.putBucketWebsite=function(C){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},T=arguments[2],B,F,J,H,K;return l.default.async(function(W){for(;;)switch(W.prev=W.next){case 0:if(A(C),B=this._bucketRequestParams("PUT",C,"website",T),F={Suffix:g.index||"index.html"},J={IndexDocument:F},H={WebsiteConfiguration:J},g.supportSubDir&&(F.SupportSubDir=g.supportSubDir),g.type&&(F.Type=g.type),g.error&&(J.ErrorDocument={Key:g.error}),!(g.routingRules!==void 0)){W.next=12;break}if(p(g.routingRules)){W.next=11;break}throw new Error("RoutingRules must be Array");case 11:J.RoutingRules={RoutingRule:g.routingRules};case 12:return H=v(H),B.content=H,B.mime="xml",B.successStatuses=[200],W.next=18,l.default.awrap(this.request(B));case 18:return K=W.sent,W.abrupt("return",{res:K.res});case 20:case"end":return W.stop()}},null,this)}},{"../utils/checkBucketName":35,"../utils/isArray":42,"../utils/obj2xml":47,"babel-runtime/regenerator":68}],14:[function(d,V,O){(function(y){"use strict";var l=d("babel-runtime/core-js/object/keys"),M=x(l),D=d("babel-runtime/core-js/json/stringify"),A=x(D);function x(v){return v&&v.__esModule?v:{default:v}}O.encodeCallback=function(h,p){if(h.headers=h.headers||{},!Object.prototype.hasOwnProperty.call(h.headers,"x-oss-callback")&&p.callback){var c={callbackUrl:encodeURI(p.callback.url),callbackBody:p.callback.body};p.callback.host&&(c.callbackHost=p.callback.host),p.callback.contentType&&(c.callbackBodyType=p.callback.contentType);var m=y.from((0,A.default)(c)).toString("base64");if(h.headers["x-oss-callback"]=m,p.callback.customValue){var C={};(0,M.default)(p.callback.customValue).forEach(function(g){C["x:"+g]=p.callback.customValue[g]}),h.headers["x-oss-callback-var"]=y.from((0,A.default)(C)).toString("base64")}}}}).call(this,d("buffer").Buffer)},{"babel-runtime/core-js/json/stringify":53,"babel-runtime/core-js/object/keys":60,buffer:73}],15:[function(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/assign"),l=M(y);function M(c){return c&&c.__esModule?c:{default:c}}var D=d("humanize-ms"),A=d("url"),x=d("../utils/checkBucketName"),v=x.checkBucketName;function h(c,m){var C=A.parse(c);if(C.protocol||(C=A.parse("http"+(m?"s":"")+"://"+c)),C.protocol!=="http:"&&C.protocol!=="https:")throw new Error("Endpoint protocol must be http or https.");return C}function p(c,m,C){var g=C?"https://":"http://",T=m?"-internal.aliyuncs.com":".aliyuncs.com",B="vpc100-oss-cn-";return c.substr(0,B.length)===B&&(T=".aliyuncs.com"),A.parse(g+c+T)}V.exports=function(c){if(!c||!c.accessKeyId||!c.accessKeySecret)throw new Error("require accessKeyId, accessKeySecret");c.bucket&&v(c.bucket);var m=(0,l.default)({region:"oss-cn-hangzhou",internal:!1,secure:!1,timeout:6e4,bucket:null,endpoint:null,cname:!1,isRequestPay:!1,sldEnable:!1},c);if(m.accessKeyId=m.accessKeyId.trim(),m.accessKeySecret=m.accessKeySecret.trim(),m.timeout&&(m.timeout=D(m.timeout)),m.endpoint)m.endpoint=h(m.endpoint,m.secure);else if(m.region)m.endpoint=p(m.region,m.internal,m.secure);else throw new Error("require options.endpoint or options.region");return m.inited=!0,m}},{"../utils/checkBucketName":35,"babel-runtime/core-js/object/assign":54,"humanize-ms":194,url:238}],16:[function(d,V,O){"use strict";var y=d("merge-descriptors"),l=O;y(l,d("./processObjectSave"))},{"./processObjectSave":17,"merge-descriptors":200}],17:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=M(y);function M(m){return m&&m.__esModule?m:{default:m}}var D=d("../utils/checkBucketName"),A=D.checkBucketName,x=d("querystring"),v=d("js-base64"),h=v.Base64.encode,p=O;p.processObjectSave=function(C,g,T,B){var F,J,H,K;return l.default.async(function(W){for(;;)switch(W.prev=W.next){case 0:return c(C,"sourceObject"),c(g,"targetObject"),c(T,"process"),g=this._objectName(g),B&&A(B),F=this._objectRequestParams("POST",C,{subres:"x-oss-process"}),J=B?",b_"+h(B):"",g=h(g),H={"x-oss-process":T+"|sys/saveas,o_"+g+J},F.content=x.stringify(H),W.next=12,l.default.awrap(this.request(F));case 12:return K=W.sent,W.abrupt("return",{res:K.res,status:K.res.status});case 14:case"end":return W.stop()}},null,this)};function c(m,C){if(!m)throw new Error(C+" is required");if(typeof m!="string")throw new Error(C+" must be String")}},{"../utils/checkBucketName":35,"babel-runtime/regenerator":68,"js-base64":199,querystring:212}],18:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=M(y);function M(p){return p&&p.__esModule?p:{default:p}}var D=d("copy-to"),A=d("./callback"),x=d("./utils/deepCopy"),v=x.deepCopy,h=O;h.listUploads=function(c,m){var C,g,T,B;return l.default.async(function(J){for(;;)switch(J.prev=J.next){case 0:return m=m||{},C={},D(m).to(C),C.subres="uploads",g=this._objectRequestParams("GET","",C),g.query=c,g.xmlResponse=!0,g.successStatuses=[200],J.next=10,l.default.awrap(this.request(g));case 10:return T=J.sent,B=T.data.Upload||[],Array.isArray(B)||(B=[B]),B=B.map(function(H){return{name:H.Key,uploadId:H.UploadId,initiated:H.Initiated}}),J.abrupt("return",{res:T.res,uploads:B,bucket:T.data.Bucket,nextKeyMarker:T.data.NextKeyMarker,nextUploadIdMarker:T.data.NextUploadIdMarker,isTruncated:T.data.IsTruncated==="true"});case 15:case"end":return J.stop()}},null,this)},h.listParts=function(c,m,C,g){var T,B,F;return l.default.async(function(H){for(;;)switch(H.prev=H.next){case 0:return g=g||{},T={},D(g).to(T),T.subres={uploadId:m},B=this._objectRequestParams("GET",c,T),B.query=C,B.xmlResponse=!0,B.successStatuses=[200],H.next=10,l.default.awrap(this.request(B));case 10:return F=H.sent,H.abrupt("return",{res:F.res,uploadId:F.data.UploadId,bucket:F.data.Bucket,name:F.data.Key,partNumberMarker:F.data.PartNumberMarker,nextPartNumberMarker:F.data.NextPartNumberMarker,maxParts:F.data.MaxParts,isTruncated:F.data.IsTruncated,parts:F.data.Part||[]});case 12:case"end":return H.stop()}},null,this)},h.abortMultipartUpload=function(c,m,C){var g,T,B;return l.default.async(function(J){for(;;)switch(J.prev=J.next){case 0:return this._stop(),C=C||{},g={},D(C).to(g),g.subres={uploadId:m},T=this._objectRequestParams("DELETE",c,g),T.successStatuses=[204],J.next=9,l.default.awrap(this.request(T));case 9:return B=J.sent,J.abrupt("return",{res:B.res});case 11:case"end":return J.stop()}},null,this)},h.initMultipartUpload=function(c,m){var C,g,T;return l.default.async(function(F){for(;;)switch(F.prev=F.next){case 0:return m=m||{},C={},D(m).to(C),C.headers=C.headers||{},this._convertMetaToHeaders(m.meta,C.headers),C.subres="uploads",g=this._objectRequestParams("POST",c,C),g.mime=m.mime,g.xmlResponse=!0,g.successStatuses=[200],F.next=12,l.default.awrap(this.request(g));case 12:return T=F.sent,F.abrupt("return",{res:T.res,bucket:T.data.Bucket,name:T.data.Key,uploadId:T.data.UploadId});case 14:case"end":return F.stop()}},null,this)},h.uploadPart=function(c,m,C,g,T,B,F){var J;return l.default.async(function(K){for(;;)switch(K.prev=K.next){case 0:return J={stream:this._createStream(g,T,B),size:B-T},K.next=3,l.default.awrap(this._uploadPart(c,m,C,J,F));case 3:return K.abrupt("return",K.sent);case 4:case"end":return K.stop()}},null,this)},h.completeMultipartUpload=function(c,m,C,g){var T,B,F,J,H,K,Y,W;return l.default.async(function(_){for(;;)switch(_.prev=_.next){case 0:for(T=C.concat().sort(function(te,q){return te.number-q.number}).filter(function(te,q,w){return!q||te.number!==w[q-1].number}),B=`<?xml version="1.0" encoding="UTF-8"?>
|
|
|
<CompleteMultipartUpload>
|
|
|
`,F=0;F<T.length;F++)J=T[F],B+=`<Part>
|
|
|
`,B+="<PartNumber>"+J.number+`</PartNumber>
|
|
|
`,B+="<ETag>"+J.etag+`</ETag>
|
|
|
`,B+=`</Part>
|
|
|
`;return B+="</CompleteMultipartUpload>",g=g||{},H={},H=v(g),H.headers&&delete H.headers["x-oss-server-side-encryption"],H.subres={uploadId:m},K=this._objectRequestParams("POST",c,H),A.encodeCallback(K,H),K.mime="xml",K.content=B,K.headers&&K.headers["x-oss-callback"]||(K.xmlResponse=!0),K.successStatuses=[200],_.next=17,l.default.awrap(this.request(K));case 17:return Y=_.sent,W={res:Y.res,bucket:K.bucket,name:c,etag:Y.res.headers.etag},K.headers&&K.headers["x-oss-callback"]&&(W.data=JSON.parse(Y.data.toString())),_.abrupt("return",W);case 21:case"end":return _.stop()}},null,this)},h._uploadPart=function(c,m,C,g,T){var B,F,J;return l.default.async(function(K){for(;;)switch(K.prev=K.next){case 0:return T=T||{},B={},D(T).to(B),B.headers={"Content-Length":g.size},B.subres={partNumber:C,uploadId:m},F=this._objectRequestParams("PUT",c,B),F.mime=B.mime,F.stream=g.stream,F.successStatuses=[200],K.next=11,l.default.awrap(this.request(F));case 11:if(J=K.sent,J.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 g.stream=null,F.stream=null,K.abrupt("return",{name:c,etag:J.res.headers.etag,res:J.res});case 17:case"end":return K.stop()}},null,this)}},{"./callback":14,"./utils/deepCopy":39,"babel-runtime/regenerator":68,"copy-to":76}],19:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=v(y),M=d("babel-runtime/core-js/object/keys"),D=v(M),A=d("babel-runtime/helpers/typeof"),x=v(A);function v(m){return m&&m.__esModule?m:{default:m}}var h=d("../utils/checkBucketName"),p=h.checkBucketName,c=O;c.copy=function(C,g,T,B){var F,J,H;return l.default.async(function(Y){for(;;)switch(Y.prev=Y.next){case 0:return(typeof T=="undefined"?"undefined":(0,x.default)(T))==="object"&&(B=T),B=B||{},B.headers=B.headers||{},(0,D.default)(B.headers).forEach(function(W){B.headers["x-oss-copy-source-"+W.toLowerCase()]=B.headers[W]}),B.meta&&(B.headers["x-oss-metadata-directive"]="REPLACE"),this._convertMetaToHeaders(B.meta,B.headers),g=this._getSourceName(g,T),B.versionId&&(g=g+"?versionId="+B.versionId),B.headers["x-oss-copy-source"]=g,F=this._objectRequestParams("PUT",C,B),F.xmlResponse=!0,F.successStatuses=[200,304],Y.next=14,l.default.awrap(this.request(F));case 14:return J=Y.sent,H=J.data,H&&(H={etag:H.ETag,lastModified:H.LastModified}),Y.abrupt("return",{data:H,res:J.res});case 18:case"end":return Y.stop()}},null,this)},c._getSourceName=function(C,g){return typeof g=="string"?C=this._objectName(C):C[0]!=="/"?g=this.options.bucket:(g=C.replace(/\/(.+?)(\/.*)/,"$1"),C=C.replace(/(\/.+?\/)(.*)/,"$2")),p(g),C=encodeURI(C),C="/"+g+"/"+C,C}},{"../utils/checkBucketName":35,"babel-runtime/core-js/object/keys":60,"babel-runtime/helpers/typeof":67,"babel-runtime/regenerator":68}],20:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=A(y),M=d("babel-runtime/core-js/object/assign"),D=A(M);function A(v){return v&&v.__esModule?v:{default:v}}var x=O;x.delete=function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c,m;return l.default.async(function(g){for(;;)switch(g.prev=g.next){case 0:return p.subres=(0,D.default)({},p.subres),p.versionId&&(p.subres.versionId=p.versionId),c=this._objectRequestParams("DELETE",h,p),c.successStatuses=[204],g.next=6,l.default.awrap(this.request(c));case 6:return m=g.sent,g.abrupt("return",{res:m.res});case 8:case"end":return g.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],21:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=A(y),M=d("babel-runtime/core-js/object/assign"),D=A(M);function A(c){return c&&c.__esModule?c:{default:c}}var x=d("utility"),v=d("../utils/obj2xml"),h=v.obj2xml,p=O;p.deleteMulti=function(m){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g,T,B,F,J,H,K,Y,W,U,_,te;return l.default.async(function(w){for(;;)switch(w.prev=w.next){case 0:if(g=[],!(!m||!m.length)){w.next=3;break}throw new Error("names is required");case 3:for(T=0;T<m.length;T++)B={},typeof m[T]=="string"?B.Key=x.escape(this._objectName(m[T])):(F=m[T],J=F.key,H=F.versionId,B.Key=x.escape(this._objectName(J)),B.VersionId=H),g.push(B);return K={Delete:{Quiet:!!C.quiet,Object:g}},Y=h(K,{headers:!0}),C.subres=(0,D.default)({delete:""},C.subres),C.versionId&&(C.subres.versionId=C.versionId),W=this._objectRequestParams("POST","",C),W.mime="xml",W.content=Y,W.xmlResponse=!0,W.successStatuses=[200],w.next=15,l.default.awrap(this.request(W));case 15:return U=w.sent,_=U.data,te=_&&_.Deleted||null,te&&(Array.isArray(te)||(te=[te])),w.abrupt("return",{res:U.res,deleted:te||[]});case 20:case"end":return w.stop()}},null,this)}},{"../utils/obj2xml":47,"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68,utility:290}],22:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=A(y),M=d("babel-runtime/core-js/object/assign"),D=A(M);function A(v){return v&&v.__esModule?v:{default:v}}var x=O;x.deleteObjectTagging=function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c,m;return l.default.async(function(g){for(;;)switch(g.prev=g.next){case 0:return p.subres=(0,D.default)({tagging:""},p.subres),p.versionId&&(p.subres.versionId=p.versionId),h=this._objectName(h),c=this._objectRequestParams("DELETE",h,p),c.successStatuses=[204],g.next=7,l.default.awrap(this.request(c));case 7:return m=g.sent,g.abrupt("return",{status:m.status,res:m.res});case 9:case"end":return g.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],23:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=A(y),M=d("babel-runtime/core-js/object/assign"),D=A(M);function A(p){return p&&p.__esModule?p:{default:p}}var x=d("fs"),v=d("is-type-of"),h=O;h.get=function(c,m){var C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},g,T,B,F;return l.default.async(function(H){for(;;)switch(H.prev=H.next){case 0:return g=null,T=!1,v.writableStream(m)?g=m:v.string(m)?(g=x.createWriteStream(m),T=!0):C=m,C=C||{},C.subres=(0,D.default)({},C.subres),C.versionId&&(C.subres.versionId=C.versionId),C.process&&(C.subres["x-oss-process"]=C.process),B=void 0,H.prev=8,F=this._objectRequestParams("GET",c,C),F.writeStream=g,F.successStatuses=[200,206,304],H.next=14,l.default.awrap(this.request(F));case 14:B=H.sent,T&&g.destroy(),H.next=25;break;case 18:if(H.prev=18,H.t0=H.catch(8),!T){H.next=24;break}return g.destroy(),H.next=24,l.default.awrap(this._deleteFileSafe(m));case 24:throw H.t0;case 25:return H.abrupt("return",{res:B.res,content:B.data});case 26:case"end":return H.stop()}},null,this,[[8,18]])}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68,fs:71,"is-type-of":289}],24:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=A(y),M=d("babel-runtime/core-js/object/assign"),D=A(M);function A(v){return v&&v.__esModule?v:{default:v}}var x=O;x.getACL=function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c,m;return l.default.async(function(g){for(;;)switch(g.prev=g.next){case 0:return p.subres=(0,D.default)({acl:""},p.subres),p.versionId&&(p.subres.versionId=p.versionId),h=this._objectName(h),c=this._objectRequestParams("GET",h,p),c.successStatuses=[200],c.xmlResponse=!0,g.next=8,l.default.awrap(this.request(c));case 8:return m=g.sent,g.abrupt("return",{acl:m.data.AccessControlList.Grant,owner:{id:m.data.Owner.ID,displayName:m.data.Owner.DisplayName},res:m.res});case 10:case"end":return g.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],25:[function(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/keys"),l=v(y),M=d("babel-runtime/regenerator"),D=v(M),A=d("babel-runtime/core-js/object/assign"),x=v(A);function v(F){return F&&F.__esModule?F:{default:F}}var h=O,p=d("../utils/isObject"),c=p.isObject,m=d("../utils/isArray"),C=m.isArray;h.getBucketVersions=g,h.listObjectVersions=g;function g(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},H,K,Y,W,U,_;return D.default.async(function(q){for(;;)switch(q.prev=q.next){case 0:if(!(F.versionIdMarker&&F.keyMarker===void 0)){q.next=2;break}throw new Error("A version-id marker cannot be specified without a key marker");case 2:return J.subres=(0,x.default)({versions:""},J.subres),J.versionId&&(J.subres.versionId=J.versionId),H=this._objectRequestParams("GET","",J),H.xmlResponse=!0,H.successStatuses=[200],H.query=B(F),q.next=10,D.default.awrap(this.request(H));case 10:return K=q.sent,Y=K.data.Version||[],W=K.data.DeleteMarker||[],U=this,Y&&(Array.isArray(Y)||(Y=[Y]),Y=Y.map(function(w){return{name:w.Key,url:U._objectUrl(w.Key),lastModified:w.LastModified,isLatest:w.IsLatest==="true",versionId:w.VersionId,etag:w.ETag,type:w.Type,size:Number(w.Size),storageClass:w.StorageClass,owner:{id:w.Owner.ID,displayName:w.Owner.DisplayName}}})),W&&(C(W)||(W=[W]),W=W.map(function(w){return{name:w.Key,lastModified:w.LastModified,versionId:w.VersionId,owner:{id:w.Owner.ID,displayName:w.Owner.DisplayName}}})),_=K.data.CommonPrefixes||null,_&&(C(_)||(_=[_]),_=_.map(function(w){return w.Prefix})),q.abrupt("return",{res:K.res,objects:Y,deleteMarker:W,prefixes:_,nextMarker:K.data.NextMarker||null,NextVersionIdMarker:K.data.NextVersionIdMarker||null,isTruncated:K.data.IsTruncated==="true"});case 19:case"end":return q.stop()}},null,this)}function T(F){return F.replace(/([A-Z])/g,"-$1").toLowerCase()}function B(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},J={};return c(F)&&(0,l.default)(F).forEach(function(H){J[T(H)]=F[H]}),J}},{"../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(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=A(y),M=d("babel-runtime/core-js/object/assign"),D=A(M);function A(v){return v&&v.__esModule?v:{default:v}}var x=O;x.getObjectMeta=function(h,p){var c,m;return l.default.async(function(g){for(;;)switch(g.prev=g.next){case 0:return p=p||{},h=this._objectName(h),p.subres=(0,D.default)({objectMeta:""},p.subres),p.versionId&&(p.subres.versionId=p.versionId),c=this._objectRequestParams("HEAD",h,p),c.successStatuses=[200],g.next=8,l.default.awrap(this.request(c));case 8:return m=g.sent,g.abrupt("return",{status:m.status,res:m.res});case 10:case"end":return g.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],27:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=A(y),M=d("babel-runtime/core-js/object/assign"),D=A(M);function A(p){return p&&p.__esModule?p:{default:p}}var x=O,v=d("../utils/isObject"),h=v.isObject;x.getObjectTagging=function(c){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C,g,T,B,F;return l.default.async(function(H){for(;;)switch(H.prev=H.next){case 0:return m.subres=(0,D.default)({tagging:""},m.subres),m.versionId&&(m.subres.versionId=m.versionId),c=this._objectName(c),C=this._objectRequestParams("GET",c,m),C.successStatuses=[200],H.next=7,l.default.awrap(this.request(C));case 7:return g=H.sent,H.next=10,l.default.awrap(this.parseXML(g.data));case 10:return T=H.sent,B=T.TagSet.Tag,B=B&&h(B)?[B]:B||[],F={},B.forEach(function(K){F[K.Key]=K.Value}),H.abrupt("return",{status:g.status,res:g.res,tag:F});case 16:case"end":return H.stop()}},null,this)}},{"../utils/isObject":46,"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],28:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=A(y),M=d("babel-runtime/core-js/object/assign"),D=A(M);function A(v){return v&&v.__esModule?v:{default:v}}var x=O;x.getSymlink=function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c,m,C;return l.default.async(function(T){for(;;)switch(T.prev=T.next){case 0:return p.subres=(0,D.default)({symlink:""},p.subres),p.versionId&&(p.subres.versionId=p.versionId),h=this._objectName(h),c=this._objectRequestParams("GET",h,p),c.successStatuses=[200],T.next=7,l.default.awrap(this.request(c));case 7:return m=T.sent,C=m.res.headers["x-oss-symlink-target"],T.abrupt("return",{targetName:decodeURIComponent(C),res:m.res});case 10:case"end":return T.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],29:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=v(y),M=d("babel-runtime/core-js/object/keys"),D=v(M),A=d("babel-runtime/core-js/object/assign"),x=v(A);function v(p){return p&&p.__esModule?p:{default:p}}var h=O;h.head=function(c){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C,g,T;return l.default.async(function(F){for(;;)switch(F.prev=F.next){case 0:return m.subres=(0,x.default)({},m.subres),m.versionId&&(m.subres.versionId=m.versionId),C=this._objectRequestParams("HEAD",c,m),C.successStatuses=[200,304],F.next=6,l.default.awrap(this.request(C));case 6:return g=F.sent,T={meta:null,res:g.res,status:g.status},g.status===200&&(0,D.default)(g.headers).forEach(function(J){J.indexOf("x-oss-meta-")===0&&(T.meta||(T.meta={}),T.meta[J.substring(11)]=g.headers[J])}),F.abrupt("return",T);case 10:case"end":return F.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/object/keys":60,"babel-runtime/regenerator":68}],30:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=A(y),M=d("babel-runtime/core-js/object/assign"),D=A(M);function A(v){return v&&v.__esModule?v:{default:v}}var x=O;x.putACL=function(h,p,c){var m,C;return l.default.async(function(T){for(;;)switch(T.prev=T.next){case 0:return c=c||{},c.subres=(0,D.default)({acl:""},c.subres),c.versionId&&(c.subres.versionId=c.versionId),c.headers=c.headers||{},c.headers["x-oss-object-acl"]=p,h=this._objectName(h),m=this._objectRequestParams("PUT",h,c),m.successStatuses=[200],T.next=10,l.default.awrap(this.request(m));case 10:return C=T.sent,T.abrupt("return",{res:C.res});case 12:case"end":return T.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],31:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=v(y),M=d("babel-runtime/core-js/object/keys"),D=v(M),A=d("babel-runtime/core-js/object/assign"),x=v(A);function v(g){return g&&g.__esModule?g:{default:g}}var h=d("../utils/obj2xml"),p=h.obj2xml,c=d("../utils/checkObjectTag"),m=c.checkObjectTag,C=O;C.putObjectTagging=function(T,B){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},J,H,K;return l.default.async(function(W){for(;;)switch(W.prev=W.next){case 0:return m(B),F.subres=(0,x.default)({tagging:""},F.subres),F.versionId&&(F.subres.versionId=F.versionId),T=this._objectName(T),J=this._objectRequestParams("PUT",T,F),J.successStatuses=[200],B=(0,D.default)(B).map(function(U){return{Key:U,Value:B[U]}}),H={Tagging:{TagSet:{Tag:B}}},J.mime="xml",J.content=p(H),W.next=12,l.default.awrap(this.request(J));case 12:return K=W.sent,W.abrupt("return",{res:K.res,status:K.status});case 14:case"end":return W.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(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=A(y),M=d("babel-runtime/core-js/object/assign"),D=A(M);function A(v){return v&&v.__esModule?v:{default:v}}var x=O;x.putSymlink=function(h,p,c){var m,C;return l.default.async(function(T){for(;;)switch(T.prev=T.next){case 0:return c=c||{},c.headers=c.headers||{},p=this._escape(this._objectName(p)),this._convertMetaToHeaders(c.meta,c.headers),c.headers["x-oss-symlink-target"]=p,c.subres=(0,D.default)({symlink:""},c.subres),c.versionId&&(c.subres.versionId=c.versionId),c.storageClass&&(c.headers["x-oss-storage-class"]=c.storageClass),h=this._objectName(h),m=this._objectRequestParams("PUT",h,c),m.successStatuses=[200],T.next=13,l.default.awrap(this.request(m));case 13:return C=T.sent,T.abrupt("return",{res:C.res});case 15:case"end":return T.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],33:[function(d,V,O){"use strict";var y=d("babel-runtime/regenerator"),l=A(y),M=d("babel-runtime/core-js/promise"),D=A(M);function A(v){return v&&v.__esModule?v:{default:v}}var x=O;x._parallelNode=function(h,p,c,m){var C,g,T,B,F,J,H,K;return l.default.async(function(W){for(;;)switch(W.prev=W.next){case 0:C=this,g=[],T=[],B=h.length/p,F=h.length%p,J=F===0?B:(h.length-F)/p+1,H=1,K=0;case 8:if(!(K<h.length)){W.next=26;break}if(!C.isCancel()){W.next=11;break}return W.abrupt("break",26);case 11:if(m?T.push(c(C,h[K],m)):T.push(c(C,h[K])),!(T.length===p||H===J&&K===h.length-1)){W.next=23;break}return W.prev=13,H+=1,W.next=17,l.default.awrap(D.default.all(T));case 17:W.next=22;break;case 19:W.prev=19,W.t0=W.catch(13),g.push(W.t0);case 22:T=[];case 23:K++,W.next=8;break;case 26:return W.abrupt("return",g);case 27:case"end":return W.stop()}},null,this,[[13,19]])},x._parallel=function(h,p,c){var m=this;return new D.default(function(C){var g=[];if(p<=0||!h){C(g);return}function T(_){return function(){if(_===null)throw new Error("Callback was already called.");var te=_;_=null;for(var q=arguments.length,w=Array(q),X=0;X<q;X++)w[X]=arguments[X];te.apply(this,w)}}function B(_){var te=-1,q=_.length;return function(){return++te<q&&!m.isCancel()?{value:_[te],key:te}:null}}var F=B(h),J=!1,H=0,K=!1;function Y(_,te){H-=1,_?(J=!0,g.push(_),C(g)):te==={}||J&&H<=0?(J=!0,C(g)):K||(m.isCancel()?C(g):U())}function W(_,te){c(_).then(function(q){te(null,q)}).catch(function(q){te(q)})}function U(){for(K=!0;H<p&&!J&&!m.isCancel();){var _=F();if(_===null||g.length>0){J=!0,H<=0&&C(g);return}H+=1,W(_.value,T(Y))}K=!1}U()})},x.cancel=function(h){this.options.cancelFlag=!0,h&&this.abortMultipartUpload(h.name,h.uploadId,h.options)},x.isCancel=function(){return this.options.cancelFlag},x.resetCancelFlag=function(){this.options.cancelFlag=!1},x._stop=function(){this.options.cancelFlag=!0},x._makeCancelEvent=function(){var h={status:0,name:"cancel"};return h}},{"babel-runtime/core-js/promise":61,"babel-runtime/regenerator":68}],34:[function(d,V,O){(function(y){"use strict";var l=d("babel-runtime/core-js/json/stringify"),M=x(l),D=d("babel-runtime/core-js/object/keys"),A=x(D);function x(p){return p&&p.__esModule?p:{default:p}}var v=d("./../../shims/crypto/crypto.js"),h=d("is-type-of");O.buildCanonicalizedResource=function(c,m){var C=""+c,g="?";if(h.string(m)&&m.trim()!=="")C+=g+m;else if(h.array(m))m.sort(),C+=g+m.join("&");else if(m){var T=function(J,H){return J[0]>H[0]?1:J[0]<H[0]?-1:0},B=function(J){C+=g+J,m[J]&&(C+="="+m[J]),g="&"};(0,A.default)(m).sort(T).forEach(B)}return C},O.buildCanonicalString=function(c,m,C,g){C=C||{};var T=C.headers||{},B="x-oss-",F=[],J={},H=[c.toUpperCase(),T["Content-Md5"]||"",T["Content-Type"]||T["Content-Type".toLowerCase()],g||T["x-oss-date"]];return(0,A.default)(T).forEach(function(K){var Y=K.toLowerCase();Y.indexOf(B)===0&&(J[Y]=String(T[K]).trim())}),(0,A.default)(J).sort().forEach(function(K){F.push(K+":"+J[K])}),H=H.concat(F),H.push(this.buildCanonicalizedResource(m,C.parameters)),H.join(`
|
|
|
`)},O.computeSignature=function(c,m){var C=v.createHmac("sha1",c);return C.update(y.from(m,"utf8")).digest("base64")},O.authorization=function(c,m,C){return"OSS "+c+":"+this.computeSignature(m,C)},O._signatureForURL=function(c){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=arguments[2],g=arguments[3],T={},B=m.subResource,F=B===void 0?{}:B;if(m.process){var J="x-oss-process";F[J]=m.process}if(m.trafficLimit){var H="x-oss-traffic-limit";F[H]=m.trafficLimit}if(m.response&&(0,A.default)(m.response).forEach(function(U){var _="response-"+U.toLowerCase();F[_]=m.response[U]}),(0,A.default)(m).forEach(function(U){var _=U.toLowerCase(),te=m[U];_.indexOf("x-oss-")===0?T[_]=te:(_.indexOf("content-md5")===0||_.indexOf("content-type")===0)&&(T[U]=te)}),Object.prototype.hasOwnProperty.call(m,"security-token")&&(F["security-token"]=m["security-token"]),Object.prototype.hasOwnProperty.call(m,"callback")){var K={callbackUrl:encodeURI(m.callback.url),callbackBody:m.callback.body};if(m.callback.host&&(K.callbackHost=m.callback.host),m.callback.contentType&&(K.callbackBodyType=m.callback.contentType),F.callback=y.from((0,M.default)(K)).toString("base64"),m.callback.customValue){var Y={};(0,A.default)(m.callback.customValue).forEach(function(U){Y["x:"+U]=m.callback.customValue[U]}),F["callback-var"]=y.from((0,M.default)(Y)).toString("base64")}}var W=this.buildCanonicalString(m.method,C,{headers:T,parameters:F},g.toString());return{Signature:this.computeSignature(c,W),subResource:F}}}).call(this,d("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(d,V,O){"use strict";Object.defineProperty(O,"__esModule",{value:!0}),O.checkBucketName=void 0,O.checkBucketName=function(y,l){var M=l?/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/:/^[a-z0-9_][a-z0-9-_]{1,61}[a-z0-9_]$/;if(!M.test(y))throw new Error("The bucket must be conform to the specifications")}},{}],36:[function(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/entries"),l=M(y);function M(m){return m&&m.__esModule?m:{default:m}}Object.defineProperty(O,"__esModule",{value:!0}),O.checkObjectTag=void 0;var D=d("./checkValid"),A=D.checkValid,x=d("./isObject"),v=x.isObject,h=[{validator:function(C){if(typeof C!="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 (/)"}],p={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 c(m){if(!v(m))throw new Error("tag must be Object");var C=(0,l.default)(m);if(C.length>10)throw new Error("maximum of 10 tags for a object");var g=["key","value"];C.forEach(function(T){T.forEach(function(B,F){A(B,p[g[F]])})})}O.checkObjectTag=c},{"./checkValid":37,"./isObject":46,"babel-runtime/core-js/object/entries":57}],37:[function(d,V,O){"use strict";Object.defineProperty(O,"__esModule",{value:!0}),O.checkValid=void 0;function y(l,M){M.forEach(function(D){if(D.validator)D.validator(l);else if(D.pattern&&!D.pattern.test(l))throw new Error(D.msg)})}O.checkValid=y},{}],38:[function(d,V,O){(function(y){"use strict";var l=d("babel-runtime/core-js/object/assign"),M=D(l);function D(T){return T&&T.__esModule?T:{default:T}}Object.defineProperty(O,"__esModule",{value:!0}),O.createRequest=void 0;var A=d("./../../../shims/crypto/crypto.js"),x=d("debug")("ali-oss"),v=d("mime"),h=d("dateformat"),p=d("copy-to"),c=d("path");function m(T,B){return T[B]||T[B.toLowerCase()]}function C(T,B){delete T[B],delete T[B.toLowerCase()]}function g(T){var B=new Date;this.options.amendTimeSkewed&&(B=+new Date+this.options.amendTimeSkewed);var F={"x-oss-date":h(B,"UTC:ddd, dd mmm yyyy HH:MM:ss 'GMT'"),"x-oss-user-agent":this.userAgent};this.userAgent.includes("nodejs")&&(F["User-Agent"]=this.userAgent),this.options.isRequestPay&&(0,M.default)(F,{"x-oss-request-payer":"requester"}),this.options.stsToken&&(F["x-oss-security-token"]=this.options.stsToken),p(T.headers).to(F),m(F,"Content-Type")||(T.mime&&T.mime.indexOf("/")>0?F["Content-Type"]=T.mime:F["Content-Type"]=v.getType(T.mime||c.extname(T.object||""))),m(F,"Content-Type")||C(F,"Content-Type"),T.content&&(F["Content-Md5"]=A.createHash("md5").update(y.from(T.content,"utf8")).digest("base64"),F["Content-Length"]||(F["Content-Length"]=T.content.length));var J=this._getResource(T);F.authorization=this.authorization(T.method,J,T.subres,F);var H=this._getReqUrl(T);x("request %s %s, with headers %j, !!stream: %s",T.method,H,F,!!T.stream);var K=T.timeout||this.options.timeout,Y={method:T.method,content:T.content,stream:T.stream,headers:F,timeout:K,writeStream:T.writeStream,customResponse:T.customResponse,ctx:T.ctx||this.ctx};return this.agent&&(Y.agent=this.agent),this.httpsAgent&&(Y.httpsAgent=this.httpsAgent),{url:H,params:Y}}O.createRequest=g}).call(this,d("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(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/keys"),l=A(y),M=d("babel-runtime/helpers/typeof"),D=A(M);function A(x){return x&&x.__esModule?x:{default:x}}Object.defineProperty(O,"__esModule",{value:!0}),O.deepCopy=void 0,O.deepCopy=function(x){if(x===null||(typeof x=="undefined"?"undefined":(0,D.default)(x))!=="object")return x;var v=Array.isArray(x)?[]:{};return(0,l.default)(x).forEach(function(h){v[h]=O.deepCopy(x[h])}),v}},{"babel-runtime/core-js/object/keys":60,"babel-runtime/helpers/typeof":67}],40:[function(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/keys"),l=A(y),M=d("babel-runtime/helpers/typeof"),D=A(M);function A(h){return h&&h.__esModule?h:{default:h}}Object.defineProperty(O,"__esModule",{value:!0}),O.formatObjKey=void 0;function x(h,p){if(h===null||(typeof h=="undefined"?"undefined":(0,D.default)(h))!=="object")return h;var c=void 0;if(Array.isArray(h)){c=[];for(var m=0;m<h.length;m++)c.push(x(h[m],p))}else c={},(0,l.default)(h).forEach(function(C){c[v(C,p)]=x(h[C],p)});return c}O.formatObjKey=x;function v(h,p){return p==="firstUpperCase"?h=h.replace(/^./,function(c){return c.toUpperCase()}):p==="firstLowerCase"&&(h=h.replace(/^./,function(c){return c.toLowerCase()})),h}},{"babel-runtime/core-js/object/keys":60,"babel-runtime/helpers/typeof":67}],41:[function(d,V,O){"use strict";Object.defineProperty(O,"__esModule",{value:!0}),O.getStrBytesCount=void 0;function y(l){for(var M=0,D=0;D<l.length;D++){var A=l.charAt(D);/^[\u00-\uff]$/.test(A)?M+=1:M+=2}return M}O.getStrBytesCount=y},{}],42:[function(d,V,O){"use strict";Object.defineProperty(O,"__esModule",{value:!0}),O.isArray=void 0,O.isArray=function(y){return Object.prototype.toString.call(y)==="[object Array]"}},{}],43:[function(d,V,O){"use strict";Object.defineProperty(O,"__esModule",{value:!0}),O.isBlob=void 0;function y(l){return typeof Blob!="undefined"&&l instanceof Blob}O.isBlob=y},{}],44:[function(d,V,O){"use strict";Object.defineProperty(O,"__esModule",{value:!0}),O.isFile=void 0,O.isFile=function(y){return typeof File!="undefined"&&y instanceof File}},{}],45:[function(d,V,O){"use strict";Object.defineProperty(O,"__esModule",{value:!0}),O.isIP=void 0,O.isIP=function(y){var l=/^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}$/,M=/^\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 l.test(y)||M.test(y)}},{}],46:[function(d,V,O){"use strict";Object.defineProperty(O,"__esModule",{value:!0}),O.isObject=void 0,O.isObject=function(y){return Object.prototype.toString.call(y)==="[object Object]"}},{}],47:[function(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/keys"),l=M(y);function M(v){return v&&v.__esModule?v:{default:v}}Object.defineProperty(O,"__esModule",{value:!0}),O.obj2xml=void 0;var D=d("./formatObjKey");function A(v){return Object.prototype.toString.call(v).replace(/(.*? |])/g,"").toLowerCase()}function x(v,h){var p="";return h&&h.headers&&(p=`<?xml version="1.0" encoding="UTF-8"?>
|
|
|
`),h&&h.firstUpperCase&&(v=D.formatObjKey(v,"firstUpperCase")),A(v)==="object"?(0,l.default)(v).forEach(function(c){A(v[c])==="string"||A(v[c])==="number"?p+="<"+c+">"+v[c]+"</"+c+">":A(v[c])==="object"?p+="<"+c+">"+x(v[c])+"</"+c+">":A(v[c])==="array"?p+=v[c].map(function(m){return"<"+c+">"+x(m)+"</"+c+">"}).join(""):p+="<"+c+">"+v[c].toString()+"</"+c+">"}):p+=v.toString(),p}O.obj2xml=x},{"./formatObjKey":40,"babel-runtime/core-js/object/keys":60}],48:[function(d,V,O){V.exports=y,V.exports.HttpsAgent=y;function y(){}},{}],49:[function(d,V,O){V.exports=d("./register")().Promise},{"./register":51}],50:[function(d,V,O){"use strict";var y="@@any-promise/REGISTRATION",l=null;V.exports=function(M,D){return function(x,v){x=x||null,v=v||{};var h=v.global!==!1;if(l===null&&h&&(l=M[y]||null),l!==null&&x!==null&&l.implementation!==x)throw new Error('any-promise already defined as "'+l.implementation+'". You can only register an implementation before the first call to require("any-promise") and an implementation cannot be changed');return l===null&&(x!==null&&typeof v.Promise!="undefined"?l={Promise:v.Promise,implementation:x}:l=D(x),h&&(M[y]=l)),l}}},{}],51:[function(d,V,O){"use strict";V.exports=d("./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(d,V,O){V.exports={default:d("core-js/library/fn/array/from"),__esModule:!0}},{"core-js/library/fn/array/from":77}],53:[function(d,V,O){V.exports={default:d("core-js/library/fn/json/stringify"),__esModule:!0}},{"core-js/library/fn/json/stringify":78}],54:[function(d,V,O){V.exports={default:d("core-js/library/fn/object/assign"),__esModule:!0}},{"core-js/library/fn/object/assign":79}],55:[function(d,V,O){V.exports={default:d("core-js/library/fn/object/create"),__esModule:!0}},{"core-js/library/fn/object/create":80}],56:[function(d,V,O){V.exports={default:d("core-js/library/fn/object/define-property"),__esModule:!0}},{"core-js/library/fn/object/define-property":81}],57:[function(d,V,O){V.exports={default:d("core-js/library/fn/object/entries"),__esModule:!0}},{"core-js/library/fn/object/entries":82}],58:[function(d,V,O){V.exports={default:d("core-js/library/fn/object/get-own-property-names"),__esModule:!0}},{"core-js/library/fn/object/get-own-property-names":83}],59:[function(d,V,O){V.exports={default:d("core-js/library/fn/object/get-prototype-of"),__esModule:!0}},{"core-js/library/fn/object/get-prototype-of":84}],60:[function(d,V,O){V.exports={default:d("core-js/library/fn/object/keys"),__esModule:!0}},{"core-js/library/fn/object/keys":85}],61:[function(d,V,O){V.exports={default:d("core-js/library/fn/promise"),__esModule:!0}},{"core-js/library/fn/promise":86}],62:[function(d,V,O){V.exports={default:d("core-js/library/fn/set-immediate"),__esModule:!0}},{"core-js/library/fn/set-immediate":87}],63:[function(d,V,O){V.exports={default:d("core-js/library/fn/string/from-code-point"),__esModule:!0}},{"core-js/library/fn/string/from-code-point":88}],64:[function(d,V,O){V.exports={default:d("core-js/library/fn/symbol"),__esModule:!0}},{"core-js/library/fn/symbol":90}],65:[function(d,V,O){V.exports={default:d("core-js/library/fn/symbol/has-instance"),__esModule:!0}},{"core-js/library/fn/symbol/has-instance":89}],66:[function(d,V,O){V.exports={default:d("core-js/library/fn/symbol/iterator"),__esModule:!0}},{"core-js/library/fn/symbol/iterator":91}],67:[function(d,V,O){"use strict";O.__esModule=!0;var y=d("../core-js/symbol/iterator"),l=x(y),M=d("../core-js/symbol"),D=x(M),A=typeof D.default=="function"&&typeof l.default=="symbol"?function(v){return typeof v}:function(v){return v&&typeof D.default=="function"&&v.constructor===D.default&&v!==D.default.prototype?"symbol":typeof v};function x(v){return v&&v.__esModule?v:{default:v}}O.default=typeof D.default=="function"&&A(l.default)==="symbol"?function(v){return typeof v=="undefined"?"undefined":A(v)}:function(v){return v&&typeof D.default=="function"&&v.constructor===D.default&&v!==D.default.prototype?"symbol":typeof v=="undefined"?"undefined":A(v)}},{"../core-js/symbol":64,"../core-js/symbol/iterator":66}],68:[function(d,V,O){V.exports=d("regenerator-runtime")},{"regenerator-runtime":226}],69:[function(d,V,O){"use strict";O.byteLength=h,O.toByteArray=c,O.fromByteArray=g;for(var y=[],l=[],M=typeof Uint8Array!="undefined"?Uint8Array:Array,D="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A=0,x=D.length;A<x;++A)y[A]=D[A],l[D.charCodeAt(A)]=A;l["-".charCodeAt(0)]=62,l["_".charCodeAt(0)]=63;function v(T){var B=T.length;if(B%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var F=T.indexOf("=");F===-1&&(F=B);var J=F===B?0:4-F%4;return[F,J]}function h(T){var B=v(T),F=B[0],J=B[1];return(F+J)*3/4-J}function p(T,B,F){return(B+F)*3/4-F}function c(T){var B,F=v(T),J=F[0],H=F[1],K=new M(p(T,J,H)),Y=0,W=H>0?J-4:J,U;for(U=0;U<W;U+=4)B=l[T.charCodeAt(U)]<<18|l[T.charCodeAt(U+1)]<<12|l[T.charCodeAt(U+2)]<<6|l[T.charCodeAt(U+3)],K[Y++]=B>>16&255,K[Y++]=B>>8&255,K[Y++]=B&255;return H===2&&(B=l[T.charCodeAt(U)]<<2|l[T.charCodeAt(U+1)]>>4,K[Y++]=B&255),H===1&&(B=l[T.charCodeAt(U)]<<10|l[T.charCodeAt(U+1)]<<4|l[T.charCodeAt(U+2)]>>2,K[Y++]=B>>8&255,K[Y++]=B&255),K}function m(T){return y[T>>18&63]+y[T>>12&63]+y[T>>6&63]+y[T&63]}function C(T,B,F){for(var J,H=[],K=B;K<F;K+=3)J=(T[K]<<16&16711680)+(T[K+1]<<8&65280)+(T[K+2]&255),H.push(m(J));return H.join("")}function g(T){for(var B,F=T.length,J=F%3,H=[],K=16383,Y=0,W=F-J;Y<W;Y+=K)H.push(C(T,Y,Y+K>W?W:Y+K));return J===1?(B=T[F-1],H.push(y[B>>2]+y[B<<4&63]+"==")):J===2&&(B=(T[F-2]<<8)+T[F-1],H.push(y[B>>10]+y[B>>4&63]+y[B<<2&63]+"=")),H.join("")}},{}],70:[function(d,V,O){/*!
|
|
|
* Bowser - a browser detector
|
|
|
* https://github.com/ded/bowser
|
|
|
* MIT License | (c) Dustin Diaz 2015
|
|
|
*/!function(y,l,M){typeof V!="undefined"&&V.exports?V.exports=M():typeof define=="function"&&define.amd?define(l,M):y[l]=M()}(this,"bowser",function(){var y=!0;function l(p){function c(L){var re=p.match(L);return re&&re.length>1&&re[1]||""}function m(L){var re=p.match(L);return re&&re.length>1&&re[2]||""}var C=c(/(ipod|iphone|ipad)/i).toLowerCase(),g=/like android/i.test(p),T=!g&&/android/i.test(p),B=/nexus\s*[0-6]\s*/i.test(p),F=!B&&/nexus\s*[0-9]+/i.test(p),J=/CrOS/.test(p),H=/silk/i.test(p),K=/sailfish/i.test(p),Y=/tizen/i.test(p),W=/(web|hpw)(o|0)s/i.test(p),U=/windows phone/i.test(p),_=/SamsungBrowser/i.test(p),te=!U&&/windows/i.test(p),q=!C&&!H&&/macintosh/i.test(p),w=!T&&!K&&!Y&&!W&&/linux/i.test(p),X=m(/edg([ea]|ios)\/(\d+(\.\d+)?)/i),ne=c(/version\/(\d+(\.\d+)?)/i),he=/tablet/i.test(p)&&!/tablet pc/i.test(p),le=!he&&/[^-]mobi/i.test(p),_e=/xbox/i.test(p),se;/opera/i.test(p)?se={name:"Opera",opera:y,version:ne||c(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)}:/opr\/|opios/i.test(p)?se={name:"Opera",opera:y,version:c(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i)||ne}:/SamsungBrowser/i.test(p)?se={name:"Samsung Internet for Android",samsungBrowser:y,version:ne||c(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)}:/Whale/i.test(p)?se={name:"NAVER Whale browser",whale:y,version:c(/(?:whale)[\s\/](\d+(?:\.\d+)+)/i)}:/MZBrowser/i.test(p)?se={name:"MZ Browser",mzbrowser:y,version:c(/(?:MZBrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/coast/i.test(p)?se={name:"Opera Coast",coast:y,version:ne||c(/(?:coast)[\s\/](\d+(\.\d+)?)/i)}:/focus/i.test(p)?se={name:"Focus",focus:y,version:c(/(?:focus)[\s\/](\d+(?:\.\d+)+)/i)}:/yabrowser/i.test(p)?se={name:"Yandex Browser",yandexbrowser:y,version:ne||c(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:/ucbrowser/i.test(p)?se={name:"UC Browser",ucbrowser:y,version:c(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/mxios/i.test(p)?se={name:"Maxthon",maxthon:y,version:c(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)}:/epiphany/i.test(p)?se={name:"Epiphany",epiphany:y,version:c(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)}:/puffin/i.test(p)?se={name:"Puffin",puffin:y,version:c(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)}:/sleipnir/i.test(p)?se={name:"Sleipnir",sleipnir:y,version:c(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)}:/k-meleon/i.test(p)?se={name:"K-Meleon",kMeleon:y,version:c(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)}:U?(se={name:"Windows Phone",osname:"Windows Phone",windowsphone:y},X?(se.msedge=y,se.version=X):(se.msie=y,se.version=c(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(p)?se={name:"Internet Explorer",msie:y,version:c(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:J?se={name:"Chrome",osname:"Chrome OS",chromeos:y,chromeBook:y,chrome:y,version:c(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/edg([ea]|ios)/i.test(p)?se={name:"Microsoft Edge",msedge:y,version:X}:/vivaldi/i.test(p)?se={name:"Vivaldi",vivaldi:y,version:c(/vivaldi\/(\d+(\.\d+)?)/i)||ne}:K?se={name:"Sailfish",osname:"Sailfish OS",sailfish:y,version:c(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(p)?se={name:"SeaMonkey",seamonkey:y,version:c(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel|fxios/i.test(p)?(se={name:"Firefox",firefox:y,version:c(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(p)&&(se.firefoxos=y,se.osname="Firefox OS")):H?se={name:"Amazon Silk",silk:y,version:c(/silk\/(\d+(\.\d+)?)/i)}:/phantom/i.test(p)?se={name:"PhantomJS",phantom:y,version:c(/phantomjs\/(\d+(\.\d+)?)/i)}:/slimerjs/i.test(p)?se={name:"SlimerJS",slimer:y,version:c(/slimerjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(p)||/rim\stablet/i.test(p)?se={name:"BlackBerry",osname:"BlackBerry OS",blackberry:y,version:ne||c(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:W?(se={name:"WebOS",osname:"WebOS",webos:y,version:ne||c(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(p)&&(se.touchpad=y)):/bada/i.test(p)?se={name:"Bada",osname:"Bada",bada:y,version:c(/dolfin\/(\d+(\.\d+)?)/i)}:Y?se={name:"Tizen",osname:"Tizen",tizen:y,version:c(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||ne}:/qupzilla/i.test(p)?se={name:"QupZilla",qupzilla:y,version:c(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i)||ne}:/chromium/i.test(p)?se={name:"Chromium",chromium:y,version:c(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i)||ne}:/chrome|crios|crmo/i.test(p)?se={name:"Chrome",chrome:y,version:c(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:T?se={name:"Android",version:ne}:/safari|applewebkit/i.test(p)?(se={name:"Safari",safari:y},ne&&(se.version=ne)):C?(se={name:C=="iphone"?"iPhone":C=="ipad"?"iPad":"iPod"},ne&&(se.version=ne)):/googlebot/i.test(p)?se={name:"Googlebot",googlebot:y,version:c(/googlebot\/(\d+(\.\d+))/i)||ne}:se={name:c(/^(.*)\/(.*) /),version:m(/^(.*)\/(.*) /)},!se.msedge&&/(apple)?webkit/i.test(p)?(/(apple)?webkit\/537\.36/i.test(p)?(se.name=se.name||"Blink",se.blink=y):(se.name=se.name||"Webkit",se.webkit=y),!se.version&&ne&&(se.version=ne)):!se.opera&&/gecko\//i.test(p)&&(se.name=se.name||"Gecko",se.gecko=y,se.version=se.version||c(/gecko\/(\d+(\.\d+)?)/i)),!se.windowsphone&&(T||se.silk)?(se.android=y,se.osname="Android"):!se.windowsphone&&C?(se[C]=y,se.ios=y,se.osname="iOS"):q?(se.mac=y,se.osname="macOS"):_e?(se.xbox=y,se.osname="Xbox"):te?(se.windows=y,se.osname="Windows"):w&&(se.linux=y,se.osname="Linux");function be(L){switch(L){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 j="";se.windows?j=be(c(/Windows ((NT|XP)( \d\d?.\d)?)/i)):se.windowsphone?j=c(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):se.mac?(j=c(/Mac OS X (\d+([_\.\s]\d+)*)/i),j=j.replace(/[_\s]/g,".")):C?(j=c(/os (\d+([_\s]\d+)*) like mac os x/i),j=j.replace(/[_\s]/g,".")):T?j=c(/android[ \/-](\d+(\.\d+)*)/i):se.webos?j=c(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):se.blackberry?j=c(/rim\stablet\sos\s(\d+(\.\d+)*)/i):se.bada?j=c(/bada\/(\d+(\.\d+)*)/i):se.tizen&&(j=c(/tizen[\/\s](\d+(\.\d+)*)/i)),j&&(se.osversion=j);var Q=!se.windows&&j.split(".")[0];return he||F||C=="ipad"||T&&(Q==3||Q>=4&&!le)||se.silk?se.tablet=y:(le||C=="iphone"||C=="ipod"||T||B||se.blackberry||se.webos||se.bada)&&(se.mobile=y),se.msedge||se.msie&&se.version>=10||se.yandexbrowser&&se.version>=15||se.vivaldi&&se.version>=1||se.chrome&&se.version>=20||se.samsungBrowser&&se.version>=4||se.whale&&x([se.version,"1.0"])===1||se.mzbrowser&&x([se.version,"6.0"])===1||se.focus&&x([se.version,"1.0"])===1||se.firefox&&se.version>=20||se.safari&&se.version>=6||se.opera&&se.version>=10||se.ios&&se.osversion&&se.osversion.split(".")[0]>=6||se.blackberry&&se.version>=10.1||se.chromium&&se.version>=20?se.a=y:se.msie&&se.version<10||se.chrome&&se.version<20||se.firefox&&se.version<20||se.safari&&se.version<6||se.opera&&se.version<10||se.ios&&se.osversion&&se.osversion.split(".")[0]<6||se.chromium&&se.version<20?se.c=y:se.x=y,se}var M=l(typeof navigator!="undefined"&&navigator.userAgent||"");M.test=function(p){for(var c=0;c<p.length;++c){var m=p[c];if(typeof m=="string"&&m in M)return!0}return!1};function D(p){return p.split(".").length}function A(p,c){var m=[],C;if(Array.prototype.map)return Array.prototype.map.call(p,c);for(C=0;C<p.length;C++)m.push(c(p[C]));return m}function x(p){for(var c=Math.max(D(p[0]),D(p[1])),m=A(p,function(C){var g=c-D(C);return C=C+new Array(g+1).join(".0"),A(C.split("."),function(T){return new Array(20-T.length).join("0")+T}).reverse()});--c>=0;){if(m[0][c]>m[1][c])return 1;if(m[0][c]===m[1][c]){if(c===0)return 0}else return-1}}function v(p,c,m){var C=M;typeof c=="string"&&(m=c,c=void 0),c===void 0&&(c=!1),m&&(C=l(m));var g=""+C.version;for(var T in p)if(p.hasOwnProperty(T)&&C[T]){if(typeof p[T]!="string")throw new Error("Browser version in the minVersion map should be a string: "+T+": "+String(p));return x([g,p[T]])<0}return c}function h(p,c,m){return!v(p,c,m)}return M.isUnsupportedBrowser=v,M.compareVersions=x,M.check=h,M._detect=l,M.detect=l,M})},{}],71:[function(d,V,O){},{}],72:[function(d,V,O){var y=d("buffer").Buffer,l=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 M(h){if(h&&!l(h))throw new Error("Unknown encoding: "+h)}var D=O.StringDecoder=function(h){this.encoding=(h||"utf8").toLowerCase().replace(/[-_]/,""),M(h);switch(this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=x;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=v;break;default:this.write=A;return}this.charBuffer=new y(6),this.charReceived=0,this.charLength=0};D.prototype.write=function(h){for(var p="";this.charLength;){var c=h.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:h.length;if(h.copy(this.charBuffer,this.charReceived,0,c),this.charReceived+=c,this.charReceived<this.charLength)return"";h=h.slice(c,h.length),p=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var C=p.charCodeAt(p.length-1);if(C>=55296&&C<=56319){this.charLength+=this.surrogateSize,p="";continue}if(this.charReceived=this.charLength=0,h.length===0)return p;break}this.detectIncompleteChar(h);var m=h.length;this.charLength&&(h.copy(this.charBuffer,0,h.length-this.charReceived,m),m-=this.charReceived),p+=h.toString(this.encoding,0,m);var m=p.length-1,C=p.charCodeAt(m);if(C>=55296&&C<=56319){var g=this.surrogateSize;return this.charLength+=g,this.charReceived+=g,this.charBuffer.copy(this.charBuffer,g,0,g),h.copy(this.charBuffer,0,0,g),p.substring(0,m)}return p},D.prototype.detectIncompleteChar=function(h){for(var p=h.length>=3?3:h.length;p>0;p--){var c=h[h.length-p];if(p==1&&c>>5==6){this.charLength=2;break}if(p<=2&&c>>4==14){this.charLength=3;break}if(p<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=p},D.prototype.end=function(h){var p="";if(h&&h.length&&(p=this.write(h)),this.charReceived){var c=this.charReceived,m=this.charBuffer,C=this.encoding;p+=m.slice(0,c).toString(C)}return p};function A(h){return h.toString(this.encoding)}function x(h){this.charReceived=h.length%2,this.charLength=this.charReceived?2:0}function v(h){this.charReceived=h.length%3,this.charLength=this.charReceived?3:0}},{buffer:73}],73:[function(d,V,O){(function(y,l){/*!
|
|
|
* The buffer module from node.js, for the browser.
|
|
|
*
|
|
|
* @author Feross Aboukhadijeh <http://feross.org>
|
|
|
* @license MIT
|
|
|
*/"use strict";var M=d("base64-js"),D=d("ieee754"),A=d("isarray");O.Buffer=l,O.SlowBuffer=H,O.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=y.TYPED_ARRAY_SUPPORT!==void 0?y.TYPED_ARRAY_SUPPORT:x(),O.kMaxLength=v();function x(){try{var pe=new Uint8Array(1);return pe.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},pe.foo()===42&&typeof pe.subarray=="function"&&pe.subarray(1,1).byteLength===0}catch(Z){return!1}}function v(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function h(pe,Z){if(v()<Z)throw new RangeError("Invalid typed array length");return l.TYPED_ARRAY_SUPPORT?(pe=new Uint8Array(Z),pe.__proto__=l.prototype):(pe===null&&(pe=new l(Z)),pe.length=Z),pe}function l(pe,Z,k){if(!l.TYPED_ARRAY_SUPPORT&&!(this instanceof l))return new l(pe,Z,k);if(typeof pe=="number"){if(typeof Z=="string")throw new Error("If encoding is specified then the first argument must be a string");return C(this,pe)}return p(this,pe,Z,k)}l.poolSize=8192,l._augment=function(pe){return pe.__proto__=l.prototype,pe};function p(pe,Z,k,$){if(typeof Z=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&Z instanceof ArrayBuffer?B(pe,Z,k,$):typeof Z=="string"?g(pe,Z,k):F(pe,Z)}l.from=function(pe,Z,k){return p(null,pe,Z,k)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0}));function c(pe){if(typeof pe!="number")throw new TypeError('"size" argument must be a number');if(pe<0)throw new RangeError('"size" argument must not be negative')}function m(pe,Z,k,$){return c(Z),Z<=0?h(pe,Z):k!==void 0?typeof $=="string"?h(pe,Z).fill(k,$):h(pe,Z).fill(k):h(pe,Z)}l.alloc=function(pe,Z,k){return m(null,pe,Z,k)};function C(pe,Z){if(c(Z),pe=h(pe,Z<0?0:J(Z)|0),!l.TYPED_ARRAY_SUPPORT)for(var k=0;k<Z;++k)pe[k]=0;return pe}l.allocUnsafe=function(pe){return C(null,pe)},l.allocUnsafeSlow=function(pe){return C(null,pe)};function g(pe,Z,k){if((typeof k!="string"||k==="")&&(k="utf8"),!l.isEncoding(k))throw new TypeError('"encoding" must be a valid string encoding');var $=K(Z,k)|0;pe=h(pe,$);var Re=pe.write(Z,k);return Re!==$&&(pe=pe.slice(0,Re)),pe}function T(pe,Z){var k=Z.length<0?0:J(Z.length)|0;pe=h(pe,k);for(var $=0;$<k;$+=1)pe[$]=Z[$]&255;return pe}function B(pe,Z,k,$){if(Z.byteLength,k<0||Z.byteLength<k)throw new RangeError("'offset' is out of bounds");if(Z.byteLength<k+($||0))throw new RangeError("'length' is out of bounds");return k===void 0&&$===void 0?Z=new Uint8Array(Z):$===void 0?Z=new Uint8Array(Z,k):Z=new Uint8Array(Z,k,$),l.TYPED_ARRAY_SUPPORT?(pe=Z,pe.__proto__=l.prototype):pe=T(pe,Z),pe}function F(pe,Z){if(l.isBuffer(Z)){var k=J(Z.length)|0;return pe=h(pe,k),pe.length===0||Z.copy(pe,0,0,k),pe}if(Z){if(typeof ArrayBuffer!="undefined"&&Z.buffer instanceof ArrayBuffer||"length"in Z)return typeof Z.length!="number"||$e(Z.length)?h(pe,0):T(pe,Z);if(Z.type==="Buffer"&&A(Z.data))return T(pe,Z.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function J(pe){if(pe>=v())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+v().toString(16)+" bytes");return pe|0}function H(pe){return+pe!=pe&&(pe=0),l.alloc(+pe)}l.isBuffer=function(Z){return!!(Z!=null&&Z._isBuffer)},l.compare=function(Z,k){if(!l.isBuffer(Z)||!l.isBuffer(k))throw new TypeError("Arguments must be Buffers");if(Z===k)return 0;for(var $=Z.length,Re=k.length,Ae=0,Xe=Math.min($,Re);Ae<Xe;++Ae)if(Z[Ae]!==k[Ae]){$=Z[Ae],Re=k[Ae];break}return $<Re?-1:Re<$?1:0},l.isEncoding=function(Z){switch(String(Z).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}},l.concat=function(Z,k){if(!A(Z))throw new TypeError('"list" argument must be an Array of Buffers');if(Z.length===0)return l.alloc(0);var $;if(k===void 0)for(k=0,$=0;$<Z.length;++$)k+=Z[$].length;var Re=l.allocUnsafe(k),Ae=0;for($=0;$<Z.length;++$){var Xe=Z[$];if(!l.isBuffer(Xe))throw new TypeError('"list" argument must be an Array of Buffers');Xe.copy(Re,Ae),Ae+=Xe.length}return Re};function K(pe,Z){if(l.isBuffer(pe))return pe.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(pe)||pe instanceof ArrayBuffer))return pe.byteLength;typeof pe!="string"&&(pe=""+pe);var k=pe.length;if(k===0)return 0;for(var $=!1;;)switch(Z){case"ascii":case"latin1":case"binary":return k;case"utf8":case"utf-8":case void 0:return ke(pe).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k*2;case"hex":return k>>>1;case"base64":return ve(pe).length;default:if($)return ke(pe).length;Z=(""+Z).toLowerCase(),$=!0}}l.byteLength=K;function Y(pe,Z,k){var $=!1;if((Z===void 0||Z<0)&&(Z=0),Z>this.length)return"";if((k===void 0||k>this.length)&&(k=this.length),k<=0)return"";if(k>>>=0,Z>>>=0,k<=Z)return"";for(pe||(pe="utf8");;)switch(pe){case"hex":return L(this,Z,k);case"utf8":case"utf-8":return _e(this,Z,k);case"ascii":return j(this,Z,k);case"latin1":case"binary":return Q(this,Z,k);case"base64":return le(this,Z,k);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return re(this,Z,k);default:if($)throw new TypeError("Unknown encoding: "+pe);pe=(pe+"").toLowerCase(),$=!0}}l.prototype._isBuffer=!0;function W(pe,Z,k){var $=pe[Z];pe[Z]=pe[k],pe[k]=$}l.prototype.swap16=function(){var Z=this.length;if(Z%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var k=0;k<Z;k+=2)W(this,k,k+1);return this},l.prototype.swap32=function(){var Z=this.length;if(Z%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var k=0;k<Z;k+=4)W(this,k,k+3),W(this,k+1,k+2);return this},l.prototype.swap64=function(){var Z=this.length;if(Z%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var k=0;k<Z;k+=8)W(this,k,k+7),W(this,k+1,k+6),W(this,k+2,k+5),W(this,k+3,k+4);return this},l.prototype.toString=function(){var Z=this.length|0;return Z===0?"":arguments.length===0?_e(this,0,Z):Y.apply(this,arguments)},l.prototype.equals=function(Z){if(!l.isBuffer(Z))throw new TypeError("Argument must be a Buffer");return this===Z?!0:l.compare(this,Z)===0},l.prototype.inspect=function(){var Z="",k=O.INSPECT_MAX_BYTES;return this.length>0&&(Z=this.toString("hex",0,k).match(/.{2}/g).join(" "),this.length>k&&(Z+=" ... ")),"<Buffer "+Z+">"},l.prototype.compare=function(Z,k,$,Re,Ae){if(!l.isBuffer(Z))throw new TypeError("Argument must be a Buffer");if(k===void 0&&(k=0),$===void 0&&($=Z?Z.length:0),Re===void 0&&(Re=0),Ae===void 0&&(Ae=this.length),k<0||$>Z.length||Re<0||Ae>this.length)throw new RangeError("out of range index");if(Re>=Ae&&k>=$)return 0;if(Re>=Ae)return-1;if(k>=$)return 1;if(k>>>=0,$>>>=0,Re>>>=0,Ae>>>=0,this===Z)return 0;for(var Xe=Ae-Re,rt=$-k,lt=Math.min(Xe,rt),bt=this.slice(Re,Ae),Tt=Z.slice(k,$),xt=0;xt<lt;++xt)if(bt[xt]!==Tt[xt]){Xe=bt[xt],rt=Tt[xt];break}return Xe<rt?-1:rt<Xe?1:0};function U(pe,Z,k,$,Re){if(pe.length===0)return-1;if(typeof k=="string"?($=k,k=0):k>2147483647?k=2147483647:k<-2147483648&&(k=-2147483648),k=+k,isNaN(k)&&(k=Re?0:pe.length-1),k<0&&(k=pe.length+k),k>=pe.length){if(Re)return-1;k=pe.length-1}else if(k<0)if(Re)k=0;else return-1;if(typeof Z=="string"&&(Z=l.from(Z,$)),l.isBuffer(Z))return Z.length===0?-1:_(pe,Z,k,$,Re);if(typeof Z=="number")return Z=Z&255,l.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?Re?Uint8Array.prototype.indexOf.call(pe,Z,k):Uint8Array.prototype.lastIndexOf.call(pe,Z,k):_(pe,[Z],k,$,Re);throw new TypeError("val must be string, number or Buffer")}function _(pe,Z,k,$,Re){var Ae=1,Xe=pe.length,rt=Z.length;if($!==void 0&&($=String($).toLowerCase(),$==="ucs2"||$==="ucs-2"||$==="utf16le"||$==="utf-16le")){if(pe.length<2||Z.length<2)return-1;Ae=2,Xe/=2,rt/=2,k/=2}function lt(Nt,at){return Ae===1?Nt[at]:Nt.readUInt16BE(at*Ae)}var bt;if(Re){var Tt=-1;for(bt=k;bt<Xe;bt++)if(lt(pe,bt)===lt(Z,Tt===-1?0:bt-Tt)){if(Tt===-1&&(Tt=bt),bt-Tt+1===rt)return Tt*Ae}else Tt!==-1&&(bt-=bt-Tt),Tt=-1}else for(k+rt>Xe&&(k=Xe-rt),bt=k;bt>=0;bt--){for(var xt=!0,Et=0;Et<rt;Et++)if(lt(pe,bt+Et)!==lt(Z,Et)){xt=!1;break}if(xt)return bt}return-1}l.prototype.includes=function(Z,k,$){return this.indexOf(Z,k,$)!==-1},l.prototype.indexOf=function(Z,k,$){return U(this,Z,k,$,!0)},l.prototype.lastIndexOf=function(Z,k,$){return U(this,Z,k,$,!1)};function te(pe,Z,k,$){k=Number(k)||0;var Re=pe.length-k;$?($=Number($),$>Re&&($=Re)):$=Re;var Ae=Z.length;if(Ae%2!==0)throw new TypeError("Invalid hex string");$>Ae/2&&($=Ae/2);for(var Xe=0;Xe<$;++Xe){var rt=parseInt(Z.substr(Xe*2,2),16);if(isNaN(rt))return Xe;pe[k+Xe]=rt}return Xe}function q(pe,Z,k,$){return ge(ke(Z,pe.length-k),pe,k,$)}function w(pe,Z,k,$){return ge(Be(Z),pe,k,$)}function X(pe,Z,k,$){return w(pe,Z,k,$)}function ne(pe,Z,k,$){return ge(ve(Z),pe,k,$)}function he(pe,Z,k,$){return ge(ot(Z,pe.length-k),pe,k,$)}l.prototype.write=function(Z,k,$,Re){if(k===void 0)Re="utf8",$=this.length,k=0;else if($===void 0&&typeof k=="string")Re=k,$=this.length,k=0;else if(isFinite(k))k=k|0,isFinite($)?($=$|0,Re===void 0&&(Re="utf8")):(Re=$,$=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var Ae=this.length-k;if(($===void 0||$>Ae)&&($=Ae),Z.length>0&&($<0||k<0)||k>this.length)throw new RangeError("Attempt to write outside buffer bounds");Re||(Re="utf8");for(var Xe=!1;;)switch(Re){case"hex":return te(this,Z,k,$);case"utf8":case"utf-8":return q(this,Z,k,$);case"ascii":return w(this,Z,k,$);case"latin1":case"binary":return X(this,Z,k,$);case"base64":return ne(this,Z,k,$);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return he(this,Z,k,$);default:if(Xe)throw new TypeError("Unknown encoding: "+Re);Re=(""+Re).toLowerCase(),Xe=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function le(pe,Z,k){return Z===0&&k===pe.length?M.fromByteArray(pe):M.fromByteArray(pe.slice(Z,k))}function _e(pe,Z,k){k=Math.min(pe.length,k);for(var $=[],Re=Z;Re<k;){var Ae=pe[Re],Xe=null,rt=Ae>239?4:Ae>223?3:Ae>191?2:1;if(Re+rt<=k){var lt,bt,Tt,xt;switch(rt){case 1:Ae<128&&(Xe=Ae);break;case 2:lt=pe[Re+1],(lt&192)===128&&(xt=(Ae&31)<<6|lt&63,xt>127&&(Xe=xt));break;case 3:lt=pe[Re+1],bt=pe[Re+2],(lt&192)===128&&(bt&192)===128&&(xt=(Ae&15)<<12|(lt&63)<<6|bt&63,xt>2047&&(xt<55296||xt>57343)&&(Xe=xt));break;case 4:lt=pe[Re+1],bt=pe[Re+2],Tt=pe[Re+3],(lt&192)===128&&(bt&192)===128&&(Tt&192)===128&&(xt=(Ae&15)<<18|(lt&63)<<12|(bt&63)<<6|Tt&63,xt>65535&&xt<1114112&&(Xe=xt))}}Xe===null?(Xe=65533,rt=1):Xe>65535&&(Xe-=65536,$.push(Xe>>>10&1023|55296),Xe=56320|Xe&1023),$.push(Xe),Re+=rt}return be($)}var se=4096;function be(pe){var Z=pe.length;if(Z<=se)return String.fromCharCode.apply(String,pe);for(var k="",$=0;$<Z;)k+=String.fromCharCode.apply(String,pe.slice($,$+=se));return k}function j(pe,Z,k){var $="";k=Math.min(pe.length,k);for(var Re=Z;Re<k;++Re)$+=String.fromCharCode(pe[Re]&127);return $}function Q(pe,Z,k){var $="";k=Math.min(pe.length,k);for(var Re=Z;Re<k;++Re)$+=String.fromCharCode(pe[Re]);return $}function L(pe,Z,k){var $=pe.length;(!Z||Z<0)&&(Z=0),(!k||k<0||k>$)&&(k=$);for(var Re="",Ae=Z;Ae<k;++Ae)Re+=Pe(pe[Ae]);return Re}function re(pe,Z,k){for(var $=pe.slice(Z,k),Re="",Ae=0;Ae<$.length;Ae+=2)Re+=String.fromCharCode($[Ae]+$[Ae+1]*256);return Re}l.prototype.slice=function(Z,k){var $=this.length;Z=~~Z,k=k===void 0?$:~~k,Z<0?(Z+=$,Z<0&&(Z=0)):Z>$&&(Z=$),k<0?(k+=$,k<0&&(k=0)):k>$&&(k=$),k<Z&&(k=Z);var Re;if(l.TYPED_ARRAY_SUPPORT)Re=this.subarray(Z,k),Re.__proto__=l.prototype;else{var Ae=k-Z;Re=new l(Ae,void 0);for(var Xe=0;Xe<Ae;++Xe)Re[Xe]=this[Xe+Z]}return Re};function de(pe,Z,k){if(pe%1!==0||pe<0)throw new RangeError("offset is not uint");if(pe+Z>k)throw new RangeError("Trying to access beyond buffer length")}l.prototype.readUIntLE=function(Z,k,$){Z=Z|0,k=k|0,$||de(Z,k,this.length);for(var Re=this[Z],Ae=1,Xe=0;++Xe<k&&(Ae*=256);)Re+=this[Z+Xe]*Ae;return Re},l.prototype.readUIntBE=function(Z,k,$){Z=Z|0,k=k|0,$||de(Z,k,this.length);for(var Re=this[Z+--k],Ae=1;k>0&&(Ae*=256);)Re+=this[Z+--k]*Ae;return Re},l.prototype.readUInt8=function(Z,k){return k||de(Z,1,this.length),this[Z]},l.prototype.readUInt16LE=function(Z,k){return k||de(Z,2,this.length),this[Z]|this[Z+1]<<8},l.prototype.readUInt16BE=function(Z,k){return k||de(Z,2,this.length),this[Z]<<8|this[Z+1]},l.prototype.readUInt32LE=function(Z,k){return k||de(Z,4,this.length),(this[Z]|this[Z+1]<<8|this[Z+2]<<16)+this[Z+3]*16777216},l.prototype.readUInt32BE=function(Z,k){return k||de(Z,4,this.length),this[Z]*16777216+(this[Z+1]<<16|this[Z+2]<<8|this[Z+3])},l.prototype.readIntLE=function(Z,k,$){Z=Z|0,k=k|0,$||de(Z,k,this.length);for(var Re=this[Z],Ae=1,Xe=0;++Xe<k&&(Ae*=256);)Re+=this[Z+Xe]*Ae;return Ae*=128,Re>=Ae&&(Re-=Math.pow(2,8*k)),Re},l.prototype.readIntBE=function(Z,k,$){Z=Z|0,k=k|0,$||de(Z,k,this.length);for(var Re=k,Ae=1,Xe=this[Z+--Re];Re>0&&(Ae*=256);)Xe+=this[Z+--Re]*Ae;return Ae*=128,Xe>=Ae&&(Xe-=Math.pow(2,8*k)),Xe},l.prototype.readInt8=function(Z,k){return k||de(Z,1,this.length),this[Z]&128?(255-this[Z]+1)*-1:this[Z]},l.prototype.readInt16LE=function(Z,k){k||de(Z,2,this.length);var $=this[Z]|this[Z+1]<<8;return $&32768?$|4294901760:$},l.prototype.readInt16BE=function(Z,k){k||de(Z,2,this.length);var $=this[Z+1]|this[Z]<<8;return $&32768?$|4294901760:$},l.prototype.readInt32LE=function(Z,k){return k||de(Z,4,this.length),this[Z]|this[Z+1]<<8|this[Z+2]<<16|this[Z+3]<<24},l.prototype.readInt32BE=function(Z,k){return k||de(Z,4,this.length),this[Z]<<24|this[Z+1]<<16|this[Z+2]<<8|this[Z+3]},l.prototype.readFloatLE=function(Z,k){return k||de(Z,4,this.length),D.read(this,Z,!0,23,4)},l.prototype.readFloatBE=function(Z,k){return k||de(Z,4,this.length),D.read(this,Z,!1,23,4)},l.prototype.readDoubleLE=function(Z,k){return k||de(Z,8,this.length),D.read(this,Z,!0,52,8)},l.prototype.readDoubleBE=function(Z,k){return k||de(Z,8,this.length),D.read(this,Z,!1,52,8)};function ee(pe,Z,k,$,Re,Ae){if(!l.isBuffer(pe))throw new TypeError('"buffer" argument must be a Buffer instance');if(Z>Re||Z<Ae)throw new RangeError('"value" argument is out of bounds');if(k+$>pe.length)throw new RangeError("Index out of range")}l.prototype.writeUIntLE=function(Z,k,$,Re){if(Z=+Z,k=k|0,$=$|0,!Re){var Ae=Math.pow(2,8*$)-1;ee(this,Z,k,$,Ae,0)}var Xe=1,rt=0;for(this[k]=Z&255;++rt<$&&(Xe*=256);)this[k+rt]=Z/Xe&255;return k+$},l.prototype.writeUIntBE=function(Z,k,$,Re){if(Z=+Z,k=k|0,$=$|0,!Re){var Ae=Math.pow(2,8*$)-1;ee(this,Z,k,$,Ae,0)}var Xe=$-1,rt=1;for(this[k+Xe]=Z&255;--Xe>=0&&(rt*=256);)this[k+Xe]=Z/rt&255;return k+$},l.prototype.writeUInt8=function(Z,k,$){return Z=+Z,k=k|0,$||ee(this,Z,k,1,255,0),l.TYPED_ARRAY_SUPPORT||(Z=Math.floor(Z)),this[k]=Z&255,k+1};function xe(pe,Z,k,$){Z<0&&(Z=65535+Z+1);for(var Re=0,Ae=Math.min(pe.length-k,2);Re<Ae;++Re)pe[k+Re]=(Z&255<<8*($?Re:1-Re))>>>($?Re:1-Re)*8}l.prototype.writeUInt16LE=function(Z,k,$){return Z=+Z,k=k|0,$||ee(this,Z,k,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[k]=Z&255,this[k+1]=Z>>>8):xe(this,Z,k,!0),k+2},l.prototype.writeUInt16BE=function(Z,k,$){return Z=+Z,k=k|0,$||ee(this,Z,k,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[k]=Z>>>8,this[k+1]=Z&255):xe(this,Z,k,!1),k+2};function Ne(pe,Z,k,$){Z<0&&(Z=4294967295+Z+1);for(var Re=0,Ae=Math.min(pe.length-k,4);Re<Ae;++Re)pe[k+Re]=Z>>>($?Re:3-Re)*8&255}l.prototype.writeUInt32LE=function(Z,k,$){return Z=+Z,k=k|0,$||ee(this,Z,k,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[k+3]=Z>>>24,this[k+2]=Z>>>16,this[k+1]=Z>>>8,this[k]=Z&255):Ne(this,Z,k,!0),k+4},l.prototype.writeUInt32BE=function(Z,k,$){return Z=+Z,k=k|0,$||ee(this,Z,k,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[k]=Z>>>24,this[k+1]=Z>>>16,this[k+2]=Z>>>8,this[k+3]=Z&255):Ne(this,Z,k,!1),k+4},l.prototype.writeIntLE=function(Z,k,$,Re){if(Z=+Z,k=k|0,!Re){var Ae=Math.pow(2,8*$-1);ee(this,Z,k,$,Ae-1,-Ae)}var Xe=0,rt=1,lt=0;for(this[k]=Z&255;++Xe<$&&(rt*=256);)Z<0&<===0&&this[k+Xe-1]!==0&&(lt=1),this[k+Xe]=(Z/rt>>0)-lt&255;return k+$},l.prototype.writeIntBE=function(Z,k,$,Re){if(Z=+Z,k=k|0,!Re){var Ae=Math.pow(2,8*$-1);ee(this,Z,k,$,Ae-1,-Ae)}var Xe=$-1,rt=1,lt=0;for(this[k+Xe]=Z&255;--Xe>=0&&(rt*=256);)Z<0&<===0&&this[k+Xe+1]!==0&&(lt=1),this[k+Xe]=(Z/rt>>0)-lt&255;return k+$},l.prototype.writeInt8=function(Z,k,$){return Z=+Z,k=k|0,$||ee(this,Z,k,1,127,-128),l.TYPED_ARRAY_SUPPORT||(Z=Math.floor(Z)),Z<0&&(Z=255+Z+1),this[k]=Z&255,k+1},l.prototype.writeInt16LE=function(Z,k,$){return Z=+Z,k=k|0,$||ee(this,Z,k,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[k]=Z&255,this[k+1]=Z>>>8):xe(this,Z,k,!0),k+2},l.prototype.writeInt16BE=function(Z,k,$){return Z=+Z,k=k|0,$||ee(this,Z,k,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[k]=Z>>>8,this[k+1]=Z&255):xe(this,Z,k,!1),k+2},l.prototype.writeInt32LE=function(Z,k,$){return Z=+Z,k=k|0,$||ee(this,Z,k,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[k]=Z&255,this[k+1]=Z>>>8,this[k+2]=Z>>>16,this[k+3]=Z>>>24):Ne(this,Z,k,!0),k+4},l.prototype.writeInt32BE=function(Z,k,$){return Z=+Z,k=k|0,$||ee(this,Z,k,4,2147483647,-2147483648),Z<0&&(Z=4294967295+Z+1),l.TYPED_ARRAY_SUPPORT?(this[k]=Z>>>24,this[k+1]=Z>>>16,this[k+2]=Z>>>8,this[k+3]=Z&255):Ne(this,Z,k,!1),k+4};function Le(pe,Z,k,$,Re,Ae){if(k+$>pe.length)throw new RangeError("Index out of range");if(k<0)throw new RangeError("Index out of range")}function Ge(pe,Z,k,$,Re){return Re||Le(pe,Z,k,4,34028234663852886e22,-34028234663852886e22),D.write(pe,Z,k,$,23,4),k+4}l.prototype.writeFloatLE=function(Z,k,$){return Ge(this,Z,k,!0,$)},l.prototype.writeFloatBE=function(Z,k,$){return Ge(this,Z,k,!1,$)};function Qe(pe,Z,k,$,Re){return Re||Le(pe,Z,k,8,17976931348623157e292,-17976931348623157e292),D.write(pe,Z,k,$,52,8),k+8}l.prototype.writeDoubleLE=function(Z,k,$){return Qe(this,Z,k,!0,$)},l.prototype.writeDoubleBE=function(Z,k,$){return Qe(this,Z,k,!1,$)},l.prototype.copy=function(Z,k,$,Re){if($||($=0),!Re&&Re!==0&&(Re=this.length),k>=Z.length&&(k=Z.length),k||(k=0),Re>0&&Re<$&&(Re=$),Re===$)return 0;if(Z.length===0||this.length===0)return 0;if(k<0)throw new RangeError("targetStart out of bounds");if($<0||$>=this.length)throw new RangeError("sourceStart out of bounds");if(Re<0)throw new RangeError("sourceEnd out of bounds");Re>this.length&&(Re=this.length),Z.length-k<Re-$&&(Re=Z.length-k+$);var Ae=Re-$,Xe;if(this===Z&&$<k&&k<Re)for(Xe=Ae-1;Xe>=0;--Xe)Z[Xe+k]=this[Xe+$];else if(Ae<1e3||!l.TYPED_ARRAY_SUPPORT)for(Xe=0;Xe<Ae;++Xe)Z[Xe+k]=this[Xe+$];else Uint8Array.prototype.set.call(Z,this.subarray($,$+Ae),k);return Ae},l.prototype.fill=function(Z,k,$,Re){if(typeof Z=="string"){if(typeof k=="string"?(Re=k,k=0,$=this.length):typeof $=="string"&&(Re=$,$=this.length),Z.length===1){var Ae=Z.charCodeAt(0);Ae<256&&(Z=Ae)}if(Re!==void 0&&typeof Re!="string")throw new TypeError("encoding must be a string");if(typeof Re=="string"&&!l.isEncoding(Re))throw new TypeError("Unknown encoding: "+Re)}else typeof Z=="number"&&(Z=Z&255);if(k<0||this.length<k||this.length<$)throw new RangeError("Out of range index");if($<=k)return this;k=k>>>0,$=$===void 0?this.length:$>>>0,Z||(Z=0);var Xe;if(typeof Z=="number")for(Xe=k;Xe<$;++Xe)this[Xe]=Z;else{var rt=l.isBuffer(Z)?Z:ke(new l(Z,Re).toString()),lt=rt.length;for(Xe=0;Xe<$-k;++Xe)this[Xe+k]=rt[Xe%lt]}return this};var Te=/[^+\/0-9A-Za-z-_]/g;function nt(pe){if(pe=Ye(pe).replace(Te,""),pe.length<2)return"";for(;pe.length%4!==0;)pe=pe+"=";return pe}function Ye(pe){return pe.trim?pe.trim():pe.replace(/^\s+|\s+$/g,"")}function Pe(pe){return pe<16?"0"+pe.toString(16):pe.toString(16)}function ke(pe,Z){Z=Z||Infinity;for(var k,$=pe.length,Re=null,Ae=[],Xe=0;Xe<$;++Xe){if(k=pe.charCodeAt(Xe),k>55295&&k<57344){if(!Re){if(k>56319){(Z-=3)>-1&&Ae.push(239,191,189);continue}else if(Xe+1===$){(Z-=3)>-1&&Ae.push(239,191,189);continue}Re=k;continue}if(k<56320){(Z-=3)>-1&&Ae.push(239,191,189),Re=k;continue}k=(Re-55296<<10|k-56320)+65536}else Re&&((Z-=3)>-1&&Ae.push(239,191,189));if(Re=null,k<128){if((Z-=1)<0)break;Ae.push(k)}else if(k<2048){if((Z-=2)<0)break;Ae.push(k>>6|192,k&63|128)}else if(k<65536){if((Z-=3)<0)break;Ae.push(k>>12|224,k>>6&63|128,k&63|128)}else if(k<1114112){if((Z-=4)<0)break;Ae.push(k>>18|240,k>>12&63|128,k>>6&63|128,k&63|128)}else throw new Error("Invalid code point")}return Ae}function Be(pe){for(var Z=[],k=0;k<pe.length;++k)Z.push(pe.charCodeAt(k)&255);return Z}function ot(pe,Z){for(var k,$,Re,Ae=[],Xe=0;Xe<pe.length&&!((Z-=2)<0);++Xe)k=pe.charCodeAt(Xe),$=k>>8,Re=k%256,Ae.push(Re),Ae.push($);return Ae}function ve(pe){return M.toByteArray(nt(pe))}function ge(pe,Z,k,$){for(var Re=0;Re<$&&!(Re+k>=Z.length||Re>=pe.length);++Re)Z[Re+k]=pe[Re];return Re}function $e(pe){return pe!==pe}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{},d("buffer").Buffer)},{"base64-js":69,buffer:73,ieee754:195,isarray:198}],74:[function(d,V,O){V.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(d,V,O){V.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(d,V,O){/*!
|
|
|
* copy-to - index.js
|
|
|
* Copyright(c) 2014 dead_horse <dead_horse@qq.com>
|
|
|
* MIT Licensed
|
|
|
*/"use strict";var y=Array.prototype.slice;V.exports=l;function l(D,A){if(!(this instanceof l))return new l(D,A);this.src=D,this._withAccess=A}l.prototype.withAccess=function(D){return this._withAccess=D!==!1,this},l.prototype.pick=function(D){return Array.isArray(D)||(D=y.call(arguments)),D.length&&(this.keys=D),this},l.prototype.to=function(D){if(D=D||{},!this.src)return D;var A=this.keys||Object.keys(this.src);if(!this._withAccess){for(var x=0;x<A.length;x++){if(v=A[x],D[v]!==void 0)continue;D[v]=this.src[v]}return D}for(var x=0;x<A.length;x++){var v=A[x];if(!M(D,v))continue;var h=this.src.__lookupGetter__(v),p=this.src.__lookupSetter__(v);h&&D.__defineGetter__(v,h),p&&D.__defineSetter__(v,p),!h&&!p&&(D[v]=this.src[v])}return D},l.prototype.toCover=function(D){for(var A=this.keys||Object.keys(this.src),x=0;x<A.length;x++){var v=A[x];delete D[v];var h=this.src.__lookupGetter__(v),p=this.src.__lookupSetter__(v);h&&D.__defineGetter__(v,h),p&&D.__defineSetter__(v,p),!h&&!p&&(D[v]=this.src[v])}},l.prototype.override=l.prototype.toCover,l.prototype.and=function(D){var A={};return this.to(A),this.src=D,this.to(A),this.src=A,this};function M(D,A){return D[A]===void 0&&D.__lookupGetter__(A)===void 0&&D.__lookupSetter__(A)===void 0}},{}],77:[function(d,V,O){d("../../modules/es6.string.iterator"),d("../../modules/es6.array.from"),V.exports=d("../../modules/_core").Array.from},{"../../modules/_core":99,"../../modules/es6.array.from":168,"../../modules/es6.string.iterator":180}],78:[function(d,V,O){var y=d("../../modules/_core"),l=y.JSON||(y.JSON={stringify:JSON.stringify});V.exports=function(D){return l.stringify.apply(l,arguments)}},{"../../modules/_core":99}],79:[function(d,V,O){d("../../modules/es6.object.assign"),V.exports=d("../../modules/_core").Object.assign},{"../../modules/_core":99,"../../modules/es6.object.assign":171}],80:[function(d,V,O){d("../../modules/es6.object.create");var y=d("../../modules/_core").Object;V.exports=function(M,D){return y.create(M,D)}},{"../../modules/_core":99,"../../modules/es6.object.create":172}],81:[function(d,V,O){d("../../modules/es6.object.define-property");var y=d("../../modules/_core").Object;V.exports=function(M,D,A){return y.defineProperty(M,D,A)}},{"../../modules/_core":99,"../../modules/es6.object.define-property":173}],82:[function(d,V,O){d("../../modules/es7.object.entries"),V.exports=d("../../modules/_core").Object.entries},{"../../modules/_core":99,"../../modules/es7.object.entries":182}],83:[function(d,V,O){d("../../modules/es6.object.get-own-property-names");var y=d("../../modules/_core").Object;V.exports=function(M){return y.getOwnPropertyNames(M)}},{"../../modules/_core":99,"../../modules/es6.object.get-own-property-names":174}],84:[function(d,V,O){d("../../modules/es6.object.get-prototype-of"),V.exports=d("../../modules/_core").Object.getPrototypeOf},{"../../modules/_core":99,"../../modules/es6.object.get-prototype-of":175}],85:[function(d,V,O){d("../../modules/es6.object.keys"),V.exports=d("../../modules/_core").Object.keys},{"../../modules/_core":99,"../../modules/es6.object.keys":176}],86:[function(d,V,O){d("../modules/es6.object.to-string"),d("../modules/es6.string.iterator"),d("../modules/web.dom.iterable"),d("../modules/es6.promise"),d("../modules/es7.promise.finally"),d("../modules/es7.promise.try"),V.exports=d("../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(d,V,O){d("../modules/web.immediate"),V.exports=d("../modules/_core").setImmediate},{"../modules/_core":99,"../modules/web.immediate":188}],88:[function(d,V,O){d("../../modules/es6.string.from-code-point"),V.exports=d("../../modules/_core").String.fromCodePoint},{"../../modules/_core":99,"../../modules/es6.string.from-code-point":179}],89:[function(d,V,O){d("../../modules/es6.function.has-instance"),V.exports=d("../../modules/_wks-ext").f("hasInstance")},{"../../modules/_wks-ext":165,"../../modules/es6.function.has-instance":170}],90:[function(d,V,O){d("../../modules/es6.symbol"),d("../../modules/es6.object.to-string"),d("../../modules/es7.symbol.async-iterator"),d("../../modules/es7.symbol.observable"),V.exports=d("../../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(d,V,O){d("../../modules/es6.string.iterator"),d("../../modules/web.dom.iterable"),V.exports=d("../../modules/_wks-ext").f("iterator")},{"../../modules/_wks-ext":165,"../../modules/es6.string.iterator":180,"../../modules/web.dom.iterable":187}],92:[function(d,V,O){V.exports=function(y){if(typeof y!="function")throw TypeError(y+" is not a function!");return y}},{}],93:[function(d,V,O){V.exports=function(){}},{}],94:[function(d,V,O){V.exports=function(y,l,M,D){if(!(y instanceof l)||D!==void 0&&D in y)throw TypeError(M+": incorrect invocation!");return y}},{}],95:[function(d,V,O){var y=d("./_is-object");V.exports=function(l){if(!y(l))throw TypeError(l+" is not an object!");return l}},{"./_is-object":119}],96:[function(d,V,O){var y=d("./_to-iobject"),l=d("./_to-length"),M=d("./_to-absolute-index");V.exports=function(D){return function(A,x,v){var h=y(A),p=l(h.length),c=M(v,p),m;if(D&&x!=x){for(;p>c;)if(m=h[c++],m!=m)return!0}else for(;p>c;c++)if((D||c in h)&&h[c]===x)return D||c||0;return!D&&-1}}},{"./_to-absolute-index":156,"./_to-iobject":158,"./_to-length":159}],97:[function(d,V,O){var y=d("./_cof"),l=d("./_wks")("toStringTag"),M=y(function(){return arguments}())=="Arguments",D=function(A,x){try{return A[x]}catch(v){}};V.exports=function(A){var x,v,h;return A===void 0?"Undefined":A===null?"Null":typeof(v=D(x=Object(A),l))=="string"?v:M?y(x):(h=y(x))=="Object"&&typeof x.callee=="function"?"Arguments":h}},{"./_cof":98,"./_wks":166}],98:[function(d,V,O){var y={}.toString;V.exports=function(l){return y.call(l).slice(8,-1)}},{}],99:[function(d,V,O){var y=V.exports={version:"2.6.11"};typeof __e=="number"&&(__e=y)},{}],100:[function(d,V,O){"use strict";var y=d("./_object-dp"),l=d("./_property-desc");V.exports=function(M,D,A){D in M?y.f(M,D,l(0,A)):M[D]=A}},{"./_object-dp":132,"./_property-desc":146}],101:[function(d,V,O){var y=d("./_a-function");V.exports=function(l,M,D){if(y(l),M===void 0)return l;switch(D){case 1:return function(A){return l.call(M,A)};case 2:return function(A,x){return l.call(M,A,x)};case 3:return function(A,x,v){return l.call(M,A,x,v)}}return function(){return l.apply(M,arguments)}}},{"./_a-function":92}],102:[function(d,V,O){V.exports=function(y){if(y==null)throw TypeError("Can't call method on "+y);return y}},{}],103:[function(d,V,O){V.exports=!d("./_fails")(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},{"./_fails":108}],104:[function(d,V,O){var y=d("./_is-object"),l=d("./_global").document,M=y(l)&&y(l.createElement);V.exports=function(D){return M?l.createElement(D):{}}},{"./_global":110,"./_is-object":119}],105:[function(d,V,O){V.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},{}],106:[function(d,V,O){var y=d("./_object-keys"),l=d("./_object-gops"),M=d("./_object-pie");V.exports=function(D){var A=y(D),x=l.f;if(x)for(var v=x(D),h=M.f,p=0,c;v.length>p;)h.call(D,c=v[p++])&&A.push(c);return A}},{"./_object-gops":137,"./_object-keys":140,"./_object-pie":141}],107:[function(d,V,O){var y=d("./_global"),l=d("./_core"),M=d("./_ctx"),D=d("./_hide"),A=d("./_has"),x="prototype",v=function(h,p,c){var m=h&v.F,C=h&v.G,g=h&v.S,T=h&v.P,B=h&v.B,F=h&v.W,J=C?l:l[p]||(l[p]={}),H=J[x],K=C?y:g?y[p]:(y[p]||{})[x],Y,W,U;C&&(c=p);for(Y in c){if(W=!m&&K&&K[Y]!==void 0,W&&A(J,Y))continue;U=W?K[Y]:c[Y],J[Y]=C&&typeof K[Y]!="function"?c[Y]:B&&W?M(U,y):F&&K[Y]==U?function(_){var te=function(q,w,X){if(this instanceof _){switch(arguments.length){case 0:return new _;case 1:return new _(q);case 2:return new _(q,w)}return new _(q,w,X)}return _.apply(this,arguments)};return te[x]=_[x],te}(U):T&&typeof U=="function"?M(Function.call,U):U,T&&((J.virtual||(J.virtual={}))[Y]=U,h&v.R&&H&&!H[Y]&&D(H,Y,U))}};v.F=1,v.G=2,v.S=4,v.P=8,v.B=16,v.W=32,v.U=64,v.R=128,V.exports=v},{"./_core":99,"./_ctx":101,"./_global":110,"./_has":111,"./_hide":112}],108:[function(d,V,O){V.exports=function(y){try{return!!y()}catch(l){return!0}}},{}],109:[function(d,V,O){var y=d("./_ctx"),l=d("./_iter-call"),M=d("./_is-array-iter"),D=d("./_an-object"),A=d("./_to-length"),x=d("./core.get-iterator-method"),v={},h={},O=V.exports=function(p,c,m,C,g){var T=g?function(){return p}:x(p),B=y(m,C,c?2:1),F=0,J,H,K,Y;if(typeof T!="function")throw TypeError(p+" is not iterable!");if(M(T)){for(J=A(p.length);J>F;F++)if(Y=c?B(D(H=p[F])[0],H[1]):B(p[F]),Y===v||Y===h)return Y}else for(K=T.call(p);!(H=K.next()).done;)if(Y=l(K,B,H.value,c),Y===v||Y===h)return Y};O.BREAK=v,O.RETURN=h},{"./_an-object":95,"./_ctx":101,"./_is-array-iter":117,"./_iter-call":120,"./_to-length":159,"./core.get-iterator-method":167}],110:[function(d,V,O){var y=V.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(d,V,O){var y={}.hasOwnProperty;V.exports=function(l,M){return y.call(l,M)}},{}],112:[function(d,V,O){var y=d("./_object-dp"),l=d("./_property-desc");V.exports=d("./_descriptors")?function(M,D,A){return y.f(M,D,l(1,A))}:function(M,D,A){return M[D]=A,M}},{"./_descriptors":103,"./_object-dp":132,"./_property-desc":146}],113:[function(d,V,O){var y=d("./_global").document;V.exports=y&&y.documentElement},{"./_global":110}],114:[function(d,V,O){V.exports=!d("./_descriptors")&&!d("./_fails")(function(){return Object.defineProperty(d("./_dom-create")("div"),"a",{get:function(){return 7}}).a!=7})},{"./_descriptors":103,"./_dom-create":104,"./_fails":108}],115:[function(d,V,O){V.exports=function(y,l,M){var D=M===void 0;switch(l.length){case 0:return D?y():y.call(M);case 1:return D?y(l[0]):y.call(M,l[0]);case 2:return D?y(l[0],l[1]):y.call(M,l[0],l[1]);case 3:return D?y(l[0],l[1],l[2]):y.call(M,l[0],l[1],l[2]);case 4:return D?y(l[0],l[1],l[2],l[3]):y.call(M,l[0],l[1],l[2],l[3])}return y.apply(M,l)}},{}],116:[function(d,V,O){var y=d("./_cof");V.exports=Object("z").propertyIsEnumerable(0)?Object:function(l){return y(l)=="String"?l.split(""):Object(l)}},{"./_cof":98}],117:[function(d,V,O){var y=d("./_iterators"),l=d("./_wks")("iterator"),M=Array.prototype;V.exports=function(D){return D!==void 0&&(y.Array===D||M[l]===D)}},{"./_iterators":125,"./_wks":166}],118:[function(d,V,O){var y=d("./_cof");V.exports=Array.isArray||function(M){return y(M)=="Array"}},{"./_cof":98}],119:[function(d,V,O){V.exports=function(y){return typeof y=="object"?y!==null:typeof y=="function"}},{}],120:[function(d,V,O){var y=d("./_an-object");V.exports=function(l,M,D,A){try{return A?M(y(D)[0],D[1]):M(D)}catch(v){var x=l.return;throw x!==void 0&&y(x.call(l)),v}}},{"./_an-object":95}],121:[function(d,V,O){"use strict";var y=d("./_object-create"),l=d("./_property-desc"),M=d("./_set-to-string-tag"),D={};d("./_hide")(D,d("./_wks")("iterator"),function(){return this}),V.exports=function(A,x,v){A.prototype=y(D,{next:l(1,v)}),M(A,x+" Iterator")}},{"./_hide":112,"./_object-create":131,"./_property-desc":146,"./_set-to-string-tag":150,"./_wks":166}],122:[function(d,V,O){"use strict";var y=d("./_library"),l=d("./_export"),M=d("./_redefine"),D=d("./_hide"),A=d("./_iterators"),x=d("./_iter-create"),v=d("./_set-to-string-tag"),h=d("./_object-gpo"),p=d("./_wks")("iterator"),c=!([].keys&&"next"in[].keys()),m="@@iterator",C="keys",g="values",T=function(){return this};V.exports=function(B,F,J,H,K,Y,W){x(J,F,H);var U=function(j){if(!c&&j in w)return w[j];switch(j){case C:return function(){return new J(this,j)};case g:return function(){return new J(this,j)}}return function(){return new J(this,j)}},_=F+" Iterator",te=K==g,q=!1,w=B.prototype,X=w[p]||w[m]||K&&w[K],ne=X||U(K),he=K?te?U("entries"):ne:void 0,le=F=="Array"&&w.entries||X,_e,se,be;if(le&&(be=h(le.call(new B)),be!==Object.prototype&&be.next&&(v(be,_,!0),!y&&typeof be[p]!="function"&&D(be,p,T))),te&&X&&X.name!==g&&(q=!0,ne=function(){return X.call(this)}),(!y||W)&&(c||q||!w[p])&&D(w,p,ne),A[F]=ne,A[_]=T,K)if(_e={values:te?ne:U(g),keys:Y?ne:U(C),entries:he},W)for(se in _e)se in w||M(w,se,_e[se]);else l(l.P+l.F*(c||q),F,_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(d,V,O){var y=d("./_wks")("iterator"),l=!1;try{var M=[7][y]();M.return=function(){l=!0},Array.from(M,function(){throw 2})}catch(D){}V.exports=function(D,A){if(!A&&!l)return!1;var x=!1;try{var v=[7],h=v[y]();h.next=function(){return{done:x=!0}},v[y]=function(){return h},D(v)}catch(p){}return x}},{"./_wks":166}],124:[function(d,V,O){V.exports=function(y,l){return{value:l,done:!!y}}},{}],125:[function(d,V,O){V.exports={}},{}],126:[function(d,V,O){V.exports=!0},{}],127:[function(d,V,O){var y=d("./_uid")("meta"),l=d("./_is-object"),M=d("./_has"),D=d("./_object-dp").f,A=0,x=Object.isExtensible||function(){return!0},v=!d("./_fails")(function(){return x(Object.preventExtensions({}))}),h=function(g){D(g,y,{value:{i:"O"+ ++A,w:{}}})},p=function(g,T){if(!l(g))return typeof g=="symbol"?g:(typeof g=="string"?"S":"P")+g;if(!M(g,y)){if(!x(g))return"F";if(!T)return"E";h(g)}return g[y].i},c=function(g,T){if(!M(g,y)){if(!x(g))return!0;if(!T)return!1;h(g)}return g[y].w},m=function(g){return v&&C.NEED&&x(g)&&!M(g,y)&&h(g),g},C=V.exports={KEY:y,NEED:!1,fastKey:p,getWeak:c,onFreeze:m}},{"./_fails":108,"./_has":111,"./_is-object":119,"./_object-dp":132,"./_uid":162}],128:[function(d,V,O){var y=d("./_global"),l=d("./_task").set,M=y.MutationObserver||y.WebKitMutationObserver,D=y.process,A=y.Promise,x=d("./_cof")(D)=="process";V.exports=function(){var v,h,p,c=function(){var T,B;for(x&&(T=D.domain)&&T.exit();v;){B=v.fn,v=v.next;try{B()}catch(F){throw v?p():h=void 0,F}}h=void 0,T&&T.enter()};if(x)p=function(){D.nextTick(c)};else if(M&&!(y.navigator&&y.navigator.standalone)){var m=!0,C=document.createTextNode("");new M(c).observe(C,{characterData:!0}),p=function(){C.data=m=!m}}else if(A&&A.resolve){var g=A.resolve(void 0);p=function(){g.then(c)}}else p=function(){l.call(y,c)};return function(T){var B={fn:T,next:void 0};h&&(h.next=B),v||(v=B,p()),h=B}}},{"./_cof":98,"./_global":110,"./_task":155}],129:[function(d,V,O){"use strict";var y=d("./_a-function");function l(M){var D,A;this.promise=new M(function(x,v){if(D!==void 0||A!==void 0)throw TypeError("Bad Promise constructor");D=x,A=v}),this.resolve=y(D),this.reject=y(A)}V.exports.f=function(M){return new l(M)}},{"./_a-function":92}],130:[function(d,V,O){"use strict";var y=d("./_descriptors"),l=d("./_object-keys"),M=d("./_object-gops"),D=d("./_object-pie"),A=d("./_to-object"),x=d("./_iobject"),v=Object.assign;V.exports=!v||d("./_fails")(function(){var h={},p={},c=Symbol(),m="abcdefghijklmnopqrst";return h[c]=7,m.split("").forEach(function(C){p[C]=C}),v({},h)[c]!=7||Object.keys(v({},p)).join("")!=m})?function(p,c){for(var m=A(p),C=arguments.length,g=1,T=M.f,B=D.f;C>g;)for(var F=x(arguments[g++]),J=T?l(F).concat(T(F)):l(F),H=J.length,K=0,Y;H>K;)Y=J[K++],(!y||B.call(F,Y))&&(m[Y]=F[Y]);return m}:v},{"./_descriptors":103,"./_fails":108,"./_iobject":116,"./_object-gops":137,"./_object-keys":140,"./_object-pie":141,"./_to-object":160}],131:[function(d,V,O){var y=d("./_an-object"),l=d("./_object-dps"),M=d("./_enum-bug-keys"),D=d("./_shared-key")("IE_PROTO"),A=function(){},x="prototype",v=function(){var h=d("./_dom-create")("iframe"),p=M.length,c="<",m=">",C;for(h.style.display="none",d("./_html").appendChild(h),h.src="javascript:",C=h.contentWindow.document,C.open(),C.write(c+"script"+m+"document.F=Object"+c+"/script"+m),C.close(),v=C.F;p--;)delete v[x][M[p]];return v()};V.exports=Object.create||function(p,c){var m;return p!==null?(A[x]=y(p),m=new A,A[x]=null,m[D]=p):m=v(),c===void 0?m:l(m,c)}},{"./_an-object":95,"./_dom-create":104,"./_enum-bug-keys":105,"./_html":113,"./_object-dps":133,"./_shared-key":151}],132:[function(d,V,O){var y=d("./_an-object"),l=d("./_ie8-dom-define"),M=d("./_to-primitive"),D=Object.defineProperty;O.f=d("./_descriptors")?Object.defineProperty:function(x,v,h){if(y(x),v=M(v,!0),y(h),l)try{return D(x,v,h)}catch(p){}if("get"in h||"set"in h)throw TypeError("Accessors not supported!");return"value"in h&&(x[v]=h.value),x}},{"./_an-object":95,"./_descriptors":103,"./_ie8-dom-define":114,"./_to-primitive":161}],133:[function(d,V,O){var y=d("./_object-dp"),l=d("./_an-object"),M=d("./_object-keys");V.exports=d("./_descriptors")?Object.defineProperties:function(A,x){l(A);for(var v=M(x),h=v.length,p=0,c;h>p;)y.f(A,c=v[p++],x[c]);return A}},{"./_an-object":95,"./_descriptors":103,"./_object-dp":132,"./_object-keys":140}],134:[function(d,V,O){var y=d("./_object-pie"),l=d("./_property-desc"),M=d("./_to-iobject"),D=d("./_to-primitive"),A=d("./_has"),x=d("./_ie8-dom-define"),v=Object.getOwnPropertyDescriptor;O.f=d("./_descriptors")?v:function(p,c){if(p=M(p),c=D(c,!0),x)try{return v(p,c)}catch(m){}if(A(p,c))return l(!y.f.call(p,c),p[c])}},{"./_descriptors":103,"./_has":111,"./_ie8-dom-define":114,"./_object-pie":141,"./_property-desc":146,"./_to-iobject":158,"./_to-primitive":161}],135:[function(d,V,O){var y=d("./_to-iobject"),l=d("./_object-gopn").f,M={}.toString,D=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],A=function(x){try{return l(x)}catch(v){return D.slice()}};V.exports.f=function(v){return D&&M.call(v)=="[object Window]"?A(v):l(y(v))}},{"./_object-gopn":136,"./_to-iobject":158}],136:[function(d,V,O){var y=d("./_object-keys-internal"),l=d("./_enum-bug-keys").concat("length","prototype");O.f=Object.getOwnPropertyNames||function(D){return y(D,l)}},{"./_enum-bug-keys":105,"./_object-keys-internal":139}],137:[function(d,V,O){O.f=Object.getOwnPropertySymbols},{}],138:[function(d,V,O){var y=d("./_has"),l=d("./_to-object"),M=d("./_shared-key")("IE_PROTO"),D=Object.prototype;V.exports=Object.getPrototypeOf||function(A){return A=l(A),y(A,M)?A[M]:typeof A.constructor=="function"&&A instanceof A.constructor?A.constructor.prototype:A instanceof Object?D:null}},{"./_has":111,"./_shared-key":151,"./_to-object":160}],139:[function(d,V,O){var y=d("./_has"),l=d("./_to-iobject"),M=d("./_array-includes")(!1),D=d("./_shared-key")("IE_PROTO");V.exports=function(A,x){var v=l(A),h=0,p=[],c;for(c in v)c!=D&&(y(v,c)&&p.push(c));for(;x.length>h;)y(v,c=x[h++])&&(~M(p,c)||p.push(c));return p}},{"./_array-includes":96,"./_has":111,"./_shared-key":151,"./_to-iobject":158}],140:[function(d,V,O){var y=d("./_object-keys-internal"),l=d("./_enum-bug-keys");V.exports=Object.keys||function(D){return y(D,l)}},{"./_enum-bug-keys":105,"./_object-keys-internal":139}],141:[function(d,V,O){O.f={}.propertyIsEnumerable},{}],142:[function(d,V,O){var y=d("./_export"),l=d("./_core"),M=d("./_fails");V.exports=function(D,A){var x=(l.Object||{})[D]||Object[D],v={};v[D]=A(x),y(y.S+y.F*M(function(){x(1)}),"Object",v)}},{"./_core":99,"./_export":107,"./_fails":108}],143:[function(d,V,O){var y=d("./_descriptors"),l=d("./_object-keys"),M=d("./_to-iobject"),D=d("./_object-pie").f;V.exports=function(A){return function(x){for(var v=M(x),h=l(v),p=h.length,c=0,m=[],C;p>c;)C=h[c++],(!y||D.call(v,C))&&m.push(A?[C,v[C]]:v[C]);return m}}},{"./_descriptors":103,"./_object-keys":140,"./_object-pie":141,"./_to-iobject":158}],144:[function(d,V,O){V.exports=function(y){try{return{e:!1,v:y()}}catch(l){return{e:!0,v:l}}}},{}],145:[function(d,V,O){var y=d("./_an-object"),l=d("./_is-object"),M=d("./_new-promise-capability");V.exports=function(D,A){if(y(D),l(A)&&A.constructor===D)return A;var x=M.f(D),v=x.resolve;return v(A),x.promise}},{"./_an-object":95,"./_is-object":119,"./_new-promise-capability":129}],146:[function(d,V,O){V.exports=function(y,l){return{enumerable:!(y&1),configurable:!(y&2),writable:!(y&4),value:l}}},{}],147:[function(d,V,O){var y=d("./_hide");V.exports=function(l,M,D){for(var A in M)D&&l[A]?l[A]=M[A]:y(l,A,M[A]);return l}},{"./_hide":112}],148:[function(d,V,O){V.exports=d("./_hide")},{"./_hide":112}],149:[function(d,V,O){"use strict";var y=d("./_global"),l=d("./_core"),M=d("./_object-dp"),D=d("./_descriptors"),A=d("./_wks")("species");V.exports=function(x){var v=typeof l[x]=="function"?l[x]:y[x];D&&v&&!v[A]&&M.f(v,A,{configurable:!0,get:function(){return this}})}},{"./_core":99,"./_descriptors":103,"./_global":110,"./_object-dp":132,"./_wks":166}],150:[function(d,V,O){var y=d("./_object-dp").f,l=d("./_has"),M=d("./_wks")("toStringTag");V.exports=function(D,A,x){D&&!l(D=x?D:D.prototype,M)&&y(D,M,{configurable:!0,value:A})}},{"./_has":111,"./_object-dp":132,"./_wks":166}],151:[function(d,V,O){var y=d("./_shared")("keys"),l=d("./_uid");V.exports=function(M){return y[M]||(y[M]=l(M))}},{"./_shared":152,"./_uid":162}],152:[function(d,V,O){var y=d("./_core"),l=d("./_global"),M="__core-js_shared__",D=l[M]||(l[M]={});(V.exports=function(A,x){return D[A]||(D[A]=x!==void 0?x:{})})("versions",[]).push({version:y.version,mode:d("./_library")?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})},{"./_core":99,"./_global":110,"./_library":126}],153:[function(d,V,O){var y=d("./_an-object"),l=d("./_a-function"),M=d("./_wks")("species");V.exports=function(D,A){var x=y(D).constructor,v;return x===void 0||(v=y(x)[M])==null?A:l(v)}},{"./_a-function":92,"./_an-object":95,"./_wks":166}],154:[function(d,V,O){var y=d("./_to-integer"),l=d("./_defined");V.exports=function(M){return function(D,A){var x=String(l(D)),v=y(A),h=x.length,p,c;return v<0||v>=h?M?"":void 0:(p=x.charCodeAt(v),p<55296||p>56319||v+1===h||(c=x.charCodeAt(v+1))<56320||c>57343?M?x.charAt(v):p:M?x.slice(v,v+2):(p-55296<<10)+(c-56320)+65536)}}},{"./_defined":102,"./_to-integer":157}],155:[function(d,V,O){var y=d("./_ctx"),l=d("./_invoke"),M=d("./_html"),D=d("./_dom-create"),A=d("./_global"),x=A.process,v=A.setImmediate,h=A.clearImmediate,p=A.MessageChannel,c=A.Dispatch,m=0,C={},g="onreadystatechange",T,B,F,J=function(){var K=+this;if(C.hasOwnProperty(K)){var Y=C[K];delete C[K],Y()}},H=function(K){J.call(K.data)};(!v||!h)&&(v=function(Y){for(var W=[],U=1;arguments.length>U;)W.push(arguments[U++]);return C[++m]=function(){l(typeof Y=="function"?Y:Function(Y),W)},T(m),m},h=function(Y){delete C[Y]},d("./_cof")(x)=="process"?T=function(K){x.nextTick(y(J,K,1))}:c&&c.now?T=function(K){c.now(y(J,K,1))}:p?(B=new p,F=B.port2,B.port1.onmessage=H,T=y(F.postMessage,F,1)):A.addEventListener&&typeof postMessage=="function"&&!A.importScripts?(T=function(K){A.postMessage(K+"","*")},A.addEventListener("message",H,!1)):g in D("script")?T=function(K){M.appendChild(D("script"))[g]=function(){M.removeChild(this),J.call(K)}}:T=function(K){setTimeout(y(J,K,1),0)}),V.exports={set:v,clear:h}},{"./_cof":98,"./_ctx":101,"./_dom-create":104,"./_global":110,"./_html":113,"./_invoke":115}],156:[function(d,V,O){var y=d("./_to-integer"),l=Math.max,M=Math.min;V.exports=function(D,A){return D=y(D),D<0?l(D+A,0):M(D,A)}},{"./_to-integer":157}],157:[function(d,V,O){var y=Math.ceil,l=Math.floor;V.exports=function(M){return isNaN(M=+M)?0:(M>0?l:y)(M)}},{}],158:[function(d,V,O){var y=d("./_iobject"),l=d("./_defined");V.exports=function(M){return y(l(M))}},{"./_defined":102,"./_iobject":116}],159:[function(d,V,O){var y=d("./_to-integer"),l=Math.min;V.exports=function(M){return M>0?l(y(M),9007199254740991):0}},{"./_to-integer":157}],160:[function(d,V,O){var y=d("./_defined");V.exports=function(l){return Object(y(l))}},{"./_defined":102}],161:[function(d,V,O){var y=d("./_is-object");V.exports=function(l,M){if(!y(l))return l;var D,A;if(M&&typeof(D=l.toString)=="function"&&!y(A=D.call(l)))return A;if(typeof(D=l.valueOf)=="function"&&!y(A=D.call(l)))return A;if(!M&&typeof(D=l.toString)=="function"&&!y(A=D.call(l)))return A;throw TypeError("Can't convert object to primitive value")}},{"./_is-object":119}],162:[function(d,V,O){var y=0,l=Math.random();V.exports=function(M){return"Symbol(".concat(M===void 0?"":M,")_",(++y+l).toString(36))}},{}],163:[function(d,V,O){var y=d("./_global"),l=y.navigator;V.exports=l&&l.userAgent||""},{"./_global":110}],164:[function(d,V,O){var y=d("./_global"),l=d("./_core"),M=d("./_library"),D=d("./_wks-ext"),A=d("./_object-dp").f;V.exports=function(x){var v=l.Symbol||(l.Symbol=M?{}:y.Symbol||{});x.charAt(0)!="_"&&!(x in v)&&A(v,x,{value:D.f(x)})}},{"./_core":99,"./_global":110,"./_library":126,"./_object-dp":132,"./_wks-ext":165}],165:[function(d,V,O){O.f=d("./_wks")},{"./_wks":166}],166:[function(d,V,O){var y=d("./_shared")("wks"),l=d("./_uid"),M=d("./_global").Symbol,D=typeof M=="function",A=V.exports=function(x){return y[x]||(y[x]=D&&M[x]||(D?M:l)("Symbol."+x))};A.store=y},{"./_global":110,"./_shared":152,"./_uid":162}],167:[function(d,V,O){var y=d("./_classof"),l=d("./_wks")("iterator"),M=d("./_iterators");V.exports=d("./_core").getIteratorMethod=function(D){if(D!=null)return D[l]||D["@@iterator"]||M[y(D)]}},{"./_classof":97,"./_core":99,"./_iterators":125,"./_wks":166}],168:[function(d,V,O){"use strict";var y=d("./_ctx"),l=d("./_export"),M=d("./_to-object"),D=d("./_iter-call"),A=d("./_is-array-iter"),x=d("./_to-length"),v=d("./_create-property"),h=d("./core.get-iterator-method");l(l.S+l.F*!d("./_iter-detect")(function(p){Array.from(p)}),"Array",{from:function(c){var m=M(c),C=typeof this=="function"?this:Array,g=arguments.length,T=g>1?arguments[1]:void 0,B=T!==void 0,F=0,J=h(m),H,K,Y,W;if(B&&(T=y(T,g>2?arguments[2]:void 0,2)),J!=null&&!(C==Array&&A(J)))for(W=J.call(m),K=new C;!(Y=W.next()).done;F++)v(K,F,B?D(W,T,[Y.value,F],!0):Y.value);else for(H=x(m.length),K=new C(H);H>F;F++)v(K,F,B?T(m[F],F):m[F]);return K.length=F,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(d,V,O){"use strict";var y=d("./_add-to-unscopables"),l=d("./_iter-step"),M=d("./_iterators"),D=d("./_to-iobject");V.exports=d("./_iter-define")(Array,"Array",function(A,x){this._t=D(A),this._i=0,this._k=x},function(){var A=this._t,x=this._k,v=this._i++;return!A||v>=A.length?(this._t=void 0,l(1)):x=="keys"?l(0,v):x=="values"?l(0,A[v]):l(0,[v,A[v]])},"values"),M.Arguments=M.Array,y("keys"),y("values"),y("entries")},{"./_add-to-unscopables":93,"./_iter-define":122,"./_iter-step":124,"./_iterators":125,"./_to-iobject":158}],170:[function(d,V,O){"use strict";var y=d("./_is-object"),l=d("./_object-gpo"),M=d("./_wks")("hasInstance"),D=Function.prototype;M in D||d("./_object-dp").f(D,M,{value:function(A){if(typeof this!="function"||!y(A))return!1;if(!y(this.prototype))return A instanceof this;for(;A=l(A);)if(this.prototype===A)return!0;return!1}})},{"./_is-object":119,"./_object-dp":132,"./_object-gpo":138,"./_wks":166}],171:[function(d,V,O){var y=d("./_export");y(y.S+y.F,"Object",{assign:d("./_object-assign")})},{"./_export":107,"./_object-assign":130}],172:[function(d,V,O){var y=d("./_export");y(y.S,"Object",{create:d("./_object-create")})},{"./_export":107,"./_object-create":131}],173:[function(d,V,O){var y=d("./_export");y(y.S+y.F*!d("./_descriptors"),"Object",{defineProperty:d("./_object-dp").f})},{"./_descriptors":103,"./_export":107,"./_object-dp":132}],174:[function(d,V,O){d("./_object-sap")("getOwnPropertyNames",function(){return d("./_object-gopn-ext").f})},{"./_object-gopn-ext":135,"./_object-sap":142}],175:[function(d,V,O){var y=d("./_to-object"),l=d("./_object-gpo");d("./_object-sap")("getPrototypeOf",function(){return function(D){return l(y(D))}})},{"./_object-gpo":138,"./_object-sap":142,"./_to-object":160}],176:[function(d,V,O){var y=d("./_to-object"),l=d("./_object-keys");d("./_object-sap")("keys",function(){return function(D){return l(y(D))}})},{"./_object-keys":140,"./_object-sap":142,"./_to-object":160}],177:[function(d,V,O){arguments[4][71][0].apply(O,arguments)},{dup:71}],178:[function(d,V,O){"use strict";var y=d("./_library"),l=d("./_global"),M=d("./_ctx"),D=d("./_classof"),A=d("./_export"),x=d("./_is-object"),v=d("./_a-function"),h=d("./_an-instance"),p=d("./_for-of"),c=d("./_species-constructor"),m=d("./_task").set,C=d("./_microtask")(),g=d("./_new-promise-capability"),T=d("./_perform"),B=d("./_user-agent"),F=d("./_promise-resolve"),J="Promise",H=l.TypeError,K=l.process,Y=K&&K.versions,W=Y&&Y.v8||"",U=l[J],_=D(K)=="process",te=function(){},q,w,X,ne,he=w=g.f,le=!!function(){try{var de=U.resolve(1),ee=(de.constructor={})[d("./_wks")("species")]=function(xe){xe(te,te)};return(_||typeof PromiseRejectionEvent=="function")&&de.then(te)instanceof ee&&W.indexOf("6.6")!==0&&B.indexOf("Chrome/66")===-1}catch(xe){}}(),_e=function(de){var ee;return x(de)&&typeof(ee=de.then)=="function"?ee:!1},se=function(de,ee){if(de._n)return;de._n=!0;var xe=de._c;C(function(){for(var Ne=de._v,Le=de._s==1,Ge=0,Qe=function(Te){var nt=Le?Te.ok:Te.fail,Ye=Te.resolve,Pe=Te.reject,ke=Te.domain,Be,ot,ve;try{nt?(Le||(de._h==2&&Q(de),de._h=1),nt===!0?Be=Ne:(ke&&ke.enter(),Be=nt(Ne),ke&&(ke.exit(),ve=!0)),Be===Te.promise?Pe(H("Promise-chain cycle")):(ot=_e(Be))?ot.call(Be,Ye,Pe):Ye(Be)):Pe(Ne)}catch(ge){ke&&!ve&&ke.exit(),Pe(ge)}};xe.length>Ge;)Qe(xe[Ge++]);de._c=[],de._n=!1,ee&&!de._h&&be(de)})},be=function(de){m.call(l,function(){var ee=de._v,xe=j(de),Ne,Le,Ge;if(xe&&(Ne=T(function(){_?K.emit("unhandledRejection",ee,de):(Le=l.onunhandledrejection)?Le({promise:de,reason:ee}):(Ge=l.console)&&Ge.error&&Ge.error("Unhandled promise rejection",ee)}),de._h=_||j(de)?2:1),de._a=void 0,xe&&Ne.e)throw Ne.v})},j=function(de){return de._h!==1&&(de._a||de._c).length===0},Q=function(de){m.call(l,function(){var ee;_?K.emit("rejectionHandled",de):(ee=l.onrejectionhandled)&&ee({promise:de,reason:de._v})})},L=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()),se(ee,!0)},re=function(de){var ee=this,xe;if(ee._d)return;ee._d=!0,ee=ee._w||ee;try{if(ee===de)throw H("Promise can't be resolved itself");(xe=_e(de))?C(function(){var Ne={_w:ee,_d:!1};try{xe.call(de,M(re,Ne,1),M(L,Ne,1))}catch(Le){L.call(Ne,Le)}}):(ee._v=de,ee._s=1,se(ee,!1))}catch(Ne){L.call({_w:ee,_d:!1},Ne)}};le||(U=function(ee){h(this,U,J,"_h"),v(ee),q.call(this);try{ee(M(re,this,1),M(L,this,1))}catch(xe){L.call(this,xe)}},q=function(ee){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},q.prototype=d("./_redefine-all")(U.prototype,{then:function(ee,xe){var Ne=he(c(this,U));return Ne.ok=typeof ee=="function"?ee:!0,Ne.fail=typeof xe=="function"&&xe,Ne.domain=_?K.domain:void 0,this._c.push(Ne),this._a&&this._a.push(Ne),this._s&&se(this,!1),Ne.promise},catch:function(de){return this.then(void 0,de)}}),X=function(){var de=new q;this.promise=de,this.resolve=M(re,de,1),this.reject=M(L,de,1)},g.f=he=function(de){return de===U||de===ne?new X(de):w(de)}),A(A.G+A.W+A.F*!le,{Promise:U}),d("./_set-to-string-tag")(U,J),d("./_set-species")(J),ne=d("./_core")[J],A(A.S+A.F*!le,J,{reject:function(ee){var xe=he(this),Ne=xe.reject;return Ne(ee),xe.promise}}),A(A.S+A.F*(y||!le),J,{resolve:function(ee){return F(y&&this===ne?U:this,ee)}}),A(A.S+A.F*!(le&&d("./_iter-detect")(function(de){U.all(de).catch(te)})),J,{all:function(ee){var xe=this,Ne=he(xe),Le=Ne.resolve,Ge=Ne.reject,Qe=T(function(){var Te=[],nt=0,Ye=1;p(ee,!1,function(Pe){var ke=nt++,Be=!1;Te.push(void 0),Ye++,xe.resolve(Pe).then(function(ot){if(Be)return;Be=!0,Te[ke]=ot,--Ye||Le(Te)},Ge)}),--Ye||Le(Te)});return Qe.e&&Ge(Qe.v),Ne.promise},race:function(ee){var xe=this,Ne=he(xe),Le=Ne.reject,Ge=T(function(){p(ee,!1,function(Qe){xe.resolve(Qe).then(Ne.resolve,Le)})});return Ge.e&&Le(Ge.v),Ne.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(d,V,O){var y=d("./_export"),l=d("./_to-absolute-index"),M=String.fromCharCode,D=String.fromCodePoint;y(y.S+y.F*(!!D&&D.length!=1),"String",{fromCodePoint:function(x){for(var v=[],h=arguments.length,p=0,c;h>p;){if(c=+arguments[p++],l(c,1114111)!==c)throw RangeError(c+" is not a valid code point");v.push(c<65536?M(c):M(((c-=65536)>>10)+55296,c%1024+56320))}return v.join("")}})},{"./_export":107,"./_to-absolute-index":156}],180:[function(d,V,O){"use strict";var y=d("./_string-at")(!0);d("./_iter-define")(String,"String",function(l){this._t=String(l),this._i=0},function(){var l=this._t,M=this._i,D;return M>=l.length?{value:void 0,done:!0}:(D=y(l,M),this._i+=D.length,{value:D,done:!1})})},{"./_iter-define":122,"./_string-at":154}],181:[function(d,V,O){"use strict";var y=d("./_global"),l=d("./_has"),M=d("./_descriptors"),D=d("./_export"),A=d("./_redefine"),x=d("./_meta").KEY,v=d("./_fails"),h=d("./_shared"),p=d("./_set-to-string-tag"),c=d("./_uid"),m=d("./_wks"),C=d("./_wks-ext"),g=d("./_wks-define"),T=d("./_enum-keys"),B=d("./_is-array"),F=d("./_an-object"),J=d("./_is-object"),H=d("./_to-object"),K=d("./_to-iobject"),Y=d("./_to-primitive"),W=d("./_property-desc"),U=d("./_object-create"),_=d("./_object-gopn-ext"),te=d("./_object-gopd"),q=d("./_object-gops"),w=d("./_object-dp"),X=d("./_object-keys"),ne=te.f,he=w.f,le=_.f,_e=y.Symbol,se=y.JSON,be=se&&se.stringify,j="prototype",Q=m("_hidden"),L=m("toPrimitive"),re={}.propertyIsEnumerable,de=h("symbol-registry"),ee=h("symbols"),xe=h("op-symbols"),Ne=Object[j],Le=typeof _e=="function"&&!!q.f,Ge=y.QObject,Qe=!Ge||!Ge[j]||!Ge[j].findChild,Te=M&&v(function(){return U(he({},"a",{get:function(){return he(this,"a",{value:7}).a}})).a!=7})?function(Ae,Xe,rt){var lt=ne(Ne,Xe);lt&&delete Ne[Xe],he(Ae,Xe,rt),lt&&Ae!==Ne&&he(Ne,Xe,lt)}:he,nt=function(Ae){var Xe=ee[Ae]=U(_e[j]);return Xe._k=Ae,Xe},Ye=Le&&typeof _e.iterator=="symbol"?function(Ae){return typeof Ae=="symbol"}:function(Ae){return Ae instanceof _e},Pe=function(Xe,rt,lt){return Xe===Ne&&Pe(xe,rt,lt),F(Xe),rt=Y(rt,!0),F(lt),l(ee,rt)?(lt.enumerable?(l(Xe,Q)&&Xe[Q][rt]&&(Xe[Q][rt]=!1),lt=U(lt,{enumerable:W(0,!1)})):(l(Xe,Q)||he(Xe,Q,W(1,{})),Xe[Q][rt]=!0),Te(Xe,rt,lt)):he(Xe,rt,lt)},ke=function(Xe,rt){F(Xe);for(var lt=T(rt=K(rt)),bt=0,Tt=lt.length,xt;Tt>bt;)Pe(Xe,xt=lt[bt++],rt[xt]);return Xe},Be=function(Xe,rt){return rt===void 0?U(Xe):ke(U(Xe),rt)},ot=function(Xe){var rt=re.call(this,Xe=Y(Xe,!0));return this===Ne&&l(ee,Xe)&&!l(xe,Xe)?!1:rt||!l(this,Xe)||!l(ee,Xe)||l(this,Q)&&this[Q][Xe]?rt:!0},ve=function(Xe,rt){if(Xe=K(Xe),rt=Y(rt,!0),Xe===Ne&&l(ee,rt)&&!l(xe,rt))return;var lt=ne(Xe,rt);return lt&&l(ee,rt)&&!(l(Xe,Q)&&Xe[Q][rt])&&(lt.enumerable=!0),lt},ge=function(Xe){for(var rt=le(K(Xe)),lt=[],bt=0,Tt;rt.length>bt;)!l(ee,Tt=rt[bt++])&&Tt!=Q&&Tt!=x&<.push(Tt);return lt},$e=function(Xe){for(var rt=Xe===Ne,lt=le(rt?xe:K(Xe)),bt=[],Tt=0,xt;lt.length>Tt;)l(ee,xt=lt[Tt++])&&(rt?l(Ne,xt):!0)&&bt.push(ee[xt]);return bt};Le||(_e=function(){if(this instanceof _e)throw TypeError("Symbol is not a constructor!");var Xe=c(arguments.length>0?arguments[0]:void 0),rt=function(lt){this===Ne&&rt.call(xe,lt),l(this,Q)&&l(this[Q],Xe)&&(this[Q][Xe]=!1),Te(this,Xe,W(1,lt))};return M&&Qe&&Te(Ne,Xe,{configurable:!0,set:rt}),nt(Xe)},A(_e[j],"toString",function(){return this._k}),te.f=ve,w.f=Pe,d("./_object-gopn").f=_.f=ge,d("./_object-pie").f=ot,q.f=$e,M&&!d("./_library")&&A(Ne,"propertyIsEnumerable",ot,!0),C.f=function(Ae){return nt(m(Ae))}),D(D.G+D.W+D.F*!Le,{Symbol:_e});for(var pe="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),Z=0;pe.length>Z;)m(pe[Z++]);for(var k=X(m.store),$=0;k.length>$;)g(k[$++]);D(D.S+D.F*!Le,"Symbol",{for:function(Ae){return l(de,Ae+="")?de[Ae]:de[Ae]=_e(Ae)},keyFor:function(Xe){if(!Ye(Xe))throw TypeError(Xe+" is not a symbol!");for(var rt in de)if(de[rt]===Xe)return rt},useSetter:function(){Qe=!0},useSimple:function(){Qe=!1}}),D(D.S+D.F*!Le,"Object",{create:Be,defineProperty:Pe,defineProperties:ke,getOwnPropertyDescriptor:ve,getOwnPropertyNames:ge,getOwnPropertySymbols:$e});var Re=v(function(){q.f(1)});D(D.S+D.F*Re,"Object",{getOwnPropertySymbols:function(Xe){return q.f(H(Xe))}}),se&&D(D.S+D.F*(!Le||v(function(){var Ae=_e();return be([Ae])!="[null]"||be({a:Ae})!="{}"||be(Object(Ae))!="{}"})),"JSON",{stringify:function(Xe){for(var rt=[Xe],lt=1,bt,Tt;arguments.length>lt;)rt.push(arguments[lt++]);return Tt=bt=rt[1],!J(bt)&&Xe===void 0||Ye(Xe)?void 0:(B(bt)||(bt=function(xt,Et){if(typeof Tt=="function"&&(Et=Tt.call(this,xt,Et)),!Ye(Et))return Et}),rt[1]=bt,be.apply(se,rt))}}),_e[j][L]||d("./_hide")(_e[j],L,_e[j].valueOf),p(_e,"Symbol"),p(Math,"Math",!0),p(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(d,V,O){var y=d("./_export"),l=d("./_object-to-array")(!0);y(y.S,"Object",{entries:function(D){return l(D)}})},{"./_export":107,"./_object-to-array":143}],183:[function(d,V,O){"use strict";var y=d("./_export"),l=d("./_core"),M=d("./_global"),D=d("./_species-constructor"),A=d("./_promise-resolve");y(y.P+y.R,"Promise",{finally:function(x){var v=D(this,l.Promise||M.Promise),h=typeof x=="function";return this.then(h?function(p){return A(v,x()).then(function(){return p})}:x,h?function(p){return A(v,x()).then(function(){throw p})}:x)}})},{"./_core":99,"./_export":107,"./_global":110,"./_promise-resolve":145,"./_species-constructor":153}],184:[function(d,V,O){"use strict";var y=d("./_export"),l=d("./_new-promise-capability"),M=d("./_perform");y(y.S,"Promise",{try:function(D){var A=l.f(this),x=M(D);return(x.e?A.reject:A.resolve)(x.v),A.promise}})},{"./_export":107,"./_new-promise-capability":129,"./_perform":144}],185:[function(d,V,O){d("./_wks-define")("asyncIterator")},{"./_wks-define":164}],186:[function(d,V,O){d("./_wks-define")("observable")},{"./_wks-define":164}],187:[function(d,V,O){d("./es6.array.iterator");for(var y=d("./_global"),l=d("./_hide"),M=d("./_iterators"),D=d("./_wks")("toStringTag"),A="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(","),x=0;x<A.length;x++){var v=A[x],h=y[v],p=h&&h.prototype;p&&!p[D]&&l(p,D,v),M[v]=M.Array}},{"./_global":110,"./_hide":112,"./_iterators":125,"./_wks":166,"./es6.array.iterator":169}],188:[function(d,V,O){var y=d("./_export"),l=d("./_task");y(y.G+y.B,{setImmediate:l.set,clearImmediate:l.clear})},{"./_export":107,"./_task":155}],189:[function(d,V,O){(function(y){"use strict";var l=d("babel-runtime/helpers/typeof"),M=D(l);function D(Y){return Y&&Y.__esModule?Y:{default:Y}}function A(Y){return Array.isArray?Array.isArray(Y):K(Y)==="[object Array]"}O.isArray=A;function x(Y){return typeof Y=="boolean"}O.isBoolean=x;function v(Y){return Y===null}O.isNull=v;function h(Y){return Y==null}O.isNullOrUndefined=h;function p(Y){return typeof Y=="number"}O.isNumber=p;function c(Y){return typeof Y=="string"}O.isString=c;function m(Y){return(typeof Y=="undefined"?"undefined":(0,M.default)(Y))==="symbol"}O.isSymbol=m;function C(Y){return Y===void 0}O.isUndefined=C;function g(Y){return K(Y)==="[object RegExp]"}O.isRegExp=g;function T(Y){return(typeof Y=="undefined"?"undefined":(0,M.default)(Y))==="object"&&Y!==null}O.isObject=T;function B(Y){return K(Y)==="[object Date]"}O.isDate=B;function F(Y){return K(Y)==="[object Error]"||Y instanceof Error}O.isError=F;function J(Y){return typeof Y=="function"}O.isFunction=J;function H(Y){return Y===null||typeof Y=="boolean"||typeof Y=="number"||typeof Y=="string"||(typeof Y=="undefined"?"undefined":(0,M.default)(Y))==="symbol"||typeof Y=="undefined"}O.isPrimitive=H,O.isBuffer=y.isBuffer;function K(Y){return Object.prototype.toString.call(Y)}}).call(this,{isBuffer:d("../../is-buffer/index.js")})},{"../../is-buffer/index.js":197,"babel-runtime/helpers/typeof":67}],190:[function(d,V,O){"use strict";var y=d("babel-runtime/helpers/typeof"),l=M(y);function M(D){return D&&D.__esModule?D:{default:D}}(function(D){"use strict";var A=function(){var c=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|'[^']*'|'[^']*'/g,m=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,C=/[^-+\dA-Z]/g;return function(g,T,B,F){if(arguments.length===1&&p(g)==="string"&&!/\d/.test(g)&&(T=g,g=void 0),g=g||new Date,g instanceof Date||(g=new Date(g)),isNaN(g))throw TypeError("Invalid date");T=String(A.masks[T]||T||A.masks.default);var J=T.slice(0,4);(J==="UTC:"||J==="GMT:")&&(T=T.slice(4),B=!0,J==="GMT:"&&(F=!0));var H=B?"getUTC":"get",K=g[H+"Date"](),Y=g[H+"Day"](),W=g[H+"Month"](),U=g[H+"FullYear"](),_=g[H+"Hours"](),te=g[H+"Minutes"](),q=g[H+"Seconds"](),w=g[H+"Milliseconds"](),X=B?0:g.getTimezoneOffset(),ne=v(g),he=h(g),le={d:K,dd:x(K),ddd:A.i18n.dayNames[Y],dddd:A.i18n.dayNames[Y+7],m:W+1,mm:x(W+1),mmm:A.i18n.monthNames[W],mmmm:A.i18n.monthNames[W+12],yy:String(U).slice(2),yyyy:U,h:_%12||12,hh:x(_%12||12),H:_,HH:x(_),M:te,MM:x(te),s:q,ss:x(q),l:x(w,3),L:x(Math.round(w/10)),t:_<12?"a":"p",tt:_<12?"am":"pm",T:_<12?"A":"P",TT:_<12?"AM":"PM",Z:F?"GMT":B?"UTC":(String(g).match(m)||[""]).pop().replace(C,""),o:(X>0?"-":"+")+x(Math.floor(Math.abs(X)/60)*100+Math.abs(X)%60,4),S:["th","st","nd","rd"][K%10>3?0:(K%100-K%10!=10)*K%10],W:ne,N:he};return T.replace(c,function(_e){return _e in le?le[_e]:_e.slice(1,_e.length-1)})}}();A.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"},A.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 x(c,m){for(c=String(c),m=m||2;c.length<m;)c="0"+c;return c}function v(c){var m=new Date(c.getFullYear(),c.getMonth(),c.getDate());m.setDate(m.getDate()-(m.getDay()+6)%7+3);var C=new Date(m.getFullYear(),0,4);C.setDate(C.getDate()-(C.getDay()+6)%7+3);var g=m.getTimezoneOffset()-C.getTimezoneOffset();m.setHours(m.getHours()-g);var T=(m-C)/(864e5*7);return 1+Math.floor(T)}function h(c){var m=c.getDay();return m===0&&(m=7),m}function p(c){return c===null?"null":c===void 0?"undefined":(typeof c=="undefined"?"undefined":(0,l.default)(c))!=="object"?typeof c=="undefined"?"undefined":(0,l.default)(c):Array.isArray(c)?"array":{}.toString.call(c).slice(8,-1).toLowerCase()}typeof define=="function"&&define.amd?define(function(){return A}):(typeof O=="undefined"?"undefined":(0,l.default)(O))==="object"?V.exports=A:D.dateFormat=A})(void 0)},{"babel-runtime/helpers/typeof":67}],191:[function(d,V,O){/*!
|
|
|
* 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=/["'&<>]/;V.exports=l;function l(M){var D=""+M,A=y.exec(D);if(!A)return D;var x,v="",h=0,p=0;for(h=A.index;h<D.length;h++){switch(D.charCodeAt(h)){case 34:x=""";break;case 38:x="&";break;case 39:x="'";break;case 60:x="<";break;case 62:x=">";break;default:continue}p!==h&&(v+=D.substring(p,h)),p=h+1,v+=x}return p!==h?v+D.substring(p,h):v}},{}],192:[function(d,V,O){function y(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}V.exports=y,y.EventEmitter=y,y.prototype._events=void 0,y.prototype._maxListeners=void 0,y.defaultMaxListeners=10,y.prototype.setMaxListeners=function(x){if(!M(x)||x<0||isNaN(x))throw TypeError("n must be a positive number");return this._maxListeners=x,this},y.prototype.emit=function(x){var v,h,p,c,m,C;if(this._events||(this._events={}),x==="error"&&(!this._events.error||D(this._events.error)&&!this._events.error.length)){if(v=arguments[1],v instanceof Error)throw v;var g=new Error('Uncaught, unspecified "error" event. ('+v+")");throw g.context=v,g}if(h=this._events[x],A(h))return!1;if(l(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:c=Array.prototype.slice.call(arguments,1),h.apply(this,c)}else if(D(h))for(c=Array.prototype.slice.call(arguments,1),C=h.slice(),p=C.length,m=0;m<p;m++)C[m].apply(this,c);return!0},y.prototype.addListener=function(x,v){var h;if(!l(v))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",x,l(v.listener)?v.listener:v),this._events[x]?D(this._events[x])?this._events[x].push(v):this._events[x]=[this._events[x],v]:this._events[x]=v,D(this._events[x])&&!this._events[x].warned&&(A(this._maxListeners)?h=y.defaultMaxListeners:h=this._maxListeners,h&&h>0&&this._events[x].length>h&&(this._events[x].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[x].length),typeof console.trace=="function"&&console.trace())),this},y.prototype.on=y.prototype.addListener,y.prototype.once=function(x,v){if(!l(v))throw TypeError("listener must be a function");var h=!1;function p(){this.removeListener(x,p),h||(h=!0,v.apply(this,arguments))}return p.listener=v,this.on(x,p),this},y.prototype.removeListener=function(x,v){var h,p,c,m;if(!l(v))throw TypeError("listener must be a function");if(!this._events||!this._events[x])return this;if(h=this._events[x],c=h.length,p=-1,h===v||l(h.listener)&&h.listener===v)delete this._events[x],this._events.removeListener&&this.emit("removeListener",x,v);else if(D(h)){for(m=c;m-- >0;)if(h[m]===v||h[m].listener&&h[m].listener===v){p=m;break}if(p<0)return this;h.length===1?(h.length=0,delete this._events[x]):h.splice(p,1),this._events.removeListener&&this.emit("removeListener",x,v)}return this},y.prototype.removeAllListeners=function(x){var v,h;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[x]&&delete this._events[x],this;if(arguments.length===0){for(v in this._events){if(v==="removeListener")continue;this.removeAllListeners(v)}return this.removeAllListeners("removeListener"),this._events={},this}if(h=this._events[x],l(h))this.removeListener(x,h);else if(h)for(;h.length;)this.removeListener(x,h[h.length-1]);return delete this._events[x],this},y.prototype.listeners=function(x){var v;return!this._events||!this._events[x]?v=[]:l(this._events[x])?v=[this._events[x]]:v=this._events[x].slice(),v},y.prototype.listenerCount=function(x){if(this._events){var v=this._events[x];if(l(v))return 1;if(v)return v.length}return 0},y.listenerCount=function(x,v){return x.listenerCount(v)};function l(x){return typeof x=="function"}function M(x){return typeof x=="number"}function D(x){return typeof x=="object"&&x!==null}function A(x){return x===void 0}},{}],193:[function(d,V,O){var y=d("http"),l=V.exports;for(var M in y)y.hasOwnProperty(M)&&(l[M]=y[M]);l.request=function(D,A){return D||(D={}),D.scheme="https",D.protocol="https:",y.request.call(this,D,A)}},{http:231}],194:[function(d,V,O){/*!
|
|
|
* humanize-ms - index.js
|
|
|
* Copyright(c) 2014 dead_horse <dead_horse@qq.com>
|
|
|
* MIT Licensed
|
|
|
*/"use strict";var y=d("util"),l=d("ms");V.exports=function(M){if(typeof M=="number")return M;var D=l(M);if(D===void 0){var A=new Error(y.format("humanize-ms(%j) result undefined",M));console.warn(A.stack)}return D}},{ms:204,util:243}],195:[function(d,V,O){O.read=function(y,l,M,D,A){var x,v,h=A*8-D-1,p=(1<<h)-1,c=p>>1,m=-7,C=M?A-1:0,g=M?-1:1,T=y[l+C];for(C+=g,x=T&(1<<-m)-1,T>>=-m,m+=h;m>0;x=x*256+y[l+C],C+=g,m-=8);for(v=x&(1<<-m)-1,x>>=-m,m+=D;m>0;v=v*256+y[l+C],C+=g,m-=8);if(x===0)x=1-c;else{if(x===p)return v?NaN:(T?-1:1)*Infinity;v=v+Math.pow(2,D),x=x-c}return(T?-1:1)*v*Math.pow(2,x-D)},O.write=function(y,l,M,D,A,x){var v,h,p,c=x*8-A-1,m=(1<<c)-1,C=m>>1,g=A===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=D?0:x-1,B=D?1:-1,F=l<0||l===0&&1/l<0?1:0;for(l=Math.abs(l),isNaN(l)||l===Infinity?(h=isNaN(l)?1:0,v=m):(v=Math.floor(Math.log(l)/Math.LN2),l*(p=Math.pow(2,-v))<1&&(v--,p*=2),v+C>=1?l+=g/p:l+=g*Math.pow(2,1-C),l*p>=2&&(v++,p/=2),v+C>=m?(h=0,v=m):v+C>=1?(h=(l*p-1)*Math.pow(2,A),v=v+C):(h=l*Math.pow(2,C-1)*Math.pow(2,A),v=0));A>=8;y[M+T]=h&255,T+=B,h/=256,A-=8);for(v=v<<A|h,c+=A;c>0;y[M+T]=v&255,T+=B,v/=256,c-=8);y[M+T-B]|=F*128}},{}],196:[function(d,V,O){typeof Object.create=="function"?V.exports=function(l,M){M&&(l.super_=M,l.prototype=Object.create(M.prototype,{constructor:{value:l,enumerable:!1,writable:!0,configurable:!0}}))}:V.exports=function(l,M){if(M){l.super_=M;var D=function(){};D.prototype=M.prototype,l.prototype=new D,l.prototype.constructor=l}}},{}],197:[function(d,V,O){/*!
|
|
|
* Determine if an object is a Buffer
|
|
|
*
|
|
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
|
* @license MIT
|
|
|
*/V.exports=function(M){return M!=null&&(y(M)||l(M)||!!M._isBuffer)};function y(M){return!!M.constructor&&typeof M.constructor.isBuffer=="function"&&M.constructor.isBuffer(M)}function l(M){return typeof M.readFloatLE=="function"&&typeof M.slice=="function"&&y(M.slice(0,0))}},{}],198:[function(d,V,O){var y={}.toString;V.exports=Array.isArray||function(l){return y.call(l)=="[object Array]"}},{}],199:[function(require,module,exports){(function(global){(function(d,V){typeof exports=="object"&&typeof module!="undefined"?module.exports=V(d):typeof define=="function"&&define.amd?define(V):V(d)})(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(d){buffer=void 0}var b64chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b64tab=function(d){for(var V={},O=0,y=d.length;O<y;O++)V[d.charAt(O)]=O;return V}(b64chars),fromCharCode=String.fromCharCode,cb_utob=function(d){if(d.length<2){var V=d.charCodeAt(0);return V<128?d:V<2048?fromCharCode(192|V>>>6)+fromCharCode(128|V&63):fromCharCode(224|V>>>12&15)+fromCharCode(128|V>>>6&63)+fromCharCode(128|V&63)}else{var V=65536+(d.charCodeAt(0)-55296)*1024+(d.charCodeAt(1)-56320);return fromCharCode(240|V>>>18&7)+fromCharCode(128|V>>>12&63)+fromCharCode(128|V>>>6&63)+fromCharCode(128|V&63)}},re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,utob=function(d){return d.replace(re_utob,cb_utob)},cb_encode=function(d){var V=[0,2,1][d.length%3],O=d.charCodeAt(0)<<16|(d.length>1?d.charCodeAt(1):0)<<8|(d.length>2?d.charCodeAt(2):0),y=[b64chars.charAt(O>>>18),b64chars.charAt(O>>>12&63),V>=2?"=":b64chars.charAt(O>>>6&63),V>=1?"=":b64chars.charAt(O&63)];return y.join("")},btoa=global.btoa?function(d){return global.btoa(d)}:function(d){return d.replace(/[\s\S]{1,3}/g,cb_encode)},_encode=function(d){var V=Object.prototype.toString.call(d)==="[object Uint8Array]";return V?d.toString("base64"):btoa(utob(String(d)))},encode=function(d,V){return V?_encode(String(d)).replace(/[+\/]/g,function(O){return O=="+"?"-":"_"}).replace(/=/g,""):_encode(d)},encodeURI=function(d){return encode(d,!0)},re_btou=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,cb_btou=function(d){switch(d.length){case 4:var V=(7&d.charCodeAt(0))<<18|(63&d.charCodeAt(1))<<12|(63&d.charCodeAt(2))<<6|63&d.charCodeAt(3),O=V-65536;return fromCharCode((O>>>10)+55296)+fromCharCode((O&1023)+56320);case 3:return fromCharCode((15&d.charCodeAt(0))<<12|(63&d.charCodeAt(1))<<6|63&d.charCodeAt(2));default:return fromCharCode((31&d.charCodeAt(0))<<6|63&d.charCodeAt(1))}},btou=function(d){return d.replace(re_btou,cb_btou)},cb_decode=function(d){var V=d.length,O=V%4,y=(V>0?b64tab[d.charAt(0)]<<18:0)|(V>1?b64tab[d.charAt(1)]<<12:0)|(V>2?b64tab[d.charAt(2)]<<6:0)|(V>3?b64tab[d.charAt(3)]:0),l=[fromCharCode(y>>>16),fromCharCode(y>>>8&255),fromCharCode(y&255)];return l.length-=[0,0,2,1][O],l.join("")},_atob=global.atob?function(d){return global.atob(d)}:function(d){return d.replace(/\S{1,4}/g,cb_decode)},atob=function(d){return _atob(String(d).replace(/[^A-Za-z0-9\+\/]/g,""))},_decode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(d){return(d.constructor===buffer.constructor?d:buffer.from(d,"base64")).toString()}:function(d){return(d.constructor===buffer.constructor?d:new buffer(d,"base64")).toString()}:function(d){return btou(_atob(d))},decode=function(d){return _decode(String(d).replace(/[-_]/g,function(V){return V=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))},noConflict=function(){var d=global.Base64;return global.Base64=_Base64,d};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(d){return{value:d,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(d){return encode(this,d)})),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(d,V,O){/*!
|
|
|
* merge-descriptors
|
|
|
* Copyright(c) 2014 Jonathan Ong
|
|
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
|
* MIT Licensed
|
|
|
*/"use strict";V.exports=l;var y=Object.prototype.hasOwnProperty;function l(M,D,A){if(!M)throw new TypeError("argument dest is required");if(!D)throw new TypeError("argument src is required");return A===void 0&&(A=!0),Object.getOwnPropertyNames(D).forEach(function(v){if(!A&&y.call(M,v))return;var h=Object.getOwnPropertyDescriptor(D,v);Object.defineProperty(M,v,h)}),M}},{}],201:[function(d,V,O){"use strict";function y(){this._types=Object.create(null),this._extensions=Object.create(null);for(var l=0;l<arguments.length;l++)this.define(arguments[l]);this.define=this.define.bind(this),this.getType=this.getType.bind(this),this.getExtension=this.getExtension.bind(this)}y.prototype.define=function(l,M){for(var D in l){var A=l[D].map(function(h){return h.toLowerCase()});D=D.toLowerCase();for(var x=0;x<A.length;x++){var v=A[x];if(v[0]=="*")continue;if(!M&&v in this._types)throw new Error('Attempt to change mapping for "'+v+'" extension from "'+this._types[v]+'" to "'+D+'". Pass `force=true` to allow this, otherwise remove "'+v+'" from the list of extensions for "'+D+'".');this._types[v]=D}if(M||!this._extensions[D]){var v=A[0];this._extensions[D]=v[0]!="*"?v:v.substr(1)}}},y.prototype.getType=function(l){l=String(l);var M=l.replace(/^.*[/\\]/,"").toLowerCase(),D=M.replace(/^.*\./,"").toLowerCase(),A=M.length<l.length,x=D.length<M.length-1;return(x||!A)&&this._types[D]||null},y.prototype.getExtension=function(l){return l=/^\s*([^;\s]*)/.test(l)&&RegExp.$1,l&&this._extensions[l.toLowerCase()]||null},V.exports=y},{}],202:[function(d,V,O){"use strict";var y=d("./Mime");V.exports=new y(d("./types/standard"))},{"./Mime":201,"./types/standard":203}],203:[function(d,V,O){V.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(d,V,O){var y=1e3,l=y*60,M=l*60,D=M*24,A=D*7,x=D*365.25;V.exports=function(m,C){C=C||{};var g=typeof m;if(g==="string"&&m.length>0)return v(m);if(g==="number"&&isFinite(m))return C.long?p(m):h(m);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(m))};function v(m){if(m=String(m),m.length>100)return;var C=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(m);if(!C)return;var g=parseFloat(C[1]),T=(C[2]||"ms").toLowerCase();switch(T){case"years":case"year":case"yrs":case"yr":case"y":return g*x;case"weeks":case"week":case"w":return g*A;case"days":case"day":case"d":return g*D;case"hours":case"hour":case"hrs":case"hr":case"h":return g*M;case"minutes":case"minute":case"mins":case"min":case"m":return g*l;case"seconds":case"second":case"secs":case"sec":case"s":return g*y;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return g;default:return}}function h(m){var C=Math.abs(m);return C>=D?Math.round(m/D)+"d":C>=M?Math.round(m/M)+"h":C>=l?Math.round(m/l)+"m":C>=y?Math.round(m/y)+"s":m+"ms"}function p(m){var C=Math.abs(m);return C>=D?c(m,C,D,"day"):C>=M?c(m,C,M,"hour"):C>=l?c(m,C,l,"minute"):C>=y?c(m,C,y,"second"):m+" ms"}function c(m,C,g,T){var B=C>=g*1.5;return Math.round(m/g)+" "+T+(B?"s":"")}},{}],205:[function(d,V,O){(function(y){function l(x,v){for(var h=0,p=x.length-1;p>=0;p--){var c=x[p];c==="."?x.splice(p,1):c===".."?(x.splice(p,1),h++):h&&(x.splice(p,1),h--)}if(v)for(;h--;h)x.unshift("..");return x}O.resolve=function(){for(var x="",v=!1,h=arguments.length-1;h>=-1&&!v;h--){var p=h>=0?arguments[h]:y.cwd();if(typeof p!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!p)continue;x=p+"/"+x,v=p.charAt(0)==="/"}return x=l(D(x.split("/"),function(c){return!!c}),!v).join("/"),(v?"/":"")+x||"."},O.normalize=function(x){var v=O.isAbsolute(x),h=A(x,-1)==="/";return x=l(D(x.split("/"),function(p){return!!p}),!v).join("/"),!x&&!v&&(x="."),x&&h&&(x+="/"),(v?"/":"")+x},O.isAbsolute=function(x){return x.charAt(0)==="/"},O.join=function(){var x=Array.prototype.slice.call(arguments,0);return O.normalize(D(x,function(v,h){if(typeof v!="string")throw new TypeError("Arguments to path.join must be strings");return v}).join("/"))},O.relative=function(x,v){x=O.resolve(x).substr(1),v=O.resolve(v).substr(1);function h(B){for(var F=0;F<B.length&&!(B[F]!=="");F++);for(var J=B.length-1;J>=0&&!(B[J]!=="");J--);return F>J?[]:B.slice(F,J-F+1)}for(var p=h(x.split("/")),c=h(v.split("/")),m=Math.min(p.length,c.length),C=m,g=0;g<m;g++)if(p[g]!==c[g]){C=g;break}for(var T=[],g=C;g<p.length;g++)T.push("..");return T=T.concat(c.slice(C)),T.join("/")},O.sep="/",O.delimiter=":",O.dirname=function(x){if(typeof x!="string"&&(x=x+""),x.length===0)return".";for(var v=x.charCodeAt(0),h=v===47,p=-1,c=!0,m=x.length-1;m>=1;--m)if(v=x.charCodeAt(m),v===47){if(!c){p=m;break}}else c=!1;return p===-1?h?"/":".":h&&p===1?"/":x.slice(0,p)};function M(x){typeof x!="string"&&(x=x+"");var v=0,h=-1,p=!0,c;for(c=x.length-1;c>=0;--c)if(x.charCodeAt(c)===47){if(!p){v=c+1;break}}else h===-1&&(p=!1,h=c+1);return h===-1?"":x.slice(v,h)}O.basename=function(x,v){var h=M(x);return v&&h.substr(-1*v.length)===v&&(h=h.substr(0,h.length-v.length)),h},O.extname=function(x){typeof x!="string"&&(x=x+"");for(var v=-1,h=0,p=-1,c=!0,m=0,C=x.length-1;C>=0;--C){var g=x.charCodeAt(C);if(g===47){if(!c){h=C+1;break}continue}p===-1&&(c=!1,p=C+1),g===46?v===-1?v=C:m!==1&&(m=1):v!==-1&&(m=-1)}return v===-1||p===-1||m===0||m===1&&v===p-1&&v===h+1?"":x.slice(v,p)};function D(x,v){if(x.filter)return x.filter(v);for(var h=[],p=0;p<x.length;p++)v(x[p],p,x)&&h.push(x[p]);return h}var A="ab".substr(-1)==="b"?function(x,v,h){return x.substr(v,h)}:function(x,v,h){return v<0&&(v=x.length+v),x.substr(v,h)}}).call(this,d("_process"))},{_process:208}],206:[function(d,V,O){(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 l={function:!0,object:!0},M=l[typeof window]&&window||this,D=M,A=l[typeof O]&&O,x=l[typeof V]&&V&&!V.nodeType&&V,v=A&&x&&typeof y=="object"&&y;v&&(v.global===v||v.window===v||v.self===v)&&(M=v);var h=Math.pow(2,53)-1,p=/\bOpera/,c=this,m=Object.prototype,C=m.hasOwnProperty,g=m.toString;function T(w){return w=String(w),w.charAt(0).toUpperCase()+w.slice(1)}function B(w,X,ne){var he={"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 X&&ne&&/^Win/i.test(w)&&!/^Windows Phone /i.test(w)&&(he=he[/[\d.]+$/.exec(w)])&&(w="Windows "+he),w=String(w),X&&ne&&(w=w.replace(RegExp(X,"i"),ne)),w=J(w.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]),w}function F(w,X){var ne=-1,he=w?w.length:0;if(typeof he=="number"&&he>-1&&he<=h)for(;++ne<he;)X(w[ne],ne,w);else H(w,X)}function J(w){return w=_(w),/^(?:webOS|i(?:OS|P))/.test(w)?w:T(w)}function H(w,X){for(var ne in w)C.call(w,ne)&&X(w[ne],ne,w)}function K(w){return w==null?T(w):g.call(w).slice(8,-1)}function Y(w,X){var ne=w!=null?typeof w[X]:"number";return!/^(?:boolean|number|string|undefined)$/.test(ne)&&(ne=="object"?!!w[X]:!0)}function W(w){return String(w).replace(/([ -])(?!$)/g,"$1?")}function U(w,X){var ne=null;return F(w,function(he,le){ne=X(ne,he,le,w)}),ne}function _(w){return String(w).replace(/^ +| +$/g,"")}function te(w){var X=M,ne=w&&typeof w=="object"&&K(w)!="String";ne&&(X=w,w=null);var he=X.navigator||{},le=he.userAgent||"";w||(w=le);var _e=ne||c==D,se=ne?!!he.likeChrome:/\bChrome\b/.test(w)&&!/internal|\n/i.test(g.toString()),be="Object",j=ne?be:"ScriptBridgingProxyObject",Q=ne?be:"Environment",L=ne&&X.java?"JavaPackage":K(X.java),re=ne?be:"RuntimeObject",de=/\bJava/.test(L)&&X.java,ee=de&&K(X.environment)==Q,xe=de?"a":"\u03B1",Ne=de?"b":"\u03B2",Le=X.document||{},Ge=X.operamini||X.opera,Qe=p.test(Qe=ne&&Ge?Ge["[[Class]]"]:K(Ge))?Qe:Ge=null,Te,nt=w,Ye=[],Pe=null,ke=w==le,Be=ke&&Ge&&typeof Ge.version=="function"&&Ge.version(),ot,ve=k([{label:"EdgeHTML",pattern:"Edge"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"]),ge=Re(["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"]),$e=Xe([{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"]),pe=$({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}}),Z=Ae(["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 k(Tt){return U(Tt,function(xt,Et){return xt||RegExp("\\b"+(Et.pattern||W(Et))+"\\b","i").exec(w)&&(Et.label||Et)})}function $(Tt){return U(Tt,function(xt,Et,Nt){return xt||(Et[$e]||Et[/^[a-z]+(?: +[a-z]+\b)*/i.exec($e)]||RegExp("\\b"+W(Nt)+"(?:\\b|\\w*\\d)","i").exec(w))&&Nt})}function Re(Tt){return U(Tt,function(xt,Et){return xt||RegExp("\\b"+(Et.pattern||W(Et))+"\\b","i").exec(w)&&(Et.label||Et)})}function Ae(Tt){return U(Tt,function(xt,Et){var Nt=Et.pattern||W(Et);return!xt&&(xt=RegExp("\\b"+Nt+"(?:/[\\d.]+|[ \\w.]*)","i").exec(w))&&(xt=B(xt,Nt,Et.label||Et)),xt})}function Xe(Tt){return U(Tt,function(xt,Et){var Nt=Et.pattern||W(Et);return!xt&&(xt=RegExp("\\b"+Nt+" *\\d+[.\\w_]*","i").exec(w)||RegExp("\\b"+Nt+" *\\w+-[\\w]*","i").exec(w)||RegExp("\\b"+Nt+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(w))&&((xt=String(Et.label&&!RegExp(Nt,"i").test(Et.label)?Et.label:xt).split("/"))[1]&&!/[\d.]+/.test(xt[0])&&(xt[0]+=" "+xt[1]),Et=Et.label||Et,xt=J(xt[0].replace(RegExp(Nt,"i"),Et).replace(RegExp("; *(?:"+Et+"[_-])?","i")," ").replace(RegExp("("+Et+")[-_.]?(\\w)","i"),"$1 $2"))),xt})}function rt(Tt){return U(Tt,function(xt,Et){return xt||(RegExp(Et+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(w)||0)[1]||null})}function lt(){return this.description||""}if(ve&&(ve=[ve]),pe&&!$e&&($e=Xe([pe])),(Te=/\bGoogle TV\b/.exec($e))&&($e=Te[0]),/\bSimulator\b/i.test(w)&&($e=($e?$e+" ":"")+"Simulator"),ge=="Opera Mini"&&/\bOPiOS\b/.test(w)&&Ye.push("running in Turbo/Uncompressed mode"),ge=="IE"&&/\blike iPhone OS\b/.test(w)?(Te=te(w.replace(/like iPhone OS/,"")),pe=Te.manufacturer,$e=Te.product):/^iP/.test($e)?(ge||(ge="Safari"),Z="iOS"+((Te=/ OS ([\d_]+)/i.exec(w))?" "+Te[1].replace(/_/g,"."):"")):ge=="Konqueror"&&!/buntu/i.test(Z)?Z="Kubuntu":pe&&pe!="Google"&&(/Chrome/.test(ge)&&!/\bMobile Safari\b/i.test(w)||/\bVita\b/.test($e))||/\bAndroid\b/.test(Z)&&/^Chrome/.test(ge)&&/\bVersion\//i.test(w)?(ge="Android Browser",Z=/\bAndroid\b/.test(Z)?Z:"Android"):ge=="Silk"?(/\bMobi/i.test(w)||(Z="Android",Ye.unshift("desktop mode")),/Accelerated *= *true/i.test(w)&&Ye.unshift("accelerated")):ge=="PaleMoon"&&(Te=/\bFirefox\/([\d.]+)\b/.exec(w))?Ye.push("identifying as Firefox "+Te[1]):ge=="Firefox"&&(Te=/\b(Mobile|Tablet|TV)\b/i.exec(w))?(Z||(Z="Firefox OS"),$e||($e=Te[1])):!ge||(Te=!/\bMinefield\b/i.test(w)&&/\b(?:Firefox|Safari)\b/.exec(ge))?(ge&&!$e&&/[\/,]|^[^(]+?\)/.test(w.slice(w.indexOf(Te+"/")+8))&&(ge=null),(Te=$e||pe||Z)&&($e||pe||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(Z))&&(ge=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(Z)?Z:Te)+" Browser")):ge=="Electron"&&(Te=(/\bChrome\/([\d.]+)\b/.exec(w)||0)[1])&&Ye.push("Chromium "+Te),Be||(Be=rt(["(?:Cloud9|CriOS|CrMo|Edge|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$))","Version",W(ge),"(?:Firefox|Minefield|NetFront)"])),(Te=ve=="iCab"&&parseFloat(Be)>3&&"WebKit"||/\bOpera\b/.test(ge)&&(/\bOPR\b/.test(w)?"Blink":"Presto")||/\b(?:Midori|Nook|Safari)\b/i.test(w)&&!/^(?:Trident|EdgeHTML)$/.test(ve)&&"WebKit"||!ve&&/\bMSIE\b/i.test(w)&&(Z=="Mac OS"?"Tasman":"Trident")||ve=="WebKit"&&/\bPlayStation\b(?! Vita\b)/i.test(ge)&&"NetFront")&&(ve=[Te]),ge=="IE"&&(Te=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(w)||0)[1])?(ge+=" Mobile",Z="Windows Phone "+(/\+$/.test(Te)?Te:Te+".x"),Ye.unshift("desktop mode")):/\bWPDesktop\b/i.test(w)?(ge="IE Mobile",Z="Windows Phone 8.x",Ye.unshift("desktop mode"),Be||(Be=(/\brv:([\d.]+)/.exec(w)||0)[1])):ge!="IE"&&ve=="Trident"&&(Te=/\brv:([\d.]+)/.exec(w))&&(ge&&Ye.push("identifying as "+ge+(Be?" "+Be:"")),ge="IE",Be=Te[1]),ke){if(Y(X,"global"))if(de&&(Te=de.lang.System,nt=Te.getProperty("os.arch"),Z=Z||Te.getProperty("os.name")+" "+Te.getProperty("os.version")),ee){try{Be=X.require("ringo/engine").version.join("."),ge="RingoJS"}catch(Tt){(Te=X.system)&&Te.global.system==X.system&&(ge="Narwhal",Z||(Z=Te[0].os||null))}ge||(ge="Rhino")}else typeof X.process=="object"&&!X.process.browser&&(Te=X.process)&&(typeof Te.versions=="object"&&(typeof Te.versions.electron=="string"?(Ye.push("Node "+Te.versions.node),ge="Electron",Be=Te.versions.electron):typeof Te.versions.nw=="string"&&(Ye.push("Chromium "+Be,"Node "+Te.versions.node),ge="NW.js",Be=Te.versions.nw)),ge||(ge="Node.js",nt=Te.arch,Z=Te.platform,Be=/[\d.]+/.exec(Te.version),Be=Be?Be[0]:null));else K(Te=X.runtime)==j?(ge="Adobe AIR",Z=Te.flash.system.Capabilities.os):K(Te=X.phantom)==re?(ge="PhantomJS",Be=(Te=Te.version||null)&&Te.major+"."+Te.minor+"."+Te.patch):typeof Le.documentMode=="number"&&(Te=/\bTrident\/(\d+)/i.exec(w))?(Be=[Be,Le.documentMode],(Te=+Te[1]+4)!=Be[1]&&(Ye.push("IE "+Be[1]+" mode"),ve&&(ve[1]=""),Be[1]=Te),Be=ge=="IE"?String(Be[1].toFixed(1)):Be[0]):typeof Le.documentMode=="number"&&/^(?:Chrome|Firefox)\b/.test(ge)&&(Ye.push("masking as "+ge+" "+Be),ge="IE",Be="11.0",ve=["Trident"],Z="Windows");Z=Z&&J(Z)}if(Be&&(Te=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(Be)||/(?:alpha|beta)(?: ?\d)?/i.exec(w+";"+(ke&&he.appMinorVersion))||/\bMinefield\b/i.test(w)&&"a")&&(Pe=/b/i.test(Te)?"beta":"alpha",Be=Be.replace(RegExp(Te+"\\+?$"),"")+(Pe=="beta"?Ne:xe)+(/\d+\+?/.exec(Te)||"")),ge=="Fennec"||ge=="Firefox"&&/\b(?:Android|Firefox OS)\b/.test(Z))ge="Firefox Mobile";else if(ge=="Maxthon"&&Be)Be=Be.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test($e))$e=="Xbox 360"&&(Z=null),$e=="Xbox 360"&&/\bIEMobile\b/.test(w)&&Ye.unshift("mobile mode");else if((/^(?:Chrome|IE|Opera)$/.test(ge)||ge&&!$e&&!/Browser|Mobi/.test(ge))&&(Z=="Windows CE"||/Mobi/i.test(w)))ge+=" Mobile";else if(ge=="IE"&&ke)try{X.external===null&&Ye.unshift("platform preview")}catch(Tt){Ye.unshift("embedded")}else(/\bBlackBerry\b/.test($e)||/\bBB10\b/.test(w))&&(Te=(RegExp($e.replace(/ +/g," *")+"/([.\\d]+)","i").exec(w)||0)[1]||Be)?(Te=[Te,/BB10/.test(w)],Z=(Te[1]?($e=null,pe="BlackBerry"):"Device Software")+" "+Te[0],Be=null):this!=H&&$e!="Wii"&&(ke&&Ge||/Opera/.test(ge)&&/\b(?:MSIE|Firefox)\b/i.test(w)||ge=="Firefox"&&/\bOS X (?:\d+\.){2,}/.test(Z)||ge=="IE"&&(Z&&!/^Win/.test(Z)&&Be>5.5||/\bWindows XP\b/.test(Z)&&Be>8||Be==8&&!/\bTrident\b/.test(w)))&&!p.test(Te=te.call(H,w.replace(p,"")+";"))&&Te.name&&(Te="ing as "+Te.name+((Te=Te.version)?" "+Te:""),p.test(ge)?(/\bIE\b/.test(Te)&&Z=="Mac OS"&&(Z=null),Te="identify"+Te):(Te="mask"+Te,Qe?ge=J(Qe.replace(/([a-z])([A-Z])/g,"$1 $2")):ge="Opera",/\bIE\b/.test(Te)&&(Z=null),ke||(Be=null)),ve=["Presto"],Ye.push(Te));(Te=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(w)||0)[1])&&(Te=[parseFloat(Te.replace(/\.(\d)$/,".0$1")),Te],ge=="Safari"&&Te[1].slice(-1)=="+"?(ge="WebKit Nightly",Pe="alpha",Be=Te[1].slice(0,-1)):(Be==Te[1]||Be==(Te[2]=(/\bSafari\/([\d.]+\+?)/i.exec(w)||0)[1]))&&(Be=null),Te[1]=(/\bChrome\/([\d.]+)/i.exec(w)||0)[1],Te[0]==537.36&&Te[2]==537.36&&parseFloat(Te[1])>=28&&ve=="WebKit"&&(ve=["Blink"]),!ke||!se&&!Te[1]?(ve&&(ve[1]="like Safari"),Te=(Te=Te[0],Te<400?1:Te<500?2:Te<526?3:Te<533?4:Te<534?"4+":Te<535?5:Te<537?6:Te<538?7:Te<601?8:"8")):(ve&&(ve[1]="like Chrome"),Te=Te[1]||(Te=Te[0],Te<530?1:Te<532?2:Te<532.05?3:Te<533?4:Te<534.03?5:Te<534.07?6:Te<534.1?7:Te<534.13?8:Te<534.16?9:Te<534.24?10:Te<534.3?11:Te<535.01?12:Te<535.02?"13+":Te<535.07?15:Te<535.11?16:Te<535.19?17:Te<536.05?18:Te<536.1?19:Te<537.01?20:Te<537.11?"21+":Te<537.13?23:Te<537.18?24:Te<537.24?25:Te<537.36?26:ve!="Blink"?"27":"28")),ve&&(ve[1]+=" "+(Te+=typeof Te=="number"?".x":/[.+]/.test(Te)?"":"+")),ge=="Safari"&&(!Be||parseInt(Be)>45)&&(Be=Te)),ge=="Opera"&&(Te=/\bzbov|zvav$/.exec(Z))?(ge+=" ",Ye.unshift("desktop mode"),Te=="zvav"?(ge+="Mini",Be=null):ge+="Mobile",Z=Z.replace(RegExp(" *"+Te+"$"),"")):ge=="Safari"&&/\bChrome\b/.exec(ve&&ve[1])&&(Ye.unshift("desktop mode"),ge="Chrome Mobile",Be=null,/\bOS X\b/.test(Z)?(pe="Apple",Z="iOS 4.3+"):Z=null),Be&&Be.indexOf(Te=/[\d.]+$/.exec(Z))==0&&w.indexOf("/"+Te+"-")>-1&&(Z=_(Z.replace(Te,""))),ve&&!/\b(?:Avant|Nook)\b/.test(ge)&&(/Browser|Lunascape|Maxthon/.test(ge)||ge!="Safari"&&/^iOS/.test(Z)&&/\bSafari\b/.test(ve[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|Web)/.test(ge)&&ve[1])&&((Te=ve[ve.length-1])&&Ye.push(Te)),Ye.length&&(Ye=["("+Ye.join("; ")+")"]),pe&&$e&&$e.indexOf(pe)<0&&Ye.push("on "+pe),$e&&Ye.push((/^on /.test(Ye[Ye.length-1])?"":"on ")+$e),Z&&(Te=/ ([\d.+]+)$/.exec(Z),ot=Te&&Z.charAt(Z.length-Te[0].length-1)=="/",Z={architecture:32,family:Te&&!ot?Z.replace(Te[0],""):Z,version:Te?Te[1]:null,toString:function(){var Tt=this.version;return this.family+(Tt&&!ot?" "+Tt:"")+(this.architecture==64?" 64-bit":"")}}),(Te=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(nt))&&!/\bi686\b/i.test(nt)?(Z&&(Z.architecture=64,Z.family=Z.family.replace(RegExp(" *"+Te),"")),ge&&(/\bWOW64\b/i.test(w)||ke&&/\w(?:86|32)$/.test(he.cpuClass||he.platform)&&!/\bWin64; x64\b/i.test(w))&&Ye.unshift("32-bit")):Z&&/^OS X/.test(Z.family)&&ge=="Chrome"&&parseFloat(Be)>=39&&(Z.architecture=64),w||(w=null);var bt={};return bt.description=w,bt.layout=ve&&ve[0],bt.manufacturer=pe,bt.name=ge,bt.prerelease=Pe,bt.product=$e,bt.ua=w,bt.version=ge&&Be,bt.os=Z||{architecture:null,family:null,version:null,toString:function(){return"null"}},bt.parse=te,bt.toString=lt,bt.version&&Ye.unshift(Be),bt.name&&Ye.unshift(ge),Z&&ge&&!(Z==String(Z).split(" ")[0]&&(Z==ge.split(" ")[0]||$e))&&Ye.push($e?"("+Z+")":"on "+Z),Ye.length&&(bt.description=Ye.join(" ")),bt}var q=te();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(M.platform=q,define(function(){return q})):A&&x?H(q,function(w,X){A[X]=w}):M.platform=q}).call(this)}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],207:[function(d,V,O){(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?V.exports={nextTick:l}:V.exports=y;function l(M,D,A,x){if(typeof M!="function")throw new TypeError('"callback" argument must be a function');var v=arguments.length,h,p;switch(v){case 0:case 1:return y.nextTick(M);case 2:return y.nextTick(function(){M.call(null,D)});case 3:return y.nextTick(function(){M.call(null,D,A)});case 4:return y.nextTick(function(){M.call(null,D,A,x)});default:for(h=new Array(v-1),p=0;p<h.length;)h[p++]=arguments[p];return y.nextTick(function(){M.apply(null,h)})}}}).call(this,d("_process"))},{_process:208}],208:[function(d,V,O){var y=V.exports={},l,M;function D(){throw new Error("setTimeout has not been defined")}function A(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?l=setTimeout:l=D}catch(F){l=D}try{typeof clearTimeout=="function"?M=clearTimeout:M=A}catch(F){M=A}})();function x(F){if(l===setTimeout)return setTimeout(F,0);if((l===D||!l)&&setTimeout)return l=setTimeout,setTimeout(F,0);try{return l(F,0)}catch(J){try{return l.call(null,F,0)}catch(H){return l.call(this,F,0)}}}function v(F){if(M===clearTimeout)return clearTimeout(F);if((M===A||!M)&&clearTimeout)return M=clearTimeout,clearTimeout(F);try{return M(F)}catch(J){try{return M.call(null,F)}catch(H){return M.call(this,F)}}}var h=[],p=!1,c,m=-1;function C(){if(!p||!c)return;p=!1,c.length?h=c.concat(h):m=-1,h.length&&g()}function g(){if(p)return;var F=x(C);p=!0;for(var J=h.length;J;){for(c=h,h=[];++m<J;)c&&c[m].run();m=-1,J=h.length}c=null,p=!1,v(F)}y.nextTick=function(F){var J=new Array(arguments.length-1);if(arguments.length>1)for(var H=1;H<arguments.length;H++)J[H-1]=arguments[H];h.push(new T(F,J)),h.length===1&&!p&&x(g)};function T(F,J){this.fun=F,this.array=J}T.prototype.run=function(){this.fun.apply(null,this.array)},y.title="browser",y.browser=!0,y.env={},y.argv=[],y.version="",y.versions={};function B(){}y.on=B,y.addListener=B,y.once=B,y.off=B,y.removeListener=B,y.removeAllListeners=B,y.emit=B,y.prependListener=B,y.prependOnceListener=B,y.listeners=function(F){return[]},y.binding=function(F){throw new Error("process.binding is not supported")},y.cwd=function(){return"/"},y.chdir=function(F){throw new Error("process.chdir is not supported")},y.umask=function(){return 0}},{}],209:[function(d,V,O){(function(y){/*! https://mths.be/punycode v1.4.1 by @mathias */(function(l){var M=typeof O=="object"&&O&&!O.nodeType&&O,D=typeof V=="object"&&V&&!V.nodeType&&V,A=typeof y=="object"&&y;(A.global===A||A.window===A||A.self===A)&&(l=A);var x,v=2147483647,h=36,p=1,c=26,m=38,C=700,g=72,T=128,B="-",F=/^xn--/,J=/[^\x20-\x7E]/,H=/[\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"},Y=h-p,W=Math.floor,U=String.fromCharCode,_;function te(L){throw new RangeError(K[L])}function q(L,re){for(var de=L.length,ee=[];de--;)ee[de]=re(L[de]);return ee}function w(L,re){var de=L.split("@"),ee="";de.length>1&&(ee=de[0]+"@",L=de[1]),L=L.replace(H,".");var xe=L.split("."),Ne=q(xe,re).join(".");return ee+Ne}function X(L){for(var re=[],de=0,ee=L.length,xe,Ne;de<ee;)xe=L.charCodeAt(de++),xe>=55296&&xe<=56319&&de<ee?(Ne=L.charCodeAt(de++),(Ne&64512)==56320?re.push(((xe&1023)<<10)+(Ne&1023)+65536):(re.push(xe),de--)):re.push(xe);return re}function ne(L){return q(L,function(re){var de="";return re>65535&&(re-=65536,de+=U(re>>>10&1023|55296),re=56320|re&1023),de+=U(re),de}).join("")}function he(L){return L-48<10?L-22:L-65<26?L-65:L-97<26?L-97:h}function le(L,re){return L+22+75*(L<26)-((re!=0)<<5)}function _e(L,re,de){var ee=0;for(L=de?W(L/C):L>>1,L+=W(L/re);L>Y*c>>1;ee+=h)L=W(L/Y);return W(ee+(Y+1)*L/(L+m))}function se(L){var re=[],de=L.length,ee,xe=0,Ne=T,Le=g,Ge,Qe,Te,nt,Ye,Pe,ke,Be,ot;for(Ge=L.lastIndexOf(B),Ge<0&&(Ge=0),Qe=0;Qe<Ge;++Qe)L.charCodeAt(Qe)>=128&&te("not-basic"),re.push(L.charCodeAt(Qe));for(Te=Ge>0?Ge+1:0;Te<de;){for(nt=xe,Ye=1,Pe=h;!(Te>=de&&te("invalid-input"),ke=he(L.charCodeAt(Te++)),(ke>=h||ke>W((v-xe)/Ye))&&te("overflow"),xe+=ke*Ye,Be=Pe<=Le?p:Pe>=Le+c?c:Pe-Le,ke<Be);Pe+=h)ot=h-Be,Ye>W(v/ot)&&te("overflow"),Ye*=ot;ee=re.length+1,Le=_e(xe-nt,ee,nt==0),W(xe/ee)>v-Ne&&te("overflow"),Ne+=W(xe/ee),xe%=ee,re.splice(xe++,0,Ne)}return ne(re)}function be(L){var re,de,ee,xe,Ne,Le,Ge,Qe,Te,nt,Ye,Pe=[],ke,Be,ot,ve;for(L=X(L),ke=L.length,re=T,de=0,Ne=g,Le=0;Le<ke;++Le)Ye=L[Le],Ye<128&&Pe.push(U(Ye));for(ee=xe=Pe.length,xe&&Pe.push(B);ee<ke;){for(Ge=v,Le=0;Le<ke;++Le)Ye=L[Le],Ye>=re&&Ye<Ge&&(Ge=Ye);for(Be=ee+1,Ge-re>W((v-de)/Be)&&te("overflow"),de+=(Ge-re)*Be,re=Ge,Le=0;Le<ke;++Le)if(Ye=L[Le],Ye<re&&++de>v&&te("overflow"),Ye==re){for(Qe=de,Te=h;!(nt=Te<=Ne?p:Te>=Ne+c?c:Te-Ne,Qe<nt);Te+=h)ve=Qe-nt,ot=h-nt,Pe.push(U(le(nt+ve%ot,0))),Qe=W(ve/ot);Pe.push(U(le(Qe,0))),Ne=_e(de,Be,ee==xe),de=0,++ee}++de,++re}return Pe.join("")}function j(L){return w(L,function(re){return F.test(re)?se(re.slice(4).toLowerCase()):re})}function Q(L){return w(L,function(re){return J.test(re)?"xn--"+be(re):re})}if(x={version:"1.4.1",ucs2:{decode:X,encode:ne},decode:se,encode:be,toASCII:Q,toUnicode:j},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return x});else if(M&&D)if(V.exports==M)D.exports=x;else for(_ in x)x.hasOwnProperty(_)&&(M[_]=x[_]);else l.punycode=x})(this)}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],210:[function(d,V,O){"use strict";function y(M,D){return Object.prototype.hasOwnProperty.call(M,D)}V.exports=function(M,D,A,x){D=D||"&",A=A||"=";var v={};if(typeof M!="string"||M.length===0)return v;var h=/\+/g;M=M.split(D);var p=1e3;x&&typeof x.maxKeys=="number"&&(p=x.maxKeys);var c=M.length;p>0&&c>p&&(c=p);for(var m=0;m<c;++m){var C=M[m].replace(h,"%20"),g=C.indexOf(A),T,B,F,J;g>=0?(T=C.substr(0,g),B=C.substr(g+1)):(T=C,B=""),F=decodeURIComponent(T),J=decodeURIComponent(B),y(v,F)?l(v[F])?v[F].push(J):v[F]=[v[F],J]:v[F]=J}return v};var l=Array.isArray||function(M){return Object.prototype.toString.call(M)==="[object Array]"}},{}],211:[function(d,V,O){"use strict";var y=function(A){switch(typeof A){case"string":return A;case"boolean":return A?"true":"false";case"number":return isFinite(A)?A:"";default:return""}};V.exports=function(A,x,v,h){return x=x||"&",v=v||"=",A===null&&(A=void 0),typeof A=="object"?M(D(A),function(p){var c=encodeURIComponent(y(p))+v;return l(A[p])?M(A[p],function(m){return c+encodeURIComponent(y(m))}).join(x):c+encodeURIComponent(y(A[p]))}).join(x):h?encodeURIComponent(y(h))+v+encodeURIComponent(y(A)):""};var l=Array.isArray||function(A){return Object.prototype.toString.call(A)==="[object Array]"};function M(A,x){if(A.map)return A.map(x);for(var v=[],h=0;h<A.length;h++)v.push(x(A[h],h));return v}var D=Object.keys||function(A){var x=[];for(var v in A)Object.prototype.hasOwnProperty.call(A,v)&&x.push(v);return x}},{}],212:[function(d,V,O){"use strict";O.decode=O.parse=d("./decode"),O.encode=O.stringify=d("./encode")},{"./decode":210,"./encode":211}],213:[function(d,V,O){V.exports=d("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":214}],214:[function(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/create"),l=A(y),M=d("babel-runtime/core-js/object/keys"),D=A(M);function A(J){return J&&J.__esModule?J:{default:J}}var x=d("process-nextick-args"),v=D.default||function(J){var H=[];for(var K in J)H.push(K);return H};V.exports=T;var h=(0,l.default)(d("core-util-is"));h.inherits=d("inherits");var p=d("./_stream_readable"),c=d("./_stream_writable");h.inherits(T,p);for(var m=v(c.prototype),C=0;C<m.length;C++){var g=m[C];T.prototype[g]||(T.prototype[g]=c.prototype[g])}function T(J){if(!(this instanceof T))return new T(J);p.call(this,J),c.call(this,J),J&&J.readable===!1&&(this.readable=!1),J&&J.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,J&&J.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",B)}Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function B(){if(this.allowHalfOpen||this._writableState.ended)return;x.nextTick(F,this)}function F(J){J.end()}Object.defineProperty(T.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(H){if(this._readableState===void 0||this._writableState===void 0)return;this._readableState.destroyed=H,this._writableState.destroyed=H}}),T.prototype._destroy=function(J,H){this.push(null),this.end(),x.nextTick(H,J)}},{"./_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(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/create"),l=M(y);function M(v){return v&&v.__esModule?v:{default:v}}V.exports=x;var D=d("./_stream_transform"),A=(0,l.default)(d("core-util-is"));A.inherits=d("inherits"),A.inherits(x,D);function x(v){if(!(this instanceof x))return new x(v);D.call(this,v)}x.prototype._transform=function(v,h,p){p(null,v)}},{"./_stream_transform":217,"babel-runtime/core-js/object/create":55,"core-util-is":189,inherits:196}],216:[function(d,V,O){(function(y,l){"use strict";var M=d("babel-runtime/core-js/object/get-prototype-of"),D=v(M),A=d("babel-runtime/core-js/object/create"),x=v(A);function v(ve){return ve&&ve.__esModule?ve:{default:ve}}var h=d("process-nextick-args");V.exports=X;var p=d("isarray"),c;X.ReadableState=w;var m=d("events").EventEmitter,C=function(ge,$e){return ge.listeners($e).length},g=d("./internal/streams/stream"),T=d("safe-buffer").Buffer,B=l.Uint8Array||function(){};function F(ve){return T.from(ve)}function J(ve){return T.isBuffer(ve)||ve instanceof B}var H=(0,x.default)(d("core-util-is"));H.inherits=d("inherits");var K=d("util"),Y=void 0;K&&K.debuglog?Y=K.debuglog("stream"):Y=function(){};var W=d("./internal/streams/BufferList"),U=d("./internal/streams/destroy"),_;H.inherits(X,g);var te=["error","close","destroy","pause","resume"];function q(ve,ge,$e){if(typeof ve.prependListener=="function")return ve.prependListener(ge,$e);!ve._events||!ve._events[ge]?ve.on(ge,$e):p(ve._events[ge])?ve._events[ge].unshift($e):ve._events[ge]=[$e,ve._events[ge]]}function w(ve,ge){c=c||d("./_stream_duplex"),ve=ve||{};var $e=ge instanceof c;this.objectMode=!!ve.objectMode,$e&&(this.objectMode=this.objectMode||!!ve.readableObjectMode);var pe=ve.highWaterMark,Z=ve.readableHighWaterMark,k=this.objectMode?16:16*1024;pe||pe===0?this.highWaterMark=pe:$e&&(Z||Z===0)?this.highWaterMark=Z:this.highWaterMark=k,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new W,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=ve.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,ve.encoding&&(_||(_=d("string_decoder/").StringDecoder),this.decoder=new _(ve.encoding),this.encoding=ve.encoding)}function X(ve){if(c=c||d("./_stream_duplex"),!(this instanceof X))return new X(ve);this._readableState=new w(ve,this),this.readable=!0,ve&&(typeof ve.read=="function"&&(this._read=ve.read),typeof ve.destroy=="function"&&(this._destroy=ve.destroy)),g.call(this)}Object.defineProperty(X.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(ge){if(!this._readableState)return;this._readableState.destroyed=ge}}),X.prototype.destroy=U.destroy,X.prototype._undestroy=U.undestroy,X.prototype._destroy=function(ve,ge){this.push(null),ge(ve)},X.prototype.push=function(ve,ge){var $e=this._readableState,pe;return $e.objectMode?pe=!0:typeof ve=="string"&&(ge=ge||$e.defaultEncoding,ge!==$e.encoding&&(ve=T.from(ve,ge),ge=""),pe=!0),ne(this,ve,ge,!1,pe)},X.prototype.unshift=function(ve){return ne(this,ve,null,!0,!1)};function ne(ve,ge,$e,pe,Z){var k=ve._readableState;if(ge===null)k.reading=!1,Q(ve,k);else{var $;Z||($=le(k,ge)),$?ve.emit("error",$):k.objectMode||ge&&ge.length>0?(typeof ge!="string"&&!k.objectMode&&(0,D.default)(ge)!==T.prototype&&(ge=F(ge)),pe?k.endEmitted?ve.emit("error",new Error("stream.unshift() after end event")):he(ve,k,ge,!0):k.ended?ve.emit("error",new Error("stream.push() after EOF")):(k.reading=!1,k.decoder&&!$e?(ge=k.decoder.write(ge),k.objectMode||ge.length!==0?he(ve,k,ge,!1):de(ve,k)):he(ve,k,ge,!1))):pe||(k.reading=!1)}return _e(k)}function he(ve,ge,$e,pe){ge.flowing&&ge.length===0&&!ge.sync?(ve.emit("data",$e),ve.read(0)):(ge.length+=ge.objectMode?1:$e.length,pe?ge.buffer.unshift($e):ge.buffer.push($e),ge.needReadable&&L(ve)),de(ve,ge)}function le(ve,ge){var $e;return!J(ge)&&typeof ge!="string"&&ge!==void 0&&!ve.objectMode&&($e=new TypeError("Invalid non-string/buffer chunk")),$e}function _e(ve){return!ve.ended&&(ve.needReadable||ve.length<ve.highWaterMark||ve.length===0)}X.prototype.isPaused=function(){return this._readableState.flowing===!1},X.prototype.setEncoding=function(ve){return _||(_=d("string_decoder/").StringDecoder),this._readableState.decoder=new _(ve),this._readableState.encoding=ve,this};var se=8388608;function be(ve){return ve>=se?ve=se:(ve--,ve|=ve>>>1,ve|=ve>>>2,ve|=ve>>>4,ve|=ve>>>8,ve|=ve>>>16,ve++),ve}function j(ve,ge){return ve<=0||ge.length===0&&ge.ended?0:ge.objectMode?1:ve!==ve?ge.flowing&&ge.length?ge.buffer.head.data.length:ge.length:(ve>ge.highWaterMark&&(ge.highWaterMark=be(ve)),ve<=ge.length?ve:ge.ended?ge.length:(ge.needReadable=!0,0))}X.prototype.read=function(ve){Y("read",ve),ve=parseInt(ve,10);var ge=this._readableState,$e=ve;if(ve!==0&&(ge.emittedReadable=!1),ve===0&&ge.needReadable&&(ge.length>=ge.highWaterMark||ge.ended))return Y("read: emitReadable",ge.length,ge.ended),ge.length===0&&ge.ended?ke(this):L(this),null;if(ve=j(ve,ge),ve===0&&ge.ended)return ge.length===0&&ke(this),null;var pe=ge.needReadable;Y("need readable",pe),(ge.length===0||ge.length-ve<ge.highWaterMark)&&(pe=!0,Y("length less than watermark",pe)),ge.ended||ge.reading?(pe=!1,Y("reading or ended",pe)):pe&&(Y("do read"),ge.reading=!0,ge.sync=!0,ge.length===0&&(ge.needReadable=!0),this._read(ge.highWaterMark),ge.sync=!1,ge.reading||(ve=j($e,ge)));var Z;return ve>0?Z=Te(ve,ge):Z=null,Z===null?(ge.needReadable=!0,ve=0):ge.length-=ve,ge.length===0&&(ge.ended||(ge.needReadable=!0),$e!==ve&&ge.ended&&ke(this)),Z!==null&&this.emit("data",Z),Z};function Q(ve,ge){if(ge.ended)return;if(ge.decoder){var $e=ge.decoder.end();$e&&$e.length&&(ge.buffer.push($e),ge.length+=ge.objectMode?1:$e.length)}ge.ended=!0,L(ve)}function L(ve){var ge=ve._readableState;ge.needReadable=!1,ge.emittedReadable||(Y("emitReadable",ge.flowing),ge.emittedReadable=!0,ge.sync?h.nextTick(re,ve):re(ve))}function re(ve){Y("emit readable"),ve.emit("readable"),Qe(ve)}function de(ve,ge){ge.readingMore||(ge.readingMore=!0,h.nextTick(ee,ve,ge))}function ee(ve,ge){for(var $e=ge.length;!ge.reading&&!ge.flowing&&!ge.ended&&ge.length<ge.highWaterMark&&!(Y("maybeReadMore read 0"),ve.read(0),$e===ge.length);)$e=ge.length;ge.readingMore=!1}X.prototype._read=function(ve){this.emit("error",new Error("_read() is not implemented"))},X.prototype.pipe=function(ve,ge){var $e=this,pe=this._readableState;switch(pe.pipesCount){case 0:pe.pipes=ve;break;case 1:pe.pipes=[pe.pipes,ve];break;default:pe.pipes.push(ve);break}pe.pipesCount+=1,Y("pipe count=%d opts=%j",pe.pipesCount,ge);var Z=(!ge||ge.end!==!1)&&ve!==y.stdout&&ve!==y.stderr,k=Z?Re:Nt;pe.endEmitted?h.nextTick(k):$e.once("end",k),ve.on("unpipe",$);function $(at,Bt){Y("onunpipe"),at===$e&&(Bt&&Bt.hasUnpiped===!1&&(Bt.hasUnpiped=!0,rt()))}function Re(){Y("onend"),ve.end()}var Ae=xe($e);ve.on("drain",Ae);var Xe=!1;function rt(){Y("cleanup"),ve.removeListener("close",xt),ve.removeListener("finish",Et),ve.removeListener("drain",Ae),ve.removeListener("error",Tt),ve.removeListener("unpipe",$),$e.removeListener("end",Re),$e.removeListener("end",Nt),$e.removeListener("data",bt),Xe=!0,pe.awaitDrain&&(!ve._writableState||ve._writableState.needDrain)&&Ae()}var lt=!1;$e.on("data",bt);function bt(at){Y("ondata"),lt=!1;var Bt=ve.write(at);Bt===!1&&!lt&&((pe.pipesCount===1&&pe.pipes===ve||pe.pipesCount>1&&ot(pe.pipes,ve)!==-1)&&!Xe&&(Y("false write response, pause",$e._readableState.awaitDrain),$e._readableState.awaitDrain++,lt=!0),$e.pause())}function Tt(at){Y("onerror",at),Nt(),ve.removeListener("error",Tt),C(ve,"error")===0&&ve.emit("error",at)}q(ve,"error",Tt);function xt(){ve.removeListener("finish",Et),Nt()}ve.once("close",xt);function Et(){Y("onfinish"),ve.removeListener("close",xt),Nt()}ve.once("finish",Et);function Nt(){Y("unpipe"),$e.unpipe(ve)}return ve.emit("pipe",$e),pe.flowing||(Y("pipe resume"),$e.resume()),ve};function xe(ve){return function(){var ge=ve._readableState;Y("pipeOnDrain",ge.awaitDrain),ge.awaitDrain&&ge.awaitDrain--,ge.awaitDrain===0&&C(ve,"data")&&(ge.flowing=!0,Qe(ve))}}X.prototype.unpipe=function(ve){var ge=this._readableState,$e={hasUnpiped:!1};if(ge.pipesCount===0)return this;if(ge.pipesCount===1)return ve&&ve!==ge.pipes?this:(ve||(ve=ge.pipes),ge.pipes=null,ge.pipesCount=0,ge.flowing=!1,ve&&ve.emit("unpipe",this,$e),this);if(!ve){var pe=ge.pipes,Z=ge.pipesCount;ge.pipes=null,ge.pipesCount=0,ge.flowing=!1;for(var k=0;k<Z;k++)pe[k].emit("unpipe",this,$e);return this}var $=ot(ge.pipes,ve);return $===-1?this:(ge.pipes.splice($,1),ge.pipesCount-=1,ge.pipesCount===1&&(ge.pipes=ge.pipes[0]),ve.emit("unpipe",this,$e),this)},X.prototype.on=function(ve,ge){var $e=g.prototype.on.call(this,ve,ge);if(ve==="data")this._readableState.flowing!==!1&&this.resume();else if(ve==="readable"){var pe=this._readableState;!pe.endEmitted&&!pe.readableListening&&(pe.readableListening=pe.needReadable=!0,pe.emittedReadable=!1,pe.reading?pe.length&&L(this):h.nextTick(Ne,this))}return $e},X.prototype.addListener=X.prototype.on;function Ne(ve){Y("readable nexttick read 0"),ve.read(0)}X.prototype.resume=function(){var ve=this._readableState;return ve.flowing||(Y("resume"),ve.flowing=!0,Le(this,ve)),this};function Le(ve,ge){ge.resumeScheduled||(ge.resumeScheduled=!0,h.nextTick(Ge,ve,ge))}function Ge(ve,ge){ge.reading||(Y("resume read 0"),ve.read(0)),ge.resumeScheduled=!1,ge.awaitDrain=0,ve.emit("resume"),Qe(ve),ge.flowing&&!ge.reading&&ve.read(0)}X.prototype.pause=function(){return Y("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Y("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function Qe(ve){var ge=ve._readableState;for(Y("flow",ge.flowing);ge.flowing&&ve.read()!==null;);}X.prototype.wrap=function(ve){var ge=this,$e=this._readableState,pe=!1;ve.on("end",function(){if(Y("wrapped end"),$e.decoder&&!$e.ended){var $=$e.decoder.end();$&&$.length&&ge.push($)}ge.push(null)}),ve.on("data",function($){if(Y("wrapped data"),$e.decoder&&($=$e.decoder.write($)),$e.objectMode&&$==null)return;if(!$e.objectMode&&(!$||!$.length))return;var Re=ge.push($);Re||(pe=!0,ve.pause())});for(var Z in ve)this[Z]===void 0&&typeof ve[Z]=="function"&&(this[Z]=function($){return function(){return ve[$].apply(ve,arguments)}}(Z));for(var k=0;k<te.length;k++)ve.on(te[k],this.emit.bind(this,te[k]));return this._read=function($){Y("wrapped _read",$),pe&&(pe=!1,ve.resume())},this},Object.defineProperty(X.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),X._fromList=Te;function Te(ve,ge){if(ge.length===0)return null;var $e;return ge.objectMode?$e=ge.buffer.shift():!ve||ve>=ge.length?(ge.decoder?$e=ge.buffer.join(""):ge.buffer.length===1?$e=ge.buffer.head.data:$e=ge.buffer.concat(ge.length),ge.buffer.clear()):$e=nt(ve,ge.buffer,ge.decoder),$e}function nt(ve,ge,$e){var pe;return ve<ge.head.data.length?(pe=ge.head.data.slice(0,ve),ge.head.data=ge.head.data.slice(ve)):ve===ge.head.data.length?pe=ge.shift():pe=$e?Ye(ve,ge):Pe(ve,ge),pe}function Ye(ve,ge){var $e=ge.head,pe=1,Z=$e.data;for(ve-=Z.length;$e=$e.next;){var k=$e.data,$=ve>k.length?k.length:ve;if($===k.length?Z+=k:Z+=k.slice(0,ve),ve-=$,ve===0){$===k.length?(++pe,$e.next?ge.head=$e.next:ge.head=ge.tail=null):(ge.head=$e,$e.data=k.slice($));break}++pe}return ge.length-=pe,Z}function Pe(ve,ge){var $e=T.allocUnsafe(ve),pe=ge.head,Z=1;for(pe.data.copy($e),ve-=pe.data.length;pe=pe.next;){var k=pe.data,$=ve>k.length?k.length:ve;if(k.copy($e,$e.length-ve,0,$),ve-=$,ve===0){$===k.length?(++Z,pe.next?ge.head=pe.next:ge.head=ge.tail=null):(ge.head=pe,pe.data=k.slice($));break}++Z}return ge.length-=Z,$e}function ke(ve){var ge=ve._readableState;if(ge.length>0)throw new Error('"endReadable()" called on non-empty stream');ge.endEmitted||(ge.ended=!0,h.nextTick(Be,ge,ve))}function Be(ve,ge){!ve.endEmitted&&ve.length===0&&(ve.endEmitted=!0,ge.readable=!1,ge.emit("end"))}function ot(ve,ge){for(var $e=0,pe=ve.length;$e<pe;$e++)if(ve[$e]===ge)return $e;return-1}}).call(this,d("_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(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/create"),l=M(y);function M(c){return c&&c.__esModule?c:{default:c}}V.exports=v;var D=d("./_stream_duplex"),A=(0,l.default)(d("core-util-is"));A.inherits=d("inherits"),A.inherits(v,D);function x(c,m){var C=this._transformState;C.transforming=!1;var g=C.writecb;if(!g)return this.emit("error",new Error("write callback called multiple times"));C.writechunk=null,C.writecb=null,m!=null&&this.push(m),g(c);var T=this._readableState;T.reading=!1,(T.needReadable||T.length<T.highWaterMark)&&this._read(T.highWaterMark)}function v(c){if(!(this instanceof v))return new v(c);D.call(this,c),this._transformState={afterTransform:x.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,c&&(typeof c.transform=="function"&&(this._transform=c.transform),typeof c.flush=="function"&&(this._flush=c.flush)),this.on("prefinish",h)}function h(){var c=this;typeof this._flush=="function"?this._flush(function(m,C){p(c,m,C)}):p(this,null,null)}v.prototype.push=function(c,m){return this._transformState.needTransform=!1,D.prototype.push.call(this,c,m)},v.prototype._transform=function(c,m,C){throw new Error("_transform() is not implemented")},v.prototype._write=function(c,m,C){var g=this._transformState;if(g.writecb=C,g.writechunk=c,g.writeencoding=m,!g.transforming){var T=this._readableState;(g.needTransform||T.needReadable||T.length<T.highWaterMark)&&this._read(T.highWaterMark)}},v.prototype._read=function(c){var m=this._transformState;m.writechunk!==null&&m.writecb&&!m.transforming?(m.transforming=!0,this._transform(m.writechunk,m.writeencoding,m.afterTransform)):m.needTransform=!0},v.prototype._destroy=function(c,m){var C=this;D.prototype._destroy.call(this,c,function(g){m(g),C.emit("close")})};function p(c,m,C){if(m)return c.emit("error",m);if(C!=null&&c.push(C),c._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(c._transformState.transforming)throw new Error("Calling transform done when still transforming");return c.push(null)}},{"./_stream_duplex":214,"babel-runtime/core-js/object/create":55,"core-util-is":189,inherits:196}],218:[function(d,V,O){(function(y,l){"use strict";var M=d("babel-runtime/core-js/object/define-property"),D=g(M),A=d("babel-runtime/core-js/symbol/has-instance"),x=g(A),v=d("babel-runtime/core-js/symbol"),h=g(v),p=d("babel-runtime/core-js/object/create"),c=g(p),m=d("babel-runtime/core-js/set-immediate"),C=g(m);function g(Pe){return Pe&&Pe.__esModule?Pe:{default:Pe}}var T=d("process-nextick-args");V.exports=le;function B(Pe,ke,Be){this.chunk=Pe,this.encoding=ke,this.callback=Be,this.next=null}function F(Pe){var ke=this;this.next=null,this.entry=null,this.finish=function(){Ye(ke,Pe)}}var J=!y.browser&&["v0.10","v0.9."].indexOf(y.version.slice(0,5))>-1?C.default:T.nextTick,H;le.WritableState=ne;var K=(0,c.default)(d("core-util-is"));K.inherits=d("inherits");var Y={deprecate:d("util-deprecate")},W=d("./internal/streams/stream"),U=d("safe-buffer").Buffer,_=l.Uint8Array||function(){};function te(Pe){return U.from(Pe)}function q(Pe){return U.isBuffer(Pe)||Pe instanceof _}var w=d("./internal/streams/destroy");K.inherits(le,W);function X(){}function ne(Pe,ke){H=H||d("./_stream_duplex"),Pe=Pe||{};var Be=ke instanceof H;this.objectMode=!!Pe.objectMode,Be&&(this.objectMode=this.objectMode||!!Pe.writableObjectMode);var ot=Pe.highWaterMark,ve=Pe.writableHighWaterMark,ge=this.objectMode?16:16*1024;ot||ot===0?this.highWaterMark=ot:Be&&(ve||ve===0)?this.highWaterMark=ve:this.highWaterMark=ge,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 $e=Pe.decodeStrings===!1;this.decodeStrings=!$e,this.defaultEncoding=Pe.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(pe){de(ke,pe)},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 F(this)}ne.prototype.getBuffer=function(){for(var ke=this.bufferedRequest,Be=[];ke;)Be.push(ke),ke=ke.next;return Be},function(){try{Object.defineProperty(ne.prototype,"buffer",{get:Y.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(Pe){}}();var he;typeof h.default=="function"&&x.default&&typeof Function.prototype[x.default]=="function"?(he=Function.prototype[x.default],(0,D.default)(le,x.default,{value:function(ke){return he.call(this,ke)?!0:this!==le?!1:ke&&ke._writableState instanceof ne}})):he=function(ke){return ke instanceof this};function le(Pe){if(H=H||d("./_stream_duplex"),!he.call(le,this)&&!(this instanceof H))return new le(Pe);this._writableState=new ne(Pe,this),this.writable=!0,Pe&&(typeof Pe.write=="function"&&(this._write=Pe.write),typeof Pe.writev=="function"&&(this._writev=Pe.writev),typeof Pe.destroy=="function"&&(this._destroy=Pe.destroy),typeof Pe.final=="function"&&(this._final=Pe.final)),W.call(this)}le.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function _e(Pe,ke){var Be=new Error("write after end");Pe.emit("error",Be),T.nextTick(ke,Be)}function se(Pe,ke,Be,ot){var ve=!0,ge=!1;return Be===null?ge=new TypeError("May not write null values to stream"):typeof Be!="string"&&Be!==void 0&&!ke.objectMode&&(ge=new TypeError("Invalid non-string/buffer chunk")),ge&&(Pe.emit("error",ge),T.nextTick(ot,ge),ve=!1),ve}le.prototype.write=function(Pe,ke,Be){var ot=this._writableState,ve=!1,ge=!ot.objectMode&&q(Pe);return ge&&!U.isBuffer(Pe)&&(Pe=te(Pe)),typeof ke=="function"&&(Be=ke,ke=null),ge?ke="buffer":ke||(ke=ot.defaultEncoding),typeof Be!="function"&&(Be=X),ot.ended?_e(this,Be):(ge||se(this,ot,Pe,Be))&&(ot.pendingcb++,ve=j(this,ot,ge,Pe,ke,Be)),ve},le.prototype.cork=function(){var Pe=this._writableState;Pe.corked++},le.prototype.uncork=function(){var Pe=this._writableState;Pe.corked&&(Pe.corked--,!Pe.writing&&!Pe.corked&&!Pe.finished&&!Pe.bufferProcessing&&Pe.bufferedRequest&&Ne(this,Pe))},le.prototype.setDefaultEncoding=function(ke){if(typeof ke=="string"&&(ke=ke.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((ke+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+ke);return this._writableState.defaultEncoding=ke,this};function be(Pe,ke,Be){return!Pe.objectMode&&Pe.decodeStrings!==!1&&typeof ke=="string"&&(ke=U.from(ke,Be)),ke}Object.defineProperty(le.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function j(Pe,ke,Be,ot,ve,ge){if(!Be){var $e=be(ke,ot,ve);ot!==$e&&(Be=!0,ve="buffer",ot=$e)}var pe=ke.objectMode?1:ot.length;ke.length+=pe;var Z=ke.length<ke.highWaterMark;if(Z||(ke.needDrain=!0),ke.writing||ke.corked){var k=ke.lastBufferedRequest;ke.lastBufferedRequest={chunk:ot,encoding:ve,isBuf:Be,callback:ge,next:null},k?k.next=ke.lastBufferedRequest:ke.bufferedRequest=ke.lastBufferedRequest,ke.bufferedRequestCount+=1}else Q(Pe,ke,!1,pe,ot,ve,ge);return Z}function Q(Pe,ke,Be,ot,ve,ge,$e){ke.writelen=ot,ke.writecb=$e,ke.writing=!0,ke.sync=!0,Be?Pe._writev(ve,ke.onwrite):Pe._write(ve,ge,ke.onwrite),ke.sync=!1}function L(Pe,ke,Be,ot,ve){--ke.pendingcb,Be?(T.nextTick(ve,ot),T.nextTick(Te,Pe,ke),Pe._writableState.errorEmitted=!0,Pe.emit("error",ot)):(ve(ot),Pe._writableState.errorEmitted=!0,Pe.emit("error",ot),Te(Pe,ke))}function re(Pe){Pe.writing=!1,Pe.writecb=null,Pe.length-=Pe.writelen,Pe.writelen=0}function de(Pe,ke){var Be=Pe._writableState,ot=Be.sync,ve=Be.writecb;if(re(Be),ke)L(Pe,Be,ot,ke,ve);else{var ge=Le(Be);!ge&&!Be.corked&&!Be.bufferProcessing&&Be.bufferedRequest&&Ne(Pe,Be),ot?J(ee,Pe,Be,ge,ve):ee(Pe,Be,ge,ve)}}function ee(Pe,ke,Be,ot){Be||xe(Pe,ke),ke.pendingcb--,ot(),Te(Pe,ke)}function xe(Pe,ke){ke.length===0&&ke.needDrain&&(ke.needDrain=!1,Pe.emit("drain"))}function Ne(Pe,ke){ke.bufferProcessing=!0;var Be=ke.bufferedRequest;if(Pe._writev&&Be&&Be.next){var ot=ke.bufferedRequestCount,ve=new Array(ot),ge=ke.corkedRequestsFree;ge.entry=Be;for(var $e=0,pe=!0;Be;)ve[$e]=Be,Be.isBuf||(pe=!1),Be=Be.next,$e+=1;ve.allBuffers=pe,Q(Pe,ke,!0,ke.length,ve,"",ge.finish),ke.pendingcb++,ke.lastBufferedRequest=null,ge.next?(ke.corkedRequestsFree=ge.next,ge.next=null):ke.corkedRequestsFree=new F(ke),ke.bufferedRequestCount=0}else{for(;Be;){var Z=Be.chunk,k=Be.encoding,$=Be.callback,Re=ke.objectMode?1:Z.length;if(Q(Pe,ke,!1,Re,Z,k,$),Be=Be.next,ke.bufferedRequestCount--,ke.writing)break}Be===null&&(ke.lastBufferedRequest=null)}ke.bufferedRequest=Be,ke.bufferProcessing=!1}le.prototype._write=function(Pe,ke,Be){Be(new Error("_write() is not implemented"))},le.prototype._writev=null,le.prototype.end=function(Pe,ke,Be){var ot=this._writableState;typeof Pe=="function"?(Be=Pe,Pe=null,ke=null):typeof ke=="function"&&(Be=ke,ke=null),Pe!=null&&this.write(Pe,ke),ot.corked&&(ot.corked=1,this.uncork()),!ot.ending&&!ot.finished&&nt(this,ot,Be)};function Le(Pe){return Pe.ending&&Pe.length===0&&Pe.bufferedRequest===null&&!Pe.finished&&!Pe.writing}function Ge(Pe,ke){Pe._final(function(Be){ke.pendingcb--,Be&&Pe.emit("error",Be),ke.prefinished=!0,Pe.emit("prefinish"),Te(Pe,ke)})}function Qe(Pe,ke){!ke.prefinished&&!ke.finalCalled&&(typeof Pe._final=="function"?(ke.pendingcb++,ke.finalCalled=!0,T.nextTick(Ge,Pe,ke)):(ke.prefinished=!0,Pe.emit("prefinish")))}function Te(Pe,ke){var Be=Le(ke);return Be&&(Qe(Pe,ke),ke.pendingcb===0&&(ke.finished=!0,Pe.emit("finish"))),Be}function nt(Pe,ke,Be){ke.ending=!0,Te(Pe,ke),Be&&(ke.finished?T.nextTick(Be):Pe.once("finish",Be)),ke.ended=!0,Pe.writable=!1}function Ye(Pe,ke,Be){var ot=Pe.entry;for(Pe.entry=null;ot;){var ve=ot.callback;ke.pendingcb--,ve(Be),ot=ot.next}ke.corkedRequestsFree?ke.corkedRequestsFree.next=Pe:ke.corkedRequestsFree=Pe}Object.defineProperty(le.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(ke){if(!this._writableState)return;this._writableState.destroyed=ke}}),le.prototype.destroy=w.destroy,le.prototype._undestroy=w.undestroy,le.prototype._destroy=function(Pe,ke){this.end(),ke(Pe)}}).call(this,d("_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(d,V,O){"use strict";function y(A,x){if(!(A instanceof x))throw new TypeError("Cannot call a class as a function")}var l=d("safe-buffer").Buffer,M=d("util");function D(A,x,v){A.copy(x,v)}V.exports=function(){function A(){y(this,A),this.head=null,this.tail=null,this.length=0}return A.prototype.push=function(v){var h={data:v,next:null};this.length>0?this.tail.next=h:this.head=h,this.tail=h,++this.length},A.prototype.unshift=function(v){var h={data:v,next:this.head};this.length===0&&(this.tail=h),this.head=h,++this.length},A.prototype.shift=function(){if(this.length===0)return;var v=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,v},A.prototype.clear=function(){this.head=this.tail=null,this.length=0},A.prototype.join=function(v){if(this.length===0)return"";for(var h=this.head,p=""+h.data;h=h.next;)p+=v+h.data;return p},A.prototype.concat=function(v){if(this.length===0)return l.alloc(0);if(this.length===1)return this.head.data;for(var h=l.allocUnsafe(v>>>0),p=this.head,c=0;p;)D(p.data,h,c),c+=p.data.length,p=p.next;return h},A}(),M&&M.inspect&&M.inspect.custom&&(V.exports.prototype[M.inspect.custom]=function(){var A=M.inspect({length:this.length});return this.constructor.name+" "+A})},{"safe-buffer":228,util:71}],220:[function(d,V,O){"use strict";var y=d("process-nextick-args");function l(A,x){var v=this,h=this._readableState&&this._readableState.destroyed,p=this._writableState&&this._writableState.destroyed;return h||p?(x?x(A):A&&(!this._writableState||!this._writableState.errorEmitted)&&y.nextTick(D,this,A),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(A||null,function(c){!x&&c?(y.nextTick(D,v,c),v._writableState&&(v._writableState.errorEmitted=!0)):x&&x(c)}),this)}function M(){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 D(A,x){A.emit("error",x)}V.exports={destroy:l,undestroy:M}},{"process-nextick-args":207}],221:[function(d,V,O){"use strict";V.exports=d("events").EventEmitter},{events:192}],222:[function(d,V,O){V.exports=d("./readable").PassThrough},{"./readable":223}],223:[function(d,V,O){O=V.exports=d("./lib/_stream_readable.js"),O.Stream=O,O.Readable=O,O.Writable=d("./lib/_stream_writable.js"),O.Duplex=d("./lib/_stream_duplex.js"),O.Transform=d("./lib/_stream_transform.js"),O.PassThrough=d("./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(d,V,O){V.exports=d("./readable").Transform},{"./readable":223}],225:[function(d,V,O){V.exports=d("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":218}],226:[function(d,V,O){var y=function(){return this}()||Function("return this")(),l=y.regeneratorRuntime&&Object.getOwnPropertyNames(y).indexOf("regeneratorRuntime")>=0,M=l&&y.regeneratorRuntime;if(y.regeneratorRuntime=void 0,V.exports=d("./runtime"),l)y.regeneratorRuntime=M;else try{delete y.regeneratorRuntime}catch(D){y.regeneratorRuntime=void 0}},{"./runtime":227}],227:[function(d,V,O){!function(y){"use strict";var l=Object.prototype,M=l.hasOwnProperty,D,A=typeof Symbol=="function"?Symbol:{},x=A.iterator||"@@iterator",v=A.asyncIterator||"@@asyncIterator",h=A.toStringTag||"@@toStringTag",p=typeof V=="object",c=y.regeneratorRuntime;if(c){p&&(V.exports=c);return}c=y.regeneratorRuntime=p?V.exports:{};function m(j,Q,L,re){var de=Q&&Q.prototype instanceof H?Q:H,ee=Object.create(de.prototype),xe=new _e(re||[]);return ee._invoke=X(j,L,xe),ee}c.wrap=m;function C(j,Q,L){try{return{type:"normal",arg:j.call(Q,L)}}catch(re){return{type:"throw",arg:re}}}var g="suspendedStart",T="suspendedYield",B="executing",F="completed",J={};function H(){}function K(){}function Y(){}var W={};W[x]=function(){return this};var U=Object.getPrototypeOf,_=U&&U(U(se([])));_&&_!==l&&M.call(_,x)&&(W=_);var te=Y.prototype=H.prototype=Object.create(W);K.prototype=te.constructor=Y,Y.constructor=K,Y[h]=K.displayName="GeneratorFunction";function q(j){["next","throw","return"].forEach(function(Q){j[Q]=function(L){return this._invoke(Q,L)}})}c.isGeneratorFunction=function(j){var Q=typeof j=="function"&&j.constructor;return Q?Q===K||(Q.displayName||Q.name)==="GeneratorFunction":!1},c.mark=function(j){return Object.setPrototypeOf?Object.setPrototypeOf(j,Y):(j.__proto__=Y,h in j||(j[h]="GeneratorFunction")),j.prototype=Object.create(te),j},c.awrap=function(j){return{__await:j}};function w(j){function Q(de,ee,xe,Ne){var Le=C(j[de],j,ee);if(Le.type==="throw")Ne(Le.arg);else{var Ge=Le.arg,Qe=Ge.value;return Qe&&typeof Qe=="object"&&M.call(Qe,"__await")?Promise.resolve(Qe.__await).then(function(Te){Q("next",Te,xe,Ne)},function(Te){Q("throw",Te,xe,Ne)}):Promise.resolve(Qe).then(function(Te){Ge.value=Te,xe(Ge)},Ne)}}var L;function re(de,ee){function xe(){return new Promise(function(Ne,Le){Q(de,ee,Ne,Le)})}return L=L?L.then(xe,xe):xe()}this._invoke=re}q(w.prototype),w.prototype[v]=function(){return this},c.AsyncIterator=w,c.async=function(j,Q,L,re){var de=new w(m(j,Q,L,re));return c.isGeneratorFunction(Q)?de:de.next().then(function(ee){return ee.done?ee.value:de.next()})};function X(j,Q,L){var re=g;return function(ee,xe){if(re===B)throw new Error("Generator is already running");if(re===F){if(ee==="throw")throw xe;return be()}for(L.method=ee,L.arg=xe;;){var Ne=L.delegate;if(Ne){var Le=ne(Ne,L);if(Le){if(Le===J)continue;return Le}}if(L.method==="next")L.sent=L._sent=L.arg;else if(L.method==="throw"){if(re===g)throw re=F,L.arg;L.dispatchException(L.arg)}else L.method==="return"&&L.abrupt("return",L.arg);re=B;var Ge=C(j,Q,L);if(Ge.type==="normal"){if(re=L.done?F:T,Ge.arg===J)continue;return{value:Ge.arg,done:L.done}}else Ge.type==="throw"&&(re=F,L.method="throw",L.arg=Ge.arg)}}}function ne(j,Q){var L=j.iterator[Q.method];if(L===D){if(Q.delegate=null,Q.method==="throw"){if(j.iterator.return&&(Q.method="return",Q.arg=D,ne(j,Q),Q.method==="throw"))return J;Q.method="throw",Q.arg=new TypeError("The iterator does not provide a 'throw' method")}return J}var re=C(L,j.iterator,Q.arg);if(re.type==="throw")return Q.method="throw",Q.arg=re.arg,Q.delegate=null,J;var de=re.arg;if(!de)return Q.method="throw",Q.arg=new TypeError("iterator result is not an object"),Q.delegate=null,J;if(de.done)Q[j.resultName]=de.value,Q.next=j.nextLoc,Q.method!=="return"&&(Q.method="next",Q.arg=D);else return de;return Q.delegate=null,J}q(te),te[h]="Generator",te[x]=function(){return this},te.toString=function(){return"[object Generator]"};function he(j){var Q={tryLoc:j[0]};1 in j&&(Q.catchLoc=j[1]),2 in j&&(Q.finallyLoc=j[2],Q.afterLoc=j[3]),this.tryEntries.push(Q)}function le(j){var Q=j.completion||{};Q.type="normal",delete Q.arg,j.completion=Q}function _e(j){this.tryEntries=[{tryLoc:"root"}],j.forEach(he,this),this.reset(!0)}c.keys=function(j){var Q=[];for(var L in j)Q.push(L);return Q.reverse(),function re(){for(;Q.length;){var de=Q.pop();if(de in j)return re.value=de,re.done=!1,re}return re.done=!0,re}};function se(j){if(j){var Q=j[x];if(Q)return Q.call(j);if(typeof j.next=="function")return j;if(!isNaN(j.length)){var L=-1,re=function de(){for(;++L<j.length;)if(M.call(j,L))return de.value=j[L],de.done=!1,de;return de.value=D,de.done=!0,de};return re.next=re}}return{next:be}}c.values=se;function be(){return{value:D,done:!0}}_e.prototype={constructor:_e,reset:function(j){if(this.prev=0,this.next=0,this.sent=this._sent=D,this.done=!1,this.delegate=null,this.method="next",this.arg=D,this.tryEntries.forEach(le),!j)for(var Q in this)Q.charAt(0)==="t"&&M.call(this,Q)&&!isNaN(+Q.slice(1))&&(this[Q]=D)},stop:function(){this.done=!0;var j=this.tryEntries[0],Q=j.completion;if(Q.type==="throw")throw Q.arg;return this.rval},dispatchException:function(j){if(this.done)throw j;var Q=this;function L(Le,Ge){return ee.type="throw",ee.arg=j,Q.next=Le,Ge&&(Q.method="next",Q.arg=D),!!Ge}for(var re=this.tryEntries.length-1;re>=0;--re){var de=this.tryEntries[re],ee=de.completion;if(de.tryLoc==="root")return L("end");if(de.tryLoc<=this.prev){var xe=M.call(de,"catchLoc"),Ne=M.call(de,"finallyLoc");if(xe&&Ne){if(this.prev<de.catchLoc)return L(de.catchLoc,!0);if(this.prev<de.finallyLoc)return L(de.finallyLoc)}else if(xe){if(this.prev<de.catchLoc)return L(de.catchLoc,!0)}else if(Ne){if(this.prev<de.finallyLoc)return L(de.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(j,Q){for(var L=this.tryEntries.length-1;L>=0;--L){var re=this.tryEntries[L];if(re.tryLoc<=this.prev&&M.call(re,"finallyLoc")&&this.prev<re.finallyLoc){var de=re;break}}de&&(j==="break"||j==="continue")&&de.tryLoc<=Q&&Q<=de.finallyLoc&&(de=null);var ee=de?de.completion:{};return ee.type=j,ee.arg=Q,de?(this.method="next",this.next=de.finallyLoc,J):this.complete(ee)},complete:function(j,Q){if(j.type==="throw")throw j.arg;return j.type==="break"||j.type==="continue"?this.next=j.arg:j.type==="return"?(this.rval=this.arg=j.arg,this.method="return",this.next="end"):j.type==="normal"&&Q&&(this.next=Q),J},finish:function(j){for(var Q=this.tryEntries.length-1;Q>=0;--Q){var L=this.tryEntries[Q];if(L.finallyLoc===j)return this.complete(L.completion,L.afterLoc),le(L),J}},catch:function(j){for(var Q=this.tryEntries.length-1;Q>=0;--Q){var L=this.tryEntries[Q];if(L.tryLoc===j){var re=L.completion;if(re.type==="throw"){var de=re.arg;le(L)}return de}}throw new Error("illegal catch attempt")},delegateYield:function(j,Q,L){return this.delegate={iterator:se(j),resultName:Q,nextLoc:L},this.method==="next"&&(this.arg=D),J}}}(function(){return this}()||Function("return this")())},{}],228:[function(d,V,O){var y=d("buffer"),l=y.Buffer;function M(A,x){for(var v in A)x[v]=A[v]}l.from&&l.alloc&&l.allocUnsafe&&l.allocUnsafeSlow?V.exports=y:(M(y,O),O.Buffer=D);function D(A,x,v){return l(A,x,v)}M(l,D),D.from=function(A,x,v){if(typeof A=="number")throw new TypeError("Argument must not be a number");return l(A,x,v)},D.alloc=function(A,x,v){if(typeof A!="number")throw new TypeError("Argument must be a number");var h=l(A);return x!==void 0?typeof v=="string"?h.fill(x,v):h.fill(x):h.fill(0),h},D.allocUnsafe=function(A){if(typeof A!="number")throw new TypeError("Argument must be a number");return l(A)},D.allocUnsafeSlow=function(A){if(typeof A!="number")throw new TypeError("Argument must be a number");return y.SlowBuffer(A)}},{buffer:73}],229:[function(d,V,O){(function(y){"use strict";var l=d("babel-runtime/core-js/string/from-code-point"),M=T(l),D=d("babel-runtime/core-js/json/stringify"),A=T(D),x=d("babel-runtime/helpers/typeof"),v=T(x),h=d("babel-runtime/core-js/object/define-property"),p=T(h),c=d("babel-runtime/core-js/object/keys"),m=T(c),C=d("babel-runtime/core-js/object/create"),g=T(C);function T(B){return B&&B.__esModule?B:{default:B}}(function(B){B.parser=function(k,$){return new J(k,$)},B.SAXParser=J,B.SAXStream=te,B.createStream=_,B.MAX_BUFFER_LENGTH=64*1024;var F=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];B.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function J(k,$){if(!(this instanceof J))return new J(k,$);var Re=this;K(Re),Re.q=Re.c="",Re.bufferCheckPosition=B.MAX_BUFFER_LENGTH,Re.opt=$||{},Re.opt.lowercase=Re.opt.lowercase||Re.opt.lowercasetags,Re.looseCase=Re.opt.lowercase?"toLowerCase":"toUpperCase",Re.tags=[],Re.closed=Re.closedRoot=Re.sawRoot=!1,Re.tag=Re.error=null,Re.strict=!!k,Re.noscript=!!(k||Re.opt.noscript),Re.state=ee.BEGIN,Re.strictEntities=Re.opt.strictEntities,Re.ENTITIES=Re.strictEntities?(0,g.default)(B.XML_ENTITIES):(0,g.default)(B.ENTITIES),Re.attribList=[],Re.opt.xmlns&&(Re.ns=(0,g.default)(he)),Re.trackPosition=Re.opt.position!==!1,Re.trackPosition&&(Re.position=Re.line=Re.column=0),Ne(Re,"onready")}g.default||(Object.create=function(k){function $(){}$.prototype=k;var Re=new $;return Re}),m.default||(Object.keys=function(k){var $=[];for(var Re in k)k.hasOwnProperty(Re)&&$.push(Re);return $});function H(k){for(var $=Math.max(B.MAX_BUFFER_LENGTH,10),Re=0,Ae=0,Xe=F.length;Ae<Xe;Ae++){var rt=k[F[Ae]].length;if(rt>$)switch(F[Ae]){case"textNode":Ge(k);break;case"cdata":Le(k,"oncdata",k.cdata),k.cdata="";break;case"script":Le(k,"onscript",k.script),k.script="";break;default:Te(k,"Max buffer length exceeded: "+F[Ae])}Re=Math.max(Re,rt)}var lt=B.MAX_BUFFER_LENGTH-Re;k.bufferCheckPosition=lt+k.position}function K(k){for(var $=0,Re=F.length;$<Re;$++)k[F[$]]=""}function Y(k){Ge(k),k.cdata!==""&&(Le(k,"oncdata",k.cdata),k.cdata=""),k.script!==""&&(Le(k,"onscript",k.script),k.script="")}J.prototype={end:function(){nt(this)},write:Z,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){Y(this)}};var W;try{W=d("stream").Stream}catch(k){W=function(){}}var U=B.EVENTS.filter(function(k){return k!=="error"&&k!=="end"});function _(k,$){return new te(k,$)}function te(k,$){if(!(this instanceof te))return new te(k,$);W.apply(this),this._parser=new J(k,$),this.writable=!0,this.readable=!0;var Re=this;this._parser.onend=function(){Re.emit("end")},this._parser.onerror=function(Ae){Re.emit("error",Ae),Re._parser.error=null},this._decoder=null,U.forEach(function(Ae){(0,p.default)(Re,"on"+Ae,{get:function(){return Re._parser["on"+Ae]},set:function(rt){if(!rt)return Re.removeAllListeners(Ae),Re._parser["on"+Ae]=rt,rt;Re.on(Ae,rt)},enumerable:!0,configurable:!1})})}te.prototype=(0,g.default)(W.prototype,{constructor:{value:te}}),te.prototype.write=function(k){if(typeof y=="function"&&typeof y.isBuffer=="function"&&y.isBuffer(k)){if(!this._decoder){var $=d("string_decoder").StringDecoder;this._decoder=new $("utf8")}k=this._decoder.write(k)}return this._parser.write(k.toString()),this.emit("data",k),!0},te.prototype.end=function(k){return k&&k.length&&this.write(k),this._parser.end(),!0},te.prototype.on=function(k,$){var Re=this;return!Re._parser["on"+k]&&U.indexOf(k)!==-1&&(Re._parser["on"+k]=function(){var Ae=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);Ae.splice(0,0,k),Re.emit.apply(Re,Ae)}),W.prototype.on.call(Re,k,$)};var q="[CDATA[",w="DOCTYPE",X="http://www.w3.org/XML/1998/namespace",ne="http://www.w3.org/2000/xmlns/",he={xml:X,xmlns:ne},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-]/,se=/[#:_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]/,be=/[#:_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 j(k){return k===" "||k===`
|
|
|
`||k==="\r"||k===" "}function Q(k){return k==='"'||k==="'"}function L(k){return k===">"||j(k)}function re(k,$){return k.test($)}function de(k,$){return!re(k,$)}var ee=0;B.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++},B.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},B.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,m.default)(B.ENTITIES).forEach(function(k){var $=B.ENTITIES[k],Re=typeof $=="number"?String.fromCharCode($):$;B.ENTITIES[k]=Re});for(var xe in B.STATE)B.STATE[B.STATE[xe]]=xe;ee=B.STATE;function Ne(k,$,Re){k[$]&&k[$](Re)}function Le(k,$,Re){k.textNode&&Ge(k),Ne(k,$,Re)}function Ge(k){k.textNode=Qe(k.opt,k.textNode),k.textNode&&Ne(k,"ontext",k.textNode),k.textNode=""}function Qe(k,$){return k.trim&&($=$.trim()),k.normalize&&($=$.replace(/\s+/g," ")),$}function Te(k,$){return Ge(k),k.trackPosition&&($+=`
|
|
|
Line: `+k.line+`
|
|
|
Column: `+k.column+`
|
|
|
Char: `+k.c),$=new Error($),k.error=$,Ne(k,"onerror",$),k}function nt(k){return k.sawRoot&&!k.closedRoot&&Ye(k,"Unclosed root tag"),k.state!==ee.BEGIN&&k.state!==ee.BEGIN_WHITESPACE&&k.state!==ee.TEXT&&Te(k,"Unexpected end"),Ge(k),k.c="",k.closed=!0,Ne(k,"onend"),J.call(k,k.strict,k.opt),k}function Ye(k,$){if((typeof k=="undefined"?"undefined":(0,v.default)(k))!=="object"||!(k instanceof J))throw new Error("bad call to strictFail");k.strict&&Te(k,$)}function Pe(k){k.strict||(k.tagName=k.tagName[k.looseCase]());var $=k.tags[k.tags.length-1]||k,Re=k.tag={name:k.tagName,attributes:{}};k.opt.xmlns&&(Re.ns=$.ns),k.attribList.length=0,Le(k,"onopentagstart",Re)}function ke(k,$){var Re=k.indexOf(":"),Ae=Re<0?["",k]:k.split(":"),Xe=Ae[0],rt=Ae[1];return $&&k==="xmlns"&&(Xe="xmlns",rt=""),{prefix:Xe,local:rt}}function Be(k){if(k.strict||(k.attribName=k.attribName[k.looseCase]()),k.attribList.indexOf(k.attribName)!==-1||k.tag.attributes.hasOwnProperty(k.attribName)){k.attribName=k.attribValue="";return}if(k.opt.xmlns){var $=ke(k.attribName,!0),Re=$.prefix,Ae=$.local;if(Re==="xmlns")if(Ae==="xml"&&k.attribValue!==X)Ye(k,"xml: prefix must be bound to "+X+`
|
|
|
Actual: `+k.attribValue);else if(Ae==="xmlns"&&k.attribValue!==ne)Ye(k,"xmlns: prefix must be bound to "+ne+`
|
|
|
Actual: `+k.attribValue);else{var Xe=k.tag,rt=k.tags[k.tags.length-1]||k;Xe.ns===rt.ns&&(Xe.ns=(0,g.default)(rt.ns)),Xe.ns[Ae]=k.attribValue}k.attribList.push([k.attribName,k.attribValue])}else k.tag.attributes[k.attribName]=k.attribValue,Le(k,"onattribute",{name:k.attribName,value:k.attribValue});k.attribName=k.attribValue=""}function ot(k,$){if(k.opt.xmlns){var Re=k.tag,Ae=ke(k.tagName);Re.prefix=Ae.prefix,Re.local=Ae.local,Re.uri=Re.ns[Ae.prefix]||"",Re.prefix&&!Re.uri&&(Ye(k,"Unbound namespace prefix: "+(0,A.default)(k.tagName)),Re.uri=Ae.prefix);var Xe=k.tags[k.tags.length-1]||k;Re.ns&&Xe.ns!==Re.ns&&(0,m.default)(Re.ns).forEach(function(rr){Le(k,"onopennamespace",{prefix:rr,uri:Re.ns[rr]})});for(var rt=0,lt=k.attribList.length;rt<lt;rt++){var bt=k.attribList[rt],Tt=bt[0],xt=bt[1],Et=ke(Tt,!0),Nt=Et.prefix,at=Et.local,Bt=Nt===""?"":Re.ns[Nt]||"",mr={name:Tt,value:xt,prefix:Nt,local:at,uri:Bt};Nt&&Nt!=="xmlns"&&!Bt&&(Ye(k,"Unbound namespace prefix: "+(0,A.default)(Nt)),mr.uri=Nt),k.tag.attributes[Tt]=mr,Le(k,"onattribute",mr)}k.attribList.length=0}k.tag.isSelfClosing=!!$,k.sawRoot=!0,k.tags.push(k.tag),Le(k,"onopentag",k.tag),$||(!k.noscript&&k.tagName.toLowerCase()==="script"?k.state=ee.SCRIPT:k.state=ee.TEXT,k.tag=null,k.tagName=""),k.attribName=k.attribValue="",k.attribList.length=0}function ve(k){if(!k.tagName){Ye(k,"Weird empty close tag."),k.textNode+="</>",k.state=ee.TEXT;return}if(k.script){if(k.tagName!=="script"){k.script+="</"+k.tagName+">",k.tagName="",k.state=ee.SCRIPT;return}Le(k,"onscript",k.script),k.script=""}var $=k.tags.length,Re=k.tagName;k.strict||(Re=Re[k.looseCase]());for(var Ae=Re;$--;){var Xe=k.tags[$];if(Xe.name!==Ae)Ye(k,"Unexpected close tag");else break}if($<0){Ye(k,"Unmatched closing tag: "+k.tagName),k.textNode+="</"+k.tagName+">",k.state=ee.TEXT;return}k.tagName=Re;for(var rt=k.tags.length;rt-- >$;){var lt=k.tag=k.tags.pop();k.tagName=k.tag.name,Le(k,"onclosetag",k.tagName);var bt={};for(var Tt in lt.ns)bt[Tt]=lt.ns[Tt];var xt=k.tags[k.tags.length-1]||k;k.opt.xmlns&<.ns!==xt.ns&&(0,m.default)(lt.ns).forEach(function(Et){var Nt=lt.ns[Et];Le(k,"onclosenamespace",{prefix:Et,uri:Nt})})}$===0&&(k.closedRoot=!0),k.tagName=k.attribValue=k.attribName="",k.attribList.length=0,k.state=ee.TEXT}function ge(k){var $=k.entity,Re=$.toLowerCase(),Ae,Xe="";return k.ENTITIES[$]?k.ENTITIES[$]:k.ENTITIES[Re]?k.ENTITIES[Re]:($=Re,$.charAt(0)==="#"&&($.charAt(1)==="x"?($=$.slice(2),Ae=parseInt($,16),Xe=Ae.toString(16)):($=$.slice(1),Ae=parseInt($,10),Xe=Ae.toString(10))),$=$.replace(/^0+/,""),isNaN(Ae)||Xe.toLowerCase()!==$?(Ye(k,"Invalid character entity"),"&"+k.entity+";"):(0,M.default)(Ae))}function $e(k,$){$==="<"?(k.state=ee.OPEN_WAKA,k.startTagPosition=k.position):j($)||(Ye(k,"Non-whitespace before first tag."),k.textNode=$,k.state=ee.TEXT)}function pe(k,$){var Re="";return $<k.length&&(Re=k.charAt($)),Re}function Z(k){var $=this;if(this.error)throw this.error;if($.closed)return Te($,"Cannot write after close. Assign an onready handler.");if(k===null)return nt($);(typeof k=="undefined"?"undefined":(0,v.default)(k))==="object"&&(k=k.toString());for(var Re=0,Ae="";!(Ae=pe(k,Re++),$.c=Ae,!Ae);){$.trackPosition&&($.position++,Ae===`
|
|
|
`?($.line++,$.column=0):$.column++);switch($.state){case ee.BEGIN:if($.state=ee.BEGIN_WHITESPACE,Ae==="\uFEFF")continue;$e($,Ae);continue;case ee.BEGIN_WHITESPACE:$e($,Ae);continue;case ee.TEXT:if($.sawRoot&&!$.closedRoot){for(var Xe=Re-1;Ae&&Ae!=="<"&&Ae!=="&";)Ae=pe(k,Re++),Ae&&$.trackPosition&&($.position++,Ae===`
|
|
|
`?($.line++,$.column=0):$.column++);$.textNode+=k.substring(Xe,Re-1)}Ae==="<"&&!($.sawRoot&&$.closedRoot&&!$.strict)?($.state=ee.OPEN_WAKA,$.startTagPosition=$.position):(!j(Ae)&&(!$.sawRoot||$.closedRoot)&&Ye($,"Text data outside of root node."),Ae==="&"?$.state=ee.TEXT_ENTITY:$.textNode+=Ae);continue;case ee.SCRIPT:Ae==="<"?$.state=ee.SCRIPT_ENDING:$.script+=Ae;continue;case ee.SCRIPT_ENDING:Ae==="/"?$.state=ee.CLOSE_TAG:($.script+="<"+Ae,$.state=ee.SCRIPT);continue;case ee.OPEN_WAKA:if(Ae==="!")$.state=ee.SGML_DECL,$.sgmlDecl="";else if(!j(Ae))if(re(le,Ae))$.state=ee.OPEN_TAG,$.tagName=Ae;else if(Ae==="/")$.state=ee.CLOSE_TAG,$.tagName="";else if(Ae==="?")$.state=ee.PROC_INST,$.procInstName=$.procInstBody="";else{if(Ye($,"Unencoded <"),$.startTagPosition+1<$.position){var rt=$.position-$.startTagPosition;Ae=new Array(rt).join(" ")+Ae}$.textNode+="<"+Ae,$.state=ee.TEXT}continue;case ee.SGML_DECL:($.sgmlDecl+Ae).toUpperCase()===q?(Le($,"onopencdata"),$.state=ee.CDATA,$.sgmlDecl="",$.cdata=""):$.sgmlDecl+Ae==="--"?($.state=ee.COMMENT,$.comment="",$.sgmlDecl=""):($.sgmlDecl+Ae).toUpperCase()===w?($.state=ee.DOCTYPE,($.doctype||$.sawRoot)&&Ye($,"Inappropriately located doctype declaration"),$.doctype="",$.sgmlDecl=""):Ae===">"?(Le($,"onsgmldeclaration",$.sgmlDecl),$.sgmlDecl="",$.state=ee.TEXT):(Q(Ae)&&($.state=ee.SGML_DECL_QUOTED),$.sgmlDecl+=Ae);continue;case ee.SGML_DECL_QUOTED:Ae===$.q&&($.state=ee.SGML_DECL,$.q=""),$.sgmlDecl+=Ae;continue;case ee.DOCTYPE:Ae===">"?($.state=ee.TEXT,Le($,"ondoctype",$.doctype),$.doctype=!0):($.doctype+=Ae,Ae==="["?$.state=ee.DOCTYPE_DTD:Q(Ae)&&($.state=ee.DOCTYPE_QUOTED,$.q=Ae));continue;case ee.DOCTYPE_QUOTED:$.doctype+=Ae,Ae===$.q&&($.q="",$.state=ee.DOCTYPE);continue;case ee.DOCTYPE_DTD:$.doctype+=Ae,Ae==="]"?$.state=ee.DOCTYPE:Q(Ae)&&($.state=ee.DOCTYPE_DTD_QUOTED,$.q=Ae);continue;case ee.DOCTYPE_DTD_QUOTED:$.doctype+=Ae,Ae===$.q&&($.state=ee.DOCTYPE_DTD,$.q="");continue;case ee.COMMENT:Ae==="-"?$.state=ee.COMMENT_ENDING:$.comment+=Ae;continue;case ee.COMMENT_ENDING:Ae==="-"?($.state=ee.COMMENT_ENDED,$.comment=Qe($.opt,$.comment),$.comment&&Le($,"oncomment",$.comment),$.comment=""):($.comment+="-"+Ae,$.state=ee.COMMENT);continue;case ee.COMMENT_ENDED:Ae!==">"?(Ye($,"Malformed comment"),$.comment+="--"+Ae,$.state=ee.COMMENT):$.state=ee.TEXT;continue;case ee.CDATA:Ae==="]"?$.state=ee.CDATA_ENDING:$.cdata+=Ae;continue;case ee.CDATA_ENDING:Ae==="]"?$.state=ee.CDATA_ENDING_2:($.cdata+="]"+Ae,$.state=ee.CDATA);continue;case ee.CDATA_ENDING_2:Ae===">"?($.cdata&&Le($,"oncdata",$.cdata),Le($,"onclosecdata"),$.cdata="",$.state=ee.TEXT):Ae==="]"?$.cdata+="]":($.cdata+="]]"+Ae,$.state=ee.CDATA);continue;case ee.PROC_INST:Ae==="?"?$.state=ee.PROC_INST_ENDING:j(Ae)?$.state=ee.PROC_INST_BODY:$.procInstName+=Ae;continue;case ee.PROC_INST_BODY:if(!$.procInstBody&&j(Ae))continue;Ae==="?"?$.state=ee.PROC_INST_ENDING:$.procInstBody+=Ae;continue;case ee.PROC_INST_ENDING:Ae===">"?(Le($,"onprocessinginstruction",{name:$.procInstName,body:$.procInstBody}),$.procInstName=$.procInstBody="",$.state=ee.TEXT):($.procInstBody+="?"+Ae,$.state=ee.PROC_INST_BODY);continue;case ee.OPEN_TAG:re(_e,Ae)?$.tagName+=Ae:(Pe($),Ae===">"?ot($):Ae==="/"?$.state=ee.OPEN_TAG_SLASH:(j(Ae)||Ye($,"Invalid character in tag name"),$.state=ee.ATTRIB));continue;case ee.OPEN_TAG_SLASH:Ae===">"?(ot($,!0),ve($)):(Ye($,"Forward-slash in opening tag not followed by >"),$.state=ee.ATTRIB);continue;case ee.ATTRIB:if(j(Ae))continue;Ae===">"?ot($):Ae==="/"?$.state=ee.OPEN_TAG_SLASH:re(le,Ae)?($.attribName=Ae,$.attribValue="",$.state=ee.ATTRIB_NAME):Ye($,"Invalid attribute name");continue;case ee.ATTRIB_NAME:Ae==="="?$.state=ee.ATTRIB_VALUE:Ae===">"?(Ye($,"Attribute without value"),$.attribValue=$.attribName,Be($),ot($)):j(Ae)?$.state=ee.ATTRIB_NAME_SAW_WHITE:re(_e,Ae)?$.attribName+=Ae:Ye($,"Invalid attribute name");continue;case ee.ATTRIB_NAME_SAW_WHITE:if(Ae==="=")$.state=ee.ATTRIB_VALUE;else{if(j(Ae))continue;Ye($,"Attribute without value"),$.tag.attributes[$.attribName]="",$.attribValue="",Le($,"onattribute",{name:$.attribName,value:""}),$.attribName="",Ae===">"?ot($):re(le,Ae)?($.attribName=Ae,$.state=ee.ATTRIB_NAME):(Ye($,"Invalid attribute name"),$.state=ee.ATTRIB)}continue;case ee.ATTRIB_VALUE:if(j(Ae))continue;Q(Ae)?($.q=Ae,$.state=ee.ATTRIB_VALUE_QUOTED):(Ye($,"Unquoted attribute value"),$.state=ee.ATTRIB_VALUE_UNQUOTED,$.attribValue=Ae);continue;case ee.ATTRIB_VALUE_QUOTED:if(Ae!==$.q){Ae==="&"?$.state=ee.ATTRIB_VALUE_ENTITY_Q:$.attribValue+=Ae;continue}Be($),$.q="",$.state=ee.ATTRIB_VALUE_CLOSED;continue;case ee.ATTRIB_VALUE_CLOSED:j(Ae)?$.state=ee.ATTRIB:Ae===">"?ot($):Ae==="/"?$.state=ee.OPEN_TAG_SLASH:re(le,Ae)?(Ye($,"No whitespace between attributes"),$.attribName=Ae,$.attribValue="",$.state=ee.ATTRIB_NAME):Ye($,"Invalid attribute name");continue;case ee.ATTRIB_VALUE_UNQUOTED:if(!L(Ae)){Ae==="&"?$.state=ee.ATTRIB_VALUE_ENTITY_U:$.attribValue+=Ae;continue}Be($),Ae===">"?ot($):$.state=ee.ATTRIB;continue;case ee.CLOSE_TAG:if($.tagName)Ae===">"?ve($):re(_e,Ae)?$.tagName+=Ae:$.script?($.script+="</"+$.tagName,$.tagName="",$.state=ee.SCRIPT):(j(Ae)||Ye($,"Invalid tagname in closing tag"),$.state=ee.CLOSE_TAG_SAW_WHITE);else{if(j(Ae))continue;de(le,Ae)?$.script?($.script+="</"+Ae,$.state=ee.SCRIPT):Ye($,"Invalid tagname in closing tag."):$.tagName=Ae}continue;case ee.CLOSE_TAG_SAW_WHITE:if(j(Ae))continue;Ae===">"?ve($):Ye($,"Invalid characters in closing tag");continue;case ee.TEXT_ENTITY:case ee.ATTRIB_VALUE_ENTITY_Q:case ee.ATTRIB_VALUE_ENTITY_U:var lt,bt;switch($.state){case ee.TEXT_ENTITY:lt=ee.TEXT,bt="textNode";break;case ee.ATTRIB_VALUE_ENTITY_Q:lt=ee.ATTRIB_VALUE_QUOTED,bt="attribValue";break;case ee.ATTRIB_VALUE_ENTITY_U:lt=ee.ATTRIB_VALUE_UNQUOTED,bt="attribValue";break}Ae===";"?($[bt]+=ge($),$.entity="",$.state=lt):re($.entity.length?be:se,Ae)?$.entity+=Ae:(Ye($,"Invalid character in entity name"),$[bt]+="&"+$.entity+Ae,$.entity="",$.state=lt);continue;default:throw new Error($,"Unknown state: "+$.state)}}return $.position>=$.bufferCheckPosition&&H($),$}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */M.default||function(){var k=String.fromCharCode,$=Math.floor,Re=function(){var Xe=16384,rt=[],lt,bt,Tt=-1,xt=arguments.length;if(!xt)return"";for(var Et="";++Tt<xt;){var Nt=Number(arguments[Tt]);if(!isFinite(Nt)||Nt<0||Nt>1114111||$(Nt)!==Nt)throw RangeError("Invalid code point: "+Nt);Nt<=65535?rt.push(Nt):(Nt-=65536,lt=(Nt>>10)+55296,bt=Nt%1024+56320,rt.push(lt,bt)),(Tt+1===xt||rt.length>Xe)&&(Et+=k.apply(null,rt),rt.length=0)}return Et};p.default?Object.defineProperty(String,"fromCodePoint",{value:Re,configurable:!0,writable:!0}):String.fromCodePoint=Re}()})(typeof O=="undefined"?(void 0).sax={}:O)}).call(this,d("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(d,V,O){V.exports=M;var y=d("events").EventEmitter,l=d("inherits");l(M,y),M.Readable=d("readable-stream/readable.js"),M.Writable=d("readable-stream/writable.js"),M.Duplex=d("readable-stream/duplex.js"),M.Transform=d("readable-stream/transform.js"),M.PassThrough=d("readable-stream/passthrough.js"),M.Stream=M;function M(){y.call(this)}M.prototype.pipe=function(D,A){var x=this;function v(T){D.writable&&(D.write(T)===!1&&x.pause&&x.pause())}x.on("data",v);function h(){x.readable&&x.resume&&x.resume()}D.on("drain",h),!D._isStdio&&(!A||A.end!==!1)&&(x.on("end",c),x.on("close",m));var p=!1;function c(){if(p)return;p=!0,D.end()}function m(){if(p)return;p=!0,typeof D.destroy=="function"&&D.destroy()}function C(T){if(g(),y.listenerCount(this,"error")===0)throw T}x.on("error",C),D.on("error",C);function g(){x.removeListener("data",v),D.removeListener("drain",h),x.removeListener("end",c),x.removeListener("close",m),x.removeListener("error",C),D.removeListener("error",C),x.removeListener("end",g),x.removeListener("close",g),D.removeListener("close",g)}return x.on("end",g),x.on("close",g),D.on("close",g),D.emit("pipe",x),D}},{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(d,V,O){(function(y){var l=d("./lib/request"),M=d("./lib/response"),D=d("xtend"),A=d("builtin-status-codes"),x=d("url"),v=O;v.request=function(h,p){typeof h=="string"?h=x.parse(h):h=D(h);var c=y.location.protocol.search(/^https?:$/)===-1?"http:":"",m=h.protocol||c,C=h.hostname||h.host,g=h.port,T=h.path||"/";C&&C.indexOf(":")!==-1&&(C="["+C+"]"),h.url=(C?m+"//"+C:"")+(g?":"+g:"")+T,h.method=(h.method||"GET").toUpperCase(),h.headers=h.headers||{};var B=new l(h);return p&&B.on("response",p),B},v.get=function(p,c){var m=v.request(p,c);return m.end(),m},v.ClientRequest=l,v.IncomingMessage=M.IncomingMessage,v.Agent=function(){},v.Agent.defaultMaxSockets=4,v.globalAgent=new v.Agent,v.STATUS_CODES=A,v.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(d,V,O){(function(y){"use strict";O.fetch=v(y.fetch)&&v(y.ReadableStream),O.writableStream=v(y.WritableStream),O.abortController=v(y.AbortController),O.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),O.blobConstructor=!0}catch(h){}var l;function M(){if(l!==void 0)return l;if(y.XMLHttpRequest){l=new y.XMLHttpRequest;try{l.open("GET",y.XDomainRequest?"/":"https://example.com")}catch(h){l=null}}else l=null;return l}function D(h){var p=M();if(!p)return!1;try{return p.responseType=h,p.responseType===h}catch(c){}return!1}var A=typeof y.ArrayBuffer!="undefined",x=A&&v(y.ArrayBuffer.prototype.slice);O.arraybuffer=O.fetch||A&&D("arraybuffer"),O.msstream=!O.fetch&&x&&D("ms-stream"),O.mozchunkedarraybuffer=!O.fetch&&A&&D("moz-chunked-arraybuffer"),O.overrideMimeType=O.fetch||(M()?v(M().overrideMimeType):!1),O.vbArray=v(y.VBArray);function v(h){return typeof h=="function"}l=null}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],233:[function(d,V,O){(function(y,l,M){"use strict";var D=d("babel-runtime/core-js/object/keys"),A=x(D);function x(H){return H&&H.__esModule?H:{default:H}}var v=d("./capability"),h=d("inherits"),p=d("./response"),c=d("readable-stream"),m=d("to-arraybuffer"),C=p.IncomingMessage,g=p.readyStates;function T(H,K){return v.fetch&&K?"fetch":v.mozchunkedarraybuffer?"moz-chunked-arraybuffer":v.msstream?"ms-stream":v.arraybuffer&&H?"arraybuffer":v.vbArray&&H?"text:vbarray":"text"}var B=V.exports=function(H){var K=this;c.Writable.call(K),K._opts=H,K._body=[],K._headers={},H.auth&&K.setHeader("Authorization","Basic "+new M(H.auth).toString("base64")),(0,A.default)(H.headers).forEach(function(U){K.setHeader(U,H.headers[U])});var Y,W=!0;if(H.mode==="disable-fetch"||"requestTimeout"in H&&!v.abortController)W=!1,Y=!0;else if(H.mode==="prefer-streaming")Y=!1;else if(H.mode==="allow-wrong-content-type")Y=!v.overrideMimeType;else if(!H.mode||H.mode==="default"||H.mode==="prefer-fast")Y=!0;else throw new Error("Invalid value for opts.mode");K._mode=T(Y,W),K._fetchTimer=null,K.on("finish",function(){K._onFinish()})};h(B,c.Writable),B.prototype.setHeader=function(H,K){var Y=this,W=H.toLowerCase();if(J.indexOf(W)!==-1)return;Y._headers[W]={name:H,value:K}},B.prototype.getHeader=function(H){var K=this._headers[H.toLowerCase()];return K?K.value:null},B.prototype.removeHeader=function(H){var K=this;delete K._headers[H.toLowerCase()]},B.prototype._onFinish=function(){var H=this;if(H._destroyed)return;var K=H._opts,Y=H._headers,W=null;K.method!=="GET"&&K.method!=="HEAD"&&(v.arraybuffer?W=m(M.concat(H._body)):v.blobConstructor?W=new l.Blob(H._body.map(function(X){return m(X)}),{type:(Y["content-type"]||{}).value||""}):W=M.concat(H._body).toString());var U=[];if((0,A.default)(Y).forEach(function(X){var ne=Y[X].name,he=Y[X].value;Array.isArray(he)?he.forEach(function(le){U.push([ne,le])}):U.push([ne,he])}),H._mode==="fetch"){var _=null,te=null;if(v.abortController){var q=new AbortController;_=q.signal,H._fetchAbortController=q,"requestTimeout"in K&&K.requestTimeout!==0&&(H._fetchTimer=l.setTimeout(function(){H.emit("requestTimeout"),H._fetchAbortController&&H._fetchAbortController.abort()},K.requestTimeout))}l.fetch(H._opts.url,{method:H._opts.method,headers:U,body:W||void 0,mode:"cors",credentials:K.withCredentials?"include":"same-origin",signal:_}).then(function(X){H._fetchResponse=X,H._connect()},function(X){l.clearTimeout(H._fetchTimer),H._destroyed||H.emit("error",X)})}else{var w=H._xhr=new l.XMLHttpRequest;try{w.open(H._opts.method,H._opts.url,!0)}catch(X){y.nextTick(function(){H.emit("error",X)});return}"responseType"in w&&(w.responseType=H._mode.split(":")[0]),"withCredentials"in w&&(w.withCredentials=!!K.withCredentials),H._mode==="text"&&"overrideMimeType"in w&&w.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in K&&(w.timeout=K.requestTimeout,w.ontimeout=function(){H.emit("requestTimeout")}),U.forEach(function(X){w.setRequestHeader(X[0],X[1])}),H._response=null,w.onreadystatechange=function(){switch(w.readyState){case g.LOADING:case g.DONE:H._onXHRProgress();break}},H._mode==="moz-chunked-arraybuffer"&&(w.onprogress=function(){H._onXHRProgress()}),w.onerror=function(){if(H._destroyed)return;H.emit("error",new Error("XHR error"))};try{w.send(W)}catch(X){y.nextTick(function(){H.emit("error",X)});return}}};function F(H){try{var K=H.status;return K!==null&&K!==0}catch(Y){return!1}}B.prototype._onXHRProgress=function(){var H=this;if(!F(H._xhr)||H._destroyed)return;H._response||H._connect(),H._response._onXHRProgress()},B.prototype._connect=function(){var H=this;if(H._destroyed)return;H._response=new C(H._xhr,H._fetchResponse,H._mode,H._fetchTimer),H._response.on("error",function(K){H.emit("error",K)}),H.emit("response",H._response)},B.prototype._write=function(H,K,Y){var W=this;W._body.push(H),Y()},B.prototype.abort=B.prototype.destroy=function(){var H=this;H._destroyed=!0,l.clearTimeout(H._fetchTimer),H._response&&(H._response._destroyed=!0),H._xhr?H._xhr.abort():H._fetchAbortController&&H._fetchAbortController.abort()},B.prototype.end=function(H,K,Y){var W=this;typeof H=="function"&&(Y=H,H=void 0),c.Writable.prototype.end.call(W,H,K,Y)},B.prototype.flushHeaders=function(){},B.prototype.setTimeout=function(){},B.prototype.setNoDelay=function(){},B.prototype.setSocketKeepAlive=function(){};var J=["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,d("_process"),typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{},d("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(d,V,O){(function(y,l,M){"use strict";var D=d("babel-runtime/core-js/promise"),A=x(D);function x(C){return C&&C.__esModule?C:{default:C}}var v=d("./capability"),h=d("inherits"),p=d("readable-stream"),c=O.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},m=O.IncomingMessage=function(C,g,T,B){var F=this;if(p.Readable.call(F),F._mode=T,F.headers={},F.rawHeaders=[],F.trailers={},F.rawTrailers=[],F.on("end",function(){y.nextTick(function(){F.emit("close")})}),T==="fetch"){var J=function _(){K.read().then(function(te){if(F._destroyed)return;if(te.done){l.clearTimeout(B),F.push(null);return}F.push(new M(te.value)),_()}).catch(function(te){l.clearTimeout(B),F._destroyed||F.emit("error",te)})};if(F._fetchResponse=g,F.url=g.url,F.statusCode=g.status,F.statusMessage=g.statusText,g.headers.forEach(function(_,te){F.headers[te.toLowerCase()]=_,F.rawHeaders.push(te,_)}),v.writableStream){var H=new WritableStream({write:function(te){return new A.default(function(q,w){F._destroyed?w():F.push(new M(te))?q():F._resumeFetch=q})},close:function(){l.clearTimeout(B),F._destroyed||F.push(null)},abort:function(te){F._destroyed||F.emit("error",te)}});try{g.body.pipeTo(H).catch(function(_){l.clearTimeout(B),F._destroyed||F.emit("error",_)});return}catch(_){}}var K=g.body.getReader();J()}else{F._xhr=C,F._pos=0,F.url=C.responseURL,F.statusCode=C.status,F.statusMessage=C.statusText;var Y=C.getAllResponseHeaders().split(/\r?\n/);if(Y.forEach(function(_){var te=_.match(/^([^:]+):\s*(.*)/);if(te){var q=te[1].toLowerCase();q==="set-cookie"?(F.headers[q]===void 0&&(F.headers[q]=[]),F.headers[q].push(te[2])):F.headers[q]!==void 0?F.headers[q]+=", "+te[2]:F.headers[q]=te[2],F.rawHeaders.push(te[1],te[2])}}),F._charset="x-user-defined",!v.overrideMimeType){var W=F.rawHeaders["mime-type"];if(W){var U=W.match(/;\s*charset=([^;])(;|$)/);U&&(F._charset=U[1].toLowerCase())}F._charset||(F._charset="utf-8")}}};h(m,p.Readable),m.prototype._read=function(){var C=this,g=C._resumeFetch;g&&(C._resumeFetch=null,g())},m.prototype._onXHRProgress=function(){var C=this,g=C._xhr,T=null;switch(C._mode){case"text:vbarray":if(g.readyState!==c.DONE)break;try{T=new l.VBArray(g.responseBody).toArray()}catch(K){}if(T!==null){C.push(new M(T));break}case"text":try{T=g.responseText}catch(K){C._mode="text:vbarray";break}if(T.length>C._pos){var B=T.substr(C._pos);if(C._charset==="x-user-defined"){for(var F=new M(B.length),J=0;J<B.length;J++)F[J]=B.charCodeAt(J)&255;C.push(F)}else C.push(B,C._charset);C._pos=T.length}break;case"arraybuffer":if(g.readyState!==c.DONE||!g.response)break;T=g.response,C.push(new M(new Uint8Array(T)));break;case"moz-chunked-arraybuffer":if(T=g.response,g.readyState!==c.LOADING||!T)break;C.push(new M(new Uint8Array(T)));break;case"ms-stream":if(T=g.response,g.readyState!==c.LOADING)break;var H=new l.MSStreamReader;H.onprogress=function(){H.result.byteLength>C._pos&&(C.push(new M(new Uint8Array(H.result.slice(C._pos)))),C._pos=H.result.byteLength)},H.onload=function(){C.push(null)},H.readAsArrayBuffer(T);break}C._xhr.readyState===c.DONE&&C._mode!=="ms-stream"&&C.push(null)}}).call(this,d("_process"),typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{},d("buffer").Buffer)},{"./capability":232,_process:208,"babel-runtime/core-js/promise":61,buffer:73,inherits:196,"readable-stream":223}],235:[function(d,V,O){"use strict";var y=d("safe-buffer").Buffer,l=y.isEncoding||function(H){H=""+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 M(H){if(!H)return"utf8";for(var K;;)switch(H){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 H;default:if(K)return;H=(""+H).toLowerCase(),K=!0}}function D(H){var K=M(H);if(typeof K!="string"&&(y.isEncoding===l||!l(H)))throw new Error("Unknown encoding: "+H);return K||H}O.StringDecoder=A;function A(H){this.encoding=D(H);var K;switch(this.encoding){case"utf16le":this.text=C,this.end=g,K=4;break;case"utf8":this.fillLast=p,K=4;break;case"base64":this.text=T,this.end=B,K=3;break;default:this.write=F,this.end=J;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=y.allocUnsafe(K)}A.prototype.write=function(H){if(H.length===0)return"";var K,Y;if(this.lastNeed){if(K=this.fillLast(H),K===void 0)return"";Y=this.lastNeed,this.lastNeed=0}else Y=0;return Y<H.length?K?K+this.text(H,Y):this.text(H,Y):K||""},A.prototype.end=m,A.prototype.text=c,A.prototype.fillLast=function(H){if(this.lastNeed<=H.length)return H.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);H.copy(this.lastChar,this.lastTotal-this.lastNeed,0,H.length),this.lastNeed-=H.length};function x(H){return H<=127?0:H>>5===6?2:H>>4===14?3:H>>3===30?4:H>>6===2?-1:-2}function v(H,K,Y){var W=K.length-1;if(W<Y)return 0;var U=x(K[W]);return U>=0?(U>0&&(H.lastNeed=U-1),U):--W<Y||U===-2?0:(U=x(K[W]),U>=0?(U>0&&(H.lastNeed=U-2),U):--W<Y||U===-2?0:(U=x(K[W]),U>=0?(U>0&&(U===2?U=0:H.lastNeed=U-3),U):0))}function h(H,K,Y){if((K[0]&192)!==128)return H.lastNeed=0,"\uFFFD";if(H.lastNeed>1&&K.length>1){if((K[1]&192)!==128)return H.lastNeed=1,"\uFFFD";if(H.lastNeed>2&&K.length>2&&(K[2]&192)!==128)return H.lastNeed=2,"\uFFFD"}}function p(H){var K=this.lastTotal-this.lastNeed,Y=h(this,H,K);if(Y!==void 0)return Y;if(this.lastNeed<=H.length)return H.copy(this.lastChar,K,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);H.copy(this.lastChar,K,0,H.length),this.lastNeed-=H.length}function c(H,K){var Y=v(this,H,K);if(!this.lastNeed)return H.toString("utf8",K);this.lastTotal=Y;var W=H.length-(Y-this.lastNeed);return H.copy(this.lastChar,0,W),H.toString("utf8",K,W)}function m(H){var K=H&&H.length?this.write(H):"";return this.lastNeed?K+"\uFFFD":K}function C(H,K){if((H.length-K)%2===0){var Y=H.toString("utf16le",K);if(Y){var W=Y.charCodeAt(Y.length-1);if(W>=55296&&W<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=H[H.length-2],this.lastChar[1]=H[H.length-1],Y.slice(0,-1)}return Y}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=H[H.length-1],H.toString("utf16le",K,H.length-1)}function g(H){var K=H&&H.length?this.write(H):"";if(this.lastNeed){var Y=this.lastTotal-this.lastNeed;return K+this.lastChar.toString("utf16le",0,Y)}return K}function T(H,K){var Y=(H.length-K)%3;return Y===0?H.toString("base64",K):(this.lastNeed=3-Y,this.lastTotal=3,Y===1?this.lastChar[0]=H[H.length-1]:(this.lastChar[0]=H[H.length-2],this.lastChar[1]=H[H.length-1]),H.toString("base64",K,H.length-Y))}function B(H){var K=H&&H.length?this.write(H):"";return this.lastNeed?K+this.lastChar.toString("base64",0,3-this.lastNeed):K}function F(H){return H.toString(this.encoding)}function J(H){return H&&H.length?this.write(H):""}},{"safe-buffer":228}],236:[function(d,V,O){(function(y,l){var M=d("process/browser.js").nextTick,D=Function.prototype.apply,A=Array.prototype.slice,x={},v=0;O.setTimeout=function(){return new h(D.call(setTimeout,window,arguments),clearTimeout)},O.setInterval=function(){return new h(D.call(setInterval,window,arguments),clearInterval)},O.clearTimeout=O.clearInterval=function(p){p.close()};function h(p,c){this._id=p,this._clearFn=c}h.prototype.unref=h.prototype.ref=function(){},h.prototype.close=function(){this._clearFn.call(window,this._id)},O.enroll=function(p,c){clearTimeout(p._idleTimeoutId),p._idleTimeout=c},O.unenroll=function(p){clearTimeout(p._idleTimeoutId),p._idleTimeout=-1},O._unrefActive=O.active=function(p){clearTimeout(p._idleTimeoutId);var c=p._idleTimeout;c>=0&&(p._idleTimeoutId=setTimeout(function(){p._onTimeout&&p._onTimeout()},c))},O.setImmediate=typeof y=="function"?y:function(p){var c=v++,m=arguments.length<2?!1:A.call(arguments,1);return x[c]=!0,M(function(){x[c]&&(m?p.apply(null,m):p.call(null),O.clearImmediate(c))}),c},O.clearImmediate=typeof l=="function"?l:function(p){delete x[p]}}).call(this,d("timers").setImmediate,d("timers").clearImmediate)},{"process/browser.js":208,timers:236}],237:[function(d,V,O){var y=d("buffer").Buffer;V.exports=function(l){if(l instanceof Uint8Array){if(l.byteOffset===0&&l.byteLength===l.buffer.byteLength)return l.buffer;if(typeof l.buffer.slice=="function")return l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength)}if(y.isBuffer(l)){for(var M=new Uint8Array(l.length),D=l.length,A=0;A<D;A++)M[A]=l[A];return M.buffer}else throw new Error("Argument must be a Buffer")}},{buffer:73}],238:[function(d,V,O){"use strict";var y=d("punycode"),l=d("./util");O.parse=K,O.resolve=W,O.resolveObject=U,O.format=Y,O.Url=M;function M(){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 D=/^([a-z0-9.+-]+:)/i,A=/:[0-9]*$/,x=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,v=["<",">",'"',"`"," ","\r",`
|
|
|
`," "],h=["{","}","|","\\","^","`"].concat(v),p=["'"].concat(h),c=["%","/","?",";","#"].concat(p),m=["/","?","#"],C=255,g=/^[+a-z0-9A-Z_-]{0,63}$/,T=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,B={javascript:!0,"javascript:":!0},F={javascript:!0,"javascript:":!0},J={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},H=d("querystring");function K(_,te,q){if(_&&l.isObject(_)&&_ instanceof M)return _;var w=new M;return w.parse(_,te,q),w}M.prototype.parse=function(_,te,q){if(!l.isString(_))throw new TypeError("Parameter 'url' must be a string, not "+typeof _);var w=_.indexOf("?"),X=w!==-1&&w<_.indexOf("#")?"?":"#",ne=_.split(X),he=/\\/g;ne[0]=ne[0].replace(he,"/"),_=ne.join(X);var le=_;if(le=le.trim(),!q&&_.split("#").length===1){var _e=x.exec(le);if(_e)return this.path=le,this.href=le,this.pathname=_e[1],_e[2]?(this.search=_e[2],te?this.query=H.parse(this.search.substr(1)):this.query=this.search.substr(1)):te&&(this.search="",this.query={}),this}var se=D.exec(le);if(se){se=se[0];var be=se.toLowerCase();this.protocol=be,le=le.substr(se.length)}if(q||se||le.match(/^\/\/[^@\/]+@[^@\/]+/)){var j=le.substr(0,2)==="//";j&&!(se&&F[se])&&(le=le.substr(2),this.slashes=!0)}if(!F[se]&&(j||se&&!J[se])){for(var Q=-1,L=0;L<m.length;L++){var re=le.indexOf(m[L]);re!==-1&&(Q===-1||re<Q)&&(Q=re)}var de,ee;Q===-1?ee=le.lastIndexOf("@"):ee=le.lastIndexOf("@",Q),ee!==-1&&(de=le.slice(0,ee),le=le.slice(ee+1),this.auth=decodeURIComponent(de)),Q=-1;for(var L=0;L<c.length;L++){var re=le.indexOf(c[L]);re!==-1&&(Q===-1||re<Q)&&(Q=re)}Q===-1&&(Q=le.length),this.host=le.slice(0,Q),le=le.slice(Q),this.parseHost(),this.hostname=this.hostname||"";var xe=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!xe)for(var Ne=this.hostname.split(/\./),L=0,Le=Ne.length;L<Le;L++){var Ge=Ne[L];if(!Ge)continue;if(!Ge.match(g)){for(var Qe="",Te=0,nt=Ge.length;Te<nt;Te++)Ge.charCodeAt(Te)>127?Qe+="x":Qe+=Ge[Te];if(!Qe.match(g)){var Ye=Ne.slice(0,L),Pe=Ne.slice(L+1),ke=Ge.match(T);ke&&(Ye.push(ke[1]),Pe.unshift(ke[2])),Pe.length&&(le="/"+Pe.join(".")+le),this.hostname=Ye.join(".");break}}}this.hostname.length>C?this.hostname="":this.hostname=this.hostname.toLowerCase(),xe||(this.hostname=y.toASCII(this.hostname));var Be=this.port?":"+this.port:"",ot=this.hostname||"";this.host=ot+Be,this.href+=this.host,xe&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),le[0]!=="/"&&(le="/"+le))}if(!B[be])for(var L=0,Le=p.length;L<Le;L++){var ve=p[L];if(le.indexOf(ve)===-1)continue;var ge=encodeURIComponent(ve);ge===ve&&(ge=escape(ve)),le=le.split(ve).join(ge)}var $e=le.indexOf("#");$e!==-1&&(this.hash=le.substr($e),le=le.slice(0,$e));var pe=le.indexOf("?");if(pe!==-1?(this.search=le.substr(pe),this.query=le.substr(pe+1),te&&(this.query=H.parse(this.query)),le=le.slice(0,pe)):te&&(this.search="",this.query={}),le&&(this.pathname=le),J[be]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var Be=this.pathname||"",Z=this.search||"";this.path=Be+Z}return this.href=this.format(),this};function Y(_){return l.isString(_)&&(_=K(_)),_ instanceof M?_.format():M.prototype.format.call(_)}M.prototype.format=function(){var _=this.auth||"";_&&(_=encodeURIComponent(_),_=_.replace(/%3A/i,":"),_+="@");var te=this.protocol||"",q=this.pathname||"",w=this.hash||"",X=!1,ne="";this.host?X=_+this.host:this.hostname&&(X=_+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(X+=":"+this.port)),this.query&&l.isObject(this.query)&&Object.keys(this.query).length&&(ne=H.stringify(this.query));var he=this.search||ne&&"?"+ne||"";return te&&te.substr(-1)!==":"&&(te+=":"),this.slashes||(!te||J[te])&&X!==!1?(X="//"+(X||""),q&&q.charAt(0)!=="/"&&(q="/"+q)):X||(X=""),w&&w.charAt(0)!=="#"&&(w="#"+w),he&&he.charAt(0)!=="?"&&(he="?"+he),q=q.replace(/[?#]/g,function(le){return encodeURIComponent(le)}),he=he.replace("#","%23"),te+X+q+he+w};function W(_,te){return K(_,!1,!0).resolve(te)}M.prototype.resolve=function(_){return this.resolveObject(K(_,!1,!0)).format()};function U(_,te){return _?K(_,!1,!0).resolveObject(te):te}M.prototype.resolveObject=function(_){if(l.isString(_)){var te=new M;te.parse(_,!1,!0),_=te}for(var q=new M,w=Object.keys(this),X=0;X<w.length;X++){var ne=w[X];q[ne]=this[ne]}if(q.hash=_.hash,_.href==="")return q.href=q.format(),q;if(_.slashes&&!_.protocol){for(var he=Object.keys(_),le=0;le<he.length;le++){var _e=he[le];_e!=="protocol"&&(q[_e]=_[_e])}return J[q.protocol]&&q.hostname&&!q.pathname&&(q.path=q.pathname="/"),q.href=q.format(),q}if(_.protocol&&_.protocol!==q.protocol){if(!J[_.protocol]){for(var se=Object.keys(_),be=0;be<se.length;be++){var j=se[be];q[j]=_[j]}return q.href=q.format(),q}if(q.protocol=_.protocol,!_.host&&!F[_.protocol]){for(var Le=(_.pathname||"").split("/");Le.length&&!(_.host=Le.shift()););_.host||(_.host=""),_.hostname||(_.hostname=""),Le[0]!==""&&Le.unshift(""),Le.length<2&&Le.unshift(""),q.pathname=Le.join("/")}else q.pathname=_.pathname;if(q.search=_.search,q.query=_.query,q.host=_.host||"",q.auth=_.auth,q.hostname=_.hostname||_.host,q.port=_.port,q.pathname||q.search){var Q=q.pathname||"",L=q.search||"";q.path=Q+L}return q.slashes=q.slashes||_.slashes,q.href=q.format(),q}var re=q.pathname&&q.pathname.charAt(0)==="/",de=_.host||_.pathname&&_.pathname.charAt(0)==="/",ee=de||re||q.host&&_.pathname,xe=ee,Ne=q.pathname&&q.pathname.split("/")||[],Le=_.pathname&&_.pathname.split("/")||[],Ge=q.protocol&&!J[q.protocol];if(Ge&&(q.hostname="",q.port=null,q.host&&(Ne[0]===""?Ne[0]=q.host:Ne.unshift(q.host)),q.host="",_.protocol&&(_.hostname=null,_.port=null,_.host&&(Le[0]===""?Le[0]=_.host:Le.unshift(_.host)),_.host=null),ee=ee&&(Le[0]===""||Ne[0]==="")),de)q.host=_.host||_.host===""?_.host:q.host,q.hostname=_.hostname||_.hostname===""?_.hostname:q.hostname,q.search=_.search,q.query=_.query,Ne=Le;else if(Le.length)Ne||(Ne=[]),Ne.pop(),Ne=Ne.concat(Le),q.search=_.search,q.query=_.query;else if(!l.isNullOrUndefined(_.search)){if(Ge){q.hostname=q.host=Ne.shift();var Qe=q.host&&q.host.indexOf("@")>0?q.host.split("@"):!1;Qe&&(q.auth=Qe.shift(),q.host=q.hostname=Qe.shift())}return q.search=_.search,q.query=_.query,(!l.isNull(q.pathname)||!l.isNull(q.search))&&(q.path=(q.pathname?q.pathname:"")+(q.search?q.search:"")),q.href=q.format(),q}if(!Ne.length)return q.pathname=null,q.search?q.path="/"+q.search:q.path=null,q.href=q.format(),q;for(var Te=Ne.slice(-1)[0],nt=(q.host||_.host||Ne.length>1)&&(Te==="."||Te==="..")||Te==="",Ye=0,Pe=Ne.length;Pe>=0;Pe--)Te=Ne[Pe],Te==="."?Ne.splice(Pe,1):Te===".."?(Ne.splice(Pe,1),Ye++):Ye&&(Ne.splice(Pe,1),Ye--);if(!ee&&!xe)for(;Ye--;Ye)Ne.unshift("..");ee&&Ne[0]!==""&&(!Ne[0]||Ne[0].charAt(0)!=="/")&&Ne.unshift(""),nt&&Ne.join("/").substr(-1)!=="/"&&Ne.push("");var ke=Ne[0]===""||Ne[0]&&Ne[0].charAt(0)==="/";if(Ge){q.hostname=q.host=ke?"":Ne.length?Ne.shift():"";var Qe=q.host&&q.host.indexOf("@")>0?q.host.split("@"):!1;Qe&&(q.auth=Qe.shift(),q.host=q.hostname=Qe.shift())}return ee=ee||q.host&&Ne.length,ee&&!ke&&Ne.unshift(""),Ne.length?q.pathname=Ne.join("/"):(q.pathname=null,q.path=null),(!l.isNull(q.pathname)||!l.isNull(q.search))&&(q.path=(q.pathname?q.pathname:"")+(q.search?q.search:"")),q.auth=_.auth||q.auth,q.slashes=q.slashes||_.slashes,q.href=q.format(),q},M.prototype.parseHost=function(){var _=this.host,te=A.exec(_);te&&(te=te[0],te!==":"&&(this.port=te.substr(1)),_=_.substr(0,_.length-te.length)),_&&(this.hostname=_)}},{"./util":239,punycode:209,querystring:212}],239:[function(d,V,O){"use strict";V.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(d,V,O){(function(y){V.exports=l;function l(D,A){if(M("noDeprecation"))return D;var x=!1;function v(){if(!x){if(M("throwDeprecation"))throw new Error(A);M("traceDeprecation")?console.trace(A):console.warn(A),x=!0}return D.apply(this,arguments)}return v}function M(D){try{if(!y.localStorage)return!1}catch(x){return!1}var A=y.localStorage[D];return A==null?!1:String(A).toLowerCase()==="true"}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],241:[function(d,V,O){typeof Object.create=="function"?V.exports=function(l,M){l.super_=M,l.prototype=Object.create(M.prototype,{constructor:{value:l,enumerable:!1,writable:!0,configurable:!0}})}:V.exports=function(l,M){l.super_=M;var D=function(){};D.prototype=M.prototype,l.prototype=new D,l.prototype.constructor=l}},{}],242:[function(d,V,O){V.exports=function(l){return l&&typeof l=="object"&&typeof l.copy=="function"&&typeof l.fill=="function"&&typeof l.readUInt8=="function"}},{}],243:[function(d,V,O){(function(y,l){var M=/%[sdj%]/g;O.format=function(Q){if(!W(Q)){for(var L=[],re=0;re<arguments.length;re++)L.push(x(arguments[re]));return L.join(" ")}for(var re=1,de=arguments,ee=de.length,xe=String(Q).replace(M,function(Le){if(Le==="%%")return"%";if(re>=ee)return Le;switch(Le){case"%s":return String(de[re++]);case"%d":return Number(de[re++]);case"%j":try{return JSON.stringify(de[re++])}catch(Ge){return"[Circular]"}default:return Le}}),Ne=de[re];re<ee;Ne=de[++re])H(Ne)||!q(Ne)?xe+=" "+Ne:xe+=" "+x(Ne);return xe},O.deprecate=function(Q,L){if(_(l.process))return function(){return O.deprecate(Q,L).apply(this,arguments)};if(y.noDeprecation===!0)return Q;var re=!1;function de(){if(!re){if(y.throwDeprecation)throw new Error(L);y.traceDeprecation?console.trace(L):console.error(L),re=!0}return Q.apply(this,arguments)}return de};var D={},A;O.debuglog=function(Q){if(_(A)&&(A=y.env.NODE_DEBUG||""),Q=Q.toUpperCase(),!D[Q])if(new RegExp("\\b"+Q+"\\b","i").test(A)){var L=y.pid;D[Q]=function(){var re=O.format.apply(O,arguments);console.error("%s %d: %s",Q,L,re)}}else D[Q]=function(){};return D[Q]};function x(Q,L){var re={seen:[],stylize:h};return arguments.length>=3&&(re.depth=arguments[2]),arguments.length>=4&&(re.colors=arguments[3]),J(L)?re.showHidden=L:L&&O._extend(re,L),_(re.showHidden)&&(re.showHidden=!1),_(re.depth)&&(re.depth=2),_(re.colors)&&(re.colors=!1),_(re.customInspect)&&(re.customInspect=!0),re.colors&&(re.stylize=v),c(re,Q,re.depth)}O.inspect=x,x.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]},x.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function v(Q,L){var re=x.styles[L];return re?"["+x.colors[re][0]+"m"+Q+"["+x.colors[re][1]+"m":Q}function h(Q,L){return Q}function p(Q){var L={};return Q.forEach(function(re,de){L[re]=!0}),L}function c(Q,L,re){if(Q.customInspect&&L&&ne(L.inspect)&&L.inspect!==O.inspect&&!(L.constructor&&L.constructor.prototype===L)){var de=L.inspect(re,Q);return W(de)||(de=c(Q,de,re)),de}var ee=m(Q,L);if(ee)return ee;var xe=Object.keys(L),Ne=p(xe);if(Q.showHidden&&(xe=Object.getOwnPropertyNames(L)),X(L)&&(xe.indexOf("message")>=0||xe.indexOf("description")>=0))return C(L);if(xe.length===0){if(ne(L)){var Le=L.name?": "+L.name:"";return Q.stylize("[Function"+Le+"]","special")}if(te(L))return Q.stylize(RegExp.prototype.toString.call(L),"regexp");if(w(L))return Q.stylize(Date.prototype.toString.call(L),"date");if(X(L))return C(L)}var Ge="",Qe=!1,Te=["{","}"];if(F(L)&&(Qe=!0,Te=["[","]"]),ne(L)){var nt=L.name?": "+L.name:"";Ge=" [Function"+nt+"]"}if(te(L)&&(Ge=" "+RegExp.prototype.toString.call(L)),w(L)&&(Ge=" "+Date.prototype.toUTCString.call(L)),X(L)&&(Ge=" "+C(L)),xe.length===0&&(!Qe||L.length==0))return Te[0]+Ge+Te[1];if(re<0)return te(L)?Q.stylize(RegExp.prototype.toString.call(L),"regexp"):Q.stylize("[Object]","special");Q.seen.push(L);var Ye;return Qe?Ye=g(Q,L,re,Ne,xe):Ye=xe.map(function(Pe){return T(Q,L,re,Ne,Pe,Qe)}),Q.seen.pop(),B(Ye,Ge,Te)}function m(Q,L){if(_(L))return Q.stylize("undefined","undefined");if(W(L)){var re="'"+JSON.stringify(L).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return Q.stylize(re,"string")}if(Y(L))return Q.stylize(""+L,"number");if(J(L))return Q.stylize(""+L,"boolean");if(H(L))return Q.stylize("null","null")}function C(Q){return"["+Error.prototype.toString.call(Q)+"]"}function g(Q,L,re,de,ee){for(var xe=[],Ne=0,Le=L.length;Ne<Le;++Ne)j(L,String(Ne))?xe.push(T(Q,L,re,de,String(Ne),!0)):xe.push("");return ee.forEach(function(Ge){Ge.match(/^\d+$/)||xe.push(T(Q,L,re,de,Ge,!0))}),xe}function T(Q,L,re,de,ee,xe){var Ne,Le,Ge;if(Ge=Object.getOwnPropertyDescriptor(L,ee)||{value:L[ee]},Ge.get?Ge.set?Le=Q.stylize("[Getter/Setter]","special"):Le=Q.stylize("[Getter]","special"):Ge.set&&(Le=Q.stylize("[Setter]","special")),j(de,ee)||(Ne="["+ee+"]"),Le||(Q.seen.indexOf(Ge.value)<0?(H(re)?Le=c(Q,Ge.value,null):Le=c(Q,Ge.value,re-1),Le.indexOf(`
|
|
|
`)>-1&&(xe?Le=Le.split(`
|
|
|
`).map(function(Qe){return" "+Qe}).join(`
|
|
|
`).substr(2):Le=`
|
|
|
`+Le.split(`
|
|
|
`).map(function(Qe){return" "+Qe}).join(`
|
|
|
`))):Le=Q.stylize("[Circular]","special")),_(Ne)){if(xe&&ee.match(/^\d+$/))return Le;Ne=JSON.stringify(""+ee),Ne.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(Ne=Ne.substr(1,Ne.length-2),Ne=Q.stylize(Ne,"name")):(Ne=Ne.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),Ne=Q.stylize(Ne,"string"))}return Ne+": "+Le}function B(Q,L,re){var de=0,ee=Q.reduce(function(xe,Ne){return de++,Ne.indexOf(`
|
|
|
`)>=0&&de++,xe+Ne.replace(/\u001b\[\d\d?m/g,"").length+1},0);return ee>60?re[0]+(L===""?"":L+`
|
|
|
`)+" "+Q.join(`,
|
|
|
`)+" "+re[1]:re[0]+L+" "+Q.join(", ")+" "+re[1]}function F(Q){return Array.isArray(Q)}O.isArray=F;function J(Q){return typeof Q=="boolean"}O.isBoolean=J;function H(Q){return Q===null}O.isNull=H;function K(Q){return Q==null}O.isNullOrUndefined=K;function Y(Q){return typeof Q=="number"}O.isNumber=Y;function W(Q){return typeof Q=="string"}O.isString=W;function U(Q){return typeof Q=="symbol"}O.isSymbol=U;function _(Q){return Q===void 0}O.isUndefined=_;function te(Q){return q(Q)&&le(Q)==="[object RegExp]"}O.isRegExp=te;function q(Q){return typeof Q=="object"&&Q!==null}O.isObject=q;function w(Q){return q(Q)&&le(Q)==="[object Date]"}O.isDate=w;function X(Q){return q(Q)&&(le(Q)==="[object Error]"||Q instanceof Error)}O.isError=X;function ne(Q){return typeof Q=="function"}O.isFunction=ne;function he(Q){return Q===null||typeof Q=="boolean"||typeof Q=="number"||typeof Q=="string"||typeof Q=="symbol"||typeof Q=="undefined"}O.isPrimitive=he,O.isBuffer=d("./support/isBuffer");function le(Q){return Object.prototype.toString.call(Q)}function _e(Q){return Q<10?"0"+Q.toString(10):Q.toString(10)}var se=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function be(){var Q=new Date,L=[_e(Q.getHours()),_e(Q.getMinutes()),_e(Q.getSeconds())].join(":");return[Q.getDate(),se[Q.getMonth()],L].join(" ")}O.log=function(){console.log("%s - %s",be(),O.format.apply(O,arguments))},O.inherits=d("inherits"),O._extend=function(Q,L){if(!L||!q(L))return Q;for(var re=Object.keys(L),de=re.length;de--;)Q[re[de]]=L[re[de]];return Q};function j(Q,L){return Object.prototype.hasOwnProperty.call(Q,L)}}).call(this,d("_process"),typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./support/isBuffer":242,_process:208,inherits:241}],244:[function(d,V,O){"use strict";(function(){"use strict";O.stripBOM=function(y){return y[0]==="\uFEFF"?y.substring(1):y}}).call(void 0)},{}],245:[function(d,V,O){"use strict";var y=d("babel-runtime/helpers/typeof"),l=A(y),M=d("babel-runtime/core-js/object/keys"),D=A(M);function A(x){return x&&x.__esModule?x:{default:x}}(function(){"use strict";var x,v,h,p,c,m={}.hasOwnProperty;x=d("xmlbuilder"),v=d("./defaults").defaults,p=function(g){return typeof g=="string"&&(g.indexOf("&")>=0||g.indexOf(">")>=0||g.indexOf("<")>=0)},c=function(g){return"<![CDATA["+h(g)+"]]>"},h=function(g){return g.replace("]]>","]]]]><![CDATA[>")},O.Builder=function(){function C(g){var T,B,F;this.options={},B=v["0.2"];for(T in B){if(!m.call(B,T))continue;F=B[T],this.options[T]=F}for(T in g){if(!m.call(g,T))continue;F=g[T],this.options[T]=F}}return C.prototype.buildObject=function(g){var T,B,F,J,H;return T=this.options.attrkey,B=this.options.charkey,(0,D.default)(g).length===1&&this.options.rootName===v["0.2"].rootName?(H=(0,D.default)(g)[0],g=g[H]):H=this.options.rootName,F=function(K){return function(Y,W){var U,_,te,q,w,X;if((typeof W=="undefined"?"undefined":(0,l.default)(W))!=="object")K.options.cdata&&p(W)?Y.raw(c(W)):Y.txt(W);else if(Array.isArray(W))for(q in W){if(!m.call(W,q))continue;_=W[q];for(w in _)te=_[w],Y=F(Y.ele(w),te).up()}else for(w in W){if(!m.call(W,w))continue;if(_=W[w],w===T){if((typeof _=="undefined"?"undefined":(0,l.default)(_))==="object")for(U in _)X=_[U],Y=Y.att(U,X)}else if(w===B)K.options.cdata&&p(_)?Y=Y.raw(c(_)):Y=Y.txt(_);else if(Array.isArray(_))for(q in _){if(!m.call(_,q))continue;te=_[q],typeof te=="string"?K.options.cdata&&p(te)?Y=Y.ele(w).raw(c(te)).up():Y=Y.ele(w,te).up():Y=F(Y.ele(w),te).up()}else(typeof _=="undefined"?"undefined":(0,l.default)(_))==="object"?Y=F(Y.ele(w),_).up():typeof _=="string"&&K.options.cdata&&p(_)?Y=Y.ele(w).raw(c(_)).up():(_==null&&(_=""),Y=Y.ele(w,_.toString()).up())}return Y}}(this),J=x.create(H,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),F(J,g).end(this.options.renderOpts)},C}()}).call(void 0)},{"./defaults":246,"babel-runtime/core-js/object/keys":60,"babel-runtime/helpers/typeof":67,xmlbuilder:282}],246:[function(d,V,O){"use strict";(function(){O.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(d,V,O){"use strict";var y=d("babel-runtime/core-js/promise"),l=p(y),M=d("babel-runtime/core-js/object/get-own-property-names"),D=p(M),A=d("babel-runtime/core-js/object/keys"),x=p(A),v=d("babel-runtime/helpers/typeof"),h=p(v);function p(c){return c&&c.__esModule?c:{default:c}}(function(){"use strict";var c,m,C,g,T,B,F,J,H=function(U,_){return function(){return U.apply(_,arguments)}},K=function(U,_){for(var te in _)Y.call(_,te)&&(U[te]=_[te]);function q(){this.constructor=U}return q.prototype=_.prototype,U.prototype=new q,U.__super__=_.prototype,U},Y={}.hasOwnProperty;F=d("sax"),C=d("events"),c=d("./bom"),B=d("./processors"),J=d("timers").setImmediate,m=d("./defaults").defaults,g=function(U){return(typeof U=="undefined"?"undefined":(0,h.default)(U))==="object"&&U!=null&&(0,x.default)(U).length===0},T=function(U,_,te){var q,w,X;for(q=0,w=U.length;q<w;q++)X=U[q],_=X(_,te);return _},O.Parser=function(W){K(U,W);function U(_){this.parseStringPromise=H(this.parseStringPromise,this),this.parseString=H(this.parseString,this),this.reset=H(this.reset,this),this.assignOrPush=H(this.assignOrPush,this),this.processAsync=H(this.processAsync,this);var te,q,w;if(!(this instanceof O.Parser))return new O.Parser(_);this.options={},q=m["0.2"];for(te in q){if(!Y.call(q,te))continue;w=q[te],this.options[te]=w}for(te in _){if(!Y.call(_,te))continue;w=_[te],this.options[te]=w}this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(B.normalize)),this.reset()}return U.prototype.processAsync=function(){var _,te;try{return this.remaining.length<=this.options.chunkSize?(_=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(_),this.saxParser.close()):(_=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(_),J(this.processAsync))}catch(q){if(te=q,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(te)}},U.prototype.assignOrPush=function(_,te,q){return te in _?(_[te]instanceof Array||(_[te]=[_[te]]),_[te].push(q)):this.options.explicitArray?_[te]=[q]:_[te]=q},U.prototype.reset=function(){var _,te,q,w;return this.removeAllListeners(),this.saxParser=F.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(X){return function(ne){if(X.saxParser.resume(),!X.saxParser.errThrown)return X.saxParser.errThrown=!0,X.emit("error",ne)}}(this),this.saxParser.onend=function(X){return function(){if(!X.saxParser.ended)return X.saxParser.ended=!0,X.emit("end",X.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,w=[],_=this.options.attrkey,te=this.options.charkey,this.saxParser.onopentag=function(X){return function(ne){var he,le,_e,se,be;if(_e={},_e[te]="",!X.options.ignoreAttrs){be=ne.attributes;for(he in be){if(!Y.call(be,he))continue;!(_ in _e)&&!X.options.mergeAttrs&&(_e[_]={}),le=X.options.attrValueProcessors?T(X.options.attrValueProcessors,ne.attributes[he],he):ne.attributes[he],se=X.options.attrNameProcessors?T(X.options.attrNameProcessors,he):he,X.options.mergeAttrs?X.assignOrPush(_e,se,le):_e[_][se]=le}}return _e["#name"]=X.options.tagNameProcessors?T(X.options.tagNameProcessors,ne.name):ne.name,X.options.xmlns&&(_e[X.options.xmlnskey]={uri:ne.uri,local:ne.local}),w.push(_e)}}(this),this.saxParser.onclosetag=function(X){return function(){var ne,he,le,_e,se,be,j,Q,L,re;if(be=w.pop(),se=be["#name"],(!X.options.explicitChildren||!X.options.preserveChildrenOrder)&&delete be["#name"],be.cdata===!0&&(ne=be.cdata,delete be.cdata),L=w[w.length-1],be[te].match(/^\s*$/)&&!ne?(he=be[te],delete be[te]):(X.options.trim&&(be[te]=be[te].trim()),X.options.normalize&&(be[te]=be[te].replace(/\s{2,}/g," ").trim()),be[te]=X.options.valueProcessors?T(X.options.valueProcessors,be[te],se):be[te],(0,x.default)(be).length===1&&te in be&&!X.EXPLICIT_CHARKEY&&(be=be[te])),g(be)&&(be=X.options.emptyTag!==""?X.options.emptyTag:he),X.options.validator!=null&&(re="/"+function(){var de,ee,xe;for(xe=[],de=0,ee=w.length;de<ee;de++)_e=w[de],xe.push(_e["#name"]);return xe}().concat(se).join("/"),function(){var de;try{return be=X.options.validator(re,L&&L[se],be)}catch(ee){return de=ee,X.emit("error",de)}}()),X.options.explicitChildren&&!X.options.mergeAttrs&&(typeof be=="undefined"?"undefined":(0,h.default)(be))==="object"){if(!X.options.preserveChildrenOrder)_e={},X.options.attrkey in be&&(_e[X.options.attrkey]=be[X.options.attrkey],delete be[X.options.attrkey]),!X.options.charsAsChildren&&X.options.charkey in be&&(_e[X.options.charkey]=be[X.options.charkey],delete be[X.options.charkey]),(0,D.default)(be).length>0&&(_e[X.options.childkey]=be),be=_e;else if(L){L[X.options.childkey]=L[X.options.childkey]||[],j={};for(le in be){if(!Y.call(be,le))continue;j[le]=be[le]}L[X.options.childkey].push(j),delete be["#name"],(0,x.default)(be).length===1&&te in be&&!X.EXPLICIT_CHARKEY&&(be=be[te])}}return w.length>0?X.assignOrPush(L,se,be):(X.options.explicitRoot&&(Q=be,be={},be[se]=Q),X.resultObject=be,X.saxParser.ended=!0,X.emit("end",X.resultObject))}}(this),q=function(X){return function(ne){var he,le;if(le=w[w.length-1],le)return le[te]+=ne,X.options.explicitChildren&&X.options.preserveChildrenOrder&&X.options.charsAsChildren&&(X.options.includeWhiteChars||ne.replace(/\\n/g,"").trim()!=="")&&(le[X.options.childkey]=le[X.options.childkey]||[],he={"#name":"__text__"},he[te]=ne,X.options.normalize&&(he[te]=he[te].replace(/\s{2,}/g," ").trim()),le[X.options.childkey].push(he)),le}}(this),this.saxParser.ontext=q,this.saxParser.oncdata=function(X){return function(ne){var he;if(he=q(ne),he)return he.cdata=!0}}(this)},U.prototype.parseString=function(_,te){var q;te!=null&&typeof te=="function"&&(this.on("end",function(w){return this.reset(),te(null,w)}),this.on("error",function(w){return this.reset(),te(w)}));try{return _=_.toString(),_.trim()===""?(this.emit("end",null),!0):(_=c.stripBOM(_),this.options.async?(this.remaining=_,J(this.processAsync),this.saxParser):this.saxParser.write(_).close())}catch(w){if(q=w,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw q}else return this.emit("error",q),this.saxParser.errThrown=!0}},U.prototype.parseStringPromise=function(_){return new l.default(function(te){return function(q,w){return te.parseString(_,function(X,ne){return X?w(X):q(ne)})}}(this))},U}(C),O.parseString=function(W,U,_){var te,q,w;return _!=null?(typeof _=="function"&&(te=_),(typeof U=="undefined"?"undefined":(0,h.default)(U))==="object"&&(q=U)):(typeof U=="function"&&(te=U),q={}),w=new O.Parser(q),w.parseString(W,te)},O.parseStringPromise=function(W,U){var _,te;return(typeof U=="undefined"?"undefined":(0,h.default)(U))==="object"&&(_=U),te=new O.Parser(_),te.parseStringPromise(W)}}).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(d,V,O){"use strict";(function(){"use strict";var y;y=new RegExp(/(?!xmlns)^.*:/),O.normalize=function(l){return l.toLowerCase()},O.firstCharLowerCase=function(l){return l.charAt(0).toLowerCase()+l.slice(1)},O.stripPrefix=function(l){return l.replace(y,"")},O.parseNumbers=function(l){return isNaN(l)||(l=l%1===0?parseInt(l,10):parseFloat(l)),l},O.parseBooleans=function(l){return/^(?:true|false)$/i.test(l)&&(l=l.toLowerCase()==="true"),l}}).call(void 0)},{}],249:[function(d,V,O){"use strict";(function(){"use strict";var y,l,M,D,A=function(h,p){for(var c in p)x.call(p,c)&&(h[c]=p[c]);function m(){this.constructor=h}return m.prototype=p.prototype,h.prototype=new m,h.__super__=p.prototype,h},x={}.hasOwnProperty;l=d("./defaults"),y=d("./builder"),M=d("./parser"),D=d("./processors"),O.defaults=l.defaults,O.processors=D,O.ValidationError=function(v){A(h,v);function h(p){this.message=p}return h}(Error),O.Builder=y.Builder,O.Parser=M.Parser,O.parseString=M.parseString,O.parseStringPromise=M.parseStringPromise}).call(void 0)},{"./builder":245,"./defaults":246,"./parser":247,"./processors":248}],250:[function(d,V,O){"use strict";(function(){V.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(void 0)},{}],251:[function(d,V,O){"use strict";(function(){V.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(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/get-prototype-of"),l=v(y),M=d("babel-runtime/helpers/typeof"),D=v(M),A=d("babel-runtime/core-js/object/assign"),x=v(A);function v(h){return h&&h.__esModule?h:{default:h}}(function(){var h,p,c,m,C,g,T,B=[].slice,F={}.hasOwnProperty;h=function(){var H,K,Y,W,U,_;if(_=arguments[0],U=2<=arguments.length?B.call(arguments,1):[],C(x.default))x.default.apply(null,arguments);else for(H=0,Y=U.length;H<Y;H++)if(W=U[H],W!=null)for(K in W){if(!F.call(W,K))continue;_[K]=W[K]}return _},C=function(H){return!!H&&Object.prototype.toString.call(H)==="[object Function]"},g=function(H){var K;return!!H&&((K=typeof H=="undefined"?"undefined":(0,D.default)(H))==="function"||K==="object")},c=function(H){return C(Array.isArray)?Array.isArray(H):Object.prototype.toString.call(H)==="[object Array]"},m=function(H){var K;if(c(H))return!H.length;for(K in H){if(!F.call(H,K))continue;return!1}return!0},T=function(H){var K,Y;return g(H)&&(Y=(0,l.default)(H))&&(K=Y.constructor)&&typeof K=="function"&&K instanceof K&&Function.prototype.toString.call(K)===Function.prototype.toString.call(Object)},p=function(H){return C(H.valueOf)?H.valueOf():H},V.exports.assign=h,V.exports.isFunction=C,V.exports.isObject=g,V.exports.isArray=c,V.exports.isEmpty=m,V.exports.isPlainObject=T,V.exports.getValue=p}).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(d,V,O){"use strict";(function(){V.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(void 0)},{}],254:[function(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/create"),l=M(y);function M(D){return D&&D.__esModule?D:{default:D}}(function(){var D,A,x;D=d("./NodeType"),x=d("./XMLNode"),V.exports=A=function(){function v(h,p,c){if(this.parent=h,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),p==null)throw new Error("Missing attribute name. "+this.debugInfo(p));this.name=this.stringify.name(p),this.value=this.stringify.attValue(c),this.type=D.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(v.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(v.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(v.prototype,"textContent",{get:function(){return this.value},set:function(p){return this.value=p||""}}),Object.defineProperty(v.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(v.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(v.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(v.prototype,"specified",{get:function(){return!0}}),v.prototype.clone=function(){return(0,l.default)(this)},v.prototype.toString=function(h){return this.options.writer.attribute(this,this.options.writer.filterOptions(h))},v.prototype.debugInfo=function(h){return h=h||this.name,h==null?"parent: <"+this.parent.name+">":"attribute: {"+h+"}, parent: <"+this.parent.name+">"},v.prototype.isEqualNode=function(h){return h.namespaceURI!==this.namespaceURI||(h.prefix!==this.prefix||h.localName!==this.localName)?!1:!(h.value!==this.value)},v}()}).call(void 0)},{"./NodeType":251,"./XMLNode":273,"babel-runtime/core-js/object/create":55}],255:[function(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/create"),l=M(y);function M(D){return D&&D.__esModule?D:{default:D}}(function(){var D,A,x,v=function(c,m){for(var C in m)h.call(m,C)&&(c[C]=m[C]);function g(){this.constructor=c}return g.prototype=m.prototype,c.prototype=new g,c.__super__=m.prototype,c},h={}.hasOwnProperty;D=d("./NodeType"),x=d("./XMLCharacterData"),V.exports=A=function(p){v(c,p);function c(m,C){if(c.__super__.constructor.call(this,m),C==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=D.CData,this.value=this.stringify.cdata(C)}return c.prototype.clone=function(){return(0,l.default)(this)},c.prototype.toString=function(m){return this.options.writer.cdata(this,this.options.writer.filterOptions(m))},c}(x)}).call(void 0)},{"./NodeType":251,"./XMLCharacterData":256,"babel-runtime/core-js/object/create":55}],256:[function(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/create"),l=M(y);function M(D){return D&&D.__esModule?D:{default:D}}(function(){var D,A,x=function(p,c){for(var m in c)v.call(c,m)&&(p[m]=c[m]);function C(){this.constructor=p}return C.prototype=c.prototype,p.prototype=new C,p.__super__=c.prototype,p},v={}.hasOwnProperty;A=d("./XMLNode"),V.exports=D=function(h){x(p,h);function p(c){p.__super__.constructor.call(this,c),this.value=""}return Object.defineProperty(p.prototype,"data",{get:function(){return this.value},set:function(m){return this.value=m||""}}),Object.defineProperty(p.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(p.prototype,"textContent",{get:function(){return this.value},set:function(m){return this.value=m||""}}),p.prototype.clone=function(){return(0,l.default)(this)},p.prototype.substringData=function(c,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.appendData=function(c){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.insertData=function(c,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.deleteData=function(c,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.replaceData=function(c,m,C){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.isEqualNode=function(c){return p.__super__.isEqualNode.apply(this,arguments).isEqualNode(c)?!(c.data!==this.data):!1},p}(A)}).call(void 0)},{"./XMLNode":273,"babel-runtime/core-js/object/create":55}],257:[function(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/create"),l=M(y);function M(D){return D&&D.__esModule?D:{default:D}}(function(){var D,A,x,v=function(c,m){for(var C in m)h.call(m,C)&&(c[C]=m[C]);function g(){this.constructor=c}return g.prototype=m.prototype,c.prototype=new g,c.__super__=m.prototype,c},h={}.hasOwnProperty;D=d("./NodeType"),A=d("./XMLCharacterData"),V.exports=x=function(p){v(c,p);function c(m,C){if(c.__super__.constructor.call(this,m),C==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=D.Comment,this.value=this.stringify.comment(C)}return c.prototype.clone=function(){return(0,l.default)(this)},c.prototype.toString=function(m){return this.options.writer.comment(this,this.options.writer.filterOptions(m))},c}(A)}).call(void 0)},{"./NodeType":251,"./XMLCharacterData":256,"babel-runtime/core-js/object/create":55}],258:[function(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/keys"),l=A(y),M=d("babel-runtime/core-js/object/create"),D=A(M);function A(x){return x&&x.__esModule?x:{default:x}}(function(){var x,v,h;v=d("./XMLDOMErrorHandler"),h=d("./XMLDOMStringList"),V.exports=x=function(){function p(){var c;this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new v,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=c=(0,D.default)(this.defaultParams)}return Object.defineProperty(p.prototype,"parameterNames",{get:function(){return new h((0,l.default)(this.defaultParams))}}),p.prototype.getParameter=function(c){return this.params.hasOwnProperty(c)?this.params[c]:null},p.prototype.canSetParameter=function(c,m){return!0},p.prototype.setParameter=function(c,m){return m!=null?this.params[c]=m:delete this.params[c]},p}()}).call(void 0)},{"./XMLDOMErrorHandler":259,"./XMLDOMStringList":261,"babel-runtime/core-js/object/create":55,"babel-runtime/core-js/object/keys":60}],259:[function(d,V,O){"use strict";(function(){var y;V.exports=y=function(){function l(){}return l.prototype.handleError=function(M){throw new Error(M)},l}()}).call(void 0)},{}],260:[function(d,V,O){"use strict";(function(){var y;V.exports=y=function(){function l(){}return l.prototype.hasFeature=function(M,D){return!0},l.prototype.createDocumentType=function(M,D,A){throw new Error("This DOM method is not implemented.")},l.prototype.createDocument=function(M,D,A){throw new Error("This DOM method is not implemented.")},l.prototype.createHTMLDocument=function(M){throw new Error("This DOM method is not implemented.")},l.prototype.getFeature=function(M,D){throw new Error("This DOM method is not implemented.")},l}()}).call(void 0)},{}],261:[function(d,V,O){"use strict";(function(){var y;V.exports=y=function(){function l(M){this.arr=M||[]}return Object.defineProperty(l.prototype,"length",{get:function(){return this.arr.length}}),l.prototype.item=function(M){return this.arr[M]||null},l.prototype.contains=function(M){return this.arr.indexOf(M)!==-1},l}()}).call(void 0)},{}],262:[function(d,V,O){"use strict";(function(){var y,l,M,D=function(v,h){for(var p in h)A.call(h,p)&&(v[p]=h[p]);function c(){this.constructor=v}return c.prototype=h.prototype,v.prototype=new c,v.__super__=h.prototype,v},A={}.hasOwnProperty;M=d("./XMLNode"),y=d("./NodeType"),V.exports=l=function(x){D(v,x);function v(h,p,c,m,C,g){if(v.__super__.constructor.call(this,h),p==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(c==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(p));if(!m)throw new Error("Missing DTD attribute type. "+this.debugInfo(p));if(!C)throw new Error("Missing DTD attribute default. "+this.debugInfo(p));if(C.indexOf("#")!==0&&(C="#"+C),!C.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(p));if(g&&!C.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(p));this.elementName=this.stringify.name(p),this.type=y.AttributeDeclaration,this.attributeName=this.stringify.name(c),this.attributeType=this.stringify.dtdAttType(m),g&&(this.defaultValue=this.stringify.dtdAttDefault(g)),this.defaultValueType=C}return v.prototype.toString=function(h){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(h))},v}(M)}).call(void 0)},{"./NodeType":251,"./XMLNode":273}],263:[function(d,V,O){"use strict";(function(){var y,l,M,D=function(v,h){for(var p in h)A.call(h,p)&&(v[p]=h[p]);function c(){this.constructor=v}return c.prototype=h.prototype,v.prototype=new c,v.__super__=h.prototype,v},A={}.hasOwnProperty;M=d("./XMLNode"),y=d("./NodeType"),V.exports=l=function(x){D(v,x);function v(h,p,c){if(v.__super__.constructor.call(this,h),p==null)throw new Error("Missing DTD element name. "+this.debugInfo());c||(c="(#PCDATA)"),Array.isArray(c)&&(c="("+c.join(",")+")"),this.name=this.stringify.name(p),this.type=y.ElementDeclaration,this.value=this.stringify.dtdElementValue(c)}return v.prototype.toString=function(h){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(h))},v}(M)}).call(void 0)},{"./NodeType":251,"./XMLNode":273}],264:[function(d,V,O){"use strict";(function(){var y,l,M,D,A=function(h,p){for(var c in p)x.call(p,c)&&(h[c]=p[c]);function m(){this.constructor=h}return m.prototype=p.prototype,h.prototype=new m,h.__super__=p.prototype,h},x={}.hasOwnProperty;D=d("./Utility").isObject,M=d("./XMLNode"),y=d("./NodeType"),V.exports=l=function(v){A(h,v);function h(p,c,m,C){if(h.__super__.constructor.call(this,p),m==null)throw new Error("Missing DTD entity name. "+this.debugInfo(m));if(C==null)throw new Error("Missing DTD entity value. "+this.debugInfo(m));if(this.pe=!!c,this.name=this.stringify.name(m),this.type=y.EntityDeclaration,!D(C))this.value=this.stringify.dtdEntityValue(C),this.internal=!0;else{if(!C.pubID&&!C.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(m));if(C.pubID&&!C.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(m));if(this.internal=!1,C.pubID!=null&&(this.pubID=this.stringify.dtdPubID(C.pubID)),C.sysID!=null&&(this.sysID=this.stringify.dtdSysID(C.sysID)),C.nData!=null&&(this.nData=this.stringify.dtdNData(C.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(m))}}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(p){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(p))},h}(M)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLNode":273}],265:[function(d,V,O){"use strict";(function(){var y,l,M,D=function(v,h){for(var p in h)A.call(h,p)&&(v[p]=h[p]);function c(){this.constructor=v}return c.prototype=h.prototype,v.prototype=new c,v.__super__=h.prototype,v},A={}.hasOwnProperty;M=d("./XMLNode"),y=d("./NodeType"),V.exports=l=function(x){D(v,x);function v(h,p,c){if(v.__super__.constructor.call(this,h),p==null)throw new Error("Missing DTD notation name. "+this.debugInfo(p));if(!c.pubID&&!c.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(p));this.name=this.stringify.name(p),this.type=y.NotationDeclaration,c.pubID!=null&&(this.pubID=this.stringify.dtdPubID(c.pubID)),c.sysID!=null&&(this.sysID=this.stringify.dtdSysID(c.sysID))}return Object.defineProperty(v.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(v.prototype,"systemId",{get:function(){return this.sysID}}),v.prototype.toString=function(h){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(h))},v}(M)}).call(void 0)},{"./NodeType":251,"./XMLNode":273}],266:[function(d,V,O){"use strict";(function(){var y,l,M,D,A=function(h,p){for(var c in p)x.call(p,c)&&(h[c]=p[c]);function m(){this.constructor=h}return m.prototype=p.prototype,h.prototype=new m,h.__super__=p.prototype,h},x={}.hasOwnProperty;D=d("./Utility").isObject,M=d("./XMLNode"),y=d("./NodeType"),V.exports=l=function(v){A(h,v);function h(p,c,m,C){var g;h.__super__.constructor.call(this,p),D(c)&&(g=c,c=g.version,m=g.encoding,C=g.standalone),c||(c="1.0"),this.type=y.Declaration,this.version=this.stringify.xmlVersion(c),m!=null&&(this.encoding=this.stringify.xmlEncoding(m)),C!=null&&(this.standalone=this.stringify.xmlStandalone(C))}return h.prototype.toString=function(p){return this.options.writer.declaration(this,this.options.writer.filterOptions(p))},h}(M)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLNode":273}],267:[function(d,V,O){"use strict";(function(){var y,l,M,D,A,x,v,h,p,c=function(g,T){for(var B in T)m.call(T,B)&&(g[B]=T[B]);function F(){this.constructor=g}return F.prototype=T.prototype,g.prototype=new F,g.__super__=T.prototype,g},m={}.hasOwnProperty;p=d("./Utility").isObject,h=d("./XMLNode"),y=d("./NodeType"),l=d("./XMLDTDAttList"),D=d("./XMLDTDEntity"),M=d("./XMLDTDElement"),A=d("./XMLDTDNotation"),v=d("./XMLNamedNodeMap"),V.exports=x=function(C){c(g,C);function g(T,B,F){var J,H,K,Y,W,U;if(g.__super__.constructor.call(this,T),this.type=y.DocType,T.children){for(Y=T.children,H=0,K=Y.length;H<K;H++)if(J=Y[H],J.type===y.Element){this.name=J.name;break}}this.documentObject=T,p(B)&&(W=B,B=W.pubID,F=W.sysID),F==null&&(U=[B,F],F=U[0],B=U[1]),B!=null&&(this.pubID=this.stringify.dtdPubID(B)),F!=null&&(this.sysID=this.stringify.dtdSysID(F))}return Object.defineProperty(g.prototype,"entities",{get:function(){var B,F,J,H,K;for(H={},K=this.children,F=0,J=K.length;F<J;F++)B=K[F],B.type===y.EntityDeclaration&&!B.pe&&(H[B.name]=B);return new v(H)}}),Object.defineProperty(g.prototype,"notations",{get:function(){var B,F,J,H,K;for(H={},K=this.children,F=0,J=K.length;F<J;F++)B=K[F],B.type===y.NotationDeclaration&&(H[B.name]=B);return new v(H)}}),Object.defineProperty(g.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(g.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(g.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),g.prototype.element=function(T,B){var F;return F=new M(this,T,B),this.children.push(F),this},g.prototype.attList=function(T,B,F,J,H){var K;return K=new l(this,T,B,F,J,H),this.children.push(K),this},g.prototype.entity=function(T,B){var F;return F=new D(this,!1,T,B),this.children.push(F),this},g.prototype.pEntity=function(T,B){var F;return F=new D(this,!0,T,B),this.children.push(F),this},g.prototype.notation=function(T,B){var F;return F=new A(this,T,B),this.children.push(F),this},g.prototype.toString=function(T){return this.options.writer.docType(this,this.options.writer.filterOptions(T))},g.prototype.ele=function(T,B){return this.element(T,B)},g.prototype.att=function(T,B,F,J,H){return this.attList(T,B,F,J,H)},g.prototype.ent=function(T,B){return this.entity(T,B)},g.prototype.pent=function(T,B){return this.pEntity(T,B)},g.prototype.not=function(T,B){return this.notation(T,B)},g.prototype.up=function(){return this.root()||this.documentObject},g.prototype.isEqualNode=function(T){return g.__super__.isEqualNode.apply(this,arguments).isEqualNode(T)?T.name!==this.name||T.publicId!==this.publicId?!1:!(T.systemId!==this.systemId):!1},g}(h)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLDTDAttList":262,"./XMLDTDElement":263,"./XMLDTDEntity":264,"./XMLDTDNotation":265,"./XMLNamedNodeMap":272,"./XMLNode":273}],268:[function(d,V,O){"use strict";(function(){var y,l,M,D,A,x,v,h,p=function(C,g){for(var T in g)c.call(g,T)&&(C[T]=g[T]);function B(){this.constructor=C}return B.prototype=g.prototype,C.prototype=new B,C.__super__=g.prototype,C},c={}.hasOwnProperty;h=d("./Utility").isPlainObject,M=d("./XMLDOMImplementation"),l=d("./XMLDOMConfiguration"),A=d("./XMLNode"),y=d("./NodeType"),v=d("./XMLStringifier"),x=d("./XMLStringWriter"),V.exports=D=function(m){p(C,m);function C(g){C.__super__.constructor.call(this,null),this.name="#document",this.type=y.Document,this.documentURI=null,this.domConfig=new l,g||(g={}),g.writer||(g.writer=new x),this.options=g,this.stringify=new v(g)}return Object.defineProperty(C.prototype,"implementation",{value:new M}),Object.defineProperty(C.prototype,"doctype",{get:function(){var T,B,F,J;for(J=this.children,B=0,F=J.length;B<F;B++)if(T=J[B],T.type===y.DocType)return T;return null}}),Object.defineProperty(C.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(C.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(C.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(C.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===y.Declaration?this.children[0].encoding:null}}),Object.defineProperty(C.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===y.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(C.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===y.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(C.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(C.prototype,"origin",{get:function(){return null}}),Object.defineProperty(C.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(C.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(C.prototype,"contentType",{get:function(){return null}}),C.prototype.end=function(g){var T;return T={},g?h(g)&&(T=g,g=this.options.writer):g=this.options.writer,g.document(this,g.filterOptions(T))},C.prototype.toString=function(g){return this.options.writer.document(this,this.options.writer.filterOptions(g))},C.prototype.createElement=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.createTextNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.createComment=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.createCDATASection=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.createProcessingInstruction=function(g,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.createAttribute=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.createEntityReference=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.getElementsByTagName=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.importNode=function(g,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.createElementNS=function(g,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.createAttributeNS=function(g,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.getElementsByTagNameNS=function(g,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.getElementById=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.adoptNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.renameNode=function(g,T,B){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.getElementsByClassName=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.createEvent=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.createNodeIterator=function(g,T,B){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.createTreeWalker=function(g,T,B){throw new Error("This DOM method is not implemented."+this.debugInfo())},C}(A)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLDOMConfiguration":258,"./XMLDOMImplementation":260,"./XMLNode":273,"./XMLStringWriter":278,"./XMLStringifier":279}],269:[function(d,V,O){"use strict";(function(){var y,l,M,D,A,x,v,h,p,c,m,C,g,T,B,F,J,H,K,Y,W,U,_,te,q={}.hasOwnProperty;te=d("./Utility"),U=te.isObject,W=te.isFunction,_=te.isPlainObject,Y=te.getValue,y=d("./NodeType"),C=d("./XMLDocument"),T=d("./XMLElement"),D=d("./XMLCData"),A=d("./XMLComment"),F=d("./XMLRaw"),K=d("./XMLText"),B=d("./XMLProcessingInstruction"),c=d("./XMLDeclaration"),m=d("./XMLDocType"),x=d("./XMLDTDAttList"),h=d("./XMLDTDEntity"),v=d("./XMLDTDElement"),p=d("./XMLDTDNotation"),M=d("./XMLAttribute"),H=d("./XMLStringifier"),J=d("./XMLStringWriter"),l=d("./WriterState"),V.exports=g=function(){function w(X,ne,he){var le;this.name="?xml",this.type=y.Document,X||(X={}),le={},X.writer?_(X.writer)&&(le=X.writer,X.writer=new J):X.writer=new J,this.options=X,this.writer=X.writer,this.writerOptions=this.writer.filterOptions(le),this.stringify=new H(X),this.onDataCallback=ne||function(){},this.onEndCallback=he||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return w.prototype.createChildNode=function(X){var ne,he,le,_e,se,be,j,Q;switch(X.type){case y.CData:this.cdata(X.value);break;case y.Comment:this.comment(X.value);break;case y.Element:le={},j=X.attribs;for(he in j){if(!q.call(j,he))continue;ne=j[he],le[he]=ne.value}this.node(X.name,le);break;case y.Dummy:this.dummy();break;case y.Raw:this.raw(X.value);break;case y.Text:this.text(X.value);break;case y.ProcessingInstruction:this.instruction(X.target,X.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+X.constructor.name)}for(Q=X.children,se=0,be=Q.length;se<be;se++)_e=Q[se],this.createChildNode(_e),_e.type===y.Element&&this.up();return this},w.prototype.dummy=function(){return this},w.prototype.node=function(X,ne,he){var le;if(X==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(X));return this.openCurrent(),X=Y(X),ne==null&&(ne={}),ne=Y(ne),U(ne)||(le=[ne,he],he=le[0],ne=le[1]),this.currentNode=new T(this,X,ne),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,he!=null&&this.text(he),this},w.prototype.element=function(X,ne,he){var le,_e,se,be,j,Q;if(this.currentNode&&this.currentNode.type===y.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(X)||U(X)||W(X))for(be=this.options.noValidation,this.options.noValidation=!0,Q=new C(this.options).element("TEMP_ROOT"),Q.element(X),this.options.noValidation=be,j=Q.children,_e=0,se=j.length;_e<se;_e++)le=j[_e],this.createChildNode(le),le.type===y.Element&&this.up();else this.node(X,ne,he);return this},w.prototype.attribute=function(X,ne){var he,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(X));if(X!=null&&(X=Y(X)),U(X))for(he in X){if(!q.call(X,he))continue;le=X[he],this.attribute(he,le)}else W(ne)&&(ne=ne.apply()),this.options.keepNullAttributes&&ne==null?this.currentNode.attribs[X]=new M(this,X,""):ne!=null&&(this.currentNode.attribs[X]=new M(this,X,ne));return this},w.prototype.text=function(X){var ne;return this.openCurrent(),ne=new K(this,X),this.onData(this.writer.text(ne,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},w.prototype.cdata=function(X){var ne;return this.openCurrent(),ne=new D(this,X),this.onData(this.writer.cdata(ne,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},w.prototype.comment=function(X){var ne;return this.openCurrent(),ne=new A(this,X),this.onData(this.writer.comment(ne,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},w.prototype.raw=function(X){var ne;return this.openCurrent(),ne=new F(this,X),this.onData(this.writer.raw(ne,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},w.prototype.instruction=function(X,ne){var he,le,_e,se,be;if(this.openCurrent(),X!=null&&(X=Y(X)),ne!=null&&(ne=Y(ne)),Array.isArray(X))for(he=0,se=X.length;he<se;he++)le=X[he],this.instruction(le);else if(U(X))for(le in X){if(!q.call(X,le))continue;_e=X[le],this.instruction(le,_e)}else W(ne)&&(ne=ne.apply()),be=new B(this,X,ne),this.onData(this.writer.processingInstruction(be,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},w.prototype.declaration=function(X,ne,he){var le;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return le=new c(this,X,ne,he),this.onData(this.writer.declaration(le,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},w.prototype.doctype=function(X,ne,he){if(this.openCurrent(),X==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 m(this,ne,he),this.currentNode.rootNodeName=X,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},w.prototype.dtdElement=function(X,ne){var he;return this.openCurrent(),he=new v(this,X,ne),this.onData(this.writer.dtdElement(he,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},w.prototype.attList=function(X,ne,he,le,_e){var se;return this.openCurrent(),se=new x(this,X,ne,he,le,_e),this.onData(this.writer.dtdAttList(se,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},w.prototype.entity=function(X,ne){var he;return this.openCurrent(),he=new h(this,!1,X,ne),this.onData(this.writer.dtdEntity(he,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},w.prototype.pEntity=function(X,ne){var he;return this.openCurrent(),he=new h(this,!0,X,ne),this.onData(this.writer.dtdEntity(he,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},w.prototype.notation=function(X,ne){var he;return this.openCurrent(),he=new p(this,X,ne),this.onData(this.writer.dtdNotation(he,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},w.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},w.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},w.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},w.prototype.openNode=function(X){var ne,he,le,_e;if(!X.isOpen){if(!this.root&&this.currentLevel===0&&X.type===y.Element&&(this.root=X),he="",X.type===y.Element){this.writerOptions.state=l.OpenTag,he=this.writer.indent(X,this.writerOptions,this.currentLevel)+"<"+X.name,_e=X.attribs;for(le in _e){if(!q.call(_e,le))continue;ne=_e[le],he+=this.writer.attribute(ne,this.writerOptions,this.currentLevel)}he+=(X.children?">":"/>")+this.writer.endline(X,this.writerOptions,this.currentLevel),this.writerOptions.state=l.InsideTag}else this.writerOptions.state=l.OpenTag,he=this.writer.indent(X,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+X.rootNodeName,X.pubID&&X.sysID?he+=' PUBLIC "'+X.pubID+'" "'+X.sysID+'"':X.sysID&&(he+=' SYSTEM "'+X.sysID+'"'),X.children?(he+=" [",this.writerOptions.state=l.InsideTag):(this.writerOptions.state=l.CloseTag,he+=">"),he+=this.writer.endline(X,this.writerOptions,this.currentLevel);return this.onData(he,this.currentLevel),X.isOpen=!0}},w.prototype.closeNode=function(X){var ne;if(!X.isClosed)return ne="",this.writerOptions.state=l.CloseTag,X.type===y.Element?ne=this.writer.indent(X,this.writerOptions,this.currentLevel)+"</"+X.name+">"+this.writer.endline(X,this.writerOptions,this.currentLevel):ne=this.writer.indent(X,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(X,this.writerOptions,this.currentLevel),this.writerOptions.state=l.None,this.onData(ne,this.currentLevel),X.isClosed=!0},w.prototype.onData=function(X,ne){return this.documentStarted=!0,this.onDataCallback(X,ne+1)},w.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},w.prototype.debugInfo=function(X){return X==null?"":"node: <"+X+">"},w.prototype.ele=function(){return this.element.apply(this,arguments)},w.prototype.nod=function(X,ne,he){return this.node(X,ne,he)},w.prototype.txt=function(X){return this.text(X)},w.prototype.dat=function(X){return this.cdata(X)},w.prototype.com=function(X){return this.comment(X)},w.prototype.ins=function(X,ne){return this.instruction(X,ne)},w.prototype.dec=function(X,ne,he){return this.declaration(X,ne,he)},w.prototype.dtd=function(X,ne,he){return this.doctype(X,ne,he)},w.prototype.e=function(X,ne,he){return this.element(X,ne,he)},w.prototype.n=function(X,ne,he){return this.node(X,ne,he)},w.prototype.t=function(X){return this.text(X)},w.prototype.d=function(X){return this.cdata(X)},w.prototype.c=function(X){return this.comment(X)},w.prototype.r=function(X){return this.raw(X)},w.prototype.i=function(X,ne){return this.instruction(X,ne)},w.prototype.att=function(){return this.currentNode&&this.currentNode.type===y.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},w.prototype.a=function(){return this.currentNode&&this.currentNode.type===y.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},w.prototype.ent=function(X,ne){return this.entity(X,ne)},w.prototype.pent=function(X,ne){return this.pEntity(X,ne)},w.prototype.not=function(X,ne){return this.notation(X,ne)},w}()}).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(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/create"),l=M(y);function M(D){return D&&D.__esModule?D:{default:D}}(function(){var D,A,x,v=function(c,m){for(var C in m)h.call(m,C)&&(c[C]=m[C]);function g(){this.constructor=c}return g.prototype=m.prototype,c.prototype=new g,c.__super__=m.prototype,c},h={}.hasOwnProperty;x=d("./XMLNode"),D=d("./NodeType"),V.exports=A=function(p){v(c,p);function c(m){c.__super__.constructor.call(this,m),this.type=D.Dummy}return c.prototype.clone=function(){return(0,l.default)(this)},c.prototype.toString=function(m){return""},c}(x)}).call(void 0)},{"./NodeType":251,"./XMLNode":273,"babel-runtime/core-js/object/create":55}],271:[function(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/create"),l=M(y);function M(D){return D&&D.__esModule?D:{default:D}}(function(){var D,A,x,v,h,p,c,m,C,g=function(F,J){for(var H in J)T.call(J,H)&&(F[H]=J[H]);function K(){this.constructor=F}return K.prototype=J.prototype,F.prototype=new K,F.__super__=J.prototype,F},T={}.hasOwnProperty;C=d("./Utility"),m=C.isObject,c=C.isFunction,p=C.getValue,h=d("./XMLNode"),D=d("./NodeType"),A=d("./XMLAttribute"),v=d("./XMLNamedNodeMap"),V.exports=x=function(B){g(F,B);function F(J,H,K){var Y,W,U,_;if(F.__super__.constructor.call(this,J),H==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(H),this.type=D.Element,this.attribs={},this.schemaTypeInfo=null,K!=null&&this.attribute(K),J.type===D.Document&&(this.isRoot=!0,this.documentObject=J,J.rootObject=this,J.children)){for(_=J.children,W=0,U=_.length;W<U;W++)if(Y=_[W],Y.type===D.DocType){Y.name=this.name;break}}}return Object.defineProperty(F.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(F.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(F.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(F.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(F.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(F.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(F.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(F.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new v(this.attribs)),this.attributeMap}}),F.prototype.clone=function(){var J,H,K,Y;K=(0,l.default)(this),K.isRoot&&(K.documentObject=null),K.attribs={},Y=this.attribs;for(H in Y){if(!T.call(Y,H))continue;J=Y[H],K.attribs[H]=J.clone()}return K.children=[],this.children.forEach(function(W){var U;return U=W.clone(),U.parent=K,K.children.push(U)}),K},F.prototype.attribute=function(J,H){var K,Y;if(J!=null&&(J=p(J)),m(J))for(K in J){if(!T.call(J,K))continue;Y=J[K],this.attribute(K,Y)}else c(H)&&(H=H.apply()),this.options.keepNullAttributes&&H==null?this.attribs[J]=new A(this,J,""):H!=null&&(this.attribs[J]=new A(this,J,H));return this},F.prototype.removeAttribute=function(J){var H,K,Y;if(J==null)throw new Error("Missing attribute name. "+this.debugInfo());if(J=p(J),Array.isArray(J))for(K=0,Y=J.length;K<Y;K++)H=J[K],delete this.attribs[H];else delete this.attribs[J];return this},F.prototype.toString=function(J){return this.options.writer.element(this,this.options.writer.filterOptions(J))},F.prototype.att=function(J,H){return this.attribute(J,H)},F.prototype.a=function(J,H){return this.attribute(J,H)},F.prototype.getAttribute=function(J){return this.attribs.hasOwnProperty(J)?this.attribs[J].value:null},F.prototype.setAttribute=function(J,H){throw new Error("This DOM method is not implemented."+this.debugInfo())},F.prototype.getAttributeNode=function(J){return this.attribs.hasOwnProperty(J)?this.attribs[J]:null},F.prototype.setAttributeNode=function(J){throw new Error("This DOM method is not implemented."+this.debugInfo())},F.prototype.removeAttributeNode=function(J){throw new Error("This DOM method is not implemented."+this.debugInfo())},F.prototype.getElementsByTagName=function(J){throw new Error("This DOM method is not implemented."+this.debugInfo())},F.prototype.getAttributeNS=function(J,H){throw new Error("This DOM method is not implemented."+this.debugInfo())},F.prototype.setAttributeNS=function(J,H,K){throw new Error("This DOM method is not implemented."+this.debugInfo())},F.prototype.removeAttributeNS=function(J,H){throw new Error("This DOM method is not implemented."+this.debugInfo())},F.prototype.getAttributeNodeNS=function(J,H){throw new Error("This DOM method is not implemented."+this.debugInfo())},F.prototype.setAttributeNodeNS=function(J){throw new Error("This DOM method is not implemented."+this.debugInfo())},F.prototype.getElementsByTagNameNS=function(J,H){throw new Error("This DOM method is not implemented."+this.debugInfo())},F.prototype.hasAttribute=function(J){return this.attribs.hasOwnProperty(J)},F.prototype.hasAttributeNS=function(J,H){throw new Error("This DOM method is not implemented."+this.debugInfo())},F.prototype.setIdAttribute=function(J,H){return this.attribs.hasOwnProperty(J)?this.attribs[J].isId:H},F.prototype.setIdAttributeNS=function(J,H,K){throw new Error("This DOM method is not implemented."+this.debugInfo())},F.prototype.setIdAttributeNode=function(J,H){throw new Error("This DOM method is not implemented."+this.debugInfo())},F.prototype.getElementsByTagName=function(J){throw new Error("This DOM method is not implemented."+this.debugInfo())},F.prototype.getElementsByTagNameNS=function(J,H){throw new Error("This DOM method is not implemented."+this.debugInfo())},F.prototype.getElementsByClassName=function(J){throw new Error("This DOM method is not implemented."+this.debugInfo())},F.prototype.isEqualNode=function(J){var H,K,Y;if(!F.__super__.isEqualNode.apply(this,arguments).isEqualNode(J))return!1;if(J.namespaceURI!==this.namespaceURI)return!1;if(J.prefix!==this.prefix)return!1;if(J.localName!==this.localName)return!1;if(J.attribs.length!==this.attribs.length)return!1;for(H=K=0,Y=this.attribs.length-1;0<=Y?K<=Y:K>=Y;H=0<=Y?++K:--K)if(!this.attribs[H].isEqualNode(J.attribs[H]))return!1;return!0},F}(h)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLAttribute":254,"./XMLNamedNodeMap":272,"./XMLNode":273,"babel-runtime/core-js/object/create":55}],272:[function(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/keys"),l=M(y);function M(D){return D&&D.__esModule?D:{default:D}}(function(){var D;V.exports=D=function(){function A(x){this.nodes=x}return Object.defineProperty(A.prototype,"length",{get:function(){return(0,l.default)(this.nodes).length||0}}),A.prototype.clone=function(){return this.nodes=null},A.prototype.getNamedItem=function(x){return this.nodes[x]},A.prototype.setNamedItem=function(x){var v;return v=this.nodes[x.nodeName],this.nodes[x.nodeName]=x,v||null},A.prototype.removeNamedItem=function(x){var v;return v=this.nodes[x],delete this.nodes[x],v||null},A.prototype.item=function(x){return this.nodes[(0,l.default)(this.nodes)[x]]||null},A.prototype.getNamedItemNS=function(x,v){throw new Error("This DOM method is not implemented.")},A.prototype.setNamedItemNS=function(x){throw new Error("This DOM method is not implemented.")},A.prototype.removeNamedItemNS=function(x,v){throw new Error("This DOM method is not implemented.")},A}()}).call(void 0)},{"babel-runtime/core-js/object/keys":60}],273:[function(d,V,O){"use strict";(function(){var y,l,M,D,A,x,v,h,p,c,m,C,g,T,B,F,J,H,K,Y={}.hasOwnProperty;K=d("./Utility"),H=K.isObject,J=K.isFunction,F=K.isEmpty,B=K.getValue,h=null,M=null,D=null,A=null,x=null,g=null,T=null,C=null,v=null,l=null,m=null,p=null,y=null,V.exports=c=function(){function W(U){this.parent=U,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,h||(h=d("./XMLElement"),M=d("./XMLCData"),D=d("./XMLComment"),A=d("./XMLDeclaration"),x=d("./XMLDocType"),g=d("./XMLRaw"),T=d("./XMLText"),C=d("./XMLProcessingInstruction"),v=d("./XMLDummy"),l=d("./NodeType"),m=d("./XMLNodeList"),p=d("./XMLNamedNodeMap"),y=d("./DocumentPosition"))}return Object.defineProperty(W.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(W.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(W.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(W.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(W.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new m(this.children)),this.childNodeList}}),Object.defineProperty(W.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(W.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(W.prototype,"previousSibling",{get:function(){var _;return _=this.parent.children.indexOf(this),this.parent.children[_-1]||null}}),Object.defineProperty(W.prototype,"nextSibling",{get:function(){var _;return _=this.parent.children.indexOf(this),this.parent.children[_+1]||null}}),Object.defineProperty(W.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(W.prototype,"textContent",{get:function(){var _,te,q,w,X;if(this.nodeType===l.Element||this.nodeType===l.DocumentFragment){for(X="",w=this.children,te=0,q=w.length;te<q;te++)_=w[te],_.textContent&&(X+=_.textContent);return X}else return null},set:function(_){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),W.prototype.setParent=function(U){var _,te,q,w,X;for(this.parent=U,U&&(this.options=U.options,this.stringify=U.stringify),w=this.children,X=[],te=0,q=w.length;te<q;te++)_=w[te],X.push(_.setParent(this));return X},W.prototype.element=function(U,_,te){var q,w,X,ne,he,le,_e,se,be,j,Q;if(le=null,_===null&&te==null&&(be=[{},null],_=be[0],te=be[1]),_==null&&(_={}),_=B(_),H(_)||(j=[_,te],te=j[0],_=j[1]),U!=null&&(U=B(U)),Array.isArray(U))for(X=0,_e=U.length;X<_e;X++)w=U[X],le=this.element(w);else if(J(U))le=this.element(U.apply());else if(H(U))for(he in U){if(!Y.call(U,he))continue;if(Q=U[he],J(Q)&&(Q=Q.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&he.indexOf(this.stringify.convertAttKey)===0)le=this.attribute(he.substr(this.stringify.convertAttKey.length),Q);else if(!this.options.separateArrayItems&&Array.isArray(Q)&&F(Q))le=this.dummy();else if(H(Q)&&F(Q))le=this.element(he);else if(!this.options.keepNullNodes&&Q==null)le=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(Q))for(ne=0,se=Q.length;ne<se;ne++)w=Q[ne],q={},q[he]=w,le=this.element(q);else H(Q)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&he.indexOf(this.stringify.convertTextKey)===0?le=this.element(Q):(le=this.element(he),le.element(Q)):le=this.element(he,Q)}else!this.options.keepNullNodes&&te===null?le=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&U.indexOf(this.stringify.convertTextKey)===0?le=this.text(te):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&U.indexOf(this.stringify.convertCDataKey)===0?le=this.cdata(te):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&U.indexOf(this.stringify.convertCommentKey)===0?le=this.comment(te):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&U.indexOf(this.stringify.convertRawKey)===0?le=this.raw(te):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&U.indexOf(this.stringify.convertPIKey)===0?le=this.instruction(U.substr(this.stringify.convertPIKey.length),te):le=this.node(U,_,te);if(le==null)throw new Error("Could not create any elements with: "+U+". "+this.debugInfo());return le},W.prototype.insertBefore=function(U,_,te){var q,w,X,ne,he;if(U!=null?U.type:void 0)return X=U,ne=_,X.setParent(this),ne?(w=children.indexOf(ne),he=children.splice(w),children.push(X),Array.prototype.push.apply(children,he)):children.push(X),X;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(U));return w=this.parent.children.indexOf(this),he=this.parent.children.splice(w),q=this.parent.element(U,_,te),Array.prototype.push.apply(this.parent.children,he),q},W.prototype.insertAfter=function(U,_,te){var q,w,X;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(U));return w=this.parent.children.indexOf(this),X=this.parent.children.splice(w+1),q=this.parent.element(U,_,te),Array.prototype.push.apply(this.parent.children,X),q},W.prototype.remove=function(){var U,_;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return U=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[U,U-U+1].concat(_=[])),this.parent},W.prototype.node=function(U,_,te){var q,w;return U!=null&&(U=B(U)),_||(_={}),_=B(_),H(_)||(w=[_,te],te=w[0],_=w[1]),q=new h(this,U,_),te!=null&&q.text(te),this.children.push(q),q},W.prototype.text=function(U){var _;return H(U)&&this.element(U),_=new T(this,U),this.children.push(_),this},W.prototype.cdata=function(U){var _;return _=new M(this,U),this.children.push(_),this},W.prototype.comment=function(U){var _;return _=new D(this,U),this.children.push(_),this},W.prototype.commentBefore=function(U){var _,te,q;return te=this.parent.children.indexOf(this),q=this.parent.children.splice(te),_=this.parent.comment(U),Array.prototype.push.apply(this.parent.children,q),this},W.prototype.commentAfter=function(U){var _,te,q;return te=this.parent.children.indexOf(this),q=this.parent.children.splice(te+1),_=this.parent.comment(U),Array.prototype.push.apply(this.parent.children,q),this},W.prototype.raw=function(U){var _;return _=new g(this,U),this.children.push(_),this},W.prototype.dummy=function(){var U;return U=new v(this),U},W.prototype.instruction=function(U,_){var te,q,w,X,ne;if(U!=null&&(U=B(U)),_!=null&&(_=B(_)),Array.isArray(U))for(X=0,ne=U.length;X<ne;X++)te=U[X],this.instruction(te);else if(H(U))for(te in U){if(!Y.call(U,te))continue;q=U[te],this.instruction(te,q)}else J(_)&&(_=_.apply()),w=new C(this,U,_),this.children.push(w);return this},W.prototype.instructionBefore=function(U,_){var te,q,w;return q=this.parent.children.indexOf(this),w=this.parent.children.splice(q),te=this.parent.instruction(U,_),Array.prototype.push.apply(this.parent.children,w),this},W.prototype.instructionAfter=function(U,_){var te,q,w;return q=this.parent.children.indexOf(this),w=this.parent.children.splice(q+1),te=this.parent.instruction(U,_),Array.prototype.push.apply(this.parent.children,w),this},W.prototype.declaration=function(U,_,te){var q,w;return q=this.document(),w=new A(q,U,_,te),q.children.length===0?q.children.unshift(w):q.children[0].type===l.Declaration?q.children[0]=w:q.children.unshift(w),q.root()||q},W.prototype.dtd=function(U,_){var te,q,w,X,ne,he,le,_e,se,be;for(q=this.document(),w=new x(q,U,_),se=q.children,X=ne=0,le=se.length;ne<le;X=++ne)if(te=se[X],te.type===l.DocType)return q.children[X]=w,w;for(be=q.children,X=he=0,_e=be.length;he<_e;X=++he)if(te=be[X],te.isRoot)return q.children.splice(X,0,w),w;return q.children.push(w),w},W.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},W.prototype.root=function(){var U;for(U=this;U;){if(U.type===l.Document)return U.rootObject;if(U.isRoot)return U;U=U.parent}},W.prototype.document=function(){var U;for(U=this;U;){if(U.type===l.Document)return U;U=U.parent}},W.prototype.end=function(U){return this.document().end(U)},W.prototype.prev=function(){var U;if(U=this.parent.children.indexOf(this),U<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[U-1]},W.prototype.next=function(){var U;if(U=this.parent.children.indexOf(this),U===-1||U===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[U+1]},W.prototype.importDocument=function(U){var _;return _=U.root().clone(),_.parent=this,_.isRoot=!1,this.children.push(_),this},W.prototype.debugInfo=function(U){var _,te;return U=U||this.name,U==null&&!((_=this.parent)!=null?_.name:void 0)?"":U==null?"parent: <"+this.parent.name+">":((te=this.parent)!=null?te.name:void 0)?"node: <"+U+">, parent: <"+this.parent.name+">":"node: <"+U+">"},W.prototype.ele=function(U,_,te){return this.element(U,_,te)},W.prototype.nod=function(U,_,te){return this.node(U,_,te)},W.prototype.txt=function(U){return this.text(U)},W.prototype.dat=function(U){return this.cdata(U)},W.prototype.com=function(U){return this.comment(U)},W.prototype.ins=function(U,_){return this.instruction(U,_)},W.prototype.doc=function(){return this.document()},W.prototype.dec=function(U,_,te){return this.declaration(U,_,te)},W.prototype.e=function(U,_,te){return this.element(U,_,te)},W.prototype.n=function(U,_,te){return this.node(U,_,te)},W.prototype.t=function(U){return this.text(U)},W.prototype.d=function(U){return this.cdata(U)},W.prototype.c=function(U){return this.comment(U)},W.prototype.r=function(U){return this.raw(U)},W.prototype.i=function(U,_){return this.instruction(U,_)},W.prototype.u=function(){return this.up()},W.prototype.importXMLBuilder=function(U){return this.importDocument(U)},W.prototype.replaceChild=function(U,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},W.prototype.removeChild=function(U){throw new Error("This DOM method is not implemented."+this.debugInfo())},W.prototype.appendChild=function(U){throw new Error("This DOM method is not implemented."+this.debugInfo())},W.prototype.hasChildNodes=function(){return this.children.length!==0},W.prototype.cloneNode=function(U){throw new Error("This DOM method is not implemented."+this.debugInfo())},W.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},W.prototype.isSupported=function(U,_){return!0},W.prototype.hasAttributes=function(){return this.attribs.length!==0},W.prototype.compareDocumentPosition=function(U){var _,te;return _=this,_===U?0:this.document()!==U.document()?(te=y.Disconnected|y.ImplementationSpecific,Math.random()<.5?te|=y.Preceding:te|=y.Following,te):_.isAncestor(U)?y.Contains|y.Preceding:_.isDescendant(U)?y.Contains|y.Following:_.isPreceding(U)?y.Preceding:y.Following},W.prototype.isSameNode=function(U){throw new Error("This DOM method is not implemented."+this.debugInfo())},W.prototype.lookupPrefix=function(U){throw new Error("This DOM method is not implemented."+this.debugInfo())},W.prototype.isDefaultNamespace=function(U){throw new Error("This DOM method is not implemented."+this.debugInfo())},W.prototype.lookupNamespaceURI=function(U){throw new Error("This DOM method is not implemented."+this.debugInfo())},W.prototype.isEqualNode=function(U){var _,te,q;if(U.nodeType!==this.nodeType)return!1;if(U.children.length!==this.children.length)return!1;for(_=te=0,q=this.children.length-1;0<=q?te<=q:te>=q;_=0<=q?++te:--te)if(!this.children[_].isEqualNode(U.children[_]))return!1;return!0},W.prototype.getFeature=function(U,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},W.prototype.setUserData=function(U,_,te){throw new Error("This DOM method is not implemented."+this.debugInfo())},W.prototype.getUserData=function(U){throw new Error("This DOM method is not implemented."+this.debugInfo())},W.prototype.contains=function(U){return U?U===this||this.isDescendant(U):!1},W.prototype.isDescendant=function(U){var _,te,q,w,X;for(X=this.children,q=0,w=X.length;q<w;q++){if(_=X[q],U===_)return!0;if(te=_.isDescendant(U),te)return!0}return!1},W.prototype.isAncestor=function(U){return U.isDescendant(this)},W.prototype.isPreceding=function(U){var _,te;return _=this.treePosition(U),te=this.treePosition(this),_===-1||te===-1?!1:_<te},W.prototype.isFollowing=function(U){var _,te;return _=this.treePosition(U),te=this.treePosition(this),_===-1||te===-1?!1:_>te},W.prototype.treePosition=function(U){var _,te;return te=0,_=!1,this.foreachTreeNode(this.document(),function(q){if(te++,!_&&q===U)return _=!0}),_?te:-1},W.prototype.foreachTreeNode=function(U,_){var te,q,w,X,ne;for(U||(U=this.document()),X=U.children,q=0,w=X.length;q<w;q++){if(te=X[q],ne=_(te))return ne;if(ne=this.foreachTreeNode(te,_),ne)return ne}},W}()}).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(d,V,O){"use strict";(function(){var y;V.exports=y=function(){function l(M){this.nodes=M}return Object.defineProperty(l.prototype,"length",{get:function(){return this.nodes.length||0}}),l.prototype.clone=function(){return this.nodes=null},l.prototype.item=function(M){return this.nodes[M]||null},l}()}).call(void 0)},{}],275:[function(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/create"),l=M(y);function M(D){return D&&D.__esModule?D:{default:D}}(function(){var D,A,x,v=function(c,m){for(var C in m)h.call(m,C)&&(c[C]=m[C]);function g(){this.constructor=c}return g.prototype=m.prototype,c.prototype=new g,c.__super__=m.prototype,c},h={}.hasOwnProperty;D=d("./NodeType"),A=d("./XMLCharacterData"),V.exports=x=function(p){v(c,p);function c(m,C,g){if(c.__super__.constructor.call(this,m),C==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=D.ProcessingInstruction,this.target=this.stringify.insTarget(C),this.name=this.target,g&&(this.value=this.stringify.insValue(g))}return c.prototype.clone=function(){return(0,l.default)(this)},c.prototype.toString=function(m){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(m))},c.prototype.isEqualNode=function(m){return c.__super__.isEqualNode.apply(this,arguments).isEqualNode(m)?!(m.target!==this.target):!1},c}(A)}).call(void 0)},{"./NodeType":251,"./XMLCharacterData":256,"babel-runtime/core-js/object/create":55}],276:[function(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/create"),l=M(y);function M(D){return D&&D.__esModule?D:{default:D}}(function(){var D,A,x,v=function(c,m){for(var C in m)h.call(m,C)&&(c[C]=m[C]);function g(){this.constructor=c}return g.prototype=m.prototype,c.prototype=new g,c.__super__=m.prototype,c},h={}.hasOwnProperty;D=d("./NodeType"),A=d("./XMLNode"),V.exports=x=function(p){v(c,p);function c(m,C){if(c.__super__.constructor.call(this,m),C==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=D.Raw,this.value=this.stringify.raw(C)}return c.prototype.clone=function(){return(0,l.default)(this)},c.prototype.toString=function(m){return this.options.writer.raw(this,this.options.writer.filterOptions(m))},c}(A)}).call(void 0)},{"./NodeType":251,"./XMLNode":273,"babel-runtime/core-js/object/create":55}],277:[function(d,V,O){"use strict";(function(){var y,l,M,D,A=function(h,p){for(var c in p)x.call(p,c)&&(h[c]=p[c]);function m(){this.constructor=h}return m.prototype=p.prototype,h.prototype=new m,h.__super__=p.prototype,h},x={}.hasOwnProperty;y=d("./NodeType"),D=d("./XMLWriterBase"),l=d("./WriterState"),V.exports=M=function(v){A(h,v);function h(p,c){this.stream=p,h.__super__.constructor.call(this,c)}return h.prototype.endline=function(p,c,m){return p.isLastRootNode&&c.state===l.CloseTag?"":h.__super__.endline.call(this,p,c,m)},h.prototype.document=function(p,c){var m,C,g,T,B,F,J,H,K;for(J=p.children,C=g=0,B=J.length;g<B;C=++g)m=J[C],m.isLastRootNode=C===p.children.length-1;for(c=this.filterOptions(c),H=p.children,K=[],T=0,F=H.length;T<F;T++)m=H[T],K.push(this.writeChildNode(m,c,0));return K},h.prototype.attribute=function(p,c,m){return this.stream.write(h.__super__.attribute.call(this,p,c,m))},h.prototype.cdata=function(p,c,m){return this.stream.write(h.__super__.cdata.call(this,p,c,m))},h.prototype.comment=function(p,c,m){return this.stream.write(h.__super__.comment.call(this,p,c,m))},h.prototype.declaration=function(p,c,m){return this.stream.write(h.__super__.declaration.call(this,p,c,m))},h.prototype.docType=function(p,c,m){var C,g,T,B;if(m||(m=0),this.openNode(p,c,m),c.state=l.OpenTag,this.stream.write(this.indent(p,c,m)),this.stream.write("<!DOCTYPE "+p.root().name),p.pubID&&p.sysID?this.stream.write(' PUBLIC "'+p.pubID+'" "'+p.sysID+'"'):p.sysID&&this.stream.write(' SYSTEM "'+p.sysID+'"'),p.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(p,c,m)),c.state=l.InsideTag,B=p.children,g=0,T=B.length;g<T;g++)C=B[g],this.writeChildNode(C,c,m+1);c.state=l.CloseTag,this.stream.write("]")}return c.state=l.CloseTag,this.stream.write(c.spaceBeforeSlash+">"),this.stream.write(this.endline(p,c,m)),c.state=l.None,this.closeNode(p,c,m)},h.prototype.element=function(p,c,m){var C,g,T,B,F,J,H,K,Y,W;m||(m=0),this.openNode(p,c,m),c.state=l.OpenTag,this.stream.write(this.indent(p,c,m)+"<"+p.name),Y=p.attribs;for(H in Y){if(!x.call(Y,H))continue;C=Y[H],this.attribute(C,c,m)}if(T=p.children.length,B=T===0?null:p.children[0],T===0||p.children.every(function(U){return(U.type===y.Text||U.type===y.Raw)&&U.value===""}))c.allowEmpty?(this.stream.write(">"),c.state=l.CloseTag,this.stream.write("</"+p.name+">")):(c.state=l.CloseTag,this.stream.write(c.spaceBeforeSlash+"/>"));else if(c.pretty&&T===1&&(B.type===y.Text||B.type===y.Raw)&&B.value!=null)this.stream.write(">"),c.state=l.InsideTag,c.suppressPrettyCount++,K=!0,this.writeChildNode(B,c,m+1),c.suppressPrettyCount--,K=!1,c.state=l.CloseTag,this.stream.write("</"+p.name+">");else{for(this.stream.write(">"+this.endline(p,c,m)),c.state=l.InsideTag,W=p.children,F=0,J=W.length;F<J;F++)g=W[F],this.writeChildNode(g,c,m+1);c.state=l.CloseTag,this.stream.write(this.indent(p,c,m)+"</"+p.name+">")}return this.stream.write(this.endline(p,c,m)),c.state=l.None,this.closeNode(p,c,m)},h.prototype.processingInstruction=function(p,c,m){return this.stream.write(h.__super__.processingInstruction.call(this,p,c,m))},h.prototype.raw=function(p,c,m){return this.stream.write(h.__super__.raw.call(this,p,c,m))},h.prototype.text=function(p,c,m){return this.stream.write(h.__super__.text.call(this,p,c,m))},h.prototype.dtdAttList=function(p,c,m){return this.stream.write(h.__super__.dtdAttList.call(this,p,c,m))},h.prototype.dtdElement=function(p,c,m){return this.stream.write(h.__super__.dtdElement.call(this,p,c,m))},h.prototype.dtdEntity=function(p,c,m){return this.stream.write(h.__super__.dtdEntity.call(this,p,c,m))},h.prototype.dtdNotation=function(p,c,m){return this.stream.write(h.__super__.dtdNotation.call(this,p,c,m))},h}(D)}).call(void 0)},{"./NodeType":251,"./WriterState":253,"./XMLWriterBase":281}],278:[function(d,V,O){"use strict";(function(){var y,l,M=function(x,v){for(var h in v)D.call(v,h)&&(x[h]=v[h]);function p(){this.constructor=x}return p.prototype=v.prototype,x.prototype=new p,x.__super__=v.prototype,x},D={}.hasOwnProperty;l=d("./XMLWriterBase"),V.exports=y=function(A){M(x,A);function x(v){x.__super__.constructor.call(this,v)}return x.prototype.document=function(v,h){var p,c,m,C,g;for(h=this.filterOptions(h),C="",g=v.children,c=0,m=g.length;c<m;c++)p=g[c],C+=this.writeChildNode(p,h,0);return h.pretty&&C.slice(-h.newline.length)===h.newline&&(C=C.slice(0,-h.newline.length)),C},x}(l)}).call(void 0)},{"./XMLWriterBase":281}],279:[function(d,V,O){"use strict";(function(){var y,l=function(A,x){return function(){return A.apply(x,arguments)}},M={}.hasOwnProperty;V.exports=y=function(){function D(A){this.assertLegalName=l(this.assertLegalName,this),this.assertLegalChar=l(this.assertLegalChar,this);var x,v,h;A||(A={}),this.options=A,this.options.version||(this.options.version="1.0"),v=A.stringify||{};for(x in v){if(!M.call(v,x))continue;h=v[x],this[x]=h}}return D.prototype.name=function(A){return this.options.noValidation?A:this.assertLegalName(""+A||"")},D.prototype.text=function(A){return this.options.noValidation?A:this.assertLegalChar(this.textEscape(""+A||""))},D.prototype.cdata=function(A){return this.options.noValidation?A:(A=""+A||"",A=A.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(A))},D.prototype.comment=function(A){if(this.options.noValidation)return A;if(A=""+A||"",A.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+A);return this.assertLegalChar(A)},D.prototype.raw=function(A){return this.options.noValidation?A:""+A||""},D.prototype.attValue=function(A){return this.options.noValidation?A:this.assertLegalChar(this.attEscape(A=""+A||""))},D.prototype.insTarget=function(A){return this.options.noValidation?A:this.assertLegalChar(""+A||"")},D.prototype.insValue=function(A){if(this.options.noValidation)return A;if(A=""+A||"",A.match(/\?>/))throw new Error("Invalid processing instruction value: "+A);return this.assertLegalChar(A)},D.prototype.xmlVersion=function(A){if(this.options.noValidation)return A;if(A=""+A||"",!A.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+A);return A},D.prototype.xmlEncoding=function(A){if(this.options.noValidation)return A;if(A=""+A||"",!A.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+A);return this.assertLegalChar(A)},D.prototype.xmlStandalone=function(A){return this.options.noValidation?A:A?"yes":"no"},D.prototype.dtdPubID=function(A){return this.options.noValidation?A:this.assertLegalChar(""+A||"")},D.prototype.dtdSysID=function(A){return this.options.noValidation?A:this.assertLegalChar(""+A||"")},D.prototype.dtdElementValue=function(A){return this.options.noValidation?A:this.assertLegalChar(""+A||"")},D.prototype.dtdAttType=function(A){return this.options.noValidation?A:this.assertLegalChar(""+A||"")},D.prototype.dtdAttDefault=function(A){return this.options.noValidation?A:this.assertLegalChar(""+A||"")},D.prototype.dtdEntityValue=function(A){return this.options.noValidation?A:this.assertLegalChar(""+A||"")},D.prototype.dtdNData=function(A){return this.options.noValidation?A:this.assertLegalChar(""+A||"")},D.prototype.convertAttKey="@",D.prototype.convertPIKey="?",D.prototype.convertTextKey="#text",D.prototype.convertCDataKey="#cdata",D.prototype.convertCommentKey="#comment",D.prototype.convertRawKey="#raw",D.prototype.assertLegalChar=function(A){var x,v;if(this.options.noValidation)return A;if(x="",this.options.version==="1.0"){if(x=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,v=A.match(x))throw new Error("Invalid character in string: "+A+" at index "+v.index)}else if(this.options.version==="1.1"&&(x=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,v=A.match(x)))throw new Error("Invalid character in string: "+A+" at index "+v.index);return A},D.prototype.assertLegalName=function(A){var x;if(this.options.noValidation)return A;if(this.assertLegalChar(A),x=/^([: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])*$/,!A.match(x))throw new Error("Invalid character in name");return A},D.prototype.textEscape=function(A){var x;return this.options.noValidation?A:(x=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,A.replace(x,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
"))},D.prototype.attEscape=function(A){var x;return this.options.noValidation?A:(x=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,A.replace(x,"&").replace(/</g,"<").replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
"))},D}()}).call(void 0)},{}],280:[function(d,V,O){"use strict";var y=d("babel-runtime/core-js/object/create"),l=M(y);function M(D){return D&&D.__esModule?D:{default:D}}(function(){var D,A,x,v=function(c,m){for(var C in m)h.call(m,C)&&(c[C]=m[C]);function g(){this.constructor=c}return g.prototype=m.prototype,c.prototype=new g,c.__super__=m.prototype,c},h={}.hasOwnProperty;D=d("./NodeType"),A=d("./XMLCharacterData"),V.exports=x=function(p){v(c,p);function c(m,C){if(c.__super__.constructor.call(this,m),C==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=D.Text,this.value=this.stringify.text(C)}return Object.defineProperty(c.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(c.prototype,"wholeText",{get:function(){var C,g,T;for(T="",g=this.previousSibling;g;)T=g.data+T,g=g.previousSibling;for(T+=this.data,C=this.nextSibling;C;)T=T+C.data,C=C.nextSibling;return T}}),c.prototype.clone=function(){return(0,l.default)(this)},c.prototype.toString=function(m){return this.options.writer.text(this,this.options.writer.filterOptions(m))},c.prototype.splitText=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.replaceWholeText=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},c}(A)}).call(void 0)},{"./NodeType":251,"./XMLCharacterData":256,"babel-runtime/core-js/object/create":55}],281:[function(d,V,O){"use strict";(function(){var y,l,M,D,A,x,v,h,p,c,m,C,g,T,B,F,J,H={}.hasOwnProperty;J=d("./Utility").assign,y=d("./NodeType"),p=d("./XMLDeclaration"),c=d("./XMLDocType"),M=d("./XMLCData"),D=d("./XMLComment"),C=d("./XMLElement"),T=d("./XMLRaw"),B=d("./XMLText"),g=d("./XMLProcessingInstruction"),m=d("./XMLDummy"),A=d("./XMLDTDAttList"),x=d("./XMLDTDElement"),v=d("./XMLDTDEntity"),h=d("./XMLDTDNotation"),l=d("./WriterState"),V.exports=F=function(){function K(Y){var W,U,_;Y||(Y={}),this.options=Y,U=Y.writer||{};for(W in U){if(!H.call(U,W))continue;_=U[W],this["_"+W]=this[W],this[W]=_}}return K.prototype.filterOptions=function(Y){var W,U,_,te,q,w,X,ne;return Y||(Y={}),Y=J({},this.options,Y),W={writer:this},W.pretty=Y.pretty||!1,W.allowEmpty=Y.allowEmpty||!1,W.indent=(U=Y.indent)!=null?U:" ",W.newline=(_=Y.newline)!=null?_:`
|
|
|
`,W.offset=(te=Y.offset)!=null?te:0,W.dontPrettyTextNodes=(q=(w=Y.dontPrettyTextNodes)!=null?w:Y.dontprettytextnodes)!=null?q:0,W.spaceBeforeSlash=(X=(ne=Y.spaceBeforeSlash)!=null?ne:Y.spacebeforeslash)!=null?X:"",W.spaceBeforeSlash===!0&&(W.spaceBeforeSlash=" "),W.suppressPrettyCount=0,W.user={},W.state=l.None,W},K.prototype.indent=function(Y,W,U){var _;return!W.pretty||W.suppressPrettyCount?"":W.pretty&&(_=(U||0)+W.offset+1,_>0)?new Array(_).join(W.indent):""},K.prototype.endline=function(Y,W,U){return!W.pretty||W.suppressPrettyCount?"":W.newline},K.prototype.attribute=function(Y,W,U){var _;return this.openAttribute(Y,W,U),_=" "+Y.name+'="'+Y.value+'"',this.closeAttribute(Y,W,U),_},K.prototype.cdata=function(Y,W,U){var _;return this.openNode(Y,W,U),W.state=l.OpenTag,_=this.indent(Y,W,U)+"<![CDATA[",W.state=l.InsideTag,_+=Y.value,W.state=l.CloseTag,_+="]]>"+this.endline(Y,W,U),W.state=l.None,this.closeNode(Y,W,U),_},K.prototype.comment=function(Y,W,U){var _;return this.openNode(Y,W,U),W.state=l.OpenTag,_=this.indent(Y,W,U)+"<!-- ",W.state=l.InsideTag,_+=Y.value,W.state=l.CloseTag,_+=" -->"+this.endline(Y,W,U),W.state=l.None,this.closeNode(Y,W,U),_},K.prototype.declaration=function(Y,W,U){var _;return this.openNode(Y,W,U),W.state=l.OpenTag,_=this.indent(Y,W,U)+"<?xml",W.state=l.InsideTag,_+=' version="'+Y.version+'"',Y.encoding!=null&&(_+=' encoding="'+Y.encoding+'"'),Y.standalone!=null&&(_+=' standalone="'+Y.standalone+'"'),W.state=l.CloseTag,_+=W.spaceBeforeSlash+"?>",_+=this.endline(Y,W,U),W.state=l.None,this.closeNode(Y,W,U),_},K.prototype.docType=function(Y,W,U){var _,te,q,w,X;if(U||(U=0),this.openNode(Y,W,U),W.state=l.OpenTag,w=this.indent(Y,W,U),w+="<!DOCTYPE "+Y.root().name,Y.pubID&&Y.sysID?w+=' PUBLIC "'+Y.pubID+'" "'+Y.sysID+'"':Y.sysID&&(w+=' SYSTEM "'+Y.sysID+'"'),Y.children.length>0){for(w+=" [",w+=this.endline(Y,W,U),W.state=l.InsideTag,X=Y.children,te=0,q=X.length;te<q;te++)_=X[te],w+=this.writeChildNode(_,W,U+1);W.state=l.CloseTag,w+="]"}return W.state=l.CloseTag,w+=W.spaceBeforeSlash+">",w+=this.endline(Y,W,U),W.state=l.None,this.closeNode(Y,W,U),w},K.prototype.element=function(Y,W,U){var _,te,q,w,X,ne,he,le,_e,se,be,j,Q,L;U||(U=0),se=!1,be="",this.openNode(Y,W,U),W.state=l.OpenTag,be+=this.indent(Y,W,U)+"<"+Y.name,j=Y.attribs;for(_e in j){if(!H.call(j,_e))continue;_=j[_e],be+=this.attribute(_,W,U)}if(q=Y.children.length,w=q===0?null:Y.children[0],q===0||Y.children.every(function(re){return(re.type===y.Text||re.type===y.Raw)&&re.value===""}))W.allowEmpty?(be+=">",W.state=l.CloseTag,be+="</"+Y.name+">"+this.endline(Y,W,U)):(W.state=l.CloseTag,be+=W.spaceBeforeSlash+"/>"+this.endline(Y,W,U));else if(W.pretty&&q===1&&(w.type===y.Text||w.type===y.Raw)&&w.value!=null)be+=">",W.state=l.InsideTag,W.suppressPrettyCount++,se=!0,be+=this.writeChildNode(w,W,U+1),W.suppressPrettyCount--,se=!1,W.state=l.CloseTag,be+="</"+Y.name+">"+this.endline(Y,W,U);else{if(W.dontPrettyTextNodes){for(Q=Y.children,X=0,he=Q.length;X<he;X++)if(te=Q[X],(te.type===y.Text||te.type===y.Raw)&&te.value!=null){W.suppressPrettyCount++,se=!0;break}}for(be+=">"+this.endline(Y,W,U),W.state=l.InsideTag,L=Y.children,ne=0,le=L.length;ne<le;ne++)te=L[ne],be+=this.writeChildNode(te,W,U+1);W.state=l.CloseTag,be+=this.indent(Y,W,U)+"</"+Y.name+">",se&&W.suppressPrettyCount--,be+=this.endline(Y,W,U),W.state=l.None}return this.closeNode(Y,W,U),be},K.prototype.writeChildNode=function(Y,W,U){switch(Y.type){case y.CData:return this.cdata(Y,W,U);case y.Comment:return this.comment(Y,W,U);case y.Element:return this.element(Y,W,U);case y.Raw:return this.raw(Y,W,U);case y.Text:return this.text(Y,W,U);case y.ProcessingInstruction:return this.processingInstruction(Y,W,U);case y.Dummy:return"";case y.Declaration:return this.declaration(Y,W,U);case y.DocType:return this.docType(Y,W,U);case y.AttributeDeclaration:return this.dtdAttList(Y,W,U);case y.ElementDeclaration:return this.dtdElement(Y,W,U);case y.EntityDeclaration:return this.dtdEntity(Y,W,U);case y.NotationDeclaration:return this.dtdNotation(Y,W,U);default:throw new Error("Unknown XML node type: "+Y.constructor.name)}},K.prototype.processingInstruction=function(Y,W,U){var _;return this.openNode(Y,W,U),W.state=l.OpenTag,_=this.indent(Y,W,U)+"<?",W.state=l.InsideTag,_+=Y.target,Y.value&&(_+=" "+Y.value),W.state=l.CloseTag,_+=W.spaceBeforeSlash+"?>",_+=this.endline(Y,W,U),W.state=l.None,this.closeNode(Y,W,U),_},K.prototype.raw=function(Y,W,U){var _;return this.openNode(Y,W,U),W.state=l.OpenTag,_=this.indent(Y,W,U),W.state=l.InsideTag,_+=Y.value,W.state=l.CloseTag,_+=this.endline(Y,W,U),W.state=l.None,this.closeNode(Y,W,U),_},K.prototype.text=function(Y,W,U){var _;return this.openNode(Y,W,U),W.state=l.OpenTag,_=this.indent(Y,W,U),W.state=l.InsideTag,_+=Y.value,W.state=l.CloseTag,_+=this.endline(Y,W,U),W.state=l.None,this.closeNode(Y,W,U),_},K.prototype.dtdAttList=function(Y,W,U){var _;return this.openNode(Y,W,U),W.state=l.OpenTag,_=this.indent(Y,W,U)+"<!ATTLIST",W.state=l.InsideTag,_+=" "+Y.elementName+" "+Y.attributeName+" "+Y.attributeType,Y.defaultValueType!=="#DEFAULT"&&(_+=" "+Y.defaultValueType),Y.defaultValue&&(_+=' "'+Y.defaultValue+'"'),W.state=l.CloseTag,_+=W.spaceBeforeSlash+">"+this.endline(Y,W,U),W.state=l.None,this.closeNode(Y,W,U),_},K.prototype.dtdElement=function(Y,W,U){var _;return this.openNode(Y,W,U),W.state=l.OpenTag,_=this.indent(Y,W,U)+"<!ELEMENT",W.state=l.InsideTag,_+=" "+Y.name+" "+Y.value,W.state=l.CloseTag,_+=W.spaceBeforeSlash+">"+this.endline(Y,W,U),W.state=l.None,this.closeNode(Y,W,U),_},K.prototype.dtdEntity=function(Y,W,U){var _;return this.openNode(Y,W,U),W.state=l.OpenTag,_=this.indent(Y,W,U)+"<!ENTITY",W.state=l.InsideTag,Y.pe&&(_+=" %"),_+=" "+Y.name,Y.value?_+=' "'+Y.value+'"':(Y.pubID&&Y.sysID?_+=' PUBLIC "'+Y.pubID+'" "'+Y.sysID+'"':Y.sysID&&(_+=' SYSTEM "'+Y.sysID+'"'),Y.nData&&(_+=" NDATA "+Y.nData)),W.state=l.CloseTag,_+=W.spaceBeforeSlash+">"+this.endline(Y,W,U),W.state=l.None,this.closeNode(Y,W,U),_},K.prototype.dtdNotation=function(Y,W,U){var _;return this.openNode(Y,W,U),W.state=l.OpenTag,_=this.indent(Y,W,U)+"<!NOTATION",W.state=l.InsideTag,_+=" "+Y.name,Y.pubID&&Y.sysID?_+=' PUBLIC "'+Y.pubID+'" "'+Y.sysID+'"':Y.pubID?_+=' PUBLIC "'+Y.pubID+'"':Y.sysID&&(_+=' SYSTEM "'+Y.sysID+'"'),W.state=l.CloseTag,_+=W.spaceBeforeSlash+">"+this.endline(Y,W,U),W.state=l.None,this.closeNode(Y,W,U),_},K.prototype.openNode=function(Y,W,U){},K.prototype.closeNode=function(Y,W,U){},K.prototype.openAttribute=function(Y,W,U){},K.prototype.closeAttribute=function(Y,W,U){},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(d,V,O){"use strict";(function(){var y,l,M,D,A,x,v,h,p,c;c=d("./Utility"),h=c.assign,p=c.isFunction,M=d("./XMLDOMImplementation"),D=d("./XMLDocument"),A=d("./XMLDocumentCB"),v=d("./XMLStringWriter"),x=d("./XMLStreamWriter"),y=d("./NodeType"),l=d("./WriterState"),V.exports.create=function(m,C,g,T){var B,F;if(m==null)throw new Error("Root element needs a name.");return T=h({},C,g,T),B=new D(T),F=B.element(m),T.headless||(B.declaration(T),(T.pubID!=null||T.sysID!=null)&&B.dtd(T)),F},V.exports.begin=function(m,C,g){var T;return p(m)&&(T=[m,C],C=T[0],g=T[1],m={}),C?new A(m,C,g):new D(m)},V.exports.stringWriter=function(m){return new v(m)},V.exports.streamWriter=function(m,C){return new x(m,C)},V.exports.implementation=new M,V.exports.nodeType=y,V.exports.writerState=l}).call(void 0)},{"./NodeType":251,"./Utility":252,"./WriterState":253,"./XMLDOMImplementation":260,"./XMLDocument":268,"./XMLDocumentCB":269,"./XMLStreamWriter":277,"./XMLStringWriter":278}],283:[function(d,V,O){V.exports=l;var y=Object.prototype.hasOwnProperty;function l(){for(var M={},D=0;D<arguments.length;D++){var A=arguments[D];for(var x in A)y.call(A,x)&&(M[x]=A[x])}return M}},{}],284:[function(d,V,O){"use strict";var y=d("buffer").Buffer,l=d("./sha"),M=d("./md5"),D={sha1:l,md5:M},A=64,x=y.alloc(A);x.fill(0);function v(c,m,C){y.isBuffer(m)||(m=y.from(m)),y.isBuffer(C)||(C=y.from(C)),m.length>A?m=c(m):m.length<A&&(m=y.concat([m,x],A));for(var g=y.alloc(A),T=y.alloc(A),B=0;B<A;B++)g[B]=m[B]^54,T[B]=m[B]^92;var F=c(y.concat([g,C]));return c(y.concat([T,F]))}function h(c,m){c=c||"sha1";var C=D[c],g=[],T=0;return C||p("algorithm:",c,"is not yet supported"),{update:function(F){return y.isBuffer(F)||(F=y.from(F)),g.push(F),T+=F.length,this},digest:function(F){var J=y.concat(g),H=m?v(C,m,J):C(J);return g=null,F?H.toString(F):H}}}function p(){var c=[].slice.call(arguments).join(" ");throw new Error([c,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(`
|
|
|
`))}O.createHash=function(c){return h(c)},O.createHmac=function(c,m){return h(c,m)},O.createCredentials=function(){p("sorry,createCredentials is not implemented yet")},O.createCipher=function(){p("sorry,createCipher is not implemented yet")},O.createCipheriv=function(){p("sorry,createCipheriv is not implemented yet")},O.createDecipher=function(){p("sorry,createDecipher is not implemented yet")},O.createDecipheriv=function(){p("sorry,createDecipheriv is not implemented yet")},O.createSign=function(){p("sorry,createSign is not implemented yet")},O.createVerify=function(){p("sorry,createVerify is not implemented yet")},O.createDiffieHellman=function(){p("sorry,createDiffieHellman is not implemented yet")},O.pbkdf2=function(){p("sorry,pbkdf2 is not implemented yet")}},{"./md5":286,"./sha":287,buffer:73}],285:[function(d,V,O){"use strict";var y=d("buffer").Buffer,l=4,M=y.alloc(l);M.fill(0);var D=8;function A(h,p){if(h.length%l!==0){var c=h.length+(l-h.length%l);h=y.concat([h,M],c)}for(var m=[],C=p?h.readInt32BE:h.readInt32LE,g=0;g<h.length;g+=l)m.push(C.call(h,g));return m}function x(h,p,c){for(var m=y.alloc(p),C=c?m.writeInt32BE:m.writeInt32LE,g=0;g<h.length;g++)C.call(m,h[g],g*4,!0);return m}function v(h,p,c,m){y.isBuffer(h)||(h=y.from(h));var C=p(A(h,m),h.length*D);return x(C,c,m)}V.exports={hash:v}},{buffer:73}],286:[function(d,V,O){"use strict";var y=d("./helpers");function l(){return hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72"}function M(m,C){m[C>>5]|=128<<C%32,m[(C+64>>>9<<4)+14]=C;for(var g=1732584193,T=-271733879,B=-1732584194,F=271733878,J=0;J<m.length;J+=16){var H=g,K=T,Y=B,W=F;g=A(g,T,B,F,m[J+0],7,-680876936),F=A(F,g,T,B,m[J+1],12,-389564586),B=A(B,F,g,T,m[J+2],17,606105819),T=A(T,B,F,g,m[J+3],22,-1044525330),g=A(g,T,B,F,m[J+4],7,-176418897),F=A(F,g,T,B,m[J+5],12,1200080426),B=A(B,F,g,T,m[J+6],17,-1473231341),T=A(T,B,F,g,m[J+7],22,-45705983),g=A(g,T,B,F,m[J+8],7,1770035416),F=A(F,g,T,B,m[J+9],12,-1958414417),B=A(B,F,g,T,m[J+10],17,-42063),T=A(T,B,F,g,m[J+11],22,-1990404162),g=A(g,T,B,F,m[J+12],7,1804603682),F=A(F,g,T,B,m[J+13],12,-40341101),B=A(B,F,g,T,m[J+14],17,-1502002290),T=A(T,B,F,g,m[J+15],22,1236535329),g=x(g,T,B,F,m[J+1],5,-165796510),F=x(F,g,T,B,m[J+6],9,-1069501632),B=x(B,F,g,T,m[J+11],14,643717713),T=x(T,B,F,g,m[J+0],20,-373897302),g=x(g,T,B,F,m[J+5],5,-701558691),F=x(F,g,T,B,m[J+10],9,38016083),B=x(B,F,g,T,m[J+15],14,-660478335),T=x(T,B,F,g,m[J+4],20,-405537848),g=x(g,T,B,F,m[J+9],5,568446438),F=x(F,g,T,B,m[J+14],9,-1019803690),B=x(B,F,g,T,m[J+3],14,-187363961),T=x(T,B,F,g,m[J+8],20,1163531501),g=x(g,T,B,F,m[J+13],5,-1444681467),F=x(F,g,T,B,m[J+2],9,-51403784),B=x(B,F,g,T,m[J+7],14,1735328473),T=x(T,B,F,g,m[J+12],20,-1926607734),g=v(g,T,B,F,m[J+5],4,-378558),F=v(F,g,T,B,m[J+8],11,-2022574463),B=v(B,F,g,T,m[J+11],16,1839030562),T=v(T,B,F,g,m[J+14],23,-35309556),g=v(g,T,B,F,m[J+1],4,-1530992060),F=v(F,g,T,B,m[J+4],11,1272893353),B=v(B,F,g,T,m[J+7],16,-155497632),T=v(T,B,F,g,m[J+10],23,-1094730640),g=v(g,T,B,F,m[J+13],4,681279174),F=v(F,g,T,B,m[J+0],11,-358537222),B=v(B,F,g,T,m[J+3],16,-722521979),T=v(T,B,F,g,m[J+6],23,76029189),g=v(g,T,B,F,m[J+9],4,-640364487),F=v(F,g,T,B,m[J+12],11,-421815835),B=v(B,F,g,T,m[J+15],16,530742520),T=v(T,B,F,g,m[J+2],23,-995338651),g=h(g,T,B,F,m[J+0],6,-198630844),F=h(F,g,T,B,m[J+7],10,1126891415),B=h(B,F,g,T,m[J+14],15,-1416354905),T=h(T,B,F,g,m[J+5],21,-57434055),g=h(g,T,B,F,m[J+12],6,1700485571),F=h(F,g,T,B,m[J+3],10,-1894986606),B=h(B,F,g,T,m[J+10],15,-1051523),T=h(T,B,F,g,m[J+1],21,-2054922799),g=h(g,T,B,F,m[J+8],6,1873313359),F=h(F,g,T,B,m[J+15],10,-30611744),B=h(B,F,g,T,m[J+6],15,-1560198380),T=h(T,B,F,g,m[J+13],21,1309151649),g=h(g,T,B,F,m[J+4],6,-145523070),F=h(F,g,T,B,m[J+11],10,-1120210379),B=h(B,F,g,T,m[J+2],15,718787259),T=h(T,B,F,g,m[J+9],21,-343485551),g=p(g,H),T=p(T,K),B=p(B,Y),F=p(F,W)}return Array(g,T,B,F)}function D(m,C,g,T,B,F){return p(c(p(p(C,m),p(T,F)),B),g)}function A(m,C,g,T,B,F,J){return D(C&g|~C&T,m,C,B,F,J)}function x(m,C,g,T,B,F,J){return D(C&T|g&~T,m,C,B,F,J)}function v(m,C,g,T,B,F,J){return D(C^g^T,m,C,B,F,J)}function h(m,C,g,T,B,F,J){return D(g^(C|~T),m,C,B,F,J)}function p(m,C){var g=(m&65535)+(C&65535),T=(m>>16)+(C>>16)+(g>>16);return T<<16|g&65535}function c(m,C){return m<<C|m>>>32-C}V.exports=function(C){return y.hash(C,M,16)}},{"./helpers":285}],287:[function(d,V,O){"use strict";var y=d("./helpers");function l(v,h){v[h>>5]|=128<<24-h%32,v[(h+64>>9<<4)+15]=h;for(var p=Array(80),c=1732584193,m=-271733879,C=-1732584194,g=271733878,T=-1009589776,B=0;B<v.length;B+=16){for(var F=c,J=m,H=C,K=g,Y=T,W=0;W<80;W++){W<16?p[W]=v[B+W]:p[W]=x(p[W-3]^p[W-8]^p[W-14]^p[W-16],1);var U=A(A(x(c,5),M(W,m,C,g)),A(A(T,p[W]),D(W)));T=g,g=C,C=x(m,30),m=c,c=U}c=A(c,F),m=A(m,J),C=A(C,H),g=A(g,K),T=A(T,Y)}return Array(c,m,C,g,T)}function M(v,h,p,c){return v<20?h&p|~h&c:v<40?h^p^c:v<60?h&p|h&c|p&c:h^p^c}function D(v){return v<20?1518500249:v<40?1859775393:v<60?-1894007588:-899497514}function A(v,h){var p=(v&65535)+(h&65535),c=(v>>16)+(h>>16)+(p>>16);return c<<16|p&65535}function x(v,h){return v<<h|v>>>32-h}V.exports=function(h){return y.hash(h,l,20,!0)}},{"./helpers":285}],288:[function(d,V,O){"use strict";V.exports=function(){return function(){}}},{}],289:[function(d,V,O){(function(y){"use strict";var l=d("babel-runtime/helpers/typeof"),M=D(l);function D(c){return c&&c.__esModule?c:{default:c}}var A=d("stream"),x=A.Stream,v=d("../lib/common/utils/isArray"),h=v.isArray;V.exports.string=function(m){return typeof m=="string"},V.exports.array=h,V.exports.buffer=y.isBuffer;function p(c){return c instanceof x}V.exports.writableStream=function(m){return p(m)&&typeof m._write=="function"&&(0,M.default)(m._writableState)==="object"}}).call(this,{isBuffer:d("../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(d,V,O){"use strict";O.encodeURIComponent=function(y){try{return encodeURIComponent(y)}catch(l){return y}},O.escape=d("escape-html"),O.timestamp=function(l){if(l){var M=l;return typeof M=="string"&&(M=Number(M)),String(l).length===10&&(M*=1e3),new Date(M)}return Math.round(Date.now()/1e3)}},{"escape-html":191}],291:[function(d,V,O){(function(y,l){"use strict";var M=d("babel-runtime/core-js/json/stringify"),D=v(M),A=d("babel-runtime/helpers/typeof"),x=v(A);function v(W){return W&&W.__esModule?W:{default:W}}var h=d("util"),p=d("url"),c=d("http"),m=d("https"),C=d("debug")("urllib"),g=d("humanize-ms"),T,B=0,F=Math.pow(2,31)-10,J=/^https?:\/\//i;function H(W,U){return W===void 0?U:W}function K(W,U){return function(_,te,q){if(_)return U(_);W({data:te,status:q.statusCode,headers:q.headers,res:q})}}O.TIMEOUTS=[g("300s"),g("300s")];var Y=["json","text"];O.request=function(U,_,te){return arguments.length===2&&typeof _=="function"&&(te=_,_=null),typeof te=="function"?O.requestWithCallback(U,_,te):(T||(T=d("any-promise")),new T(function(q,w){O.requestWithCallback(U,_,K(q,w))}))},O.requestWithCallback=function(U,_,te){if(!U||typeof U!="string"&&(typeof U=="undefined"?"undefined":(0,x.default)(U))!=="object"){var q=h.format("expect request url to be a string or a http request options, but got %j",U);throw new Error(q)}arguments.length===2&&typeof _=="function"&&(te=_,_=null),_=_||{},B>=F&&(B=0);var w=++B;_.requestUrls=_.requestUrls||[];var X={requestId:w,url:U,args:_,ctx:_.ctx};_.emitter&&_.emitter.emit("request",X),_.timeout=_.timeout||O.TIMEOUTS,_.maxRedirects=_.maxRedirects||10,_.streaming=_.streaming||_.customResponse;var ne=Date.now(),he;typeof U=="string"?(J.test(U)||(U="http://"+U),he=p.parse(U)):he=U;var le=(_.type||_.method||he.method||"GET").toUpperCase(),_e=he.port||80,se=c,be=H(_.agent,O.agent),j=_.fixJSONCtlChars;he.protocol==="https:"&&(se=m,be=H(_.httpsAgent,O.httpsAgent),he.port||(_e=443));var Q={host:he.hostname||he.host||"localhost",path:he.path||"/",method:le,port:_e,agent:be,headers:_.headers||{},lookup:_.lookup};Array.isArray(_.timeout)?Q.requestTimeout=_.timeout[_.timeout.length-1]:typeof _.timeout!="undefined"&&(Q.requestTimeout=_.timeout);for(var L=["pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","secureProtocol","secureOptions"],re=0;re<L.length;re++){var de=L[re];_.hasOwnProperty(de)&&(Q[de]=_[de])}Q.rejectUnauthorized===!1&&!Q.hasOwnProperty("secureOptions")&&(Q.secureOptions=d("constants").SSL_OP_NO_TLSv1_2);var ee=_.auth||he.auth;ee&&(Q.auth=ee);var xe=_.content||_.data,Ne=le==="GET"||le==="HEAD"||_.dataAsQueryString;if(!_.content&&(xe&&!(typeof xe=="string"||l.isBuffer(xe))))if(Ne)xe=_.nestedQuerystring?qs.stringify(xe):querystring.stringify(xe);else{var Le=Q.headers["Content-Type"]||Q.headers["content-type"];Le||(_.contentType==="json"?Le="application/json":Le="application/x-www-form-urlencoded",Q.headers["Content-Type"]=Le),parseContentType(Le).type==="application/json"?xe=(0,D.default)(xe):xe=_.nestedQuerystring?qs.stringify(xe):querystring.stringify(xe)}Ne&&xe&&(Q.path+=(he.query?"&":"?")+xe,xe=null);var Ge=0;if(xe){var Qe=xe.length;l.isBuffer(xe)||(Qe=l.byteLength(xe)),Ge=Q.headers["Content-Length"]=Qe}_.dataType==="json"&&(Q.headers.Accept="application/json"),typeof _.beforeRequest=="function"&&_.beforeRequest(Q);var Te=null,nt=null,Ye=null,Pe=!1,ke=!1,Be=0,ot=-1,ve=!1,ge="",$e="",pe=null;_.timing&&(pe={queuing:0,dnslookup:0,connected:0,requestSent:0,waiting:0,contentDownload:0});function Z(){Te&&(clearTimeout(Te),Te=null)}function k(){nt&&(clearTimeout(nt),nt=null)}function $(at,Bt,mr){if(k(),!te){console.warn("[urllib:warn] [%s] [%s] [worker:%s] %s %s callback twice!!!",Date(),w,y.pid,Q.method,U),at&&console.warn(`[urllib:warn] [%s] [%s] [worker:%s] %s: %s
|
|
|
stack: %s`,Date(),w,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"]&&(!_.headers||!_.headers.Authorization)&&_.digestAuth){var Lr=Sr["www-authenticate"];if(Lr.indexOf("Digest ")>=0)return C("Request#%d %s: got digest auth header WWW-Authenticate: %s",w,U,Lr),_.headers=_.headers||{},_.headers.Authorization=digestAuthHeader(Q.method,Q.path,Lr,_.digestAuth),C("Request#%d %s: auth with digest header: %s",w,U,_.headers.Authorization),mr.headers["set-cookie"]&&(_.headers.Cookie=mr.headers["set-cookie"].join(";")),O.requestWithCallback(U,_,rr)}var Dr=Date.now()-ne;pe&&(pe.contentDownload=Dr),C("[%sms] done, %s bytes HTTP %s %s %s %s, keepAliveSocket: %s, timing: %j",Dr,Be,ot,Q.method,Q.host,Q.path,ke,pe);var Ar={status:ot,statusCode:ot,headers:Sr,size:Be,aborted:ve,rt:Dr,keepAliveSocket:ke,data:Bt,requestUrls:_.requestUrls,timing:pe,remoteAddress:ge,remotePort:$e};if(at){var et="";be&&typeof be.getCurrentStatus=="function"&&(et=", agent status: "+(0,D.default)(be.getCurrentStatus())),at.message+=", "+Q.method+" "+U+" "+ot+" (connected: "+Pe+", keepalive socket: "+ke+et+`)
|
|
|
headers: `+(0,D.default)(Sr),at.data=Bt,at.path=Q.path,at.status=ot,at.headers=Sr,at.res=Ar}rr(at,Bt,_.streaming?mr:Ar),_.emitter&&(X.url=U,X.socket=Et&&Et.connection,X.options=Q,X.size=Ge,_.emitter.emit("response",{requestId:w,error:at,ctx:_.ctx,req:X,res:Ar}))}function Re(at){var Bt=null;if(_.followRedirect&&statuses.redirect[at.statusCode]){_._followRedirectCount=(_._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(_._followRedirectCount>_.maxRedirects)Bt=new Error("Exceeded maxRedirects. Probably stuck in a redirect loop "+U),Bt.name="MaxRedirectError";else{var rr=_.formatRedirectUrl?_.formatRedirectUrl(U,mr):p.resolve(U,mr);C("Request#%d %s: `redirected` from %s to %s",w,Q.path,U,rr),k(),_.headers&&_.headers.Host&&J.test(mr)&&(_.headers.Host=null);var Sr=te;return te=null,O.requestWithCallback(rr,_,Sr),{redirect:!0,error:null}}}return{redirect:!1,error:Bt}}!Q.headers["User-Agent"]&&!Q.headers["user-agent"]&&(Q.headers["User-Agent"]=navigator.userAgent),_.gzip&&(!Q.headers["Accept-Encoding"]&&!Q.headers["accept-encoding"]&&(Q.headers["Accept-Encoding"]="gzip"));function Ae(at,Bt,mr){var rr=at.headers["content-encoding"];return mr(null,Bt,rr)}var Xe=_.writeStream;C("Request#%d %s %s with headers %j, options.path: %s",w,le,U,Q.headers,Q.path),_.requestUrls.push(U);function rt(at){if(pe&&(pe.waiting=Date.now()-ne),C("Request#%d %s `req response` event emit: status %d, headers: %j",w,U,at.statusCode,at.headers),_.streaming){var Bt=Re(at);if(Bt.redirect){at.resume();return}return Bt.error?(at.resume(),$(Bt.error,null,at)):$(null,null,at)}if(at.on("close",function(){C("Request#%d %s: `res close` event emit, total size %d",w,U,Be)}),at.on("error",function(){C("Request#%d %s: `res error` event emit, total size %d",w,U,Be)}),at.on("aborted",function(){ve=!0,C("Request#%d %s: `res aborted` event emit, total size %d",w,U,Be)}),Xe){var Bt=Re(at);if(Bt.redirect){at.resume();return}return Bt.error?(at.resume(),Xe.end(),$(Bt.error,null,at)):(_.consumeWriteStream===!1?at.on("end",$.bind(null,null,null,at)):isNode010||isNode012?first([[Xe,"close"],[at,"aborted"]],function(Sr,Lr,Dr){C("Request#%d %s: writeStream or res %s event emitted",w,U,Dr),$(Ye||null,null,at)}):Xe.on("close",function(){C("Request#%d %s: writeStream close event emitted",w,U),$(Ye||null,null,at)}),at.pipe(Xe))}var mr=[];at.on("data",function(rr){C("Request#%d %s: `res data` event emit, size %d",w,U,rr.length),Be+=rr.length,mr.push(rr)}),at.on("end",function(){var rr=l.concat(mr,Be);if(C("Request#%d %s: `res end` event emit, total size %d, _dumped: %s",w,U,Be,at._dumped),Ye)return $(Ye,rr,at);var Sr=Re(at);if(Sr.error)return $(Sr.error,rr,at);if(Sr.redirect)return;Ae(at,rr,function(Lr,Dr,Ar){if(Lr)return $(Lr,rr,at);if(!Ar&&Y.indexOf(_.dataType)>=0){try{Dr=decodeBodyByCharset(Dr,at)}catch(Xn){return C("decodeBodyByCharset error: %s",Xn),$(null,Dr,at)}if(_.dataType==="json")if(Be===0)Dr=null;else{var et=parseJSON(Dr,j);et.error?Lr=et.error:Dr=et.data}}ve&&C("Request#%d %s: Remote socket was terminated before `response.end()` was called",w,U),$(Lr,Dr,at)})})}var lt,bt;Array.isArray(_.timeout)?(lt=g(_.timeout[0]),bt=g(_.timeout[1])):lt=bt=g(_.timeout),C("ConnectTimeout: %d, ResponseTimeout: %d",lt,bt);function Tt(){C("Connect timer ticking, timeout: %d",lt),Te=setTimeout(function(){Te=null,ot===-1&&(ot=-2);var at="Connect timeout for "+lt+"ms",Bt="ConnectionTimeoutError";Et.socket||(Bt="SocketAssignTimeoutError",at+=", working sockets is full"),Ye=new Error(at),Ye.name=Bt,Ye.requestId=w,C("ConnectTimeout: Request#%d %s %s: %s, connected: %s",w,U,Ye.name,at,Pe),Nt()},lt)}function xt(){C("Response timer ticking, timeout: %d",bt),nt=setTimeout(function(){nt=null;var at="Response timeout for "+bt+"ms",Bt="ResponseTimeoutError";Ye=new Error(at),Ye.name=Bt,Ye.requestId=w,C("ResponseTimeout: Request#%d %s %s: %s, connected: %s",w,U,Ye.name,at,Pe),Nt()},bt)}var Et;Q.mode=_.mode?_.mode:"";try{Et=se.request(Q,rt)}catch(at){return $(at)}typeof window=="undefined"?Tt():Et.on("requestTimeout",function(){ot===-1&&(ot=-2);var at="Connect timeout for "+lt+"ms",Bt="ConnectionTimeoutError";Ye=new Error(at),Ye.name=Bt,Ye.requestId=w,Nt()});function Nt(){C("Request#%d %s abort, connected: %s",w,U,Pe),Et.socket||(Ye.noSocket=!0,$(Ye)),Et.abort()}return pe&&Et.on("finish",function(){pe.requestSent=Date.now()-ne}),Et.once("socket",function(at){pe&&(pe.queuing=Date.now()-ne),isNode010&&at.socket&&(at=at.socket);var Bt=at.readyState;if(Bt==="opening"){at.once("lookup",function(mr,rr,Sr){C("Request#%d %s lookup: %s, %s, %s",w,U,mr,rr,Sr),pe&&(pe.dnslookup=Date.now()-ne),rr&&(ge=rr)}),at.once("connect",function(){pe&&(pe.connected=Date.now()-ne),Z(),xt(),C("Request#%d %s new socket connected",w,U),Pe=!0,ge||(ge=at.remoteAddress),$e=at.remotePort});return}C("Request#%d %s reuse socket connected, readyState: %s",w,U,Bt),Pe=!0,ke=!0,ge||(ge=at.remoteAddress),$e=at.remotePort,Z(),xt()}),Et.on("error",function(at){(at.name==="Error"||at.name==="TypeError")&&(at.name=Pe?"ResponseError":"RequestError"),at.message+=' (req "error")',C("Request#%d %s `req error` event emit, %s: %s",w,U,at.name,at.message),$(Ye||at)}),Xe&&Xe.once("error",function(at){at.message+=' (writeStream "error")',Ye=at,C("Request#%d %s `writeStream error` event emit, %s: %s",w,U,at.name,at.message),Nt()}),_.stream?(_.stream.pipe(Et),_.stream.once("error",function(at){at.message+=' (stream "error")',Ye=at,C("Request#%d %s `readStream error` event emit, %s: %s",w,U,at.name,at.message),Nt()})):Et.end(xe),Et.requestId=w,Et}}).call(this,d("_process"),d("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"))},nVVt:function(d,V){d.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},oRuE:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("OLod"))})(this,function(y){return y.pad.Iso10126={pad:function(l,M){var D=M*4,A=D-l.sigBytes%D;l.concat(y.lib.WordArray.random(A-1)).concat(y.lib.WordArray.create([A<<24],1))},unpad:function(l){var M=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=M}},y.pad.Iso10126})},oX8U:function(d,V,O){"use strict";(function(y){O.d(V,"a",function(){return D});var l=O("mrSG"),M=O("rOjP");function D(){var A=y.Canvas||y.HTMLCanvasElement,x=y.Image||y.HTMLImageElement,v=function(){if(A)return new A;throw new Error("createCanvasElement - missing Canvas implementation for nodejs environment")},h=function(){if(x)return new x;throw new Error("createImageElement - missing Image implementation for nodejs environment")},p=y.fetch||function(){throw new Error("fetch - missing fetch implementation for nodejs environment")},c=Object(M.a)();return Object(l.a)({Canvas:A||function(){function m(){}return m}(),CanvasRenderingContext2D:y.CanvasRenderingContext2D||function(){function m(){}return m}(),Image:x||function(){function m(){}return m}(),ImageData:y.ImageData||function(){function m(){}return m}(),Video:y.HTMLVideoElement||function(){function m(){}return m}(),createCanvasElement:v,createImageElement:h,fetch:p},c)}}).call(this,O("IyRk"))},pA7S:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("ETIr"),O("cv67"),O("K3mO"),O("OLod"))})(this,function(y){return function(){var l=y,M=l.lib,D=M.WordArray,A=M.BlockCipher,x=l.algo,v=[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],p=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{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}],m=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],C=x.DES=A.extend({_doReset:function(){for(var F=this._key,J=F.words,H=[],K=0;K<56;K++){var Y=v[K]-1;H[K]=J[Y>>>5]>>>31-Y%32&1}for(var W=this._subKeys=[],U=0;U<16;U++){for(var _=W[U]=[],te=p[U],K=0;K<24;K++)_[K/6|0]|=H[(h[K]-1+te)%28]<<31-K%6,_[4+(K/6|0)]|=H[28+(h[K+24]-1+te)%28]<<31-K%6;_[0]=_[0]<<1|_[0]>>>31;for(var K=1;K<7;K++)_[K]=_[K]>>>(K-1)*4+3;_[7]=_[7]<<5|_[7]>>>27}for(var q=this._invSubKeys=[],K=0;K<16;K++)q[K]=W[15-K]},encryptBlock:function(F,J){this._doCryptBlock(F,J,this._subKeys)},decryptBlock:function(F,J){this._doCryptBlock(F,J,this._invSubKeys)},_doCryptBlock:function(F,J,H){this._lBlock=F[J],this._rBlock=F[J+1],g.call(this,4,252645135),g.call(this,16,65535),T.call(this,2,858993459),T.call(this,8,16711935),g.call(this,1,1431655765);for(var K=0;K<16;K++){for(var Y=H[K],W=this._lBlock,U=this._rBlock,_=0,te=0;te<8;te++)_|=c[te][((U^Y[te])&m[te])>>>0];this._lBlock=U,this._rBlock=W^_}var q=this._lBlock;this._lBlock=this._rBlock,this._rBlock=q,g.call(this,1,1431655765),T.call(this,8,16711935),T.call(this,2,858993459),g.call(this,16,65535),g.call(this,4,252645135),F[J]=this._lBlock,F[J+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function g(F,J){var H=(this._lBlock>>>F^this._rBlock)&J;this._rBlock^=H,this._lBlock^=H<<F}function T(F,J){var H=(this._rBlock>>>F^this._lBlock)&J;this._lBlock^=H,this._rBlock^=H<<F}l.DES=A._createHelper(C);var B=x.TripleDES=A.extend({_doReset:function(){var F=this._key,J=F.words;if(J.length!==2&&J.length!==4&&J.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var H=J.slice(0,2),K=J.length<4?J.slice(0,2):J.slice(2,4),Y=J.length<6?J.slice(0,2):J.slice(4,6);this._des1=C.createEncryptor(D.create(H)),this._des2=C.createEncryptor(D.create(K)),this._des3=C.createEncryptor(D.create(Y))},encryptBlock:function(F,J){this._des1.encryptBlock(F,J),this._des2.decryptBlock(F,J),this._des3.encryptBlock(F,J)},decryptBlock:function(F,J){this._des3.decryptBlock(F,J),this._des2.encryptBlock(F,J),this._des1.decryptBlock(F,J)},keySize:192/32,ivSize:64/32,blockSize:64/32});l.TripleDES=A._createHelper(B)}(),y.TripleDES})},qBft:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("OLod"))})(this,function(y){return y.pad.AnsiX923={pad:function(l,M){var D=l.sigBytes,A=M*4,x=A-D%A,v=D+x-1;l.clamp(),l.words[v>>>2]|=x<<24-v%4*8,l.sigBytes+=x},unpad:function(l){var M=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=M}},y.pad.Ansix923})},qM6L:function(d,V,O){(function(y,l){d.exports=V=l(O("Ib8C"))})(this,function(y){return function(){var l=y,M=l.lib,D=M.WordArray,A=l.enc,x=A.Utf16=A.Utf16BE={stringify:function(h){for(var p=h.words,c=h.sigBytes,m=[],C=0;C<c;C+=2){var g=p[C>>>2]>>>16-C%4*8&65535;m.push(String.fromCharCode(g))}return m.join("")},parse:function(h){for(var p=h.length,c=[],m=0;m<p;m++)c[m>>>1]|=h.charCodeAt(m)<<16-m%2*16;return D.create(c,p*2)}};A.Utf16LE={stringify:function(h){for(var p=h.words,c=h.sigBytes,m=[],C=0;C<c;C+=2){var g=v(p[C>>>2]>>>16-C%4*8&65535);m.push(String.fromCharCode(g))}return m.join("")},parse:function(h){for(var p=h.length,c=[],m=0;m<p;m++)c[m>>>1]|=v(h.charCodeAt(m)<<16-m%2*16);return D.create(c,p*2)}};function v(h){return h<<8&4278255360|h>>>8&16711935}}(),y.enc.Utf16})},qu8F:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("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 l=y.lib.BlockCipherMode.extend();function M(x){if((x>>24&255)===255){var v=x>>16&255,h=x>>8&255,p=x&255;v===255?(v=0,h===255?(h=0,p===255?p=0:++p):++h):++v,x=0,x+=v<<16,x+=h<<8,x+=p}else x+=1<<24;return x}function D(x){return(x[0]=M(x[0]))===0&&(x[1]=M(x[1])),x}var A=l.Encryptor=l.extend({processBlock:function(x,v){var h=this._cipher,p=h.blockSize,c=this._iv,m=this._counter;c&&(m=this._counter=c.slice(0),this._iv=void 0),D(m);var C=m.slice(0);h.encryptBlock(C,0);for(var g=0;g<p;g++)x[v+g]^=C[g]}});return l.Decryptor=A,l}(),y.mode.CTRGladman})},rOjP:function(d,V,O){"use strict";O.d(V,"a",function(){return y});function y(l){var M="";if(!l)try{l=O("Og1z")}catch(A){M=A.toString()}var D=l?function(A){return new Promise(function(x,v){l.readFile(A,function(h,p){return h?v(h):x(p)})})}:function(){throw new Error("readFile - failed to require fs in nodejs environment with error: "+M)};return{readFile:D}}},rcnY:function(d,V,O){var y=O("aRTE");function l(M,D){this.totalCount=M,this.dataCount=D}l.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],l.getRSBlocks=function(M,D){var A=l.getRsBlockTable(M,D);if(A==null)throw new Error("bad rs block @ typeNumber:"+M+"/errorCorrectLevel:"+D);for(var x=A.length/3,v=new Array,h=0;h<x;h++)for(var p=A[h*3+0],c=A[h*3+1],m=A[h*3+2],C=0;C<p;C++)v.push(new l(c,m));return v},l.getRsBlockTable=function(M,D){switch(D){case y.L:return l.RS_BLOCK_TABLE[(M-1)*4+0];case y.M:return l.RS_BLOCK_TABLE[(M-1)*4+1];case y.Q:return l.RS_BLOCK_TABLE[(M-1)*4+2];case y.H:return l.RS_BLOCK_TABLE[(M-1)*4+3];default:return}},d.exports=l},uGsb:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("MlIO"),O("1uat"))})(this,function(y){return function(){var l=y,M=l.x64,D=M.Word,A=M.WordArray,x=l.algo,v=x.SHA512,h=x.SHA384=v.extend({_doReset:function(){this._hash=new A.init([new D.init(3418070365,3238371032),new D.init(1654270250,914150663),new D.init(2438529370,812702999),new D.init(355462360,4144912697),new D.init(1731405415,4290775857),new D.init(2394180231,1750603025),new D.init(3675008525,1694076839),new D.init(1203062813,3204075428)])},_doFinalize:function(){var p=v._doFinalize.call(this);return p.sigBytes-=16,p}});l.SHA384=v._createHelper(h),l.HmacSHA384=v._createHmacHelper(h)}(),y.SHA384})},uGxW:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("OLod"))})(this,function(y){return y.pad.NoPadding={pad:function(){},unpad:function(){}},y.pad.NoPadding})},w7YG:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("ETIr"),O("cv67"),O("K3mO"),O("OLod"))})(this,function(y){return function(){var l=y,M=l.lib,D=M.StreamCipher,A=l.algo,x=A.RC4=D.extend({_doReset:function(){for(var p=this._key,c=p.words,m=p.sigBytes,C=this._S=[],g=0;g<256;g++)C[g]=g;for(var g=0,T=0;g<256;g++){var B=g%m,F=c[B>>>2]>>>24-B%4*8&255;T=(T+C[g]+F)%256;var J=C[g];C[g]=C[T],C[T]=J}this._i=this._j=0},_doProcessBlock:function(p,c){p[c]^=v.call(this)},keySize:256/32,ivSize:0});function v(){for(var p=this._S,c=this._i,m=this._j,C=0,g=0;g<4;g++){c=(c+1)%256,m=(m+p[c])%256;var T=p[c];p[c]=p[m],p[m]=T,C|=p[(p[c]+p[m])%256]<<24-g*8}return this._i=c,this._j=m,C}l.RC4=D._createHelper(x);var h=A.RC4Drop=x.extend({cfg:x.cfg.extend({drop:192}),_doReset:function(){x._doReset.call(this);for(var p=this.cfg.drop;p>0;p--)v.call(this)}});l.RC4Drop=D._createHelper(h)}(),y.RC4})},wU8J:function(d,V){function O(){this.buffer=new Array,this.length=0}O.prototype={get:function(y){var l=Math.floor(y/8);return(this.buffer[l]>>>7-y%8&1)==1},put:function(y,l){for(var M=0;M<l;M++)this.putBit((y>>>l-M-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(y){var l=Math.floor(this.length/8);this.buffer.length<=l&&this.buffer.push(0),y&&(this.buffer[l]|=128>>>this.length%8),this.length++}},d.exports=O},wZgz:function(d,V,O){(function(y,l,M){d.exports=V=l(O("Ib8C"),O("ETIr"),O("cv67"),O("K3mO"),O("OLod"))})(this,function(y){return function(){var l=y,M=l.lib,D=M.BlockCipher,A=l.algo,x=[],v=[],h=[],p=[],c=[],m=[],C=[],g=[],T=[],B=[];(function(){for(var H=[],K=0;K<256;K++)K<128?H[K]=K<<1:H[K]=K<<1^283;for(var Y=0,W=0,K=0;K<256;K++){var U=W^W<<1^W<<2^W<<3^W<<4;U=U>>>8^U&255^99,x[Y]=U,v[U]=Y;var _=H[Y],te=H[_],q=H[te],w=H[U]*257^U*16843008;h[Y]=w<<24|w>>>8,p[Y]=w<<16|w>>>16,c[Y]=w<<8|w>>>24,m[Y]=w;var w=q*16843009^te*65537^_*257^Y*16843008;C[U]=w<<24|w>>>8,g[U]=w<<16|w>>>16,T[U]=w<<8|w>>>24,B[U]=w,Y?(Y=_^H[H[H[q^_]]],W^=H[H[W]]):Y=W=1}})();var F=[0,1,2,4,8,16,32,64,128,27,54],J=A.AES=D.extend({_doReset:function(){var H;if(this._nRounds&&this._keyPriorReset===this._key)return;for(var K=this._keyPriorReset=this._key,Y=K.words,W=K.sigBytes/4,U=this._nRounds=W+6,_=(U+1)*4,te=this._keySchedule=[],q=0;q<_;q++)q<W?te[q]=Y[q]:(H=te[q-1],q%W?W>6&&q%W==4&&(H=x[H>>>24]<<24|x[H>>>16&255]<<16|x[H>>>8&255]<<8|x[H&255]):(H=H<<8|H>>>24,H=x[H>>>24]<<24|x[H>>>16&255]<<16|x[H>>>8&255]<<8|x[H&255],H^=F[q/W|0]<<24),te[q]=te[q-W]^H);for(var w=this._invKeySchedule=[],X=0;X<_;X++){var q=_-X;if(X%4)var H=te[q];else var H=te[q-4];X<4||q<=4?w[X]=H:w[X]=C[x[H>>>24]]^g[x[H>>>16&255]]^T[x[H>>>8&255]]^B[x[H&255]]}},encryptBlock:function(H,K){this._doCryptBlock(H,K,this._keySchedule,h,p,c,m,x)},decryptBlock:function(H,K){var Y=H[K+1];H[K+1]=H[K+3],H[K+3]=Y,this._doCryptBlock(H,K,this._invKeySchedule,C,g,T,B,v);var Y=H[K+1];H[K+1]=H[K+3],H[K+3]=Y},_doCryptBlock:function(H,K,Y,W,U,_,te,q){for(var w=this._nRounds,X=H[K]^Y[0],ne=H[K+1]^Y[1],he=H[K+2]^Y[2],le=H[K+3]^Y[3],_e=4,se=1;se<w;se++){var be=W[X>>>24]^U[ne>>>16&255]^_[he>>>8&255]^te[le&255]^Y[_e++],j=W[ne>>>24]^U[he>>>16&255]^_[le>>>8&255]^te[X&255]^Y[_e++],Q=W[he>>>24]^U[le>>>16&255]^_[X>>>8&255]^te[ne&255]^Y[_e++],L=W[le>>>24]^U[X>>>16&255]^_[ne>>>8&255]^te[he&255]^Y[_e++];X=be,ne=j,he=Q,le=L}var be=(q[X>>>24]<<24|q[ne>>>16&255]<<16|q[he>>>8&255]<<8|q[le&255])^Y[_e++],j=(q[ne>>>24]<<24|q[he>>>16&255]<<16|q[le>>>8&255]<<8|q[X&255])^Y[_e++],Q=(q[he>>>24]<<24|q[le>>>16&255]<<16|q[X>>>8&255]<<8|q[ne&255])^Y[_e++],L=(q[le>>>24]<<24|q[X>>>16&255]<<16|q[ne>>>8&255]<<8|q[he&255])^Y[_e++];H[K]=be,H[K+1]=j,H[K+2]=Q,H[K+3]=L},keySize:256/32});l.AES=D._createHelper(J)}(),y.AES})},wbyO:function(d,V,O){(function(y,l){d.exports=V=l(O("Ib8C"))})(this,function(y){return function(){var l=y,M=l.lib,D=M.WordArray,A=l.enc,x=A.Base64url={stringify:function(h,p=!0){var c=h.words,m=h.sigBytes,C=p?this._safe_map:this._map;h.clamp();for(var g=[],T=0;T<m;T+=3)for(var B=c[T>>>2]>>>24-T%4*8&255,F=c[T+1>>>2]>>>24-(T+1)%4*8&255,J=c[T+2>>>2]>>>24-(T+2)%4*8&255,H=B<<16|F<<8|J,K=0;K<4&&T+K*.75<m;K++)g.push(C.charAt(H>>>6*(3-K)&63));var Y=C.charAt(64);if(Y)for(;g.length%4;)g.push(Y);return g.join("")},parse:function(h,p=!0){var c=h.length,m=p?this._safe_map:this._map,C=this._reverseMap;if(!C){C=this._reverseMap=[];for(var g=0;g<m.length;g++)C[m.charCodeAt(g)]=g}var T=m.charAt(64);if(T){var B=h.indexOf(T);B!==-1&&(c=B)}return v(h,c,C)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function v(h,p,c){for(var m=[],C=0,g=0;g<p;g++)if(g%4){var T=c[h.charCodeAt(g-1)]<<g%4*2,B=c[h.charCodeAt(g)]>>>6-g%4*2,F=T|B;m[C>>>2]|=F<<24-C%4*8,C++}return D.create(m,C)}}(),y.enc.Base64url})},yPBj:function(d,V,O){d.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"}}}]);
|