|
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[58],{"1uat":function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("MlIO"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.Hasher,D=d.x64,E=D.Word,g=D.WordArray,h=d.algo;function b(){return E.create.apply(E,arguments)}var p=[b(1116352408,3609767458),b(1899447441,602891725),b(3049323471,3964484399),b(3921009573,2173295548),b(961987163,4081628472),b(1508970993,3053834265),b(2453635748,2937671579),b(2870763221,3664609560),b(3624381080,2734883394),b(310598401,1164996542),b(607225278,1323610764),b(1426881987,3590304994),b(1925078388,4068182383),b(2162078206,991336113),b(2614888103,633803317),b(3248222580,3479774868),b(3835390401,2666613458),b(4022224774,944711139),b(264347078,2341262773),b(604807628,2007800933),b(770255983,1495990901),b(1249150122,1856431235),b(1555081692,3175218132),b(1996064986,2198950837),b(2554220882,3999719339),b(2821834349,766784016),b(2952996808,2566594879),b(3210313671,3203337956),b(3336571891,1034457026),b(3584528711,2466948901),b(113926993,3758326383),b(338241895,168717936),b(666307205,1188179964),b(773529912,1546045734),b(1294757372,1522805485),b(1396182291,2643833823),b(1695183700,2343527390),b(1986661051,1014477480),b(2177026350,1206759142),b(2456956037,344077627),b(2730485921,1290863460),b(2820302411,3158454273),b(3259730800,3505952657),b(3345764771,106217008),b(3516065817,3606008344),b(3600352804,1432725776),b(4094571909,1467031594),b(275423344,851169720),b(430227734,3100823752),b(506948616,1363258195),b(659060556,3750685593),b(883997877,3785050280),b(958139571,3318307427),b(1322822218,3812723403),b(1537002063,2003034995),b(1747873779,3602036899),b(1955562222,1575990012),b(2024104815,1125592928),b(2227730452,2716904306),b(2361852424,442776044),b(2428436474,593698344),b(2756734187,3733110249),b(3204031479,2999351573),b(3329325298,3815920427),b(3391569614,3928383900),b(3515267271,566280711),b(3940187606,3454069534),b(4118630271,4000239992),b(116418474,1914138554),b(174292421,2731055270),b(289380356,3203993006),b(460393269,320620315),b(685471733,587496836),b(852142971,1086792851),b(1017036298,365543100),b(1126000580,2618297676),b(1288033470,3409855158),b(1501505948,4234509866),b(1607167915,987167468),b(1816402316,1246189591)],v=[];(function(){for(var x=0;x<80;x++)v[x]=b()})();var I=h.SHA512=M.extend({_doReset:function(){this._hash=new g.init([new E.init(1779033703,4089235720),new E.init(3144134277,2227873595),new E.init(1013904242,4271175723),new E.init(2773480762,1595750129),new E.init(1359893119,2917565137),new E.init(2600822924,725511199),new E.init(528734635,4215389547),new E.init(1541459225,327033209)])},_doProcessBlock:function(x,S){for(var W=this._hash.words,B=W[0],Q=W[1],G=W[2],$=W[3],J=W[4],U=W[5],j=W[6],T=W[7],ee=B.high,Z=B.low,_=Q.high,X=Q.low,re=G.high,me=G.low,de=$.high,we=$.low,ge=J.high,ke=J.low,z=U.high,ie=U.low,H=j.high,ae=j.low,ue=T.high,te=T.low,Se=ee,De=Z,Fe=_,Ke=X,et=re,Ie=me,dt=de,Ye=we,Pe=ge,Le=ke,Ge=z,ot=ie,be=H,ye=ae,$e=ue,q=te,m=0;m<80;m++){var c,R,fe=v[m];if(m<16)R=fe.high=x[S+m*2]|0,c=fe.low=x[S+m*2+1]|0;else{var pe=v[m-15],Ae=pe.high,Qe=pe.low,nt=(Ae>>>1|Qe<<31)^(Ae>>>8|Qe<<24)^Ae>>>7,st=(Qe>>>1|Ae<<31)^(Qe>>>8|Ae<<24)^(Qe>>>7|Ae<<25),yt=v[m-2],ft=yt.high,_t=yt.low,Dt=(ft>>>19|_t<<13)^(ft<<3|_t>>>29)^ft>>>6,at=(_t>>>19|ft<<13)^(_t<<3|ft>>>29)^(_t>>>6|ft<<26),jt=v[m-7],mr=jt.high,rr=jt.low,Sr=v[m-16],Fr=Sr.high,Nr=Sr.low;c=st+rr,R=nt+mr+(c>>>0<st>>>0?1:0),c=c+at,R=R+Dt+(c>>>0<at>>>0?1:0),c=c+Nr,R=R+Fr+(c>>>0<Nr>>>0?1:0),fe.high=R,fe.low=c}var Ar=Pe&Ge^~Pe&be,tt=Le&ot^~Le&ye,Vn=Se&Fe^Se&et^Fe&et,Dr=De&Ke^De&Ie^Ke&Ie,ko=(Se>>>28|De<<4)^(Se<<30|De>>>2)^(Se<<25|De>>>7),Xn=(De>>>28|Se<<4)^(De<<30|Se>>>2)^(De<<25|Se>>>7),uo=(Pe>>>14|Le<<18)^(Pe>>>18|Le<<14)^(Pe<<23|Le>>>9),Cr=(Le>>>14|Pe<<18)^(Le>>>18|Pe<<14)^(Le<<23|Pe>>>9),co=p[m],Tn=co.high,lo=co.low,nr=q+Cr,pr=$e+uo+(nr>>>0<q>>>0?1:0),nr=nr+tt,pr=pr+Ar+(nr>>>0<tt>>>0?1:0),nr=nr+lo,pr=pr+Tn+(nr>>>0<lo>>>0?1:0),nr=nr+c,pr=pr+R+(nr>>>0<c>>>0?1:0),cr=Xn+Dr,rn=ko+Vn+(cr>>>0<Xn>>>0?1:0);$e=be,q=ye,be=Ge,ye=ot,Ge=Pe,ot=Le,Le=Ye+nr|0,Pe=dt+pr+(Le>>>0<Ye>>>0?1:0)|0,dt=et,Ye=Ie,et=Fe,Ie=Ke,Fe=Se,Ke=De,De=nr+cr|0,Se=pr+rn+(De>>>0<nr>>>0?1:0)|0}Z=B.low=Z+De,B.high=ee+Se+(Z>>>0<De>>>0?1:0),X=Q.low=X+Ke,Q.high=_+Fe+(X>>>0<Ke>>>0?1:0),me=G.low=me+Ie,G.high=re+et+(me>>>0<Ie>>>0?1:0),we=$.low=we+Ye,$.high=de+dt+(we>>>0<Ye>>>0?1:0),ke=J.low=ke+Le,J.high=ge+Pe+(ke>>>0<Le>>>0?1:0),ie=U.low=ie+ot,U.high=z+Ge+(ie>>>0<ot>>>0?1:0),ae=j.low=ae+ye,j.high=H+be+(ae>>>0<ye>>>0?1:0),te=T.low=te+q,T.high=ue+$e+(te>>>0<q>>>0?1:0)},_doFinalize:function(){var x=this._data,S=x.words,W=this._nDataBytes*8,B=x.sigBytes*8;S[B>>>5]|=128<<24-B%32,S[(B+128>>>10<<5)+30]=Math.floor(W/4294967296),S[(B+128>>>10<<5)+31]=W,x.sigBytes=S.length*4,this._process();var Q=this._hash.toX32();return Q},clone:function(){var x=M.clone.call(this);return x._hash=this._hash.clone(),x},blockSize:1024/32});d.SHA512=M._createHelper(I),d.HmacSHA512=M._createHmacHelper(I)}(),y.SHA512})},"2LEM":function(l,V,N){l.exports=N.p+"static/checkPeople.d3191bb4.jpg"},"2U/9":function(l,V,N){"use strict";var y=N("VTBJ"),d=N("rePB"),F=N("Ff2n"),M=N("1OyB"),D=N("vuIU"),E=N("Ji7U"),g=N("LK+K"),h=N("q1tI"),b=N.n(h),p=N("Zm9Q"),v=N("TSYQ"),I=N.n(v),x=["className","prefixCls","style","active","status","iconPrefix","icon","wrapperStyle","stepNumber","disabled","description","title","subTitle","progressDot","stepIcon","tailContent","icons","stepIndex","onStepClick","onClick"];function S($){return typeof $=="string"}var W=function($){Object(E.a)(U,$);var J=Object(g.a)(U);function U(){var j;return Object(M.a)(this,U),j=J.apply(this,arguments),j.onClick=function(){var T=j.props,ee=T.onClick,Z=T.onStepClick,_=T.stepIndex;ee&&ee.apply(void 0,arguments),Z(_)},j}return Object(D.a)(U,[{key:"renderIconNode",value:function(){var T,ee=this.props,Z=ee.prefixCls,_=ee.progressDot,X=ee.stepIcon,re=ee.stepNumber,me=ee.status,de=ee.title,we=ee.description,ge=ee.icon,ke=ee.iconPrefix,z=ee.icons,ie,H=I()("".concat(Z,"-icon"),"".concat(ke,"icon"),(T={},Object(d.a)(T,"".concat(ke,"icon-").concat(ge),ge&&S(ge)),Object(d.a)(T,"".concat(ke,"icon-check"),!ge&&me==="finish"&&(z&&!z.finish||!z)),Object(d.a)(T,"".concat(ke,"icon-cross"),!ge&&me==="error"&&(z&&!z.error||!z)),T)),ae=h.createElement("span",{className:"".concat(Z,"-icon-dot")});return _?typeof _=="function"?ie=h.createElement("span",{className:"".concat(Z,"-icon")},_(ae,{index:re-1,status:me,title:de,description:we})):ie=h.createElement("span",{className:"".concat(Z,"-icon")},ae):ge&&!S(ge)?ie=h.createElement("span",{className:"".concat(Z,"-icon")},ge):z&&z.finish&&me==="finish"?ie=h.createElement("span",{className:"".concat(Z,"-icon")},z.finish):z&&z.error&&me==="error"?ie=h.createElement("span",{className:"".concat(Z,"-icon")},z.error):ge||me==="finish"||me==="error"?ie=h.createElement("span",{className:H}):ie=h.createElement("span",{className:"".concat(Z,"-icon")},re),X&&(ie=X({index:re-1,status:me,title:de,description:we,node:ie})),ie}},{key:"render",value:function(){var T,ee=this.props,Z=ee.className,_=ee.prefixCls,X=ee.style,re=ee.active,me=ee.status,de=me===void 0?"wait":me,we=ee.iconPrefix,ge=ee.icon,ke=ee.wrapperStyle,z=ee.stepNumber,ie=ee.disabled,H=ee.description,ae=ee.title,ue=ee.subTitle,te=ee.progressDot,Se=ee.stepIcon,De=ee.tailContent,Fe=ee.icons,Ke=ee.stepIndex,et=ee.onStepClick,Ie=ee.onClick,dt=Object(F.a)(ee,x),Ye=I()("".concat(_,"-item"),"".concat(_,"-item-").concat(de),Z,(T={},Object(d.a)(T,"".concat(_,"-item-custom"),ge),Object(d.a)(T,"".concat(_,"-item-active"),re),Object(d.a)(T,"".concat(_,"-item-disabled"),ie===!0),T)),Pe=Object(y.a)({},X),Le={};return et&&!ie&&(Le.role="button",Le.tabIndex=0,Le.onClick=this.onClick),h.createElement("div",Object.assign({},dt,{className:Ye,style:Pe}),h.createElement("div",Object.assign({onClick:Ie},Le,{className:"".concat(_,"-item-container")}),h.createElement("div",{className:"".concat(_,"-item-tail")},De),h.createElement("div",{className:"".concat(_,"-item-icon")},this.renderIconNode()),h.createElement("div",{className:"".concat(_,"-item-content")},h.createElement("div",{className:"".concat(_,"-item-title")},ae,ue&&h.createElement("div",{title:typeof ue=="string"?ue:void 0,className:"".concat(_,"-item-subtitle")},ue)),H&&h.createElement("div",{className:"".concat(_,"-item-description")},H))))}}]),U}(h.Component),B=["prefixCls","style","className","children","direction","type","labelPlacement","iconPrefix","status","size","current","progressDot","stepIcon","initial","icons","onChange"],Q=function($){Object(E.a)(U,$);var J=Object(g.a)(U);function U(){var j;return Object(M.a)(this,U),j=J.apply(this,arguments),j.onStepClick=function(T){var ee=j.props,Z=ee.onChange,_=ee.current;Z&&_!==T&&Z(T)},j}return Object(D.a)(U,[{key:"render",value:function(){var T,ee=this,Z=this.props,_=Z.prefixCls,X=Z.style,re=X===void 0?{}:X,me=Z.className,de=Z.children,we=Z.direction,ge=Z.type,ke=Z.labelPlacement,z=Z.iconPrefix,ie=Z.status,H=Z.size,ae=Z.current,ue=Z.progressDot,te=Z.stepIcon,Se=Z.initial,De=Z.icons,Fe=Z.onChange,Ke=Object(F.a)(Z,B),et=ge==="navigation",Ie=ue?"vertical":ke,dt=I()(_,"".concat(_,"-").concat(we),me,(T={},Object(d.a)(T,"".concat(_,"-").concat(H),H),Object(d.a)(T,"".concat(_,"-label-").concat(Ie),we==="horizontal"),Object(d.a)(T,"".concat(_,"-dot"),!!ue),Object(d.a)(T,"".concat(_,"-navigation"),et),T));return b.a.createElement("div",Object.assign({className:dt,style:re},Ke),Object(p.a)(de).map(function(Ye,Pe){var Le=Se+Pe,Ge=Object(y.a)({stepNumber:"".concat(Le+1),stepIndex:Le,key:Le,prefixCls:_,iconPrefix:z,wrapperStyle:re,progressDot:ue,stepIcon:te,icons:De,onStepClick:Fe&&ee.onStepClick},Ye.props);return ie==="error"&&Pe===ae-1&&(Ge.className="".concat(_,"-next-error")),Ye.props.status||(Le===ae?Ge.status=ie:Le<ae?Ge.status="finish":Ge.status="wait"),Ge.active=Le===ae,Object(h.cloneElement)(Ye,Ge)}))}}]),U}(b.a.Component);Q.Step=W,Q.defaultProps={type:"default",prefixCls:"rc-steps",iconPrefix:"rc",direction:"horizontal",labelPlacement:"horizontal",initial:0,current:0,status:"process",size:"",progressDot:!1};var G=V.a=Q},"3y9D":function(l,V,N){(function(y,d){l.exports=V=d(N("Ib8C"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.WordArray,D=F.Hasher,E=d.algo,g=[],h=E.SHA1=D.extend({_doReset:function(){this._hash=new M.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(b,p){for(var v=this._hash.words,I=v[0],x=v[1],S=v[2],W=v[3],B=v[4],Q=0;Q<80;Q++){if(Q<16)g[Q]=b[p+Q]|0;else{var G=g[Q-3]^g[Q-8]^g[Q-14]^g[Q-16];g[Q]=G<<1|G>>>31}var $=(I<<5|I>>>27)+B+g[Q];Q<20?$+=(x&S|~x&W)+1518500249:Q<40?$+=(x^S^W)+1859775393:Q<60?$+=(x&S|x&W|S&W)-1894007588:$+=(x^S^W)-899497514,B=W,W=S,S=x<<30|x>>>2,x=I,I=$}v[0]=v[0]+I|0,v[1]=v[1]+x|0,v[2]=v[2]+S|0,v[3]=v[3]+W|0,v[4]=v[4]+B|0},_doFinalize:function(){var b=this._data,p=b.words,v=this._nDataBytes*8,I=b.sigBytes*8;return p[I>>>5]|=128<<24-I%32,p[(I+64>>>9<<4)+14]=Math.floor(v/4294967296),p[(I+64>>>9<<4)+15]=v,b.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var b=D.clone.call(this);return b._hash=this._hash.clone(),b}});d.SHA1=D._createHelper(h),d.HmacSHA1=D._createHmacHelper(h)}(),y.SHA1})},4:function(l,V){},"49sm":function(l,V){var N={}.toString;l.exports=Array.isArray||function(y){return N.call(y)=="[object Array]"}},5:function(l,V){},"5hvy":function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("MlIO"))})(this,function(y){return function(d){var F=y,M=F.lib,D=M.WordArray,E=M.Hasher,g=F.x64,h=g.Word,b=F.algo,p=[],v=[],I=[];(function(){for(var W=1,B=0,Q=0;Q<24;Q++){p[W+5*B]=(Q+1)*(Q+2)/2%64;var G=B%5,$=(2*W+3*B)%5;W=G,B=$}for(var W=0;W<5;W++)for(var B=0;B<5;B++)v[W+5*B]=B+(2*W+3*B)%5*5;for(var J=1,U=0;U<24;U++){for(var j=0,T=0,ee=0;ee<7;ee++){if(J&1){var Z=(1<<ee)-1;Z<32?T^=1<<Z:j^=1<<Z-32}J&128?J=J<<1^113:J<<=1}I[U]=h.create(j,T)}})();var x=[];(function(){for(var W=0;W<25;W++)x[W]=h.create()})();var S=b.SHA3=E.extend({cfg:E.cfg.extend({outputLength:512}),_doReset:function(){for(var W=this._state=[],B=0;B<25;B++)W[B]=new h.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(W,B){for(var Q=this._state,G=this.blockSize/2,$=0;$<G;$++){var J=W[B+2*$],U=W[B+2*$+1];J=(J<<8|J>>>24)&16711935|(J<<24|J>>>8)&4278255360,U=(U<<8|U>>>24)&16711935|(U<<24|U>>>8)&4278255360;var j=Q[$];j.high^=U,j.low^=J}for(var T=0;T<24;T++){for(var ee=0;ee<5;ee++){for(var Z=0,_=0,X=0;X<5;X++){var j=Q[ee+5*X];Z^=j.high,_^=j.low}var re=x[ee];re.high=Z,re.low=_}for(var ee=0;ee<5;ee++)for(var me=x[(ee+4)%5],de=x[(ee+1)%5],we=de.high,ge=de.low,Z=me.high^(we<<1|ge>>>31),_=me.low^(ge<<1|we>>>31),X=0;X<5;X++){var j=Q[ee+5*X];j.high^=Z,j.low^=_}for(var ke=1;ke<25;ke++){var Z,_,j=Q[ke],z=j.high,ie=j.low,H=p[ke];H<32?(Z=z<<H|ie>>>32-H,_=ie<<H|z>>>32-H):(Z=ie<<H-32|z>>>64-H,_=z<<H-32|ie>>>64-H);var ae=x[v[ke]];ae.high=Z,ae.low=_}var ue=x[0],te=Q[0];ue.high=te.high,ue.low=te.low;for(var ee=0;ee<5;ee++)for(var X=0;X<5;X++){var ke=ee+5*X,j=Q[ke],Se=x[ke],De=x[(ee+1)%5+5*X],Fe=x[(ee+2)%5+5*X];j.high=Se.high^~De.high&Fe.high,j.low=Se.low^~De.low&Fe.low}var j=Q[0],Ke=I[T];j.high^=Ke.high,j.low^=Ke.low}},_doFinalize:function(){var W=this._data,B=W.words,Q=this._nDataBytes*8,G=W.sigBytes*8,$=this.blockSize*32;B[G>>>5]|=1<<24-G%32,B[(d.ceil((G+1)/$)*$>>>5)-1]|=128,W.sigBytes=B.length*4,this._process();for(var J=this._state,U=this.cfg.outputLength/8,j=U/8,T=[],ee=0;ee<j;ee++){var Z=J[ee],_=Z.high,X=Z.low;_=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,X=(X<<8|X>>>24)&16711935|(X<<24|X>>>8)&4278255360,T.push(X),T.push(_)}return new D.init(T,U)},clone:function(){for(var W=E.clone.call(this),B=W._state=this._state.slice(0),Q=0;Q<25;Q++)B[Q]=B[Q].clone();return W}});F.SHA3=E._createHelper(S),F.HmacSHA3=E._createHmacHelper(S)}(Math),y.SHA3})},6:function(l,V){},7:function(l,V){},"7Cbv":function(l,V,N){"use strict";var y=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),d=new Uint8Array(16);function F(){if(!y)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return y(d)}var M=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function D(x){return typeof x=="string"&&M.test(x)}for(var E=D,g=[],h=0;h<256;++h)g.push((h+256).toString(16).substr(1));function b(x){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,W=(g[x[S+0]]+g[x[S+1]]+g[x[S+2]]+g[x[S+3]]+"-"+g[x[S+4]]+g[x[S+5]]+"-"+g[x[S+6]]+g[x[S+7]]+"-"+g[x[S+8]]+g[x[S+9]]+"-"+g[x[S+10]]+g[x[S+11]]+g[x[S+12]]+g[x[S+13]]+g[x[S+14]]+g[x[S+15]]).toLowerCase();if(!E(W))throw TypeError("Stringified UUID is invalid");return W}var p=b;function v(x,S,W){x=x||{};var B=x.random||(x.rng||F)();if(B[6]=B[6]&15|64,B[8]=B[8]&63|128,S){W=W||0;for(var Q=0;Q<16;++Q)S[W+Q]=B[Q];return S}return p(B)}var I=V.a=v},"7ixt":function(l,V,N){"use strict";N.d(V,"a",function(){return F});var y={adjustX:1,adjustY:1},d=[0,0],F={left:{points:["cr","cl"],overflow:y,offset:[-4,0],targetOffset:d},right:{points:["cl","cr"],overflow:y,offset:[4,0],targetOffset:d},top:{points:["bc","tc"],overflow:y,offset:[0,-4],targetOffset:d},bottom:{points:["tc","bc"],overflow:y,offset:[0,4],targetOffset:d},topLeft:{points:["bl","tl"],overflow:y,offset:[0,-4],targetOffset:d},leftTop:{points:["tr","tl"],overflow:y,offset:[-4,0],targetOffset:d},topRight:{points:["br","tr"],overflow:y,offset:[0,-4],targetOffset:d},rightTop:{points:["tl","tr"],overflow:y,offset:[4,0],targetOffset:d},bottomRight:{points:["tr","br"],overflow:y,offset:[0,4],targetOffset:d},rightBottom:{points:["bl","br"],overflow:y,offset:[4,0],targetOffset:d},bottomLeft:{points:["tl","bl"],overflow:y,offset:[0,4],targetOffset:d},leftBottom:{points:["br","bl"],overflow:y,offset:[-4,0],targetOffset:d}},M=F},"8KZw":function(l,V,N){"use strict";(function(y,d){N.d(V,"a",function(){return F});function F(){return typeof y=="object"&&!0&&typeof l!="undefined"&&typeof d!="undefined"&&!!d.version}}).call(this,N("IyRk"),N("Q2Ig"))},"9OqN":function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.mode.CTR=function(){var d=y.lib.BlockCipherMode.extend(),F=d.Encryptor=d.extend({processBlock:function(M,D){var E=this._cipher,g=E.blockSize,h=this._iv,b=this._counter;h&&(b=this._counter=h.slice(0),this._iv=void 0);var p=b.slice(0);E.encryptBlock(p,0),b[g-1]=b[g-1]+1|0;for(var v=0;v<g;v++)M[D+v]^=p[v]}});return d.Decryptor=F,d}(),y.mode.CTR})},ALsQ:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.mode.CFB=function(){var d=y.lib.BlockCipherMode.extend();d.Encryptor=d.extend({processBlock:function(M,D){var E=this._cipher,g=E.blockSize;F.call(this,M,D,g,E),this._prevBlock=M.slice(D,D+g)}}),d.Decryptor=d.extend({processBlock:function(M,D){var E=this._cipher,g=E.blockSize,h=M.slice(D,D+g);F.call(this,M,D,g,E),this._prevBlock=h}});function F(M,D,E,g){var h,b=this._iv;b?(h=b.slice(0),this._iv=void 0):h=this._prevBlock,g.encryptBlock(h,0);for(var p=0;p<E;p++)M[D+p]^=h[p]}return d}(),y.mode.CFB})},E4JC:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("ETIr"),N("cv67"),N("K3mO"),N("OLod"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.StreamCipher,D=d.algo,E=[],g=[],h=[],b=D.Rabbit=M.extend({_doReset:function(){for(var v=this._key.words,I=this.cfg.iv,x=0;x<4;x++)v[x]=(v[x]<<8|v[x]>>>24)&16711935|(v[x]<<24|v[x]>>>8)&4278255360;var S=this._X=[v[0],v[3]<<16|v[2]>>>16,v[1],v[0]<<16|v[3]>>>16,v[2],v[1]<<16|v[0]>>>16,v[3],v[2]<<16|v[1]>>>16],W=this._C=[v[2]<<16|v[2]>>>16,v[0]&4294901760|v[1]&65535,v[3]<<16|v[3]>>>16,v[1]&4294901760|v[2]&65535,v[0]<<16|v[0]>>>16,v[2]&4294901760|v[3]&65535,v[1]<<16|v[1]>>>16,v[3]&4294901760|v[0]&65535];this._b=0;for(var x=0;x<4;x++)p.call(this);for(var x=0;x<8;x++)W[x]^=S[x+4&7];if(I){var B=I.words,Q=B[0],G=B[1],$=(Q<<8|Q>>>24)&16711935|(Q<<24|Q>>>8)&4278255360,J=(G<<8|G>>>24)&16711935|(G<<24|G>>>8)&4278255360,U=$>>>16|J&4294901760,j=J<<16|$&65535;W[0]^=$,W[1]^=U,W[2]^=J,W[3]^=j,W[4]^=$,W[5]^=U,W[6]^=J,W[7]^=j;for(var x=0;x<4;x++)p.call(this)}},_doProcessBlock:function(v,I){var x=this._X;p.call(this),E[0]=x[0]^x[5]>>>16^x[3]<<16,E[1]=x[2]^x[7]>>>16^x[5]<<16,E[2]=x[4]^x[1]>>>16^x[7]<<16,E[3]=x[6]^x[3]>>>16^x[1]<<16;for(var S=0;S<4;S++)E[S]=(E[S]<<8|E[S]>>>24)&16711935|(E[S]<<24|E[S]>>>8)&4278255360,v[I+S]^=E[S]},blockSize:128/32,ivSize:64/32});function p(){for(var v=this._X,I=this._C,x=0;x<8;x++)g[x]=I[x];I[0]=I[0]+1295307597+this._b|0,I[1]=I[1]+3545052371+(I[0]>>>0<g[0]>>>0?1:0)|0,I[2]=I[2]+886263092+(I[1]>>>0<g[1]>>>0?1:0)|0,I[3]=I[3]+1295307597+(I[2]>>>0<g[2]>>>0?1:0)|0,I[4]=I[4]+3545052371+(I[3]>>>0<g[3]>>>0?1:0)|0,I[5]=I[5]+886263092+(I[4]>>>0<g[4]>>>0?1:0)|0,I[6]=I[6]+1295307597+(I[5]>>>0<g[5]>>>0?1:0)|0,I[7]=I[7]+3545052371+(I[6]>>>0<g[6]>>>0?1:0)|0,this._b=I[7]>>>0<g[7]>>>0?1:0;for(var x=0;x<8;x++){var S=v[x]+I[x],W=S&65535,B=S>>>16,Q=((W*W>>>17)+W*B>>>15)+B*B,G=((S&4294901760)*S|0)+((S&65535)*S|0);h[x]=Q^G}v[0]=h[0]+(h[7]<<16|h[7]>>>16)+(h[6]<<16|h[6]>>>16)|0,v[1]=h[1]+(h[0]<<8|h[0]>>>24)+h[7]|0,v[2]=h[2]+(h[1]<<16|h[1]>>>16)+(h[0]<<16|h[0]>>>16)|0,v[3]=h[3]+(h[2]<<8|h[2]>>>24)+h[1]|0,v[4]=h[4]+(h[3]<<16|h[3]>>>16)+(h[2]<<16|h[2]>>>16)|0,v[5]=h[5]+(h[4]<<8|h[4]>>>24)+h[3]|0,v[6]=h[6]+(h[5]<<16|h[5]>>>16)+(h[4]<<16|h[4]>>>16)|0,v[7]=h[7]+(h[6]<<8|h[6]>>>24)+h[5]|0}d.Rabbit=M._createHelper(b)}(),y.Rabbit})},ELcG:function(l,V,N){(function(y,d){l.exports=V=d(N("Ib8C"))})(this,function(y){/** @preserve
|
|
|
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
|
|
|
|
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
|
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
*/return function(d){var F=y,M=F.lib,D=M.WordArray,E=M.Hasher,g=F.algo,h=D.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),b=D.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),p=D.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),v=D.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),I=D.create([0,1518500249,1859775393,2400959708,2840853838]),x=D.create([1352829926,1548603684,1836072691,2053994217,0]),S=g.RIPEMD160=E.extend({_doReset:function(){this._hash=D.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(U,j){for(var T=0;T<16;T++){var ee=j+T,Z=U[ee];U[ee]=(Z<<8|Z>>>24)&16711935|(Z<<24|Z>>>8)&4278255360}var _=this._hash.words,X=I.words,re=x.words,me=h.words,de=b.words,we=p.words,ge=v.words,ke,z,ie,H,ae,ue,te,Se,De,Fe;ue=ke=_[0],te=z=_[1],Se=ie=_[2],De=H=_[3],Fe=ae=_[4];for(var Ke,T=0;T<80;T+=1)Ke=ke+U[j+me[T]]|0,T<16?Ke+=W(z,ie,H)+X[0]:T<32?Ke+=B(z,ie,H)+X[1]:T<48?Ke+=Q(z,ie,H)+X[2]:T<64?Ke+=G(z,ie,H)+X[3]:Ke+=$(z,ie,H)+X[4],Ke=Ke|0,Ke=J(Ke,we[T]),Ke=Ke+ae|0,ke=ae,ae=H,H=J(ie,10),ie=z,z=Ke,Ke=ue+U[j+de[T]]|0,T<16?Ke+=$(te,Se,De)+re[0]:T<32?Ke+=G(te,Se,De)+re[1]:T<48?Ke+=Q(te,Se,De)+re[2]:T<64?Ke+=B(te,Se,De)+re[3]:Ke+=W(te,Se,De)+re[4],Ke=Ke|0,Ke=J(Ke,ge[T]),Ke=Ke+Fe|0,ue=Fe,Fe=De,De=J(Se,10),Se=te,te=Ke;Ke=_[1]+ie+De|0,_[1]=_[2]+H+Fe|0,_[2]=_[3]+ae+ue|0,_[3]=_[4]+ke+te|0,_[4]=_[0]+z+Se|0,_[0]=Ke},_doFinalize:function(){var U=this._data,j=U.words,T=this._nDataBytes*8,ee=U.sigBytes*8;j[ee>>>5]|=128<<24-ee%32,j[(ee+64>>>9<<4)+14]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,U.sigBytes=(j.length+1)*4,this._process();for(var Z=this._hash,_=Z.words,X=0;X<5;X++){var re=_[X];_[X]=(re<<8|re>>>24)&16711935|(re<<24|re>>>8)&4278255360}return Z},clone:function(){var U=E.clone.call(this);return U._hash=this._hash.clone(),U}});function W(U,j,T){return U^j^T}function B(U,j,T){return U&j|~U&T}function Q(U,j,T){return(U|~j)^T}function G(U,j,T){return U&T|j&~T}function $(U,j,T){return U^(j|~T)}function J(U,j){return U<<j|U>>>32-j}F.RIPEMD160=E._createHelper(S),F.HmacRIPEMD160=E._createHmacHelper(S)}(Math),y.RIPEMD160})},ETIr:function(l,V,N){(function(y,d){l.exports=V=d(N("Ib8C"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.WordArray,D=d.enc,E=D.Base64={stringify:function(h){var b=h.words,p=h.sigBytes,v=this._map;h.clamp();for(var I=[],x=0;x<p;x+=3)for(var S=b[x>>>2]>>>24-x%4*8&255,W=b[x+1>>>2]>>>24-(x+1)%4*8&255,B=b[x+2>>>2]>>>24-(x+2)%4*8&255,Q=S<<16|W<<8|B,G=0;G<4&&x+G*.75<p;G++)I.push(v.charAt(Q>>>6*(3-G)&63));var $=v.charAt(64);if($)for(;I.length%4;)I.push($);return I.join("")},parse:function(h){var b=h.length,p=this._map,v=this._reverseMap;if(!v){v=this._reverseMap=[];for(var I=0;I<p.length;I++)v[p.charCodeAt(I)]=I}var x=p.charAt(64);if(x){var S=h.indexOf(x);S!==-1&&(b=S)}return g(h,b,v)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function g(h,b,p){for(var v=[],I=0,x=0;x<b;x++)if(x%4){var S=p[h.charCodeAt(x-1)]<<x%4*2,W=p[h.charCodeAt(x)]>>>6-x%4*2,B=S|W;v[I>>>2]|=B<<24-I%4*8,I++}return M.create(v,I)}}(),y.enc.Base64})},"F+F2":function(l,V,N){(function(y,d){l.exports=V=d(N("Ib8C"))})(this,function(y){return function(){if(typeof ArrayBuffer!="function")return;var d=y,F=d.lib,M=F.WordArray,D=M.init,E=M.init=function(g){if(g instanceof ArrayBuffer&&(g=new Uint8Array(g)),(g instanceof Int8Array||typeof Uint8ClampedArray!="undefined"&&g instanceof Uint8ClampedArray||g instanceof Int16Array||g instanceof Uint16Array||g instanceof Int32Array||g instanceof Uint32Array||g instanceof Float32Array||g instanceof Float64Array)&&(g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength)),g instanceof Uint8Array){for(var h=g.byteLength,b=[],p=0;p<h;p++)b[p>>>2]|=g[p]<<24-p%4*8;D.call(this,b,h)}else D.apply(this,arguments)};E.prototype=M}(),y.lib.WordArray})},GRuw:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("lPiR"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.WordArray,D=d.algo,E=D.SHA256,g=D.SHA224=E.extend({_doReset:function(){this._hash=new M.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var h=E._doFinalize.call(this);return h.sigBytes-=4,h}});d.SHA224=E._createHelper(g),d.HmacSHA224=E._createHmacHelper(g)}(),y.SHA224})},GfqC:function(l,V,N){"use strict";var y=N("q1tI"),d=N.n(y),F=N("TSYQ"),M=N.n(F);function D(H,ae){var ue="cannot "+H.method+" "+H.action+" "+ae.status+"'",te=new Error(ue);return te.status=ae.status,te.method=H.method,te.url=H.action,te}function E(H){var ae=H.responseText||H.response;if(!ae)return ae;try{return JSON.parse(ae)}catch(ue){return ae}}function g(H){var ae=new XMLHttpRequest;H.onProgress&&ae.upload&&(ae.upload.onprogress=function(De){De.total>0&&(De.percent=De.loaded/De.total*100),H.onProgress(De)});var ue=new FormData;H.data&&Object.keys(H.data).forEach(function(Se){var De=H.data[Se];if(Array.isArray(De)){De.forEach(function(Fe){ue.append(Se+"[]",Fe)});return}ue.append(Se,H.data[Se])}),H.file instanceof Blob?ue.append(H.filename,H.file,H.file.name):ue.append(H.filename,H.file),ae.onerror=function(De){H.onError(De)},ae.onload=function(){return ae.status<200||ae.status>=300?H.onError(D(H,ae),E(ae)):H.onSuccess(E(ae),ae)},ae.open(H.method,H.action,!0),H.withCredentials&&"withCredentials"in ae&&(ae.withCredentials=!0);var te=H.headers||{};return te["X-Requested-With"]!==null&&ae.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(te).forEach(function(Se){te[Se]!==null&&ae.setRequestHeader(Se,te[Se])}),ae.send(ue),{abort:function(){ae.abort()}}}var h=+new Date,b=0;function p(){return"rc-upload-"+h+"-"+ ++b}function v(H,ae){return H.indexOf(ae,H.length-ae.length)!==-1}var I=function(H,ae){if(H&&ae){var ue=Array.isArray(ae)?ae:ae.split(","),te=H.name||"",Se=H.type||"",De=Se.replace(/\/.*$/,"");return ue.some(function(Fe){var Ke=Fe.trim();return Ke.charAt(0)==="."?v(te.toLowerCase(),Ke.toLowerCase()):/\/\*$/.test(Ke)?De===Ke.replace(/\/.*$/,""):Se===Ke})}return!0};function x(H,ae){var ue=H.createReader(),te=[];function Se(){ue.readEntries(function(De){var Fe=Array.prototype.slice.apply(De);te=te.concat(Fe);var Ke=!Fe.length;Ke?ae(te):Se()})}Se()}var S=function(ae,ue,te){var Se=function De(Fe,Ke){Ke=Ke||"",Fe.isFile?Fe.file(function(et){te(et)&&(Fe.fullPath&&!et.webkitRelativePath&&(Object.defineProperties(et,{webkitRelativePath:{writable:!0}}),et.webkitRelativePath=Fe.fullPath.replace(/^\//,""),Object.defineProperties(et,{webkitRelativePath:{writable:!1}})),ue([et]))}):Fe.isDirectory&&x(Fe,function(et){et.forEach(function(Ie){De(Ie,""+Ke+Fe.name+"/")})})};ae.forEach(function(De){Se(De.webkitGetAsEntry())})},W=S,B=Object.assign||function(H){for(var ae=1;ae<arguments.length;ae++){var ue=arguments[ae];for(var te in ue)Object.prototype.hasOwnProperty.call(ue,te)&&(H[te]=ue[te])}return H},Q=function(){function H(ae,ue){var te=[],Se=!0,De=!1,Fe=void 0;try{for(var Ke=ae[Symbol.iterator](),et;!(Se=(et=Ke.next()).done)&&!(te.push(et.value),ue&&te.length===ue);Se=!0);}catch(Ie){De=!0,Fe=Ie}finally{try{!Se&&Ke.return&&Ke.return()}finally{if(De)throw Fe}}return te}return function(ae,ue){if(Array.isArray(ae))return ae;if(Symbol.iterator in Object(ae))return H(ae,ue);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),G=function(){function H(ae,ue){for(var te=0;te<ue.length;te++){var Se=ue[te];Se.enumerable=Se.enumerable||!1,Se.configurable=!0,"value"in Se&&(Se.writable=!0),Object.defineProperty(ae,Se.key,Se)}}return function(ae,ue,te){return ue&&H(ae.prototype,ue),te&&H(ae,te),ae}}();function $(H,ae,ue){return ae in H?Object.defineProperty(H,ae,{value:ue,enumerable:!0,configurable:!0,writable:!0}):H[ae]=ue,H}function J(H,ae){var ue={};for(var te in H){if(ae.indexOf(te)>=0)continue;if(!Object.prototype.hasOwnProperty.call(H,te))continue;ue[te]=H[te]}return ue}function U(H,ae){if(!(H instanceof ae))throw new TypeError("Cannot call a class as a function")}function j(H,ae){if(!H)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ae&&(typeof ae=="object"||typeof ae=="function")?ae:H}function T(H,ae){if(typeof ae!="function"&&ae!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof ae);H.prototype=Object.create(ae&&ae.prototype,{constructor:{value:H,enumerable:!1,writable:!0,configurable:!0}}),ae&&(Object.setPrototypeOf?Object.setPrototypeOf(H,ae):H.__proto__=ae)}var ee=function(ae){return Object.keys(ae).reduce(function(ue,te){return(te.substr(0,5)==="data-"||te.substr(0,5)==="aria-"||te==="role")&&(ue[te]=ae[te]),ue},{})},Z=function(H){T(ae,H);function ae(){var ue,te,Se,De;U(this,ae);for(var Fe=arguments.length,Ke=Array(Fe),et=0;et<Fe;et++)Ke[et]=arguments[et];return De=(te=(Se=j(this,(ue=ae.__proto__||Object.getPrototypeOf(ae)).call.apply(ue,[this].concat(Ke))),Se),Se.state={uid:p()},Se.reqs={},Se.onChange=function(Ie){var dt=Ie.target.files;Se.uploadFiles(dt),Se.reset()},Se.onClick=function(Ie){var dt=Se.fileInput;if(!dt)return;var Ye=Se.props,Pe=Ye.children,Le=Ye.onClick;Pe&&Pe.type==="button"&&(dt.parentNode.focus(),dt.parentNode.querySelector("button").blur()),dt.click(),Le&&Le(Ie)},Se.onKeyDown=function(Ie){Ie.key==="Enter"&&Se.onClick()},Se.onFileDrop=function(Ie){var dt=Se.props.multiple;if(Ie.preventDefault(),Ie.type==="dragover")return;if(Se.props.directory)W(Array.prototype.slice.call(Ie.dataTransfer.items),Se.uploadFiles,function(Pe){return I(Pe,Se.props.accept)});else{var Ye=Array.prototype.slice.call(Ie.dataTransfer.files).filter(function(Pe){return I(Pe,Se.props.accept)});dt===!1&&(Ye=Ye.slice(0,1)),Se.uploadFiles(Ye)}},Se.uploadFiles=function(Ie){var dt=Array.prototype.slice.call(Ie);dt.map(function(Ye){return Ye.uid=p(),Ye}).forEach(function(Ye){Se.upload(Ye,dt)})},Se.saveFileInput=function(Ie){Se.fileInput=Ie},te),j(Se,De)}return G(ae,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(te,Se){var De=this,Fe=this.props;if(!Fe.beforeUpload)return setTimeout(function(){return De.post(te)},0);var Ke=Fe.beforeUpload(te,Se);Ke&&Ke.then?Ke.then(function(et){var Ie=Object.prototype.toString.call(et);return Ie==="[object File]"||Ie==="[object Blob]"?De.post(et):De.post(te)}).catch(function(et){console.log(et)}):Ke!==!1&&setTimeout(function(){return De.post(te)},0);return}},{key:"post",value:function(te){var Se=this;if(!this._isMounted)return;var De=this.props,Fe=De.onStart,Ke=De.onProgress,et=De.transformFile,Ie=et===void 0?function(dt){return dt}:et;new Promise(function(dt){var Ye=De.action;return typeof Ye=="function"&&(Ye=Ye(te)),dt(Ye)}).then(function(dt){var Ye=te.uid,Pe=De.customRequest||g,Le=Promise.resolve(Ie(te)).then(function(Ge){var ot=De.data;return typeof ot=="function"&&(ot=ot(Ge)),Promise.all([Ge,ot])}).catch(function(Ge){console.error(Ge)});Le.then(function(Ge){var ot=Q(Ge,2),be=ot[0],ye=ot[1],$e={action:dt,filename:De.name,data:ye,file:be,headers:De.headers,withCredentials:De.withCredentials,method:De.method||"post",onProgress:Ke?function(q){Ke(q,te)}:null,onSuccess:function(m,c){delete Se.reqs[Ye],De.onSuccess(m,te,c)},onError:function(m,c){delete Se.reqs[Ye],De.onError(m,c,te)}};Fe(te),Se.reqs[Ye]=Pe($e)})})}},{key:"reset",value:function(){this.setState({uid:p()})}},{key:"abort",value:function(te){var Se=this.reqs;if(te){var De=te;te&&te.uid&&(De=te.uid),Se[De]&&Se[De].abort&&Se[De].abort(),delete Se[De]}else Object.keys(Se).forEach(function(Fe){Se[Fe]&&Se[Fe].abort&&Se[Fe].abort(),delete Se[Fe]})}},{key:"render",value:function(){var te,Se=this.props,De=Se.component,Fe=Se.prefixCls,Ke=Se.className,et=Se.disabled,Ie=Se.id,dt=Se.style,Ye=Se.multiple,Pe=Se.accept,Le=Se.children,Ge=Se.directory,ot=Se.openFileDialogOnClick,be=Se.onMouseEnter,ye=Se.onMouseLeave,$e=J(Se,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),q=M()((te={},$(te,Fe,!0),$(te,Fe+"-disabled",et),$(te,Ke,Ke),te)),m=et?{}:{onClick:ot?this.onClick:function(){},onKeyDown:ot?this.onKeyDown:function(){},onMouseEnter:be,onMouseLeave:ye,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return d.a.createElement(De,B({},m,{className:q,role:"button",style:dt}),d.a.createElement("input",B({},ee($e),{id:Ie,type:"file",ref:this.saveFileInput,onClick:function(R){return R.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:Pe,directory:Ge?"directory":null,webkitdirectory:Ge?"webkitdirectory":null,multiple:Ye,onChange:this.onChange})),Le)}}]),ae}(y.Component),_=Z,X=Object.assign||function(H){for(var ae=1;ae<arguments.length;ae++){var ue=arguments[ae];for(var te in ue)Object.prototype.hasOwnProperty.call(ue,te)&&(H[te]=ue[te])}return H},re=function(){function H(ae,ue){for(var te=0;te<ue.length;te++){var Se=ue[te];Se.enumerable=Se.enumerable||!1,Se.configurable=!0,"value"in Se&&(Se.writable=!0),Object.defineProperty(ae,Se.key,Se)}}return function(ae,ue,te){return ue&&H(ae.prototype,ue),te&&H(ae,te),ae}}();function me(H,ae){if(!(H instanceof ae))throw new TypeError("Cannot call a class as a function")}function de(H,ae){if(!H)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ae&&(typeof ae=="object"||typeof ae=="function")?ae:H}function we(H,ae){if(typeof ae!="function"&&ae!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof ae);H.prototype=Object.create(ae&&ae.prototype,{constructor:{value:H,enumerable:!1,writable:!0,configurable:!0}}),ae&&(Object.setPrototypeOf?Object.setPrototypeOf(H,ae):H.__proto__=ae)}function ge(){}var ke=function(H){we(ae,H);function ae(){var ue,te,Se,De;me(this,ae);for(var Fe=arguments.length,Ke=Array(Fe),et=0;et<Fe;et++)Ke[et]=arguments[et];return De=(te=(Se=de(this,(ue=ae.__proto__||Object.getPrototypeOf(ae)).call.apply(ue,[this].concat(Ke))),Se),Se.saveUploader=function(Ie){Se.uploader=Ie},te),de(Se,De)}return re(ae,[{key:"abort",value:function(te){this.uploader.abort(te)}},{key:"render",value:function(){return d.a.createElement(_,X({},this.props,{ref:this.saveUploader}))}}]),ae}(y.Component);ke.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:ge,onError:ge,onSuccess:ge,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var z=ke,ie=V.a=z},H7XF:function(l,V,N){"use strict";V.byteLength=h,V.toByteArray=p,V.fromByteArray=x;for(var y=[],d=[],F=typeof Uint8Array!="undefined"?Uint8Array:Array,M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",D=0,E=M.length;D<E;++D)y[D]=M[D],d[M.charCodeAt(D)]=D;d["-".charCodeAt(0)]=62,d["_".charCodeAt(0)]=63;function g(S){var W=S.length;if(W%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var B=S.indexOf("=");B===-1&&(B=W);var Q=B===W?0:4-B%4;return[B,Q]}function h(S){var W=g(S),B=W[0],Q=W[1];return(B+Q)*3/4-Q}function b(S,W,B){return(W+B)*3/4-B}function p(S){var W,B=g(S),Q=B[0],G=B[1],$=new F(b(S,Q,G)),J=0,U=G>0?Q-4:Q,j;for(j=0;j<U;j+=4)W=d[S.charCodeAt(j)]<<18|d[S.charCodeAt(j+1)]<<12|d[S.charCodeAt(j+2)]<<6|d[S.charCodeAt(j+3)],$[J++]=W>>16&255,$[J++]=W>>8&255,$[J++]=W&255;return G===2&&(W=d[S.charCodeAt(j)]<<2|d[S.charCodeAt(j+1)]>>4,$[J++]=W&255),G===1&&(W=d[S.charCodeAt(j)]<<10|d[S.charCodeAt(j+1)]<<4|d[S.charCodeAt(j+2)]>>2,$[J++]=W>>8&255,$[J++]=W&255),$}function v(S){return y[S>>18&63]+y[S>>12&63]+y[S>>6&63]+y[S&63]}function I(S,W,B){for(var Q,G=[],$=W;$<B;$+=3)Q=(S[$]<<16&16711680)+(S[$+1]<<8&65280)+(S[$+2]&255),G.push(v(Q));return G.join("")}function x(S){for(var W,B=S.length,Q=B%3,G=[],$=16383,J=0,U=B-Q;J<U;J+=$)G.push(I(S,J,J+$>U?U:J+$));return Q===1?(W=S[B-1],G.push(y[W>>2]+y[W<<4&63]+"==")):Q===2&&(W=(S[B-2]<<8)+S[B-1],G.push(y[W>>10]+y[W>>4&63]+y[W<<2&63]+"=")),G.join("")}},HDXh:function(l,V,N){"use strict";(function(y){/*!
|
|
|
* The buffer module from node.js, for the browser.
|
|
|
*
|
|
|
* @author Feross Aboukhadijeh <http://feross.org>
|
|
|
* @license MIT
|
|
|
*/var d=N("H7XF"),F=N("kVK+"),M=N("49sm");V.Buffer=h,V.SlowBuffer=G,V.INSPECT_MAX_BYTES=50,h.TYPED_ARRAY_SUPPORT=y.TYPED_ARRAY_SUPPORT!==void 0?y.TYPED_ARRAY_SUPPORT:D(),V.kMaxLength=E();function D(){try{var q=new Uint8Array(1);return q.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},q.foo()===42&&typeof q.subarray=="function"&&q.subarray(1,1).byteLength===0}catch(m){return!1}}function E(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function g(q,m){if(E()<m)throw new RangeError("Invalid typed array length");return h.TYPED_ARRAY_SUPPORT?(q=new Uint8Array(m),q.__proto__=h.prototype):(q===null&&(q=new h(m)),q.length=m),q}function h(q,m,c){if(!h.TYPED_ARRAY_SUPPORT&&!(this instanceof h))return new h(q,m,c);if(typeof q=="number"){if(typeof m=="string")throw new Error("If encoding is specified then the first argument must be a string");return I(this,q)}return b(this,q,m,c)}h.poolSize=8192,h._augment=function(q){return q.__proto__=h.prototype,q};function b(q,m,c,R){if(typeof m=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&m instanceof ArrayBuffer?W(q,m,c,R):typeof m=="string"?x(q,m,c):B(q,m)}h.from=function(q,m,c){return b(null,q,m,c)},h.TYPED_ARRAY_SUPPORT&&(h.prototype.__proto__=Uint8Array.prototype,h.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&h[Symbol.species]===h&&Object.defineProperty(h,Symbol.species,{value:null,configurable:!0}));function p(q){if(typeof q!="number")throw new TypeError('"size" argument must be a number');if(q<0)throw new RangeError('"size" argument must not be negative')}function v(q,m,c,R){return p(m),m<=0?g(q,m):c!==void 0?typeof R=="string"?g(q,m).fill(c,R):g(q,m).fill(c):g(q,m)}h.alloc=function(q,m,c){return v(null,q,m,c)};function I(q,m){if(p(m),q=g(q,m<0?0:Q(m)|0),!h.TYPED_ARRAY_SUPPORT)for(var c=0;c<m;++c)q[c]=0;return q}h.allocUnsafe=function(q){return I(null,q)},h.allocUnsafeSlow=function(q){return I(null,q)};function x(q,m,c){if((typeof c!="string"||c==="")&&(c="utf8"),!h.isEncoding(c))throw new TypeError('"encoding" must be a valid string encoding');var R=$(m,c)|0;q=g(q,R);var fe=q.write(m,c);return fe!==R&&(q=q.slice(0,fe)),q}function S(q,m){var c=m.length<0?0:Q(m.length)|0;q=g(q,c);for(var R=0;R<c;R+=1)q[R]=m[R]&255;return q}function W(q,m,c,R){if(m.byteLength,c<0||m.byteLength<c)throw new RangeError("'offset' is out of bounds");if(m.byteLength<c+(R||0))throw new RangeError("'length' is out of bounds");return c===void 0&&R===void 0?m=new Uint8Array(m):R===void 0?m=new Uint8Array(m,c):m=new Uint8Array(m,c,R),h.TYPED_ARRAY_SUPPORT?(q=m,q.__proto__=h.prototype):q=S(q,m),q}function B(q,m){if(h.isBuffer(m)){var c=Q(m.length)|0;return q=g(q,c),q.length===0||m.copy(q,0,0,c),q}if(m){if(typeof ArrayBuffer!="undefined"&&m.buffer instanceof ArrayBuffer||"length"in m)return typeof m.length!="number"||$e(m.length)?g(q,0):S(q,m);if(m.type==="Buffer"&&M(m.data))return S(q,m.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Q(q){if(q>=E())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+E().toString(16)+" bytes");return q|0}function G(q){return+q!=q&&(q=0),h.alloc(+q)}h.isBuffer=function(m){return!!(m!=null&&m._isBuffer)},h.compare=function(m,c){if(!h.isBuffer(m)||!h.isBuffer(c))throw new TypeError("Arguments must be Buffers");if(m===c)return 0;for(var R=m.length,fe=c.length,pe=0,Ae=Math.min(R,fe);pe<Ae;++pe)if(m[pe]!==c[pe]){R=m[pe],fe=c[pe];break}return R<fe?-1:fe<R?1:0},h.isEncoding=function(m){switch(String(m).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},h.concat=function(m,c){if(!M(m))throw new TypeError('"list" argument must be an Array of Buffers');if(m.length===0)return h.alloc(0);var R;if(c===void 0)for(c=0,R=0;R<m.length;++R)c+=m[R].length;var fe=h.allocUnsafe(c),pe=0;for(R=0;R<m.length;++R){var Ae=m[R];if(!h.isBuffer(Ae))throw new TypeError('"list" argument must be an Array of Buffers');Ae.copy(fe,pe),pe+=Ae.length}return fe};function $(q,m){if(h.isBuffer(q))return q.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(q)||q instanceof ArrayBuffer))return q.byteLength;typeof q!="string"&&(q=""+q);var c=q.length;if(c===0)return 0;for(var R=!1;;)switch(m){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":case void 0:return Le(q).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return be(q).length;default:if(R)return Le(q).length;m=(""+m).toLowerCase(),R=!0}}h.byteLength=$;function J(q,m,c){var R=!1;if((m===void 0||m<0)&&(m=0),m>this.length)return"";if((c===void 0||c>this.length)&&(c=this.length),c<=0)return"";if(c>>>=0,m>>>=0,c<=m)return"";for(q||(q="utf8");;)switch(q){case"hex":return H(this,m,c);case"utf8":case"utf-8":return we(this,m,c);case"ascii":return z(this,m,c);case"latin1":case"binary":return ie(this,m,c);case"base64":return de(this,m,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ae(this,m,c);default:if(R)throw new TypeError("Unknown encoding: "+q);q=(q+"").toLowerCase(),R=!0}}h.prototype._isBuffer=!0;function U(q,m,c){var R=q[m];q[m]=q[c],q[c]=R}h.prototype.swap16=function(){var m=this.length;if(m%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var c=0;c<m;c+=2)U(this,c,c+1);return this},h.prototype.swap32=function(){var m=this.length;if(m%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var c=0;c<m;c+=4)U(this,c,c+3),U(this,c+1,c+2);return this},h.prototype.swap64=function(){var m=this.length;if(m%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var c=0;c<m;c+=8)U(this,c,c+7),U(this,c+1,c+6),U(this,c+2,c+5),U(this,c+3,c+4);return this},h.prototype.toString=function(){var m=this.length|0;return m===0?"":arguments.length===0?we(this,0,m):J.apply(this,arguments)},h.prototype.equals=function(m){if(!h.isBuffer(m))throw new TypeError("Argument must be a Buffer");return this===m?!0:h.compare(this,m)===0},h.prototype.inspect=function(){var m="",c=V.INSPECT_MAX_BYTES;return this.length>0&&(m=this.toString("hex",0,c).match(/.{2}/g).join(" "),this.length>c&&(m+=" ... ")),"<Buffer "+m+">"},h.prototype.compare=function(m,c,R,fe,pe){if(!h.isBuffer(m))throw new TypeError("Argument must be a Buffer");if(c===void 0&&(c=0),R===void 0&&(R=m?m.length:0),fe===void 0&&(fe=0),pe===void 0&&(pe=this.length),c<0||R>m.length||fe<0||pe>this.length)throw new RangeError("out of range index");if(fe>=pe&&c>=R)return 0;if(fe>=pe)return-1;if(c>=R)return 1;if(c>>>=0,R>>>=0,fe>>>=0,pe>>>=0,this===m)return 0;for(var Ae=pe-fe,Qe=R-c,nt=Math.min(Ae,Qe),st=this.slice(fe,pe),yt=m.slice(c,R),ft=0;ft<nt;++ft)if(st[ft]!==yt[ft]){Ae=st[ft],Qe=yt[ft];break}return Ae<Qe?-1:Qe<Ae?1:0};function j(q,m,c,R,fe){if(q.length===0)return-1;if(typeof c=="string"?(R=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,isNaN(c)&&(c=fe?0:q.length-1),c<0&&(c=q.length+c),c>=q.length){if(fe)return-1;c=q.length-1}else if(c<0)if(fe)c=0;else return-1;if(typeof m=="string"&&(m=h.from(m,R)),h.isBuffer(m))return m.length===0?-1:T(q,m,c,R,fe);if(typeof m=="number")return m=m&255,h.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?fe?Uint8Array.prototype.indexOf.call(q,m,c):Uint8Array.prototype.lastIndexOf.call(q,m,c):T(q,[m],c,R,fe);throw new TypeError("val must be string, number or Buffer")}function T(q,m,c,R,fe){var pe=1,Ae=q.length,Qe=m.length;if(R!==void 0&&(R=String(R).toLowerCase(),R==="ucs2"||R==="ucs-2"||R==="utf16le"||R==="utf-16le")){if(q.length<2||m.length<2)return-1;pe=2,Ae/=2,Qe/=2,c/=2}function nt(Dt,at){return pe===1?Dt[at]:Dt.readUInt16BE(at*pe)}var st;if(fe){var yt=-1;for(st=c;st<Ae;st++)if(nt(q,st)===nt(m,yt===-1?0:st-yt)){if(yt===-1&&(yt=st),st-yt+1===Qe)return yt*pe}else yt!==-1&&(st-=st-yt),yt=-1}else for(c+Qe>Ae&&(c=Ae-Qe),st=c;st>=0;st--){for(var ft=!0,_t=0;_t<Qe;_t++)if(nt(q,st+_t)!==nt(m,_t)){ft=!1;break}if(ft)return st}return-1}h.prototype.includes=function(m,c,R){return this.indexOf(m,c,R)!==-1},h.prototype.indexOf=function(m,c,R){return j(this,m,c,R,!0)},h.prototype.lastIndexOf=function(m,c,R){return j(this,m,c,R,!1)};function ee(q,m,c,R){c=Number(c)||0;var fe=q.length-c;R?(R=Number(R),R>fe&&(R=fe)):R=fe;var pe=m.length;if(pe%2!==0)throw new TypeError("Invalid hex string");R>pe/2&&(R=pe/2);for(var Ae=0;Ae<R;++Ae){var Qe=parseInt(m.substr(Ae*2,2),16);if(isNaN(Qe))return Ae;q[c+Ae]=Qe}return Ae}function Z(q,m,c,R){return ye(Le(m,q.length-c),q,c,R)}function _(q,m,c,R){return ye(Ge(m),q,c,R)}function X(q,m,c,R){return _(q,m,c,R)}function re(q,m,c,R){return ye(be(m),q,c,R)}function me(q,m,c,R){return ye(ot(m,q.length-c),q,c,R)}h.prototype.write=function(m,c,R,fe){if(c===void 0)fe="utf8",R=this.length,c=0;else if(R===void 0&&typeof c=="string")fe=c,R=this.length,c=0;else if(isFinite(c))c=c|0,isFinite(R)?(R=R|0,fe===void 0&&(fe="utf8")):(fe=R,R=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var pe=this.length-c;if((R===void 0||R>pe)&&(R=pe),m.length>0&&(R<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");fe||(fe="utf8");for(var Ae=!1;;)switch(fe){case"hex":return ee(this,m,c,R);case"utf8":case"utf-8":return Z(this,m,c,R);case"ascii":return _(this,m,c,R);case"latin1":case"binary":return X(this,m,c,R);case"base64":return re(this,m,c,R);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return me(this,m,c,R);default:if(Ae)throw new TypeError("Unknown encoding: "+fe);fe=(""+fe).toLowerCase(),Ae=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function de(q,m,c){return m===0&&c===q.length?d.fromByteArray(q):d.fromByteArray(q.slice(m,c))}function we(q,m,c){c=Math.min(q.length,c);for(var R=[],fe=m;fe<c;){var pe=q[fe],Ae=null,Qe=pe>239?4:pe>223?3:pe>191?2:1;if(fe+Qe<=c){var nt,st,yt,ft;switch(Qe){case 1:pe<128&&(Ae=pe);break;case 2:nt=q[fe+1],(nt&192)===128&&(ft=(pe&31)<<6|nt&63,ft>127&&(Ae=ft));break;case 3:nt=q[fe+1],st=q[fe+2],(nt&192)===128&&(st&192)===128&&(ft=(pe&15)<<12|(nt&63)<<6|st&63,ft>2047&&(ft<55296||ft>57343)&&(Ae=ft));break;case 4:nt=q[fe+1],st=q[fe+2],yt=q[fe+3],(nt&192)===128&&(st&192)===128&&(yt&192)===128&&(ft=(pe&15)<<18|(nt&63)<<12|(st&63)<<6|yt&63,ft>65535&&ft<1114112&&(Ae=ft))}}Ae===null?(Ae=65533,Qe=1):Ae>65535&&(Ae-=65536,R.push(Ae>>>10&1023|55296),Ae=56320|Ae&1023),R.push(Ae),fe+=Qe}return ke(R)}var ge=4096;function ke(q){var m=q.length;if(m<=ge)return String.fromCharCode.apply(String,q);for(var c="",R=0;R<m;)c+=String.fromCharCode.apply(String,q.slice(R,R+=ge));return c}function z(q,m,c){var R="";c=Math.min(q.length,c);for(var fe=m;fe<c;++fe)R+=String.fromCharCode(q[fe]&127);return R}function ie(q,m,c){var R="";c=Math.min(q.length,c);for(var fe=m;fe<c;++fe)R+=String.fromCharCode(q[fe]);return R}function H(q,m,c){var R=q.length;(!m||m<0)&&(m=0),(!c||c<0||c>R)&&(c=R);for(var fe="",pe=m;pe<c;++pe)fe+=Pe(q[pe]);return fe}function ae(q,m,c){for(var R=q.slice(m,c),fe="",pe=0;pe<R.length;pe+=2)fe+=String.fromCharCode(R[pe]+R[pe+1]*256);return fe}h.prototype.slice=function(m,c){var R=this.length;m=~~m,c=c===void 0?R:~~c,m<0?(m+=R,m<0&&(m=0)):m>R&&(m=R),c<0?(c+=R,c<0&&(c=0)):c>R&&(c=R),c<m&&(c=m);var fe;if(h.TYPED_ARRAY_SUPPORT)fe=this.subarray(m,c),fe.__proto__=h.prototype;else{var pe=c-m;fe=new h(pe,void 0);for(var Ae=0;Ae<pe;++Ae)fe[Ae]=this[Ae+m]}return fe};function ue(q,m,c){if(q%1!==0||q<0)throw new RangeError("offset is not uint");if(q+m>c)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUIntLE=function(m,c,R){m=m|0,c=c|0,R||ue(m,c,this.length);for(var fe=this[m],pe=1,Ae=0;++Ae<c&&(pe*=256);)fe+=this[m+Ae]*pe;return fe},h.prototype.readUIntBE=function(m,c,R){m=m|0,c=c|0,R||ue(m,c,this.length);for(var fe=this[m+--c],pe=1;c>0&&(pe*=256);)fe+=this[m+--c]*pe;return fe},h.prototype.readUInt8=function(m,c){return c||ue(m,1,this.length),this[m]},h.prototype.readUInt16LE=function(m,c){return c||ue(m,2,this.length),this[m]|this[m+1]<<8},h.prototype.readUInt16BE=function(m,c){return c||ue(m,2,this.length),this[m]<<8|this[m+1]},h.prototype.readUInt32LE=function(m,c){return c||ue(m,4,this.length),(this[m]|this[m+1]<<8|this[m+2]<<16)+this[m+3]*16777216},h.prototype.readUInt32BE=function(m,c){return c||ue(m,4,this.length),this[m]*16777216+(this[m+1]<<16|this[m+2]<<8|this[m+3])},h.prototype.readIntLE=function(m,c,R){m=m|0,c=c|0,R||ue(m,c,this.length);for(var fe=this[m],pe=1,Ae=0;++Ae<c&&(pe*=256);)fe+=this[m+Ae]*pe;return pe*=128,fe>=pe&&(fe-=Math.pow(2,8*c)),fe},h.prototype.readIntBE=function(m,c,R){m=m|0,c=c|0,R||ue(m,c,this.length);for(var fe=c,pe=1,Ae=this[m+--fe];fe>0&&(pe*=256);)Ae+=this[m+--fe]*pe;return pe*=128,Ae>=pe&&(Ae-=Math.pow(2,8*c)),Ae},h.prototype.readInt8=function(m,c){return c||ue(m,1,this.length),this[m]&128?(255-this[m]+1)*-1:this[m]},h.prototype.readInt16LE=function(m,c){c||ue(m,2,this.length);var R=this[m]|this[m+1]<<8;return R&32768?R|4294901760:R},h.prototype.readInt16BE=function(m,c){c||ue(m,2,this.length);var R=this[m+1]|this[m]<<8;return R&32768?R|4294901760:R},h.prototype.readInt32LE=function(m,c){return c||ue(m,4,this.length),this[m]|this[m+1]<<8|this[m+2]<<16|this[m+3]<<24},h.prototype.readInt32BE=function(m,c){return c||ue(m,4,this.length),this[m]<<24|this[m+1]<<16|this[m+2]<<8|this[m+3]},h.prototype.readFloatLE=function(m,c){return c||ue(m,4,this.length),F.read(this,m,!0,23,4)},h.prototype.readFloatBE=function(m,c){return c||ue(m,4,this.length),F.read(this,m,!1,23,4)},h.prototype.readDoubleLE=function(m,c){return c||ue(m,8,this.length),F.read(this,m,!0,52,8)},h.prototype.readDoubleBE=function(m,c){return c||ue(m,8,this.length),F.read(this,m,!1,52,8)};function te(q,m,c,R,fe,pe){if(!h.isBuffer(q))throw new TypeError('"buffer" argument must be a Buffer instance');if(m>fe||m<pe)throw new RangeError('"value" argument is out of bounds');if(c+R>q.length)throw new RangeError("Index out of range")}h.prototype.writeUIntLE=function(m,c,R,fe){if(m=+m,c=c|0,R=R|0,!fe){var pe=Math.pow(2,8*R)-1;te(this,m,c,R,pe,0)}var Ae=1,Qe=0;for(this[c]=m&255;++Qe<R&&(Ae*=256);)this[c+Qe]=m/Ae&255;return c+R},h.prototype.writeUIntBE=function(m,c,R,fe){if(m=+m,c=c|0,R=R|0,!fe){var pe=Math.pow(2,8*R)-1;te(this,m,c,R,pe,0)}var Ae=R-1,Qe=1;for(this[c+Ae]=m&255;--Ae>=0&&(Qe*=256);)this[c+Ae]=m/Qe&255;return c+R},h.prototype.writeUInt8=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,1,255,0),h.TYPED_ARRAY_SUPPORT||(m=Math.floor(m)),this[c]=m&255,c+1};function Se(q,m,c,R){m<0&&(m=65535+m+1);for(var fe=0,pe=Math.min(q.length-c,2);fe<pe;++fe)q[c+fe]=(m&255<<8*(R?fe:1-fe))>>>(R?fe:1-fe)*8}h.prototype.writeUInt16LE=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[c]=m&255,this[c+1]=m>>>8):Se(this,m,c,!0),c+2},h.prototype.writeUInt16BE=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[c]=m>>>8,this[c+1]=m&255):Se(this,m,c,!1),c+2};function De(q,m,c,R){m<0&&(m=4294967295+m+1);for(var fe=0,pe=Math.min(q.length-c,4);fe<pe;++fe)q[c+fe]=m>>>(R?fe:3-fe)*8&255}h.prototype.writeUInt32LE=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[c+3]=m>>>24,this[c+2]=m>>>16,this[c+1]=m>>>8,this[c]=m&255):De(this,m,c,!0),c+4},h.prototype.writeUInt32BE=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[c]=m>>>24,this[c+1]=m>>>16,this[c+2]=m>>>8,this[c+3]=m&255):De(this,m,c,!1),c+4},h.prototype.writeIntLE=function(m,c,R,fe){if(m=+m,c=c|0,!fe){var pe=Math.pow(2,8*R-1);te(this,m,c,R,pe-1,-pe)}var Ae=0,Qe=1,nt=0;for(this[c]=m&255;++Ae<R&&(Qe*=256);)m<0&&nt===0&&this[c+Ae-1]!==0&&(nt=1),this[c+Ae]=(m/Qe>>0)-nt&255;return c+R},h.prototype.writeIntBE=function(m,c,R,fe){if(m=+m,c=c|0,!fe){var pe=Math.pow(2,8*R-1);te(this,m,c,R,pe-1,-pe)}var Ae=R-1,Qe=1,nt=0;for(this[c+Ae]=m&255;--Ae>=0&&(Qe*=256);)m<0&&nt===0&&this[c+Ae+1]!==0&&(nt=1),this[c+Ae]=(m/Qe>>0)-nt&255;return c+R},h.prototype.writeInt8=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,1,127,-128),h.TYPED_ARRAY_SUPPORT||(m=Math.floor(m)),m<0&&(m=255+m+1),this[c]=m&255,c+1},h.prototype.writeInt16LE=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[c]=m&255,this[c+1]=m>>>8):Se(this,m,c,!0),c+2},h.prototype.writeInt16BE=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[c]=m>>>8,this[c+1]=m&255):Se(this,m,c,!1),c+2},h.prototype.writeInt32LE=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[c]=m&255,this[c+1]=m>>>8,this[c+2]=m>>>16,this[c+3]=m>>>24):De(this,m,c,!0),c+4},h.prototype.writeInt32BE=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,4,2147483647,-2147483648),m<0&&(m=4294967295+m+1),h.TYPED_ARRAY_SUPPORT?(this[c]=m>>>24,this[c+1]=m>>>16,this[c+2]=m>>>8,this[c+3]=m&255):De(this,m,c,!1),c+4};function Fe(q,m,c,R,fe,pe){if(c+R>q.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function Ke(q,m,c,R,fe){return fe||Fe(q,m,c,4,34028234663852886e22,-34028234663852886e22),F.write(q,m,c,R,23,4),c+4}h.prototype.writeFloatLE=function(m,c,R){return Ke(this,m,c,!0,R)},h.prototype.writeFloatBE=function(m,c,R){return Ke(this,m,c,!1,R)};function et(q,m,c,R,fe){return fe||Fe(q,m,c,8,17976931348623157e292,-17976931348623157e292),F.write(q,m,c,R,52,8),c+8}h.prototype.writeDoubleLE=function(m,c,R){return et(this,m,c,!0,R)},h.prototype.writeDoubleBE=function(m,c,R){return et(this,m,c,!1,R)},h.prototype.copy=function(m,c,R,fe){if(R||(R=0),!fe&&fe!==0&&(fe=this.length),c>=m.length&&(c=m.length),c||(c=0),fe>0&&fe<R&&(fe=R),fe===R)return 0;if(m.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(R<0||R>=this.length)throw new RangeError("sourceStart out of bounds");if(fe<0)throw new RangeError("sourceEnd out of bounds");fe>this.length&&(fe=this.length),m.length-c<fe-R&&(fe=m.length-c+R);var pe=fe-R,Ae;if(this===m&&R<c&&c<fe)for(Ae=pe-1;Ae>=0;--Ae)m[Ae+c]=this[Ae+R];else if(pe<1e3||!h.TYPED_ARRAY_SUPPORT)for(Ae=0;Ae<pe;++Ae)m[Ae+c]=this[Ae+R];else Uint8Array.prototype.set.call(m,this.subarray(R,R+pe),c);return pe},h.prototype.fill=function(m,c,R,fe){if(typeof m=="string"){if(typeof c=="string"?(fe=c,c=0,R=this.length):typeof R=="string"&&(fe=R,R=this.length),m.length===1){var pe=m.charCodeAt(0);pe<256&&(m=pe)}if(fe!==void 0&&typeof fe!="string")throw new TypeError("encoding must be a string");if(typeof fe=="string"&&!h.isEncoding(fe))throw new TypeError("Unknown encoding: "+fe)}else typeof m=="number"&&(m=m&255);if(c<0||this.length<c||this.length<R)throw new RangeError("Out of range index");if(R<=c)return this;c=c>>>0,R=R===void 0?this.length:R>>>0,m||(m=0);var Ae;if(typeof m=="number")for(Ae=c;Ae<R;++Ae)this[Ae]=m;else{var Qe=h.isBuffer(m)?m:Le(new h(m,fe).toString()),nt=Qe.length;for(Ae=0;Ae<R-c;++Ae)this[Ae+c]=Qe[Ae%nt]}return this};var Ie=/[^+\/0-9A-Za-z-_]/g;function dt(q){if(q=Ye(q).replace(Ie,""),q.length<2)return"";for(;q.length%4!==0;)q=q+"=";return q}function Ye(q){return q.trim?q.trim():q.replace(/^\s+|\s+$/g,"")}function Pe(q){return q<16?"0"+q.toString(16):q.toString(16)}function Le(q,m){m=m||Infinity;for(var c,R=q.length,fe=null,pe=[],Ae=0;Ae<R;++Ae){if(c=q.charCodeAt(Ae),c>55295&&c<57344){if(!fe){if(c>56319){(m-=3)>-1&&pe.push(239,191,189);continue}else if(Ae+1===R){(m-=3)>-1&&pe.push(239,191,189);continue}fe=c;continue}if(c<56320){(m-=3)>-1&&pe.push(239,191,189),fe=c;continue}c=(fe-55296<<10|c-56320)+65536}else fe&&((m-=3)>-1&&pe.push(239,191,189));if(fe=null,c<128){if((m-=1)<0)break;pe.push(c)}else if(c<2048){if((m-=2)<0)break;pe.push(c>>6|192,c&63|128)}else if(c<65536){if((m-=3)<0)break;pe.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((m-=4)<0)break;pe.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return pe}function Ge(q){for(var m=[],c=0;c<q.length;++c)m.push(q.charCodeAt(c)&255);return m}function ot(q,m){for(var c,R,fe,pe=[],Ae=0;Ae<q.length&&!((m-=2)<0);++Ae)c=q.charCodeAt(Ae),R=c>>8,fe=c%256,pe.push(fe),pe.push(R);return pe}function be(q){return d.toByteArray(dt(q))}function ye(q,m,c,R){for(var fe=0;fe<R&&!(fe+c>=m.length||fe>=q.length);++fe)m[fe+c]=q[fe];return fe}function $e(q){return q!==q}}).call(this,N("IyRk"))},IO3U:function(l,V,N){l.exports={wrp:"wrp___1U2de"}},Ib8C:function(l,V,N){(function(y){(function(d,F){l.exports=V=F()})(this,function(){var d=d||function(F,M){var D;if(typeof window!="undefined"&&window.crypto&&(D=window.crypto),typeof self!="undefined"&&self.crypto&&(D=self.crypto),typeof globalThis!="undefined"&&globalThis.crypto&&(D=globalThis.crypto),!D&&typeof window!="undefined"&&window.msCrypto&&(D=window.msCrypto),!D&&typeof y!="undefined"&&y.crypto&&(D=y.crypto),!D&&!0)try{D=N(4)}catch($){}var E=function(){if(D){if(typeof D.getRandomValues=="function")try{return D.getRandomValues(new Uint32Array(1))[0]}catch($){}if(typeof D.randomBytes=="function")try{return D.randomBytes(4).readInt32LE()}catch($){}}throw new Error("Native crypto module could not be used to get secure random number.")},g=Object.create||function(){function $(){}return function(J){var U;return $.prototype=J,U=new $,$.prototype=null,U}}(),h={},b=h.lib={},p=b.Base=function(){return{extend:function($){var J=g(this);return $&&J.mixIn($),(!J.hasOwnProperty("init")||this.init===J.init)&&(J.init=function(){J.$super.init.apply(this,arguments)}),J.init.prototype=J,J.$super=this,J},create:function(){var $=this.extend();return $.init.apply($,arguments),$},init:function(){},mixIn:function($){for(var J in $)$.hasOwnProperty(J)&&(this[J]=$[J]);$.hasOwnProperty("toString")&&(this.toString=$.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),v=b.WordArray=p.extend({init:function($,J){$=this.words=$||[],J!=M?this.sigBytes=J:this.sigBytes=$.length*4},toString:function($){return($||x).stringify(this)},concat:function($){var J=this.words,U=$.words,j=this.sigBytes,T=$.sigBytes;if(this.clamp(),j%4)for(var ee=0;ee<T;ee++){var Z=U[ee>>>2]>>>24-ee%4*8&255;J[j+ee>>>2]|=Z<<24-(j+ee)%4*8}else for(var _=0;_<T;_+=4)J[j+_>>>2]=U[_>>>2];return this.sigBytes+=T,this},clamp:function(){var $=this.words,J=this.sigBytes;$[J>>>2]&=4294967295<<32-J%4*8,$.length=F.ceil(J/4)},clone:function(){var $=p.clone.call(this);return $.words=this.words.slice(0),$},random:function($){for(var J=[],U=0;U<$;U+=4)J.push(E());return new v.init(J,$)}}),I=h.enc={},x=I.Hex={stringify:function($){for(var J=$.words,U=$.sigBytes,j=[],T=0;T<U;T++){var ee=J[T>>>2]>>>24-T%4*8&255;j.push((ee>>>4).toString(16)),j.push((ee&15).toString(16))}return j.join("")},parse:function($){for(var J=$.length,U=[],j=0;j<J;j+=2)U[j>>>3]|=parseInt($.substr(j,2),16)<<24-j%8*4;return new v.init(U,J/2)}},S=I.Latin1={stringify:function($){for(var J=$.words,U=$.sigBytes,j=[],T=0;T<U;T++){var ee=J[T>>>2]>>>24-T%4*8&255;j.push(String.fromCharCode(ee))}return j.join("")},parse:function($){for(var J=$.length,U=[],j=0;j<J;j++)U[j>>>2]|=($.charCodeAt(j)&255)<<24-j%4*8;return new v.init(U,J)}},W=I.Utf8={stringify:function($){try{return decodeURIComponent(escape(S.stringify($)))}catch(J){throw new Error("Malformed UTF-8 data")}},parse:function($){return S.parse(unescape(encodeURIComponent($)))}},B=b.BufferedBlockAlgorithm=p.extend({reset:function(){this._data=new v.init,this._nDataBytes=0},_append:function($){typeof $=="string"&&($=W.parse($)),this._data.concat($),this._nDataBytes+=$.sigBytes},_process:function($){var J,U=this._data,j=U.words,T=U.sigBytes,ee=this.blockSize,Z=ee*4,_=T/Z;$?_=F.ceil(_):_=F.max((_|0)-this._minBufferSize,0);var X=_*ee,re=F.min(X*4,T);if(X){for(var me=0;me<X;me+=ee)this._doProcessBlock(j,me);J=j.splice(0,X),U.sigBytes-=re}return new v.init(J,re)},clone:function(){var $=p.clone.call(this);return $._data=this._data.clone(),$},_minBufferSize:0}),Q=b.Hasher=B.extend({cfg:p.extend(),init:function($){this.cfg=this.cfg.extend($),this.reset()},reset:function(){B.reset.call(this),this._doReset()},update:function($){return this._append($),this._process(),this},finalize:function($){$&&this._append($);var J=this._doFinalize();return J},blockSize:512/32,_createHelper:function($){return function(J,U){return new $.init(U).finalize(J)}},_createHmacHelper:function($){return function(J,U){return new G.HMAC.init($,U).finalize(J)}}}),G=h.algo={};return h}(Math);return d})}).call(this,N("IyRk"))},K3mO:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("3y9D"),N("WYAk"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.Base,D=F.WordArray,E=d.algo,g=E.MD5,h=E.EvpKDF=M.extend({cfg:M.extend({keySize:128/32,hasher:g,iterations:1}),init:function(b){this.cfg=this.cfg.extend(b)},compute:function(b,p){for(var v,I=this.cfg,x=I.hasher.create(),S=D.create(),W=S.words,B=I.keySize,Q=I.iterations;W.length<B;){v&&x.update(v),v=x.update(b).finalize(p),x.reset();for(var G=1;G<Q;G++)v=x.finalize(v),x.reset();S.concat(v)}return S.sigBytes=B*4,S}});d.EvpKDF=function(b,p,v){return h.create(v).compute(b,p)}}(),y.EvpKDF})},KhGG:function(l,V,N){"use strict";N.d(V,"a",function(){return T}),N.d(V,"c",function(){return Z});var y=N("0Owb"),d=N("miYZ"),F=N("tsqr"),M=N("oBTY"),D=N("tJVT"),E=N("PpiC"),g=N("k1fw"),h=N("9og8"),b=N("DZo9"),p=N("8z0m"),v=N("WmNS"),I=N.n(v),x=N("q1tI"),S=N.n(x),W=N("ErOA"),B=N("NFKh"),Q=N.n(B),G=N("7Cbv"),$=N("9kvl"),J=N("mxV5"),U=N.n(J),j=p.a.Dragger,T=function(re){var me="bf3c199c2470cb477d907b1e0917c17b",de="5183666c72eec9e4",we=Q.a.enc.Utf8.parse(me),ge=Q.a.enc.Utf8.parse(de),ke=Q.a.AES.decrypt(re,we,{iv:ge,mode:Q.a.mode.CBC});return ke.toString(Q.a.enc.Utf8)},ee,Z=function(){var X=Object(h.a)(I.a.mark(function re(me,de,we){var ge,ke,z,ie,H,ae,ue,te,Se;return I.a.wrap(function(Fe){for(;;)switch(Fe.prev=Fe.next){case 0:return de.file_name=me.name,Fe.next=3,Object(W.a)("/api/buckets/get_upload_token.json",{method:"get"});case 3:return ue=Fe.sent,console.log("decrypt(res.data):",T(ue.data)),ue.data=JSON.parse(T(ue.data)),te=Object(G.a)(),Se=new U.a({endpoint:ue==null||((ge=ue.data)===null||ge===void 0)?void 0:ge.end_point,region:ue==null||((ke=ue.data)===null||ke===void 0)?void 0:ke.region,accessKeyId:ue==null||((z=ue.data)===null||z===void 0)?void 0:z.access_key_id,accessKeySecret:ue==null||((ie=ue.data)===null||ie===void 0)?void 0:ie.access_key_secret,bucket:ue==null||((H=ue.data)===null||H===void 0)?void 0:H.bucket,stsToken:ue==null||((ae=ue.data)===null||ae===void 0)?void 0:ae.security_token}),Fe.abrupt("return",new Promise(function(Ke,et){var Ie;Se.multipartUpload("".concat(te),new Blob([me],{type:me.type}),Object(g.a)(Object(g.a)({timeout:200*1e3,partSize:102400},we),{},{callback:{url:ue==null||((Ie=ue.data)===null||Ie===void 0)?void 0:Ie.callback_url,host:ue==null?void 0:ue.data.bucket_host,body:"bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&my_var=${x:my_var}&"+Object(W.e)(de)}})).then(function(dt){var Ye;me.response=(Ye=dt.data)===null||Ye===void 0?void 0:Ye.data,Ke(dt==null?void 0:dt.data)}).catch(function(dt){et(dt),console.log("err:",dt)})}));case 9:case"end":return Fe.stop()}},re)}));return function(me,de,we){return X.apply(this,arguments)}}(),_=function(re){var me=re.user,de=re.cancelUpload,we=Object(E.a)(re,["user","cancelUpload"]),ge=Object(x.useState)([]),ke=Object(D.a)(ge,2),z=ke[0],ie=ke[1],H=Object(x.useState)(),ae=Object(D.a)(H,2),ue=ae[0],te=ae[1],Se={onRemove:function(Ke){ie(Object(M.a)(z.filter(function(et){return et.name!==Ke.name}))),we.onChange(z.filter(function(et){return et.name!==Ke.name}))},disabled:we.disabled,multiple:!0,fileList:z==null?void 0:z.map(function(Fe){return Fe.file}),customRequest:function(){},beforeUpload:function(){var Fe=Object(h.a)(I.a.mark(function et(Ie){var dt;return I.a.wrap(function(Pe){for(;;)switch(Pe.prev=Pe.next){case 0:if(dt=we.maxSize||1024*1024*1024*1,!z.filter(function(Le){return Le.name===Ie.name}).length){Pe.next=4;break}return F.b.info("".concat(Ie.name,"\u5DF2\u5B58\u5728\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9")),Pe.abrupt("return");case 4:if(!((Ie==null?void 0:Ie.size)>dt)){Pe.next=7;break}return F.b.info("\u6587\u4EF6\u8D85\u8FC7".concat(dt/1024/1024/1024,"GB\uFF0C\u4E0D\u7B26\u5408\u4E0A\u4F20\u8981\u6C42")),Pe.abrupt("return",!1);case 7:return z.push({name:Ie.name,file:Ie}),ie(Object(M.a)(z)),we.onChange(z),Pe.abrupt("return",!1);case 11:case"end":return Pe.stop()}},et)}));function Ke(et){return Fe.apply(this,arguments)}return Ke}()},De=function(){var Fe=Object(h.a)(I.a.mark(function Ke(et,Ie){var dt,Ye,Pe,Le,Ge,ot,be,ye,$e;return I.a.wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return Ie.file_name=et.name,be=et.name,m.next=4,Object(W.a)("/api/buckets/get_upload_token_for_big_files.json",{method:"get"});case 4:if(ye=m.sent,ye.data=JSON.parse(T(ye.data)),!((ye==null?void 0:ye.status)!==0)){m.next=12;break}return z[z.findIndex(function(c){return c.name===be})].status="error",z[z.findIndex(function(c){return c.name===be})].file.status="error",we.onChange(z),F.b.warn("\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u5C1D\u8BD5"),m.abrupt("return");case 12:return ue=new U.a({endpoint:ye==null||((dt=ye.data)===null||dt===void 0)?void 0:dt.end_point,region:ye==null||((Ye=ye.data)===null||Ye===void 0)?void 0:Ye.region,accessKeyId:ye==null||((Pe=ye.data)===null||Pe===void 0)?void 0:Pe.access_key_id,accessKeySecret:ye==null||((Le=ye.data)===null||Le===void 0)?void 0:Le.access_key_secret,bucket:ye==null||((Ge=ye.data)===null||Ge===void 0)?void 0:Ge.bucket,stsToken:ye==null||((ot=ye.data)===null||ot===void 0)?void 0:ot.security_token}),console.log(et,"file"),te(ue),$e=Object(G.a)(),m.abrupt("return",new Promise(function(c,R){try{var fe;ue.multipartUpload("".concat(we.identifier,"/").concat($e).concat(be.indexOf(".")>-1?"."+be.split(".").pop():""),new Blob([et.file],{type:et.file.type}),{timeout:3600*1e3,partSize:1002400,progress:function(Ae,Qe,nt){try{console.log("\u8FDB\u5EA6",Ae,Qe,nt);var st=z.findIndex(function(yt){return yt.name===be});z[st].file.percent=Ae*100,z[st].tempCheckpoint=Qe,ie(Object(M.a)(z))}catch(yt){}},checkpoint:z[z.findIndex(function(pe){return pe.name===be})].tempCheckpoint,callback:{customValue:{id:be+""},url:ye==null||((fe=ye.data)===null||fe===void 0)?void 0:fe.callback_url,host:ye==null?void 0:ye.data.bucket_host,body:"bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&my_var=${x:my_var}&"+Object(W.e)(Ie)}}).then(function(pe){var Ae,Qe=z.findIndex(function(_t){return _t.name===be}),nt="done";if(((Ae=pe.data)===null||Ae===void 0?void 0:Ae.status)===0){var st;et.response=(st=pe.data)===null||st===void 0?void 0:st.data;var yt=z.findIndex(function(_t){return _t.name===be});z[yt].status="done",z[yt].file.status="done"}else{var ft;F.b.warn((ft=pe.data)===null||ft===void 0?void 0:ft.message),nt="error"}z[Qe].status=nt,z[Qe].file.status=nt,we.onChange(z),c(pe==null?void 0:pe.data)}).catch(function(pe){z[z.findIndex(function(Ae){return Ae.name===be})].status="error",z[z.findIndex(function(Ae){return Ae.name===be})].file.status="error",F.b.warn("\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u5C1D\u8BD5"),ie(Object(M.a)(z)),we.onChange(z),R(pe),console.log("err:",pe)})}catch(pe){}}));case 17:case"end":return m.stop()}},Ke)}));return function(et,Ie){return Fe.apply(this,arguments)}}();return Object(x.useEffect)(function(){z.every(function(Fe){return Fe==="done"||Fe==="error"})&&we.onComplete(z)},[z]),Object(x.useEffect)(function(){if(de){var Fe;(Fe=ue)===null||Fe===void 0||Fe.cancel()}},[de]),Object(x.useEffect)(function(){we.uploading&&z.map(function(){var Fe=Object(h.a)(I.a.mark(function Ke(et){var Ie,dt;return I.a.wrap(function(Pe){for(;;)switch(Pe.prev=Pe.next){case 0:if(!((!et.status||et.status==="error")&&!de)){Pe.next=6;break}return et.status="uploading",et.file.status="uploading",Pe.next=5,De(et,{login:me==null||((Ie=me.userInfo)===null||Ie===void 0)?void 0:Ie.login,container_type:we.container_type,container_id:we.container_id,description:we.description});case 5:dt=Pe.sent;case 6:case"end":return Pe.stop()}},Ke)}));return function(Ke){return Fe.apply(this,arguments)}}())},[we.uploading]),S.a.createElement(j,Object(y.a)({},Se,{height:we.height,className:we.className}),S.a.createElement("p",{className:"ant-upload-hint"},we.text||"\u62D6\u62FD\u6587\u4EF6\u6216\u8005\u70B9\u51FB\u4E0A\u4F20"))};V.b=Object($.a)(function(X){var re=X.loading,me=X.globalSetting,de=X.user;return{globalSetting:me,loading:re.models.competitions,user:de}})(_)},KmYQ:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.pad.ZeroPadding={pad:function(d,F){var M=F*4;d.clamp(),d.sigBytes+=M-(d.sigBytes%M||M)},unpad:function(d){for(var F=d.words,M=d.sigBytes-1,M=d.sigBytes-1;M>=0;M--)if(F[M>>>2]>>>24-M%4*8&255){d.sigBytes=M+1;break}}},y.pad.ZeroPadding})},MlIO:function(l,V,N){(function(y,d){l.exports=V=d(N("Ib8C"))})(this,function(y){return function(d){var F=y,M=F.lib,D=M.Base,E=M.WordArray,g=F.x64={},h=g.Word=D.extend({init:function(p,v){this.high=p,this.low=v}}),b=g.WordArray=D.extend({init:function(p,v){p=this.words=p||[],v!=d?this.sigBytes=v:this.sigBytes=p.length*8},toX32:function(){for(var p=this.words,v=p.length,I=[],x=0;x<v;x++){var S=p[x];I.push(S.high),I.push(S.low)}return E.create(I,this.sigBytes)},clone:function(){for(var p=D.clone.call(this),v=p.words=this.words.slice(0),I=v.length,x=0;x<I;x++)v[x]=v[x].clone();return p}})}(),y})},NFKh:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("MlIO"),N("F+F2"),N("qM6L"),N("ETIr"),N("wbyO"),N("cv67"),N("3y9D"),N("lPiR"),N("GRuw"),N("1uat"),N("uGsb"),N("5hvy"),N("ELcG"),N("WYAk"),N("e7zE"),N("K3mO"),N("OLod"),N("ALsQ"),N("9OqN"),N("qu8F"),N("S6kV"),N("gb/T"),N("qBft"),N("oRuE"),N("jO9C"),N("KmYQ"),N("uGxW"),N("bQjk"),N("wZgz"),N("pA7S"),N("w7YG"),N("E4JC"),N("PVpz"))})(this,function(y){return y})},OLES:function(l,V,N){"use strict";var y=N("U8pU"),d=N("VTBJ"),F=N("Ff2n"),M=N("q1tI"),D=N("uciX"),E=N("7ixt"),g=function(x){var S=x.overlay,W=x.prefixCls,B=x.id,Q=x.overlayInnerStyle;return M.createElement("div",{className:"".concat(W,"-inner"),id:B,role:"tooltip",style:Q},typeof S=="function"?S():S)},h=g,b=function(x,S){var W=x.overlayClassName,B=x.trigger,Q=B===void 0?["hover"]:B,G=x.mouseEnterDelay,$=G===void 0?0:G,J=x.mouseLeaveDelay,U=J===void 0?.1:J,j=x.overlayStyle,T=x.prefixCls,ee=T===void 0?"rc-tooltip":T,Z=x.children,_=x.onVisibleChange,X=x.afterVisibleChange,re=x.transitionName,me=x.animation,de=x.placement,we=de===void 0?"right":de,ge=x.align,ke=ge===void 0?{}:ge,z=x.destroyTooltipOnHide,ie=z===void 0?!1:z,H=x.defaultVisible,ae=x.getTooltipContainer,ue=x.overlayInnerStyle,te=Object(F.a)(x,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),Se=Object(M.useRef)(null);Object(M.useImperativeHandle)(S,function(){return Se.current});var De=Object(d.a)({},te);"visible"in x&&(De.popupVisible=x.visible);var Fe=function(){var Ye=x.arrowContent,Pe=Ye===void 0?null:Ye,Le=x.overlay,Ge=x.id;return[M.createElement("div",{className:"".concat(ee,"-arrow"),key:"arrow"},Pe),M.createElement(h,{key:"content",prefixCls:ee,id:Ge,overlay:Le,overlayInnerStyle:ue})]},Ke=!1,et=!1;if(typeof ie=="boolean")Ke=ie;else if(ie&&Object(y.a)(ie)==="object"){var Ie=ie.keepParent;Ke=Ie===!0,et=Ie===!1}return M.createElement(D.a,Object.assign({popupClassName:W,prefixCls:ee,popup:Fe,action:Q,builtinPlacements:E.a,popupPlacement:we,ref:Se,popupAlign:ke,getPopupContainer:ae,onPopupVisibleChange:_,afterPopupVisibleChange:X,popupTransitionName:re,popupAnimation:me,defaultPopupVisible:H,destroyPopupOnHide:Ke,autoDestroy:et,mouseLeaveDelay:U,popupStyle:j,mouseEnterDelay:$},De),Z)},p=Object(M.forwardRef)(b),v=V.a=p},OLod:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("K3mO"))})(this,function(y){y.lib.Cipher||function(d){var F=y,M=F.lib,D=M.Base,E=M.WordArray,g=M.BufferedBlockAlgorithm,h=F.enc,b=h.Utf8,p=h.Base64,v=F.algo,I=v.EvpKDF,x=M.Cipher=g.extend({cfg:D.extend(),createEncryptor:function(re,me){return this.create(this._ENC_XFORM_MODE,re,me)},createDecryptor:function(re,me){return this.create(this._DEC_XFORM_MODE,re,me)},init:function(re,me,de){this.cfg=this.cfg.extend(de),this._xformMode=re,this._key=me,this.reset()},reset:function(){g.reset.call(this),this._doReset()},process:function(re){return this._append(re),this._process()},finalize:function(re){re&&this._append(re);var me=this._doFinalize();return me},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function re(me){return typeof me=="string"?X:ee}return function(me){return{encrypt:function(de,we,ge){return re(we).encrypt(me,de,we,ge)},decrypt:function(de,we,ge){return re(we).decrypt(me,de,we,ge)}}}}()}),S=M.StreamCipher=x.extend({_doFinalize:function(){var re=this._process(!0);return re},blockSize:1}),W=F.mode={},B=M.BlockCipherMode=D.extend({createEncryptor:function(re,me){return this.Encryptor.create(re,me)},createDecryptor:function(re,me){return this.Decryptor.create(re,me)},init:function(re,me){this._cipher=re,this._iv=me}}),Q=W.CBC=function(){var re=B.extend();re.Encryptor=re.extend({processBlock:function(de,we){var ge=this._cipher,ke=ge.blockSize;me.call(this,de,we,ke),ge.encryptBlock(de,we),this._prevBlock=de.slice(we,we+ke)}}),re.Decryptor=re.extend({processBlock:function(de,we){var ge=this._cipher,ke=ge.blockSize,z=de.slice(we,we+ke);ge.decryptBlock(de,we),me.call(this,de,we,ke),this._prevBlock=z}});function me(de,we,ge){var ke,z=this._iv;z?(ke=z,this._iv=d):ke=this._prevBlock;for(var ie=0;ie<ge;ie++)de[we+ie]^=ke[ie]}return re}(),G=F.pad={},$=G.Pkcs7={pad:function(re,me){for(var de=me*4,we=de-re.sigBytes%de,ge=we<<24|we<<16|we<<8|we,ke=[],z=0;z<we;z+=4)ke.push(ge);var ie=E.create(ke,we);re.concat(ie)},unpad:function(re){var me=re.words[re.sigBytes-1>>>2]&255;re.sigBytes-=me}},J=M.BlockCipher=x.extend({cfg:x.cfg.extend({mode:Q,padding:$}),reset:function(){var re;x.reset.call(this);var me=this.cfg,de=me.iv,we=me.mode;this._xformMode==this._ENC_XFORM_MODE?re=we.createEncryptor:(re=we.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==re?this._mode.init(this,de&&de.words):(this._mode=re.call(we,this,de&&de.words),this._mode.__creator=re)},_doProcessBlock:function(re,me){this._mode.processBlock(re,me)},_doFinalize:function(){var re,me=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(me.pad(this._data,this.blockSize),re=this._process(!0)):(re=this._process(!0),me.unpad(re)),re},blockSize:128/32}),U=M.CipherParams=D.extend({init:function(re){this.mixIn(re)},toString:function(re){return(re||this.formatter).stringify(this)}}),j=F.format={},T=j.OpenSSL={stringify:function(re){var me,de=re.ciphertext,we=re.salt;return we?me=E.create([1398893684,1701076831]).concat(we).concat(de):me=de,me.toString(p)},parse:function(re){var me,de=p.parse(re),we=de.words;return we[0]==1398893684&&we[1]==1701076831&&(me=E.create(we.slice(2,4)),we.splice(0,4),de.sigBytes-=16),U.create({ciphertext:de,salt:me})}},ee=M.SerializableCipher=D.extend({cfg:D.extend({format:T}),encrypt:function(re,me,de,we){we=this.cfg.extend(we);var ge=re.createEncryptor(de,we),ke=ge.finalize(me),z=ge.cfg;return U.create({ciphertext:ke,key:de,iv:z.iv,algorithm:re,mode:z.mode,padding:z.padding,blockSize:re.blockSize,formatter:we.format})},decrypt:function(re,me,de,we){we=this.cfg.extend(we),me=this._parse(me,we.format);var ge=re.createDecryptor(de,we).finalize(me.ciphertext);return ge},_parse:function(re,me){return typeof re=="string"?me.parse(re,this):re}}),Z=F.kdf={},_=Z.OpenSSL={execute:function(re,me,de,we){we||(we=E.random(64/8));var ge=I.create({keySize:me+de}).compute(re,we),ke=E.create(ge.words.slice(me),de*4);return ge.sigBytes=me*4,U.create({key:ge,iv:ke,salt:we})}},X=M.PasswordBasedCipher=ee.extend({cfg:ee.cfg.extend({kdf:_}),encrypt:function(re,me,de,we){we=this.cfg.extend(we);var ge=we.kdf.execute(de,re.keySize,re.ivSize);we.iv=ge.iv;var ke=ee.encrypt.call(this,re,me,ge.key,we);return ke.mixIn(ge),ke},decrypt:function(re,me,de,we){we=this.cfg.extend(we),me=this._parse(me,we.format);var ge=we.kdf.execute(de,re.keySize,re.ivSize,me.salt);we.iv=ge.iv;var ke=ee.decrypt.call(this,re,me,ge.key,we);return ke}})}()})},Og1z:function(l,V){(function(N){l.exports=function(){var y={887:function(){}},d={};function F(M){if(d[M])return d[M].exports;var D=d[M]={exports:{}},E=!0;try{y[M](D,D.exports,F),E=!1}finally{E&&delete d[M]}return D.exports}return F.ab=N+"/",F(887)}()}).call(this,"/")},PVpz:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("ETIr"),N("cv67"),N("K3mO"),N("OLod"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.StreamCipher,D=d.algo,E=[],g=[],h=[],b=D.RabbitLegacy=M.extend({_doReset:function(){var v=this._key.words,I=this.cfg.iv,x=this._X=[v[0],v[3]<<16|v[2]>>>16,v[1],v[0]<<16|v[3]>>>16,v[2],v[1]<<16|v[0]>>>16,v[3],v[2]<<16|v[1]>>>16],S=this._C=[v[2]<<16|v[2]>>>16,v[0]&4294901760|v[1]&65535,v[3]<<16|v[3]>>>16,v[1]&4294901760|v[2]&65535,v[0]<<16|v[0]>>>16,v[2]&4294901760|v[3]&65535,v[1]<<16|v[1]>>>16,v[3]&4294901760|v[0]&65535];this._b=0;for(var W=0;W<4;W++)p.call(this);for(var W=0;W<8;W++)S[W]^=x[W+4&7];if(I){var B=I.words,Q=B[0],G=B[1],$=(Q<<8|Q>>>24)&16711935|(Q<<24|Q>>>8)&4278255360,J=(G<<8|G>>>24)&16711935|(G<<24|G>>>8)&4278255360,U=$>>>16|J&4294901760,j=J<<16|$&65535;S[0]^=$,S[1]^=U,S[2]^=J,S[3]^=j,S[4]^=$,S[5]^=U,S[6]^=J,S[7]^=j;for(var W=0;W<4;W++)p.call(this)}},_doProcessBlock:function(v,I){var x=this._X;p.call(this),E[0]=x[0]^x[5]>>>16^x[3]<<16,E[1]=x[2]^x[7]>>>16^x[5]<<16,E[2]=x[4]^x[1]>>>16^x[7]<<16,E[3]=x[6]^x[3]>>>16^x[1]<<16;for(var S=0;S<4;S++)E[S]=(E[S]<<8|E[S]>>>24)&16711935|(E[S]<<24|E[S]>>>8)&4278255360,v[I+S]^=E[S]},blockSize:128/32,ivSize:64/32});function p(){for(var v=this._X,I=this._C,x=0;x<8;x++)g[x]=I[x];I[0]=I[0]+1295307597+this._b|0,I[1]=I[1]+3545052371+(I[0]>>>0<g[0]>>>0?1:0)|0,I[2]=I[2]+886263092+(I[1]>>>0<g[1]>>>0?1:0)|0,I[3]=I[3]+1295307597+(I[2]>>>0<g[2]>>>0?1:0)|0,I[4]=I[4]+3545052371+(I[3]>>>0<g[3]>>>0?1:0)|0,I[5]=I[5]+886263092+(I[4]>>>0<g[4]>>>0?1:0)|0,I[6]=I[6]+1295307597+(I[5]>>>0<g[5]>>>0?1:0)|0,I[7]=I[7]+3545052371+(I[6]>>>0<g[6]>>>0?1:0)|0,this._b=I[7]>>>0<g[7]>>>0?1:0;for(var x=0;x<8;x++){var S=v[x]+I[x],W=S&65535,B=S>>>16,Q=((W*W>>>17)+W*B>>>15)+B*B,G=((S&4294901760)*S|0)+((S&65535)*S|0);h[x]=Q^G}v[0]=h[0]+(h[7]<<16|h[7]>>>16)+(h[6]<<16|h[6]>>>16)|0,v[1]=h[1]+(h[0]<<8|h[0]>>>24)+h[7]|0,v[2]=h[2]+(h[1]<<16|h[1]>>>16)+(h[0]<<16|h[0]>>>16)|0,v[3]=h[3]+(h[2]<<8|h[2]>>>24)+h[1]|0,v[4]=h[4]+(h[3]<<16|h[3]>>>16)+(h[2]<<16|h[2]>>>16)|0,v[5]=h[5]+(h[4]<<8|h[4]>>>24)+h[3]|0,v[6]=h[6]+(h[5]<<16|h[5]>>>16)+(h[4]<<16|h[4]>>>16)|0,v[7]=h[7]+(h[6]<<8|h[6]>>>24)+h[5]|0}d.RabbitLegacy=M._createHelper(b)}(),y.RabbitLegacy})},"Re/O":function(l,V,N){"use strict";(function(y,d,F){N.d(V,"a",function(){return Dr}),N.d(V,"b",function(){return Tn}),N.d(V,"c",function(){return Zo}),N.d(V,"d",function(){return vl}),N.d(V,"e",function(){return qc}),N.d(V,"f",function(){return zp}),N.d(V,"g",function(){return Gc}),N.d(V,"h",function(){return pn}),N.d(V,"i",function(){return Pa}),N.d(V,"j",function(){return vs}),N.d(V,"k",function(){return ps}),N.d(V,"l",function(){return Vc}),N.d(V,"m",function(){return In}),N.d(V,"n",function(){return oi}),N.d(V,"o",function(){return Nl}),N.d(V,"p",function(){return Up}),N.d(V,"q",function(){return bu}),N.d(V,"r",function(){return bl}),N.d(V,"s",function(){return ml}),N.d(V,"t",function(){return ea}),N.d(V,"u",function(){return pu}),N.d(V,"v",function(){return Fn}),N.d(V,"w",function(){return xu}),N.d(V,"x",function(){return wa}),N.d(V,"y",function(){return Nt}),N.d(V,"z",function(){return fl}),N.d(V,"A",function(){return Kc}),N.d(V,"B",function(){return ro}),N.d(V,"C",function(){return gl}),N.d(V,"D",function(){return Go}),N.d(V,"E",function(){return Ln}),N.d(V,"F",function(){return Oo}),N.d(V,"G",function(){return Ur}),N.d(V,"H",function(){return qn}),N.d(V,"I",function(){return Qn}),N.d(V,"J",function(){return ni}),N.d(V,"K",function(){return kn}),N.d(V,"L",function(){return Rr}),N.d(V,"M",function(){return Zn}),N.d(V,"N",function(){return Cl}),N.d(V,"O",function(){return Ea}),N.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 M=function(n,r){return(M=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(n,r)};function D(n,r){function e(){this.constructor=n}M(n,r),n.prototype=r===null?Object.create(r):(e.prototype=r.prototype,new e)}function E(n,r,e,t){return new(e||(e=Promise))(function(o,a){function i(f){try{u(t.next(f))}catch(C){a(C)}}function s(f){try{u(t.throw(f))}catch(C){a(C)}}function u(f){f.done?o(f.value):new e(function(C){C(f.value)}).then(i,s)}u((t=t.apply(n,r||[])).next())})}function g(n,r){var e,t,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(f){return function(C){if(e)throw new TypeError("Generator is already executing.");for(;i;)try{if(e=1,t&&(o=2&C[0]?t.return:C[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,C[1])).done)return o;switch(t=0,o&&(C=[2&C[0],o.value]),C[0]){case 0:case 1:o=C;break;case 4:return i.label++,{value:C[1],done:!1};case 5:i.label++,t=C[1],C=[0];continue;case 7:C=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(C[0]===6||C[0]===2)){i=0;continue}if(C[0]===3&&(!o||C[1]>o[0]&&C[1]<o[3])){i.label=C[1];break}if(C[0]===6&&i.label<o[1]){i.label=o[1],o=C;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(C);break}o[2]&&i.ops.pop(),i.trys.pop();continue}C=r.call(n,i)}catch(k){C=[6,k],t=0}finally{e=o=0}if(5&C[0])throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}([u,f])}}}var h=function(){function n(r){this.global=r,this.flags={},this.flagRegistry={},this.urlFlags={},this.populateURLFlags()}return n.prototype.setPlatform=function(r,e){this.platform!=null&&console.warn("Platform "+this.platformName+" has already been set. Overwriting the platform with "+e+"."),this.platformName=r,this.platform=e},n.prototype.registerFlag=function(r,e,t){if(this.flagRegistry[r]={evaluationFn:e,setHook:t},this.urlFlags[r]!=null){var o=this.urlFlags[r];console.warn("Setting feature override from URL "+r+": "+o+"."),this.set(r,o)}},n.prototype.get=function(r){return r in this.flags?this.flags[r]:(this.flags[r]=this.evaluateFlag(r),this.flags[r])},n.prototype.getNumber=function(r){return this.get(r)},n.prototype.getBool=function(r){return this.get(r)},n.prototype.getFlags=function(){return this.flags},Object.defineProperty(n.prototype,"features",{get:function(){return this.flags},enumerable:!0,configurable:!0}),n.prototype.set=function(r,e){if(this.flagRegistry[r]==null)throw new Error("Cannot set flag "+r+" as it has not been registered.");this.flags[r]=e,this.flagRegistry[r].setHook!=null&&this.flagRegistry[r].setHook(e)},n.prototype.evaluateFlag=function(r){if(this.flagRegistry[r]==null)throw new Error("Cannot evaluate flag '"+r+"': no evaluation function found.");return this.flagRegistry[r].evaluationFn()},n.prototype.setFlags=function(r){this.flags=Object.assign({},r)},n.prototype.reset=function(){this.flags={},this.urlFlags={},this.populateURLFlags()},n.prototype.populateURLFlags=function(){var r=this;if(this.global!==void 0&&this.global.location!==void 0&&this.global.location.search!==void 0){var e,t,o=(e=this.global.location.search,t={},e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,function(a){for(var i=[],s=1;s<arguments.length;s++)i[s-1]=arguments[s];return b(t,i[0],i[1]),i.join("=")}),t);"tfjsflags"in o&&o.tfjsflags.split(",").forEach(function(a){var i=a.split(":"),s=i[0],u=i[1];r.urlFlags[s]=function(f,C){if((C=C.toLowerCase())==="true"||C==="false")return C==="true";if(""+ +C===C)return+C;throw new Error("Could not parse value flag value "+C+" for flag "+f+".")}(s,u)})}},n}();function b(n,r,e){n[decodeURIComponent(r)]=decodeURIComponent(e||"")}function p(){return v}var v=null,I=new Map,x=new Map;function S(n,r){var e=U(n,r);return I.get(e)}function W(n){return x.get(n)}function B(n){for(var r=I.entries(),e=[];;){var t=r.next(),o=t.done,a=t.value;if(o)break;var i=a[0],s=a[1];i.split("_")[0]===n&&e.push(s)}return e}function Q(n){var r=n.kernelName,e=n.backendName,t=U(r,e);if(I.has(t))throw new Error("The kernel '"+r+"' for backend '"+e+"' is already registered");I.set(t,n)}function G(n){var r=n.kernelName;x.has(r)&&console.warn("Overriding the gradient for '"+r+"'"),x.set(r,n)}function $(n,r){var e=U(n,r);if(!I.has(e))throw new Error("The kernel '"+n+"' for backend '"+r+"' is not registered");I.delete(e)}function J(n){if(!x.has(n))throw new Error("The gradient '"+n+"' for backend is not registered");x.delete(n)}function U(n,r){return r+"_"+n}function j(n){for(var r=n.length,e=0,t=0;r>0;)t=Math.random()*r|0,e=n[--r],n[r]=n[t],n[t]=e}function T(n,r,e){return Math.max(n,Math.min(r,e))}function ee(n){return n%2==0?n:n+1}function Z(n){for(var r=0,e=0;e<n.length;e++)r+=n[e];return r}function _(n,r){if(!n)throw new Error(typeof r=="string"?r:r())}function X(n,r,e){e===void 0&&(e=""),_(we(n,r),function(){return e+" Shapes "+n+" and "+r+" must match"})}function re(n){_(n!=null,function(){return"The input to the tensor constructor must be a non-null value."})}function me(n,r,e){if(r===void 0&&(r=[]),e===void 0&&(e=!1),r==null&&(r=[]),Array.isArray(n)||Ie(n)&&!e)for(var t=0;t<n.length;++t)me(n[t],r,e);else r.push(n);return r}function de(n){if(n.length===0)return 1;for(var r=n[0],e=1;e<n.length;e++)r*=n[e];return r}function we(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 ge(n){return n%1==0}function ke(n){if(Math.tanh!=null)return Math.tanh(n);if(n===1/0)return 1;if(n===-1/0)return-1;var r=Math.exp(2*n);return(r-1)/(r+1)}function z(n){var r=Math.ceil(Math.sqrt(n));return[r,Math.ceil(n/r)]}function ie(n,r){return r<=n.length?n:n+" ".repeat(r-n.length)}function H(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 ae(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 ue(n,r){var e=r.length;return _((n=n==null?r.map(function(t,o){return o}):[].concat(n)).every(function(t){return t>=-e&&t<e}),function(){return"All values in axis param must be in range [-"+e+", "+e+") but got axis "+n}),_(n.every(function(t){return ge(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 te(n,r){for(var e=[],t=[],o=r!=null&&Array.isArray(r)&&r.length===0,a=r==null||o?null:ue(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 Se(n,r){var e=null;if(n==null||n==="float32")e=new Float32Array(r);else if(n==="int32")e=new Int32Array(r);else{if(n!=="bool")throw new Error("Unknown data type "+n);e=new Uint8Array(r)}return e}function De(n,r){var e=null;if(n==null||n==="float32")e=new Float32Array(r);else if(n==="int32")e=new Int32Array(r);else if(n==="bool")e=new Uint8Array(r);else{if(n!=="string")throw new Error("Unknown data type "+n);e=new Array(r)}return e}function Fe(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 Ke(n){return n==="bool"||n==="complex64"||n==="float32"||n==="int32"||n==="string"}function et(n,r){return r!=="complex64"&&((r!=="float32"||n==="complex64")&&(r!=="int32"||n==="float32"||n==="complex64"))&&(r!=="bool"||n!=="bool")}function Ie(n){return n instanceof Float32Array||n instanceof Int32Array||n instanceof Uint8Array}function dt(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 Le(n){return typeof n=="boolean"}function Ge(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":Ge(n)?"float32":Pe(n)?"string":Le(n)?"bool":"float32"}function be(n){return!!(n&&n.constructor&&n.call&&n.apply)}function ye(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 q(n,r,e){if(r==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(n)&&(n=me(n)),e&&Fe(n,r),function(a,i){return a instanceof Float32Array&&i==="float32"||a instanceof Int32Array&&i==="int32"||a instanceof Uint8Array&&i==="bool"}(n,r))return n;if(r==null||r==="float32"||r==="complex64")return new Float32Array(n);if(r==="int32")return new Int32Array(n);if(r==="bool"){for(var t=new Uint8Array(n.length),o=0;o<t.length;++o)Math.round(n[o])!==0&&(t[o]=1);return t}throw new Error("Unknown data type "+r)}function m(n,r){if(n.length===0)return r[0];var e=n.reduce(function(t,o){return t*o});if(e===0)return[];if(e!==r.length)throw new Error("["+n+"] does not match the input size.");return function t(o,a,i){var s=new Array;if(a.length===1)for(var u=a[0],f=0;f<u;f++)s[f]=i[o+f];else{u=a[0];var C=a.slice(1),k=C.reduce(function(L,Y){return L*Y});for(f=0;f<u;f++)s[f]=t(o+f*k,C,i)}return s}(0,n,r)}function c(n,r){for(var e=R(n,r),t=0;t<e.length;t++)e[t]=1;return e}function R(n,r){if(r==null||r==="float32"||r==="complex64")return new Float32Array(n);if(r==="int32")return new Int32Array(n);if(r==="bool")return new Uint8Array(n);throw new Error("Unknown data type "+r)}function fe(){return p().platform.now()}function pe(n){n.forEach(function(r){_(Number.isInteger(r)&&r>=0,function(){return"Tensor must have a shape comprised of positive integers but got shape ["+n+"]."})})}function Ae(n,r){return r===void 0&&(r="utf-8"),r=r||"utf-8",p().platform.encode(n,r)}function Qe(n,r){return r===void 0&&(r="utf-8"),r=r||"utf-8",p().platform.decode(n,r)}function nt(n,r,e){if(r===0)return 0;if(r===1)return n[0];for(var t=n[n.length-1],o=0;o<n.length-1;++o)t+=e[o]*n[o];return t}function st(n,r,e){if(r===0)return[];if(r===1)return[n];for(var t=new Array(r),o=0;o<t.length-1;++o)t[o]=Math.floor(n/e[o]),n-=t[o]*e[o];return t[t.length-1]=n,t}var yt=Object.freeze({shuffle:j,clamp:T,nearestLargerEven:ee,sum:Z,randUniform:function(n,r){var e=Math.random();return r*e+(1-e)*n},distSquared:function(n,r){for(var e=0,t=0;t<n.length;t++){var o=Number(n[t])-Number(r[t]);e+=o*o}return e},assert:_,assertShapesMatch:X,assertNonNull:re,flatten:me,sizeFromShape:de,isScalarShape:function(n){return n.length===0},arraysEqual:we,isInt:ge,tanh:ke,sizeToSquarishShape:z,createShuffledIndices:function(n){for(var r=new Uint32Array(n),e=0;e<n;++e)r[e]=e;return j(r),r},rightPad:ie,repeatedTry:H,inferFromImplicitShape:ae,parseAxisParam:ue,squeezeShape:te,getTypedArrayFromDType:Se,getArrayFromDType:De,checkConversionForErrors:Fe,isValidDtype:Ke,hasEncodingLoss:et,isTypedArray:Ie,bytesPerElement:dt,bytesFromStringArray:Ye,isString:Pe,isBoolean:Le,isNumber:Ge,inferDtype:ot,isFunction:be,nearestDivisor:ye,computeStrides:$e,toTypedArray:q,toNestedArray:m,makeOnesTypedArray:c,makeZerosTypedArray:R,now:fe,assertNonNegativeIntegerDimensions:pe,fetch:function(n,r){return p().platform.fetch(n,r)},encodeString:Ae,decodeString:Qe,locToIndex:nt,indexToLoc:st}),ft=function(){function n(r,e){this.backendTimer=r,this.logger=e,e==null&&(this.logger=new _t)}return n.prototype.profileKernel=function(r,e,t){var o,a=this,i=this.backendTimer.time(function(){o=t()});return o.forEach(function(s){s.data().then(function(u){!function(f,C,k){if(C!=="float32")return!1;for(var L=0;L<f.length;L++){var Y=f[L];if(isNaN(Y)||!isFinite(Y))return console.warn("Found "+Y+" in the result of '"+k+"'"),!0}}(u,s.dtype,r),i.then(function(f){var C="";f.getExtraProfileInfo!=null&&(C=f.getExtraProfileInfo()),a.logger.logKernelProfile(r,s,u,f.kernelMs,e,C)})})}),o},n}(),_t=function(){function n(){}return n.prototype.logKernelProfile=function(r,e,t,o,a,i){var s=typeof o=="number"?ie(o+"ms",9):o.error,u=ie(r,25),f=e.rank,C=e.size,k=ie(e.shape.toString(),14),L="";for(var Y in a){var ne=a[Y].shape||e.shape,ce=ne.length;L+=Y+": "+ce+"D "+(ce>0?ne:"")+" "}console.log("%c"+u+" %c"+s+" %c"+f+"D "+k+" %c"+C+" %c"+L+" %c"+i,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")},n}(),Dt=20,at=3,jt=7;function mr(n,r,e,t){var o=$e(r),a=function(f,C,k,L){var Y=de(C),ne=L[L.length-1],ce=new Array(ne).fill(0),se=C.length,le=k==="complex64"?Fr(f):f;if(se>1)for(var xe=0;xe<Y/ne;xe++)for(var Ee=xe*ne,Ce=0;Ce<ne;Ce++)ce[Ce]=Math.max(ce[Ce],rr(le[Ee+Ce],0,k).length);return ce}(n,r,e,o),i=r.length,s=function f(C,k,L,Y,ne,ce){ce===void 0&&(ce=!0);var se=L==="complex64"?2:1,le=k[0],xe=k.length;if(xe===0)return L==="complex64"?[rr(Fr(C)[0],0,L)]:L==="bool"?[Sr(C[0])]:[C[0].toString()];if(xe===1){if(le>Dt){var Ee=at*se,Ce=Array.from(C.slice(0,Ee)),Te=Array.from(C.slice((le-at)*se,le*se));return L==="complex64"&&(Ce=Fr(Ce),Te=Fr(Te)),["["+Ce.map(function(ut,gt){return rr(ut,ne[gt],L)}).join(", ")+", ..., "+Te.map(function(ut,gt){return rr(ut,ne[le-at+gt],L)}).join(", ")+"]"]}return["["+(L==="complex64"?Fr(C):Array.from(C)).map(function(ut,gt){return rr(ut,ne[gt],L)}).join(", ")+"]"]}var Me=k.slice(1),He=Y.slice(1),Be=Y[0]*se,je=[];if(le>Dt){for(var We=0;We<at;We++){var Ze=(Je=We*Be)+Be;je.push.apply(je,f(C.slice(Je,Ze),Me,L,He,ne,!1))}for(je.push("..."),We=le-at;We<le;We++)Ze=(Je=We*Be)+Be,je.push.apply(je,f(C.slice(Je,Ze),Me,L,He,ne,We===le-1))}else for(We=0;We<le;We++){var Je;Ze=(Je=We*Be)+Be,je.push.apply(je,f(C.slice(Je,Ze),Me,L,He,ne,We===le-1))}var ht=xe===2?",":"";for(je[0]="["+je[0]+ht,We=1;We<je.length-1;We++)je[We]=" "+je[We]+ht;var lt=`,
|
|
|
`;for(We=2;We<xe;We++)lt+=`
|
|
|
`;return je[je.length-1]=" "+je[je.length-1]+"]"+(ce?"":lt),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 ie(Array.isArray(n)?parseFloat(n[0].toFixed(jt))+" + "+parseFloat(n[1].toFixed(jt))+"j":Pe(n)?"'"+n+"'":e==="bool"?Sr(n):parseFloat(n.toFixed(jt)).toString(),r)}function Sr(n){return n===0?"false":"true"}function Fr(n){for(var r=[],e=0;e<n.length;e+=2)r.push([n[e],n[e+1]]);return r}var Nr=function(){function n(r,e,t){var o=this;if(this.dtype=e,this.shape=r.slice(),this.size=de(r),t!=null){var a=t.length;_(a===this.size,function(){return"Length of values '"+a+"' does not match the size inferred by the shape '"+o.size+"'."})}if(e==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=t||De(e,this.size),this.strides=$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]),_(t.length===this.rank,function(){return"The number of provided coordinates ("+t.length+") must match the rank ("+e.rank+")"});var a=this.locToIndex(t);this.values[a]=r},n.prototype.get=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];r.length===0&&(r=[0]);for(var t=0,o=0,a=r;o<a.length;o++){var i=a[o];if(i<0||i>=this.shape[t]){var s="Requested out of range element at "+r+". Buffer shape="+this.shape;throw new Error(s)}t++}for(var u=r[r.length-1],f=0;f<r.length-1;++f)u+=this.strides[f]*r[f];return this.values[u]},n.prototype.locToIndex=function(r){if(this.rank===0)return 0;if(this.rank===1)return r[0];for(var e=r[r.length-1],t=0;t<r.length-1;++t)e+=this.strides[t]*r[t];return e},n.prototype.indexToLoc=function(r){if(this.rank===0)return[];if(this.rank===1)return[r];for(var e=new Array(this.shape.length),t=0;t<e.length-1;++t)e[t]=Math.floor(r/this.strides[t]),r-=e[t]*this.strides[t];return e[e.length-1]=r,e},Object.defineProperty(n.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),n.prototype.toTensor=function(){return Ar().makeTensor(this.values,this.shape,this.dtype)},n}(),Ar=null,tt=null,Vn=null,Dr=function(){function n(r,e,t,o){this.kept=!1,this.isDisposedInternal=!1,this.shape=r.slice(),this.dtype=e||"float32",this.size=de(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(),_(this.size===1,function(){return"The array must have only 1 element."}),this.reshape([])},n.prototype.as1D=function(){return this.throwIfDisposed(),this.reshape([this.size])},n.prototype.as2D=function(r,e){return this.throwIfDisposed(),this.reshape([r,e])},n.prototype.as3D=function(r,e,t){return this.throwIfDisposed(),this.reshape([r,e,t])},n.prototype.as4D=function(r,e,t,o){return this.throwIfDisposed(),this.reshape([r,e,t,o])},n.prototype.as5D=function(r,e,t,o,a){return this.throwIfDisposed(),this.reshape([r,e,t,o,a])},n.prototype.asType=function(r){return this.throwIfDisposed(),tt.cast(this,r)},Object.defineProperty(n.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),n.prototype.buffer=function(){return E(this,void 0,void 0,function(){var r;return g(this,function(e){switch(e.label){case 0:return[4,this.data()];case 1:return r=e.sent(),[2,tt.buffer(this.shape,this.dtype,r)]}})})},n.prototype.bufferSync=function(){return tt.buffer(this.shape,this.dtype,this.dataSync())},n.prototype.array=function(){return E(this,void 0,void 0,function(){var r;return g(this,function(e){switch(e.label){case 0:return[4,this.data()];case 1:return r=e.sent(),[2,m(this.shape,r)]}})})},n.prototype.arraySync=function(){return m(this.shape,this.dataSync())},n.prototype.data=function(){return E(this,void 0,void 0,function(){var r,e;return g(this,function(t){switch(t.label){case 0:return this.throwIfDisposed(),r=Ar().read(this.dataId),this.dtype!=="string"?[3,2]:[4,r];case 1:e=t.sent();try{return[2,e.map(function(o){return Qe(o)})]}catch(o){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}t.label=2;case 2:return[2,r]}})})},n.prototype.dataSync=function(){this.throwIfDisposed();var r=Ar().readSync(this.dataId);if(this.dtype==="string")try{return r.map(function(e){return Qe(e)})}catch(e){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return r},n.prototype.bytes=function(){return E(this,void 0,void 0,function(){var r;return g(this,function(e){switch(e.label){case 0:return this.throwIfDisposed(),[4,Ar().read(this.dataId)];case 1:return r=e.sent(),this.dtype==="string"?[2,r]:[2,new Uint8Array(r.buffer)]}})})},n.prototype.dispose=function(){this.isDisposed||(Ar().disposeTensor(this),this.isDisposedInternal=!0)},Object.defineProperty(n.prototype,"isDisposed",{get:function(){return this.isDisposedInternal},enumerable:!0,configurable:!0}),n.prototype.throwIfDisposed=function(){if(this.isDisposed)throw new Error("Tensor is disposed.")},n.prototype.toFloat=function(){return this.asType("float32")},n.prototype.toInt=function(){return this.asType("int32")},n.prototype.toBool=function(){return this.asType("bool")},n.prototype.print=function(r){return r===void 0&&(r=!1),tt.print(this,r)},n.prototype.reshape=function(r){return this.throwIfDisposed(),tt.reshape(this,r)},n.prototype.reshapeAs=function(r){return this.throwIfDisposed(),this.reshape(r.shape)},n.prototype.expandDims=function(r){return r===void 0&&(r=0),tt.expandDims(this,r)},n.prototype.cumsum=function(r,e,t){return r===void 0&&(r=0),e===void 0&&(e=!1),t===void 0&&(t=!1),tt.cumsum(this,r,e,t)},n.prototype.squeeze=function(r){return this.throwIfDisposed(),tt.squeeze(this,r)},n.prototype.clone=function(){return this.throwIfDisposed(),tt.clone(this)},n.prototype.oneHot=function(r,e,t){return this.throwIfDisposed(),tt.oneHot(this,r,e,t)},n.prototype.toString=function(r){return r===void 0&&(r=!1),mr(this.dataSync(),this.shape,this.dtype,r)},n.prototype.tile=function(r){return this.throwIfDisposed(),tt.tile(this,r)},n.prototype.gather=function(r,e){return e===void 0&&(e=0),this.throwIfDisposed(),tt.gather(this,r,e)},n.prototype.matMul=function(r,e,t){return e===void 0&&(e=!1),t===void 0&&(t=!1),this.throwIfDisposed(),tt.matMul(this,r,e,t)},n.prototype.dot=function(r){return this.throwIfDisposed(),tt.dot(this,r)},n.prototype.norm=function(r,e,t){return r===void 0&&(r="euclidean"),e===void 0&&(e=null),t===void 0&&(t=!1),this.throwIfDisposed(),tt.norm(this,r,e,t)},n.prototype.slice=function(r,e){return this.throwIfDisposed(),tt.slice(this,r,e)},n.prototype.reverse=function(r){return this.throwIfDisposed(),tt.reverse(this,r)},n.prototype.concat=function(r,e){return e===void 0&&(e=0),this.throwIfDisposed(),r instanceof n&&(r=[r]),tt.concat([this].concat(r),e)},n.prototype.split=function(r,e){return e===void 0&&(e=0),this.throwIfDisposed(),tt.split(this,r,e)},n.prototype.stack=function(r,e){return e===void 0&&(e=0),tt.stack([this,r],e)},n.prototype.unstack=function(r){return r===void 0&&(r=0),tt.unstack(this,r)},n.prototype.pad=function(r,e){return e===void 0&&(e=0),tt.pad(this,r,e)},n.prototype.batchNormalization=function(r,e,t,o,a){return t===void 0&&(t=.001),Vn("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon"),this.batchNorm(r,e,a,o,t)},n.prototype.batchNorm=function(r,e,t,o,a){return a===void 0&&(a=.001),this.throwIfDisposed(),tt.batchNorm(this,r,e,t,o,a)},n.prototype.all=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),tt.all(this,r,e)},n.prototype.any=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),tt.any(this,r,e)},n.prototype.logSumExp=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),tt.logSumExp(this,r,e)},n.prototype.sum=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),tt.sum(this,r,e)},n.prototype.prod=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),tt.prod(this,r,e)},n.prototype.mean=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),tt.mean(this,r,e)},n.prototype.min=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),tt.min(this,r,e)},n.prototype.max=function(r,e){return r===void 0&&(r=null),e===void 0&&(e=!1),this.throwIfDisposed(),tt.max(this,r,e)},n.prototype.argMin=function(r){return r===void 0&&(r=null),this.throwIfDisposed(),tt.argMin(this,r)},n.prototype.argMax=function(r){return r===void 0&&(r=null),this.throwIfDisposed(),tt.argMax(this,r)},n.prototype.cast=function(r){return this.throwIfDisposed(),tt.cast(this,r)},n.prototype.add=function(r){return this.throwIfDisposed(),tt.add(this,r)},n.prototype.addStrict=function(r){return this.throwIfDisposed(),tt.addStrict(this,r)},n.prototype.atan2=function(r){return this.throwIfDisposed(),tt.atan2(this,r)},n.prototype.sub=function(r){return this.throwIfDisposed(),tt.sub(this,r)},n.prototype.subStrict=function(r){return this.throwIfDisposed(),tt.subStrict(this,r)},n.prototype.pow=function(r){return this.throwIfDisposed(),tt.pow(this,r)},n.prototype.powStrict=function(r){return this.throwIfDisposed(),tt.powStrict(this,r)},n.prototype.mul=function(r){return this.throwIfDisposed(),tt.mul(this,r)},n.prototype.mulStrict=function(r){return this.throwIfDisposed(),tt.mulStrict(this,r)},n.prototype.div=function(r){return this.throwIfDisposed(),tt.div(this,r)},n.prototype.divNoNan=function(r){return this.throwIfDisposed(),tt.divNoNan(this,r)},n.prototype.floorDiv=function(r){return this.throwIfDisposed(),tt.floorDiv(this,r)},n.prototype.divStrict=function(r){return this.throwIfDisposed(),tt.divStrict(this,r)},n.prototype.minimum=function(r){return this.throwIfDisposed(),tt.minimum(this,r)},n.prototype.minimumStrict=function(r){return this.throwIfDisposed(),tt.minimumStrict(this,r)},n.prototype.maximum=function(r){return this.throwIfDisposed(),tt.maximum(this,r)},n.prototype.maximumStrict=function(r){return this.throwIfDisposed(),tt.maximumStrict(this,r)},n.prototype.mod=function(r){return this.throwIfDisposed(),tt.mod(this,r)},n.prototype.modStrict=function(r){return this.throwIfDisposed(),tt.modStrict(this,r)},n.prototype.squaredDifferenceStrict=function(r){return this.throwIfDisposed(),tt.squaredDifferenceStrict(this,r)},n.prototype.transpose=function(r){return this.throwIfDisposed(),tt.transpose(this,r)},n.prototype.notEqual=function(r){return this.throwIfDisposed(),tt.notEqual(this,r)},n.prototype.notEqualStrict=function(r){return this.throwIfDisposed(),tt.notEqualStrict(this,r)},n.prototype.less=function(r){return this.throwIfDisposed(),tt.less(this,r)},n.prototype.lessStrict=function(r){return this.throwIfDisposed(),tt.lessStrict(this,r)},n.prototype.equal=function(r){return this.throwIfDisposed(),tt.equal(this,r)},n.prototype.equalStrict=function(r){return this.throwIfDisposed(),tt.equalStrict(this,r)},n.prototype.lessEqual=function(r){return this.throwIfDisposed(),tt.lessEqual(this,r)},n.prototype.lessEqualStrict=function(r){return this.throwIfDisposed(),tt.lessEqualStrict(this,r)},n.prototype.greater=function(r){return this.throwIfDisposed(),tt.greater(this,r)},n.prototype.greaterStrict=function(r){return this.throwIfDisposed(),tt.greaterStrict(this,r)},n.prototype.greaterEqual=function(r){return this.throwIfDisposed(),tt.greaterEqual(this,r)},n.prototype.greaterEqualStrict=function(r){return this.throwIfDisposed(),tt.greaterEqualStrict(this,r)},n.prototype.logicalAnd=function(r){return this.throwIfDisposed(),tt.logicalAnd(this,r)},n.prototype.logicalOr=function(r){return this.throwIfDisposed(),tt.logicalOr(this,r)},n.prototype.logicalNot=function(){return this.throwIfDisposed(),tt.logicalNot(this)},n.prototype.logicalXor=function(r){return this.throwIfDisposed(),tt.logicalXor(this,r)},n.prototype.where=function(r,e){return this.throwIfDisposed(),tt.where(r,this,e)},n.prototype.neg=function(){return this.throwIfDisposed(),tt.neg(this)},n.prototype.ceil=function(){return this.throwIfDisposed(),tt.ceil(this)},n.prototype.floor=function(){return this.throwIfDisposed(),tt.floor(this)},n.prototype.sign=function(){return this.throwIfDisposed(),tt.sign(this)},n.prototype.isNaN=function(){return this.throwIfDisposed(),tt.isNaN(this)},n.prototype.isInf=function(){return this.throwIfDisposed(),tt.isInf(this)},n.prototype.isFinite=function(){return this.throwIfDisposed(),tt.isFinite(this)},n.prototype.exp=function(){return this.throwIfDisposed(),tt.exp(this)},n.prototype.expm1=function(){return this.throwIfDisposed(),tt.expm1(this)},n.prototype.log=function(){return this.throwIfDisposed(),tt.log(this)},n.prototype.log1p=function(){return this.throwIfDisposed(),tt.log1p(this)},n.prototype.sqrt=function(){return this.throwIfDisposed(),tt.sqrt(this)},n.prototype.rsqrt=function(){return this.throwIfDisposed(),tt.rsqrt(this)},n.prototype.square=function(){return this.throwIfDisposed(),tt.square(this)},n.prototype.reciprocal=function(){return this.throwIfDisposed(),tt.reciprocal(this)},n.prototype.abs=function(){return this.throwIfDisposed(),tt.abs(this)},n.prototype.clipByValue=function(r,e){return this.throwIfDisposed(),tt.clipByValue(this,r,e)},n.prototype.relu=function(){return this.throwIfDisposed(),tt.relu(this)},n.prototype.relu6=function(){return this.throwIfDisposed(),tt.relu6(this)},n.prototype.elu=function(){return this.throwIfDisposed(),tt.elu(this)},n.prototype.selu=function(){return this.throwIfDisposed(),tt.selu(this)},n.prototype.leakyRelu=function(r){return r===void 0&&(r=.2),this.throwIfDisposed(),tt.leakyRelu(this,r)},n.prototype.prelu=function(r){return this.throwIfDisposed(),tt.prelu(this,r)},n.prototype.sigmoid=function(){return this.throwIfDisposed(),tt.sigmoid(this)},n.prototype.logSigmoid=function(){return this.throwIfDisposed(),tt.logSigmoid(this)},n.prototype.softplus=function(){return this.throwIfDisposed(),tt.softplus(this)},n.prototype.zerosLike=function(){return this.throwIfDisposed(),tt.zerosLike(this)},n.prototype.onesLike=function(){return this.throwIfDisposed(),tt.onesLike(this)},n.prototype.sin=function(){return this.throwIfDisposed(),tt.sin(this)},n.prototype.cos=function(){return this.throwIfDisposed(),tt.cos(this)},n.prototype.tan=function(){return this.throwIfDisposed(),tt.tan(this)},n.prototype.asin=function(){return this.throwIfDisposed(),tt.asin(this)},n.prototype.acos=function(){return this.throwIfDisposed(),tt.acos(this)},n.prototype.atan=function(){return this.throwIfDisposed(),tt.atan(this)},n.prototype.sinh=function(){return this.throwIfDisposed(),tt.sinh(this)},n.prototype.cosh=function(){return this.throwIfDisposed(),tt.cosh(this)},n.prototype.tanh=function(){return this.throwIfDisposed(),tt.tanh(this)},n.prototype.asinh=function(){return this.throwIfDisposed(),tt.asinh(this)},n.prototype.acosh=function(){return this.throwIfDisposed(),tt.acosh(this)},n.prototype.atanh=function(){return this.throwIfDisposed(),tt.atanh(this)},n.prototype.erf=function(){return this.throwIfDisposed(),tt.erf(this)},n.prototype.round=function(){return this.throwIfDisposed(),tt.round(this)},n.prototype.step=function(r){return r===void 0&&(r=0),this.throwIfDisposed(),tt.step(this,r)},n.prototype.softmax=function(r){return r===void 0&&(r=-1),this.throwIfDisposed(),tt.softmax(this,r)},n.prototype.logSoftmax=function(r){return r===void 0&&(r=-1),this.throwIfDisposed(),tt.logSoftmax(this,r)},n.prototype.resizeBilinear=function(r,e){return e===void 0&&(e=!1),this.throwIfDisposed(),tt.image.resizeBilinear(this,r,e)},n.prototype.resizeNearestNeighbor=function(r,e){return e===void 0&&(e=!1),this.throwIfDisposed(),tt.image.resizeNearestNeighbor(this,r,e)},n.prototype.conv1d=function(r,e,t,o,a,i){return o===void 0&&(o="NWC"),a===void 0&&(a=1),this.throwIfDisposed(),tt.conv1d(this,r,e,t,o,a,i)},n.prototype.conv2d=function(r,e,t,o,a,i){return o===void 0&&(o="NHWC"),a===void 0&&(a=[1,1]),this.throwIfDisposed(),tt.conv2d(this,r,e,t,o,a,i)},n.prototype.conv2dTranspose=function(r,e,t,o,a){return this.throwIfDisposed(),tt.conv2dTranspose(this,r,e,t,o,a)},n.prototype.depthwiseConv2D=function(r,e,t,o,a,i){return o===void 0&&(o="NHWC"),a===void 0&&(a=[1,1]),this.throwIfDisposed(),tt.depthwiseConv2d(this,r,e,t,o,a,i)},n.prototype.separableConv2d=function(r,e,t,o,a,i){return a===void 0&&(a=[1,1]),i===void 0&&(i="NHWC"),this.throwIfDisposed(),tt.separableConv2d(this,r,e,t,o,a,i)},n.prototype.avgPool=function(r,e,t,o){return this.throwIfDisposed(),tt.avgPool(this,r,e,t,o)},n.prototype.maxPool=function(r,e,t,o){return this.throwIfDisposed(),tt.maxPool(this,r,e,t,o)},n.prototype.localResponseNormalization=function(r,e,t,o){return r===void 0&&(r=5),e===void 0&&(e=1),t===void 0&&(t=1),o===void 0&&(o=.5),tt.localResponseNormalization(this,r,e,t,o)},n.prototype.pool=function(r,e,t,o,a){return this.throwIfDisposed(),tt.pool(this,r,e,t,o,a)},n.prototype.variable=function(r,e,t){return r===void 0&&(r=!0),this.throwIfDisposed(),Ar().makeVariable(this,r,e,t)},n.prototype.unsortedSegmentSum=function(r,e){return this.throwIfDisposed(),tt.unsortedSegmentSum(this,r,e)},n.prototype.batchToSpaceND=function(r,e){return this.throwIfDisposed(),tt.batchToSpaceND(this,r,e)},n.prototype.spaceToBatchND=function(r,e){return this.throwIfDisposed(),tt.spaceToBatchND(this,r,e)},n.prototype.topk=function(r,e){return r===void 0&&(r=1),e===void 0&&(e=!0),this.throwIfDisposed(),tt.topk(this,r,e)},n.prototype.stridedSlice=function(r,e,t,o,a,i,s,u){return o===void 0&&(o=0),a===void 0&&(a=0),i===void 0&&(i=0),s===void 0&&(s=0),u===void 0&&(u=0),this.throwIfDisposed(),tt.stridedSlice(this,r,e,t,o,a,i,s,u)},n.prototype.depthToSpace=function(r,e){return this.throwIfDisposed(),tt.depthToSpace(this,r,e)},n.prototype.fft=function(){return this.throwIfDisposed(),tt.spectral.fft(this)},n.prototype.ifft=function(){return this.throwIfDisposed(),tt.spectral.ifft(this)},n.prototype.rfft=function(){return this.throwIfDisposed(),tt.spectral.rfft(this)},n.prototype.irfft=function(){return this.throwIfDisposed(),tt.spectral.irfft(this)},n}();Object.defineProperty(Dr,Symbol.hasInstance,{value:function(n){return!!n&&n.dataId!=null&&n.shape!=null&&n.dtype!=null}});var ko,Xn,uo,Cr,co,Tn=function(n){function r(e,t,o,a){var i=n.call(this,e.shape,e.dtype,e.dataId,a)||this;return i.trainable=t,i.name=o,i}return D(r,n),r.prototype.assign=function(e){if(e.dtype!==this.dtype)throw new Error("dtype of the new value ("+e.dtype+") and previous value ("+this.dtype+") must match");if(!we(e.shape,this.shape))throw new Error("shape of the new value ("+e.shape+") and previous value ("+this.shape+") must match");Ar().disposeTensor(this),this.dataId=e.dataId,Ar().incRef(this,null)},r.prototype.dispose=function(){Ar().disposeVariable(this),this.isDisposedInternal=!0},r}(Dr);Object.defineProperty(Tn,Symbol.hasInstance,{value:function(n){return n instanceof Dr&&n.assign!=null&&n.assign instanceof Function}}),function(n){n.R0="R0",n.R1="R1",n.R2="R2",n.R3="R3",n.R4="R4",n.R5="R5",n.R6="R6"}(ko||(ko={})),function(n){n.float32="float32",n.int32="int32",n.bool="int32",n.complex64="complex64"}(Xn||(Xn={})),function(n){n.float32="float32",n.int32="int32",n.bool="bool",n.complex64="complex64"}(uo||(uo={})),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"}(co||(co={}));var lo={float32:Cr,int32:Xn,bool:uo,complex64:co};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 lo[n][r]}function pr(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 rn(n,r){_(n.dtype===r.dtype,function(){return"The dtypes of the first("+n.dtype+") and second("+r.dtype+") input must match"})}function ln(n){var r=[];return function e(t,o,a){if(t==null)return;if(t instanceof Dr)return void o.push(t);if(i=t,!Array.isArray(i)&&typeof i!="object")return;var i,s=t;for(var u in s){var f=s[u];a.has(f)||(a.add(f),e(f,o,a))}}(n,r,new Set),r}var Mo,Ai=Object.freeze({makeTypesMatch:cr,assertTypesMatch:rn,isTensorInList:function(n,r){return r.some(function(e){return e.id===n.id})},getTensorsInContainer:ln}),Va=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}(),Oi=function(){function n(r){this.ENV=r,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new Va}return n.prototype.ready=function(){return E(this,void 0,void 0,function(){var r,e,t;return g(this,function(o){switch(o.label){case 0:if(this.pendingBackendInit!=null)return[2,this.pendingBackendInit.then(function(){})];if(this.backendInstance!=null)return[2];r=this.getSortedBackends(),e=0,o.label=1;case 1:return e<r.length?(t=r[e],[4,this.initializeBackend(t).success]):[3,5];case 2:return o.sent()?[4,this.setBackend(t)]:[3,4];case 3:return o.sent(),[2];case 4:return e++,[3,1];case 5:throw new Error("Could not initialize any backends, all backend initializations failed.")}})})},Object.defineProperty(n.prototype,"backend",{get:function(){if(this.pendingBackendInit!=null)throw new Error("Backend '"+this.backendName+"' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");if(this.backendInstance==null){var r=this.initializeBackendsAndReturnBest(),e=r.name;if(r.asyncInit)throw new Error("The highest priority backend '"+e+"' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");this.setBackend(e)}return this.backendInstance},enumerable:!0,configurable:!0}),n.prototype.backendNames=function(){return Object.keys(this.registryFactory)},n.prototype.findBackend=function(r){if(!(r in this.registry)){if(!(r in this.registryFactory))return null;if(this.initializeBackend(r).asyncInit)return null}return this.registry[r]},n.prototype.findBackendFactory=function(r){return r in this.registryFactory?this.registryFactory[r].factory:null},n.prototype.registerBackend=function(r,e,t){return t===void 0&&(t=1),r in this.registryFactory?(console.warn(r+" backend was already registered. Reusing existing backend factory."),!1):(this.registryFactory[r]={factory:e,priority:t},!0)},n.prototype.setBackend=function(r){return E(this,void 0,void 0,function(){var e,t,o;return g(this,function(a){switch(a.label){case 0:if(this.registryFactory[r]==null)throw new Error("Backend name '"+r+"' not found in registry");return this.backendName=r,this.registry[r]!=null?[3,4]:(this.backendInstance=null,e=this.initializeBackend(r),t=e.success,e.asyncInit?[4,t]:[3,2]);case 1:return o=a.sent(),[3,3];case 2:o=t,a.label=3;case 3:if(!o)return[2,!1];a.label=4;case 4:return this.backendInstance=this.registry[r],this.setupRegisteredKernels(),this.profiler=new ft(this.backendInstance),[2,!0]}})})},n.prototype.setupRegisteredKernels=function(){var r=this;B(this.backendName).forEach(function(e){e.setupFunc!=null&&e.setupFunc(r.backendInstance)})},n.prototype.disposeRegisteredKernels=function(r){var e=this;B(r).forEach(function(t){t.disposeFunc!=null&&t.disposeFunc(e.registry[r])})},n.prototype.initializeBackend=function(r){var e=this,t=this.registryFactory[r];if(t==null)throw new Error("Cannot initialize backend "+r+", no registration found.");try{var o=t.factory();if(Promise.resolve(o)===o){var a=++this.pendingBackendInitId,i=o.then(function(s){return!(a<e.pendingBackendInitId)&&(e.registry[r]=s,e.pendingBackendInit=null,!0)}).catch(function(s){return!(a<e.pendingBackendInitId)&&(e.pendingBackendInit=null,console.warn("Initialization of backend "+r+" failed"),console.warn(s.stack||s.message),!1)});return this.pendingBackendInit=i,{success:i,asyncInit:!0}}return this.registry[r]=o,{success:!0,asyncInit:!1}}catch(s){return console.warn("Initialization of backend "+r+" failed"),console.warn(s.stack||s.message),{success:!1,asyncInit:!1}}},n.prototype.removeBackend=function(r){if(!(r in this.registryFactory))throw new Error(r+" backend not found in registry");this.backendName===r&&this.pendingBackendInit!=null&&this.pendingBackendInitId++,r in this.registry&&(this.disposeRegisteredKernels(r),this.registry[r].dispose(),delete this.registry[r]),delete this.registryFactory[r],this.backendName===r&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)},n.prototype.getSortedBackends=function(){var r=this;if(Object.keys(this.registryFactory).length===0)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort(function(e,t){return r.registryFactory[t].priority-r.registryFactory[e].priority})},n.prototype.initializeBackendsAndReturnBest=function(){for(var r=this.getSortedBackends(),e=0;e<r.length;e++){var t=r[e],o=this.initializeBackend(t),a=o.success,i=o.asyncInit;if(i||a)return{name:t,asyncInit:i}}throw new Error("Could not initialize any backends, all backend initializations failed.")},n.prototype.moveData=function(r,e){var t=this.state.tensorInfo.get(e),o=t.backend,a=this.readSync(e);o.disposeData(e),t.backend=r,r.move(e,a,t.shape,t.dtype),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++},n.prototype.tidy=function(r,e){var t,o=this,a=null;if(e==null){if(typeof r!="function")throw new Error("Please provide a function to tidy()");e=r}else{if(typeof r!="string"&&!(r instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if(typeof e!="function")throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");a=r}return this.scopedRun(function(){return o.startScope(a)},function(){return o.endScope(t)},function(){return(t=e())instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),t})},n.prototype.scopedRun=function(r,e,t){r();try{var o=t();return e(),o}catch(a){throw e(),a}},n.prototype.nextTensorId=function(){return n.nextTensorId++},n.prototype.nextVariableId=function(){return n.nextVariableId++},n.prototype.clone=function(r){var e=this.makeTensorFromDataId(r.dataId,r.shape,r.dtype),t={x:r};return this.addTapeNode(this.state.activeScope.name,t,[e],function(o){return{x:function(){return o.toFloat()}}},[]),e},n.prototype.runKernel=function(r,e,t,o,a){return this.runKernelFunc(null,e,null,r,t,o,a)},n.prototype.shouldCheckForMemLeaks=function(){return this.ENV.getBool("IS_TEST")},n.prototype.checkKernelForMemLeak=function(r,e,t){var o=this.backend.numDataIds(),a=0;t.forEach(function(u){a+=u.dtype==="complex64"?3:1});var i=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],s=o-e-a-i;if(s>0)throw new Error("Backend '"+this.backendName+"' has an internal memory leak ("+s+" data ids) after running '"+r+"'")},n.prototype.runKernelFunc=function(r,e,t,o,a,i,s){var u,f=this;i===void 0&&(i=[]),s===void 0&&(s=[]);var C=[],k=this.isTapeOn();o==null&&(o=this.state.activeScope!=null?this.state.activeScope.name:"");var L,Y=function(xe){k&&(C=xe.map(function(Ee){return f.keep(f.clone(Ee))}))},ne=this.state.numBytes,ce=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);var se,le=S(o,this.backendName);return L=le!=null?function(){var xe=f.backend.numDataIds();se=le.kernelFunc({inputs:e,attrs:a,backend:f.backend});var Ee=Array.isArray(se)?se:[se];f.shouldCheckForMemLeaks()&&f.checkKernelForMemLeak(o,xe,Ee);var Ce=Ee.map(function(Me){var He=Me.dataId,Be=Me.shape,je=Me.dtype;return f.makeTensorFromDataId(He,Be,je)}),Te=Ce.filter(function(Me,He){return s[He]});return Y((i||[]).slice().concat(Te)),Ce}:function(){var xe=f.backend.numDataIds();se=f.tidy(function(){return r(f.backend,Y)});var Ee=Array.isArray(se)?se:[se];return f.shouldCheckForMemLeaks()&&f.checkKernelForMemLeak(o,xe,Ee),Ee},this.scopedRun(function(){return f.state.kernelDepth++},function(){return f.state.kernelDepth--},function(){u=f.ENV.getBool("DEBUG")?f.profiler.profileKernel(o,e,function(){return L()}):L()}),k&&this.addTapeNode(o,e,u,t,C),this.state.profiling&&this.state.activeProfile.kernels.push({name:o,bytesAdded:this.state.numBytes-ne,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-ce,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(e).map(function(xe){return e[xe].shape}),outputShapes:u.map(function(xe){return xe.shape})}),Array.isArray(se)?u:u[0]},n.prototype.makeTensor=function(r,e,t,o){if(r==null)throw new Error("Values passed to engine.makeTensor() are null");t=t||"float32",o=o||this.backend;var a=r;t==="string"&&Pe(r[0])&&(a=r.map(function(C){return Ae(C)}));var i=o.write(a,e,t),s=new Dr(e,t,i,this.nextTensorId());if(this.incRef(s,o),t==="string"){var u=this.state.tensorInfo.get(i),f=Ye(a);this.state.numBytes+=f-u.bytes,u.bytes=f}return s},n.prototype.makeTensorFromDataId=function(r,e,t,o){var a=new Dr(e,t=t||"float32",r,this.nextTensorId());return this.incRef(a,o),a},n.prototype.makeVariable=function(r,e,t,o){e===void 0&&(e=!0),t=t||this.nextVariableId().toString(),o!=null&&o!==r.dtype&&(r=r.asType(o));var a=new Tn(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*dt(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 Tn||this.track(r)},n.prototype.disposeTensor=function(r){if(this.state.tensorInfo.has(r.dataId)){this.state.numTensors--,r.dtype==="string"&&this.state.numStringTensors--;var e=this.state.tensorInfo.get(r.dataId);e.refCount<=1?(r.dtype!=="complex64"&&(this.state.numBytes-=e.bytes),this.state.numDataBuffers--,e.backend.disposeData(r.dataId),this.state.tensorInfo.delete(r.dataId)):this.state.tensorInfo.get(r.dataId).refCount--}},n.prototype.disposeVariables=function(){for(var r in this.state.registeredVariables){var e=this.state.registeredVariables[r];this.disposeVariable(e)}},n.prototype.disposeVariable=function(r){this.disposeTensor(r),this.state.registeredVariables[r.name]!=null&&delete this.state.registeredVariables[r.name]},n.prototype.memory=function(){var r=this.backend.memory();return r.numTensors=this.state.numTensors,r.numDataBuffers=this.state.numDataBuffers,r.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(r.unreliable=!0,r.reasons==null&&(r.reasons=[]),r.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),r},n.prototype.profile=function(r){return E(this,void 0,void 0,function(){var e,t;return g(this,function(o){return this.state.profiling=!0,e=this.state.numBytes,t=this.state.numTensors,this.state.activeProfile.kernels=[],this.state.activeProfile.result=r(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max.apply(Math,this.state.activeProfile.kernels.map(function(a){return a.totalBytesSnapshot})),this.state.activeProfile.newBytes=this.state.numBytes-e,this.state.activeProfile.newTensors=this.state.numTensors-t,[2,this.state.activeProfile]})})},n.prototype.isTapeOn=function(){return this.state.gradientDepth>0&&this.state.kernelDepth===0},n.prototype.addTapeNode=function(r,e,t,o,a){var i=this,s={id:this.state.nextTapeNodeId++,kernelName:r,inputs:e,outputs:t,saved:a},u=W(r);u!=null&&(o=u.gradFunc),o!=null&&(s.gradient=function(f){return f=f.map(function(C,k){if(C==null){var L=t[k],Y=R(L.size,L.dtype);return i.makeTensor(Y,L.shape,L.dtype)}return C}),o(f.length>1?f:f[0],a)}),this.state.activeTape.push(s)},n.prototype.keep=function(r){return r.kept=!0,r},n.prototype.startTape=function(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++},n.prototype.endTape=function(){this.state.gradientDepth--},n.prototype.startScope=function(r){var e={track:[],name:"unnamed scope",id:this.state.nextScopeId++};r&&(e.name=r),this.state.scopeStack.push(e),this.state.activeScope=e},n.prototype.endScope=function(r){for(var e=this,t=ln(r),o=new Set(t.map(function(u){return u.id})),a=0;a<this.state.activeScope.track.length;a++){var i=this.state.activeScope.track[a];i.kept||o.has(i.id)||i.dispose()}var s=this.state.scopeStack.pop();this.state.activeScope=this.state.scopeStack.length===0?null:this.state.scopeStack[this.state.scopeStack.length-1],t.forEach(function(u){u.kept||u.scopeId!==s.id||e.track(u)})},n.prototype.gradients=function(r,e,t,o){var a=this;if(o===void 0&&(o=!1),_(e.length>0,function(){return"gradients() received an empty list of xs."}),t!=null&&t.dtype!=="float32")throw new Error("dy must have 'float32' dtype, but has '"+t.dtype+"'");var i=this.scopedRun(function(){return a.startTape()},function(){return a.endTape()},function(){return a.tidy("forward",r)});_(i instanceof Dr,function(){return"The result y returned by f() must be a tensor."});var s=function(u,f,C){for(var k={},L={},Y=0;Y<f.length;Y++)k[f[Y].id]=!0;for(Y=0;Y<u.length;Y++){var ne=(Me=u[Y]).inputs;for(var ce in ne){for(var se=ne[ce],le=!1,xe=0;xe<f.length;xe++)if(k[se.id]){Me.outputs.forEach(function(We){return k[We.id]=!0}),le=!0,L[Me.id]=!0;break}if(le)break}}var Ee={};Ee[C.id]=!0;var Ce={};for(Y=u.length-1;Y>=0;Y--)for(ne=(Me=u[Y]).inputs,xe=0;xe<Me.outputs.length;xe++)if(Ee[Me.outputs[xe].id]){for(var ce in ne)Ee[ne[ce].id]=!0,Ce[Me.id]=!0;break}var Te=[];for(Y=0;Y<u.length;Y++){var Me;if(L[(Me=u[Y]).id]&&Ce[Me.id]){var He={};for(var ce in Me.inputs){var Be=Me.inputs[ce];k[Be.id]&&(He[ce]=Be)}var je=Object.assign({},Me);je.inputs=He,je.outputs=Me.outputs,Te.push(je)}}return Te}(this.state.activeTape,e,i);if(!o&&s.length===0&&e.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",function(){var u,f,C={};C[i.id]=t==null?(u=i.shape,f=c(de(u),"float32"),Ve.makeTensor(f,u,"float32")):t,function(L,Y,ne){for(var ce=function(le){var xe=Y[le],Ee=[];if(xe.outputs.forEach(function(He){var Be=L[He.id];Be!=null?Ee.push(Be):Ee.push(null)}),xe.gradient==null)throw new Error("Cannot compute gradient: gradient function not found for "+xe.kernelName+".");var Ce=xe.gradient(Ee),Te=function(He){if(!(He in Ce))throw new Error("Cannot backprop through input "+He+". Available gradients found: "+Object.keys(Ce)+".");var Be=ne(function(){return Ce[He]()});if(Be.dtype!=="float32")throw new Error("Error in gradient for op "+xe.kernelName+". The gradient of input "+He+" must have 'float32' dtype, but has '"+Be.dtype+"'");var je=xe.inputs[He];if(!we(Be.shape,je.shape))throw new Error("Error in gradient for op "+xe.kernelName+". The gradient of input '"+He+"' has shape '"+Be.shape+"', which does not match the shape of the input '"+je.shape+"'");if(L[je.id]==null)L[je.id]=Be;else{var We=L[je.id];L[je.id]=We.add(Be),We.dispose()}};for(var Me in xe.inputs)Te(Me)},se=Y.length-1;se>=0;se--)ce(se)}(C,s,function(L){return a.tidy(L)});var k=e.map(function(L){return C[L.id]});return a.state.gradientDepth===0&&(a.state.activeTape.forEach(function(L){for(var Y=0,ne=L.saved;Y<ne.length;Y++)ne[Y].dispose()}),a.state.activeTape=null),{value:i,grads:k}})},n.prototype.customGrad=function(r){var e=this;return _(be(r),function(){return"The f passed in customGrad(f) must be a function."}),function(){for(var t,o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];_(o.every(function(s){return s instanceof Dr}),function(){return"The args passed in customGrad(f)(x1, x2,...) must all be tensors"});var i={};return o.forEach(function(s,u){i[u]=s}),e.runKernelFunc(function(s,u){return _((t=r.apply(void 0,o.concat([u]))).value instanceof Dr,function(){return"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"}),_(be(t.gradFunc),function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."}),t.value},i,function(s,u){var f=t.gradFunc(s,u),C=Array.isArray(f)?f:[f];_(C.length===o.length,function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."}),_(C.every(function(L){return L instanceof Dr}),function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors."});var k={};return C.forEach(function(L,Y){k[Y]=function(){return L}}),k})}},n.prototype.readSync=function(r){return this.state.tensorInfo.get(r).backend.readSync(r)},n.prototype.read=function(r){return this.state.tensorInfo.get(r).backend.read(r)},n.prototype.time=function(r){return E(this,void 0,void 0,function(){var e,t;return g(this,function(o){switch(o.label){case 0:return e=fe(),[4,this.backend.time(r)];case 1:return(t=o.sent()).wallMs=fe()-e,[2,t]}})})},n.prototype.track=function(r){return this.state.activeScope!=null&&(r.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(r)),r},Object.defineProperty(n.prototype,"registeredVariables",{get:function(){return this.state.registeredVariables},enumerable:!0,configurable:!0}),n.prototype.reset=function(){for(var r in this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new Va,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(Mo==null){var e=void 0;if(typeof window!="undefined")e=window;else if(typeof y!="undefined")e=y;else if(typeof d!="undefined")e=d;else{if(typeof self=="undefined")throw new Error("Could not find a global object");e=self}Mo=e}return Mo}();if(n._tfengine==null){var r=new h(n);n._tfengine=new Oi(r)}return function(e){v=e}(n._tfengine.ENV),Ar=function(){return n._tfengine},n._tfengine}();function Xa(){return typeof window!="undefined"&&window.document!=null||typeof WorkerGlobalScope!="undefined"}var Sn=p();Sn.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.")}),Sn.registerFlag("IS_BROWSER",function(){return Xa()}),Sn.registerFlag("IS_NODE",function(){return typeof d!="undefined"&&d.versions!==void 0&&d.versions.node!==void 0}),Sn.registerFlag("IS_CHROME",function(){return typeof navigator!="undefined"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}),Sn.registerFlag("PROD",function(){return!1}),Sn.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",function(){return Sn.getBool("DEBUG")}),Sn.registerFlag("DEPRECATION_WARNINGS_ENABLED",function(){return!0}),Sn.registerFlag("IS_TEST",function(){return!1});var Po,Wr,Hr,An={},Ka={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function Ya(n,r){An[n]=r}function gn(n){n in An||(An[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 An[e]},!1),e===1?t.getContext("webgl",Ka)||t.getContext("experimental-webgl",Ka):t.getContext("webgl2",Ka)}(n));var r=An[n];return r.isContextLost()?(delete An[n],gn(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),An[n])}function Kn(n,r){return[r,n]}function Or(n){var r=de(n);return z(Math.ceil(r/4))}function Yn(n,r){return[Math.max(1,Math.ceil(r/2)),Math.max(1,Math.ceil(n/2))]}function Fo(n,r){var e,t,o,a,i,s,u,f,C,k=n;return p().getNumber("WEBGL_VERSION")===2?(e=k.R32F,t=k.R16F,o=k.RGBA16F,a=k.RGBA32F,i=k.RED,s=4,u=1,f=k.HALF_FLOAT,C=k.FLOAT):(e=n.RGBA,t=n.RGBA,o=n.RGBA,a=k.RGBA,i=n.RGBA,s=4,u=4,f=r!=null?r.HALF_FLOAT_OES:null,C=n.FLOAT),{internalFormatFloat:e,internalFormatHalfFloat:t,internalFormatPackedHalfFloat:o,internalFormatPackedFloat:a,textureFormatFloat:i,downloadTextureFormat:n.RGBA,downloadUnpackNumChannels:s,defaultNumChannels:u,textureTypeHalfFloat:f,textureTypeFloat:C}}function St(n,r,e){var t=e();return r&&function(o){var a=o.getError();if(a!==o.NO_ERROR)throw new Error("WebGL Error: "+$a(o,a))}(n),t}!function(n){n[n.DENSE=0]="DENSE",n[n.SHARED_BATCH=1]="SHARED_BATCH"}(Po||(Po={})),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 qu=596e-10,ws=65504;function Es(n){return!!(p().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||n===0||qu<Math.abs(n)&&Math.abs(n)<ws)}function $a(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 Rn(n,r,function(){return n.getExtension(e)},'Extension "'+e+'" not supported on this browser.')}function _s(n,r,e){var t=Rn(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 yn(n,r,e){var t=Rn(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=oa.exec(a);if(i==null)return console.log("Couldn't parse line number in error: "+a),void console.log(o);for(var s=+i[1],u=o.split(`
|
|
|
`),f=u.length.toString().length+2,C=u.map(function(se,le){return ie((le+1).toString(),f)+se}),k=0,L=0;L<C.length;L++)k=Math.max(C[L].length,k);var Y=C.slice(0,s-1),ne=C.slice(s-1,s),ce=C.slice(s);console.log(Y.join(`
|
|
|
`)),console.log(a.split(`
|
|
|
`)[0]),console.log("%c "+ie(ne[0],k),"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(ce.join(`
|
|
|
`))}(e,n.getShaderInfoLog(t)),new Error("Failed to compile fragment shader.");return t}var zr,fo,oa=/ERROR: [0-9]+:([0-9]+):/g;function on(n,r){return Rn(n,r,function(){return n.createProgram()},"Unable to create WebGLProgram.")}function bn(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 $n(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 aa(n,r,e){var t=Rn(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 Ja(n,r,e){var t=Rn(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 ia(n,r){return Rn(n,r,function(){return n.createTexture()},"Unable to create WebGLTexture.")}function sa(n,r){var e=p().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(n<=0||r<=0){var t="["+n+"x"+r+"]";throw new Error("Requested texture size "+t+" is invalid.")}if(n>e||r>e)throw t="["+n+"x"+r+"]",new Error("Requested texture size "+t+" greater than WebGL maximum on this browser / GPU "+("["+e+"x"+e+"]")+".")}function On(n,r){return Rn(n,r,function(){return n.createFramebuffer()},"Unable to create WebGLFramebuffer.")}function dn(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 qa(n,r,e,t){ei(n,t),St(n,r,function(){return n.activeTexture(n.TEXTURE0+t)}),St(n,r,function(){return n.bindTexture(n.TEXTURE_2D,e)})}function Ri(n,r,e,t){return Rn(n,r,function(){return n.getUniformLocation(e,t)},'uniform "'+t+'" not present in program.')}function Qa(n,r,e){return n.getUniformLocation(r,e)}function Za(n,r,e,t,o,a){St(n,r,function(){return qa(n,r,t,a)}),St(n,r,function(){return n.uniform1i(o,a)})}function ua(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 ca(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: "+Ii(n,r))}function Ii(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 Rn(n,r,e,t){var o=St(n,r,function(){return e()});if(o==null)throw new Error(t);return o}function ei(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 ho(n,r){return r===void 0&&(r=2),de(n.slice(0,n.length-r))}function po(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 mo(n){var r=[1,1,1];return n.length===0||n.length===1&&n[0]===1||(r=[ho(n)].concat(po(n))),r}function Ni(n,r){var e;r===void 0&&(r=!1);var t=p().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(r&&(t*=2,(n=n.map(function(f,C){return C>=n.length-2?ee(n[C]):n[C]})).length===1&&(n=[2,n[0]])),n.length!==2){var o=te(n);n=o.newShape}var a=de(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=ho(n),s=2,u=2;return n.length&&(s=(e=po(n))[0],u=e[1]),z(a=i*(s/2)*(u/2)).map(function(f){return 2*f})}return z(a)}function la(n){return n%2==0}function vo(n,r){if(we(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(la(e)&&la(t)&&(n[0]===1||r[0]===1))return!0}return n[1]===r[1]&&la(n[0])&&la(r[0])}function Di(n){if(zr==null){var r=gn(n);zr=r.getParameter(r.MAX_TEXTURE_SIZE)}return zr}function da(n){if(fo==null){var r=gn(n);fo=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,fo)}function jo(n){if(n===0)return 0;var r=gn(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 fa(n){try{if(gn(n)!=null)return!0}catch(r){return!1}return!1}function ki(n){if(n===0)return!1;var r=gn(n);if(n===1){if(!Jr(r,"OES_texture_float"))return!1}else if(!Jr(r,"EXT_color_buffer_float"))return!1;return ti(r)}function Mi(n){if(n===0)return!1;var r=gn(n);if(n!==1){if(Jr(r,"EXT_color_buffer_float"))return ti(r);if(Jr(r,"EXT_color_buffer_half_float")){var e=r.getExtension("EXT_color_buffer_half_float");return function(t,o){var a=Fo(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")&&ti(r)}function ti(n){var r=Fo(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 Pi(n){return n===2&&gn(n).fenceSync!=null}var Cs=Object.freeze({callAndCheck:St,canBeRepresented:Es,getWebGLErrorMessage:$a,getExtensionOrThrow:Lo,createVertexShader:_s,createFragmentShader:yn,createProgram:on,linkProgram:bn,validateProgram:$n,createStaticVertexBuffer:aa,createStaticIndexBuffer:Ja,getNumChannels:function(){return p().getNumber("WEBGL_VERSION")===2?1:4},createTexture:ia,validateTextureSize:sa,createFramebuffer:On,bindVertexBufferToProgramAttribute:dn,bindTextureUnit:qa,unbindTextureUnit:function(n,r,e){ei(n,e),St(n,r,function(){return n.activeTexture(n.TEXTURE0+e)}),St(n,r,function(){return n.bindTexture(n.TEXTURE_2D,null)})},getProgramUniformLocationOrThrow:Ri,getProgramUniformLocation:Qa,bindTextureToProgramUniformSampler:Za,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:ua,unbindColorTextureFromFramebuffer:ca,validateFramebuffer:$r,getFramebufferErrorMessage:Ii,getBatchDim:ho,getRowsCols:po,getShapeAs3D:mo,getTextureShapeFromLogicalShape:Ni,isReshapeFree:vo,getWebGLMaxTextureSize:Di,resetMaxTextureSize:function(){zr=null},resetMaxTexturesInShader:function(){fo=null},getMaxTexturesInShader:da,getWebGLDisjointQueryTimerVersion:jo,hasExtension:Jr,isWebGLVersionEnabled:fa,isCapableOfRenderingToFloatTexture:ki,isDownloadFloatTextureEnabled:Mi,isWebGLFenceEnabled:Pi}),Ft=p();function Fi(){p().set("PROD",!0)}function Qu(){p().set("DEBUG",!0)}function Zu(){p().set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")}function Li(n){p().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(n+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}function ec(){Ve.disposeVariables()}function Bo(){return Ve}function tc(){return Ve.memory()}function Ts(n){return Ve.profile(n)}function Rr(n,r){return Ve.tidy(n,r)}function qr(n){ln(n).forEach(function(r){return r.dispose()})}function Ss(n){return Ve.keep(n)}function rc(n){return Ve.time(n)}function nc(n){return Ve.setBackend(n)}function ad(){return Ve.ready()}function oc(){return Ve.backendName}function ji(n){Ve.removeBackend(n)}function ac(n){return Ve.findBackend(n)}function As(n){return Ve.findBackendFactory(n)}function Os(n,r,e){return e===void 0&&(e=1),Ve.registerBackend(n,r,e)}function ic(){return Ve.backend}function sc(n,r){p().setPlatform(n,r)}function ha(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];p().getBool("IS_TEST")||console.warn.apply(console,n)}function xn(n,r){var e=n;if(Ie(n))return r==="string"?[]:[n.length];if(!Array.isArray(n))return[];for(var t=[];Array.isArray(e)||Ie(e)&&r!=="string";)t.push(e.length),e=e[0];return Array.isArray(n)&&p().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&function o(a,i,s){if(s=s||[],!Array.isArray(a)&&!Ie(a))return void _(i.length===0,function(){return"Element arr["+s.join("][")+"] is a primitive, but should be an array/TypedArray of "+i[0]+" elements"});_(i.length>0,function(){return"Element arr["+s.join("][")+"] should be a primitive, but is an array of "+a.length+" elements"}),_(a.length===i[0],function(){return"Element arr["+s.join("][")+"] should have "+i[0]+" elements, but has "+a.length+" elements"});for(var u=i.slice(1),f=0;f<a.length;++f)o(a[f],u,s.concat(f))}(n,t,[]),t}function fn(n,r,e,t){if(n!=null&&(n!=="numeric"&&n!==r||n==="numeric"&&r==="string"))throw new Error("Argument '"+e+"' passed to '"+t+"' must be "+n+" tensor, but got "+r+" tensor")}function Oe(n,r,e,t){if(t===void 0&&(t="numeric"),n instanceof Dr)return fn(t,n.dtype,r,e),n;var o=ot(n);if(o!=="string"&&["bool","int32","float32"].indexOf(t)>=0&&(o=t),fn(t,o,r,e),n==null||!Ie(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=xn(n,o);Ie(n)||Array.isArray(n)||(n=[n]);var s=o!=="string"?q(n,o,p().getBool("DEBUG")):me(n,[],!0);return Ve.makeTensor(s,i,o)}function go(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 Bi(n,r){for(var e=0;e<n.length;++e)if(n[n.length-e-1]!==r-1-e)return!1;return!0}function ri(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 ri(n,r.map(function(e){return 1}),r)}function nn(n,r,e){_(Bi(r,e),function(){return n+" supports only inner-most axes for now. Got axes "+r+" and rank-"+e+" input."})}function an(n,r){if(Bi(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 yo(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 hn(n,r){for(var e=[],t=r-n;t<r;++t)e.push(t);return e}function Ui(n,r){var e=n[0].length;n.forEach(function(o,a){_(o.length===e,function(){return"Error in concat"+e+"D: rank of tensors["+a+"] must be the same as the rank of the rest ("+e+")"})}),_(r>=0&&r<e,function(){return"Error in concat"+e+"D: axis must be between 0 and "+(e-1)+"."});var t=n[0];n.forEach(function(o,a){for(var i=0;i<e;i++)_(i===r||o[i]===t[i],function(){return"Error in concat"+e+"D: Shape of tensors["+a+"] ("+o+") does not match the shape of the rest ("+t+") along the non-concatenated axis "+a+"."})})}function Jn(n,r){for(var e=n[0].slice(),t=1;t<n.length;t++)e[r]+=n[t][r];return e}function Xe(n){var r=Object.keys(n);if(r.length!==1)throw new Error("Please provide an object with a single key (operation name) mapping to a function. Got an object with "+r.length+" keys.");var e=r[0],t=n[e];e.endsWith("_")&&(e=e.substring(0,e.length-1));var o=function(){for(var a=[],i=0;i<arguments.length;i++)a[i]=arguments[i];Ve.startScope(e);try{var s=t.apply(void 0,a);return s instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),Ve.endScope(s),s}catch(u){throw Ve.endScope(null),u}};return Object.defineProperty(o,"name",{value:e,configurable:!0}),o}Ft.registerFlag("HAS_WEBGL",function(){return Ft.getNumber("WEBGL_VERSION")>0}),Ft.registerFlag("WEBGL_VERSION",function(){return fa(2)?2:fa(1)?1:0}),Ft.registerFlag("WEBGL_BUFFER_SUPPORTED",function(){return Ft.get("WEBGL_VERSION")===2}),Ft.registerFlag("WEBGL_CPU_FORWARD",function(){return!0}),Ft.registerFlag("WEBGL_FORCE_F16_TEXTURES",function(){return!1}),Ft.registerFlag("WEBGL_PACK",function(){return Ft.getBool("HAS_WEBGL")}),Ft.registerFlag("WEBGL_PACK_NORMALIZATION",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_PACK_CLIP",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_PACK_DEPTHWISECONV",function(){return!1}),Ft.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_PACK_REDUCE",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_LAZILY_UNPACK",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_CONV_IM2COL",function(){return Ft.getBool("WEBGL_PACK")}),Ft.registerFlag("WEBGL_MAX_TEXTURE_SIZE",function(){return Di(Ft.getNumber("WEBGL_VERSION"))}),Ft.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",function(){return da(Ft.getNumber("WEBGL_VERSION"))}),Ft.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",function(){var n=Ft.getNumber("WEBGL_VERSION");return n===0?0:jo(n)}),Ft.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",function(){return Ft.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&(n=navigator.userAgent||navigator.vendor||window.opera,!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(n)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(n.substr(0,4))));var n}),Ft.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",function(){return ki(Ft.getNumber("WEBGL_VERSION"))}),Ft.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",function(){return!Ft.getBool("WEBGL_FORCE_F16_TEXTURES")&&Ft.getBool("WEBGL_RENDER_FLOAT32_CAPABLE")}),Ft.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",function(){return Mi(Ft.getNumber("WEBGL_VERSION"))}),Ft.registerFlag("WEBGL_FENCE_API_ENABLED",function(){return Pi(Ft.getNumber("WEBGL_VERSION"))}),Ft.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",function(){return Ft.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0}),Vn=Li;var br=Xe({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})}}),sn=Xe({real_:function(n){var r=Oe(n,"input","real");return Ve.runKernelFunc(function(e){return e.real(r)},{$input:r})}}),wn=Xe({imag_:function(n){var r=Oe(n,"input","imag");return Ve.runKernelFunc(function(e){return e.imag(r)},{$input:r})}});function Ur(n,r,e){return Dn(n,r,xn(n,e),e)}function Dn(n,r,e,t){if(t==null&&(t=ot(n)),t==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!Ie(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){pe(r);var o=de(r),a=de(e);_(o===a,function(){return"Based on the provided shape, ["+r+"], the tensor should have "+o+" values but has "+a});for(var i=0;i<e.length;++i){var s=e[i],u=i!==e.length-1||s!==de(r.slice(i));_(e[i]===r[i]||!u,function(){return"Error creating a new Tensor. Inferred shape ("+e+") does not match the provided shape ("+r+"). "})}}return Ie(n)||Array.isArray(n)||(n=[n]),r=r||e,n=t!=="string"?q(n,t,p().getBool("DEBUG")):me(n,[],!0),Ve.makeTensor(n,r,t)}function Nt(n,r){if((Ie(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"&&Ie(n)&&!(n instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return Dn(n,[],[],r)}function qn(n,r){re(n);var e=xn(n,r);if(e.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return Dn(n,null,e,r)}function Qn(n,r,e){if(re(n),r!=null&&r.length!==2)throw new Error("tensor2d() requires shape to have two numbers");var t=xn(n,e);if(t.length!==2&&t.length!==1)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(t.length===1&&r==null)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return Dn(n,r,t,e)}function ni(n,r,e){if(re(n),r!=null&&r.length!==3)throw new Error("tensor3d() requires shape to have three numbers");var t=xn(n,e);if(t.length!==3&&t.length!==1)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(t.length===1&&r==null)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return Dn(n,r,t,e)}function kn(n,r,e){if(re(n),r!=null&&r.length!==4)throw new Error("tensor4d() requires shape to have four numbers");var t=xn(n,e);if(t.length!==4&&t.length!==1)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(t.length===1&&r==null)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return Dn(n,r,t,e)}function bo(n,r,e){if(re(n),r!=null&&r.length!==5)throw new Error("tensor5d() requires shape to have five numbers");var t=xn(n,e);if(t.length!==5&&t.length!==1)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(t.length===1&&r==null)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return Dn(n,r,t,e)}function Rs(n,r,e){if(re(n),r!=null&&r.length!==6)throw new Error("tensor6d() requires shape to have six numbers");var t=xn(n,e);if(t.length!==6&&t.length!==1)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(t.length===1&&r==null)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return Dn(n,r=r||t,t,e)}function xo(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 br(e,t)}var o=c(de(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 br(e,t)}var o=R(de(n),r);return Ve.makeTensor(o,n,r)}function oi(n,r,e){return Ve.runKernelFunc(function(t){return t.fill(n,r,e)},{})}function uc(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 pa(n,r,e,t){if(e===void 0&&(e=1),t===void 0&&(t="float32"),e===0)throw new Error("Cannot have a step of zero");if(n===r||n<r&&e<0||r<n&&e>1)return Tr([0],t);var o=R(Math.abs(Math.ceil((r-n)/e)),t);r<n&&e===1&&(e=-1),o[0]=n;for(var a=1;a<o.length;a++)o[a]=o[a-1]+e;return qn(o,t)}var Wi=Xe({onesLike_:function(n){var r=Oe(n,"x","onesLike");if(r.dtype==="complex64"){var e=Wi(sn(r)),t=$t(wn(r));return br(e,t)}return Ve.runKernelFunc(function(o){return o.onesLike(r)},{$x:r},function(o,a){return{$x:function(){return $t(o)}}})}}),$t=Xe({zerosLike_:function(n){var r=Oe(n,"x","zerosLike");return Ve.runKernelFunc(function(e){return e.zerosLike(r)},{$x:r},function(e,t){return{$x:function(){return $t(e)}}})}}),pn=Xe({concat_:function(n,r){r===void 0&&(r=0),_(n.length>=1,function(){return"Pass at least one tensor to concat"});var e=go(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=ue(r,e[0].shape)[0];var t=Jn(e.map(function(s){return s.shape}),r);if(de(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});Ui(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 Uo(s,u,r).map(function(f){return function(){return f}})},"Concat",i)}}),Is=Xe({concat1d_:function(n){return pn(n,0)}}),Ns=Xe({concat2d_:function(n,r){return pn(n,r)}}),ma=Xe({concat3d_:function(n,r){return pn(n,r)}}),Ds=Xe({concat4d_:function(n,r){return pn(n,r)}}),Uo=Xe({split_:function(n,r,e){e===void 0&&(e=0);var t,o=Oe(n,"x","split");return e=ue(e,o.shape)[0],typeof r=="number"?(_(o.shape[e]%r==0,function(){return"Number of splits must evenly divide the axis."}),t=new Array(r).fill(o.shape[e]/r)):(_(o.shape[e]===r.reduce(function(a,i){return a+i}),function(){return"The sum of sizes must match the size of the axis dimension."}),t=r),Ve.runKernelFunc(function(a){return a.split(o,t,e)},{$x:o},function(a){return{$x:function(){return pn(a,e)}}})}});typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof y!="undefined"||typeof self!="undefined"&&self;function Qr(n,r){return n(r={exports:{}},r.exports),r.exports}var Pn=Qr(function(n){!function(r,e,t){function o(s){var u,f=this,C=(u=4022871197,function(k){k=k.toString();for(var L=0;L<k.length;L++){var Y=.02519603282416938*(u+=k.charCodeAt(L));Y-=u=Y>>>0,u=(Y*=u)>>>0,u+=4294967296*(Y-=u)}return 23283064365386963e-26*(u>>>0)});f.next=function(){var k=2091639*f.s0+23283064365386963e-26*f.c;return f.s0=f.s1,f.s1=f.s2,f.s2=k-(f.c=0|k)},f.c=1,f.s0=C(" "),f.s1=C(" "),f.s2=C(" "),f.s0-=C(s),f.s0<0&&(f.s0+=1),f.s1-=C(s),f.s1<0&&(f.s1+=1),f.s2-=C(s),f.s2<0&&(f.s2+=1),C=null}function a(s,u){return u.c=s.c,u.s0=s.s0,u.s1=s.s1,u.s2=s.s2,u}function i(s,u){var f=new o(s),C=u&&u.state,k=f.next;return k.int32=function(){return 4294967296*f.next()|0},k.double=function(){return k()+11102230246251565e-32*(2097152*k()|0)},k.quick=k,C&&(typeof C=="object"&&a(C,f),k.state=function(){return a(f,{})}),k}e&&e.exports?e.exports=i:t&&t.amd?t(function(){return i}):this.alea=i}(0,n,!1)}),ks=Qr(function(n){!function(r,e,t){function o(s){var u=this,f="";u.x=0,u.y=0,u.z=0,u.w=0,u.next=function(){var k=u.x^u.x<<11;return u.x=u.y,u.y=u.z,u.z=u.w,u.w^=u.w>>>19^k^k>>>8},s===(0|s)?u.x=s:f+=s;for(var C=0;C<f.length+64;C++)u.x^=0|f.charCodeAt(C),u.next()}function a(s,u){return u.x=s.x,u.y=s.y,u.z=s.z,u.w=s.w,u}function i(s,u){var f=new o(s),C=u&&u.state,k=function(){return(f.next()>>>0)/4294967296};return k.double=function(){do var L=((f.next()>>>11)+(f.next()>>>0)/4294967296)/(1<<21);while(L===0);return L},k.int32=f.next,k.quick=k,C&&(typeof C=="object"&&a(C,f),k.state=function(){return a(f,{})}),k}e&&e.exports?e.exports=i:t&&t.amd?t(function(){return i}):this.xor128=i}(0,n,!1)}),Ms=Qr(function(n){!function(r,e,t){function o(s){var u=this,f="";u.next=function(){var k=u.x^u.x>>>2;return u.x=u.y,u.y=u.z,u.z=u.w,u.w=u.v,(u.d=u.d+362437|0)+(u.v=u.v^u.v<<4^k^k<<1)|0},u.x=0,u.y=0,u.z=0,u.w=0,u.v=0,s===(0|s)?u.x=s:f+=s;for(var C=0;C<f.length+64;C++)u.x^=0|f.charCodeAt(C),C==f.length&&(u.d=u.x<<10^u.x>>>4),u.next()}function a(s,u){return u.x=s.x,u.y=s.y,u.z=s.z,u.w=s.w,u.v=s.v,u.d=s.d,u}function i(s,u){var f=new o(s),C=u&&u.state,k=function(){return(f.next()>>>0)/4294967296};return k.double=function(){do var L=((f.next()>>>11)+(f.next()>>>0)/4294967296)/(1<<21);while(L===0);return L},k.int32=f.next,k.quick=k,C&&(typeof C=="object"&&a(C,f),k.state=function(){return a(f,{})}),k}e&&e.exports?e.exports=i:t&&t.amd?t(function(){return i}):this.xorwow=i}(0,n,!1)}),Ps=Qr(function(n){!function(r,e,t){function o(s){var u=this;u.next=function(){var f,C,k=u.x,L=u.i;return f=k[L],C=(f^=f>>>7)^f<<24,C^=(f=k[L+1&7])^f>>>10,C^=(f=k[L+3&7])^f>>>3,C^=(f=k[L+4&7])^f<<7,f=k[L+7&7],C^=(f^=f<<13)^f<<9,k[L]=C,u.i=L+1&7,C},function(f,C){var k,L=[];if(C===(0|C))L[0]=C;else for(C=""+C,k=0;k<C.length;++k)L[7&k]=L[7&k]<<15^C.charCodeAt(k)+L[k+1&7]<<13;for(;L.length<8;)L.push(0);for(k=0;k<8&&L[k]===0;++k);for(k==8?L[7]=-1:L[k],f.x=L,f.i=0,k=256;k>0;--k)f.next()}(u,s)}function a(s,u){return u.x=s.x.slice(),u.i=s.i,u}function i(s,u){s==null&&(s=+new Date);var f=new o(s),C=u&&u.state,k=function(){return(f.next()>>>0)/4294967296};return k.double=function(){do var L=((f.next()>>>11)+(f.next()>>>0)/4294967296)/(1<<21);while(L===0);return L},k.int32=f.next,k.quick=k,C&&(C.x&&a(C,f),k.state=function(){return a(f,{})}),k}e&&e.exports?e.exports=i:t&&t.amd?t(function(){return i}):this.xorshift7=i}(0,n,!1)}),Fs=Qr(function(n){!function(r,e,t){function o(s){var u=this;u.next=function(){var f,C,k=u.w,L=u.X,Y=u.i;return u.w=k=k+1640531527|0,C=L[Y+34&127],f=L[Y=Y+1&127],C^=C<<13,f^=f<<17,C^=C>>>15,f^=f>>>12,C=L[Y]=C^f,u.i=Y,C+(k^k>>>16)|0},function(f,C){var k,L,Y,ne,ce,se=[],le=128;for(C===(0|C)?(L=C,C=null):(C+="\0",L=0,le=Math.max(le,C.length)),Y=0,ne=-32;ne<le;++ne)C&&(L^=C.charCodeAt((ne+32)%C.length)),ne===0&&(ce=L),L^=L<<10,L^=L>>>15,L^=L<<4,L^=L>>>13,ne>=0&&(ce=ce+1640531527|0,Y=(k=se[127&ne]^=L+ce)==0?Y+1:0);for(Y>=128&&(se[127&(C&&C.length||0)]=-1),Y=127,ne=512;ne>0;--ne)L=se[Y+34&127],k=se[Y=Y+1&127],L^=L<<13,k^=k<<17,L^=L>>>15,k^=k>>>12,se[Y]=L^k;f.w=ce,f.X=se,f.i=Y}(u,s)}function a(s,u){return u.i=s.i,u.w=s.w,u.X=s.X.slice(),u}function i(s,u){s==null&&(s=+new Date);var f=new o(s),C=u&&u.state,k=function(){return(f.next()>>>0)/4294967296};return k.double=function(){do var L=((f.next()>>>11)+(f.next()>>>0)/4294967296)/(1<<21);while(L===0);return L},k.int32=f.next,k.quick=k,C&&(C.X&&a(C,f),k.state=function(){return a(f,{})}),k}e&&e.exports?e.exports=i:t&&t.amd?t(function(){return i}):this.xor4096=i}(0,n,!1)}),Hi=Qr(function(n){!function(r,e,t){function o(s){var u=this,f="";u.next=function(){var k=u.b,L=u.c,Y=u.d,ne=u.a;return k=k<<25^k>>>7^L,L=L-Y|0,Y=Y<<24^Y>>>8^ne,ne=ne-k|0,u.b=k=k<<20^k>>>12^L,u.c=L=L-Y|0,u.d=Y<<16^L>>>16^ne,u.a=ne-k|0},u.a=0,u.b=0,u.c=-1640531527,u.d=1367130551,s===Math.floor(s)?(u.a=s/4294967296|0,u.b=0|s):f+=s;for(var C=0;C<f.length+20;C++)u.b^=0|f.charCodeAt(C),u.next()}function a(s,u){return u.a=s.a,u.b=s.b,u.c=s.c,u.d=s.d,u}function i(s,u){var f=new o(s),C=u&&u.state,k=function(){return(f.next()>>>0)/4294967296};return k.double=function(){do var L=((f.next()>>>11)+(f.next()>>>0)/4294967296)/(1<<21);while(L===0);return L},k.int32=f.next,k.quick=k,C&&(typeof C=="object"&&a(C,f),k.state=function(){return a(f,{})}),k}e&&e.exports?e.exports=i:t&&t.amd?t(function(){return i}):this.tychei=i}(0,n,!1)}),En=Qr(function(n){!function(r,e){var t,o=this,a=256,i=6,s="random",u=e.pow(a,i),f=e.pow(2,52),C=2*f,k=a-1;function L(le,xe,Ee){var Ce=[],Te=ce(function Be(je,We){var Ze,Je=[],ht=typeof je;if(We&&ht=="object")for(Ze in je)try{Je.push(Be(je[Ze],We-1))}catch(lt){}return Je.length?Je:ht=="string"?je:je+"\0"}((xe=xe==1?{entropy:!0}:xe||{}).entropy?[le,se(r)]:le==null?function(){try{var Be;return t&&(Be=t.randomBytes)?Be=Be(a):(Be=new Uint8Array(a),(o.crypto||o.msCrypto).getRandomValues(Be)),se(Be)}catch(Ze){var je=o.navigator,We=je&&je.plugins;return[+new Date,o,We,o.screen,se(r)]}}():le,3),Ce),Me=new Y(Ce),He=function(){for(var Be=Me.g(i),je=u,We=0;Be<f;)Be=(Be+We)*a,je*=a,We=Me.g(1);for(;Be>=C;)Be/=2,je/=2,We>>>=1;return(Be+We)/je};return He.int32=function(){return 0|Me.g(4)},He.quick=function(){return Me.g(4)/4294967296},He.double=He,ce(se(Me.S),r),(xe.pass||Ee||function(Be,je,We,Ze){return Ze&&(Ze.S&&ne(Ze,Me),Be.state=function(){return ne(Me,{})}),We?(e[s]=Be,je):Be})(He,Te,"global"in xe?xe.global:this==e,xe.state)}function Y(le){var xe,Ee=le.length,Ce=this,Te=0,Me=Ce.i=Ce.j=0,He=Ce.S=[];for(Ee||(le=[Ee++]);Te<a;)He[Te]=Te++;for(Te=0;Te<a;Te++)He[Te]=He[Me=k&Me+le[Te%Ee]+(xe=He[Te])],He[Me]=xe;(Ce.g=function(Be){for(var je,We=0,Ze=Ce.i,Je=Ce.j,ht=Ce.S;Be--;)je=ht[Ze=k&Ze+1],We=We*a+ht[k&(ht[Ze]=ht[Je=k&Je+je])+(ht[Je]=je)];return Ce.i=Ze,Ce.j=Je,We})(a)}function ne(le,xe){return xe.i=le.i,xe.j=le.j,xe.S=le.S.slice(),xe}function ce(le,xe){for(var Ee,Ce=le+"",Te=0;Te<Ce.length;)xe[k&Te]=k&(Ee^=19*xe[k&Te])+Ce.charCodeAt(Te++);return se(xe)}function se(le){return String.fromCharCode.apply(0,le)}if(e["seed"+s]=L,ce(e.random(),r),n.exports){n.exports=L;try{t=N(5)}catch(le){}}}([],Math)});En.alea=Pn,En.xor128=ks,En.xorwow=Ms,En.xorshift7=Ps,En.xor4096=Fs,En.tychei=Hi;var Wo=En.alea,va=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=Wo(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}(),cc=function(){function n(r,e,t,o){this.alpha=r,this.beta=1/e,this.dtype=t;var a=o||Math.random();this.randu=Wo(a.toString()),this.randn=new va(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}(),zi=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=Wo(o)}return n.prototype.convertValue=function(r){return this.canReturnFloat()?r:Math.round(r)},n.prototype.nextValue=function(){return this.convertValue(this.min+this.range*this.random())},n}();function Lt(n,r,e){return r===void 0&&(r="float32"),r=r||"float32",pe(n),new Nr(n,r,e)}function ga(n,r){r===void 0&&(r=!1),console.log(n.toString(r))}var ya=Xe({batchToSpaceND_:function(n,r,e){var t=Oe(n,"x","batchToSpaceND"),o=r.reduce(function(a,i){return a*i});return _(t.rank>=1+r.length,function(){return"input rank is "+t.rank+" but should be > than blockShape.length "+r.length}),_(e.length===r.length,function(){return"crops.length is "+e.length+" but should be equal to blockShape.length "+r.length}),_(t.shape[0]%o==0,function(){return"input tensor batch is "+t.shape[0]+" but is not divisible by the product of the elements of blockShape "+r.join(" * ")+" === "+o}),Ve.runKernelFunc(function(a){return a.batchToSpaceND(t,r,e)},{$x:t},function(a){return{$x:function(){return a.spaceToBatchND(r,e)}}})}}),Ls=Xe({broadcastTo_:function(n,r){var e=Oe(n,"broadcastTo","x"),t=e.shape;if(r.some(function(u){return!(u>0)||u%1!=0}))throw new Error("broadcastTo(): Invalid broadcast shape ["+r+"].");if(r.length<e.rank)throw new Error("broadcastTo(): shape.length="+r.length+" < input.rank="+e.rank+".");if(r.length>e.rank){for(var o=e.shape.slice();o.length<r.length;)o.unshift(1);e=e.reshape(o)}for(var a=Array.from(r),i=r.length-1;i>=0;i--)if(e.shape[i]===r[i])a[i]=1;else if(e.shape[i]!==1)throw new Error("broadcastTo(): ["+t+"] cannot be broadcast to ["+r+"].");var s=a.map(function(u,f){return u>1?f:-1}).filter(function(u){return u>=0});return s.length===0?e.clone():Ve.runKernelFunc(function(u){return u.tile(e,a)},{input:e},function(u){return{input:function(){return u.sum(s,!0)}}})}}),ba=Xe({cast_:function(n,r){var e=Oe(n,"x","cast");if(!Ke(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)}}),xa=Xe({clone_:function(n){var r=Oe(n,"x","clone",null);return Ve.runKernelFunc(function(){return Ve.makeTensorFromDataId(r.dataId,r.shape,r.dtype)},{$x:r},function(e){return{$x:function(){return e.toFloat()}}})}}),js=Xe({cumsum_:function(n,r,e,t){r===void 0&&(r=0),e===void 0&&(e=!1),t===void 0&&(t=!1);var o=Oe(n,"x","cumsum"),a=an([r|=0],o.rank),i=o;a!=null&&(i=o.transpose(a));var s=hn(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}}),Bs=Xe({depthToSpace_:function(n,r,e){e===void 0&&(e="NHWC");var t=Oe(n,"x","depthToSpace"),o=e==="NHWC"?t.shape[1]:t.shape[2],a=e==="NHWC"?t.shape[2]:t.shape[3],i=e==="NHWC"?t.shape[3]:t.shape[1];return _(o*r>=0,function(){return`Negative dimension size caused by overflow when multiplying
|
|
|
`+o+" and "+r+` for depthToSpace with input shape
|
|
|
`+t.shape}),_(a*r>=0,function(){return`Negative dimension size caused by overflow when multiplying
|
|
|
`+a+" and "+r+` for depthToSpace with input shape
|
|
|
`+t.shape}),_(i%(r*r)==0,function(){return"Dimension size must be evenly divisible by "+r*r+" but is "+i+" for depthToSpace with input shape "+t.shape}),Ve.runKernelFunc(function(s){return s.depthToSpace(t,r,e)},{$x:t})}}),In=Xe({expandDims_:function(n,r){r===void 0&&(r=0);var e=Oe(n,"x","expandDims",null);_(r<=e.rank,function(){return"Axis must be <= rank of the tensor"});var t=e.shape.slice();return r<0&&(_(-(e.rank+1)<=r,function(){return"Axis must be in the interval ["+-(e.rank+1)+", "+e.rank+"]"}),r=e.rank+r+1),t.splice(r,0,1),wa(e,t)}}),Gi=Xe({eye_:function(n,r,e,t){t===void 0&&(t="float32"),r==null&&(r=n);for(var o=Lt([n,r],t),a=n<=r?n:r,i=0;i<a;++i)o.set(1,i,i);var s=o.toTensor().as2D(n,r);if(e==null)return s;if(e.length===1)return Zn(In(s,0),[e[0],1,1]);if(e.length===2)return Zn(In(In(s,0),0),[e[0],e[1],1,1]);if(e.length===3)return Zn(In(In(In(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.")}}),ai=Xe({multinomial_:function(n,r,e,t){t===void 0&&(t=!1);var o=Oe(n,"logits","multinomial"),a=o.size,i=o.rank;if(a<2)throw new Error("Error in multinomial: you need at least 2 outcomes, but got "+a+".");if(i>2)throw new Error("Rank of probabilities must be 1 or 2, but is "+i);e=e||Math.random();var s=i===1?o.as2D(1,-1):o,u=Ve.runKernelFunc(function(f){return f.multinomial(s,t,r,e)},{logits2D:s});return i===1?u.as1D():u}}),ii=Xe({oneHot_:function(n,r,e,t){if(e===void 0&&(e=1),t===void 0&&(t=0),r<2)throw new Error("Error in oneHot: depth must be >=2, but it is "+r);var o=Oe(n,"indices","oneHot","int32"),a=o.shape.concat([r]);return o=o.flatten(),Ve.runKernelFunc(function(i){return i.oneHot(o,r,e,t)},{$indices:o},function(i){return{$indices:function(){return Tr(o.shape,"float32")}}}).reshape(a)}}),Fn=Xe({pad_:function(n,r,e){e===void 0&&(e=0);var t=Oe(n,"x","pad");if(t.rank===0)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");var o={paddings:r,constantValue:e};return Ve.runKernelFunc(function(a){return a.pad(t,r,e)},{x:t},function(a){var i=r.map(function(s){return s[0]});return{x:function(){return a.slice(i,t.shape)}}},"PadV2",o)}}),Vi=Xe({pad1d_:function(n,r,e){return e===void 0&&(e=0),_(r.length===2,function(){return"Invalid number of paddings. Must be length of 2."}),Fn(n,[r],e)}}),wo=Xe({pad2d_:function(n,r,e){return e===void 0&&(e=0),_(r.length===2&&r[0].length===2&&r[1].length===2,function(){return"Invalid number of paddings. Must be length of 2 each."}),Fn(n,r,e)}}),si=Xe({pad3d_:function(n,r,e){return e===void 0&&(e=0),_(r.length===3&&r[0].length===2&&r[1].length===2&&r[2].length===2,function(){return"Invalid number of paddings. Must be length of 2 each."}),Fn(n,r,e)}}),Us=Xe({pad4d_:function(n,r,e){return e===void 0&&(e=0),_(r.length===4&&r[0].length===2&&r[1].length===2&&r[2].length===2&&r[3].length===2,function(){return"Invalid number of paddings. Must be length of 2 each."}),Fn(n,r,e)}}),Ws=Xe({rand_:function(n,r,e){var t=de(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)}}),Hs=Xe({randomNormal_:function(n,r,e,t,o){if(r===void 0&&(r=0),e===void 0&&(e=1),t!=null&&t==="bool")throw new Error("Unsupported data type "+t);for(var a=new va(r,e,t,!1,o),i=Lt(n,t),s=0;s<i.values.length;s++)i.values[s]=a.nextValue();return i.toTensor()}}),zs=Xe({randomGamma_:function(n,r,e,t,o){if(e===void 0&&(e=1),t===void 0&&(t="float32"),e==null&&(e=1),t==null&&(t="float32"),t!=="float32"&&t!=="int32")throw new Error("Unsupported data type "+t);for(var a=new cc(r,e,t,o),i=Lt(n,t),s=0;s<i.values.length;s++)i.values[s]=a.nextValue();return i.toTensor()}}),ui=Xe({randomUniform_:function(n,r,e,t,o){r===void 0&&(r=0),e===void 0&&(e=1),t===void 0&&(t="float32");for(var a=Lt(n,t),i=new zi(r,e,null,o),s=0;s<a.values.length;s++)a.values[s]=i.nextValue();return a.toTensor()}}),wa=Xe({reshape_:function(n,r){var e=Oe(n,"x","reshape",null);r=ae(r,e.size),_(e.size===de(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)}}),Xi=Xe({spaceToBatchND_:function(n,r,e){var t=Oe(n,"x","spaceToBatchND");return _(t.rank>=1+r.length,function(){return"input rank "+t.rank+" should be > than [blockShape] "+r.length}),_(e.length===r.length,function(){return"paddings.shape[0] "+e.length+" must be equal to [blockShape] "+r.length}),_(t.shape.reduce(function(o,a,i){return i>0&&i<=r.length?o&&(a+e[i-1][0]+e[i-1][1])%r[i-1]==0:o},!0),function(){return"input spatial dimensions "+t.shape.slice(1)+" with paddings "+e.toString()+" must be divisible by blockShapes "+r.toString()}),Ve.runKernelFunc(function(o){return o.spaceToBatchND(t,r,e)},{$x:t},function(o){return{$x:function(){return o.batchToSpaceND(r,e)}}})}}),Ki=Xe({squeeze_:function(n,r){var e=Oe(n,"x","squeeze");return wa(e,te(e.shape,r).newShape)}}),Ln=Xe({stack_:function(n,r){r===void 0&&(r=0);var e=go(n,"tensors","stack");if(_(e.length>=1,function(){return"Pass at least one tensor to tf.stack"}),e.length===1)return e[0].expandDims(r);var t=e[0].rank,o=e[0].shape,a=e[0].dtype;_(r<=t,function(){return"Axis must be <= rank of the tensor"}),e.forEach(function(s){X(o,s.shape,"All tensors passed to stack must have matching shapes")}),e.forEach(function(s){_(a===s.dtype,function(){return"All tensors passed to stack must have matching dtypes"})});var i=e.map(function(s){return s.expandDims(r)});return pn(i,r)}}),Zn=Xe({tile_:function(n,r){var e=Oe(n,"x","tile",null);_(e.rank===r.length,function(){return"Error in transpose: rank of input "+e.rank+" must match length of reps "+r+"."});var t=[e],o={reps:r};return Ve.runKernelFunc(function(a,i){var s=a.tile(e,r);return i([e]),s},{x:e},function(a,i){var s=i[0];return{x:function(){var u=$t(s);if(s.rank===1)for(var f=0;f<r[0];++f)u=u.add(a.slice([f*s.shape[0]],[s.shape[0]]));else if(s.rank===2)for(f=0;f<r[0];++f)for(var C=0;C<r[1];++C)u=u.add(a.slice([f*s.shape[0],C*s.shape[1]],[s.shape[0],s.shape[1]]));else if(s.rank===3)for(f=0;f<r[0];++f)for(C=0;C<r[1];++C)for(var k=0;k<r[2];++k)u=u.add(a.slice([f*s.shape[0],C*s.shape[1],k*s.shape[2]],[s.shape[0],s.shape[1],s.shape[2]]));else{if(s.rank!==4)throw new Error("Gradient for tile operation is not implemented for rank-"+s.rank+" tensors yet.");for(f=0;f<r[0];++f)for(C=0;C<r[1];++C)for(k=0;k<r[2];++k)for(var L=0;L<r[3];++L)u=u.add(a.slice([f*s.shape[0],C*s.shape[1],k*s.shape[2],L*s.shape[3]],[s.shape[0],s.shape[1],s.shape[2],s.shape[3]]))}return u}}},"Tile",o,t)}}),Gs=Xe({truncatedNormal_:function(n,r,e,t,o){if(r===void 0&&(r=0),e===void 0&&(e=1),t!=null&&t==="bool")throw new Error("Unsupported data type "+t);for(var a=new va(r,e,t,!0,o),i=Lt(n,t),s=0;s<i.values.length;s++)i.values[s]=a.nextValue();return i.toTensor()}}),Ea=Xe({unstack_:function(n,r){r===void 0&&(r=0),r=r||0;var e=Oe(n,"x","unstack");_(r>=-e.shape.length&&r<e.shape.length,function(){return"Axis = "+r+" is not in [-"+e.shape.length+", "+e.shape.length+")"}),r<0&&(r+=e.shape.length);var t={axis:r};return Ve.runKernelFunc(function(o){return o.unstack(e,r)},{x:e},function(o){return{x:function(){return Ln(o,r)}}},"Unpack",t)}}),Vs=function(n,r){return E(this,void 0,void 0,function(){var e,t,o,a,i,s,u,f,C,k;return g(this,function(L){switch(L.label){case 0:return e=Oe(n,"x","setdiff1d"),t=Oe(r,"y","setdiff1d"),_(e.dtype===t.dtype,function(){return"x and y should have the same dtype, but got x ("+e.dtype+") and y ("+t.dtype+")."}),_(e.rank===1,function(){return"x should be 1D tensor, but got x ("+e.shape+")."}),_(t.rank===1,function(){return"y should be 1D tensor, but got y ("+t.shape+")."}),[4,e.data()];case 1:return o=L.sent(),[4,t.data()];case 2:for(a=L.sent(),i=new Set(a),s=0,C=0;C<o.length;C++)i.has(o[C])||s++;for(u=new Nr([s],e.dtype),f=new Nr([s],"int32"),C=0,k=0;C<o.length;C++)i.has(o[C])||(u.values[k]=o[C],f.values[k]=C,k++);return[2,[u.toTensor(),f.toTensor()]]}})})};function Ho(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 Jt(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 _a(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 Xs(n,r){for(var e=[0],t=0;t<r;++t)e.push(n[t][0]);return e}function Ks(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 Yi(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(C){return C/u}).concat([1]).slice(0,t);return[s,o,u,f]}var lc=Object.freeze({prepareAndValidate:Yi}),$i=30;function ci(n){return n<=$i?n:ye(n,Math.floor(Math.sqrt(n)))}function Ys(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 $s(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)}Ys(e,r,n)}function zo(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:de(r.shape)/u,sliceSize:i,strides:$e(e.slice(0,o)).concat([1]),outputSize:de(e)}}var dc=Object.freeze({validateUpdateShape:Ys,validateInput:$s,calculateShapes:zo});function Js(n,r,e){_(n.rank===r.length,function(){return"Error in slice"+n.rank+"D: Length of begin "+r+" must match the rank of the array ("+n.rank+")."}),_(n.rank===e.length,function(){return"Error in slice"+n.rank+"D: Length of size "+e+" must match the rank of the array ("+n.rank+")."});for(var t=function(a){_(r[a]+e[a]<=n.shape[a],function(){return"Error in slice"+n.rank+"D: begin["+a+"] + size["+a+"] ("+(r[a]+e[a])+") would overflow input.shape["+a+"] ("+n.shape[a]+")"})},o=0;o<n.rank;++o)t(o)}function Ji(n){for(var r=[],e=0;n>0;)1&n&&r.push(e),n/=2,e++;return r}function Ca(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 Qs(n,r,e,t,o){var a=r[o],i=e[o]||1;(n&1<<o||a==null)&&(a=i>0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);var s=t[o];return a<0&&(a+=s),a=T(0,a,s-1)}function qi(n,r,e,t,o){var a=r[o],i=e[o]||1;(n&1<<o||a==null)&&(a=i>0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);var s=t[o];return a<0&&(a+=s),a=i>0?T(0,a,s):T(-1,a,s-1)}function Qi(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 Zi(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:Js,maskToAxes:Ji,computeOutShape:Ca,startForAxis:Qs,stopForAxis:qi,isSliceContinous:Qi,computeFlatOffset:Zi});function sd(n){return _(be(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)"),_o(s),s[0]})}}function ud(n){return _(be(n),function(){return"The f passed in grads(f) must be a function"}),function(r,e){_(Array.isArray(r),function(){return"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s"});var t=go(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,...])"),_o(s),s})}}function Zs(n){return _(be(n),function(){return"The f passed in valueAndGrad(f) must be a function"}),function(r,e){_(r instanceof Dr,function(){return"The x passed in valueAndGrad(f)(x) must be a tensor"}),_(e==null||e instanceof Dr,function(){return"The dy passed in valueAndGrad(f)(x, dy) must be a tensor"});var t=Ve.gradients(function(){return n(r)},[r],e),o=t.grads,a=t.value;return _o(o),{grad:o[0],value:a}}}function es(n){return _(be(n),function(){return"The f passed in valueAndGrads(f) must be a function"}),function(r,e){_(Array.isArray(r)&&r.every(function(o){return o instanceof Dr}),function(){return"The args passed in valueAndGrads(f)(args) must be array of tensors"}),_(e==null||e instanceof Dr,function(){return"The dy passed in valueAndGrads(f)(args, dy) must be a tensor"});var t=Ve.gradients(function(){return n.apply(void 0,r)},r,e);return e!=null&&X(t.value.shape,e.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),_o(t.grads),t}}function li(n,r){_(be(n),function(){return"The f passed in variableGrads(f) must be a function"}),_(r==null||Array.isArray(r)&&r.every(function(C){return C instanceof Tn}),function(){return"The varList passed in variableGrads(f, varList) must be an array of variables"});var e=r!=null;if(!e)for(var t in r=[],Ve.registeredVariables)r.push(Ve.registeredVariables[t]);var o=e?r.filter(function(C){return!C.trainable}):null,a=r.length;_((r=r.filter(function(C){return C.trainable})).length>0,function(){return"variableGrads() expects at least one of the input variables to be trainable, but none of the "+a+" variables is trainable."});var i=Ve.gradients(n,r,null,!0),s=i.value,u=i.grads;_(u.some(function(C){return C!=null}),function(){return"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."}),_(s.rank===0,function(){return"The f passed in variableGrads(f) must return a scalar, but it returned a rank-"+s.rank+" tensor"});var f={};return r.forEach(function(C,k){u[k]!=null&&(f[C.name]=u[k])}),o!=null&&o.forEach(function(C){return f[C.name]=null}),{value:s,grads:f}}function Eo(n){return Ve.customGrad(n)}function _o(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 Go=Xe({softmax_:function(n,r){r===void 0&&(r=-1);var e=Oe(n,"logits","softmax","float32");if(r===-1&&(r=e.rank-1),r!==e.rank-1)throw Error("Softmax along a non-last dimension is not yet supported. Logits was rank "+e.rank+" and dim was "+r);return Ve.runKernelFunc(function(t,o){var a=t.softmax(e,r);return o([a]),a},{logits:e},function(t,o){var a=o[0],i=t.mul(a);return{logits:function(){return i.sub(i.sum([r],!0).mul(a))}}},"Softmax",{dim:r},[],[!0])}}),di=Xe({logSoftmax_:function(n,r){r===void 0&&(r=-1);var e=Oe(n,"logits","logSoftmax");if(r===-1&&(r=e.rank-1),r!==e.rank-1)throw Error("Log Softmax along a non-last dimension is not yet supported. Logits was rank "+e.rank+" and axis was "+r);return Eo(function(t,o){var a=t.max(r,!0),i=t.sub(a),s=i.toFloat().sub(i.exp().sum(r,!0).log());return o([s]),{value:s,gradFunc:function(u,f){var C=f[0].exp();return u.sub(u.sum(r,!0).mul(C))}}})(e)}}),Ta=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}(),Sa=function(){function n(){}return n.prototype.time=function(r){return rt("time")},n.prototype.read=function(r){return rt("read")},n.prototype.readSync=function(r){return rt("readSync")},n.prototype.numDataIds=function(){return rt("numDataIds")},n.prototype.disposeData=function(r){return rt("disposeData")},n.prototype.write=function(r,e,t){return rt("write")},n.prototype.move=function(r,e,t,o){return rt("move")},n.prototype.memory=function(){return rt("memory")},n.prototype.floatPrecision=function(){return rt("floatPrecision")},n.prototype.epsilon=function(){return this.floatPrecision()===32?1e-7:1e-4},n.prototype.batchMatMul=function(r,e,t,o){return rt("batchMatMul")},n.prototype.fusedBatchMatMul=function(r){return r.a,r.b,r.transposeA,r.transposeB,r.bias,r.activation,r.preluActivationWeights,rt("fusedBatchMatMul")},n.prototype.slice=function(r,e,t){return rt("slice")},n.prototype.stridedSlice=function(r,e,t,o){return rt("stridedSlice")},n.prototype.unstack=function(r,e){return rt("unstack")},n.prototype.reverse=function(r,e){return rt("reverse")},n.prototype.concat=function(r,e){return rt("concat")},n.prototype.neg=function(r){return rt("neg")},n.prototype.add=function(r,e){return rt("add")},n.prototype.addN=function(r){return rt("addN")},n.prototype.subtract=function(r,e){return rt("subtract")},n.prototype.multiply=function(r,e){return rt("multiply")},n.prototype.realDivide=function(r,e){return rt("realDivide")},n.prototype.floorDiv=function(r,e){return rt("floorDiv")},n.prototype.sum=function(r,e){return rt("sum")},n.prototype.prod=function(r,e){return rt("prod")},n.prototype.unsortedSegmentSum=function(r,e,t){return rt("unsortedSegmentSum")},n.prototype.argMin=function(r,e){return rt("argMin")},n.prototype.argMax=function(r,e){return rt("argMax")},n.prototype.equal=function(r,e){return rt("equal")},n.prototype.notEqual=function(r,e){return rt("notEqual")},n.prototype.less=function(r,e){return rt("less")},n.prototype.lessEqual=function(r,e){return rt("lessEqual")},n.prototype.greater=function(r,e){return rt("greater")},n.prototype.greaterEqual=function(r,e){return rt("greaterEqual")},n.prototype.logicalNot=function(r){return rt("logicalNot")},n.prototype.logicalAnd=function(r,e){return rt("logicalAnd")},n.prototype.logicalOr=function(r,e){return rt("logicalOr")},n.prototype.where=function(r){return rt("where")},n.prototype.select=function(r,e,t){return rt("select")},n.prototype.topk=function(r,e,t){return rt("topk")},n.prototype.min=function(r,e){return rt("min")},n.prototype.minimum=function(r,e){return rt("minimum")},n.prototype.mod=function(r,e){return rt("mod")},n.prototype.max=function(r,e){return rt("max")},n.prototype.maximum=function(r,e){return rt("maximum")},n.prototype.all=function(r,e){return rt("all")},n.prototype.any=function(r,e){return rt("any")},n.prototype.squaredDifference=function(r,e){return rt("squaredDifference")},n.prototype.ceil=function(r){return rt("ceil")},n.prototype.floor=function(r){return rt("floor")},n.prototype.round=function(r){return rt("round")},n.prototype.sign=function(r){return rt("sign")},n.prototype.isNaN=function(r){return rt("isNaN")},n.prototype.isInf=function(r){return rt("isInf")},n.prototype.isFinite=function(r){return rt("isFinite")},n.prototype.pow=function(r,e){return rt("pow")},n.prototype.exp=function(r){return rt("exp")},n.prototype.expm1=function(r){return rt("expm1")},n.prototype.softmax=function(r,e){return rt("softmax")},n.prototype.log=function(r){return rt("log")},n.prototype.log1p=function(r){return rt("log1p")},n.prototype.sqrt=function(r){return rt("sqrt")},n.prototype.rsqrt=function(r){return rt("rsqrt")},n.prototype.square=function(r){return rt("square")},n.prototype.reciprocal=function(r){return rt("reciprocal")},n.prototype.relu=function(r){return rt("relu")},n.prototype.relu6=function(r){return rt("relu6")},n.prototype.prelu=function(r,e){return rt("prelu")},n.prototype.elu=function(r){return rt("elu")},n.prototype.eluDer=function(r,e){return rt("eluDer")},n.prototype.selu=function(r){return rt("selu")},n.prototype.int=function(r){return rt("int")},n.prototype.clip=function(r,e,t){return rt("clip")},n.prototype.abs=function(r){return rt("abs")},n.prototype.complexAbs=function(r){return rt("complexAbs")},n.prototype.sigmoid=function(r){return rt("sigmoid")},n.prototype.softplus=function(r){return rt("softplus")},n.prototype.sin=function(r){return rt("sin")},n.prototype.cos=function(r){return rt("cos")},n.prototype.tan=function(r){return rt("tan")},n.prototype.asin=function(r){return rt("asin")},n.prototype.acos=function(r){return rt("acos")},n.prototype.atan=function(r){return rt("atan")},n.prototype.atan2=function(r,e){return rt("atan2")},n.prototype.sinh=function(r){return rt("sinh")},n.prototype.cosh=function(r){return rt("cosh")},n.prototype.tanh=function(r){return rt("tanh")},n.prototype.asinh=function(r){return rt("asinh")},n.prototype.acosh=function(r){return rt("acosh")},n.prototype.atanh=function(r){return rt("atanh")},n.prototype.erf=function(r){return rt("erf")},n.prototype.step=function(r,e){return rt("step")},n.prototype.fusedConv2d=function(r){return r.input,r.filter,r.convInfo,r.bias,r.activation,r.preluActivationWeights,rt("fusedConv2d")},n.prototype.conv2d=function(r,e,t){return rt("conv2d")},n.prototype.conv2dDerInput=function(r,e,t){return rt("conv2dDerInput")},n.prototype.conv2dDerFilter=function(r,e,t){return rt("conv2dDerFilter")},n.prototype.fusedDepthwiseConv2D=function(r){return r.input,r.filter,r.convInfo,r.bias,r.activation,r.preluActivationWeights,rt("fusedDepthwiseConv2D")},n.prototype.depthwiseConv2D=function(r,e,t){return rt("depthwiseConv2D")},n.prototype.depthwiseConv2DDerInput=function(r,e,t){return rt("depthwiseConv2DDerInput")},n.prototype.depthwiseConv2DDerFilter=function(r,e,t){return rt("depthwiseConv2DDerFilter")},n.prototype.conv3d=function(r,e,t){return rt("conv3d")},n.prototype.conv3dDerInput=function(r,e,t){return rt("conv3dDerInput")},n.prototype.conv3dDerFilter=function(r,e,t){return rt("conv3dDerFilter")},n.prototype.maxPool=function(r,e){return rt("maxPool")},n.prototype.maxPoolBackprop=function(r,e,t,o){return rt("maxPoolBackprop")},n.prototype.avgPool=function(r,e){return rt("avgPool")},n.prototype.avgPoolBackprop=function(r,e,t){return rt("avgPoolBackprop")},n.prototype.avgPool3d=function(r,e){return rt("avgPool3d")},n.prototype.avgPool3dBackprop=function(r,e,t){return rt("avgPool3dBackprop")},n.prototype.maxPool3d=function(r,e){return rt("maxPool3d")},n.prototype.maxPool3dBackprop=function(r,e,t,o){return rt("maxPool3dBackprop")},n.prototype.reshape=function(r,e){return rt("reshape")},n.prototype.cast=function(r,e){return rt("cast")},n.prototype.tile=function(r,e){return rt("tile")},n.prototype.pad=function(r,e,t){return rt("pad")},n.prototype.transpose=function(r,e){return rt("transpose")},n.prototype.gather=function(r,e,t){return rt("gather")},n.prototype.gatherND=function(r,e){return rt("gatherND")},n.prototype.scatterND=function(r,e,t){return rt("scatterND")},n.prototype.batchToSpaceND=function(r,e,t){return rt("batchToSpaceND")},n.prototype.spaceToBatchND=function(r,e,t){return rt("spaceToBatchND")},n.prototype.resizeBilinear=function(r,e,t,o){return rt("resizeBilinear")},n.prototype.resizeBilinearBackprop=function(r,e,t){return rt("resizeBilinearBackprop")},n.prototype.resizeNearestNeighbor=function(r,e,t,o){return rt("resizeNearestNeighbor")},n.prototype.resizeNearestNeighborBackprop=function(r,e,t){return rt("resizeNearestNeighborBackprop")},n.prototype.batchNormalization=function(r,e,t,o,a,i){return rt("batchNormalization")},n.prototype.localResponseNormalization4D=function(r,e,t,o,a){return rt("localResponseNormalization4D")},n.prototype.LRNGrad=function(r,e,t,o,a,i,s){return rt("LRNGrad")},n.prototype.multinomial=function(r,e,t,o){return rt("multinomial")},n.prototype.oneHot=function(r,e,t,o){return rt("oneHot")},n.prototype.cumsum=function(r,e,t,o){return rt("cumsum")},n.prototype.nonMaxSuppression=function(r,e,t,o,a){return rt("nonMaxSuppression")},n.prototype.fft=function(r){return rt("fft")},n.prototype.ifft=function(r){return rt("ifft")},n.prototype.complex=function(r,e){return rt("complex")},n.prototype.real=function(r){return rt("real")},n.prototype.imag=function(r){return rt("imag")},n.prototype.cropAndResize=function(r,e,t,o,a,i){return rt("cropAndResize")},n.prototype.depthToSpace=function(r,e,t){return rt("depthToSpace")},n.prototype.split=function(r,e,t){return rt("split")},n.prototype.sparseToDense=function(r,e,t,o){return rt("sparseToDense")},n.prototype.diag=function(r){return rt("diag")},n.prototype.fill=function(r,e,t){return rt("fill")},n.prototype.onesLike=function(r){return rt("onesLike")},n.prototype.zerosLike=function(r){return rt("zerosLike")},n.prototype.linspace=function(r,e,t){return rt("linspace")},n.prototype.dispose=function(){return rt("dispose")},n}();function rt(n){throw new Error("'"+n+"' not yet implemented or not found in the registry. Did you forget to import the kernel?")}function _n(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 Wt(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 eo(n,r,e,t,o,a,i){i===void 0&&(i="channelsLast");var s,u=Oa(r),f=u[0],C=u[1];if(i==="channelsLast")s=[f,C,n[3],n[3]];else{if(i!=="channelsFirst")throw new Error("Unknown dataFormat "+i);s=[f,C,n[1],n[1]]}return jn(n,s,e,t,o,a,!1,i)}function Vo(n,r,e,t,o,a,i){i===void 0&&(i="NDHWC");var s,u,f=Xo(r),C=f[0],k=f[1],L=f[2];if(i==="NDHWC")u="channelsLast",s=[C,k,L,n[4],n[4]];else{if(i!=="NCDHW")throw new Error("Unknown dataFormat "+i);u="channelsFirst",s=[C,k,L,n[1],n[1]]}return Co(n,s,e,t,o,!1,u,a)}function jn(n,r,e,t,o,a,i,s){i===void 0&&(i=!1),s===void 0&&(s="channelsLast");var u=[-1,-1,-1,-1],f=u[0],C=u[1],k=u[2],L=u[3];if(s==="channelsLast")f=n[0],C=n[1],k=n[2],L=n[3];else{if(s!=="channelsFirst")throw new Error("Unknown dataFormat "+s);f=n[0],L=n[1],C=n[2],k=n[3]}var Y,ne=r[0],ce=r[1],se=r[3],le=Oa(e),xe=le[0],Ee=le[1],Ce=Oa(t),Te=Ce[0],Me=Ce[1],He=Bn(ne,Te),Be=Bn(ce,Me),je=function(lt,ut,gt,mt,ct,xt,wt,Ot){var Mt,Pt,Vt;if(typeof lt=="number"){Mt={top:lt,bottom:lt,left:lt,right:lt,type:lt===0?"VALID":"NUMBER"};var Xt=function(tr,Er,hr,Lr,Mr){Lr==null&&(Lr=Aa(tr,Er,hr));var Pr=tr[0],Hn=tr[1],zn=Ko((Pr-Er+2*Lr)/hr+1,Mr);_(ge(zn),function(){return"The output # of rows ("+zn+") must be an integer. Change the stride and/or zero pad parameters"});var vn=Ko((Hn-Er+2*Lr)/hr+1,Mr);return _(ge(vn),function(){return"The output # of columns ("+vn+") must be an integer. Change the stride and/or zero pad parameters"}),[zn,vn]}([ut,gt],xt,mt,lt,Ot);Pt=Xt[0],Vt=Xt[1]}else if(lt==="same"){Pt=Math.ceil(ut/mt),Vt=Math.ceil(gt/ct);var Yt=Math.max(0,(Pt-1)*mt+xt-ut),ar=Math.max(0,(Vt-1)*ct+wt-gt),er=Math.floor(Yt/2),ir=Yt-er,jr=Math.floor(ar/2);Mt={top:er,bottom:ir,left:jr,right:ar-jr,type:"SAME"}}else{if(lt!=="valid")throw Error("Unknown padding parameter: "+lt);Mt={top:0,bottom:0,left:0,right:0,type:"VALID"},Pt=Math.ceil((ut-xt+1)/mt),Vt=Math.ceil((gt-wt+1)/ct)}return{padInfo:Mt,outHeight:Pt,outWidth:Vt}}(o,C,k,xe,Ee,He,Be,a),We=je.padInfo,Ze=je.outHeight,Je=je.outWidth,ht=i?se*L:se;return s==="channelsFirst"?Y=[f,ht,Ze,Je]:s==="channelsLast"&&(Y=[f,Ze,Je,ht]),{batchSize:f,dataFormat:s,inHeight:C,inWidth:k,inChannels:L,outHeight:Ze,outWidth:Je,outChannels:ht,padInfo:We,strideHeight:xe,strideWidth:Ee,filterHeight:ne,filterWidth:ce,effectiveFilterHeight:He,effectiveFilterWidth:Be,dilationHeight:Te,dilationWidth:Me,inShape:n,outShape:Y,filterShape:r}}function Co(n,r,e,t,o,a,i,s){a===void 0&&(a=!1),i===void 0&&(i="channelsLast");var u=[-1,-1,-1,-1,-1],f=u[0],C=u[1],k=u[2],L=u[3],Y=u[4];if(i==="channelsLast")f=n[0],C=n[1],k=n[2],L=n[3],Y=n[4];else{if(i!=="channelsFirst")throw new Error("Unknown dataFormat "+i);f=n[0],Y=n[1],C=n[2],k=n[3],L=n[4]}var ne,ce=r[0],se=r[1],le=r[2],xe=r[4],Ee=Xo(e),Ce=Ee[0],Te=Ee[1],Me=Ee[2],He=Xo(t),Be=He[0],je=He[1],We=He[2],Ze=Bn(ce,Be),Je=Bn(se,je),ht=Bn(le,We),lt=function(wt,Ot,Mt,Pt,Vt,Xt,Yt,ar,er,ir,jr){var tr,Er,hr,Lr;if(typeof wt=="number"){tr={top:wt,bottom:wt,left:wt,right:wt,front:wt,back:wt,type:wt===0?"VALID":"NUMBER"};var Mr=function(za,so,Xu,Ga,Gn,Ku){Gn==null&&(Gn=Aa(za,so,Ga));var Xp=za[0],Kp=za[1],Yp=za[2],Yu=Ko((Xp-so+2*Gn)/Ga+1,Ku);_(ge(Yu),function(){return"The output # of depths ("+Yu+") must be an integer. Change the stride and/or zero pad parameters"});var $u=Ko((Kp-so+2*Gn)/Ga+1,Ku);_(ge($u),function(){return"The output # of rows ("+$u+") must be an integer. Change the stride and/or zero pad parameters"});var Ju=Ko((Yp-so+2*Gn)/Ga+1,Ku);return _(ge(Ju),function(){return"The output # of columns ("+Ju+") must be an integer. Change the stride and/or zero pad parameters"}),[Yu,$u,Ju,Xu]}([Ot,Mt,Pt,1],ar,1,Vt,wt,jr);Er=Mr[0],hr=Mr[1],Lr=Mr[2]}else if(wt==="same"){Er=Math.ceil(Ot/Vt),hr=Math.ceil(Mt/Xt),Lr=Math.ceil(Pt/Yt);var Pr=(Er-1)*Vt+ar-Ot,Hn=(hr-1)*Xt+er-Mt,zn=(Lr-1)*Yt+ir-Pt,vn=Math.floor(Pr/2),Ha=Pr-vn,ao=Math.floor(Hn/2),Do=Hn-ao,io=Math.floor(zn/2);tr={top:ao,bottom:Do,left:io,right:zn-io,front:vn,back:Ha,type:"SAME"}}else{if(wt!=="valid")throw Error("Unknown padding parameter: "+wt);tr={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},Er=Math.ceil((Ot-ar+1)/Vt),hr=Math.ceil((Mt-er+1)/Xt),Lr=Math.ceil((Pt-ir+1)/Yt)}return{padInfo:tr,outDepth:Er,outHeight:hr,outWidth:Lr}}(o,C,k,L,Ce,Te,Me,Ze,Je,ht,s),ut=lt.padInfo,gt=lt.outDepth,mt=lt.outHeight,ct=lt.outWidth,xt=a?xe*Y:xe;return i==="channelsFirst"?ne=[f,xt,gt,mt,ct]:i==="channelsLast"&&(ne=[f,gt,mt,ct,xt]),{batchSize:f,dataFormat:i,inDepth:C,inHeight:k,inWidth:L,inChannels:Y,outDepth:gt,outHeight:mt,outWidth:ct,outChannels:xt,padInfo:ut,strideDepth:Ce,strideHeight:Te,strideWidth:Me,filterDepth:ce,filterHeight:se,filterWidth:le,effectiveFilterDepth:Ze,effectiveFilterHeight:Je,effectiveFilterWidth:ht,dilationDepth:Be,dilationHeight:je,dilationWidth:We,inShape:n,outShape:ne,filterShape:r}}function Aa(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 Oa(n){return typeof n=="number"?[n,n,n]:n.length===2?[n[0],n[1],1]:n}function Xo(n){return typeof n=="number"?[n,n,n]:n}function Bn(n,r){return r<=1?n:n+(n-1)*(r-1)}function Ko(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 To(n){var r=Oa(n),e=r[0],t=r[1],o=r[2];return e===1&&t===1&&o===1}function Zr(n,r){return To(n)||To(r)}function fi(n){if(n==="NHWC")return"channelsLast";if(n==="NCHW")return"channelsFirst";throw new Error("Unknown dataFormat "+n)}function hi(n,r,e){if(r==="complex64"){if(n.dtype==="complex64")return n.clone();var t=Tr(n.shape),o=n.toFloat(),a=e.complex(o,t);return t.dispose(),o.dispose(),a}if(!et(n.dtype,r))return Ve.makeTensorFromDataId(n.dataId,n.shape,r);if(n.dtype==="complex64"){var i=e.real(n);return a=i.cast(r),i.dispose(),a}if(r==="int32")return e.int(n);if(r==="bool"){var s=Nt(0,n.dtype);return a=e.notEqual(n,s),s.dispose(),a}throw new Error("Error in Cast: failed to cast "+n.dtype+" to "+r)}function Ra(n,r){return Ve.makeTensorFromDataId(n.dataId,r,n.dtype)}function ts(n,r,e){var t=(r-n)/(e-1),o=R(e,"float32");o[0]=n;for(var a=1;a<o.length;a++)o[a]=o[a-1]+t;return qn(o,"float32")}var cd=Object.freeze({castTensor:hi,reshapeTensor:Ra,linspaceImpl:ts,upcastType:nr,axesAreInnerMostDims:Bi,combineLocations:ri,computeOutAndReduceShapes:Gr,expandShapeToKeepDim:Vr,assertAxesAreInnerMostDims:nn,getAxesPermutation:an,getUndoAxesPermutation:yo,getInnerMostAxes:hn,getBroadcastDims:_n,getReductionAxes:Ir,assertAndGetBroadcastShape:Wt,assertParamsConsistent:Ui,computeOutShape:Jn,computePool2DInfo:eo,computePool3DInfo:Vo,computeConv2DInfo:jn,computeConv3DInfo:Co,computeDefaultPad:Aa,tupleValuesAreOne:To,eitherStridesOrDilationsAreOne:Zr,convertConv2DDataFormat:fi,PARALLELIZE_THRESHOLD:$i,computeOptimalWindowSize:ci});function Ia(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 rs(n,r){return{real:n[2*r],imag:n[2*r+1]}}function eu(n,r,e,t){n[2*t]=r,n[2*t+1]=e}function tu(n,r,e){var t=(e?2:-2)*Math.PI*(n/r);return{real:Math.cos(t),imag:Math.sin(t)}}function ru(n,r,e){var t=function(a,i,s){return function(u,f,C){for(var k=0,L=u.length,Y=0,ne=!1;k<L;){var ce=C(f,u[Y=k+(L-k>>>1)]);ce>0?k=Y+1:(L=Y,ne=!ce)}return ne?k:-k-1}(a,i,s||nu)}(n,r,e),o=t<0?-(t+1):t;n.splice(o,0,r)}function nu(n,r){return n>r?1:n<r?-1:0}function pi(n,r,e,t,o){return ns(n,r,e,t,o,0).selectedIndices}function mi(n,r,e,t,o,a){var i=ns(n,r,e,t,o,a,!0);return i.numValidOutputs.dispose(),{selectedIndices:i.selectedIndices,selectedScores:i.selectedScores}}function ns(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(Ce,Te){return{score:Ce,boxIndex:Te,suppressBeginIndex:0}}).filter(function(Ce){return Ce.score>o}).sort(os),f=a>0?-.5/a:0,C=[],k=[];C.length<e&&u.length>0;){var L=u.pop(),Y=L.score,ne=L.boxIndex,ce=L.suppressBeginIndex;if(Y<o)break;for(var se=!1,le=C.length-1;le>=ce;--le){var xe=ou(n,ne,C[le]);if(xe>=t){se=!0;break}if(L.score=L.score*au(t,f,xe),L.score<=o)break}L.suppressBeginIndex=C.length,se||(L.score===Y?(C.push(ne),k.push(L.score)):L.score>o&&ru(u,L,os))}var Ee=C.length;return s&&(C.fill(0,Ee),k.fill(0,Ee)),{selectedIndices:qn(C,"int32"),selectedScores:qn(k,"float32"),numValidOutputs:Nt(Ee,"int32")}}function ou(n,r,e){var t=n.subarray(4*r,4*r+4),o=n.subarray(4*e,4*e+4),a=Math.min(t[0],t[2]),i=Math.min(t[1],t[3]),s=Math.max(t[0],t[2]),u=Math.max(t[1],t[3]),f=Math.min(o[0],o[2]),C=Math.min(o[1],o[3]),k=Math.max(o[0],o[2]),L=Math.max(o[1],o[3]),Y=(s-a)*(u-i),ne=(k-f)*(L-C);if(Y<=0||ne<=0)return 0;var ce=Math.max(a,f),se=Math.max(i,C),le=Math.min(s,k),xe=Math.min(u,L),Ee=Math.max(le-ce,0)*Math.max(xe-se,0);return Ee/(Y+ne-Ee)}function au(n,r,e){var t=Math.exp(r*e*e);return e<=n?t:0}function os(n,r){return n.score-r.score||n.score===r.score&&r.boxIndex-n.boxIndex}function as(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 is(n,r){for(var e=new Array(n.rank),t=0;t<e.length;t++)e[t]=n.shape[t]*r[t];var o=Lt(e,n.dtype);for(t=0;t<o.values.length;++t){for(var a=o.indexToLoc(t),i=new Array(n.rank),s=0;s<i.length;s++)i[s]=a[s]%n.shape[s];var u=n.locToIndex(i);o.values[t]=n.values[u]}return o.toTensor()}function ss(n,r,e,t,o){for(var a=r[r.length-1],i=[n.length/a,a],s=i[0],u=i[1],f=Se(e,s*t),C=Se("int32",s*t),k=0;k<s;k++){for(var L=k*u,Y=n.subarray(L,L+u),ne=[],ce=0;ce<Y.length;ce++)ne.push({value:Y[ce],index:ce});ne.sort(function(Ce,Te){return Te.value-Ce.value});var se=k*t,le=f.subarray(se,se+t),xe=C.subarray(se,se+t);for(ce=0;ce<t;ce++)le[ce]=ne[ce].value,xe[ce]=ne[ce].index}var Ee=r.slice();return Ee[Ee.length-1]=t,[Ur(f,Ee,e),Ur(C,Ee,"int32")]}function vi(n,r){for(var e=[],t=0;t<r.length;t++)r[t]&&e.push(t);var o=Lt(n,"int32"),a=Lt([e.length,n.length],"int32");for(t=0;t<e.length;t++){var i=o.indexToLoc(e[t]),s=t*n.length;a.values.set(i,s)}return a.toTensor()}var iu=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);
|
|
|
}
|
|
|
`},fc=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);
|
|
|
}
|
|
|
`},hc=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 su(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]:su(n,r)}function Yr(){var n,r,e,t,o,a,i,s,u,f;return p().getNumber("WEBGL_VERSION")===2?(n="#version 300 es",r="in",e="out",t="in",o="texture",a="outputColor",i="out vec4 outputColor;",s=`
|
|
|
bool isnan_custom(float val) {
|
|
|
return (val > 0.0 || val < 0.0) ? false : val != 0.0;
|
|
|
}
|
|
|
|
|
|
bvec4 isnan_custom(vec4 val) {
|
|
|
return bvec4(isnan_custom(val.x),
|
|
|
isnan_custom(val.y), isnan_custom(val.z), isnan_custom(val.w));
|
|
|
}
|
|
|
|
|
|
#define isnan(value) isnan_custom(value)
|
|
|
`,u="",f=`
|
|
|
#define round(value) newRound(value)
|
|
|
int newRound(float value) {
|
|
|
return int(floor(value + 0.5));
|
|
|
}
|
|
|
|
|
|
ivec4 newRound(vec4 value) {
|
|
|
return ivec4(floor(value + vec4(0.5)));
|
|
|
}
|
|
|
`):(n="",r="attribute",e="varying",t="varying",o="texture2D",a="gl_FragColor",i="",s=`
|
|
|
#define isnan(value) isnan_custom(value)
|
|
|
bool isnan_custom(float val) {
|
|
|
return (val > 0. || val < 1. || val == 0.) ? false : true;
|
|
|
}
|
|
|
bvec4 isnan_custom(vec4 val) {
|
|
|
return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w));
|
|
|
}
|
|
|
`,u=`
|
|
|
uniform float INFINITY;
|
|
|
|
|
|
bool isinf(float val) {
|
|
|
return abs(val) == INFINITY;
|
|
|
}
|
|
|
bvec4 isinf(vec4 val) {
|
|
|
return equal(abs(val), vec4(INFINITY));
|
|
|
}
|
|
|
`,f=`
|
|
|
int round(float value) {
|
|
|
return int(floor(value + 0.5));
|
|
|
}
|
|
|
|
|
|
ivec4 round(vec4 value) {
|
|
|
return ivec4(floor(value + vec4(0.5)));
|
|
|
}
|
|
|
`),{version:n,attribute:r,varyingVs:e,varyingFs:t,texture2D:o,output:a,defineOutput:i,defineSpecialNaN:s,defineSpecialInf:u,defineRound:f}}function O(n,r,e){e===void 0&&(e="index");var t=$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 w(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 A=`
|
|
|
const float FLOAT_MAX = 1.70141184e38;
|
|
|
const float FLOAT_MIN = 1.17549435e-38;
|
|
|
|
|
|
lowp vec4 encode_float(highp float v) {
|
|
|
if (isnan(v)) {
|
|
|
return vec4(255, 255, 255, 255);
|
|
|
}
|
|
|
|
|
|
highp float av = abs(v);
|
|
|
|
|
|
if(av < FLOAT_MIN) {
|
|
|
return vec4(0.0, 0.0, 0.0, 0.0);
|
|
|
} else if(v > FLOAT_MAX) {
|
|
|
return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;
|
|
|
} else if(v < -FLOAT_MAX) {
|
|
|
return vec4(0.0, 0.0, 128.0, 255.0) / 255.0;
|
|
|
}
|
|
|
|
|
|
highp vec4 c = vec4(0,0,0,0);
|
|
|
|
|
|
highp float e = floor(log2(av));
|
|
|
highp float m = exp2(fract(log2(av))) - 1.0;
|
|
|
|
|
|
c[2] = floor(128.0 * m);
|
|
|
m -= c[2] / 128.0;
|
|
|
c[1] = floor(32768.0 * m);
|
|
|
m -= c[1] / 32768.0;
|
|
|
c[0] = floor(8388608.0 * m);
|
|
|
|
|
|
highp float ebias = e + 127.0;
|
|
|
c[3] = floor(ebias / 2.0);
|
|
|
ebias -= c[3] * 2.0;
|
|
|
c[2] += floor(ebias) * 128.0;
|
|
|
|
|
|
c[3] += 128.0 * step(0.0, -v);
|
|
|
|
|
|
return c / 255.0;
|
|
|
}
|
|
|
`;function P(n,r,e,t){var o=[];n.forEach(function(Y){var ne=de(Y.shapeInfo.logicalShape);Y.shapeInfo.isUniform?o.push("uniform float "+Y.name+(ne>1?"["+ne+"]":"")+";"):(o.push("uniform sampler2D "+Y.name+";"),o.push("uniform int offset"+Y.name+";"))});var a,i,s=o.join(`
|
|
|
`),u=n.map(function(Y){return function(ne,ce,se){se===void 0&&(se=!1);var le="";le+=se?oe(ne):K(ne);var xe=ne.shapeInfo.logicalShape,Ee=ce.logicalShape;return xe.length<=Ee.length&&(le+=se?function(Ce,Te){var Me,He=Ce.name,Be=He.charAt(0).toUpperCase()+He.slice(1),je="get"+Be+"AtOutCoords",We=Ce.shapeInfo.logicalShape.length,Ze=Te.logicalShape.length,Je=_n(Ce.shapeInfo.logicalShape,Te.logicalShape),ht=ze(Ze),lt=Ze-We,ut=["x","y","z","w","u","v"];Me=We===0?"":Ze<2&&Je.length>=1?"coords = 0;":Je.map(function(Mt){return"coords."+ut[Mt+lt]+" = 0;"}).join(`
|
|
|
`);var gt="";gt=Ze<2&&We>0?"coords":Ce.shapeInfo.logicalShape.map(function(Mt,Pt){return"coords."+ut[Pt+lt]}).join(", ");var mt="return outputValue;",ct=de(Ce.shapeInfo.logicalShape)===1,xt=de(Te.logicalShape)===1;if(We!==1||ct||xt){if(ct&&!xt)mt=Ze===1?`
|
|
|
return vec4(outputValue.x, outputValue.x, 0., 0.);
|
|
|
`:`
|
|
|
return vec4(outputValue.x);
|
|
|
`;else if(Je.length){var wt=We-2,Ot=We-1;Je.indexOf(wt)>-1&&Je.indexOf(Ot)>-1?mt="return vec4(outputValue.x);":Je.indexOf(wt)>-1?mt="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":Je.indexOf(Ot)>-1&&(mt="return vec4(outputValue.xx, outputValue.zz);")}}else mt=`
|
|
|
return vec4(outputValue.xy, outputValue.xy);
|
|
|
`;return`
|
|
|
vec4 `+je+`() {
|
|
|
`+ht+` coords = getOutputCoords();
|
|
|
`+Me+`
|
|
|
vec4 outputValue = get`+Be+"("+gt+`);
|
|
|
`+mt+`
|
|
|
}
|
|
|
`}(ne,ce):function(Ce,Te){var Me=Ce.name,He=Me.charAt(0).toUpperCase()+Me.slice(1),Be="get"+He+"AtOutCoords",je=Te.texShape,We=Ce.shapeInfo.texShape,Ze=Ce.shapeInfo.logicalShape.length,Je=Te.logicalShape.length;if(!Ce.shapeInfo.isUniform&&Ze===Je&&Ce.shapeInfo.flatOffset==null&&we(We,je))return`
|
|
|
float `+Be+`() {
|
|
|
return sampleTexture(`+Me+`, resultUV);
|
|
|
}
|
|
|
`;var ht,lt=ze(Je),ut=_n(Ce.shapeInfo.logicalShape,Te.logicalShape),gt=Je-Ze,mt=["x","y","z","w","u","v"];ht=Ze===0?"":Je<2&&ut.length>=1?"coords = 0;":ut.map(function(xt){return"coords."+mt[xt+gt]+" = 0;"}).join(`
|
|
|
`);var ct="";return ct=Je<2&&Ze>0?"coords":Ce.shapeInfo.logicalShape.map(function(xt,wt){return"coords."+mt[wt+gt]}).join(", "),`
|
|
|
float `+Be+`() {
|
|
|
`+lt+` coords = getOutputCoords();
|
|
|
`+ht+`
|
|
|
return get`+He+"("+ct+`);
|
|
|
}
|
|
|
`}(ne,ce)),le}(Y,r,t)}).join(`
|
|
|
`),f=r.texShape,C=Yr(),k=function(Y){return`
|
|
|
float sampleTexture(sampler2D textureSampler, vec2 uv) {
|
|
|
return `+Y.texture2D+`(textureSampler, uv).r;
|
|
|
}
|
|
|
`}(C),L=function(Y){return Y.version+`
|
|
|
precision highp float;
|
|
|
precision highp int;
|
|
|
precision highp sampler2D;
|
|
|
`+Y.varyingFs+` vec2 resultUV;
|
|
|
`+Y.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;
|
|
|
`+Y.defineSpecialNaN+`
|
|
|
`+Y.defineSpecialInf+`
|
|
|
`+Y.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);
|
|
|
}
|
|
|
|
|
|
`+ve+`
|
|
|
`+he+`
|
|
|
`+_e+`
|
|
|
`}(C);return r.isPacked?(a=function(Y,ne){switch(Y.length){case 0:return`
|
|
|
int getOutputCoords() {
|
|
|
return 0;
|
|
|
}
|
|
|
`;case 1:return function(Ce,Te){var Me=[Math.ceil(Te[0]/2),Math.ceil(Te[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,ne);case 2:return function(Ce,Te){var Me=[Math.ceil(Te[0]/2),Math.ceil(Te[1]/2)];if(we(Ce,Te))return`
|
|
|
ivec2 getOutputCoords() {
|
|
|
return 2 * ivec2(resultUV.yx * vec2(`+Me[0]+", "+Me[1]+`));
|
|
|
}
|
|
|
`;var He=Math.ceil(Ce[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);
|
|
|
}
|
|
|
`}(Y,ne);case 3:return ce=Y,se=ne,le=[Math.ceil(se[0]/2),Math.ceil(se[1]/2)],xe=Math.ceil(ce[2]/2),Ee=xe*Math.ceil(ce[1]/2),`
|
|
|
ivec3 getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+le[0]+", "+le[1]+`));
|
|
|
int index = resTexRC.x * `+le[1]+` + resTexRC.y;
|
|
|
|
|
|
int b = index / `+Ee+`;
|
|
|
index -= b * `+Ee+`;
|
|
|
|
|
|
int r = 2 * (index / `+xe+`);
|
|
|
int c = imod(index, `+xe+`) * 2;
|
|
|
|
|
|
return ivec3(b, r, c);
|
|
|
}
|
|
|
`;default:return function(Ce,Te){for(var Me=[Math.ceil(Te[0]/2),Math.ceil(Te[1]/2)],He=Math.ceil(Ce[Ce.length-1]/2),Be=He*Math.ceil(Ce[Ce.length-2]/2),je=Be,We="",Ze="b, r, c",Je=2;Je<Ce.length-1;Je++)je*=Ce[Ce.length-Je-1],We=`
|
|
|
int b`+Je+" = index / "+je+`;
|
|
|
index -= b`+Je+" * "+je+`;
|
|
|
`+We,Ze="b"+Je+", "+Ze;return`
|
|
|
ivec`+Ce.length+` getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+Me[0]+", "+Me[1]+`));
|
|
|
int index = resTexRC.x * `+Me[1]+` + resTexRC.y;
|
|
|
|
|
|
`+We+`
|
|
|
|
|
|
int b = index / `+Be+`;
|
|
|
index -= b * `+Be+`;
|
|
|
|
|
|
int r = 2 * (index / `+He+`);
|
|
|
int c = imod(index, `+He+`) * 2;
|
|
|
|
|
|
return ivec`+Ce.length+"("+Ze+`);
|
|
|
}
|
|
|
`}(Y,ne)}var ce,se,le,xe,Ee}(r.logicalShape,f),i=function(Y){return`
|
|
|
void setOutput(vec4 val) {
|
|
|
`+Y.output+` = val;
|
|
|
}
|
|
|
`}(C)):(a=function(Y,ne){switch(Y.length){case 0:return`
|
|
|
int getOutputCoords() {
|
|
|
return 0;
|
|
|
}
|
|
|
`;case 1:return function(le,xe){return xe[0]===1?`
|
|
|
int getOutputCoords() {
|
|
|
return int(resultUV.x * `+xe[1]+`.0);
|
|
|
}
|
|
|
`:xe[1]===1?`
|
|
|
int getOutputCoords() {
|
|
|
return int(resultUV.y * `+xe[0]+`.0);
|
|
|
}
|
|
|
`:`
|
|
|
int getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+xe[0]+", "+xe[1]+`));
|
|
|
return resTexRC.x * `+xe[1]+` + resTexRC.y;
|
|
|
}
|
|
|
`}(0,ne);case 2:return function(le,xe){return we(le,xe)?`
|
|
|
ivec2 getOutputCoords() {
|
|
|
return ivec2(resultUV.yx * vec2(`+xe[0]+", "+xe[1]+`));
|
|
|
}
|
|
|
`:le[1]===1?`
|
|
|
ivec2 getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+xe[0]+", "+xe[1]+`));
|
|
|
int index = resTexRC.x * `+xe[1]+` + resTexRC.y;
|
|
|
return ivec2(index, 0);
|
|
|
}
|
|
|
`:le[0]===1?`
|
|
|
ivec2 getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+xe[0]+", "+xe[1]+`));
|
|
|
int index = resTexRC.x * `+xe[1]+` + resTexRC.y;
|
|
|
return ivec2(0, index);
|
|
|
}
|
|
|
`:`
|
|
|
ivec2 getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+xe[0]+", "+xe[1]+`));
|
|
|
int index = resTexRC.x * `+xe[1]+` + resTexRC.y;
|
|
|
int r = index / `+le[1]+`;
|
|
|
int c = index - r * `+le[1]+`;
|
|
|
return ivec2(r, c);
|
|
|
}
|
|
|
`}(Y,ne);case 3:return ce=ne,se=O(["r","c","d"],Y),`
|
|
|
ivec3 getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+ce[0]+", "+ce[1]+`));
|
|
|
int index = resTexRC.x * `+ce[1]+` + resTexRC.y;
|
|
|
`+se+`
|
|
|
return ivec3(r, c, d);
|
|
|
}
|
|
|
`;case 4:return function(le,xe){var Ee=O(["r","c","d","d2"],le);return`
|
|
|
ivec4 getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+xe[0]+", "+xe[1]+`));
|
|
|
int index = resTexRC.x * `+xe[1]+` + resTexRC.y;
|
|
|
`+Ee+`
|
|
|
return ivec4(r, c, d, d2);
|
|
|
}
|
|
|
`}(Y,ne);case 5:return function(le,xe){var Ee=O(["r","c","d","d2","d3"],le);return`
|
|
|
ivec5 getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx * vec2(`+xe[0]+`,
|
|
|
`+xe[1]+`));
|
|
|
|
|
|
int index = resTexRC.x * `+xe[1]+` + resTexRC.y;
|
|
|
|
|
|
`+Ee+`
|
|
|
|
|
|
ivec5 outShape = ivec5(r, c, d, d2, d3);
|
|
|
return outShape;
|
|
|
}
|
|
|
`}(Y,ne);case 6:return function(le,xe){var Ee=O(["r","c","d","d2","d3","d4"],le);return`
|
|
|
ivec6 getOutputCoords() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+xe[0]+", "+xe[1]+`));
|
|
|
int index = resTexRC.x * `+xe[1]+` + resTexRC.y;
|
|
|
|
|
|
`+Ee+`
|
|
|
|
|
|
ivec6 result = ivec6(r, c, d, d2, d3, d4);
|
|
|
return result;
|
|
|
}
|
|
|
`}(Y,ne);default:throw new Error(Y.length+"-D output sampling is not yet supported")}var ce,se}(r.logicalShape,f),i=function(Y){return`
|
|
|
void setOutput(float val) {
|
|
|
`+Y.output+` = vec4(val, 0, 0, 0);
|
|
|
}
|
|
|
`}(C)),t&&(L+=Re),[L,k,i,s,a,u,e].join(`
|
|
|
`)}function K(n){var r=n.shapeInfo.logicalShape;switch(r.length){case 0:return function(e){var t=e.name,o="get"+t.charAt(0).toUpperCase()+t.slice(1);if(e.shapeInfo.isUniform)return"float "+o+"() {return "+t+";}";var a=e.shapeInfo.texShape,i=a[0],s=a[1];if(i===1&&s===1)return`
|
|
|
float `+o+`() {
|
|
|
return sampleTexture(`+t+`, halfCR);
|
|
|
}
|
|
|
`;var u=e.shapeInfo.texShape,f=u[0],C=u[1],k=Ne(t);return`
|
|
|
float `+o+`() {
|
|
|
vec2 uv = uvFromFlat(`+f+", "+C+", "+k+`);
|
|
|
return sampleTexture(`+t+`, uv);
|
|
|
}
|
|
|
`}(n);case 1:return function(e){var t=e.name,o="get"+t.charAt(0).toUpperCase()+t.slice(1);if(e.shapeInfo.isUniform)return`
|
|
|
float `+o+`(int index) {
|
|
|
`+Ue(e)+`
|
|
|
}
|
|
|
`;var a=e.shapeInfo.texShape,i=a[0],s=a[1];if(s===1&&i===1)return`
|
|
|
float `+o+`(int index) {
|
|
|
return sampleTexture(`+t+`, halfCR);
|
|
|
}
|
|
|
`;var u=Ne(t);return s===1?`
|
|
|
float `+o+`(int index) {
|
|
|
vec2 uv = vec2(0.5, (float(index + `+u+") + 0.5) / "+i+`.0);
|
|
|
return sampleTexture(`+t+`, uv);
|
|
|
}
|
|
|
`:i===1?`
|
|
|
float `+o+`(int index) {
|
|
|
vec2 uv = vec2((float(index + `+u+") + 0.5) / "+s+`.0, 0.5);
|
|
|
return sampleTexture(`+t+`, uv);
|
|
|
}
|
|
|
`:`
|
|
|
float `+o+`(int index) {
|
|
|
vec2 uv = uvFromFlat(`+i+", "+s+", index + "+u+`);
|
|
|
return sampleTexture(`+t+`, uv);
|
|
|
}
|
|
|
`}(n);case 2:return function(e){var t=e.shapeInfo.logicalShape,o=e.name,a="get"+o.charAt(0).toUpperCase()+o.slice(1),i=e.shapeInfo.texShape;if(i!=null&&we(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=te(t),C=f.newShape,k=f.keptDims,L=C;if(L.length<t.length){var Y=qe(e,L);return`
|
|
|
`+K(Y)+`
|
|
|
float `+a+`(int row, int col) {
|
|
|
return `+a+"("+it(["row","col"],k)+`);
|
|
|
}
|
|
|
`}if(e.shapeInfo.isUniform)return`
|
|
|
float `+a+`(int row, int col) {
|
|
|
int index = round(dot(vec2(row, col), vec2(`+t[1]+`, 1)));
|
|
|
`+Ue(e)+`
|
|
|
}
|
|
|
`;var ne=i[0],ce=i[1],se=Ne(o);return ce===1?`
|
|
|
float `+a+`(int row, int col) {
|
|
|
float index = dot(vec3(row, col, `+se+"), vec3("+t[1]+`, 1, 1));
|
|
|
vec2 uv = vec2(0.5, (index + 0.5) / `+ne+`.0);
|
|
|
return sampleTexture(`+o+`, uv);
|
|
|
}
|
|
|
`:ne===1?`
|
|
|
float `+a+`(int row, int col) {
|
|
|
float index = dot(vec3(row, col, `+se+"), vec3("+t[1]+`, 1, 1));
|
|
|
vec2 uv = vec2((index + 0.5) / `+ce+`.0, 0.5);
|
|
|
return sampleTexture(`+o+`, uv);
|
|
|
}
|
|
|
`:`
|
|
|
float `+a+`(int row, int col) {
|
|
|
// Explicitly use integer operations as dot() only works on floats.
|
|
|
int index = row * `+t[1]+" + col + "+se+`;
|
|
|
vec2 uv = uvFromFlat(`+ne+", "+ce+`, 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=te(t),f=u.newShape,C=u.keptDims,k=f;if(k.length<t.length){var L=qe(e,k);return`
|
|
|
`+K(L)+`
|
|
|
float `+a+`(int row, int col, int depth) {
|
|
|
return `+a+"("+it(["row","col","depth"],C)+`);
|
|
|
}
|
|
|
`}if(e.shapeInfo.isUniform)return`
|
|
|
float `+a+`(int row, int col, int depth) {
|
|
|
int index = round(dot(vec3(row, col, depth),
|
|
|
vec3(`+i+", "+s+`, 1)));
|
|
|
`+Ue(e)+`
|
|
|
}
|
|
|
`;var Y=e.shapeInfo.texShape,ne=Y[0],ce=Y[1],se=e.shapeInfo.flatOffset;if(ce===i&&se==null)return`
|
|
|
float `+a+`(int row, int col, int depth) {
|
|
|
float texR = float(row);
|
|
|
float texC = dot(vec2(col, depth), vec2(`+s+`, 1));
|
|
|
vec2 uv = (vec2(texC, texR) + halfCR) /
|
|
|
vec2(`+ce+".0, "+ne+`.0);
|
|
|
return sampleTexture(`+o+`, uv);
|
|
|
}
|
|
|
`;if(ce===s&&se==null)return`
|
|
|
float `+a+`(int row, int col, int depth) {
|
|
|
float texR = dot(vec2(row, col), vec2(`+t[1]+`, 1));
|
|
|
float texC = float(depth);
|
|
|
vec2 uv = (vec2(texC, texR) + halfCR) / vec2(`+ce+".0, "+ne+`.0);
|
|
|
return sampleTexture(`+o+`, uv);
|
|
|
}
|
|
|
`;var le=Ne(o);return`
|
|
|
float `+a+`(int row, int col, int depth) {
|
|
|
// Explicitly use integer operations as dot() only works on floats.
|
|
|
int index = row * `+i+" + col * "+s+" + depth + "+le+`;
|
|
|
vec2 uv = uvFromFlat(`+ne+", "+ce+`, 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=te(t),C=f.newShape,k=f.keptDims;if(C.length<t.length){var L=qe(e,C);return`
|
|
|
`+K(L)+`
|
|
|
float `+a+`(int row, int col, int depth, int depth2) {
|
|
|
return `+a+"("+it(["row","col","depth","depth2"],k)+`);
|
|
|
}
|
|
|
`}if(e.shapeInfo.isUniform)return`
|
|
|
float `+a+`(int row, int col, int depth, int depth2) {
|
|
|
int index = round(dot(vec4(row, col, depth, depth2),
|
|
|
vec4(`+u+", "+s+", "+i+`, 1)));
|
|
|
`+Ue(e)+`
|
|
|
}
|
|
|
`;var Y=e.shapeInfo.flatOffset,ne=e.shapeInfo.texShape,ce=ne[0],se=ne[1];if(se===u&&Y==null)return`
|
|
|
float `+a+`(int row, int col, int depth, int depth2) {
|
|
|
float texR = float(row);
|
|
|
float texC =
|
|
|
dot(vec3(col, depth, depth2),
|
|
|
vec3(`+s+", "+i+`, 1));
|
|
|
vec2 uv = (vec2(texC, texR) + halfCR) /
|
|
|
vec2(`+se+".0, "+ce+`.0);
|
|
|
return sampleTexture(`+o+`, uv);
|
|
|
}
|
|
|
`;if(se===i&&Y==null)return`
|
|
|
float `+a+`(int row, int col, int depth, int depth2) {
|
|
|
float texR = dot(vec3(row, col, depth),
|
|
|
vec3(`+t[1]*t[2]+", "+t[2]+`, 1));
|
|
|
float texC = float(depth2);
|
|
|
vec2 uv = (vec2(texC, texR) + halfCR) /
|
|
|
vec2(`+se+".0, "+ce+`.0);
|
|
|
return sampleTexture(`+o+`, uv);
|
|
|
}
|
|
|
`;var le=Ne(o);return`
|
|
|
float `+a+`(int row, int col, int depth, int depth2) {
|
|
|
// Explicitly use integer operations as dot() only works on floats.
|
|
|
int index = row * `+u+" + col * "+s+` +
|
|
|
depth * `+i+` + depth2;
|
|
|
vec2 uv = uvFromFlat(`+ce+", "+se+", index + "+le+`);
|
|
|
return sampleTexture(`+o+`, uv);
|
|
|
}
|
|
|
`}(n);case 5:return function(e){var t=e.shapeInfo.logicalShape,o=e.name,a="get"+o.charAt(0).toUpperCase()+o.slice(1),i=t[4],s=t[3]*i,u=t[2]*s,f=t[1]*u,C=te(t),k=C.newShape,L=C.keptDims;if(k.length<t.length){var Y=qe(e,k);return`
|
|
|
`+K(Y)+`
|
|
|
float `+a+`(int row, int col, int depth, int depth2, int depth3) {
|
|
|
return `+a+"("+it(["row","col","depth","depth2","depth3"],L)+`);
|
|
|
}
|
|
|
`}if(e.shapeInfo.isUniform)return`
|
|
|
float `+a+`(int row, int col, int depth, int depth2, int depth3) {
|
|
|
float index = dot(
|
|
|
vec4(row, col, depth, depth2),
|
|
|
vec4(`+f+", "+u+", "+s+", "+i+`)) +
|
|
|
depth3;
|
|
|
`+Ue(e)+`
|
|
|
}
|
|
|
`;var ne=e.shapeInfo.flatOffset,ce=e.shapeInfo.texShape,se=ce[0],le=ce[1];if(le===f&&ne==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(`+le+".0, "+se+`.0);
|
|
|
return sampleTexture(`+o+`, uv);
|
|
|
}
|
|
|
`;if(le===i&&ne==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(`+le+".0, "+se+`.0);
|
|
|
return sampleTexture(`+o+`, uv);
|
|
|
}
|
|
|
`;var xe=Ne(o);return`
|
|
|
float `+a+`(int row, int col, int depth, int depth2, int depth3) {
|
|
|
// Explicitly use integer operations as dot() only works on floats.
|
|
|
int index = row * `+f+" + col * "+u+" + depth * "+s+` +
|
|
|
depth2 * `+i+" + depth3 + "+xe+`;
|
|
|
vec2 uv = uvFromFlat(`+se+", "+le+`, 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=te(t),s=i.newShape,u=i.keptDims;if(s.length<t.length){var f=qe(e,s);return`
|
|
|
`+K(f)+`
|
|
|
float `+a+`(int row, int col, int depth,
|
|
|
int depth2, int depth3, int depth4) {
|
|
|
return `+a+"("+it(["row","col","depth","depth2","depth3","depth4"],u)+`);
|
|
|
}
|
|
|
`}var C=t[5],k=t[4]*C,L=t[3]*k,Y=t[2]*L,ne=t[1]*Y;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(`+ne+", "+Y+", "+L+", "+k+`)) +
|
|
|
dot(
|
|
|
vec2(depth3, depth4),
|
|
|
vec2(`+C+`, 1)));
|
|
|
`+Ue(e)+`
|
|
|
}
|
|
|
`;var ce=e.shapeInfo.flatOffset,se=e.shapeInfo.texShape,le=se[0],xe=se[1];if(xe===ne&&ce==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(`+Y+", "+L+", "+k+", "+C+`)) +
|
|
|
float(depth4);
|
|
|
vec2 uv = (vec2(texC, texR) + halfCR) /
|
|
|
vec2(`+xe+".0, "+le+`.0);
|
|
|
return sampleTexture(`+o+`, uv);
|
|
|
}
|
|
|
`;if(xe===C&&ce==null)return`
|
|
|
float `+a+`(int row, int col, int depth,
|
|
|
int depth2, int depth3, int depth4) {
|
|
|
float texR = dot(vec4(row, col, depth, depth2),
|
|
|
vec4(`+t[1]*t[2]*t[3]*t[4]+`,
|
|
|
`+t[2]*t[3]*t[4]+`,
|
|
|
`+t[3]*t[4]+`,
|
|
|
`+t[4]+`)) + float(depth3);
|
|
|
int texC = depth4;
|
|
|
vec2 uv = (vec2(texC, texR) + halfCR) /
|
|
|
vec2(`+xe+".0, "+le+`.0);
|
|
|
return sampleTexture(`+o+`, uv);
|
|
|
}
|
|
|
`;var Ee=Ne(o);return`
|
|
|
float `+a+`(int row, int col, int depth,
|
|
|
int depth2, int depth3, int depth4) {
|
|
|
// Explicitly use integer operations as dot() only works on floats.
|
|
|
int index = row * `+ne+" + col * "+Y+" + depth * "+L+` +
|
|
|
depth2 * `+k+" + depth3 * "+C+" + depth4 + "+Ee+`;
|
|
|
vec2 uv = uvFromFlat(`+le+", "+xe+`, index);
|
|
|
return sampleTexture(`+o+`, uv);
|
|
|
}
|
|
|
`}(n);default:throw new Error(r.length+"-D input sampling is not yet supported")}}function oe(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=Yr(),`
|
|
|
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=Yr();return`
|
|
|
vec4 `+i+`(int index) {
|
|
|
vec2 uv = packedUVfrom1D(
|
|
|
`+u[0]+", "+u[1]+`, index);
|
|
|
return `+f.texture2D+"("+a+`, uv);
|
|
|
}
|
|
|
`}(n);case 2:return function(o){var a=o.shapeInfo.logicalShape,i=o.name,s="get"+i.charAt(0).toUpperCase()+i.slice(1),u=o.shapeInfo.texShape,f=u[0],C=u[1],k=Yr();if(u!=null&&we(a,u))return`
|
|
|
vec4 `+s+`(int row, int col) {
|
|
|
vec2 uv = (vec2(col, row) + halfCR) / vec2(`+C+".0, "+f+`.0);
|
|
|
|
|
|
return `+k.texture2D+"("+i+`, uv);
|
|
|
}
|
|
|
`;var L=[Math.ceil(u[0]/2),Math.ceil(u[1]/2)],Y=Math.ceil(a[1]/2);return`
|
|
|
vec4 `+s+`(int row, int col) {
|
|
|
vec2 uv = packedUVfrom2D(`+Y+", "+L[0]+", "+L[1]+`, row, col);
|
|
|
return `+k.texture2D+"("+i+`, uv);
|
|
|
}
|
|
|
`}(n);case 3:return function(o){var a=o.shapeInfo.logicalShape,i=o.name,s="get"+i.charAt(0).toUpperCase()+i.slice(1),u=o.shapeInfo.texShape,f=[Math.ceil(u[0]/2),Math.ceil(u[1]/2)];if(a[0]===1){var C=a.slice(1),k=qe(o,C);return`
|
|
|
`+oe(k)+`
|
|
|
vec4 `+s+`(int b, int row, int col) {
|
|
|
return `+s+"("+it(["b","row","col"],[1,2])+`);
|
|
|
}
|
|
|
`}var L=f[0],Y=f[1],ne=Math.ceil(a[2]/2),ce=ne*Math.ceil(a[1]/2),se=Yr();return`
|
|
|
vec4 `+s+`(int b, int row, int col) {
|
|
|
vec2 uv = packedUVfrom3D(
|
|
|
`+L+", "+Y+", "+ce+", "+ne+`, b, row, col);
|
|
|
return `+se.texture2D+"("+i+`, uv);
|
|
|
}
|
|
|
`}(n);default:return function(o){for(var a=o.shapeInfo.logicalShape,i=a.length,s=o.name,u="get"+s.charAt(0).toUpperCase()+s.slice(1),f=o.shapeInfo.texShape,C=[Math.ceil(f[0]/2),Math.ceil(f[1]/2)],k=C[0],L=C[1],Y=Math.ceil(a[i-1]/2),ne=Y*Math.ceil(a[i-2]/2),ce="int b, int row, int col",se="b * "+ne+" + (row / 2) * "+Y+" + (col / 2)",le=2;le<i-1;le++)ce="int b"+le+", "+ce,ne*=a[i-le-1],se="b"+le+" * "+ne+" + "+se;var xe=Yr();return`
|
|
|
vec4 `+u+"("+ce+`) {
|
|
|
int index = `+se+`;
|
|
|
int texR = index / `+L+`;
|
|
|
int texC = index - texR * `+L+`;
|
|
|
vec2 uv = (vec2(texC, texR) + halfCR) / vec2(`+L+", "+k+`);
|
|
|
return `+xe.texture2D+"("+s+`, uv);
|
|
|
}
|
|
|
`}(n)}}var ve=`
|
|
|
vec2 uvFromFlat(int texNumR, int texNumC, int index) {
|
|
|
int texR = index / texNumC;
|
|
|
int texC = index - texR * texNumC;
|
|
|
return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
|
|
|
}
|
|
|
vec2 packedUVfrom1D(int texNumR, int texNumC, int index) {
|
|
|
int texelIndex = index / 2;
|
|
|
int texR = texelIndex / texNumC;
|
|
|
int texC = texelIndex - texR * texNumC;
|
|
|
return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
|
|
|
}
|
|
|
`,he=`
|
|
|
vec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR,
|
|
|
int texNumC, int row, int col) {
|
|
|
int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);
|
|
|
int texR = texelIndex / texNumC;
|
|
|
int texC = texelIndex - texR * texNumC;
|
|
|
return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);
|
|
|
}
|
|
|
`,_e=`
|
|
|
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);
|
|
|
}
|
|
|
`,Re=`
|
|
|
float getChannel(vec4 frag, vec2 innerDims) {
|
|
|
vec2 modCoord = mod(innerDims, 2.);
|
|
|
return modCoord.x == 0. ?
|
|
|
(modCoord.y == 0. ? frag.r : frag.g) :
|
|
|
(modCoord.y == 0. ? frag.b : frag.a);
|
|
|
}
|
|
|
float getChannel(vec4 frag, int dim) {
|
|
|
float modCoord = mod(float(dim), 2.);
|
|
|
return modCoord == 0. ? frag.r : frag.g;
|
|
|
}
|
|
|
`;function Ne(n){return"offset"+n}function Ue(n){var r=n.name,e=de(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 bt=function(n,r,e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,_(n.length>2,function(){return"Packed arg"+(e.charAt(0).toUpperCase()+e.slice(1))+" supports only inputs with rank above 2."});var o=n[n.length-1],a=Math.ceil(o/r);this.outputShape=n.slice(0,-1),a>1&&this.outputShape.push(a),t||this.variableNames.push("bestIndicesA");var i,s,u=this.outputShape,f=u.length,C=ze(f),k=en("coords",f);if(a===1){var L=ze(s=f+1);i=`
|
|
|
`+L+" sourceLocR = "+L+"("+k.join()+`, 0);
|
|
|
++`+k[f-1]+`;
|
|
|
`+L+" sourceLocG = "+L+"("+k.join()+`, 0);
|
|
|
++`+k[f-2]+`;
|
|
|
`+L+" sourceLocA = "+L+"("+k.join()+`, 0);
|
|
|
--`+k[f-1]+`;
|
|
|
`+L+" sourceLocB = "+L+"("+k.join()+`, 0);
|
|
|
--`+k[f-2]+";"}else s=f,i=`
|
|
|
`+C+` sourceLocR = coords;
|
|
|
++`+k[f-1]+`;
|
|
|
`+C+` sourceLocG = coords;
|
|
|
++`+k[f-2]+`;
|
|
|
`+C+` sourceLocA = coords;
|
|
|
--`+k[f-1]+`;
|
|
|
`+C+` sourceLocB = coords;
|
|
|
--`+k[f-2]+";";var Y=["x","y","z","w","u","v"].slice(0,s),ne="."+Y[s-1],ce=Y.map(function(Be){return"int "+Be}),se=en("sourceLocR",s-1).concat("inIdx.r"),le=en("sourceLocG",s-1).concat("inIdx.g"),xe=en("sourceLocB",s-1).concat("inIdx.b"),Ee=en("sourceLocA",s-1).concat("inIdx.a"),Ce=e==="max"?"greaterThan":"lessThan",Te=t?"":`
|
|
|
inIdx = round(vec4(getBestIndicesAChannel(`+se.join()+`),
|
|
|
getBestIndicesAChannel(`+le.join()+`),
|
|
|
getBestIndicesAChannel(`+xe.join()+`),
|
|
|
getBestIndicesAChannel(`+Ee.join()+")));",Me=`vec4(
|
|
|
getAChannel(`+se.join()+`),
|
|
|
hasNextCol ? getAChannel(`+le.join()+`) : 0.,
|
|
|
hasNextRow ? getAChannel(`+xe.join()+`) : 0.,
|
|
|
hasNextRow && hasNextCol ? getAChannel(`+Ee.join()+") : 0.)",He=t?"":`
|
|
|
float getBestIndicesAChannel(`+ce.join()+`) {
|
|
|
return getChannel(getBestIndicesA(`+Y.join()+`),
|
|
|
vec2(`+Y.slice(-2).join()+`));
|
|
|
}`;this.userCode=`
|
|
|
float getAChannel(`+ce.join()+`) {
|
|
|
return getChannel(getA(`+Y.join()+`),
|
|
|
vec2(`+Y.slice(-2).join()+`));
|
|
|
}
|
|
|
`+He+`
|
|
|
void main() {
|
|
|
`+C+` coords = getOutputCoords();
|
|
|
bool hasNextCol = `+k[f-1]+" < "+(u[f-1]-1)+`;
|
|
|
bool hasNextRow = `+k[f-2]+" < "+(u[f-2]-1)+`;
|
|
|
`+i+`
|
|
|
ivec4 srcIdx = ivec4(sourceLocR`+ne+", sourceLocG"+ne+`,
|
|
|
sourceLocB`+ne+", sourceLocA"+ne+") * "+r+`;
|
|
|
ivec4 inIdx = srcIdx;
|
|
|
vec4 bestIndex = vec4(inIdx);
|
|
|
vec4 bestValue = `+Me+`;
|
|
|
|
|
|
for (int i = 0; i < `+r+`; i++) {
|
|
|
inIdx = srcIdx;
|
|
|
`+Te+`
|
|
|
vec4 candidate = `+Me+`;
|
|
|
bvec4 nan = isnan(candidate);
|
|
|
bvec4 replace = bvec4(
|
|
|
vec4(`+Ce+`(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);
|
|
|
}
|
|
|
`},Et=function(n){this.variableNames=["dy"],this.outputShape=n.inShape;var r=n.filterHeight,e=n.filterWidth,t=n.strideHeight,o=n.strideWidth,a=n.dilationHeight,i=n.dilationWidth,s=n.effectiveFilterHeight,u=n.effectiveFilterWidth,f=s-1-n.padInfo.top,C=u-1-n.padInfo.left,k=1/(r*e);this.userCode=`
|
|
|
const ivec2 pads = ivec2(`+f+", "+C+`);
|
|
|
const float avgMultiplier = float(`+k+`);
|
|
|
|
|
|
void main() {
|
|
|
ivec4 coords = getOutputCoords();
|
|
|
int b = coords[0];
|
|
|
int d = coords[3];
|
|
|
|
|
|
ivec2 dyRCCorner = coords.yz - pads;
|
|
|
int dyRCorner = dyRCCorner.x;
|
|
|
int dyCCorner = dyRCCorner.y;
|
|
|
|
|
|
// Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).
|
|
|
// ? = to be determined. : = across all values in that axis.
|
|
|
float dotProd = 0.0;
|
|
|
for (int wR = 0; wR < `+s+`;
|
|
|
wR += `+a+`) {
|
|
|
float dyR = float(dyRCorner + wR) / `+t+`.0;
|
|
|
|
|
|
if (dyR < 0.0 || dyR >= `+n.outHeight+`.0 || fract(dyR) > 0.0) {
|
|
|
continue;
|
|
|
}
|
|
|
int idyR = int(dyR);
|
|
|
|
|
|
for (int wC = 0; wC < `+u+`;
|
|
|
wC+= `+i+`) {
|
|
|
float dyC = float(dyCCorner + wC) / `+o+`.0;
|
|
|
|
|
|
if (dyC < 0.0 || dyC >= `+n.outWidth+`.0 ||
|
|
|
fract(dyC) > 0.0) {
|
|
|
continue;
|
|
|
}
|
|
|
int idyC = int(dyC);
|
|
|
|
|
|
float dyValue = getDy(b, idyR, idyC, d);
|
|
|
|
|
|
dotProd += dyValue * avgMultiplier;
|
|
|
}
|
|
|
}
|
|
|
setOutput(dotProd);
|
|
|
}
|
|
|
`},Tt=function(n){this.variableNames=["dy"],this.outputShape=n.inShape;var r=n.filterDepth,e=n.filterHeight,t=n.filterWidth,o=n.strideDepth,a=n.strideHeight,i=n.strideWidth,s=n.dilationDepth,u=n.dilationHeight,f=n.dilationWidth,C=n.effectiveFilterDepth,k=n.effectiveFilterHeight,L=n.effectiveFilterWidth,Y=C-1-n.padInfo.front,ne=k-1-n.padInfo.top,ce=L-1-n.padInfo.left,se=1/(r*e*t);this.userCode=`
|
|
|
const ivec3 pads = ivec3(`+Y+", "+ne+", "+ce+`);
|
|
|
const float avgMultiplier = float(`+se+`);
|
|
|
|
|
|
void main() {
|
|
|
ivec5 coords = getOutputCoords();
|
|
|
int batch = coords.x;
|
|
|
int ch = coords.u;
|
|
|
|
|
|
ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;
|
|
|
int dyDCorner = dyCorner.x;
|
|
|
int dyRCorner = dyCorner.y;
|
|
|
int dyCCorner = dyCorner.z;
|
|
|
|
|
|
// Convolve dy(?, ?, ?, d) with pos mask(:, :, :, ch) to get
|
|
|
// dx(xD, xR, xC, ch).
|
|
|
// ? = to be determined. : = across all values in that axis.
|
|
|
float dotProd = 0.0;
|
|
|
|
|
|
for (int wD = 0; wD < `+C+`;
|
|
|
wD += `+s+`) {
|
|
|
float dyD = float(dyDCorner + wD) / `+o+`.0;
|
|
|
|
|
|
if (dyD < 0.0 || dyD >= `+n.outDepth+`.0 || fract(dyD) > 0.0) {
|
|
|
continue;
|
|
|
}
|
|
|
int idyD = int(dyD);
|
|
|
|
|
|
for (int wR = 0; wR < `+k+`;
|
|
|
wR += `+u+`) {
|
|
|
float dyR = float(dyRCorner + wR) / `+a+`.0;
|
|
|
|
|
|
if (dyR < 0.0 || dyR >= `+n.outHeight+`.0 ||
|
|
|
fract(dyR) > 0.0) {
|
|
|
continue;
|
|
|
}
|
|
|
int idyR = int(dyR);
|
|
|
|
|
|
for (int wC = 0; wC < `+L+`;
|
|
|
wC += `+f+`) {
|
|
|
float dyC = float(dyCCorner + wC) / `+i+`.0;
|
|
|
|
|
|
if (dyC < 0.0 || dyC >= `+n.outWidth+`.0 ||
|
|
|
fract(dyC) > 0.0) {
|
|
|
continue;
|
|
|
}
|
|
|
int idyC = int(dyC);
|
|
|
|
|
|
float dyValue = getDy(batch, idyD, idyR, idyC, ch);
|
|
|
|
|
|
dotProd += dyValue * avgMultiplier;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
setOutput(dotProd);
|
|
|
}
|
|
|
`},It=function(n,r,e,t,o,a){this.outputShape=[],this.variableNames=["x","mean","variance"],Wt(n,r),Wt(n,e);var i="0.0";t!=null&&(Wt(n,t),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");var s="1.0";o!=null&&(Wt(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"],Wt(n,r),Wt(n,e);var i="vec4(0.0)";t!=null&&(Wt(n,t),this.variableNames.push("offset"),i="getOffsetAtOutCoords()");var s="vec4(1.0)";o!=null&&(Wt(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);
|
|
|
}
|
|
|
`},vt="return areal * breal - aimag * bimag;",Ct="return areal * bimag + aimag * breal;",Bt=function(n,r,e){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=Wt(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));
|
|
|
}
|
|
|
`},lr="return a + b;",xr="return a - b;",or="return a * b;",Ht="return (a < 0.) ? b * a : a;",Ut=function(n,r,e){this.variableNames=["A","B"],this.outputShape=Wt(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);
|
|
|
`,dr=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=Wt(r,e);var o=this.outputShape.length,a="";if(t)if(o===0||de(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}(),un=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))
|
|
|
);
|
|
|
}
|
|
|
`},Kr=function(n){this.outputShape=[],this.outputShape=Jn(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(`
|
|
|
`)+`
|
|
|
}
|
|
|
`},fr=function(n,r){this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[],this.outputShape=Jn(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(se,le){return"T"+le});var s=new Array(n.length-1);s[0]=n[0][r];for(var u=1;u<s.length;u++)s[u]=s[u-1]+n[u][r];var f=i[r],C=i.slice(-2),k=i.join(),L="if ("+f+" < "+s[0]+`) {
|
|
|
return getChannel(
|
|
|
getT0(`+k+"), vec2("+C.join()+`));
|
|
|
}`;for(u=1;u<s.length;u++){var Y=s[u-1];L+=`
|
|
|
if (`+f+" < "+s[u]+" && "+f+" >= "+s[u-1]+`) {
|
|
|
return getChannel(
|
|
|
getT`+u+"("+_r(i,f,Y)+`),
|
|
|
vec2(`+_r(C,f,Y)+`));
|
|
|
}`}var ne=s.length,ce=s[s.length-1];L+=`
|
|
|
return getChannel(
|
|
|
getT`+ne+"("+_r(i,f,ce)+`),
|
|
|
vec2(`+_r(C,f,ce)+"));",this.userCode=`
|
|
|
float getValue(`+i.map(function(se){return"int "+se})+`) {
|
|
|
`+L+`
|
|
|
}
|
|
|
|
|
|
void main() {
|
|
|
`+o+` coords = getOutputCoords();
|
|
|
vec4 result = vec4(getValue(`+a+`), 0., 0., 0.);
|
|
|
|
|
|
`+a[t-1]+" = "+a[t-1]+` + 1;
|
|
|
if (`+a[t-1]+" < "+e[t-1]+`) {
|
|
|
result.g = getValue(`+a+`);
|
|
|
}
|
|
|
|
|
|
`+a[t-2]+" = "+a[t-2]+` + 1;
|
|
|
if (`+a[t-2]+" < "+e[t-2]+`) {
|
|
|
result.a = getValue(`+a+`);
|
|
|
}
|
|
|
|
|
|
`+a[t-1]+" = "+a[t-1]+` - 1;
|
|
|
if (`+a[t-2]+" < "+e[t-2]+` &&
|
|
|
`+a[t-1]+" < "+e[t-1]+`) {
|
|
|
result.b = getValue(`+a+`);
|
|
|
}
|
|
|
setOutput(result);
|
|
|
}
|
|
|
`};function _r(n,r,e){var t=n.indexOf(r);return n.map(function(o,a){return a===t?o+" - "+e:o}).join()}var Un=function(n){this.variableNames=["x","dy"],this.outputShape=n.filterShape;var r=n.strideHeight,e=n.strideWidth,t=n.padInfo.top,o=n.padInfo.left,a=n.dataFormat==="channelsLast";this.userCode=`
|
|
|
void main() {
|
|
|
ivec4 coords = getOutputCoords();
|
|
|
int wR = coords.x;
|
|
|
int wC = coords.y;
|
|
|
int d1 = coords.z;
|
|
|
int d2 = coords.w;
|
|
|
|
|
|
// Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2).
|
|
|
// ? = to be determined. : = across all values in that axis.
|
|
|
float dotProd = 0.0;
|
|
|
|
|
|
for (int b = 0; b < `+n.batchSize+`; b++) {
|
|
|
for (int yR = 0; yR < `+n.outHeight+`; yR++) {
|
|
|
int xR = wR + yR * `+r+" - "+t+`;
|
|
|
|
|
|
if (xR < 0 || xR >= `+n.inHeight+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int yC = 0; yC < `+n.outWidth+`; yC++) {
|
|
|
int xC = wC + yC * `+e+" - "+o+`;
|
|
|
|
|
|
if (xC < 0 || xC >= `+n.inWidth+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
if (`+a+`) {
|
|
|
float dyValue = getDy(b, yR, yC, d2);
|
|
|
float xValue = getX(b, xR, xC, d1);
|
|
|
dotProd += (xValue * dyValue);
|
|
|
} else {
|
|
|
float dyValue = getDy(b, d2, yR, yC);
|
|
|
float xValue = getX(b, d1, xR, xC);
|
|
|
dotProd += (xValue * dyValue);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
setOutput(dotProd);
|
|
|
}
|
|
|
`},Cn=function(n){this.variableNames=["dy","W"],this.outputShape=n.inShape;var r=n.filterHeight,e=n.filterWidth,t=n.strideHeight,o=n.strideWidth,a=n.dataFormat==="channelsLast",i=r-1-n.padInfo.top,s=e-1-n.padInfo.left,u=a?1:2,f=a?2:3,C=a?3:1;this.userCode=`
|
|
|
const ivec2 pads = ivec2(`+i+", "+s+`);
|
|
|
|
|
|
void main() {
|
|
|
ivec4 coords = getOutputCoords();
|
|
|
int batch = coords[0];
|
|
|
int d1 = coords[`+C+`];
|
|
|
|
|
|
ivec2 dyCorner = ivec2(coords[`+u+"], coords["+f+`]) - pads;
|
|
|
int dyRCorner = dyCorner.x;
|
|
|
int dyCCorner = dyCorner.y;
|
|
|
|
|
|
// Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).
|
|
|
// ? = to be determined. : = across all values in that axis.
|
|
|
float dotProd = 0.0;
|
|
|
for (int wR = 0; wR < `+r+`; wR++) {
|
|
|
float dyR = float(dyRCorner + wR) / `+t+`.0;
|
|
|
|
|
|
if (dyR < 0.0 || dyR >= `+n.outHeight+`.0 || fract(dyR) > 0.0) {
|
|
|
continue;
|
|
|
}
|
|
|
int idyR = int(dyR);
|
|
|
|
|
|
int wRPerm = `+r+` - 1 - wR;
|
|
|
|
|
|
for (int wC = 0; wC < `+e+`; wC++) {
|
|
|
float dyC = float(dyCCorner + wC) / `+o+`.0;
|
|
|
|
|
|
if (dyC < 0.0 || dyC >= `+n.outWidth+`.0 ||
|
|
|
fract(dyC) > 0.0) {
|
|
|
continue;
|
|
|
}
|
|
|
int idyC = int(dyC);
|
|
|
|
|
|
int wCPerm = `+e+` - 1 - wC;
|
|
|
|
|
|
for (int d2 = 0; d2 < `+n.outChannels+`; d2++) {
|
|
|
|
|
|
if (`+a+`) {
|
|
|
float xValue = getDy(batch, idyR, idyC, d2);
|
|
|
float wValue = getW(wRPerm, wCPerm, d1, d2);
|
|
|
dotProd += xValue * wValue;
|
|
|
} else {
|
|
|
float xValue = getDy(batch, d2, idyR, idyC);
|
|
|
float wValue = getW(wRPerm, wCPerm, d1, d2);
|
|
|
dotProd += xValue * wValue;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
setOutput(dotProd);
|
|
|
}
|
|
|
`},Yo=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);
|
|
|
}
|
|
|
`},So=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);
|
|
|
}
|
|
|
`},$o=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);
|
|
|
}
|
|
|
`},vr=function(n){this.variableNames=["dy","W"],this.outputShape=n.inShape;var r=n.filterHeight,e=n.filterWidth,t=n.strideHeight,o=n.strideWidth,a=r-1-n.padInfo.top,i=e-1-n.padInfo.left,s=n.outChannels/n.inChannels;this.userCode=`
|
|
|
const ivec2 pads = ivec2(`+a+", "+i+`);
|
|
|
|
|
|
void main() {
|
|
|
ivec4 coords = getOutputCoords();
|
|
|
int batch = coords[0];
|
|
|
int d1 = coords[3];
|
|
|
ivec2 dyCorner = coords.yz - pads;
|
|
|
int dyRCorner = dyCorner.x;
|
|
|
int dyCCorner = dyCorner.y;
|
|
|
|
|
|
float dotProd = 0.0;
|
|
|
|
|
|
for (int wR = 0; wR < `+r+`; wR++) {
|
|
|
float dyR = float(dyRCorner + wR) / `+t+`.0;
|
|
|
|
|
|
if (dyR < 0.0 || dyR >= `+n.outHeight+`.0 || fract(dyR) > 0.0) {
|
|
|
continue;
|
|
|
}
|
|
|
int idyR = int(dyR);
|
|
|
|
|
|
int wRPerm = `+r+` - 1 - wR;
|
|
|
|
|
|
for (int wC = 0; wC < `+e+`; wC++) {
|
|
|
float dyC = float(dyCCorner + wC) / `+o+`.0;
|
|
|
|
|
|
if (dyC < 0.0 || dyC >= `+n.outWidth+`.0 ||
|
|
|
fract(dyC) > 0.0) {
|
|
|
continue;
|
|
|
}
|
|
|
int idyC = int(dyC);
|
|
|
|
|
|
int wCPerm = `+e+` - 1 - wC;
|
|
|
|
|
|
// TO DO: Vec4 over the channelMul
|
|
|
for (int dm = 0; dm < `+s+`; dm++) {
|
|
|
int d2 = d1 * `+s+` + dm;
|
|
|
float xValue = getDy(batch, idyR, idyC, d2);
|
|
|
float wValue = getW(wRPerm, wCPerm, d1, dm);
|
|
|
dotProd += xValue * wValue;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
setOutput(dotProd);
|
|
|
}
|
|
|
`},kt=function(n,r,e,t){r===void 0&&(r=!1),e===void 0&&(e=null),t===void 0&&(t=!1),this.variableNames=["x","W"],this.outputShape=n.outShape;var o=n.padInfo.top,a=n.padInfo.left,i=n.strideHeight,s=n.strideWidth,u=n.dilationHeight,f=n.dilationWidth,C=n.filterHeight,k=n.filterWidth,L=4*Math.floor(n.inChannels/4),Y=n.inChannels%4,ne=n.dataFormat==="channelsLast",ce=ne?1:2,se=ne?2:3,le=ne?3:1,xe="",Ee="";e&&(xe=t?`float activation(float a) {
|
|
|
float b = getPreluActivationWeightsAtOutCoords();
|
|
|
`+e+`
|
|
|
}`:`
|
|
|
float activation(float x) {
|
|
|
`+e+`
|
|
|
}
|
|
|
`,Ee="result = activation(result);");var Ce=r?"result += getBiasAtOutCoords();":"";r&&this.variableNames.push("bias"),t&&this.variableNames.push("preluActivationWeights"),this.userCode=`
|
|
|
`+xe+`
|
|
|
|
|
|
const ivec2 strides = ivec2(`+i+", "+s+`);
|
|
|
const ivec2 pads = ivec2(`+o+", "+a+`);
|
|
|
|
|
|
void main() {
|
|
|
ivec4 coords = getOutputCoords();
|
|
|
int batch = coords[0];
|
|
|
int d2 = coords[`+le+`];
|
|
|
|
|
|
ivec2 xRCCorner =
|
|
|
ivec2(coords[`+ce+"], coords["+se+`]) * strides - pads;
|
|
|
int xRCorner = xRCCorner.x;
|
|
|
int xCCorner = xRCCorner.y;
|
|
|
|
|
|
// Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).
|
|
|
// ? = to be determined. : = across all values in that axis.
|
|
|
float dotProd = 0.0;
|
|
|
for (int wR = 0; wR < `+C+`; wR++) {
|
|
|
int xR = xRCorner + wR * `+u+`;
|
|
|
|
|
|
if (xR < 0 || xR >= `+n.inHeight+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int wC = 0; wC < `+k+`; wC++) {
|
|
|
int xC = xCCorner + wC * `+f+`;
|
|
|
|
|
|
if (xC < 0 || xC >= `+n.inWidth+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int d1 = 0; d1 < `+L+`; d1 += 4) {
|
|
|
vec4 wValues = vec4(
|
|
|
getW(wR, wC, d1, d2),
|
|
|
getW(wR, wC, d1 + 1, d2),
|
|
|
getW(wR, wC, d1 + 2, d2),
|
|
|
getW(wR, wC, d1 + 3, d2)
|
|
|
);
|
|
|
|
|
|
if (`+ne+`) {
|
|
|
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 (`+(Y===1)+`) {
|
|
|
|
|
|
if (`+ne+`) {
|
|
|
dotProd +=
|
|
|
getX(batch, xR, xC, `+L+`) *
|
|
|
getW(wR, wC, `+L+`, d2);
|
|
|
} else {
|
|
|
dotProd +=
|
|
|
getX(batch, `+L+`, xR, xC) *
|
|
|
getW(wR, wC, `+L+`, d2);
|
|
|
}
|
|
|
|
|
|
} else if (`+(Y===2)+`) {
|
|
|
vec2 wValues = vec2(
|
|
|
getW(wR, wC, `+L+`, d2),
|
|
|
getW(wR, wC, `+L+` + 1, d2)
|
|
|
);
|
|
|
|
|
|
if (`+ne+`) {
|
|
|
vec2 xValues = vec2(
|
|
|
getX(batch, xR, xC, `+L+`),
|
|
|
getX(batch, xR, xC, `+L+` + 1)
|
|
|
);
|
|
|
dotProd += dot(xValues, wValues);
|
|
|
} else {
|
|
|
vec2 xValues = vec2(
|
|
|
getX(batch, `+L+`, xR, xC),
|
|
|
getX(batch, `+L+` + 1, xR, xC)
|
|
|
);
|
|
|
dotProd += dot(xValues, wValues);
|
|
|
}
|
|
|
|
|
|
} else if (`+(Y===3)+`) {
|
|
|
vec3 wValues = vec3(
|
|
|
getW(wR, wC, `+L+`, d2),
|
|
|
getW(wR, wC, `+L+` + 1, d2),
|
|
|
getW(wR, wC, `+L+` + 2, d2)
|
|
|
);
|
|
|
|
|
|
if (`+ne+`) {
|
|
|
vec3 xValues = vec3(
|
|
|
getX(batch, xR, xC, `+L+`),
|
|
|
getX(batch, xR, xC, `+L+` + 1),
|
|
|
getX(batch, xR, xC, `+L+` + 2)
|
|
|
);
|
|
|
dotProd += dot(xValues, wValues);
|
|
|
} else {
|
|
|
vec3 xValues = vec3(
|
|
|
getX(batch, `+L+`, xR, xC),
|
|
|
getX(batch, `+L+` + 1, xR, xC),
|
|
|
getX(batch, `+L+` + 2, xR, xC)
|
|
|
);
|
|
|
dotProd += dot(xValues, wValues);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
float result = dotProd;
|
|
|
`+Ce+`
|
|
|
`+Ee+`
|
|
|
setOutput(result);
|
|
|
}
|
|
|
`},Gt=function(n){this.variableNames=["x","W"],this.outputShape=n.outShape;var r=n.padInfo.front,e=n.padInfo.top,t=n.padInfo.left,o=n.strideDepth,a=n.strideHeight,i=n.strideWidth,s=n.dilationDepth,u=n.dilationHeight,f=n.dilationWidth,C=n.filterDepth,k=n.filterHeight,L=n.filterWidth,Y=4*Math.floor(n.inChannels/4),ne=n.inChannels%4;this.userCode=`
|
|
|
const ivec3 strides = ivec3(`+o+", "+a+", "+i+`);
|
|
|
const ivec3 pads = ivec3(`+r+", "+e+", "+t+`);
|
|
|
|
|
|
void main() {
|
|
|
ivec5 coords = getOutputCoords();
|
|
|
int batch = coords.x;
|
|
|
int d2 = coords.u;
|
|
|
|
|
|
ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;
|
|
|
int xFCorner = xFRCCorner.x;
|
|
|
int xRCorner = xFRCCorner.y;
|
|
|
int xCCorner = xFRCCorner.z;
|
|
|
|
|
|
// Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get
|
|
|
// y(yF, yR, yC, d2). ? = to be determined. : = across all
|
|
|
// values in that axis.
|
|
|
float dotProd = 0.0;
|
|
|
for (int wF = 0; wF < `+C+`; wF++) {
|
|
|
int xF = xFCorner + wF * `+s+`;
|
|
|
|
|
|
if (xF < 0 || xF >= `+n.inDepth+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int wR = 0; wR < `+k+`; wR++) {
|
|
|
int xR = xRCorner + wR * `+u+`;
|
|
|
|
|
|
if (xR < 0 || xR >= `+n.inHeight+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int wC = 0; wC < `+L+`; wC++) {
|
|
|
int xC = xCCorner + wC * `+f+`;
|
|
|
|
|
|
if (xC < 0 || xC >= `+n.inWidth+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int d1 = 0; d1 < `+Y+`; 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 (`+(ne===1)+`) {
|
|
|
dotProd +=
|
|
|
getX(batch, xF, xR, xC, `+Y+`) *
|
|
|
getW(wF, wR, wC, `+Y+`, d2);
|
|
|
} else if (`+(ne===2)+`) {
|
|
|
vec2 xValues = vec2(
|
|
|
getX(batch, xF, xR, xC, `+Y+`),
|
|
|
getX(batch, xF, xR, xC, `+Y+` + 1)
|
|
|
);
|
|
|
vec2 wValues = vec2(
|
|
|
getW(wF, wR, wC, `+Y+`, d2),
|
|
|
getW(wF, wR, wC, `+Y+` + 1, d2)
|
|
|
);
|
|
|
dotProd += dot(xValues, wValues);
|
|
|
} else if (`+(ne===3)+`) {
|
|
|
vec3 xValues = vec3(
|
|
|
getX(batch, xF, xR, xC, `+Y+`),
|
|
|
getX(batch, xF, xR, xC, `+Y+` + 1),
|
|
|
getX(batch, xF, xR, xC, `+Y+` + 2)
|
|
|
);
|
|
|
vec3 wValues = vec3(
|
|
|
getW(wF, wR, wC, `+Y+`, d2),
|
|
|
getW(wF, wR, wC, `+Y+` + 1, d2),
|
|
|
getW(wF, wR, wC, `+Y+` + 2, d2)
|
|
|
);
|
|
|
dotProd += dot(xValues, wValues);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
setOutput(dotProd);
|
|
|
}
|
|
|
`},gr=function(n,r,e,t){r===void 0&&(r=!1),e===void 0&&(e=null),t===void 0&&(t=!1),this.variableNames=["x","W"],this.outputShape=n.outShape;var o=n.inHeight,a=n.inWidth,i=n.padInfo.top,s=n.padInfo.left,u=n.strideHeight,f=n.strideWidth,C=n.dilationHeight,k=n.dilationWidth,L=n.filterHeight,Y=n.filterWidth,ne=n.outChannels/n.inChannels,ce="",se="";e&&(ce=t?`float activation(float a) {
|
|
|
float b = getPreluActivationWeightsAtOutCoords();
|
|
|
`+e+`
|
|
|
}`:`
|
|
|
float activation(float x) {
|
|
|
`+e+`
|
|
|
}
|
|
|
`,se="result = activation(result);");var le=r?"result += getBiasAtOutCoords();":"";r&&this.variableNames.push("bias"),t&&this.variableNames.push("preluActivationWeights"),this.userCode=`
|
|
|
`+ce+`
|
|
|
|
|
|
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 / `+ne+`;
|
|
|
int q = d2 - d1 * `+ne+`;
|
|
|
|
|
|
int xRCorner = xRCCorner.x;
|
|
|
int xCCorner = xRCCorner.y;
|
|
|
|
|
|
// Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).
|
|
|
// ? = to be determined. : = across all values in that axis.
|
|
|
float dotProd = 0.0;
|
|
|
// TO DO(dsmilkov): Flatten the two for loops and vec4 the operations.
|
|
|
for (int wR = 0; wR < `+L+`; wR++) {
|
|
|
int xR = xRCorner + wR * `+C+`;
|
|
|
|
|
|
if (xR < 0 || xR >= `+o+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int wC = 0; wC < `+Y+`; wC++) {
|
|
|
int xC = xCCorner + wC * `+k+`;
|
|
|
|
|
|
if (xC < 0 || xC >= `+a+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
float xVal = getX(batch, xR, xC, d1);
|
|
|
float wVal = getW(wR, wC, d1, q);
|
|
|
dotProd += xVal * wVal;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
float result = dotProd;
|
|
|
`+le+`
|
|
|
`+se+`
|
|
|
setOutput(result);
|
|
|
}
|
|
|
`},cn=function(n,r,e,t){r===void 0&&(r=!1),e===void 0&&(e=null),t===void 0&&(t=!1),this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n.outShape;for(var o=n.inHeight,a=n.inWidth,i=n.padInfo.top,s=n.padInfo.left,u=n.strideHeight,f=n.strideWidth,C=n.dilationHeight,k=n.dilationWidth,L=n.filterHeight,Y=n.filterWidth,ne=Y,ce="int xR; int xC; int xCOffset;",se=0;se<L;se++)for(var le=0;le<Y;le++)ce+=`
|
|
|
vec4 xTexelR`+se+"C"+2*le+` = vec4(0.);
|
|
|
vec4 wR`+se+"C"+le+` = vec4(0.);
|
|
|
vec4 xR`+se+"C"+le+" = vec4(0.);";for(se=0;se<L;se++)for(var xe=0;xe<ne;xe++){if(ce+=`
|
|
|
xR = xRCorner + `+se*C+`;
|
|
|
xC = xCCorner + `+(le=2*xe)*k+`;
|
|
|
`,f===1){if(le<Y&&(ce+=s%2==1?`
|
|
|
xCOffset = xC + 1;
|
|
|
if(xR >= 0 && xR < `+o+" && xCOffset >= 0 && xCOffset < "+a+`) {
|
|
|
xTexelR`+se+"C"+le+` = getX(batch, xR, xCOffset, d1);
|
|
|
|
|
|
// Need to manually clear unused channels in case
|
|
|
// we're reading from recycled texture.
|
|
|
if(xCOffset + 1 >= `+a+`) {
|
|
|
xTexelR`+se+"C"+le+`.zw = vec2(0.);
|
|
|
}
|
|
|
} else {
|
|
|
xTexelR`+se+"C"+le+` = vec4(0.);
|
|
|
}
|
|
|
|
|
|
xCOffset = xC + 1 - 2;
|
|
|
if(xR >= 0 && xR < `+o+" && xCOffset >= 0 && xCOffset < "+a+`) {
|
|
|
vec4 previous = getX(batch, xR, xCOffset, d1);
|
|
|
|
|
|
// Need to manually clear unused channels in case
|
|
|
// we're reading from recycled texture.
|
|
|
if(xCOffset + 1 >= `+a+`) {
|
|
|
previous.zw = vec2(0.);
|
|
|
}
|
|
|
|
|
|
xR`+se+"C"+le+" = vec4(previous.zw, xTexelR"+se+"C"+le+`.xy);
|
|
|
} else {
|
|
|
xR`+se+"C"+le+" = vec4(0, 0, xTexelR"+se+"C"+le+`.xy);
|
|
|
}
|
|
|
`:`
|
|
|
if(xR >= 0 && xR < `+o+" && xC >= 0 && xC < "+a+`) {
|
|
|
xTexelR`+se+"C"+le+` = getX(batch, xR, xC, d1);
|
|
|
} else {
|
|
|
xTexelR`+se+"C"+le+` = vec4(0.);
|
|
|
}
|
|
|
|
|
|
xR`+se+"C"+le+" = xTexelR"+se+"C"+le+`;
|
|
|
`,le+1<Y)){var Ee=s%2==0?ee(k):k;k%2==0&&s%2==1||k%2!=0&&s%2!=1?(ce+=`
|
|
|
xCOffset = xC + `+s%2+" + "+Ee+`;
|
|
|
|
|
|
if(xR >= 0 && xR < `+o+` &&
|
|
|
xCOffset >= 0 && xCOffset < `+a+`) {
|
|
|
xTexelR`+se+"C"+(le+2)+` = getX(batch, xR, xCOffset, d1);
|
|
|
}
|
|
|
`,k>1&&(ce+=`
|
|
|
xCOffset -= 2;
|
|
|
if(xR >= 0 && xR < `+o+` &&
|
|
|
xCOffset >= 0 && xCOffset < `+a+`) {
|
|
|
xTexelR`+se+"C"+le+` = getX(batch, xR, xCOffset, d1);
|
|
|
} else {
|
|
|
xTexelR`+se+"C"+le+` = vec4(0.);
|
|
|
}
|
|
|
`),ce+=`
|
|
|
xR`+se+"C"+(le+1)+` = vec4(
|
|
|
xTexelR`+se+"C"+le+".zw, xTexelR"+se+"C"+(le+2)+`.xy);
|
|
|
`):ce+=`
|
|
|
xCOffset = xC + `+Ee+`;
|
|
|
|
|
|
if(xR >= 0 && xR < `+o+` &&
|
|
|
xCOffset >= 0 && xCOffset < `+a+`) {
|
|
|
xTexelR`+se+"C"+(le+2)+` = getX(batch, xR, xCOffset, d1);
|
|
|
}
|
|
|
|
|
|
xR`+se+"C"+(le+1)+" = xTexelR"+se+"C"+(le+2)+`;
|
|
|
`}}else le<Y&&(ce+=`
|
|
|
if(xR >= 0 && xR < `+o+`) {
|
|
|
`,s%2==1?(ce+=`
|
|
|
xCOffset = xC + 1 - `+f+`;
|
|
|
if(xCOffset >= 0 && xCOffset < `+a+`) {
|
|
|
xTexelR`+se+"C"+le+` = getX(batch, xR, xCOffset, d1);
|
|
|
} else {
|
|
|
xTexelR`+se+"C"+le+` = vec4(0.);
|
|
|
}
|
|
|
|
|
|
if(xC + 1 >= 0 && xC + 1 < `+a+`) {
|
|
|
xTexelR`+se+"C"+(le+2)+` = getX(batch, xR, xC + 1, d1);
|
|
|
} else {
|
|
|
xTexelR`+se+"C"+(le+2)+` = vec4(0.);
|
|
|
}
|
|
|
|
|
|
xR`+se+"C"+le+` = vec4(
|
|
|
xTexelR`+se+"C"+le+".zw, xTexelR"+se+"C"+(le+2)+`.zw);
|
|
|
`,le+1<Y&&(ce+=`
|
|
|
vec4 final = vec4(0.);
|
|
|
xCOffset = xC + 1 + `+f+`;
|
|
|
if(xCOffset >= 0 && xCOffset < `+a+`) {
|
|
|
final = getX(batch, xR, xCOffset, d1);
|
|
|
}
|
|
|
xR`+se+"C"+(le+1)+" = vec4(xTexelR"+se+"C"+(le+2)+`.xy, final.xy);
|
|
|
`)):(ce+=`
|
|
|
if(xC >= 0 && xC < `+a+`) {
|
|
|
xTexelR`+se+"C"+le+` = getX(batch, xR, xC, d1);
|
|
|
} else {
|
|
|
xTexelR`+se+"C"+le+` = vec4(0.);
|
|
|
}
|
|
|
|
|
|
xCOffset = xC + `+f+`;
|
|
|
if(xCOffset >= 0 && xCOffset < `+a+`) {
|
|
|
xTexelR`+se+"C"+(le+2)+` = getX(batch, xR, xCOffset, d1);
|
|
|
} else {
|
|
|
xTexelR`+se+"C"+(le+2)+` = vec4(0.);
|
|
|
}
|
|
|
|
|
|
xR`+se+"C"+le+` = vec4(
|
|
|
xTexelR`+se+"C"+le+".xy, xTexelR"+se+"C"+(le+2)+`.xy);
|
|
|
`,le+1<Y&&(ce+=`
|
|
|
xR`+se+"C"+(le+1)+` = vec4(
|
|
|
xTexelR`+se+"C"+le+".zw, xTexelR"+se+"C"+(le+2)+`.zw);
|
|
|
`)),ce+="}");le<Y&&(ce+=`
|
|
|
vec4 wTexelR`+se+"C"+le+" = getW("+se+", "+le+`, d1, q);
|
|
|
wR`+se+"C"+le+" = vec4(wTexelR"+se+"C"+le+".xz, wTexelR"+se+"C"+le+`.xz);
|
|
|
`,le+1<Y&&(ce+=`
|
|
|
vec4 wTexelR`+se+"C"+(le+1)+" = getW("+se+", "+(le+1)+`, d1, q);
|
|
|
wR`+se+"C"+(le+1)+` =
|
|
|
vec4(wTexelR`+se+"C"+(le+1)+".xz, wTexelR"+se+"C"+(le+1)+".xz);"))}for(se=0;se<L;se++)for(le=0;le<Y;le++)ce+="dotProd += xR"+se+"C"+le+" * wR"+se+"C"+le+";";var Ce="",Te="";e&&(Ce=t?`vec4 activation(vec4 a) {
|
|
|
vec4 b = getPreluActivationWeightsAtOutCoords();
|
|
|
`+e+`
|
|
|
}`:`vec4 activation(vec4 x) {
|
|
|
`+e+`
|
|
|
}`,Te="result = activation(result);");var Me=r?"result += getBiasAtOutCoords();":"";r&&this.variableNames.push("bias"),t&&this.variableNames.push("preluActivationWeights"),this.userCode=`
|
|
|
`+Ce+`
|
|
|
|
|
|
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.);
|
|
|
|
|
|
`+ce+`
|
|
|
|
|
|
vec4 result = dotProd;
|
|
|
`+Me+`
|
|
|
`+Te+`
|
|
|
setOutput(result);
|
|
|
}
|
|
|
`},qt=function(n,r,e,t,o){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];var a=n[0],i=n[1],s=n[2],u=n[3],f=r[0],C=e[0],k=e[1];this.outputShape=[f,C,k,u];var L=t==="bilinear"?1:0,Y=[i-1+".0",s-1+".0"],ne=Y[0],ce=Y[1],se=C>1?[""+(i-1)/(C-1),"(y2-y1) * height_ratio","y1*"+ne+" + float(y)*(height_scale)"]:["0.0","0.0","0.5 * (y1+y2) * "+ne],le=se[0],xe=se[1],Ee=se[2],Ce=k>1?[""+(s-1)/(k-1),"(x2-x1) * width_ratio","x1*"+ce+" + float(x)*(width_scale)"]:["0.0","0.0","0.5 * (x1+x2) * "+ce],Te=Ce[0],Me=Ce[1],He=Ce[2];this.userCode=`
|
|
|
const float height_ratio = float(`+le+`);
|
|
|
const float width_ratio = float(`+Te+`);
|
|
|
void main() {
|
|
|
ivec4 coords = getOutputCoords();
|
|
|
int b = coords[0];
|
|
|
int y = coords[1];
|
|
|
int x = coords[2];
|
|
|
int d = coords[3];
|
|
|
|
|
|
// get box vals
|
|
|
float y1 = getBoxes(b,0);
|
|
|
float x1 = getBoxes(b,1);
|
|
|
float y2 = getBoxes(b,2);
|
|
|
float x2 = getBoxes(b,3);
|
|
|
|
|
|
// get image in batch index
|
|
|
int bInd = round(getBoxInd(b));
|
|
|
if(bInd < 0 || bInd >= `+a+`) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
float height_scale = `+xe+`;
|
|
|
float width_scale = `+Me+`;
|
|
|
|
|
|
float in_y = `+Ee+`;
|
|
|
if( in_y < 0.0 || in_y > `+ne+` ) {
|
|
|
setOutput(float(`+o+`));
|
|
|
return;
|
|
|
}
|
|
|
float in_x = `+He+`;
|
|
|
if( in_x < 0.0 || in_x > `+ce+` ) {
|
|
|
setOutput(float(`+o+`));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
vec2 sourceFracIndexCR = vec2(in_x,in_y);
|
|
|
if(`+L+` == 1) {
|
|
|
// Compute the four integer indices.
|
|
|
ivec2 sourceFloorCR = ivec2(sourceFracIndexCR);
|
|
|
ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR));
|
|
|
|
|
|
float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d);
|
|
|
float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d);
|
|
|
float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d);
|
|
|
float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d);
|
|
|
|
|
|
vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR);
|
|
|
|
|
|
float top = topLeft + (topRight - topLeft) * fracCR.x;
|
|
|
float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;
|
|
|
float newValue = top + (bottom - top) * fracCR.y;
|
|
|
setOutput(newValue);
|
|
|
} else {
|
|
|
// Compute the coordinators of nearest neighbor point.
|
|
|
ivec2 sourceNearestCR = ivec2(floor(
|
|
|
sourceFracIndexCR + vec2(0.5,0.5)));
|
|
|
float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d);
|
|
|
setOutput(newValue);
|
|
|
}
|
|
|
}
|
|
|
`},Qt=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 = `+Kt(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;
|
|
|
}
|
|
|
`+Kt(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 Kt(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 ur=function(n){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=Po.DENSE;var r=Or(n),e=Yr();this.outputShape=n,this.userCode=`
|
|
|
ivec3 outCoordsFromFlatIndex(int index) {
|
|
|
`+O(["r","c","d"],n)+`
|
|
|
return ivec3(r, c, d);
|
|
|
}
|
|
|
|
|
|
void main() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+r[0]+", "+r[1]+`));
|
|
|
int index = 4 * (resTexRC.x * `+r[1]+` + resTexRC.y);
|
|
|
|
|
|
vec4 result = vec4(0.);
|
|
|
|
|
|
for (int i=0; i<4; i++) {
|
|
|
int flatIndex = index + i;
|
|
|
ivec3 rc = outCoordsFromFlatIndex(flatIndex);
|
|
|
result[i] = getA(rc.x, rc.y, rc.z);
|
|
|
}
|
|
|
|
|
|
`+e.output+` = result;
|
|
|
}
|
|
|
`},Zt=function(n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=Po.DENSE;var r=Or(n),e=Yr();this.outputShape=n,this.userCode=`
|
|
|
ivec3 outCoordsFromFlatIndex(int index) {
|
|
|
`+O(["r","c","d"],n)+`
|
|
|
return ivec3(r, c, d);
|
|
|
}
|
|
|
|
|
|
void main() {
|
|
|
ivec2 resTexRC = ivec2(resultUV.yx *
|
|
|
vec2(`+r[0]+", "+r[1]+`));
|
|
|
int index = 4 * (resTexRC.x * `+r[1]+` + resTexRC.y);
|
|
|
|
|
|
vec4 result = vec4(0.);
|
|
|
|
|
|
for (int i=0; i<4; i++) {
|
|
|
int flatIndex = index + i;
|
|
|
ivec3 rc = outCoordsFromFlatIndex(flatIndex);
|
|
|
result[i] = getChannel(getA(rc.x, rc.y, rc.z), vec2(rc.y, rc.z));
|
|
|
}
|
|
|
|
|
|
`+e.output+` = result;
|
|
|
}
|
|
|
`},sr=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}(),wr=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);
|
|
|
}
|
|
|
`},to=function(n){this.variableNames=["A"],this.outTexUsage=Wr.DOWNLOAD;var r=Yr();this.outputShape=n,this.userCode=`
|
|
|
`+A+`
|
|
|
|
|
|
void main() {
|
|
|
float x = getAAtOutCoords();
|
|
|
`+r.output+` = encode_float(x);
|
|
|
}
|
|
|
`},Wn=function(n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=Wr.DOWNLOAD;var r=Yr();this.outputShape=n,this.userCode=`
|
|
|
`+A+`
|
|
|
|
|
|
void main() {
|
|
|
ivec3 coords = getOutputCoords();
|
|
|
float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z));
|
|
|
`+r.output+` = encode_float(x);
|
|
|
}
|
|
|
`},Jo=function(n,r,e){e===void 0&&(e=!1),this.variableNames=["A"];var t=Yr(),o=r[0],a=r[1];this.outputShape=n;var i="result";e&&(i="floor(result * 255. + 0.5)"),this.userCode=`
|
|
|
`+w(n)+`
|
|
|
|
|
|
void main() {
|
|
|
ivec3 coords = getOutputCoords();
|
|
|
|
|
|
int flatIndex = getFlatIndex(coords);
|
|
|
int offset = imod(flatIndex, 4);
|
|
|
|
|
|
flatIndex = idiv(flatIndex, 4, 1.);
|
|
|
|
|
|
int r = flatIndex / `+a+`;
|
|
|
int c = imod(flatIndex, `+a+`);
|
|
|
vec2 uv = (vec2(c, r) + halfCR) / vec2(`+a+".0, "+o+`.0);
|
|
|
vec4 values = `+t.texture2D+`(A, uv);
|
|
|
|
|
|
float result;
|
|
|
|
|
|
if(offset == 0) {
|
|
|
result = values[0];
|
|
|
} else if(offset == 1) {
|
|
|
result = values[1];
|
|
|
} else if(offset == 2) {
|
|
|
result = values[2];
|
|
|
} else {
|
|
|
result = values[3];
|
|
|
}
|
|
|
|
|
|
`+t.output+" = vec4("+i+`, 0., 0., 0.);
|
|
|
}
|
|
|
`},Br=function(n,r,e){e===void 0&&(e=!1),this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;var t=Yr(),o=r[0],a=r[1];this.outputShape=n;var i="",s="result";e&&(s="floor(result * 255. + 0.5)");for(var u=0;u<=1;u++)for(var f=0;f<=1;f++){var C=2*u+f;i+=`
|
|
|
localCoords = coords;
|
|
|
if(localCoords[2] + `+f+" < "+n[2]+`) {
|
|
|
localCoords[2] += `+f+`;
|
|
|
if(localCoords[1] + `+u+" < "+n[1]+`) {
|
|
|
localCoords[1] += `+u+`;
|
|
|
|
|
|
flatIndex = getFlatIndex(localCoords);
|
|
|
offset = imod(flatIndex, 4);
|
|
|
|
|
|
flatIndex = idiv(flatIndex, 4, 1.);
|
|
|
|
|
|
r = flatIndex / `+a+`;
|
|
|
c = imod(flatIndex, `+a+`);
|
|
|
uv = (vec2(c, r) + halfCR) / vec2(`+a+".0, "+o+`.0);
|
|
|
values = `+t.texture2D+`(A, uv);
|
|
|
|
|
|
if(offset == 0) {
|
|
|
result[`+C+`] = values[0];
|
|
|
} else if(offset == 1) {
|
|
|
result[`+C+`] = values[1];
|
|
|
} else if(offset == 2) {
|
|
|
result[`+C+`] = values[2];
|
|
|
} else {
|
|
|
result[`+C+`] = values[3];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
`}this.userCode=`
|
|
|
`+w(n)+`
|
|
|
|
|
|
void main() {
|
|
|
ivec3 coords = getOutputCoords();
|
|
|
|
|
|
vec4 result = vec4(0.);
|
|
|
int flatIndex, r, c, offset;
|
|
|
ivec3 localCoords;
|
|
|
vec2 uv;
|
|
|
vec4 values;
|
|
|
|
|
|
`+i+`
|
|
|
|
|
|
`+t.output+" = "+s+`;
|
|
|
}
|
|
|
`},Na="return real * expR - imag * expI;",gi="return real * expI + imag * expR;",Da=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]));
|
|
|
}
|
|
|
`},yi=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}(),bi=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"],C=[],k=0;k<i.length;k++)k===s?C.push("int(getIndices("+f[k]+"))"):C.push(""+f[k]);return C.join()}(n,e);this.userCode=`
|
|
|
void main() {
|
|
|
`+o+` resRC = getOutputCoords();
|
|
|
setOutput(getA(`+a+`));
|
|
|
}
|
|
|
`},yr=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 ka(n,r){var e=Yr();return _s(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 xi(n,r){return aa(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 wi(n,r){return Ja(n,r,new Uint16Array([0,1,2,2,1,3]))}function Ma(n,r,e,t,o,a,i){sa(e,t);var s=ia(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 Ao(n,r,e,t,o){var a=Kn(e,t);return Ma(n,r,a[0],a[1],o.internalFormatFloat,o.textureFormatFloat,n.FLOAT)}function qo(n,r,e,t,o){var a=Kn(e,t);return Ma(n,r,a[0],a[1],o.internalFormatHalfFloat,o.textureFormatFloat,o.textureTypeHalfFloat)}function pc(n,r,e,t,o){var a=Kn(e,t);return Ma(n,r,a[0],a[1],n.RGBA,n.RGBA,n.UNSIGNED_BYTE)}function mc(n,r,e,t,o){var a=Yn(e,t);return Ma(n,r,a[0],a[1],o.internalFormatPackedFloat,n.RGBA,n.FLOAT)}function vc(n,r,e,t,o){var a=Yn(e,t);return Ma(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)}),dn(n,r,e,"clipSpacePos",t,3,20,0)&&dn(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=Kn(e,t),i=a[0],s=a[1],u=new Uint8Array(e*t*4);return St(n,r,function(){return n.readPixels(0,0,i,s,o.downloadTextureFormat,n.UNSIGNED_BYTE,u)}),new Float32Array(u.buffer)}function _c(n,r,e,t,o,a,i,s){var u=n,f=new Float32Array(function(C,k){var L=Yn(C,k);return L[0]*L[1]*4}(a,i));return u.bindBuffer(u.PIXEL_PACK_BUFFER,r),u.getBufferSubData(u.PIXEL_PACK_BUFFER,0,f),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),f}function Cc(n,r,e,t){var o=new Float32Array(e*t*4);return St(n,r,function(){return n.readPixels(0,0,t,e,n.RGBA,n.FLOAT,o)}),o}var ld=Object.freeze({createVertexShader:ka,createVertexBuffer:xi,createIndexBuffer:wi,createFloat32MatrixTexture:Ao,createFloat16MatrixTexture:qo,createUnsignedBytesMatrixTexture:pc,createPackedMatrixTexture:mc,createFloat16PackedMatrixTexture:vc,bindVertexProgramAttributeStreams:gc,uploadDenseMatrixToTexture:yc,uploadPixelDataToTexture:bc,createBufferFromOutputTexture:xc,downloadFloat32MatrixFromBuffer:wc,downloadByteEncodedFloatMatrixFromOutputTexture:Ec,downloadPackedMatrixFromBuffer:_c,downloadMatrixFromPackedOutputTexture:Cc}),Tc=function(){function n(r){this.outputTexture=null,this.program=null,this.disposed=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[];var e=p().getNumber("WEBGL_VERSION");r!=null?(this.gl=r,Ya(e,r)):this.gl=gn(e);var t="WEBGL_color_buffer_float";if(p().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(p().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");if(this.colorBufferFloatExtension=this.gl.getExtension(t),Jr(this.gl,"EXT_color_buffer_half_float"))this.colorBufferHalfFloatExtension=Lo(this.gl,this.debug,"EXT_color_buffer_half_float");else if(p().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.")}else if(t="EXT_color_buffer_float",Jr(this.gl,t))this.colorBufferFloatExtension=this.gl.getExtension(t);else{if(!Jr(this.gl,"EXT_color_buffer_half_float"))throw new Error("GL context does not support color renderable floats");this.colorBufferHalfFloatExtension=this.gl.getExtension("EXT_color_buffer_half_float")}this.vertexBuffer=xi(this.gl,this.debug),this.indexBuffer=wi(this.gl,this.debug),this.framebuffer=On(this.gl,this.debug),this.textureConfig=Fo(this.gl,this.textureHalfFloatExtension)}return Object.defineProperty(n.prototype,"debug",{get:function(){return p().getBool("DEBUG")},enumerable:!0,configurable:!0}),n.prototype.dispose=function(){var r=this;if(!this.disposed){this.program!=null&&console.warn("Disposing a GPGPUContext that still has a bound WebGLProgram. This is probably a resource leak, delete the program with GPGPUContext.deleteProgram before disposing."),this.outputTexture!=null&&console.warn("Disposing a GPGPUContext that still has a bound output matrix texture. This is probably a resource leak, delete the output matrix texture with GPGPUContext.deleteMatrixTexture before disposing.");var e=this.gl;St(e,this.debug,function(){return e.finish()}),St(e,this.debug,function(){return e.bindFramebuffer(e.FRAMEBUFFER,null)}),St(e,this.debug,function(){return e.deleteFramebuffer(r.framebuffer)}),St(e,this.debug,function(){return e.bindBuffer(e.ARRAY_BUFFER,null)}),St(e,this.debug,function(){return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)}),St(e,this.debug,function(){return e.deleteBuffer(r.indexBuffer)}),this.disposed=!0}},n.prototype.createFloat32MatrixTexture=function(r,e){return this.throwIfDisposed(),Ao(this.gl,this.debug,r,e,this.textureConfig)},n.prototype.createFloat16MatrixTexture=function(r,e){return this.throwIfDisposed(),qo(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&&(ca(this.gl,this.debug,this.framebuffer),this.outputTexture=null),St(this.gl,this.debug,function(){return e.gl.deleteTexture(r)})},n.prototype.downloadByteEncodedFloatMatrixFromOutputTexture=function(r,e,t){var o=this;return this.downloadMatrixDriver(r,function(){return Ec(o.gl,o.debug,e,t,o.textureConfig)})},n.prototype.downloadPackedMatrixFromBuffer=function(r,e,t,o,a,i){return _c(this.gl,r,0,0,0,a,i,this.textureConfig)},n.prototype.downloadFloat32MatrixFromBuffer=function(r,e){return wc(this.gl,r,e)},n.prototype.createBufferFromTexture=function(r,e,t){this.bindTextureToFrameBuffer(r);var o=xc(this.gl,this.debug,e,t,this.textureConfig);return this.unbindTextureToFrameBuffer(),o},n.prototype.createAndWaitForFence=function(){var r=this.createFence(this.gl);return this.pollFence(r)},n.prototype.createFence=function(r){var e,t,o=this;if(p().getBool("WEBGL_FENCE_API_ENABLED")){var a=r,i=a.fenceSync(a.SYNC_GPU_COMMANDS_COMPLETE,0);r.flush(),t=function(){var s=a.clientWaitSync(i,0,0);return s===a.ALREADY_SIGNALED||s===a.CONDITION_SATISFIED},e=i}else p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(e=this.beginQuery(),this.endQuery(),t=function(){return o.isQueryAvailable(e,p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}):t=function(){return!0};return{query:e,isFencePassed:t}},n.prototype.downloadMatrixFromPackedTexture=function(r,e,t){var o=this;return this.downloadMatrixDriver(r,function(){return Cc(o.gl,o.debug,e,t)})},n.prototype.createProgram=function(r){this.throwIfDisposed();var e=this.gl,t=yn(e,this.debug,r),o=ka(e,this.debug),a=on(e,this.debug);return St(e,this.debug,function(){return e.attachShader(a,o)}),St(e,this.debug,function(){return e.attachShader(a,t)}),bn(e,this.debug,a),this.debug&&$n(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&&$n(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?Ri(this.gl,this.debug,r,e):Qa(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(),Za(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=Yn(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&&$n(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,p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension},n.prototype.getQueryTimerExtensionWebGL2=function(){return this.getQueryTimerExtension()},n.prototype.getQueryTimerExtensionWebGL1=function(){return this.getQueryTimerExtension()},n.prototype.beginQuery=function(){if(p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){var r=this.gl,e=this.getQueryTimerExtensionWebGL2(),t=r.createQuery();return r.beginQuery(e.TIME_ELAPSED_EXT,t),t}var o=this.getQueryTimerExtensionWebGL1(),a=o.createQueryEXT();return o.beginQueryEXT(o.TIME_ELAPSED_EXT,a),a},n.prototype.endQuery=function(){if(p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")!==2){var r=this.getQueryTimerExtensionWebGL1();r.endQueryEXT(r.TIME_ELAPSED_EXT)}else{var e=this.gl,t=this.getQueryTimerExtensionWebGL2();e.endQuery(t.TIME_ELAPSED_EXT)}},n.prototype.waitForQueryAndGetTime=function(r){return E(this,void 0,void 0,function(){var e=this;return g(this,function(t){switch(t.label){case 0:return[4,H(function(){return e.disposed||e.isQueryAvailable(r,p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))})];case 1:return t.sent(),[2,this.getQueryTime(r,p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))]}})})},n.prototype.getQueryTime=function(r,e){if(e===0)return null;if(e===2){var t=this.gl;return t.getQueryParameter(r,t.QUERY_RESULT)/1e6}var o=this.getQueryTimerExtensionWebGL1();return o.getQueryObjectEXT(r,o.QUERY_RESULT_EXT)/1e6},n.prototype.isQueryAvailable=function(r,e){if(e===0)return!0;if(e===2){var t=this.gl,o=this.getQueryTimerExtensionWebGL2(),a=t.getQueryParameter(r,t.QUERY_RESULT_AVAILABLE);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(o.GPU_DISJOINT_EXT)),a&&!this.disjoint}return a=(o=this.getQueryTimerExtensionWebGL1()).getQueryObjectEXT(r,o.QUERY_RESULT_AVAILABLE_EXT),this.disjoint==null&&(this.disjoint=this.gl.getParameter(o.GPU_DISJOINT_EXT)),a&&!this.disjoint},n.prototype.pollFence=function(r){var e=this;return new Promise(function(t){e.addItemToPoll(function(){return r.isFencePassed()},function(){return t()})})},n.prototype.pollItems=function(){for(var r=function(t){for(var o=0;o<t.length&&t[o]();++o);return o-1}(this.itemsToPoll.map(function(t){return t.isDoneFn})),e=0;e<=r;++e)(0,this.itemsToPoll[e].resolveFn)();this.itemsToPoll=this.itemsToPoll.slice(r+1)},n.prototype.addItemToPoll=function(r,e){var t=this;this.itemsToPoll.push({isDoneFn:r,resolveFn:e}),this.itemsToPoll.length>1||H(function(){return t.pollItems(),t.itemsToPoll.length===0})},n.prototype.bindTextureToFrameBuffer=function(r){this.throwIfDisposed(),ua(this.gl,this.debug,r,this.framebuffer),this.debug&&$r(this.gl)},n.prototype.unbindTextureToFrameBuffer=function(){this.outputTexture!=null?(ua(this.gl,this.debug,this.outputTexture,this.framebuffer),this.debug&&$r(this.gl)):ca(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;ua(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(!we(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(!we(s,u))throw Error("Binary was compiled with different texture shapes than the current args. Shape "+s+" and "+u+" must match")}})}var dd=function(n,r,e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n;for(var t=e.filterWidth,o=e.inChannels,a=e.strideWidth,i=e.strideHeight,s=e.padInfo,u=e.outWidth,f=e.dilationWidth,C=e.dilationHeight,k=e.dataFormat,L=s.left,Y=s.top,ne=o*t,ce=Yr(),se=k==="channelsLast",le=se?0:1,xe=se?1:2,Ee="",Ce=0;Ce<=1;Ce++)for(var Te=0;Te<=1;Te++)Ee+=`
|
|
|
blockIndex = rc.y + `+Te+`;
|
|
|
pos = rc.x + `+Ce+`;
|
|
|
|
|
|
if(blockIndex < `+n[1]+" && pos < "+n[0]+`) {
|
|
|
offsetY = int(blockIndex / (`+u+")) * "+i+" - "+Y+`;
|
|
|
d0 = offsetY + `+C+" * (pos / "+ne+`);
|
|
|
|
|
|
if(d0 < `+r[le]+` && d0 >= 0) {
|
|
|
|
|
|
offsetX = int(mod(float(blockIndex), `+u+".) * "+a+". - "+L+`.);
|
|
|
d1 = offsetX + `+f+" * (int(mod(float(pos), "+ne+".) / "+o+`.));
|
|
|
|
|
|
if(d1 < `+r[xe]+` && d1 >= 0) {
|
|
|
|
|
|
ch = int(mod(float(pos), `+o+`.));
|
|
|
|
|
|
if (`+se+`) {
|
|
|
innerDims = vec2(d1, ch);
|
|
|
result[`+(2*Ce+Te)+`] = getChannel(
|
|
|
getA(d0, int(innerDims.x),
|
|
|
int(innerDims.y)), innerDims);
|
|
|
} else {
|
|
|
innerDims = vec2(d0, d1);
|
|
|
result[`+(2*Ce+Te)+`] = 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;
|
|
|
|
|
|
`+Ee+`
|
|
|
|
|
|
`+ce.output+` = result;
|
|
|
}
|
|
|
`},fd=function(n,r,e,t,o){this.variableNames=["x"],this.outputShape=[];var a,i=r,s=n[3]-1;this.outputShape=n;var u="float("+e+") + float("+t+") * sum";a=o===.5?"inversesqrt("+u+")":o===1?"1.0/("+u+")":"exp(log("+u+") * float(-"+o+"));",this.userCode=`
|
|
|
void main() {
|
|
|
ivec4 coords = getOutputCoords();
|
|
|
int b = coords[0];
|
|
|
int r = coords[1];
|
|
|
int c = coords[2];
|
|
|
int d = coords[3];
|
|
|
float x = getX(b, r, c, d);
|
|
|
float sum = 0.0;
|
|
|
for (int j = -`+i+"; j <= "+i+`; j++) {
|
|
|
int idx = d + j;
|
|
|
if (idx >= 0 && idx <= `+s+`) {
|
|
|
float z = getX(b, r, c, idx);
|
|
|
sum += z * z;
|
|
|
}
|
|
|
}
|
|
|
float val = x * `+a+`;
|
|
|
setOutput(val);
|
|
|
}
|
|
|
`},hd=function(n,r,e,t,o){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=n,this.depth=n[3],this.depthRadius=r,this.bias=e,this.alpha=t,this.beta=o,this.userCode=`
|
|
|
void main() {
|
|
|
ivec4 coords = getOutputCoords();
|
|
|
int b = coords[0];
|
|
|
int r = coords[1];
|
|
|
int c = coords[2];
|
|
|
|
|
|
float result = 0.0;
|
|
|
for (int d = 0; d < `+this.depth+`; ++d) {
|
|
|
int depthBegin = int(max(0.0, float(d - `+r+`)));
|
|
|
int depthEnd = int(min(float(`+this.depth+`),
|
|
|
float(d + `+r+` + 1)));
|
|
|
|
|
|
const int MIN_DEPTH_BEGIN = 0;
|
|
|
const int MAX_DEPTH_END = `+this.depth+`;
|
|
|
|
|
|
float norm = 0.0;
|
|
|
for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) {
|
|
|
if (k < depthBegin){
|
|
|
continue;
|
|
|
}
|
|
|
else if (k >= depthBegin && k < depthEnd) {
|
|
|
norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);
|
|
|
}
|
|
|
else {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
norm = float(`+t+") * norm + float("+e+`);
|
|
|
|
|
|
for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){
|
|
|
if (k < depthBegin){
|
|
|
continue;
|
|
|
}
|
|
|
else if (k >= depthBegin && k < depthEnd){
|
|
|
float dyi = -2.0 * float(`+t+`)
|
|
|
* float(`+o+`)
|
|
|
* getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d)
|
|
|
/ norm;
|
|
|
if (k == d) {
|
|
|
dyi += pow(norm, -1.0 * `+o+`);
|
|
|
}
|
|
|
if (k == coords[3]) {
|
|
|
dyi *= getDy(b, r, c, d);
|
|
|
result += dyi;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
setOutput(result);
|
|
|
}
|
|
|
`},pd=function(n,r,e,t,o){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;var a,i=r,s=n[3]-1;this.outputShape=n;var u="float("+e+") + float("+t+") * sum";a=o===.5?"inversesqrt("+u+")":o===1?"1.0/("+u+")":"exp(log("+u+") * float(-"+o+"));",this.userCode=`
|
|
|
void main() {
|
|
|
ivec4 coords = getOutputCoords();
|
|
|
int b = coords.x;
|
|
|
int r = coords.y;
|
|
|
int c = coords.z;
|
|
|
int d = coords.w;
|
|
|
|
|
|
bool hasNextCol = d < `+this.outputShape[3]+`;
|
|
|
bool hasNextRow = c < `+this.outputShape[2]+`;
|
|
|
|
|
|
vec4 sum = vec4(0.);
|
|
|
vec4 xFragAtOutputCoords = getX(b, r, c, d);
|
|
|
|
|
|
vec4 xAtOutputCoords = vec4(
|
|
|
getChannel(xFragAtOutputCoords, vec2(c, d)),
|
|
|
hasNextCol ?
|
|
|
getChannel(xFragAtOutputCoords, vec2(c, d + 1)) : 0.0,
|
|
|
hasNextRow ?
|
|
|
getChannel(xFragAtOutputCoords , vec2(c + 1, d)) : 0.0,
|
|
|
(hasNextRow && hasNextCol) ?
|
|
|
getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0
|
|
|
);
|
|
|
|
|
|
int firstChannel = d - `+i+`;
|
|
|
vec2 cache = vec2(0.);
|
|
|
if(firstChannel >= 0){
|
|
|
vec4 firstChannelFrag = getX(b, r, c, firstChannel);
|
|
|
cache.x = getChannel(firstChannelFrag, vec2(c, firstChannel));
|
|
|
if(hasNextRow){
|
|
|
cache.y = getChannel(firstChannelFrag, vec2(c + 1, firstChannel));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
ivec2 depth = ivec2(d, d + 1);
|
|
|
for (int j = - `+i+"; j <= "+i+`; j++) {
|
|
|
ivec2 idx = depth + j;
|
|
|
bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0));
|
|
|
bvec2 belowUpperBound = lessThanEqual(idx, ivec2(`+s+`));
|
|
|
|
|
|
bool depthInRange = aboveLowerBound.x && belowUpperBound.x;
|
|
|
bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y;
|
|
|
|
|
|
if(depthInRange || depthPlusOneInRange){
|
|
|
vec4 z = vec4(0.);
|
|
|
vec4 xFragAtCurrentDepth;
|
|
|
z.xz = cache.xy;
|
|
|
if(depthPlusOneInRange && hasNextCol){
|
|
|
xFragAtCurrentDepth = idx.y != d ?
|
|
|
getX(b, r, c, idx.y) : xFragAtOutputCoords;
|
|
|
z.y = getChannel(xFragAtCurrentDepth, vec2(c, idx.y));
|
|
|
if(hasNextRow){
|
|
|
z.w = getChannel(xFragAtCurrentDepth, vec2(c + 1, idx.y));
|
|
|
}
|
|
|
}
|
|
|
cache.xy = z.yw;
|
|
|
sum += z * z;
|
|
|
}
|
|
|
}
|
|
|
vec4 result = xAtOutputCoords * `+a+`;
|
|
|
setOutput(result);
|
|
|
}
|
|
|
`},md=function(n){this.variableNames=["dy","maxPos"],this.outputShape=n.inShape;var r=n.strideHeight,e=n.strideWidth,t=n.dilationHeight,o=n.effectiveFilterHeight,a=n.effectiveFilterWidth,i=o-1-n.padInfo.top,s=a-1-n.padInfo.left,u=o*a-1;this.userCode=`
|
|
|
const ivec2 pads = ivec2(`+i+", "+s+`);
|
|
|
|
|
|
void main() {
|
|
|
ivec4 coords = getOutputCoords();
|
|
|
int b = coords[0];
|
|
|
int d = coords[3];
|
|
|
|
|
|
ivec2 dyRCCorner = coords.yz - pads;
|
|
|
int dyRCorner = dyRCCorner.x;
|
|
|
int dyCCorner = dyRCCorner.y;
|
|
|
|
|
|
// Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).
|
|
|
// ? = to be determined. : = across all values in that axis.
|
|
|
float dotProd = 0.0;
|
|
|
for (int wR = 0; wR < `+o+`;
|
|
|
wR += `+t+`) {
|
|
|
float dyR = float(dyRCorner + wR) / `+r+`.0;
|
|
|
|
|
|
if (dyR < 0.0 || dyR >= `+n.outHeight+`.0 || fract(dyR) > 0.0) {
|
|
|
continue;
|
|
|
}
|
|
|
int idyR = int(dyR);
|
|
|
|
|
|
for (int wC = 0; wC < `+a+`; wC++) {
|
|
|
float dyC = float(dyCCorner + wC) / `+e+`.0;
|
|
|
|
|
|
if (dyC < 0.0 || dyC >= `+n.outWidth+`.0 ||
|
|
|
fract(dyC) > 0.0) {
|
|
|
continue;
|
|
|
}
|
|
|
int idyC = int(dyC);
|
|
|
|
|
|
float dyValue = getDy(b, idyR, idyC, d);
|
|
|
int maxPosValue = `+u+` - int(getMaxPos(b, idyR, idyC, d));
|
|
|
|
|
|
// Get the current value, check it against the value from the
|
|
|
// position matrix.
|
|
|
int curPosValue = wR * `+a+` + wC;
|
|
|
float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);
|
|
|
|
|
|
dotProd += dyValue * mask;
|
|
|
}
|
|
|
}
|
|
|
setOutput(dotProd);
|
|
|
}
|
|
|
`},vd=function(n){this.variableNames=["dy","maxPos"],this.outputShape=n.inShape;var r=n.strideDepth,e=n.strideHeight,t=n.strideWidth,o=n.dilationDepth,a=n.dilationHeight,i=n.dilationWidth,s=n.effectiveFilterDepth,u=n.effectiveFilterHeight,f=n.effectiveFilterWidth,C=s-1-n.padInfo.front,k=u-1-n.padInfo.top,L=f-1-n.padInfo.left,Y=s*u*f-1;this.userCode=`
|
|
|
const ivec3 pads = ivec3(`+C+", "+k+", "+L+`);
|
|
|
|
|
|
void main() {
|
|
|
ivec5 coords = getOutputCoords();
|
|
|
int batch = coords.x;
|
|
|
int ch = coords.u;
|
|
|
|
|
|
ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;
|
|
|
int dyDCorner = dyCorner.x;
|
|
|
int dyRCorner = dyCorner.y;
|
|
|
int dyCCorner = dyCorner.z;
|
|
|
|
|
|
// Convolve dy(?, ?, ?, ch) with pos mask(:, :, :, d) to get
|
|
|
// dx(xD, xR, xC, ch).
|
|
|
// ? = to be determined. : = across all values in that axis.
|
|
|
float dotProd = 0.0;
|
|
|
|
|
|
for (int wD = 0; wD < `+s+`;
|
|
|
wD += `+o+`) {
|
|
|
float dyD = float(dyDCorner + wD) / `+r+`.0;
|
|
|
|
|
|
if (dyD < 0.0 || dyD >= `+n.outDepth+`.0 || fract(dyD) > 0.0) {
|
|
|
continue;
|
|
|
}
|
|
|
int idyD = int(dyD);
|
|
|
|
|
|
for (int wR = 0; wR < `+u+`;
|
|
|
wR += `+a+`) {
|
|
|
float dyR = float(dyRCorner + wR) / `+e+`.0;
|
|
|
|
|
|
if (dyR < 0.0 || dyR >= `+n.outHeight+`.0 ||
|
|
|
fract(dyR) > 0.0) {
|
|
|
continue;
|
|
|
}
|
|
|
int idyR = int(dyR);
|
|
|
|
|
|
for (int wC = 0; wC < `+f+`;
|
|
|
wC += `+i+`) {
|
|
|
float dyC = float(dyCCorner + wC) / `+t+`.0;
|
|
|
|
|
|
if (dyC < 0.0 || dyC >= `+n.outWidth+`.0 ||
|
|
|
fract(dyC) > 0.0) {
|
|
|
continue;
|
|
|
}
|
|
|
int idyC = int(dyC);
|
|
|
|
|
|
float dyValue = getDy(batch, idyD, idyR, idyC, ch);
|
|
|
int maxPosValue = `+Y+` -
|
|
|
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);
|
|
|
}
|
|
|
`},uu=function(n,r,e,t,o,a,i){e===void 0&&(e=!1),t===void 0&&(t=!1),o===void 0&&(o=!1),a===void 0&&(a=null),i===void 0&&(i=!1),this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=r;var s=e?n[1]:n[2],u=Math.ceil(s/2),f=e?"i * 2, rc.y":"rc.y, i * 2",C=t?"rc.z, i * 2":"i * 2, rc.z",k=e?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],L=t?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],Y="",ne="";a&&(Y=i?`vec4 activation(vec4 a) {
|
|
|
vec4 b = getPreluActivationWeightsAtOutCoords();
|
|
|
`+a+`
|
|
|
}`:`vec4 activation(vec4 x) {
|
|
|
`+a+`
|
|
|
}`,ne="result = activation(result);");var ce=o?"result += getBiasAtOutCoords();":"";o&&this.variableNames.push("bias"),i&&this.variableNames.push("preluActivationWeights"),this.userCode=`
|
|
|
`+Y+`
|
|
|
|
|
|
const float sharedDimension = `+u+`.0;
|
|
|
|
|
|
vec4 dot2x2ARowBCol(ivec3 rc) {
|
|
|
vec4 result = vec4(0);
|
|
|
for (int i = 0; i < `+u+`; i++) {
|
|
|
vec4 a = getMatrixA(rc.x, `+f+`);
|
|
|
vec4 b = getMatrixB(rc.x, `+C+`);
|
|
|
|
|
|
// These swizzled products need to be separately added.
|
|
|
// See: https://github.com/tensorflow/tfjs/issues/1735
|
|
|
result += (`+k[0]+" * "+L[0]+`);
|
|
|
result += (`+k[1]+" * "+L[1]+`);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
void main() {
|
|
|
ivec3 rc = getOutputCoords();
|
|
|
vec4 result = dot2x2ARowBCol(rc);
|
|
|
|
|
|
`+ce+`
|
|
|
|
|
|
`+ne+`
|
|
|
|
|
|
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 C="",k=s-2;k<s;k++)C+=f[k]+" >= "+u[k],k<s-1&&(C+="||");return C}(r,n,e),a=function(s,u,f,C){if(s===1)return"";var k=C.slice(-2);return`
|
|
|
int r = `+k[0]+`;
|
|
|
int c = `+k[1]+`;
|
|
|
int rp1 = r + 1;
|
|
|
int cp1 = c + 1;
|
|
|
|
|
|
bool cEdge = cp1 >= `+u+`;
|
|
|
bool rEdge = rp1 >= `+f+`;
|
|
|
`}(r,n[n.length-1],n[n.length-2],e),i=function(s,u){var f=s.length,C=function(k,L){for(var Y=[],ne=0;ne<=1;ne++)for(var ce=0;ce<=1;ce++){for(var se=(ne===0?"r":"rp1")+", "+(ce===0?"c":"cp1"),le=2;le<k;le++)se=L[L.length-1-le]+","+se;Y.push(se)}return Y}(f,u);return f===1?`getA(rc),
|
|
|
rc + 1 >= `+s[0]+` ? 0. : getA(rc + 1),
|
|
|
0, 0`:"getA("+C[0]+`),
|
|
|
cEdge ? 0. : getA(`+C[1]+`),
|
|
|
rEdge ? 0. : getA(`+C[2]+`),
|
|
|
rEdge || cEdge ? 0. : getA(`+C[3]+")"}(n,e);this.userCode=`
|
|
|
void main() {
|
|
|
`+t+` rc = getOutputCoords();
|
|
|
|
|
|
if(`+o+`) {
|
|
|
setOutput(vec4(0));
|
|
|
} else {
|
|
|
`+a+`
|
|
|
|
|
|
setOutput(vec4(`+i+`));
|
|
|
}
|
|
|
}
|
|
|
`}},xd=function(n,r,e){this.variableNames=["x"],this.outputShape=r.map(function(u,f){return u[0]+n[f]+u[1]});var t=n.length,o=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(se,le){return se[0]+n[le]+se[1]});for(var t=n.length,o=ze(t),a=r.map(function(se){return se[0]}).join(","),i=r.map(function(se,le){return se[0]+n[le]}).join(","),s=en("rc",t),u=en("source",t),f=s[t-1]+" < "+this.outputShape[t-1],C=t===1?"source":"vec2("+u.slice(-2).join()+")",k=[o+" rc = outputLoc;",s[t-1]+` += 1;
|
|
|
if(`+f+`) {
|
|
|
`,t===1?"":`}
|
|
|
rc = outputLoc;
|
|
|
`+s[t-2]+` += 1;
|
|
|
if(`+s[t-2]+" < "+this.outputShape[t-2]+") {",t===1?"":" "+s[t-1]+` += 1;
|
|
|
if(`+f+") {"],L=t===1?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))",Y="",ne=0,ce=t===1?2:4;ne<ce;ne++)Y+=`
|
|
|
`+k[ne]+`
|
|
|
if (`+L+`) {
|
|
|
result[`+ne+"] = float("+e+`);
|
|
|
} else {
|
|
|
`+o+` source = rc - start;
|
|
|
result[`+ne+"] = getChannel(getX("+u.join()+"), "+C+`);
|
|
|
}
|
|
|
`;Y+=t===1?"} ":"}}",this.userCode=`
|
|
|
const `+o+" start = "+o+"("+a+`);
|
|
|
const `+o+" end = "+o+"("+i+`);
|
|
|
|
|
|
void main() {
|
|
|
`+o+` outputLoc = getOutputCoords();
|
|
|
vec4 result = vec4(0.);
|
|
|
`+Y+`
|
|
|
setOutput(result);
|
|
|
}
|
|
|
`},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.strideHeight,a=n.strideWidth,i=n.dilationHeight,s=n.dilationWidth,u=n.effectiveFilterHeight,f=n.effectiveFilterWidth,C=n.padInfo.top,k=n.padInfo.left;this.outputShape=n.outShape;var L=r==="avg",Y="0.0";if(L||(Y="-1.0 / 1e-20"),e)this.userCode=`
|
|
|
const ivec2 strides = ivec2(`+o+", "+a+`);
|
|
|
const ivec2 pads = ivec2(`+C+", "+k+`);
|
|
|
|
|
|
void main() {
|
|
|
ivec4 coords = getOutputCoords();
|
|
|
int batch = coords[0];
|
|
|
int d = coords[3];
|
|
|
|
|
|
ivec2 xRCCorner = coords.yz * strides - pads;
|
|
|
int xRCorner = xRCCorner.x;
|
|
|
int xCCorner = xRCCorner.y;
|
|
|
|
|
|
// max/min x(?, ?, d) to get y(yR, yC, d).
|
|
|
// ? = to be determined
|
|
|
float minMaxValue = 0.0;
|
|
|
float minMaxValueFound = 0.0;
|
|
|
int minMaxPosition = 0;
|
|
|
float avgValue = 0.0;
|
|
|
|
|
|
for (int wR = 0; wR < `+u+`;
|
|
|
wR += `+i+`) {
|
|
|
int xR = xRCorner + wR;
|
|
|
|
|
|
if (xR < 0 || xR >= `+n.inHeight+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int wC = 0; wC < `+f+`;
|
|
|
wC += `+s+`) {
|
|
|
int xC = xCCorner + wC;
|
|
|
|
|
|
if (xC < 0 || xC >= `+n.inWidth+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
float value = getX(batch, xR, xC, d);
|
|
|
|
|
|
// If a min / max value has already been found, use it. If not,
|
|
|
// use the current value.
|
|
|
float currMinMaxValue = mix(
|
|
|
value, minMaxValue, minMaxValueFound);
|
|
|
if (value >= currMinMaxValue) {
|
|
|
minMaxValue = value;
|
|
|
minMaxValueFound = 1.0;
|
|
|
minMaxPosition = wR * `+f+` + wC;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
setOutput(float(minMaxPosition));
|
|
|
}
|
|
|
`;else{var ne=r+"("+r+"("+r+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";r==="avg"&&(ne="avgValue / count");var ce=4*Math.floor(t/4),se=t%4,le=`
|
|
|
if (`+L+`) {
|
|
|
avgValue += dot(values, ones);
|
|
|
} else {
|
|
|
minMaxValue = max(values, minMaxValue);
|
|
|
}
|
|
|
`;this.userCode=`
|
|
|
const ivec2 strides = ivec2(`+o+", "+a+`);
|
|
|
const ivec2 pads = ivec2(`+C+", "+k+`);
|
|
|
const float initializationValue = `+Y+`;
|
|
|
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(`+Y+`);
|
|
|
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 < `+ce+`; 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)
|
|
|
);
|
|
|
|
|
|
`+le+`
|
|
|
}
|
|
|
|
|
|
int xC = xCCorner + `+ce+`;
|
|
|
if (`+(se===1)+`) {
|
|
|
vec4 values = vec4(
|
|
|
getValue(batch, xR, xC, d),
|
|
|
initializationValue,
|
|
|
initializationValue,
|
|
|
initializationValue
|
|
|
);
|
|
|
|
|
|
`+le+`
|
|
|
} else if (`+(se===2)+`) {
|
|
|
vec4 values = vec4(
|
|
|
getValue(batch, xR, xC, d),
|
|
|
getValue(batch, xR, xC + `+s+`, d),
|
|
|
initializationValue,
|
|
|
initializationValue
|
|
|
);
|
|
|
|
|
|
`+le+`
|
|
|
} else if (`+(se===3)+`) {
|
|
|
vec4 values = vec4(
|
|
|
getValue(batch, xR, xC, d),
|
|
|
getValue(batch, xR, xC + `+s+`, d),
|
|
|
getValue(batch, xR, xC + 2 * `+s+`, d),
|
|
|
initializationValue
|
|
|
);
|
|
|
|
|
|
`+le+`
|
|
|
}
|
|
|
}
|
|
|
setOutput(`+ne+`);
|
|
|
}
|
|
|
`}},lu=function(n,r,e){if(this.variableNames=["x"],r==="avg"&&e)throw new Error("Cannot compute positions for average pool.");var t=n.filterWidth,o=n.strideDepth,a=n.strideHeight,i=n.strideWidth,s=n.dilationDepth,u=n.dilationHeight,f=n.dilationWidth,C=n.effectiveFilterDepth,k=n.effectiveFilterHeight,L=n.effectiveFilterWidth,Y=n.padInfo.front,ne=n.padInfo.top,ce=n.padInfo.left;this.outputShape=n.outShape;var se=r==="avg",le="0.0";if(se||(le="-1.0 / 1e-20"),e)this.userCode=`
|
|
|
const ivec3 strides =
|
|
|
ivec3(`+o+", "+a+", "+i+`);
|
|
|
const ivec3 pads = ivec3(`+Y+", "+ne+", "+ce+`);
|
|
|
|
|
|
void main() {
|
|
|
ivec5 coords = getOutputCoords();
|
|
|
int batch = coords.x;
|
|
|
int ch = coords.u;
|
|
|
|
|
|
ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;
|
|
|
int xDCorner = xCorner.x;
|
|
|
int xRCorner = xCorner.y;
|
|
|
int xCCorner = xCorner.z;
|
|
|
|
|
|
// max/min x(?, ?, ?, ch) to get y(yD, yR, yC, ch).
|
|
|
// ? = to be determined
|
|
|
float minMaxValue = 0.0;
|
|
|
float minMaxValueFound = 0.0;
|
|
|
int minMaxPosition = 0;
|
|
|
|
|
|
for (int wD = 0; wD < `+C+`;
|
|
|
wD += `+s+`) {
|
|
|
int xD = xDCorner + wD;
|
|
|
|
|
|
if (xD < 0 || xD >= `+n.inDepth+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int wR = 0; wR < `+k+`;
|
|
|
wR += `+u+`) {
|
|
|
int xR = xRCorner + wR;
|
|
|
|
|
|
if (xR < 0 || xR >= `+n.inHeight+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int wC = 0; wC < `+L+`;
|
|
|
wC += `+f+`) {
|
|
|
int xC = xCCorner + wC;
|
|
|
|
|
|
if (xC < 0 || xC >= `+n.inWidth+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
float value = getX(batch, xD, xR, xC, ch);
|
|
|
|
|
|
// If a min / max value has already been found, use it. If not,
|
|
|
// use the current value.
|
|
|
float currMinMaxValue = mix(
|
|
|
value, minMaxValue, minMaxValueFound);
|
|
|
if (value >= currMinMaxValue) {
|
|
|
minMaxValue = value;
|
|
|
minMaxValueFound = 1.0;
|
|
|
minMaxPosition =
|
|
|
wD * `+k+" * "+L+` +
|
|
|
wR * `+L+` + wC;;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
setOutput(float(minMaxPosition));
|
|
|
}
|
|
|
`;else{var xe=r+"("+r+"("+r+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";r==="avg"&&(xe="avgValue / count");var Ee=4*Math.floor(t/4),Ce=t%4,Te=`
|
|
|
if (`+se+`) {
|
|
|
avgValue += dot(values, ones);
|
|
|
} else {
|
|
|
minMaxValue = max(values, minMaxValue);
|
|
|
}
|
|
|
`;this.userCode=`
|
|
|
const ivec3 strides =
|
|
|
ivec3(`+o+", "+a+", "+i+`);
|
|
|
const ivec3 pads = ivec3(`+Y+", "+ne+", "+ce+`);
|
|
|
const float initializationValue = `+le+`;
|
|
|
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(`+le+`);
|
|
|
float avgValue = 0.0;
|
|
|
count = 0.0;
|
|
|
|
|
|
for (int wD = 0; wD < `+C+`;
|
|
|
wD += `+s+`) {
|
|
|
int xD = xDCorner + wD;
|
|
|
|
|
|
if (xD < 0 || xD >= `+n.inDepth+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int wR = 0; wR < `+k+`;
|
|
|
wR += `+u+`) {
|
|
|
int xR = xRCorner + wR;
|
|
|
|
|
|
if (xR < 0 || xR >= `+n.inHeight+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int wC = 0; wC < `+Ee+`; 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)
|
|
|
);
|
|
|
|
|
|
`+Te+`
|
|
|
}
|
|
|
|
|
|
int xC = xCCorner + `+Ee+`;
|
|
|
if (`+(Ce===1)+`) {
|
|
|
vec4 values = vec4(
|
|
|
getValue(batch, xD, xR, xC, ch),
|
|
|
initializationValue,
|
|
|
initializationValue,
|
|
|
initializationValue
|
|
|
);
|
|
|
|
|
|
`+Te+`
|
|
|
} else if (`+(Ce===2)+`) {
|
|
|
vec4 values = vec4(
|
|
|
getValue(batch, xD, xR, xC, ch),
|
|
|
getValue(batch, xD, xR, xC + `+f+`, ch),
|
|
|
initializationValue,
|
|
|
initializationValue
|
|
|
);
|
|
|
|
|
|
`+Te+`
|
|
|
} else if (`+(Ce===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
|
|
|
);
|
|
|
|
|
|
`+Te+`
|
|
|
}
|
|
|
}
|
|
|
setOutput(`+xe+`);
|
|
|
}
|
|
|
}
|
|
|
`}},Ed=function(n,r){this.variableNames=["x"];var e=n.windowSize,t=n.batchSize,o=n.inSize,a=Math.ceil(o/e);this.outputShape=[t,a];var i="0.0",s="";r==="prod"?i="1.0":r==="min"?(i="1.0 / 1e-20",s="min"):r==="max"&&(i="-1.0 / 1e-20",s="max");var u=r+"("+r+"("+r+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";r==="sum"?u="sumValue":r==="prod"?u="prodValue":r==="all"?u="allValue":r==="any"&&(u="anyValue");var f=4*Math.floor(e/4),C=e%4,k=`
|
|
|
if (`+(r==="sum")+`) {
|
|
|
sumValue += dot(values, ones);
|
|
|
} else if (`+(r==="prod")+`) {
|
|
|
vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);
|
|
|
prodValue *= tmp[0] * tmp[1];
|
|
|
} else {
|
|
|
minMaxValue = `+s+`(values, minMaxValue);
|
|
|
}
|
|
|
`,L="vec4";r==="all"?(i="1.0",k=`
|
|
|
bool reducedAllValue = all(values);
|
|
|
float floatedReducedAllValue = float(reducedAllValue);
|
|
|
allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);
|
|
|
`,L="bvec4"):r==="any"&&(i="0.0",k=`
|
|
|
bool reducedAnyValue = any(values);
|
|
|
float floatedReducedAnyValue = float(reducedAnyValue);
|
|
|
anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);
|
|
|
`,L="bvec4");var Y="";o%e>0&&(Y=`
|
|
|
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) {
|
|
|
`+Y+`
|
|
|
return getX(batch, inIdx);
|
|
|
}
|
|
|
|
|
|
void main() {
|
|
|
ivec2 coords = getOutputCoords();
|
|
|
int batch = coords[0];
|
|
|
int outIdx = coords[1];
|
|
|
int inOffset = outIdx * `+e+`;
|
|
|
|
|
|
vec4 minMaxValue = vec4(`+i+`);
|
|
|
float prodValue = 1.0;
|
|
|
float sumValue = 0.0;
|
|
|
float allValue = 1.0;
|
|
|
float anyValue = 0.0;
|
|
|
|
|
|
for (int i = 0; i < `+f+`; i += 4) {
|
|
|
int inIdx = inOffset + i;
|
|
|
`+L+" values = "+L+`(
|
|
|
getValue(batch, inIdx),
|
|
|
getValue(batch, inIdx + 1),
|
|
|
getValue(batch, inIdx + 2),
|
|
|
getValue(batch, inIdx + 3)
|
|
|
);
|
|
|
|
|
|
`+k+`
|
|
|
}
|
|
|
|
|
|
int inIdx = inOffset + `+f+`;
|
|
|
if (`+(C===1)+`) {
|
|
|
`+L+" values = "+L+`(
|
|
|
getValue(batch, inIdx),
|
|
|
initializationValue,
|
|
|
initializationValue,
|
|
|
initializationValue
|
|
|
);
|
|
|
|
|
|
`+k+`
|
|
|
} else if (`+(C===2)+`) {
|
|
|
`+L+" values = "+L+`(
|
|
|
getValue(batch, inIdx),
|
|
|
getValue(batch, inIdx + 1),
|
|
|
initializationValue,
|
|
|
initializationValue
|
|
|
);
|
|
|
|
|
|
`+k+`
|
|
|
} else if (`+(C===3)+`) {
|
|
|
`+L+" values = "+L+`(
|
|
|
getValue(batch, inIdx),
|
|
|
getValue(batch, inIdx + 1),
|
|
|
getValue(batch, inIdx + 2),
|
|
|
initializationValue
|
|
|
);
|
|
|
|
|
|
`+k+`
|
|
|
}
|
|
|
setOutput(`+u+`);
|
|
|
}
|
|
|
`},_d=function(n,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n;for(var e="",t=0;t<4;t++){var o="thisRC = rc;";t%2==1&&(o+="thisRC.z += 1;"),t>1&&(o+="thisRC.y += 1;"),e+=`
|
|
|
`+o+`
|
|
|
`+(t>0?"if(thisRC.y < rows && thisRC.z < cols){":"")+`
|
|
|
int flatIndex = getFlatIndex(thisRC);
|
|
|
|
|
|
ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);
|
|
|
vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));
|
|
|
|
|
|
result[`+t+`] =
|
|
|
getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);
|
|
|
`+(t>0?"}":"")+`
|
|
|
`}this.userCode=`
|
|
|
|
|
|
ivec3 inputCoordsFromReshapedOutCoords(int index) {
|
|
|
`+O(["r","c","d"],r)+`
|
|
|
return ivec3(r, c, d);
|
|
|
}
|
|
|
|
|
|
`+w(n)+`
|
|
|
|
|
|
void main() {
|
|
|
ivec3 rc = getOutputCoords();
|
|
|
|
|
|
vec4 result = vec4(0.);
|
|
|
|
|
|
ivec3 thisRC;
|
|
|
int rows = `+n[1]+`;
|
|
|
int cols = `+n[2]+`;
|
|
|
|
|
|
`+e+`
|
|
|
|
|
|
setOutput(result);
|
|
|
}
|
|
|
`},Cd=function(n,r,e){this.variableNames=["dy"],this.outputShape=[],this.outputShape=r.shape;var t=r.shape,o=t[1],a=t[2],i=n.shape,s=i[1],u=i[2],f=[e&&s>1?o-1:o,e&&u>1?a-1:a],C=[e&&s>1?s-1:s,e&&u>1?u-1:u],k=f[0]/C[0],L=f[1]/C[1],Y=1/k,ne=1/L,ce=2*Math.ceil(Y)+2,se=2*Math.ceil(ne)+2;this.userCode=`
|
|
|
void main() {
|
|
|
ivec4 coords = getOutputCoords();
|
|
|
int b = coords[0];
|
|
|
int d = coords[3];
|
|
|
int r = coords[1];
|
|
|
int c = coords[2];
|
|
|
|
|
|
float accumulator = 0.0;
|
|
|
|
|
|
const float heightScale = float(`+k+`);
|
|
|
const float widthScale = float(`+L+`);
|
|
|
|
|
|
const float invHeightScale = float(`+Y+`);
|
|
|
const float invWidthScale = float(`+ne+`);
|
|
|
|
|
|
const int winHeight = int(`+ce+`);
|
|
|
const int winWidth = int(`+se+`);
|
|
|
|
|
|
// Compute bounds for where in dy we will look
|
|
|
float startRLerp = floor(float(r) * invHeightScale);
|
|
|
int startDyR = int(startRLerp - float(winHeight / 2));
|
|
|
|
|
|
float startCLerp = floor(float(c) * invWidthScale);
|
|
|
int startDyC = int(startCLerp - float(winWidth / 2));
|
|
|
|
|
|
// Loop over dy
|
|
|
for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {
|
|
|
int dyR = dyROffset + startDyR;
|
|
|
|
|
|
// Guard against the window exceeding the bounds of dy
|
|
|
if (dyR < 0 || dyR >= `+s+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {
|
|
|
int dyC = dyCOffset + startDyC;
|
|
|
|
|
|
// Guard against the window exceeding the bounds of dy
|
|
|
if (dyC < 0 || dyC >= `+u+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
float dxR = float(dyR) * heightScale;
|
|
|
int topDxRIndex = int(floor(dxR));
|
|
|
int bottomDxRIndex = int(min(ceil(dxR), `+(o-1)+`.0));
|
|
|
float dxRLerp = dxR - float(topDxRIndex);
|
|
|
float inverseDxRLerp = 1.0 - dxRLerp;
|
|
|
|
|
|
float dxC = float(dyC) * widthScale;
|
|
|
int leftDxCIndex = int(floor(dxC));
|
|
|
int rightDxCIndex = int(min(ceil(dxC), `+(a-1)+`.0));
|
|
|
float dxCLerp = dxC - float(leftDxCIndex);
|
|
|
float inverseDxCLerp = 1.0 - dxCLerp;
|
|
|
|
|
|
if (r == topDxRIndex && c == leftDxCIndex) {
|
|
|
// topLeft
|
|
|
accumulator +=
|
|
|
getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;
|
|
|
}
|
|
|
|
|
|
if (r == topDxRIndex && c == rightDxCIndex) {
|
|
|
// topRight
|
|
|
accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;
|
|
|
}
|
|
|
|
|
|
if (r == bottomDxRIndex && c == leftDxCIndex) {
|
|
|
// bottomLeft
|
|
|
accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;
|
|
|
}
|
|
|
|
|
|
if (r == bottomDxRIndex && c == rightDxCIndex) {
|
|
|
// bottomRight
|
|
|
accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// End loop over dy
|
|
|
|
|
|
setOutput(accumulator);
|
|
|
}
|
|
|
`},Td=function(n,r,e,t){this.variableNames=["A"],this.outputShape=[];var o=n[0],a=n[1],i=n[2],s=n[3];this.outputShape=[o,r,e,s];var u=[t&&r>1?a-1:a,t&&e>1?i-1:i],f=[t&&r>1?r-1:r,t&&e>1?e-1:e];this.userCode=`
|
|
|
const vec2 effectiveInputOverOutputRatioRC = vec2(
|
|
|
`+u[0]/f[0]+`,
|
|
|
`+u[1]/f[1]+`);
|
|
|
const vec2 inputShapeRC = vec2(`+a+".0, "+i+`.0);
|
|
|
|
|
|
void main() {
|
|
|
ivec4 coords = getOutputCoords();
|
|
|
int b = coords[0];
|
|
|
int d = coords[3];
|
|
|
ivec2 yRC = coords.yz;
|
|
|
|
|
|
// Fractional source index.
|
|
|
vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;
|
|
|
|
|
|
// Compute the four integer indices.
|
|
|
ivec2 sourceFloorRC = ivec2(sourceFracIndexRC);
|
|
|
ivec2 sourceCeilRC = ivec2(
|
|
|
min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));
|
|
|
|
|
|
float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d);
|
|
|
float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d);
|
|
|
float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d);
|
|
|
float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d);
|
|
|
|
|
|
vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);
|
|
|
|
|
|
float top = topLeft + (topRight - topLeft) * fracRC.y;
|
|
|
float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;
|
|
|
float newValue = top + (bottom - top) * fracRC.x;
|
|
|
|
|
|
setOutput(newValue);
|
|
|
}
|
|
|
`},Sd=function(n,r,e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];var o=n[0],a=n[1],i=n[2],s=n[3];this.outputShape=[o,r,e,s];var u=[t&&r>1?a-1:a,t&&e>1?i-1:i],f=[t&&r>1?r-1:r,t&&e>1?e-1:e];this.userCode=`
|
|
|
const vec3 effectiveInputOverOutputRatioRC = vec3(
|
|
|
`+u[0]/f[0]+`,
|
|
|
`+u[1]/f[1]+`,
|
|
|
`+u[1]/f[1]+`);
|
|
|
const vec3 inputShapeRC = vec3(`+a+".0, "+i+`.0,
|
|
|
`+i+`.0);
|
|
|
|
|
|
float getAValue(int b, int r, int c, int d) {
|
|
|
return getChannel(getA(b, r, c, d), vec2(c, d));
|
|
|
}
|
|
|
|
|
|
void main() {
|
|
|
ivec4 coords = getOutputCoords();
|
|
|
int b = coords[0];
|
|
|
int d = coords[3];
|
|
|
// Calculate values for next column in yRC.z.
|
|
|
ivec3 yRC = coords.yzz + ivec3(0, 0, 1);
|
|
|
|
|
|
// Fractional source index.
|
|
|
vec3 sourceFracIndexRC = vec3(yRC) * effectiveInputOverOutputRatioRC;
|
|
|
|
|
|
// Compute the four integer indices.
|
|
|
ivec3 sourceFloorRC = ivec3(sourceFracIndexRC);
|
|
|
ivec3 sourceCeilRC = ivec3(
|
|
|
min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));
|
|
|
|
|
|
// Should we calculate next column and row elements in 2x2 packed cell.
|
|
|
bool hasNextCol = d < `+(s-1)+`;
|
|
|
bool hasNextRow = coords.z < `+(e-1)+`;
|
|
|
|
|
|
// In parallel, construct four corners for all four components in
|
|
|
// packed 2x2 cell.
|
|
|
vec4 topLeft = vec4(
|
|
|
getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d),
|
|
|
hasNextCol ? getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d + 1)
|
|
|
: 0.0,
|
|
|
hasNextRow ? getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d)
|
|
|
: 0.0,
|
|
|
(hasNextRow && hasNextCol) ?
|
|
|
getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d + 1) : 0.0);
|
|
|
|
|
|
vec4 bottomLeft = vec4(
|
|
|
getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d),
|
|
|
hasNextCol ? getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d + 1)
|
|
|
: 0.0,
|
|
|
hasNextRow ? getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d)
|
|
|
: 0.0,
|
|
|
(hasNextRow && hasNextCol) ?
|
|
|
getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d + 1) : 0.0);
|
|
|
|
|
|
vec4 topRight = vec4(
|
|
|
getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d),
|
|
|
hasNextCol ? getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d + 1)
|
|
|
: 0.0,
|
|
|
hasNextRow ? getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d)
|
|
|
: 0.0,
|
|
|
(hasNextRow && hasNextCol) ?
|
|
|
getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d + 1) : 0.0);
|
|
|
|
|
|
vec4 bottomRight = vec4(
|
|
|
getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d),
|
|
|
hasNextCol ? getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d + 1)
|
|
|
: 0.0,
|
|
|
hasNextRow ? getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d)
|
|
|
: 0.0,
|
|
|
(hasNextRow && hasNextCol) ?
|
|
|
getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d + 1) : 0.0);
|
|
|
|
|
|
vec3 fracRC = sourceFracIndexRC - vec3(sourceFloorRC);
|
|
|
|
|
|
vec4 top = mix(topLeft, topRight, fracRC.yyzz);
|
|
|
vec4 bottom = mix(bottomLeft, bottomRight, fracRC.yyzz);
|
|
|
vec4 newValue = mix(top, bottom, fracRC.x);
|
|
|
|
|
|
setOutput(newValue);
|
|
|
}
|
|
|
`},Ad=function(n,r,e){this.variableNames=["dy"],this.outputShape=[],this.outputShape=r.shape;var t=r.shape,o=t[1],a=t[2],i=n.shape,s=i[1],u=i[2],f=[e&&s>1?o-1:o,e&&u>1?a-1:a],C=[e&&s>1?s-1:s,e&&u>1?u-1:u],k=f[0]/C[0],L=f[1]/C[1],Y=1/k,ne=1/L,ce=2*Math.ceil(Y)+2,se=2*Math.ceil(ne)+2;this.userCode=`
|
|
|
void main() {
|
|
|
ivec4 coords = getOutputCoords();
|
|
|
int b = coords[0];
|
|
|
int d = coords[3];
|
|
|
int r = coords[1];
|
|
|
int c = coords[2];
|
|
|
|
|
|
float accumulator = 0.0;
|
|
|
|
|
|
const float heightScale = float(`+k+`);
|
|
|
const float widthScale = float(`+L+`);
|
|
|
|
|
|
const float invHeightScale = float(`+Y+`);
|
|
|
const float invWidthScale = float(`+ne+`);
|
|
|
|
|
|
const int winHeight = int(`+ce+`);
|
|
|
const int winWidth = int(`+se+`);
|
|
|
|
|
|
// Compute bounds for where in dy we will look
|
|
|
float startRLerp = floor(float(r) * invHeightScale);
|
|
|
int startDyR = int(floor(startRLerp - float(winHeight / 2)));
|
|
|
|
|
|
float startCLerp = floor(float(c) * invWidthScale);
|
|
|
int startDyC = int(floor(startCLerp - float(winWidth / 2)));
|
|
|
|
|
|
// Loop over dy
|
|
|
for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {
|
|
|
int dyR = dyROffset + startDyR;
|
|
|
|
|
|
// Guard against the window exceeding the bounds of dy
|
|
|
if (dyR < 0 || dyR >= `+s+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {
|
|
|
int dyC = dyCOffset + startDyC;
|
|
|
|
|
|
// Guard against the window exceeding the bounds of dy
|
|
|
if (dyC < 0 || dyC >= `+u+`) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
float sourceFracRow =
|
|
|
float(`+f[0]+`) *
|
|
|
(float(dyR) / float(`+C[0]+`));
|
|
|
|
|
|
float sourceFracCol =
|
|
|
float(`+f[1]+`) *
|
|
|
(float(dyC) / float(`+C[1]+`));
|
|
|
|
|
|
int sourceNearestRow = int(min(
|
|
|
float(int(`+o+`) - 1),
|
|
|
`+e+` ? float(round(sourceFracRow)) :
|
|
|
float(floor(sourceFracRow))));
|
|
|
|
|
|
int sourceNearestCol = int(min(
|
|
|
float(int(`+a+`) - 1),
|
|
|
`+e+` ? float(round(sourceFracCol)) :
|
|
|
float(floor(sourceFracCol))));
|
|
|
|
|
|
if (r == sourceNearestRow && c == sourceNearestCol) {
|
|
|
accumulator += getDy(b, dyR, dyC, d);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// End loop over dy
|
|
|
|
|
|
setOutput(accumulator);
|
|
|
}
|
|
|
`},Od=function(n,r,e,t){this.variableNames=["A"],this.outputShape=[];var o=n[0],a=n[1],i=n[2],s=n[3];this.outputShape=[o,r,e,s];var u=[t&&r>1?a-1:a,t&&e>1?i-1:i],f=[t&&r>1?r-1:r,t&&e>1?e-1:e],C=t?"0.5":"0.0";this.userCode=`
|
|
|
const vec2 effectiveInputOverOutputRatioRC = vec2(
|
|
|
`+u[0]/f[0]+`,
|
|
|
`+u[1]/f[1]+`);
|
|
|
const vec2 inputShapeRC = vec2(`+a+".0, "+i+`.0);
|
|
|
|
|
|
void main() {
|
|
|
ivec4 coords = getOutputCoords();
|
|
|
int b = coords[0];
|
|
|
int d = coords[3];
|
|
|
ivec2 yRC = coords.yz;
|
|
|
|
|
|
// Fractional source index.
|
|
|
vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;
|
|
|
|
|
|
// Compute the coordinators of nearest neighbor point.
|
|
|
ivec2 sourceNearestRC = ivec2(
|
|
|
min(inputShapeRC - 1.0, floor(sourceFracIndexRC + `+C+`)));
|
|
|
|
|
|
float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);
|
|
|
|
|
|
setOutput(newValue);
|
|
|
}
|
|
|
`},Rd=function(n,r){this.variableNames=["x"];var e=n.length;if(e>4)throw new Error("WebGL backend: Reverse of rank-"+e+" tensor is not yet supported");if(this.outputShape=n,e!==1){var t=n.map(function(a,i){return function(s){return r.indexOf(s)!==-1&&n[s]!==1?n[s]+" - coords["+s+"] - 1":"coords["+s+"]"}(i)}).join(","),o=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(C,k){return function(L,Y){return r.indexOf(L)!==-1&&n[L]!==1?n[L]+" - "+Y[L]+" - 1":""+Y[L]}(k,u)});return"getChannel(getX("+f.join(",")+"), vec2("+f.slice(-2).join(",")+"))"}this.userCode=e===1?`
|
|
|
void main(){
|
|
|
int rc = getOutputCoords();
|
|
|
vec4 result = vec4(0.);
|
|
|
result.r = getChannel(getX(`+n[0]+` - rc - 1),
|
|
|
`+n[0]+` - rc - 1);
|
|
|
if(`+o+`){
|
|
|
result.g = getChannel(getX(`+n[0]+` - (rc + 1) - 1),
|
|
|
`+n[0]+` - (rc + 1) - 1);
|
|
|
}
|
|
|
setOutput(result);
|
|
|
}
|
|
|
`:`
|
|
|
void main() {
|
|
|
`+i+` rc = getOutputCoords();
|
|
|
vec4 result = vec4(0.);
|
|
|
result.r = `+function(u){return s(u)}(t.slice())+`;
|
|
|
if(`+o+`){
|
|
|
result.g = `+function(u){return u[e-1]="("+u[e-1]+" + 1)",s(u)}(t.slice())+`;
|
|
|
}
|
|
|
if(`+a+`) {
|
|
|
result.b = `+function(u){return u[e-2]="("+u[e-2]+" + 1)",s(u)}(t.slice())+`;
|
|
|
if(`+o+`) {
|
|
|
result.a = `+function(u){return u[e-1]="("+u[e-1]+" + 1)",u[e-2]="("+u[e-2]+" + 1)",s(u)}(t.slice())+`;
|
|
|
}
|
|
|
}
|
|
|
setOutput(result);
|
|
|
}
|
|
|
`},Ac=function(n,r,e,t,o,a,i){i===void 0&&(i=!0),this.variableNames=["updates","indices","defaultValue"],this.outputShape=a;var s=ze(o.length),u=ze(a.length),f="";e===1?f="i":e===2&&(f="i, j");var C="getIndices("+f+")",k="";t===1?k="i":t===2&&(k="i, coords[1]");var L="getUpdates("+k+")",Y=r>1?"strides[j]":"strides";this.userCode=`
|
|
|
`+s+" strides = "+s+"("+o+`);
|
|
|
|
|
|
void main() {
|
|
|
`+u+` coords = getOutputCoords();
|
|
|
float sum = 0.0;
|
|
|
bool found = false;
|
|
|
for (int i = 0; i < `+n+`; i++) {
|
|
|
int flattenedIndex = 0;
|
|
|
for (int j = 0; j < `+r+`; j++) {
|
|
|
int index = round(`+C+`);
|
|
|
flattenedIndex += index * `+Y+`;
|
|
|
}
|
|
|
if (flattenedIndex == coords[0]) {
|
|
|
sum += `+L+`;
|
|
|
found = true;
|
|
|
}
|
|
|
}
|
|
|
setOutput(mix(getDefaultValue(), sum, float(found)));
|
|
|
}
|
|
|
`},Nd=function(n,r){this.variableNames=["x","segmentIds"];var e=n.windowSize,t=n.batchSize,o=n.inSize,a=n.numSegments,i=a*Math.ceil(o/e);this.outputShape=[t,i];var s=4*Math.floor(e/4),u=e%4,f=`
|
|
|
sumValue += dot(values, segFilter);
|
|
|
`,C="";o%e>0&&(C=`
|
|
|
if (inIdx < 0 || inIdx >= `+o+`) {
|
|
|
return initializationValue;
|
|
|
}
|
|
|
`);var k="";o%e>0&&(k=`
|
|
|
if (inIdx < 0 || inIdx >= `+o+`) {
|
|
|
return -1.0;
|
|
|
}
|
|
|
`),this.userCode=`
|
|
|
const float initializationValue = 0.0;
|
|
|
|
|
|
float getValue(int batch, int inIdx) {
|
|
|
`+C+`
|
|
|
return getX(batch, inIdx);
|
|
|
}
|
|
|
|
|
|
float getSegmentIdAtIndex(int inIdx) {
|
|
|
`+k+`
|
|
|
return getSegmentIds(inIdx);
|
|
|
}
|
|
|
|
|
|
void main() {
|
|
|
ivec2 coords = getOutputCoords();
|
|
|
int batch = coords[0];
|
|
|
int outIdx = coords[1];
|
|
|
int inOffset = int(floor(float(outIdx) / float(
|
|
|
`+a+")) * float("+e+`));
|
|
|
int currentSeg = int(mod(float(outIdx), float(`+a+`)));
|
|
|
|
|
|
float sumValue = 0.0;
|
|
|
|
|
|
for (int i = 0; i < `+s+`; i += 4) {
|
|
|
int inIdx = inOffset + i;
|
|
|
vec4 values = vec4(
|
|
|
getValue(batch, inIdx),
|
|
|
getValue(batch, inIdx + 1),
|
|
|
getValue(batch, inIdx + 2),
|
|
|
getValue(batch, inIdx + 3)
|
|
|
);
|
|
|
|
|
|
vec4 segFilter = vec4(
|
|
|
int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
|
|
|
int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,
|
|
|
int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,
|
|
|
int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0
|
|
|
);
|
|
|
|
|
|
`+f+`
|
|
|
}
|
|
|
|
|
|
int inIdx = inOffset + `+s+`;
|
|
|
if (`+(u===1)+`) {
|
|
|
vec4 values = vec4(
|
|
|
getValue(batch, inIdx),
|
|
|
initializationValue,
|
|
|
initializationValue,
|
|
|
initializationValue
|
|
|
);
|
|
|
|
|
|
int inIdxSeg = int(getSegmentIdAtIndex(inIdx));
|
|
|
|
|
|
vec4 segFilter = vec4(
|
|
|
int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
|
|
|
0,
|
|
|
0,
|
|
|
0
|
|
|
);
|
|
|
|
|
|
`+f+`
|
|
|
} else if (`+(u===2)+`) {
|
|
|
vec4 values = vec4(
|
|
|
getValue(batch, inIdx),
|
|
|
getValue(batch, inIdx + 1),
|
|
|
initializationValue,
|
|
|
initializationValue
|
|
|
);
|
|
|
|
|
|
vec4 segFilter = vec4(
|
|
|
int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
|
|
|
int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,
|
|
|
0,
|
|
|
0
|
|
|
);
|
|
|
|
|
|
`+f+`
|
|
|
} else if (`+(u===3)+`) {
|
|
|
vec4 values = vec4(
|
|
|
getValue(batch, inIdx),
|
|
|
getValue(batch, inIdx + 1),
|
|
|
getValue(batch, inIdx + 2),
|
|
|
initializationValue
|
|
|
);
|
|
|
|
|
|
vec4 segFilter = vec4(
|
|
|
int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,
|
|
|
int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,
|
|
|
int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,
|
|
|
0
|
|
|
);
|
|
|
|
|
|
`+f+`
|
|
|
}
|
|
|
setOutput(sumValue);
|
|
|
}
|
|
|
`},Dd=function(n,r,e){var t,o;if(this.variableNames=["c","a","b"],this.outputShape=r,e>4)throw Error("Where for rank "+e+" is not yet supported");if(e===1)o="resRC",t="resRC";else{for(var a=["resRC.x","resRC.y","resRC.z","resRC.w"],i=[],s=[],u=0;u<r.length;u++)s.push(""+a[u]),u<n&&i.push(""+a[u]);t=i.join(),o=s.join()}var f=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 du.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."+du[s]+" = start["+s+"] + coords."+du[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}(),du=["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(C,k){return"start["+k+"]"}).join()+");":r.map(function(C,k){return o[k]+" = "+t[k]+" + start["+k+"];"}).join(`
|
|
|
`);this.userCode=`
|
|
|
uniform int start[`+this.rank+`];
|
|
|
void main() {
|
|
|
`+e+` coords = getOutputCoords();
|
|
|
`+e+` sourceLoc;
|
|
|
`+f+`
|
|
|
vec4 result = vec4(0.);
|
|
|
`+s+`
|
|
|
`+u+`
|
|
|
setOutput(result);
|
|
|
}
|
|
|
`}return n.prototype.getCustomSetupFunc=function(r){var e=this;if(r.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+r.length+")");return function(t,o){e.startLoc==null&&(e.startLoc=t.getUniformLocationNoThrow(o,"start"),e.startLoc==null)||t.gl.uniform1iv(e.startLoc,r)}},n}(),Pd=function(n,r,e){this.variableNames=["x"],this.outputShape=e;var t=e.length,o=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+`));
|
|
|
}
|
|
|
`},Fd=function(){function n(r){this.gpgpu=r,this.numUsedTextures=0,this.numFreeTextures=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}return n.prototype.acquireTexture=function(r,e,t){var o,a=Oc(e,t),i=Rc(r,a,t);if(i in this.freeTextures||(this.freeTextures[i]=[]),i in this.usedTextures||(this.usedTextures[i]=[]),this.freeTextures[i].length>0){this.numFreeTextures--,this.numUsedTextures++,this.log();var s=this.freeTextures[i].shift();return this.usedTextures[i].push(s),s}return this.numUsedTextures++,this.log(),a===Hr.PACKED_2X2_FLOAT32?o=this.gpgpu.createPackedMatrixTexture(r[0],r[1]):a===Hr.PACKED_2X2_FLOAT16?o=this.gpgpu.createFloat16PackedMatrixTexture(r[0],r[1]):a===Hr.UNPACKED_FLOAT32?o=this.gpgpu.createFloat32MatrixTexture(r[0],r[1]):a===Hr.UNPACKED_FLOAT16?o=this.gpgpu.createFloat16MatrixTexture(r[0],r[1]):a===Hr.PACKED_4X1_UNSIGNED_BYTE&&(o=this.gpgpu.createUnsignedBytesMatrixTexture(r[0],r[1])),this.usedTextures[i].push(o),o},n.prototype.releaseTexture=function(r,e,t,o){if(this.freeTextures!=null){var a=Rc(e,Oc(t,o),o);a in this.freeTextures||(this.freeTextures[a]=[]),this.freeTextures[a].push(r),this.numFreeTextures++,this.numUsedTextures--;var i=this.usedTextures[a],s=i.indexOf(r);if(s<0)throw new Error("Cannot release a texture that was never provided by this texture manager");i.splice(s,1),this.log()}},n.prototype.log=function(){if(this.logEnabled){var r=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",this.numFreeTextures+" / "+this.numUsedTextures,"("+r+")")}},n.prototype.getNumUsedTextures=function(){return this.numUsedTextures},n.prototype.getNumFreeTextures=function(){return this.numFreeTextures},n.prototype.dispose=function(){var r=this;if(this.freeTextures!=null){for(var e in this.freeTextures)this.freeTextures[e].forEach(function(t){r.gpgpu.deleteMatrixTexture(t)});for(var e in this.usedTextures)this.usedTextures[e].forEach(function(o){r.gpgpu.deleteMatrixTexture(o)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0}},n}();function Oc(n,r){if(n===Wr.UPLOAD)return Hr.PACKED_2X2_FLOAT32;if(n===Wr.RENDER||n==null)return function(e){return p().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?e?Hr.PACKED_2X2_FLOAT32:Hr.UNPACKED_FLOAT32:e?Hr.PACKED_2X2_FLOAT16:Hr.UNPACKED_FLOAT16}(r);if(n===Wr.DOWNLOAD||n===Wr.PIXELS)return Hr.PACKED_4X1_UNSIGNED_BYTE;throw new Error("Unknown logical texture type "+n)}function Rc(n,r,e){return n[0]+"_"+n[1]+"_"+r+"_"+e}var Ld=function(n,r){this.variableNames=["A"];for(var e=new Array(n.length),t=0;t<e.length;t++)e[t]=n[t]*r[t];this.outputShape=e,this.rank=e.length;var o=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=[],C=0;C<i.length;C++)f.push("imod("+u[C]+", "+i[C]+")");return f.join()}(n);this.userCode=`
|
|
|
void main() {
|
|
|
`+o+` resRC = getOutputCoords();
|
|
|
setOutput(getA(`+a+`));
|
|
|
}
|
|
|
`},jd=function(n,r){this.variableNames=["A"];for(var e=new Array(n.length),t=0;t<e.length;t++)e[t]=n[r[t]];this.outputShape=e,this.rank=e.length;var o=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),C=0;C<i.length;C++)f[i[C]]=u[C];return f.join()}(r);this.userCode=`
|
|
|
void main() {
|
|
|
`+o+` resRC = getOutputCoords();
|
|
|
setOutput(getA(`+a+`));
|
|
|
}
|
|
|
`},Bd=function(n,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0;for(var e=new Array(n.length),t=0;t<e.length;t++)e[t]=n[r[t]];if(this.outputShape=e,this.rank=e.length,this.rank>6)throw Error("Packed transpose for rank "+this.rank+" is not yet supported.");var o=ze(this.rank),a=su("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);
|
|
|
}
|
|
|
`},fu=1.7580993408473768,hu=1.0507009873554805,zt=function(n,r){this.variableNames=["A"],this.outputShape=n,this.userCode=`
|
|
|
float unaryOperation(float x) {
|
|
|
`+r+`
|
|
|
}
|
|
|
|
|
|
void main() {
|
|
|
float x = getAAtOutCoords();
|
|
|
float y = unaryOperation(x);
|
|
|
|
|
|
setOutput(y);
|
|
|
}
|
|
|
`},Nn="if (isnan(x)) return x;",Ud="return x;",Ic="return abs(x);",Nc=Nn+`
|
|
|
return (x < 0.0) ? 0.0 : x;
|
|
|
`,Dc=Nn+`
|
|
|
return (x < 0.0) ? 0.0 : min(6.0, x);
|
|
|
`,kc="return (x >= 0.0) ? x : (exp(x) - 1.0);",Wd=`
|
|
|
// Stable and Attracting Fixed Point (0, 1) for Normalized Weights.
|
|
|
// see: https://arxiv.org/abs/1706.02515
|
|
|
float scaleAlpha = `+fu+`;
|
|
|
float scale = `+hu+`;
|
|
|
return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);
|
|
|
`,Mc="return -x;",Pc="return ceil(x);",Fc="return floor(x);",Lc="return exp(x);",jc="return exp(x) - 1.0;",Hd=Nn+`
|
|
|
return sin(x);
|
|
|
`,zd=Nn+`
|
|
|
return cos(x);
|
|
|
`,Gd=Nn+`
|
|
|
if (abs(x) > 1.) {
|
|
|
return NAN;
|
|
|
}
|
|
|
return asin(x);
|
|
|
`,Vd=Nn+`
|
|
|
if (abs(x) > 1.) {
|
|
|
return NAN;
|
|
|
}
|
|
|
return acos(x);
|
|
|
`,Xd=Nn+`
|
|
|
return atan(x);
|
|
|
`,Kd=Nn+"return log(x + sqrt(x * x + 1.0));",Yd=Nn+`
|
|
|
if (x < 1.0) return NAN;
|
|
|
return log(x + sqrt(x * x - 1.0));`,$d=Nn+`
|
|
|
if ((x < -1.0) || (x > 1.0)) return NAN;
|
|
|
return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,us="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;
|
|
|
`,Ei=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="",C=0;C<s;C++)f+=u[C],C<s-1&&(f+=",");return f}(r,e),a=e.slice(-2),i=r<=1?"rc":"vec2("+a.join(",")+")";this.userCode=`
|
|
|
void main() {
|
|
|
`+t+` rc = getOutputCoords();
|
|
|
vec4 packedInput = getA(`+o+`);
|
|
|
|
|
|
setOutput(getChannel(packedInput, `+i+`));
|
|
|
}
|
|
|
`},cs={};function ls(n,r){if(r===void 0&&(r=!1),n==="linear")return r?Jd:Ud;if(n==="relu")return r?Bc:Nc;if(n==="elu")return r?Wc:kc;if(n==="relu6")return r?Uc:Dc;if(n==="prelu")return r?kr:Ht;throw new Error("Activation "+n+" has not been implemented for the WebGL backend.")}var Qd=600,Hc=function(n){function r(e){var t,o=n.call(this)||this;if(o.pendingRead=new WeakMap,o.pendingDisposal=new WeakSet,o.dataRefCount=new WeakMap,o.numBytesInGPU=0,o.uploadWaitMs=0,o.downloadWaitMs=0,o.warnedAboutMemory=!1,o.pendingDeletes=0,o.disposed=!1,!p().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");if(e==null){var a=gn(p().getNumber("WEBGL_VERSION"));o.binaryCache=((t=p().getNumber("WEBGL_VERSION"))in cs||(cs[t]={}),cs[t]),o.gpgpu=new Tc(a),o.canvas=a.canvas,o.gpgpuCreatedLocally=!0}else o.gpgpu=e,o.binaryCache={},o.gpgpuCreatedLocally=!1,o.canvas=e.gl.canvas;return o.textureManager=new Fd(o.gpgpu),o.numMBBeforeWarning=p().global.screen==null?1024:p().global.screen.height*p().global.screen.width*window.devicePixelRatio*Qd/1024/1024,o.texData=new Ta(o,Ve),o}return D(r,n),r.prototype.numDataIds=function(){return this.texData.numDataIds()+(this.cpuBackend?this.cpuBackend.numDataIds():0)-this.pendingDeletes},r.prototype.write=function(e,t,o){if(p().getBool("DEBUG")&&this.checkNumericalProblems(e),o==="complex64"&&e!=null)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");var a={};return this.texData.set(a,{shape:t,dtype:o,values:e,usage:Wr.UPLOAD}),a},r.prototype.move=function(e,t,o,a){if(p().getBool("DEBUG")&&this.checkNumericalProblems(t),a==="complex64")throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(e,{shape:o,dtype:a,values:t,usage:Wr.UPLOAD})},r.prototype.readSync=function(e){var t=this.texData.get(e),o=t.values,a=t.dtype,i=t.complexTensors,s=t.slice,u=t.shape,f=t.isPacked;if(s!=null){var C=void 0;C=f?new Ei(u,us):new zt(u,us);var k=this.runWebGLProgram(C,[{dataId:e,shape:u,dtype:a}],a),L=this.readSync(k.dataId);return this.disposeData(k.dataId),L}if(o!=null)return this.convertAndCacheOnCPU(e);if(a==="string")return o;var Y,ne,ce=this.activeTimers!=null;return(ce&&(Y=fe()),a==="complex64")?ne=Ia(i.real.dataSync(),i.imag.dataSync()):ne=this.getValuesFromTexture(e),ce&&(this.downloadWaitMs+=fe()-Y),this.convertAndCacheOnCPU(e,ne)},r.prototype.read=function(e){return E(this,void 0,void 0,function(){var t,o,a,i,s,u,f,C,k,L,Y,ne,ce,se,le,xe,Ee,Ce,Te,Me,He,Be;return g(this,function(je){switch(je.label){case 0:if(this.pendingRead.has(e))return t=this.pendingRead.get(e),[2,new Promise(function(We){return t.push(We)})];if(o=this.texData.get(e),a=o.values,i=o.shape,s=o.slice,u=o.dtype,f=o.complexTensors,C=o.isPacked,s!=null)return k=void 0,k=C?new Ei(i,us):new zt(i,us),L=this.runWebGLProgram(k,[{dataId:e,shape:i,dtype:u}],u),Y=this.read(L.dataId),this.disposeData(L.dataId),[2,Y];if(a!=null)return[2,this.convertAndCacheOnCPU(e)];if(!p().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&p().getNumber("WEBGL_VERSION")===2)throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");return ne=null,u!=="complex64"&&p().get("WEBGL_BUFFER_SUPPORTED")&&(ce=this.decode(e),se=this.texData.get(ce.dataId),ne=(Be=this.gpgpu).createBufferFromTexture.apply(Be,[se.texture].concat(Or(i)))),this.pendingRead.set(e,[]),u==="complex64"?[3,2]:[4,this.gpgpu.createAndWaitForFence()];case 1:je.sent(),je.label=2;case 2:return u!=="complex64"?[3,4]:[4,Promise.all([f.real.data(),f.imag.data()])];case 3:return xe=je.sent(),Ee=xe[0],Ce=xe[1],le=Ia(Ee,Ce),[3,5];case 4:ne==null?le=this.getValuesFromTexture(e):(Te=de(i),le=this.gpgpu.downloadFloat32MatrixFromBuffer(ne,Te)),je.label=5;case 5:return ce!=null&&this.disposeData(ce.dataId),Me=this.convertAndCacheOnCPU(e,le),He=this.pendingRead.get(e),this.pendingRead.delete(e),He.forEach(function(We){return We(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(!Es(o))throw p().getBool("WEBGL_RENDER_FLOAT32_CAPABLE")?Error("The value "+o+" cannot be represented with your current settings. Consider enabling float32 rendering: 'tf.env().set('WEBGL_RENDER_FLOAT32_ENABLED', true);'"):Error("The value "+o+" cannot be represented on this device.")}},r.prototype.getValuesFromTexture=function(e){var t,o=this.texData.get(e),a=o.shape,i=o.dtype,s=o.isPacked,u=de(a);if(p().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")){var f=this.decode(e),C=this.texData.get(f.dataId),k=(t=this.gpgpu).downloadMatrixFromPackedTexture.apply(t,[C.texture].concat(Or(a))).subarray(0,u);return this.disposeData(f.dataId),k}var L=p().getBool("WEBGL_PACK")&&s===!0,Y=L?mo(a):a,ne=L?new Wn(Y):new to(Y),ce=this.runWebGLProgram(ne,[{shape:Y,dtype:i,dataId:e}],"float32"),se=this.texData.get(ce.dataId),le=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(se.texture,se.texShape[0],se.texShape[1]).subarray(0,u);return this.disposeData(ce.dataId),le},r.prototype.time=function(e){return E(this,void 0,void 0,function(){var t,o,a,i,s,u,f;return g(this,function(C){switch(C.label){case 0:return t=this.activeTimers,o=[],a=!1,this.programTimersStack==null?(this.programTimersStack=o,a=!0):this.activeTimers.push(o),this.activeTimers=o,e(),i=me(this.activeTimers.map(function(k){return k.query})).filter(function(k){return k!=null}),s=me(this.activeTimers.map(function(k){return k.name})).filter(function(k){return k!=null}),this.activeTimers=t,a&&(this.programTimersStack=null),u={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null},p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?[4,Promise.all(i)]:[3,2];case 1:return f=C.sent(),u.kernelMs=Z(f),u.getExtraProfileInfo=function(){return f.map(function(k,L){return{name:s[L],ms:k}}).map(function(k){return k.name+": "+k.ms}).join(", ")},[3,3];case 2:u.kernelMs={error:"WebGL query timers are not supported in this environment."},C.label=3;case 3:return this.uploadWaitMs=0,this.downloadWaitMs=0,[2,u]}})})},r.prototype.memory=function(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU}},r.prototype.startTimer=function(){return p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:fe(),endMs:null}},r.prototype.endTimer=function(e){return p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),e):(e.endMs=fe(),e)},r.prototype.getQueryTime=function(e){return E(this,void 0,void 0,function(){var t;return g(this,function(o){return p().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?[2,this.gpgpu.waitForQueryAndGetTime(e)]:[2,(t=e).endMs-t.startMs]})})},r.prototype.disposeData=function(e){if(!this.pendingDisposal.has(e)){if(this.pendingRead.has(e))return this.pendingDisposal.add(e),void this.pendingDeletes++;if(this.texData.has(e)){this.releaseGPUData(e);var t=this.texData.get(e).complexTensors;t!=null&&(t.real.dispose(),t.imag.dispose()),this.texData.delete(e)}}},r.prototype.releaseGPUData=function(e){var t=this.texData.get(e),o=t.texture,a=t.dtype,i=t.texShape,s=t.usage,u=t.isPacked,f=t.slice,C=f&&f.origDataId||e,k=this.dataRefCount.get(C);k>1?this.dataRefCount.set(C,k-1):(this.dataRefCount.delete(C),o!=null&&(this.numBytesInGPU-=this.computeBytes(i,a),this.textureManager.releaseTexture(o,i,s,u)));var L=this.texData.get(e);L.texture=null,L.texShape=null,L.isPacked=!1,L.slice=null},r.prototype.getTexture=function(e){return this.uploadToGPU(e),this.texData.get(e).texture},r.prototype.getDataInfo=function(e){return this.texData.get(e)},r.prototype.getCPUBackend=function(){return p().getBool("WEBGL_CPU_FORWARD")?(this.cpuBackend==null&&(this.cpuBackend=Ve.findBackend("cpu")),this.cpuBackend):null},r.prototype.shouldExecuteOnCPU=function(e,t){var o=this;return t===void 0&&(t=128),this.getCPUBackend()!=null&&e.every(function(a){return o.texData.get(a.dataId).texture==null&&a.size<t})},r.prototype.getGPGPUContext=function(){return this.gpgpu},r.prototype.complex=function(e,t){var o=this.makeOutput(e.shape,"complex64");return this.texData.get(o.dataId).complexTensors={real:Ve.keep(e.clone()),imag:Ve.keep(t.clone())},o},r.prototype.real=function(e){return this.texData.get(e.dataId).complexTensors.real.clone()},r.prototype.imag=function(e){return this.texData.get(e.dataId).complexTensors.imag.clone()},r.prototype.slice=function(e,t,o){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.slice(e,t,o);if(de(o)===0)return Ur([],o,e.dtype);var a=this.texData.get(e.dataId).isPacked,i=Qi(e.shape,t,o);if(a||!i){var s=p().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Md(o):new kd(o),u=s.getCustomSetupFunc(t);return this.compileAndRun(s,[e],null,u)}return this.uploadToGPU(e.dataId),this.shallowSlice(e,t,o)},r.prototype.shallowSlice=function(e,t,o){var a=this.texData.get(e.dataId),i=this.makeOutput(o,e.dtype),s=this.texData.get(i.dataId);Object.assign(s,a),s.shape=o,s.dtype=e.dtype;var u=Zi(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=Ca(t,o,a);if(i.some(function(u){return u===0}))return Ur([],i);var s=new Pd(t,a,i);return this.compileAndRun(s,[e])},r.prototype.reverse=function(e,t){var o=p().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Id(e.shape,t):new Rd(e.shape,t);return this.compileAndRun(o,[e])},r.prototype.concat=function(e,t){if(e[0].dtype==="complex64"){var o=e.map(function(Y){return sn(Y)}),a=e.map(function(Y){return wn(Y)});return br(this.concat(o,t),this.concat(a,t))}if(this.shouldExecuteOnCPU(e))return this.cpuBackend.concat(e,t);if(e.length===1)return e[0];if(e.length>p().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){var i=Math.floor(e.length/2),s=this.concat(e.slice(0,i),t),u=this.concat(e.slice(i),t);return this.concat([s,u],t)}if(p().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&e[0].rank>1){var f=new fr(e.map(function(Y){return Y.shape}),t);return this.compileAndRun(f,e)}var C=Jn(e.map(function(Y){return Y.shape}),t),k=e.map(function(Y){return Y.as2D(-1,de(Y.shape.slice(t)))}),L=new Kr(k.map(function(Y){return Y.shape}));return this.compileAndRun(L,k).reshape(C)},r.prototype.neg=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.neg(e);if(p().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,Mc,e.dtype);var t=new zt(e.shape,Mc);return this.compileAndRun(t,[e])},r.prototype.batchMatMul=function(e,t,o,a){var i=o?e.shape[2]:e.shape[1],s=a?t.shape[1]:t.shape[2],u=o?e.shape[1]:e.shape[2],f=e.shape[0];if((i===1||s===1)&&u>1e3){o&&(e=e.transpose([0,2,1])),a&&(t=t.transpose([0,2,1]));var C=s===1?e:e.as3D(f,u,1),k=s===1?2:1,L=s===1?t.as3D(f,1,u):t;return this.multiply(C,L).sum(k,!0)}var Y=nr(e.dtype,t.dtype),ne=new uu(e.shape,[f,i,s],o,a);return this.compileAndRun(ne,[e,t],Y)},r.prototype.fusedBatchMatMul=function(e){var t=e.a,o=e.b,a=e.transposeA,i=e.transposeB,s=e.bias,u=e.activation,f=e.preluActivationWeights,C=a?t.shape[2]:t.shape[1],k=i?o.shape[1]:o.shape[2],L=t.shape[0],Y=nr(t.dtype,o.dtype),ne=s!=null,ce=f!=null,se=u?ls(u,!0):null,le=new uu(t.shape,[L,C,k],a,i,ne,se,ce),xe=[t,o];return s&&xe.push(s),f&&xe.push(f),this.compileAndRun(le,xe,Y)},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 Bt(vt,e.shape,t.shape),s=new Bt(Ct,e.shape,t.shape),u=[this.makeComplexComponentTensorInfo(e,o.complexTensors.real),this.makeComplexComponentTensorInfo(e,o.complexTensors.imag),this.makeComplexComponentTensorInfo(t,a.complexTensors.real),this.makeComplexComponentTensorInfo(t,a.complexTensors.imag)],f=this.compileAndRun(i,u),C=this.compileAndRun(s,u),k=this.complex(f,C);return f.dispose(),C.dispose(),k}if(this.shouldExecuteOnCPU([e,t]))return this.cpuBackend.multiply(e,t);if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,or,e.dtype);var L=new Ut(or,e.shape,t.shape);return this.compileAndRun(L,[e,t],e.dtype)},r.prototype.batchNormalization=function(e,t,o,a,i,s){var u=[e,t,o],f=null;s!=null&&(f=s.shape,u.push(s));var C=null;if(i!=null&&(C=i.shape,u.push(i)),p().getBool("WEBGL_PACK_NORMALIZATION")){var k=new At(e.shape,t.shape,o.shape,f,C,a);return this.compileAndRun(k,u)}var L=new It(e.shape,t.shape,o.shape,f,C,a);return this.compileAndRun(L,u)},r.prototype.localResponseNormalization4D=function(e,t,o,a,i){var s=p().getBool("WEBGL_PACK_NORMALIZATION")?new pd(e.shape,t,o,a,i):new fd(e.shape,t,o,a,i);return this.compileAndRun(s,[e])},r.prototype.LRNGrad=function(e,t,o,a,i,s,u){var f=new hd(t.shape,a,i,s,u);return this.compileAndRun(f,[t,o,e])},r.prototype.tile=function(e,t){if(e.dtype==="string"){var o=this.readSync(e.dataId).map(function(i){return Qe(i)});return is(Lt(e.shape,e.dtype,o),t)}var a=new Ld(e.shape,t);return this.compileAndRun(a,[e])},r.prototype.pad=function(e,t,o){var a=p().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new wd(e.shape,t,o):new xd(e.shape,t,o);return this.compileAndRun(a,[e])},r.prototype.transpose=function(e,t){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.transpose(e,t);var o=p().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Bd(e.shape,t):new jd(e.shape,t);return this.compileAndRun(o,[e])},r.prototype.gather=function(e,t,o){if(this.shouldExecuteOnCPU([e,t]))return this.cpuBackend.gather(e,t,o);var a=new bi(e.shape,t.size,o);return this.compileAndRun(a,[e,t])},r.prototype.batchToSpaceND=function(e,t,o){_(e.rank<=4,function(){return"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet"});var a=t.reduce(function(k,L){return k*L}),i=Ho(e.shape,t,a),s=Jt(i.length,t.length),u=_a(e.shape,t,a),f=Xs(o,t.length),C=Ks(u,o,t.length);return e.reshape(i).transpose(s).reshape(u).slice(f,C)},r.prototype.spaceToBatchND=function(e,t,o){_(e.rank<=4,function(){return"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet"});var a=t.reduce(function(L,Y){return L*Y}),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=Ho(u.shape,t,a,!1),C=Jt(f.length,t.length,!1),k=_a(u.shape,t,a,!1);return u.reshape(f).transpose(C).reshape(k)},r.prototype.reduce=function(e,t,o){var a=e.shape[0],i=e.shape[1],s=ci(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=ci(i),u=new hc({windowSize:s,inSize:i,batchSize:a},t,o==null),f=[e];o!=null&&f.push(o);var C=this.compileAndRun(u,f,"int32");return C.shape[1]===1?C:this.argReduce(e,t,C)},r.prototype.argReducePacked=function(e,t,o){o===void 0&&(o=null);var a=o!=null?o.shape:e.shape,i=ci(a[a.length-1]),s=new bt(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){nn("sum",t,e.rank);var o=Gr(e.shape,t),a=o[0],i=de(o[1]),s=e.as2D(-1,i),u=pr(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=de(o[1]),s=e.as2D(-1,i),u=pr(e.dtype);return this.reduce(s,"prod",u).reshape(a)},r.prototype.unsortedSegmentSum=function(e,t,o){var a=0,i=an([a],e.rank),s=e;i!=null&&(s=e.transpose(i),a=hn(1,e.rank)[0]);var u=function(Y,ne,ce){for(var se=[],le=Y.length,xe=0;xe<le;xe++)xe!==ne?se.push(Y[xe]):se.push(ce);return se}(s.shape,a,o),f=de([s.shape[a]]),C=s.as2D(-1,f),k=pr(e.dtype),L=this.segOpCompute(C,"unsortedSegmentSum",t,k,o).reshape(u);return i!=null&&(L=L.transpose(yo(i))),L},r.prototype.segOpCompute=function(e,t,o,a,i){var s=e.shape[0],u=e.shape[1],f=function(L,Y){var ne,ce=!1;for(L<=$i?(ne=L,ce=!0):ne=ye(L,Math.floor(Math.sqrt(L)));!ce;)ne>Y||ne===L?ce=!0:ne=ye(L,ne+1);return ne}(u,i),C=new Nd({windowSize:f,inSize:u,batchSize:s,numSegments:i},t),k=this.compileAndRun(C,[e,o],a);return k.shape[1]===i?k:(o=pa(0,i).tile([u/f]),this.segOpCompute(k,t,o,a,i))},r.prototype.argMinMaxReduce=function(e,t,o){var a=[t];if(nn("arg"+o.charAt(0).toUpperCase()+o.slice(1),a,e.rank),!p().getBool("WEBGL_PACK_REDUCE")||e.rank<=2){var i=Gr(e.shape,a),s=i[0],u=de(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 Qt(e.shape,o,a);return this.compileAndRun(i,[e])},r.prototype.equal=function(e,t){if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
|
|
|
return vec4(equal(a, b));
|
|
|
`,"bool");var o=new Ut("return float(a == b);",e.shape,t.shape);return this.compileAndRun(o,[e,t],"bool")},r.prototype.notEqual=function(e,t){if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
|
|
|
return vec4(notEqual(a, b));
|
|
|
`,"bool");var o=new Ut("return float(a != b);",e.shape,t.shape);return this.compileAndRun(o,[e,t],"bool")},r.prototype.less=function(e,t){if(this.shouldExecuteOnCPU([e,t]))return this.cpuBackend.less(e,t);if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
|
|
|
return vec4(lessThan(a, b));
|
|
|
`,"bool");var o=new Ut("return float(a < b);",e.shape,t.shape);return this.compileAndRun(o,[e,t],"bool")},r.prototype.lessEqual=function(e,t){if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
|
|
|
return vec4(lessThanEqual(a, b));
|
|
|
`,"bool");var o=new Ut("return float(a <= b);",e.shape,t.shape);return this.compileAndRun(o,[e,t],"bool")},r.prototype.greater=function(e,t){if(this.shouldExecuteOnCPU([e,t]))return this.cpuBackend.greater(e,t);if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
|
|
|
return vec4(greaterThan(a, b));
|
|
|
`,"bool");var o=new Ut("return float(a > b);",e.shape,t.shape);return this.compileAndRun(o,[e,t],"bool")},r.prototype.greaterEqual=function(e,t){if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
|
|
|
return vec4(greaterThanEqual(a, b));
|
|
|
`,"bool");var o=new Ut("return float(a >= b);",e.shape,t.shape);return this.compileAndRun(o,[e,t],"bool")},r.prototype.logicalNot=function(e){var t=new zt(e.shape,"return float(!(x >= 1.0));");return this.compileAndRun(t,[e])},r.prototype.logicalAnd=function(e,t){if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
|
|
|
return vec4(
|
|
|
vec4(greaterThanEqual(a, vec4(1.0))) *
|
|
|
vec4(greaterThanEqual(b, vec4(1.0))));
|
|
|
`,"bool");var o=new Ut("return float(a >= 1.0 && b >= 1.0);",e.shape,t.shape);return this.compileAndRun(o,[e,t],"bool")},r.prototype.logicalOr=function(e,t){if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
|
|
|
return min(
|
|
|
vec4(greaterThanEqual(a, vec4(1.0))) +
|
|
|
vec4(greaterThanEqual(b, vec4(1.0))),
|
|
|
vec4(1.0));
|
|
|
`,"bool");var o=new Ut("return float(a >= 1.0 || b >= 1.0);",e.shape,t.shape);return this.compileAndRun(o,[e,t],"bool")},r.prototype.select=function(e,t,o){var a=new Dd(e.rank,t.shape,t.rank);return this.compileAndRun(a,[e,t,o],nr(t.dtype,o.dtype))},r.prototype.where=function(e){ha("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");var t=e.dataSync();return vi(e.shape,t)},r.prototype.topk=function(e,t,o){return ss(e.dataSync(),e.shape,e.dtype,t)},r.prototype.min=function(e,t){nn("min",t,e.rank);var o=Gr(e.shape,t),a=o[0],i=de(o[1]),s=e.as2D(-1,i);return this.reduce(s,"min",s.dtype).reshape(a)},r.prototype.minimum=function(e,t){if(this.shouldExecuteOnCPU([e,t]))return this.cpuBackend.minimum(e,t);var o=p().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new dr(`
|
|
|
vec4 result = vec4(min(a, b));
|
|
|
vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));
|
|
|
|
|
|
result.r = isNaN.r > 0. ? NAN : result.r;
|
|
|
result.g = isNaN.g > 0. ? NAN : result.g;
|
|
|
result.b = isNaN.b > 0. ? NAN : result.b;
|
|
|
result.a = isNaN.a > 0. ? NAN : result.a;
|
|
|
|
|
|
return result;
|
|
|
`,e.shape,t.shape):new Ut(`
|
|
|
if (isnan(a)) return a;
|
|
|
if (isnan(b)) return b;
|
|
|
|
|
|
return min(a, b);
|
|
|
`,e.shape,t.shape);return this.compileAndRun(o,[e,t])},r.prototype.mod=function(e,t){var o=p().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new dr(`
|
|
|
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);nn("max",t,e.rank);var o=Gr(e.shape,t),a=o[0],i=de(o[1]),s=e.as2D(-1,i);return this.reduce(s,"max",s.dtype).reshape(a)},r.prototype.maximum=function(e,t){if(this.shouldExecuteOnCPU([e,t]))return this.cpuBackend.maximum(e,t);var o=p().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new dr(`
|
|
|
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){nn("all",t,e.rank);var o=Gr(e.shape,t),a=o[0],i=de(o[1]),s=e.as2D(-1,i);return this.reduce(s,"all",s.dtype).reshape(a)},r.prototype.any=function(e,t){nn("any",t,e.rank);var o=Gr(e.shape,t),a=o[0],i=de(o[1]),s=e.as2D(-1,i);return this.reduce(s,"any",s.dtype).reshape(a)},r.prototype.realDivide=function(e,t){if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
|
|
|
// vec4 one = vec4(equal(a, b));
|
|
|
// return one + (vec4(1.0) - one) * a / b;
|
|
|
vec4 result = a / b;
|
|
|
if(a.x == b.x) {
|
|
|
result.x = 1.;
|
|
|
}
|
|
|
if(a.y == b.y) {
|
|
|
result.y = 1.;
|
|
|
}
|
|
|
if(a.z == b.z) {
|
|
|
result.z = 1.;
|
|
|
}
|
|
|
if(a.w == b.w) {
|
|
|
result.w = 1.;
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
`,"float32",!0);var o=new Ut(`
|
|
|
if (a == b) {
|
|
|
return 1.0;
|
|
|
};
|
|
|
return a / b;`,e.shape,t.shape);return this.compileAndRun(o,[e,t],"float32")},r.prototype.floorDiv=function(e,t){if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,`
|
|
|
ivec4 ia = round(a);
|
|
|
ivec4 ib = round(b);
|
|
|
bvec4 cond = notEqual(ib, ivec4(0));
|
|
|
ivec4 result = ivec4(0);
|
|
|
vec4 s = sign(a) * sign(b);
|
|
|
|
|
|
// Windows (D3D) wants guaranteed non-zero int division at compile-time.
|
|
|
if (cond[0]) {
|
|
|
result[0] = idiv(ia[0], ib[0], s[0]);
|
|
|
}
|
|
|
if (cond[1]) {
|
|
|
result[1] = idiv(ia[1], ib[1], s[1]);
|
|
|
}
|
|
|
if (cond[2]) {
|
|
|
result[2] = idiv(ia[2], ib[2], s[2]);
|
|
|
}
|
|
|
if (cond[3]) {
|
|
|
result[3] = idiv(ia[3], ib[3], s[3]);
|
|
|
}
|
|
|
return vec4(result);
|
|
|
`,"int32");var o=new Ut(`
|
|
|
float s = sign(a) * sign(b);
|
|
|
int ia = round(a);
|
|
|
int ib = round(b);
|
|
|
if (ib != 0) {
|
|
|
// Windows (D3D) wants guaranteed non-zero int division at compile-time.
|
|
|
return float(idiv(ia, ib, s));
|
|
|
} else {
|
|
|
return NAN;
|
|
|
}
|
|
|
`,e.shape,t.shape);return this.compileAndRun(o,[e,t],"int32")},r.prototype.add=function(e,t){if(e.dtype==="complex64"&&t.dtype==="complex64")return this.complexSeparableBinaryOp(e,t,lr);if(this.shouldExecuteOnCPU([e,t]))return this.cpuBackend.add(e,t);var o=nr(e.dtype,t.dtype);if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,lr,o);var a=new Ut(lr,e.shape,t.shape);return this.compileAndRun(a,[e,t],o)},r.prototype.packedUnaryOp=function(e,t,o){var a=new Ei(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 dr(o,e.shape,t.shape,i);return this.compileAndRun(s,[e,t],a)},r.prototype.complexSeparableBinaryOp=function(e,t,o){var a=this,i=this.texData.get(e.dataId),s=this.texData.get(t.dataId),u=[[i.complexTensors.real,s.complexTensors.real],[i.complexTensors.imag,s.complexTensors.imag]].map(function(L){var Y=L[0],ne=L[1],ce=a.makeComplexComponentTensorInfo(e,Y),se=a.makeComplexComponentTensorInfo(t,ne),le=new Ut(o,e.shape,t.shape);return a.compileAndRun(le,[ce,se],nr(Y.dtype,ne.dtype))}),f=u[0],C=u[1],k=this.complex(f,C);return f.dispose(),C.dispose(),k},r.prototype.makeComplexComponentTensorInfo=function(e,t){return{dataId:t.dataId,dtype:t.dtype,shape:e.shape}},r.prototype.addN=function(e){if(e.length===1)return e[0];if(e.length>p().get("WEBGL_MAX_TEXTURES_IN_SHADER")){var t=Math.floor(e.length/2),o=this.addN(e.slice(0,t)),a=this.addN(e.slice(t));return this.addN([o,a])}var i=e.map(function(f){return f.dtype}).reduce(function(f,C){return nr(f,C)}),s=e.map(function(f){return f.shape}),u=p().getBool("WEBGL_PACK")?new fc(e[0].shape,s):new iu(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,xr);if(this.shouldExecuteOnCPU([e,t]))return this.cpuBackend.subtract(e,t);var o=nr(e.dtype,t.dtype);if(p().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(e,t,xr,e.dtype);var a=new Ut(xr,e.shape,t.shape);return this.compileAndRun(a,[e,t],o)},r.prototype.pow=function(e,t){var o=p().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new dr(`
|
|
|
// isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.
|
|
|
vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1)));
|
|
|
vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);
|
|
|
vec4 result = multiplier * pow(abs(a), b);
|
|
|
|
|
|
// Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS
|
|
|
bvec4 isExpZero = equal(b, vec4(0.0));
|
|
|
result.r = isExpZero.r ? 1.0 : result.r;
|
|
|
result.g = isExpZero.g ? 1.0 : result.g;
|
|
|
result.b = isExpZero.b ? 1.0 : result.b;
|
|
|
result.a = isExpZero.a ? 1.0 : result.a;
|
|
|
|
|
|
vec4 isNaN = vec4(lessThan(a, vec4(0.0))) * vec4(lessThan(floor(b), b));
|
|
|
|
|
|
result.r = isNaN.r > 0. ? NAN : result.r;
|
|
|
result.g = isNaN.g > 0. ? NAN : result.g;
|
|
|
result.b = isNaN.b > 0. ? NAN : result.b;
|
|
|
result.a = isNaN.a > 0. ? NAN : result.a;
|
|
|
|
|
|
return result;
|
|
|
`,e.shape,t.shape):new Ut(`
|
|
|
if(a < 0.0 && floor(b) < b){
|
|
|
return NAN;
|
|
|
}
|
|
|
if (b == 0.0) {
|
|
|
return 1.0;
|
|
|
}
|
|
|
return (round(mod(b, 2.0)) != 1) ?
|
|
|
pow(abs(a), b) : sign(a) * pow(abs(a), b);
|
|
|
`,e.shape,t.shape),a=nr(e.dtype,t.dtype);return this.compileAndRun(o,[e,t],a)},r.prototype.ceil=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.ceil(e);if(p().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,Pc,e.dtype);var t=new zt(e.shape,Pc);return this.compileAndRun(t,[e])},r.prototype.floor=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.floor(e);if(p().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,Fc,e.dtype);var t=new zt(e.shape,Fc);return this.compileAndRun(t,[e])},r.prototype.sign=function(e){var t=new zt(e.shape,`
|
|
|
if (isnan(x)) { return 0.0; }
|
|
|
return sign(x);
|
|
|
`);return this.compileAndRun(t,[e])},r.prototype.isNaN=function(e){var t=new zt(e.shape,"return float(isnan(x));");return this.compileAndRun(t,[e],"bool")},r.prototype.isInf=function(e){var t=new zt(e.shape,"return float(isinf(x));");return this.compileAndRun(t,[e],"bool")},r.prototype.isFinite=function(e){var t=new zt(e.shape,"return float(!isnan(x) && !isinf(x));");return this.compileAndRun(t,[e],"bool")},r.prototype.round=function(e){var t=new zt(e.shape,`
|
|
|
// OpenGL ES does not support round function.
|
|
|
// The algorithm is based on banker's rounding.
|
|
|
float base = floor(x);
|
|
|
if ((x - base) < 0.5) {
|
|
|
return floor(x);
|
|
|
} else if ((x - base) > 0.5) {
|
|
|
return ceil(x);
|
|
|
} else {
|
|
|
if (mod(base, 2.0) == 0.0) {
|
|
|
return base;
|
|
|
} else {
|
|
|
return base + 1.0;
|
|
|
}
|
|
|
}
|
|
|
`);return this.compileAndRun(t,[e])},r.prototype.exp=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.exp(e);if(p().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,Lc,e.dtype);var t=new zt(e.shape,Lc);return this.compileAndRun(t,[e])},r.prototype.expm1=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.expm1(e);if(p().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,jc,e.dtype);var t=new zt(e.shape,jc);return this.compileAndRun(t,[e])},r.prototype.softmax=function(e,t){var o=ue([t],e.shape),a=this.max(e,o),i=Vr(a.shape,o),s=this.subtract(e,a.reshape(i)),u=this.exp(s),f=this.sum(u,o).reshape(i);return this.realDivide(u,f)},r.prototype.log=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.log(e);if(p().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,`
|
|
|
vec4 result = log(x);
|
|
|
vec4 isNaN = vec4(lessThan(x, vec4(0.0)));
|
|
|
result.r = isNaN.r == 1.0 ? NAN : result.r;
|
|
|
result.g = isNaN.g == 1.0 ? NAN : result.g;
|
|
|
result.b = isNaN.b == 1.0 ? NAN : result.b;
|
|
|
result.a = isNaN.a == 1.0 ? NAN : result.a;
|
|
|
|
|
|
return result;
|
|
|
`,e.dtype);var t=new zt(e.shape,`if (x < 0.0) return NAN;
|
|
|
return log(x);`);return this.compileAndRun(t,[e])},r.prototype.log1p=function(e){var t=new zt(e.shape,"return log(1.0 + x);");return this.compileAndRun(t,[e])},r.prototype.sqrt=function(e){var t=new zt(e.shape,"return sqrt(x);");return this.compileAndRun(t,[e])},r.prototype.rsqrt=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.rsqrt(e);var t=new zt(e.shape,"return inversesqrt(x);");return this.compileAndRun(t,[e])},r.prototype.reciprocal=function(e){var t=new zt(e.shape,"return 1.0 / x;");return this.compileAndRun(t,[e])},r.prototype.relu=function(e){var t;return t=p().getBool("WEBGL_PACK")?new Ei(e.shape,Bc):new zt(e.shape,Nc),this.compileAndRun(t,[e])},r.prototype.relu6=function(e){var t;return t=p().getBool("WEBGL_PACK")?new Ei(e.shape,Uc):new zt(e.shape,Dc),this.compileAndRun(t,[e])},r.prototype.prelu=function(e,t){var o=p().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new dr(kr,e.shape,t.shape):new Ut(Ht,e.shape,t.shape);return this.compileAndRun(o,[e,t])},r.prototype.elu=function(e){if(p().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,Wc,e.dtype);var t=new zt(e.shape,kc);return this.compileAndRun(t,[e])},r.prototype.eluDer=function(e,t){var o=p().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new dr(`
|
|
|
vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));
|
|
|
return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));
|
|
|
`,e.shape,t.shape):new Ut("return (b >= 1.0) ? a : a * (b + 1.0);",e.shape,t.shape);return this.compileAndRun(o,[e,t])},r.prototype.selu=function(e){var t=new zt(e.shape,Wd);return this.compileAndRun(t,[e])},r.prototype.int=function(e){var t=new zt(e.shape,"return float(int(x));");return this.compileAndRun(t,[e],"int32")},r.prototype.clip=function(e,t,o){var a,i=(a=p().getBool("WEBGL_PACK_CLIP")?new un(e.shape):new Xr(e.shape)).getCustomSetupFunc(t,o);return this.compileAndRun(a,[e],null,i)},r.prototype.abs=function(e){if(this.shouldExecuteOnCPU([e]))return this.cpuBackend.abs(e);if(p().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,Ic,e.dtype);var t=new zt(e.shape,Ic);return this.compileAndRun(t,[e])},r.prototype.complexAbs=function(e){var t=this.texData.get(e.dataId),o=new Rt(e.shape),a=[this.makeComplexComponentTensorInfo(e,t.complexTensors.real),this.makeComplexComponentTensorInfo(e,t.complexTensors.imag)];return this.compileAndRun(o,a)},r.prototype.sigmoid=function(e){var t=new zt(e.shape,"return 1.0 / (1.0 + exp(-1.0 * x));");return this.compileAndRun(t,[e])},r.prototype.softplus=function(e){var t=new zt(e.shape,`
|
|
|
float epsilon = 1.1920928955078125e-7;
|
|
|
float threshold = log(epsilon) + 2.0;
|
|
|
|
|
|
bool too_large = x > -threshold;
|
|
|
bool too_small = x < threshold;
|
|
|
|
|
|
float result;
|
|
|
float exp_x = exp(x);
|
|
|
|
|
|
if (too_large){
|
|
|
result = x;
|
|
|
}
|
|
|
else if (too_small){
|
|
|
result = exp_x;
|
|
|
}
|
|
|
else{
|
|
|
result = log(exp_x + 1.0);
|
|
|
}
|
|
|
return result;
|
|
|
`);return this.compileAndRun(t,[e])},r.prototype.sin=function(e){var t=new zt(e.shape,Hd);return this.compileAndRun(t,[e])},r.prototype.cos=function(e){var t=new zt(e.shape,zd);return this.compileAndRun(t,[e])},r.prototype.tan=function(e){var t=new zt(e.shape,"return tan(x);");return this.compileAndRun(t,[e])},r.prototype.asin=function(e){var t=new zt(e.shape,Gd);return this.compileAndRun(t,[e])},r.prototype.acos=function(e){var t=new zt(e.shape,Vd);return this.compileAndRun(t,[e])},r.prototype.atan=function(e){var t=new zt(e.shape,Xd);return this.compileAndRun(t,[e])},r.prototype.atan2=function(e,t){var o=p().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new dr(`
|
|
|
vec4 result = atan(a, b);
|
|
|
vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));
|
|
|
|
|
|
result.r = isNaN.r > 0. ? NAN : result.r;
|
|
|
result.g = isNaN.g > 0. ? NAN : result.g;
|
|
|
result.b = isNaN.b > 0. ? NAN : result.b;
|
|
|
result.a = isNaN.a > 0. ? NAN : result.a;
|
|
|
|
|
|
return result;
|
|
|
`,e.shape,t.shape):new Ut(`
|
|
|
if (isnan(a)) return a;
|
|
|
if (isnan(b)) return b;
|
|
|
|
|
|
return atan(a, b);
|
|
|
`,e.shape,t.shape);return this.compileAndRun(o,[e,t])},r.prototype.sinh=function(e){var t=new zt(e.shape,`
|
|
|
float e2x = exp(x);
|
|
|
return (e2x - 1.0 / e2x) / 2.0;
|
|
|
`);return this.compileAndRun(t,[e])},r.prototype.cosh=function(e){var t=new zt(e.shape,`
|
|
|
float e2x = exp(-x);
|
|
|
return (e2x + 1.0 / e2x) / 2.0;
|
|
|
`);return this.compileAndRun(t,[e])},r.prototype.tanh=function(e){var t=new zt(e.shape,`
|
|
|
float e2x = exp(-2.0 * abs(x));
|
|
|
return sign(x) * (1.0 - e2x) / (1.0 + e2x);
|
|
|
`);return this.compileAndRun(t,[e])},r.prototype.asinh=function(e){var t=new zt(e.shape,Kd);return this.compileAndRun(t,[e])},r.prototype.acosh=function(e){var t=new zt(e.shape,Yd);return this.compileAndRun(t,[e])},r.prototype.atanh=function(e){var t=new zt(e.shape,$d);return this.compileAndRun(t,[e])},r.prototype.erf=function(e){var t=new zt(e.shape,`
|
|
|
// Error function is calculated approximately with elementary function.
|
|
|
// See "Handbook of Mathematical Functions with Formulas,
|
|
|
// Graphs, and Mathematical Tables", Abramowitz and Stegun.
|
|
|
float p = 0.3275911;
|
|
|
float a1 = 0.254829592;
|
|
|
float a2 = -0.284496736;
|
|
|
float a3 = 1.421413741;
|
|
|
float a4 = -1.453152027;
|
|
|
float a5 = 1.061405429;
|
|
|
|
|
|
float sign = sign(x);
|
|
|
x = abs(x);
|
|
|
float t = 1.0 / (1.0 + p * x);
|
|
|
return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x));
|
|
|
`);return this.compileAndRun(t,[e])},r.prototype.step=function(e,t){var o=new zt(e.shape,function(a){return a===void 0&&(a=0),Nn+`
|
|
|
return x > 0.0 ? 1.0 : float(`+a+`);
|
|
|
`}(t));return this.compileAndRun(o,[e])},r.prototype.conv2dByMatMul=function(e,t,o,a,i,s){var u=e.shape,f=this.texData.get(e.dataId),C=o.inChannels,k=u[0]*u[1]*u[2],L=o.outChannels,Y=o.dataFormat==="channelsLast",ne=(k===1||L===1)&&C>1e3,ce=u[2]%2!=0&&!!f.isPacked;if(ne||!p().getBool("WEBGL_LAZILY_UNPACK")||!p().getBool("WEBGL_PACK_BINARY_OPERATIONS")||!ce){var se=Y?u[0]*u[1]*u[2]:u[0]*u[2]*u[3],le=this.reshape(e,[1,se,o.inChannels]),xe=this.reshape(t,[1,o.inChannels,o.outChannels]);return this.reshape(this.fusedBatchMatMul({a:le,b:xe,transposeA:!1,transposeB:!1,bias:a,activation:i,preluActivationWeights:s}),o.outShape)}var Ee=Y?u[0]*u[1]*(u[2]+1):u[0]*u[2]*(u[3]+1),Ce={dataId:e.dataId,shape:[1,Ee,o.inChannels],dtype:e.dtype},Te=f.shape;f.shape=f.shape.slice(),f.shape[f.shape.length-2]++,_(vo(f.shape,Ce.shape),function(){return"packed reshape "+f.shape+" to "+Ce.shape+" isn't free"});var Me=this.reshape(t,[1,o.inChannels,o.outChannels]),He=this.fusedBatchMatMul({a:Ce,b:Me,transposeA:!1,transposeB:!1,bias:a,activation:i,preluActivationWeights:s}),Be=this.texData.get(He.dataId);return _(Be.isPacked,function(){return"batchMatMul result is expected to be packed"}),f.shape=Te,Be.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,C=o.inChannels,k=o.outWidth,L=o.outHeight,Y=o.dataFormat==="channelsLast",ne=u*f*C,ce=L*k,se=[ne,ce],le=e.squeeze([0]),xe=t.reshape([1,ne,-1]),Ee=new dd(se,le.shape,o),Ce=this.compileAndRun(Ee,[le]).reshape([1,se[0],se[1]]),Te=a!=null,Me=s!=null,He=i?ls(i,!0):null,Be=new uu(Ce.shape,[1,ce,o.outChannels],!0,!1,Te,He,Me),je=[Ce,xe];a&&je.push(a),Me&&je.push(s);var We=this.compileAndRun(Be,je);return Y?We.reshape([1,L,k,o.outChannels]):We.reshape([1,o.outChannels,L,k])},r.prototype.fusedConv2d=function(e){var t=e.input,o=e.filter,a=e.convInfo,i=e.bias,s=e.activation,u=e.preluActivationWeights;if(a.filterHeight===1&&a.filterWidth===1&&a.dilationHeight===1&&a.dilationWidth===1&&a.strideHeight===1&&a.strideWidth===1&&(a.padInfo.type==="SAME"||a.padInfo.type==="VALID"))return this.conv2dByMatMul(t,o,a,i,s,u);if(p().getBool("WEBGL_CONV_IM2COL")&&t.shape[0]===1)return this.conv2dWithIm2Row(t,o,a,i,s,u);var f=i!=null,C=u!=null,k=s?ls(s,!1):null,L=new kt(a,f,k,C),Y=[t,o];return i&&Y.push(i),u&&Y.push(u),this.compileAndRun(L,Y)},r.prototype.conv2d=function(e,t,o){if(o.filterHeight===1&&o.filterWidth===1&&o.dilationHeight===1&&o.dilationWidth===1&&o.strideHeight===1&&o.strideWidth===1&&(o.padInfo.type==="SAME"||o.padInfo.type==="VALID"))return this.conv2dByMatMul(e,t,o);if(p().getBool("WEBGL_CONV_IM2COL")&&e.shape[0]===1)return this.conv2dWithIm2Row(e,t,o);var a=new kt(o);return this.compileAndRun(a,[e,t])},r.prototype.conv2dDerInput=function(e,t,o){var a=new Cn(o);return this.compileAndRun(a,[e,t])},r.prototype.conv2dDerFilter=function(e,t,o){var a=new Un(o);return this.compileAndRun(a,[e,t])},r.prototype.fusedDepthwiseConv2D=function(e){var t,o=e.input,a=e.filter,i=e.convInfo,s=e.bias,u=e.activation,f=e.preluActivationWeights,C=p().getBool("WEBGL_PACK_DEPTHWISECONV")&&i.strideWidth<=2&&i.outChannels/i.inChannels==1,k=u?ls(u,C):null,L=[o,a],Y=s!=null,ne=f!=null;return Y&&L.push(s),ne&&L.push(f),C?(t=new cn(i,Y,k,ne),this.compileAndRun(t,L)):(t=new gr(i,Y,k,ne),this.compileAndRun(t,L))},r.prototype.depthwiseConv2D=function(e,t,o){var a;return p().getBool("WEBGL_PACK_DEPTHWISECONV")&&o.strideWidth<=2&&o.outChannels/o.inChannels==1?(a=new cn(o),this.compileAndRun(a,[e,t])):(a=new gr(o),this.compileAndRun(a,[e,t]))},r.prototype.depthwiseConv2DDerInput=function(e,t,o){var a=new vr(o);return this.compileAndRun(a,[e,t])},r.prototype.depthwiseConv2DDerFilter=function(e,t,o){var a=new $o(o);return this.compileAndRun(a,[e,t])},r.prototype.conv3d=function(e,t,o){var a=new Gt(o);return this.compileAndRun(a,[e,t])},r.prototype.conv3dDerInput=function(e,t,o){var a=new So(o);return this.compileAndRun(a,[e,t])},r.prototype.conv3dDerFilter=function(e,t,o){var a=new Yo(o);return this.compileAndRun(a,[e,t])},r.prototype.maxPool=function(e,t){var o=new cu(t,"max",!1);return this.compileAndRun(o,[e])},r.prototype.avgPool=function(e,t){var o=new cu(t,"avg",!1);return this.compileAndRun(o,[e],"float32")},r.prototype.maxPoolBackprop=function(e,t,o,a){var i=new cu(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 Et(o);return this.compileAndRun(a,[e],t.dtype)},r.prototype.cast=function(e,t){return hi(e,t,this)},r.prototype.unstack=function(e,t){for(var o=e.shape[t],a=new Array(e.rank-1),i=0,s=0;s<e.rank;s++)s!==t&&(a[i++]=e.shape[s]);var u=new Array(e.rank).fill(0),f=e.shape.slice();f[t]=1;var C=new Array(o);for(s=0;s<C.length;s++)u[t]=s,C[s]=this.slice(e,u,f).reshape(a);return C},r.prototype.avgPool3d=function(e,t){var o=new lu(t,"avg",!1);return this.compileAndRun(o,[e],"float32")},r.prototype.avgPool3dBackprop=function(e,t,o){var a=new Tt(o);return this.compileAndRun(a,[e],t.dtype)},r.prototype.maxPool3d=function(e,t){var o=new lu(t,"max",!1);return this.compileAndRun(o,[e],"float32")},r.prototype.maxPool3dBackprop=function(e,t,o,a){var i=new lu(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&&!vo(e.shape,t)&&(o.texture===null||!vo(o.shape,t))){var a=this.packedReshape(e,t);return Ve.makeTensorFromDataId(a.dataId,a.shape,a.dtype)}return Ra(e,t)},r.prototype.resizeBilinear=function(e,t,o,a){var i=p().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new Sd(e.shape,t,o,a):new Td(e.shape,t,o,a);return this.compileAndRun(i,[e],"float32")},r.prototype.resizeBilinearBackprop=function(e,t,o){var a=new Cd(e,t,o);return this.compileAndRun(a,[e])},r.prototype.resizeNearestNeighbor=function(e,t,o,a){var i=new Od(e.shape,t,o,a);return this.compileAndRun(i,[e])},r.prototype.resizeNearestNeighborBackprop=function(e,t,o){var a=new Ad(e,t,o);return this.compileAndRun(a,[e])},r.prototype.multinomial=function(e,t,o,a){var i=t?e:Go(e),s=i.shape[0],u=i.shape[1],f=new gd(s,u,o),C=f.getCustomSetupFunc(a);return this.compileAndRun(f,[i],"int32",C)},r.prototype.oneHot=function(e,t,o,a){var i=new yd(e.size,t,o,a);return this.compileAndRun(i,[e])},r.prototype.diag=function(e){var t=new wr(e.size);return this.compileAndRun(t,[e])},r.prototype.nonMaxSuppression=function(e,t,o,a,i){return ha("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead"),pi(e.dataSync(),t.dataSync(),o,a,i)},r.prototype.cropAndResize=function(e,t,o,a,i,s){var u=new qt(e.shape,t.shape,a,i,s);return this.compileAndRun(u,[e,t,o],"float32")},r.prototype.depthToSpace=function(e,t,o){_(t>1,function(){return"blockSize should be > 1 for depthToSpace, but was: "+t});var a=e.shape[0],i=o==="NHWC"?e.shape[1]:e.shape[2],s=o==="NHWC"?e.shape[2]:e.shape[3],u=o==="NHWC"?e.shape[3]:e.shape[1],f=i*t,C=s*t,k=u/(t*t),L=new sr(o==="NHWC"?[a,f,C,k]:[a,k,f,C],t,o);return this.compileAndRun(L,[e])},r.prototype.split=function(e,t,o){return as(e,t,o)},r.prototype.scatterND=function(e,t,o){var a=zo(0,e,o),i=a.sliceRank,s=a.numUpdates,u=a.sliceSize,f=a.strides,C=a.outputSize,k=[C/u,u],L=e.reshape([s,i]),Y=t.reshape([s,u]);if(C===0)return Ra(Ur([]),o);var ne=Nt(0),ce=new Ac(s,i,L.rank,Y.rank,f,k);return this.compileAndRun(ce,[Y,L,ne]).reshape(o)},r.prototype.sparseToDense=function(e,t,o,a){var i=zo(0,e,o),s=i.sliceRank,u=i.numUpdates,f=i.strides,C=i.outputSize,k=new Ac(u,s,e.rank,t.rank,f,[C,1],!1);return this.compileAndRun(k,[t,e,a]).reshape(o)},r.prototype.fft=function(e){return this.fftImpl(e,!1)},r.prototype.ifft=function(e){return this.fftImpl(e,!0)},r.prototype.fftImpl=function(e,t){var o=this.texData.get(e.dataId),a=new Da(Na,e.shape,t),i=new Da(gi,e.shape,t),s=[this.makeComplexComponentTensorInfo(e,o.complexTensors.real),this.makeComplexComponentTensorInfo(e,o.complexTensors.imag)],u=this.compileAndRun(a,s),f=this.compileAndRun(i,s),C=this.complex(u,f).as2D(e.shape[0],e.shape[1]);return u.dispose(),f.dispose(),C},r.prototype.gatherND=function(e,t){var o=t.shape,a=o[o.length-1],i=Yi(e,t),s=i[0],u=i[1],f=i[2],C=i[3],k=t.reshape([u,a]),L=e.reshape([e.size/f,f]),Y=new yr(a,C,[u,f]);return this.compileAndRun(Y,[L,k]).reshape(s)},r.prototype.fill=function(e,t,o){if((o=o||ot(t))==="string"){var a=De(o,de(e));return a.fill(t),Ve.makeTensor(a,e,o,this)}var i=new yi(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 ts(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=[ho(e.shape)].concat(po(e.shape)),a={dtype:e.dtype,shape:o,dataId:e.dataId},i=[ho(t)].concat(po(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=mo(i);return t=a?new Zt(u):new ur(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===Po.DENSE){var C=Or(e.outputShape);f.texShape=C.map(function(Ee){return 2*Ee})}if(e.outTexUsage!=null&&(f.usage=e.outTexUsage),de(u.shape)===0)return f.values=Se(u.dtype,0),u;var k=[],L=t.map(function(Ee){if(Ee.dtype==="complex64")throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");var Ce=s.texData.get(Ee.dataId);if(Ce.texture==null){if(!e.packedInputs&&de(Ee.shape)<=p().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:Ee.shape,texData:null,isUniform:!0,uniformValues:Ce.values};e.packedInputs&&(Ce.isPacked=!0,Ce.shape=Ee.shape)}else if(!!Ce.isPacked!=!!e.packedInputs)Ee=Ce.isPacked?s.unpackTensor(Ee):s.packTensor(Ee),k.push(Ee),Ce=s.texData.get(Ee.dataId);else if(Ce.isPacked&&!vo(Ce.shape,Ee.shape)){var Te=Ee,Me=Ee.shape;Ee.shape=Ce.shape,Ee=s.packedReshape(Ee,Me),k.push(Ee),Ce=s.texData.get(Ee.dataId),Te.shape=Me}return s.uploadToGPU(Ee.dataId),{shape:Ee.shape,texData:Ce,isUniform:!1}});this.uploadToGPU(u.dataId);var Y,ne={shape:u.shape,texData:f,isUniform:!1},ce=function(Ee,Ce,Te){var Me="";Ce.concat(Te).forEach(function(je){var We=je.texData!=null&&je.texData.slice!=null&&je.texData.slice.flatOffset>0,Ze=je.isUniform?"uniform":je.texData.texShape;Me+=je.shape+"_"+Ze+"_"+We});var He=Ee.userCode,Be=Ee.constructor.name;return Be+="_"+Me+"_"+He}(e,L,ne),se=this.getAndSaveBinary(ce,function(){return function(Ee,Ce,Te,Me){var He=Ce.userCode,Be=Te.map(function(ct,xt){var wt={logicalShape:ct.shape,texShape:ct.isUniform?null:ct.texData.texShape,isUniform:ct.isUniform,isPacked:!ct.isUniform&&ct.texData.isPacked,flatOffset:null};return ct.texData!=null&&ct.texData.slice!=null&&ct.texData.slice.flatOffset>0&&(wt.flatOffset=ct.texData.slice.flatOffset),{name:Ce.variableNames[xt],shapeInfo:wt}}),je=Be.map(function(ct){return ct.shapeInfo}),We={logicalShape:Me.shape,texShape:Me.texData.texShape,isUniform:!1,isPacked:Me.texData.isPacked,flatOffset:null},Ze=P(Be,We,He,Ce.packedInputs),Je=Ee.createProgram(Ze),ht=null,lt=Ee.getUniformLocation(Je,"NAN",!1);p().getNumber("WEBGL_VERSION")===1&&(ht=Ee.getUniformLocation(Je,"INFINITY",!1));for(var ut={},gt=0;gt<Ce.variableNames.length;gt++){var mt=Ce.variableNames[gt];ut[mt]=Ee.getUniformLocation(Je,mt,!1),ut["offset"+mt]=Ee.getUniformLocation(Je,"offset"+mt,!1)}return{program:Ce,source:Ze,webGLProgram:Je,uniformLocations:ut,inShapeInfos:je,outShapeInfo:We,infLoc:ht,nanLoc:lt}}(s.gpgpu,e,L,ne)}),le=this.activeTimers!=null;if(le&&(Y=this.startTimer()),function(Ee,Ce,Te,Me,He){Sc(Ce.inShapeInfos,Te),Sc([Ce.outShapeInfo],[Me]);var Be=Me.texData.texture,je=Me.texData.texShape;Me.texData.isPacked?Ee.setOutputPackedMatrixTexture(Be,je[0],je[1]):Ee.setOutputMatrixTexture(Be,je[0],je[1]),Ee.setProgram(Ce.webGLProgram),p().getNumber("WEBGL_VERSION")===1&&Ce.infLoc!==null&&Ee.gl.uniform1f(Ce.infLoc,1/0),Ce.nanLoc!==null&&Ee.gl.uniform1f(Ce.nanLoc,NaN),Te.forEach(function(We,Ze){var Je=Ce.program.variableNames[Ze],ht=Ce.uniformLocations[Je],lt=Ce.uniformLocations["offset"+Je];if(ht!=null)if(We.isUniform)if(de(We.shape)<2)Ee.gl.uniform1f(ht,We.uniformValues[0]);else{var ut=We.uniformValues;ut instanceof Float32Array||(ut=new Float32Array(ut)),Ee.gl.uniform1fv(ht,ut)}else We.texData.slice!=null&<!=null&&Ee.gl.uniform1i(lt,We.texData.slice.flatOffset),Ee.setInputMatrixTexture(We.texData.texture,ht,Ze)}),He!=null&&He(Ee,Ce.webGLProgram),Ee.executeProgram()}(this.gpgpu,se,L,ne,a),k.forEach(function(Ee){return s.disposeData(Ee.dataId)}),le&&(Y=this.endTimer(Y),this.activeTimers.push({name:e.constructor.name,query:this.getQueryTime(Y)})),!p().getBool("WEBGL_LAZILY_UNPACK")&&f.isPacked&&i===!1){var xe=this.unpackTensor(u);return this.disposeData(u.dataId),xe}return u},r.prototype.compileAndRun=function(e,t,o,a,i){i===void 0&&(i=!1),o=o||t[0].dtype;var s=this.runWebGLProgram(e,t,o,a,i);return Ve.makeTensorFromDataId(s.dataId,s.shape,s.dtype)},r.prototype.getAndSaveBinary=function(e,t){return e in this.binaryCache||(this.binaryCache[e]=t()),this.binaryCache[e]},r.prototype.getTextureManager=function(){return this.textureManager},r.prototype.dispose=function(){var e=this;this.disposed||(p().getBool("IS_TEST")||Object.keys(this.binaryCache).forEach(function(t){e.gpgpu.deleteProgram(e.binaryCache[t].webGLProgram),delete e.binaryCache[t]}),this.textureManager.dispose(),this.canvas!=null&&typeof HTMLCanvasElement!="undefined"&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0)},r.prototype.floatPrecision=function(){var e=this;return this.floatPrecisionValue==null&&(this.floatPrecisionValue=Rr(function(){if(!p().get("WEBGL_RENDER_FLOAT32_ENABLED")){var t=p().getBool("DEBUG");p().set("DEBUG",!1);var o=e.abs(Nt(1e-8)).dataSync()[0];if(p().set("DEBUG",t),o>0)return 32}return 16})),this.floatPrecisionValue},r.prototype.epsilon=function(){return this.floatPrecision()===32?1e-7:1e-4},r.prototype.uploadToGPU=function(e){var t,o=this.texData.get(e),a=o.shape,i=o.dtype,s=o.values,u=o.texture,f=o.usage,C=o.isPacked;if(u==null){var k,L=this.activeTimers!=null;L&&(k=fe());var Y=o.texShape;if(Y==null&&(Y=Ni(a,C),o.texShape=Y),s!=null){var ne=mo(a),ce=void 0,se=Y[1],le=Y[0],xe=s instanceof Uint8Array;C?(se=(t=Yn(Y[0],Y[1]))[0],le=t[1],ce=new Br(ne,[le,se],xe)):ce=new Jo(ne,[le,se],xe);var Ee=this.makeTensorInfo([le,se],i);this.texData.get(Ee.dataId).usage=xe?Wr.PIXELS:Wr.UPLOAD,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(Ee.dataId),se,le,s);var Ce=this.runWebGLProgram(ce,[Ee],i,null,!0),Te=this.texData.get(Ce.dataId);o.texture=Te.texture,o.texShape=Te.texShape,o.isPacked=Te.isPacked,o.usage=Te.usage,this.disposeData(Ee.dataId),this.texData.delete(Ce.dataId),o.values=null,L&&(this.uploadWaitMs+=fe()-k)}else{var Me=this.acquireTexture(Y,f,i,C);o.texture=Me}}},r.prototype.convertAndCacheOnCPU=function(e,t){var o=this.texData.get(e),a=o.dtype;return this.releaseGPUData(e),t!=null&&(o.values=function(i,s){if(s==="float32"||s==="complex64")return i;if(s==="int32"||s==="bool"){for(var u=s==="int32"?new Int32Array(i.length):new Uint8Array(i.length),f=0;f<u.length;++f)u[f]=Math.round(i[f]);return u}throw new Error("Unknown dtype "+s)}(t,a)),o.values},r.prototype.acquireTexture=function(e,t,o,a){if(this.numBytesInGPU+=this.computeBytes(e,o),!this.warnedAboutMemory&&this.numBytesInGPU>1024*this.numMBBeforeWarning*1024){var i=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn("High memory usage in GPU: "+i+" MB, most likely due to a memory leak")}return this.textureManager.acquireTexture(e,t,a)},r.prototype.computeBytes=function(e,t){return e[0]*e[1]*dt(t)},r}(Sa);Xa()&&Ve.registerBackend("webgl",function(){return new Hc},2);var Zd=Xe({square_:function(n){var r=Oe(n,"x","square"),e=[r];return Ve.runKernelFunc(function(t,o){return o([r]),t.square(r)},{x:r},null,"Square",{},e,[])}}),_i="SquaredDifference",zc=Xe({squaredDifference_:function(n,r){var e,t=Oe(n,"a","squaredDifference"),o=Oe(r,"b","squaredDifference");e=cr(t,o),t=e[0],o=e[1],Wt(t.shape,o.shape);var a={a:t,b:o},i=[t,o];return Ve.runKernelFunc(function(s,u){var f=s.squaredDifference(t,o);return u([t,o]),f},a,function(s,u){var f=u[0],C=u[1],k=Nt(2);return{a:function(){return s.mul(f.sub(C).mul(k))},b:function(){return s.mul(C.sub(f).mul(k))}}},_i,{},i,[])}}),ef=Xe({abs_:function(n){var r=Oe(n,"x","abs");return r.dtype==="complex64"?Ve.runKernelFunc(function(e){return e.complexAbs(r)},{$x:r}):Ve.runKernelFunc(function(e,t){var o=e.abs(r);return t([r]),o},{x:r},function(e,t){var o=t[0];return{x:function(){return e.mul(o.toFloat().step(-1))}}},"Abs")}}),tf=Xe({acos_:function(n){var r=Oe(n,"x","acos");return Ve.runKernelFunc(function(e,t){var o=e.acos(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.divStrict(Nt(1).sub(o.toFloat().square()).sqrt()).neg()}}})}}),rf=Xe({acosh_:function(n){var r=Oe(n,"x","acosh");return Ve.runKernelFunc(function(e,t){var o=e.acosh(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.divStrict(o.toFloat().square().sub(1).sqrt())}}})}}),nf=Xe({asin_:function(n){var r=Oe(n,"x","asin");return Ve.runKernelFunc(function(e,t){var o=e.asin(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.divStrict(Nt(1).sub(o.toFloat().square()).sqrt())}}})}}),of=Xe({asinh_:function(n){var r=Oe(n,"x","asinh");return Ve.runKernelFunc(function(e,t){var o=e.asinh(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.divStrict(Nt(1).add(o.toFloat().square()).sqrt())}}})}}),af=Xe({atan_:function(n){var r=Oe(n,"x","atan");return Ve.runKernelFunc(function(e,t){var o=e.atan(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.div(o.toFloat().square().add(1))}}})}}),sf=Xe({atanh_:function(n){var r=Oe(n,"x","atanh");return Ve.runKernelFunc(function(e,t){var o=e.atanh(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.div(Nt(1).sub(o.toFloat().square()))}}})}}),uf=Xe({ceil_:function(n){var r=Oe(n,"x","ceil");return Ve.runKernelFunc(function(e){return e.ceil(r)},{$x:r},function(e){return{$x:function(){return $t(e)}}})}}),Gc=Xe({clipByValue_:function(n,r,e){var t=Oe(n,"x","clipByValue");_(r<=e,function(){return"Error in clip: min ("+r+") must be less than or equal to max ("+e+")."});var o=[t],a={min:r,max:e};return Ve.runKernelFunc(function(i,s){var u=i.clip(t,r,e);return s([t]),u},{x:t},function(i,s){var u=s[0];return{x:function(){return i.where(u.greaterEqual(r).logicalAnd(u.lessEqual(e)),$t(i))}}},"ClipByValue",a,o)}}),cf=Xe({cos_:function(n){var r=Oe(n,"x","cos"),e=[r];return Ve.runKernelFunc(function(t,o){var a=t.cos(r);return o([r]),a},{x:r},function(t,o){var a=o[0];return{x:function(){return a.toFloat().sin().neg().mul(t)}}},"Cos",{},e)}}),lf=Xe({cosh_:function(n){var r=Oe(n,"x","cosh");return Ve.runKernelFunc(function(e,t){var o=e.cosh(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return o.toFloat().sinh().mulStrict(e)}}})}}),df=Xe({erf_:function(n){var r=Oe(n,"x","erf");return _(r.dtype==="int32"||r.dtype==="float32",function(){return"Input dtype must be `int32` or `float32`."}),r.dtype==="int32"&&(r=r.toFloat()),Ve.runKernelFunc(function(e,t){var o=e.erf(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.mul(o.square().neg().exp().mul(2/Math.sqrt(Math.PI)))}}})}}),Vc=Xe({exp_:function(n){var r=Oe(n,"x","exp");return Ve.runKernelFunc(function(e,t){var o=e.exp(r);return t([o]),o},{x:r},function(e,t){return{x:function(){return e.mulStrict(t[0])}}},"Exp",{},[],[!0])}}),ff=Xe({expm1_:function(n){var r=Oe(n,"x","expm1");return Ve.runKernelFunc(function(e,t){var o=e.expm1(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.mul(o.exp())}}})}}),hf=Xe({floor_:function(n){var r=Oe(n,"x","floor");return Ve.runKernelFunc(function(e){return e.floor(r)},{$x:r},function(e){return{$x:function(){return $t(e)}}})}}),pf=Xe({log_:function(n){var r=Oe(n,"x","log"),e=[r];return Ve.runKernelFunc(function(t,o){var a=t.log(r);return o([r]),a},{x:r},function(t,o){var a=o[0];return{x:function(){return t.div(a.toFloat())}}},"Log",{},e)}}),mf=Xe({log1p_:function(n){var r=Oe(n,"x","log1p");return Ve.runKernelFunc(function(e,t){var o=e.log1p(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.div(o.add(1))}}})}}),vf=Xe({logSigmoid_:function(n){var r=Oe(n,"x","logSigmoid");return Ve.runKernelFunc(function(e,t){var o=e.softplus(r.neg()).neg();return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.mul(o.neg().sigmoid())}}})}}),pu=Xe({neg_:function(n){var r=Oe(n,"x","neg"),e=[r];return Ve.runKernelFunc(function(t){return t.neg(r)},{x:r},function(t){return{x:function(){return t.neg()}}},"Neg",{},e)}}),gf=Xe({reciprocal_:function(n){var r=Oe(n,"x","reciprocal");return Ve.runKernelFunc(function(e,t){var o=e.reciprocal(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.div(o.square().neg())}}})}}),yf=Xe({round_:function(n){var r=Oe(n,"x","round");return Ve.runKernelFunc(function(e){return e.round(r)},{$x:r},function(e){return{$x:function(){return $t(e)}}})}}),Xc=Xe({rsqrt_:function(n){var r=Oe(n,"x","rsqrt"),e=[r];return Ve.runKernelFunc(function(t,o){var a=t.rsqrt(r);return o([r]),a},{x:r},function(t,o){var a=o[0];return{x:function(){return t.div(a.pow(1.5).mul(2)).neg()}}},"Rsqrt",{},e)}}),Kc=Xe({sigmoid_:function(n){var r=Oe(n,"x","sigmoid");return Ve.runKernelFunc(function(e,t){var o=e.sigmoid(r);return t([o]),o},{x:r},function(e,t){var o=t[0];return{x:function(){return e.mul(o.mul(Nt(1).sub(o)))}}},"Sigmoid")}}),bf=Xe({sign_:function(n){var r=Oe(n,"x","sign");return Ve.runKernelFunc(function(e){return e.sign(r)},{$x:r},function(e){return{$x:function(){return $t(e)}}})}}),xf=Xe({isNaN_:function(n){var r=Oe(n,"x","isNaN");return Ve.runKernelFunc(function(e){return e.isNaN(r)},{$x:r},function(e){return{$x:function(){return $t(e)}}})}}),wf=Xe({isInf_:function(n){var r=Oe(n,"x","isInf");return Ve.runKernelFunc(function(e){return e.isInf(r)},{$x:r},function(e){return{$x:function(){return $t(e)}}})}}),Ef=Xe({isFinite_:function(n){var r=Oe(n,"x","isFinite");return Ve.runKernelFunc(function(e){return e.isFinite(r)},{$x:r},function(e){return{$x:function(){return $t(e)}}})}}),_f=Xe({sin_:function(n){var r=Oe(n,"x","sin"),e=[r];return Ve.runKernelFunc(function(t,o){var a=t.sin(r);return o([r]),a},{x:r},function(t,o){var a=o[0];return{x:function(){return a.toFloat().cos().mul(t)}}},"Sin",{},e)}}),Cf=Xe({sinh_:function(n){var r=Oe(n,"x","sinh");return Ve.runKernelFunc(function(e,t){var o=e.sinh(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return o.toFloat().cosh().mulStrict(e)}}})}}),Tf=Xe({softplus_:function(n){var r=Oe(n,"x","softplus");return Ve.runKernelFunc(function(e,t){var o=e.softplus(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.mul(o.sigmoid())}}})}}),Sf=Xe({sqrt_:function(n){var r=Oe(n,"x","sqrt");return Ve.runKernelFunc(function(e,t){var o=e.sqrt(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.div(o.toFloat().sqrt().mul(2))}}})}}),Af=Xe({step_:function(n,r){r===void 0&&(r=0);var e=Oe(n,"x","step");return Ve.runKernelFunc(function(t){return t.step(e,r)},{$x:e},function(t){return{$x:function(){return $t(t)}}})}}),Of=Xe({tan_:function(n){var r=Oe(n,"x","tan");return Ve.runKernelFunc(function(e,t){var o=e.tan(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return e.div(o.cos().square())}}})}}),Rf=Xe({tanh_:function(n){var r=Oe(n,"x","tanh");return Ve.runKernelFunc(function(e,t){var o=e.tanh(r);return t([o]),o},{x:r},function(e,t){var o=t[0];return{x:function(){return Nt(1).sub(o.square()).mulStrict(e)}}},"Tanh",{},null,[!0])}});function Yc(n,r,e,t,o,a){var i,s,u=Oe(n,"x","batchNorm"),f=Oe(r,"mean","batchNorm"),C=Oe(e,"variance","batchNorm");return o!=null&&(i=Oe(o,"scale","batchNorm")),t!=null&&(s=Oe(t,"offset","batchNorm")),_(u.rank===2,function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+u.rank+"."}),_(f.rank===2||f.rank===1,function(){return"Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank "+f.rank+"."}),_(C.rank===2||C.rank===1,function(){return"Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank "+C.rank+"."}),i!=null&&_(i.rank===2||i.rank===1,function(){return"Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank "+i.rank+"."}),s!=null&&_(s.rank===2||s.rank===1,function(){return"Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank "+s.rank+"."}),Ci(u,f,C,s,i,a)}function $c(n,r,e,t,o,a){var i,s,u=Oe(n,"x","batchNorm"),f=Oe(r,"mean","batchNorm"),C=Oe(e,"variance","batchNorm");return o!=null&&(i=Oe(o,"scale","batchNorm")),t!=null&&(s=Oe(t,"offset","batchNorm")),_(u.rank===3,function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+u.rank+"."}),_(f.rank===3||f.rank===1,function(){return"Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank "+f.rank+"."}),_(C.rank===3||C.rank===1,function(){return"Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank "+C.rank+"."}),i!=null&&_(i.rank===3||i.rank===1,function(){return"Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank "+i.rank+"."}),s!=null&&_(s.rank===3||s.rank===1,function(){return"Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank "+s.rank+"."}),Ci(u,f,C,s,i,a)}function Jc(n,r,e,t,o,a){var i,s,u=Oe(n,"x","batchNorm"),f=Oe(r,"mean","batchNorm"),C=Oe(e,"variance","batchNorm");return o!=null&&(i=Oe(o,"scale","batchNorm")),t!=null&&(s=Oe(t,"offset","batchNorm")),_(u.rank===4,function(){return"Error in batchNorm4D: x must be rank 4 but got rank "+u.rank+"."}),_(f.rank===4||f.rank===1,function(){return"Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank "+f.rank+"."}),_(C.rank===4||C.rank===1,function(){return"Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank "+C.rank+"."}),i!=null&&_(i.rank===4||i.rank===1,function(){return"Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank "+i.rank+"."}),s!=null&&_(s.rank===4||s.rank===1,function(){return"Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank "+s.rank+"."}),Ci(u,f,C,s,i,a)}function Ci(n,r,e,t,o,a){a==null&&(a=.001);var i,s,u,f=Oe(n,"x","batchNorm"),C=Oe(r,"mean","batchNorm"),k=Oe(e,"variance","batchNorm");o!=null&&(i=Oe(o,"scale","batchNorm")),t!=null&&(s=Oe(t,"offset","batchNorm")),_(C.rank===k.rank,function(){return"Batch normalization gradient requires mean and variance to have equal ranks."}),_(s==null||C.rank===s.rank,function(){return"Batch normalization gradient requires mean and offset to have equal ranks."}),_(i==null||C.rank===i.rank,function(){return"Batch normalization gradient requires mean and scale to have equal ranks."}),u=f.rank===0||f.rank===1?f.as4D(1,1,1,f.size):f.rank===2?f.as4D(1,1,f.shape[0],f.shape[1]):f.rank===3?f.as4D(1,f.shape[0],f.shape[1],f.shape[2]):f;var L=[f,C,k,i];return Ve.runKernelFunc(function(Y,ne){var ce=Y.batchNormalization(u,ds(C),ds(k),a,ds(i),ds(s));return ne([f,C,k,i]),ce},{x:f,mean:C,variance:k,scale:i,offset:s},function(Y,ne){var ce=ne,se=ce[0],le=ce[1],xe=ce[2],Ee=ce[3],Ce=Ee==null?Nt(1):Ee,Te=Ir(le.shape,u.shape),Me=[];if(le.rank===1){for(var He=0;He<u.shape.length-1;++He)Me.push(u.shape[He]);Me.push(1)}var Be=se.sub(le),je=Y.mul(Ce),We=Xc(xe.add(Nt(a))),Ze=We.mul(We).mul(We).mul(Nt(-.5));return{x:function(){return le.rank===1?Y.mul(Zn(We.as4D(1,1,1,le.shape[0]),Me)).mul(Ce).reshape(se.shape):Y.mul(We).mul(Ce).reshape(se.shape)},mean:function(){var Je=We.mul(Nt(-1)).mul(je);return le.rank===1&&(Je=Je.sum(Te)),Je.reshape(le.shape)},variance:function(){var Je=Ze.mul(Be).mul(je);return le.rank===1&&(Je=Je.sum(Te)),Je.reshape(le.shape)},scale:function(){var Je=Be.mul(We),ht=Y.mul(Je);return le.rank===1&&(ht=ht.sum(Te)),ht.reshape(le.shape)},offset:function(){var Je=Y;return le.rank===1&&(Je=Je.sum(Te)),Je.reshape(le.shape)}}},"BatchNormalization",{varianceEpsilon:a},L).reshape(f.shape)}function ds(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 fs(){Li("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon")}var If=Xe({batchNormalization2d_:function(n,r,e,t,o,a){return t===void 0&&(t=.001),fs(),Yc(n,r,e,a,o,t)}}),Nf=Xe({batchNormalization3d_:function(n,r,e,t,o,a){return t===void 0&&(t=.001),fs(),$c(n,r,e,a,o,t)}}),Df=Xe({batchNormalization4d_:function(n,r,e,t,o,a){return t===void 0&&(t=.001),fs(),Jc(n,r,e,a,o,t)}}),kf=Xe({batchNormalization_:function(n,r,e,t,o,a){return t===void 0&&(t=.001),fs(),Ci(n,r,e,a,o,t)}}),qc=Xe({batchNorm_:Ci}),Mf=Xe({batchNorm2d_:Yc}),Pf=Xe({batchNorm3d_:$c}),Ff=Xe({batchNorm4d_:Jc}),hs=Xe({logicalAnd_:function(n,r){var e=Oe(n,"a","logicalAnd","bool"),t=Oe(r,"b","logicalAnd","bool");return Wt(e.shape,t.shape),Ve.runKernelFunc(function(o){return o.logicalAnd(e,t)},{a:e,b:t},null,"LogicalAnd")}}),Lf=Xe({logicalNot_:function(n){var r=Oe(n,"x","logicalNot","bool");return Ve.runKernelFunc(function(e){return e.logicalNot(r)},{$x:r})}}),Qc=Xe({logicalOr_:function(n,r){var e=Oe(n,"a","logicalOr","bool"),t=Oe(r,"b","logicalOr","bool");return Wt(e.shape,t.shape),Ve.runKernelFunc(function(o){return o.logicalOr(e,t)},{$a:e,$b:t})}}),jf=Xe({logicalXor_:function(n,r){var e=Oe(n,"a","logicalXor","bool"),t=Oe(r,"b","logicalXor","bool");return Wt(e.shape,t.shape),Qc(n,r).logicalAnd(hs(n,r).logicalNot())}}),Qo=Xe({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?_(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 $t(u).toFloat()},$a:function(){return i.mul(u.cast(i.dtype))},$b:function(){return i.mul(u.logicalNot().cast(i.dtype))}}})}}),Zc=function(n){return E(this,void 0,void 0,function(){var r,e,t;return g(this,function(o){switch(o.label){case 0:return[4,(r=Oe(n,"condition","whereAsync","bool")).data()];case 1:return e=o.sent(),t=vi(r.shape,e),n!==r&&r.dispose(),[2,t]}})})},Zo=Xe({add_:function(n,r){var e,t=Oe(n,"a","add"),o=Oe(r,"b","add");e=cr(t,o),t=e[0],o=e[1];var a=Wt(t.shape,o.shape);return Ve.runKernelFunc(function(i){return i.add(t,o)},{a:t,b:o},function(i){return{a:function(){var s=i,u=Ir(t.shape,a);return u.length>0&&(s=s.sum(u)),s.reshape(t.shape)},b:function(){var s=i,u=Ir(o.shape,a);return u.length>0&&(s=s.sum(u)),s.reshape(o.shape)}}},"Add")}}),Bf=Xe({addN_:function(n){_(Array.isArray(n),function(){return"The argument passed to tf.addN() must be a list of tensors"}),_(n.length>=1,function(){return"Must pass at least one tensor to tf.addN(), but got "+n.length});var r=n.map(function(o,a){return Oe(o,"tensors"+a,"addN")}),e=r[0];r.forEach(function(o){if(o.dtype!==e.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),r.forEach(function(o){if(!we(o.shape,e.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});var t=r;return Ve.runKernelFunc(function(o){return o.addN(r)},t,function(o){var a={};return r.forEach(function(i,s){a[s]=function(){return o.clone()}}),a},"AddN")}}),Uf=Xe({addStrict_:function(n,r){var e=Oe(n,"a","addStrict"),t=Oe(r,"b","addStrict");return X(e.shape,t.shape,"Error in addStrict: "),e.add(t)}}),Wf=Xe({atan2_:function(n,r){var e,t=Oe(n,"a","atan2"),o=Oe(r,"b","atan2");e=cr(t,o),t=e[0],o=e[1];var a=Wt(t.shape,o.shape);return Ve.runKernelFunc(function(i,s){var u=i.atan2(t,o);return s([t,o]),u},{$a:t,$b:o},function(i,s){var u=s[0],f=s[1];return{$a:function(){var C=Zo(u.square(),f.square()),k=i.mul(f.div(C)),L=Ir(u.shape,a);return L.length>0&&(k=k.sum(L)),k.reshape(u.shape)},$b:function(){var C=Zo(u.square(),f.square()),k=pu(i.mul(u.div(C))),L=Ir(f.shape,a);return L.length>0&&(k=k.sum(L)),k.reshape(f.shape)}}})}}),ps=Xe({div_:function(n,r){var e,t=Oe(n,"a","div"),o=Oe(r,"b","div");if(e=cr(t,o),t=e[0],o=e[1],t.dtype==="int32"&&o.dtype==="int32")return el(t,o);var a=Wt(t.shape,o.shape);return Ve.runKernelFunc(function(i,s){var u=i.realDivide(t,o);return s([t,o]),u},{a:t,b:o},function(i,s){var u=s[0],f=s[1];return{a:function(){var C=i.div(f.toFloat()),k=Ir(u.shape,a);return k.length>0?C.sum(k).reshape(u.shape):C},b:function(){var C=i.mul(u.toFloat()),k=Ir(f.shape,a);k.length>0&&(C=C.sum(k).reshape(f.shape));var L=f.square();return C.div(L.toFloat()).neg()}}},"Div")}}),Hf=Xe({divNoNan_:function(n,r){var e,t=Oe(n,"a","div"),o=Oe(r,"b","div");t=(e=cr(t,o))[0],o=e[1];var a=ps(t,o),i=$t(a),s=o.equal(i);return Qo(s,i,a)}}),zf=Xe({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=Xe({floorDiv_:function(n,r){var e,t=Oe(n,"a","floorDiv"),o=Oe(r,"b","floorDiv");e=cr(t,o),t=e[0],o=e[1];var a=Wt(t.shape,o.shape);return Ve.runKernelFunc(function(i,s){var u=i.floorDiv(t,o);return s([t,o]),u},{a:t,b:o},function(i,s){var u=s[0],f=s[1];return{a:function(){var C=i.div(f.toFloat()),k=Ir(u.shape,a);return k.length>0?C.sum(k).reshape(u.shape):C},b:function(){var C=i.mul(u.toFloat()),k=Ir(f.shape,a);k.length>0&&(C=C.sum(k).reshape(f.shape));var L=f.square();return C.div(L.toFloat()).neg()}}},"FloorDiv")}}),mu=Xe({maximum_:function(n,r){var e,t=Oe(n,"a","maximum"),o=Oe(r,"b","maximum");return e=cr(t,o),t=e[0],o=e[1],t.dtype==="bool"&&(t=t.toInt(),o=o.toInt()),Wt(t.shape,o.shape),Ve.runKernelFunc(function(a,i){var s=a.maximum(t,o);return i([t,o]),s},{a:t,b:o},function(a,i){var s=i[0],u=i[1];return{a:function(){return a.mul(s.greaterEqual(u).toFloat())},b:function(){return a.mul(s.less(u).toFloat())}}},"Maximum")}}),Gf=Xe({maximumStrict_:function(n,r){var e=Oe(n,"a","maximumStrict"),t=Oe(r,"b","maximumStrict");return X(e.shape,t.shape,"Error in maximumStrict: "),e.maximum(t)}}),tl=Xe({minimum_:function(n,r){var e,t=Oe(n,"a","minimum"),o=Oe(r,"b","minimum");return e=cr(t,o),t=e[0],o=e[1],t.dtype==="bool"&&(t=t.toInt(),o=o.toInt()),Wt(t.shape,o.shape),Ve.runKernelFunc(function(a,i){var s=a.minimum(t,o);return i([t,o]),s},{a:t,b:o},function(a,i){var s=i[0],u=i[1];return{a:function(){return a.mul(s.lessEqual(u).toFloat())},b:function(){return a.mul(s.greater(u).toFloat())}}},"Minimum")}}),Vf=Xe({minimumStrict_:function(n,r){var e=Oe(n,"a","minimumStrict"),t=Oe(r,"b","minimumStrict");return X(e.shape,t.shape,"Error in minimumStrict: "),e.minimum(t)}}),Xf=Xe({mod_:function(n,r){var e,t=Oe(n,"a","mod"),o=Oe(r,"b","mod");e=cr(t,o),t=e[0],o=e[1];var a=Wt(t.shape,o.shape);return Ve.runKernelFunc(function(i,s){var u=i.mod(t,o);return s([t,o]),u},{$a:t,$b:o},function(i,s){var u=s[0],f=s[1];return{$a:function(){var C=Ir(u.shape,a);return C.length>0?i.sum(C).reshape(u.shape):i},$b:function(){var C=i.mul(u.div(f).floor().neg()),k=Ir(f.shape,a);return k.length>0?C.sum(k).reshape(f.shape):C}}})}}),Kf=Xe({modStrict_:function(n,r){var e=Oe(n,"a","modStrict"),t=Oe(r,"b","modStrict");return X(e.shape,t.shape,"Error in modStrict: "),e.mod(t)}}),ea=Xe({mul_:function(n,r){var e,t=Oe(n,"a","mul"),o=Oe(r,"b","mul");e=cr(t,o),t=e[0],o=e[1];var a=Wt(t.shape,o.shape);return Ve.runKernelFunc(function(i,s){var u=i.multiply(t,o);return s([t,o]),u},{a:t,b:o},function(i,s){var u=s[0],f=s[1];return{a:function(){var C=i.mul(f.toFloat()),k=Ir(u.shape,a);return k.length>0?C.sum(k).reshape(u.shape):C},b:function(){var C=i.mul(u.toFloat()),k=Ir(f.shape,a);return k.length>0?C.sum(k).reshape(f.shape):C}}},"Mul")}}),Yf=Xe({mulStrict_:function(n,r){var e=Oe(n,"a","mul"),t=Oe(r,"b","mul");return X(e.shape,t.shape,"Error in multiplyStrict: "),e.mul(t)}}),ms=Xe({pow_:function(n,r){var e,t=Oe(n,"base","pow"),o=Oe(r,"exp","pow");e=cr(t,o),t=e[0],o=e[1];var a=Wt(t.shape,o.shape),i=[t,o];return Ve.runKernelFunc(function(s,u){var f=s.pow(t,o);return u([t,o,f]),f},{a:t,b:o},function(s,u){var f=u[0],C=u[1],k=u[2];return{a:function(){var L=C.toFloat(),Y=s.mul(L.mul(f.pow(L.sub(Nt(1))))),ne=Ir(f.shape,a);return ne.length>0&&(Y=Y.sum(ne)),Y.reshape(f.shape)},b:function(){var L=f.greater(0),Y=f.log().where(L,$t(f)),ne=s.mul(k.mul(Y)),ce=Ir(C.shape,a);return ce.length>0&&(ne=ne.sum(ce)),ne.reshape(C.shape)}}},"Pow",{},i,[!0])}}),$f=Xe({powStrict_:function(n,r){return X(n.shape,r.shape,"Error in powStrict: "),n.pow(r)}}),Jf=Xe({squaredDifferenceStrict_:function(n,r){var e=Oe(n,"a","squaredDifferenceStrict"),t=Oe(r,"b","squaredDifferenceStrict");return X(e.shape,t.shape,"Error in squaredDifferenceStrict: "),e.squaredDifference(t)}}),Oo=Xe({sub_:function(n,r){var e,t=Oe(n,"a","sub"),o=Oe(r,"b","sub");e=cr(t,o),t=e[0],o=e[1];var a=Wt(t.shape,o.shape);return Ve.runKernelFunc(function(i){return i.subtract(t,o)},{a:t,b:o},function(i){return{a:function(){var s=i,u=Ir(t.shape,a);return u.length>0&&(s=s.sum(u)),s.reshape(t.shape)},b:function(){var s=i,u=Ir(o.shape,a);return u.length>0&&(s=s.sum(u)),s.neg().reshape(o.shape)}}},"Sub")}}),qf=Xe({subStrict_:function(n,r){var e=Oe(n,"a","subStrict"),t=Oe(r,"b","subStrict");return X(e.shape,t.shape,"Error in subStrict: "),e.sub(t)}}),rl=Xe({equal_:function(n,r){var e,t=Oe(n,"a","equal"),o=Oe(r,"b","equal");return e=cr(t,o),t=e[0],o=e[1],Wt(t.shape,o.shape),Ve.runKernelFunc(function(a){return a.equal(t,o)},{$a:t,$b:o})}}),Qf=Xe({equalStrict_:function(n,r){var e=Oe(n,"a","equalStrict"),t=Oe(r,"b","equalStrict");return X(e.shape,t.shape,"Error in equalStrict: "),e.equal(t)}}),Zf=Xe({greater_:function(n,r){var e,t=Oe(n,"a","greater"),o=Oe(r,"b","greater");return e=cr(t,o),t=e[0],o=e[1],Wt(t.shape,o.shape),Ve.runKernelFunc(function(a){return a.greater(t,o)},{a:t,b:o},null,"Greater")}}),nl=Xe({greaterEqual_:function(n,r){var e,t=Oe(n,"a","greaterEqual"),o=Oe(r,"b","greaterEqual");return e=cr(t,o),t=e[0],o=e[1],Wt(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 $t(s)},b:function(){return $t(u)}}},"GreaterEqual")}}),eh=Xe({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=Xe({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=Xe({less_:function(n,r){var e,t=Oe(n,"a","less"),o=Oe(r,"b","less");return e=cr(t,o),t=e[0],o=e[1],Wt(t.shape,o.shape),Ve.runKernelFunc(function(a){return a.less(t,o)},{a:t,b:o},null,"Less")}}),nh=Xe({lessEqual_:function(n,r){var e,t=Oe(n,"a","lessEqual"),o=Oe(r,"b","lessEqual");return e=cr(t,o),t=e[0],o=e[1],Wt(t.shape,o.shape),Ve.runKernelFunc(function(a,i){var s=a.lessEqual(t,o);return i([t,o]),s},{a:t,b:o},null,"LessEqual")}}),oh=Xe({lessEqualStrict_:function(n,r){var e=Oe(n,"a","lessEqualStrict"),t=Oe(r,"b","lessEqualStrict");return X(e.shape,t.shape,"Error in lessEqualStrict: "),e.lessEqual(t)}}),ah=Xe({lessStrict_:function(n,r){var e=Oe(n,"a","lessStrict"),t=Oe(r,"b","lessStrict");return X(e.shape,t.shape,"Error in lessStrict: "),e.less(t)}}),ih=Xe({notEqual_:function(n,r){var e,t=Oe(n,"a","notEqual"),o=Oe(r,"b","notEqual");return e=cr(t,o),t=e[0],o=e[1],Wt(t.shape,o.shape),Ve.runKernelFunc(function(a){return a.notEqual(t,o)},{a:t,b:o},null,"NotEqual")}}),sh=Xe({notEqualStrict_:function(n,r){var e=Oe(n,"a","notEqualStrict"),t=Oe(r,"b","notEqualStrict");return 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 vu=Xe({gather_:function(n,r,e){e===void 0&&(e=0);var t=Oe(n,"x","gather"),o=Oe(r,"indices","gather","int32");e=ue(e,t.shape)[0];var a=function(i,s,u){for(var f=i.shape[u],C=[],k=1,L=1,Y=0;Y<u;Y++)C.push(i.shape[Y]),k*=i.shape[Y];for(Y=0;Y<s.rank;Y++)C.push(s.shape[Y]);for(Y=u+1;Y<i.rank;Y++)C.push(i.shape[Y]),L*=i.shape[Y];return{batchSize:k,sliceSize:L,dimSize:f,outputShape:C}}(t,o,e);return Ve.runKernelFunc(function(i,s){var u=i.gather(t,o.flatten(),e);return s([o]),u},{x:t,indices:o},function(i,s){var u=s[0];return{x:function(){var f=t.shape,C=u.size,k=f.slice(0,e),L=k.length,Y=f.slice(e,f.length).slice(1),ne=Y.length,ce=ol(0,L),se=ol(L+1,L+1+ne),le=al([k,[C],Y]),xe=i.reshape(le),Ee=u.reshape([C]),Ce=al([[L],ce,se]),Te=xe.transpose(Ce),Me=il(Te,Ee,t.shape[e]),He=yo(Ce);return Me=Me.transpose(He)},indices:function(){return u}}},"Gather",{axis:e}).reshape(a.outputShape)}}),il=Xe({unsortedSegmentSum_:function(n,r,e){var t=Oe(n,"x","unsortedSegmentSum"),o=Oe(r,"segmentIds","unsortedSegmentSum","int32");return _(ge(e),function(){return"numSegments must be of dtype int"}),Ve.runKernelFunc(function(a,i){var s=a.unsortedSegmentSum(t,o,e);return i([o]),s},{$x:t},function(a,i){var s=i[0];return{$x:function(){return function(u,f){for(var C=mu(f,$t(f)),k=vu(u,C),L=nl(f,Nt(0,"int32")),Y=k.rank-L.rank,ne=0;ne<Y;++ne)L=In(L,ne+1);L=hs(L,Mn(k.shape,"bool"));var ce=$t(k);return Qo(L,k,ce)}(a,s)}}})}}),uh=function(n,r,e){return E(this,void 0,void 0,function(){var t,o,a,i,s,u,f,C,k,L,Y,ne,ce;return g(this,function(se){switch(se.label){case 0:for(t=Oe(n,"tensor","boolMask"),o=Oe(r,"mask","boolMask","bool"),a=e==null?0:e,i=o.rank,s=t.shape,_(i>0,function(){return"mask cannot be scalar"}),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 C=s.slice(0,a).concat([u],s.slice(a+i)),k=t.reshape(C),L=o.reshape([-1]),[4,Zc(L)];case 1:return Y=se.sent(),ne=Y.squeeze([1]),ce=vu(k,ne,a),n!==t&&t.dispose(),r!==o&&o.dispose(),ne.dispose(),k.dispose(),L.dispose(),Y.dispose(),[2,ce]}})})};function sl(n,r,e,t,o,a,i){a===void 0&&(a="NHWC"),_(n.length===r.rank,function(){return"Length of inShape ("+n.length+") and rank of dy ("+r.rank+") must match"});var s=n,u=r,f=!1;r.rank===3&&(f=!0,u=r.as4D(1,r.shape[0],r.shape[1],r.shape[2]),s=[1,n[0],n[1],n[2]]),_(s.length===4,function(){return"Error in conv2dDerInput: inShape must be length 4, but got length "+s.length+"."}),_(u.rank===4,function(){return"Error in conv2dDerInput: dy must be rank 4, but got rank "+u.rank}),_(e.rank===4,function(){return"Error in conv2dDerInput: filter must be rank 4, but got rank "+e.rank});var C=a==="NHWC"?s[3]:s[1],k=a==="NHWC"?u.shape[3]:u.shape[1];_(C===e.shape[2],function(){return"Error in conv2dDerInput: depth of input ("+C+") must match input depth for filter "+e.shape[2]+"."}),_(k===e.shape[3],function(){return"Error in conv2dDerInput: depth of output ("+k+") must match output depth for filter "+e.shape[3]+"."}),i!=null&&_(ge(o),function(){return"Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+o+"."});var L=fi(a),Y=jn(s,e.shape,t,1,o,i,!1,L),ne=Ve.runKernelFunc(function(ce,se){var le=ce.conv2dDerInput(u,e,Y);return se([e,u]),le},{dy4D:u,filter:e},function(ce,se){var le=se[0],xe=se[1];return{dy4D:function(){return Pa(ce,le,t,o,a,1,i)},filter:function(){return yu(ce,xe,le.shape,t,o,a,i)}}});return f?ne.as3D(ne.shape[1],ne.shape[2],ne.shape[3]):ne}function gu(n){var r=function(a){return typeof a=="number"?[a,a,a]:a.length===2?[a[0],a[1],1]:a}(n),e=r[0],t=r[1],o=r[2];return e===1&&t===1&&o===1}function ul(n,r,e,t,o){_(n.length===r.rank,function(){return"Length of inShape ("+n.length+") and rank of dy ("+r.rank+") must match"});var a=n,i=r,s=!1;r.rank===4&&(s=!0,i=r.as5D(1,r.shape[0],r.shape[1],r.shape[2],r.shape[3]),a=[1,n[0],n[1],n[2],n[3]]);var u=a[4],f=i.shape[4];_(a.length===5,function(){return"Error in conv3dDerInput: inShape must be length 5, but got length "+a.length+"."}),_(i.rank===5,function(){return"Error in conv3dDerInput: dy must be rank 5, but got rank "+i.rank}),_(e.rank===5,function(){return"Error in conv3dDerInput: filter must be rank 5, but got rank "+e.rank}),_(u===e.shape[3],function(){return"Error in conv3dDerInput: depth of input ("+u+") must match input depth for filter "+e.shape[3]+"."}),_(f===e.shape[4],function(){return"Error in conv3dDerInput: depth of output ("+f+") must match output depth for filter "+e.shape[4]+"."});var C=Co(a,e.shape,t,1,o),k=Ve.runKernelFunc(function(L){return L.conv3dDerInput(i,e,C)},{dy5D:i});return s?k.as4D(k.shape[1],k.shape[2],k.shape[3],k.shape[4]):k}var ch=Xe({conv1d_:function(n,r,e,t,o,a,i){o===void 0&&(o="NWC"),a===void 0&&(a=1);var s=Oe(n,"x","conv1d"),u=Oe(r,"filter","conv1d"),f=s,C=!1;s.rank===2&&(C=!0,f=s.as3D(1,s.shape[0],s.shape[1])),_(f.rank===3,function(){return"Error in conv1d: input must be rank 3, but got rank "+f.rank+"."}),_(u.rank===3,function(){return"Error in conv1d: filter must be rank 3, but got rank "+u.rank+"."}),i!=null&&_(ge(t),function(){return"Error in conv1d: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+t+"."}),_(f.shape[2]===u.shape[1],function(){return"Error in conv1d: depth of input ("+f.shape[2]+") must match input depth for filter "+u.shape[1]+"."}),_(Zr(e,a),function(){return"Error in conv1D: Either stride or dilation must be 1. Got stride "+e+" and dilation '"+a+"'"}),_(o==="NWC",function(){return"Error in conv1d: got dataFormat of "+o+" but only NWC is currently supported."});var k=u.as4D(1,u.shape[0],u.shape[1],u.shape[2]),L=f.as4D(f.shape[0],1,f.shape[1],f.shape[2]),Y=Pa(L,k,[1,e],t,"NHWC",[1,a],i);return C?Y.as2D(Y.shape[2],Y.shape[3]):Y.as3D(Y.shape[0],Y.shape[2],Y.shape[3])}}),Pa=Xe({conv2d_:function(n,r,e,t,o,a,i){o===void 0&&(o="NHWC"),a===void 0&&(a=[1,1]);var s=Oe(n,"x","conv2d"),u=Oe(r,"filter","conv2d"),f=s,C=!1;s.rank===3&&(C=!0,f=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),_(f.rank===4,function(){return"Error in conv2d: input must be rank 4, but got rank "+f.rank+"."}),_(u.rank===4,function(){return"Error in conv2d: filter must be rank 4, but got rank "+u.rank+"."}),i!=null&&_(ge(t),function(){return"Error in conv2d: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+t+"."});var k=o==="NHWC"?f.shape[3]:f.shape[1];_(k===u.shape[2],function(){return"Error in conv2d: depth of input ("+k+") must match input depth for filter "+u.shape[2]+"."}),_(Zr(e,a),function(){return"Error in conv2D: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+a+"'"});var L=fi(o),Y=jn(f.shape,u.shape,e,a,t,i,!1,L),ne=[u,f],ce=Ve.runKernelFunc(function(se,le){var xe=se.conv2d(f,u,Y);return le([u,f]),xe},{x:f,filter:u},function(se,le){var xe=le,Ee=xe[0],Ce=xe[1];return _(To(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(Ce.shape,se,Ee,e,t,o)},filter:function(){return yu(Ce,se,Ee.shape,e,t,o)}}},"Conv2D",Y,ne);return C?ce.as3D(ce.shape[1],ce.shape[2],ce.shape[3]):ce}}),lh=Xe({conv3d_:function(n,r,e,t,o,a){o===void 0&&(o="NDHWC"),a===void 0&&(a=[1,1,1]);var i=Oe(n,"x","conv3d"),s=Oe(r,"filter","conv3d"),u=i,f=!1;i.rank===4&&(f=!0,u=i.as5D(1,i.shape[0],i.shape[1],i.shape[2],i.shape[3])),_(u.rank===5,function(){return"Error in conv3d: input must be rank 5, but got rank "+u.rank+"."}),_(s.rank===5,function(){return"Error in conv3d: filter must be rank 5, but got rank "+s.rank+"."}),_(u.shape[4]===s.shape[3],function(){return"Error in conv3d: depth of input ("+u.shape[4]+") must match input depth for filter "+s.shape[3]+"."}),_(function(L,Y){return gu(L)||gu(Y)}(e,a),function(){return"Error in conv3D: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+a+"'"}),_(o==="NDHWC",function(){return"Error in conv3d: got dataFormat of "+o+" but only NDHWC is currently supported."});var C=Co(u.shape,s.shape,e,a,t),k=Ve.runKernelFunc(function(L,Y){var ne=L.conv3d(u,s,C);return Y([u,s]),ne},{x:u,$filter:s},function(L,Y){_(gu(a),function(){return"Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+a+"'"});var ne=Y[0],ce=Y[1];return{x:function(){return ul(ne.shape,L,ce,e,t)},$filter:function(){return function(se,le,xe,Ee,Ce){var Te=se;se.rank===4&&(Te=se.as5D(1,se.shape[0],se.shape[1],se.shape[2],se.shape[3]));var Me=le;Me.rank===4&&(Me=le.as5D(1,le.shape[0],le.shape[1],le.shape[2],le.shape[3])),_(Te.rank===5,function(){return"Error in conv3dDerFilter: input must be rank 5, but got shape "+Te.shape+"."}),_(Me.rank===5,function(){return"Error in conv3dDerFilter: dy must be rank 5, but got shape "+Me.shape+"."}),_(xe.length===5,function(){return"Error in conv3dDerFilter: filterShape must be length 5, but got "+xe+"."}),_(Te.shape[4]===xe[3],function(){return"Error in conv3dDerFilter: depth of input "+Te.shape[4]+") must match input depth in filter ("+xe[3]+"."}),_(Me.shape[4]===xe[4],function(){return"Error in conv3dDerFilter: depth of dy ("+Me.shape[4]+") must match output depth for filter ("+xe[4]+")."});var He=Co(Te.shape,xe,Ee,1,Ce);return Ve.runKernelFunc(function(Be){return Be.conv3dDerFilter(Te,Me,He)},{x5D:Te,dy5D:Me})}(ne,L,ce.shape,e,t)}}});return f?k.as4D(k.shape[1],k.shape[2],k.shape[3],k.shape[4]):k}}),yu=Xe({conv2dDerFilter_:function(n,r,e,t,o,a,i){a===void 0&&(a="NHWC");var s=n;n.rank===3&&(s=n.as4D(1,n.shape[0],n.shape[1],n.shape[2]));var u=r;u.rank===3&&(u=r.as4D(1,r.shape[0],r.shape[1],r.shape[2])),_(s.rank===4,function(){return"Error in conv2dDerFilter: input must be rank 4, but got shape "+s.shape+"."}),_(u.rank===4,function(){return"Error in conv2dDerFilter: dy must be rank 4, but got shape "+u.shape+"."}),_(e.length===4,function(){return"Error in conv2dDerFilter: filterShape must be length 4, but got "+e+"."});var f=a==="NHWC"?s.shape[3]:s.shape[1],C=a==="NHWC"?u.shape[3]:u.shape[1];_(f===e[2],function(){return"Error in conv2dDerFilter: depth of input "+f+") must match input depth in filter ("+e[2]+"."}),_(C===e[3],function(){return"Error in conv2dDerFilter: depth of dy ("+C+") must match output depth for filter ("+e[3]+")."}),i!=null&&_(ge(o),function(){return"Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+o+"."});var k=fi(a),L=jn(s.shape,e,t,1,o,i,!1,k);return Ve.runKernelFunc(function(Y){return Y.conv2dDerFilter(s,u,L)},{x4D:s,dy4D:u})}}),cl=Xe({conv2dDerInput_:sl}),vs=Xe({depthwiseConv2d_:function(n,r,e,t,o,a,i){o===void 0&&(o="NHWC"),a===void 0&&(a=[1,1]);var s=Oe(n,"x","depthwiseConv2d"),u=Oe(r,"filter","depthwiseConv2d"),f=s,C=!1;s.rank===3&&(C=!0,f=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),_(f.rank===4,function(){return"Error in depthwiseConv2d: input must be rank 4, but got rank "+f.rank+"."}),_(u.rank===4,function(){return"Error in depthwiseConv2d: filter must be rank 4, but got rank "+u.rank+"."}),_(f.shape[3]===u.shape[2],function(){return"Error in depthwiseConv2d: number of input channels ("+f.shape[3]+") must match the inChannels dimension in filter "+u.shape[2]+"."}),a==null&&(a=[1,1]),_(Zr(e,a),function(){return"Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+a+"'"}),i!=null&&_(ge(t),function(){return"Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+t+"."});var k=jn(f.shape,u.shape,e,a,t,i,!0),L=[f,u],Y=Ve.runKernelFunc(function(ne,ce){var se=ne.depthwiseConv2D(f,u,k);return ce([f,u]),se},{x:f,filter:u},function(ne,ce){_(To(a),function(){return"Error in gradient of depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+a+"'"});var se=ce[0],le=ce[1];return{x:function(){return ll(se.shape,ne,le,k)},filter:function(){return dl(se,ne,le.shape,k)}}},"DepthwiseConv2dNative",k,L);return C?Y.as3D(Y.shape[1],Y.shape[2],Y.shape[3]):Y}}),ll=Xe({depthwiseConv2dDerInput_:function(n,r,e,t){var o=r,a=!1;r.rank===3&&(a=!0,o=r.as4D(1,r.shape[0],r.shape[1],r.shape[2]));var i=Ve.runKernelFunc(function(s){return s.depthwiseConv2DDerInput(o,e,t)},{dy4D:o});return a?i.as3D(i.shape[1],i.shape[2],i.shape[3]):i}}),dl=Xe({depthwiseConv2dDerFilter_:function(n,r,e,t){var o=n;n.rank===3&&(o=n.as4D(1,n.shape[0],n.shape[1],n.shape[2]));var a=r;return a.rank===3&&(a=r.as4D(1,r.shape[0],r.shape[1],r.shape[2])),Ve.runKernelFunc(function(i){return i.depthwiseConv2DDerFilter(o,a,t)},{x4D:o,dy4D:a})}}),fl=Xe({separableConv2d_:function(n,r,e,t,o,a,i){a===void 0&&(a=[1,1]),i===void 0&&(i="NHWC");var s=Oe(n,"x","separableConv2d"),u=Oe(r,"depthwiseFilter","separableConv2d"),f=Oe(e,"pointwiseFilter","separableConv2d"),C=s,k=!1;if(s.rank===3&&(k=!0,C=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),i==="NCHW")throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");_(C.rank===4,function(){return"Error in separableConv2d: input must be rank 4, but got rank "+C.rank+"."}),_(u.rank===4,function(){return"Error in separableConv2d: depthwise filter must be rank 4, but got rank "+u.rank+"."}),_(f.rank===4,function(){return"Error in separableConv2d: pointwise filter must be rank 4, but got rank "+u.rank+"."}),_(f.shape[0]===1,function(){return"Error in separableConv2d: the first dimension of pointwise filter must be 1, but got "+f.shape[0]+"."}),_(f.shape[1]===1,function(){return"Error in separableConv2d: the second dimension of pointwise filter must be 1, but got "+f.shape[1]+"."});var L=u.shape[2],Y=u.shape[3];_(f.shape[2]===L*Y,function(){return"Error in separableConv2d: the third dimension of pointwise filter must be "+L*Y+", but got "+f.shape[2]+"."});var ne=vs(C,u,t,o,i,a),ce=Pa(ne,f,1,"valid",i);return k?ce.as3D(ce.shape[1],ce.shape[2],ce.shape[3]):ce}}),dh=Xe({conv2dTranspose_:function(n,r,e,t,o,a){return sl(e,Oe(n,"x","conv2dTranspose"),Oe(r,"filter","conv2dTranspose"),t,o,"NHWC",a)}}),fh=Xe({conv3dTranspose_:function(n,r,e,t,o){return ul(e,Oe(n,"x","conv3dTranspose"),Oe(r,"filter","conv3dTranspose"),t,o)}}),bu=Xe({matMul_:function(n,r,e,t){var o;e===void 0&&(e=!1),t===void 0&&(t=!1);var a=Oe(n,"a","matMul"),i=Oe(r,"b","matMul");o=cr(a,i),a=o[0],i=o[1];var s=e?a.shape[a.rank-2]:a.shape[a.rank-1],u=t?i.shape[i.rank-1]:i.shape[i.rank-2],f=e?a.shape[a.rank-1]:a.shape[a.rank-2],C=t?i.shape[i.rank-2]:i.shape[i.rank-1],k=a.shape.slice(0,-2),L=i.shape.slice(0,-2),Y=de(k),ne=de(L);_(a.rank>=2&&i.rank>=2&&a.rank===i.rank,function(){return"Error in matMul: inputs must have the same rank of at least 2, got ranks "+a.rank+" and "+i.rank+"."}),_(we(k,L),function(){return"Error in matMul: outer dimensions ("+k+") and ("+L+") of Tensors with shapes "+a.shape+" and "+i.shape+" must match."}),_(s===u,function(){return"Error in matMul: inner shapes ("+s+") and ("+u+") of Tensors with shapes "+a.shape+" and "+i.shape+" and transposeA="+e+" and transposeB="+t+" must match."});var ce=a.shape.slice(0,-2).concat([f,C]),se=e?a.as3D(Y,s,f):a.as3D(Y,f,s),le=t?i.as3D(ne,C,u):i.as3D(ne,u,C),xe={transposeA:e,transposeB:t};return Ve.runKernelFunc(function(Ee,Ce){var Te=Ee.batchMatMul(se,le,e,t);return Ce([se,le]),Te},{a:se,b:le},function(Ee,Ce){var Te=Ce,Me=Te[0],He=Te[1];return e||t?!e&&t?{a:function(){return Ee.matMul(He,!1,!1)},b:function(){return Ee.matMul(Me,!0,!1)}}:e&&!t?{a:function(){return He.matMul(Ee,!1,!0)},b:function(){return Me.matMul(Ee,!1,!1)}}:{a:function(){return He.matMul(Ee,!0,!0)},b:function(){return Ee.matMul(Me,!0,!0)}}:{a:function(){return Ee.matMul(He,!1,!0)},b:function(){return Me.matMul(Ee,!0,!1)}}},"BatchMatMul",xe).reshape(ce)}}),hh=Xe({dot_:function(n,r){var e=Oe(n,"t1","dot"),t=Oe(r,"t2","dot");_(!(e.rank!==1&&e.rank!==2||t.rank!==1&&t.rank!==2),function(){return"Error in dot: inputs must all be rank 1 or 2, but got ranks "+e.rank+" and "+t.rank+"."});var o=e.rank===1?e.size:e.shape[1],a=t.rank===1?t.size:t.shape[0];return _(o===a,function(){return"Error in dot: inner dimensions of inputs must match, but got "+o+" and "+a+"."}),e.rank===1&&t.rank===1?e.as2D(1,-1).matMul(t.as2D(-1,1)).asScalar():e.rank===1&&t.rank===2?e.as2D(1,-1).matMul(t.as2D(t.shape[0],t.shape[1])).as1D():e.rank===2&&t.rank===1?e.matMul(t.as2D(-1,1)).as1D():e.matMul(t.as2D(t.shape[0],t.shape[1]))}}),ph=Xe({outerProduct_:function(n,r){var e=Oe(n,"v1","outerProduct"),t=Oe(r,"v2","outerProduct");return _(e.rank===1&&t.rank===1,function(){return"Error in outerProduct: inputs must be rank 1, but got ranks "+e.rank+" and "+t.rank+"."}),e.as2D(-1,1).matMul(t.as2D(1,-1))}}),Ti=Xe({reverse_:function(n,r){var e=Oe(n,"x","reverse");if(e.rank===0)return e.clone();var t=ue(r,e.shape);return Ve.runKernelFunc(function(o){return o.reverse(e,t)},{$x:e},function(o){return{$x:function(){return o.reverse(t)}}}).reshapeAs(e)}}),mh=Xe({reverse1d_:function(n){var r=Oe(n,"x","reverse");return _(r.rank===1,function(){return"Error in reverse1D: x must be rank 1 but got rank "+r.rank+"."}),Ti(r,0)}}),vh=Xe({reverse2d_:function(n,r){var e=Oe(n,"x","reverse");return _(e.rank===2,function(){return"Error in reverse2D: x must be rank 2 but got rank "+e.rank+"."}),Ti(e,r)}}),gh=Xe({reverse3d_:function(n,r){var e=Oe(n,"x","reverse");return _(e.rank===3,function(){return"Error in reverse3D: x must be rank 3 but got rank "+e.rank+"."}),Ti(e,r)}}),yh=Xe({reverse4d_:function(n,r){var e=Oe(n,"x","reverse");return _(e.rank===4,function(){return"Error in reverse4D: x must be rank 4 but got rank "+e.rank+"."}),Ti(e,r)}});function hl(n,r,e,t,o,a){var i=Oe(n,"x","maxPool"),s=i,u=!1;i.rank===3&&(u=!0,s=i.as4D(1,i.shape[0],i.shape[1],i.shape[2])),t==null&&(t=[1,1]),_(s.rank===4,function(){return"Error in maxPool: input must be rank 4 but got rank "+s.rank+"."}),_(Zr(e,t),function(){return"Error in maxPool: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+t+"'"}),a!=null&&_(ge(o),function(){return"Error in maxPool: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+o+"."});var f=eo(s.shape,r,e,t,o,a);if(f.filterWidth===1&&f.filterHeight===1&&we(f.inShape,f.outShape))return i.clone();var C=[s],k=Ve.runKernelFunc(function(L,Y){var ne=L.maxPool(s,f);return Y([s,ne]),ne},{x:s},function(L,Y){var ne=Y[0],ce=Y[1];return{x:function(){return function(se,le,xe,Ee,Ce,Te,Me,He){var Be=Oe(se,"dy","maxPoolBackprop"),je=Oe(le,"input","maxPoolBackprop"),We=Oe(xe,"output","maxPoolBackprop");_(je.rank===Be.rank,function(){return"Rank of input ("+je.rank+") does not match rank of dy ("+Be.rank+")"}),Te==null&&(Te=[1,1]),_(Zr(Ce,Te),function(){return"Error in maxPoolBackProp: Either strides or dilations must be 1. Got strides "+Ce+" and dilations '"+Te+"'"}),_(Be.rank===4,function(){return"Error in maxPoolBackprop: dy must be rank 4 but got rank "+Be.rank+"."}),_(je.rank===4,function(){return"Error in maxPoolBackprop: input must be rank 4 but got rank "+je.rank+"."}),He!=null&&_(ge(Me),function(){return"Error in maxPoolBackprop: pad must be an integer when using, dimRoundingMode "+He+" but got pad "+Me+"."});var Ze=eo(je.shape,Ee,Ce,Te,Me,He);return Ve.runKernelFunc(function(Je){return Je.maxPoolBackprop(Be,je,We,Ze)},{$dy:Be,$input:je})}(L,ne,ce,r,e,t,o)}}},"MaxPool",f,C);return u?k.as3D(k.shape[1],k.shape[2],k.shape[3]):k}function pl(n,r,e,t,o,a){var i=Oe(n,"x","avgPool","float32");t==null&&(t=[1,1]),_(Zr(e,t),function(){return"Error in avgPool: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+t+"'"});var s=i,u=!1;i.rank===3&&(u=!0,s=i.as4D(1,i.shape[0],i.shape[1],i.shape[2])),_(s.rank===4,function(){return"Error in avgPool: x must be rank 4 but got rank "+s.rank+"."}),a!=null&&_(ge(o),function(){return"Error in avgPool: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+o+"."});var f=eo(s.shape,r,e,t,o,a);if(f.filterWidth===1&&f.filterHeight===1&&we(f.inShape,f.outShape))return i.clone();var C=Ve.runKernelFunc(function(k){return k.avgPool(s,f)},{x:s},function(k){return{x:function(){return function(L,Y,ne,ce,se,le){var xe=Oe(L,"dy","avgPoolBackprop"),Ee=Oe(Y,"input","avgPoolBackprop");_(Ee.rank===xe.rank,function(){return"Rank of input ("+Ee.rank+") does not match rank of dy ("+xe.rank+")"}),se==null&&(se=[1,1]),_(Zr(ce,se),function(){return"Error in avgPoolBackprop: Either strides or dilations must be 1. Got strides "+ce+" and dilations '"+se+"'"});var Ce=Ee,Te=xe,Me=!1;Ee.rank===3&&(Me=!0,Ce=Ee.as4D(1,Ee.shape[0],Ee.shape[1],Ee.shape[2]),Te=xe.as4D(1,xe.shape[0],xe.shape[1],xe.shape[2])),_(Te.rank===4,function(){return"Error in avgPoolBackprop: dy must be rank 4 but got rank "+Te.rank+"."}),_(Ce.rank===4,function(){return"Error in avgPoolBackprop: input must be rank 4 but got rank "+Ce.rank+"."});var He=eo(Ce.shape,ne,ce,se,le),Be=Ve.runKernelFunc(function(je){return je.avgPoolBackprop(Te,Ce,He)},{dy4D:Te,input4D:Ce});return Me?Be.as3D(Be.shape[1],Be.shape[2],Be.shape[3]):Be}(k,s,r,e,t,o)}}},"AvgPool",f);return C=C.cast(i.dtype),u?C.as3D(C.shape[1],C.shape[2],C.shape[3]):C}var ml=Xe({maxPool_:function(n,r,e,t,o){return hl(n,r,e,1,t,o)}}),vl=Xe({avgPool_:function(n,r,e,t,o){return pl(n,r,e,1,t,o)}}),bh=Xe({pool_:function(n,r,e,t,o,a){o==null&&(o=[1,1]),a==null&&(a=1),t===0&&(t="valid");var i=Oe(n,"x","maxPool"),s=i,u=!1;i.rank===3&&(u=!0,s=i.as4D(1,i.shape[0],i.shape[1],i.shape[2])),_(Zr(a,o),function(){return"Error in pool: Either strides or dilations must be 1. Got strides "+a+" and dilations '"+o+"'"});var f,C=eo(s.shape,r,a,o,t),k=[C.dilationHeight,C.dilationWidth];f=t==="same"?function(Ce,Te){var Me=Ce.map(function(je,We){return je+(je-1)*(Te[We]-1)}).map(function(je){return je-1}),He=Me.map(function(je){return Math.floor(je/2)}),Be=Me.map(function(je,We){return je-He[We]});return Me.map(function(je,We){return[He[We],Be[We]]})}([C.filterHeight,C.filterWidth],k):[[0,0],[0,0]];var L=k[0]===1&&k[1]===1,Y=function(Ce,Te,Me){var He=Me.map(function(lt){return lt[0]}),Be=Me.map(function(lt){return lt[1]}),je=Ce.concat(He,Be),We=Te.map(function(lt,ut){return(lt-je[ut]%lt)%lt}),Ze=Be.map(function(lt,ut){return lt+We[ut]}),Je=Te.map(function(lt,ut){return[He[ut],Ze[ut]]}),ht=Te.map(function(lt,ut){return[0,We[ut]]});return[Je,ht]}([C.inHeight,C.inWidth],k,f),ne=Y[0],ce=Y[1],se=L?t:"valid",le=L?s:Xi(s,k,ne),xe=(e==="avg"?function(){return pl(le,r,a,1,se)}:function(){return hl(le,r,a,1,se)})(),Ee=L?xe:ya(xe,k,ce);return u?Ee.as3D(Ee.shape[1],Ee.shape[2],Ee.shape[3]):Ee}}),xh=Xe({maxPool3d_:function(n,r,e,t,o,a,i){a===void 0&&(a="NDHWC");var s=Oe(n,"x","maxPool3d"),u=s,f=!1;s.rank===4&&(f=!0,u=s.as5D(1,s.shape[0],s.shape[1],s.shape[2],s.shape[3])),i==null&&(i=[1,1,1]),_(u.rank===5,function(){return"Error in maxPool3d: x must be rank 5 but got rank "+u.rank+"."}),_(a==="NDHWC",function(){return"Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of "+a}),_(Zr(e,i),function(){return"Error in maxPool3d: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+i+"'"}),o!=null&&_(ge(t),function(){return"Error in maxPool3d: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+t+"."});var C=Vo(u.shape,r,e,i,t,o,a),k=Ve.runKernelFunc(function(L,Y){var ne=L.maxPool3d(u,C);return Y([u,ne]),ne},{x:u},function(L,Y){var ne=Y[0],ce=Y[1];return{x:function(){return function(se,le,xe,Ee,Ce,Te,Me,He){var Be=Oe(se,"dy","maxPool3dBackprop"),je=Oe(le,"input","maxPool3dBackprop"),We=Oe(xe,"output","maxPool3dBackprop"),Ze=Be,Je=je,ht=We,lt=!1;je.rank===4&&(lt=!0,Ze=Be.as5D(1,Be.shape[0],Be.shape[1],Be.shape[2],Be.shape[3]),Je=je.as5D(1,je.shape[0],je.shape[1],je.shape[2],je.shape[3]),ht=We.as5D(1,We.shape[0],We.shape[1],We.shape[2],We.shape[3])),_(Ze.rank===5,function(){return"Error in maxPool3dBackprop: dy must be rank 5 but got rank "+Ze.rank+"."}),_(Je.rank===5,function(){return"Error in maxPool3dBackprop: input must be rank 5 but got rank "+Je.rank+"."}),_(ht.rank===5,function(){return"Error in maxPool3dBackprop: output must be rank 5 but got rank "+ht.rank+"."}),Te==null&&(Te=[1,1,1]),_(Zr(Ce,Te),function(){return"Error in maxPool3dBackprop: Either strides or dilations must be 1. Got strides "+Ce+" and dilations '"+Te+"'"}),He!=null&&_(ge(Me),function(){return"Error in maxPool3dBackprop: pad must be an integer when using, dimRoundingMode "+He+" but got pad "+Me+"."});var ut=Vo(Je.shape,Ee,Ce,Te,Me,He),gt=Ve.runKernelFunc(function(mt){return mt.maxPool3dBackprop(Ze,Je,ht,ut)},{dy5D:Ze,input5D:Je});return lt?gt.as4D(gt.shape[1],gt.shape[2],gt.shape[3],gt.shape[4]):gt}(L,ne,ce,r,e,i,t,o)}}});return f?k.as4D(k.shape[1],k.shape[2],k.shape[3],k.shape[4]):k}}),wh=Xe({avgPool3d_:function(n,r,e,t,o,a,i){a===void 0&&(a="NDHWC");var s=Oe(n,"x","avgPool3d","float32"),u=s,f=!1;s.rank===4&&(f=!0,u=s.as5D(1,s.shape[0],s.shape[1],s.shape[2],s.shape[3])),i==null&&(i=[1,1,1]),_(u.rank===5,function(){return"Error in avgPool3d: x must be rank 5 but got rank "+u.rank+"."}),_(a==="NDHWC",function(){return"Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of "+a}),_(Zr(e,i),function(){return"Error in avgPool3d: Either strides or dilations must be 1. Got strides "+e+" and dilations '"+i+"'"}),o!=null&&_(ge(t),function(){return"Error in avgPool3d: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+t+"."});var C=Vo(u.shape,r,e,i,t,o,a),k=Ve.runKernelFunc(function(L){return L.avgPool3d(u,C)},{x:u},function(L){return{x:function(){return function(Y,ne,ce,se,le,xe,Ee){var Ce=Oe(Y,"dy","avgPool3dBackprop"),Te=Oe(ne,"input","avgPool3dBackprop"),Me=Ce,He=Te,Be=!1;Te.rank===4&&(Be=!0,Me=Ce.as5D(1,Ce.shape[0],Ce.shape[1],Ce.shape[2],Ce.shape[3]),He=Te.as5D(1,Te.shape[0],Te.shape[1],Te.shape[2],Te.shape[3])),_(Me.rank===5,function(){return"Error in avgPool3dBackprop: dy must be rank 5 but got rank "+Me.rank+"."}),_(He.rank===5,function(){return"Error in avgPool3dBackprop: input must be rank 5 but got rank "+He.rank+"."}),le==null&&(le=[1,1,1]),_(Zr(se,le),function(){return"Error in avgPool3dBackprop: Either strides or dilations must be 1. Got strides "+se+" and dilations '"+le+"'"}),Ee!=null&&_(ge(xe),function(){return"Error in maxPool3dBackprop: pad must be an integer when using, dimRoundingMode "+Ee+" but got pad "+xe+"."});var je=Vo(He.shape,ce,se,le,xe,Ee),We=Ve.runKernelFunc(function(Ze){return Ze.avgPool3dBackprop(Me,He,je)},{dy5D:Me,input5D:He});return Be?We.as4D(We.shape[1],We.shape[2],We.shape[3],We.shape[4]):We}(L,u,r,e,i,t,o)}}});return k=k.cast(u.dtype),f?k.as4D(k.shape[1],k.shape[2],k.shape[3],k.shape[4]):k}}),ro=Xe({slice_:function(n,r,e){var t,o,a=Oe(n,"x","slice");if(a.rank===0)throw new Error("Slicing scalar is not possible");(t=typeof r=="number"?[r].concat(new Array(a.rank-1).fill(0)):r.length<a.rank?r.concat(new Array(a.rank-r.length).fill(0)):r.slice()).forEach(function(u){_(u!==-1,function(){return"slice() does not support negative begin indexing."})}),o=(o=e==null?new Array(a.rank).fill(-1):typeof e=="number"?[e].concat(new Array(a.rank-1).fill(-1)):e.length<a.rank?e.concat(new Array(a.rank-e.length).fill(-1)):e).map(function(u,f){return u>=0?u:(_(u===-1,function(){return"Negative size values should be exactly -1 but got "+u+" for the slice() size at index "+f+"."}),a.shape[f]-t[f])}),Js(a,t,o);var i=a.shape,s={begin:t,size:o};return Ve.runKernelFunc(function(u){return u.slice(a,t,o)},{x:a},function(u){for(var f=[],C=0;C<u.rank;C++)f.push([t[C],i[C]-t[C]-o[C]]);return{x:function(){return u.pad(f)}}},"Slice",s)}}),Eh=Xe({slice1d_:function(n,r,e){var t=Oe(n,"x","slice1d");return _(t.rank===1,function(){return"slice1d expects a rank-1 tensor, but got a rank-"+t.rank+" tensor"}),ro(t,[r],[e])}}),_h=Xe({slice2d_:function(n,r,e){var t=Oe(n,"x","slice2d");return _(t.rank===2,function(){return"slice2d expects a rank-2 tensor, but got a rank-"+t.rank+" tensor"}),ro(t,r,e)}}),gl=Xe({slice3d_:function(n,r,e){var t=Oe(n,"x","slice3d");return _(t.rank===3,function(){return"slice3d expects a rank-3 tensor, but got a rank-"+t.rank+" tensor"}),ro(t,r,e)}}),Ch=Xe({slice4d_:function(n,r,e){var t=Oe(n,"x","slice4d");return _(t.rank===4,function(){return"slice4d expects a rank-4 tensor, but got a rank-"+t.rank+" tensor"}),ro(t,r,e)}});function yl(n,r,e,t,o){return r.rank<e.rank&&(r=r.reshape(Vr(r.shape,t))),n.rank<e.rank&&(n=n.reshape(Vr(n.shape,t))),{x:function(){var a=n.mul(e.equal(r).cast(n.dtype));return o==null?a:a.transpose(o)}}}var Th=Xe({all_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=Oe(n,"x","all","bool"),o=ue(r,t.shape),a=o,i=an(a,t.rank);i!=null&&(t=t.transpose(i),a=hn(a.length,t.rank));var s=Ve.runKernelFunc(function(f){return f.all(t,a)},{$x:t});if(e){var u=Vr(s.shape,o);return s.reshape(u)}return s}}),Sh=Xe({any_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=Oe(n,"x","any","bool"),o=ue(r,t.shape),a=o,i=an(a,t.rank);i!=null&&(t=t.transpose(i),a=hn(a.length,t.rank));var s=Ve.runKernelFunc(function(f){return f.any(t,a)},{$x:t});if(e){var u=Vr(s.shape,o);return s.reshape(u)}return s}}),Ah=Xe({argMax_:function(n,r){r===void 0&&(r=0);var e=Oe(n,"x","argMax");r==null&&(r=0);var t=ue(r,e.shape),o=an(t,e.rank);o!=null&&(e=e.transpose(o),t=hn(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 $t(f)}}},"ArgMax",a,i)}}),Oh=Xe({argMin_:function(n,r){r===void 0&&(r=0);var e=Oe(n,"x","argMin");r==null&&(r=0);var t=ue(r,e.shape),o=an(t,e.rank);return o!=null&&(e=e.transpose(o),t=hn(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 $t(s)}}})}}),Rh=Xe({logSumExp_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=Oe(n,"x","logSumExp"),o=ue(r,t.shape),a=t.max(o,!0),i=t.sub(a).exp().sum(o).log(),s=a.reshape(i.shape).add(i);if(e){var u=Vr(s.shape,o);return s.reshape(u)}return s}}),bl=Xe({max_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=Oe(n,"x","max"),o=t,a=ue(r,t.shape),i=a,s=an(i,t.rank);s!=null&&(t=t.transpose(s),i=hn(i.length,t.rank));var u=[t],f=Ve.runKernelFunc(function(k,L){var Y=k.max(t,i);return L([o,Y]),Y},{x:t},function(k,L){return yl(k,L[1],L[0],a,s)},"Max",{axes:i},u,[!0]);if(e){var C=Vr(f.shape,a);f=f.reshape(C)}return f}}),Ih=Xe({mean_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=Oe(n,"x","mean"),o=ue(r,t.shape),a=de(Gr(t.shape,o)[1]);return Eo(function(i){var s=Nt(a);return{value:(s.dtype===i.dtype?i:i.cast(s.dtype)).div(s).sum(r,e),gradFunc:function(u){var f=i.shape.slice();return o.forEach(function(C){f[C]=1}),u.reshape(f).mul(Mn(i.shape,"float32")).div(a)}}})(t)}}),Nh=Xe({min_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=Oe(n,"x","min"),o=t,a=ue(r,t.shape),i=a,s=an(i,t.rank);s!=null&&(t=t.transpose(s),i=hn(i.length,t.rank));var u=[t],f=Ve.runKernelFunc(function(k,L){var Y=k.min(t,i);return L([o,Y]),Y},{x:t},function(k,L){return yl(k,L[1],L[0],a,s)},"Min",{axes:i},u,[!0]);if(e){var C=Vr(f.shape,a);f=f.reshape(C)}return f}}),Dh=Xe({moments_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=ue(r,(n=Oe(n,"x","moments")).shape),o=n.mean(t,e),a=o.shape;e||(a=Vr(o.shape,t));var i=n.toFloat().sub(o.reshape(a)).square();return{mean:o,variance:i.mean(t,e)}}}),xl=Xe({sum_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=Oe(n,"x","sum");t.dtype==="bool"&&(t=t.toInt());var o=ue(r,t.shape);return Eo(function(a){var i=an(o,a.rank),s=o,u=a;i!=null&&(u=a.transpose(i),s=hn(s.length,a.rank));var f=function(Y){var ne=a.shape.slice();return o.forEach(function(ce){ne[ce]=1}),Y.reshape(ne).mul(Mn(a.shape,"float32"))},C={axes:s},k=Ve.runKernelFunc(function(Y){return Y.sum(u,s)},{x:u},function(Y){return{x:function(){return f(Y)}}},"Sum",C);if(e){var L=Vr(k.shape,o);k=k.reshape(L)}return{value:k,gradFunc:f}})(t)}}),kh=Xe({prod_:function(n,r,e){r===void 0&&(r=null),e===void 0&&(e=!1);var t=Oe(n,"x","prod");t.dtype==="bool"&&(t=t.toInt());var o=ue(r,t.shape),a=an(o,t.rank),i=o,s=t;a!=null&&(s=t.transpose(a),i=hn(i.length,t.rank));var u=Ve.runKernelFunc(function(C){return C.prod(s,i)},{permutedX:s});if(e){var f=Vr(u.shape,o);u=u.reshape(f)}return u}}),wl=Xe({elu_:function(n){var r=Oe(n,"x","elu");return Ve.runKernelFunc(function(e,t){var o=e.elu(r);return t([o]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){return Ve.runKernelFunc(function(a){return a.eluDer(e,o)},{dy:e,y:o})}}})}}),Mh=Xe({leakyRelu_:function(n,r){r===void 0&&(r=.2);var e=Oe(n,"x","leakyRelu");return mu(Nt(r).mul(e),e)}}),El=Xe({prelu_:function(n,r){var e=Oe(n,"x","prelu"),t=Oe(r,"alpha","prelu");return Ve.runKernelFunc(function(o,a){var i=o.prelu(e,t);return a([e,t]),i},{x:e,alpha:t},function(o,a){var i=a[0],s=a[1],u=i.greater(0);return{x:function(){return Qo(u,o,o.mul(s))},alpha:function(){var f=Qo(u,$t(o),o.mul(i)),C=Ir(s.shape,o.shape);return C.length>0&&(f=f.sum(C)),f.reshape(s.shape)}}},"Prelu")}}),xu=Xe({relu_:function(n){var r=Oe(n,"x","relu");return r.dtype==="bool"?r.toInt():Ve.runKernelFunc(function(e,t){var o=e.relu(r);return t([r]),o},{x:r},function(e,t){var o=t[0];return{x:function(){return e.mulStrict(o.step().toFloat())}}},"Relu")}}),_l=Xe({relu6_:function(n){var r=Oe(n,"x","relu6");return r.dtype==="bool"?r.toInt():Ve.runKernelFunc(function(e,t){var o=e.relu6(r);return t([r]),o},{x:r},function(e,t){var o=t[0],a=o.lessEqual(6).mul(o.step());return{x:function(){return e.mulStrict(a.toFloat())}}},"Relu6")}}),Ph=Xe({selu_:function(n){var r=Oe(n,"x","selu");return Ve.runKernelFunc(function(e,t){var o=e.selu(r);return t([r]),o},{$x:r},function(e,t){var o=t[0];return{$x:function(){var a=o.greater(Nt(0)),i=Nt(fu),s=Nt(hu),u=e.mul(s),f=e.mul(i).mul(o.toFloat().exp());return Qo(a,u,f)}}})}}),Cl=Xe({transpose_:function(n,r){var e=Oe(n,"x","transpose");if(r==null&&(r=e.shape.map(function(o,a){return a}).reverse()),_(e.rank===r.length,function(){return"Error in transpose: rank of input "+e.rank+" must match length of perm "+r+"."}),r.forEach(function(o){_(o>=0&&o<e.rank,function(){return"All entries in 'perm' must be between 0 and "+(e.rank-1)+" but got "+r})}),e.rank<=1)return e.clone();var t={perm:r};return Ve.runKernelFunc(function(o){return o.transpose(e,r)},{x:e},function(o){var a=yo(r);return{x:function(){return o.transpose(a)}}},"Transpose",t)}}),Fh=Xe({localResponseNormalization_:function(n,r,e,t,o){r===void 0&&(r=5),e===void 0&&(e=1),t===void 0&&(t=1),o===void 0&&(o=.5);var a=Oe(n,"x","localResponseNormalization");_(a.rank===4||a.rank===3,function(){return`Error in localResponseNormalization: x must be rank 3 or 4 but got
|
|
|
rank `+a.rank+"."}),_(ge(r),function(){return"Error in localResponseNormalization: depthRadius must be an integer but got depthRadius "+r+"."});var i=a,s=!1;a.rank===3&&(s=!0,i=a.as4D(1,a.shape[0],a.shape[1],a.shape[2]));var u=Ve.runKernelFunc(function(f,C){var k=f.localResponseNormalization4D(i,r,e,t,o);return C([i,k]),k},{x4D:i},function(f,C){var k=C[0],L=C[1];return{x4D:function(){return Ve.runKernelFunc(function(Y){return Y.LRNGrad(f,k,L,r,e,t,o)},{})}}});return s?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),Tl=Xe({norm_:function(n,r,e,t){r===void 0&&(r="euclidean"),e===void 0&&(e=null),t===void 0&&(t=!1);var o=function s(u,f,C){if(C===void 0&&(C=null),u.rank===0)return u.abs();if(u.rank!==1&&C===null)return s(u.reshape([-1]),f,C);if(u.rank===1||typeof C=="number"||Array.isArray(C)&&C.length===1){if(f===1)return u.abs().sum(C);if(f===1/0)return u.abs().max(C);if(f===-1/0)return u.abs().min(C);if(f==="euclidean"||f===2)return u.abs().pow(Nt(2,"int32")).sum(C).sqrt();throw new Error("Error in norm: invalid ord value: "+f)}if(Array.isArray(C)&&C.length===2){if(f===1)return u.abs().sum(C[0]).max(C[1]-1);if(f===1/0)return u.abs().sum(C[1]).max(C[0]);if(f===-1/0)return u.abs().sum(C[1]).min(C[0]);if(f==="fro"||f==="euclidean")return u.square().sum(C).sqrt();throw new Error("Error in norm: invalid ord value: "+f)}throw new Error("Error in norm: invalid axis: "+C)}(n=Oe(n,"x","norm"),r,e),a=o.shape;if(t){var i=ue(e,n.shape);a=Vr(o.shape,i)}return o.reshape(a)}}),Lh=Xe({basicLSTMCell_:function(n,r,e,t,o,a){var i=Oe(n,"forgetBias","basicLSTMCell"),s=Oe(r,"lstmKernel","basicLSTMCell"),u=Oe(e,"lstmBias","basicLSTMCell"),f=Oe(t,"data","basicLSTMCell"),C=Oe(o,"c","basicLSTMCell"),k=Oe(a,"h","basicLSTMCell"),L=f.concat(k,1).matMul(s).add(u),Y=L.shape[0],ne=L.shape[1]/4,ce=[Y,ne],se=L.slice([0,0],ce),le=L.slice([0,ne],ce),xe=L.slice([0,2*ne],ce),Ee=L.slice([0,3*ne],ce),Ce=se.sigmoid().mulStrict(le.tanh()).addStrict(C.mulStrict(i.add(xe).sigmoid())),Te=Ce.tanh().mulStrict(Ee.sigmoid());return[Ce,Te]}}),jh=Xe({multiRNNCell_:function(n,r,e,t){for(var o=Oe(r,"data","multiRNNCell"),a=go(e,"c","multiRNNCell"),i=go(t,"h","multiRNNCell"),s=o,u=[],f=0;f<n.length;f++){var C=n[f](s,a[f],i[f]);u.push(C[0]),u.push(C[1]),s=C[1]}var k=[],L=[];for(f=0;f<u.length;f+=2)k.push(u[f]),L.push(u[f+1]);return[k,L]}}),Bh=Xe({movingAverage_:function(n,r,e,t,o){o===void 0&&(o=!0);var a=Oe(n,"v","movingAverage"),i=Oe(r,"x","movingAverage"),s=Oe(e,"decay","movingAverage");rn(a,i),_(we(a.shape,i.shape),function(){return"Shape mismatch in v and x"});var u=Nt(1),f=u.sub(s),C=i.sub(a).mul(f);if(o){_(t!=null,function(){return"When using zeroDebias: true, step is required."});var k=Oe(t,"step","movingAverage");C=C.div(u.sub(ms(s,k)))}return a.add(C)}}),Uh=Xe({stridedSlice_:function(n,r,e,t,o,a,i,s,u){if(o===void 0&&(o=0),a===void 0&&(a=0),i===void 0&&(i=0),s===void 0&&(s=0),u===void 0&&(u=0),t==null&&(t=new Array(r.length)),i!==0)throw new Error("ellipsis mask is not yet supported");var f=Oe(n,"x","stridedSlice"),C=Ji(s),k=f.shape.slice();C.forEach(function(se){r[se]=0,e[se]=1,k.splice(se,0,1)}),f=f.reshape(k);for(var L=0;L<f.rank;L++)r[L]=Qs(o,r,t,f.shape,L),e[L]=qi(a,e,t,f.shape,L),t[L]=t[L]||1;var Y=Ji(u);Y.forEach(function(se){e[se]=r[se]+1,t[se]=1});var ne=Ca(r,e,t),ce=ne.filter(function(se,le){return Y.indexOf(le)===-1});return t.every(function(se){return se===1})?ro(f,r,ne).reshape(ce):Ve.runKernelFunc(function(se){return se.stridedSlice(f,r,e,t)},{$x:f}).reshape(ce)}}),Wh=Xe({topk_:function(n,r,e){r===void 0&&(r=1),e===void 0&&(e=!0);var t=Oe(n,"x","topk");if(t.rank===0)throw new Error("topk() expects the input to be of rank 1 or higher");var o=t.shape[t.shape.length-1];if(r>o)throw new Error("'k' passed to topk() must be <= the last dimension ("+o+") but got "+r);var a=Ve.runKernelFunc(function(i){return i.topk(t,r,e)},{$x:t});return{values:a[0],indices:a[1]}}}),Hh=Xe({scatterND_:function(n,r,e){var t=Oe(n,"indices","scatterND","int32"),o=Oe(r,"updates","scatterND");return $s(o,t,e),Ve.runKernelFunc(function(a){return a.scatterND(t,o,e)},{indices:t,updates:o},null,"ScatterNd",{shape:e})}}),wu=Xe({fft_:function(n){_(n.dtype==="complex64",function(){return"The dtype for tf.spectral.fft() must be complex64 but got "+n.dtype+"."});var r=n.shape[n.shape.length-1],e=n.size/r,t=n.as2D(e,r);return Ve.runKernelFunc(function(o){return o.fft(t)},{input:n}).reshape(n.shape)}}),gs=Xe({ifft_:function(n){_(n.dtype==="complex64",function(){return"The dtype for tf.spectral.ifft() must be complex64 but got "+n.dtype+"."});var r=n.shape[n.shape.length-1],e=n.size/r,t=n.as2D(e,r);return Ve.runKernelFunc(function(o){return o.ifft(t)},{input:n}).reshape(n.shape)}}),Eu=Xe({rfft_:function(n,r){_(n.dtype==="float32",function(){return"The dtype for rfft() must be real value but got "+n.dtype});var e,t=n.shape[n.shape.length-1],o=n.size/t;if(r!=null&&r<t){var a=n.shape.map(function(le){return 0}),i=n.shape.map(function(le){return le});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(le){return le});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=br(e,u).as2D(o,t),C=wu(f),k=Math.floor(t/2)+1,L=sn(C),Y=wn(C),ne=L.split([k,t-k],L.shape.length-1),ce=Y.split([k,t-k],Y.shape.length-1),se=e.shape.slice();return se[e.shape.length-1]=k,br(ne[0],ce[0]).reshape(se)}}),Sl=Xe({irfft_:function(n){var r=n.shape[n.shape.length-1],e=n.size/r;if(r<=2){var t=n.as2D(e,r),o=gs(t);return sn(o)}var a=[e,2*(r-1)],i=sn(n).as2D(e,r),s=wn(n).as2D(e,r),u=i.slice([0,1],[e,r-2]).reverse(1),f=s.slice([0,1],[e,r-2]).reverse(1).mul(Nt(-1)),C=i.concat(u,1),k=s.concat(f,1);return t=br(C,k).as2D(a[0],a[1]),o=gs(t),sn(o)}}),zh=Object.freeze({fft:wu,ifft:gs,rfft:Eu,irfft:Sl}),Gh=Xe({sparseToDense_:function(n,r,e,t){t===void 0&&(t=0);var o=Oe(n,"sparseIndices","sparseToDense","int32"),a=Oe(r,"sparseValues","sparseToDense"),i=Oe(t,"defaultValue","sparseToDense",a.dtype);return function(s,u,f,C){if(s.dtype!=="int32")throw new Error("tf.sparseToDense() expects the indices to be int32 type, but the dtype was "+s.dtype+".");if(s.rank>2)throw new Error("sparseIndices should be a scalar, vector, or matrix, but got shape "+s.shape+".");var k=s.rank>0?s.shape[0]:1,L=s.rank>1?s.shape[1]:1;if(f.length!==L)throw new Error("outputShape has incorrect number of elements:, "+f.length+", should be: "+L+".");var Y=u.size;if(u.rank!==0&&(u.rank!==1||Y!==k))throw new Error("sparseValues has incorrect shape "+u.shape+", should be [] or ["+k+"]");if(u.dtype!==C.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}(o,a,e,i),Ve.runKernelFunc(function(s){return s.sparseToDense(o,a,e,i)},{$sparseIndices:o,$sparseValues:a,$defaultValue:i})}}),Vh=Xe({gatherND_:function(n,r){var e=Oe(r,"indices","gatherND","int32"),t=Oe(n,"x","gatherND");return Ve.runKernelFunc(function(o){return o.gatherND(t,e)},{x:t,indices:e},null,"GatherNd")}}),Xh=Xe({diag_:function(n){var r=Oe(n,"x","diag").flatten(),e=n.shape.concat(n.shape);return Ve.runKernelFunc(function(t){return t.diag(r)},{$x:r}).reshape(e)}}),Kh=Xe({dropout_:function(n,r,e,t){var o=Oe(n,"x","dropout");if(_(o.dtype==="float32",function(){return"x has to be a floating point tensor since it's going to be scaled, but got a "+o.dtype+" tensor instead."}),_(r>=0&&r<1,function(){return"rate must be a float in the range [0, 1), but got "+r+"."}),r===0)return n instanceof Dr?o.clone():o;var a=function(u,f){if(f==null)return u.shape.slice();if(we(u.shape,f))return f;if(u.shape.length===f.length){for(var C=[],k=0;k<u.shape.length;k++)f[k]==null&&u.shape[k]!=null?C.push(u.shape[k]):C.push(f[k]);return C}return f}(o,e),i=1-r,s=ui(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 _u=Xe({hannWindow_:function(n){return Al(n,.5,.5)}}),Ol=Xe({hammingWindow_:function(n){return Al(n,.54,.46)}}),Cu=Xe({frame_:function(n,r,e,t,o){t===void 0&&(t=!1),o===void 0&&(o=0);for(var a=0,i=[];a+r<=n.size;)i.push(ro(n,a,r)),a+=e;if(t)for(;a<n.size;){var s=a+r-n.size,u=pn([ro(n,a,r-s),oi([s],o)]);i.push(u),a+=e}return i.length===0?Qn([],[0,r]):pn(i).as2D(i.length,r)}}),Rl=Xe({stft_:function(n,r,e,t,o){var a;o===void 0&&(o=_u),t==null&&(a=r,t=Math.floor(Math.pow(2,Math.ceil(Math.log(a)/Math.log(2)))));for(var i=Cu(n,r,e),s=ea(i,o(r)),u=[],f=0;f<i.shape[0];f++)u.push(Eu(s.slice([f,0],[1,r]),t));return pn(u)}}),Yh=Object.freeze({hannWindow:_u,hammingWindow:Ol,frame:Cu,stft:Rl}),tn,$h=function(n,r,e){return e===void 0&&(e=1),E(this,void 0,void 0,function(){var t,o,a,i,s,u,f,C,k,L,Y,ne,ce,se;return g(this,function(le){switch(le.label){case 0:return t=Oe(n,"predictions","inTopK"),o=Oe(r,"targets","inTopK"),_(t.rank>1,function(){return"inTopK() expects the predictions to be of rank 2 or higher, but got "+t.rank}),_(t.rank-1===o.rank,function(){return"predictions rank should be 1 larger than targets rank, but got predictions rank "+t.rank+" and targets rank "+o.rank}),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],_(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=le.sent(),[4,o.data()];case 2:for(s=le.sent(),u=[i.length/a,a],C=u[1],k=Se("bool",f=u[0]),L=0;L<f;L++){for(Y=L*C,ne=i.subarray(Y,Y+C),ce=[],se=0;se<ne.length;se++)ce.push({value:ne[se],index:se});for(ce.sort(function(xe,Ee){return Ee.value-xe.value}),k[L]=0,se=0;se<e;se++)if(ce[se].index===s[L]){k[L]=1;break}}return n!==t&&t.dispose(),r!==o&&o.dispose(),[2,Ur(k,o.shape,"bool")]}})})};!function(n){n[n.NONE=0]="NONE",n[n.MEAN=1]="MEAN",n[n.SUM=2]="SUM",n[n.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"}(tn||(tn={}));var Jh=Xe({absoluteDifference_:function(n,r,e,t){t===void 0&&(t=tn.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 no(s,i,t)}}),no=Xe({computeWeightedLoss_:function(n,r,e){e===void 0&&(e=tn.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===tn.NONE)return a;if(e===tn.SUM)return a.sum();if(e===tn.MEAN){if(o==null)return a.mean();var i=t.size/o.size,s=a.sum().div(o.sum());return i>1?s.div(Nt(i)):s}if(e===tn.SUM_BY_NONZERO_WEIGHTS){if(o==null)return a.sum().div(Nt(t.size));var u=o.mul(Mn(t.shape)).notEqual(Nt(0)).sum().toFloat();return a.sum().div(u)}throw Error("Unknown reduction: "+e)}}),qh=Xe({cosineDistance_:function(n,r,e,t,o){o===void 0&&(o=tn.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=Nt(1).sub(a.mul(i).sum(e,!0));return no(u,s,o)}}),Qh=Xe({hingeLoss_:function(n,r,e,t){t===void 0&&(t=tn.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=Nt(1);o=Nt(2).mul(o).sub(s);var u=s.sub(o.mul(a)).relu();return no(u,i,t)}}),Zh=Xe({huberLoss_:function(n,r,e,t,o){t===void 0&&(t=1),o===void 0&&(o=tn.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=Nt(t),f=i.sub(a).abs(),C=tl(f,u),k=f.sub(C),L=Nt(.5).mul(C.square()).add(u.mul(k));return no(L,s,o)}}),ep=Xe({logLoss_:function(n,r,e,t,o){t===void 0&&(t=1e-7),o===void 0&&(o=tn.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=Nt(1),f=Nt(t),C=a.mul(i.add(f).log()).neg().sub(u.sub(a).mul(u.sub(i).add(f).log()));return no(C,s,o)}}),tp=Xe({meanSquaredError_:function(n,r,e,t){t===void 0&&(t=tn.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 no(s,i,t)}}),rp=Xe({sigmoidCrossEntropy_:function(n,r,e,t,o){t===void 0&&(t=0),o===void 0&&(o=tn.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=Nt(t),f=Nt(1),C=Nt(.5);a=a.mul(f.sub(u)).add(C.mul(u))}var k=function(L,Y){var ne=Oe(L,"labels","sigmoidCrossEntropyWithLogits"),ce=Oe(Y,"logits","sigmoidCrossEntropyWithLogits");X(ne.shape,ce.shape,"Error in sigmoidCrossEntropyWithLogits: ");var se=ce.relu(),le=ce.mul(ne),xe=ce.abs().neg().exp().log1p();return se.sub(le).add(xe)}(a,i);return no(k,s,o)}}),np=Xe({softmaxCrossEntropy_:function(n,r,e,t,o){t===void 0&&(t=0),o===void 0&&(o=tn.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=Nt(t),f=Nt(1),C=Nt(a.shape[1]);a=a.mul(f.sub(u)).add(u.div(C))}var k=function(L,Y,ne){if(ne===void 0&&(ne=-1),ne===-1&&(ne=Y.rank-1),ne!==Y.rank-1)throw Error("Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank "+Y.rank+" and dim was "+ne);return Eo(function(ce,se,le){var xe=se.logSumExp([ne],!0),Ee=se.toFloat().sub(xe);return le([ce,Ee]),{value:Ee.mul(ce).neg().sum([ne]),gradFunc:function(Ce,Te){var Me=Te[0],He=Te[1],Be=Vr(Ce.shape,[ne]);return[Ce.reshape(Be).mul(Me.toFloat().sub(He.exp())),Ce.reshape(Be).mul(He.exp().sub(Me.toFloat()))]}}})(L,Y)}(a,i);return no(k,s,o)}}),op=Object.freeze({get Reduction(){return tn},absoluteDifference:Jh,computeWeightedLoss:no,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=Gi(e),a=n.clone(),i=Qn([[1]],[1,1]),s=i.clone(),u=e>=t?t:e,f=function(k){var L,Y=a,ne=s,ce=o;L=Ve.tidy(function(){var se=a.slice([k,k],[e-k,1]),le=se.norm(),xe=a.slice([k,k],[1,1]),Ee=Qn([[-1]]).where(xe.greater(0),Qn([[1]])),Ce=xe.sub(Ee.mul(le)),Te=se.div(Ce);s=Te.shape[0]===1?i.clone():i.concat(Te.slice([1,0],[Te.shape[0]-1,Te.shape[1]]),0);var Me=Ee.matMul(Ce).div(le).neg(),He=a.slice([k,0],[e-k,t]),Be=Me.mul(s);if(k===0)a=He.sub(Be.matMul(s.transpose().matMul(He)));else{var je=He.sub(Be.matMul(s.transpose().matMul(He)));a=a.slice([0,0],[k,t]).concat(je,0)}var We=o.slice([0,k],[e,o.shape[1]-k]);if(k===0)o=We.sub(We.matMul(s).matMul(Be.transpose()));else{var Ze=We.sub(We.matMul(s).matMul(Be.transpose()));o=o.slice([0,0],[e,k]).concat(Ze,1)}return[s,a,o]}),s=L[0],a=L[1],o=L[2],qr([Y,ne,ce])},C=0;C<u;++C)f(C);return!r&&e>t&&(o=o.slice([0,0],[e,t]),a=a.slice([0,0],[t,t])),[o,a]})}var ap=Xe({bandPart_:function(n,r,e){if(r%1!=0)throw new Error("bandPart(): numLower must be an integer, got "+r+".");if(e%1!=0)throw new Error("bandPart(): numUpper must be an integer, got "+e+".");var t=Oe(n,"a","bandPart");if(t.rank<2)throw new Error("bandPart(): Rank must be at least 2, got "+t.rank+".");var o=t.shape,a=t.shape.slice(-2),i=a[0],s=a[1];if(!(r<=i))throw new Error("bandPart(): numLower ("+r+") must not be greater than the number of rows ("+i+").");if(!(e<=s))throw new Error("bandPart(): numUpper ("+e+") must not be greater than the number of columns ("+s+").");r<0&&(r=i),e<0&&(e=s);var u=pa(0,i,1,"int32").reshape([-1,1]),f=pa(0,s,1,"int32"),C=Oo(u,f),k=hs(C.lessEqual(Nt(+r,"int32")),C.greaterEqual(Nt(-e,"int32"))),L=Tr([i,s],t.dtype);return Ln(Ea(t.reshape([-1,i,s])).map(function(Y){return Qo(k,Y,L)})).reshape(o)}}),ip=Xe({gramSchmidt_:function(n){var r;if(Array.isArray(n)){r=!1,_(n!=null&&n.length>0,function(){return"Gram-Schmidt process: input must not be null, undefined, or empty"});for(var e=n[0].shape[0],t=function(u){_(n[u].shape[0]===e,function(){return"Gram-Schmidt: Non-unique lengths found in the input vectors: ("+n[u].shape[0]+" vs. "+e+")"})},o=1;o<n.length;++o)t(o)}else r=!0,n=Uo(n,n.shape[0],0).map(function(u){return Ki(u,[0])});_(n.length<=n[0].shape[0],function(){return"Gram-Schmidt: Number of vectors ("+n.length+") exceeds number of dimensions ("+n[0].shape[0]+")."});var a=[],i=n,s=function(u){a.push(Ve.tidy(function(){var f=i[u];if(u>0)for(var C=0;C<u;++C){var k=xl(a[C].mulStrict(f)).mul(a[C]);f=f.sub(k)}return f.div(Tl(f,"euclidean"))}))};for(o=0;o<n.length;++o)s(o);return r?Ln(a,0):a}}),sp=Xe({qr_:function(n,r){if(r===void 0&&(r=!1),n.rank<2)throw new Error("qr() requires input tensor to have a rank >= 2, but got rank "+n.rank);if(n.rank===2)return Il(n,r);var e=n.shape.slice(0,n.shape.length-2).reduce(function(i,s){return i*s}),t=Ea(n.reshape([e,n.shape[n.shape.length-2],n.shape[n.shape.length-1]]),0),o=[],a=[];return t.forEach(function(i){var s=Il(i,r),u=s[0],f=s[1];o.push(u),a.push(f)}),[Ln(o,0).reshape(n.shape),Ln(a,0).reshape(n.shape)]}}),up=Object.freeze({bandPart:ap,gramSchmidt:ip,qr:sp});function ys(n,r,e,t,o,a){t==null&&(t=.5),o==null&&(o=Number.NEGATIVE_INFINITY),a==null&&(a=0);var i=n.shape[0];return e=Math.min(e,i),_(0<=t&&t<=1,function(){return"iouThreshold must be in [0, 1], but was '"+t+"'"}),_(n.rank===2,function(){return"boxes must be a 2D tensor, but was of rank '"+n.rank+"'"}),_(n.shape[1]===4,function(){return"boxes must have 4 columns, but 2nd dimension was "+n.shape[1]}),_(r.rank===1,function(){return"scores must be a 1D tensor"}),_(r.shape[0]===i,function(){return"scores has incompatible shape with boxes. Expected "+i+", but was "+r.shape[0]}),_(0<=a&&a<=1,function(){return"softNmsSigma must be in [0, 1], but was '"+a+"'"}),{maxOutputSize:e,iouThreshold:t,scoreThreshold:o,softNmsSigma:a}}var cp=Xe({resizeBilinear_:function(n,r,e){e===void 0&&(e=!1);var t=Oe(n,"images","resizeBilinear");_(t.rank===3||t.rank===4,function(){return"Error in resizeBilinear: x must be rank 3 or 4, but got rank "+t.rank+"."}),_(r.length===2,function(){return"Error in resizeBilinear: new shape must 2D, but got shape "+r+"."});var o=t,a=!1;t.rank===3&&(a=!0,o=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var i=r[0],s=r[1],u=Ve.runKernelFunc(function(f,C){return C([o]),f.resizeBilinear(o,i,s,e)},{x:o},function(f,C){return{x:function(){return Ve.runKernelFunc(function(k){return k.resizeBilinearBackprop(f,C[0],e)},{})}}},"ResizeBilinear",{alignCorners:e,newHeight:i,newWidth:s});return a?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),lp=Xe({resizeNearestNeighbor_:function(n,r,e){e===void 0&&(e=!1);var t=Oe(n,"images","resizeNearestNeighbor");_(t.rank===3||t.rank===4,function(){return"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank "+t.rank+"."}),_(r.length===2,function(){return"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+r+"."}),_(t.dtype==="float32"||t.dtype==="int32",function(){return"`images` must have `int32` or `float32` as dtype"});var o=t,a=!1;t.rank===3&&(a=!0,o=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var i=r[0],s=r[1],u=Ve.runKernelFunc(function(f,C){return C([o]),f.resizeNearestNeighbor(o,i,s,e)},{batchImages:o},function(f,C){return{batchImages:function(){return Ve.runKernelFunc(function(k){return k.resizeNearestNeighborBackprop(f,C[0],e)},{})}}});return a?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),dp=Xe({nonMaxSuppression_:function(n,r,e,t,o){t===void 0&&(t=.5),o===void 0&&(o=Number.NEGATIVE_INFINITY);var a=Oe(n,"boxes","nonMaxSuppression"),i=Oe(r,"scores","nonMaxSuppression"),s=ys(a,i,e,t,o);e=s.maxOutputSize,t=s.iouThreshold,o=s.scoreThreshold;var u={maxOutputSize:e,iouThreshold:t,scoreThreshold:o};return Ve.runKernelFunc(function(f){return f.nonMaxSuppression(a,i,e,t,o)},{boxes:a,scores:i},null,"NonMaxSuppressionV3",u)}}),fp=function(n,r,e,t,o){return t===void 0&&(t=.5),o===void 0&&(o=Number.NEGATIVE_INFINITY),E(this,void 0,void 0,function(){var a,i,s,u,f,C,k;return g(this,function(L){switch(L.label){case 0:return a=Oe(n,"boxes","nonMaxSuppressionAsync"),i=Oe(r,"scores","nonMaxSuppressionAsync"),s=ys(a,i,e,t,o),e=s.maxOutputSize,t=s.iouThreshold,o=s.scoreThreshold,[4,Promise.all([a.data(),i.data()])];case 1:return u=L.sent(),f=u[0],C=u[1],k=pi(f,C,e,t,o),a!==n&&a.dispose(),i!==r&&i.dispose(),[2,k]}})})},hp=Xe({nonMaxSuppressionWithScore_:function(n,r,e,t,o,a){t===void 0&&(t=.5),o===void 0&&(o=Number.NEGATIVE_INFINITY),a===void 0&&(a=0);var i=Oe(n,"boxes","nonMaxSuppression"),s=Oe(r,"scores","nonMaxSuppression"),u=ys(i,s,e,t,o,a),f={maxOutputSize:e=u.maxOutputSize,iouThreshold:t=u.iouThreshold,scoreThreshold:o=u.scoreThreshold,softNmsSigma:a=u.softNmsSigma},C=Ve.runKernel("NonMaxSuppressionV5",{boxes:i,scores:s},f);return{selectedIndices:C[0],selectedScores:C[1]}}}),pp=function(n,r,e,t,o,a){return t===void 0&&(t=.5),o===void 0&&(o=Number.NEGATIVE_INFINITY),a===void 0&&(a=0),E(this,void 0,void 0,function(){var i,s,u,f,C,k,L;return g(this,function(Y){switch(Y.label){case 0:return i=Oe(n,"boxes","nonMaxSuppressionAsync"),s=Oe(r,"scores","nonMaxSuppressionAsync"),u=ys(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=Y.sent(),C=f[0],k=f[1],L=mi(C,k,e,t,o,a),i!==n&&i.dispose(),s!==r&&s.dispose(),[2,L]}})})},mp=Xe({cropAndResize_:function(n,r,e,t,o,a){var i=Oe(n,"image","cropAndResize"),s=Oe(r,"boxes","cropAndResize","float32"),u=Oe(e,"boxInd","cropAndResize","int32");o=o||"bilinear",a=a||0;var f=s.shape[0];return _(i.rank===4,function(){return"Error in cropAndResize: image must be rank 4,but got rank "+i.rank+"."}),_(s.rank===2&&s.shape[1]===4,function(){return"Error in cropAndResize: boxes must be have size ["+f+",4] but had shape "+s.shape+"."}),_(u.rank===1&&u.shape[0]===f,function(){return"Error in cropAndResize: boxInd must be have size ["+f+"] but had shape "+s.shape+"."}),_(t.length===2,function(){return"Error in cropAndResize: cropSize must be of length 2, but got length "+t.length+"."}),_(t[0]>=1&&t[1]>=1,function(){return"cropSize must be atleast [1,1], but was "+t}),_(o==="bilinear"||o==="nearest",function(){return"method must be bilinear or nearest, but was "+o}),Ve.runKernelFunc(function(C,k){return C.cropAndResize(i,s,u,t,o,a)},{images:i,boxes:s,boxInd:u},null,"CropAndResize",{method:o,extrapolationValue:a,cropSize:t})}}),Nl=Object.freeze({resizeBilinear:cp,resizeNearestNeighbor:lp,nonMaxSuppression:dp,nonMaxSuppressionAsync:fp,nonMaxSuppressionWithScore:hp,nonMaxSuppressionWithScoreAsync:pp,cropAndResize:mp}),Tu=function(n,r){return!(n>0)||r==="linear"},Su=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.")},Au=function(n,r){var e=r,t=Ir(n.shape,r.shape);return t.length>0&&(e=e.sum(t)),e.reshape(n.shape)},Ou=function(n,r,e){if(r==="linear")return n;if(r==="relu")return xu(n);if(r==="elu")return wl(n);if(r==="relu6")return _l(n);if(r==="prelu")return El(n,e);throw new Error("Unknown fused activation "+r+".")},vp=Xe({fusedMatMul_:function(n){var r,e=n.a,t=n.b,o=n.transposeA,a=o!==void 0&&o,i=n.transposeB,s=i!==void 0&&i,u=n.bias,f=n.activation,C=f===void 0?"linear":f,k=n.preluActivationWeights;if(Tu(Ve.state.gradientDepth,C)===!1){var L=bu(e,t,a,s);return u!=null&&(L=Zo(L,u)),Ou(L,C,k)}var Y=Oe(e,"a","fused matMul"),ne=Oe(t,"b","fused matMul");r=cr(Y,ne),Y=r[0],ne=r[1];var ce=a?Y.shape[Y.rank-2]:Y.shape[Y.rank-1],se=s?ne.shape[ne.rank-1]:ne.shape[ne.rank-2],le=a?Y.shape[Y.rank-1]:Y.shape[Y.rank-2],xe=s?ne.shape[ne.rank-2]:ne.shape[ne.rank-1],Ee=Y.shape.slice(0,-2),Ce=ne.shape.slice(0,-2),Te=de(Ee),Me=de(Ce);_(Y.rank>=2&&ne.rank>=2&&Y.rank===ne.rank,function(){return"Error in fused matMul: inputs must have the same rank of at least 2, got ranks "+Y.rank+" and "+ne.rank+"."}),_(we(Ee,Ce),function(){return"Error in fused matMul: outer dimensions ("+Ee+") and ("+Ce+") of Tensors with shapes "+Y.shape+" and "+ne.shape+" must match."}),_(ce===se,function(){return"Error in fused matMul: inner shapes ("+ce+") and ("+se+") of Tensors with shapes "+Y.shape+" and "+ne.shape+" and transposeA="+a+" and transposeB="+s+" must match."});var He,Be,je=Y.shape.slice(0,-2).concat([le,xe]),We=a?Y.as3D(Te,ce,le):Y.as3D(Te,le,ce),Ze=s?ne.as3D(Me,xe,se):ne.as3D(Me,se,xe);u!=null&&Wt(je,(He=cr(He=Oe(u,"bias","fused matMul"),Y)[0]).shape),k!=null&&(Be=Oe(k,"prelu weights","fused matMul"));var Je={a:We,b:Ze};u!=null&&(Je.bias=He),k!=null&&(Je.preluActivationWeights=Be);var ht=[We,Ze];return Ve.runKernelFunc(function(lt,ut){var gt=lt.fusedBatchMatMul({a:We,b:Ze,transposeA:a,transposeB:s,bias:He,activation:C,preluActivationWeights:Be});return ut([We,Ze,gt]),gt},Je,function(lt,ut){var gt=ut[0],mt=ut[1],ct=ut[2],xt=Su(lt,ct,C),wt={};return u!=null&&(wt={bias:function(){return Au(He,xt)}}),a||s?!a&&s?Object.assign({a:function(){return xt.matMul(mt,!1,!1)},b:function(){return xt.matMul(gt,!0,!1)}},wt):a&&!s?Object.assign({a:function(){return mt.matMul(xt,!1,!0)},b:function(){return gt.matMul(xt,!1,!1)}},wt):Object.assign({a:function(){return mt.matMul(xt,!0,!0)},b:function(){return xt.matMul(gt,!0,!0)}},wt):Object.assign({a:function(){return xt.matMul(mt,!1,!0)},b:function(){return gt.matMul(xt,!0,!1)}},wt)},"_FusedMatMul",{transposeA:a,transposeB:s,activation:C},ht,[!0]).reshape(je)}}),gp=Xe({fusedConv2d_:function(n){var r=n.x,e=n.filter,t=n.strides,o=n.pad,a=n.dataFormat,i=a===void 0?"NHWC":a,s=n.dilations,u=s===void 0?[1,1]:s,f=n.dimRoundingMode,C=n.bias,k=n.activation,L=k===void 0?"linear":k,Y=n.preluActivationWeights;if(L=L||"linear",Tu(Ve.state.gradientDepth,L)===!1){var ne=Pa(r,e,t,o,i,u,f);return C!=null&&(ne=Zo(ne,C)),Ou(ne,L,Y)}var ce=Oe(r,"x","conv2d"),se=Oe(e,"filter","conv2d"),le=ce,xe=!1;ce.rank===3&&(xe=!0,le=ce.as4D(1,ce.shape[0],ce.shape[1],ce.shape[2])),_(le.rank===4,function(){return"Error in fused conv2d: input must be rank 4, but got rank "+le.rank+"."}),_(se.rank===4,function(){return"Error in fused conv2d: filter must be rank 4, but got rank "+se.rank+"."}),f!=null&&_(ge(o),function(){return"Error in fused conv2d: pad must be an integer when using, dimRoundingMode "+f+" but got pad "+o+"."}),_(le.shape[3]===se.shape[2],function(){return"Error in conv2d: depth of input ("+le.shape[3]+") must match input depth for filter "+se.shape[2]+"."}),_(Zr(t,u),function(){return"Error in conv2D: Either strides or dilations must be 1. Got strides "+t+" and dilations '"+u+"'"}),_(i==="NHWC",function(){return"Error in conv2d: got dataFormat of "+i+" but only NHWC is currently supported."});var Ee,Ce,Te=jn(le.shape,se.shape,t,u,o,f);C!=null&&(Ee=cr(Ee=Oe(C,"bias","fused conv2d"),ce)[0],Wt(Te.outShape,Ee.shape)),Y!=null&&(Ce=Oe(Y,"prelu weights","fused conv2d"));var Me={x:le,filter:se};C!=null&&(Me.bias=Ee),Y!=null&&(Me.preluActivationWeights=Ce);var He=[se,le],Be=Ve.runKernelFunc(function(je,We){var Ze=je.fusedConv2d({input:le,filter:se,convInfo:Te,bias:Ee,activation:L,preluActivationWeights:Ce});return We([se,le,Ze]),Ze},Me,function(je,We){var Ze=We,Je=Ze[0],ht=Ze[1],lt=Ze[2],ut=Su(je,lt,L);_(To(u),function(){return"Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+u+"'"});var gt={};return C!=null&&(gt={bias:function(){return Au(Ee,ut)}}),Object.assign({x:function(){return cl(ht.shape,ut,Je,t,o)},filter:function(){return yu(ht,ut,Je.shape,t,o)}},gt)},"FusedConv2D",{convInfo:Te,activation:L},He,[!0]);return xe?Be.as3D(Be.shape[1],Be.shape[2],Be.shape[3]):Be}}),yp=Xe({fusedDepthwiseConv2d_:function(n){var r=n.x,e=n.filter,t=n.strides,o=n.pad,a=n.dataFormat,i=a===void 0?"NHWC":a,s=n.dilations,u=s===void 0?[1,1]:s,f=n.dimRoundingMode,C=n.bias,k=n.activation,L=k===void 0?"linear":k,Y=n.preluActivationWeights;if(Tu(Ve.state.gradientDepth,L)===!1){var ne=vs(r,e,t,o,i,u,f);return C!=null&&(ne=Zo(ne,C)),Ou(ne,L,Y)}var ce=Oe(r,"x","depthwiseConv2d"),se=Oe(e,"filter","depthwiseConv2d"),le=ce,xe=!1;ce.rank===3&&(xe=!0,le=ce.as4D(1,ce.shape[0],ce.shape[1],ce.shape[2])),_(le.rank===4,function(){return"Error in fused depthwiseConv2d: input must be rank 4, but got rank "+le.rank+"."}),_(se.rank===4,function(){return"Error in fused depthwiseConv2d: filter must be rank 4, but got rank "+se.rank+"."}),_(le.shape[3]===se.shape[2],function(){return"Error in fused depthwiseConv2d: number of input channels ("+le.shape[3]+") must match the inChannels dimension in filter "+se.shape[2]+"."}),u==null&&(u=[1,1]),_(Zr(t,u),function(){return"Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides "+t+" and dilations '"+u+"'"}),f!=null&&_(ge(o),function(){return"Error in fused depthwiseConv2d: pad must be an integer when using dimRoundingMode "+f+" but got pad "+o+"."});var Ee,Ce,Te=jn(le.shape,se.shape,t,u,o,f,!0);C!=null&&(Ee=cr(Ee=Oe(C,"bias","fused conv2d"),ce)[0],Wt(Te.outShape,Ee.shape)),Y!=null&&(Ce=Oe(Y,"prelu weights","fused depthwiseConv2d"));var Me={x:le,filter:se};C!=null&&(Me.bias=Ee),Y!=null&&(Me.preluActivationWeights=Ce);var He=[se,le],Be=Ve.runKernelFunc(function(je,We){var Ze=je.fusedDepthwiseConv2D({input:le,filter:se,convInfo:Te,bias:Ee,activation:L,preluActivationWeights:Ce});return We([se,le,Ze]),Ze},Me,function(je,We){_(To(u),function(){return"Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+u+"'"});var Ze=We[0],Je=We[1],ht=We[2],lt=Su(je,ht,L),ut={};return C!=null&&(ut={bias:function(){return Au(Ee,lt)}}),Object.assign({x:function(){return ll(Je.shape,lt,Ze,Te)},filter:function(){return dl(Je,lt,Ze.shape,Te)}},ut)},"FusedDepthwiseConv2D",{convInfo:Te,activation:L},He,[!0]);return xe?Be.as3D(Be.shape[1],Be.shape[2],Be.shape[3]):Be}}),bp=Object.freeze({matMul:vp,conv2d:gp,depthwiseConv2d:yp}),xp=Object.freeze({image:Nl,linalg:up,losses:op,spectral:zh,fused:bp,signal:Yh,square:Zd,squaredDifference:zc,conv1d:ch,conv2d:Pa,conv3d:lh,depthwiseConv2d:vs,separableConv2d:fl,conv2dTranspose:dh,conv3dTranspose:fh,op:Xe,batchNormalization2d:If,batchNormalization3d:Nf,batchNormalization4d:Df,batchNormalization:kf,batchNorm:qc,batchNorm2d:Mf,batchNorm3d:Pf,batchNorm4d:Ff,booleanMaskAsync:uh,complex:br,real:sn,imag:wn,concat:pn,concat1d:Is,concat2d:Ns,concat3d:ma,concat4d:Ds,split:Uo,matMul:bu,dot:hh,outerProduct:ph,reverse:Ti,reverse1d:mh,reverse2d:vh,reverse3d:gh,reverse4d:yh,maxPool:ml,avgPool:vl,pool:bh,maxPool3d:xh,avgPool3d:wh,slice:ro,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:pu,reciprocal:gf,round:yf,rsqrt:Xc,sigmoid:Kc,sign:bf,isNaN:xf,isInf:wf,isFinite:Ef,sin:_f,sinh:Cf,softplus:Tf,sqrt:Sf,step:Af,tan:Of,tanh:Rf,all:Th,any:Sh,argMax:Ah,argMin:Oh,logSumExp:Rh,max:bl,mean:Ih,min:Nh,moments:Dh,sum:xl,prod:kh,equal:rl,equalStrict:Qf,greater:Zf,greaterEqual:nl,greaterEqualStrict:eh,greaterStrict:th,less:rh,lessEqual:nh,lessEqualStrict:oh,lessStrict:ah,notEqual:ih,notEqualStrict:sh,add:Zo,addN:Bf,addStrict:Uf,atan2:Wf,div:ps,divNoNan:Hf,divStrict:zf,floorDiv:el,maximum:mu,maximumStrict:Gf,minimum:tl,minimumStrict:Vf,mod:Xf,modStrict:Kf,mul:ea,mulStrict:Yf,pow:ms,powStrict:$f,squaredDifferenceStrict:Jf,sub:Oo,subStrict:qf,elu:wl,leakyRelu:Mh,prelu:El,relu:xu,relu6:_l,selu:Ph,logicalAnd:hs,logicalNot:Lf,logicalOr:Qc,logicalXor:jf,where:Qo,whereAsync:Zc,buffer:Lt,print:ga,batchToSpaceND:ya,broadcastTo:Ls,cast:ba,clone:xa,cumsum:js,depthToSpace:Bs,expandDims:In,eye:Gi,multinomial:ai,oneHot:ii,pad:Fn,pad1d:Vi,pad2d:wo,pad3d:si,pad4d:Us,rand:Ws,randomNormal:Hs,randomGamma:zs,randomUniform:ui,reshape:wa,spaceToBatchND:Xi,squeeze:Ki,stack:Ln,tile:Zn,truncatedNormal:Gs,unstack:Ea,setdiff1dAsync:Vs,fill:oi,linspace:uc,ones:Mn,range:pa,scalar:Nt,tensor:Ur,tensor1d:qn,tensor2d:Qn,tensor3d:ni,tensor4d:kn,tensor5d:bo,tensor6d:Rs,variable:xo,zeros:Tr,onesLike:Wi,zerosLike:$t,transpose:Cl,softmax:Go,logSoftmax:di,localResponseNormalization:Fh,norm:Tl,gather:vu,unsortedSegmentSum:il,basicLSTMCell:Lh,multiRNNCell:jh,movingAverage:Bh,stridedSlice:Uh,topk:Wh,scatterND:Hh,fft:wu,ifft:gs,rfft:Eu,irfft:Sl,sparseToDense:Gh,gatherND:Vh,diag:Xh,dropout:Kh,hannWindow:_u,hammingWindow:Ol,frame:Cu,stft:Rl,inTopKAsync:$h});function pt(n,r){Array.isArray(n)||(n=[n]),n.forEach(function(e){e!=null&&_(e.dtype!=="complex64",function(){return r+" does not support complex64 tensors."})})}function Ru(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 Ta(e,Ve),e}return D(r,n),r.prototype.write=function(e,t,o){this.firstUse&&(this.firstUse=!1,p().get("IS_NODE")&&ha(`
|
|
|
============================
|
|
|
Hi there \u{1F44B}. Looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, which binds to TensorFlow C++, by running npm i @tensorflow/tfjs-node, or npm i @tensorflow/tfjs-node-gpu if you have CUDA. Then call require('@tensorflow/tfjs-node'); (-gpu suffix for CUDA) at the start of your program. Visit https://github.com/tensorflow/tfjs-node for more details.
|
|
|
============================`));var a={};return this.data.set(a,{values:e,dtype:o}),a},r.prototype.move=function(e,t,o,a){this.data.set(e,{values:t,dtype:a})},r.prototype.numDataIds=function(){return this.data.numDataIds()},r.prototype.read=function(e){return E(this,void 0,void 0,function(){return g(this,function(t){return[2,this.readSync(e)]})})},r.prototype.readSync=function(e){var t=this.data.get(e),o=t.dtype,a=t.complexTensors;return o==="complex64"?Ia(this.readSync(a.real.dataId),this.readSync(a.imag.dataId)):this.data.get(e).values},r.prototype.bufferSync=function(e){var t=this.readSync(e.dataId),o=t;if(e.dtype==="string")try{o=t.map(function(a){return Qe(a)})}catch(a){throw new Error("Failed to decode encoded string bytes into utf-8")}return Lt(e.shape,e.dtype,o)},r.prototype.makeOutput=function(e,t,o){var a=this.write(e,t,o);return Ve.makeTensorFromDataId(a,t,o,this)},r.prototype.disposeData=function(e){if(this.data.has(e)){var t=this.data.get(e).complexTensors;t!=null&&(t.real.dispose(),t.imag.dispose()),this.data.delete(e)}},r.prototype.time=function(e){return E(this,void 0,void 0,function(){var t;return g(this,function(o){return t=fe(),e(),[2,{kernelMs:fe()-t}]})})},r.prototype.memory=function(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}},r.prototype.complex=function(e,t){var o=this.makeOutput(null,e.shape,"complex64");return this.data.get(o.dataId).complexTensors={real:Ve.keep(e.clone()),imag:Ve.keep(t.clone())},o},r.prototype.real=function(e){return this.data.get(e.dataId).complexTensors.real.clone()},r.prototype.imag=function(e){return this.data.get(e.dataId).complexTensors.imag.clone()},r.prototype.slice=function(e,t,o){if(pt(e,"slice"),Qi(e.shape,t,o)){var a=Zi(t,e.strides),i=de(o);return Ur(this.readSync(e.dataId).subarray(a,a+i),o,e.dtype)}for(var s=Lt(o,e.dtype),u=this.bufferSync(e),f=0;f<s.size;++f){var C=s.indexToLoc(f).map(function(k,L){return k+t[L]});s.values[f]=u.get.apply(u,C)}return s.toTensor()},r.prototype.stridedSlice=function(e,t,o,a){pt(e,"stridedSlice");var i=Ca(t,o,a);if(i.some(function(Y){return Y===0}))return Ur([],i);for(var s=Lt(i,e.dtype),u=this.bufferSync(e),f=0;f<s.size;f++){for(var C=s.indexToLoc(f),k=new Array(C.length),L=0;L<k.length;L++)k[L]=C[L]*a[L]+t[L];s.set.apply(s,[u.get.apply(u,k)].concat(C))}return s.toTensor()},r.prototype.diag=function(e){for(var t=this.readSync(e.dataId),o=Lt([e.size,e.size],e.dtype),a=o.values,i=0;i<t.length;i++)a[i*e.size+i]=t[i];return o.toTensor()},r.prototype.unstack=function(e,t){for(var o=e.shape[t],a=new Array(e.rank-1),i=0,s=0;s<e.rank;s++)s!==t&&(a[i++]=e.shape[s]);var u=new Array(e.rank).fill(0),f=e.shape.slice();f[t]=1;var C=new Array(o);for(s=0;s<C.length;s++)u[t]=s,C[s]=this.slice(e,u,f).reshape(a);return C},r.prototype.reverse=function(e,t){pt(e,"reverse");for(var o=Lt(e.shape,e.dtype),a=this.bufferSync(e),i=function(u){var f=o.indexToLoc(u),C=f.slice();t.forEach(function(k){return C[k]=e.shape[k]-1-C[k]}),o.set.apply(o,[a.get.apply(a,C)].concat(f))},s=0;s<o.size;s++)i(s);return o.toTensor()},r.prototype.concat=function(e,t){var o=this;if(e[0].dtype==="complex64"){var a=e.map(function(Y){return sn(Y)}),i=e.map(function(Y){return wn(Y)});return br(this.concat(a,t),this.concat(i,t))}var s=e.map(function(Y){var ne=de(Y.shape.slice(t));return Y.as2D(-1,ne)}),u=Jn(s.map(function(Y){return Y.shape}),1),f=Lt(u,e[0].dtype).values;if(s[0].shape[0]===1){var C=0;s.forEach(function(Y){f.set(o.readSync(Y.dataId),C),C+=Y.size})}else{var k=0;s.forEach(function(Y){for(var ne=o.readSync(Y.dataId),ce=0,se=0;se<Y.shape[0];++se)for(var le=se*u[1]+k,xe=0;xe<Y.shape[1];++xe)f[le+xe]=ne[ce++];k+=Y.shape[1]})}var L=Jn(e.map(function(Y){return Y.shape}),t);return Ur(f,L,e[0].dtype)},r.prototype.neg=function(e){return pt(e,"neg"),this.multiply(Nt(-1),e)},r.prototype.add=function(e,t){return e.dtype==="complex64"||t.dtype==="complex64"?this.broadcastedBinaryComplexOp(e.cast("complex64"),t.cast("complex64"),function(o,a,i,s){return{real:o+i,imag:a+s}}):this.broadcastedBinaryOp(e,t,nr(e.dtype,t.dtype),function(o,a){return o+a})},r.prototype.addN=function(e){var t=this;pt(e,"addN");for(var o=e.map(function(C){return t.readSync(C.dataId)}),a=Lt(e[0].shape,e[0].dtype),i=a.values,s=0;s<e.length;s++)for(var u=o[s],f=0;f<i.length;f++)i[f]+=u[f];return a.toTensor()},r.prototype.softmax=function(e,t){var o=ue([t],e.shape),a=this.max(e,o),i=Vr(a.shape,o),s=this.subtract(e,a.reshape(i)),u=this.exp(s),f=this.sum(u,o).reshape(i);return this.realDivide(u,f)},r.prototype.subtract=function(e,t){return e.dtype==="complex64"||t.dtype==="complex64"?this.broadcastedBinaryComplexOp(e.cast("complex64"),t.cast("complex64"),function(o,a,i,s){return{real:o-i,imag:a-s}}):this.broadcastedBinaryOp(e,t,nr(e.dtype,t.dtype),function(o,a){return o-a})},r.prototype.pow=function(e,t){return pt([e,t],"pow"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){return Math.pow(o,a)})},r.prototype.batchMatMul=function(e,t,o,a){pt([e,t],"matMul");for(var i=o?e.shape[1]:e.shape[2],s=o?e.shape[2]:e.shape[1],u=a?t.shape[1]:t.shape[2],f=e.shape[0],C=this.readSync(e.dataId),k=this.readSync(t.dataId),L=o?[e.strides[0],1,e.strides[1]]:[e.strides[0],e.strides[1],1],Y=L[0],ne=L[1],ce=L[2],se=a?[1,t.strides[1],t.strides[0]]:[t.strides[1],1,t.strides[0]],le=se[0],xe=se[1],Ee=se[2],Ce=s*u,Te=Lt([f,s,u],e.dtype),Me=Te.values,He=this.blockSize,Be=0;Be<f;Be++)for(var je=0;je<s;je+=He)for(var We=0;We<u;We+=He)for(var Ze=0;Ze<i;Ze+=He)for(var Je=Math.min(je+He,s),ht=Math.min(We+He,u),lt=Math.min(Ze+He,i),ut=je;ut<Je;ut++)for(var gt=We;gt<ht;gt++){for(var mt=0,ct=Ze;ct<lt;ct++)mt+=C[Be*Y+ut*ne+ct*ce]*k[ct*le+gt*xe+Be*Ee];Me[Be*Ce+(ut*u+gt)]+=mt}return Te.toTensor()},r.prototype.fusedBatchMatMul=function(e){var t=e.a,o=e.b,a=e.transposeA,i=e.transposeB,s=e.bias,u=e.activation,f=e.preluActivationWeights,C=this.batchMatMul(t,o,a,i);return s&&(C=this.add(C,s)),u&&(C=Ru(this,C,u,f)),C},r.prototype.multiply=function(e,t){return e.dtype==="complex64"||t.dtype==="complex64"?this.broadcastedBinaryComplexOp(e.cast("complex64"),t.cast("complex64"),function(o,a,i,s){return{real:o*i-a*s,imag:o*s+a*i}}):this.broadcastedBinaryOp(e,t,nr(e.dtype,t.dtype),function(o,a){return o*a})},r.prototype.realDivide=function(e,t){return pt([e,t],"realDivide"),this.broadcastedBinaryOp(e,t,"float32",function(o,a){return o/a})},r.prototype.floorDiv=function(e,t){return pt([e,t],"floorDiv"),this.broadcastedBinaryOp(e,t,"int32",function(o,a){return Math.floor(o/a)})},r.prototype.sum=function(e,t){pt(e,"sum"),nn("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=de(i),f=this.readSync(s.dataId),C=this.readSync(e.dataId),k=0;k<f.length;++k){for(var L=k*u,Y=0,ne=0;ne<u;++ne)Y+=C[L+ne];f[k]=Y}return s},r.prototype.prod=function(e,t){pt(e,"sum");for(var o=Gr(e.shape,t),a=o[0],i=o[1],s=Tr(a,nr(e.dtype,"int32")),u=de(i),f=this.readSync(s.dataId),C=this.readSync(e.dataId),k=0;k<f.length;++k){for(var L=k*u,Y=1,ne=0;ne<u;++ne)Y*=C[L+ne];f[k]=Y}return s},r.prototype.unsortedSegmentSum=function(e,t,o){pt(e,"unsortedSegmentSum");for(var a=[],i=e.rank-t.rank,s=0;s<i;++s)t=t.expandDims(s+1);for(s=0;s<o;++s){var u=Nt(s,"int32"),f=rl(u,t).asType("float32").mul(e).sum(0);a.push(f)}return Ln(a)},r.prototype.argMin=function(e,t){pt(e,"argMin");var o=[t];nn("argMin",o,e.rank);for(var a=Gr(e.shape,o),i=a[0],s=a[1],u=Tr(i,"int32"),f=de(s),C=this.readSync(u.dataId),k=this.readSync(e.dataId),L=0;L<C.length;++L){for(var Y=L*f,ne=k[Y],ce=0,se=0;se<f;++se){var le=k[Y+se];le<ne&&(ne=le,ce=se)}C[L]=ce}return u},r.prototype.argMax=function(e,t){pt(e,"argMax");var o=[t];nn("argMax",o,e.rank);for(var a=Gr(e.shape,o),i=a[0],s=a[1],u=Tr(i,"int32"),f=de(s),C=this.readSync(u.dataId),k=this.readSync(e.dataId),L=0;L<C.length;++L){for(var Y=L*f,ne=k[Y],ce=0,se=0;se<f;++se){var le=k[Y+se];le>ne&&(ne=le,ce=se)}C[L]=ce}return u},r.prototype.cumsum=function(e,t,o,a){if(pt(e,"cumsum"),t!==e.rank-1)throw new Error("backend.cumsum in CPU expects an inner-most axis="+(e.rank-1)+" but got axis="+t);for(var i=nr(e.dtype,"int32"),s=Tr(e.shape,i),u=this.readSync(s.dataId),f=this.readSync(e.dataId),C=e.shape[e.rank-1],k=a?function(se,le){return se+C-le-1}:function(se,le){return se+le},L=0;L<f.length;L+=C)for(var Y=0;Y<C;Y++){var ne=k(L,Y);if(Y===0)u[ne]=o?0:f[ne];else{var ce=k(L,Y-1);u[ne]=o?f[ce]+u[ce]:f[ne]+u[ce]}}return s},r.prototype.equal=function(e,t){return pt([e,t],"equal"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o===a?1:0})},r.prototype.notEqual=function(e,t){return pt([e,t],"notEqual"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o!==a?1:0})},r.prototype.less=function(e,t){return pt([e,t],"less"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o<a?1:0})},r.prototype.lessEqual=function(e,t){return pt([e,t],"lessEqual"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o<=a?1:0})},r.prototype.greater=function(e,t){return pt([e,t],"greater"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o>a?1:0})},r.prototype.greaterEqual=function(e,t){return pt([e,t],"greaterEqual"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o>=a?1:0})},r.prototype.logicalNot=function(e){pt(e,"logicalNot");for(var t=this.readSync(e.dataId),o=new Uint8Array(t.length),a=0;a<t.length;++a)o[a]=t[a]?0:1;return this.makeOutput(o,e.shape,"bool")},r.prototype.logicalAnd=function(e,t){return pt([e,t],"logicalAnd"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o&&a})},r.prototype.logicalOr=function(e,t){return pt([e,t],"logicalOr"),this.broadcastedBinaryOp(e,t,"bool",function(o,a){return o||a})},r.prototype.select=function(e,t,o){pt([e,t,o],"select");for(var a=this.readSync(e.dataId),i=this.readSync(t.dataId),s=this.readSync(o.dataId),u=Tr(t.shape,nr(t.dtype,o.dtype)),f=this.readSync(u.dataId),C=0,k=e.rank===0||e.rank>1||t.rank===1?1:de(t.shape.slice(1)),L=0;L<a.length;L++)for(var Y=0;Y<k;Y++)a[L]===1?f[C++]=i[L]:f[C++]=s[L];return u},r.prototype.where=function(e){pt([e],"where");var t=this.readSync(e.dataId);return vi(e.shape,t)},r.prototype.topk=function(e,t,o){return pt(e,"topk"),ss(this.readSync(e.dataId),e.shape,e.dtype,t)},r.prototype.min=function(e,t){pt(e,"min"),nn("min",t,e.rank);for(var o=Gr(e.shape,t),a=o[0],i=o[1],s=Tr(a,e.dtype),u=de(i),f=this.readSync(s.dataId),C=this.readSync(e.dataId),k=0;k<f.length;++k){for(var L=k*u,Y=C[L],ne=0;ne<u;++ne){var ce=C[L+ne];ce<Y&&(Y=ce)}f[k]=Y}return s},r.prototype.minimum=function(e,t){return pt([e,t],"minimum"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){return Math.min(o,a)})},r.prototype.mod=function(e,t){return pt([e,t],"mod"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){var i=o%a;return o<0&&a<0||o>=0&&a>=0?i:(i+a)%a})},r.prototype.max=function(e,t){pt(e,"max"),nn("max",t,e.rank);for(var o=Gr(e.shape,t),a=o[0],i=o[1],s=Tr(a,e.dtype),u=de(i),f=this.readSync(s.dataId),C=this.readSync(e.dataId),k=0;k<f.length;++k){for(var L=k*u,Y=C[L],ne=0;ne<u;++ne){var ce=C[L+ne];ce>Y&&(Y=ce)}f[k]=Y}return s},r.prototype.maximum=function(e,t){return pt([e,t],"maximum"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){return Math.max(o,a)})},r.prototype.all=function(e,t){pt(e,"all"),nn("all",t,e.rank);for(var o=Gr(e.shape,t),a=o[0],i=o[1],s=Tr(a,e.dtype),u=de(i),f=this.readSync(s.dataId),C=this.readSync(e.dataId),k=0;k<f.length;++k){for(var L=k*u,Y=C[L],ne=0;ne<u;++ne){var ce=C[L+ne];Y=Y&&ce}f[k]=Y}return s},r.prototype.any=function(e,t){pt(e,"any"),nn("any",t,e.rank);for(var o=Gr(e.shape,t),a=o[0],i=o[1],s=Tr(a,e.dtype),u=de(i),f=this.readSync(s.dataId),C=this.readSync(e.dataId),k=0;k<f.length;++k){for(var L=k*u,Y=C[L],ne=0;ne<u;++ne){var ce=C[L+ne];Y=Y||ce}f[k]=Y}return s},r.prototype.squaredDifference=function(e,t){return pt([e,t],"squaredDifference"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){var i=o-a;return i*i})},r.prototype.ceil=function(e){pt(e,"ceil");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a)o[a]=Math.ceil(t[a]);return this.makeOutput(o,e.shape,"float32")},r.prototype.floor=function(e){pt(e,"floor");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a)o[a]=Math.floor(t[a]);return this.makeOutput(o,e.shape,"float32")},r.prototype.sign=function(e){pt(e,"x");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a)t[a]<0?o[a]=-1:t[a]>0?o[a]=1:o[a]=0;return this.makeOutput(o,e.shape,"float32")},r.prototype.isNaN=function(e){pt(e,"x");for(var t=this.readSync(e.dataId),o=new Uint8Array(t.length),a=0;a<t.length;++a)Number.isNaN(t[a])&&(o[a]=1);return this.makeOutput(o,e.shape,"bool")},r.prototype.isInf=function(e){pt(e,"x");for(var t=this.readSync(e.dataId),o=new Uint8Array(t.length),a=0;a<t.length;++a)Math.abs(t[a])===1/0&&(o[a]=1);return this.makeOutput(o,e.shape,"bool")},r.prototype.isFinite=function(e){pt(e,"x");for(var t=this.readSync(e.dataId),o=new Uint8Array(t.length),a=0;a<t.length;++a)Number.isFinite(t[a])&&(o[a]=1);return this.makeOutput(o,e.shape,"bool")},r.prototype.round=function(e){pt(e,"round");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a){var i=Math.floor(t[a]);t[a]-i<.5?o[a]=Math.floor(t[a]):t[a]-i>.5?o[a]=Math.ceil(t[a]):o[a]=i%2==0?i:i+1}return this.makeOutput(o,e.shape,"float32")},r.prototype.exp=function(e){pt(e,"exp");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a)o[a]=Math.exp(t[a]);return this.makeOutput(o,e.shape,"float32")},r.prototype.expm1=function(e){pt(e,"expm1");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a)o[a]=Math.expm1(t[a]);return this.makeOutput(o,e.shape,"float32")},r.prototype.log=function(e){pt(e,"log");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a){var i=t[a];o[a]=Math.log(i)}return this.makeOutput(o,e.shape,"float32")},r.prototype.log1p=function(e){pt(e,"log1p");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a){var i=t[a];o[a]=Math.log1p(i)}return this.makeOutput(o,e.shape,"float32")},r.prototype.sqrt=function(e){pt(e,"sqrt");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a){var i=t[a];o[a]=Math.sqrt(i)}return this.makeOutput(o,e.shape,"float32")},r.prototype.rsqrt=function(e){pt(e,"rsqrt");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a){var i=t[a];o[a]=1/Math.sqrt(i)}return this.makeOutput(o,e.shape,"float32")},r.prototype.reciprocal=function(e){pt(e,"reciprocal");for(var t=this.readSync(e.dataId),o=new Float32Array(t.length),a=0;a<t.length;++a)o[a]=1/t[a];return this.makeOutput(o,e.shape,"float32")},r.prototype.linear=function(e){return e},r.prototype.relu=function(e){pt(e,"relu");for(var t=Tr(e.shape,e.dtype),o=this.readSync(t.dataId),a=this.readSync(e.dataId),i=0;i<a.length;++i)o[i]=Math.max(0,a[i]);return t},r.prototype.relu6=function(e){pt(e,"relu");for(var t=Tr(e.shape,e.dtype),o=this.readSync(t.dataId),a=this.readSync(e.dataId),i=0;i<a.length;++i)o[i]=Math.min(Math.max(0,a[i]),6);return t},r.prototype.prelu=function(e,t){return pt([e,t],"prelu"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){return o<0?a*o:o})},r.prototype.elu=function(e){pt(e,"elu");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a){var i=o[a];t[a]=i>=0?i:Math.exp(i)-1}return this.makeOutput(t,e.shape,"float32")},r.prototype.eluDer=function(e,t){pt([e,t],"eluDer");for(var o=new Float32Array(t.size),a=this.readSync(t.dataId),i=this.readSync(e.dataId),s=0;s<a.length;++s){var u=a[s];o[s]=u>=1?i[s]:i[s]*(u+1)}return this.makeOutput(o,t.shape,"float32")},r.prototype.selu=function(e){pt(e,"selu");for(var t=fu,o=hu,a=new Float32Array(e.size),i=this.readSync(e.dataId),s=0;s<i.length;++s){var u=i[s];a[s]=u>=0?o*u:t*(Math.exp(u)-1)}return this.makeOutput(a,e.shape,"float32")},r.prototype.clip=function(e,t,o){pt(e,"clip");for(var a=new Float32Array(e.size),i=this.readSync(e.dataId),s=0;s<i.length;++s){var u=i[s];a[s]=u>o?o:u<t?t:u}return this.makeOutput(a,e.shape,"float32")},r.prototype.abs=function(e){for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.abs(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.complexAbs=function(e){for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<e.size;++a){var i=o[2*a],s=o[2*a+1];t[a]=Math.hypot(i,s)}return this.makeOutput(t,e.shape,"float32")},r.prototype.int=function(e){pt(e,"int");for(var t=new Int32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=o[a];return this.makeOutput(t,e.shape,"int32")},r.prototype.sigmoid=function(e){pt(e,"sigmoid");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=1/(1+Math.exp(-o[a]));return this.makeOutput(t,e.shape,"float32")},r.prototype.softplus=function(e){pt(e,"softplus");for(var t=Math.log(11920928955078125e-23)+2,o=new Float32Array(e.size),a=this.readSync(e.dataId),i=0;i<a.length;++i){var s=a[i]>-t,u=a[i]<t,f=Math.exp(a[i]),C=void 0;C=u?f:s?a[i]:Math.log(1+f),o[i]=C}return this.makeOutput(o,e.shape,"float32")},r.prototype.sin=function(e){pt(e,"sin");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.sin(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.cos=function(e){pt(e,"cos");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.cos(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.tan=function(e){pt(e,"tan");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.tan(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.asin=function(e){pt(e,"asin");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.asin(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.acos=function(e){pt(e,"acos");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.acos(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.atan=function(e){pt(e,"atan");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.atan(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.atan2=function(e,t){return pt([e,t],"atan2"),this.broadcastedBinaryOp(e,t,e.dtype,function(o,a){return Math.atan2(o,a)})},r.prototype.sinh=function(e){pt(e,"sinh");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.sinh(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.cosh=function(e){pt(e,"cosh");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.cosh(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.tanh=function(e){pt(e,"tanh");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=ke(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.asinh=function(e){pt(e,"asinh");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.asinh(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.acosh=function(e){pt(e,"acosh");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.acosh(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.atanh=function(e){pt(e,"atanh");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a)t[a]=Math.atanh(o[a]);return this.makeOutput(t,e.shape,"float32")},r.prototype.erf=function(e){pt(e,"erf");for(var t=new Float32Array(e.size),o=this.readSync(e.dataId),a=0;a<o.length;++a){var i=Math.sign(o[a]),s=Math.abs(o[a]),u=1/(1+.3275911*s);t[a]=i*(1-((((1.061405429*u-1.453152027)*u+1.421413741)*u-.284496736)*u+.254829592)*u*Math.exp(-s*s))}return this.makeOutput(t,e.shape,"float32")},r.prototype.step=function(e,t){t===void 0&&(t=0),pt(e,"step");for(var o=new Float32Array(e.size),a=this.readSync(e.dataId),i=0;i<a.length;++i){var s=a[i];isNaN(s)?o[i]=NaN:o[i]=s>0?1:t}return this.makeOutput(o,e.shape,"float32")},r.prototype.fusedConv2d=function(e){var t=e.input,o=e.filter,a=e.convInfo,i=e.bias,s=e.activation,u=e.preluActivationWeights,f=this.conv2d(t,o,a);return i&&(f=this.add(f,i)),s&&(f=Ru(this,f,s,u)),f},r.prototype.conv2d=function(e,t,o){pt([e,t],"conv2d");for(var a=o.filterHeight,i=o.filterWidth,s=o.dilationHeight,u=o.dilationWidth,f=o.padInfo.left,C=o.padInfo.top,k=o.dataFormat==="channelsLast",L=Lt(o.outShape,e.dtype),Y=e.strides[0],ne=k?e.strides[1]:e.strides[2],ce=k?e.strides[2]:1,se=k?1:e.strides[1],le=L.strides[0],xe=k?L.strides[1]:L.strides[2],Ee=k?L.strides[2]:1,Ce=k?1:L.strides[1],Te=this.readSync(e.dataId),Me=this.readSync(t.dataId),He=L.values,Be=0;Be<o.batchSize;++Be)for(var je=Be*Y,We=Be*le,Ze=0;Ze<o.outHeight;++Ze)for(var Je=We+Ze*xe,ht=Ze*o.strideHeight-C,lt=0;lt<a;lt++){var ut=ht+lt*s;if(!(ut<0||ut>=o.inHeight))for(var gt=lt*t.strides[0],mt=je+ut*ne,ct=0;ct<o.outWidth;++ct)for(var xt=Je+ct*Ee,wt=ct*o.strideWidth-f,Ot=0;Ot<i;Ot++){var Mt=wt+Ot*u;if(!(Mt<0||Mt>=o.inWidth))for(var Pt=mt+Mt*ce,Vt=gt+Ot*t.strides[1],Xt=0;Xt<o.inChannels;++Xt){for(var Yt=Te[Pt+Xt*se],ar=0;ar<o.outChannels;++ar)He[xt+ar*Ce]+=Yt*Me[Vt+ar];Vt+=o.outChannels}}}return L.toTensor()},r.prototype.conv3d=function(e,t,o){for(var a=o.filterDepth,i=o.filterHeight,s=o.filterWidth,u=o.dilationDepth,f=o.dilationHeight,C=o.dilationWidth,k=o.padInfo.front,L=o.padInfo.left,Y=o.padInfo.top,ne=Lt(o.outShape,e.dtype),ce=this.readSync(e.dataId),se=this.readSync(t.dataId),le=ne.values,xe=0;xe<o.batchSize;++xe)for(var Ee=xe*e.strides[0],Ce=xe*ne.strides[0],Te=0;Te<o.outDepth;++Te)for(var Me=Ce+Te*ne.strides[1],He=Te*o.strideDepth-k,Be=0;Be<a;Be++){var je=He+Be*u;if(!(je<0||je>=o.inDepth))for(var We=Be*t.strides[0],Ze=Ee+je*e.strides[1],Je=0;Je<o.outHeight;++Je)for(var ht=Me+Je*ne.strides[2],lt=Je*o.strideHeight-Y,ut=0;ut<i;ut++){var gt=lt+ut*f;if(!(gt<0||gt>=o.inHeight))for(var mt=We+ut*t.strides[1],ct=Ze+gt*e.strides[2],xt=0;xt<o.outWidth;++xt)for(var wt=ht+xt*o.outChannels,Ot=xt*o.strideWidth-L,Mt=0;Mt<s;Mt++){var Pt=Ot+Mt*C;if(!(Pt<0||Pt>=o.inWidth))for(var Vt=mt+Mt*t.strides[2],Xt=ct+Pt*o.inChannels,Yt=Vt,ar=0;ar<o.inChannels;++ar){for(var er=ce[Xt+ar],ir=0;ir<o.outChannels;++ir)le[wt+ir]+=er*se[Yt+ir];Yt+=o.outChannels}}}}return ne.toTensor()},r.prototype.conv2dDerInput=function(e,t,o){pt([e,t],"conv2dDerInput");for(var a=Lt(o.inShape,"float32"),i=a.values,s=this.readSync(e.dataId),u=this.readSync(t.dataId),f=t.strides,C=f[0],k=f[1],L=f[2],Y=o.batchSize,ne=o.filterHeight,ce=o.filterWidth,se=o.inChannels,le=o.inHeight,xe=o.inWidth,Ee=o.outChannels,Ce=o.outHeight,Te=o.outWidth,Me=o.strideHeight,He=o.strideWidth,Be=o.dataFormat,je=ne-1-o.padInfo.top,We=ce-1-o.padInfo.left,Ze=Be==="channelsLast",Je=a.strides[0],ht=Ze?a.strides[1]:a.strides[2],lt=Ze?a.strides[2]:1,ut=Ze?1:a.strides[1],gt=e.strides[0],mt=Ze?e.strides[1]:e.strides[2],ct=Ze?e.strides[2]:1,xt=Ze?1:e.strides[1],wt=0;wt<Y;++wt)for(var Ot=0;Ot<se;++Ot)for(var Mt=0;Mt<le;++Mt)for(var Pt=Mt-je,Vt=Math.max(0,Math.ceil(Pt/Me)),Xt=Math.min(Ce,(ne+Pt)/Me),Yt=0;Yt<xe;++Yt){for(var ar=Yt-We,er=Math.max(0,Math.ceil(ar/He)),ir=Math.min(Te,(ce+ar)/He),jr=0,tr=Vt;tr<Xt;++tr)for(var Er=tr*Me-Pt,hr=er;hr<ir;++hr)for(var Lr=gt*wt+mt*tr+ct*hr,Mr=C*(ne-1-Er)+k*(ce-1-(hr*He-ar))+L*Ot,Pr=0;Pr<Ee;++Pr)jr+=s[Lr+xt*Pr]*u[Mr+Pr];i[Je*wt+ht*Mt+lt*Yt+ut*Ot]=jr}return a.toTensor()},r.prototype.conv3dDerInput=function(e,t,o){for(var a=Lt(o.inShape,"float32"),i=a.values,s=a.strides,u=s[0],f=s[1],C=s[2],k=s[3],L=this.readSync(e.dataId),Y=e.strides,ne=Y[0],ce=Y[1],se=Y[2],le=Y[3],xe=this.readSync(t.dataId),Ee=t.strides,Ce=Ee[0],Te=Ee[1],Me=Ee[2],He=Ee[3],Be=o.batchSize,je=o.filterDepth,We=o.filterHeight,Ze=o.filterWidth,Je=o.inChannels,ht=o.inDepth,lt=o.inHeight,ut=o.inWidth,gt=o.outChannels,mt=o.outDepth,ct=o.outHeight,xt=o.outWidth,wt=o.strideDepth,Ot=o.strideHeight,Mt=o.strideWidth,Pt=je-1-o.padInfo.front,Vt=We-1-o.padInfo.top,Xt=Ze-1-o.padInfo.left,Yt=0;Yt<Be;++Yt)for(var ar=0;ar<Je;++ar)for(var er=0;er<ht;++er)for(var ir=er-Pt,jr=Math.max(0,Math.ceil(ir/wt)),tr=Math.min(mt,(je+ir)/wt),Er=0;Er<lt;++Er)for(var hr=Er-Vt,Lr=Math.max(0,Math.ceil(hr/Ot)),Mr=Math.min(ct,(We+hr)/Ot),Pr=0;Pr<ut;++Pr){for(var Hn=Pr-Xt,zn=Math.max(0,Math.ceil(Hn/Mt)),vn=Math.min(xt,(Ze+Hn)/Mt),Ha=0,ao=jr;ao<tr;++ao)for(var Do=ao*wt-ir,io=Lr;io<Mr;++io)for(var za=io*Ot-hr,so=zn;so<vn;++so)for(var Xu=ne*Yt+ce*ao+se*io+le*so,Ga=Ce*(je-1-Do)+Te*(We-1-za)+Me*(Ze-1-(so*Mt-Hn))+He*ar,Gn=0;Gn<gt;++Gn)Ha+=L[Xu+Gn]*xe[Ga+Gn];i[u*Yt+f*er+C*Er+k*Pr+ar]=Ha}return a.toTensor()},r.prototype.conv2dDerFilter=function(e,t,o){pt([e,t],"conv2dDerFilter");for(var a=o.strideHeight,i=o.strideWidth,s=o.filterHeight,u=o.filterWidth,f=o.dataFormat==="channelsLast",C=Lt(o.filterShape,"float32"),k=o.padInfo.left,L=o.padInfo.top,Y=this.bufferSync(e),ne=this.bufferSync(t),ce=0;ce<s;++ce)for(var se=Math.max(0,Math.ceil((L-ce)/a)),le=Math.min(o.outHeight,(o.inHeight+L-ce)/a),xe=0;xe<u;++xe)for(var Ee=Math.max(0,Math.ceil((k-xe)/i)),Ce=Math.min(o.outWidth,(o.inWidth+k-xe)/i),Te=0;Te<o.inChannels;++Te)for(var Me=0;Me<o.outChannels;++Me){for(var He=0,Be=0;Be<o.batchSize;++Be)for(var je=se;je<le;++je)for(var We=ce+je*a-L,Ze=Ee;Ze<Ce;++Ze){var Je=xe+Ze*i-k;He+=f?Y.get(Be,We,Je,Te)*ne.get(Be,je,Ze,Me):Y.get(Be,Te,We,Je)*ne.get(Be,Me,je,Ze)}C.set(He,ce,xe,Te,Me)}return C.toTensor()},r.prototype.conv3dDerFilter=function(e,t,o){for(var a=o.strideDepth,i=o.strideHeight,s=o.strideWidth,u=o.filterDepth,f=o.filterHeight,C=o.filterWidth,k=Lt(o.filterShape,"float32"),L=k.values,Y=k.strides,ne=Y[0],ce=Y[1],se=Y[2],le=Y[3],xe=this.readSync(t.dataId),Ee=t.strides,Ce=Ee[0],Te=Ee[1],Me=Ee[2],He=Ee[3],Be=this.readSync(e.dataId),je=e.strides,We=je[0],Ze=je[1],Je=je[2],ht=je[3],lt=o.padInfo.front,ut=o.padInfo.left,gt=o.padInfo.top,mt=0;mt<u;++mt)for(var ct=Math.max(0,Math.ceil((lt-mt)/a)),xt=Math.min(o.outDepth,(o.inDepth+lt-mt)/a),wt=mt*ne,Ot=0;Ot<f;++Ot)for(var Mt=Math.max(0,Math.ceil((gt-Ot)/i)),Pt=Math.min(o.outHeight,(o.inHeight+gt-Ot)/i),Vt=Ot*ce+wt,Xt=0;Xt<C;++Xt)for(var Yt=Math.max(0,Math.ceil((ut-Xt)/s)),ar=Math.min(o.outWidth,(o.inWidth+ut-Xt)/s),er=Xt*se+Vt,ir=0;ir<o.inChannels;++ir)for(var jr=ir*le+er,tr=0;tr<o.outChannels;++tr){for(var Er=0,hr=0;hr<o.batchSize;++hr)for(var Lr=hr*We,Mr=hr*Ce,Pr=ct;Pr<xt;++Pr)for(var Hn=(mt+Pr*a-lt)*Ze+Lr,zn=Pr*Te+Mr,vn=Mt;vn<Pt;++vn)for(var Ha=(Ot+vn*i-gt)*Je+Hn,ao=vn*Me+zn,Do=Yt;Do<ar;++Do){var io=Do*He+ao;Er+=Be[(Xt+Do*s-ut)*ht+Ha+ir]*xe[io+tr]}L[jr+tr]=Er}return k.toTensor()},r.prototype.fusedDepthwiseConv2D=function(e){var t=e.input,o=e.filter,a=e.convInfo,i=e.bias,s=e.activation,u=e.preluActivationWeights,f=this.depthwiseConv2D(t,o,a);return i&&(f=this.add(f,i)),s&&(f=Ru(this,f,s,u)),f},r.prototype.depthwiseConv2D=function(e,t,o){pt([e,t],"depthwiseConv2D");for(var a=o.filterHeight,i=o.filterWidth,s=o.dilationHeight,u=o.dilationWidth,f=o.padInfo.left,C=o.padInfo.top,k=o.outChannels/o.inChannels,L=Lt(o.outShape,e.dtype),Y=this.readSync(e.dataId),ne=this.readSync(t.dataId),ce=L.values,se=0;se<o.batchSize;++se)for(var le=se*e.strides[0],xe=se*L.strides[0],Ee=0;Ee<o.outHeight;++Ee)for(var Ce=xe+Ee*L.strides[1],Te=Ee*o.strideHeight-f,Me=0;Me<a;++Me){var He=Te+Me*s;if(!(He<0||He>=o.inHeight))for(var Be=Me*t.strides[0],je=le+He*e.strides[1],We=0;We<o.outWidth;++We)for(var Ze=Ce+We*L.strides[2],Je=We*o.strideWidth-C,ht=0;ht<i;++ht){var lt=Je+ht*u;if(!(lt<0||lt>=o.inWidth))for(var ut=Be+ht*t.strides[1],gt=je+lt*o.inChannels,mt=Ze,ct=ut,xt=0;xt<o.inChannels;++xt){for(var wt=Y[gt+xt],Ot=0;Ot<k;++Ot)ce[mt+Ot]+=wt*ne[ct+Ot];mt+=k,ct+=k}}}return L.toTensor()},r.prototype.depthwiseConv2DDerInput=function(e,t,o){pt([e,t],"depthwiseConv2DDerInput");for(var a=Lt(o.inShape,"float32"),i=a.values,s=a.strides,u=s[0],f=s[1],C=s[2],k=this.readSync(e.dataId),L=e.strides,Y=L[0],ne=L[1],ce=L[2],se=this.readSync(t.dataId),le=t.strides,xe=le[0],Ee=le[1],Ce=le[2],Te=o.batchSize,Me=o.filterHeight,He=o.filterWidth,Be=o.inChannels,je=o.inHeight,We=o.inWidth,Ze=o.outChannels,Je=o.outHeight,ht=o.outWidth,lt=o.strideHeight,ut=o.strideWidth,gt=Me-1-o.padInfo.top,mt=He-1-o.padInfo.left,ct=Ze/Be,xt=0;xt<Te;++xt)for(var wt=0;wt<Be;++wt)for(var Ot=0;Ot<je;++Ot)for(var Mt=Ot-gt,Pt=Math.max(0,Math.ceil(Mt/lt)),Vt=Math.min(Je,(Me+Mt)/lt),Xt=0;Xt<We;++Xt){for(var Yt=Xt-mt,ar=Math.max(0,Math.ceil(Yt/ut)),er=Math.min(ht,(He+Yt)/ut),ir=0,jr=Pt;jr<Vt;++jr)for(var tr=jr*lt-Mt,Er=ar;Er<er;++Er)for(var hr=Y*xt+ne*jr+ce*Er,Lr=xe*(Me-1-tr)+Ee*(He-1-(Er*ut-Yt))+Ce*wt,Mr=0;Mr<ct;++Mr)ir+=k[hr+(wt*ct+Mr)]*se[Lr+Mr];i[u*xt+f*Ot+C*Xt+wt]=ir}return a.toTensor()},r.prototype.depthwiseConv2DDerFilter=function(e,t,o){pt([e,t],"depthwiseConv2DDerFilter");for(var a=o.strideHeight,i=o.strideWidth,s=o.filterHeight,u=o.filterWidth,f=Lt(o.filterShape,"float32"),C=o.padInfo.left,k=o.padInfo.top,L=o.outChannels/o.inChannels,Y=this.bufferSync(e),ne=this.bufferSync(t),ce=0;ce<s;++ce)for(var se=Math.max(0,Math.ceil((k-ce)/a)),le=Math.min(o.outHeight,(o.inHeight+k-ce)/a),xe=0;xe<u;++xe)for(var Ee=Math.max(0,Math.ceil((C-xe)/i)),Ce=Math.min(o.outWidth,(o.inWidth+C-xe)/i),Te=0;Te<o.outChannels;++Te){for(var Me=Math.trunc(Te/L),He=Te%L,Be=0,je=0;je<o.batchSize;++je)for(var We=se;We<le;++We)for(var Ze=ce+We*a-k,Je=Ee;Je<Ce;++Je){var ht=xe+Je*i-C;Be+=Y.get(je,Ze,ht,Me)*ne.get(je,We,Je,Te)}f.set(Be,ce,xe,Me,He)}return f.toTensor()},r.prototype.tile=function(e,t){return pt(e,"tile"),is(this.bufferSync(e),t)},r.prototype.pad=function(e,t,o){pt(e,"pad");var a=t.map(function(L,Y){return L[0]+e.shape[Y]+L[1]}),i=t.map(function(L){return L[0]}),s=this.bufferSync(e),u=Lt(a,e.dtype);o!==0&&u.values.fill(o);for(var f=0;f<e.size;f++){var C=s.indexToLoc(f),k=C.map(function(L,Y){return L+i[Y]});u.set.apply(u,[s.get.apply(s,C)].concat(k))}return u.toTensor()},r.prototype.transpose=function(e,t){pt(e,"transpose");for(var o=new Array(e.rank),a=0;a<o.length;a++)o[a]=e.shape[t[a]];var i=this.readSync(e.dataId),s=Lt(o,e.dtype),u=this.bufferSync(e);for(a=0;a<e.size;++a){for(var f=u.indexToLoc(a),C=new Array(f.length),k=0;k<C.length;k++)C[k]=f[t[k]];var L=s.locToIndex(C);s.values[L]=i[a]}return s.toTensor()},r.prototype.gather=function(e,t,o){pt([e,t],"gather");var a=e.shape.slice(),i=this.readSync(t.dataId);a[o]=i.length;for(var s=Lt(a,e.dtype),u=this.bufferSync(e),f=0;f<s.size;++f){var C=s.indexToLoc(f),k=C.slice();k[o]=i[C[o]];var L=u.locToIndex(k);s.values[f]=u.values[L]}return s.toTensor()},r.prototype.batchToSpaceND=function(e,t,o){pt([e],"batchToSpaceND");var a=t.reduce(function(k,L){return k*L}),i=Ho(e.shape,t,a),s=Jt(i.length,t.length),u=_a(e.shape,t,a),f=Xs(o,t.length),C=Ks(u,o,t.length);return e.reshape(i).transpose(s).reshape(u).slice(f,C)},r.prototype.spaceToBatchND=function(e,t,o){pt([e],"spaceToBatchND");var a=t.reduce(function(L,Y){return L*Y}),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=Ho(u.shape,t,a,!1),C=Jt(f.length,t.length,!1),k=_a(u.shape,t,a,!1);return u.reshape(f).transpose(C).reshape(k)},r.prototype.pool=function(e,t,o){pt(e,"pool");for(var a=t.strideHeight,i=t.strideWidth,s=t.dilationHeight,u=t.dilationWidth,f=t.effectiveFilterHeight,C=t.effectiveFilterWidth,k=t.padInfo.top,L=t.padInfo.left,Y=o==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,ne=this.readSync(e.dataId),ce=Lt(t.outShape,e.dtype),se=ce.values,le=t.outShape[1]*t.outShape[2]*t.outShape[3],xe=t.outShape[2]*t.outShape[3],Ee=t.outShape[3],Ce=0;Ce<t.batchSize;++Ce)for(var Te=Ce*le,Me=Ce*e.strides[0],He=0;He<t.inChannels;++He)for(var Be=0;Be<t.outHeight;++Be)for(var je=Be*a-k,We=Math.max(0,je),Ze=Math.min(t.inHeight,f+je),Je=Te+Be*xe,ht=0;ht<t.outWidth;++ht){for(var lt=ht*i-L,ut=Math.max(0,lt),gt=Math.min(t.inWidth,C+lt),mt=Y,ct=0,xt=0,wt=We;wt<Ze;wt+=s){for(var Ot=Me+wt*e.strides[1],Mt=ut;Mt<gt;Mt+=u){var Pt=ne[Ot+Mt*e.strides[2]+He];o==="max"&&Pt>mt?mt=Pt:o==="avg"&&(ct+=Pt,xt++)}if(isNaN(mt))break}se[Je+ht*Ee+He]=o==="avg"?ct/xt:mt}return ce.toTensor()},r.prototype.maxPool=function(e,t){return this.pool(e,t,"max")},r.prototype.maxPoolPositions=function(e,t){for(var o=Lt(t.outShape,"int32"),a=t.strideHeight,i=t.strideWidth,s=t.dilationHeight,u=t.dilationWidth,f=t.effectiveFilterHeight,C=t.effectiveFilterWidth,k=t.padInfo.top,L=t.padInfo.left,Y=this.bufferSync(e),ne=0;ne<t.batchSize;++ne)for(var ce=0;ce<t.inChannels;++ce)for(var se=0;se<t.outHeight;++se){for(var le=se*a-k,xe=le;xe<0;)xe+=s;for(var Ee=Math.min(t.inHeight,f+le),Ce=0;Ce<t.outWidth;++Ce){for(var Te=Ce*i-L,Me=Te;Me<0;)Me+=u;for(var He=Math.min(t.inWidth,C+Te),Be=Number.NEGATIVE_INFINITY,je=-1,We=xe;We<Ee;We+=s)for(var Ze=We-le,Je=Me;Je<He;Je+=u){var ht=Je-Te,lt=Y.get(ne,We,Je,ce);lt>Be&&(Be=lt,je=Ze*C+ht)}o.set(je,ne,se,Ce,ce)}}return o.toTensor()},r.prototype.maxPoolBackprop=function(e,t,o,a){pt([t,o],"maxPoolBackprop");for(var i=this.maxPoolPositions(t,a),s=a.strideHeight,u=a.strideWidth,f=a.dilationHeight,C=a.dilationWidth,k=a.effectiveFilterHeight,L=a.effectiveFilterWidth,Y=L-1-a.padInfo.left,ne=k-1-a.padInfo.top,ce=Lt(t.shape,"float32"),se=this.bufferSync(i),le=this.bufferSync(e),xe=0;xe<a.batchSize;++xe)for(var Ee=0;Ee<a.inChannels;++Ee)for(var Ce=0;Ce<a.inHeight;++Ce)for(var Te=0;Te<a.inWidth;++Te){for(var Me=Ce-ne,He=Te-Y,Be=0,je=0;je<k;je+=f){var We=(Me+je)/s;if(!(We<0||We>=a.outHeight||Math.floor(We)!==We))for(var Ze=0;Ze<L;Ze+=C){var Je=(He+Ze)/u;if(!(Je<0||Je>=a.outWidth||Math.floor(Je)!==Je)){var ht=k*L-1-se.get(xe,We,Je,Ee)===je*L+Ze?1:0;ht!==0&&(Be+=le.get(xe,We,Je,Ee)*ht)}}}ce.set(Be,xe,Ce,Te,Ee)}return ce.toTensor()},r.prototype.avgPoolBackprop=function(e,t,o){pt([e,t],"avgPoolBackprop");for(var a=o.strideHeight,i=o.strideWidth,s=o.filterHeight,u=o.filterWidth,f=o.dilationHeight,C=o.dilationWidth,k=o.effectiveFilterHeight,L=o.effectiveFilterWidth,Y=L-1-o.padInfo.left,ne=k-1-o.padInfo.top,ce=Lt(t.shape,"float32"),se=1/(s*u),le=this.bufferSync(e),xe=0;xe<o.batchSize;++xe)for(var Ee=0;Ee<o.inChannels;++Ee)for(var Ce=0;Ce<o.inHeight;++Ce)for(var Te=0;Te<o.inWidth;++Te){for(var Me=Ce-ne,He=Te-Y,Be=0,je=0;je<k;je+=f){var We=(Me+je)/a;if(!(We<0||We>=o.outHeight||Math.floor(We)!==We))for(var Ze=0;Ze<L;Ze+=C){var Je=(He+Ze)/i;Je<0||Je>=o.outWidth||Math.floor(Je)!==Je||(Be+=le.get(xe,We,Je,Ee))}}ce.set(Be*se,xe,Ce,Te,Ee)}return ce.toTensor()},r.prototype.pool3d=function(e,t,o){pt(e,"pool3d");for(var a=t.strideDepth,i=t.strideHeight,s=t.strideWidth,u=t.dilationDepth,f=t.dilationHeight,C=t.dilationWidth,k=t.effectiveFilterDepth,L=t.effectiveFilterHeight,Y=t.effectiveFilterWidth,ne=t.padInfo.front,ce=t.padInfo.top,se=t.padInfo.left,le=o==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,xe=this.readSync(e.dataId),Ee=Lt(t.outShape,e.dtype),Ce=Ee.values,Te=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],Be=t.outShape[4],je=0;je<t.batchSize;++je)for(var We=je*Te,Ze=je*e.strides[0],Je=0;Je<t.inChannels;++Je)for(var ht=0;ht<t.outDepth;++ht){for(var lt=ht*a-ne,ut=lt;ut<0;)ut+=u;for(var gt=Math.min(t.inDepth,k+lt),mt=We+ht*Me,ct=0;ct<t.outHeight;++ct){for(var xt=ct*i-ce,wt=xt;wt<0;)wt+=f;for(var Ot=Math.min(t.inHeight,L+xt),Mt=mt+ct*He,Pt=0;Pt<t.outWidth;++Pt){for(var Vt=Pt*s-se,Xt=Vt;Xt<0;)Xt+=C;for(var Yt=Math.min(t.inWidth,Y+Vt),ar=Mt+Pt*Be,er=le,ir=0,jr=0,tr=ut;tr<gt;tr+=u){for(var Er=Ze+tr*e.strides[1],hr=wt;hr<Ot;hr+=f){for(var Lr=Er+hr*e.strides[2],Mr=Xt;Mr<Yt;Mr+=C){var Pr=xe[Lr+Mr*e.strides[3]+Je];if(o==="max"&&Pr>er?er=Pr:o==="avg"&&(ir+=Pr,jr++),isNaN(er))break}if(isNaN(er))break}if(isNaN(er))break}Ce[ar+Je]=o==="avg"?ir/jr:er}}}return Ee.toTensor()},r.prototype.avgPool3d=function(e,t){return pt(e,"avgPool3d"),this.pool3d(e,t,"avg").toFloat()},r.prototype.avgPool3dBackprop=function(e,t,o){pt([e,t],"avgPool3dBackprop");for(var a=o.strideDepth,i=o.strideHeight,s=o.strideWidth,u=o.filterDepth,f=o.filterHeight,C=o.filterWidth,k=o.dilationDepth,L=o.dilationHeight,Y=o.dilationWidth,ne=o.effectiveFilterDepth,ce=o.effectiveFilterHeight,se=o.effectiveFilterWidth,le=ne-1-o.padInfo.front,xe=se-1-o.padInfo.left,Ee=ce-1-o.padInfo.top,Ce=Lt(t.shape,"float32"),Te=1/(u*f*C),Me=this.bufferSync(e),He=0;He<o.batchSize;++He)for(var Be=0;Be<o.inChannels;++Be)for(var je=0;je<o.inDepth;++je)for(var We=0;We<o.inHeight;++We)for(var Ze=0;Ze<o.inWidth;++Ze){for(var Je=je-le,ht=We-Ee,lt=Ze-xe,ut=0,gt=0;gt<ne;gt+=k){var mt=(Je+gt)/a;if(!(mt<0||mt>=o.outDepth||Math.floor(mt)!==mt))for(var ct=0;ct<ce;ct+=L){var xt=(ht+ct)/i;if(!(xt<0||xt>=o.outHeight||Math.floor(xt)!==xt))for(var wt=0;wt<se;wt+=Y){var Ot=(lt+wt)/s;Ot<0||Ot>=o.outWidth||Math.floor(Ot)!==Ot||(ut+=Me.get(He,mt,xt,Ot,Be))}}}Ce.set(ut*Te,He,je,We,Ze,Be)}return Ce.toTensor()},r.prototype.maxPool3d=function(e,t){return pt(e,"maxPool3d"),this.pool3d(e,t,"max").toFloat()},r.prototype.maxPool3dPositions=function(e,t){for(var o=Lt(t.outShape,"int32"),a=t.strideDepth,i=t.strideHeight,s=t.strideWidth,u=t.dilationDepth,f=t.dilationHeight,C=t.dilationWidth,k=t.effectiveFilterDepth,L=t.effectiveFilterHeight,Y=t.effectiveFilterWidth,ne=t.padInfo.front,ce=t.padInfo.top,se=t.padInfo.left,le=this.bufferSync(e),xe=0;xe<t.batchSize;++xe)for(var Ee=0;Ee<t.inChannels;++Ee)for(var Ce=0;Ce<t.outDepth;++Ce){for(var Te=Ce*a-ne,Me=Te;Me<0;)Me+=u;for(var He=Math.min(t.inDepth,k+Te),Be=0;Be<t.outHeight;++Be){for(var je=Be*i-ce,We=je;We<0;)We+=f;for(var Ze=Math.min(t.inHeight,L+je),Je=0;Je<t.outWidth;++Je){for(var ht=Je*s-se,lt=ht;lt<0;)lt+=C;for(var ut=Math.min(t.inWidth,Y+ht),gt=Number.NEGATIVE_INFINITY,mt=-1,ct=Me;ct<He;ct+=u)for(var xt=ct-Te,wt=We;wt<Ze;wt+=f)for(var Ot=wt-je,Mt=lt;Mt<ut;Mt+=C){var Pt=Mt-ht,Vt=le.get(xe,ct,wt,Mt,Ee);Vt>=gt&&(gt=Vt,mt=xt*L*Y+Ot*L+Pt)}o.set(mt,xe,Ce,Be,Je,Ee)}}}return o.toTensor()},r.prototype.maxPool3dBackprop=function(e,t,o,a){pt([t,o],"maxPool3dBackprop");for(var i=this.maxPool3dPositions(t,a),s=a.strideDepth,u=a.strideHeight,f=a.strideWidth,C=a.dilationDepth,k=a.dilationHeight,L=a.dilationWidth,Y=a.effectiveFilterDepth,ne=a.effectiveFilterHeight,ce=a.effectiveFilterWidth,se=Y-1-a.padInfo.front,le=ce-1-a.padInfo.left,xe=ne-1-a.padInfo.top,Ee=Lt(t.shape,"float32"),Ce=this.bufferSync(i),Te=this.bufferSync(e),Me=0;Me<a.batchSize;++Me)for(var He=0;He<a.inChannels;++He)for(var Be=0;Be<a.inDepth;++Be)for(var je=0;je<a.inHeight;++je)for(var We=0;We<a.inWidth;++We){for(var Ze=Be-se,Je=je-xe,ht=We-le,lt=0,ut=0;ut<Y;ut+=C){var gt=(Ze+ut)/s;if(!(gt<0||gt>=a.outDepth||Math.floor(gt)!==gt))for(var mt=0;mt<ne;mt+=k){var ct=(Je+mt)/u;if(!(ct<0||ct>=a.outHeight||Math.floor(ct)!==ct))for(var xt=0;xt<ce;xt+=L){var wt=(ht+xt)/f;if(!(wt<0||wt>=a.outWidth||Math.floor(wt)!==wt)){var Ot=Y*ne*ce-1-Ce.get(Me,gt,ct,wt,He)===ut*ne*ce+mt*ce+xt?1:0;Ot!==0&&(lt+=Te.get(Me,gt,ct,wt,He)*Ot)}}}}Ee.set(lt,Me,Be,je,We,He)}return Ee.toTensor()},r.prototype.cast=function(e,t){return hi(e,t,this)},r.prototype.reshape=function(e,t){return Ra(e,t)},r.prototype.avgPool=function(e,t){return pt(e,"avgPool"),this.pool(e,t,"avg").toFloat()},r.prototype.resizeBilinear=function(e,t,o,a){pt(e,"resizeBilinear");for(var i=e.shape,s=i[0],u=i[1],f=i[2],C=i[3],k=this.readSync(e.dataId),L=new Float32Array(de([s,t,o,C])),Y=[a&&t>1?u-1:u,a&&o>1?f-1:f],ne=[a&&t>1?t-1:t,a&&o>1?o-1:o],ce=0,se=Y[0]/ne[0],le=Y[1]/ne[1],xe=0;xe<s;xe++)for(var Ee=0;Ee<t;Ee++)for(var Ce=se*Ee,Te=Math.floor(Ce),Me=Ce-Te,He=Math.min(u-1,Math.ceil(Ce)),Be=xe*e.strides[0]+Te*e.strides[1],je=xe*e.strides[0]+He*e.strides[1],We=0;We<o;We++)for(var Ze=le*We,Je=Math.floor(Ze),ht=Ze-Je,lt=Math.min(f-1,Math.ceil(Ze)),ut=Be+Je*e.strides[2],gt=je+Je*e.strides[2],mt=Be+lt*e.strides[2],ct=je+lt*e.strides[2],xt=0;xt<C;xt++){var wt=k[ut+xt],Ot=k[gt+xt],Mt=wt+(k[mt+xt]-wt)*ht,Pt=Mt+(Ot+(k[ct+xt]-Ot)*ht-Mt)*Me;L[ce++]=Pt}return Ur(L,[s,t,o,C])},r.prototype.resizeBilinearBackprop=function(e,t,o){pt([e,t],"resizeBilinearBackprop");for(var a=t.shape,i=a[0],s=a[1],u=a[2],f=a[3],C=e.shape,k=C[1],L=C[2],Y=new Float32Array(i*s*u*f),ne=[o&&k>1?s-1:s,o&&L>1?u-1:u],ce=[o&&k>1?k-1:k,o&&L>1?L-1:L],se=ne[0]/ce[0],le=ne[1]/ce[1],xe=this.readSync(e.dataId),Ee=0,Ce=0;Ce<i;Ce++)for(var Te=Ce*t.strides[0],Me=0;Me<k;Me++)for(var He=Me*se,Be=Math.floor(He),je=Math.min(Math.ceil(He),s-1),We=Te+Be*t.strides[1],Ze=Te+je*t.strides[1],Je=He-Be,ht=1-Je,lt=0;lt<L;lt++)for(var ut=lt*le,gt=Math.floor(ut),mt=Math.min(Math.ceil(ut),u-1),ct=ut-gt,xt=1-ct,wt=We+gt*t.strides[2],Ot=We+mt*t.strides[2],Mt=Ze+gt*t.strides[2],Pt=Ze+mt*t.strides[2],Vt=ht*xt,Xt=ht*ct,Yt=Je*xt,ar=Je*ct,er=0;er<f;er++){var ir=xe[Ee++];Y[wt+er]+=ir*Vt,Y[Ot+er]+=ir*Xt,Y[Mt+er]+=ir*Yt,Y[Pt+er]+=ir*ar}return kn(Y,[i,u,s,f],t.dtype)},r.prototype.resizeNearestNeighbor=function(e,t,o,a){pt(e,"resizeNearestNeighbor");for(var i=e.shape,s=i[0],u=i[1],f=i[2],C=i[3],k=this.readSync(e.dataId),L=new Float32Array(s*t*o*C),Y=[a&&t>1?u-1:u,a&&o>1?f-1:f],ne=[a&&t>1?t-1:t,a&&o>1?o-1:o],ce=Y[0]/ne[0],se=Y[1]/ne[1],le=0,xe=0;xe<s;xe++)for(var Ee=xe*e.strides[0],Ce=0;Ce<t;Ce++)for(var Te=ce*Ce,Me=Ee+Math.min(u-1,a?Math.round(Te):Math.floor(Te))*e.strides[1],He=0;He<o;He++)for(var Be=se*He,je=Me+Math.min(f-1,a?Math.round(Be):Math.floor(Be))*e.strides[2],We=0;We<C;We++){var Ze=k[je+We];L[le++]=Ze}return Ur(L,[s,t,o,C],e.dtype)},r.prototype.resizeNearestNeighborBackprop=function(e,t,o){pt([e,t],"resizeNearestNeighborBackprop");for(var a=t.shape,i=a[0],s=a[1],u=a[2],f=a[3],C=e.shape,k=C[1],L=C[2],Y=new Float32Array(i*s*u*f),ne=this.readSync(e.dataId),ce=[o&&k>1?s-1:s,o&&L>1?u-1:u],se=[o&&k>1?k-1:k,o&&L>1?L-1:L],le=ce[0]/se[0],xe=ce[1]/se[1],Ee=1/le,Ce=1/xe,Te=2*Math.ceil(Ee)+2,Me=2*Math.ceil(Ce)+2,He=0;He<i;He++)for(var Be=He*t.strides[0],je=0;je<s;je++)for(var We=Be+je*t.strides[1],Ze=Math.floor(je*Ee),Je=Math.floor(Ze-Te/2),ht=0;ht<u;ht++)for(var lt=We+ht*t.strides[2],ut=Math.floor(ht*Ce),gt=Math.floor(ut-Me/2),mt=0;mt<f;mt++){for(var ct=0,xt=0;xt<Te;xt++){var wt=xt+Je;if(!(wt<0||wt>=k)){var Ot=Be+wt*e.strides[1],Mt=wt*le;if(je===Math.min(s-1,o?Math.round(Mt):Math.floor(Mt)))for(var Pt=0;Pt<Me;Pt++){var Vt=Pt+gt;if(!(Vt<0||Vt>=L)){var Xt=Ot+Vt*e.strides[2],Yt=Vt*xe;ht===Math.min(u-1,o?Math.round(Yt):Math.floor(Yt))&&(ct+=ne[Xt+mt])}}}}Y[lt+mt]=ct}return kn(Y,t.shape,t.dtype)},r.prototype.batchNormalization=function(e,t,o,a,i,s){pt([e,t,o,i,s],"batchNorm");for(var u=this.readSync(e.dataId),f=this.readSync(t.dataId),C=this.readSync(o.dataId),k=i?this.readSync(i.dataId):new Float32Array([1]),L=s?this.readSync(s.dataId):new Float32Array([0]),Y=new Float32Array(u.length),ne=L.length,ce=k.length,se=C.length,le=f.length,xe=0,Ee=0,Ce=0,Te=0,Me=0;Me<u.length;++Me)Y[Me]=L[xe++]+(u[Me]-f[Ee++])*k[Ce++]/Math.sqrt(C[Te++]+a),xe>=ne&&(xe=0),Ee>=le&&(Ee=0),Ce>=ce&&(Ce=0),Te>=se&&(Te=0);return kn(Y,e.shape)},r.prototype.localResponseNormalization4D=function(e,t,o,a,i){pt(e,"localResponseNormalization4D");var s=e.shape[3],u=s-1,f=this.readSync(e.dataId),C=e.size,k=new Float32Array(C);function L(se){for(var le=se%s,xe=se-le+Math.max(0,le-t),Ee=se-le+Math.min(le+t,u),Ce=0;xe<=Ee;xe++){var Te=f[xe];Ce+=Te*Te}return Ce}for(var Y=0;Y<C;Y++){var ne=L(Y),ce=f[Y]*Math.pow(o+a*ne,-i);k[Y]=ce}return kn(k,e.shape)},r.prototype.LRNGrad=function(e,t,o,a,i,s,u){pt(e,"LRNGrad");for(var f=e.shape[3],C=this.readSync(e.dataId),k=this.readSync(t.dataId),L=this.readSync(o.dataId),Y=new Float32Array(e.size),ne=e.size,ce=0;ce<ne;ce++){for(var se=ce%f,le=ce-se+Math.max(0,se-a),xe=ce-se+Math.min(f,se+a+1),Ee=0,Ce=le;Ce<xe;Ce++)Ee+=Math.pow(k[Ce],2);for(Ee=s*Ee+i,Ce=le;Ce<xe;Ce++){var Te=-2*s*u*k[Ce]*L[ce]/Ee;ce===Ce&&(Te+=Math.pow(Ee,-u)),Te*=C[ce],Y[Ce]+=Te}}return kn(Y,e.shape)},r.prototype.multinomial=function(e,t,o,a){pt(e,"multinomial");for(var i=t?e:Go(e),s=i.shape[0],u=i.shape[1],f=Tr([s,o],"int32"),C=this.readSync(f.dataId),k=this.readSync(i.dataId),L=0;L<s;++L){var Y=L*u,ne=new Float32Array(u-1);ne[0]=k[Y];for(var ce=1;ce<ne.length;++ce)ne[ce]=ne[ce-1]+k[Y+ce];for(var se=Wo(a.toString()),le=L*o,xe=0;xe<o;++xe){var Ee=se();C[le+xe]=ne.length;for(var Ce=0;Ce<ne.length;Ce++)if(Ee<ne[Ce]){C[le+xe]=Ce;break}}}return f},r.prototype.oneHot=function(e,t,o,a){pt(e,"oneHot");var i=new Float32Array(e.size*t);i.fill(a);for(var s=this.readSync(e.dataId),u=0;u<e.size;++u)s[u]>=0&&s[u]<t&&(i[u*t+s[u]]=o);return Qn(i,[e.size,t],"int32")},r.prototype.nonMaxSuppression=function(e,t,o,a,i){return pt(e,"nonMaxSuppression"),pi(this.readSync(e.dataId),this.readSync(t.dataId),o,a,i)},r.prototype.fft=function(e){return this.fftBatch(e,!1)},r.prototype.ifft=function(e){return this.fftBatch(e,!0)},r.prototype.fftBatch=function(e,t){for(var o=e.shape[0],a=e.shape[1],i=Lt(e.shape,"float32"),s=Lt(e.shape,"float32"),u=sn(e).as2D(o,a),f=wn(e).as2D(o,a),C=0;C<o;C++)for(var k=u.slice([C,0],[1,a]),L=f.slice([C,0],[1,a]),Y=br(k,L),ne=this.readSync(this.fftImpl(Y,t).dataId),ce=0;ce<a;ce++){var se=rs(ne,ce);i.values[C*a+ce]=se.real,s.values[C*a+ce]=se.imag}return br(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=br(sn(i).div(Nt(a)),wn(i).div(Nt(a)))),i}var s=this.readSync(e.dataId),u=function(f){for(var C=new Float32Array(f.length/2),k=new Float32Array(f.length/2),L=0;L<f.length;L+=2)C[L/2]=f[L],k[L/2]=f[L+1];return{real:C,imag:k}}(this.fourierTransformByMatmul(s,a,t));return br(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(le){for(var xe=Math.ceil(le.length/4),Ee=new Float32Array(xe),Ce=new Float32Array(xe),Te=0;Te<le.length;Te+=4)Ee[Math.floor(Te/4)]=le[Te],Ce[Math.floor(Te/4)]=le[Te+1];return{real:Ee,imag:Ce}}(a),u=br(s.real,s.imag).as1D(),f=function(le){for(var xe=Math.floor(le.length/4),Ee=new Float32Array(xe),Ce=new Float32Array(xe),Te=2;Te<le.length;Te+=4)Ee[Math.floor(Te/4)]=le[Te],Ce[Math.floor(Te/4)]=le[Te+1];return{real:Ee,imag:Ce}}(a),C=br(f.real,f.imag).as1D();u=this.fftRadix2(u,i,o),C=this.fftRadix2(C,i,o);var k=function(le,xe){for(var Ee=new Float32Array(le/2),Ce=new Float32Array(le/2),Te=0;Te<Math.ceil(le/2);Te++){var Me=(xe?2:-2)*Math.PI*(Te/le);Ee[Te]=Math.cos(Me),Ce[Te]=Math.sin(Me)}return{real:Ee,imag:Ce}}(t,o),L=br(k.real,k.imag).mul(C),Y=u.add(L),ne=u.sub(L),ce=sn(Y).concat(sn(ne)),se=wn(Y).concat(wn(ne));return br(ce,se).as1D()},r.prototype.fourierTransformByMatmul=function(e,t,o){for(var a=new Float32Array(2*t),i=0;i<t;i++){for(var s=0,u=0,f=0;f<t;f++){var C=tu(i*f,t,o),k=rs(e,f);s+=k.real*C.real-k.imag*C.imag,u+=k.real*C.imag+k.imag*C.real}o&&(s/=t,u/=t),eu(a,s,u,i)}return a},r.prototype.depthToSpace=function(e,t,o){_(o==="NHWC",function(){return"Only NHWC dataFormat supported on CPU for depthToSpace. Got "+o}),_(t>1,function(){return"blockSize should be > 1 for depthToSpace, but was: "+t});for(var a=e.shape[0],i=e.shape[1],s=e.shape[2],u=e.shape[3],f=i*t,C=s*t,k=u/(t*t),L=this.readSync(e.dataId),Y=new Float32Array(a*f*C*k),ne=0,ce=0;ce<a;++ce)for(var se=0;se<f;++se)for(var le=Math.floor(se/t),xe=se%t,Ee=0;Ee<C;++Ee)for(var Ce=Math.floor(Ee/t),Te=(xe*t+Ee%t)*k,Me=0;Me<k;++Me){var He=Me+Te+u*(Ce+s*(le+i*ce));Y[ne++]=L[He]}return kn(Y,[a,f,C,k])},r.prototype.broadcastedBinaryOp=function(e,t,o,a){var i=Wt(e.shape,t.shape),s=Lt(i,o),u=this.readSync(e.dataId),f=this.readSync(t.dataId),C=_n(e.shape,i),k=_n(t.shape,i),L=s.values;if(C.length+k.length===0)for(var Y=0;Y<L.length;++Y)L[Y]=a(u[Y%u.length],f[Y%f.length]);else{var ne=this.bufferSync(e),ce=this.bufferSync(t),se=function(le){var xe=s.indexToLoc(le),Ee=xe.slice(-e.rank);C.forEach(function(He){return Ee[He]=0});var Ce=ne.locToIndex(Ee),Te=xe.slice(-t.rank);k.forEach(function(He){return Te[He]=0});var Me=ce.locToIndex(Te);L[le]=a(u[Ce],f[Me])};for(Y=0;Y<L.length;++Y)se(Y)}return s.toTensor()},r.prototype.broadcastedBinaryComplexOp=function(e,t,o){var a=Wt(e.shape,t.shape),i=Lt(a,"float32"),s=Lt(a,"float32"),u=this.readSync(e.dataId),f=this.readSync(t.dataId),C=_n(e.shape,a),k=_n(t.shape,a),L=i.values,Y=s.values;if(C.length+k.length===0)for(var ne=0;ne<L.length;ne++){var ce=ne%u.length,se=ne%f.length,le=o(u[2*ce],u[2*ce+1],f[2*se],f[2*se+1]);L[ne]=le.real,Y[ne]=le.imag}else{var xe=this.bufferSync(this.data.get(e.dataId).complexTensors.real),Ee=this.bufferSync(this.data.get(t.dataId).complexTensors.real),Ce=function(Te){var Me=i.indexToLoc(Te),He=Me.slice(-e.rank);C.forEach(function(Je){return He[Je]=0});var Be=xe.locToIndex(He),je=Me.slice(-t.rank);k.forEach(function(Je){return je[Je]=0});var We=Ee.locToIndex(je),Ze=o(u[2*Be],u[2*Be+1],f[2*We],f[2*We+1]);L[Te]=Ze.real,Y[Te]=Ze.imag};for(ne=0;ne<L.length;ne++)Ce(ne)}return this.complex(i.toTensor(),s.toTensor())},r.prototype.split=function(e,t,o){return as(e,t,o)},r.prototype.dispose=function(){},r.prototype.floatPrecision=function(){return 32},r.prototype.epsilon=function(){return 1e-7},r.prototype.cropAndResize=function(e,t,o,a,i,s){for(var u=e.shape,f=u[0],C=u[1],k=u[2],L=u[3],Y=t.shape[0],ne=a[0],ce=a[1],se=Lt([Y,ne,ce,L],"float32"),le=this.readSync(t.dataId),xe=this.readSync(o.dataId),Ee=this.readSync(e.dataId),Ce=e.strides,Te=se.strides,Me=0;Me<Y;Me++){var He=4*Me,Be=le[He],je=le[He+1],We=le[He+2],Ze=le[He+3],Je=xe[Me];if(!(Je>=f))for(var ht=ne>1?(We-Be)*(C-1)/(ne-1):0,lt=ce>1?(Ze-je)*(k-1)/(ce-1):0,ut=0;ut<ne;ut++){var gt=ne>1?Be*(C-1)+ut*ht:.5*(Be+We)*(C-1);if(gt<0||gt>C-1)for(var mt=0;mt<ce;mt++)for(var ct=0;ct<L;ct++){var xt=ct+mt*Te[2]+ut*Te[1]+Me*Te[0];se.values[xt]=s}else if(i==="bilinear"){var wt=Math.floor(gt),Ot=Math.ceil(gt),Mt=gt-wt;for(mt=0;mt<ce;mt++)if((tr=ce>1?je*(k-1)+mt*lt:.5*(je+Ze)*(k-1))<0||tr>k-1)for(ct=0;ct<L;ct++)xt=ct+mt*Te[2]+ut*Te[1]+Me*Te[0],se.values[xt]=s;else{var Pt=Math.floor(tr),Vt=Math.ceil(tr),Xt=tr-Pt;for(ct=0;ct<L;ct++){var Yt=Ee[xt=ct+Pt*Ce[2]+wt*Ce[1]+Je*Ce[0]],ar=Ee[xt=ct+Vt*Ce[2]+wt*Ce[1]+Je*Ce[0]],er=Ee[xt=ct+Pt*Ce[2]+Ot*Ce[1]+Je*Ce[0]],ir=Yt+(ar-Yt)*Xt,jr=er+(Ee[xt=ct+Vt*Ce[2]+Ot*Ce[1]+Je*Ce[0]]-er)*Xt;xt=ct+mt*Te[2]+ut*Te[1]+Me*Te[0],se.values[xt]=ir+(jr-ir)*Mt}}}else for(mt=0;mt<ce;++mt){var tr;if((tr=ce>1?je*(k-1)+mt*lt:.5*(je+Ze)*(k-1))<0||tr>k-1)for(ct=0;ct<L;ct++)xt=ct+mt*Te[2]+ut*Te[1]+Me*Te[0],se.values[xt]=s;else{var Er=Math.round(tr),hr=Math.round(gt);for(ct=0;ct<L;ct++){var Lr=ct+Er*Ce[2]+hr*Ce[1]+Je*Ce[0],Mr=ct+mt*Te[2]+ut*Te[1]+Me*Te[0];se.values[Mr]=Ee[Lr]}}}}}return se.toTensor()},r.prototype.sparseToDense=function(e,t,o,a){var i=zo(0,e,o),s=i.sliceRank,u=i.numUpdates,f=i.sliceSize,C=i.strides,k=i.outputSize;return this.scatter(e,t,o,k,f,u,s,C,a,!1)},r.prototype.gatherND=function(e,t){var o=t.shape,a=o[o.length-1],i=Yi(e,t),s=i[0],u=i[1],f=i[2],C=i[3];if(u===0)return Ur([],s,e.dtype);for(var k=new Nr([u,f],e.dtype),L=this.readSync(t.dataId),Y=this.readSync(e.dataId),ne=0;ne<u;ne++){for(var ce=[],se=0,le=0;le<a;le++){var xe=L[ne*a+le];se+=xe*C[le],ce.push(xe)}if(se<0||se>=e.size/f)throw new Error("Invalid indices: "+ce+" does not index into "+e.shape);for(var Ee=0;Ee<f;Ee++)k.values[ne*f+Ee]=Y[se*f+Ee]}return k.toTensor().reshape(s)},r.prototype.scatterND=function(e,t,o){var a=zo(0,e,o),i=a.sliceRank,s=a.numUpdates,u=a.sliceSize,f=a.strides,C=a.outputSize,k=Nt(0);return this.scatter(e,t,o,C,u,s,i,f,k,!0)},r.prototype.fill=function(e,t,o){var a=De(o=o||ot(t),de(e));return a.fill(t),Ve.makeTensor(a,e,o,this)},r.prototype.onesLike=function(e){if(e.dtype==="string")throw new Error("onesLike is not supported for string tensors");return this.fill(e.shape,1,e.dtype)},r.prototype.zerosLike=function(e){var t=De(e.dtype,de(e.shape));return this.makeOutput(t,e.shape,e.dtype)},r.prototype.linspace=function(e,t,o){return ts(e,t,o)},r.prototype.scatter=function(e,t,o,a,i,s,u,f,C,k){var L=[a/i,i],Y=this.readSync(e.dataId),ne=this.readSync(t.dataId);if(a===0)return Ur([],o,t.dtype);var ce=new Nr(L,t.dtype);ce.values.fill(this.readSync(C.dataId)[0]);for(var se=0;se<s;se++){for(var le=[],xe=0,Ee=0;Ee<u;Ee++){var Ce=Y[se*u+Ee];le.push(Ce),xe+=Ce*f[Ee]}if(xe<0||xe>=a/i)throw new Error("Invalid indices: "+le+" does not index into "+o);for(var Te=0;Te<i;Te++)k?ce.values[xe*i+Te]+=ne[se*i+Te]:ce.values[xe*i+Te]=t.rank===0?ne[0]:ne[se*i+Te]}return ce.toTensor().reshape(o)},r}(Sa);Ve.registerBackend("cpu",function(){return new wp},1);for(var Iu=0,Dl=[{kernelName:"NonMaxSuppressionV5",backendName:"cpu",kernelFunc:function(n){var r=n.inputs,e=n.backend,t=n.attrs,o=r,a=o.boxes,i=o.scores,s=t,u=s.maxOutputSize,f=s.iouThreshold,C=s.scoreThreshold,k=s.softNmsSigma,L=e;pt(a,"NonMaxSuppressionWithScore");var Y=mi(L.data.get(a.dataId).values,L.data.get(i.dataId).values,u,f,C,k);return[Y.selectedIndices,Y.selectedScores]}},{kernelName:"Square",backendName:"cpu",kernelFunc:function(n){var r=n.inputs,e=n.backend,t=r.x,o=e;pt(t,"square");for(var a=o.data.get(t.dataId).values,i=new Float32Array(a.length),s=0;s<a.length;++s){var u=a[s];i[s]=u*u}return{dataId:o.write(i,t.shape,t.dtype),shape:t.shape,dtype:t.dtype}}},{kernelName:_i,backendName:"cpu",kernelFunc:function(n){var r=n.inputs,e=n.backend,t=r,o=t.a,a=t.b,i=e;pt([o,a],_i);var s=i.data.get(o.dataId).values,u=i.data.get(a.dataId).values,f=function(L,Y,ne,ce,se,le){var xe=Wt(L,Y),Ee=xe.length,Ce=$e(xe),Te=Se(se,de(xe)),Me=L.length,He=Y.length,Be=$e(L),je=$e(Y),We=_n(L,xe),Ze=_n(Y,xe);if(We.length+Ze.length===0)for(var Je=0;Je<Te.length;++Je)Te[Je]=le(ne[Je%ne.length],ce[Je%ce.length]);else{var ht=function(lt){var ut=st(lt,Ee,Ce),gt=ut.slice(-Me);We.forEach(function(wt){return gt[wt]=0});var mt=nt(gt,Me,Be),ct=ut.slice(-He);Ze.forEach(function(wt){return ct[wt]=0});var xt=nt(ct,He,je);Te[lt]=le(ne[mt],ce[xt])};for(Je=0;Je<Te.length;++Je)ht(Je)}return[Te,xe]}(o.shape,a.shape,s,u,o.dtype,function(L,Y){var ne=L-Y;return ne*ne}),C=f[0],k=f[1];return{dataId:i.write(C,k,o.dtype),shape:k,dtype:o.dtype}}}];Iu<Dl.length;Iu++)Q(Dl[Iu]);for(var Fa,Ep=function(n){this.variableNames=["A"];var r=Yr(),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=Yr(),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;
|
|
|
}
|
|
|
`},Nu=0,kl=[{kernelName:"FromPixels",backendName:"webgl",kernelFunc:function(n){var r=n.inputs,e=n.backend,t=n.attrs,o=r.pixels,a=t.numChannels,i=typeof HTMLVideoElement!="undefined"&&o instanceof HTMLVideoElement,s=typeof HTMLImageElement!="undefined"&&o instanceof HTMLImageElement,u=i?[o.videoWidth,o.videoHeight]:[o.width,o.height],f=u[0],C=u[1],k=[C,f],L=[C,f,a];(s||i)&&(Fa==null&&(Fa=document.createElement("canvas").getContext("2d")),Fa.canvas.width=f,Fa.canvas.height=C,Fa.drawImage(o,0,0,f,C),o=Fa.canvas);var Y=e.makeTensorInfo(k,"int32");e.texData.get(Y.dataId).usage=Wr.PIXELS,e.gpgpu.uploadPixelDataToTexture(e.getTexture(Y.dataId),o);var ne=p().getBool("WEBGL_PACK")?new _p(L):new Ep(L),ce=e.runWebGLProgram(ne,[Y],"int32");return e.disposeData(Y.dataId),ce}},{kernelName:"NonMaxSuppressionV5",backendName:"webgl",kernelFunc:function(n){var r=n.inputs,e=n.backend,t=n.attrs;ha("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");var o=r,a=o.boxes,i=o.scores,s=t,u=s.maxOutputSize,f=s.iouThreshold,C=s.scoreThreshold,k=s.softNmsSigma,L=e,Y=mi(L.readSync(a.dataId),L.readSync(i.dataId),u,f,C,k);return[Y.selectedIndices,Y.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:_i,backendName:"webgl",kernelFunc:function(n){var r=n.inputs,e=n.backend,t=r,o=t.a,a=t.b,i=e,s=p().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new dr("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])}}];Nu<kl.length;Nu++)Q(kl[Nu]);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:_i,gradFunc:function(n,r){var e=r[0],t=r[1],o=Nt(2);return{a:function(){return ea(n,ea(o,Oo(e,t)))},b:function(){return ea(n,ea(o,Oo(t,e)))}}}}];Du<Ml.length;Du++)G(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}();p().get("IS_BROWSER")&&p().setPlatform("browser",new Cp);var ku,Tp=function(){return N(6)},Sp=function(){function n(){this.util=N(7),this.textEncoder=new this.util.TextEncoder}return n.prototype.fetch=function(r,e){return p().global.fetch!=null?p().global.fetch(r,e):(ku==null&&(ku=Tp()),ku(r,e))},n.prototype.now=function(){var r=d.hrtime();return 1e3*r[0]+r[1]/1e6},n.prototype.encode=function(r,e){if(e!=="utf-8"&&e!=="utf8")throw new Error("Node built-in encoder only supports utf-8, but got "+e);return this.textEncoder.encode(r)},n.prototype.decode=function(r,e){return r.length===0?"":new this.util.TextDecoder(e).decode(r)},n}();p().get("IS_NODE")&&p().setPlatform("node",new Sp);var Mu={float32:4,int32:4,uint16:2,uint8:1,bool:1},bs=4;function Pl(n,r){for(var e={},t=0,o=function(s){var u=s.name,f=s.dtype,C=s.shape,k=de(C),L=void 0;if("quantization"in s){var Y=s.quantization;if(Y.dtype!=="uint8"&&Y.dtype!=="uint16")throw new Error("Weight "+s.name+" has unknown quantization dtype "+Y.dtype+". Supported quantization dtypes are: 'uint8' and 'uint16'.");var ne=Mu[Y.dtype],ce=n.slice(t,t+k*ne),se=Y.dtype==="uint8"?new Uint8Array(ce):new Uint16Array(ce);if(f==="float32")L=Float32Array.from(se,function(Me){return Me*Y.scale+Y.min});else{if(f!=="int32")throw new Error("Unsupported dtype in weight '"+u+"': "+f);L=Int32Array.from(se,function(Me){return Math.round(Me*Y.scale+Y.min)})}t+=k*ne}else if(f==="string"){var le=de(s.shape);L=[];for(var xe=0;xe<le;xe++){var Ee=new Uint32Array(n.slice(t,t+bs))[0];t+=bs;var Ce=new Uint8Array(n.slice(t,t+Ee));L.push(Ce),t+=Ee}}else{var Te=Mu[f];if(ce=n.slice(t,t+k*Te),f==="float32")L=new Float32Array(ce);else if(f==="int32")L=new Int32Array(ce);else{if(f!=="bool")throw new Error("Unsupported dtype in weight '"+u+"': "+f);L=new Uint8Array(ce)}t+=k*Te}e[u]=Ur(L,C,f)},a=0,i=r;a<i.length;a++)o(i[a]);return e}function Ap(n){if(n===null)throw new Error("Invalid input value: "+JSON.stringify(n));var r=0,e=[];n.forEach(function(a){if(r+=a.byteLength,e.push(a.byteLength===a.buffer.byteLength?a:new a.constructor(a)),!(a instanceof Float32Array||a instanceof Int32Array||a instanceof Uint8Array))throw new Error("Unsupported TypedArray subtype: "+a.constructor.name)});var t=new Uint8Array(r),o=0;return e.forEach(function(a){t.set(new Uint8Array(a.buffer),o),o+=a.byteLength}),t.buffer}var Pu=typeof F!="undefined"&&(typeof Blob=="undefined"||typeof atob=="undefined"||typeof btoa=="undefined");function Fl(n){return Pu?F.byteLength(n):new Blob([n]).size}function Fu(n){var r=0;n.forEach(function(o){r+=o.byteLength});var e=new Uint8Array(r),t=0;return n.forEach(function(o){e.set(new Uint8Array(o),t),t+=o.byteLength}),e.buffer}function Ll(n){for(n=n.trim();n.endsWith("/");)n=n.slice(0,n.length-1);var r=n.split("/");return r[r.length-1]}function Si(n){if(n.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:n.modelTopology==null?0:Fl(JSON.stringify(n.modelTopology)),weightSpecsBytes:n.weightSpecs==null?0:Fl(JSON.stringify(n.weightSpecs)),weightDataBytes:n.weightData==null?0:n.weightData.byteLength}}var mn=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}(),La="://",Ro=function(){function n(){this.managers={}}return n.getInstance=function(){return n.instance==null&&(n.instance=new n),n.instance},n.registerManager=function(r,e){_(r!=null,function(){return"scheme must not be undefined or null."}),r.endsWith(La)&&(r=r.slice(0,r.indexOf(La))),_(r.length>0,function(){return"scheme must not be an empty string."});var t=n.getInstance();_(t.managers[r]==null,function(){return"A model store manager is already registered for scheme '"+r+"'."}),t.managers[r]=e},n.getManager=function(r){var e=this.getInstance().managers[r];if(e==null)throw new Error("Cannot find model manager for scheme '"+r+"'");return e},n.getSchemes=function(){return Object.keys(this.getInstance().managers)},n}();function xs(n){if(n.indexOf(La)===-1)throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+Ro.getSchemes().join(","));return{scheme:n.split(La)[0],path:n.split(La)[1]}}function jl(n,r,e){return e===void 0&&(e=!1),E(this,void 0,void 0,function(){var t,o,a,i,s,u,f,C,k;return g(this,function(L){switch(L.label){case 0:return _(n!==r,function(){return"Old path and new path are the same: '"+n+"'"}),_((t=mn.getLoadHandlers(n)).length>0,function(){return"Copying failed because no load handler is found for source URL "+n+"."}),_(t.length<2,function(){return"Copying failed because more than one ("+t.length+") load handlers for source URL "+n+"."}),o=t[0],_((a=mn.getSaveHandlers(r)).length>0,function(){return"Copying failed because no save handler is found for destination URL "+r+"."}),_(a.length<2,function(){return"Copying failed because more than one ("+t.length+") save handlers for destination URL "+r+"."}),i=a[0],s=xs(n).scheme,u=xs(n).path,f=s===xs(n).scheme,[4,o.load()];case 1:return C=L.sent(),e&&f?[4,Ro.getManager(s).removeModel(u)]:[3,3];case 2:L.sent(),L.label=3;case 3:return[4,i.save(C)];case 4:return k=L.sent(),!e||f?[3,6]:[4,Ro.getManager(s).removeModel(u)];case 5:L.sent(),L.label=6;case 6:return[2,k.modelArtifactsInfo]}})})}var ta="models_store",Io="model_info_store";function Bl(){if(!p().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");var n=window||self,r=n.indexedDB||n.mozIndexedDB||n.webkitIndexedDB||n.msIndexedDB||n.shimIndexedDB;if(r==null)throw new Error("The current browser does not appear to support IndexedDB.");return r}function Lu(n){var r=n.result;r.createObjectStore(ta,{keyPath:"modelPath"}),r.createObjectStore(Io,{keyPath:"modelPath"})}var ja=function(){function n(r){if(this.indexedDB=Bl(),r==null||!r)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=r}return n.prototype.save=function(r){return E(this,void 0,void 0,function(){return g(this,function(e){if(r.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return[2,this.databaseAction(this.modelPath,r)]})})},n.prototype.load=function(){return E(this,void 0,void 0,function(){return g(this,function(r){return[2,this.databaseAction(this.modelPath)]})})},n.prototype.databaseAction=function(r,e){var t=this;return new Promise(function(o,a){var i=t.indexedDB.open("tensorflowjs",1);i.onupgradeneeded=function(){return Lu(i)},i.onsuccess=function(){var s=i.result;if(e==null){var u=s.transaction(ta,"readonly"),f=u.objectStore(ta).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(ce){return s.close(),a(f.error)},u.oncomplete=function(){return s.close()}}else{var C,k=Si(e),L=s.transaction(Io,"readwrite"),Y=L.objectStore(Io),ne=Y.put({modelPath:t.modelPath,modelArtifactsInfo:k});ne.onsuccess=function(){var ce=(C=s.transaction(ta,"readwrite")).objectStore(ta).put({modelPath:t.modelPath,modelArtifacts:e,modelArtifactsInfo:k});ce.onsuccess=function(){return o({modelArtifactsInfo:k})},ce.onerror=function(se){var le=(Y=L.objectStore(Io)).delete(t.modelPath);le.onsuccess=function(){return s.close(),a(ce.error)},le.onerror=function(xe){return s.close(),a(ce.error)}}},ne.onerror=function(ce){return s.close(),a(ne.error)},L.oncomplete=function(){C==null?s.close():C.oncomplete=function(){return s.close()}}}},i.onerror=function(s){return a(i.error)}})},n.URL_SCHEME="indexeddb://",n}(),Ul=function(n){return p().getBool("IS_BROWSER")&&!Array.isArray(n)&&n.startsWith(ja.URL_SCHEME)?(r=n.slice(ja.URL_SCHEME.length),new ja(r)):null;var r};mn.registerSaveRouter(Ul),mn.registerLoadRouter(Ul);var Op=function(){function n(){this.indexedDB=Bl()}return n.prototype.listModels=function(){return E(this,void 0,void 0,function(){var r=this;return g(this,function(e){return[2,new Promise(function(t,o){var a=r.indexedDB.open("tensorflowjs",1);a.onupgradeneeded=function(){return Lu(a)},a.onsuccess=function(){var i=a.result,s=i.transaction(Io,"readonly"),u=s.objectStore(Io).getAll();u.onsuccess=function(){for(var f={},C=0,k=u.result;C<k.length;C++){var L=k[C];f[L.modelPath]=L.modelArtifactsInfo}t(f)},u.onerror=function(f){return i.close(),o(u.error)},s.oncomplete=function(){return i.close()}},a.onerror=function(i){return o(a.error)}})]})})},n.prototype.removeModel=function(r){return E(this,void 0,void 0,function(){var e=this;return g(this,function(t){var o;return r=(o=r).startsWith(ja.URL_SCHEME)?o.slice(ja.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,C=f.transaction(Io,"readwrite"),k=C.objectStore(Io),L=k.get(r);L.onsuccess=function(){if(L.result==null)return f.close(),i(new Error("Cannot find model with path '"+r+"' in IndexedDB."));var Y=k.delete(r),ne=function(){var ce=(u=f.transaction(ta,"readwrite")).objectStore(ta).delete(r);ce.onsuccess=function(){return a(L.result.modelArtifactsInfo)},ce.onerror=function(se){return i(L.error)}};Y.onsuccess=ne,Y.onerror=function(ce){return ne(),f.close(),i(L.error)}},L.onerror=function(Y){return f.close(),i(L.error)},C.oncomplete=function(){u==null?f.close():u.oncomplete=function(){return f.close()}}},s.onerror=function(u){return i(s.error)}})]})})},n}();if(p().getBool("IS_BROWSER"))try{Ro.registerManager(ja.URL_SCHEME,new Op)}catch(n){}var oo="/",Ba="tensorflowjs_models",Wl="info",Rp="model_topology",Ip="weight_specs",Np="weight_data",Dp="model_metadata";function Hl(n){return{info:[Ba,n,Wl].join(oo),topology:[Ba,n,Rp].join(oo),weightSpecs:[Ba,n,Ip].join(oo),weightData:[Ba,n,Np].join(oo),modelMetadata:[Ba,n,Dp].join(oo)}}function kp(n){var r=n.split(oo);if(r.length<3)throw new Error("Invalid key format: "+n);return r.slice(1,r.length-1).join(oo)}var Ua=function(){function n(r){if(!p().getBool("IS_BROWSER")||typeof window=="undefined"||window.localStorage===void 0)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,r==null||!r)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=r,this.keys=Hl(this.modelPath)}return n.prototype.save=function(r){return E(this,void 0,void 0,function(){var e,t,o;return g(this,function(a){if(r.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");e=JSON.stringify(r.modelTopology),t=JSON.stringify(r.weightSpecs),o=Si(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(Pu)return F.from(i).toString("base64");for(var s=new Uint8Array(i),u="",f=0,C=s.length;f<C;f++)u+=String.fromCharCode(s[f]);return btoa(u)}(r.weightData)),this.LS.setItem(this.keys.modelMetadata,JSON.stringify({format:r.format,generatedBy:r.generatedBy,convertedBy:r.convertedBy,userDefinedMetadata:r.userDefinedMetadata})),[2,{modelArtifactsInfo:o}]}catch(i){throw this.LS.removeItem(this.keys.info),this.LS.removeItem(this.keys.topology),this.LS.removeItem(this.keys.weightSpecs),this.LS.removeItem(this.keys.weightData),this.LS.removeItem(this.keys.modelMetadata),new Error("Failed to save model '"+this.modelPath+"' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes="+o.modelTopologyBytes+", weightSpecsBytes="+o.weightSpecsBytes+", weightDataBytes="+o.weightDataBytes+".")}return[2]})})},n.prototype.load=function(){return E(this,void 0,void 0,function(){var r,e,t,o,a,i,s;return g(this,function(u){if((r=JSON.parse(this.LS.getItem(this.keys.info)))==null)throw new Error("In local storage, there is no model with name '"+this.modelPath+"'");if(r.modelTopologyType!=="JSON")throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");if(e={},(t=JSON.parse(this.LS.getItem(this.keys.topology)))==null)throw new Error("In local storage, the topology of model '"+this.modelPath+"' is missing.");if(e.modelTopology=t,(o=JSON.parse(this.LS.getItem(this.keys.weightSpecs)))==null)throw new Error("In local storage, the weight specs of model '"+this.modelPath+"' are missing.");if(e.weightSpecs=o,(a=this.LS.getItem(this.keys.modelMetadata))!=null&&(i=JSON.parse(a),e.format=i.format,e.generatedBy=i.generatedBy,e.convertedBy=i.convertedBy,e.userDefinedMetadata=i.userDefinedMetadata),(s=this.LS.getItem(this.keys.weightData))==null)throw new Error("In local storage, the binary weight values of model '"+this.modelPath+"' are missing.");return e.weightData=function(f){if(Pu){var C=F.from(f,"base64");return C.buffer.slice(C.byteOffset,C.byteOffset+C.byteLength)}for(var k=atob(f),L=new Uint8Array(k.length),Y=0;Y<k.length;++Y)L.set([k.charCodeAt(Y)],Y);return L.buffer}(s),[2,e]})})},n.URL_SCHEME="localstorage://",n}(),zl=function(n){return p().getBool("IS_BROWSER")&&!Array.isArray(n)&&n.startsWith(Ua.URL_SCHEME)?(r=n.slice(Ua.URL_SCHEME.length),new Ua(r)):null;var r};mn.registerSaveRouter(zl),mn.registerLoadRouter(zl);var Mp=function(){function n(){_(p().getBool("IS_BROWSER"),function(){return"Current environment is not a web browser"}),_(typeof window=="undefined"||window.localStorage!==void 0,function(){return"Current browser does not appear to support localStorage"}),this.LS=window.localStorage}return n.prototype.listModels=function(){return E(this,void 0,void 0,function(){var r,e,t,o,a,i;return g(this,function(s){for(r={},e=Ba+oo,t=oo+Wl,o=0;o<this.LS.length;++o)(a=this.LS.key(o)).startsWith(e)&&a.endsWith(t)&&(i=kp(a),r[i]=JSON.parse(this.LS.getItem(a)));return[2,r]})})},n.prototype.removeModel=function(r){return E(this,void 0,void 0,function(){var e,t;return g(this,function(o){var a;if(r=(a=r).startsWith(Ua.URL_SCHEME)?a.slice(Ua.URL_SCHEME.length):a,e=Hl(r),this.LS.getItem(e.info)==null)throw new Error("Cannot find model at path '"+r+"'");return t=JSON.parse(this.LS.getItem(e.info)),this.LS.removeItem(e.info),this.LS.removeItem(e.topology),this.LS.removeItem(e.weightSpecs),this.LS.removeItem(e.weightData),[2,t]})})},n}();if(p().getBool("IS_BROWSER"))try{Ro.registerManager(Ua.URL_SCHEME,new Mp)}catch(n){}var Pp="model",Fp=".json",Lp=".weights.bin";function Gl(n){return new Promise(function(r){return setTimeout(r)}).then(n)}var ju=function(){function n(r){if(!p().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");r.startsWith(n.URL_SCHEME)&&(r=r.slice(n.URL_SCHEME.length)),r!=null&&r.length!==0||(r=Pp),this.modelTopologyFileName=r+Fp,this.weightDataFileName=r+Lp}return n.prototype.save=function(r){return E(this,void 0,void 0,function(){var e,t,o,a,i,s;return g(this,function(u){switch(u.label){case 0:if(typeof document=="undefined")throw new Error("Browser downloads are not supported in this environment since `document` is not present");if(e=window.URL.createObjectURL(new Blob([r.weightData],{type:"application/octet-stream"})),!(r.modelTopology instanceof ArrayBuffer))return[3,1];throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");case 1:return t=[{paths:["./"+this.weightDataFileName],weights:r.weightSpecs}],o={modelTopology:r.modelTopology,format:r.format,generatedBy:r.generatedBy,convertedBy:r.convertedBy,weightsManifest:t},a=window.URL.createObjectURL(new Blob([JSON.stringify(o)],{type:"application/json"})),(i=this.jsonAnchor==null?document.createElement("a"):this.jsonAnchor).download=this.modelTopologyFileName,i.href=a,[4,Gl(function(){return i.dispatchEvent(new MouseEvent("click"))})];case 2:return u.sent(),r.weightData==null?[3,4]:((s=this.weightDataAnchor==null?document.createElement("a"):this.weightDataAnchor).download=this.weightDataFileName,s.href=e,[4,Gl(function(){return s.dispatchEvent(new MouseEvent("click"))})]);case 3:u.sent(),u.label=4;case 4:return[2,{modelArtifactsInfo:Si(r)}]}})})},n.URL_SCHEME="downloads://",n}(),jp=function(){function n(r){if(r==null||r.length<1)throw new Error("When calling browserFiles, at least 1 file is required, but received "+r);this.files=r}return n.prototype.load=function(){return E(this,void 0,void 0,function(){var r,e,t=this;return g(this,function(o){return r=this.files[0],e=this.files.slice(1),[2,new Promise(function(a,i){var s=new FileReader;s.onload=function(u){var f=JSON.parse(u.target.result),C=f.modelTopology;if(C!=null){e.length===0&&a({modelTopology:C});var k=f.weightsManifest;if(k!=null){var L;try{L=t.checkManifestAndWeightFiles(k,e)}catch(se){return void i(se)}var Y=[],ne=[],ce=[];k.forEach(function(se){se.paths.forEach(function(le){ne.push(le),ce.push(null)}),Y.push.apply(Y,se.weights)}),k.forEach(function(se){se.paths.forEach(function(le){var xe=new FileReader;xe.onload=function(Ee){var Ce=Ee.target.result,Te=ne.indexOf(le);ce[Te]=Ce,ce.indexOf(null)===-1&&a({modelTopology:C,weightSpecs:Y,weightData:Fu(ce),format:f.format,generatedBy:f.generatedBy,convertedBy:f.convertedBy,userDefinedMetadata:f.userDefinedMetadata})},xe.onerror=function(Ee){return i("Failed to weights data from file of path '"+le+"'.")},xe.readAsArrayBuffer(L[le])})})}else i(new Error("weightManifest field is missing from file "+r.name))}else i(new Error("modelTopology field is missing from file "+r.name))},s.onerror=function(u){return i("Failed to read model topology and weights manifest JSON from file '"+r.name+"'. BrowserFiles supports loading Keras-style tf.Model artifacts only.")},s.readAsText(r)})]})})},n.prototype.checkManifestAndWeightFiles=function(r,e){for(var t=[],o=e.map(function(u){return Ll(u.name)}),a={},i=0,s=r;i<s.length;i++)s[i].paths.forEach(function(u){var f=Ll(u);if(t.indexOf(f)!==-1)throw new Error("Duplicate file basename found in weights manifest: '"+f+"'");if(t.push(f),o.indexOf(f)===-1)throw new Error("Weight file with basename '"+f+"' is not provided.");a[u]=e[o.indexOf(f)]});if(t.length!==e.length)throw new Error("Mismatch in the number of files in weights manifest ("+t.length+") and the number of weight files provided ("+e.length+").");return a},n}();function Vl(n,r,e,t){!function(a){_(a!=null&&Array.isArray(a)&&a.length>0,function(){return"promises must be a none empty array"})}(n),function(a,i){_(a>=0&&a<=1,function(){return"Progress fraction must be in range [0, 1], but got startFraction "+a}),_(i>=0&&i<=1,function(){return"Progress fraction must be in range [0, 1], but got endFraction "+i}),_(i>=a,function(){return"startFraction must be no more than endFraction, but got startFraction "+a+" and endFraction "+i})}(e=e==null?0:e,t=t==null?1:t);var o=0;return Promise.all(n.map(function(a){return a.then(function(i){var s=e+ ++o/n.length*(t-e);return r(s),i}),a}))}function Xl(n,r){return E(this,void 0,void 0,function(){var e,t,o,a,i,s,u,f,C;return g(this,function(k){switch(k.label){case 0:return r==null&&(r={}),e=r.fetchFunc==null?p().platform.fetch:r.fetchFunc,t=n.map(function(L){return e(L,r.requestInit,{isBinary:!0})}),o=0,a=.5,r.onProgress!=null?[3,2]:[4,Promise.all(t)];case 1:return i=k.sent(),[3,4];case 2:return[4,Vl(t,r.onProgress,o,a)];case 3:i=k.sent(),k.label=4;case 4:return s=i.map(function(L){return L.arrayBuffer()}),u=.5,f=1,r.onProgress!=null?[3,6]:[4,Promise.all(s)];case 5:return C=k.sent(),[3,8];case 6:return[4,Vl(s,r.onProgress,u,f)];case 7:C=k.sent(),k.label=8;case 8:return[2,C]}})})}function Kl(n){var r=this;return function(e,t,o){return t===void 0&&(t=""),E(r,void 0,void 0,function(){var a,i,s,u,f,C,k,L,Y,ne;return g(this,function(ce){switch(ce.label){case 0:if(a=e.map(function(){return!1}),i={},s=o!=null?o.map(function(){return!1}):[],u=[],e.forEach(function(se,le){var xe=0;se.weights.forEach(function(Ee){var Ce="quantization"in Ee?Ee.quantization.dtype:Ee.dtype,Te=Mu[Ce]*de(Ee.shape),Me=function(){a[le]=!0,i[le]==null&&(i[le]=[]),i[le].push({manifestEntry:Ee,groupOffset:xe,sizeBytes:Te})};o!=null?o.forEach(function(He,Be){He===Ee.name&&(Me(),s[Be]=!0)}):Me(),u.push(Ee.name),xe+=Te})}),!s.every(function(se){return se}))throw f=o.filter(function(se,le){return!s[le]}),new Error("Could not find weights in manifest with names: "+f.join(", ")+`.
|
|
|
Manifest JSON has weights with names: `+u.join(", ")+".");return C=a.reduce(function(se,le,xe){return le&&se.push(xe),se},[]),k=[],C.forEach(function(se){e[se].paths.forEach(function(le){var xe=t+(t.endsWith("/")?"":"/")+le;k.push(xe)})}),[4,n(k)];case 1:return L=ce.sent(),Y={},ne=0,C.forEach(function(se){for(var le=e[se].paths.length,xe=0,Ee=0;Ee<le;Ee++)xe+=L[ne+Ee].byteLength;for(var Ce=new ArrayBuffer(xe),Te=new Uint8Array(Ce),Me=0,He=0;He<le;He++){var Be=new Uint8Array(L[ne+He]);Te.set(Be,Me),Me+=Be.byteLength}i[se].forEach(function(je){var We=Pl(Ce.slice(je.groupOffset,je.groupOffset+je.sizeBytes),[je.manifestEntry]);for(var Ze in We)Y[Ze]=We[Ze]}),ne+=le}),[2,Y]}})})}}mn.registerSaveRouter(function(n){return p().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?(_(typeof e.fetchFunc=="function",function(){return"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"}),this.fetch=e.fetchFunc):this.fetch=p().platform.fetch,_(r!=null&&r.length>0,function(){return"URL path for http must not be null, undefined or empty."}),Array.isArray(r)&&_(r.length===2,function(){return"URL paths for http must have a length of 2, (actual length is "+r.length+")."}),this.path=r,e.requestInit!=null&&e.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=e.requestInit||{}}return n.prototype.save=function(r){return E(this,void 0,void 0,function(){var e,t,o,a;return g(this,function(i){switch(i.label){case 0:if(r.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");return(e=Object.assign({method:this.DEFAULT_METHOD},this.requestInit)).body=new FormData,t=[{paths:["./model.weights.bin"],weights:r.weightSpecs}],o={modelTopology:r.modelTopology,format:r.format,generatedBy:r.generatedBy,convertedBy:r.convertedBy,userDefinedMetadata:r.userDefinedMetadata,weightsManifest:t},e.body.append("model.json",new Blob([JSON.stringify(o)],{type:"application/json"}),"model.json"),r.weightData!=null&&e.body.append("model.weights.bin",new Blob([r.weightData],{type:"application/octet-stream"}),"model.weights.bin"),[4,this.fetch(this.path,e)];case 1:if((a=i.sent()).ok)return[2,{modelArtifactsInfo:Si(r),responses:[a]}];throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+a.status+".")}})})},n.prototype.load=function(){return E(this,void 0,void 0,function(){var r,e,t,o,a,i,s,u,f,C,k,L;return g(this,function(Y){switch(Y.label){case 0:return[4,this.fetch(this.path,this.requestInit)];case 1:if(!(r=Y.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.");Y.label=2;case 2:return Y.trys.push([2,4,,5]),[4,r.json()];case 3:return e=Y.sent(),[3,5];case 4:throw Y.sent(),t="Failed to parse model JSON of response from "+this.path+".",this.path.endsWith(".pb")?t+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":t+=" Please make sure the server is serving valid JSON for this request.",new Error(t);case 5:if(o=e.modelTopology,a=e.weightsManifest,i=e.generatedBy,s=e.convertedBy,u=e.format,f=e.userDefinedMetadata,o==null&&a==null)throw new Error("The JSON from HTTP path "+this.path+" contains neither model topology or manifest for weights.");return a==null?[3,7]:[4,this.loadWeights(a)];case 6:L=Y.sent(),C=L[0],k=L[1],Y.label=7;case 7:return[2,{modelTopology:o,weightSpecs:C,weightData:k,userDefinedMetadata:f,generatedBy:i,convertedBy:s,format:u}]}})})},n.prototype.loadWeights=function(r){return E(this,void 0,void 0,function(){var e,t,o,a,i,s,u,f,C,k,L;return g(this,function(Y){switch(Y.label){case 0:for(e=Array.isArray(this.path)?this.path[1]:this.path,t=function(ne){var ce=ne.lastIndexOf("/"),se=ne.lastIndexOf("?"),le=ne.substring(0,ce),xe=se>ce?ne.substring(se):"";return[le+"/",xe]}(e),o=t[0],a=t[1],i=this.weightPathPrefix||o,s=[],u=0,f=r;u<f.length;u++)C=f[u],s.push.apply(s,C.weights);return k=[],r.forEach(function(ne){ne.paths.forEach(function(ce){k.push(i+ce+a)})}),[4,Xl(k,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress})];case 1:return L=Y.sent(),[2,[s,Fu(L)]]}})})},n.URL_SCHEME_REGEX=/^https?:\/\//,n}();function Bu(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 Bu(e)}):Bu(n))?Uu(n,{onProgress:r}):null};function Uu(n,r){return new Yl(n,r)}mn.registerSaveRouter($l),mn.registerLoadRouter($l);var Wu=function(){function n(r){this.modelArtifacts=r}return n.prototype.load=function(){return E(this,void 0,void 0,function(){return g(this,function(r){return[2,this.modelArtifacts]})})},n}(),Bp=function(){function n(r){this.saveHandler=r}return n.prototype.save=function(r){return E(this,void 0,void 0,function(){return g(this,function(e){return[2,this.saveHandler(r)]})})},n}(),Up=Object.freeze({browserFiles:function(n){return new jp(n)},browserHTTPRequest:function(n,r){return Uu(n,r)},concatenateArrayBuffers:Fu,decodeWeights:Pl,encodeWeights:function(n,r){return E(this,void 0,void 0,function(){var e,t,o,a,i,s=this;return g(this,function(u){switch(u.label){case 0:for(e=[],t=[],o=Array.isArray(n)?n.map(function(f){return f.name}):Object.keys(n),a=function(f){var C=o[f],k=Array.isArray(n)?n[f].tensor:n[C];if(k.dtype!=="float32"&&k.dtype!=="int32"&&k.dtype!=="bool"&&k.dtype!=="string")throw new Error("Unsupported dtype in weight '"+C+"': "+k.dtype);var L={name:C,shape:k.shape,dtype:k.dtype};if(k.dtype==="string"){var Y=new Promise(function(ne){return E(s,void 0,void 0,function(){var ce,se,le,xe,Ee,Ce,Te;return g(this,function(Me){switch(Me.label){case 0:return[4,k.bytes()];case 1:for(ce=Me.sent(),se=ce.reduce(function(He,Be){return He+Be.length},0)+bs*ce.length,le=new Uint8Array(se),xe=0,Ee=0;Ee<ce.length;Ee++)Ce=ce[Ee],Te=new Uint8Array(new Uint32Array([Ce.length]).buffer),le.set(Te,xe),xe+=bs,le.set(Ce,xe),xe+=Ce.length;return ne(le),[2]}})})});t.push(Y)}else t.push(k.data());r!=null&&(L.group=r),e.push(L)},i=0;i<o.length;++i)a(i);return[4,Promise.all(t)];case 1:return[2,{data:Ap(u.sent()),specs:e}]}})})},fromMemory:function(n,r,e,t){return arguments.length===1?n.modelTopology!=null||n.weightSpecs!=null?new Wu(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 Wu({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 Wu({modelTopology:n,weightSpecs:r,weightData:e,trainingConfig:t}))},getLoadHandlers:function(n,r){return mn.getLoadHandlers(n,r)},getModelArtifactsInfoForJSON:Si,getSaveHandlers:function(n){return mn.getSaveHandlers(n)},http:Uu,isHTTPScheme:Bu,loadWeights:function(n,r,e,t){return r===void 0&&(r=""),E(this,void 0,void 0,function(){return g(this,function(o){return[2,Kl(function(a){return Xl(a,{requestInit:t})})(n,r,e)]})})},registerLoadRouter:function(n){return mn.registerLoadRouter(n)},registerSaveRouter:function(n){return mn.registerSaveRouter(n)},weightsLoaderFactory:Kl,withSaveHandler:function(n){return new Bp(n)},copyModel:function(n,r){return E(this,void 0,void 0,function(){return g(this,function(e){return[2,jl(n,r,!1)]})})},listModels:function(){return E(this,void 0,void 0,function(){var n,r,e,t,o,a,i;return g(this,function(s){switch(s.label){case 0:n=Ro.getSchemes(),r={},e=0,t=n,s.label=1;case 1:return e<t.length?(o=t[e],[4,Ro.getManager(o).listModels()]):[3,4];case 2:for(i in a=s.sent())r[o+La+i]=a[i];s.label=3;case 3:return e++,[3,1];case 4:return[2,r]}})})},moveModel:function(n,r){return E(this,void 0,void 0,function(){return g(this,function(e){return[2,jl(n,r,!0)]})})},removeModel:function(n){return E(this,void 0,void 0,function(){var r;return g(this,function(e){return r=xs(n),[2,Ro.getManager(r.scheme).removeModel(r.path)]})})}}),Wa,Wp=Xe({confusionMatrix_:function(n,r,e){var t=Oe(n,"labels","confusionMatrix"),o=Oe(r,"predictions","confusionMatrix");_(e==null||e>0&&Number.isInteger(e),function(){return"If provided, numClasses must be a positive integer, but got "+e}),_(t.rank===1,function(){return"Expected the rank of labels to be 1, but got "+t.rank}),_(o.rank===1,function(){return"Expected the rank of predictions to be 1, but got "+o.rank}),_(t.shape[0]===o.shape[0],function(){return"Mismatch in the number of examples: "+t.shape[0]+" vs. "+o.shape[0]+". Labels and predictions should have the same number of elements."}),_(e>0&&Number.isInteger(e),function(){return"numClasses is required to be a positive integer, but got "+e});var a=ii(t.asType("int32"),e),i=ii(o.asType("int32"),e);return a.transpose().matMul(i).asType("int32")}}),$p=Object.freeze({confusionMatrix:Wp}),Hp=Xe({fromPixels_:function(n,r){if(r===void 0&&(r=3),r>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(n==null)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");var e=!1,t=!1,o=!1,a=!1,i=!1;if(n.data instanceof Uint8Array)e=!0;else if(typeof ImageData!="undefined"&&n instanceof ImageData)t=!0;else if(typeof HTMLVideoElement!="undefined"&&n instanceof HTMLVideoElement)o=!0;else if(typeof HTMLImageElement!="undefined"&&n instanceof HTMLImageElement)a=!0;else{if(n.getContext==null)throw new Error("pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, but was "+n.constructor.name);i=!0}if(o&&(o&&n.readyState<2))throw new Error("The video element has not loaded data yet. Please wait for `loadeddata` event on the <video> element.");if(S("FromPixels",Ve.backendName)!=null)return Ve.runKernel("FromPixels",{pixels:n},{numChannels:r});var s,u,f=o?[n.videoWidth,n.videoHeight]:[n.width,n.height],C=f[0],k=f[1];if(i?s=n.getContext("2d").getImageData(0,0,C,k).data:t||e?s=n.data:(a||o)&&(Wa==null&&(Wa=document.createElement("canvas").getContext("2d")),Wa.canvas.width=C,Wa.canvas.height=k,Wa.drawImage(n,0,0,C,k),s=Wa.getImageData(0,0,C,k).data),r===4)u=new Int32Array(s);else{var L=C*k;u=new Int32Array(L*r);for(var Y=0;Y<L;Y++)for(var ne=0;ne<r;++ne)u[Y*r+ne]=s[4*Y+ne]}return ni(u,[k,C,r],"int32")}}),zp=Object.freeze({toPixels:function(n,r){return E(this,void 0,void 0,function(){var e,t,o,a,i,s,u,f,C,k,L,Y,ne,ce,se,le,xe,Ee,Ce,Te,Me,He,Be;return g(this,function(je){switch(je.label){case 0:if(e=Oe(n,"img","toPixels"),n instanceof Dr||(e=e.toInt()),e.rank!==2&&e.rank!==3)throw new Error("toPixels only supports rank 2 or 3 tensors, got rank "+e.rank+".");if(t=e.shape.slice(0,2),o=t[0],a=t[1],(i=e.rank===2?1:e.shape[2])>4||i===2)throw new Error("toPixels only supports depth of size 1, 3 or 4 but got "+i);return[4,e.data()];case 1:return s=je.sent(),u=e.min(),f=e.max(),[4,Promise.all([u.data(),f.data()])];case 2:if(C=je.sent(),k=C[0],L=C[1],Y=k[0],ne=L[0],u.dispose(),f.dispose(),e.dtype==="float32"){if(Y<0||ne>1)throw new Error("Tensor values for a float32 Tensor must be in the range [0 - 1] but got range ["+Y+" - "+ne+"].")}else{if(e.dtype!=="int32")throw new Error("Unsupported type for toPixels: "+e.dtype+". Please use float32 or int32 tensors.");if(Y<0||ne>255)throw new Error("Tensor values for a int32 Tensor must be in the range [0 - 255] but got range ["+Y+" - "+ne+"].")}for(ce=e.dtype==="float32"?255:1,se=new Uint8ClampedArray(a*o*4),le=0;le<o*a;++le)xe=void 0,Ee=void 0,Ce=void 0,Te=void 0,i===1?(xe=s[le]*ce,Ee=s[le]*ce,Ce=s[le]*ce,Te=255):i===3?(xe=s[3*le]*ce,Ee=s[3*le+1]*ce,Ce=s[3*le+2]*ce,Te=255):i===4&&(xe=s[4*le]*ce,Ee=s[4*le+1]*ce,Ce=s[4*le+2]*ce,Te=s[4*le+3]*ce),se[(Me=4*le)+0]=Math.round(xe),se[Me+1]=Math.round(Ee),se[Me+2]=Math.round(Ce),se[Me+3]=Math.round(Te);return r!=null&&(r.width=a,r.height=o,He=r.getContext("2d"),Be=new ImageData(se,a,o),He.putImageData(Be,0,0)),e!==n&&e.dispose(),[2,se]}})})},fromPixels:Hp}),Jl=function(){function n(){}return n.prototype.getClassName=function(){return this.constructor.className},n.fromConfig=function(r,e){return new r(e)},n}(),ql=function(){function n(){this.classNameMap={}}return n.getMap=function(){return n.instance==null&&(n.instance=new n),n.instance},n.register=function(r){n.getMap().classNameMap[r.className]=[r,r.fromConfig]},n}();function No(n){_(n.className!=null,function(){return"Class being registered does not have the static className property defined."}),_(typeof n.className=="string",function(){return"className is required to be a string, but got type "+typeof n.className}),_(n.className.length>0,function(){return"Class being registered has an empty-string as its className, which is disallowed."}),ql.register(n)}var Jp=Object.freeze({Serializable:Jl,SerializationMap:ql,registerClass:No}),Gp=.001,Ql=.1;function Hu(){return Ve.backend.floatPrecision()===32?Gp:Ql}function zu(n,r,e){var t=!0;if((Ie(n)||Ie(r))&&(t=!1),Ie(n)&&Ie(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=xn(n),s=xn(r);if(!we(i,s))throw new Error("Arrays have different shapes. Actual: ["+i+"]. Expected: ["+s+"]")}var u=Ie(n)?n:me(n),f=Ie(r)?r:me(r);if(u.length!==f.length)throw new Error("Arrays have different lengths actual: "+u.length+" vs expected: "+f.length+`.
|
|
|
Actual: `+u+`.
|
|
|
Expected: `+f+".");for(var C=0;C<f.length;++C){var k=u[C],L=f[C];if(!e(k,L))throw new Error("Arrays differ: actual["+C+"] = "+k+", expected["+C+"] = "+L+`.
|
|
|
Actual: `+u+`.
|
|
|
Expected: `+f+".")}}function Gu(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=Hu()),zu(n,r,function(t,o){return Gu(t,o,e)})},testEpsilon:Hu,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])?zu(n,e,function(t,o){return t==o}):zu(n,r,function(t,o){return Gu(t,o,0)})},expectNumbersClose:function(n,r,e){if(e==null&&(e=Hu()),!Gu(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:Cs,forceHalfFloat:function(){p().set("WEBGL_FORCE_F16_TEXTURES",!0)},MathBackendWebGL:Hc,setWebGLContext:Ya,GPGPUContext:Tc}),ra=function(n){function r(){return n!==null&&n.apply(this,arguments)||this}return D(r,n),r.prototype.minimize=function(e,t,o){t===void 0&&(t=!1);var a=this.computeGradients(e,o),i=a.value,s=a.grads;if(o!=null){var u=o.map(function(f){return{name:f.name,tensor:s[f.name]}});this.applyGradients(u)}else this.applyGradients(s);return qr(s),t?i:(i.dispose(),null)},Object.defineProperty(r.prototype,"iterations",{get:function(){return this.iterations_==null&&(this.iterations_=0),this.iterations_},enumerable:!0,configurable:!0}),r.prototype.incrementIterations=function(){this.iterations_=this.iterations+1},r.prototype.computeGradients=function(e,t){return li(e,t)},r.prototype.dispose=function(){this.iterations_!=null&&qr(this.iterations_)},r.prototype.saveIterations=function(){return E(this,void 0,void 0,function(){return g(this,function(e){return this.iterations_==null&&(this.iterations_=0),[2,{name:"iter",tensor:Nt(this.iterations_,"int32")}]})})},r.prototype.getWeights=function(){return E(this,void 0,void 0,function(){return g(this,function(e){throw new Error("getWeights() is not implemented for this optimizer yet.")})})},r.prototype.setWeights=function(e){return E(this,void 0,void 0,function(){return g(this,function(t){throw new Error("setWeights() is not implemented for this optimizer class "+this.getClassName())})})},r.prototype.extractIterations=function(e){return E(this,void 0,void 0,function(){var t;return g(this,function(o){switch(o.label){case 0:return t=this,[4,e[0].tensor.data()];case 1:return t.iterations_=o.sent()[0],[2,e.slice(1)]}})})},r}(Jl);Object.defineProperty(ra,Symbol.hasInstance,{value:function(n){return n.minimize!=null&&n.computeGradients!=null&&n.applyGradients!=null}});var Zl=function(n){function r(e,t,o){o===void 0&&(o=null);var a=n.call(this)||this;return a.learningRate=e,a.rho=t,a.epsilon=o,a.accumulatedGrads=[],a.accumulatedUpdates=[],o==null&&(a.epsilon=Ve.backend.epsilon()),a}return D(r,n),r.prototype.applyGradients=function(e){var t=this;(Array.isArray(e)?e.map(function(o){return o.name}):Object.keys(e)).forEach(function(o,a){var i=Ve.registeredVariables[o];t.accumulatedGrads[a]==null&&(t.accumulatedGrads[a]={originalName:o+"/accum_grad",variable:Rr(function(){return $t(i).variable(!1)})}),t.accumulatedUpdates[a]==null&&(t.accumulatedUpdates[a]={originalName:o+"/accum_var",variable:Rr(function(){return $t(i).variable(!1)})});var s=Array.isArray(e)?e[a].tensor:e[o];if(s!=null){var u=t.accumulatedGrads[a].variable,f=t.accumulatedUpdates[a].variable;Rr(function(){var C=u.mul(t.rho).add(s.square().mul(1-t.rho)),k=f.add(t.epsilon).sqrt().div(u.add(t.epsilon).sqrt()).mul(s),L=f.mul(t.rho).add(k.square().mul(1-t.rho));u.assign(C),f.assign(L);var Y=k.mul(-t.learningRate).add(i);i.assign(Y)})}}),this.incrementIterations()},r.prototype.dispose=function(){this.accumulatedUpdates!=null&&(qr(this.accumulatedGrads.map(function(e){return e.variable})),qr(this.accumulatedUpdates.map(function(e){return e.variable})))},r.prototype.getWeights=function(){return E(this,void 0,void 0,function(){var e;return g(this,function(t){switch(t.label){case 0:return e=this.accumulatedGrads.concat(this.accumulatedUpdates),[4,this.saveIterations()];case 1:return[2,[t.sent()].concat(e.map(function(o){return{name:o.originalName,tensor:o.variable}}))]}})})},r.prototype.setWeights=function(e){return E(this,void 0,void 0,function(){var t;return g(this,function(o){switch(o.label){case 0:return[4,this.extractIterations(e)];case 1:return e=o.sent(),t=e.length/2,this.accumulatedGrads=e.slice(0,t).map(function(a){return{originalName:a.name,variable:a.tensor.variable(!1)}}),this.accumulatedUpdates=e.slice(t,2*t).map(function(a){return{originalName:a.name,variable:a.tensor.variable(!1)}}),[2]}})})},r.prototype.getConfig=function(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}},r.fromConfig=function(e,t){return new e(t.learningRate,t.rho,t.epsilon)},r.className="Adadelta",r}(ra);No(Zl);var ed=function(n){function r(e,t){t===void 0&&(t=.1);var o=n.call(this)||this;return o.learningRate=e,o.initialAccumulatorValue=t,o.accumulatedGrads=[],o}return D(r,n),r.prototype.applyGradients=function(e){var t=this;(Array.isArray(e)?e.map(function(o){return o.name}):Object.keys(e)).forEach(function(o,a){var i=Ve.registeredVariables[o];t.accumulatedGrads[a]==null&&(t.accumulatedGrads[a]={originalName:o+"/accumulator",variable:Rr(function(){return oi(i.shape,t.initialAccumulatorValue).variable(!1)})});var s=Array.isArray(e)?e[a].tensor:e[o];if(s!=null){var u=t.accumulatedGrads[a].variable;Rr(function(){var f=u.add(s.square());u.assign(f);var C=s.div(f.add(Ve.backend.epsilon()).sqrt()).mul(-t.learningRate).add(i);i.assign(C)})}}),this.incrementIterations()},r.prototype.dispose=function(){this.accumulatedGrads!=null&&qr(this.accumulatedGrads.map(function(e){return e.variable}))},r.prototype.getWeights=function(){return E(this,void 0,void 0,function(){return g(this,function(e){switch(e.label){case 0:return[4,this.saveIterations()];case 1:return[2,[e.sent()].concat(this.accumulatedGrads.map(function(t){return{name:t.originalName,tensor:t.variable}}))]}})})},r.prototype.setWeights=function(e){return E(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this.extractIterations(e)];case 1:return e=t.sent(),this.accumulatedGrads=e.map(function(o){return{originalName:o.name,variable:o.tensor.variable(!1)}}),[2]}})})},r.prototype.getConfig=function(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}},r.fromConfig=function(e,t){return new e(t.learningRate,t.initialAccumulatorValue)},r.className="Adagrad",r}(ra);No(ed);var td=function(n){function r(e,t,o,a){a===void 0&&(a=null);var i=n.call(this)||this;return i.learningRate=e,i.beta1=t,i.beta2=o,i.epsilon=a,i.accumulatedFirstMoment=[],i.accumulatedSecondMoment=[],Rr(function(){i.accBeta1=Nt(t).variable(),i.accBeta2=Nt(o).variable()}),a==null&&(i.epsilon=Ve.backend.epsilon()),i}return D(r,n),r.prototype.applyGradients=function(e){var t=this,o=Array.isArray(e)?e.map(function(a){return a.name}):Object.keys(e);Rr(function(){var a=Oo(1,t.accBeta1),i=Oo(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 $t(f).variable(!1)})}),t.accumulatedSecondMoment[u]==null&&(t.accumulatedSecondMoment[u]={originalName:s+"/v",variable:Rr(function(){return $t(f).variable(!1)})});var C=Array.isArray(e)?e[u].tensor:e[s];if(C!=null){var k=t.accumulatedFirstMoment[u].variable,L=t.accumulatedSecondMoment[u].variable,Y=k.mul(t.beta1).add(C.mul(1-t.beta1)),ne=L.mul(t.beta2).add(C.square().mul(1-t.beta2)),ce=Y.div(a),se=ne.div(i);k.assign(Y),L.assign(ne);var le=ce.div(se.sqrt().add(t.epsilon)).mul(-t.learningRate).add(f);f.assign(le)}}),t.accBeta1.assign(t.accBeta1.mul(t.beta1)),t.accBeta2.assign(t.accBeta2.mul(t.beta2))}),this.incrementIterations()},r.prototype.dispose=function(){this.accBeta1.dispose(),this.accBeta2.dispose(),this.accumulatedFirstMoment!=null&&qr(this.accumulatedFirstMoment.map(function(e){return e.variable})),this.accumulatedSecondMoment!=null&&qr(this.accumulatedSecondMoment.map(function(e){return e.variable}))},r.prototype.getWeights=function(){return E(this,void 0,void 0,function(){var e;return g(this,function(t){switch(t.label){case 0:return e=this.accumulatedFirstMoment.concat(this.accumulatedSecondMoment),[4,this.saveIterations()];case 1:return[2,[t.sent()].concat(e.map(function(o){return{name:o.originalName,tensor:o.variable}}))]}})})},r.prototype.setWeights=function(e){return E(this,void 0,void 0,function(){var t,o=this;return g(this,function(a){switch(a.label){case 0:return[4,this.extractIterations(e)];case 1:return e=a.sent(),Rr(function(){o.accBeta1.assign(ms(o.beta1,o.iterations_+1)),o.accBeta2.assign(ms(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}(ra);No(td);var rd=function(n){function r(e,t,o,a,i){a===void 0&&(a=null),i===void 0&&(i=0);var s=n.call(this)||this;return s.learningRate=e,s.beta1=t,s.beta2=o,s.epsilon=a,s.decay=i,s.accumulatedFirstMoment=[],s.accumulatedWeightedInfNorm=[],Rr(function(){s.iteration=Nt(0).variable(),s.accBeta1=Nt(t).variable()}),a==null&&(s.epsilon=Ve.backend.epsilon()),s}return D(r,n),r.prototype.applyGradients=function(e){var t=this,o=Array.isArray(e)?e.map(function(a){return a.name}):Object.keys(e);Rr(function(){var a=Oo(1,t.accBeta1),i=ps(-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:$t(f).variable(!1)}),t.accumulatedWeightedInfNorm[u]==null&&(t.accumulatedWeightedInfNorm[u]={originalName:s+"/v",variable:$t(f).variable(!1)});var C=Array.isArray(e)?e[u].tensor:e[s];if(C!=null){var k=t.accumulatedFirstMoment[u].variable,L=t.accumulatedWeightedInfNorm[u].variable,Y=k.mul(t.beta1).add(C.mul(1-t.beta1)),ne=L.mul(t.beta2),ce=C.abs(),se=ne.maximum(ce);k.assign(Y),L.assign(se);var le=i.div(a).mul(Y.div(se.add(t.epsilon))).add(f);f.assign(le)}}),t.iteration.assign(t.iteration.add(1)),t.accBeta1.assign(t.accBeta1.mul(t.beta1))}),this.incrementIterations()},r.prototype.dispose=function(){this.accBeta1.dispose(),this.iteration.dispose(),this.accumulatedFirstMoment!=null&&qr(this.accumulatedFirstMoment.map(function(e){return e.variable})),this.accumulatedWeightedInfNorm!=null&&qr(this.accumulatedWeightedInfNorm.map(function(e){return e.variable}))},r.prototype.getWeights=function(){return E(this,void 0,void 0,function(){return g(this,function(e){throw new Error("getWeights() is not implemented for Adamax yet.")})})},r.prototype.setWeights=function(e){return E(this,void 0,void 0,function(){return g(this,function(t){throw new Error("setWeights() is not implemented for Adamax yet.")})})},r.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}},r.fromConfig=function(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)},r.className="Adamax",r}(ra);No(rd);var Vu=function(n){function r(e){var t=n.call(this)||this;return t.learningRate=e,t.setLearningRate(e),t}return D(r,n),r.prototype.applyGradients=function(e){var t=this;(Array.isArray(e)?e.map(function(o){return o.name}):Object.keys(e)).forEach(function(o,a){var i=Array.isArray(e)?e[a].tensor:e[o];if(i!=null){var s=Ve.registeredVariables[o];Rr(function(){var u=t.c.mul(i).add(s);s.assign(u)})}}),this.incrementIterations()},r.prototype.setLearningRate=function(e){this.learningRate=e,this.c!=null&&this.c.dispose(),this.c=Ss(Nt(-e))},r.prototype.dispose=function(){this.c.dispose()},r.prototype.getWeights=function(){return E(this,void 0,void 0,function(){return g(this,function(e){switch(e.label){case 0:return[4,this.saveIterations()];case 1:return[2,[e.sent()]]}})})},r.prototype.setWeights=function(e){return E(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this.extractIterations(e)];case 1:if((e=t.sent()).length!==0)throw new Error("SGD optimizer does not have settable weights.");return[2]}})})},r.prototype.getConfig=function(){return{learningRate:this.learningRate}},r.fromConfig=function(e,t){return new e(t.learningRate)},r.className="SGD",r}(ra);No(Vu);var nd=function(n){function r(e,t,o){o===void 0&&(o=!1);var a=n.call(this,e)||this;return a.learningRate=e,a.momentum=t,a.useNesterov=o,a.accumulations=[],a.m=Nt(a.momentum),a}return D(r,n),r.prototype.applyGradients=function(e){var t=this;(Array.isArray(e)?e.map(function(o){return o.name}):Object.keys(e)).forEach(function(o,a){var i=Ve.registeredVariables[o];t.accumulations[a]==null&&(t.accumulations[a]={originalName:o+"/momentum",variable:Rr(function(){return $t(i).variable(!1)})});var s=t.accumulations[a].variable,u=Array.isArray(e)?e[a].tensor:e[o];u!=null&&Rr(function(){var f,C=t.m.mul(s).add(u);f=t.useNesterov?t.c.mul(u.add(C.mul(t.m))).add(i):t.c.mul(C).add(i),s.assign(C),i.assign(f)})}),this.incrementIterations()},r.prototype.dispose=function(){this.m.dispose(),this.accumulations!=null&&qr(this.accumulations.map(function(e){return e.variable}))},r.prototype.setMomentum=function(e){this.momentum=e},r.prototype.getWeights=function(){return E(this,void 0,void 0,function(){return g(this,function(e){switch(e.label){case 0:return[4,this.saveIterations()];case 1:return[2,[e.sent()].concat(this.accumulations.map(function(t){return{name:t.originalName,tensor:t.variable}}))]}})})},r.prototype.setWeights=function(e){return E(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this.extractIterations(e)];case 1:return e=t.sent(),this.accumulations=e.map(function(o){return{originalName:o.name,variable:o.tensor.variable(!1)}}),[2]}})})},r.prototype.getConfig=function(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}},r.fromConfig=function(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)},r.className="Momentum",r}(Vu);No(nd);var od=function(n){function r(e,t,o,a,i){t===void 0&&(t=.9),o===void 0&&(o=0),a===void 0&&(a=null),i===void 0&&(i=!1);var s=n.call(this)||this;if(s.learningRate=e,s.decay=t,s.momentum=o,s.epsilon=a,s.accumulatedMeanSquares=[],s.accumulatedMoments=[],s.accumulatedMeanGrads=[],s.centered=i,a==null&&(s.epsilon=Ve.backend.epsilon()),e==null)throw new Error("learningRate for RMSPropOptimizer must be defined.");return s}return D(r,n),r.prototype.applyGradients=function(e){var t=this;(Array.isArray(e)?e.map(function(o){return o.name}):Object.keys(e)).forEach(function(o,a){var i=Ve.registeredVariables[o];t.accumulatedMeanSquares[a]==null&&(t.accumulatedMeanSquares[a]={originalName:o+"/rms",variable:Rr(function(){return $t(i).variable(!1)})}),t.accumulatedMoments[a]==null&&(t.accumulatedMoments[a]={originalName:o+"/momentum",variable:Rr(function(){return $t(i).variable(!1)})}),t.accumulatedMeanGrads[a]==null&&t.centered&&(t.accumulatedMeanGrads[a]={originalName:o+"/mg",variable:Rr(function(){return $t(i).variable(!1)})});var s=Array.isArray(e)?e[a].tensor:e[o];if(s!=null){var u=t.accumulatedMeanSquares[a].variable,f=t.accumulatedMoments[a].variable;Rr(function(){var C=u.mul(t.decay).add(s.square().mul(1-t.decay));if(t.centered){var k=t.accumulatedMeanGrads[a].variable,L=k.mul(t.decay).add(s.mul(1-t.decay)),Y=f.mul(t.momentum).add(s.mul(t.learningRate).div(C.sub(L.square().add(t.epsilon)).sqrt()));u.assign(C),k.assign(L),f.assign(Y);var ne=i.sub(Y);i.assign(ne)}else{var ce=u.mul(t.decay).add(s.square().mul(1-t.decay));Y=f.mul(t.momentum).add(s.mul(t.learningRate).div(ce.add(t.epsilon).sqrt())),u.assign(ce),f.assign(Y),ne=i.sub(Y),i.assign(ne)}})}}),this.incrementIterations()},r.prototype.dispose=function(){this.accumulatedMeanSquares!=null&&qr(this.accumulatedMeanSquares.map(function(e){return e.variable})),this.accumulatedMeanGrads!=null&&this.centered&&qr(this.accumulatedMeanGrads.map(function(e){return e.variable})),this.accumulatedMoments!=null&&qr(this.accumulatedMoments.map(function(e){return e.variable}))},r.prototype.getWeights=function(){return E(this,void 0,void 0,function(){var e;return g(this,function(t){switch(t.label){case 0:return e=this.accumulatedMeanSquares.concat(this.accumulatedMoments),this.centered&&e.push.apply(e,this.accumulatedMeanGrads),[4,this.saveIterations()];case 1:return[2,[t.sent()].concat(e.map(function(o){return{name:o.originalName,tensor:o.variable}}))]}})})},r.prototype.setWeights=function(e){return E(this,void 0,void 0,function(){var t;return g(this,function(o){switch(o.label){case 0:return[4,this.extractIterations(e)];case 1:return e=o.sent(),t=this.centered?e.length/3:e.length/2,this.accumulatedMeanSquares=e.slice(0,t).map(function(a){return{originalName:a.name,variable:a.tensor.variable(!1)}}),this.accumulatedMoments=e.slice(t,2*t).map(function(a){return{originalName:a.name,variable:a.tensor.variable(!1)}}),this.centered&&(this.accumulatedMeanGrads=e.slice(2*t,3*t).map(function(a){return{originalName:a.name,variable:a.tensor.variable(!1)}})),[2]}})})},r.prototype.getConfig=function(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}},r.fromConfig=function(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)},r.className="RMSProp",r}(ra);No(od);var na=function(){function n(){}return n.sgd=function(r){return new Vu(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:na.sgd,momentum:na.momentum,adadelta:na.adadelta,adagrad:na.adagrad,rmsprop:na.rmsprop,adamax:na.adamax,adam:na.adam},Vp=typeof requestAnimationFrame!="undefined"?requestAnimationFrame:typeof setImmediate!="undefined"?setImmediate:function(n){return n()};function tm(){return new Promise(function(n){return Vp(function(){return n()})})}Dr.prototype.squaredDifference=function(n){return zc(this,n)},tt=xp}).call(this,N("IyRk"),N("Q2Ig"),N("HDXh").Buffer)},S6kV:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.mode.OFB=function(){var d=y.lib.BlockCipherMode.extend(),F=d.Encryptor=d.extend({processBlock:function(M,D){var E=this._cipher,g=E.blockSize,h=this._iv,b=this._keystream;h&&(b=this._keystream=h.slice(0),this._iv=void 0),E.encryptBlock(b,0);for(var p=0;p<g;p++)M[D+p]^=b[p]}});return d.Decryptor=F,d}(),y.mode.OFB})},WYAk:function(l,V,N){(function(y,d){l.exports=V=d(N("Ib8C"))})(this,function(y){(function(){var d=y,F=d.lib,M=F.Base,D=d.enc,E=D.Utf8,g=d.algo,h=g.HMAC=M.extend({init:function(b,p){b=this._hasher=new b.init,typeof p=="string"&&(p=E.parse(p));var v=b.blockSize,I=v*4;p.sigBytes>I&&(p=b.finalize(p)),p.clamp();for(var x=this._oKey=p.clone(),S=this._iKey=p.clone(),W=x.words,B=S.words,Q=0;Q<v;Q++)W[Q]^=1549556828,B[Q]^=909522486;x.sigBytes=S.sigBytes=I,this.reset()},reset:function(){var b=this._hasher;b.reset(),b.update(this._iKey)},update:function(b){return this._hasher.update(b),this},finalize:function(b){var p=this._hasher,v=p.finalize(b);p.reset();var I=p.finalize(this._oKey.clone().concat(v));return I}})})()})},bQjk:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("OLod"))})(this,function(y){return function(d){var F=y,M=F.lib,D=M.CipherParams,E=F.enc,g=E.Hex,h=F.format,b=h.Hex={stringify:function(p){return p.ciphertext.toString(g)},parse:function(p){var v=g.parse(p);return D.create({ciphertext:v})}}}(),y.format.Hex})},cv67:function(l,V,N){(function(y,d){l.exports=V=d(N("Ib8C"))})(this,function(y){return function(d){var F=y,M=F.lib,D=M.WordArray,E=M.Hasher,g=F.algo,h=[];(function(){for(var S=0;S<64;S++)h[S]=d.abs(d.sin(S+1))*4294967296|0})();var b=g.MD5=E.extend({_doReset:function(){this._hash=new D.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(S,W){for(var B=0;B<16;B++){var Q=W+B,G=S[Q];S[Q]=(G<<8|G>>>24)&16711935|(G<<24|G>>>8)&4278255360}var $=this._hash.words,J=S[W+0],U=S[W+1],j=S[W+2],T=S[W+3],ee=S[W+4],Z=S[W+5],_=S[W+6],X=S[W+7],re=S[W+8],me=S[W+9],de=S[W+10],we=S[W+11],ge=S[W+12],ke=S[W+13],z=S[W+14],ie=S[W+15],H=$[0],ae=$[1],ue=$[2],te=$[3];H=p(H,ae,ue,te,J,7,h[0]),te=p(te,H,ae,ue,U,12,h[1]),ue=p(ue,te,H,ae,j,17,h[2]),ae=p(ae,ue,te,H,T,22,h[3]),H=p(H,ae,ue,te,ee,7,h[4]),te=p(te,H,ae,ue,Z,12,h[5]),ue=p(ue,te,H,ae,_,17,h[6]),ae=p(ae,ue,te,H,X,22,h[7]),H=p(H,ae,ue,te,re,7,h[8]),te=p(te,H,ae,ue,me,12,h[9]),ue=p(ue,te,H,ae,de,17,h[10]),ae=p(ae,ue,te,H,we,22,h[11]),H=p(H,ae,ue,te,ge,7,h[12]),te=p(te,H,ae,ue,ke,12,h[13]),ue=p(ue,te,H,ae,z,17,h[14]),ae=p(ae,ue,te,H,ie,22,h[15]),H=v(H,ae,ue,te,U,5,h[16]),te=v(te,H,ae,ue,_,9,h[17]),ue=v(ue,te,H,ae,we,14,h[18]),ae=v(ae,ue,te,H,J,20,h[19]),H=v(H,ae,ue,te,Z,5,h[20]),te=v(te,H,ae,ue,de,9,h[21]),ue=v(ue,te,H,ae,ie,14,h[22]),ae=v(ae,ue,te,H,ee,20,h[23]),H=v(H,ae,ue,te,me,5,h[24]),te=v(te,H,ae,ue,z,9,h[25]),ue=v(ue,te,H,ae,T,14,h[26]),ae=v(ae,ue,te,H,re,20,h[27]),H=v(H,ae,ue,te,ke,5,h[28]),te=v(te,H,ae,ue,j,9,h[29]),ue=v(ue,te,H,ae,X,14,h[30]),ae=v(ae,ue,te,H,ge,20,h[31]),H=I(H,ae,ue,te,Z,4,h[32]),te=I(te,H,ae,ue,re,11,h[33]),ue=I(ue,te,H,ae,we,16,h[34]),ae=I(ae,ue,te,H,z,23,h[35]),H=I(H,ae,ue,te,U,4,h[36]),te=I(te,H,ae,ue,ee,11,h[37]),ue=I(ue,te,H,ae,X,16,h[38]),ae=I(ae,ue,te,H,de,23,h[39]),H=I(H,ae,ue,te,ke,4,h[40]),te=I(te,H,ae,ue,J,11,h[41]),ue=I(ue,te,H,ae,T,16,h[42]),ae=I(ae,ue,te,H,_,23,h[43]),H=I(H,ae,ue,te,me,4,h[44]),te=I(te,H,ae,ue,ge,11,h[45]),ue=I(ue,te,H,ae,ie,16,h[46]),ae=I(ae,ue,te,H,j,23,h[47]),H=x(H,ae,ue,te,J,6,h[48]),te=x(te,H,ae,ue,X,10,h[49]),ue=x(ue,te,H,ae,z,15,h[50]),ae=x(ae,ue,te,H,Z,21,h[51]),H=x(H,ae,ue,te,ge,6,h[52]),te=x(te,H,ae,ue,T,10,h[53]),ue=x(ue,te,H,ae,de,15,h[54]),ae=x(ae,ue,te,H,U,21,h[55]),H=x(H,ae,ue,te,re,6,h[56]),te=x(te,H,ae,ue,ie,10,h[57]),ue=x(ue,te,H,ae,_,15,h[58]),ae=x(ae,ue,te,H,ke,21,h[59]),H=x(H,ae,ue,te,ee,6,h[60]),te=x(te,H,ae,ue,we,10,h[61]),ue=x(ue,te,H,ae,j,15,h[62]),ae=x(ae,ue,te,H,me,21,h[63]),$[0]=$[0]+H|0,$[1]=$[1]+ae|0,$[2]=$[2]+ue|0,$[3]=$[3]+te|0},_doFinalize:function(){var S=this._data,W=S.words,B=this._nDataBytes*8,Q=S.sigBytes*8;W[Q>>>5]|=128<<24-Q%32;var G=d.floor(B/4294967296),$=B;W[(Q+64>>>9<<4)+15]=(G<<8|G>>>24)&16711935|(G<<24|G>>>8)&4278255360,W[(Q+64>>>9<<4)+14]=($<<8|$>>>24)&16711935|($<<24|$>>>8)&4278255360,S.sigBytes=(W.length+1)*4,this._process();for(var J=this._hash,U=J.words,j=0;j<4;j++){var T=U[j];U[j]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360}return J},clone:function(){var S=E.clone.call(this);return S._hash=this._hash.clone(),S}});function p(S,W,B,Q,G,$,J){var U=S+(W&B|~W&Q)+G+J;return(U<<$|U>>>32-$)+W}function v(S,W,B,Q,G,$,J){var U=S+(W&Q|B&~Q)+G+J;return(U<<$|U>>>32-$)+W}function I(S,W,B,Q,G,$,J){var U=S+(W^B^Q)+G+J;return(U<<$|U>>>32-$)+W}function x(S,W,B,Q,G,$,J){var U=S+(B^(W|~Q))+G+J;return(U<<$|U>>>32-$)+W}F.MD5=E._createHelper(b),F.HmacMD5=E._createHmacHelper(b)}(Math),y.MD5})},e7zE:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("3y9D"),N("WYAk"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.Base,D=F.WordArray,E=d.algo,g=E.SHA1,h=E.HMAC,b=E.PBKDF2=M.extend({cfg:M.extend({keySize:128/32,hasher:g,iterations:1}),init:function(p){this.cfg=this.cfg.extend(p)},compute:function(p,v){for(var I=this.cfg,x=h.create(I.hasher,p),S=D.create(),W=D.create([1]),B=S.words,Q=W.words,G=I.keySize,$=I.iterations;B.length<G;){var J=x.update(v).finalize(W);x.reset();for(var U=J.words,j=U.length,T=J,ee=1;ee<$;ee++){T=x.finalize(T),x.reset();for(var Z=T.words,_=0;_<j;_++)U[_]^=Z[_]}S.concat(J),Q[0]++}return S.sigBytes=G*4,S}});d.PBKDF2=function(p,v,I){return b.create(I).compute(p,v)}}(),y.PBKDF2})},"gb/T":function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.mode.ECB=function(){var d=y.lib.BlockCipherMode.extend();return d.Encryptor=d.extend({processBlock:function(F,M){this._cipher.encryptBlock(F,M)}}),d.Decryptor=d.extend({processBlock:function(F,M){this._cipher.decryptBlock(F,M)}}),d}(),y.mode.ECB})},gctT:function(l,V,N){"use strict";N.r(V);var y={};N.r(y),N.d(y,"drawContour",function(){return ie}),N.d(y,"drawDetections",function(){return Ve}),N.d(y,"drawFaceExpressions",function(){return Di}),N.d(y,"DrawBoxOptions",function(){return Va}),N.d(y,"DrawBox",function(){return Oi}),N.d(y,"DrawFaceLandmarksOptions",function(){return Jr}),N.d(y,"DrawFaceLandmarks",function(){return fa}),N.d(y,"drawFaceLandmarks",function(){return ki}),N.d(y,"AnchorPosition",function(){return ln}),N.d(y,"DrawTextFieldOptions",function(){return Mo}),N.d(y,"DrawTextField",function(){return Ai});var d=N("2qtc"),F=N("kLXV"),M=N("14J3"),D=N("BMrR"),E=N("jCWc"),g=N("kPKH"),h=N("+L6B"),b=N("2/Rp"),p=N("miYZ"),v=N("tsqr"),I=N("k1fw"),x=N("9og8"),S=N("tJVT"),W=N("PpiC"),B=N("FJo9"),Q=N("L41K"),G=N("aHsQ"),$=N("sGsY"),J=N("WmNS"),U=N.n(J),j=N("q1tI"),T=N.n(j),ee=N("Ty5D"),Z=N("9kvl"),_=N("yPBj"),X=N.n(_),re=N("1vsH"),me=N("V0Rq"),de=N("D1Df"),we=N.n(de),ge=N("T2oS"),ke=N("W9HT"),z=N("Re/O");function ie(O,w,A){if(A===void 0&&(A=!1),O.beginPath(),w.slice(1).forEach(function(oe,ve){var he=oe.x,_e=oe.y,Re=w[ve];O.moveTo(Re.x,Re.y),O.lineTo(he,_e)}),A){var P=w[w.length-1],K=w[0];if(!P||!K)return;O.moveTo(P.x,P.y),O.lineTo(K.x,K.y)}O.stroke()}var H=N("mrSG"),ae=function(){function O(w,A){if(!Ge(w)||!Ge(A))throw new Error("Dimensions.constructor - expected width and height to be valid numbers, instead have "+JSON.stringify({width:w,height:A}));this._width=w,this._height=A}return Object.defineProperty(O.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),O.prototype.reverse=function(){return new O(1/this.width,1/this.height)},O}();function ue(O,w){return O instanceof z.a&&O.shape.length===w}function te(O){return ue(O,1)}function Se(O){return ue(O,2)}function De(O){return ue(O,3)}function Fe(O){return ue(O,4)}function Ke(O){return O%1!==0}function et(O){return O%2===0}function Ie(O,w){w===void 0&&(w=2);var A=Math.pow(10,w);return Math.floor(O*A)/A}function dt(O){return O&&O.width&&O.height}function Ye(O,w){var A=O.width,P=O.height,K=w/Math.max(P,A);return new ae(Math.round(A*K),Math.round(P*K))}function Pe(O){return O.reduce(function(w,A){return w.add(A)},new be(0,0)).div(new be(O.length,O.length))}function Le(O,w,A){return Array(O).fill(0).map(function(P,K){return w+K*A})}function Ge(O){return!!O&&O!==Infinity&&O!==-Infinity&&!isNaN(O)||O===0}function ot(O){return Ge(O)&&0<=O&&O<=1}var be=function(){function O(w,A){this._x=w,this._y=A}return Object.defineProperty(O.prototype,"x",{get:function(){return this._x},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"y",{get:function(){return this._y},enumerable:!0,configurable:!0}),O.prototype.add=function(w){return new O(this.x+w.x,this.y+w.y)},O.prototype.sub=function(w){return new O(this.x-w.x,this.y-w.y)},O.prototype.mul=function(w){return new O(this.x*w.x,this.y*w.y)},O.prototype.div=function(w){return new O(this.x/w.x,this.y/w.y)},O.prototype.abs=function(){return new O(Math.abs(this.x),Math.abs(this.y))},O.prototype.magnitude=function(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))},O.prototype.floor=function(){return new O(Math.floor(this.x),Math.floor(this.y))},O}(),ye=function(){function O(w,A){A===void 0&&(A=!0);var P=w||{},K=[P.left,P.top,P.right,P.bottom].every(Ge),oe=[P.x,P.y,P.width,P.height].every(Ge);if(!oe&&!K)throw new Error("Box.constructor - expected box to be IBoundingBox | IRect, instead have "+JSON.stringify(P));var ve=oe?[P.x,P.y,P.width,P.height]:[P.left,P.top,P.right-P.left,P.bottom-P.top],he=ve[0],_e=ve[1],Re=ve[2],Ne=ve[3];O.assertIsValidBox({x:he,y:_e,width:Re,height:Ne},"Box.constructor",A),this._x=he,this._y=_e,this._width=Re,this._height=Ne}return O.isRect=function(w){return!!w&&[w.x,w.y,w.width,w.height].every(Ge)},O.assertIsValidBox=function(w,A,P){if(P===void 0&&(P=!1),!O.isRect(w))throw new Error(A+" - invalid box: "+JSON.stringify(w)+", expected object with properties x, y, width, height");if(!P&&(w.width<0||w.height<0))throw new Error(A+" - width ("+w.width+") and height ("+w.height+") must be positive numbers")},Object.defineProperty(O.prototype,"x",{get:function(){return this._x},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"y",{get:function(){return this._y},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"left",{get:function(){return this.x},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"top",{get:function(){return this.y},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"right",{get:function(){return this.x+this.width},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"area",{get:function(){return this.width*this.height},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"topLeft",{get:function(){return new be(this.left,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"topRight",{get:function(){return new be(this.right,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"bottomLeft",{get:function(){return new be(this.left,this.bottom)},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"bottomRight",{get:function(){return new be(this.right,this.bottom)},enumerable:!0,configurable:!0}),O.prototype.round=function(){var w=[this.x,this.y,this.width,this.height].map(function(ve){return Math.round(ve)}),A=w[0],P=w[1],K=w[2],oe=w[3];return new O({x:A,y:P,width:K,height:oe})},O.prototype.floor=function(){var w=[this.x,this.y,this.width,this.height].map(function(ve){return Math.floor(ve)}),A=w[0],P=w[1],K=w[2],oe=w[3];return new O({x:A,y:P,width:K,height:oe})},O.prototype.toSquare=function(){var w=this,A=w.x,P=w.y,K=w.width,oe=w.height,ve=Math.abs(K-oe);return K<oe&&(A-=ve/2,K+=ve),oe<K&&(P-=ve/2,oe+=ve),new O({x:A,y:P,width:K,height:oe})},O.prototype.rescale=function(w){var A=dt(w)?w.width:w,P=dt(w)?w.height:w;return new O({x:this.x*A,y:this.y*P,width:this.width*A,height:this.height*P})},O.prototype.pad=function(w,A){var P=[this.x-w/2,this.y-A/2,this.width+w,this.height+A],K=P[0],oe=P[1],ve=P[2],he=P[3];return new O({x:K,y:oe,width:ve,height:he})},O.prototype.clipAtImageBorders=function(w,A){var P=this,K=P.x,oe=P.y,ve=P.right,he=P.bottom,_e=Math.max(K,0),Re=Math.max(oe,0),Ne=ve-_e,Ue=he-Re,ze=Math.min(Ne,w-_e),qe=Math.min(Ue,A-Re);return new O({x:_e,y:Re,width:ze,height:qe}).floor()},O.prototype.shift=function(w,A){var P=this,K=P.width,oe=P.height,ve=this.x+w,he=this.y+A;return new O({x:ve,y:he,width:K,height:oe})},O.prototype.padAtBorders=function(w,A){var P=this.width+1,K=this.height+1,oe=1,ve=1,he=P,_e=K,Re=this.left,Ne=this.top,Ue=this.right,ze=this.bottom;return Ue>A&&(he=-Ue+A+P,Ue=A),ze>w&&(_e=-ze+w+K,ze=w),Re<1&&(_e=2-Re,Re=1),Ne<1&&(_e=2-Ne,Ne=1),{dy:ve,edy:_e,dx:oe,edx:he,y:Ne,ey:ze,x:Re,ex:Ue,w:P,h:K}},O.prototype.calibrate=function(w){return new O({left:this.left+w.left*this.width,top:this.top+w.top*this.height,right:this.right+w.right*this.width,bottom:this.bottom+w.bottom*this.height}).toSquare().round()},O}(),$e=function(O){Object(H.c)(w,O);function w(A,P,K,oe,ve){return ve===void 0&&(ve=!1),O.call(this,{left:A,top:P,right:K,bottom:oe},ve)||this}return w}(ye),q=function(){function O(w,A,P,K,oe){this._imageDims=new ae(oe.width,oe.height),this._score=w,this._classScore=A,this._className=P,this._box=new ye(K).rescale(this._imageDims)}return Object.defineProperty(O.prototype,"score",{get:function(){return this._score},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"classScore",{get:function(){return this._classScore},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"className",{get:function(){return this._className},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"box",{get:function(){return this._box},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"imageDims",{get:function(){return this._imageDims},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"imageWidth",{get:function(){return this.imageDims.width},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"imageHeight",{get:function(){return this.imageDims.height},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"relativeBox",{get:function(){return new ye(this._box).rescale(this.imageDims.reverse())},enumerable:!0,configurable:!0}),O.prototype.forSize=function(w,A){return new O(this.score,this.classScore,this.className,this.relativeBox,{width:w,height:A})},O}(),m=function(O){Object(H.c)(w,O);function w(A,P,K){return O.call(this,A,A,"",P,K)||this}return w.prototype.forSize=function(A,P){var K=O.prototype.forSize.call(this,A,P),oe=K.score,ve=K.relativeBox,he=K.imageDims;return new w(oe,ve,he)},w}(q);function c(O,w,A){A===void 0&&(A=!0);var P=Math.max(0,Math.min(O.right,w.right)-Math.max(O.left,w.left)),K=Math.max(0,Math.min(O.bottom,w.bottom)-Math.max(O.top,w.top)),oe=P*K;return A?oe/(O.area+w.area-oe):oe/Math.min(O.area,w.area)}function R(O){var w=O.map(function(he){return he.x}),A=O.map(function(he){return he.y}),P=w.reduce(function(he,_e){return _e<he?_e:he},Infinity),K=A.reduce(function(he,_e){return _e<he?_e:he},Infinity),oe=w.reduce(function(he,_e){return he<_e?_e:he},0),ve=A.reduce(function(he,_e){return he<_e?_e:he},0);return new $e(P,K,oe,ve)}function fe(O,w,A,P){P===void 0&&(P=!0);for(var K=w.map(function(he,_e){return{score:he,boxIndex:_e}}).sort(function(he,_e){return he.score-_e.score}).map(function(he){return he.boxIndex}),oe=[],ve=function(){var he=K.pop();oe.push(he);for(var _e=K,Re=[],Ne=0;Ne<_e.length;Ne++){var Ue=_e[Ne],ze=O[he],qe=O[Ue];Re.push(c(ze,qe,P))}K=K.filter(function(it,bt){return Re[bt]<=A})};K.length>0;)ve();return oe}function pe(O,w){return z.L(function(){var A=w[0],P=w[1],K=w[2],oe=z.n(Object(H.e)(O.shape.slice(0,3),[1]),A),ve=z.n(Object(H.e)(O.shape.slice(0,3),[1]),P),he=z.n(Object(H.e)(O.shape.slice(0,3),[1]),K),_e=z.h([oe,ve,he],3);return z.F(O,_e)})}function Ae(O,w){return w===void 0&&(w=!1),z.L(function(){var A=O.shape.slice(1),P=A[0],K=A[1];if(P===K)return O;var oe=Math.abs(P-K),ve=Math.round(oe*(w?.5:1)),he=P>K?2:1,_e=function(qe){var it=O.shape.slice();return it[he]=qe,z.n(it,0)},Re=_e(ve),Ne=oe-Re.shape[he],Ue=w&&Ne?_e(Ne):null,ze=[Ue,O,Re].filter(function(qe){return!!qe}).map(function(qe){return qe.toFloat()});return z.h(ze,he)})}function Qe(O){for(var w=O.slice(),A=w.length-1;A>0;A--){var P=Math.floor(Math.random()*(A+1)),K=w[A];w[A]=w[P],w[P]=K}return w}function nt(O){return 1/(1+Math.exp(-O))}function st(O){return Math.log(O/(1-O))}var yt=function(O){Object(H.c)(w,O);function w(A,P,K,oe,ve){return ve===void 0&&(ve=!1),O.call(this,{x:A,y:P,width:K,height:oe},ve)||this}return w}(ye),ft=.5,_t=.43,Dt=.45,at=function(){function O(w,A,P){P===void 0&&(P=new be(0,0));var K=A.width,oe=A.height;this._imgDims=new ae(K,oe),this._shift=P,this._positions=w.map(function(ve){return ve.mul(new be(K,oe)).add(P)})}return Object.defineProperty(O.prototype,"shift",{get:function(){return new be(this._shift.x,this._shift.y)},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"imageWidth",{get:function(){return this._imgDims.width},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"imageHeight",{get:function(){return this._imgDims.height},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"positions",{get:function(){return this._positions},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"relativePositions",{get:function(){var w=this;return this._positions.map(function(A){return A.sub(w._shift).div(new be(w.imageWidth,w.imageHeight))})},enumerable:!0,configurable:!0}),O.prototype.forSize=function(w,A){return new this.constructor(this.relativePositions,{width:w,height:A})},O.prototype.shiftBy=function(w,A){return new this.constructor(this.relativePositions,this._imgDims,new be(w,A))},O.prototype.shiftByPoint=function(w){return this.shiftBy(w.x,w.y)},O.prototype.align=function(w,A){if(A===void 0&&(A={}),w){var P=w instanceof m?w.box.floor():new ye(w);return this.shiftBy(P.x,P.y).align(null,A)}var K=Object.assign({},{useDlibAlignment:!1,minBoxPadding:.2},A),oe=K.useDlibAlignment,ve=K.minBoxPadding;return oe?this.alignDlib():this.alignMinBbox(ve)},O.prototype.alignDlib=function(){var w=this.getRefPointsForAlignment(),A=w[0],P=w[1],K=w[2],oe=function(Ue){return K.sub(Ue).magnitude()},ve=(oe(A)+oe(P))/2,he=Math.floor(ve/Dt),_e=Pe(w),Re=Math.floor(Math.max(0,_e.x-ft*he)),Ne=Math.floor(Math.max(0,_e.y-_t*he));return new yt(Re,Ne,Math.min(he,this.imageWidth+Re),Math.min(he,this.imageHeight+Ne))},O.prototype.alignMinBbox=function(w){var A=R(this.positions);return A.pad(A.width*w,A.height*w)},O.prototype.getRefPointsForAlignment=function(){throw new Error("getRefPointsForAlignment not implemented by base class")},O}(),jt=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.getRefPointsForAlignment=function(){var A=this.positions;return[A[0],A[1],Pe([A[3],A[4]])]},w}(at),mr=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.getJawOutline=function(){return this.positions.slice(0,17)},w.prototype.getLeftEyeBrow=function(){return this.positions.slice(17,22)},w.prototype.getRightEyeBrow=function(){return this.positions.slice(22,27)},w.prototype.getNose=function(){return this.positions.slice(27,36)},w.prototype.getLeftEye=function(){return this.positions.slice(36,42)},w.prototype.getRightEye=function(){return this.positions.slice(42,48)},w.prototype.getMouth=function(){return this.positions.slice(48,68)},w.prototype.getRefPointsForAlignment=function(){return[this.getLeftEye(),this.getRightEye(),this.getMouth()].map(Pe)},w}(at),rr=function(){function O(w,A){this._label=w,this._distance=A}return Object.defineProperty(O.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"distance",{get:function(){return this._distance},enumerable:!0,configurable:!0}),O.prototype.toString=function(w){return w===void 0&&(w=!0),""+this.label+(w?" ("+Ie(this.distance)+")":"")},O}(),Sr=function(O){Object(H.c)(w,O);function w(A,P){var K=O.call(this,A)||this;return K._label=P,K}return w.assertIsValidLabeledBox=function(A,P){if(ye.assertIsValidBox(A,P),!Ge(A.label))throw new Error(P+" - expected property label ("+A.label+") to be a number")},Object.defineProperty(w.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),w}(ye),Fr=function(){function O(w,A){if(!(typeof w=="string"))throw new Error("LabeledFaceDescriptors - constructor expected label to be a string");if(!Array.isArray(A)||A.some(function(P){return!(P instanceof Float32Array)}))throw new Error("LabeledFaceDescriptors - constructor expected descriptors to be an array of Float32Array");this._label=w,this._descriptors=A}return Object.defineProperty(O.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"descriptors",{get:function(){return this._descriptors},enumerable:!0,configurable:!0}),O.prototype.toJSON=function(){return{label:this.label,descriptors:this.descriptors.map(function(w){return Array.from(w)})}},O.fromJSON=function(w){var A=w.descriptors.map(function(P){return new Float32Array(P)});return new O(w.label,A)},O}(),Nr=function(O){Object(H.c)(w,O);function w(A,P,K,oe){var ve=O.call(this,A,P)||this;return ve._score=K,ve._classScore=oe,ve}return w.assertIsValidPredictedBox=function(A,P){if(Sr.assertIsValidLabeledBox(A,P),!ot(A.score)||!ot(A.classScore))throw new Error(P+" - expected properties score ("+A.score+") and ("+A.classScore+") to be a number between [0, 1]")},Object.defineProperty(w.prototype,"score",{get:function(){return this._score},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"classScore",{get:function(){return this._classScore},enumerable:!0,configurable:!0}),w}(Sr);function Ar(O){return O.detection instanceof m}function tt(O,w){var A={detection:w};return Object.assign({},O,A)}function Vn(){var O=window.fetch||function(){throw new Error("fetch - missing fetch implementation for browser environment")},w=function(){throw new Error("readFile - filesystem not available for browser environment")};return{Canvas:HTMLCanvasElement,CanvasRenderingContext2D,Image:HTMLImageElement,ImageData,Video:HTMLVideoElement,createCanvasElement:function(){return document.createElement("canvas")},createImageElement:function(){return document.createElement("img")},fetch:O,readFile:w}}var Dr=N("rOjP"),ko=N("oX8U");function Xn(){return typeof window=="object"&&typeof document!="undefined"&&typeof HTMLImageElement!="undefined"&&typeof HTMLCanvasElement!="undefined"&&typeof HTMLVideoElement!="undefined"&&typeof ImageData!="undefined"&&typeof CanvasRenderingContext2D!="undefined"}var uo=N("8KZw"),Cr;function co(){if(!Cr)throw new Error("getEnv - environment is not defined, check isNodejs() and isBrowser()");return Cr}function Tn(O){Cr=O}function lo(){Xn()&&Tn(Vn()),Object(uo.a)()&&Tn(Object(ko.a)())}function nr(O){if(Cr||lo(),!Cr)throw new Error("monkeyPatch - environment is not defined, check isNodejs() and isBrowser()");var w=O.Canvas,A=w===void 0?Cr.Canvas:w,P=O.Image,K=P===void 0?Cr.Image:P;Cr.Canvas=A,Cr.Image=K,Cr.createCanvasElement=O.createCanvasElement||function(){return new A},Cr.createImageElement=O.createImageElement||function(){return new K},Cr.ImageData=O.ImageData||Cr.ImageData,Cr.Video=O.Video||Cr.Video,Cr.fetch=O.fetch||Cr.fetch,Cr.readFile=O.readFile||Cr.readFile}var pr={getEnv:co,setEnv:Tn,initialize:lo,createBrowserEnv:Vn,createFileSystem:Dr.a,createNodejsEnv:ko.a,monkeyPatch:nr,isBrowser:Xn,isNodejs:uo.a};lo();function cr(O){return!pr.isNodejs()&&typeof O=="string"?document.getElementById(O):O}function rn(O){var w=pr.getEnv(),A=w.Canvas,P=w.CanvasRenderingContext2D;if(O instanceof P)return O;var K=cr(O);if(!(K instanceof A))throw new Error("resolveContext2d - expected canvas to be of instance of Canvas");var oe=K.getContext("2d");if(!oe)throw new Error("resolveContext2d - canvas 2d context is null");return oe}var ln;(function(O){O.TOP_LEFT="TOP_LEFT",O.TOP_RIGHT="TOP_RIGHT",O.BOTTOM_LEFT="BOTTOM_LEFT",O.BOTTOM_RIGHT="BOTTOM_RIGHT"})(ln||(ln={}));var Mo=function(){function O(w){w===void 0&&(w={});var A=w.anchorPosition,P=w.backgroundColor,K=w.fontColor,oe=w.fontSize,ve=w.fontStyle,he=w.padding;this.anchorPosition=A||ln.TOP_LEFT,this.backgroundColor=P||"rgba(0, 0, 0, 0.5)",this.fontColor=K||"rgba(255, 255, 255, 1)",this.fontSize=oe||14,this.fontStyle=ve||"Georgia",this.padding=he||4}return O}(),Ai=function(){function O(w,A,P){P===void 0&&(P={}),this.text=typeof w=="string"?[w]:w instanceof O?w.text:w,this.anchor=A,this.options=new Mo(P)}return O.prototype.measureWidth=function(w){var A=this.options.padding;return this.text.map(function(P){return w.measureText(P).width}).reduce(function(P,K){return P<K?K:P},0)+2*A},O.prototype.measureHeight=function(){var w=this.options,A=w.fontSize,P=w.padding;return this.text.length*A+2*P},O.prototype.getUpperLeft=function(w,A){var P=this.options.anchorPosition,K=P===ln.BOTTOM_RIGHT||P===ln.TOP_RIGHT,oe=P===ln.BOTTOM_LEFT||P===ln.BOTTOM_RIGHT,ve=this.measureWidth(w),he=this.measureHeight(),_e=K?this.anchor.x-ve:this.anchor.x,Re=oe?this.anchor.y-he:this.anchor.y;if(A){var Ne=A.width,Ue=A.height,ze=Math.max(Math.min(_e,Ne-ve),0),qe=Math.max(Math.min(Re,Ue-he),0);return{x:ze,y:qe}}return{x:_e,y:Re}},O.prototype.draw=function(w){var A=cr(w),P=rn(A),K=this.options,oe=K.backgroundColor,ve=K.fontColor,he=K.fontSize,_e=K.fontStyle,Re=K.padding;P.font=he+"px "+_e;var Ne=this.measureWidth(P),Ue=this.measureHeight();P.fillStyle=oe;var ze=this.getUpperLeft(P,A);P.fillRect(ze.x,ze.y,Ne,Ue),P.fillStyle=ve,this.text.forEach(function(qe,it){var bt=Re+ze.x,Et=Re+ze.y+(it+1)*he;P.fillText(qe,bt,Et)})},O}(),Va=function(){function O(w){w===void 0&&(w={});var A=w.boxColor,P=w.lineWidth,K=w.label,oe=w.drawLabelOptions;this.boxColor=A||"rgba(0, 0, 255, 1)",this.lineWidth=P||2,this.label=K;var ve={anchorPosition:ln.BOTTOM_LEFT,backgroundColor:this.boxColor};this.drawLabelOptions=new Mo(Object.assign({},ve,oe))}return O}(),Oi=function(){function O(w,A){A===void 0&&(A={}),this.box=new ye(w),this.options=new Va(A)}return O.prototype.draw=function(w){var A=rn(w),P=this.options,K=P.boxColor,oe=P.lineWidth,ve=this.box,he=ve.x,_e=ve.y,Re=ve.width,Ne=ve.height;A.strokeStyle=K,A.lineWidth=oe,A.strokeRect(he,_e,Re,Ne);var Ue=this.options.label;Ue&&new Ai([Ue],{x:he-oe/2,y:_e},this.options.drawLabelOptions).draw(w)},O}();function Ve(O,w){var A=Array.isArray(w)?w:[w];A.forEach(function(P){var K=P instanceof m?P.score:Ar(P)?P.detection.score:void 0,oe=P instanceof m?P.box:Ar(P)?P.detection.box:new ye(P),ve=K?""+Ie(K):void 0;new Oi(oe,{label:ve}).draw(O)})}function Xa(O){var w=pr.getEnv(),A=w.Image,P=w.Video;return O instanceof A&&O.complete||O instanceof P&&O.readyState>=3}function Sn(O){return new Promise(function(w,A){if(O instanceof pr.getEnv().Canvas||Xa(O))return w();function P(oe){if(!oe.currentTarget)return;oe.currentTarget.removeEventListener("load",P),oe.currentTarget.removeEventListener("error",K),w(oe)}function K(oe){if(!oe.currentTarget)return;oe.currentTarget.removeEventListener("load",P),oe.currentTarget.removeEventListener("error",K),A(oe)}O.addEventListener("load",P),O.addEventListener("error",K)})}function Po(O){return new Promise(function(w,A){if(!(O instanceof Blob))return A("bufferToImage - expected buf to be of type: Blob");var P=new FileReader;P.onload=function(){if(typeof P.result!="string")return A("bufferToImage - expected reader.result to be a string, in onload");var K=pr.getEnv().createImageElement();K.onload=function(){return w(K)},K.onerror=A,K.src=P.result},P.onerror=A,P.readAsDataURL(O)})}function Wr(O){var w=pr.getEnv(),A=w.Image,P=w.Video;return O instanceof A?new ae(O.naturalWidth,O.naturalHeight):O instanceof P?new ae(O.videoWidth,O.videoHeight):new ae(O.width,O.height)}function Hr(O){var w=O.width,A=O.height,P=pr.getEnv().createCanvasElement,K=P();return K.width=w,K.height=A,K}function An(O,w){var A=pr.getEnv().ImageData;if(!(O instanceof A)&&!Xa(O))throw new Error("createCanvasFromMedia - media has not finished loading yet");var P=w||Wr(O),K=P.width,oe=P.height,ve=Hr({width:K,height:oe});return O instanceof A?rn(ve).putImageData(O,0,0):rn(ve).drawImage(O,0,0,K,oe),ve}function Ka(O,w){return Object(H.b)(this,void 0,void 0,function(){var A,P,K,oe,ve,he;return Object(H.d)(this,function(_e){switch(_e.label){case 0:return A=w||pr.getEnv().createCanvasElement(),P=O.shape.slice(Fe(O)?1:0),K=P[0],oe=P[1],ve=P[2],he=z.L(function(){return O.as3D(K,oe,ve).toInt()}),[4,z.f.toPixels(he,A)];case 1:return _e.sent(),he.dispose(),[2,A]}})})}function Ya(O){var w=pr.getEnv(),A=w.Image,P=w.Canvas,K=w.Video;return O instanceof A||O instanceof P||O instanceof K}function gn(O,w,A){A===void 0&&(A=!1);var P=pr.getEnv(),K=P.Image,oe=P.Canvas;if(!(O instanceof K||O instanceof oe))throw new Error("imageToSquare - expected arg0 to be HTMLImageElement | HTMLCanvasElement");var ve=Wr(O),he=w/Math.max(ve.height,ve.width),_e=he*ve.width,Re=he*ve.height,Ne=Hr({width:w,height:w}),Ue=O instanceof oe?O:An(O),ze=Math.abs(_e-Re)/2,qe=A&&_e<Re?ze:0,it=A&&Re<_e?ze:0;return rn(Ne).drawImage(Ue,qe,it,_e,Re),Ne}var Kn=function(){function O(w,A){var P=this;if(A===void 0&&(A=!1),this._imageTensors=[],this._canvases=[],this._treatAsBatchInput=!1,this._inputDimensions=[],!Array.isArray(w))throw new Error("NetInput.constructor - expected inputs to be an Array of TResolvedNetInput or to be instanceof tf.Tensor4D, instead have "+w);this._treatAsBatchInput=A,this._batchSize=w.length,w.forEach(function(K,oe){if(De(K)){P._imageTensors[oe]=K,P._inputDimensions[oe]=K.shape;return}if(Fe(K)){var ve=K.shape[0];if(ve!==1)throw new Error("NetInput - tf.Tensor4D with batchSize "+ve+" passed, but not supported in input array");P._imageTensors[oe]=K,P._inputDimensions[oe]=K.shape.slice(1);return}var he=K instanceof pr.getEnv().Canvas?K:An(K);P._canvases[oe]=he,P._inputDimensions[oe]=[he.height,he.width,3]})}return Object.defineProperty(O.prototype,"imageTensors",{get:function(){return this._imageTensors},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"canvases",{get:function(){return this._canvases},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"isBatchInput",{get:function(){return this.batchSize>1||this._treatAsBatchInput},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"batchSize",{get:function(){return this._batchSize},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"inputDimensions",{get:function(){return this._inputDimensions},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"inputSize",{get:function(){return this._inputSize},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"reshapedInputDimensions",{get:function(){var w=this;return Le(this.batchSize,0,1).map(function(A,P){return w.getReshapedInputDimensions(P)})},enumerable:!0,configurable:!0}),O.prototype.getInput=function(w){return this.canvases[w]||this.imageTensors[w]},O.prototype.getInputDimensions=function(w){return this._inputDimensions[w]},O.prototype.getInputHeight=function(w){return this._inputDimensions[w][0]},O.prototype.getInputWidth=function(w){return this._inputDimensions[w][1]},O.prototype.getReshapedInputDimensions=function(w){if(typeof this.inputSize!="number")throw new Error("getReshapedInputDimensions - inputSize not set, toBatchTensor has not been called yet");var A=this.getInputWidth(w),P=this.getInputHeight(w);return Ye({width:A,height:P},this.inputSize)},O.prototype.toBatchTensor=function(w,A){var P=this;return A===void 0&&(A=!0),this._inputSize=w,z.L(function(){var K=Le(P.batchSize,0,1).map(function(ve){var he=P.getInput(ve);if(he instanceof z.a){var _e=Fe(he)?he:he.expandDims();return _e=Ae(_e,A),(_e.shape[1]!==w||_e.shape[2]!==w)&&(_e=z.o.resizeBilinear(_e,[w,w])),_e.as3D(w,w,3)}if(he instanceof pr.getEnv().Canvas)return z.f.fromPixels(gn(he,w,A));throw new Error("toBatchTensor - at batchIdx "+ve+", expected input to be instanceof tf.Tensor or instanceof HTMLCanvasElement, instead have "+he)}),oe=z.E(K.map(function(ve){return ve.toFloat()})).as4D(P.batchSize,w,w,3);return oe})},O}();function Or(O){return Object(H.b)(this,void 0,void 0,function(){var w,A,P;return Object(H.d)(this,function(K){switch(K.label){case 0:if(O instanceof Kn)return[2,O];if(w=Array.isArray(O)?O:[O],!w.length)throw new Error("toNetInput - empty array passed as input");return A=function(oe){return Array.isArray(O)?" at input index "+oe+":":""},P=w.map(cr),P.forEach(function(oe,ve){if(!Ya(oe)&&!De(oe)&&!Fe(oe))throw typeof w[ve]=="string"?new Error("toNetInput -"+A(ve)+" string passed, but could not resolve HTMLElement for element id "+w[ve]):new Error("toNetInput -"+A(ve)+" expected media to be of type HTMLImageElement | HTMLVideoElement | HTMLCanvasElement | tf.Tensor3D, or to be an element id");if(Fe(oe)){var he=oe.shape[0];if(he!==1)throw new Error("toNetInput -"+A(ve)+" tf.Tensor4D with batchSize "+he+" passed, but not supported in input array")}}),[4,Promise.all(P.map(function(oe){return Ya(oe)&&Sn(oe)}))];case 1:return K.sent(),[2,new Kn(P,Array.isArray(O))]}})})}function Yn(O,w){return Object(H.b)(this,void 0,void 0,function(){var A,P,K,oe,ve,he,_e;return Object(H.d)(this,function(Re){switch(Re.label){case 0:return A=pr.getEnv().Canvas,P=O,O instanceof A?[3,5]:[4,Or(O)];case 1:if(K=Re.sent(),K.batchSize>1)throw new Error("extractFaces - batchSize > 1 not supported");return oe=K.getInput(0),oe instanceof A?(ve=oe,[3,4]):[3,2];case 2:return[4,Ka(oe)];case 3:ve=Re.sent(),Re.label=4;case 4:P=ve,Re.label=5;case 5:return he=rn(P),_e=w.map(function(Ne){return Ne instanceof m?Ne.forSize(P.width,P.height).box.floor():Ne}).map(function(Ne){return Ne.clipAtImageBorders(P.width,P.height)}),[2,_e.map(function(Ne){var Ue=Ne.x,ze=Ne.y,qe=Ne.width,it=Ne.height,bt=Hr({width:qe,height:it});return rn(bt).putImageData(he.getImageData(Ue,ze,qe,it),0,0),bt})]}})})}function Fo(O,w){return Object(H.b)(this,void 0,void 0,function(){return Object(H.d)(this,function(A){if(!De(O)&&!Fe(O))throw new Error("extractFaceTensors - expected image tensor to be 3D or 4D");if(Fe(O)&&O.shape[0]>1)throw new Error("extractFaceTensors - batchSize > 1 not supported");return[2,z.L(function(){var P=O.shape.slice(Fe(O)?1:0),K=P[0],oe=P[1],ve=P[2],he=w.map(function(Re){return Re instanceof m?Re.forSize(oe,K).box:Re}).map(function(Re){return Re.clipAtImageBorders(oe,K)}),_e=he.map(function(Re){var Ne=Re.x,Ue=Re.y,ze=Re.width,qe=Re.height;return z.C(O.as3D(K,oe,ve),[Ue,Ne,0],[qe,ze,ve])});return _e})]})})}function St(O,w){return Object(H.b)(this,void 0,void 0,function(){var A,P;return Object(H.d)(this,function(K){switch(K.label){case 0:return A=pr.getEnv().fetch,[4,A(O,w)];case 1:if(P=K.sent(),!(P.status<400))throw new Error("failed to fetch: ("+P.status+") "+P.statusText+", from url: "+P.url);return[2,P]}})})}function qu(O){return Object(H.b)(this,void 0,void 0,function(){var w,A;return Object(H.d)(this,function(P){switch(P.label){case 0:return[4,St(O)];case 1:return w=P.sent(),[4,w.blob()];case 2:if(A=P.sent(),!A.type.startsWith("image/"))throw new Error("fetchImage - expected blob type to be of type image/*, instead have: "+A.type+", for url: "+w.url);return[2,Po(A)]}})})}function ws(O){return Object(H.b)(this,void 0,void 0,function(){return Object(H.d)(this,function(w){switch(w.label){case 0:return[4,St(O)];case 1:return[2,w.sent().json()]}})})}function Es(O){return Object(H.b)(this,void 0,void 0,function(){var w;return Object(H.d)(this,function(A){switch(A.label){case 0:return w=Float32Array.bind,[4,St(O)];case 1:return[4,A.sent().arrayBuffer()];case 2:return[2,new(w.apply(Float32Array,[void 0,A.sent()]))]}})})}function $a(O,w){var A=w+"-weights_manifest.json";if(!O)return{modelBaseUri:"",manifestUri:A};if(O==="/")return{modelBaseUri:"/",manifestUri:"/"+A};var P=O.startsWith("http://")?"http://":O.startsWith("https://")?"https://":"";O=O.replace(P,"");var K=O.split("/").filter(function(he){return he}),oe=O.endsWith(".json")?K[K.length-1]:A,ve=P+(O.endsWith(".json")?K.slice(0,K.length-1):K).join("/");return ve=O.startsWith("/")?"/"+ve:ve,{modelBaseUri:ve,manifestUri:ve==="/"?"/"+oe:ve+"/"+oe}}function Lo(O,w){return Object(H.b)(this,void 0,void 0,function(){var A,P,K,oe;return Object(H.d)(this,function(ve){switch(ve.label){case 0:return A=$a(O,w),P=A.manifestUri,K=A.modelBaseUri,[4,ws(P)];case 1:return oe=ve.sent(),[2,z.p.loadWeights(oe,K)]}})})}function _s(O,w,A){A===void 0&&(A=!1);var P=A?Wr(w):w,K=P.width,oe=P.height;return O.width=K,O.height=oe,{width:K,height:oe}}var yn=function(){function O(w){this._name=w,this._params=void 0,this._paramMappings=[]}return Object.defineProperty(O.prototype,"params",{get:function(){return this._params},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"paramMappings",{get:function(){return this._paramMappings},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"isLoaded",{get:function(){return!!this.params},enumerable:!0,configurable:!0}),O.prototype.getParamFromPath=function(w){var A=this.traversePropertyPath(w),P=A.obj,K=A.objProp;return P[K]},O.prototype.reassignParamFromPath=function(w,A){var P=this.traversePropertyPath(w),K=P.obj,oe=P.objProp;K[oe].dispose(),K[oe]=A},O.prototype.getParamList=function(){var w=this;return this._paramMappings.map(function(A){var P=A.paramPath;return{path:P,tensor:w.getParamFromPath(P)}})},O.prototype.getTrainableParams=function(){return this.getParamList().filter(function(w){return w.tensor instanceof z.b})},O.prototype.getFrozenParams=function(){return this.getParamList().filter(function(w){return!(w.tensor instanceof z.b)})},O.prototype.variable=function(){var w=this;this.getFrozenParams().forEach(function(A){var P=A.path,K=A.tensor;w.reassignParamFromPath(P,K.variable())})},O.prototype.freeze=function(){var w=this;this.getTrainableParams().forEach(function(A){var P=A.path,K=A.tensor,oe=z.G(K.dataSync());K.dispose(),w.reassignParamFromPath(P,oe)})},O.prototype.dispose=function(w){w===void 0&&(w=!0),this.getParamList().forEach(function(A){if(w&&A.tensor.isDisposed)throw new Error("param tensor has already been disposed for path "+A.path);A.tensor.dispose()}),this._params=void 0},O.prototype.serializeParams=function(){return new Float32Array(this.getParamList().map(function(w){var A=w.tensor;return Array.from(A.dataSync())}).reduce(function(w,A){return w.concat(A)}))},O.prototype.load=function(w){return Object(H.b)(this,void 0,void 0,function(){return Object(H.d)(this,function(A){switch(A.label){case 0:return w instanceof Float32Array?(this.extractWeights(w),[2]):[4,this.loadFromUri(w)];case 1:return A.sent(),[2]}})})},O.prototype.loadFromUri=function(w){return Object(H.b)(this,void 0,void 0,function(){var A;return Object(H.d)(this,function(P){switch(P.label){case 0:if(w&&typeof w!="string")throw new Error(this._name+".loadFromUri - expected model uri");return[4,Lo(w,this.getDefaultModelName())];case 1:return A=P.sent(),this.loadFromWeightMap(A),[2]}})})},O.prototype.loadFromDisk=function(w){return Object(H.b)(this,void 0,void 0,function(){var A,P,K,oe,ve,he,_e,Re,Ne,Ue;return Object(H.d)(this,function(ze){switch(ze.label){case 0:if(w&&typeof w!="string")throw new Error(this._name+".loadFromDisk - expected model file path");return A=pr.getEnv().readFile,P=$a(w,this.getDefaultModelName()),K=P.manifestUri,oe=P.modelBaseUri,ve=function(qe){return Promise.all(qe.map(function(it){return A(it).then(function(bt){return bt.buffer})}))},he=z.p.weightsLoaderFactory(ve),Ne=(Re=JSON).parse,[4,A(K)];case 1:return _e=Ne.apply(Re,[ze.sent().toString()]),[4,he(_e,oe)];case 2:return Ue=ze.sent(),this.loadFromWeightMap(Ue),[2]}})})},O.prototype.loadFromWeightMap=function(w){var A=this.extractParamsFromWeigthMap(w),P=A.paramMappings,K=A.params;this._paramMappings=P,this._params=K},O.prototype.extractWeights=function(w){var A=this.extractParams(w),P=A.paramMappings,K=A.params;this._paramMappings=P,this._params=K},O.prototype.traversePropertyPath=function(w){if(!this.params)throw new Error("traversePropertyPath - model has no loaded params");var A=w.split("/").reduce(function(oe,ve){if(!oe.nextObj.hasOwnProperty(ve))throw new Error("traversePropertyPath - object does not have property "+ve+", for path "+w);return{obj:oe.nextObj,objProp:ve,nextObj:oe.nextObj[ve]}},{nextObj:this.params}),P=A.obj,K=A.objProp;if(!P||!K||!(P[K]instanceof z.a))throw new Error("traversePropertyPath - parameter is not a tensor, for path "+w);return{obj:P,objProp:K}},O}();function zr(O,w,A){return z.L(function(){var P=z.z(O,w.depthwise_filter,w.pointwise_filter,A,"same");return P=z.c(P,w.bias),P})}function fo(O,w,A){return A===void 0&&(A=!1),z.L(function(){var P=z.w(A?z.c(z.i(O,w.conv0.filters,[2,2],"same"),w.conv0.bias):zr(O,w.conv0,[2,2])),K=zr(P,w.conv1,[1,1]),oe=z.w(z.c(P,K)),ve=zr(oe,w.conv2,[1,1]);return z.w(z.c(P,z.c(K,ve)))})}function oa(O,w,A,P){return A===void 0&&(A=!1),P===void 0&&(P=!0),z.L(function(){var K=z.w(A?z.c(z.i(O,w.conv0.filters,P?[2,2]:[1,1],"same"),w.conv0.bias):zr(O,w.conv0,P?[2,2]:[1,1])),oe=zr(K,w.conv1,[1,1]),ve=z.w(z.c(K,oe)),he=zr(ve,w.conv2,[1,1]),_e=z.w(z.c(K,z.c(oe,he))),Re=zr(_e,w.conv3,[1,1]);return z.w(z.c(K,z.c(oe,z.c(he,Re))))})}function on(O,w,A,P){return A===void 0&&(A="same"),P===void 0&&(P=!1),z.L(function(){var K=z.c(z.i(O,w.filters,[1,1],A),w.bias);return P?z.w(K):K})}function bn(O,w){Object.keys(O).forEach(function(A){w.some(function(P){return P.originalPath===A})||O[A].dispose()})}function $n(O,w){return function(A,P,K,oe){var ve=z.K(O(A*P*K*K),[K,K,A,P]),he=z.H(O(P));return w.push({paramPath:oe+"/filters"},{paramPath:oe+"/bias"}),{filters:ve,bias:he}}}function aa(O,w){return function(A,P,K){var oe=z.I(O(A*P),[A,P]),ve=z.H(O(P));return w.push({paramPath:K+"/weights"},{paramPath:K+"/bias"}),{weights:oe,bias:ve}}}var Ja=function(){function O(w,A,P){this.depthwise_filter=w,this.pointwise_filter=A,this.bias=P}return O}();function ia(O,w){return function(A,P,K){var oe=z.K(O(3*3*A),[3,3,A,1]),ve=z.K(O(A*P),[1,1,A,P]),he=z.H(O(P));return w.push({paramPath:K+"/depthwise_filter"},{paramPath:K+"/pointwise_filter"},{paramPath:K+"/bias"}),new Ja(oe,ve,he)}}function sa(O){return function(w){var A=O(w+"/depthwise_filter",4),P=O(w+"/pointwise_filter",4),K=O(w+"/bias",1);return new Ja(A,P,K)}}function On(O,w){return function(A,P,K){var oe=O[A];if(!ue(oe,P))throw new Error("expected weightMap["+A+"] to be a Tensor"+P+"D, instead have "+oe);return w.push({originalPath:A,paramPath:K||A}),oe}}function dn(O){var w=O;function A(K){var oe=w.slice(0,K);return w=w.slice(K),oe}function P(){return w}return{extractWeights:A,getRemainingWeights:P}}function qa(O,w){var A=$n(O,w),P=ia(O,w);function K(ve,he,_e,Re){Re===void 0&&(Re=!1);var Ne=Re?A(ve,he,3,_e+"/conv0"):P(ve,he,_e+"/conv0"),Ue=P(he,he,_e+"/conv1"),ze=P(he,he,_e+"/conv2");return{conv0:Ne,conv1:Ue,conv2:ze}}function oe(ve,he,_e,Re){Re===void 0&&(Re=!1);var Ne=K(ve,he,_e,Re),Ue=Ne.conv0,ze=Ne.conv1,qe=Ne.conv2,it=P(he,he,_e+"/conv3");return{conv0:Ue,conv1:ze,conv2:qe,conv3:it}}return{extractDenseBlock3Params:K,extractDenseBlock4Params:oe}}function Ri(O){var w=[],A=dn(O),P=A.extractWeights,K=A.getRemainingWeights,oe=qa(P,w).extractDenseBlock4Params,ve=oe(3,32,"dense0",!0),he=oe(32,64,"dense1"),_e=oe(64,128,"dense2"),Re=oe(128,256,"dense3");if(K().length!==0)throw new Error("weights remaing after extract: "+K().length);return{paramMappings:w,params:{dense0:ve,dense1:he,dense2:_e,dense3:Re}}}function Qa(O){return function(w){var A=O(w+"/filters",4),P=O(w+"/bias",1);return{filters:A,bias:P}}}function Za(O,w){var A=On(O,w),P=Qa(A),K=sa(A);function oe(he,_e){_e===void 0&&(_e=!1);var Re=_e?P(he+"/conv0"):K(he+"/conv0"),Ne=K(he+"/conv1"),Ue=K(he+"/conv2");return{conv0:Re,conv1:Ne,conv2:Ue}}function ve(he,_e){_e===void 0&&(_e=!1);var Re=_e?P(he+"/conv0"):K(he+"/conv0"),Ne=K(he+"/conv1"),Ue=K(he+"/conv2"),ze=K(he+"/conv3");return{conv0:Re,conv1:Ne,conv2:Ue,conv3:ze}}return{extractDenseBlock3Params:oe,extractDenseBlock4Params:ve}}function ua(O){var w=[],A=Za(O,w).extractDenseBlock4Params,P={dense0:A("dense0",!0),dense1:A("dense1"),dense2:A("dense2"),dense3:A("dense3")};return bn(O,w),{params:P,paramMappings:w}}var ca=function(O){Object(H.c)(w,O);function w(){return O.call(this,"FaceFeatureExtractor")||this}return w.prototype.forwardInput=function(A){var P=this.params;if(!P)throw new Error("FaceFeatureExtractor - load model before inference");return z.L(function(){var K=A.toBatchTensor(112,!0),oe=[122.782,117.001,104.298],ve=pe(K,oe).div(z.y(255)),he=oa(ve,P.dense0,!0);return he=oa(he,P.dense1),he=oa(he,P.dense2),he=oa(he,P.dense3),he=z.d(he,[7,7],[2,2],"valid"),he})},w.prototype.forward=function(A){return Object(H.b)(this,void 0,void 0,function(){var P;return Object(H.d)(this,function(K){switch(K.label){case 0:return P=this.forwardInput,[4,Or(A)];case 1:return[2,P.apply(this,[K.sent()])]}})})},w.prototype.getDefaultModelName=function(){return"face_feature_extractor_model"},w.prototype.extractParamsFromWeigthMap=function(A){return ua(A)},w.prototype.extractParams=function(A){return Ri(A)},w}(yn);function $r(O,w){return z.L(function(){return z.c(z.q(O,w.weights),w.bias)})}function Ii(O,w,A){var P=[],K=dn(O),oe=K.extractWeights,ve=K.getRemainingWeights,he=aa(oe,P),_e=he(w,A,"fc");if(ve().length!==0)throw new Error("weights remaing after extract: "+ve().length);return{paramMappings:P,params:{fc:_e}}}function Rn(O){var w=[],A=On(O,w);function P(oe){var ve=A(oe+"/weights",2),he=A(oe+"/bias",1);return{weights:ve,bias:he}}var K={fc:P("fc")};return bn(O,w),{params:K,paramMappings:w}}function ei(O){var w={},A={};return Object.keys(O).forEach(function(P){var K=P.startsWith("fc")?A:w;K[P]=O[P]}),{featureExtractorMap:w,classifierMap:A}}var ho=function(O){Object(H.c)(w,O);function w(A,P){var K=O.call(this,A)||this;return K._faceFeatureExtractor=P,K}return Object.defineProperty(w.prototype,"faceFeatureExtractor",{get:function(){return this._faceFeatureExtractor},enumerable:!0,configurable:!0}),w.prototype.runNet=function(A){var P=this,K=this.params;if(!K)throw new Error(this._name+" - load model before inference");return z.L(function(){var oe=A instanceof Kn?P.faceFeatureExtractor.forwardInput(A):A;return $r(oe.as2D(oe.shape[0],-1),K.fc)})},w.prototype.dispose=function(A){A===void 0&&(A=!0),this.faceFeatureExtractor.dispose(A),O.prototype.dispose.call(this,A)},w.prototype.loadClassifierParams=function(A){var P=this.extractClassifierParams(A),K=P.params,oe=P.paramMappings;this._params=K,this._paramMappings=oe},w.prototype.extractClassifierParams=function(A){return Ii(A,this.getClassifierChannelsIn(),this.getClassifierChannelsOut())},w.prototype.extractParamsFromWeigthMap=function(A){var P=ei(A),K=P.featureExtractorMap,oe=P.classifierMap;return this.faceFeatureExtractor.loadFromWeightMap(K),Rn(oe)},w.prototype.extractParams=function(A){var P=this.getClassifierChannelsIn(),K=this.getClassifierChannelsOut(),oe=K*P+K,ve=A.slice(0,A.length-oe),he=A.slice(A.length-oe);return this.faceFeatureExtractor.extractWeights(ve),this.extractClassifierParams(he)},w}(yn),po=["neutral","happy","sad","angry","fearful","disgusted","surprised"],mo=function(){function O(w){var A=this;if(w.length!==7)throw new Error("FaceExpressions.constructor - expected probabilities.length to be 7, have: "+w.length);po.forEach(function(P,K){A[P]=w[K]})}return O.prototype.asSortedArray=function(){var w=this;return po.map(function(A){return{expression:A,probability:w[A]}}).sort(function(A,P){return P.probability-A.probability})},O}(),Ni=function(O){Object(H.c)(w,O);function w(A){return A===void 0&&(A=new ca),O.call(this,"FaceExpressionNet",A)||this}return w.prototype.forwardInput=function(A){var P=this;return z.L(function(){return z.D(P.runNet(A))})},w.prototype.forward=function(A){return Object(H.b)(this,void 0,void 0,function(){var P;return Object(H.d)(this,function(K){switch(K.label){case 0:return P=this.forwardInput,[4,Or(A)];case 1:return[2,P.apply(this,[K.sent()])]}})})},w.prototype.predictExpressions=function(A){return Object(H.b)(this,void 0,void 0,function(){var P,K,oe,ve,he=this;return Object(H.d)(this,function(_e){switch(_e.label){case 0:return[4,Or(A)];case 1:return P=_e.sent(),[4,this.forwardInput(P)];case 2:return K=_e.sent(),[4,Promise.all(z.O(K).map(function(Re){return Object(H.b)(he,void 0,void 0,function(){var Ne;return Object(H.d)(this,function(Ue){switch(Ue.label){case 0:return[4,Re.data()];case 1:return Ne=Ue.sent(),Re.dispose(),[2,Ne]}})})}))];case 3:return oe=_e.sent(),K.dispose(),ve=oe.map(function(Re){return new mo(Re)}),[2,P.isBatchInput?ve:ve[0]]}})})},w.prototype.getDefaultModelName=function(){return"face_expression_model"},w.prototype.getClassifierChannelsIn=function(){return 256},w.prototype.getClassifierChannelsOut=function(){return 7},w}(ho);function la(O){return O.expressions instanceof mo}function vo(O,w){var A={expressions:w};return Object.assign({},O,A)}function Di(O,w,A,P){A===void 0&&(A=.1);var K=Array.isArray(w)?w:[w];K.forEach(function(oe){var ve=oe instanceof mo?oe:la(oe)?oe.expressions:void 0;if(!ve)throw new Error("drawFaceExpressions - expected faceExpressions to be FaceExpressions | WithFaceExpressions<{}> or array thereof");var he=ve.asSortedArray(),_e=he.filter(function(Ue){return Ue.probability>A}),Re=Ar(oe)?oe.detection.box.bottomLeft:P||new be(0,0),Ne=new Ai(_e.map(function(Ue){return Ue.expression+" ("+Ie(Ue.probability)+")"}),Re);Ne.draw(O)})}function da(O){return Ar(O)&&O.landmarks instanceof at&&O.unshiftedLandmarks instanceof at&&O.alignedRect instanceof m}function jo(O,w){var A=O.detection.box,P=w.shiftBy(A.x,A.y),K=P.align(),oe=O.detection.imageDims,ve=new m(O.detection.score,K.rescale(oe.reverse()),oe),he={landmarks:P,unshiftedLandmarks:w,alignedRect:ve};return Object.assign({},O,he)}var Jr=function(){function O(w){w===void 0&&(w={});var A=w.drawLines,P=A===void 0?!0:A,K=w.drawPoints,oe=K===void 0?!0:K,ve=w.lineWidth,he=w.lineColor,_e=w.pointSize,Re=w.pointColor;this.drawLines=P,this.drawPoints=oe,this.lineWidth=ve||1,this.pointSize=_e||2,this.lineColor=he||"rgba(0, 255, 255, 1)",this.pointColor=Re||"rgba(255, 0, 255, 1)"}return O}(),fa=function(){function O(w,A){A===void 0&&(A={}),this.faceLandmarks=w,this.options=new Jr(A)}return O.prototype.draw=function(w){var A=rn(w),P=this.options,K=P.drawLines,oe=P.drawPoints,ve=P.lineWidth,he=P.lineColor,_e=P.pointSize,Re=P.pointColor;if(K&&this.faceLandmarks instanceof mr&&(A.strokeStyle=he,A.lineWidth=ve,ie(A,this.faceLandmarks.getJawOutline()),ie(A,this.faceLandmarks.getLeftEyeBrow()),ie(A,this.faceLandmarks.getRightEyeBrow()),ie(A,this.faceLandmarks.getNose()),ie(A,this.faceLandmarks.getLeftEye(),!0),ie(A,this.faceLandmarks.getRightEye(),!0),ie(A,this.faceLandmarks.getMouth(),!0)),oe){A.strokeStyle=Re,A.fillStyle=Re;var Ne=function(Ue){A.beginPath(),A.arc(Ue.x,Ue.y,_e,0,2*Math.PI),A.fill()};this.faceLandmarks.positions.forEach(Ne)}},O}();function ki(O,w){var A=Array.isArray(w)?w:[w];A.forEach(function(P){var K=P instanceof at?P:da(P)?P.landmarks:void 0;if(!K)throw new Error("drawFaceLandmarks - expected faceExpressions to be FaceLandmarks | WithFaceLandmarks<WithFaceDetection<{}>> or array thereof");new fa(K).draw(O)})}function Mi(O,w){var A=$n(O,w),P=ia(O,w);function K(ve,he,_e){var Re=P(ve,he,_e+"/separable_conv0"),Ne=P(he,he,_e+"/separable_conv1"),Ue=A(ve,he,1,_e+"/expansion_conv");return{separable_conv0:Re,separable_conv1:Ne,expansion_conv:Ue}}function oe(ve,he){var _e=P(ve,ve,he+"/separable_conv0"),Re=P(ve,ve,he+"/separable_conv1"),Ne=P(ve,ve,he+"/separable_conv2");return{separable_conv0:_e,separable_conv1:Re,separable_conv2:Ne}}return{extractConvParams:A,extractSeparableConvParams:P,extractReductionBlockParams:K,extractMainBlockParams:oe}}function ti(O,w){var A=[],P=dn(O),K=P.extractWeights,oe=P.getRemainingWeights,ve=Mi(K,A),he=ve.extractConvParams,_e=ve.extractSeparableConvParams,Re=ve.extractReductionBlockParams,Ne=ve.extractMainBlockParams,Ue=he(3,32,3,"entry_flow/conv_in"),ze=Re(32,64,"entry_flow/reduction_block_0"),qe=Re(64,128,"entry_flow/reduction_block_1"),it={conv_in:Ue,reduction_block_0:ze,reduction_block_1:qe},bt={};Le(w,0,1).forEach(function(At){bt["main_block_"+At]=Ne(128,"middle_flow/main_block_"+At)});var Et=Re(128,256,"exit_flow/reduction_block"),Tt=_e(256,512,"exit_flow/separable_conv"),It={reduction_block:Et,separable_conv:Tt};if(oe().length!==0)throw new Error("weights remaing after extract: "+oe().length);return{paramMappings:A,params:{entry_flow:it,middle_flow:bt,exit_flow:It}}}function Pi(O,w){var A=On(O,w),P=Qa(A),K=sa(A);function oe(he){var _e=K(he+"/separable_conv0"),Re=K(he+"/separable_conv1"),Ne=P(he+"/expansion_conv");return{separable_conv0:_e,separable_conv1:Re,expansion_conv:Ne}}function ve(he){var _e=K(he+"/separable_conv0"),Re=K(he+"/separable_conv1"),Ne=K(he+"/separable_conv2");return{separable_conv0:_e,separable_conv1:Re,separable_conv2:Ne}}return{extractConvParams:P,extractSeparableConvParams:K,extractReductionBlockParams:oe,extractMainBlockParams:ve}}function Cs(O,w){var A=[],P=Pi(O,A),K=P.extractConvParams,oe=P.extractSeparableConvParams,ve=P.extractReductionBlockParams,he=P.extractMainBlockParams,_e=K("entry_flow/conv_in"),Re=ve("entry_flow/reduction_block_0"),Ne=ve("entry_flow/reduction_block_1"),Ue={conv_in:_e,reduction_block_0:Re,reduction_block_1:Ne},ze={};Le(w,0,1).forEach(function(Et){ze["main_block_"+Et]=he("middle_flow/main_block_"+Et)});var qe=ve("exit_flow/reduction_block"),it=oe("exit_flow/separable_conv"),bt={reduction_block:qe,separable_conv:it};return bn(O,A),{params:{entry_flow:Ue,middle_flow:ze,exit_flow:bt},paramMappings:A}}function Ft(O,w,A){return z.c(z.i(O,w.filters,A,"same"),w.bias)}function Fi(O,w,A){A===void 0&&(A=!0);var P=A?z.w(O):O;return P=zr(P,w.separable_conv0,[1,1]),P=zr(z.w(P),w.separable_conv1,[1,1]),P=z.s(P,[3,3],[2,2],"same"),P=z.c(P,Ft(O,w.expansion_conv,[2,2])),P}function Qu(O,w){var A=zr(z.w(O),w.separable_conv0,[1,1]);return A=zr(z.w(A),w.separable_conv1,[1,1]),A=zr(z.w(A),w.separable_conv2,[1,1]),A=z.c(A,O),A}var Zu=function(O){Object(H.c)(w,O);function w(A){var P=O.call(this,"TinyXception")||this;return P._numMainBlocks=A,P}return w.prototype.forwardInput=function(A){var P=this,K=this.params;if(!K)throw new Error("TinyXception - load model before inference");return z.L(function(){var oe=A.toBatchTensor(112,!0),ve=[122.782,117.001,104.298],he=pe(oe,ve).div(z.y(256)),_e=z.w(Ft(he,K.entry_flow.conv_in,[2,2]));return _e=Fi(_e,K.entry_flow.reduction_block_0,!1),_e=Fi(_e,K.entry_flow.reduction_block_1),Le(P._numMainBlocks,0,1).forEach(function(Re){_e=Qu(_e,K.middle_flow["main_block_"+Re])}),_e=Fi(_e,K.exit_flow.reduction_block),_e=z.w(zr(_e,K.exit_flow.separable_conv,[1,1])),_e})},w.prototype.forward=function(A){return Object(H.b)(this,void 0,void 0,function(){var P;return Object(H.d)(this,function(K){switch(K.label){case 0:return P=this.forwardInput,[4,Or(A)];case 1:return[2,P.apply(this,[K.sent()])]}})})},w.prototype.getDefaultModelName=function(){return"tiny_xception_model"},w.prototype.extractParamsFromWeigthMap=function(A){return Cs(A,this._numMainBlocks)},w.prototype.extractParams=function(A){return ti(A,this._numMainBlocks)},w}(yn);function Li(O){var w=[],A=dn(O),P=A.extractWeights,K=A.getRemainingWeights,oe=aa(P,w),ve=oe(512,1,"fc/age"),he=oe(512,2,"fc/gender");if(K().length!==0)throw new Error("weights remaing after extract: "+K().length);return{paramMappings:w,params:{fc:{age:ve,gender:he}}}}function ec(O){var w=[],A=On(O,w);function P(oe){var ve=A(oe+"/weights",2),he=A(oe+"/bias",1);return{weights:ve,bias:he}}var K={fc:{age:P("fc/age"),gender:P("fc/gender")}};return bn(O,w),{params:K,paramMappings:w}}var Bo;(function(O){O.FEMALE="female",O.MALE="male"})(Bo||(Bo={}));var tc=function(O){Object(H.c)(w,O);function w(A){A===void 0&&(A=new Zu(2));var P=O.call(this,"AgeGenderNet")||this;return P._faceFeatureExtractor=A,P}return Object.defineProperty(w.prototype,"faceFeatureExtractor",{get:function(){return this._faceFeatureExtractor},enumerable:!0,configurable:!0}),w.prototype.runNet=function(A){var P=this,K=this.params;if(!K)throw new Error(this._name+" - load model before inference");return z.L(function(){var oe=A instanceof Kn?P.faceFeatureExtractor.forwardInput(A):A,ve=z.d(oe,[7,7],[2,2],"valid").as2D(oe.shape[0],-1),he=$r(ve,K.fc.age).as1D(),_e=$r(ve,K.fc.gender);return{age:he,gender:_e}})},w.prototype.forwardInput=function(A){var P=this;return z.L(function(){var K=P.runNet(A),oe=K.age,ve=K.gender;return{age:oe,gender:z.D(ve)}})},w.prototype.forward=function(A){return Object(H.b)(this,void 0,void 0,function(){var P;return Object(H.d)(this,function(K){switch(K.label){case 0:return P=this.forwardInput,[4,Or(A)];case 1:return[2,P.apply(this,[K.sent()])]}})})},w.prototype.predictAgeAndGender=function(A){return Object(H.b)(this,void 0,void 0,function(){var P,K,oe,ve,he,_e,Re=this;return Object(H.d)(this,function(Ne){switch(Ne.label){case 0:return[4,Or(A)];case 1:return P=Ne.sent(),[4,this.forwardInput(P)];case 2:return K=Ne.sent(),oe=z.O(K.age),ve=z.O(K.gender),he=oe.map(function(Ue,ze){return{ageTensor:Ue,genderTensor:ve[ze]}}),[4,Promise.all(he.map(function(Ue){var ze=Ue.ageTensor,qe=Ue.genderTensor;return Object(H.b)(Re,void 0,void 0,function(){var it,bt,Et,Tt,It;return Object(H.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 bt=At.sent()[0],Et=bt>.5,Tt=Et?Bo.MALE:Bo.FEMALE,It=Et?bt:1-bt,ze.dispose(),qe.dispose(),[2,{age:it,gender:Tt,genderProbability:It}]}})})}))];case 3:return _e=Ne.sent(),K.age.dispose(),K.gender.dispose(),[2,P.isBatchInput?_e:_e[0]]}})})},w.prototype.getDefaultModelName=function(){return"age_gender_model"},w.prototype.dispose=function(A){A===void 0&&(A=!0),this.faceFeatureExtractor.dispose(A),O.prototype.dispose.call(this,A)},w.prototype.loadClassifierParams=function(A){var P=this.extractClassifierParams(A),K=P.params,oe=P.paramMappings;this._params=K,this._paramMappings=oe},w.prototype.extractClassifierParams=function(A){return Li(A)},w.prototype.extractParamsFromWeigthMap=function(A){var P=ei(A),K=P.featureExtractorMap,oe=P.classifierMap;return this.faceFeatureExtractor.loadFromWeightMap(K),ec(oe)},w.prototype.extractParams=function(A){var P=512*1+1+(512*2+2),K=A.slice(0,A.length-P),oe=A.slice(A.length-P);return this.faceFeatureExtractor.extractWeights(K),this.extractClassifierParams(oe)},w}(yn),Ts=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.postProcess=function(A,P,K){var oe=K.map(function(he){var _e=he.width,Re=he.height,Ne=P/Math.max(Re,_e);return{width:_e*Ne,height:Re*Ne}}),ve=oe.length;return z.L(function(){var he=function(ze,qe){return z.E([z.n([68],ze),z.n([68],qe)],1).as2D(1,136).as1D()},_e=function(ze,qe){var it=oe[ze],bt=it.width,Et=it.height;return qe(bt,Et)?Math.abs(bt-Et)/2:0},Re=function(ze){return _e(ze,function(qe,it){return qe<it})},Ne=function(ze){return _e(ze,function(qe,it){return it<qe})},Ue=A.mul(z.n([ve,136],P)).sub(z.E(Array.from(Array(ve),function(ze,qe){return he(Re(qe),Ne(qe))}))).div(z.E(Array.from(Array(ve),function(ze,qe){return he(oe[qe].width,oe[qe].height)})));return Ue})},w.prototype.forwardInput=function(A){var P=this;return z.L(function(){var K=P.runNet(A);return P.postProcess(K,A.inputSize,A.inputDimensions.map(function(oe){var ve=oe[0],he=oe[1];return{height:ve,width:he}}))})},w.prototype.forward=function(A){return Object(H.b)(this,void 0,void 0,function(){var P;return Object(H.d)(this,function(K){switch(K.label){case 0:return P=this.forwardInput,[4,Or(A)];case 1:return[2,P.apply(this,[K.sent()])]}})})},w.prototype.detectLandmarks=function(A){return Object(H.b)(this,void 0,void 0,function(){var P,K,oe,ve=this;return Object(H.d)(this,function(he){switch(he.label){case 0:return[4,Or(A)];case 1:return P=he.sent(),K=z.L(function(){return z.O(ve.forwardInput(P))}),[4,Promise.all(K.map(function(_e,Re){return Object(H.b)(ve,void 0,void 0,function(){var Ne,Ue,ze,qe,it;return Object(H.d)(this,function(bt){switch(bt.label){case 0:return ze=(Ue=Array).from,[4,_e.data()];case 1:return Ne=ze.apply(Ue,[bt.sent()]),qe=Ne.filter(function(Et,Tt){return et(Tt)}),it=Ne.filter(function(Et,Tt){return!et(Tt)}),[2,new mr(Array(68).fill(0).map(function(Et,Tt){return new be(qe[Tt],it[Tt])}),{height:P.getInputHeight(Re),width:P.getInputWidth(Re)})]}})})}))];case 2:return oe=he.sent(),K.forEach(function(_e){return _e.dispose()}),[2,P.isBatchInput?oe:oe[0]]}})})},w.prototype.getClassifierChannelsOut=function(){return 136},w}(ho),Rr=function(O){Object(H.c)(w,O);function w(A){return A===void 0&&(A=new ca),O.call(this,"FaceLandmark68Net",A)||this}return w.prototype.getDefaultModelName=function(){return"face_landmark_68_model"},w.prototype.getClassifierChannelsIn=function(){return 256},w}(Ts);function qr(O){var w=[],A=Za(O,w).extractDenseBlock3Params,P={dense0:A("dense0",!0),dense1:A("dense1"),dense2:A("dense2")};return bn(O,w),{params:P,paramMappings:w}}function Ss(O){var w=[],A=dn(O),P=A.extractWeights,K=A.getRemainingWeights,oe=qa(P,w).extractDenseBlock3Params,ve=oe(3,32,"dense0",!0),he=oe(32,64,"dense1"),_e=oe(64,128,"dense2");if(K().length!==0)throw new Error("weights remaing after extract: "+K().length);return{paramMappings:w,params:{dense0:ve,dense1:he,dense2:_e}}}var rc=function(O){Object(H.c)(w,O);function w(){return O.call(this,"TinyFaceFeatureExtractor")||this}return w.prototype.forwardInput=function(A){var P=this.params;if(!P)throw new Error("TinyFaceFeatureExtractor - load model before inference");return z.L(function(){var K=A.toBatchTensor(112,!0),oe=[122.782,117.001,104.298],ve=pe(K,oe).div(z.y(255)),he=fo(ve,P.dense0,!0);return he=fo(he,P.dense1),he=fo(he,P.dense2),he=z.d(he,[14,14],[2,2],"valid"),he})},w.prototype.forward=function(A){return Object(H.b)(this,void 0,void 0,function(){var P;return Object(H.d)(this,function(K){switch(K.label){case 0:return P=this.forwardInput,[4,Or(A)];case 1:return[2,P.apply(this,[K.sent()])]}})})},w.prototype.getDefaultModelName=function(){return"face_feature_extractor_tiny_model"},w.prototype.extractParamsFromWeigthMap=function(A){return qr(A)},w.prototype.extractParams=function(A){return Ss(A)},w}(yn),nc=function(O){Object(H.c)(w,O);function w(A){return A===void 0&&(A=new rc),O.call(this,"FaceLandmark68TinyNet",A)||this}return w.prototype.getDefaultModelName=function(){return"face_landmark_68_tiny_model"},w.prototype.getClassifierChannelsIn=function(){return 128},w}(Ts),ad=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w}(Rr);function oc(O,w){return z.c(z.t(O,w.weights),w.biases)}function ji(O,w,A,P,K){K===void 0&&(K="same");var oe=w.conv,ve=oe.filters,he=oe.bias,_e=z.i(O,ve,A,K);return _e=z.c(_e,he),_e=oc(_e,w.scale),P?z.w(_e):_e}function ac(O,w){return ji(O,w,[1,1],!0)}function As(O,w){return ji(O,w,[1,1],!1)}function Os(O,w){return ji(O,w,[2,2],!0,"valid")}function ic(O,w){function A(he,_e,Re){var Ne=O(he),Ue=Ne.length/(_e*Re*Re);if(Ke(Ue))throw new Error("depth has to be an integer: "+Ue+", weights.length: "+Ne.length+", numFilters: "+_e+", filterSize: "+Re);return z.L(function(){return z.N(z.K(Ne,[_e,Ue,Re,Re]),[2,3,1,0])})}function P(he,_e,Re,Ne){var Ue=A(he,_e,Re),ze=z.H(O(_e));return w.push({paramPath:Ne+"/filters"},{paramPath:Ne+"/bias"}),{filters:Ue,bias:ze}}function K(he,_e){var Re=z.H(O(he)),Ne=z.H(O(he));return w.push({paramPath:_e+"/weights"},{paramPath:_e+"/biases"}),{weights:Re,biases:Ne}}function oe(he,_e,Re,Ne){var Ue=P(he,_e,Re,Ne+"/conv"),ze=K(_e,Ne+"/scale");return{conv:Ue,scale:ze}}function ve(he,_e,Re,Ne,Ue){Ue===void 0&&(Ue=!1);var ze=oe((Ue?.5:1)*he,_e,Re,Ne+"/conv1"),qe=oe(he,_e,Re,Ne+"/conv2");return{conv1:ze,conv2:qe}}return{extractConvLayerParams:oe,extractResidualLayerParams:ve}}function sc(O){var w=dn(O),A=w.extractWeights,P=w.getRemainingWeights,K=[],oe=ic(A,K),ve=oe.extractConvLayerParams,he=oe.extractResidualLayerParams,_e=ve(4704,32,7,"conv32_down"),Re=he(9216,32,3,"conv32_1"),Ne=he(9216,32,3,"conv32_2"),Ue=he(9216,32,3,"conv32_3"),ze=he(36864,64,3,"conv64_down",!0),qe=he(36864,64,3,"conv64_1"),it=he(36864,64,3,"conv64_2"),bt=he(36864,64,3,"conv64_3"),Et=he(147456,128,3,"conv128_down",!0),Tt=he(147456,128,3,"conv128_1"),It=he(147456,128,3,"conv128_2"),At=he(589824,256,3,"conv256_down",!0),vt=he(589824,256,3,"conv256_1"),Ct=he(589824,256,3,"conv256_2"),Bt=he(589824,256,3,"conv256_down_out"),lr=z.L(function(){return z.N(z.I(A(256*128),[128,256]),[1,0])});if(K.push({paramPath:"fc"}),P().length!==0)throw new Error("weights remaing after extract: "+P().length);var xr={conv32_down:_e,conv32_1:Re,conv32_2:Ne,conv32_3:Ue,conv64_down:ze,conv64_1:qe,conv64_2:it,conv64_3:bt,conv128_down:Et,conv128_1:Tt,conv128_2:It,conv256_down:At,conv256_1:vt,conv256_2:Ct,conv256_down_out:Bt,fc:lr};return{params:xr,paramMappings:K}}function ha(O,w){var A=On(O,w);function P(ve){var he=A(ve+"/scale/weights",1),_e=A(ve+"/scale/biases",1);return{weights:he,biases:_e}}function K(ve){var he=A(ve+"/conv/filters",4),_e=A(ve+"/conv/bias",1),Re=P(ve);return{conv:{filters:he,bias:_e},scale:Re}}function oe(ve){return{conv1:K(ve+"/conv1"),conv2:K(ve+"/conv2")}}return{extractConvLayerParams:K,extractResidualLayerParams:oe}}function xn(O){var w=[],A=ha(O,w),P=A.extractConvLayerParams,K=A.extractResidualLayerParams,oe=P("conv32_down"),ve=K("conv32_1"),he=K("conv32_2"),_e=K("conv32_3"),Re=K("conv64_down"),Ne=K("conv64_1"),Ue=K("conv64_2"),ze=K("conv64_3"),qe=K("conv128_down"),it=K("conv128_1"),bt=K("conv128_2"),Et=K("conv256_down"),Tt=K("conv256_1"),It=K("conv256_2"),At=K("conv256_down_out"),vt=O.fc;if(w.push({originalPath:"fc",paramPath:"fc"}),!Se(vt))throw new Error("expected weightMap[fc] to be a Tensor2D, instead have "+vt);var Ct={conv32_down:oe,conv32_1:ve,conv32_2:he,conv32_3:_e,conv64_down:Re,conv64_1:Ne,conv64_2:Ue,conv64_3:ze,conv128_down:qe,conv128_1:it,conv128_2:bt,conv256_down:Et,conv256_1:Tt,conv256_2:It,conv256_down_out:At,fc:vt};return bn(O,w),{params:Ct,paramMappings:w}}function fn(O,w){var A=ac(O,w.conv1);return A=As(A,w.conv2),A=z.c(A,O),A=z.w(A),A}function Oe(O,w){var A=Os(O,w.conv1);A=As(A,w.conv2);var P=z.d(O,2,2,"valid"),K=z.P(P.shape),oe=P.shape[3]!==A.shape[3],ve=P.shape[1]!==A.shape[1]||P.shape[2]!==A.shape[2];if(ve){var he=Object(H.e)(A.shape);he[1]=1;var _e=z.P(he);A=z.h([A,_e],1);var Re=Object(H.e)(A.shape);Re[2]=1;var Ne=z.P(Re);A=z.h([A,Ne],2)}return P=oe?z.h([P,K],3):P,A=z.c(P,A),A=z.w(A),A}var go=function(O){Object(H.c)(w,O);function w(){return O.call(this,"FaceRecognitionNet")||this}return w.prototype.forwardInput=function(A){var P=this.params;if(!P)throw new Error("FaceRecognitionNet - load model before inference");return z.L(function(){var K=A.toBatchTensor(150,!0).toFloat(),oe=[122.782,117.001,104.298],ve=pe(K,oe).div(z.y(256)),he=Os(ve,P.conv32_down);he=z.s(he,3,2,"valid"),he=fn(he,P.conv32_1),he=fn(he,P.conv32_2),he=fn(he,P.conv32_3),he=Oe(he,P.conv64_down),he=fn(he,P.conv64_1),he=fn(he,P.conv64_2),he=fn(he,P.conv64_3),he=Oe(he,P.conv128_down),he=fn(he,P.conv128_1),he=fn(he,P.conv128_2),he=Oe(he,P.conv256_down),he=fn(he,P.conv256_1),he=fn(he,P.conv256_2),he=Oe(he,P.conv256_down_out);var _e=he.mean([1,2]),Re=z.q(_e,P.fc);return Re})},w.prototype.forward=function(A){return Object(H.b)(this,void 0,void 0,function(){var P;return Object(H.d)(this,function(K){switch(K.label){case 0:return P=this.forwardInput,[4,Or(A)];case 1:return[2,P.apply(this,[K.sent()])]}})})},w.prototype.computeFaceDescriptor=function(A){return Object(H.b)(this,void 0,void 0,function(){var P,K,oe,ve=this;return Object(H.d)(this,function(he){switch(he.label){case 0:return[4,Or(A)];case 1:return P=he.sent(),K=z.L(function(){return z.O(ve.forwardInput(P))}),[4,Promise.all(K.map(function(_e){return _e.data()}))];case 2:return oe=he.sent(),K.forEach(function(_e){return _e.dispose()}),[2,P.isBatchInput?oe:oe[0]]}})})},w.prototype.getDefaultModelName=function(){return"face_recognition_model"},w.prototype.extractParamsFromWeigthMap=function(A){return xn(A)},w.prototype.extractParams=function(A){return sc(A)},w}(yn);function Bi(O){var w=new go;return w.extractWeights(O),w}function ri(O,w){var A={descriptor:w};return Object.assign({},O,A)}function Gr(O){return typeof O.age=="number"}function Vr(O,w){var A={age:w};return Object.assign({},O,A)}function nn(O){return(O.gender===Bo.MALE||O.gender===Bo.FEMALE)&&ot(O.genderProbability)}function an(O,w,A){var P={gender:w,genderProbability:A};return Object.assign({},O,P)}var yo=function(){function O(w){var A=w===void 0?{}:w,P=A.minFaceSize,K=A.scaleFactor,oe=A.maxNumScales,ve=A.scoreThresholds,he=A.scaleSteps;if(this._name="MtcnnOptions",this._minFaceSize=P||20,this._scaleFactor=K||.709,this._maxNumScales=oe||10,this._scoreThresholds=ve||[.6,.7,.7],this._scaleSteps=he,typeof this._minFaceSize!="number"||this._minFaceSize<0)throw new Error(this._name+" - expected minFaceSize to be a number > 0");if(typeof this._scaleFactor!="number"||this._scaleFactor<=0||this._scaleFactor>=1)throw new Error(this._name+" - expected scaleFactor to be a number between 0 and 1");if(typeof this._maxNumScales!="number"||this._maxNumScales<0)throw new Error(this._name+" - expected maxNumScales to be a number > 0");if(!Array.isArray(this._scoreThresholds)||this._scoreThresholds.length!==3||this._scoreThresholds.some(function(_e){return typeof _e!="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(_e){return typeof _e!="number"})))throw new Error(this._name+" - expected scaleSteps to be an array of numbers")}return Object.defineProperty(O.prototype,"minFaceSize",{get:function(){return this._minFaceSize},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"scaleFactor",{get:function(){return this._scaleFactor},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"maxNumScales",{get:function(){return this._maxNumScales},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"scoreThresholds",{get:function(){return this._scoreThresholds},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"scaleSteps",{get:function(){return this._scaleSteps},enumerable:!0,configurable:!0}),O}();function hn(O,w){function A(_e,Re){var Ne=z.K(O(3*3*_e),[3,3,_e,1]),Ue=z.H(O(_e)),ze=z.H(O(_e)),qe=z.H(O(_e)),it=z.H(O(_e));return w.push({paramPath:Re+"/filters"},{paramPath:Re+"/batch_norm_scale"},{paramPath:Re+"/batch_norm_offset"},{paramPath:Re+"/batch_norm_mean"},{paramPath:Re+"/batch_norm_variance"}),{filters:Ne,batch_norm_scale:Ue,batch_norm_offset:ze,batch_norm_mean:qe,batch_norm_variance:it}}function P(_e,Re,Ne,Ue,ze){var qe=z.K(O(_e*Re*Ne*Ne),[Ne,Ne,_e,Re]),it=z.H(O(Re));return w.push({paramPath:Ue+"/filters"},{paramPath:Ue+"/"+(ze?"batch_norm_offset":"bias")}),{filters:qe,bias:it}}function K(_e,Re,Ne,Ue){var ze=P(_e,Re,Ne,Ue,!0),qe=ze.filters,it=ze.bias;return{filters:qe,batch_norm_offset:it}}function oe(_e,Re,Ne){var Ue=A(_e,Ne+"/depthwise_conv"),ze=K(_e,Re,1,Ne+"/pointwise_conv");return{depthwise_conv:Ue,pointwise_conv:ze}}function ve(){var _e=K(3,32,3,"mobilenetv1/conv_0"),Re=oe(32,64,"mobilenetv1/conv_1"),Ne=oe(64,128,"mobilenetv1/conv_2"),Ue=oe(128,128,"mobilenetv1/conv_3"),ze=oe(128,256,"mobilenetv1/conv_4"),qe=oe(256,256,"mobilenetv1/conv_5"),it=oe(256,512,"mobilenetv1/conv_6"),bt=oe(512,512,"mobilenetv1/conv_7"),Et=oe(512,512,"mobilenetv1/conv_8"),Tt=oe(512,512,"mobilenetv1/conv_9"),It=oe(512,512,"mobilenetv1/conv_10"),At=oe(512,512,"mobilenetv1/conv_11"),vt=oe(512,1024,"mobilenetv1/conv_12"),Ct=oe(1024,1024,"mobilenetv1/conv_13");return{conv_0:_e,conv_1:Re,conv_2:Ne,conv_3:Ue,conv_4:ze,conv_5:qe,conv_6:it,conv_7:bt,conv_8:Et,conv_9:Tt,conv_10:It,conv_11:At,conv_12:vt,conv_13:Ct}}function he(){var _e=K(1024,256,1,"prediction_layer/conv_0"),Re=K(256,512,3,"prediction_layer/conv_1"),Ne=K(512,128,1,"prediction_layer/conv_2"),Ue=K(128,256,3,"prediction_layer/conv_3"),ze=K(256,128,1,"prediction_layer/conv_4"),qe=K(128,256,3,"prediction_layer/conv_5"),it=K(256,64,1,"prediction_layer/conv_6"),bt=K(64,128,3,"prediction_layer/conv_7"),Et=P(512,12,1,"prediction_layer/box_predictor_0/box_encoding_predictor"),Tt=P(512,9,1,"prediction_layer/box_predictor_0/class_predictor"),It=P(1024,24,1,"prediction_layer/box_predictor_1/box_encoding_predictor"),At=P(1024,18,1,"prediction_layer/box_predictor_1/class_predictor"),vt=P(512,24,1,"prediction_layer/box_predictor_2/box_encoding_predictor"),Ct=P(512,18,1,"prediction_layer/box_predictor_2/class_predictor"),Bt=P(256,24,1,"prediction_layer/box_predictor_3/box_encoding_predictor"),lr=P(256,18,1,"prediction_layer/box_predictor_3/class_predictor"),xr=P(256,24,1,"prediction_layer/box_predictor_4/box_encoding_predictor"),or=P(256,18,1,"prediction_layer/box_predictor_4/class_predictor"),Ht=P(128,24,1,"prediction_layer/box_predictor_5/box_encoding_predictor"),Ut=P(128,18,1,"prediction_layer/box_predictor_5/class_predictor"),kr={box_encoding_predictor:Et,class_predictor:Tt},dr={box_encoding_predictor:It,class_predictor:At},Xr={box_encoding_predictor:vt,class_predictor:Ct},un={box_encoding_predictor:Bt,class_predictor:lr},Rt={box_encoding_predictor:xr,class_predictor:or},Kr={box_encoding_predictor:Ht,class_predictor:Ut};return{conv_0:_e,conv_1:Re,conv_2:Ne,conv_3:Ue,conv_4:ze,conv_5:qe,conv_6:it,conv_7:bt,box_predictor_0:kr,box_predictor_1:dr,box_predictor_2:Xr,box_predictor_3:un,box_predictor_4:Rt,box_predictor_5:Kr}}return{extractMobilenetV1Params:ve,extractPredictionLayerParams:he}}function Ui(O){var w=[],A=dn(O),P=A.extractWeights,K=A.getRemainingWeights,oe=hn(P,w),ve=oe.extractMobilenetV1Params,he=oe.extractPredictionLayerParams,_e=ve(),Re=he(),Ne=z.J(P(5118*4),[1,5118,4]),Ue={extra_dim:Ne};if(w.push({paramPath:"output_layer/extra_dim"}),K().length!==0)throw new Error("weights remaing after extract: "+K().length);return{params:{mobilenetv1:_e,prediction_layer:Re,output_layer:Ue},paramMappings:w}}function Jn(O,w){var A=On(O,w);function P(Re,Ne,Ue){var ze=A(Re+"/Conv2d_"+Ne+"_pointwise/weights",4,Ue+"/filters"),qe=A(Re+"/Conv2d_"+Ne+"_pointwise/convolution_bn_offset",1,Ue+"/batch_norm_offset");return{filters:ze,batch_norm_offset:qe}}function K(Re){var Ne="mobilenetv1/conv_"+Re,Ue="MobilenetV1/Conv2d_"+Re+"_depthwise",ze=Ne+"/depthwise_conv",qe=Ne+"/pointwise_conv",it=A(Ue+"/depthwise_weights",4,ze+"/filters"),bt=A(Ue+"/BatchNorm/gamma",1,ze+"/batch_norm_scale"),Et=A(Ue+"/BatchNorm/beta",1,ze+"/batch_norm_offset"),Tt=A(Ue+"/BatchNorm/moving_mean",1,ze+"/batch_norm_mean"),It=A(Ue+"/BatchNorm/moving_variance",1,ze+"/batch_norm_variance");return{depthwise_conv:{filters:it,batch_norm_scale:bt,batch_norm_offset:Et,batch_norm_mean:Tt,batch_norm_variance:It},pointwise_conv:P("MobilenetV1",Re,qe)}}function oe(){return{conv_0:P("MobilenetV1",0,"mobilenetv1/conv_0"),conv_1:K(1),conv_2:K(2),conv_3:K(3),conv_4:K(4),conv_5:K(5),conv_6:K(6),conv_7:K(7),conv_8:K(8),conv_9:K(9),conv_10:K(10),conv_11:K(11),conv_12:K(12),conv_13:K(13)}}function ve(Re,Ne){var Ue=A(Re+"/weights",4,Ne+"/filters"),ze=A(Re+"/biases",1,Ne+"/bias");return{filters:Ue,bias:ze}}function he(Re){var Ne=ve("Prediction/BoxPredictor_"+Re+"/BoxEncodingPredictor","prediction_layer/box_predictor_"+Re+"/box_encoding_predictor"),Ue=ve("Prediction/BoxPredictor_"+Re+"/ClassPredictor","prediction_layer/box_predictor_"+Re+"/class_predictor");return{box_encoding_predictor:Ne,class_predictor:Ue}}function _e(){return{conv_0:P("Prediction",0,"prediction_layer/conv_0"),conv_1:P("Prediction",1,"prediction_layer/conv_1"),conv_2:P("Prediction",2,"prediction_layer/conv_2"),conv_3:P("Prediction",3,"prediction_layer/conv_3"),conv_4:P("Prediction",4,"prediction_layer/conv_4"),conv_5:P("Prediction",5,"prediction_layer/conv_5"),conv_6:P("Prediction",6,"prediction_layer/conv_6"),conv_7:P("Prediction",7,"prediction_layer/conv_7"),box_predictor_0:he(0),box_predictor_1:he(1),box_predictor_2:he(2),box_predictor_3:he(3),box_predictor_4:he(4),box_predictor_5:he(5)}}return{extractMobilenetV1Params:oe,extractPredictionLayerParams:_e}}function Xe(O){var w=[],A=Jn(O,w),P=A.extractMobilenetV1Params,K=A.extractPredictionLayerParams,oe=O["Output/extra_dim"];if(w.push({originalPath:"Output/extra_dim",paramPath:"output_layer/extra_dim"}),!De(oe))throw new Error("expected weightMap['Output/extra_dim'] to be a Tensor3D, instead have "+oe);var ve={mobilenetv1:P(),prediction_layer:K(),output_layer:{extra_dim:oe}};return bn(O,w),{params:ve,paramMappings:w}}function br(O,w,A){return z.L(function(){var P=z.i(O,w.filters,A,"same");return P=z.c(P,w.batch_norm_offset),z.g(P,0,6)})}var sn=.0010000000474974513;function wn(O,w,A){return z.L(function(){var P=z.j(O,w.filters,A,"same");return P=z.e(P,w.batch_norm_mean,w.batch_norm_variance,w.batch_norm_offset,w.batch_norm_scale,sn),z.g(P,0,6)})}function Ur(O){return[2,4,6,12].some(function(w){return w===O})?[2,2]:[1,1]}function Dn(O,w){return z.L(function(){var A=null,P=br(O,w.conv_0,[2,2]),K=[w.conv_1,w.conv_2,w.conv_3,w.conv_4,w.conv_5,w.conv_6,w.conv_7,w.conv_8,w.conv_9,w.conv_10,w.conv_11,w.conv_12,w.conv_13];if(K.forEach(function(oe,ve){var he=ve+1,_e=Ur(he);P=wn(P,oe.depthwise_conv,_e),P=br(P,oe.pointwise_conv,[1,1]),he===11&&(A=P)}),A===null)throw new Error("mobileNetV1 - output of conv layer 11 is null");return{out:P,conv11:A}})}function Nt(O,w,A,P,K){var oe=O.shape[0],ve=Math.min(A,oe),he=w.map(function(Ne,Ue){return{score:Ne,boxIndex:Ue}}).filter(function(Ne){return Ne.score>K}).sort(function(Ne,Ue){return Ue.score-Ne.score}),_e=function(Ne){return Ne<=P?1:0},Re=[];return he.forEach(function(Ne){if(Re.length>=ve)return;for(var Ue=Ne.score,ze=Re.length-1;ze>=0;--ze){var qe=qn(O,Ne.boxIndex,Re[ze]);if(qe===0)continue;if(Ne.score*=_e(qe),Ne.score<=K)break}Ue===Ne.score&&Re.push(Ne.boxIndex)}),Re}function qn(O,w,A){var P=O.arraySync(),K=Math.min(P[w][0],P[w][2]),oe=Math.min(P[w][1],P[w][3]),ve=Math.max(P[w][0],P[w][2]),he=Math.max(P[w][1],P[w][3]),_e=Math.min(P[A][0],P[A][2]),Re=Math.min(P[A][1],P[A][3]),Ne=Math.max(P[A][0],P[A][2]),Ue=Math.max(P[A][1],P[A][3]),ze=(ve-K)*(he-oe),qe=(Ne-_e)*(Ue-Re);if(ze<=0||qe<=0)return 0;var it=Math.max(K,_e),bt=Math.max(oe,Re),Et=Math.min(ve,Ne),Tt=Math.min(he,Ue),It=Math.max(Et-it,0)*Math.max(Tt-bt,0);return It/(ze+qe-It)}function Qn(O){var w=z.O(z.N(O,[1,0])),A=[z.F(w[2],w[0]),z.F(w[3],w[1])],P=[z.c(w[0],z.k(A[0],z.y(2))),z.c(w[1],z.k(A[1],z.y(2)))];return{sizes:A,centers:P}}function ni(O,w){var A=Qn(O),P=A.sizes,K=A.centers,oe=z.O(z.N(w,[1,0])),ve=z.k(z.t(z.l(z.k(oe[2],z.y(5))),P[0]),z.y(2)),he=z.c(z.t(z.k(oe[0],z.y(10)),P[0]),K[0]),_e=z.k(z.t(z.l(z.k(oe[3],z.y(5))),P[1]),z.y(2)),Re=z.c(z.t(z.k(oe[1],z.y(10)),P[1]),K[1]);return z.N(z.E([z.F(he,ve),z.F(Re,_e),z.c(he,ve),z.c(Re,_e)]),[1,0])}function kn(O,w,A){return z.L(function(){var P=O.shape[0],K=ni(z.x(z.M(A.extra_dim,[P,1,1]),[-1,4]),z.x(O,[-1,4]));K=z.x(K,[P,K.shape[0]/P,4]);var oe=z.A(z.B(w,[0,0,1],[-1,-1,-1])),ve=z.B(oe,[0,0,0],[-1,-1,1]);ve=z.x(ve,[P,ve.shape[1]]);var he=z.O(K),_e=z.O(ve);return{boxes:he,scores:_e}})}function bo(O,w){return z.L(function(){var A=O.shape[0],P=z.x(on(O,w.box_encoding_predictor),[A,-1,1,4]),K=z.x(on(O,w.class_predictor),[A,-1,3]);return{boxPredictionEncoding:P,classPrediction:K}})}function Rs(O,w,A){return z.L(function(){var P=br(O,A.conv_0,[1,1]),K=br(P,A.conv_1,[2,2]),oe=br(K,A.conv_2,[1,1]),ve=br(oe,A.conv_3,[2,2]),he=br(ve,A.conv_4,[1,1]),_e=br(he,A.conv_5,[2,2]),Re=br(_e,A.conv_6,[1,1]),Ne=br(Re,A.conv_7,[2,2]),Ue=bo(w,A.box_predictor_0),ze=bo(O,A.box_predictor_1),qe=bo(K,A.box_predictor_2),it=bo(ve,A.box_predictor_3),bt=bo(_e,A.box_predictor_4),Et=bo(Ne,A.box_predictor_5),Tt=z.h([Ue.boxPredictionEncoding,ze.boxPredictionEncoding,qe.boxPredictionEncoding,it.boxPredictionEncoding,bt.boxPredictionEncoding,Et.boxPredictionEncoding],1),It=z.h([Ue.classPrediction,ze.classPrediction,qe.classPrediction,it.classPrediction,bt.classPrediction,Et.classPrediction],1);return{boxPredictions:Tt,classPredictions:It}})}var xo=function(){function O(w){var A=w===void 0?{}:w,P=A.minConfidence,K=A.maxResults;if(this._name="SsdMobilenetv1Options",this._minConfidence=P||.5,this._maxResults=K||100,typeof this._minConfidence!="number"||this._minConfidence<=0||this._minConfidence>=1)throw new Error(this._name+" - expected minConfidence to be a number between 0 and 1");if(typeof this._maxResults!="number")throw new Error(this._name+" - expected maxResults to be a number")}return Object.defineProperty(O.prototype,"minConfidence",{get:function(){return this._minConfidence},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"maxResults",{get:function(){return this._maxResults},enumerable:!0,configurable:!0}),O}(),Mn=function(O){Object(H.c)(w,O);function w(){return O.call(this,"SsdMobilenetv1")||this}return w.prototype.forwardInput=function(A){var P=this.params;if(!P)throw new Error("SsdMobilenetv1 - load model before inference");return z.L(function(){var K=A.toBatchTensor(512,!1).toFloat(),oe=z.F(z.t(K,z.y(.007843137718737125)),z.y(1)),ve=Dn(oe,P.mobilenetv1),he=Rs(ve.out,ve.conv11,P.prediction_layer),_e=he.boxPredictions,Re=he.classPredictions;return kn(_e,Re,P.output_layer)})},w.prototype.forward=function(A){return Object(H.b)(this,void 0,void 0,function(){var P;return Object(H.d)(this,function(K){switch(K.label){case 0:return P=this.forwardInput,[4,Or(A)];case 1:return[2,P.apply(this,[K.sent()])]}})})},w.prototype.locateFaces=function(A,P){return P===void 0&&(P={}),Object(H.b)(this,void 0,void 0,function(){var K,oe,ve,he,_e,Re,Ne,Ue,ze,qe,it,bt,Et,Tt,It,At,vt,Ct,Bt,lr,xr;return Object(H.d)(this,function(or){switch(or.label){case 0:return K=new xo(P),oe=K.maxResults,ve=K.minConfidence,[4,Or(A)];case 1:for(he=or.sent(),_e=this.forwardInput(he),Re=_e.boxes,Ne=_e.scores,Ue=Re[0],ze=Ne[0],qe=1;qe<Re.length;qe++)Re[qe].dispose(),Ne[qe].dispose();return Et=(bt=Array).from,[4,ze.data()];case 2:return it=Et.apply(bt,[or.sent()]),Tt=.5,It=Nt(Ue,it,oe,Tt,ve),At=he.getReshapedInputDimensions(0),vt=he.inputSize,Ct=vt/At.width,Bt=vt/At.height,lr=Ue.arraySync(),xr=It.map(function(Ht){var Ut=[Math.max(0,lr[Ht][0]),Math.min(1,lr[Ht][2])].map(function(Kr){return Kr*Bt}),kr=Ut[0],dr=Ut[1],Xr=[Math.max(0,lr[Ht][1]),Math.min(1,lr[Ht][3])].map(function(Kr){return Kr*Ct}),un=Xr[0],Rt=Xr[1];return new m(it[Ht],new yt(un,kr,Rt-un,dr-kr),{height:he.getInputHeight(0),width:he.getInputWidth(0)})}),Ue.dispose(),ze.dispose(),[2,xr]}})})},w.prototype.getDefaultModelName=function(){return"ssd_mobilenetv1_model"},w.prototype.extractParamsFromWeigthMap=function(A){return Xe(A)},w.prototype.extractParams=function(A){return Ui(A)},w}(yn);function Tr(O){var w=new Mn;return w.extractWeights(O),w}function oi(O){return Tr(O)}var uc=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w}(Mn),pa=.4,Wi=[new be(.738768,.874946),new be(2.42204,2.65704),new be(4.30971,7.04493),new be(10.246,4.59428),new be(12.6868,11.8741)],$t=[new be(1.603231,2.094468),new be(6.041143,7.080126),new be(2.882459,3.518061),new be(4.266906,5.178857),new be(9.041765,10.66308)],pn=[117.001,114.697,97.404],Is="tiny_yolov2_model",Ns="tiny_yolov2_separable_conv_model",ma=function(O){return typeof O=="number"};function Ds(O){if(!O)throw new Error("invalid config: "+O);if(typeof O.withSeparableConvs!="boolean")throw new Error("config.withSeparableConvs has to be a boolean, have: "+O.withSeparableConvs);if(!ma(O.iouThreshold)||O.iouThreshold<0||O.iouThreshold>1)throw new Error("config.iouThreshold has to be a number between [0, 1], have: "+O.iouThreshold);if(!Array.isArray(O.classes)||!O.classes.length||!O.classes.every(function(w){return typeof w=="string"}))throw new Error("config.classes has to be an array class names: string[], have: "+JSON.stringify(O.classes));if(!Array.isArray(O.anchors)||!O.anchors.length||!O.anchors.map(function(w){return w||{}}).every(function(w){return ma(w.x)&&ma(w.y)}))throw new Error("config.anchors has to be an array of { x: number, y: number }, have: "+JSON.stringify(O.anchors));if(O.meanRgb&&(!Array.isArray(O.meanRgb)||O.meanRgb.length!==3||!O.meanRgb.every(ma)))throw new Error("config.meanRgb has to be an array of shape [number, number, number], have: "+JSON.stringify(O.meanRgb))}function Uo(O){return z.L(function(){var w=z.t(O,z.y(.10000000149011612));return z.c(z.w(z.F(O,w)),w)})}function Qr(O,w){return z.L(function(){var A=z.v(O,[[0,0],[1,1],[1,1],[0,0]]);return A=z.i(A,w.conv.filters,[1,1],"valid"),A=z.F(A,w.bn.sub),A=z.t(A,w.bn.truediv),A=z.c(A,w.conv.bias),Uo(A)})}function Pn(O,w){return z.L(function(){var A=z.v(O,[[0,0],[1,1],[1,1],[0,0]]);return A=z.z(A,w.depthwise_filter,w.pointwise_filter,[1,1],"valid"),A=z.c(A,w.bias),Uo(A)})}function ks(O,w){var A=$n(O,w);function P(ve,he){var _e=z.H(O(ve)),Re=z.H(O(ve));return w.push({paramPath:he+"/sub"},{paramPath:he+"/truediv"}),{sub:_e,truediv:Re}}function K(ve,he,_e){var Re=A(ve,he,3,_e+"/conv"),Ne=P(he,_e+"/bn");return{conv:Re,bn:Ne}}var oe=ia(O,w);return{extractConvParams:A,extractConvWithBatchNormParams:K,extractSeparableConvParams:oe}}function Ms(O,w,A,P){var K=dn(O),oe=K.extractWeights,ve=K.getRemainingWeights,he=[],_e=ks(oe,he),Re=_e.extractConvParams,Ne=_e.extractConvWithBatchNormParams,Ue=_e.extractSeparableConvParams,ze;if(w.withSeparableConvs){var qe=P[0],it=P[1],bt=P[2],Et=P[3],Tt=P[4],It=P[5],At=P[6],vt=P[7],Ct=P[8],Bt=w.isFirstLayerConv2d?Re(qe,it,3,"conv0"):Ue(qe,it,"conv0"),lr=Ue(it,bt,"conv1"),xr=Ue(bt,Et,"conv2"),or=Ue(Et,Tt,"conv3"),Ht=Ue(Tt,It,"conv4"),Ut=Ue(It,At,"conv5"),kr=vt?Ue(At,vt,"conv6"):void 0,dr=Ct?Ue(vt,Ct,"conv7"):void 0,Xr=Re(Ct||vt||At,5*A,1,"conv8");ze={conv0:Bt,conv1:lr,conv2:xr,conv3:or,conv4:Ht,conv5:Ut,conv6:kr,conv7:dr,conv8:Xr}}else{var qe=P[0],it=P[1],bt=P[2],Et=P[3],Tt=P[4],It=P[5],At=P[6],vt=P[7],Ct=P[8],Bt=Ne(qe,it,"conv0"),lr=Ne(it,bt,"conv1"),xr=Ne(bt,Et,"conv2"),or=Ne(Et,Tt,"conv3"),Ht=Ne(Tt,It,"conv4"),Ut=Ne(It,At,"conv5"),kr=Ne(At,vt,"conv6"),dr=Ne(vt,Ct,"conv7"),Xr=Re(Ct,5*A,1,"conv8");ze={conv0:Bt,conv1:lr,conv2:xr,conv3:or,conv4:Ht,conv5:Ut,conv6:kr,conv7:dr,conv8:Xr}}if(ve().length!==0)throw new Error("weights remaing after extract: "+ve().length);return{params:ze,paramMappings:he}}function Ps(O,w){var A=On(O,w);function P(he){var _e=A(he+"/sub",1),Re=A(he+"/truediv",1);return{sub:_e,truediv:Re}}function K(he){var _e=A(he+"/filters",4),Re=A(he+"/bias",1);return{filters:_e,bias:Re}}function oe(he){var _e=K(he+"/conv"),Re=P(he+"/bn");return{conv:_e,bn:Re}}var ve=sa(A);return{extractConvParams:K,extractConvWithBatchNormParams:oe,extractSeparableConvParams:ve}}function Fs(O,w){var A=[],P=Ps(O,A),K=P.extractConvParams,oe=P.extractConvWithBatchNormParams,ve=P.extractSeparableConvParams,he;if(w.withSeparableConvs){var _e=w.filterSizes&&w.filterSizes.length||9;he={conv0:w.isFirstLayerConv2d?K("conv0"):ve("conv0"),conv1:ve("conv1"),conv2:ve("conv2"),conv3:ve("conv3"),conv4:ve("conv4"),conv5:ve("conv5"),conv6:_e>7?ve("conv6"):void 0,conv7:_e>8?ve("conv7"):void 0,conv8:K("conv8")}}else he={conv0:oe("conv0"),conv1:oe("conv1"),conv2:oe("conv2"),conv3:oe("conv3"),conv4:oe("conv4"),conv5:oe("conv5"),conv6:oe("conv6"),conv7:oe("conv7"),conv8:K("conv8")};return bn(O,A),{params:he,paramMappings:A}}var Hi;(function(O){O[O.XS=224]="XS",O[O.SM=320]="SM",O[O.MD=416]="MD",O[O.LG=608]="LG"})(Hi||(Hi={}));var En=function(){function O(w){var A=w===void 0?{}:w,P=A.inputSize,K=A.scoreThreshold;if(this._name="TinyYolov2Options",this._inputSize=P||416,this._scoreThreshold=K||.5,typeof this._inputSize!="number"||this._inputSize%32!==0)throw new Error(this._name+" - expected inputSize to be a number divisible by 32");if(typeof this._scoreThreshold!="number"||this._scoreThreshold<=0||this._scoreThreshold>=1)throw new Error(this._name+" - expected scoreThreshold to be a number between 0 and 1")}return Object.defineProperty(O.prototype,"inputSize",{get:function(){return this._inputSize},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"scoreThreshold",{get:function(){return this._scoreThreshold},enumerable:!0,configurable:!0}),O}(),Wo=function(O){Object(H.c)(w,O);function w(A){var P=O.call(this,"TinyYolov2")||this;return Ds(A),P._config=A,P}return Object.defineProperty(w.prototype,"config",{get:function(){return this._config},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"withClassScores",{get:function(){return this.config.withClassScores||this.config.classes.length>1},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"boxEncodingSize",{get:function(){return 5+(this.withClassScores?this.config.classes.length:0)},enumerable:!0,configurable:!0}),w.prototype.runTinyYolov2=function(A,P){var K=Qr(A,P.conv0);return K=z.s(K,[2,2],[2,2],"same"),K=Qr(K,P.conv1),K=z.s(K,[2,2],[2,2],"same"),K=Qr(K,P.conv2),K=z.s(K,[2,2],[2,2],"same"),K=Qr(K,P.conv3),K=z.s(K,[2,2],[2,2],"same"),K=Qr(K,P.conv4),K=z.s(K,[2,2],[2,2],"same"),K=Qr(K,P.conv5),K=z.s(K,[2,2],[1,1],"same"),K=Qr(K,P.conv6),K=Qr(K,P.conv7),on(K,P.conv8,"valid",!1)},w.prototype.runMobilenet=function(A,P){var K=this.config.isFirstLayerConv2d?Uo(on(A,P.conv0,"valid",!1)):Pn(A,P.conv0);return K=z.s(K,[2,2],[2,2],"same"),K=Pn(K,P.conv1),K=z.s(K,[2,2],[2,2],"same"),K=Pn(K,P.conv2),K=z.s(K,[2,2],[2,2],"same"),K=Pn(K,P.conv3),K=z.s(K,[2,2],[2,2],"same"),K=Pn(K,P.conv4),K=z.s(K,[2,2],[2,2],"same"),K=Pn(K,P.conv5),K=z.s(K,[2,2],[1,1],"same"),K=P.conv6?Pn(K,P.conv6):K,K=P.conv7?Pn(K,P.conv7):K,on(K,P.conv8,"valid",!1)},w.prototype.forwardInput=function(A,P){var K=this,oe=this.params;if(!oe)throw new Error("TinyYolov2 - load model before inference");return z.L(function(){var ve=A.toBatchTensor(P,!1).toFloat();return ve=K.config.meanRgb?pe(ve,K.config.meanRgb):ve,ve=ve.div(z.y(256)),K.config.withSeparableConvs?K.runMobilenet(ve,oe):K.runTinyYolov2(ve,oe)})},w.prototype.forward=function(A,P){return Object(H.b)(this,void 0,void 0,function(){var K;return Object(H.d)(this,function(oe){switch(oe.label){case 0:return K=this.forwardInput,[4,Or(A)];case 1:return[4,K.apply(this,[oe.sent(),P])];case 2:return[2,oe.sent()]}})})},w.prototype.detect=function(A,P){return P===void 0&&(P={}),Object(H.b)(this,void 0,void 0,function(){var K,oe,ve,he,_e,Re,Ne,Ue,ze,qe,it,bt,Et,Tt,It=this;return Object(H.d)(this,function(At){switch(At.label){case 0:return K=new En(P),oe=K.inputSize,ve=K.scoreThreshold,[4,Or(A)];case 1:return he=At.sent(),[4,this.forwardInput(he,oe)];case 2:return _e=At.sent(),Re=z.L(function(){return z.O(_e)[0].expandDims()}),Ne={width:he.getInputWidth(0),height:he.getInputHeight(0)},[4,this.extractBoxes(Re,he.getReshapedInputDimensions(0),ve)];case 3:return Ue=At.sent(),_e.dispose(),Re.dispose(),ze=Ue.map(function(vt){return vt.box}),qe=Ue.map(function(vt){return vt.score}),it=Ue.map(function(vt){return vt.classScore}),bt=Ue.map(function(vt){return It.config.classes[vt.label]}),Et=fe(ze.map(function(vt){return vt.rescale(oe)}),qe,this.config.iouThreshold,!0),Tt=Et.map(function(vt){return new q(qe[vt],it[vt],bt[vt],ze[vt],Ne)}),[2,Tt]}})})},w.prototype.getDefaultModelName=function(){return""},w.prototype.extractParamsFromWeigthMap=function(A){return Fs(A,this.config)},w.prototype.extractParams=function(A){var P=this.config.filterSizes||w.DEFAULT_FILTER_SIZES,K=P?P.length:void 0;if(K!==7&&K!==8&&K!==9)throw new Error("TinyYolov2 - expected 7 | 8 | 9 convolutional filters, but found "+K+" filterSizes in config");return Ms(A,this.config,this.boxEncodingSize,P)},w.prototype.extractBoxes=function(A,P,K){return Object(H.b)(this,void 0,void 0,function(){var oe,ve,he,_e,Re,Ne,Ue,ze,qe,it,bt,Et,Tt,It,At,vt,Ct,Bt,lr,xr,or,Ht,Ut,kr,dr,Xr,un,Rt,Kr,fr=this;return Object(H.d)(this,function(_r){switch(_r.label){case 0:return oe=P.width,ve=P.height,he=Math.max(oe,ve),_e=he/oe,Re=he/ve,Ne=A.shape[1],Ue=this.config.anchors.length,ze=z.L(function(){var Un=A.reshape([Ne,Ne,Ue,fr.boxEncodingSize]),Cn=Un.slice([0,0,0,0],[Ne,Ne,Ue,4]),Yo=Un.slice([0,0,0,4],[Ne,Ne,Ue,1]),So=fr.withClassScores?z.D(Un.slice([0,0,0,5],[Ne,Ne,Ue,fr.config.classes.length]),3):z.y(0);return[Cn,Yo,So]}),qe=ze[0],it=ze[1],bt=ze[2],Et=[],[4,it.array()];case 1:return Tt=_r.sent(),[4,qe.array()];case 2:It=_r.sent(),At=0,_r.label=3;case 3:if(!(At<Ne))return[3,12];vt=0,_r.label=4;case 4:if(!(vt<Ne))return[3,11];Ct=0,_r.label=5;case 5:return Ct<Ue?(Bt=nt(Tt[At][vt][Ct][0]),!K||Bt>K?(lr=(vt+nt(It[At][vt][Ct][0]))/Ne*_e,xr=(At+nt(It[At][vt][Ct][1]))/Ne*Re,or=Math.exp(It[At][vt][Ct][2])*this.config.anchors[Ct].x/Ne*_e,Ht=Math.exp(It[At][vt][Ct][3])*this.config.anchors[Ct].y/Ne*Re,Ut=lr-or/2,kr=xr-Ht/2,dr={row:At,col:vt,anchor:Ct},this.withClassScores?[4,this.extractPredictedClass(bt,dr)]:[3,7]):[3,9]):[3,10];case 6:return Kr=_r.sent(),[3,8];case 7:Kr={classScore:1,label:0},_r.label=8;case 8:Xr=Kr,un=Xr.classScore,Rt=Xr.label,Et.push(Object(H.a)({box:new $e(Ut,kr,Ut+or,kr+Ht),score:Bt,classScore:Bt*un,label:Rt},dr)),_r.label=9;case 9:return Ct++,[3,5];case 10:return vt++,[3,4];case 11:return At++,[3,3];case 12:return qe.dispose(),it.dispose(),bt.dispose(),[2,Et]}})})},w.prototype.extractPredictedClass=function(A,P){return Object(H.b)(this,void 0,void 0,function(){var K,oe,ve,he;return Object(H.d)(this,function(_e){switch(_e.label){case 0:return K=P.row,oe=P.col,ve=P.anchor,[4,A.array()];case 1:return he=_e.sent(),[2,Array(this.config.classes.length).fill(0).map(function(Re,Ne){return he[K][oe][ve][Ne]}).map(function(Re,Ne){return{classScore:Re,label:Ne}}).reduce(function(Re,Ne){return Re.classScore>Ne.classScore?Re:Ne})]}})})},w.DEFAULT_FILTER_SIZES=[3,16,32,64,128,256,512,1024,1024],w}(yn),va=function(O){Object(H.c)(w,O);function w(A){A===void 0&&(A=!0);var P=this,K=Object.assign({},{withSeparableConvs:A,iouThreshold:pa,classes:["face"]},A?{anchors:$t,meanRgb:pn}:{anchors:Wi,withClassScores:!0});return P=O.call(this,K)||this,P}return Object.defineProperty(w.prototype,"withSeparableConvs",{get:function(){return this.config.withSeparableConvs},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"anchors",{get:function(){return this.config.anchors},enumerable:!0,configurable:!0}),w.prototype.locateFaces=function(A,P){return Object(H.b)(this,void 0,void 0,function(){var K;return Object(H.d)(this,function(oe){switch(oe.label){case 0:return[4,this.detect(A,P)];case 1:return K=oe.sent(),[2,K.map(function(ve){return new m(ve.score,ve.relativeBox,{width:ve.imageWidth,height:ve.imageHeight})})]}})})},w.prototype.getDefaultModelName=function(){return this.withSeparableConvs?Ns:Is},w.prototype.extractParamsFromWeigthMap=function(A){return O.prototype.extractParamsFromWeigthMap.call(this,A)},w}(Wo);function cc(O,w){w===void 0&&(w=!0);var A=new va(w);return A.extractWeights(O),A}var zi=function(O){Object(H.c)(w,O);function w(){var A=O!==null&&O.apply(this,arguments)||this;return A._name="TinyFaceDetectorOptions",A}return w}(En),Lt=function(){function O(){}return O.prototype.then=function(w){return Object(H.b)(this,void 0,void 0,function(){var A;return Object(H.d)(this,function(P){switch(P.label){case 0:return A=w,[4,this.run()];case 1:return[2,A.apply(void 0,[P.sent()])]}})})},O.prototype.run=function(){return Object(H.b)(this,void 0,void 0,function(){return Object(H.d)(this,function(w){throw new Error("ComposableTask - run is not implemented")})})},O}();function ga(O,w,A,P,K){return K===void 0&&(K=function(oe){var ve=oe.alignedRect;return ve}),Object(H.b)(this,void 0,void 0,function(){var oe,ve,he,_e,Re;return Object(H.d)(this,function(Ne){switch(Ne.label){case 0:return oe=O.map(function(Ue){return da(Ue)?K(Ue):Ue.detection}),he=P,he?[3,5]:w instanceof z.a?[4,Fo(w,oe)]:[3,2];case 1:return _e=Ne.sent(),[3,4];case 2:return[4,Yn(w,oe)];case 3:_e=Ne.sent(),Ne.label=4;case 4:he=_e,Ne.label=5;case 5:return ve=he,[4,A(ve)];case 6:return Re=Ne.sent(),ve.forEach(function(Ue){return Ue instanceof z.a&&Ue.dispose()}),[2,Re]}})})}function ya(O,w,A,P,K){return Object(H.b)(this,void 0,void 0,function(){var oe=this;return Object(H.d)(this,function(ve){return[2,ga([O],w,function(he){return Object(H.b)(oe,void 0,void 0,function(){return Object(H.d)(this,function(_e){return[2,A(he[0])]})})},P,K)]})})}function Ls(O){return z.L(function(){return z.E(z.O(O,3).reverse(),3)})}var ba=2,xa=12;function js(O,w){var A=$n(O,w),P=aa(O,w);function K(Re,Ne){var Ue=z.H(O(Re));return w.push({paramPath:Ne}),Ue}function oe(Re,Ne,Ue){Ue===void 0&&(Ue=!1);var ze=A(Re[0],Re[1],3,Ne+"/conv1"),qe=K(Re[1],Ne+"/prelu1_alpha"),it=A(Re[1],Re[2],3,Ne+"/conv2"),bt=K(Re[2],Ne+"/prelu2_alpha"),Et=A(Re[2],Re[3],Ue?2:3,Ne+"/conv3"),Tt=K(Re[3],Ne+"/prelu3_alpha");return{conv1:ze,prelu1_alpha:qe,conv2:it,prelu2_alpha:bt,conv3:Et,prelu3_alpha:Tt}}function ve(){var Re=oe([3,10,16,32],"pnet"),Ne=A(32,2,1,"pnet/conv4_1"),Ue=A(32,4,1,"pnet/conv4_2");return Object(H.a)(Object(H.a)({},Re),{conv4_1:Ne,conv4_2:Ue})}function he(){var Re=oe([3,28,48,64],"rnet",!0),Ne=P(576,128,"rnet/fc1"),Ue=K(128,"rnet/prelu4_alpha"),ze=P(128,2,"rnet/fc2_1"),qe=P(128,4,"rnet/fc2_2");return Object(H.a)(Object(H.a)({},Re),{fc1:Ne,prelu4_alpha:Ue,fc2_1:ze,fc2_2:qe})}function _e(){var Re=oe([3,32,64,64],"onet"),Ne=A(64,128,2,"onet/conv4"),Ue=K(128,"onet/prelu4_alpha"),ze=P(1152,256,"onet/fc1"),qe=K(256,"onet/prelu5_alpha"),it=P(256,2,"onet/fc2_1"),bt=P(256,4,"onet/fc2_2"),Et=P(256,10,"onet/fc2_3");return Object(H.a)(Object(H.a)({},Re),{conv4:Ne,prelu4_alpha:Ue,fc1:ze,prelu5_alpha:qe,fc2_1:it,fc2_2:bt,fc2_3:Et})}return{extractPNetParams:ve,extractRNetParams:he,extractONetParams:_e}}function Bs(O){var w=dn(O),A=w.extractWeights,P=w.getRemainingWeights,K=[],oe=js(A,K),ve=oe.extractPNetParams,he=oe.extractRNetParams,_e=oe.extractONetParams,Re=ve(),Ne=he(),Ue=_e();if(P().length!==0)throw new Error("weights remaing after extract: "+P().length);return{params:{pnet:Re,rnet:Ne,onet:Ue},paramMappings:K}}function In(O,w){var A=On(O,w);function P(Ne){var Ue=A(Ne+"/weights",4,Ne+"/filters"),ze=A(Ne+"/bias",1);return{filters:Ue,bias:ze}}function K(Ne){var Ue=A(Ne+"/weights",2),ze=A(Ne+"/bias",1);return{weights:Ue,bias:ze}}function oe(Ne){return A(Ne,1)}function ve(Ne){var Ue=P(Ne+"/conv1"),ze=oe(Ne+"/prelu1_alpha"),qe=P(Ne+"/conv2"),it=oe(Ne+"/prelu2_alpha"),bt=P(Ne+"/conv3"),Et=oe(Ne+"/prelu3_alpha");return{conv1:Ue,prelu1_alpha:ze,conv2:qe,prelu2_alpha:it,conv3:bt,prelu3_alpha:Et}}function he(){var Ne=ve("pnet"),Ue=P("pnet/conv4_1"),ze=P("pnet/conv4_2");return Object(H.a)(Object(H.a)({},Ne),{conv4_1:Ue,conv4_2:ze})}function _e(){var Ne=ve("rnet"),Ue=K("rnet/fc1"),ze=oe("rnet/prelu4_alpha"),qe=K("rnet/fc2_1"),it=K("rnet/fc2_2");return Object(H.a)(Object(H.a)({},Ne),{fc1:Ue,prelu4_alpha:ze,fc2_1:qe,fc2_2:it})}function Re(){var Ne=ve("onet"),Ue=P("onet/conv4"),ze=oe("onet/prelu4_alpha"),qe=K("onet/fc1"),it=oe("onet/prelu5_alpha"),bt=K("onet/fc2_1"),Et=K("onet/fc2_2"),Tt=K("onet/fc2_3");return Object(H.a)(Object(H.a)({},Ne),{conv4:Ue,prelu4_alpha:ze,fc1:qe,prelu5_alpha:it,fc2_1:bt,fc2_2:Et,fc2_3:Tt})}return{extractPNetParams:he,extractRNetParams:_e,extractONetParams:Re}}function Gi(O){var w=[],A=In(O,w),P=A.extractPNetParams,K=A.extractRNetParams,oe=A.extractONetParams,ve=P(),he=K(),_e=oe();return bn(O,w),{params:{pnet:ve,rnet:he,onet:_e},paramMappings:w}}function ai(O,w){var A=w[0],P=w[1];return{height:Math.floor(A*O),width:Math.floor(P*O)}}function ii(O,w,A){for(var P=A[0],K=A[1],oe=xa/O,ve=[],he=Math.min(P,K)*oe,_e=0;he>=12;)ve.push(oe*Math.pow(w,_e)),he=he*w,_e+=1;return ve}var Fn=function(O){Object(H.c)(w,O);function w(A,P,K,oe){return O.call(this,{left:A,top:P,right:K,bottom:oe},!0)||this}return w}(ye);function Vi(O){return z.L(function(){return z.t(z.F(O,z.y(127.5)),z.y(.0078125))})}function wo(O,w){return z.L(function(){return z.c(z.w(O),z.t(w,z.u(z.w(z.u(O)))))})}function si(O,w,A){return A===void 0&&(A=!1),z.L(function(){var P=on(O,w.conv1,"valid");return P=wo(P,w.prelu1_alpha),P=z.s(P,A?[2,2]:[3,3],[2,2],"same"),P=on(P,w.conv2,"valid"),P=wo(P,w.prelu2_alpha),P=A?P:z.s(P,[3,3],[2,2],"valid"),P=on(P,w.conv3,"valid"),P=wo(P,w.prelu3_alpha),P})}function Us(O,w){return z.L(function(){var A=si(O,w,!0),P=on(A,w.conv4_1,"valid"),K=z.m(z.r(P,3),3),oe=z.D(z.F(P,K),3),ve=on(A,w.conv4_2,"valid");return{prob:oe,regions:ve}})}function Ws(O,w){return z.L(function(){var A=ai(w,O.shape.slice(1)),P=A.height,K=A.width,oe=z.o.resizeBilinear(O,[P,K]),ve=Vi(oe);return z.N(ve,[0,2,1,3])})}function Hs(O,w,A,P){for(var K=[],oe=O.arraySync(),ve=0;ve<O.shape[0];ve++)for(var he=0;he<O.shape[1];he++)oe[ve][he]>=P&&K.push(new be(he,ve));var _e=K.map(function(Re){var Ne=new $e(Math.round((Re.y*ba+1)/A),Math.round((Re.x*ba+1)/A),Math.round((Re.y*ba+xa)/A),Math.round((Re.x*ba+xa)/A)),Ue=oe[Re.y][Re.x],ze=w.arraySync(),qe=new Fn(ze[Re.y][Re.x][0],ze[Re.y][Re.x][1],ze[Re.y][Re.x][2],ze[Re.y][Re.x][3]);return{cell:Ne,score:Ue,region:qe}});return _e}function zs(O,w,A,P,K){K.stage1=[];var oe=w.map(function(ze){return z.L(function(){var qe={scale:ze},it=Ws(O,ze),bt=Date.now(),Et=Us(it,P),Tt=Et.prob,It=Et.regions;qe.pnet=Date.now()-bt;var At=z.O(z.O(Tt,3)[1])[0],vt=z.O(It)[0];return{scoresTensor:At,regionsTensor:vt,scale:ze,statsForScale:qe}})}),ve=oe.map(function(ze){var qe=ze.scoresTensor,it=ze.regionsTensor,bt=ze.scale,Et=ze.statsForScale,Tt=Hs(qe,it,bt,A);if(qe.dispose(),it.dispose(),!Tt.length)return K.stage1.push(Et),[];var It=Date.now(),At=fe(Tt.map(function(vt){return vt.cell}),Tt.map(function(vt){return vt.score}),.5);return Et.nms=Date.now()-It,Et.numBoxes=At.length,K.stage1.push(Et),At.map(function(vt){return Tt[vt]})}),he=ve.reduce(function(ze,qe){return ze.concat(qe)},[]),_e=[],Re=[];if(he.length>0){var Ne=Date.now(),Ue=fe(he.map(function(ze){return ze.cell}),he.map(function(ze){return ze.score}),.7);K.stage1_nms=Date.now()-Ne,Re=Ue.map(function(ze){return he[ze].score}),_e=Ue.map(function(ze){return he[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:_e,scores:Re}}function ui(O,w,A){var P=A.width,K=A.height;return Object(H.b)(this,void 0,void 0,function(){var oe,ve,he,_e=this;return Object(H.d)(this,function(Re){switch(Re.label){case 0:return oe=rn(O),[4,Promise.all(w.map(function(Ne){return Object(H.b)(_e,void 0,void 0,function(){var Ue,ze,qe,it,bt,Et,Tt,It;return Object(H.d)(this,function(At){return Ue=Ne.padAtBorders(O.height,O.width),ze=Ue.y,qe=Ue.ey,it=Ue.x,bt=Ue.ex,Et=it-1,Tt=ze-1,It=oe.getImageData(Et,Tt,bt-Et,qe-Tt),[2,pr.isNodejs()?An(It):createImageBitmap(It)]})})}))];case 1:return ve=Re.sent(),he=[],ve.forEach(function(Ne){var Ue=Hr({width:P,height:K}),ze=rn(Ue);ze.drawImage(Ne,0,0,P,K);for(var qe=ze.getImageData(0,0,P,K).data,it=[],bt=0;bt<qe.length;bt+=4)it.push(qe[bt+2]),it.push(qe[bt+1]),it.push(qe[bt]);he.push(it)}),[2,he.map(function(Ne){var Ue=z.L(function(){var ze=z.N(z.K(Ne,[1,P,K,3]),[0,2,1,3]).toFloat();return Vi(ze)});return Ue})]}})})}function wa(O,w){return z.L(function(){var A=si(O,w),P=z.x(A,[A.shape[0],w.fc1.weights.shape[0]]),K=$r(P,w.fc1),oe=wo(K,w.prelu4_alpha),ve=$r(oe,w.fc2_1),he=z.m(z.r(ve,1),1),_e=z.D(z.F(ve,he),1),Re=$r(oe,w.fc2_2),Ne=z.O(_e,1)[1];return{scores:Ne,regions:Re}})}function Xi(O,w,A,P,K){return Object(H.b)(this,void 0,void 0,function(){var oe,ve,he,_e,Re,Ne,Ue,ze,qe,it,bt,Et,Tt,It;return Object(H.d)(this,function(At){switch(At.label){case 0:return oe=Date.now(),[4,ui(O,w,{width:24,height:24})];case 1:return ve=At.sent(),K.stage2_extractImagePatches=Date.now()-oe,oe=Date.now(),he=ve.map(function(vt){var Ct=wa(vt,P);return vt.dispose(),Ct}),K.stage2_rnet=Date.now()-oe,_e=he.length>1?z.h(he.map(function(vt){return vt.scores})):he[0].scores,Ue=(Ne=Array).from,[4,_e.data()];case 2:return Re=Ue.apply(Ne,[At.sent()]),_e.dispose(),ze=Re.map(function(vt,Ct){return{score:vt,idx:Ct}}).filter(function(vt){return vt.score>A}).map(function(vt){var Ct=vt.idx;return Ct}),qe=ze.map(function(vt){return w[vt]}),it=ze.map(function(vt){return Re[vt]}),bt=[],Et=[],qe.length>0&&(oe=Date.now(),Tt=fe(qe,it,.7),K.stage2_nms=Date.now()-oe,It=Tt.map(function(vt){var Ct=he[ze[vt]].regions.arraySync();return new Fn(Ct[0][0],Ct[0][1],Ct[0][2],Ct[0][3])}),Et=Tt.map(function(vt){return it[vt]}),bt=Tt.map(function(vt,Ct){return qe[vt].calibrate(It[Ct])})),he.forEach(function(vt){vt.regions.dispose(),vt.scores.dispose()}),[2,{boxes:bt,scores:Et}]}})})}function Ki(O,w){return z.L(function(){var A=si(O,w);A=z.s(A,[2,2],[2,2],"same"),A=on(A,w.conv4,"valid"),A=wo(A,w.prelu4_alpha);var P=z.x(A,[A.shape[0],w.fc1.weights.shape[0]]),K=$r(P,w.fc1),oe=wo(K,w.prelu5_alpha),ve=$r(oe,w.fc2_1),he=z.m(z.r(ve,1),1),_e=z.D(z.F(ve,he),1),Re=$r(oe,w.fc2_2),Ne=$r(oe,w.fc2_3),Ue=z.O(_e,1)[1];return{scores:Ue,regions:Re,points:Ne}})}function Ln(O,w,A,P,K){return Object(H.b)(this,void 0,void 0,function(){var oe,ve,he,_e,Re,Ne,Ue,ze,qe,it,bt,Et,Tt,It,At;return Object(H.d)(this,function(vt){switch(vt.label){case 0:return oe=Date.now(),[4,ui(O,w,{width:48,height:48})];case 1:return ve=vt.sent(),K.stage3_extractImagePatches=Date.now()-oe,oe=Date.now(),he=ve.map(function(Ct){var Bt=Ki(Ct,P);return Ct.dispose(),Bt}),K.stage3_onet=Date.now()-oe,_e=he.length>1?z.h(he.map(function(Ct){return Ct.scores})):he[0].scores,Ue=(Ne=Array).from,[4,_e.data()];case 2:return Re=Ue.apply(Ne,[vt.sent()]),_e.dispose(),ze=Re.map(function(Ct,Bt){return{score:Ct,idx:Bt}}).filter(function(Ct){return Ct.score>A}).map(function(Ct){var Bt=Ct.idx;return Bt}),qe=ze.map(function(Ct){var Bt=he[Ct].regions.arraySync();return new Fn(Bt[0][0],Bt[0][1],Bt[0][2],Bt[0][3])}),it=ze.map(function(Ct,Bt){return w[Ct].calibrate(qe[Bt])}),bt=ze.map(function(Ct){return Re[Ct]}),Et=[],Tt=[],It=[],it.length>0&&(oe=Date.now(),At=fe(it,bt,.7,!1),K.stage3_nms=Date.now()-oe,Et=At.map(function(Ct){return it[Ct]}),Tt=At.map(function(Ct){return bt[Ct]}),It=At.map(function(Ct,Bt){return Array(5).fill(0).map(function(lr,xr){var or=he[Ct].points.arraySync();return new be(or[0][xr]*(Et[Bt].width+1)+Et[Bt].left,or[0][xr+5]*(Et[Bt].height+1)+Et[Bt].top)})})),he.forEach(function(Ct){Ct.regions.dispose(),Ct.scores.dispose(),Ct.points.dispose()}),[2,{boxes:Et,scores:Tt,points:It}]}})})}var Zn=function(O){Object(H.c)(w,O);function w(){return O.call(this,"Mtcnn")||this}return w.prototype.load=function(A){return Object(H.b)(this,void 0,void 0,function(){return Object(H.d)(this,function(P){return console.warn("mtcnn is deprecated and will be removed soon"),[2,O.prototype.load.call(this,A)]})})},w.prototype.loadFromDisk=function(A){return Object(H.b)(this,void 0,void 0,function(){return Object(H.d)(this,function(P){return console.warn("mtcnn is deprecated and will be removed soon"),[2,O.prototype.loadFromDisk.call(this,A)]})})},w.prototype.forwardInput=function(A,P){return P===void 0&&(P={}),Object(H.b)(this,void 0,void 0,function(){var K,oe,ve,he,_e,Re,Ne,Ue,ze,qe,it,bt,Et,Tt,It,At,vt,Ct,Bt,lr,xr;return Object(H.d)(this,function(or){switch(or.label){case 0:if(K=this.params,!K)throw new Error("Mtcnn - load model before inference");if(oe=A.canvases[0],!oe)throw new Error("Mtcnn - inputCanvas is not defined, note that passing tensors into Mtcnn.forwardInput is not supported yet.");return ve={},he=Date.now(),_e=z.L(function(){return Ls(z.m(z.f.fromPixels(oe)).toFloat())}),Re=function(Ht){return _e.dispose(),ve.total=Date.now()-he,Ht},Ne=_e.shape.slice(1),Ue=Ne[0],ze=Ne[1],qe=new yo(P),it=qe.minFaceSize,bt=qe.scaleFactor,Et=qe.maxNumScales,Tt=qe.scoreThresholds,It=qe.scaleSteps,At=(It||ii(it,bt,[Ue,ze])).filter(function(Ht){var Ut=ai(Ht,[Ue,ze]);return Math.min(Ut.width,Ut.height)>xa}).slice(0,Et),ve.scales=At,ve.pyramid=At.map(function(Ht){return ai(Ht,[Ue,ze])}),vt=Date.now(),[4,zs(_e,At,Tt[0],K.pnet,ve)];case 1:return Ct=or.sent(),ve.total_stage1=Date.now()-vt,Ct.boxes.length?(ve.stage2_numInputBoxes=Ct.boxes.length,vt=Date.now(),[4,Xi(oe,Ct.boxes,Tt[1],K.rnet,ve)]):[2,Re({results:[],stats:ve})];case 2:return Bt=or.sent(),ve.total_stage2=Date.now()-vt,Bt.boxes.length?(ve.stage3_numInputBoxes=Bt.boxes.length,vt=Date.now(),[4,Ln(oe,Bt.boxes,Tt[2],K.onet,ve)]):[2,Re({results:[],stats:ve})];case 3:return lr=or.sent(),ve.total_stage3=Date.now()-vt,xr=lr.boxes.map(function(Ht,Ut){return jo(tt({},new m(lr.scores[Ut],new yt(Ht.left/ze,Ht.top/Ue,Ht.width/ze,Ht.height/Ue),{height:Ue,width:ze})),new jt(lr.points[Ut].map(function(kr){return kr.sub(new be(Ht.left,Ht.top)).div(new be(Ht.width,Ht.height))}),{width:Ht.width,height:Ht.height}))}),[2,Re({results:xr,stats:ve})]}})})},w.prototype.forward=function(A,P){return P===void 0&&(P={}),Object(H.b)(this,void 0,void 0,function(){var K;return Object(H.d)(this,function(oe){switch(oe.label){case 0:return K=this.forwardInput,[4,Or(A)];case 1:return[4,K.apply(this,[oe.sent(),P])];case 2:return[2,oe.sent().results]}})})},w.prototype.forwardWithStats=function(A,P){return P===void 0&&(P={}),Object(H.b)(this,void 0,void 0,function(){var K;return Object(H.d)(this,function(oe){switch(oe.label){case 0:return K=this.forwardInput,[4,Or(A)];case 1:return[2,K.apply(this,[oe.sent(),P])]}})})},w.prototype.getDefaultModelName=function(){return"mtcnn_model"},w.prototype.extractParamsFromWeigthMap=function(A){return Gi(A)},w.prototype.extractParams=function(A){return Bs(A)},w}(yn),Gs=.4,Ea=[new be(1.603231,2.094468),new be(6.041143,7.080126),new be(2.882459,3.518061),new be(4.266906,5.178857),new be(9.041765,10.66308)],Vs=[117.001,114.697,97.404],Ho=function(O){Object(H.c)(w,O);function w(){var A=this,P={withSeparableConvs:!0,iouThreshold:Gs,classes:["face"],anchors:Ea,meanRgb:Vs,isFirstLayerConv2d:!0,filterSizes:[3,16,32,64,128,256,512]};return A=O.call(this,P)||this,A}return Object.defineProperty(w.prototype,"anchors",{get:function(){return this.config.anchors},enumerable:!0,configurable:!0}),w.prototype.locateFaces=function(A,P){return Object(H.b)(this,void 0,void 0,function(){var K;return Object(H.d)(this,function(oe){switch(oe.label){case 0:return[4,this.detect(A,P)];case 1:return K=oe.sent(),[2,K.map(function(ve){return new m(ve.score,ve.relativeBox,{width:ve.imageWidth,height:ve.imageHeight})})]}})})},w.prototype.getDefaultModelName=function(){return"tiny_face_detector_model"},w.prototype.extractParamsFromWeigthMap=function(A){return O.prototype.extractParamsFromWeigthMap.call(this,A)},w}(Wo),Jt={ssdMobilenetv1:new Mn,tinyFaceDetector:new Ho,tinyYolov2:new va,mtcnn:new Zn,faceLandmark68Net:new Rr,faceLandmark68TinyNet:new nc,faceRecognitionNet:new go,faceExpressionNet:new Ni,ageGenderNet:new tc},_a=function(O,w){return Jt.ssdMobilenetv1.locateFaces(O,w)},Xs=function(O,w){return Jt.tinyFaceDetector.locateFaces(O,w)},Ks=function(O,w){return Jt.tinyYolov2.locateFaces(O,w)},Yi=function(O,w){return Jt.mtcnn.forward(O,w)},lc=function(O){return Jt.faceLandmark68Net.detectLandmarks(O)},$i=function(O){return Jt.faceLandmark68TinyNet.detectLandmarks(O)},ci=function(O){return Jt.faceRecognitionNet.computeFaceDescriptor(O)},Ys=function(O){return Jt.faceExpressionNet.predictExpressions(O)},$s=function(O){return Jt.ageGenderNet.predictAgeAndGender(O)},zo=function(O){return Jt.ssdMobilenetv1.load(O)},dc=function(O){return Jt.tinyFaceDetector.load(O)},Js=function(O){return Jt.mtcnn.load(O)},Ji=function(O){return Jt.tinyYolov2.load(O)},Ca=function(O){return Jt.faceLandmark68Net.load(O)},Qs=function(O){return Jt.faceLandmark68TinyNet.load(O)},qi=function(O){return Jt.faceRecognitionNet.load(O)},Qi=function(O){return Jt.faceExpressionNet.load(O)},Zi=function(O){return Jt.ageGenderNet.load(O)},id=zo,sd=_a,ud=lc,Zs=function(O){Object(H.c)(w,O);function w(A,P,K){var oe=O.call(this)||this;return oe.parentTask=A,oe.input=P,oe.extractedFaces=K,oe}return w}(Lt),es=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(H.b)(this,void 0,void 0,function(){var A,P,K=this;return Object(H.d)(this,function(oe){switch(oe.label){case 0:return[4,this.parentTask];case 1:return A=oe.sent(),[4,ga(A,this.input,function(ve){return Object(H.b)(K,void 0,void 0,function(){return Object(H.d)(this,function(he){switch(he.label){case 0:return[4,Promise.all(ve.map(function(_e){return Jt.faceExpressionNet.predictExpressions(_e)}))];case 1:return[2,he.sent()]}})})},this.extractedFaces)];case 2:return P=oe.sent(),[2,A.map(function(ve,he){return vo(ve,P[he])})]}})})},w.prototype.withAgeAndGender=function(){return new di(this,this.input)},w}(Zs),li=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(H.b)(this,void 0,void 0,function(){var A,P;return Object(H.d)(this,function(K){switch(K.label){case 0:return[4,this.parentTask];case 1:return A=K.sent(),A?[4,ya(A,this.input,function(oe){return Jt.faceExpressionNet.predictExpressions(oe)},this.extractedFaces)]:[2];case 2:return P=K.sent(),[2,vo(A,P)]}})})},w.prototype.withAgeAndGender=function(){return new Ta(this,this.input)},w}(Zs),Eo=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.withAgeAndGender=function(){return new Sa(this,this.input)},w.prototype.withFaceDescriptors=function(){return new Ir(this,this.input)},w}(es),_o=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.withAgeAndGender=function(){return new rt(this,this.input)},w.prototype.withFaceDescriptor=function(){return new Wt(this,this.input)},w}(li),Go=function(O){Object(H.c)(w,O);function w(A,P,K){var oe=O.call(this)||this;return oe.parentTask=A,oe.input=P,oe.extractedFaces=K,oe}return w}(Lt),di=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(H.b)(this,void 0,void 0,function(){var A,P,K=this;return Object(H.d)(this,function(oe){switch(oe.label){case 0:return[4,this.parentTask];case 1:return A=oe.sent(),[4,ga(A,this.input,function(ve){return Object(H.b)(K,void 0,void 0,function(){return Object(H.d)(this,function(he){switch(he.label){case 0:return[4,Promise.all(ve.map(function(_e){return Jt.ageGenderNet.predictAgeAndGender(_e)}))];case 1:return[2,he.sent()]}})})},this.extractedFaces)];case 2:return P=oe.sent(),[2,A.map(function(ve,he){var _e=P[he],Re=_e.age,Ne=_e.gender,Ue=_e.genderProbability;return Vr(an(ve,Ne,Ue),Re)})]}})})},w.prototype.withFaceExpressions=function(){return new es(this,this.input)},w}(Go),Ta=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(H.b)(this,void 0,void 0,function(){var A,P,K,oe,ve;return Object(H.d)(this,function(he){switch(he.label){case 0:return[4,this.parentTask];case 1:return A=he.sent(),A?[4,ya(A,this.input,function(_e){return Jt.ageGenderNet.predictAgeAndGender(_e)},this.extractedFaces)]:[2];case 2:return P=he.sent(),K=P.age,oe=P.gender,ve=P.genderProbability,[2,Vr(an(A,oe,ve),K)]}})})},w.prototype.withFaceExpressions=function(){return new li(this,this.input)},w}(Go),Sa=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.withFaceExpressions=function(){return new Eo(this,this.input)},w.prototype.withFaceDescriptors=function(){return new Ir(this,this.input)},w}(di),rt=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.withFaceExpressions=function(){return new _o(this,this.input)},w.prototype.withFaceDescriptor=function(){return new Wt(this,this.input)},w}(Ta),_n=function(O){Object(H.c)(w,O);function w(A,P){var K=O.call(this)||this;return K.parentTask=A,K.input=P,K}return w}(Lt),Ir=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(H.b)(this,void 0,void 0,function(){var A,P;return Object(H.d)(this,function(K){switch(K.label){case 0:return[4,this.parentTask];case 1:return A=K.sent(),[4,ga(A,this.input,function(oe){return Promise.all(oe.map(function(ve){return Jt.faceRecognitionNet.computeFaceDescriptor(ve)}))},null,function(oe){return oe.landmarks.align(null,{useDlibAlignment:!0})})];case 2:return P=K.sent(),[2,P.map(function(oe,ve){return ri(A[ve],oe)})]}})})},w.prototype.withFaceExpressions=function(){return new Eo(this,this.input)},w.prototype.withAgeAndGender=function(){return new Sa(this,this.input)},w}(_n),Wt=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(H.b)(this,void 0,void 0,function(){var A,P;return Object(H.d)(this,function(K){switch(K.label){case 0:return[4,this.parentTask];case 1:return A=K.sent(),A?[4,ya(A,this.input,function(oe){return Jt.faceRecognitionNet.computeFaceDescriptor(oe)},null,function(oe){return oe.landmarks.align(null,{useDlibAlignment:!0})})]:[2];case 2:return P=K.sent(),[2,ri(A,P)]}})})},w.prototype.withFaceExpressions=function(){return new _o(this,this.input)},w.prototype.withAgeAndGender=function(){return new rt(this,this.input)},w}(_n),eo=function(O){Object(H.c)(w,O);function w(A,P,K){var oe=O.call(this)||this;return oe.parentTask=A,oe.input=P,oe.useTinyLandmarkNet=K,oe}return Object.defineProperty(w.prototype,"landmarkNet",{get:function(){return this.useTinyLandmarkNet?Jt.faceLandmark68TinyNet:Jt.faceLandmark68Net},enumerable:!0,configurable:!0}),w}(Lt),Vo=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(H.b)(this,void 0,void 0,function(){var A,P,K,oe,ve,he=this;return Object(H.d)(this,function(_e){switch(_e.label){case 0:return[4,this.parentTask];case 1:return A=_e.sent(),P=A.map(function(Re){return Re.detection}),this.input instanceof z.a?[4,Fo(this.input,P)]:[3,3];case 2:return oe=_e.sent(),[3,5];case 3:return[4,Yn(this.input,P)];case 4:oe=_e.sent(),_e.label=5;case 5:return K=oe,[4,Promise.all(K.map(function(Re){return he.landmarkNet.detectLandmarks(Re)}))];case 6:return ve=_e.sent(),K.forEach(function(Re){return Re instanceof z.a&&Re.dispose()}),[2,A.map(function(Re,Ne){return jo(Re,ve[Ne])})]}})})},w.prototype.withFaceExpressions=function(){return new Eo(this,this.input)},w.prototype.withAgeAndGender=function(){return new Sa(this,this.input)},w.prototype.withFaceDescriptors=function(){return new Ir(this,this.input)},w}(eo),jn=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(H.b)(this,void 0,void 0,function(){var A,P,K,oe,ve;return Object(H.d)(this,function(he){switch(he.label){case 0:return[4,this.parentTask];case 1:return A=he.sent(),A?(P=A.detection,this.input instanceof z.a?[4,Fo(this.input,[P])]:[3,3]):[2];case 2:return oe=he.sent(),[3,5];case 3:return[4,Yn(this.input,[P])];case 4:oe=he.sent(),he.label=5;case 5:return K=oe,[4,this.landmarkNet.detectLandmarks(K[0])];case 6:return ve=he.sent(),K.forEach(function(_e){return _e instanceof z.a&&_e.dispose()}),[2,jo(A,ve)]}})})},w.prototype.withFaceExpressions=function(){return new _o(this,this.input)},w.prototype.withAgeAndGender=function(){return new rt(this,this.input)},w.prototype.withFaceDescriptor=function(){return new Wt(this,this.input)},w}(eo),Co=function(O){Object(H.c)(w,O);function w(A,P){P===void 0&&(P=new xo);var K=O.call(this)||this;return K.input=A,K.options=P,K}return w}(Lt),Aa=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(H.b)(this,void 0,void 0,function(){var A,P,K,oe;return Object(H.d)(this,function(ve){switch(ve.label){case 0:return A=this,P=A.input,K=A.options,K instanceof yo?[4,Jt.mtcnn.forward(P,K)]:[3,2];case 1:return[2,ve.sent().map(function(he){return he.detection})];case 2:if(oe=K instanceof zi?function(he){return Jt.tinyFaceDetector.locateFaces(he,K)}:K instanceof xo?function(he){return Jt.ssdMobilenetv1.locateFaces(he,K)}:K instanceof En?function(he){return Jt.tinyYolov2.locateFaces(he,K)}:null,!oe)throw new Error("detectFaces - expected options to be instance of TinyFaceDetectorOptions | SsdMobilenetv1Options | MtcnnOptions | TinyYolov2Options");return[2,oe(P)]}})})},w.prototype.runAndExtendWithFaceDetections=function(){var A=this;return new Promise(function(P){return Object(H.b)(A,void 0,void 0,function(){var K;return Object(H.d)(this,function(oe){switch(oe.label){case 0:return[4,this.run()];case 1:return K=oe.sent(),[2,P(K.map(function(ve){return tt({},ve)}))]}})})})},w.prototype.withFaceLandmarks=function(A){return A===void 0&&(A=!1),new Vo(this.runAndExtendWithFaceDetections(),this.input,A)},w.prototype.withFaceExpressions=function(){return new es(this.runAndExtendWithFaceDetections(),this.input)},w.prototype.withAgeAndGender=function(){return new di(this.runAndExtendWithFaceDetections(),this.input)},w}(Co),Oa=function(O){Object(H.c)(w,O);function w(){return O!==null&&O.apply(this,arguments)||this}return w.prototype.run=function(){return Object(H.b)(this,void 0,void 0,function(){var A,P;return Object(H.d)(this,function(K){switch(K.label){case 0:return[4,new Aa(this.input,this.options)];case 1:return A=K.sent(),P=A[0],A.forEach(function(oe){oe.score>P.score&&(P=oe)}),[2,P]}})})},w.prototype.runAndExtendWithFaceDetection=function(){var A=this;return new Promise(function(P){return Object(H.b)(A,void 0,void 0,function(){var K;return Object(H.d)(this,function(oe){switch(oe.label){case 0:return[4,this.run()];case 1:return K=oe.sent(),[2,P(K?tt({},K):void 0)]}})})})},w.prototype.withFaceLandmarks=function(A){return A===void 0&&(A=!1),new jn(this.runAndExtendWithFaceDetection(),this.input,A)},w.prototype.withFaceExpressions=function(){return new li(this.runAndExtendWithFaceDetection(),this.input)},w.prototype.withAgeAndGender=function(){return new Ta(this.runAndExtendWithFaceDetection(),this.input)},w}(Co);function Xo(O,w){return w===void 0&&(w=new xo),new Oa(O,w)}function Bn(O,w){return w===void 0&&(w=new xo),new Aa(O,w)}function Ko(O,w){return Object(H.b)(this,void 0,void 0,function(){return Object(H.d)(this,function(A){switch(A.label){case 0:return console.warn("allFacesSsdMobilenetv1 is deprecated and will be removed soon, use the high level api instead"),[4,Bn(O,new xo(w?{minConfidence:w}:{})).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,A.sent()]}})})}function To(O,w){return w===void 0&&(w={}),Object(H.b)(this,void 0,void 0,function(){return Object(H.d)(this,function(A){switch(A.label){case 0:return console.warn("allFacesTinyYolov2 is deprecated and will be removed soon, use the high level api instead"),[4,Bn(O,new En(w)).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,A.sent()]}})})}function Zr(O,w){return w===void 0&&(w={}),Object(H.b)(this,void 0,void 0,function(){return Object(H.d)(this,function(A){switch(A.label){case 0:return console.warn("allFacesMtcnn is deprecated and will be removed soon, use the high level api instead"),[4,Bn(O,new yo(w)).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,A.sent()]}})})}var fi=Ko;function hi(O,w){if(O.length!==w.length)throw new Error("euclideanDistance: arr1.length !== arr2.length");var A=Array.from(O),P=Array.from(w);return Math.sqrt(A.map(function(K,oe){return K-P[oe]}).reduce(function(K,oe){return K+Math.pow(oe,2)},0))}var Ra=function(){function O(w,A){A===void 0&&(A=.6),this._distanceThreshold=A;var P=Array.isArray(w)?w:[w];if(!P.length)throw new Error("FaceRecognizer.constructor - expected atleast one input");var K=1,oe=function(){return"person "+K++};this._labeledDescriptors=P.map(function(ve){if(ve instanceof Fr)return ve;if(ve instanceof Float32Array)return new Fr(oe(),[ve]);if(ve.descriptor&&ve.descriptor instanceof Float32Array)return new Fr(oe(),[ve.descriptor]);throw new Error("FaceRecognizer.constructor - expected inputs to be of type LabeledFaceDescriptors | WithFaceDescriptor<any> | Float32Array | Array<LabeledFaceDescriptors | WithFaceDescriptor<any> | Float32Array>")})}return Object.defineProperty(O.prototype,"labeledDescriptors",{get:function(){return this._labeledDescriptors},enumerable:!0,configurable:!0}),Object.defineProperty(O.prototype,"distanceThreshold",{get:function(){return this._distanceThreshold},enumerable:!0,configurable:!0}),O.prototype.computeMeanDistance=function(w,A){return A.map(function(P){return hi(P,w)}).reduce(function(P,K){return P+K},0)/(A.length||1)},O.prototype.matchDescriptor=function(w){var A=this;return this.labeledDescriptors.map(function(P){var K=P.descriptors,oe=P.label;return new rr(oe,A.computeMeanDistance(w,K))}).reduce(function(P,K){return P.distance<K.distance?P:K})},O.prototype.findBestMatch=function(w){var A=this.matchDescriptor(w);return A.distance<this.distanceThreshold?A:new rr("unknown",A.distance)},O.prototype.toJSON=function(){return{distanceThreshold:this.distanceThreshold,labeledDescriptors:this.labeledDescriptors.map(function(w){return w.toJSON()})}},O.fromJSON=function(w){var A=w.labeledDescriptors.map(function(P){return Fr.fromJSON(P)});return new O(A,w.distanceThreshold)},O}();function ts(O){var w=new Zn;return w.extractWeights(O),w}function cd(O){var w=new Ho;return w.extractWeights(O),w}function Ia(O,w){var A=new ae(w.width,w.height),P=A.width,K=A.height;if(P<=0||K<=0)throw new Error("resizeResults - invalid dimensions: "+JSON.stringify({width:P,height:K}));if(Array.isArray(O))return O.map(function(he){return Ia(he,{width:P,height:K})});if(da(O)){var oe=O.detection.forSize(P,K),ve=O.unshiftedLandmarks.forSize(oe.box.width,oe.box.height);return jo(tt(O,oe),ve)}return Ar(O)?tt(O,O.detection.forSize(P,K)):O instanceof at||O instanceof m?O.forSize(P,K):O}var rs=N("mxV5"),eu=N.n(rs),tu=N("7Cbv"),ru=N("KhGG"),nu=N("ErOA"),pi=N("IO3U"),mi=N.n(pi),ns=function(w,A){for(var P=w.split(","),K=P[0].match(/:(.*?);/)[1],oe=atob(P[1]),ve=oe.length,he=new Uint8Array(ve);ve--;)he[ve]=oe.charCodeAt(ve);return new Blob([he],{type:K})},ou=function(){var O=Object(x.a)(U.a.mark(function w(A){return U.a.wrap(function(K){for(;;)switch(K.prev=K.next){case 0:return K.abrupt("return",new Promise(function(oe,ve){var he=new Image;(A==null?void 0:A.indexOf("educoder.net"))>-1?he.setAttribute("crossOrigin","educoder.net"):he.setAttribute("crossOrigin","aliyuncs.com"),he.onload=function(){var _e=document.createElement("canvas");_e.width=this.naturalWidth,_e.height=this.naturalHeight,_e.getContext("2d").drawImage(he,0,0);var Re=_e.toDataURL("image/png");oe(Re)},he.src=A,he.onerror=function(){ve(new Error("\u56FE\u7247\u6D41\u5F02\u5E38")),v.b.error("\u60A8\u7684\u8EAB\u4EFD\u7167\u7247\u5F02\u5E38\uFF0C\u8BF7\u62CD\u7167\u540E\u63D0\u4EA4\u81F3\u4EBA\u5DE5\u5BA1\u6838")}}));case 1:case"end":return K.stop()}},w)}));return function(A){return O.apply(this,arguments)}}(),au=Object(j.forwardRef)(function(O,w){var A=O.outputResult,P=O.identity_url,K=O.onCameraReady,oe=O.defaultOpen,ve=Object(ee.i)(),he=window.ENV==="build"?"/react/build/weights/":"/weights/",_e=Object(j.useRef)(),Re=Object(j.useRef)(),Ne=Object(j.useRef)(),Ue=Object(j.useRef)(!1),ze=Object(j.useRef)(),qe=Object(j.useState)(!0),it=Object(S.a)(qe,2),bt=it[0],Et=it[1],Tt=Object(j.useState)(""),It=Object(S.a)(Tt,2),At=It[0],vt=It[1],Ct=Object(j.useState)(""),Bt=Object(S.a)(Ct,2),lr=Bt[0],xr=Bt[1],or=Object(j.useRef)(!1),Ht=Object(j.useRef)(""),Ut=Object(j.useState)(!0),kr=Object(S.a)(Ut,1),dr=kr[0],Xr=.5,un=224,Rt="\u5BA1\u6838\u5931\u8D25",Kr=Object(j.useMemo)(function(){return new zi({inputSize:un,scoreThreshold:Xr})},[]),fr=function(){var qt=Object(x.a)(U.a.mark(function Qt(){return U.a.wrap(function(ur){for(;;)switch(ur.prev=ur.next){case 0:return ur.next=2,Jt.ssdMobilenetv1.loadFromUri(he);case 2:return ur.next=4,dc(he);case 4:return ur.next=6,Ca(he);case 6:return ur.next=8,qi(he);case 8:case"end":return ur.stop()}},Qt)}));return function(){return qt.apply(this,arguments)}}();Object(j.useEffect)(function(){oe&&Gt(!0)},[oe]),Object(j.useImperativeHandle)(w,function(){return{handleStop:kt,handleRemove:vr,handlePlay:Gt,startDiscern:So,handleUploadImage:Yo}});var _r=function(){var qt=Object(x.a)(U.a.mark(function Qt(Kt){return U.a.wrap(function(Zt){for(;;)switch(Zt.prev=Zt.next){case 0:if(_e.current){Zt.next=3;break}return setTimeout(function(){return _r(Kt)}),Zt.abrupt("return");case 3:navigator.mediaDevices.getUserMedia({video:{width:640,height:360}}).then(function(){var sr=Object(x.a)(U.a.mark(function wr(to){var Wn;return U.a.wrap(function(Br){for(;;)switch(Br.prev=Br.next){case 0:if("srcObject"in _e.current?_e.current.srcObject=to:_e.current.src=window.URL.createObjectURL(to),_e.current.onloadedmetadata=function(Na){Et(!1),_e.current.play()},!Kt){Br.next=10;break}return Wn=document.createElement("img"),Br.next=6,ou(P+"?t="+new Date().getTime());case 6:return Wn.src=Br.sent,Br.next=9,Xo(Wn,Kr).withFaceLandmarks().withFaceDescriptor();case 9:ze.current=Br.sent;case 10:case"end":return Br.stop()}},wr)}));return function(wr){return sr.apply(this,arguments)}}()).catch(function(sr){console.log("err:",sr,sr.message),sr.message==="Permission denied"||sr.name==="NotAllowedError"?v.b.error("\u60A8\u5DF2\u62D2\u7EDD\u4E86\u83B7\u53D6\u6444\u50CF\u5934"):sr.message!="\u56FE\u7247\u6D41\u5F02\u5E38"&&v.b.error("\u6444\u50CF\u5934\u83B7\u53D6\u5931\u8D25\uFF0C\u6216\u60A8\u5DF2\u62D2\u7EDD\u4E86\u83B7\u53D6\u6444\u50CF\u5934")});case 4:case"end":return Zt.stop()}},Qt)}));return function(Kt){return qt.apply(this,arguments)}}(),Un=function(){var qt=Object(x.a)(U.a.mark(function Qt(Kt,ur){return U.a.wrap(function(sr){for(;;)switch(sr.prev=sr.next){case 0:return sr.abrupt("return",new Promise(function(){var wr=Object(x.a)(U.a.mark(function to(Wn){var Jo,Br,Na,gi,Da,yi,bi,yr,ka,xi,wi;return U.a.wrap(function(Ao){for(;;)switch(Ao.prev=Ao.next){case 0:return Ao.next=2,Object(nu.a)("/api/buckets/get_upload_token.json",{method:"get"});case 2:yr=Ao.sent,yr.data=JSON.parse(Object(ru.a)(yr.data)),ka=Object(tu.a)(),xi=new eu.a({endpoint:yr==null||((Jo=yr.data)===null||Jo===void 0)?void 0:Jo.end_point,region:yr==null||((Br=yr.data)===null||Br===void 0)?void 0:Br.region,accessKeyId:yr==null||((Na=yr.data)===null||Na===void 0)?void 0:Na.access_key_id,accessKeySecret:yr==null||((gi=yr.data)===null||gi===void 0)?void 0:gi.access_key_secret,bucket:yr==null||((Da=yr.data)===null||Da===void 0)?void 0:Da.bucket,stsToken:yr==null||((yi=yr.data)===null||yi===void 0)?void 0:yi.security_token}),wi=ns(Kt,ka),xi.multipartUpload("".concat(ka,".png"),wi,{timeout:10*1e3,partSize:10485760,callback:{url:yr==null||((bi=yr.data)===null||bi===void 0)?void 0:bi.callback_url,host:yr==null?void 0:yr.data.bucket_host,body:"bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&my_var=${x:my_var}&login="+ve.login+"&container_id="+ve.categoryId+"&container_type=ExerciseIdentity&p="+ur}}).then(function(qo){Wn(qo),console.log("result:",qo)}).catch(function(qo){console.log("err:",qo)});case 8:case"end":return Ao.stop()}},to)}));return function(to){return wr.apply(this,arguments)}}()));case 1:case"end":return sr.stop()}},Qt)}));return function(Kt,ur){return qt.apply(this,arguments)}}(),Cn=function(){var qt=Object(x.a)(U.a.mark(function Qt(Kt){var ur;return U.a.wrap(function(sr){for(;;)switch(sr.prev=sr.next){case 0:return sr.prev=0,Re.current.width=_e.current.videoWidth,Re.current.height=360,ur=Re.current.getContext("2d"),sr.next=6,ur.drawImage(_e.current,0,0,Re.current.width,Re.current.height);case 6:Ht.current=Re.current.toDataURL("image/png"),Kt===1&&Un(Ht.current,Kt),sr.next=12;break;case 10:sr.prev=10,sr.t0=sr.catch(0);case 12:case"end":return sr.stop()}},Qt,null,[[0,10]])}));return function(Kt){return qt.apply(this,arguments)}}(),Yo=function(){var qt=Object(x.a)(U.a.mark(function Qt(Kt){return U.a.wrap(function(Zt){for(;;)switch(Zt.prev=Zt.next){case 0:return Zt.abrupt("return",new Promise(function(){var sr=Object(x.a)(U.a.mark(function wr(to){var Wn;return U.a.wrap(function(Br){for(;;)switch(Br.prev=Br.next){case 0:return Wn=Re.current.getContext("2d"),Br.next=3,Wn.drawImage(_e.current,0,0,Re.current.width,Re.current.height);case 3:return Br.next=5,Un(Ht.current,Kt);case 5:to();case 6:case"end":return Br.stop()}},wr)}));return function(wr){return sr.apply(this,arguments)}}()));case 1:case"end":return Zt.stop()}},Qt)}));return function(Kt){return qt.apply(this,arguments)}}(),So=function(){var qt=Object(x.a)(U.a.mark(function Qt(){var Kt,ur,Zt;return U.a.wrap(function(wr){for(;;)switch(wr.prev=wr.next){case 0:return Ue.current=!0,wr.next=3,Xo(_e.current,Kr).withFaceLandmarks().withFaceDescriptor();case 3:Kt=wr.sent,Kt&&ze.current?(ur=new Ra(Kt),Zt=ur.findBestMatch(ze.current.descriptor),vt(Zt._distance<.4?"\u8BC6\u522B\u6210\u529F":Rt),Cn(Zt._distance<.4?1:0),setTimeout(function(){A==null||A({content:Zt._distance<.4?"\u8BC6\u522B\u6210\u529F":Rt,success:Zt._distance<.4})},1e3),or.current=!0):(Cn(0),vt(Rt),setTimeout(function(){A==null||A({content:Rt,success:!1})},1e3)),setTimeout(function(){_e.current.pause()},600);case 6:case"end":return wr.stop()}},Qt)}));return function(){return qt.apply(this,arguments)}}(),$o=function(){var qt=Object(x.a)(U.a.mark(function Qt(){var Kt,ur,Zt;return U.a.wrap(function(wr){for(;;)switch(wr.prev=wr.next){case 0:if(!((Kt=_e.current)!==null&&Kt!==void 0&&Kt.paused||(ur=_e.current)!==null&&ur!==void 0&&ur.ended)){wr.next=2;break}return wr.abrupt("return",setTimeout(function(){return $o()}));case 2:return wr.next=4,Xo(_e.current,Kr).withFaceLandmarks().withFaceDescriptor();case 4:Zt=wr.sent,Ue.current||(Ue.current=!0,K(!0)),Zt&&_e.current?(xr(""),gr(_e.current,Ne.current,[Zt],dr)):xr("\u8BF7\u5C06\u8138\u90E8\u79FB\u52A8\u81F3\u53D6\u666F\u6846\u5185"),or.current||setTimeout(function(){return $o()});case 8:case"end":return wr.stop()}},Qt)}));return function(){return qt.apply(this,arguments)}}(),vr=function(){try{var Qt=_e.current.srcObject,Kt=Qt.getTracks();Kt.forEach(function(ur){ur.stop()}),Ue.current=!1}catch(ur){}},kt=function(){Et(!1);try{Ue.current=!1}catch(Qt){}},Gt=function(Qt){Ue.current=!1,or.current=!1,Re.current.getContext("2d").clearRect(0,0,640,480),vt(""),Et(!0);try{_r(Qt||!1)}catch(Kt){}},gr=function(Qt,Kt,ur){var Zt=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,sr=cn(Qt,Kt,ur);Zt&&y.drawDetections(Kt,sr.map(function(wr){return wr.detection}))},cn=function(Qt,Kt,ur){var Zt=Qt instanceof HTMLVideoElement?Wr(Qt):Qt,sr=Zt.width,wr=Zt.height;return Kt.width=sr,Kt.height=wr,Ia(ur,{width:sr,height:wr})};return Object(j.useEffect)(function(){fr()},[]),T.a.createElement("div",{className:mi.a.wrp},T.a.createElement(ke.a,{spinning:bt,tip:"\u6B63\u5728\u542F\u52A8\u6444\u50CF\u5934\uFF0C\u8BF7\u7A0D\u540E..."},T.a.createElement("video",{onPlay:$o,ref:_e,id:"inputVideo",autoPlay:!0,muted:!0}),T.a.createElement("canvas",{style:{zIndex:2},ref:Ne}),T.a.createElement("canvas",{ref:Re}),T.a.createElement("div",{className:"c-red mt5 tc",style:{height:22}},At," ",lr)))}),os=au,as=N("2LEM"),is=N.n(as),ss=N("LvDl"),vi=$.a.Countdown,iu=Q.a.Step,fc=["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"],hc={0:"c-red-ee4",1:"c-green"},su=["\u5355\u9009\u9898","\u591A\u9009\u9898","\u5224\u65AD\u9898","\u586B\u7A7A\u9898","\u7B80\u7B54\u9898","\u5B9E\u8BAD\u9898","\u7F16\u7A0B\u9898"],en=function(w){var A,P=w.globalSetting,K=w.loading,oe=w.user,ve=w.exercise,he=w.dispatch,_e=Object(W.a)(w,["globalSetting","loading","user","exercise","dispatch"]),Re=Object(ee.i)(),Ne=Object(j.useState)(0),Ue=Object(S.a)(Ne,2),ze=Ue[0],qe=Ue[1],it=Object(j.useState)(!1),bt=Object(S.a)(it,2),Et=bt[0],Tt=bt[1],It=Object(j.useState)(!1),At=Object(S.a)(It,2),vt=At[0],Ct=At[1],Bt=Object(j.useState)(!1),lr=Object(S.a)(Bt,2),xr=lr[0],or=lr[1],Ht=Object(j.useState)(0),Ut=Object(S.a)(Ht,2),kr=Ut[0],dr=Ut[1],Xr=Object(j.useState)({}),un=Object(S.a)(Xr,2),Rt=un[0],Kr=un[1],fr=Object(j.useRef)(),_r=Object(j.useRef)(!0),Un=[{title:"\u91C7\u96C6\u7167\u7247",content:"First-content"},{title:"\u5BA1\u6838\u7ED3\u679C",content:"Second-content"},{title:"\u5F00\u542F\u624B\u673A\u5F55\u5236",content:"Last-content"}].filter(function(vr){return Rt!=null&&Rt.open_phone_video_recording?!0:vr.content!=="Last-content"}),Cn=function(){var vr=Object(x.a)(U.a.mark(function kt(){return U.a.wrap(function(gr){for(;;)switch(gr.prev=gr.next){case 0:return gr.abrupt("return",new Promise(function(){var cn=Object(x.a)(U.a.mark(function qt(Qt){var Kt;return U.a.wrap(function(Zt){for(;;)switch(Zt.prev=Zt.next){case 0:return Zt.next=2,Object(me.P)(Object(I.a)({},Re));case 2:Kt=Zt.sent,Kr(Object(I.a)({},Kt)),Qt(Kt);case 5:case"end":return Zt.stop()}},qt)}));return function(qt){return cn.apply(this,arguments)}}()));case 1:case"end":return gr.stop()}},kt)}));return function(){return vr.apply(this,arguments)}}(),Yo=function(){var vr=Object(x.a)(U.a.mark(function kt(){var Gt,gr;return U.a.wrap(function(qt){for(;;)switch(qt.prev=qt.next){case 0:return qt.next=2,Cn();case 2:Gt=qt.sent,Gt!=null&&Gt.identity_verify||qe(2),Gt!=null&&Gt.can_start&&Gt.countdown_time===0?qe(2):(Gt==null?void 0:Gt.identity_photo_state)==="rejected"?(_r.current=!1,dr(1)):(Gt==null?void 0:Gt.identity_photo_state)==="passed"&&(_r.current=!1,fr==null||((gr=fr.current)===null||gr===void 0)||gr.handleStop(),Rt!=null&&Rt.open_phone_video_recording||qe(2));case 5:case"end":return qt.stop()}},kt)}));return function(){return vr.apply(this,arguments)}}(),So=function(){var vr=Object(x.a)(U.a.mark(function kt(){var Gt,gr;return U.a.wrap(function(qt){for(;;)switch(qt.prev=qt.next){case 0:return qt.next=2,Cn();case 2:Gt=qt.sent,(Gt==null?void 0:Gt.identity_photo_state)==="submitted"||((Gt==null?void 0:Gt.identity_photo_state)==="rejected"?(_r.current=!1,dr(2)):(Gt==null?void 0:Gt.identity_photo_state)==="passed"&&(_r.current=!1,fr==null||((gr=fr.current)===null||gr===void 0)||gr.handleStop(),dr(1),Rt!=null&&Rt.open_phone_video_recording||qe(2))),(Gt==null?void 0:Gt.identity_photo_state)!=="passed"&&_r.current&&setTimeout(function(){So()},30*1e3);case 5:case"end":return qt.stop()}},kt)}));return function(){return vr.apply(this,arguments)}}(),$o=function(){var kt;Tt(!1),fr==null||((kt=fr.current)===null||kt===void 0)||kt.startDiscern()};return Object(j.useEffect)(function(){return Yo(),console.log("captureRef:",fr),function(){dr(0),or(!1),Ct(!1),qe(0)}},[]),T.a.createElement("div",{className:"p30 bg-white minHb100 edu-container mt20"},(Rt==null?void 0:Rt.identity_verify)&&T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{className:"tc font16 blod"},"\u8EAB\u4EFD\u9A8C\u8BC1"),T.a.createElement("div",{className:X.a.steps},T.a.createElement(Q.a,{current:ze},Un.map(function(vr){return T.a.createElement(iu,{key:vr.title,title:vr.title})})))),T.a.createElement("div",{className:ze===0?"":"hide"},T.a.createElement("div",{className:"tc mt50"},"\u8BF7\u4FDD\u8BC1\u5468\u56F4\u5149\u7EBF\u5145\u8DB3\uFF0C\u4E94\u5B98\u6E05\u6670\u53EF\u89C1\uFF01"),!vt&&T.a.createElement("div",{className:"tc"},T.a.createElement("img",{width:536,src:is.a,className:"mt30"})),T.a.createElement("div",{className:vt?"":"hide"},T.a.createElement(os,{ref:fr,onCameraReady:function(kt){Tt(kt)},defaultOpen:Rt==null?void 0:Rt.identity_verify,identity_url:Object(re.g)(oe==null||((A=oe.userInfo)===null||A===void 0)?void 0:A.identity_url),outputResult:function(kt){kt.success?(v.b.success({content:"\u4EBA\u8138\u8BC6\u522B\u6210\u529F",key:"checkapi"}),qe(2)):or(!0),Tt(!1)}})),vt&&T.a.createElement(T.a.Fragment,null,xr?T.a.createElement("div",{className:"tc mb30 mt15"},T.a.createElement(b.a,{type:"primary",onClick:function(){var kt;fr==null||((kt=fr.current)===null||kt===void 0)||kt.handlePlay(),Kr(Object(I.a)({},{})),or(!1)}},"\u91CD\u65B0\u8BC6\u522B"),T.a.createElement(b.a,{type:"primary",className:"ml90",onClick:Object(x.a)(U.a.mark(function vr(){var kt;return U.a.wrap(function(gr){for(;;)switch(gr.prev=gr.next){case 0:return gr.next=2,fr==null||((kt=fr.current)===null||kt===void 0)?void 0:kt.handleUploadImage(0);case 2:_r.current=!0,qe(1),dr(0),or(!1),So();case 7:case"end":return gr.stop()}},vr)}))},"\u4EBA\u5DE5\u5BA1\u6838")):Et&&T.a.createElement("div",{className:"tc mb30 mt15"},T.a.createElement(b.a,{type:"primary",onClick:Object(ss.throttle)($o,2e3)},"\u5F00\u59CB\u8BC6\u522B"))),!vt&&T.a.createElement("div",{className:"tc mb30 mt15"},T.a.createElement(b.a,{type:"primary",onClick:function(){Ct(!0)}},"\u5F00\u59CB\u91C7\u96C6"))),ze===1&&T.a.createElement("div",{className:"tc"},kr===0&&T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{className:"tc mt50"},T.a.createElement("span",{className:"c-blue font50 iconfont icon-dengdaishenhe"}),T.a.createElement("br",null),"\u4EBA\u5DE5\u5BA1\u6838\u4E2D...",T.a.createElement("br",null),"\u7533\u8BF7\u5DF2\u63D0\u4EA4\uFF0C\u76D1\u63A7\u8001\u5E08\u5BA1\u6838\u4E2D\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85\uFF01"),T.a.createElement(b.a,{type:"primary",className:"mt50",onClick:Object(x.a)(U.a.mark(function vr(){var kt;return U.a.wrap(function(gr){for(;;)switch(gr.prev=gr.next){case 0:return gr.next=2,Cn();case 2:kt=gr.sent,(kt==null?void 0:kt.identity_photo_state)==="submitted"?v.b.warn({content:"\u6B63\u5728\u7B49\u5F85\u8001\u5E08\u5BA1\u6838\u4E2D\uFF0C\u8BF7\u7A0D\u540E...",key:"sh1"}):(kt==null?void 0:kt.identity_photo_state)==="rejected"?(dr(2),_r.current=!1):(kt==null?void 0:kt.identity_photo_state)==="passed"&&(_r.current=!1,dr(1),Rt!=null&&Rt.open_phone_video_recording||qe(2));case 4:case"end":return gr.stop()}},vr)}))},"\u67E5\u770B\u5BA1\u6838\u7ED3\u679C")),kr===1&&T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{className:"tc mt50"},T.a.createElement("span",{className:"c-green font50 iconfont icon-tongguo"}),T.a.createElement("br",null),"\u8EAB\u4EFD\u9A8C\u8BC1\u5BA1\u6838\u901A\u8FC7\u3002"),(Rt==null?void 0:Rt.open_phone_video_recording)&&T.a.createElement(b.a,{type:"primary",className:"mt50",onClick:function(){return qe(2)}},"\u4E0B\u4E00\u6B65")),kr===2&&T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{className:"tc mt50"},T.a.createElement("span",{className:"c-red font50 iconfont icon-hongsejingshi"}),T.a.createElement("br",null),"\u8EAB\u4EFD\u9A8C\u8BC1\u5BA1\u6838\u4E0D\u901A\u8FC7\u3002\u8BF7\u91CD\u65B0\u62CD\u7167\u9A8C\u8BC1\u3002"),T.a.createElement("div",{className:"mt20"},T.a.createElement(D.a,null,T.a.createElement(g.a,{className:"tr",flex:"430px"},"\u5931\u8D25\u539F\u56E0\uFF1A"),T.a.createElement(g.a,null,Rt==null?void 0:Rt.identity_photo_comment)),T.a.createElement(D.a,{className:"mt30"},T.a.createElement(g.a,{className:"tr",flex:"430px"},"\u91C7\u96C6\u7167\u7247\uFF1A"),T.a.createElement(g.a,null,T.a.createElement("img",{src:Object(re.g)(Rt==null?void 0:Rt.identity_photo_url),width:200}))),T.a.createElement(D.a,null,T.a.createElement(g.a,{className:"tr",flex:"430px"}),T.a.createElement(g.a,null,T.a.createElement(b.a,{type:"primary",className:"mt50",onClick:function(){var kt;qe(0),Tt(!1),or(!1),Ct(!1),fr==null||((kt=fr.current)===null||kt===void 0)||kt.handlePlay()}},"\u91CD\u65B0\u8BA4\u8BC1")))))),ze===2&&T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{className:"tc mt50"},!(Rt!=null&&Rt.open_phone_video_recording)&&T.a.createElement(T.a.Fragment,null,(Rt==null?void 0:Rt.countdown_time)<=0?T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{className:"tc mt50"},T.a.createElement("span",{className:"c-green font50 iconfont icon-tongguo"}),T.a.createElement("br",null),"\u8EAB\u4EFD\u9A8C\u8BC1\u5BA1\u6838\u901A\u8FC7\u3002")):"\u8003\u8BD5\u5373\u5C06\u5F00\u59CB\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..."),(Rt==null?void 0:Rt.open_phone_video_recording)&&T.a.createElement(T.a.Fragment,null,(Rt==null?void 0:Rt.countdown_time)<=0?T.a.createElement("div",{className:"tc"},"\u6839\u636E\u8003\u8BD5\u89C4\u5B9A\uFF0C\u8BF7\u6253\u5F00\u5FAE\u4FE1\u626B\u4E00\u626B\uFF0C\u626B\u7801\u4E0B\u9762\u7684\u4E8C\u7EF4\u7801\u5F00\u542F\u624B\u673A\u5F55\u5236\u89C6\u9891",T.a.createElement("br",null),T.a.createElement("span",{className:"c-blue",style:{cursor:"default"},onClick:function(){F.a.info({icon:null,title:"\u67E5\u770B\u64CD\u4F5C\u6307\u5F15",className:"custom-modal-divider",width:540,content:T.a.createElement(D.a,null,T.a.createElement(g.a,{flex:"178px"},T.a.createElement("img",{width:148,src:"/images/operation_guidance.png"})),T.a.createElement(g.a,{flex:"1"},"\u8BF7\u70B9\u51FB\u53F3\u4E0A\u89D2\u201C\u2026\u201D\uFF0C\u9009\u62E9",T.a.createElement("span",{className:"c-orange"},"Safari\u4E2D\u6253\u5F00"),"\u6216\u8005",T.a.createElement("span",{className:"c-orange"},"\u201C\u5728\u9ED8\u8BA4\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00\u201D"),"\u540E\uFF0C\u6D4F\u89C8\u5668\u6253\u5F00\u540E\u8BF7\u70B9\u51FB\u5F00\u59CB\u5F55\u5236\u6309\u94AE\uFF0C\u53EF\u4EE5\u5F00\u542F\u624B\u673A\u5F55\u5236\u89C6\u9891\u3002"))})}},"\u5982\u82F9\u679C\u624B\u673A\u5FAE\u4FE1\u626B\u63CF\u4E8C\u7EF4\u7801\u540E\uFF0C\u51FA\u73B0\u70B9\u51FB\u5F00\u59CB\u5F55\u5236\u65E0\u54CD\u5E94\uFF0C\u8BF7\u67E5\u770B\u64CD\u4F5C\u6307\u5F15\u3002")):"\u8003\u8BD5\u5373\u5C06\u5F00\u59CB\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85...")),(Rt==null?void 0:Rt.open_phone_video_recording)&&T.a.createElement("div",{className:X.a.qrcode},T.a.createElement(we.a,{value:"https://".concat(document.domain,"/live-push.html?id=").concat(Re.categoryId,"&login=").concat(Re.login,"&cookie=").concat(Object(re.E)("_educoder_session"))})),(Rt==null?void 0:Rt.countdown_time)>0&&T.a.createElement("div",{className:"tc mt20"},T.a.createElement(vi,{value:Date.now()+(Rt==null?void 0:Rt.countdown_time)*1e3,valueStyle:{color:"#cf1322",fontSize:40},onFinish:function(){Cn()}})),T.a.createElement("div",{className:"tc mb30 mt50"},T.a.createElement(b.a,{type:"primary",onClick:Object(x.a)(U.a.mark(function vr(){var kt,Gt;return U.a.wrap(function(cn){for(;;)switch(cn.prev=cn.next){case 0:return cn.next=2,Cn();case 2:kt=cn.sent,kt!=null&&kt.can_start&&(kt==null?void 0:kt.countdown_time)<=0?(fr==null||((Gt=fr.current)===null||Gt===void 0)||Gt.handleRemove(),Rt!=null&&Rt.open_phone_video_recording?kt!=null&&kt.video_url&&setTimeout(function(){location.href="/classrooms/".concat(Re.coursesId,"/exercise/").concat(Re.categoryId,"/users/").concat(Re.login)},300):setTimeout(function(){location.href="/classrooms/".concat(Re.coursesId,"/exercise/").concat(Re.categoryId,"/users/").concat(Re.login)},300)):(kt==null?void 0:kt.countdown_time)>0?v.b.warn({content:"\u8003\u8BD5\u6682\u672A\u5F00\u59CB\uFF0C\u8BF7\u7A0D\u540E..."}):v.b.warn({content:"\u8BF7\u6253\u5F00\u5FAE\u4FE1\u626B\u4E00\u626B\uFF0C\u5F00\u542F\u624B\u673A\u89C6\u9891\u5F55\u5236"});case 4:case"end":return cn.stop()}},vr)}))},"\u5F00\u59CB\u8003\u8BD5"))))},Yr=V.default=Object(Z.a)(function(O){var w=O.loading,A=O.user,P=O.exercise,K=O.globalSetting;return{globalSetting:K,user:A,exercise:P,loading:w.effects}})(en)},jO9C:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.pad.Iso97971={pad:function(d,F){d.concat(y.lib.WordArray.create([2147483648],1)),y.pad.ZeroPadding.pad(d,F)},unpad:function(d){y.pad.ZeroPadding.unpad(d),d.sigBytes--}},y.pad.Iso97971})},"kVK+":function(l,V){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */V.read=function(N,y,d,F,M){var D,E,g=M*8-F-1,h=(1<<g)-1,b=h>>1,p=-7,v=d?M-1:0,I=d?-1:1,x=N[y+v];for(v+=I,D=x&(1<<-p)-1,x>>=-p,p+=g;p>0;D=D*256+N[y+v],v+=I,p-=8);for(E=D&(1<<-p)-1,D>>=-p,p+=F;p>0;E=E*256+N[y+v],v+=I,p-=8);if(D===0)D=1-b;else{if(D===h)return E?NaN:(x?-1:1)*Infinity;E=E+Math.pow(2,F),D=D-b}return(x?-1:1)*E*Math.pow(2,D-F)},V.write=function(N,y,d,F,M,D){var E,g,h,b=D*8-M-1,p=(1<<b)-1,v=p>>1,I=M===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=F?0:D-1,S=F?1:-1,W=y<0||y===0&&1/y<0?1:0;for(y=Math.abs(y),isNaN(y)||y===Infinity?(g=isNaN(y)?1:0,E=p):(E=Math.floor(Math.log(y)/Math.LN2),y*(h=Math.pow(2,-E))<1&&(E--,h*=2),E+v>=1?y+=I/h:y+=I*Math.pow(2,1-v),y*h>=2&&(E++,h/=2),E+v>=p?(g=0,E=p):E+v>=1?(g=(y*h-1)*Math.pow(2,M),E=E+v):(g=y*Math.pow(2,v-1)*Math.pow(2,M),E=0));M>=8;N[d+x]=g&255,x+=S,g/=256,M-=8);for(E=E<<M|g,b+=M;b>0;N[d+x]=E&255,x+=S,E/=256,b-=8);N[d+x-S]|=W*128}},lPiR:function(l,V,N){(function(y,d){l.exports=V=d(N("Ib8C"))})(this,function(y){return function(d){var F=y,M=F.lib,D=M.WordArray,E=M.Hasher,g=F.algo,h=[],b=[];(function(){function I(B){for(var Q=d.sqrt(B),G=2;G<=Q;G++)if(!(B%G))return!1;return!0}function x(B){return(B-(B|0))*4294967296|0}for(var S=2,W=0;W<64;)I(S)&&(W<8&&(h[W]=x(d.pow(S,1/2))),b[W]=x(d.pow(S,1/3)),W++),S++})();var p=[],v=g.SHA256=E.extend({_doReset:function(){this._hash=new D.init(h.slice(0))},_doProcessBlock:function(I,x){for(var S=this._hash.words,W=S[0],B=S[1],Q=S[2],G=S[3],$=S[4],J=S[5],U=S[6],j=S[7],T=0;T<64;T++){if(T<16)p[T]=I[x+T]|0;else{var ee=p[T-15],Z=(ee<<25|ee>>>7)^(ee<<14|ee>>>18)^ee>>>3,_=p[T-2],X=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;p[T]=Z+p[T-7]+X+p[T-16]}var re=$&J^~$&U,me=W&B^W&Q^B&Q,de=(W<<30|W>>>2)^(W<<19|W>>>13)^(W<<10|W>>>22),we=($<<26|$>>>6)^($<<21|$>>>11)^($<<7|$>>>25),ge=j+we+re+b[T]+p[T],ke=de+me;j=U,U=J,J=$,$=G+ge|0,G=Q,Q=B,B=W,W=ge+ke|0}S[0]=S[0]+W|0,S[1]=S[1]+B|0,S[2]=S[2]+Q|0,S[3]=S[3]+G|0,S[4]=S[4]+$|0,S[5]=S[5]+J|0,S[6]=S[6]+U|0,S[7]=S[7]+j|0},_doFinalize:function(){var I=this._data,x=I.words,S=this._nDataBytes*8,W=I.sigBytes*8;return x[W>>>5]|=128<<24-W%32,x[(W+64>>>9<<4)+14]=d.floor(S/4294967296),x[(W+64>>>9<<4)+15]=S,I.sigBytes=x.length*4,this._process(),this._hash},clone:function(){var I=E.clone.call(this);return I._hash=this._hash.clone(),I}});F.SHA256=E._createHelper(v),F.HmacSHA256=E._createHmacHelper(v)}(Math),y.SHA256})},mrSG:function(l,V,N){"use strict";N.d(V,"c",function(){return d}),N.d(V,"a",function(){return F}),N.d(V,"b",function(){return h}),N.d(V,"d",function(){return b}),N.d(V,"e",function(){return W});/*! *****************************************************************************
|
|
|
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(_,X){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(re,me){re.__proto__=me}||function(re,me){for(var de in me)me.hasOwnProperty(de)&&(re[de]=me[de])},y(_,X)};function d(Z,_){y(Z,_);function X(){this.constructor=Z}Z.prototype=_===null?Object.create(_):(X.prototype=_.prototype,new X)}var F=function(){return F=Object.assign||function(X){for(var re,me=1,de=arguments.length;me<de;me++){re=arguments[me];for(var we in re)Object.prototype.hasOwnProperty.call(re,we)&&(X[we]=re[we])}return X},F.apply(this,arguments)};function M(Z,_){var X={};for(var re in Z)Object.prototype.hasOwnProperty.call(Z,re)&&_.indexOf(re)<0&&(X[re]=Z[re]);if(Z!=null&&typeof Object.getOwnPropertySymbols=="function")for(var me=0,re=Object.getOwnPropertySymbols(Z);me<re.length;me++)_.indexOf(re[me])<0&&Object.prototype.propertyIsEnumerable.call(Z,re[me])&&(X[re[me]]=Z[re[me]]);return X}function D(Z,_,X,re){var me=arguments.length,de=me<3?_:re===null?re=Object.getOwnPropertyDescriptor(_,X):re,we;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")de=Reflect.decorate(Z,_,X,re);else for(var ge=Z.length-1;ge>=0;ge--)(we=Z[ge])&&(de=(me<3?we(de):me>3?we(_,X,de):we(_,X))||de);return me>3&&de&&Object.defineProperty(_,X,de),de}function E(Z,_){return function(X,re){_(X,re,Z)}}function g(Z,_){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(Z,_)}function h(Z,_,X,re){function me(de){return de instanceof X?de:new X(function(we){we(de)})}return new(X||(X=Promise))(function(de,we){function ge(ie){try{z(re.next(ie))}catch(H){we(H)}}function ke(ie){try{z(re.throw(ie))}catch(H){we(H)}}function z(ie){ie.done?de(ie.value):me(ie.value).then(ge,ke)}z((re=re.apply(Z,_||[])).next())})}function b(Z,_){var X={label:0,sent:function(){if(de[0]&1)throw de[1];return de[1]},trys:[],ops:[]},re,me,de,we;return we={next:ge(0),throw:ge(1),return:ge(2)},typeof Symbol=="function"&&(we[Symbol.iterator]=function(){return this}),we;function ge(z){return function(ie){return ke([z,ie])}}function ke(z){if(re)throw new TypeError("Generator is already executing.");for(;X;)try{if(re=1,me&&(de=z[0]&2?me.return:z[0]?me.throw||((de=me.return)&&de.call(me),0):me.next)&&!(de=de.call(me,z[1])).done)return de;(me=0,de)&&(z=[z[0]&2,de.value]);switch(z[0]){case 0:case 1:de=z;break;case 4:return X.label++,{value:z[1],done:!1};case 5:X.label++,me=z[1],z=[0];continue;case 7:z=X.ops.pop(),X.trys.pop();continue;default:if(!(de=X.trys,de=de.length>0&&de[de.length-1])&&(z[0]===6||z[0]===2)){X=0;continue}if(z[0]===3&&(!de||z[1]>de[0]&&z[1]<de[3])){X.label=z[1];break}if(z[0]===6&&X.label<de[1]){X.label=de[1],de=z;break}if(de&&X.label<de[2]){X.label=de[2],X.ops.push(z);break}de[2]&&X.ops.pop(),X.trys.pop();continue}z=_.call(Z,X)}catch(ie){z=[6,ie],me=0}finally{re=de=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}}function p(Z,_,X,re){re===void 0&&(re=X),Z[re]=_[X]}function v(Z,_){for(var X in Z)X!=="default"&&!_.hasOwnProperty(X)&&(_[X]=Z[X])}function I(Z){var _=typeof Symbol=="function"&&Symbol.iterator,X=_&&Z[_],re=0;if(X)return X.call(Z);if(Z&&typeof Z.length=="number")return{next:function(){return Z&&re>=Z.length&&(Z=void 0),{value:Z&&Z[re++],done:!Z}}};throw new TypeError(_?"Object is not iterable.":"Symbol.iterator is not defined.")}function x(Z,_){var X=typeof Symbol=="function"&&Z[Symbol.iterator];if(!X)return Z;var re=X.call(Z),me,de=[],we;try{for(;(_===void 0||_-- >0)&&!(me=re.next()).done;)de.push(me.value)}catch(ge){we={error:ge}}finally{try{me&&!me.done&&(X=re.return)&&X.call(re)}finally{if(we)throw we.error}}return de}function S(){for(var Z=[],_=0;_<arguments.length;_++)Z=Z.concat(x(arguments[_]));return Z}function W(){for(var Z=0,_=0,X=arguments.length;_<X;_++)Z+=arguments[_].length;for(var re=Array(Z),me=0,_=0;_<X;_++)for(var de=arguments[_],we=0,ge=de.length;we<ge;we++,me++)re[me]=de[we];return re}function B(Z){return this instanceof B?(this.v=Z,this):new B(Z)}function Q(Z,_,X){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var re=X.apply(Z,_||[]),me,de=[];return me={},we("next"),we("throw"),we("return"),me[Symbol.asyncIterator]=function(){return this},me;function we(ae){re[ae]&&(me[ae]=function(ue){return new Promise(function(te,Se){de.push([ae,ue,te,Se])>1||ge(ae,ue)})})}function ge(ae,ue){try{ke(re[ae](ue))}catch(te){H(de[0][3],te)}}function ke(ae){ae.value instanceof B?Promise.resolve(ae.value.v).then(z,ie):H(de[0][2],ae)}function z(ae){ge("next",ae)}function ie(ae){ge("throw",ae)}function H(ae,ue){(ae(ue),de.shift(),de.length)&&ge(de[0][0],de[0][1])}}function G(Z){var _,X;return _={},re("next"),re("throw",function(me){throw me}),re("return"),_[Symbol.iterator]=function(){return this},_;function re(me,de){_[me]=Z[me]?function(we){return(X=!X)?{value:B(Z[me](we)),done:me==="return"}:de?de(we):we}:de}}function $(Z){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var _=Z[Symbol.asyncIterator],X;return _?_.call(Z):(Z=typeof I=="function"?I(Z):Z[Symbol.iterator](),X={},re("next"),re("throw"),re("return"),X[Symbol.asyncIterator]=function(){return this},X);function re(de){X[de]=Z[de]&&function(we){return new Promise(function(ge,ke){we=Z[de](we),me(ge,ke,we.done,we.value)})}}function me(de,we,ge,ke){Promise.resolve(ke).then(function(z){de({value:z,done:ge})},we)}}function J(Z,_){return Object.defineProperty?Object.defineProperty(Z,"raw",{value:_}):Z.raw=_,Z}function U(Z){if(Z&&Z.__esModule)return Z;var _={};if(Z!=null)for(var X in Z)Object.hasOwnProperty.call(Z,X)&&(_[X]=Z[X]);return _.default=Z,_}function j(Z){return Z&&Z.__esModule?Z:{default:Z}}function T(Z,_){if(!_.has(Z))throw new TypeError("attempted to get private field on non-instance");return _.get(Z)}function ee(Z,_,X){if(!_.has(Z))throw new TypeError("attempted to set private field on non-instance");return _.set(Z,X),X}},mxV5:function(module,exports,__webpack_require__){(function(global){var require,require;(function(l){if(!0)module.exports=l();else var V})(function(){var define,module,exports;return function(){function l(V,N,y){function d(D,E){if(!N[D]){if(!V[D]){var g=typeof require=="function"&&require;if(!E&&g)return require(D,!0);if(F)return F(D,!0);var h=new Error("Cannot find module '"+D+"'");throw h.code="MODULE_NOT_FOUND",h}var b=N[D]={exports:{}};V[D][0].call(b.exports,function(p){var v=V[D][1][p];return d(v||p)},b,b.exports,l,V,N,y)}return N[D].exports}for(var F=typeof require=="function"&&require,M=0;M<y.length;M++)d(y[M]);return d}return l}()({1:[function(l,V,N){"use strict";var y=l("./browser/client");y.Buffer=l("buffer").Buffer,y.urllib=l("../shims/xhr"),y.version=l("./browser/version").version,V.exports=y},{"../shims/xhr":291,"./browser/client":2,"./browser/version":5,buffer:73}],2:[function(l,V,N){(function(y,d){"use strict";var F=l("babel-runtime/core-js/promise"),M=b(F),D=l("babel-runtime/regenerator"),E=b(D),g=l("babel-runtime/core-js/object/assign"),h=b(g);function b(ke){return ke&&ke.__esModule?ke:{default:ke}}var p=l("debug")("ali-oss"),v=l("copy-to"),I=l("xml2js"),x=l("agentkeepalive"),S=l("merge-descriptors"),W=l("url"),B=l("is-type-of"),Q=l("platform"),G=l("utility"),$=l("urllib"),J=l("./version"),U=l("bowser"),j=l("../common/signUtils"),T=l("../common/utils/isIP"),ee=T.isIP,Z=l("../common/client/initOptions"),_=l("../common/utils/createRequest"),X=_.createRequest,re=new x;function me(){var ke=Q.name,z=Q.version;ke&&ke.toLowerCase&&ke.toLowerCase()==="ie"&&z.split(".")[0]<10&&console.warn("ali-oss does not support the current browser")}function de(){return location&&location.protocol==="https:"}function we(ke,z){if(me(),!(this instanceof we))return new we(ke,z);ke&&ke.inited?this.options=ke:this.options=we.initOptions(ke),this.options.cancelFlag=!1,this.options.urllib?this.urllib=this.options.urllib:(this.urllib=$,this.agent=this.options.agent||re),this.ctx=z,this.userAgent=this._getUserAgent(),this.options.amendTimeSkewed=0}V.exports=we,we.initOptions=function(z){z.stsToken||console.warn("Please use STS Token for safety, see more details at https://help.aliyun.com/document_detail/32077.html");var ie=(0,h.default)({secure:de(),useFetch:!1},z);return Z(ie)};var ge=we.prototype;ge.debug=p,S(ge,l("./object")),S(ge,l("../common/bucket/getBucketWebsite")),S(ge,l("../common/bucket/putBucketWebsite")),S(ge,l("../common/bucket/deleteBucketWebsite")),S(ge,l("../common/bucket/getBucketLifecycle")),S(ge,l("../common/bucket/putBucketLifecycle")),S(ge,l("../common/bucket/deleteBucketLifecycle")),S(ge,l("../common/bucket/putBucketVersioning")),S(ge,l("../common/bucket/getBucketVersioning")),S(ge,l("./managed-upload")),S(ge,l("../common/multipart")),S(ge,l("../common/parallel")),ge.signature=function(z){return this.debug("authorization stringToSign: %s",z,"info"),j.computeSignature(this.options.accessKeySecret,z)},ge.authorization=function(z,ie,H,ae){var ue=j.buildCanonicalString(z.toUpperCase(),ie,{headers:ae,parameters:H});return j.authorization(this.options.accessKeyId,this.options.accessKeySecret,ue)},ge.request=function(z){var ie,H,ae,ue,te,Se;return E.default.async(function(Fe){for(;;)switch(Fe.prev=Fe.next){case 0:return ie=X.call(this,z),this.options.useFetch||(ie.params.mode="disable-fetch"),H=void 0,ae=void 0,ue=!!z.stream,Fe.prev=5,Fe.next=8,E.default.awrap(this.urllib.request(ie.url,ie.params));case 8:H=Fe.sent,this.debug("response %s %s, got %s, headers: %j",z.method,ie.url,H.status,H.headers,"info"),Fe.next=15;break;case 12:Fe.prev=12,Fe.t0=Fe.catch(5),ae=Fe.t0;case 15:if(te=void 0,!(H&&z.successStatuses&&z.successStatuses.indexOf(H.status)===-1)){Fe.next=28;break}return Fe.next=19,E.default.awrap(this.requestError(H));case 19:if(te=Fe.sent,!(te.code==="RequestTimeTooSkewed"&&!ue)){Fe.next=25;break}return this.options.amendTimeSkewed=+new Date(te.serverTime)-new Date,Fe.next=24,E.default.awrap(this.request(z));case 24:return Fe.abrupt("return",Fe.sent);case 25:te.params=z,Fe.next=32;break;case 28:if(!ae){Fe.next=32;break}return Fe.next=31,E.default.awrap(this.requestError(ae));case 31:te=Fe.sent;case 32:if(!te){Fe.next=34;break}throw te;case 34:if(!z.xmlResponse){Fe.next=39;break}return Fe.next=37,E.default.awrap(this.parseXML(H.data));case 37:Se=Fe.sent,H.data=Se;case 39:return Fe.abrupt("return",H);case 40:case"end":return Fe.stop()}},null,this,[[5,12]])},ge._getResource=function(z){var ie="/";return z.bucket&&(ie+=z.bucket+"/"),z.object&&(ie+=z.object),ie},ge._isIP=ee,ge._escape=function(z){return G.encodeURIComponent(z).replace(/%2F/g,"/")},ge._getReqUrl=function(z){var ie={};v(this.options.endpoint).to(ie);var H=this._isIP(ie.hostname),ae=this.options.cname;z.bucket&&!ae&&!H&&(ie.host=z.bucket+"."+ie.host);var ue="/";z.bucket&&H&&(ue+=z.bucket+"/"),z.object&&(ue+=this._escape(z.object).replace(/\+/g,"%2B")),ie.pathname=ue;var te={};if(z.query&&S(te,z.query),z.subres){var Se={};B.string(z.subres)?Se[z.subres]="":B.array(z.subres)?z.subres.forEach(function(De){Se[De]=""}):Se=z.subres,S(te,Se)}return ie.query=te,W.format(ie)},ge._getUserAgent=function(){var z=d&&d.browser?"js":"nodejs",ie="aliyun-sdk-"+z+"/"+J.version,H=Q.description;return!H&&d&&(H="Node.js "+d.version.slice(1)+" on "+d.platform+" "+d.arch),this._checkUserAgent(ie+" "+H)},ge._checkUserAgent=function(z){var ie=z.replace(/\u03b1/,"alpha").replace(/\u03b2/,"beta");return ie},ge.checkBrowserAndVersion=function(z,ie){return U.name===z&&U.version.split(".")[0]===ie},ge.parseXML=function(z){return new M.default(function(ie,H){y.isBuffer(z)&&(z=z.toString()),I.parseString(z,{explicitRoot:!1,explicitArray:!1},function(ae,ue){ae?H(ae):ie(ue)})})},ge.requestError=function(z){var ie,H,ae,ue;return E.default.async(function(Se){for(;;)switch(Se.prev=Se.next){case 0:if(ie=null,!(!z.data||!z.data.length)){Se.next=5;break}z.status===-1||z.status===-2?(ie=new Error(z.message),ie.name=z.name,ie.status=z.status,ie.code=z.name):(z.status===404?(ie=new Error("Object not exists"),ie.name="NoSuchKeyError",ie.status=404,ie.code="NoSuchKey"):z.status===412?(ie=new Error("Pre condition failed"),ie.name="PreconditionFailedError",ie.status=412,ie.code="PreconditionFailed"):(ie=new Error("Unknow error, status: "+z.status),ie.name="UnknowError",ie.status=z.status),ie.requestId=z.headers["x-oss-request-id"],ie.host=""),Se.next=33;break;case 5:return H=String(z.data),this.debug("request response error data: %s",H,"error"),ae=void 0,Se.prev=8,Se.next=11,E.default.awrap(this.parseXML(H));case 11:if(Se.t0=Se.sent,Se.t0){Se.next=14;break}Se.t0={};case 14:ae=Se.t0,Se.next=24;break;case 17:return Se.prev=17,Se.t1=Se.catch(8),this.debug(H,"error"),Se.t1.message+=`
|
|
|
raw xml: `+H,Se.t1.status=z.status,Se.t1.requestId=z.headers["x-oss-request-id"],Se.abrupt("return",Se.t1);case 24:ue=ae.Message||"unknow request error, status: "+z.status,ae.Condition&&(ue+=" (condition: "+ae.Condition+")"),ie=new Error(ue),ie.name=ae.Code?ae.Code+"Error":"UnknowError",ie.status=z.status,ie.code=ae.Code,ie.requestId=ae.RequestId,ie.hostId=ae.HostId,ie.serverTime=ae.ServerTime;case 33:return this.debug("generate error %j",ie,"error"),Se.abrupt("return",ie);case 35:case"end":return Se.stop()}},null,this,[[8,17]])}}).call(this,{isBuffer:l("../../node_modules/is-buffer/index.js")},l("_process"))},{"../../node_modules/is-buffer/index.js":197,"../common/bucket/deleteBucketLifecycle":6,"../common/bucket/deleteBucketWebsite":7,"../common/bucket/getBucketLifecycle":8,"../common/bucket/getBucketVersioning":9,"../common/bucket/getBucketWebsite":10,"../common/bucket/putBucketLifecycle":11,"../common/bucket/putBucketVersioning":12,"../common/bucket/putBucketWebsite":13,"../common/client/initOptions":15,"../common/multipart":18,"../common/parallel":33,"../common/signUtils":34,"../common/utils/createRequest":38,"../common/utils/isIP":45,"./managed-upload":3,"./object":4,"./version":5,_process:208,agentkeepalive:48,"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/promise":61,"babel-runtime/regenerator":68,bowser:70,"copy-to":76,debug:288,"is-type-of":289,"merge-descriptors":200,platform:206,url:238,urllib:291,utility:290,xml2js:249}],3:[function(l,V,N){(function(y){"use strict";var d=l("babel-runtime/core-js/array/from"),F=h(d),M=l("babel-runtime/core-js/promise"),D=h(M),E=l("babel-runtime/regenerator"),g=h(E);function h(j){return j&&j.__esModule?j:{default:j}}var b=l("is-type-of"),p=l("util"),v=l("path"),I=l("mime"),x=l("copy-to"),S=l("../common/utils/isBlob"),W=S.isBlob,B=l("../common/utils/isFile"),Q=B.isFile,G=N;G.multipartUpload=function(T,ee,Z){var _,X,re,me,de,we,ge,ke,z;return g.default.async(function(H){for(;;)switch(H.prev=H.next){case 0:if(this.resetCancelFlag(),Z=Z||{},!(Z.checkpoint&&Z.checkpoint.uploadId)){H.next=6;break}return H.next=5,g.default.awrap(this._resumeMultipart(Z.checkpoint,Z));case 5:return H.abrupt("return",H.sent);case 6:return _=100*1024,Z.mime||(Q(ee)?Z.mime=I.getType(v.extname(ee.name)):W(ee)?Z.mime=ee.type:Z.mime=I.getType(v.extname(ee))),Z.headers=Z.headers||{},this._convertMetaToHeaders(Z.meta,Z.headers),H.next=12,g.default.awrap(this._getFileSize(ee));case 12:if(X=H.sent,!(X<_)){H.next=25;break}return re=this._createStream(ee,0,X),Z.contentLength=X,H.next=18,g.default.awrap(this.putStream(T,re,Z));case 18:if(me=H.sent,!(Z&&Z.progress)){H.next=22;break}return H.next=22,g.default.awrap(Z.progress(1));case 22:return de={res:me.res,bucket:this.options.bucket,name:T,etag:me.res.headers.etag},(Z.headers&&Z.headers["x-oss-callback"]||Z.callback)&&(de.data=me.data),H.abrupt("return",de);case 25:if(!(Z.partSize&&!(parseInt(Z.partSize,10)===Z.partSize))){H.next=27;break}throw new Error("partSize must be int number");case 27:if(!(Z.partSize&&Z.partSize<_)){H.next=29;break}throw new Error("partSize must not be smaller than "+_);case 29:return H.next=31,g.default.awrap(this.initMultipartUpload(T,Z));case 31:if(we=H.sent,ge=we.uploadId,ke=this._getPartSize(X,Z.partSize),z={file:ee,name:T,fileSize:X,partSize:ke,uploadId:ge,doneParts:[]},!(Z&&Z.progress)){H.next=38;break}return H.next=38,g.default.awrap(Z.progress(0,z,we.res));case 38:return H.next=40,g.default.awrap(this._resumeMultipart(z,Z));case 40:return H.abrupt("return",H.sent);case 41:case"end":return H.stop()}},null,this)},G._resumeMultipart=function(T,ee){var Z,_,X,re,me,de,we,ge,ke,z,ie,H,ae,ue,te,Se,De,Fe;return g.default.async(function(et){for(;;)switch(et.prev=et.next){case 0:if(Z=this,!this.isCancel()){et.next=3;break}throw this._makeCancelEvent();case 3:return _=T.file,X=T.fileSize,re=T.partSize,me=T.uploadId,de=T.doneParts,we=T.name,ge=[],de.length>0&&x(de).to(ge),ke=this._divideParts(X,re),z=ke.length,ie=!1,H=function(dt,Ye){var Pe=this;return new D.default(function(Ge,ot){var be,ye,$e,q;return g.default.async(function(c){for(;;)switch(c.prev=c.next){case 0:if(c.prev=0,dt.isCancel()){c.next=18;break}return be=ke[Ye-1],ye={stream:dt._createStream(_,be.start,be.end),size:be.end-be.start},c.next=6,g.default.awrap(dt._uploadPart(we,me,Ye,ye));case 6:if($e=c.sent,!(!dt.isCancel()&&!ie)){c.next=15;break}if(T.doneParts.push({number:Ye,etag:$e.res.headers.etag}),!ee.progress){c.next=12;break}return c.next=12,g.default.awrap(ee.progress(de.length/z,T,$e.res));case 12:Ge({number:Ye,etag:$e.res.headers.etag}),c.next=16;break;case 15:Ge();case 16:c.next=19;break;case 18:Ge();case 19:c.next=30;break;case 21:c.prev=21,c.t0=c.catch(0),q=new Error,q.name=c.t0.name,q.message=c.t0.message,q.stack=c.t0.stack,q.partNum=Ye,x(c.t0).to(q),ot(q);case 30:case"end":return c.stop()}},null,Pe,[[0,21]])})},ae=(0,F.default)(new Array(z),function(Ie,dt){return dt+1}),ue=ge.map(function(Ie){return Ie.number}),te=ae.filter(function(Ie){return ue.indexOf(Ie)<0}),Se=5,De=ee.parallel||Se,et.next=17,g.default.awrap(this._parallel(te,De,function(Ie){return new D.default(function(dt,Ye){H(Z,Ie).then(function(Pe){Pe&&ge.push(Pe),dt()}).catch(function(Pe){Ye(Pe)})})}));case 17:if(Fe=et.sent,ie=!0,!this.isCancel()){et.next=22;break}throw H=null,this._makeCancelEvent();case 22:if(!(Fe&&Fe.length>0)){et.next=25;break}throw Fe[0].message="Failed to upload some parts with error: "+Fe[0].toString()+" part_num: "+Fe[0].partNum,Fe[0];case 25:return et.next=27,g.default.awrap(this.completeMultipartUpload(we,me,ge,ee));case 27:return et.abrupt("return",et.sent);case 28:case"end":return et.stop()}},null,this)},G._getFileSize=function(T){return g.default.async(function(Z){for(;;)switch(Z.prev=Z.next){case 0:if(!b.buffer(T)){Z.next=4;break}return Z.abrupt("return",T.length);case 4:if(!(W(T)||Q(T))){Z.next=6;break}return Z.abrupt("return",T.size);case 6:throw new Error("_getFileSize requires Buffer/File/Blob.");case 7:case"end":return Z.stop()}},null,this)};var $=l("stream"),J=$.Readable;function U(j,T){if(!(this instanceof U))return new U(j,T);J.call(this,T),this.file=j,this.reader=new FileReader,this.start=0,this.finish=!1,this.fileBuffer=null}p.inherits(U,J),U.prototype.readFileAndPush=function(T){if(this.fileBuffer)for(var ee=!0;ee&&this.fileBuffer&&this.start<this.fileBuffer.length;){var Z=this.start,_=Z+T;_=_>this.fileBuffer.length?this.fileBuffer.length:_,this.start=_,ee=this.push(this.fileBuffer.slice(Z,_))}},U.prototype._read=function(T){if(this.file&&this.start>=this.file.size||this.fileBuffer&&this.start>=this.fileBuffer.length||this.finish||this.start===0&&!this.file){this.finish||(this.fileBuffer=null,this.finish=!0),this.push(null);return}var ee=16*1024;T=T||ee;var Z=this;this.reader.onload=function(X){Z.fileBuffer=y.from(new Uint8Array(X.target.result)),Z.file=null,Z.readFileAndPush(T)},this.start===0?this.reader.readAsArrayBuffer(this.file):this.readFileAndPush(T)},G._createStream=function(T,ee,Z){if(W(T)||Q(T))return new U(T.slice(ee,Z));throw new Error("_createStream requires File/Blob.")},G._getPartSize=function(T,ee){var Z=10*1e3,_=1024*1024;return ee?Math.max(Math.ceil(T/Z),ee):_},G._divideParts=function(T,ee){for(var Z=Math.ceil(T/ee),_=[],X=0;X<Z;X++){var re=ee*X,me=Math.min(re+ee,T);_.push({start:re,end:me})}return _}}).call(this,l("buffer").Buffer)},{"../common/utils/isBlob":43,"../common/utils/isFile":44,"babel-runtime/core-js/array/from":52,"babel-runtime/core-js/promise":61,"babel-runtime/regenerator":68,buffer:73,"copy-to":76,"is-type-of":289,mime:202,path:205,stream:230,util:243}],4:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/promise"),d=b(y),F=l("babel-runtime/core-js/object/keys"),M=b(F),D=l("babel-runtime/core-js/object/assign"),E=b(D),g=l("babel-runtime/regenerator"),h=b(g);function b(Z){return Z&&Z.__esModule?Z:{default:Z}}var p=l("utility"),v=l("fs"),I=l("is-type-of"),x=l("url"),S=l("copy-to"),W=l("path"),B=l("mime"),Q=l("../common/callback"),G=l("../common/signUtils"),$=l("merge-descriptors"),J=l("../common/utils/isBlob"),U=J.isBlob,j=l("../common/utils/isFile"),T=j.isFile,ee=N;ee.append=function(_,X,re){var me;return h.default.async(function(we){for(;;)switch(we.prev=we.next){case 0:return re=re||{},re.position===void 0&&(re.position="0"),re.subres={append:"",position:re.position},re.method="POST",we.next=6,h.default.awrap(this.put(_,X,re));case 6:return me=we.sent,me.nextAppendPosition=me.res.headers["x-oss-next-append-position"],we.abrupt("return",me);case 9:case"end":return we.stop()}},null,this)},ee.put=function(_,X,re){var me,de,we,ge,ke,z,ie;return h.default.async(function(ae){for(;;)switch(ae.prev=ae.next){case 0:if(me=void 0,re=re||{},_=this._objectName(_),!I.buffer(X)){ae.next=7;break}me=X,ae.next=33;break;case 7:if(!(U(X)||T(X))){ae.next=32;break}return re.mime||(T(X)?re.mime=B.getType(W.extname(X.name)):re.mime=X.type),de=this._createStream(X,0,X.size),ae.next=12,h.default.awrap(this._getFileSize(X));case 12:return re.contentLength=ae.sent,ae.prev=13,ae.next=16,h.default.awrap(this.putStream(_,de,re));case 16:return we=ae.sent,ae.abrupt("return",we);case 20:if(ae.prev=20,ae.t0=ae.catch(13),!(ae.t0.code==="RequestTimeTooSkewed")){ae.next=29;break}return this.options.amendTimeSkewed=+new Date(ae.t0.serverTime)-new Date,ae.next=26,h.default.awrap(this.put(_,X,re));case 26:return ae.abrupt("return",ae.sent);case 29:throw ae.t0;case 30:ae.next=33;break;case 32:throw new TypeError("Must provide Buffer/Blob/File for put.");case 33:return re.headers=re.headers||{},this._convertMetaToHeaders(re.meta,re.headers),ge=re.method||"PUT",ke=this._objectRequestParams(ge,_,re),Q.encodeCallback(ke,re),ke.mime=re.mime,ke.content=me,ke.successStatuses=[200],ae.next=43,h.default.awrap(this.request(ke));case 43:return z=ae.sent,ie={name:_,url:this._objectUrl(_),res:z.res},ke.headers&&ke.headers["x-oss-callback"]&&(ie.data=JSON.parse(z.data.toString())),ae.abrupt("return",ie);case 47:case"end":return ae.stop()}},null,this,[[13,20]])},ee.putStream=function(_,X,re){var me,de,we,ge;return h.default.async(function(z){for(;;)switch(z.prev=z.next){case 0:return re=re||{},re.headers=re.headers||{},_=this._objectName(_),re.contentLength?re.headers["Content-Length"]=re.contentLength:re.headers["Transfer-Encoding"]="chunked",this._convertMetaToHeaders(re.meta,re.headers),me=re.method||"PUT",de=this._objectRequestParams(me,_,re),Q.encodeCallback(de,re),de.mime=re.mime,de.stream=X,de.successStatuses=[200],z.next=13,h.default.awrap(this.request(de));case 13:return we=z.sent,ge={name:_,url:this._objectUrl(_),res:we.res},de.headers&&de.headers["x-oss-callback"]&&(ge.data=JSON.parse(we.data.toString())),z.abrupt("return",ge);case 17:case"end":return z.stop()}},null,this)},$(ee,l("../common/object/copyObject")),$(ee,l("../common/object/getObjectTagging")),$(ee,l("../common/object/putObjectTagging")),$(ee,l("../common/object/deleteObjectTagging")),$(ee,l("../common/image")),$(ee,l("../common/object/getBucketVersions")),$(ee,l("../common/object/getACL")),$(ee,l("../common/object/putACL")),$(ee,l("../common/object/head")),$(ee,l("../common/object/delete")),$(ee,l("../common/object/get")),$(ee,l("../common/object/putSymlink")),$(ee,l("../common/object/getSymlink")),$(ee,l("../common/object/deleteMulti")),$(ee,l("../common/object/getObjectMeta")),ee.putMeta=function(_,X,re){var me;return h.default.async(function(we){for(;;)switch(we.prev=we.next){case 0:return we.next=2,h.default.awrap(this.copy(_,_,{meta:X||{},timeout:re&&re.timeout,ctx:re&&re.ctx}));case 2:return me=we.sent,we.abrupt("return",me);case 4:case"end":return we.stop()}},null,this)},ee.list=function(_,X){var re,me,de,we,ge;return h.default.async(function(z){for(;;)switch(z.prev=z.next){case 0:return re=this._objectRequestParams("GET","",X),re.query=_,re.xmlResponse=!0,re.successStatuses=[200],z.next=6,h.default.awrap(this.request(re));case 6:return me=z.sent,de=me.data.Contents,we=this,de&&(Array.isArray(de)||(de=[de]),de=de.map(function(ie){return{name:ie.Key,url:we._objectUrl(ie.Key),lastModified:ie.LastModified,etag:ie.ETag,type:ie.Type,size:Number(ie.Size),storageClass:ie.StorageClass,owner:{id:ie.Owner.ID,displayName:ie.Owner.DisplayName}}})),ge=me.data.CommonPrefixes||null,ge&&(Array.isArray(ge)||(ge=[ge]),ge=ge.map(function(ie){return ie.Prefix})),z.abrupt("return",{res:me.res,objects:de,prefixes:ge,nextMarker:me.data.NextMarker||null,isTruncated:me.data.IsTruncated==="true"});case 13:case"end":return z.stop()}},null,this)},ee.restore=function(_,X){var re,me;return h.default.async(function(we){for(;;)switch(we.prev=we.next){case 0:return X=X||{},X.subres=(0,E.default)({restore:""},X.subres),X.versionId&&(X.subres.versionId=X.versionId),re=this._objectRequestParams("POST",_,X),re.successStatuses=[202],we.next=7,h.default.awrap(this.request(re));case 7:return me=we.sent,we.abrupt("return",{res:me.res});case 9:case"end":return we.stop()}},null,this)},ee.signatureUrl=function(_,X){X=X||{},_=this._objectName(_),X.method=X.method||"GET";var re=p.timestamp()+(X.expires||1800),me={bucket:this.options.bucket,object:_},de=this._getResource(me);this.options.stsToken&&(X["security-token"]=this.options.stsToken);var we=G._signatureForURL(this.options.accessKeySecret,X,de,re),ge=x.parse(this._getReqUrl(me));return ge.query={OSSAccessKeyId:this.options.accessKeyId,Expires:re,Signature:we.Signature},S(we.subResource).to(ge.query),ge.format()},ee.getObjectUrl=function(_,X){return X?X[X.length-1]!=="/"&&(X+="/"):X=this.options.endpoint.format(),X+this._escape(this._objectName(_))},ee._objectUrl=function(_){return this._getReqUrl({bucket:this.options.bucket,object:_})},ee.generateObjectUrl=function(Z,_){if(_)_[_.length-1]!=="/"&&(_+="/");else{_=this.options.endpoint.format();var X=x.parse(_),re=this.options.bucket;X.hostname=re+"."+X.hostname,X.host=re+"."+X.host,_=X.format()}return _+this._escape(this._objectName(Z))},ee._objectRequestParams=function(_,X,re){if(!this.options.bucket)throw new Error("Please create a bucket first");re=re||{},X=this._objectName(X);var me={object:X,bucket:this.options.bucket,method:_,subres:re&&re.subres,timeout:re&&re.timeout,ctx:re&&re.ctx};return re.headers&&(me.headers={},S(re.headers).to(me.headers)),me},ee._objectName=function(_){return _.replace(/^\/+/,"")},ee._convertMetaToHeaders=function(_,X){if(!_)return;(0,M.default)(_).forEach(function(re){X["x-oss-meta-"+re]=_[re]})},ee._deleteFileSafe=function(_){var X=this;return new d.default(function(re){v.exists(_,function(me){me?v.unlink(_,function(de){de&&X.debug("unlink %j error: %s",_,de,"error"),re()}):re()})})}},{"../common/callback":14,"../common/image":16,"../common/object/copyObject":19,"../common/object/delete":20,"../common/object/deleteMulti":21,"../common/object/deleteObjectTagging":22,"../common/object/get":23,"../common/object/getACL":24,"../common/object/getBucketVersions":25,"../common/object/getObjectMeta":26,"../common/object/getObjectTagging":27,"../common/object/getSymlink":28,"../common/object/head":29,"../common/object/putACL":30,"../common/object/putObjectTagging":31,"../common/object/putSymlink":32,"../common/signUtils":34,"../common/utils/isBlob":43,"../common/utils/isFile":44,"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/object/keys":60,"babel-runtime/core-js/promise":61,"babel-runtime/regenerator":68,"copy-to":76,fs:71,"is-type-of":289,"merge-descriptors":200,mime:202,path:205,url:238,utility:290}],5:[function(l,V,N){"use strict";N.version="6.10.0"},{}],6:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(g){return g&&g.__esModule?g:{default:g}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=N;E.deleteBucketLifecycle=function(h,b){var p,v;return d.default.async(function(x){for(;;)switch(x.prev=x.next){case 0:return D(h),p=this._bucketRequestParams("DELETE",h,"lifecycle",b),p.successStatuses=[204],x.next=5,d.default.awrap(this.request(p));case 5:return v=x.sent,x.abrupt("return",{res:v.res});case 7:case"end":return x.stop()}},null,this)}},{"../utils/checkBucketName":35,"babel-runtime/regenerator":68}],7:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(g){return g&&g.__esModule?g:{default:g}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=N;E.deleteBucketWebsite=function(h,b){var p,v;return d.default.async(function(x){for(;;)switch(x.prev=x.next){case 0:return D(h),p=this._bucketRequestParams("DELETE",h,"website",b),p.successStatuses=[204],x.next=5,d.default.awrap(this.request(p));case 5:return v=x.sent,x.abrupt("return",{res:v.res});case 7:case"end":return x.stop()}},null,this)}},{"../utils/checkBucketName":35,"babel-runtime/regenerator":68}],8:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(v){return v&&v.__esModule?v:{default:v}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=l("../utils/isArray"),g=E.isArray,h=l("../utils/formatObjKey"),b=h.formatObjKey,p=N;p.getBucketLifecycle=function(I,x){var S,W,B;return d.default.async(function(G){for(;;)switch(G.prev=G.next){case 0:return D(I),S=this._bucketRequestParams("GET",I,"lifecycle",x),S.successStatuses=[200],S.xmlResponse=!0,G.next=6,d.default.awrap(this.request(S));case 6:return W=G.sent,B=W.data.Rule||null,B&&(g(B)||(B=[B]),B=B.map(function($){return $.ID&&($.id=$.ID,delete $.ID),$.Tag&&!g($.Tag)&&($.Tag=[$.Tag]),b($,"firstLowerCase")})),G.abrupt("return",{rules:B,res:W.res});case 10:case"end":return G.stop()}},null,this)}},{"../utils/checkBucketName":35,"../utils/formatObjKey":40,"../utils/isArray":42,"babel-runtime/regenerator":68}],9:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(g){return g&&g.__esModule?g:{default:g}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=N;E.getBucketVersioning=function(h,b){var p,v,I;return d.default.async(function(S){for(;;)switch(S.prev=S.next){case 0:return D(h),p=this._bucketRequestParams("GET",h,"versioning",b),p.xmlResponse=!0,p.successStatuses=[200],S.next=6,d.default.awrap(this.request(p));case 6:return v=S.sent,I=v.data.Status,S.abrupt("return",{status:v.status,versionStatus:I,res:v.res});case 9:case"end":return S.stop()}},null,this)}},{"../utils/checkBucketName":35,"babel-runtime/regenerator":68}],10:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(b){return b&&b.__esModule?b:{default:b}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=l("../utils/isObject"),g=E.isObject,h=N;h.getBucketWebsite=function(p,v){var I,x,S;return d.default.async(function(B){for(;;)switch(B.prev=B.next){case 0:return D(p),I=this._bucketRequestParams("GET",p,"website",v),I.successStatuses=[200],I.xmlResponse=!0,B.next=6,d.default.awrap(this.request(I));case 6:return x=B.sent,S=[],x.data.RoutingRules&&x.data.RoutingRules.RoutingRule&&(g(x.data.RoutingRules.RoutingRule)?S=[x.data.RoutingRules.RoutingRule]:S=x.data.RoutingRules.RoutingRule),B.abrupt("return",{index:x.data.IndexDocument&&x.data.IndexDocument.Suffix||"",supportSubDir:x.data.IndexDocument&&x.data.IndexDocument.SupportSubDir||"false",type:x.data.IndexDocument&&x.data.IndexDocument.Type,routingRules:S,error:x.data.ErrorDocument&&x.data.ErrorDocument.Key||null,res:x.res});case 10:case"end":return B.stop()}},null,this)}},{"../utils/checkBucketName":35,"../utils/isObject":46,"babel-runtime/regenerator":68}],11:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(T){return T&&T.__esModule?T:{default:T}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=l("../utils/isArray"),g=E.isArray,h=l("../utils/deepCopy"),b=h.deepCopy,p=l("../utils/isObject"),v=p.isObject,I=l("../utils/obj2xml"),x=I.obj2xml,S=l("../utils/checkObjectTag"),W=S.checkObjectTag,B=l("../utils/getStrBytesCount"),Q=B.getStrBytesCount,G=N;G.putBucketLifecycle=function(ee,Z,_){var X,re,me,de,we;return d.default.async(function(ke){for(;;)switch(ke.prev=ke.next){case 0:if(D(ee),g(Z)){ke.next=3;break}throw new Error("rules must be Array");case 3:return X=this._bucketRequestParams("PUT",ee,"lifecycle",_),re=[],me={LifecycleConfiguration:{Rule:re}},Z.forEach(function(z){$(z),j(z),z.id&&(z.ID=z.id,delete z.id),re.push(z)}),de=x(me,{headers:!0,firstUpperCase:!0}),X.content=de,X.mime="xml",X.successStatuses=[200],ke.next=13,d.default.awrap(this.request(X));case 13:return we=ke.sent,ke.abrupt("return",{res:we.res});case 15:case"end":return ke.stop()}},null,this)};function $(T){T.days&&(T.expiration={days:T.days}),T.date&&(T.expiration={createdBeforeDate:T.date})}function J(T,ee){var Z=T.days,_=T.createdBeforeDate;if(!Z&&!_)throw new Error(ee+" must includes days or createdBeforeDate");if(Z&&!/^[1-9][0-9]*$/.test(Z))throw new Error("days must be a positive integer");if(_&&!/\d{4}-\d{2}-\d{2}T00:00:00.000Z/.test(_))throw new Error("createdBeforeDate must be date and conform to iso8601 format")}function U(T){if(!g(T)&&!v(T))throw new Error("tag must be Object or Array");T=v(T)?[T]:T;var ee={},Z=b(T);Z.forEach(function(_){ee[_.key]=_.value}),W(ee)}function j(T){if(T.id&&Q(T.id)>255)throw new Error("ID is composed of 255 bytes at most");if(T.prefix===""||T.prefix===void 0)throw new Error("Rule must includes prefix");if(!["Enabled","Disabled"].includes(T.status))throw new Error("Status must be Enabled or Disabled");if(T.transition){if(!["IA","Archive"].includes(T.transition.storageClass))throw new Error("StorageClass must be IA or Archive");J(T.transition,"Transition")}if(T.expiration){if(!T.expiration.expiredObjectDeleteMarker)J(T.expiration,"Expiration");else if(T.expiration.days||T.expiration.createdBeforeDate)throw new Error("expiredObjectDeleteMarker cannot be used with days or createdBeforeDate")}if(T.abortMultipartUpload&&J(T.abortMultipartUpload,"AbortMultipartUpload"),!T.expiration&&!T.abortMultipartUpload&&!T.transition&&!T.noncurrentVersionTransition)throw new Error("Rule must includes expiration or abortMultipartUpload or transition or noncurrentVersionTransition");if(T.tag){if(T.abortMultipartUpload)throw new Error("Tag cannot be used with abortMultipartUpload");U(T.tag)}}},{"../utils/checkBucketName":35,"../utils/checkObjectTag":36,"../utils/deepCopy":39,"../utils/getStrBytesCount":41,"../utils/isArray":42,"../utils/isObject":46,"../utils/obj2xml":47,"babel-runtime/regenerator":68}],12:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(b){return b&&b.__esModule?b:{default:b}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=l("../utils/obj2xml"),g=E.obj2xml,h=N;h.putBucketVersioning=function(p,v){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},x,S,W;return d.default.async(function(Q){for(;;)switch(Q.prev=Q.next){case 0:if(D(p),["Enabled","Suspended"].includes(v)){Q.next=3;break}throw new Error("status must be Enabled or Suspended");case 3:return x=this._bucketRequestParams("PUT",p,"versioning",I),S={VersioningConfiguration:{Status:v}},x.mime="xml",x.content=g(S,{headers:!0}),Q.next=9,d.default.awrap(this.request(x));case 9:return W=Q.sent,Q.abrupt("return",{res:W.res,status:W.status});case 11:case"end":return Q.stop()}},null,this)}},{"../utils/checkBucketName":35,"../utils/obj2xml":47,"babel-runtime/regenerator":68}],13:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(v){return v&&v.__esModule?v:{default:v}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=l("../utils/obj2xml"),g=E.obj2xml,h=l("../utils/isArray"),b=h.isArray,p=N;p.putBucketWebsite=function(I){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=arguments[2],W,B,Q,G,$;return d.default.async(function(U){for(;;)switch(U.prev=U.next){case 0:if(D(I),W=this._bucketRequestParams("PUT",I,"website",S),B={Suffix:x.index||"index.html"},Q={IndexDocument:B},G={WebsiteConfiguration:Q},x.supportSubDir&&(B.SupportSubDir=x.supportSubDir),x.type&&(B.Type=x.type),x.error&&(Q.ErrorDocument={Key:x.error}),!(x.routingRules!==void 0)){U.next=12;break}if(b(x.routingRules)){U.next=11;break}throw new Error("RoutingRules must be Array");case 11:Q.RoutingRules={RoutingRule:x.routingRules};case 12:return G=g(G),W.content=G,W.mime="xml",W.successStatuses=[200],U.next=18,d.default.awrap(this.request(W));case 18:return $=U.sent,U.abrupt("return",{res:$.res});case 20:case"end":return U.stop()}},null,this)}},{"../utils/checkBucketName":35,"../utils/isArray":42,"../utils/obj2xml":47,"babel-runtime/regenerator":68}],14:[function(l,V,N){(function(y){"use strict";var d=l("babel-runtime/core-js/object/keys"),F=E(d),M=l("babel-runtime/core-js/json/stringify"),D=E(M);function E(g){return g&&g.__esModule?g:{default:g}}N.encodeCallback=function(h,b){if(h.headers=h.headers||{},!Object.prototype.hasOwnProperty.call(h.headers,"x-oss-callback")&&b.callback){var p={callbackUrl:encodeURI(b.callback.url),callbackBody:b.callback.body};b.callback.host&&(p.callbackHost=b.callback.host),b.callback.contentType&&(p.callbackBodyType=b.callback.contentType);var v=y.from((0,D.default)(p)).toString("base64");if(h.headers["x-oss-callback"]=v,b.callback.customValue){var I={};(0,F.default)(b.callback.customValue).forEach(function(x){I["x:"+x]=b.callback.customValue[x]}),h.headers["x-oss-callback-var"]=y.from((0,D.default)(I)).toString("base64")}}}}).call(this,l("buffer").Buffer)},{"babel-runtime/core-js/json/stringify":53,"babel-runtime/core-js/object/keys":60,buffer:73}],15:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/assign"),d=F(y);function F(p){return p&&p.__esModule?p:{default:p}}var M=l("humanize-ms"),D=l("url"),E=l("../utils/checkBucketName"),g=E.checkBucketName;function h(p,v){var I=D.parse(p);if(I.protocol||(I=D.parse("http"+(v?"s":"")+"://"+p)),I.protocol!=="http:"&&I.protocol!=="https:")throw new Error("Endpoint protocol must be http or https.");return I}function b(p,v,I){var x=I?"https://":"http://",S=v?"-internal.aliyuncs.com":".aliyuncs.com",W="vpc100-oss-cn-";return p.substr(0,W.length)===W&&(S=".aliyuncs.com"),D.parse(x+p+S)}V.exports=function(p){if(!p||!p.accessKeyId||!p.accessKeySecret)throw new Error("require accessKeyId, accessKeySecret");p.bucket&&g(p.bucket);var v=(0,d.default)({region:"oss-cn-hangzhou",internal:!1,secure:!1,timeout:6e4,bucket:null,endpoint:null,cname:!1,isRequestPay:!1,sldEnable:!1},p);if(v.accessKeyId=v.accessKeyId.trim(),v.accessKeySecret=v.accessKeySecret.trim(),v.timeout&&(v.timeout=M(v.timeout)),v.endpoint)v.endpoint=h(v.endpoint,v.secure);else if(v.region)v.endpoint=b(v.region,v.internal,v.secure);else throw new Error("require options.endpoint or options.region");return v.inited=!0,v}},{"../utils/checkBucketName":35,"babel-runtime/core-js/object/assign":54,"humanize-ms":194,url:238}],16:[function(l,V,N){"use strict";var y=l("merge-descriptors"),d=N;y(d,l("./processObjectSave"))},{"./processObjectSave":17,"merge-descriptors":200}],17:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(v){return v&&v.__esModule?v:{default:v}}var M=l("../utils/checkBucketName"),D=M.checkBucketName,E=l("querystring"),g=l("js-base64"),h=g.Base64.encode,b=N;b.processObjectSave=function(I,x,S,W){var B,Q,G,$;return d.default.async(function(U){for(;;)switch(U.prev=U.next){case 0:return p(I,"sourceObject"),p(x,"targetObject"),p(S,"process"),x=this._objectName(x),W&&D(W),B=this._objectRequestParams("POST",I,{subres:"x-oss-process"}),Q=W?",b_"+h(W):"",x=h(x),G={"x-oss-process":S+"|sys/saveas,o_"+x+Q},B.content=E.stringify(G),U.next=12,d.default.awrap(this.request(B));case 12:return $=U.sent,U.abrupt("return",{res:$.res,status:$.res.status});case 14:case"end":return U.stop()}},null,this)};function p(v,I){if(!v)throw new Error(I+" is required");if(typeof v!="string")throw new Error(I+" must be String")}},{"../utils/checkBucketName":35,"babel-runtime/regenerator":68,"js-base64":199,querystring:212}],18:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=F(y);function F(b){return b&&b.__esModule?b:{default:b}}var M=l("copy-to"),D=l("./callback"),E=l("./utils/deepCopy"),g=E.deepCopy,h=N;h.listUploads=function(p,v){var I,x,S,W;return d.default.async(function(Q){for(;;)switch(Q.prev=Q.next){case 0:return v=v||{},I={},M(v).to(I),I.subres="uploads",x=this._objectRequestParams("GET","",I),x.query=p,x.xmlResponse=!0,x.successStatuses=[200],Q.next=10,d.default.awrap(this.request(x));case 10:return S=Q.sent,W=S.data.Upload||[],Array.isArray(W)||(W=[W]),W=W.map(function(G){return{name:G.Key,uploadId:G.UploadId,initiated:G.Initiated}}),Q.abrupt("return",{res:S.res,uploads:W,bucket:S.data.Bucket,nextKeyMarker:S.data.NextKeyMarker,nextUploadIdMarker:S.data.NextUploadIdMarker,isTruncated:S.data.IsTruncated==="true"});case 15:case"end":return Q.stop()}},null,this)},h.listParts=function(p,v,I,x){var S,W,B;return d.default.async(function(G){for(;;)switch(G.prev=G.next){case 0:return x=x||{},S={},M(x).to(S),S.subres={uploadId:v},W=this._objectRequestParams("GET",p,S),W.query=I,W.xmlResponse=!0,W.successStatuses=[200],G.next=10,d.default.awrap(this.request(W));case 10:return B=G.sent,G.abrupt("return",{res:B.res,uploadId:B.data.UploadId,bucket:B.data.Bucket,name:B.data.Key,partNumberMarker:B.data.PartNumberMarker,nextPartNumberMarker:B.data.NextPartNumberMarker,maxParts:B.data.MaxParts,isTruncated:B.data.IsTruncated,parts:B.data.Part||[]});case 12:case"end":return G.stop()}},null,this)},h.abortMultipartUpload=function(p,v,I){var x,S,W;return d.default.async(function(Q){for(;;)switch(Q.prev=Q.next){case 0:return this._stop(),I=I||{},x={},M(I).to(x),x.subres={uploadId:v},S=this._objectRequestParams("DELETE",p,x),S.successStatuses=[204],Q.next=9,d.default.awrap(this.request(S));case 9:return W=Q.sent,Q.abrupt("return",{res:W.res});case 11:case"end":return Q.stop()}},null,this)},h.initMultipartUpload=function(p,v){var I,x,S;return d.default.async(function(B){for(;;)switch(B.prev=B.next){case 0:return v=v||{},I={},M(v).to(I),I.headers=I.headers||{},this._convertMetaToHeaders(v.meta,I.headers),I.subres="uploads",x=this._objectRequestParams("POST",p,I),x.mime=v.mime,x.xmlResponse=!0,x.successStatuses=[200],B.next=12,d.default.awrap(this.request(x));case 12:return S=B.sent,B.abrupt("return",{res:S.res,bucket:S.data.Bucket,name:S.data.Key,uploadId:S.data.UploadId});case 14:case"end":return B.stop()}},null,this)},h.uploadPart=function(p,v,I,x,S,W,B){var Q;return d.default.async(function($){for(;;)switch($.prev=$.next){case 0:return Q={stream:this._createStream(x,S,W),size:W-S},$.next=3,d.default.awrap(this._uploadPart(p,v,I,Q,B));case 3:return $.abrupt("return",$.sent);case 4:case"end":return $.stop()}},null,this)},h.completeMultipartUpload=function(p,v,I,x){var S,W,B,Q,G,$,J,U;return d.default.async(function(T){for(;;)switch(T.prev=T.next){case 0:for(S=I.concat().sort(function(ee,Z){return ee.number-Z.number}).filter(function(ee,Z,_){return!Z||ee.number!==_[Z-1].number}),W=`<?xml version="1.0" encoding="UTF-8"?>
|
|
|
<CompleteMultipartUpload>
|
|
|
`,B=0;B<S.length;B++)Q=S[B],W+=`<Part>
|
|
|
`,W+="<PartNumber>"+Q.number+`</PartNumber>
|
|
|
`,W+="<ETag>"+Q.etag+`</ETag>
|
|
|
`,W+=`</Part>
|
|
|
`;return W+="</CompleteMultipartUpload>",x=x||{},G={},G=g(x),G.headers&&delete G.headers["x-oss-server-side-encryption"],G.subres={uploadId:v},$=this._objectRequestParams("POST",p,G),D.encodeCallback($,G),$.mime="xml",$.content=W,$.headers&&$.headers["x-oss-callback"]||($.xmlResponse=!0),$.successStatuses=[200],T.next=17,d.default.awrap(this.request($));case 17:return J=T.sent,U={res:J.res,bucket:$.bucket,name:p,etag:J.res.headers.etag},$.headers&&$.headers["x-oss-callback"]&&(U.data=JSON.parse(J.data.toString())),T.abrupt("return",U);case 21:case"end":return T.stop()}},null,this)},h._uploadPart=function(p,v,I,x,S){var W,B,Q;return d.default.async(function($){for(;;)switch($.prev=$.next){case 0:return S=S||{},W={},M(S).to(W),W.headers={"Content-Length":x.size},W.subres={partNumber:I,uploadId:v},B=this._objectRequestParams("PUT",p,W),B.mime=W.mime,B.stream=x.stream,B.successStatuses=[200],$.next=11,d.default.awrap(this.request(B));case 11:if(Q=$.sent,Q.res.headers.etag){$.next=14;break}throw new Error(`Please set the etag of expose-headers in OSS
|
|
|
https://help.aliyun.com/document_detail/32069.html`);case 14:return x.stream=null,B.stream=null,$.abrupt("return",{name:p,etag:Q.res.headers.etag,res:Q.res});case 17:case"end":return $.stop()}},null,this)}},{"./callback":14,"./utils/deepCopy":39,"babel-runtime/regenerator":68,"copy-to":76}],19:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=g(y),F=l("babel-runtime/core-js/object/keys"),M=g(F),D=l("babel-runtime/helpers/typeof"),E=g(D);function g(v){return v&&v.__esModule?v:{default:v}}var h=l("../utils/checkBucketName"),b=h.checkBucketName,p=N;p.copy=function(I,x,S,W){var B,Q,G;return d.default.async(function(J){for(;;)switch(J.prev=J.next){case 0:return(typeof S=="undefined"?"undefined":(0,E.default)(S))==="object"&&(W=S),W=W||{},W.headers=W.headers||{},(0,M.default)(W.headers).forEach(function(U){W.headers["x-oss-copy-source-"+U.toLowerCase()]=W.headers[U]}),W.meta&&(W.headers["x-oss-metadata-directive"]="REPLACE"),this._convertMetaToHeaders(W.meta,W.headers),x=this._getSourceName(x,S),W.versionId&&(x=x+"?versionId="+W.versionId),W.headers["x-oss-copy-source"]=x,B=this._objectRequestParams("PUT",I,W),B.xmlResponse=!0,B.successStatuses=[200,304],J.next=14,d.default.awrap(this.request(B));case 14:return Q=J.sent,G=Q.data,G&&(G={etag:G.ETag,lastModified:G.LastModified}),J.abrupt("return",{data:G,res:Q.res});case 18:case"end":return J.stop()}},null,this)},p._getSourceName=function(I,x){return typeof x=="string"?I=this._objectName(I):I[0]!=="/"?x=this.options.bucket:(x=I.replace(/\/(.+?)(\/.*)/,"$1"),I=I.replace(/(\/.+?\/)(.*)/,"$2")),b(x),I=encodeURI(I),I="/"+x+"/"+I,I}},{"../utils/checkBucketName":35,"babel-runtime/core-js/object/keys":60,"babel-runtime/helpers/typeof":67,"babel-runtime/regenerator":68}],20:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(g){return g&&g.__esModule?g:{default:g}}var E=N;E.delete=function(h){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p,v;return d.default.async(function(x){for(;;)switch(x.prev=x.next){case 0:return b.subres=(0,M.default)({},b.subres),b.versionId&&(b.subres.versionId=b.versionId),p=this._objectRequestParams("DELETE",h,b),p.successStatuses=[204],x.next=6,d.default.awrap(this.request(p));case 6:return v=x.sent,x.abrupt("return",{res:v.res});case 8:case"end":return x.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],21:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(p){return p&&p.__esModule?p:{default:p}}var E=l("utility"),g=l("../utils/obj2xml"),h=g.obj2xml,b=N;b.deleteMulti=function(v){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x,S,W,B,Q,G,$,J,U,j,T,ee;return d.default.async(function(_){for(;;)switch(_.prev=_.next){case 0:if(x=[],!(!v||!v.length)){_.next=3;break}throw new Error("names is required");case 3:for(S=0;S<v.length;S++)W={},typeof v[S]=="string"?W.Key=E.escape(this._objectName(v[S])):(B=v[S],Q=B.key,G=B.versionId,W.Key=E.escape(this._objectName(Q)),W.VersionId=G),x.push(W);return $={Delete:{Quiet:!!I.quiet,Object:x}},J=h($,{headers:!0}),I.subres=(0,M.default)({delete:""},I.subres),I.versionId&&(I.subres.versionId=I.versionId),U=this._objectRequestParams("POST","",I),U.mime="xml",U.content=J,U.xmlResponse=!0,U.successStatuses=[200],_.next=15,d.default.awrap(this.request(U));case 15:return j=_.sent,T=j.data,ee=T&&T.Deleted||null,ee&&(Array.isArray(ee)||(ee=[ee])),_.abrupt("return",{res:j.res,deleted:ee||[]});case 20:case"end":return _.stop()}},null,this)}},{"../utils/obj2xml":47,"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68,utility:290}],22:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(g){return g&&g.__esModule?g:{default:g}}var E=N;E.deleteObjectTagging=function(h){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p,v;return d.default.async(function(x){for(;;)switch(x.prev=x.next){case 0:return b.subres=(0,M.default)({tagging:""},b.subres),b.versionId&&(b.subres.versionId=b.versionId),h=this._objectName(h),p=this._objectRequestParams("DELETE",h,b),p.successStatuses=[204],x.next=7,d.default.awrap(this.request(p));case 7:return v=x.sent,x.abrupt("return",{status:v.status,res:v.res});case 9:case"end":return x.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],23:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(b){return b&&b.__esModule?b:{default:b}}var E=l("fs"),g=l("is-type-of"),h=N;h.get=function(p,v){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},x,S,W,B;return d.default.async(function(G){for(;;)switch(G.prev=G.next){case 0:return x=null,S=!1,g.writableStream(v)?x=v:g.string(v)?(x=E.createWriteStream(v),S=!0):I=v,I=I||{},I.subres=(0,M.default)({},I.subres),I.versionId&&(I.subres.versionId=I.versionId),I.process&&(I.subres["x-oss-process"]=I.process),W=void 0,G.prev=8,B=this._objectRequestParams("GET",p,I),B.writeStream=x,B.successStatuses=[200,206,304],G.next=14,d.default.awrap(this.request(B));case 14:W=G.sent,S&&x.destroy(),G.next=25;break;case 18:if(G.prev=18,G.t0=G.catch(8),!S){G.next=24;break}return x.destroy(),G.next=24,d.default.awrap(this._deleteFileSafe(v));case 24:throw G.t0;case 25:return G.abrupt("return",{res:W.res,content:W.data});case 26:case"end":return G.stop()}},null,this,[[8,18]])}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68,fs:71,"is-type-of":289}],24:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(g){return g&&g.__esModule?g:{default:g}}var E=N;E.getACL=function(h){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p,v;return d.default.async(function(x){for(;;)switch(x.prev=x.next){case 0:return b.subres=(0,M.default)({acl:""},b.subres),b.versionId&&(b.subres.versionId=b.versionId),h=this._objectName(h),p=this._objectRequestParams("GET",h,b),p.successStatuses=[200],p.xmlResponse=!0,x.next=8,d.default.awrap(this.request(p));case 8:return v=x.sent,x.abrupt("return",{acl:v.data.AccessControlList.Grant,owner:{id:v.data.Owner.ID,displayName:v.data.Owner.DisplayName},res:v.res});case 10:case"end":return x.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],25:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/keys"),d=g(y),F=l("babel-runtime/regenerator"),M=g(F),D=l("babel-runtime/core-js/object/assign"),E=g(D);function g(B){return B&&B.__esModule?B:{default:B}}var h=N,b=l("../utils/isObject"),p=b.isObject,v=l("../utils/isArray"),I=v.isArray;h.getBucketVersions=x,h.listObjectVersions=x;function x(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},G,$,J,U,j,T;return M.default.async(function(Z){for(;;)switch(Z.prev=Z.next){case 0:if(!(B.versionIdMarker&&B.keyMarker===void 0)){Z.next=2;break}throw new Error("A version-id marker cannot be specified without a key marker");case 2:return Q.subres=(0,E.default)({versions:""},Q.subres),Q.versionId&&(Q.subres.versionId=Q.versionId),G=this._objectRequestParams("GET","",Q),G.xmlResponse=!0,G.successStatuses=[200],G.query=W(B),Z.next=10,M.default.awrap(this.request(G));case 10:return $=Z.sent,J=$.data.Version||[],U=$.data.DeleteMarker||[],j=this,J&&(Array.isArray(J)||(J=[J]),J=J.map(function(_){return{name:_.Key,url:j._objectUrl(_.Key),lastModified:_.LastModified,isLatest:_.IsLatest==="true",versionId:_.VersionId,etag:_.ETag,type:_.Type,size:Number(_.Size),storageClass:_.StorageClass,owner:{id:_.Owner.ID,displayName:_.Owner.DisplayName}}})),U&&(I(U)||(U=[U]),U=U.map(function(_){return{name:_.Key,lastModified:_.LastModified,versionId:_.VersionId,owner:{id:_.Owner.ID,displayName:_.Owner.DisplayName}}})),T=$.data.CommonPrefixes||null,T&&(I(T)||(T=[T]),T=T.map(function(_){return _.Prefix})),Z.abrupt("return",{res:$.res,objects:J,deleteMarker:U,prefixes:T,nextMarker:$.data.NextMarker||null,NextVersionIdMarker:$.data.NextVersionIdMarker||null,isTruncated:$.data.IsTruncated==="true"});case 19:case"end":return Z.stop()}},null,this)}function S(B){return B.replace(/([A-Z])/g,"-$1").toLowerCase()}function W(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Q={};return p(B)&&(0,d.default)(B).forEach(function(G){Q[S(G)]=B[G]}),Q}},{"../utils/isArray":42,"../utils/isObject":46,"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/object/keys":60,"babel-runtime/regenerator":68}],26:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(g){return g&&g.__esModule?g:{default:g}}var E=N;E.getObjectMeta=function(h,b){var p,v;return d.default.async(function(x){for(;;)switch(x.prev=x.next){case 0:return b=b||{},h=this._objectName(h),b.subres=(0,M.default)({objectMeta:""},b.subres),b.versionId&&(b.subres.versionId=b.versionId),p=this._objectRequestParams("HEAD",h,b),p.successStatuses=[200],x.next=8,d.default.awrap(this.request(p));case 8:return v=x.sent,x.abrupt("return",{status:v.status,res:v.res});case 10:case"end":return x.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],27:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(b){return b&&b.__esModule?b:{default:b}}var E=N,g=l("../utils/isObject"),h=g.isObject;E.getObjectTagging=function(p){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I,x,S,W,B;return d.default.async(function(G){for(;;)switch(G.prev=G.next){case 0:return v.subres=(0,M.default)({tagging:""},v.subres),v.versionId&&(v.subres.versionId=v.versionId),p=this._objectName(p),I=this._objectRequestParams("GET",p,v),I.successStatuses=[200],G.next=7,d.default.awrap(this.request(I));case 7:return x=G.sent,G.next=10,d.default.awrap(this.parseXML(x.data));case 10:return S=G.sent,W=S.TagSet.Tag,W=W&&h(W)?[W]:W||[],B={},W.forEach(function($){B[$.Key]=$.Value}),G.abrupt("return",{status:x.status,res:x.res,tag:B});case 16:case"end":return G.stop()}},null,this)}},{"../utils/isObject":46,"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],28:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(g){return g&&g.__esModule?g:{default:g}}var E=N;E.getSymlink=function(h){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p,v,I;return d.default.async(function(S){for(;;)switch(S.prev=S.next){case 0:return b.subres=(0,M.default)({symlink:""},b.subres),b.versionId&&(b.subres.versionId=b.versionId),h=this._objectName(h),p=this._objectRequestParams("GET",h,b),p.successStatuses=[200],S.next=7,d.default.awrap(this.request(p));case 7:return v=S.sent,I=v.res.headers["x-oss-symlink-target"],S.abrupt("return",{targetName:decodeURIComponent(I),res:v.res});case 10:case"end":return S.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],29:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=g(y),F=l("babel-runtime/core-js/object/keys"),M=g(F),D=l("babel-runtime/core-js/object/assign"),E=g(D);function g(b){return b&&b.__esModule?b:{default:b}}var h=N;h.head=function(p){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I,x,S;return d.default.async(function(B){for(;;)switch(B.prev=B.next){case 0:return v.subres=(0,E.default)({},v.subres),v.versionId&&(v.subres.versionId=v.versionId),I=this._objectRequestParams("HEAD",p,v),I.successStatuses=[200,304],B.next=6,d.default.awrap(this.request(I));case 6:return x=B.sent,S={meta:null,res:x.res,status:x.status},x.status===200&&(0,M.default)(x.headers).forEach(function(Q){Q.indexOf("x-oss-meta-")===0&&(S.meta||(S.meta={}),S.meta[Q.substring(11)]=x.headers[Q])}),B.abrupt("return",S);case 10:case"end":return B.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/object/keys":60,"babel-runtime/regenerator":68}],30:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(g){return g&&g.__esModule?g:{default:g}}var E=N;E.putACL=function(h,b,p){var v,I;return d.default.async(function(S){for(;;)switch(S.prev=S.next){case 0:return p=p||{},p.subres=(0,M.default)({acl:""},p.subres),p.versionId&&(p.subres.versionId=p.versionId),p.headers=p.headers||{},p.headers["x-oss-object-acl"]=b,h=this._objectName(h),v=this._objectRequestParams("PUT",h,p),v.successStatuses=[200],S.next=10,d.default.awrap(this.request(v));case 10:return I=S.sent,S.abrupt("return",{res:I.res});case 12:case"end":return S.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],31:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=g(y),F=l("babel-runtime/core-js/object/keys"),M=g(F),D=l("babel-runtime/core-js/object/assign"),E=g(D);function g(x){return x&&x.__esModule?x:{default:x}}var h=l("../utils/obj2xml"),b=h.obj2xml,p=l("../utils/checkObjectTag"),v=p.checkObjectTag,I=N;I.putObjectTagging=function(S,W){var B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},Q,G,$;return d.default.async(function(U){for(;;)switch(U.prev=U.next){case 0:return v(W),B.subres=(0,E.default)({tagging:""},B.subres),B.versionId&&(B.subres.versionId=B.versionId),S=this._objectName(S),Q=this._objectRequestParams("PUT",S,B),Q.successStatuses=[200],W=(0,M.default)(W).map(function(j){return{Key:j,Value:W[j]}}),G={Tagging:{TagSet:{Tag:W}}},Q.mime="xml",Q.content=b(G),U.next=12,d.default.awrap(this.request(Q));case 12:return $=U.sent,U.abrupt("return",{res:$.res,status:$.status});case 14:case"end":return U.stop()}},null,this)}},{"../utils/checkObjectTag":36,"../utils/obj2xml":47,"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/object/keys":60,"babel-runtime/regenerator":68}],32:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/object/assign"),M=D(F);function D(g){return g&&g.__esModule?g:{default:g}}var E=N;E.putSymlink=function(h,b,p){var v,I;return d.default.async(function(S){for(;;)switch(S.prev=S.next){case 0:return p=p||{},p.headers=p.headers||{},b=this._escape(this._objectName(b)),this._convertMetaToHeaders(p.meta,p.headers),p.headers["x-oss-symlink-target"]=b,p.subres=(0,M.default)({symlink:""},p.subres),p.versionId&&(p.subres.versionId=p.versionId),p.storageClass&&(p.headers["x-oss-storage-class"]=p.storageClass),h=this._objectName(h),v=this._objectRequestParams("PUT",h,p),v.successStatuses=[200],S.next=13,d.default.awrap(this.request(v));case 13:return I=S.sent,S.abrupt("return",{res:I.res});case 15:case"end":return S.stop()}},null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],33:[function(l,V,N){"use strict";var y=l("babel-runtime/regenerator"),d=D(y),F=l("babel-runtime/core-js/promise"),M=D(F);function D(g){return g&&g.__esModule?g:{default:g}}var E=N;E._parallelNode=function(h,b,p,v){var I,x,S,W,B,Q,G,$;return d.default.async(function(U){for(;;)switch(U.prev=U.next){case 0:I=this,x=[],S=[],W=h.length/b,B=h.length%b,Q=B===0?W:(h.length-B)/b+1,G=1,$=0;case 8:if(!($<h.length)){U.next=26;break}if(!I.isCancel()){U.next=11;break}return U.abrupt("break",26);case 11:if(v?S.push(p(I,h[$],v)):S.push(p(I,h[$])),!(S.length===b||G===Q&&$===h.length-1)){U.next=23;break}return U.prev=13,G+=1,U.next=17,d.default.awrap(M.default.all(S));case 17:U.next=22;break;case 19:U.prev=19,U.t0=U.catch(13),x.push(U.t0);case 22:S=[];case 23:$++,U.next=8;break;case 26:return U.abrupt("return",x);case 27:case"end":return U.stop()}},null,this,[[13,19]])},E._parallel=function(h,b,p){var v=this;return new M.default(function(I){var x=[];if(b<=0||!h){I(x);return}function S(T){return function(){if(T===null)throw new Error("Callback was already called.");var ee=T;T=null;for(var Z=arguments.length,_=Array(Z),X=0;X<Z;X++)_[X]=arguments[X];ee.apply(this,_)}}function W(T){var ee=-1,Z=T.length;return function(){return++ee<Z&&!v.isCancel()?{value:T[ee],key:ee}:null}}var B=W(h),Q=!1,G=0,$=!1;function J(T,ee){G-=1,T?(Q=!0,x.push(T),I(x)):ee==={}||Q&&G<=0?(Q=!0,I(x)):$||(v.isCancel()?I(x):j())}function U(T,ee){p(T).then(function(Z){ee(null,Z)}).catch(function(Z){ee(Z)})}function j(){for($=!0;G<b&&!Q&&!v.isCancel();){var T=B();if(T===null||x.length>0){Q=!0,G<=0&&I(x);return}G+=1,U(T.value,S(J))}$=!1}j()})},E.cancel=function(h){this.options.cancelFlag=!0,h&&this.abortMultipartUpload(h.name,h.uploadId,h.options)},E.isCancel=function(){return this.options.cancelFlag},E.resetCancelFlag=function(){this.options.cancelFlag=!1},E._stop=function(){this.options.cancelFlag=!0},E._makeCancelEvent=function(){var h={status:0,name:"cancel"};return h}},{"babel-runtime/core-js/promise":61,"babel-runtime/regenerator":68}],34:[function(l,V,N){(function(y){"use strict";var d=l("babel-runtime/core-js/json/stringify"),F=E(d),M=l("babel-runtime/core-js/object/keys"),D=E(M);function E(b){return b&&b.__esModule?b:{default:b}}var g=l("./../../shims/crypto/crypto.js"),h=l("is-type-of");N.buildCanonicalizedResource=function(p,v){var I=""+p,x="?";if(h.string(v)&&v.trim()!=="")I+=x+v;else if(h.array(v))v.sort(),I+=x+v.join("&");else if(v){var S=function(Q,G){return Q[0]>G[0]?1:Q[0]<G[0]?-1:0},W=function(Q){I+=x+Q,v[Q]&&(I+="="+v[Q]),x="&"};(0,D.default)(v).sort(S).forEach(W)}return I},N.buildCanonicalString=function(p,v,I,x){I=I||{};var S=I.headers||{},W="x-oss-",B=[],Q={},G=[p.toUpperCase(),S["Content-Md5"]||"",S["Content-Type"]||S["Content-Type".toLowerCase()],x||S["x-oss-date"]];return(0,D.default)(S).forEach(function($){var J=$.toLowerCase();J.indexOf(W)===0&&(Q[J]=String(S[$]).trim())}),(0,D.default)(Q).sort().forEach(function($){B.push($+":"+Q[$])}),G=G.concat(B),G.push(this.buildCanonicalizedResource(v,I.parameters)),G.join(`
|
|
|
`)},N.computeSignature=function(p,v){var I=g.createHmac("sha1",p);return I.update(y.from(v,"utf8")).digest("base64")},N.authorization=function(p,v,I){return"OSS "+p+":"+this.computeSignature(v,I)},N._signatureForURL=function(p){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=arguments[2],x=arguments[3],S={},W=v.subResource,B=W===void 0?{}:W;if(v.process){var Q="x-oss-process";B[Q]=v.process}if(v.trafficLimit){var G="x-oss-traffic-limit";B[G]=v.trafficLimit}if(v.response&&(0,D.default)(v.response).forEach(function(j){var T="response-"+j.toLowerCase();B[T]=v.response[j]}),(0,D.default)(v).forEach(function(j){var T=j.toLowerCase(),ee=v[j];T.indexOf("x-oss-")===0?S[T]=ee:(T.indexOf("content-md5")===0||T.indexOf("content-type")===0)&&(S[j]=ee)}),Object.prototype.hasOwnProperty.call(v,"security-token")&&(B["security-token"]=v["security-token"]),Object.prototype.hasOwnProperty.call(v,"callback")){var $={callbackUrl:encodeURI(v.callback.url),callbackBody:v.callback.body};if(v.callback.host&&($.callbackHost=v.callback.host),v.callback.contentType&&($.callbackBodyType=v.callback.contentType),B.callback=y.from((0,F.default)($)).toString("base64"),v.callback.customValue){var J={};(0,D.default)(v.callback.customValue).forEach(function(j){J["x:"+j]=v.callback.customValue[j]}),B["callback-var"]=y.from((0,F.default)(J)).toString("base64")}}var U=this.buildCanonicalString(v.method,I,{headers:S,parameters:B},x.toString());return{Signature:this.computeSignature(p,U),subResource:B}}}).call(this,l("buffer").Buffer)},{"./../../shims/crypto/crypto.js":284,"babel-runtime/core-js/json/stringify":53,"babel-runtime/core-js/object/keys":60,buffer:73,"is-type-of":289}],35:[function(l,V,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.checkBucketName=void 0,N.checkBucketName=function(y,d){var F=d?/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/:/^[a-z0-9_][a-z0-9-_]{1,61}[a-z0-9_]$/;if(!F.test(y))throw new Error("The bucket must be conform to the specifications")}},{}],36:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/entries"),d=F(y);function F(v){return v&&v.__esModule?v:{default:v}}Object.defineProperty(N,"__esModule",{value:!0}),N.checkObjectTag=void 0;var M=l("./checkValid"),D=M.checkValid,E=l("./isObject"),g=E.isObject,h=[{validator:function(I){if(typeof I!="string")throw new Error("the key and value of the tag must be String")}},{pattern:/^[a-zA-Z0-9 +-=._:/]+$/,msg:"tag can contain letters, numbers, spaces, and the following symbols: plus sign (+), hyphen (-), equal sign (=), period (.), underscore (_), colon (:), and forward slash (/)"}],b={key:[].concat(h,[{pattern:/^.{1,128}$/,msg:"tag key can be a maximum of 128 bytes in length"}]),value:[].concat(h,[{pattern:/^.{0,256}$/,msg:"tag value can be a maximum of 256 bytes in length"}])};function p(v){if(!g(v))throw new Error("tag must be Object");var I=(0,d.default)(v);if(I.length>10)throw new Error("maximum of 10 tags for a object");var x=["key","value"];I.forEach(function(S){S.forEach(function(W,B){D(W,b[x[B]])})})}N.checkObjectTag=p},{"./checkValid":37,"./isObject":46,"babel-runtime/core-js/object/entries":57}],37:[function(l,V,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.checkValid=void 0;function y(d,F){F.forEach(function(M){if(M.validator)M.validator(d);else if(M.pattern&&!M.pattern.test(d))throw new Error(M.msg)})}N.checkValid=y},{}],38:[function(l,V,N){(function(y){"use strict";var d=l("babel-runtime/core-js/object/assign"),F=M(d);function M(S){return S&&S.__esModule?S:{default:S}}Object.defineProperty(N,"__esModule",{value:!0}),N.createRequest=void 0;var D=l("./../../../shims/crypto/crypto.js"),E=l("debug")("ali-oss"),g=l("mime"),h=l("dateformat"),b=l("copy-to"),p=l("path");function v(S,W){return S[W]||S[W.toLowerCase()]}function I(S,W){delete S[W],delete S[W.toLowerCase()]}function x(S){var W=new Date;this.options.amendTimeSkewed&&(W=+new Date+this.options.amendTimeSkewed);var B={"x-oss-date":h(W,"UTC:ddd, dd mmm yyyy HH:MM:ss 'GMT'"),"x-oss-user-agent":this.userAgent};this.userAgent.includes("nodejs")&&(B["User-Agent"]=this.userAgent),this.options.isRequestPay&&(0,F.default)(B,{"x-oss-request-payer":"requester"}),this.options.stsToken&&(B["x-oss-security-token"]=this.options.stsToken),b(S.headers).to(B),v(B,"Content-Type")||(S.mime&&S.mime.indexOf("/")>0?B["Content-Type"]=S.mime:B["Content-Type"]=g.getType(S.mime||p.extname(S.object||""))),v(B,"Content-Type")||I(B,"Content-Type"),S.content&&(B["Content-Md5"]=D.createHash("md5").update(y.from(S.content,"utf8")).digest("base64"),B["Content-Length"]||(B["Content-Length"]=S.content.length));var Q=this._getResource(S);B.authorization=this.authorization(S.method,Q,S.subres,B);var G=this._getReqUrl(S);E("request %s %s, with headers %j, !!stream: %s",S.method,G,B,!!S.stream);var $=S.timeout||this.options.timeout,J={method:S.method,content:S.content,stream:S.stream,headers:B,timeout:$,writeStream:S.writeStream,customResponse:S.customResponse,ctx:S.ctx||this.ctx};return this.agent&&(J.agent=this.agent),this.httpsAgent&&(J.httpsAgent=this.httpsAgent),{url:G,params:J}}N.createRequest=x}).call(this,l("buffer").Buffer)},{"./../../../shims/crypto/crypto.js":284,"babel-runtime/core-js/object/assign":54,buffer:73,"copy-to":76,dateformat:190,debug:288,mime:202,path:205}],39:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/keys"),d=D(y),F=l("babel-runtime/helpers/typeof"),M=D(F);function D(E){return E&&E.__esModule?E:{default:E}}Object.defineProperty(N,"__esModule",{value:!0}),N.deepCopy=void 0,N.deepCopy=function(E){if(E===null||(typeof E=="undefined"?"undefined":(0,M.default)(E))!=="object")return E;var g=Array.isArray(E)?[]:{};return(0,d.default)(E).forEach(function(h){g[h]=N.deepCopy(E[h])}),g}},{"babel-runtime/core-js/object/keys":60,"babel-runtime/helpers/typeof":67}],40:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/keys"),d=D(y),F=l("babel-runtime/helpers/typeof"),M=D(F);function D(h){return h&&h.__esModule?h:{default:h}}Object.defineProperty(N,"__esModule",{value:!0}),N.formatObjKey=void 0;function E(h,b){if(h===null||(typeof h=="undefined"?"undefined":(0,M.default)(h))!=="object")return h;var p=void 0;if(Array.isArray(h)){p=[];for(var v=0;v<h.length;v++)p.push(E(h[v],b))}else p={},(0,d.default)(h).forEach(function(I){p[g(I,b)]=E(h[I],b)});return p}N.formatObjKey=E;function g(h,b){return b==="firstUpperCase"?h=h.replace(/^./,function(p){return p.toUpperCase()}):b==="firstLowerCase"&&(h=h.replace(/^./,function(p){return p.toLowerCase()})),h}},{"babel-runtime/core-js/object/keys":60,"babel-runtime/helpers/typeof":67}],41:[function(l,V,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.getStrBytesCount=void 0;function y(d){for(var F=0,M=0;M<d.length;M++){var D=d.charAt(M);/^[\u00-\uff]$/.test(D)?F+=1:F+=2}return F}N.getStrBytesCount=y},{}],42:[function(l,V,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.isArray=void 0,N.isArray=function(y){return Object.prototype.toString.call(y)==="[object Array]"}},{}],43:[function(l,V,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.isBlob=void 0;function y(d){return typeof Blob!="undefined"&&d instanceof Blob}N.isBlob=y},{}],44:[function(l,V,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.isFile=void 0,N.isFile=function(y){return typeof File!="undefined"&&y instanceof File}},{}],45:[function(l,V,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.isIP=void 0,N.isIP=function(y){var d=/^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}$/,F=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/;return d.test(y)||F.test(y)}},{}],46:[function(l,V,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.isObject=void 0,N.isObject=function(y){return Object.prototype.toString.call(y)==="[object Object]"}},{}],47:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/keys"),d=F(y);function F(g){return g&&g.__esModule?g:{default:g}}Object.defineProperty(N,"__esModule",{value:!0}),N.obj2xml=void 0;var M=l("./formatObjKey");function D(g){return Object.prototype.toString.call(g).replace(/(.*? |])/g,"").toLowerCase()}function E(g,h){var b="";return h&&h.headers&&(b=`<?xml version="1.0" encoding="UTF-8"?>
|
|
|
`),h&&h.firstUpperCase&&(g=M.formatObjKey(g,"firstUpperCase")),D(g)==="object"?(0,d.default)(g).forEach(function(p){D(g[p])==="string"||D(g[p])==="number"?b+="<"+p+">"+g[p]+"</"+p+">":D(g[p])==="object"?b+="<"+p+">"+E(g[p])+"</"+p+">":D(g[p])==="array"?b+=g[p].map(function(v){return"<"+p+">"+E(v)+"</"+p+">"}).join(""):b+="<"+p+">"+g[p].toString()+"</"+p+">"}):b+=g.toString(),b}N.obj2xml=E},{"./formatObjKey":40,"babel-runtime/core-js/object/keys":60}],48:[function(l,V,N){V.exports=y,V.exports.HttpsAgent=y;function y(){}},{}],49:[function(l,V,N){V.exports=l("./register")().Promise},{"./register":51}],50:[function(l,V,N){"use strict";var y="@@any-promise/REGISTRATION",d=null;V.exports=function(F,M){return function(E,g){E=E||null,g=g||{};var h=g.global!==!1;if(d===null&&h&&(d=F[y]||null),d!==null&&E!==null&&d.implementation!==E)throw new Error('any-promise already defined as "'+d.implementation+'". You can only register an implementation before the first call to require("any-promise") and an implementation cannot be changed');return d===null&&(E!==null&&typeof g.Promise!="undefined"?d={Promise:g.Promise,implementation:E}:d=M(E),h&&(F[y]=d)),d}}},{}],51:[function(l,V,N){"use strict";V.exports=l("./loader")(window,y);function y(){if(typeof window.Promise=="undefined")throw new Error("any-promise browser requires a polyfill or explicit registration e.g: require('any-promise/register/bluebird')");return{Promise:window.Promise,implementation:"window.Promise"}}},{"./loader":50}],52:[function(l,V,N){V.exports={default:l("core-js/library/fn/array/from"),__esModule:!0}},{"core-js/library/fn/array/from":77}],53:[function(l,V,N){V.exports={default:l("core-js/library/fn/json/stringify"),__esModule:!0}},{"core-js/library/fn/json/stringify":78}],54:[function(l,V,N){V.exports={default:l("core-js/library/fn/object/assign"),__esModule:!0}},{"core-js/library/fn/object/assign":79}],55:[function(l,V,N){V.exports={default:l("core-js/library/fn/object/create"),__esModule:!0}},{"core-js/library/fn/object/create":80}],56:[function(l,V,N){V.exports={default:l("core-js/library/fn/object/define-property"),__esModule:!0}},{"core-js/library/fn/object/define-property":81}],57:[function(l,V,N){V.exports={default:l("core-js/library/fn/object/entries"),__esModule:!0}},{"core-js/library/fn/object/entries":82}],58:[function(l,V,N){V.exports={default:l("core-js/library/fn/object/get-own-property-names"),__esModule:!0}},{"core-js/library/fn/object/get-own-property-names":83}],59:[function(l,V,N){V.exports={default:l("core-js/library/fn/object/get-prototype-of"),__esModule:!0}},{"core-js/library/fn/object/get-prototype-of":84}],60:[function(l,V,N){V.exports={default:l("core-js/library/fn/object/keys"),__esModule:!0}},{"core-js/library/fn/object/keys":85}],61:[function(l,V,N){V.exports={default:l("core-js/library/fn/promise"),__esModule:!0}},{"core-js/library/fn/promise":86}],62:[function(l,V,N){V.exports={default:l("core-js/library/fn/set-immediate"),__esModule:!0}},{"core-js/library/fn/set-immediate":87}],63:[function(l,V,N){V.exports={default:l("core-js/library/fn/string/from-code-point"),__esModule:!0}},{"core-js/library/fn/string/from-code-point":88}],64:[function(l,V,N){V.exports={default:l("core-js/library/fn/symbol"),__esModule:!0}},{"core-js/library/fn/symbol":90}],65:[function(l,V,N){V.exports={default:l("core-js/library/fn/symbol/has-instance"),__esModule:!0}},{"core-js/library/fn/symbol/has-instance":89}],66:[function(l,V,N){V.exports={default:l("core-js/library/fn/symbol/iterator"),__esModule:!0}},{"core-js/library/fn/symbol/iterator":91}],67:[function(l,V,N){"use strict";N.__esModule=!0;var y=l("../core-js/symbol/iterator"),d=E(y),F=l("../core-js/symbol"),M=E(F),D=typeof M.default=="function"&&typeof d.default=="symbol"?function(g){return typeof g}:function(g){return g&&typeof M.default=="function"&&g.constructor===M.default&&g!==M.default.prototype?"symbol":typeof g};function E(g){return g&&g.__esModule?g:{default:g}}N.default=typeof M.default=="function"&&D(d.default)==="symbol"?function(g){return typeof g=="undefined"?"undefined":D(g)}:function(g){return g&&typeof M.default=="function"&&g.constructor===M.default&&g!==M.default.prototype?"symbol":typeof g=="undefined"?"undefined":D(g)}},{"../core-js/symbol":64,"../core-js/symbol/iterator":66}],68:[function(l,V,N){V.exports=l("regenerator-runtime")},{"regenerator-runtime":226}],69:[function(l,V,N){"use strict";N.byteLength=h,N.toByteArray=p,N.fromByteArray=x;for(var y=[],d=[],F=typeof Uint8Array!="undefined"?Uint8Array:Array,M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",D=0,E=M.length;D<E;++D)y[D]=M[D],d[M.charCodeAt(D)]=D;d["-".charCodeAt(0)]=62,d["_".charCodeAt(0)]=63;function g(S){var W=S.length;if(W%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var B=S.indexOf("=");B===-1&&(B=W);var Q=B===W?0:4-B%4;return[B,Q]}function h(S){var W=g(S),B=W[0],Q=W[1];return(B+Q)*3/4-Q}function b(S,W,B){return(W+B)*3/4-B}function p(S){var W,B=g(S),Q=B[0],G=B[1],$=new F(b(S,Q,G)),J=0,U=G>0?Q-4:Q,j;for(j=0;j<U;j+=4)W=d[S.charCodeAt(j)]<<18|d[S.charCodeAt(j+1)]<<12|d[S.charCodeAt(j+2)]<<6|d[S.charCodeAt(j+3)],$[J++]=W>>16&255,$[J++]=W>>8&255,$[J++]=W&255;return G===2&&(W=d[S.charCodeAt(j)]<<2|d[S.charCodeAt(j+1)]>>4,$[J++]=W&255),G===1&&(W=d[S.charCodeAt(j)]<<10|d[S.charCodeAt(j+1)]<<4|d[S.charCodeAt(j+2)]>>2,$[J++]=W>>8&255,$[J++]=W&255),$}function v(S){return y[S>>18&63]+y[S>>12&63]+y[S>>6&63]+y[S&63]}function I(S,W,B){for(var Q,G=[],$=W;$<B;$+=3)Q=(S[$]<<16&16711680)+(S[$+1]<<8&65280)+(S[$+2]&255),G.push(v(Q));return G.join("")}function x(S){for(var W,B=S.length,Q=B%3,G=[],$=16383,J=0,U=B-Q;J<U;J+=$)G.push(I(S,J,J+$>U?U:J+$));return Q===1?(W=S[B-1],G.push(y[W>>2]+y[W<<4&63]+"==")):Q===2&&(W=(S[B-2]<<8)+S[B-1],G.push(y[W>>10]+y[W>>4&63]+y[W<<2&63]+"=")),G.join("")}},{}],70:[function(l,V,N){/*!
|
|
|
* Bowser - a browser detector
|
|
|
* https://github.com/ded/bowser
|
|
|
* MIT License | (c) Dustin Diaz 2015
|
|
|
*/!function(y,d,F){typeof V!="undefined"&&V.exports?V.exports=F():typeof define=="function"&&define.amd?define(d,F):y[d]=F()}(this,"bowser",function(){var y=!0;function d(b){function p(H){var ae=b.match(H);return ae&&ae.length>1&&ae[1]||""}function v(H){var ae=b.match(H);return ae&&ae.length>1&&ae[2]||""}var I=p(/(ipod|iphone|ipad)/i).toLowerCase(),x=/like android/i.test(b),S=!x&&/android/i.test(b),W=/nexus\s*[0-6]\s*/i.test(b),B=!W&&/nexus\s*[0-9]+/i.test(b),Q=/CrOS/.test(b),G=/silk/i.test(b),$=/sailfish/i.test(b),J=/tizen/i.test(b),U=/(web|hpw)(o|0)s/i.test(b),j=/windows phone/i.test(b),T=/SamsungBrowser/i.test(b),ee=!j&&/windows/i.test(b),Z=!I&&!G&&/macintosh/i.test(b),_=!S&&!$&&!J&&!U&&/linux/i.test(b),X=v(/edg([ea]|ios)\/(\d+(\.\d+)?)/i),re=p(/version\/(\d+(\.\d+)?)/i),me=/tablet/i.test(b)&&!/tablet pc/i.test(b),de=!me&&/[^-]mobi/i.test(b),we=/xbox/i.test(b),ge;/opera/i.test(b)?ge={name:"Opera",opera:y,version:re||p(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)}:/opr\/|opios/i.test(b)?ge={name:"Opera",opera:y,version:p(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i)||re}:/SamsungBrowser/i.test(b)?ge={name:"Samsung Internet for Android",samsungBrowser:y,version:re||p(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)}:/Whale/i.test(b)?ge={name:"NAVER Whale browser",whale:y,version:p(/(?:whale)[\s\/](\d+(?:\.\d+)+)/i)}:/MZBrowser/i.test(b)?ge={name:"MZ Browser",mzbrowser:y,version:p(/(?:MZBrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/coast/i.test(b)?ge={name:"Opera Coast",coast:y,version:re||p(/(?:coast)[\s\/](\d+(\.\d+)?)/i)}:/focus/i.test(b)?ge={name:"Focus",focus:y,version:p(/(?:focus)[\s\/](\d+(?:\.\d+)+)/i)}:/yabrowser/i.test(b)?ge={name:"Yandex Browser",yandexbrowser:y,version:re||p(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:/ucbrowser/i.test(b)?ge={name:"UC Browser",ucbrowser:y,version:p(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/mxios/i.test(b)?ge={name:"Maxthon",maxthon:y,version:p(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)}:/epiphany/i.test(b)?ge={name:"Epiphany",epiphany:y,version:p(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)}:/puffin/i.test(b)?ge={name:"Puffin",puffin:y,version:p(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)}:/sleipnir/i.test(b)?ge={name:"Sleipnir",sleipnir:y,version:p(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)}:/k-meleon/i.test(b)?ge={name:"K-Meleon",kMeleon:y,version:p(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)}:j?(ge={name:"Windows Phone",osname:"Windows Phone",windowsphone:y},X?(ge.msedge=y,ge.version=X):(ge.msie=y,ge.version=p(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(b)?ge={name:"Internet Explorer",msie:y,version:p(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:Q?ge={name:"Chrome",osname:"Chrome OS",chromeos:y,chromeBook:y,chrome:y,version:p(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/edg([ea]|ios)/i.test(b)?ge={name:"Microsoft Edge",msedge:y,version:X}:/vivaldi/i.test(b)?ge={name:"Vivaldi",vivaldi:y,version:p(/vivaldi\/(\d+(\.\d+)?)/i)||re}:$?ge={name:"Sailfish",osname:"Sailfish OS",sailfish:y,version:p(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(b)?ge={name:"SeaMonkey",seamonkey:y,version:p(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel|fxios/i.test(b)?(ge={name:"Firefox",firefox:y,version:p(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(b)&&(ge.firefoxos=y,ge.osname="Firefox OS")):G?ge={name:"Amazon Silk",silk:y,version:p(/silk\/(\d+(\.\d+)?)/i)}:/phantom/i.test(b)?ge={name:"PhantomJS",phantom:y,version:p(/phantomjs\/(\d+(\.\d+)?)/i)}:/slimerjs/i.test(b)?ge={name:"SlimerJS",slimer:y,version:p(/slimerjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(b)||/rim\stablet/i.test(b)?ge={name:"BlackBerry",osname:"BlackBerry OS",blackberry:y,version:re||p(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:U?(ge={name:"WebOS",osname:"WebOS",webos:y,version:re||p(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(b)&&(ge.touchpad=y)):/bada/i.test(b)?ge={name:"Bada",osname:"Bada",bada:y,version:p(/dolfin\/(\d+(\.\d+)?)/i)}:J?ge={name:"Tizen",osname:"Tizen",tizen:y,version:p(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||re}:/qupzilla/i.test(b)?ge={name:"QupZilla",qupzilla:y,version:p(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i)||re}:/chromium/i.test(b)?ge={name:"Chromium",chromium:y,version:p(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i)||re}:/chrome|crios|crmo/i.test(b)?ge={name:"Chrome",chrome:y,version:p(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:S?ge={name:"Android",version:re}:/safari|applewebkit/i.test(b)?(ge={name:"Safari",safari:y},re&&(ge.version=re)):I?(ge={name:I=="iphone"?"iPhone":I=="ipad"?"iPad":"iPod"},re&&(ge.version=re)):/googlebot/i.test(b)?ge={name:"Googlebot",googlebot:y,version:p(/googlebot\/(\d+(\.\d+))/i)||re}:ge={name:p(/^(.*)\/(.*) /),version:v(/^(.*)\/(.*) /)},!ge.msedge&&/(apple)?webkit/i.test(b)?(/(apple)?webkit\/537\.36/i.test(b)?(ge.name=ge.name||"Blink",ge.blink=y):(ge.name=ge.name||"Webkit",ge.webkit=y),!ge.version&&re&&(ge.version=re)):!ge.opera&&/gecko\//i.test(b)&&(ge.name=ge.name||"Gecko",ge.gecko=y,ge.version=ge.version||p(/gecko\/(\d+(\.\d+)?)/i)),!ge.windowsphone&&(S||ge.silk)?(ge.android=y,ge.osname="Android"):!ge.windowsphone&&I?(ge[I]=y,ge.ios=y,ge.osname="iOS"):Z?(ge.mac=y,ge.osname="macOS"):we?(ge.xbox=y,ge.osname="Xbox"):ee?(ge.windows=y,ge.osname="Windows"):_&&(ge.linux=y,ge.osname="Linux");function ke(H){switch(H){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 z="";ge.windows?z=ke(p(/Windows ((NT|XP)( \d\d?.\d)?)/i)):ge.windowsphone?z=p(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):ge.mac?(z=p(/Mac OS X (\d+([_\.\s]\d+)*)/i),z=z.replace(/[_\s]/g,".")):I?(z=p(/os (\d+([_\s]\d+)*) like mac os x/i),z=z.replace(/[_\s]/g,".")):S?z=p(/android[ \/-](\d+(\.\d+)*)/i):ge.webos?z=p(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):ge.blackberry?z=p(/rim\stablet\sos\s(\d+(\.\d+)*)/i):ge.bada?z=p(/bada\/(\d+(\.\d+)*)/i):ge.tizen&&(z=p(/tizen[\/\s](\d+(\.\d+)*)/i)),z&&(ge.osversion=z);var ie=!ge.windows&&z.split(".")[0];return me||B||I=="ipad"||S&&(ie==3||ie>=4&&!de)||ge.silk?ge.tablet=y:(de||I=="iphone"||I=="ipod"||S||W||ge.blackberry||ge.webos||ge.bada)&&(ge.mobile=y),ge.msedge||ge.msie&&ge.version>=10||ge.yandexbrowser&&ge.version>=15||ge.vivaldi&&ge.version>=1||ge.chrome&&ge.version>=20||ge.samsungBrowser&&ge.version>=4||ge.whale&&E([ge.version,"1.0"])===1||ge.mzbrowser&&E([ge.version,"6.0"])===1||ge.focus&&E([ge.version,"1.0"])===1||ge.firefox&&ge.version>=20||ge.safari&&ge.version>=6||ge.opera&&ge.version>=10||ge.ios&&ge.osversion&&ge.osversion.split(".")[0]>=6||ge.blackberry&&ge.version>=10.1||ge.chromium&&ge.version>=20?ge.a=y:ge.msie&&ge.version<10||ge.chrome&&ge.version<20||ge.firefox&&ge.version<20||ge.safari&&ge.version<6||ge.opera&&ge.version<10||ge.ios&&ge.osversion&&ge.osversion.split(".")[0]<6||ge.chromium&&ge.version<20?ge.c=y:ge.x=y,ge}var F=d(typeof navigator!="undefined"&&navigator.userAgent||"");F.test=function(b){for(var p=0;p<b.length;++p){var v=b[p];if(typeof v=="string"&&v in F)return!0}return!1};function M(b){return b.split(".").length}function D(b,p){var v=[],I;if(Array.prototype.map)return Array.prototype.map.call(b,p);for(I=0;I<b.length;I++)v.push(p(b[I]));return v}function E(b){for(var p=Math.max(M(b[0]),M(b[1])),v=D(b,function(I){var x=p-M(I);return I=I+new Array(x+1).join(".0"),D(I.split("."),function(S){return new Array(20-S.length).join("0")+S}).reverse()});--p>=0;){if(v[0][p]>v[1][p])return 1;if(v[0][p]===v[1][p]){if(p===0)return 0}else return-1}}function g(b,p,v){var I=F;typeof p=="string"&&(v=p,p=void 0),p===void 0&&(p=!1),v&&(I=d(v));var x=""+I.version;for(var S in b)if(b.hasOwnProperty(S)&&I[S]){if(typeof b[S]!="string")throw new Error("Browser version in the minVersion map should be a string: "+S+": "+String(b));return E([x,b[S]])<0}return p}function h(b,p,v){return!g(b,p,v)}return F.isUnsupportedBrowser=g,F.compareVersions=E,F.check=h,F._detect=d,F.detect=d,F})},{}],71:[function(l,V,N){},{}],72:[function(l,V,N){var y=l("buffer").Buffer,d=y.isEncoding||function(h){switch(h&&h.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function F(h){if(h&&!d(h))throw new Error("Unknown encoding: "+h)}var M=N.StringDecoder=function(h){this.encoding=(h||"utf8").toLowerCase().replace(/[-_]/,""),F(h);switch(this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=E;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=g;break;default:this.write=D;return}this.charBuffer=new y(6),this.charReceived=0,this.charLength=0};M.prototype.write=function(h){for(var b="";this.charLength;){var p=h.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:h.length;if(h.copy(this.charBuffer,this.charReceived,0,p),this.charReceived+=p,this.charReceived<this.charLength)return"";h=h.slice(p,h.length),b=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var I=b.charCodeAt(b.length-1);if(I>=55296&&I<=56319){this.charLength+=this.surrogateSize,b="";continue}if(this.charReceived=this.charLength=0,h.length===0)return b;break}this.detectIncompleteChar(h);var v=h.length;this.charLength&&(h.copy(this.charBuffer,0,h.length-this.charReceived,v),v-=this.charReceived),b+=h.toString(this.encoding,0,v);var v=b.length-1,I=b.charCodeAt(v);if(I>=55296&&I<=56319){var x=this.surrogateSize;return this.charLength+=x,this.charReceived+=x,this.charBuffer.copy(this.charBuffer,x,0,x),h.copy(this.charBuffer,0,0,x),b.substring(0,v)}return b},M.prototype.detectIncompleteChar=function(h){for(var b=h.length>=3?3:h.length;b>0;b--){var p=h[h.length-b];if(b==1&&p>>5==6){this.charLength=2;break}if(b<=2&&p>>4==14){this.charLength=3;break}if(b<=3&&p>>3==30){this.charLength=4;break}}this.charReceived=b},M.prototype.end=function(h){var b="";if(h&&h.length&&(b=this.write(h)),this.charReceived){var p=this.charReceived,v=this.charBuffer,I=this.encoding;b+=v.slice(0,p).toString(I)}return b};function D(h){return h.toString(this.encoding)}function E(h){this.charReceived=h.length%2,this.charLength=this.charReceived?2:0}function g(h){this.charReceived=h.length%3,this.charLength=this.charReceived?3:0}},{buffer:73}],73:[function(l,V,N){(function(y,d){/*!
|
|
|
* The buffer module from node.js, for the browser.
|
|
|
*
|
|
|
* @author Feross Aboukhadijeh <http://feross.org>
|
|
|
* @license MIT
|
|
|
*/"use strict";var F=l("base64-js"),M=l("ieee754"),D=l("isarray");N.Buffer=d,N.SlowBuffer=G,N.INSPECT_MAX_BYTES=50,d.TYPED_ARRAY_SUPPORT=y.TYPED_ARRAY_SUPPORT!==void 0?y.TYPED_ARRAY_SUPPORT:E(),N.kMaxLength=g();function E(){try{var q=new Uint8Array(1);return q.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},q.foo()===42&&typeof q.subarray=="function"&&q.subarray(1,1).byteLength===0}catch(m){return!1}}function g(){return d.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function h(q,m){if(g()<m)throw new RangeError("Invalid typed array length");return d.TYPED_ARRAY_SUPPORT?(q=new Uint8Array(m),q.__proto__=d.prototype):(q===null&&(q=new d(m)),q.length=m),q}function d(q,m,c){if(!d.TYPED_ARRAY_SUPPORT&&!(this instanceof d))return new d(q,m,c);if(typeof q=="number"){if(typeof m=="string")throw new Error("If encoding is specified then the first argument must be a string");return I(this,q)}return b(this,q,m,c)}d.poolSize=8192,d._augment=function(q){return q.__proto__=d.prototype,q};function b(q,m,c,R){if(typeof m=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&m instanceof ArrayBuffer?W(q,m,c,R):typeof m=="string"?x(q,m,c):B(q,m)}d.from=function(q,m,c){return b(null,q,m,c)},d.TYPED_ARRAY_SUPPORT&&(d.prototype.__proto__=Uint8Array.prototype,d.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&d[Symbol.species]===d&&Object.defineProperty(d,Symbol.species,{value:null,configurable:!0}));function p(q){if(typeof q!="number")throw new TypeError('"size" argument must be a number');if(q<0)throw new RangeError('"size" argument must not be negative')}function v(q,m,c,R){return p(m),m<=0?h(q,m):c!==void 0?typeof R=="string"?h(q,m).fill(c,R):h(q,m).fill(c):h(q,m)}d.alloc=function(q,m,c){return v(null,q,m,c)};function I(q,m){if(p(m),q=h(q,m<0?0:Q(m)|0),!d.TYPED_ARRAY_SUPPORT)for(var c=0;c<m;++c)q[c]=0;return q}d.allocUnsafe=function(q){return I(null,q)},d.allocUnsafeSlow=function(q){return I(null,q)};function x(q,m,c){if((typeof c!="string"||c==="")&&(c="utf8"),!d.isEncoding(c))throw new TypeError('"encoding" must be a valid string encoding');var R=$(m,c)|0;q=h(q,R);var fe=q.write(m,c);return fe!==R&&(q=q.slice(0,fe)),q}function S(q,m){var c=m.length<0?0:Q(m.length)|0;q=h(q,c);for(var R=0;R<c;R+=1)q[R]=m[R]&255;return q}function W(q,m,c,R){if(m.byteLength,c<0||m.byteLength<c)throw new RangeError("'offset' is out of bounds");if(m.byteLength<c+(R||0))throw new RangeError("'length' is out of bounds");return c===void 0&&R===void 0?m=new Uint8Array(m):R===void 0?m=new Uint8Array(m,c):m=new Uint8Array(m,c,R),d.TYPED_ARRAY_SUPPORT?(q=m,q.__proto__=d.prototype):q=S(q,m),q}function B(q,m){if(d.isBuffer(m)){var c=Q(m.length)|0;return q=h(q,c),q.length===0||m.copy(q,0,0,c),q}if(m){if(typeof ArrayBuffer!="undefined"&&m.buffer instanceof ArrayBuffer||"length"in m)return typeof m.length!="number"||$e(m.length)?h(q,0):S(q,m);if(m.type==="Buffer"&&D(m.data))return S(q,m.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Q(q){if(q>=g())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+g().toString(16)+" bytes");return q|0}function G(q){return+q!=q&&(q=0),d.alloc(+q)}d.isBuffer=function(m){return!!(m!=null&&m._isBuffer)},d.compare=function(m,c){if(!d.isBuffer(m)||!d.isBuffer(c))throw new TypeError("Arguments must be Buffers");if(m===c)return 0;for(var R=m.length,fe=c.length,pe=0,Ae=Math.min(R,fe);pe<Ae;++pe)if(m[pe]!==c[pe]){R=m[pe],fe=c[pe];break}return R<fe?-1:fe<R?1:0},d.isEncoding=function(m){switch(String(m).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.concat=function(m,c){if(!D(m))throw new TypeError('"list" argument must be an Array of Buffers');if(m.length===0)return d.alloc(0);var R;if(c===void 0)for(c=0,R=0;R<m.length;++R)c+=m[R].length;var fe=d.allocUnsafe(c),pe=0;for(R=0;R<m.length;++R){var Ae=m[R];if(!d.isBuffer(Ae))throw new TypeError('"list" argument must be an Array of Buffers');Ae.copy(fe,pe),pe+=Ae.length}return fe};function $(q,m){if(d.isBuffer(q))return q.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(q)||q instanceof ArrayBuffer))return q.byteLength;typeof q!="string"&&(q=""+q);var c=q.length;if(c===0)return 0;for(var R=!1;;)switch(m){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":case void 0:return Le(q).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return be(q).length;default:if(R)return Le(q).length;m=(""+m).toLowerCase(),R=!0}}d.byteLength=$;function J(q,m,c){var R=!1;if((m===void 0||m<0)&&(m=0),m>this.length)return"";if((c===void 0||c>this.length)&&(c=this.length),c<=0)return"";if(c>>>=0,m>>>=0,c<=m)return"";for(q||(q="utf8");;)switch(q){case"hex":return H(this,m,c);case"utf8":case"utf-8":return we(this,m,c);case"ascii":return z(this,m,c);case"latin1":case"binary":return ie(this,m,c);case"base64":return de(this,m,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ae(this,m,c);default:if(R)throw new TypeError("Unknown encoding: "+q);q=(q+"").toLowerCase(),R=!0}}d.prototype._isBuffer=!0;function U(q,m,c){var R=q[m];q[m]=q[c],q[c]=R}d.prototype.swap16=function(){var m=this.length;if(m%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var c=0;c<m;c+=2)U(this,c,c+1);return this},d.prototype.swap32=function(){var m=this.length;if(m%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var c=0;c<m;c+=4)U(this,c,c+3),U(this,c+1,c+2);return this},d.prototype.swap64=function(){var m=this.length;if(m%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var c=0;c<m;c+=8)U(this,c,c+7),U(this,c+1,c+6),U(this,c+2,c+5),U(this,c+3,c+4);return this},d.prototype.toString=function(){var m=this.length|0;return m===0?"":arguments.length===0?we(this,0,m):J.apply(this,arguments)},d.prototype.equals=function(m){if(!d.isBuffer(m))throw new TypeError("Argument must be a Buffer");return this===m?!0:d.compare(this,m)===0},d.prototype.inspect=function(){var m="",c=N.INSPECT_MAX_BYTES;return this.length>0&&(m=this.toString("hex",0,c).match(/.{2}/g).join(" "),this.length>c&&(m+=" ... ")),"<Buffer "+m+">"},d.prototype.compare=function(m,c,R,fe,pe){if(!d.isBuffer(m))throw new TypeError("Argument must be a Buffer");if(c===void 0&&(c=0),R===void 0&&(R=m?m.length:0),fe===void 0&&(fe=0),pe===void 0&&(pe=this.length),c<0||R>m.length||fe<0||pe>this.length)throw new RangeError("out of range index");if(fe>=pe&&c>=R)return 0;if(fe>=pe)return-1;if(c>=R)return 1;if(c>>>=0,R>>>=0,fe>>>=0,pe>>>=0,this===m)return 0;for(var Ae=pe-fe,Qe=R-c,nt=Math.min(Ae,Qe),st=this.slice(fe,pe),yt=m.slice(c,R),ft=0;ft<nt;++ft)if(st[ft]!==yt[ft]){Ae=st[ft],Qe=yt[ft];break}return Ae<Qe?-1:Qe<Ae?1:0};function j(q,m,c,R,fe){if(q.length===0)return-1;if(typeof c=="string"?(R=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,isNaN(c)&&(c=fe?0:q.length-1),c<0&&(c=q.length+c),c>=q.length){if(fe)return-1;c=q.length-1}else if(c<0)if(fe)c=0;else return-1;if(typeof m=="string"&&(m=d.from(m,R)),d.isBuffer(m))return m.length===0?-1:T(q,m,c,R,fe);if(typeof m=="number")return m=m&255,d.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?fe?Uint8Array.prototype.indexOf.call(q,m,c):Uint8Array.prototype.lastIndexOf.call(q,m,c):T(q,[m],c,R,fe);throw new TypeError("val must be string, number or Buffer")}function T(q,m,c,R,fe){var pe=1,Ae=q.length,Qe=m.length;if(R!==void 0&&(R=String(R).toLowerCase(),R==="ucs2"||R==="ucs-2"||R==="utf16le"||R==="utf-16le")){if(q.length<2||m.length<2)return-1;pe=2,Ae/=2,Qe/=2,c/=2}function nt(Dt,at){return pe===1?Dt[at]:Dt.readUInt16BE(at*pe)}var st;if(fe){var yt=-1;for(st=c;st<Ae;st++)if(nt(q,st)===nt(m,yt===-1?0:st-yt)){if(yt===-1&&(yt=st),st-yt+1===Qe)return yt*pe}else yt!==-1&&(st-=st-yt),yt=-1}else for(c+Qe>Ae&&(c=Ae-Qe),st=c;st>=0;st--){for(var ft=!0,_t=0;_t<Qe;_t++)if(nt(q,st+_t)!==nt(m,_t)){ft=!1;break}if(ft)return st}return-1}d.prototype.includes=function(m,c,R){return this.indexOf(m,c,R)!==-1},d.prototype.indexOf=function(m,c,R){return j(this,m,c,R,!0)},d.prototype.lastIndexOf=function(m,c,R){return j(this,m,c,R,!1)};function ee(q,m,c,R){c=Number(c)||0;var fe=q.length-c;R?(R=Number(R),R>fe&&(R=fe)):R=fe;var pe=m.length;if(pe%2!==0)throw new TypeError("Invalid hex string");R>pe/2&&(R=pe/2);for(var Ae=0;Ae<R;++Ae){var Qe=parseInt(m.substr(Ae*2,2),16);if(isNaN(Qe))return Ae;q[c+Ae]=Qe}return Ae}function Z(q,m,c,R){return ye(Le(m,q.length-c),q,c,R)}function _(q,m,c,R){return ye(Ge(m),q,c,R)}function X(q,m,c,R){return _(q,m,c,R)}function re(q,m,c,R){return ye(be(m),q,c,R)}function me(q,m,c,R){return ye(ot(m,q.length-c),q,c,R)}d.prototype.write=function(m,c,R,fe){if(c===void 0)fe="utf8",R=this.length,c=0;else if(R===void 0&&typeof c=="string")fe=c,R=this.length,c=0;else if(isFinite(c))c=c|0,isFinite(R)?(R=R|0,fe===void 0&&(fe="utf8")):(fe=R,R=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var pe=this.length-c;if((R===void 0||R>pe)&&(R=pe),m.length>0&&(R<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");fe||(fe="utf8");for(var Ae=!1;;)switch(fe){case"hex":return ee(this,m,c,R);case"utf8":case"utf-8":return Z(this,m,c,R);case"ascii":return _(this,m,c,R);case"latin1":case"binary":return X(this,m,c,R);case"base64":return re(this,m,c,R);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return me(this,m,c,R);default:if(Ae)throw new TypeError("Unknown encoding: "+fe);fe=(""+fe).toLowerCase(),Ae=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function de(q,m,c){return m===0&&c===q.length?F.fromByteArray(q):F.fromByteArray(q.slice(m,c))}function we(q,m,c){c=Math.min(q.length,c);for(var R=[],fe=m;fe<c;){var pe=q[fe],Ae=null,Qe=pe>239?4:pe>223?3:pe>191?2:1;if(fe+Qe<=c){var nt,st,yt,ft;switch(Qe){case 1:pe<128&&(Ae=pe);break;case 2:nt=q[fe+1],(nt&192)===128&&(ft=(pe&31)<<6|nt&63,ft>127&&(Ae=ft));break;case 3:nt=q[fe+1],st=q[fe+2],(nt&192)===128&&(st&192)===128&&(ft=(pe&15)<<12|(nt&63)<<6|st&63,ft>2047&&(ft<55296||ft>57343)&&(Ae=ft));break;case 4:nt=q[fe+1],st=q[fe+2],yt=q[fe+3],(nt&192)===128&&(st&192)===128&&(yt&192)===128&&(ft=(pe&15)<<18|(nt&63)<<12|(st&63)<<6|yt&63,ft>65535&&ft<1114112&&(Ae=ft))}}Ae===null?(Ae=65533,Qe=1):Ae>65535&&(Ae-=65536,R.push(Ae>>>10&1023|55296),Ae=56320|Ae&1023),R.push(Ae),fe+=Qe}return ke(R)}var ge=4096;function ke(q){var m=q.length;if(m<=ge)return String.fromCharCode.apply(String,q);for(var c="",R=0;R<m;)c+=String.fromCharCode.apply(String,q.slice(R,R+=ge));return c}function z(q,m,c){var R="";c=Math.min(q.length,c);for(var fe=m;fe<c;++fe)R+=String.fromCharCode(q[fe]&127);return R}function ie(q,m,c){var R="";c=Math.min(q.length,c);for(var fe=m;fe<c;++fe)R+=String.fromCharCode(q[fe]);return R}function H(q,m,c){var R=q.length;(!m||m<0)&&(m=0),(!c||c<0||c>R)&&(c=R);for(var fe="",pe=m;pe<c;++pe)fe+=Pe(q[pe]);return fe}function ae(q,m,c){for(var R=q.slice(m,c),fe="",pe=0;pe<R.length;pe+=2)fe+=String.fromCharCode(R[pe]+R[pe+1]*256);return fe}d.prototype.slice=function(m,c){var R=this.length;m=~~m,c=c===void 0?R:~~c,m<0?(m+=R,m<0&&(m=0)):m>R&&(m=R),c<0?(c+=R,c<0&&(c=0)):c>R&&(c=R),c<m&&(c=m);var fe;if(d.TYPED_ARRAY_SUPPORT)fe=this.subarray(m,c),fe.__proto__=d.prototype;else{var pe=c-m;fe=new d(pe,void 0);for(var Ae=0;Ae<pe;++Ae)fe[Ae]=this[Ae+m]}return fe};function ue(q,m,c){if(q%1!==0||q<0)throw new RangeError("offset is not uint");if(q+m>c)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUIntLE=function(m,c,R){m=m|0,c=c|0,R||ue(m,c,this.length);for(var fe=this[m],pe=1,Ae=0;++Ae<c&&(pe*=256);)fe+=this[m+Ae]*pe;return fe},d.prototype.readUIntBE=function(m,c,R){m=m|0,c=c|0,R||ue(m,c,this.length);for(var fe=this[m+--c],pe=1;c>0&&(pe*=256);)fe+=this[m+--c]*pe;return fe},d.prototype.readUInt8=function(m,c){return c||ue(m,1,this.length),this[m]},d.prototype.readUInt16LE=function(m,c){return c||ue(m,2,this.length),this[m]|this[m+1]<<8},d.prototype.readUInt16BE=function(m,c){return c||ue(m,2,this.length),this[m]<<8|this[m+1]},d.prototype.readUInt32LE=function(m,c){return c||ue(m,4,this.length),(this[m]|this[m+1]<<8|this[m+2]<<16)+this[m+3]*16777216},d.prototype.readUInt32BE=function(m,c){return c||ue(m,4,this.length),this[m]*16777216+(this[m+1]<<16|this[m+2]<<8|this[m+3])},d.prototype.readIntLE=function(m,c,R){m=m|0,c=c|0,R||ue(m,c,this.length);for(var fe=this[m],pe=1,Ae=0;++Ae<c&&(pe*=256);)fe+=this[m+Ae]*pe;return pe*=128,fe>=pe&&(fe-=Math.pow(2,8*c)),fe},d.prototype.readIntBE=function(m,c,R){m=m|0,c=c|0,R||ue(m,c,this.length);for(var fe=c,pe=1,Ae=this[m+--fe];fe>0&&(pe*=256);)Ae+=this[m+--fe]*pe;return pe*=128,Ae>=pe&&(Ae-=Math.pow(2,8*c)),Ae},d.prototype.readInt8=function(m,c){return c||ue(m,1,this.length),this[m]&128?(255-this[m]+1)*-1:this[m]},d.prototype.readInt16LE=function(m,c){c||ue(m,2,this.length);var R=this[m]|this[m+1]<<8;return R&32768?R|4294901760:R},d.prototype.readInt16BE=function(m,c){c||ue(m,2,this.length);var R=this[m+1]|this[m]<<8;return R&32768?R|4294901760:R},d.prototype.readInt32LE=function(m,c){return c||ue(m,4,this.length),this[m]|this[m+1]<<8|this[m+2]<<16|this[m+3]<<24},d.prototype.readInt32BE=function(m,c){return c||ue(m,4,this.length),this[m]<<24|this[m+1]<<16|this[m+2]<<8|this[m+3]},d.prototype.readFloatLE=function(m,c){return c||ue(m,4,this.length),M.read(this,m,!0,23,4)},d.prototype.readFloatBE=function(m,c){return c||ue(m,4,this.length),M.read(this,m,!1,23,4)},d.prototype.readDoubleLE=function(m,c){return c||ue(m,8,this.length),M.read(this,m,!0,52,8)},d.prototype.readDoubleBE=function(m,c){return c||ue(m,8,this.length),M.read(this,m,!1,52,8)};function te(q,m,c,R,fe,pe){if(!d.isBuffer(q))throw new TypeError('"buffer" argument must be a Buffer instance');if(m>fe||m<pe)throw new RangeError('"value" argument is out of bounds');if(c+R>q.length)throw new RangeError("Index out of range")}d.prototype.writeUIntLE=function(m,c,R,fe){if(m=+m,c=c|0,R=R|0,!fe){var pe=Math.pow(2,8*R)-1;te(this,m,c,R,pe,0)}var Ae=1,Qe=0;for(this[c]=m&255;++Qe<R&&(Ae*=256);)this[c+Qe]=m/Ae&255;return c+R},d.prototype.writeUIntBE=function(m,c,R,fe){if(m=+m,c=c|0,R=R|0,!fe){var pe=Math.pow(2,8*R)-1;te(this,m,c,R,pe,0)}var Ae=R-1,Qe=1;for(this[c+Ae]=m&255;--Ae>=0&&(Qe*=256);)this[c+Ae]=m/Qe&255;return c+R},d.prototype.writeUInt8=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,1,255,0),d.TYPED_ARRAY_SUPPORT||(m=Math.floor(m)),this[c]=m&255,c+1};function Se(q,m,c,R){m<0&&(m=65535+m+1);for(var fe=0,pe=Math.min(q.length-c,2);fe<pe;++fe)q[c+fe]=(m&255<<8*(R?fe:1-fe))>>>(R?fe:1-fe)*8}d.prototype.writeUInt16LE=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,2,65535,0),d.TYPED_ARRAY_SUPPORT?(this[c]=m&255,this[c+1]=m>>>8):Se(this,m,c,!0),c+2},d.prototype.writeUInt16BE=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,2,65535,0),d.TYPED_ARRAY_SUPPORT?(this[c]=m>>>8,this[c+1]=m&255):Se(this,m,c,!1),c+2};function De(q,m,c,R){m<0&&(m=4294967295+m+1);for(var fe=0,pe=Math.min(q.length-c,4);fe<pe;++fe)q[c+fe]=m>>>(R?fe:3-fe)*8&255}d.prototype.writeUInt32LE=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,4,4294967295,0),d.TYPED_ARRAY_SUPPORT?(this[c+3]=m>>>24,this[c+2]=m>>>16,this[c+1]=m>>>8,this[c]=m&255):De(this,m,c,!0),c+4},d.prototype.writeUInt32BE=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,4,4294967295,0),d.TYPED_ARRAY_SUPPORT?(this[c]=m>>>24,this[c+1]=m>>>16,this[c+2]=m>>>8,this[c+3]=m&255):De(this,m,c,!1),c+4},d.prototype.writeIntLE=function(m,c,R,fe){if(m=+m,c=c|0,!fe){var pe=Math.pow(2,8*R-1);te(this,m,c,R,pe-1,-pe)}var Ae=0,Qe=1,nt=0;for(this[c]=m&255;++Ae<R&&(Qe*=256);)m<0&&nt===0&&this[c+Ae-1]!==0&&(nt=1),this[c+Ae]=(m/Qe>>0)-nt&255;return c+R},d.prototype.writeIntBE=function(m,c,R,fe){if(m=+m,c=c|0,!fe){var pe=Math.pow(2,8*R-1);te(this,m,c,R,pe-1,-pe)}var Ae=R-1,Qe=1,nt=0;for(this[c+Ae]=m&255;--Ae>=0&&(Qe*=256);)m<0&&nt===0&&this[c+Ae+1]!==0&&(nt=1),this[c+Ae]=(m/Qe>>0)-nt&255;return c+R},d.prototype.writeInt8=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,1,127,-128),d.TYPED_ARRAY_SUPPORT||(m=Math.floor(m)),m<0&&(m=255+m+1),this[c]=m&255,c+1},d.prototype.writeInt16LE=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,2,32767,-32768),d.TYPED_ARRAY_SUPPORT?(this[c]=m&255,this[c+1]=m>>>8):Se(this,m,c,!0),c+2},d.prototype.writeInt16BE=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,2,32767,-32768),d.TYPED_ARRAY_SUPPORT?(this[c]=m>>>8,this[c+1]=m&255):Se(this,m,c,!1),c+2},d.prototype.writeInt32LE=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,4,2147483647,-2147483648),d.TYPED_ARRAY_SUPPORT?(this[c]=m&255,this[c+1]=m>>>8,this[c+2]=m>>>16,this[c+3]=m>>>24):De(this,m,c,!0),c+4},d.prototype.writeInt32BE=function(m,c,R){return m=+m,c=c|0,R||te(this,m,c,4,2147483647,-2147483648),m<0&&(m=4294967295+m+1),d.TYPED_ARRAY_SUPPORT?(this[c]=m>>>24,this[c+1]=m>>>16,this[c+2]=m>>>8,this[c+3]=m&255):De(this,m,c,!1),c+4};function Fe(q,m,c,R,fe,pe){if(c+R>q.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function Ke(q,m,c,R,fe){return fe||Fe(q,m,c,4,34028234663852886e22,-34028234663852886e22),M.write(q,m,c,R,23,4),c+4}d.prototype.writeFloatLE=function(m,c,R){return Ke(this,m,c,!0,R)},d.prototype.writeFloatBE=function(m,c,R){return Ke(this,m,c,!1,R)};function et(q,m,c,R,fe){return fe||Fe(q,m,c,8,17976931348623157e292,-17976931348623157e292),M.write(q,m,c,R,52,8),c+8}d.prototype.writeDoubleLE=function(m,c,R){return et(this,m,c,!0,R)},d.prototype.writeDoubleBE=function(m,c,R){return et(this,m,c,!1,R)},d.prototype.copy=function(m,c,R,fe){if(R||(R=0),!fe&&fe!==0&&(fe=this.length),c>=m.length&&(c=m.length),c||(c=0),fe>0&&fe<R&&(fe=R),fe===R)return 0;if(m.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(R<0||R>=this.length)throw new RangeError("sourceStart out of bounds");if(fe<0)throw new RangeError("sourceEnd out of bounds");fe>this.length&&(fe=this.length),m.length-c<fe-R&&(fe=m.length-c+R);var pe=fe-R,Ae;if(this===m&&R<c&&c<fe)for(Ae=pe-1;Ae>=0;--Ae)m[Ae+c]=this[Ae+R];else if(pe<1e3||!d.TYPED_ARRAY_SUPPORT)for(Ae=0;Ae<pe;++Ae)m[Ae+c]=this[Ae+R];else Uint8Array.prototype.set.call(m,this.subarray(R,R+pe),c);return pe},d.prototype.fill=function(m,c,R,fe){if(typeof m=="string"){if(typeof c=="string"?(fe=c,c=0,R=this.length):typeof R=="string"&&(fe=R,R=this.length),m.length===1){var pe=m.charCodeAt(0);pe<256&&(m=pe)}if(fe!==void 0&&typeof fe!="string")throw new TypeError("encoding must be a string");if(typeof fe=="string"&&!d.isEncoding(fe))throw new TypeError("Unknown encoding: "+fe)}else typeof m=="number"&&(m=m&255);if(c<0||this.length<c||this.length<R)throw new RangeError("Out of range index");if(R<=c)return this;c=c>>>0,R=R===void 0?this.length:R>>>0,m||(m=0);var Ae;if(typeof m=="number")for(Ae=c;Ae<R;++Ae)this[Ae]=m;else{var Qe=d.isBuffer(m)?m:Le(new d(m,fe).toString()),nt=Qe.length;for(Ae=0;Ae<R-c;++Ae)this[Ae+c]=Qe[Ae%nt]}return this};var Ie=/[^+\/0-9A-Za-z-_]/g;function dt(q){if(q=Ye(q).replace(Ie,""),q.length<2)return"";for(;q.length%4!==0;)q=q+"=";return q}function Ye(q){return q.trim?q.trim():q.replace(/^\s+|\s+$/g,"")}function Pe(q){return q<16?"0"+q.toString(16):q.toString(16)}function Le(q,m){m=m||Infinity;for(var c,R=q.length,fe=null,pe=[],Ae=0;Ae<R;++Ae){if(c=q.charCodeAt(Ae),c>55295&&c<57344){if(!fe){if(c>56319){(m-=3)>-1&&pe.push(239,191,189);continue}else if(Ae+1===R){(m-=3)>-1&&pe.push(239,191,189);continue}fe=c;continue}if(c<56320){(m-=3)>-1&&pe.push(239,191,189),fe=c;continue}c=(fe-55296<<10|c-56320)+65536}else fe&&((m-=3)>-1&&pe.push(239,191,189));if(fe=null,c<128){if((m-=1)<0)break;pe.push(c)}else if(c<2048){if((m-=2)<0)break;pe.push(c>>6|192,c&63|128)}else if(c<65536){if((m-=3)<0)break;pe.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((m-=4)<0)break;pe.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return pe}function Ge(q){for(var m=[],c=0;c<q.length;++c)m.push(q.charCodeAt(c)&255);return m}function ot(q,m){for(var c,R,fe,pe=[],Ae=0;Ae<q.length&&!((m-=2)<0);++Ae)c=q.charCodeAt(Ae),R=c>>8,fe=c%256,pe.push(fe),pe.push(R);return pe}function be(q){return F.toByteArray(dt(q))}function ye(q,m,c,R){for(var fe=0;fe<R&&!(fe+c>=m.length||fe>=q.length);++fe)m[fe+c]=q[fe];return fe}function $e(q){return q!==q}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{},l("buffer").Buffer)},{"base64-js":69,buffer:73,ieee754:195,isarray:198}],74:[function(l,V,N){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(l,V,N){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(l,V,N){/*!
|
|
|
* copy-to - index.js
|
|
|
* Copyright(c) 2014 dead_horse <dead_horse@qq.com>
|
|
|
* MIT Licensed
|
|
|
*/"use strict";var y=Array.prototype.slice;V.exports=d;function d(M,D){if(!(this instanceof d))return new d(M,D);this.src=M,this._withAccess=D}d.prototype.withAccess=function(M){return this._withAccess=M!==!1,this},d.prototype.pick=function(M){return Array.isArray(M)||(M=y.call(arguments)),M.length&&(this.keys=M),this},d.prototype.to=function(M){if(M=M||{},!this.src)return M;var D=this.keys||Object.keys(this.src);if(!this._withAccess){for(var E=0;E<D.length;E++){if(g=D[E],M[g]!==void 0)continue;M[g]=this.src[g]}return M}for(var E=0;E<D.length;E++){var g=D[E];if(!F(M,g))continue;var h=this.src.__lookupGetter__(g),b=this.src.__lookupSetter__(g);h&&M.__defineGetter__(g,h),b&&M.__defineSetter__(g,b),!h&&!b&&(M[g]=this.src[g])}return M},d.prototype.toCover=function(M){for(var D=this.keys||Object.keys(this.src),E=0;E<D.length;E++){var g=D[E];delete M[g];var h=this.src.__lookupGetter__(g),b=this.src.__lookupSetter__(g);h&&M.__defineGetter__(g,h),b&&M.__defineSetter__(g,b),!h&&!b&&(M[g]=this.src[g])}},d.prototype.override=d.prototype.toCover,d.prototype.and=function(M){var D={};return this.to(D),this.src=M,this.to(D),this.src=D,this};function F(M,D){return M[D]===void 0&&M.__lookupGetter__(D)===void 0&&M.__lookupSetter__(D)===void 0}},{}],77:[function(l,V,N){l("../../modules/es6.string.iterator"),l("../../modules/es6.array.from"),V.exports=l("../../modules/_core").Array.from},{"../../modules/_core":99,"../../modules/es6.array.from":168,"../../modules/es6.string.iterator":180}],78:[function(l,V,N){var y=l("../../modules/_core"),d=y.JSON||(y.JSON={stringify:JSON.stringify});V.exports=function(M){return d.stringify.apply(d,arguments)}},{"../../modules/_core":99}],79:[function(l,V,N){l("../../modules/es6.object.assign"),V.exports=l("../../modules/_core").Object.assign},{"../../modules/_core":99,"../../modules/es6.object.assign":171}],80:[function(l,V,N){l("../../modules/es6.object.create");var y=l("../../modules/_core").Object;V.exports=function(F,M){return y.create(F,M)}},{"../../modules/_core":99,"../../modules/es6.object.create":172}],81:[function(l,V,N){l("../../modules/es6.object.define-property");var y=l("../../modules/_core").Object;V.exports=function(F,M,D){return y.defineProperty(F,M,D)}},{"../../modules/_core":99,"../../modules/es6.object.define-property":173}],82:[function(l,V,N){l("../../modules/es7.object.entries"),V.exports=l("../../modules/_core").Object.entries},{"../../modules/_core":99,"../../modules/es7.object.entries":182}],83:[function(l,V,N){l("../../modules/es6.object.get-own-property-names");var y=l("../../modules/_core").Object;V.exports=function(F){return y.getOwnPropertyNames(F)}},{"../../modules/_core":99,"../../modules/es6.object.get-own-property-names":174}],84:[function(l,V,N){l("../../modules/es6.object.get-prototype-of"),V.exports=l("../../modules/_core").Object.getPrototypeOf},{"../../modules/_core":99,"../../modules/es6.object.get-prototype-of":175}],85:[function(l,V,N){l("../../modules/es6.object.keys"),V.exports=l("../../modules/_core").Object.keys},{"../../modules/_core":99,"../../modules/es6.object.keys":176}],86:[function(l,V,N){l("../modules/es6.object.to-string"),l("../modules/es6.string.iterator"),l("../modules/web.dom.iterable"),l("../modules/es6.promise"),l("../modules/es7.promise.finally"),l("../modules/es7.promise.try"),V.exports=l("../modules/_core").Promise},{"../modules/_core":99,"../modules/es6.object.to-string":177,"../modules/es6.promise":178,"../modules/es6.string.iterator":180,"../modules/es7.promise.finally":183,"../modules/es7.promise.try":184,"../modules/web.dom.iterable":187}],87:[function(l,V,N){l("../modules/web.immediate"),V.exports=l("../modules/_core").setImmediate},{"../modules/_core":99,"../modules/web.immediate":188}],88:[function(l,V,N){l("../../modules/es6.string.from-code-point"),V.exports=l("../../modules/_core").String.fromCodePoint},{"../../modules/_core":99,"../../modules/es6.string.from-code-point":179}],89:[function(l,V,N){l("../../modules/es6.function.has-instance"),V.exports=l("../../modules/_wks-ext").f("hasInstance")},{"../../modules/_wks-ext":165,"../../modules/es6.function.has-instance":170}],90:[function(l,V,N){l("../../modules/es6.symbol"),l("../../modules/es6.object.to-string"),l("../../modules/es7.symbol.async-iterator"),l("../../modules/es7.symbol.observable"),V.exports=l("../../modules/_core").Symbol},{"../../modules/_core":99,"../../modules/es6.object.to-string":177,"../../modules/es6.symbol":181,"../../modules/es7.symbol.async-iterator":185,"../../modules/es7.symbol.observable":186}],91:[function(l,V,N){l("../../modules/es6.string.iterator"),l("../../modules/web.dom.iterable"),V.exports=l("../../modules/_wks-ext").f("iterator")},{"../../modules/_wks-ext":165,"../../modules/es6.string.iterator":180,"../../modules/web.dom.iterable":187}],92:[function(l,V,N){V.exports=function(y){if(typeof y!="function")throw TypeError(y+" is not a function!");return y}},{}],93:[function(l,V,N){V.exports=function(){}},{}],94:[function(l,V,N){V.exports=function(y,d,F,M){if(!(y instanceof d)||M!==void 0&&M in y)throw TypeError(F+": incorrect invocation!");return y}},{}],95:[function(l,V,N){var y=l("./_is-object");V.exports=function(d){if(!y(d))throw TypeError(d+" is not an object!");return d}},{"./_is-object":119}],96:[function(l,V,N){var y=l("./_to-iobject"),d=l("./_to-length"),F=l("./_to-absolute-index");V.exports=function(M){return function(D,E,g){var h=y(D),b=d(h.length),p=F(g,b),v;if(M&&E!=E){for(;b>p;)if(v=h[p++],v!=v)return!0}else for(;b>p;p++)if((M||p in h)&&h[p]===E)return M||p||0;return!M&&-1}}},{"./_to-absolute-index":156,"./_to-iobject":158,"./_to-length":159}],97:[function(l,V,N){var y=l("./_cof"),d=l("./_wks")("toStringTag"),F=y(function(){return arguments}())=="Arguments",M=function(D,E){try{return D[E]}catch(g){}};V.exports=function(D){var E,g,h;return D===void 0?"Undefined":D===null?"Null":typeof(g=M(E=Object(D),d))=="string"?g:F?y(E):(h=y(E))=="Object"&&typeof E.callee=="function"?"Arguments":h}},{"./_cof":98,"./_wks":166}],98:[function(l,V,N){var y={}.toString;V.exports=function(d){return y.call(d).slice(8,-1)}},{}],99:[function(l,V,N){var y=V.exports={version:"2.6.11"};typeof __e=="number"&&(__e=y)},{}],100:[function(l,V,N){"use strict";var y=l("./_object-dp"),d=l("./_property-desc");V.exports=function(F,M,D){M in F?y.f(F,M,d(0,D)):F[M]=D}},{"./_object-dp":132,"./_property-desc":146}],101:[function(l,V,N){var y=l("./_a-function");V.exports=function(d,F,M){if(y(d),F===void 0)return d;switch(M){case 1:return function(D){return d.call(F,D)};case 2:return function(D,E){return d.call(F,D,E)};case 3:return function(D,E,g){return d.call(F,D,E,g)}}return function(){return d.apply(F,arguments)}}},{"./_a-function":92}],102:[function(l,V,N){V.exports=function(y){if(y==null)throw TypeError("Can't call method on "+y);return y}},{}],103:[function(l,V,N){V.exports=!l("./_fails")(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},{"./_fails":108}],104:[function(l,V,N){var y=l("./_is-object"),d=l("./_global").document,F=y(d)&&y(d.createElement);V.exports=function(M){return F?d.createElement(M):{}}},{"./_global":110,"./_is-object":119}],105:[function(l,V,N){V.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},{}],106:[function(l,V,N){var y=l("./_object-keys"),d=l("./_object-gops"),F=l("./_object-pie");V.exports=function(M){var D=y(M),E=d.f;if(E)for(var g=E(M),h=F.f,b=0,p;g.length>b;)h.call(M,p=g[b++])&&D.push(p);return D}},{"./_object-gops":137,"./_object-keys":140,"./_object-pie":141}],107:[function(l,V,N){var y=l("./_global"),d=l("./_core"),F=l("./_ctx"),M=l("./_hide"),D=l("./_has"),E="prototype",g=function(h,b,p){var v=h&g.F,I=h&g.G,x=h&g.S,S=h&g.P,W=h&g.B,B=h&g.W,Q=I?d:d[b]||(d[b]={}),G=Q[E],$=I?y:x?y[b]:(y[b]||{})[E],J,U,j;I&&(p=b);for(J in p){if(U=!v&&$&&$[J]!==void 0,U&&D(Q,J))continue;j=U?$[J]:p[J],Q[J]=I&&typeof $[J]!="function"?p[J]:W&&U?F(j,y):B&&$[J]==j?function(T){var ee=function(Z,_,X){if(this instanceof T){switch(arguments.length){case 0:return new T;case 1:return new T(Z);case 2:return new T(Z,_)}return new T(Z,_,X)}return T.apply(this,arguments)};return ee[E]=T[E],ee}(j):S&&typeof j=="function"?F(Function.call,j):j,S&&((Q.virtual||(Q.virtual={}))[J]=j,h&g.R&&G&&!G[J]&&M(G,J,j))}};g.F=1,g.G=2,g.S=4,g.P=8,g.B=16,g.W=32,g.U=64,g.R=128,V.exports=g},{"./_core":99,"./_ctx":101,"./_global":110,"./_has":111,"./_hide":112}],108:[function(l,V,N){V.exports=function(y){try{return!!y()}catch(d){return!0}}},{}],109:[function(l,V,N){var y=l("./_ctx"),d=l("./_iter-call"),F=l("./_is-array-iter"),M=l("./_an-object"),D=l("./_to-length"),E=l("./core.get-iterator-method"),g={},h={},N=V.exports=function(b,p,v,I,x){var S=x?function(){return b}:E(b),W=y(v,I,p?2:1),B=0,Q,G,$,J;if(typeof S!="function")throw TypeError(b+" is not iterable!");if(F(S)){for(Q=D(b.length);Q>B;B++)if(J=p?W(M(G=b[B])[0],G[1]):W(b[B]),J===g||J===h)return J}else for($=S.call(b);!(G=$.next()).done;)if(J=d($,W,G.value,p),J===g||J===h)return J};N.BREAK=g,N.RETURN=h},{"./_an-object":95,"./_ctx":101,"./_is-array-iter":117,"./_iter-call":120,"./_to-length":159,"./core.get-iterator-method":167}],110:[function(l,V,N){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(l,V,N){var y={}.hasOwnProperty;V.exports=function(d,F){return y.call(d,F)}},{}],112:[function(l,V,N){var y=l("./_object-dp"),d=l("./_property-desc");V.exports=l("./_descriptors")?function(F,M,D){return y.f(F,M,d(1,D))}:function(F,M,D){return F[M]=D,F}},{"./_descriptors":103,"./_object-dp":132,"./_property-desc":146}],113:[function(l,V,N){var y=l("./_global").document;V.exports=y&&y.documentElement},{"./_global":110}],114:[function(l,V,N){V.exports=!l("./_descriptors")&&!l("./_fails")(function(){return Object.defineProperty(l("./_dom-create")("div"),"a",{get:function(){return 7}}).a!=7})},{"./_descriptors":103,"./_dom-create":104,"./_fails":108}],115:[function(l,V,N){V.exports=function(y,d,F){var M=F===void 0;switch(d.length){case 0:return M?y():y.call(F);case 1:return M?y(d[0]):y.call(F,d[0]);case 2:return M?y(d[0],d[1]):y.call(F,d[0],d[1]);case 3:return M?y(d[0],d[1],d[2]):y.call(F,d[0],d[1],d[2]);case 4:return M?y(d[0],d[1],d[2],d[3]):y.call(F,d[0],d[1],d[2],d[3])}return y.apply(F,d)}},{}],116:[function(l,V,N){var y=l("./_cof");V.exports=Object("z").propertyIsEnumerable(0)?Object:function(d){return y(d)=="String"?d.split(""):Object(d)}},{"./_cof":98}],117:[function(l,V,N){var y=l("./_iterators"),d=l("./_wks")("iterator"),F=Array.prototype;V.exports=function(M){return M!==void 0&&(y.Array===M||F[d]===M)}},{"./_iterators":125,"./_wks":166}],118:[function(l,V,N){var y=l("./_cof");V.exports=Array.isArray||function(F){return y(F)=="Array"}},{"./_cof":98}],119:[function(l,V,N){V.exports=function(y){return typeof y=="object"?y!==null:typeof y=="function"}},{}],120:[function(l,V,N){var y=l("./_an-object");V.exports=function(d,F,M,D){try{return D?F(y(M)[0],M[1]):F(M)}catch(g){var E=d.return;throw E!==void 0&&y(E.call(d)),g}}},{"./_an-object":95}],121:[function(l,V,N){"use strict";var y=l("./_object-create"),d=l("./_property-desc"),F=l("./_set-to-string-tag"),M={};l("./_hide")(M,l("./_wks")("iterator"),function(){return this}),V.exports=function(D,E,g){D.prototype=y(M,{next:d(1,g)}),F(D,E+" Iterator")}},{"./_hide":112,"./_object-create":131,"./_property-desc":146,"./_set-to-string-tag":150,"./_wks":166}],122:[function(l,V,N){"use strict";var y=l("./_library"),d=l("./_export"),F=l("./_redefine"),M=l("./_hide"),D=l("./_iterators"),E=l("./_iter-create"),g=l("./_set-to-string-tag"),h=l("./_object-gpo"),b=l("./_wks")("iterator"),p=!([].keys&&"next"in[].keys()),v="@@iterator",I="keys",x="values",S=function(){return this};V.exports=function(W,B,Q,G,$,J,U){E(Q,B,G);var j=function(z){if(!p&&z in _)return _[z];switch(z){case I:return function(){return new Q(this,z)};case x:return function(){return new Q(this,z)}}return function(){return new Q(this,z)}},T=B+" Iterator",ee=$==x,Z=!1,_=W.prototype,X=_[b]||_[v]||$&&_[$],re=X||j($),me=$?ee?j("entries"):re:void 0,de=B=="Array"&&_.entries||X,we,ge,ke;if(de&&(ke=h(de.call(new W)),ke!==Object.prototype&&ke.next&&(g(ke,T,!0),!y&&typeof ke[b]!="function"&&M(ke,b,S))),ee&&X&&X.name!==x&&(Z=!0,re=function(){return X.call(this)}),(!y||U)&&(p||Z||!_[b])&&M(_,b,re),D[B]=re,D[T]=S,$)if(we={values:ee?re:j(x),keys:J?re:j(I),entries:me},U)for(ge in we)ge in _||F(_,ge,we[ge]);else d(d.P+d.F*(p||Z),B,we);return we}},{"./_export":107,"./_hide":112,"./_iter-create":121,"./_iterators":125,"./_library":126,"./_object-gpo":138,"./_redefine":148,"./_set-to-string-tag":150,"./_wks":166}],123:[function(l,V,N){var y=l("./_wks")("iterator"),d=!1;try{var F=[7][y]();F.return=function(){d=!0},Array.from(F,function(){throw 2})}catch(M){}V.exports=function(M,D){if(!D&&!d)return!1;var E=!1;try{var g=[7],h=g[y]();h.next=function(){return{done:E=!0}},g[y]=function(){return h},M(g)}catch(b){}return E}},{"./_wks":166}],124:[function(l,V,N){V.exports=function(y,d){return{value:d,done:!!y}}},{}],125:[function(l,V,N){V.exports={}},{}],126:[function(l,V,N){V.exports=!0},{}],127:[function(l,V,N){var y=l("./_uid")("meta"),d=l("./_is-object"),F=l("./_has"),M=l("./_object-dp").f,D=0,E=Object.isExtensible||function(){return!0},g=!l("./_fails")(function(){return E(Object.preventExtensions({}))}),h=function(x){M(x,y,{value:{i:"O"+ ++D,w:{}}})},b=function(x,S){if(!d(x))return typeof x=="symbol"?x:(typeof x=="string"?"S":"P")+x;if(!F(x,y)){if(!E(x))return"F";if(!S)return"E";h(x)}return x[y].i},p=function(x,S){if(!F(x,y)){if(!E(x))return!0;if(!S)return!1;h(x)}return x[y].w},v=function(x){return g&&I.NEED&&E(x)&&!F(x,y)&&h(x),x},I=V.exports={KEY:y,NEED:!1,fastKey:b,getWeak:p,onFreeze:v}},{"./_fails":108,"./_has":111,"./_is-object":119,"./_object-dp":132,"./_uid":162}],128:[function(l,V,N){var y=l("./_global"),d=l("./_task").set,F=y.MutationObserver||y.WebKitMutationObserver,M=y.process,D=y.Promise,E=l("./_cof")(M)=="process";V.exports=function(){var g,h,b,p=function(){var S,W;for(E&&(S=M.domain)&&S.exit();g;){W=g.fn,g=g.next;try{W()}catch(B){throw g?b():h=void 0,B}}h=void 0,S&&S.enter()};if(E)b=function(){M.nextTick(p)};else if(F&&!(y.navigator&&y.navigator.standalone)){var v=!0,I=document.createTextNode("");new F(p).observe(I,{characterData:!0}),b=function(){I.data=v=!v}}else if(D&&D.resolve){var x=D.resolve(void 0);b=function(){x.then(p)}}else b=function(){d.call(y,p)};return function(S){var W={fn:S,next:void 0};h&&(h.next=W),g||(g=W,b()),h=W}}},{"./_cof":98,"./_global":110,"./_task":155}],129:[function(l,V,N){"use strict";var y=l("./_a-function");function d(F){var M,D;this.promise=new F(function(E,g){if(M!==void 0||D!==void 0)throw TypeError("Bad Promise constructor");M=E,D=g}),this.resolve=y(M),this.reject=y(D)}V.exports.f=function(F){return new d(F)}},{"./_a-function":92}],130:[function(l,V,N){"use strict";var y=l("./_descriptors"),d=l("./_object-keys"),F=l("./_object-gops"),M=l("./_object-pie"),D=l("./_to-object"),E=l("./_iobject"),g=Object.assign;V.exports=!g||l("./_fails")(function(){var h={},b={},p=Symbol(),v="abcdefghijklmnopqrst";return h[p]=7,v.split("").forEach(function(I){b[I]=I}),g({},h)[p]!=7||Object.keys(g({},b)).join("")!=v})?function(b,p){for(var v=D(b),I=arguments.length,x=1,S=F.f,W=M.f;I>x;)for(var B=E(arguments[x++]),Q=S?d(B).concat(S(B)):d(B),G=Q.length,$=0,J;G>$;)J=Q[$++],(!y||W.call(B,J))&&(v[J]=B[J]);return v}:g},{"./_descriptors":103,"./_fails":108,"./_iobject":116,"./_object-gops":137,"./_object-keys":140,"./_object-pie":141,"./_to-object":160}],131:[function(l,V,N){var y=l("./_an-object"),d=l("./_object-dps"),F=l("./_enum-bug-keys"),M=l("./_shared-key")("IE_PROTO"),D=function(){},E="prototype",g=function(){var h=l("./_dom-create")("iframe"),b=F.length,p="<",v=">",I;for(h.style.display="none",l("./_html").appendChild(h),h.src="javascript:",I=h.contentWindow.document,I.open(),I.write(p+"script"+v+"document.F=Object"+p+"/script"+v),I.close(),g=I.F;b--;)delete g[E][F[b]];return g()};V.exports=Object.create||function(b,p){var v;return b!==null?(D[E]=y(b),v=new D,D[E]=null,v[M]=b):v=g(),p===void 0?v:d(v,p)}},{"./_an-object":95,"./_dom-create":104,"./_enum-bug-keys":105,"./_html":113,"./_object-dps":133,"./_shared-key":151}],132:[function(l,V,N){var y=l("./_an-object"),d=l("./_ie8-dom-define"),F=l("./_to-primitive"),M=Object.defineProperty;N.f=l("./_descriptors")?Object.defineProperty:function(E,g,h){if(y(E),g=F(g,!0),y(h),d)try{return M(E,g,h)}catch(b){}if("get"in h||"set"in h)throw TypeError("Accessors not supported!");return"value"in h&&(E[g]=h.value),E}},{"./_an-object":95,"./_descriptors":103,"./_ie8-dom-define":114,"./_to-primitive":161}],133:[function(l,V,N){var y=l("./_object-dp"),d=l("./_an-object"),F=l("./_object-keys");V.exports=l("./_descriptors")?Object.defineProperties:function(D,E){d(D);for(var g=F(E),h=g.length,b=0,p;h>b;)y.f(D,p=g[b++],E[p]);return D}},{"./_an-object":95,"./_descriptors":103,"./_object-dp":132,"./_object-keys":140}],134:[function(l,V,N){var y=l("./_object-pie"),d=l("./_property-desc"),F=l("./_to-iobject"),M=l("./_to-primitive"),D=l("./_has"),E=l("./_ie8-dom-define"),g=Object.getOwnPropertyDescriptor;N.f=l("./_descriptors")?g:function(b,p){if(b=F(b),p=M(p,!0),E)try{return g(b,p)}catch(v){}if(D(b,p))return d(!y.f.call(b,p),b[p])}},{"./_descriptors":103,"./_has":111,"./_ie8-dom-define":114,"./_object-pie":141,"./_property-desc":146,"./_to-iobject":158,"./_to-primitive":161}],135:[function(l,V,N){var y=l("./_to-iobject"),d=l("./_object-gopn").f,F={}.toString,M=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],D=function(E){try{return d(E)}catch(g){return M.slice()}};V.exports.f=function(g){return M&&F.call(g)=="[object Window]"?D(g):d(y(g))}},{"./_object-gopn":136,"./_to-iobject":158}],136:[function(l,V,N){var y=l("./_object-keys-internal"),d=l("./_enum-bug-keys").concat("length","prototype");N.f=Object.getOwnPropertyNames||function(M){return y(M,d)}},{"./_enum-bug-keys":105,"./_object-keys-internal":139}],137:[function(l,V,N){N.f=Object.getOwnPropertySymbols},{}],138:[function(l,V,N){var y=l("./_has"),d=l("./_to-object"),F=l("./_shared-key")("IE_PROTO"),M=Object.prototype;V.exports=Object.getPrototypeOf||function(D){return D=d(D),y(D,F)?D[F]:typeof D.constructor=="function"&&D instanceof D.constructor?D.constructor.prototype:D instanceof Object?M:null}},{"./_has":111,"./_shared-key":151,"./_to-object":160}],139:[function(l,V,N){var y=l("./_has"),d=l("./_to-iobject"),F=l("./_array-includes")(!1),M=l("./_shared-key")("IE_PROTO");V.exports=function(D,E){var g=d(D),h=0,b=[],p;for(p in g)p!=M&&(y(g,p)&&b.push(p));for(;E.length>h;)y(g,p=E[h++])&&(~F(b,p)||b.push(p));return b}},{"./_array-includes":96,"./_has":111,"./_shared-key":151,"./_to-iobject":158}],140:[function(l,V,N){var y=l("./_object-keys-internal"),d=l("./_enum-bug-keys");V.exports=Object.keys||function(M){return y(M,d)}},{"./_enum-bug-keys":105,"./_object-keys-internal":139}],141:[function(l,V,N){N.f={}.propertyIsEnumerable},{}],142:[function(l,V,N){var y=l("./_export"),d=l("./_core"),F=l("./_fails");V.exports=function(M,D){var E=(d.Object||{})[M]||Object[M],g={};g[M]=D(E),y(y.S+y.F*F(function(){E(1)}),"Object",g)}},{"./_core":99,"./_export":107,"./_fails":108}],143:[function(l,V,N){var y=l("./_descriptors"),d=l("./_object-keys"),F=l("./_to-iobject"),M=l("./_object-pie").f;V.exports=function(D){return function(E){for(var g=F(E),h=d(g),b=h.length,p=0,v=[],I;b>p;)I=h[p++],(!y||M.call(g,I))&&v.push(D?[I,g[I]]:g[I]);return v}}},{"./_descriptors":103,"./_object-keys":140,"./_object-pie":141,"./_to-iobject":158}],144:[function(l,V,N){V.exports=function(y){try{return{e:!1,v:y()}}catch(d){return{e:!0,v:d}}}},{}],145:[function(l,V,N){var y=l("./_an-object"),d=l("./_is-object"),F=l("./_new-promise-capability");V.exports=function(M,D){if(y(M),d(D)&&D.constructor===M)return D;var E=F.f(M),g=E.resolve;return g(D),E.promise}},{"./_an-object":95,"./_is-object":119,"./_new-promise-capability":129}],146:[function(l,V,N){V.exports=function(y,d){return{enumerable:!(y&1),configurable:!(y&2),writable:!(y&4),value:d}}},{}],147:[function(l,V,N){var y=l("./_hide");V.exports=function(d,F,M){for(var D in F)M&&d[D]?d[D]=F[D]:y(d,D,F[D]);return d}},{"./_hide":112}],148:[function(l,V,N){V.exports=l("./_hide")},{"./_hide":112}],149:[function(l,V,N){"use strict";var y=l("./_global"),d=l("./_core"),F=l("./_object-dp"),M=l("./_descriptors"),D=l("./_wks")("species");V.exports=function(E){var g=typeof d[E]=="function"?d[E]:y[E];M&&g&&!g[D]&&F.f(g,D,{configurable:!0,get:function(){return this}})}},{"./_core":99,"./_descriptors":103,"./_global":110,"./_object-dp":132,"./_wks":166}],150:[function(l,V,N){var y=l("./_object-dp").f,d=l("./_has"),F=l("./_wks")("toStringTag");V.exports=function(M,D,E){M&&!d(M=E?M:M.prototype,F)&&y(M,F,{configurable:!0,value:D})}},{"./_has":111,"./_object-dp":132,"./_wks":166}],151:[function(l,V,N){var y=l("./_shared")("keys"),d=l("./_uid");V.exports=function(F){return y[F]||(y[F]=d(F))}},{"./_shared":152,"./_uid":162}],152:[function(l,V,N){var y=l("./_core"),d=l("./_global"),F="__core-js_shared__",M=d[F]||(d[F]={});(V.exports=function(D,E){return M[D]||(M[D]=E!==void 0?E:{})})("versions",[]).push({version:y.version,mode:l("./_library")?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})},{"./_core":99,"./_global":110,"./_library":126}],153:[function(l,V,N){var y=l("./_an-object"),d=l("./_a-function"),F=l("./_wks")("species");V.exports=function(M,D){var E=y(M).constructor,g;return E===void 0||(g=y(E)[F])==null?D:d(g)}},{"./_a-function":92,"./_an-object":95,"./_wks":166}],154:[function(l,V,N){var y=l("./_to-integer"),d=l("./_defined");V.exports=function(F){return function(M,D){var E=String(d(M)),g=y(D),h=E.length,b,p;return g<0||g>=h?F?"":void 0:(b=E.charCodeAt(g),b<55296||b>56319||g+1===h||(p=E.charCodeAt(g+1))<56320||p>57343?F?E.charAt(g):b:F?E.slice(g,g+2):(b-55296<<10)+(p-56320)+65536)}}},{"./_defined":102,"./_to-integer":157}],155:[function(l,V,N){var y=l("./_ctx"),d=l("./_invoke"),F=l("./_html"),M=l("./_dom-create"),D=l("./_global"),E=D.process,g=D.setImmediate,h=D.clearImmediate,b=D.MessageChannel,p=D.Dispatch,v=0,I={},x="onreadystatechange",S,W,B,Q=function(){var $=+this;if(I.hasOwnProperty($)){var J=I[$];delete I[$],J()}},G=function($){Q.call($.data)};(!g||!h)&&(g=function(J){for(var U=[],j=1;arguments.length>j;)U.push(arguments[j++]);return I[++v]=function(){d(typeof J=="function"?J:Function(J),U)},S(v),v},h=function(J){delete I[J]},l("./_cof")(E)=="process"?S=function($){E.nextTick(y(Q,$,1))}:p&&p.now?S=function($){p.now(y(Q,$,1))}:b?(W=new b,B=W.port2,W.port1.onmessage=G,S=y(B.postMessage,B,1)):D.addEventListener&&typeof postMessage=="function"&&!D.importScripts?(S=function($){D.postMessage($+"","*")},D.addEventListener("message",G,!1)):x in M("script")?S=function($){F.appendChild(M("script"))[x]=function(){F.removeChild(this),Q.call($)}}:S=function($){setTimeout(y(Q,$,1),0)}),V.exports={set:g,clear:h}},{"./_cof":98,"./_ctx":101,"./_dom-create":104,"./_global":110,"./_html":113,"./_invoke":115}],156:[function(l,V,N){var y=l("./_to-integer"),d=Math.max,F=Math.min;V.exports=function(M,D){return M=y(M),M<0?d(M+D,0):F(M,D)}},{"./_to-integer":157}],157:[function(l,V,N){var y=Math.ceil,d=Math.floor;V.exports=function(F){return isNaN(F=+F)?0:(F>0?d:y)(F)}},{}],158:[function(l,V,N){var y=l("./_iobject"),d=l("./_defined");V.exports=function(F){return y(d(F))}},{"./_defined":102,"./_iobject":116}],159:[function(l,V,N){var y=l("./_to-integer"),d=Math.min;V.exports=function(F){return F>0?d(y(F),9007199254740991):0}},{"./_to-integer":157}],160:[function(l,V,N){var y=l("./_defined");V.exports=function(d){return Object(y(d))}},{"./_defined":102}],161:[function(l,V,N){var y=l("./_is-object");V.exports=function(d,F){if(!y(d))return d;var M,D;if(F&&typeof(M=d.toString)=="function"&&!y(D=M.call(d)))return D;if(typeof(M=d.valueOf)=="function"&&!y(D=M.call(d)))return D;if(!F&&typeof(M=d.toString)=="function"&&!y(D=M.call(d)))return D;throw TypeError("Can't convert object to primitive value")}},{"./_is-object":119}],162:[function(l,V,N){var y=0,d=Math.random();V.exports=function(F){return"Symbol(".concat(F===void 0?"":F,")_",(++y+d).toString(36))}},{}],163:[function(l,V,N){var y=l("./_global"),d=y.navigator;V.exports=d&&d.userAgent||""},{"./_global":110}],164:[function(l,V,N){var y=l("./_global"),d=l("./_core"),F=l("./_library"),M=l("./_wks-ext"),D=l("./_object-dp").f;V.exports=function(E){var g=d.Symbol||(d.Symbol=F?{}:y.Symbol||{});E.charAt(0)!="_"&&!(E in g)&&D(g,E,{value:M.f(E)})}},{"./_core":99,"./_global":110,"./_library":126,"./_object-dp":132,"./_wks-ext":165}],165:[function(l,V,N){N.f=l("./_wks")},{"./_wks":166}],166:[function(l,V,N){var y=l("./_shared")("wks"),d=l("./_uid"),F=l("./_global").Symbol,M=typeof F=="function",D=V.exports=function(E){return y[E]||(y[E]=M&&F[E]||(M?F:d)("Symbol."+E))};D.store=y},{"./_global":110,"./_shared":152,"./_uid":162}],167:[function(l,V,N){var y=l("./_classof"),d=l("./_wks")("iterator"),F=l("./_iterators");V.exports=l("./_core").getIteratorMethod=function(M){if(M!=null)return M[d]||M["@@iterator"]||F[y(M)]}},{"./_classof":97,"./_core":99,"./_iterators":125,"./_wks":166}],168:[function(l,V,N){"use strict";var y=l("./_ctx"),d=l("./_export"),F=l("./_to-object"),M=l("./_iter-call"),D=l("./_is-array-iter"),E=l("./_to-length"),g=l("./_create-property"),h=l("./core.get-iterator-method");d(d.S+d.F*!l("./_iter-detect")(function(b){Array.from(b)}),"Array",{from:function(p){var v=F(p),I=typeof this=="function"?this:Array,x=arguments.length,S=x>1?arguments[1]:void 0,W=S!==void 0,B=0,Q=h(v),G,$,J,U;if(W&&(S=y(S,x>2?arguments[2]:void 0,2)),Q!=null&&!(I==Array&&D(Q)))for(U=Q.call(v),$=new I;!(J=U.next()).done;B++)g($,B,W?M(U,S,[J.value,B],!0):J.value);else for(G=E(v.length),$=new I(G);G>B;B++)g($,B,W?S(v[B],B):v[B]);return $.length=B,$}})},{"./_create-property":100,"./_ctx":101,"./_export":107,"./_is-array-iter":117,"./_iter-call":120,"./_iter-detect":123,"./_to-length":159,"./_to-object":160,"./core.get-iterator-method":167}],169:[function(l,V,N){"use strict";var y=l("./_add-to-unscopables"),d=l("./_iter-step"),F=l("./_iterators"),M=l("./_to-iobject");V.exports=l("./_iter-define")(Array,"Array",function(D,E){this._t=M(D),this._i=0,this._k=E},function(){var D=this._t,E=this._k,g=this._i++;return!D||g>=D.length?(this._t=void 0,d(1)):E=="keys"?d(0,g):E=="values"?d(0,D[g]):d(0,[g,D[g]])},"values"),F.Arguments=F.Array,y("keys"),y("values"),y("entries")},{"./_add-to-unscopables":93,"./_iter-define":122,"./_iter-step":124,"./_iterators":125,"./_to-iobject":158}],170:[function(l,V,N){"use strict";var y=l("./_is-object"),d=l("./_object-gpo"),F=l("./_wks")("hasInstance"),M=Function.prototype;F in M||l("./_object-dp").f(M,F,{value:function(D){if(typeof this!="function"||!y(D))return!1;if(!y(this.prototype))return D instanceof this;for(;D=d(D);)if(this.prototype===D)return!0;return!1}})},{"./_is-object":119,"./_object-dp":132,"./_object-gpo":138,"./_wks":166}],171:[function(l,V,N){var y=l("./_export");y(y.S+y.F,"Object",{assign:l("./_object-assign")})},{"./_export":107,"./_object-assign":130}],172:[function(l,V,N){var y=l("./_export");y(y.S,"Object",{create:l("./_object-create")})},{"./_export":107,"./_object-create":131}],173:[function(l,V,N){var y=l("./_export");y(y.S+y.F*!l("./_descriptors"),"Object",{defineProperty:l("./_object-dp").f})},{"./_descriptors":103,"./_export":107,"./_object-dp":132}],174:[function(l,V,N){l("./_object-sap")("getOwnPropertyNames",function(){return l("./_object-gopn-ext").f})},{"./_object-gopn-ext":135,"./_object-sap":142}],175:[function(l,V,N){var y=l("./_to-object"),d=l("./_object-gpo");l("./_object-sap")("getPrototypeOf",function(){return function(M){return d(y(M))}})},{"./_object-gpo":138,"./_object-sap":142,"./_to-object":160}],176:[function(l,V,N){var y=l("./_to-object"),d=l("./_object-keys");l("./_object-sap")("keys",function(){return function(M){return d(y(M))}})},{"./_object-keys":140,"./_object-sap":142,"./_to-object":160}],177:[function(l,V,N){arguments[4][71][0].apply(N,arguments)},{dup:71}],178:[function(l,V,N){"use strict";var y=l("./_library"),d=l("./_global"),F=l("./_ctx"),M=l("./_classof"),D=l("./_export"),E=l("./_is-object"),g=l("./_a-function"),h=l("./_an-instance"),b=l("./_for-of"),p=l("./_species-constructor"),v=l("./_task").set,I=l("./_microtask")(),x=l("./_new-promise-capability"),S=l("./_perform"),W=l("./_user-agent"),B=l("./_promise-resolve"),Q="Promise",G=d.TypeError,$=d.process,J=$&&$.versions,U=J&&J.v8||"",j=d[Q],T=M($)=="process",ee=function(){},Z,_,X,re,me=_=x.f,de=!!function(){try{var ue=j.resolve(1),te=(ue.constructor={})[l("./_wks")("species")]=function(Se){Se(ee,ee)};return(T||typeof PromiseRejectionEvent=="function")&&ue.then(ee)instanceof te&&U.indexOf("6.6")!==0&&W.indexOf("Chrome/66")===-1}catch(Se){}}(),we=function(ue){var te;return E(ue)&&typeof(te=ue.then)=="function"?te:!1},ge=function(ue,te){if(ue._n)return;ue._n=!0;var Se=ue._c;I(function(){for(var De=ue._v,Fe=ue._s==1,Ke=0,et=function(Ie){var dt=Fe?Ie.ok:Ie.fail,Ye=Ie.resolve,Pe=Ie.reject,Le=Ie.domain,Ge,ot,be;try{dt?(Fe||(ue._h==2&&ie(ue),ue._h=1),dt===!0?Ge=De:(Le&&Le.enter(),Ge=dt(De),Le&&(Le.exit(),be=!0)),Ge===Ie.promise?Pe(G("Promise-chain cycle")):(ot=we(Ge))?ot.call(Ge,Ye,Pe):Ye(Ge)):Pe(De)}catch(ye){Le&&!be&&Le.exit(),Pe(ye)}};Se.length>Ke;)et(Se[Ke++]);ue._c=[],ue._n=!1,te&&!ue._h&&ke(ue)})},ke=function(ue){v.call(d,function(){var te=ue._v,Se=z(ue),De,Fe,Ke;if(Se&&(De=S(function(){T?$.emit("unhandledRejection",te,ue):(Fe=d.onunhandledrejection)?Fe({promise:ue,reason:te}):(Ke=d.console)&&Ke.error&&Ke.error("Unhandled promise rejection",te)}),ue._h=T||z(ue)?2:1),ue._a=void 0,Se&&De.e)throw De.v})},z=function(ue){return ue._h!==1&&(ue._a||ue._c).length===0},ie=function(ue){v.call(d,function(){var te;T?$.emit("rejectionHandled",ue):(te=d.onrejectionhandled)&&te({promise:ue,reason:ue._v})})},H=function(ue){var te=this;if(te._d)return;te._d=!0,te=te._w||te,te._v=ue,te._s=2,te._a||(te._a=te._c.slice()),ge(te,!0)},ae=function(ue){var te=this,Se;if(te._d)return;te._d=!0,te=te._w||te;try{if(te===ue)throw G("Promise can't be resolved itself");(Se=we(ue))?I(function(){var De={_w:te,_d:!1};try{Se.call(ue,F(ae,De,1),F(H,De,1))}catch(Fe){H.call(De,Fe)}}):(te._v=ue,te._s=1,ge(te,!1))}catch(De){H.call({_w:te,_d:!1},De)}};de||(j=function(te){h(this,j,Q,"_h"),g(te),Z.call(this);try{te(F(ae,this,1),F(H,this,1))}catch(Se){H.call(this,Se)}},Z=function(te){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},Z.prototype=l("./_redefine-all")(j.prototype,{then:function(te,Se){var De=me(p(this,j));return De.ok=typeof te=="function"?te:!0,De.fail=typeof Se=="function"&&Se,De.domain=T?$.domain:void 0,this._c.push(De),this._a&&this._a.push(De),this._s&&ge(this,!1),De.promise},catch:function(ue){return this.then(void 0,ue)}}),X=function(){var ue=new Z;this.promise=ue,this.resolve=F(ae,ue,1),this.reject=F(H,ue,1)},x.f=me=function(ue){return ue===j||ue===re?new X(ue):_(ue)}),D(D.G+D.W+D.F*!de,{Promise:j}),l("./_set-to-string-tag")(j,Q),l("./_set-species")(Q),re=l("./_core")[Q],D(D.S+D.F*!de,Q,{reject:function(te){var Se=me(this),De=Se.reject;return De(te),Se.promise}}),D(D.S+D.F*(y||!de),Q,{resolve:function(te){return B(y&&this===re?j:this,te)}}),D(D.S+D.F*!(de&&l("./_iter-detect")(function(ue){j.all(ue).catch(ee)})),Q,{all:function(te){var Se=this,De=me(Se),Fe=De.resolve,Ke=De.reject,et=S(function(){var Ie=[],dt=0,Ye=1;b(te,!1,function(Pe){var Le=dt++,Ge=!1;Ie.push(void 0),Ye++,Se.resolve(Pe).then(function(ot){if(Ge)return;Ge=!0,Ie[Le]=ot,--Ye||Fe(Ie)},Ke)}),--Ye||Fe(Ie)});return et.e&&Ke(et.v),De.promise},race:function(te){var Se=this,De=me(Se),Fe=De.reject,Ke=S(function(){b(te,!1,function(et){Se.resolve(et).then(De.resolve,Fe)})});return Ke.e&&Fe(Ke.v),De.promise}})},{"./_a-function":92,"./_an-instance":94,"./_classof":97,"./_core":99,"./_ctx":101,"./_export":107,"./_for-of":109,"./_global":110,"./_is-object":119,"./_iter-detect":123,"./_library":126,"./_microtask":128,"./_new-promise-capability":129,"./_perform":144,"./_promise-resolve":145,"./_redefine-all":147,"./_set-species":149,"./_set-to-string-tag":150,"./_species-constructor":153,"./_task":155,"./_user-agent":163,"./_wks":166}],179:[function(l,V,N){var y=l("./_export"),d=l("./_to-absolute-index"),F=String.fromCharCode,M=String.fromCodePoint;y(y.S+y.F*(!!M&&M.length!=1),"String",{fromCodePoint:function(E){for(var g=[],h=arguments.length,b=0,p;h>b;){if(p=+arguments[b++],d(p,1114111)!==p)throw RangeError(p+" is not a valid code point");g.push(p<65536?F(p):F(((p-=65536)>>10)+55296,p%1024+56320))}return g.join("")}})},{"./_export":107,"./_to-absolute-index":156}],180:[function(l,V,N){"use strict";var y=l("./_string-at")(!0);l("./_iter-define")(String,"String",function(d){this._t=String(d),this._i=0},function(){var d=this._t,F=this._i,M;return F>=d.length?{value:void 0,done:!0}:(M=y(d,F),this._i+=M.length,{value:M,done:!1})})},{"./_iter-define":122,"./_string-at":154}],181:[function(l,V,N){"use strict";var y=l("./_global"),d=l("./_has"),F=l("./_descriptors"),M=l("./_export"),D=l("./_redefine"),E=l("./_meta").KEY,g=l("./_fails"),h=l("./_shared"),b=l("./_set-to-string-tag"),p=l("./_uid"),v=l("./_wks"),I=l("./_wks-ext"),x=l("./_wks-define"),S=l("./_enum-keys"),W=l("./_is-array"),B=l("./_an-object"),Q=l("./_is-object"),G=l("./_to-object"),$=l("./_to-iobject"),J=l("./_to-primitive"),U=l("./_property-desc"),j=l("./_object-create"),T=l("./_object-gopn-ext"),ee=l("./_object-gopd"),Z=l("./_object-gops"),_=l("./_object-dp"),X=l("./_object-keys"),re=ee.f,me=_.f,de=T.f,we=y.Symbol,ge=y.JSON,ke=ge&&ge.stringify,z="prototype",ie=v("_hidden"),H=v("toPrimitive"),ae={}.propertyIsEnumerable,ue=h("symbol-registry"),te=h("symbols"),Se=h("op-symbols"),De=Object[z],Fe=typeof we=="function"&&!!Z.f,Ke=y.QObject,et=!Ke||!Ke[z]||!Ke[z].findChild,Ie=F&&g(function(){return j(me({},"a",{get:function(){return me(this,"a",{value:7}).a}})).a!=7})?function(pe,Ae,Qe){var nt=re(De,Ae);nt&&delete De[Ae],me(pe,Ae,Qe),nt&&pe!==De&&me(De,Ae,nt)}:me,dt=function(pe){var Ae=te[pe]=j(we[z]);return Ae._k=pe,Ae},Ye=Fe&&typeof we.iterator=="symbol"?function(pe){return typeof pe=="symbol"}:function(pe){return pe instanceof we},Pe=function(Ae,Qe,nt){return Ae===De&&Pe(Se,Qe,nt),B(Ae),Qe=J(Qe,!0),B(nt),d(te,Qe)?(nt.enumerable?(d(Ae,ie)&&Ae[ie][Qe]&&(Ae[ie][Qe]=!1),nt=j(nt,{enumerable:U(0,!1)})):(d(Ae,ie)||me(Ae,ie,U(1,{})),Ae[ie][Qe]=!0),Ie(Ae,Qe,nt)):me(Ae,Qe,nt)},Le=function(Ae,Qe){B(Ae);for(var nt=S(Qe=$(Qe)),st=0,yt=nt.length,ft;yt>st;)Pe(Ae,ft=nt[st++],Qe[ft]);return Ae},Ge=function(Ae,Qe){return Qe===void 0?j(Ae):Le(j(Ae),Qe)},ot=function(Ae){var Qe=ae.call(this,Ae=J(Ae,!0));return this===De&&d(te,Ae)&&!d(Se,Ae)?!1:Qe||!d(this,Ae)||!d(te,Ae)||d(this,ie)&&this[ie][Ae]?Qe:!0},be=function(Ae,Qe){if(Ae=$(Ae),Qe=J(Qe,!0),Ae===De&&d(te,Qe)&&!d(Se,Qe))return;var nt=re(Ae,Qe);return nt&&d(te,Qe)&&!(d(Ae,ie)&&Ae[ie][Qe])&&(nt.enumerable=!0),nt},ye=function(Ae){for(var Qe=de($(Ae)),nt=[],st=0,yt;Qe.length>st;)!d(te,yt=Qe[st++])&&yt!=ie&&yt!=E&&nt.push(yt);return nt},$e=function(Ae){for(var Qe=Ae===De,nt=de(Qe?Se:$(Ae)),st=[],yt=0,ft;nt.length>yt;)d(te,ft=nt[yt++])&&(Qe?d(De,ft):!0)&&st.push(te[ft]);return st};Fe||(we=function(){if(this instanceof we)throw TypeError("Symbol is not a constructor!");var Ae=p(arguments.length>0?arguments[0]:void 0),Qe=function(nt){this===De&&Qe.call(Se,nt),d(this,ie)&&d(this[ie],Ae)&&(this[ie][Ae]=!1),Ie(this,Ae,U(1,nt))};return F&&et&&Ie(De,Ae,{configurable:!0,set:Qe}),dt(Ae)},D(we[z],"toString",function(){return this._k}),ee.f=be,_.f=Pe,l("./_object-gopn").f=T.f=ye,l("./_object-pie").f=ot,Z.f=$e,F&&!l("./_library")&&D(De,"propertyIsEnumerable",ot,!0),I.f=function(pe){return dt(v(pe))}),M(M.G+M.W+M.F*!Fe,{Symbol:we});for(var q="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),m=0;q.length>m;)v(q[m++]);for(var c=X(v.store),R=0;c.length>R;)x(c[R++]);M(M.S+M.F*!Fe,"Symbol",{for:function(pe){return d(ue,pe+="")?ue[pe]:ue[pe]=we(pe)},keyFor:function(Ae){if(!Ye(Ae))throw TypeError(Ae+" is not a symbol!");for(var Qe in ue)if(ue[Qe]===Ae)return Qe},useSetter:function(){et=!0},useSimple:function(){et=!1}}),M(M.S+M.F*!Fe,"Object",{create:Ge,defineProperty:Pe,defineProperties:Le,getOwnPropertyDescriptor:be,getOwnPropertyNames:ye,getOwnPropertySymbols:$e});var fe=g(function(){Z.f(1)});M(M.S+M.F*fe,"Object",{getOwnPropertySymbols:function(Ae){return Z.f(G(Ae))}}),ge&&M(M.S+M.F*(!Fe||g(function(){var pe=we();return ke([pe])!="[null]"||ke({a:pe})!="{}"||ke(Object(pe))!="{}"})),"JSON",{stringify:function(Ae){for(var Qe=[Ae],nt=1,st,yt;arguments.length>nt;)Qe.push(arguments[nt++]);return yt=st=Qe[1],!Q(st)&&Ae===void 0||Ye(Ae)?void 0:(W(st)||(st=function(ft,_t){if(typeof yt=="function"&&(_t=yt.call(this,ft,_t)),!Ye(_t))return _t}),Qe[1]=st,ke.apply(ge,Qe))}}),we[z][H]||l("./_hide")(we[z],H,we[z].valueOf),b(we,"Symbol"),b(Math,"Math",!0),b(y.JSON,"JSON",!0)},{"./_an-object":95,"./_descriptors":103,"./_enum-keys":106,"./_export":107,"./_fails":108,"./_global":110,"./_has":111,"./_hide":112,"./_is-array":118,"./_is-object":119,"./_library":126,"./_meta":127,"./_object-create":131,"./_object-dp":132,"./_object-gopd":134,"./_object-gopn":136,"./_object-gopn-ext":135,"./_object-gops":137,"./_object-keys":140,"./_object-pie":141,"./_property-desc":146,"./_redefine":148,"./_set-to-string-tag":150,"./_shared":152,"./_to-iobject":158,"./_to-object":160,"./_to-primitive":161,"./_uid":162,"./_wks":166,"./_wks-define":164,"./_wks-ext":165}],182:[function(l,V,N){var y=l("./_export"),d=l("./_object-to-array")(!0);y(y.S,"Object",{entries:function(M){return d(M)}})},{"./_export":107,"./_object-to-array":143}],183:[function(l,V,N){"use strict";var y=l("./_export"),d=l("./_core"),F=l("./_global"),M=l("./_species-constructor"),D=l("./_promise-resolve");y(y.P+y.R,"Promise",{finally:function(E){var g=M(this,d.Promise||F.Promise),h=typeof E=="function";return this.then(h?function(b){return D(g,E()).then(function(){return b})}:E,h?function(b){return D(g,E()).then(function(){throw b})}:E)}})},{"./_core":99,"./_export":107,"./_global":110,"./_promise-resolve":145,"./_species-constructor":153}],184:[function(l,V,N){"use strict";var y=l("./_export"),d=l("./_new-promise-capability"),F=l("./_perform");y(y.S,"Promise",{try:function(M){var D=d.f(this),E=F(M);return(E.e?D.reject:D.resolve)(E.v),D.promise}})},{"./_export":107,"./_new-promise-capability":129,"./_perform":144}],185:[function(l,V,N){l("./_wks-define")("asyncIterator")},{"./_wks-define":164}],186:[function(l,V,N){l("./_wks-define")("observable")},{"./_wks-define":164}],187:[function(l,V,N){l("./es6.array.iterator");for(var y=l("./_global"),d=l("./_hide"),F=l("./_iterators"),M=l("./_wks")("toStringTag"),D="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),E=0;E<D.length;E++){var g=D[E],h=y[g],b=h&&h.prototype;b&&!b[M]&&d(b,M,g),F[g]=F.Array}},{"./_global":110,"./_hide":112,"./_iterators":125,"./_wks":166,"./es6.array.iterator":169}],188:[function(l,V,N){var y=l("./_export"),d=l("./_task");y(y.G+y.B,{setImmediate:d.set,clearImmediate:d.clear})},{"./_export":107,"./_task":155}],189:[function(l,V,N){(function(y){"use strict";var d=l("babel-runtime/helpers/typeof"),F=M(d);function M(J){return J&&J.__esModule?J:{default:J}}function D(J){return Array.isArray?Array.isArray(J):$(J)==="[object Array]"}N.isArray=D;function E(J){return typeof J=="boolean"}N.isBoolean=E;function g(J){return J===null}N.isNull=g;function h(J){return J==null}N.isNullOrUndefined=h;function b(J){return typeof J=="number"}N.isNumber=b;function p(J){return typeof J=="string"}N.isString=p;function v(J){return(typeof J=="undefined"?"undefined":(0,F.default)(J))==="symbol"}N.isSymbol=v;function I(J){return J===void 0}N.isUndefined=I;function x(J){return $(J)==="[object RegExp]"}N.isRegExp=x;function S(J){return(typeof J=="undefined"?"undefined":(0,F.default)(J))==="object"&&J!==null}N.isObject=S;function W(J){return $(J)==="[object Date]"}N.isDate=W;function B(J){return $(J)==="[object Error]"||J instanceof Error}N.isError=B;function Q(J){return typeof J=="function"}N.isFunction=Q;function G(J){return J===null||typeof J=="boolean"||typeof J=="number"||typeof J=="string"||(typeof J=="undefined"?"undefined":(0,F.default)(J))==="symbol"||typeof J=="undefined"}N.isPrimitive=G,N.isBuffer=y.isBuffer;function $(J){return Object.prototype.toString.call(J)}}).call(this,{isBuffer:l("../../is-buffer/index.js")})},{"../../is-buffer/index.js":197,"babel-runtime/helpers/typeof":67}],190:[function(l,V,N){"use strict";var y=l("babel-runtime/helpers/typeof"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(M){"use strict";var D=function(){var p=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|'[^']*'|'[^']*'/g,v=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,I=/[^-+\dA-Z]/g;return function(x,S,W,B){if(arguments.length===1&&b(x)==="string"&&!/\d/.test(x)&&(S=x,x=void 0),x=x||new Date,x instanceof Date||(x=new Date(x)),isNaN(x))throw TypeError("Invalid date");S=String(D.masks[S]||S||D.masks.default);var Q=S.slice(0,4);(Q==="UTC:"||Q==="GMT:")&&(S=S.slice(4),W=!0,Q==="GMT:"&&(B=!0));var G=W?"getUTC":"get",$=x[G+"Date"](),J=x[G+"Day"](),U=x[G+"Month"](),j=x[G+"FullYear"](),T=x[G+"Hours"](),ee=x[G+"Minutes"](),Z=x[G+"Seconds"](),_=x[G+"Milliseconds"](),X=W?0:x.getTimezoneOffset(),re=g(x),me=h(x),de={d:$,dd:E($),ddd:D.i18n.dayNames[J],dddd:D.i18n.dayNames[J+7],m:U+1,mm:E(U+1),mmm:D.i18n.monthNames[U],mmmm:D.i18n.monthNames[U+12],yy:String(j).slice(2),yyyy:j,h:T%12||12,hh:E(T%12||12),H:T,HH:E(T),M:ee,MM:E(ee),s:Z,ss:E(Z),l:E(_,3),L:E(Math.round(_/10)),t:T<12?"a":"p",tt:T<12?"am":"pm",T:T<12?"A":"P",TT:T<12?"AM":"PM",Z:B?"GMT":W?"UTC":(String(x).match(v)||[""]).pop().replace(I,""),o:(X>0?"-":"+")+E(Math.floor(Math.abs(X)/60)*100+Math.abs(X)%60,4),S:["th","st","nd","rd"][$%10>3?0:($%100-$%10!=10)*$%10],W:re,N:me};return S.replace(p,function(we){return we in de?de[we]:we.slice(1,we.length-1)})}}();D.masks={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},D.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};function E(p,v){for(p=String(p),v=v||2;p.length<v;)p="0"+p;return p}function g(p){var v=new Date(p.getFullYear(),p.getMonth(),p.getDate());v.setDate(v.getDate()-(v.getDay()+6)%7+3);var I=new Date(v.getFullYear(),0,4);I.setDate(I.getDate()-(I.getDay()+6)%7+3);var x=v.getTimezoneOffset()-I.getTimezoneOffset();v.setHours(v.getHours()-x);var S=(v-I)/(864e5*7);return 1+Math.floor(S)}function h(p){var v=p.getDay();return v===0&&(v=7),v}function b(p){return p===null?"null":p===void 0?"undefined":(typeof p=="undefined"?"undefined":(0,d.default)(p))!=="object"?typeof p=="undefined"?"undefined":(0,d.default)(p):Array.isArray(p)?"array":{}.toString.call(p).slice(8,-1).toLowerCase()}typeof define=="function"&&define.amd?define(function(){return D}):(typeof N=="undefined"?"undefined":(0,d.default)(N))==="object"?V.exports=D:M.dateFormat=D})(void 0)},{"babel-runtime/helpers/typeof":67}],191:[function(l,V,N){/*!
|
|
|
* escape-html
|
|
|
* Copyright(c) 2012-2013 TJ Holowaychuk
|
|
|
* Copyright(c) 2015 Andreas Lubbe
|
|
|
* Copyright(c) 2015 Tiancheng "Timothy" Gu
|
|
|
* MIT Licensed
|
|
|
*/"use strict";var y=/["'&<>]/;V.exports=d;function d(F){var M=""+F,D=y.exec(M);if(!D)return M;var E,g="",h=0,b=0;for(h=D.index;h<M.length;h++){switch(M.charCodeAt(h)){case 34:E=""";break;case 38:E="&";break;case 39:E="'";break;case 60:E="<";break;case 62:E=">";break;default:continue}b!==h&&(g+=M.substring(b,h)),b=h+1,g+=E}return b!==h?g+M.substring(b,h):g}},{}],192:[function(l,V,N){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(E){if(!F(E)||E<0||isNaN(E))throw TypeError("n must be a positive number");return this._maxListeners=E,this},y.prototype.emit=function(E){var g,h,b,p,v,I;if(this._events||(this._events={}),E==="error"&&(!this._events.error||M(this._events.error)&&!this._events.error.length)){if(g=arguments[1],g instanceof Error)throw g;var x=new Error('Uncaught, unspecified "error" event. ('+g+")");throw x.context=g,x}if(h=this._events[E],D(h))return!1;if(d(h))switch(arguments.length){case 1:h.call(this);break;case 2:h.call(this,arguments[1]);break;case 3:h.call(this,arguments[1],arguments[2]);break;default:p=Array.prototype.slice.call(arguments,1),h.apply(this,p)}else if(M(h))for(p=Array.prototype.slice.call(arguments,1),I=h.slice(),b=I.length,v=0;v<b;v++)I[v].apply(this,p);return!0},y.prototype.addListener=function(E,g){var h;if(!d(g))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",E,d(g.listener)?g.listener:g),this._events[E]?M(this._events[E])?this._events[E].push(g):this._events[E]=[this._events[E],g]:this._events[E]=g,M(this._events[E])&&!this._events[E].warned&&(D(this._maxListeners)?h=y.defaultMaxListeners:h=this._maxListeners,h&&h>0&&this._events[E].length>h&&(this._events[E].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[E].length),typeof console.trace=="function"&&console.trace())),this},y.prototype.on=y.prototype.addListener,y.prototype.once=function(E,g){if(!d(g))throw TypeError("listener must be a function");var h=!1;function b(){this.removeListener(E,b),h||(h=!0,g.apply(this,arguments))}return b.listener=g,this.on(E,b),this},y.prototype.removeListener=function(E,g){var h,b,p,v;if(!d(g))throw TypeError("listener must be a function");if(!this._events||!this._events[E])return this;if(h=this._events[E],p=h.length,b=-1,h===g||d(h.listener)&&h.listener===g)delete this._events[E],this._events.removeListener&&this.emit("removeListener",E,g);else if(M(h)){for(v=p;v-- >0;)if(h[v]===g||h[v].listener&&h[v].listener===g){b=v;break}if(b<0)return this;h.length===1?(h.length=0,delete this._events[E]):h.splice(b,1),this._events.removeListener&&this.emit("removeListener",E,g)}return this},y.prototype.removeAllListeners=function(E){var g,h;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[E]&&delete this._events[E],this;if(arguments.length===0){for(g in this._events){if(g==="removeListener")continue;this.removeAllListeners(g)}return this.removeAllListeners("removeListener"),this._events={},this}if(h=this._events[E],d(h))this.removeListener(E,h);else if(h)for(;h.length;)this.removeListener(E,h[h.length-1]);return delete this._events[E],this},y.prototype.listeners=function(E){var g;return!this._events||!this._events[E]?g=[]:d(this._events[E])?g=[this._events[E]]:g=this._events[E].slice(),g},y.prototype.listenerCount=function(E){if(this._events){var g=this._events[E];if(d(g))return 1;if(g)return g.length}return 0},y.listenerCount=function(E,g){return E.listenerCount(g)};function d(E){return typeof E=="function"}function F(E){return typeof E=="number"}function M(E){return typeof E=="object"&&E!==null}function D(E){return E===void 0}},{}],193:[function(l,V,N){var y=l("http"),d=V.exports;for(var F in y)y.hasOwnProperty(F)&&(d[F]=y[F]);d.request=function(M,D){return M||(M={}),M.scheme="https",M.protocol="https:",y.request.call(this,M,D)}},{http:231}],194:[function(l,V,N){/*!
|
|
|
* humanize-ms - index.js
|
|
|
* Copyright(c) 2014 dead_horse <dead_horse@qq.com>
|
|
|
* MIT Licensed
|
|
|
*/"use strict";var y=l("util"),d=l("ms");V.exports=function(F){if(typeof F=="number")return F;var M=d(F);if(M===void 0){var D=new Error(y.format("humanize-ms(%j) result undefined",F));console.warn(D.stack)}return M}},{ms:204,util:243}],195:[function(l,V,N){N.read=function(y,d,F,M,D){var E,g,h=D*8-M-1,b=(1<<h)-1,p=b>>1,v=-7,I=F?D-1:0,x=F?-1:1,S=y[d+I];for(I+=x,E=S&(1<<-v)-1,S>>=-v,v+=h;v>0;E=E*256+y[d+I],I+=x,v-=8);for(g=E&(1<<-v)-1,E>>=-v,v+=M;v>0;g=g*256+y[d+I],I+=x,v-=8);if(E===0)E=1-p;else{if(E===b)return g?NaN:(S?-1:1)*Infinity;g=g+Math.pow(2,M),E=E-p}return(S?-1:1)*g*Math.pow(2,E-M)},N.write=function(y,d,F,M,D,E){var g,h,b,p=E*8-D-1,v=(1<<p)-1,I=v>>1,x=D===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=M?0:E-1,W=M?1:-1,B=d<0||d===0&&1/d<0?1:0;for(d=Math.abs(d),isNaN(d)||d===Infinity?(h=isNaN(d)?1:0,g=v):(g=Math.floor(Math.log(d)/Math.LN2),d*(b=Math.pow(2,-g))<1&&(g--,b*=2),g+I>=1?d+=x/b:d+=x*Math.pow(2,1-I),d*b>=2&&(g++,b/=2),g+I>=v?(h=0,g=v):g+I>=1?(h=(d*b-1)*Math.pow(2,D),g=g+I):(h=d*Math.pow(2,I-1)*Math.pow(2,D),g=0));D>=8;y[F+S]=h&255,S+=W,h/=256,D-=8);for(g=g<<D|h,p+=D;p>0;y[F+S]=g&255,S+=W,g/=256,p-=8);y[F+S-W]|=B*128}},{}],196:[function(l,V,N){typeof Object.create=="function"?V.exports=function(d,F){F&&(d.super_=F,d.prototype=Object.create(F.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}}))}:V.exports=function(d,F){if(F){d.super_=F;var M=function(){};M.prototype=F.prototype,d.prototype=new M,d.prototype.constructor=d}}},{}],197:[function(l,V,N){/*!
|
|
|
* Determine if an object is a Buffer
|
|
|
*
|
|
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
|
* @license MIT
|
|
|
*/V.exports=function(F){return F!=null&&(y(F)||d(F)||!!F._isBuffer)};function y(F){return!!F.constructor&&typeof F.constructor.isBuffer=="function"&&F.constructor.isBuffer(F)}function d(F){return typeof F.readFloatLE=="function"&&typeof F.slice=="function"&&y(F.slice(0,0))}},{}],198:[function(l,V,N){var y={}.toString;V.exports=Array.isArray||function(d){return y.call(d)=="[object Array]"}},{}],199:[function(require,module,exports){(function(global){(function(l,V){typeof exports=="object"&&typeof module!="undefined"?module.exports=V(l):typeof define=="function"&&define.amd?define(V):V(l)})(typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:this,function(global){"use strict";global=global||{};var _Base64=global.Base64,version="2.5.2",buffer;if(typeof module!="undefined"&&module.exports)try{buffer=eval("require('buffer').Buffer")}catch(l){buffer=void 0}var b64chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b64tab=function(l){for(var V={},N=0,y=l.length;N<y;N++)V[l.charAt(N)]=N;return V}(b64chars),fromCharCode=String.fromCharCode,cb_utob=function(l){if(l.length<2){var V=l.charCodeAt(0);return V<128?l: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+(l.charCodeAt(0)-55296)*1024+(l.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(l){return l.replace(re_utob,cb_utob)},cb_encode=function(l){var V=[0,2,1][l.length%3],N=l.charCodeAt(0)<<16|(l.length>1?l.charCodeAt(1):0)<<8|(l.length>2?l.charCodeAt(2):0),y=[b64chars.charAt(N>>>18),b64chars.charAt(N>>>12&63),V>=2?"=":b64chars.charAt(N>>>6&63),V>=1?"=":b64chars.charAt(N&63)];return y.join("")},btoa=global.btoa?function(l){return global.btoa(l)}:function(l){return l.replace(/[\s\S]{1,3}/g,cb_encode)},_encode=function(l){var V=Object.prototype.toString.call(l)==="[object Uint8Array]";return V?l.toString("base64"):btoa(utob(String(l)))},encode=function(l,V){return V?_encode(String(l)).replace(/[+\/]/g,function(N){return N=="+"?"-":"_"}).replace(/=/g,""):_encode(l)},encodeURI=function(l){return encode(l,!0)},re_btou=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,cb_btou=function(l){switch(l.length){case 4:var V=(7&l.charCodeAt(0))<<18|(63&l.charCodeAt(1))<<12|(63&l.charCodeAt(2))<<6|63&l.charCodeAt(3),N=V-65536;return fromCharCode((N>>>10)+55296)+fromCharCode((N&1023)+56320);case 3:return fromCharCode((15&l.charCodeAt(0))<<12|(63&l.charCodeAt(1))<<6|63&l.charCodeAt(2));default:return fromCharCode((31&l.charCodeAt(0))<<6|63&l.charCodeAt(1))}},btou=function(l){return l.replace(re_btou,cb_btou)},cb_decode=function(l){var V=l.length,N=V%4,y=(V>0?b64tab[l.charAt(0)]<<18:0)|(V>1?b64tab[l.charAt(1)]<<12:0)|(V>2?b64tab[l.charAt(2)]<<6:0)|(V>3?b64tab[l.charAt(3)]:0),d=[fromCharCode(y>>>16),fromCharCode(y>>>8&255),fromCharCode(y&255)];return d.length-=[0,0,2,1][N],d.join("")},_atob=global.atob?function(l){return global.atob(l)}:function(l){return l.replace(/\S{1,4}/g,cb_decode)},atob=function(l){return _atob(String(l).replace(/[^A-Za-z0-9\+\/]/g,""))},_decode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(l){return(l.constructor===buffer.constructor?l:buffer.from(l,"base64")).toString()}:function(l){return(l.constructor===buffer.constructor?l:new buffer(l,"base64")).toString()}:function(l){return btou(_atob(l))},decode=function(l){return _decode(String(l).replace(/[-_]/g,function(V){return V=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))},noConflict=function(){var l=global.Base64;return global.Base64=_Base64,l};if(global.Base64={VERSION:version,atob,btoa,fromBase64:decode,toBase64:encode,utob,encode,encodeURI,btou,decode,noConflict,__buffer__:buffer},typeof Object.defineProperty=="function"){var noEnum=function(l){return{value:l,enumerable:!1,writable:!0,configurable:!0}};global.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",noEnum(function(){return decode(this)})),Object.defineProperty(String.prototype,"toBase64",noEnum(function(l){return encode(this,l)})),Object.defineProperty(String.prototype,"toBase64URI",noEnum(function(){return encode(this,!0)}))}}return global.Meteor&&(Base64=global.Base64),typeof module!="undefined"&&module.exports?module.exports.Base64=global.Base64:typeof define=="function"&&define.amd&&define([],function(){return global.Base64}),{Base64:global.Base64}})}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],200:[function(l,V,N){/*!
|
|
|
* merge-descriptors
|
|
|
* Copyright(c) 2014 Jonathan Ong
|
|
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
|
* MIT Licensed
|
|
|
*/"use strict";V.exports=d;var y=Object.prototype.hasOwnProperty;function d(F,M,D){if(!F)throw new TypeError("argument dest is required");if(!M)throw new TypeError("argument src is required");return D===void 0&&(D=!0),Object.getOwnPropertyNames(M).forEach(function(g){if(!D&&y.call(F,g))return;var h=Object.getOwnPropertyDescriptor(M,g);Object.defineProperty(F,g,h)}),F}},{}],201:[function(l,V,N){"use strict";function y(){this._types=Object.create(null),this._extensions=Object.create(null);for(var d=0;d<arguments.length;d++)this.define(arguments[d]);this.define=this.define.bind(this),this.getType=this.getType.bind(this),this.getExtension=this.getExtension.bind(this)}y.prototype.define=function(d,F){for(var M in d){var D=d[M].map(function(h){return h.toLowerCase()});M=M.toLowerCase();for(var E=0;E<D.length;E++){var g=D[E];if(g[0]=="*")continue;if(!F&&g in this._types)throw new Error('Attempt to change mapping for "'+g+'" extension from "'+this._types[g]+'" to "'+M+'". Pass `force=true` to allow this, otherwise remove "'+g+'" from the list of extensions for "'+M+'".');this._types[g]=M}if(F||!this._extensions[M]){var g=D[0];this._extensions[M]=g[0]!="*"?g:g.substr(1)}}},y.prototype.getType=function(d){d=String(d);var F=d.replace(/^.*[/\\]/,"").toLowerCase(),M=F.replace(/^.*\./,"").toLowerCase(),D=F.length<d.length,E=M.length<F.length-1;return(E||!D)&&this._types[M]||null},y.prototype.getExtension=function(d){return d=/^\s*([^;\s]*)/.test(d)&&RegExp.$1,d&&this._extensions[d.toLowerCase()]||null},V.exports=y},{}],202:[function(l,V,N){"use strict";var y=l("./Mime");V.exports=new y(l("./types/standard"))},{"./Mime":201,"./types/standard":203}],203:[function(l,V,N){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(l,V,N){var y=1e3,d=y*60,F=d*60,M=F*24,D=M*7,E=M*365.25;V.exports=function(v,I){I=I||{};var x=typeof v;if(x==="string"&&v.length>0)return g(v);if(x==="number"&&isFinite(v))return I.long?b(v):h(v);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(v))};function g(v){if(v=String(v),v.length>100)return;var I=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(v);if(!I)return;var x=parseFloat(I[1]),S=(I[2]||"ms").toLowerCase();switch(S){case"years":case"year":case"yrs":case"yr":case"y":return x*E;case"weeks":case"week":case"w":return x*D;case"days":case"day":case"d":return x*M;case"hours":case"hour":case"hrs":case"hr":case"h":return x*F;case"minutes":case"minute":case"mins":case"min":case"m":return x*d;case"seconds":case"second":case"secs":case"sec":case"s":return x*y;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return x;default:return}}function h(v){var I=Math.abs(v);return I>=M?Math.round(v/M)+"d":I>=F?Math.round(v/F)+"h":I>=d?Math.round(v/d)+"m":I>=y?Math.round(v/y)+"s":v+"ms"}function b(v){var I=Math.abs(v);return I>=M?p(v,I,M,"day"):I>=F?p(v,I,F,"hour"):I>=d?p(v,I,d,"minute"):I>=y?p(v,I,y,"second"):v+" ms"}function p(v,I,x,S){var W=I>=x*1.5;return Math.round(v/x)+" "+S+(W?"s":"")}},{}],205:[function(l,V,N){(function(y){function d(E,g){for(var h=0,b=E.length-1;b>=0;b--){var p=E[b];p==="."?E.splice(b,1):p===".."?(E.splice(b,1),h++):h&&(E.splice(b,1),h--)}if(g)for(;h--;h)E.unshift("..");return E}N.resolve=function(){for(var E="",g=!1,h=arguments.length-1;h>=-1&&!g;h--){var b=h>=0?arguments[h]:y.cwd();if(typeof b!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!b)continue;E=b+"/"+E,g=b.charAt(0)==="/"}return E=d(M(E.split("/"),function(p){return!!p}),!g).join("/"),(g?"/":"")+E||"."},N.normalize=function(E){var g=N.isAbsolute(E),h=D(E,-1)==="/";return E=d(M(E.split("/"),function(b){return!!b}),!g).join("/"),!E&&!g&&(E="."),E&&h&&(E+="/"),(g?"/":"")+E},N.isAbsolute=function(E){return E.charAt(0)==="/"},N.join=function(){var E=Array.prototype.slice.call(arguments,0);return N.normalize(M(E,function(g,h){if(typeof g!="string")throw new TypeError("Arguments to path.join must be strings");return g}).join("/"))},N.relative=function(E,g){E=N.resolve(E).substr(1),g=N.resolve(g).substr(1);function h(W){for(var B=0;B<W.length&&!(W[B]!=="");B++);for(var Q=W.length-1;Q>=0&&!(W[Q]!=="");Q--);return B>Q?[]:W.slice(B,Q-B+1)}for(var b=h(E.split("/")),p=h(g.split("/")),v=Math.min(b.length,p.length),I=v,x=0;x<v;x++)if(b[x]!==p[x]){I=x;break}for(var S=[],x=I;x<b.length;x++)S.push("..");return S=S.concat(p.slice(I)),S.join("/")},N.sep="/",N.delimiter=":",N.dirname=function(E){if(typeof E!="string"&&(E=E+""),E.length===0)return".";for(var g=E.charCodeAt(0),h=g===47,b=-1,p=!0,v=E.length-1;v>=1;--v)if(g=E.charCodeAt(v),g===47){if(!p){b=v;break}}else p=!1;return b===-1?h?"/":".":h&&b===1?"/":E.slice(0,b)};function F(E){typeof E!="string"&&(E=E+"");var g=0,h=-1,b=!0,p;for(p=E.length-1;p>=0;--p)if(E.charCodeAt(p)===47){if(!b){g=p+1;break}}else h===-1&&(b=!1,h=p+1);return h===-1?"":E.slice(g,h)}N.basename=function(E,g){var h=F(E);return g&&h.substr(-1*g.length)===g&&(h=h.substr(0,h.length-g.length)),h},N.extname=function(E){typeof E!="string"&&(E=E+"");for(var g=-1,h=0,b=-1,p=!0,v=0,I=E.length-1;I>=0;--I){var x=E.charCodeAt(I);if(x===47){if(!p){h=I+1;break}continue}b===-1&&(p=!1,b=I+1),x===46?g===-1?g=I:v!==1&&(v=1):g!==-1&&(v=-1)}return g===-1||b===-1||v===0||v===1&&g===b-1&&g===h+1?"":E.slice(g,b)};function M(E,g){if(E.filter)return E.filter(g);for(var h=[],b=0;b<E.length;b++)g(E[b],b,E)&&h.push(E[b]);return h}var D="ab".substr(-1)==="b"?function(E,g,h){return E.substr(g,h)}:function(E,g,h){return g<0&&(g=E.length+g),E.substr(g,h)}}).call(this,l("_process"))},{_process:208}],206:[function(l,V,N){(function(y){/*!
|
|
|
* Platform.js <https://mths.be/platform>
|
|
|
* Copyright 2014-2018 Benjamin Tan <https://bnjmnt4n.now.sh/>
|
|
|
* Copyright 2011-2013 John-David Dalton <http://allyoucanleet.com/>
|
|
|
* Available under MIT license <https://mths.be/mit>
|
|
|
*/(function(){"use strict";var d={function:!0,object:!0},F=d[typeof window]&&window||this,M=F,D=d[typeof N]&&N,E=d[typeof V]&&V&&!V.nodeType&&V,g=D&&E&&typeof y=="object"&&y;g&&(g.global===g||g.window===g||g.self===g)&&(F=g);var h=Math.pow(2,53)-1,b=/\bOpera/,p=this,v=Object.prototype,I=v.hasOwnProperty,x=v.toString;function S(_){return _=String(_),_.charAt(0).toUpperCase()+_.slice(1)}function W(_,X,re){var me={"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&&re&&/^Win/i.test(_)&&!/^Windows Phone /i.test(_)&&(me=me[/[\d.]+$/.exec(_)])&&(_="Windows "+me),_=String(_),X&&re&&(_=_.replace(RegExp(X,"i"),re)),_=Q(_.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/," $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0]),_}function B(_,X){var re=-1,me=_?_.length:0;if(typeof me=="number"&&me>-1&&me<=h)for(;++re<me;)X(_[re],re,_);else G(_,X)}function Q(_){return _=T(_),/^(?:webOS|i(?:OS|P))/.test(_)?_:S(_)}function G(_,X){for(var re in _)I.call(_,re)&&X(_[re],re,_)}function $(_){return _==null?S(_):x.call(_).slice(8,-1)}function J(_,X){var re=_!=null?typeof _[X]:"number";return!/^(?:boolean|number|string|undefined)$/.test(re)&&(re=="object"?!!_[X]:!0)}function U(_){return String(_).replace(/([ -])(?!$)/g,"$1?")}function j(_,X){var re=null;return B(_,function(me,de){re=X(re,me,de,_)}),re}function T(_){return String(_).replace(/^ +| +$/g,"")}function ee(_){var X=F,re=_&&typeof _=="object"&&$(_)!="String";re&&(X=_,_=null);var me=X.navigator||{},de=me.userAgent||"";_||(_=de);var we=re||p==M,ge=re?!!me.likeChrome:/\bChrome\b/.test(_)&&!/internal|\n/i.test(x.toString()),ke="Object",z=re?ke:"ScriptBridgingProxyObject",ie=re?ke:"Environment",H=re&&X.java?"JavaPackage":$(X.java),ae=re?ke:"RuntimeObject",ue=/\bJava/.test(H)&&X.java,te=ue&&$(X.environment)==ie,Se=ue?"a":"\u03B1",De=ue?"b":"\u03B2",Fe=X.document||{},Ke=X.operamini||X.opera,et=b.test(et=re&&Ke?Ke["[[Class]]"]:$(Ke))?et:Ke=null,Ie,dt=_,Ye=[],Pe=null,Le=_==de,Ge=Le&&Ke&&typeof Ke.version=="function"&&Ke.version(),ot,be=c([{label:"EdgeHTML",pattern:"Edge"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"]),ye=fe(["Adobe AIR","Arora","Avant Browser","Breach","Camino","Electron","Epiphany","Fennec","Flock","Galeon","GreenBrowser","iCab","Iceweasel","K-Meleon","Konqueror","Lunascape","Maxthon",{label:"Microsoft Edge",pattern:"Edge"},"Midori","Nook Browser","PaleMoon","PhantomJS","Raven","Rekonq","RockMelt",{label:"Samsung Internet",pattern:"SamsungBrowser"},"SeaMonkey",{label:"Silk",pattern:"(?:Cloud9|Silk-Accelerated)"},"Sleipnir","SlimBrowser",{label:"SRWare Iron",pattern:"Iron"},"Sunrise","Swiftfox","Waterfox","WebPositive","Opera Mini",{label:"Opera Mini",pattern:"OPiOS"},"Opera",{label:"Opera",pattern:"OPR"},"Chrome",{label:"Chrome Mobile",pattern:"(?:CriOS|CrMo)"},{label:"Firefox",pattern:"(?:Firefox|Minefield)"},{label:"Firefox for iOS",pattern:"FxiOS"},{label:"IE",pattern:"IEMobile"},{label:"IE",pattern:"MSIE"},"Safari"]),$e=Ae([{label:"BlackBerry",pattern:"BB10"},"BlackBerry",{label:"Galaxy S",pattern:"GT-I9000"},{label:"Galaxy S2",pattern:"GT-I9100"},{label:"Galaxy S3",pattern:"GT-I9300"},{label:"Galaxy S4",pattern:"GT-I9500"},{label:"Galaxy S5",pattern:"SM-G900"},{label:"Galaxy S6",pattern:"SM-G920"},{label:"Galaxy S6 Edge",pattern:"SM-G925"},{label:"Galaxy S7",pattern:"SM-G930"},{label:"Galaxy S7 Edge",pattern:"SM-G935"},"Google TV","Lumia","iPad","iPod","iPhone","Kindle",{label:"Kindle Fire",pattern:"(?:Cloud9|Silk-Accelerated)"},"Nexus","Nook","PlayBook","PlayStation Vita","PlayStation","TouchPad","Transformer",{label:"Wii U",pattern:"WiiU"},"Wii","Xbox One",{label:"Xbox 360",pattern:"Xbox"},"Xoom"]),q=R({Apple:{iPad:1,iPhone:1,iPod:1},Archos:{},Amazon:{Kindle:1,"Kindle Fire":1},Asus:{Transformer:1},"Barnes & Noble":{Nook:1},BlackBerry:{PlayBook:1},Google:{"Google TV":1,Nexus:1},HP:{TouchPad:1},HTC:{},LG:{},Microsoft:{Xbox:1,"Xbox One":1},Motorola:{Xoom:1},Nintendo:{"Wii U":1,Wii:1},Nokia:{Lumia:1},Samsung:{"Galaxy S":1,"Galaxy S2":1,"Galaxy S3":1,"Galaxy S4":1},Sony:{PlayStation:1,"PlayStation Vita":1}}),m=pe(["Windows Phone","Android","CentOS",{label:"Chrome OS",pattern:"CrOS"},"Debian","Fedora","FreeBSD","Gentoo","Haiku","Kubuntu","Linux Mint","OpenBSD","Red Hat","SuSE","Ubuntu","Xubuntu","Cygwin","Symbian OS","hpwOS","webOS ","webOS","Tablet OS","Tizen","Linux","Mac OS X","Macintosh","Mac","Windows 98;","Windows "]);function c(yt){return j(yt,function(ft,_t){return ft||RegExp("\\b"+(_t.pattern||U(_t))+"\\b","i").exec(_)&&(_t.label||_t)})}function R(yt){return j(yt,function(ft,_t,Dt){return ft||(_t[$e]||_t[/^[a-z]+(?: +[a-z]+\b)*/i.exec($e)]||RegExp("\\b"+U(Dt)+"(?:\\b|\\w*\\d)","i").exec(_))&&Dt})}function fe(yt){return j(yt,function(ft,_t){return ft||RegExp("\\b"+(_t.pattern||U(_t))+"\\b","i").exec(_)&&(_t.label||_t)})}function pe(yt){return j(yt,function(ft,_t){var Dt=_t.pattern||U(_t);return!ft&&(ft=RegExp("\\b"+Dt+"(?:/[\\d.]+|[ \\w.]*)","i").exec(_))&&(ft=W(ft,Dt,_t.label||_t)),ft})}function Ae(yt){return j(yt,function(ft,_t){var Dt=_t.pattern||U(_t);return!ft&&(ft=RegExp("\\b"+Dt+" *\\d+[.\\w_]*","i").exec(_)||RegExp("\\b"+Dt+" *\\w+-[\\w]*","i").exec(_)||RegExp("\\b"+Dt+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(_))&&((ft=String(_t.label&&!RegExp(Dt,"i").test(_t.label)?_t.label:ft).split("/"))[1]&&!/[\d.]+/.test(ft[0])&&(ft[0]+=" "+ft[1]),_t=_t.label||_t,ft=Q(ft[0].replace(RegExp(Dt,"i"),_t).replace(RegExp("; *(?:"+_t+"[_-])?","i")," ").replace(RegExp("("+_t+")[-_.]?(\\w)","i"),"$1 $2"))),ft})}function Qe(yt){return j(yt,function(ft,_t){return ft||(RegExp(_t+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(_)||0)[1]||null})}function nt(){return this.description||""}if(be&&(be=[be]),q&&!$e&&($e=Ae([q])),(Ie=/\bGoogle TV\b/.exec($e))&&($e=Ie[0]),/\bSimulator\b/i.test(_)&&($e=($e?$e+" ":"")+"Simulator"),ye=="Opera Mini"&&/\bOPiOS\b/.test(_)&&Ye.push("running in Turbo/Uncompressed mode"),ye=="IE"&&/\blike iPhone OS\b/.test(_)?(Ie=ee(_.replace(/like iPhone OS/,"")),q=Ie.manufacturer,$e=Ie.product):/^iP/.test($e)?(ye||(ye="Safari"),m="iOS"+((Ie=/ OS ([\d_]+)/i.exec(_))?" "+Ie[1].replace(/_/g,"."):"")):ye=="Konqueror"&&!/buntu/i.test(m)?m="Kubuntu":q&&q!="Google"&&(/Chrome/.test(ye)&&!/\bMobile Safari\b/i.test(_)||/\bVita\b/.test($e))||/\bAndroid\b/.test(m)&&/^Chrome/.test(ye)&&/\bVersion\//i.test(_)?(ye="Android Browser",m=/\bAndroid\b/.test(m)?m:"Android"):ye=="Silk"?(/\bMobi/i.test(_)||(m="Android",Ye.unshift("desktop mode")),/Accelerated *= *true/i.test(_)&&Ye.unshift("accelerated")):ye=="PaleMoon"&&(Ie=/\bFirefox\/([\d.]+)\b/.exec(_))?Ye.push("identifying as Firefox "+Ie[1]):ye=="Firefox"&&(Ie=/\b(Mobile|Tablet|TV)\b/i.exec(_))?(m||(m="Firefox OS"),$e||($e=Ie[1])):!ye||(Ie=!/\bMinefield\b/i.test(_)&&/\b(?:Firefox|Safari)\b/.exec(ye))?(ye&&!$e&&/[\/,]|^[^(]+?\)/.test(_.slice(_.indexOf(Ie+"/")+8))&&(ye=null),(Ie=$e||q||m)&&($e||q||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(m))&&(ye=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(m)?m:Ie)+" Browser")):ye=="Electron"&&(Ie=(/\bChrome\/([\d.]+)\b/.exec(_)||0)[1])&&Ye.push("Chromium "+Ie),Ge||(Ge=Qe(["(?:Cloud9|CriOS|CrMo|Edge|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$))","Version",U(ye),"(?:Firefox|Minefield|NetFront)"])),(Ie=be=="iCab"&&parseFloat(Ge)>3&&"WebKit"||/\bOpera\b/.test(ye)&&(/\bOPR\b/.test(_)?"Blink":"Presto")||/\b(?:Midori|Nook|Safari)\b/i.test(_)&&!/^(?:Trident|EdgeHTML)$/.test(be)&&"WebKit"||!be&&/\bMSIE\b/i.test(_)&&(m=="Mac OS"?"Tasman":"Trident")||be=="WebKit"&&/\bPlayStation\b(?! Vita\b)/i.test(ye)&&"NetFront")&&(be=[Ie]),ye=="IE"&&(Ie=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(_)||0)[1])?(ye+=" Mobile",m="Windows Phone "+(/\+$/.test(Ie)?Ie:Ie+".x"),Ye.unshift("desktop mode")):/\bWPDesktop\b/i.test(_)?(ye="IE Mobile",m="Windows Phone 8.x",Ye.unshift("desktop mode"),Ge||(Ge=(/\brv:([\d.]+)/.exec(_)||0)[1])):ye!="IE"&&be=="Trident"&&(Ie=/\brv:([\d.]+)/.exec(_))&&(ye&&Ye.push("identifying as "+ye+(Ge?" "+Ge:"")),ye="IE",Ge=Ie[1]),Le){if(J(X,"global"))if(ue&&(Ie=ue.lang.System,dt=Ie.getProperty("os.arch"),m=m||Ie.getProperty("os.name")+" "+Ie.getProperty("os.version")),te){try{Ge=X.require("ringo/engine").version.join("."),ye="RingoJS"}catch(yt){(Ie=X.system)&&Ie.global.system==X.system&&(ye="Narwhal",m||(m=Ie[0].os||null))}ye||(ye="Rhino")}else typeof X.process=="object"&&!X.process.browser&&(Ie=X.process)&&(typeof Ie.versions=="object"&&(typeof Ie.versions.electron=="string"?(Ye.push("Node "+Ie.versions.node),ye="Electron",Ge=Ie.versions.electron):typeof Ie.versions.nw=="string"&&(Ye.push("Chromium "+Ge,"Node "+Ie.versions.node),ye="NW.js",Ge=Ie.versions.nw)),ye||(ye="Node.js",dt=Ie.arch,m=Ie.platform,Ge=/[\d.]+/.exec(Ie.version),Ge=Ge?Ge[0]:null));else $(Ie=X.runtime)==z?(ye="Adobe AIR",m=Ie.flash.system.Capabilities.os):$(Ie=X.phantom)==ae?(ye="PhantomJS",Ge=(Ie=Ie.version||null)&&Ie.major+"."+Ie.minor+"."+Ie.patch):typeof Fe.documentMode=="number"&&(Ie=/\bTrident\/(\d+)/i.exec(_))?(Ge=[Ge,Fe.documentMode],(Ie=+Ie[1]+4)!=Ge[1]&&(Ye.push("IE "+Ge[1]+" mode"),be&&(be[1]=""),Ge[1]=Ie),Ge=ye=="IE"?String(Ge[1].toFixed(1)):Ge[0]):typeof Fe.documentMode=="number"&&/^(?:Chrome|Firefox)\b/.test(ye)&&(Ye.push("masking as "+ye+" "+Ge),ye="IE",Ge="11.0",be=["Trident"],m="Windows");m=m&&Q(m)}if(Ge&&(Ie=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(Ge)||/(?:alpha|beta)(?: ?\d)?/i.exec(_+";"+(Le&&me.appMinorVersion))||/\bMinefield\b/i.test(_)&&"a")&&(Pe=/b/i.test(Ie)?"beta":"alpha",Ge=Ge.replace(RegExp(Ie+"\\+?$"),"")+(Pe=="beta"?De:Se)+(/\d+\+?/.exec(Ie)||"")),ye=="Fennec"||ye=="Firefox"&&/\b(?:Android|Firefox OS)\b/.test(m))ye="Firefox Mobile";else if(ye=="Maxthon"&&Ge)Ge=Ge.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test($e))$e=="Xbox 360"&&(m=null),$e=="Xbox 360"&&/\bIEMobile\b/.test(_)&&Ye.unshift("mobile mode");else if((/^(?:Chrome|IE|Opera)$/.test(ye)||ye&&!$e&&!/Browser|Mobi/.test(ye))&&(m=="Windows CE"||/Mobi/i.test(_)))ye+=" Mobile";else if(ye=="IE"&&Le)try{X.external===null&&Ye.unshift("platform preview")}catch(yt){Ye.unshift("embedded")}else(/\bBlackBerry\b/.test($e)||/\bBB10\b/.test(_))&&(Ie=(RegExp($e.replace(/ +/g," *")+"/([.\\d]+)","i").exec(_)||0)[1]||Ge)?(Ie=[Ie,/BB10/.test(_)],m=(Ie[1]?($e=null,q="BlackBerry"):"Device Software")+" "+Ie[0],Ge=null):this!=G&&$e!="Wii"&&(Le&&Ke||/Opera/.test(ye)&&/\b(?:MSIE|Firefox)\b/i.test(_)||ye=="Firefox"&&/\bOS X (?:\d+\.){2,}/.test(m)||ye=="IE"&&(m&&!/^Win/.test(m)&&Ge>5.5||/\bWindows XP\b/.test(m)&&Ge>8||Ge==8&&!/\bTrident\b/.test(_)))&&!b.test(Ie=ee.call(G,_.replace(b,"")+";"))&&Ie.name&&(Ie="ing as "+Ie.name+((Ie=Ie.version)?" "+Ie:""),b.test(ye)?(/\bIE\b/.test(Ie)&&m=="Mac OS"&&(m=null),Ie="identify"+Ie):(Ie="mask"+Ie,et?ye=Q(et.replace(/([a-z])([A-Z])/g,"$1 $2")):ye="Opera",/\bIE\b/.test(Ie)&&(m=null),Le||(Ge=null)),be=["Presto"],Ye.push(Ie));(Ie=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(_)||0)[1])&&(Ie=[parseFloat(Ie.replace(/\.(\d)$/,".0$1")),Ie],ye=="Safari"&&Ie[1].slice(-1)=="+"?(ye="WebKit Nightly",Pe="alpha",Ge=Ie[1].slice(0,-1)):(Ge==Ie[1]||Ge==(Ie[2]=(/\bSafari\/([\d.]+\+?)/i.exec(_)||0)[1]))&&(Ge=null),Ie[1]=(/\bChrome\/([\d.]+)/i.exec(_)||0)[1],Ie[0]==537.36&&Ie[2]==537.36&&parseFloat(Ie[1])>=28&&be=="WebKit"&&(be=["Blink"]),!Le||!ge&&!Ie[1]?(be&&(be[1]="like Safari"),Ie=(Ie=Ie[0],Ie<400?1:Ie<500?2:Ie<526?3:Ie<533?4:Ie<534?"4+":Ie<535?5:Ie<537?6:Ie<538?7:Ie<601?8:"8")):(be&&(be[1]="like Chrome"),Ie=Ie[1]||(Ie=Ie[0],Ie<530?1:Ie<532?2:Ie<532.05?3:Ie<533?4:Ie<534.03?5:Ie<534.07?6:Ie<534.1?7:Ie<534.13?8:Ie<534.16?9:Ie<534.24?10:Ie<534.3?11:Ie<535.01?12:Ie<535.02?"13+":Ie<535.07?15:Ie<535.11?16:Ie<535.19?17:Ie<536.05?18:Ie<536.1?19:Ie<537.01?20:Ie<537.11?"21+":Ie<537.13?23:Ie<537.18?24:Ie<537.24?25:Ie<537.36?26:be!="Blink"?"27":"28")),be&&(be[1]+=" "+(Ie+=typeof Ie=="number"?".x":/[.+]/.test(Ie)?"":"+")),ye=="Safari"&&(!Ge||parseInt(Ge)>45)&&(Ge=Ie)),ye=="Opera"&&(Ie=/\bzbov|zvav$/.exec(m))?(ye+=" ",Ye.unshift("desktop mode"),Ie=="zvav"?(ye+="Mini",Ge=null):ye+="Mobile",m=m.replace(RegExp(" *"+Ie+"$"),"")):ye=="Safari"&&/\bChrome\b/.exec(be&&be[1])&&(Ye.unshift("desktop mode"),ye="Chrome Mobile",Ge=null,/\bOS X\b/.test(m)?(q="Apple",m="iOS 4.3+"):m=null),Ge&&Ge.indexOf(Ie=/[\d.]+$/.exec(m))==0&&_.indexOf("/"+Ie+"-")>-1&&(m=T(m.replace(Ie,""))),be&&!/\b(?:Avant|Nook)\b/.test(ye)&&(/Browser|Lunascape|Maxthon/.test(ye)||ye!="Safari"&&/^iOS/.test(m)&&/\bSafari\b/.test(be[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|Web)/.test(ye)&&be[1])&&((Ie=be[be.length-1])&&Ye.push(Ie)),Ye.length&&(Ye=["("+Ye.join("; ")+")"]),q&&$e&&$e.indexOf(q)<0&&Ye.push("on "+q),$e&&Ye.push((/^on /.test(Ye[Ye.length-1])?"":"on ")+$e),m&&(Ie=/ ([\d.+]+)$/.exec(m),ot=Ie&&m.charAt(m.length-Ie[0].length-1)=="/",m={architecture:32,family:Ie&&!ot?m.replace(Ie[0],""):m,version:Ie?Ie[1]:null,toString:function(){var yt=this.version;return this.family+(yt&&!ot?" "+yt:"")+(this.architecture==64?" 64-bit":"")}}),(Ie=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(dt))&&!/\bi686\b/i.test(dt)?(m&&(m.architecture=64,m.family=m.family.replace(RegExp(" *"+Ie),"")),ye&&(/\bWOW64\b/i.test(_)||Le&&/\w(?:86|32)$/.test(me.cpuClass||me.platform)&&!/\bWin64; x64\b/i.test(_))&&Ye.unshift("32-bit")):m&&/^OS X/.test(m.family)&&ye=="Chrome"&&parseFloat(Ge)>=39&&(m.architecture=64),_||(_=null);var st={};return st.description=_,st.layout=be&&be[0],st.manufacturer=q,st.name=ye,st.prerelease=Pe,st.product=$e,st.ua=_,st.version=ye&&Ge,st.os=m||{architecture:null,family:null,version:null,toString:function(){return"null"}},st.parse=ee,st.toString=nt,st.version&&Ye.unshift(Ge),st.name&&Ye.unshift(ye),m&&ye&&!(m==String(m).split(" ")[0]&&(m==ye.split(" ")[0]||$e))&&Ye.push($e?"("+m+")":"on "+m),Ye.length&&(st.description=Ye.join(" ")),st}var Z=ee();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(F.platform=Z,define(function(){return Z})):D&&E?G(Z,function(_,X){D[X]=_}):F.platform=Z}).call(this)}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],207:[function(l,V,N){(function(y){"use strict";typeof y=="undefined"||!y.version||y.version.indexOf("v0.")===0||y.version.indexOf("v1.")===0&&y.version.indexOf("v1.8.")!==0?V.exports={nextTick:d}:V.exports=y;function d(F,M,D,E){if(typeof F!="function")throw new TypeError('"callback" argument must be a function');var g=arguments.length,h,b;switch(g){case 0:case 1:return y.nextTick(F);case 2:return y.nextTick(function(){F.call(null,M)});case 3:return y.nextTick(function(){F.call(null,M,D)});case 4:return y.nextTick(function(){F.call(null,M,D,E)});default:for(h=new Array(g-1),b=0;b<h.length;)h[b++]=arguments[b];return y.nextTick(function(){F.apply(null,h)})}}}).call(this,l("_process"))},{_process:208}],208:[function(l,V,N){var y=V.exports={},d,F;function M(){throw new Error("setTimeout has not been defined")}function D(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?d=setTimeout:d=M}catch(B){d=M}try{typeof clearTimeout=="function"?F=clearTimeout:F=D}catch(B){F=D}})();function E(B){if(d===setTimeout)return setTimeout(B,0);if((d===M||!d)&&setTimeout)return d=setTimeout,setTimeout(B,0);try{return d(B,0)}catch(Q){try{return d.call(null,B,0)}catch(G){return d.call(this,B,0)}}}function g(B){if(F===clearTimeout)return clearTimeout(B);if((F===D||!F)&&clearTimeout)return F=clearTimeout,clearTimeout(B);try{return F(B)}catch(Q){try{return F.call(null,B)}catch(G){return F.call(this,B)}}}var h=[],b=!1,p,v=-1;function I(){if(!b||!p)return;b=!1,p.length?h=p.concat(h):v=-1,h.length&&x()}function x(){if(b)return;var B=E(I);b=!0;for(var Q=h.length;Q;){for(p=h,h=[];++v<Q;)p&&p[v].run();v=-1,Q=h.length}p=null,b=!1,g(B)}y.nextTick=function(B){var Q=new Array(arguments.length-1);if(arguments.length>1)for(var G=1;G<arguments.length;G++)Q[G-1]=arguments[G];h.push(new S(B,Q)),h.length===1&&!b&&E(x)};function S(B,Q){this.fun=B,this.array=Q}S.prototype.run=function(){this.fun.apply(null,this.array)},y.title="browser",y.browser=!0,y.env={},y.argv=[],y.version="",y.versions={};function W(){}y.on=W,y.addListener=W,y.once=W,y.off=W,y.removeListener=W,y.removeAllListeners=W,y.emit=W,y.prependListener=W,y.prependOnceListener=W,y.listeners=function(B){return[]},y.binding=function(B){throw new Error("process.binding is not supported")},y.cwd=function(){return"/"},y.chdir=function(B){throw new Error("process.chdir is not supported")},y.umask=function(){return 0}},{}],209:[function(l,V,N){(function(y){/*! https://mths.be/punycode v1.4.1 by @mathias */(function(d){var F=typeof N=="object"&&N&&!N.nodeType&&N,M=typeof V=="object"&&V&&!V.nodeType&&V,D=typeof y=="object"&&y;(D.global===D||D.window===D||D.self===D)&&(d=D);var E,g=2147483647,h=36,b=1,p=26,v=38,I=700,x=72,S=128,W="-",B=/^xn--/,Q=/[^\x20-\x7E]/,G=/[\x2E\u3002\uFF0E\uFF61]/g,$={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},J=h-b,U=Math.floor,j=String.fromCharCode,T;function ee(H){throw new RangeError($[H])}function Z(H,ae){for(var ue=H.length,te=[];ue--;)te[ue]=ae(H[ue]);return te}function _(H,ae){var ue=H.split("@"),te="";ue.length>1&&(te=ue[0]+"@",H=ue[1]),H=H.replace(G,".");var Se=H.split("."),De=Z(Se,ae).join(".");return te+De}function X(H){for(var ae=[],ue=0,te=H.length,Se,De;ue<te;)Se=H.charCodeAt(ue++),Se>=55296&&Se<=56319&&ue<te?(De=H.charCodeAt(ue++),(De&64512)==56320?ae.push(((Se&1023)<<10)+(De&1023)+65536):(ae.push(Se),ue--)):ae.push(Se);return ae}function re(H){return Z(H,function(ae){var ue="";return ae>65535&&(ae-=65536,ue+=j(ae>>>10&1023|55296),ae=56320|ae&1023),ue+=j(ae),ue}).join("")}function me(H){return H-48<10?H-22:H-65<26?H-65:H-97<26?H-97:h}function de(H,ae){return H+22+75*(H<26)-((ae!=0)<<5)}function we(H,ae,ue){var te=0;for(H=ue?U(H/I):H>>1,H+=U(H/ae);H>J*p>>1;te+=h)H=U(H/J);return U(te+(J+1)*H/(H+v))}function ge(H){var ae=[],ue=H.length,te,Se=0,De=S,Fe=x,Ke,et,Ie,dt,Ye,Pe,Le,Ge,ot;for(Ke=H.lastIndexOf(W),Ke<0&&(Ke=0),et=0;et<Ke;++et)H.charCodeAt(et)>=128&&ee("not-basic"),ae.push(H.charCodeAt(et));for(Ie=Ke>0?Ke+1:0;Ie<ue;){for(dt=Se,Ye=1,Pe=h;!(Ie>=ue&&ee("invalid-input"),Le=me(H.charCodeAt(Ie++)),(Le>=h||Le>U((g-Se)/Ye))&&ee("overflow"),Se+=Le*Ye,Ge=Pe<=Fe?b:Pe>=Fe+p?p:Pe-Fe,Le<Ge);Pe+=h)ot=h-Ge,Ye>U(g/ot)&&ee("overflow"),Ye*=ot;te=ae.length+1,Fe=we(Se-dt,te,dt==0),U(Se/te)>g-De&&ee("overflow"),De+=U(Se/te),Se%=te,ae.splice(Se++,0,De)}return re(ae)}function ke(H){var ae,ue,te,Se,De,Fe,Ke,et,Ie,dt,Ye,Pe=[],Le,Ge,ot,be;for(H=X(H),Le=H.length,ae=S,ue=0,De=x,Fe=0;Fe<Le;++Fe)Ye=H[Fe],Ye<128&&Pe.push(j(Ye));for(te=Se=Pe.length,Se&&Pe.push(W);te<Le;){for(Ke=g,Fe=0;Fe<Le;++Fe)Ye=H[Fe],Ye>=ae&&Ye<Ke&&(Ke=Ye);for(Ge=te+1,Ke-ae>U((g-ue)/Ge)&&ee("overflow"),ue+=(Ke-ae)*Ge,ae=Ke,Fe=0;Fe<Le;++Fe)if(Ye=H[Fe],Ye<ae&&++ue>g&&ee("overflow"),Ye==ae){for(et=ue,Ie=h;!(dt=Ie<=De?b:Ie>=De+p?p:Ie-De,et<dt);Ie+=h)be=et-dt,ot=h-dt,Pe.push(j(de(dt+be%ot,0))),et=U(be/ot);Pe.push(j(de(et,0))),De=we(ue,Ge,te==Se),ue=0,++te}++ue,++ae}return Pe.join("")}function z(H){return _(H,function(ae){return B.test(ae)?ge(ae.slice(4).toLowerCase()):ae})}function ie(H){return _(H,function(ae){return Q.test(ae)?"xn--"+ke(ae):ae})}if(E={version:"1.4.1",ucs2:{decode:X,encode:re},decode:ge,encode:ke,toASCII:ie,toUnicode:z},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return E});else if(F&&M)if(V.exports==F)M.exports=E;else for(T in E)E.hasOwnProperty(T)&&(F[T]=E[T]);else d.punycode=E})(this)}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],210:[function(l,V,N){"use strict";function y(F,M){return Object.prototype.hasOwnProperty.call(F,M)}V.exports=function(F,M,D,E){M=M||"&",D=D||"=";var g={};if(typeof F!="string"||F.length===0)return g;var h=/\+/g;F=F.split(M);var b=1e3;E&&typeof E.maxKeys=="number"&&(b=E.maxKeys);var p=F.length;b>0&&p>b&&(p=b);for(var v=0;v<p;++v){var I=F[v].replace(h,"%20"),x=I.indexOf(D),S,W,B,Q;x>=0?(S=I.substr(0,x),W=I.substr(x+1)):(S=I,W=""),B=decodeURIComponent(S),Q=decodeURIComponent(W),y(g,B)?d(g[B])?g[B].push(Q):g[B]=[g[B],Q]:g[B]=Q}return g};var d=Array.isArray||function(F){return Object.prototype.toString.call(F)==="[object Array]"}},{}],211:[function(l,V,N){"use strict";var y=function(D){switch(typeof D){case"string":return D;case"boolean":return D?"true":"false";case"number":return isFinite(D)?D:"";default:return""}};V.exports=function(D,E,g,h){return E=E||"&",g=g||"=",D===null&&(D=void 0),typeof D=="object"?F(M(D),function(b){var p=encodeURIComponent(y(b))+g;return d(D[b])?F(D[b],function(v){return p+encodeURIComponent(y(v))}).join(E):p+encodeURIComponent(y(D[b]))}).join(E):h?encodeURIComponent(y(h))+g+encodeURIComponent(y(D)):""};var d=Array.isArray||function(D){return Object.prototype.toString.call(D)==="[object Array]"};function F(D,E){if(D.map)return D.map(E);for(var g=[],h=0;h<D.length;h++)g.push(E(D[h],h));return g}var M=Object.keys||function(D){var E=[];for(var g in D)Object.prototype.hasOwnProperty.call(D,g)&&E.push(g);return E}},{}],212:[function(l,V,N){"use strict";N.decode=N.parse=l("./decode"),N.encode=N.stringify=l("./encode")},{"./decode":210,"./encode":211}],213:[function(l,V,N){V.exports=l("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":214}],214:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=D(y),F=l("babel-runtime/core-js/object/keys"),M=D(F);function D(Q){return Q&&Q.__esModule?Q:{default:Q}}var E=l("process-nextick-args"),g=M.default||function(Q){var G=[];for(var $ in Q)G.push($);return G};V.exports=S;var h=(0,d.default)(l("core-util-is"));h.inherits=l("inherits");var b=l("./_stream_readable"),p=l("./_stream_writable");h.inherits(S,b);for(var v=g(p.prototype),I=0;I<v.length;I++){var x=v[I];S.prototype[x]||(S.prototype[x]=p.prototype[x])}function S(Q){if(!(this instanceof S))return new S(Q);b.call(this,Q),p.call(this,Q),Q&&Q.readable===!1&&(this.readable=!1),Q&&Q.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,Q&&Q.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",W)}Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function W(){if(this.allowHalfOpen||this._writableState.ended)return;E.nextTick(B,this)}function B(Q){Q.end()}Object.defineProperty(S.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(G){if(this._readableState===void 0||this._writableState===void 0)return;this._readableState.destroyed=G,this._writableState.destroyed=G}}),S.prototype._destroy=function(Q,G){this.push(null),this.end(),E.nextTick(G,Q)}},{"./_stream_readable":216,"./_stream_writable":218,"babel-runtime/core-js/object/create":55,"babel-runtime/core-js/object/keys":60,"core-util-is":189,inherits:196,"process-nextick-args":207}],215:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(g){return g&&g.__esModule?g:{default:g}}V.exports=E;var M=l("./_stream_transform"),D=(0,d.default)(l("core-util-is"));D.inherits=l("inherits"),D.inherits(E,M);function E(g){if(!(this instanceof E))return new E(g);M.call(this,g)}E.prototype._transform=function(g,h,b){b(null,g)}},{"./_stream_transform":217,"babel-runtime/core-js/object/create":55,"core-util-is":189,inherits:196}],216:[function(l,V,N){(function(y,d){"use strict";var F=l("babel-runtime/core-js/object/get-prototype-of"),M=g(F),D=l("babel-runtime/core-js/object/create"),E=g(D);function g(be){return be&&be.__esModule?be:{default:be}}var h=l("process-nextick-args");V.exports=X;var b=l("isarray"),p;X.ReadableState=_;var v=l("events").EventEmitter,I=function(ye,$e){return ye.listeners($e).length},x=l("./internal/streams/stream"),S=l("safe-buffer").Buffer,W=d.Uint8Array||function(){};function B(be){return S.from(be)}function Q(be){return S.isBuffer(be)||be instanceof W}var G=(0,E.default)(l("core-util-is"));G.inherits=l("inherits");var $=l("util"),J=void 0;$&&$.debuglog?J=$.debuglog("stream"):J=function(){};var U=l("./internal/streams/BufferList"),j=l("./internal/streams/destroy"),T;G.inherits(X,x);var ee=["error","close","destroy","pause","resume"];function Z(be,ye,$e){if(typeof be.prependListener=="function")return be.prependListener(ye,$e);!be._events||!be._events[ye]?be.on(ye,$e):b(be._events[ye])?be._events[ye].unshift($e):be._events[ye]=[$e,be._events[ye]]}function _(be,ye){p=p||l("./_stream_duplex"),be=be||{};var $e=ye instanceof p;this.objectMode=!!be.objectMode,$e&&(this.objectMode=this.objectMode||!!be.readableObjectMode);var q=be.highWaterMark,m=be.readableHighWaterMark,c=this.objectMode?16:16*1024;q||q===0?this.highWaterMark=q:$e&&(m||m===0)?this.highWaterMark=m:this.highWaterMark=c,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new U,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=be.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,be.encoding&&(T||(T=l("string_decoder/").StringDecoder),this.decoder=new T(be.encoding),this.encoding=be.encoding)}function X(be){if(p=p||l("./_stream_duplex"),!(this instanceof X))return new X(be);this._readableState=new _(be,this),this.readable=!0,be&&(typeof be.read=="function"&&(this._read=be.read),typeof be.destroy=="function"&&(this._destroy=be.destroy)),x.call(this)}Object.defineProperty(X.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(ye){if(!this._readableState)return;this._readableState.destroyed=ye}}),X.prototype.destroy=j.destroy,X.prototype._undestroy=j.undestroy,X.prototype._destroy=function(be,ye){this.push(null),ye(be)},X.prototype.push=function(be,ye){var $e=this._readableState,q;return $e.objectMode?q=!0:typeof be=="string"&&(ye=ye||$e.defaultEncoding,ye!==$e.encoding&&(be=S.from(be,ye),ye=""),q=!0),re(this,be,ye,!1,q)},X.prototype.unshift=function(be){return re(this,be,null,!0,!1)};function re(be,ye,$e,q,m){var c=be._readableState;if(ye===null)c.reading=!1,ie(be,c);else{var R;m||(R=de(c,ye)),R?be.emit("error",R):c.objectMode||ye&&ye.length>0?(typeof ye!="string"&&!c.objectMode&&(0,M.default)(ye)!==S.prototype&&(ye=B(ye)),q?c.endEmitted?be.emit("error",new Error("stream.unshift() after end event")):me(be,c,ye,!0):c.ended?be.emit("error",new Error("stream.push() after EOF")):(c.reading=!1,c.decoder&&!$e?(ye=c.decoder.write(ye),c.objectMode||ye.length!==0?me(be,c,ye,!1):ue(be,c)):me(be,c,ye,!1))):q||(c.reading=!1)}return we(c)}function me(be,ye,$e,q){ye.flowing&&ye.length===0&&!ye.sync?(be.emit("data",$e),be.read(0)):(ye.length+=ye.objectMode?1:$e.length,q?ye.buffer.unshift($e):ye.buffer.push($e),ye.needReadable&&H(be)),ue(be,ye)}function de(be,ye){var $e;return!Q(ye)&&typeof ye!="string"&&ye!==void 0&&!be.objectMode&&($e=new TypeError("Invalid non-string/buffer chunk")),$e}function we(be){return!be.ended&&(be.needReadable||be.length<be.highWaterMark||be.length===0)}X.prototype.isPaused=function(){return this._readableState.flowing===!1},X.prototype.setEncoding=function(be){return T||(T=l("string_decoder/").StringDecoder),this._readableState.decoder=new T(be),this._readableState.encoding=be,this};var ge=8388608;function ke(be){return be>=ge?be=ge:(be--,be|=be>>>1,be|=be>>>2,be|=be>>>4,be|=be>>>8,be|=be>>>16,be++),be}function z(be,ye){return be<=0||ye.length===0&&ye.ended?0:ye.objectMode?1:be!==be?ye.flowing&&ye.length?ye.buffer.head.data.length:ye.length:(be>ye.highWaterMark&&(ye.highWaterMark=ke(be)),be<=ye.length?be:ye.ended?ye.length:(ye.needReadable=!0,0))}X.prototype.read=function(be){J("read",be),be=parseInt(be,10);var ye=this._readableState,$e=be;if(be!==0&&(ye.emittedReadable=!1),be===0&&ye.needReadable&&(ye.length>=ye.highWaterMark||ye.ended))return J("read: emitReadable",ye.length,ye.ended),ye.length===0&&ye.ended?Le(this):H(this),null;if(be=z(be,ye),be===0&&ye.ended)return ye.length===0&&Le(this),null;var q=ye.needReadable;J("need readable",q),(ye.length===0||ye.length-be<ye.highWaterMark)&&(q=!0,J("length less than watermark",q)),ye.ended||ye.reading?(q=!1,J("reading or ended",q)):q&&(J("do read"),ye.reading=!0,ye.sync=!0,ye.length===0&&(ye.needReadable=!0),this._read(ye.highWaterMark),ye.sync=!1,ye.reading||(be=z($e,ye)));var m;return be>0?m=Ie(be,ye):m=null,m===null?(ye.needReadable=!0,be=0):ye.length-=be,ye.length===0&&(ye.ended||(ye.needReadable=!0),$e!==be&&ye.ended&&Le(this)),m!==null&&this.emit("data",m),m};function ie(be,ye){if(ye.ended)return;if(ye.decoder){var $e=ye.decoder.end();$e&&$e.length&&(ye.buffer.push($e),ye.length+=ye.objectMode?1:$e.length)}ye.ended=!0,H(be)}function H(be){var ye=be._readableState;ye.needReadable=!1,ye.emittedReadable||(J("emitReadable",ye.flowing),ye.emittedReadable=!0,ye.sync?h.nextTick(ae,be):ae(be))}function ae(be){J("emit readable"),be.emit("readable"),et(be)}function ue(be,ye){ye.readingMore||(ye.readingMore=!0,h.nextTick(te,be,ye))}function te(be,ye){for(var $e=ye.length;!ye.reading&&!ye.flowing&&!ye.ended&&ye.length<ye.highWaterMark&&!(J("maybeReadMore read 0"),be.read(0),$e===ye.length);)$e=ye.length;ye.readingMore=!1}X.prototype._read=function(be){this.emit("error",new Error("_read() is not implemented"))},X.prototype.pipe=function(be,ye){var $e=this,q=this._readableState;switch(q.pipesCount){case 0:q.pipes=be;break;case 1:q.pipes=[q.pipes,be];break;default:q.pipes.push(be);break}q.pipesCount+=1,J("pipe count=%d opts=%j",q.pipesCount,ye);var m=(!ye||ye.end!==!1)&&be!==y.stdout&&be!==y.stderr,c=m?fe:Dt;q.endEmitted?h.nextTick(c):$e.once("end",c),be.on("unpipe",R);function R(at,jt){J("onunpipe"),at===$e&&(jt&&jt.hasUnpiped===!1&&(jt.hasUnpiped=!0,Qe()))}function fe(){J("onend"),be.end()}var pe=Se($e);be.on("drain",pe);var Ae=!1;function Qe(){J("cleanup"),be.removeListener("close",ft),be.removeListener("finish",_t),be.removeListener("drain",pe),be.removeListener("error",yt),be.removeListener("unpipe",R),$e.removeListener("end",fe),$e.removeListener("end",Dt),$e.removeListener("data",st),Ae=!0,q.awaitDrain&&(!be._writableState||be._writableState.needDrain)&&pe()}var nt=!1;$e.on("data",st);function st(at){J("ondata"),nt=!1;var jt=be.write(at);jt===!1&&!nt&&((q.pipesCount===1&&q.pipes===be||q.pipesCount>1&&ot(q.pipes,be)!==-1)&&!Ae&&(J("false write response, pause",$e._readableState.awaitDrain),$e._readableState.awaitDrain++,nt=!0),$e.pause())}function yt(at){J("onerror",at),Dt(),be.removeListener("error",yt),I(be,"error")===0&&be.emit("error",at)}Z(be,"error",yt);function ft(){be.removeListener("finish",_t),Dt()}be.once("close",ft);function _t(){J("onfinish"),be.removeListener("close",ft),Dt()}be.once("finish",_t);function Dt(){J("unpipe"),$e.unpipe(be)}return be.emit("pipe",$e),q.flowing||(J("pipe resume"),$e.resume()),be};function Se(be){return function(){var ye=be._readableState;J("pipeOnDrain",ye.awaitDrain),ye.awaitDrain&&ye.awaitDrain--,ye.awaitDrain===0&&I(be,"data")&&(ye.flowing=!0,et(be))}}X.prototype.unpipe=function(be){var ye=this._readableState,$e={hasUnpiped:!1};if(ye.pipesCount===0)return this;if(ye.pipesCount===1)return be&&be!==ye.pipes?this:(be||(be=ye.pipes),ye.pipes=null,ye.pipesCount=0,ye.flowing=!1,be&&be.emit("unpipe",this,$e),this);if(!be){var q=ye.pipes,m=ye.pipesCount;ye.pipes=null,ye.pipesCount=0,ye.flowing=!1;for(var c=0;c<m;c++)q[c].emit("unpipe",this,$e);return this}var R=ot(ye.pipes,be);return R===-1?this:(ye.pipes.splice(R,1),ye.pipesCount-=1,ye.pipesCount===1&&(ye.pipes=ye.pipes[0]),be.emit("unpipe",this,$e),this)},X.prototype.on=function(be,ye){var $e=x.prototype.on.call(this,be,ye);if(be==="data")this._readableState.flowing!==!1&&this.resume();else if(be==="readable"){var q=this._readableState;!q.endEmitted&&!q.readableListening&&(q.readableListening=q.needReadable=!0,q.emittedReadable=!1,q.reading?q.length&&H(this):h.nextTick(De,this))}return $e},X.prototype.addListener=X.prototype.on;function De(be){J("readable nexttick read 0"),be.read(0)}X.prototype.resume=function(){var be=this._readableState;return be.flowing||(J("resume"),be.flowing=!0,Fe(this,be)),this};function Fe(be,ye){ye.resumeScheduled||(ye.resumeScheduled=!0,h.nextTick(Ke,be,ye))}function Ke(be,ye){ye.reading||(J("resume read 0"),be.read(0)),ye.resumeScheduled=!1,ye.awaitDrain=0,be.emit("resume"),et(be),ye.flowing&&!ye.reading&&be.read(0)}X.prototype.pause=function(){return J("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(J("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function et(be){var ye=be._readableState;for(J("flow",ye.flowing);ye.flowing&&be.read()!==null;);}X.prototype.wrap=function(be){var ye=this,$e=this._readableState,q=!1;be.on("end",function(){if(J("wrapped end"),$e.decoder&&!$e.ended){var R=$e.decoder.end();R&&R.length&&ye.push(R)}ye.push(null)}),be.on("data",function(R){if(J("wrapped data"),$e.decoder&&(R=$e.decoder.write(R)),$e.objectMode&&R==null)return;if(!$e.objectMode&&(!R||!R.length))return;var fe=ye.push(R);fe||(q=!0,be.pause())});for(var m in be)this[m]===void 0&&typeof be[m]=="function"&&(this[m]=function(R){return function(){return be[R].apply(be,arguments)}}(m));for(var c=0;c<ee.length;c++)be.on(ee[c],this.emit.bind(this,ee[c]));return this._read=function(R){J("wrapped _read",R),q&&(q=!1,be.resume())},this},Object.defineProperty(X.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),X._fromList=Ie;function Ie(be,ye){if(ye.length===0)return null;var $e;return ye.objectMode?$e=ye.buffer.shift():!be||be>=ye.length?(ye.decoder?$e=ye.buffer.join(""):ye.buffer.length===1?$e=ye.buffer.head.data:$e=ye.buffer.concat(ye.length),ye.buffer.clear()):$e=dt(be,ye.buffer,ye.decoder),$e}function dt(be,ye,$e){var q;return be<ye.head.data.length?(q=ye.head.data.slice(0,be),ye.head.data=ye.head.data.slice(be)):be===ye.head.data.length?q=ye.shift():q=$e?Ye(be,ye):Pe(be,ye),q}function Ye(be,ye){var $e=ye.head,q=1,m=$e.data;for(be-=m.length;$e=$e.next;){var c=$e.data,R=be>c.length?c.length:be;if(R===c.length?m+=c:m+=c.slice(0,be),be-=R,be===0){R===c.length?(++q,$e.next?ye.head=$e.next:ye.head=ye.tail=null):(ye.head=$e,$e.data=c.slice(R));break}++q}return ye.length-=q,m}function Pe(be,ye){var $e=S.allocUnsafe(be),q=ye.head,m=1;for(q.data.copy($e),be-=q.data.length;q=q.next;){var c=q.data,R=be>c.length?c.length:be;if(c.copy($e,$e.length-be,0,R),be-=R,be===0){R===c.length?(++m,q.next?ye.head=q.next:ye.head=ye.tail=null):(ye.head=q,q.data=c.slice(R));break}++m}return ye.length-=m,$e}function Le(be){var ye=be._readableState;if(ye.length>0)throw new Error('"endReadable()" called on non-empty stream');ye.endEmitted||(ye.ended=!0,h.nextTick(Ge,ye,be))}function Ge(be,ye){!be.endEmitted&&be.length===0&&(be.endEmitted=!0,ye.readable=!1,ye.emit("end"))}function ot(be,ye){for(var $e=0,q=be.length;$e<q;$e++)if(be[$e]===ye)return $e;return-1}}).call(this,l("_process"),typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./_stream_duplex":214,"./internal/streams/BufferList":219,"./internal/streams/destroy":220,"./internal/streams/stream":221,_process:208,"babel-runtime/core-js/object/create":55,"babel-runtime/core-js/object/get-prototype-of":59,"core-util-is":189,events:192,inherits:196,isarray:198,"process-nextick-args":207,"safe-buffer":228,"string_decoder/":235,util:71}],217:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(p){return p&&p.__esModule?p:{default:p}}V.exports=g;var M=l("./_stream_duplex"),D=(0,d.default)(l("core-util-is"));D.inherits=l("inherits"),D.inherits(g,M);function E(p,v){var I=this._transformState;I.transforming=!1;var x=I.writecb;if(!x)return this.emit("error",new Error("write callback called multiple times"));I.writechunk=null,I.writecb=null,v!=null&&this.push(v),x(p);var S=this._readableState;S.reading=!1,(S.needReadable||S.length<S.highWaterMark)&&this._read(S.highWaterMark)}function g(p){if(!(this instanceof g))return new g(p);M.call(this,p),this._transformState={afterTransform:E.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,p&&(typeof p.transform=="function"&&(this._transform=p.transform),typeof p.flush=="function"&&(this._flush=p.flush)),this.on("prefinish",h)}function h(){var p=this;typeof this._flush=="function"?this._flush(function(v,I){b(p,v,I)}):b(this,null,null)}g.prototype.push=function(p,v){return this._transformState.needTransform=!1,M.prototype.push.call(this,p,v)},g.prototype._transform=function(p,v,I){throw new Error("_transform() is not implemented")},g.prototype._write=function(p,v,I){var x=this._transformState;if(x.writecb=I,x.writechunk=p,x.writeencoding=v,!x.transforming){var S=this._readableState;(x.needTransform||S.needReadable||S.length<S.highWaterMark)&&this._read(S.highWaterMark)}},g.prototype._read=function(p){var v=this._transformState;v.writechunk!==null&&v.writecb&&!v.transforming?(v.transforming=!0,this._transform(v.writechunk,v.writeencoding,v.afterTransform)):v.needTransform=!0},g.prototype._destroy=function(p,v){var I=this;M.prototype._destroy.call(this,p,function(x){v(x),I.emit("close")})};function b(p,v,I){if(v)return p.emit("error",v);if(I!=null&&p.push(I),p._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(p._transformState.transforming)throw new Error("Calling transform done when still transforming");return p.push(null)}},{"./_stream_duplex":214,"babel-runtime/core-js/object/create":55,"core-util-is":189,inherits:196}],218:[function(l,V,N){(function(y,d){"use strict";var F=l("babel-runtime/core-js/object/define-property"),M=x(F),D=l("babel-runtime/core-js/symbol/has-instance"),E=x(D),g=l("babel-runtime/core-js/symbol"),h=x(g),b=l("babel-runtime/core-js/object/create"),p=x(b),v=l("babel-runtime/core-js/set-immediate"),I=x(v);function x(Pe){return Pe&&Pe.__esModule?Pe:{default:Pe}}var S=l("process-nextick-args");V.exports=de;function W(Pe,Le,Ge){this.chunk=Pe,this.encoding=Le,this.callback=Ge,this.next=null}function B(Pe){var Le=this;this.next=null,this.entry=null,this.finish=function(){Ye(Le,Pe)}}var Q=!y.browser&&["v0.10","v0.9."].indexOf(y.version.slice(0,5))>-1?I.default:S.nextTick,G;de.WritableState=re;var $=(0,p.default)(l("core-util-is"));$.inherits=l("inherits");var J={deprecate:l("util-deprecate")},U=l("./internal/streams/stream"),j=l("safe-buffer").Buffer,T=d.Uint8Array||function(){};function ee(Pe){return j.from(Pe)}function Z(Pe){return j.isBuffer(Pe)||Pe instanceof T}var _=l("./internal/streams/destroy");$.inherits(de,U);function X(){}function re(Pe,Le){G=G||l("./_stream_duplex"),Pe=Pe||{};var Ge=Le instanceof G;this.objectMode=!!Pe.objectMode,Ge&&(this.objectMode=this.objectMode||!!Pe.writableObjectMode);var ot=Pe.highWaterMark,be=Pe.writableHighWaterMark,ye=this.objectMode?16:16*1024;ot||ot===0?this.highWaterMark=ot:Ge&&(be||be===0)?this.highWaterMark=be:this.highWaterMark=ye,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(q){ue(Le,q)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new B(this)}re.prototype.getBuffer=function(){for(var Le=this.bufferedRequest,Ge=[];Le;)Ge.push(Le),Le=Le.next;return Ge},function(){try{Object.defineProperty(re.prototype,"buffer",{get:J.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(Pe){}}();var me;typeof h.default=="function"&&E.default&&typeof Function.prototype[E.default]=="function"?(me=Function.prototype[E.default],(0,M.default)(de,E.default,{value:function(Le){return me.call(this,Le)?!0:this!==de?!1:Le&&Le._writableState instanceof re}})):me=function(Le){return Le instanceof this};function de(Pe){if(G=G||l("./_stream_duplex"),!me.call(de,this)&&!(this instanceof G))return new de(Pe);this._writableState=new re(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)),U.call(this)}de.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function we(Pe,Le){var Ge=new Error("write after end");Pe.emit("error",Ge),S.nextTick(Le,Ge)}function ge(Pe,Le,Ge,ot){var be=!0,ye=!1;return Ge===null?ye=new TypeError("May not write null values to stream"):typeof Ge!="string"&&Ge!==void 0&&!Le.objectMode&&(ye=new TypeError("Invalid non-string/buffer chunk")),ye&&(Pe.emit("error",ye),S.nextTick(ot,ye),be=!1),be}de.prototype.write=function(Pe,Le,Ge){var ot=this._writableState,be=!1,ye=!ot.objectMode&&Z(Pe);return ye&&!j.isBuffer(Pe)&&(Pe=ee(Pe)),typeof Le=="function"&&(Ge=Le,Le=null),ye?Le="buffer":Le||(Le=ot.defaultEncoding),typeof Ge!="function"&&(Ge=X),ot.ended?we(this,Ge):(ye||ge(this,ot,Pe,Ge))&&(ot.pendingcb++,be=z(this,ot,ye,Pe,Le,Ge)),be},de.prototype.cork=function(){var Pe=this._writableState;Pe.corked++},de.prototype.uncork=function(){var Pe=this._writableState;Pe.corked&&(Pe.corked--,!Pe.writing&&!Pe.corked&&!Pe.finished&&!Pe.bufferProcessing&&Pe.bufferedRequest&&De(this,Pe))},de.prototype.setDefaultEncoding=function(Le){if(typeof Le=="string"&&(Le=Le.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Le+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+Le);return this._writableState.defaultEncoding=Le,this};function ke(Pe,Le,Ge){return!Pe.objectMode&&Pe.decodeStrings!==!1&&typeof Le=="string"&&(Le=j.from(Le,Ge)),Le}Object.defineProperty(de.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function z(Pe,Le,Ge,ot,be,ye){if(!Ge){var $e=ke(Le,ot,be);ot!==$e&&(Ge=!0,be="buffer",ot=$e)}var q=Le.objectMode?1:ot.length;Le.length+=q;var m=Le.length<Le.highWaterMark;if(m||(Le.needDrain=!0),Le.writing||Le.corked){var c=Le.lastBufferedRequest;Le.lastBufferedRequest={chunk:ot,encoding:be,isBuf:Ge,callback:ye,next:null},c?c.next=Le.lastBufferedRequest:Le.bufferedRequest=Le.lastBufferedRequest,Le.bufferedRequestCount+=1}else ie(Pe,Le,!1,q,ot,be,ye);return m}function ie(Pe,Le,Ge,ot,be,ye,$e){Le.writelen=ot,Le.writecb=$e,Le.writing=!0,Le.sync=!0,Ge?Pe._writev(be,Le.onwrite):Pe._write(be,ye,Le.onwrite),Le.sync=!1}function H(Pe,Le,Ge,ot,be){--Le.pendingcb,Ge?(S.nextTick(be,ot),S.nextTick(Ie,Pe,Le),Pe._writableState.errorEmitted=!0,Pe.emit("error",ot)):(be(ot),Pe._writableState.errorEmitted=!0,Pe.emit("error",ot),Ie(Pe,Le))}function ae(Pe){Pe.writing=!1,Pe.writecb=null,Pe.length-=Pe.writelen,Pe.writelen=0}function ue(Pe,Le){var Ge=Pe._writableState,ot=Ge.sync,be=Ge.writecb;if(ae(Ge),Le)H(Pe,Ge,ot,Le,be);else{var ye=Fe(Ge);!ye&&!Ge.corked&&!Ge.bufferProcessing&&Ge.bufferedRequest&&De(Pe,Ge),ot?Q(te,Pe,Ge,ye,be):te(Pe,Ge,ye,be)}}function te(Pe,Le,Ge,ot){Ge||Se(Pe,Le),Le.pendingcb--,ot(),Ie(Pe,Le)}function Se(Pe,Le){Le.length===0&&Le.needDrain&&(Le.needDrain=!1,Pe.emit("drain"))}function De(Pe,Le){Le.bufferProcessing=!0;var Ge=Le.bufferedRequest;if(Pe._writev&&Ge&&Ge.next){var ot=Le.bufferedRequestCount,be=new Array(ot),ye=Le.corkedRequestsFree;ye.entry=Ge;for(var $e=0,q=!0;Ge;)be[$e]=Ge,Ge.isBuf||(q=!1),Ge=Ge.next,$e+=1;be.allBuffers=q,ie(Pe,Le,!0,Le.length,be,"",ye.finish),Le.pendingcb++,Le.lastBufferedRequest=null,ye.next?(Le.corkedRequestsFree=ye.next,ye.next=null):Le.corkedRequestsFree=new B(Le),Le.bufferedRequestCount=0}else{for(;Ge;){var m=Ge.chunk,c=Ge.encoding,R=Ge.callback,fe=Le.objectMode?1:m.length;if(ie(Pe,Le,!1,fe,m,c,R),Ge=Ge.next,Le.bufferedRequestCount--,Le.writing)break}Ge===null&&(Le.lastBufferedRequest=null)}Le.bufferedRequest=Ge,Le.bufferProcessing=!1}de.prototype._write=function(Pe,Le,Ge){Ge(new Error("_write() is not implemented"))},de.prototype._writev=null,de.prototype.end=function(Pe,Le,Ge){var ot=this._writableState;typeof Pe=="function"?(Ge=Pe,Pe=null,Le=null):typeof Le=="function"&&(Ge=Le,Le=null),Pe!=null&&this.write(Pe,Le),ot.corked&&(ot.corked=1,this.uncork()),!ot.ending&&!ot.finished&&dt(this,ot,Ge)};function Fe(Pe){return Pe.ending&&Pe.length===0&&Pe.bufferedRequest===null&&!Pe.finished&&!Pe.writing}function Ke(Pe,Le){Pe._final(function(Ge){Le.pendingcb--,Ge&&Pe.emit("error",Ge),Le.prefinished=!0,Pe.emit("prefinish"),Ie(Pe,Le)})}function et(Pe,Le){!Le.prefinished&&!Le.finalCalled&&(typeof Pe._final=="function"?(Le.pendingcb++,Le.finalCalled=!0,S.nextTick(Ke,Pe,Le)):(Le.prefinished=!0,Pe.emit("prefinish")))}function Ie(Pe,Le){var Ge=Fe(Le);return Ge&&(et(Pe,Le),Le.pendingcb===0&&(Le.finished=!0,Pe.emit("finish"))),Ge}function dt(Pe,Le,Ge){Le.ending=!0,Ie(Pe,Le),Ge&&(Le.finished?S.nextTick(Ge):Pe.once("finish",Ge)),Le.ended=!0,Pe.writable=!1}function Ye(Pe,Le,Ge){var ot=Pe.entry;for(Pe.entry=null;ot;){var be=ot.callback;Le.pendingcb--,be(Ge),ot=ot.next}Le.corkedRequestsFree?Le.corkedRequestsFree.next=Pe:Le.corkedRequestsFree=Pe}Object.defineProperty(de.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(Le){if(!this._writableState)return;this._writableState.destroyed=Le}}),de.prototype.destroy=_.destroy,de.prototype._undestroy=_.undestroy,de.prototype._destroy=function(Pe,Le){this.end(),Le(Pe)}}).call(this,l("_process"),typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./_stream_duplex":214,"./internal/streams/destroy":220,"./internal/streams/stream":221,_process:208,"babel-runtime/core-js/object/create":55,"babel-runtime/core-js/object/define-property":56,"babel-runtime/core-js/set-immediate":62,"babel-runtime/core-js/symbol":64,"babel-runtime/core-js/symbol/has-instance":65,"core-util-is":189,inherits:196,"process-nextick-args":207,"safe-buffer":228,"util-deprecate":240}],219:[function(l,V,N){"use strict";function y(D,E){if(!(D instanceof E))throw new TypeError("Cannot call a class as a function")}var d=l("safe-buffer").Buffer,F=l("util");function M(D,E,g){D.copy(E,g)}V.exports=function(){function D(){y(this,D),this.head=null,this.tail=null,this.length=0}return D.prototype.push=function(g){var h={data:g,next:null};this.length>0?this.tail.next=h:this.head=h,this.tail=h,++this.length},D.prototype.unshift=function(g){var h={data:g,next:this.head};this.length===0&&(this.tail=h),this.head=h,++this.length},D.prototype.shift=function(){if(this.length===0)return;var g=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,g},D.prototype.clear=function(){this.head=this.tail=null,this.length=0},D.prototype.join=function(g){if(this.length===0)return"";for(var h=this.head,b=""+h.data;h=h.next;)b+=g+h.data;return b},D.prototype.concat=function(g){if(this.length===0)return d.alloc(0);if(this.length===1)return this.head.data;for(var h=d.allocUnsafe(g>>>0),b=this.head,p=0;b;)M(b.data,h,p),p+=b.data.length,b=b.next;return h},D}(),F&&F.inspect&&F.inspect.custom&&(V.exports.prototype[F.inspect.custom]=function(){var D=F.inspect({length:this.length});return this.constructor.name+" "+D})},{"safe-buffer":228,util:71}],220:[function(l,V,N){"use strict";var y=l("process-nextick-args");function d(D,E){var g=this,h=this._readableState&&this._readableState.destroyed,b=this._writableState&&this._writableState.destroyed;return h||b?(E?E(D):D&&(!this._writableState||!this._writableState.errorEmitted)&&y.nextTick(M,this,D),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(D||null,function(p){!E&&p?(y.nextTick(M,g,p),g._writableState&&(g._writableState.errorEmitted=!0)):E&&E(p)}),this)}function F(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function M(D,E){D.emit("error",E)}V.exports={destroy:d,undestroy:F}},{"process-nextick-args":207}],221:[function(l,V,N){"use strict";V.exports=l("events").EventEmitter},{events:192}],222:[function(l,V,N){V.exports=l("./readable").PassThrough},{"./readable":223}],223:[function(l,V,N){N=V.exports=l("./lib/_stream_readable.js"),N.Stream=N,N.Readable=N,N.Writable=l("./lib/_stream_writable.js"),N.Duplex=l("./lib/_stream_duplex.js"),N.Transform=l("./lib/_stream_transform.js"),N.PassThrough=l("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":214,"./lib/_stream_passthrough.js":215,"./lib/_stream_readable.js":216,"./lib/_stream_transform.js":217,"./lib/_stream_writable.js":218}],224:[function(l,V,N){V.exports=l("./readable").Transform},{"./readable":223}],225:[function(l,V,N){V.exports=l("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":218}],226:[function(l,V,N){var y=function(){return this}()||Function("return this")(),d=y.regeneratorRuntime&&Object.getOwnPropertyNames(y).indexOf("regeneratorRuntime")>=0,F=d&&y.regeneratorRuntime;if(y.regeneratorRuntime=void 0,V.exports=l("./runtime"),d)y.regeneratorRuntime=F;else try{delete y.regeneratorRuntime}catch(M){y.regeneratorRuntime=void 0}},{"./runtime":227}],227:[function(l,V,N){!function(y){"use strict";var d=Object.prototype,F=d.hasOwnProperty,M,D=typeof Symbol=="function"?Symbol:{},E=D.iterator||"@@iterator",g=D.asyncIterator||"@@asyncIterator",h=D.toStringTag||"@@toStringTag",b=typeof V=="object",p=y.regeneratorRuntime;if(p){b&&(V.exports=p);return}p=y.regeneratorRuntime=b?V.exports:{};function v(z,ie,H,ae){var ue=ie&&ie.prototype instanceof G?ie:G,te=Object.create(ue.prototype),Se=new we(ae||[]);return te._invoke=X(z,H,Se),te}p.wrap=v;function I(z,ie,H){try{return{type:"normal",arg:z.call(ie,H)}}catch(ae){return{type:"throw",arg:ae}}}var x="suspendedStart",S="suspendedYield",W="executing",B="completed",Q={};function G(){}function $(){}function J(){}var U={};U[E]=function(){return this};var j=Object.getPrototypeOf,T=j&&j(j(ge([])));T&&T!==d&&F.call(T,E)&&(U=T);var ee=J.prototype=G.prototype=Object.create(U);$.prototype=ee.constructor=J,J.constructor=$,J[h]=$.displayName="GeneratorFunction";function Z(z){["next","throw","return"].forEach(function(ie){z[ie]=function(H){return this._invoke(ie,H)}})}p.isGeneratorFunction=function(z){var ie=typeof z=="function"&&z.constructor;return ie?ie===$||(ie.displayName||ie.name)==="GeneratorFunction":!1},p.mark=function(z){return Object.setPrototypeOf?Object.setPrototypeOf(z,J):(z.__proto__=J,h in z||(z[h]="GeneratorFunction")),z.prototype=Object.create(ee),z},p.awrap=function(z){return{__await:z}};function _(z){function ie(ue,te,Se,De){var Fe=I(z[ue],z,te);if(Fe.type==="throw")De(Fe.arg);else{var Ke=Fe.arg,et=Ke.value;return et&&typeof et=="object"&&F.call(et,"__await")?Promise.resolve(et.__await).then(function(Ie){ie("next",Ie,Se,De)},function(Ie){ie("throw",Ie,Se,De)}):Promise.resolve(et).then(function(Ie){Ke.value=Ie,Se(Ke)},De)}}var H;function ae(ue,te){function Se(){return new Promise(function(De,Fe){ie(ue,te,De,Fe)})}return H=H?H.then(Se,Se):Se()}this._invoke=ae}Z(_.prototype),_.prototype[g]=function(){return this},p.AsyncIterator=_,p.async=function(z,ie,H,ae){var ue=new _(v(z,ie,H,ae));return p.isGeneratorFunction(ie)?ue:ue.next().then(function(te){return te.done?te.value:ue.next()})};function X(z,ie,H){var ae=x;return function(te,Se){if(ae===W)throw new Error("Generator is already running");if(ae===B){if(te==="throw")throw Se;return ke()}for(H.method=te,H.arg=Se;;){var De=H.delegate;if(De){var Fe=re(De,H);if(Fe){if(Fe===Q)continue;return Fe}}if(H.method==="next")H.sent=H._sent=H.arg;else if(H.method==="throw"){if(ae===x)throw ae=B,H.arg;H.dispatchException(H.arg)}else H.method==="return"&&H.abrupt("return",H.arg);ae=W;var Ke=I(z,ie,H);if(Ke.type==="normal"){if(ae=H.done?B:S,Ke.arg===Q)continue;return{value:Ke.arg,done:H.done}}else Ke.type==="throw"&&(ae=B,H.method="throw",H.arg=Ke.arg)}}}function re(z,ie){var H=z.iterator[ie.method];if(H===M){if(ie.delegate=null,ie.method==="throw"){if(z.iterator.return&&(ie.method="return",ie.arg=M,re(z,ie),ie.method==="throw"))return Q;ie.method="throw",ie.arg=new TypeError("The iterator does not provide a 'throw' method")}return Q}var ae=I(H,z.iterator,ie.arg);if(ae.type==="throw")return ie.method="throw",ie.arg=ae.arg,ie.delegate=null,Q;var ue=ae.arg;if(!ue)return ie.method="throw",ie.arg=new TypeError("iterator result is not an object"),ie.delegate=null,Q;if(ue.done)ie[z.resultName]=ue.value,ie.next=z.nextLoc,ie.method!=="return"&&(ie.method="next",ie.arg=M);else return ue;return ie.delegate=null,Q}Z(ee),ee[h]="Generator",ee[E]=function(){return this},ee.toString=function(){return"[object Generator]"};function me(z){var ie={tryLoc:z[0]};1 in z&&(ie.catchLoc=z[1]),2 in z&&(ie.finallyLoc=z[2],ie.afterLoc=z[3]),this.tryEntries.push(ie)}function de(z){var ie=z.completion||{};ie.type="normal",delete ie.arg,z.completion=ie}function we(z){this.tryEntries=[{tryLoc:"root"}],z.forEach(me,this),this.reset(!0)}p.keys=function(z){var ie=[];for(var H in z)ie.push(H);return ie.reverse(),function ae(){for(;ie.length;){var ue=ie.pop();if(ue in z)return ae.value=ue,ae.done=!1,ae}return ae.done=!0,ae}};function ge(z){if(z){var ie=z[E];if(ie)return ie.call(z);if(typeof z.next=="function")return z;if(!isNaN(z.length)){var H=-1,ae=function ue(){for(;++H<z.length;)if(F.call(z,H))return ue.value=z[H],ue.done=!1,ue;return ue.value=M,ue.done=!0,ue};return ae.next=ae}}return{next:ke}}p.values=ge;function ke(){return{value:M,done:!0}}we.prototype={constructor:we,reset:function(z){if(this.prev=0,this.next=0,this.sent=this._sent=M,this.done=!1,this.delegate=null,this.method="next",this.arg=M,this.tryEntries.forEach(de),!z)for(var ie in this)ie.charAt(0)==="t"&&F.call(this,ie)&&!isNaN(+ie.slice(1))&&(this[ie]=M)},stop:function(){this.done=!0;var z=this.tryEntries[0],ie=z.completion;if(ie.type==="throw")throw ie.arg;return this.rval},dispatchException:function(z){if(this.done)throw z;var ie=this;function H(Fe,Ke){return te.type="throw",te.arg=z,ie.next=Fe,Ke&&(ie.method="next",ie.arg=M),!!Ke}for(var ae=this.tryEntries.length-1;ae>=0;--ae){var ue=this.tryEntries[ae],te=ue.completion;if(ue.tryLoc==="root")return H("end");if(ue.tryLoc<=this.prev){var Se=F.call(ue,"catchLoc"),De=F.call(ue,"finallyLoc");if(Se&&De){if(this.prev<ue.catchLoc)return H(ue.catchLoc,!0);if(this.prev<ue.finallyLoc)return H(ue.finallyLoc)}else if(Se){if(this.prev<ue.catchLoc)return H(ue.catchLoc,!0)}else if(De){if(this.prev<ue.finallyLoc)return H(ue.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(z,ie){for(var H=this.tryEntries.length-1;H>=0;--H){var ae=this.tryEntries[H];if(ae.tryLoc<=this.prev&&F.call(ae,"finallyLoc")&&this.prev<ae.finallyLoc){var ue=ae;break}}ue&&(z==="break"||z==="continue")&&ue.tryLoc<=ie&&ie<=ue.finallyLoc&&(ue=null);var te=ue?ue.completion:{};return te.type=z,te.arg=ie,ue?(this.method="next",this.next=ue.finallyLoc,Q):this.complete(te)},complete:function(z,ie){if(z.type==="throw")throw z.arg;return z.type==="break"||z.type==="continue"?this.next=z.arg:z.type==="return"?(this.rval=this.arg=z.arg,this.method="return",this.next="end"):z.type==="normal"&&ie&&(this.next=ie),Q},finish:function(z){for(var ie=this.tryEntries.length-1;ie>=0;--ie){var H=this.tryEntries[ie];if(H.finallyLoc===z)return this.complete(H.completion,H.afterLoc),de(H),Q}},catch:function(z){for(var ie=this.tryEntries.length-1;ie>=0;--ie){var H=this.tryEntries[ie];if(H.tryLoc===z){var ae=H.completion;if(ae.type==="throw"){var ue=ae.arg;de(H)}return ue}}throw new Error("illegal catch attempt")},delegateYield:function(z,ie,H){return this.delegate={iterator:ge(z),resultName:ie,nextLoc:H},this.method==="next"&&(this.arg=M),Q}}}(function(){return this}()||Function("return this")())},{}],228:[function(l,V,N){var y=l("buffer"),d=y.Buffer;function F(D,E){for(var g in D)E[g]=D[g]}d.from&&d.alloc&&d.allocUnsafe&&d.allocUnsafeSlow?V.exports=y:(F(y,N),N.Buffer=M);function M(D,E,g){return d(D,E,g)}F(d,M),M.from=function(D,E,g){if(typeof D=="number")throw new TypeError("Argument must not be a number");return d(D,E,g)},M.alloc=function(D,E,g){if(typeof D!="number")throw new TypeError("Argument must be a number");var h=d(D);return E!==void 0?typeof g=="string"?h.fill(E,g):h.fill(E):h.fill(0),h},M.allocUnsafe=function(D){if(typeof D!="number")throw new TypeError("Argument must be a number");return d(D)},M.allocUnsafeSlow=function(D){if(typeof D!="number")throw new TypeError("Argument must be a number");return y.SlowBuffer(D)}},{buffer:73}],229:[function(l,V,N){(function(y){"use strict";var d=l("babel-runtime/core-js/string/from-code-point"),F=S(d),M=l("babel-runtime/core-js/json/stringify"),D=S(M),E=l("babel-runtime/helpers/typeof"),g=S(E),h=l("babel-runtime/core-js/object/define-property"),b=S(h),p=l("babel-runtime/core-js/object/keys"),v=S(p),I=l("babel-runtime/core-js/object/create"),x=S(I);function S(W){return W&&W.__esModule?W:{default:W}}(function(W){W.parser=function(c,R){return new Q(c,R)},W.SAXParser=Q,W.SAXStream=ee,W.createStream=T,W.MAX_BUFFER_LENGTH=64*1024;var B=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];W.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function Q(c,R){if(!(this instanceof Q))return new Q(c,R);var fe=this;$(fe),fe.q=fe.c="",fe.bufferCheckPosition=W.MAX_BUFFER_LENGTH,fe.opt=R||{},fe.opt.lowercase=fe.opt.lowercase||fe.opt.lowercasetags,fe.looseCase=fe.opt.lowercase?"toLowerCase":"toUpperCase",fe.tags=[],fe.closed=fe.closedRoot=fe.sawRoot=!1,fe.tag=fe.error=null,fe.strict=!!c,fe.noscript=!!(c||fe.opt.noscript),fe.state=te.BEGIN,fe.strictEntities=fe.opt.strictEntities,fe.ENTITIES=fe.strictEntities?(0,x.default)(W.XML_ENTITIES):(0,x.default)(W.ENTITIES),fe.attribList=[],fe.opt.xmlns&&(fe.ns=(0,x.default)(me)),fe.trackPosition=fe.opt.position!==!1,fe.trackPosition&&(fe.position=fe.line=fe.column=0),De(fe,"onready")}x.default||(Object.create=function(c){function R(){}R.prototype=c;var fe=new R;return fe}),v.default||(Object.keys=function(c){var R=[];for(var fe in c)c.hasOwnProperty(fe)&&R.push(fe);return R});function G(c){for(var R=Math.max(W.MAX_BUFFER_LENGTH,10),fe=0,pe=0,Ae=B.length;pe<Ae;pe++){var Qe=c[B[pe]].length;if(Qe>R)switch(B[pe]){case"textNode":Ke(c);break;case"cdata":Fe(c,"oncdata",c.cdata),c.cdata="";break;case"script":Fe(c,"onscript",c.script),c.script="";break;default:Ie(c,"Max buffer length exceeded: "+B[pe])}fe=Math.max(fe,Qe)}var nt=W.MAX_BUFFER_LENGTH-fe;c.bufferCheckPosition=nt+c.position}function $(c){for(var R=0,fe=B.length;R<fe;R++)c[B[R]]=""}function J(c){Ke(c),c.cdata!==""&&(Fe(c,"oncdata",c.cdata),c.cdata=""),c.script!==""&&(Fe(c,"onscript",c.script),c.script="")}Q.prototype={end:function(){dt(this)},write:m,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){J(this)}};var U;try{U=l("stream").Stream}catch(c){U=function(){}}var j=W.EVENTS.filter(function(c){return c!=="error"&&c!=="end"});function T(c,R){return new ee(c,R)}function ee(c,R){if(!(this instanceof ee))return new ee(c,R);U.apply(this),this._parser=new Q(c,R),this.writable=!0,this.readable=!0;var fe=this;this._parser.onend=function(){fe.emit("end")},this._parser.onerror=function(pe){fe.emit("error",pe),fe._parser.error=null},this._decoder=null,j.forEach(function(pe){(0,b.default)(fe,"on"+pe,{get:function(){return fe._parser["on"+pe]},set:function(Qe){if(!Qe)return fe.removeAllListeners(pe),fe._parser["on"+pe]=Qe,Qe;fe.on(pe,Qe)},enumerable:!0,configurable:!1})})}ee.prototype=(0,x.default)(U.prototype,{constructor:{value:ee}}),ee.prototype.write=function(c){if(typeof y=="function"&&typeof y.isBuffer=="function"&&y.isBuffer(c)){if(!this._decoder){var R=l("string_decoder").StringDecoder;this._decoder=new R("utf8")}c=this._decoder.write(c)}return this._parser.write(c.toString()),this.emit("data",c),!0},ee.prototype.end=function(c){return c&&c.length&&this.write(c),this._parser.end(),!0},ee.prototype.on=function(c,R){var fe=this;return!fe._parser["on"+c]&&j.indexOf(c)!==-1&&(fe._parser["on"+c]=function(){var pe=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);pe.splice(0,0,c),fe.emit.apply(fe,pe)}),U.prototype.on.call(fe,c,R)};var Z="[CDATA[",_="DOCTYPE",X="http://www.w3.org/XML/1998/namespace",re="http://www.w3.org/2000/xmlns/",me={xml:X,xmlns:re},de=/[:_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]/,we=/[:_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-]/,ge=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,ke=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function z(c){return c===" "||c===`
|
|
|
`||c==="\r"||c===" "}function ie(c){return c==='"'||c==="'"}function H(c){return c===">"||z(c)}function ae(c,R){return c.test(R)}function ue(c,R){return!ae(c,R)}var te=0;W.STATE={BEGIN:te++,BEGIN_WHITESPACE:te++,TEXT:te++,TEXT_ENTITY:te++,OPEN_WAKA:te++,SGML_DECL:te++,SGML_DECL_QUOTED:te++,DOCTYPE:te++,DOCTYPE_QUOTED:te++,DOCTYPE_DTD:te++,DOCTYPE_DTD_QUOTED:te++,COMMENT_STARTING:te++,COMMENT:te++,COMMENT_ENDING:te++,COMMENT_ENDED:te++,CDATA:te++,CDATA_ENDING:te++,CDATA_ENDING_2:te++,PROC_INST:te++,PROC_INST_BODY:te++,PROC_INST_ENDING:te++,OPEN_TAG:te++,OPEN_TAG_SLASH:te++,ATTRIB:te++,ATTRIB_NAME:te++,ATTRIB_NAME_SAW_WHITE:te++,ATTRIB_VALUE:te++,ATTRIB_VALUE_QUOTED:te++,ATTRIB_VALUE_CLOSED:te++,ATTRIB_VALUE_UNQUOTED:te++,ATTRIB_VALUE_ENTITY_Q:te++,ATTRIB_VALUE_ENTITY_U:te++,CLOSE_TAG:te++,CLOSE_TAG_SAW_WHITE:te++,SCRIPT:te++,SCRIPT_ENDING:te++},W.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},W.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},(0,v.default)(W.ENTITIES).forEach(function(c){var R=W.ENTITIES[c],fe=typeof R=="number"?String.fromCharCode(R):R;W.ENTITIES[c]=fe});for(var Se in W.STATE)W.STATE[W.STATE[Se]]=Se;te=W.STATE;function De(c,R,fe){c[R]&&c[R](fe)}function Fe(c,R,fe){c.textNode&&Ke(c),De(c,R,fe)}function Ke(c){c.textNode=et(c.opt,c.textNode),c.textNode&&De(c,"ontext",c.textNode),c.textNode=""}function et(c,R){return c.trim&&(R=R.trim()),c.normalize&&(R=R.replace(/\s+/g," ")),R}function Ie(c,R){return Ke(c),c.trackPosition&&(R+=`
|
|
|
Line: `+c.line+`
|
|
|
Column: `+c.column+`
|
|
|
Char: `+c.c),R=new Error(R),c.error=R,De(c,"onerror",R),c}function dt(c){return c.sawRoot&&!c.closedRoot&&Ye(c,"Unclosed root tag"),c.state!==te.BEGIN&&c.state!==te.BEGIN_WHITESPACE&&c.state!==te.TEXT&&Ie(c,"Unexpected end"),Ke(c),c.c="",c.closed=!0,De(c,"onend"),Q.call(c,c.strict,c.opt),c}function Ye(c,R){if((typeof c=="undefined"?"undefined":(0,g.default)(c))!=="object"||!(c instanceof Q))throw new Error("bad call to strictFail");c.strict&&Ie(c,R)}function Pe(c){c.strict||(c.tagName=c.tagName[c.looseCase]());var R=c.tags[c.tags.length-1]||c,fe=c.tag={name:c.tagName,attributes:{}};c.opt.xmlns&&(fe.ns=R.ns),c.attribList.length=0,Fe(c,"onopentagstart",fe)}function Le(c,R){var fe=c.indexOf(":"),pe=fe<0?["",c]:c.split(":"),Ae=pe[0],Qe=pe[1];return R&&c==="xmlns"&&(Ae="xmlns",Qe=""),{prefix:Ae,local:Qe}}function Ge(c){if(c.strict||(c.attribName=c.attribName[c.looseCase]()),c.attribList.indexOf(c.attribName)!==-1||c.tag.attributes.hasOwnProperty(c.attribName)){c.attribName=c.attribValue="";return}if(c.opt.xmlns){var R=Le(c.attribName,!0),fe=R.prefix,pe=R.local;if(fe==="xmlns")if(pe==="xml"&&c.attribValue!==X)Ye(c,"xml: prefix must be bound to "+X+`
|
|
|
Actual: `+c.attribValue);else if(pe==="xmlns"&&c.attribValue!==re)Ye(c,"xmlns: prefix must be bound to "+re+`
|
|
|
Actual: `+c.attribValue);else{var Ae=c.tag,Qe=c.tags[c.tags.length-1]||c;Ae.ns===Qe.ns&&(Ae.ns=(0,x.default)(Qe.ns)),Ae.ns[pe]=c.attribValue}c.attribList.push([c.attribName,c.attribValue])}else c.tag.attributes[c.attribName]=c.attribValue,Fe(c,"onattribute",{name:c.attribName,value:c.attribValue});c.attribName=c.attribValue=""}function ot(c,R){if(c.opt.xmlns){var fe=c.tag,pe=Le(c.tagName);fe.prefix=pe.prefix,fe.local=pe.local,fe.uri=fe.ns[pe.prefix]||"",fe.prefix&&!fe.uri&&(Ye(c,"Unbound namespace prefix: "+(0,D.default)(c.tagName)),fe.uri=pe.prefix);var Ae=c.tags[c.tags.length-1]||c;fe.ns&&Ae.ns!==fe.ns&&(0,v.default)(fe.ns).forEach(function(rr){Fe(c,"onopennamespace",{prefix:rr,uri:fe.ns[rr]})});for(var Qe=0,nt=c.attribList.length;Qe<nt;Qe++){var st=c.attribList[Qe],yt=st[0],ft=st[1],_t=Le(yt,!0),Dt=_t.prefix,at=_t.local,jt=Dt===""?"":fe.ns[Dt]||"",mr={name:yt,value:ft,prefix:Dt,local:at,uri:jt};Dt&&Dt!=="xmlns"&&!jt&&(Ye(c,"Unbound namespace prefix: "+(0,D.default)(Dt)),mr.uri=Dt),c.tag.attributes[yt]=mr,Fe(c,"onattribute",mr)}c.attribList.length=0}c.tag.isSelfClosing=!!R,c.sawRoot=!0,c.tags.push(c.tag),Fe(c,"onopentag",c.tag),R||(!c.noscript&&c.tagName.toLowerCase()==="script"?c.state=te.SCRIPT:c.state=te.TEXT,c.tag=null,c.tagName=""),c.attribName=c.attribValue="",c.attribList.length=0}function be(c){if(!c.tagName){Ye(c,"Weird empty close tag."),c.textNode+="</>",c.state=te.TEXT;return}if(c.script){if(c.tagName!=="script"){c.script+="</"+c.tagName+">",c.tagName="",c.state=te.SCRIPT;return}Fe(c,"onscript",c.script),c.script=""}var R=c.tags.length,fe=c.tagName;c.strict||(fe=fe[c.looseCase]());for(var pe=fe;R--;){var Ae=c.tags[R];if(Ae.name!==pe)Ye(c,"Unexpected close tag");else break}if(R<0){Ye(c,"Unmatched closing tag: "+c.tagName),c.textNode+="</"+c.tagName+">",c.state=te.TEXT;return}c.tagName=fe;for(var Qe=c.tags.length;Qe-- >R;){var nt=c.tag=c.tags.pop();c.tagName=c.tag.name,Fe(c,"onclosetag",c.tagName);var st={};for(var yt in nt.ns)st[yt]=nt.ns[yt];var ft=c.tags[c.tags.length-1]||c;c.opt.xmlns&&nt.ns!==ft.ns&&(0,v.default)(nt.ns).forEach(function(_t){var Dt=nt.ns[_t];Fe(c,"onclosenamespace",{prefix:_t,uri:Dt})})}R===0&&(c.closedRoot=!0),c.tagName=c.attribValue=c.attribName="",c.attribList.length=0,c.state=te.TEXT}function ye(c){var R=c.entity,fe=R.toLowerCase(),pe,Ae="";return c.ENTITIES[R]?c.ENTITIES[R]:c.ENTITIES[fe]?c.ENTITIES[fe]:(R=fe,R.charAt(0)==="#"&&(R.charAt(1)==="x"?(R=R.slice(2),pe=parseInt(R,16),Ae=pe.toString(16)):(R=R.slice(1),pe=parseInt(R,10),Ae=pe.toString(10))),R=R.replace(/^0+/,""),isNaN(pe)||Ae.toLowerCase()!==R?(Ye(c,"Invalid character entity"),"&"+c.entity+";"):(0,F.default)(pe))}function $e(c,R){R==="<"?(c.state=te.OPEN_WAKA,c.startTagPosition=c.position):z(R)||(Ye(c,"Non-whitespace before first tag."),c.textNode=R,c.state=te.TEXT)}function q(c,R){var fe="";return R<c.length&&(fe=c.charAt(R)),fe}function m(c){var R=this;if(this.error)throw this.error;if(R.closed)return Ie(R,"Cannot write after close. Assign an onready handler.");if(c===null)return dt(R);(typeof c=="undefined"?"undefined":(0,g.default)(c))==="object"&&(c=c.toString());for(var fe=0,pe="";!(pe=q(c,fe++),R.c=pe,!pe);){R.trackPosition&&(R.position++,pe===`
|
|
|
`?(R.line++,R.column=0):R.column++);switch(R.state){case te.BEGIN:if(R.state=te.BEGIN_WHITESPACE,pe==="\uFEFF")continue;$e(R,pe);continue;case te.BEGIN_WHITESPACE:$e(R,pe);continue;case te.TEXT:if(R.sawRoot&&!R.closedRoot){for(var Ae=fe-1;pe&&pe!=="<"&&pe!=="&";)pe=q(c,fe++),pe&&R.trackPosition&&(R.position++,pe===`
|
|
|
`?(R.line++,R.column=0):R.column++);R.textNode+=c.substring(Ae,fe-1)}pe==="<"&&!(R.sawRoot&&R.closedRoot&&!R.strict)?(R.state=te.OPEN_WAKA,R.startTagPosition=R.position):(!z(pe)&&(!R.sawRoot||R.closedRoot)&&Ye(R,"Text data outside of root node."),pe==="&"?R.state=te.TEXT_ENTITY:R.textNode+=pe);continue;case te.SCRIPT:pe==="<"?R.state=te.SCRIPT_ENDING:R.script+=pe;continue;case te.SCRIPT_ENDING:pe==="/"?R.state=te.CLOSE_TAG:(R.script+="<"+pe,R.state=te.SCRIPT);continue;case te.OPEN_WAKA:if(pe==="!")R.state=te.SGML_DECL,R.sgmlDecl="";else if(!z(pe))if(ae(de,pe))R.state=te.OPEN_TAG,R.tagName=pe;else if(pe==="/")R.state=te.CLOSE_TAG,R.tagName="";else if(pe==="?")R.state=te.PROC_INST,R.procInstName=R.procInstBody="";else{if(Ye(R,"Unencoded <"),R.startTagPosition+1<R.position){var Qe=R.position-R.startTagPosition;pe=new Array(Qe).join(" ")+pe}R.textNode+="<"+pe,R.state=te.TEXT}continue;case te.SGML_DECL:(R.sgmlDecl+pe).toUpperCase()===Z?(Fe(R,"onopencdata"),R.state=te.CDATA,R.sgmlDecl="",R.cdata=""):R.sgmlDecl+pe==="--"?(R.state=te.COMMENT,R.comment="",R.sgmlDecl=""):(R.sgmlDecl+pe).toUpperCase()===_?(R.state=te.DOCTYPE,(R.doctype||R.sawRoot)&&Ye(R,"Inappropriately located doctype declaration"),R.doctype="",R.sgmlDecl=""):pe===">"?(Fe(R,"onsgmldeclaration",R.sgmlDecl),R.sgmlDecl="",R.state=te.TEXT):(ie(pe)&&(R.state=te.SGML_DECL_QUOTED),R.sgmlDecl+=pe);continue;case te.SGML_DECL_QUOTED:pe===R.q&&(R.state=te.SGML_DECL,R.q=""),R.sgmlDecl+=pe;continue;case te.DOCTYPE:pe===">"?(R.state=te.TEXT,Fe(R,"ondoctype",R.doctype),R.doctype=!0):(R.doctype+=pe,pe==="["?R.state=te.DOCTYPE_DTD:ie(pe)&&(R.state=te.DOCTYPE_QUOTED,R.q=pe));continue;case te.DOCTYPE_QUOTED:R.doctype+=pe,pe===R.q&&(R.q="",R.state=te.DOCTYPE);continue;case te.DOCTYPE_DTD:R.doctype+=pe,pe==="]"?R.state=te.DOCTYPE:ie(pe)&&(R.state=te.DOCTYPE_DTD_QUOTED,R.q=pe);continue;case te.DOCTYPE_DTD_QUOTED:R.doctype+=pe,pe===R.q&&(R.state=te.DOCTYPE_DTD,R.q="");continue;case te.COMMENT:pe==="-"?R.state=te.COMMENT_ENDING:R.comment+=pe;continue;case te.COMMENT_ENDING:pe==="-"?(R.state=te.COMMENT_ENDED,R.comment=et(R.opt,R.comment),R.comment&&Fe(R,"oncomment",R.comment),R.comment=""):(R.comment+="-"+pe,R.state=te.COMMENT);continue;case te.COMMENT_ENDED:pe!==">"?(Ye(R,"Malformed comment"),R.comment+="--"+pe,R.state=te.COMMENT):R.state=te.TEXT;continue;case te.CDATA:pe==="]"?R.state=te.CDATA_ENDING:R.cdata+=pe;continue;case te.CDATA_ENDING:pe==="]"?R.state=te.CDATA_ENDING_2:(R.cdata+="]"+pe,R.state=te.CDATA);continue;case te.CDATA_ENDING_2:pe===">"?(R.cdata&&Fe(R,"oncdata",R.cdata),Fe(R,"onclosecdata"),R.cdata="",R.state=te.TEXT):pe==="]"?R.cdata+="]":(R.cdata+="]]"+pe,R.state=te.CDATA);continue;case te.PROC_INST:pe==="?"?R.state=te.PROC_INST_ENDING:z(pe)?R.state=te.PROC_INST_BODY:R.procInstName+=pe;continue;case te.PROC_INST_BODY:if(!R.procInstBody&&z(pe))continue;pe==="?"?R.state=te.PROC_INST_ENDING:R.procInstBody+=pe;continue;case te.PROC_INST_ENDING:pe===">"?(Fe(R,"onprocessinginstruction",{name:R.procInstName,body:R.procInstBody}),R.procInstName=R.procInstBody="",R.state=te.TEXT):(R.procInstBody+="?"+pe,R.state=te.PROC_INST_BODY);continue;case te.OPEN_TAG:ae(we,pe)?R.tagName+=pe:(Pe(R),pe===">"?ot(R):pe==="/"?R.state=te.OPEN_TAG_SLASH:(z(pe)||Ye(R,"Invalid character in tag name"),R.state=te.ATTRIB));continue;case te.OPEN_TAG_SLASH:pe===">"?(ot(R,!0),be(R)):(Ye(R,"Forward-slash in opening tag not followed by >"),R.state=te.ATTRIB);continue;case te.ATTRIB:if(z(pe))continue;pe===">"?ot(R):pe==="/"?R.state=te.OPEN_TAG_SLASH:ae(de,pe)?(R.attribName=pe,R.attribValue="",R.state=te.ATTRIB_NAME):Ye(R,"Invalid attribute name");continue;case te.ATTRIB_NAME:pe==="="?R.state=te.ATTRIB_VALUE:pe===">"?(Ye(R,"Attribute without value"),R.attribValue=R.attribName,Ge(R),ot(R)):z(pe)?R.state=te.ATTRIB_NAME_SAW_WHITE:ae(we,pe)?R.attribName+=pe:Ye(R,"Invalid attribute name");continue;case te.ATTRIB_NAME_SAW_WHITE:if(pe==="=")R.state=te.ATTRIB_VALUE;else{if(z(pe))continue;Ye(R,"Attribute without value"),R.tag.attributes[R.attribName]="",R.attribValue="",Fe(R,"onattribute",{name:R.attribName,value:""}),R.attribName="",pe===">"?ot(R):ae(de,pe)?(R.attribName=pe,R.state=te.ATTRIB_NAME):(Ye(R,"Invalid attribute name"),R.state=te.ATTRIB)}continue;case te.ATTRIB_VALUE:if(z(pe))continue;ie(pe)?(R.q=pe,R.state=te.ATTRIB_VALUE_QUOTED):(Ye(R,"Unquoted attribute value"),R.state=te.ATTRIB_VALUE_UNQUOTED,R.attribValue=pe);continue;case te.ATTRIB_VALUE_QUOTED:if(pe!==R.q){pe==="&"?R.state=te.ATTRIB_VALUE_ENTITY_Q:R.attribValue+=pe;continue}Ge(R),R.q="",R.state=te.ATTRIB_VALUE_CLOSED;continue;case te.ATTRIB_VALUE_CLOSED:z(pe)?R.state=te.ATTRIB:pe===">"?ot(R):pe==="/"?R.state=te.OPEN_TAG_SLASH:ae(de,pe)?(Ye(R,"No whitespace between attributes"),R.attribName=pe,R.attribValue="",R.state=te.ATTRIB_NAME):Ye(R,"Invalid attribute name");continue;case te.ATTRIB_VALUE_UNQUOTED:if(!H(pe)){pe==="&"?R.state=te.ATTRIB_VALUE_ENTITY_U:R.attribValue+=pe;continue}Ge(R),pe===">"?ot(R):R.state=te.ATTRIB;continue;case te.CLOSE_TAG:if(R.tagName)pe===">"?be(R):ae(we,pe)?R.tagName+=pe:R.script?(R.script+="</"+R.tagName,R.tagName="",R.state=te.SCRIPT):(z(pe)||Ye(R,"Invalid tagname in closing tag"),R.state=te.CLOSE_TAG_SAW_WHITE);else{if(z(pe))continue;ue(de,pe)?R.script?(R.script+="</"+pe,R.state=te.SCRIPT):Ye(R,"Invalid tagname in closing tag."):R.tagName=pe}continue;case te.CLOSE_TAG_SAW_WHITE:if(z(pe))continue;pe===">"?be(R):Ye(R,"Invalid characters in closing tag");continue;case te.TEXT_ENTITY:case te.ATTRIB_VALUE_ENTITY_Q:case te.ATTRIB_VALUE_ENTITY_U:var nt,st;switch(R.state){case te.TEXT_ENTITY:nt=te.TEXT,st="textNode";break;case te.ATTRIB_VALUE_ENTITY_Q:nt=te.ATTRIB_VALUE_QUOTED,st="attribValue";break;case te.ATTRIB_VALUE_ENTITY_U:nt=te.ATTRIB_VALUE_UNQUOTED,st="attribValue";break}pe===";"?(R[st]+=ye(R),R.entity="",R.state=nt):ae(R.entity.length?ke:ge,pe)?R.entity+=pe:(Ye(R,"Invalid character in entity name"),R[st]+="&"+R.entity+pe,R.entity="",R.state=nt);continue;default:throw new Error(R,"Unknown state: "+R.state)}}return R.position>=R.bufferCheckPosition&&G(R),R}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */F.default||function(){var c=String.fromCharCode,R=Math.floor,fe=function(){var Ae=16384,Qe=[],nt,st,yt=-1,ft=arguments.length;if(!ft)return"";for(var _t="";++yt<ft;){var Dt=Number(arguments[yt]);if(!isFinite(Dt)||Dt<0||Dt>1114111||R(Dt)!==Dt)throw RangeError("Invalid code point: "+Dt);Dt<=65535?Qe.push(Dt):(Dt-=65536,nt=(Dt>>10)+55296,st=Dt%1024+56320,Qe.push(nt,st)),(yt+1===ft||Qe.length>Ae)&&(_t+=c.apply(null,Qe),Qe.length=0)}return _t};b.default?Object.defineProperty(String,"fromCodePoint",{value:fe,configurable:!0,writable:!0}):String.fromCodePoint=fe}()})(typeof N=="undefined"?(void 0).sax={}:N)}).call(this,l("buffer").Buffer)},{"babel-runtime/core-js/json/stringify":53,"babel-runtime/core-js/object/create":55,"babel-runtime/core-js/object/define-property":56,"babel-runtime/core-js/object/keys":60,"babel-runtime/core-js/string/from-code-point":63,"babel-runtime/helpers/typeof":67,buffer:73,stream:230,string_decoder:72}],230:[function(l,V,N){V.exports=F;var y=l("events").EventEmitter,d=l("inherits");d(F,y),F.Readable=l("readable-stream/readable.js"),F.Writable=l("readable-stream/writable.js"),F.Duplex=l("readable-stream/duplex.js"),F.Transform=l("readable-stream/transform.js"),F.PassThrough=l("readable-stream/passthrough.js"),F.Stream=F;function F(){y.call(this)}F.prototype.pipe=function(M,D){var E=this;function g(S){M.writable&&(M.write(S)===!1&&E.pause&&E.pause())}E.on("data",g);function h(){E.readable&&E.resume&&E.resume()}M.on("drain",h),!M._isStdio&&(!D||D.end!==!1)&&(E.on("end",p),E.on("close",v));var b=!1;function p(){if(b)return;b=!0,M.end()}function v(){if(b)return;b=!0,typeof M.destroy=="function"&&M.destroy()}function I(S){if(x(),y.listenerCount(this,"error")===0)throw S}E.on("error",I),M.on("error",I);function x(){E.removeListener("data",g),M.removeListener("drain",h),E.removeListener("end",p),E.removeListener("close",v),E.removeListener("error",I),M.removeListener("error",I),E.removeListener("end",x),E.removeListener("close",x),M.removeListener("close",x)}return E.on("end",x),E.on("close",x),M.on("close",x),M.emit("pipe",E),M}},{events:192,inherits:196,"readable-stream/duplex.js":213,"readable-stream/passthrough.js":222,"readable-stream/readable.js":223,"readable-stream/transform.js":224,"readable-stream/writable.js":225}],231:[function(l,V,N){(function(y){var d=l("./lib/request"),F=l("./lib/response"),M=l("xtend"),D=l("builtin-status-codes"),E=l("url"),g=N;g.request=function(h,b){typeof h=="string"?h=E.parse(h):h=M(h);var p=y.location.protocol.search(/^https?:$/)===-1?"http:":"",v=h.protocol||p,I=h.hostname||h.host,x=h.port,S=h.path||"/";I&&I.indexOf(":")!==-1&&(I="["+I+"]"),h.url=(I?v+"//"+I:"")+(x?":"+x:"")+S,h.method=(h.method||"GET").toUpperCase(),h.headers=h.headers||{};var W=new d(h);return b&&W.on("response",b),W},g.get=function(b,p){var v=g.request(b,p);return v.end(),v},g.ClientRequest=d,g.IncomingMessage=F.IncomingMessage,g.Agent=function(){},g.Agent.defaultMaxSockets=4,g.globalAgent=new g.Agent,g.STATUS_CODES=D,g.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./lib/request":233,"./lib/response":234,"builtin-status-codes":74,url:238,xtend:283}],232:[function(l,V,N){(function(y){"use strict";N.fetch=g(y.fetch)&&g(y.ReadableStream),N.writableStream=g(y.WritableStream),N.abortController=g(y.AbortController),N.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),N.blobConstructor=!0}catch(h){}var d;function F(){if(d!==void 0)return d;if(y.XMLHttpRequest){d=new y.XMLHttpRequest;try{d.open("GET",y.XDomainRequest?"/":"https://example.com")}catch(h){d=null}}else d=null;return d}function M(h){var b=F();if(!b)return!1;try{return b.responseType=h,b.responseType===h}catch(p){}return!1}var D=typeof y.ArrayBuffer!="undefined",E=D&&g(y.ArrayBuffer.prototype.slice);N.arraybuffer=N.fetch||D&&M("arraybuffer"),N.msstream=!N.fetch&&E&&M("ms-stream"),N.mozchunkedarraybuffer=!N.fetch&&D&&M("moz-chunked-arraybuffer"),N.overrideMimeType=N.fetch||(F()?g(F().overrideMimeType):!1),N.vbArray=g(y.VBArray);function g(h){return typeof h=="function"}d=null}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],233:[function(l,V,N){(function(y,d,F){"use strict";var M=l("babel-runtime/core-js/object/keys"),D=E(M);function E(G){return G&&G.__esModule?G:{default:G}}var g=l("./capability"),h=l("inherits"),b=l("./response"),p=l("readable-stream"),v=l("to-arraybuffer"),I=b.IncomingMessage,x=b.readyStates;function S(G,$){return g.fetch&&$?"fetch":g.mozchunkedarraybuffer?"moz-chunked-arraybuffer":g.msstream?"ms-stream":g.arraybuffer&&G?"arraybuffer":g.vbArray&&G?"text:vbarray":"text"}var W=V.exports=function(G){var $=this;p.Writable.call($),$._opts=G,$._body=[],$._headers={},G.auth&&$.setHeader("Authorization","Basic "+new F(G.auth).toString("base64")),(0,D.default)(G.headers).forEach(function(j){$.setHeader(j,G.headers[j])});var J,U=!0;if(G.mode==="disable-fetch"||"requestTimeout"in G&&!g.abortController)U=!1,J=!0;else if(G.mode==="prefer-streaming")J=!1;else if(G.mode==="allow-wrong-content-type")J=!g.overrideMimeType;else if(!G.mode||G.mode==="default"||G.mode==="prefer-fast")J=!0;else throw new Error("Invalid value for opts.mode");$._mode=S(J,U),$._fetchTimer=null,$.on("finish",function(){$._onFinish()})};h(W,p.Writable),W.prototype.setHeader=function(G,$){var J=this,U=G.toLowerCase();if(Q.indexOf(U)!==-1)return;J._headers[U]={name:G,value:$}},W.prototype.getHeader=function(G){var $=this._headers[G.toLowerCase()];return $?$.value:null},W.prototype.removeHeader=function(G){var $=this;delete $._headers[G.toLowerCase()]},W.prototype._onFinish=function(){var G=this;if(G._destroyed)return;var $=G._opts,J=G._headers,U=null;$.method!=="GET"&&$.method!=="HEAD"&&(g.arraybuffer?U=v(F.concat(G._body)):g.blobConstructor?U=new d.Blob(G._body.map(function(X){return v(X)}),{type:(J["content-type"]||{}).value||""}):U=F.concat(G._body).toString());var j=[];if((0,D.default)(J).forEach(function(X){var re=J[X].name,me=J[X].value;Array.isArray(me)?me.forEach(function(de){j.push([re,de])}):j.push([re,me])}),G._mode==="fetch"){var T=null,ee=null;if(g.abortController){var Z=new AbortController;T=Z.signal,G._fetchAbortController=Z,"requestTimeout"in $&&$.requestTimeout!==0&&(G._fetchTimer=d.setTimeout(function(){G.emit("requestTimeout"),G._fetchAbortController&&G._fetchAbortController.abort()},$.requestTimeout))}d.fetch(G._opts.url,{method:G._opts.method,headers:j,body:U||void 0,mode:"cors",credentials:$.withCredentials?"include":"same-origin",signal:T}).then(function(X){G._fetchResponse=X,G._connect()},function(X){d.clearTimeout(G._fetchTimer),G._destroyed||G.emit("error",X)})}else{var _=G._xhr=new d.XMLHttpRequest;try{_.open(G._opts.method,G._opts.url,!0)}catch(X){y.nextTick(function(){G.emit("error",X)});return}"responseType"in _&&(_.responseType=G._mode.split(":")[0]),"withCredentials"in _&&(_.withCredentials=!!$.withCredentials),G._mode==="text"&&"overrideMimeType"in _&&_.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in $&&(_.timeout=$.requestTimeout,_.ontimeout=function(){G.emit("requestTimeout")}),j.forEach(function(X){_.setRequestHeader(X[0],X[1])}),G._response=null,_.onreadystatechange=function(){switch(_.readyState){case x.LOADING:case x.DONE:G._onXHRProgress();break}},G._mode==="moz-chunked-arraybuffer"&&(_.onprogress=function(){G._onXHRProgress()}),_.onerror=function(){if(G._destroyed)return;G.emit("error",new Error("XHR error"))};try{_.send(U)}catch(X){y.nextTick(function(){G.emit("error",X)});return}}};function B(G){try{var $=G.status;return $!==null&&$!==0}catch(J){return!1}}W.prototype._onXHRProgress=function(){var G=this;if(!B(G._xhr)||G._destroyed)return;G._response||G._connect(),G._response._onXHRProgress()},W.prototype._connect=function(){var G=this;if(G._destroyed)return;G._response=new I(G._xhr,G._fetchResponse,G._mode,G._fetchTimer),G._response.on("error",function($){G.emit("error",$)}),G.emit("response",G._response)},W.prototype._write=function(G,$,J){var U=this;U._body.push(G),J()},W.prototype.abort=W.prototype.destroy=function(){var G=this;G._destroyed=!0,d.clearTimeout(G._fetchTimer),G._response&&(G._response._destroyed=!0),G._xhr?G._xhr.abort():G._fetchAbortController&&G._fetchAbortController.abort()},W.prototype.end=function(G,$,J){var U=this;typeof G=="function"&&(J=G,G=void 0),p.Writable.prototype.end.call(U,G,$,J)},W.prototype.flushHeaders=function(){},W.prototype.setTimeout=function(){},W.prototype.setNoDelay=function(){},W.prototype.setSocketKeepAlive=function(){};var Q=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"]}).call(this,l("_process"),typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{},l("buffer").Buffer)},{"./capability":232,"./response":234,_process:208,"babel-runtime/core-js/object/keys":60,buffer:73,inherits:196,"readable-stream":223,"to-arraybuffer":237}],234:[function(l,V,N){(function(y,d,F){"use strict";var M=l("babel-runtime/core-js/promise"),D=E(M);function E(I){return I&&I.__esModule?I:{default:I}}var g=l("./capability"),h=l("inherits"),b=l("readable-stream"),p=N.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},v=N.IncomingMessage=function(I,x,S,W){var B=this;if(b.Readable.call(B),B._mode=S,B.headers={},B.rawHeaders=[],B.trailers={},B.rawTrailers=[],B.on("end",function(){y.nextTick(function(){B.emit("close")})}),S==="fetch"){var Q=function T(){$.read().then(function(ee){if(B._destroyed)return;if(ee.done){d.clearTimeout(W),B.push(null);return}B.push(new F(ee.value)),T()}).catch(function(ee){d.clearTimeout(W),B._destroyed||B.emit("error",ee)})};if(B._fetchResponse=x,B.url=x.url,B.statusCode=x.status,B.statusMessage=x.statusText,x.headers.forEach(function(T,ee){B.headers[ee.toLowerCase()]=T,B.rawHeaders.push(ee,T)}),g.writableStream){var G=new WritableStream({write:function(ee){return new D.default(function(Z,_){B._destroyed?_():B.push(new F(ee))?Z():B._resumeFetch=Z})},close:function(){d.clearTimeout(W),B._destroyed||B.push(null)},abort:function(ee){B._destroyed||B.emit("error",ee)}});try{x.body.pipeTo(G).catch(function(T){d.clearTimeout(W),B._destroyed||B.emit("error",T)});return}catch(T){}}var $=x.body.getReader();Q()}else{B._xhr=I,B._pos=0,B.url=I.responseURL,B.statusCode=I.status,B.statusMessage=I.statusText;var J=I.getAllResponseHeaders().split(/\r?\n/);if(J.forEach(function(T){var ee=T.match(/^([^:]+):\s*(.*)/);if(ee){var Z=ee[1].toLowerCase();Z==="set-cookie"?(B.headers[Z]===void 0&&(B.headers[Z]=[]),B.headers[Z].push(ee[2])):B.headers[Z]!==void 0?B.headers[Z]+=", "+ee[2]:B.headers[Z]=ee[2],B.rawHeaders.push(ee[1],ee[2])}}),B._charset="x-user-defined",!g.overrideMimeType){var U=B.rawHeaders["mime-type"];if(U){var j=U.match(/;\s*charset=([^;])(;|$)/);j&&(B._charset=j[1].toLowerCase())}B._charset||(B._charset="utf-8")}}};h(v,b.Readable),v.prototype._read=function(){var I=this,x=I._resumeFetch;x&&(I._resumeFetch=null,x())},v.prototype._onXHRProgress=function(){var I=this,x=I._xhr,S=null;switch(I._mode){case"text:vbarray":if(x.readyState!==p.DONE)break;try{S=new d.VBArray(x.responseBody).toArray()}catch($){}if(S!==null){I.push(new F(S));break}case"text":try{S=x.responseText}catch($){I._mode="text:vbarray";break}if(S.length>I._pos){var W=S.substr(I._pos);if(I._charset==="x-user-defined"){for(var B=new F(W.length),Q=0;Q<W.length;Q++)B[Q]=W.charCodeAt(Q)&255;I.push(B)}else I.push(W,I._charset);I._pos=S.length}break;case"arraybuffer":if(x.readyState!==p.DONE||!x.response)break;S=x.response,I.push(new F(new Uint8Array(S)));break;case"moz-chunked-arraybuffer":if(S=x.response,x.readyState!==p.LOADING||!S)break;I.push(new F(new Uint8Array(S)));break;case"ms-stream":if(S=x.response,x.readyState!==p.LOADING)break;var G=new d.MSStreamReader;G.onprogress=function(){G.result.byteLength>I._pos&&(I.push(new F(new Uint8Array(G.result.slice(I._pos)))),I._pos=G.result.byteLength)},G.onload=function(){I.push(null)},G.readAsArrayBuffer(S);break}I._xhr.readyState===p.DONE&&I._mode!=="ms-stream"&&I.push(null)}}).call(this,l("_process"),typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{},l("buffer").Buffer)},{"./capability":232,_process:208,"babel-runtime/core-js/promise":61,buffer:73,inherits:196,"readable-stream":223}],235:[function(l,V,N){"use strict";var y=l("safe-buffer").Buffer,d=y.isEncoding||function(G){G=""+G;switch(G&&G.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function F(G){if(!G)return"utf8";for(var $;;)switch(G){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 G;default:if($)return;G=(""+G).toLowerCase(),$=!0}}function M(G){var $=F(G);if(typeof $!="string"&&(y.isEncoding===d||!d(G)))throw new Error("Unknown encoding: "+G);return $||G}N.StringDecoder=D;function D(G){this.encoding=M(G);var $;switch(this.encoding){case"utf16le":this.text=I,this.end=x,$=4;break;case"utf8":this.fillLast=b,$=4;break;case"base64":this.text=S,this.end=W,$=3;break;default:this.write=B,this.end=Q;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=y.allocUnsafe($)}D.prototype.write=function(G){if(G.length===0)return"";var $,J;if(this.lastNeed){if($=this.fillLast(G),$===void 0)return"";J=this.lastNeed,this.lastNeed=0}else J=0;return J<G.length?$?$+this.text(G,J):this.text(G,J):$||""},D.prototype.end=v,D.prototype.text=p,D.prototype.fillLast=function(G){if(this.lastNeed<=G.length)return G.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);G.copy(this.lastChar,this.lastTotal-this.lastNeed,0,G.length),this.lastNeed-=G.length};function E(G){return G<=127?0:G>>5===6?2:G>>4===14?3:G>>3===30?4:G>>6===2?-1:-2}function g(G,$,J){var U=$.length-1;if(U<J)return 0;var j=E($[U]);return j>=0?(j>0&&(G.lastNeed=j-1),j):--U<J||j===-2?0:(j=E($[U]),j>=0?(j>0&&(G.lastNeed=j-2),j):--U<J||j===-2?0:(j=E($[U]),j>=0?(j>0&&(j===2?j=0:G.lastNeed=j-3),j):0))}function h(G,$,J){if(($[0]&192)!==128)return G.lastNeed=0,"\uFFFD";if(G.lastNeed>1&&$.length>1){if(($[1]&192)!==128)return G.lastNeed=1,"\uFFFD";if(G.lastNeed>2&&$.length>2&&($[2]&192)!==128)return G.lastNeed=2,"\uFFFD"}}function b(G){var $=this.lastTotal-this.lastNeed,J=h(this,G,$);if(J!==void 0)return J;if(this.lastNeed<=G.length)return G.copy(this.lastChar,$,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);G.copy(this.lastChar,$,0,G.length),this.lastNeed-=G.length}function p(G,$){var J=g(this,G,$);if(!this.lastNeed)return G.toString("utf8",$);this.lastTotal=J;var U=G.length-(J-this.lastNeed);return G.copy(this.lastChar,0,U),G.toString("utf8",$,U)}function v(G){var $=G&&G.length?this.write(G):"";return this.lastNeed?$+"\uFFFD":$}function I(G,$){if((G.length-$)%2===0){var J=G.toString("utf16le",$);if(J){var U=J.charCodeAt(J.length-1);if(U>=55296&&U<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=G[G.length-2],this.lastChar[1]=G[G.length-1],J.slice(0,-1)}return J}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=G[G.length-1],G.toString("utf16le",$,G.length-1)}function x(G){var $=G&&G.length?this.write(G):"";if(this.lastNeed){var J=this.lastTotal-this.lastNeed;return $+this.lastChar.toString("utf16le",0,J)}return $}function S(G,$){var J=(G.length-$)%3;return J===0?G.toString("base64",$):(this.lastNeed=3-J,this.lastTotal=3,J===1?this.lastChar[0]=G[G.length-1]:(this.lastChar[0]=G[G.length-2],this.lastChar[1]=G[G.length-1]),G.toString("base64",$,G.length-J))}function W(G){var $=G&&G.length?this.write(G):"";return this.lastNeed?$+this.lastChar.toString("base64",0,3-this.lastNeed):$}function B(G){return G.toString(this.encoding)}function Q(G){return G&&G.length?this.write(G):""}},{"safe-buffer":228}],236:[function(l,V,N){(function(y,d){var F=l("process/browser.js").nextTick,M=Function.prototype.apply,D=Array.prototype.slice,E={},g=0;N.setTimeout=function(){return new h(M.call(setTimeout,window,arguments),clearTimeout)},N.setInterval=function(){return new h(M.call(setInterval,window,arguments),clearInterval)},N.clearTimeout=N.clearInterval=function(b){b.close()};function h(b,p){this._id=b,this._clearFn=p}h.prototype.unref=h.prototype.ref=function(){},h.prototype.close=function(){this._clearFn.call(window,this._id)},N.enroll=function(b,p){clearTimeout(b._idleTimeoutId),b._idleTimeout=p},N.unenroll=function(b){clearTimeout(b._idleTimeoutId),b._idleTimeout=-1},N._unrefActive=N.active=function(b){clearTimeout(b._idleTimeoutId);var p=b._idleTimeout;p>=0&&(b._idleTimeoutId=setTimeout(function(){b._onTimeout&&b._onTimeout()},p))},N.setImmediate=typeof y=="function"?y:function(b){var p=g++,v=arguments.length<2?!1:D.call(arguments,1);return E[p]=!0,F(function(){E[p]&&(v?b.apply(null,v):b.call(null),N.clearImmediate(p))}),p},N.clearImmediate=typeof d=="function"?d:function(b){delete E[b]}}).call(this,l("timers").setImmediate,l("timers").clearImmediate)},{"process/browser.js":208,timers:236}],237:[function(l,V,N){var y=l("buffer").Buffer;V.exports=function(d){if(d instanceof Uint8Array){if(d.byteOffset===0&&d.byteLength===d.buffer.byteLength)return d.buffer;if(typeof d.buffer.slice=="function")return d.buffer.slice(d.byteOffset,d.byteOffset+d.byteLength)}if(y.isBuffer(d)){for(var F=new Uint8Array(d.length),M=d.length,D=0;D<M;D++)F[D]=d[D];return F.buffer}else throw new Error("Argument must be a Buffer")}},{buffer:73}],238:[function(l,V,N){"use strict";var y=l("punycode"),d=l("./util");N.parse=$,N.resolve=U,N.resolveObject=j,N.format=J,N.Url=F;function F(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var M=/^([a-z0-9.+-]+:)/i,D=/:[0-9]*$/,E=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,g=["<",">",'"',"`"," ","\r",`
|
|
|
`," "],h=["{","}","|","\\","^","`"].concat(g),b=["'"].concat(h),p=["%","/","?",";","#"].concat(b),v=["/","?","#"],I=255,x=/^[+a-z0-9A-Z_-]{0,63}$/,S=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,W={javascript:!0,"javascript:":!0},B={javascript:!0,"javascript:":!0},Q={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},G=l("querystring");function $(T,ee,Z){if(T&&d.isObject(T)&&T instanceof F)return T;var _=new F;return _.parse(T,ee,Z),_}F.prototype.parse=function(T,ee,Z){if(!d.isString(T))throw new TypeError("Parameter 'url' must be a string, not "+typeof T);var _=T.indexOf("?"),X=_!==-1&&_<T.indexOf("#")?"?":"#",re=T.split(X),me=/\\/g;re[0]=re[0].replace(me,"/"),T=re.join(X);var de=T;if(de=de.trim(),!Z&&T.split("#").length===1){var we=E.exec(de);if(we)return this.path=de,this.href=de,this.pathname=we[1],we[2]?(this.search=we[2],ee?this.query=G.parse(this.search.substr(1)):this.query=this.search.substr(1)):ee&&(this.search="",this.query={}),this}var ge=M.exec(de);if(ge){ge=ge[0];var ke=ge.toLowerCase();this.protocol=ke,de=de.substr(ge.length)}if(Z||ge||de.match(/^\/\/[^@\/]+@[^@\/]+/)){var z=de.substr(0,2)==="//";z&&!(ge&&B[ge])&&(de=de.substr(2),this.slashes=!0)}if(!B[ge]&&(z||ge&&!Q[ge])){for(var ie=-1,H=0;H<v.length;H++){var ae=de.indexOf(v[H]);ae!==-1&&(ie===-1||ae<ie)&&(ie=ae)}var ue,te;ie===-1?te=de.lastIndexOf("@"):te=de.lastIndexOf("@",ie),te!==-1&&(ue=de.slice(0,te),de=de.slice(te+1),this.auth=decodeURIComponent(ue)),ie=-1;for(var H=0;H<p.length;H++){var ae=de.indexOf(p[H]);ae!==-1&&(ie===-1||ae<ie)&&(ie=ae)}ie===-1&&(ie=de.length),this.host=de.slice(0,ie),de=de.slice(ie),this.parseHost(),this.hostname=this.hostname||"";var Se=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!Se)for(var De=this.hostname.split(/\./),H=0,Fe=De.length;H<Fe;H++){var Ke=De[H];if(!Ke)continue;if(!Ke.match(x)){for(var et="",Ie=0,dt=Ke.length;Ie<dt;Ie++)Ke.charCodeAt(Ie)>127?et+="x":et+=Ke[Ie];if(!et.match(x)){var Ye=De.slice(0,H),Pe=De.slice(H+1),Le=Ke.match(S);Le&&(Ye.push(Le[1]),Pe.unshift(Le[2])),Pe.length&&(de="/"+Pe.join(".")+de),this.hostname=Ye.join(".");break}}}this.hostname.length>I?this.hostname="":this.hostname=this.hostname.toLowerCase(),Se||(this.hostname=y.toASCII(this.hostname));var Ge=this.port?":"+this.port:"",ot=this.hostname||"";this.host=ot+Ge,this.href+=this.host,Se&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),de[0]!=="/"&&(de="/"+de))}if(!W[ke])for(var H=0,Fe=b.length;H<Fe;H++){var be=b[H];if(de.indexOf(be)===-1)continue;var ye=encodeURIComponent(be);ye===be&&(ye=escape(be)),de=de.split(be).join(ye)}var $e=de.indexOf("#");$e!==-1&&(this.hash=de.substr($e),de=de.slice(0,$e));var q=de.indexOf("?");if(q!==-1?(this.search=de.substr(q),this.query=de.substr(q+1),ee&&(this.query=G.parse(this.query)),de=de.slice(0,q)):ee&&(this.search="",this.query={}),de&&(this.pathname=de),Q[ke]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var Ge=this.pathname||"",m=this.search||"";this.path=Ge+m}return this.href=this.format(),this};function J(T){return d.isString(T)&&(T=$(T)),T instanceof F?T.format():F.prototype.format.call(T)}F.prototype.format=function(){var T=this.auth||"";T&&(T=encodeURIComponent(T),T=T.replace(/%3A/i,":"),T+="@");var ee=this.protocol||"",Z=this.pathname||"",_=this.hash||"",X=!1,re="";this.host?X=T+this.host:this.hostname&&(X=T+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(X+=":"+this.port)),this.query&&d.isObject(this.query)&&Object.keys(this.query).length&&(re=G.stringify(this.query));var me=this.search||re&&"?"+re||"";return ee&&ee.substr(-1)!==":"&&(ee+=":"),this.slashes||(!ee||Q[ee])&&X!==!1?(X="//"+(X||""),Z&&Z.charAt(0)!=="/"&&(Z="/"+Z)):X||(X=""),_&&_.charAt(0)!=="#"&&(_="#"+_),me&&me.charAt(0)!=="?"&&(me="?"+me),Z=Z.replace(/[?#]/g,function(de){return encodeURIComponent(de)}),me=me.replace("#","%23"),ee+X+Z+me+_};function U(T,ee){return $(T,!1,!0).resolve(ee)}F.prototype.resolve=function(T){return this.resolveObject($(T,!1,!0)).format()};function j(T,ee){return T?$(T,!1,!0).resolveObject(ee):ee}F.prototype.resolveObject=function(T){if(d.isString(T)){var ee=new F;ee.parse(T,!1,!0),T=ee}for(var Z=new F,_=Object.keys(this),X=0;X<_.length;X++){var re=_[X];Z[re]=this[re]}if(Z.hash=T.hash,T.href==="")return Z.href=Z.format(),Z;if(T.slashes&&!T.protocol){for(var me=Object.keys(T),de=0;de<me.length;de++){var we=me[de];we!=="protocol"&&(Z[we]=T[we])}return Q[Z.protocol]&&Z.hostname&&!Z.pathname&&(Z.path=Z.pathname="/"),Z.href=Z.format(),Z}if(T.protocol&&T.protocol!==Z.protocol){if(!Q[T.protocol]){for(var ge=Object.keys(T),ke=0;ke<ge.length;ke++){var z=ge[ke];Z[z]=T[z]}return Z.href=Z.format(),Z}if(Z.protocol=T.protocol,!T.host&&!B[T.protocol]){for(var Fe=(T.pathname||"").split("/");Fe.length&&!(T.host=Fe.shift()););T.host||(T.host=""),T.hostname||(T.hostname=""),Fe[0]!==""&&Fe.unshift(""),Fe.length<2&&Fe.unshift(""),Z.pathname=Fe.join("/")}else Z.pathname=T.pathname;if(Z.search=T.search,Z.query=T.query,Z.host=T.host||"",Z.auth=T.auth,Z.hostname=T.hostname||T.host,Z.port=T.port,Z.pathname||Z.search){var ie=Z.pathname||"",H=Z.search||"";Z.path=ie+H}return Z.slashes=Z.slashes||T.slashes,Z.href=Z.format(),Z}var ae=Z.pathname&&Z.pathname.charAt(0)==="/",ue=T.host||T.pathname&&T.pathname.charAt(0)==="/",te=ue||ae||Z.host&&T.pathname,Se=te,De=Z.pathname&&Z.pathname.split("/")||[],Fe=T.pathname&&T.pathname.split("/")||[],Ke=Z.protocol&&!Q[Z.protocol];if(Ke&&(Z.hostname="",Z.port=null,Z.host&&(De[0]===""?De[0]=Z.host:De.unshift(Z.host)),Z.host="",T.protocol&&(T.hostname=null,T.port=null,T.host&&(Fe[0]===""?Fe[0]=T.host:Fe.unshift(T.host)),T.host=null),te=te&&(Fe[0]===""||De[0]==="")),ue)Z.host=T.host||T.host===""?T.host:Z.host,Z.hostname=T.hostname||T.hostname===""?T.hostname:Z.hostname,Z.search=T.search,Z.query=T.query,De=Fe;else if(Fe.length)De||(De=[]),De.pop(),De=De.concat(Fe),Z.search=T.search,Z.query=T.query;else if(!d.isNullOrUndefined(T.search)){if(Ke){Z.hostname=Z.host=De.shift();var et=Z.host&&Z.host.indexOf("@")>0?Z.host.split("@"):!1;et&&(Z.auth=et.shift(),Z.host=Z.hostname=et.shift())}return Z.search=T.search,Z.query=T.query,(!d.isNull(Z.pathname)||!d.isNull(Z.search))&&(Z.path=(Z.pathname?Z.pathname:"")+(Z.search?Z.search:"")),Z.href=Z.format(),Z}if(!De.length)return Z.pathname=null,Z.search?Z.path="/"+Z.search:Z.path=null,Z.href=Z.format(),Z;for(var Ie=De.slice(-1)[0],dt=(Z.host||T.host||De.length>1)&&(Ie==="."||Ie==="..")||Ie==="",Ye=0,Pe=De.length;Pe>=0;Pe--)Ie=De[Pe],Ie==="."?De.splice(Pe,1):Ie===".."?(De.splice(Pe,1),Ye++):Ye&&(De.splice(Pe,1),Ye--);if(!te&&!Se)for(;Ye--;Ye)De.unshift("..");te&&De[0]!==""&&(!De[0]||De[0].charAt(0)!=="/")&&De.unshift(""),dt&&De.join("/").substr(-1)!=="/"&&De.push("");var Le=De[0]===""||De[0]&&De[0].charAt(0)==="/";if(Ke){Z.hostname=Z.host=Le?"":De.length?De.shift():"";var et=Z.host&&Z.host.indexOf("@")>0?Z.host.split("@"):!1;et&&(Z.auth=et.shift(),Z.host=Z.hostname=et.shift())}return te=te||Z.host&&De.length,te&&!Le&&De.unshift(""),De.length?Z.pathname=De.join("/"):(Z.pathname=null,Z.path=null),(!d.isNull(Z.pathname)||!d.isNull(Z.search))&&(Z.path=(Z.pathname?Z.pathname:"")+(Z.search?Z.search:"")),Z.auth=T.auth||Z.auth,Z.slashes=Z.slashes||T.slashes,Z.href=Z.format(),Z},F.prototype.parseHost=function(){var T=this.host,ee=D.exec(T);ee&&(ee=ee[0],ee!==":"&&(this.port=ee.substr(1)),T=T.substr(0,T.length-ee.length)),T&&(this.hostname=T)}},{"./util":239,punycode:209,querystring:212}],239:[function(l,V,N){"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(l,V,N){(function(y){V.exports=d;function d(M,D){if(F("noDeprecation"))return M;var E=!1;function g(){if(!E){if(F("throwDeprecation"))throw new Error(D);F("traceDeprecation")?console.trace(D):console.warn(D),E=!0}return M.apply(this,arguments)}return g}function F(M){try{if(!y.localStorage)return!1}catch(E){return!1}var D=y.localStorage[M];return D==null?!1:String(D).toLowerCase()==="true"}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],241:[function(l,V,N){typeof Object.create=="function"?V.exports=function(d,F){d.super_=F,d.prototype=Object.create(F.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}})}:V.exports=function(d,F){d.super_=F;var M=function(){};M.prototype=F.prototype,d.prototype=new M,d.prototype.constructor=d}},{}],242:[function(l,V,N){V.exports=function(d){return d&&typeof d=="object"&&typeof d.copy=="function"&&typeof d.fill=="function"&&typeof d.readUInt8=="function"}},{}],243:[function(l,V,N){(function(y,d){var F=/%[sdj%]/g;N.format=function(ie){if(!U(ie)){for(var H=[],ae=0;ae<arguments.length;ae++)H.push(E(arguments[ae]));return H.join(" ")}for(var ae=1,ue=arguments,te=ue.length,Se=String(ie).replace(F,function(Fe){if(Fe==="%%")return"%";if(ae>=te)return Fe;switch(Fe){case"%s":return String(ue[ae++]);case"%d":return Number(ue[ae++]);case"%j":try{return JSON.stringify(ue[ae++])}catch(Ke){return"[Circular]"}default:return Fe}}),De=ue[ae];ae<te;De=ue[++ae])G(De)||!Z(De)?Se+=" "+De:Se+=" "+E(De);return Se},N.deprecate=function(ie,H){if(T(d.process))return function(){return N.deprecate(ie,H).apply(this,arguments)};if(y.noDeprecation===!0)return ie;var ae=!1;function ue(){if(!ae){if(y.throwDeprecation)throw new Error(H);y.traceDeprecation?console.trace(H):console.error(H),ae=!0}return ie.apply(this,arguments)}return ue};var M={},D;N.debuglog=function(ie){if(T(D)&&(D=y.env.NODE_DEBUG||""),ie=ie.toUpperCase(),!M[ie])if(new RegExp("\\b"+ie+"\\b","i").test(D)){var H=y.pid;M[ie]=function(){var ae=N.format.apply(N,arguments);console.error("%s %d: %s",ie,H,ae)}}else M[ie]=function(){};return M[ie]};function E(ie,H){var ae={seen:[],stylize:h};return arguments.length>=3&&(ae.depth=arguments[2]),arguments.length>=4&&(ae.colors=arguments[3]),Q(H)?ae.showHidden=H:H&&N._extend(ae,H),T(ae.showHidden)&&(ae.showHidden=!1),T(ae.depth)&&(ae.depth=2),T(ae.colors)&&(ae.colors=!1),T(ae.customInspect)&&(ae.customInspect=!0),ae.colors&&(ae.stylize=g),p(ae,ie,ae.depth)}N.inspect=E,E.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},E.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function g(ie,H){var ae=E.styles[H];return ae?"["+E.colors[ae][0]+"m"+ie+"["+E.colors[ae][1]+"m":ie}function h(ie,H){return ie}function b(ie){var H={};return ie.forEach(function(ae,ue){H[ae]=!0}),H}function p(ie,H,ae){if(ie.customInspect&&H&&re(H.inspect)&&H.inspect!==N.inspect&&!(H.constructor&&H.constructor.prototype===H)){var ue=H.inspect(ae,ie);return U(ue)||(ue=p(ie,ue,ae)),ue}var te=v(ie,H);if(te)return te;var Se=Object.keys(H),De=b(Se);if(ie.showHidden&&(Se=Object.getOwnPropertyNames(H)),X(H)&&(Se.indexOf("message")>=0||Se.indexOf("description")>=0))return I(H);if(Se.length===0){if(re(H)){var Fe=H.name?": "+H.name:"";return ie.stylize("[Function"+Fe+"]","special")}if(ee(H))return ie.stylize(RegExp.prototype.toString.call(H),"regexp");if(_(H))return ie.stylize(Date.prototype.toString.call(H),"date");if(X(H))return I(H)}var Ke="",et=!1,Ie=["{","}"];if(B(H)&&(et=!0,Ie=["[","]"]),re(H)){var dt=H.name?": "+H.name:"";Ke=" [Function"+dt+"]"}if(ee(H)&&(Ke=" "+RegExp.prototype.toString.call(H)),_(H)&&(Ke=" "+Date.prototype.toUTCString.call(H)),X(H)&&(Ke=" "+I(H)),Se.length===0&&(!et||H.length==0))return Ie[0]+Ke+Ie[1];if(ae<0)return ee(H)?ie.stylize(RegExp.prototype.toString.call(H),"regexp"):ie.stylize("[Object]","special");ie.seen.push(H);var Ye;return et?Ye=x(ie,H,ae,De,Se):Ye=Se.map(function(Pe){return S(ie,H,ae,De,Pe,et)}),ie.seen.pop(),W(Ye,Ke,Ie)}function v(ie,H){if(T(H))return ie.stylize("undefined","undefined");if(U(H)){var ae="'"+JSON.stringify(H).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ie.stylize(ae,"string")}if(J(H))return ie.stylize(""+H,"number");if(Q(H))return ie.stylize(""+H,"boolean");if(G(H))return ie.stylize("null","null")}function I(ie){return"["+Error.prototype.toString.call(ie)+"]"}function x(ie,H,ae,ue,te){for(var Se=[],De=0,Fe=H.length;De<Fe;++De)z(H,String(De))?Se.push(S(ie,H,ae,ue,String(De),!0)):Se.push("");return te.forEach(function(Ke){Ke.match(/^\d+$/)||Se.push(S(ie,H,ae,ue,Ke,!0))}),Se}function S(ie,H,ae,ue,te,Se){var De,Fe,Ke;if(Ke=Object.getOwnPropertyDescriptor(H,te)||{value:H[te]},Ke.get?Ke.set?Fe=ie.stylize("[Getter/Setter]","special"):Fe=ie.stylize("[Getter]","special"):Ke.set&&(Fe=ie.stylize("[Setter]","special")),z(ue,te)||(De="["+te+"]"),Fe||(ie.seen.indexOf(Ke.value)<0?(G(ae)?Fe=p(ie,Ke.value,null):Fe=p(ie,Ke.value,ae-1),Fe.indexOf(`
|
|
|
`)>-1&&(Se?Fe=Fe.split(`
|
|
|
`).map(function(et){return" "+et}).join(`
|
|
|
`).substr(2):Fe=`
|
|
|
`+Fe.split(`
|
|
|
`).map(function(et){return" "+et}).join(`
|
|
|
`))):Fe=ie.stylize("[Circular]","special")),T(De)){if(Se&&te.match(/^\d+$/))return Fe;De=JSON.stringify(""+te),De.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(De=De.substr(1,De.length-2),De=ie.stylize(De,"name")):(De=De.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),De=ie.stylize(De,"string"))}return De+": "+Fe}function W(ie,H,ae){var ue=0,te=ie.reduce(function(Se,De){return ue++,De.indexOf(`
|
|
|
`)>=0&&ue++,Se+De.replace(/\u001b\[\d\d?m/g,"").length+1},0);return te>60?ae[0]+(H===""?"":H+`
|
|
|
`)+" "+ie.join(`,
|
|
|
`)+" "+ae[1]:ae[0]+H+" "+ie.join(", ")+" "+ae[1]}function B(ie){return Array.isArray(ie)}N.isArray=B;function Q(ie){return typeof ie=="boolean"}N.isBoolean=Q;function G(ie){return ie===null}N.isNull=G;function $(ie){return ie==null}N.isNullOrUndefined=$;function J(ie){return typeof ie=="number"}N.isNumber=J;function U(ie){return typeof ie=="string"}N.isString=U;function j(ie){return typeof ie=="symbol"}N.isSymbol=j;function T(ie){return ie===void 0}N.isUndefined=T;function ee(ie){return Z(ie)&&de(ie)==="[object RegExp]"}N.isRegExp=ee;function Z(ie){return typeof ie=="object"&&ie!==null}N.isObject=Z;function _(ie){return Z(ie)&&de(ie)==="[object Date]"}N.isDate=_;function X(ie){return Z(ie)&&(de(ie)==="[object Error]"||ie instanceof Error)}N.isError=X;function re(ie){return typeof ie=="function"}N.isFunction=re;function me(ie){return ie===null||typeof ie=="boolean"||typeof ie=="number"||typeof ie=="string"||typeof ie=="symbol"||typeof ie=="undefined"}N.isPrimitive=me,N.isBuffer=l("./support/isBuffer");function de(ie){return Object.prototype.toString.call(ie)}function we(ie){return ie<10?"0"+ie.toString(10):ie.toString(10)}var ge=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ke(){var ie=new Date,H=[we(ie.getHours()),we(ie.getMinutes()),we(ie.getSeconds())].join(":");return[ie.getDate(),ge[ie.getMonth()],H].join(" ")}N.log=function(){console.log("%s - %s",ke(),N.format.apply(N,arguments))},N.inherits=l("inherits"),N._extend=function(ie,H){if(!H||!Z(H))return ie;for(var ae=Object.keys(H),ue=ae.length;ue--;)ie[ae[ue]]=H[ae[ue]];return ie};function z(ie,H){return Object.prototype.hasOwnProperty.call(ie,H)}}).call(this,l("_process"),typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./support/isBuffer":242,_process:208,inherits:241}],244:[function(l,V,N){"use strict";(function(){"use strict";N.stripBOM=function(y){return y[0]==="\uFEFF"?y.substring(1):y}}).call(void 0)},{}],245:[function(l,V,N){"use strict";var y=l("babel-runtime/helpers/typeof"),d=D(y),F=l("babel-runtime/core-js/object/keys"),M=D(F);function D(E){return E&&E.__esModule?E:{default:E}}(function(){"use strict";var E,g,h,b,p,v={}.hasOwnProperty;E=l("xmlbuilder"),g=l("./defaults").defaults,b=function(x){return typeof x=="string"&&(x.indexOf("&")>=0||x.indexOf(">")>=0||x.indexOf("<")>=0)},p=function(x){return"<![CDATA["+h(x)+"]]>"},h=function(x){return x.replace("]]>","]]]]><![CDATA[>")},N.Builder=function(){function I(x){var S,W,B;this.options={},W=g["0.2"];for(S in W){if(!v.call(W,S))continue;B=W[S],this.options[S]=B}for(S in x){if(!v.call(x,S))continue;B=x[S],this.options[S]=B}}return I.prototype.buildObject=function(x){var S,W,B,Q,G;return S=this.options.attrkey,W=this.options.charkey,(0,M.default)(x).length===1&&this.options.rootName===g["0.2"].rootName?(G=(0,M.default)(x)[0],x=x[G]):G=this.options.rootName,B=function($){return function(J,U){var j,T,ee,Z,_,X;if((typeof U=="undefined"?"undefined":(0,d.default)(U))!=="object")$.options.cdata&&b(U)?J.raw(p(U)):J.txt(U);else if(Array.isArray(U))for(Z in U){if(!v.call(U,Z))continue;T=U[Z];for(_ in T)ee=T[_],J=B(J.ele(_),ee).up()}else for(_ in U){if(!v.call(U,_))continue;if(T=U[_],_===S){if((typeof T=="undefined"?"undefined":(0,d.default)(T))==="object")for(j in T)X=T[j],J=J.att(j,X)}else if(_===W)$.options.cdata&&b(T)?J=J.raw(p(T)):J=J.txt(T);else if(Array.isArray(T))for(Z in T){if(!v.call(T,Z))continue;ee=T[Z],typeof ee=="string"?$.options.cdata&&b(ee)?J=J.ele(_).raw(p(ee)).up():J=J.ele(_,ee).up():J=B(J.ele(_),ee).up()}else(typeof T=="undefined"?"undefined":(0,d.default)(T))==="object"?J=B(J.ele(_),T).up():typeof T=="string"&&$.options.cdata&&b(T)?J=J.ele(_).raw(p(T)).up():(T==null&&(T=""),J=J.ele(_,T.toString()).up())}return J}}(this),Q=E.create(G,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),B(Q,x).end(this.options.renderOpts)},I}()}).call(void 0)},{"./defaults":246,"babel-runtime/core-js/object/keys":60,"babel-runtime/helpers/typeof":67,xmlbuilder:282}],246:[function(l,V,N){"use strict";(function(){N.defaults={"0.1":{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},"0.2":{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:`
|
|
|
`},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(void 0)},{}],247:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/promise"),d=b(y),F=l("babel-runtime/core-js/object/get-own-property-names"),M=b(F),D=l("babel-runtime/core-js/object/keys"),E=b(D),g=l("babel-runtime/helpers/typeof"),h=b(g);function b(p){return p&&p.__esModule?p:{default:p}}(function(){"use strict";var p,v,I,x,S,W,B,Q,G=function(j,T){return function(){return j.apply(T,arguments)}},$=function(j,T){for(var ee in T)J.call(T,ee)&&(j[ee]=T[ee]);function Z(){this.constructor=j}return Z.prototype=T.prototype,j.prototype=new Z,j.__super__=T.prototype,j},J={}.hasOwnProperty;B=l("sax"),I=l("events"),p=l("./bom"),W=l("./processors"),Q=l("timers").setImmediate,v=l("./defaults").defaults,x=function(j){return(typeof j=="undefined"?"undefined":(0,h.default)(j))==="object"&&j!=null&&(0,E.default)(j).length===0},S=function(j,T,ee){var Z,_,X;for(Z=0,_=j.length;Z<_;Z++)X=j[Z],T=X(T,ee);return T},N.Parser=function(U){$(j,U);function j(T){this.parseStringPromise=G(this.parseStringPromise,this),this.parseString=G(this.parseString,this),this.reset=G(this.reset,this),this.assignOrPush=G(this.assignOrPush,this),this.processAsync=G(this.processAsync,this);var ee,Z,_;if(!(this instanceof N.Parser))return new N.Parser(T);this.options={},Z=v["0.2"];for(ee in Z){if(!J.call(Z,ee))continue;_=Z[ee],this.options[ee]=_}for(ee in T){if(!J.call(T,ee))continue;_=T[ee],this.options[ee]=_}this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(W.normalize)),this.reset()}return j.prototype.processAsync=function(){var T,ee;try{return this.remaining.length<=this.options.chunkSize?(T=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(T),this.saxParser.close()):(T=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(T),Q(this.processAsync))}catch(Z){if(ee=Z,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(ee)}},j.prototype.assignOrPush=function(T,ee,Z){return ee in T?(T[ee]instanceof Array||(T[ee]=[T[ee]]),T[ee].push(Z)):this.options.explicitArray?T[ee]=[Z]:T[ee]=Z},j.prototype.reset=function(){var T,ee,Z,_;return this.removeAllListeners(),this.saxParser=B.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(X){return function(re){if(X.saxParser.resume(),!X.saxParser.errThrown)return X.saxParser.errThrown=!0,X.emit("error",re)}}(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,_=[],T=this.options.attrkey,ee=this.options.charkey,this.saxParser.onopentag=function(X){return function(re){var me,de,we,ge,ke;if(we={},we[ee]="",!X.options.ignoreAttrs){ke=re.attributes;for(me in ke){if(!J.call(ke,me))continue;!(T in we)&&!X.options.mergeAttrs&&(we[T]={}),de=X.options.attrValueProcessors?S(X.options.attrValueProcessors,re.attributes[me],me):re.attributes[me],ge=X.options.attrNameProcessors?S(X.options.attrNameProcessors,me):me,X.options.mergeAttrs?X.assignOrPush(we,ge,de):we[T][ge]=de}}return we["#name"]=X.options.tagNameProcessors?S(X.options.tagNameProcessors,re.name):re.name,X.options.xmlns&&(we[X.options.xmlnskey]={uri:re.uri,local:re.local}),_.push(we)}}(this),this.saxParser.onclosetag=function(X){return function(){var re,me,de,we,ge,ke,z,ie,H,ae;if(ke=_.pop(),ge=ke["#name"],(!X.options.explicitChildren||!X.options.preserveChildrenOrder)&&delete ke["#name"],ke.cdata===!0&&(re=ke.cdata,delete ke.cdata),H=_[_.length-1],ke[ee].match(/^\s*$/)&&!re?(me=ke[ee],delete ke[ee]):(X.options.trim&&(ke[ee]=ke[ee].trim()),X.options.normalize&&(ke[ee]=ke[ee].replace(/\s{2,}/g," ").trim()),ke[ee]=X.options.valueProcessors?S(X.options.valueProcessors,ke[ee],ge):ke[ee],(0,E.default)(ke).length===1&&ee in ke&&!X.EXPLICIT_CHARKEY&&(ke=ke[ee])),x(ke)&&(ke=X.options.emptyTag!==""?X.options.emptyTag:me),X.options.validator!=null&&(ae="/"+function(){var ue,te,Se;for(Se=[],ue=0,te=_.length;ue<te;ue++)we=_[ue],Se.push(we["#name"]);return Se}().concat(ge).join("/"),function(){var ue;try{return ke=X.options.validator(ae,H&&H[ge],ke)}catch(te){return ue=te,X.emit("error",ue)}}()),X.options.explicitChildren&&!X.options.mergeAttrs&&(typeof ke=="undefined"?"undefined":(0,h.default)(ke))==="object"){if(!X.options.preserveChildrenOrder)we={},X.options.attrkey in ke&&(we[X.options.attrkey]=ke[X.options.attrkey],delete ke[X.options.attrkey]),!X.options.charsAsChildren&&X.options.charkey in ke&&(we[X.options.charkey]=ke[X.options.charkey],delete ke[X.options.charkey]),(0,M.default)(ke).length>0&&(we[X.options.childkey]=ke),ke=we;else if(H){H[X.options.childkey]=H[X.options.childkey]||[],z={};for(de in ke){if(!J.call(ke,de))continue;z[de]=ke[de]}H[X.options.childkey].push(z),delete ke["#name"],(0,E.default)(ke).length===1&&ee in ke&&!X.EXPLICIT_CHARKEY&&(ke=ke[ee])}}return _.length>0?X.assignOrPush(H,ge,ke):(X.options.explicitRoot&&(ie=ke,ke={},ke[ge]=ie),X.resultObject=ke,X.saxParser.ended=!0,X.emit("end",X.resultObject))}}(this),Z=function(X){return function(re){var me,de;if(de=_[_.length-1],de)return de[ee]+=re,X.options.explicitChildren&&X.options.preserveChildrenOrder&&X.options.charsAsChildren&&(X.options.includeWhiteChars||re.replace(/\\n/g,"").trim()!=="")&&(de[X.options.childkey]=de[X.options.childkey]||[],me={"#name":"__text__"},me[ee]=re,X.options.normalize&&(me[ee]=me[ee].replace(/\s{2,}/g," ").trim()),de[X.options.childkey].push(me)),de}}(this),this.saxParser.ontext=Z,this.saxParser.oncdata=function(X){return function(re){var me;if(me=Z(re),me)return me.cdata=!0}}(this)},j.prototype.parseString=function(T,ee){var Z;ee!=null&&typeof ee=="function"&&(this.on("end",function(_){return this.reset(),ee(null,_)}),this.on("error",function(_){return this.reset(),ee(_)}));try{return T=T.toString(),T.trim()===""?(this.emit("end",null),!0):(T=p.stripBOM(T),this.options.async?(this.remaining=T,Q(this.processAsync),this.saxParser):this.saxParser.write(T).close())}catch(_){if(Z=_,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw Z}else return this.emit("error",Z),this.saxParser.errThrown=!0}},j.prototype.parseStringPromise=function(T){return new d.default(function(ee){return function(Z,_){return ee.parseString(T,function(X,re){return X?_(X):Z(re)})}}(this))},j}(I),N.parseString=function(U,j,T){var ee,Z,_;return T!=null?(typeof T=="function"&&(ee=T),(typeof j=="undefined"?"undefined":(0,h.default)(j))==="object"&&(Z=j)):(typeof j=="function"&&(ee=j),Z={}),_=new N.Parser(Z),_.parseString(U,ee)},N.parseStringPromise=function(U,j){var T,ee;return(typeof j=="undefined"?"undefined":(0,h.default)(j))==="object"&&(T=j),ee=new N.Parser(T),ee.parseStringPromise(U)}}).call(void 0)},{"./bom":244,"./defaults":246,"./processors":248,"babel-runtime/core-js/object/get-own-property-names":58,"babel-runtime/core-js/object/keys":60,"babel-runtime/core-js/promise":61,"babel-runtime/helpers/typeof":67,events:192,sax:229,timers:236}],248:[function(l,V,N){"use strict";(function(){"use strict";var y;y=new RegExp(/(?!xmlns)^.*:/),N.normalize=function(d){return d.toLowerCase()},N.firstCharLowerCase=function(d){return d.charAt(0).toLowerCase()+d.slice(1)},N.stripPrefix=function(d){return d.replace(y,"")},N.parseNumbers=function(d){return isNaN(d)||(d=d%1===0?parseInt(d,10):parseFloat(d)),d},N.parseBooleans=function(d){return/^(?:true|false)$/i.test(d)&&(d=d.toLowerCase()==="true"),d}}).call(void 0)},{}],249:[function(l,V,N){"use strict";(function(){"use strict";var y,d,F,M,D=function(h,b){for(var p in b)E.call(b,p)&&(h[p]=b[p]);function v(){this.constructor=h}return v.prototype=b.prototype,h.prototype=new v,h.__super__=b.prototype,h},E={}.hasOwnProperty;d=l("./defaults"),y=l("./builder"),F=l("./parser"),M=l("./processors"),N.defaults=d.defaults,N.processors=M,N.ValidationError=function(g){D(h,g);function h(b){this.message=b}return h}(Error),N.Builder=y.Builder,N.Parser=F.Parser,N.parseString=F.parseString,N.parseStringPromise=F.parseStringPromise}).call(void 0)},{"./builder":245,"./defaults":246,"./parser":247,"./processors":248}],250:[function(l,V,N){"use strict";(function(){V.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(void 0)},{}],251:[function(l,V,N){"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(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/get-prototype-of"),d=g(y),F=l("babel-runtime/helpers/typeof"),M=g(F),D=l("babel-runtime/core-js/object/assign"),E=g(D);function g(h){return h&&h.__esModule?h:{default:h}}(function(){var h,b,p,v,I,x,S,W=[].slice,B={}.hasOwnProperty;h=function(){var G,$,J,U,j,T;if(T=arguments[0],j=2<=arguments.length?W.call(arguments,1):[],I(E.default))E.default.apply(null,arguments);else for(G=0,J=j.length;G<J;G++)if(U=j[G],U!=null)for($ in U){if(!B.call(U,$))continue;T[$]=U[$]}return T},I=function(G){return!!G&&Object.prototype.toString.call(G)==="[object Function]"},x=function(G){var $;return!!G&&(($=typeof G=="undefined"?"undefined":(0,M.default)(G))==="function"||$==="object")},p=function(G){return I(Array.isArray)?Array.isArray(G):Object.prototype.toString.call(G)==="[object Array]"},v=function(G){var $;if(p(G))return!G.length;for($ in G){if(!B.call(G,$))continue;return!1}return!0},S=function(G){var $,J;return x(G)&&(J=(0,d.default)(G))&&($=J.constructor)&&typeof $=="function"&&$ instanceof $&&Function.prototype.toString.call($)===Function.prototype.toString.call(Object)},b=function(G){return I(G.valueOf)?G.valueOf():G},V.exports.assign=h,V.exports.isFunction=I,V.exports.isObject=x,V.exports.isArray=p,V.exports.isEmpty=v,V.exports.isPlainObject=S,V.exports.getValue=b}).call(void 0)},{"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/object/get-prototype-of":59,"babel-runtime/helpers/typeof":67}],253:[function(l,V,N){"use strict";(function(){V.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(void 0)},{}],254:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E;M=l("./NodeType"),E=l("./XMLNode"),V.exports=D=function(){function g(h,b,p){if(this.parent=h,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),b==null)throw new Error("Missing attribute name. "+this.debugInfo(b));this.name=this.stringify.name(b),this.value=this.stringify.attValue(p),this.type=M.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(g.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(g.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(g.prototype,"textContent",{get:function(){return this.value},set:function(b){return this.value=b||""}}),Object.defineProperty(g.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(g.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(g.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(g.prototype,"specified",{get:function(){return!0}}),g.prototype.clone=function(){return(0,d.default)(this)},g.prototype.toString=function(h){return this.options.writer.attribute(this,this.options.writer.filterOptions(h))},g.prototype.debugInfo=function(h){return h=h||this.name,h==null?"parent: <"+this.parent.name+">":"attribute: {"+h+"}, parent: <"+this.parent.name+">"},g.prototype.isEqualNode=function(h){return h.namespaceURI!==this.namespaceURI||(h.prefix!==this.prefix||h.localName!==this.localName)?!1:!(h.value!==this.value)},g}()}).call(void 0)},{"./NodeType":251,"./XMLNode":273,"babel-runtime/core-js/object/create":55}],255:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E,g=function(p,v){for(var I in v)h.call(v,I)&&(p[I]=v[I]);function x(){this.constructor=p}return x.prototype=v.prototype,p.prototype=new x,p.__super__=v.prototype,p},h={}.hasOwnProperty;M=l("./NodeType"),E=l("./XMLCharacterData"),V.exports=D=function(b){g(p,b);function p(v,I){if(p.__super__.constructor.call(this,v),I==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=M.CData,this.value=this.stringify.cdata(I)}return p.prototype.clone=function(){return(0,d.default)(this)},p.prototype.toString=function(v){return this.options.writer.cdata(this,this.options.writer.filterOptions(v))},p}(E)}).call(void 0)},{"./NodeType":251,"./XMLCharacterData":256,"babel-runtime/core-js/object/create":55}],256:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E=function(b,p){for(var v in p)g.call(p,v)&&(b[v]=p[v]);function I(){this.constructor=b}return I.prototype=p.prototype,b.prototype=new I,b.__super__=p.prototype,b},g={}.hasOwnProperty;D=l("./XMLNode"),V.exports=M=function(h){E(b,h);function b(p){b.__super__.constructor.call(this,p),this.value=""}return Object.defineProperty(b.prototype,"data",{get:function(){return this.value},set:function(v){return this.value=v||""}}),Object.defineProperty(b.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(b.prototype,"textContent",{get:function(){return this.value},set:function(v){return this.value=v||""}}),b.prototype.clone=function(){return(0,d.default)(this)},b.prototype.substringData=function(p,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.appendData=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.insertData=function(p,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.deleteData=function(p,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.replaceData=function(p,v,I){throw new Error("This DOM method is not implemented."+this.debugInfo())},b.prototype.isEqualNode=function(p){return b.__super__.isEqualNode.apply(this,arguments).isEqualNode(p)?!(p.data!==this.data):!1},b}(D)}).call(void 0)},{"./XMLNode":273,"babel-runtime/core-js/object/create":55}],257:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E,g=function(p,v){for(var I in v)h.call(v,I)&&(p[I]=v[I]);function x(){this.constructor=p}return x.prototype=v.prototype,p.prototype=new x,p.__super__=v.prototype,p},h={}.hasOwnProperty;M=l("./NodeType"),D=l("./XMLCharacterData"),V.exports=E=function(b){g(p,b);function p(v,I){if(p.__super__.constructor.call(this,v),I==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=M.Comment,this.value=this.stringify.comment(I)}return p.prototype.clone=function(){return(0,d.default)(this)},p.prototype.toString=function(v){return this.options.writer.comment(this,this.options.writer.filterOptions(v))},p}(D)}).call(void 0)},{"./NodeType":251,"./XMLCharacterData":256,"babel-runtime/core-js/object/create":55}],258:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/keys"),d=D(y),F=l("babel-runtime/core-js/object/create"),M=D(F);function D(E){return E&&E.__esModule?E:{default:E}}(function(){var E,g,h;g=l("./XMLDOMErrorHandler"),h=l("./XMLDOMStringList"),V.exports=E=function(){function b(){var p;this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new g,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=p=(0,M.default)(this.defaultParams)}return Object.defineProperty(b.prototype,"parameterNames",{get:function(){return new h((0,d.default)(this.defaultParams))}}),b.prototype.getParameter=function(p){return this.params.hasOwnProperty(p)?this.params[p]:null},b.prototype.canSetParameter=function(p,v){return!0},b.prototype.setParameter=function(p,v){return v!=null?this.params[p]=v:delete this.params[p]},b}()}).call(void 0)},{"./XMLDOMErrorHandler":259,"./XMLDOMStringList":261,"babel-runtime/core-js/object/create":55,"babel-runtime/core-js/object/keys":60}],259:[function(l,V,N){"use strict";(function(){var y;V.exports=y=function(){function d(){}return d.prototype.handleError=function(F){throw new Error(F)},d}()}).call(void 0)},{}],260:[function(l,V,N){"use strict";(function(){var y;V.exports=y=function(){function d(){}return d.prototype.hasFeature=function(F,M){return!0},d.prototype.createDocumentType=function(F,M,D){throw new Error("This DOM method is not implemented.")},d.prototype.createDocument=function(F,M,D){throw new Error("This DOM method is not implemented.")},d.prototype.createHTMLDocument=function(F){throw new Error("This DOM method is not implemented.")},d.prototype.getFeature=function(F,M){throw new Error("This DOM method is not implemented.")},d}()}).call(void 0)},{}],261:[function(l,V,N){"use strict";(function(){var y;V.exports=y=function(){function d(F){this.arr=F||[]}return Object.defineProperty(d.prototype,"length",{get:function(){return this.arr.length}}),d.prototype.item=function(F){return this.arr[F]||null},d.prototype.contains=function(F){return this.arr.indexOf(F)!==-1},d}()}).call(void 0)},{}],262:[function(l,V,N){"use strict";(function(){var y,d,F,M=function(g,h){for(var b in h)D.call(h,b)&&(g[b]=h[b]);function p(){this.constructor=g}return p.prototype=h.prototype,g.prototype=new p,g.__super__=h.prototype,g},D={}.hasOwnProperty;F=l("./XMLNode"),y=l("./NodeType"),V.exports=d=function(E){M(g,E);function g(h,b,p,v,I,x){if(g.__super__.constructor.call(this,h),b==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(p==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(b));if(!v)throw new Error("Missing DTD attribute type. "+this.debugInfo(b));if(!I)throw new Error("Missing DTD attribute default. "+this.debugInfo(b));if(I.indexOf("#")!==0&&(I="#"+I),!I.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(b));if(x&&!I.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(b));this.elementName=this.stringify.name(b),this.type=y.AttributeDeclaration,this.attributeName=this.stringify.name(p),this.attributeType=this.stringify.dtdAttType(v),x&&(this.defaultValue=this.stringify.dtdAttDefault(x)),this.defaultValueType=I}return g.prototype.toString=function(h){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(h))},g}(F)}).call(void 0)},{"./NodeType":251,"./XMLNode":273}],263:[function(l,V,N){"use strict";(function(){var y,d,F,M=function(g,h){for(var b in h)D.call(h,b)&&(g[b]=h[b]);function p(){this.constructor=g}return p.prototype=h.prototype,g.prototype=new p,g.__super__=h.prototype,g},D={}.hasOwnProperty;F=l("./XMLNode"),y=l("./NodeType"),V.exports=d=function(E){M(g,E);function g(h,b,p){if(g.__super__.constructor.call(this,h),b==null)throw new Error("Missing DTD element name. "+this.debugInfo());p||(p="(#PCDATA)"),Array.isArray(p)&&(p="("+p.join(",")+")"),this.name=this.stringify.name(b),this.type=y.ElementDeclaration,this.value=this.stringify.dtdElementValue(p)}return g.prototype.toString=function(h){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(h))},g}(F)}).call(void 0)},{"./NodeType":251,"./XMLNode":273}],264:[function(l,V,N){"use strict";(function(){var y,d,F,M,D=function(h,b){for(var p in b)E.call(b,p)&&(h[p]=b[p]);function v(){this.constructor=h}return v.prototype=b.prototype,h.prototype=new v,h.__super__=b.prototype,h},E={}.hasOwnProperty;M=l("./Utility").isObject,F=l("./XMLNode"),y=l("./NodeType"),V.exports=d=function(g){D(h,g);function h(b,p,v,I){if(h.__super__.constructor.call(this,b),v==null)throw new Error("Missing DTD entity name. "+this.debugInfo(v));if(I==null)throw new Error("Missing DTD entity value. "+this.debugInfo(v));if(this.pe=!!p,this.name=this.stringify.name(v),this.type=y.EntityDeclaration,!M(I))this.value=this.stringify.dtdEntityValue(I),this.internal=!0;else{if(!I.pubID&&!I.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(v));if(I.pubID&&!I.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(v));if(this.internal=!1,I.pubID!=null&&(this.pubID=this.stringify.dtdPubID(I.pubID)),I.sysID!=null&&(this.sysID=this.stringify.dtdSysID(I.sysID)),I.nData!=null&&(this.nData=this.stringify.dtdNData(I.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(v))}}return Object.defineProperty(h.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(h.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(h.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(h.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(h.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(h.prototype,"xmlVersion",{get:function(){return null}}),h.prototype.toString=function(b){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(b))},h}(F)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLNode":273}],265:[function(l,V,N){"use strict";(function(){var y,d,F,M=function(g,h){for(var b in h)D.call(h,b)&&(g[b]=h[b]);function p(){this.constructor=g}return p.prototype=h.prototype,g.prototype=new p,g.__super__=h.prototype,g},D={}.hasOwnProperty;F=l("./XMLNode"),y=l("./NodeType"),V.exports=d=function(E){M(g,E);function g(h,b,p){if(g.__super__.constructor.call(this,h),b==null)throw new Error("Missing DTD notation name. "+this.debugInfo(b));if(!p.pubID&&!p.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(b));this.name=this.stringify.name(b),this.type=y.NotationDeclaration,p.pubID!=null&&(this.pubID=this.stringify.dtdPubID(p.pubID)),p.sysID!=null&&(this.sysID=this.stringify.dtdSysID(p.sysID))}return Object.defineProperty(g.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(g.prototype,"systemId",{get:function(){return this.sysID}}),g.prototype.toString=function(h){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(h))},g}(F)}).call(void 0)},{"./NodeType":251,"./XMLNode":273}],266:[function(l,V,N){"use strict";(function(){var y,d,F,M,D=function(h,b){for(var p in b)E.call(b,p)&&(h[p]=b[p]);function v(){this.constructor=h}return v.prototype=b.prototype,h.prototype=new v,h.__super__=b.prototype,h},E={}.hasOwnProperty;M=l("./Utility").isObject,F=l("./XMLNode"),y=l("./NodeType"),V.exports=d=function(g){D(h,g);function h(b,p,v,I){var x;h.__super__.constructor.call(this,b),M(p)&&(x=p,p=x.version,v=x.encoding,I=x.standalone),p||(p="1.0"),this.type=y.Declaration,this.version=this.stringify.xmlVersion(p),v!=null&&(this.encoding=this.stringify.xmlEncoding(v)),I!=null&&(this.standalone=this.stringify.xmlStandalone(I))}return h.prototype.toString=function(b){return this.options.writer.declaration(this,this.options.writer.filterOptions(b))},h}(F)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLNode":273}],267:[function(l,V,N){"use strict";(function(){var y,d,F,M,D,E,g,h,b,p=function(x,S){for(var W in S)v.call(S,W)&&(x[W]=S[W]);function B(){this.constructor=x}return B.prototype=S.prototype,x.prototype=new B,x.__super__=S.prototype,x},v={}.hasOwnProperty;b=l("./Utility").isObject,h=l("./XMLNode"),y=l("./NodeType"),d=l("./XMLDTDAttList"),M=l("./XMLDTDEntity"),F=l("./XMLDTDElement"),D=l("./XMLDTDNotation"),g=l("./XMLNamedNodeMap"),V.exports=E=function(I){p(x,I);function x(S,W,B){var Q,G,$,J,U,j;if(x.__super__.constructor.call(this,S),this.type=y.DocType,S.children){for(J=S.children,G=0,$=J.length;G<$;G++)if(Q=J[G],Q.type===y.Element){this.name=Q.name;break}}this.documentObject=S,b(W)&&(U=W,W=U.pubID,B=U.sysID),B==null&&(j=[W,B],B=j[0],W=j[1]),W!=null&&(this.pubID=this.stringify.dtdPubID(W)),B!=null&&(this.sysID=this.stringify.dtdSysID(B))}return Object.defineProperty(x.prototype,"entities",{get:function(){var W,B,Q,G,$;for(G={},$=this.children,B=0,Q=$.length;B<Q;B++)W=$[B],W.type===y.EntityDeclaration&&!W.pe&&(G[W.name]=W);return new g(G)}}),Object.defineProperty(x.prototype,"notations",{get:function(){var W,B,Q,G,$;for(G={},$=this.children,B=0,Q=$.length;B<Q;B++)W=$[B],W.type===y.NotationDeclaration&&(G[W.name]=W);return new g(G)}}),Object.defineProperty(x.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(x.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(x.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),x.prototype.element=function(S,W){var B;return B=new F(this,S,W),this.children.push(B),this},x.prototype.attList=function(S,W,B,Q,G){var $;return $=new d(this,S,W,B,Q,G),this.children.push($),this},x.prototype.entity=function(S,W){var B;return B=new M(this,!1,S,W),this.children.push(B),this},x.prototype.pEntity=function(S,W){var B;return B=new M(this,!0,S,W),this.children.push(B),this},x.prototype.notation=function(S,W){var B;return B=new D(this,S,W),this.children.push(B),this},x.prototype.toString=function(S){return this.options.writer.docType(this,this.options.writer.filterOptions(S))},x.prototype.ele=function(S,W){return this.element(S,W)},x.prototype.att=function(S,W,B,Q,G){return this.attList(S,W,B,Q,G)},x.prototype.ent=function(S,W){return this.entity(S,W)},x.prototype.pent=function(S,W){return this.pEntity(S,W)},x.prototype.not=function(S,W){return this.notation(S,W)},x.prototype.up=function(){return this.root()||this.documentObject},x.prototype.isEqualNode=function(S){return x.__super__.isEqualNode.apply(this,arguments).isEqualNode(S)?S.name!==this.name||S.publicId!==this.publicId?!1:!(S.systemId!==this.systemId):!1},x}(h)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLDTDAttList":262,"./XMLDTDElement":263,"./XMLDTDEntity":264,"./XMLDTDNotation":265,"./XMLNamedNodeMap":272,"./XMLNode":273}],268:[function(l,V,N){"use strict";(function(){var y,d,F,M,D,E,g,h,b=function(I,x){for(var S in x)p.call(x,S)&&(I[S]=x[S]);function W(){this.constructor=I}return W.prototype=x.prototype,I.prototype=new W,I.__super__=x.prototype,I},p={}.hasOwnProperty;h=l("./Utility").isPlainObject,F=l("./XMLDOMImplementation"),d=l("./XMLDOMConfiguration"),D=l("./XMLNode"),y=l("./NodeType"),g=l("./XMLStringifier"),E=l("./XMLStringWriter"),V.exports=M=function(v){b(I,v);function I(x){I.__super__.constructor.call(this,null),this.name="#document",this.type=y.Document,this.documentURI=null,this.domConfig=new d,x||(x={}),x.writer||(x.writer=new E),this.options=x,this.stringify=new g(x)}return Object.defineProperty(I.prototype,"implementation",{value:new F}),Object.defineProperty(I.prototype,"doctype",{get:function(){var S,W,B,Q;for(Q=this.children,W=0,B=Q.length;W<B;W++)if(S=Q[W],S.type===y.DocType)return S;return null}}),Object.defineProperty(I.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(I.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(I.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(I.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===y.Declaration?this.children[0].encoding:null}}),Object.defineProperty(I.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===y.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(I.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===y.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(I.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(I.prototype,"origin",{get:function(){return null}}),Object.defineProperty(I.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(I.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(I.prototype,"contentType",{get:function(){return null}}),I.prototype.end=function(x){var S;return S={},x?h(x)&&(S=x,x=this.options.writer):x=this.options.writer,x.document(this,x.filterOptions(S))},I.prototype.toString=function(x){return this.options.writer.document(this,this.options.writer.filterOptions(x))},I.prototype.createElement=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createTextNode=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createComment=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createCDATASection=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createProcessingInstruction=function(x,S){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createAttribute=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createEntityReference=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.getElementsByTagName=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.importNode=function(x,S){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createElementNS=function(x,S){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createAttributeNS=function(x,S){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.getElementsByTagNameNS=function(x,S){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.getElementById=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.adoptNode=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.renameNode=function(x,S,W){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.getElementsByClassName=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createEvent=function(x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createNodeIterator=function(x,S,W){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.createTreeWalker=function(x,S,W){throw new Error("This DOM method is not implemented."+this.debugInfo())},I}(D)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLDOMConfiguration":258,"./XMLDOMImplementation":260,"./XMLNode":273,"./XMLStringWriter":278,"./XMLStringifier":279}],269:[function(l,V,N){"use strict";(function(){var y,d,F,M,D,E,g,h,b,p,v,I,x,S,W,B,Q,G,$,J,U,j,T,ee,Z={}.hasOwnProperty;ee=l("./Utility"),j=ee.isObject,U=ee.isFunction,T=ee.isPlainObject,J=ee.getValue,y=l("./NodeType"),I=l("./XMLDocument"),S=l("./XMLElement"),M=l("./XMLCData"),D=l("./XMLComment"),B=l("./XMLRaw"),$=l("./XMLText"),W=l("./XMLProcessingInstruction"),p=l("./XMLDeclaration"),v=l("./XMLDocType"),E=l("./XMLDTDAttList"),h=l("./XMLDTDEntity"),g=l("./XMLDTDElement"),b=l("./XMLDTDNotation"),F=l("./XMLAttribute"),G=l("./XMLStringifier"),Q=l("./XMLStringWriter"),d=l("./WriterState"),V.exports=x=function(){function _(X,re,me){var de;this.name="?xml",this.type=y.Document,X||(X={}),de={},X.writer?T(X.writer)&&(de=X.writer,X.writer=new Q):X.writer=new Q,this.options=X,this.writer=X.writer,this.writerOptions=this.writer.filterOptions(de),this.stringify=new G(X),this.onDataCallback=re||function(){},this.onEndCallback=me||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return _.prototype.createChildNode=function(X){var re,me,de,we,ge,ke,z,ie;switch(X.type){case y.CData:this.cdata(X.value);break;case y.Comment:this.comment(X.value);break;case y.Element:de={},z=X.attribs;for(me in z){if(!Z.call(z,me))continue;re=z[me],de[me]=re.value}this.node(X.name,de);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(ie=X.children,ge=0,ke=ie.length;ge<ke;ge++)we=ie[ge],this.createChildNode(we),we.type===y.Element&&this.up();return this},_.prototype.dummy=function(){return this},_.prototype.node=function(X,re,me){var de;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=J(X),re==null&&(re={}),re=J(re),j(re)||(de=[re,me],me=de[0],re=de[1]),this.currentNode=new S(this,X,re),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,me!=null&&this.text(me),this},_.prototype.element=function(X,re,me){var de,we,ge,ke,z,ie;if(this.currentNode&&this.currentNode.type===y.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(X)||j(X)||U(X))for(ke=this.options.noValidation,this.options.noValidation=!0,ie=new I(this.options).element("TEMP_ROOT"),ie.element(X),this.options.noValidation=ke,z=ie.children,we=0,ge=z.length;we<ge;we++)de=z[we],this.createChildNode(de),de.type===y.Element&&this.up();else this.node(X,re,me);return this},_.prototype.attribute=function(X,re){var me,de;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=J(X)),j(X))for(me in X){if(!Z.call(X,me))continue;de=X[me],this.attribute(me,de)}else U(re)&&(re=re.apply()),this.options.keepNullAttributes&&re==null?this.currentNode.attribs[X]=new F(this,X,""):re!=null&&(this.currentNode.attribs[X]=new F(this,X,re));return this},_.prototype.text=function(X){var re;return this.openCurrent(),re=new $(this,X),this.onData(this.writer.text(re,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.cdata=function(X){var re;return this.openCurrent(),re=new M(this,X),this.onData(this.writer.cdata(re,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.comment=function(X){var re;return this.openCurrent(),re=new D(this,X),this.onData(this.writer.comment(re,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.raw=function(X){var re;return this.openCurrent(),re=new B(this,X),this.onData(this.writer.raw(re,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.instruction=function(X,re){var me,de,we,ge,ke;if(this.openCurrent(),X!=null&&(X=J(X)),re!=null&&(re=J(re)),Array.isArray(X))for(me=0,ge=X.length;me<ge;me++)de=X[me],this.instruction(de);else if(j(X))for(de in X){if(!Z.call(X,de))continue;we=X[de],this.instruction(de,we)}else U(re)&&(re=re.apply()),ke=new W(this,X,re),this.onData(this.writer.processingInstruction(ke,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},_.prototype.declaration=function(X,re,me){var de;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return de=new p(this,X,re,me),this.onData(this.writer.declaration(de,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.doctype=function(X,re,me){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 v(this,re,me),this.currentNode.rootNodeName=X,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},_.prototype.dtdElement=function(X,re){var me;return this.openCurrent(),me=new g(this,X,re),this.onData(this.writer.dtdElement(me,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.attList=function(X,re,me,de,we){var ge;return this.openCurrent(),ge=new E(this,X,re,me,de,we),this.onData(this.writer.dtdAttList(ge,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.entity=function(X,re){var me;return this.openCurrent(),me=new h(this,!1,X,re),this.onData(this.writer.dtdEntity(me,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.pEntity=function(X,re){var me;return this.openCurrent(),me=new h(this,!0,X,re),this.onData(this.writer.dtdEntity(me,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.notation=function(X,re){var me;return this.openCurrent(),me=new b(this,X,re),this.onData(this.writer.dtdNotation(me,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},_.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},_.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},_.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},_.prototype.openNode=function(X){var re,me,de,we;if(!X.isOpen){if(!this.root&&this.currentLevel===0&&X.type===y.Element&&(this.root=X),me="",X.type===y.Element){this.writerOptions.state=d.OpenTag,me=this.writer.indent(X,this.writerOptions,this.currentLevel)+"<"+X.name,we=X.attribs;for(de in we){if(!Z.call(we,de))continue;re=we[de],me+=this.writer.attribute(re,this.writerOptions,this.currentLevel)}me+=(X.children?">":"/>")+this.writer.endline(X,this.writerOptions,this.currentLevel),this.writerOptions.state=d.InsideTag}else this.writerOptions.state=d.OpenTag,me=this.writer.indent(X,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+X.rootNodeName,X.pubID&&X.sysID?me+=' PUBLIC "'+X.pubID+'" "'+X.sysID+'"':X.sysID&&(me+=' SYSTEM "'+X.sysID+'"'),X.children?(me+=" [",this.writerOptions.state=d.InsideTag):(this.writerOptions.state=d.CloseTag,me+=">"),me+=this.writer.endline(X,this.writerOptions,this.currentLevel);return this.onData(me,this.currentLevel),X.isOpen=!0}},_.prototype.closeNode=function(X){var re;if(!X.isClosed)return re="",this.writerOptions.state=d.CloseTag,X.type===y.Element?re=this.writer.indent(X,this.writerOptions,this.currentLevel)+"</"+X.name+">"+this.writer.endline(X,this.writerOptions,this.currentLevel):re=this.writer.indent(X,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(X,this.writerOptions,this.currentLevel),this.writerOptions.state=d.None,this.onData(re,this.currentLevel),X.isClosed=!0},_.prototype.onData=function(X,re){return this.documentStarted=!0,this.onDataCallback(X,re+1)},_.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},_.prototype.debugInfo=function(X){return X==null?"":"node: <"+X+">"},_.prototype.ele=function(){return this.element.apply(this,arguments)},_.prototype.nod=function(X,re,me){return this.node(X,re,me)},_.prototype.txt=function(X){return this.text(X)},_.prototype.dat=function(X){return this.cdata(X)},_.prototype.com=function(X){return this.comment(X)},_.prototype.ins=function(X,re){return this.instruction(X,re)},_.prototype.dec=function(X,re,me){return this.declaration(X,re,me)},_.prototype.dtd=function(X,re,me){return this.doctype(X,re,me)},_.prototype.e=function(X,re,me){return this.element(X,re,me)},_.prototype.n=function(X,re,me){return this.node(X,re,me)},_.prototype.t=function(X){return this.text(X)},_.prototype.d=function(X){return this.cdata(X)},_.prototype.c=function(X){return this.comment(X)},_.prototype.r=function(X){return this.raw(X)},_.prototype.i=function(X,re){return this.instruction(X,re)},_.prototype.att=function(){return this.currentNode&&this.currentNode.type===y.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},_.prototype.a=function(){return this.currentNode&&this.currentNode.type===y.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},_.prototype.ent=function(X,re){return this.entity(X,re)},_.prototype.pent=function(X,re){return this.pEntity(X,re)},_.prototype.not=function(X,re){return this.notation(X,re)},_}()}).call(void 0)},{"./NodeType":251,"./Utility":252,"./WriterState":253,"./XMLAttribute":254,"./XMLCData":255,"./XMLComment":257,"./XMLDTDAttList":262,"./XMLDTDElement":263,"./XMLDTDEntity":264,"./XMLDTDNotation":265,"./XMLDeclaration":266,"./XMLDocType":267,"./XMLDocument":268,"./XMLElement":271,"./XMLProcessingInstruction":275,"./XMLRaw":276,"./XMLStringWriter":278,"./XMLStringifier":279,"./XMLText":280}],270:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E,g=function(p,v){for(var I in v)h.call(v,I)&&(p[I]=v[I]);function x(){this.constructor=p}return x.prototype=v.prototype,p.prototype=new x,p.__super__=v.prototype,p},h={}.hasOwnProperty;E=l("./XMLNode"),M=l("./NodeType"),V.exports=D=function(b){g(p,b);function p(v){p.__super__.constructor.call(this,v),this.type=M.Dummy}return p.prototype.clone=function(){return(0,d.default)(this)},p.prototype.toString=function(v){return""},p}(E)}).call(void 0)},{"./NodeType":251,"./XMLNode":273,"babel-runtime/core-js/object/create":55}],271:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E,g,h,b,p,v,I,x=function(B,Q){for(var G in Q)S.call(Q,G)&&(B[G]=Q[G]);function $(){this.constructor=B}return $.prototype=Q.prototype,B.prototype=new $,B.__super__=Q.prototype,B},S={}.hasOwnProperty;I=l("./Utility"),v=I.isObject,p=I.isFunction,b=I.getValue,h=l("./XMLNode"),M=l("./NodeType"),D=l("./XMLAttribute"),g=l("./XMLNamedNodeMap"),V.exports=E=function(W){x(B,W);function B(Q,G,$){var J,U,j,T;if(B.__super__.constructor.call(this,Q),G==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(G),this.type=M.Element,this.attribs={},this.schemaTypeInfo=null,$!=null&&this.attribute($),Q.type===M.Document&&(this.isRoot=!0,this.documentObject=Q,Q.rootObject=this,Q.children)){for(T=Q.children,U=0,j=T.length;U<j;U++)if(J=T[U],J.type===M.DocType){J.name=this.name;break}}}return Object.defineProperty(B.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(B.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(B.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(B.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(B.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(B.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(B.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(B.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new g(this.attribs)),this.attributeMap}}),B.prototype.clone=function(){var Q,G,$,J;$=(0,d.default)(this),$.isRoot&&($.documentObject=null),$.attribs={},J=this.attribs;for(G in J){if(!S.call(J,G))continue;Q=J[G],$.attribs[G]=Q.clone()}return $.children=[],this.children.forEach(function(U){var j;return j=U.clone(),j.parent=$,$.children.push(j)}),$},B.prototype.attribute=function(Q,G){var $,J;if(Q!=null&&(Q=b(Q)),v(Q))for($ in Q){if(!S.call(Q,$))continue;J=Q[$],this.attribute($,J)}else p(G)&&(G=G.apply()),this.options.keepNullAttributes&&G==null?this.attribs[Q]=new D(this,Q,""):G!=null&&(this.attribs[Q]=new D(this,Q,G));return this},B.prototype.removeAttribute=function(Q){var G,$,J;if(Q==null)throw new Error("Missing attribute name. "+this.debugInfo());if(Q=b(Q),Array.isArray(Q))for($=0,J=Q.length;$<J;$++)G=Q[$],delete this.attribs[G];else delete this.attribs[Q];return this},B.prototype.toString=function(Q){return this.options.writer.element(this,this.options.writer.filterOptions(Q))},B.prototype.att=function(Q,G){return this.attribute(Q,G)},B.prototype.a=function(Q,G){return this.attribute(Q,G)},B.prototype.getAttribute=function(Q){return this.attribs.hasOwnProperty(Q)?this.attribs[Q].value:null},B.prototype.setAttribute=function(Q,G){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.getAttributeNode=function(Q){return this.attribs.hasOwnProperty(Q)?this.attribs[Q]:null},B.prototype.setAttributeNode=function(Q){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.removeAttributeNode=function(Q){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.getElementsByTagName=function(Q){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.getAttributeNS=function(Q,G){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.setAttributeNS=function(Q,G,$){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.removeAttributeNS=function(Q,G){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.getAttributeNodeNS=function(Q,G){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.setAttributeNodeNS=function(Q){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.getElementsByTagNameNS=function(Q,G){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.hasAttribute=function(Q){return this.attribs.hasOwnProperty(Q)},B.prototype.hasAttributeNS=function(Q,G){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.setIdAttribute=function(Q,G){return this.attribs.hasOwnProperty(Q)?this.attribs[Q].isId:G},B.prototype.setIdAttributeNS=function(Q,G,$){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.setIdAttributeNode=function(Q,G){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.getElementsByTagName=function(Q){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.getElementsByTagNameNS=function(Q,G){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.getElementsByClassName=function(Q){throw new Error("This DOM method is not implemented."+this.debugInfo())},B.prototype.isEqualNode=function(Q){var G,$,J;if(!B.__super__.isEqualNode.apply(this,arguments).isEqualNode(Q))return!1;if(Q.namespaceURI!==this.namespaceURI)return!1;if(Q.prefix!==this.prefix)return!1;if(Q.localName!==this.localName)return!1;if(Q.attribs.length!==this.attribs.length)return!1;for(G=$=0,J=this.attribs.length-1;0<=J?$<=J:$>=J;G=0<=J?++$:--$)if(!this.attribs[G].isEqualNode(Q.attribs[G]))return!1;return!0},B}(h)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLAttribute":254,"./XMLNamedNodeMap":272,"./XMLNode":273,"babel-runtime/core-js/object/create":55}],272:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/keys"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M;V.exports=M=function(){function D(E){this.nodes=E}return Object.defineProperty(D.prototype,"length",{get:function(){return(0,d.default)(this.nodes).length||0}}),D.prototype.clone=function(){return this.nodes=null},D.prototype.getNamedItem=function(E){return this.nodes[E]},D.prototype.setNamedItem=function(E){var g;return g=this.nodes[E.nodeName],this.nodes[E.nodeName]=E,g||null},D.prototype.removeNamedItem=function(E){var g;return g=this.nodes[E],delete this.nodes[E],g||null},D.prototype.item=function(E){return this.nodes[(0,d.default)(this.nodes)[E]]||null},D.prototype.getNamedItemNS=function(E,g){throw new Error("This DOM method is not implemented.")},D.prototype.setNamedItemNS=function(E){throw new Error("This DOM method is not implemented.")},D.prototype.removeNamedItemNS=function(E,g){throw new Error("This DOM method is not implemented.")},D}()}).call(void 0)},{"babel-runtime/core-js/object/keys":60}],273:[function(l,V,N){"use strict";(function(){var y,d,F,M,D,E,g,h,b,p,v,I,x,S,W,B,Q,G,$,J={}.hasOwnProperty;$=l("./Utility"),G=$.isObject,Q=$.isFunction,B=$.isEmpty,W=$.getValue,h=null,F=null,M=null,D=null,E=null,x=null,S=null,I=null,g=null,d=null,v=null,b=null,y=null,V.exports=p=function(){function U(j){this.parent=j,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,h||(h=l("./XMLElement"),F=l("./XMLCData"),M=l("./XMLComment"),D=l("./XMLDeclaration"),E=l("./XMLDocType"),x=l("./XMLRaw"),S=l("./XMLText"),I=l("./XMLProcessingInstruction"),g=l("./XMLDummy"),d=l("./NodeType"),v=l("./XMLNodeList"),b=l("./XMLNamedNodeMap"),y=l("./DocumentPosition"))}return Object.defineProperty(U.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(U.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(U.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(U.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(U.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new v(this.children)),this.childNodeList}}),Object.defineProperty(U.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(U.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(U.prototype,"previousSibling",{get:function(){var T;return T=this.parent.children.indexOf(this),this.parent.children[T-1]||null}}),Object.defineProperty(U.prototype,"nextSibling",{get:function(){var T;return T=this.parent.children.indexOf(this),this.parent.children[T+1]||null}}),Object.defineProperty(U.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(U.prototype,"textContent",{get:function(){var T,ee,Z,_,X;if(this.nodeType===d.Element||this.nodeType===d.DocumentFragment){for(X="",_=this.children,ee=0,Z=_.length;ee<Z;ee++)T=_[ee],T.textContent&&(X+=T.textContent);return X}else return null},set:function(T){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),U.prototype.setParent=function(j){var T,ee,Z,_,X;for(this.parent=j,j&&(this.options=j.options,this.stringify=j.stringify),_=this.children,X=[],ee=0,Z=_.length;ee<Z;ee++)T=_[ee],X.push(T.setParent(this));return X},U.prototype.element=function(j,T,ee){var Z,_,X,re,me,de,we,ge,ke,z,ie;if(de=null,T===null&&ee==null&&(ke=[{},null],T=ke[0],ee=ke[1]),T==null&&(T={}),T=W(T),G(T)||(z=[T,ee],ee=z[0],T=z[1]),j!=null&&(j=W(j)),Array.isArray(j))for(X=0,we=j.length;X<we;X++)_=j[X],de=this.element(_);else if(Q(j))de=this.element(j.apply());else if(G(j))for(me in j){if(!J.call(j,me))continue;if(ie=j[me],Q(ie)&&(ie=ie.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&me.indexOf(this.stringify.convertAttKey)===0)de=this.attribute(me.substr(this.stringify.convertAttKey.length),ie);else if(!this.options.separateArrayItems&&Array.isArray(ie)&&B(ie))de=this.dummy();else if(G(ie)&&B(ie))de=this.element(me);else if(!this.options.keepNullNodes&&ie==null)de=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(ie))for(re=0,ge=ie.length;re<ge;re++)_=ie[re],Z={},Z[me]=_,de=this.element(Z);else G(ie)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&me.indexOf(this.stringify.convertTextKey)===0?de=this.element(ie):(de=this.element(me),de.element(ie)):de=this.element(me,ie)}else!this.options.keepNullNodes&&ee===null?de=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&j.indexOf(this.stringify.convertTextKey)===0?de=this.text(ee):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&j.indexOf(this.stringify.convertCDataKey)===0?de=this.cdata(ee):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&j.indexOf(this.stringify.convertCommentKey)===0?de=this.comment(ee):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&j.indexOf(this.stringify.convertRawKey)===0?de=this.raw(ee):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&j.indexOf(this.stringify.convertPIKey)===0?de=this.instruction(j.substr(this.stringify.convertPIKey.length),ee):de=this.node(j,T,ee);if(de==null)throw new Error("Could not create any elements with: "+j+". "+this.debugInfo());return de},U.prototype.insertBefore=function(j,T,ee){var Z,_,X,re,me;if(j!=null?j.type:void 0)return X=j,re=T,X.setParent(this),re?(_=children.indexOf(re),me=children.splice(_),children.push(X),Array.prototype.push.apply(children,me)):children.push(X),X;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(j));return _=this.parent.children.indexOf(this),me=this.parent.children.splice(_),Z=this.parent.element(j,T,ee),Array.prototype.push.apply(this.parent.children,me),Z},U.prototype.insertAfter=function(j,T,ee){var Z,_,X;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(j));return _=this.parent.children.indexOf(this),X=this.parent.children.splice(_+1),Z=this.parent.element(j,T,ee),Array.prototype.push.apply(this.parent.children,X),Z},U.prototype.remove=function(){var j,T;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return j=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[j,j-j+1].concat(T=[])),this.parent},U.prototype.node=function(j,T,ee){var Z,_;return j!=null&&(j=W(j)),T||(T={}),T=W(T),G(T)||(_=[T,ee],ee=_[0],T=_[1]),Z=new h(this,j,T),ee!=null&&Z.text(ee),this.children.push(Z),Z},U.prototype.text=function(j){var T;return G(j)&&this.element(j),T=new S(this,j),this.children.push(T),this},U.prototype.cdata=function(j){var T;return T=new F(this,j),this.children.push(T),this},U.prototype.comment=function(j){var T;return T=new M(this,j),this.children.push(T),this},U.prototype.commentBefore=function(j){var T,ee,Z;return ee=this.parent.children.indexOf(this),Z=this.parent.children.splice(ee),T=this.parent.comment(j),Array.prototype.push.apply(this.parent.children,Z),this},U.prototype.commentAfter=function(j){var T,ee,Z;return ee=this.parent.children.indexOf(this),Z=this.parent.children.splice(ee+1),T=this.parent.comment(j),Array.prototype.push.apply(this.parent.children,Z),this},U.prototype.raw=function(j){var T;return T=new x(this,j),this.children.push(T),this},U.prototype.dummy=function(){var j;return j=new g(this),j},U.prototype.instruction=function(j,T){var ee,Z,_,X,re;if(j!=null&&(j=W(j)),T!=null&&(T=W(T)),Array.isArray(j))for(X=0,re=j.length;X<re;X++)ee=j[X],this.instruction(ee);else if(G(j))for(ee in j){if(!J.call(j,ee))continue;Z=j[ee],this.instruction(ee,Z)}else Q(T)&&(T=T.apply()),_=new I(this,j,T),this.children.push(_);return this},U.prototype.instructionBefore=function(j,T){var ee,Z,_;return Z=this.parent.children.indexOf(this),_=this.parent.children.splice(Z),ee=this.parent.instruction(j,T),Array.prototype.push.apply(this.parent.children,_),this},U.prototype.instructionAfter=function(j,T){var ee,Z,_;return Z=this.parent.children.indexOf(this),_=this.parent.children.splice(Z+1),ee=this.parent.instruction(j,T),Array.prototype.push.apply(this.parent.children,_),this},U.prototype.declaration=function(j,T,ee){var Z,_;return Z=this.document(),_=new D(Z,j,T,ee),Z.children.length===0?Z.children.unshift(_):Z.children[0].type===d.Declaration?Z.children[0]=_:Z.children.unshift(_),Z.root()||Z},U.prototype.dtd=function(j,T){var ee,Z,_,X,re,me,de,we,ge,ke;for(Z=this.document(),_=new E(Z,j,T),ge=Z.children,X=re=0,de=ge.length;re<de;X=++re)if(ee=ge[X],ee.type===d.DocType)return Z.children[X]=_,_;for(ke=Z.children,X=me=0,we=ke.length;me<we;X=++me)if(ee=ke[X],ee.isRoot)return Z.children.splice(X,0,_),_;return Z.children.push(_),_},U.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},U.prototype.root=function(){var j;for(j=this;j;){if(j.type===d.Document)return j.rootObject;if(j.isRoot)return j;j=j.parent}},U.prototype.document=function(){var j;for(j=this;j;){if(j.type===d.Document)return j;j=j.parent}},U.prototype.end=function(j){return this.document().end(j)},U.prototype.prev=function(){var j;if(j=this.parent.children.indexOf(this),j<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[j-1]},U.prototype.next=function(){var j;if(j=this.parent.children.indexOf(this),j===-1||j===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[j+1]},U.prototype.importDocument=function(j){var T;return T=j.root().clone(),T.parent=this,T.isRoot=!1,this.children.push(T),this},U.prototype.debugInfo=function(j){var T,ee;return j=j||this.name,j==null&&!((T=this.parent)!=null?T.name:void 0)?"":j==null?"parent: <"+this.parent.name+">":((ee=this.parent)!=null?ee.name:void 0)?"node: <"+j+">, parent: <"+this.parent.name+">":"node: <"+j+">"},U.prototype.ele=function(j,T,ee){return this.element(j,T,ee)},U.prototype.nod=function(j,T,ee){return this.node(j,T,ee)},U.prototype.txt=function(j){return this.text(j)},U.prototype.dat=function(j){return this.cdata(j)},U.prototype.com=function(j){return this.comment(j)},U.prototype.ins=function(j,T){return this.instruction(j,T)},U.prototype.doc=function(){return this.document()},U.prototype.dec=function(j,T,ee){return this.declaration(j,T,ee)},U.prototype.e=function(j,T,ee){return this.element(j,T,ee)},U.prototype.n=function(j,T,ee){return this.node(j,T,ee)},U.prototype.t=function(j){return this.text(j)},U.prototype.d=function(j){return this.cdata(j)},U.prototype.c=function(j){return this.comment(j)},U.prototype.r=function(j){return this.raw(j)},U.prototype.i=function(j,T){return this.instruction(j,T)},U.prototype.u=function(){return this.up()},U.prototype.importXMLBuilder=function(j){return this.importDocument(j)},U.prototype.replaceChild=function(j,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.removeChild=function(j){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.appendChild=function(j){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.hasChildNodes=function(){return this.children.length!==0},U.prototype.cloneNode=function(j){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.isSupported=function(j,T){return!0},U.prototype.hasAttributes=function(){return this.attribs.length!==0},U.prototype.compareDocumentPosition=function(j){var T,ee;return T=this,T===j?0:this.document()!==j.document()?(ee=y.Disconnected|y.ImplementationSpecific,Math.random()<.5?ee|=y.Preceding:ee|=y.Following,ee):T.isAncestor(j)?y.Contains|y.Preceding:T.isDescendant(j)?y.Contains|y.Following:T.isPreceding(j)?y.Preceding:y.Following},U.prototype.isSameNode=function(j){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.lookupPrefix=function(j){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.isDefaultNamespace=function(j){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.lookupNamespaceURI=function(j){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.isEqualNode=function(j){var T,ee,Z;if(j.nodeType!==this.nodeType)return!1;if(j.children.length!==this.children.length)return!1;for(T=ee=0,Z=this.children.length-1;0<=Z?ee<=Z:ee>=Z;T=0<=Z?++ee:--ee)if(!this.children[T].isEqualNode(j.children[T]))return!1;return!0},U.prototype.getFeature=function(j,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.setUserData=function(j,T,ee){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.getUserData=function(j){throw new Error("This DOM method is not implemented."+this.debugInfo())},U.prototype.contains=function(j){return j?j===this||this.isDescendant(j):!1},U.prototype.isDescendant=function(j){var T,ee,Z,_,X;for(X=this.children,Z=0,_=X.length;Z<_;Z++){if(T=X[Z],j===T)return!0;if(ee=T.isDescendant(j),ee)return!0}return!1},U.prototype.isAncestor=function(j){return j.isDescendant(this)},U.prototype.isPreceding=function(j){var T,ee;return T=this.treePosition(j),ee=this.treePosition(this),T===-1||ee===-1?!1:T<ee},U.prototype.isFollowing=function(j){var T,ee;return T=this.treePosition(j),ee=this.treePosition(this),T===-1||ee===-1?!1:T>ee},U.prototype.treePosition=function(j){var T,ee;return ee=0,T=!1,this.foreachTreeNode(this.document(),function(Z){if(ee++,!T&&Z===j)return T=!0}),T?ee:-1},U.prototype.foreachTreeNode=function(j,T){var ee,Z,_,X,re;for(j||(j=this.document()),X=j.children,Z=0,_=X.length;Z<_;Z++){if(ee=X[Z],re=T(ee))return re;if(re=this.foreachTreeNode(ee,T),re)return re}},U}()}).call(void 0)},{"./DocumentPosition":250,"./NodeType":251,"./Utility":252,"./XMLCData":255,"./XMLComment":257,"./XMLDeclaration":266,"./XMLDocType":267,"./XMLDummy":270,"./XMLElement":271,"./XMLNamedNodeMap":272,"./XMLNodeList":274,"./XMLProcessingInstruction":275,"./XMLRaw":276,"./XMLText":280}],274:[function(l,V,N){"use strict";(function(){var y;V.exports=y=function(){function d(F){this.nodes=F}return Object.defineProperty(d.prototype,"length",{get:function(){return this.nodes.length||0}}),d.prototype.clone=function(){return this.nodes=null},d.prototype.item=function(F){return this.nodes[F]||null},d}()}).call(void 0)},{}],275:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E,g=function(p,v){for(var I in v)h.call(v,I)&&(p[I]=v[I]);function x(){this.constructor=p}return x.prototype=v.prototype,p.prototype=new x,p.__super__=v.prototype,p},h={}.hasOwnProperty;M=l("./NodeType"),D=l("./XMLCharacterData"),V.exports=E=function(b){g(p,b);function p(v,I,x){if(p.__super__.constructor.call(this,v),I==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=M.ProcessingInstruction,this.target=this.stringify.insTarget(I),this.name=this.target,x&&(this.value=this.stringify.insValue(x))}return p.prototype.clone=function(){return(0,d.default)(this)},p.prototype.toString=function(v){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(v))},p.prototype.isEqualNode=function(v){return p.__super__.isEqualNode.apply(this,arguments).isEqualNode(v)?!(v.target!==this.target):!1},p}(D)}).call(void 0)},{"./NodeType":251,"./XMLCharacterData":256,"babel-runtime/core-js/object/create":55}],276:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E,g=function(p,v){for(var I in v)h.call(v,I)&&(p[I]=v[I]);function x(){this.constructor=p}return x.prototype=v.prototype,p.prototype=new x,p.__super__=v.prototype,p},h={}.hasOwnProperty;M=l("./NodeType"),D=l("./XMLNode"),V.exports=E=function(b){g(p,b);function p(v,I){if(p.__super__.constructor.call(this,v),I==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=M.Raw,this.value=this.stringify.raw(I)}return p.prototype.clone=function(){return(0,d.default)(this)},p.prototype.toString=function(v){return this.options.writer.raw(this,this.options.writer.filterOptions(v))},p}(D)}).call(void 0)},{"./NodeType":251,"./XMLNode":273,"babel-runtime/core-js/object/create":55}],277:[function(l,V,N){"use strict";(function(){var y,d,F,M,D=function(h,b){for(var p in b)E.call(b,p)&&(h[p]=b[p]);function v(){this.constructor=h}return v.prototype=b.prototype,h.prototype=new v,h.__super__=b.prototype,h},E={}.hasOwnProperty;y=l("./NodeType"),M=l("./XMLWriterBase"),d=l("./WriterState"),V.exports=F=function(g){D(h,g);function h(b,p){this.stream=b,h.__super__.constructor.call(this,p)}return h.prototype.endline=function(b,p,v){return b.isLastRootNode&&p.state===d.CloseTag?"":h.__super__.endline.call(this,b,p,v)},h.prototype.document=function(b,p){var v,I,x,S,W,B,Q,G,$;for(Q=b.children,I=x=0,W=Q.length;x<W;I=++x)v=Q[I],v.isLastRootNode=I===b.children.length-1;for(p=this.filterOptions(p),G=b.children,$=[],S=0,B=G.length;S<B;S++)v=G[S],$.push(this.writeChildNode(v,p,0));return $},h.prototype.attribute=function(b,p,v){return this.stream.write(h.__super__.attribute.call(this,b,p,v))},h.prototype.cdata=function(b,p,v){return this.stream.write(h.__super__.cdata.call(this,b,p,v))},h.prototype.comment=function(b,p,v){return this.stream.write(h.__super__.comment.call(this,b,p,v))},h.prototype.declaration=function(b,p,v){return this.stream.write(h.__super__.declaration.call(this,b,p,v))},h.prototype.docType=function(b,p,v){var I,x,S,W;if(v||(v=0),this.openNode(b,p,v),p.state=d.OpenTag,this.stream.write(this.indent(b,p,v)),this.stream.write("<!DOCTYPE "+b.root().name),b.pubID&&b.sysID?this.stream.write(' PUBLIC "'+b.pubID+'" "'+b.sysID+'"'):b.sysID&&this.stream.write(' SYSTEM "'+b.sysID+'"'),b.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(b,p,v)),p.state=d.InsideTag,W=b.children,x=0,S=W.length;x<S;x++)I=W[x],this.writeChildNode(I,p,v+1);p.state=d.CloseTag,this.stream.write("]")}return p.state=d.CloseTag,this.stream.write(p.spaceBeforeSlash+">"),this.stream.write(this.endline(b,p,v)),p.state=d.None,this.closeNode(b,p,v)},h.prototype.element=function(b,p,v){var I,x,S,W,B,Q,G,$,J,U;v||(v=0),this.openNode(b,p,v),p.state=d.OpenTag,this.stream.write(this.indent(b,p,v)+"<"+b.name),J=b.attribs;for(G in J){if(!E.call(J,G))continue;I=J[G],this.attribute(I,p,v)}if(S=b.children.length,W=S===0?null:b.children[0],S===0||b.children.every(function(j){return(j.type===y.Text||j.type===y.Raw)&&j.value===""}))p.allowEmpty?(this.stream.write(">"),p.state=d.CloseTag,this.stream.write("</"+b.name+">")):(p.state=d.CloseTag,this.stream.write(p.spaceBeforeSlash+"/>"));else if(p.pretty&&S===1&&(W.type===y.Text||W.type===y.Raw)&&W.value!=null)this.stream.write(">"),p.state=d.InsideTag,p.suppressPrettyCount++,$=!0,this.writeChildNode(W,p,v+1),p.suppressPrettyCount--,$=!1,p.state=d.CloseTag,this.stream.write("</"+b.name+">");else{for(this.stream.write(">"+this.endline(b,p,v)),p.state=d.InsideTag,U=b.children,B=0,Q=U.length;B<Q;B++)x=U[B],this.writeChildNode(x,p,v+1);p.state=d.CloseTag,this.stream.write(this.indent(b,p,v)+"</"+b.name+">")}return this.stream.write(this.endline(b,p,v)),p.state=d.None,this.closeNode(b,p,v)},h.prototype.processingInstruction=function(b,p,v){return this.stream.write(h.__super__.processingInstruction.call(this,b,p,v))},h.prototype.raw=function(b,p,v){return this.stream.write(h.__super__.raw.call(this,b,p,v))},h.prototype.text=function(b,p,v){return this.stream.write(h.__super__.text.call(this,b,p,v))},h.prototype.dtdAttList=function(b,p,v){return this.stream.write(h.__super__.dtdAttList.call(this,b,p,v))},h.prototype.dtdElement=function(b,p,v){return this.stream.write(h.__super__.dtdElement.call(this,b,p,v))},h.prototype.dtdEntity=function(b,p,v){return this.stream.write(h.__super__.dtdEntity.call(this,b,p,v))},h.prototype.dtdNotation=function(b,p,v){return this.stream.write(h.__super__.dtdNotation.call(this,b,p,v))},h}(M)}).call(void 0)},{"./NodeType":251,"./WriterState":253,"./XMLWriterBase":281}],278:[function(l,V,N){"use strict";(function(){var y,d,F=function(E,g){for(var h in g)M.call(g,h)&&(E[h]=g[h]);function b(){this.constructor=E}return b.prototype=g.prototype,E.prototype=new b,E.__super__=g.prototype,E},M={}.hasOwnProperty;d=l("./XMLWriterBase"),V.exports=y=function(D){F(E,D);function E(g){E.__super__.constructor.call(this,g)}return E.prototype.document=function(g,h){var b,p,v,I,x;for(h=this.filterOptions(h),I="",x=g.children,p=0,v=x.length;p<v;p++)b=x[p],I+=this.writeChildNode(b,h,0);return h.pretty&&I.slice(-h.newline.length)===h.newline&&(I=I.slice(0,-h.newline.length)),I},E}(d)}).call(void 0)},{"./XMLWriterBase":281}],279:[function(l,V,N){"use strict";(function(){var y,d=function(D,E){return function(){return D.apply(E,arguments)}},F={}.hasOwnProperty;V.exports=y=function(){function M(D){this.assertLegalName=d(this.assertLegalName,this),this.assertLegalChar=d(this.assertLegalChar,this);var E,g,h;D||(D={}),this.options=D,this.options.version||(this.options.version="1.0"),g=D.stringify||{};for(E in g){if(!F.call(g,E))continue;h=g[E],this[E]=h}}return M.prototype.name=function(D){return this.options.noValidation?D:this.assertLegalName(""+D||"")},M.prototype.text=function(D){return this.options.noValidation?D:this.assertLegalChar(this.textEscape(""+D||""))},M.prototype.cdata=function(D){return this.options.noValidation?D:(D=""+D||"",D=D.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(D))},M.prototype.comment=function(D){if(this.options.noValidation)return D;if(D=""+D||"",D.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+D);return this.assertLegalChar(D)},M.prototype.raw=function(D){return this.options.noValidation?D:""+D||""},M.prototype.attValue=function(D){return this.options.noValidation?D:this.assertLegalChar(this.attEscape(D=""+D||""))},M.prototype.insTarget=function(D){return this.options.noValidation?D:this.assertLegalChar(""+D||"")},M.prototype.insValue=function(D){if(this.options.noValidation)return D;if(D=""+D||"",D.match(/\?>/))throw new Error("Invalid processing instruction value: "+D);return this.assertLegalChar(D)},M.prototype.xmlVersion=function(D){if(this.options.noValidation)return D;if(D=""+D||"",!D.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+D);return D},M.prototype.xmlEncoding=function(D){if(this.options.noValidation)return D;if(D=""+D||"",!D.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+D);return this.assertLegalChar(D)},M.prototype.xmlStandalone=function(D){return this.options.noValidation?D:D?"yes":"no"},M.prototype.dtdPubID=function(D){return this.options.noValidation?D:this.assertLegalChar(""+D||"")},M.prototype.dtdSysID=function(D){return this.options.noValidation?D:this.assertLegalChar(""+D||"")},M.prototype.dtdElementValue=function(D){return this.options.noValidation?D:this.assertLegalChar(""+D||"")},M.prototype.dtdAttType=function(D){return this.options.noValidation?D:this.assertLegalChar(""+D||"")},M.prototype.dtdAttDefault=function(D){return this.options.noValidation?D:this.assertLegalChar(""+D||"")},M.prototype.dtdEntityValue=function(D){return this.options.noValidation?D:this.assertLegalChar(""+D||"")},M.prototype.dtdNData=function(D){return this.options.noValidation?D:this.assertLegalChar(""+D||"")},M.prototype.convertAttKey="@",M.prototype.convertPIKey="?",M.prototype.convertTextKey="#text",M.prototype.convertCDataKey="#cdata",M.prototype.convertCommentKey="#comment",M.prototype.convertRawKey="#raw",M.prototype.assertLegalChar=function(D){var E,g;if(this.options.noValidation)return D;if(E="",this.options.version==="1.0"){if(E=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,g=D.match(E))throw new Error("Invalid character in string: "+D+" at index "+g.index)}else if(this.options.version==="1.1"&&(E=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,g=D.match(E)))throw new Error("Invalid character in string: "+D+" at index "+g.index);return D},M.prototype.assertLegalName=function(D){var E;if(this.options.noValidation)return D;if(this.assertLegalChar(D),E=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!D.match(E))throw new Error("Invalid character in name");return D},M.prototype.textEscape=function(D){var E;return this.options.noValidation?D:(E=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,D.replace(E,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
"))},M.prototype.attEscape=function(D){var E;return this.options.noValidation?D:(E=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,D.replace(E,"&").replace(/</g,"<").replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
"))},M}()}).call(void 0)},{}],280:[function(l,V,N){"use strict";var y=l("babel-runtime/core-js/object/create"),d=F(y);function F(M){return M&&M.__esModule?M:{default:M}}(function(){var M,D,E,g=function(p,v){for(var I in v)h.call(v,I)&&(p[I]=v[I]);function x(){this.constructor=p}return x.prototype=v.prototype,p.prototype=new x,p.__super__=v.prototype,p},h={}.hasOwnProperty;M=l("./NodeType"),D=l("./XMLCharacterData"),V.exports=E=function(b){g(p,b);function p(v,I){if(p.__super__.constructor.call(this,v),I==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=M.Text,this.value=this.stringify.text(I)}return Object.defineProperty(p.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(p.prototype,"wholeText",{get:function(){var I,x,S;for(S="",x=this.previousSibling;x;)S=x.data+S,x=x.previousSibling;for(S+=this.data,I=this.nextSibling;I;)S=S+I.data,I=I.nextSibling;return S}}),p.prototype.clone=function(){return(0,d.default)(this)},p.prototype.toString=function(v){return this.options.writer.text(this,this.options.writer.filterOptions(v))},p.prototype.splitText=function(v){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.replaceWholeText=function(v){throw new Error("This DOM method is not implemented."+this.debugInfo())},p}(D)}).call(void 0)},{"./NodeType":251,"./XMLCharacterData":256,"babel-runtime/core-js/object/create":55}],281:[function(l,V,N){"use strict";(function(){var y,d,F,M,D,E,g,h,b,p,v,I,x,S,W,B,Q,G={}.hasOwnProperty;Q=l("./Utility").assign,y=l("./NodeType"),b=l("./XMLDeclaration"),p=l("./XMLDocType"),F=l("./XMLCData"),M=l("./XMLComment"),I=l("./XMLElement"),S=l("./XMLRaw"),W=l("./XMLText"),x=l("./XMLProcessingInstruction"),v=l("./XMLDummy"),D=l("./XMLDTDAttList"),E=l("./XMLDTDElement"),g=l("./XMLDTDEntity"),h=l("./XMLDTDNotation"),d=l("./WriterState"),V.exports=B=function(){function $(J){var U,j,T;J||(J={}),this.options=J,j=J.writer||{};for(U in j){if(!G.call(j,U))continue;T=j[U],this["_"+U]=this[U],this[U]=T}}return $.prototype.filterOptions=function(J){var U,j,T,ee,Z,_,X,re;return J||(J={}),J=Q({},this.options,J),U={writer:this},U.pretty=J.pretty||!1,U.allowEmpty=J.allowEmpty||!1,U.indent=(j=J.indent)!=null?j:" ",U.newline=(T=J.newline)!=null?T:`
|
|
|
`,U.offset=(ee=J.offset)!=null?ee:0,U.dontPrettyTextNodes=(Z=(_=J.dontPrettyTextNodes)!=null?_:J.dontprettytextnodes)!=null?Z:0,U.spaceBeforeSlash=(X=(re=J.spaceBeforeSlash)!=null?re:J.spacebeforeslash)!=null?X:"",U.spaceBeforeSlash===!0&&(U.spaceBeforeSlash=" "),U.suppressPrettyCount=0,U.user={},U.state=d.None,U},$.prototype.indent=function(J,U,j){var T;return!U.pretty||U.suppressPrettyCount?"":U.pretty&&(T=(j||0)+U.offset+1,T>0)?new Array(T).join(U.indent):""},$.prototype.endline=function(J,U,j){return!U.pretty||U.suppressPrettyCount?"":U.newline},$.prototype.attribute=function(J,U,j){var T;return this.openAttribute(J,U,j),T=" "+J.name+'="'+J.value+'"',this.closeAttribute(J,U,j),T},$.prototype.cdata=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j)+"<![CDATA[",U.state=d.InsideTag,T+=J.value,U.state=d.CloseTag,T+="]]>"+this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},$.prototype.comment=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j)+"<!-- ",U.state=d.InsideTag,T+=J.value,U.state=d.CloseTag,T+=" -->"+this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},$.prototype.declaration=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j)+"<?xml",U.state=d.InsideTag,T+=' version="'+J.version+'"',J.encoding!=null&&(T+=' encoding="'+J.encoding+'"'),J.standalone!=null&&(T+=' standalone="'+J.standalone+'"'),U.state=d.CloseTag,T+=U.spaceBeforeSlash+"?>",T+=this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},$.prototype.docType=function(J,U,j){var T,ee,Z,_,X;if(j||(j=0),this.openNode(J,U,j),U.state=d.OpenTag,_=this.indent(J,U,j),_+="<!DOCTYPE "+J.root().name,J.pubID&&J.sysID?_+=' PUBLIC "'+J.pubID+'" "'+J.sysID+'"':J.sysID&&(_+=' SYSTEM "'+J.sysID+'"'),J.children.length>0){for(_+=" [",_+=this.endline(J,U,j),U.state=d.InsideTag,X=J.children,ee=0,Z=X.length;ee<Z;ee++)T=X[ee],_+=this.writeChildNode(T,U,j+1);U.state=d.CloseTag,_+="]"}return U.state=d.CloseTag,_+=U.spaceBeforeSlash+">",_+=this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),_},$.prototype.element=function(J,U,j){var T,ee,Z,_,X,re,me,de,we,ge,ke,z,ie,H;j||(j=0),ge=!1,ke="",this.openNode(J,U,j),U.state=d.OpenTag,ke+=this.indent(J,U,j)+"<"+J.name,z=J.attribs;for(we in z){if(!G.call(z,we))continue;T=z[we],ke+=this.attribute(T,U,j)}if(Z=J.children.length,_=Z===0?null:J.children[0],Z===0||J.children.every(function(ae){return(ae.type===y.Text||ae.type===y.Raw)&&ae.value===""}))U.allowEmpty?(ke+=">",U.state=d.CloseTag,ke+="</"+J.name+">"+this.endline(J,U,j)):(U.state=d.CloseTag,ke+=U.spaceBeforeSlash+"/>"+this.endline(J,U,j));else if(U.pretty&&Z===1&&(_.type===y.Text||_.type===y.Raw)&&_.value!=null)ke+=">",U.state=d.InsideTag,U.suppressPrettyCount++,ge=!0,ke+=this.writeChildNode(_,U,j+1),U.suppressPrettyCount--,ge=!1,U.state=d.CloseTag,ke+="</"+J.name+">"+this.endline(J,U,j);else{if(U.dontPrettyTextNodes){for(ie=J.children,X=0,me=ie.length;X<me;X++)if(ee=ie[X],(ee.type===y.Text||ee.type===y.Raw)&&ee.value!=null){U.suppressPrettyCount++,ge=!0;break}}for(ke+=">"+this.endline(J,U,j),U.state=d.InsideTag,H=J.children,re=0,de=H.length;re<de;re++)ee=H[re],ke+=this.writeChildNode(ee,U,j+1);U.state=d.CloseTag,ke+=this.indent(J,U,j)+"</"+J.name+">",ge&&U.suppressPrettyCount--,ke+=this.endline(J,U,j),U.state=d.None}return this.closeNode(J,U,j),ke},$.prototype.writeChildNode=function(J,U,j){switch(J.type){case y.CData:return this.cdata(J,U,j);case y.Comment:return this.comment(J,U,j);case y.Element:return this.element(J,U,j);case y.Raw:return this.raw(J,U,j);case y.Text:return this.text(J,U,j);case y.ProcessingInstruction:return this.processingInstruction(J,U,j);case y.Dummy:return"";case y.Declaration:return this.declaration(J,U,j);case y.DocType:return this.docType(J,U,j);case y.AttributeDeclaration:return this.dtdAttList(J,U,j);case y.ElementDeclaration:return this.dtdElement(J,U,j);case y.EntityDeclaration:return this.dtdEntity(J,U,j);case y.NotationDeclaration:return this.dtdNotation(J,U,j);default:throw new Error("Unknown XML node type: "+J.constructor.name)}},$.prototype.processingInstruction=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j)+"<?",U.state=d.InsideTag,T+=J.target,J.value&&(T+=" "+J.value),U.state=d.CloseTag,T+=U.spaceBeforeSlash+"?>",T+=this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},$.prototype.raw=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j),U.state=d.InsideTag,T+=J.value,U.state=d.CloseTag,T+=this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},$.prototype.text=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j),U.state=d.InsideTag,T+=J.value,U.state=d.CloseTag,T+=this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},$.prototype.dtdAttList=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j)+"<!ATTLIST",U.state=d.InsideTag,T+=" "+J.elementName+" "+J.attributeName+" "+J.attributeType,J.defaultValueType!=="#DEFAULT"&&(T+=" "+J.defaultValueType),J.defaultValue&&(T+=' "'+J.defaultValue+'"'),U.state=d.CloseTag,T+=U.spaceBeforeSlash+">"+this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},$.prototype.dtdElement=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j)+"<!ELEMENT",U.state=d.InsideTag,T+=" "+J.name+" "+J.value,U.state=d.CloseTag,T+=U.spaceBeforeSlash+">"+this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},$.prototype.dtdEntity=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j)+"<!ENTITY",U.state=d.InsideTag,J.pe&&(T+=" %"),T+=" "+J.name,J.value?T+=' "'+J.value+'"':(J.pubID&&J.sysID?T+=' PUBLIC "'+J.pubID+'" "'+J.sysID+'"':J.sysID&&(T+=' SYSTEM "'+J.sysID+'"'),J.nData&&(T+=" NDATA "+J.nData)),U.state=d.CloseTag,T+=U.spaceBeforeSlash+">"+this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},$.prototype.dtdNotation=function(J,U,j){var T;return this.openNode(J,U,j),U.state=d.OpenTag,T=this.indent(J,U,j)+"<!NOTATION",U.state=d.InsideTag,T+=" "+J.name,J.pubID&&J.sysID?T+=' PUBLIC "'+J.pubID+'" "'+J.sysID+'"':J.pubID?T+=' PUBLIC "'+J.pubID+'"':J.sysID&&(T+=' SYSTEM "'+J.sysID+'"'),U.state=d.CloseTag,T+=U.spaceBeforeSlash+">"+this.endline(J,U,j),U.state=d.None,this.closeNode(J,U,j),T},$.prototype.openNode=function(J,U,j){},$.prototype.closeNode=function(J,U,j){},$.prototype.openAttribute=function(J,U,j){},$.prototype.closeAttribute=function(J,U,j){},$}()}).call(void 0)},{"./NodeType":251,"./Utility":252,"./WriterState":253,"./XMLCData":255,"./XMLComment":257,"./XMLDTDAttList":262,"./XMLDTDElement":263,"./XMLDTDEntity":264,"./XMLDTDNotation":265,"./XMLDeclaration":266,"./XMLDocType":267,"./XMLDummy":270,"./XMLElement":271,"./XMLProcessingInstruction":275,"./XMLRaw":276,"./XMLText":280}],282:[function(l,V,N){"use strict";(function(){var y,d,F,M,D,E,g,h,b,p;p=l("./Utility"),h=p.assign,b=p.isFunction,F=l("./XMLDOMImplementation"),M=l("./XMLDocument"),D=l("./XMLDocumentCB"),g=l("./XMLStringWriter"),E=l("./XMLStreamWriter"),y=l("./NodeType"),d=l("./WriterState"),V.exports.create=function(v,I,x,S){var W,B;if(v==null)throw new Error("Root element needs a name.");return S=h({},I,x,S),W=new M(S),B=W.element(v),S.headless||(W.declaration(S),(S.pubID!=null||S.sysID!=null)&&W.dtd(S)),B},V.exports.begin=function(v,I,x){var S;return b(v)&&(S=[v,I],I=S[0],x=S[1],v={}),I?new D(v,I,x):new M(v)},V.exports.stringWriter=function(v){return new g(v)},V.exports.streamWriter=function(v,I){return new E(v,I)},V.exports.implementation=new F,V.exports.nodeType=y,V.exports.writerState=d}).call(void 0)},{"./NodeType":251,"./Utility":252,"./WriterState":253,"./XMLDOMImplementation":260,"./XMLDocument":268,"./XMLDocumentCB":269,"./XMLStreamWriter":277,"./XMLStringWriter":278}],283:[function(l,V,N){V.exports=d;var y=Object.prototype.hasOwnProperty;function d(){for(var F={},M=0;M<arguments.length;M++){var D=arguments[M];for(var E in D)y.call(D,E)&&(F[E]=D[E])}return F}},{}],284:[function(l,V,N){"use strict";var y=l("buffer").Buffer,d=l("./sha"),F=l("./md5"),M={sha1:d,md5:F},D=64,E=y.alloc(D);E.fill(0);function g(p,v,I){y.isBuffer(v)||(v=y.from(v)),y.isBuffer(I)||(I=y.from(I)),v.length>D?v=p(v):v.length<D&&(v=y.concat([v,E],D));for(var x=y.alloc(D),S=y.alloc(D),W=0;W<D;W++)x[W]=v[W]^54,S[W]=v[W]^92;var B=p(y.concat([x,I]));return p(y.concat([S,B]))}function h(p,v){p=p||"sha1";var I=M[p],x=[],S=0;return I||b("algorithm:",p,"is not yet supported"),{update:function(B){return y.isBuffer(B)||(B=y.from(B)),x.push(B),S+=B.length,this},digest:function(B){var Q=y.concat(x),G=v?g(I,v,Q):I(Q);return x=null,B?G.toString(B):G}}}function b(){var p=[].slice.call(arguments).join(" ");throw new Error([p,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(`
|
|
|
`))}N.createHash=function(p){return h(p)},N.createHmac=function(p,v){return h(p,v)},N.createCredentials=function(){b("sorry,createCredentials is not implemented yet")},N.createCipher=function(){b("sorry,createCipher is not implemented yet")},N.createCipheriv=function(){b("sorry,createCipheriv is not implemented yet")},N.createDecipher=function(){b("sorry,createDecipher is not implemented yet")},N.createDecipheriv=function(){b("sorry,createDecipheriv is not implemented yet")},N.createSign=function(){b("sorry,createSign is not implemented yet")},N.createVerify=function(){b("sorry,createVerify is not implemented yet")},N.createDiffieHellman=function(){b("sorry,createDiffieHellman is not implemented yet")},N.pbkdf2=function(){b("sorry,pbkdf2 is not implemented yet")}},{"./md5":286,"./sha":287,buffer:73}],285:[function(l,V,N){"use strict";var y=l("buffer").Buffer,d=4,F=y.alloc(d);F.fill(0);var M=8;function D(h,b){if(h.length%d!==0){var p=h.length+(d-h.length%d);h=y.concat([h,F],p)}for(var v=[],I=b?h.readInt32BE:h.readInt32LE,x=0;x<h.length;x+=d)v.push(I.call(h,x));return v}function E(h,b,p){for(var v=y.alloc(b),I=p?v.writeInt32BE:v.writeInt32LE,x=0;x<h.length;x++)I.call(v,h[x],x*4,!0);return v}function g(h,b,p,v){y.isBuffer(h)||(h=y.from(h));var I=b(D(h,v),h.length*M);return E(I,p,v)}V.exports={hash:g}},{buffer:73}],286:[function(l,V,N){"use strict";var y=l("./helpers");function d(){return hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72"}function F(v,I){v[I>>5]|=128<<I%32,v[(I+64>>>9<<4)+14]=I;for(var x=1732584193,S=-271733879,W=-1732584194,B=271733878,Q=0;Q<v.length;Q+=16){var G=x,$=S,J=W,U=B;x=D(x,S,W,B,v[Q+0],7,-680876936),B=D(B,x,S,W,v[Q+1],12,-389564586),W=D(W,B,x,S,v[Q+2],17,606105819),S=D(S,W,B,x,v[Q+3],22,-1044525330),x=D(x,S,W,B,v[Q+4],7,-176418897),B=D(B,x,S,W,v[Q+5],12,1200080426),W=D(W,B,x,S,v[Q+6],17,-1473231341),S=D(S,W,B,x,v[Q+7],22,-45705983),x=D(x,S,W,B,v[Q+8],7,1770035416),B=D(B,x,S,W,v[Q+9],12,-1958414417),W=D(W,B,x,S,v[Q+10],17,-42063),S=D(S,W,B,x,v[Q+11],22,-1990404162),x=D(x,S,W,B,v[Q+12],7,1804603682),B=D(B,x,S,W,v[Q+13],12,-40341101),W=D(W,B,x,S,v[Q+14],17,-1502002290),S=D(S,W,B,x,v[Q+15],22,1236535329),x=E(x,S,W,B,v[Q+1],5,-165796510),B=E(B,x,S,W,v[Q+6],9,-1069501632),W=E(W,B,x,S,v[Q+11],14,643717713),S=E(S,W,B,x,v[Q+0],20,-373897302),x=E(x,S,W,B,v[Q+5],5,-701558691),B=E(B,x,S,W,v[Q+10],9,38016083),W=E(W,B,x,S,v[Q+15],14,-660478335),S=E(S,W,B,x,v[Q+4],20,-405537848),x=E(x,S,W,B,v[Q+9],5,568446438),B=E(B,x,S,W,v[Q+14],9,-1019803690),W=E(W,B,x,S,v[Q+3],14,-187363961),S=E(S,W,B,x,v[Q+8],20,1163531501),x=E(x,S,W,B,v[Q+13],5,-1444681467),B=E(B,x,S,W,v[Q+2],9,-51403784),W=E(W,B,x,S,v[Q+7],14,1735328473),S=E(S,W,B,x,v[Q+12],20,-1926607734),x=g(x,S,W,B,v[Q+5],4,-378558),B=g(B,x,S,W,v[Q+8],11,-2022574463),W=g(W,B,x,S,v[Q+11],16,1839030562),S=g(S,W,B,x,v[Q+14],23,-35309556),x=g(x,S,W,B,v[Q+1],4,-1530992060),B=g(B,x,S,W,v[Q+4],11,1272893353),W=g(W,B,x,S,v[Q+7],16,-155497632),S=g(S,W,B,x,v[Q+10],23,-1094730640),x=g(x,S,W,B,v[Q+13],4,681279174),B=g(B,x,S,W,v[Q+0],11,-358537222),W=g(W,B,x,S,v[Q+3],16,-722521979),S=g(S,W,B,x,v[Q+6],23,76029189),x=g(x,S,W,B,v[Q+9],4,-640364487),B=g(B,x,S,W,v[Q+12],11,-421815835),W=g(W,B,x,S,v[Q+15],16,530742520),S=g(S,W,B,x,v[Q+2],23,-995338651),x=h(x,S,W,B,v[Q+0],6,-198630844),B=h(B,x,S,W,v[Q+7],10,1126891415),W=h(W,B,x,S,v[Q+14],15,-1416354905),S=h(S,W,B,x,v[Q+5],21,-57434055),x=h(x,S,W,B,v[Q+12],6,1700485571),B=h(B,x,S,W,v[Q+3],10,-1894986606),W=h(W,B,x,S,v[Q+10],15,-1051523),S=h(S,W,B,x,v[Q+1],21,-2054922799),x=h(x,S,W,B,v[Q+8],6,1873313359),B=h(B,x,S,W,v[Q+15],10,-30611744),W=h(W,B,x,S,v[Q+6],15,-1560198380),S=h(S,W,B,x,v[Q+13],21,1309151649),x=h(x,S,W,B,v[Q+4],6,-145523070),B=h(B,x,S,W,v[Q+11],10,-1120210379),W=h(W,B,x,S,v[Q+2],15,718787259),S=h(S,W,B,x,v[Q+9],21,-343485551),x=b(x,G),S=b(S,$),W=b(W,J),B=b(B,U)}return Array(x,S,W,B)}function M(v,I,x,S,W,B){return b(p(b(b(I,v),b(S,B)),W),x)}function D(v,I,x,S,W,B,Q){return M(I&x|~I&S,v,I,W,B,Q)}function E(v,I,x,S,W,B,Q){return M(I&S|x&~S,v,I,W,B,Q)}function g(v,I,x,S,W,B,Q){return M(I^x^S,v,I,W,B,Q)}function h(v,I,x,S,W,B,Q){return M(x^(I|~S),v,I,W,B,Q)}function b(v,I){var x=(v&65535)+(I&65535),S=(v>>16)+(I>>16)+(x>>16);return S<<16|x&65535}function p(v,I){return v<<I|v>>>32-I}V.exports=function(I){return y.hash(I,F,16)}},{"./helpers":285}],287:[function(l,V,N){"use strict";var y=l("./helpers");function d(g,h){g[h>>5]|=128<<24-h%32,g[(h+64>>9<<4)+15]=h;for(var b=Array(80),p=1732584193,v=-271733879,I=-1732584194,x=271733878,S=-1009589776,W=0;W<g.length;W+=16){for(var B=p,Q=v,G=I,$=x,J=S,U=0;U<80;U++){U<16?b[U]=g[W+U]:b[U]=E(b[U-3]^b[U-8]^b[U-14]^b[U-16],1);var j=D(D(E(p,5),F(U,v,I,x)),D(D(S,b[U]),M(U)));S=x,x=I,I=E(v,30),v=p,p=j}p=D(p,B),v=D(v,Q),I=D(I,G),x=D(x,$),S=D(S,J)}return Array(p,v,I,x,S)}function F(g,h,b,p){return g<20?h&b|~h&p:g<40?h^b^p:g<60?h&b|h&p|b&p:h^b^p}function M(g){return g<20?1518500249:g<40?1859775393:g<60?-1894007588:-899497514}function D(g,h){var b=(g&65535)+(h&65535),p=(g>>16)+(h>>16)+(b>>16);return p<<16|b&65535}function E(g,h){return g<<h|g>>>32-h}V.exports=function(h){return y.hash(h,d,20,!0)}},{"./helpers":285}],288:[function(l,V,N){"use strict";V.exports=function(){return function(){}}},{}],289:[function(l,V,N){(function(y){"use strict";var d=l("babel-runtime/helpers/typeof"),F=M(d);function M(p){return p&&p.__esModule?p:{default:p}}var D=l("stream"),E=D.Stream,g=l("../lib/common/utils/isArray"),h=g.isArray;V.exports.string=function(v){return typeof v=="string"},V.exports.array=h,V.exports.buffer=y.isBuffer;function b(p){return p instanceof E}V.exports.writableStream=function(v){return b(v)&&typeof v._write=="function"&&(0,F.default)(v._writableState)==="object"}}).call(this,{isBuffer:l("../node_modules/is-buffer/index.js")})},{"../lib/common/utils/isArray":42,"../node_modules/is-buffer/index.js":197,"babel-runtime/helpers/typeof":67,stream:230}],290:[function(l,V,N){"use strict";N.encodeURIComponent=function(y){try{return encodeURIComponent(y)}catch(d){return y}},N.escape=l("escape-html"),N.timestamp=function(d){if(d){var F=d;return typeof F=="string"&&(F=Number(F)),String(d).length===10&&(F*=1e3),new Date(F)}return Math.round(Date.now()/1e3)}},{"escape-html":191}],291:[function(l,V,N){(function(y,d){"use strict";var F=l("babel-runtime/core-js/json/stringify"),M=g(F),D=l("babel-runtime/helpers/typeof"),E=g(D);function g(U){return U&&U.__esModule?U:{default:U}}var h=l("util"),b=l("url"),p=l("http"),v=l("https"),I=l("debug")("urllib"),x=l("humanize-ms"),S,W=0,B=Math.pow(2,31)-10,Q=/^https?:\/\//i;function G(U,j){return U===void 0?j:U}function $(U,j){return function(T,ee,Z){if(T)return j(T);U({data:ee,status:Z.statusCode,headers:Z.headers,res:Z})}}N.TIMEOUTS=[x("300s"),x("300s")];var J=["json","text"];N.request=function(j,T,ee){return arguments.length===2&&typeof T=="function"&&(ee=T,T=null),typeof ee=="function"?N.requestWithCallback(j,T,ee):(S||(S=l("any-promise")),new S(function(Z,_){N.requestWithCallback(j,T,$(Z,_))}))},N.requestWithCallback=function(j,T,ee){if(!j||typeof j!="string"&&(typeof j=="undefined"?"undefined":(0,E.default)(j))!=="object"){var Z=h.format("expect request url to be a string or a http request options, but got %j",j);throw new Error(Z)}arguments.length===2&&typeof T=="function"&&(ee=T,T=null),T=T||{},W>=B&&(W=0);var _=++W;T.requestUrls=T.requestUrls||[];var X={requestId:_,url:j,args:T,ctx:T.ctx};T.emitter&&T.emitter.emit("request",X),T.timeout=T.timeout||N.TIMEOUTS,T.maxRedirects=T.maxRedirects||10,T.streaming=T.streaming||T.customResponse;var re=Date.now(),me;typeof j=="string"?(Q.test(j)||(j="http://"+j),me=b.parse(j)):me=j;var de=(T.type||T.method||me.method||"GET").toUpperCase(),we=me.port||80,ge=p,ke=G(T.agent,N.agent),z=T.fixJSONCtlChars;me.protocol==="https:"&&(ge=v,ke=G(T.httpsAgent,N.httpsAgent),me.port||(we=443));var ie={host:me.hostname||me.host||"localhost",path:me.path||"/",method:de,port:we,agent:ke,headers:T.headers||{},lookup:T.lookup};Array.isArray(T.timeout)?ie.requestTimeout=T.timeout[T.timeout.length-1]:typeof T.timeout!="undefined"&&(ie.requestTimeout=T.timeout);for(var H=["pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","secureProtocol","secureOptions"],ae=0;ae<H.length;ae++){var ue=H[ae];T.hasOwnProperty(ue)&&(ie[ue]=T[ue])}ie.rejectUnauthorized===!1&&!ie.hasOwnProperty("secureOptions")&&(ie.secureOptions=l("constants").SSL_OP_NO_TLSv1_2);var te=T.auth||me.auth;te&&(ie.auth=te);var Se=T.content||T.data,De=de==="GET"||de==="HEAD"||T.dataAsQueryString;if(!T.content&&(Se&&!(typeof Se=="string"||d.isBuffer(Se))))if(De)Se=T.nestedQuerystring?qs.stringify(Se):querystring.stringify(Se);else{var Fe=ie.headers["Content-Type"]||ie.headers["content-type"];Fe||(T.contentType==="json"?Fe="application/json":Fe="application/x-www-form-urlencoded",ie.headers["Content-Type"]=Fe),parseContentType(Fe).type==="application/json"?Se=(0,M.default)(Se):Se=T.nestedQuerystring?qs.stringify(Se):querystring.stringify(Se)}De&&Se&&(ie.path+=(me.query?"&":"?")+Se,Se=null);var Ke=0;if(Se){var et=Se.length;d.isBuffer(Se)||(et=d.byteLength(Se)),Ke=ie.headers["Content-Length"]=et}T.dataType==="json"&&(ie.headers.Accept="application/json"),typeof T.beforeRequest=="function"&&T.beforeRequest(ie);var Ie=null,dt=null,Ye=null,Pe=!1,Le=!1,Ge=0,ot=-1,be=!1,ye="",$e="",q=null;T.timing&&(q={queuing:0,dnslookup:0,connected:0,requestSent:0,waiting:0,contentDownload:0});function m(){Ie&&(clearTimeout(Ie),Ie=null)}function c(){dt&&(clearTimeout(dt),dt=null)}function R(at,jt,mr){if(c(),!ee){console.warn("[urllib:warn] [%s] [%s] [worker:%s] %s %s callback twice!!!",Date(),_,y.pid,ie.method,j),at&&console.warn(`[urllib:warn] [%s] [%s] [worker:%s] %s: %s
|
|
|
stack: %s`,Date(),_,y.pid,at.name,at.message,at.stack);return}var rr=ee;ee=null;var Sr={};if(mr&&(ot=mr.statusCode,Sr=mr.headers),ot===401&&Sr["www-authenticate"]&&(!T.headers||!T.headers.Authorization)&&T.digestAuth){var Fr=Sr["www-authenticate"];if(Fr.indexOf("Digest ")>=0)return I("Request#%d %s: got digest auth header WWW-Authenticate: %s",_,j,Fr),T.headers=T.headers||{},T.headers.Authorization=digestAuthHeader(ie.method,ie.path,Fr,T.digestAuth),I("Request#%d %s: auth with digest header: %s",_,j,T.headers.Authorization),mr.headers["set-cookie"]&&(T.headers.Cookie=mr.headers["set-cookie"].join(";")),N.requestWithCallback(j,T,rr)}var Nr=Date.now()-re;q&&(q.contentDownload=Nr),I("[%sms] done, %s bytes HTTP %s %s %s %s, keepAliveSocket: %s, timing: %j",Nr,Ge,ot,ie.method,ie.host,ie.path,Le,q);var Ar={status:ot,statusCode:ot,headers:Sr,size:Ge,aborted:be,rt:Nr,keepAliveSocket:Le,data:jt,requestUrls:T.requestUrls,timing:q,remoteAddress:ye,remotePort:$e};if(at){var tt="";ke&&typeof ke.getCurrentStatus=="function"&&(tt=", agent status: "+(0,M.default)(ke.getCurrentStatus())),at.message+=", "+ie.method+" "+j+" "+ot+" (connected: "+Pe+", keepalive socket: "+Le+tt+`)
|
|
|
headers: `+(0,M.default)(Sr),at.data=jt,at.path=ie.path,at.status=ot,at.headers=Sr,at.res=Ar}rr(at,jt,T.streaming?mr:Ar),T.emitter&&(X.url=j,X.socket=_t&&_t.connection,X.options=ie,X.size=Ke,T.emitter.emit("response",{requestId:_,error:at,ctx:T.ctx,req:X,res:Ar}))}function fe(at){var jt=null;if(T.followRedirect&&statuses.redirect[at.statusCode]){T._followRedirectCount=(T._followRedirectCount||0)+1;var mr=at.headers.location;if(!mr)jt=new Error("Got statusCode "+at.statusCode+" but cannot resolve next location from headers"),jt.name="FollowRedirectError";else if(T._followRedirectCount>T.maxRedirects)jt=new Error("Exceeded maxRedirects. Probably stuck in a redirect loop "+j),jt.name="MaxRedirectError";else{var rr=T.formatRedirectUrl?T.formatRedirectUrl(j,mr):b.resolve(j,mr);I("Request#%d %s: `redirected` from %s to %s",_,ie.path,j,rr),c(),T.headers&&T.headers.Host&&Q.test(mr)&&(T.headers.Host=null);var Sr=ee;return ee=null,N.requestWithCallback(rr,T,Sr),{redirect:!0,error:null}}}return{redirect:!1,error:jt}}!ie.headers["User-Agent"]&&!ie.headers["user-agent"]&&(ie.headers["User-Agent"]=navigator.userAgent),T.gzip&&(!ie.headers["Accept-Encoding"]&&!ie.headers["accept-encoding"]&&(ie.headers["Accept-Encoding"]="gzip"));function pe(at,jt,mr){var rr=at.headers["content-encoding"];return mr(null,jt,rr)}var Ae=T.writeStream;I("Request#%d %s %s with headers %j, options.path: %s",_,de,j,ie.headers,ie.path),T.requestUrls.push(j);function Qe(at){if(q&&(q.waiting=Date.now()-re),I("Request#%d %s `req response` event emit: status %d, headers: %j",_,j,at.statusCode,at.headers),T.streaming){var jt=fe(at);if(jt.redirect){at.resume();return}return jt.error?(at.resume(),R(jt.error,null,at)):R(null,null,at)}if(at.on("close",function(){I("Request#%d %s: `res close` event emit, total size %d",_,j,Ge)}),at.on("error",function(){I("Request#%d %s: `res error` event emit, total size %d",_,j,Ge)}),at.on("aborted",function(){be=!0,I("Request#%d %s: `res aborted` event emit, total size %d",_,j,Ge)}),Ae){var jt=fe(at);if(jt.redirect){at.resume();return}return jt.error?(at.resume(),Ae.end(),R(jt.error,null,at)):(T.consumeWriteStream===!1?at.on("end",R.bind(null,null,null,at)):isNode010||isNode012?first([[Ae,"close"],[at,"aborted"]],function(Sr,Fr,Nr){I("Request#%d %s: writeStream or res %s event emitted",_,j,Nr),R(Ye||null,null,at)}):Ae.on("close",function(){I("Request#%d %s: writeStream close event emitted",_,j),R(Ye||null,null,at)}),at.pipe(Ae))}var mr=[];at.on("data",function(rr){I("Request#%d %s: `res data` event emit, size %d",_,j,rr.length),Ge+=rr.length,mr.push(rr)}),at.on("end",function(){var rr=d.concat(mr,Ge);if(I("Request#%d %s: `res end` event emit, total size %d, _dumped: %s",_,j,Ge,at._dumped),Ye)return R(Ye,rr,at);var Sr=fe(at);if(Sr.error)return R(Sr.error,rr,at);if(Sr.redirect)return;pe(at,rr,function(Fr,Nr,Ar){if(Fr)return R(Fr,rr,at);if(!Ar&&J.indexOf(T.dataType)>=0){try{Nr=decodeBodyByCharset(Nr,at)}catch(Vn){return I("decodeBodyByCharset error: %s",Vn),R(null,Nr,at)}if(T.dataType==="json")if(Ge===0)Nr=null;else{var tt=parseJSON(Nr,z);tt.error?Fr=tt.error:Nr=tt.data}}be&&I("Request#%d %s: Remote socket was terminated before `response.end()` was called",_,j),R(Fr,Nr,at)})})}var nt,st;Array.isArray(T.timeout)?(nt=x(T.timeout[0]),st=x(T.timeout[1])):nt=st=x(T.timeout),I("ConnectTimeout: %d, ResponseTimeout: %d",nt,st);function yt(){I("Connect timer ticking, timeout: %d",nt),Ie=setTimeout(function(){Ie=null,ot===-1&&(ot=-2);var at="Connect timeout for "+nt+"ms",jt="ConnectionTimeoutError";_t.socket||(jt="SocketAssignTimeoutError",at+=", working sockets is full"),Ye=new Error(at),Ye.name=jt,Ye.requestId=_,I("ConnectTimeout: Request#%d %s %s: %s, connected: %s",_,j,Ye.name,at,Pe),Dt()},nt)}function ft(){I("Response timer ticking, timeout: %d",st),dt=setTimeout(function(){dt=null;var at="Response timeout for "+st+"ms",jt="ResponseTimeoutError";Ye=new Error(at),Ye.name=jt,Ye.requestId=_,I("ResponseTimeout: Request#%d %s %s: %s, connected: %s",_,j,Ye.name,at,Pe),Dt()},st)}var _t;ie.mode=T.mode?T.mode:"";try{_t=ge.request(ie,Qe)}catch(at){return R(at)}typeof window=="undefined"?yt():_t.on("requestTimeout",function(){ot===-1&&(ot=-2);var at="Connect timeout for "+nt+"ms",jt="ConnectionTimeoutError";Ye=new Error(at),Ye.name=jt,Ye.requestId=_,Dt()});function Dt(){I("Request#%d %s abort, connected: %s",_,j,Pe),_t.socket||(Ye.noSocket=!0,R(Ye)),_t.abort()}return q&&_t.on("finish",function(){q.requestSent=Date.now()-re}),_t.once("socket",function(at){q&&(q.queuing=Date.now()-re),isNode010&&at.socket&&(at=at.socket);var jt=at.readyState;if(jt==="opening"){at.once("lookup",function(mr,rr,Sr){I("Request#%d %s lookup: %s, %s, %s",_,j,mr,rr,Sr),q&&(q.dnslookup=Date.now()-re),rr&&(ye=rr)}),at.once("connect",function(){q&&(q.connected=Date.now()-re),m(),ft(),I("Request#%d %s new socket connected",_,j),Pe=!0,ye||(ye=at.remoteAddress),$e=at.remotePort});return}I("Request#%d %s reuse socket connected, readyState: %s",_,j,jt),Pe=!0,Le=!0,ye||(ye=at.remoteAddress),$e=at.remotePort,m(),ft()}),_t.on("error",function(at){(at.name==="Error"||at.name==="TypeError")&&(at.name=Pe?"ResponseError":"RequestError"),at.message+=' (req "error")',I("Request#%d %s `req error` event emit, %s: %s",_,j,at.name,at.message),R(Ye||at)}),Ae&&Ae.once("error",function(at){at.message+=' (writeStream "error")',Ye=at,I("Request#%d %s `writeStream error` event emit, %s: %s",_,j,at.name,at.message),Dt()}),T.stream?(T.stream.pipe(_t),T.stream.once("error",function(at){at.message+=' (stream "error")',Ye=at,I("Request#%d %s `readStream error` event emit, %s: %s",_,j,at.name,at.message),Dt()})):_t.end(Se),_t.requestId=_,_t}}).call(this,l("_process"),l("buffer").Buffer)},{_process:208,"any-promise":49,"babel-runtime/core-js/json/stringify":53,"babel-runtime/helpers/typeof":67,buffer:73,constants:75,debug:288,http:231,https:193,"humanize-ms":194,url:238,util:243}]},{},[1])(1)})}).call(this,__webpack_require__("IyRk"))},oRuE:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.pad.Iso10126={pad:function(d,F){var M=F*4,D=M-d.sigBytes%M;d.concat(y.lib.WordArray.random(D-1)).concat(y.lib.WordArray.create([D<<24],1))},unpad:function(d){var F=d.words[d.sigBytes-1>>>2]&255;d.sigBytes-=F}},y.pad.Iso10126})},oX8U:function(l,V,N){"use strict";(function(y){N.d(V,"a",function(){return M});var d=N("mrSG"),F=N("rOjP");function M(){var D=y.Canvas||y.HTMLCanvasElement,E=y.Image||y.HTMLImageElement,g=function(){if(D)return new D;throw new Error("createCanvasElement - missing Canvas implementation for nodejs environment")},h=function(){if(E)return new E;throw new Error("createImageElement - missing Image implementation for nodejs environment")},b=y.fetch||function(){throw new Error("fetch - missing fetch implementation for nodejs environment")},p=Object(F.a)();return Object(d.a)({Canvas:D||function(){function v(){}return v}(),CanvasRenderingContext2D:y.CanvasRenderingContext2D||function(){function v(){}return v}(),Image:E||function(){function v(){}return v}(),ImageData:y.ImageData||function(){function v(){}return v}(),Video:y.HTMLVideoElement||function(){function v(){}return v}(),createCanvasElement:g,createImageElement:h,fetch:b},p)}}).call(this,N("IyRk"))},pA7S:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("ETIr"),N("cv67"),N("K3mO"),N("OLod"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.WordArray,D=F.BlockCipher,E=d.algo,g=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],h=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],b=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],p=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],v=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],I=E.DES=D.extend({_doReset:function(){for(var B=this._key,Q=B.words,G=[],$=0;$<56;$++){var J=g[$]-1;G[$]=Q[J>>>5]>>>31-J%32&1}for(var U=this._subKeys=[],j=0;j<16;j++){for(var T=U[j]=[],ee=b[j],$=0;$<24;$++)T[$/6|0]|=G[(h[$]-1+ee)%28]<<31-$%6,T[4+($/6|0)]|=G[28+(h[$+24]-1+ee)%28]<<31-$%6;T[0]=T[0]<<1|T[0]>>>31;for(var $=1;$<7;$++)T[$]=T[$]>>>($-1)*4+3;T[7]=T[7]<<5|T[7]>>>27}for(var Z=this._invSubKeys=[],$=0;$<16;$++)Z[$]=U[15-$]},encryptBlock:function(B,Q){this._doCryptBlock(B,Q,this._subKeys)},decryptBlock:function(B,Q){this._doCryptBlock(B,Q,this._invSubKeys)},_doCryptBlock:function(B,Q,G){this._lBlock=B[Q],this._rBlock=B[Q+1],x.call(this,4,252645135),x.call(this,16,65535),S.call(this,2,858993459),S.call(this,8,16711935),x.call(this,1,1431655765);for(var $=0;$<16;$++){for(var J=G[$],U=this._lBlock,j=this._rBlock,T=0,ee=0;ee<8;ee++)T|=p[ee][((j^J[ee])&v[ee])>>>0];this._lBlock=j,this._rBlock=U^T}var Z=this._lBlock;this._lBlock=this._rBlock,this._rBlock=Z,x.call(this,1,1431655765),S.call(this,8,16711935),S.call(this,2,858993459),x.call(this,16,65535),x.call(this,4,252645135),B[Q]=this._lBlock,B[Q+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function x(B,Q){var G=(this._lBlock>>>B^this._rBlock)&Q;this._rBlock^=G,this._lBlock^=G<<B}function S(B,Q){var G=(this._rBlock>>>B^this._lBlock)&Q;this._lBlock^=G,this._rBlock^=G<<B}d.DES=D._createHelper(I);var W=E.TripleDES=D.extend({_doReset:function(){var B=this._key,Q=B.words;if(Q.length!==2&&Q.length!==4&&Q.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var G=Q.slice(0,2),$=Q.length<4?Q.slice(0,2):Q.slice(2,4),J=Q.length<6?Q.slice(0,2):Q.slice(4,6);this._des1=I.createEncryptor(M.create(G)),this._des2=I.createEncryptor(M.create($)),this._des3=I.createEncryptor(M.create(J))},encryptBlock:function(B,Q){this._des1.encryptBlock(B,Q),this._des2.decryptBlock(B,Q),this._des3.encryptBlock(B,Q)},decryptBlock:function(B,Q){this._des3.decryptBlock(B,Q),this._des2.encryptBlock(B,Q),this._des1.decryptBlock(B,Q)},keySize:192/32,ivSize:64/32,blockSize:64/32});d.TripleDES=D._createHelper(W)}(),y.TripleDES})},qBft:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.pad.AnsiX923={pad:function(d,F){var M=d.sigBytes,D=F*4,E=D-M%D,g=M+E-1;d.clamp(),d.words[g>>>2]|=E<<24-g%4*8,d.sigBytes+=E},unpad:function(d){var F=d.words[d.sigBytes-1>>>2]&255;d.sigBytes-=F}},y.pad.Ansix923})},qM6L:function(l,V,N){(function(y,d){l.exports=V=d(N("Ib8C"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.WordArray,D=d.enc,E=D.Utf16=D.Utf16BE={stringify:function(h){for(var b=h.words,p=h.sigBytes,v=[],I=0;I<p;I+=2){var x=b[I>>>2]>>>16-I%4*8&65535;v.push(String.fromCharCode(x))}return v.join("")},parse:function(h){for(var b=h.length,p=[],v=0;v<b;v++)p[v>>>1]|=h.charCodeAt(v)<<16-v%2*16;return M.create(p,b*2)}};D.Utf16LE={stringify:function(h){for(var b=h.words,p=h.sigBytes,v=[],I=0;I<p;I+=2){var x=g(b[I>>>2]>>>16-I%4*8&65535);v.push(String.fromCharCode(x))}return v.join("")},parse:function(h){for(var b=h.length,p=[],v=0;v<b;v++)p[v>>>1]|=g(h.charCodeAt(v)<<16-v%2*16);return M.create(p,b*2)}};function g(h){return h<<8&4278255360|h>>>8&16711935}}(),y.enc.Utf16})},qu8F:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("OLod"))})(this,function(y){/** @preserve
|
|
|
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
|
* derived from CryptoJS.mode.CTR
|
|
|
* Jan Hruby jhruby.web@gmail.com
|
|
|
*/return y.mode.CTRGladman=function(){var d=y.lib.BlockCipherMode.extend();function F(E){if((E>>24&255)===255){var g=E>>16&255,h=E>>8&255,b=E&255;g===255?(g=0,h===255?(h=0,b===255?b=0:++b):++h):++g,E=0,E+=g<<16,E+=h<<8,E+=b}else E+=1<<24;return E}function M(E){return(E[0]=F(E[0]))===0&&(E[1]=F(E[1])),E}var D=d.Encryptor=d.extend({processBlock:function(E,g){var h=this._cipher,b=h.blockSize,p=this._iv,v=this._counter;p&&(v=this._counter=p.slice(0),this._iv=void 0),M(v);var I=v.slice(0);h.encryptBlock(I,0);for(var x=0;x<b;x++)E[g+x]^=I[x]}});return d.Decryptor=D,d}(),y.mode.CTRGladman})},rOjP:function(l,V,N){"use strict";N.d(V,"a",function(){return y});function y(d){var F="";if(!d)try{d=N("Og1z")}catch(D){F=D.toString()}var M=d?function(D){return new Promise(function(E,g){d.readFile(D,function(h,b){return h?g(h):E(b)})})}:function(){throw new Error("readFile - failed to require fs in nodejs environment with error: "+F)};return{readFile:M}}},uGsb:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("MlIO"),N("1uat"))})(this,function(y){return function(){var d=y,F=d.x64,M=F.Word,D=F.WordArray,E=d.algo,g=E.SHA512,h=E.SHA384=g.extend({_doReset:function(){this._hash=new D.init([new M.init(3418070365,3238371032),new M.init(1654270250,914150663),new M.init(2438529370,812702999),new M.init(355462360,4144912697),new M.init(1731405415,4290775857),new M.init(2394180231,1750603025),new M.init(3675008525,1694076839),new M.init(1203062813,3204075428)])},_doFinalize:function(){var b=g._doFinalize.call(this);return b.sigBytes-=16,b}});d.SHA384=g._createHelper(h),d.HmacSHA384=g._createHmacHelper(h)}(),y.SHA384})},uGxW:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("OLod"))})(this,function(y){return y.pad.NoPadding={pad:function(){},unpad:function(){}},y.pad.NoPadding})},w7YG:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("ETIr"),N("cv67"),N("K3mO"),N("OLod"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.StreamCipher,D=d.algo,E=D.RC4=M.extend({_doReset:function(){for(var b=this._key,p=b.words,v=b.sigBytes,I=this._S=[],x=0;x<256;x++)I[x]=x;for(var x=0,S=0;x<256;x++){var W=x%v,B=p[W>>>2]>>>24-W%4*8&255;S=(S+I[x]+B)%256;var Q=I[x];I[x]=I[S],I[S]=Q}this._i=this._j=0},_doProcessBlock:function(b,p){b[p]^=g.call(this)},keySize:256/32,ivSize:0});function g(){for(var b=this._S,p=this._i,v=this._j,I=0,x=0;x<4;x++){p=(p+1)%256,v=(v+b[p])%256;var S=b[p];b[p]=b[v],b[v]=S,I|=b[(b[p]+b[v])%256]<<24-x*8}return this._i=p,this._j=v,I}d.RC4=M._createHelper(E);var h=D.RC4Drop=E.extend({cfg:E.cfg.extend({drop:192}),_doReset:function(){E._doReset.call(this);for(var b=this.cfg.drop;b>0;b--)g.call(this)}});d.RC4Drop=M._createHelper(h)}(),y.RC4})},wZgz:function(l,V,N){(function(y,d,F){l.exports=V=d(N("Ib8C"),N("ETIr"),N("cv67"),N("K3mO"),N("OLod"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.BlockCipher,D=d.algo,E=[],g=[],h=[],b=[],p=[],v=[],I=[],x=[],S=[],W=[];(function(){for(var G=[],$=0;$<256;$++)$<128?G[$]=$<<1:G[$]=$<<1^283;for(var J=0,U=0,$=0;$<256;$++){var j=U^U<<1^U<<2^U<<3^U<<4;j=j>>>8^j&255^99,E[J]=j,g[j]=J;var T=G[J],ee=G[T],Z=G[ee],_=G[j]*257^j*16843008;h[J]=_<<24|_>>>8,b[J]=_<<16|_>>>16,p[J]=_<<8|_>>>24,v[J]=_;var _=Z*16843009^ee*65537^T*257^J*16843008;I[j]=_<<24|_>>>8,x[j]=_<<16|_>>>16,S[j]=_<<8|_>>>24,W[j]=_,J?(J=T^G[G[G[Z^T]]],U^=G[G[U]]):J=U=1}})();var B=[0,1,2,4,8,16,32,64,128,27,54],Q=D.AES=M.extend({_doReset:function(){var G;if(this._nRounds&&this._keyPriorReset===this._key)return;for(var $=this._keyPriorReset=this._key,J=$.words,U=$.sigBytes/4,j=this._nRounds=U+6,T=(j+1)*4,ee=this._keySchedule=[],Z=0;Z<T;Z++)Z<U?ee[Z]=J[Z]:(G=ee[Z-1],Z%U?U>6&&Z%U==4&&(G=E[G>>>24]<<24|E[G>>>16&255]<<16|E[G>>>8&255]<<8|E[G&255]):(G=G<<8|G>>>24,G=E[G>>>24]<<24|E[G>>>16&255]<<16|E[G>>>8&255]<<8|E[G&255],G^=B[Z/U|0]<<24),ee[Z]=ee[Z-U]^G);for(var _=this._invKeySchedule=[],X=0;X<T;X++){var Z=T-X;if(X%4)var G=ee[Z];else var G=ee[Z-4];X<4||Z<=4?_[X]=G:_[X]=I[E[G>>>24]]^x[E[G>>>16&255]]^S[E[G>>>8&255]]^W[E[G&255]]}},encryptBlock:function(G,$){this._doCryptBlock(G,$,this._keySchedule,h,b,p,v,E)},decryptBlock:function(G,$){var J=G[$+1];G[$+1]=G[$+3],G[$+3]=J,this._doCryptBlock(G,$,this._invKeySchedule,I,x,S,W,g);var J=G[$+1];G[$+1]=G[$+3],G[$+3]=J},_doCryptBlock:function(G,$,J,U,j,T,ee,Z){for(var _=this._nRounds,X=G[$]^J[0],re=G[$+1]^J[1],me=G[$+2]^J[2],de=G[$+3]^J[3],we=4,ge=1;ge<_;ge++){var ke=U[X>>>24]^j[re>>>16&255]^T[me>>>8&255]^ee[de&255]^J[we++],z=U[re>>>24]^j[me>>>16&255]^T[de>>>8&255]^ee[X&255]^J[we++],ie=U[me>>>24]^j[de>>>16&255]^T[X>>>8&255]^ee[re&255]^J[we++],H=U[de>>>24]^j[X>>>16&255]^T[re>>>8&255]^ee[me&255]^J[we++];X=ke,re=z,me=ie,de=H}var ke=(Z[X>>>24]<<24|Z[re>>>16&255]<<16|Z[me>>>8&255]<<8|Z[de&255])^J[we++],z=(Z[re>>>24]<<24|Z[me>>>16&255]<<16|Z[de>>>8&255]<<8|Z[X&255])^J[we++],ie=(Z[me>>>24]<<24|Z[de>>>16&255]<<16|Z[X>>>8&255]<<8|Z[re&255])^J[we++],H=(Z[de>>>24]<<24|Z[X>>>16&255]<<16|Z[re>>>8&255]<<8|Z[me&255])^J[we++];G[$]=ke,G[$+1]=z,G[$+2]=ie,G[$+3]=H},keySize:256/32});d.AES=M._createHelper(Q)}(),y.AES})},wbyO:function(l,V,N){(function(y,d){l.exports=V=d(N("Ib8C"))})(this,function(y){return function(){var d=y,F=d.lib,M=F.WordArray,D=d.enc,E=D.Base64url={stringify:function(h,b=!0){var p=h.words,v=h.sigBytes,I=b?this._safe_map:this._map;h.clamp();for(var x=[],S=0;S<v;S+=3)for(var W=p[S>>>2]>>>24-S%4*8&255,B=p[S+1>>>2]>>>24-(S+1)%4*8&255,Q=p[S+2>>>2]>>>24-(S+2)%4*8&255,G=W<<16|B<<8|Q,$=0;$<4&&S+$*.75<v;$++)x.push(I.charAt(G>>>6*(3-$)&63));var J=I.charAt(64);if(J)for(;x.length%4;)x.push(J);return x.join("")},parse:function(h,b=!0){var p=h.length,v=b?this._safe_map:this._map,I=this._reverseMap;if(!I){I=this._reverseMap=[];for(var x=0;x<v.length;x++)I[v.charCodeAt(x)]=x}var S=v.charAt(64);if(S){var W=h.indexOf(S);W!==-1&&(p=W)}return g(h,p,I)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function g(h,b,p){for(var v=[],I=0,x=0;x<b;x++)if(x%4){var S=p[h.charCodeAt(x-1)]<<x%4*2,W=p[h.charCodeAt(x)]>>>6-x%4*2,B=S|W;v[I>>>2]|=B<<24-I%4*8,I++}return M.create(v,I)}}(),y.enc.Base64url})},yPBj:function(l,V,N){l.exports={flex_box_center:"flex_box_center___3-ehW",flex_space_between:"flex_space_between___1gePc",flex_box_vertical_center:"flex_box_vertical_center___2IxJA",flex_box_center_end:"flex_box_center_end___2Bh1H",flex_box_column:"flex_box_column___35awp",bg:"bg___CQ173",steps:"steps___upu0k",qrcode:"qrcode___25DP3"}}}]);
|