!function(n){var r={};function i(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,i),e.l=!0,e.exports}i.m=n,i.c=r,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=622)}([function(t,rh,ih){"use strict";(function(n,t,e,a){ih.d(rh,"Cd",function(){return Jf}),ih.d(rh,"Nb",function(){return Qf}),ih.d(rh,"rb",function(){return th}),ih.d(rh,"zc",function(){return eh}),ih.d(rh,"De",function(){return Nf}),ih.d(rh,"Mc",function(){return fl}),ih.d(rh,"wb",function(){return Yt}),ih.d(rh,"pb",function(){return Zt}),ih.d(rh,"mb",function(){return Jt}),ih.d(rh,"R",function(){return Uo}),ih.d(rh,"xb",function(){return ee}),ih.d(rh,"Xb",function(){return ff}),ih.d(rh,"tc",function(){return pf}),ih.d(rh,"Bd",function(){return bf}),ih.d(rh,"ne",function(){return Sf}),ih.d(rh,"ye",function(){return J}),ih.d(rh,"Ee",function(){return If}),ih.d(rh,"a",function(){return Cf}),ih.d(rh,"b",function(){return Mf}),ih.d(rh,"c",function(){return jf}),ih.d(rh,"d",function(){return Ff}),ih.d(rh,"i",function(){return Hf}),ih.d(rh,"j",function(){return Of}),ih.d(rh,"k",function(){return Kf}),ih.d(rh,"n",function(){return Vf}),ih.d(rh,"o",function(){return mt}),ih.d(rh,"p",function(){return ct}),ih.d(rh,"Be",function(){return Ct}),ih.d(rh,"q",function(){return vt}),ih.d(rh,"l",function(){return wt}),ih.d(rh,"m",function(){return Dc}),ih.d(rh,"f",function(){return te}),ih.d(rh,"g",function(){return Kt}),ih.d(rh,"h",function(){return ln}),ih.d(rh,"e",function(){return cn}),ih.d(rh,"Wb",function(){return il}),ih.d(rh,"fc",function(){return Zc}),ih.d(rh,"rc",function(){return Gc}),ih.d(rh,"Rd",function(){return Mc}),ih.d(rh,"Kb",function(){return al}),ih.d(rh,"Tc",function(){return Ue}),ih.d(rh,"N",function(){return Es}),ih.d(rh,"O",function(){return Ss}),ih.d(rh,"P",function(){return Ns}),ih.d(rh,"M",function(){return Is}),ih.d(rh,"I",function(){return Os}),ih.d(rh,"J",function(){return ks}),ih.d(rh,"K",function(){return As}),ih.d(rh,"L",function(){return Cs}),ih.d(rh,"X",function(){return qe}),ih.d(rh,"ld",function(){return He}),ih.d(rh,"Vb",function(){return $e}),ih.d(rh,"Y",function(){return Vo}),ih.d(rh,"Z",function(){return Wo}),ih.d(rh,"ab",function(){return qo}),ih.d(rh,"bb",function(){return Ho}),ih.d(rh,"cb",function(){return $o}),ih.d(rh,"Sd",function(){return Go}),ih.d(rh,"db",function(){return $s}),ih.d(rh,"eb",function(){return Gs}),ih.d(rh,"hb",function(){return Ks}),ih.d(rh,"fb",function(){return Xs}),ih.d(rh,"ob",function(){return Ys}),ih.d(rh,"Ad",function(){return Zs}),ih.d(rh,"gb",function(){return Js}),ih.d(rh,"sc",function(){return zs}),ih.d(rh,"ub",function(){return Us}),ih.d(rh,"Uc",function(){return Vs}),ih.d(rh,"pd",function(){return Qs}),ih.d(rh,"qd",function(){return tu}),ih.d(rh,"rd",function(){return eu}),ih.d(rh,"sd",function(){return nu}),ih.d(rh,"td",function(){return ru}),ih.d(rh,"vc",function(){return au}),ih.d(rh,"G",function(){return su}),ih.d(rh,"ad",function(){return uu}),ih.d(rh,"Id",function(){return cu}),ih.d(rh,"Jd",function(){return lu}),ih.d(rh,"Kd",function(){return fu}),ih.d(rh,"Ld",function(){return hu}),ih.d(rh,"Md",function(){return pu}),ih.d(rh,"r",function(){return Fa}),ih.d(rh,"s",function(){return za}),ih.d(rh,"t",function(){return Ua}),ih.d(rh,"B",function(){return Va}),ih.d(rh,"C",function(){return Wa}),ih.d(rh,"D",function(){return qa}),ih.d(rh,"F",function(){return Ha}),ih.d(rh,"U",function(){return $a}),ih.d(rh,"V",function(){return Ga}),ih.d(rh,"ib",function(){return Ka}),ih.d(rh,"jb",function(){return Xa}),ih.d(rh,"Ab",function(){return Ya}),ih.d(rh,"Bb",function(){return Za}),ih.d(rh,"Db",function(){return Ja}),ih.d(rh,"Hb",function(){return Qa}),ih.d(rh,"ic",function(){return ts}),ih.d(rh,"jc",function(){return es}),ih.d(rh,"kc",function(){return ns}),ih.d(rh,"Lc",function(){return rs}),ih.d(rh,"md",function(){return is}),ih.d(rh,"vd",function(){return os}),ih.d(rh,"wd",function(){return as}),ih.d(rh,"Ed",function(){return ss}),ih.d(rh,"Fd",function(){return us}),ih.d(rh,"Gd",function(){return cs}),ih.d(rh,"Hd",function(){return ls}),ih.d(rh,"Od",function(){return fs}),ih.d(rh,"Td",function(){return hs}),ih.d(rh,"Ud",function(){return ps}),ih.d(rh,"Zd",function(){return ds}),ih.d(rh,"ee",function(){return ms}),ih.d(rh,"fe",function(){return gs}),ih.d(rh,"x",function(){return mu}),ih.d(rh,"y",function(){return gu}),ih.d(rh,"z",function(){return yu}),ih.d(rh,"A",function(){return vu}),ih.d(rh,"mc",function(){return bu}),ih.d(rh,"uc",function(){return wu}),ih.d(rh,"yc",function(){return _u}),ih.d(rh,"Ac",function(){return xu}),ih.d(rh,"Fc",function(){return Eu}),ih.d(rh,"de",function(){return Su}),ih.d(rh,"fd",function(){return Nu}),ih.d(rh,"yb",function(){return Iu}),ih.d(rh,"zb",function(){return Ou}),ih.d(rh,"Qb",function(){return ku}),ih.d(rh,"Rb",function(){return Au}),ih.d(rh,"Sb",function(){return Cu}),ih.d(rh,"Tb",function(){return Pu}),ih.d(rh,"bc",function(){return Tu}),ih.d(rh,"cc",function(){return Mu}),ih.d(rh,"dc",function(){return Ru}),ih.d(rh,"ec",function(){return Du}),ih.d(rh,"Oc",function(){return ju}),ih.d(rh,"Pc",function(){return Bu}),ih.d(rh,"u",function(){return Lu}),ih.d(rh,"v",function(){return Fu}),ih.d(rh,"w",function(){return zu}),ih.d(rh,"E",function(){return Uu}),ih.d(rh,"sb",function(){return Vu}),ih.d(rh,"tb",function(){return Wu}),ih.d(rh,"Ib",function(){return qu}),ih.d(rh,"wc",function(){return Hu}),ih.d(rh,"xc",function(){return $u}),ih.d(rh,"Bc",function(){return Gu}),ih.d(rh,"Cc",function(){return Ku}),ih.d(rh,"Dc",function(){return Xu}),ih.d(rh,"Ec",function(){return Yu}),ih.d(rh,"Hc",function(){return Zu}),ih.d(rh,"Ic",function(){return Ju}),ih.d(rh,"bd",function(){return Qu}),ih.d(rh,"cd",function(){return tc}),ih.d(rh,"Vd",function(){return ec}),ih.d(rh,"Wd",function(){return nc}),ih.d(rh,"be",function(){return rc}),ih.d(rh,"ce",function(){return ic}),ih.d(rh,"vb",function(){return fc}),ih.d(rh,"ac",function(){return hc}),ih.d(rh,"dd",function(){return pc}),ih.d(rh,"nd",function(){return dc}),ih.d(rh,"zd",function(){return mc}),ih.d(rh,"nc",function(){return oc}),ih.d(rh,"oc",function(){return ac}),ih.d(rh,"pc",function(){return sc}),ih.d(rh,"qc",function(){return uc}),ih.d(rh,"Fe",function(){return cc}),ih.d(rh,"Ge",function(){return lc}),ih.d(rh,"S",function(){return aa}),ih.d(rh,"re",function(){return oa}),ih.d(rh,"ed",function(){return sa}),ih.d(rh,"Q",function(){return ua}),ih.d(rh,"T",function(){return ca}),ih.d(rh,"W",function(){return la}),ih.d(rh,"kb",function(){return fa}),ih.d(rh,"nb",function(){return ha}),ih.d(rh,"Cb",function(){return pa}),ih.d(rh,"Eb",function(){return da}),ih.d(rh,"Jb",function(){return ma}),ih.d(rh,"Kc",function(){return ga}),ih.d(rh,"Qc",function(){return ya}),ih.d(rh,"Vc",function(){return va}),ih.d(rh,"Wc",function(){return ba}),ih.d(rh,"Xc",function(){return wa}),ih.d(rh,"Yc",function(){return _a}),ih.d(rh,"Zc",function(){return xa}),ih.d(rh,"hd",function(){return Ea}),ih.d(rh,"id",function(){return Sa}),ih.d(rh,"jd",function(){return Na}),ih.d(rh,"od",function(){return Ia}),ih.d(rh,"Pd",function(){return Oa}),ih.d(rh,"Xd",function(){return ka}),ih.d(rh,"Yd",function(){return Aa}),ih.d(rh,"pe",function(){return Ca}),ih.d(rh,"ve",function(){return Pa}),ih.d(rh,"xe",function(){return Ta}),ih.d(rh,"Dd",function(){return Ma}),ih.d(rh,"Gb",function(){return rn}),ih.d(rh,"gc",function(){return on}),ih.d(rh,"Rc",function(){return en}),ih.d(rh,"kd",function(){return an}),ih.d(rh,"xd",function(){return Ke}),ih.d(rh,"ge",function(){return Ge}),ih.d(rh,"he",function(){return Xe}),ih.d(rh,"ie",function(){return Ye}),ih.d(rh,"je",function(){return Ze}),ih.d(rh,"ke",function(){return Je}),ih.d(rh,"le",function(){return Qe}),ih.d(rh,"me",function(){return tn}),ih.d(rh,"He",function(){return nn}),ih.d(rh,"Sc",function(){return sn}),ih.d(rh,"Ie",function(){return un}),ih.d(rh,"ue",function(){return gc}),ih.d(rh,"Nd",function(){return Ve}),ih.d(rh,"lc",function(){return We}),ih.d(rh,"hc",function(){return yc}),ih.d(rh,"Nc",function(){return vc}),ih.d(rh,"Lb",function(){return _c}),ih.d(rh,"we",function(){return xc}),ih.d(rh,"H",function(){return Ec}),ih.d(rh,"Jc",function(){return Sc}),ih.d(rh,"Gc",function(){return Nc}),ih.d(rh,"ae",function(){return Ic}),ih.d(rh,"se",function(){return Oc}),ih.d(rh,"yd",function(){return kc}),ih.d(rh,"Fb",function(){return Ac}),ih.d(rh,"Ub",function(){return Cc}),ih.d(rh,"ud",function(){return Pc}),ih.d(rh,"Yb",function(){return Tc}),ih.d(rh,"Qd",function(){return Rc}),ih.d(rh,"Mb",function(){return Bc}),ih.d(rh,"te",function(){return Zf}),ih.d(rh,"oe",function(){return ce}),ih.d(rh,"Zb",function(){return le}),ih.d(rh,"qb",function(){return fe}),ih.d(rh,"qe",function(){return he}),ih.d(rh,"gd",function(){return pe}),ih.d(rh,"lb",function(){return se}),ih.d(rh,"Ob",function(){return ne}),ih.d(rh,"Pb",function(){return re}),ih.d(rh,"ze",function(){return ie}),ih.d(rh,"Ae",function(){return oe}),ih.d(rh,"Ce",function(){return ae});
/**
 * @license
 * Copyright 2019 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 r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var o=function(){return(o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function m(o,a,s,u){return new(s||(s=Promise))(function(t,e){function n(t){try{i(u.next(t))}catch(t){e(t)}}function r(t){try{i(u.throw(t))}catch(t){e(t)}}function i(e){e.done?t(e.value):new s(function(t){t(e.value)}).then(n,r)}i((u=u.apply(o,a||[])).next())})}function I(n,r){var i,o,a,t,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(a=2&e[0]?o.return:e[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,e[1])).done)return a;switch(o=0,a&&(e=[2&e[0],a.value]),e[0]){case 0:case 1:a=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,o=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){s.label=e[1];break}if(6===e[0]&&s.label<a[1]){s.label=a[1],a=e;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(e);break}a[2]&&s.ops.pop(),s.trys.pop();continue}e=r.call(n,s)}catch(t){e=[6,t],o=0}finally{i=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}var s={},u={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function c(e){e in s||(document.createElement("canvas").addEventListener("webglcontextlost",function(t){t.preventDefault(),delete s[e]},!1),s[e]=function(t){if(1!==t&&2!==t)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");var e=document.createElement("canvas");return 1===t?e.getContext("webgl",u)||e.getContext("experimental-webgl",u):e.getContext("webgl2",u)}(e));var t=s[e];return t.isContextLost()?(delete s[e],c(e)):(t.disable(t.DEPTH_TEST),t.disable(t.STENCIL_TEST),t.disable(t.BLEND),t.disable(t.DITHER),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SAMPLE_COVERAGE),t.enable(t.SCISSOR_TEST),t.enable(t.CULL_FACE),t.cullFace(t.BACK),s[e])}function l(t){for(var e=t.length,n=0,r=0;0<e;)r=Math.random()*e|0,n=t[--e],t[e]=t[r],t[r]=n}function f(t,e,n){return Math.max(t,Math.min(e,n))}function S(t){return t%2==0?t:t+1}function h(t){for(var e=0,n=0;n<t.length;n++)e+=t[n];return e}function p(t,e){var n=Math.random();return e*n+(1-n)*t}function C(t,e){if(!t)throw new Error("string"==typeof e?e:e())}function d(t,e,n){void 0===n&&(n=""),C(x(t,e),n+" Shapes "+t+" and "+e+" must match")}function g(t){C(null!=t,"The input to the tensor constructor must be a non-null value.")}function y(t,e){if(void 0===e&&(e=[]),Array.isArray(t)||D(t))for(var n=0;n<t.length;++n)y(t[n],e);else e.push(t);return e}function L(t){if(0===t.length)return 1;for(var e=t[0],n=1;n<t.length;n++)e*=t[n];return e}function x(t,e){if(t===e)return!0;if(null==t||null==e)return!1;if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function P(t){return t%1==0}function v(t){if(null!=Math.tanh)return Math.tanh(t);if(t===1/0)return 1;if(t===-1/0)return-1;var e=Math.exp(2*t);return(e-1)/(e+1)}function b(t){var e=Math.ceil(Math.sqrt(t));return[e,Math.ceil(t/e)]}function w(t,e){return e<=t.length?t:t+" ".repeat(e-t.length)}function _(o,a,s){return void 0===a&&(a=function(t){return 0}),new Promise(function(e,n){var r=0,i=function(){if(o())e();else{var t=a(++r);null!=s&&s<=r?n():setTimeout(i,t)}};i()})}function E(t,e){for(var n=1,r=-1,i=0;i<t.length;++i)if(0<=t[i])n*=t[i];else if(-1===t[i]){if(-1!==r)throw Error("Shapes can only have 1 implicit size. Found -1 at dim "+r+" and dim "+i);r=i}else if(t[i]<0)throw Error("Shapes can not be < 0. Found "+t[i]+" at dim "+i);if(-1===r){if(0<e&&e!==n)throw Error("Size("+e+") must match the product of shape "+t);return t}if(0===n)throw Error("Cannot infer the missing size in ["+t+"] when there are 0 elements");if(e%n!=0)throw Error("The implicit shape can't be a fractional number. Got "+e+" / "+n);var o=t.slice();return o[r]=e/n,o}function N(t,e){var n=e.length;return C((t=null==t?e.map(function(t,e){return e}):[].concat(t)).every(function(t){return-n<=t&&t<n}),"All values in axis param must be in range [-"+n+", "+n+") but got axis "+t),C(t.every(function(t){return P(t)}),"All values in axis param must be integers but got axis "+t),t.map(function(t){return t<0?n+t:t})}function O(t,e){for(var n=[],r=[],i=null==e?null:N(e,t).sort(),o=0,a=0;a<t.length;++a){if(null!=i){if(i[o]===a&&1!==t[a])throw new Error("Can't squeeze axis "+a+" since its dim '"+t[a]+"' is not 1");(null==i[o]||i[o]>a)&&1===t[a]&&(n.push(t[a]),r.push(a)),i[o]<=a&&o++}1!==t[a]&&(n.push(t[a]),r.push(a))}return{newShape:n,keptDims:r}}function k(t,e){var n=null;if(null==t||"float32"===t)n=new Float32Array(e);else if("int32"===t)n=new Int32Array(e);else{if("bool"!==t)throw new Error("Unknown data type "+t);n=new Uint8Array(e)}return n}function A(t,e){var n=null;if(null==t||"float32"===t)n=new Float32Array(e);else if("int32"===t)n=new Int32Array(e);else if("bool"===t)n=new Uint8Array(e);else{if("string"!==t)throw new Error("Unknown data type "+t);n=new Array(e)}return n}function T(t,e,n){if("float32"===e)for(var r=0;r<t.length;r++){var i=t[r];if(isNaN(i)||!isFinite(i))throw Error("The result of the '"+n+"' is "+i+".")}}function M(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(isNaN(r)||!isFinite(r))throw Error("A tensor of type "+e+" being uploaded contains "+r+".")}}function R(t,e){return!("complex64"===e||"float32"===e&&"complex64"!==t||"int32"===e&&"float32"!==t&&"complex64"!==t||"bool"===e&&"bool"===t)}function D(t){return t instanceof Float32Array||t instanceof Int32Array||t instanceof Uint8Array}function j(t){if("float32"===t||"int32"===t)return 4;if("complex64"===t)return 8;if("bool"===t)return 1;throw new Error("Unknown dtype "+t)}function B(t){if(null==t)return 0;var e=0;return t.forEach(function(t){return e+=2*t.length}),e}function F(t){return"string"==typeof t||t instanceof String}function z(t){return"boolean"==typeof t}function U(t){return"number"==typeof t}function V(t){return Array.isArray(t)?V(t[0]):t instanceof Float32Array?"float32":t instanceof Int32Array||t instanceof Uint8Array?"int32":U(t)?"float32":F(t)?"string":z(t)?"bool":"float32"}function W(t){return!!(t&&t.constructor&&t.call&&t.apply)}function q(t,e){for(var n=e;n<t;++n)if(t%n==0)return n;return t}function H(t){var e=t.length;if(e<2)return[];var n=new Array(e-1);n[e-2]=t[e-1];for(var r=e-3;0<=r;--r)n[r]=n[r+1]*t[r+1];return n}function $(t,e,n){if("string"===e)throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(t)&&(t=y(t)),n&&M(t,e),function(t,e){return t instanceof Float32Array&&"float32"===e||t instanceof Int32Array&&"int32"===e||t instanceof Uint8Array&&"bool"===e}(t,e))return t;if(null==e||"float32"===e||"complex64"===e)return new Float32Array(t);if("int32"===e)return new Int32Array(t);if("bool"!==e)throw new Error("Unknown data type "+e);for(var r=new Uint8Array(t.length),i=0;i<r.length;++i)0!==Math.round(t[i])&&(r[i]=1);return r}function G(t,e){if(0===t.length)return e[0];var n=t.reduce(function(t,e){return t*e});if(0===n)return[];if(n!==e.length)throw new Error("["+t+"] does not match the input size.");return function t(e,n,r){var i=new Array;if(1===n.length)for(var o=n[0],a=0;a<o;a++)i[a]=r[e+a];else{o=n[0];var s=n.slice(1),u=s.reduce(function(t,e){return t*e});for(a=0;a<o;a++)i[a]=t(e+a*u,s,r)}return i}(0,t,e)}function K(t,e){for(var n=X(t,e),r=0;r<n.length;r++)n[r]=1;return n}function X(t,e){if(null==e||"float32"===e||"complex64"===e)return new Float32Array(t);if("int32"===e)return new Int32Array(t);if("bool"===e)return new Uint8Array(t);throw new Error("Unknown data type "+e)}function Y(){if("undefined"!=typeof performance)return performance.now();if(void 0===n)throw new Error("Cannot measure time in this environment. You should run tf.js in the browser or in Node.js");var t=n.hrtime();return 1e3*t[0]+t[1]/1e6}function Z(n,r,i,o){var t,e,a;C(null!=(a=n)&&Array.isArray(a)&&0<a.length,"promises must be a none empty array"),t=i=null==i?0:i,e=o=null==o?1:o,C(0<=t&&t<=1,"Progress fraction must be in range [0, 1], but got startFraction "+t),C(0<=e&&e<=1,"Progress fraction must be in range [0, 1], but got endFraction "+e),C(t<=e,"startFraction must be no more than endFraction, but got startFraction "+t+" and endFraction "+e);var s=0;return Promise.all(n.map(function(t){return t.then(function(t){var e=i+ ++s/n.length*(o-i);return r(e),t}),t}))}var J=Object.freeze({shuffle:l,clamp:f,nearestLargerEven:S,sum:h,randUniform:p,distSquared:function(t,e){for(var n=0,r=0;r<t.length;r++){var i=Number(t[r])-Number(e[r]);n+=i*i}return n},assert:C,assertShapesMatch:d,assertNonNull:g,flatten:y,sizeFromShape:L,isScalarShape:function(t){return 0===t.length},arraysEqual:x,isInt:P,tanh:v,sizeToSquarishShape:b,createShuffledIndices:function(t){for(var e=new Uint32Array(t),n=0;n<t;++n)e[n]=n;return l(e),e},rightPad:w,repeatedTry:_,inferFromImplicitShape:E,parseAxisParam:N,squeezeShape:O,getTypedArrayFromDType:k,getArrayFromDType:A,checkComputationForErrors:T,checkConversionForErrors:M,hasEncodingLoss:R,isTypedArray:D,bytesPerElement:j,bytesFromStringArray:B,isString:F,isBoolean:z,isNumber:U,inferDtype:V,isFunction:W,nearestDivisor:q,computeStrides:H,toTypedArray:$,toNestedArray:G,makeOnesTypedArray:K,makeZerosTypedArray:X,now:Y,monitorPromisesProgress:Z}),Q=(ot.prototype.profileKernel=function(i,t){var e,o=this,a=this.backendTimer.time(function(){e=t()});return(Array.isArray(e)?e:[e]).forEach(function(n){var r=n.dataSync();T(r,n.dtype,i),a.then(function(t){var e="";null!=t.getExtraProfileInfo&&(e=t.getExtraProfileInfo()),o.logger.logKernelProfile(i,n,r,t.kernelMs,e)})}),e},ot),tt=(it.prototype.logKernelProfile=function(t,e,n,r,i){var o=w(r+"ms",9),a=w(t,25),s=e.rank,u=e.size,c=w(e.shape.toString(),14);console.log("%c"+a+"\t%c"+o+"\t%c"+s+"D "+c+"\t%c"+u+"\t%c"+i,"font-weight:bold","color:red","color:blue","color: orange","color: green")},it),et=20,nt=3,rt=7;function it(){}function ot(t,e){this.backendTimer=t,null==(this.logger=e)&&(this.logger=new tt)}function at(t,e,n,r){var i=H(e),o=function(t,e,n,r){var i=L(e),o=r[r.length-1],a=new Array(o).fill(0),s=e.length,u="complex64"===n?ut(t):t;if(1<s)for(var c=0;c<i/o;c++)for(var l=c*o,f=0;f<o;f++)a[f]=Math.max(a[f],st(u[l+f],0).length);return a}(t,e,n,i),a=e.length,s=function t(e,n,r,i,o,a){void 0===a&&(a=!0);var s="complex64"===r?2:1,u=n[0],c=n.length;if(0===c)return"complex64"===r?[st(ut(e)[0],0)]:[e[0].toString()];if(1===c){if(et<u){var l=nt*s,f=Array.from(e.slice(0,l)),h=Array.from(e.slice(u-nt*s,u));return"complex64"===r&&(f=ut(f),h=ut(h)),["["+f.map(function(t,e){return st(t,o[e])}).join(", ")+", ..., "+h.map(function(t,e){return st(t,o[u-nt+e])}).join(", ")+"]"]}return["["+("complex64"===r?ut(e):Array.from(e)).map(function(t,e){return st(t,o[e])}).join(", ")+"]"]}var p=n.slice(1),d=i.slice(1),m=i[0]*s,g=[];if(et<u){for(var y=0;y<nt;y++){var v=(b=y*m)+m;g.push.apply(g,t(e.slice(b,v),p,r,d,o,!1))}for(g.push("..."),y=u-nt;y<u;y++)v=(b=y*m)+m,g.push.apply(g,t(e.slice(b,v),p,r,d,o,y===u-1))}else for(y=0;y<u;y++){var b;v=(b=y*m)+m,g.push.apply(g,t(e.slice(b,v),p,r,d,o,y===u-1))}var w=2===c?",":"";g[0]="["+g[0]+w;for(y=1;y<g.length-1;y++)g[y]=" "+g[y]+w;var _=",\n";for(y=2;y<c;y++)_+="\n";return g[g.length-1]=" "+g[g.length-1]+"]"+(a?"":_),g}(t,e,n,i,o),u=["Tensor"];return r&&(u.push("  dtype: "+n),u.push("  rank: "+a),u.push("  shape: ["+e+"]"),u.push("  values:")),u.push(s.map(function(t){return"    "+t}).join("\n")),u.join("\n")}function st(t,e){return w(Array.isArray(t)?parseFloat(t[0].toFixed(rt))+" + "+parseFloat(t[1].toFixed(rt))+"j":F(t)?"'"+t+"'":parseFloat(t.toFixed(rt)).toString(),e)}function ut(t){for(var e=[],n=0;n<t.length;n+=2)e.push([t[n],t[n+1]]);return e}var ct=(pt.prototype.set=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];0===e.length&&(e=[0]),C(e.length===this.rank,"The number of provided coordinates ("+e.length+") must match the rank ("+this.rank+")");var r=this.locToIndex(e);this.values[r]=t},pt.prototype.get=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];0===t.length&&(t=[0]);for(var n=t[t.length-1],r=0;r<t.length-1;++r)n+=this.strides[r]*t[r];return this.values[n]},pt.prototype.locToIndex=function(t){if(0===this.rank)return 0;if(1===this.rank)return t[0];for(var e=t[t.length-1],n=0;n<t.length-1;++n)e+=this.strides[n]*t[n];return e},pt.prototype.indexToLoc=function(t){if(0===this.rank)return[];if(1===this.rank)return[t];for(var e=new Array(this.shape.length),n=0;n<e.length-1;++n)e[n]=Math.floor(t/this.strides[n]),t-=e[n]*this.strides[n];return e[e.length-1]=t,e},Object.defineProperty(pt.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),pt.prototype.toTensor=function(){return mt.make(this.shape,{values:this.values},this.dtype)},pt),lt=null,ft=null,ht=null;function pt(t,e,n){if(this.dtype=e,this.shape=t.slice(),this.size=L(t),null!=n){var r=n.length;C(r===this.size,"Length of values '"+r+"' does not match the size inferred by the shape '"+this.size+"'.")}if("complex64"===e)throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||A(e,L(this.shape)),this.strides=H(t)}function dt(t){lt=t}var mt=(gt.make=function(t,e,n){return new gt(t,n,e.values,e.dataId)},gt.prototype.flatten=function(){return this.throwIfDisposed(),this.as1D()},gt.prototype.asScalar=function(){return this.throwIfDisposed(),C(1===this.size,"The array must have only 1 element."),this.reshape([])},gt.prototype.as1D=function(){return this.throwIfDisposed(),this.reshape([this.size])},gt.prototype.as2D=function(t,e){return this.throwIfDisposed(),this.reshape([t,e])},gt.prototype.as3D=function(t,e,n){return this.throwIfDisposed(),this.reshape([t,e,n])},gt.prototype.as4D=function(t,e,n,r){return this.throwIfDisposed(),this.reshape([t,e,n,r])},gt.prototype.as5D=function(t,e,n,r,i){return this.throwIfDisposed(),this.reshape([t,e,n,r,i])},gt.prototype.asType=function(t){return this.throwIfDisposed(),ft.cast(this,t)},Object.defineProperty(gt.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),gt.prototype.get=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];ht("Tensor.get() is deprecated. Use Tensor.array() and native array indexing instead."),C(t.length===this.rank,"Number of coordinates in get() must match the rank of the tensor"),C("complex64"!==this.dtype,"Tensor.get() is not supported for complex64 tensors yet."),this.throwIfDisposed(),0===t.length&&(t=[0]);for(var n=t[t.length-1],r=0;r<t.length-1;++r)n+=this.strides[r]*t[r];return this.dataSync()[n]},gt.prototype.buffer=function(){return ht("Tensor.buffer() is renamed to Tensor.bufferSync() in TensorFlow.js 1.0 and Tensor.buffer() will become an async function."),ft.buffer(this.shape,this.dtype,this.dataSync())},gt.prototype.bufferSync=function(){return ft.buffer(this.shape,this.dtype,this.dataSync())},gt.prototype.array=function(){return m(this,void 0,void 0,function(){var e,n;return I(this,function(t){switch(t.label){case 0:return e=G,n=[this.shape],[4,this.data()];case 1:return[2,e.apply(void 0,n.concat([t.sent()]))]}})})},gt.prototype.arraySync=function(){return G(this.shape,this.dataSync())},gt.prototype.data=function(){return m(this,void 0,void 0,function(){return I(this,function(t){return this.throwIfDisposed(),[2,lt().read(this.dataId)]})})},gt.prototype.dataSync=function(){return this.throwIfDisposed(),lt().readSync(this.dataId)},gt.prototype.dispose=function(){this.isDisposed||(lt().disposeTensor(this),this.isDisposedInternal=!0)},Object.defineProperty(gt.prototype,"isDisposed",{get:function(){return this.isDisposedInternal},enumerable:!0,configurable:!0}),gt.prototype.throwIfDisposed=function(){if(this.isDisposed)throw new Error("Tensor is disposed.")},gt.prototype.toFloat=function(){return this.asType("float32")},gt.prototype.toInt=function(){return this.asType("int32")},gt.prototype.toBool=function(){return this.asType("bool")},gt.prototype.print=function(t){return void 0===t&&(t=!1),ft.print(this,t)},gt.prototype.reshape=function(t){return this.throwIfDisposed(),ft.reshape(this,t)},gt.prototype.reshapeAs=function(t){return this.throwIfDisposed(),this.reshape(t.shape)},gt.prototype.expandDims=function(t){return void 0===t&&(t=0),ft.expandDims(this,t)},gt.prototype.cumsum=function(t,e,n){return void 0===t&&(t=0),void 0===e&&(e=!1),void 0===n&&(n=!1),ft.cumsum(this,t,e,n)},gt.prototype.squeeze=function(t){return this.throwIfDisposed(),ft.squeeze(this,t)},gt.prototype.clone=function(){return this.throwIfDisposed(),ft.clone(this)},gt.prototype.oneHot=function(t,e,n){return this.throwIfDisposed(),ft.oneHot(this,t,e,n)},gt.prototype.toString=function(t){return void 0===t&&(t=!1),at(this.dataSync(),this.shape,this.dtype,t)},gt.prototype.tile=function(t){return this.throwIfDisposed(),ft.tile(this,t)},gt.prototype.gather=function(t,e){return void 0===e&&(e=0),this.throwIfDisposed(),ft.gather(this,t,e)},gt.prototype.matMul=function(t,e,n){return void 0===e&&(e=!1),void 0===n&&(n=!1),this.throwIfDisposed(),ft.matMul(this,t,e,n)},gt.prototype.dot=function(t){return this.throwIfDisposed(),ft.dot(this,t)},gt.prototype.norm=function(t,e,n){return void 0===t&&(t="euclidean"),void 0===e&&(e=null),void 0===n&&(n=!1),this.throwIfDisposed(),ft.norm(this,t,e,n)},gt.prototype.slice=function(t,e){return this.throwIfDisposed(),ft.slice(this,t,e)},gt.prototype.reverse=function(t){return this.throwIfDisposed(),ft.reverse(this,t)},gt.prototype.concat=function(t,e){return void 0===e&&(e=0),this.throwIfDisposed(),t instanceof gt&&(t=[t]),ft.concat([this].concat(t),e)},gt.prototype.split=function(t,e){return void 0===e&&(e=0),this.throwIfDisposed(),ft.split(this,t,e)},gt.prototype.stack=function(t,e){return void 0===e&&(e=0),ft.stack([this,t],e)},gt.prototype.unstack=function(t){return void 0===t&&(t=0),ft.unstack(this,t)},gt.prototype.pad=function(t,e){return void 0===e&&(e=0),ft.pad(this,t,e)},gt.prototype.batchNormalization=function(t,e,n,r,i){return void 0===n&&(n=.001),ht("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon"),this.batchNorm(t,e,i,r,n)},gt.prototype.batchNorm=function(t,e,n,r,i){return void 0===i&&(i=.001),this.throwIfDisposed(),ft.batchNorm(this,t,e,n,r,i)},gt.prototype.all=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),ft.all(this,t,e)},gt.prototype.any=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),ft.any(this,t,e)},gt.prototype.logSumExp=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),ft.logSumExp(this,t,e)},gt.prototype.sum=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),ft.sum(this,t,e)},gt.prototype.prod=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),ft.prod(this,t,e)},gt.prototype.mean=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),ft.mean(this,t,e)},gt.prototype.min=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),ft.min(this,t,e)},gt.prototype.max=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),ft.max(this,t,e)},gt.prototype.argMin=function(t){return void 0===t&&(t=null),this.throwIfDisposed(),ft.argMin(this,t)},gt.prototype.argMax=function(t){return void 0===t&&(t=null),this.throwIfDisposed(),ft.argMax(this,t)},gt.prototype.cast=function(t){return this.throwIfDisposed(),ft.cast(this,t)},gt.prototype.add=function(t){return this.throwIfDisposed(),ft.add(this,t)},gt.prototype.addStrict=function(t){return this.throwIfDisposed(),ft.addStrict(this,t)},gt.prototype.atan2=function(t){return this.throwIfDisposed(),ft.atan2(this,t)},gt.prototype.sub=function(t){return this.throwIfDisposed(),ft.sub(this,t)},gt.prototype.subStrict=function(t){return this.throwIfDisposed(),ft.subStrict(this,t)},gt.prototype.pow=function(t){return this.throwIfDisposed(),ft.pow(this,t)},gt.prototype.powStrict=function(t){return this.throwIfDisposed(),ft.powStrict(this,t)},gt.prototype.mul=function(t){return this.throwIfDisposed(),ft.mul(this,t)},gt.prototype.mulStrict=function(t){return this.throwIfDisposed(),ft.mulStrict(this,t)},gt.prototype.div=function(t){return this.throwIfDisposed(),ft.div(this,t)},gt.prototype.floorDiv=function(t){return this.throwIfDisposed(),ft.floorDiv(this,t)},gt.prototype.divStrict=function(t){return this.throwIfDisposed(),ft.divStrict(this,t)},gt.prototype.minimum=function(t){return this.throwIfDisposed(),ft.minimum(this,t)},gt.prototype.minimumStrict=function(t){return this.throwIfDisposed(),ft.minimumStrict(this,t)},gt.prototype.maximum=function(t){return this.throwIfDisposed(),ft.maximum(this,t)},gt.prototype.maximumStrict=function(t){return this.throwIfDisposed(),ft.maximumStrict(this,t)},gt.prototype.mod=function(t){return this.throwIfDisposed(),ft.mod(this,t)},gt.prototype.modStrict=function(t){return this.throwIfDisposed(),ft.modStrict(this,t)},gt.prototype.squaredDifference=function(t){return this.throwIfDisposed(),ft.squaredDifference(this,t)},gt.prototype.squaredDifferenceStrict=function(t){return this.throwIfDisposed(),ft.squaredDifferenceStrict(this,t)},gt.prototype.transpose=function(t){return this.throwIfDisposed(),ft.transpose(this,t)},gt.prototype.notEqual=function(t){return this.throwIfDisposed(),ft.notEqual(this,t)},gt.prototype.notEqualStrict=function(t){return this.throwIfDisposed(),ft.notEqualStrict(this,t)},gt.prototype.less=function(t){return this.throwIfDisposed(),ft.less(this,t)},gt.prototype.lessStrict=function(t){return this.throwIfDisposed(),ft.lessStrict(this,t)},gt.prototype.equal=function(t){return this.throwIfDisposed(),ft.equal(this,t)},gt.prototype.equalStrict=function(t){return this.throwIfDisposed(),ft.equalStrict(this,t)},gt.prototype.lessEqual=function(t){return this.throwIfDisposed(),ft.lessEqual(this,t)},gt.prototype.lessEqualStrict=function(t){return this.throwIfDisposed(),ft.lessEqualStrict(this,t)},gt.prototype.greater=function(t){return this.throwIfDisposed(),ft.greater(this,t)},gt.prototype.greaterStrict=function(t){return this.throwIfDisposed(),ft.greaterStrict(this,t)},gt.prototype.greaterEqual=function(t){return this.throwIfDisposed(),ft.greaterEqual(this,t)},gt.prototype.greaterEqualStrict=function(t){return this.throwIfDisposed(),ft.greaterEqualStrict(this,t)},gt.prototype.logicalAnd=function(t){return this.throwIfDisposed(),ft.logicalAnd(this,t)},gt.prototype.logicalOr=function(t){return this.throwIfDisposed(),ft.logicalOr(this,t)},gt.prototype.logicalNot=function(){return this.throwIfDisposed(),ft.logicalNot(this)},gt.prototype.logicalXor=function(t){return this.throwIfDisposed(),ft.logicalXor(this,t)},gt.prototype.where=function(t,e){return this.throwIfDisposed(),ft.where(t,this,e)},gt.prototype.neg=function(){return this.throwIfDisposed(),ft.neg(this)},gt.prototype.ceil=function(){return this.throwIfDisposed(),ft.ceil(this)},gt.prototype.floor=function(){return this.throwIfDisposed(),ft.floor(this)},gt.prototype.sign=function(){return this.throwIfDisposed(),ft.sign(this)},gt.prototype.exp=function(){return this.throwIfDisposed(),ft.exp(this)},gt.prototype.expm1=function(){return this.throwIfDisposed(),ft.expm1(this)},gt.prototype.log=function(){return this.throwIfDisposed(),ft.log(this)},gt.prototype.log1p=function(){return this.throwIfDisposed(),ft.log1p(this)},gt.prototype.sqrt=function(){return this.throwIfDisposed(),ft.sqrt(this)},gt.prototype.rsqrt=function(){return this.throwIfDisposed(),ft.rsqrt(this)},gt.prototype.square=function(){return this.throwIfDisposed(),ft.square(this)},gt.prototype.reciprocal=function(){return this.throwIfDisposed(),ft.reciprocal(this)},gt.prototype.abs=function(){return this.throwIfDisposed(),ft.abs(this)},gt.prototype.clipByValue=function(t,e){return this.throwIfDisposed(),ft.clipByValue(this,t,e)},gt.prototype.relu=function(){return this.throwIfDisposed(),ft.relu(this)},gt.prototype.elu=function(){return this.throwIfDisposed(),ft.elu(this)},gt.prototype.selu=function(){return this.throwIfDisposed(),ft.selu(this)},gt.prototype.leakyRelu=function(t){return void 0===t&&(t=.2),this.throwIfDisposed(),ft.leakyRelu(this,t)},gt.prototype.prelu=function(t){return this.throwIfDisposed(),ft.prelu(this,t)},gt.prototype.sigmoid=function(){return this.throwIfDisposed(),ft.sigmoid(this)},gt.prototype.logSigmoid=function(){return this.throwIfDisposed(),ft.logSigmoid(this)},gt.prototype.softplus=function(){return this.throwIfDisposed(),ft.softplus(this)},gt.prototype.zerosLike=function(){return this.throwIfDisposed(),ft.zerosLike(this)},gt.prototype.onesLike=function(){return this.throwIfDisposed(),ft.onesLike(this)},gt.prototype.sin=function(){return this.throwIfDisposed(),ft.sin(this)},gt.prototype.cos=function(){return this.throwIfDisposed(),ft.cos(this)},gt.prototype.tan=function(){return this.throwIfDisposed(),ft.tan(this)},gt.prototype.asin=function(){return this.throwIfDisposed(),ft.asin(this)},gt.prototype.acos=function(){return this.throwIfDisposed(),ft.acos(this)},gt.prototype.atan=function(){return this.throwIfDisposed(),ft.atan(this)},gt.prototype.sinh=function(){return this.throwIfDisposed(),ft.sinh(this)},gt.prototype.cosh=function(){return this.throwIfDisposed(),ft.cosh(this)},gt.prototype.tanh=function(){return this.throwIfDisposed(),ft.tanh(this)},gt.prototype.asinh=function(){return this.throwIfDisposed(),ft.asinh(this)},gt.prototype.acosh=function(){return this.throwIfDisposed(),ft.acosh(this)},gt.prototype.atanh=function(){return this.throwIfDisposed(),ft.atanh(this)},gt.prototype.erf=function(){return this.throwIfDisposed(),ft.erf(this)},gt.prototype.round=function(){return this.throwIfDisposed(),ft.round(this)},gt.prototype.step=function(t){return void 0===t&&(t=0),this.throwIfDisposed(),ft.step(this,t)},gt.prototype.softmax=function(t){return void 0===t&&(t=-1),this.throwIfDisposed(),ft.softmax(this,t)},gt.prototype.logSoftmax=function(t){return void 0===t&&(t=-1),this.throwIfDisposed(),ft.logSoftmax(this,t)},gt.prototype.resizeBilinear=function(t,e){return void 0===e&&(e=!1),this.throwIfDisposed(),ft.image.resizeBilinear(this,t,e)},gt.prototype.resizeNearestNeighbor=function(t,e){return void 0===e&&(e=!1),this.throwIfDisposed(),ft.image.resizeNearestNeighbor(this,t,e)},gt.prototype.conv1d=function(t,e,n,r,i,o){return void 0===r&&(r="NWC"),void 0===i&&(i=1),this.throwIfDisposed(),ft.conv1d(this,t,e,n,r,i,o)},gt.prototype.conv2d=function(t,e,n,r,i,o){return void 0===r&&(r="NHWC"),void 0===i&&(i=[1,1]),this.throwIfDisposed(),ft.conv2d(this,t,e,n,r,i,o)},gt.prototype.conv2dTranspose=function(t,e,n,r,i){return this.throwIfDisposed(),ft.conv2dTranspose(this,t,e,n,r,i)},gt.prototype.depthwiseConv2D=function(t,e,n,r,i,o){return void 0===r&&(r="NHWC"),void 0===i&&(i=[1,1]),this.throwIfDisposed(),ft.depthwiseConv2d(this,t,e,n,r,i,o)},gt.prototype.separableConv2d=function(t,e,n,r,i,o){return void 0===i&&(i=[1,1]),void 0===o&&(o="NHWC"),this.throwIfDisposed(),ft.separableConv2d(this,t,e,n,r,i,o)},gt.prototype.avgPool=function(t,e,n,r){return this.throwIfDisposed(),ft.avgPool(this,t,e,n,r)},gt.prototype.maxPool=function(t,e,n,r){return this.throwIfDisposed(),ft.maxPool(this,t,e,n,r)},gt.prototype.localResponseNormalization=function(t,e,n,r){return void 0===t&&(t=5),void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=.5),ft.localResponseNormalization(this,t,e,n,r)},gt.prototype.pool=function(t,e,n,r,i){return this.throwIfDisposed(),ft.pool(this,t,e,n,r,i)},gt.prototype.variable=function(t,e,n){return void 0===t&&(t=!0),this.throwIfDisposed(),vt.variable(this,t,e,n)},gt.prototype.unsortedSegmentSum=function(t,e){return this.throwIfDisposed(),ft.unsortedSegmentSum(this,t,e)},gt.prototype.batchToSpaceND=function(t,e){return this.throwIfDisposed(),ft.batchToSpaceND(this,t,e)},gt.prototype.spaceToBatchND=function(t,e){return this.throwIfDisposed(),ft.spaceToBatchND(this,t,e)},gt.prototype.topk=function(t,e){return void 0===t&&(t=1),void 0===e&&(e=!0),this.throwIfDisposed(),ft.topk(this,t,e)},gt.prototype.stridedSlice=function(t,e,n,r,i,o,a,s){return void 0===r&&(r=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),this.throwIfDisposed(),ft.stridedSlice(this,t,e,n,r,i,o,a,s)},gt.prototype.depthToSpace=function(t,e){return this.throwIfDisposed(),ft.depthToSpace(this,t,e)},gt.prototype.fft=function(){return this.throwIfDisposed(),ft.spectral.fft(this)},gt.prototype.ifft=function(){return this.throwIfDisposed(),ft.spectral.ifft(this)},gt.prototype.rfft=function(){return this.throwIfDisposed(),ft.spectral.rfft(this)},gt.prototype.irfft=function(){return this.throwIfDisposed(),ft.spectral.irfft(this)},gt);function gt(t,e,n,r){this.isDisposedInternal=!1,this.shape=t.slice(),this.dtype=e||"float32",this.size=L(t),this.strides=H(t),this.dataId=null!=r?r:{},this.id=lt().nextTensorId(),this.rankType=this.rank<5?this.rank.toString():"higher",lt().registerTensor(this),null!=n&&lt().write(this.dataId,n)}Object.defineProperty(mt,Symbol.hasInstance,{value:function(t){return!!t&&null!=t.dataId&&null!=t.shape&&null!=t.dtype}});var yt,vt=(i(bt,yt=mt),bt.variable=function(t,e,n,r){return void 0===e&&(e=!0),null!=r&&r!==t.dtype&&(t=t.asType(r)),new bt(t,e,n)},bt.prototype.assign=function(t){if(t.dtype!==this.dtype)throw new Error("dtype of the new value ("+t.dtype+") and previous value ("+this.dtype+") must match");if(!x(t.shape,this.shape))throw new Error("shape of the new value ("+t.shape+") and previous value ("+this.shape+") must match");lt().disposeTensor(this),this.dataId=t.dataId,lt().registerTensor(this)},bt);function bt(t,e,n){void 0===e&&(e=!0);var r=yt.call(this,t.shape,t.dtype,null,t.dataId)||this;r.trainable=e,r.name=n,null==r.name&&(r.name=lt().nextVariableId().toString());try{lt().registerVariable(r)}catch(t){throw lt().disposeTensor(r),t}return r}Object.defineProperty(vt,Symbol.hasInstance,{value:function(t){return t instanceof mt&&null!=t.assign&&t.assign instanceof Function}});var wt,_t,xt,Et,St,Nt,It,Ot,kt,At,Ct=vt.variable;(At=wt||(wt={})).R0="R0",At.R1="R1",At.R2="R2",At.R3="R3",At.R4="R4",At.R5="R5",At.R6="R6",(kt=_t||(_t={})).float32="float32",kt.int32="int32",kt.bool="int32",kt.complex64="complex64",(Ot=xt||(xt={})).float32="float32",Ot.int32="int32",Ot.bool="bool",Ot.complex64="complex64",(It=Et||(Et={})).float32="float32",It.int32="float32",It.bool="float32",It.complex64="complex64",(Nt=St||(St={})).float32="complex64",Nt.int32="complex64",Nt.bool="complex64",Nt.complex64="complex64";var Pt={float32:Et,int32:_t,bool:xt,complex64:St};function Tt(t,e){if("string"!==t&&"string"!==e)return Pt[t][e];if("string"===t&&"string"===e)return"string";throw new Error("Can not upcast "+t+" with "+e)}function Mt(t){return Tt(t,"int32")}function Rt(t,e){if(t.dtype===e.dtype)return[t,e];var n=Tt(t.dtype,e.dtype);return[t.cast(n),e.cast(n)]}function Dt(t){var e=[];return function t(e,n,r){if(null!=e)if(e instanceof mt)n.push(e);else if(s=e,Array.isArray(s)||"object"==typeof s){var i=e;for(var o in i){var a=i[o];r.has(a)||(r.add(a),t(a,n,r))}}var s}(t,e,new Set),e}var jt,Bt,Lt=(Ft.prototype.moveData=function(t){this.write(t,this.readSync(t))},Ft.prototype.tidy=function(t,e,n){var r=this;void 0===n&&(n=!1);var i,o=null;if(null==e){if("function"!=typeof t)throw new Error("Please provide a function to tidy()");e=t}else{if("string"!=typeof t&&!(t instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if("function"!=typeof e)throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");o=t}return this.scopedRun(function(){return r.startScope(o,n)},function(){return r.endScope(i,n)},function(){return(i=e())instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),i})},Ft.prototype.scopedRun=function(t,e,n){t();try{var r=n();return e(),r}catch(t){throw e(),t}},Ft.prototype.nextTensorId=function(){return Ft.nextTensorId++},Ft.prototype.nextVariableId=function(){return Ft.nextVariableId++},Ft.prototype.runKernel=function(t,e,n){function r(t){return a.push(t),t}var i,o=this,a=[],s=null!=this.activeScope?this.activeScope.name:"",u=this.numBytes,c=this.numTensors;if(this.scopedRun(function(){return o.customGradientDepth++},function(){return o.customGradientDepth--},function(){i=o.debugMode()?o.profiler.profileKernel(s,function(){return t(o.backend,r)}):t(o.backend,r)}),this.shouldRecord()){var l={id:this.nextTapeNodeId++,name:s,inputs:e,outputs:Array.isArray(i)?i:[i]};null!=n&&(l.gradient=function(t){return n(t,a)}),this.activeTape.push(l)}return this.profiling&&this.activeProfile.kernels.push({name:s,bytesAdded:this.numBytes-u,totalBytesSnapshot:this.numBytes,tensorsAdded:this.numTensors-c,totalTensorsSnapshot:this.numTensors,inputShapes:Object.keys(e).map(function(t){return e[t].shape}),outputShape:Array.isArray(i)?i.map(function(t){return t.shape}):i.shape}),i},Ft.prototype.registerTensor=function(t){var e=this.tensorInfo.has(t.dataId)?this.tensorInfo.get(t.dataId).refCount:0;if(this.numTensors++,"string"===t.dtype&&this.numStringTensors++,0===e){this.numDataBuffers++;var n=0;"complex64"!==t.dtype&&"string"!==t.dtype&&(n=L(t.shape)*j(t.dtype)),this.tensorInfo.set(t.dataId,{backend:this.backend,dtype:t.dtype,shape:t.shape,bytes:n,refCount:0}),this.numBytes+=n,this.backend.register(t.dataId,t.shape,t.dtype)}this.tensorInfo.get(t.dataId).refCount++,t instanceof vt||this.track(t)},Ft.prototype.registerVariable=function(t){if(null!=this.registeredVariables[t.name])throw new Error("Variable with name "+t.name+" was already registered");this.registeredVariables[t.name]=t},Ft.prototype.disposeTensor=function(t){if(this.tensorInfo.has(t.dataId)){this.keepTensors.has(t.id)&&this.keepTensors.delete(t.id),this.numTensors--,"string"===t.dtype&&this.numStringTensors--;var e=this.tensorInfo.get(t.dataId);e.refCount<=1?("complex64"!==t.dtype&&(this.numBytes-=e.bytes),this.numDataBuffers--,e.backend.disposeData(t.dataId),this.tensorInfo.delete(t.dataId)):this.tensorInfo.get(t.dataId).refCount--}},Ft.prototype.disposeVariables=function(){for(var t in this.registeredVariables){var e=this.registeredVariables[t];this.disposeTensor(e),delete this.registeredVariables[t]}},Ft.prototype.memory=function(){var t=this.backend.memory();return t.numTensors=this.numTensors,t.numDataBuffers=this.numDataBuffers,t.numBytes=this.numBytes,0<this.numStringTensors&&(t.unreliable=!0,null==t.reasons&&(t.reasons=[]),t.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),t},Ft.prototype.profile=function(r){return m(this,void 0,void 0,function(){var e,n;return I(this,function(t){return this.profiling=!0,e=this.numBytes,n=this.numTensors,this.activeProfile.kernels=[],this.activeProfile.result=r(),this.profiling=!1,this.activeProfile.peakBytes=Math.max.apply(Math,this.activeProfile.kernels.map(function(t){return t.totalBytesSnapshot})),this.activeProfile.newBytes=this.numBytes-e,this.activeProfile.newTensors=this.numTensors-n,[2,this.activeProfile]})})},Ft.prototype.shouldRecord=function(){return null!=this.activeTape&&0===this.customGradientDepth},Ft.prototype.addTapeNode=function(t,e,r){var n={};t.forEach(function(t,e){n[e]=t});var i={id:this.nextTapeNodeId++,name:this.activeScope.name,inputs:n,outputs:[e],gradient:function(t){var n={};return r(t).forEach(function(t,e){n[e]=function(){return t}}),n}};this.activeTape.push(i)},Ft.prototype.keep=function(t){if(1===this.scopeStack.length&&this.safeMode)throw new Error("Safe mode is ON. Enclose all tensor operations inside tf.tidy(): tf.tidy(() => {...}) to avoid memory leaks.");return this.keepTensors.add(t.id),t},Ft.prototype.startScope=function(t,e){void 0===e&&(e=!1),e&&0===this.gradientScopeCount&&(this.activeTape=[]),e&&this.gradientScopeCount++;var n={track:[],name:"unnamed scope"};t&&(n.name=t),this.scopeStack.push(n),this.activeScope=n},Ft.prototype.endScope=function(t,e){var n=this;void 0===e&&(e=!1),e&&(this.gradientScopeCount--,0===this.gradientScopeCount&&(this.activeTape=null));var r=new Set(this.keepTensors),i=Dt(t);i.forEach(function(t){return r.add(t.id)});for(var o=0;o<this.activeScope.track.length;o++){var a=this.activeScope.track[o];r.has(a.id)||(null!=this.activeTape?i.push(a):a.dispose())}var s=this.scopeStack.pop();this.activeScope=0===this.scopeStack.length?null:this.scopeStack[this.scopeStack.length-1],i.forEach(function(t){!n.keepTensors.has(t.id)&&function(t,e){for(var n=0;n<e.length;n++)if(e[n].id===t.id)return!0;return!1}(t,s.track)&&n.track(t)})},Ft.prototype.gradients=function(r,i,o,a){var s=this;if(void 0===a&&(a=!1),C(0<i.length,"gradients() received an empty list of xs."),null!=o&&"float32"!==o.dtype)throw new Error("dy must have 'float32' dtype, but has '"+o.dtype+"'");return this.tidy("gradients",function(){var t=r();C(t instanceof mt,"The result y returned by f() must be a tensor.");var e=function(t,e,n){for(var r={},i={},o=0;o<e.length;o++)r[e[o].id]=!0;for(o=0;o<t.length;o++){var a=(d=t[o]).inputs;for(var s in a){for(var u=a[s],c=!1,l=0;l<e.length;l++)if(r[u.id]){d.outputs.forEach(function(t){return r[t.id]=!0}),c=!0,i[d.id]=!0;break}if(c)break}}var f={};f[n.id]=!0;var h={};for(o=t.length-1;0<=o;o--)for(a=(d=t[o]).inputs,l=0;l<d.outputs.length;l++)if(f[d.outputs[l].id]){for(var s in a)f[a[s].id]=!0,h[d.id]=!0;break}var p=[];for(o=0;o<t.length;o++){var d;if(i[(d=t[o]).id]&&h[d.id]){var m={};for(var s in d.inputs){var g=d.inputs[s];r[g.id]&&(m[s]=g)}var y=Object.assign({},d);y.inputs=m,y.outputs=d.outputs,p.push(y)}}return p}(s.activeTape,i,t);if(!a&&0===e.length&&0<i.length)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 n={};return n[t.id]=null==o?function(t){var e=K(L(t),"float32");return mt.make(t,{values:e})}(t.shape):o,function(u,c){for(var t=function(t){var e=c[t],r=[];if(e.outputs.forEach(function(t){var e=u[t.id];if(null!=e)r.push(e);else{var n=mt.make(t.shape,{values:X(t.size,t.dtype)},t.dtype);r.push(n)}}),null==e.gradient)throw new Error("Cannot compute gradient: gradient function not found for "+e.name+".");var n=e.gradient(1===e.outputs.length?r[0]:r);for(var i in e.inputs){if(!(i in n))throw new Error("Cannot backprop through input "+i+". Available gradients found: "+Object.keys(n)+".");var o=n[i]();if("float32"!==o.dtype)throw new Error("Error in gradient for op "+e.name+". The gradient of input "+i+" must have 'float32' dtype, but has '"+o.dtype+"'");var a=e.inputs[i];if(!x(o.shape,a.shape))throw new Error("Error in gradient for op "+e.name+". The gradient of input '"+i+"' has shape '"+o.shape+"', which does not match the shape of the input '"+a.shape+"'");if(null==u[a.id])u[a.id]=o;else{var s=u[a.id];u[a.id]=s.add(o),s.dispose()}}},e=c.length-1;0<=e;e--)t(e)}(n,e),{value:t,grads:i.map(function(t){return n[t.id]})}},!0)},Ft.prototype.customGrad=function(o){var n=this;return C(W(o),"The f passed in customGrad(f) must be a function."),function(){for(var r,t,i=[],e=0;e<arguments.length;e++)i[e]=arguments[e];return C(i.every(function(t){return t instanceof mt}),"The args passed in customGrad(f)(x1, x2,...) must all be tensors"),n.scopedRun(function(){return n.customGradientDepth++},function(){return n.customGradientDepth--},function(){t=n.tidy(o.name,function(){var t=o.apply(void 0,i),e=t.value,n=t.gradFunc;return C(e instanceof mt,"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),C(W(n),"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),r=n,e},!0)}),n.shouldRecord()&&n.addTapeNode(i,t,function(t){var e=r(t),n=Array.isArray(e)?e:[e];return C(n.length===i.length,"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."),C(n.every(function(t){return t instanceof mt}),"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors."),n}),t}},Ft.prototype.write=function(t,e){var n=this.tensorInfo.get(t);if("string"===n.dtype){var r=B(e);this.numBytes+=r-n.bytes,n.bytes=r}this.backend!==n.backend&&(n.backend.disposeData(t),n.backend=this.backend,this.backend.register(t,n.shape,n.dtype)),this.backend.write(t,e)},Ft.prototype.readSync=function(t){return this.tensorInfo.get(t).backend.readSync(t)},Ft.prototype.read=function(t){return this.tensorInfo.get(t).backend.read(t)},Ft.prototype.fromPixels=function(t,e){return this.backend.fromPixels(t,e)},Ft.prototype.time=function(r){return m(this,void 0,void 0,function(){var e,n;return I(this,function(t){switch(t.label){case 0:return e=Y(),[4,this.backend.time(r)];case 1:return(n=t.sent()).wallMs=Y()-e,[2,n]}})})},Ft.prototype.track=function(t){if(1===this.scopeStack.length&&this.safeMode)throw new Error("Safe mode is ON. Enclose all tensor operations inside tf.tidy(): tf.tidy(() => {op();...}); to avoid memory leaks.");return null!=this.activeScope&&this.activeScope.track.push(t),t},Ft.nextTensorId=0,Ft.nextVariableId=0,Ft);function Ft(t,e,n){this.backend=t,this.safeMode=e,this.debugMode=n,this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.profiling=!1,this.gradientScopeCount=0,this.customGradientDepth=0,this.scopeStack=[],this.keepTensors=new Set,this.tensorInfo=new WeakMap,this.profiler=new Q(t),this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null}}(Bt=jt||(jt={}))[Bt.NUMBER=0]="NUMBER",Bt[Bt.BOOLEAN=1]="BOOLEAN",Bt[Bt.STRING=2]="STRING";var zt,Ut,Vt=[{name:"DEBUG",type:jt.BOOLEAN},{name:"IS_BROWSER",type:jt.BOOLEAN},{name:"WEBGL_LAZILY_UNPACK",type:jt.BOOLEAN},{name:"WEBGL_CPU_FORWARD",type:jt.BOOLEAN},{name:"WEBGL_PACK",type:jt.BOOLEAN},{name:"WEBGL_PACK_BATCHNORMALIZATION",type:jt.BOOLEAN},{name:"WEBGL_PACK_CLIP",type:jt.BOOLEAN},{name:"WEBGL_PACK_DEPTHWISECONV",type:jt.BOOLEAN},{name:"WEBGL_PACK_BINARY_OPERATIONS",type:jt.BOOLEAN},{name:"WEBGL_PACK_ARRAY_OPERATIONS",type:jt.BOOLEAN},{name:"WEBGL_CONV_IM2COL",type:jt.BOOLEAN},{name:"WEBGL_MAX_TEXTURE_SIZE",type:jt.NUMBER},{name:"WEBGL_NUM_MB_BEFORE_PAGING",type:jt.NUMBER},{name:"WEBGL_MAX_TEXTURES_IN_SHADER",type:jt.NUMBER},{name:"WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",type:jt.NUMBER},{name:"WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",type:jt.BOOLEAN},{name:"WEBGL_VERSION",type:jt.NUMBER},{name:"WEBGL_RENDER_FLOAT32_ENABLED",type:jt.BOOLEAN},{name:"WEBGL_DOWNLOAD_FLOAT_ENABLED",type:jt.BOOLEAN},{name:"WEBGL_FENCE_API_ENABLED",type:jt.BOOLEAN},{name:"WEBGL_SIZE_UPLOAD_UNIFORM",type:jt.NUMBER},{name:"BACKEND",type:jt.STRING},{name:"EPSILON",type:jt.NUMBER},{name:"PROD",type:jt.BOOLEAN},{name:"TENSORLIKE_CHECK_SHAPE_CONSISTENCY",type:jt.BOOLEAN},{name:"DEPRECATION_WARNINGS_ENABLED",type:jt.BOOLEAN}];function Wt(t){try{if(null!=c(t))return!0}catch(t){return!1}return!1}var qt="tfjsflags";function Ht(){var e={};if("undefined"==typeof window||void 0===window.location||void 0===window.location.search)return e;var t=function(t){var r={};return t.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return function(t,e,n){t[decodeURIComponent(e)]=decodeURIComponent(n||"")}(r,e[0],e[1]),e.join("=")}),r}(window.location.search);if(qt in t){var i={};t[qt].split(",").forEach(function(t){var e=t.split(":"),n=e[0],r=e[1];i[n]=r}),Vt.forEach(function(t){t.name in i&&(console.log("Setting feature override from URL "+t.name+": "+i[t.name]),t.type===jt.NUMBER?e[t.name]=+i[t.name]:t.type===jt.BOOLEAN?e[t.name]="true"===i[t.name]:t.type===jt.STRING?e[t.name]=i[t.name]:console.warn("Unknown URL param: "+t.name+"."))})}return e}function $t(t,e){return null!=t.getExtension(e)}function Gt(t,e){var n=t.createFramebuffer(),r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);var i=2===e?t.RGBA32F:t.RGBA;t.texImage2D(t.TEXTURE_2D,0,i,1,1,0,t.RGBA,t.FLOAT,null),t.bindFramebuffer(t.FRAMEBUFFER,n),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0);var o=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;return t.bindTexture(t.TEXTURE_2D,null),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteTexture(r),t.deleteFramebuffer(n),o}var Kt=(Xt.setBackend=function(t,e){if(void 0===e&&(e=!1),!(t in te.registry))throw new Error("Backend name '"+t+"' not found in registry");te.engine.backend=te.findBackend(t),te.backendName=t},Xt.getBackend=function(){return te.initEngine(),te.backendName},Xt.disposeVariables=function(){te.engine.disposeVariables()},Xt.memory=function(){return te.engine.memory()},Xt.profile=function(t){return te.engine.profile(t)},Xt.tidy=function(t,e){return te.engine.tidy(t,e)},Xt.dispose=function(t){Dt(t).forEach(function(t){return t.dispose()})},Xt.keep=function(t){return te.engine.keep(t)},Xt.time=function(t){return te.engine.time(t)},Xt.prototype.get=function(t){return t in this.features||(this.features[t]=this.evaluateFeature(t)),this.features[t]},Xt.prototype.getFeatures=function(){return this.features},Xt.prototype.set=function(t,e){this.features[t]=e},Xt.prototype.getBestBackendName=function(){var e=this;if(0===Object.keys(this.registry).length)throw new Error("No backend found in registry.");return Object.keys(this.registry).map(function(t){return{name:t,entry:e.registry[t]}}).sort(function(t,e){return e.entry.priority-t.entry.priority})[0].name},Xt.prototype.evaluateFeature=function(t){if("DEBUG"===t)return!1;if("IS_BROWSER"===t)return"undefined"!=typeof window;if("IS_NODE"===t)return void 0!==n&&void 0!==n.versions&&void 0!==n.versions.node;if("IS_CHROME"===t)return"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor);if("WEBGL_CPU_FORWARD"===t)return!0;if("WEBGL_PACK"===t)return!1;if("WEBGL_PACK_BATCHNORMALIZATION"===t)return this.get("WEBGL_PACK");if("WEBGL_PACK_CLIP"===t)return this.get("WEBGL_PACK");if("WEBGL_PACK_DEPTHWISECONV"===t)return this.get("WEBGL_PACK");if("WEBGL_PACK_BINARY_OPERATIONS"===t)return this.get("WEBGL_PACK");if("WEBGL_PACK_ARRAY_OPERATIONS"===t)return this.get("WEBGL_PACK");if("WEBGL_LAZILY_UNPACK"===t)return this.get("WEBGL_PACK");if("WEBGL_CONV_IM2COL"===t)return this.get("WEBGL_PACK");if("WEBGL_NUM_MB_BEFORE_PAGING"===t)return this.get("PROD")||!this.get("IS_BROWSER")?Number.POSITIVE_INFINITY:window.screen.height*window.screen.width*window.devicePixelRatio*600/1024;if("WEBGL_MAX_TEXTURE_SIZE"===t)return function(t){if(null==zt){var e=c(t);zt=e.getParameter(e.MAX_TEXTURE_SIZE)}return zt}(this.get("WEBGL_VERSION"));if("WEBGL_MAX_TEXTURES_IN_SHADER"===t)return function(t){if(null==Ut){var e=c(t);Ut=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,Ut)}(this.get("WEBGL_VERSION"));if("IS_TEST"===t)return!1;if("BACKEND"===t)return this.getBestBackendName();if("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"===t){var e=this.get("WEBGL_VERSION");return 0===e?0:function(t){if(0===t)return 0;var e=c(t);return $t(e,"EXT_disjoint_timer_query_webgl2")&&2===t?2:$t(e,"EXT_disjoint_timer_query")?1:0}(e)}if("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE"===t)return 0<this.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")&&!function(){var t=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))}();if("HAS_WEBGL"===t)return 0<this.get("WEBGL_VERSION");if("WEBGL_VERSION"===t)return Wt(2)?2:Wt(1)?1:0;if("WEBGL_RENDER_FLOAT32_ENABLED"===t)return function(t){if(0===t)return!1;var e=c(t);if(1===t){if(!$t(e,"OES_texture_float"))return!1}else if(!$t(e,"EXT_color_buffer_float"))return!1;return Gt(e,t)}(this.get("WEBGL_VERSION"));if("WEBGL_DOWNLOAD_FLOAT_ENABLED"===t)return function(t){if(0===t)return!1;var e=c(t);if(1===t){if(!$t(e,"OES_texture_float"))return!1;if(!$t(e,"WEBGL_color_buffer_float"))return!1}else if(!$t(e,"EXT_color_buffer_float"))return!1;return Gt(e,t)}(this.get("WEBGL_VERSION"));if("WEBGL_FENCE_API_ENABLED"===t)return function(t){return 2===t&&null!=c(t).fenceSync}(this.get("WEBGL_VERSION"));if("WEBGL_SIZE_UPLOAD_UNIFORM"===t)return this.get("WEBGL_RENDER_FLOAT32_ENABLED")?4:0;if("TEST_EPSILON"===t)return 32===this.backend.floatPrecision()?.001:.1;if("EPSILON"===t)return 32===this.backend.floatPrecision()?1e-7:1e-4;if("PROD"===t)return!1;if("TENSORLIKE_CHECK_SHAPE_CONSISTENCY"===t)return!this.get("PROD");if("DEPRECATION_WARNINGS_ENABLED"===t)return!0;throw new Error("Unknown feature "+t+".")},Xt.prototype.setFeatures=function(t){this.features=Object.assign({},t)},Xt.prototype.reset=function(){this.features=Ht(),null!=this.globalEngine&&(this.globalEngine=null)},Object.defineProperty(Xt.prototype,"backend",{get:function(){return this.engine.backend},enumerable:!0,configurable:!0}),Xt.prototype.findBackend=function(t){return t in this.registry?this.registry[t].backend:null},Xt.prototype.registerBackend=function(t,e,n,r){var i=this;if(void 0===n&&(n=1),t in this.registry)return console.warn(t+" backend was already registered. Reusing existing backend"),null!=r&&r(function(){return i.engine}),!1;try{var o=e();return o.setDataMover({moveData:function(t){return i.engine.moveData(t)}}),this.registry[t]={backend:o,priority:n},!0}catch(e){return console.warn("Registration of backend "+t+" failed"),console.warn(e.stack||e.message),!1}},Xt.prototype.removeBackend=function(t){if(!(t in this.registry))throw new Error(t+" backend not found in registry");this.registry[t].backend.dispose(),delete this.registry[t]},Object.defineProperty(Xt.prototype,"engine",{get:function(){return this.initEngine(),this.globalEngine},enumerable:!0,configurable:!0}),Xt.prototype.initEngine=function(){var t=this;if(null==this.globalEngine){this.backendName=this.get("BACKEND");var e=this.findBackend(this.backendName);this.globalEngine=new Lt(e,!1,function(){return t.get("DEBUG")})}},Xt);function Xt(t){this.features={},this.registry={},null!=t&&(this.features=t),this.get("DEBUG")&&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.")}function Yt(){te.set("PROD",!0)}function Zt(){te.set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")}function Jt(t){te.get("DEPRECATION_WARNINGS_ENABLED")&&console.warn(t+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}ht=Jt;var Qt,te=(null==(Qt=function(){var t;if("undefined"!=typeof window)t=window;else{if(void 0===n)throw new Error("Could not find a global object");t=n}return t}()).ENV&&(Qt.ENV=new Kt(Ht()),dt(function(){return Qt.ENV.engine})),Qt.ENV),ee=Object.freeze({EPSILON_FLOAT16:1e-4,EPSILON_FLOAT32:1e-7,Environment:Kt,enableProdMode:Yt,disableDeprecationWarnings:Zt,deprecationWarn:Jt,ENV:te});function ne(o){return C(W(o),"The f passed in grad(f) must be a function"),function(r,i){return C(r instanceof mt,"The x passed in grad(f)(x) must be a tensor"),C(null==i||i instanceof mt,"The dy passed in grad(f)(x, dy) must be a tensor"),te.engine.tidy(function(){var t=te.engine.gradients(function(){return o(r)},[r],i),e=t.value,n=t.grads;return null!=i&&d(e.shape,i.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),ue(n),n[0]})}}function re(o){return C(W(o),"The f passed in grads(f) must be a function"),function(r,i){return C(Array.isArray(r)&&r.every(function(t){return t instanceof mt}),"The args passed in grads(f)(args) must be an array of tensors"),C(null==i||i instanceof mt,"The dy passed in grads(f)(args, dy) must be a tensor"),te.engine.tidy(function(){var t=te.engine.gradients(function(){return o.apply(void 0,r)},r,i),e=t.value,n=t.grads;return null!=i&&d(e.shape,i.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),ue(n),n})}}function ie(o){return C(W(o),"The f passed in valueAndGrad(f) must be a function"),function(t,e){C(t instanceof mt,"The x passed in valueAndGrad(f)(x) must be a tensor"),C(null==e||e instanceof mt,"The dy passed in valueAndGrad(f)(x, dy) must be a tensor");var n=te.engine.gradients(function(){return o(t)},[t],e),r=n.grads,i=n.value;return ue(r),{grad:r[0],value:i}}}function oe(r){return C(W(r),"The f passed in valueAndGrads(f) must be a function"),function(t,e){C(Array.isArray(t)&&t.every(function(t){return t instanceof mt}),"The args passed in valueAndGrads(f)(args) must be array of tensors"),C(null==e||e instanceof mt,"The dy passed in valueAndGrads(f)(args, dy) must be a tensor");var n=te.engine.gradients(function(){return r.apply(void 0,t)},t,e);return null!=e&&d(n.value.shape,e.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),ue(n.grads),n}}function ae(t,e){if(C(W(t),"The f passed in variableGrads(f) must be a function"),C(null==e||Array.isArray(e)&&e.every(function(t){return t instanceof vt}),"The varList passed in variableGrads(f, varList) must be an array of variables"),null==e)for(var n in e=[],te.engine.registeredVariables)e.push(te.engine.registeredVariables[n]);var r=e.length;C(0<(e=e.filter(function(t){return t.trainable})).length,"variableGrads() expects at least one of the input variables to be trainable, but none of the "+r+" variables is trainable.");var i=te.engine.gradients(t,e,null,!0),o=i.value,a=i.grads;C(a.some(function(t){return null!=t}),"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()."),C(0===o.rank,"The f passed in variableGrads(f) must return a scalar, but it returned a rank-"+o.rank+" tensor");var s={};return e.forEach(function(t,e){null!=a[e]&&(s[t.name]=a[e])}),{value:o,grads:s}}function se(t){return te.engine.customGrad(t)}function ue(t){if(0<t.filter(function(t){return null==t}).length)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that\n    the f you passed encloses all operations that lead from x to y.")}var ce=Kt.tidy,le=Kt.keep,fe=Kt.dispose,he=Kt.time,pe=Kt.profile;function de(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];te.get("IS_TEST")||console.warn.apply(console,t)}function me(t,e,n,r){void 0===r&&(r=!0);var i=[];if(r)(i=i.concat(e.slice(0))).push(t[0]/n),i=i.concat(t.slice(1));else{i=i.concat(t[0]);for(var o=e.length,a=0;a<o;++a)i=i.concat([t[a+1]/e[a],e[a]]);i=i.concat(t.slice(o+1))}return i}function ge(t,e,n){void 0===n&&(n=!0);var r=[];if(n){r.push(e);for(var i=e+1;i<t;++i)i<=2*e?(r.push(i),r.push(i-(e+1))):r.push(i)}else{var o=[],a=[];for(i=1;i<t;++i)2*e+1<=i||i%2==1?a.push(i):o.push(i);r.push.apply(r,o),r.push(0),r.push.apply(r,a)}return r}function ye(t,e,n,r){void 0===r&&(r=!0);var i=[];r?i.push(t[0]/n):i.push(t[0]*n);for(var o=1;o<t.length;++o)o<=e.length?r?i.push(e[o-1]*t[o]):i.push(t[o]/e[o-1]):i.push(t[o]);return i}function ve(t,e){for(var n=[0],r=0;r<e;++r)n.push(t[r][0]);return n}function be(t,e,n){for(var r=t.slice(0,1),i=0;i<n;++i)r.push(t[i+1]-e[i][0]-e[i][1]);return r}function we(t,e){for(var n=0;n<t.length;++n)if(t[t.length-n-1]!==e-1-n)return!1;return!0}function _e(e,t){for(var n=[],r=e.length,i=0;i<r;i++)-1===t.indexOf(i)&&n.push(e[i]);return[n,t.map(function(t){return e[t]})]}function xe(t,e){return function(t,e,n){for(var r=t.length+e.length,i=[],o=0,a=0,s=0;s<r;s++)-1===n.indexOf(s)?i.push(t[o++]):i.push(e[a++]);return i}(t,e.map(function(t){return 1}),e)}function Ee(t,e,n){C(we(e,n),t+" supports only inner-most axes for now. Got axes "+e+" and rank-"+n+" input.")}function Se(t,e){if(we(t,e))return null;for(var n=[],r=0;r<e;++r)-1===t.indexOf(r)&&n.push(r);return t.forEach(function(t){return n.push(t)}),n}function Ne(t){return t.map(function(t,e){return[e,t]}).sort(function(t,e){return t[1]-e[1]}).map(function(t){return t[0]})}function Ie(t,e){for(var n=[],r=e-t;r<e;++r)n.push(r);return n}function Oe(t,e){for(var n=t[0].slice(),r=1;r<t.length;r++)n[e]+=t[r][e];return n}function ke(t,e){if(t.rank<1)throw new Error("tf.gatherND() expects the input to be rank 1 or higher, but the rank was "+t.rank+".");if(e.rank<1)throw new Error("tf.gatherND() expects the indices to be rank 1 or higher, but the rank was "+e.rank+".");if("int32"!==e.dtype)throw new Error("tf.gatherND() expects the indices to be int32 type, but the dtype was "+e.dtype+".");if(e.shape[e.rank-1]>t.rank)throw new Error("index innermost dimension length must be <= tensor rank; saw: "+e.shape[e.rank-1]+" vs. "+t.rank);if(0===t.size)throw new Error("Requested more than 0 entries, but input is empty. Input shape: "+t.shape+".");for(var n=e.shape,r=n[n.length-1],i=1,o=0;o<n.length-1;++o)i*=n[o];var a=t.shape,s=n.slice();s.pop();var u=1;for(o=r;o<t.rank;++o)u*=a[o],s.push(a[o]);var c=H(t.shape).map(function(t){return t/u}).concat([1]).slice(0,r);return[s,i,u,c]}function Ae(t){return t<=30?t:q(t,Math.floor(Math.sqrt(t)))}function Ce(t,e,n){if(e.rank<1)throw new Error("tf.scatterND() expects the indices to be rank 1 or higher, but the rank was "+e.rank+".");if(t.rank<1)throw new Error("tf.scatterND() expects the updates to be rank 1 or higher, but the rank was "+t.rank+".");if("int32"!==e.dtype)throw new Error("The dtype of 'indices' should be int32, but got dtype: "+e.dtype);if(n.length<1)throw new Error("Output rank must be greater or equal to 1, but got shape: "+n);if(0===n.length){if(0===e.size)throw new Error("Indices specified for empty output. indices shape: "+e.shape);if(0===t.size)throw new Error("Updates specified for empty output. updates shape: "+t.shape)}!function(t,e,n){var r=1<e.rank?e.shape[e.rank-1]:1,i=1<e.rank?e.rank-1:1,o="Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: "+n.shape+", indices.shape: "+e.shape+", shape: "+t+", sliceDim: "+r+", and batchDim: "+i+".";if(n.rank<i)throw new Error(o+" update.rank < "+i+". ");if(t.length<r+(n.rank-i))throw new Error(o+" Output shape length < "+(r+(n.rank-i)));if(n.rank!==i+t.length-r)throw new Error(o+" update.rank != "+(i+t.length-r));for(var a=0;a<i;++a)if(n.shape[a]!==e.shape[a])throw new Error(o+" updates.shape["+a+"] ("+n.shape[a]+") != indices.shape["+a+"] ("+e.shape[a]+").");for(a=0;a<n.rank-i;++a)if(n.shape[a+i]!==t[a+r])throw new Error(o+" updates.shape["+(a+i)+"] ("+n.shape[a+i]+") != shape["+(a+i)+"] ("+t[a+i]+")")}(n,e,t)}function Pe(t,e,n){for(var r=1<e.rank?e.shape[e.rank-1]:1,i=n.length,o=1,a=r;a<i;++a)o*=n[a];var s=r<1?1:r;return{sliceRank:r,numUpdates:e.size/s,sliceSize:o,strides:H(n.slice(0,r)).concat([1]),outputSize:L(n)}}function Te(t,e,n,i,r,o,a,s,u){if(void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=0),0!==a)throw new Error("ellipsis mask is not yet supported");if(0!==s)throw new Error("new axis mask is not yet supported");for(var c=[],l=[],f=[],h=0;h<t.length;h++)c[h]=Me(r,e,i,t,h),l[h]=Re(o,n,i,t,h),u&1<<h&&(l[h]=c[h]+1,f.push(h));var p=new Array(t.length).fill(0);return p=p.map(function(t,e){for(var n=0,r=c[e];!(0<i[e]?r>=l[e]:r<=l[e]);r+=i[e])n+=1;return n}),[c,p,f]}function Me(t,e,n,r,i){var o=e[i];t&1<<i&&(o=0<n[i]?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);var a=r[i];return o<0&&(o+=a),f(0,o,a-1)}function Re(t,e,n,r,i){var o=e[i];t&1<<i&&(o=0<n[i]?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);var a=r[i];return o<0&&(o+=a),0<n[i]?f(0,o,a):f(-1,o,a-1)}function De(t,e,n){for(var r=n.length,i=0;i<n.length;i++)if(1<n[i]){r=i;break}for(i=r+1;i<n.length;i++)if(0<e[i]||n[i]!==t[i])return!1;return!0}function je(t,e){for(var n=0<t.length?t[t.length-1]:1,r=0;r<t.length-1;r++)n+=t[r]*e[r];return n}function Be(t){var e=t;if(D(t))return[t.length];if(!Array.isArray(t))return[];for(var n=[];Array.isArray(e)||D(e);)n.push(e.length),e=e[0];return Array.isArray(t)&&te.get("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&function t(e,n,r){if(r=r||[],Array.isArray(e)||D(e)){C(0<n.length,function(){return"Element arr["+r.join("][")+"] should be a primitive, but is an array of "+e.length+" elements"}),C(e.length===n[0],function(){return"Element arr["+r.join("][")+"] should have "+n[0]+" elements, but has "+e.length+" elements"});for(var i=n.slice(1),o=0;o<e.length;++o)t(e[o],i,r.concat(o))}else C(0===n.length,function(){return"Element arr["+r.join("][")+"] is a primitive, but should be an array/TypedArray of "+n[0]+" elements"})}(t,n,[]),n}function Le(t,e,n,r){if(null!=t&&("numeric"!==t&&t!==e||"numeric"===t&&"string"===e))throw new Error("Argument '"+n+"' passed to '"+r+"' must be "+t+" tensor, but got "+e+" tensor")}function Fe(t,e,n,r){if(void 0===r&&(r="numeric"),t instanceof mt)return Le(r,t.dtype,e,n),t;var i=V(t);if("string"!==i&&0<=["bool","int32","float32"].indexOf(r)&&(i=r),Le(r,i,e,n),!D(t)&&!Array.isArray(t)&&"number"!=typeof t&&"boolean"!=typeof t&&"string"!=typeof t)throw new Error("Argument '"+e+"' passed to '"+n+"' must be a Tensor or TensorLike, but got '"+t.constructor.name+"'");var o=Be(t);D(t)||Array.isArray(t)||(t=[t]);var a="string"!==i?$(t,i,te.get("DEBUG")):y(t);return mt.make(o,{values:a},i)}function ze(t,n,r){if(!Array.isArray(t))throw new Error("Argument "+n+" passed to "+r+" must be a `Tensor[]` or `TensorLike[]`");return t.map(function(t,e){return Fe(t,n+"["+e+"]",r)})}function Ue(t){var e=Object.keys(t);if(1!==e.length)throw new Error("Please provide an object with a single key (operation name) mapping to a function. Got an object with "+e.length+" keys.");var r=e[0],i=t[r];r.endsWith("_")&&(r=r.substring(0,r.length-1));function n(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];te.engine.startScope(r);try{var n=i.apply(void 0,t);return n instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),te.engine.endScope(n),n}catch(t){throw te.engine.endScope(null),t}}return Object.defineProperty(n,"name",{value:r,configurable:!0}),n}var Ve=Ue({softmax_:function(t,r){void 0===r&&(r=-1);var e=Fe(t,"logits","softmax");if(-1===r&&(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 se(function(t){var e=t.logSumExp([r],!0),n=t.toFloat().sub(e).exp();return{value:n,gradFunc:function(t){var e=t.mul(n);return e.sub(e.sum([r],!0).mul(n))}}})(e)}}),We=Ue({logSoftmax_:function(t,i){void 0===i&&(i=-1);var e=Fe(t,"logits","logSoftmax");if(-1===i&&(i=e.rank-1),i!==e.rank-1)throw Error("Log Softmax along a non-last dimension is not yet supported. Logits was rank "+e.rank+" and axis was "+i);return se(function(t){var e=t.max(i,!0),n=t.sub(e),r=n.toFloat().sub(n.exp().sum(i,!0).log());return{value:r,gradFunc:function(t){var e=r.exp();return t.sub(t.sum(i,!0).mul(e))}}})(e)}});var qe=Ue({complex_:function(t,e){var n=Fe(t,"real","complex"),r=Fe(e,"imag","complex");return d(n.shape,r.shape,"real and imag shapes, "+n.shape+" and "+r.shape+", must match in call to tf.complex()."),te.engine.runKernel(function(t){return t.complex(n,r)},{$real:n,$imag:r})}}),He=Ue({real_:function(t){var e=Fe(t,"input","real");return te.engine.runKernel(function(t){return t.real(e)},{$input:e})}}),$e=Ue({imag_:function(t){var e=Fe(t,"input","imag");return te.engine.runKernel(function(t){return t.imag(e)},{$input:e})}});function Ge(t,e,n){if(null==n&&(n=V(t)),"complex64"===n)throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!D(t)&&!Array.isArray(t)&&"number"!=typeof t&&"boolean"!=typeof t&&"string"!=typeof t)throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");var r=Be(t);if(null!=e){var i=L(e),o=L(r);C(i===o,function(){return"Based on the provided shape, ["+e+"], the tensor should have "+i+" values but has "+o});for(var a=0;a<r.length;++a){var s=r[a],u=a!==r.length-1||s!==L(e.slice(a));C(r[a]===e[a]||!u,function(){return"Error creating a new Tensor. Inferred shape ("+r+") does not match the provided shape ("+e+"). "})}}return D(t)||Array.isArray(t)||(t=[t]),e=e||r,t="string"!==n?$(t,n,te.get("DEBUG")):y(t),mt.make(e,{values:t},n)}function Ke(t,e){if((D(t)||Array.isArray(t))&&"complex64"!==e)throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");return Ge(t,[],e)}function Xe(t,e){g(t);var n=Be(t);if(1!==n.length)throw new Error("tensor1d() requires values to be a flat/TypedArray");return Ge(t,n,e)}function Ye(t,e,n){if(g(t),null!=e&&2!==e.length)throw new Error("tensor2d() requires shape to have two numbers");var r=Be(t);if(2!==r.length&&1!==r.length)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(1===r.length&&null==e)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return Ge(t,e=e||r,n)}function Ze(t,e,n){if(g(t),null!=e&&3!==e.length)throw new Error("tensor3d() requires shape to have three numbers");var r=Be(t);if(3!==r.length&&1!==r.length)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(1===r.length&&null==e)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return Ge(t,e=e||r,n)}function Je(t,e,n){if(g(t),null!=e&&4!==e.length)throw new Error("tensor4d() requires shape to have four numbers");var r=Be(t);if(4!==r.length&&1!==r.length)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(1===r.length&&null==e)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return Ge(t,e=e||r,n)}function Qe(t,e,n){if(g(t),null!=e&&5!==e.length)throw new Error("tensor5d() requires shape to have five numbers");var r=Be(t);if(5!==r.length&&1!==r.length)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(1===r.length&&null==e)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return Ge(t,e=e||r,n)}function tn(t,e,n){if(g(t),null!=e&&6!==e.length)throw new Error("tensor6d() requires shape to have six numbers");var r=Be(t);if(6!==r.length&&1!==r.length)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(1===r.length&&null==e)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return Ge(t,e=e||r,n)}function en(t,e){if(void 0===e&&(e="float32"),"complex64"===e){var n=en(t,"float32"),r=en(t,"float32");return qe(n,r)}var i=K(L(t),e);return mt.make(t,{values:i},e)}function nn(t,e){if(void 0===e&&(e="float32"),"complex64"===e){var n=nn(t,"float32"),r=nn(t,"float32");return qe(n,r)}var i=X(L(t),e);return mt.make(t,{values:i},e)}function rn(t,e,n){var r=A(n=n||V(e),L(t));return r.fill(e),mt.make(t,{values:r},n)}function on(t,e,n){if(0===n)throw new Error("Cannot request zero samples");var r=(e-t)/(n-1),i=X(n,"float32");i[0]=t;for(var o=1;o<i.length;o++)i[o]=i[o-1]+r;return Xe(i,"float32")}function an(t,e,n,r){if(void 0===n&&(n=1),void 0===r&&(r="float32"),0===n)throw new Error("Cannot have a step of zero");if(t===e||t<e&&n<0||e<t&&1<n)return nn([0],r);var i=X(Math.abs(Math.ceil((e-t)/n)),r);e<t&&1===n&&(n=-1),i[0]=t;for(var o=1;o<i.length;o++)i[o]=i[o-1]+n;return Xe(i,r)}var sn=Ue({onesLike_:function(t){var e=Fe(t,"x","onesLike");return en(e.shape,e.dtype)}}),un=Ue({zerosLike_:function(t){var e=Fe(t,"x","zerosLike");return nn(e.shape,e.dtype)}}),cn=(hn.prototype.get=function(t){return this.data.has(t)||this.dataMover.moveData(t),this.data.get(t)},hn.prototype.set=function(t,e){this.data.set(t,e)},hn.prototype.has=function(t){return this.data.has(t)},hn.prototype.delete=function(t){return this.data.delete(t)},hn),ln=(fn.prototype.time=function(t){throw new Error("Not yet implemented.")},fn.prototype.read=function(t){throw new Error("Not yet implemented.")},fn.prototype.readSync=function(t){throw new Error("Not yet implemented.")},fn.prototype.disposeData=function(t){throw new Error("Not yet implemented.")},fn.prototype.write=function(t,e){throw new Error("Not yet implemented.")},fn.prototype.fromPixels=function(t,e){throw new Error("Not yet implemented.")},fn.prototype.register=function(t,e,n){throw new Error("Not yet implemented.")},fn.prototype.memory=function(){throw new Error("Not yet implemented.")},fn.prototype.floatPrecision=function(){throw new Error("Not yet implemented")},fn.prototype.batchMatMul=function(t,e,n,r){throw new Error("Not yet implemented")},fn.prototype.fusedBatchMatMul=function(t,e,n,r,i,o){throw new Error("Not yet implemented")},fn.prototype.slice=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.stridedSlice=function(t,e,n,r,i,o,a,s,u){throw new Error("Not yet implemented")},fn.prototype.unstack=function(t,e){throw new Error("Not yet implemented")},fn.prototype.reverse=function(t,e){throw new Error("Not yet implemented")},fn.prototype.concat=function(t,e){throw new Error("Not yet implemented")},fn.prototype.neg=function(t){throw new Error("Not yet implemented")},fn.prototype.add=function(t,e){throw new Error("Not yet implemented")},fn.prototype.addN=function(t){throw new Error("Not yet implemented")},fn.prototype.subtract=function(t,e){throw new Error("Not yet implemented")},fn.prototype.multiply=function(t,e){throw new Error("Not yet implemented")},fn.prototype.realDivide=function(t,e){throw new Error("Not yet implemented")},fn.prototype.floorDiv=function(t,e){throw new Error("Not yet implemented")},fn.prototype.sum=function(t,e){throw new Error("Not yet implemented")},fn.prototype.prod=function(t,e){throw new Error("Not yet implemented")},fn.prototype.unsortedSegmentSum=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.argMin=function(t,e){throw new Error("Not yet implemented")},fn.prototype.argMax=function(t,e){throw new Error("Not yet implemented")},fn.prototype.equal=function(t,e){throw new Error("Not yet implemented")},fn.prototype.notEqual=function(t,e){throw new Error("Not yet implemented")},fn.prototype.less=function(t,e){throw new Error("Not yet implemented")},fn.prototype.lessEqual=function(t,e){throw new Error("Not yet implemented")},fn.prototype.greater=function(t,e){throw new Error("Not yet implemented")},fn.prototype.greaterEqual=function(t,e){throw new Error("Not yet implemented")},fn.prototype.logicalNot=function(t){throw new Error("Not yet implemented")},fn.prototype.logicalAnd=function(t,e){throw new Error("Not yet implemented")},fn.prototype.logicalOr=function(t,e){throw new Error("Not yet implemented")},fn.prototype.where=function(t){throw new Error("Not yet implemented")},fn.prototype.select=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.topk=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.min=function(t,e){throw new Error("Not yet implemented")},fn.prototype.minimum=function(t,e){throw new Error("Not yet implemented")},fn.prototype.mod=function(t,e){throw new Error("Not yet implemented")},fn.prototype.max=function(t,e){throw new Error("Not yet implemented")},fn.prototype.maximum=function(t,e){throw new Error("Not yet implemented")},fn.prototype.all=function(t,e){throw new Error("Not yet implemented")},fn.prototype.any=function(t,e){throw new Error("Not yet implemented")},fn.prototype.squaredDifference=function(t,e){throw new Error("Not yet implemented")},fn.prototype.ceil=function(t){throw new Error("Not yet implemented")},fn.prototype.floor=function(t){throw new Error("Not yet implemented")},fn.prototype.round=function(t){throw new Error("Not yet implemented")},fn.prototype.sign=function(t){throw new Error("Not yet implemented")},fn.prototype.pow=function(t,e){throw new Error("Not yet implemented")},fn.prototype.exp=function(t){throw new Error("Not yet implemented")},fn.prototype.expm1=function(t){throw new Error("Not yet implemented")},fn.prototype.log=function(t){throw new Error("Not yet implemented")},fn.prototype.log1p=function(t){throw new Error("Not yet implemented")},fn.prototype.sqrt=function(t){throw new Error("Not yet implemented")},fn.prototype.rsqrt=function(t){throw new Error("Not yet implemented")},fn.prototype.square=function(t){throw new Error("Not yet implemented")},fn.prototype.reciprocal=function(t){throw new Error("Not yet implemented")},fn.prototype.relu=function(t){throw new Error("Not yet implemented")},fn.prototype.prelu=function(t,e){throw new Error("Not yet implemented")},fn.prototype.elu=function(t){throw new Error("Not yet implemented")},fn.prototype.eluDer=function(t,e){throw new Error("Not yet implemented")},fn.prototype.selu=function(t){throw new Error("Not yet implemented")},fn.prototype.int=function(t){throw new Error("Not yet implemented")},fn.prototype.clip=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.abs=function(t){throw new Error("Not yet implemented")},fn.prototype.complexAbs=function(t){throw new Error("Not yet implemented")},fn.prototype.sigmoid=function(t){throw new Error("Not yet implemented")},fn.prototype.softplus=function(t){throw new Error("Not yet implemented")},fn.prototype.sin=function(t){throw new Error("Not yet implemented")},fn.prototype.cos=function(t){throw new Error("Not yet implemented")},fn.prototype.tan=function(t){throw new Error("Not yet implemented")},fn.prototype.asin=function(t){throw new Error("Not yet implemented")},fn.prototype.acos=function(t){throw new Error("Not yet implemented")},fn.prototype.atan=function(t){throw new Error("Not yet implemented")},fn.prototype.atan2=function(t,e){throw new Error("Not yet implemented")},fn.prototype.sinh=function(t){throw new Error("Not yet implemented")},fn.prototype.cosh=function(t){throw new Error("Not yet implemented")},fn.prototype.tanh=function(t){throw new Error("Not yet implemented")},fn.prototype.asinh=function(t){throw new Error("Not yet implemented")},fn.prototype.acosh=function(t){throw new Error("Not yet implemented")},fn.prototype.atanh=function(t){throw new Error("Not yet implemented")},fn.prototype.erf=function(t){throw new Error("Not yet implemented")},fn.prototype.step=function(t,e){throw new Error("Not yet implemented")},fn.prototype.conv2d=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.conv2dDerInput=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.conv2dDerFilter=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.depthwiseConv2D=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.depthwiseConv2DDerInput=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.depthwiseConv2DDerFilter=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.conv3d=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.conv3dDerInput=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.conv3dDerFilter=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.maxPool=function(t,e){throw new Error("Not yet implemented")},fn.prototype.maxPoolBackprop=function(t,e,n,r){throw new Error("Not yet implemented")},fn.prototype.avgPool=function(t,e){throw new Error("Not yet implemented")},fn.prototype.avgPoolBackprop=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.reshape=function(t,e){throw new Error("Not yet implemented")},fn.prototype.cast=function(t,e){throw new Error("Not yet implemented")},fn.prototype.tile=function(t,e){throw new Error("Not yet implemented")},fn.prototype.pad=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.transpose=function(t,e){throw new Error("Not yet implemented")},fn.prototype.gather=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.gatherND=function(t,e){throw new Error("Not yet implemented")},fn.prototype.scatterND=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.batchToSpaceND=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.spaceToBatchND=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.resizeBilinear=function(t,e,n,r){throw new Error("Not yet implemented")},fn.prototype.resizeBilinearBackprop=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.resizeNearestNeighbor=function(t,e,n,r){throw new Error("Not yet implemented")},fn.prototype.resizeNearestNeighborBackprop=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.batchNormalization=function(t,e,n,r,i,o){throw new Error("Not yet implemented")},fn.prototype.localResponseNormalization4D=function(t,e,n,r,i){throw new Error("Not yet implemented")},fn.prototype.LRNGrad=function(t,e,n,r,i,o,a){throw new Error("Not yet implemented")},fn.prototype.multinomial=function(t,e,n,r){throw new Error("Not yet implemented")},fn.prototype.oneHot=function(t,e,n,r){throw new Error("Not yet implemented")},fn.prototype.cumsum=function(t,e,n,r){throw new Error("Not yet implemented")},fn.prototype.nonMaxSuppression=function(t,e,n,r,i){throw new Error("Not yet implemented")},fn.prototype.fft=function(t){throw new Error("Not yet implemented")},fn.prototype.ifft=function(t){throw new Error("Not yet implemented")},fn.prototype.complex=function(t,e){throw new Error("Not yet implemented")},fn.prototype.real=function(t){throw new Error("Not yet implemented")},fn.prototype.imag=function(t){throw new Error("Not yet implemented")},fn.prototype.cropAndResize=function(t,e,n,r,i,o){throw new Error("Not yet implemented")},fn.prototype.depthToSpace=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.split=function(t,e,n){throw new Error("Not yet implemented")},fn.prototype.sparseToDense=function(t,e,n,r){throw new Error("Not yet implemented")},fn.prototype.setDataMover=function(t){throw new Error("Not yet implemented")},fn.prototype.dispose=function(){throw new Error("Not yet implemented")},fn);function fn(){}function hn(t){this.dataMover=t,this.data=new WeakMap}function pn(t,e,n){if("complex64"===e){if("complex64"===t.dtype)return t.clone();var r=nn(t.shape),i=t.toFloat(),o=n.complex(i,r);return r.dispose(),i.dispose(),o}if(!R(t.dtype,e))return mt.make(t.shape,{dataId:t.dataId},e);if("complex64"===t.dtype){var a=n.real(t);return o=a.cast(e),a.dispose(),o}if("int32"===e)return n.int(t);if("bool"!==e)throw new Error("Error in Cast: unknown dtype argument ("+e+")");var s=Ke(0,t.dtype);return o=n.notEqual(t,s),s.dispose(),o}function dn(t,e){return mt.make(e,{dataId:t.dataId},t.dtype)}function mn(t,e){if(t.length!==e.length)throw new Error("Cannot merge real and imag arrays of different lengths. real:"+t.length+", imag: "+e.length+".");for(var n=new Float32Array(2*t.length),r=0;r<n.length;r+=2)n[r]=t[r/2],n[r+1]=e[r/2];return n}function gn(t,e){return{real:t[2*e],imag:t[2*e+1]}}function yn(t,e,n,r,i){for(var o=Array.from(e).map(function(t,e){return{score:t,boxIndex:e}}).filter(function(t){return t.score>i}).sort(function(t,e){return e.score-t.score}),a=[],s=0;s<o.length;s++){var u=o[s],c=u.score,l=u.boxIndex;if(c<i)break;for(var f=!1,h=a.length-1;0<=h;--h)if(vn(t,l,a[h])>=r){f=!0;break}if(!f&&(a.push(l),a.length>=n))break}return Xe(a,"int32")}function vn(t,e,n){var r=t.subarray(4*e,4*e+4),i=t.subarray(4*n,4*n+4),o=Math.min(r[0],r[2]),a=Math.min(r[1],r[3]),s=Math.max(r[0],r[2]),u=Math.max(r[1],r[3]),c=Math.min(i[0],i[2]),l=Math.min(i[1],i[3]),f=Math.max(i[0],i[2]),h=Math.max(i[1],i[3]),p=(s-o)*(u-a),d=(f-c)*(h-l);if(p<=0||d<=0)return 0;var m=Math.max(o,c),g=Math.max(a,l),y=Math.min(s,f),v=Math.min(u,h),b=Math.max(y-m,0)*Math.max(v-g,0);return b/(p+d-b)}function bn(n,t,r){var i=new Array(n.rank).fill(0),o=n.shape.slice();return t.map(function(t){o[r]=t;var e=n.slice(i,o);return i[r]+=t,e})}function wn(t,e,n,r,i){for(var o=e[e.length-1],a=[t.length/o,o],s=a[0],u=a[1],c=k(n,s*r),l=k("int32",s*r),f=0;f<s;f++){for(var h=f*u,p=t.subarray(h,h+u),d=[],m=0;m<p.length;m++)d.push({value:p[m],index:m});d.sort(function(t,e){return e.value-t.value});var g=f*r,y=c.subarray(g,g+r),v=l.subarray(g,g+r);for(m=0;m<r;m++)y[m]=d[m].value,v[m]=d[m].index}var b=e.slice();return b[b.length-1]=r,[Ge(c,b,n),Ge(l,b,"int32")]}var _n=function(t,e,n){this.variableNames=["A"];var r=t.windowSize,i=t.batchSize,o=t.inSize,a=Math.ceil(o/r);n||this.variableNames.push("bestIndicesA"),this.outputShape=[i,a];var s="max"===e?">":"<",u=n?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode="\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int batch = coords[0];\n        int outIdx = coords[1];\n        int inOffset = outIdx * "+r+";\n\n        int bestIndex = inOffset;\n        float bestValue = getA(batch, bestIndex);\n\n        for (int i = 0; i < "+r+"; i++) {\n          int inIdx = "+u+";\n          float candidate = getA(batch, inIdx);\n          if (candidate "+s+" bestValue) {\n            bestValue = candidate;\n            bestIndex = inIdx;\n          }\n        }\n        setOutput(float(bestIndex));\n      }\n    "},xn=function(t){this.variableNames=["dy"],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,r=t.strideHeight,i=t.strideWidth,o=t.dilationHeight,a=t.dilationWidth,s=t.effectiveFilterHeight,u=t.effectiveFilterWidth,c=s-1-t.padInfo.top,l=u-1-t.padInfo.left,f=1/(e*n);this.userCode="\n      const ivec2 pads = ivec2("+c+", "+l+");\n      const float avgMultiplier = float("+f+");\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n\n        ivec2 dyRCCorner = coords.yz - pads;\n        int dyRCorner = dyRCCorner.x;\n        int dyCCorner = dyRCCorner.y;\n\n        // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n        for (int wR = 0; wR < "+s+";\n            wR += "+o+") {\n          float dyR = float(dyRCorner + wR) / "+r+".0;\n\n          if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n            continue;\n          }\n          int idyR = int(dyR);\n\n          for (int wC = 0; wC < "+u+";\n            wC+= "+a+") {\n            float dyC = float(dyCCorner + wC) / "+i+".0;\n\n            if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n                fract(dyC) > 0.0) {\n              continue;\n            }\n            int idyC = int(dyC);\n\n            float dyValue = getDy(b, idyR, idyC, d);\n\n            dotProd += dyValue * avgMultiplier;\n          }\n        }\n        setOutput(dotProd);\n      }\n    "};function En(t,e){for(var n=t.length,r=[],i=0;i<n;i++){var o=n-1-i,a=t[o]||1;1<(e[e.length-1-i]||1)&&1===a&&r.unshift(o)}return r}function Sn(t,e){for(var n=[],r=0;r<e.length;r++){var i=t[t.length-r-1],o=e.length-r-1,a=e[o];(null==i||1===i&&1<a)&&n.unshift(o)}return n}function Nn(t,e){for(var n=[],r=Math.max(t.length,e.length),i=0;i<r;i++){var o=t[t.length-i-1];null==o&&(o=1);var a=e[e.length-i-1];if(null==a&&(a=1),1===o)n.unshift(a);else if(1===a)n.unshift(o);else{if(o!==a)throw Error("Operands could not be broadcast together with shapes "+t+" and "+e+".");n.unshift(o)}}return n}var In=function(t,e,n,r,i,o){this.outputShape=[],this.variableNames=["x","mean","variance"],Nn(t,e),Nn(t,n);var a="0.0";null!=r&&(Nn(t,r),this.variableNames.push("offset"),a="getOffsetAtOutCoords()");var s="1.0";null!=i&&(Nn(t,i),this.variableNames.push("scale"),s="getScaleAtOutCoords()"),this.outputShape=t,this.userCode="\n      void main() {\n        float x = getXAtOutCoords();\n        float mean = getMeanAtOutCoords();\n        float variance = getVarianceAtOutCoords();\n        float offset = "+a+";\n        float scale = "+s+";\n        float inv = scale * inversesqrt(variance + float("+o+"));\n        setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));\n      }\n    "},On=function(t,e,n,r,i,o){this.usesPackedTextures=!0,this.variableNames=["x","mean","variance"],Nn(t,e),Nn(t,n);var a="vec4(0.0)";null!=r&&(Nn(t,r),this.variableNames.push("offset"),a="getOffsetAtOutCoords()");var s="vec4(1.0)";null!=i&&(Nn(t,i),this.variableNames.push("scale"),s="getScaleAtOutCoords()"),this.outputShape=t,this.userCode="\n      void main() {\n        vec4 offset = "+a+";\n        vec4 scale = "+s+";\n\n        vec4 x = getXAtOutCoords();\n        vec4 mean = getMeanAtOutCoords();\n        vec4 variance = getVarianceAtOutCoords();\n\n        vec4 inv = scale * inversesqrt(variance + vec4("+o+"));\n\n        setOutput((x - mean) * inv + offset);\n      }\n    "},kn="return areal * breal - aimag * bimag;",An="return areal * bimag + aimag * breal;",Cn=function(t,e,n){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=Nn(e,n),this.userCode="\n      float binaryOpComplex(\n          float areal, float aimag, float breal, float bimag) {\n        "+t+"\n      }\n\n      void main() {\n        float areal = getARealAtOutCoords();\n        float aimag = getAImagAtOutCoords();\n        float breal = getBRealAtOutCoords();\n        float bimag = getBImagAtOutCoords();\n        setOutput(binaryOpComplex(areal, aimag, breal, bimag));\n      }\n    "},Pn="return a + b;",Tn="return a - b;",Mn="return a * b;",Rn=(tr.prototype.getCustomSetupFunc=function(){var n=this;return function(t,e){null==n.startLoc&&(n.startLoc=t.getUniformLocationNoThrow(e,"NAN"),null==n.startLoc)||t.gl.uniform1f(n.startLoc,NaN)}},tr),Dn=(Qn.prototype.getCustomSetupFunc=function(){var n=this;return function(t,e){null==n.startLoc&&(n.startLoc=t.getUniformLocationNoThrow(e,"NAN"),null==n.startLoc)||t.gl.uniform1f(n.startLoc,NaN)}},Qn),jn=(Jn.prototype.getCustomSetupFunc=function(n,r){var i=this;return function(t,e){null==i.minLoc&&(i.minLoc=t.getUniformLocationNoThrow(e,"min"),i.maxLoc=t.getUniformLocationNoThrow(e,"max")),t.gl.uniform1f(i.minLoc,n),t.gl.uniform1f(i.maxLoc,r)}},Jn),Bn=(Zn.prototype.getCustomSetupFunc=function(n,r){var i=this;return function(t,e){null==i.minLoc&&(i.minLoc=t.getUniformLocationNoThrow(e,"min"),i.maxLoc=t.getUniformLocationNoThrow(e,"max")),t.gl.uniform1f(i.minLoc,n),t.gl.uniform1f(i.maxLoc,r)}},Zn),Ln=function(t){this.variableNames=["real","imag"],this.outputShape=t,this.userCode="\n      void main() {\n        float re = abs(getRealAtOutCoords());\n        float im = abs(getImagAtOutCoords());\n        float mx = max(re, im);\n\n        // sadly the length function in glsl is not underflow-safe\n        // (at least not on Intel GPUs). So the safe solution is\n        // to ensure underflow-safety in all cases.\n        setOutput(\n          mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx))\n        );\n      }\n    "},Fn=function(t){this.outputShape=[],this.outputShape=Oe(t,1),this.variableNames=t.map(function(t,e){return"T"+e});var e=new Array(t.length-1);e[0]=t[0][1];for(var n=1;n<e.length;n++)e[n]=e[n-1]+t[n][1];var r=["if (yC < "+e[0]+") setOutput(getT0(yR, yC));"];for(n=1;n<e.length;n++){var i=e[n-1];r.push("else if (yC < "+e[n]+") setOutput(getT"+n+"(yR, yC-"+i+"));")}var o=e.length,a=e[e.length-1];r.push("else setOutput(getT"+o+"(yR, yC-"+a+"));"),this.userCode="\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int yR = coords.x;\n        int yC = coords.y;\n\n        "+r.join("\n        ")+"\n      }\n    "},zn=function(t){this.variableNames=["x","dy"],this.outputShape=t.filterShape;var e=t.strideHeight,n=t.strideWidth,r=t.padInfo.top,i=t.padInfo.left;this.userCode="\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int wR = coords.x;\n        int wC = coords.y;\n        int d1 = coords.z;\n        int d2 = coords.w;\n\n        // Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n\n        for (int b = 0; b < "+t.batchSize+"; b++) {\n          for (int yR = 0; yR < "+t.outHeight+"; yR++) {\n            int xR = wR + yR * "+e+" - "+r+";\n\n            if (xR < 0 || xR >= "+t.inHeight+") {\n              continue;\n            }\n\n            for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n              int xC = wC + yC * "+n+" - "+i+";\n\n              if (xC < 0 || xC >= "+t.inWidth+") {\n                continue;\n              }\n\n              float dyValue = getDy(b, yR, yC, d2);\n              float xValue = getX(b, xR, xC, d1);\n              dotProd += (xValue * dyValue);\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    "},Un=function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,r=t.strideHeight,i=t.strideWidth,o=e-1-t.padInfo.top,a=n-1-t.padInfo.left;this.userCode="\n      const ivec2 pads = ivec2("+o+", "+a+");\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords[0];\n        int d1 = coords[3];\n\n        ivec2 dyCorner = coords.yz - pads;\n        int dyRCorner = dyCorner.x;\n        int dyCCorner = dyCorner.y;\n\n        // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n        for (int wR = 0; wR < "+e+"; wR++) {\n          float dyR = float(dyRCorner + wR) / "+r+".0;\n\n          if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n            continue;\n          }\n          int idyR = int(dyR);\n\n          int wRPerm = "+e+" - 1 - wR;\n\n          for (int wC = 0; wC < "+n+"; wC++) {\n            float dyC = float(dyCCorner + wC) / "+i+".0;\n\n            if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n                fract(dyC) > 0.0) {\n              continue;\n            }\n            int idyC = int(dyC);\n\n            int wCPerm = "+n+" - 1 - wC;\n\n            for (int d2 = 0; d2 < "+t.outChannels+"; d2++) {\n              float xValue = getDy(batch, idyR, idyC, d2);\n              float wValue = getW(wRPerm, wCPerm, d1, d2);\n              dotProd += xValue * wValue;\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    "},Vn=function(t){this.variableNames=["x","dy"],this.outputShape=t.filterShape;var e=t.strideDepth,n=t.strideHeight,r=t.strideWidth,i=t.padInfo.front,o=t.padInfo.top,a=t.padInfo.left;this.userCode="\n      void main() {\n        ivec5 coords = getOutputCoords();\n        int wF = coords.x;\n        int wR = coords.y;\n        int wC = coords.z;\n        int d1 = coords.w;\n        int d2 = coords.u;\n\n        float dotProd = 0.0;\n\n        for (int b = 0; b < "+t.batchSize+"; b++) {\n          for (int yF = 0; yF < "+t.outDepth+"; yF++) {\n            int xF = wF + yF * "+e+" - "+i+";\n\n            if (xF < 0 || xF >= "+t.inDepth+") {\n              continue;\n            }\n\n            for (int yR = 0; yR < "+t.outHeight+"; yR++) {\n              int xR = wR + yR * "+n+" - "+o+";\n\n              if (xR < 0 || xR >= "+t.inHeight+") {\n                continue;\n              }\n\n              for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n                int xC = wC + yC * "+r+" - "+a+";\n\n                if (xC < 0 || xC >= "+t.inWidth+") {\n                  continue;\n                }\n\n                float dyValue = getDy(b, yF, yR, yC, d2);\n                float xValue = getX(b, xF, xR, xC, d1);\n                dotProd += (xValue * dyValue);\n              }\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    "},Wn=function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterDepth,n=t.filterHeight,r=t.filterWidth,i=t.strideDepth,o=t.strideHeight,a=t.strideWidth,s=e-1-t.padInfo.front,u=n-1-t.padInfo.top,c=r-1-t.padInfo.left;this.userCode="\n      const ivec3 pads = ivec3("+s+", "+u+", "+c+");\n\n      void main() {\n        ivec5 coords = getOutputCoords();\n        int batch = coords.x;\n        int d1 = coords.u;\n\n\n        ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n        int dyFCorner = dyCorner.x;\n        int dyRCorner = dyCorner.y;\n        int dyCCorner = dyCorner.z;\n\n        float dotProd = 0.0;\n        for (int wF = 0; wF < "+e+"; wF++) {\n          float dyF = float(dyFCorner + wF) / "+i+".0;\n\n          if (dyF < 0.0 || dyF >= "+t.outDepth+".0 || fract(dyF) > 0.0) {\n            continue;\n          }\n          int idyF = int(dyF);\n\n          int wFPerm = "+e+" - 1 - wF;\n\n          for (int wR = 0; wR < "+n+"; wR++) {\n            float dyR = float(dyRCorner + wR) / "+o+".0;\n\n            if (dyR < 0.0 || dyR >= "+t.outHeight+".0 ||\n              fract(dyR) > 0.0) {\n              continue;\n            }\n            int idyR = int(dyR);\n\n            int wRPerm = "+n+" - 1 - wR;\n\n            for (int wC = 0; wC < "+r+"; wC++) {\n              float dyC = float(dyCCorner + wC) / "+a+".0;\n\n              if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n                  fract(dyC) > 0.0) {\n                continue;\n              }\n              int idyC = int(dyC);\n\n              int wCPerm = "+r+" - 1 - wC;\n\n              for (int d2 = 0; d2 < "+t.outChannels+"; d2++) {\n                float xValue = getDy(batch, idyF, idyR, idyC, d2);\n                float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2);\n                dotProd += xValue * wValue;\n              }\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    "},qn=function(t){this.variableNames=["x","dy"],this.outputShape=t.filterShape;var e=t.strideHeight,n=t.strideWidth,r=t.padInfo.top,i=t.padInfo.left,o=t.outChannels/t.inChannels;this.userCode="\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int wR = coords.x;\n        int wC = coords.y;\n        int d1 = coords.z;\n        int dm = coords.w;\n        int d2 = d1 * "+o+" + dm;\n\n        float dotProd = 0.0;\n\n        // TODO: Vec4 over the batch size\n        for (int b = 0; b < "+t.batchSize+"; b++) {\n          for (int yR = 0; yR < "+t.outHeight+"; yR++) {\n            int xR = wR + yR * "+e+" - "+r+";\n\n            if (xR < 0 || xR >= "+t.inHeight+") {\n              continue;\n            }\n\n            for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n              int xC = wC + yC * "+n+" - "+i+";\n\n              if (xC < 0 || xC >= "+t.inWidth+") {\n                continue;\n              }\n\n              float dyValue = getDy(b, yR, yC, d2);\n              float xValue = getX(b, xR, xC, d1);\n              dotProd += (xValue * dyValue);\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    "},Hn=function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,r=t.strideHeight,i=t.strideWidth,o=e-1-t.padInfo.top,a=n-1-t.padInfo.left,s=t.outChannels/t.inChannels;this.userCode="\n      const ivec2 pads = ivec2("+o+", "+a+");\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords[0];\n        int d1 = coords[3];\n        ivec2 dyCorner = coords.yz - pads;\n        int dyRCorner = dyCorner.x;\n        int dyCCorner = dyCorner.y;\n\n        float dotProd = 0.0;\n\n        for (int wR = 0; wR < "+e+"; wR++) {\n          float dyR = float(dyRCorner + wR) / "+r+".0;\n\n          if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n            continue;\n          }\n          int idyR = int(dyR);\n\n          int wRPerm = "+e+" - 1 - wR;\n\n          for (int wC = 0; wC < "+n+"; wC++) {\n            float dyC = float(dyCCorner + wC) / "+i+".0;\n\n            if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n                fract(dyC) > 0.0) {\n              continue;\n            }\n            int idyC = int(dyC);\n\n            int wCPerm = "+n+" - 1 - wC;\n\n            // TODO: Vec4 over the channelMul\n            for (int dm = 0; dm < "+s+"; dm++) {\n              int d2 = d1 * "+s+" + dm;\n              float xValue = getDy(batch, idyR, idyC, d2);\n              float wValue = getW(wRPerm, wCPerm, d1, dm);\n              dotProd += xValue * wValue;\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    "},$n=function(t){this.variableNames=["x","W"],this.outputShape=t.outShape;var e=t.padInfo.top,n=t.padInfo.left,r=t.strideHeight,i=t.strideWidth,o=t.dilationHeight,a=t.dilationWidth,s=t.filterHeight,u=t.filterWidth,c=4*Math.floor(t.inChannels/4),l=t.inChannels%4;this.userCode="\n      const ivec2 strides = ivec2("+r+", "+i+");\n      const ivec2 pads = ivec2("+e+", "+n+");\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords[0];\n        int d2 = coords[3];\n\n        ivec2 xRCCorner = coords.yz * strides - pads;\n        int xRCorner = xRCCorner.x;\n        int xCCorner = xRCCorner.y;\n\n        // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n        for (int wR = 0; wR < "+s+"; wR++) {\n          int xR = xRCorner + wR * "+o+";\n\n          if (xR < 0 || xR >= "+t.inHeight+") {\n            continue;\n          }\n\n          for (int wC = 0; wC < "+u+"; wC++) {\n            int xC = xCCorner + wC * "+a+";\n\n            if (xC < 0 || xC >= "+t.inWidth+") {\n              continue;\n            }\n\n            for (int d1 = 0; d1 < "+c+"; d1 += 4) {\n              vec4 xValues = vec4(\n                getX(batch, xR, xC, d1),\n                getX(batch, xR, xC, d1 + 1),\n                getX(batch, xR, xC, d1 + 2),\n                getX(batch, xR, xC, d1 + 3)\n              );\n              vec4 wValues = vec4(\n                getW(wR, wC, d1, d2),\n                getW(wR, wC, d1 + 1, d2),\n                getW(wR, wC, d1 + 2, d2),\n                getW(wR, wC, d1 + 3, d2)\n              );\n\n              dotProd += dot(xValues, wValues);\n            }\n\n            if ("+(1==l)+") {\n              dotProd +=\n                getX(batch, xR, xC, "+c+") *\n                getW(wR, wC, "+c+", d2);\n            } else if ("+(2==l)+") {\n              vec2 xValues = vec2(\n                getX(batch, xR, xC, "+c+"),\n                getX(batch, xR, xC, "+c+" + 1)\n              );\n              vec2 wValues = vec2(\n                getW(wR, wC, "+c+", d2),\n                getW(wR, wC, "+c+" + 1, d2)\n              );\n              dotProd += dot(xValues, wValues);\n            } else if ("+(3==l)+") {\n              vec3 xValues = vec3(\n                getX(batch, xR, xC, "+c+"),\n                getX(batch, xR, xC, "+c+" + 1),\n                getX(batch, xR, xC, "+c+" + 2)\n              );\n              vec3 wValues = vec3(\n                getW(wR, wC, "+c+", d2),\n                getW(wR, wC, "+c+" + 1, d2),\n                getW(wR, wC, "+c+" + 2, d2)\n              );\n              dotProd += dot(xValues, wValues);\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    "},Gn=function(t){this.variableNames=["x","W"],this.outputShape=t.outShape;var e=t.padInfo.front,n=t.padInfo.top,r=t.padInfo.left,i=t.strideDepth,o=t.strideHeight,a=t.strideWidth,s=t.dilationDepth,u=t.dilationHeight,c=t.dilationWidth,l=t.filterDepth,f=t.filterHeight,h=t.filterWidth,p=4*Math.floor(t.inChannels/4),d=t.inChannels%4;this.userCode="\n      const ivec3 strides = ivec3("+i+", "+o+", "+a+");\n      const ivec3 pads = ivec3("+e+", "+n+", "+r+");\n\n      void main() {\n        ivec5 coords = getOutputCoords();\n        int batch = coords.x;\n        int d2 = coords.u;\n\n        ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n        int xFCorner = xFRCCorner.x;\n        int xRCorner = xFRCCorner.y;\n        int xCCorner = xFRCCorner.z;\n\n        // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get\n        // y(yF, yR, yC, d2). ? = to be determined. : = across all\n        // values in that axis.\n        float dotProd = 0.0;\n        for (int wF = 0; wF < "+l+"; wF++) {\n          int xF = xFCorner + wF * "+s+";\n\n          if (xF < 0 || xF >= "+t.inDepth+") {\n            continue;\n          }\n\n          for (int wR = 0; wR < "+f+"; wR++) {\n            int xR = xRCorner + wR * "+u+";\n\n            if (xR < 0 || xR >= "+t.inHeight+") {\n              continue;\n            }\n\n            for (int wC = 0; wC < "+h+"; wC++) {\n              int xC = xCCorner + wC * "+c+";\n\n              if (xC < 0 || xC >= "+t.inWidth+") {\n                continue;\n              }\n\n              for (int d1 = 0; d1 < "+p+"; d1 += 4) {\n                vec4 xValues = vec4(\n                  getX(batch, xF, xR, xC, d1),\n                  getX(batch, xF, xR, xC, d1 + 1),\n                  getX(batch, xF, xR, xC, d1 + 2),\n                  getX(batch, xF, xR, xC, d1 + 3)\n                );\n                vec4 wValues = vec4(\n                  getW(wF, wR, wC, d1, d2),\n                  getW(wF, wR, wC, d1 + 1, d2),\n                  getW(wF, wR, wC, d1 + 2, d2),\n                  getW(wF, wR, wC, d1 + 3, d2)\n                );\n\n                dotProd += dot(xValues, wValues);\n              }\n\n              if ("+(1==d)+") {\n                dotProd +=\n                  getX(batch, xF, xR, xC, "+p+") *\n                  getW(wF, wR, wC, "+p+", d2);\n              } else if ("+(2==d)+") {\n                vec2 xValues = vec2(\n                  getX(batch, xF, xR, xC, "+p+"),\n                  getX(batch, xF, xR, xC, "+p+" + 1)\n                );\n                vec2 wValues = vec2(\n                  getW(wF, wR, wC, "+p+", d2),\n                  getW(wF, wR, wC, "+p+" + 1, d2)\n                );\n                dotProd += dot(xValues, wValues);\n              } else if ("+(3==d)+") {\n                vec3 xValues = vec3(\n                  getX(batch, xF, xR, xC, "+p+"),\n                  getX(batch, xF, xR, xC, "+p+" + 1),\n                  getX(batch, xF, xR, xC, "+p+" + 2)\n                );\n                vec3 wValues = vec3(\n                  getW(wF, wR, wC, "+p+", d2),\n                  getW(wF, wR, wC, "+p+" + 1, d2),\n                  getW(wF, wR, wC, "+p+" + 2, d2)\n                );\n                dotProd += dot(xValues, wValues);\n              }\n            }\n          }\n        }\n        setOutput(dotProd);\n      }\n    "},Kn=function(t){this.variableNames=["x","W"],this.outputShape=t.outShape;var e=t.inHeight,n=t.inWidth,r=t.padInfo.top,i=t.padInfo.left,o=t.strideHeight,a=t.strideWidth,s=t.dilationHeight,u=t.dilationWidth,c=t.filterHeight,l=t.filterWidth,f=t.outChannels/t.inChannels;this.userCode="\n      const ivec2 strides = ivec2("+o+", "+a+");\n      const ivec2 pads = ivec2("+r+", "+i+");\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords.x;\n        ivec2 xRCCorner = coords.yz * strides - pads;\n        int d2 = coords.w;\n        int d1 = d2 / "+f+";\n        int q = d2 - d1 * "+f+";\n\n        int xRCorner = xRCCorner.x;\n        int xCCorner = xRCCorner.y;\n\n        // Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n        // TODO(dsmilkov): Flatten the two for loops and vec4 the operations.\n        for (int wR = 0; wR < "+c+"; wR++) {\n          int xR = xRCorner + wR * "+s+";\n\n          if (xR < 0 || xR >= "+e+") {\n            continue;\n          }\n\n          for (int wC = 0; wC < "+l+"; wC++) {\n            int xC = xCCorner + wC * "+u+";\n\n            if (xC < 0 || xC >= "+n+") {\n              continue;\n            }\n\n            float xVal = getX(batch, xR, xC, d1);\n            float wVal = getW(wR, wC, d1, q);\n            dotProd += xVal * wVal;\n          }\n        }\n        setOutput(dotProd);\n      }\n    "},Xn=function(t){this.variableNames=["x","W"],this.usesPackedTextures=!0,this.outputShape=t.outShape;for(var e=t.inHeight,n=t.inWidth,r=t.padInfo.top,i=t.padInfo.left,o=t.strideHeight,a=t.strideWidth,s=t.dilationHeight,u=t.dilationWidth,c=t.filterHeight,l=t.filterWidth,f=l,h="int xR; int xC; int xCOffset;",p=0;p<c;p++)for(var d=0;d<l;d++)h+="\n          vec4 xTexelR"+p+"C"+2*d+" = vec4(0.);\n          vec4 wR"+p+"C"+d+" = vec4(0.);\n          vec4 xR"+p+"C"+d+" = vec4(0.);";for(p=0;p<c;p++)for(var m=0;m<f;m++){if(h+="\n          xR = xRCorner + "+p*s+";\n          xC = xCCorner + "+(d=2*m)*u+";\n        ",1===a){if(d<l&&(h+=i%2==1?"\n                xCOffset = xC + 1;\n                if(xR >= 0 && xR < "+e+" && xCOffset >= 0 && xCOffset < "+n+") {\n                  xTexelR"+p+"C"+d+" = getX(batch, xR, xCOffset, d1);\n                } else {\n                  xTexelR"+p+"C"+d+" = vec4(0.);\n                }\n\n                xCOffset = xC + 1 - 2;\n                if(xR >= 0 && xR < "+e+" && xCOffset >= 0 && xCOffset < "+n+") {\n                  vec4 previous = getX(batch, xR, xCOffset, d1);\n                  xR"+p+"C"+d+" = vec4(previous.zw, xTexelR"+p+"C"+d+".xy);\n                } else {\n                  xR"+p+"C"+d+" = vec4(0, 0, xTexelR"+p+"C"+d+".xy);\n                }\n              ":"\n                if(xR >= 0 && xR < "+e+" && xC >= 0 && xC < "+n+") {\n                  xTexelR"+p+"C"+d+" = getX(batch, xR, xC, d1);\n                } else {\n                  xTexelR"+p+"C"+d+" = vec4(0.);\n                }\n\n                xR"+p+"C"+d+" = xTexelR"+p+"C"+d+";\n              ",d+1<l)){var g=i%2==0?S(u):u;u%2==0&&i%2==1||u%2!=0&&i%2!=1?(h+="\n                  xCOffset = xC + "+i%2+" + "+g+";\n\n                  if(xR >= 0 && xR < "+e+" &&\n                    xCOffset >= 0 && xCOffset < "+n+") {\n                    xTexelR"+p+"C"+(d+2)+" = getX(batch, xR, xCOffset, d1);\n                  }\n                ",1<u&&(h+="\n                    xCOffset -= 2;\n                    if(xR >= 0 && xR < "+e+" &&\n                      xCOffset >= 0 && xCOffset < "+n+") {\n                      xTexelR"+p+"C"+d+" = getX(batch, xR, xCOffset, d1);\n                    } else {\n                      xTexelR"+p+"C"+d+" = vec4(0.);\n                    }\n                  "),h+="\n                  xR"+p+"C"+(d+1)+" = vec4(\n                    xTexelR"+p+"C"+d+".zw, xTexelR"+p+"C"+(d+2)+".xy);\n                "):h+="\n                  xCOffset = xC + "+g+";\n\n                  if(xR >= 0 && xR < "+e+" &&\n                    xCOffset >= 0 && xCOffset < "+n+") {\n                    xTexelR"+p+"C"+(d+2)+" = getX(batch, xR, xCOffset, d1);\n                  }\n\n                  xR"+p+"C"+(d+1)+" = xTexelR"+p+"C"+(d+2)+";\n                "}}else d<l&&(h+="\n              if(xR >= 0 && xR < "+e+") {\n            ",i%2==1?(h+="\n                xCOffset = xC + 1 - "+a+";\n                if(xCOffset >= 0 && xCOffset < "+n+") {\n                  xTexelR"+p+"C"+d+" = getX(batch, xR, xCOffset, d1);\n                } else {\n                  xTexelR"+p+"C"+d+" = vec4(0.);\n                }\n\n                if(xC + 1 >= 0 && xC + 1 < "+n+") {\n                  xTexelR"+p+"C"+(d+2)+" = getX(batch, xR, xC + 1, d1);\n                } else {\n                  xTexelR"+p+"C"+(d+2)+" = vec4(0.);\n                }\n\n                xR"+p+"C"+d+" = vec4(\n                  xTexelR"+p+"C"+d+".zw, xTexelR"+p+"C"+(d+2)+".zw);\n              ",d+1<l&&(h+="\n                  vec4 final = vec4(0.);\n                  xCOffset = xC + 1 + "+a+";\n                  if(xCOffset >= 0 && xCOffset < "+n+") {\n                    final = getX(batch, xR, xCOffset, d1);\n                  }\n                  xR"+p+"C"+(d+1)+" = vec4(xTexelR"+p+"C"+(d+2)+".xy, final.xy);\n                ")):(h+="\n                if(xC >= 0 && xC < "+n+") {\n                  xTexelR"+p+"C"+d+" = getX(batch, xR, xC, d1);\n                } else {\n                  xTexelR"+p+"C"+d+" = vec4(0.);\n                }\n\n                xCOffset = xC + "+a+";\n                if(xCOffset >= 0 && xCOffset < "+n+") {\n                  xTexelR"+p+"C"+(d+2)+" = getX(batch, xR, xCOffset, d1);\n                } else {\n                  xTexelR"+p+"C"+(d+2)+" = vec4(0.);\n                }\n\n                xR"+p+"C"+d+" = vec4(\n                  xTexelR"+p+"C"+d+".xy, xTexelR"+p+"C"+(d+2)+".xy);\n              ",d+1<l&&(h+="\n                  xR"+p+"C"+(d+1)+" = vec4(\n                    xTexelR"+p+"C"+d+".zw, xTexelR"+p+"C"+(d+2)+".zw);\n                ")),h+="}");d<l&&(h+="\n            vec4 wTexelR"+p+"C"+d+" = getW("+p+", "+d+", d1, q);\n            wR"+p+"C"+d+" = vec4(wTexelR"+p+"C"+d+".xz, wTexelR"+p+"C"+d+".xz);\n          ",d+1<l&&(h+="\n              vec4 wTexelR"+p+"C"+(d+1)+" = getW("+p+", "+(d+1)+", d1, q);\n              wR"+p+"C"+(d+1)+" =\n                vec4(wTexelR"+p+"C"+(d+1)+".xz, wTexelR"+p+"C"+(d+1)+".xz);"))}for(p=0;p<c;p++)for(d=0;d<l;d++)h+="result += xR"+p+"C"+d+" * wR"+p+"C"+d+";";this.userCode="\n      const ivec2 strides = ivec2("+o+", "+a+");\n      const ivec2 pads = ivec2("+r+", "+i+");\n\n      void main() {\n\n        ivec4 coords = getOutputCoords();\n        int batch = coords.x;\n        ivec2 xRCCorner = coords.yz * strides - pads;\n        int d2 = coords.w;\n        int d1 = d2;\n        int q = 0;\n        int xRCorner = xRCCorner.x;\n        int xCCorner = xRCCorner.y;\n\n        vec4 result = vec4(0.);\n\n        "+h+"\n\n        setOutput(result);\n      }\n    "},Yn=function(t,e,n,r,i){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];var o=t[0],a=t[1],s=t[2],u=t[3],c=e[0],l=n[0],f=n[1];this.outputShape=[c,l,f,u];var h="bilinear"===r?1:0,p=[a-1+".0",s-1+".0"],d=p[0],m=p[1],g=1<l?[""+(a-1)/(l-1),"(y2-y1) * height_ratio","y1*"+d+" + float(y)*(height_scale)"]:["0.0","0.0","0.5 * (y1+y2) * "+d],y=g[0],v=g[1],b=g[2],w=1<f?[""+(s-1)/(f-1),"(x2-x1) * width_ratio","x1*"+m+" + float(x)*(width_scale)"]:["0.0","0.0","0.5 * (x1+x2) * "+m],_=w[0],x=w[1],E=w[2];this.userCode="\n      const float height_ratio = float("+y+");\n      const float width_ratio = float("+_+");\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int y = coords[1];\n        int x = coords[2];\n        int d = coords[3];\n\n        // get box vals\n        float y1 = getBoxes(b,0);\n        float x1 = getBoxes(b,1);\n        float y2 = getBoxes(b,2);\n        float x2 = getBoxes(b,3);\n\n        // get image in batch index\n        int bInd = round(getBoxInd(b));\n        if(bInd < 0 || bInd >= "+o+") {\n          return;\n        }\n\n        float height_scale = "+v+";\n        float width_scale = "+x+";\n\n        float in_y = "+b+";\n        if( in_y < 0.0 || in_y > "+d+" ) {\n          setOutput(float("+i+"));\n          return;\n        }\n        float in_x = "+E+";\n        if( in_x < 0.0 || in_x > "+m+" ) {\n          setOutput(float("+i+"));\n          return;\n        }\n\n        vec2 sourceFracIndexRC = vec2(in_y,in_x);\n        if("+h+" == 1) {\n          // Compute the four integer indices.\n          ivec2 sourceFloorRC = ivec2(sourceFracIndexRC);\n          ivec2 sourceCeilRC = ivec2(ceil(sourceFracIndexRC));\n\n          float topLeft = getImage(b, sourceFloorRC.x, sourceFloorRC.y, d);\n          float bottomLeft = getImage(b, sourceCeilRC.x, sourceFloorRC.y, d);\n          float topRight = getImage(b, sourceFloorRC.x, sourceCeilRC.y, d);\n          float bottomRight = getImage(b, sourceCeilRC.x, sourceCeilRC.y, d);\n\n          vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);\n\n          float top = topLeft + (topRight - topLeft) * fracRC.y;\n          float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;\n          float newValue = top + (bottom - top) * fracRC.x;\n          setOutput(newValue);\n        } else {\n          // Compute the coordinators of nearest neighbor point.\n          ivec2 sourceNearestRC = ivec2(floor(\n            sourceFracIndexRC + vec2(0.5,0.5)));\n          float newValue = getImage(b, sourceNearestRC.x, sourceNearestRC.y, d);\n          setOutput(newValue);\n        }\n      }\n    "};function Zn(t){this.variableNames=["A"],this.usesPackedTextures=!0,this.outputShape=t,this.userCode="\n      uniform float min;\n      uniform float max;\n\n      void main() {\n        vec4 value = getAAtOutCoords();\n\n        if (hasNaN(value)) {\n          setOutput(value);\n          return;\n        }\n\n        setOutput(clamp(value, vec4(min), vec4(max)));\n      }\n    "}function Jn(t){this.variableNames=["A"],this.outputShape=t,this.userCode="\n      uniform float min;\n      uniform float max;\n\n      void main() {\n        float value = getAAtOutCoords();\n        if (isNaN(value)) {\n          setOutput(value);\n          return;\n        }\n\n        setOutput(clamp(value, min, max));\n      }\n    "}function Qn(t,e,n){this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.usesPackedTextures=!0,this.outputShape=Nn(e,n),this.userCode="\n      uniform float NAN;\n      vec4 binaryOperation(vec4 a, vec4 b) {\n        "+t+"\n      }\n\n      void main() {\n        vec4 a = getAAtOutCoords();\n        vec4 b = getBAtOutCoords();\n        setOutput(binaryOperation(a, b));\n      }\n    "}function tr(t,e,n){this.variableNames=["A","B"],this.outputShape=Nn(e,n),this.userCode="\n      uniform float NAN;\n      float binaryOperation(float a, float b) {\n        "+t+"\n      }\n\n      void main() {\n        float a = getAAtOutCoords();\n        float b = getBAtOutCoords();\n        setOutput(binaryOperation(a, b));\n      }\n    "}function er(){var t,e,n,r,i,o,a,s;return s=2===te.get("WEBGL_VERSION")?(t="#version 300 es",n="out",r=e="in",i="texture",o="outputColor",a="out vec4 outputColor;","\n      #define round(value) newRound(value)\n      int newRound(float value) {\n        return int(floor(value + 0.5));\n      }\n\n      ivec4 newRound(vec4 value) {\n        return ivec4(floor(value + vec4(0.5)));\n      }\n    "):(e="attribute",r=n="varying",i="texture2D",o="gl_FragColor",a=t="","\n      int round(float value) {\n        return int(floor(value + 0.5));\n      }\n\n      ivec4 round(vec4 value) {\n        return ivec4(floor(value + vec4(0.5)));\n      }\n    "),{version:t,attribute:e,varyingVs:n,varyingFs:r,texture2D:i,output:o,defineOutput:a,defineRound:s}}function nr(n,t,r){void 0===r&&(r="index");var i=H(t);return i.map(function(t,e){return"int "+n[e]+" = "+r+" / "+t+"; "+(e===i.length-1?"int "+n[e+1]+" = "+r+" - "+n[e]+" * "+t:"index -= "+n[e]+" * "+t)+";"}).join("")}function rr(t){return 1===t.length?""+t[0]:"vec"+t.length+"("+t.join(",")+")"}function ir(t,e,n,r){var i=[];t.forEach(function(t){var e=L(t.shapeInfo.logicalShape);t.shapeInfo.isUniform?i.push("uniform float "+t.name+(1<e?"["+e+"]":"")+";"):(i.push("uniform sampler2D "+t.name+";"),i.push("uniform int offset"+t.name+";"))});var o,a,s=i.join("\n"),u=t.map(function(t){return function(t,e,n){void 0===n&&(n=!1);var r="";r+=n?ar(t):or(t);var i=t.shapeInfo.logicalShape,o=e.logicalShape;return i.length<=o.length&&(r+=n?function(t,e){var n,r=t.name,i=r.charAt(0).toUpperCase()+r.slice(1),o="get"+i+"AtOutCoords",a=t.shapeInfo.logicalShape.length,s=e.logicalShape.length,u=En(t.shapeInfo.logicalShape,e.logicalShape),c=mr(s),l=s-a,f=["x","y","z","w","u","v"];n=0===a?"":s<2&&1<=u.length?"coords = 0;":u.map(function(t){return"coords."+f[t+l]+" = 0;"}).join("\n");var h="";h=s<2&&0<a?"coords":t.shapeInfo.logicalShape.map(function(t,e){return"coords."+f[e+l]}).join(", ");var p="return outputValue;";if(1===a&&1<s)p="\n      return vec4(outputValue.xy, outputValue.xy);\n    ";else if(0===a&&0<s)p=1===s?"\n        return vec4(outputValue.x, outputValue.x, 0., 0.);\n      ":"\n        return vec4(outputValue.x);\n      ";else if(u.length){var d=a-2,m=a-1;-1<u.indexOf(d)&&-1<u.indexOf(m)?p="return vec4(outputValue.x);":-1<u.indexOf(d)?p="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":-1<u.indexOf(m)&&(p="return vec4(outputValue.xx, outputValue.zz);")}return"\n    vec4 "+o+"() {\n      "+c+" coords = getOutputCoords();\n      "+n+"\n      vec4 outputValue = get"+i+"("+h+");\n      "+p+"\n    }\n  "}(t,e):function(t,e){var n=t.name,r=n.charAt(0).toUpperCase()+n.slice(1),i="get"+r+"AtOutCoords",o=e.texShape,a=t.shapeInfo.texShape,s=t.shapeInfo.logicalShape.length,u=e.logicalShape.length;if(!t.shapeInfo.isUniform&&s===u&&null==t.shapeInfo.flatOffset&&x(a,o))return"\n      float "+i+"() {\n        return sampleTexture("+n+", resultUV);\n      }\n    ";var c=mr(u),l=En(t.shapeInfo.logicalShape,e.logicalShape),f=u-s,h=["x","y","z","w","u","v"];return"\n    float "+i+"() {\n      "+c+" coords = getOutputCoords();\n      "+(0===s?"":u<2&&1<=l.length?"coords = 0;":l.map(function(t){return"coords."+h[t+f]+" = 0;"}).join("\n"))+"\n      return get"+r+"("+(u<2&&0<s?"coords":t.shapeInfo.logicalShape.map(function(t,e){return"coords."+h[e+f]}).join(", "))+");\n    }\n  "}(t,e)),r}(t,e,r)}).join("\n"),c=e.texShape,l=er(),f=function(t){return"\n    float sampleTexture(sampler2D textureSampler, vec2 uv) {\n      return "+t.texture2D+"(textureSampler, uv).r;\n    }\n  "}(l),h=function(t){var e="";return e=te.get("PROD")?"\n      bool isNaN(float val) {\n        return false;\n      }\n\n      bool hasNaN(vec4 values) {\n        return false;\n      }\n    ":"\n      bool isNaN(float val) {\n        return (val < 1.0 || 0.0 < val || val == 0.0) ? false : true;\n      }\n\n      bool hasNaN(vec4 values) {\n        return any(bvec4(\n          isNaN(values.x),\n          isNaN(values.y),\n          isNaN(values.z),\n          isNaN(values.w)\n        ));\n      }\n    ",t.version+"\n    precision highp float;\n    precision highp int;\n    precision highp sampler2D;\n    "+t.varyingFs+" vec2 resultUV;\n    "+t.defineOutput+"\n    const vec2 halfCR = vec2(0.5, 0.5);\n\n    struct ivec5\n    {\n      int x;\n      int y;\n      int z;\n      int w;\n      int u;\n    };\n\n    struct ivec6\n    {\n      int x;\n      int y;\n      int z;\n      int w;\n      int u;\n      int v;\n    };\n\n    "+e+"\n\n    float getNaN(vec4 values) {\n      return dot(vec4(1), values);\n    }\n\n    "+t.defineRound+"\n\n    int imod(int x, int y) {\n      return x - y * (x / y);\n    }\n\n    //Based on the work of Dave Hoskins\n    //https://www.shadertoy.com/view/4djSRW\n    #define HASHSCALE1 443.8975\n    float random(float seed){\n      vec2 p = resultUV * seed;\n      vec3 p3  = fract(vec3(p.xyx) * HASHSCALE1);\n      p3 += dot(p3, p3.yzx + 19.19);\n      return fract((p3.x + p3.y) * p3.z);\n    }\n\n    "+sr+"\n    "+ur+"\n    "+cr+"\n    "+lr+"\n    "+fr+"\n  "}(l);return a=e.isPacked?(o=function(t,e){switch(t.length){case 0:return"\n    int getOutputCoords() {\n      return 0;\n    }\n  ";case 1:return function(t,e){var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];return 1===n[0]?"\n      int getOutputCoords() {\n        return 2 * int(resultUV.x * "+n[1]+".0);\n      }\n    ":1===n[1]?"\n      int getOutputCoords() {\n        return 2 * int(resultUV.y * "+n[0]+".0);\n      }\n    ":"\n    int getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2("+n[0]+", "+n[1]+"));\n      return resTexRC.x * "+n[1]+" + resTexRC.y;\n    }\n  "}(0,e);case 2:return function(t,e){var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];if(x(t,e))return"\n      ivec2 getOutputCoords() {\n        return 2 * ivec2(resultUV.yx * vec2("+n[0]+", "+n[1]+"));\n      }\n    ";var r=Math.ceil(t[1]/2);return"\n    ivec2 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2("+n[0]+", "+n[1]+"));\n\n      int index = resTexRC.x * "+n[1]+" + resTexRC.y;\n      int r = 2 * (index / "+r+");\n      int c = imod(index, "+r+") * 2;\n\n      return ivec2(r, c);\n    }\n  "}(t,e);case 3:return function(t,e){var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)],r=Math.ceil(t[2]/2),i=r*Math.ceil(t[1]/2);return"\n    ivec3 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2("+n[0]+", "+n[1]+"));\n      int index = resTexRC.x * "+n[1]+" + resTexRC.y;\n\n      int b = index / "+i+";\n      index -= b * "+i+";\n\n      int r = 2 * (index / "+r+");\n      int c = imod(index, "+r+") * 2;\n\n      return ivec3(b, r, c);\n    }\n  "}(t,e);default:return function(t,e){for(var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)],r=Math.ceil(t[t.length-1]/2),i=r*Math.ceil(t[t.length-2]/2),o=i,a="",s="b, r, c",u=2;u<t.length-1;u++)a="\n      int b"+u+" = index / "+(o*=t[t.length-u-1])+";\n      index -= b"+u+" * "+o+";\n    "+a,s="b"+u+", "+s;return"\n    ivec"+t.length+" getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2("+n[0]+", "+n[1]+"));\n      int index = resTexRC.x * "+n[1]+" + resTexRC.y;\n\n      "+a+"\n\n      int b = index / "+i+";\n      index -= b * "+i+";\n\n      int r = 2 * (index / "+r+");\n      int c = imod(index, "+r+") * 2;\n\n      return ivec"+t.length+"("+s+");\n    }\n  "}(t,e)}}(e.logicalShape,c),function(t){return"\n    void setOutput(vec4 val) {\n      "+t.output+" = val;\n    }\n  "}(l)):(o=function(t,e){switch(t.length){case 0:return"\n    int getOutputCoords() {\n      return 0;\n    }\n  ";case 1:return function(t,e){return 1===e[0]?"\n      int getOutputCoords() {\n        return int(resultUV.x * "+e[1]+".0);\n      }\n    ":1===e[1]?"\n      int getOutputCoords() {\n        return int(resultUV.y * "+e[0]+".0);\n      }\n    ":"\n    int getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2("+e[0]+", "+e[1]+"));\n      return resTexRC.x * "+e[1]+" + resTexRC.y;\n    }\n  "}(0,e);case 2:return function(t,e){return x(t,e)?"\n      ivec2 getOutputCoords() {\n        return ivec2(resultUV.yx * vec2("+e[0]+", "+e[1]+"));\n      }\n    ":1===t[1]?"\n      ivec2 getOutputCoords() {\n        ivec2 resTexRC = ivec2(resultUV.yx *\n                               vec2("+e[0]+", "+e[1]+"));\n        int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n        return ivec2(index, 0);\n      }\n    ":1===t[0]?"\n      ivec2 getOutputCoords() {\n        ivec2 resTexRC = ivec2(resultUV.yx *\n                               vec2("+e[0]+", "+e[1]+"));\n        int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n        return ivec2(0, index);\n      }\n    ":"\n    ivec2 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2("+e[0]+", "+e[1]+"));\n      int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n      int r = index / "+t[1]+";\n      int c = index - r * "+t[1]+";\n      return ivec2(r, c);\n    }\n  "}(t,e);case 3:return function(t,e){var n=nr(["r","c","d"],t);return"\n    ivec3 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2("+e[0]+", "+e[1]+"));\n      int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n      "+n+"\n      return ivec3(r, c, d);\n    }\n  "}(t,e);case 4:return function(t,e){var n=nr(["r","c","d","d2"],t);return"\n    ivec4 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n        vec2("+e[0]+", "+e[1]+"));\n      int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n      "+n+"\n      return ivec4(r, c, d, d2);\n    }\n  "}(t,e);case 5:return function(t,e){var n=nr(["r","c","d","d2","d3"],t);return"\n    ivec5 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx * vec2("+e[0]+",\n                             "+e[1]+"));\n\n      int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n\n      "+n+"\n\n      ivec5 outShape = ivec5(r, c, d, d2, d3);\n      return outShape;\n    }\n  "}(t,e);case 6:return function(t,e){var n=nr(["r","c","d","d2","d3","d4"],t);return"\n    ivec6 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n        vec2("+e[0]+", "+e[1]+"));\n      int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n\n      "+n+"\n\n      ivec6 result = ivec6(r, c, d, d2, d3, d4);\n      return result;\n    }\n  "}(t,e);default:throw new Error(t.length+"-D output sampling is not yet supported")}}(e.logicalShape,c),function(t){return"\n    void setOutput(float val) {\n      "+t.output+" = vec4(val, 0, 0, 0);\n    }\n  "}(l)),r&&(h+=hr),[h,f,a,s,o,u,n].join("\n")}function or(t){var e=t.shapeInfo.logicalShape;switch(e.length){case 0:return function(t){var e=t.name,n="get"+e.charAt(0).toUpperCase()+e.slice(1);if(t.shapeInfo.isUniform)return"float "+n+"() {return "+e+";}";var r=t.shapeInfo.texShape,i=r[0],o=r[1];if(1===i&&1===o)return"\n      float "+n+"() {\n        return sampleTexture("+e+", halfCR);\n      }\n    ";var a=t.shapeInfo.texShape;return"\n    float "+n+"() {\n      vec2 uv = uvFromFlat("+a[0]+", "+a[1]+", "+pr(e)+");\n      return sampleTexture("+e+", uv);\n    }\n  "}(t);case 1:return function(t){var e=t.name,n="get"+e.charAt(0).toUpperCase()+e.slice(1);if(t.shapeInfo.isUniform)return"\n      float "+n+"(int index) {\n        "+dr(t)+"\n      }\n    ";var r=t.shapeInfo.texShape,i=r[0],o=r[1];if(1===o&&1===i)return"\n      float "+n+"(int index) {\n        return sampleTexture("+e+", halfCR);\n      }\n    ";var a=pr(e);return 1===o?"\n      float "+n+"(int index) {\n        vec2 uv = vec2(0.5, (float(index + "+a+") + 0.5) / "+i+".0);\n        return sampleTexture("+e+", uv);\n      }\n    ":1===i?"\n      float "+n+"(int index) {\n        vec2 uv = vec2((float(index + "+a+") + 0.5) / "+o+".0, 0.5);\n        return sampleTexture("+e+", uv);\n      }\n    ":"\n    float "+n+"(int index) {\n      vec2 uv = uvFromFlat("+i+", "+o+", index + "+a+");\n      return sampleTexture("+e+", uv);\n    }\n  "}(t);case 2:return function(t){var e=t.shapeInfo.logicalShape,n=t.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),i=t.shapeInfo.texShape;if(null!=i&&x(e,i)){var o=i[0];return"\n    float "+r+"(int row, int col) {\n      vec2 uv = (vec2(col, row) + halfCR) / vec2("+i[1]+".0, "+o+".0);\n      return sampleTexture("+n+", uv);\n    }\n  "}var a=O(e),s=a.newShape,u=a.keptDims,c=s;if(c.length<e.length)return"\n      "+or(gr(t,c))+"\n      float "+r+"(int row, int col) {\n        return "+r+"("+yr(["row","col"],u)+");\n      }\n    ";if(t.shapeInfo.isUniform)return"\n      float "+r+"(int row, int col) {\n        int index = round(dot(vec2(row, col), vec2("+e[1]+", 1)));\n        "+dr(t)+"\n      }\n    ";var l=i[0],f=i[1],h=pr(n);return 1===f?"\n    float "+r+"(int row, int col) {\n      float index = dot(vec3(row, col, "+h+"), vec3("+e[1]+", 1, 1));\n      vec2 uv = vec2(0.5, (index + 0.5) / "+l+".0);\n      return sampleTexture("+n+", uv);\n    }\n  ":1===l?"\n    float "+r+"(int row, int col) {\n      float index = dot(vec3(row, col, "+h+"), vec3("+e[1]+", 1, 1));\n      vec2 uv = vec2((index + 0.5) / "+f+".0, 0.5);\n      return sampleTexture("+n+", uv);\n    }\n  ":"\n  float "+r+"(int row, int col) {\n    // Explicitly use integer operations as dot() only works on floats.\n    int index = row * "+e[1]+" + col + "+h+";\n    vec2 uv = uvFromFlat("+l+", "+f+", index);\n    return sampleTexture("+n+", uv);\n  }\n"}(t);case 3:return function(t){var e=t.shapeInfo.logicalShape,n=t.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),i=e[1]*e[2],o=e[2],a=O(e),s=a.newShape,u=a.keptDims,c=s;if(c.length<e.length)return"\n        "+or(gr(t,c))+"\n        float "+r+"(int row, int col, int depth) {\n          return "+r+"("+yr(["row","col","depth"],u)+");\n        }\n      ";if(t.shapeInfo.isUniform)return"\n      float "+r+"(int row, int col, int depth) {\n        int index = round(dot(vec3(row, col, depth),\n                          vec3("+i+", "+o+", 1)));\n        "+dr(t)+"\n      }\n    ";var l=t.shapeInfo.texShape,f=l[0],h=l[1],p=t.shapeInfo.flatOffset;return h===i&&null==p?"\n        float "+r+"(int row, int col, int depth) {\n          float texR = float(row);\n          float texC = dot(vec2(col, depth), vec2("+o+", 1));\n          vec2 uv = (vec2(texC, texR) + halfCR) /\n                     vec2("+h+".0, "+f+".0);\n          return sampleTexture("+n+", uv);\n        }\n      ":h===o&&null==p?"\n    float "+r+"(int row, int col, int depth) {\n      float texR = dot(vec2(row, col), vec2("+e[1]+", 1));\n      float texC = float(depth);\n      vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+h+".0, "+f+".0);\n      return sampleTexture("+n+", uv);\n    }\n  ":"\n      float "+r+"(int row, int col, int depth) {\n        // Explicitly use integer operations as dot() only works on floats.\n        int index = row * "+i+" + col * "+o+" + depth + "+pr(n)+";\n        vec2 uv = uvFromFlat("+f+", "+h+", index);\n        return sampleTexture("+n+", uv);\n      }\n  "}(t);case 4:return function(t){var e=t.shapeInfo.logicalShape,n=t.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),i=e[3],o=e[2]*i,a=e[1]*o,s=O(e),u=s.newShape,c=s.keptDims;if(u.length<e.length)return"\n      "+or(gr(t,u))+"\n      float "+r+"(int row, int col, int depth, int depth2) {\n        return "+r+"("+yr(["row","col","depth","depth2"],c)+");\n      }\n    ";if(t.shapeInfo.isUniform)return"\n      float "+r+"(int row, int col, int depth, int depth2) {\n        int index = round(dot(vec4(row, col, depth, depth2),\n                          vec4("+a+", "+o+", "+i+", 1)));\n        "+dr(t)+"\n      }\n    ";var l=t.shapeInfo.flatOffset,f=t.shapeInfo.texShape,h=f[0],p=f[1];return p===a&&null==l?"\n      float "+r+"(int row, int col, int depth, int depth2) {\n        float texR = float(row);\n        float texC =\n            dot(vec3(col, depth, depth2),\n                vec3("+o+", "+i+", 1));\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                   vec2("+p+".0, "+h+".0);\n        return sampleTexture("+n+", uv);\n      }\n    ":p===i&&null==l?"\n      float "+r+"(int row, int col, int depth, int depth2) {\n        float texR = dot(vec3(row, col, depth),\n                         vec3("+e[1]*e[2]+", "+e[2]+", 1));\n        float texC = float(depth2);\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                  vec2("+p+".0, "+h+".0);\n        return sampleTexture("+n+", uv);\n      }\n    ":"\n    float "+r+"(int row, int col, int depth, int depth2) {\n      // Explicitly use integer operations as dot() only works on floats.\n      int index = row * "+a+" + col * "+o+" +\n          depth * "+i+" + depth2;\n      vec2 uv = uvFromFlat("+h+", "+p+", index + "+pr(n)+");\n      return sampleTexture("+n+", uv);\n    }\n  "}(t);case 5:return function(t){var e=t.shapeInfo.logicalShape,n=t.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),i=e[4],o=e[3]*i,a=e[2]*o,s=e[1]*a,u=O(e),c=u.newShape,l=u.keptDims;if(c.length<e.length)return"\n      "+or(gr(t,c))+"\n      float "+r+"(int row, int col, int depth, int depth2, int depth3) {\n        return "+r+"("+yr(["row","col","depth","depth2","depth3"],l)+");\n      }\n    ";if(t.shapeInfo.isUniform)return"\n      float "+r+"(int row, int col, int depth, int depth2, int depth3) {\n        float index = dot(\n          vec4(row, col, depth, depth2),\n          vec4("+s+", "+a+", "+o+", "+i+")) +\n          depth3;\n        "+dr(t)+"\n      }\n    ";var f=t.shapeInfo.flatOffset,h=t.shapeInfo.texShape,p=h[0],d=h[1];return d===s&&null==f?"\n      float "+r+"(int row, int col, int depth, int depth2, int depth3) {\n        int texR = row;\n        float texC = dot(vec4(col, depth, depth2, depth3),\n                         vec4("+a+", "+o+", "+i+", 1));\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                   vec2("+d+".0, "+p+".0);\n        return sampleTexture("+n+", uv);\n      }\n    ":d===i&&null==f?"\n      float "+r+"(int row, int col, int depth, int depth2, int depth3) {\n        float texR = dot(\n          vec4(row, col, depth, depth2),\n          vec4("+e[1]*e[2]*e[3]+",\n               "+e[2]*e[3]+", "+e[3]+", 1));\n        int texC = depth3;\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                  vec2("+d+".0, "+p+".0);\n        return sampleTexture("+n+", uv);\n      }\n    ":"\n    float "+r+"(int row, int col, int depth, int depth2, int depth3) {\n      // Explicitly use integer operations as dot() only works on floats.\n      int index = row * "+s+" + col * "+a+" + depth * "+o+" +\n          depth2 * "+i+" + depth3 + "+pr(n)+";\n      vec2 uv = uvFromFlat("+p+", "+d+", index);\n      return sampleTexture("+n+", uv);\n    }\n  "}(t);case 6:return function(t){var e=t.shapeInfo.logicalShape,n=t.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),i=O(e),o=i.newShape,a=i.keptDims;if(o.length<e.length)return"\n      "+or(gr(t,o))+"\n      float "+r+"(int row, int col, int depth,\n                    int depth2, int depth3, int depth4) {\n        return "+r+"("+yr(["row","col","depth","depth2","depth3","depth4"],a)+");\n      }\n    ";var s=e[5],u=e[4]*s,c=e[3]*u,l=e[2]*c,f=e[1]*l;if(t.shapeInfo.isUniform)return"\n      float "+r+"(int row, int col, int depth,\n                  int depth2, int depth3, int depth4) {\n        int index = round(dot(\n          vec4(row, col, depth, depth2),\n          vec4("+f+", "+l+", "+c+", "+u+")) +\n          dot(\n            vec2(depth3, depth4),\n            vec2("+s+", 1)));\n        "+dr(t)+"\n      }\n    ";var h=t.shapeInfo.flatOffset,p=t.shapeInfo.texShape,d=p[0],m=p[1];return m===f&&null==h?"\n      float "+r+"(int row, int col, int depth,\n                    int depth2, int depth3, int depth4) {\n        int texR = row;\n        float texC = dot(vec4(col, depth, depth2, depth3),\n          vec4("+l+", "+c+", "+u+", "+s+")) +\n               float(depth4);\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                   vec2("+m+".0, "+d+".0);\n        return sampleTexture("+n+", uv);\n      }\n    ":m===s&&null==h?"\n      float "+r+"(int row, int col, int depth,\n                    int depth2, int depth3, int depth4) {\n        float texR = dot(vec4(row, col, depth, depth2),\n          vec4("+e[1]*e[2]*e[3]*e[4]+",\n               "+e[2]*e[3]*e[4]+",\n               "+e[3]*e[4]+",\n               "+e[4]+")) + float(depth3);\n        int texC = depth4;\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                  vec2("+m+".0, "+d+".0);\n        return sampleTexture("+n+", uv);\n      }\n    ":"\n    float "+r+"(int row, int col, int depth,\n                  int depth2, int depth3, int depth4) {\n      // Explicitly use integer operations as dot() only works on floats.\n      int index = row * "+f+" + col * "+l+" + depth * "+c+" +\n          depth2 * "+u+" + depth3 * "+s+" + depth4 + "+pr(n)+";\n      vec2 uv = uvFromFlat("+d+", "+m+", index);\n      return sampleTexture("+n+", uv);\n    }\n  "}(t);default:throw new Error(e.length+"-D input sampling is not yet supported")}}function ar(t){switch(t.shapeInfo.logicalShape.length){case 0:return function(t){var e=t.name;return"\n    vec4 get"+e.charAt(0).toUpperCase()+e.slice(1)+"() {\n      return "+er().texture2D+"("+e+", halfCR);\n    }\n  "}(t);case 1:return function(t){var e=t.name,n="get"+e.charAt(0).toUpperCase()+e.slice(1),r=t.shapeInfo.texShape,i=[Math.ceil(r[0]/2),Math.ceil(r[1]/2)],o=er();return"\n    vec4 "+n+"(int index) {\n      vec2 uv = packedUVfrom1D(\n        "+i[0]+", "+i[1]+", index);\n      return "+o.texture2D+"("+e+", uv);\n    }\n  "}(t);case 2:return function(t){var e=t.shapeInfo.logicalShape,n=t.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),i=t.shapeInfo.texShape,o=i[0],a=i[1],s=er();if(null!=i&&x(e,i))return"\n      vec4 "+r+"(int row, int col) {\n        vec2 uv = (vec2(col, row) + halfCR) / vec2("+a+".0, "+o+".0);\n\n        return "+s.texture2D+"("+n+", uv);\n      }\n    ";var u=[Math.ceil(i[0]/2),Math.ceil(i[1]/2)];return"\n    vec4 "+r+"(int row, int col) {\n      vec2 uv = packedUVfrom2D("+Math.ceil(e[1]/2)+", "+u[0]+", "+u[1]+", row, col);\n      return "+s.texture2D+"("+n+", uv);\n    }\n  "}(t);case 3:return function(t){var e=t.shapeInfo.logicalShape,n=t.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),i=t.shapeInfo.texShape,o=[Math.ceil(i[0]/2),Math.ceil(i[1]/2)];if(1===e[0])return"\n        "+ar(gr(t,e.slice(1)))+"\n        vec4 "+r+"(int b, int row, int col) {\n          return "+r+"("+yr(["b","row","col"],[1,2])+");\n        }\n      ";var a=o[0],s=o[1],u=Math.ceil(e[2]/2);return"\n    vec4 "+r+"(int b, int row, int col) {\n      vec2 uv = packedUVfrom3D(\n        "+a+", "+s+", "+u*Math.ceil(e[1]/2)+", "+u+", b, row, col);\n      return "+er().texture2D+"("+n+", uv);\n    }\n  "}(t);default:return function(t){for(var e=t.shapeInfo.logicalShape,n=e.length,r=t.name,i="get"+r.charAt(0).toUpperCase()+r.slice(1),o=t.shapeInfo.texShape,a=[Math.ceil(o[0]/2),Math.ceil(o[1]/2)],s=a[0],u=a[1],c=Math.ceil(e[n-1]/2),l=c*Math.ceil(e[n-2]/2),f="int b, int row, int col",h="b * "+l+" + (row / 2) * "+c+" + (col / 2)",p=2;p<n-1;p++)f="int b"+p+", "+f,h="b"+p+" * "+(l*=e[n-p-1])+" + "+h;return"\n    vec4 "+i+"("+f+") {\n      int index = "+h+";\n      int texR = index / "+u+";\n      int texC = index - texR * "+u+";\n      vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+u+", "+s+");\n      return "+er().texture2D+"("+r+", uv);\n    }\n  "}(t)}}var sr="\nvec2 uvFromFlat(int texNumR, int texNumC, int index) {\n  int texR = index / texNumC;\n  int texC = index - texR * texNumC;\n  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\nvec2 packedUVfrom1D(int texNumR, int texNumC, int index) {\n  int texelIndex = index / 2;\n  int texR = texelIndex / texNumC;\n  int texC = texelIndex - texR * texNumC;\n  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",ur="\nvec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR,\n  int texNumC, int row, int col) {\n  int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);\n  int texR = texelIndex / texNumC;\n  int texC = texelIndex - texR * texNumC;\n  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",cr="\nvec2 packedUVfrom3D(int texNumR, int texNumC,\n    int texelsInBatch, int texelsInLogicalRow, int b,\n    int row, int col) {\n  int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);\n  int texR = index / texNumC;\n  int texC = index - texR * texNumC;\n  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",lr="\nvec2 UVfrom5D(int texNumR, int texNumC, int stride0,\n    int stride1, int stride2, int stride3, int row, int col, int depth,\n    int depth2, int depth3) {\n  // Explicitly use integer operations as dot() only works on floats.\n  int index = row * stride0 + col * stride1 +\n              depth * stride2 + depth2 * stride3 + depth3;\n  int texR = index / texNumC;\n  int texC = index - texR * texNumC;\n  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",fr="\nvec2 UVfrom6D(int texNumR, int texNumC, int stride0,\n    int stride1, int stride2, int stride3, int stride4,\n    int row, int col, int depth, int depth2, int depth3, int depth4) {\n  // Explicitly use integer operations as dot() only works on floats.\n  int index = row * stride0 + col * stride1 + depth * stride2 + depth2 *\n    stride3 + depth3 * stride4 + depth4;\n  int texR = index / texNumC;\n  int texC = index - texR * texNumC;\n  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",hr="\n  float getChannel(vec4 frag, vec2 innerDims) {\n    vec2 modCoord = mod(innerDims, 2.);\n    return modCoord.x == 0. ?\n      (modCoord.y == 0. ? frag.r : frag.g) :\n      (modCoord.y == 0. ? frag.b : frag.a);\n  }\n  float getChannel(vec4 frag, int dim) {\n    float modCoord = mod(float(dim), 2.);\n    return modCoord == 0. ? frag.r : frag.g;\n  }\n";function pr(t){return"offset"+t}function dr(t){var e=t.name,n=L(t.shapeInfo.logicalShape);return 1===n?"return "+e+";":"\n    for (int i = 0; i < "+n+"; i++) {\n      if (i == index) {\n        return "+e+"[i];\n      }\n    }\n  "}function mr(t){if(t<=1)return"int";if(2===t)return"ivec2";if(3===t)return"ivec3";if(4===t)return"ivec4";if(5===t)return"ivec5";if(6===t)return"ivec6";throw Error("GPU for rank "+t+" is not yet supported")}function gr(t,e){var n=JSON.parse(JSON.stringify(t));return n.shapeInfo.logicalShape=e,n}function yr(e,t){return t.map(function(t){return e[t]}).join(", ")}var vr=function(t,e,n){this.variableNames=["x"];var r=(this.outputShape=t).length,i=t[t.length-1],o=n?"<":">";this.userCode="\n      int getIndex(int i) {\n        "+(n?"return "+i+" -i - 1;":"return i;")+"\n      }\n\n      void main() {\n        "+mr(r)+" coords = getOutputCoords();\n        int end = "+br(r,"coords")+";\n        float val = 0.0;\n        for (int i = "+i+" - 1; i >= 0; i -= 1) {\n          int idx = getIndex(i);\n          if (idx "+o+" end) {\n            continue;\n          }\n          if (idx == end && "+e+") {\n            continue;\n          }\n          "+br(r,"coords")+" = idx;\n          val += getX("+function(t,e){if(1===t)return""+e;if(2===t)return e+".x, "+e+".y";if(3===t)return e+".x, "+e+".y, "+e+".z";if(4===t)return e+".x, "+e+".y, "+e+".z, "+e+".w";throw Error("Cumulative sum for rank "+t+" is not yet supported")}(r,"coords")+");\n        }\n        setOutput(val);\n      }\n    "};function br(t,e){if(1===t)return""+e;if(2===t)return e+".y";if(3===t)return e+".z";if(4===t)return e+".w";throw Error("Cumulative sum for rank "+t+" is not yet supported")}var wr=(Or.prototype.getHeightCoordString=function(){return"NHWC"===this.dataFormat?"coords[1]":"coords[2]"},Or.prototype.getWidthCoordString=function(){return"NHWC"===this.dataFormat?"coords[2]":"coords[3]"},Or.prototype.getDepthCoordString=function(){return"NHWC"===this.dataFormat?"coords[3]":"coords[1]"},Or.prototype.getOutputDepthSize=function(){return"NHWC"===this.dataFormat?this.outputShape[3]:this.outputShape[1]},Or.prototype.getInputSamplingString=function(){return"NHWC"===this.dataFormat?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"},Or),_r=function(t){this.variableNames=["A"];var e=er();this.outputShape=t,this.userCode="\n      const float FLOAT_MAX = 1.70141184e38;\n      const float FLOAT_MIN = 1.17549435e-38;\n\n      lowp vec4 encode_float(highp float v) {\n        if (isNaN(v)) {\n          return vec4(255, 255, 255, 255);\n        }\n\n        highp float av = abs(v);\n\n        if(av < FLOAT_MIN) {\n          return vec4(0.0, 0.0, 0.0, 0.0);\n        } else if(v > FLOAT_MAX) {\n          return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;\n        } else if(v < -FLOAT_MAX) {\n          return vec4(0.0, 0.0,  128.0, 255.0) / 255.0;\n        }\n\n        highp vec4 c = vec4(0,0,0,0);\n\n        highp float e = floor(log2(av));\n        highp float m = exp2(fract(log2(av))) - 1.0;\n\n        c[2] = floor(128.0 * m);\n        m -= c[2] / 128.0;\n        c[1] = floor(32768.0 * m);\n        m -= c[1] / 32768.0;\n        c[0] = floor(8388608.0 * m);\n\n        highp float ebias = e + 127.0;\n        c[3] = floor(ebias / 2.0);\n        ebias -= c[3] * 2.0;\n        c[2] += floor(ebias) * 128.0;\n\n        c[3] += 128.0 * step(0.0, -v);\n\n        return c / 255.0;\n      }\n\n      void main() {\n        float x = getAAtOutCoords();\n        "+e.output+" = encode_float(x);\n      }\n    "},xr="return real * expR - imag * expI;",Er="return real * expI + imag * expR;",Sr=function(t,e,n){this.variableNames=["real","imag"];var r=e[1];this.outputShape=e;var i=n?"2.0 * "+Math.PI:"-2.0 * "+Math.PI,o=n?r+".0":"1.0";this.userCode="\n      const float exponentMultiplier = "+i+";\n\n      float unaryOpComplex(float real, float expR, float imag, float expI) {\n        "+t+"\n      }\n\n      float mulMatDFT(int batch, int index) {\n        float indexRatio = float(index) / float("+r+");\n        float exponentMultiplierTimesIndexRatio =\n            exponentMultiplier * indexRatio;\n\n        float result = 0.0;\n\n        for (int i = 0; i < "+r+"; i++) {\n          // x = (-2|2 * PI / N) * index * i;\n          float x = exponentMultiplierTimesIndexRatio * float(i);\n          float expR = cos(x);\n          float expI = sin(x);\n          float real = getReal(batch, i);\n          float imag = getImag(batch, i);\n\n          result +=\n              unaryOpComplex(real, expR, imag, expI) / "+o+";\n        }\n\n        return result;\n      }\n\n      void main() {\n        ivec2 coords = getOutputCoords();\n        setOutput(mulMatDFT(coords[0], coords[1]));\n      }\n    "},Nr=function(t){this.variableNames=["A"];var e=er(),n=t[0],r=t[1];this.outputShape=t,this.userCode="\n      void main() {\n        ivec3 coords = getOutputCoords();\n        int texR = coords[0];\n        int texC = coords[1];\n        int depth = coords[2];\n        vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+r+".0, "+n+".0);\n\n        vec4 values = "+e.texture2D+"(A, uv);\n        float value;\n        if (depth == 0) {\n          value = values.r;\n        } else if (depth == 1) {\n          value = values.g;\n        } else if (depth == 2) {\n          value = values.b;\n        } else if (depth == 3) {\n          value = values.a;\n        }\n\n        setOutput(floor(value * 255.0 + 0.5));\n      }\n    "},Ir=function(t,e,n){this.variableNames=["A","indices"];var r=t.slice();r[n]=e,this.outputShape=r,this.rank=r.length;var i=mr(this.rank),o=function(t,e){var n=t.length;if(4<n)throw Error("Gather for rank "+n+" is not yet supported");if(1===n)return"int(getIndices(resRC))";for(var r=["resRC.x","resRC.y","resRC.z","resRC.w"],i=[],o=0;o<t.length;o++)o===e?i.push("int(getIndices("+r[o]+"))"):i.push(""+r[o]);return i.join()}(t,n);this.userCode="\n      void main() {\n        "+i+" resRC = getOutputCoords();\n        setOutput(getA("+o+"));\n      }\n    "};function Or(t,e,n){this.variableNames=["x"],this.outputShape=[],this.outputShape=t,this.blockSize=e,this.dataFormat=n,this.userCode="\n    void main() {\n      ivec4 coords = getOutputCoords();\n      int b = coords[0];\n      int h = "+this.getHeightCoordString()+";\n      int w = "+this.getWidthCoordString()+";\n      int d = "+this.getDepthCoordString()+";\n\n      int in_h = h / "+e+";\n      int offset_h = imod(h, "+e+");\n      int in_w = w / "+e+";\n      int offset_w = imod(w, "+e+");\n      int offset_d = (offset_h * "+e+" + offset_w) *\n        "+this.getOutputDepthSize()+";\n      int in_d = d + offset_d;\n\n      float result = "+this.getInputSamplingString()+";\n      setOutput(result);\n    }\n  "}var kr,Ar,Cr,Pr,Tr=function(t,e,n){this.sliceDim=t,this.strides=e,this.variableNames=["x","indices"],this.outputShape=n;var r=mr(e.length),i=mr(n.length),o=1<this.sliceDim?"strides[j]":"strides";this.userCode="\n        "+r+" strides = "+r+"("+this.strides+");\n         void main() {\n          "+i+" coords = getOutputCoords();\n          int flattenIndex = 0;\n          for (int j = 0; j < "+this.sliceDim+"; j++) {\n            int index = round(getIndices(coords[0], j));\n            flattenIndex += index * "+o+";\n          }\n          setOutput(getX(flattenIndex, coords[1]));\n        }\n      "};function Mr(t,e){return[e,t]}function Rr(t,e){return t*e}function Dr(t,e,n){var r=function(t,e){if(t%e!=0)throw new Error("unpackedSize ("+t+") must be a multiple of "+e);return t/e}(t.length,n);if(e.length<r)throw new Error("matrix length ("+e.length+") must be >= "+r);for(var i=0,o=0;o<t.length;o+=n)e[i++]=t[o]}function jr(t,e){return[Math.max(1,Math.ceil(e/2)),Math.max(1,Math.ceil(t/2))]}function Br(t,e){var n=jr(t,e);return n[0]*n[1]*4}function Lr(t,e,n,r,i){var o=n*r;if(i.length<o)throw new Error("matrix length ("+i.length+") must be >= "+o);for(var a=r%2==1,s=n%2==1,u=Math.floor(r/2),c=Math.floor(n/2),l=Math.ceil(r/2),f=l*Math.ceil(n/2),h=S(n)*S(r),p=0;p<e;p++){for(var d=p*n*r,m=p*h,g=a?4:0,y=r+(a?1:0),v=m,b=d,w=d+r,_=0;_<c;++_){for(var x=0;x<u;++x)i[b++]=t[v++],i[b++]=t[v++],i[w++]=t[v++],i[w++]=t[v++];v+=g,b+=y,w+=y}if(a){v=m+4*(l-1);var E=d+r-1;for(g=4*l,y=2*r,_=0;_<c;++_)i[E]=t[v],i[E+r]=t[v+2],v+=g,E+=y}if(s){for(v=m+4*(f-l),E=d+(n-1)*r,x=0;x<u;++x)i[E++]=t[v++],i[E++]=t[v++],v+=2;a&&(i[d+n*r-1]=t[v])}}return i}function Fr(t,e){var n=e();return Vr(t),n}(Pr=kr||(kr={}))[Pr.RENDER=0]="RENDER",Pr[Pr.UPLOAD=1]="UPLOAD",Pr[Pr.PIXELS=2]="PIXELS",Pr[Pr.DOWNLOAD=3]="DOWNLOAD",(Cr=Ar||(Ar={}))[Cr.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",Cr[Cr.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",Cr[Cr.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",Cr[Cr.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32";var zr=!(Cr[Cr.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16");function Ur(t){zr=t}function Vr(t){if(zr){var e=t.getError();if(e!==t.NO_ERROR)throw new Error("WebGL Error: "+qr(t,e))}}function Wr(t){return!!(te.get("WEBGL_RENDER_FLOAT32_ENABLED")||0===t||5.96e-8<Math.abs(t)&&Math.abs(t)<65504)}function qr(t,e){switch(e){case t.NO_ERROR:return"NO_ERROR";case t.INVALID_ENUM:return"INVALID_ENUM";case t.INVALID_VALUE:return"INVALID_VALUE";case t.INVALID_OPERATION:return"INVALID_OPERATION";case t.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case t.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case t.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return"Unknown error code "+e}}function Hr(t,e){return pi(t,function(){return t.getExtension(e)},'Extension "'+e+'" not supported on this browser.')}function $r(t,e){var n=pi(t,function(){return t.createShader(t.VERTEX_SHADER)},"Unable to create vertex WebGLShader.");if(Fr(t,function(){return t.shaderSource(n,e)}),Fr(t,function(){return t.compileShader(n)}),!1===t.getShaderParameter(n,t.COMPILE_STATUS))throw console.log(t.getShaderInfoLog(n)),new Error("Failed to compile vertex shader.");return n}function Gr(t,e){var n=pi(t,function(){return t.createShader(t.FRAGMENT_SHADER)},"Unable to create fragment WebGLShader.");if(Fr(t,function(){return t.shaderSource(n,e)}),Fr(t,function(){return t.compileShader(n)}),!1===t.getShaderParameter(n,t.COMPILE_STATUS))throw function(t,e){var n=Kr.exec(e);if(null==n)return console.log("Couldn't parse line number in error: "+e),console.log(t);for(var r=+n[1],i=t.split("\n"),o=i.length.toString().length+2,a=i.map(function(t,e){return w((e+1).toString(),o)+t}),s=0,u=0;u<a.length;u++)s=Math.max(a[u].length,s);var c=a.slice(0,r-1),l=a.slice(r-1,r),f=a.slice(r);console.log(c.join("\n")),console.log(e.split("\n")[0]),console.log("%c "+w(l[0],s),"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(f.join("\n"))}(e,t.getShaderInfoLog(n)),new Error("Failed to compile fragment shader.");return n}var Kr=/ERROR: [0-9]+:([0-9]+):/g;function Xr(t){return pi(t,function(){return t.createProgram()},"Unable to create WebGLProgram.")}function Yr(t,e){if(Fr(t,function(){return t.linkProgram(e)}),!1===t.getProgramParameter(e,t.LINK_STATUS))throw console.log(t.getProgramInfoLog(e)),new Error("Failed to link vertex and fragment shaders.")}function Zr(t,e){if(Fr(t,function(){return t.validateProgram(e)}),!1===t.getProgramParameter(e,t.VALIDATE_STATUS))throw console.log(t.getProgramInfoLog(e)),new Error("Shader program validation failed.")}function Jr(t,e){var n=pi(t,function(){return t.createBuffer()},"Unable to create WebGLBuffer");return Fr(t,function(){return t.bindBuffer(t.ARRAY_BUFFER,n)}),Fr(t,function(){return t.bufferData(t.ARRAY_BUFFER,e,t.STATIC_DRAW)}),n}function Qr(t,e){var n=pi(t,function(){return t.createBuffer()},"Unable to create WebGLBuffer");return Fr(t,function(){return t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n)}),Fr(t,function(){return t.bufferData(t.ELEMENT_ARRAY_BUFFER,e,t.STATIC_DRAW)}),n}function ti(){return 2===te.get("WEBGL_VERSION")?1:4}function ei(t){return pi(t,function(){return t.createTexture()},"Unable to create WebGLTexture.")}function ni(t,e){var n=te.get("WEBGL_MAX_TEXTURE_SIZE");if(t<=0||e<=0){var r="["+t+"x"+e+"]";throw new Error("Requested texture size "+r+" is invalid.")}if(n<t||n<e)throw r="["+t+"x"+e+"]",new Error("Requested texture size "+r+" greater than WebGL maximum on this browser / GPU ["+n+"x"+n+"].")}function ri(t){return pi(t,function(){return t.createFramebuffer()},"Unable to create WebGLFramebuffer.")}function ii(t,e,n,r,i,o,a){var s=t.getAttribLocation(e,n);return-1!==s&&(Fr(t,function(){return t.bindBuffer(t.ARRAY_BUFFER,r)}),Fr(t,function(){return t.vertexAttribPointer(s,i,t.FLOAT,!1,o,a)}),Fr(t,function(){return t.enableVertexAttribArray(s)}),!0)}function oi(t,e,n){di(t,n),Fr(t,function(){return t.activeTexture(t.TEXTURE0+n)}),Fr(t,function(){return t.bindTexture(t.TEXTURE_2D,e)})}function ai(t,e,n){return pi(t,function(){return t.getUniformLocation(e,n)},'uniform "'+n+'" not present in program.')}function si(t,e,n){return t.getUniformLocation(e,n)}function ui(t,e,n,r,i){Fr(t,function(){return oi(t,n,i)}),Fr(t,function(){return t.uniform1i(r,i)})}function ci(t,e,n){Fr(t,function(){return t.bindFramebuffer(t.FRAMEBUFFER,n)}),Fr(t,function(){return t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)})}function li(t,e){Fr(t,function(){return t.bindFramebuffer(t.FRAMEBUFFER,e)}),Fr(t,function(){return t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,null,0)})}function fi(t){var e=t.checkFramebufferStatus(t.FRAMEBUFFER);if(e!==t.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+hi(t,e))}function hi(t,e){switch(e){case t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case t.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return"unknown error "+e}}function pi(t,e,n){var r=Fr(t,function(){return e()});if(null==r)throw new Error(n);return r}function di(t,e){var n=t.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,r=e+t.TEXTURE0;if(r<t.TEXTURE0||n<r)throw new Error("textureUnit must be in [gl.TEXTURE0, gl.TEXTURE"+n+"].")}function mi(t,e){return void 0===e&&(e=2),L(t.slice(0,t.length-e))}function gi(t){if(0===t.length)throw Error("Cannot get rows and columns of an empty shape array.");return[1<t.length?t[t.length-2]:1,t[t.length-1]]}function yi(n,t){var e;void 0===t&&(t=!1);var r=te.get("WEBGL_MAX_TEXTURE_SIZE");if(t&&(r*=2,1===(n=n.map(function(t,e){return e>=n.length-2?S(n[e]):n[e]})).length&&(n=[2,n[0]])),2!==n.length){var i=O(n);n=i.newShape}var o=L(n);if(n.length<=1&&o<=r)return[1,o];if(2===n.length&&n[0]<=r&&n[1]<=r)return n;if(3===n.length&&n[0]*n[1]<=r&&n[2]<=r)return[n[0]*n[1],n[2]];if(3===n.length&&n[0]<=r&&n[1]*n[2]<=r)return[n[0],n[1]*n[2]];if(4===n.length&&n[0]*n[1]*n[2]<=r&&n[3]<=r)return[n[0]*n[1]*n[2],n[3]];if(4===n.length&&n[0]<=r&&n[1]*n[2]*n[3]<=r)return[n[0],n[1]*n[2]*n[3]];if(t){var a=mi(n),s=2,u=2;return n.length&&(s=(e=gi(n))[0],u=e[1]),b(o=a*(s/2)*(u/2)).map(function(t){return 2*t})}return b(o)}function vi(t){return t%2==0}function bi(t,e){if(x(t=t.slice(-2),e=e.slice(-2)))return!0;if(!t.length||!e.length)return!0;if(0===t[0]||0===t[1]||0===e[0]||0===e[1])return!0;if(t.length!==e.length){var n=t.slice(-1)[0],r=e.slice(-1)[0];if(n===r)return!0;if(vi(n)&&vi(r)&&(1===t[0]||1===e[0]))return!0}return t[1]===e[1]&&vi(t[0])&&vi(e[0])}var wi=Object.freeze({callAndCheck:Fr,enableDebugWebGLErrorChecking:Ur,checkWebGLError:Vr,canBeRepresented:Wr,getWebGLErrorMessage:qr,getExtensionOrThrow:Hr,createVertexShader:$r,createFragmentShader:Gr,createProgram:Xr,linkProgram:Yr,validateProgram:Zr,createStaticVertexBuffer:Jr,createStaticIndexBuffer:Qr,getNumChannels:ti,createTexture:ei,validateTextureSize:ni,createFramebuffer:ri,bindVertexBufferToProgramAttribute:ii,bindTextureUnit:oi,unbindTextureUnit:function(t,e){di(t,e),Fr(t,function(){return t.activeTexture(t.TEXTURE0+e)}),Fr(t,function(){return t.bindTexture(t.TEXTURE_2D,null)})},getProgramUniformLocationOrThrow:ai,getProgramUniformLocation:si,bindTextureToProgramUniformSampler:ui,bindCanvasToFramebuffer:function(t){Fr(t,function(){return t.bindFramebuffer(t.FRAMEBUFFER,null)}),Fr(t,function(){return t.viewport(0,0,t.canvas.width,t.canvas.height)}),Fr(t,function(){return t.scissor(0,0,t.canvas.width,t.canvas.height)})},bindColorTextureToFramebuffer:ci,unbindColorTextureFromFramebuffer:li,validateFramebuffer:fi,getFramebufferErrorMessage:hi,getBatchDim:mi,getRowsCols:gi,getTextureShapeFromLogicalShape:yi,isReshapeFree:bi});function _i(t){var e=er();return $r(t,e.version+"\n    precision highp float;\n    "+e.attribute+" vec3 clipSpacePos;\n    "+e.attribute+" vec2 uv;\n    "+e.varyingVs+" vec2 resultUV;\n\n    void main() {\n      gl_Position = vec4(clipSpacePos, 1);\n      resultUV = uv;\n    }")}function xi(t){return Jr(t,new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]))}function Ei(t){return Qr(t,new Uint16Array([0,1,2,2,1,3]))}function Si(t,e){var n,r,i,o,a,s,u,c=t;return u=2===te.get("WEBGL_VERSION")?(n=c.R32F,r=c.R16F,i=c.RGBA32F,o=c.RED,a=4,s=1,c.HALF_FLOAT):(n=t.RGBA,r=t.RGBA,i=c.RGBA,o=t.RGBA,s=a=4,null!=e?e.HALF_FLOAT_OES:null),{internalFormatFloat:n,internalFormatHalfFloat:r,internalFormatPackedFloat:i,textureFormatFloat:o,downloadTextureFormat:t.RGBA,downloadUnpackNumChannels:a,defaultNumChannels:s,textureTypeHalfFloat:u}}function Ni(t,e,n,r,i,o){ni(e,n);var a=ei(t),s=t.TEXTURE_2D;return Fr(t,function(){return t.bindTexture(s,a)}),Fr(t,function(){return t.texParameteri(s,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE)}),Fr(t,function(){return t.texParameteri(s,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}),Fr(t,function(){return t.texParameteri(s,t.TEXTURE_MIN_FILTER,t.NEAREST)}),Fr(t,function(){return t.texParameteri(s,t.TEXTURE_MAG_FILTER,t.NEAREST)}),Fr(t,function(){return t.texImage2D(s,0,r,e,n,0,i,o,null)}),Fr(t,function(){return t.bindTexture(t.TEXTURE_2D,null)}),a}function Ii(t,e,n,r){var i=Mr(e,n);return Ni(t,i[0],i[1],r.internalFormatFloat,r.textureFormatFloat,t.FLOAT)}function Oi(t,e,n,r){var i=Mr(e,n);return Ni(t,i[0],i[1],r.internalFormatFloat,r.textureFormatFloat,r.textureTypeHalfFloat)}function ki(t,e,n,r){var i=Mr(e,n);return Ni(t,i[0],i[1],t.RGBA,t.RGBA,t.UNSIGNED_BYTE)}function Ai(t,e,n,r){var i=jr(e,n);return Ni(t,i[0],i[1],r.internalFormatPackedFloat,t.RGBA,t.FLOAT)}function Ci(t,e,n,r){var i=jr(e,n);return Ni(t,i[0],i[1],r.internalFormatHalfFloat,t.RGBA,r.textureTypeHalfFloat)}function Pi(t,e,n){return Fr(t,function(){return t.bindBuffer(t.ARRAY_BUFFER,n)}),ii(t,e,"clipSpacePos",n,3,20,0)&&ii(t,e,"uv",n,2,20,12)}function Ti(t,e,n){Fr(t,function(){return t.bindTexture(t.TEXTURE_2D,e)}),Fr(t,function(){return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n)}),Fr(t,function(){return t.bindTexture(t.TEXTURE_2D,null)})}function Mi(t,e,n,r,i,o){ni(n,r),Fr(t,function(){return t.bindTexture(t.TEXTURE_2D,e)}),Fr(t,function(){return t.texSubImage2D(t.TEXTURE_2D,0,0,0,n,r,o,t.FLOAT,i)}),Fr(t,function(){return t.bindTexture(t.TEXTURE_2D,null)})}function Ri(t,e,n,r,i,o,a){var s,u=Mr(n,r),c=u[0],l=u[1],f=n*r;1===a.defaultNumChannels&&f===i.length?s=i:function(t,e,n){var r=Rr(t.length,n);if(e.length<r)throw new Error("unpackedArray length ("+e.length+") must be >= "+r);for(var i=0,o=0;o<t.length;++o)e[i]=t[o],i+=n}(i,s=new Float32Array(f*o),o),Mi(t,e,c,l,s,a.textureFormatFloat)}function Di(t,e,n,r,i,o,a,s,u){var c=jr(o,a),l=c[0],f=c[1],h=new Float32Array(Br(o,a));(function(t,e,n,r,i){for(var o=r%2==1,a=n%2==1,s=Math.floor(r/2),u=Math.floor(n/2),c=Math.ceil(r/2),l=c*Math.ceil(n/2),f=S(n)*S(r),h=0;h<e;h++){for(var p=h*n*r,d=h*f,m=o?4:0,g=r,y=d,v=0;v<u;++v){for(var b=2*v*r,w=0;w<s;++w){var _=p+b+2*w;i[y]=t[_],i[y+1]=t[_+1],i[y+2]=t[_+g],i[y+3]=t[_+g+1],y+=4}y+=m}if(o){_=p+r-1,y=d+4*(c-1);var x=2*r;for(m=4*c,v=0;v<u;++v)i[y]=t[_],i[y+2]=t[_+r],_+=x,y+=m}if(a){for(_=p+(n-1)*r,y=d+4*(l-c),w=0;w<s;++w)i[y++]=t[_++],i[y++]=t[_++],y+=2;o&&a&&(i[d+f-4]=t[_])}}})(s,n,r,i,h),Mi(t,e,l,f,h,t.RGBA)}function ji(t,e,n,r,i){var o=e;if(2===te.get("WEBGL_VERSION")){var a=t,s=a.createBuffer();Fr(t,function(){return t.bindBuffer(a.PIXEL_PACK_BUFFER,s)});var u=4*Rr(n*r,i.downloadUnpackNumChannels);Fr(t,function(){return t.bufferData(a.PIXEL_PACK_BUFFER,u,a.STREAM_READ)}),Fr(t,function(){return a.readPixels(0,0,r,n,t.RGBA,t.FLOAT,0)}),Fr(t,function(){return t.bindBuffer(a.PIXEL_PACK_BUFFER,null)}),o=s}return o}function Bi(t,e,n,r,i){var o=t,a=new Float32Array(Rr(n*r,i.downloadUnpackNumChannels));o.bindBuffer(o.PIXEL_PACK_BUFFER,e),o.getBufferSubData(o.PIXEL_PACK_BUFFER,0,a),o.bindBuffer(o.PIXEL_PACK_BUFFER,null);var s=new Float32Array(n*r);return Dr(a,s,i.downloadUnpackNumChannels),s}function Li(t,e,n,r){var i=Mr(e,n),o=i[0],a=i[1],s=new Float32Array(Rr(e*n,r.downloadUnpackNumChannels));Fr(t,function(){return t.readPixels(0,0,o,a,r.downloadTextureFormat,t.FLOAT,s)});var u=new Float32Array(e*n);return Dr(s,u,r.downloadUnpackNumChannels),u}function Fi(t,e,n,r){var i=Mr(e,n),o=i[0],a=i[1],s=new Uint8Array(Rr(e*n,4));return Fr(t,function(){return t.readPixels(0,0,o,a,r.downloadTextureFormat,t.UNSIGNED_BYTE,s)}),new Float32Array(s.buffer)}function zi(t,e,n,r,i,o,a,s){var u=t,c=new Float32Array(Br(o,a));u.bindBuffer(u.PIXEL_PACK_BUFFER,e),u.getBufferSubData(u.PIXEL_PACK_BUFFER,0,c),u.bindBuffer(u.PIXEL_PACK_BUFFER,null);var l=new Float32Array(L([n,r,i]));return Lr(c,n,r,i,l),l}function Ui(t,e,n,r,i,o,a){var s=jr(i,o),u=s[0],c=s[1],l=new Float32Array(Br(i,o));Fr(t,function(){return t.readPixels(0,0,u,c,t.RGBA,t.FLOAT,l)});var f=new Float32Array(L([e,n,r]));return Lr(l,e,n,r,f)}var Vi=Object.freeze({createVertexShader:_i,createVertexBuffer:xi,createIndexBuffer:Ei,getTextureConfig:Si,createFloat32MatrixTexture:Ii,createFloat16MatrixTexture:Oi,createUnsignedBytesMatrixTexture:ki,createPackedMatrixTexture:Ai,createFloat16PackedMatrixTexture:Ci,bindVertexProgramAttributeStreams:Pi,uploadPixelDataToTexture:Ti,uploadMatrixToTexture:Ri,uploadMatrixToPackedTexture:Di,maybeCreateBufferFromOutputTexture:ji,downloadFloat32MatrixFromBuffer:Bi,downloadFloat32MatrixFromOutputTexture:Li,downloadByteEncodedFloatMatrixFromOutputTexture:Fi,downloadPackedMatrixFromBuffer:zi,downloadMatrixFromPackedOutputTexture:Ui}),Wi=(qi.prototype.dispose=function(){var t=this;if(!this.disposed){null!=this.program&&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."),null!=this.outputTexture&&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;Fr(e,function(){return e.finish()}),Fr(e,function(){return e.bindFramebuffer(e.FRAMEBUFFER,null)}),Fr(e,function(){return e.deleteFramebuffer(t.framebuffer)}),Fr(e,function(){return e.bindBuffer(e.ARRAY_BUFFER,null)}),Fr(e,function(){return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)}),Fr(e,function(){return e.deleteBuffer(t.indexBuffer)}),this.disposed=!0}},qi.prototype.enableAutomaticDebugValidation=function(t){Ur(this.autoDebugValidate=t)},qi.prototype.createFloat32MatrixTexture=function(t,e){return this.throwIfDisposed(),Ii(this.gl,t,e,this.textureConfig)},qi.prototype.createFloat16MatrixTexture=function(t,e){return this.throwIfDisposed(),Oi(this.gl,t,e,this.textureConfig)},qi.prototype.createUnsignedBytesMatrixTexture=function(t,e){return this.throwIfDisposed(),ki(this.gl,t,e,this.textureConfig)},qi.prototype.uploadPixelDataToTexture=function(t,e){this.throwIfDisposed(),Ti(this.gl,t,e)},qi.prototype.createFloat16PackedMatrixTexture=function(t,e){return this.throwIfDisposed(),Ci(this.gl,t,e,this.textureConfig)},qi.prototype.createPackedMatrixTexture=function(t,e){return this.throwIfDisposed(),Ai(this.gl,t,e,this.textureConfig)},qi.prototype.deleteMatrixTexture=function(t){var e=this;this.throwIfDisposed(),this.outputTexture===t&&(li(this.gl,this.framebuffer),this.outputTexture=null),Fr(this.gl,function(){return e.gl.deleteTexture(t)})},qi.prototype.uploadMatrixToTexture=function(t,e,n,r){this.throwIfDisposed();var i=ti();return Ri(this.gl,t,e,n,r,i,this.textureConfig)},qi.prototype.uploadMatrixToPackedTexture=function(t,e,n,r,i,o,a){return this.throwIfDisposed(),Di(this.gl,t,e,n,r,i,o,a,this.textureConfig)},qi.prototype.downloadFloat32MatrixFromOutputTexture=function(t,e,n){var r=this;return this.downloadMatrixDriver(t,function(){return Li(r.gl,e,n,r.textureConfig)})},qi.prototype.downloadByteEncodedFloatMatrixFromOutputTexture=function(t,e,n){var r=this;return this.downloadMatrixDriver(t,function(){return Fi(r.gl,e,n,r.textureConfig)})},qi.prototype.downloadPackedMatrixFromBuffer=function(t,e,n,r,i,o){return zi(this.gl,t,e,n,r,i,o,this.textureConfig)},qi.prototype.downloadFloat32MatrixFromBuffer=function(t,e,n){return Bi(this.gl,t,e,n,this.textureConfig)},qi.prototype.maybeCreateBufferFromTexture=function(t,e,n){this.bindTextureToFrameBuffer(t);var r=ji(this.gl,t,e,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),r},qi.prototype.createAndWaitForFence=function(){var t=this.createFence(this.gl);return this.pollFence(t)},qi.prototype.createFence=function(t){var e,n,r=this;if(te.get("WEBGL_FENCE_API_ENABLED")){var i=t,o=i.fenceSync(i.SYNC_GPU_COMMANDS_COMPLETE,0);t.flush(),n=function(){var t=i.clientWaitSync(o,0,0);return t===i.ALREADY_SIGNALED||t===i.CONDITION_SATISFIED},e=o}else n=0<te.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?(e=this.beginQuery(),this.endQuery(),function(){return r.isQueryAvailable(e,te.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}):function(){return!0};return{query:e,isFencePassed:n}},qi.prototype.downloadMatrixFromPackedTexture=function(t,e,n,r,i,o){var a=this;return this.downloadMatrixDriver(t,function(){return Ui(a.gl,e,n,r,i,o,a.textureConfig)})},qi.prototype.createProgram=function(t){this.throwIfDisposed();var e=this.gl,n=Gr(e,t),r=_i(e),i=Xr(e);return Fr(e,function(){return e.attachShader(i,r)}),Fr(e,function(){return e.attachShader(i,n)}),Yr(e,i),this.autoDebugValidate&&Zr(e,i),this.vertexAttrsAreBound||(this.setProgram(i),this.vertexAttrsAreBound=Pi(e,this.program,this.vertexBuffer)),i},qi.prototype.deleteProgram=function(t){var e=this;this.throwIfDisposed(),t===this.program&&(this.program=null),null!=t&&Fr(this.gl,function(){return e.gl.deleteProgram(t)})},qi.prototype.setProgram=function(t){var e=this;this.throwIfDisposed(),this.program=t,null!=this.program&&this.autoDebugValidate&&Zr(this.gl,this.program),Fr(this.gl,function(){return e.gl.useProgram(t)})},qi.prototype.getUniformLocation=function(t,e,n){return void 0===n&&(n=!0),this.throwIfDisposed(),n?ai(this.gl,t,e):si(this.gl,t,e)},qi.prototype.getAttributeLocation=function(t,e){var n=this;return this.throwIfDisposed(),Fr(this.gl,function(){return n.gl.getAttribLocation(t,e)})},qi.prototype.getUniformLocationNoThrow=function(t,e){return this.throwIfDisposed(),this.gl.getUniformLocation(t,e)},qi.prototype.setInputMatrixTexture=function(t,e,n){this.throwIfDisposed(),this.throwIfNoProgram(),ui(this.gl,this.program,t,e,n)},qi.prototype.setOutputMatrixTexture=function(t,e,n){this.setOutputMatrixTextureDriver(t,n,e)},qi.prototype.setOutputPackedMatrixTexture=function(t,e,n){this.throwIfDisposed();var r=jr(e,n),i=r[0],o=r[1];this.setOutputMatrixTextureDriver(t,i,o)},qi.prototype.setOutputMatrixWriteRegion=function(t,e,n,r){this.setOutputMatrixWriteRegionDriver(n,t,r,e)},qi.prototype.setOutputPackedMatrixWriteRegion=function(t,e,n,r){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")},qi.prototype.debugValidate=function(){null!=this.program&&Zr(this.gl,this.program),fi(this.gl)},qi.prototype.executeProgram=function(){this.throwIfDisposed(),this.throwIfNoProgram();var t=this.gl;this.autoDebugValidate&&this.debugValidate(),Fr(t,function(){return t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0)})},qi.prototype.blockUntilAllProgramsCompleted=function(){var t=this;this.throwIfDisposed(),Fr(this.gl,function(){return t.gl.finish()})},qi.prototype.getQueryTimerExtension=function(){return null==this.disjointQueryTimerExtension&&(this.disjointQueryTimerExtension=Hr(this.gl,2===te.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension},qi.prototype.getQueryTimerExtensionWebGL2=function(){return this.getQueryTimerExtension()},qi.prototype.getQueryTimerExtensionWebGL1=function(){return this.getQueryTimerExtension()},qi.prototype.beginQuery=function(){if(2===te.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var t=this.gl,e=this.getQueryTimerExtensionWebGL2(),n=t.createQuery();return t.beginQuery(e.TIME_ELAPSED_EXT,n),n}var r=this.getQueryTimerExtensionWebGL1(),i=r.createQueryEXT();return r.beginQueryEXT(r.TIME_ELAPSED_EXT,i),i},qi.prototype.endQuery=function(){if(2!==te.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var t=this.getQueryTimerExtensionWebGL1();t.endQueryEXT(t.TIME_ELAPSED_EXT)}else{var e=this.gl,n=this.getQueryTimerExtensionWebGL2();e.endQuery(n.TIME_ELAPSED_EXT)}},qi.prototype.waitForQueryAndGetTime=function(n){return m(this,void 0,void 0,function(){var e=this;return I(this,function(t){switch(t.label){case 0:return[4,_(function(){return e.disposed||e.isQueryAvailable(n,te.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))})];case 1:return t.sent(),[2,this.getQueryTime(n,te.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))]}})})},qi.prototype.getQueryTime=function(t,e){if(0===e)return null;if(2===e){var n=this.gl;return n.getQueryParameter(t,n.QUERY_RESULT)/1e6}var r=this.getQueryTimerExtensionWebGL1();return r.getQueryObjectEXT(t,r.QUERY_RESULT_EXT)/1e6},qi.prototype.isQueryAvailable=function(t,e){if(0===e)return!0;if(2!==e)return i=(r=this.getQueryTimerExtensionWebGL1()).getQueryObjectEXT(t,r.QUERY_RESULT_AVAILABLE_EXT),null==this.disjoint&&(this.disjoint=this.gl.getParameter(r.GPU_DISJOINT_EXT)),i&&!this.disjoint;var n=this.gl,r=this.getQueryTimerExtensionWebGL2(),i=n.getQueryParameter(t,n.QUERY_RESULT_AVAILABLE);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(r.GPU_DISJOINT_EXT)),i&&!this.disjoint},qi.prototype.pollFence=function(e){var n=this;return new Promise(function(t){n.addItemToPoll(function(){return e.isFencePassed()},function(){return t()})})},qi.prototype.pollItems=function(){for(var t=function(t){for(var e=0;e<t.length&&t[e]();++e);return e-1}(this.itemsToPoll.map(function(t){return t.isDoneFn})),e=0;e<=t;++e)(0,this.itemsToPoll[e].resolveFn)();this.itemsToPoll=this.itemsToPoll.slice(t+1)},qi.prototype.addItemToPoll=function(t,e){var n=this;this.itemsToPoll.push({isDoneFn:t,resolveFn:e}),1<this.itemsToPoll.length||_(function(){return n.pollItems(),0===n.itemsToPoll.length})},qi.prototype.bindTextureToFrameBuffer=function(t){this.throwIfDisposed(),ci(this.gl,t,this.framebuffer),this.autoDebugValidate&&fi(this.gl)},qi.prototype.unbindTextureToFrameBuffer=function(){null!=this.outputTexture?(ci(this.gl,this.outputTexture,this.framebuffer),this.autoDebugValidate&&fi(this.gl)):li(this.gl,this.framebuffer)},qi.prototype.downloadMatrixDriver=function(t,e){this.bindTextureToFrameBuffer(t);var n=e();return this.unbindTextureToFrameBuffer(),n},qi.prototype.setOutputMatrixTextureDriver=function(t,e,n){this.throwIfDisposed();var r=this.gl;ci(r,t,this.framebuffer),this.autoDebugValidate&&fi(r),this.outputTexture=t,Fr(r,function(){return r.viewport(0,0,e,n)}),Fr(r,function(){return r.scissor(0,0,e,n)})},qi.prototype.setOutputMatrixWriteRegionDriver=function(t,e,n,r){var i=this;this.throwIfDisposed(),Fr(this.gl,function(){return i.gl.scissor(t,e,n,r)})},qi.prototype.throwIfDisposed=function(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")},qi.prototype.throwIfNoProgram=function(){if(null==this.program)throw new Error("No GPU program is currently set.")},qi);function qi(t){this.outputTexture=null,this.program=null,this.disposed=!1,this.autoDebugValidate=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[],this.gl=null!=t?t:c(te.get("WEBGL_VERSION")),1===te.get("WEBGL_VERSION")?(this.textureFloatExtension=Hr(this.gl,"OES_texture_float"),this.colorBufferFloatExtension=this.gl.getExtension("WEBGL_color_buffer_float"),te.get("WEBGL_RENDER_FLOAT32_ENABLED")||(this.textureHalfFloatExtension=Hr(this.gl,"OES_texture_half_float"),this.colorBufferHalfFloatExtension=this.gl.getExtension("EXT_color_buffer_half_float"))):this.colorBufferFloatExtension=Hr(this.gl,"EXT_color_buffer_float"),this.vertexBuffer=xi(this.gl),this.indexBuffer=Ei(this.gl),this.framebuffer=ri(this.gl),this.textureConfig=Si(this.gl,this.textureHalfFloatExtension)}function Hi(t,s){if(t.length!==s.length)throw Error("Binary was compiled with "+t.length+" inputs, but was executed with "+s.length+" inputs");t.forEach(function(t,e){var n=t.logicalShape,r=s[e],i=r.shape;if(!x(n,i))throw Error("Binary was compiled with different shapes than the current args. Shapes "+n+" and "+i+" must match");if(!t.isUniform||!r.isUniform){var o=t.texShape,a=r.isUniform?null:r.texData.texShape;if(!x(o,a))throw Error("Binary was compiled with different texture shapes than the current args. Shape "+o+" and "+a+" must match")}})}var $i=function(t,e,n){this.variableNames=["A"],this.outputShape=t;var r=n.filterWidth,i=n.inChannels,o=n.strideWidth,a=n.strideHeight,s=n.padInfo,u=n.outWidth,c=n.dilationWidth,l=n.dilationHeight,f=s.left,h=s.top,p=i*r,d=er();this.userCode="\n      void main() {\n        ivec2 rc = getOutputCoords();\n\n        vec4 result = vec4(0);\n\n        for(int row=0; row<=1; row++) {\n          for(int col=0; col<=1; col++) {\n            int blockIndex = rc.y + col;\n            int pos = rc.x + row;\n\n            if(blockIndex >= "+t[1]+" || pos >= "+t[0]+") continue;\n\n            int offsetY = int(blockIndex / ("+u+")) * "+a+" - "+h+";\n            int d0 = offsetY + "+l+" * (pos / "+p+");\n\n            if(d0 >= "+e[0]+" || d0 < 0) continue;\n\n            int offsetX = int(mod(float(blockIndex), "+u+".) * "+o+". - "+f+".);\n            int d1 = offsetX + "+c+" * (int(mod(float(pos), "+p+".) / "+i+".));\n\n            if(d1 >= "+e[1]+" || d1 < 0) continue;\n\n            result[row * 2 + col] = getA(d0, d1, int(mod(float(pos), "+i+".)));\n          }\n        }\n\n        "+d.output+" = result;\n      }\n    "},Gi=function(t,e,n,r,i){this.variableNames=["x"],this.outputShape=[];var o,a=e,s=t[3]-1;this.outputShape=t;var u="float("+n+") + float("+r+") * sum";o=.5===i?"inversesqrt("+u+")":1===i?"1.0/("+u+")":"exp(log("+u+") * float(-"+i+"));",this.userCode="\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int r = coords[1];\n        int c = coords[2];\n        int d = coords[3];\n        float x = getX(b, r, c, d);\n        float sum = 0.0;\n        for (int j = -"+a+"; j <= "+a+"; j++) {\n          int idx = d + j;\n          if (idx >= 0 && idx <=  "+s+") {\n            float z = getX(b, r, c, idx);\n            sum += z * z;\n          }\n        }\n        float val = x * "+o+";\n        setOutput(val);\n      }\n    "},Ki=function(t,e,n,r,i){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=t,this.depth=t[3],this.depthRadius=e,this.bias=n,this.alpha=r,this.beta=i,this.userCode="\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int r = coords[1];\n        int c = coords[2];\n\n        float result = 0.0;\n        for (int d = 0; d < "+this.depth+"; ++d) {\n          int depthBegin = int(max(0.0, float(d - "+e+")));\n          int depthEnd = int(min(float("+this.depth+"),\n              float(d + "+e+" + 1)));\n\n          const int MIN_DEPTH_BEGIN = 0;\n          const int MAX_DEPTH_END = "+this.depth+";\n\n          float norm = 0.0;\n          for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) {\n            if (k < depthBegin){\n              continue;\n            }\n            else if (k >= depthBegin && k < depthEnd) {\n              norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);\n            }\n            else {\n              break;\n            }\n          }\n\n          norm = float("+r+") * norm + float("+n+");\n\n          for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){\n            if (k < depthBegin){\n              continue;\n            }\n            else if (k >= depthBegin && k < depthEnd){\n              float dyi = -2.0 * float("+r+")\n                * float("+i+")\n                * getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d)\n                / norm;\n              if (k == d) {\n                dyi += pow(norm, -1.0 * "+i+");\n              }\n              if (k == coords[3]) {\n                dyi *= getDy(b, r, c, d);\n                result += dyi;\n              }\n            }\n            else {\n              break;\n            }\n          }\n      }\n      setOutput(result);\n      }\n    "},Xi=function(t){this.variableNames=["dy","maxPos"],this.outputShape=t.inShape;var e=t.strideHeight,n=t.strideWidth,r=t.dilationHeight,i=t.effectiveFilterHeight,o=t.effectiveFilterWidth,a=i-1-t.padInfo.top,s=o-1-t.padInfo.left,u=i*o-1;this.userCode="\n      const ivec2 pads = ivec2("+a+", "+s+");\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n\n        ivec2 dyRCCorner = coords.yz - pads;\n        int dyRCorner = dyRCCorner.x;\n        int dyCCorner = dyRCCorner.y;\n\n        // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n        // ? = to be determined. : = across all values in that axis.\n        float dotProd = 0.0;\n        for (int wR = 0; wR < "+i+";\n          wR += "+r+") {\n          float dyR = float(dyRCorner + wR) / "+e+".0;\n\n          if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n            continue;\n          }\n          int idyR = int(dyR);\n\n          for (int wC = 0; wC < "+o+"; wC++) {\n            float dyC = float(dyCCorner + wC) / "+n+".0;\n\n            if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n                fract(dyC) > 0.0) {\n              continue;\n            }\n            int idyC = int(dyC);\n\n            float dyValue = getDy(b, idyR, idyC, d);\n            int maxPosValue = "+u+" - int(getMaxPos(b, idyR, idyC, d));\n\n            // Get the current value, check it against the value from the\n            // position matrix.\n            int curPosValue = wR * "+o+" + wC;\n            float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n            dotProd += dyValue * mask;\n          }\n        }\n        setOutput(dotProd);\n      }\n    "},Yi=function(t,e,n,r,i,o){void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===i&&(i=!1),void 0===o&&(o=null),this.variableNames=["matrixA","matrixB"];var a=t[0],s=n?t[2]:t[1],u=r?e[1]:e[2],c=n?t[1]:t[2];function l(t,e){return n?"batch, "+e+" + "+t+", aRow":"batch, aRow, "+e+" + "+t}function f(t,e){return r?"batch, bCol, "+e+" + "+t:"batch, "+e+" + "+t+", bCol"}this.outputShape=[a,s,u];var h=4*Math.floor(c/4),p=c%4,d="",m="";o&&(d="float activation(float x) {\n        "+o+"\n      }",m="result = activation(result);");var g=i?"result += getBiasAtOutCoords();":"";i&&this.variableNames.push("bias"),this.userCode="\n      "+d+"\n\n      float dotARowBCol(int batch, int aRow, int bCol) {\n        float result = 0.0;\n        for (int i = 0; i < "+h+"; i += 4) {\n          vec4 a = vec4(\n            getMatrixA("+l(0,"i")+"),\n            getMatrixA("+l(1,"i")+"),\n            getMatrixA("+l(2,"i")+"),\n            getMatrixA("+l(3,"i")+")\n          );\n          vec4 b = vec4(\n            getMatrixB("+f(0,"i")+"),\n            getMatrixB("+f(1,"i")+"),\n            getMatrixB("+f(2,"i")+"),\n            getMatrixB("+f(3,"i")+")\n          );\n\n          result += dot(a, b);\n        }\n\n        if ("+(1==p)+") {\n          result += getMatrixA("+l(0,h)+") *\n            getMatrixB("+f(0,h)+");\n        } else if ("+(2==p)+") {\n          vec2 a = vec2(\n            getMatrixA("+l(0,h)+"),\n            getMatrixA("+l(1,h)+")\n          );\n          vec2 b = vec2(\n            getMatrixB("+f(0,h)+"),\n            getMatrixB("+f(1,h)+")\n          );\n          result += dot(a, b);\n        } else if ("+(3==p)+") {\n          vec3 a = vec3(\n            getMatrixA("+l(0,h)+"),\n            getMatrixA("+l(1,h)+"),\n            getMatrixA("+l(2,h)+")\n          );\n          vec3 b = vec3(\n            getMatrixB("+f(0,h)+"),\n            getMatrixB("+f(1,h)+"),\n            getMatrixB("+f(2,h)+")\n          );\n          result += dot(a, b);\n        }\n\n        return result;\n      }\n\n      void main() {\n        ivec3 resBRC = getOutputCoords();\n        float result = dotARowBCol(resBRC.x, resBRC.y, resBRC.z);\n\n        "+g+"\n\n        "+m+"\n\n        setOutput(result);\n      }\n    "},Zi=function(t,e,n,r,i,o,a){void 0===r&&(r=!1),void 0===i&&(i=!1),void 0===o&&(o=!1),void 0===a&&(a=null),this.variableNames=["matrixA","matrixB"],this.usesPackedTextures=!0,this.outputShape=n;var s=r?t[0]:t[1],u=Math.ceil(s/2),c=r?"i * 2, rc.x":"rc.x, i * 2",l=i?"rc.y, i * 2":"i * 2, rc.y",f=r?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],h=i?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],p="",d="";a&&(p="vec4 activation(vec4 x) {\n        "+a+"\n      }",d="result = activation(result);");var m=o?"result += getBiasAtOutCoords();":"";o&&this.variableNames.push("bias"),this.userCode="\n      "+p+"\n\n      const float sharedDimension = "+u+".0;\n\n      vec4 dot2x2ARowBCol(ivec2 rc) {\n        vec4 result = vec4(0);\n        for (int i = 0; i < "+u+"; i++) {\n          vec4 a = getMatrixA("+c+");\n          vec4 b = getMatrixB("+l+");\n\n          result += ("+f[0]+" * "+h[0]+") + ("+f[1]+" * "+h[1]+");\n        }\n        return result;\n      }\n\n      void main() {\n        ivec2 rc = getOutputCoords();\n        vec4 result = dot2x2ARowBCol(rc);\n\n        "+m+"\n\n        "+d+"\n\n        setOutput(result);\n      }\n    "},Ji=(to.prototype.getCustomSetupFunc=function(n){var r=this;return function(t,e){null==r.seedLoc&&(r.seedLoc=t.getUniformLocation(e,"seed")),t.gl.uniform1f(r.seedLoc,n)}},to),Qi=function(t,e,n,r){this.variableNames=["indices"],this.outputShape=[t,e],this.userCode="\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int index = round(getIndices(coords.x));\n        setOutput(mix(float("+r+"), float("+n+"),\n                      float(index == coords.y)));\n      }\n    "};function to(t,e,n){this.variableNames=["probs"],this.outputShape=[t,n],this.userCode="\n      uniform float seed;\n\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int batch = coords[0];\n\n        float r = random(seed);\n        float cdf = 0.0;\n\n        for (int i = 0; i < "+(e-1)+"; i++) {\n          cdf += getProbs(batch, i);\n\n          if (r < cdf) {\n            setOutput(float(i));\n            return;\n          }\n        }\n\n        // If no other event happened, last event happened.\n        setOutput(float("+(e-1)+"));\n      }\n    "}function eo(t,e){return 1===e?[t]:function(e,t){return["x","y","z","w","u","v"].slice(0,t).map(function(t){return e+"."+t})}(t,e)}var no=function(t){this.variableNames=["A"],this.isPackShader=!0;var e=(this.outputShape=t).length;if(0===e)this.userCode="\n        void main() {\n          setOutput(vec4(getA(), 0., 0., 0.));\n        }\n      ";else{var n=eo("rc",e),r=mr(e),i=function(t,e,n){if(1===t)return"rc > "+e[0];for(var r="",i=t-2;i<t;i++)r+=n[i]+" >= "+e[i],i<t-1&&(r+="||");return r}(e,t,n),o=function(t,e,n,r){if(1===t)return"";var i=r.slice(-2);return"\n    int r = "+i[0]+";\n    int c = "+i[1]+";\n    int rp1 = r + 1;\n    int cp1 = c + 1;\n\n    bool cEdge = cp1 >= "+e+";\n    bool rEdge = rp1 >= "+n+";\n  "}(e,t[t.length-1],t[t.length-2],n),a=function(t,e){var n=t.length,r=function(t,e){for(var n=[],r=0;r<=1;r++)for(var i=0;i<=1;i++){for(var o=(0===r?"r":"rp1")+", "+(0===i?"c":"cp1"),a=2;a<t;a++)o=e[e.length-1-a]+","+o;n.push(o)}return n}(n,e);return 1===n?"getA(rc),\n            rc + 1 >= "+t[0]+" ? 0. : getA(rc + 1),\n            0, 0":"getA("+r[0]+"),\n          cEdge ? 0. : getA("+r[1]+"),\n          rEdge ? 0. : getA("+r[2]+"),\n          rEdge || cEdge ? 0. : getA("+r[3]+")"}(t,n);this.userCode="\n        void main() {\n          "+r+" rc = getOutputCoords();\n\n          if("+i+") {\n            setOutput(vec4(0));\n          } else {\n            "+o+"\n\n            setOutput(vec4("+a+"));\n          }\n        }\n      "}};var ro=function(n,t,e){this.variableNames=["x"],this.outputShape=t.map(function(t,e){return t[0]+n[e]+t[1]});var r=n.length,i=mr(r),o=t.map(function(t){return t[0]}).join(","),a=t.map(function(t,e){return t[0]+n[e]}).join(","),s=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,r);this.userCode=1!==r?"\n      "+i+" start = "+i+"("+o+");\n      "+i+" end = "+i+"("+a+");\n\n      void main() {\n        "+i+" outC = getOutputCoords();\n        if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {\n          setOutput(float("+e+"));\n        } else {\n          "+i+" coords = outC - start;\n          setOutput(getX("+s+"));\n        }\n      }\n    ":"\n        int start = "+o+";\n        int end = "+a+";\n\n        void main() {\n          int outC = getOutputCoords();\n          if (outC < start || outC >= end) {\n            setOutput(float("+e+"));\n          } else {\n            setOutput(getX(outC - start));\n          }\n        }\n      "},io=function(n,t,e){this.variableNames=["x"],this.usesPackedTextures=!0,this.outputShape=t.map(function(t,e){return t[0]+n[e]+t[1]});for(var r=n.length,i=mr(r),o=t.map(function(t){return t[0]}).join(","),a=t.map(function(t,e){return t[0]+n[e]}).join(","),s=eo("rc",r),u=eo("source",r),c=s[r-1]+" < "+this.outputShape[r-1],l=1===r?"source":"vec2("+u.slice(-2).join()+")",f=[i+" rc = outputLoc;",s[r-1]+" += 1;\n       if("+c+") {\n      ",1===r?"":"}\n       rc = outputLoc;\n       "+s[r-2]+" += 1;\n       if("+s[r-2]+" < "+this.outputShape[r-2]+") {",1===r?"":"  "+s[r-1]+" += 1;\n         if("+c+") {"],h=1===r?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))",p="",d=0,m=1===r?2:4;d<m;d++)p+="\n        "+f[d]+"\n        if ("+h+") {\n          result["+d+"] = float("+e+");\n        } else {\n          "+i+" source = rc - start;\n          result["+d+"] = getChannel(getX("+u.join()+"), "+l+");\n        }\n      ";p+=1===r?"} ":"}}",this.userCode="\n      const "+i+" start = "+i+"("+o+");\n      const "+i+" end = "+i+"("+a+");\n\n      void main() {\n        "+i+" outputLoc = getOutputCoords();\n        vec4 result = vec4(0.);\n        "+p+"\n        setOutput(result);\n      }\n    "},oo=function(t,e,n){if(this.variableNames=["x"],"avg"===e&&n)throw new Error("Cannot compute positions for average pool.");var r=t.filterWidth,i=t.strideHeight,o=t.strideWidth,a=t.dilationHeight,s=t.dilationWidth,u=t.effectiveFilterHeight,c=t.effectiveFilterWidth,l=t.padInfo.top,f=t.padInfo.left;this.outputShape=t.outShape;var h="avg"===e,p="0.0";if(h||(p="-1.0 / 1e-20"),n)this.userCode="\n        const ivec2 strides = ivec2("+i+", "+o+");\n        const ivec2 pads = ivec2("+l+", "+f+");\n\n        void main() {\n          ivec4 coords = getOutputCoords();\n          int batch = coords[0];\n          int d = coords[3];\n\n          ivec2 xRCCorner = coords.yz * strides - pads;\n          int xRCorner = xRCCorner.x;\n          int xCCorner = xRCCorner.y;\n\n          // max/min x(?, ?, d) to get y(yR, yC, d).\n          // ? = to be determined\n          float minMaxValue = 0.0;\n          float minMaxValueFound = 0.0;\n          int minMaxPosition = 0;\n          float avgValue = 0.0;\n\n          for (int wR = 0; wR < "+u+";\n              wR += "+a+") {\n            int xR = xRCorner + wR;\n\n            if (xR < 0 || xR >= "+t.inHeight+") {\n              continue;\n            }\n\n            for (int wC = 0; wC < "+c+";\n                wC += "+s+") {\n              int xC = xCCorner + wC;\n\n              if (xC < 0 || xC >= "+t.inWidth+") {\n                continue;\n              }\n\n              float value = getX(batch, xR, xC, d);\n\n              // If a min / max value has already been found, use it. If not,\n              // use the current value.\n              float currMinMaxValue = mix(\n                  value, minMaxValue, minMaxValueFound);\n              if (value >= currMinMaxValue) {\n                minMaxValue = value;\n                minMaxValueFound = 1.0;\n                minMaxPosition = wR * "+c+" + wC;\n              }\n            }\n          }\n          setOutput(float(minMaxPosition));\n        }\n      ";else{var d=e+"("+e+"("+e+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"avg"===e&&(d="avgValue / count");var m=4*Math.floor(r/4),g=r%4,y="\n      if ("+h+") {\n        avgValue += dot(values, ones);\n      } else {\n        minMaxValue = max(values, minMaxValue);\n      }\n    ";this.userCode="\n      const ivec2 strides = ivec2("+i+", "+o+");\n      const ivec2 pads = ivec2("+l+", "+f+");\n      const float initializationValue = "+p+";\n      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n      float count = 0.0;\n\n      float getValue(int batch, int xR, int xC, int d) {\n        if (xC < 0 || xC >= "+t.inWidth+") {\n          return initializationValue;\n        }\n        count += 1.0;\n        return getX(batch, xR, xC, d);\n      }\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int batch = coords[0];\n        int d = coords[3];\n\n        ivec2 xRCCorner = coords.yz * strides - pads;\n        int xRCorner = xRCCorner.x;\n        int xCCorner = xRCCorner.y;\n\n        // max/min x(?, ?, d) to get y(yR, yC, d).\n        // ? = to be determined\n        vec4 minMaxValue = vec4("+p+");\n        float avgValue = 0.0;\n        count = 0.0;\n\n        for (int wR = 0; wR < "+u+";\n            wR += "+a+") {\n          int xR = xRCorner + wR;\n\n          if (xR < 0 || xR >= "+t.inHeight+") {\n            continue;\n          }\n\n          for (int wC = 0; wC < "+m+"; wC += 4) {\n            int xC = xCCorner + wC * "+s+";\n\n            vec4 values = vec4(\n              getValue(batch, xR, xC, d),\n              getValue(batch, xR, xC + "+s+", d),\n              getValue(batch, xR, xC + 2 * "+s+", d),\n              getValue(batch, xR, xC + 3 * "+s+", d)\n            );\n\n            "+y+"\n          }\n\n          int xC = xCCorner + "+m+";\n          if ("+(1==g)+") {\n            vec4 values = vec4(\n              getValue(batch, xR, xC, d),\n              initializationValue,\n              initializationValue,\n              initializationValue\n            );\n\n            "+y+"\n          } else if ("+(2==g)+") {\n            vec4 values = vec4(\n              getValue(batch, xR, xC, d),\n              getValue(batch, xR, xC + "+s+", d),\n              initializationValue,\n              initializationValue\n            );\n\n            "+y+"\n          } else if ("+(3==g)+") {\n            vec4 values = vec4(\n              getValue(batch, xR, xC, d),\n              getValue(batch, xR, xC + "+s+", d),\n              getValue(batch, xR, xC + 2 * "+s+", d),\n              initializationValue\n            );\n\n            "+y+"\n          }\n        }\n        setOutput("+d+");\n      }\n    "}},ao=function(t,e){this.variableNames=["x"];var n=t.windowSize,r=t.batchSize,i=t.inSize,o=Math.ceil(i/n);this.outputShape=[r,o];var a="0.0",s="";"prod"===e?a="1.0":"min"===e?(a="1.0 / 1e-20",s="min"):"max"===e&&(a="-1.0 / 1e-20",s="max");var u=e+"("+e+"("+e+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"sum"===e?u="sumValue":"prod"===e?u="prodValue":"all"===e?u="allValue":"any"===e&&(u="anyValue");var c=4*Math.floor(n/4),l=n%4,f="\n      if ("+("sum"===e)+") {\n        sumValue += dot(values, ones);\n      } else if ("+("prod"===e)+") {\n        vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);\n        prodValue *= tmp[0] * tmp[1];\n      } else {\n        minMaxValue = "+s+"(values, minMaxValue);\n      }\n    ",h="vec4";"all"===e?(a="1.0",f="\n        bool reducedAllValue = all(values);\n        float floatedReducedAllValue = float(reducedAllValue);\n        allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);\n      ",h="bvec4"):"any"===e&&(a="0.0",f="\n        bool reducedAnyValue = any(values);\n        float floatedReducedAnyValue = float(reducedAnyValue);\n        anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);\n      ",h="bvec4");var p="";0<i%n&&(p="\n        if (inIdx < 0 || inIdx >= "+i+") {\n          return initializationValue;\n        }\n      "),this.userCode="\n      const float initializationValue = "+a+";\n      const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n      float getValue(int batch, int inIdx) {\n        "+p+"\n        return getX(batch, inIdx);\n      }\n\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int batch = coords[0];\n        int outIdx = coords[1];\n        int inOffset = outIdx * "+n+";\n\n        vec4 minMaxValue = vec4("+a+");\n        float prodValue = 1.0;\n        float sumValue = 0.0;\n        float allValue = 1.0;\n        float anyValue = 0.0;\n\n        for (int i = 0; i < "+c+"; i += 4) {\n          int inIdx = inOffset + i;\n          "+h+" values = "+h+"(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            getValue(batch, inIdx + 2),\n            getValue(batch, inIdx + 3)\n          );\n\n          "+f+"\n        }\n\n        int inIdx = inOffset + "+c+";\n        if ("+(1==l)+") {\n          "+h+" values = "+h+"(\n            getValue(batch, inIdx),\n            initializationValue,\n            initializationValue,\n            initializationValue\n          );\n\n          "+f+"\n        } else if ("+(2==l)+") {\n          "+h+" values = "+h+"(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            initializationValue,\n            initializationValue\n          );\n\n          "+f+"\n        } else if ("+(3==l)+") {\n          "+h+" values = "+h+"(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            getValue(batch, inIdx + 2),\n            initializationValue\n          );\n\n          "+f+"\n        }\n        setOutput("+u+");\n      }\n    "},so=function(t,e){this.variableNames=["A"],this.usesPackedTextures=!0,this.outputShape=t;for(var n="",r=0;r<4;r++){var i="thisRC = rc;";r%2==1&&(i+="thisRC.z += 1;"),1<r&&(i+="thisRC.y += 1;"),n+="\n        "+i+"\n        "+(0<r?"if(thisRC.y < rows && thisRC.z < cols){":"")+"\n          int flatIndex = getFlatIndex(thisRC);\n\n          ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);\n          vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));\n\n          result["+r+"] =\n            getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);\n        "+(0<r?"}":"")+"\n      "}this.userCode="\n      "+function(t){return"\n    ivec3 inputCoordsFromReshapedOutCoords(int index) {\n      "+nr(["r","c","d"],t)+"\n      return ivec3(r, c, d);\n    }\n  "}(e)+"\n      "+function(t){return"\n    int getFlatIndex(ivec3 coords) {\n      return round("+function(t,e){if(t.length!==e.length)throw new Error("Vectors to be dotted must be of the same length -got "+t.length+" and "+e.length);for(var n=[],r=Math.floor(t.length/4),i=t.length%4,o=0;o<r;o++){var a=t.slice(4*o,4*o+4),s=e.slice(4*o,4*o+4);n.push(rr(a)+", "+rr(s))}return 0!=i&&(a=t.slice(4*r),s=e.slice(4*r),1===a.length&&(a=a.map(function(t){return"float("+t+")"}),s=s.map(function(t){return"float("+t+")"})),n.push(rr(a)+", "+rr(s))),n.map(function(t,e){return"dot("+t+")"}).join("+")}(["coords.x","coords.y","coords.z"],H(t).map(function(t){return t.toString()}).concat(["1."]))+");\n    }\n  "}(t)+"\n\n      void main() {\n        ivec3 rc = getOutputCoords();\n\n        vec4 result = vec4(0.);\n\n        ivec3 thisRC;\n        int rows = "+t[1]+";\n        int cols = "+t[2]+";\n\n        "+n+"\n\n        setOutput(result);\n      }\n    "};var uo=function(t,e,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=e.shape;var r=e.shape,i=r[1],o=r[2],a=t.shape,s=a[1],u=a[2],c=[n&&1<s?i-1:i,n&&1<u?o-1:o],l=[n&&1<s?s-1:s,n&&1<u?u-1:u],f=c[0]/l[0],h=c[1]/l[1],p=1/f,d=1/h,m=2*Math.ceil(p)+2,g=2*Math.ceil(d)+2;this.userCode="\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n        int r = coords[1];\n        int c = coords[2];\n\n        float accumulator = 0.0;\n\n        const float heightScale = float("+f+");\n        const float widthScale = float("+h+");\n\n        const float invHeightScale = float("+p+");\n        const float invWidthScale = float("+d+");\n\n        const int winHeight = int("+m+");\n        const int winWidth = int("+g+");\n\n        // Compute bounds for where in dy we will look\n        float startRLerp = floor(float(r) * invHeightScale);\n        int startDyR = int(startRLerp - float(winHeight / 2));\n\n        float startCLerp = floor(float(c) * invWidthScale);\n        int startDyC = int(startCLerp - float(winWidth / 2));\n\n        // Loop over dy\n        for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n          int dyR = dyROffset + startDyR;\n\n          // Guard against the window exceeding the bounds of dy\n          if (dyR < 0 || dyR >= "+s+") {\n            continue;\n          }\n\n          for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n            int dyC = dyCOffset + startDyC;\n\n            // Guard against the window exceeding the bounds of dy\n            if (dyC < 0 || dyC >= "+u+") {\n              continue;\n            }\n\n            float dxR = float(dyR) * heightScale;\n            int topDxRIndex = int(floor(dxR));\n            int bottomDxRIndex = int(min(ceil(dxR), "+(i-1)+".0));\n            float dxRLerp = dxR - float(topDxRIndex);\n            float inverseDxRLerp = 1.0 - dxRLerp;\n\n            float dxC = float(dyC) * widthScale;\n            int leftDxCIndex = int(floor(dxC));\n            int rightDxCIndex = int(min(ceil(dxC), "+(o-1)+".0));\n            float dxCLerp = dxC - float(leftDxCIndex);\n            float inverseDxCLerp = 1.0 - dxCLerp;\n\n            if (r == topDxRIndex && c == leftDxCIndex) {\n              // topLeft\n              accumulator +=\n                getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;\n            }\n\n            if (r == topDxRIndex && c == rightDxCIndex) {\n              // topRight\n              accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;\n            }\n\n            if (r == bottomDxRIndex && c == leftDxCIndex) {\n              // bottomLeft\n              accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;\n            }\n\n            if (r == bottomDxRIndex && c == rightDxCIndex) {\n              // bottomRight\n              accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;\n            }\n          }\n        }\n        // End loop over dy\n\n        setOutput(accumulator);\n      }\n    "},co=function(t,e,n,r){this.variableNames=["A"],this.outputShape=[];var i=t[0],o=t[1],a=t[2],s=t[3];this.outputShape=[i,e,n,s];var u=[r&&1<e?o-1:o,r&&1<n?a-1:a],c=[r&&1<e?e-1:e,r&&1<n?n-1:n];this.userCode="\n      const vec2 effectiveInputOverOutputRatioRC = vec2(\n          "+u[0]/c[0]+",\n          "+u[1]/c[1]+");\n      const vec2 inputShapeRC = vec2("+o+".0, "+a+".0);\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n        ivec2 yRC = coords.yz;\n\n        // Fractional source index.\n        vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;\n\n        // Compute the four integer indices.\n        ivec2 sourceFloorRC = ivec2(sourceFracIndexRC);\n        ivec2 sourceCeilRC = ivec2(\n          min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n        float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d);\n        float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d);\n        float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d);\n        float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d);\n\n        vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);\n\n        float top = topLeft + (topRight - topLeft) * fracRC.y;\n        float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;\n        float newValue = top + (bottom - top) * fracRC.x;\n\n        setOutput(newValue);\n      }\n    "},lo=function(t,e,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=e.shape;var r=e.shape,i=r[1],o=r[2],a=t.shape,s=a[1],u=a[2],c=[n&&1<s?i-1:i,n&&1<u?o-1:o],l=[n&&1<s?s-1:s,n&&1<u?u-1:u],f=c[0]/l[0],h=c[1]/l[1],p=1/f,d=1/h,m=2*Math.ceil(p)+2,g=2*Math.ceil(d)+2;this.userCode="\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n        int r = coords[1];\n        int c = coords[2];\n\n        float accumulator = 0.0;\n\n        const float heightScale = float("+f+");\n        const float widthScale = float("+h+");\n\n        const float invHeightScale = float("+p+");\n        const float invWidthScale = float("+d+");\n\n        const int winHeight = int("+m+");\n        const int winWidth = int("+g+");\n\n        // Compute bounds for where in dy we will look\n        float startRLerp = floor(float(r) * invHeightScale);\n        int startDyR = int(floor(startRLerp - float(winHeight / 2)));\n\n        float startCLerp = floor(float(c) * invWidthScale);\n        int startDyC = int(floor(startCLerp - float(winWidth / 2)));\n\n        // Loop over dy\n        for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n          int dyR = dyROffset + startDyR;\n\n          // Guard against the window exceeding the bounds of dy\n          if (dyR < 0 || dyR >= "+s+") {\n            continue;\n          }\n\n          for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n            int dyC = dyCOffset + startDyC;\n\n            // Guard against the window exceeding the bounds of dy\n            if (dyC < 0 || dyC >= "+u+") {\n              continue;\n            }\n\n            float sourceFracRow =\n              float("+c[0]+") *\n                (float(dyR) / float("+l[0]+"));\n\n            float sourceFracCol =\n                float("+c[1]+") *\n                  (float(dyC) / float("+l[1]+"));\n\n            int sourceNearestRow = int(min(\n                float(int("+i+") - 1),\n                "+n+" ? float(round(sourceFracRow)) :\n                                  float(floor(sourceFracRow))));\n\n            int sourceNearestCol = int(min(\n                float(int("+o+") - 1),\n                "+n+" ? float(round(sourceFracCol)) :\n                                  float(floor(sourceFracCol))));\n\n            if (r == sourceNearestRow && c == sourceNearestCol) {\n              accumulator += getDy(b, dyR, dyC, d);\n            }\n          }\n        }\n        // End loop over dy\n\n        setOutput(accumulator);\n      }\n    "},fo=function(t,e,n,r){this.variableNames=["A"],this.outputShape=[];var i=t[0],o=t[1],a=t[2],s=t[3];this.outputShape=[i,e,n,s];var u=[r&&1<e?o-1:o,r&&1<n?a-1:a],c=[r&&1<e?e-1:e,r&&1<n?n-1:n],l=r?"0.5":"0.0";this.userCode="\n      const vec2 effectiveInputOverOutputRatioRC = vec2(\n          "+u[0]/c[0]+",\n          "+u[1]/c[1]+");\n      const vec2 inputShapeRC = vec2("+o+".0, "+a+".0);\n\n      void main() {\n        ivec4 coords = getOutputCoords();\n        int b = coords[0];\n        int d = coords[3];\n        ivec2 yRC = coords.yz;\n\n        // Fractional source index.\n        vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;\n\n        // Compute the coordinators of nearest neighbor point.\n        ivec2 sourceNearestRC = ivec2(\n          min(inputShapeRC - 1.0, floor(sourceFracIndexRC + "+l+")));\n\n        float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);\n\n        setOutput(newValue);\n      }\n    "},ho=function(r,i){this.variableNames=["x"];var t=r.length;if(4<t)throw new Error("WebGL backend: Reverse of rank-"+t+" tensor is not yet supported");if(this.outputShape=r,1!==t){var e=r.map(function(t,e){return n=e,-1!==i.indexOf(n)&&1!==r[n]?r[n]+" - coords["+n+"] - 1":"coords["+n+"]";var n}).join(","),n=mr(t);this.userCode="\n      void main() {\n        "+n+" coords = getOutputCoords();\n        setOutput(getX("+e+"));\n      }\n    "}else this.userCode="\n        void main() {\n          int coord = getOutputCoords();\n          setOutput(getX("+r[0]+" - coord - 1));\n        }\n      "},po=function(t,e,n,r,i,o,a){void 0===a&&(a=!0),this.variableNames=["updates","indices","defaultValue"],this.outputShape=o;var s=mr(i.length),u=mr(o.length),c="";1===n?c="i":2===n&&(c="i, j");var l="getIndices("+c+")",f="";1===r?f="i":2===r&&(f="i, coords[1]");var h="getUpdates("+f+")",p=1<e?"strides[j]":"strides";this.userCode="\n        "+s+" strides = "+s+"("+i+");\n\n        void main() {\n          "+u+" coords = getOutputCoords();\n          float sum = 0.0;\n          bool found = false;\n          for (int i = 0; i < "+t+"; i++) {\n            int flattenedIndex = 0;\n            for (int j = 0; j < "+e+"; j++) {\n              int index = round("+l+");\n              flattenedIndex += index * "+p+";\n            }\n            if (flattenedIndex == coords[0]) {\n              sum += "+h+";\n              found = true;\n            }\n          }\n          setOutput(mix(getDefaultValue(), sum, float(found)));\n        }\n      "},mo=function(t,e){this.variableNames=["x","segmentIds"];var n=t.windowSize,r=t.batchSize,i=t.inSize,o=t.numSegments,a=o*Math.ceil(i/n);this.outputShape=[r,a];var s=4*Math.floor(n/4),u=n%4,c="\n        sumValue += dot(values, segFilter);\n    ",l="";0<i%n&&(l="\n        if (inIdx < 0 || inIdx >= "+i+") {\n          return initializationValue;\n        }\n      ");var f="";0<i%n&&(f="\n        if (inIdx < 0 || inIdx >= "+i+") {\n          return -1.0;\n        }\n      "),this.userCode="\n      const float initializationValue = 0.0;\n\n      float getValue(int batch, int inIdx) {\n        "+l+"\n        return getX(batch, inIdx);\n      }\n\n      float getSegmentIdAtIndex(int inIdx) {\n        "+f+"\n        return getSegmentIds(inIdx);\n      }\n\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int batch = coords[0];\n        int outIdx = coords[1];\n        int inOffset = int(floor(float(outIdx) / float(\n          "+o+")) * float("+n+"));\n        int currentSeg = int(mod(float(outIdx), float("+o+")));\n\n        float sumValue = 0.0;\n\n        for (int i = 0; i < "+s+"; i += 4) {\n          int inIdx = inOffset + i;\n          vec4 values = vec4(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            getValue(batch, inIdx + 2),\n            getValue(batch, inIdx + 3)\n          );\n\n          vec4 segFilter = vec4(\n            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0\n          );\n\n          "+c+"\n        }\n\n        int inIdx = inOffset + "+s+";\n        if ("+(1==u)+") {\n          vec4 values = vec4(\n            getValue(batch, inIdx),\n            initializationValue,\n            initializationValue,\n            initializationValue\n          );\n\n          int inIdxSeg = int(getSegmentIdAtIndex(inIdx));\n\n          vec4 segFilter = vec4(\n            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n            0,\n            0,\n            0\n          );\n\n          "+c+"\n        } else if ("+(2==u)+") {\n          vec4 values = vec4(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            initializationValue,\n            initializationValue\n          );\n\n          vec4 segFilter = vec4(\n            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n              0,\n              0\n          );\n\n          "+c+"\n        } else if ("+(3==u)+") {\n          vec4 values = vec4(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            getValue(batch, inIdx + 2),\n            initializationValue\n          );\n\n          vec4 segFilter = vec4(\n            int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n            int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n            0\n          );\n\n          "+c+"\n        }\n        setOutput(sumValue);\n      }\n    "},go=function(t,e,n){var r,i;if(this.variableNames=["c","a","b"],this.outputShape=e,4<n)throw Error("Where for rank "+n+" is not yet supported");if(1===n)r=i="resRC";else{for(var o=["resRC.x","resRC.y","resRC.z","resRC.w"],a=[],s=[],u=0;u<e.length;u++)s.push(""+o[u]),u<t&&a.push(""+o[u]);r=a.join(),i=s.join()}var c=mr(n);this.userCode="\n      void main() {\n        "+c+" resRC = getOutputCoords();\n        float cVal = getC("+r+");\n        if (cVal >= 1.0) {\n          setOutput(getA("+i+"));\n        } else {\n          setOutput(getB("+i+"));\n        }\n      }\n    "},yo=(bo.prototype.getCustomSetupFunc=function(n){var r=this;if(n.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+n.length+")");return function(t,e){null==r.startLoc&&(r.startLoc=t.getUniformLocationNoThrow(e,"start"),null==r.startLoc)||t.gl.uniform1iv(r.startLoc,n)}},bo),vo=["x","y","z","w","u","v"];function bo(t){this.variableNames=["source"],this.outputShape=t,this.rank=t.length;var e,n=mr(this.rank),r="uniform int start["+this.rank+"];",i=function(t){if(1===t)return"sourceLoc";if(t<=6)return vo.slice(0,t).map(function(t){return"sourceLoc."+t}).join(",");throw Error("Slicing for rank "+t+" is not yet supported")}(this.rank);e="\n        "+n+" sourceLoc;\n        "+n+" coords = getOutputCoords();\n        "+t.map(function(t,e){return"sourceLoc."+vo[e]+" = start["+e+"] + coords."+vo[e]+";"}).join("\n")+"\n      ",this.userCode="\n      "+r+"\n      void main() {\n        "+e+"\n        setOutput(getSource("+i+"));\n      }\n    "}var wo=function(t,e,n,r){this.variableNames=["x"];var i=n.filter(function(t,e){return-1===r.indexOf(e)});this.outputShape=i;var o=n.length,a=mr(n.length),s=mr(i.length),u="";if(1===o)u="coords * strides + begin";else{var c=0;u=n.map(function(t,e){return-1===r.indexOf(e)?(c++,1===i.length?"coords * strides["+e+"] + begin["+e+"]":"coords["+(c-1)+"] * strides["+e+"] + begin["+e+"]"):"begin["+e+"]"}).join(",")}this.userCode="\n      "+a+" begin = "+a+"("+t+");\n      "+a+" strides = "+a+"("+e+");\n\n      void main() {\n        "+s+" coords = getOutputCoords();\n        setOutput(getX("+u+"));\n      }\n    "},_o=(xo.prototype.acquireTexture=function(t,e,n){var r,i=Eo(e,n),o=So(t,i,n);if(o in this.freeTextures||(this.freeTextures[o]=[]),o in this.usedTextures||(this.usedTextures[o]=[]),0<this.freeTextures[o].length){this.numFreeTextures--,this.numUsedTextures++,this.log();var a=this.freeTextures[o].shift();return this.usedTextures[o].push(a),a}return this.numUsedTextures++,this.log(),i===Ar.PACKED_2X2_FLOAT32?r=this.gpgpu.createPackedMatrixTexture(t[0],t[1]):i===Ar.PACKED_2X2_FLOAT16?r=this.gpgpu.createFloat16PackedMatrixTexture(t[0],t[1]):i===Ar.UNPACKED_FLOAT32?r=this.gpgpu.createFloat32MatrixTexture(t[0],t[1]):i===Ar.UNPACKED_FLOAT16?r=this.gpgpu.createFloat16MatrixTexture(t[0],t[1]):i===Ar.PACKED_4X1_UNSIGNED_BYTE&&(r=this.gpgpu.createUnsignedBytesMatrixTexture(t[0],t[1])),this.usedTextures[o].push(r),r},xo.prototype.releaseTexture=function(t,e,n,r){if(null!=this.freeTextures){var i=So(e,Eo(n,r),r);i in this.freeTextures||(this.freeTextures[i]=[]),this.freeTextures[i].push(t),this.numFreeTextures++,this.numUsedTextures--;var o=this.usedTextures[i],a=o.indexOf(t);if(a<0)throw new Error("Cannot release a texture that was never provided by this texture manager");o.splice(a,1),this.log()}},xo.prototype.log=function(){if(this.logEnabled){var t=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",this.numFreeTextures+" / "+this.numUsedTextures,"("+t+")")}},xo.prototype.getNumUsedTextures=function(){return this.numUsedTextures},xo.prototype.getNumFreeTextures=function(){return this.numFreeTextures},xo.prototype.dispose=function(){var e=this;if(null!=this.freeTextures){for(var t in this.freeTextures)this.freeTextures[t].forEach(function(t){e.gpgpu.deleteMatrixTexture(t)});for(var t in this.usedTextures)this.usedTextures[t].forEach(function(t){e.gpgpu.deleteMatrixTexture(t)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0}},xo);function xo(t){this.gpgpu=t,this.numUsedTextures=0,this.numFreeTextures=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}function Eo(t,e){if(t===kr.UPLOAD)return e?Ar.PACKED_2X2_FLOAT32:Ar.UNPACKED_FLOAT32;if(t===kr.RENDER||null==t)return e?te.get("WEBGL_RENDER_FLOAT32_ENABLED")?Ar.PACKED_2X2_FLOAT32:Ar.PACKED_2X2_FLOAT16:te.get("WEBGL_RENDER_FLOAT32_ENABLED")?Ar.UNPACKED_FLOAT32:Ar.UNPACKED_FLOAT16;if(t===kr.DOWNLOAD||t===kr.PIXELS)return Ar.PACKED_4X1_UNSIGNED_BYTE;throw new Error("Unknown logical texture type "+t)}function So(t,e,n){return t[0]+"_"+t[1]+"_"+e+"_"+n}var No=function(t,e){this.variableNames=["A"];for(var n=new Array(t.length),r=0;r<n.length;r++)n[r]=t[r]*e[r];this.outputShape=n,this.rank=n.length;var i=mr(this.rank),o=function(t){var e=t.length;if(5<e)throw Error("Tile for rank "+e+" is not yet supported");if(1===e)return"imod(resRC, "+t[0]+")";for(var n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],r=[],i=0;i<t.length;i++)r.push("imod("+n[i]+", "+t[i]+")");return r.join()}(t);this.userCode="\n      void main() {\n        "+i+" resRC = getOutputCoords();\n        setOutput(getA("+o+"));\n      }\n    "};var Io=function(t,e){this.variableNames=["A"];for(var n=new Array(t.length),r=0;r<n.length;r++)n[r]=t[e[r]];this.outputShape=n,this.rank=n.length;var i=mr(this.rank),o=function(t){var e=t.length;if(6<e)throw Error("Transpose for rank "+e+" is not yet supported");for(var n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],r=new Array(e),i=0;i<t.length;i++)r[t[i]]=n[i];return r.join()}(e);this.userCode="\n    void main() {\n      "+i+" resRC = getOutputCoords();\n      setOutput(getA("+o+"));\n    }\n    "};var Oo=1.7580993408473768,ko=1.0507009873554805,Ao=(To.prototype.getCustomSetupFunc=function(){var n=this;return function(t,e){null==n.startLoc&&(n.startLoc=t.getUniformLocationNoThrow(e,"NAN"),null==n.startLoc)||t.gl.uniform1f(n.startLoc,NaN)}},To),Co="if (isNaN(x)) return x;",Po=Co+"\n  return (x < 0.0) ? 0.0 : x;\n";function To(t,e){this.variableNames=["A"],this.outputShape=t,this.userCode="\n      uniform float NAN;\n      float unaryOperation(float x) {\n        "+e+"\n      }\n\n      void main() {\n        float x = getAAtOutCoords();\n        float y = unaryOperation(x);\n\n        setOutput(y);\n      }\n    "}var Mo="return exp(x);",Ro="return x;",Do="\n  vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));\n\n  result.r = isNaN(x.r) ? x.r : result.r;\n  result.g = isNaN(x.g) ? x.g : result.g;\n  result.b = isNaN(x.b) ? x.b : result.b;\n  result.a = isNaN(x.a) ? x.a : result.a;\n\n  return result;\n",jo=(Lo.prototype.getCustomSetupFunc=function(){var n=this;return function(t,e){null==n.startLoc&&(n.startLoc=t.getUniformLocationNoThrow(e,"NAN"),null==n.startLoc)||t.gl.uniform1f(n.startLoc,NaN)}},Lo),Bo=function(t){this.variableNames=["A"],this.usesPackedTextures=!0;var e=(this.outputShape=t).length,n=eo("rc",e),r=mr(e),i=function(t,e){if(1===t)return"rc";for(var n="",r=0;r<t;r++)n+=e[r],r<t-1&&(n+=",");return n}(e,n),o=n.slice(-2),a=e<=1?"rc":"vec2("+o.join(",")+")";this.userCode="\n      void main() {\n        "+r+" rc = getOutputCoords();\n        vec4 packedInput = getA("+i+");\n\n        setOutput(getChannel(packedInput, "+a+"));\n      }\n    "};function Lo(t,e){this.variableNames=["A"],this.usesPackedTextures=!0,this.outputShape=t,this.userCode="\n      uniform float NAN;\n      vec4 unaryOperation(vec4 x) {\n        "+e+"\n      }\n\n      void main() {\n        vec4 x = getAAtOutCoords();\n        vec4 y = unaryOperation(x);\n\n        setOutput(y);\n      }\n    "}function Fo(_,x){return m(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c,l,f,h,p,d,m,g,y,v,b,w;return I(this,function(t){switch(t.label){case 0:if(e=Fe(_,"img","toPixels"),_ instanceof mt||(e=e.toInt()),2!==e.rank&&3!==e.rank)throw new Error("toPixels only supports rank 2 or 3 tensors, got rank "+e.rank+".");if(n=e.shape.slice(0,2),r=n[0],i=n[1],4<(o=2===e.rank?1:e.shape[2])||2===o)throw new Error("toPixels only supports depth of size 1, 3 or 4 but got "+o);return a=e.min(),s=e.max(),[4,a.data()];case 1:return u=t.sent()[0],[4,s.data()];case 2:if(c=t.sent()[0],a.dispose(),s.dispose(),"float32"===e.dtype){if(u<0||1<c)throw new Error("Tensor values for a float32 Tensor must be in the range [0 - 1] but got range ["+u+" - "+c+"].")}else{if("int32"!==e.dtype)throw new Error("Unsupported type for toPixels: "+e.dtype+". Please use float32 or int32 tensors.");if(u<0||255<c)throw new Error("Tensor values for a int32 Tensor must be in the range [0 - 255] but got range ["+u+" - "+c+"].")}return[4,e.data()];case 3:for(l=t.sent(),f="float32"===e.dtype?255:1,h=new Uint8ClampedArray(i*r*4),p=0;p<r*i;++p)y=g=m=d=void 0,1===o?(d=l[p]*f,m=l[p]*f,g=l[p]*f,y=255):3===o?(d=l[3*p]*f,m=l[3*p+1]*f,g=l[3*p+2]*f,y=255):4===o&&(d=l[4*p]*f,m=l[4*p+1]*f,g=l[4*p+2]*f,y=l[4*p+3]*f),h[0+(v=4*p)]=Math.round(d),h[1+v]=Math.round(m),h[2+v]=Math.round(g),h[3+v]=Math.round(y);return null!=x&&(x.width=i,x.height=r,b=x.getContext("2d"),w=new ImageData(h,i,r),b.putImageData(w,0,0)),e!==_&&e.dispose(),[2,h]}})})}var zo=Ue({fromPixels_:function(t,e){if(void 0===e&&(e=3),4<e)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");return te.engine.fromPixels(t,e)}}),Uo=Object.freeze({toPixels:Fo,fromPixels:zo});var Vo=Ue({concat_:function(t,n){void 0===n&&(n=0),C(1<=t.length,"Pass at least one tensor to concat");var e=ze(t,"tensors","concat");n=N(n,e[0].shape)[0];var r=Oe(e.map(function(t){return t.shape}),n);if(0===L(r))return Ge([],r);if(1===(e=e.filter(function(t){return 0<t.size})).length)return e[0];var i=e.map(function(t){return t.shape});!function(t,r){var i=t[0].length;t.forEach(function(t,e){C(t.length===i,"Error in concat"+i+"D: rank of tensors["+e+"] must be the same as the rank of the rest ("+i+")")}),C(0<=r&&r<i,"Error in concat"+i+"D: axis must be between 0 and "+(i-1)+".");var o=t[0];t.forEach(function(t,e){for(var n=0;n<i;n++)C(n===r||t[n]===o[n],"Error in concat"+i+"D: Shape of tensors["+e+"] ("+t+") does not match the shape of the rest ("+o+") along the non-concatenated axis "+e+".")})}(i,n);var o=e;return te.engine.runKernel(function(t){return t.concat(e,n)},o,function(t){var e=i.map(function(t){return t[n]});return Go(t,e,n).map(function(t){return function(){return t}})})}}),Wo=Ue({concat1d_:function(t){return Vo(t,0)}}),qo=Ue({concat2d_:function(t,e){return Vo(t,e)}}),Ho=Ue({concat3d_:function(t,e){return Vo(t,e)}}),$o=Ue({concat4d_:function(t,e){return Vo(t,e)}}),Go=Ue({split_:function(t,e,n){void 0===n&&(n=0);var r,i=Fe(t,"x","split");return n=N(n,i.shape)[0],r="number"==typeof e?(C(i.shape[n]%e==0,"Number of splits must evenly divide the axis."),new Array(e).fill(i.shape[n]/e)):(C(i.shape[n]===e.reduce(function(t,e){return t+e}),"The sum of sizes must match the size of the axis dimension."),e),te.engine.runKernel(function(t){return t.split(i,r,n)},{$x:i},function(t){return{$x:function(){return Vo(t,n)}}})}});"undefined"!=typeof window?window:void 0!==t||"undefined"!=typeof self&&self;function Ko(t,e){return t(e={exports:{}},e.exports),e.exports}var Xo=Ko(function(t){!function(t,e,n){function o(t,e){return e.c=t.c,e.s0=t.s0,e.s1=t.s1,e.s2=t.s2,e}function r(t,e){var n=new function(t){var r,e=this,n=(r=4022871197,function(t){t=t.toString();for(var e=0;e<t.length;e++){var n=.02519603282416938*(r+=t.charCodeAt(e));n-=r=n>>>0,r=(n*=r)>>>0,r+=4294967296*(n-=r)}return 2.3283064365386963e-10*(r>>>0)});e.next=function(){var t=2091639*e.s0+2.3283064365386963e-10*e.c;return e.s0=e.s1,e.s1=e.s2,e.s2=t-(e.c=0|t)},e.c=1,e.s0=n(" "),e.s1=n(" "),e.s2=n(" "),e.s0-=n(t),e.s0<0&&(e.s0+=1),e.s1-=n(t),e.s1<0&&(e.s1+=1),e.s2-=n(t),e.s2<0&&(e.s2+=1),n=null}(t),r=e&&e.state,i=n.next;return i.int32=function(){return 4294967296*n.next()|0},i.double=function(){return i()+11102230246251565e-32*(2097152*i()|0)},i.quick=i,r&&("object"==typeof r&&o(r,n),i.state=function(){return o(n,{})}),i}e&&e.exports?e.exports=r:this.alea=r}(0,t)}),Yo=Ko(function(t){!function(t,e,n){function o(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e}function r(t,e){function n(){return(r.next()>>>0)/4294967296}var r=new function(t){var e=this,n="";e.x=0,e.y=0,e.z=0,e.w=0,e.next=function(){var t=e.x^e.x<<11;return e.x=e.y,e.y=e.z,e.z=e.w,e.w^=e.w>>>19^t^t>>>8},t===(0|t)?e.x=t:n+=t;for(var r=0;r<n.length+64;r++)e.x^=0|n.charCodeAt(r),e.next()}(t),i=e&&e.state;return n.double=function(){do{var t=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&o(i,r),n.state=function(){return o(r,{})}),n}e&&e.exports?e.exports=r:this.xor128=r}(0,t)}),Zo=Ko(function(t){!function(t,e,n){function o(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e.v=t.v,e.d=t.d,e}function r(t,e){function n(){return(r.next()>>>0)/4294967296}var r=new function(t){var e=this,n="";e.next=function(){var t=e.x^e.x>>>2;return e.x=e.y,e.y=e.z,e.z=e.w,e.w=e.v,(e.d=e.d+362437|0)+(e.v=e.v^e.v<<4^t^t<<1)|0},e.x=0,e.y=0,e.z=0,e.w=0,t===((e.v=0)|t)?e.x=t:n+=t;for(var r=0;r<n.length+64;r++)e.x^=0|n.charCodeAt(r),r==n.length&&(e.d=e.x<<10^e.x>>>4),e.next()}(t),i=e&&e.state;return n.double=function(){do{var t=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&o(i,r),n.state=function(){return o(r,{})}),n}e&&e.exports?e.exports=r:this.xorwow=r}(0,t)}),Jo=Ko(function(t){!function(t,e,n){function o(t,e){return e.x=t.x.slice(),e.i=t.i,e}function r(t,e){null==t&&(t=+new Date);function n(){return(r.next()>>>0)/4294967296}var r=new function(t){var i=this;i.next=function(){var t,e,n=i.x,r=i.i;return t=n[r],e=(t^=t>>>7)^t<<24,e^=(t=n[r+1&7])^t>>>10,e^=(t=n[r+3&7])^t>>>3,e^=(t=n[r+4&7])^t<<7,t=n[r+7&7],e^=(t^=t<<13)^t<<9,n[r]=e,i.i=r+1&7,e},function(t,e){var n,r=[];if(e===(0|e))r[0]=e;else for(e=""+e,n=0;n<e.length;++n)r[7&n]=r[7&n]<<15^e.charCodeAt(n)+r[n+1&7]<<13;for(;r.length<8;)r.push(0);for(n=0;n<8&&0===r[n];++n);for(8==n?r[7]=-1:r[n],t.x=r,t.i=0,n=256;0<n;--n)t.next()}(i,t)}(t),i=e&&e.state;return n.double=function(){do{var t=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},n.int32=r.next,n.quick=n,i&&(i.x&&o(i,r),n.state=function(){return o(r,{})}),n}e&&e.exports?e.exports=r:this.xorshift7=r}(0,t)}),Qo=Ko(function(t){!function(t,e,n){function o(t,e){return e.i=t.i,e.w=t.w,e.X=t.X.slice(),e}function r(t,e){null==t&&(t=+new Date);function n(){return(r.next()>>>0)/4294967296}var r=new function(t){var o=this;o.next=function(){var t,e,n=o.w,r=o.X,i=o.i;return o.w=n=n+1640531527|0,e=r[i+34&127],t=r[i=i+1&127],e^=e<<13,t^=t<<17,e^=e>>>15,t^=t>>>12,e=r[i]=e^t,o.i=i,e+(n^n>>>16)|0},function(t,e){var n,r,i,o,a,s=[],u=128;for(e===(0|e)?(r=e,e=null):(e+="\0",r=0,u=Math.max(u,e.length)),i=0,o=-32;o<u;++o)e&&(r^=e.charCodeAt((o+32)%e.length)),0===o&&(a=r),r^=r<<10,r^=r>>>15,r^=r<<4,r^=r>>>13,0<=o&&(a=a+1640531527|0,i=0==(n=s[127&o]^=r+a)?i+1:0);for(128<=i&&(s[127&(e&&e.length||0)]=-1),i=127,o=512;0<o;--o)r=s[i+34&127],n=s[i=i+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[i]=r^n;t.w=a,t.X=s,t.i=i}(o,t)}(t),i=e&&e.state;return n.double=function(){do{var t=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},n.int32=r.next,n.quick=n,i&&(i.X&&o(i,r),n.state=function(){return o(r,{})}),n}e&&e.exports?e.exports=r:this.xor4096=r}(0,t)}),ta=Ko(function(t){!function(t,e,n){function o(t,e){return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e}function r(t,e){function n(){return(r.next()>>>0)/4294967296}var r=new function(t){var i=this,e="";i.next=function(){var t=i.b,e=i.c,n=i.d,r=i.a;return t=t<<25^t>>>7^e,e=e-n|0,n=n<<24^n>>>8^r,r=r-t|0,i.b=t=t<<20^t>>>12^e,i.c=e=e-n|0,i.d=n<<16^e>>>16^r,i.a=r-t|0},i.a=0,i.b=0,i.c=-1640531527,i.d=1367130551,t===Math.floor(t)?(i.a=t/4294967296|0,i.b=0|t):e+=t;for(var n=0;n<e.length+20;n++)i.b^=0|e.charCodeAt(n),i.next()}(t),i=e&&e.state;return n.double=function(){do{var t=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&o(i,r),n.state=function(){return o(r,{})}),n}e&&e.exports?e.exports=r:this.tychei=r}(0,t)}),ea=Ko(function(e){!function(s,u){var c,l=this,f=256,h=6,p="random",d=u.pow(f,h),m=u.pow(2,52),g=2*m,y=f-1;function t(t,e,n){function r(){for(var t=a.g(h),e=d,n=0;t<m;)t=(t+n)*f,e*=f,n=a.g(1);for(;g<=t;)t/=2,e/=2,n>>>=1;return(t+n)/e}var i=[],o=b(function t(e,n){var r,i=[],o=typeof e;if(n&&"object"==o)for(r in e)try{i.push(t(e[r],n-1))}catch(t){}return i.length?i:"string"==o?e:e+"\0"}((e=1==e?{entropy:!0}:e||{}).entropy?[t,w(s)]:null==t?function(){try{var t;return c&&(t=c.randomBytes)?t=t(f):(t=new Uint8Array(f),(l.crypto||l.msCrypto).getRandomValues(t)),w(t)}catch(t){var e=l.navigator,n=e&&e.plugins;return[+new Date,l,n,l.screen,w(s)]}}():t,3),i),a=new function(t){var e,n=t.length,a=this,r=0,i=a.i=a.j=0,o=a.S=[];for(n||(t=[n++]);r<f;)o[r]=r++;for(r=0;r<f;r++)o[r]=o[i=y&i+t[r%n]+(e=o[r])],o[i]=e;(a.g=function(t){for(var e,n=0,r=a.i,i=a.j,o=a.S;t--;)e=o[r=y&r+1],n=n*f+o[y&(o[r]=o[i=y&i+e])+(o[i]=e)];return a.i=r,a.j=i,n})(f)}(i);return r.int32=function(){return 0|a.g(4)},r.quick=function(){return a.g(4)/4294967296},r.double=r,b(w(a.S),s),(e.pass||n||function(t,e,n,r){return r&&(r.S&&v(r,a),t.state=function(){return v(a,{})}),n?(u[p]=t,e):t})(r,o,"global"in e?e.global:this==u,e.state)}function v(t,e){return e.i=t.i,e.j=t.j,e.S=t.S.slice(),e}function b(t,e){for(var n,r=t+"",i=0;i<r.length;)e[y&i]=y&(n^=19*e[y&i])+r.charCodeAt(i++);return w(e)}function w(t){return String.fromCharCode.apply(0,t)}if(u["seed"+p]=t,b(u.random(),s),e.exports){e.exports=t;try{c=ih(191)}catch(t){}}}([],Math)});ea.alea=Xo,ea.xor128=Yo,ea.xorwow=Zo,ea.xorshift7=Jo,ea.xor4096=Qo,ea.tychei=ta;var na=ea.alea,ra=(ia.prototype.nextValue=function(){if(!isNaN(this.nextVal)){var t=this.nextVal;return this.nextVal=NaN,t}for(var e,n,r=!1;!r;){for(var i=void 0,o=void 0,a=void 0;1<=(a=(i=2*this.random()-1)*i+(o=2*this.random()-1)*o)||0===a;);var s=Math.sqrt(-2*Math.log(a)/a);e=this.mean+this.stdDev*i*s,n=this.mean+this.stdDev*o*s,this.truncated&&!this.isValidTruncated(e)||(r=!0)}return this.truncated&&!this.isValidTruncated(n)||(this.nextVal=this.convertValue(n)),this.convertValue(e)},ia.prototype.convertValue=function(t){return null==this.dtype||"float32"===this.dtype?t:Math.round(t)},ia.prototype.isValidTruncated=function(t){return t<=this.upper&&t>=this.lower},ia);function ia(t,e,n,r,i){this.mean=t,this.stdDev=e,this.dtype=n,this.nextVal=NaN,this.truncated=r,this.truncated&&(this.upper=this.mean+2*this.stdDev,this.lower=this.mean-2*this.stdDev);var o=i||Math.random();this.random=na(o.toString())}function oa(e,n){return m(this,void 0,void 0,function(){return I(this,function(t){return Jt("tf.toPixels() is renamed to tf.browser.toPixels(), please switch to the new method as the old method will be removed in TensorFlow.js 1.0."),[2,Fo(e,n)]})})}function aa(t,e,n){return void 0===e&&(e="float32"),new ct(t,e=e||"float32",n)}function sa(t,e){void 0===e&&(e=!1),console.log(t.toString(e))}var ua=Ue({batchToSpaceND_:function(t,e,n){var r=Fe(t,"x","batchToSpaceND"),i=e.reduce(function(t,e){return t*e});return C(r.rank>=1+e.length,"input rank is "+r.rank+" but should be > than blockShape.length "+e.length),C(n.length===e.length,"crops.length is "+n.length+" but should be equal to blockShape.length  "+e.length),C(r.shape[0]%i==0,"input tensor batch is "+r.shape[0]+" but is not divisible by the product of the elements of blockShape "+e.join(" * ")+" === "+i),te.engine.runKernel(function(t){return t.batchToSpaceND(r,e,n)},{$x:r},function(t){return{$x:function(){return t.spaceToBatchND(e,n)}}})}}),ca=Ue({cast_:function(t,e){var n=Fe(t,"x","cast");return te.engine.runKernel(function(t){return t.cast(n,e)},{$x:n},function(t){return{$x:function(){return t.clone()}}})}}),la=Ue({clone_:function(t){var e=Fe(t,"x","clone",null);return te.engine.runKernel(function(t){return mt.make(e.shape,{dataId:e.dataId},e.dtype)},{$x:e},function(t){return{$x:function(){return t.toFloat()}}})}}),fa=Ue({cumsum_:function(t,e,n,r){void 0===e&&(e=0),void 0===n&&(n=!1),void 0===r&&(r=!1);var i=Fe(t,"x","cumsum"),o=Se([e|=0],i.rank),a=i;null!=o&&(a=i.transpose(o));var s=Ie(1,i.rank)[0],u=te.engine.runKernel(function(t){return t.cumsum(a,s,n,r)},{permutedX:a},function(t){return{permutedX:function(){return t.cumsum(e,n,!r)}}});return null!=o&&(u=u.transpose(o)),u}}),ha=Ue({depthToSpace_:function(t,e,n){void 0===n&&(n="NHWC");var r=Fe(t,"x","depthToSpace"),i="NHWC"===n?r.shape[1]:r.shape[2],o="NHWC"===n?r.shape[2]:r.shape[3],a="NHWC"===n?r.shape[3]:r.shape[1];return C(0<=i*e,"Negative dimension size caused by overflow when multiplying\n      "+i+" and "+e+"  for depthToSpace with input shape\n      "+r.shape),C(0<=o*e,"Negative dimension size caused by overflow when multiplying\n      "+o+" and "+e+" for depthToSpace with input shape\n          "+r.shape),C(a%(e*e)==0,"Dimension size must be evenly divisible by "+e*e+" but is "+a+" for depthToSpace with input shape "+r.shape),te.engine.runKernel(function(t){return t.depthToSpace(r,e,n)},{$x:r})}}),pa=Ue({expandDims_:function(t,e){void 0===e&&(e=0);var n=Fe(t,"x","expandDims");C(e<=n.rank,"Axis must be <= rank of the tensor");var r=n.shape.slice();return e<0&&(C(-(n.rank+1)<=e,"Axis must be in the interval ["+-(n.rank+1)+", "+n.rank+"]"),e=n.rank+e+1),r.splice(e,0,1),Ia(n,r)}}),da=Ue({eye_:function(t,e,n,r){void 0===r&&(r="float32"),null==e&&(e=t);for(var i=aa([t,e],r),o=t<=e?t:e,a=0;a<o;++a)i.set(1,a,a);var s=i.toTensor().as2D(t,e);if(null==n)return s;if(1===n.length)return Ca(pa(s,0),[n[0],1,1]);if(2===n.length)return Ca(pa(pa(s,0),0),[n[0],n[1],1,1]);if(3===n.length)return Ca(pa(pa(pa(s,0),0),0),[n[0],n[1],n[2],1,1]);throw new Error("eye() currently supports only 1D and 2D batchShapes, but received "+n.length+"D.")}}),ma=function(t,e){return void 0===e&&(e=3),Jt("tf.fromPixels() is renamed to tf.browser.fromPixels(), please switch to the new method as the old method will be removed in TensorFlow.js 1.0."),zo(t,e)},ga=Ue({multinomial_:function(t,e,n,r){void 0===r&&(r=!1);var i=Fe(t,"logits","multinomial"),o=i.size,a=i.rank;if(o<2)throw new Error("Error in multinomial: you need at least 2 outcomes, but got "+o+".");if(2<a)throw new Error("Rank of probabilities must be 1 or 2, but is "+a);n=n||Math.random();var s=1===a?i.as2D(1,-1):i,u=te.engine.runKernel(function(t){return t.multinomial(s,r,e,n)},{logits2D:s});return 1===a?u.as1D():u}}),ya=Ue({oneHot_:function(t,e,n,r){if(void 0===n&&(n=1),void 0===r&&(r=0),e<2)throw new Error("Error in oneHot: depth must be >=2, but it is "+e);var i=Fe(t,"indices","oneHot","int32"),o=i.shape.concat([e]);return i=i.flatten(),te.engine.runKernel(function(t){return t.oneHot(i,e,n,r)},{$indices:i},function(t){return{$indices:function(){return nn(i.shape,"float32")}}}).reshape(o)}}),va=Ue({pad_:function(t,e,n){void 0===n&&(n=0);var r=Fe(t,"x","pad");if(0===r.rank)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");var i=e.map(function(t){return t[0]});return te.engine.runKernel(function(t){return t.pad(r,e,n)},{$x:r},function(t){return{$x:function(){return t.slice(i,r.shape)}}})}}),ba=Ue({pad1d_:function(t,e,n){return void 0===n&&(n=0),C(2===e.length,"Invalid number of paddings. Must be length of 2."),va(t,[e],n)}}),wa=Ue({pad2d_:function(t,e,n){return void 0===n&&(n=0),C(2===e.length&&2===e[0].length&&2===e[1].length,"Invalid number of paddings. Must be length of 2 each."),va(t,e,n)}}),_a=Ue({pad3d_:function(t,e,n){return void 0===n&&(n=0),C(3===e.length&&2===e[0].length&&2===e[1].length&&2===e[2].length,"Invalid number of paddings. Must be length of 2 each."),va(t,e,n)}}),xa=Ue({pad4d_:function(t,e,n){return void 0===n&&(n=0),C(4===e.length&&2===e[0].length&&2===e[1].length&&2===e[2].length&&2===e[3].length,"Invalid number of paddings. Must be length of 2 each."),va(t,e,n)}}),Ea=Ue({rand_:function(t,e,n){var r=L(t),i=null;if(null==n||"float32"===n)i=new Float32Array(r);else if("int32"===n)i=new Int32Array(r);else{if("bool"!==n)throw new Error("Unknown data type "+n);i=new Uint8Array(r)}for(var o=0;o<r;o++)i[o]=e();return mt.make(t,{values:i},n)}}),Sa=Ue({randomNormal_:function(t,e,n,r,i){if(void 0===e&&(e=0),void 0===n&&(n=1),null!=r&&"bool"===r)throw new Error("Unsupported data type "+r);for(var o=new ra(e,n,r,!1,i),a=aa(t,r),s=0;s<a.values.length;s++)a.values[s]=o.nextValue();return a.toTensor()}}),Na=Ue({randomUniform_:function(t,e,n,r){void 0===e&&(e=0),void 0===n&&(n=1),void 0===r&&(r="float32");for(var i=aa(t,r),o=0;o<i.values.length;o++)i.values[o]=p(e,n);return i.toTensor()}}),Ia=Ue({reshape_:function(t,e){var n=Fe(t,"x","reshape",null);return e=E(e,n.size),C(n.size===L(e),"new shape and old shape must have the same number of elements."),te.engine.runKernel(function(t){return t.reshape(n,e)},{$x:n},function(t){return{$x:function(){return t.reshape(n.shape)}}})}}),Oa=Ue({spaceToBatchND_:function(t,r,i){var e=Fe(t,"x","spaceToBatchND");return C(e.rank>=1+r.length,"input rank "+e.rank+" should be > than [blockShape] "+r.length),C(i.length===r.length,"paddings.shape[0] "+i.length+" must be equal to [blockShape] "+r.length),C(e.shape.reduce(function(t,e,n){return 0<n&&n<=r.length?t&&(e+i[n-1][0]+i[n-1][1])%r[n-1]==0:t},!0),"input spatial dimensions "+e.shape.slice(1)+" with paddings "+i.toString()+" must be divisible by blockShapes "+r.toString()),te.engine.runKernel(function(t){return t.spaceToBatchND(e,r,i)},{$x:e},function(t){return{$x:function(){return t.batchToSpaceND(r,i)}}})}}),ka=Ue({squeeze_:function(t,e){var n=Fe(t,"x","squeeze");return Ia(n,O(n.shape,e).newShape)}}),Aa=Ue({stack_:function(t,e){void 0===e&&(e=0);var n=ze(t,"tensors","stack");if(C(1<=n.length,"Pass at least one tensor to tf.stack"),1===n.length)return n[0].expandDims(e);var r=n[0].rank,i=n[0].shape,o=n[0].dtype;C(e<=r,"Axis must be <= rank of the tensor"),n.forEach(function(t){d(i,t.shape,"All tensors passed to stack must have matching shapes")}),n.forEach(function(t){C(o===t.dtype,"All tensors passed to stack must have matching dtypes")});var a=n.map(function(t){return t.expandDims(e)});return Vo(a,e)}}),Ca=Ue({tile_:function(t,a){var s=Fe(t,"x","tile");return C(s.rank===a.length,"Error in transpose: rank of input "+s.rank+" must match length of reps "+a+"."),te.engine.runKernel(function(t){return t.tile(s,a)},{$x:s},function(o){return{$x:function(){var t=un(s);if(1===s.rank)for(var e=0;e<a[0];++e)t=t.add(o.slice([e*s.shape[0]],[s.shape[0]]));else if(2===s.rank)for(e=0;e<a[0];++e)for(var n=0;n<a[1];++n)t=t.add(o.slice([e*s.shape[0],n*s.shape[1]],[s.shape[0],s.shape[1]]));else if(3===s.rank)for(e=0;e<a[0];++e)for(n=0;n<a[1];++n)for(var r=0;r<a[2];++r)t=t.add(o.slice([e*s.shape[0],n*s.shape[1],r*s.shape[2]],[s.shape[0],s.shape[1],s.shape[2]]));else{if(4!==s.rank)throw new Error("Gradient for tile operation is not implemented for rank-"+s.rank+" tensors yet.");for(e=0;e<a[0];++e)for(n=0;n<a[1];++n)for(r=0;r<a[2];++r)for(var i=0;i<a[3];++i)t=t.add(o.slice([e*s.shape[0],n*s.shape[1],r*s.shape[2],i*s.shape[3]],[s.shape[0],s.shape[1],s.shape[2],s.shape[3]]))}return t}}})}}),Pa=Ue({truncatedNormal_:function(t,e,n,r,i){if(void 0===e&&(e=0),void 0===n&&(n=1),null!=r&&"bool"===r)throw new Error("Unsupported data type "+r);for(var o=new ra(e,n,r,!0,i),a=aa(t,r),s=0;s<a.values.length;s++)a.values[s]=o.nextValue();return a.toTensor()}}),Ta=Ue({unstack_:function(t,e){void 0===e&&(e=0),e=e||0;var n=Fe(t,"x","unstack");return C(e<n.shape.length,"Axis "+e+" is >= to tensor shape length "+n.shape.length),te.engine.runKernel(function(t){return t.unstack(n,e)},{$x:n},function(t){return{$x:function(){return Aa(t,e)}}})}}),Ma=function(f,h){return m(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c,l;return I(this,function(t){switch(t.label){case 0:return e=Fe(f,"x","setdiff1d"),n=Fe(h,"y","setdiff1d"),C(e.dtype===n.dtype,"x and y should have the same dtype, but got x ("+e.dtype+") and y ("+n.dtype+")."),C(1===e.rank,"x should be 1D tensor, but got x ("+e.shape+")."),C(1===n.rank,"y should be 1D tensor, but got y ("+n.shape+")."),[4,e.data()];case 1:return r=t.sent(),[4,n.data()];case 2:for(i=t.sent(),o=new Set(i),c=a=0;c<r.length;c++)o.has(r[c])||a++;for(s=new ct([a],e.dtype),u=new ct([a],"int32"),l=c=0;c<r.length;c++)o.has(r[c])||(s.values[l]=r[c],u.values[l]=c,l++);return[2,[s.toTensor(),u.toTensor()]]}})})};function Ra(t,e){for(var n=[],r=0;r<e.length;r++)e[r]&&n.push(r);var i=aa(t,"int32"),o=aa([n.length,t.length],"int32");for(r=0;r<n.length;r++){var a=i.indexToLoc(n[r]),s=r*t.length;o.values.set(a,s)}return o.toTensor()}function Da(t,e){if(void 0===e&&(e=!1),"linear"===t)return"return x;";if("relu"===t)return e?Do:Po;throw new Error("Activation "+t+" has not been implemented for the WebGL backend.")}var ja=(Ba.prototype.register=function(t,e,n){if(this.texData.has(t))throw new Error("Data buffer is already registered");this.texData.set(t,{shape:e,dtype:n})},Ba.prototype.setDataMover=function(t){this.texData=new cn(t)},Ba.prototype.fromPixels=function(t,e){if(null==t)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");var n=[t.height,t.width],r=[t.height,t.width,e];if(!(t instanceof HTMLVideoElement||t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof ImageData))throw new Error("pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement or ImageData, but was "+t.constructor.name);if(t instanceof HTMLVideoElement){if(null==this.fromPixels2DContext){if(!te.get("IS_BROWSER"))throw new Error("Can't read pixels from HTMLImageElement outside the browser.");if("complete"!==document.readyState)throw new Error("The DOM is not ready yet. Please call tf.fromPixels() once the DOM is ready. One way to do that is to add an event listener for `DOMContentLoaded` on the document object");this.fromPixels2DContext=document.createElement("canvas").getContext("2d")}this.fromPixels2DContext.canvas.width=t.width,this.fromPixels2DContext.canvas.height=t.height,this.fromPixels2DContext.drawImage(t,0,0,t.width,t.height),t=this.fromPixels2DContext.canvas}var i=this.makeTensorHandle(n,"int32");this.texData.get(i.dataId).usage=kr.PIXELS,this.gpgpu.uploadPixelDataToTexture(this.getTexture(i.dataId),t);var o=new Nr(r),a=this.compileAndRun(o,[i]);return this.disposeData(i.dataId),a},Ba.prototype.makeTensorHandle=function(t,e){var n={};return this.register(n,t,e),{dataId:n,shape:t,dtype:e}},Ba.prototype.write=function(t,e){if(null==e)throw new Error("MathBackendWebGL.write(): values can not be null");if(te.get("DEBUG"))for(var n=0;n<e.length;n++){var r=e[n];if(!Wr(r))throw Error("The value "+r+" cannot be represented on this device.")}var i=this.texData.get(t),o=i.texture,a=i.texShape,s=i.usage,u=i.dtype,c=i.isPacked;if("complex64"===u)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");null!=o&&(this.releaseTexture(t,o,a,s,c),i.texture=null,i.texShape=null),i.usage=kr.UPLOAD,i.values=e,this.delayedStorage||this.uploadToGPU(t)},Ba.prototype.readSync=function(t){var e=this.texData.get(t),n=e.values,r=e.dtype,i=e.complexTensors,o=e.slice,a=e.shape;if(null!=o){var s=new Ao(a,Ro),u=this.compileAndRun(s,[{dataId:t,shape:a,dtype:r}]),c=this.readSync(u.dataId);return u.dispose(),c}if(null!=n)return this.convertAndCacheOnCPU(t);if("string"===r)return n;var l,f,h=null!=this.activeTimers;return h&&(l=performance.now()),f="complex64"===r?mn(i.real.dataSync(),i.imag.dataSync()):this.getValuesFromTexture(t),h&&(this.downloadWaitMs+=performance.now()-l),this.convertAndCacheOnCPU(t,f)},Ba.prototype.read=function(N){return m(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c,l,f,h,p,d,m,g,y,v,b,w,_,x,E,S;return I(this,function(t){switch(t.label){case 0:if(this.pendingRead.has(N))return r=this.pendingRead.get(N),[2,new Promise(function(t){return r.push(t)})];if(i=this.texData.get(N),o=i.texture,a=i.values,s=i.texShape,u=i.isPacked,c=i.shape,l=i.slice,f=i.dtype,null!=l)return h=new Ao(c,Ro),p=this.compileAndRun(h,[{dataId:N,shape:c,dtype:f}]),d=this.read(p.dataId),p.dispose(),[2,d];if(null!=a)return[2,this.convertAndCacheOnCPU(N)];if(this.pendingRead.set(N,[]),!te.get("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&2===te.get("WEBGL_VERSION"))throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");return m=s[1],g=s[0],u&&(e=jr(s[0],s[1]),m=e[0],g=e[1]),y=this.gpgpu.maybeCreateBufferFromTexture(o,g,m),[4,this.gpgpu.createAndWaitForFence()];case 1:return t.sent(),v=y instanceof WebGLTexture?this.getValuesFromTexture(N):(b=L(c),u?(w=mi(c),x=_=1,c.length&&(n=gi(c),_=n[0],x=n[1]),this.gpgpu.downloadPackedMatrixFromBuffer(y,w,_,x,s[0],s[1]).subarray(0,b)):this.gpgpu.downloadFloat32MatrixFromBuffer(y,s[0],s[1]).subarray(0,b)),E=this.convertAndCacheOnCPU(N,v),S=this.pendingRead.get(N),this.pendingRead.delete(N),S.forEach(function(t){return t(E)}),this.pendingDisposal.has(N)&&(this.pendingDisposal.delete(N),this.disposeData(N)),[2,E]}})})},Ba.prototype.getValuesFromTexture=function(t){var e,n=this.texData.get(t),r=n.shape,i=n.dtype,o=n.texture,a=n.texShape,s=L(r);if(te.get("WEBGL_DOWNLOAD_FLOAT_ENABLED")){if(this.texData.get(t).isPacked){var u=mi(r),c=1,l=1;return r.length&&(c=(e=gi(r))[0],l=e[1]),this.gpgpu.downloadMatrixFromPackedTexture(o,u,c,l,a[0],a[1]).subarray(0,s)}return this.gpgpu.downloadFloat32MatrixFromOutputTexture(o,a[0],a[1]).subarray(0,s)}var f=this.makeTensorHandle(r,"float32");f.size=L(r),this.texData.get(f.dataId).usage=kr.DOWNLOAD;var h=new _r(r);this.compileAndRun(h,[{shape:r,dtype:i,dataId:t}],f,null,!1);var p=this.texData.get(f.dataId),d=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(p.texture,p.texShape[0],p.texShape[1]).subarray(0,s);return this.disposeData(f.dataId),d},Ba.prototype.time=function(u){return m(this,void 0,void 0,function(){var e,n,r,i,o,a,s;return I(this,function(t){switch(t.label){case 0:return e=this.activeTimers,r=!(n=[]),null==this.programTimersStack?(this.programTimersStack=n,r=!0):this.activeTimers.push(n),this.activeTimers=n,u(),i=y(this.activeTimers.map(function(t){return t.query})).filter(function(t){return null!=t}),o=y(this.activeTimers.map(function(t){return t.name})).filter(function(t){return null!=t}),this.activeTimers=e,r&&(this.programTimersStack=null),[4,Promise.all(i)];case 1:return a=t.sent(),s={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:h(a),getExtraProfileInfo:function(){return a.map(function(t,e){return{name:o[e],ms:t}}).map(function(t){return t.name+": "+t.ms}).join(", ")},wallMs:null},this.uploadWaitMs=0,this.downloadWaitMs=0,[2,s]}})})},Ba.prototype.memory=function(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU}},Ba.prototype.startTimer=function(){return 0<te.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?this.gpgpu.beginQuery():{startMs:performance.now(),endMs:null}},Ba.prototype.endTimer=function(t){return 0<te.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?this.gpgpu.endQuery():t.endMs=performance.now(),t},Ba.prototype.getQueryTime=function(n){return m(this,void 0,void 0,function(){var e;return I(this,function(t){return 0<te.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?[2,this.gpgpu.waitForQueryAndGetTime(n)]:[2,(e=n).endMs-e.startMs]})})},Ba.prototype.disposeData=function(t){if(!this.pendingDisposal.has(t))if(this.pendingRead.has(t))this.pendingDisposal.add(t);else if(this.texData.has(t)){var e=this.texData.get(t),n=e.texture,r=e.texShape,i=e.usage,o=e.complexTensors,a=e.isPacked,s=e.slice;if(null!=n){var u=s&&s.origDataId||t,c=this.dataRefCount.get(u);1<c?this.dataRefCount.set(u,c-1):(this.dataRefCount.delete(u),this.releaseTexture(t,n,r,i,a),this.texData.delete(t))}null!=o&&(o.real.dispose(),o.imag.dispose())}},Ba.prototype.getTexture=function(t){return this.uploadToGPU(t),this.texData.get(t).texture},Ba.prototype.getCPUBackend=function(){return te.get("WEBGL_CPU_FORWARD")?(null==this.cpuBackend&&(this.cpuBackend=te.findBackend("cpu")),this.cpuBackend):null},Ba.prototype.shouldExecuteOnCPU=function(t,e){var n=this;return void 0===e&&(e=10),null!=this.getCPUBackend()&&t.every(function(t){return null==n.texData.get(t.dataId).texture&&t.size<e})},Ba.prototype.getGPGPUContext=function(){return this.gpgpu},Ba.prototype.getCanvas=function(){return this.canvas},Ba.prototype.complex=function(t,e){var n=this.makeOutputArray(t.shape,"complex64");return this.texData.get(n.dataId).complexTensors={real:te.engine.keep(t.clone()),imag:te.engine.keep(e.clone())},n},Ba.prototype.real=function(t){return this.texData.get(t.dataId).complexTensors.real.clone()},Ba.prototype.imag=function(t){return this.texData.get(t.dataId).complexTensors.imag.clone()},Ba.prototype.slice=function(t,e,n){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.slice(t,e,n);var r=this.texData.get(t.dataId).isPacked,i=De(t.shape,e,n);if(!r&&i)return this.uploadToGPU(t.dataId),this.shallowSlice(t,e,n);var o=new yo(n),a=o.getCustomSetupFunc(e);return this.compileAndRun(o,[t],null,a)},Ba.prototype.shallowSlice=function(t,e,n){var r=this.texData.get(t.dataId),i=mt.make(n,{},t.dtype),o=this.texData.get(i.dataId);Object.assign(o,r),o.shape=n,o.dtype=t.dtype;var a=je(e,t.strides);r.slice&&(a+=r.slice.flatOffset),o.slice={flatOffset:a,origDataId:r.slice&&r.slice.origDataId||t.dataId};var s=this.dataRefCount.get(o.slice.origDataId)||1;return this.dataRefCount.set(o.slice.origDataId,s+1),i},Ba.prototype.stridedSlice=function(t,e,n,r,i,o,a,s,u){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.stridedSlice(t,e,n,r,i,o,a,s,u);var c=Te(t.shape,e,n,r,i,o,a,s,u),l=c[0],f=c[1],h=c[2],p=f.filter(function(t,e){return-1===h.indexOf(e)});if(p.some(function(t){return 0===t}))return Ge([],p);var d=new wo(l,r,f,h);return this.compileAndRun(d,[t])},Ba.prototype.reverse=function(t,e){var n=new ho(t.shape,e);return this.compileAndRun(n,[t])},Ba.prototype.concat=function(t,e){if(this.shouldExecuteOnCPU(t))return this.cpuBackend.concat(t,e);if(1===t.length)return t[0];if(t.length>te.get("WEBGL_MAX_TEXTURES_IN_SHADER")){var n=Math.floor(t.length/2),r=this.concat(t.slice(0,n),e),i=this.concat(t.slice(n),e);return this.concat([r,i],e)}var o=Oe(t.map(function(t){return t.shape}),e),a=t.map(function(t){return t.as2D(-1,L(t.shape.slice(e)))}),s=new Fn(a.map(function(t){return t.shape}));return this.compileAndRun(s,a).reshape(o)},Ba.prototype.neg=function(t){var e=new Ao(t.shape,"return -x;");return this.compileAndRun(e,[t])},Ba.prototype.batchMatMul=function(t,e,n,r){var i=n?t.shape[2]:t.shape[1],o=r?e.shape[1]:e.shape[2],a=n?t.shape[1]:t.shape[2],s=t.shape[0];if((1===i||1===o)&&1e3<a){n&&(t=t.transpose([0,2,1])),r&&(e=e.transpose([0,2,1]));var u=1===o?t:t.as3D(s,a,1),c=1===o?2:1,l=1===o?e.as3D(s,1,a):e;return this.multiply(u,l).sum(c,!0)}var f=Tt(t.dtype,e.dtype);if(1!==s)return d=new Yi(t.shape,e.shape,n,r),m=this.makeOutputArray(d.outputShape,f),this.compileAndRun(d,[t,e],m);var h=t.as2D(t.shape[1],t.shape[2]),p=e.as2D(e.shape[1],e.shape[2]),d=new Zi(h.shape,p.shape,[i,o],n,r),m=this.makePackedTensor(d.outputShape,f),g=this.compileAndRun(d,[h,p],m);return g.reshape([1,g.shape[0],g.shape[1]])},Ba.prototype.fusedBatchMatMul=function(t,e,n,r,i,o){var a=n?t.shape[2]:t.shape[1],s=r?e.shape[1]:e.shape[2],u=t.shape[0],c=Tt(t.dtype,e.dtype);if(1!==u)return h=new Yi(t.shape,e.shape,n,r,!!i,o?Da(o):null),d=[t,e],i&&d.push(i),p=this.makeOutputArray(h.outputShape,c),this.compileAndRun(h,d,p);var l=t.as2D(t.shape[1],t.shape[2]),f=e.as2D(e.shape[1],e.shape[2]),h=new Zi(l.shape,f.shape,[a,s],n,r,!!i,o?Da(o,!0):null),p=this.makePackedTensor(h.outputShape,c),d=[l,f];i&&d.push(i);var m=this.compileAndRun(h,d,p);return m.reshape([1,m.shape[0],m.shape[1]])},Ba.prototype.multiply=function(t,e){if("complex64"===t.dtype){var n=this.texData.get(t.dataId),r=this.texData.get(e.dataId),i=new Cn(kn,t.shape,e.shape),o=new Cn(An,t.shape,e.shape),a=[this.makeComplexComponentTensorHandle(t,n.complexTensors.real),this.makeComplexComponentTensorHandle(t,n.complexTensors.imag),this.makeComplexComponentTensorHandle(e,r.complexTensors.real),this.makeComplexComponentTensorHandle(e,r.complexTensors.imag)],s=this.compileAndRun(i,a),u=this.compileAndRun(o,a),c=this.complex(s,u);return s.dispose(),u.dispose(),c}if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.multiply(t,e);if(te.get("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,Mn,t.dtype);var l=new Rn(Mn,t.shape,e.shape),f=this.makeOutputArray(l.outputShape,t.dtype);return this.compileAndRun(l,[t,e],f)},Ba.prototype.batchNormalization=function(t,e,n,r,i,o){var a=[t,e,n],s=null;null!=o&&(s=o.shape,a.push(o));var u=null;if(null!=i&&(u=i.shape,a.push(i)),te.get("WEBGL_PACK_BATCHNORMALIZATION")){var c=new On(t.shape,e.shape,n.shape,s,u,r);return this.compileAndRun(c,a)}var l=new In(t.shape,e.shape,n.shape,s,u,r);return this.compileAndRun(l,a)},Ba.prototype.localResponseNormalization4D=function(t,e,n,r,i){var o=new Gi(t.shape,e,n,r,i);return this.compileAndRun(o,[t])},Ba.prototype.LRNGrad=function(t,e,n,r,i,o,a){var s=new Ki(e.shape,r,i,o,a);return this.compileAndRun(s,[e,n,t])},Ba.prototype.tile=function(t,e){var n=new No(t.shape,e);return this.compileAndRun(n,[t])},Ba.prototype.pad=function(t,e,n){var r=te.get("WEBGL_PACK_ARRAY_OPERATIONS")?new io(t.shape,e,n):new ro(t.shape,e,n);return this.compileAndRun(r,[t])},Ba.prototype.transpose=function(t,e){var n=new Io(t.shape,e);return this.compileAndRun(n,[t])},Ba.prototype.gather=function(t,e,n){var r=new Ir(t.shape,e.size,n);return this.compileAndRun(r,[t,e])},Ba.prototype.batchToSpaceND=function(t,e,n){C(t.rank<=4,"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet");var r=e.reduce(function(t,e){return t*e}),i=me(t.shape,e,r),o=ge(i.length,e.length),a=ye(t.shape,e,r),s=ve(n,e.length),u=be(a,n,e.length);return t.reshape(i).transpose(o).reshape(a).slice(s,u)},Ba.prototype.spaceToBatchND=function(t,e,n){C(t.rank<=4,"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet");var r=e.reduce(function(t,e){return t*e}),i=[[0,0]];i.push.apply(i,n);for(var o=1+e.length;o<t.shape.length;++o)i.push([0,0]);var a=t.pad(i),s=me(a.shape,e,r,!1),u=ge(s.length,e.length,!1),c=ye(a.shape,e,r,!1);return a.reshape(s).transpose(u).reshape(c)},Ba.prototype.reduce=function(t,e,n){var r=t.shape[0],i=t.shape[1],o=Ae(i),a=new ao({windowSize:o,inSize:i,batchSize:r},e),s=a.outputShape,u=s[0],c=s[1],l=this.makeOutputArray([u,c],n);return this.compileAndRun(a,[t],l),1===l.shape[1]?l:this.reduce(l,e,n)},Ba.prototype.argReduce=function(t,e,n){void 0===n&&(n=null);var r=t.shape[0],i=t.shape[1];null!=n&&(r=n.shape[0],i=n.shape[1]);var o=Ae(i),a=new _n({windowSize:o,inSize:i,batchSize:r},e,null==n),s=a.outputShape,u=s[0],c=s[1],l=this.makeOutputArray([u,c],"int32"),f=[t];return null!=n&&f.push(n),this.compileAndRun(a,f,l),1===l.shape[1]?l:this.argReduce(t,e,l)},Ba.prototype.sum=function(t,e){Ee("sum",e,t.rank);var n=_e(t.shape,e),r=n[0],i=L(n[1]),o=t.as2D(-1,i),a=Mt(t.dtype);return this.reduce(o,"sum",a).reshape(r)},Ba.prototype.prod=function(t,e){var n=_e(t.shape,e),r=n[0],i=L(n[1]),o=t.as2D(-1,i),a=Mt(t.dtype);return this.reduce(o,"prod",a).reshape(r)},Ba.prototype.unsortedSegmentSum=function(t,e,n){var r=0,i=Se([r],t.rank),o=t;null!=i&&(o=t.transpose(i),r=Ie(1,t.rank)[0]);var a=function(t,e,n){for(var r=[],i=t.length,o=0;o<i;o++)o!==e?r.push(t[o]):r.push(n);return r}(o.shape,r,n),s=L([o.shape[r]]),u=o.as2D(-1,s),c=Mt(t.dtype),l=this.segOpCompute(u,"unsortedSegmentSum",e,c,n).reshape(a);return null!=i&&(l=l.transpose(Ne(i))),l},Ba.prototype.segOpCompute=function(t,e,n,r,i){var o=t.shape[0],a=t.shape[1],s=function(t,e){var n,r=!1;for(t<=30?(n=t,r=!0):n=q(t,Math.floor(Math.sqrt(t)));!r;){if(e<n||n===t){r=!0;break}n=q(t,n+1)}return n}(a,i),u=new mo({windowSize:s,inSize:a,batchSize:o,numSegments:i},e),c=u.outputShape,l=c[0],f=c[1],h=this.makeOutputArray([l,f],r);return this.compileAndRun(u,[t,n],h),h.shape[1]===i?h:(n=an(0,i).tile([a/s]),this.segOpCompute(h,e,n,r,i))},Ba.prototype.argMin=function(t,e){var n=[e];Ee("argMin",n,t.rank);var r=_e(t.shape,n),i=r[0],o=L(r[1]),a=t.as2D(-1,o);return this.argReduce(a,"min").reshape(i)},Ba.prototype.argMax=function(t,e){var n=[e];Ee("argMax",n,t.rank);var r=_e(t.shape,n),i=r[0],o=L(r[1]),a=t.as2D(-1,o);return this.argReduce(a,"max").reshape(i)},Ba.prototype.cumsum=function(t,e,n,r){if(e!==t.rank-1)throw new Error("WebGL cumsum shader expects an inner-most axis="+(t.rank-1)+" but got axis="+e);var i=new vr(t.shape,n,r);return this.compileAndRun(i,[t])},Ba.prototype.equal=function(t,e){var n=new Rn("return float(a == b);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},Ba.prototype.notEqual=function(t,e){var n=new Rn("return float(a != b);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},Ba.prototype.less=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.less(t,e);var n=new Rn("return float(a < b);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},Ba.prototype.lessEqual=function(t,e){var n=new Rn("return float(a <= b);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},Ba.prototype.greater=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.greater(t,e);var n=new Rn("return float(a > b);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},Ba.prototype.greaterEqual=function(t,e){var n=new Rn("return float(a >= b);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},Ba.prototype.logicalNot=function(t){var e=new Ao(t.shape,"return float(!(x >= 1.0));");return this.compileAndRun(e,[t])},Ba.prototype.logicalAnd=function(t,e){var n=new Rn("return float(a >= 1.0 && b >= 1.0);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},Ba.prototype.logicalOr=function(t,e){var n=new Rn("return float(a >= 1.0 || b >= 1.0);",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[t,e],r)},Ba.prototype.select=function(t,e,n){var r=new go(t.rank,e.shape,e.rank),i=this.makeOutputArray(r.outputShape,Tt(e.dtype,n.dtype));return this.compileAndRun(r,[t,e,n],i)},Ba.prototype.where=function(t){de("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");var e=t.dataSync();return Ra(t.shape,e)},Ba.prototype.topk=function(t,e,n){return wn(t.dataSync(),t.shape,t.dtype,e)},Ba.prototype.min=function(t,e){Ee("min",e,t.rank);var n=_e(t.shape,e),r=n[0],i=L(n[1]),o=t.as2D(-1,i);return this.reduce(o,"min",o.dtype).reshape(r)},Ba.prototype.minimum=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.minimum(t,e);var n=new Rn("\n  if (isNaN(a)) return a;\n  if (isNaN(b)) return b;\n\n  return min(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},Ba.prototype.mod=function(t,e){var n=new Rn("if (b == 0.0) return NAN;\n  return mod(a, b);",t.shape,e.shape),r=n.getCustomSetupFunc();return this.compileAndRun(n,[t,e],null,r)},Ba.prototype.max=function(t,e){Ee("max",e,t.rank);var n=_e(t.shape,e),r=n[0],i=L(n[1]),o=t.as2D(-1,i);return this.reduce(o,"max",o.dtype).reshape(r)},Ba.prototype.maximum=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.maximum(t,e);var n=new Rn("\n  if (isNaN(a)) return a;\n  if (isNaN(b)) return b;\n\n  return max(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},Ba.prototype.all=function(t,e){Ee("all",e,t.rank);var n=_e(t.shape,e),r=n[0],i=L(n[1]),o=t.as2D(-1,i);return this.reduce(o,"all",o.dtype).reshape(r)},Ba.prototype.any=function(t,e){Ee("any",e,t.rank);var n=_e(t.shape,e),r=n[0],i=L(n[1]),o=t.as2D(-1,i);return this.reduce(o,"any",o.dtype).reshape(r)},Ba.prototype.squaredDifference=function(t,e){var n=new Rn("return (a - b) * (a - b);",t.shape,e.shape);return this.compileAndRun(n,[t,e])},Ba.prototype.realDivide=function(t,e){if(te.get("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n  // vec4 one = vec4(equal(a, b));\n  // return one + (vec4(1.0) - one) * a / b;\n  vec4 result = a / b;\n  result.x = a.x == b.x ? 1. : result.x;\n  result.y = a.y == b.y ? 1. : result.y;\n  result.z = a.z == b.z ? 1. : result.z;\n  result.w = a.w == b.w ? 1. : result.w;\n  return result;\n","float32");var n=new Rn("if (a == b) return 1.0;\n  return a / b;",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"float32");return this.compileAndRun(n,[t,e],r)},Ba.prototype.floorDiv=function(t,e){if(te.get("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n  vec4 resultSign = sign(a) * sign(b);\n  ivec4 ia = round(a);\n  ivec4 ib = round(b);\n  ivec4 result = ia / ib;\n  ivec4 amodb = ia - ib * result;\n\n  // Vectorize INT_DIV\n  // if (resultSign < 0.0 && amodb != 0) result -= 1;\n  // return float(result);\n  return vec4(result -\n     ivec4(lessThan(resultSign, vec4(0.0))) * ivec4(notEqual(amodb, ivec4(0))));\n","int32");var n=new Rn("\n  float resultSign = sign(a) * sign(b);\n  int ia = round(a);\n  int ib = round(b);\n  int result = ia / ib;\n  int amodb = ia - ib * result;\n\n  if (resultSign < 0.0 && amodb != 0) {\n    result -= 1;\n  }\n  return float(result);\n",t.shape,e.shape),r=this.makeOutputArray(n.outputShape,"int32");return this.compileAndRun(n,[t,e],r)},Ba.prototype.add=function(t,e){if("complex64"===t.dtype&&"complex64"===e.dtype)return this.complexSeparableBinaryOp(t,e,Pn);var n=Tt(t.dtype,e.dtype);if(te.get("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,Pn,n);var r=new Rn(Pn,t.shape,e.shape),i=this.makeOutputArray(r.outputShape,n);return this.compileAndRun(r,[t,e],i)},Ba.prototype.packedBinaryOp=function(t,e,n,r){var i=new Dn(n,t.shape,e.shape),o=this.makePackedTensor(i.outputShape,r);return this.compileAndRun(i,[t,e],o)},Ba.prototype.complexSeparableBinaryOp=function(s,u,c){var l=this,t=this.texData.get(s.dataId),e=this.texData.get(u.dataId),n=[[t.complexTensors.real,e.complexTensors.real],[t.complexTensors.imag,e.complexTensors.imag]].map(function(t){var e=t[0],n=t[1],r=new Rn(c,s.shape,u.shape),i=l.makeOutputArray(r.outputShape,Tt(e.dtype,n.dtype)),o=l.makeComplexComponentTensorHandle(s,e),a=l.makeComplexComponentTensorHandle(u,n);return l.compileAndRun(r,[o,a],i)}),r=n[0],i=n[1],o=this.complex(r,i);return r.dispose(),i.dispose(),o},Ba.prototype.makeComplexComponentTensorHandle=function(t,e){return{dataId:e.dataId,dtype:e.dtype,shape:t.shape}},Ba.prototype.addN=function(t){for(var e=t[0],n=1;n<t.length;n++)e=this.add(e,t[n]);return e},Ba.prototype.subtract=function(t,e){if("complex64"===t.dtype&&"complex64"===e.dtype)return this.complexSeparableBinaryOp(t,e,Tn);if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.subtract(t,e);var n=Tt(t.dtype,e.dtype);if(te.get("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,Tn,t.dtype);var r=new Rn(Tn,t.shape,e.shape),i=this.makeOutputArray(r.outputShape,n);return this.compileAndRun(r,[t,e],i)},Ba.prototype.pow=function(t,e){var n=te.get("WEBGL_PACK_BINARY_OPERATIONS"),r=n?new Dn("\n  // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.\n  vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1)));\n  vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);\n  vec4 result = multiplier * pow(abs(a), b);\n\n  vec4 isNaN = vec4(lessThan(a, vec4(0.0))) * vec4(lessThan(floor(b), b));\n  result.r = isNaN.r == 1.0 ? NAN : result.r;\n  result.g = isNaN.g == 1.0 ? NAN : result.g;\n  result.b = isNaN.b == 1.0 ? NAN : result.b;\n  result.a = isNaN.a == 1.0 ? NAN : result.a;\n\n  return result;\n",t.shape,e.shape):new Rn("\nif(a < 0.0 && floor(b) < b){\n  return NAN;\n}\nreturn (round(mod(b, 2.0)) != 1) ?\n    pow(abs(a), b) : sign(a) * pow(abs(a), b);\n",t.shape,e.shape),i=Tt(t.dtype,e.dtype),o=n?this.makePackedTensor(r.outputShape,i):this.makeOutputArray(r.outputShape,i),a=r.getCustomSetupFunc();return this.compileAndRun(r,[t,e],o,a)},Ba.prototype.ceil=function(t){var e=new Ao(t.shape,"return ceil(x);");return this.compileAndRun(e,[t])},Ba.prototype.floor=function(t){var e=new Ao(t.shape,"return floor(x);");return this.compileAndRun(e,[t])},Ba.prototype.sign=function(t){var e=new Ao(t.shape,"\n  if (isNaN(x)) { return 0.0; }\n  return sign(x);\n");return this.compileAndRun(e,[t])},Ba.prototype.round=function(t){var e=new Ao(t.shape,"\n  // OpenGL ES does not support round function.\n  // The algorithm is based on banker's rounding.\n  float base = floor(x);\n  if ((x - base) < 0.5) {\n    return floor(x);\n  } else if ((x - base) > 0.5) {\n    return ceil(x);\n  } else {\n    if (mod(base, 2.0) == 0.0) {\n      return base;\n    } else {\n      return base + 1.0;\n    }\n  }\n");return this.compileAndRun(e,[t])},Ba.prototype.exp=function(t){var e;return e=te.get("WEBGL_PACK")?new jo(t.shape,Mo):new Ao(t.shape,Mo),this.compileAndRun(e,[t])},Ba.prototype.expm1=function(t){var e=new Ao(t.shape,"return exp(x) - 1.0;");return this.compileAndRun(e,[t])},Ba.prototype.log=function(t){var e,n=(e=te.get("WEBGL_PACK")?new jo(t.shape,"\n  vec4 result = log(x);\n  vec4 isNaN = vec4(lessThan(x, vec4(0.0)));\n  result.r = isNaN.r == 1.0 ? NAN : result.r;\n  result.g = isNaN.g == 1.0 ? NAN : result.g;\n  result.b = isNaN.b == 1.0 ? NAN : result.b;\n  result.a = isNaN.a == 1.0 ? NAN : result.a;\n\n  return result;\n"):new Ao(t.shape,"if (x < 0.0) return NAN;\n  return log(x);")).getCustomSetupFunc();return this.compileAndRun(e,[t],null,n)},Ba.prototype.log1p=function(t){var e=new Ao(t.shape,"return log(1.0 + x);");return this.compileAndRun(e,[t])},Ba.prototype.sqrt=function(t){var e=new Ao(t.shape,"return sqrt(x);");return this.compileAndRun(e,[t])},Ba.prototype.rsqrt=function(t){var e=new Ao(t.shape,"return inversesqrt(x);");return this.compileAndRun(e,[t])},Ba.prototype.square=function(t){var e=new Ao(t.shape,"return x * x;");return this.compileAndRun(e,[t])},Ba.prototype.reciprocal=function(t){var e=new Ao(t.shape,"return 1.0 / x;");return this.compileAndRun(e,[t])},Ba.prototype.relu=function(t){var e;return e=te.get("WEBGL_PACK")?new jo(t.shape,Do):new Ao(t.shape,Po),this.compileAndRun(e,[t])},Ba.prototype.prelu=function(t,e){var n=new Rn("return (a < 0.) ? b * a : a;",t.shape,e.shape);return this.compileAndRun(n,[t,e])},Ba.prototype.elu=function(t){var e=new Ao(t.shape,"return (x >= 0.0) ? x : (exp(x) - 1.0);");return this.compileAndRun(e,[t])},Ba.prototype.eluDer=function(t,e){var n=new Rn("return (b >= 1.0) ? a : a * (b + 1.0);",t.shape,e.shape);return this.compileAndRun(n,[t,e])},Ba.prototype.selu=function(t){var e=new Ao(t.shape,"\n  // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.\n  // see: https://arxiv.org/abs/1706.02515\n  float scaleAlpha = 1.7580993408473768;\n  float scale = 1.0507009873554805;\n  return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n");return this.compileAndRun(e,[t])},Ba.prototype.int=function(t){var e=new Ao(t.shape,"return float(int(x));"),n=this.makeOutputArray(e.outputShape,"int32");return this.compileAndRun(e,[t],n)},Ba.prototype.clip=function(t,e,n){var r,i=(r=te.get("WEBGL_PACK_CLIP")?new Bn(t.shape):new jn(t.shape)).getCustomSetupFunc(e,n);return this.compileAndRun(r,[t],null,i)},Ba.prototype.abs=function(t){var e=new Ao(t.shape,"return abs(x);");return this.compileAndRun(e,[t])},Ba.prototype.complexAbs=function(t){var e=this.texData.get(t.dataId),n=new Ln(t.shape),r=[this.makeComplexComponentTensorHandle(t,e.complexTensors.real),this.makeComplexComponentTensorHandle(t,e.complexTensors.imag)];return this.compileAndRun(n,r)},Ba.prototype.sigmoid=function(t){var e=new Ao(t.shape,"return 1.0 / (1.0 + exp(-1.0 * x));");return this.compileAndRun(e,[t])},Ba.prototype.softplus=function(t){var e=new Ao(t.shape,"\n  float epsilon = 1.1920928955078125e-7;\n  float threshold = log(epsilon) + 2.0;\n\n  bool too_large = x > -threshold;\n  bool too_small = x < threshold;\n\n  float result;\n  float exp_x = exp(x);\n\n  if (too_large){\n    result = x;\n  }\n  else if (too_small){\n    result = exp_x;\n  }\n  else{\n    result = log(exp_x + 1.0);\n  }\n  return result;\n");return this.compileAndRun(e,[t])},Ba.prototype.sin=function(t){var e=new Ao(t.shape,"if (isNaN(x)) return x;\n  return sin(x);\n");return this.compileAndRun(e,[t])},Ba.prototype.cos=function(t){var e=new Ao(t.shape,"if (isNaN(x)) return x;\n  return cos(x);\n");return this.compileAndRun(e,[t])},Ba.prototype.tan=function(t){var e=new Ao(t.shape,"return tan(x);");return this.compileAndRun(e,[t])},Ba.prototype.asin=function(t){var e=new Ao(t.shape,"return asin(x);");return this.compileAndRun(e,[t])},Ba.prototype.acos=function(t){var e=new Ao(t.shape,"return acos(x);");return this.compileAndRun(e,[t])},Ba.prototype.atan=function(t){var e=new Ao(t.shape,"if (isNaN(x)) return x;\n  return atan(x);\n");return this.compileAndRun(e,[t])},Ba.prototype.atan2=function(t,e){var n=new Rn("\n  if (isNaN(a)) return a;\n  if (isNaN(b)) return b;\n\n  return atan(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},Ba.prototype.sinh=function(t){var e=new Ao(t.shape,"\n  float e2x = exp(x);\n  return (e2x - 1.0 / e2x) / 2.0;\n");return this.compileAndRun(e,[t])},Ba.prototype.cosh=function(t){var e=new Ao(t.shape,"\n  float e2x = exp(-x);\n  return (e2x + 1.0 / e2x) / 2.0;\n");return this.compileAndRun(e,[t])},Ba.prototype.tanh=function(t){var e=new Ao(t.shape,"\n  float e2x = exp(-2.0 * abs(x));\n  return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n");return this.compileAndRun(e,[t])},Ba.prototype.asinh=function(t){var e=new Ao(t.shape,"return log(x + sqrt(x * x + 1.0));");return this.compileAndRun(e,[t])},Ba.prototype.acosh=function(t){var e=new Ao(t.shape,"if (isNaN(x)) return x;\n  if (x < 1.0) return NAN;\n  return log(x + sqrt(x * x - 1.0));"),n=e.getCustomSetupFunc();return this.compileAndRun(e,[t],null,n)},Ba.prototype.atanh=function(t){var e=new Ao(t.shape,"if (isNaN(x)) return x;\n  if ((x < -1.0) || (x > 1.0)) return NAN;\n  return (log(1.0 + x) - log(1.0 - x)) / 2.0;"),n=e.getCustomSetupFunc();return this.compileAndRun(e,[t],null,n)},Ba.prototype.erf=function(t){var e=new Ao(t.shape,'\n  // Error function is calculated approximately with elementary function.\n  // See "Handbook of Mathematical Functions with Formulas,\n  // Graphs, and Mathematical Tables", Abramowitz and Stegun.\n  float p = 0.3275911;\n  float a1 = 0.254829592;\n  float a2 = -0.284496736;\n  float a3 = 1.421413741;\n  float a4 = -1.453152027;\n  float a5 = 1.061405429;\n\n  float t = 1.0 / (1.0 + p * x);\n  return 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x);\n');return this.compileAndRun(e,[t])},Ba.prototype.step=function(t,e){var n=new Ao(t.shape,function(t){return void 0===t&&(t=0),Co+"\n    return x > 0.0 ? 1.0 : float("+t+");\n  "}(e));return this.compileAndRun(n,[t])},Ba.prototype.conv2dWithIm2Row=function(t,e,n){var r=n.filterWidth,i=n.filterHeight,o=n.inChannels,a=n.outWidth,s=n.outHeight,u=r*i*o,c=s*a,l=[u,c],f=t.squeeze([0]),h=e.reshape([u,-1]),p=new $i(l,f.shape,n),d=this.compileAndRun(p,[f]),m=new Zi(d.shape,h.shape,[c,n.outChannels],!0,!1);return this.compileAndRun(m,[d,h]).reshape([1,s,a,n.outChannels])},Ba.prototype.conv2d=function(t,e,n){if(te.get("WEBGL_CONV_IM2COL")&&1===t.shape[0])return this.conv2dWithIm2Row(t,e,n);var r=new $n(n);return this.compileAndRun(r,[t,e])},Ba.prototype.conv2dDerInput=function(t,e,n){var r=new Un(n);return this.compileAndRun(r,[t,e])},Ba.prototype.conv2dDerFilter=function(t,e,n){var r=new zn(n);return this.compileAndRun(r,[t,e])},Ba.prototype.depthwiseConv2D=function(t,e,n){var r;return te.get("WEBGL_PACK_DEPTHWISECONV")&&n.strideWidth<=2&&n.outChannels/n.inChannels==1?(r=new Xn(n),this.compileAndRun(r,[t,e],this.makePackedTensor(n.outShape,t.dtype))):(r=new Kn(n),this.compileAndRun(r,[t,e]))},Ba.prototype.depthwiseConv2DDerInput=function(t,e,n){var r=new Hn(n);return this.compileAndRun(r,[t,e])},Ba.prototype.depthwiseConv2DDerFilter=function(t,e,n){var r=new qn(n);return this.compileAndRun(r,[t,e])},Ba.prototype.conv3d=function(t,e,n){var r=new Gn(n);return this.compileAndRun(r,[t,e])},Ba.prototype.conv3dDerInput=function(t,e,n){var r=new Wn(n);return this.compileAndRun(r,[t,e])},Ba.prototype.conv3dDerFilter=function(t,e,n){var r=new Vn(n);return this.compileAndRun(r,[t,e])},Ba.prototype.maxPool=function(t,e){var n=new oo(e,"max",!1),r=this.makeOutputArray(n.outputShape,t.dtype);return this.compileAndRun(n,[t],r)},Ba.prototype.avgPool=function(t,e){var n=new oo(e,"avg",!1),r=this.makeOutputArray(n.outputShape,"float32");return this.compileAndRun(n,[t],r)},Ba.prototype.maxPoolBackprop=function(t,e,n,r){var i=new oo(r,"max",!0),o=this.compileAndRun(i,[e]),a=new Xi(r),s=this.makeOutputArray(a.outputShape,e.dtype),u=this.compileAndRun(a,[t,o],s);return o.dispose(),u},Ba.prototype.avgPoolBackprop=function(t,e,n){var r=new xn(n),i=this.makeOutputArray(r.outputShape,e.dtype);return this.compileAndRun(r,[t],i)},Ba.prototype.cast=function(t,e){return pn(t,e,this)},Ba.prototype.unstack=function(t,e){for(var n=t.shape[e],r=new Array(t.rank-1),i=0,o=0;o<t.rank;o++)o!==e&&(r[i++]=t.shape[o]);var a=new Array(t.rank).fill(0),s=t.shape.slice();s[e]=1;var u=new Array(n);for(o=0;o<u.length;o++)u[a[e]=o]=this.slice(t,a,s).reshape(r);return u},Ba.prototype.reshape=function(t,e){return this.texData.get(t.dataId).isPacked&&!bi(t.shape,e)?this.packedReshape(t,e):dn(t,e)},Ba.prototype.resizeBilinear=function(t,e,n,r){var i=new co(t.shape,e,n,r);return this.compileAndRun(i,[t])},Ba.prototype.resizeBilinearBackprop=function(t,e,n){var r=new uo(t,e,n);return this.compileAndRun(r,[t])},Ba.prototype.resizeNearestNeighbor=function(t,e,n,r){var i=new fo(t.shape,e,n,r);return this.compileAndRun(i,[t])},Ba.prototype.resizeNearestNeighborBackprop=function(t,e,n){var r=new lo(t,e,n);return this.compileAndRun(r,[t])},Ba.prototype.multinomial=function(t,e,n,r){var i=e?t:Ve(t),o=i.shape[0],a=i.shape[1],s=new Ji(o,a,n),u=this.makeOutputArray(s.outputShape,"int32"),c=s.getCustomSetupFunc(r);return this.compileAndRun(s,[i],u,c)},Ba.prototype.oneHot=function(t,e,n,r){var i=new Qi(t.size,e,n,r);return this.compileAndRun(i,[t])},Ba.prototype.nonMaxSuppression=function(t,e,n,r,i){return de("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead"),yn(t.dataSync(),e.dataSync(),n,r,i)},Ba.prototype.cropAndResize=function(t,e,n,r,i,o){var a=new Yn(t.shape,e.shape,r,i,o);return this.compileAndRun(a,[t,e,n])},Ba.prototype.depthToSpace=function(t,e,n){C(1<e,"blockSize should be > 1 for depthToSpace, but was: "+e);var r=t.shape[0],i=("NHWC"===n?t.shape[1]:t.shape[2])*e,o=("NHWC"===n?t.shape[2]:t.shape[3])*e,a=("NHWC"===n?t.shape[3]:t.shape[1])/(e*e),s=new wr("NHWC"===n?[r,i,o,a]:[r,a,i,o],e,n);return this.compileAndRun(s,[t])},Ba.prototype.split=function(t,e,n){return bn(t,e,n)},Ba.prototype.scatterND=function(t,e,n){var r=Pe(0,t,n),i=r.sliceRank,o=r.numUpdates,a=r.sliceSize,s=r.strides,u=r.outputSize,c=[u/a,a],l=t.reshape([o,i]),f=e.reshape([o,a]);if(0===u)return dn(Ge([]),n);var h=Ke(0),p=new po(o,i,l.rank,f.rank,s,c);return this.compileAndRun(p,[f,l,h]).reshape(n)},Ba.prototype.sparseToDense=function(t,e,n,r){var i=Pe(0,t,n),o=i.sliceRank,a=i.numUpdates,s=i.strides,u=i.outputSize,c=new po(a,o,t.rank,e.rank,s,[u,1],!1);return this.compileAndRun(c,[e,t,r]).reshape(n)},Ba.prototype.fft=function(t){return this.fftImpl(t,!1)},Ba.prototype.ifft=function(t){return this.fftImpl(t,!0)},Ba.prototype.fftImpl=function(t,e){var n=this.texData.get(t.dataId),r=new Sr(xr,t.shape,e),i=new Sr(Er,t.shape,e),o=[this.makeComplexComponentTensorHandle(t,n.complexTensors.real),this.makeComplexComponentTensorHandle(t,n.complexTensors.imag)],a=this.compileAndRun(r,o),s=this.compileAndRun(i,o),u=this.complex(a,s).as2D(t.shape[0],t.shape[1]);return a.dispose(),s.dispose(),u},Ba.prototype.gatherND=function(t,e){var n=e.shape,r=n[n.length-1],i=ke(t,e),o=i[0],a=i[1],s=i[2],u=i[3],c=e.reshape([a,r]),l=t.reshape([t.size/s,s]),f=new Tr(r,u,[a,s]);return this.compileAndRun(f,[l,c]).reshape(o)},Ba.prototype.makeOutputArray=function(t,e){return mt.make(t,{},e)},Ba.prototype.makePackedTensor=function(t,e){var n=mt.make(t,{},e);return this.texData.get(n.dataId).isPacked=!0,n},Ba.prototype.unpackTensor=function(t){var e=new Bo(t.shape);return this.compileAndRun(e,[t],mt.make(e.outputShape,{},t.dtype))},Ba.prototype.packedReshape=function(t,e){var n=t.reshape([mi(t.shape)].concat(gi(t.shape))),r=[mi(e)].concat(gi(e)),i=new so(r,n.shape);return this.compileAndRun(i,[n]).reshape(e)},Ba.prototype.compileAndRun=function(o,t,e,n,r){var a=this;if(void 0===r&&(r=!0),null==e&&(e=o.usesPackedTextures?this.makePackedTensor(o.outputShape,t[0].dtype):this.makeOutputArray(o.outputShape,t[0].dtype)),0===e.size)return this.texData.get(e.dataId).values=k(e.dtype,0),e;var i=t.map(function(t){if("complex64"===t.dtype)throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");var e=a.texData.get(t.dataId);if(null==e.texture){if(!o.usesPackedTextures&&L(t.shape)<=te.get("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:t.shape,texData:null,isUniform:!0,uniformValues:a.readSync(t.dataId)};o.usesPackedTextures&&(e.isPacked=!0,e.shape=t.shape)}else if(!!e.isPacked!=!!o.usesPackedTextures){var n=void 0,r=void 0;r=e.isPacked?(n=new Bo(t.shape),a.compileAndRun(n,[t],mt.make(n.outputShape,{},t.dtype))):(n=new no(t.shape),a.compileAndRun(n,[t],a.makePackedTensor(t.shape,t.dtype))),e=a.texData.get(r.dataId),t=r}else if(e.isPacked&&!bi(e.shape,t.shape)){a.delayedStorage=!1;var i=t.dataSync();a.delayedStorage=!0,t=mt.make(t.shape,{values:i},t.dtype),(e=a.texData.get(t.dataId)).isPacked=!0}return a.uploadToGPU(t.dataId),{shape:t.shape,texData:e,isUniform:!1}});this.uploadToGPU(e.dataId);var s,u={shape:e.shape,texData:this.texData.get(e.dataId),isUniform:!1},c=function(t,e,n){var r="";e.concat(n).forEach(function(t){var e=null!=t.texData&&null!=t.texData.slice&&0<t.texData.slice.flatOffset,n=t.isUniform?"uniform":t.texData.texShape;r+=t.shape+"_"+n+"_"+e});var i=t.userCode;return t.constructor.name+"_"+r+"_"+i}(o,i,u),l=this.getAndSaveBinary(c,function(){return function(t,r,e,n){for(var i=r.userCode,o=e.map(function(t,e){var n={logicalShape:t.shape,texShape:t.isUniform?null:t.texData.texShape,isUniform:t.isUniform,isPacked:!t.isUniform&&t.texData.isPacked,flatOffset:null};return null!=t.texData&&null!=t.texData.slice&&0<t.texData.slice.flatOffset&&(n.flatOffset=t.texData.slice.flatOffset),{name:r.variableNames[e],shapeInfo:n}}),a=o.map(function(t){return t.shapeInfo}),s={logicalShape:n.shape,texShape:n.texData.texShape,isUniform:!1,isPacked:n.texData.isPacked,flatOffset:null},u=ir(o,s,i,r.usesPackedTextures),c=t.createProgram(u),l={},f=0;f<r.variableNames.length;f++){var h=r.variableNames[f];l[h]=t.getUniformLocation(c,h,!1),l["offset"+h]=t.getUniformLocation(c,"offset"+h,!1)}return{program:r,source:u,webGLProgram:c,uniformLocations:l,gpgpu:t,inShapeInfos:a,outShapeInfo:s}}(a.gpgpu,o,i,u)}),f=null!=this.activeTimers;f&&(s=this.startTimer()),function(a,t,e,n){Hi(a.inShapeInfos,t),Hi([a.outShapeInfo],[e]);var r=e.texData.texture,i=e.texData.texShape,s=a.gpgpu;e.texData.isPacked?s.setOutputPackedMatrixTexture(r,i[0],i[1]):s.setOutputMatrixTexture(r,i[0],i[1]),s.setProgram(a.webGLProgram),t.forEach(function(t,e){var n=a.program.variableNames[e],r=a.uniformLocations[n],i=a.uniformLocations["offset"+n];if(null!=r)if(t.isUniform)if(1===L(t.shape))s.gl.uniform1f(r,t.uniformValues[0]);else{var o=t.uniformValues;o instanceof Float32Array||(o=new Float32Array(o)),s.gl.uniform1fv(r,o)}else null!=t.texData.slice&&null!=i&&s.gl.uniform1i(i,t.texData.slice.flatOffset),s.setInputMatrixTexture(t.texData.texture,r,e)}),null!=n&&n(s,a.webGLProgram),s.executeProgram()}(l,i,u,n);var h=1024*te.get("WEBGL_NUM_MB_BEFORE_PAGING");if(r&&this.numBytesInGPU>h)for(var p=this.numBytesInGPU-h;0<p&&0<this.lruDataGPU.length;){var d=this.lruDataGPU.shift(),m=this.texData.get(d),g=m.shape,y=m.dtype;p-=this.computeBytes(g,y),this.read(d)}return f&&(s=this.endTimer(s),this.activeTimers.push({name:o.constructor.name,query:this.getQueryTime(s)})),te.get("WEBGL_LAZILY_UNPACK")||!this.texData.get(e.dataId).isPacked||o.isPackShader?e:this.unpackTensor(e)},Ba.prototype.getAndSaveBinary=function(t,e){return t in this.binaryCache||(this.binaryCache[t]=e()),this.binaryCache[t]},Ba.prototype.getTextureManager=function(){return this.textureManager},Ba.prototype.dispose=function(){if(!this.disposed){for(var t in this.binaryCache)this.gpgpu.deleteProgram(this.binaryCache[t].webGLProgram);this.textureManager.dispose(),this.canvas.remove(),null!=this.fromPixels2DContext&&this.fromPixels2DContext.canvas.remove(),this.gpgpuCreatedLocally&&this.gpgpu.dispose(),this.disposed=!0}},Ba.prototype.floatPrecision=function(){var n=this;return ce(function(){var t=te.get("DEBUG");te.set("DEBUG",!1);var e=n.abs(Ke(1e-8)).dataSync()[0];return te.set("DEBUG",t),0<e?32:16})},Ba.prototype.uploadToGPU=function(t){var e,n=this.texData.get(t),r=n.shape,i=n.values,o=n.texture,a=n.usage,s=n.isPacked;if(null==o){var u,c=null!=this.activeTimers;c&&(u=performance.now());var l=yi(r,s);n.texShape=l;var f=this.acquireTexture(t,l,a,s);if(n.texture=f,null!=i){if(s){var h=mi(r),p=1,d=1;r.length&&(p=(e=gi(r))[0],d=e[1]),this.gpgpu.uploadMatrixToPackedTexture(f,h,p,d,l[0],l[1],La(i))}else this.gpgpu.uploadMatrixToTexture(f,l[0],l[1],La(i));n.values=null,c&&(this.uploadWaitMs+=performance.now()-u)}}else te.get("WEBGL_NUM_MB_BEFORE_PAGING")<Number.POSITIVE_INFINITY&&0<=this.lruDataGPU.indexOf(t)&&(this.lruDataGPU.splice(this.lruDataGPU.indexOf(t),1),this.lruDataGPU.push(t))},Ba.prototype.convertAndCacheOnCPU=function(t,e){var n=this.delayedStorage,r=this.texData.get(t),i=r.texture,o=r.texShape,a=r.dtype,s=r.usage,u=r.isPacked;return n&&null!=i&&(this.releaseTexture(t,i,o,s,u),r.texture=null,r.texShape=null,r.isPacked=!1),r.usage=kr.UPLOAD,null!=e&&(r.values=function(t,e){if("float32"===e||"complex64"===e)return t;if("int32"!==e&&"bool"!==e)throw new Error("Unknown dtype "+e);for(var n="int32"===e?new Int32Array(t.length):new Uint8Array(t.length),r=0;r<n.length;++r)n[r]=Math.round(t[r]);return n}(e,a)),r.values},Ba.prototype.releaseTexture=function(t,e,n,r,i){var o=this.texData.get(t),a=o.shape,s=o.dtype;if(te.get("WEBGL_NUM_MB_BEFORE_PAGING")<Number.POSITIVE_INFINITY){var u=this.lruDataGPU.indexOf(t);0<=u&&this.lruDataGPU.splice(u,1)}this.numBytesInGPU-=this.computeBytes(a,s),this.textureManager.releaseTexture(e,n,r,i)},Ba.prototype.acquireTexture=function(t,e,n,r){var i=this.texData.get(t),o=i.shape,a=i.dtype;return te.get("WEBGL_NUM_MB_BEFORE_PAGING")<Number.POSITIVE_INFINITY&&this.lruDataGPU.push(t),this.numBytesInGPU+=this.computeBytes(o,a),this.textureManager.acquireTexture(e,n,r)},Ba.prototype.computeBytes=function(t,e){return L(t)*j(e)},Ba);function Ba(t,e){if(void 0===e&&(e=!0),this.gpgpu=t,this.delayedStorage=e,this.pendingRead=new WeakMap,this.pendingDisposal=new WeakSet,this.dataRefCount=new WeakMap,this.lruDataGPU=[],this.numBytesInGPU=0,this.uploadWaitMs=0,this.downloadWaitMs=0,this.binaryCache={},this.disposed=!1,te.get("WEBGL_VERSION")<1)throw new Error("WebGL is not supported on this device");if(null==t){var n=c(te.get("WEBGL_VERSION"));this.gpgpu=new Wi(n),this.canvas=n.canvas,this.gpgpuCreatedLocally=!0}else this.gpgpuCreatedLocally=!1,this.canvas=t.gl.canvas;this.textureManager=new _o(this.gpgpu)}function La(t){return t instanceof Float32Array?t:new Float32Array(t)}te.get("IS_BROWSER")&&te.registerBackend("webgl",function(){return new ja},2,dt);var Fa=Ue({abs_:function(t){var e=Fe(t,"x","abs");return"complex64"===e.dtype?te.engine.runKernel(function(t){return t.complexAbs(e)},{$x:e}):te.engine.runKernel(function(t){return t.abs(e)},{$x:e},function(t){return{$x:function(){return t.mulStrict(e.toFloat().step(-1))}}})}}),za=Ue({acos_:function(t){var e=Fe(t,"x","acos");return te.engine.runKernel(function(t){return t.acos(e)},{$x:e},function(t){return{$x:function(){return t.divStrict(Ke(1).sub(e.toFloat().square()).sqrt()).neg()}}})}}),Ua=Ue({acosh_:function(t){var e=Fe(t,"x","acosh");return te.engine.runKernel(function(t){return t.acosh(e)},{$x:e},function(t){return{$x:function(){return t.divStrict(e.toFloat().square().sub(1).sqrt())}}})}}),Va=Ue({asin_:function(t){var e=Fe(t,"x","asin");return te.engine.runKernel(function(t){return t.asin(e)},{$x:e},function(t){return{$x:function(){return t.divStrict(Ke(1).sub(e.toFloat().square()).sqrt())}}})}}),Wa=Ue({asinh_:function(t){var e=Fe(t,"x","asinh");return te.engine.runKernel(function(t){return t.asinh(e)},{$x:e},function(t){return{$x:function(){return t.divStrict(Ke(1).add(e.toFloat().square()).sqrt())}}})}}),qa=Ue({atan_:function(t){var e=Fe(t,"x","atan");return te.engine.runKernel(function(t){return t.atan(e)},{$x:e},function(t){return{$x:function(){return t.div(e.toFloat().square().add(1))}}})}}),Ha=Ue({atanh_:function(t){var e=Fe(t,"x","atanh");return te.engine.runKernel(function(t){return t.atanh(e)},{$x:e},function(t){return{$x:function(){return t.div(Ke(1).sub(e.toFloat().square()))}}})}}),$a=Ue({ceil_:function(t){var e=Fe(t,"x","ceil");return te.engine.runKernel(function(t){return t.ceil(e)},{$x:e},function(t){return{$x:function(){return un(t)}}})}}),Ga=Ue({clipByValue_:function(t,e,n){var r=Fe(t,"x","clipByValue");return C(e<=n,"Error in clip: min ("+e+") must be less than or equal to max ("+n+")."),te.engine.runKernel(function(t){return t.clip(r,e,n)},{$x:r},function(t){return{$x:function(){return t.where(r.greaterEqual(e).logicalAnd(r.lessEqual(n)),un(t))}}})}}),Ka=Ue({cos_:function(t){var e=Fe(t,"x","cos");return te.engine.runKernel(function(t){return t.cos(e)},{$x:e},function(t){return{$x:function(){return e.toFloat().sin().neg().mulStrict(t)}}})}}),Xa=Ue({cosh_:function(t){var e=Fe(t,"x","cosh");return te.engine.runKernel(function(t){return t.cosh(e)},{$x:e},function(t){return{$x:function(){return e.toFloat().sinh().mulStrict(t)}}})}}),Ya=Ue({erf_:function(t){var e=Fe(t,"x","erf");return C("int32"===e.dtype||"float32"===e.dtype,"Input dtype must be `int32` or `float32`."),"int32"===e.dtype&&(e=e.toFloat()),te.engine.runKernel(function(t){return t.erf(e)},{$x:e},function(t){return{$x:function(){return t.mul(e.square().neg().exp().mul(2/Math.sqrt(Math.PI)))}}})}}),Za=Ue({exp_:function(t){var n=Fe(t,"x","exp");return te.engine.runKernel(function(t,e){return e(t.exp(n))},{$x:n},function(t,e){var n=e[0];return{$x:function(){return t.mulStrict(n)}}})}}),Ja=Ue({expm1_:function(t){var e=Fe(t,"x","expm1");return te.engine.runKernel(function(t){return t.expm1(e)},{$x:e},function(t){return{$x:function(){return t.mulStrict(e.exp())}}})}}),Qa=Ue({floor_:function(t){var e=Fe(t,"x","floor");return te.engine.runKernel(function(t){return t.floor(e)},{$x:e},function(t){return{$x:function(){return un(t)}}})}}),ts=Ue({log_:function(t){var e=Fe(t,"x","log");return te.engine.runKernel(function(t){return t.log(e)},{$x:e},function(t){return{$x:function(){return t.divStrict(e.toFloat())}}})}}),es=Ue({log1p_:function(t){var e=Fe(t,"x","log1p");return te.engine.runKernel(function(t){return t.log1p(e)},{$x:e},function(t){return{$x:function(){return t.div(e.add(1))}}})}}),ns=Ue({logSigmoid_:function(t){var e=Fe(t,"x","logSigmoid");return te.engine.runKernel(function(t){return t.softplus(e.neg()).neg()},{$x:e},function(t){return{$x:function(){return t.mulStrict(e.neg().sigmoid())}}})}}),rs=Ue({neg_:function(t){var e=Fe(t,"x","neg");return te.engine.runKernel(function(t){return t.neg(e)},{$x:e},function(t){return{$x:function(){return t.neg()}}})}}),is=Ue({reciprocal_:function(t){var e=Fe(t,"x","reciprocal");return te.engine.runKernel(function(t){return t.reciprocal(e)},{$x:e},function(t){return{$x:function(){return t.divStrict(e.square().neg())}}})}}),os=Ue({round_:function(t){var e=Fe(t,"x","round");return te.engine.runKernel(function(t){return t.round(e)},{$x:e},function(t){return{$x:function(){return un(t)}}})}}),as=Ue({rsqrt_:function(t){var e=Fe(t,"x","rsqrt");return te.engine.runKernel(function(t){return t.rsqrt(e)},{$x:e},function(t){return{$x:function(){return t.div(e.pow(1.5).mul(2)).neg()}}})}}),ss=Ue({sigmoid_:function(t){var n=Fe(t,"x","sigmoid");return te.engine.runKernel(function(t,e){return e(t.sigmoid(n))},{$x:n},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.mul(Ke(1).sub(n)))}}})}}),us=Ue({sign_:function(t){var e=Fe(t,"x","sign");return te.engine.runKernel(function(t){return t.sign(e)},{$x:e},function(t){return{$x:function(){return un(t)}}})}}),cs=Ue({sin_:function(t){var e=Fe(t,"x","sin");return te.engine.runKernel(function(t){return t.sin(e)},{$x:e},function(t){return{$x:function(){return e.toFloat().cos().mulStrict(t)}}})}}),ls=Ue({sinh_:function(t){var e=Fe(t,"x","sinh");return te.engine.runKernel(function(t){return t.sinh(e)},{$x:e},function(t){return{$x:function(){return e.toFloat().cosh().mulStrict(t)}}})}}),fs=Ue({softplus_:function(t){var e=Fe(t,"x","softplus");return te.engine.runKernel(function(t){return t.softplus(e)},{$x:e},function(t){return{$x:function(){return t.mulStrict(e.sigmoid())}}})}}),hs=Ue({sqrt_:function(t){var e=Fe(t,"x","sqrt");return te.engine.runKernel(function(t){return t.sqrt(e)},{$x:e},function(t){return{$x:function(){return t.div(e.toFloat().sqrt().mul(2))}}})}}),ps=Ue({square_:function(t){var e=Fe(t,"x","square");return te.engine.runKernel(function(t){return t.square(e)},{$x:e},function(t){return{$x:function(){return t.mul(e.toFloat().mul(2))}}})}}),ds=Ue({step_:function(t,e){void 0===e&&(e=0);var n=Fe(t,"x","step");return te.engine.runKernel(function(t){return t.step(n,e)},{$x:n},function(t){return{$x:function(){return un(t)}}})}}),ms=Ue({tan_:function(t){var e=Fe(t,"x","tan");return te.engine.runKernel(function(t){return t.tan(e)},{$x:e},function(t){return{$x:function(){return t.divStrict(e.cos().square())}}})}}),gs=Ue({tanh_:function(t){var n=Fe(t,"x","tanh");return te.engine.runKernel(function(t,e){return e(t.tanh(n))},{$x:n},function(t,e){var n=e[0];return{$x:function(){return Ke(1).sub(n.square()).mulStrict(t)}}})}});function ys(t,e,n,r,i,o){void 0===o&&(o=.001);var a,s,u=Fe(t,"x","batchNorm"),c=Fe(e,"mean","batchNorm"),l=Fe(n,"variance","batchNorm");return null!=i&&(a=Fe(i,"scale","batchNorm")),null!=r&&(s=Fe(r,"offset","batchNorm")),C(2===u.rank,"Error in batchNorm3D: x must be rank 3 but got rank "+u.rank+"."),C(2===c.rank||1===c.rank,"Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank "+c.rank+"."),C(2===l.rank||1===l.rank,"Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank "+l.rank+"."),null!=a&&C(2===a.rank||1===a.rank,"Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank "+a.rank+"."),null!=s&&C(2===s.rank||1===s.rank,"Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank "+s.rank+"."),ws(u,c,l,s,a,o)}function vs(t,e,n,r,i,o){void 0===o&&(o=.001);var a,s,u=Fe(t,"x","batchNorm"),c=Fe(e,"mean","batchNorm"),l=Fe(n,"variance","batchNorm");return null!=i&&(a=Fe(i,"scale","batchNorm")),null!=r&&(s=Fe(r,"offset","batchNorm")),C(3===u.rank,"Error in batchNorm3D: x must be rank 3 but got rank "+u.rank+"."),C(3===c.rank||1===c.rank,"Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank "+c.rank+"."),C(3===l.rank||1===l.rank,"Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank "+l.rank+"."),null!=a&&C(3===a.rank||1===a.rank,"Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank "+a.rank+"."),null!=s&&C(3===s.rank||1===s.rank,"Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank "+s.rank+"."),ws(u,c,l,s,a,o)}function bs(t,e,n,r,i,o){void 0===o&&(o=.001);var a,s,u=Fe(t,"x","batchNorm"),c=Fe(e,"mean","batchNorm"),l=Fe(n,"variance","batchNorm");return null!=i&&(a=Fe(i,"scale","batchNorm")),null!=r&&(s=Fe(r,"offset","batchNorm")),C(4===u.rank,"Error in batchNorm4D: x must be rank 4 but got rank "+u.rank+"."),C(4===c.rank||1===c.rank,"Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank "+c.rank+"."),C(4===l.rank||1===l.rank,"Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank "+l.rank+"."),null!=a&&C(4===a.rank||1===a.rank,"Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank "+a.rank+"."),null!=s&&C(4===s.rank||1===s.rank,"Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank "+s.rank+"."),ws(u,c,l,s,a,o)}function ws(t,e,n,r,i,c){void 0===c&&(c=.001);var l,o,f,h=Fe(t,"x","batchNorm"),p=Fe(e,"mean","batchNorm"),d=Fe(n,"variance","batchNorm");return null!=i&&(l=Fe(i,"scale","batchNorm")),null!=r&&(o=Fe(r,"offset","batchNorm")),C(p.rank===d.rank,"Batch normalization gradient requires mean and variance to have equal ranks."),C(null==o||p.rank===o.rank,"Batch normalization gradient requires mean and offset to have equal ranks."),C(null==l||p.rank===l.rank,"Batch normalization gradient requires mean and scale to have equal ranks."),f=0===h.rank||1===h.rank?h.as4D(1,1,1,h.size):2===h.rank?h.as4D(1,1,h.shape[0],h.shape[1]):3===h.rank?h.as4D(1,h.shape[0],h.shape[1],h.shape[2]):h,te.engine.runKernel(function(t){return t.batchNormalization(f,_s(p),_s(d),c,_s(l),_s(o))},{$x:h,$mean:p,$variance:d,$scale:l,$offset:o},function(n){var t=null==l?Ke(1):l,r=Sn(p.shape,f.shape),e=[];if(1===p.rank){for(var i=0;i<f.shape.length-1;++i)e.push(f.shape[i]);e.push(1)}var o=h.sub(p),a=n.mul(t),s=as(d.add(Ke(c))),u=s.mul(s).mul(s).mul(Ke(-.5));return{$x:function(){return 1===p.rank?n.mul(Ca(s.as4D(1,1,1,p.shape[0]),e)).mul(t).reshape(h.shape):n.mul(s).mul(t).reshape(h.shape)},$mean:function(){var t=s.mul(Ke(-1)).mul(a);return 1===p.rank&&(t=t.sum(r)),t.reshape(p.shape)},$variance:function(){var t=u.mul(o).mul(a);return 1===p.rank&&(t=t.sum(r)),t.reshape(p.shape)},$scale:function(){var t=o.mul(s),e=n.mul(t);return 1===p.rank&&(e=e.sum(r)),e.reshape(p.shape)},$offset:function(){var t=n;return 1===p.rank&&(t=t.sum(r)),t.reshape(p.shape)}}}).reshape(h.shape)}function _s(t){return null==t?null:0===t.rank?t.as1D():1===t.rank?t:2===t.rank?t.as4D(1,1,t.shape[0],t.shape[1]):3===t.rank?t.as4D(1,t.shape[0],t.shape[1],t.shape[2]):t}function xs(){Jt("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon")}var Es=Ue({batchNormalization2d_:function(t,e,n,r,i,o){return void 0===r&&(r=.001),xs(),ys(t,e,n,o,i,r)}}),Ss=Ue({batchNormalization3d_:function(t,e,n,r,i,o){return void 0===r&&(r=.001),xs(),vs(t,e,n,o,i,r)}}),Ns=Ue({batchNormalization4d_:function(t,e,n,r,i,o){return void 0===r&&(r=.001),xs(),bs(t,e,n,o,i,r)}}),Is=Ue({batchNormalization_:function(t,e,n,r,i,o){return void 0===r&&(r=.001),xs(),ws(t,e,n,o,i,r)}}),Os=Ue({batchNorm_:ws}),ks=Ue({batchNorm2d_:ys}),As=Ue({batchNorm3d_:vs}),Cs=Ue({batchNorm4d_:bs});function Ps(t,e,n,r,i,o,a){void 0===a&&(a="channelsLast");var s,u=Rs(e),c=u[0],l=u[1];if("channelsLast"===a)s=[c,l,t[3],t[3]];else{if("channelsFirst"!==a)throw new Error("Unknown dataFormat "+a);s=[c,l,t[1],t[1]]}return Ts(t,s,n,r,i,o,!1,a)}function Ts(t,e,n,r,i,o,a,s){void 0===a&&(a=!1),void 0===s&&(s="channelsLast");var u=[-1,-1,-1,-1],c=u[0],l=u[1],f=u[2],h=u[3];if("channelsLast"===s)c=t[0],l=t[1],f=t[2],h=t[3];else{if("channelsFirst"!==s)throw new Error("Unknown dataFormat "+s);c=t[0],h=t[1],l=t[2],f=t[3]}var p,d=e[0],m=e[1],g=e[3],y=Rs(n),v=y[0],b=y[1],w=Rs(r),_=w[0],x=w[1],E=js(d,_),S=js(m,x),N=function(t,e,n,r,i,o,a,s){var u,c,l;if("number"==typeof t){u={top:t,bottom:t,left:t,right:t,type:0===t?"VALID":"NUMBER"};var f=function(t,e,n,r,i,o){null==i&&(i=function(t,e,n,r){void 0===r&&(r=1);var i=js(e,r);return Math.floor((t[0]*(n-1)-n+i)/2)}(t,e,r));var a=t[0],s=t[1],u=Bs((a-e+2*i)/r+1,o);C(P(u),"The output # of rows ("+u+") must be an integer. Change the stride and/or zero pad parameters");var c=Bs((s-e+2*i)/r+1,o);return C(P(c),"The output # of columns ("+c+") must be an integer. Change the stride and/or zero pad parameters"),[u,c,n]}([e,n,1],o,1,r,t,s);c=f[0],l=f[1]}else if("same"===t){c=Math.ceil(e/r),l=Math.ceil(n/i);var h=Math.max(0,(c-1)*r+o-e),p=Math.max(0,(l-1)*i+a-n),d=Math.floor(h/2),m=h-d,g=Math.floor(p/2);u={top:d,bottom:m,left:g,right:p-g,type:"SAME"}}else{if("valid"!==t)throw Error("Unknown padding parameter: "+t);u={top:0,bottom:0,left:0,right:0,type:"VALID"},c=Math.ceil((e-o+1)/r),l=Math.ceil((n-a+1)/i)}return{padInfo:u,outHeight:c,outWidth:l}}(i,l,f,v,b,E,S,o),I=N.padInfo,O=N.outHeight,k=N.outWidth,A=a?g*h:g;return"channelsFirst"===s?p=[c,A,O,k]:"channelsLast"===s&&(p=[c,O,k,A]),{batchSize:c,dataFormat:s,inHeight:l,inWidth:f,inChannels:h,outHeight:O,outWidth:k,outChannels:A,padInfo:I,strideHeight:v,strideWidth:b,filterHeight:d,filterWidth:m,effectiveFilterHeight:E,effectiveFilterWidth:S,dilationHeight:_,dilationWidth:x,inShape:t,outShape:p,filterShape:e}}function Ms(t,e,n,r,i,o,a){void 0===o&&(o=!1),void 0===a&&(a="channelsLast");var s=[-1,-1,-1,-1,-1],u=s[0],c=s[1],l=s[2],f=s[3],h=s[4];if("channelsLast"===a)u=t[0],c=t[1],l=t[2],f=t[3],h=t[4];else{if("channelsFirst"!==a)throw new Error("Unknown dataFormat "+a);u=t[0],h=t[1],c=t[2],l=t[3],f=t[4]}var p,d=e[0],m=e[1],g=e[2],y=e[4],v=Ds(n),b=v[0],w=v[1],_=v[2],x=Ds(r),E=x[0],S=x[1],N=x[2],I=function(t,e,n,r,i,o,a,s,u,c){var l,f,h,p;if("same"===t){var d=((f=Math.ceil(e/i))-1)*i+s-e,m=((h=Math.ceil(n/o))-1)*o+u-n,g=((p=Math.ceil(r/a))-1)*a+c-r,y=Math.floor(d/2),v=d-y,b=Math.floor(m/2),w=m-b,_=Math.floor(g/2);l={top:b,bottom:w,left:_,right:g-_,front:y,back:v,type:"SAME"}}else{if("valid"!==t)throw Error("Unknown padding parameter: "+t);l={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},f=Math.ceil((e-s+1)/i),h=Math.ceil((n-u+1)/o),p=Math.ceil((r-c+1)/a)}return{padInfo:l,outDepth:f,outHeight:h,outWidth:p}}(i,c,l,f,b,w,_,js(d,E),js(m,S),js(g,N)),O=I.padInfo,k=I.outDepth,A=I.outHeight,C=I.outWidth,P=o?y*h:y;return"channelsFirst"===a?p=[u,P,k,A,C]:"channelsLast"===a&&(p=[u,k,A,C,P]),{batchSize:u,dataFormat:a,inDepth:c,inHeight:l,inWidth:f,inChannels:h,outDepth:k,outHeight:A,outWidth:C,outChannels:P,padInfo:O,strideDepth:b,strideHeight:w,strideWidth:_,filterDepth:d,filterHeight:m,filterWidth:g,dilationDepth:E,dilationHeight:S,dilationWidth:N,inShape:t,outShape:p,filterShape:e}}function Rs(t){return"number"==typeof t?[t,t]:t}function Ds(t){return"number"==typeof t?[t,t,t]:t}function js(t,e){return e<=1?t:t+(t-1)*(e-1)}function Bs(t,e){if(!e)return t;switch(e){case"round":return Math.round(t);case"ceil":return Math.ceil(t);case"floor":return Math.floor(t);default:throw new Error("Unknown roundingMode "+e)}}function Ls(t){var e=Rs(t),n=e[0],r=e[1];return 1===n&&1===r}function Fs(t,e){return Ls(t)||Ls(e)}var zs=Ue({matMul_:function(t,e,n,r){var i;void 0===n&&(n=!1),void 0===r&&(r=!1);var o=Fe(t,"a","matMul"),a=Fe(e,"b","matMul");o=(i=Rt(o,a))[0],a=i[1];var s=n?o.shape[o.rank-2]:o.shape[o.rank-1],u=r?a.shape[a.rank-1]:a.shape[a.rank-2],c=n?o.shape[o.rank-1]:o.shape[o.rank-2],l=r?a.shape[a.rank-2]:a.shape[a.rank-1],f=o.shape.slice(0,-2),h=a.shape.slice(0,-2),p=L(f),d=L(h);C(2<=o.rank&&2<=a.rank&&o.rank===a.rank,"Error in matMul: inputs must have the same rank of at least 2, got ranks "+o.rank+" and "+a.rank+"."),C(x(f,h),"Error in matMul: outer dimensions ("+f+") and ("+h+") of Tensors with shapes "+o.shape+" and "+a.shape+" must match."),C(s===u,"Error in matMul: inner shapes ("+s+") and ("+u+") of Tensors with shapes "+o.shape+" and "+a.shape+" and transposeA="+n+" and transposeB="+r+" must match.");var m=o.shape.slice(0,-2).concat([c,l]),g=n?o.as3D(p,s,c):o.as3D(p,c,s),y=r?a.as3D(d,l,u):a.as3D(d,u,l);return te.engine.runKernel(function(t){return t.batchMatMul(g,y,n,r)},{$a:g,$b:y},function(t){return n||r?!n&&r?{$a:function(){return t.matMul(y,!1,!1)},$b:function(){return t.matMul(g,!0,!1)}}:n&&!r?{$a:function(){return y.matMul(t,!1,!0)},$b:function(){return g.matMul(t,!1,!1)}}:{$a:function(){return y.matMul(t,!0,!0)},$b:function(){return t.matMul(g,!0,!0)}}:{$a:function(){return t.matMul(y,!1,!0)},$b:function(){return g.matMul(t,!0,!1)}}}).reshape(m)}}),Us=Ue({dot_:function(t,e){var n=Fe(t,"t1","dot"),r=Fe(e,"t2","dot");C(!(1!==n.rank&&2!==n.rank||1!==r.rank&&2!==r.rank),"Error in dot: inputs must all be rank 1 or 2, but got ranks "+n.rank+" and "+r.rank+".");var i=1===n.rank?n.size:n.shape[1],o=1===r.rank?r.size:r.shape[0];return C(i===o,"Error in dot: inner dimensions of inputs must match, but got "+i+" and "+o+"."),1===n.rank&&1===r.rank?n.as2D(1,-1).matMul(r.as2D(-1,1)).asScalar():1===n.rank&&2===r.rank?n.as2D(1,-1).matMul(r.as2D(r.shape[0],r.shape[1])).as1D():2===n.rank&&1===r.rank?n.matMul(r.as2D(-1,1)).as1D():n.matMul(r.as2D(r.shape[0],r.shape[1]))}}),Vs=Ue({outerProduct_:function(t,e){var n=Fe(t,"v1","outerProduct"),r=Fe(e,"v2","outerProduct");return C(1===n.rank&&1===r.rank,"Error in outerProduct: inputs must be rank 1, but got ranks "+n.rank+" and "+r.rank+"."),n.as2D(-1,1).matMul(r.as2D(1,-1))}});function Ws(t,e,n,r,i,o){C(t.length===e.rank,"Length of inShape ("+t.length+") and rank of dy ("+e.rank+") must match");var a=t,s=e,u=!1;3===e.rank&&(u=!0,s=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]),a=[1,t[0],t[1],t[2]]);var c=a[3],l=s.shape[3];C(4===a.length,"Error in conv2dDerInput: inShape must be length 4, but got length "+a.length+"."),C(4===s.rank,"Error in conv2dDerInput: dy must be rank 4, but got rank "+s.rank),C(4===n.rank,"Error in conv2dDerInput: filter must be rank 4, but got rank "+n.rank),C(c===n.shape[2],"Error in conv2dDerInput: depth of input ("+c+") must match input depth for filter "+n.shape[2]+"."),C(l===n.shape[3],"Error in conv2dDerInput: depth of output ("+l+") must match output depth for filter "+n.shape[3]+"."),null!=o&&C(P(i),"Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+i+".");var f=Ts(a,n.shape,r,1,i,o),h=te.engine.runKernel(function(t){return t.conv2dDerInput(s,n,f)},{dy4D:s,filter:n},function(t){return{dy4D:function(){return Gs(t,n,r,i,"NHWC",1,o)},filter:function(){return Xs(t,s,n.shape,r,i,o)}}});return u?h.as3D(h.shape[1],h.shape[2],h.shape[3]):h}function qs(t,e,n,r,i,o){var a=t;3===t.rank&&(a=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var s=e;3===s.rank&&(s=e.as4D(1,e.shape[0],e.shape[1],e.shape[2])),C(4===a.rank,"Error in conv2dDerFilter: input must be rank 4, but got shape "+a.shape+"."),C(4===s.rank,"Error in conv2dDerFilter: dy must be rank 4, but got shape "+s.shape+"."),C(4===n.length,"Error in conv2dDerFilter: filterShape must be length 4, but got "+n+"."),C(a.shape[3]===n[2],"Error in conv2dDerFilter: depth of input "+a.shape[3]+") must match input depth in filter ("+n[2]+"."),C(s.shape[3]===n[3],"Error in conv2dDerFilter: depth of dy ("+s.shape[3]+") must match output depth for filter ("+n[3]+")."),null!=o&&C(P(i),"Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+i+".");var u=Ts(a.shape,n,r,1,i,o);return te.engine.runKernel(function(t){return t.conv2dDerFilter(a,s,u)},{x4D:a,dy4D:s})}function Hs(t){var e=function(t){return"number"==typeof t?[t,t,t]:2===t.length?[t[0],t[1],1]:t}(t),n=e[0],r=e[1],i=e[2];return 1===n&&1===r&&1===i}var $s=Ue({conv1d_:function(t,e,n,r,i,o,a){void 0===i&&(i="NWC"),void 0===o&&(o=1);var s=Fe(t,"x","conv1d"),u=Fe(e,"filter","conv1d"),c=s,l=!1;2===s.rank&&(l=!0,c=s.as3D(1,s.shape[0],s.shape[1])),C(3===c.rank,"Error in conv1d: input must be rank 3, but got rank "+c.rank+"."),C(3===u.rank,"Error in conv1d: filter must be rank 3, but got rank "+u.rank+"."),null!=a&&C(P(r),"Error in conv1d: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+r+"."),C(c.shape[2]===u.shape[1],"Error in conv1d: depth of input ("+c.shape[2]+") must match input depth for filter "+u.shape[1]+"."),C(Fs(n,o),"Error in conv1D: Either stride or dilation must be 1. Got stride "+n+" and dilation '"+o+"'"),C("NWC"===i,"Error in conv1d: got dataFormat of "+i+" but only NWC is currently supported.");var f=u.as4D(1,u.shape[0],u.shape[1],u.shape[2]),h=c.as4D(c.shape[0],1,c.shape[1],c.shape[2]),p=Gs(h,f,[1,n],r,"NHWC",[1,o],a);return l?p.as2D(p.shape[2],p.shape[3]):p.as3D(p.shape[0],p.shape[2],p.shape[3])}}),Gs=Ue({conv2d_:function(t,e,n,r,i,o,a){void 0===i&&(i="NHWC"),void 0===o&&(o=[1,1]);var s=Fe(t,"x","conv2d"),u=Fe(e,"filter","conv2d"),c=s,l=!1;3===s.rank&&(l=!0,c=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),C(4===c.rank,"Error in conv2d: input must be rank 4, but got rank "+c.rank+"."),C(4===u.rank,"Error in conv2d: filter must be rank 4, but got rank "+u.rank+"."),null!=a&&C(P(r),"Error in conv2d: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+r+"."),C(c.shape[3]===u.shape[2],"Error in conv2d: depth of input ("+c.shape[3]+") must match input depth for filter "+u.shape[2]+"."),C(Fs(n,o),"Error in conv2D: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+o+"'"),C("NHWC"===i,"Error in conv2d: got dataFormat of "+i+" but only NHWC is currently supported.");var f,h=Ts(c.shape,u.shape,n,o,r,a);if(1!==h.filterHeight||1!==h.filterWidth||1!==h.dilationHeight||1!==h.dilationWidth||1!==h.strideHeight||1!==h.strideWidth||"SAME"!==h.padInfo.type&&"VALID"!==h.padInfo.type)f=te.engine.runKernel(function(t){return t.conv2d(c,u,h)},{x:c,$filter:u},function(t){return C(Ls(o),"Error in gradient of conv2D: dilation rates greater than 1 are notyet supported in gradients. Got dilations '"+o+"'"),{x:function(){return Ws(c.shape,t,u,n,r)},$filter:function(){return qs(c,t,u.shape,n,r)}}});else{var p=c.reshape([-1,h.inChannels]),d=u.reshape([h.inChannels,h.outChannels]);f=zs(p,d).reshape(h.outShape)}return l?f.as3D(f.shape[1],f.shape[2],f.shape[3]):f}}),Ks=Ue({conv3d_:function(t,e,n,r,i,o){void 0===i&&(i="NHWC"),void 0===o&&(o=[1,1,1]);var a=Fe(t,"x","conv3d"),s=Fe(e,"filter","conv3d"),u=a,c=!1;4===a.rank&&(c=!0,u=a.as5D(1,a.shape[0],a.shape[1],a.shape[2],a.shape[3])),C(5===u.rank,"Error in conv3d: input must be rank 5, but got rank "+u.rank+"."),C(5===s.rank,"Error in conv3d: filter must be rank 5, but got rank "+s.rank+"."),C(u.shape[4]===s.shape[3],"Error in conv3d: depth of input ("+u.shape[4]+") must match input depth for filter "+s.shape[3]+"."),C(function(t,e){return Hs(t)||Hs(e)}(n,o),"Error in conv3D: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+o+"'"),C("NHWC"===i,"Error in conv3d: got dataFormat of "+i+" but only NHWC is currently supported.");var l=Ms(u.shape,s.shape,n,o,r),f=te.engine.runKernel(function(t){return t.conv3d(u,s,l)},{x:u,$filter:s},function(t){return C(Hs(o),"Error in gradient of conv3D: dilation rates greater than 1 are notyet supported in gradients. Got dilations '"+o+"'"),{x:function(){return function(t,e,n,r,i){C(t.length===e.rank,"Length of inShape ("+t.length+") and rank of dy ("+e.rank+") must match");var o=t,a=e,s=!1;4===e.rank&&(s=!0,a=e.as5D(1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]),o=[1,t[0],t[1],t[2],t[3]]);var u=o[4],c=a.shape[4];C(5===o.length,"Error in conv3dDerInput: inShape must be length 5, but got length "+o.length+"."),C(5===a.rank,"Error in conv3dDerInput: dy must be rank 5, but got rank "+a.rank),C(5===n.rank,"Error in conv3dDerInput: filter must be rank 5, but got rank "+n.rank),C(u===n.shape[3],"Error in conv3dDerInput: depth of input ("+u+") must match input depth for filter "+n.shape[3]+"."),C(c===n.shape[4],"Error in conv3dDerInput: depth of output ("+c+") must match output depth for filter "+n.shape[4]+".");var l=Ms(o,n.shape,r,1,i),f=te.engine.runKernel(function(t){return t.conv3dDerInput(a,n,l)},{dy5D:a});return s?f.as4D(f.shape[1],f.shape[2],f.shape[3],f.shape[4]):f}(u.shape,t,s,n,r)},$filter:function(){return function(t,e,n,r,i){var o=t;4===t.rank&&(o=t.as5D(1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]));var a=e;4===a.rank&&(a=e.as5D(1,e.shape[0],e.shape[1],e.shape[2],e.shape[3])),C(5===o.rank,"Error in conv3dDerFilter: input must be rank 5, but got shape "+o.shape+"."),C(5===a.rank,"Error in conv3dDerFilter: dy must be rank 5, but got shape "+a.shape+"."),C(5===n.length,"Error in conv3dDerFilter: filterShape must be length 5, but got "+n+"."),C(o.shape[4]===n[3],"Error in conv3dDerFilter: depth of input "+o.shape[4]+") must match input depth in filter ("+n[3]+"."),C(a.shape[4]===n[4],"Error in conv3dDerFilter: depth of dy ("+a.shape[4]+") must match output depth for filter ("+n[4]+").");var s=Ms(o.shape,n,r,1,i);return te.engine.runKernel(function(t){return t.conv3dDerFilter(o,a,s)},{x5D:o,dy5D:a})}(u,t,s.shape,n,r)}}});return c?f.as4D(f.shape[1],f.shape[2],f.shape[3],f.shape[4]):f}}),Xs=Ue({conv2dDerFilter_:qs}),Ys=Ue({depthwiseConv2d_:function(t,e,n,r,i,o,a){void 0===i&&(i="NHWC"),void 0===o&&(o=[1,1]);var s=Fe(t,"x","depthwiseConv2d"),u=Fe(e,"filter","depthwiseConv2d"),c=s,l=!1;3===s.rank&&(l=!0,c=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),C(4===c.rank,"Error in depthwiseConv2d: input must be rank 4, but got rank "+c.rank+"."),C(4===u.rank,"Error in depthwiseConv2d: filter must be rank 4, but got rank "+u.rank+"."),C(c.shape[3]===u.shape[2],"Error in depthwiseConv2d: number of input channels ("+c.shape[3]+") must match the inChannels dimension in filter "+u.shape[2]+"."),null==o&&(o=[1,1]),C(Fs(n,o),"Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+o+"'"),null!=a&&C(P(r),"Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+r+".");var f=Ts(c.shape,u.shape,n,o,r,a,!0),h=te.engine.runKernel(function(t){return t.depthwiseConv2D(c,u,f)},{x:c,$filter:u},function(t){return C(Ls(o),"Error in gradient of depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+o+"'"),{x:function(){return function(t,e,n,r){var i=e,o=!1;3===e.rank&&(o=!0,i=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]));var a=te.engine.runKernel(function(t){return t.depthwiseConv2DDerInput(i,n,r)},{dy4D:i});return o?a.as3D(a.shape[1],a.shape[2],a.shape[3]):a}(c.shape,t,u,f)},$filter:function(){return function(t,e,n,r){var i=t;3===t.rank&&(i=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var o=e;return 3===o.rank&&(o=e.as4D(1,e.shape[0],e.shape[1],e.shape[2])),te.engine.runKernel(function(t){return t.depthwiseConv2DDerFilter(i,o,r)},{x4D:i,dy4D:o})}(c,t,u.shape,f)}}});return l?h.as3D(h.shape[1],h.shape[2],h.shape[3]):h}}),Zs=Ue({separableConv2d_:function(t,e,n,r,i,o,a){void 0===o&&(o=[1,1]),void 0===a&&(a="NHWC");var s=Fe(t,"x","separableConv2d"),u=Fe(e,"depthwiseFilter","separableConv2d"),c=Fe(n,"pointwiseFilter","separableConv2d"),l=s,f=!1;if(3===s.rank&&(f=!0,l=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),"NCHW"===a)throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");C(4===l.rank,"Error in separableConv2d: input must be rank 4, but got rank "+l.rank+"."),C(4===u.rank,"Error in separableConv2d: depthwise filter must be rank 4, but got rank "+u.rank+"."),C(4===c.rank,"Error in separableConv2d: pointwise filter must be rank 4, but got rank "+u.rank+"."),C(1===c.shape[0],"Error in separableConv2d: the first dimension of pointwise filter  must be 1, but got "+c.shape[0]+"."),C(1===c.shape[1],"Error in separableConv2d: the second dimension of pointwise filter  must be 1, but got "+c.shape[1]+".");var h=u.shape[2],p=u.shape[3];C(c.shape[2]===h*p,"Error in separableConv2d: the third dimension of pointwise filter must be "+h*p+", but got "+c.shape[2]+".");var d=Ys(l,u,r,i,a,o),m=Gs(d,c,1,"valid",a);return f?m.as3D(m.shape[1],m.shape[2],m.shape[3]):m}}),Js=Ue({conv2dTranspose_:function(t,e,n,r,i,o){return Ws(n,Fe(t,"x","conv2dTranspose"),Fe(e,"filter","conv2dTranspose"),r,i,o)}});var Qs=Ue({reverse_:function(t,e){var n=Fe(t,"x","reverse");if(0===n.rank)return n.clone();var r=N(e,n.shape);return te.engine.runKernel(function(t){return t.reverse(n,r)},{$x:n},function(t){return{$x:function(){return t.reverse(r)}}}).reshapeAs(n)}}),tu=Ue({reverse1d_:function(t){var e=Fe(t,"x","reverse");return C(1===e.rank,"Error in reverse1D: x must be rank 1 but got\n             rank "+e.rank+"."),Qs(e,0)}}),eu=Ue({reverse2d_:function(t,e){var n=Fe(t,"x","reverse");return C(2===n.rank,"Error in reverse2D: x must be rank 2 but got\n             rank "+n.rank+"."),Qs(n,e)}}),nu=Ue({reverse3d_:function(t,e){var n=Fe(t,"x","reverse");return C(3===n.rank,"Error in reverse3D: x must be rank 3 but got\n             rank "+n.rank+"."),Qs(n,e)}}),ru=Ue({reverse4d_:function(t,e){var n=Fe(t,"x","reverse");return C(4===n.rank,"Error in reverse4D: x must be rank 4 but got\n             rank "+n.rank+"."),Qs(n,e)}});function iu(t,r,i,o,a,e){var n=Fe(t,"x","maxPool"),s=n,u=!1;3===n.rank&&(u=!0,s=n.as4D(1,n.shape[0],n.shape[1],n.shape[2])),null==o&&(o=[1,1]),C(4===s.rank,"Error in maxPool: input must be rank 4 but got rank "+s.rank+"."),C(Fs(i,o),"Error in maxPool: Either strides or dilations must be 1. Got strides "+i+" and dilations '"+o+"'"),null!=e&&C(P(a),"Error in maxPool: pad must be an integer when using, dimRoundingMode "+e+" but got pad "+a+".");var c=Ps(s.shape,r,i,o,a,e),l=te.engine.runKernel(function(t,e){return e(t.maxPool(s,c))},{x:s},function(t,e){var n=e[0];return{x:function(){return function(t,e,n,r,i,o,a,s){var u=Fe(t,"dy","maxPoolBackprop"),c=Fe(e,"input","maxPoolBackprop"),l=Fe(n,"output","maxPoolBackprop");C(c.rank===u.rank,"Rank of input ("+c.rank+") does not match rank of dy ("+u.rank+")"),null==o&&(o=[1,1]),C(Fs(i,o),"Error in maxPoolBackProp: Either strides or dilations must be 1. Got strides "+i+" and dilations '"+o+"'"),C(4===u.rank,"Error in maxPoolBackprop: dy must be rank 4 but got rank "+u.rank+"."),C(4===c.rank,"Error in maxPoolBackprop: input must be rank 4 but got rank "+c.rank+"."),null!=s&&C(P(a),"Error in maxPoolBackprop: pad must be an integer when using, dimRoundingMode "+s+" but got pad "+a+".");var f=Ps(c.shape,r,i,o,a,s);return te.engine.runKernel(function(t){return t.maxPoolBackprop(u,c,l,f)},{$dy:u,$input:c})}(t,s,n,r,i,o,a)}}});return u?l.as3D(l.shape[1],l.shape[2],l.shape[3]):l}function ou(t,e,n,r,i,o){var a=Fe(t,"x","avgPool","float32");null==r&&(r=[1,1]),C(Fs(n,r),"Error in avgPool: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+r+"'");var s=a,u=!1;3===a.rank&&(u=!0,s=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),C(4===s.rank,"Error in avgPool: x must be rank 4 but got rank "+s.rank+"."),null!=o&&C(P(i),"Error in avgPool: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+i+".");var c=Ps(s.shape,e,n,r,i,o),l=te.engine.runKernel(function(t){return t.avgPool(s,c)},{x:s},function(t){return{x:function(){return function(t,e,n,r,i,o){var a=Fe(t,"dy","avgPoolBackprop"),s=Fe(e,"input","avgPoolBackprop");C(s.rank===a.rank,"Rank of input ("+s.rank+") does not match rank of dy ("+a.rank+")"),null==i&&(i=[1,1]),C(Fs(r,i),"Error in avgPoolBackprop: Either strides or dilations must be 1. Got strides "+r+" and dilations '"+i+"'");var u=s,c=a,l=!1;3===s.rank&&(l=!0,u=s.as4D(1,s.shape[0],s.shape[1],s.shape[2]),c=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),C(4===c.rank,"Error in avgPoolBackprop: dy must be rank 4 but got rank "+c.rank+"."),C(4===u.rank,"Error in avgPoolBackprop: input must be rank 4 but got rank "+u.rank+".");var f=Ps(u.shape,n,r,i,o),h=te.engine.runKernel(function(t){return t.avgPoolBackprop(c,u,f)},{dy4D:c,input4D:u});return l?h.as3D(h.shape[1],h.shape[2],h.shape[3]):h}(t,s,e,n,r,i)}}});return l=l.cast(a.dtype),u?l.as3D(l.shape[1],l.shape[2],l.shape[3]):l}var au=Ue({maxPool_:function(t,e,n,r,i){return iu(t,e,n,1,r,i)}}),su=Ue({avgPool_:function(t,e,n,r,i){return ou(t,e,n,1,r,i)}}),uu=Ue({pool_:function(t,e,n,r,i,o){null==i&&(i=[1,1]),null==o&&(o=1),0===r&&(r="valid");var a=Fe(t,"x","maxPool"),s=a,u=!1;3===a.rank&&(u=!0,s=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),C(Fs(o,i),"Error in pool: Either strides or dilations must be 1. Got strides "+o+" and dilations '"+i+"'");var c,l=Ps(s.shape,e,o,i,r),f=[l.dilationHeight,l.dilationWidth];c="same"===r?function(t,n){var e=t.map(function(t,e){return t+(t-1)*(n[e]-1)}).map(function(t){return t-1}),r=e.map(function(t){return Math.floor(t/2)}),i=e.map(function(t,e){return t-r[e]});return e.map(function(t,e){return[r[e],i[e]]})}([l.filterHeight,l.filterWidth],f):[[0,0],[0,0]];var h=1===f[0]&&1===f[1],p=function(t,e,n){var r=n.map(function(t){return t[0]}),i=n.map(function(t){return t[1]}),o=t.concat(r,i),a=e.map(function(t,e){return(t-o[e]%t)%t}),s=i.map(function(t,e){return t+a[e]});return[e.map(function(t,e){return[r[e],s[e]]}),e.map(function(t,e){return[0,a[e]]})]}([l.inHeight,l.inWidth],f,c),d=p[0],m=p[1],g=h?r:"valid",y=h?s:Oa(s,f,d),v=("avg"===n?function(){return ou(y,e,o,1,g)}:function(){return iu(y,e,o,1,g)})(),b=h?v:ua(v,f,m);return u?b.as3D(b.shape[1],b.shape[2],b.shape[3]):b}});var cu=Ue({slice_:function(t,e,n){var r,i,o=Fe(t,"x","slice");if(0===o.rank)throw new Error("Slicing scalar is not possible");r="number"==typeof e?[e].concat(new Array(o.rank-1).fill(0)):e.length<o.rank?e.concat(new Array(o.rank-e.length).fill(0)):e.slice(),i=(i=null==n?new Array(o.rank).fill(-1):"number"==typeof n?[n].concat(new Array(o.rank-1).fill(-1)):n.length<o.rank?n.concat(new Array(o.rank-n.length).fill(-1)):n).map(function(t,e){return 0<=t?t:(C(-1===t,"Bad value in size"),o.shape[e]-r[e])}),function(t,e,n){C(t.rank===e.length,"Error in slice"+t.rank+"D: Length of begin "+e+" must match the rank of the array ("+t.rank+")."),C(t.rank===n.length,"Error in slice"+t.rank+"D: Length of size "+n+" must match the rank of the array ("+t.rank+").");for(var r=0;r<t.rank;++r)C(e[r]+n[r]<=t.shape[r],"Error in slice"+t.rank+"D: begin["+r+"] + size["+r+"] ("+(e[r]+n[r])+") would overflow input.shape["+r+"] ("+t.shape[r]+")")}(o,r,i);var a=o.shape;return te.engine.runKernel(function(t){return t.slice(o,r,i)},{$x:o},function(t){for(var e=[],n=0;n<t.rank;n++)e.push([r[n],a[n]-r[n]-i[n]]);return{$x:function(){return t.pad(e)}}})}}),lu=Ue({slice1d_:function(t,e,n){var r=Fe(t,"x","slice1d");return C(1===r.rank,"slice1d expects a rank-1 tensor, but got a rank-"+r.rank+" tensor"),cu(r,[e],[n])}}),fu=Ue({slice2d_:function(t,e,n){var r=Fe(t,"x","slice2d");return C(2===r.rank,"slice2d expects a rank-2 tensor, but got a rank-"+r.rank+" tensor"),cu(r,e,n)}}),hu=Ue({slice3d_:function(t,e,n){var r=Fe(t,"x","slice3d");return C(3===r.rank,"slice3d expects a rank-3 tensor, but got a rank-"+r.rank+" tensor"),cu(r,e,n)}}),pu=Ue({slice4d_:function(t,e,n){var r=Fe(t,"x","slice4d");return C(4===r.rank,"slice4d expects a rank-4 tensor, but got a rank-"+r.rank+" tensor"),cu(r,e,n)}});function du(e,t,n,r,i){var o=t[0];return o.rank<n.rank&&(o=o.reshape(xe(o.shape,r))),e.rank<n.rank&&(e=e.reshape(xe(e.shape,r))),{$x:function(){var t=e.mul(n.equal(o).cast(e.dtype));return null==i?t:t.transpose(i)}}}var mu=Ue({all_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Fe(t,"x","all","bool"),i=N(e,r.shape),o=i,a=Se(o,r.rank);null!=a&&(r=r.transpose(a),o=Ie(o.length,r.rank));var s=te.engine.runKernel(function(t){return t.all(r,o)},{$x:r});if(n){var u=xe(s.shape,i);return s.reshape(u)}return s}}),gu=Ue({any_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Fe(t,"x","any","bool"),i=N(e,r.shape),o=i,a=Se(o,r.rank);null!=a&&(r=r.transpose(a),o=Ie(o.length,r.rank));var s=te.engine.runKernel(function(t){return t.any(r,o)},{$x:r});if(n){var u=xe(s.shape,i);return s.reshape(u)}return s}}),yu=Ue({argMax_:function(t,e){void 0===e&&(e=0);var n=Fe(t,"x","argMax");null==e&&(e=0);var r=N(e,n.shape),i=Se(r,n.rank);return null!=i&&(n=n.transpose(i),r=Ie(r.length,n.rank)),te.engine.runKernel(function(t){return t.argMax(n,r[0])},{$x:n},function(t){return{$x:function(){return un(n)}}})}}),vu=Ue({argMin_:function(t,e){void 0===e&&(e=0);var n=Fe(t,"x","argMin");null==e&&(e=0);var r=N(e,n.shape),i=Se(r,n.rank);return null!=i&&(n=n.transpose(i),r=Ie(r.length,n.rank)),te.engine.runKernel(function(t){return t.argMin(n,r[0])},{$x:n},function(t){return{$x:function(){return un(n)}}})}}),bu=Ue({logSumExp_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Fe(t,"x","logSumExp"),i=N(e,r.shape),o=r.max(i,!0),a=r.sub(o).exp().sum(i).log(),s=o.reshape(a.shape).add(a);if(n){var u=xe(s.shape,i);return s.reshape(u)}return s}}),wu=Ue({max_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Fe(t,"x","max"),i=r,o=N(e,r.shape),a=o,s=Se(a,r.rank);null!=s&&(r=r.transpose(s),a=Ie(a.length,r.rank));var u=te.engine.runKernel(function(t,e){return e(t.max(r,a))},{$x:r},function(t,e){return du(t,e,i,o,s)});if(n){var c=xe(u.shape,o);u=u.reshape(c)}return u}}),_u=Ue({mean_:function(t,e,i){void 0===e&&(e=null),void 0===i&&(i=!1);var n=Fe(t,"x","mean"),o=N(e,n.shape),a=L(_e(n.shape,o)[1]);return se(function(n){var r=Ke(a);return{value:(r.dtype===n.dtype?n:n.cast(r.dtype)).div(r).sum(e,i),gradFunc:function(t){var e=n.shape.slice();return o.forEach(function(t){e[t]=1}),t.reshape(e).mul(en(n.shape,"float32")).div(r)}}})(n)}}),xu=Ue({min_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Fe(t,"x","min"),i=r,o=N(e,r.shape),a=o,s=Se(a,r.rank);null!=s&&(r=r.transpose(s),a=Ie(a.length,r.rank));var u=te.engine.runKernel(function(t,e){return e(t.min(r,a))},{$x:r},function(t,e){return du(t,e,i,o,s)});if(n){var c=xe(u.shape,o);u=u.reshape(c)}return u}}),Eu=Ue({moments_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=N(e,(t=Fe(t,"x","moments")).shape),i=t.mean(r,n),o=i.shape;return n||(o=xe(i.shape,r)),{mean:i,variance:t.toFloat().sub(i.reshape(o)).square().mean(r,n)}}}),Su=Ue({sum_:function(t,e,a){void 0===e&&(e=null),void 0===a&&(a=!1);var n=Fe(t,"x","sum");"bool"===n.dtype&&(n=n.toInt());var s=N(e,n.shape);return se(function(n){var t=Se(s,n.rank),e=s,r=n;null!=t&&(r=n.transpose(t),e=Ie(e.length,n.rank));var i=te.engine.runKernel(function(t){return t.sum(r,e)},{permutedX:r});if(a){var o=xe(i.shape,s);i=i.reshape(o)}return{value:i,gradFunc:function(t){var e=n.shape.slice();return s.forEach(function(t){e[t]=1}),t.reshape(e).mul(en(n.shape,"float32"))}}})(n)}}),Nu=Ue({prod_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Fe(t,"x","prod");"bool"===r.dtype&&(r=r.toInt());var i=N(e,r.shape),o=Se(i,r.rank),a=i,s=r;null!=o&&(s=r.transpose(o),a=Ie(a.length,r.rank));var u=te.engine.runKernel(function(t){return t.prod(s,a)},{permutedX:s});if(n){var c=xe(u.shape,i);u=u.reshape(c)}return u}});var Iu=Ue({equal_:function(t,e){var n,r=Fe(t,"a","equal"),i=Fe(e,"b","equal");return n=Rt(r,i),r=n[0],i=n[1],Nn(r.shape,i.shape),te.engine.runKernel(function(t){return t.equal(r,i)},{$a:r,$b:i})}}),Ou=Ue({equalStrict_:function(t,e){var n=Fe(t,"a","equalStrict"),r=Fe(e,"b","equalStrict");return d(n.shape,r.shape,"Error in equalStrict: "),n.equal(r)}}),ku=Ue({greater_:function(t,e){var n,r=Fe(t,"a","greater"),i=Fe(e,"b","greater");return n=Rt(r,i),r=n[0],i=n[1],Nn(r.shape,i.shape),te.engine.runKernel(function(t){return t.greater(r,i)},{$a:r,$b:i})}}),Au=Ue({greaterEqual_:function(t,e){var n,r=Fe(t,"a","greaterEqual"),i=Fe(e,"b","greaterEqual");return n=Rt(r,i),r=n[0],i=n[1],Nn(r.shape,i.shape),te.engine.runKernel(function(t){return t.greaterEqual(r,i)},{$a:r,$b:i},function(t){return{$a:function(){return un(r)},$b:function(){return un(i)}}})}}),Cu=Ue({greaterEqualStrict_:function(t,e){var n=Fe(t,"a","greaterEqualStrict"),r=Fe(e,"b","greaterEqualStrict");return d(n.shape,r.shape,"Error in greaterEqualStrict: "),n.greaterEqual(r)}}),Pu=Ue({greaterStrict_:function(t,e){var n=Fe(t,"a","greaterStrict"),r=Fe(e,"b","greaterStrict");return d(n.shape,r.shape,"Error in greaterStrict: "),n.greater(r)}}),Tu=Ue({less_:function(t,e){var n,r=Fe(t,"a","less"),i=Fe(e,"b","less");return n=Rt(r,i),r=n[0],i=n[1],Nn(r.shape,i.shape),te.engine.runKernel(function(t){return t.less(r,i)},{$a:r,$b:i})}}),Mu=Ue({lessEqual_:function(t,e){var n,r=Fe(t,"a","lessEqual"),i=Fe(e,"b","lessEqual");return n=Rt(r,i),r=n[0],i=n[1],Nn(r.shape,i.shape),te.engine.runKernel(function(t){return t.lessEqual(r,i)},{$a:r,$b:i})}}),Ru=Ue({lessEqualStrict_:function(t,e){var n=Fe(t,"a","lessEqualStrict"),r=Fe(e,"b","lessEqualStrict");return d(n.shape,r.shape,"Error in lessEqualStrict: "),n.lessEqual(r)}}),Du=Ue({lessStrict_:function(t,e){var n=Fe(t,"a","lessStrict"),r=Fe(e,"b","lessStrict");return d(n.shape,r.shape,"Error in lessStrict: "),n.less(r)}}),ju=Ue({notEqual_:function(t,e){var n,r=Fe(t,"a","notEqual"),i=Fe(e,"b","notEqual");return n=Rt(r,i),r=n[0],i=n[1],Nn(r.shape,i.shape),te.engine.runKernel(function(t){return t.notEqual(r,i)},{$a:r,$b:i})}}),Bu=Ue({notEqualStrict_:function(t,e){var n=Fe(t,"a","notEqualStrict"),r=Fe(e,"b","notEqualStrict");return d(n.shape,r.shape,"Error in notEqualStrict: "),n.notEqual(r)}});var Lu=Ue({add_:function(t,e){var n,r=Fe(t,"a","add"),i=Fe(e,"b","add");n=Rt(r,i),r=n[0],i=n[1];var o=Nn(r.shape,i.shape);return te.engine.runKernel(function(t){return t.add(r,i)},{$a:r,$b:i},function(n){return{$a:function(){var t=n,e=Sn(r.shape,o);return 0<e.length&&(t=t.sum(e)),t.reshape(r.shape)},$b:function(){var t=n,e=Sn(i.shape,o);return 0<e.length&&(t=t.sum(e)),t.reshape(i.shape)}}})}}),Fu=Ue({addN_:function(t){C(Array.isArray(t),function(){return"The argument passed to tf.addN() must be a list of tensors"}),C(1<=t.length,function(){return"Must pass at least one tensor to tf.addN(), but got "+t.length});var e=t.map(function(t,e){return Fe(t,"tensors"+e,"addN")}),n=e[0];e.forEach(function(t){if(t.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),e.forEach(function(t){if(!x(t.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});var r=e;return te.engine.runKernel(function(t){return t.addN(e)},r,function(n){var r={};return e.forEach(function(t,e){r[e]=function(){return n.clone()}}),r})}}),zu=Ue({addStrict_:function(t,e){var n=Fe(t,"a","addStrict"),r=Fe(e,"b","addStrict");return d(n.shape,r.shape,"Error in addStrict: "),n.add(r)}}),Uu=Ue({atan2_:function(t,e){var n,i=Fe(t,"a","atan2"),o=Fe(e,"b","atan2");n=Rt(i,o),i=n[0],o=n[1];var a=Nn(i.shape,o.shape);return te.engine.runKernel(function(t){return t.atan2(i,o)},{$a:i,$b:o},function(r){return{$a:function(){var t=Lu(i.square(),o.square()),e=r.mul(o.div(t)),n=Sn(i.shape,a);return 0<n.length&&(e=e.sum(n)),e.reshape(i.shape)},$b:function(){var t=Lu(i.square(),o.square()),e=rs(r.mul(i.div(t))),n=Sn(o.shape,a);return 0<n.length&&(e=e.sum(n)),e.reshape(o.shape)}}})}}),Vu=Ue({div_:function(t,e){var n,r,i=Fe(t,"a","div"),o=Fe(e,"b","div");if(n=Rt(i,o),i=n[0],o=n[1],"int32"===i.dtype&&"int32"===o.dtype)return qu(i,o);r=function(t){return t.realDivide(i,o)};var a=Nn(i.shape,o.shape);return te.engine.runKernel(r,{$a:i,$b:o},function(r){return{$a:function(){var t=r.div(o.toFloat()),e=Sn(i.shape,a);return 0<e.length?t.sum(e).reshape(i.shape):t},$b:function(){var t=r.mul(i.toFloat()),e=Sn(o.shape,a);0<e.length&&(t=t.sum(e).reshape(o.shape));var n=o.square();return t.div(n.toFloat()).neg()}}})}}),Wu=Ue({divStrict_:function(t,e){var n=Fe(t,"a","div"),r=Fe(e,"b","div");return d(n.shape,r.shape,"Error in divideStrict: "),n.div(r)}}),qu=Ue({floorDiv_:function(t,e){var n,i=Fe(t,"a","floorDiv"),o=Fe(e,"b","floorDiv");n=Rt(i,o),i=n[0],o=n[1];var a=Nn(i.shape,o.shape);return te.engine.runKernel(function(t){return t.floorDiv(i,o)},{$a:i,$b:o},function(r){return{$a:function(){var t=r.div(o.toFloat()),e=Sn(i.shape,a);return 0<e.length?t.sum(e).reshape(i.shape):t},$b:function(){var t=r.mul(i.toFloat()),e=Sn(o.shape,a);0<e.length&&(t=t.sum(e).reshape(o.shape));var n=o.square();return t.div(n.toFloat()).neg()}}})}}),Hu=Ue({maximum_:function(t,e){var n,r=Fe(t,"a","maximum"),i=Fe(e,"b","maximum");return n=Rt(r,i),r=n[0],i=n[1],"bool"===r.dtype&&(r=r.toInt(),i=i.toInt()),Nn(r.shape,i.shape),te.engine.runKernel(function(t){return t.maximum(r,i)},{$a:r,$b:i},function(t){return{$a:function(){return t.mul(r.greaterEqual(i).toFloat())},$b:function(){return t.mul(r.less(i).toFloat())}}})}}),$u=Ue({maximumStrict_:function(t,e){var n=Fe(t,"a","maximumStrict"),r=Fe(e,"b","maximumStrict");return d(n.shape,r.shape,"Error in maximumStrict: "),n.maximum(r)}}),Gu=Ue({minimum_:function(t,e){var n,r=Fe(t,"a","minimum"),i=Fe(e,"b","minimum");return n=Rt(r,i),r=n[0],i=n[1],"bool"===r.dtype&&(r=r.toInt(),i=i.toInt()),Nn(r.shape,i.shape),te.engine.runKernel(function(t){return t.minimum(r,i)},{$a:r,$b:i},function(t){return{$a:function(){return t.mul(r.lessEqual(i).toFloat())},$b:function(){return t.mul(r.greater(i).toFloat())}}})}}),Ku=Ue({minimumStrict_:function(t,e){var n=Fe(t,"a","minimumStrict"),r=Fe(e,"b","minimumStrict");return d(n.shape,r.shape,"Error in minimumStrict: "),n.minimum(r)}}),Xu=Ue({mod_:function(t,e){var n,r=Fe(t,"a","mod"),i=Fe(e,"b","mod");n=Rt(r,i),r=n[0],i=n[1];var o=Nn(r.shape,i.shape);return te.engine.runKernel(function(t){return t.mod(r,i)},{$a:r,$b:i},function(n){return{$a:function(){var t=Sn(r.shape,o);return 0<t.length?n.sum(t).reshape(r.shape):n},$b:function(){var t=n.mul(r.div(i).floor().neg()),e=Sn(i.shape,o);return 0<e.length?t.sum(e).reshape(i.shape):t}}})}}),Yu=Ue({modStrict_:function(t,e){var n=Fe(t,"a","modStrict"),r=Fe(e,"b","modStrict");return d(n.shape,r.shape,"Error in modStrict: "),n.mod(r)}}),Zu=Ue({mul_:function(t,e){var n,r=Fe(t,"a","mul"),i=Fe(e,"b","mul");n=Rt(r,i),r=n[0],i=n[1];var o=Nn(r.shape,i.shape);return te.engine.runKernel(function(t){return t.multiply(r,i)},{$a:r,$b:i},function(n){return{$a:function(){var t=n.mul(i.toFloat()),e=Sn(r.shape,o);return 0<e.length?t.sum(e).reshape(r.shape):t},$b:function(){var t=n.mul(r.toFloat()),e=Sn(i.shape,o);return 0<e.length?t.sum(e).reshape(i.shape):t}}})}}),Ju=Ue({mulStrict_:function(t,e){var n=Fe(t,"a","mul"),r=Fe(e,"b","mul");return d(n.shape,r.shape,"Error in multiplyStrict: "),n.mul(r)}}),Qu=Ue({pow_:function(t,e){var a=Fe(t,"base","pow"),s=Fe(e,"exp","pow"),u=Nn(a.shape,s.shape);return t=a.cast(Tt(a.dtype,s.dtype)),e=s.cast(Tt(a.dtype,s.dtype)),te.engine.runKernel(function(t,e){return e(t.pow(a,s))},{$base:a,$exp:s},function(i,t){var o=t[0];return{$base:function(){var t=s.toFloat(),e=i.mul(t.mul(a.pow(t.sub(Ke(1))))),n=Sn(a.shape,u);return 0<n.length&&(e=e.sum(n)),e.reshape(a.shape)},$exp:function(){var t=a.greater(0),e=a.log().where(t,un(a)),n=i.mul(o.mul(e)),r=Sn(s.shape,u);return 0<r.length&&(n=n.sum(r)),n.reshape(s.shape)}}})}}),tc=Ue({powStrict_:function(t,e){return d(t.shape,e.shape,"Error in powStrict: "),t.pow(e)}}),ec=Ue({squaredDifference_:function(t,e){var n,r=Fe(t,"a","squaredDifference"),i=Fe(e,"b","squaredDifference");return n=Rt(r,i),r=n[0],i=n[1],Nn(r.shape,i.shape),te.engine.runKernel(function(t){return t.squaredDifference(r,i)},{$a:r,$b:i},function(t){var e=Ke(2);return{$a:function(){return t.mul(r.sub(i).mul(e))},$b:function(){return t.mul(i.sub(r).mul(e))}}})}}),nc=Ue({squaredDifferenceStrict_:function(t,e){var n=Fe(t,"a","squaredDifferenceStrict"),r=Fe(e,"b","squaredDifferenceStrict");return d(n.shape,r.shape,"Error in squaredDifferenceStrict: "),n.squaredDifference(r)}}),rc=Ue({sub_:function(t,e){var n,r=Fe(t,"a","sub"),i=Fe(e,"b","sub");n=Rt(r,i),r=n[0],i=n[1];var o=Nn(r.shape,i.shape);return te.engine.runKernel(function(t){return t.subtract(r,i)},{$a:r,$b:i},function(n){return{$a:function(){var t=n,e=Sn(r.shape,o);return 0<e.length&&(t=t.sum(e)),t.reshape(r.shape)},$b:function(){var t=n,e=Sn(i.shape,o);return 0<e.length&&(t=t.sum(e)),t.neg().reshape(i.shape)}}})}}),ic=Ue({subStrict_:function(t,e){var n=Fe(t,"a","subStrict"),r=Fe(e,"b","subStrict");return d(n.shape,r.shape,"Error in subStrict: "),n.sub(r)}});var oc=Ue({logicalAnd_:function(t,e){var n=Fe(t,"a","logicalAnd","bool"),r=Fe(e,"b","logicalAnd","bool");return Nn(n.shape,r.shape),te.engine.runKernel(function(t){return t.logicalAnd(n,r)},{$a:n,$b:r})}}),ac=Ue({logicalNot_:function(t){var e=Fe(t,"x","logicalNot","bool");return te.engine.runKernel(function(t){return t.logicalNot(e)},{$x:e})}}),sc=Ue({logicalOr_:function(t,e){var n=Fe(t,"a","logicalOr","bool"),r=Fe(e,"b","logicalOr","bool");return Nn(n.shape,r.shape),te.engine.runKernel(function(t){return t.logicalOr(n,r)},{$a:n,$b:r})}}),uc=Ue({logicalXor_:function(t,e){var n=Fe(t,"a","logicalXor","bool"),r=Fe(e,"b","logicalXor","bool");return Nn(n.shape,r.shape),sc(t,e).logicalAnd(oc(t,e).logicalNot())}}),cc=Ue({where_:function(t,e,n){var r=Fe(e,"a","where"),i=Fe(n,"b","where"),o=Fe(t,"condition","where","bool");return d(r.shape,i.shape,"Error in where: "),1===o.rank?C(o.shape[0]===r.shape[0],"The first dimension of `a` must match the size of `condition`."):d(o.shape,i.shape,"Error in where: "),te.engine.runKernel(function(t){return t.select(o,r,i)},{$condition:o,$a:r,$b:i},function(t){return{$condition:function(){return un(o).toFloat()},$a:function(){return t.mul(o.cast(t.dtype))},$b:function(){return t.mul(o.logicalNot().cast(t.dtype))}}})}}),lc=function(i){return m(this,void 0,void 0,function(){var e,n,r;return I(this,function(t){switch(t.label){case 0:return[4,(e=Fe(i,"condition","whereAsync","bool")).data()];case 1:return n=t.sent(),r=Ra(e.shape,n),i!==e&&e.dispose(),[2,r]}})})};var fc=Ue({elu_:function(t){var n=Fe(t,"x","elu");return te.engine.runKernel(function(t,e){return e(t.elu(n))},{$x:n},function(e,t){var n=t[0];return{$x:function(){return te.engine.runKernel(function(t){return t.eluDer(e,n)},{dy:e,y:n})}}})}}),hc=Ue({leakyRelu_:function(t,e){void 0===e&&(e=.2);var n=Fe(t,"x","leakyRelu");return Hu(Ke(e).mul(n),n)}}),pc=Ue({prelu_:function(t,e){var i=Fe(t,"x","prelu"),o=Fe(e,"alpha","prelu");return te.engine.runKernel(function(t){return t.prelu(i,o)},{$x:i,$alpha:o},function(n){var r=i.greater(0);return{$x:function(){return cc(r,n,n.mul(o))},$alpha:function(){var t=cc(r,un(n),n.mul(i)),e=Sn(o.shape,n.shape);return 0<e.length&&(t=t.sum(e)),t.reshape(o.shape)}}})}}),dc=Ue({relu_:function(t){var n=Fe(t,"x","relu");return"bool"===n.dtype?n.toInt():te.engine.runKernel(function(t){return t.relu(n)},{$x:n},function(t){var e=n.step();return{$x:function(){return t.mulStrict(e.toFloat())}}})}}),mc=Ue({selu_:function(t){var a=Fe(t,"x","selu");return te.engine.runKernel(function(t){return t.selu(a)},{$x:a},function(o){return{$x:function(){var t=a.greater(Ke(0)),e=Ke(Oo),n=Ke(ko),r=o.mul(n),i=o.mul(e).mul(a.toFloat().exp());return cc(t,r,i)}}})}});var gc=Ue({transpose_:function(t,n){var e=Fe(t,"x","transpose");return null==n&&(n=e.shape.map(function(t,e){return e}).reverse()),C(e.rank===n.length,"Error in transpose: rank of input "+e.rank+" must match length of perm "+n+"."),n.forEach(function(t){C(0<=t&&t<e.rank,"All entries in 'perm' must be between 0 and "+(e.rank-1)+" but got "+n)}),e.rank<=1?e.clone():te.engine.runKernel(function(t){return t.transpose(e,n)},{$x:e},function(t){var e=Ne(n);return{$x:function(){return t.transpose(e)}}})}});var yc=Ue({localResponseNormalization_:function(t,r,i,o,a){void 0===r&&(r=5),void 0===i&&(i=1),void 0===o&&(o=1),void 0===a&&(a=.5);var e=Fe(t,"x","localResponseNormalization");C(4===e.rank||3===e.rank,"Error in localResponseNormalization: x must be rank 3 or 4 but got\n               rank "+e.rank+"."),C(P(r),"Error in localResponseNormalization: depthRadius must be an integer\n                     but got depthRadius "+r+".");var s=e,n=!1;3===e.rank&&(n=!0,s=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]));var u=te.engine.runKernel(function(t,e){return e(t.localResponseNormalization4D(s,r,i,o,a))},{x4D:s},function(e,t){var n=t[0];return{x4D:function(){return te.engine.runKernel(function(t){return t.LRNGrad(e,s,n,r,i,o,a)},{})}}});return n?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}});var vc=Ue({norm_:function(t,e,n,r){void 0===e&&(e="euclidean"),void 0===n&&(n=null),void 0===r&&(r=!1);var i=function t(e,n,r){if(void 0===r&&(r=null),0===e.rank)return e.abs();if(1!==e.rank&&null===r)return t(e.reshape([-1]),n,r);if(1===e.rank||"number"==typeof r||Array.isArray(r)&&1===r.length){if(1===n)return e.abs().sum(r);if(n===1/0)return e.abs().max(r);if(n===-1/0)return e.abs().min(r);if("euclidean"===n||2===n)return e.abs().pow(Ke(2,"int32")).sum(r).sqrt();throw new Error("Error in norm: invalid ord value: "+n)}if(Array.isArray(r)&&2===r.length){if(1===n)return e.abs().sum(r[0]).max(r[1]-1);if(n===1/0)return e.abs().sum(r[1]).max(r[0]);if(n===-1/0)return e.abs().sum(r[1]).min(r[0]);if("fro"===n||"euclidean"===n)return e.square().sum(r).sqrt();throw new Error("Error in norm: invalid ord value: "+n)}throw new Error("Error in norm: invalid axis: "+r)}(t=Fe(t,"x","norm"),e,n),o=i.shape;if(r){var a=N(n,t.shape);o=xe(i.shape,a)}return i.reshape(o)}});function bc(t,e){for(var n=[],r=t;r<e;++r)n.push(r);return n}function wc(t){for(var e=[],n=0;n<t.length;++n)for(var r=0;r<t[n].length;++r)e.push(t[n][r]);return e}var _c=Ue({gather_:function(t,e,g){void 0===g&&(g=0);var y=Fe(t,"x","gather"),v=Fe(e,"indices","gather","int32");g=N(g,y.shape)[0];var n=function(t,e,n){for(var r=t.shape[n],i=[],o=1,a=1,s=0;s<n;s++)i.push(t.shape[s]),o*=t.shape[s];for(s=0;s<e.rank;s++)i.push(e.shape[s]);for(s=n+1;s<t.rank;s++)i.push(t.shape[s]),a*=t.shape[s];return{batchSize:o,sliceSize:a,dimSize:r,outputShape:i}}(y,v,g);return te.engine.runKernel(function(t){return t.gather(y,v.flatten(),g)},{$x:y},function(m){return{$x:function(){var t=y.shape,e=v.size,n=t.slice(0,g),r=n.length,i=t.slice(g,t.length).slice(1),o=i.length,a=bc(0,r),s=bc(r+1,r+1+o),u=wc([n,[e],i]),c=m.reshape(u),l=v.reshape([e]),f=wc([[r],a,s]),h=c.transpose(f),p=xc(h,l,y.shape[g]),d=Ne(f);return p.transpose(d)}}}).reshape(n.outputShape)}}),xc=Ue({unsortedSegmentSum_:function(t,e,n){var r=Fe(t,"x","unsortedSegmentSum"),i=Fe(e,"segmentIds","unsortedSegmentSum","int32");return C(P(n),"numSegments must be of dtype int"),te.engine.runKernel(function(t){return t.unsortedSegmentSum(r,i,n)},{$x:r},function(t){return{$x:function(){return function(t,e){for(var n=Hu(e,un(e)),r=_c(t,n),i=Au(e,Ke(0,"int32")),o=r.rank-i.rank,a=0;a<o;++a)i=pa(i,a+1);i=oc(i,en(r.shape,"bool"));var s=un(r);return cc(i,r,s)}(t,i)}}})}});var Ec=Ue({basicLSTMCell_:function(t,e,n,r,i,o){var a=Fe(t,"forgetBias","basicLSTMCell"),s=Fe(e,"lstmKernel","basicLSTMCell"),u=Fe(n,"lstmBias","basicLSTMCell"),c=Fe(r,"data","basicLSTMCell"),l=Fe(i,"c","basicLSTMCell"),f=Fe(o,"h","basicLSTMCell"),h=c.concat(f,1).matMul(s).add(u),p=h.shape[0],d=h.shape[1]/4,m=[p,d],g=h.slice([0,0],m),y=h.slice([0,d],m),v=h.slice([0,2*d],m),b=h.slice([0,3*d],m),w=g.sigmoid().mulStrict(y.tanh()).addStrict(l.mulStrict(a.add(v).sigmoid()));return[w,w.tanh().mulStrict(b.sigmoid())]}}),Sc=Ue({multiRNNCell_:function(t,e,n,r){for(var i=Fe(e,"data","multiRNNCell"),o=ze(n,"c","multiRNNCell"),a=ze(r,"h","multiRNNCell"),s=i,u=[],c=0;c<t.length;c++){var l=t[c](s,o[c],a[c]);u.push(l[0]),u.push(l[1]),s=l[1]}var f=[],h=[];for(c=0;c<u.length;c+=2)f.push(u[c]),h.push(u[c+1]);return[f,h]}});var Nc=Ue({movingAverage_:function(t,e,n,r,i){void 0===i&&(i=!0);var o=Fe(t,"v","movingAverage"),a=Fe(e,"x","movingAverage"),s=Fe(n,"decay","movingAverage");(function(t,e){C(t.dtype===e.dtype,"The dtypes of the first("+t.dtype+") and second("+e.dtype+") input must match")})(o,a),C(x(o.shape,a.shape),"Shape mismatch in v and x");var u=Ke(1),c=u.sub(s),l=a.sub(o).mul(c);if(i){C(null!=r,"When using zeroDebias: true, step is required.");var f=Fe(r,"step","movingAverage");l=l.div(u.sub(Qu(s,f)))}return o.add(l)}});var Ic=Ue({stridedSlice_:function(t,e,n,r,i,o,a,s,u){if(void 0===i&&(i=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=0),0!==a)throw new Error("ellipsis mask is not yet supported");if(0!==s)throw new Error("new axis mask is not yet supported");var c=Fe(t,"x","stridedSlice");if(r.every(function(t){return 1===t})){var l=Te(c.shape,e,n,r,i,o,a,s,u),f=l[0],h=l[1],p=l[2],d=h.filter(function(t,e){return-1===p.indexOf(e)});return cu(c,f,h).reshape(d)}return te.engine.runKernel(function(t){return t.stridedSlice(c,e,n,r,i,o,a,s,u)},{$x:c})}});var Oc=Ue({topk_:function(t,e,n){void 0===e&&(e=1),void 0===n&&(n=!0);var r=Fe(t,"x","topk");if(0===r.rank)throw new Error("topk() expects the input to be of rank 1 or higher");var i=r.shape[r.shape.length-1];if(i<e)throw new Error("'k' passed to topk() must be <= the last dimension ("+i+") but got "+e);var o=te.engine.runKernel(function(t){return t.topk(r,e,n)},{$x:r});return{values:o[0],indices:o[1]}}});var kc=Ue({scatterND_:function(t,e,n){var r=Fe(t,"indices","scatterND","int32"),i=Fe(e,"updates","scatterND");return Ce(i,r,n),te.engine.runKernel(function(t){return t.scatterND(r,i,n)},{$indices:r,$updates:i})}});var Ac=Ue({fft_:function(t){C("complex64"===t.dtype,"The dtype for tf.spectral.fft() must be complex64 but got "+t.dtype+".");var e=t.shape[t.shape.length-1],n=t.size/e,r=t.as2D(n,e);return te.engine.runKernel(function(t){return t.fft(r)},{input:t}).reshape(t.shape)}}),Cc=Ue({ifft_:function(t){C("complex64"===t.dtype,"The dtype for tf.spectral.ifft() must be complex64 but got "+t.dtype+".");var e=t.shape[t.shape.length-1],n=t.size/e,r=t.as2D(n,e);return te.engine.runKernel(function(t){return t.ifft(r)},{input:t}).reshape(t.shape)}}),Pc=Ue({rfft_:function(t){C("float32"===t.dtype,"The dtype for rfft() must be real value but\n    got "+t.dtype);var e=t.shape[t.shape.length-1],n=t.size/e,r=t.zerosLike(),i=qe(t,r).as2D(n,e),o=Ac(i),a=Math.floor(e/2)+1,s=He(o),u=$e(o),c=s.split([a,e-a],s.shape.length-1),l=u.split([a,e-a],u.shape.length-1),f=t.shape.slice();return f[t.shape.length-1]=a,qe(c[0],l[0]).reshape(f)}}),Tc=Ue({irfft_:function(t){var e=t.shape[t.shape.length-1],n=t.size/e;if(e<=2){var r=t.as2D(n,e),i=Cc(r);return He(i)}var o=[n,2*(e-1)],a=He(t).as2D(n,e),s=$e(t).as2D(n,e),u=a.slice([0,1],[n,e-2]).reverse(1),c=s.slice([0,1],[n,e-2]).reverse(1).mul(Ke(-1)),l=a.concat(u,1),f=s.concat(c,1);return r=qe(l,f).as2D(o[0],o[1]),i=Cc(r),He(i)}}),Mc=Object.freeze({fft:Ac,ifft:Cc,rfft:Pc,irfft:Tc});var Rc=Ue({sparseToDense_:function(t,e,n,r){var i=Fe(t,"sparseIndices","sparseToDense","int32"),o=Fe(e,"sparseValues","sparseToDense"),a=Fe(r,"defaultValue","sparseToDense",o.dtype);return function(t,e,n,r){if("int32"!==t.dtype)throw new Error("tf.sparseToDense() expects the indices to be int32 type, but the dtype was "+t.dtype+".");if(2<t.rank)throw new Error("sparseIndices should be a scalar, vector, or matrix, but got shape "+t.shape+".");var i=0<t.rank?t.shape[0]:1,o=1<t.rank?t.shape[1]:1;if(n.length!==o)throw new Error("outputShape has incorrect number of elements:, "+n.length+", should be: "+o+".");var a=e.size;if(0!==e.rank&&(1!==e.rank||a!==i))throw new Error("sparseValues has incorrect shape "+e.shape+", should be [] or ["+i+"]");if(e.dtype!==r.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}(i,o,n,a),te.engine.runKernel(function(t){return t.sparseToDense(i,o,n,a)},{$sparseIndices:i,$sparseValues:o,$defaultValue:a})}});var Dc,jc,Bc=Ue({gatherND_:function(t,e){var n=Fe(e,"indices","gatherND","int32"),r=Fe(t,"x","gatherND");return te.engine.runKernel(function(t){return t.gatherND(r,n)},{$x:r,$indices:n})}});(jc=Dc||(Dc={}))[jc.NONE=0]="NONE",jc[jc.MEAN=1]="MEAN",jc[jc.SUM=2]="SUM",jc[jc.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS";var Lc=Ue({absoluteDifference_:function(t,e,n,r){void 0===r&&(r=Dc.SUM_BY_NONZERO_WEIGHTS);var i=Fe(t,"labels","absoluteDifference"),o=Fe(e,"predictions","absoluteDifference"),a=null;null!=n&&(a=Fe(n,"weights","absoluteDifference")),d(i.shape,o.shape,"Error in absoluteDifference: ");var s=i.sub(o).abs();return Fc(s,a,r)}}),Fc=Ue({computeWeightedLoss_:function(t,e,n){void 0===n&&(n=Dc.SUM_BY_NONZERO_WEIGHTS);var r=Fe(t,"losses","computeWeightedLoss"),i=null;null!=e&&(i=Fe(e,"weights","computeWeightedLoss"));var o=null==i?r:r.mul(i);if(n===Dc.NONE)return o;if(n===Dc.SUM)return o.sum();if(n===Dc.MEAN){if(null==i)return o.mean();var a=L(r.shape)/L(i.shape),s=o.sum().div(i.sum());return 1<a?s.div(Ke(a)):s}if(n!==Dc.SUM_BY_NONZERO_WEIGHTS)throw Error("Unknown reduction: "+n);if(null==i)return o.sum().div(Ke(r.size));var u=i.mul(en(r.shape)).notEqual(Ke(0)).sum().toFloat();return o.sum().div(u)}}),zc=Ue({cosineDistance_:function(t,e,n,r,i){void 0===i&&(i=Dc.SUM_BY_NONZERO_WEIGHTS);var o=Fe(t,"labels","cosineDistance"),a=Fe(e,"predictions","cosineDistance"),s=null;null!=r&&(s=Fe(r,"weights","cosineDistance")),d(o.shape,a.shape,"Error in cosineDistance: ");var u=Ke(1).sub(o.mul(a).sum(n,!0));return Fc(u,s,i)}}),Uc=Ue({hingeLoss_:function(t,e,n,r){void 0===r&&(r=Dc.SUM_BY_NONZERO_WEIGHTS);var i=Fe(t,"labels","hingeLoss"),o=Fe(e,"predictions","hingeLoss"),a=null;null!=n&&(a=Fe(n,"weights","hingeLoss")),d(i.shape,o.shape,"Error in hingeLoss: ");var s=Ke(1);i=Ke(2).mul(i).sub(s);var u=s.sub(i.mul(o)).relu();return Fc(u,a,r)}}),Vc=Ue({huberLoss_:function(t,e,n,r,i){void 0===r&&(r=1),void 0===i&&(i=Dc.SUM_BY_NONZERO_WEIGHTS);var o=Fe(t,"labels","huberLoss"),a=Fe(e,"predictions","huberLoss"),s=null;null!=n&&(s=Fe(n,"weights","huberLoss")),d(o.shape,a.shape,"Error in huberLoss: ");var u=Ke(r),c=a.sub(o).abs(),l=Gu(c,u),f=c.sub(l),h=Ke(.5).mul(l.square()).add(u.mul(f));return Fc(h,s,i)}}),Wc=Ue({logLoss_:function(t,e,n,r,i){void 0===r&&(r=1e-7),void 0===i&&(i=Dc.SUM_BY_NONZERO_WEIGHTS);var o=Fe(t,"labels","logLoss"),a=Fe(e,"predictions","logLoss"),s=null;null!=n&&(s=Fe(n,"weights","logLoss")),d(o.shape,a.shape,"Error in logLoss: ");var u=Ke(1),c=Ke(r),l=o.mul(a.add(c).log()).neg().sub(u.sub(o).mul(u.sub(a).add(c).log()));return Fc(l,s,i)}}),qc=Ue({meanSquaredError_:function(t,e,n,r){void 0===r&&(r=Dc.SUM_BY_NONZERO_WEIGHTS);var i=Fe(t,"labels","meanSquaredError"),o=Fe(e,"predictions","meanSquaredError"),a=null;null!=n&&(a=Fe(n,"weights","meanSquaredError")),d(i.shape,o.shape,"Error in meanSquaredError: ");var s=i.squaredDifference(o);return Fc(s,a,r)}}),Hc=Ue({sigmoidCrossEntropy_:function(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=Dc.SUM_BY_NONZERO_WEIGHTS);var o=Fe(t,"multiClassLabels","sigmoidCrossEntropy"),a=Fe(e,"logits","sigmoidCrossEntropy"),s=null;if(null!=n&&(s=Fe(n,"weights","sigmoidCrossEntropy")),d(o.shape,a.shape,"Error in sigmoidCrossEntropy: "),0<r){var u=Ke(r),c=Ke(1),l=Ke(.5);o=o.mul(c.sub(u)).add(l.mul(u))}var f=function(t,e){var n=Fe(t,"labels","sigmoidCrossEntropyWithLogits"),r=Fe(e,"logits","sigmoidCrossEntropyWithLogits");d(n.shape,r.shape,"Error in sigmoidCrossEntropyWithLogits: ");var i=r.relu(),o=r.mul(n),a=r.abs().neg().exp().log1p();return i.sub(o).add(a)}(o,a);return Fc(f,s,i)}}),$c=Ue({softmaxCrossEntropy_:function(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=Dc.SUM_BY_NONZERO_WEIGHTS);var o=Fe(t,"onehotLabels","softmaxCrossEntropy"),a=Fe(e,"logits","softmaxCrossEntropy"),s=null;if(null!=n&&(s=Fe(n,"weights","softmaxCrossEntropy")),d(o.shape,a.shape,"Error in softmaxCrossEntropy: "),0<r){var u=Ke(r),c=Ke(1),l=Ke(o.shape[1]);o=o.mul(c.sub(u)).add(u.div(l))}var f=function(t,e,i){if(void 0===i&&(i=-1),-1===i&&(i=e.rank-1),i!==e.rank-1)throw Error("Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank "+e.rank+" and dim was "+i);return se(function(n,t){var e=t.logSumExp([i],!0),r=t.toFloat().sub(e);return{value:r.mul(n).neg().sum([i]),gradFunc:function(t){var e=xe(t.shape,[i]);return[t.reshape(e).mul(n.toFloat().sub(r.exp())),t.reshape(e).mul(r.exp().sub(n.toFloat()))]}}})(t,e)}(o,a);return Fc(f,s,i)}}),Gc=Object.freeze({get Reduction(){return Dc},absoluteDifference:Lc,computeWeightedLoss:Fc,cosineDistance:zc,hingeLoss:Uc,huberLoss:Vc,logLoss:Wc,meanSquaredError:qc,sigmoidCrossEntropy:Hc,softmaxCrossEntropy:$c});function Kc(r,i){return void 0===i&&(i=!1),te.engine.tidy(function(){if(2!==r.shape.length)throw new Error("qr2d() requires a 2D Tensor, but got a "+r.shape.length+"D Tensor.");for(var f=r.shape[0],h=r.shape[1],p=da(f),d=r.clone(),m=Ye([[1]],[1,1]),g=m.clone(),t=h<=f?h:f,e=function(l){var t,e=d,n=g,r=p;g=(t=te.engine.tidy(function(){var t=d.slice([l,l],[f-l,1]),e=t.norm(),n=d.slice([l,l],[1,1]),r=n.sign().neg(),i=n.sub(r.mul(e)),o=t.div(i);g=1===o.shape[0]?m.clone():m.concat(o.slice([1,0],[o.shape[0]-1,o.shape[1]]),0);var a=r.matMul(i).div(e).neg(),s=d.slice([l,0],[f-l,h]),u=a.mul(g);d=0===l?s.sub(u.matMul(g.transpose().matMul(s))):d.slice([0,0],[l,h]).concat(s.sub(u.matMul(g.transpose().matMul(s))),0);var c=p.slice([0,l],[f,p.shape[1]-l]);return p=0===l?c.sub(c.matMul(g).matMul(u.transpose())):p.slice([0,0],[f,l]).concat(c.sub(c.matMul(g).matMul(u.transpose())),1),[g,d,p]}))[0],d=t[1],p=t[2],fe([e,n,r])},n=0;n<t;++n)e(n);return!i&&h<f&&(p=p.slice([0,0],[f,h]),d=d.slice([0,0],[h,h])),[p,d]})}var Xc=Ue({gramSchmidt_:function(t){var e;if(Array.isArray(t)){e=!1,C(null!=t&&0<t.length,"Gram-Schmidt process: input must not be null, undefined, or empty");for(var n=t[0].shape[0],r=1;r<t.length;++r)C(t[r].shape[0]===n,"Gram-Schmidt: Non-unique lengths found in the input vectors: ("+t[r].shape[0]+" vs. "+n+")")}else e=!0,t=Go(t,t.shape[0],0).map(function(t){return ka(t,[0])});function i(r){o.push(te.engine.tidy(function(){var t=a[r];if(0<r)for(var e=0;e<r;++e){var n=Su(o[e].mulStrict(t)).mul(o[e]);t=t.sub(n)}return t.div(vc(t,"euclidean"))}))}C(t.length<=t[0].shape[0],"Gram-Schmidt: Number of vectors ("+t.length+") exceeds number of dimensions ("+t[0].shape[0]+").");var o=[],a=t;for(r=0;r<t.length;++r)i(r);return e?Aa(o,0):o}}),Yc=Ue({qr_:function(t,i){if(void 0===i&&(i=!1),t.rank<2)throw new Error("qr() requires input tensor to have a rank >= 2, but got rank "+t.rank);if(2===t.rank)return Kc(t,i);var e=t.shape.slice(0,t.shape.length-2).reduce(function(t,e){return t*e}),o=[],a=[];return Ta(t.reshape([e,t.shape[t.shape.length-2],t.shape[t.shape.length-1]]),0).forEach(function(t){var e=Kc(t,i),n=e[0],r=e[1];o.push(n),a.push(r)}),[Aa(o,0).reshape(t.shape),Aa(a,0).reshape(t.shape)]}}),Zc=Object.freeze({gramSchmidt:Xc,qr:Yc});function Jc(t,e,n,r,i){null==r&&(r=.5),null==i&&(i=Number.NEGATIVE_INFINITY);var o=t.shape[0];return n=Math.min(n,o),C(0<=r&&r<=1,"iouThreshold must be in [0, 1], but was '"+r+"'"),C(2===t.rank,"boxes must be a 2D tensor, but was of rank '"+t.rank+"'"),C(4===t.shape[1],"boxes must have 4 columns, but 2nd dimension was "+t.shape[1]),C(1===e.rank,"scores must be a 1D tensor"),C(e.shape[0]===o,"scores has incompatible shape with boxes. Expected "+o+", but was "+e.shape[0]),{maxOutputSize:n,iouThreshold:r,scoreThreshold:i}}function Qc(s,u,c,l,f){return void 0===l&&(l=.5),void 0===f&&(f=Number.NEGATIVE_INFINITY),m(this,void 0,void 0,function(){var e,n,r,i,o,a;return I(this,function(t){switch(t.label){case 0:return e=Fe(s,"boxes","nonMaxSuppressionAsync"),n=Fe(u,"scores","nonMaxSuppressionAsync"),r=Jc(e,n,c,l,f),c=r.maxOutputSize,l=r.iouThreshold,f=r.scoreThreshold,[4,e.data()];case 1:return i=t.sent(),[4,n.data()];case 2:return o=t.sent(),a=yn(i,o,c,l,f),e!==s&&e.dispose(),n!==u&&n.dispose(),[2,a]}})})}var tl=Ue({resizeBilinear_:function(t,e,n){void 0===n&&(n=!1);var r=Fe(t,"images","resizeBilinear");C(3===r.rank||4===r.rank,"Error in resizeBilinear: x must be rank 3 or 4, but got rank "+r.rank+"."),C(2===e.length,"Error in resizeBilinear: new shape must 2D, but got shape "+e+".");var i=r,o=!1;3===r.rank&&(o=!0,i=r.as4D(1,r.shape[0],r.shape[1],r.shape[2]));var a=e[0],s=e[1],u=te.engine.runKernel(function(t,e){return t.resizeBilinear(i,a,s,n)},{batchImages:i},function(e,t){return{batchImages:function(){return te.engine.runKernel(function(t){return t.resizeBilinearBackprop(e,i,n)},{})}}});return o?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),el=Ue({resizeNearestNeighbor_:function(t,e,n){void 0===n&&(n=!1);var r=Fe(t,"images","resizeNearestNeighbor");C(3===r.rank||4===r.rank,"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank "+r.rank+"."),C(2===e.length,"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+e+"."),C("float32"===r.dtype||"int32"===r.dtype,"`images` must have `int32` or `float32` as dtype");var i=r,o=!1;3===r.rank&&(o=!0,i=r.as4D(1,r.shape[0],r.shape[1],r.shape[2]));var a=e[0],s=e[1],u=te.engine.runKernel(function(t,e){return t.resizeNearestNeighbor(i,a,s,n)},{batchImages:i},function(e,t){return{batchImages:function(){return te.engine.runKernel(function(t){return t.resizeNearestNeighborBackprop(e,i,n)},{})}}});return o?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),nl=Ue({nonMaxSuppression_:function(t,e,n,r,i){void 0===r&&(r=.5),void 0===i&&(i=Number.NEGATIVE_INFINITY);var o=Fe(t,"boxes","nonMaxSuppression"),a=Fe(e,"scores","nonMaxSuppression"),s=Jc(o,a,n,r,i);return n=s.maxOutputSize,r=s.iouThreshold,i=s.scoreThreshold,te.engine.runKernel(function(t){return t.nonMaxSuppression(o,a,n,r,i)},{$boxes:o})}}),rl=Ue({cropAndResize_:function(t,e,n,r,i,o){var a=Fe(t,"image","cropAndResize","float32"),s=Fe(e,"boxes","cropAndResize","float32"),u=Fe(n,"boxInd","cropAndResize","int32");i=i||"bilinear",o=o||0;var c=s.shape[0];return C(4===a.rank,"Error in cropAndResize: image must be rank 4,but got rank "+a.rank+"."),C(2===s.rank&&4===s.shape[1],"Error in cropAndResize: boxes must be have size ["+c+",4] but had shape "+s.shape+"."),C(1===u.rank&&u.shape[0]===c,"Error in cropAndResize: boxInd must be have size ["+c+"] but had shape "+s.shape+"."),C(2===r.length,"Error in cropAndResize: cropSize must be of length 2, but got length "+r.length+"."),C(1<=r[0]&&1<=r[1],"cropSize must be atleast [1,1], but was "+r),C("bilinear"===i||"nearest"===i,"method must be bilinear or nearest, but was "+i),te.engine.runKernel(function(t,e){return t.cropAndResize(a,s,u,r,i,o)},{$image:a,$boxes:s})}}),il=Object.freeze({resizeBilinear:tl,resizeNearestNeighbor:el,nonMaxSuppression:nl,nonMaxSuppressionAsync:Qc,cropAndResize:rl});var ol=Ue({matMul_:function(t,e,o,a,s,u){var n;void 0===o&&(o=!1),void 0===a&&(a=!1),void 0===u&&(u="linear");var r=Fe(t,"a","fused matMul"),i=Fe(e,"b","fused matMul");r=(n=Rt(r,i))[0],i=n[1];var c=o?r.shape[r.rank-2]:r.shape[r.rank-1],l=a?i.shape[i.rank-1]:i.shape[i.rank-2],f=o?r.shape[r.rank-1]:r.shape[r.rank-2],h=a?i.shape[i.rank-2]:i.shape[i.rank-1],p=r.shape.slice(0,-2),d=i.shape.slice(0,-2),m=L(p),g=L(d);C(2<=r.rank&&2<=i.rank&&r.rank===i.rank,"Error in fused matMul: inputs must have the same rank of at least 2, got ranks "+r.rank+" and "+i.rank+"."),C(x(p,d),"Error in fused matMul: outer dimensions ("+p+") and ("+d+") of Tensors with shapes "+r.shape+" and "+i.shape+" must match."),C(c===l,"Error in fused matMul: inner shapes ("+c+") and ("+l+") of Tensors with shapes "+r.shape+" and "+i.shape+" and transposeA="+o+" and transposeB="+a+" must match.");var y,v=r.shape.slice(0,-2).concat([f,h]),b=o?r.as3D(m,c,f):r.as3D(m,f,c),w=a?i.as3D(g,h,l):i.as3D(g,l,h);null!=s&&(y=Rt(y=Fe(s,"bias","fused matMul"),r)[0],Nn(v,y.shape));var _={$a:b,$b:w};return null!=s&&(_.$bias=y),te.engine.runKernel(function(t,e){return e(t.fusedBatchMatMul(b,w,o,a,y,u))},_,function(t,e){var n,r=e[0];if(null==u||"linear"===u)n=t;else{if("relu"!==u)throw new Error("Gradient for activation "+u+" has not been implemented yet.");n=t.mul(r.step())}var i={};return null!=s&&(i={$bias:function(){var t=n,e=Sn(y.shape,v);return 0<e.length&&(t=t.sum(e)),t.reshape(y.shape)}}),o||a?!o&&a?Object.assign({$a:function(){return n.matMul(w,!1,!1)},$b:function(){return n.matMul(b,!0,!1)}},i):o&&!a?Object.assign({$a:function(){return w.matMul(n,!1,!0)},$b:function(){return b.matMul(n,!1,!1)}},i):Object.assign({$a:function(){return w.matMul(n,!0,!0)},$b:function(){return n.matMul(b,!0,!0)}},i):Object.assign({$a:function(){return n.matMul(w,!1,!0)},$b:function(){return b.matMul(n,!0,!1)}},i)}).reshape(v)}}),al=Object.freeze({matMul:ol}),sl=Object.freeze({image:il,linalg:Zc,losses:Gc,spectral:Mc,fused:al,op:Ue,batchNormalization2d:Es,batchNormalization3d:Ss,batchNormalization4d:Ns,batchNormalization:Is,batchNorm:Os,batchNorm2d:ks,batchNorm3d:As,batchNorm4d:Cs,complex:qe,real:He,imag:$e,concat:Vo,concat1d:Wo,concat2d:qo,concat3d:Ho,concat4d:$o,split:Go,conv1d:$s,conv2d:Gs,conv3d:Ks,conv2dDerFilter:Xs,depthwiseConv2d:Ys,separableConv2d:Zs,conv2dTranspose:Js,matMul:zs,dot:Us,outerProduct:Vs,reverse:Qs,reverse1d:tu,reverse2d:eu,reverse3d:nu,reverse4d:ru,maxPool:au,avgPool:su,pool:uu,slice:cu,slice1d:lu,slice2d:fu,slice3d:hu,slice4d:pu,abs:Fa,acos:za,acosh:Ua,asin:Va,asinh:Wa,atan:qa,atanh:Ha,ceil:$a,clipByValue:Ga,cos:Ka,cosh:Xa,erf:Ya,exp:Za,expm1:Ja,floor:Qa,log:ts,log1p:es,logSigmoid:ns,neg:rs,reciprocal:is,round:os,rsqrt:as,sigmoid:ss,sign:us,sin:cs,sinh:ls,softplus:fs,sqrt:hs,square:ps,step:ds,tan:ms,tanh:gs,all:mu,any:gu,argMax:yu,argMin:vu,logSumExp:bu,max:wu,mean:_u,min:xu,moments:Eu,sum:Su,prod:Nu,equal:Iu,equalStrict:Ou,greater:ku,greaterEqual:Au,greaterEqualStrict:Cu,greaterStrict:Pu,less:Tu,lessEqual:Mu,lessEqualStrict:Ru,lessStrict:Du,notEqual:ju,notEqualStrict:Bu,add:Lu,addN:Fu,addStrict:zu,atan2:Uu,div:Vu,divStrict:Wu,floorDiv:qu,maximum:Hu,maximumStrict:$u,minimum:Gu,minimumStrict:Ku,mod:Xu,modStrict:Yu,mul:Zu,mulStrict:Ju,pow:Qu,powStrict:tc,squaredDifference:ec,squaredDifferenceStrict:nc,sub:rc,subStrict:ic,elu:fc,leakyRelu:hc,prelu:pc,relu:dc,selu:mc,logicalAnd:oc,logicalNot:ac,logicalOr:sc,logicalXor:uc,where:cc,whereAsync:lc,buffer:aa,toPixels:oa,print:sa,batchToSpaceND:ua,cast:ca,clone:la,cumsum:fa,depthToSpace:ha,expandDims:pa,eye:da,fromPixels:ma,multinomial:ga,oneHot:ya,pad:va,pad1d:ba,pad2d:wa,pad3d:_a,pad4d:xa,rand:Ea,randomNormal:Sa,randomUniform:Na,reshape:Ia,spaceToBatchND:Oa,squeeze:ka,stack:Aa,tile:Ca,truncatedNormal:Pa,unstack:Ta,setdiff1dAsync:Ma,fill:rn,linspace:on,ones:en,range:an,scalar:Ke,tensor:Ge,tensor1d:Xe,tensor2d:Ye,tensor3d:Ze,tensor4d:Je,tensor5d:Qe,tensor6d:tn,zeros:nn,onesLike:sn,zerosLike:un,transpose:gc,softmax:Ve,logSoftmax:We,localResponseNormalization:yc,norm:vc,gather:_c,unsortedSegmentSum:xc,basicLSTMCell:Ec,multiRNNCell:Sc,movingAverage:Nc,stridedSlice:Ic,topk:Oc,scatterND:kc,fft:Ac,ifft:Cc,rfft:Pc,irfft:Tc,sparseToDense:Rc,gatherND:Bc});var ul=(cl.prototype.setDataMover=function(t){this.data=new cn(t)},cl.prototype.register=function(t,e,n){if(this.firstUse&&(this.firstUse=!1,te.get("IS_NODE")&&de("\n============================\nHi there üëã. 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.\n============================\n")),this.data.has(t))throw new Error("Data buffer is already registered");this.data.set(t,{dtype:n})},cl.prototype.write=function(t,e){if(null==e)throw new Error("MathBackendCPU.write(): values can not be null");this.data.get(t).values=e},cl.prototype.fromPixels=function(t,e){if(null==t)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");var n,r;if(te.get("IS_NODE")&&null==t.getContext)throw new Error("When running in node, pixels must be an HTMLCanvasElement like the one returned by the `canvas` npm package");if(null!=t.getContext)n=t.getContext("2d").getImageData(0,0,t.width,t.height).data;else if(t instanceof ImageData)n=t.data;else{if(!(t instanceof HTMLImageElement||t instanceof HTMLVideoElement))throw new Error("pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement or ImageData, but was "+t.constructor.name);if(null==this.fromPixels2DContext)throw new Error("Can't read pixels from HTMLImageElement outside the browser.");this.fromPixels2DContext.canvas.width=t.width,this.fromPixels2DContext.canvas.height=t.height,this.fromPixels2DContext.drawImage(t,0,0,t.width,t.height),n=this.fromPixels2DContext.getImageData(0,0,t.width,t.height).data}if(4===e)r=new Int32Array(n);else{var i=t.width*t.height;r=new Int32Array(i*e);for(var o=0;o<i;o++)for(var a=0;a<e;++a)r[o*e+a]=n[4*o+a]}return Ze(r,[t.height,t.width,e],"int32")},cl.prototype.read=function(e){return m(this,void 0,void 0,function(){return I(this,function(t){return[2,this.readSync(e)]})})},cl.prototype.readSync=function(t){var e=this.data.get(t),n=e.dtype,r=e.complexTensors;return"complex64"===n?mn(r.real.dataSync(),r.imag.dataSync()):this.data.get(t).values},cl.prototype.disposeData=function(t){if(this.data.has(t)){var e=this.data.get(t).complexTensors;null!=e&&(e.real.dispose(),e.imag.dispose()),this.data.delete(t)}},cl.prototype.time=function(n){return m(this,void 0,void 0,function(){var e;return I(this,function(t){return e=Y(),n(),[2,{kernelMs:Y()-e}]})})},cl.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."]}},cl.prototype.complex=function(t,e){var n=mt.make(t.shape,{},"complex64");return this.data.get(n.dataId).complexTensors={real:te.engine.keep(t.clone()),imag:te.engine.keep(e.clone())},n},cl.prototype.real=function(t){return this.data.get(t.dataId).complexTensors.real.clone()},cl.prototype.imag=function(t){return this.data.get(t.dataId).complexTensors.imag.clone()},cl.prototype.assertNotComplex=function(t,e){Array.isArray(t)||(t=[t]),t.forEach(function(t){null!=t&&C("complex64"!==t.dtype,e+" does not support complex64 tensors.")})},cl.prototype.slice=function(t,n,e){if(this.assertNotComplex(t,"slice"),De(t.shape,n,e)){var r=je(n,t.strides),i=L(e);return Ge(t.dataSync().subarray(r,r+i),e,t.dtype)}for(var o=aa(e,t.dtype),a=t.bufferSync(),s=0;s<o.size;++s){var u=o.indexToLoc(s).map(function(t,e){return t+n[e]});o.values[s]=a.get.apply(a,u)}return o.toTensor()},cl.prototype.stridedSlice=function(t,e,n,r,i,o,a,s,u){this.assertNotComplex(t,"stridedSlice");var c=Te(t.shape,e,n,r,i,o,a,s,u),l=c[0],f=c[1],h=c[2],p=f.filter(function(t,e){return-1===h.indexOf(e)});if(p.some(function(t){return 0===t}))return Ge([],p);for(var d=aa(f,t.dtype),m=t.bufferSync(),g=0;g<d.size;g++){for(var y=d.indexToLoc(g),v=new Array(y.length),b=0;b<v.length;b++)v[b]=y[b]*r[b]+l[b];d.set.apply(d,[m.get.apply(m,v)].concat(y))}return d.toTensor().reshape(p)},cl.prototype.unstack=function(t,e){for(var n=t.shape[e],r=new Array(t.rank-1),i=0,o=0;o<t.rank;o++)o!==e&&(r[i++]=t.shape[o]);var a=new Array(t.rank).fill(0),s=t.shape.slice();s[e]=1;var u=new Array(n);for(o=0;o<u.length;o++)u[a[e]=o]=this.slice(t,a,s).reshape(r);return u},cl.prototype.reverse=function(r,i){this.assertNotComplex(r,"reverse");for(var o=aa(r.shape,r.dtype),a=r.bufferSync(),t=function(t){var e=o.indexToLoc(t),n=e.slice();i.forEach(function(t){return n[t]=r.shape[t]-1-n[t]}),o.set.apply(o,[a.get.apply(a,n)].concat(e))},e=0;e<o.size;e++)t(e);return o.toTensor()},cl.prototype.concat=function(t,n){this.assertNotComplex(t,"concat");var e=t.map(function(t){var e=L(t.shape.slice(n));return t.as2D(-1,e)}),a=Oe(e.map(function(t){return t.shape}),1),s=aa(a,t[0].dtype).values;if(1===e[0].shape[0]){var r=0;e.forEach(function(t){s.set(t.dataSync(),r),r+=t.size})}else{var u=0;e.forEach(function(t){for(var e=t.dataSync(),n=0,r=0;r<t.shape[0];++r)for(var i=r*a[1]+u,o=0;o<t.shape[1];++o)s[i+o]=e[n++];u+=t.shape[1]})}var i=Oe(t.map(function(t){return t.shape}),n);return Ge(s,i,t[0].dtype)},cl.prototype.neg=function(t){return this.assertNotComplex(t,"neg"),this.multiply(Ke(-1),t)},cl.prototype.add=function(t,e){return"complex64"===t.dtype||"complex64"===e.dtype?this.broadcastedBinaryComplexOp(t.cast("complex64"),e.cast("complex64"),function(t,e,n,r){return{real:t+n,imag:e+r}}):this.broadcastedBinaryOp(t,e,Tt(t.dtype,e.dtype),function(t,e){return t+e})},cl.prototype.addN=function(t){this.assertNotComplex(t,"addN");for(var e=t.map(function(t){return t.dataSync()}),n=aa(t[0].shape,t[0].dtype),r=n.values,i=0;i<t.length;i++)for(var o=e[i],a=0;a<r.length;a++)r[a]+=o[a];return n.toTensor()},cl.prototype.subtract=function(t,e){return"complex64"===t.dtype||"complex64"===e.dtype?this.broadcastedBinaryComplexOp(t.cast("complex64"),e.cast("complex64"),function(t,e,n,r){return{real:t-n,imag:e-r}}):this.broadcastedBinaryOp(t,e,Tt(t.dtype,e.dtype),function(t,e){return t-e})},cl.prototype.pow=function(t,e){return this.assertNotComplex([t,e],"pow"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return Math.pow(t,e)})},cl.prototype.batchMatMul=function(t,e,n,r){this.assertNotComplex([t,e],"matMul");for(var i=n?t.shape[1]:t.shape[2],o=n?t.shape[2]:t.shape[1],a=r?e.shape[1]:e.shape[2],s=t.shape[0],u=t.dataSync(),c=e.dataSync(),l=n?[t.strides[0],1,t.strides[1]]:[t.strides[0],t.strides[1],1],f=l[0],h=l[1],p=l[2],d=r?[1,e.strides[1],e.strides[0]]:[e.strides[1],1,e.strides[0]],m=d[0],g=d[1],y=d[2],v=o*a,b=aa([s,o,a],t.dtype),w=b.values,_=this.blockSize,x=0;x<s;x++)for(var E=0;E<o;E+=_)for(var S=0;S<a;S+=_)for(var N=0;N<i;N+=_)for(var I=Math.min(E+_,o),O=Math.min(S+_,a),k=Math.min(N+_,i),A=E;A<I;A++)for(var C=S;C<O;C++){for(var P=0,T=N;T<k;T++)P+=u[x*f+A*h+T*p]*c[T*m+C*g+x*y];w[x*v+(A*a+C)]+=P}return b.toTensor()},cl.prototype.fusedBatchMatMul=function(t,e,n,r,i,o){var a=this.batchMatMul(t,e,n,r);return i&&(a=this.add(a,i)),o&&(a=function(t,e,n){if("linear"===e)return t.linear(n);if("relu"===e)return t.relu(n);throw new Error("Activation "+e+" has not been implemented for the CPU backend.")}(this,o,a)),a},cl.prototype.multiply=function(t,e){return"complex64"===t.dtype||"complex64"===e.dtype?this.broadcastedBinaryComplexOp(t.cast("complex64"),e.cast("complex64"),function(t,e,n,r){return{real:t*n-e*r,imag:t*r+e*n}}):this.broadcastedBinaryOp(t,e,Tt(t.dtype,e.dtype),function(t,e){return t*e})},cl.prototype.realDivide=function(t,e){return this.assertNotComplex([t,e],"realDivide"),this.broadcastedBinaryOp(t,e,"float32",function(t,e){return t/e})},cl.prototype.floorDiv=function(t,e){return this.assertNotComplex([t,e],"floorDiv"),this.broadcastedBinaryOp(t,e,"int32",function(t,e){return Math.floor(t/e)})},cl.prototype.sum=function(t,e){this.assertNotComplex(t,"sum"),Ee("sum",e,t.rank);for(var n=_e(t.shape,e),r=n[0],i=n[1],o=nn(r,Tt(t.dtype,"int32")),a=L(i),s=o.dataSync(),u=t.dataSync(),c=0;c<s.length;++c){for(var l=c*a,f=0,h=0;h<a;++h)f+=u[l+h];s[c]=f}return o},cl.prototype.prod=function(t,e){this.assertNotComplex(t,"sum");for(var n=_e(t.shape,e),r=n[0],i=n[1],o=nn(r,Tt(t.dtype,"int32")),a=L(i),s=o.dataSync(),u=t.dataSync(),c=0;c<s.length;++c){for(var l=c*a,f=1,h=0;h<a;++h)f*=u[l+h];s[c]=f}return o},cl.prototype.unsortedSegmentSum=function(t,e,n){this.assertNotComplex(t,"unsortedSegmentSum");for(var r=[],i=t.rank-e.rank,o=0;o<i;++o)e=e.expandDims(o+1);for(o=0;o<n;++o){var a=Ke(o,"int32"),s=Iu(a,e).asType("float32").mul(t).sum(0);r.push(s)}return Aa(r)},cl.prototype.argMin=function(t,e){this.assertNotComplex(t,"argMin");var n=[e];Ee("argMin",n,t.rank);for(var r=_e(t.shape,n),i=r[0],o=r[1],a=nn(i,"int32"),s=L(o),u=a.dataSync(),c=t.dataSync(),l=0;l<u.length;++l){for(var f=l*s,h=c[f],p=0,d=0;d<s;++d){var m=c[f+d];m<h&&(h=m,p=d)}u[l]=p}return a},cl.prototype.argMax=function(t,e){this.assertNotComplex(t,"argMax");var n=[e];Ee("argMax",n,t.rank);for(var r=_e(t.shape,n),i=r[0],o=r[1],a=nn(i,"int32"),s=L(o),u=a.dataSync(),c=t.dataSync(),l=0;l<u.length;++l){for(var f=l*s,h=c[f],p=0,d=0;d<s;++d){var m=c[f+d];h<m&&(h=m,p=d)}u[l]=p}return a},cl.prototype.cumsum=function(t,e,n,r){if(this.assertNotComplex(t,"cumsum"),e!==t.rank-1)throw new Error("backend.cumsum in CPU expects an inner-most axis="+(t.rank-1)+" but got axis="+e);for(var i=Tt(t.dtype,"int32"),o=nn(t.shape,i),a=o.dataSync(),s=t.dataSync(),u=t.shape[t.rank-1],c=r?function(t,e){return t+u-e-1}:function(t,e){return t+e},l=0;l<s.length;l+=u)for(var f=0;f<u;f++){var h=c(l,f);if(0===f)a[h]=n?0:s[h];else{var p=c(l,f-1);a[h]=n?s[p]+a[p]:s[h]+a[p]}}return o},cl.prototype.equal=function(t,e){return this.assertNotComplex([t,e],"equal"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t===e?1:0})},cl.prototype.notEqual=function(t,e){return this.assertNotComplex([t,e],"notEqual"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t!==e?1:0})},cl.prototype.less=function(t,e){return this.assertNotComplex([t,e],"less"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t<e?1:0})},cl.prototype.lessEqual=function(t,e){return this.assertNotComplex([t,e],"lessEqual"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t<=e?1:0})},cl.prototype.greater=function(t,e){return this.assertNotComplex([t,e],"greater"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return e<t?1:0})},cl.prototype.greaterEqual=function(t,e){return this.assertNotComplex([t,e],"greaterEqual"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return e<=t?1:0})},cl.prototype.logicalNot=function(t){this.assertNotComplex(t,"logicalNot");for(var e=t.dataSync(),n=new Uint8Array(e.length),r=0;r<e.length;++r)n[r]=e[r]?0:1;return mt.make(t.shape,{values:n},"bool")},cl.prototype.logicalAnd=function(t,e){return this.assertNotComplex([t,e],"logicalAnd"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t&&e})},cl.prototype.logicalOr=function(t,e){return this.assertNotComplex([t,e],"logicalOr"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t||e})},cl.prototype.select=function(t,e,n){this.assertNotComplex([t,e,n],"select");for(var r=t.dataSync(),i=e.dataSync(),o=n.dataSync(),a=nn(e.shape,Tt(e.dtype,n.dtype)),s=a.dataSync(),u=0,c=0===t.rank||1<t.rank||1===e.rank?1:e.shape[1],l=0;l<r.length;l++)for(var f=0;f<c;f++)1===r[l]?s[u++]=i[l]:s[u++]=o[l];return a},cl.prototype.where=function(t){this.assertNotComplex([t],"where");var e=t.dataSync();return Ra(t.shape,e)},cl.prototype.topk=function(t,e,n){return this.assertNotComplex(t,"topk"),wn(t.dataSync(),t.shape,t.dtype,e)},cl.prototype.min=function(t,e){this.assertNotComplex(t,"min"),Ee("min",e,t.rank);for(var n=_e(t.shape,e),r=n[0],i=n[1],o=nn(r,t.dtype),a=L(i),s=o.dataSync(),u=t.dataSync(),c=0;c<s.length;++c){for(var l=c*a,f=u[l],h=0;h<a;++h){var p=u[l+h];p<f&&(f=p)}s[c]=f}return o},cl.prototype.minimum=function(t,e){return this.assertNotComplex([t,e],"minimum"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return Math.min(t,e)})},cl.prototype.mod=function(t,e){return this.assertNotComplex([t,e],"mod"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){var n=t%e;return t<0&&e<0||0<=t&&0<=e?n:(n+e)%e})},cl.prototype.max=function(t,e){this.assertNotComplex(t,"max"),Ee("max",e,t.rank);for(var n=_e(t.shape,e),r=n[0],i=n[1],o=nn(r,t.dtype),a=L(i),s=o.dataSync(),u=t.dataSync(),c=0;c<s.length;++c){for(var l=c*a,f=u[l],h=0;h<a;++h){var p=u[l+h];f<p&&(f=p)}s[c]=f}return o},cl.prototype.maximum=function(t,e){return this.assertNotComplex([t,e],"maximum"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return Math.max(t,e)})},cl.prototype.all=function(t,e){this.assertNotComplex(t,"all"),Ee("all",e,t.rank);for(var n=_e(t.shape,e),r=n[0],i=n[1],o=nn(r,t.dtype),a=L(i),s=o.dataSync(),u=t.dataSync(),c=0;c<s.length;++c){for(var l=c*a,f=u[l],h=0;h<a;++h){var p=u[l+h];f=f&&p}s[c]=f}return o},cl.prototype.any=function(t,e){this.assertNotComplex(t,"any"),Ee("any",e,t.rank);for(var n=_e(t.shape,e),r=n[0],i=n[1],o=nn(r,t.dtype),a=L(i),s=o.dataSync(),u=t.dataSync(),c=0;c<s.length;++c){for(var l=c*a,f=u[l],h=0;h<a;++h){var p=u[l+h];f=f||p}s[c]=f}return o},cl.prototype.squaredDifference=function(t,e){return this.assertNotComplex([t,e],"squaredDifference"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){var n=t-e;return n*n})},cl.prototype.ceil=function(t){this.assertNotComplex(t,"ceil");for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r<e.length;++r)n[r]=Math.ceil(e[r]);return mt.make(t.shape,{values:n})},cl.prototype.floor=function(t){this.assertNotComplex(t,"floor");for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r<e.length;++r)n[r]=Math.floor(e[r]);return mt.make(t.shape,{values:n})},cl.prototype.sign=function(t){this.assertNotComplex(t,"x");for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r<e.length;++r)e[r]<0?n[r]=-1:0<e[r]?n[r]=1:n[r]=0;return mt.make(t.shape,{values:n})},cl.prototype.round=function(t){this.assertNotComplex(t,"round");for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r<e.length;++r){var i=Math.floor(e[r]);e[r]-i<.5?n[r]=Math.floor(e[r]):.5<e[r]-i?n[r]=Math.ceil(e[r]):n[r]=i%2==0?i:i+1}return mt.make(t.shape,{values:n})},cl.prototype.exp=function(t){this.assertNotComplex(t,"exp");for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r<e.length;++r)n[r]=Math.exp(e[r]);return mt.make(t.shape,{values:n})},cl.prototype.expm1=function(t){this.assertNotComplex(t,"expm1");for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r<e.length;++r)n[r]=Math.expm1(e[r]);return mt.make(t.shape,{values:n})},cl.prototype.log=function(t){this.assertNotComplex(t,"log");for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r<e.length;++r){var i=e[r];n[r]=Math.log(i)}return mt.make(t.shape,{values:n})},cl.prototype.log1p=function(t){this.assertNotComplex(t,"log1p");for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r<e.length;++r){var i=e[r];n[r]=Math.log1p(i)}return mt.make(t.shape,{values:n})},cl.prototype.sqrt=function(t){this.assertNotComplex(t,"sqrt");for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r<e.length;++r){var i=e[r];n[r]=Math.sqrt(i)}return mt.make(t.shape,{values:n})},cl.prototype.rsqrt=function(t){this.assertNotComplex(t,"rsqrt");for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r<e.length;++r){var i=e[r];n[r]=1/Math.sqrt(i)}return mt.make(t.shape,{values:n})},cl.prototype.square=function(t){this.assertNotComplex(t,"square");for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r<e.length;++r){var i=e[r];n[r]=i*i}return mt.make(t.shape,{values:n})},cl.prototype.reciprocal=function(t){this.assertNotComplex(t,"reciprocal");for(var e=t.dataSync(),n=new Float32Array(e.length),r=0;r<e.length;++r)n[r]=1/e[r];return mt.make(t.shape,{values:n})},cl.prototype.linear=function(t){return t},cl.prototype.relu=function(t){this.assertNotComplex(t,"relu");for(var e=nn(t.shape,t.dtype),n=e.dataSync(),r=t.dataSync(),i=0;i<r.length;++i)n[i]=Math.max(0,r[i]);return e},cl.prototype.prelu=function(t,e){return this.assertNotComplex([t,e],"prelu"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return t<0?e*t:t})},cl.prototype.elu=function(t){this.assertNotComplex(t,"elu");for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r){var i=n[r];e[r]=0<=i?i:Math.exp(i)-1}return mt.make(t.shape,{values:e})},cl.prototype.eluDer=function(t,e){this.assertNotComplex([t,e],"eluDer");for(var n=new Float32Array(e.size),r=e.dataSync(),i=t.dataSync(),o=0;o<r.length;++o){var a=r[o];n[o]=1<=a?i[o]:i[o]*(a+1)}return mt.make(e.shape,{values:n})},cl.prototype.selu=function(t){this.assertNotComplex(t,"selu");for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r){var i=n[r];e[r]=0<=i?1.0507009873554805*i:1.7580993408473768*(Math.exp(i)-1)}return mt.make(t.shape,{values:e})},cl.prototype.clip=function(t,e,n){this.assertNotComplex(t,"clip");for(var r=new Float32Array(t.size),i=t.dataSync(),o=0;o<i.length;++o){var a=i[o];r[o]=n<a?n:a<e?e:a}return mt.make(t.shape,{values:r})},cl.prototype.abs=function(t){for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r)e[r]=Math.abs(n[r]);return mt.make(t.shape,{values:e})},cl.prototype.complexAbs=function(t){for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<t.size;++r){var i=n[2*r],o=n[2*r+1];e[r]=Math.hypot(i,o)}return mt.make(t.shape,{values:e})},cl.prototype.int=function(t){this.assertNotComplex(t,"int");for(var e=new Int32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r)e[r]=n[r];return mt.make(t.shape,{values:e},"int32")},cl.prototype.sigmoid=function(t){this.assertNotComplex(t,"sigmoid");for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r)e[r]=1/(1+Math.exp(-n[r]));return mt.make(t.shape,{values:e})},cl.prototype.softplus=function(t){this.assertNotComplex(t,"softplus");for(var e=Math.log(1.1920928955078125e-7)+2,n=new Float32Array(t.size),r=t.dataSync(),i=0;i<r.length;++i){var o,a=r[i]>-e,s=r[i]<e,u=Math.exp(r[i]);o=s?u:a?r[i]:Math.log(1+u),n[i]=o}return mt.make(t.shape,{values:n})},cl.prototype.sin=function(t){this.assertNotComplex(t,"sin");for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r)e[r]=Math.sin(n[r]);return mt.make(t.shape,{values:e})},cl.prototype.cos=function(t){this.assertNotComplex(t,"cos");for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r)e[r]=Math.cos(n[r]);return mt.make(t.shape,{values:e})},cl.prototype.tan=function(t){this.assertNotComplex(t,"tan");for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r)e[r]=Math.tan(n[r]);return mt.make(t.shape,{values:e})},cl.prototype.asin=function(t){this.assertNotComplex(t,"asin");for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r)e[r]=Math.asin(n[r]);return mt.make(t.shape,{values:e})},cl.prototype.acos=function(t){this.assertNotComplex(t,"acos");for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r)e[r]=Math.acos(n[r]);return mt.make(t.shape,{values:e})},cl.prototype.atan=function(t){this.assertNotComplex(t,"atan");for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r)e[r]=Math.atan(n[r]);return mt.make(t.shape,{values:e})},cl.prototype.atan2=function(t,e){return this.assertNotComplex([t,e],"atan2"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return Math.atan2(t,e)})},cl.prototype.sinh=function(t){this.assertNotComplex(t,"sinh");for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r)e[r]=Math.sinh(n[r]);return mt.make(t.shape,{values:e})},cl.prototype.cosh=function(t){this.assertNotComplex(t,"cosh");for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r)e[r]=Math.cosh(n[r]);return mt.make(t.shape,{values:e})},cl.prototype.tanh=function(t){this.assertNotComplex(t,"tanh");for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r)e[r]=v(n[r]);return mt.make(t.shape,{values:e})},cl.prototype.asinh=function(t){this.assertNotComplex(t,"asinh");for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r)e[r]=Math.asinh(n[r]);return mt.make(t.shape,{values:e})},cl.prototype.acosh=function(t){this.assertNotComplex(t,"acosh");for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r)e[r]=Math.acosh(n[r]);return mt.make(t.shape,{values:e})},cl.prototype.atanh=function(t){this.assertNotComplex(t,"atanh");for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r)e[r]=Math.atanh(n[r]);return mt.make(t.shape,{values:e})},cl.prototype.erf=function(t){this.assertNotComplex(t,"erf");for(var e=new Float32Array(t.size),n=t.dataSync(),r=0;r<n.length;++r){var i=n[r],o=1/(1+.3275911*i);e[r]=1-((((1.061405429*o-1.453152027)*o+1.421413741)*o-.284496736)*o+.254829592)*o*Math.exp(-i*i)}return mt.make(t.shape,{values:e})},cl.prototype.step=function(t,e){void 0===e&&(e=0),this.assertNotComplex(t,"step");for(var n=new Float32Array(t.size),r=t.dataSync(),i=0;i<r.length;++i){var o=r[i];isNaN(o)?n[i]=NaN:n[i]=0<o?1:e}return mt.make(t.shape,{values:n})},cl.prototype.conv2d=function(t,e,n){this.assertNotComplex([t,e],"conv2d");for(var r=n.filterHeight,i=n.filterWidth,o=n.dilationHeight,a=n.dilationWidth,s=n.padInfo.left,u=n.padInfo.top,c=aa(n.outShape,t.dtype),l=t.dataSync(),f=e.dataSync(),h=c.values,p=0;p<n.batchSize;++p)for(var d=p*t.strides[0],m=p*c.strides[0],g=0;g<n.outHeight;++g)for(var y=m+g*c.strides[1],v=g*n.strideHeight-s,b=0;b<r;b++){var w=v+b*o;if(!(w<0||w>=n.inHeight))for(var _=b*e.strides[0],x=d+w*t.strides[1],E=0;E<n.outWidth;++E)for(var S=y+E*n.outChannels,N=E*n.strideWidth-u,I=0;I<i;I++){var O=N+I*a;if(!(O<0||O>=n.inWidth))for(var k=_+I*e.strides[1],A=x+O*n.inChannels,C=k,P=0;P<n.inChannels;++P){for(var T=l[A+P],M=0;M<n.outChannels;++M)h[S+M]+=T*f[C+M];C+=n.outChannels}}}return c.toTensor()},cl.prototype.conv3d=function(t,e,n){for(var r=n.filterDepth,i=n.filterHeight,o=n.filterWidth,a=n.dilationDepth,s=n.dilationHeight,u=n.dilationWidth,c=n.padInfo.front,l=n.padInfo.left,f=n.padInfo.top,h=aa(n.outShape,t.dtype),p=t.dataSync(),d=e.dataSync(),m=h.values,g=0;g<n.batchSize;++g)for(var y=g*t.strides[0],v=g*h.strides[0],b=0;b<n.outDepth;++b)for(var w=v+b*h.strides[1],_=b*n.strideDepth-c,x=0;x<r;x++){var E=_+x*a;if(!(E<0||E>=n.inDepth))for(var S=x*e.strides[0],N=y+E*t.strides[1],I=0;I<n.outHeight;++I)for(var O=w+I*h.strides[2],k=I*n.strideHeight-f,A=0;A<i;A++){var C=k+A*s;if(!(C<0||C>=n.inHeight))for(var P=S+A*e.strides[1],T=N+C*t.strides[2],M=0;M<n.outWidth;++M)for(var R=O+M*n.outChannels,D=M*n.strideWidth-l,j=0;j<o;j++){var B=D+j*u;if(!(B<0||B>=n.inWidth))for(var L=P+j*e.strides[2],F=T+B*n.inChannels,z=L,U=0;U<n.inChannels;++U){for(var V=p[F+U],W=0;W<n.outChannels;++W)m[R+W]+=V*d[z+W];z+=n.outChannels}}}}return h.toTensor()},cl.prototype.conv2dDerInput=function(t,e,n){this.assertNotComplex([t,e],"conv2dDerInput");for(var r=aa(n.inShape,"float32"),i=r.values,o=r.strides,a=o[0],s=o[1],u=o[2],c=t.dataSync(),l=t.strides,f=l[0],h=l[1],p=l[2],d=e.dataSync(),m=e.strides,g=m[0],y=m[1],v=m[2],b=n.batchSize,w=n.filterHeight,_=n.filterWidth,x=n.inChannels,E=n.inHeight,S=n.inWidth,N=n.outChannels,I=n.outHeight,O=n.outWidth,k=n.strideHeight,A=n.strideWidth,C=w-1-n.padInfo.top,P=_-1-n.padInfo.left,T=0;T<b;++T)for(var M=0;M<x;++M)for(var R=0;R<E;++R)for(var D=R-C,j=Math.max(0,Math.ceil(D/k)),B=Math.min(I,(w+D)/k),L=0;L<S;++L){for(var F=L-P,z=Math.max(0,Math.ceil(F/A)),U=Math.min(O,(_+F)/A),V=0,W=j;W<B;++W)for(var q=W*k-D,H=z;H<U;++H)for(var $=f*T+h*W+p*H,G=g*(w-1-q)+y*(_-1-(H*A-F))+v*M,K=0;K<N;++K)V+=c[$+K]*d[G+K];i[a*T+s*R+u*L+M]=V}return r.toTensor()},cl.prototype.conv3dDerInput=function(t,e,n){for(var r=aa(n.inShape,"float32"),i=r.values,o=r.strides,a=o[0],s=o[1],u=o[2],c=o[3],l=t.dataSync(),f=t.strides,h=f[0],p=f[1],d=f[2],m=f[3],g=e.dataSync(),y=e.strides,v=y[0],b=y[1],w=y[2],_=y[3],x=n.batchSize,E=n.filterDepth,S=n.filterHeight,N=n.filterWidth,I=n.inChannels,O=n.inDepth,k=n.inHeight,A=n.inWidth,C=n.outChannels,P=n.outDepth,T=n.outHeight,M=n.outWidth,R=n.strideDepth,D=n.strideHeight,j=n.strideWidth,B=E-1-n.padInfo.front,L=S-1-n.padInfo.top,F=N-1-n.padInfo.left,z=0;z<x;++z)for(var U=0;U<I;++U)for(var V=0;V<O;++V)for(var W=V-B,q=Math.max(0,Math.ceil(W/R)),H=Math.min(P,(E+W)/R),$=0;$<k;++$)for(var G=$-L,K=Math.max(0,Math.ceil(G/D)),X=Math.min(T,(S+G)/D),Y=0;Y<A;++Y){for(var Z=Y-F,J=Math.max(0,Math.ceil(Z/j)),Q=Math.min(M,(N+Z)/j),tt=0,et=q;et<H;++et)for(var nt=et*R-W,rt=K;rt<X;++rt)for(var it=rt*D-G,ot=J;ot<Q;++ot)for(var at=h*z+p*et+d*rt+m*ot,st=v*(E-1-nt)+b*(S-1-it)+w*(N-1-(ot*j-Z))+_*U,ut=0;ut<C;++ut)tt+=l[at+ut]*g[st+ut];i[a*z+s*V+u*$+c*Y+U]=tt}return r.toTensor()},cl.prototype.conv2dDerFilter=function(t,e,n){this.assertNotComplex([t,e],"conv2dDerFilter");for(var r=n.strideHeight,i=n.strideWidth,o=n.filterHeight,a=n.filterWidth,s=aa(n.filterShape,"float32"),u=n.padInfo.left,c=n.padInfo.top,l=t.bufferSync(),f=e.bufferSync(),h=0;h<o;++h)for(var p=Math.max(0,Math.ceil((c-h)/r)),d=Math.min(n.outHeight,(n.inHeight+c-h)/r),m=0;m<a;++m)for(var g=Math.max(0,Math.ceil((u-m)/i)),y=Math.min(n.outWidth,(n.inWidth+u-m)/i),v=0;v<n.inChannels;++v)for(var b=0;b<n.outChannels;++b){for(var w=0,_=0;_<n.batchSize;++_)for(var x=p;x<d;++x)for(var E=h+x*r-c,S=g;S<y;++S){var N=m+S*i-u;w+=l.get(_,E,N,v)*f.get(_,x,S,b)}s.set(w,h,m,v,b)}return s.toTensor()},cl.prototype.conv3dDerFilter=function(t,e,n){for(var r=n.strideDepth,i=n.strideHeight,o=n.strideWidth,a=n.filterDepth,s=n.filterHeight,u=n.filterWidth,c=aa(n.filterShape,"float32"),l=c.values,f=c.strides,h=f[0],p=f[1],d=f[2],m=f[3],g=e.dataSync(),y=e.strides,v=y[0],b=y[1],w=y[2],_=y[3],x=t.dataSync(),E=t.strides,S=E[0],N=E[1],I=E[2],O=E[3],k=n.padInfo.front,A=n.padInfo.left,C=n.padInfo.top,P=0;P<a;++P)for(var T=Math.max(0,Math.ceil((k-P)/r)),M=Math.min(n.outDepth,(n.inDepth+k-P)/r),R=P*h,D=0;D<s;++D)for(var j=Math.max(0,Math.ceil((C-D)/i)),B=Math.min(n.outHeight,(n.inHeight+C-D)/i),L=D*p+R,F=0;F<u;++F)for(var z=Math.max(0,Math.ceil((A-F)/o)),U=Math.min(n.outWidth,(n.inWidth+A-F)/o),V=F*d+L,W=0;W<n.inChannels;++W)for(var q=W*m+V,H=0;H<n.outChannels;++H){for(var $=0,G=0;G<n.batchSize;++G)for(var K=G*S,X=G*v,Y=T;Y<M;++Y)for(var Z=(P+Y*r-k)*N+K,J=Y*b+X,Q=j;Q<B;++Q)for(var tt=(D+Q*i-C)*I+Z,et=Q*w+J,nt=z;nt<U;++nt){var rt=nt*_+et;$+=x[(F+nt*o-A)*O+tt+W]*g[rt+H]}l[q+H]=$}return c.toTensor()},cl.prototype.depthwiseConv2D=function(t,e,n){this.assertNotComplex([t,e],"depthwiseConv2D");for(var r=n.filterHeight,i=n.filterWidth,o=n.dilationHeight,a=n.dilationWidth,s=n.padInfo.left,u=n.padInfo.top,c=n.outChannels/n.inChannels,l=aa(n.outShape,t.dtype),f=t.dataSync(),h=e.dataSync(),p=l.values,d=0;d<n.batchSize;++d)for(var m=d*t.strides[0],g=d*l.strides[0],y=0;y<n.outHeight;++y)for(var v=g+y*l.strides[1],b=y*n.strideHeight-s,w=0;w<r;++w){var _=b+w*o;if(!(_<0||_>=n.inHeight))for(var x=w*e.strides[0],E=m+_*t.strides[1],S=0;S<n.outWidth;++S)for(var N=v+S*l.strides[2],I=S*n.strideWidth-u,O=0;O<i;++O){var k=I+O*a;if(!(k<0||k>=n.inWidth))for(var A=x+O*e.strides[1],C=E+k*n.inChannels,P=N,T=A,M=0;M<n.inChannels;++M){for(var R=f[C+M],D=0;D<c;++D)p[P+D]+=R*h[T+D];P+=c,T+=c}}}return l.toTensor()},cl.prototype.depthwiseConv2DDerInput=function(t,e,n){this.assertNotComplex([t,e],"depthwiseConv2DDerInput");for(var r=aa(n.inShape,"float32"),i=r.values,o=r.strides,a=o[0],s=o[1],u=o[2],c=t.dataSync(),l=t.strides,f=l[0],h=l[1],p=l[2],d=e.dataSync(),m=e.strides,g=m[0],y=m[1],v=m[2],b=n.batchSize,w=n.filterHeight,_=n.filterWidth,x=n.inChannels,E=n.inHeight,S=n.inWidth,N=n.outChannels,I=n.outHeight,O=n.outWidth,k=n.strideHeight,A=n.strideWidth,C=w-1-n.padInfo.top,P=_-1-n.padInfo.left,T=N/x,M=0;M<b;++M)for(var R=0;R<x;++R)for(var D=0;D<E;++D)for(var j=D-C,B=Math.max(0,Math.ceil(j/k)),L=Math.min(I,(w+j)/k),F=0;F<S;++F){for(var z=F-P,U=Math.max(0,Math.ceil(z/A)),V=Math.min(O,(_+z)/A),W=0,q=B;q<L;++q)for(var H=q*k-j,$=U;$<V;++$)for(var G=f*M+h*q+p*$,K=g*(w-1-H)+y*(_-1-($*A-z))+v*R,X=0;X<T;++X)W+=c[G+(R*T+X)]*d[K+X];i[a*M+s*D+u*F+R]=W}return r.toTensor()},cl.prototype.depthwiseConv2DDerFilter=function(t,e,n){this.assertNotComplex([t,e],"depthwiseConv2DDerFilter");for(var r=n.strideHeight,i=n.strideWidth,o=n.filterHeight,a=n.filterWidth,s=aa(n.filterShape,"float32"),u=n.padInfo.left,c=n.padInfo.top,l=n.outChannels/n.inChannels,f=t.bufferSync(),h=e.bufferSync(),p=0;p<o;++p)for(var d=Math.max(0,Math.ceil((c-p)/r)),m=Math.min(n.outHeight,(n.inHeight+c-p)/r),g=0;g<a;++g)for(var y=Math.max(0,Math.ceil((u-g)/i)),v=Math.min(n.outWidth,(n.inWidth+u-g)/i),b=0;b<n.outChannels;++b){for(var w=Math.trunc(b/l),_=b%l,x=0,E=0;E<n.batchSize;++E)for(var S=d;S<m;++S)for(var N=p+S*r-c,I=y;I<v;++I){var O=g+I*i-u;x+=f.get(E,N,O,w)*h.get(E,S,I,b)}s.set(x,p,g,w,_)}return s.toTensor()},cl.prototype.tile=function(t,e){this.assertNotComplex(t,"tile");for(var n=new Array(t.rank),r=0;r<n.length;r++)n[r]=t.shape[r]*e[r];var i=aa(n,t.dtype),o=t.bufferSync();for(r=0;r<i.values.length;++r){for(var a=i.indexToLoc(r),s=new Array(t.rank),u=0;u<s.length;u++)s[u]=a[u]%t.shape[u];var c=o.locToIndex(s);i.values[r]=o.values[c]}return i.toTensor()},cl.prototype.pad=function(n,t,e){this.assertNotComplex(n,"pad");var r=t.map(function(t,e){return t[0]+n.shape[e]+t[1]}),i=t.map(function(t){return t[0]}),o=n.bufferSync(),a=aa(r,n.dtype);0!==e&&a.values.fill(e);for(var s=0;s<n.size;s++){var u=o.indexToLoc(s),c=u.map(function(t,e){return t+i[e]});a.set.apply(a,[o.get.apply(o,u)].concat(c))}return a.toTensor()},cl.prototype.transpose=function(t,e){this.assertNotComplex(t,"transpose");for(var n=new Array(t.rank),r=0;r<n.length;r++)n[r]=t.shape[e[r]];var i=t.dataSync(),o=aa(n,t.dtype),a=t.bufferSync();for(r=0;r<t.size;++r){for(var s=a.indexToLoc(r),u=new Array(s.length),c=0;c<u.length;c++)u[c]=s[e[c]];var l=o.locToIndex(u);o.values[l]=i[r]}return o.toTensor()},cl.prototype.gather=function(t,e,n){this.assertNotComplex([t,e],"gather");var r=t.shape.slice(),i=e.dataSync();r[n]=i.length;for(var o=aa(r,t.dtype),a=t.bufferSync(),s=0;s<o.size;++s){var u=o.indexToLoc(s),c=u.slice();c[n]=i[u[n]];var l=a.locToIndex(c);o.values[s]=a.values[l]}return o.toTensor()},cl.prototype.batchToSpaceND=function(t,e,n){this.assertNotComplex([t],"batchToSpaceND");var r=e.reduce(function(t,e){return t*e}),i=me(t.shape,e,r),o=ge(i.length,e.length),a=ye(t.shape,e,r),s=ve(n,e.length),u=be(a,n,e.length);return t.reshape(i).transpose(o).reshape(a).slice(s,u)},cl.prototype.spaceToBatchND=function(t,e,n){this.assertNotComplex([t],"spaceToBatchND");var r=e.reduce(function(t,e){return t*e}),i=[[0,0]];i.push.apply(i,n);for(var o=1+e.length;o<t.shape.length;++o)i.push([0,0]);var a=t.pad(i),s=me(a.shape,e,r,!1),u=ge(s.length,e.length,!1),c=ye(a.shape,e,r,!1);return a.reshape(s).transpose(u).reshape(c)},cl.prototype.pool=function(t,e,n){this.assertNotComplex(t,"pool");for(var r=e.strideHeight,i=e.strideWidth,o=e.dilationHeight,a=e.dilationWidth,s=e.effectiveFilterHeight,u=e.effectiveFilterWidth,c=e.padInfo.top,l=e.padInfo.left,f="max"===n?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,h=t.dataSync(),p=aa(e.outShape,t.dtype),d=p.values,m=e.outShape[1]*e.outShape[2]*e.outShape[3],g=e.outShape[2]*e.outShape[3],y=e.outShape[3],v=0;v<e.batchSize;++v)for(var b=v*m,w=v*t.strides[0],_=0;_<e.inChannels;++_)for(var x=0;x<e.outHeight;++x)for(var E=x*r-c,S=Math.max(0,E),N=Math.min(e.inHeight,s+E),I=b+x*g,O=0;O<e.outWidth;++O){for(var k=O*i-l,A=Math.max(0,k),C=Math.min(e.inWidth,u+k),P=f,T=0,M=0,R=S;R<N;R+=o){for(var D=w+R*t.strides[1],j=A;j<C;j+=a){var B=h[D+j*t.strides[2]+_];"max"===n&&P<B?P=B:"avg"===n&&(T+=B,M++)}if(isNaN(P))break}d[I+O*y+_]="avg"===n?T/M:P}return p.toTensor()},cl.prototype.maxPool=function(t,e){return this.pool(t,e,"max")},cl.prototype.maxPoolPositions=function(t,e){for(var n=aa(e.outShape,"int32"),r=e.strideHeight,i=e.strideWidth,o=e.dilationHeight,a=e.dilationWidth,s=e.effectiveFilterHeight,u=e.effectiveFilterWidth,c=e.padInfo.top,l=e.padInfo.left,f=t.bufferSync(),h=0;h<e.batchSize;++h)for(var p=0;p<e.inChannels;++p)for(var d=0;d<e.outHeight;++d){for(var m=d*r-c,g=m;g<0;)g+=o;for(var y=Math.min(e.inHeight,s+m),v=0;v<e.outWidth;++v){for(var b=v*i-l,w=b;w<0;)w+=a;for(var _=Math.min(e.inWidth,u+b),x=Number.NEGATIVE_INFINITY,E=-1,S=g;S<y;S+=o)for(var N=S-m,I=w;I<_;I+=a){var O=I-b,k=f.get(h,S,I,p);x<k&&(x=k,E=N*u+O)}n.set(E,h,d,v,p)}}return n.toTensor()},cl.prototype.maxPoolBackprop=function(t,e,n,r){this.assertNotComplex([e,n],"maxPoolBackprop");for(var i=this.maxPoolPositions(e,r),o=r.strideHeight,a=r.strideWidth,s=r.dilationHeight,u=r.dilationWidth,c=r.effectiveFilterHeight,l=r.effectiveFilterWidth,f=l-1-r.padInfo.left,h=c-1-r.padInfo.top,p=aa(e.shape,"float32"),d=i.bufferSync(),m=t.bufferSync(),g=0;g<r.batchSize;++g)for(var y=0;y<r.inChannels;++y)for(var v=0;v<r.inHeight;++v)for(var b=0;b<r.inWidth;++b){for(var w=v-h,_=b-f,x=0,E=0;E<c;E+=s){var S=(w+E)/o;if(!(S<0||S>=r.outHeight||Math.floor(S)!==S))for(var N=0;N<l;N+=u){var I=(_+N)/a;if(!(I<0||I>=r.outWidth||Math.floor(I)!==I)){var O=c*l-1-d.get(g,S,I,y)===E*l+N?1:0;0!=O&&(x+=m.get(g,S,I,y)*O)}}}p.set(x,g,v,b,y)}return p.toTensor()},cl.prototype.avgPoolBackprop=function(t,e,n){this.assertNotComplex([t,e],"avgPoolBackprop");for(var r=n.strideHeight,i=n.strideWidth,o=n.filterHeight,a=n.filterWidth,s=n.dilationHeight,u=n.dilationWidth,c=n.effectiveFilterHeight,l=n.effectiveFilterWidth,f=l-1-n.padInfo.left,h=c-1-n.padInfo.top,p=aa(e.shape,"float32"),d=1/(o*a),m=t.bufferSync(),g=0;g<n.batchSize;++g)for(var y=0;y<n.inChannels;++y)for(var v=0;v<n.inHeight;++v)for(var b=0;b<n.inWidth;++b){for(var w=v-h,_=b-f,x=0,E=0;E<c;E+=s){var S=(w+E)/r;if(!(S<0||S>=n.outHeight||Math.floor(S)!==S))for(var N=0;N<l;N+=u){var I=(_+N)/i;I<0||I>=n.outWidth||Math.floor(I)!==I||(x+=m.get(g,S,I,y))}}p.set(x*d,g,v,b,y)}return p.toTensor()},cl.prototype.cast=function(t,e){return pn(t,e,this)},cl.prototype.reshape=function(t,e){return dn(t,e)},cl.prototype.avgPool=function(t,e){return this.assertNotComplex(t,"avgPool"),this.pool(t,e,"avg").toFloat()},cl.prototype.resizeBilinear=function(t,e,n,r){this.assertNotComplex(t,"resizeBilinear");for(var i=t.shape,o=i[0],a=i[1],s=i[2],u=i[3],c=t.dataSync(),l=new Float32Array(L([o,e,n,u])),f=[r&&1<e?a-1:a,r&&1<n?s-1:s],h=[r&&1<e?e-1:e,r&&1<n?n-1:n],p=0,d=f[0]/h[0],m=f[1]/h[1],g=0;g<o;g++)for(var y=0;y<e;y++)for(var v=d*y,b=Math.floor(v),w=v-b,_=Math.min(a-1,Math.ceil(v)),x=g*t.strides[0]+b*t.strides[1],E=g*t.strides[0]+_*t.strides[1],S=0;S<n;S++)for(var N=m*S,I=Math.floor(N),O=N-I,k=Math.min(s-1,Math.ceil(N)),A=x+I*t.strides[2],C=E+I*t.strides[2],P=x+ +k*t.strides[2],T=E+k*t.strides[2],M=0;M<u;M++){var R=c[A+M],D=c[C+M],j=R+(c[P+M]-R)*O,B=j+(D+(c[T+M]-D)*O-j)*w;l[p++]=B}return Ge(l,[o,e,n,u])},cl.prototype.resizeBilinearBackprop=function(t,e,n){this.assertNotComplex([t,e],"resizeBilinearBackprop");for(var r=e.shape,i=r[0],o=r[1],a=r[2],s=r[3],u=t.shape,c=u[1],l=u[2],f=new Float32Array(i*o*a*s),h=[n&&1<c?o-1:o,n&&1<l?a-1:a],p=[n&&1<c?c-1:c,n&&1<l?l-1:l],d=h[0]/p[0],m=h[1]/p[1],g=t.dataSync(),y=0,v=0;v<i;v++)for(var b=v*e.strides[0],w=0;w<c;w++)for(var _=w*d,x=Math.floor(_),E=Math.min(Math.ceil(_),o-1),S=b+x*e.strides[1],N=b+E*e.strides[1],I=_-x,O=1-I,k=0;k<l;k++)for(var A=k*m,C=Math.floor(A),P=Math.min(Math.ceil(A),a-1),T=A-C,M=1-T,R=S+C*e.strides[2],D=S+P*e.strides[2],j=N+C*e.strides[2],B=N+P*e.strides[2],L=O*M,F=O*T,z=I*M,U=I*T,V=0;V<s;V++){var W=g[y++];f[R+V]+=W*L,f[D+V]+=W*F,f[j+V]+=W*z,f[B+V]+=W*U}return Je(f,[i,a,o,s],e.dtype)},cl.prototype.resizeNearestNeighbor=function(t,e,n,r){this.assertNotComplex(t,"resizeNearestNeighbor");for(var i=t.shape,o=i[0],a=i[1],s=i[2],u=i[3],c=t.dataSync(),l=new Float32Array(o*e*n*u),f=[r&&1<e?a-1:a,r&&1<n?s-1:s],h=[r&&1<e?e-1:e,r&&1<n?n-1:n],p=f[0]/h[0],d=f[1]/h[1],m=0,g=0;g<o;g++)for(var y=g*t.strides[0],v=0;v<e;v++)for(var b=p*v,w=y+Math.min(a-1,r?Math.round(b):Math.floor(b))*t.strides[1],_=0;_<n;_++)for(var x=d*_,E=w+Math.min(s-1,r?Math.round(x):Math.floor(x))*t.strides[2],S=0;S<u;S++){var N=c[E+S];l[m++]=N}return Ge(l,[o,e,n,u],t.dtype)},cl.prototype.resizeNearestNeighborBackprop=function(t,e,n){this.assertNotComplex([t,e],"resizeNearestNeighborBackprop");for(var r=e.shape,i=r[0],o=r[1],a=r[2],s=r[3],u=t.shape,c=u[1],l=u[2],f=new Float32Array(i*o*a*s),h=t.dataSync(),p=[n&&1<c?o-1:o,n&&1<l?a-1:a],d=[n&&1<c?c-1:c,n&&1<l?l-1:l],m=p[0]/d[0],g=p[1]/d[1],y=1/m,v=1/g,b=2*Math.ceil(y)+2,w=2*Math.ceil(v)+2,_=0;_<i;_++)for(var x=_*e.strides[0],E=0;E<o;E++)for(var S=x+E*e.strides[1],N=Math.floor(E*y),I=Math.floor(N-b/2),O=0;O<a;O++)for(var k=S+O*e.strides[2],A=Math.floor(O*v),C=Math.floor(A-w/2),P=0;P<s;P++){for(var T=0,M=0;M<b;M++){var R=M+I;if(!(R<0||c<=R)){var D=x+R*t.strides[1],j=R*m;if(E===Math.min(o-1,n?Math.round(j):Math.floor(j)))for(var B=0;B<w;B++){var L=B+C;if(!(L<0||l<=L)){var F=D+L*t.strides[2],z=L*g;O===Math.min(a-1,n?Math.round(z):Math.floor(z))&&(T+=h[F+P])}}}}f[k+P]=T}return Je(f,e.shape,e.dtype)},cl.prototype.batchNormalization=function(t,e,n,r,i,o){this.assertNotComplex([t,e,n,i,o],"batchNorm");for(var a=t.dataSync(),s=e.dataSync(),u=n.dataSync(),c=i?i.dataSync():new Float32Array([1]),l=o?o.dataSync():new Float32Array([0]),f=new Float32Array(a.length),h=l.length,p=c.length,d=u.length,m=s.length,g=0,y=0,v=0,b=0,w=0;w<a.length;++w)f[w]=l[g++]+(a[w]-s[y++])*c[v++]/Math.sqrt(u[b++]+r),h<=g&&(g=0),m<=y&&(y=0),p<=v&&(v=0),d<=b&&(b=0);return Je(f,t.shape)},cl.prototype.localResponseNormalization4D=function(t,a,e,n,r){this.assertNotComplex(t,"localResponseNormalization4D");var s=t.shape[3],u=s-1,c=t.dataSync(),i=L(t.shape),o=new Float32Array(i);function l(t){for(var e=t%s,n=t-e+Math.max(0,e-a),r=t-e+Math.min(e+a,u),i=0;n<=r;n++){var o=c[n];i+=o*o}return i}for(var f=0;f<i;f++){var h=l(f),p=c[f]*Math.pow(e+n*h,-r);o[f]=p}return Je(o,t.shape)},cl.prototype.LRNGrad=function(t,e,n,r,i,o,a){this.assertNotComplex(t,"LRNGrad");for(var s=t.shape[3],u=t.dataSync(),c=e.dataSync(),l=n.dataSync(),f=new Float32Array(L(t.shape)),h=L(t.shape),p=0;p<h;p++){for(var d=p%s,m=p-d+Math.max(0,d-r),g=p-d+Math.min(s,d+r+1),y=0,v=m;v<g;v++)y+=Math.pow(c[v],2);for(y=o*y+i,v=m;v<g;v++){var b=-2*o*a*c[v]*l[p]/y;p===v&&(b+=Math.pow(y,-a)),b*=u[p],f[v]+=b}}return Je(f,t.shape)},cl.prototype.multinomial=function(t,e,n,r){this.assertNotComplex(t,"multinomial");for(var i=e?t:Ve(t),o=i.shape[0],a=i.shape[1],s=nn([o,n],"int32"),u=s.dataSync(),c=i.dataSync(),l=0;l<o;++l){var f=l*a,h=new Float32Array(a-1);h[0]=c[f];for(var p=1;p<h.length;++p)h[p]=h[p-1]+c[f+p];for(var d=na(r.toString()),m=l*n,g=0;g<n;++g){var y=d();u[m+g]=h.length;for(var v=0;v<h.length;v++)if(y<h[v]){u[m+g]=v;break}}}return s},cl.prototype.oneHot=function(t,e,n,r){this.assertNotComplex(t,"oneHot");var i=new Float32Array(t.size*e);i.fill(r);for(var o=t.dataSync(),a=0;a<t.size;++a)0<=o[a]&&o[a]<e&&(i[a*e+o[a]]=n);return Ye(i,[t.size,e],"int32")},cl.prototype.nonMaxSuppression=function(t,e,n,r,i){return this.assertNotComplex(t,"nonMaxSuppression"),yn(t.dataSync(),e.dataSync(),n,r,i)},cl.prototype.fft=function(t){return this.fftBatch(t,!1)},cl.prototype.ifft=function(t){return this.fftBatch(t,!0)},cl.prototype.fftBatch=function(t,e){for(var n=t.shape[0],r=t.shape[1],i=aa(t.shape,"float32"),o=aa(t.shape,"float32"),a=He(t).as2D(n,r),s=$e(t).as2D(n,r),u=0;u<n;u++)for(var c=a.slice([u,0],[1,r]),l=s.slice([u,0],[1,r]),f=qe(c,l),h=this.fftImpl(f,e).dataSync(),p=0;p<r;p++){var d=gn(h,p);i.values[u*r+p]=d.real,o.values[u*r+p]=d.imag}return qe(i.toTensor(),o.toTensor()).as2D(n,r)},cl.prototype.fftImpl=function(t,e){var n=t.as1D(),r=n.size;if(this.isExponentOf2(r)){var i=this.fftRadix2(n,r,e).as2D(t.shape[0],t.shape[1]);return e&&(i=qe(He(i).div(Ke(r)),$e(i).div(Ke(r)))),i}var o=t.dataSync(),a=function(t){for(var e=new Float32Array(t.length/2),n=new Float32Array(t.length/2),r=0;r<t.length;r+=2)e[r/2]=t[r],n[r/2]=t[r+1];return{real:e,imag:n}}(this.fourierTransformByMatmul(o,r,e));return qe(a.real,a.imag).as2D(t.shape[0],t.shape[1])},cl.prototype.isExponentOf2=function(t){return 0==(t&t-1)},cl.prototype.fftRadix2=function(t,e,n){if(1===e)return t;var r=t.dataSync(),i=e/2,o=function(t){for(var e=Math.ceil(t.length/4),n=new Float32Array(e),r=new Float32Array(e),i=0;i<t.length;i+=4)n[Math.floor(i/4)]=t[i],r[Math.floor(i/4)]=t[i+1];return{real:n,imag:r}}(r),a=qe(o.real,o.imag).as1D(),s=function(t){for(var e=Math.floor(t.length/4),n=new Float32Array(e),r=new Float32Array(e),i=2;i<t.length;i+=4)n[Math.floor(i/4)]=t[i],r[Math.floor(i/4)]=t[i+1];return{real:n,imag:r}}(r),u=qe(s.real,s.imag).as1D();a=this.fftRadix2(a,i,n),u=this.fftRadix2(u,i,n);var c=function(t,e){for(var n=new Float32Array(t/2),r=new Float32Array(t/2),i=0;i<Math.ceil(t/2);i++){var o=(e?2:-2)*Math.PI*(i/t);n[i]=Math.cos(o),r[i]=Math.sin(o)}return{real:n,imag:r}}(e,n),l=qe(c.real,c.imag).mul(u),f=a.add(l),h=a.sub(l),p=He(f).concat(He(h)),d=$e(f).concat($e(h));return qe(p,d).as1D()},cl.prototype.fourierTransformByMatmul=function(t,e,n){for(var r=new Float32Array(2*e),i=0;i<e;i++){for(var o=0,a=0,s=0;s<e;s++){var u=(d=i*s,m=e,g=(n?2:-2)*Math.PI*(d/m),{real:Math.cos(g),imag:Math.sin(g)}),c=gn(t,s);o+=c.real*u.real-c.imag*u.imag,a+=c.real*u.imag+c.imag*u.real}n&&(o/=e,a/=e),f=o,h=a,(l=r)[2*(p=i)]=f,l[2*p+1]=h}var l,f,h,p,d,m,g;return r},cl.prototype.depthToSpace=function(t,e,n){C("NHWC"===n,"Only NHWC dataFormat supported on CPU for depthToSpace. Got "+n),C(1<e,"blockSize should be > 1 for depthToSpace, but was: "+e);for(var r=t.shape[0],i=t.shape[1],o=t.shape[2],a=t.shape[3],s=i*e,u=o*e,c=a/(e*e),l=t.dataSync(),f=new Float32Array(r*s*u*c),h=0,p=0;p<r;++p)for(var d=0;d<s;++d)for(var m=Math.floor(d/e),g=d%e,y=0;y<u;++y)for(var v=Math.floor(y/e),b=(g*e+y%e)*c,w=0;w<c;++w){var _=w+b+a*(v+o*(m+i*p));f[h++]=l[_]}return Je(f,[r,s,u,c])},cl.prototype.broadcastedBinaryOp=function(a,s,t,u){var e=Nn(a.shape,s.shape),c=aa(e,t),l=a.dataSync(),f=s.dataSync(),h=En(a.shape,e),p=En(s.shape,e),d=c.values;if(h.length+p.length===0)for(var n=0;n<d.length;++n)d[n]=u(l[n%l.length],f[n%f.length]);else{var m=a.bufferSync(),g=s.bufferSync(),r=function(t){var e=c.indexToLoc(t),n=e.slice(-a.rank);h.forEach(function(t){return n[t]=0});var r=m.locToIndex(n),i=e.slice(-s.rank);p.forEach(function(t){return i[t]=0});var o=g.locToIndex(i);d[t]=u(l[r],f[o])};for(n=0;n<d.length;++n)r(n)}return c.toTensor()},cl.prototype.broadcastedBinaryComplexOp=function(s,u,c){var t=Nn(s.shape,u.shape),l=aa(t,"float32"),e=aa(t,"float32"),f=s.dataSync(),h=u.dataSync(),p=En(s.shape,t),d=En(u.shape,t),m=l.values,g=e.values;if(p.length+d.length===0)for(var n=0;n<m.length;n++){var r=n%f.length,i=n%h.length,o=c(f[2*r],f[2*r+1],h[2*i],h[2*i+1]);m[n]=o.real,g[n]=o.imag}else{var y=this.data.get(s.dataId).complexTensors.real.bufferSync(),v=this.data.get(u.dataId).complexTensors.real.bufferSync(),a=function(t){var e=l.indexToLoc(t),n=e.slice(-s.rank);p.forEach(function(t){return n[t]=0});var r=y.locToIndex(n),i=e.slice(-u.rank);d.forEach(function(t){return i[t]=0});var o=v.locToIndex(i),a=c(f[2*r],f[2*r+1],h[2*o],h[2*o+1]);m[t]=a.real,g[t]=a.imag};for(n=0;n<m.length;n++)a(n)}return this.complex(l.toTensor(),e.toTensor())},cl.prototype.split=function(t,e,n){return bn(t,e,n)},cl.prototype.dispose=function(){},cl.prototype.floatPrecision=function(){return 32},cl.prototype.cropAndResize=function(t,e,n,r,i,o){for(var a=t.shape,s=a[0],u=a[1],c=a[2],l=a[3],f=e.shape[0],h=r[0],p=r[1],d=aa([f,h,p,l],t.dtype),m=e.dataSync(),g=n.dataSync(),y=t.dataSync(),v=t.strides,b=d.strides,w=0;w<f;w++){var _=4*w,x=m[_],E=m[1+_],S=m[2+_],N=m[3+_],I=g[w];if(!(s<=I))for(var O=1<h?(S-x)*(u-1)/(h-1):0,k=1<p?(N-E)*(c-1)/(p-1):0,A=0;A<h;A++){var C=1<h?x*(u-1)+A*O:.5*(x+S)*(u-1);if(C<0||u-1<C)for(var P=0;P<p;P++)for(var T=0;T<l;T++){var M=T+P*b[2]+A*b[1]+w*b[0];d.values[M]=o}else if("bilinear"===i){var R=Math.floor(C),D=Math.ceil(C),j=C-R;for(P=0;P<p;P++)if((H=1<p?E*(c-1)+P*k:.5*(E+N)*(c-1))<0||c-1<H)for(T=0;T<l;T++)M=T+P*b[2]+A*b[1]+w*b[0],d.values[M]=o;else{var B=Math.floor(H),L=Math.ceil(H),F=H-B;for(T=0;T<l;T++){var z=y[M=T+B*v[2]+R*v[1]+I*v[0]],U=y[M=T+L*v[2]+R*v[1]+I*v[0]],V=y[M=T+B*v[2]+D*v[1]+I*v[0]],W=z+(U-z)*F,q=V+(y[M=T+L*v[2]+D*v[1]+I*v[0]]-V)*F;M=T+P*b[2]+A*b[1]+w*b[0],d.values[M]=W+(q-W)*j}}}else for(P=0;P<p;++P){var H;if((H=1<p?E*(c-1)+P*k:.5*(E+N)*(c-1))<0||c-1<H)for(T=0;T<l;T++)M=T+P*b[2]+A*b[1]+w*b[0],d.values[M]=o;else{var $=Math.round(H),G=Math.round(C);for(T=0;T<l;T++){var K=T+$*v[2]+G*v[1]+I*v[0],X=T+P*b[2]+A*b[1]+w*b[0];d.values[X]=y[K]}}}}}return d.toTensor()},cl.prototype.sparseToDense=function(t,e,n,r){var i=Pe(0,t,n),o=i.sliceRank,a=i.numUpdates,s=i.sliceSize,u=i.strides,c=i.outputSize;return this.scatter(t,e,n,c,s,a,o,u,r,!1)},cl.prototype.gatherND=function(t,e){var n=e.shape,r=n[n.length-1],i=ke(t,e),o=i[0],a=i[1],s=i[2],u=i[3];if(0===a)return Ge([],o,t.dtype);for(var c=new ct([a,s],t.dtype),l=e.dataSync(),f=t.dataSync(),h=0;h<a;h++){for(var p=[],d=0,m=0;m<r;m++){var g=l[h*r+m];d+=g*u[m],p.push(g)}if(d<0||d>=t.size/s)throw new Error("Invalid indices: "+p+" does not index into "+t.shape);for(var y=0;y<s;y++)c.values[h*s+y]=f[d*s+y]}return c.toTensor().reshape(o)},cl.prototype.scatterND=function(t,e,n){var r=Pe(0,t,n),i=r.sliceRank,o=r.numUpdates,a=r.sliceSize,s=r.strides,u=r.outputSize,c=Ke(0);return this.scatter(t,e,n,u,a,o,i,s,c,!0)},cl.prototype.scatter=function(t,e,n,r,i,o,a,s,u,c){var l=[r/i,i],f=t.dataSync(),h=e.dataSync();if(0===r)return Ge([],n,e.dtype);var p=new ct(l,e.dtype);p.values.fill(u.dataSync()[0]);for(var d=0;d<o;d++){for(var m=[],g=0,y=0;y<a;y++){var v=f[d*a+y];m.push(v),g+=v*s[y]}if(g<0||r/i<=g)throw new Error("Invalid indices: "+m+" does not index into "+n);for(var b=0;b<i;b++)c?p.values[g*i+b]+=h[d*i+b]:p.values[g*i+b]=0===e.rank?h[0]:h[d*i+b]}return p.toTensor().reshape(n)},cl);function cl(){this.blockSize=48,this.firstUse=!0,te.get("IS_BROWSER")&&(this.fromPixels2DContext=document.createElement("canvas").getContext("2d"))}te.registerBackend("cpu",function(){return new ul},1,dt);var ll="undefined"!=typeof requestAnimationFrame?requestAnimationFrame:e;function fl(){return new Promise(function(t){return ll(function(){return t()})})}var hl={float32:4,int32:4,uint16:2,uint8:1,bool:1};function pl(h,t){for(var p={},d=0,e=function(t){var e=t.name,n=t.dtype,r=t.shape,i=L(r),o=void 0;if("quantization"in t){var a=t.quantization;if("uint8"!==a.dtype&&"uint16"!==a.dtype)throw new Error("Weight "+t.name+" has unknown quantization dtype "+a.dtype+". Supported quantization dtypes are: 'uint8' and 'uint16'.");var s=hl[a.dtype],u=h.slice(d,d+i*s),c="uint8"===a.dtype?new Uint8Array(u):new Uint16Array(u);if("float32"===n)o=Float32Array.from(c,function(t){return t*a.scale+a.min});else{if("int32"!==n)throw new Error("Unsupported dtype in weight '"+e+"': "+n);o=Int32Array.from(c,function(t){return Math.round(t*a.scale+a.min)})}d+=i*s}else{var l=hl[n];if(u=h.slice(d,d+i*l),"float32"===n)o=new Float32Array(u);else if("int32"===n)o=new Int32Array(u);else{if("bool"!==n)throw new Error("Unsupported dtype in weight '"+e+"': "+n);o=new Uint8Array(u)}d+=i*l}var f=void 0;if("float32"===n)f=Ge(o,r,"float32");else if("int32"===n)f=Ge(o,r,"int32");else{if("bool"!==n)throw new Error("Unsupported dtype in weight '"+e+"': "+n);f=Ge(o,r,"bool")}p[e]=f},n=0,r=t;n<r.length;n++)e(r[n]);return p}var dl=void 0!==a&&("undefined"==typeof Blob||"undefined"==typeof atob||"undefined"==typeof btoa);function ml(t){return dl?a.byteLength(t):new Blob([t]).size}function gl(t){var e=0;t.forEach(function(t){e+=t.byteLength});var n=new Uint8Array(e),r=0;return t.forEach(function(t){n.set(new Uint8Array(t),r),r+=t.byteLength}),n.buffer}function yl(t){for(t=t.trim();t.endsWith("/");)t=t.slice(0,t.length-1);var e=t.split("/");return e[e.length-1]}function vl(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:null==t.modelTopology?0:ml(JSON.stringify(t.modelTopology)),weightSpecsBytes:null==t.weightSpecs?0:ml(JSON.stringify(t.weightSpecs)),weightDataBytes:null==t.weightData?0:t.weightData.byteLength}}var bl=(El.getInstance=function(){return null==El.instance&&(El.instance=new El),El.instance},El.registerSaveRouter=function(t){El.getInstance().saveRouters.push(t)},El.registerLoadRouter=function(t){El.getInstance().loadRouters.push(t)},El.getSaveHandlers=function(t){return El.getHandlers(t,"save")},El.getLoadHandlers=function(t,e){return El.getHandlers(t,"load",e)},El.getHandlers=function(n,t,r){var i=[];return("load"===t?this.getInstance().loadRouters:this.getInstance().saveRouters).forEach(function(t){var e=t(n,r);null!==e&&i.push(e)}),i},El),wl="://",_l=(xl.getInstance=function(){return null==xl.instance&&(xl.instance=new xl),xl.instance},xl.registerManager=function(t,e){C(null!=t,"scheme must not be undefined or null."),t.endsWith(wl)&&(t=t.slice(0,t.indexOf(wl))),C(0<t.length,"scheme must not be an empty string.");var n=xl.getInstance();C(null==n.managers[t],"A model store manager is already registered for scheme '"+t+"'."),n.managers[t]=e},xl.getManager=function(t){var e=this.getInstance().managers[t];if(null==e)throw new Error("Cannot find model manager for scheme '"+t+"'");return e},xl.getSchemes=function(){return Object.keys(this.getInstance().managers)},xl);function xl(){this.managers={}}function El(){this.saveRouters=[],this.loadRouters=[]}function Sl(t){if(-1===t.indexOf(wl))throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+_l.getSchemes().join(","));return{scheme:t.split(wl)[0],path:t.split(wl)[1]}}function Nl(l,f,h){return void 0===h&&(h=!1),m(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c;return I(this,function(t){switch(t.label){case 0:return C(l!==f,"Old path and new path are the same: '"+l+"'"),C(0<(e=bl.getLoadHandlers(l)).length,"Copying failed because no load handler is found for source URL "+l+"."),C(e.length<2,"Copying failed because more than one ("+e.length+") load handlers for source URL "+l+"."),n=e[0],C(0<(r=bl.getSaveHandlers(f)).length,"Copying failed because no save handler is found for destination URL "+f+"."),C(r.length<2,"Copying failed because more than one ("+e.length+") save handlers for destination URL "+f+"."),i=r[0],o=Sl(l).scheme,a=Sl(l).path,s=o===Sl(l).scheme,[4,n.load()];case 1:return u=t.sent(),h&&s?[4,_l.getManager(o).removeModel(a)]:[3,3];case 2:t.sent(),t.label=3;case 3:return[4,i.save(u)];case 4:return c=t.sent(),!h||s?[3,6]:[4,_l.getManager(o).removeModel(a)];case 5:t.sent(),t.label=6;case 6:return[2,c.modelArtifactsInfo]}})})}var Il="tensorflowjs",Ol="models_store",kl="model_info_store";function Al(){if(!te.get("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");var t=window,e=t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB||t.shimIndexedDB;if(null==e)throw new Error("The current browser does not appear to support IndexedDB.");return e}function Cl(t){var e=t.result;e.createObjectStore(Ol,{keyPath:"modelPath"}),e.createObjectStore(kl,{keyPath:"modelPath"})}function Pl(t){return te.get("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(Tl.URL_SCHEME)?function(t){return new Tl(t)}(t.slice(Tl.URL_SCHEME.length)):null}var Tl=(Ml.prototype.save=function(e){return m(this,void 0,void 0,function(){return I(this,function(t){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return[2,this.databaseAction(this.modelPath,e)]})})},Ml.prototype.load=function(){return m(this,void 0,void 0,function(){return I(this,function(t){return[2,this.databaseAction(this.modelPath)]})})},Ml.prototype.databaseAction=function(t,f){var h=this;return new Promise(function(u,c){var l=h.indexedDB.open(Il,1);l.onupgradeneeded=function(){return Cl(l)},l.onsuccess=function(){var r=l.result;if(null==f){var t=r.transaction(Ol,"readonly"),e=t.objectStore(Ol).get(h.modelPath);e.onsuccess=function(){if(null==e.result)return r.close(),c(new Error("Cannot find model with path '"+h.modelPath+"' in IndexedDB."));u(e.result.modelArtifacts)},e.onerror=function(t){return r.close(),c(e.error)},t.oncomplete=function(){return r.close()}}else{var i,o=vl(f),a=r.transaction(kl,"readwrite"),s=a.objectStore(kl),n=s.put({modelPath:h.modelPath,modelArtifactsInfo:o});n.onsuccess=function(){var n=(i=r.transaction(Ol,"readwrite")).objectStore(Ol).put({modelPath:h.modelPath,modelArtifacts:f,modelArtifactsInfo:o});n.onsuccess=function(){return u({modelArtifactsInfo:o})},n.onerror=function(t){var e=(s=a.objectStore(kl)).delete(h.modelPath);e.onsuccess=function(){return r.close(),c(n.error)},e.onerror=function(t){return r.close(),c(n.error)}}},n.onerror=function(t){return r.close(),c(n.error)},a.oncomplete=function(){null==i?r.close():i.oncomplete=function(){return r.close()}}}},l.onerror=function(t){return c(l.error)}})},Ml.URL_SCHEME="indexeddb://",Ml);function Ml(t){if(this.indexedDB=Al(),null==t||!t)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=t}bl.registerSaveRouter(Pl),bl.registerLoadRouter(Pl);var Rl=(Dl.prototype.listModels=function(){return m(this,void 0,void 0,function(){var e=this;return I(this,function(t){return[2,new Promise(function(o,n){var r=e.indexedDB.open(Il,1);r.onupgradeneeded=function(){return Cl(r)},r.onsuccess=function(){var e=r.result,t=e.transaction(kl,"readonly"),i=t.objectStore(kl).getAll();i.onsuccess=function(){for(var t={},e=0,n=i.result;e<n.length;e++){var r=n[e];t[r.modelPath]=r.modelArtifactsInfo}o(t)},i.onerror=function(t){return e.close(),n(i.error)},t.oncomplete=function(){return e.close()}},r.onerror=function(t){return n(r.error)}})]})})},Dl.prototype.removeModel=function(u){return m(this,void 0,void 0,function(){var n=this;return I(this,function(t){return u=function(t){return t.startsWith(Tl.URL_SCHEME)?t.slice(Tl.URL_SCHEME.length):t}(u),[2,new Promise(function(a,s){var e=n.indexedDB.open(Il,1);e.onupgradeneeded=function(){return Cl(e)},e.onsuccess=function(){var n,r=e.result,t=r.transaction(kl,"readwrite"),i=t.objectStore(kl),o=i.get(u);o.onsuccess=function(){if(null==o.result)return r.close(),s(new Error("Cannot find model with path '"+u+"' in IndexedDB."));function e(){var t=(n=r.transaction(Ol,"readwrite")).objectStore(Ol).delete(u);t.onsuccess=function(){return a(o.result.modelArtifactsInfo)},t.onerror=function(t){return s(o.error)}}var t=i.delete(u);t.onsuccess=e,t.onerror=function(t){return e(),r.close(),s(o.error)}},o.onerror=function(t){return r.close(),s(o.error)},t.oncomplete=function(){null==n?r.close():n.oncomplete=function(){return r.close()}}},e.onerror=function(t){return s(e.error)}})]})})},Dl);function Dl(){this.indexedDB=Al()}if(te.get("IS_BROWSER"))try{_l.registerManager(Tl.URL_SCHEME,new Rl)}catch(t){}var jl="/",Bl="tensorflowjs_models",Ll="info",Fl="model_topology",zl="weight_specs",Ul="weight_data";function Vl(t){return{info:[Bl,t,Ll].join(jl),topology:[Bl,t,Fl].join(jl),weightSpecs:[Bl,t,zl].join(jl),weightData:[Bl,t,Ul].join(jl)}}function Wl(t){var e=t.split(jl);if(e.length<3)throw new Error("Invalid key format: "+t);return e.slice(1,e.length-1).join(jl)}function ql(t){return te.get("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(Hl.URL_SCHEME)?function(t){return new Hl(t)}(t.slice(Hl.URL_SCHEME.length)):null}var Hl=($l.prototype.save=function(o){return m(this,void 0,void 0,function(){var e,n,r,i;return I(this,function(t){if(o.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");e=JSON.stringify(o.modelTopology),n=JSON.stringify(o.weightSpecs),r=vl(o);try{return this.LS.setItem(this.keys.info,JSON.stringify(r)),this.LS.setItem(this.keys.topology,e),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,function(t){return dl?a.from(t).toString("base64"):btoa(String.fromCharCode.apply(null,new Uint8Array(t)))}(o.weightData)),[2,{modelArtifactsInfo:r}]}catch(t){for(i in this.keys)this.LS.removeItem(this.keys[i]);throw new Error("Failed to save model '"+this.modelPath+"' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes="+r.modelTopologyBytes+", weightSpecsBytes="+r.weightSpecsBytes+", weightDataBytes="+r.weightDataBytes+".")}return[2]})})},$l.prototype.load=function(){return m(this,void 0,void 0,function(){var e,n,r,i,o;return I(this,function(t){if(null==(e=JSON.parse(this.LS.getItem(this.keys.info))))throw new Error("In local storage, there is no model with name '"+this.modelPath+"'");if("JSON"!==e.modelTopologyType)throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");if(n={},null==(r=JSON.parse(this.LS.getItem(this.keys.topology))))throw new Error("In local storage, the topology of model '"+this.modelPath+"' is missing.");if(n.modelTopology=r,null==(i=JSON.parse(this.LS.getItem(this.keys.weightSpecs))))throw new Error("In local storage, the weight specs of model '"+this.modelPath+"' are missing.");if(n.weightSpecs=i,null==(o=this.LS.getItem(this.keys.weightData)))throw new Error("In local storage, the binary weight values of model '"+this.modelPath+"' are missing.");return n.weightData=function(t){if(dl){var e=a.from(t,"base64");return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}for(var n=atob(t),r=new Uint8Array(n.length),i=0;i<n.length;++i)r.set([n.charCodeAt(i)],i);return r.buffer}(o),[2,n]})})},$l.URL_SCHEME="localstorage://",$l);function $l(t){if(!te.get("IS_BROWSER")||void 0===window.localStorage)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,null==t||!t)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=t,this.keys=Vl(this.modelPath)}bl.registerSaveRouter(ql),bl.registerLoadRouter(ql);var Gl=(Kl.prototype.listModels=function(){return m(this,void 0,void 0,function(){var e,n,r,i,o,a;return I(this,function(t){for(e={},n=Bl+jl,r=jl+Ll,i=0;i<this.LS.length;++i)(o=this.LS.key(i)).startsWith(n)&&o.endsWith(r)&&(a=Wl(o),e[a]=JSON.parse(this.LS.getItem(o)));return[2,e]})})},Kl.prototype.removeModel=function(r){return m(this,void 0,void 0,function(){var e,n;return I(this,function(t){if(r=function(t){return t.startsWith(Hl.URL_SCHEME)?t.slice(Hl.URL_SCHEME.length):t}(r),e=Vl(r),null==this.LS.getItem(e.info))throw new Error("Cannot find model at path '"+r+"'");return n=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,n]})})},Kl);function Kl(){C(te.get("IS_BROWSER"),"Current environment is not a web browser"),C(void 0!==window.localStorage,"Current browser does not appear to support localStorage"),this.LS=window.localStorage}if(te.get("IS_BROWSER"))try{_l.registerManager(Hl.URL_SCHEME,new Gl)}catch(t){}var Xl=(Jl.prototype.save=function(s){return m(this,void 0,void 0,function(){var e,n,r,i,o,a;return I(this,function(t){if(e=window.URL.createObjectURL(new Blob([s.weightData],{type:"application/octet-stream"})),s.modelTopology instanceof ArrayBuffer)throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");return n=[{paths:["./"+this.weightDataFileName],weights:s.weightSpecs}],r={modelTopology:s.modelTopology,weightsManifest:n},i=window.URL.createObjectURL(new Blob([JSON.stringify(r)],{type:"application/json"})),(o=null==this.jsonAnchor?document.createElement("a"):this.jsonAnchor).download=this.modelTopologyFileName,o.href=i,o.click(),null!=s.weightData&&((a=null==this.weightDataAnchor?document.createElement("a"):this.weightDataAnchor).download=this.weightDataFileName,a.href=e,a.click()),[2,{modelArtifactsInfo:vl(s)}]})})},Jl.URL_SCHEME="downloads://",Jl),Yl=(Zl.prototype.load=function(){return m(this,void 0,void 0,function(){var r,f,h=this;return I(this,function(t){return r=this.files[0],f=this.files.slice(1),[2,new Promise(function(c,l){var t=new FileReader;t.onload=function(t){var e=JSON.parse(t.target.result),i=e.modelTopology;if(null!=i){0===f.length&&c({modelTopology:i});var n=e.weightsManifest;if(null!=n){var o;try{o=h.checkManifestAndWeightFiles(n,f)}catch(t){return void l(t)}var a=[],s=[],u=[];n.forEach(function(t){t.paths.forEach(function(t){s.push(t),u.push(null)}),a.push.apply(a,t.weights)}),n.forEach(function(t){t.paths.forEach(function(r){var t=new FileReader;t.onload=function(t){var e=t.target.result,n=s.indexOf(r);u[n]=e,-1===u.indexOf(null)&&c({modelTopology:i,weightSpecs:a,weightData:gl(u)})},t.onerror=function(t){return l("Failed to weights data from file of path '"+r+"'.")},t.readAsArrayBuffer(o[r])})})}else l(new Error("weightManifest field is missing from file "+r.name))}else l(new Error("modelTopology field is missing from file "+r.name))},t.onerror=function(t){return l("Failed to read model topology and weights manifest JSON from file '"+r.name+"'. BrowserFiles supports loading Keras-style tf.Model artifacts only.")},t.readAsText(r)})]})})},Zl.prototype.checkManifestAndWeightFiles=function(t,n){for(var r=[],i=n.map(function(t){return yl(t.name)}),o={},e=0,a=t;e<a.length;e++)a[e].paths.forEach(function(t){var e=yl(t);if(-1!==r.indexOf(e))throw new Error("Duplicate file basename found in weights manifest: '"+e+"'");if(r.push(e),-1===i.indexOf(e))throw new Error("Weight file with basename '"+e+"' is not provided.");o[t]=n[i.indexOf(e)]});if(r.length!==n.length)throw new Error("Mismatch in the number of files in weights manifest ("+r.length+") and the number of weight files provided ("+n.length+").");return o},Zl);function Zl(t){if(null==t||t.length<1)throw new Error("When calling browserFiles, at least 1 file is required, but received "+t);this.files=t}function Jl(t){if(!te.get("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");t.startsWith(Jl.URL_SCHEME)&&(t=t.slice(Jl.URL_SCHEME.length)),null!=t&&0!==t.length||(t="model"),this.modelTopologyFileName=t+".json",this.weightDataFileName=t+".weights.bin"}function Ql(i,o,a,s){return m(this,void 0,void 0,function(){var e,n,r;return I(this,function(t){switch(t.label){case 0:return null==a&&(a=fetch),e=i.map(function(t){return a(t,o)}),null!=s&&Z(e,s,0,.5),[4,Promise.all(e)];case 1:return n=t.sent(),r=n.map(function(t){return t.arrayBuffer()}),null!=s&&Z(r,s,.5,1),[4,Promise.all(r)];case 2:return[2,t.sent()]}})})}function tf(o){var t=this;return function(p,i,d){return void 0===i&&(i=""),m(t,void 0,void 0,function(){var a,c,s,u,e,n,r,l,f,h;return I(this,function(t){switch(t.label){case 0:if(a=p.map(function(){return!1}),c={},s=null!=d?d.map(function(){return!1}):[],u=[],p.forEach(function(t,i){var o=0;t.weights.forEach(function(n){function r(){a[i]=!0,null==c[i]&&(c[i]=[]),c[i].push({manifestEntry:n,groupOffset:o,sizeBytes:e})}var t="quantization"in n?n.quantization.dtype:n.dtype,e=hl[t]*L(n.shape);null!=d?d.forEach(function(t,e){t===n.name&&(r(),s[e]=!0)}):r(),u.push(n.name),o+=e})}),!s.every(function(t){return t}))throw e=d.filter(function(t,e){return!s[e]}),new Error("Could not find weights in manifest with names: "+e.join(", ")+". \nManifest JSON has weights with names: "+u.join(", ")+".");return n=a.reduce(function(t,e,n){return e&&t.push(n),t},[]),r=[],n.forEach(function(t){p[t].paths.forEach(function(t){var e=i+(i.endsWith("/")?"":"/")+t;r.push(e)})}),[4,o(r)];case 1:return l=t.sent(),f={},h=0,n.forEach(function(t){for(var e=p[t].paths.length,n=0,r=0;r<e;r++)n+=l[h+r].byteLength;for(var i=new ArrayBuffer(n),o=new Uint8Array(i),a=0,s=0;s<e;s++){var u=new Uint8Array(l[h+s]);o.set(u,a),a+=u.byteLength}c[t].forEach(function(t){var e=pl(i.slice(t.groupOffset,t.groupOffset+t.sizeBytes),[t.manifestEntry]);for(var n in e)f[n]=e[n]}),h+=e}),[2,f]}})})}}bl.registerSaveRouter(function(t){return te.get("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(Xl.URL_SCHEME)?function(t){return void 0===t&&(t="model"),new Xl(t)}(t.slice(Xl.URL_SCHEME.length)):null});var ef=(nf.prototype.save=function(o){return m(this,void 0,void 0,function(){var e,n,r,i;return I(this,function(t){switch(t.label){case 0:if(o.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,n=[{paths:["./model.weights.bin"],weights:o.weightSpecs}],r={modelTopology:o.modelTopology,weightsManifest:n},e.body.append("model.json",new Blob([JSON.stringify(r)],{type:"application/json"}),"model.json"),null!=o.weightData&&e.body.append("model.weights.bin",new Blob([o.weightData],{type:"application/octet-stream"}),"model.weights.bin"),[4,this.getFetchFunc()(this.path,e)];case 1:if((i=t.sent()).ok)return[2,{modelArtifactsInfo:vl(o),responses:[i]}];throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+i.status+".")}})})},nf.prototype.load=function(){return m(this,void 0,void 0,function(){return I(this,function(t){return[2,Array.isArray(this.path)?this.loadBinaryModel():this.loadJSONModel()]})})},nf.prototype.loadBinaryTopology=function(){return m(this,void 0,void 0,function(){var e;return I(this,function(t){switch(t.label){case 0:return[4,this.getFetchFunc()(this.path[0],this.requestInit)];case 1:if(!(e=t.sent()).ok)throw new Error("Request to "+this.path[0]+" failed with error: "+e.statusText);return[4,e.arrayBuffer()];case 2:return[2,t.sent()]}})})},nf.prototype.loadBinaryModel=function(){return m(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u;return I(this,function(t){switch(t.label){case 0:return e=this.loadBinaryTopology(),[4,this.getFetchFunc()(this.path[1],this.requestInit)];case 1:if(!(n=t.sent()).ok)throw new Error("Request to "+this.path[1]+" failed with error: "+n.statusText);return[4,Promise.all([e,n])];case 2:return r=t.sent(),i=r[0],[4,r[1].json()];case 3:return null==(o=t.sent())?[3,5]:[4,this.loadWeights(o)];case 4:u=t.sent(),a=u[0],s=u[1],t.label=5;case 5:return[2,{modelTopology:i,weightSpecs:a,weightData:s}]}})})},nf.prototype.loadJSONModel=function(){return m(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u;return I(this,function(t){switch(t.label){case 0:return[4,this.getFetchFunc()(this.path,this.requestInit)];case 1:if(!(e=t.sent()).ok)throw new Error("Request to "+this.path+" failed with error: "+e.statusText);return[4,e.json()];case 2:if(n=t.sent(),r=n.modelTopology,i=n.weightsManifest,null==r&&null==i)throw new Error("The JSON from HTTP path "+this.path+" contains neither model topology or manifest for weights.");return null==i?[3,4]:(s=n.weightsManifest,[4,this.loadWeights(s)]);case 3:u=t.sent(),o=u[0],a=u[1],t.label=4;case 4:return[2,{modelTopology:r,weightSpecs:o,weightData:a}]}})})},nf.prototype.loadWeights=function(p){return m(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c,l,f,h;return I(this,function(t){switch(t.label){case 0:for(e=Array.isArray(this.path)?this.path[1]:this.path,n=function(t){var e=t.lastIndexOf("/"),n=t.lastIndexOf("?");return[t.substring(0,e)+"/",e<n?t.substring(n):""]}(e),r=n[0],i=n[1],o=this.weightPathPrefix||r,a=[],s=0,u=p;s<u.length;s++)c=u[s],a.push.apply(a,c.weights);return l=[],p.forEach(function(t){t.paths.forEach(function(t){l.push(o+t+i)})}),f=[a],h=gl,[4,Ql(l,this.requestInit,this.getFetchFunc(),this.onProgress)];case 1:return[2,f.concat([h.apply(void 0,[t.sent()])])]}})})},nf.prototype.getFetchFunc=function(){return this.fetchFunc},nf.URL_SCHEME_REGEX=/^https?:\/\//,nf);function nf(t,e,n,r,i){if(this.weightPathPrefix=n,this.onProgress=i,this.DEFAULT_METHOD="POST",null==r){if("undefined"==typeof fetch)throw new Error("browserHTTPRequest is not supported outside the web browser without a fetch polyfill.");r=fetch.bind("undefined"==typeof window?null:window)}else C("function"==typeof r,"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)");if(this.fetchFunc=function(e,t){return r(e,t).catch(function(t){throw new Error("Request for "+e+" failed due to error: "+t)})},C(null!=t&&0<t.length,"URL path for browserHTTPRequest must not be null, undefined or empty."),Array.isArray(t)&&C(2===t.length,"URL paths for browserHTTPRequest must have a length of 2, (actual length is "+t.length+")."),this.path=t,null!=e&&null!=e.body)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=e||{}}function rf(t){return null!=t.match(ef.URL_SCHEME_REGEX)}function of(t,e){return"undefined"==typeof fetch?null:(Array.isArray(t)?t.every(function(t){return rf(t)}):rf(t))?af(t,null,null,null,e):null}function af(t,e,n,r,i){return new ef(t,e,n,r,i)}bl.registerSaveRouter(of),bl.registerLoadRouter(of);var sf=(lf.prototype.load=function(){return m(this,void 0,void 0,function(){var e;return I(this,function(t){return e={},null!=this.modelTopology&&(e=o({modelTopology:this.modelTopology},e)),null!=this.weightSpecs&&0<this.weightSpecs.length&&(e=o({weightSpecs:this.weightSpecs},e)),null!=this.weightData&&0<this.weightData.byteLength&&(e=o({weightData:this.weightData},e)),[2,e]})})},lf),uf=(cf.prototype.save=function(e){return m(this,void 0,void 0,function(){return I(this,function(t){return[2,this.saveHandler(e)]})})},cf);function cf(t){this.saveHandler=t}function lf(t,e,n){this.modelTopology=t,this.weightSpecs=e,this.weightData=n}var ff=Object.freeze({browserFiles:function(t){return new Yl(t)},browserHTTPRequest:af,concatenateArrayBuffers:gl,decodeWeights:pl,encodeWeights:function(o){return m(this,void 0,void 0,function(){var e,n,r,i;return I(this,function(t){switch(t.label){case 0:for(r in e=[],n=[],o){if("float32"!==(i=o[r]).dtype&&"int32"!==i.dtype&&"bool"!==i.dtype)throw new Error("Unsupported dtype in weight '"+r+"': "+i.dtype);e.push({name:r,shape:i.shape,dtype:i.dtype}),n.push(i.data())}return[4,Promise.all(n)];case 1:return[2,{data:function(t){if(null===t)throw new Error("Invalid input value: "+JSON.stringify(t));var e=0,n=[];t.forEach(function(t){if(e+=t.byteLength,n.push(t.byteLength===t.buffer.byteLength?t:new t.constructor(t)),!(t instanceof Float32Array||t instanceof Int32Array||t instanceof Uint8Array))throw new Error("Unsupported TypedArray subtype: "+t.constructor.name)});var r=new Uint8Array(e),i=0;return n.forEach(function(t){r.set(new Uint8Array(t.buffer),i),i+=t.byteLength}),r.buffer}(t.sent()),specs:e}]}})})},fromMemory:function(t,e,n){return new sf(t,e,n)},getLoadHandlers:function(t,e){return bl.getLoadHandlers(t)},getModelArtifactsInfoForJSON:vl,getSaveHandlers:function(t){return bl.getSaveHandlers(t)},isHTTPScheme:rf,loadWeights:function(e,n,r,i){return void 0===n&&(n=""),m(this,void 0,void 0,function(){return I(this,function(t){return[2,tf(function(t){return Ql(t,i)})(e,n,r)]})})},registerLoadRouter:function(t){return bl.registerLoadRouter(t)},registerSaveRouter:function(t){return bl.registerSaveRouter(t)},weightsLoaderFactory:tf,withSaveHandler:function(t){return new uf(t)},copyModel:function(e,n){return m(this,void 0,void 0,function(){return I(this,function(t){switch(t.label){case 0:return[4,Nl(e,n,!1)];case 1:return[2,t.sent()]}})})},listModels:function(){return m(this,void 0,void 0,function(){var e,n,r,i,o,a,s;return I(this,function(t){switch(t.label){case 0:e=_l.getSchemes(),n={},r=0,i=e,t.label=1;case 1:return r<i.length?(o=i[r],[4,_l.getManager(o).listModels()]):[3,4];case 2:for(s in a=t.sent())n[o+wl+s]=a[s];t.label=3;case 3:return r++,[3,1];case 4:return[2,n]}})})},moveModel:function(e,n){return m(this,void 0,void 0,function(){return I(this,function(t){switch(t.label){case 0:return[4,Nl(e,n,!0)];case 1:return[2,t.sent()]}})})},removeModel:function(n){return m(this,void 0,void 0,function(){var e;return I(this,function(t){switch(t.label){case 0:return e=Sl(n),[4,_l.getManager(e.scheme).removeModel(e.path)];case 1:return[2,t.sent()]}})})}});var hf=Ue({confusionMatrix_:function(t,e,n){var r=Fe(t,"labels","confusionMatrix"),i=Fe(e,"predictions","confusionMatrix");C(null==n||0<n&&Number.isInteger(n),"If provided, numClasses must be a positive integer, but got "+n),C(1===r.rank,"Expected the rank of labels to be 1, but got "+r.rank),C(1===i.rank,"Expected the rank of predictions to be 1, but got "+i.rank),C(r.shape[0]===i.shape[0],"Mismatch in the number of examples: "+r.shape[0]+" vs. "+i.shape[0]+". Labels and predictions should have the same number of elements."),C(0<n&&Number.isInteger(n),"numClasses is required to be a positive integer, but got "+n);var o=ya(r.asType("int32"),n),a=ya(i.asType("int32"),n);return o.transpose().matMul(a).asType("int32")}}),pf=Object.freeze({confusionMatrix:hf}),df=(yf.prototype.getClassName=function(){return this.constructor.className},yf.fromConfig=function(t,e){return new t(e)},yf),mf=(gf.getMap=function(){return null==gf.instance&&(gf.instance=new gf),gf.instance},gf.register=function(t){gf.getMap().classNameMap[t.className]=[t,t.fromConfig]},gf);function gf(){this.classNameMap={}}function yf(){}function vf(t){C(null!=t.className,"Class being registered does not have the static className property defined."),C("string"==typeof t.className,"className is required to be a string, but got type "+typeof t.className),C(0<t.className.length,"Class being registered has an empty-string as its className, which is disallowed."),mf.register(t)}var bf=Object.freeze({Serializable:df,SerializationMap:mf,registerClass:vf});function wf(t,e,n){return null==n&&(n=te.get("TEST_EPSILON")),_f(t,"number"==typeof e||"boolean"==typeof e?[e]:e,function(t,e){return xf(t,Number(e),n)})}function _f(t,e,n){if(t instanceof mt||e instanceof mt){if(t instanceof mt&&e instanceof mt){if(t.dtype!==e.dtype)throw new Error("Arrays are of different type actual: "+t.dtype+" vs expected: "+e.dtype+".");if(!x(t.shape,e.shape))throw new Error("Arrays are of different shape actual: "+t.shape+" vs expected: "+e.shape+".")}}else{var r=t.constructor.name,i=e.constructor.name;if(r!==i)throw new Error("Arrays are of different type actual: "+r+" vs expected: "+i)}var o,a;if(o=t instanceof mt?t.dataSync():t,a=e instanceof mt?e.dataSync():e,o.length!==a.length)throw new Error("Arrays have different lengths actual: "+o.length+" vs expected: "+a.length+".\nActual:   "+o+".\nExpected: "+a+".");for(var s=0;s<a.length;++s){var u=o[s],c=a[s];if(!n(u,c))throw new Error("Arrays differ: actual["+s+"] = "+u+", expected["+s+"] = "+c+".\nActual:   "+o+".\nExpected: "+a+".")}}function xf(t,e,n){return!(!isNaN(t)||!isNaN(e))||!(isNaN(t)||isNaN(e)||Math.abs(t-e)>n)}var Ef,Sf=Object.freeze({WEBGL_ENVS:{HAS_WEBGL:!0},PACKED_ENVS:{WEBGL_PACK:!0},NODE_ENVS:{IS_NODE:!0},CHROME_ENVS:{IS_CHROME:!0},BROWSER_ENVS:{IS_BROWSER:!0},CPU_ENVS:{HAS_WEBGL:!1},ALL_ENVS:{},expectArraysClose:wf,expectPromiseToFail:function(t,e){t().then(function(){return e.fail()},function(){return e()})},expectArraysEqual:function(t,e){var n="string"==typeof e||"number"==typeof e||"boolean"==typeof e?[e]:e;return t instanceof mt&&"string"===t.dtype||e instanceof mt&&"string"===e.dtype||Array.isArray(t)&&F(t[0])||Array.isArray(e)&&F(e[0])?_f(t,n,function(t,e){return t==e}):wf(t,e,0)},expectNumbersClose:function(t,e,n){if(null==n&&(n=te.get("TEST_EPSILON")),!xf(t,e,n))throw new Error("Numbers differ: actual === "+t+", expected === "+e)},expectValuesInRange:function(t,e,n){var r;r=t instanceof mt?t.dataSync():t;for(var i=0;i<r.length;i++)if(r[i]<e||r[i]>n)throw new Error("Value out of range:"+r[i]+" low: "+e+", high: "+n)},expectArrayBuffersEqual:function(t,e){expect(new Float32Array(t)).toEqual(new Float32Array(e))}}),Nf="0.15.4",If=Object.freeze({gpgpu_util:Vi,webgl_util:wi,MathBackendWebGL:ja,GPGPUContext:Wi}),Of=(i(kf,Ef=df),kf.prototype.minimize=function(t,e,n){void 0===e&&(e=!1);var r=this.computeGradients(t,n),i=r.value,o=r.grads;return this.applyGradients(o),Object.keys(o).forEach(function(t){return o[t].dispose()}),e?i:(i.dispose(),null)},kf.prototype.computeGradients=function(t,e){return ae(t,e)},kf);function kf(){return null!==Ef&&Ef.apply(this,arguments)||this}Object.defineProperty(Of,Symbol.hasInstance,{value:function(t){return null!=t.minimize&&null!=t.computeGradients&&null!=t.applyGradients}});var Af,Cf=(i(Pf,Af=Of),Pf.prototype.applyGradients=function(t){function e(i){var o=te.engine.registeredVariables[i];null==n.accumulatedGrads[i]&&ce(function(){c.accumulatedGrads[i]=un(o).variable(!1)}),null==n.accumulatedUpdates[i]&&ce(function(){c.accumulatedUpdates[i]=un(o).variable(!1)});var a=t[i],s=n.accumulatedGrads[i],u=n.accumulatedUpdates[i];ce(function(){var t=c.rhoScalar.mul(s).add(c.oneMinusRho.mul(a.square())),e=u.add(c.epsilonScalar).sqrt().div(s.add(c.epsilonScalar).sqrt()).mul(a),n=c.rhoScalar.mul(u).add(c.oneMinusRho.mul(e.square()));c.accumulatedGrads[i].assign(t),c.accumulatedUpdates[i].assign(n);var r=c.c.mul(e).add(o);o.assign(r)})}var c=this,n=this;for(var r in t)e(r)},Pf.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsilonScalar.dispose(),this.rhoScalar.dispose(),this.oneMinusRho.dispose(),null!=this.accumulatedUpdates&&(Object.keys(this.accumulatedUpdates).forEach(function(t){return e.accumulatedUpdates[t].dispose()}),Object.keys(this.accumulatedGrads).forEach(function(t){return e.accumulatedGrads[t].dispose()}))},Pf.prototype.getConfig=function(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}},Pf.fromConfig=function(t,e){return new t(e.learningRate,e.rho,e.epsilon)},Pf.className="AdadeltaOptimizer",Pf);function Pf(t,e,n){void 0===n&&(n=null);var r=Af.call(this)||this;return r.learningRate=t,r.rho=e,r.epsilon=n,r.accumulatedGrads={},r.accumulatedUpdates={},r.c=le(Ke(-t)),r.rhoScalar=le(Ke(e)),r.oneMinusRho=le(Ke(1-e)),null===n&&(n=te.get("EPSILON")),r.epsilonScalar=le(Ke(n)),r}vf(Cf);var Tf,Mf=(i(Rf,Tf=Of),Rf.prototype.applyGradients=function(t){function e(n){var r=te.engine.registeredVariables[n];null==s.accumulatedGrads[n]&&ce(function(){a.accumulatedGrads[n]=rn(r.shape,a.initialAccumulatorValue).variable(!1)});var i=t[n],o=s.accumulatedGrads[n];ce(function(){var t=o.add(i.square());a.accumulatedGrads[n].assign(t);var e=a.c.mul(i.div(t.add(a.epsilon).sqrt())).add(r);r.assign(e)})}var a=this,s=this;for(var n in t)e(n)},Rf.prototype.dispose=function(){var e=this;this.epsilon.dispose(),this.c.dispose(),null!=this.accumulatedGrads&&Object.keys(this.accumulatedGrads).forEach(function(t){return e.accumulatedGrads[t].dispose()})},Rf.prototype.getConfig=function(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}},Rf.fromConfig=function(t,e){return new t(e.learningRate,e.initialAccumulatorValue)},Rf.className="AdagradOptimizer",Rf);function Rf(t,e){void 0===e&&(e=.1);var n=Tf.call(this)||this;return n.learningRate=t,n.initialAccumulatorValue=e,n.accumulatedGrads={},n.c=le(Ke(-t)),n.epsilon=le(Ke(te.get("EPSILON"))),n}vf(Mf);var Df,jf=(i(Bf,Df=Of),Bf.prototype.applyGradients=function(p){var d=this;ce(function(){var t=d.one.sub(d.accBeta1),e=d.one.sub(d.accBeta2);for(var n in p){var r=te.engine.registeredVariables[n];if(null==d.accumulatedFirstMoment[n]){var i=!1;d.accumulatedFirstMoment[n]=un(r).variable(i)}null==d.accumulatedSecondMoment[n]&&(i=!1,d.accumulatedSecondMoment[n]=un(r).variable(i));var o=p[n],a=d.accumulatedFirstMoment[n],s=d.accumulatedSecondMoment[n],u=d.beta1Scalar.mul(a).add(d.oneMinusBeta1.mul(o)),c=d.beta2Scalar.mul(s).add(d.oneMinusBeta2.mul(o.square())),l=u.div(t),f=c.div(e);d.accumulatedFirstMoment[n].assign(u),d.accumulatedSecondMoment[n].assign(c);var h=d.c.mul(l.div(d.epsScalar.add(f.sqrt()))).add(r);r.assign(h)}d.accBeta1.assign(d.accBeta1.mul(d.beta1Scalar)),d.accBeta2.assign(d.accBeta2.mul(d.beta2Scalar))})},Bf.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsScalar.dispose(),this.beta1Scalar.dispose(),this.beta2Scalar.dispose(),this.accBeta1.dispose(),this.accBeta2.dispose(),this.oneMinusBeta1.dispose(),this.oneMinusBeta2.dispose(),this.one.dispose(),null!=this.accumulatedFirstMoment&&Object.keys(this.accumulatedFirstMoment).forEach(function(t){return e.accumulatedFirstMoment[t].dispose()}),null!=this.accumulatedSecondMoment&&Object.keys(this.accumulatedSecondMoment).forEach(function(t){return e.accumulatedSecondMoment[t].dispose()})},Bf.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}},Bf.fromConfig=function(t,e){return new t(e.learningRate,e.beta1,e.beta2,e.epsilon)},Bf.className="AdamOptimizer",Bf);function Bf(t,e,n,r){void 0===r&&(r=null);var i=Df.call(this)||this;return i.learningRate=t,i.beta1=e,i.beta2=n,i.epsilon=r,i.accumulatedFirstMoment={},i.accumulatedSecondMoment={},i.c=le(Ke(-t)),i.beta1Scalar=le(Ke(e)),i.beta2Scalar=le(Ke(n)),ce(function(){i.accBeta1=Ke(e).variable(),i.accBeta2=Ke(n).variable()}),i.oneMinusBeta1=le(Ke(1-e)),i.oneMinusBeta2=le(Ke(1-n)),i.one=le(Ke(1)),null===r&&(r=te.get("EPSILON")),i.epsScalar=le(Ke(r)),i}vf(jf);var Lf,Ff=(i(zf,Lf=Of),zf.prototype.applyGradients=function(p){var d=this;ce(function(){var t=d.one.sub(d.accBeta1),e=d.c.div(d.one.add(d.decayScalar.mul(d.iteration)));for(var n in p){var r=te.engine.registeredVariables[n];if(null==d.accumulatedFirstMoment[n]){var i=!1;d.accumulatedFirstMoment[n]=un(r).variable(i)}null==d.accumulatedWeightedInfNorm[n]&&(i=!1,d.accumulatedWeightedInfNorm[n]=un(r).variable(i));var o=p[n],a=d.accumulatedFirstMoment[n],s=d.accumulatedWeightedInfNorm[n],u=d.beta1Scalar.mul(a).add(d.oneMinusBeta1.mul(o)),c=d.beta2Scalar.mul(s),l=o.abs(),f=c.maximum(l);d.accumulatedFirstMoment[n].assign(u),d.accumulatedWeightedInfNorm[n].assign(f);var h=e.div(t).mul(u.div(d.epsScalar.add(f))).add(r);r.assign(h)}d.iteration.assign(d.iteration.add(d.one)),d.accBeta1.assign(d.accBeta1.mul(d.beta1Scalar))})},zf.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsScalar.dispose(),this.accBeta1.dispose(),this.beta1Scalar.dispose(),this.beta2Scalar.dispose(),this.oneMinusBeta1.dispose(),this.decayScalar.dispose(),this.iteration.dispose(),this.one.dispose(),null!=this.accumulatedFirstMoment&&Object.keys(this.accumulatedFirstMoment).forEach(function(t){return e.accumulatedFirstMoment[t].dispose()}),null!=this.accumulatedWeightedInfNorm&&Object.keys(this.accumulatedWeightedInfNorm).forEach(function(t){return e.accumulatedWeightedInfNorm[t].dispose()})},zf.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}},zf.fromConfig=function(t,e){return new t(e.learningRate,e.beta1,e.beta2,e.epsilon,e.decay)},zf.className="AdamaxOptimizer",zf);function zf(t,e,n,r,i){void 0===r&&(r=null),void 0===i&&(i=0);var o=Lf.call(this)||this;return o.learningRate=t,o.beta1=e,o.beta2=n,o.epsilon=r,o.decay=i,o.accumulatedFirstMoment={},o.accumulatedWeightedInfNorm={},o.c=le(Ke(-t)),o.beta1Scalar=le(Ke(e)),o.beta2Scalar=le(Ke(n)),o.decayScalar=le(Ke(i)),ce(function(){o.iteration=Ke(0).variable(),o.accBeta1=Ke(e).variable()}),o.oneMinusBeta1=le(Ke(1-e)),o.one=le(Ke(1)),null===r&&(r=te.get("EPSILON")),o.epsScalar=le(Ke(r)),o}vf(Ff);var Uf,Vf=(i(Wf,Uf=Of),Wf.prototype.applyGradients=function(r){var i=this;Object.keys(r).forEach(function(t){var e=r[t],n=te.engine.registeredVariables[t];ce(function(){var t=i.c.mul(e).add(n);n.assign(t)})})},Wf.prototype.setLearningRate=function(t){this.learningRate=t,null!=this.c&&this.c.dispose(),this.c=le(Ke(-t))},Wf.prototype.dispose=function(){this.c.dispose()},Wf.prototype.getConfig=function(){return{learningRate:this.learningRate}},Wf.fromConfig=function(t,e){return new t(e.learningRate)},Wf.className="SGDOptimizer",Wf);function Wf(t){var e=Uf.call(this)||this;return e.learningRate=t,e.setLearningRate(t),e}vf(Vf);var qf,Hf=(i($f,qf=Vf),$f.prototype.applyGradients=function(t){function e(n){var r=te.engine.registeredVariables[n];null==s.accumulations[n]&&ce(function(){a.accumulations[n]=un(r).variable(!1)});var i=s.accumulations[n],o=t[n];ce(function(){var t,e=a.m.mul(i).add(o);t=a.useNesterov?a.c.mul(o.add(e.mul(a.m))).add(r):a.c.mul(e).add(r),a.accumulations[n].assign(e),r.assign(t)})}var a=this,s=this;for(var n in t)e(n)},$f.prototype.dispose=function(){if(qf.prototype.dispose.call(this),this.m.dispose(),null!=this.accumulations)for(var t in this.accumulations)this.accumulations[t].dispose()},$f.prototype.setMomentum=function(t){this.momentum=t},$f.prototype.getConfig=function(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}},$f.fromConfig=function(t,e){return new t(e.learningRate,e.momentum,e.useNesterov)},$f.className="MomentumOptimizer",$f);function $f(t,e,n){void 0===n&&(n=!1);var r=qf.call(this,t)||this;return r.learningRate=t,r.momentum=e,r.useNesterov=n,r.m=Ke(r.momentum),r.accumulations={},r}vf(Hf);var Gf,Kf=(i(Xf,Gf=Of),Xf.prototype.applyGradients=function(t){function e(o){var a=te.engine.registeredVariables[o];null==n.accumulatedMeanSquares[o]&&ce(function(){f.accumulatedMeanSquares[o]=un(a).variable(!1)}),null==n.accumulatedMeanGrads[o]&&n.centered&&ce(function(){f.accumulatedMeanGrads[o]=un(a).variable(!1)}),null==n.accumulatedMoments[o]&&ce(function(){f.accumulatedMoments[o]=un(a).variable(!1)});var s=n.accumulatedMeanSquares[o],u=n.accumulatedMeanGrads[o],c=n.accumulatedMoments[o],l=t[o];ce(function(){var t=f.decayScalar.mul(s).add(f.oneMinusDecay.mul(l.square()));if(f.centered){var e=f.decayScalar.mul(u).add(f.oneMinusDecay.mul(l)),n=f.momentumScalar.mul(c).add(f.c.mul(l).div(t.sub(e.square().add(f.epsilonScalar)).sqrt()));f.accumulatedMeanSquares[o].assign(t),f.accumulatedMeanGrads[o].assign(e),f.accumulatedMoments[o].assign(n);var r=a.sub(n);a.assign(r)}else{var i=f.decayScalar.mul(s).add(f.oneMinusDecay.mul(l.square()));n=f.momentumScalar.mul(c).add(f.c.mul(l).div(i.add(f.epsilonScalar).sqrt())),f.accumulatedMeanSquares[o].assign(i),f.accumulatedMoments[o].assign(n),r=a.sub(n),a.assign(r)}})}var f=this,n=this;for(var r in t)e(r)},Xf.prototype.dispose=function(){var e=this;this.c.dispose(),this.epsilonScalar.dispose(),this.decayScalar.dispose(),this.momentumScalar.dispose(),this.oneMinusDecay.dispose(),null!=this.accumulatedMeanSquares&&Object.keys(this.accumulatedMeanSquares).forEach(function(t){return e.accumulatedMeanSquares[t].dispose()}),null!=this.accumulatedMeanGrads&&this.centered&&Object.keys(this.accumulatedMeanGrads).forEach(function(t){return e.accumulatedMeanGrads[t].dispose()}),null!=this.accumulatedMoments&&Object.keys(this.accumulatedMoments).forEach(function(t){return e.accumulatedMoments[t].dispose()})},Xf.prototype.getConfig=function(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}},Xf.fromConfig=function(t,e){return new t(e.learningRate,e.decay,e.momentum,e.epsilon,e.centered)},Xf.className="RMSPropOptimizer",Xf);function Xf(t,e,n,r,i){void 0===e&&(e=.9),void 0===n&&(n=0),void 0===r&&(r=null),void 0===i&&(i=!1);var o=Gf.call(this)||this;return o.learningRate=t,o.decay=e,o.momentum=n,o.epsilon=r,o.accumulatedMeanSquares={},o.accumulatedMeanGrads={},o.accumulatedMoments={},o.c=le(Ke(t)),o.decayScalar=le(Ke(e)),o.momentumScalar=le(Ke(n)),o.oneMinusDecay=le(Ke(1-e)),o.centered=i,null===r&&(r=te.get("EPSILON")),o.epsilonScalar=le(Ke(r)),o}vf(Kf);var Yf=(nh.sgd=function(t){return new Vf(t)},nh.momentum=function(t,e,n){return void 0===n&&(n=!1),new Hf(t,e,n)},nh.rmsprop=function(t,e,n,r,i){return void 0===e&&(e=.9),void 0===n&&(n=0),void 0===r&&(r=null),void 0===i&&(i=!1),new Kf(t,e,n,r,i)},nh.adam=function(t,e,n,r){return void 0===t&&(t=.001),void 0===e&&(e=.9),void 0===n&&(n=.999),void 0===r&&(r=null),new jf(t,e,n,r)},nh.adadelta=function(t,e,n){return void 0===t&&(t=.001),void 0===e&&(e=.95),void 0===n&&(n=null),new Cf(t,e,n)},nh.adamax=function(t,e,n,r,i){return void 0===t&&(t=.002),void 0===e&&(e=.9),void 0===n&&(n=.999),void 0===r&&(r=null),void 0===i&&(i=0),new Ff(t,e,n,r,i)},nh.adagrad=function(t,e){return void 0===e&&(e=.1),new Mf(t,e)},nh),Zf={sgd:Yf.sgd,momentum:Yf.momentum,adadelta:Yf.adadelta,adagrad:Yf.adagrad,rmsprop:Yf.rmsprop,adamax:Yf.adamax,adam:Yf.adam},Jf=Kt.setBackend,Qf=Kt.getBackend,th=Kt.disposeVariables,eh=Kt.memory;function nh(){}ft=sl}).call(this,ih(35),ih(15),ih(189).setImmediate,ih(14).Buffer)},function(t,e,n){var m=n(5),g=n(26),y=n(18),v=n(19),b=n(27),w="prototype",_=function(t,e,n){var r,i,o,a,s=t&_.F,u=t&_.G,c=t&_.S,l=t&_.P,f=t&_.B,h=u?m:c?m[e]||(m[e]={}):(m[e]||{})[w],p=u?g:g[e]||(g[e]={}),d=p[w]||(p[w]={});for(r in u&&(n=e),n)o=((i=!s&&h&&void 0!==h[r])?h:n)[r],a=f&&i?b(o,m):l&&"function"==typeof o?b(Function.call,o):o,h&&v(h,r,o,t&_.U),p[r]!=o&&y(p,r,a),l&&d[r]!=o&&(d[r]=o)};m.core=g,_.F=1,_.G=2,_.S=4,_.P=8,_.B=16,_.W=32,_.U=64,_.R=128,t.exports=_},function(t,e,n){var r=n(7);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;function n(){}n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){var r=n(14),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function a(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=a),o(i,a),a.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},a.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){var r=n(64)("wks"),i=n(46),o=n(5).Symbol,a="function"==typeof o;(t.exports=function(t){return r[t]||(r[t]=a&&o[t]||(a?o:i)("Symbol."+t))}).store=r},function(t,e,n){var r=n(29),i=Math.min;t.exports=function(t){return 0<t?i(r(t),9007199254740991):0}},function(t,e,n){t.exports=!n(6)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(2),i=n(153),o=n(31),a=Object.defineProperty;e.f=n(10)?Object.defineProperty:function(t,e,n){if(r(t),e=o(e,!0),r(n),i)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,E){(function(t){!function(t,e){"use strict";function g(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;function n(){}n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function y(t,e,n){if(y.isBN(t))return t;this.negative=0,this.words=null,this.length=0,(this.red=null)!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var r;"object"==typeof t?t.exports=y:e.BN=y,(y.BN=y).wordSize=26;try{r=E(482).Buffer}catch(t){}function a(t,e,n){for(var r=0,i=Math.min(t.length,n),o=e;o<i;o++){var a=t.charCodeAt(o)-48;r<<=4,r|=49<=a&&a<=54?a-49+10:17<=a&&a<=22?a-17+10:15&a}return r}function f(t,e,n,r){for(var i=0,o=Math.min(t.length,n),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=r,i+=49<=s?s-49+10:17<=s?s-17+10:s}return i}y.isBN=function(t){return t instanceof y||null!==t&&"object"==typeof t&&t.constructor.wordSize===y.wordSize&&Array.isArray(t.words)},y.max=function(t,e){return 0<t.cmp(e)?t:e},y.min=function(t,e){return t.cmp(e)<0?t:e},y.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),g(e===(0|e)&&2<=e&&e<=36);var r=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&r++,16===e?this._parseHex(t,r):this._parseBase(t,e,r),"-"===t[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},y.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(g(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},y.prototype._initArray=function(t,e,n){if(g("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o,a=0;if("be"===n)for(r=t.length-1,i=0;0<=r;r-=3)o=t[r]|t[r-1]<<8|t[r-2]<<16,this.words[i]|=o<<a&67108863,this.words[i+1]=o>>>26-a&67108863,26<=(a+=24)&&(a-=26,i++);else if("le"===n)for(i=r=0;r<t.length;r+=3)o=t[r]|t[r+1]<<8|t[r+2]<<16,this.words[i]|=o<<a&67108863,this.words[i+1]=o>>>26-a&67108863,26<=(a+=24)&&(a-=26,i++);return this.strip()},y.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,o=0;for(n=t.length-6,r=0;e<=n;n-=6)i=a(t,n,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303,26<=(o+=24)&&(o-=26,r++);n+6!==e&&(i=a(t,e,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303),this.strip()},y.prototype._parseBase=function(t,e,n){this.words=[0];for(var r=0,i=this.length=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,u=0,c=n;c<s;c+=r)u=f(t,c,c+r,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!=a){var l=1;for(u=f(t,c,t.length,e),c=0;c<a;c++)l*=e;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}},y.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},y.prototype.clone=function(){var t=new y(null);return this.copy(t),t},y.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},y.prototype.strip=function(){for(;1<this.length&&0===this.words[this.length-1];)this.length--;return this._normSign()},y.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},y.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],p=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function i(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;r=(n.length=r)-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,f=67108863&u,h=Math.min(c,e.length-1),p=Math.max(0,c-t.length+1);p<=h;p++){var d=c-p|0;l+=(a=(i=0|t.words[d])*(o=0|e.words[p])+f)/67108864|0,f=67108863&a}n.words[c]=0|f,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}y.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var r=0,i=0,o=0;o<this.length;o++){var a=this.words[o],s=(16777215&(a<<r|i)).toString(16);n=0!==(i=a>>>24-r&16777215)||o!==this.length-1?h[6-s.length]+s+n:s+n,26<=(r+=2)&&(r-=26,o--)}for(0!==i&&(n=i.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&2<=t&&t<=36){var u=p[t],c=d[t];n="";var l=this.clone();for(l.negative=0;!l.isZero();){var f=l.modn(c).toString(t);n=(l=l.idivn(c)).isZero()?f+n:h[u-f.length]+f+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}g(!1,"Base should be between 2 and 36")},y.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:2<this.length&&g(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},y.prototype.toJSON=function(){return this.toString(16)},y.prototype.toBuffer=function(t,e){return g(void 0!==r),this.toArrayLike(r,t,e)},y.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},y.prototype.toArrayLike=function(t,e,n){var r=this.byteLength(),i=n||Math.max(1,r);g(r<=i,"byte array longer than desired length"),g(0<i,"Requested array length <= 0"),this.strip();var o,a,s="le"===e,u=new t(i),c=this.clone();if(s){for(a=0;!c.isZero();a++)o=c.andln(255),c.iushrn(8),u[a]=o;for(;a<i;a++)u[a]=0}else{for(a=0;a<i-r;a++)u[a]=0;for(a=0;!c.isZero();a++)o=c.andln(255),c.iushrn(8),u[i-a-1]=o}return u},y.prototype._countBits=Math.clz32?function(t){return 32-Math.clz32(t)}:function(t){var e=t,n=0;return 4096<=e&&(n+=13,e>>>=13),64<=e&&(n+=7,e>>>=7),8<=e&&(n+=4,e>>>=4),2<=e&&(n+=2,e>>>=2),n+e},y.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},y.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},y.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},y.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},y.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},y.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},y.prototype.isNeg=function(){return 0!==this.negative},y.prototype.neg=function(){return this.clone().ineg()},y.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},y.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},y.prototype.ior=function(t){return g(0==(this.negative|t.negative)),this.iuor(t)},y.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},y.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},y.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},y.prototype.iand=function(t){return g(0==(this.negative|t.negative)),this.iuand(t)},y.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},y.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},y.prototype.iuxor=function(t){var e,n;n=this.length>t.length?(e=this,t):(e=t,this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},y.prototype.ixor=function(t){return g(0==(this.negative|t.negative)),this.iuxor(t)},y.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},y.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},y.prototype.inotn=function(t){g("number"==typeof t&&0<=t);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),0<n&&e--;for(var r=0;r<e;r++)this.words[r]=67108863&~this.words[r];return 0<n&&(this.words[r]=~this.words[r]&67108863>>26-n),this.strip()},y.prototype.notn=function(t){return this.clone().inotn(t)},y.prototype.setn=function(t,e){g("number"==typeof t&&0<=t);var n=t/26|0,r=t%26;return this._expand(1+n),this.words[n]=e?this.words[n]|1<<r:this.words[n]&~(1<<r),this.strip()},y.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();r=this.length>t.length?(n=this,t):(n=t,this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},y.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},y.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;r=0<i?(n=this,t):(n=t,this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},y.prototype.sub=function(t){return this.clone().isub(t)};var o=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],f=8191&l,h=l>>>13,p=0|a[1],d=8191&p,m=p>>>13,g=0|a[2],y=8191&g,v=g>>>13,b=0|a[3],w=8191&b,_=b>>>13,x=0|a[4],E=8191&x,S=x>>>13,N=0|a[5],I=8191&N,O=N>>>13,k=0|a[6],A=8191&k,C=k>>>13,P=0|a[7],T=8191&P,M=P>>>13,R=0|a[8],D=8191&R,j=R>>>13,B=0|a[9],L=8191&B,F=B>>>13,z=0|s[0],U=8191&z,V=z>>>13,W=0|s[1],q=8191&W,H=W>>>13,$=0|s[2],G=8191&$,K=$>>>13,X=0|s[3],Y=8191&X,Z=X>>>13,J=0|s[4],Q=8191&J,tt=J>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ft=8191&lt,ht=lt>>>13,pt=0|s[9],dt=8191&pt,mt=pt>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(f,U))|0)+((8191&(i=(i=Math.imul(f,V))+Math.imul(h,U)|0))<<13)|0;c=((o=Math.imul(h,V))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(d,U),i=(i=Math.imul(d,V))+Math.imul(m,U)|0,o=Math.imul(m,V);var yt=(c+(r=r+Math.imul(f,q)|0)|0)+((8191&(i=(i=i+Math.imul(f,H)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,U),i=(i=Math.imul(y,V))+Math.imul(v,U)|0,o=Math.imul(v,V),r=r+Math.imul(d,q)|0,i=(i=i+Math.imul(d,H)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,H)|0;var vt=(c+(r=r+Math.imul(f,G)|0)|0)+((8191&(i=(i=i+Math.imul(f,K)|0)+Math.imul(h,G)|0))<<13)|0;c=((o=o+Math.imul(h,K)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(w,U),i=(i=Math.imul(w,V))+Math.imul(_,U)|0,o=Math.imul(_,V),r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(d,G)|0,i=(i=i+Math.imul(d,K)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,K)|0;var bt=(c+(r=r+Math.imul(f,Y)|0)|0)+((8191&(i=(i=i+Math.imul(f,Z)|0)+Math.imul(h,Y)|0))<<13)|0;c=((o=o+Math.imul(h,Z)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(E,U),i=(i=Math.imul(E,V))+Math.imul(S,U)|0,o=Math.imul(S,V),r=r+Math.imul(w,q)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(_,q)|0,o=o+Math.imul(_,H)|0,r=r+Math.imul(y,G)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0,r=r+Math.imul(d,Y)|0,i=(i=i+Math.imul(d,Z)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,Z)|0;var wt=(c+(r=r+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((o=o+Math.imul(h,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(I,U),i=(i=Math.imul(I,V))+Math.imul(O,U)|0,o=Math.imul(O,V),r=r+Math.imul(E,q)|0,i=(i=i+Math.imul(E,H)|0)+Math.imul(S,q)|0,o=o+Math.imul(S,H)|0,r=r+Math.imul(w,G)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,K)|0,r=r+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(v,Y)|0,o=o+Math.imul(v,Z)|0,r=r+Math.imul(d,Q)|0,i=(i=i+Math.imul(d,tt)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,tt)|0;var _t=(c+(r=r+Math.imul(f,nt)|0)|0)+((8191&(i=(i=i+Math.imul(f,rt)|0)+Math.imul(h,nt)|0))<<13)|0;c=((o=o+Math.imul(h,rt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(A,U),i=(i=Math.imul(A,V))+Math.imul(C,U)|0,o=Math.imul(C,V),r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(O,q)|0,o=o+Math.imul(O,H)|0,r=r+Math.imul(E,G)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,K)|0,r=r+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,Z)|0,r=r+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(d,nt)|0,i=(i=i+Math.imul(d,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var xt=(c+(r=r+Math.imul(f,ot)|0)|0)+((8191&(i=(i=i+Math.imul(f,at)|0)+Math.imul(h,ot)|0))<<13)|0;c=((o=o+Math.imul(h,at)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(T,U),i=(i=Math.imul(T,V))+Math.imul(M,U)|0,o=Math.imul(M,V),r=r+Math.imul(A,q)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(C,q)|0,o=o+Math.imul(C,H)|0,r=r+Math.imul(I,G)|0,i=(i=i+Math.imul(I,K)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,K)|0,r=r+Math.imul(E,Y)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(S,Y)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(d,ot)|0,i=(i=i+Math.imul(d,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var Et=(c+(r=r+Math.imul(f,ut)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(h,ut)|0))<<13)|0;c=((o=o+Math.imul(h,ct)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(D,U),i=(i=Math.imul(D,V))+Math.imul(j,U)|0,o=Math.imul(j,V),r=r+Math.imul(T,q)|0,i=(i=i+Math.imul(T,H)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(A,G)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,Z)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(_,nt)|0,o=o+Math.imul(_,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(d,ut)|0,i=(i=i+Math.imul(d,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var St=(c+(r=r+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(h,ft)|0))<<13)|0;c=((o=o+Math.imul(h,ht)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(L,U),i=(i=Math.imul(L,V))+Math.imul(F,U)|0,o=Math.imul(F,V),r=r+Math.imul(D,q)|0,i=(i=i+Math.imul(D,H)|0)+Math.imul(j,q)|0,o=o+Math.imul(j,H)|0,r=r+Math.imul(T,G)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,K)|0,r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,Z)|0,r=r+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,tt)|0,r=r+Math.imul(E,nt)|0,i=(i=i+Math.imul(E,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(d,ft)|0,i=(i=i+Math.imul(d,ht)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,ht)|0;var Nt=(c+(r=r+Math.imul(f,dt)|0)|0)+((8191&(i=(i=i+Math.imul(f,mt)|0)+Math.imul(h,dt)|0))<<13)|0;c=((o=o+Math.imul(h,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(L,q),i=(i=Math.imul(L,H))+Math.imul(F,q)|0,o=Math.imul(F,H),r=r+Math.imul(D,G)|0,i=(i=i+Math.imul(D,K)|0)+Math.imul(j,G)|0,o=o+Math.imul(j,K)|0,r=r+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,Z)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,Z)|0,r=r+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(O,nt)|0,o=o+Math.imul(O,rt)|0,r=r+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ct)|0,r=r+Math.imul(y,ft)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(v,ft)|0,o=o+Math.imul(v,ht)|0;var It=(c+(r=r+Math.imul(d,dt)|0)|0)+((8191&(i=(i=i+Math.imul(d,mt)|0)+Math.imul(m,dt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(L,G),i=(i=Math.imul(L,K))+Math.imul(F,G)|0,o=Math.imul(F,K),r=r+Math.imul(D,Y)|0,i=(i=i+Math.imul(D,Z)|0)+Math.imul(j,Y)|0,o=o+Math.imul(j,Z)|0,r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(A,nt)|0,i=(i=i+Math.imul(A,rt)|0)+Math.imul(C,nt)|0,o=o+Math.imul(C,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,at)|0,r=r+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(w,ft)|0,i=(i=i+Math.imul(w,ht)|0)+Math.imul(_,ft)|0,o=o+Math.imul(_,ht)|0;var Ot=(c+(r=r+Math.imul(y,dt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,dt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,r=Math.imul(L,Y),i=(i=Math.imul(L,Z))+Math.imul(F,Y)|0,o=Math.imul(F,Z),r=r+Math.imul(D,Q)|0,i=(i=i+Math.imul(D,tt)|0)+Math.imul(j,Q)|0,o=o+Math.imul(j,tt)|0,r=r+Math.imul(T,nt)|0,i=(i=i+Math.imul(T,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,at)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ct)|0,r=r+Math.imul(E,ft)|0,i=(i=i+Math.imul(E,ht)|0)+Math.imul(S,ft)|0,o=o+Math.imul(S,ht)|0;var kt=(c+(r=r+Math.imul(w,dt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(_,dt)|0))<<13)|0;c=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,tt))+Math.imul(F,Q)|0,o=Math.imul(F,tt),r=r+Math.imul(D,nt)|0,i=(i=i+Math.imul(D,rt)|0)+Math.imul(j,nt)|0,o=o+Math.imul(j,rt)|0,r=r+Math.imul(T,ot)|0,i=(i=i+Math.imul(T,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ct)|0,r=r+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,ht)|0;var At=(c+(r=r+Math.imul(E,dt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(S,dt)|0))<<13)|0;c=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(L,nt),i=(i=Math.imul(L,rt))+Math.imul(F,nt)|0,o=Math.imul(F,rt),r=r+Math.imul(D,ot)|0,i=(i=i+Math.imul(D,at)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,at)|0,r=r+Math.imul(T,ut)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,ht)|0)+Math.imul(C,ft)|0,o=o+Math.imul(C,ht)|0;var Ct=(c+(r=r+Math.imul(I,dt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(O,dt)|0))<<13)|0;c=((o=o+Math.imul(O,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(L,ot),i=(i=Math.imul(L,at))+Math.imul(F,ot)|0,o=Math.imul(F,at),r=r+Math.imul(D,ut)|0,i=(i=i+Math.imul(D,ct)|0)+Math.imul(j,ut)|0,o=o+Math.imul(j,ct)|0,r=r+Math.imul(T,ft)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(M,ft)|0,o=o+Math.imul(M,ht)|0;var Pt=(c+(r=r+Math.imul(A,dt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(C,dt)|0))<<13)|0;c=((o=o+Math.imul(C,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(L,ut),i=(i=Math.imul(L,ct))+Math.imul(F,ut)|0,o=Math.imul(F,ct),r=r+Math.imul(D,ft)|0,i=(i=i+Math.imul(D,ht)|0)+Math.imul(j,ft)|0,o=o+Math.imul(j,ht)|0;var Tt=(c+(r=r+Math.imul(T,dt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(M,dt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(L,ft),i=(i=Math.imul(L,ht))+Math.imul(F,ft)|0,o=Math.imul(F,ht);var Mt=(c+(r=r+Math.imul(D,dt)|0)|0)+((8191&(i=(i=i+Math.imul(D,mt)|0)+Math.imul(j,dt)|0))<<13)|0;c=((o=o+Math.imul(j,mt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863;var Rt=(c+(r=Math.imul(L,dt))|0)+((8191&(i=(i=Math.imul(L,mt))+Math.imul(F,dt)|0))<<13)|0;return c=((o=Math.imul(F,mt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=gt,u[1]=yt,u[2]=vt,u[3]=bt,u[4]=wt,u[5]=_t,u[6]=xt,u[7]=Et,u[8]=St,u[9]=Nt,u[10]=It,u[11]=Ot,u[12]=kt,u[13]=At,u[14]=Ct,u[15]=Pt,u[16]=Tt,u[17]=Mt,u[18]=Rt,0!==c&&(u[19]=c,n.length++),n};function s(t,e,n){return(new u).mulp(t,e,n)}function u(t,e){this.x=t,this.y=e}Math.imul||(o=i),y.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?o(this,t,e):n<63?i(this,t,e):n<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,f=(0|t.words[l])*(0|e.words[c]),h=67108863&f;s=67108863&(h=h+s|0),i+=(a=(a=a+(f/67108864|0)|0)+(h>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):s(this,t,e)},u.prototype.makeRBT=function(t){for(var e=new Array(t),n=y.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},u.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},u.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},u.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var f=u,h=c,p=0;p<a;p++){var d=n[l+p],m=r[l+p],g=n[l+p+a],y=r[l+p+a],v=f*g-h*y;y=f*y+h*g,g=v,n[l+p]=d+g,r[l+p]=m+y,n[l+p+a]=d-g,r[l+p+a]=m-y,p!==s&&(v=u*f-c*h,h=u*h+c*f,f=v)}},u.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},u.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},u.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},u.prototype.convert13b=function(t,e,n,r){for(var i=0,o=0;o<e;o++)i+=0|t[o],n[2*o]=8191&i,i>>>=13,n[2*o+1]=8191&i,i>>>=13;for(o=2*e;o<r;++o)n[o]=0;g(0===i),g(0==(-8192&i))},u.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},u.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),l=new Array(r),f=new Array(r),h=n.words;h.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,l,f,r,i);for(var p=0;p<r;p++){var d=s[p]*l[p]-u[p]*f[p];u[p]=s[p]*f[p]+u[p]*l[p],s[p]=d}return this.conjugate(s,u,r),this.transform(s,u,h,o,r,i),this.conjugate(h,o,r),this.normalize13b(h,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},y.prototype.mul=function(t){var e=new y(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},y.prototype.mulf=function(t){var e=new y(null);return e.words=new Array(this.length+t.length),s(this,t,e)},y.prototype.imul=function(t){return this.clone().mulTo(t,this)},y.prototype.imuln=function(t){g("number"==typeof t),g(t<67108864);for(var e=0,n=0;n<this.length;n++){var r=(0|this.words[n])*t,i=(67108863&r)+(67108863&e);e>>=26,e+=r/67108864|0,e+=i>>>26,this.words[n]=67108863&i}return 0!==e&&(this.words[n]=e,this.length++),this},y.prototype.muln=function(t){return this.clone().imuln(t)},y.prototype.sqr=function(){return this.mul(this)},y.prototype.isqr=function(){return this.imul(this.clone())},y.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new y(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var i=n.sqr();r<e.length;r++,i=i.sqr())0!==e[r]&&(n=n.mul(i));return n},y.prototype.iushln=function(t){g("number"==typeof t&&0<=t);var e,n=t%26,r=(t-n)/26,i=67108863>>>26-n<<26-n;if(0!=n){var o=0;for(e=0;e<this.length;e++){var a=this.words[e]&i,s=(0|this.words[e])-a<<n;this.words[e]=s|o,o=a>>>26-n}o&&(this.words[e]=o,this.length++)}if(0!=r){for(e=this.length-1;0<=e;e--)this.words[e+r]=this.words[e];for(e=0;e<r;e++)this.words[e]=0;this.length+=r}return this.strip()},y.prototype.ishln=function(t){return g(0===this.negative),this.iushln(t)},y.prototype.iushrn=function(t,e,n){var r;g("number"==typeof t&&0<=t),r=e?(e-e%26)/26:0;var i=t%26,o=Math.min((t-i)/26,this.length),a=67108863^67108863>>>i<<i,s=n;if(r-=o,r=Math.max(0,r),s){for(var u=0;u<o;u++)s.words[u]=this.words[u];s.length=o}if(0===o);else if(this.length>o)for(this.length-=o,u=0;u<this.length;u++)this.words[u]=this.words[u+o];else this.words[0]=0,this.length=1;var c=0;for(u=this.length-1;0<=u&&(0!==c||r<=u);u--){var l=0|this.words[u];this.words[u]=c<<26-i|l>>>i,c=l&a}return s&&0!==c&&(s.words[s.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},y.prototype.ishrn=function(t,e,n){return g(0===this.negative),this.iushrn(t,e,n)},y.prototype.shln=function(t){return this.clone().ishln(t)},y.prototype.ushln=function(t){return this.clone().iushln(t)},y.prototype.shrn=function(t){return this.clone().ishrn(t)},y.prototype.ushrn=function(t){return this.clone().iushrn(t)},y.prototype.testn=function(t){g("number"==typeof t&&0<=t);var e=t%26,n=(t-e)/26,r=1<<e;return!(this.length<=n)&&!!(this.words[n]&r)},y.prototype.imaskn=function(t){g("number"==typeof t&&0<=t);var e=t%26,n=(t-e)/26;if(g(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!=e&&n++,this.length=Math.min(n,this.length),0!=e){var r=67108863^67108863>>>e<<e;this.words[this.length-1]&=r}return this.strip()},y.prototype.maskn=function(t){return this.clone().imaskn(t)},y.prototype.iaddn=function(t){return g("number"==typeof t),g(t<67108864),t<0?this.isubn(-t):0!==this.negative?(1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0):(this.negative=0,this.isubn(t),this.negative=1),this):this._iaddn(t)},y.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&67108864<=this.words[e];e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},y.prototype.isubn=function(t){if(g("number"==typeof t),g(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},y.prototype.addn=function(t){return this.clone().iaddn(t)},y.prototype.subn=function(t){return this.clone().isubn(t)},y.prototype.iabs=function(){return this.negative=0,this},y.prototype.abs=function(){return this.clone().iabs()},y.prototype._ishlnsubmul=function(t,e,n){var r,i,o=t.length+n;this._expand(o);var a=0;for(r=0;r<t.length;r++){i=(0|this.words[r+n])+a;var s=(0|t.words[r])*e;a=((i-=67108863&s)>>26)-(s/67108864|0),this.words[r+n]=67108863&i}for(;r<this.length-n;r++)a=(i=(0|this.words[r+n])+a)>>26,this.words[r+n]=67108863&i;if(0===a)return this.strip();for(g(-1===a),r=a=0;r<this.length;r++)a=(i=-(0|this.words[r])+a)>>26,this.words[r]=67108863&i;return this.negative=1,this.strip()},y.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,o=0|i.words[i.length-1];0!=(n=26-this._countBits(o))&&(i=i.ushln(n),r.iushln(n),o=0|i.words[i.length-1]);var a,s=r.length-i.length;if("mod"!==e){(a=new y(null)).length=1+s,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var c=r.clone()._ishlnsubmul(i,1,s);0===c.negative&&(r=c,a&&(a.words[s]=1));for(var l=s-1;0<=l;l--){var f=67108864*(0|r.words[i.length+l])+(0|r.words[i.length+l-1]);for(f=Math.min(f/o|0,67108863),r._ishlnsubmul(i,f,l);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(i,1,l),r.isZero()||(r.negative^=1);a&&(a.words[l]=f)}return a&&a.strip(),r.strip(),"div"!==e&&0!=n&&r.iushrn(n),{div:a||null,mod:r}},y.prototype.divmod=function(t,e,n){return g(!t.isZero()),this.isZero()?{div:new y(0),mod:new y(0)}:0!==this.negative&&0===t.negative?(o=this.neg().divmod(t,e),"mod"!==e&&(r=o.div.neg()),"div"!==e&&(i=o.mod.neg(),n&&0!==i.negative&&i.iadd(t)),{div:r,mod:i}):0===this.negative&&0!==t.negative?(o=this.divmod(t.neg(),e),"mod"!==e&&(r=o.div.neg()),{div:r,mod:o.mod}):0!=(this.negative&t.negative)?(o=this.neg().divmod(t.neg(),e),"div"!==e&&(i=o.mod.neg(),n&&0!==i.negative&&i.isub(t)),{div:o.div,mod:i}):t.length>this.length||this.cmp(t)<0?{div:new y(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new y(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new y(this.modn(t.words[0]))}:this._wordDiv(t,e);var r,i,o},y.prototype.div=function(t){return this.divmod(t,"div",!1).div},y.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},y.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},y.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},y.prototype.modn=function(t){g(t<=67108863);for(var e=(1<<26)%t,n=0,r=this.length-1;0<=r;r--)n=(e*n+(0|this.words[r]))%t;return n},y.prototype.idivn=function(t){g(t<=67108863);for(var e=0,n=this.length-1;0<=n;n--){var r=(0|this.words[n])+67108864*e;this.words[n]=r/t|0,e=r%t}return this.strip()},y.prototype.divn=function(t){return this.clone().idivn(t)},y.prototype.egcd=function(t){g(0===t.negative),g(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var r=new y(1),i=new y(0),o=new y(0),a=new y(1),s=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++s;for(var u=n.clone(),c=e.clone();!e.isZero();){for(var l=0,f=1;0==(e.words[0]&f)&&l<26;++l,f<<=1);if(0<l)for(e.iushrn(l);0<l--;)(r.isOdd()||i.isOdd())&&(r.iadd(u),i.isub(c)),r.iushrn(1),i.iushrn(1);for(var h=0,p=1;0==(n.words[0]&p)&&h<26;++h,p<<=1);if(0<h)for(n.iushrn(h);0<h--;)(o.isOdd()||a.isOdd())&&(o.iadd(u),a.isub(c)),o.iushrn(1),a.iushrn(1);0<=e.cmp(n)?(e.isub(n),r.isub(o),i.isub(a)):(n.isub(e),o.isub(r),a.isub(i))}return{a:o,b:a,gcd:n.iushln(s)}},y.prototype._invmp=function(t){g(0===t.negative),g(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var r,i=new y(1),o=new y(0),a=n.clone();0<e.cmpn(1)&&0<n.cmpn(1);){for(var s=0,u=1;0==(e.words[0]&u)&&s<26;++s,u<<=1);if(0<s)for(e.iushrn(s);0<s--;)i.isOdd()&&i.iadd(a),i.iushrn(1);for(var c=0,l=1;0==(n.words[0]&l)&&c<26;++c,l<<=1);if(0<c)for(n.iushrn(c);0<c--;)o.isOdd()&&o.iadd(a),o.iushrn(1);0<=e.cmp(n)?(e.isub(n),i.isub(o)):(n.isub(e),o.isub(i))}return(r=0===e.cmpn(1)?i:o).cmpn(0)<0&&r.iadd(t),r},y.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0;for(var r=n.negative=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},y.prototype.invm=function(t){return this.egcd(t).a.umod(t)},y.prototype.isEven=function(){return 0==(1&this.words[0])},y.prototype.isOdd=function(){return 1==(1&this.words[0])},y.prototype.andln=function(t){return this.words[0]&t},y.prototype.bincn=function(t){g("number"==typeof t);var e=t%26,n=(t-e)/26,r=1<<e;if(this.length<=n)return this._expand(1+n),this.words[n]|=r,this;for(var i=r,o=n;0!==i&&o<this.length;o++){var a=0|this.words[o];i=(a+=i)>>>26,a&=67108863,this.words[o]=a}return 0!==i&&(this.words[o]=i,this.length++),this},y.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},y.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),1<this.length)e=1;else{n&&(t=-t),g(t<=67108863,"Number is too big");var r=0|this.words[0];e=r===t?0:r<t?-1:1}return 0!==this.negative?0|-e:e},y.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},y.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;0<=n;n--){var r=0|this.words[n],i=0|t.words[n];if(r!=i){r<i?e=-1:i<r&&(e=1);break}}return e},y.prototype.gtn=function(t){return 1===this.cmpn(t)},y.prototype.gt=function(t){return 1===this.cmp(t)},y.prototype.gten=function(t){return 0<=this.cmpn(t)},y.prototype.gte=function(t){return 0<=this.cmp(t)},y.prototype.ltn=function(t){return-1===this.cmpn(t)},y.prototype.lt=function(t){return-1===this.cmp(t)},y.prototype.lten=function(t){return this.cmpn(t)<=0},y.prototype.lte=function(t){return this.cmp(t)<=0},y.prototype.eqn=function(t){return 0===this.cmpn(t)},y.prototype.eq=function(t){return 0===this.cmp(t)},y.red=function(t){return new _(t)},y.prototype.toRed=function(t){return g(!this.red,"Already a number in reduction context"),g(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},y.prototype.fromRed=function(){return g(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},y.prototype._forceRed=function(t){return this.red=t,this},y.prototype.forceRed=function(t){return g(!this.red,"Already a number in reduction context"),this._forceRed(t)},y.prototype.redAdd=function(t){return g(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},y.prototype.redIAdd=function(t){return g(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},y.prototype.redSub=function(t){return g(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},y.prototype.redISub=function(t){return g(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},y.prototype.redShl=function(t){return g(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},y.prototype.redMul=function(t){return g(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},y.prototype.redIMul=function(t){return g(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},y.prototype.redSqr=function(){return g(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},y.prototype.redISqr=function(){return g(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},y.prototype.redSqrt=function(){return g(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},y.prototype.redInvm=function(){return g(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},y.prototype.redNeg=function(){return g(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},y.prototype.redPow=function(t){return g(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var c={k256:null,p224:null,p192:null,p25519:null};function l(t,e){this.name=t,this.p=new y(e,16),this.n=this.p.bitLength(),this.k=new y(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function m(){l.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){l.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){l.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){l.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var e=y._prime(t);this.m=e.p,this.prime=e}else g(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function x(t){_.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new y(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}l.prototype._tmp=function(){var t=new y(null);return t.words=new Array(Math.ceil(this.n/13)),t},l.prototype.ireduce=function(t){for(var e,n=t;this.split(n,this.tmp),(e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength())>this.n;);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):0<r?n.isub(this.p):n.strip(),n},l.prototype.split=function(t,e){t.iushrn(this.n,0,e)},l.prototype.imulK=function(t){return t.imul(this.k)},n(m,l),m.prototype.split=function(t,e){for(var n=Math.min(t.length,9),r=0;r<n;r++)e.words[r]=t.words[r];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,r=10;r<t.length;r++){var o=0|t.words[r];t.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,0===(t.words[r-10]=i)&&10<t.length?t.length-=10:t.length-=9},m.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(v,l),n(b,l),n(w,l),w.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},y._prime=function(t){if(c[t])return c[t];var e;if("k256"===t)e=new m;else if("p224"===t)e=new v;else if("p192"===t)e=new b;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new w}return c[t]=e},_.prototype._verify1=function(t){g(0===t.negative,"red works only with positives"),g(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,e){g(0==(t.negative|e.negative),"red works only with positives"),g(t.red&&t.red===e.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return 0<=n.cmp(this.m)&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return 0<=n.cmp(this.m)&&n.isub(this.m),n},_.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},_.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},_.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(g(e%2==1),3===e){var n=this.m.add(new y(1)).iushrn(2);return this.pow(t,n)}for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);g(!r.isZero());var o=new y(1).toRed(this),a=o.redNeg(),s=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new y(2*u*u).toRed(this);0!==this.pow(u,s).cmp(a);)u.redIAdd(a);for(var c=this.pow(u,r),l=this.pow(t,r.addn(1).iushrn(1)),f=this.pow(t,r),h=i;0!==f.cmp(o);){for(var p=f,d=0;0!==p.cmp(o);d++)p=p.redSqr();g(d<h);var m=this.pow(c,new y(1).iushln(h-d-1));l=l.redMul(m),c=m.redSqr(),f=f.redMul(c),h=d}return l},_.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},_.prototype.pow=function(t,e){if(e.isZero())return new y(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new y(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var i=n[0],o=0,a=0,s=e.bitLength()%26;for(0===s&&(s=26),r=e.length-1;0<=r;r--){for(var u=e.words[r],c=s-1;0<=c;c--){var l=u>>c&1;i!==n[0]&&(i=this.sqr(i)),0!=l||0!==o?(o<<=1,o|=l,(4===++a||0===r&&0===c)&&(i=this.mul(i,n[o]),o=a=0)):a=0}s=26}return i},_.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},_.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},y.mont=function(t){return new x(t)},n(x,_),x.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},x.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new y(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,E(144)(t))},function(t,e,n){var r=n(32);t.exports=function(t){return Object(r(t))}},function(t,B,L){"use strict";(function(t){
/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
 * @license  MIT
 */
var r=L(446),o=L(447),a=L(190);function n(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(n()<e)throw new RangeError("Invalid typed array length");return f.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=f.prototype:(null===t&&(t=new f(e)),t.length=e),t}function f(t,e,n){if(!(f.TYPED_ARRAY_SUPPORT||this instanceof f))return new f(t,e,n);if("number"!=typeof t)return i(this,t,e,n);if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(this,t)}function i(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);f.TYPED_ARRAY_SUPPORT?(t=e).__proto__=f.prototype:t=l(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!f.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|p(e,n),i=(t=s(t,r)).write(e,n);i!==r&&(t=t.slice(0,i));return t}(t,e,n):function(t,e){if(f.isBuffer(e)){var n=0|h(e.length);return 0===(t=s(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||function(t){return t!=t}(e.length)?s(t,0):l(t,e);if("Buffer"===e.type&&a(e.data))return l(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,e){if(u(e),t=s(t,e<0?0:0|h(e)),!f.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function l(t,e){var n=e.length<0?0:0|h(e.length);t=s(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function h(t){if(t>=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|t}function p(t,e){if(f.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return R(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return D(t).length;default:if(r)return R(t).length;e=(""+e).toLowerCase(),r=!0}}function d(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function m(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):2147483647<n?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=f.from(e,r)),f.isBuffer(e))return 0===e.length?-1:g(t,e,n,r,i);if("number"==typeof e)return e&=255,f.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):g(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function g(t,e,n,r,i){var o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s/=a=2,u/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var l=-1;for(o=n;o<s;o++)if(c(t,o)===c(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*a}else-1!==l&&(o-=o-l),l=-1}else for(s<n+u&&(n=s-u),o=n;0<=o;o--){for(var f=!0,h=0;h<u;h++)if(c(t,o+h)!==c(e,h)){f=!1;break}if(f)return o}return-1}function y(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?i<(r=Number(r))&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");o/2<r&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[n+a]=s}return a}function v(t,e,n,r){return j(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function b(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function w(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,a,s,u,c=t[i],l=null,f=239<c?4:223<c?3:191<c?2:1;if(i+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=t[i+1]))&&127<(u=(31&c)<<6|63&o)&&(l=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&2047<(u=(15&c)<<12|(63&o)<<6|63&a)&&(u<55296||57343<u)&&(l=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&65535<(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)&&u<1114112&&(l=u)}null===l?(l=65533,f=1):65535<l&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=f}return function(t){var e=t.length;if(e<=_)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=_));return n}(r)}B.Buffer=f,B.SlowBuffer=function(t){+t!=t&&(t=0);return f.alloc(+t)},B.INSPECT_MAX_BYTES=50,f.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),B.kMaxLength=n(),f.poolSize=8192,f._augment=function(t){return t.__proto__=f.prototype,t},f.from=function(t,e,n){return i(null,t,e,n)},f.TYPED_ARRAY_SUPPORT&&(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&f[Symbol.species]===f&&Object.defineProperty(f,Symbol.species,{value:null,configurable:!0})),f.alloc=function(t,e,n){return function(t,e,n,r){return u(e),e<=0?s(t,e):void 0!==n?"string"==typeof r?s(t,e).fill(n,r):s(t,e).fill(n):s(t,e)}(null,t,e,n)},f.allocUnsafe=function(t){return c(null,t)},f.allocUnsafeSlow=function(t){return c(null,t)},f.isBuffer=function(t){return!(null==t||!t._isBuffer)},f.compare=function(t,e){if(!f.isBuffer(t)||!f.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},f.isEncoding=function(t){switch(String(t).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}},f.concat=function(t,e){if(!a(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return f.alloc(0);var n;if(void 0===e)for(n=e=0;n<t.length;++n)e+=t[n].length;var r=f.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var o=t[n];if(!f.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},f.byteLength=p,f.prototype._isBuffer=!0,f.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)d(this,e,e+1);return this},f.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)d(this,e,e+3),d(this,e+1,e+2);return this},f.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)d(this,e,e+7),d(this,e+1,e+6),d(this,e+2,e+5),d(this,e+3,e+4);return this},f.prototype.toString=function(){var t=0|this.length;return 0==t?"":0===arguments.length?w(this,0,t):function(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return S(this,e,n);case"utf8":case"utf-8":return w(this,e,n);case"ascii":return x(this,e,n);case"latin1":case"binary":return E(this,e,n);case"base64":return b(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}.apply(this,arguments)},f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===f.compare(this,t)},f.prototype.inspect=function(){var t="",e=B.INSPECT_MAX_BYTES;return 0<this.length&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},f.prototype.compare=function(t,e,n,r,i){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(i<=r&&n<=e)return 0;if(i<=r)return-1;if(n<=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),s=Math.min(o,a),u=this.slice(r,i),c=t.slice(e,n),l=0;l<s;++l)if(u[l]!==c[l]){o=u[l],a=c[l];break}return o<a?-1:a<o?1:0},f.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},f.prototype.indexOf=function(t,e,n){return m(this,t,e,n,!0)},f.prototype.lastIndexOf=function(t,e,n){return m(this,t,e,n,!1)},f.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||i<n)&&(n=i),0<t.length&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o,a,s,u,c,l,f,h,p,d=!1;;)switch(r){case"hex":return y(this,t,e,n);case"utf8":case"utf-8":return h=e,p=n,j(R(t,(f=this).length-h),f,h,p);case"ascii":return v(this,t,e,n);case"latin1":case"binary":return v(this,t,e,n);case"base64":return u=this,c=e,l=n,j(D(t),u,c,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a=e,s=n,j(function(t,e){for(var n,r,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)n=t.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,(o=this).length-a),o,a,s);default:if(d)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),d=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var _=4096;function x(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function E(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function S(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||r<n)&&(n=r);for(var i="",o=e;o<n;++o)i+=M(t[o]);return i}function N(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function I(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(n<t+e)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,n,r,i,o){if(!f.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(i<e||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function k(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function A(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function C(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function P(t,e,n,r,i){return i||C(t,0,n,4),o.write(t,e,n,r,23,4),n+4}function T(t,e,n,r,i){return i||C(t,0,n,8),o.write(t,e,n,r,52,8),n+8}f.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):r<t&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):r<e&&(e=r),e<t&&(e=t),f.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=f.prototype;else{var i=e-t;n=new f(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},f.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||I(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},f.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||I(t,e,this.length);for(var r=this[t+--e],i=1;0<e&&(i*=256);)r+=this[t+--e]*i;return r},f.prototype.readUInt8=function(t,e){return e||I(t,1,this.length),this[t]},f.prototype.readUInt16LE=function(t,e){return e||I(t,2,this.length),this[t]|this[t+1]<<8},f.prototype.readUInt16BE=function(t,e){return e||I(t,2,this.length),this[t]<<8|this[t+1]},f.prototype.readUInt32LE=function(t,e){return e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},f.prototype.readUInt32BE=function(t,e){return e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},f.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||I(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return(i*=128)<=r&&(r-=Math.pow(2,8*e)),r},f.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||I(t,e,this.length);for(var r=e,i=1,o=this[t+--r];0<r&&(i*=256);)o+=this[t+--r]*i;return(i*=128)<=o&&(o-=Math.pow(2,8*e)),o},f.prototype.readInt8=function(t,e){return e||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},f.prototype.readInt16LE=function(t,e){e||I(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},f.prototype.readInt16BE=function(t,e){e||I(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},f.prototype.readInt32LE=function(t,e){return e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},f.prototype.readInt32BE=function(t,e){return e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},f.prototype.readFloatLE=function(t,e){return e||I(t,4,this.length),o.read(this,t,!0,23,4)},f.prototype.readFloatBE=function(t,e){return e||I(t,4,this.length),o.read(this,t,!1,23,4)},f.prototype.readDoubleLE=function(t,e){return e||I(t,8,this.length),o.read(this,t,!0,52,8)},f.prototype.readDoubleBE=function(t,e){return e||I(t,8,this.length),o.read(this,t,!1,52,8)},f.prototype.writeUIntLE=function(t,e,n,r){t=+t,e|=0,n|=0,r||O(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},f.prototype.writeUIntBE=function(t,e,n,r){t=+t,e|=0,n|=0,r||O(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;0<=--i&&(o*=256);)this[e+i]=t/o&255;return e+n},f.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,1,255,0),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},f.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):k(this,t,e,!0),e+2},f.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):k(this,t,e,!1),e+2},f.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):A(this,t,e,!0),e+4},f.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):A(this,t,e,!1),e+4},f.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);O(this,t,e,n,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<n&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},f.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);O(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;0<=--o&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},f.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,1,127,-128),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},f.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):k(this,t,e,!0),e+2},f.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):k(this,t,e,!1),e+2},f.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):A(this,t,e,!0),e+4},f.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):A(this,t,e,!1),e+4},f.prototype.writeFloatLE=function(t,e,n){return P(this,t,e,!0,n)},f.prototype.writeFloatBE=function(t,e,n){return P(this,t,e,!1,n)},f.prototype.writeDoubleLE=function(t,e,n){return T(this,t,e,!0,n)},f.prototype.writeDoubleBE=function(t,e,n){return T(this,t,e,!1,n)},f.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),0<r&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;0<=i;--i)t[i+e]=this[i+n];else if(o<1e3||!f.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},f.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!f.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var a=f.isBuffer(t)?t:R(new f(t,r).toString()),s=a.length;for(o=0;o<n-e;++o)this[o+e]=a[o%s]}return this};var e=/[^+\/0-9A-Za-z-_]/g;function M(t){return t<16?"0"+t.toString(16):t.toString(16)}function R(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],a=0;a<r;++a){if(55295<(n=t.charCodeAt(a))&&n<57344){if(!i){if(56319<n){-1<(e-=3)&&o.push(239,191,189);continue}if(a+1===r){-1<(e-=3)&&o.push(239,191,189);continue}i=n;continue}if(n<56320){-1<(e-=3)&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&-1<(e-=3)&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function D(t){return r.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(e,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function j(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}}).call(this,L(15))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){"use strict";var r=e;r.version=n(488).version,r.utils=n(489),r.rand=n(213),r.curve=n(94),r.curves=n(494),r.ec=n(502),r.eddsa=n(506)},function(t,e,n){var r=n(11),i=n(45);t.exports=n(10)?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var o=n(5),a=n(18),s=n(21),u=n(46)("src"),r=n(246),c=(""+r).split("toString");n(26).inspectSource=function(t){return r.call(t)},(t.exports=function(t,e,n,r){var i="function"==typeof n;i&&(s(n,"name")||a(n,"name",e)),t[e]!==n&&(i&&(s(n,u)||a(n,u,t[e]?""+t[e]:c.join(String(e)))),t===o?t[e]=n:r?t[e]?t[e]=n:a(t,e,n):(delete t[e],a(t,e,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[u]||r.call(this)})},function(t,e,n){function r(t,e,n,r){var i=String(a(t)),o="<"+e;return""!==n&&(o+=" "+n+'="'+String(r).replace(s,"&quot;")+'"'),o+">"+i+"</"+e+">"}var i=n(1),o=n(6),a=n(32),s=/"/g;t.exports=function(e,t){var n={};n[e]=t(r),i(i.P+i.F*o(function(){var t=""[e]('"');return t!==t.toLowerCase()||3<t.split('"').length}),"String",n)}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r=n(65),i=n(32);t.exports=function(t){return r(i(t))}},function(t,e,n){var r=n(66),i=n(45),o=n(22),a=n(31),s=n(21),u=n(153),c=Object.getOwnPropertyDescriptor;e.f=n(10)?c:function(t,e){if(t=o(t),e=a(e,!0),u)try{return c(t,e)}catch(t){}if(s(t,e))return i(!r.f.call(t,e),t[e])}},function(t,e,n){var r=n(21),i=n(13),o=n(108)("IE_PROTO"),a=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),r(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?a:null}},function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}(t.exports=n).equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)}},function(t,e){var n=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=n)},function(t,e,n){var o=n(16);t.exports=function(r,i,t){if(o(r),void 0===i)return r;switch(t){case 1:return function(t){return r.call(i,t)};case 2:return function(t,e){return r.call(i,t,e)};case 3:return function(t,e,n){return r.call(i,t,e,n)}}return function(){return r.apply(i,arguments)}}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(0<t?r:n)(t)}},function(t,e,n){"use strict";var r=n(6);t.exports=function(t,e){return!!t&&r(function(){e?t.call(null,function(){},1):t.call(null)})}},function(t,e,n){var i=n(7);t.exports=function(t,e){if(!i(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!i(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!i(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!i(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on  "+t);return t}},function(t,e,n){var i=n(1),o=n(26),a=n(6);t.exports=function(t,e){var n=(o.Object||{})[t]||Object[t],r={};r[t]=e(n),i(i.S+i.F*a(function(){n(1)}),"Object",r)}},function(t,e,n){var b=n(27),w=n(65),_=n(13),x=n(9),r=n(124);t.exports=function(f,t){var h=1==f,p=2==f,d=3==f,m=4==f,g=6==f,y=5==f||g,v=t||r;return function(t,e,n){for(var r,i,o=_(t),a=w(o),s=b(e,n,3),u=x(a.length),c=0,l=h?v(t,u):p?v(t,0):void 0;c<u;c++)if((y||c in a)&&(i=s(r=a[c],c,o),f))if(h)l[c]=i;else if(i)switch(f){case 3:return!0;case 5:return r;case 6:return c;case 2:l.push(r)}else if(m)return!1;return g?-1:d||m?m:l}}},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var u,c=[],l=!1,f=-1;function h(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&p())}function p(){if(!l){var t=s(h);l=!0;for(var e=c.length;e;){for(u=c,c=[];++f<e;)u&&u[f].run();f=-1,e=c.length}u=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new d(t,e)),1!==c.length||l||s(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){"use strict";var c=n(25),r=n(3);function o(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function i(t){return 1===t.length?"0"+t:t}function a(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=r,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n,r,i=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),a=0;a<t.length;a+=2)i.push(parseInt(t[a]+t[a+1],16))}else for(var o=0,a=0;a<t.length;a++){var s=t.charCodeAt(a);s<128?i[o++]=s:(s<2048?i[o++]=s>>6|192:(r=a,55296!=(64512&(n=t).charCodeAt(r))||r<0||r+1>=n.length||56320!=(64512&n.charCodeAt(r+1))?i[o++]=s>>12|224:(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++a)),i[o++]=s>>18|240,i[o++]=s>>12&63|128),i[o++]=s>>6&63|128),i[o++]=63&s|128)}else for(a=0;a<t.length;a++)i[a]=0|t[a];return i},e.toHex=function(t){for(var e="",n=0;n<t.length;n++)e+=i(t[n].toString(16));return e},e.htonl=o,e.toHex32=function(t,e){for(var n="",r=0;r<t.length;r++){var i=t[r];"little"===e&&(i=o(i)),n+=a(i.toString(16))}return n},e.zero2=i,e.zero8=a,e.join32=function(t,e,n,r){var i=n-e;c(i%4==0);for(var o=new Array(i/4),a=0,s=e;a<o.length;a++,s+=4){var u;u="big"===r?t[s]<<24|t[s+1]<<16|t[s+2]<<8|t[s+3]:t[s+3]<<24|t[s+2]<<16|t[s+1]<<8|t[s],o[a]=u>>>0}return o},e.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4){var o=t[r];"big"===e?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<<e|t>>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,n){return t+e+n>>>0},e.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},e.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},e.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o<r?1:0)+n+i;t[e]=a>>>0,t[e+1]=o},e.sum64_hi=function(t,e,n,r){return(e+r>>>0<e?1:0)+t+n>>>0},e.sum64_lo=function(t,e,n,r){return e+r>>>0},e.sum64_4_hi=function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)<e?1:0,u+=(c=c+o>>>0)<o?1:0,t+n+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},e.sum64_4_lo=function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},e.sum64_5_hi=function(t,e,n,r,i,o,a,s,u,c){var l=0,f=e;return l+=(f=f+r>>>0)<e?1:0,l+=(f=f+o>>>0)<o?1:0,l+=(f=f+s>>>0)<s?1:0,t+n+i+a+u+(l+=(f=f+c>>>0)<c?1:0)>>>0},e.sum64_5_lo=function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},e.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},e.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},e.shr64_hi=function(t,e,n){return t>>>n},e.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0}},function(t,e,n){"use strict";if(n(10)){var y=n(40),v=n(5),b=n(6),w=n(1),_=n(87),r=n(132),h=n(27),x=n(52),i=n(45),E=n(18),o=n(54),a=n(29),S=n(9),N=n(181),s=n(48),u=n(31),c=n(21),I=n(58),O=n(7),p=n(13),d=n(121),k=n(49),A=n(24),C=n(50).f,m=n(123),l=n(46),f=n(8),g=n(34),P=n(77),T=n(68),M=n(126),R=n(60),D=n(82),j=n(51),B=n(125),L=n(170),F=n(11),z=n(23),U=F.f,V=z.f,W=v.RangeError,q=v.TypeError,H=v.Uint8Array,$="ArrayBuffer",G="Shared"+$,K="BYTES_PER_ELEMENT",X="prototype",Y=Array[X],Z=r.ArrayBuffer,J=r.DataView,Q=g(0),tt=g(2),et=g(3),nt=g(4),rt=g(5),it=g(6),ot=P(!0),at=P(!1),st=M.values,ut=M.keys,ct=M.entries,lt=Y.lastIndexOf,ft=Y.reduce,ht=Y.reduceRight,pt=Y.join,dt=Y.sort,mt=Y.slice,gt=Y.toString,yt=Y.toLocaleString,vt=f("iterator"),bt=f("toStringTag"),wt=l("typed_constructor"),_t=l("def_constructor"),xt=_.CONSTR,Et=_.TYPED,St=_.VIEW,Nt="Wrong length!",It=g(1,function(t,e){return Pt(T(t,t[_t]),e)}),Ot=b(function(){return 1===new H(new Uint16Array([1]).buffer)[0]}),kt=!!H&&!!H[X].set&&b(function(){new H(1).set({})}),At=function(t,e){var n=a(t);if(n<0||n%e)throw W("Wrong offset!");return n},Ct=function(t){if(O(t)&&Et in t)return t;throw q(t+" is not a typed array!")},Pt=function(t,e){if(!(O(t)&&wt in t))throw q("It is not a typed array constructor!");return new t(e)},Tt=function(t,e){return Mt(T(t,t[_t]),e)},Mt=function(t,e){for(var n=0,r=e.length,i=Pt(t,r);n<r;)i[n]=e[n++];return i},Rt=function(t,e,n){U(t,e,{get:function(){return this._d[n]}})},Dt=function(t){var e,n,r,i,o,a,s=p(t),u=arguments.length,c=1<u?arguments[1]:void 0,l=void 0!==c,f=m(s);if(null!=f&&!d(f)){for(a=f.call(s),r=[],e=0;!(o=a.next()).done;e++)r.push(o.value);s=r}for(l&&2<u&&(c=h(c,arguments[2],2)),e=0,n=S(s.length),i=Pt(this,n);e<n;e++)i[e]=l?c(s[e],e):s[e];return i},jt=function(){for(var t=0,e=arguments.length,n=Pt(this,e);t<e;)n[t]=arguments[t++];return n},Bt=!!H&&b(function(){yt.call(new H(1))}),Lt=function(){return yt.apply(Bt?mt.call(Ct(this)):Ct(this),arguments)},Ft={copyWithin:function(t,e){return L.call(Ct(this),t,e,2<arguments.length?arguments[2]:void 0)},every:function(t){return nt(Ct(this),t,1<arguments.length?arguments[1]:void 0)},fill:function(t){return B.apply(Ct(this),arguments)},filter:function(t){return Tt(this,tt(Ct(this),t,1<arguments.length?arguments[1]:void 0))},find:function(t){return rt(Ct(this),t,1<arguments.length?arguments[1]:void 0)},findIndex:function(t){return it(Ct(this),t,1<arguments.length?arguments[1]:void 0)},forEach:function(t){Q(Ct(this),t,1<arguments.length?arguments[1]:void 0)},indexOf:function(t){return at(Ct(this),t,1<arguments.length?arguments[1]:void 0)},includes:function(t){return ot(Ct(this),t,1<arguments.length?arguments[1]:void 0)},join:function(t){return pt.apply(Ct(this),arguments)},lastIndexOf:function(t){return lt.apply(Ct(this),arguments)},map:function(t){return It(Ct(this),t,1<arguments.length?arguments[1]:void 0)},reduce:function(t){return ft.apply(Ct(this),arguments)},reduceRight:function(t){return ht.apply(Ct(this),arguments)},reverse:function(){for(var t,e=Ct(this).length,n=Math.floor(e/2),r=0;r<n;)t=this[r],this[r++]=this[--e],this[e]=t;return this},some:function(t){return et(Ct(this),t,1<arguments.length?arguments[1]:void 0)},sort:function(t){return dt.call(Ct(this),t)},subarray:function(t,e){var n=Ct(this),r=n.length,i=s(t,r);return new(T(n,n[_t]))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,S((void 0===e?r:s(e,r))-i))}},zt=function(t,e){return Tt(this,mt.call(Ct(this),t,e))},Ut=function(t){Ct(this);var e=At(arguments[1],1),n=this.length,r=p(t),i=S(r.length),o=0;if(n<i+e)throw W(Nt);for(;o<i;)this[e+o]=r[o++]},Vt={entries:function(){return ct.call(Ct(this))},keys:function(){return ut.call(Ct(this))},values:function(){return st.call(Ct(this))}},Wt=function(t,e){return O(t)&&t[Et]&&"symbol"!=typeof e&&e in t&&String(+e)==String(e)},qt=function(t,e){return Wt(t,e=u(e,!0))?i(2,t[e]):V(t,e)},Ht=function(t,e,n){return!(Wt(t,e=u(e,!0))&&O(n)&&c(n,"value"))||c(n,"get")||c(n,"set")||n.configurable||c(n,"writable")&&!n.writable||c(n,"enumerable")&&!n.enumerable?U(t,e,n):(t[e]=n.value,t)};xt||(z.f=qt,F.f=Ht),w(w.S+w.F*!xt,"Object",{getOwnPropertyDescriptor:qt,defineProperty:Ht}),b(function(){gt.call({})})&&(gt=yt=function(){return pt.call(this)});var $t=o({},Ft);o($t,Vt),E($t,vt,Vt.values),o($t,{slice:zt,set:Ut,constructor:function(){},toString:gt,toLocaleString:Lt}),Rt($t,"buffer","b"),Rt($t,"byteOffset","o"),Rt($t,"byteLength","l"),Rt($t,"length","e"),U($t,bt,{get:function(){return this[Et]}}),t.exports=function(t,f,e,i){function h(t,e){U(t,e,{get:function(){return function(t,e){var n=t._d;return n.v[r](e*f+n.o,Ot)}(this,e)},set:function(t){return function(t,e,n){var r=t._d;i&&(n=(n=Math.round(n))<0?0:255<n?255:255&n),r.v[o](e*f+r.o,n,Ot)}(this,e,t)},enumerable:!0})}var p=t+((i=!!i)?"Clamped":"")+"Array",r="get"+t,o="set"+t,d=v[p],a=d||{},n=d&&A(d),s=!d||!_.ABV,u={},c=d&&d[X];s?(d=e(function(t,e,n,r){x(t,d,p,"_d");var i,o,a,s,u=0,c=0;if(O(e)){if(!(e instanceof Z||(s=I(e))==$||s==G))return Et in e?Mt(d,e):Dt.call(d,e);i=e,c=At(n,f);var l=e.byteLength;if(void 0===r){if(l%f)throw W(Nt);if((o=l-c)<0)throw W(Nt)}else if(l<(o=S(r)*f)+c)throw W(Nt);a=o/f}else a=N(e),i=new Z(o=a*f);for(E(t,"_d",{b:i,o:c,l:o,e:a,v:new J(i)});u<a;)h(t,u++)}),c=d[X]=k($t),E(c,"constructor",d)):b(function(){d(1)})&&b(function(){new d(-1)})&&D(function(t){new d,new d(null),new d(1.5),new d(t)},!0)||(d=e(function(t,e,n,r){var i;return x(t,d,p),O(e)?e instanceof Z||(i=I(e))==$||i==G?void 0!==r?new a(e,At(n,f),r):void 0!==n?new a(e,At(n,f)):new a(e):Et in e?Mt(d,e):Dt.call(d,e):new a(N(e))}),Q(n!==Function.prototype?C(a).concat(C(n)):C(a),function(t){t in d||E(d,t,a[t])}),d[X]=c,y||(c.constructor=d));var l=c[vt],m=!!l&&("values"==l.name||null==l.name),g=Vt.values;E(d,wt,!0),E(c,Et,p),E(c,St,!0),E(c,_t,d),(i?new d(1)[bt]==p:bt in c)||U(c,bt,{get:function(){return p}}),u[p]=d,w(w.G+w.W+w.F*(d!=a),u),w(w.S,p,{BYTES_PER_ELEMENT:f}),w(w.S+w.F*b(function(){a.of.call(d,1)}),p,{from:Dt,of:jt}),K in c||E(c,K,f),w(w.P,p,Ft),j(p),w(w.P+w.F*kt,p,{set:Ut}),w(w.P+w.F*!m,p,Vt),y||c.toString==gt||(c.toString=gt),w(w.P+w.F*b(function(){new d(1).slice()}),p,{slice:zt}),w(w.P+w.F*(b(function(){return[1,2].toLocaleString()!=new d([1,2]).toLocaleString()})||!b(function(){c.toLocaleString.call([1,2])})),p,{toLocaleString:Lt}),R[p]=m?l:g,y||m||E(c,vt,g)}}else t.exports=function(){}},function(t,e,n){function i(t,e,n){var r=s.get(t);if(!r){if(!n)return;s.set(t,r=new o)}var i=r.get(e);if(!i){if(!n)return;r.set(e,i=new o)}return i}var o=n(176),r=n(1),a=n(64)("metadata"),s=a.store||(a.store=new(n(179)));t.exports={store:s,map:i,has:function(t,e,n){var r=i(e,n,!1);return void 0!==r&&r.has(t)},get:function(t,e,n){var r=i(e,n,!1);return void 0===r?void 0:r.get(t)},set:function(t,e,n,r){i(n,r,!0).set(t,e)},keys:function(t,e){var n=i(t,e,!1),r=[];return n&&n.forEach(function(t,e){r.push(e)}),r},key:function(t){return void 0===t||"symbol"==typeof t?t:String(t)},exp:function(t){r(r.S,"Reflect",t)}}},function(t,e,n){var r=n(230),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();t.exports=o},function(t,e){t.exports=!1},function(t,e,n){function r(t){s(t,i,{value:{i:"O"+ ++u,w:{}}})}var i=n(46)("meta"),o=n(7),a=n(21),s=n(11).f,u=0,c=Object.isExtensible||function(){return!0},l=!n(6)(function(){return c(Object.preventExtensions({}))}),f=t.exports={KEY:i,NEED:!1,fastKey:function(t,e){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!a(t,i)){if(!c(t))return"F";if(!e)return"E";r(t)}return t[i].i},getWeak:function(t,e){if(!a(t,i)){if(!c(t))return!0;if(!e)return!1;r(t)}return t[i].w},onFreeze:function(t){return l&&f.NEED&&c(t)&&!a(t,i)&&r(t),t}}},function(t,e,n){var r=n(8)("unscopables"),i=Array.prototype;null==i[r]&&n(18)(i,r,{}),t.exports=function(t){i[r][t]=!0}},function(t,e,n){var i=n(4).Buffer,r=n(134).Transform,o=n(138).StringDecoder;function a(t){r.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}n(3)(a,r),a.prototype.update=function(t,e,n){"string"==typeof t&&(t=i.from(t,e));var r=this._update(t);return this.hashMode?this:(n&&(r=this._toString(r,n)),r)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(t,e,n){var r;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){r=t}finally{n(r)}},a.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},a.prototype._finalOrDigest=function(t){var e=this.__final()||i.alloc(0);return t&&(e=this._toString(e,t,!0)),e},a.prototype._toString=function(t,e,n){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var r=this._decoder.write(t);return n&&(r+=this._decoder.end()),r},t.exports=a},function(t,e){var n=Array.isArray;t.exports=n},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e,n){var r=n(155),i=n(109);t.exports=Object.keys||function(t){return r(t,i)}},function(t,e,n){var r=n(29),i=Math.max,o=Math.min;t.exports=function(t,e){return(t=r(t))<0?i(t+e,0):o(t,e)}},function(t,e,r){function i(){}var o=r(2),a=r(156),s=r(109),u=r(108)("IE_PROTO"),c="prototype",l=function(){var t,e=r(106)("iframe"),n=s.length;for(e.style.display="none",r(110).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),l=t.F;n--;)delete l[c][s[n]];return l()};t.exports=Object.create||function(t,e){var n;return null!==t?(i[c]=o(t),n=new i,i[c]=null,n[u]=t):n=l(),void 0===e?n:a(n,e)}},function(t,e,n){var r=n(155),i=n(109).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},function(t,e,n){"use strict";var r=n(5),i=n(11),o=n(10),a=n(8)("species");t.exports=function(t){var e=r[t];o&&e&&!e[a]&&i.f(e,a,{configurable:!0,get:function(){return this}})}},function(t,e){t.exports=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}},function(t,e,n){var h=n(27),p=n(168),d=n(121),m=n(2),g=n(9),y=n(123),v={},b={};(e=t.exports=function(t,e,n,r,i){var o,a,s,u,c=i?function(){return t}:y(t),l=h(n,r,e?2:1),f=0;if("function"!=typeof c)throw TypeError(t+" is not iterable!");if(d(c)){for(o=g(t.length);f<o;f++)if((u=e?l(m(a=t[f])[0],a[1]):l(t[f]))===v||u===b)return u}else for(s=c.call(t);!(a=s.next()).done;)if((u=p(s,l,a.value,e))===v||u===b)return u}).BREAK=v,e.RETURN=b},function(t,e,n){var i=n(19);t.exports=function(t,e,n){for(var r in e)i(t,r,e[r],n);return t}},function(t,e,n){var r=n(7);t.exports=function(t,e){if(!r(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}},function(t,e,n){"use strict";var r=n(91),i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=f;var o=n(70);o.inherits=n(3);var a=n(193),s=n(137);o.inherits(f,a);for(var u=i(s.prototype),c=0;c<u.length;c++){var l=u[c];f.prototype[l]||(f.prototype[l]=s.prototype[l])}function f(t){if(!(this instanceof f))return new f(t);a.call(this,t),s.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",h)}function h(){this.allowHalfOpen||this._writableState.ended||r.nextTick(p,this)}function p(t){t.end()}Object.defineProperty(f.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(f.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),f.prototype._destroy=function(t,e){this.push(null),this.end(),r.nextTick(e,t)}},function(t,e,n){var r=n(11).f,i=n(21),o=n(8)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,o)&&r(t,o,{configurable:!0,value:e})}},function(t,e,n){var i=n(28),o=n(8)("toStringTag"),a="Arguments"==i(function(){return arguments}());t.exports=function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),o))?n:a?i(e):"Object"==(r=i(e))&&"function"==typeof e.callee?"Arguments":r}},function(t,e,n){function r(t,e,n){var r={},i=s(function(){return!!u[t]()||"‚Äã¬Ö"!="‚Äã¬Ö"[t]()}),o=r[t]=i?e(f):u[t];n&&(r[n]=o),a(a.P+a.F*i,"String",r)}var a=n(1),i=n(32),s=n(6),u=n(112),o="["+u+"]",c=RegExp("^"+o+o+"*"),l=RegExp(o+o+"*$"),f=r.trim=function(t,e){return t=String(i(t)),1&e&&(t=t.replace(c,"")),2&e&&(t=t.replace(l,"")),t};t.exports=r},function(t,e){t.exports={}},function(e,t,n){"use strict";(function(t,i){var o=n(4).Buffer,a=t.crypto||t.msCrypto;a&&a.getRandomValues?e.exports=function(t,e){if(4294967295<t)throw new RangeError("requested too many random bytes");var n=o.allocUnsafe(t);if(0<t)if(65536<t)for(var r=0;r<t;r+=65536)a.getRandomValues(n.slice(r,r+65536));else a.getRandomValues(n);return"function"!=typeof e?n:i.nextTick(function(){e(null,n)})}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,n(15),n(35))},function(t,e,n){var l=n(4).Buffer;function r(t,e){this._block=l.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}r.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=l.from(t,e));for(var n=this._block,r=this._blockSize,i=t.length,o=this._len,a=0;a<i;){for(var s=o%r,u=Math.min(i-a,r-s),c=0;c<u;c++)n[s+c]=t[a+c];a+=u,(o+=u)%r==0&&this._update(n)}return this._len+=i,this},r.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,1+e),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},r.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=r},function(t,e,n){var r=n(545),i=n(550);t.exports=function(t,e){var n=i(t,e);return r(n)?n:void 0}},function(t,e,n){var r=n(26),i=n(5),o="__core-js_shared__",a=i[o]||(i[o]={});(t.exports=function(t,e){return a[t]||(a[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(40)?"pure":"global",copyright:"¬© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e,n){var r=n(28);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,n){"use strict";var r=n(2);t.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},function(t,e,n){var i=n(2),o=n(16),a=n(8)("species");t.exports=function(t,e){var n,r=i(t).constructor;return void 0===r||null==(n=i(r)[a])?e:o(n)}},function(t,e,n){"use strict";var r=n(3),i=n(133),o=n(139),a=n(140),s=n(43);function u(t){s.call(this,"digest"),this._hash=t}r(u,s),u.prototype._update=function(t){this._hash.update(t)},u.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new i:"rmd160"===t||"ripemd160"===t?new o:new u(a(t))}},function(t,n,e){(function(t){function e(t){return Object.prototype.toString.call(t)}n.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===e(t)},n.isBoolean=function(t){return"boolean"==typeof t},n.isNull=function(t){return null===t},n.isNullOrUndefined=function(t){return null==t},n.isNumber=function(t){return"number"==typeof t},n.isString=function(t){return"string"==typeof t},n.isSymbol=function(t){return"symbol"==typeof t},n.isUndefined=function(t){return void 0===t},n.isRegExp=function(t){return"[object RegExp]"===e(t)},n.isObject=function(t){return"object"==typeof t&&null!==t},n.isDate=function(t){return"[object Date]"===e(t)},n.isError=function(t){return"[object Error]"===e(t)||t instanceof Error},n.isFunction=function(t){return"function"==typeof t},n.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},n.isBuffer=t.isBuffer}).call(this,e(14).Buffer)},function(t,e,n){(function(o){t.exports=function(t,e){for(var n=Math.min(t.length,e.length),r=new o(n),i=0;i<n;++i)r[i]=t[i]^e[i];return r}}).call(this,n(14).Buffer)},function(t,e,n){"use strict";var i=n(36),r=n(25);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}(e.BlockHash=o).prototype.update=function(t,e){if(t=i.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-n,this.endian);for(var r=0;r<t.length;r+=this._delta32)this._update(t,r,r+this._delta32)}return this},o.prototype.digest=function(t){return this.update(this._pad()),r(null===this.pending),this._digest(t)},o.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,n=e-(t+this.padLength)%e,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=t>>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r}},function(t,e,n){var r=e;r.bignum=n(12),r.define=n(510).define,r.base=n(74),r.constants=n(219),r.decoders=n(516),r.encoders=n(518)},function(t,e,n){var r=e;r.Reporter=n(513).Reporter,r.DecoderBuffer=n(218).DecoderBuffer,r.EncoderBuffer=n(218).EncoderBuffer,r.Node=n(514)},function(t,e,n){var r=n(98),i=n(546),o=n(547),a=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":a&&a in Object(t)?i(t):o(t)}},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e,n){var u=n(22),c=n(9),l=n(48);t.exports=function(s){return function(t,e,n){var r,i=u(t),o=c(i.length),a=l(n,o);if(s&&e!=e){for(;a<o;)if((r=i[a++])!=r)return!0}else for(;a<o;a++)if((s||a in i)&&i[a]===e)return s||a||0;return!s&&-1}}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,n){var r=n(28);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,n){var u=n(29),c=n(32);t.exports=function(s){return function(t,e){var n,r,i=String(c(t)),o=u(e),a=i.length;return o<0||a<=o?s?"":void 0:(n=i.charCodeAt(o))<55296||56319<n||o+1===a||(r=i.charCodeAt(o+1))<56320||57343<r?s?i.charAt(o):n:s?i.slice(o,o+2):r-56320+(n-55296<<10)+65536}}},function(t,e,n){var r=n(7),i=n(28),o=n(8)("match");t.exports=function(t){var e;return r(t)&&(void 0!==(e=t[o])?!!e:"RegExp"==i(t))}},function(t,e,n){var o=n(8)("iterator"),a=!1;try{var r=[7][o]();r.return=function(){a=!0},Array.from(r,function(){throw 2})}catch(t){}t.exports=function(t,e){if(!e&&!a)return!1;var n=!1;try{var r=[7],i=r[o]();i.next=function(){return{done:n=!0}},r[o]=function(){return i},t(r)}catch(t){}return n}},function(t,e,n){"use strict";var i=n(58),o=RegExp.prototype.exec;t.exports=function(t,e){var n=t.exec;if("function"==typeof n){var r=n.call(t,e);if("object"!=typeof r)throw new TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==i(t))throw new TypeError("RegExp#exec called on incompatible receiver");return o.call(t,e)}},function(t,e,n){"use strict";n(172);var l=n(19),f=n(18),h=n(6),p=n(32),d=n(8),m=n(127),g=d("species"),y=!h(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),v=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2===n.length&&"a"===n[0]&&"b"===n[1]}();t.exports=function(n,t,e){var r=d(n),o=!h(function(){var t={};return t[r]=function(){return 7},7!=""[n](t)}),i=o?!h(function(){var t=!1,e=/a/;return e.exec=function(){return t=!0,null},"split"===n&&(e.constructor={},e.constructor[g]=function(){return e}),e[r](""),!t}):void 0;if(!o||!i||"replace"===n&&!y||"split"===n&&!v){var a=/./[r],s=e(p,r,""[n],function(t,e,n,r,i){return e.exec===m?o&&!i?{done:!0,value:a.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}}),u=s[0],c=s[1];l(String.prototype,n,u),f(RegExp.prototype,r,2==t?function(t,e){return c.call(t,this,e)}:function(t){return c.call(t,this)})}}},function(t,e,n){var r=n(5).navigator;t.exports=r&&r.userAgent||""},function(t,e,n){"use strict";var y=n(5),v=n(1),b=n(19),w=n(54),_=n(41),x=n(53),E=n(52),S=n(7),N=n(6),I=n(82),O=n(57),k=n(113);t.exports=function(r,t,e,n,i,o){function a(t){var n=l[t];b(l,t,"delete"==t?function(t){return!(o&&!S(t))&&n.call(this,0===t?0:t)}:"has"==t?function(t){return!(o&&!S(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return o&&!S(t)?void 0:n.call(this,0===t?0:t)}:"add"==t?function(t){return n.call(this,0===t?0:t),this}:function(t,e){return n.call(this,0===t?0:t,e),this})}var s=y[r],u=s,c=i?"set":"add",l=u&&u.prototype,f={};if("function"==typeof u&&(o||l.forEach&&!N(function(){(new u).entries().next()}))){var h=new u,p=h[c](o?{}:-0,1)!=h,d=N(function(){h.has(1)}),m=I(function(t){new u(t)}),g=!o&&N(function(){for(var t=new u,e=5;e--;)t[c](e,e);return!t.has(-0)});m||(((u=t(function(t,e){E(t,u,r);var n=k(new s,t,u);return null!=e&&x(e,i,n[c],n),n})).prototype=l).constructor=u),(d||g)&&(a("delete"),a("has"),i&&a("get")),(g||p)&&a(c),o&&l.clear&&delete l.clear}else u=n.getConstructor(t,r,i,c),w(u.prototype,e),_.NEED=!0;return O(u,r),f[r]=u,v(v.G+v.W+v.F*(u!=s),f),o||n.setStrong(u,r,i),u}},function(t,e,n){for(var r,i=n(5),o=n(18),a=n(46),s=a("typed_array"),u=a("view"),c=!(!i.ArrayBuffer||!i.DataView),l=c,f=0,h="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");f<9;)(r=i[h[f++]])?(o(r.prototype,s,!0),o(r.prototype,u,!0)):l=!1;t.exports={ABV:c,CONSTR:l,TYPED:s,VIEW:u}},function(t,e,n){"use strict";t.exports=n(40)||!n(6)(function(){var t=Math.random();__defineSetter__.call(null,t,function(){}),delete n(5)[t]})},function(t,e,n){"use strict";var r=n(1);t.exports=function(t){r(r.S,t,{of:function(){for(var t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return new this(e)}})}},function(t,e,n){"use strict";var r=n(1),a=n(16),s=n(27),u=n(53);t.exports=function(t){r(r.S,t,{from:function(t){var e,n,r,i,o=arguments[1];return a(this),(e=void 0!==o)&&a(o),null==t?new this:(n=[],e?(r=0,i=s(o,arguments[2],2),u(t,!1,function(t){n.push(i(t,r++))})):u(t,!1,n.push,n),new this(n))}})}},function(t,e,n){"use strict";(function(s){!s.version||0===s.version.indexOf("v0.")||0===s.version.indexOf("v1.")&&0!==s.version.indexOf("v1.8.")?t.exports={nextTick:function(t,e,n,r){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var i,o,a=arguments.length;switch(a){case 0:case 1:return s.nextTick(t);case 2:return s.nextTick(function(){t.call(null,e)});case 3:return s.nextTick(function(){t.call(null,e,n)});case 4:return s.nextTick(function(){t.call(null,e,n,r)});default:for(i=new Array(a-1),o=0;o<i.length;)i[o++]=arguments[o];return s.nextTick(function(){t.apply(null,i)})}}}:t.exports=s}).call(this,n(35))},function(t,e,n){var i=n(4).Buffer;function o(t){i.isBuffer(t)||(t=i.from(t));for(var e=t.length/4|0,n=new Array(e),r=0;r<e;r++)n[r]=t.readUInt32BE(4*r);return n}function r(t){for(;0<t.length;t++)t[0]=0}function a(t,e,n,r,i){for(var o,a,s,u,c=n[0],l=n[1],f=n[2],h=n[3],p=t[0]^e[0],d=t[1]^e[1],m=t[2]^e[2],g=t[3]^e[3],y=4,v=1;v<i;v++)o=c[p>>>24]^l[d>>>16&255]^f[m>>>8&255]^h[255&g]^e[y++],a=c[d>>>24]^l[m>>>16&255]^f[g>>>8&255]^h[255&p]^e[y++],s=c[m>>>24]^l[g>>>16&255]^f[p>>>8&255]^h[255&d]^e[y++],u=c[g>>>24]^l[p>>>16&255]^f[d>>>8&255]^h[255&m]^e[y++],p=o,d=a,m=s,g=u;return o=(r[p>>>24]<<24|r[d>>>16&255]<<16|r[m>>>8&255]<<8|r[255&g])^e[y++],a=(r[d>>>24]<<24|r[m>>>16&255]<<16|r[g>>>8&255]<<8|r[255&p])^e[y++],s=(r[m>>>24]<<24|r[g>>>16&255]<<16|r[p>>>8&255]<<8|r[255&d])^e[y++],u=(r[g>>>24]<<24|r[p>>>16&255]<<16|r[d>>>8&255]<<8|r[255&m])^e[y++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var f=[0,1,2,4,8,16,32,64,128,27,54],h=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var c=s^s<<1^s<<2^s<<3^s<<4;c=c>>>8^255&c^99;var l=t[r[n[a]=c]=a],f=t[l],h=t[f],p=257*t[c]^16843008*c;i[0][a]=p<<24|p>>>8,i[1][a]=p<<16|p>>>16,i[2][a]=p<<8|p>>>24,i[3][a]=p,p=16843009*h^65537*f^257*l^16843008*a,o[0][c]=p<<24|p>>>8,o[1][c]=p<<16|p>>>16,o[2][c]=p<<8|p>>>24,o[3][c]=p,0===a?a=s=1:(a=l^t[t[t[h^l]]],s^=t[t[s]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function s(t){this._key=o(t),this._reset()}s.blockSize=16,s.keySize=32,s.prototype.blockSize=s.blockSize,s.prototype.keySize=s.keySize,s.prototype._reset=function(){for(var t=this._key,e=t.length,n=e+6,r=4*(n+1),i=[],o=0;o<e;o++)i[o]=t[o];for(o=e;o<r;o++){var a=i[o-1];o%e==0?(a=a<<8|a>>>24,a=h.SBOX[a>>>24]<<24|h.SBOX[a>>>16&255]<<16|h.SBOX[a>>>8&255]<<8|h.SBOX[255&a],a^=f[o/e|0]<<24):6<e&&o%e==4&&(a=h.SBOX[a>>>24]<<24|h.SBOX[a>>>16&255]<<16|h.SBOX[a>>>8&255]<<8|h.SBOX[255&a]),i[o]=i[o-e]^a}for(var s=[],u=0;u<r;u++){var c=r-u,l=i[c-(u%4?0:4)];s[u]=u<4||c<=4?l:h.INV_SUB_MIX[0][h.SBOX[l>>>24]]^h.INV_SUB_MIX[1][h.SBOX[l>>>16&255]]^h.INV_SUB_MIX[2][h.SBOX[l>>>8&255]]^h.INV_SUB_MIX[3][h.SBOX[255&l]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=s},s.prototype.encryptBlockRaw=function(t){return a(t=o(t),this._keySchedule,h.SUB_MIX,h.SBOX,this._nRounds)},s.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),n=i.allocUnsafe(16);return n.writeUInt32BE(e[0],0),n.writeUInt32BE(e[1],4),n.writeUInt32BE(e[2],8),n.writeUInt32BE(e[3],12),n},s.prototype.decryptBlock=function(t){var e=(t=o(t))[1];t[1]=t[3],t[3]=e;var n=a(t,this._invKeySchedule,h.INV_SUB_MIX,h.INV_SBOX,this._nRounds),r=i.allocUnsafe(16);return r.writeUInt32BE(n[0],0),r.writeUInt32BE(n[3],4),r.writeUInt32BE(n[2],8),r.writeUInt32BE(n[1],12),r},s.prototype.scrub=function(){r(this._keySchedule),r(this._invKeySchedule),r(this._key)},t.exports.AES=s},function(t,e,n){var p=n(4).Buffer,d=n(133);t.exports=function(t,e,n,r){if(p.isBuffer(t)||(t=p.from(t,"binary")),e&&(p.isBuffer(e)||(e=p.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var i=n/8,o=p.alloc(i),a=p.alloc(r||0),s=p.alloc(0);0<i||0<r;){var u=new d;u.update(s),u.update(t),e&&u.update(e),s=u.digest();var c=0;if(0<i){var l=o.length-i;c=Math.min(i,s.length),s.copy(o,l,0,c),i-=c}if(c<s.length&&0<r){var f=a.length-r,h=Math.min(r,s.length-c);s.copy(a,f,c,c+h),r-=h}}return s.fill(0),{key:o,iv:a}}},function(t,e,n){"use strict";var r=e;r.base=n(490),r.short=n(491),r.mont=n(492),r.edwards=n(493)},function(t,e,n){var s=n(509),f=n(521),u=n(522),h=n(142),p=n(202),d=n(4).Buffer;function r(t){var e;"object"!=typeof t||d.isBuffer(t)||(e=t.passphrase,t=t.key),"string"==typeof t&&(t=d.from(t));var n,r,i=u(t,e),o=i.tag,a=i.data;switch(o){case"CERTIFICATE":r=s.certificate.decode(a,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(r||(r=s.PublicKey.decode(a,"der")),n=r.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return s.RSAPublicKey.decode(r.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return r.subjectPrivateKey=r.subjectPublicKey,{type:"ec",data:r};case"1.2.840.10040.4.1":return r.algorithm.params.pub_key=s.DSAparam.decode(r.subjectPublicKey.data,"der"),{type:"dsa",data:r.algorithm.params};default:throw new Error("unknown key id "+n)}throw new Error("unknown key type "+o);case"ENCRYPTED PRIVATE KEY":a=function(t,e){var n=t.algorithm.decrypt.kde.kdeparams.salt,r=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),i=f[t.algorithm.decrypt.cipher.algo.join(".")],o=t.algorithm.decrypt.cipher.iv,a=t.subjectPrivateKey,s=parseInt(i.split("-")[1],10)/8,u=p.pbkdf2Sync(e,n,r,s,"sha1"),c=h.createDecipheriv(i,u,o),l=[];return l.push(c.update(a)),l.push(c.final()),d.concat(l)}(a=s.EncryptedPrivateKey.decode(a,"der"),e);case"PRIVATE KEY":switch(n=(r=s.PrivateKey.decode(a,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return s.RSAPrivateKey.decode(r.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:r.algorithm.curve,privateKey:s.ECPrivateKey.decode(r.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return r.algorithm.params.priv_key=s.DSAparam.decode(r.subjectPrivateKey,"der"),{type:"dsa",params:r.algorithm.params};default:throw new Error("unknown key id "+n)}throw new Error("unknown key type "+o);case"RSA PUBLIC KEY":return s.RSAPublicKey.decode(a,"der");case"RSA PRIVATE KEY":return s.RSAPrivateKey.decode(a,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:s.DSAPrivateKey.decode(a,"der")};case"EC PRIVATE KEY":return{curve:(a=s.ECPrivateKey.decode(a,"der")).parameters.value,privateKey:a.privateKey};default:throw new Error("unknown key type "+o)}}(t.exports=r).signature=s.signature},function(t,e,n){var r=n(535),i=n(536),o=n(537),a=n(538),s=n(539);function u(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}u.prototype.clear=r,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=a,u.prototype.set=s,t.exports=u},function(t,e,n){var r=n(228);t.exports=function(t,e){for(var n=t.length;n--;)if(r(t[n][0],e))return n;return-1}},function(t,e,n){var r=n(39).Symbol;t.exports=r},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e,n){var r=n(63)(Object,"create");t.exports=r},function(t,e,n){var r=n(559);t.exports=function(t,e){var n=t.__data__;return r(e)?n["string"==typeof e?"string":"hash"]:n.map}},function(t,e,n){var r=n(75),i=n(76);t.exports=function(t){return"symbol"==typeof t||i(t)&&"[object Symbol]"==r(t)}},function(t,e,n){var r=n(102);t.exports=function(t){if("string"==typeof t||r(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global,Buffer){__webpack_require__.d(__webpack_exports__,"d",function(){return loadFrozenModel$2}),__webpack_require__.d(__webpack_exports__,"e",function(){return loadGraphModel}),__webpack_require__.d(__webpack_exports__,"a",function(){return FrozenModel}),__webpack_require__.d(__webpack_exports__,"f",function(){return loadTfHubModule}),__webpack_require__.d(__webpack_exports__,"c",function(){return FrozenModel}),__webpack_require__.d(__webpack_exports__,"b",function(){return FrozenModel$1}),__webpack_require__.d(__webpack_exports__,"g",function(){return version});var _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),__assign=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t};
/**
 * @license
 * Copyright 2019 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.
 * =============================================================================
 */function __awaiter(o,a,s,u){return new(s||(s=Promise))(function(t,e){function n(t){try{i(u.next(t))}catch(t){e(t)}}function r(t){try{i(u.throw(t))}catch(t){e(t)}}function i(e){e.done?t(e.value):new s(function(t){t(e.value)}).then(n,r)}i((u=u.apply(o,a||[])).next())})}function __generator(n,r){var i,o,a,t,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(a=o[2&e[0]?"return":e[0]?"throw":"next"])&&!(a=a.call(o,e[1])).done)return a;switch(o=0,a&&(e=[0,a.value]),e[0]){case 0:case 1:a=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,o=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){s.label=e[1];break}if(6===e[0]&&s.label<a[1]){s.label=a[1],a=e;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(e);break}a[2]&&s.ops.pop(),s.trys.pop();continue}e=r.call(n,s)}catch(t){e=[6,t],o=0}finally{i=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}var commonjsGlobal="undefined"!=typeof window?window:void 0!==global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(t,e){return t(e={exports:{}},e.exports),e.exports}var aspromise=asPromise;function asPromise(t,e){for(var n=new Array(arguments.length-1),o=0,r=2,a=!0;r<arguments.length;)n[o++]=arguments[r++];return new Promise(function(r,i){n[o]=function(t){if(a)if(a=!1,t)i(t);else{for(var e=new Array(arguments.length-1),n=0;n<e.length;)e[n++]=arguments[n];r.apply(null,e)}};try{t.apply(e||null,n)}catch(t){a&&(a=!1,i(t))}})}var base64_1=createCommonjsModule(function(t,e){var n=e;n.length=function(t){var e=t.length;if(!e)return 0;for(var n=0;1<--e%4&&"="===t.charAt(e);)++n;return Math.ceil(3*t.length)/4-n};for(var c=new Array(64),u=new Array(123),r=0;r<64;)u[c[r]=r<26?r+65:r<52?r+71:r<62?r-4:r-59|43]=r++;n.encode=function(t,e,n){for(var r,i=null,o=[],a=0,s=0;e<n;){var u=t[e++];switch(s){case 0:o[a++]=c[u>>2],r=(3&u)<<4,s=1;break;case 1:o[a++]=c[r|u>>4],r=(15&u)<<2,s=2;break;case 2:o[a++]=c[r|u>>6],o[a++]=c[63&u],s=0}8191<a&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),a=0)}return s&&(o[a++]=c[r],o[a++]=61,1===s&&(o[a++]=61)),i?(a&&i.push(String.fromCharCode.apply(String,o.slice(0,a))),i.join("")):String.fromCharCode.apply(String,o.slice(0,a))},n.decode=function(t,e,n){for(var r,i=n,o=0,a=0;a<t.length;){var s=t.charCodeAt(a++);if(61===s&&1<o)break;if(void 0===(s=u[s]))throw Error("invalid encoding");switch(o){case 0:r=s,o=1;break;case 1:e[n++]=r<<2|(48&s)>>4,r=s,o=2;break;case 2:e[n++]=(15&r)<<4|(60&s)>>2,r=s,o=3;break;case 3:e[n++]=(3&r)<<6|s,o=0}}if(1===o)throw Error("invalid encoding");return n-i},n.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}}),eventemitter=EventEmitter;function EventEmitter(){this._listeners={}}EventEmitter.prototype.on=function(t,e,n){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:n||this}),this},EventEmitter.prototype.off=function(t,e){if(void 0===t)this._listeners={};else if(void 0===e)this._listeners[t]=[];else for(var n=this._listeners[t],r=0;r<n.length;)n[r].fn===e?n.splice(r,1):++r;return this},EventEmitter.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var n=[],r=1;r<arguments.length;)n.push(arguments[r++]);for(r=0;r<e.length;)e[r].fn.apply(e[r++].ctx,n)}return this};var float_1=factory(factory);function factory(t){return"undefined"!=typeof Float32Array?(l=new Float32Array([-0]),f=new Uint8Array(l.buffer),h=128===f[3],t.writeFloatLE=h?m:g,t.writeFloatBE=h?g:m,t.readFloatLE=h?y:v,t.readFloatBE=h?v:y):(t.writeFloatLE=p.bind(null,writeUintLE),t.writeFloatBE=p.bind(null,writeUintBE),t.readFloatLE=d.bind(null,readUintLE),t.readFloatBE=d.bind(null,readUintBE)),"undefined"!=typeof Float64Array?(s=new Float64Array([-0]),u=new Uint8Array(s.buffer),c=128===u[7],t.writeDoubleLE=c?r:i,t.writeDoubleBE=c?i:r,t.readDoubleLE=c?o:a,t.readDoubleBE=c?a:o):(t.writeDoubleLE=e.bind(null,writeUintLE,0,4),t.writeDoubleBE=e.bind(null,writeUintBE,4,0),t.readDoubleLE=n.bind(null,readUintLE,0,4),t.readDoubleBE=n.bind(null,readUintBE,4,0)),t;function e(t,e,n,r,i,o){var a=r<0?1:0;if(a&&(r=-r),0===r)t(0,i,o+e),t(0<1/r?0:2147483648,i,o+n);else if(isNaN(r))t(0,i,o+e),t(2146959360,i,o+n);else if(17976931348623157e292<r)t(0,i,o+e),t((a<<31|2146435072)>>>0,i,o+n);else{var s;if(r<22250738585072014e-324)t((s=r/5e-324)>>>0,i,o+e),t((a<<31|s/4294967296)>>>0,i,o+n);else{var u=Math.floor(Math.log(r)/Math.LN2);1024===u&&(u=1023),t(4503599627370496*(s=r*Math.pow(2,-u))>>>0,i,o+e),t((a<<31|u+1023<<20|1048576*s&1048575)>>>0,i,o+n)}}}function n(t,e,n,r,i){var o=t(r,i+e),a=t(r,i+n),s=2*(a>>31)+1,u=a>>>20&2047,c=4294967296*(1048575&a)+o;return 2047==u?c?NaN:1/0*s:0==u?5e-324*s*c:s*Math.pow(2,u-1075)*(c+4503599627370496)}function r(t,e,n){s[0]=t,e[n]=u[0],e[n+1]=u[1],e[n+2]=u[2],e[n+3]=u[3],e[n+4]=u[4],e[n+5]=u[5],e[n+6]=u[6],e[n+7]=u[7]}function i(t,e,n){s[0]=t,e[n]=u[7],e[n+1]=u[6],e[n+2]=u[5],e[n+3]=u[4],e[n+4]=u[3],e[n+5]=u[2],e[n+6]=u[1],e[n+7]=u[0]}function o(t,e){return u[0]=t[e],u[1]=t[e+1],u[2]=t[e+2],u[3]=t[e+3],u[4]=t[e+4],u[5]=t[e+5],u[6]=t[e+6],u[7]=t[e+7],s[0]}function a(t,e){return u[7]=t[e],u[6]=t[e+1],u[5]=t[e+2],u[4]=t[e+3],u[3]=t[e+4],u[2]=t[e+5],u[1]=t[e+6],u[0]=t[e+7],s[0]}var s,u,c,l,f,h;function p(t,e,n,r){var i=e<0?1:0;if(i&&(e=-e),0===e)t(0<1/e?0:2147483648,n,r);else if(isNaN(e))t(2143289344,n,r);else if(34028234663852886e22<e)t((i<<31|2139095040)>>>0,n,r);else if(e<11754943508222875e-54)t((i<<31|Math.round(e/1401298464324817e-60))>>>0,n,r);else{var o=Math.floor(Math.log(e)/Math.LN2);t((i<<31|o+127<<23|8388607&Math.round(e*Math.pow(2,-o)*8388608))>>>0,n,r)}}function d(t,e,n){var r=t(e,n),i=2*(r>>31)+1,o=r>>>23&255,a=8388607&r;return 255==o?a?NaN:1/0*i:0==o?1401298464324817e-60*i*a:i*Math.pow(2,o-150)*(8388608+a)}function m(t,e,n){l[0]=t,e[n]=f[0],e[n+1]=f[1],e[n+2]=f[2],e[n+3]=f[3]}function g(t,e,n){l[0]=t,e[n]=f[3],e[n+1]=f[2],e[n+2]=f[1],e[n+3]=f[0]}function y(t,e){return f[0]=t[e],f[1]=t[e+1],f[2]=t[e+2],f[3]=t[e+3],l[0]}function v(t,e){return f[3]=t[e],f[2]=t[e+1],f[1]=t[e+2],f[0]=t[e+3],l[0]}}function writeUintLE(t,e,n){e[n]=255&t,e[n+1]=t>>>8&255,e[n+2]=t>>>16&255,e[n+3]=t>>>24}function writeUintBE(t,e,n){e[n]=t>>>24,e[n+1]=t>>>16&255,e[n+2]=t>>>8&255,e[n+3]=255&t}function readUintLE(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function readUintBE(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}var inquire_1=inquire;function inquire(moduleName){try{var mod$$1=eval("quire".replace(/^/,"re"))(moduleName);if(mod$$1&&(mod$$1.length||Object.keys(mod$$1).length))return mod$$1}catch(t){}return null}var utf8_1=createCommonjsModule(function(t,e){var n=e;n.length=function(t){for(var e=0,n=0,r=0;r<t.length;++r)(n=t.charCodeAt(r))<128?e+=1:n<2048?e+=2:55296==(64512&n)&&56320==(64512&t.charCodeAt(r+1))?(++r,e+=4):e+=3;return e},n.read=function(t,e,n){if(n-e<1)return"";for(var r,i=null,o=[],a=0;e<n;)(r=t[e++])<128?o[a++]=r:191<r&&r<224?o[a++]=(31&r)<<6|63&t[e++]:239<r&&r<365?(r=((7&r)<<18|(63&t[e++])<<12|(63&t[e++])<<6|63&t[e++])-65536,o[a++]=55296+(r>>10),o[a++]=56320+(1023&r)):o[a++]=(15&r)<<12|(63&t[e++])<<6|63&t[e++],8191<a&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),a=0);return i?(a&&i.push(String.fromCharCode.apply(String,o.slice(0,a))),i.join("")):String.fromCharCode.apply(String,o.slice(0,a))},n.write=function(t,e,n){for(var r,i,o=n,a=0;a<t.length;++a)(r=t.charCodeAt(a))<128?e[n++]=r:(r<2048?e[n++]=r>>6|192:(55296==(64512&r)&&56320==(64512&(i=t.charCodeAt(a+1)))?(r=65536+((1023&r)<<10)+(1023&i),++a,e[n++]=r>>18|240,e[n++]=r>>12&63|128):e[n++]=r>>12|224,e[n++]=r>>6&63|128),e[n++]=63&r|128);return n-o}}),pool_1=pool;function pool(n,r,t){var i=t||8192,o=i>>>1,a=null,s=i;return function(t){if(t<1||o<t)return n(t);i<s+t&&(a=n(i),s=0);var e=r.call(a,s,s+=t);return 7&s&&(s=1+(7|s)),e}}var longbits=LongBits;function LongBits(t,e){this.lo=t>>>0,this.hi=e>>>0}var zero=LongBits.zero=new LongBits(0,0);zero.toNumber=function(){return 0},zero.zzEncode=zero.zzDecode=function(){return this},zero.length=function(){return 1};var zeroHash=LongBits.zeroHash="\0\0\0\0\0\0\0\0";LongBits.fromNumber=function(t){if(0===t)return zero;var e=t<0;e&&(t=-t);var n=t>>>0,r=(t-n)/4294967296>>>0;return e&&(r=~r>>>0,n=~n>>>0,4294967295<++n&&(n=0,4294967295<++r&&(r=0))),new LongBits(n,r)},LongBits.from=function(t){if("number"==typeof t)return LongBits.fromNumber(t);if(minimal.isString(t)){if(!minimal.Long)return LongBits.fromNumber(parseInt(t,10));t=minimal.Long.fromString(t)}return t.low||t.high?new LongBits(t.low>>>0,t.high>>>0):zero},LongBits.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=1+~this.lo>>>0,n=~this.hi>>>0;return e||(n=n+1>>>0),-(e+4294967296*n)}return this.lo+4294967296*this.hi},LongBits.prototype.toLong=function(t){return minimal.Long?new minimal.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var charCodeAt=String.prototype.charCodeAt;LongBits.fromHash=function(t){return t===zeroHash?zero:new LongBits((charCodeAt.call(t,0)|charCodeAt.call(t,1)<<8|charCodeAt.call(t,2)<<16|charCodeAt.call(t,3)<<24)>>>0,(charCodeAt.call(t,4)|charCodeAt.call(t,5)<<8|charCodeAt.call(t,6)<<16|charCodeAt.call(t,7)<<24)>>>0)},LongBits.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},LongBits.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},LongBits.prototype.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},LongBits.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0==n?0==e?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10};var minimal=createCommonjsModule(function(t,e){var r=e;function i(t,e,n){for(var r=Object.keys(e),i=0;i<r.length;++i)void 0!==t[r[i]]&&n||(t[r[i]]=e[r[i]]);return t}function n(t){function n(t,e){if(!(this instanceof n))return new n(t,e);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,n):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),e&&i(this,e)}return(n.prototype=Object.create(Error.prototype)).constructor=n,Object.defineProperty(n.prototype,"name",{get:function(){return t}}),n.prototype.toString=function(){return this.name+": "+this.message},n}r.asPromise=aspromise,r.base64=base64_1,r.EventEmitter=eventemitter,r.float=float_1,r.inquire=inquire_1,r.utf8=utf8_1,r.pool=pool_1,r.LongBits=longbits,r.global="undefined"!=typeof window&&window||void 0!==commonjsGlobal&&commonjsGlobal||"undefined"!=typeof self&&self||commonjsGlobal,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isNode=Boolean(r.global.process&&r.global.process.versions&&r.global.process.versions.node),r.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},r.isString=function(t){return"string"==typeof t||t instanceof String},r.isObject=function(t){return t&&"object"==typeof t},r.isset=r.isSet=function(t,e){var n=t[e];return!(null==n||!t.hasOwnProperty(e))&&("object"!=typeof n||0<(Array.isArray(n)?n.length:Object.keys(n).length))},r.Buffer=function(){try{var t=r.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch(t){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(t){return"number"==typeof t?r.Buffer?r._Buffer_allocUnsafe(t):new r.Array(t):r.Buffer?r._Buffer_from(t):"undefined"==typeof Uint8Array?t:new Uint8Array(t)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(t){return t?r.LongBits.from(t).toHash():r.LongBits.zeroHash},r.longFromHash=function(t,e){var n=r.LongBits.fromHash(t);return r.Long?r.Long.fromBits(n.lo,n.hi,e):n.toNumber(Boolean(e))},r.merge=i,r.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},r.newError=n,r.ProtocolError=n("ProtocolError"),r.oneOfGetter=function(t){for(var n={},e=0;e<t.length;++e)n[t[e]]=1;return function(){for(var t=Object.keys(this),e=t.length-1;-1<e;--e)if(1===n[t[e]]&&void 0!==this[t[e]]&&null!==this[t[e]])return t[e]}},r.oneOfSetter=function(n){return function(t){for(var e=0;e<n.length;++e)n[e]!==t&&delete this[n[e]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var n=r.Buffer;n?(r._Buffer_from=n.from!==Uint8Array.from&&n.from||function(t,e){return new n(t,e)},r._Buffer_allocUnsafe=n.allocUnsafe||function(t){return new n(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}}),writer=Writer,BufferWriter,LongBits$1=minimal.LongBits,base64=minimal.base64,utf8=minimal.utf8;function Op(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}function noop(){}function State(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Writer(){this.len=0,this.head=new Op(noop,0,0),this.tail=this.head,this.states=null}function writeByte(t,e,n){e[n]=255&t}function writeVarint32(t,e,n){for(;127<t;)e[n++]=127&t|128,t>>>=7;e[n]=t}function VarintOp(t,e){this.len=t,this.next=void 0,this.val=e}function writeVarint64(t,e,n){for(;t.hi;)e[n++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;127<t.lo;)e[n++]=127&t.lo|128,t.lo=t.lo>>>7;e[n++]=t.lo}function writeFixed32(t,e,n){e[n]=255&t,e[n+1]=t>>>8&255,e[n+2]=t>>>16&255,e[n+3]=t>>>24}Writer.create=minimal.Buffer?function(){return(Writer.create=function(){return new BufferWriter})()}:function(){return new Writer},Writer.alloc=function(t){return new minimal.Array(t)},minimal.Array!==Array&&(Writer.alloc=minimal.pool(Writer.alloc,minimal.Array.prototype.subarray)),Writer.prototype._push=function(t,e,n){return this.tail=this.tail.next=new Op(t,e,n),this.len+=e,this},VarintOp.prototype=Object.create(Op.prototype),VarintOp.prototype.fn=writeVarint32,Writer.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new VarintOp((t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},Writer.prototype.int32=function(t){return t<0?this._push(writeVarint64,10,LongBits$1.fromNumber(t)):this.uint32(t)},Writer.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},Writer.prototype.uint64=function(t){var e=LongBits$1.from(t);return this._push(writeVarint64,e.length(),e)},Writer.prototype.int64=Writer.prototype.uint64,Writer.prototype.sint64=function(t){var e=LongBits$1.from(t).zzEncode();return this._push(writeVarint64,e.length(),e)},Writer.prototype.bool=function(t){return this._push(writeByte,1,t?1:0)},Writer.prototype.fixed32=function(t){return this._push(writeFixed32,4,t>>>0)},Writer.prototype.sfixed32=Writer.prototype.fixed32,Writer.prototype.fixed64=function(t){var e=LongBits$1.from(t);return this._push(writeFixed32,4,e.lo)._push(writeFixed32,4,e.hi)},Writer.prototype.sfixed64=Writer.prototype.fixed64,Writer.prototype.float=function(t){return this._push(minimal.float.writeFloatLE,4,t)},Writer.prototype.double=function(t){return this._push(minimal.float.writeDoubleLE,8,t)};var writeBytes=minimal.Array.prototype.set?function(t,e,n){e.set(t,n)}:function(t,e,n){for(var r=0;r<t.length;++r)e[n+r]=t[r]};Writer.prototype.bytes=function(t){var e=t.length>>>0;if(!e)return this._push(writeByte,1,0);if(minimal.isString(t)){var n=Writer.alloc(e=base64.length(t));base64.decode(t,n,0),t=n}return this.uint32(e)._push(writeBytes,e,t)},Writer.prototype.string=function(t){var e=utf8.length(t);return e?this.uint32(e)._push(utf8.write,e,t):this._push(writeByte,1,0)},Writer.prototype.fork=function(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this},Writer.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this},Writer.prototype.ldelim=function(){var t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=e,this.len+=n),this},Writer.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e},Writer._configure=function(t){BufferWriter=t};var writer_buffer=BufferWriter$1;(BufferWriter$1.prototype=Object.create(writer.prototype)).constructor=BufferWriter$1;var Buffer$1=minimal.Buffer;function BufferWriter$1(){writer.call(this)}BufferWriter$1.alloc=function(t){return(BufferWriter$1.alloc=minimal._Buffer_allocUnsafe)(t)};var writeBytesBuffer=Buffer$1&&Buffer$1.prototype instanceof Uint8Array&&"set"===Buffer$1.prototype.set.name?function(t,e,n){e.set(t,n)}:function(t,e,n){if(t.copy)t.copy(e,n,0,t.length);else for(var r=0;r<t.length;)e[n++]=t[r++]};function writeStringBuffer(t,e,n){t.length<40?minimal.utf8.write(t,e,n):e.utf8Write(t,n)}BufferWriter$1.prototype.bytes=function(t){minimal.isString(t)&&(t=minimal._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(writeBytesBuffer,e,t),this},BufferWriter$1.prototype.string=function(t){var e=Buffer$1.byteLength(t);return this.uint32(e),e&&this._push(writeStringBuffer,e,t),this};var reader=Reader,BufferReader,LongBits$2=minimal.LongBits,utf8$1=minimal.utf8;function indexOutOfRange(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function Reader(t){this.buf=t,this.pos=0,this.len=t.length}var create_array="undefined"!=typeof Uint8Array?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new Reader(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new Reader(t);throw Error("illegal buffer")},_Mc;function readLongVarint(){var t=new LongBits$2(0,0),e=0;if(!(4<this.len-this.pos)){for(;e<3;++e){if(this.pos>=this.len)throw indexOutOfRange(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(127&this.buf[this.pos++])<<7*e)>>>0,t}for(;e<4;++e)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t;if(e=0,4<this.len-this.pos){for(;e<5;++e)if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw indexOutOfRange(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function readFixed32_end(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits$2(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader.create=minimal.Buffer?function(t){return(Reader.create=function(t){return minimal.Buffer.isBuffer(t)?new BufferReader(t):create_array(t)})(t)}:create_array,Reader.prototype._slice=minimal.Array.prototype.subarray||minimal.Array.prototype.slice,Reader.prototype.uint32=(_Mc=4294967295,function(){if(_Mc=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return _Mc;if(_Mc=(_Mc|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return _Mc;if(_Mc=(_Mc|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return _Mc;if(_Mc=(_Mc|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return _Mc;if(_Mc=(_Mc|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return _Mc;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return _Mc}),Reader.prototype.int32=function(){return 0|this.uint32()},Reader.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},Reader.prototype.bool=function(){return 0!==this.uint32()},Reader.prototype.fixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)},Reader.prototype.sfixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return 0|readFixed32_end(this.buf,this.pos+=4)},Reader.prototype.float=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var t=minimal.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},Reader.prototype.double=function(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var t=minimal.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},Reader.prototype.bytes=function(){var t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw indexOutOfRange(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(e,n):e===n?new this.buf.constructor(0):this._slice.call(this.buf,e,n)},Reader.prototype.string=function(){var t=this.bytes();return utf8$1.read(t,0,t.length)},Reader.prototype.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw indexOutOfRange(this,t);this.pos+=t}else do{if(this.pos>=this.len)throw indexOutOfRange(this)}while(128&this.buf[this.pos++]);return this},Reader.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},Reader._configure=function(t){BufferReader=t;var e=minimal.Long?"toLong":"toNumber";minimal.merge(Reader.prototype,{int64:function(){return readLongVarint.call(this)[e](!1)},uint64:function(){return readLongVarint.call(this)[e](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[e](!1)},fixed64:function(){return readFixed64.call(this)[e](!0)},sfixed64:function(){return readFixed64.call(this)[e](!1)}})};var reader_buffer=BufferReader$1;function BufferReader$1(t){reader.call(this,t)}(BufferReader$1.prototype=Object.create(reader.prototype)).constructor=BufferReader$1,minimal.Buffer&&(BufferReader$1.prototype._slice=minimal.Buffer.prototype.slice),BufferReader$1.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len))};var service=Service;function Service(t,e,n){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");minimal.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(e),this.responseDelimited=Boolean(n)}(Service.prototype=Object.create(minimal.EventEmitter.prototype)).constructor=Service,Service.prototype.rpcCall=function t(n,e,r,i,o){if(!i)throw TypeError("request must be specified");var a=this;if(!o)return minimal.asPromise(t,a,n,e,r,i);if(a.rpcImpl)try{return a.rpcImpl(n,e[a.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(t,e){if(t)return a.emit("error",t,n),o(t);if(null!==e){if(!(e instanceof r))try{e=r[a.responseDelimited?"decodeDelimited":"decode"](e)}catch(t){return a.emit("error",t,n),o(t)}return a.emit("data",e,n),o(null,e)}a.end(!0)})}catch(t){return a.emit("error",t,n),void setTimeout(function(){o(t)},0)}else setTimeout(function(){o(Error("already ended"))},0)},Service.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this};var rpc_1=createCommonjsModule(function(t,e){e.Service=service}),roots={},indexMinimal=createCommonjsModule(function(t,e){var n=e;function r(){n.Reader._configure(n.BufferReader),n.util._configure()}n.build="minimal",n.Writer=writer,n.BufferWriter=writer_buffer,n.Reader=reader,n.BufferReader=reader_buffer,n.util=minimal,n.rpc=rpc_1,n.roots=roots,n.configure=r,n.Writer._configure(n.BufferWriter),r()}),minimal$1=indexMinimal,minimal_1=minimal$1.roots,minimal_2=minimal$1.Reader,minimal_3=minimal$1.util,$Reader=minimal$1.Reader,$util=minimal$1.util,$root=minimal$1.roots.default||(minimal$1.roots.default={}),GNc,HNc,MQc,BQc,CQc,yPc,tOc,INc;function fTc(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function XSc(t){if(this.attr={},this.nodeDef=[],this.ret={},t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function OSc(t){if(this.function=[],this.gradient=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function FSc(t){if(this.metaGraphs=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function mSc(t){if(this.collectionDef={},this.signatureDef={},this.assetFileDef=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function wSc(t){if(this.tags=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function dSc(t){if(this.op=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function vRc(t){if(this.inputArg=[],this.outputArg=[],this.attr=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function WRc(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function NRc(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function ERc(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function mRc(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function cRc(t){if(this.inputs={},this.outputs={},t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function LQc(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function VQc(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function AQc(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function xPc(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function rQc(t){if(this.value=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function hQc(t){if(this.value=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function ZPc(t){if(this.value=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function QPc(t){if(this.value=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function HPc(t){if(this.value=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function oPc(t){if(this.node=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function ePc(t){if(this.badConsumers=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function WOc(t){if(this.input=[],this.attr={},t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function MOc(t){if(this.attr={},t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function sOc(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function COc(t){if(this.s=[],this.i=[],this.f=[],this.b=[],this.type=[],this.shape=[],this.tensor=[],this.func=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function iOc(t){if(this.floatVal=[],this.doubleVal=[],this.intVal=[],this.stringVal=[],this.scomplexVal=[],this.int64Val=[],this.boolVal=[],this.uint32Val=[],this.uint64Val=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function SNc(t){if(this.dim=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function _Nc(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}function JNc(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}$root.tensorflow=(INc={},INc.Any=(JNc.prototype.typeUrl="",JNc.prototype.value=$util.newBuffer([]),JNc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.Any;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.typeUrl=t.string();break;case 2:r.value=t.bytes();break;default:t.skipType(7&i)}}return r},JNc),INc.DataType=(GNc={},(HNc=Object.create(GNc))[GNc[0]="DT_INVALID"]=0,HNc[GNc[1]="DT_FLOAT"]=1,HNc[GNc[2]="DT_DOUBLE"]=2,HNc[GNc[3]="DT_INT32"]=3,HNc[GNc[4]="DT_UINT8"]=4,HNc[GNc[5]="DT_INT16"]=5,HNc[GNc[6]="DT_INT8"]=6,HNc[GNc[7]="DT_STRING"]=7,HNc[GNc[8]="DT_COMPLEX64"]=8,HNc[GNc[9]="DT_INT64"]=9,HNc[GNc[10]="DT_BOOL"]=10,HNc[GNc[11]="DT_QINT8"]=11,HNc[GNc[12]="DT_QUINT8"]=12,HNc[GNc[13]="DT_QINT32"]=13,HNc[GNc[14]="DT_BFLOAT16"]=14,HNc[GNc[101]="DT_FLOAT_REF"]=101,HNc[GNc[102]="DT_DOUBLE_REF"]=102,HNc[GNc[103]="DT_INT32_REF"]=103,HNc[GNc[104]="DT_UINT8_REF"]=104,HNc[GNc[105]="DT_INT16_REF"]=105,HNc[GNc[106]="DT_INT8_REF"]=106,HNc[GNc[107]="DT_STRING_REF"]=107,HNc[GNc[108]="DT_COMPLEX64_REF"]=108,HNc[GNc[109]="DT_INT64_REF"]=109,HNc[GNc[110]="DT_BOOL_REF"]=110,HNc[GNc[111]="DT_QINT8_REF"]=111,HNc[GNc[112]="DT_QUINT8_REF"]=112,HNc[GNc[113]="DT_QINT32_REF"]=113,HNc[GNc[114]="DT_BFLOAT16_REF"]=114,HNc),INc.TensorShape=(SNc.prototype.dim=$util.emptyArray,SNc.prototype.unknownRank=!1,SNc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.TensorShape;t.pos<n;){var i=t.uint32();switch(i>>>3){case 2:r.dim&&r.dim.length||(r.dim=[]),r.dim.push($root.tensorflow.TensorShape.Dim.decode(t,t.uint32()));break;case 3:r.unknownRank=t.bool();break;default:t.skipType(7&i)}}return r},SNc.Dim=(_Nc.prototype.size=$util.Long?$util.Long.fromBits(0,0,!1):0,_Nc.prototype.name="",_Nc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.TensorShape.Dim;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.size=t.int64();break;case 2:r.name=t.string();break;default:t.skipType(7&i)}}return r},_Nc),SNc),INc.Tensor=(iOc.prototype.dtype=0,iOc.prototype.tensorShape=null,iOc.prototype.versionNumber=0,iOc.prototype.tensorContent=$util.newBuffer([]),iOc.prototype.floatVal=$util.emptyArray,iOc.prototype.doubleVal=$util.emptyArray,iOc.prototype.intVal=$util.emptyArray,iOc.prototype.stringVal=$util.emptyArray,iOc.prototype.scomplexVal=$util.emptyArray,iOc.prototype.int64Val=$util.emptyArray,iOc.prototype.boolVal=$util.emptyArray,iOc.prototype.uint32Val=$util.emptyArray,iOc.prototype.uint64Val=$util.emptyArray,iOc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.Tensor;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.dtype=t.int32();break;case 2:r.tensorShape=$root.tensorflow.TensorShape.decode(t,t.uint32());break;case 3:r.versionNumber=t.int32();break;case 4:r.tensorContent=t.bytes();break;case 5:if(r.floatVal&&r.floatVal.length||(r.floatVal=[]),2==(7&i))for(var o=t.uint32()+t.pos;t.pos<o;)r.floatVal.push(t.float());else r.floatVal.push(t.float());break;case 6:if(r.doubleVal&&r.doubleVal.length||(r.doubleVal=[]),2==(7&i))for(o=t.uint32()+t.pos;t.pos<o;)r.doubleVal.push(t.double());else r.doubleVal.push(t.double());break;case 7:if(r.intVal&&r.intVal.length||(r.intVal=[]),2==(7&i))for(o=t.uint32()+t.pos;t.pos<o;)r.intVal.push(t.int32());else r.intVal.push(t.int32());break;case 8:r.stringVal&&r.stringVal.length||(r.stringVal=[]),r.stringVal.push(t.bytes());break;case 9:if(r.scomplexVal&&r.scomplexVal.length||(r.scomplexVal=[]),2==(7&i))for(o=t.uint32()+t.pos;t.pos<o;)r.scomplexVal.push(t.float());else r.scomplexVal.push(t.float());break;case 10:if(r.int64Val&&r.int64Val.length||(r.int64Val=[]),2==(7&i))for(o=t.uint32()+t.pos;t.pos<o;)r.int64Val.push(t.int64());else r.int64Val.push(t.int64());break;case 11:if(r.boolVal&&r.boolVal.length||(r.boolVal=[]),2==(7&i))for(o=t.uint32()+t.pos;t.pos<o;)r.boolVal.push(t.bool());else r.boolVal.push(t.bool());break;case 16:if(r.uint32Val&&r.uint32Val.length||(r.uint32Val=[]),2==(7&i))for(o=t.uint32()+t.pos;t.pos<o;)r.uint32Val.push(t.uint32());else r.uint32Val.push(t.uint32());break;case 17:if(r.uint64Val&&r.uint64Val.length||(r.uint64Val=[]),2==(7&i))for(o=t.uint32()+t.pos;t.pos<o;)r.uint64Val.push(t.uint64());else r.uint64Val.push(t.uint64());break;default:t.skipType(7&i)}}return r},iOc),INc.AttrValue=(sOc.prototype.list=null,sOc.prototype.s=$util.newBuffer([]),sOc.prototype.i=$util.Long?$util.Long.fromBits(0,0,!1):0,sOc.prototype.f=0,sOc.prototype.b=!1,sOc.prototype.type=0,sOc.prototype.shape=null,sOc.prototype.tensor=null,sOc.prototype.placeholder="",sOc.prototype.func=null,Object.defineProperty(sOc.prototype,"value",{get:$util.oneOfGetter(tOc=["list","s","i","f","b","type","shape","tensor","placeholder","func"]),set:$util.oneOfSetter(tOc)}),sOc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.AttrValue;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.list=$root.tensorflow.AttrValue.ListValue.decode(t,t.uint32());break;case 2:r.s=t.bytes();break;case 3:r.i=t.int64();break;case 4:r.f=t.float();break;case 5:r.b=t.bool();break;case 6:r.type=t.int32();break;case 7:r.shape=$root.tensorflow.TensorShape.decode(t,t.uint32());break;case 8:r.tensor=$root.tensorflow.Tensor.decode(t,t.uint32());break;case 9:r.placeholder=t.string();break;case 10:r.func=$root.tensorflow.NameAttrList.decode(t,t.uint32());break;default:t.skipType(7&i)}}return r},sOc.ListValue=(COc.prototype.s=$util.emptyArray,COc.prototype.i=$util.emptyArray,COc.prototype.f=$util.emptyArray,COc.prototype.b=$util.emptyArray,COc.prototype.type=$util.emptyArray,COc.prototype.shape=$util.emptyArray,COc.prototype.tensor=$util.emptyArray,COc.prototype.func=$util.emptyArray,COc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.AttrValue.ListValue;t.pos<n;){var i=t.uint32();switch(i>>>3){case 2:r.s&&r.s.length||(r.s=[]),r.s.push(t.bytes());break;case 3:if(r.i&&r.i.length||(r.i=[]),2==(7&i))for(var o=t.uint32()+t.pos;t.pos<o;)r.i.push(t.int64());else r.i.push(t.int64());break;case 4:if(r.f&&r.f.length||(r.f=[]),2==(7&i))for(o=t.uint32()+t.pos;t.pos<o;)r.f.push(t.float());else r.f.push(t.float());break;case 5:if(r.b&&r.b.length||(r.b=[]),2==(7&i))for(o=t.uint32()+t.pos;t.pos<o;)r.b.push(t.bool());else r.b.push(t.bool());break;case 6:if(r.type&&r.type.length||(r.type=[]),2==(7&i))for(o=t.uint32()+t.pos;t.pos<o;)r.type.push(t.int32());else r.type.push(t.int32());break;case 7:r.shape&&r.shape.length||(r.shape=[]),r.shape.push($root.tensorflow.TensorShape.decode(t,t.uint32()));break;case 8:r.tensor&&r.tensor.length||(r.tensor=[]),r.tensor.push($root.tensorflow.Tensor.decode(t,t.uint32()));break;case 9:r.func&&r.func.length||(r.func=[]),r.func.push($root.tensorflow.NameAttrList.decode(t,t.uint32()));break;default:t.skipType(7&i)}}return r},COc),sOc),INc.NameAttrList=(MOc.prototype.name="",MOc.prototype.attr=$util.emptyObject,MOc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n,r=void 0===e?t.len:t.pos+e,i=new $root.tensorflow.NameAttrList;t.pos<r;){var o=t.uint32();switch(o>>>3){case 1:i.name=t.string();break;case 2:t.skip().pos++,i.attr===$util.emptyObject&&(i.attr={}),n=t.string(),t.pos++,i.attr[n]=$root.tensorflow.AttrValue.decode(t,t.uint32());break;default:t.skipType(7&o)}}return i},MOc),INc.NodeDef=(WOc.prototype.name="",WOc.prototype.op="",WOc.prototype.input=$util.emptyArray,WOc.prototype.device="",WOc.prototype.attr=$util.emptyObject,WOc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n,r=void 0===e?t.len:t.pos+e,i=new $root.tensorflow.NodeDef;t.pos<r;){var o=t.uint32();switch(o>>>3){case 1:i.name=t.string();break;case 2:i.op=t.string();break;case 3:i.input&&i.input.length||(i.input=[]),i.input.push(t.string());break;case 4:i.device=t.string();break;case 5:t.skip().pos++,i.attr===$util.emptyObject&&(i.attr={}),n=t.string(),t.pos++,i.attr[n]=$root.tensorflow.AttrValue.decode(t,t.uint32());break;default:t.skipType(7&o)}}return i},WOc),INc.VersionDef=(ePc.prototype.producer=0,ePc.prototype.minConsumer=0,ePc.prototype.badConsumers=$util.emptyArray,ePc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.VersionDef;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.producer=t.int32();break;case 2:r.minConsumer=t.int32();break;case 3:if(r.badConsumers&&r.badConsumers.length||(r.badConsumers=[]),2==(7&i))for(var o=t.uint32()+t.pos;t.pos<o;)r.badConsumers.push(t.int32());else r.badConsumers.push(t.int32());break;default:t.skipType(7&i)}}return r},ePc),INc.GraphDef=(oPc.prototype.node=$util.emptyArray,oPc.prototype.versions=null,oPc.prototype.library=null,oPc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.GraphDef;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.node&&r.node.length||(r.node=[]),r.node.push($root.tensorflow.NodeDef.decode(t,t.uint32()));break;case 4:r.versions=$root.tensorflow.VersionDef.decode(t,t.uint32());break;case 2:r.library=$root.tensorflow.FunctionDefLibrary.decode(t,t.uint32());break;default:t.skipType(7&i)}}return r},oPc),INc.CollectionDef=(xPc.prototype.nodeList=null,xPc.prototype.bytesList=null,xPc.prototype.int64List=null,xPc.prototype.floatList=null,xPc.prototype.anyList=null,Object.defineProperty(xPc.prototype,"kind",{get:$util.oneOfGetter(yPc=["nodeList","bytesList","int64List","floatList","anyList"]),set:$util.oneOfSetter(yPc)}),xPc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.CollectionDef;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.nodeList=$root.tensorflow.CollectionDef.NodeList.decode(t,t.uint32());break;case 2:r.bytesList=$root.tensorflow.CollectionDef.BytesList.decode(t,t.uint32());break;case 3:r.int64List=$root.tensorflow.CollectionDef.Int64List.decode(t,t.uint32());break;case 4:r.floatList=$root.tensorflow.CollectionDef.FloatList.decode(t,t.uint32());break;case 5:r.anyList=$root.tensorflow.CollectionDef.AnyList.decode(t,t.uint32());break;default:t.skipType(7&i)}}return r},xPc.NodeList=(HPc.prototype.value=$util.emptyArray,HPc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.CollectionDef.NodeList;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.value&&r.value.length||(r.value=[]),r.value.push(t.string());break;default:t.skipType(7&i)}}return r},HPc),xPc.BytesList=(QPc.prototype.value=$util.emptyArray,QPc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.CollectionDef.BytesList;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.value&&r.value.length||(r.value=[]),r.value.push(t.bytes());break;default:t.skipType(7&i)}}return r},QPc),xPc.Int64List=(ZPc.prototype.value=$util.emptyArray,ZPc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.CollectionDef.Int64List;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:if(r.value&&r.value.length||(r.value=[]),2==(7&i))for(var o=t.uint32()+t.pos;t.pos<o;)r.value.push(t.int64());else r.value.push(t.int64());break;default:t.skipType(7&i)}}return r},ZPc),xPc.FloatList=(hQc.prototype.value=$util.emptyArray,hQc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.CollectionDef.FloatList;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:if(r.value&&r.value.length||(r.value=[]),2==(7&i))for(var o=t.uint32()+t.pos;t.pos<o;)r.value.push(t.float());else r.value.push(t.float());break;default:t.skipType(7&i)}}return r},hQc),xPc.AnyList=(rQc.prototype.value=$util.emptyArray,rQc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.CollectionDef.AnyList;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.value&&r.value.length||(r.value=[]),r.value.push($root.tensorflow.Any.decode(t,t.uint32()));break;default:t.skipType(7&i)}}return r},rQc),xPc),INc.SaverDef=(AQc.prototype.filenameTensorName="",AQc.prototype.saveTensorName="",AQc.prototype.restoreOpName="",AQc.prototype.maxToKeep=0,AQc.prototype.sharded=!1,AQc.prototype.keepCheckpointEveryNHours=0,AQc.prototype.version=0,AQc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.SaverDef;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.filenameTensorName=t.string();break;case 2:r.saveTensorName=t.string();break;case 3:r.restoreOpName=t.string();break;case 4:r.maxToKeep=t.int32();break;case 5:r.sharded=t.bool();break;case 6:r.keepCheckpointEveryNHours=t.float();break;case 7:r.version=t.int32();break;default:t.skipType(7&i)}}return r},AQc.CheckpointFormatVersion=(BQc={},(CQc=Object.create(BQc))[BQc[0]="LEGACY"]=0,CQc[BQc[1]="V1"]=1,CQc[BQc[2]="V2"]=2,CQc),AQc),INc.TensorInfo=(LQc.prototype.name="",LQc.prototype.cooSparse=null,LQc.prototype.dtype=0,LQc.prototype.tensorShape=null,Object.defineProperty(LQc.prototype,"encoding",{get:$util.oneOfGetter(MQc=["name","cooSparse"]),set:$util.oneOfSetter(MQc)}),LQc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.TensorInfo;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.name=t.string();break;case 4:r.cooSparse=$root.tensorflow.TensorInfo.CooSparse.decode(t,t.uint32());break;case 2:r.dtype=t.int32();break;case 3:r.tensorShape=$root.tensorflow.TensorShape.decode(t,t.uint32());break;default:t.skipType(7&i)}}return r},LQc.CooSparse=(VQc.prototype.valuesTensorName="",VQc.prototype.indicesTensorName="",VQc.prototype.denseShapeTensorName="",VQc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.TensorInfo.CooSparse;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.valuesTensorName=t.string();break;case 2:r.indicesTensorName=t.string();break;case 3:r.denseShapeTensorName=t.string();break;default:t.skipType(7&i)}}return r},VQc),LQc),INc.SignatureDef=(cRc.prototype.inputs=$util.emptyObject,cRc.prototype.outputs=$util.emptyObject,cRc.prototype.methodName="",cRc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n,r=void 0===e?t.len:t.pos+e,i=new $root.tensorflow.SignatureDef;t.pos<r;){var o=t.uint32();switch(o>>>3){case 1:t.skip().pos++,i.inputs===$util.emptyObject&&(i.inputs={}),n=t.string(),t.pos++,i.inputs[n]=$root.tensorflow.TensorInfo.decode(t,t.uint32());break;case 2:t.skip().pos++,i.outputs===$util.emptyObject&&(i.outputs={}),n=t.string(),t.pos++,i.outputs[n]=$root.tensorflow.TensorInfo.decode(t,t.uint32());break;case 3:i.methodName=t.string();break;default:t.skipType(7&o)}}return i},cRc),INc.AssetFileDef=(mRc.prototype.tensorInfo=null,mRc.prototype.filename="",mRc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.AssetFileDef;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.tensorInfo=$root.tensorflow.TensorInfo.decode(t,t.uint32());break;case 2:r.filename=t.string();break;default:t.skipType(7&i)}}return r},mRc),INc.OpDef=(vRc.prototype.name="",vRc.prototype.inputArg=$util.emptyArray,vRc.prototype.outputArg=$util.emptyArray,vRc.prototype.attr=$util.emptyArray,vRc.prototype.deprecation=null,vRc.prototype.summary="",vRc.prototype.description="",vRc.prototype.isCommutative=!1,vRc.prototype.isAggregate=!1,vRc.prototype.isStateful=!1,vRc.prototype.allowsUninitializedInput=!1,vRc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.OpDef;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.name=t.string();break;case 2:r.inputArg&&r.inputArg.length||(r.inputArg=[]),r.inputArg.push($root.tensorflow.OpDef.ArgDef.decode(t,t.uint32()));break;case 3:r.outputArg&&r.outputArg.length||(r.outputArg=[]),r.outputArg.push($root.tensorflow.OpDef.ArgDef.decode(t,t.uint32()));break;case 4:r.attr&&r.attr.length||(r.attr=[]),r.attr.push($root.tensorflow.OpDef.AttrDef.decode(t,t.uint32()));break;case 8:r.deprecation=$root.tensorflow.OpDef.OpDeprecation.decode(t,t.uint32());break;case 5:r.summary=t.string();break;case 6:r.description=t.string();break;case 18:r.isCommutative=t.bool();break;case 16:r.isAggregate=t.bool();break;case 17:r.isStateful=t.bool();break;case 19:r.allowsUninitializedInput=t.bool();break;default:t.skipType(7&i)}}return r},vRc.ArgDef=(ERc.prototype.name="",ERc.prototype.description="",ERc.prototype.type=0,ERc.prototype.typeAttr="",ERc.prototype.numberAttr="",ERc.prototype.typeListAttr="",ERc.prototype.isRef=!1,ERc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.OpDef.ArgDef;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.name=t.string();break;case 2:r.description=t.string();break;case 3:r.type=t.int32();break;case 4:r.typeAttr=t.string();break;case 5:r.numberAttr=t.string();break;case 6:r.typeListAttr=t.string();break;case 16:r.isRef=t.bool();break;default:t.skipType(7&i)}}return r},ERc),vRc.AttrDef=(NRc.prototype.name="",NRc.prototype.type="",NRc.prototype.defaultValue=null,NRc.prototype.description="",NRc.prototype.hasMinimum=!1,NRc.prototype.minimum=$util.Long?$util.Long.fromBits(0,0,!1):0,NRc.prototype.allowedValues=null,NRc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.OpDef.AttrDef;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.name=t.string();break;case 2:r.type=t.string();break;case 3:r.defaultValue=$root.tensorflow.AttrValue.decode(t,t.uint32());break;case 4:r.description=t.string();break;case 5:r.hasMinimum=t.bool();break;case 6:r.minimum=t.int64();break;case 7:r.allowedValues=$root.tensorflow.AttrValue.decode(t,t.uint32());break;default:t.skipType(7&i)}}return r},NRc),vRc.OpDeprecation=(WRc.prototype.version=0,WRc.prototype.explanation="",WRc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.OpDef.OpDeprecation;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.version=t.int32();break;case 2:r.explanation=t.string();break;default:t.skipType(7&i)}}return r},WRc),vRc),INc.OpList=(dSc.prototype.op=$util.emptyArray,dSc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.OpList;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.op&&r.op.length||(r.op=[]),r.op.push($root.tensorflow.OpDef.decode(t,t.uint32()));break;default:t.skipType(7&i)}}return r},dSc),INc.MetaGraphDef=(mSc.prototype.metaInfoDef=null,mSc.prototype.graphDef=null,mSc.prototype.saverDef=null,mSc.prototype.collectionDef=$util.emptyObject,mSc.prototype.signatureDef=$util.emptyObject,mSc.prototype.assetFileDef=$util.emptyArray,mSc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n,r=void 0===e?t.len:t.pos+e,i=new $root.tensorflow.MetaGraphDef;t.pos<r;){var o=t.uint32();switch(o>>>3){case 1:i.metaInfoDef=$root.tensorflow.MetaGraphDef.MetaInfoDef.decode(t,t.uint32());break;case 2:i.graphDef=$root.tensorflow.GraphDef.decode(t,t.uint32());break;case 3:i.saverDef=$root.tensorflow.SaverDef.decode(t,t.uint32());break;case 4:t.skip().pos++,i.collectionDef===$util.emptyObject&&(i.collectionDef={}),n=t.string(),t.pos++,i.collectionDef[n]=$root.tensorflow.CollectionDef.decode(t,t.uint32());break;case 5:t.skip().pos++,i.signatureDef===$util.emptyObject&&(i.signatureDef={}),n=t.string(),t.pos++,i.signatureDef[n]=$root.tensorflow.SignatureDef.decode(t,t.uint32());break;case 6:i.assetFileDef&&i.assetFileDef.length||(i.assetFileDef=[]),i.assetFileDef.push($root.tensorflow.AssetFileDef.decode(t,t.uint32()));break;default:t.skipType(7&o)}}return i},mSc.MetaInfoDef=(wSc.prototype.metaGraphVersion="",wSc.prototype.strippedOpList=null,wSc.prototype.anyInfo=null,wSc.prototype.tags=$util.emptyArray,wSc.prototype.tensorflowVersion="",wSc.prototype.tensorflowGitVersion="",wSc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.MetaGraphDef.MetaInfoDef;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.metaGraphVersion=t.string();break;case 2:r.strippedOpList=$root.tensorflow.OpList.decode(t,t.uint32());break;case 3:r.anyInfo=$root.tensorflow.Any.decode(t,t.uint32());break;case 4:r.tags&&r.tags.length||(r.tags=[]),r.tags.push(t.string());break;case 5:r.tensorflowVersion=t.string();break;case 6:r.tensorflowGitVersion=t.string();break;default:t.skipType(7&i)}}return r},wSc),mSc),INc.SavedModel=(FSc.prototype.savedModelSchemaVersion=$util.Long?$util.Long.fromBits(0,0,!1):0,FSc.prototype.metaGraphs=$util.emptyArray,FSc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.SavedModel;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.savedModelSchemaVersion=t.int64();break;case 2:r.metaGraphs&&r.metaGraphs.length||(r.metaGraphs=[]),r.metaGraphs.push($root.tensorflow.MetaGraphDef.decode(t,t.uint32()));break;default:t.skipType(7&i)}}return r},FSc),INc.FunctionDefLibrary=(OSc.prototype.function=$util.emptyArray,OSc.prototype.gradient=$util.emptyArray,OSc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.FunctionDefLibrary;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.function&&r.function.length||(r.function=[]),r.function.push($root.tensorflow.FunctionDef.decode(t,t.uint32()));break;case 2:r.gradient&&r.gradient.length||(r.gradient=[]),r.gradient.push($root.tensorflow.GradientDef.decode(t,t.uint32()));break;default:t.skipType(7&i)}}return r},OSc),INc.FunctionDef=(XSc.prototype.signature=null,XSc.prototype.attr=$util.emptyObject,XSc.prototype.nodeDef=$util.emptyArray,XSc.prototype.ret=$util.emptyObject,XSc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n,r=void 0===e?t.len:t.pos+e,i=new $root.tensorflow.FunctionDef;t.pos<r;){var o=t.uint32();switch(o>>>3){case 1:i.signature=$root.tensorflow.OpDef.decode(t,t.uint32());break;case 5:t.skip().pos++,i.attr===$util.emptyObject&&(i.attr={}),n=t.string(),t.pos++,i.attr[n]=$root.tensorflow.AttrValue.decode(t,t.uint32());break;case 3:i.nodeDef&&i.nodeDef.length||(i.nodeDef=[]),i.nodeDef.push($root.tensorflow.NodeDef.decode(t,t.uint32()));break;case 4:t.skip().pos++,i.ret===$util.emptyObject&&(i.ret={}),n=t.string(),t.pos++,i.ret[n]=t.string();break;default:t.skipType(7&o)}}return i},XSc),INc.GradientDef=(fTc.prototype.functionName="",fTc.prototype.gradientFunc="",fTc.decode=function(t,e){t instanceof $Reader||(t=$Reader.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new $root.tensorflow.GradientDef;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.functionName=t.string();break;case 2:r.gradientFunc=t.string();break;default:t.skipType(7&i)}}return r},fTc),INc);var compiled_api=$root,compiled_api_1=compiled_api.tensorflow;function getParamValue(t,e,n,r){var i=e.params[t];if(i&&void 0!==i.inputIndex){if("tensor"===i.type)return getTensor(e.inputNames[i.inputIndex],n,r);if("tensors"===i.type)return(0===i.inputIndex?0===i.inputParamLength?e.inputNames:e.inputNames.slice(i.inputIndex,-i.inputParamLength):e.inputNames.splice(i.inputIndex)).map(function(t){return getTensor(t,n,r)});var o=Array.prototype.slice.call(getTensor(e.inputNames.slice(i.inputIndex)[0],n,r).dataSync());return"number"===i.type?o[0]:o}return i&&i.value}function getTensor(t,e,n){var r=parseNodeName(t),i=r[0],o=r[1],a=n.currentContextIds.find(function(t){return!!e[getNodeNameWithContextId(i,t)]});return void 0!==a?e[getNodeNameWithContextId(i,a)][o]:void 0}function getTensorsForCurrentContenxt(t,e,n){return e[getNodeNameWithContextId(t,n.currentContextId)]}function getNodeNameAndIndex(t,e){var n=parseNodeName(t),r=n[0],i=n[1];return[getNodeNameWithContextId(r,e&&e.currentContextId),i]}function getNodeNameWithContextId(t,e){return e?t+"-"+e:t}function parseNodeName(t){var e=t.lastIndexOf(":");return-1===e?[t,0]:[t.substring(0,e),Number(t.substring(e+1))]}function split$1(t,e){for(var n=[],r=0;r<t.length;r+=e)n.push(t.slice(r,r+e));return n}var json=[{tfOpName:"Add",dlOpName:"add",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddN",dlOpName:"addN",category:"arithmetic",params:[{tfInputIndex:0,tfInputParamLength:0,dlParamName:"tensors",type:"tensors"}]},{tfOpName:"BiasAdd",dlOpName:"add",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sub",dlOpName:"sub",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"RealDiv",dlOpName:"div",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Div",dlOpName:"div",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorDiv",dlOpName:"floorDiv",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mul",dlOpName:"mul",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Maximum",dlOpName:"maximum",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"}]},{tfOpName:"Minimum",dlOpName:"minimum",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"}]},{tfOpName:"Pow",dlOpName:"pow",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SquaredDifference",dlOpName:"squaredDifference",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mod",dlOpName:"mod",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorMod",dlOpName:"mod",category:"arithmetic",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]}],arithmetic=Object.freeze({json:json}),json$1=[{tfOpName:"Abs",dlOpName:"abs",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acos",dlOpName:"acos",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asin",dlOpName:"asin",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan",dlOpName:"atan",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan2",dlOpName:"atan2",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"y",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ceil",dlOpName:"ceil",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ClipByValue",dlOpName:"clipByValue",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"clip_value_min",dlParamName:"clipValueMin",type:"number"},{tfParamName:"clip_value_max",dlParamName:"clipValueMax",type:"number"}]},{tfOpName:"Cos",dlOpName:"cos",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cosh",dlOpName:"cosh",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Elu",dlOpName:"elu",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Exp",dlOpName:"exp",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Floor",dlOpName:"floor",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log",dlOpName:"log",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Neg",dlOpName:"neg",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu",dlOpName:"relu",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu6",dlOpName:"clipByValue",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0},{dlParamName:"clipValueMin",type:"number",defaultValue:0},{dlParamName:"clipValueMax",type:"number",defaultValue:6}]},{tfOpName:"Selu",dlOpName:"selu",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sigmoid",dlOpName:"sigmoid",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sin",dlOpName:"sin",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sinh",dlOpName:"sinh",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sqrt",dlOpName:"sqrt",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Rsqrt",dlOpName:"rsqrt",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Square",dlOpName:"square",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tan",dlOpName:"tan",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tanh",dlOpName:"tanh",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sign",dlOpName:"sign",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Round",dlOpName:"round",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Expm1",dlOpName:"expm1",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log1p",dlOpName:"log1p",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",dlOpName:"reciprocal",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",dlOpName:"reciprocal",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Softplus",dlOpName:"softplus",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asinh",dlOpName:"asinh",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acosh",dlOpName:"acosh",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atanh",dlOpName:"atanh",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Erf",dlOpName:"erf",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Prod",dlOpName:"prod",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axes",type:"number[]"},{tfParamName:"keep_dims",dlParamName:"keepDims",type:"bool",notSupported:!0},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LeakyRelu",dlOpName:"leakyRelu",category:"basic_math",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"alpha",dlParamName:"alpha",type:"number",defaultValue:.2},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]}],basicMath=Object.freeze({json:json$1}),json$2=[{tfOpName:"LoopCond",dlOpName:"loopCond",category:"control",params:[{tfInputIndex:0,dlParamName:"pred",type:"tensor"}]},{tfOpName:"Switch",dlOpName:"switch",category:"control",params:[{tfInputIndex:0,dlParamName:"data",type:"tensor"},{tfInputIndex:1,dlParamName:"pred",type:"tensor"}]},{tfOpName:"Merge",dlOpName:"merge",category:"control",params:[{tfInputIndex:0,tfInputParamLength:0,dlParamName:"tensors",type:"tensors"}]},{tfOpName:"Enter",dlOpName:"enter",category:"control",params:[{tfInputIndex:0,dlParamName:"tensor",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0},{tfParamName:"frame_name",dlParamName:"frameName",type:"string"},{tfParamName:"is_constant",dlParamName:"isConstant",type:"bool"}]},{tfOpName:"Exit",dlOpName:"exit",category:"control",params:[{tfInputIndex:0,dlParamName:"tensor",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NextIteration",dlOpName:"nextIteration",category:"control",params:[{tfInputIndex:0,dlParamName:"tensor",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayV3",dlOpName:"tensorArray",category:"control",params:[{tfInputIndex:0,dlParamName:"size",type:"number"},{tfParamName:"dtype",dlParamName:"dtype",type:"dtype"},{tfParamName:"element_shape",dlParamName:"elementShape",type:"shape"},{tfParamName:"dynamic_size",dlParamName:"dynamicSize",type:"bool"},{tfParamName:"clear_after_read",dlParamName:"clearAfterRead",type:"bool"},{tfParamName:"identical_element_shapes",dlParamName:"identicalElementShapes",type:"bool"},{tfParamName:"tensor_array_name",dlParamName:"name",type:"string"}]},{tfOpName:"TensorArrayWriteV3",dlOpName:"tensorArrayWrite",category:"control",params:[{tfInputIndex:0,dlParamName:"tensorArrayId",type:"number"},{tfInputIndex:1,dlParamName:"index",type:"number"},{tfInputIndex:2,dlParamName:"tensor",type:"tensor"},{tfInputIndex:3,dlParamName:"flowIn",type:"number"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayReadV3",dlOpName:"tensorArrayRead",category:"control",params:[{tfInputIndex:0,dlParamName:"tensorArrayId",type:"number"},{tfInputIndex:1,dlParamName:"index",type:"number"},{tfInputIndex:2,dlParamName:"flowIn",type:"number"},{tfParamName:"dtype",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayGatherV3",dlOpName:"tensorArrayGather",category:"control",params:[{tfInputIndex:0,dlParamName:"tensorArrayId",type:"number"},{tfInputIndex:1,dlParamName:"indices",type:"number[]"},{tfInputIndex:2,dlParamName:"flowIn",type:"number"},{tfParamName:"dtype",dlParamName:"dtype",type:"dtype"},{tfParamName:"element_shape",dlParamName:"elementShape",type:"shape"}]},{tfOpName:"TensorArrayScatterV3",dlOpName:"tensorArrayScatter",category:"control",params:[{tfInputIndex:0,dlParamName:"tensorArrayId",type:"number"},{tfInputIndex:1,dlParamName:"indices",type:"number[]"},{tfInputIndex:2,dlParamName:"tensor",type:"tensor"},{tfInputIndex:3,dlParamName:"flowIn",type:"number"},{tfParamName:"T",dlParamName:"dtype",type:"dtype"}]},{tfOpName:"TensorArrayConcatV3",dlOpName:"tensorArrayConcat",category:"control",params:[{tfInputIndex:0,dlParamName:"tensorArrayId",type:"number"},{tfInputIndex:1,dlParamName:"flowIn",type:"number"},{tfParamName:"dtype",dlParamName:"dtype",type:"dtype"},{tfParamName:"element_shape_except0",dlParamName:"elementShapeExcept0",type:"shape",notSupported:!0}]},{tfOpName:"TensorArraySplitV3",dlOpName:"tensorArraySplit",category:"control",params:[{tfInputIndex:0,dlParamName:"tensorArrayId",type:"number"},{tfInputIndex:1,dlParamName:"tensor",type:"tensor"},{tfInputIndex:2,dlParamName:"lengths",type:"number[]"},{tfInputIndex:3,dlParamName:"flowIn",type:"number"},{tfParamName:"T",dlParamName:"dtype",type:"dtype"}]},{tfOpName:"TensorArraySizeV3",dlOpName:"tensorArraySize",category:"control",params:[{tfInputIndex:0,dlParamName:"tensorArrayId",type:"number"},{tfInputIndex:1,dlParamName:"flowIn",type:"number"}]},{tfOpName:"TensorArrayCloseV3",dlOpName:"tensorArrayClose",category:"control",params:[{tfInputIndex:0,dlParamName:"tensorArrayId",type:"number"}]}],control=Object.freeze({json:json$2}),json$3=[{tfOpName:"AvgPool",dlOpName:"avgPool",category:"convolution",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"strides",dlParamName:"strides",type:"number[]"},{tfParamName:"padding",dlParamName:"pad",type:"string"},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",notSupported:!0},{tfParamName:"ksize",dlParamName:"kernelSize",type:"number[]"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool",dlOpName:"maxPool",category:"convolution",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"strides",dlParamName:"strides",type:"number[]"},{tfParamName:"padding",dlParamName:"pad",type:"string"},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",notSupported:!0},{tfParamName:"ksize",dlParamName:"kernelSize",type:"number[]"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Conv1D",dlOpName:"conv1d",category:"convolution",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"filter",type:"tensor"},{tfParamName:"stride",dlParamName:"stride",type:"number"},{tfParamName:"padding",dlParamName:"pad",type:"string"},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",defaultValue:"NWC"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0},{tfParamName:"dilation",dlParamName:"dilation",type:"number",defaultValue:1}]},{tfOpName:"Conv2D",dlOpName:"conv2d",category:"convolution",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"filter",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0},{tfParamName:"strides",dlParamName:"strides",type:"number[]"},{tfParamName:"padding",dlParamName:"pad",type:"string"},{tfParamName:"useCudnnOnGpu",dlParamName:"useCudnnOnGpu",type:"bool"},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",defaultValue:"NHWC"},{tfParamName:"dilations",dlParamName:"dilations",type:"number[]"}]},{tfOpName:"Conv2DBackpropInput",dlOpName:"conv2dTranspose",category:"convolution",params:[{tfInputIndex:2,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"filter",type:"tensor"},{tfInputIndex:0,dlParamName:"outputShape",type:"number[]"},{tfParamName:"strides",dlParamName:"strides",type:"number[]"},{tfParamName:"padding",dlParamName:"pad",type:"string"},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"DepthwiseConv2d",dlOpName:"depthwiseConv2d",category:"convolution",params:[{tfInputIndex:0,dlParamName:"input",type:"tensor"},{tfInputIndex:1,dlParamName:"filter",type:"tensor"},{tfParamName:"strides",dlParamName:"strides",type:"number[]"},{tfParamName:"padding",dlParamName:"pad",type:"string"},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",defaultValue:"NHWC"},{tfParamName:"dilations",dlParamName:"dilations",type:"number[]"}]},{tfOpName:"DepthwiseConv2dNative",dlOpName:"depthwiseConv2d",category:"convolution",params:[{tfInputIndex:0,dlParamName:"input",type:"tensor"},{tfInputIndex:1,dlParamName:"filter",type:"tensor"},{tfParamName:"strides",dlParamName:"strides",type:"number[]"},{tfParamName:"padding",dlParamName:"pad",type:"string"},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",defaultValue:"NHWC"},{tfParamName:"dilations",dlParamName:"dilations",type:"number[]"}]}],convolution=Object.freeze({json:json$3}),json$4=[{tfOpName:"Fill",dlOpName:"fill",category:"creation",params:[{tfInputIndex:0,dlParamName:"shape",type:"number[]"},{tfInputIndex:1,dlParamName:"value",type:"number"},{tfParamName:"T",dlParamName:"dtype",type:"dtype"}]},{tfOpName:"LinSpace",dlOpName:"linspace",category:"creation",params:[{tfInputIndex:0,dlParamName:"start",type:"number"},{tfInputIndex:1,dlParamName:"stop",type:"number"},{tfInputIndex:2,dlParamName:"num",type:"number"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"OneHot",dlOpName:"oneHot",category:"creation",params:[{tfInputIndex:0,dlParamName:"indices",type:"tensor"},{tfInputIndex:1,dlParamName:"depth",type:"number"},{tfInputIndex:2,dlParamName:"onValue",type:"number",defaultValue:1},{tfInputIndex:3,dlParamName:"offValue",type:"number",defaultValue:0},{tfParamName:"axis",dlParamName:"axis",type:"number",notSupported:!0},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ones",dlOpName:"ones",category:"creation",params:[{tfInputIndex:0,dlParamName:"shape",type:"number[]"},{tfParamName:"T",dlParamName:"dtype",type:"dtype"}]},{tfOpName:"OnesLike",dlOpName:"onesLike",category:"creation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"dtype",dlParamName:"dtype",type:"dtype"}]},{tfOpName:"RandomUniform",dlOpName:"randomUniform",category:"creation",params:[{tfInputIndex:0,dlParamName:"shape",type:"number[]"},{tfParamName:"minval",dlParamName:"minval",type:"number",defaultValue:0},{tfParamName:"maxval",dlParamName:"maxval",type:"number",defaultValue:1},{tfParamName:"dtype",dlParamName:"dtype",type:"dtype"},{tfParamName:"seed",dlParamName:"seed",type:"number",defaultValue:0},{tfParamName:"seed2",dlParamName:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfParamName:"T",dlParamName:"T",type:"number",notSupported:!0}]},{tfOpName:"Range",dlOpName:"range",category:"creation",params:[{tfInputIndex:0,dlParamName:"start",type:"number"},{tfInputIndex:1,dlParamName:"stop",type:"number"},{tfInputIndex:2,dlParamName:"step",type:"number",defaultValue:0},{tfParamName:"Tidx",dlParamName:"dtype",type:"dtype"}]},{tfOpName:"truncatedNormal",dlOpName:"truncatedNormal",category:"creation",params:[{tfInputIndex:0,dlParamName:"shape",type:"number[]"},{tfParamName:"means",dlParamName:"mean",type:"number",defaultValue:0},{tfParamName:"stddev",dlParamName:"stdDev",type:"number",defaultValue:1},{tfParamName:"seed",dlParamName:"seed",type:"number"},{tfParamName:"seed2",dlParamName:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfParamName:"dtype",dlParamName:"dtype",type:"dtype"},{tfParamName:"T",dlParamName:"T",type:"number",notSupported:!0}]},{tfOpName:"Zeros",dlOpName:"zeros",category:"creation",params:[{tfInputIndex:0,dlParamName:"shape",type:"number[]"},{tfParamName:"T",dlParamName:"dtype",type:"dtype"}]},{tfOpName:"ZerosLike",dlOpName:"zerosLike",category:"creation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype"}]}],creation=Object.freeze({json:json$4}),json$5=[{tfOpName:"NonMaxSuppressionV2",dlOpName:"nonMaxSuppression",category:"dynamic",params:[{tfInputIndex:0,dlParamName:"boxes",type:"tensor"},{tfInputIndex:1,dlParamName:"scores",type:"tensor"},{tfInputIndex:2,dlParamName:"maxOutputSize",type:"number"},{tfInputIndex:3,dlParamName:"iouThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV3",dlOpName:"nonMaxSuppression",category:"dynamic",params:[{tfInputIndex:0,dlParamName:"boxes",type:"tensor"},{tfInputIndex:1,dlParamName:"scores",type:"tensor"},{tfInputIndex:2,dlParamName:"maxOutputSize",type:"number"},{tfInputIndex:3,dlParamName:"iouThreshold",type:"number"},{tfInputIndex:4,dlParamName:"scoreThreshold",type:"number"}]},{tfOpName:"Where",dlOpName:"whereAsync",category:"dynamic",params:[{tfInputIndex:0,dlParamName:"condition",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ListDiff",dlOpName:"setdiff1dAsync",category:"dynamic",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"y",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]}],dynamic=Object.freeze({json:json$5}),json$6=[{tfOpName:"TopKV2",dlOpName:"topK",category:"evaluation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"k",type:"number"},{tfParamName:"sorted",dlParamName:"sorted",type:"bool"}]}],evaluation=Object.freeze({json:json$6}),json$7=[{tfOpName:"PlaceholderWithDefault",dlOpName:"placeholder",category:"graph",params:[{tfInputIndex:0,dlParamName:"default",type:"tensor"},{tfParamName:"shape",dlParamName:"shape",type:"shape"},{tfParamName:"dtype",dlParamName:"dtype",type:"dtype"}]},{tfOpName:"Placeholder",dlOpName:"placeholder",category:"graph",params:[{tfParamName:"shape",dlParamName:"shape",type:"shape"},{tfParamName:"dtype",dlParamName:"dtype",type:"dtype"}]},{tfOpName:"Const",dlOpName:"const",category:"graph"},{tfOpName:"Identity",dlOpName:"identity",category:"graph",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"}]},{tfOpName:"Snapshot",dlOpName:"snapshot",category:"graph",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"}]},{tfOpName:"Rank",dlOpName:"rank",category:"graph",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"}]},{tfOpName:"Size",dlOpName:"size",category:"graph",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"}]},{tfOpName:"Shape",dlOpName:"shape",category:"graph",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"}]},{tfOpName:"ShapeN",dlOpName:"shapeN",category:"graph",params:[{tfInputIndex:0,tfInputParamLength:0,dlParamName:"x",type:"tensors"}]},{tfOpName:"Print",dlOpName:"print",category:"graph",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,tfInputParamLength:1,dlParamName:"data",type:"tensors"},{tfParamName:"message",dlParamName:"message",type:"string"},{tfParamName:"first_n",dlParamName:"firstN",type:"number",notSupprted:!0},{tfParamName:"summarize",dlParamName:"summarize",type:"number",defaultValue:3}]},{tfOpName:"NoOp",dlOpName:"noop",category:"graph",params:[]},{tfOpName:"StopGradient",dlOpName:"stopGradient",category:"graph",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"}]},{tfOpName:"FakeQuantWithMinMaxVars",dlOpName:"fakeQuantWithMinMaxVars",category:"graph",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"min",dlParamName:"min",type:"number"},{tfParamName:"max",dlParamName:"max",type:"number"}]}],graph=Object.freeze({json:json$7}),json$8=[{tfOpName:"ResizeBilinear",dlOpName:"resizeBilinear",category:"image",params:[{tfInputIndex:0,dlParamName:"images",type:"tensor"},{tfInputIndex:1,dlParamName:"size",type:"number[]"},{tfParamName:"align_corners",dlParamName:"alignCorners",type:"bool"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ResizeNearestNeighbor",dlOpName:"resizeNearestNeighbor",category:"image",params:[{tfInputIndex:0,dlParamName:"images",type:"tensor"},{tfInputIndex:1,dlParamName:"size",type:"number[]"},{tfParamName:"align_corners",dlParamName:"alignCorners",type:"bool"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"CropAndResize",dlOpName:"cropAndResize",category:"image",params:[{tfInputIndex:0,dlParamName:"image",type:"tensor"},{tfInputIndex:1,dlParamName:"boxes",type:"tensor"},{tfInputIndex:2,dlParamName:"boxInd",type:"tensor"},{tfInputIndex:3,dlParamName:"cropSize",type:"number[]"},{tfParamName:"method",dlParamName:"method",type:"string"},{tfParamName:"extrapolation_value",dlParamName:"extrapolationValue",type:"number"}]}],image$1=Object.freeze({json:json$8}),json$9=[{tfOpName:"Equal",dlOpName:"equal",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NotEqual",dlOpName:"notEqual",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Greater",dlOpName:"greater",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"GreaterEqual",dlOpName:"greaterEqual",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Less",dlOpName:"less",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LessEqual",dlOpName:"lessEqual",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalAnd",dlOpName:"logicalAnd",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalNot",dlOpName:"logicalNot",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalOr",dlOpName:"logicalOr",category:"logical",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Select",dlOpName:"where",category:"logical",params:[{tfInputIndex:0,dlParamName:"condition",type:"tensor"},{tfInputIndex:1,dlParamName:"a",type:"tensor"},{tfInputIndex:2,dlParamName:"b",type:"tensor"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]}],logical=Object.freeze({json:json$9}),json$10=[{tfOpName:"MatMul",dlOpName:"matMul",category:"matrices",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"transpose_a",dlParamName:"transposeA",type:"bool",defaultValue:!1},{tfParamName:"transpose_b",dlParamName:"transposeB",type:"bool",defaultValue:!1},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMul",dlOpName:"matMul",category:"matrices",params:[{tfInputIndex:0,dlParamName:"a",type:"tensor"},{tfInputIndex:1,dlParamName:"b",type:"tensor"},{tfParamName:"adj_x",dlParamName:"transposeA",type:"bool",defaultValue:!1},{tfParamName:"adj_y",dlParamName:"transposeB",type:"bool",defaultValue:!1},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Transpose",dlOpName:"transpose",category:"matrices",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"perm",type:"number[]"},{tfParamName:"T",dlParamName:"dtype",type:"dtype",notSupported:!0}]}],matrices=Object.freeze({json:json$10}),json$11=[{tfOpName:"FusedBatchNorm",dlOpName:"batchNormalization",category:"normalization",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"scale",type:"tensor"},{tfInputIndex:2,dlParamName:"offset",type:"tensor"},{tfInputIndex:3,dlParamName:"mean",type:"tensor"},{tfInputIndex:4,dlParamName:"variance",type:"tensor"},{tfParamName:"epsilon",dlParamName:"epsilon",type:"number",defaultValue:.001},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV2",dlOpName:"batchNormalization",category:"normalization",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"scale",type:"tensor"},{tfInputIndex:2,dlParamName:"offset",type:"tensor"},{tfInputIndex:3,dlParamName:"mean",type:"tensor"},{tfInputIndex:4,dlParamName:"variance",type:"tensor"},{tfParamName:"epsilon",dlParamName:"epsilon",type:"number",defaultValue:.001},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"LRN",dlOpName:"localResponseNormalization",category:"normalization",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"depth_radius",dlParamName:"radius",type:"number",defaultValue:5},{tfParamName:"bias",dlParamName:"bias",type:"number",defaultValue:1},{tfParamName:"alpha",dlParamName:"alpha",type:"number",defaultValue:1},{tfParamName:"beta",dlParamName:"beta",type:"number",defaultValue:.5}]},{tfOpName:"Softmax",dlOpName:"softmax",category:"normalization",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"}]},{tfOpName:"LogSoftmax",dlOpName:"logSoftmax",category:"normalization",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"}]},{tfOpName:"SparseToDense",dlOpName:"sparseToDense",category:"normalization",params:[{tfInputIndex:0,dlParamName:"sparseIndices",type:"tensor"},{tfInputIndex:1,dlParamName:"outputShape",type:"number[]"},{tfInputIndex:2,dlParamName:"sparseValues",type:"tensor"},{tfInputIndex:3,dlParamName:"defaultValue",type:"tensor"},{tfParamName:"validate_indices",dlParamName:"validateIndices",type:"bool",defaultValue:!0,notSupported:!0}]}],normalization=Object.freeze({json:json$11}),json$12=[{tfOpName:"Max",dlOpName:"max",category:"reduction",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number[]"},{tfParamName:"keep_dims",dlParamName:"keepDims",type:"bool"}]},{tfOpName:"Mean",dlOpName:"mean",category:"reduction",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number[]"},{tfParamName:"keep_dims",dlParamName:"keepDims",type:"bool"}]},{tfOpName:"Min",dlOpName:"min",category:"reduction",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number[]"},{tfParamName:"keep_dims",dlParamName:"keepDims",type:"bool"}]},{tfOpName:"Sum",dlOpName:"sum",category:"reduction",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number[]"},{tfParamName:"keep_dims",dlParamName:"keepDims",type:"bool"}]},{tfOpName:"All",dlOpName:"all",category:"reduction",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number[]"},{tfParamName:"keep_dims",dlParamName:"keepDims",type:"bool"}]},{tfOpName:"Any",dlOpName:"any",category:"reduction",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number[]"},{tfParamName:"keep_dims",dlParamName:"keepDims",type:"bool"}]},{tfOpName:"ArgMax",dlOpName:"argMax",category:"reduction",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number"}]},{tfOpName:"ArgMin",dlOpName:"argMin",category:"reduction",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number"}]},{tfOpName:"Prod",dlOpName:"prod",category:"reduction",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number[]"},{tfParamName:"keep_dims",dlParamName:"keepDims",type:"bool"}]}],reduction=Object.freeze({json:json$12}),json$13=[{tfOpName:"ConcatV2",dlOpName:"concat",category:"slice_join",params:[{tfInputIndex:0,tfInputParamLength:1,dlParamName:"tensors",type:"tensors"},{tfInputIndex:-1,dlParamName:"axis",type:"number"}]},{tfOpName:"Concat",dlOpName:"concat",category:"slice_join",params:[{tfInputIndex:1,tfInputParamLength:1,dlParamName:"tensors",type:"tensors"},{tfInputIndex:0,dlParamName:"axis",type:"number"}]},{tfOpName:"GatherV2",dlOpName:"gather",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"indices",type:"tensor"},{tfInputIndex:2,dlParamName:"axis",type:"number",defaultValue:0}]},{tfOpName:"Gather",dlOpName:"gather",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"indices",type:"tensor"},{tfParamName:"axis",dlParamName:"axis",type:"number",defaultValue:0},{tfParamName:"validate_indices",dlParamName:"validateIndices",type:"bool",notSupported:!0}]},{tfOpName:"Reverse",dlOpName:"reverse",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"dims",type:"bool",notSupported:!0}]},{tfOpName:"ReverseV2",dlOpName:"reverse",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"axis",type:"number[]"}]},{tfOpName:"Slice",dlOpName:"slice",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"begin",type:"number[]"},{tfInputIndex:2,dlParamName:"size",type:"number[]"}]},{tfOpName:"StridedSlice",dlOpName:"stridedSlice",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"begin",type:"number[]"},{tfInputIndex:2,dlParamName:"end",type:"number[]"},{tfInputIndex:3,dlParamName:"strides",type:"number[]"},{tfParamName:"begin_mask",dlParamName:"beginMask",type:"number",defaultValue:0},{tfParamName:"end_mask",dlParamName:"endMask",type:"number",defaultValue:0},{tfParamName:"new_axis_mask",dlParamName:"newAxisMask",type:"number",defaultValue:0},{tfParamName:"ellipsis_mask",dlParamName:"ellipsisMask",type:"number",defaultValue:0},{tfParamName:"shrink_axis_mask",dlParamName:"shrinkAxisMask",type:"number",defaultValue:0}]},{tfOpName:"Pack",dlOpName:"stack",category:"slice_join",params:[{tfInputIndex:0,tfInputParamLength:0,dlParamName:"tensors",type:"tensors"},{tfParamName:"axis",dlParamName:"axis",type:"number",defaultValue:0}]},{tfOpName:"Unpack",dlOpName:"unstack",category:"slice_join",params:[{tfInputIndex:0,tfInputParamLength:0,dlParamName:"tensor",type:"tensor"},{tfParamName:"axis",dlParamName:"axis",type:"number",defaultValue:0},{tfParamName:"num",dlParamName:"num",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Tile",dlOpName:"tile",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"reps",type:"number[]"}]},{tfOpName:"Split",dlOpName:"split",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"axis",type:"number",defaultValue:0},{tfInputIndex:1,dlParamName:"x",type:"tensor"},{tfParamName:"num_split",dlParamName:"numOrSizeSplits",type:"number",defaultValue:1}]},{tfOpName:"SplitV",dlOpName:"split",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"numOrSizeSplits",type:"number[]"},{tfInputIndex:2,dlParamName:"axis",type:"number",defaultValue:0}]},{tfOpName:"ScatterNd",dlOpName:"scatterNd",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"indices",type:"tensor"},{tfInputIndex:1,dlParamName:"values",type:"tensor"},{tfInputIndex:2,dlParamName:"shape",type:"number[]"}]},{tfOpName:"GatherNd",dlOpName:"gatherNd",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"indices",type:"tensor"}]},{tfOpName:"SparseToDense",dlOpName:"sparseToDense",category:"slice_join",params:[{tfInputIndex:0,dlParamName:"sparseIndices",type:"tensor"},{tfInputIndex:1,dlParamName:"outputShape",type:"number[]"},{tfInputIndex:2,dlParamName:"sparseValues",type:"tensor"},{tfInputIndex:3,dlParamName:"defaultValue",type:"tensor"},{tfParamName:"validate_indices",dlParamName:"validateIndices",type:"bool",defaultValue:!1,notSupported:!0}]}],sliceJoin=Object.freeze({json:json$13}),json$14=[{tfOpName:"FFT",dlOpName:"fft",category:"spectral",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"}]},{tfOpName:"IFFT",dlOpName:"ifft",category:"spectral",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"}]},{tfOpName:"RFFT",dlOpName:"rfft",category:"spectral",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"fft_length",type:"number",unsupported:!0}]},{tfOpName:"IRFFT",dlOpName:"irfft",category:"spectral",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"fft_length",type:"number",unsupported:!0}]}],spectral=Object.freeze({json:json$14}),json$15=[{tfOpName:"Cast",dlOpName:"cast",category:"transformation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"SrcT",dlParamName:"sdtype",type:"dtype",notSupported:!0},{tfParamName:"DstT",dlParamName:"dtype",type:"dtype"}]},{tfOpName:"ExpandDims",dlOpName:"expandDims",category:"transformation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,tfParamNameDeprecated:"dim",dlParamName:"axis",type:"number"}]},{tfOpName:"Pad",dlOpName:"pad",category:"transformation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"padding",type:"number[]"},{tfParamName:"constant_value",dlParamName:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"PadV2",dlOpName:"pad",category:"transformation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"padding",type:"number[]"},{tfInputIndex:2,dlParamName:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"Reshape",dlOpName:"reshape",category:"transformation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"shape",type:"number[]"}]},{tfOpName:"Squeeze",dlOpName:"squeeze",category:"transformation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"axis",tfParamNameDeprecated:"squeeze_dims",dlParamName:"axis",type:"number[]"}]},{tfOpName:"SpaceToBatchND",dlOpName:"spaceToBatchND",category:"transformation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"blockShape",type:"number[]"},{tfInputIndex:2,dlParamName:"paddings",type:"number[]"}]},{tfOpName:"BatchToSpaceND",dlOpName:"batchToSpaceND",category:"transformation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfInputIndex:1,dlParamName:"blockShape",type:"number[]"},{tfInputIndex:2,dlParamName:"crops",type:"number[]"}]},{tfOpName:"DepthToSpace",dlOpName:"depthToSpace",category:"transformation",params:[{tfInputIndex:0,dlParamName:"x",type:"tensor"},{tfParamName:"block_size",dlParamName:"blockSize",type:"number"},{tfParamName:"data_format",dlParamName:"dataFormat",type:"string"}]}],transformation=Object.freeze({json:json$15}),CONTROL_FLOW_OPS=["Switch","Merge","Enter","Exit","NextIteration"],DYNAMIC_SHAPE_OPS=["NonMaxSuppressionV2","NonMaxSuppressionV3","Where"],OperationMapper=(Object.defineProperty(TTc,"Instance",{get:function(){return this._instance||(this._instance=new this)},enumerable:!0,configurable:!0}),TTc.prototype.isControlFlow=function(e){return CONTROL_FLOW_OPS.some(function(t){return t===e.op})},TTc.prototype.isDynamicShape=function(e){return DYNAMIC_SHAPE_OPS.some(function(t){return t===e.op})},TTc.prototype.transformGraph=function(t){var n=this,r=!1,i=!1,o=[],a=[],s=t.node.reduce(function(t,e){return t[e.name]=n.mapNode(e),n.isControlFlow(e)&&(r=!0),n.isDynamicShape(e)&&(i=!0),"Placeholder"===e.op&&o.push(t[e.name]),"Const"===e.op&&a.push(t[e.name]),t},{}),e=[],u=[];return Object.keys(s).forEach(function(t){var n=s[t];n.inputNames.forEach(function(t){var e=getNodeNameAndIndex(t)[0];n.inputs.push(s[e]),s[e].children.push(n)}),0===n.inputs.length&&e.push(n)}),Object.keys(s).forEach(function(t){var e=s[t];0===e.children.length&&u.push(e)}),{nodes:s,inputs:e,outputs:u,weights:a,placeholders:o,withControlFlow:r,withDynamicShape:i}},TTc.prototype.mapNode=function(a){var s=this,t=this.opMappers[a.op];if(void 0===t)throw new Error("Tensorflow Op is not supported: "+a.op);var e={name:a.name,op:t.dlOpName,category:t.category,inputNames:(a.input||[]).map(function(t){return t.startsWith("^")?t.substr(1):t}),inputs:[],children:[],params:{}};return t.params&&(e.params=t.params.reduce(function(t,e){var n=e.tfInputIndex,r=e.tfInputParamLength,i=e.type,o=void 0;if(void 0===n)switch(e.type){case"string":void 0===(o=s.getStringParam(a.attr,e.tfParamName,e.defaultValue))&&e.tfParamNameDeprecated&&(o=s.getStringParam(a.attr,e.tfParamNameDeprecated,e.defaultValue));break;case"number":void 0===(o=s.getNumberParam(a.attr,e.tfParamName,e.defaultValue||0))&&e.tfParamNameDeprecated&&(o=s.getNumberParam(a.attr,e.tfParamNameDeprecated,e.defaultValue));break;case"number[]":void 0===(o=s.getNumericArrayParam(a.attr,e.tfParamName,e.defaultValue))&&e.tfParamNameDeprecated&&(o=s.getNumericArrayParam(a.attr,e.tfParamNameDeprecated,e.defaultValue));break;case"bool":void 0===(o=s.getBoolParam(a.attr,e.tfParamName,e.defaultValue))&&e.tfParamNameDeprecated&&(o=s.getBoolParam(a.attr,e.tfParamNameDeprecated,e.defaultValue));break;case"shape":void 0===(o=s.getTensorShapeParam(a.attr,e.tfParamName,e.defaultValue))&&e.tfParamNameDeprecated&&(o=s.getTensorShapeParam(a.attr,e.tfParamNameDeprecated,e.defaultValue));break;case"dtype":void 0===(o=s.getDtypeParam(a.attr,e.tfParamName,e.defaultValue))&&e.tfParamNameDeprecated&&(o=s.getDtypeParam(a.attr,e.tfParamNameDeprecated,e.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error("Unsupported param type: "+e.type+" for op: "+a.op)}return t[e.dlParamName]={value:o,inputIndex:n,type:i,inputParamLength:r},t},{})),e},TTc.prototype.getStringParam=function(t,e,n,r){void 0===r&&(r=!1);var i=t[e];if(void 0===i)return n;var o=String.fromCharCode.apply(null,i.s);return r?o:o.toLowerCase()},TTc.prototype.getBoolParam=function(t,e,n){var r=t[e];return r?r.b:n},TTc.prototype.getNumberParam=function(t,e,n){var r=t[e],i=r?r[r.value]:n;return"number"==typeof i?i:i.toInt()},TTc.prototype.getDtypeParam=function(t,e,n){var r=t[e];if(r&&r.type)switch(r.type){case compiled_api_1.DataType.DT_FLOAT:return"float32";case compiled_api_1.DataType.DT_INT32:return"int32";case compiled_api_1.DataType.DT_BOOL:return"bool";default:return n}return n},TTc.prototype.getTensorShapeParam=function(t,e,n){var r=t[e];return r&&r.shape?r.shape.dim.map(function(t){return"number"==typeof t.size?t.size:t.size.toInt()}):n},TTc.prototype.getNumericArrayParam=function(t,e,n){var r=t[e];return r?(r.list.f&&r.list.f.length?r.list.f:r.list.i).map(function(t){return"number"==typeof t?t:t.toInt()}):n},TTc),executeOp=function(t,e,n){switch(t.op){case"add":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.u)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];case"addN":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.v)(getParamValue("tensors",t,e,n))];case"mod":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Dc)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];case"mul":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Hc)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];case"div":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.sb)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];case"floorDiv":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Ib)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];case"sub":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.be)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];case"minimum":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Bc)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];case"maximum":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.wc)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];case"pow":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.bd)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];case"squaredDifference":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Vd)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];default:throw TypeError("Node type "+t.op+" is not implemented")}},executeOp$1=function(t,e,n){switch(t.op){case"abs":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.r)(getParamValue("x",t,e,n))];case"acos":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.s)(getParamValue("x",t,e,n))];case"acosh":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.t)(getParamValue("x",t,e,n))];case"asin":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.B)(getParamValue("x",t,e,n))];case"asinh":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.C)(getParamValue("x",t,e,n))];case"atan":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.D)(getParamValue("x",t,e,n))];case"atan2":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.E)(getParamValue("x",t,e,n),getParamValue("y",t,e,n))];case"atanh":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.F)(getParamValue("x",t,e,n))];case"ceil":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.U)(getParamValue("x",t,e,n))];case"cos":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ib)(getParamValue("x",t,e,n))];case"cosh":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.jb)(getParamValue("x",t,e,n))];case"elu":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.vb)(getParamValue("x",t,e,n))];case"erf":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Ab)(getParamValue("x",t,e,n))];case"exp":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Bb)(getParamValue("x",t,e,n))];case"expm1":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Db)(getParamValue("x",t,e,n))];case"floor":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Hb)(getParamValue("x",t,e,n))];case"log":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ic)(getParamValue("x",t,e,n))];case"log1p":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.jc)(getParamValue("x",t,e,n))];case"neg":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Lc)(getParamValue("x",t,e,n))];case"reciprocal":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.md)(getParamValue("x",t,e,n))];case"relu":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.nd)(getParamValue("x",t,e,n))];case"round":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.vd)(getParamValue("x",t,e,n))];case"selu":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.zd)(getParamValue("x",t,e,n))];case"sigmoid":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Ed)(getParamValue("x",t,e,n))];case"sin":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Gd)(getParamValue("x",t,e,n))];case"sign":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Fd)(getParamValue("x",t,e,n))];case"sinh":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Hd)(getParamValue("x",t,e,n))];case"softplus":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Od)(getParamValue("x",t,e,n))];case"sqrt":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Td)(getParamValue("x",t,e,n))];case"square":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Ud)(getParamValue("x",t,e,n))];case"tanh":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.fe)(getParamValue("x",t,e,n))];case"tan":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ee)(getParamValue("x",t,e,n))];case"clipByValue":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.V)(getParamValue("x",t,e,n),getParamValue("clipValueMin",t,e,n),getParamValue("clipValueMax",t,e,n))];case"rsqrt":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.sb)(Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.xd)(1,"float32"),Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Td)(getTensor(t.inputNames[0],e,n)))];case"prod":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.fd)(getParamValue("x",t,e,n),getParamValue("axes",t,e,n))];case"leakyRelu":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ac)(getParamValue("x",t,e,n),getParamValue("alpha",t,e,n))];default:throw TypeError("Node type "+t.op+" is not implemented")}},TensorArray=(Object.defineProperty(kVc.prototype,"closed",{get:function(){return this.closed_},enumerable:!0,configurable:!0}),kVc.prototype.clearAndClose=function(){this.tensors.forEach(function(t){return t.tensor.dispose()}),this.tensors=[],this.closed_=!0},kVc.prototype.size=function(){return this.tensors.length},kVc.prototype.read=function(t){if(this.closed_)throw new Error("TensorArray "+this.name+" has already been closed.");if(t<0||t>=this.tensors.length)throw new Error("Tried to read from index "+t+", but array size is: "+this.tensors.length);var e=this.tensors[t];if(e.cleared)throw new Error("TensorArray "+this.name+": Could not read index "+t+" twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).");return this.clearAfterRead&&(e.cleared=!0),e.read=!0,e.tensor},kVc.prototype.readMany=function(t){var e=this;return t.map(function(t){return e.read(t)})},kVc.prototype.write=function(t,e){if(this.closed_)throw new Error("TensorArray "+this.name+" has already been closed.");if(t<0||!this.dynamicSize&&t>=this.maxSize)throw new Error("Tried to write to index "+t+", but array is not resizeable and size is: "+this.maxSize);var n=this.tensors[t]||{};if(e.dtype!==this.dtype)throw new Error("TensorArray "+this.name+": Could not write to TensorArray index "+t+",\n          because the value dtype is "+e.dtype+", but TensorArray dtype is "+this.dtype+".");if(0!==this.size()||null!=this.elementShape&&0!==this.elementShape.length||(this.elementShape=e.shape),this.assertShapesMatch(this.elementShape,e.shape,"TensorArray "+this.name+": Could not write to TensorArray index "+t+"."),n&&n.read)throw new Error("TensorArray "+this.name+": Could not write to TensorArray index "+t+", because it has already been read.");if(n&&n.written)throw new Error("TensorArray "+this.name+": Could not write to TensorArray index "+t+", because it has already been written.");n.tensor=e,n.written=!0,this.tensors[t]=n},kVc.prototype.writeMany=function(t,n){var r=this;if(t.length!==n.length)throw new Error("TensorArray "+this.name+": could not write multiple tensors,because the index size: "+t.length+" is not the same as tensors size: "+n.length+".");t.forEach(function(t,e){return r.write(t,n[e])})},kVc.prototype.gather=function(t,e){if(e&&e!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but gather requested dtype "+e);if(!t){t=[];for(var n=0;n<this.size();n++)t.push(n)}if(0===t.length)return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ge)([],[0].concat(this.elementShape));var r=this.readMany(t);return this.assertShapesMatch(this.elementShape,r[0].shape,"TensorArray shape mismatch: "),Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Yd)(r,0)},kVc.prototype.concat=function(t){if(t&&t!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but concat requested dtype "+t);if(0===this.size())return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ge)([],[0].concat(this.elementShape));for(var e=[],n=0;n<this.size();n++)e.push(n);var r=this.readMany(e);return this.assertShapesMatch(this.elementShape,r[0].shape,"TensorArray shape mismatch: tensor array shape ("+this.elementShape+") vs first tensor shape ("+r[0].shape+")"),Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Y)(r,0)},kVc.prototype.scatter=function(t,e){if(e.dtype!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but tensor has dtype "+e.dtype);if(t.length!==e.shape[0])throw new Error("Expected len(indices) == tensor.shape[0], but saw: "+t.length+" vs. "+e.shape[0]);var n=Math.max.apply(Math,t);if(!this.dynamicSize&&n>=this.maxSize)throw new Error("Max index must be < array size ("+n+"  vs. "+this.maxSize+")");this.writeMany(t,Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.xe)(e,0))},kVc.prototype.split=function(r,i){var o=this;if(i.dtype!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but tensor has dtype "+i.dtype);var a=0,s=r.map(function(t){return a+=t});if(a!==i.shape[0])throw new Error("Expected sum of lengths to be equal to\n          tensor.shape[0], but sum of lengths is\n        "+a+", and tensor's shape is: "+i.shape);if(!this.dynamicSize&&r.length!==this.maxSize)throw new Error("TensorArray's size is not equal to the size of lengths ("+this.maxSize+" vs. "+r.length+"), and the TensorArray is not marked as dynamically resizeable");var u=0===a?0:i.size/a,c=[];Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.oe)(function(){i=i.reshape([1,a,u]);for(var t=0;t<r.length;++t){var e=[0,0===t?0:s[t-1],0],n=[1,r[t],u];c[t]=Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Id)(i,e,n).reshape(o.elementShape)}return c});for(var t=[],e=0;e<r.length;e++)t[e]=e;this.writeMany(t,c)},kVc.prototype.assertShapesMatch=function(t,e,n){void 0===n&&(n=""),_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ye.assert(this.arraysEqual(t,e),n+" Shapes "+t+" and "+e+" must match")},kVc.prototype.arraysEqual=function(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(-1!==t[n]&&-1!==e[n]&&t[n]!==e[n])return!1;return!0},kVc.nextId=0,kVc);function kVc(t,e,n,r,i,o,a){this.name=t,this.dtype=e,this.maxSize=n,this.elementShape=r,this.identicalElementShapes=i,this.dynamicSize=o,this.clearAfterRead=a,this.tensors=[],this.closed_=!1,this.id=kVc.nextId++}function TTc(){var t=[arithmetic,basicMath,control,convolution,creation,dynamic,evaluation,logical,image$1,graph,matrices,normalization,reduction,sliceJoin,spectral,transformation],e=[].concat.apply([],t.map(function(t){return t.json}));this.opMappers=e.reduce(function(t,e){return t[e.tfOpName]=e,t},{})}function executeOp$2(j,B,L){return __awaiter(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c,l,f,h,p,d,m,g,y,v,b,w,_,x,E,S,N,I,O,k,A,C,P,T,M,R,D;return __generator(this,function(t){switch(t.label){case 0:switch(j.op){case"loopCond":return[3,1];case"switch":return[3,2];case"merge":return[3,4];case"enter":return[3,5];case"exit":return[3,6];case"nextIteration":return[3,7];case"tensorArray":return[3,8];case"tensorArrayWrite":return[3,9];case"tensorArrayRead":return[3,10];case"tensorArrayGather":return[3,11];case"tensorArrayScatter":return[3,12];case"tensorArrayConcat":return[3,13];case"tensorArraySplit":return[3,14];case"tensorArraySize":return[3,15];case"tensorArrayClose":return[3,16]}return[3,17];case 1:return[2,[getParamValue("pred",j,B,L).clone()]];case 2:return e=getParamValue("pred",j,B,L),n=getParamValue("data",j,B,L),[4,e.data()];case 3:return[2,t.sent()[0]?[void 0,n.clone()]:[n.clone(),void 0]];case 4:return[2,(r=j.inputNames.find(function(t){return void 0!==getTensor(t,B,L)}))?[getTensor(r,B,L).clone()]:void 0];case 5:return i=getParamValue("frameName",j,B,L),o=getParamValue("tensor",j,B,L),L.enterFrame(i),[2,[o.clone()]];case 6:return a=getParamValue("tensor",j,B,L),L.exitFrame(),[2,[a.clone()]];case 7:return s=getParamValue("tensor",j,B,L),L.nextIteration(),[2,[s.clone()]];case 8:return u=getParamValue("size",j,B,L),c=getParamValue("dtype",j,B,L),l=getParamValue("elementShape",j,B,L),f=getParamValue("dynamicSize",j,B,L),h=getParamValue("clearAfterRead",j,B,L),p=getParamValue("identicalElementShapes",j,B,L),d=getParamValue("name",j,B,L),m=new TensorArray(d,c,u,l,p,f,h),L.addTensorArray(m),[2,[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.xd)(m.id),Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.xd)(1)]];case 9:return g=getParamValue("tensorArrayId",j,B,L),y=getParamValue("index",j,B,L),v=getParamValue("tensor",j,B,L),L.getTensorArray(g).write(y,v),[2,[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.xd)(1)]];case 10:return b=getParamValue("tensorArrayId",j,B,L),w=getParamValue("index",j,B,L),[2,[L.getTensorArray(b).read(w)]];case 11:return _=getParamValue("tensorArrayId",j,B,L),x=getParamValue("indices",j,B,L),E=getParamValue("dtype",j,B,L),[2,[L.getTensorArray(_).gather(x,E)]];case 12:return S=getParamValue("tensorArrayId",j,B,L),N=getParamValue("indices",j,B,L),I=getParamValue("tensor",j,B,L),L.getTensorArray(S).scatter(N,I),[2,[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.xd)(1)]];case 13:return O=getParamValue("tensorArrayId",j,B,L),k=L.getTensorArray(O),A=getParamValue("dtype",j,B,L),[2,[k.concat(A)]];case 14:return C=getParamValue("tensorArrayId",j,B,L),P=getParamValue("tensor",j,B,L),T=getParamValue("lengths",j,B,L),L.getTensorArray(C).split(T,P),[2,[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.xd)(1)]];case 15:return M=getParamValue("tensorArrayId",j,B,L),R=L.getTensorArray(M),[2,[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.xd)(R.size(),"int32")]];case 16:return D=getParamValue("tensorArrayId",j,B,L),L.getTensorArray(D).clearAndClose(),[2,[]];case 17:throw TypeError("Node type "+j.op+" is not implemented")}})})}var executeOp$3=function(t,e,n){switch(t.op){case"conv1d":var r=getParamValue("stride",t,e,n),i=getParamValue("pad",t,e,n),o=getParamValue("dataFormat",t,e,n).toUpperCase(),a=getParamValue("dilation",t,e,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.db)(getParamValue("x",t,e,n),getParamValue("filter",t,e,n),r,i,o,a)];case"conv2d":r=getParamValue("strides",t,e,n),i=getParamValue("pad",t,e,n),o=getParamValue("dataFormat",t,e,n).toUpperCase();var s=getParamValue("dilations",t,e,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.eb)(getParamValue("x",t,e,n),getParamValue("filter",t,e,n),[r[1],r[2]],i,o,[s[0],s[1]])];case"conv2dTranspose":var u=getParamValue("outputShape",t,e,n);return r=getParamValue("strides",t,e,n),i=getParamValue("pad",t,e,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.gb)(getParamValue("x",t,e,n),getParamValue("filter",t,e,n),u,[r[1],r[2]],i)];case"depthwiseConv2d":return r=getParamValue("strides",t,e,n),i=getParamValue("pad",t,e,n),s=getParamValue("dilations",t,e,n),o=getParamValue("dataFormat",t,e,n).toUpperCase(),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ob)(getParamValue("input",t,e,n),getParamValue("filter",t,e,n),[r[1],r[2]],i,o,[s[0],s[1]])];case"avgPool":r=getParamValue("strides",t,e,n),i=getParamValue("pad",t,e,n);var c=getParamValue("kernelSize",t,e,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.G)(getParamValue("x",t,e,n),[c[1],c[2]],[r[1],r[2]],i)];case"maxPool":return r=getParamValue("strides",t,e,n),i=getParamValue("pad",t,e,n),c=getParamValue("kernelSize",t,e,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.vc)(getParamValue("x",t,e,n),[c[1],c[2]],[r[1],r[2]],i)];default:throw TypeError("Node type "+t.op+" is not implemented")}},executeOp$4=function(t,e,n){switch(t.op){case"fill":var r=getParamValue("shape",t,e,n),i=getParamValue("dtype",t,e,n),o=getParamValue("value",t,e,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Gb)(r,o,i)];case"linspace":var a=getParamValue("start",t,e,n),s=getParamValue("stop",t,e,n),u=getParamValue("num",t,e,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.gc)(a,s,u)];case"oneHot":var c=getParamValue("indices",t,e,n),l=getParamValue("depth",t,e,n),f=getParamValue("onValue",t,e,n),h=getParamValue("offValue",t,e,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Qc)(c,l,f,h)];case"ones":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Rc)(getParamValue("shape",t,e,n),getParamValue("dtype",t,e,n))];case"onesLike":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Sc)(getParamValue("x",t,e,n))];case"randomUniform":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.jd)(getParamValue("shape",t,e,n),getParamValue("minval",t,e,n),getParamValue("maxval",t,e,n),getParamValue("dtype",t,e,n))];case"range":a=getParamValue("start",t,e,n);var p=getParamValue("stop",t,e,n),d=getParamValue("step",t,e,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.kd)(a,p,d,getParamValue("dtype",t,e,n))];case"truncatedNormal":r=getParamValue("shape",t,e,n);var m=getParamValue("mean",t,e,n),g=getParamValue("stdDev",t,e,n),y=getParamValue("seed",t,e,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ve)(r,m,g,getParamValue("dtype",t,e,n),y)];case"zeros":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.He)(getParamValue("shape",t,e,n),getParamValue("dtype",t,e,n))];case"zerosLike":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Ie)(getParamValue("x",t,e,n))];default:throw TypeError("Node type "+t.op+" is not implemented")}};function executeOp$5(a,s,u){return __awaiter(this,void 0,void 0,function(){var e,n,r,i,o;return __generator(this,function(t){switch(t.label){case 0:switch(a.op){case"nonMaxSuppression":return[3,1];case"whereAsync":return[3,3];case"setdiff1dAsync":return[3,5]}return[3,7];case 1:return e=getParamValue("boxes",a,s,u),n=getParamValue("scores",a,s,u),r=getParamValue("maxOutputSize",a,s,u),i=getParamValue("iouThreshold",a,s,u),o=getParamValue("scoreThreshold",a,s,u),[4,_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Wb.nonMaxSuppressionAsync(e,n,r,i,o)];case 2:return[2,[t.sent()]];case 3:return[4,Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Ge)(getParamValue("condition",a,s,u))];case 4:return[2,[t.sent()]];case 5:return[4,Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Dd)(getParamValue("x",a,s,u),getParamValue("y",a,s,u))];case 6:return[2,t.sent()];case 7:throw TypeError("Node type "+a.op+" is not implemented")}})})}var executeOp$6=function(t,e,n){switch(t.op){case"topK":var r=getParamValue("x",t,e,n),i=getParamValue("k",t,e,n),o=getParamValue("sorted",t,e,n),a=Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.se)(r,i,o);return[a.values,a.indices];default:throw TypeError("Node type "+t.op+" is not implemented")}},executeOp$7=function(t,e,n){switch(t.op){case"const":return e[t.name];case"placeholder":var r=getParamValue("default",t,e,n);return[getTensor(t.name,e,n)||r];case"identity":case"stopGradient":case"fakeQuantWithMinMaxVars":case"snapshot":return[getParamValue("x",t,e,n).clone()];case"shape":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.he)(getParamValue("x",t,e,n).shape,"int32")];case"shapeN":return getParamValue("x",t,e,n).map(function(t){return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.he)(t.shape)});case"size":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.xd)(getParamValue("x",t,e,n).size,"int32")];case"rank":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.xd)(getParamValue("x",t,e,n).rank,"int32")];case"noop":return[];case"print":var i=getParamValue("x",t,e,n),o=getParamValue("data",t,e,n),a=getParamValue("message",t,e,n),s=getParamValue("summarize",t,e,n);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(a);for(var u=0;u<o.length;u++)console.log(Array.prototype.slice.call(o[0].dataSync()).slice(0,s));return[i];default:throw TypeError("Node type "+t.op+" is not implemented")}},executeOp$8=function(t,e,n){switch(t.op){case"resizeBilinear":var r=getParamValue("images",t,e,n),i=getParamValue("size",t,e,n),o=getParamValue("alignCorners",t,e,n);return[_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Wb.resizeBilinear(r,[i[0],i[1]],o)];case"resizeNearestNeighbor":return r=getParamValue("images",t,e,n),i=getParamValue("size",t,e,n),o=getParamValue("alignCorners",t,e,n),[_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Wb.resizeNearestNeighbor(r,[i[0],i[1]],o)];case"cropAndResize":var a=getParamValue("image",t,e,n),s=getParamValue("boxes",t,e,n),u=getParamValue("boxInd",t,e,n),c=getParamValue("cropSize",t,e,n),l=getParamValue("method",t,e,n),f=getParamValue("extrapolationValue",t,e,n);return[_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Wb.cropAndResize(a,s,u,c,l,f)];default:throw TypeError("Node type "+t.op+" is not implemented")}},executeOp$9=function(t,e,n){switch(t.op){case"equal":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.yb)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];case"notEqual":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Oc)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];case"greater":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Qb)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];case"greaterEqual":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Rb)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];case"less":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.bc)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];case"lessEqual":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.cc)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];case"logicalAnd":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.nc)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];case"logicalNot":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.oc)(getParamValue("a",t,e,n))];case"logicalOr":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.pc)(getParamValue("a",t,e,n),getParamValue("b",t,e,n))];case"where":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Fe)(getParamValue("condition",t,e,n),getParamValue("a",t,e,n),getParamValue("b",t,e,n))];default:throw TypeError("Node type "+t.op+" is not implemented")}},executeOp$10=function(t,e,n){switch(t.op){case"matMul":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.sc)(getParamValue("a",t,e,n),getParamValue("b",t,e,n),getParamValue("transposeA",t,e,n),getParamValue("transposeB",t,e,n))];case"transpose":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ue)(getParamValue("x",t,e,n),getParamValue("perm",t,e,n))];default:throw TypeError("Node type "+t.op+" is not implemented")}},executeOp$11=function(t,e,n){switch(t.op){case"batchNormalization":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.I)(getParamValue("x",t,e,n),getParamValue("mean",t,e,n),getParamValue("variance",t,e,n),getParamValue("offset",t,e,n),getParamValue("scale",t,e,n),getParamValue("epsilon",t,e,n))];case"localResponseNormalization":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.hc)(getParamValue("x",t,e,n),getParamValue("radius",t,e,n),getParamValue("bias",t,e,n),getParamValue("alpha",t,e,n),getParamValue("beta",t,e,n))];case"softmax":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Nd)(getParamValue("x",t,e,n))];case"logSoftmax":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.lc)(getParamValue("x",t,e,n))];case"sparseToDense":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Qd)(getParamValue("sparseIndices",t,e,n),getParamValue("outputShape",t,e,n),getParamValue("sparseValues",t,e,n),getParamValue("defaultValue",t,e,n))];default:throw TypeError("Node type "+t.op+" is not implemented")}},executeOp$12=function(t,e,n){switch(t.op){case"max":var r=getParamValue("axis",t,e,n),i=getParamValue("keepDims",t,e,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.uc)(getParamValue("x",t,e,n),r,i)];case"mean":return r=getParamValue("axis",t,e,n),i=getParamValue("keepDims",t,e,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.yc)(getParamValue("x",t,e,n),r,i)];case"min":return r=getParamValue("axis",t,e,n),i=getParamValue("keepDims",t,e,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Ac)(getParamValue("x",t,e,n),r,i)];case"sum":return r=getParamValue("axis",t,e,n),i=getParamValue("keepDims",t,e,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.de)(getParamValue("x",t,e,n),r,i)];case"all":return r=getParamValue("axis",t,e,n),i=getParamValue("keepDims",t,e,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.x)(getParamValue("x",t,e,n),r,i)];case"any":return r=getParamValue("axis",t,e,n),i=getParamValue("keepDims",t,e,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.y)(getParamValue("x",t,e,n),r,i)];case"argMax":return r=getParamValue("axis",t,e,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.z)(getParamValue("x",t,e,n),r)];case"argMin":return r=getParamValue("axis",t,e,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.A)(getParamValue("x",t,e,n),r)];case"prod":return r=getParamValue("axis",t,e,n),i=getParamValue("keepDims",t,e,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.fd)(getParamValue("x",t,e,n),r,i)];default:throw TypeError("Node type "+t.op+" is not implemented")}},executeOp$13=function(o,a,s){switch(o.op){case"concat":var t=getParamValue("axis",o,a,s),e=getParamValue("tensors",o,a,s);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Y)(e,t)];case"gather":t=getParamValue("axis",o,a,s);var n=getParamValue("x",o,a,s),r=getParamValue("indices",o,a,s);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Lb)(n,r,t)];case"reverse":return t=getParamValue("axis",o,a,s),n=getParamValue("x",o,a,s),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.pd)(n,t)];case"slice":var i=getParamValue("begin",o,a,s),u=getParamValue("size",o,a,s);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Id)(getParamValue("x",o,a,s),i,u)];case"stridedSlice":i=getParamValue("begin",o,a,s);var c=getParamValue("end",o,a,s),l=getParamValue("strides",o,a,s),f=getParamValue("beginMask",o,a,s),h=getParamValue("endMask",o,a,s),p=getParamValue("ellipsisMask",o,a,s),d=getParamValue("newAxisMask",o,a,s),m=getParamValue("shrinkAxisMask",o,a,s),g=getParamValue("x",o,a,s);if(1===i.length&&1<g.shape.length)for(var y=1;y<g.shape.length;y++)i.push(0),c.push(g.shape[y]),l.push(l[0]);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ae)(g,i,c,l,f,h,p,d,m)];case"stack":return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.oe)(function(){var t=getParamValue("axis",o,a,s),e=getParamValue("tensors",o,a,s),n=e[0].shape,r=e[0].squeeze().shape,i=e.map(function(t){var e=_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ye.arraysEqual(t.shape,n);if(!e&&!_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ye.arraysEqual(t.squeeze().shape,r))throw new Error("the input tensors shape does not match");return e?t:t.reshape(n)});return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Yd)(i,t)]});case"unstack":return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.oe)(function(){var t=getParamValue("axis",o,a,s),e=getParamValue("tensor",o,a,s);return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.xe)(e,t)});case"tile":var v=getParamValue("reps",o,a,s);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.pe)(getParamValue("x",o,a,s),v)];case"split":t=getParamValue("axis",o,a,s);var b=getParamValue("numOrSizeSplits",o,a,s);return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Sd)(getParamValue("x",o,a,s),b,t);case"scatterNd":r=getParamValue("indices",o,a,s);var w=getParamValue("values",o,a,s),_=getParamValue("shape",o,a,s);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.yd)(r,w,_)];case"gatherNd":var x=getParamValue("x",o,a,s);return r=getParamValue("indices",o,a,s),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Mb)(x,r)];case"sparseToDense":r=getParamValue("sparseIndices",o,a,s),_=getParamValue("outputShape",o,a,s);var E=getParamValue("sparseValues",o,a,s),S=getParamValue("defaultValue",o,a,s);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Qd)(r,E,_,S)];default:throw TypeError("Node type "+o.op+" is not implemented")}},executeOp$14=function(t,e,n){switch(t.op){case"fft":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Fb)(getParamValue("x",t,e,n))];case"ifft":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Ub)(getParamValue("x",t,e,n))];case"rfft":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ud)(getParamValue("x",t,e,n))];case"irfft":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Yb)(getParamValue("x",t,e,n))];default:throw TypeError("Node type "+t.op+" is not implemented")}},executeOp$15=function(t,e,n){switch(t.op){case"cast":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.T)(getParamValue("x",t,e,n),getParamValue("dtype",t,e,n))];case"expandDims":var r=getParamValue("axis",t,e,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Cb)(getParamValue("x",t,e,n),r)];case"squeeze":return r=getParamValue("axis",t,e,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Xd)(getParamValue("x",t,e,n),r)];case"reshape":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.od)(getParamValue("x",t,e,n),getParamValue("shape",t,e,n))];case"pad":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Vc)(getParamValue("x",t,e,n),split$1(getParamValue("padding",t,e,n),2),getParamValue("constantValue",t,e,n))];case"spaceToBatchND":var i=getParamValue("blockShape",t,e,n),o=split$1(getParamValue("paddings",t,e,n),2);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Pd)(getParamValue("x",t,e,n),i,o)];case"batchToSpaceND":i=getParamValue("blockShape",t,e,n);var a=split$1(getParamValue("crops",t,e,n),2);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Q)(getParamValue("x",t,e,n),i,a)];case"depthToSpace":var s=getParamValue("blockSize",t,e,n),u=getParamValue("dataFormat",t,e,n).toUpperCase();return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.nb)(getParamValue("x",t,e,n),s,u)];default:throw TypeError("Node type "+t.op+" is not implemented")}};function executeOp$16(t,e,n){switch(t.category){case"arithmetic":return executeOp(t,e,n);case"basic_math":return executeOp$1(t,e,n);case"control":return executeOp$2(t,e,n);case"convolution":return executeOp$3(t,e,n);case"creation":return executeOp$4(t,e,n);case"dynamic":return executeOp$5(t,e,n);case"evaluation":return executeOp$6(t,e,n);case"image":return executeOp$8(t,e,n);case"graph":return executeOp$7(t,e,n);case"logical":return executeOp$9(t,e,n);case"matrices":return executeOp$10(t,e,n);case"normalization":return executeOp$11(t,e,n);case"reduction":return executeOp$12(t,e,n);case"slice_join":return executeOp$13(t,e,n);case"spectral":return executeOp$14(t,e,n);case"transformation":return executeOp$15(t,e,n);default:throw TypeError("Node type "+t.op+" is not implemented")}}var ExecutionContext=(pZc.prototype.newFrame=function(t,e){return{id:t,frameName:e,iterationId:0}},Object.defineProperty(pZc.prototype,"currentContext",{get:function(){return this.contexts},set:function(t){this.contexts!==t&&(this.contexts=t,this.generateCurrentContextIds())},enumerable:!0,configurable:!0}),Object.defineProperty(pZc.prototype,"currentContextId",{get:function(){return this._currentContextIds[0]},enumerable:!0,configurable:!0}),Object.defineProperty(pZc.prototype,"currentContextIds",{get:function(){return this._currentContextIds},enumerable:!0,configurable:!0}),pZc.prototype.generateCurrentContextIds=function(){for(var t=[],e=0;e<this.contexts.length-1;e++){var n=this.contexts.slice(0,this.contexts.length-e);t.push(this.contextIdforContexts(n))}t.push(""),this._currentContextIds=t},pZc.prototype.contextIdforContexts=function(t){return t?t.map(function(t){return 0===t.id&&0===t.iterationId?"":t.frameName+"-"+t.iterationId}).join("/"):""},pZc.prototype.enterFrame=function(t){this.contexts&&(this.lastId++,this.contexts=this.contexts.slice(),this.contexts.push(this.newFrame(this.lastId,t)),this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)))},pZc.prototype.exitFrame=function(){if(!(this.contexts&&1<this.contexts.length))throw new Error("Cannot exit frame, the context is empty");this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift()},pZc.prototype.nextIteration=function(){if(!(this.contexts&&0<this.contexts.length))throw new Error("Cannot increase frame iteration, the context is empty");this.contexts=this.contexts.slice(),this.lastId++;var t=Object.assign({},this.contexts[this.contexts.length-1]);t.iterationId+=1,t.id=this.lastId,this.contexts.splice(-1,1,t),this._currentContextIds.splice(0,1,this.contextIdforContexts(this.contexts))},pZc.prototype.getWeight=function(t){return this.weightMap[t]},pZc.prototype.addTensorArray=function(t){this.tensorArrayMap[t.id]=t},pZc.prototype.getTensorArray=function(t){return this.tensorArrayMap[t]},pZc),GraphExecutor=(Object.defineProperty(FZc.prototype,"weightMap",{get:function(){return this._weightMap},set:function(e){var t=Object.keys(e).map(function(t){return e[t].map(function(t){return t.id})});this.weightIds=[].concat.apply([],t),this._weightMap=e},enumerable:!0,configurable:!0}),Object.defineProperty(FZc.prototype,"inputs",{get:function(){return this.placeholders.map(function(t){return{name:t.name,shape:t.params.shape?t.params.shape.value:void 0,dtype:t.params.dtype?t.params.dtype.value:void 0}})},enumerable:!0,configurable:!0}),Object.defineProperty(FZc.prototype,"outputs",{get:function(){return this._outputs.map(function(t){return{name:t.name,shape:t.params.shape?t.params.shape.value:void 0,dtype:t.params.dtype?t.params.dtype.value:void 0}})},enumerable:!0,configurable:!0}),Object.defineProperty(FZc.prototype,"inputNodes",{get:function(){return this.placeholders.map(function(t){return t.name})},enumerable:!0,configurable:!0}),Object.defineProperty(FZc.prototype,"outputNodes",{get:function(){return this.outputs.map(function(t){return t.name})},enumerable:!0,configurable:!0}),Object.defineProperty(FZc.prototype,"isControlFlowModel",{get:function(){return this.graph.withControlFlow},enumerable:!0,configurable:!0}),Object.defineProperty(FZc.prototype,"isDynamicShapeModel",{get:function(){return this.graph.withDynamicShape},enumerable:!0,configurable:!0}),FZc.prototype.compile=function(t){if(!this.graph.withControlFlow&&!this.graph.withDynamicShape){var e=[],n=t||this.graph.placeholders,r=n.map(function(t){return t.name}).sort().join(this.SEPERATOR);if(!this.compiledMap.get(r)){for(var i=n.concat(this.graph.weights),o={};0<i.length;){var a=i.pop();o[a.name]=!0,e.push(a),a.children.forEach(function(t){!o[t.name]&&t.inputNames.every(function(t){var e=getNodeNameAndIndex(t)[0];return o[e]})&&i.push(t)})}this.compiledMap.set(r,e)}}},FZc.prototype.execute=function(s,t,e){var u=this;void 0===t&&(t=!0);var c=Object.keys(s).sort();this.checkInput(s,t),this.checkInputShapeAndType(s,t),this.compile(c.map(function(t){return u.graph.nodes[t]}));var l=this.calculateOutputs(e);this.checkOutput(this.compiledMap.get(c.join(this.SEPERATOR)),l);var f={};return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.oe)(function(){for(var t=new ExecutionContext(u._weightMap,f),e=__assign({},u.weightMap,s),n=u.getFrozenTensorIds(e),r={},i=u.compiledMap.get(c.join(u.SEPERATOR)),o=0;o<i.length;o++){var a=i[o];if(e[a.name]||(e[a.name]=executeOp$16(a,e,t),u.checkTensorForDisposal(a.name,a,e,t,n,l,r)),l.every(function(t){return!!e[t]}))break}return u.findOutputs(e,t,l)})},FZc.prototype.getFrozenTensorIds=function(e){var t=[].concat.apply([],Object.keys(e).map(function(t){return e[t]}).map(function(t){return t.map(function(t){return t.id})}));return new Set(t)},FZc.prototype.checkTensorForDisposal=function(t,e,n,r,i,o,a){"control"!==e.category&&-1===o.indexOf(t)&&(n[t].forEach(function(t){null!=t&&(a[t.id]=(a[t.id]||0)+e.children.length)}),e.inputs.forEach(function(t){if("control"!==t.category){var e=getTensorsForCurrentContenxt(t.name,n,r);null!=e&&e.forEach(function(t){if(t&&!i.has(t.id)){var e=a[t.id];1===e?(t.dispose(),delete a[t.id]):null!=e&&a[t.id]--}})}}))},FZc.prototype.executeAsync=function(l,f){return __awaiter(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c=this;return __generator(this,function(t){switch(t.label){case 0:return this.checkInput(l,!1),this.checkInputShapeAndType(l,!1),e={},n=new ExecutionContext(this._weightMap,e),r=this.calculateOutputs(f),[4,this.executeWithControlFlow(l,n,r)];case 1:return i=t.sent(),o=this.findOutputs(i,n,f),a=Object.keys(o).map(function(t){return o[t].id}),s=Object.keys(l).map(function(t){return l[t].map(function(t){return t.id})}),u=[].concat.apply([],s),Object.keys(i).forEach(function(t){i[t].forEach(function(t){t&&-1===a.indexOf(t.id)&&-1===u.indexOf(t.id)&&-1===c.weightIds.indexOf(t.id)&&t.dispose()})}),[2,o]}})})},FZc.prototype.executeWithControlFlow=function(l,f,h){return __awaiter(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c=this;return __generator(this,function(t){switch(t.label){case 0:e=Object.keys(l),n=e.map(function(t){return c.graph.nodes[t]}),r=n.concat(this.graph.weights).map(function(t){return{node:t,contexts:f.currentContext}}),i=__assign({},this.weightMap,l),o={},a=this.getFrozenTensorIds(i),s={},t.label=1;case 1:return 0<r.length?(u=this.processStack(n,r,f,i,s,a,h,o),[4,Promise.all(u)]):[3,3];case 2:return t.sent(),[3,1];case 3:return[2,i]}})})},FZc.prototype.processStack=function(i,o,a,s,u,c,l,f){for(var h=this,p=[],t=function(){var e=o.pop();a.currentContext=e.contexts;var n="";if("enter"===e.node.op&&getParamValue("isConstant",e.node,s,a)&&(n=getNodeNameAndIndex(e.node.name,a)[0]),-1===i.indexOf(e.node)){var t=executeOp$16(e.node,s,a);n||(n=getNodeNameAndIndex(e.node.name,a)[0]);var r=a.currentContext;t instanceof Promise?p.push(t.then(function(t){return s[n]=t,a.currentContext=r,h.checkTensorForDisposal(n,e.node,s,a,c,l,f),h.processChildNodes(e.node,o,a,s,u),t})):(s[n]=t,d.checkTensorForDisposal(n,e.node,s,a,c,l,f),d.processChildNodes(e.node,o,a,s,u))}else d.processChildNodes(e.node,o,a,s,u)},d=this;0<o.length;)t();return p},FZc.prototype.processChildNodes=function(t,n,r,i,o){t.children.forEach(function(t){var e=getNodeNameAndIndex(t.name,r)[0];o[e]||("merge"===t.op?t.inputNames.some(function(t){return!!getTensor(t,i,r)})&&(o[e]=!0,n.push({contexts:r.currentContext,node:t})):t.inputNames.every(function(t){return!!getTensor(t,i,r)})&&(o[e]=!0,n.push({contexts:r.currentContext,node:t})))})},FZc.prototype.calculateOutputs=function(t){return!t||t instanceof Array||(t=[t]),t||this.graph.outputs.map(function(t){return t.name})},FZc.prototype.findOutputs=function(n,r,t){return this.calculateOutputs(t).reduce(function(t,e){return t[e]=getTensor(e,n,r),t},{})},FZc.prototype.dispose=function(){var e=this;Object.keys(this.weightMap).forEach(function(t){return e.weightMap[t].forEach(function(t){return t.dispose()})})},FZc.prototype.checkInputShapeAndType=function(o,a){void 0===a&&(a=!0),this.placeholders.forEach(function(t){var e=o[t.name];if(a||e){var n=e[0];if(t.params.shape&&t.params.shape.value){var r=t.params.shape.value,i=r.length===n.shape.length&&n.shape.every(function(t,e){return-1===r[e]||r[e]===t});_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ye.assert(i,"The shape of dict['"+t.name+"'] provided in model.execute(dict) must be ["+r+"], but was ["+n.shape+"]")}t.params.dtype&&t.params.dtype.value&&_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ye.assert(n.dtype===t.params.dtype.value,"The dtype of dict['"+t.name+"'] provided in model.execute(dict) must be "+t.params.dtype.value+", but was "+n.dtype)}})},FZc.prototype.checkInput=function(t,e){var n=this;void 0===e&&(e=!0);var r=Object.keys(t),i=[],o=[];this.inputNodes.forEach(function(t){-1===r.indexOf(t)&&i.push(t)}),r.forEach(function(t){-1===n.inputNodes.indexOf(t)&&o.push(t)});var a=o.filter(function(t){return!n.graph.nodes[t]});if(0<i.length&&e)throw new Error("The dict provided in model.execute(dict) has the keys ["+r+"], but is missing the required keys: ["+i+"].");if(0<o.length&&e)throw new Error("The dict provided in model.execute(dict) has unused keys: ["+o+"]. Please provide only the following keys: ["+this.inputNodes+"].");if(0<a.length)throw new Error("The dict provided in model.execute(dict) has keys: ["+a+"] not part of model graph.")},FZc.prototype.checkOutput=function(t,e){var n=t.map(function(t){return t.name}),r=[];if(e.forEach(function(t){var e=parseNodeName(t)[0];-1===n.indexOf(e)&&r.push(e)}),0<r.length)throw new Error("The following outputs are not generated by the execution: ["+r+"].")},FZc),TFHUB_SEARCH_PARAM="?tfjs-format=file",DEFAULT_MODEL_NAME="tensorflowjs_model.pb",DEFAULT_MANIFEST_NAME="weights_manifest.json",FrozenModel=(Object.defineProperty(r0c.prototype,"modelVersion",{get:function(){return this.version},enumerable:!0,configurable:!0}),Object.defineProperty(r0c.prototype,"inputNodes",{get:function(){return this.executor.inputNodes},enumerable:!0,configurable:!0}),Object.defineProperty(r0c.prototype,"outputNodes",{get:function(){return this.executor.outputNodes},enumerable:!0,configurable:!0}),Object.defineProperty(r0c.prototype,"inputs",{get:function(){return this.executor.inputs},enumerable:!0,configurable:!0}),Object.defineProperty(r0c.prototype,"outputs",{get:function(){return this.executor.outputs},enumerable:!0,configurable:!0}),Object.defineProperty(r0c.prototype,"weights",{get:function(){return this.executor.weightMap},enumerable:!0,configurable:!0}),r0c.prototype.findIOHandler=function(){var t=[this.modelUrl,this.weightManifestUrl];if(this.requestOption||this.weightPrefix)this.handler=_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Xb.browserHTTPRequest(t,this.requestOption,this.weightPrefix,null,this.onProgress);else{var e=_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Xb.getLoadHandlers(t,this.onProgress);if(0===e.length)e.push(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Xb.browserHTTPRequest(t,this.requestOption,this.weightPrefix,null,this.onProgress));else if(1<e.length)throw new Error("Found more than one ("+e.length+") load handlers for URL '"+[t]+"'");this.handler=e[0]}},r0c.prototype.load=function(){return __awaiter(this,void 0,void 0,function(){var e,n,r;return __generator(this,function(t){switch(t.label){case 0:if(this.findIOHandler(),null==this.handler.load)throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");return[4,this.handler.load()];case 1:return e=t.sent(),n=compiled_api_1.GraphDef.decode(new Uint8Array(e.modelTopology)),this.version=n.versions.producer+"."+n.versions.minConsumer,r=_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Xb.decodeWeights(e.weightData,e.weightSpecs),this.executor=new GraphExecutor(OperationMapper.Instance.transformGraph(n)),this.executor.weightMap=this.convertTensorMapToTensorsMap(r),[2,!0]}})})},r0c.prototype.predict=function(t,e){return this.execute_(t,!0,this.outputNodes)},r0c.prototype.constructTensorMap=function(t){var r=t instanceof _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.o?[t]:t;if(r.length!==this.inputNodes.length)throw new Error("Input tensor count mismatch,the frozen model has "+this.inputNodes.length+" placeholders, while there are "+r.length+" input tensors.");return this.inputNodes.reduce(function(t,e,n){return t[e]=r[n],t},{})},r0c.prototype.execute=function(t,e){return this.execute_(t,!1,e)},r0c.prototype.execute_=function(t,e,n){if(void 0===e&&(e=!0),n=n||this.outputNodes,(t instanceof _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.o||Array.isArray(t))&&(t=this.constructTensorMap(t)),this.executor.isControlFlowModel||this.executor.isDynamicShapeModel)throw new Error("The model contains control flow or dynamic shape ops, please use executeAsync method");var r=this.executor.execute(this.convertTensorMapToTensorsMap(t),e,n),i=Object.keys(r);return Array.isArray(n)&&1<n.length?n.map(function(t){return r[t]}):r[i[0]]},r0c.prototype.executeAsync=function(r,i){return __awaiter(this,void 0,void 0,function(){var e,n;return __generator(this,function(t){switch(t.label){case 0:if(!this.executor.isControlFlowModel&&!this.executor.isDynamicShapeModel)throw new Error("The model does not contain control flow or dynamic shape ops, please use execute method for better performance.");return i=i||this.outputNodes,(r instanceof _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.o||Array.isArray(r))&&(r=this.constructTensorMap(r)),[4,this.executor.executeAsync(this.convertTensorMapToTensorsMap(r),i)];case 1:return e=t.sent(),n=Object.keys(e),[2,Array.isArray(i)&&1<i.length?i.map(function(t){return e[t]}):e[n[0]]]}})})},r0c.prototype.convertTensorMapToTensorsMap=function(n){return Object.keys(n).reduce(function(t,e){return t[e]=[n[e]],t},{})},r0c.prototype.dispose=function(){this.executor.dispose()},r0c),tensorflow_json,j1c,l1c,m1c,k1c;function r0c(t,e,n,r,i){this.modelUrl=t,this.weightManifestUrl=e,this.requestOption=n,this.weightPrefix=r,this.onProgress=i,this.version="n/a"}function FZc(t){this.graph=t,this.compiledMap=new Map,this._weightMap={},this.SEPERATOR=",",this.placeholders=t.placeholders,this._outputs=t.outputs,this.compile()}function pZc(t,e){this.weightMap=t,this.tensorArrayMap=e,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}function loadFrozenModel(n,r,i,o){return __awaiter(this,void 0,void 0,function(){var e;return __generator(this,function(t){switch(t.label){case 0:return[4,(e=new FrozenModel(n,r,i,null,o)).load()];case 1:return t.sent(),[2,e]}})})}function loadTfHubModule(e,n,r){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){return e.endsWith("/")||(e+="/"),[2,loadFrozenModel(""+e+DEFAULT_MODEL_NAME+TFHUB_SEARCH_PARAM,""+e+DEFAULT_MANIFEST_NAME+TFHUB_SEARCH_PARAM,n,r)]})})}j1c=tensorflow_json||(tensorflow_json={}),(k1c=j1c.DataType||(j1c.DataType={}))[k1c.DT_INVALID=0]="DT_INVALID",k1c[k1c.DT_FLOAT=1]="DT_FLOAT",k1c[k1c.DT_DOUBLE=2]="DT_DOUBLE",k1c[k1c.DT_INT32=3]="DT_INT32",k1c[k1c.DT_UINT8=4]="DT_UINT8",k1c[k1c.DT_INT16=5]="DT_INT16",k1c[k1c.DT_INT8=6]="DT_INT8",k1c[k1c.DT_STRING=7]="DT_STRING",k1c[k1c.DT_COMPLEX64=8]="DT_COMPLEX64",k1c[k1c.DT_INT64=9]="DT_INT64",k1c[k1c.DT_BOOL=10]="DT_BOOL",k1c[k1c.DT_QINT8=11]="DT_QINT8",k1c[k1c.DT_QUINT8=12]="DT_QUINT8",k1c[k1c.DT_QINT32=13]="DT_QINT32",k1c[k1c.DT_BFLOAT16=14]="DT_BFLOAT16",k1c[k1c.DT_FLOAT_REF=101]="DT_FLOAT_REF",k1c[k1c.DT_DOUBLE_REF=102]="DT_DOUBLE_REF",k1c[k1c.DT_INT32_REF=103]="DT_INT32_REF",k1c[k1c.DT_UINT8_REF=104]="DT_UINT8_REF",k1c[k1c.DT_INT16_REF=105]="DT_INT16_REF",k1c[k1c.DT_INT8_REF=106]="DT_INT8_REF",k1c[k1c.DT_STRING_REF=107]="DT_STRING_REF",k1c[k1c.DT_COMPLEX64_REF=108]="DT_COMPLEX64_REF",k1c[k1c.DT_INT64_REF=109]="DT_INT64_REF",k1c[k1c.DT_BOOL_REF=110]="DT_BOOL_REF",k1c[k1c.DT_QINT8_REF=111]="DT_QINT8_REF",k1c[k1c.DT_QUINT8_REF=112]="DT_QUINT8_REF",k1c[k1c.DT_QINT32_REF=113]="DT_QINT32_REF",k1c[k1c.DT_BFLOAT16_REF=114]="DT_BFLOAT16_REF",l1c=j1c.SaverDef||(j1c.SaverDef={}),(m1c=l1c.CheckpointFormatVersion||(l1c.CheckpointFormatVersion={}))[m1c.LEGACY=0]="LEGACY",m1c[m1c.V1=1]="V1",m1c[m1c.V2=2]="V2";var CONTROL_FLOW_OPS$1=["Switch","Merge","Enter","Exit","NextIteration"],DYNAMIC_SHAPE_OPS$1=["NonMaxSuppressionV2","NonMaxSuppressionV3","Where"],OperationMapper$1=(Object.defineProperty(n1c,"Instance",{get:function(){return this._instance||(this._instance=new this)},enumerable:!0,configurable:!0}),n1c.prototype.isControlFlow=function(e){return CONTROL_FLOW_OPS$1.some(function(t){return t===e.op})},n1c.prototype.isDynamicShape=function(e){return DYNAMIC_SHAPE_OPS$1.some(function(t){return t===e.op})},n1c.prototype.transformGraph=function(t){var n=this,r=!1,i=!1,o=[],a=[],s=t.node.reduce(function(t,e){return t[e.name]=n.mapNode(e),n.isControlFlow(e)&&(r=!0),n.isDynamicShape(e)&&(i=!0),"Placeholder"===e.op&&o.push(t[e.name]),"Const"===e.op&&a.push(t[e.name]),t},{}),e=[],u=[];return Object.keys(s).forEach(function(t){var n=s[t];n.inputNames.forEach(function(t){var e=getNodeNameAndIndex(t)[0];n.inputs.push(s[e]),s[e].children.push(n)}),0===n.inputs.length&&e.push(n)}),Object.keys(s).forEach(function(t){var e=s[t];0===e.children.length&&u.push(e)}),{nodes:s,inputs:e,outputs:u,weights:a,placeholders:o,withControlFlow:r,withDynamicShape:i}},n1c.prototype.mapNode=function(a){var s=this,t=this.opMappers[a.op];if(void 0===t)throw new Error("Tensorflow Op is not supported: "+a.op);var e={name:a.name,op:t.dlOpName,category:t.category,inputNames:(a.input||[]).map(function(t){return t.startsWith("^")?t.substr(1):t}),inputs:[],children:[],params:{}};return t.params&&(e.params=t.params.reduce(function(t,e){var n=e.tfInputIndex,r=e.tfInputParamLength,i=e.type,o=void 0;if(void 0===n)switch(e.type){case"string":void 0===(o=s.getStringParam(a.attr,e.tfParamName,e.defaultValue))&&e.tfParamNameDeprecated&&(o=s.getStringParam(a.attr,e.tfParamNameDeprecated,e.defaultValue));break;case"number":void 0===(o=s.getNumberParam(a.attr,e.tfParamName,e.defaultValue||0))&&e.tfParamNameDeprecated&&(o=s.getNumberParam(a.attr,e.tfParamNameDeprecated,e.defaultValue));break;case"number[]":void 0===(o=s.getNumericArrayParam(a.attr,e.tfParamName,e.defaultValue))&&e.tfParamNameDeprecated&&(o=s.getNumericArrayParam(a.attr,e.tfParamNameDeprecated,e.defaultValue));break;case"bool":void 0===(o=s.getBoolParam(a.attr,e.tfParamName,e.defaultValue))&&e.tfParamNameDeprecated&&(o=s.getBoolParam(a.attr,e.tfParamNameDeprecated,e.defaultValue));break;case"shape":void 0===(o=s.getTensorShapeParam(a.attr,e.tfParamName,e.defaultValue))&&e.tfParamNameDeprecated&&(o=s.getTensorShapeParam(a.attr,e.tfParamNameDeprecated,e.defaultValue));break;case"dtype":void 0===(o=s.getDtypeParam(a.attr,e.tfParamName,e.defaultValue))&&e.tfParamNameDeprecated&&(o=s.getDtypeParam(a.attr,e.tfParamNameDeprecated,e.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error("Unsupported param type: "+e.type+" for op: "+a.op)}return t[e.dlParamName]={value:o,inputIndex:n,type:i,inputParamLength:r},t},{})),e},n1c.prototype.decodeBase64=function(t){if("undefined"!=typeof atob)return atob(t);if(void 0!==Buffer)return new Buffer(t,"base64").toString();throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()")},n1c.prototype.getStringParam=function(t,e,n,r){void 0===r&&(r=!1);var i=t[e];if(void 0===i)return n;var o=Array.isArray(i.s)?String.fromCharCode.apply(null,i.s):this.decodeBase64(i.s);return r?o:o.toLowerCase()},n1c.prototype.getBoolParam=function(t,e,n){var r=t[e];return r?r.b:n},n1c.prototype.getNumberParam=function(t,e,n){var r=t[e]||{},i=r.i?r.i:r.f?r.f:n;return"number"==typeof i?i:parseInt(i,10)},n1c.prototype.getDtypeParam=function(t,e,n){var r=t[e];if(r&&r.type){var i=r.type;switch("string"==typeof r.type&&(i=tensorflow_json.DataType[r.type]),i){case tensorflow_json.DataType.DT_FLOAT:return"float32";case tensorflow_json.DataType.DT_INT32:return"int32";case tensorflow_json.DataType.DT_BOOL:return"bool";default:return n}}return n},n1c.prototype.getTensorShapeParam=function(t,e,n){var r=t[e];if(r&&r.shape){if(r.shape.unknownRank)return;if(null!=r.shape.dim)return r.shape.dim.map(function(t){return"number"==typeof t.size?t.size:parseInt(t.size,10)})}return n},n1c.prototype.getNumericArrayParam=function(t,e,n){var r=t[e];return r?(r.list.f&&r.list.f.length?r.list.f:r.list.i).map(function(t){return"number"==typeof t?t:parseInt(t,10)}):n},n1c),FrozenModel$1=(Object.defineProperty(C2c.prototype,"modelVersion",{get:function(){return this.version},enumerable:!0,configurable:!0}),Object.defineProperty(C2c.prototype,"inputNodes",{get:function(){return this.executor.inputNodes},enumerable:!0,configurable:!0}),Object.defineProperty(C2c.prototype,"outputNodes",{get:function(){return this.executor.outputNodes},enumerable:!0,configurable:!0}),Object.defineProperty(C2c.prototype,"inputs",{get:function(){return this.executor.inputs},enumerable:!0,configurable:!0}),Object.defineProperty(C2c.prototype,"outputs",{get:function(){return this.executor.outputs},enumerable:!0,configurable:!0}),Object.defineProperty(C2c.prototype,"weights",{get:function(){return this.executor.weightMap},enumerable:!0,configurable:!0}),C2c.prototype.findIOHandler=function(){var t=this.modelUrl;if(this.requestOption||this.weightPrefix)this.handler=_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Xb.browserHTTPRequest(t,this.requestOption,this.weightPrefix,null,this.onProgress);else{var e=_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Xb.getLoadHandlers(t,this.onProgress);if(0===e.length)e.push(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Xb.browserHTTPRequest(t,this.requestOption,this.weightPrefix,null,this.onProgress));else if(1<e.length)throw new Error("Found more than one ("+e.length+") load handlers for URL '"+[t]+"'");this.handler=e[0]}},C2c.prototype.load=function(){return __awaiter(this,void 0,void 0,function(){var e,n,r;return __generator(this,function(t){switch(t.label){case 0:if(this.findIOHandler(),null==this.handler.load)throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");return[4,this.handler.load()];case 1:return e=t.sent(),n=e.modelTopology,this.version=n.versions.producer+"."+n.versions.minConsumer,r=_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Xb.decodeWeights(e.weightData,e.weightSpecs),this.executor=new GraphExecutor(OperationMapper$1.Instance.transformGraph(n)),this.executor.weightMap=this.convertTensorMapToTensorsMap(r),[2,!0]}})})},C2c.prototype.predict=function(t,e){return this.execute_(t,!0,this.outputNodes)},C2c.prototype.constructTensorMap=function(t){var r=t instanceof _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.o?[t]:t;if(r.length!==this.inputNodes.length)throw new Error("Input tensor count mismatch,the frozen model has "+this.inputNodes.length+" placeholders, while there are "+r.length+" input tensors.");return this.inputNodes.reduce(function(t,e,n){return t[e]=r[n],t},{})},C2c.prototype.execute=function(t,e){return this.execute_(t,!1,e)},C2c.prototype.execute_=function(t,e,n){if(void 0===e&&(e=!0),n=n||this.outputNodes,(t instanceof _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.o||Array.isArray(t))&&(t=this.constructTensorMap(t)),this.executor.isControlFlowModel||this.executor.isDynamicShapeModel)throw new Error("The model contains control flow or dynamic shape ops, please use executeAsync method");var r=this.executor.execute(this.convertTensorMapToTensorsMap(t),e,n),i=Object.keys(r);return Array.isArray(n)&&1<n.length?n.map(function(t){return r[t]}):r[i[0]]},C2c.prototype.executeAsync=function(r,i){return __awaiter(this,void 0,void 0,function(){var e,n;return __generator(this,function(t){switch(t.label){case 0:if(!this.executor.isControlFlowModel&&!this.executor.isDynamicShapeModel)throw new Error("The model does not contain control flow or dynamic shape ops, please use execute method for better performance.");return i=i||this.outputNodes,(r instanceof _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.o||Array.isArray(r))&&(r=this.constructTensorMap(r)),[4,this.executor.executeAsync(this.convertTensorMapToTensorsMap(r),i)];case 1:return e=t.sent(),n=Object.keys(e),[2,Array.isArray(i)&&1<i.length?i.map(function(t){return e[t]}):e[n[0]]]}})})},C2c.prototype.convertTensorMapToTensorsMap=function(n){return Object.keys(n).reduce(function(t,e){return t[e]=[n[e]],t},{})},C2c.prototype.dispose=function(){this.executor.dispose()},C2c);function C2c(t,e,n,r){this.modelUrl=t,this.requestOption=e,this.weightPrefix=n,this.onProgress=r,this.version="n/a"}function n1c(){var t=[arithmetic,basicMath,control,convolution,creation,dynamic,evaluation,logical,image$1,graph,matrices,normalization,reduction,sliceJoin,spectral,transformation],e=[].concat.apply([],t.map(function(t){return t.json}));this.opMappers=e.reduce(function(t,e){return t[e.tfOpName]=e,t},{})}function loadFrozenModel$1(n,r,i){return __awaiter(this,void 0,void 0,function(){var e;return __generator(this,function(t){switch(t.label){case 0:return[4,(e=new FrozenModel$1(n,r,null,i)).load()];case 1:return t.sent(),[2,e]}})})}var version="0.8.4";function loadFrozenModel$2(t,e,n,r){return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.mb)("tf.loadFrozenModel() is going away. Use tf.loadGraphModel() instead, and note the positional argument changes."),t&&t.endsWith(".json")?loadFrozenModel$1(t,n,r):(null!=t&&null==e&&(e=getWeightsManifestUrl(t)),loadFrozenModel(t,e,n,r))}function getWeightsManifestUrl(t){var e;return null!=t&&(e=t.substr(0,t.lastIndexOf("/"))+"/"+DEFAULT_MANIFEST_NAME),e}function loadGraphModel(t,e){if(void 0===e&&(e={}),null==e&&(e={}),e.fromTFHub)return loadTfHubModule(t,e.requestInit,e.onProgress);var n=void 0;return t&&t.endsWith(".json")?loadFrozenModel$1(t,e.requestInit,e.onProgress):(null!=t&&null==n&&(n=getWeightsManifestUrl(t)),loadFrozenModel(t,n,e.requestInit,e.onProgress))}}).call(this,__webpack_require__(15),__webpack_require__(14).Buffer)},function(t,Te,Me){"use strict";Me.r(Te),function(t,d,i){Me.d(Te,"array",function(){return Ft}),Me.d(Te,"Dataset",function(){return Mt}),Me.d(Te,"zip",function(){return zt}),Me.d(Te,"CSVDataset",function(){return oe}),Me.d(Te,"TextLineDataset",function(){return Qt}),Me.d(Te,"csv",function(){return Ae}),Me.d(Te,"generator",function(){return Ce}),Me.d(Te,"FileDataSource",function(){return Ne}),Me.d(Te,"URLDataSource",function(){return Ie}),Me.d(Te,"version_data",function(){return Pe});var u=Me(0),r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};
/**
 * @license
 * Copyright 2019 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.
 * =============================================================================
 */function o(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function c(o,a,s,u){return new(s||(s=Promise))(function(t,e){function n(t){try{i(u.next(t))}catch(t){e(t)}}function r(t){try{i(u.throw(t))}catch(t){e(t)}}function i(e){e.done?t(e.value):new s(function(t){t(e.value)}).then(n,r)}i((u=u.apply(o,a||[])).next())})}function l(n,r){var i,o,a,t,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(a=2&e[0]?o.return:e[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,e[1])).done)return a;switch(o=0,a&&(e=[2&e[0],a.value]),e[0]){case 0:case 1:a=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,o=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){s.label=e[1];break}if(6===e[0]&&s.label<a[1]){s.label=a[1],a=e;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(e);break}a[2]&&s.ops.pop(),s.trys.pop();continue}e=r.call(n,s)}catch(t){e=[6,t],o=0}finally{i=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}var v="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t,e){return t(e={exports:{}},e.exports),e.exports}var a=n(function(t){!function(t,e,n){function o(t,e){return e.c=t.c,e.s0=t.s0,e.s1=t.s1,e.s2=t.s2,e}function r(t,e){var n=new function(t){var r,e=this,n=(r=4022871197,function(t){t=t.toString();for(var e=0;e<t.length;e++){var n=.02519603282416938*(r+=t.charCodeAt(e));n-=r=n>>>0,r=(n*=r)>>>0,r+=4294967296*(n-=r)}return 2.3283064365386963e-10*(r>>>0)});e.next=function(){var t=2091639*e.s0+2.3283064365386963e-10*e.c;return e.s0=e.s1,e.s1=e.s2,e.s2=t-(e.c=0|t)},e.c=1,e.s0=n(" "),e.s1=n(" "),e.s2=n(" "),e.s0-=n(t),e.s0<0&&(e.s0+=1),e.s1-=n(t),e.s1<0&&(e.s1+=1),e.s2-=n(t),e.s2<0&&(e.s2+=1),n=null}(t),r=e&&e.state,i=n.next;return i.int32=function(){return 4294967296*n.next()|0},i.double=function(){return i()+11102230246251565e-32*(2097152*i()|0)},i.quick=i,r&&("object"==typeof r&&o(r,n),i.state=function(){return o(n,{})}),i}e&&e.exports?e.exports=r:this.alea=r}(0,t)}),s=n(function(t){!function(t,e,n){function o(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e}function r(t,e){function n(){return(r.next()>>>0)/4294967296}var r=new function(t){var e=this,n="";e.x=0,e.y=0,e.z=0,e.w=0,e.next=function(){var t=e.x^e.x<<11;return e.x=e.y,e.y=e.z,e.z=e.w,e.w^=e.w>>>19^t^t>>>8},t===(0|t)?e.x=t:n+=t;for(var r=0;r<n.length+64;r++)e.x^=0|n.charCodeAt(r),e.next()}(t),i=e&&e.state;return n.double=function(){do{var t=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&o(i,r),n.state=function(){return o(r,{})}),n}e&&e.exports?e.exports=r:this.xor128=r}(0,t)}),f=n(function(t){!function(t,e,n){function o(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e.v=t.v,e.d=t.d,e}function r(t,e){function n(){return(r.next()>>>0)/4294967296}var r=new function(t){var e=this,n="";e.next=function(){var t=e.x^e.x>>>2;return e.x=e.y,e.y=e.z,e.z=e.w,e.w=e.v,(e.d=e.d+362437|0)+(e.v=e.v^e.v<<4^t^t<<1)|0},e.x=0,e.y=0,e.z=0,e.w=0,t===((e.v=0)|t)?e.x=t:n+=t;for(var r=0;r<n.length+64;r++)e.x^=0|n.charCodeAt(r),r==n.length&&(e.d=e.x<<10^e.x>>>4),e.next()}(t),i=e&&e.state;return n.double=function(){do{var t=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&o(i,r),n.state=function(){return o(r,{})}),n}e&&e.exports?e.exports=r:this.xorwow=r}(0,t)}),h=n(function(t){!function(t,e,n){function o(t,e){return e.x=t.x.slice(),e.i=t.i,e}function r(t,e){null==t&&(t=+new Date);function n(){return(r.next()>>>0)/4294967296}var r=new function(t){var i=this;i.next=function(){var t,e,n=i.x,r=i.i;return t=n[r],e=(t^=t>>>7)^t<<24,e^=(t=n[r+1&7])^t>>>10,e^=(t=n[r+3&7])^t>>>3,e^=(t=n[r+4&7])^t<<7,t=n[r+7&7],e^=(t^=t<<13)^t<<9,n[r]=e,i.i=r+1&7,e},function(t,e){var n,r=[];if(e===(0|e))r[0]=e;else for(e=""+e,n=0;n<e.length;++n)r[7&n]=r[7&n]<<15^e.charCodeAt(n)+r[n+1&7]<<13;for(;r.length<8;)r.push(0);for(n=0;n<8&&0===r[n];++n);for(8==n?r[7]=-1:r[n],t.x=r,t.i=0,n=256;0<n;--n)t.next()}(i,t)}(t),i=e&&e.state;return n.double=function(){do{var t=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},n.int32=r.next,n.quick=n,i&&(i.x&&o(i,r),n.state=function(){return o(r,{})}),n}e&&e.exports?e.exports=r:this.xorshift7=r}(0,t)}),p=n(function(t){!function(t,e,n){function o(t,e){return e.i=t.i,e.w=t.w,e.X=t.X.slice(),e}function r(t,e){null==t&&(t=+new Date);function n(){return(r.next()>>>0)/4294967296}var r=new function(t){var o=this;o.next=function(){var t,e,n=o.w,r=o.X,i=o.i;return o.w=n=n+1640531527|0,e=r[i+34&127],t=r[i=i+1&127],e^=e<<13,t^=t<<17,e^=e>>>15,t^=t>>>12,e=r[i]=e^t,o.i=i,e+(n^n>>>16)|0},function(t,e){var n,r,i,o,a,s=[],u=128;for(e===(0|e)?(r=e,e=null):(e+="\0",r=0,u=Math.max(u,e.length)),i=0,o=-32;o<u;++o)e&&(r^=e.charCodeAt((o+32)%e.length)),0===o&&(a=r),r^=r<<10,r^=r>>>15,r^=r<<4,r^=r>>>13,0<=o&&(a=a+1640531527|0,i=0==(n=s[127&o]^=r+a)?i+1:0);for(128<=i&&(s[127&(e&&e.length||0)]=-1),i=127,o=512;0<o;--o)r=s[i+34&127],n=s[i=i+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[i]=r^n;t.w=a,t.X=s,t.i=i}(o,t)}(t),i=e&&e.state;return n.double=function(){do{var t=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},n.int32=r.next,n.quick=n,i&&(i.X&&o(i,r),n.state=function(){return o(r,{})}),n}e&&e.exports?e.exports=r:this.xor4096=r}(0,t)}),m=n(function(t){!function(t,e,n){function o(t,e){return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e}function r(t,e){function n(){return(r.next()>>>0)/4294967296}var r=new function(t){var i=this,e="";i.next=function(){var t=i.b,e=i.c,n=i.d,r=i.a;return t=t<<25^t>>>7^e,e=e-n|0,n=n<<24^n>>>8^r,r=r-t|0,i.b=t=t<<20^t>>>12^e,i.c=e=e-n|0,i.d=n<<16^e>>>16^r,i.a=r-t|0},i.a=0,i.b=0,i.c=-1640531527,i.d=1367130551,t===Math.floor(t)?(i.a=t/4294967296|0,i.b=0|t):e+=t;for(var n=0;n<e.length+20;n++)i.b^=0|e.charCodeAt(n),i.next()}(t),i=e&&e.state;return n.double=function(){do{var t=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&o(i,r),n.state=function(){return o(r,{})}),n}e&&e.exports?e.exports=r:this.tychei=r}(0,t)}),g=n(function(e){!function(s,u){var c,l=(0,eval)("this"),f=u.pow(256,6),h=u.pow(2,52),p=2*h,d=255;function t(t,e,n){function r(){for(var t=a.g(6),e=f,n=0;t<h;)t=256*(t+n),e*=256,n=a.g(1);for(;p<=t;)t/=2,e/=2,n>>>=1;return(t+n)/e}var i=[],o=g(function t(e,n){var r,i=[],o=typeof e;if(n&&"object"==o)for(r in e)try{i.push(t(e[r],n-1))}catch(t){}return i.length?i:"string"==o?e:e+"\0"}((e=1==e?{entropy:!0}:e||{}).entropy?[t,y(s)]:null==t?function(){try{var t;return c&&(t=c.randomBytes)?t=t(256):(t=new Uint8Array(256),(l.crypto||l.msCrypto).getRandomValues(t)),y(t)}catch(t){var e=l.navigator,n=e&&e.plugins;return[+new Date,l,n,l.screen,y(s)]}}():t,3),i),a=new function(t){var e,n=t.length,a=this,r=0,i=a.i=a.j=0,o=a.S=[];for(n||(t=[n++]);r<256;)o[r]=r++;for(r=0;r<256;r++)o[r]=o[i=d&i+t[r%n]+(e=o[r])],o[i]=e;(a.g=function(t){for(var e,n=0,r=a.i,i=a.j,o=a.S;t--;)e=o[r=d&r+1],n=256*n+o[d&(o[r]=o[i=d&i+e])+(o[i]=e)];return a.i=r,a.j=i,n})(256)}(i);return r.int32=function(){return 0|a.g(4)},r.quick=function(){return a.g(4)/4294967296},r.double=r,g(y(a.S),s),(e.pass||n||function(t,e,n,r){return r&&(r.S&&m(r,a),t.state=function(){return m(a,{})}),n?(u.random=t,e):t})(r,o,"global"in e?e.global:this==u,e.state)}function m(t,e){return e.i=t.i,e.j=t.j,e.S=t.S.slice(),e}function g(t,e){for(var n,r=t+"",i=0;i<r.length;)e[d&i]=d&(n^=19*e[d&i])+r.charCodeAt(i++);return y(e)}function y(t){return String.fromCharCode.apply(0,t)}if(u.seedrandom=t,g(u.random(),s),e.exports){e.exports=t;try{c=Me(191)}catch(t){}}}([],Math)});g.alea=a,g.xor128=s,g.xorwow=f,g.xorshift7=h,g.xor4096=p,g.tychei=m;var y=g.alea,b=n(function(t,e){function r(t){for(var e=t.length,n=0,r=0;0<e;)r=Math.random()*e|0,n=t[--e],t[e]=t[r],t[r]=n}function u(t,e){if(!t)throw new Error("string"==typeof e?e:e())}function o(t,e){if(void 0===e&&(e=[]),Array.isArray(t)||l(t))for(var n=0;n<t.length;++n)o(t[n],e);else e.push(t);return e}function i(t,e){if(t===e)return!0;if(null==t||null==e)return!1;if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function a(t){return t%1==0}function s(t,e){var n=e.length;return u((t=null==t?e.map(function(t,e){return e}):[].concat(t)).every(function(t){return-n<=t&&t<n}),"All values in axis param must be in range [-"+n+", "+n+") but got axis "+t),u(t.every(function(t){return a(t)}),"All values in axis param must be integers but got axis "+t),t.map(function(t){return t<0?n+t:t})}function c(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(isNaN(r)||!isFinite(r))throw Error("A tensor of type "+e+" being uploaded contains "+r+".")}}function l(t){return t instanceof Float32Array||t instanceof Int32Array||t instanceof Uint8Array}function n(t){return"string"==typeof t||t instanceof String}function f(t){return"boolean"==typeof t}function h(t){return"number"==typeof t}function p(t,e){if(null==e||"float32"===e||"complex64"===e)return new Float32Array(t);if("int32"===e)return new Int32Array(t);if("bool"===e)return new Uint8Array(t);throw new Error("Unknown data type "+e)}Object.defineProperty(e,"__esModule",{value:!0}),e.shuffle=r,e.clamp=function(t,e,n){return Math.max(t,Math.min(e,n))},e.nearestLargerEven=function(t){return t%2==0?t:t+1},e.sum=function(t){for(var e=0,n=0;n<t.length;n++)e+=t[n];return e},e.randUniform=function(t,e){var n=Math.random();return e*n+(1-n)*t},e.distSquared=function(t,e){for(var n=0,r=0;r<t.length;r++){var i=Number(t[r])-Number(e[r]);n+=i*i}return n},e.assert=u,e.assertShapesMatch=function(t,e,n){void 0===n&&(n=""),u(i(t,e),n+" Shapes "+t+" and "+e+" must match")},e.assertNonNull=function(t){u(null!=t,"The input to the tensor constructor must be a non-null value.")},e.flatten=o,e.sizeFromShape=function(t){if(0===t.length)return 1;for(var e=t[0],n=1;n<t.length;n++)e*=t[n];return e},e.isScalarShape=function(t){return 0===t.length},e.arraysEqual=i,e.isInt=a,e.tanh=function(t){if(null!=Math.tanh)return Math.tanh(t);if(t===1/0)return 1;if(t===-1/0)return-1;var e=Math.exp(2*t);return(e-1)/(e+1)},e.sizeToSquarishShape=function(t){var e=Math.ceil(Math.sqrt(t));return[e,Math.ceil(t/e)]},e.createShuffledIndices=function(t){for(var e=new Uint32Array(t),n=0;n<t;++n)e[n]=n;return r(e),e},e.rightPad=function(t,e){return e<=t.length?t:t+" ".repeat(e-t.length)},e.repeatedTry=function(o,a,s){return void 0===a&&(a=function(t){return 0}),new Promise(function(e,n){var r=0,i=function(){if(o())e();else{var t=a(++r);null!=s&&s<=r?n():setTimeout(i,t)}};i()})},e.inferFromImplicitShape=function(t,e){for(var n=1,r=-1,i=0;i<t.length;++i)if(0<=t[i])n*=t[i];else if(-1===t[i]){if(-1!==r)throw Error("Shapes can only have 1 implicit size. Found -1 at dim "+r+" and dim "+i);r=i}else if(t[i]<0)throw Error("Shapes can not be < 0. Found "+t[i]+" at dim "+i);if(-1===r){if(0<e&&e!==n)throw Error("Size("+e+") must match the product of shape "+t);return t}if(0===n)throw Error("Cannot infer the missing size in ["+t+"] when there are 0 elements");if(e%n!=0)throw Error("The implicit shape can't be a fractional number. Got "+e+" / "+n);var o=t.slice();return o[r]=e/n,o},e.parseAxisParam=s,e.squeezeShape=function(t,e){for(var n=[],r=[],i=null==e?null:s(e,t).sort(),o=0,a=0;a<t.length;++a){if(null!=i){if(i[o]===a&&1!==t[a])throw new Error("Can't squeeze axis "+a+" since its dim '"+t[a]+"' is not 1");(null==i[o]||i[o]>a)&&1===t[a]&&(n.push(t[a]),r.push(a)),i[o]<=a&&o++}1!==t[a]&&(n.push(t[a]),r.push(a))}return{newShape:n,keptDims:r}},e.getTypedArrayFromDType=function(t,e){var n=null;if(null==t||"float32"===t)n=new Float32Array(e);else if("int32"===t)n=new Int32Array(e);else{if("bool"!==t)throw new Error("Unknown data type "+t);n=new Uint8Array(e)}return n},e.getArrayFromDType=function(t,e){var n=null;if(null==t||"float32"===t)n=new Float32Array(e);else if("int32"===t)n=new Int32Array(e);else if("bool"===t)n=new Uint8Array(e);else{if("string"!==t)throw new Error("Unknown data type "+t);n=new Array(e)}return n},e.checkComputationForErrors=function(t,e,n){if("float32"===e)for(var r=0;r<t.length;r++){var i=t[r];if(isNaN(i)||!isFinite(i))throw Error("The result of the '"+n+"' is "+i+".")}},e.checkConversionForErrors=c,e.hasEncodingLoss=function(t,e){return!("complex64"===e||"float32"===e&&"complex64"!==t||"int32"===e&&"float32"!==t&&"complex64"!==t||"bool"===e&&"bool"===t)},e.isTypedArray=l,e.bytesPerElement=function(t){if("float32"===t||"int32"===t)return 4;if("complex64"===t)return 8;if("bool"===t)return 1;throw new Error("Unknown dtype "+t)},e.bytesFromStringArray=function(t){if(null==t)return 0;var e=0;return t.forEach(function(t){return e+=2*t.length}),e},e.isString=n,e.isBoolean=f,e.isNumber=h,e.inferDtype=function t(e){return Array.isArray(e)?t(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array?"int32":h(e)?"float32":n(e)?"string":f(e)?"bool":"float32"},e.isFunction=function(t){return!!(t&&t.constructor&&t.call&&t.apply)},e.nearestDivisor=function(t,e){for(var n=e;n<t;++n)if(t%n==0)return n;return t},e.computeStrides=function(t){var e=t.length;if(e<2)return[];var n=new Array(e-1);n[e-2]=t[e-1];for(var r=e-3;0<=r;--r)n[r]=n[r+1]*t[r+1];return n},e.toTypedArray=function(t,e,n){if("string"===e)throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(t)&&(t=o(t)),n&&c(t,e),t instanceof Float32Array&&"float32"===e||t instanceof Int32Array&&"int32"===e||t instanceof Uint8Array&&"bool"===e)return t;if(null==e||"float32"===e||"complex64"===e)return new Float32Array(t);if("int32"===e)return new Int32Array(t);if("bool"!==e)throw new Error("Unknown data type "+e);for(var r=new Uint8Array(t.length),i=0;i<r.length;++i)0!==Math.round(t[i])&&(r[i]=1);return r},e.toNestedArray=function(t,e){if(0===t.length)return e[0];var n=t.reduce(function(t,e){return t*e});if(0===n)return[];if(n!==e.length)throw new Error("["+t+"] does not match the input size.");return function t(e,n,r){var i=new Array;if(1===n.length)for(var o=n[0],a=0;a<o;a++)i[a]=r[e+a];else{o=n[0];var s=n.slice(1),u=s.reduce(function(t,e){return t*e});for(a=0;a<o;a++)i[a]=t(e+a*u,s,r)}return i}(0,t,e)},e.makeOnesTypedArray=function(t,e){for(var n=p(t,e),r=0;r<n.length;r++)n[r]=1;return n},e.makeZerosTypedArray=p,e.now=function(){if("undefined"!=typeof performance)return performance.now();if(void 0===d)throw new Error("Cannot measure time in this environment. You should run tf.js in the browser or in Node.js");var t=d.hrtime();return 1e3*t[0]+t[1]/1e6},e.monitorPromisesProgress=function(n,r,i,o){var t,e,a;u(null!=(a=n)&&Array.isArray(a)&&0<a.length,"promises must be a none empty array"),t=i=null==i?0:i,e=o=null==o?1:o,u(0<=t&&t<=1,"Progress fraction must be in range [0, 1], but got startFraction "+t),u(0<=e&&e<=1,"Progress fraction must be in range [0, 1], but got endFraction "+e),u(t<=e,"startFraction must be no more than endFraction, but got startFraction "+t+" and endFraction "+e);var s=0;return Promise.all(n.map(function(t){return t.then(function(t){var e=i+ ++s/n.length*(o-i);return r(e),t}),t}))}});e(b);b.shuffle,b.clamp,b.nearestLargerEven,b.sum,b.randUniform,b.distSquared,b.assert,b.assertShapesMatch,b.assertNonNull,b.flatten,b.sizeFromShape,b.isScalarShape,b.arraysEqual,b.isInt,b.tanh,b.sizeToSquarishShape,b.createShuffledIndices,b.rightPad,b.repeatedTry,b.inferFromImplicitShape,b.parseAxisParam,b.squeezeShape,b.getTypedArrayFromDType,b.getArrayFromDType,b.checkComputationForErrors,b.checkConversionForErrors,b.hasEncodingLoss,b.isTypedArray,b.bytesPerElement,b.bytesFromStringArray,b.isString,b.isBoolean,b.isNumber,b.inferDtype,b.isFunction,b.nearestDivisor,b.computeStrides,b.toTypedArray,b.toNestedArray,b.makeOnesTypedArray,b.makeZerosTypedArray,b.now,b.monitorPromisesProgress;var w=n(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var r=7;function x(t,e){var n;return n=Array.isArray(t)?parseFloat(t[0].toFixed(r))+" + "+parseFloat(t[1].toFixed(r))+"j":b.isString(t)?"'"+t+"'":parseFloat(t.toFixed(r)).toString(),b.rightPad(n,e)}function E(t){for(var e=[],n=0;n<t.length;n+=2)e.push([t[n],t[n+1]]);return e}e.tensorToString=function(t,e,n,r){var i=b.computeStrides(e),o=function(t,e,n,r){var i=b.sizeFromShape(e),o=r[r.length-1],a=new Array(o).fill(0),s=e.length,u="complex64"===n?E(t):t;if(1<s)for(var c=0;c<i/o;c++)for(var l=c*o,f=0;f<o;f++)a[f]=Math.max(a[f],x(u[l+f],0).length);return a}(t,e,n,i),a=e.length,s=function t(e,n,r,i,o,a){void 0===a&&(a=!0);var s="complex64"===r?2:1,u=n[0],c=n.length;if(0===c)return"complex64"!==r?[e[0].toString()]:[x(E(e)[0],0)];if(1===c){if(20<u){var l=3*s,f=Array.from(e.slice(0,l)),h=Array.from(e.slice(u-3*s,u));return"complex64"===r&&(f=E(f),h=E(h)),["["+f.map(function(t,e){return x(t,o[e])}).join(", ")+", ..., "+h.map(function(t,e){return x(t,o[u-3+e])}).join(", ")+"]"]}return["["+("complex64"===r?E(e):Array.from(e)).map(function(t,e){return x(t,o[e])}).join(", ")+"]"]}var p=n.slice(1),d=i.slice(1),m=i[0]*s,g=[];if(20<u){for(var y=0;y<3;y++){var v=(b=y*m)+m;g.push.apply(g,t(e.slice(b,v),p,r,d,o,!1))}g.push("...");for(y=u-3;y<u;y++){v=(b=y*m)+m;g.push.apply(g,t(e.slice(b,v),p,r,d,o,y===u-1))}}else for(y=0;y<u;y++){var b;v=(b=y*m)+m;g.push.apply(g,t(e.slice(b,v),p,r,d,o,y===u-1))}var w=2===c?",":"";g[0]="["+g[0]+w;for(y=1;y<g.length-1;y++)g[y]=" "+g[y]+w;var _=",\n";for(y=2;y<c;y++)_+="\n";return g[g.length-1]=" "+g[g.length-1]+"]"+(a?"":_),g}(t,e,n,i,o),u=["Tensor"];return r&&(u.push("  dtype: "+n),u.push("  rank: "+a),u.push("  shape: ["+e+"]"),u.push("  values:")),u.push(s.map(function(t){return"    "+t}).join("\n")),u.join("\n")}});e(w);w.tensorToString;var _=n(function(t,e){var r,n=v&&v.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=v&&v.__awaiter||function(o,a,s,u){return new(s||(s=Promise))(function(t,e){function n(t){try{i(u.next(t))}catch(t){e(t)}}function r(t){try{i(u.throw(t))}catch(t){e(t)}}function i(e){e.done?t(e.value):new s(function(t){t(e.value)}).then(n,r)}i((u=u.apply(o,a||[])).next())})},o=v&&v.__generator||function(n,r){var i,o,a,t,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(a=2&e[0]?o.return:e[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,e[1])).done)return a;switch(o=0,a&&(e=[2&e[0],a.value]),e[0]){case 0:case 1:a=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,o=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){s.label=e[1];break}if(6===e[0]&&s.label<a[1]){s.label=a[1],a=e;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(e);break}a[2]&&s.ops.pop(),s.trys.pop();continue}e=r.call(n,s)}catch(t){e=[6,t],o=0}finally{i=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}};Object.defineProperty(e,"__esModule",{value:!0});var a=b,s=(u.prototype.set=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];0===e.length&&(e=[0]),b.assert(e.length===this.rank,"The number of provided coordinates ("+e.length+") must match the rank ("+this.rank+")");var r=this.locToIndex(e);this.values[r]=t},u.prototype.get=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];0===t.length&&(t=[0]);for(var n=t[t.length-1],r=0;r<t.length-1;++r)n+=this.strides[r]*t[r];return this.values[n]},u.prototype.locToIndex=function(t){if(0===this.rank)return 0;if(1===this.rank)return t[0];for(var e=t[t.length-1],n=0;n<t.length-1;++n)e+=this.strides[n]*t[n];return e},u.prototype.indexToLoc=function(t){if(0===this.rank)return[];if(1===this.rank)return[t];for(var e=new Array(this.shape.length),n=0;n<e.length-1;++n)e[n]=Math.floor(t/this.strides[n]),t-=e[n]*this.strides[n];return e[e.length-1]=t,e},Object.defineProperty(u.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),u.prototype.toTensor=function(){return h.make(this.shape,{values:this.values},this.dtype)},u);function u(t,e,n){if(this.dtype=e,this.shape=t.slice(),this.size=b.sizeFromShape(t),null!=n){var r=n.length;b.assert(r===this.size,"Length of values '"+r+"' does not match the size inferred by the shape '"+this.size+"'.")}if("complex64"===e)throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||b.getArrayFromDType(e,b.sizeFromShape(this.shape)),this.strides=a.computeStrides(t)}e.TensorBuffer=s;var c=null,l=null,f=null;e.setTensorTracker=function(t){c=t},e.setOpHandler=function(t){l=t},e.setDeprecationWarningFn=function(t){f=t};var h=(p.make=function(t,e,n){return new p(t,n,e.values,e.dataId)},p.prototype.flatten=function(){return this.throwIfDisposed(),this.as1D()},p.prototype.asScalar=function(){return this.throwIfDisposed(),b.assert(1===this.size,"The array must have only 1 element."),this.reshape([])},p.prototype.as1D=function(){return this.throwIfDisposed(),this.reshape([this.size])},p.prototype.as2D=function(t,e){return this.throwIfDisposed(),this.reshape([t,e])},p.prototype.as3D=function(t,e,n){return this.throwIfDisposed(),this.reshape([t,e,n])},p.prototype.as4D=function(t,e,n,r){return this.throwIfDisposed(),this.reshape([t,e,n,r])},p.prototype.as5D=function(t,e,n,r,i){return this.throwIfDisposed(),this.reshape([t,e,n,r,i])},p.prototype.asType=function(t){return this.throwIfDisposed(),l.cast(this,t)},Object.defineProperty(p.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),p.prototype.get=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];f("Tensor.get() is deprecated. Use Tensor.array() and native array indexing instead."),b.assert(t.length===this.rank,"Number of coordinates in get() must match the rank of the tensor"),b.assert("complex64"!==this.dtype,"Tensor.get() is not supported for complex64 tensors yet."),this.throwIfDisposed(),0===t.length&&(t=[0]);for(var n=t[t.length-1],r=0;r<t.length-1;++r)n+=this.strides[r]*t[r];return this.dataSync()[n]},p.prototype.buffer=function(){return f("Tensor.buffer() is renamed to Tensor.bufferSync() in TensorFlow.js 1.0 and Tensor.buffer() will become an async function."),l.buffer(this.shape,this.dtype,this.dataSync())},p.prototype.bufferSync=function(){return l.buffer(this.shape,this.dtype,this.dataSync())},p.prototype.array=function(){return i(this,void 0,void 0,function(){var e,n;return o(this,function(t){switch(t.label){case 0:return e=a.toNestedArray,n=[this.shape],[4,this.data()];case 1:return[2,e.apply(void 0,n.concat([t.sent()]))]}})})},p.prototype.arraySync=function(){return a.toNestedArray(this.shape,this.dataSync())},p.prototype.data=function(){return i(this,void 0,void 0,function(){return o(this,function(t){return this.throwIfDisposed(),[2,c().read(this.dataId)]})})},p.prototype.dataSync=function(){return this.throwIfDisposed(),c().readSync(this.dataId)},p.prototype.dispose=function(){this.isDisposed||(c().disposeTensor(this),this.isDisposedInternal=!0)},Object.defineProperty(p.prototype,"isDisposed",{get:function(){return this.isDisposedInternal},enumerable:!0,configurable:!0}),p.prototype.throwIfDisposed=function(){if(this.isDisposed)throw new Error("Tensor is disposed.")},p.prototype.toFloat=function(){return this.asType("float32")},p.prototype.toInt=function(){return this.asType("int32")},p.prototype.toBool=function(){return this.asType("bool")},p.prototype.print=function(t){return void 0===t&&(t=!1),l.print(this,t)},p.prototype.reshape=function(t){return this.throwIfDisposed(),l.reshape(this,t)},p.prototype.reshapeAs=function(t){return this.throwIfDisposed(),this.reshape(t.shape)},p.prototype.expandDims=function(t){return void 0===t&&(t=0),l.expandDims(this,t)},p.prototype.cumsum=function(t,e,n){return void 0===t&&(t=0),void 0===e&&(e=!1),void 0===n&&(n=!1),l.cumsum(this,t,e,n)},p.prototype.squeeze=function(t){return this.throwIfDisposed(),l.squeeze(this,t)},p.prototype.clone=function(){return this.throwIfDisposed(),l.clone(this)},p.prototype.oneHot=function(t,e,n){return this.throwIfDisposed(),l.oneHot(this,t,e,n)},p.prototype.toString=function(t){void 0===t&&(t=!1);var e=this.dataSync();return w.tensorToString(e,this.shape,this.dtype,t)},p.prototype.tile=function(t){return this.throwIfDisposed(),l.tile(this,t)},p.prototype.gather=function(t,e){return void 0===e&&(e=0),this.throwIfDisposed(),l.gather(this,t,e)},p.prototype.matMul=function(t,e,n){return void 0===e&&(e=!1),void 0===n&&(n=!1),this.throwIfDisposed(),l.matMul(this,t,e,n)},p.prototype.dot=function(t){return this.throwIfDisposed(),l.dot(this,t)},p.prototype.norm=function(t,e,n){return void 0===t&&(t="euclidean"),void 0===e&&(e=null),void 0===n&&(n=!1),this.throwIfDisposed(),l.norm(this,t,e,n)},p.prototype.slice=function(t,e){return this.throwIfDisposed(),l.slice(this,t,e)},p.prototype.reverse=function(t){return this.throwIfDisposed(),l.reverse(this,t)},p.prototype.concat=function(t,e){return void 0===e&&(e=0),this.throwIfDisposed(),t instanceof p&&(t=[t]),l.concat([this].concat(t),e)},p.prototype.split=function(t,e){return void 0===e&&(e=0),this.throwIfDisposed(),l.split(this,t,e)},p.prototype.stack=function(t,e){return void 0===e&&(e=0),l.stack([this,t],e)},p.prototype.unstack=function(t){return void 0===t&&(t=0),l.unstack(this,t)},p.prototype.pad=function(t,e){return void 0===e&&(e=0),l.pad(this,t,e)},p.prototype.batchNormalization=function(t,e,n,r,i){return void 0===n&&(n=.001),f("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon"),this.batchNorm(t,e,i,r,n)},p.prototype.batchNorm=function(t,e,n,r,i){return void 0===i&&(i=.001),this.throwIfDisposed(),l.batchNorm(this,t,e,n,r,i)},p.prototype.all=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),l.all(this,t,e)},p.prototype.any=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),l.any(this,t,e)},p.prototype.logSumExp=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),l.logSumExp(this,t,e)},p.prototype.sum=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),l.sum(this,t,e)},p.prototype.prod=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),l.prod(this,t,e)},p.prototype.mean=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),l.mean(this,t,e)},p.prototype.min=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),l.min(this,t,e)},p.prototype.max=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),l.max(this,t,e)},p.prototype.argMin=function(t){return void 0===t&&(t=null),this.throwIfDisposed(),l.argMin(this,t)},p.prototype.argMax=function(t){return void 0===t&&(t=null),this.throwIfDisposed(),l.argMax(this,t)},p.prototype.cast=function(t){return this.throwIfDisposed(),l.cast(this,t)},p.prototype.add=function(t){return this.throwIfDisposed(),l.add(this,t)},p.prototype.addStrict=function(t){return this.throwIfDisposed(),l.addStrict(this,t)},p.prototype.atan2=function(t){return this.throwIfDisposed(),l.atan2(this,t)},p.prototype.sub=function(t){return this.throwIfDisposed(),l.sub(this,t)},p.prototype.subStrict=function(t){return this.throwIfDisposed(),l.subStrict(this,t)},p.prototype.pow=function(t){return this.throwIfDisposed(),l.pow(this,t)},p.prototype.powStrict=function(t){return this.throwIfDisposed(),l.powStrict(this,t)},p.prototype.mul=function(t){return this.throwIfDisposed(),l.mul(this,t)},p.prototype.mulStrict=function(t){return this.throwIfDisposed(),l.mulStrict(this,t)},p.prototype.div=function(t){return this.throwIfDisposed(),l.div(this,t)},p.prototype.floorDiv=function(t){return this.throwIfDisposed(),l.floorDiv(this,t)},p.prototype.divStrict=function(t){return this.throwIfDisposed(),l.divStrict(this,t)},p.prototype.minimum=function(t){return this.throwIfDisposed(),l.minimum(this,t)},p.prototype.minimumStrict=function(t){return this.throwIfDisposed(),l.minimumStrict(this,t)},p.prototype.maximum=function(t){return this.throwIfDisposed(),l.maximum(this,t)},p.prototype.maximumStrict=function(t){return this.throwIfDisposed(),l.maximumStrict(this,t)},p.prototype.mod=function(t){return this.throwIfDisposed(),l.mod(this,t)},p.prototype.modStrict=function(t){return this.throwIfDisposed(),l.modStrict(this,t)},p.prototype.squaredDifference=function(t){return this.throwIfDisposed(),l.squaredDifference(this,t)},p.prototype.squaredDifferenceStrict=function(t){return this.throwIfDisposed(),l.squaredDifferenceStrict(this,t)},p.prototype.transpose=function(t){return this.throwIfDisposed(),l.transpose(this,t)},p.prototype.notEqual=function(t){return this.throwIfDisposed(),l.notEqual(this,t)},p.prototype.notEqualStrict=function(t){return this.throwIfDisposed(),l.notEqualStrict(this,t)},p.prototype.less=function(t){return this.throwIfDisposed(),l.less(this,t)},p.prototype.lessStrict=function(t){return this.throwIfDisposed(),l.lessStrict(this,t)},p.prototype.equal=function(t){return this.throwIfDisposed(),l.equal(this,t)},p.prototype.equalStrict=function(t){return this.throwIfDisposed(),l.equalStrict(this,t)},p.prototype.lessEqual=function(t){return this.throwIfDisposed(),l.lessEqual(this,t)},p.prototype.lessEqualStrict=function(t){return this.throwIfDisposed(),l.lessEqualStrict(this,t)},p.prototype.greater=function(t){return this.throwIfDisposed(),l.greater(this,t)},p.prototype.greaterStrict=function(t){return this.throwIfDisposed(),l.greaterStrict(this,t)},p.prototype.greaterEqual=function(t){return this.throwIfDisposed(),l.greaterEqual(this,t)},p.prototype.greaterEqualStrict=function(t){return this.throwIfDisposed(),l.greaterEqualStrict(this,t)},p.prototype.logicalAnd=function(t){return this.throwIfDisposed(),l.logicalAnd(this,t)},p.prototype.logicalOr=function(t){return this.throwIfDisposed(),l.logicalOr(this,t)},p.prototype.logicalNot=function(){return this.throwIfDisposed(),l.logicalNot(this)},p.prototype.logicalXor=function(t){return this.throwIfDisposed(),l.logicalXor(this,t)},p.prototype.where=function(t,e){return this.throwIfDisposed(),l.where(t,this,e)},p.prototype.neg=function(){return this.throwIfDisposed(),l.neg(this)},p.prototype.ceil=function(){return this.throwIfDisposed(),l.ceil(this)},p.prototype.floor=function(){return this.throwIfDisposed(),l.floor(this)},p.prototype.sign=function(){return this.throwIfDisposed(),l.sign(this)},p.prototype.exp=function(){return this.throwIfDisposed(),l.exp(this)},p.prototype.expm1=function(){return this.throwIfDisposed(),l.expm1(this)},p.prototype.log=function(){return this.throwIfDisposed(),l.log(this)},p.prototype.log1p=function(){return this.throwIfDisposed(),l.log1p(this)},p.prototype.sqrt=function(){return this.throwIfDisposed(),l.sqrt(this)},p.prototype.rsqrt=function(){return this.throwIfDisposed(),l.rsqrt(this)},p.prototype.square=function(){return this.throwIfDisposed(),l.square(this)},p.prototype.reciprocal=function(){return this.throwIfDisposed(),l.reciprocal(this)},p.prototype.abs=function(){return this.throwIfDisposed(),l.abs(this)},p.prototype.clipByValue=function(t,e){return this.throwIfDisposed(),l.clipByValue(this,t,e)},p.prototype.relu=function(){return this.throwIfDisposed(),l.relu(this)},p.prototype.elu=function(){return this.throwIfDisposed(),l.elu(this)},p.prototype.selu=function(){return this.throwIfDisposed(),l.selu(this)},p.prototype.leakyRelu=function(t){return void 0===t&&(t=.2),this.throwIfDisposed(),l.leakyRelu(this,t)},p.prototype.prelu=function(t){return this.throwIfDisposed(),l.prelu(this,t)},p.prototype.sigmoid=function(){return this.throwIfDisposed(),l.sigmoid(this)},p.prototype.logSigmoid=function(){return this.throwIfDisposed(),l.logSigmoid(this)},p.prototype.softplus=function(){return this.throwIfDisposed(),l.softplus(this)},p.prototype.zerosLike=function(){return this.throwIfDisposed(),l.zerosLike(this)},p.prototype.onesLike=function(){return this.throwIfDisposed(),l.onesLike(this)},p.prototype.sin=function(){return this.throwIfDisposed(),l.sin(this)},p.prototype.cos=function(){return this.throwIfDisposed(),l.cos(this)},p.prototype.tan=function(){return this.throwIfDisposed(),l.tan(this)},p.prototype.asin=function(){return this.throwIfDisposed(),l.asin(this)},p.prototype.acos=function(){return this.throwIfDisposed(),l.acos(this)},p.prototype.atan=function(){return this.throwIfDisposed(),l.atan(this)},p.prototype.sinh=function(){return this.throwIfDisposed(),l.sinh(this)},p.prototype.cosh=function(){return this.throwIfDisposed(),l.cosh(this)},p.prototype.tanh=function(){return this.throwIfDisposed(),l.tanh(this)},p.prototype.asinh=function(){return this.throwIfDisposed(),l.asinh(this)},p.prototype.acosh=function(){return this.throwIfDisposed(),l.acosh(this)},p.prototype.atanh=function(){return this.throwIfDisposed(),l.atanh(this)},p.prototype.erf=function(){return this.throwIfDisposed(),l.erf(this)},p.prototype.round=function(){return this.throwIfDisposed(),l.round(this)},p.prototype.step=function(t){return void 0===t&&(t=0),this.throwIfDisposed(),l.step(this,t)},p.prototype.softmax=function(t){return void 0===t&&(t=-1),this.throwIfDisposed(),l.softmax(this,t)},p.prototype.logSoftmax=function(t){return void 0===t&&(t=-1),this.throwIfDisposed(),l.logSoftmax(this,t)},p.prototype.resizeBilinear=function(t,e){return void 0===e&&(e=!1),this.throwIfDisposed(),l.image.resizeBilinear(this,t,e)},p.prototype.resizeNearestNeighbor=function(t,e){return void 0===e&&(e=!1),this.throwIfDisposed(),l.image.resizeNearestNeighbor(this,t,e)},p.prototype.conv1d=function(t,e,n,r,i,o){return void 0===r&&(r="NWC"),void 0===i&&(i=1),this.throwIfDisposed(),l.conv1d(this,t,e,n,r,i,o)},p.prototype.conv2d=function(t,e,n,r,i,o){return void 0===r&&(r="NHWC"),void 0===i&&(i=[1,1]),this.throwIfDisposed(),l.conv2d(this,t,e,n,r,i,o)},p.prototype.conv2dTranspose=function(t,e,n,r,i){return this.throwIfDisposed(),l.conv2dTranspose(this,t,e,n,r,i)},p.prototype.depthwiseConv2D=function(t,e,n,r,i,o){return void 0===r&&(r="NHWC"),void 0===i&&(i=[1,1]),this.throwIfDisposed(),l.depthwiseConv2d(this,t,e,n,r,i,o)},p.prototype.separableConv2d=function(t,e,n,r,i,o){return void 0===i&&(i=[1,1]),void 0===o&&(o="NHWC"),this.throwIfDisposed(),l.separableConv2d(this,t,e,n,r,i,o)},p.prototype.avgPool=function(t,e,n,r){return this.throwIfDisposed(),l.avgPool(this,t,e,n,r)},p.prototype.maxPool=function(t,e,n,r){return this.throwIfDisposed(),l.maxPool(this,t,e,n,r)},p.prototype.localResponseNormalization=function(t,e,n,r){return void 0===t&&(t=5),void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=.5),l.localResponseNormalization(this,t,e,n,r)},p.prototype.pool=function(t,e,n,r,i){return this.throwIfDisposed(),l.pool(this,t,e,n,r,i)},p.prototype.variable=function(t,e,n){return void 0===t&&(t=!0),this.throwIfDisposed(),m.variable(this,t,e,n)},p.prototype.unsortedSegmentSum=function(t,e){return this.throwIfDisposed(),l.unsortedSegmentSum(this,t,e)},p.prototype.batchToSpaceND=function(t,e){return this.throwIfDisposed(),l.batchToSpaceND(this,t,e)},p.prototype.spaceToBatchND=function(t,e){return this.throwIfDisposed(),l.spaceToBatchND(this,t,e)},p.prototype.topk=function(t,e){return void 0===t&&(t=1),void 0===e&&(e=!0),this.throwIfDisposed(),l.topk(this,t,e)},p.prototype.stridedSlice=function(t,e,n,r,i,o,a,s){return void 0===r&&(r=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),this.throwIfDisposed(),l.stridedSlice(this,t,e,n,r,i,o,a,s)},p.prototype.depthToSpace=function(t,e){return this.throwIfDisposed(),l.depthToSpace(this,t,e)},p.prototype.fft=function(){return this.throwIfDisposed(),l.spectral.fft(this)},p.prototype.ifft=function(){return this.throwIfDisposed(),l.spectral.ifft(this)},p.prototype.rfft=function(){return this.throwIfDisposed(),l.spectral.rfft(this)},p.prototype.irfft=function(){return this.throwIfDisposed(),l.spectral.irfft(this)},p);function p(t,e,n,r){this.isDisposedInternal=!1,this.shape=t.slice(),this.dtype=e||"float32",this.size=b.sizeFromShape(t),this.strides=a.computeStrides(t),this.dataId=null!=r?r:{},this.id=c().nextTensorId(),this.rankType=this.rank<5?this.rank.toString():"higher",c().registerTensor(this),null!=n&&c().write(this.dataId,n)}e.Tensor=h,Object.defineProperty(h,Symbol.hasInstance,{value:function(t){return!!t&&null!=t.dataId&&null!=t.shape&&null!=t.dtype}});var d,m=(n(g,d=h),g.variable=function(t,e,n,r){return void 0===e&&(e=!0),null!=r&&r!==t.dtype&&(t=t.asType(r)),new g(t,e,n)},g.prototype.assign=function(t){if(t.dtype!==this.dtype)throw new Error("dtype of the new value ("+t.dtype+") and previous value ("+this.dtype+") must match");if(!b.arraysEqual(t.shape,this.shape))throw new Error("shape of the new value ("+t.shape+") and previous value ("+this.shape+") must match");c().disposeTensor(this),this.dataId=t.dataId,c().registerTensor(this)},g);function g(t,e,n){void 0===e&&(e=!0);var r=d.call(this,t.shape,t.dtype,null,t.dataId)||this;r.trainable=e,r.name=n,null==r.name&&(r.name=c().nextVariableId().toString());try{c().registerVariable(r)}catch(t){throw c().disposeTensor(r),t}return r}e.Variable=m,Object.defineProperty(m,Symbol.hasInstance,{value:function(t){return t instanceof h&&null!=t.assign&&t.assign instanceof Function}});var y=m.variable;e.variable=y});e(_);_.TensorBuffer,_.setTensorTracker,_.setOpHandler,_.setDeprecationWarningFn,_.Tensor,_.Variable,_.variable;var x=n(function(t,e){var n,r,i,o,a,s,u,c,l;Object.defineProperty(e,"__esModule",{value:!0}),(l=e.Rank||(e.Rank={})).R0="R0",l.R1="R1",l.R2="R2",l.R3="R3",l.R4="R4",l.R5="R5",l.R6="R6",(c=n||(n={})).float32="float32",c.int32="int32",c.bool="int32",c.complex64="complex64",(u=r||(r={})).float32="float32",u.int32="int32",u.bool="bool",u.complex64="complex64",(s=i||(i={})).float32="float32",s.int32="float32",s.bool="float32",s.complex64="complex64",(a=o||(o={})).float32="complex64",a.int32="complex64",a.bool="complex64",a.complex64="complex64";var f={float32:i,int32:n,bool:r,complex64:o};function h(t,e){if("string"!==t&&"string"!==e)return f[t][e];if("string"===t&&"string"===e)return"string";throw new Error("Can not upcast "+t+" with "+e)}e.upcastType=h,e.sumOutType=function(t){return h(t,"int32")}});e(x);x.Rank,x.upcastType,x.sumOutType;var E=n(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.makeTypesMatch=function(t,e){if(t.dtype===e.dtype)return[t,e];var n=x.upcastType(t.dtype,e.dtype);return[t.cast(n),e.cast(n)]},e.assertTypesMatch=function(t,e){b.assert(t.dtype===e.dtype,"The dtypes of the first("+t.dtype+") and second("+e.dtype+") input must match")},e.isTensorInList=function(t,e){for(var n=0;n<e.length;n++)if(e[n].id===t.id)return!0;return!1},e.flattenNameArrayMap=function(t,e){var n=[];if(t instanceof _.Tensor)n.push(t);else for(var r=t,i=0;i<e.length;i++)n.push(r[e[i]]);return n},e.unflattenToNameArrayMap=function(t,e){if(t.length!==e.length)throw new Error("Cannot unflatten Tensor[], keys and arrays are not of same length.");for(var n={},r=0;r<t.length;r++)n[t[r]]=e[r];return n},e.getTensorsInContainer=function(t){var e=[];return function t(e,n,r){if(null!=e)if(e instanceof _.Tensor)n.push(e);else if(i=e,Array.isArray(i)||"object"==typeof i){var i,o=e;for(var a in o){var s=o[a];r.has(s)||(r.add(s),t(s,n,r))}}}(t,e,new Set),e}});e(E);E.makeTypesMatch,E.assertTypesMatch;var S=E.isTensorInList,N=(E.flattenNameArrayMap,E.unflattenToNameArrayMap,E.getTensorsInContainer);function I(t,e,n,r){if(void 0===n&&(n=new Map),void 0===r&&(r=new Set),null==t)return null;if(r.has(t))throw new Error("Circular references are not supported.");if(n.has(t))return n.get(t);var i=e(t);if(i.recurse&&null!==i.value)throw new Error("A deep map function may not return both a value and recurse=true.");if(i.recurse){if(C(t)){var o=Array.isArray(t)?[]:{};for(var a in r.add(t),t){var s=I(t[a],e,n,r);o[a]=s}return r.delete(t),o}throw new Error("Can't recurse into non-iterable type: "+t)}return n.set(t,i.value),i.value}function O(t,e){return void 0===e&&(e=k),function n(r,i,o){void 0===o&&(o=new Set);var t=r[0];if(o.has(t))throw new Error("Circular references are not supported.");var e=i(r);if(e.recurse&&null!==e.value)throw new Error("A deep zip function may not return both a value and recurse=true.");if(e.recurse){if(C(t)){var a=Array.isArray(t)?[]:{};o.add(t);var s=function(e){var t=n(r.map(function(t){return t[e]}),i,o);a[e]=t};for(var u in t)s(u);return o.delete(t),a}throw new Error("Can't recurse into non-iterable type: "+t)}return e.value}(t,e)}function k(t){return null===t?null:C(t[0])?{value:null,recurse:!0}:{value:t,recurse:!1}}function A(s,u){return c(this,void 0,void 0,function(){var e,n,r,i,o,a;return l(this,function(t){switch(t.label){case 0:e=new Map,I(s,u,e),n=0,r=Array.from(e.keys()),t.label=1;case 1:return n<r.length?(i=r[n],(o=e.get(i))instanceof Promise?[4,o]:[3,3]):[3,4];case 2:a=t.sent(),e.set(i,a),t.label=3;case 3:return n++,[3,1];case 4:return[2,I(s,u,e)]}})})}function C(t){return null!=t&&(Array.isArray(t)||"object"==typeof t&&!(t instanceof u.o))}var P,T=(D.prototype.wrap=function(t){for(;t<0;)t+=this.doubledCapacity;return t%this.doubledCapacity},D.prototype.get=function(t){if(t<0)throw new RangeError("Can't get item at a negative index.");return this.data[t%this.capacity]},D.prototype.set=function(t,e){if(t<0)throw new RangeError("Can't set item at a negative index.");this.data[t%this.capacity]=e},D.prototype.length=function(){var t=this.end-this.begin;return t<0&&(t=this.doubledCapacity+t),t},D.prototype.isFull=function(){return this.length()===this.capacity},D.prototype.isEmpty=function(){return 0===this.length()},D.prototype.push=function(t){if(this.isFull())throw new RangeError("Ring buffer is full.");this.set(this.end,t),this.end=this.wrap(this.end+1)},D.prototype.pushAll=function(t){for(var e=0,n=t;e<n.length;e++){var r=n[e];this.push(r)}},D.prototype.pop=function(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");this.end=this.wrap(this.end-1);var t=this.get(this.end);return this.set(this.end,void 0),t},D.prototype.unshift=function(t){if(this.isFull())throw new RangeError("Ring buffer is full.");this.begin=this.wrap(this.begin-1),this.set(this.begin,t)},D.prototype.shift=function(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");var t=this.get(this.begin);return this.set(this.begin,void 0),this.begin=this.wrap(this.begin+1),t},D.prototype.shuffleExcise=function(t){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");var e=this.wrap(this.begin+t),n=this.get(e);return this.set(e,this.pop()),n},D),M=(o(R,P=T),R.prototype.isFull=function(){return!1},R.prototype.push=function(t){P.prototype.isFull.call(this)&&this.expand(),P.prototype.push.call(this,t)},R.prototype.unshift=function(t){P.prototype.isFull.call(this)&&this.expand(),P.prototype.unshift.call(this,t)},R.prototype.expand=function(){for(var t=2*this.capacity,e=new Array(t),n=this.length(),r=0;r<n;r++)e[r]=this.get(this.wrap(this.begin+r));this.data=e,this.capacity=t,this.doubledCapacity=2*this.capacity,this.begin=0,this.end=n},R.INITIAL_CAPACITY=32,R);function R(){return P.call(this,R.INITIAL_CAPACITY)||this}function D(t){if(this.capacity=t,this.begin=0,this.end=0,t<1)throw new RangeError("Can't create ring buffer of capacity < 1.");this.data=new Array(t),this.doubledCapacity=2*t}function j(t){return new tt(t)}function B(t){return new et(t)}var L,F,z,U,V,W,q,H,$,G,K,X,Y,Z,J,Q=(It.prototype.collect=function(o,a){return void 0===o&&(o=1e3),void 0===a&&(a=100),c(this,void 0,void 0,function(){var e,n,r,i;return l(this,function(t){switch(t.label){case 0:return e=0<a?this.prefetch(a):this,n=[],r=0,[4,e.next()];case 1:i=t.sent(),t.label=2;case 2:return i.done?[3,4]:(n.push(i.value),++r>=o?[2,n]:[4,e.next()]);case 3:return i=t.sent(),[3,2];case 4:return[2,n]}})})},It.prototype.resolveFully=function(){return c(this,void 0,void 0,function(){var e;return l(this,function(t){switch(t.label){case 0:return[4,this.next()];case 1:e=t.sent(),t.label=2;case 2:return e.done?[3,4]:[4,this.next()];case 3:return e=t.sent(),[3,2];case 4:return[2]}})})},It.prototype.resolveWhile=function(r){return c(this,void 0,void 0,function(){var e,n;return l(this,function(t){switch(t.label){case 0:return[4,this.next()];case 1:e=t.sent(),n=r(e.value),t.label=2;case 2:return e.done||!n?[3,4]:[4,this.next()];case 3:return e=t.sent(),n=r(e.value),[3,2];case 4:return[2]}})})},It.prototype.handleErrors=function(t){return new ut(this,t)},It.prototype.filter=function(t){return new at(this,t)},It.prototype.map=function(t){return new st(this,t)},It.prototype.mapAsync=function(t){return new ct(this,t)},It.prototype.serialMapAsync=function(t){return new ct(this,t).serial()},It.prototype.flatmap=function(t){return new ft(this,t)},It.prototype.forEachAsync=function(e){return c(this,void 0,void 0,function(){return l(this,function(t){return[2,this.map(e).resolveFully()]})})},It.prototype.serialForEach=function(e){return c(this,void 0,void 0,function(){return l(this,function(t){return[2,this.serialMapAsync(e).resolveWhile(function(t){return!0===t})]})})},It.prototype.rowMajorBatch=function(t,e){return void 0===e&&(e=!0),new ot(this,t,e)},It.prototype.columnMajorBatch=function(t,e,n){return void 0===e&&(e=!0),void 0===n&&(n=k),this.rowMajorBatch(t,e).map(function(t){return O(t,n)})},It.prototype.concatenate=function(t,e){return new ht(j([this,t]),e)},It.prototype.take=function(t){return t<0||null==t?this:new it(this,t)},It.prototype.skip=function(t){return t<0||null==t?this:new rt(this,t)},It.prototype.prefetch=function(t){return new Pt(this,t)},It.prototype.shuffle=function(t,e){return new Tt(this,t,e)},It.prototype.serial=function(){return new nt(this)},It),tt=(o(Nt,Z=Q),Nt.prototype.summary=function(){return"Array of "+this.items.length+" items"},Nt.prototype.next=function(){return c(this,void 0,void 0,function(){var e,n;return l(this,function(t){return this.trav>=this.items.length?[2,{value:null,done:!0}]:(e=this.items[this.trav],n=e instanceof u.o?Object(u.W)(e):e,this.trav++,[2,{value:n,done:!1}])})})},Nt),et=(o(St,Y=Q),St.prototype.summary=function(){return"Function call"},St.prototype.next=function(){return c(this,void 0,void 0,function(){return l(this,function(t){try{return[2,this.nextFn()]}catch(t){throw t.message="Error thrown while iterating through a dataset: "+t.message,t}return[2]})})},St),nt=(o(Et,X=Q),Et.prototype.summary=function(){return this.upstream.summary()+" -> Serial"},Et.prototype.next=function(){return c(this,void 0,void 0,function(){var e=this;return l(this,function(t){return this.lastRead=this.lastRead.then(function(){return e.serialNext()}),[2,this.lastRead]})})},Et.prototype.serialNext=function(){return c(this,void 0,void 0,function(){return l(this,function(t){return[2,this.upstream.next()]})})},Et),rt=(o(xt,K=Q),xt.prototype.summary=function(){return this.upstream.summary()+" -> Skip"},xt.prototype.next=function(){return c(this,void 0,void 0,function(){var e=this;return l(this,function(t){return this.lastRead=this.lastRead.then(function(){return e.serialNext()}),[2,this.lastRead]})})},xt.prototype.serialNext=function(){return c(this,void 0,void 0,function(){var e;return l(this,function(t){switch(t.label){case 0:return this.count++<this.maxCount?[4,this.upstream.next()]:[3,2];case 1:return(e=t.sent()).done?[2,e]:(Object(u.qb)(e.value),[3,0]);case 2:return[2,this.upstream.next()]}})})},xt),it=(o(_t,G=Q),_t.prototype.summary=function(){return this.upstream.summary()+" -> Take"},_t.prototype.next=function(){return c(this,void 0,void 0,function(){return l(this,function(t){return this.count++>=this.maxCount?[2,{value:null,done:!0}]:[2,this.upstream.next()]})})},_t),ot=(o(wt,$=Q),wt.prototype.summary=function(){return this.upstream.summary()+" -> RowMajorBatch"},wt.prototype.next=function(){return c(this,void 0,void 0,function(){var e=this;return l(this,function(t){return this.lastRead=this.lastRead.then(function(){return e.serialNext()}),[2,this.lastRead]})})},wt.prototype.serialNext=function(){return c(this,void 0,void 0,function(){var e,n;return l(this,function(t){switch(t.label){case 0:e=[],t.label=1;case 1:return e.length<this.batchSize?[4,this.upstream.next()]:[3,3];case 2:return(n=t.sent()).done?this.enableSmallLastBatch&&0<e.length?[2,{value:e,done:!1}]:[2,{value:null,done:!0}]:(e.push(n.value),[3,1]);case 3:return[2,{value:e,done:!1}]}})})},wt),at=(o(bt,H=Q),bt.prototype.summary=function(){return this.upstream.summary()+" -> Filter"},bt.prototype.next=function(){return c(this,void 0,void 0,function(){var e=this;return l(this,function(t){return this.lastRead=this.lastRead.then(function(){return e.serialNext()}),[2,this.lastRead]})})},bt.prototype.serialNext=function(){return c(this,void 0,void 0,function(){var e;return l(this,function(t){switch(t.label){case 0:return[4,this.upstream.next()];case 1:return(e=t.sent()).done||this.predicate(e.value)?[2,e]:(Object(u.qb)(e.value),[3,0]);case 2:return[2]}})})},bt),st=(o(vt,q=Q),vt.prototype.summary=function(){return this.upstream.summary()+" -> Map"},vt.prototype.next=function(){return c(this,void 0,void 0,function(){var e,n,r,i,o,a,s;return l(this,function(t){switch(t.label){case 0:return[4,this.upstream.next()];case 1:if((e=t.sent()).done)return[2,{value:null,done:!0}];for(n=N(e.value),r=this.transform(e.value),i=N(r),o=0,a=n;o<a.length;o++)s=a[o],S(s,i)||s.dispose();return[2,{value:r,done:!1}]}})})},vt),ut=(o(yt,W=Q),yt.prototype.summary=function(){return this.upstream.summary()+" -> handleErrors"},yt.prototype.next=function(){return c(this,void 0,void 0,function(){var e=this;return l(this,function(t){return this.lastRead=this.lastRead.then(function(){return e.serialNext()}),[2,this.lastRead]})})},yt.prototype.serialNext=function(){return c(this,void 0,void 0,function(){var e;return l(this,function(t){switch(t.label){case 0:t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.upstream.next()];case 2:return[2,t.sent()];case 3:return e=t.sent(),this.handler(e)?[3,4]:[2,{value:null,done:!0}];case 4:return[3,0];case 5:return[2]}})})},yt),ct=(o(gt,V=Q),gt.prototype.summary=function(){return this.upstream.summary()+" -> AsyncMap"},gt.prototype.next=function(){return c(this,void 0,void 0,function(){var e,n,r,i,o,a,s;return l(this,function(t){switch(t.label){case 0:return[4,this.upstream.next()];case 1:return(e=t.sent()).done?[2,{value:null,done:!0}]:(n=N(e.value),[4,this.transform(e.value)]);case 2:for(r=t.sent(),i=N(r),o=0,a=n;o<a.length;o++)s=a[o],S(s,i)||s.dispose();return[2,{value:r,done:!1}]}})})},gt),lt=(o(mt,U=Q),mt.prototype.next=function(){return c(this,void 0,void 0,function(){var e=this;return l(this,function(t){return this.lastRead=this.lastRead.then(function(){return e.serialNext()}),[2,this.lastRead]})})},mt.prototype.serialNext=function(){return c(this,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return 0!==this.outputQueue.length()?[3,2]:[4,this.pump()];case 1:return t.sent()?[3,0]:[2,{value:null,done:!0}];case 2:return[2,{value:this.outputQueue.shift(),done:!1}]}})})},mt),ft=(o(dt,z=lt),dt.prototype.summary=function(){return this.upstream.summary()+" -> Flatmap"},dt.prototype.pump=function(){return c(this,void 0,void 0,function(){var e,n,r,i,o,a,s;return l(this,function(t){switch(t.label){case 0:return[4,this.upstream.next()];case 1:if((e=t.sent()).done)return[2,!1];for(n=N(e.value),r=this.transform(e.value),i=N(r),this.outputQueue.pushAll(r),o=0,a=n;o<a.length;o++)s=a[o],S(s,i)||s.dispose();return[2,!0]}})})},dt),ht=(o(pt,F=Q),pt.prototype.summary=function(){return"TODO: fill in upstream of chained summaries -> Chained"},pt.prototype.next=function(){return c(this,void 0,void 0,function(){return l(this,function(t){return this.lastRead=this.readFromChain(this.lastRead),[2,this.lastRead]})})},pt.prototype.readFromChain=function(r){return c(this,void 0,void 0,function(){var e,n;return l(this,function(t){switch(t.label){case 0:return[4,r];case 1:return t.sent(),null!=this.iterator?[3,3]:[4,this.moreIterators.next()];case 2:if((e=t.sent()).done)return[2,{value:null,done:!0}];this.iterator=e.value,null!=this.baseErrorHandler&&(this.iterator=this.iterator.handleErrors(this.baseErrorHandler)),t.label=3;case 3:return[4,this.iterator.next()];case 4:return(n=t.sent()).done?(this.iterator=null,[2,this.readFromChain(r)]):[2,n]}})})},pt);function pt(t,e){var n=F.call(this)||this;return n.baseErrorHandler=e,n.lastRead=null,n.iterator=null,n.moreIterators=t,n}function dt(t,e){var n=z.call(this)||this;return n.upstream=t,n.transform=e,n}function mt(){var t=U.call(this)||this;return t.outputQueue=new M,t.lastRead=Promise.resolve({value:null,done:!1}),t}function gt(t,e){var n=V.call(this)||this;return n.upstream=t,n.transform=e,n}function yt(t,e){var n=W.call(this)||this;return n.upstream=t,n.handler=e,n.count=0,n.lastRead=Promise.resolve({value:null,done:!1}),n}function vt(t,e){var n=q.call(this)||this;return n.upstream=t,n.transform=e,n}function bt(t,e){var n=H.call(this)||this;return n.upstream=t,n.predicate=e,n.lastRead=Promise.resolve({value:null,done:!1}),n}function wt(t,e,n){void 0===n&&(n=!0);var r=$.call(this)||this;return r.upstream=t,r.batchSize=e,r.enableSmallLastBatch=n,r.lastRead=Promise.resolve({value:null,done:!1}),r}function _t(t,e){var n=G.call(this)||this;return n.upstream=t,n.maxCount=e,n.count=0,n}function xt(t,e){var n=K.call(this)||this;return n.upstream=t,n.maxCount=e,n.count=0,n.lastRead=Promise.resolve({value:null,done:!1}),n}function Et(t){var e=X.call(this)||this;return e.upstream=t,e.lastRead=Promise.resolve({value:null,done:!1}),e}function St(t){var e=Y.call(this)||this;return e.nextFn=t,e}function Nt(t){var e=Z.call(this)||this;return e.items=t,e.trav=0,e}function It(){}(J=L||(L={}))[J.FAIL=0]="FAIL",J[J.SHORTEST=1]="SHORTEST",J[J.LONGEST=2]="LONGEST";var Ot,kt,At,Ct=(o(Bt,At=Q),Bt.prototype.summary=function(){return"{TODO: fill in upstream of zip summaries} -> Zip"},Bt.prototype.nextState=function(o){return c(this,void 0,void 0,function(){function e(t){return t instanceof Q?{value:t.next().then(function(t){return n++,t.done&&r++,t.value}),recurse:!1}:{value:null,recurse:!0}}var n,r,i;return l(this,function(t){switch(t.label){case 0:return[4,o];case 1:return t.sent(),r=n=0,[4,A(this.iterators,e)];case 2:if(i=t.sent(),n===r)return[2,{value:null,done:!0}];if(0<r)switch(this.mismatchMode){case L.FAIL:throw new Error("Zipped streams should have the same length. Mismatched at element "+this.count+".");case L.SHORTEST:return[2,{value:null,done:!0}];case L.LONGEST:}return this.count++,[2,{value:i,done:!1}]}})})},Bt.prototype.next=function(){return c(this,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return this.currentPromise=this.nextState(this.currentPromise),[4,this.currentPromise];case 1:return[2,t.sent()]}})})},Bt),Pt=(o(jt,kt=Q),jt.prototype.summary=function(){return this.upstream.summary()+" -> Prefetch"},jt.prototype.refill=function(){for(;!this.buffer.isFull();){var t=this.upstream.next();this.buffer.push(t)}},jt.prototype.next=function(){return this.refill(),this.buffer.shift()},jt),Tt=(o(Dt,Ot=Pt),Dt.prototype.next=function(){return c(this,void 0,void 0,function(){var e=this;return l(this,function(t){return this.lastRead=this.lastRead.then(function(){return e.serialNext()}),[2,this.lastRead]})})},Dt.prototype.randomInt=function(t){return Math.floor(this.random()*t)},Dt.prototype.chooseIndex=function(){return this.randomInt(this.buffer.length())},Dt.prototype.serialNext=function(){return c(this,void 0,void 0,function(){var e,n;return l(this,function(t){switch(t.label){case 0:this.upstreamExhausted||this.refill(),t.label=1;case 1:return this.buffer.isEmpty()?[3,3]:(e=this.chooseIndex(),[4,this.buffer.shuffleExcise(e)]);case 2:return(n=t.sent()).done?(this.upstreamExhausted=!0,[3,1]):(this.refill(),[2,n]);case 3:return[2,{value:null,done:!0}]}})})},Dt),Mt=(Rt.prototype.batch=function(e,n){var t=this;void 0===n&&(n=!0);var r=this;return u.ye.assert(0<e,"batchSize need to be positive, but it is\n      "+e),Lt(function(){return c(t,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,r.iterator()];case 1:return[2,t.sent().columnMajorBatch(e,n,Ut)]}})})},this.size===1/0||null==this.size?this.size:n?Math.ceil(this.size/e):Math.floor(this.size/e))},Rt.prototype.concatenate=function(r){var t=this,i=this;return Lt(function(){return c(t,void 0,void 0,function(){var e,n;return l(this,function(t){switch(t.label){case 0:return[4,i.iterator()];case 1:return n=(e=t.sent()).concatenate,[4,r.iterator()];case 2:return[2,n.apply(e,[t.sent()])]}})})},this.size===1/0||r.size===1/0?1/0:null!=this.size&&null!=r.size?this.size+r.size:null)},Rt.prototype.filter=function(e){var t=this,n=this;return Lt(function(){return c(t,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,n.iterator()];case 1:return[2,t.sent().filter(function(t){return Object(u.oe)(function(){return e(t)})})]}})})},this.size===1/0?1/0:null)},Rt.prototype.forEachAsync=function(e){return c(this,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,this.iterator()];case 1:return[2,t.sent().forEachAsync(e)]}})})},Rt.prototype.forEach=function(e){return c(this,void 0,void 0,function(){return l(this,function(t){return Object(u.mb)("dataset.forEach() is deprecated and will be removed. Please use dataset.forEachAsync() instead"),[2,this.forEachAsync(e)]})})},Rt.prototype.map=function(e){var t=this,n=this;return Lt(function(){return c(t,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,n.iterator()];case 1:return[2,t.sent().map(function(t){return Object(u.oe)(function(){return e(t)})})]}})})},this.size)},Rt.prototype.mapAsync=function(e){var t=this,n=this;return Lt(function(){return c(t,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,n.iterator()];case 1:return[2,t.sent().mapAsync(e)]}})})},this.size)},Rt.prototype.prefetch=function(e){var t=this,n=this;return Lt(function(){return c(t,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,n.iterator()];case 1:return[2,t.sent().prefetch(e)]}})})},this.size)},Rt.prototype.repeat=function(n){var t=this,r=this;return Lt(function(){return c(t,void 0,void 0,function(){var e=this;return l(this,function(t){return[2,function(t,e){return new ht(t,e)}(B(function(){return c(e,void 0,void 0,function(){var e;return l(this,function(t){switch(t.label){case 0:return e={},[4,r.iterator()];case 1:return[2,(e.value=t.sent(),e.done=!1,e)]}})})}).take(n))]})})},null!=this.size&&0<n?this.size*n:0===n?0:null!=this.size&&(void 0===n||n<0)?1/0:null)},Rt.prototype.skip=function(e){var t=this,n=this;return Lt(function(){return c(t,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,n.iterator()];case 1:return[2,t.sent().skip(e)]}})})},null!=this.size&&0<=e&&this.size>=e?this.size-e:null!=this.size&&(this.size<e||void 0===e||e<0)?0:null)},Rt.prototype.shuffle=function(n,t,r){var e=this;void 0===r&&(r=!0);var i=this,o=y(t||u.ye.now().toString());return Lt(function(){return c(e,void 0,void 0,function(){var e;return l(this,function(t){switch(t.label){case 0:return e=o.int32(),r&&(e+=o.int32()),[4,i.iterator()];case 1:return[2,t.sent().shuffle(n,e.toString())]}})})},this.size)},Rt.prototype.take=function(e){var t=this,n=this;return Lt(function(){return c(t,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,n.iterator()];case 1:return[2,t.sent().take(e)]}})})},null!=this.size&&this.size>e?e:null!=this.size&&this.size<=e?this.size:null)},Rt.prototype.toArray=function(){return c(this,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,this.iterator()];case 1:return[2,t.sent().collect()]}})})},Rt);function Rt(){this.size=null}function Dt(t,e,n){var r=Ot.call(this,t,e)||this;return r.upstream=t,r.windowSize=e,r.upstreamExhausted=!1,r.random=y(n||u.ye.now().toString()),r.lastRead=Promise.resolve({value:null,done:!1}),r}function jt(t,e){var n=kt.call(this)||this;return n.upstream=t,n.bufferSize=e,n.buffer=new T(e),n}function Bt(t,e){void 0===e&&(e=L.FAIL);var n=At.call(this)||this;return n.iterators=t,n.mismatchMode=e,n.count=0,n.currentPromise=null,n}function Lt(e,n){return void 0===n&&(n=null),o(t,r=Mt),t.prototype.iterator=function(){return c(this,void 0,void 0,function(){return l(this,function(t){return[2,e()]})})},new t;function t(){var t=null!==r&&r.apply(this,arguments)||this;return t.size=n,t}var r}function Ft(e){var t=this;return Lt(function(){return c(t,void 0,void 0,function(){return l(this,function(t){return[2,j(e)]})})},e.length)}function zt(e){var t,n=this;if(!C(e))throw new Error("The argument to zip() must be an object or array.");if(Array.isArray(e))for(var r=0;r<e.length;r++)t=null==t?e[r].size:Math.min(t,e[r].size);else if(e instanceof Object)for(var i in e)t=null==t?e[i].size:Math.min(t,e[i].size);return Lt(function(){return c(n,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,A(e,function(t){if(t instanceof Mt)return{value:t.iterator(),recurse:!1};if(C(t))return{value:null,recurse:!0};throw new Error("Leaves of the structure passed to zip() must be Datasets, not primitives.")})];case 1:return[2,function(t,e){return void 0===e&&(e=L.FAIL),new Ct(t,e)}(t.sent(),L.SHORTEST)]}})})},t)}function Ut(t){if(null===t)return null;var e=t[0];return"string"==typeof e?{value:t,recurse:!1}:C(e)?function(t){if(null==t)return!1;if(!Array.isArray(t))return!1;for(var e in t)if("number"!=typeof t[e])return!1;return!0}(e)?{value:Vt(t),recurse:!1}:{value:null,recurse:!0}:{value:Vt(t),recurse:!1}}function Vt(t){if(0===t.length)throw new Error("Can't make a batch of zero elements.");if(t[0]instanceof u.o)return Object(u.Yd)(t);if(Array.isArray(t[0]))return function(t){for(var e=t[0].length,n=[t.length,t[0].length],r=new Float32Array(t.length*e),i=0,o=0,a=t;o<a.length;o++){var s=a[o];if(s.length!==e)throw new Error("Elements must have the same shape to be batched");r.set(s,i),i+=e}return u.o.make(n,{values:r})}(t);var e=t;return u.o.make([e.length],{values:new Float32Array(e)})}function Wt(){}var qt,Ht,$t,Gt,Kt,Xt,Yt,Zt,Jt,Qt=(o(_e,Jt=Mt),_e.prototype.iterator=function(){return c(this,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,this.input.iterator()];case 1:return[2,t.sent().decodeUTF8().split("\n")]}})})},_e),te=Symbol("out"),ee=Symbol("field"),ne=Symbol("quote"),re=Symbol("quoteafterquote"),ie=Symbol("quoteinquote"),oe=(o(we,Zt=Mt),we.prototype.columnNames=function(){return c(this,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return this.columnNamesValidated?[3,2]:[4,this.setColumnNames()];case 1:t.sent(),t.label=2;case 2:return[2,this.configuredColumnsOnly?Object.keys(this.columnConfigs):this.fullColumnNames]}})})},we.prototype.setColumnNames=function(){return c(this,void 0,void 0,function(){var e,n,r,i,o,a;return l(this,function(t){switch(t.label){case 0:return[4,this.maybeReadHeaderLine()];case 1:if(e=t.sent(),!this.fullColumnNames&&!e)throw new Error("Column names must be provided if there is no header line.");if(this.fullColumnNames&&e&&u.ye.assert(e.length===this.fullColumnNames.length,"The length of provided columnNames ("+this.fullColumnNames.length.toString()+") does not match the length of the header line read from file ("+e.length.toString()+")."),this.fullColumnNames||(this.fullColumnNames=e),n=this.fullColumnNames.reduce(function(t,e){return t[e]=t[e]+1||1,t},{}),r=Object.keys(n).filter(function(t){return 1<n[t]}),u.ye.assert(0===r.length,"Duplicate column names found: "+r.toString()),this.columnConfigs)for(i=0,o=Object.keys(this.columnConfigs);i<o.length;i++)if(a=o[i],-1===this.fullColumnNames.indexOf(a))throw new Error('The key "'+a+'" provided in columnConfigs does not match any of the column names ('+this.fullColumnNames.toString()+").");return this.columnNamesValidated=!0,[2]}})})},we.prototype.maybeReadHeaderLine=function(){return c(this,void 0,void 0,function(){var e;return l(this,function(t){switch(t.label){case 0:return this.hasHeader?[4,this.base.iterator()]:[3,3];case 1:return[4,t.sent().next()];case 2:if((e=t.sent()).done)throw new Error("No data was found for CSV parsing.");return[2,e.value.split(this.delimiter)];case 3:return[2,null]}})})},we.prototype.iterator=function(){return c(this,void 0,void 0,function(){var e,n=this;return l(this,function(t){switch(t.label){case 0:return this.columnNamesValidated?[3,2]:[4,this.setColumnNames()];case 1:t.sent(),t.label=2;case 2:return[4,this.base.iterator()];case 3:return e=t.sent(),this.hasHeader&&(e=e.skip(1)),[2,e.map(function(t){return n.makeDataElement(t)})]}})})},we.prototype.makeDataElement=function(t){for(var e=this.parseRow(t),n={},r={},i=0;i<this.fullColumnNames.length;i++){var o=this.fullColumnNames[i],a=this.columnConfigs?this.columnConfigs[o]:null;if(!this.configuredColumnsOnly||a){var s=e[i],u=null;if(""===s)if(a&&void 0!==a.default)u=a.default;else{if(a&&(a.required||a.isLabel))throw new Error("Required column "+o+" is empty in this line: "+t);u=void 0}else{var c=Number(s);if(isNaN(c))u=a&&"bool"===a.dtype?this.getBoolean(s):s;else if(a&&a.dtype)switch(a.dtype){case"float32":u=c;break;case"int32":u=Math.floor(c);break;case"bool":u=this.getBoolean(s);break;default:u=c}else u=c}a&&a.isLabel?r[o]=u:n[o]=u}}return 0===Object.keys(r).length?n:[n,r]},we.prototype.getBoolean=function(t){return"1"===t||"true"===t.toLowerCase()?1:0},we.prototype.parseRow=function(t){for(var e=[],n=0,r=t.length,i=ee,o=0;o<r;o++)switch(i){case te:switch(t.charAt(o)){case'"':n=o+1,i=ne;break;case this.delimiter:e.push(""),i=te,n=o+1;break;default:i=ee,n=o}break;case ee:switch(t.charAt(o)){case this.delimiter:e.push(t.substring(n,o)),i=te,n=o+1}break;case ne:switch(t.charAt(o)){case'"':i=re}break;case re:switch(t.charAt(o)){case this.delimiter:e.push(t.substring(n,o-1)),i=te,n=o+1;break;case'"':i=ne;break;default:i=ie}break;case ie:switch(t.charAt(o)){case'"':i=ne}}return i===re?e.push(t.substring(n,r-1)):e.push(t.substring(n)),e},we),ae=(o(be,Yt=Q),be.prototype.split=function(t){return new se(this,t)},be),se=(o(ve,Xt=ae),ve.prototype.summary=function(){return this.impl.summary()},ve.prototype.next=function(){return c(this,void 0,void 0,function(){return l(this,function(t){return[2,this.impl.next()]})})},ve),ue=(o(ye,Kt=lt),ye.prototype.summary=function(){return this.upstream.summary()+" -> Split('"+this.separator+"')"},ye.prototype.pump=function(){return c(this,void 0,void 0,function(){var e,n,r,i,o;return l(this,function(t){switch(t.label){case 0:return[4,this.upstream.next()];case 1:if((e=t.sent()).done)return""===this.carryover?[2,!1]:(this.outputQueue.push(this.carryover),[2,!(this.carryover="")]);for((n=e.value.split(this.separator))[0]=this.carryover+n[0],r=0,i=n.slice(0,-1);r<i.length;r++)o=i[r],this.outputQueue.push(o);return this.carryover=n[n.length-1],[2,!0]}})})},ye),ce=(o(ge,Gt=Q),ge.prototype.decodeUTF8=function(){return new le(this)},ge),le=(o(me,$t=ae),me.prototype.summary=function(){return this.impl.summary()},me.prototype.next=function(){return c(this,void 0,void 0,function(){return l(this,function(t){return[2,this.impl.next()]})})},me),fe=(o(de,Ht=lt),de.prototype.summary=function(){return this.upstream.summary()+" -> Utf8"},de.prototype.pump=function(){return c(this,void 0,void 0,function(){var e,n,r;return l(this,function(t){switch(t.label){case 0:return[4,this.upstream.next()];case 1:return(e=t.sent()).done?[2,!1]:(n=e.value,r=u.f.get("IS_BROWSER")?this.decoder.decode(n,{stream:!0}):this.decoder.write(i.from(n.buffer)),this.outputQueue.push(r),[2,!0])}})})},de),he=(o(pe,qt=ce),pe.prototype.summary=function(){return"FileChunks "+this.file},pe.prototype.next=function(){return c(this,void 0,void 0,function(){var e,n,o=this;return l(this,function(t){switch(t.label){case 0:return this.offset>=(this.file instanceof Uint8Array?this.file.byteLength:this.file.size)?[2,{value:null,done:!0}]:(e=new Promise(function(n,r){var t=o.offset+o.chunkSize;if(o.file instanceof Uint8Array)n(new Uint8Array(o.file.slice(o.offset,t)));else{var i=new FileReader;i.onload=function(t){var e=i.result;if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),!(e instanceof Uint8Array))return r(new TypeError("FileReader returned unknown type."));n(e)},i.onabort=function(t){return r(new Error("Aborted"))},i.onerror=function(t){return r(new Error(t.type))};var e=o.file.slice(o.offset,t);i.readAsArrayBuffer(e)}o.offset=t}),n={},[4,e]);case 1:return[2,(n.value=t.sent(),n.done=!1,n)]}})})},pe);function pe(t,e){void 0===e&&(e={});var n=qt.call(this)||this;return n.file=t,n.options=e,u.ye.assert(t instanceof Uint8Array||!!u.f.get("IS_BROWSER")&&(t instanceof File||t instanceof Blob),"FileChunkIterator only supports File, Blob and Uint8Array right now."),n.offset=e.offset||0,n.chunkSize=e.chunkSize||1048576,n}function de(t){var e=Ht.call(this)||this;if(e.upstream=t,u.f.get("IS_BROWSER"))e.decoder=new TextDecoder("utf-8");else{var n=Me(529).StringDecoder;e.decoder=new n("utf8")}return e}function me(t){var e=$t.call(this)||this;return e.upstream=t,e.impl=new fe(t),e}function ge(){return null!==Gt&&Gt.apply(this,arguments)||this}function ye(t,e){var n=Kt.call(this)||this;return n.upstream=t,n.separator=e,n.carryover="",n}function ve(t,e){var n=Xt.call(this)||this;return n.upstream=t,n.impl=new ue(t,e),n}function be(){return null!==Yt&&Yt.apply(this,arguments)||this}function we(t,e){var n=Zt.call(this)||this;return n.input=t,n.hasHeader=!0,n.fullColumnNames=null,n.columnNamesValidated=!1,n.columnConfigs=null,n.configuredColumnsOnly=!1,n.delimiter=",",n.base=new Qt(t),e||(e={}),n.hasHeader=!1!==e.hasHeader,n.fullColumnNames=e.columnNames,n.columnConfigs=e.columnConfigs,n.configuredColumnsOnly=e.configuredColumnsOnly,n.delimiter=e.delimiter?e.delimiter:",",n}function _e(t){var e=Jt.call(this)||this;return e.input=t,e}function xe(t){return"string"==typeof t&&"file://"===t.substr(0,7)}var Ee,Se,Ne=(o(ke,Se=Wt),ke.prototype.iterator=function(){return c(this,void 0,void 0,function(){var e;return l(this,function(t){return xe(this.input)&&u.f.get("IS_NODE")&&(e=Me(531),this.input=e.readFileSync(this.input.substr(7))),[2,new he(this.input,this.options)]})})},ke),Ie=(o(Oe,Ee=Wt),Oe.prototype.iterator=function(){return c(this,void 0,void 0,function(){return l(this,function(t){return xe(this.url)?[2,new Ne(this.url,this.fileOptions).iterator()]:[2,function(o,a){return void 0===a&&(a={}),c(this,void 0,void 0,function(){var e,n,r,i;return l(this,function(t){switch(t.label){case 0:return u.f.get("IS_BROWSER")?[4,fetch(o)]:[3,5];case 1:return(e=t.sent()).ok?[4,e.blob()]:[3,3];case 2:return n=t.sent(),[2,new he(n,a)];case 3:throw new Error(e.statusText);case 4:return[3,9];case 5:if(r=Me(530),"string"!=typeof o)throw new Error("URL must be a string. Request objects are not supported in the node.js environment yet.");return[4,r(o)];case 6:return(e=t.sent()).ok?[4,e.buffer()]:[3,8];case 7:return i=t.sent(),[2,new he(i,a)];case 8:throw new Error(e.statusText);case 9:return[2]}})})}(this.url,this.fileOptions)]})})},Oe);function Oe(t,e){void 0===e&&(e={});var n=Ee.call(this)||this;return n.url=t,n.fileOptions=e,n}function ke(t,e){void 0===e&&(e={});var n=Se.call(this)||this;return n.input=t,n.options=e,n}function Ae(t,e){return void 0===e&&(e={}),new oe(new Ie(t),e)}function Ce(t){var e=this,n=B(t);return Lt(function(){return c(e,void 0,void 0,function(){return l(this,function(t){return[2,n]})})})}var Pe="0.2.3"}.call(this,Me(15),Me(35),Me(14).Buffer)},function(t,e,n){var r=n(7),i=n(5).document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},function(t,e,n){var r=n(5),i=n(26),o=n(40),a=n(154),s=n(11).f;t.exports=function(t){var e=i.Symbol||(i.Symbol=o?{}:r.Symbol||{});"_"==t.charAt(0)||t in e||s(e,t,{value:a.f(t)})}},function(t,e,n){var r=n(64)("keys"),i=n(46);t.exports=function(t){return r[t]||(r[t]=i(t))}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){var r=n(5).document;t.exports=r&&r.documentElement},function(t,e,i){function o(t,e){if(r(t),!n(e)&&null!==e)throw TypeError(e+": can't set as prototype!")}var n=i(7),r=i(2);t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,n,r){try{(r=i(27)(Function.call,i(23).f(Object.prototype,"__proto__").set,2))(t,[]),n=!(t instanceof Array)}catch(t){n=!0}return function(t,e){return o(t,e),n?t.__proto__=e:r(t,e),t}}({},!1):void 0),check:o}},function(t,e){t.exports="\t\n\v\f\r ¬†·öÄ·†é‚ÄÄ‚ÄÅ‚ÄÇ‚ÄÉ‚ÄÑ‚ÄÖ‚ÄÜ‚Äá‚Äà‚Äâ‚Ää‚ÄØ‚Åü„ÄÄ\u2028\u2029\ufeff"},function(t,e,n){var o=n(7),a=n(111).set;t.exports=function(t,e,n){var r,i=e.constructor;return i!==n&&"function"==typeof i&&(r=i.prototype)!==n.prototype&&o(r)&&a&&a(t,r),t}},function(t,e,n){"use strict";var i=n(29),o=n(32);t.exports=function(t){var e=String(o(this)),n="",r=i(t);if(r<0||r==1/0)throw RangeError("Count can't be negative");for(;0<r;(r>>>=1)&&(e+=e))1&r&&(n+=e);return n}},function(t,e){t.exports=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1}},function(t,e){var n=Math.expm1;t.exports=!n||22025.465794806718<n(10)||n(10)<22025.465794806718||-2e-17!=n(-2e-17)?function(t){return 0==(t=+t)?t:-1e-6<t&&t<1e-6?t+t*t/2:Math.exp(t)-1}:n},function(t,e,n){"use strict";function b(){return this}var w=n(40),_=n(1),x=n(19),E=n(18),S=n(60),N=n(118),I=n(57),O=n(24),k=n(8)("iterator"),A=!([].keys&&"next"in[].keys()),C="values";t.exports=function(t,e,n,r,i,o,a){N(n,e,r);function s(t){if(!A&&t in d)return d[t];switch(t){case"keys":case C:return function(){return new n(this,t)}}return function(){return new n(this,t)}}var u,c,l,f=e+" Iterator",h=i==C,p=!1,d=t.prototype,m=d[k]||d["@@iterator"]||i&&d[i],g=m||s(i),y=i?h?s("entries"):g:void 0,v="Array"==e&&d.entries||m;if(v&&(l=O(v.call(new t)))!==Object.prototype&&l.next&&(I(l,f,!0),w||"function"==typeof l[k]||E(l,k,b)),h&&m&&m.name!==C&&(p=!0,g=function(){return m.call(this)}),w&&!a||!A&&!p&&d[k]||E(d,k,g),S[e]=g,S[f]=b,i)if(u={values:h?g:s(C),keys:o?g:s("keys"),entries:y},a)for(c in u)c in d||x(d,c,u[c]);else _(_.P+_.F*(A||p),e,u);return u}},function(t,e,n){"use strict";var r=n(49),i=n(45),o=n(57),a={};n(18)(a,n(8)("iterator"),function(){return this}),t.exports=function(t,e,n){t.prototype=r(a,{next:i(1,n)}),o(t,e+" Iterator")}},function(t,e,n){var r=n(81),i=n(32);t.exports=function(t,e,n){if(r(e))throw TypeError("String#"+n+" doesn't accept regex!");return String(i(t))}},function(t,e,n){var r=n(8)("match");t.exports=function(e){var n=/./;try{"/./"[e](n)}catch(t){try{return n[r]=!1,!"/./"[e](n)}catch(t){}}return!0}},function(t,e,n){var r=n(60),i=n(8)("iterator"),o=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||o[i]===t)}},function(t,e,n){"use strict";var r=n(11),i=n(45);t.exports=function(t,e,n){e in t?r.f(t,e,i(0,n)):t[e]=n}},function(t,e,n){var r=n(58),i=n(8)("iterator"),o=n(60);t.exports=n(26).getIteratorMethod=function(t){if(null!=t)return t[i]||t["@@iterator"]||o[r(t)]}},function(t,e,n){var r=n(335);t.exports=function(t,e){return new(r(t))(e)}},function(t,e,n){"use strict";var s=n(13),u=n(48),c=n(9);t.exports=function(t){for(var e=s(this),n=c(e.length),r=arguments.length,i=u(1<r?arguments[1]:void 0,n),o=2<r?arguments[2]:void 0,a=void 0===o?n:u(o,n);i<a;)e[i++]=t;return e}},function(t,e,n){"use strict";var r=n(42),i=n(171),o=n(60),a=n(22);t.exports=n(117)(Array,"Array",function(t,e){this._t=a(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,i(1)):i(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(t,e,n){"use strict";var r,i,o=n(67),a=RegExp.prototype.exec,s=String.prototype.replace,u=a,c="lastIndex",l=(r=/a/,i=/b*/g,a.call(r,"a"),a.call(i,"a"),0!==r[c]||0!==i[c]),f=void 0!==/()??/.exec("")[1];(l||f)&&(u=function(t){var e,n,r,i;return f&&(n=new RegExp("^"+this.source+"$(?!\\s)",o.call(this))),l&&(e=this[c]),r=a.call(this,t),l&&r&&(this[c]=this.global?r.index+r[0].length:e),f&&r&&1<r.length&&s.call(r[0],n,function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)}),r}),t.exports=u},function(t,e,n){"use strict";var r=n(80)(!0);t.exports=function(t,e,n){return e+(n?r(t,e).length:1)}},function(t,e,n){function r(){var t=+this;if(b.hasOwnProperty(t)){var e=b[t];delete b[t],e()}}function i(t){r.call(t.data)}var o,a,s,u=n(27),c=n(161),l=n(110),f=n(106),h=n(5),p=h.process,d=h.setImmediate,m=h.clearImmediate,g=h.MessageChannel,y=h.Dispatch,v=0,b={},w="onreadystatechange";d&&m||(d=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return b[++v]=function(){c("function"==typeof t?t:Function(t),e)},o(v),v},m=function(t){delete b[t]},"process"==n(28)(p)?o=function(t){p.nextTick(u(r,t,1))}:y&&y.now?o=function(t){y.now(u(r,t,1))}:g?(s=(a=new g).port2,a.port1.onmessage=i,o=u(s.postMessage,s,1)):h.addEventListener&&"function"==typeof postMessage&&!h.importScripts?(o=function(t){h.postMessage(t+"","*")},h.addEventListener("message",i,!1)):o=w in f("script")?function(t){l.appendChild(f("script"))[w]=function(){l.removeChild(this),r.call(t)}}:function(t){setTimeout(u(r,t,1),0)}),t.exports={set:d,clear:m}},function(t,e,n){var s=n(5),u=n(129).set,c=s.MutationObserver||s.WebKitMutationObserver,l=s.process,f=s.Promise,h="process"==n(28)(l);t.exports=function(){function t(){var t,e;for(h&&(t=l.domain)&&t.exit();n;){e=n.fn,n=n.next;try{e()}catch(t){throw n?i():r=void 0,t}}r=void 0,t&&t.enter()}var n,r,i;if(h)i=function(){l.nextTick(t)};else if(!c||s.navigator&&s.navigator.standalone)if(f&&f.resolve){var e=f.resolve(void 0);i=function(){e.then(t)}}else i=function(){u.call(s,t)};else{var o=!0,a=document.createTextNode("");new c(t).observe(a,{characterData:!0}),i=function(){a.data=o=!o}}return function(t){var e={fn:t,next:void 0};r&&(r.next=e),n||(n=e,i()),r=e}}},function(t,e,n){"use strict";var i=n(16);function r(t){var n,r;this.promise=new t(function(t,e){if(void 0!==n||void 0!==r)throw TypeError("Bad Promise constructor");n=t,r=e}),this.resolve=i(n),this.reject=i(r)}t.exports.f=function(t){return new r(t)}},function(t,e,n){"use strict";var r=n(5),i=n(10),o=n(40),a=n(87),s=n(18),u=n(54),c=n(6),l=n(52),f=n(29),h=n(9),p=n(181),d=n(50).f,m=n(11).f,g=n(125),y=n(57),v="ArrayBuffer",b="DataView",w="prototype",_="Wrong index!",x=r[v],E=r[b],S=r.Math,N=r.RangeError,I=r.Infinity,O=x,k=S.abs,A=S.pow,C=S.floor,P=S.log,T=S.LN2,M="byteLength",R="byteOffset",D=i?"_b":"buffer",j=i?"_l":M,B=i?"_o":R;function L(t,e,n){var r,i,o,a=new Array(n),s=8*n-e-1,u=(1<<s)-1,c=u>>1,l=23===e?A(2,-24)-A(2,-77):0,f=0,h=t<0||0===t&&1/t<0?1:0;for((t=k(t))!=t||t===I?(i=t!=t?1:0,r=u):(r=C(P(t)/T),t*(o=A(2,-r))<1&&(r--,o*=2),2<=(t+=1<=r+c?l/o:l*A(2,1-c))*o&&(r++,o/=2),u<=r+c?(i=0,r=u):1<=r+c?(i=(t*o-1)*A(2,e),r+=c):(i=t*A(2,c-1)*A(2,e),r=0));8<=e;a[f++]=255&i,i/=256,e-=8);for(r=r<<e|i,s+=e;0<s;a[f++]=255&r,r/=256,s-=8);return a[--f]|=128*h,a}function F(t,e,n){var r,i=8*n-e-1,o=(1<<i)-1,a=o>>1,s=i-7,u=n-1,c=t[u--],l=127&c;for(c>>=7;0<s;l=256*l+t[u],u--,s-=8);for(r=l&(1<<-s)-1,l>>=-s,s+=e;0<s;r=256*r+t[u],u--,s-=8);if(0===l)l=1-a;else{if(l===o)return r?NaN:c?-I:I;r+=A(2,e),l-=a}return(c?-1:1)*r*A(2,l-e)}function z(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function U(t){return[255&t]}function V(t){return[255&t,t>>8&255]}function W(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function q(t){return L(t,52,8)}function H(t){return L(t,23,4)}function $(t,e,n){m(t[w],e,{get:function(){return this[n]}})}function G(t,e,n,r){var i=p(+n);if(i+e>t[j])throw N(_);var o=t[D]._b,a=i+t[B],s=o.slice(a,a+e);return r?s:s.reverse()}function K(t,e,n,r,i,o){var a=p(+n);if(a+e>t[j])throw N(_);for(var s=t[D]._b,u=a+t[B],c=r(+i),l=0;l<e;l++)s[u+l]=c[o?l:e-l-1]}if(a.ABV){if(!c(function(){x(1)})||!c(function(){new x(-1)})||c(function(){return new x,new x(1.5),new x(NaN),x.name!=v})){for(var X,Y=(x=function(t){return l(this,x),new O(p(t))})[w]=O[w],Z=d(O),J=0;Z.length>J;)(X=Z[J++])in x||s(x,X,O[X]);o||(Y.constructor=x)}var Q=new E(new x(2)),tt=E[w].setInt8;Q.setInt8(0,2147483648),Q.setInt8(1,2147483649),!Q.getInt8(0)&&Q.getInt8(1)||u(E[w],{setInt8:function(t,e){tt.call(this,t,e<<24>>24)},setUint8:function(t,e){tt.call(this,t,e<<24>>24)}},!0)}else x=function(t){l(this,x,v);var e=p(t);this._b=g.call(new Array(e),0),this[j]=e},E=function(t,e,n){l(this,E,b),l(t,x,b);var r=t[j],i=f(e);if(i<0||r<i)throw N("Wrong offset!");if(r<i+(n=void 0===n?r-i:h(n)))throw N("Wrong length!");this[D]=t,this[B]=i,this[j]=n},i&&($(x,M,"_l"),$(E,"buffer","_b"),$(E,M,"_l"),$(E,R,"_o")),u(E[w],{getInt8:function(t){return G(this,1,t)[0]<<24>>24},getUint8:function(t){return G(this,1,t)[0]},getInt16:function(t){var e=G(this,2,t,arguments[1]);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=G(this,2,t,arguments[1]);return e[1]<<8|e[0]},getInt32:function(t){return z(G(this,4,t,arguments[1]))},getUint32:function(t){return z(G(this,4,t,arguments[1]))>>>0},getFloat32:function(t){return F(G(this,4,t,arguments[1]),23,4)},getFloat64:function(t){return F(G(this,8,t,arguments[1]),52,8)},setInt8:function(t,e){K(this,1,t,U,e)},setUint8:function(t,e){K(this,1,t,U,e)},setInt16:function(t,e){K(this,2,t,V,e,arguments[2])},setUint16:function(t,e){K(this,2,t,V,e,arguments[2])},setInt32:function(t,e){K(this,4,t,W,e,arguments[2])},setUint32:function(t,e){K(this,4,t,W,e,arguments[2])},setFloat32:function(t,e){K(this,4,t,H,e,arguments[2])},setFloat64:function(t,e){K(this,8,t,q,e,arguments[2])}});y(x,v),y(E,b),s(E[w],a.VIEW,!0),e[v]=x,e[b]=E},function(t,e,n){"use strict";var r=n(3),i=n(192),o=n(4).Buffer,a=new Array(16);function s(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<<e|t>>>32-e}function c(t,e,n,r,i,o,a){return u(t+(e&n|~e&r)+i+o|0,a)+e|0}function l(t,e,n,r,i,o,a){return u(t+(e&r|n&~r)+i+o|0,a)+e|0}function f(t,e,n,r,i,o,a){return u(t+(e^n^r)+i+o|0,a)+e|0}function h(t,e,n,r,i,o,a){return u(t+(n^(e|~r))+i+o|0,a)+e|0}r(s,i),s.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var n=this._a,r=this._b,i=this._c,o=this._d;r=h(r=h(r=h(r=h(r=f(r=f(r=f(r=f(r=l(r=l(r=l(r=l(r=c(r=c(r=c(r=c(r,i=c(i,o=c(o,n=c(n,r,i,o,t[0],3614090360,7),r,i,t[1],3905402710,12),n,r,t[2],606105819,17),o,n,t[3],3250441966,22),i=c(i,o=c(o,n=c(n,r,i,o,t[4],4118548399,7),r,i,t[5],1200080426,12),n,r,t[6],2821735955,17),o,n,t[7],4249261313,22),i=c(i,o=c(o,n=c(n,r,i,o,t[8],1770035416,7),r,i,t[9],2336552879,12),n,r,t[10],4294925233,17),o,n,t[11],2304563134,22),i=c(i,o=c(o,n=c(n,r,i,o,t[12],1804603682,7),r,i,t[13],4254626195,12),n,r,t[14],2792965006,17),o,n,t[15],1236535329,22),i=l(i,o=l(o,n=l(n,r,i,o,t[1],4129170786,5),r,i,t[6],3225465664,9),n,r,t[11],643717713,14),o,n,t[0],3921069994,20),i=l(i,o=l(o,n=l(n,r,i,o,t[5],3593408605,5),r,i,t[10],38016083,9),n,r,t[15],3634488961,14),o,n,t[4],3889429448,20),i=l(i,o=l(o,n=l(n,r,i,o,t[9],568446438,5),r,i,t[14],3275163606,9),n,r,t[3],4107603335,14),o,n,t[8],1163531501,20),i=l(i,o=l(o,n=l(n,r,i,o,t[13],2850285829,5),r,i,t[2],4243563512,9),n,r,t[7],1735328473,14),o,n,t[12],2368359562,20),i=f(i,o=f(o,n=f(n,r,i,o,t[5],4294588738,4),r,i,t[8],2272392833,11),n,r,t[11],1839030562,16),o,n,t[14],4259657740,23),i=f(i,o=f(o,n=f(n,r,i,o,t[1],2763975236,4),r,i,t[4],1272893353,11),n,r,t[7],4139469664,16),o,n,t[10],3200236656,23),i=f(i,o=f(o,n=f(n,r,i,o,t[13],681279174,4),r,i,t[0],3936430074,11),n,r,t[3],3572445317,16),o,n,t[6],76029189,23),i=f(i,o=f(o,n=f(n,r,i,o,t[9],3654602809,4),r,i,t[12],3873151461,11),n,r,t[15],530742520,16),o,n,t[2],3299628645,23),i=h(i,o=h(o,n=h(n,r,i,o,t[0],4096336452,6),r,i,t[7],1126891415,10),n,r,t[14],2878612391,15),o,n,t[5],4237533241,21),i=h(i,o=h(o,n=h(n,r,i,o,t[12],1700485571,6),r,i,t[3],2399980690,10),n,r,t[10],4293915773,15),o,n,t[1],2240044497,21),i=h(i,o=h(o,n=h(n,r,i,o,t[8],1873313359,6),r,i,t[15],4264355552,10),n,r,t[6],2734768916,15),o,n,t[13],1309151649,21),i=h(i,o=h(o,n=h(n,r,i,o,t[4],4149444226,6),r,i,t[11],3174756917,10),n,r,t[2],718787259,15),o,n,t[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,56<this._blockOffset&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=s},function(t,e,n){t.exports=r;var l=n(135).EventEmitter;function r(){l.call(this)}n(3)(r,l),r.Readable=n(136),r.Writable=n(453),r.Duplex=n(454),r.Transform=n(455),r.PassThrough=n(456),(r.Stream=r).prototype.pipe=function(e,t){var n=this;function r(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function i(){n.readable&&n.resume&&n.resume()}n.on("data",r),e.on("drain",i),e._isStdio||t&&!1===t.end||(n.on("end",a),n.on("close",s));var o=!1;function a(){o||(o=!0,e.end())}function s(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function u(t){if(c(),0===l.listenerCount(this,"error"))throw t}function c(){n.removeListener("data",r),e.removeListener("drain",i),n.removeListener("end",a),n.removeListener("close",s),n.removeListener("error",u),e.removeListener("error",u),n.removeListener("end",c),n.removeListener("close",c),e.removeListener("close",c)}return n.on("error",u),e.on("error",u),n.on("end",c),n.on("close",c),e.on("close",c),e.emit("pipe",n),e}},function(t,e,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,l=i&&"function"==typeof i.apply?i.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}((t.exports=a).EventEmitter=a).prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var s=10;function u(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function c(t,e,n,r){var i,o,a;if("function"!=typeof n)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n);if(void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]),void 0===a)a=o[e]=n,++t._eventsCount;else if("function"==typeof a?a=o[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),0<(i=u(t))&&a.length>i&&!a.warned){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=a.length,function(t){console&&console.warn&&console.warn(t)}(s)}return t}function f(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=function(){for(var t=[],e=0;e<arguments.length;e++)t.push(arguments[e]);this.fired||(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,l(this.listener,this.target,t))}.bind(r);return i.listener=n,r.wrapFn=i}function h(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(i):d(i,i.length)}function p(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function d(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");s=t}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var o;if(0<e.length&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=i[t];if(void 0===s)return!1;if("function"==typeof s)l(s,this,e);else{var u=s.length,c=d(s,u);for(n=0;n<u;++n)l(c[n],this,e)}return!0},a.prototype.on=a.prototype.addListener=function(t,e){return c(this,t,e,!1)},a.prototype.prependListener=function(t,e){return c(this,t,e,!0)},a.prototype.once=function(t,e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e);return this.on(t,f(this,t,e)),this},a.prototype.prependOnceListener=function(t,e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e);return this.prependListener(t,f(this,t,e)),this},a.prototype.off=a.prototype.removeListener=function(t,e){var n,r,i,o,a;if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e);if(void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,o=n.length-1;0<=o;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,i),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,a||e)}return this},a.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;0<=r;r--)this.removeListener(t,e[r]);return this},a.prototype.listeners=function(t){return h(this,t,!0)},a.prototype.rawListeners=function(t){return h(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},a.prototype.listenerCount=p,a.prototype.eventNames=function(){return 0<this._eventsCount?r(this._events):[]}},function(t,e,n){(((e=t.exports=n(193)).Stream=e).Readable=e).Writable=n(137),e.Duplex=n(56),e.Transform=n(196),e.PassThrough=n(452)},function(E,t,S){"use strict";(function(t,e,n){var s=S(91);function f(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;t.entry=null;for(;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}E.exports=g;var u,c=!t.browser&&-1<["v0.10","v0.9."].indexOf(t.version.slice(0,5))?e:s.nextTick;g.WritableState=m;var r=S(70);r.inherits=S(3);var i={deprecate:S(451)},o=S(194),l=S(4).Buffer,a=n.Uint8Array||function(){};var h,p=S(195);function d(){}function m(t,e){u=u||S(56),t=t||{};var n=e instanceof u;this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var r=t.highWaterMark,i=t.writableHighWaterMark,o=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n&&(i||0===i)?i:o,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var a=(this.destroyed=!1)===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,i=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,i){--e.pendingcb,n?(s.nextTick(i,r),s.nextTick(x,t,e),t._writableState.errorEmitted=!0,t.emit("error",r)):(i(r),t._writableState.errorEmitted=!0,t.emit("error",r),x(t,e))}(t,n,r,e,i);else{var o=w(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||b(t,n),r?c(v,t,n,o,i):v(t,n,o,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new f(this)}function g(t){if(u=u||S(56),!(h.call(g,this)||this instanceof u))return new g(t);this._writableState=new m(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),o.call(this)}function y(t,e,n,r,i,o,a){e.writelen=r,e.writecb=a,e.writing=!0,e.sync=!0,n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function v(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),x(t,e)}function b(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),o=e.corkedRequestsFree;o.entry=n;for(var a=0,s=!0;n;)(i[a]=n).isBuf||(s=!1),n=n.next,a+=1;i.allBuffers=s,y(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new f(e),e.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,c=n.encoding,l=n.callback;if(y(t,e,!1,e.objectMode?1:u.length,u,c,l),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function w(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function _(e,n){e._final(function(t){n.pendingcb--,t&&e.emit("error",t),n.prefinished=!0,e.emit("prefinish"),x(e,n)})}function x(t,e){var n=w(e);return n&&(function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,s.nextTick(_,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}r.inherits(g,o),m.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(m.prototype,"buffer",{get:i.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(g,Symbol.hasInstance,{value:function(t){return!!h.call(this,t)||this===g&&(t&&t._writableState instanceof m)}})):h=function(t){return t instanceof this},g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(t,e,n){var r=this._writableState,i=!1,o=!r.objectMode&&function(t){return l.isBuffer(t)||t instanceof a}(t);return o&&!l.isBuffer(t)&&(t=function(t){return l.from(t)}(t)),"function"==typeof e&&(n=e,e=null),o?e="buffer":e||(e=r.defaultEncoding),"function"!=typeof n&&(n=d),r.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),s.nextTick(e,n)}(this,n):(o||function(t,e,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),s.nextTick(r,o),i=!1),i}(this,r,t,n))&&(r.pendingcb++,i=function(t,e,n,r,i,o){if(!n){var a=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=l.from(e,n));return e}(e,r,i);r!==a&&(n=!0,i="buffer",r=a)}var s=e.objectMode?1:r.length;e.length+=s;var u=e.length<e.highWaterMark;u||(e.needDrain=!0);if(e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else y(t,e,!1,s,r,i,o);return u}(this,r,o,t,e,n)),i},g.prototype.cork=function(){this._writableState.corked++},g.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||b(this,t))},g.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(-1<["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),g.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(t,e,n){var r=this._writableState;"function"==typeof t?(n=t,e=t=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,n){e.ending=!0,x(t,e),n&&(e.finished?s.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,r,n)},Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),g.prototype.destroy=p.destroy,g.prototype._undestroy=p.undestroy,g.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,S(35),S(189).setImmediate,S(15))},function(t,e,n){"use strict";var r=n(4).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.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 o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=c,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=l,this.end=f,e=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"ÔøΩ";if(1<t.lastNeed&&1<e.length){if(128!=(192&e[1]))return t.lastNeed=1,"ÔøΩ";if(2<t.lastNeed&&2<e.length&&128!=(192&e[2]))return t.lastNeed=2,"ÔøΩ"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2!=0)return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1);var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(55296<=r&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function l(t,e){var n=(t.length-e)%3;return 0==n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1==n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}(e.StringDecoder=o).prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<t.length?e?e+this.text(t,n):this.text(t,n):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"ÔøΩ":e},o.prototype.text=function(t,e){var n=function(t,e,n){var r=e.length-1;if(r<n)return 0;var i=a(e[r]);if(0<=i)return 0<i&&(t.lastNeed=i-1),i;if(--r<n||-2===i)return 0;if(0<=(i=a(e[r])))return 0<i&&(t.lastNeed=i-2),i;if(--r<n||-2===i)return 0;if(0<=(i=a(e[r])))return 0<i&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){"use strict";var r=n(14).Buffer,i=n(3),o=n(192),g=new Array(16),y=[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],v=[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],b=[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],w=[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],_=[0,1518500249,1859775393,2400959708,2840853838],x=[1352829926,1548603684,1836072691,2053994217,0];function a(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function E(t,e){return t<<e|t>>>32-e}function S(t,e,n,r,i,o,a,s){return E(t+(e^n^r)+o+a|0,s)+i|0}function N(t,e,n,r,i,o,a,s){return E(t+(e&n|~e&r)+o+a|0,s)+i|0}function I(t,e,n,r,i,o,a,s){return E(t+((e|~n)^r)+o+a|0,s)+i|0}function O(t,e,n,r,i,o,a,s){return E(t+(e&r|n&~r)+o+a|0,s)+i|0}function k(t,e,n,r,i,o,a,s){return E(t+(e^(n|~r))+o+a|0,s)+i|0}i(a,o),a.prototype._update=function(){for(var t=g,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._a,u=0|this._b,c=0|this._c,l=0|this._d,f=0|this._e,h=0;h<80;h+=1){var p,d;d=h<16?(p=S(n,r,i,o,a,t[y[h]],_[0],b[h]),k(s,u,c,l,f,t[v[h]],x[0],w[h])):h<32?(p=N(n,r,i,o,a,t[y[h]],_[1],b[h]),O(s,u,c,l,f,t[v[h]],x[1],w[h])):h<48?(p=I(n,r,i,o,a,t[y[h]],_[2],b[h]),I(s,u,c,l,f,t[v[h]],x[2],w[h])):h<64?(p=O(n,r,i,o,a,t[y[h]],_[3],b[h]),N(s,u,c,l,f,t[v[h]],x[3],w[h])):(p=k(n,r,i,o,a,t[y[h]],_[4],b[h]),S(s,u,c,l,f,t[v[h]],x[4],w[h])),n=a,a=o,o=E(i,10),i=r,r=p,s=f,f=l,l=E(c,10),c=u,u=d}var m=this._b+i+l|0;this._b=this._c+o+f|0,this._c=this._d+a+s|0,this._d=this._e+n+u|0,this._e=this._a+r+c|0,this._a=m},a.prototype._digest=function(){this._block[this._blockOffset++]=128,56<this._blockOffset&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=r.alloc?r.alloc(20):new r(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=a},function(t,n,e){(n=t.exports=function(t){t=t.toLowerCase();var e=n[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e}).sha=e(457),n.sha1=e(458),n.sha224=e(459),n.sha256=e(197),n.sha384=e(460),n.sha512=e(198)},function(t,e,n){"use strict";e.utils=n(466),e.Cipher=n(467),e.DES=n(468),e.CBC=n(469),e.EDE=n(470)},function(t,e,n){var r=n(471),i=n(479),o=n(208);e.createCipher=e.Cipher=r.createCipher,e.createCipheriv=e.Cipheriv=r.createCipheriv,e.createDecipher=e.Decipher=i.createDecipher,e.createDecipheriv=e.Decipheriv=i.createDecipheriv,e.listCiphers=e.getCiphers=function(){return Object.keys(o)}},function(t,e,n){var r={ECB:n(472),CBC:n(473),CFB:n(474),CFB8:n(475),CFB1:n(476),OFB:n(477),CTR:n(206),GCM:n(206)},i=n(208);for(var o in i)i[o].module=r[i[o].mode];t.exports=i},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(e,t,n){(function(p){var d=n(12),r=n(61);function t(t,e){var n=function(t){var e=m(t);return{blinder:e.toRed(d.mont(t.modulus)).redPow(new d(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(e),r=e.modulus.byteLength(),i=(d.mont(e.modulus),new d(t).mul(n.blinder).umod(e.modulus)),o=i.toRed(d.mont(e.prime1)),a=i.toRed(d.mont(e.prime2)),s=e.coefficient,u=e.prime1,c=e.prime2,l=o.redPow(e.exponent1),f=a.redPow(e.exponent2);l=l.fromRed(),f=f.fromRed();var h=l.isub(f).imul(s).umod(u);return h.imul(c),f.iadd(h),new p(f.imul(n.unblinder).umod(e.modulus).toArray(!1,r))}function m(t){for(var e=t.modulus.byteLength(),n=new d(r(e));0<=n.cmp(t.modulus)||!n.umod(t.prime1)||!n.umod(t.prime2);)n=new d(r(e));return n}(e.exports=t).getr=m}).call(this,n(14).Buffer)},function(t,e,n){var r=e;r.utils=n(36),r.common=n(72),r.sha=n(495),r.ripemd=n(499),r.hmac=n(500),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},function(t,e,n){var r=n(63)(n(39),"Map");t.exports=r},function(t,e,n){var r=n(551),i=n(558),o=n(560),a=n(561),s=n(562);function u(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}u.prototype.clear=r,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=a,u.prototype.set=s,t.exports=u},function(t,e,n){var r=n(580),i=n(587),o=n(238);t.exports=function(t){return o(t)?r(t):i(t)}},function(t,e){t.exports=function(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991}},function(t,e,n){var r=n(44),i=n(102),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=function(t,e){if(r(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!i(t))||a.test(t)||!o.test(t)||null!=e&&t in Object(e)}},function(t,e,n){var r=n(532)(n(612));t.exports=r},function(t,e,n){t.exports=!n(10)&&!n(6)(function(){return 7!=Object.defineProperty(n(106)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){e.f=n(8)},function(t,e,n){var a=n(21),s=n(22),u=n(77)(!1),c=n(108)("IE_PROTO");t.exports=function(t,e){var n,r=s(t),i=0,o=[];for(n in r)n!=c&&a(r,n)&&o.push(n);for(;e.length>i;)a(r,n=e[i++])&&(~u(o,n)||o.push(n));return o}},function(t,e,n){var a=n(11),s=n(2),u=n(47);t.exports=n(10)?Object.defineProperties:function(t,e){s(t);for(var n,r=u(e),i=r.length,o=0;o<i;)a.f(t,n=r[o++],e[n]);return t}},function(t,e,n){var r=n(22),i=n(50).f,o={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return a&&"[object Window]"==o.call(t)?function(t){try{return i(t)}catch(t){return a.slice()}}(t):i(r(t))}},function(t,e,n){"use strict";var h=n(47),p=n(78),d=n(66),m=n(13),g=n(65),i=Object.assign;t.exports=!i||n(6)(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=i({},t)[n]||Object.keys(i({},e)).join("")!=r})?function(t,e){for(var n=m(t),r=arguments.length,i=1,o=p.f,a=d.f;i<r;)for(var s,u=g(arguments[i++]),c=o?h(u).concat(o(u)):h(u),l=c.length,f=0;f<l;)a.call(u,s=c[f++])&&(n[s]=u[s]);return n}:i},function(t,e){t.exports=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}},function(t,e,n){"use strict";var o=n(16),a=n(7),s=n(161),u=[].slice,c={};t.exports=Function.bind||function(e){var n=o(this),r=u.call(arguments,1),i=function(){var t=r.concat(u.call(arguments));return this instanceof i?function(t,e,n){if(!(e in c)){for(var r=[],i=0;i<e;i++)r[i]="a["+i+"]";c[e]=Function("F,a","return new F("+r.join(",")+")")}return c[e](t,n)}(n,t.length,t):s(n,t,e)};return a(n.prototype)&&(i.prototype=n.prototype),i}},function(t,e){t.exports=function(t,e,n){var r=void 0===n;switch(e.length){case 0:return r?t():t.call(n);case 1:return r?t(e[0]):t.call(n,e[0]);case 2:return r?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return r?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return r?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},function(t,e,n){var r=n(5).parseInt,i=n(59).trim,o=n(112),a=/^[-+]?0[xX]/;t.exports=8!==r(o+"08")||22!==r(o+"0x16")?function(t,e){var n=i(String(t),3);return r(n,e>>>0||(a.test(n)?16:10))}:r},function(t,e,n){var r=n(5).parseFloat,i=n(59).trim;t.exports=1/r(n(112)+"-0")!=-1/0?function(t){var e=i(String(t),3),n=r(e);return 0===n&&"-"==e.charAt(0)?-0:n}:r},function(t,e,n){var r=n(28);t.exports=function(t,e){if("number"!=typeof t&&"Number"!=r(t))throw TypeError(e);return+t}},function(t,e,n){var r=n(7),i=Math.floor;t.exports=function(t){return!r(t)&&isFinite(t)&&i(t)===t}},function(t,e){t.exports=Math.log1p||function(t){return-1e-8<(t=+t)&&t<1e-8?t-t*t/2:Math.log(1+t)}},function(t,e,n){var o=n(115),r=Math.pow,a=r(2,-52),s=r(2,-23),u=r(2,127)*(2-s),c=r(2,-126);t.exports=Math.fround||function(t){var e,n,r=Math.abs(t),i=o(t);return r<c?i*function(t){return t+1/a-1/a}(r/c/s)*c*s:u<(n=(e=(1+s/a)*r)-(e-r))||n!=n?i*(1/0):i*n}},function(t,e,n){var o=n(2);t.exports=function(e,t,n,r){try{return r?t(o(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&o(i.call(e)),t}}},function(t,e,n){var l=n(16),f=n(13),h=n(65),p=n(9);t.exports=function(t,e,n,r,i){l(e);var o=f(t),a=h(o),s=p(o.length),u=i?s-1:0,c=i?-1:1;if(n<2)for(;;){if(u in a){r=a[u],u+=c;break}if(u+=c,i?u<0:s<=u)throw TypeError("Reduce of empty array with no initial value")}for(;i?0<=u:u<s;u+=c)u in a&&(r=e(r,a[u],u,o));return r}},function(t,e,n){"use strict";var c=n(13),l=n(48),f=n(9);t.exports=[].copyWithin||function(t,e){var n=c(this),r=f(n.length),i=l(t,r),o=l(e,r),a=2<arguments.length?arguments[2]:void 0,s=Math.min((void 0===a?r:l(a,r))-o,r-i),u=1;for(o<i&&i<o+s&&(u=-1,o+=s-1,i+=s-1);0<s--;)o in n?n[i]=n[o]:delete n[i],i+=u,o+=u;return n}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){"use strict";var r=n(127);n(1)({target:"RegExp",proto:!0,forced:r!==/./.exec},{exec:r})},function(t,e,n){n(10)&&"g"!=/./g.flags&&n(11).f(RegExp.prototype,"flags",{configurable:!0,get:n(67)})},function(t,e){t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},function(t,e,n){var r=n(2),i=n(7),o=n(131);t.exports=function(t,e){if(r(t),i(e)&&e.constructor===t)return e;var n=o.f(t);return(0,n.resolve)(e),n.promise}},function(t,e,n){"use strict";var r=n(177),i=n(55);t.exports=n(86)("Map",function(t){return function(){return t(this,0<arguments.length?arguments[0]:void 0)}},{get:function(t){var e=r.getEntry(i(this,"Map"),t);return e&&e.v},set:function(t,e){return r.def(i(this,"Map"),0===t?0:t,e)}},r,!0)},function(t,e,n){"use strict";function a(t,e){var n,r=d(e);if("F"!==r)return t._i[r];for(n=t._f;n;n=n.n)if(n.k==e)return n}var s=n(11).f,u=n(49),c=n(54),l=n(27),f=n(52),h=n(53),r=n(117),i=n(171),o=n(51),p=n(10),d=n(41).fastKey,m=n(55),g=p?"_s":"size";t.exports={getConstructor:function(t,o,n,r){var i=t(function(t,e){f(t,i,o,"_i"),t._t=o,t._i=u(null),t._f=void 0,t._l=void 0,t[g]=0,null!=e&&h(e,n,t[r],t)});return c(i.prototype,{clear:function(){for(var t=m(this,o),e=t._i,n=t._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete e[n.i];t._f=t._l=void 0,t[g]=0},delete:function(t){var e=m(this,o),n=a(e,t);if(n){var r=n.n,i=n.p;delete e._i[n.i],n.r=!0,i&&(i.n=r),r&&(r.p=i),e._f==n&&(e._f=r),e._l==n&&(e._l=i),e[g]--}return!!n},forEach:function(t){m(this,o);for(var e,n=l(t,1<arguments.length?arguments[1]:void 0,3);e=e?e.n:this._f;)for(n(e.v,e.k,this);e&&e.r;)e=e.p},has:function(t){return!!a(m(this,o),t)}}),p&&s(i.prototype,"size",{get:function(){return m(this,o)[g]}}),i},def:function(t,e,n){var r,i,o=a(t,e);return o?o.v=n:(t._l=o={i:i=d(e,!0),k:e,v:n,p:r=t._l,n:void 0,r:!1},t._f||(t._f=o),r&&(r.n=o),t[g]++,"F"!==i&&(t._i[i]=o)),t},getEntry:a,setStrong:function(t,n,e){r(t,n,function(t,e){this._t=m(t,n),this._k=e,this._l=void 0},function(){for(var t=this._k,e=this._l;e&&e.r;)e=e.p;return this._t&&(this._l=e=e?e.n:this._t._f)?i(0,"keys"==t?e.k:"values"==t?e.v:[e.k,e.v]):(this._t=void 0,i(1))},e?"entries":"values",!e,!0),o(n)}}},function(t,e,n){"use strict";var r=n(177),i=n(55);t.exports=n(86)("Set",function(t){return function(){return t(this,0<arguments.length?arguments[0]:void 0)}},{add:function(t){return r.def(i(this,"Set"),t=0===t?0:t,t)}},r)},function(t,e,n){"use strict";function r(t){return function(){return t(this,0<arguments.length?arguments[0]:void 0)}}var o,i=n(5),a=n(34)(0),s=n(19),u=n(41),c=n(158),l=n(180),f=n(7),h=n(55),p=n(55),d=!i.ActiveXObject&&"ActiveXObject"in i,m="WeakMap",g=u.getWeak,y=Object.isExtensible,v=l.ufstore,b={get:function(t){if(f(t)){var e=g(t);return!0===e?v(h(this,m)).get(t):e?e[this._i]:void 0}},set:function(t,e){return l.def(h(this,m),t,e)}},w=t.exports=n(86)(m,r,b,l,!0,!0);p&&d&&(c((o=l.getConstructor(r,m)).prototype,b),u.NEED=!0,a(["delete","has","get","set"],function(r){var t=w.prototype,i=t[r];s(t,r,function(t,e){if(!f(t)||y(t))return i.call(this,t,e);this._f||(this._f=new o);var n=this._f[r](t,e);return"set"==r?this:n})}))},function(t,e,n){"use strict";function a(t){return t._l||(t._l=new y)}function r(t,e){return d(t.a,function(t){return t[0]===e})}var s=n(54),u=n(41).getWeak,i=n(2),c=n(7),l=n(52),f=n(53),o=n(34),h=n(21),p=n(55),d=o(5),m=o(6),g=0,y=function(){this.a=[]};y.prototype={get:function(t){var e=r(this,t);if(e)return e[1]},has:function(t){return!!r(this,t)},set:function(t,e){var n=r(this,t);n?n[1]=e:this.a.push([t,e])},delete:function(e){var t=m(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}},t.exports={getConstructor:function(t,n,r,i){var o=t(function(t,e){l(t,o,n,"_i"),t._t=n,t._i=g++,t._l=void 0,null!=e&&f(e,r,t[i],t)});return s(o.prototype,{delete:function(t){if(!c(t))return!1;var e=u(t);return!0===e?a(p(this,n)).delete(t):e&&h(e,this._i)&&delete e[this._i]},has:function(t){if(!c(t))return!1;var e=u(t);return!0===e?a(p(this,n)).has(t):e&&h(e,this._i)}}),o},def:function(t,e,n){var r=u(i(e),!0);return!0===r?a(t).set(e,n):r[t._i]=n,t},ufstore:a}},function(t,e,n){var r=n(29),i=n(9);t.exports=function(t){if(void 0===t)return 0;var e=r(t),n=i(e);if(e!==n)throw RangeError("Wrong length!");return n}},function(t,e,n){var r=n(50),i=n(78),o=n(2),a=n(5).Reflect;t.exports=a&&a.ownKeys||function(t){var e=r.f(o(t)),n=i.f;return n?e.concat(n(t)):e}},function(t,e,n){"use strict";var d=n(79),m=n(7),g=n(9),y=n(27),v=n(8)("isConcatSpreadable");t.exports=function t(e,n,r,i,o,a,s,u){for(var c,l,f=o,h=0,p=!!s&&y(s,u,3);h<i;){if(h in r){if(c=p?p(r[h],h,n):r[h],l=!1,m(c)&&(l=void 0!==(l=c[v])?!!l:d(c)),l&&0<a)f=t(e,n,c,g(c.length),f,a-1)-1;else{if(9007199254740991<=f)throw TypeError();e[f]=c}f++}h++}return f}},function(t,e,n){var l=n(9),f=n(114),h=n(32);t.exports=function(t,e,n,r){var i=String(h(t)),o=i.length,a=void 0===n?" ":String(n),s=l(e);if(s<=o||""==a)return i;var u=s-o,c=f.call(a,Math.ceil(u/a.length));return c.length>u&&(c=c.slice(0,u)),r?c+i:i+c}},function(t,e,n){var u=n(47),c=n(22),l=n(66).f;t.exports=function(s){return function(t){for(var e,n=c(t),r=u(n),i=r.length,o=0,a=[];o<i;)l.call(n,e=r[o++])&&a.push(s?[e,n[e]]:n[e]);return a}}},function(t,e,n){var r=n(58),i=n(187);t.exports=function(t){return function(){if(r(this)!=t)throw TypeError(t+"#toJSON isn't generic");return i(this)}}},function(t,e,n){var r=n(53);t.exports=function(t,e){var n=[];return r(t,!1,n.push,n,e),n}},function(t,e){t.exports=Math.scale||function(t,e,n,r,i){return 0===arguments.length||t!=t||e!=e||n!=n||r!=r||i!=i?NaN:t===1/0||t===-1/0?t:(t-e)*(i-r)/(n-e)+r}},function(t,i,o){(function(t){var e=void 0!==t&&t||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function r(t,e){this._id=t,this._clearFn=e}i.setTimeout=function(){return new r(n.call(setTimeout,e,arguments),clearTimeout)},i.setInterval=function(){return new r(n.call(setInterval,e,arguments),clearInterval)},i.clearTimeout=i.clearInterval=function(t){t&&t.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(e,this._id)},i.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},i.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},i._unrefActive=i.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;0<=e&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},o(445),i.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,i.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,o(15))},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=n(61),e.createHash=e.Hash=n(69),e.createHmac=e.Hmac=n(199);var r=n(462),i=Object.keys(r),o=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(i);e.getHashes=function(){return o};var a=n(202);e.pbkdf2=a.pbkdf2,e.pbkdf2Sync=a.pbkdf2Sync;var s=n(464);e.Cipher=s.Cipher,e.createCipher=s.createCipher,e.Cipheriv=s.Cipheriv,e.createCipheriv=s.createCipheriv,e.Decipher=s.Decipher,e.createDecipher=s.createDecipher,e.Decipheriv=s.Decipheriv,e.createDecipheriv=s.createDecipheriv,e.getCiphers=s.getCiphers,e.listCiphers=s.listCiphers;var u=n(481);e.DiffieHellmanGroup=u.DiffieHellmanGroup,e.createDiffieHellmanGroup=u.createDiffieHellmanGroup,e.getDiffieHellman=u.getDiffieHellman,e.createDiffieHellman=u.createDiffieHellman,e.DiffieHellman=u.DiffieHellman;var c=n(486);e.createSign=c.createSign,e.Sign=c.Sign,e.createVerify=c.createVerify,e.Verify=c.Verify,e.createECDH=n(524);var l=n(525);e.publicEncrypt=l.publicEncrypt,e.privateEncrypt=l.privateEncrypt,e.publicDecrypt=l.publicDecrypt,e.privateDecrypt=l.privateDecrypt;var f=n(528);e.randomFill=f.randomFill,e.randomFillSync=f.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.constants={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,ALPN_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}},function(t,e,n){"use strict";var s=n(4).Buffer,r=n(134).Transform;function i(t){r.call(this),this._block=s.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}n(3)(i,r),i.prototype._transform=function(t,e,n){var r=null;try{this.update(t,e)}catch(t){r=t}n(r)},i.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},i.prototype.update=function(t,e){if(function(t,e){if(!s.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");s.isBuffer(t)||(t=s.from(t,e));for(var n=this._block,r=0;this._blockOffset+t.length-r>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)n[i++]=t[r++];this._update(),this._blockOffset=0}for(;r<t.length;)n[this._blockOffset++]=t[r++];for(var o=0,a=8*t.length;0<a;++o)this._length[o]+=a,0<(a=this._length[o]/4294967296|0)&&(this._length[o]-=4294967296*a);return this},i.prototype._update=function(){throw new Error("_update is not implemented")},i.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0);for(var n=this._blockOffset=0;n<4;++n)this._length[n]=0;return e},i.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=i},function(M,t,R){"use strict";(function(t,m){var g=R(91);M.exports=h;var a,y=R(190);h.ReadableState=o;function v(t,e){return t.listeners(e).length}R(135).EventEmitter;var i=R(194),s=R(4).Buffer,u=t.Uint8Array||function(){};var e=R(70);e.inherits=R(3);var n=R(448),b=void 0;b=n&&n.debuglog?n.debuglog("stream"):function(){};var c,l=R(449),r=R(195);e.inherits(h,i);var f=["error","close","destroy","pause","resume"];function o(t,e){t=t||{};var n=e instanceof(a=a||R(56));this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var r=t.highWaterMark,i=t.readableHighWaterMark,o=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n&&(i||0===i)?i:o,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new l,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=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(c||(c=R(138).StringDecoder),this.decoder=new c(t.encoding),this.encoding=t.encoding)}function h(t){if(a=a||R(56),!(this instanceof h))return new h(t);this._readableState=new o(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),i.call(this)}function p(t,e,n,r,i){var o,a=t._readableState;null===e?(a.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,x(t)}(t,a)):(i||(o=function(t,e){var n;(function(t){return s.isBuffer(t)||t instanceof u})(e)||"string"==typeof e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(a,e)),o?t.emit("error",o):a.objectMode||e&&0<e.length?("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),r?a.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):d(t,a,e,!0):a.ended?t.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!n?(e=a.decoder.write(e),a.objectMode||0!==e.length?d(t,a,e,!1):S(t,a)):d(t,a,e,!1))):r||(a.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(a)}function d(t,e,n,r){e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&x(t)),S(t,e)}Object.defineProperty(h.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),h.prototype.destroy=r.destroy,h.prototype._undestroy=r.undestroy,h.prototype._destroy=function(t,e){this.push(null),e(t)},h.prototype.push=function(t,e){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof t&&((e=e||r.defaultEncoding)!==r.encoding&&(t=s.from(t,e),e=""),n=!0),p(this,t,e,!1,n)},h.prototype.unshift=function(t){return p(this,t,null,!0,!1)},h.prototype.isPaused=function(){return!1===this._readableState.flowing},h.prototype.setEncoding=function(t){return c||(c=R(138).StringDecoder),this._readableState.decoder=new c(t),this._readableState.encoding=t,this};var w=8388608;function _(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return w<=t?t=w:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function x(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(b("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?g.nextTick(E,t):E(t))}function E(t){b("emit readable"),t.emit("readable"),k(t)}function S(t,e){e.readingMore||(e.readingMore=!0,g.nextTick(N,t,e))}function N(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(b("maybeReadMore read 0"),t.read(0),n!==e.length);)n=e.length;e.readingMore=!1}function I(t){b("readable nexttick read 0"),t.read(0)}function O(t,e){e.reading||(b("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),k(t),e.flowing&&!e.reading&&t.read(0)}function k(t){var e=t._readableState;for(b("flow",e.flowing);e.flowing&&null!==t.read(););}function A(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var r;t<e.head.data.length?(r=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):r=t===e.head.data.length?e.shift():n?function(t,e){var n=e.head,r=1,i=n.data;t-=i.length;for(;n=n.next;){var o=n.data,a=t>o.length?o.length:t;if(a===o.length?i+=o:i+=o.slice(0,t),0===(t-=a)){a===o.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n).data=o.slice(a);break}++r}return e.length-=r,i}(t,e):function(t,e){var n=s.allocUnsafe(t),r=e.head,i=1;r.data.copy(n),t-=r.data.length;for(;r=r.next;){var o=r.data,a=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,a),0===(t-=a)){a===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r).data=o.slice(a);break}++i}return e.length-=i,n}(t,e);return r}(t,e.buffer,e.decoder),n);var n}function C(t){var e=t._readableState;if(0<e.length)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,g.nextTick(P,e,t))}function P(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function T(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}h.prototype.read=function(t){b("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return b("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?C(this):x(this),null;if(0===(t=_(t,e))&&e.ended)return 0===e.length&&C(this),null;var r,i=e.needReadable;return b("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&b("length less than watermark",i=!0),e.ended||e.reading?b("reading or ended",i=!1):i&&(b("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=_(n,e))),null===(r=0<t?A(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&C(this)),null!==r&&this.emit("data",r),r},h.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},h.prototype.pipe=function(n,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=n;break;case 1:i.pipes=[i.pipes,n];break;default:i.pipes.push(n)}i.pipesCount+=1,b("pipe count=%d opts=%j",i.pipesCount,t);var e=(!t||!1!==t.end)&&n!==m.stdout&&n!==m.stderr?a:d;function o(t,e){b("onunpipe"),t===r&&e&&!1===e.hasUnpiped&&(e.hasUnpiped=!0,b("cleanup"),n.removeListener("close",h),n.removeListener("finish",p),n.removeListener("drain",s),n.removeListener("error",f),n.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",d),r.removeListener("data",l),u=!0,!i.awaitDrain||n._writableState&&!n._writableState.needDrain||s())}function a(){b("onend"),n.end()}i.endEmitted?g.nextTick(e):r.once("end",e),n.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;b("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&v(e,"data")&&(t.flowing=!0,k(e))}}(r);n.on("drain",s);var u=!1;var c=!1;function l(t){b("ondata"),(c=!1)!==n.write(t)||c||((1===i.pipesCount&&i.pipes===n||1<i.pipesCount&&-1!==T(i.pipes,n))&&!u&&(b("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,c=!0),r.pause())}function f(t){b("onerror",t),d(),n.removeListener("error",f),0===v(n,"error")&&n.emit("error",t)}function h(){n.removeListener("finish",p),d()}function p(){b("onfinish"),n.removeListener("close",h),d()}function d(){b("unpipe"),r.unpipe(n)}return r.on("data",l),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?y(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(n,"error",f),n.once("close",h),n.once("finish",p),n.emit("pipe",r),i.flowing||(b("pipe resume"),r.resume()),n},h.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,n);return this}var a=T(e.pipes,t);return-1===a||(e.pipes.splice(a,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,n)),this},h.prototype.addListener=h.prototype.on=function(t,e){var n=i.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&x(this):g.nextTick(I,this))}return n},h.prototype.resume=function(){var t=this._readableState;return t.flowing||(b("resume"),t.flowing=!0,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,g.nextTick(O,t,e))}(this,t)),this},h.prototype.pause=function(){return b("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(b("pause"),this._readableState.flowing=!1,this.emit("pause")),this},h.prototype.wrap=function(e){var n=this,r=this._readableState,i=!1;for(var t in e.on("end",function(){if(b("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&n.push(t)}n.push(null)}),e.on("data",function(t){b("wrapped data"),r.decoder&&(t=r.decoder.write(t)),r.objectMode&&null==t||(r.objectMode||t&&t.length)&&(n.push(t)||(i=!0,e.pause()))}),e)void 0===this[t]&&"function"==typeof e[t]&&(this[t]=function(t){return function(){return e[t].apply(e,arguments)}}(t));for(var o=0;o<f.length;o++)e.on(f[o],this.emit.bind(this,f[o]));return this._read=function(t){b("wrapped _read",t),i&&(i=!1,e.resume())},this},Object.defineProperty(h.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),h._fromList=A}).call(this,R(15),R(35))},function(t,e,n){t.exports=n(135).EventEmitter},function(t,e,n){"use strict";var o=n(91);function a(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?e?e(t):!t||this._writableState&&this._writableState.errorEmitted||o.nextTick(a,this,t):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(o.nextTick(a,n,t),n._writableState&&(n._writableState.errorEmitted=!0)):e&&e(t)})),this},undestroy:function(){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(t,e,n){"use strict";t.exports=o;var r=n(56),i=n(70);function o(t){if(!(this instanceof o))return new o(t);r.call(this,t),this._transformState={afterTransform:function(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,(n.writecb=null)!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",a)}function a(){var n=this;"function"==typeof this._flush?this._flush(function(t,e){s(n,t,e)}):s(this,null,null)}function s(t,e,n){if(e)return t.emit("error",e);if(null!=n&&t.push(n),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}i.inherits=n(3),i.inherits(o,r),o.prototype.push=function(t,e){return this._transformState.needTransform=!1,r.prototype.push.call(this,t,e)},o.prototype._transform=function(t,e,n){throw new Error("_transform() is not implemented")},o.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},o.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},o.prototype._destroy=function(t,e){var n=this;r.prototype._destroy.call(this,t,function(t){e(t),n.emit("close")})}},function(t,e,n){var r=n(3),i=n(62),o=n(4).Buffer,_=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=new Array(64);function s(){this.init(),this._w=a,i.call(this,64,56)}r(s,i),s.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},s.prototype._update=function(t){for(var e,n,r,i,o,a,s,u=this._w,c=0|this._a,l=0|this._b,f=0|this._c,h=0|this._d,p=0|this._e,d=0|this._f,m=0|this._g,g=0|this._h,y=0;y<16;++y)u[y]=t.readInt32BE(4*y);for(;y<64;++y)u[y]=0|(((n=u[y-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10)+u[y-7]+(((e=u[y-15])>>>7|e<<25)^(e>>>18|e<<14)^e>>>3)+u[y-16];for(var v=0;v<64;++v){var b=g+(((s=p)>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+((a=m)^p&(d^a))+_[v]+u[v]|0,w=0|(((o=c)>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+((r=c)&(i=l)|f&(r|i));g=m,m=d,d=p,p=h+b|0,h=f,f=l,l=c,c=b+w|0}this._a=c+this._a|0,this._b=l+this._b|0,this._c=f+this._c|0,this._d=h+this._d|0,this._e=p+this._e|0,this._f=d+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},s.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=s},function(t,e,n){var r=n(3),i=n(62),o=n(4).Buffer,tt=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],a=new Array(160);function s(){this.init(),this._w=a,i.call(this,128,112)}function et(t,e,n){return n^t&(e^n)}function nt(t,e,n){return t&e|n&(t|e)}function rt(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function it(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function ot(t,e){return t>>>0<e>>>0?1:0}r(s,i),s.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},s.prototype._update=function(t){for(var e,n,r,i,o,a,s,u,c=this._w,l=0|this._ah,f=0|this._bh,h=0|this._ch,p=0|this._dh,d=0|this._eh,m=0|this._fh,g=0|this._gh,y=0|this._hh,v=0|this._al,b=0|this._bl,w=0|this._cl,_=0|this._dl,x=0|this._el,E=0|this._fl,S=0|this._gl,N=0|this._hl,I=0;I<32;I+=2)c[I]=t.readInt32BE(4*I),c[I+1]=t.readInt32BE(4*I+4);for(;I<160;I+=2){var O=c[I-30],k=c[I-30+1],A=((s=O)>>>1|(u=k)<<31)^(s>>>8|u<<24)^s>>>7,C=((o=k)>>>1|(a=O)<<31)^(o>>>8|a<<24)^(o>>>7|a<<25);O=c[I-4],k=c[I-4+1];var P=((r=O)>>>19|(i=k)<<13)^(i>>>29|r<<3)^r>>>6,T=((e=k)>>>19|(n=O)<<13)^(n>>>29|e<<3)^(e>>>6|n<<26),M=c[I-14],R=c[I-14+1],D=c[I-32],j=c[I-32+1],B=C+R|0,L=A+M+ot(B,C)|0;L=(L=L+P+ot(B=B+T|0,T)|0)+D+ot(B=B+j|0,j)|0,c[I]=L,c[I+1]=B}for(var F=0;F<160;F+=2){L=c[F],B=c[F+1];var z=nt(l,f,h),U=nt(v,b,w),V=rt(l,v),W=rt(v,l),q=it(d,x),H=it(x,d),$=tt[F],G=tt[F+1],K=et(d,m,g),X=et(x,E,S),Y=N+H|0,Z=y+q+ot(Y,N)|0;Z=(Z=(Z=Z+K+ot(Y=Y+X|0,X)|0)+$+ot(Y=Y+G|0,G)|0)+L+ot(Y=Y+B|0,B)|0;var J=W+U|0,Q=V+z+ot(J,W)|0;y=g,N=S,g=m,S=E,m=d,E=x,d=p+Z+ot(x=_+Y|0,_)|0,p=h,_=w,h=f,w=b,f=l,b=v,l=Z+Q+ot(v=Y+J|0,Y)|0}this._al=this._al+v|0,this._bl=this._bl+b|0,this._cl=this._cl+w|0,this._dl=this._dl+_|0,this._el=this._el+x|0,this._fl=this._fl+E|0,this._gl=this._gl+S|0,this._hl=this._hl+N|0,this._ah=this._ah+l+ot(this._al,v)|0,this._bh=this._bh+f+ot(this._bl,b)|0,this._ch=this._ch+h+ot(this._cl,w)|0,this._dh=this._dh+p+ot(this._dl,_)|0,this._eh=this._eh+d+ot(this._el,x)|0,this._fh=this._fh+m+ot(this._fl,E)|0,this._gh=this._gh+g+ot(this._gl,S)|0,this._hh=this._hh+y+ot(this._hl,N)|0},s.prototype._hash=function(){var r=o.allocUnsafe(64);function t(t,e,n){r.writeInt32BE(t,n),r.writeInt32BE(e,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),r},t.exports=s},function(t,e,n){"use strict";var r=n(3),i=n(461),a=n(43),s=n(4).Buffer,o=n(200),u=n(139),c=n(140),l=s.alloc(128);function f(t,e){a.call(this,"digest"),"string"==typeof e&&(e=s.from(e));var n="sha512"===t||"sha384"===t?128:64;(this._alg=t,(this._key=e).length>n)?e=("rmd160"===t?new u:c(t)).update(e).digest():e.length<n&&(e=s.concat([e,l],n));for(var r=this._ipad=s.allocUnsafe(n),i=this._opad=s.allocUnsafe(n),o=0;o<n;o++)r[o]=54^e[o],i[o]=92^e[o];this._hash="rmd160"===t?new u:c(t),this._hash.update(r)}r(f,a),f.prototype._update=function(t){this._hash.update(t)},f.prototype._final=function(){var t=this._hash.digest();return("rmd160"===this._alg?new u:c(this._alg)).update(this._opad).update(t).digest()},t.exports=function(t,e){return"rmd160"===(t=t.toLowerCase())||"ripemd160"===t?new f("rmd160",e):"md5"===t?new i(o,e):new f(t,e)}},function(t,e,n){var r=n(133);t.exports=function(t){return(new r).update(t).digest()}},function(t){t.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},function(t,e,n){e.pbkdf2=n(463),e.pbkdf2Sync=n(205)},function(t,e,n){(function(n){var i=Math.pow(2,30)-1;function o(t,e){if("string"!=typeof t&&!n.isBuffer(t))throw new TypeError(e+" must be a buffer or string")}t.exports=function(t,e,n,r){if(o(t,"Password"),o(e,"Salt"),"number"!=typeof n)throw new TypeError("Iterations not a number");if(n<0)throw new TypeError("Bad iterations");if("number"!=typeof r)throw new TypeError("Key length not a number");if(r<0||i<r||r!=r)throw new TypeError("Bad key length")}}).call(this,n(14).Buffer)},function(n,t,e){(function(t){var e;t.browser?e="utf-8":e=6<=parseInt(t.version.split(".")[0].slice(1),10)?"utf-8":"binary";n.exports=e}).call(this,e(35))},function(t,e,n){var c=n(200),l=n(139),f=n(140),g=n(203),y=n(204),v=n(4).Buffer,h=v.alloc(128),b={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function w(t,e,n){var r=function(e){return"rmd160"===e||"ripemd160"===e?function(t){return(new l).update(t).digest()}:"md5"===e?c:function(t){return f(e).update(t).digest()}}(t),i="sha512"===t||"sha384"===t?128:64;e.length>i?e=r(e):e.length<i&&(e=v.concat([e,h],i));for(var o=v.allocUnsafe(i+b[t]),a=v.allocUnsafe(i+b[t]),s=0;s<i;s++)o[s]=54^e[s],a[s]=92^e[s];var u=v.allocUnsafe(i+n+4);o.copy(u,0,0,i),this.ipad1=u,this.ipad2=o,this.opad=a,this.alg=t,this.blocksize=i,this.hash=r,this.size=b[t]}w.prototype.run=function(t,e){return t.copy(e,this.blocksize),this.hash(e).copy(this.opad,this.blocksize),this.hash(this.opad)},t.exports=function(t,e,n,r,i){g(t,e,n,r),v.isBuffer(t)||(t=v.from(t,y)),v.isBuffer(e)||(e=v.from(e,y));var o=new w(i=i||"sha1",t,e.length),a=v.allocUnsafe(r),s=v.allocUnsafe(e.length+4);e.copy(s,0,0,e.length);for(var u=0,c=b[i],l=Math.ceil(r/c),f=1;f<=l;f++){s.writeUInt32BE(f,e.length);for(var h=o.run(s,o.ipad1),p=h,d=1;d<n;d++){p=o.run(p,o.ipad2);for(var m=0;m<c;m++)h[m]^=p[m]}h.copy(a,u),u+=c}return a}},function(t,e,n){var l=n(71),f=n(4).Buffer,h=n(207);e.encrypt=function(t,e){var n,r,i=Math.ceil(e.length/16),o=t._cache.length;t._cache=f.concat([t._cache,f.allocUnsafe(16*i)]);for(var a=0;a<i;a++){var s=(void 0,r=(n=t)._cipher.encryptBlockRaw(n._prev),h(n._prev),r),u=o+16*a;t._cache.writeUInt32BE(s[0],u+0),t._cache.writeUInt32BE(s[1],u+4),t._cache.writeUInt32BE(s[2],u+8),t._cache.writeUInt32BE(s[3],u+12)}var c=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),l(e,c)}},function(t,e){t.exports=function(t){for(var e,n=t.length;n--;){if(255!==(e=t.readUInt8(n))){e++,t.writeUInt8(e,n);break}t.writeUInt8(0,n)}}},function(t){t.exports={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}}},function(t,e,n){var a=n(92),c=n(4).Buffer,s=n(43),r=n(3),l=n(478),i=n(71),f=n(207);function o(t,e,n,r){s.call(this);var i=c.alloc(4,0);this._cipher=new a.AES(e);var o=this._cipher.encryptBlock(i);this._ghash=new l(o),n=function(t,e,n){if(12===e.length)return t._finID=c.concat([e,c.from([0,0,0,1])]),c.concat([e,c.from([0,0,0,2])]);var r=new l(n),i=e.length,o=i%16;r.update(e),o&&(o=16-o,r.update(c.alloc(o,0))),r.update(c.alloc(8,0));var a=8*i,s=c.alloc(8);s.writeUIntBE(a,0,8),r.update(s),t._finID=r.state;var u=c.from(t._finID);return f(u),u}(this,n,o),this._prev=c.from(n),this._cache=c.allocUnsafe(0),this._secCache=c.allocUnsafe(0),this._decrypt=r,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}r(o,s),o.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=c.alloc(e,0),this._ghash.update(e))}this._called=!0;var n=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(n),this._len+=t.length,n},o.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=i(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var n=0;t.length!==e.length&&n++;for(var r=Math.min(t.length,e.length),i=0;i<r;++i)n+=t[i]^e[i];return n}(t,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=t,this._cipher.scrub()},o.prototype.getAuthTag=function(){if(this._decrypt||!c.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},o.prototype.setAuthTag=function(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t},o.prototype.setAAD=function(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length},t.exports=o},function(t,e,n){var i=n(92),o=n(4).Buffer,a=n(43);function r(t,e,n,r){a.call(this),this._cipher=new i.AES(e),this._prev=o.from(n),this._cache=o.allocUnsafe(0),this._secCache=o.allocUnsafe(0),this._decrypt=r,this._mode=t}n(3)(r,a),r.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},r.prototype._final=function(){this._cipher.scrub()},t.exports=r},function(t,e,n){var i=n(61);(t.exports=r).simpleSieve=g,r.fermatTest=y;var o=n(12),a=new o(24),s=new(n(212)),u=new o(1),c=new o(2),l=new o(5),f=(new o(16),new o(8),new o(10)),h=new o(3),p=(new o(7),new o(11)),d=new o(4),m=(new o(12),null);function g(t){for(var e=function(){if(null!==m)return m;var t=[];t[0]=2;for(var e=1,n=3;n<1048576;n+=2){for(var r=Math.ceil(Math.sqrt(n)),i=0;i<e&&t[i]<=r&&n%t[i]!=0;i++);e!==i&&t[i]<=r||(t[e++]=n)}return m=t}(),n=0;n<e.length;n++)if(0===t.modn(e[n]))return 0===t.cmpn(e[n]);return!0}function y(t){var e=o.mont(t);return 0===c.toRed(e).redPow(t.subn(1)).fromRed().cmpn(1)}function r(t,e){if(t<16)return new o(2===e||5===e?[140,123]:[140,39]);var n,r;for(e=new o(e);;){for(n=new o(i(Math.ceil(t/8)));n.bitLength()>t;)n.ishrn(1);if(n.isEven()&&n.iadd(u),n.testn(1)||n.iadd(c),e.cmp(c)){if(!e.cmp(l))for(;n.mod(f).cmp(h);)n.iadd(d)}else for(;n.mod(a).cmp(p);)n.iadd(d);if(g(r=n.shrn(1))&&g(n)&&y(r)&&y(n)&&s.test(r)&&s.test(n))return n}}},function(t,e,n){var p=n(12),r=n(213);function i(t){this.rand=t||new r.Rand}(t.exports=i).create=function(t){return new i(t)},i.prototype._randbelow=function(t){var e=t.bitLength(),n=Math.ceil(e/8);do{var r=new p(this.rand.generate(n))}while(0<=r.cmp(t));return r},i.prototype._randrange=function(t,e){var n=e.sub(t);return t.add(this._randbelow(n))},i.prototype.test=function(t,e,n){var r=t.bitLength(),i=p.mont(t),o=new p(1).toRed(i);e||(e=Math.max(1,r/48|0));for(var a=t.subn(1),s=0;!a.testn(s);s++);for(var u=t.shrn(s),c=a.toRed(i);0<e;e--){var l=this._randrange(new p(2),a);n&&n(l);var f=l.toRed(i).redPow(u);if(0!==f.cmp(o)&&0!==f.cmp(c)){for(var h=1;h<s;h++){if(0===(f=f.redSqr()).cmp(o))return!1;if(0===f.cmp(c))break}if(h===s)return!1}}return!0},i.prototype.getDivisor=function(t,e){var n=t.bitLength(),r=p.mont(t),i=new p(1).toRed(r);e||(e=Math.max(1,n/48|0));for(var o=t.subn(1),a=0;!o.testn(a);a++);for(var s=t.shrn(a),u=o.toRed(r);0<e;e--){var c=this._randrange(new p(2),o),l=t.gcd(c);if(0!==l.cmpn(1))return l;var f=c.toRed(r).redPow(s);if(0!==f.cmp(i)&&0!==f.cmp(u)){for(var h=1;h<a;h++){if(0===(f=f.redSqr()).cmp(i))return f.fromRed().subn(1).gcd(t);if(0===f.cmp(u))break}if(h===a)return(f=f.redSqr()).fromRed().subn(1).gcd(t)}}return!1}},function(t,e,n){var r;function i(t){this.rand=t}if(t.exports=function(t){return r||(r=new i(null)),r.generate(t)},(t.exports.Rand=i).prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),n=0;n<e.length;n++)e[n]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(i.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=n(483);if("function"!=typeof o.randomBytes)throw new Error("Not supported");i.prototype._rand=function(t){return o.randomBytes(t)}}catch(t){}},function(t,e,n){"use strict";var r=e;function i(t){return 1===t.length?"0"+t:t}function o(t){for(var e="",n=0;n<t.length;n++)e+=i(t[n].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"!=typeof t){for(var r=0;r<t.length;r++)n[r]=0|t[r];return n}if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),r=0;r<t.length;r+=2)n.push(parseInt(t[r]+t[r+1],16));else for(r=0;r<t.length;r++){var i=t.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}return n},r.zero2=i,r.toHex=o,r.encode=function(t,e){return"hex"===e?o(t):t}},function(t,e,n){"use strict";var r=n(36).rotr32;function i(t,e,n){return t&e^~t&n}function o(t,e,n){return t&e^t&n^e&n}function a(t,e,n){return t^e^n}e.ft_1=function(t,e,n,r){return 0===t?i(e,n,r):1===t||3===t?a(e,n,r):2===t?o(e,n,r):void 0},e.ch32=i,e.maj32=o,e.p32=a,e.s0_256=function(t){return r(t,2)^r(t,13)^r(t,22)},e.s1_256=function(t){return r(t,6)^r(t,11)^r(t,25)},e.g0_256=function(t){return r(t,7)^r(t,18)^t>>>3},e.g1_256=function(t){return r(t,17)^r(t,19)^t>>>10}},function(t,e,n){"use strict";var r=n(36),i=n(72),o=n(215),d=n(25),m=r.sum32,g=r.sum32_4,y=r.sum32_5,v=o.ch32,b=o.maj32,w=o.s0_256,_=o.s1_256,x=o.g0_256,E=o.g1_256,a=i.BlockHash,s=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function u(){if(!(this instanceof u))return new u;a.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=s,this.W=new Array(64)}r.inherits(u,a),(t.exports=u).blockSize=512,u.outSize=256,u.hmacStrength=192,u.padLength=64,u.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=g(E(n[r-2]),n[r-7],x(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],l=this.h[6],f=this.h[7];for(d(this.k.length===n.length),r=0;r<n.length;r++){var h=y(f,_(u),v(u,c,l),this.k[r],n[r]),p=m(w(i),b(i,o,a));f=l,l=c,c=u,u=m(s,h),s=a,a=o,o=i,i=m(h,p)}this.h[0]=m(this.h[0],i),this.h[1]=m(this.h[1],o),this.h[2]=m(this.h[2],a),this.h[3]=m(this.h[3],s),this.h[4]=m(this.h[4],u),this.h[5]=m(this.h[5],c),this.h[6]=m(this.h[6],l),this.h[7]=m(this.h[7],f)},u.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"big"):r.split32(this.h,"big")}},function(t,e,n){"use strict";var r=n(36),i=n(72),R=n(25),o=r.rotr64_hi,a=r.rotr64_lo,s=r.shr64_hi,u=r.shr64_lo,D=r.sum64,j=r.sum64_hi,B=r.sum64_lo,h=r.sum64_4_hi,p=r.sum64_4_lo,L=r.sum64_5_hi,F=r.sum64_5_lo,c=i.BlockHash,l=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function f(){if(!(this instanceof f))return new f;c.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=l,this.W=new Array(160)}function z(t,e,n,r,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function U(t,e,n,r,i,o){var a=e&r^~e&o;return a<0&&(a+=4294967296),a}function V(t,e,n,r,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function W(t,e,n,r,i,o){var a=e&r^e&o^r&o;return a<0&&(a+=4294967296),a}function q(t,e){var n=o(t,e,28)^o(e,t,2)^o(e,t,7);return n<0&&(n+=4294967296),n}function H(t,e){var n=a(t,e,28)^a(e,t,2)^a(e,t,7);return n<0&&(n+=4294967296),n}function $(t,e){var n=o(t,e,14)^o(t,e,18)^o(e,t,9);return n<0&&(n+=4294967296),n}function G(t,e){var n=a(t,e,14)^a(t,e,18)^a(e,t,9);return n<0&&(n+=4294967296),n}function d(t,e){var n=o(t,e,1)^o(t,e,8)^s(t,e,7);return n<0&&(n+=4294967296),n}function m(t,e){var n=a(t,e,1)^a(t,e,8)^u(t,e,7);return n<0&&(n+=4294967296),n}function g(t,e){var n=o(t,e,19)^o(e,t,29)^s(t,e,6);return n<0&&(n+=4294967296),n}function y(t,e){var n=a(t,e,19)^a(e,t,29)^u(t,e,6);return n<0&&(n+=4294967296),n}r.inherits(f,c),(t.exports=f).blockSize=1024,f.outSize=512,f.hmacStrength=192,f.padLength=128,f.prototype._prepareBlock=function(t,e){for(var n=this.W,r=0;r<32;r++)n[r]=t[e+r];for(;r<n.length;r+=2){var i=g(n[r-4],n[r-3]),o=y(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=d(n[r-30],n[r-29]),c=m(n[r-30],n[r-29]),l=n[r-32],f=n[r-31];n[r]=h(i,o,a,s,u,c,l,f),n[r+1]=p(i,o,a,s,u,c,l,f)}},f.prototype._update=function(t,e){this._prepareBlock(t,e);var n=this.W,r=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],s=this.h[4],u=this.h[5],c=this.h[6],l=this.h[7],f=this.h[8],h=this.h[9],p=this.h[10],d=this.h[11],m=this.h[12],g=this.h[13],y=this.h[14],v=this.h[15];R(this.k.length===n.length);for(var b=0;b<n.length;b+=2){var w=y,_=v,x=$(f,h),E=G(f,h),S=z(f,h,p,d,m),N=U(f,h,p,d,m,g),I=this.k[b],O=this.k[b+1],k=n[b],A=n[b+1],C=L(w,_,x,E,S,N,I,O,k,A),P=F(w,_,x,E,S,N,I,O,k,A);w=q(r,i),_=H(r,i),x=V(r,i,o,a,s),E=W(r,i,o,a,s,u);var T=j(w,_,x,E),M=B(w,_,x,E);y=m,v=g,m=p,g=d,p=f,d=h,f=j(c,l,C,P),h=B(l,l,C,P),c=s,l=u,s=o,u=a,o=r,a=i,r=j(C,P,T,M),i=B(C,P,T,M)}D(this.h,0,r,i),D(this.h,2,o,a),D(this.h,4,s,u),D(this.h,6,c,l),D(this.h,8,f,h),D(this.h,10,p,d),D(this.h,12,m,g),D(this.h,14,y,v)},f.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"big"):r.split32(this.h,"big")}},function(t,e,n){var r=n(3),i=n(74).Reporter,o=n(14).Buffer;function a(t,e){i.call(this,e),o.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function s(t,e){if(Array.isArray(t))this.length=0,this.value=t.map(function(t){return t instanceof s||(t=new s(t,e)),this.length+=t.length,t},this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=o.byteLength(t);else{if(!o.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}r(a,i),(e.DecoderBuffer=a).prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},a.prototype.restore=function(t){var e=new a(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),e},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},a.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");var n=new a(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},a.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},(e.EncoderBuffer=s).prototype.join=function(e,n){return e||(e=new o(this.length)),n||(n=0),0===this.length||(Array.isArray(this.value)?this.value.forEach(function(t){t.join(e,n),n+=t.length}):("number"==typeof this.value?e[n]=this.value:"string"==typeof this.value?e.write(this.value,n):o.isBuffer(this.value)&&this.value.copy(e,n),n+=this.length)),e}},function(t,e,n){var r=e;r._reverse=function(n){var r={};return Object.keys(n).forEach(function(t){(0|t)==t&&(t|=0);var e=n[t];r[e]=t}),r},r.der=n(515)},function(t,e,n){var r=n(3),i=n(73),o=i.base,a=i.bignum,s=i.constants.der;function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new c,this.tree._init(t.body)}function c(t){o.Node.call(this,"der",t)}function l(t,e){var n=t.readUInt8(e);if(t.isError(n))return n;var r=s.tagClass[n>>6],i=0==(32&n);if(31==(31&n)){var o=n;for(n=0;128==(128&o);){if(o=t.readUInt8(e),t.isError(o))return o;n<<=7,n|=127&o}}else n&=31;return{cls:r,primitive:i,tag:n,tagStr:s.tag[n]}}function f(t,e,n){var r=t.readUInt8(n);if(t.isError(r))return r;if(!e&&128===r)return null;if(0==(128&r))return r;var i=127&r;if(4<i)return t.error("length octect is too long");for(var o=r=0;o<i;o++){r<<=8;var a=t.readUInt8(n);if(t.isError(a))return a;r|=a}return r}(t.exports=u).prototype.decode=function(t,e){return t instanceof o.DecoderBuffer||(t=new o.DecoderBuffer(t,e)),this.tree._decode(t,e)},r(c,o.Node),c.prototype._peekTag=function(t,e,n){if(t.isEmpty())return!1;var r=t.save(),i=l(t,'Failed to peek tag: "'+e+'"');return t.isError(i)?i:(t.restore(r),i.tag===e||i.tagStr===e||i.tagStr+"of"===e||n)},c.prototype._decodeTag=function(t,e,n){var r=l(t,'Failed to decode tag of "'+e+'"');if(t.isError(r))return r;var i=f(t,r.primitive,'Failed to get length of "'+e+'"');if(t.isError(i))return i;if(!n&&r.tag!==e&&r.tagStr!==e&&r.tagStr+"of"!==e)return t.error('Failed to match tag: "'+e+'"');if(r.primitive||null!==i)return t.skip(i,'Failed to match body of: "'+e+'"');var o=t.save(),a=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(a)?a:(i=t.offset-o.offset,t.restore(o),t.skip(i,'Failed to match body of: "'+e+'"'))},c.prototype._skipUntilEnd=function(t,e){for(;;){var n=l(t,e);if(t.isError(n))return n;var r,i=f(t,n.primitive,e);if(t.isError(i))return i;if(r=n.primitive||null!==i?t.skip(i):this._skipUntilEnd(t,e),t.isError(r))return r;if("end"===n.tagStr)break}},c.prototype._decodeList=function(t,e,n,r){for(var i=[];!t.isEmpty();){var o=this._peekTag(t,"end");if(t.isError(o))return o;var a=n.decode(t,"der",r);if(t.isError(a)&&o)break;i.push(a)}return i},c.prototype._decodeStr=function(t,e){if("bitstr"===e){var n=t.readUInt8();return t.isError(n)?n:{unused:n,data:t.raw()}}if("bmpstr"===e){var r=t.raw();if(r.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");for(var i="",o=0;o<r.length/2;o++)i+=String.fromCharCode(r.readUInt16BE(2*o));return i}if("numstr"===e){var a=t.raw().toString("ascii");return this._isNumstr(a)?a:t.error("Decoding of string type: numstr unsupported characters")}if("octstr"===e)return t.raw();if("objDesc"===e)return t.raw();if("printstr"!==e)return/str$/.test(e)?t.raw().toString():t.error("Decoding of string type: "+e+" unsupported");var s=t.raw().toString("ascii");return this._isPrintstr(s)?s:t.error("Decoding of string type: printstr unsupported characters")},c.prototype._decodeObjid=function(t,e,n){for(var r,i=[],o=0;!t.isEmpty();){var a=t.readUInt8();o<<=7,o|=127&a,0==(128&a)&&(i.push(o),o=0)}128&a&&i.push(o);var s=i[0]/40|0,u=i[0]%40;if(r=n?i:[s,u].concat(i.slice(1)),e){var c=e[r.join(" ")];void 0===c&&(c=e[r.join(".")]),void 0!==c&&(r=c)}return r},c.prototype._decodeTime=function(t,e){var n=t.raw().toString();if("gentime"===e)var r=0|n.slice(0,4),i=0|n.slice(4,6),o=0|n.slice(6,8),a=0|n.slice(8,10),s=0|n.slice(10,12),u=0|n.slice(12,14);else{if("utctime"!==e)return t.error("Decoding "+e+" time is not supported yet");r=0|n.slice(0,2),i=0|n.slice(2,4),o=0|n.slice(4,6),a=0|n.slice(6,8),s=0|n.slice(8,10),u=0|n.slice(10,12);r=r<70?2e3+r:1900+r}return Date.UTC(r,i-1,o,a,s,u,0)},c.prototype._decodeNull=function(t){return null},c.prototype._decodeBool=function(t){var e=t.readUInt8();return t.isError(e)?e:0!==e},c.prototype._decodeInt=function(t,e){var n=t.raw(),r=new a(n);return e&&(r=e[r.toString(10)]||r),r},c.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getDecoder("der").tree}},function(t,e,n){var r=n(3),c=n(14).Buffer,i=n(73),o=i.base,l=i.constants.der;function a(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new s,this.tree._init(t.body)}function s(t){o.Node.call(this,"der",t)}function u(t){return t<10?"0"+t:t}(t.exports=a).prototype.encode=function(t,e){return this.tree._encode(t,e).join()},r(s,o.Node),s.prototype._encodeComposite=function(t,e,n,r){var i,o=function(t,e,n,r){var i;"seqof"===t?t="seq":"setof"===t&&(t="set");if(l.tagByName.hasOwnProperty(t))i=l.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return r.error("Unknown tag: "+t);i=t}if(31<=i)return r.error("Multi-octet tag encoding unsupported");e||(i|=32);return i|=l.tagClassByName[n||"universal"]<<6}(t,e,n,this.reporter);if(r.length<128)return(i=new c(2))[0]=o,i[1]=r.length,this._createEncoderBuffer([i,r]);for(var a=1,s=r.length;256<=s;s>>=8)a++;(i=new c(2+a))[0]=o,i[1]=128|a;s=1+a;for(var u=r.length;0<u;s--,u>>=8)i[s]=255&u;return this._createEncoderBuffer([i,r])},s.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"!==e)return"numstr"===e?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===e?this._isPrintstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(e)?this._createEncoderBuffer(t):"objDesc"===e?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+e+" unsupported");for(var n=new c(2*t.length),r=0;r<t.length;r++)n.writeUInt16BE(t.charCodeAt(r),2*r);return this._createEncoderBuffer(n)},s.prototype._encodeObjid=function(t,e,n){if("string"==typeof t){if(!e)return this.reporter.error("string objid given, but no values map found");if(!e.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=e[t].split(/[\s\.]+/g);for(var r=0;r<t.length;r++)t[r]|=0}else if(Array.isArray(t)){t=t.slice();for(r=0;r<t.length;r++)t[r]|=0}if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!n){if(40<=t[1])return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var i=0;for(r=0;r<t.length;r++){var o=t[r];for(i++;128<=o;o>>=7)i++}var a=new c(i),s=a.length-1;for(r=t.length-1;0<=r;r--){o=t[r];for(a[s--]=127&o;0<(o>>=7);)a[s--]=128|127&o}return this._createEncoderBuffer(a)},s.prototype._encodeTime=function(t,e){var n,r=new Date(t);return"gentime"===e?n=[u(r.getFullYear()),u(r.getUTCMonth()+1),u(r.getUTCDate()),u(r.getUTCHours()),u(r.getUTCMinutes()),u(r.getUTCSeconds()),"Z"].join(""):"utctime"===e?n=[u(r.getFullYear()%100),u(r.getUTCMonth()+1),u(r.getUTCDate()),u(r.getUTCHours()),u(r.getUTCMinutes()),u(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(n,"octstr")},s.prototype._encodeNull=function(){return this._createEncoderBuffer("")},s.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!c.isBuffer(t)){var n=t.toArray();!t.sign&&128&n[0]&&n.unshift(0),t=new c(n)}if(c.isBuffer(t)){var r=t.length;0===t.length&&r++;var i=new c(r);return t.copy(i),0===t.length&&(i[0]=0),this._createEncoderBuffer(i)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);r=1;for(var o=t;256<=o;o>>=8)r++;for(o=(i=new Array(r)).length-1;0<=o;o--)i[o]=255&t,t>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(new c(i))},s.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},s.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},s.prototype._skipDefault=function(t,e,n){var r,i=this._baseState;if(null===i.default)return!1;var o=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,e,n).join()),o.length!==i.defaultBuffer.length)return!1;for(r=0;r<o.length;r++)if(o[r]!==i.defaultBuffer[r])return!1;return!0}},function(t){t.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},function(t,e,n){var o=n(69),a=n(4).Buffer;function s(t){var e=a.allocUnsafe(4);return e.writeUInt32BE(t,0),e}t.exports=function(t,e){for(var n,r=a.alloc(0),i=0;r.length<e;)n=s(i++),r=a.concat([r,o("sha1").update(t).update(n).digest()]);return r.slice(0,e)}},function(t,e){t.exports=function(t,e){for(var n=t.length,r=-1;++r<n;)t[r]^=e[r];return t}},function(t,e,n){var r=n(12),i=n(4).Buffer;t.exports=function(t,e){return i.from(t.toRed(r.mont(e.modulus)).redPow(new r(e.publicExponent)).fromRed().toArray())}},function(t,e,n){var r=n(533),i=n(597),o=n(608),a=n(44),s=n(609);t.exports=function(t){return"function"==typeof t?t:null==t?o:"object"==typeof t?a(t)?i(t[0],t[1]):r(t):s(t)}},function(t,e,n){var r=n(96),i=n(540),o=n(541),a=n(542),s=n(543),u=n(544);function c(t){var e=this.__data__=new r(t);this.size=e.size}c.prototype.clear=i,c.prototype.delete=o,c.prototype.get=a,c.prototype.has=s,c.prototype.set=u,t.exports=c},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e,n){var r=n(75),i=n(99);t.exports=function(t){if(!i(t))return!1;var e=r(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},function(n,t,e){(function(t){var e="object"==typeof t&&t&&t.Object===Object&&t;n.exports=e}).call(this,e(15))},function(t,e){var n=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return n.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,e,n){var a=n(563),s=n(76);t.exports=function t(e,n,r,i,o){return e===n||(null==e||null==n||!s(e)&&!s(n)?e!=e&&n!=n:a(e,n,r,i,t,o))}},function(t,e,n){var g=n(564),y=n(567),v=n(568);t.exports=function(t,e,n,r,i,o){var a=1&n,s=t.length,u=e.length;if(s!=u&&!(a&&s<u))return!1;var c=o.get(t);if(c&&o.get(e))return c==e;var l=-1,f=!0,h=2&n?new g:void 0;for(o.set(t,e),o.set(e,t);++l<s;){var p=t[l],d=e[l];if(r)var m=a?r(d,p,l,e,t,o):r(p,d,l,t,e,o);if(void 0!==m){if(m)continue;f=!1;break}if(h){if(!y(e,function(t,e){if(!v(h,e)&&(p===t||i(p,t,n,r,o)))return h.push(e)})){f=!1;break}}else if(p!==d&&!i(p,d,n,r,o)){f=!1;break}}return o.delete(t),o.delete(e),f}},function(t,e,n){var r=n(582),i=n(76),o=Object.prototype,a=o.hasOwnProperty,s=o.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(t){return i(t)&&a.call(t,"callee")&&!s.call(t,"callee")};t.exports=u},function(t,s,u){(function(t){var e=u(39),n=u(583),r=s&&!s.nodeType&&s,i=r&&"object"==typeof t&&t&&!t.nodeType&&t,o=i&&i.exports===r?e.Buffer:void 0,a=(o?o.isBuffer:void 0)||n;t.exports=a}).call(this,u(144)(t))},function(t,e){var r=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&r.test(t))&&-1<t&&t%1==0&&t<e}},function(t,e,n){var r=n(584),i=n(585),o=n(586),a=o&&o.isTypedArray,s=a?i(a):r;t.exports=s},function(t,e,n){var r=n(229),i=n(150);t.exports=function(t){return null!=t&&i(t.length)&&!r(t)}},function(t,e,n){var r=n(99);t.exports=function(t){return t==t&&!r(t)}},function(t,e){t.exports=function(e,n){return function(t){return null!=t&&t[e]===n&&(void 0!==n||e in Object(t))}}},function(t,e,n){var i=n(242),o=n(103);t.exports=function(t,e){for(var n=0,r=(e=i(e,t)).length;null!=t&&n<r;)t=t[o(e[n++])];return n&&n==r?t:void 0}},function(t,e,n){var r=n(44),i=n(151),o=n(599),a=n(602);t.exports=function(t,e){return r(t)?t:i(t,e)?[t]:o(a(t))}},function(t,e,n){"use strict";(function(t){if(n(244),n(441),n(442),t._babelPolyfill)throw new Error("only one instance of babel-polyfill is allowed");t._babelPolyfill=!0;function e(t,e,n){t[e]||Object.defineProperty(t,e,{writable:!0,configurable:!0,value:n})}e(String.prototype,"padLeft","".padStart),e(String.prototype,"padRight","".padEnd),"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function(t){[][t]&&e(Array,t,Function.call.bind([][t]))})}).call(this,n(15))},function(t,e,n){n(245),n(248),n(249),n(250),n(251),n(252),n(253),n(254),n(255),n(256),n(257),n(258),n(259),n(260),n(261),n(262),n(263),n(264),n(265),n(266),n(267),n(268),n(269),n(270),n(271),n(272),n(273),n(274),n(275),n(276),n(277),n(278),n(279),n(280),n(281),n(282),n(283),n(284),n(285),n(286),n(287),n(288),n(289),n(290),n(291),n(292),n(293),n(294),n(295),n(296),n(297),n(298),n(299),n(300),n(301),n(302),n(303),n(304),n(305),n(306),n(307),n(308),n(309),n(310),n(311),n(312),n(313),n(314),n(315),n(316),n(317),n(318),n(319),n(320),n(321),n(322),n(323),n(325),n(326),n(328),n(329),n(330),n(331),n(332),n(333),n(334),n(336),n(337),n(338),n(339),n(340),n(341),n(342),n(343),n(344),n(345),n(346),n(347),n(348),n(126),n(349),n(172),n(350),n(173),n(351),n(352),n(353),n(354),n(355),n(176),n(178),n(179),n(356),n(357),n(358),n(359),n(360),n(361),n(362),n(363),n(364),n(365),n(366),n(367),n(368),n(369),n(370),n(371),n(372),n(373),n(374),n(375),n(376),n(377),n(378),n(379),n(380),n(381),n(382),n(383),n(384),n(385),n(386),n(387),n(388),n(389),n(390),n(391),n(392),n(393),n(394),n(395),n(396),n(397),n(398),n(399),n(400),n(401),n(402),n(403),n(404),n(405),n(406),n(407),n(408),n(409),n(410),n(411),n(412),n(413),n(414),n(415),n(416),n(417),n(418),n(419),n(420),n(421),n(422),n(423),n(424),n(425),n(426),n(427),n(428),n(429),n(430),n(431),n(432),n(433),n(434),n(435),n(436),n(437),n(438),n(439),n(440),t.exports=n(26)},function(t,e,n){"use strict";function r(t){var e=H[t]=A(B[z]);return e._k=t,e}function i(t,e){S(t);for(var n,r=x(e=I(e)),i=0,o=r.length;i<o;)Q(t,n=r[i++],e[n]);return t}function o(t){var e=W.call(this,t=O(t,!0));return!(this===G&&l(H,t)&&!l($,t))&&(!(e||!l(this,t)||!l(H,t)||l(this,U)&&this[U][t])||e)}function a(t,e){if(t=I(t),e=O(e,!0),t!==G||!l(H,e)||l($,e)){var n=R(t,e);return!n||!l(H,e)||l(t,U)&&t[U][e]||(n.enumerable=!0),n}}function s(t){for(var e,n=j(I(t)),r=[],i=0;n.length>i;)l(H,e=n[i++])||e==U||e==d||r.push(e);return r}function u(t){for(var e,n=t===G,r=j(n?$:I(t)),i=[],o=0;r.length>o;)!l(H,e=r[o++])||n&&!l(G,e)||i.push(H[e]);return i}var c=n(5),l=n(21),f=n(10),h=n(1),p=n(19),d=n(41).KEY,m=n(6),g=n(64),y=n(57),v=n(46),b=n(8),w=n(154),_=n(107),x=n(247),E=n(79),S=n(2),N=n(7),I=n(22),O=n(31),k=n(45),A=n(49),C=n(157),P=n(23),T=n(11),M=n(47),R=P.f,D=T.f,j=C.f,B=c.Symbol,L=c.JSON,F=L&&L.stringify,z="prototype",U=b("_hidden"),V=b("toPrimitive"),W={}.propertyIsEnumerable,q=g("symbol-registry"),H=g("symbols"),$=g("op-symbols"),G=Object[z],K="function"==typeof B,X=c.QObject,Y=!X||!X[z]||!X[z].findChild,Z=f&&m(function(){return 7!=A(D({},"a",{get:function(){return D(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=R(G,e);r&&delete G[e],D(t,e,n),r&&t!==G&&D(G,e,r)}:D,J=K&&"symbol"==typeof B.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof B},Q=function(t,e,n){return t===G&&Q($,e,n),S(t),e=O(e,!0),S(n),l(H,e)?(n.enumerable?(l(t,U)&&t[U][e]&&(t[U][e]=!1),n=A(n,{enumerable:k(0,!1)})):(l(t,U)||D(t,U,k(1,{})),t[U][e]=!0),Z(t,e,n)):D(t,e,n)};K||(p((B=function(){if(this instanceof B)throw TypeError("Symbol is not a constructor!");var e=v(0<arguments.length?arguments[0]:void 0),n=function(t){this===G&&n.call($,t),l(this,U)&&l(this[U],e)&&(this[U][e]=!1),Z(this,e,k(1,t))};return f&&Y&&Z(G,e,{configurable:!0,set:n}),r(e)})[z],"toString",function(){return this._k}),P.f=a,T.f=Q,n(50).f=C.f=s,n(66).f=o,n(78).f=u,f&&!n(40)&&p(G,"propertyIsEnumerable",o,!0),w.f=function(t){return r(b(t))}),h(h.G+h.W+h.F*!K,{Symbol:B});for(var tt="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),et=0;tt.length>et;)b(tt[et++]);for(var nt=M(b.store),rt=0;nt.length>rt;)_(nt[rt++]);h(h.S+h.F*!K,"Symbol",{for:function(t){return l(q,t+="")?q[t]:q[t]=B(t)},keyFor:function(t){if(!J(t))throw TypeError(t+" is not a symbol!");for(var e in q)if(q[e]===t)return e},useSetter:function(){Y=!0},useSimple:function(){Y=!1}}),h(h.S+h.F*!K,"Object",{create:function(t,e){return void 0===e?A(t):i(A(t),e)},defineProperty:Q,defineProperties:i,getOwnPropertyDescriptor:a,getOwnPropertyNames:s,getOwnPropertySymbols:u}),L&&h(h.S+h.F*(!K||m(function(){var t=B();return"[null]"!=F([t])||"{}"!=F({a:t})||"{}"!=F(Object(t))})),"JSON",{stringify:function(t){for(var e,n,r=[t],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=e=r[1],(N(e)||void 0!==t)&&!J(t))return E(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!J(e))return e}),r[1]=e,F.apply(L,r)}}),B[z][V]||n(18)(B[z],V,B[z].valueOf),y(B,"Symbol"),y(Math,"Math",!0),y(c.JSON,"JSON",!0)},function(t,e,n){t.exports=n(64)("native-function-to-string",Function.toString)},function(t,e,n){var s=n(47),u=n(78),c=n(66);t.exports=function(t){var e=s(t),n=u.f;if(n)for(var r,i=n(t),o=c.f,a=0;i.length>a;)o.call(t,r=i[a++])&&e.push(r);return e}},function(t,e,n){var r=n(1);r(r.S,"Object",{create:n(49)})},function(t,e,n){var r=n(1);r(r.S+r.F*!n(10),"Object",{defineProperty:n(11).f})},function(t,e,n){var r=n(1);r(r.S+r.F*!n(10),"Object",{defineProperties:n(156)})},function(t,e,n){var r=n(22),i=n(23).f;n(33)("getOwnPropertyDescriptor",function(){return function(t,e){return i(r(t),e)}})},function(t,e,n){var r=n(13),i=n(24);n(33)("getPrototypeOf",function(){return function(t){return i(r(t))}})},function(t,e,n){var r=n(13),i=n(47);n(33)("keys",function(){return function(t){return i(r(t))}})},function(t,e,n){n(33)("getOwnPropertyNames",function(){return n(157).f})},function(t,e,n){var r=n(7),i=n(41).onFreeze;n(33)("freeze",function(e){return function(t){return e&&r(t)?e(i(t)):t}})},function(t,e,n){var r=n(7),i=n(41).onFreeze;n(33)("seal",function(e){return function(t){return e&&r(t)?e(i(t)):t}})},function(t,e,n){var r=n(7),i=n(41).onFreeze;n(33)("preventExtensions",function(e){return function(t){return e&&r(t)?e(i(t)):t}})},function(t,e,n){var r=n(7);n(33)("isFrozen",function(e){return function(t){return!r(t)||!!e&&e(t)}})},function(t,e,n){var r=n(7);n(33)("isSealed",function(e){return function(t){return!r(t)||!!e&&e(t)}})},function(t,e,n){var r=n(7);n(33)("isExtensible",function(e){return function(t){return!!r(t)&&(!e||e(t))}})},function(t,e,n){var r=n(1);r(r.S+r.F,"Object",{assign:n(158)})},function(t,e,n){var r=n(1);r(r.S,"Object",{is:n(159)})},function(t,e,n){var r=n(1);r(r.S,"Object",{setPrototypeOf:n(111).set})},function(t,e,n){"use strict";var r=n(58),i={};i[n(8)("toStringTag")]="z",i+""!="[object z]"&&n(19)(Object.prototype,"toString",function(){return"[object "+r(this)+"]"},!0)},function(t,e,n){var r=n(1);r(r.P,"Function",{bind:n(160)})},function(t,e,n){var r=n(11).f,i=Function.prototype,o=/^\s*function ([^ (]*)/;"name"in i||n(10)&&r(i,"name",{configurable:!0,get:function(){try{return(""+this).match(o)[1]}catch(t){return""}}})},function(t,e,n){"use strict";var r=n(7),i=n(24),o=n(8)("hasInstance"),a=Function.prototype;o in a||n(11).f(a,o,{value:function(t){if("function"!=typeof this||!r(t))return!1;if(!r(this.prototype))return t instanceof this;for(;t=i(t);)if(this.prototype===t)return!0;return!1}})},function(t,e,n){var r=n(1),i=n(162);r(r.G+r.F*(parseInt!=i),{parseInt:i})},function(t,e,n){var r=n(1),i=n(163);r(r.G+r.F*(parseFloat!=i),{parseFloat:i})},function(t,e,n){"use strict";function r(t){var e=l(t,!1);if("string"==typeof e&&2<e.length){var n,r,i,o=(e=b?e.trim():p(e,3)).charCodeAt(0);if(43===o||45===o){if(88===(n=e.charCodeAt(2))||120===n)return NaN}else if(48===o){switch(e.charCodeAt(1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+e}for(var a,s=e.slice(2),u=0,c=s.length;u<c;u++)if((a=s.charCodeAt(u))<48||i<a)return NaN;return parseInt(s,r)}}return+e}var i=n(5),o=n(21),a=n(28),s=n(113),l=n(31),u=n(6),c=n(50).f,f=n(23).f,h=n(11).f,p=n(59).trim,d="Number",m=i[d],g=m,y=m.prototype,v=a(n(49)(y))==d,b="trim"in String.prototype;if(!m(" 0o1")||!m("0b1")||m("+0x1")){m=function(t){var e=arguments.length<1?0:t,n=this;return n instanceof m&&(v?u(function(){y.valueOf.call(n)}):a(n)!=d)?s(new g(r(e)),n,m):r(e)};for(var w,_=n(10)?c(g):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),x=0;_.length>x;x++)o(g,w=_[x])&&!o(m,w)&&h(m,w,f(g,w));(m.prototype=y).constructor=m,n(19)(i,d,m)}},function(t,e,n){"use strict";function c(t,e){for(var n=-1,r=e;++n<6;)r+=t*a[n],a[n]=r%1e7,r=o(r/1e7)}function l(t){for(var e=6,n=0;0<=--e;)n+=a[e],a[e]=o(n/t),n=n%t*1e7}function f(){for(var t=6,e="";0<=--t;)if(""!==e||0===t||0!==a[t]){var n=String(a[t]);e=""===e?n:e+d.call("0",7-n.length)+n}return e}var r=n(1),h=n(29),p=n(164),d=n(114),i=1..toFixed,o=Math.floor,a=[0,0,0,0,0,0],m="Number.toFixed: incorrect invocation!",g=function(t,e,n){return 0===e?n:e%2==1?g(t,e-1,n*t):g(t*t,e/2,n)};r(r.P+r.F*(!!i&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!n(6)(function(){i.call({})})),"Number",{toFixed:function(t){var e,n,r,i,o=p(this,m),a=h(t),s="",u="0";if(a<0||20<a)throw RangeError(m);if(o!=o)return"NaN";if(o<=-1e21||1e21<=o)return String(o);if(o<0&&(s="-",o=-o),1e-21<o)if(n=(e=function(t){for(var e=0,n=t;4096<=n;)e+=12,n/=4096;for(;2<=n;)e+=1,n/=2;return e}(o*g(2,69,1))-69)<0?o*g(2,-e,1):o/g(2,e,1),n*=4503599627370496,0<(e=52-e)){for(c(0,n),r=a;7<=r;)c(1e7,0),r-=7;for(c(g(10,r,1),0),r=e-1;23<=r;)l(1<<23),r-=23;l(1<<r),c(1,1),l(2),u=f()}else c(0,n),c(1<<-e,0),u=f()+d.call("0",a);return u=0<a?s+((i=u.length)<=a?"0."+d.call("0",a-i)+u:u.slice(0,i-a)+"."+u.slice(i-a)):s+u}})},function(t,e,n){"use strict";var r=n(1),i=n(6),o=n(164),a=1..toPrecision;r(r.P+r.F*(i(function(){return"1"!==a.call(1,void 0)})||!i(function(){a.call({})})),"Number",{toPrecision:function(t){var e=o(this,"Number#toPrecision: incorrect invocation!");return void 0===t?a.call(e):a.call(e,t)}})},function(t,e,n){var r=n(1);r(r.S,"Number",{EPSILON:Math.pow(2,-52)})},function(t,e,n){var r=n(1),i=n(5).isFinite;r(r.S,"Number",{isFinite:function(t){return"number"==typeof t&&i(t)}})},function(t,e,n){var r=n(1);r(r.S,"Number",{isInteger:n(165)})},function(t,e,n){var r=n(1);r(r.S,"Number",{isNaN:function(t){return t!=t}})},function(t,e,n){var r=n(1),i=n(165),o=Math.abs;r(r.S,"Number",{isSafeInteger:function(t){return i(t)&&o(t)<=9007199254740991}})},function(t,e,n){var r=n(1);r(r.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},function(t,e,n){var r=n(1);r(r.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},function(t,e,n){var r=n(1),i=n(163);r(r.S+r.F*(Number.parseFloat!=i),"Number",{parseFloat:i})},function(t,e,n){var r=n(1),i=n(162);r(r.S+r.F*(Number.parseInt!=i),"Number",{parseInt:i})},function(t,e,n){var r=n(1),i=n(166),o=Math.sqrt,a=Math.acosh;r(r.S+r.F*!(a&&710==Math.floor(a(Number.MAX_VALUE))&&a(1/0)==1/0),"Math",{acosh:function(t){return(t=+t)<1?NaN:94906265.62425156<t?Math.log(t)+Math.LN2:i(t-1+o(t-1)*o(t+1))}})},function(t,e,n){var r=n(1),i=Math.asinh;r(r.S+r.F*!(i&&0<1/i(0)),"Math",{asinh:function t(e){return isFinite(e=+e)&&0!=e?e<0?-t(-e):Math.log(e+Math.sqrt(e*e+1)):e}})},function(t,e,n){var r=n(1),i=Math.atanh;r(r.S+r.F*!(i&&1/i(-0)<0),"Math",{atanh:function(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}})},function(t,e,n){var r=n(1),i=n(115);r(r.S,"Math",{cbrt:function(t){return i(t=+t)*Math.pow(Math.abs(t),1/3)}})},function(t,e,n){var r=n(1);r(r.S,"Math",{clz32:function(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},function(t,e,n){var r=n(1),i=Math.exp;r(r.S,"Math",{cosh:function(t){return(i(t=+t)+i(-t))/2}})},function(t,e,n){var r=n(1),i=n(116);r(r.S+r.F*(i!=Math.expm1),"Math",{expm1:i})},function(t,e,n){var r=n(1);r(r.S,"Math",{fround:n(167)})},function(t,e,n){var r=n(1),u=Math.abs;r(r.S,"Math",{hypot:function(t,e){for(var n,r,i=0,o=0,a=arguments.length,s=0;o<a;)s<(n=u(arguments[o++]))?(i=i*(r=s/n)*r+1,s=n):i+=0<n?(r=n/s)*r:n;return s===1/0?1/0:s*Math.sqrt(i)}})},function(t,e,n){var r=n(1),i=Math.imul;r(r.S+r.F*n(6)(function(){return-5!=i(4294967295,5)||2!=i.length}),"Math",{imul:function(t,e){var n=+t,r=+e,i=65535&n,o=65535&r;return 0|i*o+((65535&n>>>16)*o+i*(65535&r>>>16)<<16>>>0)}})},function(t,e,n){var r=n(1);r(r.S,"Math",{log10:function(t){return Math.log(t)*Math.LOG10E}})},function(t,e,n){var r=n(1);r(r.S,"Math",{log1p:n(166)})},function(t,e,n){var r=n(1);r(r.S,"Math",{log2:function(t){return Math.log(t)/Math.LN2}})},function(t,e,n){var r=n(1);r(r.S,"Math",{sign:n(115)})},function(t,e,n){var r=n(1),i=n(116),o=Math.exp;r(r.S+r.F*n(6)(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function(t){return Math.abs(t=+t)<1?(i(t)-i(-t))/2:(o(t-1)-o(-t-1))*(Math.E/2)}})},function(t,e,n){var r=n(1),i=n(116),o=Math.exp;r(r.S,"Math",{tanh:function(t){var e=i(t=+t),n=i(-t);return e==1/0?1:n==1/0?-1:(e-n)/(o(t)+o(-t))}})},function(t,e,n){var r=n(1);r(r.S,"Math",{trunc:function(t){return(0<t?Math.floor:Math.ceil)(t)}})},function(t,e,n){var r=n(1),o=n(48),a=String.fromCharCode,i=String.fromCodePoint;r(r.S+r.F*(!!i&&1!=i.length),"String",{fromCodePoint:function(t){for(var e,n=[],r=arguments.length,i=0;i<r;){if(e=+arguments[i++],o(e,1114111)!==e)throw RangeError(e+" is not a valid code point");n.push(e<65536?a(e):a(55296+((e-=65536)>>10),e%1024+56320))}return n.join("")}})},function(t,e,n){var r=n(1),a=n(22),s=n(9);r(r.S,"String",{raw:function(t){for(var e=a(t.raw),n=s(e.length),r=arguments.length,i=[],o=0;o<n;)i.push(String(e[o++])),o<r&&i.push(String(arguments[o]));return i.join("")}})},function(t,e,n){"use strict";n(59)("trim",function(t){return function(){return t(this,3)}})},function(t,e,n){"use strict";var r=n(80)(!0);n(117)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})})},function(t,e,n){"use strict";var r=n(1),i=n(80)(!1);r(r.P,"String",{codePointAt:function(t){return i(this,t)}})},function(t,e,n){"use strict";var r=n(1),a=n(9),s=n(119),u="endsWith",c=""[u];r(r.P+r.F*n(120)(u),"String",{endsWith:function(t){var e=s(this,t,u),n=1<arguments.length?arguments[1]:void 0,r=a(e.length),i=void 0===n?r:Math.min(a(n),r),o=String(t);return c?c.call(e,o,i):e.slice(i-o.length,i)===o}})},function(t,e,n){"use strict";var r=n(1),i=n(119);r(r.P+r.F*n(120)("includes"),"String",{includes:function(t){return!!~i(this,t,"includes").indexOf(t,1<arguments.length?arguments[1]:void 0)}})},function(t,e,n){var r=n(1);r(r.P,"String",{repeat:n(114)})},function(t,e,n){"use strict";var r=n(1),i=n(9),o=n(119),a="startsWith",s=""[a];r(r.P+r.F*n(120)(a),"String",{startsWith:function(t){var e=o(this,t,a),n=i(Math.min(1<arguments.length?arguments[1]:void 0,e.length)),r=String(t);return s?s.call(e,r,n):e.slice(n,n+r.length)===r}})},function(t,e,n){"use strict";n(20)("anchor",function(e){return function(t){return e(this,"a","name",t)}})},function(t,e,n){"use strict";n(20)("big",function(t){return function(){return t(this,"big","","")}})},function(t,e,n){"use strict";n(20)("blink",function(t){return function(){return t(this,"blink","","")}})},function(t,e,n){"use strict";n(20)("bold",function(t){return function(){return t(this,"b","","")}})},function(t,e,n){"use strict";n(20)("fixed",function(t){return function(){return t(this,"tt","","")}})},function(t,e,n){"use strict";n(20)("fontcolor",function(e){return function(t){return e(this,"font","color",t)}})},function(t,e,n){"use strict";n(20)("fontsize",function(e){return function(t){return e(this,"font","size",t)}})},function(t,e,n){"use strict";n(20)("italics",function(t){return function(){return t(this,"i","","")}})},function(t,e,n){"use strict";n(20)("link",function(e){return function(t){return e(this,"a","href",t)}})},function(t,e,n){"use strict";n(20)("small",function(t){return function(){return t(this,"small","","")}})},function(t,e,n){"use strict";n(20)("strike",function(t){return function(){return t(this,"strike","","")}})},function(t,e,n){"use strict";n(20)("sub",function(t){return function(){return t(this,"sub","","")}})},function(t,e,n){"use strict";n(20)("sup",function(t){return function(){return t(this,"sup","","")}})},function(t,e,n){var r=n(1);r(r.S,"Date",{now:function(){return(new Date).getTime()}})},function(t,e,n){"use strict";var r=n(1),i=n(13),o=n(31);r(r.P+r.F*n(6)(function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}),"Date",{toJSON:function(t){var e=i(this),n=o(e);return"number"!=typeof n||isFinite(n)?e.toISOString():null}})},function(t,e,n){var r=n(1),i=n(324);r(r.P+r.F*(Date.prototype.toISOString!==i),"Date",{toISOString:i})},function(t,e,n){"use strict";function r(t){return 9<t?t:"0"+t}var i=n(6),o=Date.prototype.getTime,a=Date.prototype.toISOString;t.exports=i(function(){return"0385-07-25T07:06:39.999Z"!=a.call(new Date(-5e13-1))})||!i(function(){a.call(new Date(NaN))})?function(){if(!isFinite(o.call(this)))throw RangeError("Invalid time value");var t=this.getUTCFullYear(),e=this.getUTCMilliseconds(),n=t<0?"-":9999<t?"+":"";return n+("00000"+Math.abs(t)).slice(n?-6:-4)+"-"+r(this.getUTCMonth()+1)+"-"+r(this.getUTCDate())+"T"+r(this.getUTCHours())+":"+r(this.getUTCMinutes())+":"+r(this.getUTCSeconds())+"."+(99<e?e:"0"+r(e))+"Z"}:a},function(t,e,n){var r=Date.prototype,i="Invalid Date",o=r.toString,a=r.getTime;new Date(NaN)+""!=i&&n(19)(r,"toString",function(){var t=a.call(this);return t==t?o.call(this):i})},function(t,e,n){var r=n(8)("toPrimitive"),i=Date.prototype;r in i||n(18)(i,r,n(327))},function(t,e,n){"use strict";var r=n(2),i=n(31);t.exports=function(t){if("string"!==t&&"number"!==t&&"default"!==t)throw TypeError("Incorrect hint");return i(r(this),"number"!=t)}},function(t,e,n){var r=n(1);r(r.S,"Array",{isArray:n(79)})},function(t,e,n){"use strict";var h=n(27),r=n(1),p=n(13),d=n(168),m=n(121),g=n(9),y=n(122),v=n(123);r(r.S+r.F*!n(82)(function(t){Array.from(t)}),"Array",{from:function(t){var e,n,r,i,o=p(t),a="function"==typeof this?this:Array,s=arguments.length,u=1<s?arguments[1]:void 0,c=void 0!==u,l=0,f=v(o);if(c&&(u=h(u,2<s?arguments[2]:void 0,2)),null==f||a==Array&&m(f))for(n=new a(e=g(o.length));l<e;l++)y(n,l,c?u(o[l],l):o[l]);else for(i=f.call(o),n=new a;!(r=i.next()).done;l++)y(n,l,c?d(i,u,[r.value,l],!0):r.value);return n.length=l,n}})},function(t,e,n){"use strict";var r=n(1),i=n(122);r(r.S+r.F*n(6)(function(){function t(){}return!(Array.of.call(t)instanceof t)}),"Array",{of:function(){for(var t=0,e=arguments.length,n=new("function"==typeof this?this:Array)(e);t<e;)i(n,t,arguments[t++]);return n.length=e,n}})},function(t,e,n){"use strict";var r=n(1),i=n(22),o=[].join;r(r.P+r.F*(n(65)!=Object||!n(30)(o)),"Array",{join:function(t){return o.call(i(this),void 0===t?",":t)}})},function(t,e,n){"use strict";var r=n(1),i=n(110),c=n(28),l=n(48),f=n(9),h=[].slice;r(r.P+r.F*n(6)(function(){i&&h.call(i)}),"Array",{slice:function(t,e){var n=f(this.length),r=c(this);if(e=void 0===e?n:e,"Array"==r)return h.call(this,t,e);for(var i=l(t,n),o=l(e,n),a=f(o-i),s=new Array(a),u=0;u<a;u++)s[u]="String"==r?this.charAt(i+u):this[i+u];return s}})},function(t,e,n){"use strict";var r=n(1),i=n(16),o=n(13),a=n(6),s=[].sort,u=[1,2,3];r(r.P+r.F*(a(function(){u.sort(void 0)})||!a(function(){u.sort(null)})||!n(30)(s)),"Array",{sort:function(t){return void 0===t?s.call(o(this)):s.call(o(this),i(t))}})},function(t,e,n){"use strict";var r=n(1),i=n(34)(0),o=n(30)([].forEach,!0);r(r.P+r.F*!o,"Array",{forEach:function(t){return i(this,t,arguments[1])}})},function(t,e,n){var r=n(7),i=n(79),o=n(8)("species");t.exports=function(t){var e;return i(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!i(e.prototype)||(e=void 0),r(e)&&null===(e=e[o])&&(e=void 0)),void 0===e?Array:e}},function(t,e,n){"use strict";var r=n(1),i=n(34)(1);r(r.P+r.F*!n(30)([].map,!0),"Array",{map:function(t){return i(this,t,arguments[1])}})},function(t,e,n){"use strict";var r=n(1),i=n(34)(2);r(r.P+r.F*!n(30)([].filter,!0),"Array",{filter:function(t){return i(this,t,arguments[1])}})},function(t,e,n){"use strict";var r=n(1),i=n(34)(3);r(r.P+r.F*!n(30)([].some,!0),"Array",{some:function(t){return i(this,t,arguments[1])}})},function(t,e,n){"use strict";var r=n(1),i=n(34)(4);r(r.P+r.F*!n(30)([].every,!0),"Array",{every:function(t){return i(this,t,arguments[1])}})},function(t,e,n){"use strict";var r=n(1),i=n(169);r(r.P+r.F*!n(30)([].reduce,!0),"Array",{reduce:function(t){return i(this,t,arguments.length,arguments[1],!1)}})},function(t,e,n){"use strict";var r=n(1),i=n(169);r(r.P+r.F*!n(30)([].reduceRight,!0),"Array",{reduceRight:function(t){return i(this,t,arguments.length,arguments[1],!0)}})},function(t,e,n){"use strict";var r=n(1),i=n(77)(!1),o=[].indexOf,a=!!o&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(a||!n(30)(o)),"Array",{indexOf:function(t){return a?o.apply(this,arguments)||0:i(this,t,arguments[1])}})},function(t,e,n){"use strict";var r=n(1),i=n(22),o=n(29),a=n(9),s=[].lastIndexOf,u=!!s&&1/[1].lastIndexOf(1,-0)<0;r(r.P+r.F*(u||!n(30)(s)),"Array",{lastIndexOf:function(t){if(u)return s.apply(this,arguments)||0;var e=i(this),n=a(e.length),r=n-1;for(1<arguments.length&&(r=Math.min(r,o(arguments[1]))),r<0&&(r=n+r);0<=r;r--)if(r in e&&e[r]===t)return r||0;return-1}})},function(t,e,n){var r=n(1);r(r.P,"Array",{copyWithin:n(170)}),n(42)("copyWithin")},function(t,e,n){var r=n(1);r(r.P,"Array",{fill:n(125)}),n(42)("fill")},function(t,e,n){"use strict";var r=n(1),i=n(34)(5),o=!0;"find"in[]&&Array(1).find(function(){o=!1}),r(r.P+r.F*o,"Array",{find:function(t){return i(this,t,1<arguments.length?arguments[1]:void 0)}}),n(42)("find")},function(t,e,n){"use strict";var r=n(1),i=n(34)(6),o="findIndex",a=!0;o in[]&&Array(1)[o](function(){a=!1}),r(r.P+r.F*a,"Array",{findIndex:function(t){return i(this,t,1<arguments.length?arguments[1]:void 0)}}),n(42)(o)},function(t,e,n){n(51)("Array")},function(t,e,n){var r=n(5),o=n(113),i=n(11).f,a=n(50).f,s=n(81),u=n(67),c=r.RegExp,l=c,f=c.prototype,h=/a/g,p=/a/g,d=new c(h)!==h;if(n(10)&&(!d||n(6)(function(){return p[n(8)("match")]=!1,c(h)!=h||c(p)==p||"/a/i"!=c(h,"i")}))){c=function(t,e){var n=this instanceof c,r=s(t),i=void 0===e;return!n&&r&&t.constructor===c&&i?t:o(d?new l(r&&!i?t.source:t,e):l((r=t instanceof c)?t.source:t,r&&i?u.call(t):e),n?this:f,c)};function m(e){e in c||i(c,e,{configurable:!0,get:function(){return l[e]},set:function(t){l[e]=t}})}for(var g=a(l),y=0;g.length>y;)m(g[y++]);(f.constructor=c).prototype=f,n(19)(r,"RegExp",c)}n(51)("RegExp")},function(t,e,n){"use strict";n(173);function r(t){n(19)(RegExp.prototype,s,t,!0)}var i=n(2),o=n(67),a=n(10),s="toString",u=/./[s];n(6)(function(){return"/a/b"!=u.call({source:"a",flags:"b"})})?r(function(){var t=i(this);return"/".concat(t.source,"/","flags"in t?t.flags:!a&&t instanceof RegExp?o.call(t):void 0)}):u.name!=s&&r(function(){return u.call(this)})},function(t,e,n){"use strict";var f=n(2),h=n(9),p=n(128),d=n(83);n(84)("match",1,function(r,i,c,l){return[function(t){var e=r(this),n=null==t?void 0:t[i];return void 0!==n?n.call(t,e):new RegExp(t)[i](String(e))},function(t){var e=l(c,t,this);if(e.done)return e.value;var n=f(t),r=String(this);if(!n.global)return d(n,r);for(var i,o=n.unicode,a=[],s=n.lastIndex=0;null!==(i=d(n,r));){var u=String(i[0]);""===(a[s]=u)&&(n.lastIndex=p(r,h(n.lastIndex),o)),s++}return 0===s?null:a}]})},function(t,e,n){"use strict";var S=n(2),r=n(13),N=n(9),I=n(29),O=n(128),k=n(83),A=Math.max,C=Math.min,h=Math.floor,p=/\$([$&`']|\d\d?|<[^>]*>)/g,d=/\$([$&`']|\d\d?)/g;n(84)("replace",2,function(i,o,_,x){return[function(t,e){var n=i(this),r=null==t?void 0:t[o];return void 0!==r?r.call(t,n,e):_.call(String(n),t,e)},function(t,e){var n=x(_,t,this,e);if(n.done)return n.value;var r=S(t),i=String(this),o="function"==typeof e;o||(e=String(e));var a=r.global;if(a){var s=r.unicode;r.lastIndex=0}for(var u=[];;){var c=k(r,i);if(null===c)break;if(u.push(c),!a)break;""===String(c[0])&&(r.lastIndex=O(i,N(r.lastIndex),s))}for(var l,f="",h=0,p=0;p<u.length;p++){c=u[p];for(var d=String(c[0]),m=A(C(I(c.index),i.length),0),g=[],y=1;y<c.length;y++)g.push(void 0===(l=c[y])?l:String(l));var v=c.groups;if(o){var b=[d].concat(g,m,i);void 0!==v&&b.push(v);var w=String(e.apply(void 0,b))}else w=E(d,i,m,g,v,e);h<=m&&(f+=i.slice(h,m)+w,h=m+d.length)}return f+i.slice(h)}];function E(o,a,s,u,c,t){var l=s+o.length,f=u.length,e=d;return void 0!==c&&(c=r(c),e=p),_.call(t,e,function(t,e){var n;switch(e.charAt(0)){case"$":return"$";case"&":return o;case"`":return a.slice(0,s);case"'":return a.slice(l);case"<":n=c[e.slice(1,-1)];break;default:var r=+e;if(0==r)return t;if(f<r){var i=h(r/10);return 0===i?t:i<=f?void 0===u[i-1]?e.charAt(1):u[i-1]+e.charAt(1):t}n=u[r-1]}return void 0===n?"":n})}})},function(t,e,n){"use strict";var u=n(2),c=n(159),l=n(83);n(84)("search",1,function(r,i,a,s){return[function(t){var e=r(this),n=null==t?void 0:t[i];return void 0!==n?n.call(t,e):new RegExp(t)[i](String(e))},function(t){var e=s(a,t,this);if(e.done)return e.value;var n=u(t),r=String(this),i=n.lastIndex;c(i,0)||(n.lastIndex=0);var o=l(n,r);return c(n.lastIndex,i)||(n.lastIndex=i),null===o?-1:o.index}]})},function(t,e,n){"use strict";var f=n(81),b=n(2),w=n(68),_=n(128),x=n(9),E=n(83),h=n(127),r=n(6),S=Math.min,p=[].push,a="split",d="length",m="lastIndex",N=4294967295,I=!r(function(){RegExp(N,"y")});n(84)("split",2,function(i,o,g,y){var v;return v="c"=="abbc"[a](/(b)*/)[1]||4!="test"[a](/(?:)/,-1)[d]||2!="ab"[a](/(?:ab)*/)[d]||4!="."[a](/(.?)(.?)/)[d]||1<"."[a](/()()/)[d]||""[a](/.?/)[d]?function(t,e){var n=String(this);if(void 0===t&&0===e)return[];if(!f(t))return g.call(n,t,e);for(var r,i,o,a=[],s=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),u=0,c=void 0===e?N:e>>>0,l=new RegExp(t.source,s+"g");(r=h.call(l,n))&&!(u<(i=l[m])&&(a.push(n.slice(u,r.index)),1<r[d]&&r.index<n[d]&&p.apply(a,r.slice(1)),o=r[0][d],u=i,a[d]>=c));)l[m]===r.index&&l[m]++;return u===n[d]?!o&&l.test("")||a.push(""):a.push(n.slice(u)),a[d]>c?a.slice(0,c):a}:"0"[a](void 0,0)[d]?function(t,e){return void 0===t&&0===e?[]:g.call(this,t,e)}:g,[function(t,e){var n=i(this),r=null==t?void 0:t[o];return void 0!==r?r.call(t,n,e):v.call(String(n),t,e)},function(t,e){var n=y(v,t,this,e,v!==g);if(n.done)return n.value;var r=b(t),i=String(this),o=w(r,RegExp),a=r.unicode,s=(r.ignoreCase?"i":"")+(r.multiline?"m":"")+(r.unicode?"u":"")+(I?"y":"g"),u=new o(I?r:"^(?:"+r.source+")",s),c=void 0===e?N:e>>>0;if(0==c)return[];if(0===i.length)return null===E(u,i)?[i]:[];for(var l=0,f=0,h=[];f<i.length;){u.lastIndex=I?f:0;var p,d=E(u,I?i:i.slice(f));if(null===d||(p=S(x(u.lastIndex+(I?0:f)),i.length))===l)f=_(i,f,a);else{if(h.push(i.slice(l,f)),h.length===c)return h;for(var m=1;m<=d.length-1;m++)if(h.push(d[m]),h.length===c)return h;f=l=p}}return h.push(i.slice(l)),h}]})},function(t,e,n){"use strict";function r(){}function f(t){var e;return!(!g(t)||"function"!=typeof(e=t.then))&&e}function i(l,n){if(!l._n){l._n=!0;var r=l._c;x(function(){for(var u=l._v,c=1==l._s,t=0,e=function(t){var e,n,r,i=c?t.ok:t.fail,o=t.resolve,a=t.reject,s=t.domain;try{i?(c||(2==l._h&&L(l),l._h=1),!0===i?e=u:(s&&s.enter(),e=i(u),s&&(s.exit(),r=!0)),e===t.promise?a(k("Promise-chain cycle")):(n=f(e))?n.call(e,o,a):o(e)):a(u)}catch(t){s&&!r&&s.exit(),a(t)}};r.length>t;)e(r[t++]);l._c=[],l._n=!1,n&&!l._h&&j(l)})}}function o(t){var e=this;e._d||(e._d=!0,(e=e._w||e)._v=t,e._s=2,e._a||(e._a=e._c.slice()),i(e,!0))}var a,s,u,c,l=n(40),h=n(5),p=n(27),d=n(58),m=n(1),g=n(7),y=n(16),v=n(52),b=n(53),w=n(68),_=n(129).set,x=n(130)(),E=n(131),S=n(174),N=n(85),I=n(175),O="Promise",k=h.TypeError,A=h.process,C=A&&A.versions,P=C&&C.v8||"",T=h[O],M="process"==d(A),R=s=E.f,D=!!function(){try{var t=T.resolve(1),e=(t.constructor={})[n(8)("species")]=function(t){t(r,r)};return(M||"function"==typeof PromiseRejectionEvent)&&t.then(r)instanceof e&&0!==P.indexOf("6.6")&&-1===N.indexOf("Chrome/66")}catch(t){}}(),j=function(o){_.call(h,function(){var t,e,n,r=o._v,i=B(o);if(i&&(t=S(function(){M?A.emit("unhandledRejection",r,o):(e=h.onunhandledrejection)?e({promise:o,reason:r}):(n=h.console)&&n.error&&n.error("Unhandled promise rejection",r)}),o._h=M||B(o)?2:1),o._a=void 0,i&&t.e)throw t.v})},B=function(t){return 1!==t._h&&0===(t._a||t._c).length},L=function(e){_.call(h,function(){var t;M?A.emit("rejectionHandled",e):(t=h.onrejectionhandled)&&t({promise:e,reason:e._v})})},F=function(t){var n,r=this;if(!r._d){r._d=!0,r=r._w||r;try{if(r===t)throw k("Promise can't be resolved itself");(n=f(t))?x(function(){var e={_w:r,_d:!1};try{n.call(t,p(F,e,1),p(o,e,1))}catch(t){o.call(e,t)}}):(r._v=t,r._s=1,i(r,!1))}catch(t){o.call({_w:r,_d:!1},t)}}};D||(T=function(t){v(this,T,O,"_h"),y(t),a.call(this);try{t(p(F,this,1),p(o,this,1))}catch(t){o.call(this,t)}},(a=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(54)(T.prototype,{then:function(t,e){var n=R(w(this,T));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=M?A.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&i(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),u=function(){var t=new a;this.promise=t,this.resolve=p(F,t,1),this.reject=p(o,t,1)},E.f=R=function(t){return t===T||t===c?new u(t):s(t)}),m(m.G+m.W+m.F*!D,{Promise:T}),n(57)(T,O),n(51)(O),c=n(26)[O],m(m.S+m.F*!D,O,{reject:function(t){var e=R(this);return(0,e.reject)(t),e.promise}}),m(m.S+m.F*(l||!D),O,{resolve:function(t){return I(l&&this===c?T:this,t)}}),m(m.S+m.F*!(D&&n(82)(function(t){T.all(t).catch(r)})),O,{all:function(t){var a=this,e=R(a),s=e.resolve,u=e.reject,n=S(function(){var r=[],i=0,o=1;b(t,!1,function(t){var e=i++,n=!1;r.push(void 0),o++,a.resolve(t).then(function(t){n||(n=!0,r[e]=t,--o||s(r))},u)}),--o||s(r)});return n.e&&u(n.v),e.promise},race:function(t){var e=this,n=R(e),r=n.reject,i=S(function(){b(t,!1,function(t){e.resolve(t).then(n.resolve,r)})});return i.e&&r(i.v),n.promise}})},function(t,e,n){"use strict";var r=n(180),i=n(55);n(86)("WeakSet",function(t){return function(){return t(this,0<arguments.length?arguments[0]:void 0)}},{add:function(t){return r.def(i(this,"WeakSet"),t,!0)}},r,!1,!0)},function(t,e,n){"use strict";var r=n(1),i=n(87),o=n(132),c=n(2),l=n(48),f=n(9),a=n(7),s=n(5).ArrayBuffer,h=n(68),p=o.ArrayBuffer,d=o.DataView,u=i.ABV&&s.isView,m=p.prototype.slice,g=i.VIEW,y="ArrayBuffer";r(r.G+r.W+r.F*(s!==p),{ArrayBuffer:p}),r(r.S+r.F*!i.CONSTR,y,{isView:function(t){return u&&u(t)||a(t)&&g in t}}),r(r.P+r.U+r.F*n(6)(function(){return!new p(2).slice(1,void 0).byteLength}),y,{slice:function(t,e){if(void 0!==m&&void 0===e)return m.call(c(this),t);for(var n=c(this).byteLength,r=l(t,n),i=l(void 0===e?n:e,n),o=new(h(this,p))(f(i-r)),a=new d(this),s=new d(o),u=0;r<i;)s.setUint8(u++,a.getUint8(r++));return o}}),n(51)(y)},function(t,e,n){var r=n(1);r(r.G+r.W+r.F*!n(87).ABV,{DataView:n(132).DataView})},function(t,e,n){n(37)("Int8",1,function(r){return function(t,e,n){return r(this,t,e,n)}})},function(t,e,n){n(37)("Uint8",1,function(r){return function(t,e,n){return r(this,t,e,n)}})},function(t,e,n){n(37)("Uint8",1,function(r){return function(t,e,n){return r(this,t,e,n)}},!0)},function(t,e,n){n(37)("Int16",2,function(r){return function(t,e,n){return r(this,t,e,n)}})},function(t,e,n){n(37)("Uint16",2,function(r){return function(t,e,n){return r(this,t,e,n)}})},function(t,e,n){n(37)("Int32",4,function(r){return function(t,e,n){return r(this,t,e,n)}})},function(t,e,n){n(37)("Uint32",4,function(r){return function(t,e,n){return r(this,t,e,n)}})},function(t,e,n){n(37)("Float32",4,function(r){return function(t,e,n){return r(this,t,e,n)}})},function(t,e,n){n(37)("Float64",8,function(r){return function(t,e,n){return r(this,t,e,n)}})},function(t,e,n){var r=n(1),o=n(16),a=n(2),s=(n(5).Reflect||{}).apply,u=Function.apply;r(r.S+r.F*!n(6)(function(){s(function(){})}),"Reflect",{apply:function(t,e,n){var r=o(t),i=a(n);return s?s(r,e,i):u.call(r,e,i)}})},function(t,e,n){var r=n(1),s=n(49),u=n(16),c=n(2),l=n(7),i=n(6),f=n(160),h=(n(5).Reflect||{}).construct,p=i(function(){function t(){}return!(h(function(){},[],t)instanceof t)}),d=!i(function(){h(function(){})});r(r.S+r.F*(p||d),"Reflect",{construct:function(t,e){u(t),c(e);var n=arguments.length<3?t:u(arguments[2]);if(d&&!p)return h(t,e,n);if(t==n){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var r=[null];return r.push.apply(r,e),new(f.apply(t,r))}var i=n.prototype,o=s(l(i)?i:Object.prototype),a=Function.apply.call(t,o,e);return l(a)?a:o}})},function(t,e,n){var r=n(11),i=n(1),o=n(2),a=n(31);i(i.S+i.F*n(6)(function(){Reflect.defineProperty(r.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(t,e,n){o(t),e=a(e,!0),o(n);try{return r.f(t,e,n),!0}catch(t){return!1}}})},function(t,e,n){var r=n(1),i=n(23).f,o=n(2);r(r.S,"Reflect",{deleteProperty:function(t,e){var n=i(o(t),e);return!(n&&!n.configurable)&&delete t[e]}})},function(t,e,n){"use strict";function r(t){this._t=o(t),this._i=0;var e,n=this._k=[];for(e in t)n.push(e)}var i=n(1),o=n(2);n(118)(r,"Object",function(){var t,e=this._k;do{if(this._i>=e.length)return{value:void 0,done:!0}}while(!((t=e[this._i++])in this._t));return{value:t,done:!1}}),i(i.S,"Reflect",{enumerate:function(t){return new r(t)}})},function(t,e,n){var a=n(23),s=n(24),u=n(21),r=n(1),c=n(7),l=n(2);r(r.S,"Reflect",{get:function t(e,n){var r,i,o=arguments.length<3?e:arguments[2];return l(e)===o?e[n]:(r=a.f(e,n))?u(r,"value")?r.value:void 0!==r.get?r.get.call(o):void 0:c(i=s(e))?t(i,n,o):void 0}})},function(t,e,n){var r=n(23),i=n(1),o=n(2);i(i.S,"Reflect",{getOwnPropertyDescriptor:function(t,e){return r.f(o(t),e)}})},function(t,e,n){var r=n(1),i=n(24),o=n(2);r(r.S,"Reflect",{getPrototypeOf:function(t){return i(o(t))}})},function(t,e,n){var r=n(1);r(r.S,"Reflect",{has:function(t,e){return e in t}})},function(t,e,n){var r=n(1),i=n(2),o=Object.isExtensible;r(r.S,"Reflect",{isExtensible:function(t){return i(t),!o||o(t)}})},function(t,e,n){var r=n(1);r(r.S,"Reflect",{ownKeys:n(182)})},function(t,e,n){var r=n(1),i=n(2),o=Object.preventExtensions;r(r.S,"Reflect",{preventExtensions:function(t){i(t);try{return o&&o(t),!0}catch(t){return!1}}})},function(t,e,n){var u=n(11),c=n(23),l=n(24),f=n(21),r=n(1),h=n(45),p=n(2),d=n(7);r(r.S,"Reflect",{set:function t(e,n,r){var i,o,a=arguments.length<4?e:arguments[3],s=c.f(p(e),n);if(!s){if(d(o=l(e)))return t(o,n,r,a);s=h(0)}if(f(s,"value")){if(!1===s.writable||!d(a))return!1;if(i=c.f(a,n)){if(i.get||i.set||!1===i.writable)return!1;i.value=r,u.f(a,n,i)}else u.f(a,n,h(0,r));return!0}return void 0!==s.set&&(s.set.call(a,r),!0)}})},function(t,e,n){var r=n(1),i=n(111);i&&r(r.S,"Reflect",{setPrototypeOf:function(t,e){i.check(t,e);try{return i.set(t,e),!0}catch(t){return!1}}})},function(t,e,n){"use strict";var r=n(1),i=n(77)(!0);r(r.P,"Array",{includes:function(t){return i(this,t,1<arguments.length?arguments[1]:void 0)}}),n(42)("includes")},function(t,e,n){"use strict";var r=n(1),i=n(183),o=n(13),a=n(9),s=n(16),u=n(124);r(r.P,"Array",{flatMap:function(t){var e,n,r=o(this);return s(t),e=a(r.length),n=u(r,0),i(n,r,r,e,0,1,t,arguments[1]),n}}),n(42)("flatMap")},function(t,e,n){"use strict";var r=n(1),i=n(183),o=n(13),a=n(9),s=n(29),u=n(124);r(r.P,"Array",{flatten:function(){var t=arguments[0],e=o(this),n=a(e.length),r=u(e,0);return i(r,e,e,n,0,void 0===t?1:s(t)),r}}),n(42)("flatten")},function(t,e,n){"use strict";var r=n(1),i=n(80)(!0);r(r.P,"String",{at:function(t){return i(this,t)}})},function(t,e,n){"use strict";var r=n(1),i=n(184),o=n(85),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(o);r(r.P+r.F*a,"String",{padStart:function(t){return i(this,t,1<arguments.length?arguments[1]:void 0,!0)}})},function(t,e,n){"use strict";var r=n(1),i=n(184),o=n(85),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(o);r(r.P+r.F*a,"String",{padEnd:function(t){return i(this,t,1<arguments.length?arguments[1]:void 0,!1)}})},function(t,e,n){"use strict";n(59)("trimLeft",function(t){return function(){return t(this,1)}},"trimStart")},function(t,e,n){"use strict";n(59)("trimRight",function(t){return function(){return t(this,2)}},"trimEnd")},function(t,e,n){"use strict";function i(t,e){this._r=t,this._s=e}var r=n(1),o=n(32),a=n(9),s=n(81),u=n(67),c=RegExp.prototype;n(118)(i,"RegExp String",function(){var t=this._r.exec(this._s);return{value:t,done:null===t}}),r(r.P,"String",{matchAll:function(t){if(o(this),!s(t))throw TypeError(t+" is not a regexp!");var e=String(this),n="flags"in c?String(t.flags):u.call(t),r=new RegExp(t.source,~n.indexOf("g")?n:"g"+n);return r.lastIndex=a(t.lastIndex),new i(r,e)}})},function(t,e,n){n(107)("asyncIterator")},function(t,e,n){n(107)("observable")},function(t,e,n){var r=n(1),u=n(182),c=n(22),l=n(23),f=n(122);r(r.S,"Object",{getOwnPropertyDescriptors:function(t){for(var e,n,r=c(t),i=l.f,o=u(r),a={},s=0;o.length>s;)void 0!==(n=i(r,e=o[s++]))&&f(a,e,n);return a}})},function(t,e,n){var r=n(1),i=n(185)(!1);r(r.S,"Object",{values:function(t){return i(t)}})},function(t,e,n){var r=n(1),i=n(185)(!0);r(r.S,"Object",{entries:function(t){return i(t)}})},function(t,e,n){"use strict";var r=n(1),i=n(13),o=n(16),a=n(11);n(10)&&r(r.P+n(88),"Object",{__defineGetter__:function(t,e){a.f(i(this),t,{get:o(e),enumerable:!0,configurable:!0})}})},function(t,e,n){"use strict";var r=n(1),i=n(13),o=n(16),a=n(11);n(10)&&r(r.P+n(88),"Object",{__defineSetter__:function(t,e){a.f(i(this),t,{set:o(e),enumerable:!0,configurable:!0})}})},function(t,e,n){"use strict";var r=n(1),i=n(13),o=n(31),a=n(24),s=n(23).f;n(10)&&r(r.P+n(88),"Object",{__lookupGetter__:function(t){var e,n=i(this),r=o(t,!0);do{if(e=s(n,r))return e.get}while(n=a(n))}})},function(t,e,n){"use strict";var r=n(1),i=n(13),o=n(31),a=n(24),s=n(23).f;n(10)&&r(r.P+n(88),"Object",{__lookupSetter__:function(t){var e,n=i(this),r=o(t,!0);do{if(e=s(n,r))return e.set}while(n=a(n))}})},function(t,e,n){var r=n(1);r(r.P+r.R,"Map",{toJSON:n(186)("Map")})},function(t,e,n){var r=n(1);r(r.P+r.R,"Set",{toJSON:n(186)("Set")})},function(t,e,n){n(89)("Map")},function(t,e,n){n(89)("Set")},function(t,e,n){n(89)("WeakMap")},function(t,e,n){n(89)("WeakSet")},function(t,e,n){n(90)("Map")},function(t,e,n){n(90)("Set")},function(t,e,n){n(90)("WeakMap")},function(t,e,n){n(90)("WeakSet")},function(t,e,n){var r=n(1);r(r.G,{global:n(5)})},function(t,e,n){var r=n(1);r(r.S,"System",{global:n(5)})},function(t,e,n){var r=n(1),i=n(28);r(r.S,"Error",{isError:function(t){return"Error"===i(t)}})},function(t,e,n){var r=n(1);r(r.S,"Math",{clamp:function(t,e,n){return Math.min(n,Math.max(e,t))}})},function(t,e,n){var r=n(1);r(r.S,"Math",{DEG_PER_RAD:Math.PI/180})},function(t,e,n){var r=n(1),i=180/Math.PI;r(r.S,"Math",{degrees:function(t){return t*i}})},function(t,e,n){var r=n(1),o=n(188),a=n(167);r(r.S,"Math",{fscale:function(t,e,n,r,i){return a(o(t,e,n,r,i))}})},function(t,e,n){var r=n(1);r(r.S,"Math",{iaddh:function(t,e,n,r){var i=t>>>0,o=n>>>0;return(e>>>0)+(r>>>0)+((i&o|(i|o)&~(i+o>>>0))>>>31)|0}})},function(t,e,n){var r=n(1);r(r.S,"Math",{isubh:function(t,e,n,r){var i=t>>>0,o=n>>>0;return(e>>>0)-(r>>>0)-((~i&o|~(i^o)&i-o>>>0)>>>31)|0}})},function(t,e,n){var r=n(1);r(r.S,"Math",{imulh:function(t,e){var n=+t,r=+e,i=65535&n,o=65535&r,a=n>>16,s=r>>16,u=(a*o>>>0)+(i*o>>>16);return a*s+(u>>16)+((i*s>>>0)+(65535&u)>>16)}})},function(t,e,n){var r=n(1);r(r.S,"Math",{RAD_PER_DEG:180/Math.PI})},function(t,e,n){var r=n(1),i=Math.PI/180;r(r.S,"Math",{radians:function(t){return t*i}})},function(t,e,n){var r=n(1);r(r.S,"Math",{scale:n(188)})},function(t,e,n){var r=n(1);r(r.S,"Math",{umulh:function(t,e){var n=+t,r=+e,i=65535&n,o=65535&r,a=n>>>16,s=r>>>16,u=(a*o>>>0)+(i*o>>>16);return a*s+(u>>>16)+((i*s>>>0)+(65535&u)>>>16)}})},function(t,e,n){var r=n(1);r(r.S,"Math",{signbit:function(t){return(t=+t)!=t?t:0==t?1/t==1/0:0<t}})},function(t,e,n){"use strict";var r=n(1),i=n(26),o=n(5),a=n(68),s=n(175);r(r.P+r.R,"Promise",{finally:function(e){var n=a(this,i.Promise||o.Promise),t="function"==typeof e;return this.then(t?function(t){return s(n,e()).then(function(){return t})}:e,t?function(t){return s(n,e()).then(function(){throw t})}:e)}})},function(t,e,n){"use strict";var r=n(1),i=n(131),o=n(174);r(r.S,"Promise",{try:function(t){var e=i.f(this),n=o(t);return(n.e?e.reject:e.resolve)(n.v),e.promise}})},function(t,e,n){var r=n(38),i=n(2),o=r.key,a=r.set;r.exp({defineMetadata:function(t,e,n,r){a(t,e,i(n),o(r))}})},function(t,e,n){var r=n(38),o=n(2),a=r.key,s=r.map,u=r.store;r.exp({deleteMetadata:function(t,e){var n=arguments.length<3?void 0:a(arguments[2]),r=s(o(e),n,!1);if(void 0===r||!r.delete(t))return!1;if(r.size)return!0;var i=u.get(e);return i.delete(n),!!i.size||u.delete(e)}})},function(t,e,n){var r=n(38),i=n(2),o=n(24),a=r.has,s=r.get,u=r.key,c=function(t,e,n){if(a(t,e,n))return s(t,e,n);var r=o(e);return null!==r?c(t,r,n):void 0};r.exp({getMetadata:function(t,e){return c(t,i(e),arguments.length<3?void 0:u(arguments[2]))}})},function(t,e,n){var o=n(178),a=n(187),r=n(38),i=n(2),s=n(24),u=r.keys,c=r.key,l=function(t,e){var n=u(t,e),r=s(t);if(null===r)return n;var i=l(r,e);return i.length?n.length?a(new o(n.concat(i))):i:n};r.exp({getMetadataKeys:function(t){return l(i(t),arguments.length<2?void 0:c(arguments[1]))}})},function(t,e,n){var r=n(38),i=n(2),o=r.get,a=r.key;r.exp({getOwnMetadata:function(t,e){return o(t,i(e),arguments.length<3?void 0:a(arguments[2]))}})},function(t,e,n){var r=n(38),i=n(2),o=r.keys,a=r.key;r.exp({getOwnMetadataKeys:function(t){return o(i(t),arguments.length<2?void 0:a(arguments[1]))}})},function(t,e,n){var r=n(38),i=n(2),o=n(24),a=r.has,s=r.key,u=function(t,e,n){if(a(t,e,n))return!0;var r=o(e);return null!==r&&u(t,r,n)};r.exp({hasMetadata:function(t,e){return u(t,i(e),arguments.length<3?void 0:s(arguments[2]))}})},function(t,e,n){var r=n(38),i=n(2),o=r.has,a=r.key;r.exp({hasOwnMetadata:function(t,e){return o(t,i(e),arguments.length<3?void 0:a(arguments[2]))}})},function(t,e,n){var r=n(38),i=n(2),o=n(16),a=r.key,s=r.set;r.exp({metadata:function(n,r){return function(t,e){s(n,r,(void 0!==e?i:o)(t),a(e))}}})},function(t,e,n){var r=n(1),i=n(130)(),o=n(5).process,a="process"==n(28)(o);r(r.G,{asap:function(t){var e=a&&o.domain;i(e?e.bind(t):t)}})},function(t,e,n){"use strict";function i(t){return null==t?void 0:p(t)}function o(t){var e=t._c;e&&(t._c=void 0,e())}function a(t){return void 0===t._o}function s(t){a(t)||(t._o=void 0,o(t))}function r(e,t){d(e),this._c=void 0,this._o=e,e=new w(this);try{var n=t(e),r=n;null!=n&&("function"==typeof n.unsubscribe?n=function(){r.unsubscribe()}:p(n),this._c=n)}catch(t){return void e.error(t)}a(this)&&o(this)}var u=n(1),c=n(5),l=n(26),f=n(130)(),h=n(8)("observable"),p=n(16),d=n(2),m=n(52),g=n(54),y=n(18),v=n(53),b=v.RETURN;r.prototype=g({},{unsubscribe:function(){s(this)}});var w=function(t){this._s=t};w.prototype=g({},{next:function(t){var e=this._s;if(!a(e)){var n=e._o;try{var r=i(n.next);if(r)return r.call(n,t)}catch(t){try{s(e)}finally{throw t}}}},error:function(t){var e=this._s;if(a(e))throw t;var n=e._o;e._o=void 0;try{var r=i(n.error);if(!r)throw t;t=r.call(n,t)}catch(t){try{o(e)}finally{throw t}}return o(e),t},complete:function(t){var e=this._s;if(!a(e)){var n=e._o;e._o=void 0;try{var r=i(n.complete);t=r?r.call(n,t):void 0}catch(t){try{o(e)}finally{throw t}}return o(e),t}}});var _=function(t){m(this,_,"Observable","_f")._f=p(t)};g(_.prototype,{subscribe:function(t){return new r(t,this._f)},forEach:function(r){var i=this;return new(l.Promise||c.Promise)(function(t,e){p(r);var n=i.subscribe({next:function(t){try{return r(t)}catch(t){e(t),n.unsubscribe()}},error:e,complete:t})})}}),g(_,{from:function(t){var e="function"==typeof this?this:_,n=i(d(t)[h]);if(n){var r=d(n.call(t));return r.constructor===e?r:new e(function(t){return r.subscribe(t)})}return new e(function(e){var n=!1;return f(function(){if(!n){try{if(v(t,!1,function(t){if(e.next(t),n)return b})===b)return}catch(t){if(n)throw t;return void e.error(t)}e.complete()}}),function(){n=!0}})},of:function(){for(var t=0,e=arguments.length,r=new Array(e);t<e;)r[t]=arguments[t++];return new("function"==typeof this?this:_)(function(e){var n=!1;return f(function(){if(!n){for(var t=0;t<r.length;++t)if(e.next(r[t]),n)return;e.complete()}}),function(){n=!0}})}}),y(_.prototype,h,function(){return this}),u(u.G,{Observable:_}),n(51)("Observable")},function(t,e,n){function r(i){return function(t,e){var n=2<arguments.length,r=n&&s.call(arguments,2);return i(n?function(){("function"==typeof t?t:Function(t)).apply(this,r)}:t,e)}}var i=n(5),o=n(1),a=n(85),s=[].slice,u=/MSIE .\./.test(a);o(o.G+o.B+o.F*u,{setTimeout:r(i.setTimeout),setInterval:r(i.setInterval)})},function(t,e,n){var r=n(1),i=n(129);r(r.G+r.B,{setImmediate:i.set,clearImmediate:i.clear})},function(t,e,n){for(var r=n(126),i=n(47),o=n(19),a=n(5),s=n(18),u=n(60),c=n(8),l=c("iterator"),f=c("toStringTag"),h=u.Array,p={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},d=i(p),m=0;m<d.length;m++){var g,y=d[m],v=p[y],b=a[y],w=b&&b.prototype;if(w&&(w[l]||s(w,l,h),w[f]||s(w,f,y),u[y]=h,v))for(g in r)w[g]||o(w,g,r[g],!0)}},function(T,t,e){(function(t){!function(t){"use strict";var u,e=Object.prototype,c=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",r=n.asyncIterator||"@@asyncIterator",o=n.toStringTag||"@@toStringTag",a="object"==typeof T,s=t.regeneratorRuntime;if(s)a&&(T.exports=s);else{(s=t.regeneratorRuntime=a?T.exports:{}).wrap=b;var l="suspendedStart",f="suspendedYield",h="executing",p="completed",d={},m={};m[i]=function(){return this};var g=Object.getPrototypeOf,y=g&&g(g(C([])));y&&y!==e&&c.call(y,i)&&(m=y);var v=E.prototype=_.prototype=Object.create(m);x.prototype=v.constructor=E,E.constructor=x,E[o]=x.displayName="GeneratorFunction",s.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===x||"GeneratorFunction"===(e.displayName||e.name))},s.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,o in t||(t[o]="GeneratorFunction")),t.prototype=Object.create(v),t},s.awrap=function(t){return{__await:t}},S(N.prototype),N.prototype[r]=function(){return this},s.AsyncIterator=N,s.async=function(t,e,n,r){var i=new N(b(t,e,n,r));return s.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},S(v),v[o]="Generator",v[i]=function(){return this},v.toString=function(){return"[object Generator]"},s.keys=function(n){var r=[];for(var t in n)r.push(t);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in n)return t.value=e,t.done=!1,t}return t.done=!0,t}},s.values=C,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&c.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function t(t,e){return o.type="throw",o.arg=n,r.next=t,e&&(r.method="next",r.arg=u),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=c.call(i,"catchLoc"),s=c.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&c.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),d}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:C(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=u),d}}}function b(t,e,n,r){var i=e&&e.prototype instanceof _?e:_,o=Object.create(i.prototype),a=new A(r||[]);return o._invoke=function(o,a,s){var u=l;return function(t,e){if(u===h)throw new Error("Generator is already running");if(u===p){if("throw"===t)throw e;return P()}for(s.method=t,s.arg=e;;){var n=s.delegate;if(n){var r=I(n,s);if(r){if(r===d)continue;return r}}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if(u===l)throw u=p,s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);u=h;var i=w(o,a,s);if("normal"===i.type){if(u=s.done?p:f,i.arg===d)continue;return{value:i.arg,done:s.done}}"throw"===i.type&&(u=p,s.method="throw",s.arg=i.arg)}}}(t,n,a),o}function w(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function _(){}function x(){}function E(){}function S(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function N(s){function u(t,e,n,r){var i=w(s[t],s,e);if("throw"!==i.type){var o=i.arg,a=o.value;return a&&"object"==typeof a&&c.call(a,"__await")?Promise.resolve(a.__await).then(function(t){u("next",t,n,r)},function(t){u("throw",t,n,r)}):Promise.resolve(a).then(function(t){o.value=t,n(o)},r)}r(i.arg)}var e;"object"==typeof t.process&&t.process.domain&&(u=t.process.domain.bind(u)),this._invoke=function(n,r){function t(){return new Promise(function(t,e){u(n,r,t,e)})}return e=e?e.then(t,t):t()}}function I(t,e){var n=t.iterator[e.method];if(n===u){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=u,I(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var r=w(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,d;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=u),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(c.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=u,t.done=!0,t};return r.next=r}}return{next:P}}function P(){return{value:u,done:!0}}}("object"==typeof t?t:"object"==typeof window?window:"object"==typeof self?self:this)}).call(this,e(15))},function(t,e,n){n(443),t.exports=n(26).RegExp.escape},function(t,e,n){var r=n(1),i=n(444)(/[\\^$*+?.()|[\]{}]/g,"\\$&");r(r.S,"RegExp",{escape:function(t){return i(t)}})},function(t,e){t.exports=function(e,n){var r=n===Object(n)?function(t){return n[t]}:n;return function(t){return String(t).replace(e,r)}}},function(t,e,n){(function(t,d){!function(n,r){"use strict";if(!n.setImmediate){var i,o,e,a,s=1,u={},c=!1,l=n.document,t=Object.getPrototypeOf&&Object.getPrototypeOf(n);t=t&&t.setTimeout?t:n,i="[object process]"==={}.toString.call(n.process)?function(t){d.nextTick(function(){h(t)})}:function(){if(n.postMessage&&!n.importScripts){var t=!0,e=n.onmessage;return n.onmessage=function(){t=!1},n.postMessage("","*"),n.onmessage=e,t}}()?(a="setImmediate$"+Math.random()+"$",n.addEventListener?n.addEventListener("message",p,!1):n.attachEvent("onmessage",p),function(t){n.postMessage(a+t,"*")}):n.MessageChannel?((e=new MessageChannel).port1.onmessage=function(t){h(t.data)},function(t){e.port2.postMessage(t)}):l&&"onreadystatechange"in l.createElement("script")?(o=l.documentElement,function(t){var e=l.createElement("script");e.onreadystatechange=function(){h(t),e.onreadystatechange=null,o.removeChild(e),e=null},o.appendChild(e)}):function(t){setTimeout(h,0,t)},t.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var r={callback:t,args:e};return u[s]=r,i(s),s++},t.clearImmediate=f}function f(t){delete u[t]}function h(t){if(c)setTimeout(h,0,t);else{var e=u[t];if(e){c=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(r,n)}}(e)}finally{f(t),c=!1}}}}function p(t){t.source===n&&"string"==typeof t.data&&0===t.data.indexOf(a)&&h(+t.data.slice(a.length))}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(15),n(35))},function(t,e,n){"use strict";e.byteLength=function(t){var e=f(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){for(var e,n=f(t),r=n[0],i=n[1],o=new l(function(t,e,n){return 3*(e+n)/4-n}(0,r,i)),a=0,s=0<i?r-4:r,u=0;u<s;u+=4)e=c[t.charCodeAt(u)]<<18|c[t.charCodeAt(u+1)]<<12|c[t.charCodeAt(u+2)]<<6|c[t.charCodeAt(u+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=255&e;2===i&&(e=c[t.charCodeAt(u)]<<2|c[t.charCodeAt(u+1)]>>4,o[a++]=255&e);1===i&&(e=c[t.charCodeAt(u)]<<10|c[t.charCodeAt(u+1)]<<4|c[t.charCodeAt(u+2)]>>2,o[a++]=e>>8&255,o[a++]=255&e);return o},e.fromByteArray=function(t){for(var e,n=t.length,r=n%3,i=[],o=0,a=n-r;o<a;o+=16383)i.push(u(t,o,a<o+16383?a:o+16383));1==r?(e=t[n-1],i.push(s[e>>2]+s[e<<4&63]+"==")):2==r&&(e=(t[n-2]<<8)+t[n-1],i.push(s[e>>10]+s[e>>4&63]+s[e<<2&63]+"="));return i.join("")};for(var s=[],c=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=r.length;i<o;++i)s[i]=r[i],c[r.charCodeAt(i)]=i;function f(t){var e=t.length;if(0<e%4)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function u(t,e,n){for(var r,i,o=[],a=e;a<n;a+=3)r=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),o.push(s[(i=r)>>18&63]+s[i>>12&63]+s[i>>6&63]+s[63&i]);return o.join("")}c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,c=u>>1,l=-7,f=n?i-1:0,h=n?-1:1,p=t[e+f];for(f+=h,o=p&(1<<-l)-1,p>>=-l,l+=s;0<l;o=256*o+t[e+f],f+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;0<l;a=256*a+t[e+f],f+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),o-=c}return(p?-1:1)*a*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,f=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),2<=(e+=1<=a+f?h/u:h*Math.pow(2,1-f))*u&&(a++,u/=2),l<=a+f?(s=0,a=l):1<=a+f?(s=(e*u-1)*Math.pow(2,i),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));8<=i;t[n+p]=255&s,p+=d,s/=256,i-=8);for(a=a<<i|s,c+=i;0<c;t[n+p]=255&a,p+=d,a/=256,c-=8);t[n+p-d]|=128*m}},function(t,e){},function(t,e,n){"use strict";var s=n(4).Buffer,r=n(450);function i(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),this.head=null,this.tail=null,this.length=0}t.exports=(i.prototype.push=function(t){var e={data:t,next:null};0<this.length?this.tail.next=e:this.head=e,this.tail=e,++this.length},i.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},i.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},i.prototype.clear=function(){this.head=this.tail=null,this.length=0},i.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},i.prototype.concat=function(t){if(0===this.length)return s.alloc(0);if(1===this.length)return this.head.data;for(var e,n,r,i=s.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,n=i,r=a,e.copy(n,r),a+=o.data.length,o=o.next;return i},i),r&&r.inspect&&r.inspect.custom&&(t.exports.prototype[r.inspect.custom]=function(){var t=r.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,n){(function(n){function r(t){try{if(!n.localStorage)return!1}catch(t){return!1}var e=n.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,n(15))},function(t,e,n){"use strict";t.exports=o;var r=n(196),i=n(70);function o(t){if(!(this instanceof o))return new o(t);r.call(this,t)}i.inherits=n(3),i.inherits(o,r),o.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){t.exports=n(137)},function(t,e,n){t.exports=n(56)},function(t,e,n){t.exports=n(136).Transform},function(t,e,n){t.exports=n(136).PassThrough},function(t,e,n){var r=n(3),i=n(62),o=n(4).Buffer,y=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function s(){this.init(),this._w=a,i.call(this,64,56)}r(s,i),s.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},s.prototype._update=function(t){for(var e,n,r,i,o,a,s=this._w,u=0|this._a,c=0|this._b,l=0|this._c,f=0|this._d,h=0|this._e,p=0;p<16;++p)s[p]=t.readInt32BE(4*p);for(;p<80;++p)s[p]=s[p-3]^s[p-8]^s[p-14]^s[p-16];for(var d=0;d<80;++d){var m=~~(d/20),g=0|((a=u)<<5|a>>>27)+(r=c,i=l,o=f,0===(n=m)?r&i|~r&o:2===n?r&i|r&o|i&o:r^i^o)+h+s[d]+y[m];h=f,f=l,l=(e=c)<<30|e>>>2,c=u,u=g}this._a=u+this._a|0,this._b=c+this._b|0,this._c=l+this._c|0,this._d=f+this._d|0,this._e=h+this._e|0},s.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=s},function(t,e,n){var r=n(3),i=n(62),o=n(4).Buffer,v=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function s(){this.init(),this._w=a,i.call(this,64,56)}r(s,i),s.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},s.prototype._update=function(t){for(var e,n,r,i,o,a,s,u=this._w,c=0|this._a,l=0|this._b,f=0|this._c,h=0|this._d,p=0|this._e,d=0;d<16;++d)u[d]=t.readInt32BE(4*d);for(;d<80;++d)u[d]=(e=u[d-3]^u[d-8]^u[d-14]^u[d-16])<<1|e>>>31;for(var m=0;m<80;++m){var g=~~(m/20),y=0|((s=c)<<5|s>>>27)+(i=l,o=f,a=h,0===(r=g)?i&o|~i&a:2===r?i&o|i&a|o&a:i^o^a)+p+u[m]+v[g];p=h,h=f,f=(n=l)<<30|n>>>2,l=c,c=y}this._a=c+this._a|0,this._b=l+this._b|0,this._c=f+this._c|0,this._d=h+this._d|0,this._e=p+this._e|0},s.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=s},function(t,e,n){var r=n(3),i=n(197),o=n(62),a=n(4).Buffer,s=new Array(64);function u(){this.init(),this._w=s,o.call(this,64,56)}r(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var t=a.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=u},function(t,e,n){var r=n(3),i=n(198),o=n(62),a=n(4).Buffer,s=new Array(160);function u(){this.init(),this._w=s,o.call(this,128,112)}r(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var r=a.allocUnsafe(48);function t(t,e,n){r.writeInt32BE(t,n),r.writeInt32BE(e,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),r},t.exports=u},function(t,e,n){"use strict";var r=n(3),o=n(4).Buffer,a=n(43),s=o.alloc(128);function i(t,e){a.call(this,"digest"),"string"==typeof e&&(e=o.from(e)),this._alg=t,64<(this._key=e).length?e=t(e):e.length<64&&(e=o.concat([e,s],64));for(var n=this._ipad=o.allocUnsafe(64),r=this._opad=o.allocUnsafe(64),i=0;i<64;i++)n[i]=54^e[i],r[i]=92^e[i];this._hash=[n]}r(i,a),i.prototype._update=function(t){this._hash.push(t)},i.prototype._final=function(){var t=this._alg(o.concat(this._hash));return this._alg(o.concat([this._opad,t]))},t.exports=i},function(t,e,n){t.exports=n(201)},function(e,t,n){(function(u,c){var l,t=n(203),f=n(204),h=n(205),p=n(4).Buffer,d=u.crypto&&u.crypto.subtle,m={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},g=[];function y(t,e,n,r,i){return d.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then(function(t){return d.deriveBits({name:"PBKDF2",salt:e,iterations:n,hash:{name:i}},t,r<<3)}).then(function(t){return p.from(t)})}e.exports=function(e,n,r,i,o,a){"function"==typeof o&&(a=o,o=void 0);var s=m[(o=o||"sha1").toLowerCase()];if(!s||"function"!=typeof u.Promise)return c.nextTick(function(){var t;try{t=h(e,n,r,i,o)}catch(t){return a(t)}a(null,t)});if(t(e,n,r,i),"function"!=typeof a)throw new Error("No callback provided to pbkdf2");p.isBuffer(e)||(e=p.from(e,f)),p.isBuffer(n)||(n=p.from(n,f)),function(t,e){t.then(function(t){c.nextTick(function(){e(null,t)})},function(t){c.nextTick(function(){e(t)})})}(function(t){if(u.process&&!u.process.browser)return Promise.resolve(!1);if(!d||!d.importKey||!d.deriveBits)return Promise.resolve(!1);if(void 0!==g[t])return g[t];var e=y(l=l||p.alloc(8),l,10,128,t).then(function(){return!0}).catch(function(){return!1});return g[t]=e}(s).then(function(t){return t?y(e,n,r,i,s):h(e,n,r,i,o)}),a)}}).call(this,n(15),n(35))},function(t,e,n){var r=n(465),i=n(142),o=n(143),a=n(480),s=n(93);function u(t,e,n){if(t=t.toLowerCase(),o[t])return i.createCipheriv(t,e,n);if(a[t])return new r({key:e,iv:n,mode:t});throw new TypeError("invalid suite type")}function c(t,e,n){if(t=t.toLowerCase(),o[t])return i.createDecipheriv(t,e,n);if(a[t])return new r({key:e,iv:n,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}e.createCipher=e.Cipher=function(t,e){var n,r;if(t=t.toLowerCase(),o[t])n=o[t].key,r=o[t].iv;else{if(!a[t])throw new TypeError("invalid suite type");n=8*a[t].key,r=a[t].iv}var i=s(e,!1,n,r);return u(t,i.key,i.iv)},e.createCipheriv=e.Cipheriv=u,e.createDecipher=e.Decipher=function(t,e){var n,r;if(t=t.toLowerCase(),o[t])n=o[t].key,r=o[t].iv;else{if(!a[t])throw new TypeError("invalid suite type");n=8*a[t].key,r=a[t].iv}var i=s(e,!1,n,r);return c(t,i.key,i.iv)},e.createDecipheriv=e.Decipheriv=c,e.listCiphers=e.getCiphers=function(){return Object.keys(a).concat(i.getCiphers())}},function(t,e,n){var a=n(43),r=n(141),i=n(3),s=n(4).Buffer,u={"des-ede3-cbc":r.CBC.instantiate(r.EDE),"des-ede3":r.EDE,"des-ede-cbc":r.CBC.instantiate(r.EDE),"des-ede":r.EDE,"des-cbc":r.CBC.instantiate(r.DES),"des-ecb":r.DES};function o(t){a.call(this);var e,n=t.mode.toLowerCase(),r=u[n];e=t.decrypt?"decrypt":"encrypt";var i=t.key;s.isBuffer(i)||(i=s.from(i)),"des-ede"!==n&&"des-ede-cbc"!==n||(i=s.concat([i,i.slice(0,8)]));var o=t.iv;s.isBuffer(o)||(o=s.from(o)),this._des=r.create({key:i,iv:o,type:e})}u.des=u["des-cbc"],u.des3=u["des-ede3-cbc"],i(t.exports=o,a),o.prototype._update=function(t){return s.from(this._des.update(t))},o.prototype._final=function(){return s.from(this._des.final())}},function(t,e,n){"use strict";e.readUInt32BE=function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},e.writeUInt32BE=function(t,e,n){t[0+n]=e>>>24,t[1+n]=e>>>16&255,t[2+n]=e>>>8&255,t[3+n]=255&e},e.ip=function(t,e,n,r){for(var i=0,o=0,a=6;0<=a;a-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=e>>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=t>>>s+a&1}for(a=6;0<=a;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1}n[r+0]=i>>>0,n[r+1]=o>>>0},e.rip=function(t,e,n,r){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;0<=s;s-=8)i<<=1,i|=e>>>s+a&1,i<<=1,i|=t>>>s+a&1;for(a=4;a<8;a++)for(s=24;0<=s;s-=8)o<<=1,o|=e>>>s+a&1,o<<=1,o|=t>>>s+a&1;n[r+0]=i>>>0,n[r+1]=o>>>0},e.pc1=function(t,e,n,r){for(var i=0,o=0,a=7;5<=a;a--){for(var s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;n[r+0]=i>>>0,n[r+1]=o>>>0},e.r28shl=function(t,e){return t<<e&268435455|t>>>28-e};var u=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(t,e,n,r){for(var i=0,o=0,a=u.length>>>1,s=0;s<a;s++)i<<=1,i|=t>>>u[s]&1;for(s=a;s<u.length;s++)o<<=1,o|=e>>>u[s]&1;n[r+0]=i>>>0,n[r+1]=o>>>0},e.expand=function(t,e,n){var r=0,i=0;r=(1&t)<<5|t>>>27;for(var o=23;15<=o;o-=4)r<<=6,r|=t>>>o&63;for(o=11;3<=o;o-=4)i|=t>>>o&63,i<<=6;i|=(31&t)<<1|t>>>31,e[n+0]=r>>>0,e[n+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(t,e){for(var n=0,r=0;r<4;r++){n<<=4,n|=i[64*r+(t>>>18-6*r&63)]}for(r=0;r<4;r++){n<<=4,n|=i[256+64*r+(e>>>18-6*r&63)]}return n>>>0};var r=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(t){for(var e=0,n=0;n<r.length;n++)e<<=1,e|=t>>>r[n]&1;return e>>>0},e.padSplit=function(t,e,n){for(var r=t.toString(2);r.length<e;)r="0"+r;for(var i=[],o=0;o<e;o+=n)i.push(r.slice(o,o+n));return i.join(" ")}},function(t,e,n){"use strict";var r=n(25);function i(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}(t.exports=i).prototype._init=function(){},i.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},i.prototype._buffer=function(t,e){for(var n=Math.min(this.buffer.length-this.bufferOff,t.length-e),r=0;r<n;r++)this.buffer[this.bufferOff+r]=t[e+r];return this.bufferOff+=n,n},i.prototype._flushBuffer=function(t,e){return this._update(this.buffer,0,t,e),this.bufferOff=0,this.blockSize},i.prototype._updateEncrypt=function(t){var e=0,n=0,r=(this.bufferOff+t.length)/this.blockSize|0,i=new Array(r*this.blockSize);0!==this.bufferOff&&(e+=this._buffer(t,e),this.bufferOff===this.buffer.length&&(n+=this._flushBuffer(i,n)));for(var o=t.length-(t.length-e)%this.blockSize;e<o;e+=this.blockSize)this._update(t,e,i,n),n+=this.blockSize;for(;e<t.length;e++,this.bufferOff++)this.buffer[this.bufferOff]=t[e];return i},i.prototype._updateDecrypt=function(t){for(var e=0,n=0,r=Math.ceil((this.bufferOff+t.length)/this.blockSize)-1,i=new Array(r*this.blockSize);0<r;r--)e+=this._buffer(t,e),n+=this._flushBuffer(i,n);return e+=this._buffer(t,e),i},i.prototype.final=function(t){var e,n;return t&&(e=this.update(t)),n="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(n):n},i.prototype._pad=function(t,e){if(0===e)return!1;for(;e<t.length;)t[e++]=0;return!0},i.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var t=new Array(this.blockSize);return this._update(this.buffer,0,t,0),t},i.prototype._unpad=function(t){return t},i.prototype._finalDecrypt=function(){r.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var t=new Array(this.blockSize);return this._flushBuffer(t,0),this._unpad(t)}},function(t,e,n){"use strict";var a=n(25),r=n(3),i=n(141),h=i.utils,o=i.Cipher;function s(){this.tmp=new Array(2),this.keys=null}function u(t){o.call(this,t);var e=new s;this._desState=e,this.deriveKeys(e,t.key)}r(u,o),(t.exports=u).create=function(t){return new u(t)};var c=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];u.prototype.deriveKeys=function(t,e){t.keys=new Array(32),a.equal(e.length,this.blockSize,"Invalid key length");var n=h.readUInt32BE(e,0),r=h.readUInt32BE(e,4);h.pc1(n,r,t.tmp,0),n=t.tmp[0],r=t.tmp[1];for(var i=0;i<t.keys.length;i+=2){var o=c[i>>>1];n=h.r28shl(n,o),r=h.r28shl(r,o),h.pc2(n,r,t.keys,i)}},u.prototype._update=function(t,e,n,r){var i=this._desState,o=h.readUInt32BE(t,e),a=h.readUInt32BE(t,e+4);h.ip(o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,a,i.tmp,0):this._decrypt(i,o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],h.writeUInt32BE(n,o,r),h.writeUInt32BE(n,a,r+4)},u.prototype._pad=function(t,e){for(var n=t.length-e,r=e;r<t.length;r++)t[r]=n;return!0},u.prototype._unpad=function(t){for(var e=t[t.length-1],n=t.length-e;n<t.length;n++)a.equal(t[n],e);return t.slice(0,t.length-e)},u.prototype._encrypt=function(t,e,n,r,i){for(var o=e,a=n,s=0;s<t.keys.length;s+=2){var u=t.keys[s],c=t.keys[s+1];h.expand(a,t.tmp,0),u^=t.tmp[0],c^=t.tmp[1];var l=h.substitute(u,c),f=a;a=(o^h.permute(l))>>>0,o=f}h.rip(a,o,r,i)},u.prototype._decrypt=function(t,e,n,r,i){for(var o=n,a=e,s=t.keys.length-2;0<=s;s-=2){var u=t.keys[s],c=t.keys[s+1];h.expand(o,t.tmp,0),u^=t.tmp[0],c^=t.tmp[1];var l=h.substitute(u,c),f=o;o=(a^h.permute(l))>>>0,a=f}h.rip(o,a,r,i)}},function(t,e,n){"use strict";var r=n(25),o=n(3),a={};function i(t){r.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e<this.iv.length;e++)this.iv[e]=t[e]}e.instantiate=function(e){function n(t){e.call(this,t),this._cbcInit()}o(n,e);for(var t=Object.keys(a),r=0;r<t.length;r++){var i=t[r];n.prototype[i]=a[i]}return n.create=function(t){return new n(t)},n},a._cbcInit=function(){var t=new i(this.options.iv);this._cbcState=t},a._update=function(t,e,n,r){var i=this._cbcState,o=this.constructor.super_.prototype,a=i.iv;if("encrypt"===this.type){for(var s=0;s<this.blockSize;s++)a[s]^=t[e+s];o._update.call(this,a,0,n,r);for(s=0;s<this.blockSize;s++)a[s]=n[r+s]}else{o._update.call(this,t,e,n,r);for(s=0;s<this.blockSize;s++)n[r+s]^=a[s];for(s=0;s<this.blockSize;s++)a[s]=t[e+s]}}},function(t,e,n){"use strict";var o=n(25),r=n(3),i=n(141),a=i.Cipher,s=i.DES;function u(t,e){o.equal(e.length,24,"Invalid key length");var n=e.slice(0,8),r=e.slice(8,16),i=e.slice(16,24);this.ciphers="encrypt"===t?[s.create({type:"encrypt",key:n}),s.create({type:"decrypt",key:r}),s.create({type:"encrypt",key:i})]:[s.create({type:"decrypt",key:i}),s.create({type:"encrypt",key:r}),s.create({type:"decrypt",key:n})]}function c(t){a.call(this,t);var e=new u(this.type,this.options.key);this._edeState=e}r(c,a),(t.exports=c).create=function(t){return new c(t)},c.prototype._update=function(t,e,n,r){var i=this._edeState;i.ciphers[0]._update(t,e,n,r),i.ciphers[1]._update(n,r,n,r),i.ciphers[2]._update(n,r,n,r)},c.prototype._pad=s.prototype._pad,c.prototype._unpad=s.prototype._unpad},function(t,e,n){var i=n(143),o=n(209),a=n(4).Buffer,s=n(210),r=n(43),u=n(92),c=n(93);function l(t,e,n){r.call(this),this._cache=new h,this._cipher=new u.AES(e),this._prev=a.from(n),this._mode=t,this._autopadding=!0}n(3)(l,r),l.prototype._update=function(t){var e,n;this._cache.add(t);for(var r=[];e=this._cache.get();)n=this._mode.encrypt(this,e),r.push(n);return a.concat(r)};var f=a.alloc(16,16);function h(){this.cache=a.allocUnsafe(0)}function p(t,e,n){var r=i[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=a.from(e)),e.length!==r.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof n&&(n=a.from(n)),"GCM"!==r.mode&&n.length!==r.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===r.type?new s(r.module,e,n):"auth"===r.type?new o(r.module,e,n):new l(r.module,e,n)}l.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(f))throw this._cipher.scrub(),new Error("data not multiple of block length")},l.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},h.prototype.add=function(t){this.cache=a.concat([this.cache,t])},h.prototype.get=function(){if(15<this.cache.length){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},h.prototype.flush=function(){for(var t=16-this.cache.length,e=a.allocUnsafe(t),n=-1;++n<t;)e.writeUInt8(t,n);return a.concat([this.cache,e])},e.createCipheriv=p,e.createCipher=function(t,e){var n=i[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var r=c(e,!1,n.key,n.iv);return p(t,r.key,r.iv)}},function(t,e){e.encrypt=function(t,e){return t._cipher.encryptBlock(e)},e.decrypt=function(t,e){return t._cipher.decryptBlock(e)}},function(t,e,n){var i=n(71);e.encrypt=function(t,e){var n=i(e,t._prev);return t._prev=t._cipher.encryptBlock(n),t._prev},e.decrypt=function(t,e){var n=t._prev;t._prev=e;var r=t._cipher.decryptBlock(e);return i(r,n)}},function(t,e,n){var o=n(4).Buffer,a=n(71);function s(t,e,n){var r=e.length,i=a(e,t._cache);return t._cache=t._cache.slice(r),t._prev=o.concat([t._prev,n?e:i]),i}e.encrypt=function(t,e,n){for(var r,i=o.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=o.allocUnsafe(0)),!(t._cache.length<=e.length)){i=o.concat([i,s(t,e,n)]);break}r=t._cache.length,i=o.concat([i,s(t,e.slice(0,r),n)]),e=e.slice(r)}return i}},function(t,e,n){var l=n(4).Buffer;e.encrypt=function(t,e,n){for(var r,i,o,a,s=e.length,u=l.allocUnsafe(s),c=-1;++c<s;)u[c]=(r=t,i=e[c],o=n,void 0,a=r._cipher.encryptBlock(r._prev)[0]^i,r._prev=l.concat([r._prev.slice(1),l.from([o?i:a])]),a);return u}},function(t,e,n){var a=n(4).Buffer;function s(t,e,n){for(var r,i,o=-1,a=0;++o<8;)r=e&1<<7-o?128:0,a+=(128&(i=t._cipher.encryptBlock(t._prev)[0]^r))>>o%8,t._prev=u(t._prev,n?r:i);return a}function u(t,e){var n=t.length,r=-1,i=a.allocUnsafe(t.length);for(t=a.concat([t,a.from([e])]);++r<n;)i[r]=t[r]<<1|t[r+1]>>7;return i}e.encrypt=function(t,e,n){for(var r=e.length,i=a.allocUnsafe(r),o=-1;++o<r;)i[o]=s(t,e[o],n);return i}},function(t,e,n){(function(i){var o=n(71);e.encrypt=function(t,e){for(;t._cache.length<e.length;)t._cache=i.concat([t._cache,(n=t,n._prev=n._cipher.encryptBlock(n._prev),n._prev)]);var n,r=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),o(e,r)}}).call(this,n(14).Buffer)},function(t,e,n){var r=n(4).Buffer,i=r.alloc(16,0);function o(t){var e=r.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function a(t){this.h=t,this.state=r.alloc(16,0),this.cache=r.allocUnsafe(0)}a.prototype.ghash=function(t){for(var e=-1;++e<t.length;)this.state[e]^=t[e];this._multiply()},a.prototype._multiply=function(){for(var t,e,n=function(t){return[t.readUInt32BE(0),t.readUInt32BE(4),t.readUInt32BE(8),t.readUInt32BE(12)]}(this.h),r=[0,0,0,0],i=-1;++i<128;){for(0!=(this.state[~~(i/8)]&1<<7-i%8)&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),e=0!=(1&n[3]),t=3;0<t;t--)n[t]=n[t]>>>1|(1&n[t-1])<<31;n[0]=n[0]>>>1,e&&(n[0]=n[0]^225<<24)}this.state=o(r)},a.prototype.update=function(t){var e;for(this.cache=r.concat([this.cache,t]);16<=this.cache.length;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},a.prototype.final=function(t,e){return this.cache.length&&this.ghash(r.concat([this.cache,i],16)),this.ghash(o([0,t,0,e])),this.state},t.exports=a},function(t,e,n){var i=n(209),o=n(4).Buffer,a=n(143),s=n(210),r=n(43),u=n(92),c=n(93);function l(t,e,n){r.call(this),this._cache=new f,this._last=void 0,this._cipher=new u.AES(e),this._prev=o.from(n),this._mode=t,this._autopadding=!0}function f(){this.cache=o.allocUnsafe(0)}function h(t,e,n){var r=a[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");if("string"==typeof n&&(n=o.from(n)),"GCM"!==r.mode&&n.length!==r.iv)throw new TypeError("invalid iv length "+n.length);if("string"==typeof e&&(e=o.from(e)),e.length!==r.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===r.type?new s(r.module,e,n,!0):"auth"===r.type?new i(r.module,e,n,!0):new l(r.module,e,n)}n(3)(l,r),l.prototype._update=function(t){var e,n;this._cache.add(t);for(var r=[];e=this._cache.get(this._autopadding);)n=this._mode.decrypt(this,e),r.push(n);return o.concat(r)},l.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||16<e)throw new Error("unable to decrypt data");var n=-1;for(;++n<e;)if(t[n+(16-e)]!==e)throw new Error("unable to decrypt data");if(16===e)return;return t.slice(0,16-e)}(this._mode.decrypt(this,t));if(t)throw new Error("data not multiple of block length")},l.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},f.prototype.add=function(t){this.cache=o.concat([this.cache,t])},f.prototype.get=function(t){var e;if(t){if(16<this.cache.length)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(16<=this.cache.length)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},f.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=function(t,e){var n=a[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var r=c(e,!1,n.key,n.iv);return h(t,r.key,r.iv)},e.createDecipheriv=h},function(t,e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}},function(t,e,n){(function(o){var a=n(211),r=n(484),s=n(485);var u={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(t){var e=new o(r[t].prime,"hex"),n=new o(r[t].gen,"hex");return new s(e,n)},e.createDiffieHellman=e.DiffieHellman=function t(e,n,r,i){return o.isBuffer(n)||void 0===u[n]?t(e,"binary",n,r):(n=n||"binary",i=i||"binary",r=r||new o([2]),o.isBuffer(r)||(r=new o(r,i)),"number"==typeof e?new s(a(e,r),r,!0):(o.isBuffer(e)||(e=new o(e,n)),new s(e,r,!0)))}}).call(this,n(14).Buffer)},function(t,e){},function(t,e){},function(t){t.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},function(m,t,g){(function(o){var a=g(12),s=new(g(212)),u=new a(24),c=new a(11),l=new a(10),f=new a(3),h=new a(7),p=g(211),t=g(61);function r(t,e){return e=e||"utf8",o.isBuffer(t)||(t=new o(t,e)),this._pub=new a(t),this}function i(t,e){return e=e||"utf8",o.isBuffer(t)||(t=new o(t,e)),this._priv=new a(t),this}m.exports=e;var d={};function e(t,e,n){this.setGenerator(e),this.__prime=new a(t),this._prime=a.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,n?(this.setPublicKey=r,this.setPrivateKey=i):this._primeCode=8}function n(t,e){var n=new o(t.toArray());return e?n.toString(e):n}Object.defineProperty(e.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,e){var n=e.toString("hex"),r=[n,t.toString(16)].join("_");if(r in d)return d[r];var i,o=0;if(t.isEven()||!p.simpleSieve||!p.fermatTest(t)||!s.test(t))return o+=1,o+="02"===n||"05"===n?8:4,d[r]=o;switch(s.test(t.shrn(1))||(o+=2),n){case"02":t.mod(u).cmp(c)&&(o+=8);break;case"05":(i=t.mod(l)).cmp(f)&&i.cmp(h)&&(o+=8);break;default:o+=4}return d[r]=o}(this.__prime,this.__gen)),this._primeCode}}),e.prototype.generateKeys=function(){return this._priv||(this._priv=new a(t(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},e.prototype.computeSecret=function(t){var e=(t=(t=new a(t)).toRed(this._prime)).redPow(this._priv).fromRed(),n=new o(e.toArray()),r=this.getPrime();if(n.length<r.length){var i=new o(r.length-n.length);i.fill(0),n=o.concat([i,n])}return n},e.prototype.getPublicKey=function(t){return n(this._pub,t)},e.prototype.getPrivateKey=function(t){return n(this._priv,t)},e.prototype.getPrime=function(t){return n(this.__prime,t)},e.prototype.getGenerator=function(t){return n(this._gen,t)},e.prototype.setGenerator=function(t,e){return e=e||"utf8",o.isBuffer(t)||(t=new o(t,e)),this.__gen=t,this._gen=new a(t),this}}).call(this,g(14).Buffer)},function(f,t,h){(function(i){var n=h(69),r=h(134),t=h(3),o=h(487),a=h(523),s=h(201);function e(t){r.Writable.call(this);var e=s[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=n(e.hash),this._tag=e.id,this._signType=e.sign}function u(t){r.Writable.call(this);var e=s[t];if(!e)throw new Error("Unknown message digest");this._hash=n(e.hash),this._tag=e.id,this._signType=e.sign}function c(t){return new e(t)}function l(t){return new u(t)}Object.keys(s).forEach(function(t){s[t].id=new i(s[t].id,"hex"),s[t.toLowerCase()]=s[t]}),t(e,r.Writable),e.prototype._write=function(t,e,n){this._hash.update(t),n()},e.prototype.update=function(t,e){return"string"==typeof t&&(t=new i(t,e)),this._hash.update(t),this},e.prototype.sign=function(t,e){this.end();var n=this._hash.digest(),r=o(n,t,this._hashType,this._signType,this._tag);return e?r.toString(e):r},t(u,r.Writable),u.prototype._write=function(t,e,n){this._hash.update(t),n()},u.prototype.update=function(t,e){return"string"==typeof t&&(t=new i(t,e)),this._hash.update(t),this},u.prototype.verify=function(t,e,n){"string"==typeof e&&(e=new i(e,n)),this.end();var r=this._hash.digest();return a(e,r,t,this._signType,this._tag)},f.exports={Sign:c,Verify:l,createSign:c,createVerify:l}}).call(this,h(14).Buffer)},function(t,e,n){(function(m){var c=n(199),l=n(145),f=n(17).ec,g=n(12),h=n(95),p=n(222);function y(t,e,n,r){if((t=new m(t.toArray())).length<e.byteLength()){var i=new m(e.byteLength()-t.length);i.fill(0),t=m.concat([i,t])}var o=n.length,a=function(t,e){t=(t=v(t,e)).mod(e);var n=new m(t.toArray());if(n.length<e.byteLength()){var r=new m(e.byteLength()-n.length);r.fill(0),n=m.concat([r,n])}return n}(n,e),s=new m(o);s.fill(1);var u=new m(o);return u.fill(0),u=c(r,u).update(s).update(new m([0])).update(t).update(a).digest(),s=c(r,u).update(s).digest(),{k:u=c(r,u).update(s).update(new m([1])).update(t).update(a).digest(),v:s=c(r,u).update(s).digest()}}function v(t,e){var n=new g(t),r=(t.length<<3)-e.bitLength();return 0<r&&n.ishrn(r),n}function b(t,e,n){var r,i;do{for(r=new m(0);8*r.length<t.bitLength();)e.v=c(n,e.k).update(e.v).digest(),r=m.concat([r,e.v]);i=v(r,t),e.k=c(n,e.k).update(e.v).update(new m([0])).digest(),e.v=c(n,e.k).update(e.v).digest()}while(-1!==i.cmp(t));return i}t.exports=function(t,e,n,r,i){var o=h(e);if(o.curve){if("ecdsa"!==r&&"ecdsa/rsa"!==r)throw new Error("wrong private key type");return function(t,e){var n=p[e.curve.join(".")];if(!n)throw new Error("unknown curve "+e.curve.join("."));var r=new f(n).keyFromPrivate(e.privateKey).sign(t);return new m(r.toDER())}(t,o)}if("dsa"===o.type){if("dsa"!==r)throw new Error("wrong private key type");return function(t,e,n){for(var r,i,o,a,s=e.params.priv_key,u=e.params.p,c=e.params.q,l=e.params.g,f=new g(0),h=v(t,c).mod(c),p=!1,d=y(s,c,t,n);!1===p;)r=b(c,d,n),i=r,o=u,a=c,f=l.toRed(g.mont(o)).redPow(i).fromRed().mod(a),0===(p=r.invm(c).imul(h.add(s.mul(f))).mod(c)).cmpn(0)&&(p=!1,f=new g(0));return function(t,e){t=t.toArray(),e=e.toArray(),128&t[0]&&(t=[0].concat(t)),128&e[0]&&(e=[0].concat(e));var n=[48,t.length+e.length+4,2,t.length];return n=n.concat(t,[2,e.length],e),new m(n)}(f,p)}(t,o,n)}if("rsa"!==r&&"ecdsa/rsa"!==r)throw new Error("wrong private key type");t=m.concat([i,t]);for(var a=o.modulus.byteLength(),s=[0,1];t.length+s.length+1<a;)s.push(255);s.push(0);for(var u=-1;++u<t.length;)s.push(t[u]);return l(s,o)},t.exports.getKey=y,t.exports.makeKey=b}).call(this,n(14).Buffer)},function(t){t.exports={_args:[["elliptic@6.4.1","/Users/charlie/Projects/personal-projects-github/tfjs-recycling"]],_development:!0,_from:"elliptic@6.4.1",_id:"elliptic@6.4.1",_inBundle:!1,_integrity:"sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==",_location:"/elliptic",_phantomChildren:{},_requested:{type:"version",registry:!0,raw:"elliptic@6.4.1",name:"elliptic",escapedName:"elliptic",rawSpec:"6.4.1",saveSpec:null,fetchSpec:"6.4.1"},_requiredBy:["/browserify-sign","/create-ecdh"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz",_spec:"6.4.1",_where:"/Users/charlie/Projects/personal-projects-github/tfjs-recycling",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},description:"EC cryptography",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.4.1"}},function(t,e,n){"use strict";var r=e,i=n(12),o=n(25),a=n(214);r.assert=o,r.toArray=a.toArray,r.zero2=a.zero2,r.toHex=a.toHex,r.encode=a.encode,r.getNAF=function(t,e){for(var n=[],r=1<<e+1,i=t.clone();0<=i.cmpn(1);){var o;if(i.isOdd()){var a=i.andln(r-1);o=(r>>1)-1<a?(r>>1)-a:a,i.isubn(o)}else o=0;n.push(o);for(var s=0!==i.cmpn(0)&&0===i.andln(r-1)?e+1:1,u=1;u<s;u++)n.push(0);i.iushrn(s)}return n},r.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r=0,i=0;0<t.cmpn(-r)||0<e.cmpn(-i);){var o,a,s,u=t.andln(3)+r&3,c=e.andln(3)+i&3;3===u&&(u=-1),3===c&&(c=-1),o=0==(1&u)?0:3!=(s=t.andln(7)+r&7)&&5!==s||2!==c?u:-u,n[0].push(o),a=0==(1&c)?0:3!=(s=e.andln(7)+i&7)&&5!==s||2!==u?c:-c,n[1].push(a),2*r===o+1&&(r=1-r),2*i===a+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return n},r.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new i(t,"hex","le")}},function(t,e,n){"use strict";var r=n(12),i=n(17).utils,N=i.getNAF,I=i.getJSF,f=i.assert;function o(t,e){this.type=t,this.p=new r(e.p,16),this.red=e.prime?r.red(e.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=e.n&&new r(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var n=this.n&&this.p.div(this.n);!n||0<n.cmpn(100)?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function a(t,e){this.curve=t,this.type=e,this.precomputed=null}(t.exports=o).prototype.point=function(){throw new Error("Not implemented")},o.prototype.validate=function(){throw new Error("Not implemented")},o.prototype._fixedNafMul=function(t,e){f(t.precomputed);var n=t._getDoubles(),r=N(e,1),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;for(var o=[],a=0;a<r.length;a+=n.step){var s=0;for(e=a+n.step-1;a<=e;e--)s=(s<<1)+r[e];o.push(s)}for(var u=this.jpoint(null,null,null),c=this.jpoint(null,null,null),l=i;0<l;l--){for(a=0;a<o.length;a++){(s=o[a])===l?c=c.mixedAdd(n.points[a]):s===-l&&(c=c.mixedAdd(n.points[a].neg()))}u=u.add(c)}return u.toP()},o.prototype._wnafMul=function(t,e){var n=4,r=t._getNAFPoints(n);n=r.wnd;for(var i=r.points,o=N(e,n),a=this.jpoint(null,null,null),s=o.length-1;0<=s;s--){for(e=0;0<=s&&0===o[s];s--)e++;if(0<=s&&e++,a=a.dblp(e),s<0)break;var u=o[s];f(0!==u),a="affine"===t.type?0<u?a.mixedAdd(i[u-1>>1]):a.mixedAdd(i[-u-1>>1].neg()):0<u?a.add(i[u-1>>1]):a.add(i[-u-1>>1].neg())}return"affine"===t.type?a.toP():a},o.prototype._wnafMulAdd=function(t,e,n,r,i){for(var o=this._wnafT1,a=this._wnafT2,s=this._wnafT3,u=0,c=0;c<r;c++){var l=(E=e[c])._getNAFPoints(t);o[c]=l.wnd,a[c]=l.points}for(c=r-1;1<=c;c-=2){var f=c-1,h=c;if(1===o[f]&&1===o[h]){var p=[e[f],null,null,e[h]];0===e[f].y.cmp(e[h].y)?(p[1]=e[f].add(e[h]),p[2]=e[f].toJ().mixedAdd(e[h].neg())):0===e[f].y.cmp(e[h].y.redNeg())?(p[1]=e[f].toJ().mixedAdd(e[h]),p[2]=e[f].add(e[h].neg())):(p[1]=e[f].toJ().mixedAdd(e[h]),p[2]=e[f].toJ().mixedAdd(e[h].neg()));var d=[-3,-1,-5,-7,0,7,5,1,3],m=I(n[f],n[h]);u=Math.max(m[0].length,u),s[f]=new Array(u),s[h]=new Array(u);for(var g=0;g<u;g++){var y=0|m[0][g],v=0|m[1][g];s[f][g]=d[3*(1+y)+(1+v)],s[h][g]=0,a[f]=p}}else s[f]=N(n[f],o[f]),s[h]=N(n[h],o[h]),u=Math.max(s[f].length,u),u=Math.max(s[h].length,u)}var b=this.jpoint(null,null,null),w=this._wnafT4;for(c=u;0<=c;c--){for(var _=0;0<=c;){var x=!0;for(g=0;g<r;g++)w[g]=0|s[g][c],0!==w[g]&&(x=!1);if(!x)break;_++,c--}if(0<=c&&_++,b=b.dblp(_),c<0)break;for(g=0;g<r;g++){var E,S=w[g];0!==S&&(0<S?E=a[g][S-1>>1]:S<0&&(E=a[g][-S-1>>1].neg()),b="affine"===E.type?b.mixedAdd(E):b.add(E))}}for(c=0;c<r;c++)a[c]=null;return i?b:b.toP()},(o.BasePoint=a).prototype.eq=function(){throw new Error("Not implemented")},a.prototype.validate=function(){return this.curve.validate(this)},o.prototype.decodePoint=function(t,e){t=i.toArray(t,e);var n=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*n)return 6===t[0]?f(t[t.length-1]%2==0):7===t[0]&&f(t[t.length-1]%2==1),this.point(t.slice(1,1+n),t.slice(1+n,1+2*n));if((2===t[0]||3===t[0])&&t.length-1===n)return this.pointFromX(t.slice(1,1+n),3===t[0]);throw new Error("Unknown point format")},a.prototype.encodeCompressed=function(t){return this.encode(t,!0)},a.prototype._encode=function(t){var e=this.curve.p.byteLength(),n=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",e))},a.prototype.encode=function(t,e){return i.encode(this._encode(e),t)},a.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},a.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},a.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)r=r.dbl();n.push(r)}return{step:t,points:n}},a.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],n=(1<<t)-1,r=1==n?null:this.dbl(),i=1;i<n;i++)e[i]=e[i-1].add(r);return{wnd:t,points:e}},a.prototype._getBeta=function(){return null},a.prototype.dblp=function(t){for(var e=this,n=0;n<t;n++)e=e.dbl();return e}},function(t,e,n){"use strict";var r=n(94),i=n(17),_=n(12),o=n(3),a=r.base,s=i.utils.assert;function u(t){a.call(this,"short",t),this.a=new _(t.a,16).toRed(this.red),this.b=new _(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(t,e,n,r){a.BasePoint.call(this,t,"affine"),null===e&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new _(e,16),this.y=new _(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function l(t,e,n,r){a.BasePoint.call(this,t,"jacobian"),null===e&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new _(0)):(this.x=new _(e,16),this.y=new _(n,16),this.z=new _(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,a),(t.exports=u).prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,n;if(t.beta)e=new _(t.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);e=(e=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(t.lambda)n=new _(t.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?n=i[0]:(n=i[1],s(0===this.g.mul(n).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:n,basis:t.basis?t.basis.map(function(t){return{a:new _(t.a,16),b:new _(t.b,16)}}):this._getEndoBasis(n)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:_.mont(t),n=new _(2).toRed(e).redInvm(),r=n.redNeg(),i=new _(3).toRed(e).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,n,r,i,o,a,s,u,c,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=t,h=this.n.clone(),p=new _(1),d=new _(0),m=new _(0),g=new _(1),y=0;0!==f.cmpn(0);){var v=h.div(f);u=h.sub(v.mul(f)),c=m.sub(v.mul(p));var b=g.sub(v.mul(d));if(!r&&u.cmp(l)<0)e=s.neg(),n=p,r=u.neg(),i=c;else if(r&&2==++y)break;h=f,f=s=u,m=p,p=c,g=d,d=b}o=u.neg(),a=c;var w=r.sqr().add(i.sqr());return 0<=o.sqr().add(a.sqr()).cmp(w)&&(o=e,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},u.prototype.pointFromX=function(t,e){(t=new _(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(e&&!i||!e&&i)&&(r=r.redNeg()),this.point(t,r)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var a=this._endoSplit(e[o]),s=t[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),r[2*o]=s,r[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var c=this._wnafMulAdd(1,r,i,2*o,n),l=0;l<2*o;l++)r[l]=null,i[l]=null;return c},o(c,a.BasePoint),u.prototype.point=function(t,e,n){return new c(this,t,e,n)},u.prototype.pointFromJSON=function(t,e){return c.fromJSON(this,t,e)},c.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var n=this.curve,r=function(t){return n.point(t.x.redMul(n.endo.beta),t.y)};(t.beta=e).precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(r)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(r)}}}return e}},c.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},c.fromJSON=function(e,t,n){"string"==typeof t&&(t=JSON.parse(t));var r=e.point(t[0],t[1],n);if(!t[2])return r;function i(t){return e.point(t[0],t[1],n)}var o=t[2];return r.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[r].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[r].concat(o.naf.points.map(i))}},r},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},c.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(t){return t=new _(t,16),this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},c.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},c.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},c.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(l,a.BasePoint),u.prototype.jpoint=function(t,e,n){return new l(this,t,e,n)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),f=r.redMul(c),h=u.redSqr().redIAdd(l).redISub(f).redISub(f),p=u.redMul(f.redISub(h)).redISub(o.redMul(l)),d=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(h,p,d)},l.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),f=s.redSqr().redIAdd(c).redISub(l).redISub(l),h=s.redMul(l.redISub(f)).redISub(i.redMul(c)),p=this.z.redMul(a);return this.curve.jpoint(f,h,p)},l.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,n=0;n<t;n++)e=e.dbl();return e}var r=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),c=a.redAdd(a);for(n=0;n<t;n++){var l=o.redSqr(),f=c.redSqr(),h=f.redSqr(),p=l.redAdd(l).redIAdd(l).redIAdd(r.redMul(u)),d=o.redMul(f),m=p.redSqr().redISub(d.redAdd(d)),g=d.redISub(m),y=p.redMul(g);y=y.redIAdd(y).redISub(h);var v=c.redMul(s);n+1<t&&(u=u.redMul(h)),o=m,s=v,c=y}return this.curve.jpoint(o,c.redMul(i),s)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},l.prototype._zeroDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r),u=s.redSqr().redISub(a).redISub(a),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=u,e=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),f=this.y.redSqr(),h=f.redSqr(),p=this.x.redAdd(f).redSqr().redISub(l).redISub(h);p=p.redIAdd(p);var d=l.redAdd(l).redIAdd(l),m=d.redSqr(),g=h.redIAdd(h);g=(g=g.redIAdd(g)).redIAdd(g),t=m.redISub(p).redISub(p),e=d.redMul(p.redISub(t)).redISub(g),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(t,e,n)},l.prototype._threeDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);t=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),f=this.y.redSqr(),h=this.x.redMul(f),p=this.x.redSub(l).redMul(this.x.redAdd(l));p=p.redAdd(p).redIAdd(p);var d=h.redIAdd(h),m=(d=d.redIAdd(d)).redAdd(d);t=p.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(f).redISub(l);var g=f.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=p.redMul(d.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,n)},l.prototype._dbl=function(){var t=this.curve.a,e=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=e.redSqr(),a=n.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=e.redAdd(e),c=(u=u.redIAdd(u)).redMul(a),l=s.redSqr().redISub(c.redAdd(c)),f=c.redISub(l),h=a.redSqr();h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var p=s.redMul(f).redISub(h),d=n.redAdd(n).redMul(r);return this.curve.jpoint(l,p,d)},l.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr(),r=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),a=this.x.redAdd(e).redSqr().redISub(t).redISub(r),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=r.redIAdd(r);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),l=e.redMul(c);l=(l=l.redIAdd(l)).redIAdd(l);var f=this.x.redMul(s).redISub(l);f=(f=f.redIAdd(f)).redIAdd(f);var h=this.y.redMul(c.redMul(u.redISub(c)).redISub(a.redMul(s)));h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var p=this.z.redAdd(a).redSqr().redISub(n).redISub(s);return this.curve.jpoint(f,h,p)},l.prototype.mul=function(t,e){return t=new _(t,e),this.curve._wnafMul(this,t)},l.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),n=t.z.redSqr();if(0!==this.x.redMul(n).redISub(t.x.redMul(e)).cmpn(0))return!1;var r=e.redMul(this.z),i=n.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(r)).cmpn(0)},l.prototype.eqXToP=function(t){var e=this.z.redSqr(),n=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(n))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(e);;){if(r.iadd(this.curve.n),0<=r.cmp(this.curve.p))return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},l.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},l.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(t,e,n){"use strict";var r=n(94),i=n(12),o=n(3),a=r.base,s=n(17).utils;function u(t){a.call(this,"mont",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(t,e,n){a.BasePoint.call(this,t,"projective"),null===e&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(e,16),this.z=new i(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(u,a),(t.exports=u).prototype.validate=function(t){var e=t.normalize().x,n=e.redSqr(),r=n.redMul(e).redAdd(n.redMul(this.a)).redAdd(e);return 0===r.redSqrt().redSqr().cmp(r)},o(c,a.BasePoint),u.prototype.decodePoint=function(t,e){return this.point(s.toArray(t,e),1)},u.prototype.point=function(t,e){return new c(this,t,e)},u.prototype.pointFromJSON=function(t){return c.fromJSON(this,t)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(t,e){return new c(t,e[0],e[1]||t.one)},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),n=t.redSub(e),r=t.redMul(e),i=n.redMul(e.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(t,e){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(n),a=i.redMul(r),s=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},c.prototype.mul=function(t){for(var e=t.clone(),n=this,r=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;0<=o;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(t,e,n){"use strict";var r=n(94),i=n(17),u=n(12),o=n(3),a=r.base,s=i.utils.assert;function c(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,a.call(this,"edwards",t),this.a=new u(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new u(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new u(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),s(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function l(t,e,n,r,i){a.BasePoint.call(this,t,"projective"),null===e&&null===n&&null===r?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new u(e,16),this.y=new u(n,16),this.z=r?new u(r,16):this.curve.one,this.t=i&&new u(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(c,a),(t.exports=c).prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},c.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},c.prototype.jpoint=function(t,e,n,r){return this.point(t,e,n,r)},c.prototype.pointFromX=function(t,e){(t=new u(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=r.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(e&&!s||!e&&s)&&(a=a.redNeg()),this.point(t,a)},c.prototype.pointFromY=function(t,e){(t=new u(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=n.redSub(this.c2),i=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=r.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},c.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),n=t.y.redSqr(),r=e.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(n)));return 0===r.cmp(i)},o(l,a.BasePoint),c.prototype.pointFromJSON=function(t){return l.fromJSON(this,t)},c.prototype.point=function(t,e,n,r){return new l(this,t,e,n,r)},l.fromJSON=function(t,e){return new l(t,e[0],e[1],e[2])},l.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},l.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},l.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=r.redAdd(e),a=o.redSub(n),s=r.redSub(e),u=i.redMul(a),c=o.redMul(s),l=i.redMul(s),f=a.redMul(o);return this.curve.point(u,c,f,l)},l.prototype._projDbl=function(){var t,e,n,r=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var a=(c=this.curve._mulA(i)).redAdd(o);if(this.zOne)t=r.redSub(i).redSub(o).redMul(a.redSub(this.curve.two)),e=a.redMul(c.redSub(o)),n=a.redSqr().redSub(a).redSub(a);else{var s=this.z.redSqr(),u=a.redSub(s).redISub(s);t=r.redSub(i).redISub(o).redMul(u),e=a.redMul(c.redSub(o)),n=a.redMul(u)}}else{var c=i.redAdd(o);s=this.curve._mulC(this.z).redSqr(),u=c.redSub(s).redSub(s);t=this.curve._mulC(r.redISub(c)).redMul(u),e=this.curve._mulC(c).redMul(i.redISub(o)),n=c.redMul(u)}return this.curve.point(t,e,n)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},l.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),r=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=n.redSub(e),a=i.redSub(r),s=i.redAdd(r),u=n.redAdd(e),c=o.redMul(a),l=s.redMul(u),f=o.redMul(u),h=a.redMul(s);return this.curve.point(c,l,h,f)},l.prototype._projAdd=function(t){var e,n,r=this.z.redMul(t.z),i=r.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),c=i.redAdd(s),l=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),f=r.redMul(u).redMul(l);return n=this.curve.twisted?(e=r.redMul(c).redMul(a.redSub(this.curve._mulA(o))),u.redMul(c)):(e=r.redMul(c).redMul(a.redSub(o)),this.curve._mulC(u).redMul(c)),this.curve.point(f,e,n)},l.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},l.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},l.prototype.mulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!1)},l.prototype.jmulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!0)},l.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},l.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},l.prototype.getX=function(){return this.normalize(),this.x.fromRed()},l.prototype.getY=function(){return this.normalize(),this.y.fromRed()},l.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},l.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var n=t.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),0<=n.cmp(this.curve.p))return!1;if(e.redIAdd(r),0===this.x.cmp(e))return!0}},l.prototype.toP=l.prototype.normalize,l.prototype.mixedAdd=l.prototype.add},function(t,e,n){"use strict";var r,i=e,o=n(146),a=n(17),s=a.utils.assert;function u(t){"short"===t.type?this.curve=new a.curve.short(t):"edwards"===t.type?this.curve=new a.curve.edwards(t):this.curve=new a.curve.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,n){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var t=new u(n);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:t}),t}})}i.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=n(501)}catch(t){r=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})},function(t,e,n){"use strict";e.sha1=n(496),e.sha224=n(497),e.sha256=n(216),e.sha384=n(498),e.sha512=n(217)},function(t,e,n){"use strict";var r=n(36),i=n(72),o=n(215),f=r.rotl32,h=r.sum32,p=r.sum32_5,d=o.ft_1,a=i.BlockHash,m=[1518500249,1859775393,2400959708,3395469782];function s(){if(!(this instanceof s))return new s;a.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}r.inherits(s,a),(t.exports=s).blockSize=512,s.outSize=160,s.hmacStrength=80,s.padLength=64,s.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=f(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4];for(r=0;r<n.length;r++){var c=~~(r/20),l=p(f(i,5),d(c,o,a,s),u,n[r],m[c]);u=s,s=a,a=f(o,30),o=i,i=l}this.h[0]=h(this.h[0],i),this.h[1]=h(this.h[1],o),this.h[2]=h(this.h[2],a),this.h[3]=h(this.h[3],s),this.h[4]=h(this.h[4],u)},s.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"big"):r.split32(this.h,"big")}},function(t,e,n){"use strict";var r=n(36),i=n(216);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}r.inherits(o,i),(t.exports=o).blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h.slice(0,7),"big"):r.split32(this.h.slice(0,7),"big")}},function(t,e,n){"use strict";var r=n(36),i=n(217);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}r.inherits(o,i),(t.exports=o).blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h.slice(0,12),"big"):r.split32(this.h.slice(0,12),"big")}},function(t,e,n){"use strict";var r=n(36),i=n(72),d=r.rotl32,m=r.sum32,g=r.sum32_3,y=r.sum32_4,o=i.BlockHash;function a(){if(!(this instanceof a))return new a;o.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function v(t,e,n,r){return t<=15?e^n^r:t<=31?e&n|~e&r:t<=47?(e|~n)^r:t<=63?e&r|n&~r:e^(n|~r)}function b(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function w(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}r.inherits(a,o),(e.ripemd160=a).blockSize=512,a.outSize=160,a.hmacStrength=192,a.padLength=64,a.prototype._update=function(t,e){for(var n=this.h[0],r=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],s=n,u=r,c=i,l=o,f=a,h=0;h<80;h++){var p=m(d(y(n,v(h,r,i,o),t[_[h]+e],b(h)),E[h]),a);n=a,a=o,o=d(i,10),i=r,r=p,p=m(d(y(s,v(79-h,u,c,l),t[x[h]+e],w(h)),S[h]),f),s=f,f=l,l=d(c,10),c=u,u=p}p=g(this.h[1],i,l),this.h[1]=g(this.h[2],o,f),this.h[2]=g(this.h[3],a,s),this.h[3]=g(this.h[4],n,u),this.h[4]=g(this.h[0],r,c),this.h[0]=p},a.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"little"):r.split32(this.h,"little")};var _=[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],x=[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],E=[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],S=[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]},function(t,e,n){"use strict";var r=n(36),i=n(25);function o(t,e,n){if(!(this instanceof o))return new o(t,e,n);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(r.toArray(e,n))}(t.exports=o).prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},o.prototype.update=function(t,e){return this.inner.update(t,e),this},o.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},function(t,e){t.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(t,e,n){"use strict";var g=n(12),y=n(503),o=n(17),p=o.utils.assert,r=n(504),v=n(505);function i(t){if(!(this instanceof i))return new i(t);"string"==typeof t&&(p(o.curves.hasOwnProperty(t),"Unknown curve "+t),t=o.curves[t]),t instanceof o.curves.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}(t.exports=i).prototype.keyPair=function(t){return new r(this,t)},i.prototype.keyFromPrivate=function(t,e){return r.fromPrivate(this,t,e)},i.prototype.keyFromPublic=function(t,e){return r.fromPublic(this,t,e)},i.prototype.genKeyPair=function(t){t||(t={});for(var e=new y({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||o.rand(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new g(2));;){var i=new g(e.generate(n));if(!(0<i.cmp(r)))return i.iaddn(1),this.keyFromPrivate(i)}},i.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return 0<n&&(t=t.ushrn(n)),!e&&0<=t.cmp(this.n)?t.sub(this.n):t},i.prototype.sign=function(t,e,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new g(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),a=t.toArray("be",i),s=new y({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new g(1)),c=0;;c++){var l=r.k?r.k(c):new g(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||0<=l.cmp(u))){var f=this.g.mul(l);if(!f.isInfinity()){var h=f.getX(),p=h.umod(this.n);if(0!==p.cmpn(0)){var d=l.invm(this.n).mul(p.mul(e.getPrivate()).iadd(t));if(0!==(d=d.umod(this.n)).cmpn(0)){var m=(f.getY().isOdd()?1:0)|(0!==h.cmp(p)?2:0);return r.canonical&&0<d.cmp(this.nh)&&(d=this.n.sub(d),m^=1),new v({r:p,s:d,recoveryParam:m})}}}}}},i.prototype.verify=function(t,e,n,r){t=this._truncateToN(new g(t,16)),n=this.keyFromPublic(n,r);var i=(e=new v(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||0<=i.cmp(this.n))return!1;if(o.cmpn(1)<0||0<=o.cmp(this.n))return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),c=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),c)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(u,n.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},i.prototype.recoverPubKey=function(t,e,n,r){p((3&n)===n,"The recovery param is more than two bits"),e=new v(e,r);var i=this.n,o=new g(t),a=e.r,s=e.s,u=1&n,c=n>>1;if(0<=a.cmp(this.curve.p.umod(this.curve.n))&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var l=e.r.invm(i),f=i.sub(o).mul(l).umod(i),h=s.mul(l).umod(i);return this.g.mulAdd(f,a,h)},i.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new v(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")}},function(t,e,n){"use strict";var r=n(146),a=n(214),i=n(25);function o(t){if(!(this instanceof o))return new o(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=a.toArray(t.entropy,t.entropyEnc||"hex"),n=a.toArray(t.nonce,t.nonceEnc||"hex"),r=a.toArray(t.pers,t.persEnc||"hex");i(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}(t.exports=o).prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},o.prototype._hmac=function(){return new r.hmac(this.hash,this.K)},o.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},o.prototype.reseed=function(t,e,n,r){"string"!=typeof e&&(r=n,n=e,e=null),t=a.toArray(t,e),n=a.toArray(n,r),i(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},o.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=a.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<t;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,t);return this._update(n),this._reseed++,a.encode(o,e)}},function(t,e,n){"use strict";var r=n(12),i=n(17).utils.assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}(t.exports=o).fromPublic=function(t,e,n){return e instanceof o?e:new o(t,{pub:e,pubEnc:n})},o.fromPrivate=function(t,e,n){return e instanceof o?e:new o(t,{priv:e,privEnc:n})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new r(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.mul(this.priv).getX()},o.prototype.sign=function(t,e,n){return this.ec.sign(t,this,e,n)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},function(t,e,n){"use strict";var s=n(12),u=n(17).utils,r=u.assert;function i(t,e){if(t instanceof i)return t;this._importDER(t,e)||(r(t.r&&t.s,"Signature without r or s"),this.r=new s(t.r,16),this.s=new s(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function c(){this.place=0}function l(t,e){var n=t[e.place++];if(!(128&n))return n;for(var r=15&n,i=0,o=0,a=e.place;o<r;o++,a++)i<<=8,i|=t[a];return e.place=a,i}function a(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e<n;)e++;return 0===e?t:t.slice(e)}function f(t,e){if(e<128)t.push(e);else{var n=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}(t.exports=i).prototype._importDER=function(t,e){t=u.toArray(t,e);var n=new c;if(48!==t[n.place++])return!1;if(l(t,n)+n.place!==t.length)return!1;if(2!==t[n.place++])return!1;var r=l(t,n),i=t.slice(n.place,r+n.place);if(n.place+=r,2!==t[n.place++])return!1;var o=l(t,n);if(t.length!==o+n.place)return!1;var a=t.slice(n.place,o+n.place);return 0===i[0]&&128&i[1]&&(i=i.slice(1)),0===a[0]&&128&a[1]&&(a=a.slice(1)),this.r=new s(i),this.s=new s(a),!(this.recoveryParam=null)},i.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=a(e),n=a(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];f(r,e.length),(r=r.concat(e)).push(2),f(r,n.length);var i=r.concat(n),o=[48];return f(o,i.length),o=o.concat(i),u.encode(o,t)}},function(t,e,n){"use strict";var r=n(146),i=n(17),o=i.utils,a=o.assert,u=o.parseBytes,s=n(507),c=n(508);function l(t){if(a("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof l))return new l(t);t=i.curves[t].curve;this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=r.sha512}(t.exports=l).prototype.sign=function(t,e){t=u(t);var n=this.keyFromSecret(e),r=this.hashInt(n.messagePrefix(),t),i=this.g.mul(r),o=this.encodePoint(i),a=this.hashInt(o,n.pubBytes(),t).mul(n.priv()),s=r.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},l.prototype.verify=function(t,e,n){t=u(t),e=this.makeSignature(e);var r=this.keyFromPublic(n),i=this.hashInt(e.Rencoded(),r.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(r.pub().mul(i)).eq(o)},l.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return o.intFromLE(t.digest()).umod(this.curve.n)},l.prototype.keyFromPublic=function(t){return s.fromPublic(this,t)},l.prototype.keyFromSecret=function(t){return s.fromSecret(this,t)},l.prototype.makeSignature=function(t){return t instanceof c?t:new c(this,t)},l.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},l.prototype.decodePoint=function(t){var e=(t=o.parseBytes(t)).length-1,n=t.slice(0,e).concat(-129&t[e]),r=0!=(128&t[e]),i=o.intFromLE(n);return this.curve.pointFromY(i,r)},l.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},l.prototype.decodeInt=function(t){return o.intFromLE(t)},l.prototype.isPoint=function(t){return t instanceof this.pointClass}},function(t,e,n){"use strict";var r=n(17).utils,i=r.assert,o=r.parseBytes,a=r.cachedProperty;function s(t,e){this.eddsa=t,this._secret=o(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=o(e.pub)}s.fromPublic=function(t,e){return e instanceof s?e:new s(t,{pub:e})},s.fromSecret=function(t,e){return e instanceof s?e:new s(t,{secret:e})},s.prototype.secret=function(){return this._secret},a(s,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),a(s,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),a(s,"privBytes",function(){var t=this.eddsa,e=this.hash(),n=t.encodingLength-1,r=e.slice(0,t.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r}),a(s,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),a(s,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),a(s,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),s.prototype.sign=function(t){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},s.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},s.prototype.getSecret=function(t){return i(this._secret,"KeyPair is public only"),r.encode(this.secret(),t)},s.prototype.getPublic=function(t){return r.encode(this.pubBytes(),t)},t.exports=s},function(t,e,n){"use strict";var r=n(12),i=n(17).utils,o=i.assert,a=i.cachedProperty,s=i.parseBytes;function u(t,e){this.eddsa=t,"object"!=typeof e&&(e=s(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),o(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof r&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}a(u,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),a(u,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),a(u,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),a(u,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},t.exports=u},function(t,e,n){"use strict";var r=n(73);e.certificate=n(520);var i=r.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});e.RSAPrivateKey=i;var o=r.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});e.RSAPublicKey=o;var a=r.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())});e.PublicKey=a;var s=r.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),u=r.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())});e.PrivateKey=u;var c=r.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});e.EncryptedPrivateKey=c;var l=r.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});e.DSAPrivateKey=l,e.DSAparam=r.define("DSAparam",function(){this.int()});var f=r.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(h),this.key("publicKey").optional().explicit(1).bitstr())});e.ECPrivateKey=f;var h=r.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});e.signature=r.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},function(t,e,r){var n=r(73),i=r(3);function o(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}e.define=function(t,e){return new o(t,e)},o.prototype._createNamed=function(e){var n;try{n=r(511).runInThisContext("(function "+this.name+"(entity) {\n  this._initNamed(entity);\n})")}catch(t){n=function(t){this._initNamed(t)}}return i(n,e),n.prototype._initNamed=function(t){e.call(this,t)},new n(this)},o.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(n.decoders[t])),this.decoders[t]},o.prototype.decode=function(t,e,n){return this._getDecoder(e).decode(t,n)},o.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(n.encoders[t])),this.encoders[t]},o.prototype.encode=function(t,e,n){return this._getEncoder(e).encode(t,n)}},function(module,exports,__webpack_require__){var indexOf=__webpack_require__(512),Object_keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)e.push(n);return e},forEach=function(t,e){if(t.forEach)return t.forEach(e);for(var n=0;n<t.length;n++)e(t[n],n,t)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(t,e,n){Object.defineProperty(t,e,{writable:!0,enumerable:!1,configurable:!0,value:n})}}catch(t){return function(t,e,n){t[e]=n}}}(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function Context(){}Context.prototype={};var Script=exports.Script=function(t){if(!(this instanceof Script))return new Script(t);this.code=t};Script.prototype.runInContext=function(e){if(!(e instanceof Context))throw new TypeError("needs a 'context' argument.");var t=document.createElement("iframe");t.style||(t.style={}),t.style.display="none",document.body.appendChild(t);var n=t.contentWindow,r=n.eval,i=n.execScript;!r&&i&&(i.call(n,"null"),r=n.eval),forEach(Object_keys(e),function(t){n[t]=e[t]}),forEach(globals,function(t){e[t]&&(n[t]=e[t])});var o=Object_keys(n),a=r.call(n,this.code);return forEach(Object_keys(n),function(t){(t in e||-1===indexOf(o,t))&&(e[t]=n[t])}),forEach(globals,function(t){t in e||defineProp(e,t,n[t])}),document.body.removeChild(t),a},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInNewContext=function(e){var n=Script.createContext(e),t=this.runInContext(n);return forEach(Object_keys(n),function(t){e[t]=n[t]}),t},forEach(Object_keys(Script.prototype),function(n){exports[n]=Script[n]=function(t){var e=Script(t);return e[n].apply(e,[].slice.call(arguments,1))}}),exports.createScript=function(t){return exports.Script(t)},exports.createContext=Script.createContext=function(e){var n=new Context;return"object"==typeof e&&forEach(Object_keys(e),function(t){n[t]=e[t]}),n}},function(t,e){var r=[].indexOf;t.exports=function(t,e){if(r)return t.indexOf(e);for(var n=0;n<t.length;++n)if(t[n]===e)return n;return-1}},function(t,e,n){var r=n(3);function i(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}(e.Reporter=i).prototype.isError=function(t){return t instanceof o},i.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function(t){var e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},i.prototype.enterKey=function(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function(t){var e=this._reporterState;e.path=e.path.slice(0,t-1)},i.prototype.leaveKey=function(t,e,n){var r=this._reporterState;this.exitKey(t),null!==r.obj&&(r.obj[e]=n)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){var t=this._reporterState,e=t.obj;return t.obj={},e},i.prototype.leaveObject=function(t){var e=this._reporterState,n=e.obj;return e.obj=t,n},i.prototype.error=function(t){var e,n=this._reporterState,r=t instanceof o;if(e=r?t:new o(n.path.map(function(t){return"["+JSON.stringify(t)+"]"}).join(""),t.message||t,t.stack),!n.options.partial)throw e;return r||n.errors.push(e),e},i.prototype.wrapResult=function(t){var e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},r(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},function(t,e,n){var l=n(74).Reporter,r=n(74).EncoderBuffer,p=n(74).DecoderBuffer,i=n(25),o=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],a=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(o);function s(t,e){var n={};(this._baseState=n).enc=t,n.parent=e||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}t.exports=s;var u=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];s.prototype.clone=function(){var e=this._baseState,n={};u.forEach(function(t){n[t]=e[t]});var t=new this.constructor(n.parent);return t._baseState=n,t},s.prototype._wrap=function(){var n=this._baseState;a.forEach(function(e){this[e]=function(){var t=new this.constructor(this);return n.children.push(t),t[e].apply(t,arguments)}},this)},s.prototype._init=function(t){var e=this._baseState;i(null===e.parent),t.call(this),e.children=e.children.filter(function(t){return t._baseState.parent===this},this),i.equal(e.children.length,1,"Root node can have only one child")},s.prototype._useArgs=function(t){var e=this._baseState,n=t.filter(function(t){return t instanceof this.constructor},this);t=t.filter(function(t){return!(t instanceof this.constructor)},this),0!==n.length&&(i(null===e.children),(e.children=n).forEach(function(t){t._baseState.parent=this},this)),0!==t.length&&(i(null===e.args),e.args=t,e.reverseArgs=t.map(function(n){if("object"!=typeof n||n.constructor!==Object)return n;var r={};return Object.keys(n).forEach(function(t){t==(0|t)&&(t|=0);var e=n[t];r[e]=t}),r}))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach(function(e){s.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}}),o.forEach(function(n){s.prototype[n]=function(){var t=this._baseState,e=Array.prototype.slice.call(arguments);return i(null===t.tag),t.tag=n,this._useArgs(e),this}}),s.prototype.use=function(t){i(t);var e=this._baseState;return i(null===e.use),e.use=t,this},s.prototype.optional=function(){return this._baseState.optional=!0,this},s.prototype.def=function(t){var e=this._baseState;return i(null===e.default),e.default=t,e.optional=!0,this},s.prototype.explicit=function(t){var e=this._baseState;return i(null===e.explicit&&null===e.implicit),e.explicit=t,this},s.prototype.implicit=function(t){var e=this._baseState;return i(null===e.explicit&&null===e.implicit),e.implicit=t,this},s.prototype.obj=function(){var t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},s.prototype.key=function(t){var e=this._baseState;return i(null===e.key),e.key=t,this},s.prototype.any=function(){return this._baseState.any=!0,this},s.prototype.choice=function(e){var t=this._baseState;return i(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},s.prototype.contains=function(t){var e=this._baseState;return i(null===e.use),e.contains=t,this},s.prototype._decode=function(e,n){var t=this._baseState;if(null===t.parent)return e.wrapResult(t.children[0]._decode(e,n));var r,i=t.default,o=!0,a=null;if(null!==t.key&&(a=e.enterKey(t.key)),t.optional){var s=null;if(null!==t.explicit?s=t.explicit:null!==t.implicit?s=t.implicit:null!==t.tag&&(s=t.tag),null!==s||t.any){if(o=this._peekTag(e,s,t.any),e.isError(o))return o}else{var u=e.save();try{null===t.choice?this._decodeGeneric(t.tag,e,n):this._decodeChoice(e,n),o=!0}catch(t){o=!1}e.restore(u)}}if(t.obj&&o&&(r=e.enterObject()),o){if(null!==t.explicit){var c=this._decodeTag(e,t.explicit);if(e.isError(c))return c;e=c}var l=e.offset;if(null===t.use&&null===t.choice){if(t.any)u=e.save();var f=this._decodeTag(e,null!==t.implicit?t.implicit:t.tag,t.any);if(e.isError(f))return f;t.any?i=e.raw(u):e=f}if(n&&n.track&&null!==t.tag&&n.track(e.path(),l,e.length,"tagged"),n&&n.track&&null!==t.tag&&n.track(e.path(),e.offset,e.length,"content"),i=t.any?i:null===t.choice?this._decodeGeneric(t.tag,e,n):this._decodeChoice(e,n),e.isError(i))return i;if(t.any||null!==t.choice||null===t.children||t.children.forEach(function(t){t._decode(e,n)}),t.contains&&("octstr"===t.tag||"bitstr"===t.tag)){var h=new p(i);i=this._getUse(t.contains,e._reporterState.obj)._decode(h,n)}}return t.obj&&o&&(i=e.leaveObject(r)),null===t.key||null===i&&!0!==o?null!==a&&e.exitKey(a):e.leaveKey(a,t.key,i),i},s.prototype._decodeGeneric=function(t,e,n){var r=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,r.args[0],n):/str$/.test(t)?this._decodeStr(e,t,n):"objid"===t&&r.args?this._decodeObjid(e,r.args[0],r.args[1],n):"objid"===t?this._decodeObjid(e,null,null,n):"gentime"===t||"utctime"===t?this._decodeTime(e,t,n):"null_"===t?this._decodeNull(e,n):"bool"===t?this._decodeBool(e,n):"objDesc"===t?this._decodeStr(e,t,n):"int"===t||"enum"===t?this._decodeInt(e,r.args&&r.args[0],n):null!==r.use?this._getUse(r.use,e._reporterState.obj)._decode(e,n):e.error("unknown tag: "+t)},s.prototype._getUse=function(t,e){var n=this._baseState;return n.useDecoder=this._use(t,e),i(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},s.prototype._decodeChoice=function(i,o){var a=this._baseState,s=null,u=!1;return Object.keys(a.choice).some(function(t){var e=i.save(),n=a.choice[t];try{var r=n._decode(i,o);if(i.isError(r))return!1;s={type:t,value:r},u=!0}catch(t){return i.restore(e),!1}return!0},this),u?s:i.error("Choice not matched")},s.prototype._createEncoderBuffer=function(t){return new r(t,this.reporter)},s.prototype._encode=function(t,e,n){var r=this._baseState;if(null===r.default||r.default!==t){var i=this._encodeValue(t,e,n);if(void 0!==i&&!this._skipDefault(i,e,n))return i}},s.prototype._encodeValue=function(r,i,t){var e=this._baseState;if(null===e.parent)return e.children[0]._encode(r,i||new l);var n=null;if(this.reporter=i,e.optional&&void 0===r){if(null===e.default)return;r=e.default}var o=null,a=!1;if(e.any)n=this._createEncoderBuffer(r);else if(e.choice)n=this._encodeChoice(r,i);else if(e.contains)o=this._getUse(e.contains,t)._encode(r,i),a=!0;else if(e.children)o=e.children.map(function(t){if("null_"===t._baseState.tag)return t._encode(null,i,r);if(null===t._baseState.key)return i.error("Child should have a key");var e=i.enterKey(t._baseState.key);if("object"!=typeof r)return i.error("Child expected, but input is not object");var n=t._encode(r[t._baseState.key],i,r);return i.leaveKey(e),n},this).filter(function(t){return t}),o=this._createEncoderBuffer(o);else if("seqof"===e.tag||"setof"===e.tag){if(!e.args||1!==e.args.length)return i.error("Too many args for : "+e.tag);if(!Array.isArray(r))return i.error("seqof/setof, but data is not Array");var s=this.clone();s._baseState.implicit=null,o=this._createEncoderBuffer(r.map(function(t){var e=this._baseState;return this._getUse(e.args[0],r)._encode(t,i)},s))}else null!==e.use?n=this._getUse(e.use,t)._encode(r,i):(o=this._encodePrimitive(e.tag,r),a=!0);if(!e.any&&null===e.choice){var u=null!==e.implicit?e.implicit:e.tag,c=null===e.implicit?"universal":"context";null===u?null===e.use&&i.error("Tag could be omitted only for .use()"):null===e.use&&(n=this._encodeComposite(u,a,c,o))}return null!==e.explicit&&(n=this._encodeComposite(e.explicit,!1,"context",n)),n},s.prototype._encodeChoice=function(t,e){var n=this._baseState,r=n.choice[t.type];return r||i(!1,t.type+" not found in "+JSON.stringify(Object.keys(n.choice))),r._encode(t.value,e)},s.prototype._encodePrimitive=function(t,e){var n=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&n.args)return this._encodeObjid(e,n.reverseArgs[0],n.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,n.args&&n.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},s.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},s.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(t)}},function(t,e,n){var r=n(219);e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=r._reverse(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=r._reverse(e.tag)},function(t,e,n){var r=e;r.der=n(220),r.pem=n(517)},function(t,e,n){var r=n(3),f=n(14).Buffer,h=n(220);function i(t){h.call(this,t),this.enc="pem"}r(i,h),(t.exports=i).prototype.decode=function(t,e){for(var n=t.toString().split(/[\r\n]+/g),r=e.label.toUpperCase(),i=/^-----(BEGIN|END) ([^-]+)-----$/,o=-1,a=-1,s=0;s<n.length;s++){var u=n[s].match(i);if(null!==u&&u[2]===r){if(-1!==o){if("END"!==u[1])break;a=s;break}if("BEGIN"!==u[1])break;o=s}}if(-1===o||-1===a)throw new Error("PEM section not found for: "+r);var c=n.slice(o+1,a).join("");c.replace(/[^a-z0-9\+\/=]+/gi,"");var l=new f(c,"base64");return h.prototype.decode.call(this,l,e)}},function(t,e,n){var r=e;r.der=n(221),r.pem=n(519)},function(t,e,n){var r=n(3),o=n(221);function i(t){o.call(this,t),this.enc="pem"}r(i,o),(t.exports=i).prototype.encode=function(t,e){for(var n=o.prototype.encode.call(this,t).toString("base64"),r=["-----BEGIN "+e.label+"-----"],i=0;i<n.length;i+=64)r.push(n.slice(i,i+64));return r.push("-----END "+e.label+"-----"),r.join("\n")}},function(t,e,n){"use strict";var r=n(73),i=r.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),o=r.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),a=r.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),s=r.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())}),u=r.define("RelativeDistinguishedName",function(){this.setof(o)}),c=r.define("RDNSequence",function(){this.seqof(u)}),l=r.define("Name",function(){this.choice({rdnSequence:this.use(c)})}),f=r.define("Validity",function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))}),h=r.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),p=r.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(a),this.key("issuer").use(l),this.key("validity").use(f),this.key("subject").use(l),this.key("subjectPublicKeyInfo").use(s),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(h).optional())}),d=r.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(p),this.key("signatureAlgorithm").use(a),this.key("signatureValue").bitstr())});t.exports=d},function(t){t.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},function(t,e,n){var h=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m,p=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,d=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m,m=n(93),g=n(142),y=n(4).Buffer;t.exports=function(t,e){var n,r=t.toString(),i=r.match(h);if(i){var o="aes"+i[1],a=y.from(i[2],"hex"),s=y.from(i[3].replace(/[\r\n]/g,""),"base64"),u=m(e,a.slice(0,8),parseInt(i[1],10)).key,c=[],l=g.createDecipheriv(o,u,a);c.push(l.update(s)),c.push(l.final()),n=y.concat(c)}else{var f=r.match(d);n=new y(f[2].replace(/[\r\n]/g,""),"base64")}return{tag:r.match(p)[1],data:n}}},function(t,e,n){(function(h){var p=n(12),d=n(17).ec,m=n(95),g=n(222);function y(t,e){if(t.cmpn(0)<=0)throw new Error("invalid sig");if(t.cmp(e)>=e)throw new Error("invalid sig")}t.exports=function(t,e,n,r,i){var o=m(n);if("ec"===o.type){if("ecdsa"!==r&&"ecdsa/rsa"!==r)throw new Error("wrong public key type");return function(t,e,n){var r=g[n.data.algorithm.curve.join(".")];if(!r)throw new Error("unknown curve "+n.data.algorithm.curve.join("."));var i=new d(r),o=n.data.subjectPrivateKey.data;return i.verify(e,t,o)}(t,e,o)}if("dsa"===o.type){if("dsa"!==r)throw new Error("wrong public key type");return function(t,e,n){var r=n.data.p,i=n.data.q,o=n.data.g,a=n.data.pub_key,s=m.signature.decode(t,"der"),u=s.s,c=s.r;y(u,i),y(c,i);var l=p.mont(r),f=u.invm(i);return 0===o.toRed(l).redPow(new p(e).mul(f).mod(i)).fromRed().mul(a.toRed(l).redPow(c.mul(f).mod(i)).fromRed()).mod(r).mod(i).cmp(c)}(t,e,o)}if("rsa"!==r&&"ecdsa/rsa"!==r)throw new Error("wrong public key type");e=h.concat([i,e]);for(var a=o.modulus.byteLength(),s=[1],u=0;e.length+s.length+2<a;)s.push(255),u++;s.push(0);for(var c=-1;++c<e.length;)s.push(e[c]);s=new h(s);var l=p.mont(o.modulus);t=(t=new p(t).toRed(l)).redPow(new p(o.publicExponent)),t=new h(t.fromRed().toArray());var f=u<8?1:0;for(a=Math.min(t.length,s.length),t.length!==s.length&&(f=1),c=-1;++c<a;)f|=t[c]^s[c];return 0===f}}).call(this,n(14).Buffer)},function(t,e,s){(function(o){var e=s(17),r=s(12);t.exports=function(t){return new i(t)};var n={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function i(t){this.curveType=n[t],this.curveType||(this.curveType={name:t}),this.curve=new e.ec(this.curveType.name),this.keys=void 0}function a(t,e,n){Array.isArray(t)||(t=t.toArray());var r=new o(t);if(n&&r.length<n){var i=new o(n-r.length);i.fill(0),r=o.concat([i,r])}return e?r.toString(e):r}n.p224=n.secp224r1,n.p256=n.secp256r1=n.prime256v1,n.p192=n.secp192r1=n.prime192v1,n.p384=n.secp384r1,n.p521=n.secp521r1,i.prototype.generateKeys=function(t,e){return this.keys=this.curve.genKeyPair(),this.getPublicKey(t,e)},i.prototype.computeSecret=function(t,e,n){return e=e||"utf8",o.isBuffer(t)||(t=new o(t,e)),a(this.curve.keyFromPublic(t).getPublic().mul(this.keys.getPrivate()).getX(),n,this.curveType.byteLength)},i.prototype.getPublicKey=function(t,e){var n=this.keys.getPublic("compressed"===e,!0);return"hybrid"===e&&(n[n.length-1]%2?n[0]=7:n[0]=6),a(n,t)},i.prototype.getPrivateKey=function(t){return a(this.keys.getPrivate(),t)},i.prototype.setPublicKey=function(t,e){return e=e||"utf8",o.isBuffer(t)||(t=new o(t,e)),this.keys._importPublic(t),this},i.prototype.setPrivateKey=function(t,e){e=e||"utf8",o.isBuffer(t)||(t=new o(t,e));var n=new r(t);return n=n.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(n),this}}).call(this,s(14).Buffer)},function(t,n,e){n.publicEncrypt=e(526),n.privateDecrypt=e(527),n.privateEncrypt=function(t,e){return n.publicEncrypt(t,e,!0)},n.publicDecrypt=function(t,e){return n.privateDecrypt(t,e,!0)}},function(t,e,n){var a=n(95),h=n(61),p=n(69),d=n(223),m=n(224),g=n(12),s=n(225),u=n(145),y=n(4).Buffer;t.exports=function(t,e,n){var r;r=t.padding?t.padding:n?1:4;var i,o=a(t);if(4===r)i=function(t,e){var n=t.modulus.byteLength(),r=e.length,i=p("sha1").update(y.alloc(0)).digest(),o=i.length,a=2*o;if(n-a-2<r)throw new Error("message too long");var s=y.alloc(n-r-a-2),u=n-o-1,c=h(o),l=m(y.concat([i,s,y.alloc(1,1),e],u),d(c,u)),f=m(c,d(l,o));return new g(y.concat([y.alloc(1),f,l],n))}(o,e);else if(1===r)i=function(t,e,n){var r,i=e.length,o=t.modulus.byteLength();if(o-11<i)throw new Error("message too long");r=n?y.alloc(o-i-3,255):function(t){var e,n=y.allocUnsafe(t),r=0,i=h(2*t),o=0;for(;r<t;)o===i.length&&(i=h(2*t),o=0),(e=i[o++])&&(n[r++]=e);return n}(o-i-3);return new g(y.concat([y.from([0,n?1:2]),r,y.alloc(1),e],o))}(o,e,n);else{if(3!==r)throw new Error("unknown padding");if(0<=(i=new g(e)).cmp(o.modulus))throw new Error("data too long for modulus")}return n?u(i,o):s(i,o)}},function(t,e,n){var u=n(95),l=n(223),f=n(224),c=n(12),h=n(145),p=n(69),d=n(225),m=n(4).Buffer;t.exports=function(t,e,n){var r;r=t.padding?t.padding:n?1:4;var i,o=u(t),a=o.modulus.byteLength();if(e.length>a||0<=new c(e).cmp(o.modulus))throw new Error("decryption error");i=n?d(new c(e),o):h(e,o);var s=m.alloc(a-i.length);if(i=m.concat([s,i],a),4===r)return function(t,e){var n=t.modulus.byteLength(),r=p("sha1").update(m.alloc(0)).digest(),i=r.length;if(0!==e[0])throw new Error("decryption error");var o=e.slice(1,i+1),a=e.slice(i+1),s=f(o,l(a,i)),u=f(a,l(s,n-i-1));if(function(t,e){t=m.from(t),e=m.from(e);var n=0,r=t.length;t.length!==e.length&&(n++,r=Math.min(t.length,e.length));var i=-1;for(;++i<r;)n+=t[i]^e[i];return n}(r,u.slice(0,i)))throw new Error("decryption error");var c=i;for(;0===u[c];)c++;if(1===u[c++])return u.slice(c);throw new Error("decryption error")}(o,i);if(1===r)return function(t,e,n){var r=e.slice(0,2),i=2,o=0;for(;0!==e[i++];)if(i>=e.length){o++;break}var a=e.slice(2,i-1);("0002"!==r.toString("hex")&&!n||"0001"!==r.toString("hex")&&n)&&o++;a.length<8&&o++;if(o)throw new Error("decryption error");return e.slice(i)}(0,i,n);if(3===r)return i;throw new Error("unknown padding")}},function(t,n,p){"use strict";(function(i,a){function t(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var e=p(4),s=p(61),o=e.Buffer,r=e.kMaxLength,u=i.crypto||i.msCrypto,c=Math.pow(2,32)-1;function l(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(c<t||t<0)throw new TypeError("offset must be a uint32");if(r<t||e<t)throw new RangeError("offset out of range")}function f(t,e,n){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(c<t||t<0)throw new TypeError("size must be a uint32");if(n<t+e||r<t)throw new RangeError("buffer too small")}function h(n,r,t,i){if(a.browser){var e=n.buffer,o=new Uint8Array(e,r,t);return u.getRandomValues(o),i?void a.nextTick(function(){i(null,n)}):n}if(!i)return s(t).copy(n,r),n;s(t,function(t,e){if(t)return i(t);e.copy(n,r),i(null,n)})}u&&u.getRandomValues||!a.browser?(n.randomFill=function(t,e,n,r){if(!(o.isBuffer(t)||t instanceof i.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof e)r=e,e=0,n=t.length;else if("function"==typeof n)r=n,n=t.length-e;else if("function"!=typeof r)throw new TypeError('"cb" argument must be a function');return l(e,t.length),f(n,e,t.length),h(t,e,n,r)},n.randomFillSync=function(t,e,n){void 0===e&&(e=0);if(!(o.isBuffer(t)||t instanceof i.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');l(e,t.length),void 0===n&&(n=t.length-e);return f(n,e,t.length),h(t,e,n)}):(n.randomFill=t,n.randomFillSync=t)}).call(this,p(15),p(35))},function(t,e){},function(t,e){},function(t,e){},function(t,e,n){var s=n(226),u=n(238),c=n(149);t.exports=function(a){return function(t,e,n){var r=Object(t);if(!u(t)){var i=s(e,3);t=c(t),e=function(t){return i(r[t],t,r)}}var o=a(t,e,n);return-1<o?r[i?t[o]:o]:void 0}}},function(t,e,n){var r=n(534),i=n(596),o=n(240);t.exports=function(e){var n=i(e);return 1==n.length&&n[0][2]?o(n[0][0],n[0][1]):function(t){return t===e||r(t,e,n)}}},function(t,e,n){var p=n(227),d=n(232);t.exports=function(t,e,n,r){var i=n.length,o=i,a=!r;if(null==t)return!o;for(t=Object(t);i--;){var s=n[i];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<o;){var u=(s=n[i])[0],c=t[u],l=s[1];if(a&&s[2]){if(void 0===c&&!(u in t))return!1}else{var f=new p;if(r)var h=r(c,l,u,t,e,f);if(!(void 0===h?d(l,c,3,r,f):h))return!1}}return!0}},function(t,e){t.exports=function(){this.__data__=[],this.size=0}},function(t,e,n){var r=n(97),i=Array.prototype.splice;t.exports=function(t){var e=this.__data__,n=r(e,t);return!(n<0||(n==e.length-1?e.pop():i.call(e,n,1),--this.size,0))}},function(t,e,n){var r=n(97);t.exports=function(t){var e=this.__data__,n=r(e,t);return n<0?void 0:e[n][1]}},function(t,e,n){var r=n(97);t.exports=function(t){return-1<r(this.__data__,t)}},function(t,e,n){var i=n(97);t.exports=function(t,e){var n=this.__data__,r=i(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}},function(t,e,n){var r=n(96);t.exports=function(){this.__data__=new r,this.size=0}},function(t,e){t.exports=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}},function(t,e){t.exports=function(t){return this.__data__.get(t)}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e,n){var i=n(96),o=n(147),a=n(148);t.exports=function(t,e){var n=this.__data__;if(n instanceof i){var r=n.__data__;if(!o||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new a(r)}return n.set(t,e),this.size=n.size,this}},function(t,e,n){var r=n(229),i=n(548),o=n(99),a=n(231),s=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,l=u.toString,f=c.hasOwnProperty,h=RegExp("^"+l.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!o(t)||i(t))&&(r(t)?h:s).test(a(t))}},function(t,e,n){var r=n(98),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=r?r.toStringTag:void 0;t.exports=function(t){var e=o.call(t,s),n=t[s];try{var r=!(t[s]=void 0)}catch(t){}var i=a.call(t);return r&&(e?t[s]=n:delete t[s]),i}},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},function(t,e,n){var r,i=n(549),o=(r=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(t){return!!o&&o in t}},function(t,e,n){var r=n(39)["__core-js_shared__"];t.exports=r},function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}},function(t,e,n){var r=n(552),i=n(96),o=n(147);t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(o||i),string:new r}}},function(t,e,n){var r=n(553),i=n(554),o=n(555),a=n(556),s=n(557);function u(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}u.prototype.clear=r,u.prototype.delete=i,u.prototype.get=o,u.prototype.has=a,u.prototype.set=s,t.exports=u},function(t,e,n){var r=n(100);t.exports=function(){this.__data__=r?r(null):{},this.size=0}},function(t,e){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},function(t,e,n){var r=n(100),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(r){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return i.call(e,t)?e[t]:void 0}},function(t,e,n){var r=n(100),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return r?void 0!==e[t]:i.call(e,t)}},function(t,e,n){var r=n(100);t.exports=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=r&&void 0===e?"__lodash_hash_undefined__":e,this}},function(t,e,n){var r=n(101);t.exports=function(t){var e=r(this,t).delete(t);return this.size-=e?1:0,e}},function(t,e){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},function(t,e,n){var r=n(101);t.exports=function(t){return r(this,t).get(t)}},function(t,e,n){var r=n(101);t.exports=function(t){return r(this,t).has(t)}},function(t,e,n){var i=n(101);t.exports=function(t,e){var n=i(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}},function(t,e,n){var y=n(227),v=n(233),b=n(569),w=n(573),_=n(591),x=n(44),E=n(235),S=n(237),N="[object Arguments]",I="[object Array]",O="[object Object]",k=Object.prototype.hasOwnProperty;t.exports=function(t,e,n,r,i,o){var a=x(t),s=x(e),u=a?I:_(t),c=s?I:_(e),l=(u=u==N?O:u)==O,f=(c=c==N?O:c)==O,h=u==c;if(h&&E(t)){if(!E(e))return!1;l=!(a=!0)}if(h&&!l)return o||(o=new y),a||S(t)?v(t,e,n,r,i,o):b(t,e,u,n,r,i,o);if(!(1&n)){var p=l&&k.call(t,"__wrapped__"),d=f&&k.call(e,"__wrapped__");if(p||d){var m=p?t.value():t,g=d?e.value():e;return o||(o=new y),i(m,g,n,r,o)}}return h&&(o||(o=new y),w(t,e,n,r,i,o))}},function(t,e,n){var r=n(148),i=n(565),o=n(566);function a(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new r;++e<n;)this.add(t[e])}a.prototype.add=a.prototype.push=i,a.prototype.has=o,t.exports=a},function(t,e){t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e){t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}},function(t,e){t.exports=function(t,e){return t.has(e)}},function(t,e,n){var r=n(98),f=n(570),h=n(228),p=n(233),d=n(571),m=n(572),i=r?r.prototype:void 0,g=i?i.valueOf:void 0;t.exports=function(t,e,n,r,i,o,a){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!o(new f(t),new f(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return h(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var s=d;case"[object Set]":var u=1&r;if(s||(s=m),t.size!=e.size&&!u)return!1;var c=a.get(t);if(c)return c==e;r|=2,a.set(t,e);var l=p(s(t),s(e),r,i,o,a);return a.delete(t),l;case"[object Symbol]":if(g)return g.call(t)==g.call(e)}return!1}},function(t,e,n){var r=n(39).Uint8Array;t.exports=r},function(t,e){t.exports=function(t){var n=-1,r=Array(t.size);return t.forEach(function(t,e){r[++n]=[e,t]}),r}},function(t,e){t.exports=function(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}},function(t,e,n){var b=n(574),w=Object.prototype.hasOwnProperty;t.exports=function(t,e,n,r,i,o){var a=1&n,s=b(t),u=s.length;if(u!=b(e).length&&!a)return!1;for(var c=u;c--;){var l=s[c];if(!(a?l in e:w.call(e,l)))return!1}var f=o.get(t);if(f&&o.get(e))return f==e;var h=!0;o.set(t,e),o.set(e,t);for(var p=a;++c<u;){var d=t[l=s[c]],m=e[l];if(r)var g=a?r(m,d,l,e,t,o):r(d,m,l,t,e,o);if(!(void 0===g?d===m||i(d,m,n,r,o):g)){h=!1;break}p||(p="constructor"==l)}if(h&&!p){var y=t.constructor,v=e.constructor;y!=v&&"constructor"in t&&"constructor"in e&&!("function"==typeof y&&y instanceof y&&"function"==typeof v&&v instanceof v)&&(h=!1)}return o.delete(t),o.delete(e),h}},function(t,e,n){var r=n(575),i=n(577),o=n(149);t.exports=function(t){return r(t,o,i)}},function(t,e,n){var i=n(576),o=n(44);t.exports=function(t,e,n){var r=e(t);return o(t)?r:i(r,n(t))}},function(t,e){t.exports=function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}},function(t,e,n){var r=n(578),i=n(579),o=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols,s=a?function(e){return null==e?[]:(e=Object(e),r(a(e),function(t){return o.call(e,t)}))}:i;t.exports=s},function(t,e){t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o}},function(t,e){t.exports=function(){return[]}},function(t,e,n){var l=n(581),f=n(234),h=n(44),p=n(235),d=n(236),m=n(237),g=Object.prototype.hasOwnProperty;t.exports=function(t,e){var n=h(t),r=!n&&f(t),i=!n&&!r&&p(t),o=!n&&!r&&!i&&m(t),a=n||r||i||o,s=a?l(t.length,String):[],u=s.length;for(var c in t)!e&&!g.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||d(c,u))||s.push(c);return s}},function(t,e){t.exports=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}},function(t,e,n){var r=n(75),i=n(76);t.exports=function(t){return i(t)&&"[object Arguments]"==r(t)}},function(t,e){t.exports=function(){return!1}},function(t,e,n){var r=n(75),i=n(150),o=n(76),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,t.exports=function(t){return o(t)&&i(t.length)&&!!a[r(t)]}},function(t,e){t.exports=function(e){return function(t){return e(t)}}},function(t,a,s){(function(t){var e=s(230),n=a&&!a.nodeType&&a,r=n&&"object"==typeof t&&t&&!t.nodeType&&t,i=r&&r.exports===n&&e.process,o=function(){try{var t=r&&r.require&&r.require("util").types;return t||i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=o}).call(this,s(144)(t))},function(t,e,n){var r=n(588),i=n(589),o=Object.prototype.hasOwnProperty;t.exports=function(t){if(!r(t))return i(t);var e=[];for(var n in Object(t))o.call(t,n)&&"constructor"!=n&&e.push(n);return e}},function(t,e){var n=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||n)}},function(t,e,n){var r=n(590)(Object.keys,Object);t.exports=r},function(t,e){t.exports=function(e,n){return function(t){return e(n(t))}}},function(t,e,n){var r=n(592),i=n(147),o=n(593),a=n(594),s=n(595),u=n(75),c=n(231),l="[object Map]",f="[object Promise]",h="[object Set]",p="[object WeakMap]",d="[object DataView]",m=c(r),g=c(i),y=c(o),v=c(a),b=c(s),w=u;(r&&w(new r(new ArrayBuffer(1)))!=d||i&&w(new i)!=l||o&&w(o.resolve())!=f||a&&w(new a)!=h||s&&w(new s)!=p)&&(w=function(t){var e=u(t),n="[object Object]"==e?t.constructor:void 0,r=n?c(n):"";if(r)switch(r){case m:return d;case g:return l;case y:return f;case v:return h;case b:return p}return e}),t.exports=w},function(t,e,n){var r=n(63)(n(39),"DataView");t.exports=r},function(t,e,n){var r=n(63)(n(39),"Promise");t.exports=r},function(t,e,n){var r=n(63)(n(39),"Set");t.exports=r},function(t,e,n){var r=n(63)(n(39),"WeakMap");t.exports=r},function(t,e,n){var o=n(239),a=n(149);t.exports=function(t){for(var e=a(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,o(i)]}return e}},function(t,e,n){var i=n(232),o=n(598),a=n(605),s=n(151),u=n(239),c=n(240),l=n(103);t.exports=function(n,r){return s(n)&&u(r)?c(l(n),r):function(t){var e=o(t,n);return void 0===e&&e===r?a(t,n):i(r,e,3)}}},function(t,e,n){var i=n(241);t.exports=function(t,e,n){var r=null==t?void 0:i(t,e);return void 0===r?n:r}},function(t,e,n){var r=n(600),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,a=/\\(\\)?/g,i=r(function(t){var i=[];return 46===t.charCodeAt(0)&&i.push(""),t.replace(o,function(t,e,n,r){i.push(n?r.replace(a,"$1"):e||t)}),i});t.exports=i},function(t,e,n){var r=n(601);t.exports=function(t){var e=r(t,function(t){return 500===n.size&&n.clear(),t}),n=e.cache;return e}},function(t,e,n){var r=n(148),s="Expected a function";function u(i,o){if("function"!=typeof i||null!=o&&"function"!=typeof o)throw new TypeError(s);var a=function(){var t=arguments,e=o?o.apply(this,t):t[0],n=a.cache;if(n.has(e))return n.get(e);var r=i.apply(this,t);return a.cache=n.set(e,r)||n,r};return a.cache=new(u.Cache||r),a}u.Cache=r,t.exports=u},function(t,e,n){var r=n(603);t.exports=function(t){return null==t?"":r(t)}},function(t,e,n){var r=n(98),i=n(604),o=n(44),a=n(102),s=1/0,u=r?r.prototype:void 0,c=u?u.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(o(e))return i(e,t)+"";if(a(e))return c?c.call(e):"";var n=e+"";return"0"==n&&1/e==-s?"-0":n}},function(t,e){t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}},function(t,e,n){var r=n(606),i=n(607);t.exports=function(t,e){return null!=t&&i(t,e,r)}},function(t,e){t.exports=function(t,e){return null!=t&&e in Object(t)}},function(t,e,n){var s=n(242),u=n(234),c=n(44),l=n(236),f=n(150),h=n(103);t.exports=function(t,e,n){for(var r=-1,i=(e=s(e,t)).length,o=!1;++r<i;){var a=h(e[r]);if(!(o=null!=t&&n(t,a)))break;t=t[a]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&f(i)&&l(a,i)&&(c(t)||u(t))}},function(t,e){t.exports=function(t){return t}},function(t,e,n){var r=n(610),i=n(611),o=n(151),a=n(103);t.exports=function(t){return o(t)?r(a(t)):i(t)}},function(t,e){t.exports=function(e){return function(t){return null==t?void 0:t[e]}}},function(t,e,n){var r=n(241);t.exports=function(e){return function(t){return r(t,e)}}},function(t,e,n){var o=n(613),a=n(226),s=n(614),u=Math.max;t.exports=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:s(n);return i<0&&(i=u(r+i,0)),o(t,a(e,3),i)}},function(t,e){t.exports=function(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}},function(t,e,n){var r=n(615);t.exports=function(t){var e=r(t),n=e%1;return e==e?n?e-n:e:0}},function(t,e,n){var r=n(616);t.exports=function(t){return t?(t=r(t))!==1/0&&t!==-1/0?t==t?t:0:17976931348623157e292*(t<0?-1:1):0===t?t:0}},function(t,e,n){var r=n(99),i=n(102),o=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return NaN;if(r(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=r(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(o,"");var n=s.test(t);return n||u.test(t)?c(t.slice(2),n?2:8):a.test(t)?NaN:+t}},function(t,e,n){var r=n(618);"string"==typeof r&&(r=[[t.i,r,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};n(620)(r,i);r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(619)(!1)).push([t.i,'body{\n  margin: 0;\n  font-family: "Open Sans", "Helvetica";\n}\n\n.app{\n  position: absolute;\n  background: radial-gradient(rgb(55, 73, 130), rgb(30, 41, 72));\n  width: 100%;\n  height: 100%;\n  margin: 0;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n}\n\nh1, h2{\n  text-align: center;\n  font-family: "Open Sans", "Helvetica";\n  margin: .5em auto;\n}\n\nh1{\n  font-weight: 800;\n  color: white;\n}\n\nh1.earth{\n  font-size: 6em;\n  margin-bottom: 0;\n}\n\nh1.earth:empty  {\n  display: none;\n}\n\nh2{\n  font-weight: 300;\n  color: rgb(199, 255, 131);\n  font-size: .9em;\n  width: 85%;\n}\n\n.intro p{\n  font-weight: 400;\n  font-size: .6em;\n  width: 60%;\n  text-align: center;\n  font-family: "Open Sans", "Helvetica";\n  width: 80%;\n  margin: 0 auto;\n  color: rgb(104, 172, 250);\n  font-weight: 200;\n}\n\n.app .intro{\n  justify-content: center;\n  align-items: center;\n}\n\n.intro .start-button{\n  display: block;\n  margin: 2em auto;\n  border: 1px solid white;\n  background: none;\n  border-radius: .3em;\n  padding: .5em 1em;\n  color: white;\n  font-size: .8em;\n}\n\n.blinking{\n  animation: 2s infinite ease-in-out blink;\n}\n\n@keyframes blink{\n  0%{\n    opacity: 1;\n  }\n  50%{\n    opacity: 0;\n  }\n  100%{\n    opacity: 1;\n  }\n}\n\n.feed{\n  display: none;\n  position: absolute;\n  top: 0;\n  left: 0;\n  height: 100%;\n  width: 100%;\n}\n\n.feed #webcam-frame{\n  margin: 0;\n  padding: 0;\n  position: fixed;\n  height: 100%;\n  width: 100%;\n  object-fit: cover;\n}\n\nvideo{\n  margin: 0;\n  padding: 0;\n  position: fixed;\n  height: 100%;\n  width: 100%;\n  object-fit: cover;\n}\n\n.classification-content{\n  position: absolute;\n  bottom: 0;\n  width: 100%;\n  z-index: 10;\n  background: rgba(30, 41, 72, .6);\n  padding: 1em 0;\n}\n\n#guess-button{\n  background: none;\n  border: 2px solid white;\n  border-radius: .3em;\n  padding: 1em 2em;\n  color: white;\n  font-size: 14px;\n  display: block;\n  margin: 0 auto 0 auto;\n}\n\n#confirmation-buttons{\n  display: none;\n  width: fit-content;\n  margin: 0 auto 0 auto;\n}\n\n#yes, #no, #next{\n  border-radius: .3em;\n  padding: 1em 2em;\n  background: none;\n  border: 2px solid rgb(199, 255, 131);\n  font-weight: 400;\n  color: rgb(199, 255, 131);\n  width: fit-content;\n}\n\n#yes{\n  margin-right: 1em;\n}\n\n#result, #recycling-classification{\n  font-family: "Open Sans", "Helvetica";\n  display: block;\n  margin: 0 auto;\n  width: fit-content;\n  color: white;\n}\n\n#recycling-classification{\n  font-size: 20px;\n}\n\n#result{\n  padding: 0 1em 1em 1em;\n}\n\n#result:empty{\n  display: none;\n}\n\n#next{\n  display: none;\n  margin: 0 auto;\n  font-size: 14px;\n}\n\n@media(min-width:600px){\n  h1{\n    font-size: 2em;\n  }\n\n  h2{\n    font-size: 1em;\n    width: 70%;\n  }\n\n  .intro p{\n    font-size: .8em;\n  }\n\n  .intro .start-button{\n    font-size: .8em;\n  }\n}\n\n@media(min-width:800px){\n  h1{\n    font-size: 3em;\n  }\n\n  h2{\n    font-size: 1.3em;\n    width: 100%;\n  }\n\n  .intro p{\n    font-size: .9em;\n  }\n\n  .intro .start-button{\n    font-size: 1em;\n  }\n\n  #guess-button{\n    font-size: 20px;\n  }\n\n  #result, #recycling-classification{\n    font-size: 20px;\n  }\n\n  #yes, #no, #next{\n    font-size: 20px;\n  }\n}\n',""])},function(t,e,n){"use strict";t.exports=function(n){var a=[];return a.toString=function(){return this.map(function(t){var e=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var i=function(t){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t))))+" */"}(r),o=r.sources.map(function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"});return[n].concat(o).concat([i]).join("\n")}return[n].join("\n")}(t,n);return t[2]?"@media "+t[2]+"{"+e+"}":e}).join("")},a.i=function(t,e){"string"==typeof t&&(t=[[null,t,""]]);for(var n={},r=0;r<this.length;r++){var i=this[r][0];null!=i&&(n[i]=!0)}for(r=0;r<t.length;r++){var o=t[r];null!=o[0]&&n[o[0]]||(e&&!o[2]?o[2]=e:e&&(o[2]="("+o[2]+") and ("+e+")"),a.push(o))}},a}},function(t,e,r){var n,i,o,u={},c=(n=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===i&&(i=n.apply(this,arguments)),i}),a=(o={},function(t,e){if("function"==typeof t)return t();if(void 0===o[t]){var n=function(t,e){return e?e.querySelector(t):document.querySelector(t)}.call(this,t,e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}o[t]=n}return o[t]}),s=null,l=0,f=[],h=r(621);function p(t,e){for(var n=0;n<t.length;n++){var r=t[n],i=u[r.id];if(i){i.refs++;for(var o=0;o<i.parts.length;o++)i.parts[o](r.parts[o]);for(;o<r.parts.length;o++)i.parts.push(b(r.parts[o],e))}else{var a=[];for(o=0;o<r.parts.length;o++)a.push(b(r.parts[o],e));u[r.id]={id:r.id,refs:1,parts:a}}}}function d(t,e){for(var n=[],r={},i=0;i<t.length;i++){var o=t[i],a=e.base?o[0]+e.base:o[0],s={css:o[1],media:o[2],sourceMap:o[3]};r[a]?r[a].parts.push(s):n.push(r[a]={id:a,parts:[s]})}return n}function m(t,e){var n=a(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=f[f.length-1];if("top"===t.insertAt)r?r.nextSibling?n.insertBefore(e,r.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),f.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var i=a(t.insertAt.before,n);n.insertBefore(e,i)}}function g(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=f.indexOf(t);0<=e&&f.splice(e,1)}function y(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var n=function(){0;return r.nc}();n&&(t.attrs.nonce=n)}return v(e,t.attrs),m(t,e),e}function v(e,n){Object.keys(n).forEach(function(t){e.setAttribute(t,n[t])})}function b(e,t){var n,r,i,o;if(t.transform&&e.css){if(!(o="function"==typeof t.transform?t.transform(e.css):t.transform.default(e.css)))return function(){};e.css=o}if(t.singleton){var a=l++;n=s||(s=y(t)),r=x.bind(null,n,a,!1),i=x.bind(null,n,a,!0)}else i=e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",v(e,t.attrs),m(t,e),e}(t),r=function(t,e,n){var r=n.css,i=n.sourceMap,o=void 0===e.convertToAbsoluteUrls&&i;(e.convertToAbsoluteUrls||o)&&(r=h(r));i&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var a=new Blob([r],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,t),function(){g(n),n.href&&URL.revokeObjectURL(n.href)}):(n=y(t),r=function(t,e){var n=e.css,r=e.media;r&&t.setAttribute("media",r);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),function(){g(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else i()}}t.exports=function(t,a){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(a=a||{}).attrs="object"==typeof a.attrs?a.attrs:{},a.singleton||"boolean"==typeof a.singleton||(a.singleton=c()),a.insertInto||(a.insertInto="head"),a.insertAt||(a.insertAt="bottom");var s=d(t,a);return p(s,a),function(t){for(var e=[],n=0;n<s.length;n++){var r=s[n];(i=u[r.id]).refs--,e.push(i)}t&&p(d(t,a),a);for(n=0;n<e.length;n++){var i;if(0===(i=e[n]).refs){for(var o=0;o<i.parts.length;o++)i.parts[o]();delete u[i.id]}}}};var w,_=(w=[],function(t,e){return w[t]=e,w.filter(Boolean).join("\n")});function x(t,e,n,r){var i=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=_(e,i);else{var o=document.createTextNode(i),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(o,a[e]):t.appendChild(o)}}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var i=e.protocol+"//"+e.host,o=i+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var n,r=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(n=0===r.indexOf("//")?r:0===r.indexOf("/")?i+r:o+r.replace(/^\.\//,""),"url("+JSON.stringify(n)+")")})}},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"setBackend",function(){return B.Cd}),n.d(r,"getBackend",function(){return B.Nb}),n.d(r,"disposeVariables",function(){return B.rb}),n.d(r,"memory",function(){return B.zc}),n.d(r,"version_core",function(){return B.De}),n.d(r,"nextFrame",function(){return B.Mc}),n.d(r,"enableProdMode",function(){return B.wb}),n.d(r,"disableDeprecationWarnings",function(){return B.pb}),n.d(r,"deprecationWarn",function(){return B.mb}),n.d(r,"browser",function(){return B.R}),n.d(r,"environment",function(){return B.xb}),n.d(r,"io",function(){return B.Xb}),n.d(r,"math",function(){return B.tc}),n.d(r,"serialization",function(){return B.Bd}),n.d(r,"test_util",function(){return B.ne}),n.d(r,"util",function(){return B.ye}),n.d(r,"webgl",function(){return B.Ee}),n.d(r,"AdadeltaOptimizer",function(){return B.a}),n.d(r,"AdagradOptimizer",function(){return B.b}),n.d(r,"AdamOptimizer",function(){return B.c}),n.d(r,"AdamaxOptimizer",function(){return B.d}),n.d(r,"MomentumOptimizer",function(){return B.i}),n.d(r,"Optimizer",function(){return B.j}),n.d(r,"RMSPropOptimizer",function(){return B.k}),n.d(r,"SGDOptimizer",function(){return B.n}),n.d(r,"Tensor",function(){return B.o}),n.d(r,"TensorBuffer",function(){return B.p}),n.d(r,"variable",function(){return B.Be}),n.d(r,"Variable",function(){return B.q}),n.d(r,"Rank",function(){return B.l}),n.d(r,"Reduction",function(){return B.m}),n.d(r,"ENV",function(){return B.f}),n.d(r,"Environment",function(){return B.g}),n.d(r,"KernelBackend",function(){return B.h}),n.d(r,"DataStorage",function(){return B.e}),n.d(r,"image",function(){return B.Wb}),n.d(r,"linalg",function(){return B.fc}),n.d(r,"losses",function(){return B.rc}),n.d(r,"spectral",function(){return B.Rd}),n.d(r,"fused",function(){return B.Kb}),n.d(r,"op",function(){return B.Tc}),n.d(r,"batchNormalization2d",function(){return B.N}),n.d(r,"batchNormalization3d",function(){return B.O}),n.d(r,"batchNormalization4d",function(){return B.P}),n.d(r,"batchNormalization",function(){return B.M}),n.d(r,"batchNorm",function(){return B.I}),n.d(r,"batchNorm2d",function(){return B.J}),n.d(r,"batchNorm3d",function(){return B.K}),n.d(r,"batchNorm4d",function(){return B.L}),n.d(r,"complex",function(){return B.X}),n.d(r,"real",function(){return B.ld}),n.d(r,"imag",function(){return B.Vb}),n.d(r,"concat",function(){return B.Y}),n.d(r,"concat1d",function(){return B.Z}),n.d(r,"concat2d",function(){return B.ab}),n.d(r,"concat3d",function(){return B.bb}),n.d(r,"concat4d",function(){return B.cb}),n.d(r,"split",function(){return B.Sd}),n.d(r,"conv1d",function(){return B.db}),n.d(r,"conv2d",function(){return B.eb}),n.d(r,"conv3d",function(){return B.hb}),n.d(r,"conv2dDerFilter",function(){return B.fb}),n.d(r,"depthwiseConv2d",function(){return B.ob}),n.d(r,"separableConv2d",function(){return B.Ad}),n.d(r,"conv2dTranspose",function(){return B.gb}),n.d(r,"matMul",function(){return B.sc}),n.d(r,"dot",function(){return B.ub}),n.d(r,"outerProduct",function(){return B.Uc}),n.d(r,"reverse",function(){return B.pd}),n.d(r,"reverse1d",function(){return B.qd}),n.d(r,"reverse2d",function(){return B.rd}),n.d(r,"reverse3d",function(){return B.sd}),n.d(r,"reverse4d",function(){return B.td}),n.d(r,"maxPool",function(){return B.vc}),n.d(r,"avgPool",function(){return B.G}),n.d(r,"pool",function(){return B.ad}),n.d(r,"slice",function(){return B.Id}),n.d(r,"slice1d",function(){return B.Jd}),n.d(r,"slice2d",function(){return B.Kd}),n.d(r,"slice3d",function(){return B.Ld}),n.d(r,"slice4d",function(){return B.Md}),n.d(r,"abs",function(){return B.r}),n.d(r,"acos",function(){return B.s}),n.d(r,"acosh",function(){return B.t}),n.d(r,"asin",function(){return B.B}),n.d(r,"asinh",function(){return B.C}),n.d(r,"atan",function(){return B.D}),n.d(r,"atanh",function(){return B.F}),n.d(r,"ceil",function(){return B.U}),n.d(r,"clipByValue",function(){return B.V}),n.d(r,"cos",function(){return B.ib}),n.d(r,"cosh",function(){return B.jb}),n.d(r,"erf",function(){return B.Ab}),n.d(r,"exp",function(){return B.Bb}),n.d(r,"expm1",function(){return B.Db}),n.d(r,"floor",function(){return B.Hb}),n.d(r,"log",function(){return B.ic}),n.d(r,"log1p",function(){return B.jc}),n.d(r,"logSigmoid",function(){return B.kc}),n.d(r,"neg",function(){return B.Lc}),n.d(r,"reciprocal",function(){return B.md}),n.d(r,"round",function(){return B.vd}),n.d(r,"rsqrt",function(){return B.wd}),n.d(r,"sigmoid",function(){return B.Ed}),n.d(r,"sign",function(){return B.Fd}),n.d(r,"sin",function(){return B.Gd}),n.d(r,"sinh",function(){return B.Hd}),n.d(r,"softplus",function(){return B.Od}),n.d(r,"sqrt",function(){return B.Td}),n.d(r,"square",function(){return B.Ud}),n.d(r,"step",function(){return B.Zd}),n.d(r,"tan",function(){return B.ee}),n.d(r,"tanh",function(){return B.fe}),n.d(r,"all",function(){return B.x}),n.d(r,"any",function(){return B.y}),n.d(r,"argMax",function(){return B.z}),n.d(r,"argMin",function(){return B.A}),n.d(r,"logSumExp",function(){return B.mc}),n.d(r,"max",function(){return B.uc}),n.d(r,"mean",function(){return B.yc}),n.d(r,"min",function(){return B.Ac}),n.d(r,"moments",function(){return B.Fc}),n.d(r,"sum",function(){return B.de}),n.d(r,"prod",function(){return B.fd}),n.d(r,"equal",function(){return B.yb}),n.d(r,"equalStrict",function(){return B.zb}),n.d(r,"greater",function(){return B.Qb}),n.d(r,"greaterEqual",function(){return B.Rb}),n.d(r,"greaterEqualStrict",function(){return B.Sb}),n.d(r,"greaterStrict",function(){return B.Tb}),n.d(r,"less",function(){return B.bc}),n.d(r,"lessEqual",function(){return B.cc}),n.d(r,"lessEqualStrict",function(){return B.dc}),n.d(r,"lessStrict",function(){return B.ec}),n.d(r,"notEqual",function(){return B.Oc}),n.d(r,"notEqualStrict",function(){return B.Pc}),n.d(r,"add",function(){return B.u}),n.d(r,"addN",function(){return B.v}),n.d(r,"addStrict",function(){return B.w}),n.d(r,"atan2",function(){return B.E}),n.d(r,"div",function(){return B.sb}),n.d(r,"divStrict",function(){return B.tb}),n.d(r,"floorDiv",function(){return B.Ib}),n.d(r,"maximum",function(){return B.wc}),n.d(r,"maximumStrict",function(){return B.xc}),n.d(r,"minimum",function(){return B.Bc}),n.d(r,"minimumStrict",function(){return B.Cc}),n.d(r,"mod",function(){return B.Dc}),n.d(r,"modStrict",function(){return B.Ec}),n.d(r,"mul",function(){return B.Hc}),n.d(r,"mulStrict",function(){return B.Ic}),n.d(r,"pow",function(){return B.bd}),n.d(r,"powStrict",function(){return B.cd}),n.d(r,"squaredDifference",function(){return B.Vd}),n.d(r,"squaredDifferenceStrict",function(){return B.Wd}),n.d(r,"sub",function(){return B.be}),n.d(r,"subStrict",function(){return B.ce}),n.d(r,"elu",function(){return B.vb}),n.d(r,"leakyRelu",function(){return B.ac}),n.d(r,"prelu",function(){return B.dd}),n.d(r,"relu",function(){return B.nd}),n.d(r,"selu",function(){return B.zd}),n.d(r,"logicalAnd",function(){return B.nc}),n.d(r,"logicalNot",function(){return B.oc}),n.d(r,"logicalOr",function(){return B.pc}),n.d(r,"logicalXor",function(){return B.qc}),n.d(r,"where",function(){return B.Fe}),n.d(r,"whereAsync",function(){return B.Ge}),n.d(r,"buffer",function(){return B.S}),n.d(r,"toPixels",function(){return B.re}),n.d(r,"print",function(){return B.ed}),n.d(r,"batchToSpaceND",function(){return B.Q}),n.d(r,"cast",function(){return B.T}),n.d(r,"clone",function(){return B.W}),n.d(r,"cumsum",function(){return B.kb}),n.d(r,"depthToSpace",function(){return B.nb}),n.d(r,"expandDims",function(){return B.Cb}),n.d(r,"eye",function(){return B.Eb}),n.d(r,"fromPixels",function(){return B.Jb}),n.d(r,"multinomial",function(){return B.Kc}),n.d(r,"oneHot",function(){return B.Qc}),n.d(r,"pad",function(){return B.Vc}),n.d(r,"pad1d",function(){return B.Wc}),n.d(r,"pad2d",function(){return B.Xc}),n.d(r,"pad3d",function(){return B.Yc}),n.d(r,"pad4d",function(){return B.Zc}),n.d(r,"rand",function(){return B.hd}),n.d(r,"randomNormal",function(){return B.id}),n.d(r,"randomUniform",function(){return B.jd}),n.d(r,"reshape",function(){return B.od}),n.d(r,"spaceToBatchND",function(){return B.Pd}),n.d(r,"squeeze",function(){return B.Xd}),n.d(r,"stack",function(){return B.Yd}),n.d(r,"tile",function(){return B.pe}),n.d(r,"truncatedNormal",function(){return B.ve}),n.d(r,"unstack",function(){return B.xe}),n.d(r,"setdiff1dAsync",function(){return B.Dd}),n.d(r,"fill",function(){return B.Gb}),n.d(r,"linspace",function(){return B.gc}),n.d(r,"ones",function(){return B.Rc}),n.d(r,"range",function(){return B.kd}),n.d(r,"scalar",function(){return B.xd}),n.d(r,"tensor",function(){return B.ge}),n.d(r,"tensor1d",function(){return B.he}),n.d(r,"tensor2d",function(){return B.ie}),n.d(r,"tensor3d",function(){return B.je}),n.d(r,"tensor4d",function(){return B.ke}),n.d(r,"tensor5d",function(){return B.le}),n.d(r,"tensor6d",function(){return B.me}),n.d(r,"zeros",function(){return B.He}),n.d(r,"onesLike",function(){return B.Sc}),n.d(r,"zerosLike",function(){return B.Ie}),n.d(r,"transpose",function(){return B.ue}),n.d(r,"softmax",function(){return B.Nd}),n.d(r,"logSoftmax",function(){return B.lc}),n.d(r,"localResponseNormalization",function(){return B.hc}),n.d(r,"norm",function(){return B.Nc}),n.d(r,"gather",function(){return B.Lb}),n.d(r,"unsortedSegmentSum",function(){return B.we}),n.d(r,"basicLSTMCell",function(){return B.H}),n.d(r,"multiRNNCell",function(){return B.Jc}),n.d(r,"movingAverage",function(){return B.Gc}),n.d(r,"stridedSlice",function(){return B.ae}),n.d(r,"topk",function(){return B.se}),n.d(r,"scatterND",function(){return B.yd}),n.d(r,"fft",function(){return B.Fb}),n.d(r,"ifft",function(){return B.Ub}),n.d(r,"rfft",function(){return B.ud}),n.d(r,"irfft",function(){return B.Yb}),n.d(r,"sparseToDense",function(){return B.Qd}),n.d(r,"gatherND",function(){return B.Mb}),n.d(r,"train",function(){return B.te}),n.d(r,"tidy",function(){return B.oe}),n.d(r,"keep",function(){return B.Zb}),n.d(r,"dispose",function(){return B.qb}),n.d(r,"time",function(){return B.qe}),n.d(r,"profile",function(){return B.gd}),n.d(r,"customGrad",function(){return B.lb}),n.d(r,"grad",function(){return B.Ob}),n.d(r,"grads",function(){return B.Pb}),n.d(r,"valueAndGrad",function(){return B.ze}),n.d(r,"valueAndGrads",function(){return B.Ae}),n.d(r,"variableGrads",function(){return B.Ce}),n.d(r,"data",function(){return Qu}),n.d(r,"version",function(){return tc}),n.d(r,"constraints",function(){return yt}),n.d(r,"initializers",function(){return Je}),n.d(r,"layers",function(){return Hu}),n.d(r,"metrics",function(){return $u}),n.d(r,"models",function(){return Gu}),n.d(r,"regularizers",function(){return Xu}),n.d(r,"CallbackList",function(){return Cn}),n.d(r,"CustomCallback",function(){return Rn}),n.d(r,"History",function(){return Mn}),n.d(r,"Callback",function(){return Yu}),n.d(r,"InputSpec",function(){return ln}),n.d(r,"SymbolicTensor",function(){return fn}),n.d(r,"Model",function(){return ii}),n.d(r,"input",function(){return di}),n.d(r,"loadLayersModel",function(){return pi}),n.d(r,"loadModel",function(){return hi}),n.d(r,"model",function(){return li}),n.d(r,"registerCallbackConstructor",function(){return mi}),n.d(r,"sequential",function(){return fi}),n.d(r,"RNN",function(){return Qs}),n.d(r,"Sequential",function(){return ui}),n.d(r,"LayerVariable",function(){return on}),n.d(r,"version_layers",function(){return Cr}),n.d(r,"loadFrozenModel",function(){return Ju.d}),n.d(r,"loadGraphModel",function(){return Ju.e}),n.d(r,"FrozenModel",function(){return Ju.a}),n.d(r,"loadTfHubModule",function(){return Ju.f}),n.d(r,"GraphModel",function(){return Ju.c}),n.d(r,"FrozenModelJSON",function(){return Ju.b}),n.d(r,"version_converter",function(){return Ju.g});n(243);var B=n(0),i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function u(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var o,I=function(){return(I=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function N(o,a,s,u){return new(s||(s=Promise))(function(t,e){function n(t){try{i(u.next(t))}catch(t){e(t)}}function r(t){try{i(u.throw(t))}catch(t){e(t)}}function i(e){e.done?t(e.value):new s(function(t){t(e.value)}).then(n,r)}i((u=u.apply(o,a||[])).next())})}function P(n,r){var i,o,a,t,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(a=2&e[0]?o.return:e[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,e[1])).done)return a;switch(o=0,a&&(e=[2&e[0],a.value]),e[0]){case 0:case 1:a=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,o=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){s.label=e[1];break}if(6===e[0]&&s.label<a[1]){s.label=a[1],a=e;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(e);break}a[2]&&s.ops.pop(),s.trys.pop();continue}e=r.call(n,s)}catch(t){e=[6,t],o=0}finally{i=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}function f(){return null==o&&(o=B.f.get("EPSILON")),o}var a=0;function s(){return a++}var c={};function rt(t){return void 0===t&&(t=""),t in c||(c[t]=0),c[t]+=1,t+c[t].toString()}var l={float32:{},int32:{}},h="float32";function O(t,e){return void 0===e&&(e=h),null==l[e][t]&&(l[e][t]=Object(B.xd)(t,e),Object(B.Zb)(l[e][t])),l[e][t]}var p,d,m,g,y,v,b=(u(A,v=Error),A),it=(u(k,y=Error),k),ot=(u(S,g=Error),S),R=(u(E,m=Error),E),w=(u(x,d=Error),x);u(_,p=Error);function _(t){var e=p.call(this,t)||this;return Object.setPrototypeOf(e,_.prototype),e}function x(t){var e=d.call(this,t)||this;return Object.setPrototypeOf(e,x.prototype),e}function E(t){var e=m.call(this,t)||this;return Object.setPrototypeOf(e,E.prototype),e}function S(t){var e=g.call(this,t)||this;return Object.setPrototypeOf(e,S.prototype),e}function k(t){var e=y.call(this,t)||this;return Object.setPrototypeOf(e,k.prototype),e}function A(t){var e=v.call(this,t)||this;return Object.setPrototypeOf(e,A.prototype),e}function D(t,e){if(Array.isArray(t)){for(var n=[],r=0;r<e;r++)n=n.concat(t);return n}return(n=new Array(e)).fill(t),n}function at(t,e){if(!t)throw new w(e)}function C(t,e){for(var n=0,r=0,i=t;r<i.length;r++)i[r]===e&&n++;return n}function T(t){return 1===t.length?t[0]:t}function L(t){return Array.isArray(t)?t:[t]}function M(t){var e=t.replace(/(.)([A-Z][a-z0-9]+)/g,"$1_$2").replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase();return"_"!==e[0]?e:"private"+e}function j(t){return t.length<=1?t:-1===t.indexOf("_")?t:t.replace(/[_]+(\w|$)/g,function(t,e){return e.toUpperCase()})}var F={};function z(t){return null==t?null:{className:t.getClassName(),config:t.getConfig()}}function U(t,e,n,r,i){if(void 0===e&&(e={}),void 0===n&&(n={}),void 0===r&&(r="object"),void 0===i&&(i=!1),"string"==typeof t){var o=t,a=void 0;if(o in n)a=n[o];else if(o in F)a=F[o];else if(null==(a=e[o]))throw new ot("Unknown "+r+": "+t+". This may be due to one of the following reasons:\n1. The "+r+" is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.\n2. The custom "+r+" is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().");return a}var s=t;if(null==s.className||null==s.config)throw new ot(r+": Improper config format: "+JSON.stringify(s)+".\n'className' and 'config' must set.");var u,c,l,f=s.className,h=void 0,p=void 0;if(f in n?(h=(u=n.get(f))[0],p=u[1]):f in F?(h=(c=F.className)[0],p=c[1]):f in e&&(h=(l=e[f])[0],p=l[1]),null==h)throw new ot("Unknown "+r+": "+f+". This may be due to one of the following reasons:\n1. The "+r+" is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.\n2. The custom "+r+" is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().");if(null!=p){for(var d={},m=0,g=Object.keys(F);m<g.length;m++)d[x=g[m]]=F[x];for(var y=0,v=Object.keys(n);y<v.length;y++)d[x=v[y]]=n[x];s.config.customObjects=d;for(var b=I({},F),w=0,_=Object.keys(n);w<_.length;w++){var x=_[w];F[x]=n[x]}!function e(t){if(null!=t&&"object"==typeof t)if(Array.isArray(t))t.forEach(function(t){return e(t)});else for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n],o=t[i];null!=o&&"object"==typeof o&&(Array.isArray(o)||"ndarray"!==o.type||"number"!=typeof o.value?e(o):t[i]=o.value)}}(s.config);var E=p(h,s.config,n,i);return F=I({},b),E}b=I({},F);for(var S=0,N=Object.keys(n);S<N.length;S++)x=N[S],F[x]=n[x];return E=new h(s.config),F=I({},b),E}function st(t,e){return-1*function(t,e){return t<e?-1:e<t?1:0}(t,e)}function ut(t){if(null==t)return t;for(var e=[],n=0,r=t;n<r.length;n++){var i=r[n];-1===e.indexOf(i)&&e.push(i)}return e}function V(t){if(null==t)throw new ot("Invalid value in obj: "+JSON.stringify(t));for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}function W(t,e,n){if(null!=n&&t.indexOf(n)<0)throw new ot(n+" is not a valid "+e+".  Valid values are "+t+" or null/undefined.")}function q(t,e,n,r){return void 0===n&&(n=0),void 0===r&&(r=1/0),at(0<=n),at(n<=r),Array.isArray(t)&&t.length>=n&&t.length<=r&&t.every(function(t){return typeof t===e})}function H(t,e){return Object(B.oe)(function(){return Object(B.Td)(Object(B.de)(Object(B.Ic)(t,t),e,!0))})}var $,G,K=(u(Z,G=B.Bd.Serializable),Z.prototype.getConfig=function(){return{}},Z),X=(u(Y,$=K),Y.prototype.apply=function(n){var r=this;return Object(B.oe)(function(){var t=H(n,r.axis),e=Object(B.V)(t,0,r.maxValue);return Object(B.Hc)(n,Object(B.sb)(e,Object(B.u)(O(f()),t)))})},Y.prototype.getConfig=function(){return{maxValue:this.maxValue,axis:this.axis}},Y.className="MaxNorm",Y);function Y(t){var e=$.call(this)||this;return e.defaultMaxValue=2,e.defaultAxis=0,e.maxValue=null!=t.maxValue?t.maxValue:e.defaultMaxValue,e.axis=null!=t.axis?t.axis:e.defaultAxis,e}function Z(){return null!==G&&G.apply(this,arguments)||this}B.Bd.registerClass(X);var J,Q=(u(tt,J=K),tt.prototype.apply=function(t){var e=this;return Object(B.oe)(function(){return Object(B.sb)(t,Object(B.u)(O(f()),H(t,e.axis)))})},tt.prototype.getConfig=function(){return{axis:this.axis}},tt.className="UnitNorm",tt);function tt(t){var e=J.call(this)||this;return e.defaultAxis=0,e.axis=null!=t.axis?t.axis:e.defaultAxis,e}B.Bd.registerClass(Q);var et,nt=(u(ct,et=K),ct.prototype.apply=function(t){return Object(B.nd)(t)},ct.className="NonNeg",ct);function ct(){return null!==et&&et.apply(this,arguments)||this}B.Bd.registerClass(nt);var lt,ft=(u(ht,lt=K),ht.prototype.apply=function(n){var r=this;return Object(B.oe)(function(){var t=H(n,r.axis),e=Object(B.u)(Object(B.Hc)(O(r.rate),Object(B.V)(t,r.minValue,r.maxValue)),Object(B.Hc)(O(1-r.rate),t));return Object(B.Hc)(n,Object(B.sb)(e,Object(B.u)(O(f()),t)))})},ht.prototype.getConfig=function(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}},ht.className="MinMaxNorm",ht);function ht(t){var e=lt.call(this)||this;return e.defaultMinValue=0,e.defaultMaxValue=1,e.defaultRate=1,e.defaultAxis=0,e.minValue=null!=t.minValue?t.minValue:e.defaultMinValue,e.maxValue=null!=t.maxValue?t.maxValue:e.defaultMaxValue,e.rate=null!=t.rate?t.rate:e.defaultRate,e.axis=null!=t.axis?t.axis:e.defaultAxis,e}B.Bd.registerClass(ft);var pt={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function dt(t){return z(t)}function mt(t,e){return void 0===e&&(e={}),U(t,B.Bd.SerializationMap.getMap().classNameMap,e,"constraint")}function gt(t){return null==t?null:"string"==typeof t?mt({className:t in pt?pt[t]:t,config:{}}):t instanceof K?t:mt(t)}var yt=Object.freeze({maxNorm:function(t){return new X(t)},unitNorm:function(t){return new Q(t)},nonNeg:function(){return new nt},minMaxNorm:function(t){return new ft(t)}}),vt=["channelsFirst","channelsLast"],bt=["valid","same","causal"],wt=["max","avg"],_t=["sum","mul","concat","ave"],xt=new Map;function Et(t){W(vt,"DataFormat",t)}function St(t){W(bt,"PaddingMode",t)}var Nt=[],It="/";function Ot(t,e){Nt.push(t);try{var n=e();return Nt.pop(),n}catch(t){throw Nt.pop(),t}}function kt(t){if(!Pt(t))throw new Error("Not a valid tensor name: '"+t+"'");return(0===Nt.length?"":Nt.join(It)+It)+t}function At(t){if(!Pt(t))throw new Error("Not a valid tensor name: '"+t+"'");xt.has(t)||xt.set(t,0);var e=xt.get(t);if(xt.set(t,xt.get(t)+1),0<e){var n=t+"_"+e;return xt.set(n,1),n}return t}var Ct=new RegExp(/^[A-Za-z][-A-Za-z0-9\._\/]*$/);function Pt(t){return!!t.match(Ct)}function Tt(t,e,n){null==e&&(e=0),null==n&&(n=t.length);for(var r=1,i=e;i<n;++i)r*=t[i];return r}function Mt(t){return t=Array.isArray(t)?new Float32Array(t):t,Object(B.he)(t)}function Rt(t){return Object(B.Ac)(Mt(t)).dataSync()[0]}function Dt(t){return Object(B.uc)(Mt(t)).dataSync()[0]}function jt(t,e){if(e<t)throw new ot("end ("+e+") < begin ("+t+") is forbidden.");for(var n=[],r=t;r<e;++r)n.push(r);return n}function Bt(t,e){return t.asType(e)}function Lt(t,e){void 0===e&&(e=-1);var n=t.shape.slice();return e<0&&(e=n.length+e+1),n.splice(e,0,1),t.reshape(n)}function Ft(t,e,n){return Object(B.oe)(function(){switch(t.rank){case 1:return Object(B.Jd)(t,e,n);case 2:return Object(B.Kd)(t,[e,0],[n,t.shape[1]]);case 3:return Object(B.Ld)(t,[e,0,0],[n,t.shape[1],t.shape[2]]);case 4:return Object(B.Md)(t,[e,0,0,0],[n,t.shape[1],t.shape[2],t.shape[3]]);default:throw new ot("sliceAlongFirstAxis() received an unsupported tensor rank: "+t.rank)}})}function zt(t,e,n){return Object(B.oe)(function(){switch(t.rank){case 1:return Object(B.Jd)(t,e,n);case 2:return Object(B.Kd)(t,[0,e],[t.shape[0],n]);case 3:return Object(B.Ld)(t,[0,0,e],[t.shape[0],t.shape[1],n]);case 4:return Object(B.Md)(t,[0,0,0,e],[t.shape[0],t.shape[1],t.shape[2],n]);default:throw new ot("sliceAlongLastAxis() received an unsupported tensor rank: "+t.rank)}})}function Ut(t,e,n,r){return Object(B.oe)(function(){switch(t.rank){case 1:return Object(B.Jd)(t,e,n);case 2:switch(r){case 1:return Ft(t,e,n);case 2:return zt(t,e,n);default:throw new ot("The axis is not within the rank of the tensor "+r)}case 3:switch(r){case 1:return Ft(t,e,n);case 2:return Object(B.Ld)(t,[0,e,0],[t.shape[0],n,t.shape[2]]);case 3:return zt(t,e,n);default:throw new ot("The axis is not within the rank of the tensor "+r)}case 4:switch(r){case 1:return Ft(t,e,n);case 2:return Object(B.Md)(t,[0,e,0,0],[t.shape[0],n,t.shape[2],t.shape[3]]);case 3:return Object(B.Md)(t,[0,0,e,0],[t.shape[0],t.shape[1],n,t.shape[3]]);case 4:return zt(t,e,n);default:throw new ot("The axis is not within the rank of the tensor "+r)}default:throw new ot("sliceAlongLastAxis() received an unsupported tensor rank: "+t.rank)}})}function Vt(t,e){var n;return void 0===e&&(e=-1),e<0&&(e=0!==(n=t[0].rank)?n:0),e===t[0].rank&&(e=-1),Object(B.Y)(t,e)}function Wt(t,e){switch(t.rank){case 1:return Object(B.Z)([t,e]);case 2:return Object(B.ab)([t,e],0);case 3:return Object(B.bb)([t,e],0);case 4:return Object(B.cb)([t,e],0);default:throw new ot("concatAlongFirstAxis() received an unsupported tensor rank: "+t.rank)}}function qt(t,e){if(Array.isArray(e)||(e=[e]),t.rank!==e.length)throw new ot("The length of input n ("+e.length+") does not match the number of dimensions in input x ("+t.rank+")");return Object(B.pe)(t,e)}function Ht(t,e,n,r,i){return void 0===e&&(e=0),void 0===n&&(n=1),Object(B.id)(t,e,n,r,i)}function $t(t,n){if(t.rank<2||n.rank<2)throw new R("dot requires both inputs to be rank >= 2 but got x shape = "+t.shape+" and y shape = "+n.shape);if(3<=n.rank&&(r=t.shape.slice(-1)[0])!==(a=n.shape.slice(-2)[0]))throw new R("If rank y >= 3, then the second last dim of y must equal the last dim of x but got x shape = "+t.shape+" and  y shape = "+n.shape);if(2===t.rank&&2===n.rank)return Object(B.sc)(t,n);var e=t.shape.slice(),r=e.pop();t=t.reshape([-1,r]);var i=n.shape.slice(),o=i.pop(),a=i.pop(),s=i.concat([o]),u=Array.from({length:n.rank},function(t,e){return 0===e?n.rank-2:e<=n.rank-2?e-1:e});n=n.transpose(u).reshape([a,-1]);var c=e.concat(s);return Object(B.sc)(t,n).reshape(c)}function Gt(t,e,n){return Object(B.oe)(function(){return e=Array.isArray(e)?Object(B.he)(e,"int32"):e.toInt(),Object(B.Lb)(t,e,n)})}function Kt(t){return Object(B.Ic)(t,t)}function Xt(n,r,i){return Object(B.oe)(function(){if(null==i&&(i="channelsLast"),Et(i),1!==r.rank&&r.rank!==n.rank)throw new ot("Unexpected bias dimensions: "+r.rank+"; expected it to be 1 or "+n.rank);var t,e=r.shape;if(5===n.rank)"channelsFirst"===i?t=1===e.length?n.add(r.reshape([1,e[0],1,1,1])):n.add(r.reshape([1,e[3],e[0],e[1],e[2]])):"channelsLast"===i&&(t=1===e.length?n.add(r.reshape([1,1,1,1,e[0]])):n.add(r.reshape([1].concat(e))));else if(4===n.rank)"channelsFirst"===i?t=1===e.length?n.add(r.reshape([1,e[0],1,1])):n.add(r.reshape([1,e[2],e[0],e[1]])):"channelsLast"===i&&(t=1===e.length?n.add(r.reshape([1,1,1,e[0]])):n.add(r.reshape([1].concat(e))));else if(3===n.rank)"channelsFirst"===i?t=1===e.length?n.add(r.reshape([1,e[0],1])):n.add(r.reshape([1,e[1],e[0]])):"channelsLast"===i&&(t=1===e.length?n.add(r.reshape([1,1,e[0]])):n.add(r.reshape([1].concat(e))));else{if(!(n.rank<3))throw new ot("Unsupported input rank by biasAdd: "+n.rank);t=n.add(r)}return t})}function Yt(e,n,r,i){return Object(B.oe)(function(){if(null!=r&&!B.ye.arraysEqual(e.shape,r))throw new R("Non-default noise shape is not implemented yet: "+JSON.stringify(r));if(null!=i)throw new R("seed is not implemented for dropout yet.");var t=Object(B.Zd)(Object(B.u)(Object(B.Lc)(n),Object(B.jd)(e.shape,0,1,"float32")));return t=Object(B.Hc)(Object(B.sb)(O(1),Object(B.be)(O(1),n)),t),Object(B.Hc)(e,t)})}function Zt(t,e,n){return void 0===n&&(n=!1),n?t():e()}var Jt=["fanIn","fanOut","fanAvg"],Qt=["normal","uniform"];var te,ee,ne=(u(oe,ee=B.Bd.Serializable),oe.prototype.fromConfigUsesCustomObjects=function(){return!1},oe.prototype.getConfig=function(){return{}},oe),re=(u(ie,te=ne),ie.prototype.apply=function(t,e){return Object(B.He)(t,e)},ie.className="Zeros",ie);function ie(){return null!==te&&te.apply(this,arguments)||this}function oe(){return null!==ee&&ee.apply(this,arguments)||this}B.Bd.registerClass(re);var ae,se=(u(ue,ae=ne),ue.prototype.apply=function(t,e){return Object(B.Rc)(t,e)},ue.className="Ones",ue);function ue(){return null!==ae&&ae.apply(this,arguments)||this}B.Bd.registerClass(se);var ce,le=(u(fe,ce=ne),fe.prototype.apply=function(t,e){var n=this;return Object(B.oe)(function(){return Object(B.Hc)(Object(B.xd)(n.value),Object(B.Rc)(t,e))})},fe.prototype.getConfig=function(){return{value:this.value}},fe.className="Constant",fe);function fe(t){var e=ce.call(this)||this;if("object"!=typeof t)throw new ot("Expected argument of type ConstantConfig but got "+t);if(void 0===t.value)throw new ot("config must have value set but got "+t);return e.value=t.value,e}B.Bd.registerClass(le);var he,pe=(u(de,he=ne),de.prototype.apply=function(t,e){return Object(B.jd)(t,this.minval,this.maxval,e)},de.prototype.getConfig=function(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}},de.className="RandomUniform",de);function de(t){var e=he.call(this)||this;return e.DEFAULT_MINVAL=-.05,e.DEFAULT_MAXVAL=.05,e.minval=t.minval||e.DEFAULT_MINVAL,e.maxval=t.maxval||e.DEFAULT_MAXVAL,e.seed=t.seed,e}B.Bd.registerClass(pe);var me,ge=(u(ye,me=ne),ye.prototype.apply=function(t,e){if("float32"!==(e=e||"float32")&&"int32"!==e)throw new R("randomNormal does not support dType "+e+".");return Ht(t,this.mean,this.stddev,e,this.seed)},ye.prototype.getConfig=function(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}},ye.className="RandomNormal",ye);function ye(t){var e=me.call(this)||this;return e.DEFAULT_MEAN=0,e.DEFAULT_STDDEV=.05,e.mean=t.mean||e.DEFAULT_MEAN,e.stddev=t.stddev||e.DEFAULT_STDDEV,e.seed=t.seed,e}B.Bd.registerClass(ge);var ve,be=(u(we,ve=ne),we.prototype.apply=function(t,e){if("float32"!==(e=e||"float32")&&"int32"!==e)throw new R("truncatedNormal does not support dType "+e+".");return Object(B.ve)(t,this.mean,this.stddev,e,this.seed)},we.prototype.getConfig=function(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}},we.className="TruncatedNormal",we);function we(t){var e=ve.call(this)||this;return e.DEFAULT_MEAN=0,e.DEFAULT_STDDEV=.05,e.mean=t.mean||e.DEFAULT_MEAN,e.stddev=t.stddev||e.DEFAULT_STDDEV,e.seed=t.seed,e}B.Bd.registerClass(be);var _e,xe=(u(Ee,_e=ne),Ee.prototype.apply=function(t,e){var n=this;return Object(B.oe)(function(){if(2!==t.length||t[0]!==t[1])throw new ot("Identity matrix initializer can only be used for 2D square matrices.");return Object(B.Hc)(n.gain,Object(B.Eb)(t[0]))})},Ee.prototype.getConfig=function(){return{gain:this.gain.get()}},Ee.className="Identity",Ee);function Ee(t){var e=_e.call(this)||this;return e.gain=null!=t.gain?Object(B.xd)(t.gain):O(1),e}B.Bd.registerClass(xe);var Se,Ne=(u(Ie,Se=ne),Ie.prototype.apply=function(t,e){var n=function(t,e){var n,r;if(void 0===e&&(e="channelsLast"),Et(e),2===t.length)n=t[0],r=t[1];else if(-1!==[3,4,5].indexOf(t.length))if("channelsFirst"===e){var i=Tt(t,2);n=t[1]*i,r=t[0]*i}else"channelsLast"===e&&(i=Tt(t,0,t.length-2),n=t[t.length-2]*i,r=t[t.length-1]*i);else{var o=Tt(t);n=Math.sqrt(o),r=Math.sqrt(o)}return[n,r]}(t),r=n[0],i=n[1],o=this.scale;if("fanIn"===this.mode?o/=Math.max(1,r):"fanOut"===this.mode?o/=Math.max(1,i):o/=Math.max(1,(r+i)/2),"normal"===this.distribution){var a=Math.sqrt(o);if("float32"!==(e=e||"float32")&&"int32"!==e)throw new R(this.getClassName()+" does not support dType "+e+".");return Object(B.ve)(t,0,a,e,this.seed)}var s=Math.sqrt(3*o);return Object(B.jd)(t,-s,s,e)},Ie.prototype.getConfig=function(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}},Ie.className="VarianceScaling",Ie);function Ie(t){var e=Se.call(this)||this;if(t.scale<0)throw new ot("scale must be a positive float. Got: "+t.scale);return e.scale=null==t.scale?1:t.scale,e.mode=t.mode,function(t){W(Jt,"FanMode",t)}(e.mode),e.distribution=t.distribution,function(t){W(Qt,"Distribution",t)}(e.distribution),e.seed=t.seed,e}B.Bd.registerClass(Ne);var Oe,ke=(u(Ae,Oe=Ne),Ae.prototype.getClassName=function(){return Ne.className},Ae.className="GlorotUniform",Ae);function Ae(t){return Oe.call(this,{scale:1,mode:"fanAvg",distribution:"uniform",seed:null==t?null:t.seed})||this}B.Bd.registerClass(ke);var Ce,Pe=(u(Te,Ce=Ne),Te.prototype.getClassName=function(){return Ne.className},Te.className="GlorotNormal",Te);function Te(t){return Ce.call(this,{scale:1,mode:"fanAvg",distribution:"normal",seed:null==t?null:t.seed})||this}B.Bd.registerClass(Pe);var Me,Re=(u(De,Me=Ne),De.prototype.getClassName=function(){return Ne.className},De.className="HeNormal",De);function De(t){return Me.call(this,{scale:2,mode:"fanIn",distribution:"normal",seed:null==t?null:t.seed})||this}B.Bd.registerClass(Re);var je,Be=(u(Le,je=Ne),Le.prototype.getClassName=function(){return Ne.className},Le.className="HeUniform",Le);function Le(t){return je.call(this,{scale:2,mode:"fanIn",distribution:"uniform",seed:null==t?null:t.seed})||this}B.Bd.registerClass(Be);var Fe,ze=(u(Ue,Fe=Ne),Ue.prototype.getClassName=function(){return Ne.className},Ue.className="LeCunNormal",Ue);function Ue(t){return Fe.call(this,{scale:1,mode:"fanIn",distribution:"normal",seed:null==t?null:t.seed})||this}B.Bd.registerClass(ze);var Ve,We=(u(qe,Ve=Ne),qe.prototype.getClassName=function(){return Ne.className},qe.className="LeCunNormal",qe);function qe(t){return Ve.call(this,{scale:1,mode:"fanIn",distribution:"uniform",seed:null==t?null:t.seed})||this}B.Bd.registerClass(We);var He,$e=(u(Ge,He=ne),Ge.prototype.apply=function(n,t){var r=this;return Object(B.oe)(function(){if(2!==n.length)throw new R("The Orthogonal Initializer does not support non-2D shapes yet.");2e3<n[0]*n[1]&&console.warn("Orthogonal initializer is being called on a matrix with more than 2000 ("+n[0]*n[1]+") elements: Slowness may result.");var t=Ht(n[0]>n[1]?[n[1],n[0]]:n,0,1,"float32"),e=B.fc.gramSchmidt(t);return n[0]>n[1]&&(e=e.transpose()),Object(B.Hc)(O(r.gain),e)})},Ge.prototype.getConfig=function(){return{gain:this.gain,seed:this.seed}},Ge.className="Orthogonal",Ge);function Ge(t){var e=He.call(this)||this;if(e.DEFAULT_GAIN=1,e.gain=null==t.gain?e.DEFAULT_GAIN:t.gain,e.seed=t.seed,null!=e.seed)throw new R("Random seed is not implemented for Orthogonal Initializer yet.");return e}B.Bd.registerClass($e);var Ke={constant:"Constant",glorotNormal:"GlorotNormal",glorotUniform:"GlorotUniform",heNormal:"HeNormal",heUniform:"HeUniform",identity:"Identity",leCunNormal:"LeCunNormal",leCunUniform:"LeCunUniform",ones:"Ones",orthogonal:"Orthogonal",randomNormal:"RandomNormal",randomUniform:"RandomUniform",truncatedNormal:"TruncatedNormal",varianceScaling:"VarianceScaling",zeros:"Zeros"};function Xe(t,e){return void 0===e&&(e={}),U(t,B.Bd.SerializationMap.getMap().classNameMap,e,"initializer")}function Ye(t){return z(t)}function Ze(t){if("string"!=typeof t)return t instanceof ne?t:Xe(t);var e=t in Ke?Ke[t]:t;return"GlorotNormal"===e?new Pe:"GlorotUniform"===e?new ke:"HeNormal"===e?new Re:"HeUniform"===e?new Be:"LeCunNormal"===e?new ze:"LeCunUniform"===e?new We:Xe({className:e,config:{}})}var Je=Object.freeze({zeros:function(){return new re},ones:function(){return new se},constant:function(t){return new le(t)},randomUniform:function(t){return new pe(t)},randomNormal:function(t){return new ge(t)},truncatedNormal:function(t){return new be(t)},identity:function(t){return new xe(t)},varianceScaling:function(t){return new Ne(t)},glorotUniform:function(t){return new ke(t)},glorotNormal:function(t){return new Pe(t)},heNormal:function(t){return new Re(t)},heUniform:function(t){return new Be(t)},leCunNormal:function(t){return new ze(t)},leCunUniform:function(t){return new We(t)},orthogonal:function(t){return new $e(t)}});function Qe(t){return Array.isArray(t)&&Array.isArray(t[0])}function tn(t){return 0===t.length?[]:Array.isArray(t[0])?t:[t]}function en(t){var e;if(Array.isArray(t)){if(1!==t.length)throw new ot("Expected Tensor length to be 1; got "+t.length);e=t[0]}else e=t;return e}function nn(t){if(Array.isArray(t)&&Array.isArray(t[0])){if(1===t.length)return(t=t)[0];throw new ot("Expected exactly 1 Shape; got "+t.length)}return t}function rn(t){for(var e=0,n=0,r=t;n<r.length;n++){var i=r[n];0===i.shape.length?e+=1:e+=i.shape.reduce(function(t,e){return t*e})}return e}var on=(an.prototype.read=function(){return this.assertNotDisposed(),this.val},an.prototype.write=function(t){return this.assertNotDisposed(),function(t,e){if(t.shape.toString()!==e.shape.toString())throw new Error("Shape mismatch: "+JSON.stringify(t.shape)+" vs. "+JSON.stringify(e.shape))}(this.val,t),this.val.id!==t.id&&(this.val.assign(t),null!=this.constraint&&this.val.assign(this.constraint.apply(this.val))),this},an.prototype.dispose=function(){this.assertNotDisposed(),this.val.dispose()},an.prototype.assertNotDisposed=function(){if(this.val.isDisposed)throw new Error("LayersVariable "+this.name+" is already disposed.")},an);function an(t,e,n,r,i){void 0===e&&(e="float32"),void 0===n&&(n="Variable"),void 0===r&&(r=!0),void 0===i&&(i=null),this.dtype=null==e?"float32":e,this.shape=t.shape,this.id=s(),n=null==n?"Variable":n,this.originalName=kt(n),this.name=At(this.originalName),this.trainable=r,this.constraint=i,this.val=Object(B.Be)(t,this.trainable,this.name,this.dtype)}function sn(t){return t.map(function(t){return t.read()})}function un(t){t.forEach(function(t){t[0].write(t[1])})}var cn,ln=function(t){this.dtype=t.dtype,this.shape=t.shape,null!=t.shape?this.ndim=t.shape.length:this.ndim=t.ndim,this.maxNDim=t.maxNDim,this.minNDim=t.minNDim,this.axes=t.axes||{}},fn=function(t,e,n,r,i,o,a){this.dtype=t,this.shape=e,this.sourceLayer=n,this.inputs=r,this.callArgs=i,this.outputTensorIndex=a,this.id=s(),null!=o&&(this.originalName=kt(o),this.name=At(this.originalName)),this.rank=e.length},hn=0,pn=(yn.prototype.getConfig=function(){for(var t=[],e=0,n=this.inboundLayers;e<n.length;e++){var r=n[e];null!=r?t.push(r.name):t.push(null)}return{outboundLayer:this.outboundLayer?this.outboundLayer.name:null,inboundLayers:t,nodeIndices:this.nodeIndices,tensorIndices:this.tensorIndices}},yn),dn=0,mn=(u(gn,cn=B.Bd.Serializable),gn.nodeKey=function(t,e){return t.name+"_ib-"+e.toString()},gn.prototype.getNodeAtIndex=function(t,e){if(0===this.inboundNodes.length)throw new it("The layer has never been called and thus has no defined "+e+".");if(this.inboundNodes.length<=t)throw new ot("Asked to get "+e+" at node "+t+", but the layer has only "+this.inboundNodes.length+" inbound nodes.");return this.inboundNodes[t]},gn.prototype.getInputAt=function(t){return T(this.getNodeAtIndex(t,"input").inputTensors)},gn.prototype.getOutputAt=function(t){return T(this.getNodeAtIndex(t,"output").outputTensors)},Object.defineProperty(gn.prototype,"input",{get:function(){if(1<this.inboundNodes.length)throw new b("Layer "+this.name+' has multiple inbound nodes, hence the notion of "layer input" is ill-defined. Use `getInputAt(nodeIndex)` instead.');if(0===this.inboundNodes.length)throw new b("Layer "+this.name+" is not connected, no input to return.");return T(this.getNodeAtIndex(0,"input").inputTensors)},enumerable:!0,configurable:!0}),Object.defineProperty(gn.prototype,"output",{get:function(){if(0===this.inboundNodes.length)throw new b("Layer "+this.name+" has no inbound nodes.");if(1<this.inboundNodes.length)throw new b("Layer "+this.name+' has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use `getOutputAt(nodeIndex)` instead.');return T(this.getNodeAtIndex(0,"output").outputTensors)},enumerable:!0,configurable:!0}),Object.defineProperty(gn.prototype,"losses",{get:function(){return this._losses},enumerable:!0,configurable:!0}),gn.prototype.calculateLosses=function(){return this.losses.map(function(t){return t()})},Object.defineProperty(gn.prototype,"updates",{get:function(){return this._updates},enumerable:!0,configurable:!0}),Object.defineProperty(gn.prototype,"built",{get:function(){return this._built},set:function(t){this._built=t},enumerable:!0,configurable:!0}),Object.defineProperty(gn.prototype,"trainableWeights",{get:function(){return this.trainable?this._trainableWeights:[]},set:function(t){this._trainableWeights=t},enumerable:!0,configurable:!0}),Object.defineProperty(gn.prototype,"nonTrainableWeights",{get:function(){return this.trainable?this._nonTrainableWeights:this._trainableWeights.concat(this._nonTrainableWeights)},set:function(t){this._nonTrainableWeights=t},enumerable:!0,configurable:!0}),Object.defineProperty(gn.prototype,"weights",{get:function(){return this.trainableWeights.concat(this.nonTrainableWeights)},enumerable:!0,configurable:!0}),Object.defineProperty(gn.prototype,"stateful",{get:function(){return this._stateful},enumerable:!0,configurable:!0}),gn.prototype.resetStates=function(){if(!this.stateful)throw new Error("Cannot call the resetStates() method of a non-stateful Layer object.")},gn.prototype.assertInputCompatibility=function(t){if(t=L(t),null!=this.inputSpec&&0!==this.inputSpec.length){var e=L(this.inputSpec);if(t.length!==e.length)throw new ot("Layer "+this.name+" expects "+e.length+" inputs, but it received "+t.length+" input tensors. Input received: "+t);for(var n=0;n<t.length;n++){var r=t[n],i=e[n];if(null!=i){var o=r.rank;if(null!=i.ndim&&o!==i.ndim)throw new ot("Input "+n+" is incompatible with layer "+this.name+": expected ndim="+i.ndim+", found ndim="+o);if(null!=i.maxNDim&&o>i.maxNDim)throw new ot("Input "+n+" is incompatible with layer "+this.name+": expected max_ndim="+i.maxNDim+", found ndim="+o);if(null!=i.minNDim&&o<i.minNDim)throw new ot("Input "+n+" is incompatible with layer "+this.name+": expected min_ndim="+i.minNDim+", found ndim="+o+".");if(null!=i.dtype&&r.dtype!==i.dtype)throw new ot("Input "+n+" is incompatible with layer "+this.name+" : expected dtype="+i.dtype+", found dtype="+r.dtype+".");if(i.axes){var a=r.shape;for(var s in i.axes){var u=Number(s),c=i.axes[s],l=0<=u?a[u]:a[a.length+u];if(null!=c&&-1===[c,null].indexOf(l))throw new ot("Input "+n+" is incompatible with layer "+this.name+": expected axis "+u+" of input shape to have value "+c+" but got shape "+a+".")}}if(null!=i.shape)for(var f=0;f<i.shape.length;++f){var h=i.shape[f],p=r.shape[f];if(null!=h&&null!=p&&h!==p)throw new ot("Input "+n+" is incompatible with layer "+this.name+": expected shape="+i.shape+", found shape=${xShape}.")}}}}},gn.prototype.call=function(t,e){return t},gn.prototype.invokeCallHook=function(t,e){null!=this._callHook&&this._callHook(t,e)},gn.prototype.setCallHook=function(t){this._callHook=t},gn.prototype.clearCallHook=function(){this._callHook=null},gn.prototype.apply=function(f,h){var p=this;h=h||{},this.assertNotDisposed();for(var d=L(f),t=!0,e=0,n=d;e<n.length;e++)if(!(n[e]instanceof fn)){t=!1;break}for(var m=!0,r=0,i=d;r<i.length;r++)if(i[r]instanceof fn){m=!1;break}if(t===m)throw new ot("Arguments to apply() must be all SymbolicTensors or all Tensors");return Ot(this.name,function(){if(!p.built){p.assertInputCompatibility(f);for(var t=[],e=0,n=L(f);e<n.length;e++){var r=n[e];t.push(r.shape)}p.build(T(t)),p.built=!0,p.initialWeights&&p.setWeights(p.initialWeights),null===p._refCount&&m&&(p._refCount=1)}if(p.assertInputCompatibility(f),m){for(var i=[],o=0,a=L(l=p.call(f,h));o<a.length;o++){var s=a[o];-1!==d.indexOf(s)&&(s=s.clone()),i.push(s)}if(l=T(i),null!=p.activityRegularizer)throw new R("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return l}var u=function(t){for(var e=[],n=0,r=t=L(t);n<r.length;n++){var i=r[n];e.push(i.shape)}return T(e)}(f),c=p.computeOutputShape(u),l=void 0;if(p.warnOnIncompatibleInputShape(Array.isArray(f)?u[0]:u),l=null!=c&&0<c.length&&Array.isArray(c[0])?c.map(function(t,e){return new fn("float32",t,p,L(f),h,p.name,e)}):new fn("float32",c,p,L(f),h,p.name),p.addInboundNode(f,l,null,null,u,c,h),p._refCount++,null!=p.activityRegularizer)throw new R("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return l})},gn.prototype.warnOnIncompatibleInputShape=function(n){if(null!=this.batchInputShape)if(n.length!==this.batchInputShape.length)console.warn("The rank of the input tensor provided (shape: "+JSON.stringify(n)+") does not match that of the batchInputShape ("+JSON.stringify(this.batchInputShape)+") of the layer "+this.name);else{var r=!1;this.batchInputShape.forEach(function(t,e){null!=t&&null!=n[e]&&n[e]!==t&&(r=!0)}),r&&console.warn("The shape of the input tensor ("+JSON.stringify(n)+") does not match the expectation of layer "+this.name+": "+JSON.stringify(this.batchInputShape))}},Object.defineProperty(gn.prototype,"outputShape",{get:function(){if(null==this.inboundNodes||0===this.inboundNodes.length)throw new b("The layer "+this.name+" has never been called and thus has no defined output shape.");for(var t=[],e=0,n=this.inboundNodes;e<n.length;e++){var r=n[e],i=JSON.stringify(r.outputShapes);-1===t.indexOf(i)&&t.push(i)}if(1!==t.length)throw new b("The layer "+this.name+' has multiple inbound nodes with different output shapes. Hence the notion of "outut shape" is ill-defined for the layer.');var o=this.inboundNodes[0].outputShapes;return Array.isArray(o)&&Array.isArray(o[0])&&1===o.length?o[0]:o},enumerable:!0,configurable:!0}),gn.prototype.countParams=function(){if(!this.built)throw new it("You tried to call countParams() on "+this.name+", but the layer is not built yet. Build it first by calling build(batchInputShape).");return rn(this.weights)},gn.prototype.build=function(t){this.built=!0},gn.prototype.getWeights=function(t){return void 0===t&&(t=!1),sn(t?this.trainableWeights:this.weights)},gn.prototype.setWeights=function(s){var u=this;Object(B.oe)(function(){var t=u.weights;if(t.length!==s.length)throw new ot('You called setWeights(weights) on layer "'+u.name+'" with a weight list of length '+s.length+", but the layer was expecting "+t.length+" weights. Provided weights: "+s+"...");if(0!==t.length){for(var e=[],n=sn(t),r=0;r<n.length;++r){var i=n[r],o=t[r],a=s[r];if(!B.ye.arraysEqual(i.shape,a.shape))throw new ot("Layer weight shape "+i.shape+" not compatible with provided weight shape "+a.shape);e.push([o,a])}un(e)}})},gn.prototype.addWeight=function(t,e,n,r,i,o,a){if(-1!==this._addedWeightNames.indexOf(t))throw new ot("Duplicate weight name "+t+" for layer "+this.name);this._addedWeightNames.push(t),null==n&&(n="float32"),this.fastWeightInitDuringBuild&&(r=Ze("zeros"));var s=r.apply(e,n),u=new on(s,n,t,o,a);return s.dispose(),null!=i&&this.addLoss(function(){return i.apply(u.read())}),null==o&&(o=!0),o?this._trainableWeights.push(u):this._nonTrainableWeights.push(u),u},gn.prototype.setFastWeightInitDuringBuild=function(t){this.fastWeightInitDuringBuild=t},gn.prototype.addLoss=function(t){var e;null==t||Array.isArray(t)&&0===t.length||(t=L(t),void 0!==this._losses&&null!==this._losses&&(e=this.losses).push.apply(e,t))},gn.prototype.computeOutputShape=function(t){return t},gn.prototype.computeMask=function(t,e){var n=this;if(this.supportsMasking)return e;if(null!=e){if(!Array.isArray(e))throw new TypeError("Layer "+this.name+" does not support masking, but was passed an inputMask.");e.forEach(function(t){if(null!=t)throw new TypeError("Layer "+n.name+" does not support masking, but was passed an inputMask.")})}return null},gn.prototype.addInboundNode=function(t,e,n,r,i,o,a){void 0===a&&(a=null);var s=L(t);e=L(e),n=L(n),r=L(r),i=tn(i),o=tn(o);for(var u=[],c=[],l=[],f=0,h=s;f<h.length;f++){var p=h[f];u.push(p.sourceLayer),c.push(p.nodeIndex),l.push(p.tensorIndex)}new pn({outboundLayer:this,inboundLayers:u,nodeIndices:c,tensorIndices:l,inputTensors:s,outputTensors:e,inputMasks:n,outputMasks:r,inputShapes:i,outputShapes:o},a);for(var d=0;d<e.length;d++)e[d].sourceLayer=this,e[d].nodeIndex=this.inboundNodes.length-1,e[d].tensorIndex=d},gn.prototype.getConfig=function(){var t={name:this.name,trainable:this.trainable};return null!=this.batchInputShape&&(t.batchInputShape=this.batchInputShape),null!=this.dtype&&(t.dtype=this.dtype),t},gn.prototype.disposeWeights=function(){return this.weights.forEach(function(t){return t.dispose()}),this.weights.length},gn.prototype.assertNotDisposed=function(){if(0===this._refCount)throw new Error("Layer '"+this.name+"' is already disposed.")},gn.prototype.dispose=function(){if(!this.built)throw new Error("Cannot dispose Layer "+this.name+" because it has not been built yet.");if(null===this._refCount)throw new Error("Cannot dispose Layer "+this.name+" because it has not been used yet.");this.assertNotDisposed();var t=0;return 0==--this._refCount&&(t=this.disposeWeights()),{refCountAfterDispose:this._refCount,numDisposedVariables:t}},gn);function gn(t){var e=cn.call(this)||this;e._callHook=null,e._addedWeightNames=[],e._stateful=!1,e.id=dn++,e.activityRegularizer=null,e.inputSpec=null,e.supportsMasking=!1,e._trainableWeights=[],e._nonTrainableWeights=[],e._losses=[],e._updates=[],e._built=!1,e.inboundNodes=[],e.outboundNodes=[];var n=t.name;if(!n){var r=e.getClassName();n=M(r)+"_"+rt(r)}if(e.name=n,e.trainable=null==t.trainable||t.trainable,e.updatable=null==t.updatable||t.updatable,null!=t.inputShape||null!=t.batchInputShape){var i=void 0;if(null!=t.batchInputShape)i=t.batchInputShape;else if(null!=t.inputShape){var o=null;null!=t.batchSize&&(o=t.batchSize),i=[o].concat(t.inputShape)}e.batchInputShape=i;var a=t.dtype;null==a&&(a=t.inputDType),null==a&&(a="float32"),e.dtype=a}return null!=t.weights?e.initialWeights=t.weights:e.initialWeights=null,e._refCount=null,e.fastWeightInitDuringBuild=!1,e}function yn(t,e){this.callArgs=e,this.id=hn++,this.outboundLayer=t.outboundLayer,this.inboundLayers=t.inboundLayers,this.nodeIndices=t.nodeIndices,this.tensorIndices=t.tensorIndices,this.inputTensors=t.inputTensors,this.outputTensors=t.outputTensors,this.inputMasks=t.inputMasks,this.outputMasks=t.outputMasks,this.inputShapes=t.inputShapes,this.outputShapes=t.outputShapes;for(var n=0,r=t.inboundLayers;n<r.length;n++){var i=r[n];null!=i&&i.outboundNodes.push(this)}t.outboundLayer.inboundNodes.push(this)}var vn,bn,wn,_n=(u(xn,bn=mn),xn.prototype.apply=function(t,e){throw new ot("Cannot pass any input to an InputLayer's apply() method. InputLayer name: "+this.name)},xn.prototype.dispose=function(){return{refCountAfterDispose:this._refCount,numDisposedVariables:0}},xn.prototype.getConfig=function(){return{batchInputShape:this.batchInputShape,dtype:this.dtype,sparse:this.sparse,name:this.name}},xn.className="InputLayer",xn);function xn(t){var e=bn.call(this,{dtype:t.dtype,name:null!=t.name?t.name:rt("input").toString()})||this;if(null==t.batchSize&&(t.batchSize=null),null==t.sparse&&(t.sparse=!1),e.trainable=!1,e.built=!0,e.sparse=t.sparse,null!=t.inputShape&&null!=t.batchInputShape)throw new ot("Only provide the inputShape OR batchInputShape argument to inputLayer, not both at the same time.");var n=t.batchInputShape;if(null==n){if(null==t.inputShape)throw new ot("An InputLayer should be passed either a `batchInputShape` or an `inputShape`.");n=[t.batchSize].concat(t.inputShape)}else if(null!=t.batchSize)throw new ot("Cannot specify batchSize if batchInputShape isspecified when creating an InputLayer.");var r=t.dtype||"float32";e.batchInputShape=n,e.dtype=r,e.inputSpec=[{shape:n}];var i=new fn(e.dtype,e.batchInputShape,e,[],{},e.name);return i.nodeIndex=0,i.tensorIndex=0,new pn({outboundLayer:e,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:[i],outputTensors:[i],inputMasks:[null],outputMasks:[null],inputShapes:[n],outputShapes:[n]}),e}function En(t){if(null==t.batchShape&&null==t.shape)throw new Error("Please provide to Input either a `shape` or a `batchShape` argument. Note that `shape` does not include the batch dimension.");if(null!=t.batchShape&&null!=t.shape)throw new ot("Please provide either a `shape` or `batchShape` argument to Input, but not both.");var e=t.batchShape;null!=t.shape&&null==e&&(e=[null].concat(t.shape));var n=t.dtype;return null==n&&(n="float32"),new _n({batchInputShape:e,name:t.name,dtype:n,sparse:t.sparse}).inboundNodes[0].outputTensors[0]}function Sn(c){return N(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u;return P(this,function(t){switch(t.label){case 0:if(null==c)return[2];for(i in e=[],n=[],r=[],c)"number"!=typeof(o=c[i])&&(a=o,e.push(a.data()),n.push(i),r.push(a));return[4,Promise.all(e)];case 1:for(s=t.sent(),u=0;u<s.length;++u)c[n[u]]=s[u][0];return Object(B.qb)(r),[2]}})})}function Nn(t){if(null!=t)for(var e in t){var n=t[e];"number"!=typeof n&&n.dispose()}}B.Bd.registerClass(_n),(wn=vn||(vn={}))[wn.SILENT=0]="SILENT",wn[wn.VERBOSE=1]="VERBOSE";var In,On,kn,An=(zn.prototype.setParams=function(t){this.params=t},zn.prototype.onEpochBegin=function(t,e){return N(this,void 0,void 0,function(){return P(this,function(t){return[2]})})},zn.prototype.onEpochEnd=function(t,e){return N(this,void 0,void 0,function(){return P(this,function(t){return[2]})})},zn.prototype.onBatchBegin=function(t,e){return N(this,void 0,void 0,function(){return P(this,function(t){return[2]})})},zn.prototype.onBatchEnd=function(t,e){return N(this,void 0,void 0,function(){return P(this,function(t){return[2]})})},zn.prototype.onTrainBegin=function(t){return N(this,void 0,void 0,function(){return P(this,function(t){return[2]})})},zn.prototype.onTrainEnd=function(t){return N(this,void 0,void 0,function(){return P(this,function(t){return[2]})})},zn.prototype.setModel=function(t){},zn),Cn=(Fn.prototype.append=function(t){this.callbacks.push(t)},Fn.prototype.setParams=function(t){for(var e=0,n=this.callbacks;e<n.length;e++)n[e].setParams(t)},Fn.prototype.setModel=function(t){for(var e=0,n=this.callbacks;e<n.length;e++)n[e].setModel(t)},Fn.prototype.onEpochBegin=function(r,i){return N(this,void 0,void 0,function(){var e,n;return P(this,function(t){switch(t.label){case 0:null==i&&(i={}),e=0,n=this.callbacks,t.label=1;case 1:return e<n.length?[4,n[e].onEpochBegin(r,i)]:[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}})})},Fn.prototype.onEpochEnd=function(r,i){return N(this,void 0,void 0,function(){var e,n;return P(this,function(t){switch(t.label){case 0:null==i&&(i={}),e=0,n=this.callbacks,t.label=1;case 1:return e<n.length?[4,n[e].onEpochEnd(r,i)]:[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}})})},Fn.prototype.onBatchBegin=function(r,i){return N(this,void 0,void 0,function(){var e,n;return P(this,function(t){switch(t.label){case 0:null==i&&(i={}),e=0,n=this.callbacks,t.label=1;case 1:return e<n.length?[4,n[e].onBatchBegin(r,i)]:[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}})})},Fn.prototype.onBatchEnd=function(r,i){return N(this,void 0,void 0,function(){var e,n;return P(this,function(t){switch(t.label){case 0:null==i&&(i={}),e=0,n=this.callbacks,t.label=1;case 1:return e<n.length?[4,n[e].onBatchEnd(r,i)]:[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}})})},Fn.prototype.onTrainBegin=function(r){return N(this,void 0,void 0,function(){var e,n;return P(this,function(t){switch(t.label){case 0:null==r&&(r={}),e=0,n=this.callbacks,t.label=1;case 1:return e<n.length?[4,n[e].onTrainBegin(r)]:[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}})})},Fn.prototype.onTrainEnd=function(r){return N(this,void 0,void 0,function(){var e,n;return P(this,function(t){switch(t.label){case 0:null==r&&(r={}),e=0,n=this.callbacks,t.label=1;case 1:return e<n.length?[4,n[e].onTrainEnd(r)]:[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}})})},Fn),Pn=(Ln.prototype.maybeYieldOnBatch=function(t){return N(this,void 0,void 0,function(){var e,n;return P(this,function(t){switch(t.label){case 0:return"auto"!==this.yieldEvery?[3,5]:(this.batchCount++,null!=this.autoYieldEveryBatches?[3,2]:(e=B.ye.now(),[4,Object(B.Mc)()]));case 1:return t.sent(),this.batchCount>Ln.SKIP_FIRST_BATCHES&&(this.batchDurationsMillis.push(e-this.batchStartMillis),this.batchDurationsMillis.length>=Ln.DECISION_BATCH_COUNT&&(n=this.batchDurationsMillis.reduce(function(t,e){return t+e})/this.batchDurationsMillis.length,this.autoYieldEveryBatches=Math.round(Ln.THRESHOLD_MILLIS/n),this.autoYieldEveryBatches<1&&(this.autoYieldEveryBatches=1))),this.batchStartMillis=B.ye.now(),this.lastYieldBatchCount=this.batchCount,[3,4];case 2:return this.batchCount-this.lastYieldBatchCount>=this.autoYieldEveryBatches?[4,Object(B.Mc)()]:[3,4];case 3:t.sent(),this.lastYieldBatchCount=this.batchCount,t.label=4;case 4:return[3,7];case 5:return"batch"!==this.yieldEvery?[3,7]:[4,Object(B.Mc)()];case 6:t.sent(),t.label=7;case 7:return[2]}})})},Ln.prototype.maybeYieldOnEpoch=function(){return N(this,void 0,void 0,function(){return P(this,function(t){switch(t.label){case 0:return"epoch"!==this.yieldEvery?[3,2]:[4,Object(B.Mc)()];case 1:t.sent(),t.label=2;case 2:return[2]}})})},Ln.SKIP_FIRST_BATCHES=1,Ln.DECISION_BATCH_COUNT=2,Ln.THRESHOLD_MILLIS=16,Ln),Tn=(u(Bn,kn=An),Bn.prototype.onTrainBegin=function(t){return N(this,void 0,void 0,function(){return P(this,function(t){return this.autoYielder=new Pn(this.yieldEvery),[2]})})},Bn.prototype.onEpochBegin=function(t){return N(this,void 0,void 0,function(){return P(this,function(t){return this.seen=0,this.totals={},[2]})})},Bn.prototype.onBatchEnd=function(t,a){return N(this,void 0,void 0,function(){var r,e,i,n,o=this;return P(this,function(t){switch(t.label){case 0:return[4,this.autoYielder.maybeYieldOnBatch(a)];case 1:for(n in t.sent(),null==a&&(a={}),r=null==a.size?0:a.size,this.seen+=r,e=function(t){var e=a[t];if("number"==typeof e)i.totals.hasOwnProperty(t)||(i.totals[t]=0),i.totals[t]=i.totals[t]+e*r;else{var n=void 0;t in i.totals?n=i.totals[t]:i.totals[t]=O(0),i.totals[t]=Object(B.oe)(function(){return Object(B.u)(o.totals[t],Object(B.Hc)(e,O(r)))}),null!=n&&n.dispose()}},i=this,a)e(n);return[2]}})})},Bn.prototype.onEpochEnd=function(t,s){return N(this,void 0,void 0,function(){var e,n,r,i,o,a=this;return P(this,function(t){switch(t.label){case 0:return[4,this.autoYielder.maybeYieldOnEpoch()];case 1:if(t.sent(),null!=s)for(e=function(t){if(null==n.totals[t])return"continue";"number"==typeof n.totals[t]?s[t]=n.totals[t]/n.seen:Object(B.oe)(function(){s[t]=Object(B.Hc)(Object(B.sb)(O(1),O(a.seen)),a.totals[t]),a.totals[t].dispose(),Object(B.Zb)(s[t])})},r=0,i=(n=this).params.metrics;r<i.length;r++)o=i[r],e(o);return[2]}})})},Bn),Mn=(u(jn,On=An),jn.prototype.onTrainBegin=function(t){return N(this,void 0,void 0,function(){return P(this,function(t){return this.epoch=[],this.history={},[2]})})},jn.prototype.onEpochEnd=function(n,r){return N(this,void 0,void 0,function(){var e;return P(this,function(t){for(e in null==r&&(r={}),this.epoch.push(n),r)null==this.history[e]&&(this.history[e]=[]),this.history[e].push(r[e]);return[2]})})},jn.prototype.syncData=function(){return N(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c;return P(this,function(t){switch(t.label){case 0:for(i in e=[],n=[],r=[],this.history)for(o=this.history[i],a=0;a<o.length;++a)"number"!=typeof o[a]&&(s=o[a],e.push(s.data()),n.push(i),r.push(a));return[4,Promise.all(e)];case 1:for(u=t.sent(),c=0;c<u.length;++c)this.history[n[c]][r[c]].dispose(),this.history[n[c]][r[c]]=u[c][0];return[2]}})})},jn),Rn=(u(Dn,In=An),Dn.prototype.onEpochBegin=function(e,n){return N(this,void 0,void 0,function(){return P(this,function(t){switch(t.label){case 0:return null==this.epochBegin?[3,3]:[4,Sn(n)];case 1:return t.sent(),[4,this.epochBegin(e,n)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},Dn.prototype.onEpochEnd=function(e,n){return N(this,void 0,void 0,function(){return P(this,function(t){switch(t.label){case 0:return null==this.epochEnd?[3,3]:[4,Sn(n)];case 1:return t.sent(),[4,this.epochEnd(e,n)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},Dn.prototype.onBatchBegin=function(e,n){return N(this,void 0,void 0,function(){return P(this,function(t){switch(t.label){case 0:return null==this.batchBegin?[3,3]:[4,Sn(n)];case 1:return t.sent(),[4,this.batchBegin(e,n)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},Dn.prototype.onBatchEnd=function(e,n){return N(this,void 0,void 0,function(){return P(this,function(t){switch(t.label){case 0:return null==this.batchEnd?[3,3]:[4,Sn(n)];case 1:return t.sent(),[4,this.batchEnd(e,n)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},Dn.prototype.onTrainBegin=function(e){return N(this,void 0,void 0,function(){return P(this,function(t){switch(t.label){case 0:return null==this.trainBegin?[3,3]:[4,Sn(e)];case 1:return t.sent(),[4,this.trainBegin(e)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},Dn.prototype.onTrainEnd=function(e){return N(this,void 0,void 0,function(){return P(this,function(t){switch(t.label){case 0:return null==this.trainEnd?[3,3]:[4,Sn(e)];case 1:return t.sent(),[4,this.trainEnd(e)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},Dn);function Dn(t){var e=In.call(this)||this;return e.trainBegin=t.onTrainBegin,e.trainEnd=t.onTrainEnd,e.epochBegin=t.onEpochBegin,e.epochEnd=t.onEpochEnd,e.batchBegin=t.onBatchBegin,e.batchEnd=t.onBatchEnd,e}function jn(){return null!==On&&On.apply(this,arguments)||this}function Bn(t){var e=kn.call(this)||this;return e.yieldEvery=t||"auto",e}function Ln(t){this.yieldEvery=t,this.batchCount=0,this.batchDurationsMillis=[],this.autoYieldEveryBatches=null,this.batchStartMillis=B.ye.now()}function Fn(t,e){void 0===e&&(e=10),null==t&&(t=[]),this.callbacks=t,this.queueLength=e}function zn(){this.validationData=null}function Un(t){return null==t?null:t instanceof An?[t]:Array.isArray(t)&&t[0]instanceof An?t:L(t).map(function(t){return new Rn(t)})}var Vn=(Wn.registerCallbackConstructor=function(t,e){B.ye.assert(0<=t&&Number.isInteger(t),"Verbosity level is expected to be an integer >= 0, but got "+t),Wn.checkForDuplicate(e),null==Wn.constructors[t]&&(Wn.constructors[t]=[]),Wn.constructors[t].push(e)},Wn.checkForDuplicate=function(e){for(var t in Wn.constructors)Wn.constructors[+t].forEach(function(t){if(t===e)throw new ot("Duplicate callback constructor.")})},Wn.clear=function(){Wn.constructors={}},Wn.createCallbacks=function(t){var e=[];for(var n in Wn.constructors){var r=+n;r<=t&&e.push.apply(e,Wn.constructors[r])}return e.map(function(t){return new t})},Wn.constructors={},Wn);function Wn(){}function qn(t,e,n,r,i,o,a,s,u,c){var l=new Mn,f=[new Tn(e)].concat(Vn.createCallbacks(n));null!=t&&f.push.apply(f,t),f.push(l);var h=new Cn(f);return h.setParams({epochs:r,initialEpoch:i,samples:o,steps:a,batchSize:s,verbose:n,doValidation:u,metrics:c}),{callbackList:h,history:l}}function Hn(r,i){return Object(B.oe)(function(){var t=Object(B.de)(Kt(r),i,!0),e=Object(B.Hc)(Object(B.xd)(f()),Object(B.Sc)(r)),n=Object(B.Td)(Object(B.wc)(t,e));return Object(B.sb)(r,n)})}function $n(t,e){return Object(B.oe)(function(){return Object(B.yc)(Kt(Object(B.be)(e,t)),-1)})}function Gn(t,e){return Object(B.oe)(function(){return Object(B.yc)(Object(B.r)(Object(B.be)(e,t)),-1)})}function Kn(r,i){return Object(B.oe)(function(){var t=Object(B.be)(r,i),e=Object(B.V)(Object(B.r)(r),f(),Number.MAX_VALUE),n=Object(B.r)(Object(B.sb)(t,e));return Object(B.Hc)(O(100),Object(B.yc)(n,-1))})}function Xn(o,a){return Object(B.oe)(function(){var t=O(1),e=Object(B.V)(a,f(),Number.MAX_VALUE),n=Object(B.ic)(Object(B.u)(t,e)),r=Object(B.V)(o,f(),Number.MAX_VALUE),i=Object(B.ic)(Object(B.u)(t,r));return Object(B.yc)(Kt(Object(B.be)(n,i)),-1)})}function Yn(r,i){return Object(B.oe)(function(){var t=O(0),e=O(1),n=Object(B.wc)(t,Object(B.be)(e,Object(B.Hc)(r,i)));return Object(B.yc)(Kt(n),-1)})}function Zn(r,i){return Object(B.oe)(function(){var t=O(0),e=O(1),n=Object(B.wc)(t,Object(B.be)(e,Object(B.Hc)(r,i)));return Object(B.yc)(n,-1)})}function Jn(i,o){return Object(B.oe)(function(){var t=O(0),e=O(1),n=Object(B.de)(Object(B.Hc)(i,o),-1),r=Object(B.uc)(Object(B.Hc)(Object(B.be)(e,i),o),-1);return Object(B.wc)(t,Object(B.u)(e,Object(B.be)(r,n)))})}function Qn(r,i){return Object(B.oe)(function(){var t=O(Math.log(2)),e=Object(B.be)(i,r),n=Object(B.be)(Object(B.u)(e,Object(B.Od)(Object(B.Hc)(O(-2),e))),t);return Object(B.yc)(n,-1)})}function tr(e,n,r){return void 0===r&&(r=!1),Object(B.oe)(function(){if(r)n=Object(B.Nd)(n);else{var t=Object(B.de)(n,n.shape.length-1,!0);n=Object(B.sb)(n,t)}return n=Object(B.V)(n,f(),1-f()),Object(B.Lc)(Object(B.de)(Object(B.Hc)(e.toFloat(),Object(B.ic)(n)),n.shape.length-1))})}function er(n,r){return Object(B.oe)(function(){var t=Object(B.Hb)(function(t){var e=[Tt(t.shape)];return t.reshape(e)}(n)).toInt(),e=(r=Object(B.V)(r,f(),1-f())).shape;return tr(Object(B.Qc)(t,e[e.length-1]).reshape(e),r,!1)})}function nr(e,n){return Object(B.oe)(function(){var t;return t=Object(B.V)(n,f(),1-f()),t=Object(B.ic)(Object(B.sb)(t,Object(B.be)(O(1),t))),Object(B.yc)(function(n,r){if(!B.ye.arraysEqual(n.shape,r.shape))throw new ot("logits and labels must have the same shape, but got shapes "+JSON.stringify(n.shape)+" and "+JSON.stringify(r.shape));return Object(B.oe)(function(){var t=r.relu(),e=r.abs().neg();return t.sub(r.mul(n)).add(e.exp().log1p())})}(e,t),-1)})}function rr(n,r){return Object(B.oe)(function(){var t=Object(B.V)(n,f(),1),e=Object(B.V)(r,f(),1);return Object(B.de)(Object(B.Hc)(n,Object(B.ic)(Object(B.sb)(t,e))),-1)})}function ir(e,n){return Object(B.oe)(function(){var t=Object(B.ic)(Object(B.u)(O(f()),n));return Object(B.yc)(Object(B.be)(n,Object(B.Hc)(e,t)),-1)})}function or(r,i){return Object(B.oe)(function(){var t=Hn(r,-1),e=Hn(i,-1),n=Object(B.Hc)(t,e);return Object(B.Lc)(Object(B.de)(n,-1))})}function ar(t){var e={meanSquaredError:$n,meanAbsoluteError:Gn,meanAbsolutePercentageError:Kn,meanSquaredLogarithmicError:Xn,squaredHinge:Yn,hinge:Zn,categoricalHinge:Jn,logcosh:Qn,categoricalCrossentropy:tr,sparseCategoricalCrossentropy:er,binaryCrossentropy:nr,kullbackLeiblerDivergence:rr,poisson:ir,cosineProximity:or};if("string"!=typeof t)return t;if(t in e)return e[t];var n="Unknown loss "+t;throw t.toLowerCase().includes("softmaxcrossentropy")&&(n="Unknown loss "+t+'. Use "categoricalCrossentropy" as the string name for tf.losses.softmaxCrossEntropy'),new ot(n)}function sr(n,r){return Object(B.oe)(function(){var t=Object(B.Hc)(O(.5),Object(B.Sc)(r)),e=Bt(Object(B.Qb)(r,t),n.dtype);return Object(B.yc)(Object(B.yb)(n,e),-1)})}function ur(t,e){return Object(B.oe)(function(){return Bt(Object(B.yb)(Object(B.z)(t,-1),Object(B.z)(e,-1)),"float32")})}function cr(e,n){return Object(B.oe)(function(){var t=O(1);return Object(B.nc)(e.equal(t),n.equal(t)).sum().cast("float32")})}function lr(i,o){return Object(B.oe)(function(){var t=O(0),e=cr(i,o),n=function(n,r){return Object(B.oe)(function(){var t=O(1),e=O(0);return Object(B.nc)(n.equal(e),r.equal(t)).sum().cast("float32")})}(i,o),r=e.add(n);return Object(B.Fe)(Object(B.Qb)(r,t),e.div(r),t).cast("float32")})}function fr(i,o){return Object(B.oe)(function(){var t=O(0),e=cr(i,o),n=function(n,r){return Object(B.oe)(function(){var t=O(1),e=O(0);return Object(B.nc)(n.equal(t),r.equal(e)).sum().cast("float32")})}(i,o),r=e.add(n);return Object(B.Fe)(Object(B.Qb)(r,t),e.div(r),t).cast("float32")})}function hr(t,e){return nr(t,e)}function pr(t,e){return t.rank===e.rank&&(t=t.squeeze([t.rank-1])),(e=e.argMax(-1)).dtype!==t.dtype&&(e=e.asType(t.dtype)),Object(B.yb)(t,e).asType("float32")}var dr=$n,mr=$n,gr=Gn,yr=Gn,vr=Kn,br=Kn,wr=tr,_r=or,xr=er;function Er(t,e,n,r){void 0===r&&(r=console.log);var i,o=function(t){var e=!0,n=[],r=[];for(var i in t.nodesByDepth)n.push(t.nodesByDepth[i]);for(var o=0,a=n;o<a.length;o++){var s=a[o];if(1<s.length||1===s.length&&1<s[0].inboundLayers.length){e=!1;break}r.push.apply(r,s)}if(e)for(var u=0,c=t.layers;u<c.length;u++){for(var l=!1,f=0,h=c[u].inboundNodes;f<h.length;f++){var p=h[f];if(-1!==r.indexOf(p)){if(l){e=!1;break}l=!0}}if(!e)break}return e}(t),a=["Layer (type)","Output shape","Param #"];if((n=o?(e=e||65,n||[.45,.85,1]):(e=e||98,n||[.33,.55,.67,1]))[n.length-1]<=1&&(n=n.map(function(t){return Math.floor(e*t)})),!o)for(var s in a.push("Receives inputs"),i=[],t.nodesByDepth)i.push.apply(i,t.nodesByDepth[s]);r("_".repeat(e)),Sr(a,n,r),r("=".repeat(e));for(var u=t.layers,c=0;c<u.length;++c)o?Nr(u[c],n,r):Ir(u[c],n,i,r),r((c===u.length-1?"=":"_").repeat(e));t.checkTrainableWeightsConsistency();var l=function(t){return null!=t.collectedTrainableWeights?rn(t.collectedTrainableWeights):rn(t.trainableWeights)}(t),f=rn(t.nonTrainableWeights);r("Total params: "+(l+f)),r("Trainable params: "+l),r("Non-trainable params: "+f),r("_".repeat(e))}function Sr(t,e,n){void 0===n&&(n=console.log);for(var r="",i=0;i<t.length;++i)0<i&&(r=r.slice(0,r.length-1)+" "),r=(r+=t[i]).slice(0,e[i]),r+=" ".repeat(e[i]-r.length);n(r)}function Nr(t,e,n){var r;try{r=JSON.stringify(t.outputShape)}catch(t){r="multiple"}Sr([t.name+" ("+t.getClassName()+")",r,t.countParams().toString()],e,n)}function Ir(t,e,n,r){var i;try{i=JSON.stringify(t.outputShape)}catch(t){i="multiple"}for(var o=[],a=0,s=t.inboundNodes;a<s.length;a++){var u=s[a];if(!(null!=n&&0<n.length&&-1===n.indexOf(u)))for(var c=0;c<u.inboundLayers.length;++c){var l=u.inboundLayers[c].name,f=u.nodeIndices[c],h=u.tensorIndices[c];o.push(l+"["+f+"]["+h+"]")}}var p=t.name,d=t.getClassName(),m=0===o.length?"":o[0];for(Sr([p+" ("+d+")",i,t.countParams().toString(),m],e,r),c=1;c<o.length;++c)Sr(["","","",o[c]],e,r)}function Or(t,e,n){return void 0===e&&(e={}),void 0===n&&(n=!1),U(t,B.Bd.SerializationMap.getMap().classNameMap,e,"layer",n)}function kr(t,e,n){return("inboundNodes"===t||"outputLayers"===t||"inputLayers"===t)&&0===e&&"string"==typeof n}function Ar(t,e){if(null===t)return null;if("string"==typeof t)return j(t);if("number"==typeof t||"boolean"==typeof t)return t;if(t instanceof Array){for(var n=[],r=t.length,i=0;i<r;++i){var o=t[i];kr(e,i,o)?n.push(o):n.push(Ar(o,e))}return n}for(var a={},s=0,u=Object.keys(t);s<u.length;s++){var c=u[s],l=t[c];if("name"===c&&"string"==typeof l)a[c]=l;else{var f=j(c);a[f]=Ar(l,f)}}return a}var Cr="0.10.3";var Pr=(Rr.prototype.add=function(t,e,n){if(null!=this.id2Value[t.id])throw new ot("Duplicate key: name="+t.name+", id="+t.id);return this.id2Value[t.id]=function(e,n){if(null==e.dtype||e.dtype===n.dtype)return n;try{return Object(B.T)(n,e.dtype)}catch(t){throw new ot("The dtype of the feed ("+n.dtype+") can not be cast to the dtype of the key '"+e.name+"' ("+e.dtype+").")}}(t,e),this.name2Id[t.name]=t.id,null!=n&&(this.id2Mask[t.id]=n),this},Rr.prototype.addFeed=function(t){this.add(t.key,t.value)},Rr.prototype.hasKey=function(t){return null!=this.id2Value[t.id]},Rr.prototype.names=function(){return Object.keys(this.name2Id)},Rr.prototype.getValue=function(t){if(t instanceof fn){if(null==this.id2Value[t.id])throw new ot("Nonexistent key: "+t.name);return this.id2Value[t.id]}var e=this.name2Id[t];if(null==e)throw new ot("Feed dict has no SymbolicTensor name: "+t);return this.id2Value[e]},Rr.prototype.getMask=function(t){if(t instanceof fn){if(null==this.id2Value[t.id])throw new ot("Nonexistent key: "+t.name);return this.id2Mask[t.id]}var e=this.name2Id[t];if(null==e)throw new ot("Feed dict has no SymbolicTensor name: "+t);return this.id2Mask[e]},Rr.prototype.disposeMasks=function(){null!=this.id2Mask&&Object(B.qb)(this.id2Mask)},Rr),Tr={},Mr={};function Rr(t){if(this.id2Value={},this.id2Mask={},this.name2Id={},t instanceof Rr)for(var e in t.id2Value)this.id2Value[e]=t.id2Value[e],e in t.id2Mask&&(this.id2Mask[e]=t.id2Mask[e]);else{if(null==t)return;for(var n=0,r=t;n<r.length;n++){var i=r[n];this.add(i.key,i.value)}}}function Dr(t,e,n,r){for(var i=null!=n&&n.training,o=Array.isArray(t),a=o?t:[t],s=a.map(function(t){return t.name}),u=[],c=e.names(),l=0,f=s;l<f.length;l++){var h=f[l];-1!==c.indexOf(h)?u.push(e.getValue(h)):u.push(null)}null!=r&&(r.maxNumTensors=-1/0,r.minNumTensors=1/0);var p,d,m=s.join(",")+"|"+e.names().join(",");if(null==Tr[m]){var g=function(t,e){B.ye.assert(null!=t&&0<t.length,"Exepcted at least one fetch, got none");var n=[],r={};if(1===t.length){var i=jr(t[0],e);n=i.sorted,r=i.recipientMap}else for(var o=new Set,a=0,s=t;a<s.length;a++){for(var u=jr(s[a],e),c=u.sorted,l=u.recipientMap,f=0,h=c;f<h.length;f++){var p=h[f];o.has(p.name)||(n.push(p),o.add(p.name))}var d=function(e){null==r[e]&&(r[e]=new Set),l[e].forEach(function(t){return r[e].add(t)})};for(var m in l)d(m)}return{sorted:n,recipientCounts:function(t){var e={};for(var n in t)e[n]=t[n].size;return e}(r)}}(a,e);p=g.sorted,d=g.recipientCounts,Tr[m]=p,Mr[m]=d}p=Tr[m],d={},i||Object.assign(d,Mr[m]);for(var y=new Pr(e),v=0;v<p.length;++v){if(null!=r){var b=Object(B.zc)().numTensors;b>r.maxNumTensors&&(r.maxNumTensors=b),b<r.minNumTensors&&(r.minNumTensors=b)}var w=p[v],_=w.sourceLayer;if(!(_ instanceof _n)){for(var x=[],E=[],S=[],N=!1,I=0,O=w.inputs;I<O.length;I++){var k=O[I],A=y.getValue(k),C=y.getMask(k);x.push(A),E.push(C),null!=C&&(N=!0),i||(d[k.name]--,0!==d[k.name]||e.hasKey(k)||-1!==s.indexOf(k.name)||A.isDisposed||S.push(A))}N&&((n=n||{}).mask=E[0]);var P=L(_.apply(x,n)),T=null;_.supportsMasking&&(T=_.computeMask(x,E));for(var M=Br(w),R=Array.isArray(M)?M:[M],D=0;D<R.length;++D){y.hasKey(R[D])||y.add(R[D],P[D],Array.isArray(T)?T[0]:T);var j=s.indexOf(R[D].name);-1!==j&&(u[j]=P[D])}i||Object(B.qb)(S)}}return y.disposeMasks(),o?u:u[0]}function jr(t,e){for(var n=new Set,r=[],i={},o=0,a=e.names();o<a.length;o++){var s=a[o];n.add(s)}var u=[],c=[];for(u.push(t);0<u.length;){var l=u[u.length-1];if(n.has(l.name))u.pop();else{var f=c[c.length-1]===u.length-1;if(0===l.inputs.length||f)u.pop(),r.push(l),n.add(l.name),f&&c.pop();else{c.push(u.length-1);for(var h=0,p=l.inputs;h<p.length;h++){var d=p[h];null==i[d.name]&&(i[d.name]=new Set),i[d.name].add(l.name),n.has(d.name)||u.push(d)}}}}return{sorted:r,recipientMap:i}}function Br(t){var e;if(1===t.sourceLayer.inboundNodes.length)e=t.sourceLayer.output;else{for(var n=null,r=0;r<t.sourceLayer.inboundNodes.length;++r)for(var i=0,o=t.sourceLayer.inboundNodes[r].outputTensors;i<o.length;i++)if(o[i].id===t.id){n=r;break}e=t.sourceLayer.getOutputAt(n)}return e}function Lr(t,e,n,r){if(!n.startsWith("2."))throw new ot("Unsupported Keras version in weights being loaded: "+n);return e}function Fr(t,e,n){var r=function(t){switch(t){case"float32":return"float32";default:throw new ot("Invalid dtype: "+t)}}(t);return B.o.make(e,{values:0===e.length?n:B.ye.flatten(n)},r)}var zr,Ur=(u(Vr,zr=mn),Vr.prototype.assertNotDisposed=function(){if(0===this._refCount)throw new Error("Container '"+this.name+"' is already disposed.")},Vr.prototype.dispose=function(){this.assertNotDisposed();var t={refCountAfterDispose:null,numDisposedVariables:0};if(0==--this._refCount)for(var e=0,n=this.layers;e<n.length;e++){var r=n[e];t.numDisposedVariables+=r.dispose().numDisposedVariables}return t.refCountAfterDispose=this._refCount,t},Object.defineProperty(Vr.prototype,"trainableWeights",{get:function(){if(0<this._trainableWeights.length)throw new ot("Container instance unexpectedly contains _trainableWeights.The trainable weights of a Container are a union of the trainable weights of its consituent Layers. Its own _trainableWeights must remain an empty Array.");if(!this.trainable)return[];for(var t=[],e=0,n=this.layers;e<n.length;e++){var r=n[e];t=t.concat(r.trainableWeights)}return t},enumerable:!0,configurable:!0}),Object.defineProperty(Vr.prototype,"nonTrainableWeights",{get:function(){for(var t=[],e=0,n=this.layers;e<n.length;e++){var r=n[e];t.push.apply(t,r.nonTrainableWeights)}if(this.trainable)return t;for(var i=[],o=0,a=this.layers;o<a.length;o++)r=a[o],i.push.apply(i,r.trainableWeights);return i.concat(t)},enumerable:!0,configurable:!0}),Object.defineProperty(Vr.prototype,"weights",{get:function(){return this.trainableWeights.concat(this.nonTrainableWeights)},enumerable:!0,configurable:!0}),Vr.prototype.loadWeights=function(t,e,n,r){void 0===e&&(e=!1),void 0===n&&(n=!1),void 0===r&&(r=!0),n?function(t,e,n){void 0===n&&(n=!0);for(var r={},i=0,o=0,a=e;o<a.length;o++)for(var s=0,u=a[o].weights;s<u.length;s++){var c=u[s];if(null!=r[c.originalName])throw new ot("Duplicate weight name: "+c.originalName);r[c.originalName]=c,i++}var l=[];for(var f in t){if(null!=r[f])l.push([r[f],t[f]]);else if(n)throw new ot("Provided weight data has no target variable: "+f);delete r[f]}if(n){var h=[];for(var p in r)h.push(p);if(0<h.length)throw new ot(h.length+" of "+i+" weights are not set: "+h)}un(l)}(t,this.layers,r):function(t,e,n){void 0===n&&(n=!1);for(var r=t.keras_version,i=(t.backend,e.map(function(t){return t.name})),o={},a=0,s=e;a<s.length;a++)null!=(v=s[a]).name&&(null==o[v.name]&&(o[v.name]=[]),o[v.name].push(v));for(var u=t.weights,c=[],l=0;l<i.length;++l){var f=i[l],h=u[f];null==h&&(h=[]);for(var p=[],d=0;d<h.length;++d){var m=h[d];p.push(new on(Fr(m.dtype,m.shape,m.value)))}for(var g=0,y=o[f];g<y.length;g++){var v,b=(v=y[g]).weights;if((p=Lr(0,p,r)).length!==b.length){if(!n)throw new ot("Layer #"+l+' (named "'+v.name+'") expects '+b.length+" weight(s), but the saved weights have "+p.length+" element(s).");console.warn("Skipping loading of weights of layer "+v.name+" due to mismatch in number of weights: ("+p.length+" vs "+b.length+").")}for(var w=0;w<p.length;++w)!n||B.ye.arraysEqual(b[w].shape,p[w].shape)?c.push([b[w],p[w].read()]):console.warn("Skipping loading of weights for layer "+v.name+" due to mismatch in shape ("+b[w].shape+" vs "+p[w].shape+")")}}un(c)}(t,this.layers,e)},Vr.prototype.updatedConfig=function(){var t=this.getConfig();return{className:this.getClassName(),config:t,kerasVersion:"tfjs-layers "+Cr,backend:"TensorFlow.js"}},Vr.prototype.toJSON=function(t,e){void 0===e&&(e=!0);var n=function t(e,n){if(null==e)return null;if("string"==typeof e)return M(e);if("number"==typeof e||"boolean"==typeof e)return e;if(e instanceof Array){for(var r=[],i=e.length,o=0;o<i;++o){var a=e[o];kr(n,o,a)?r.push(a):r.push(t(a,n))}return r}for(var s={},u=0,c=Object.keys(e);u<c.length;u++){var l=c[u],f=e[l];s[M(l)]="name"!==l&&"className"!==l||"string"!=typeof f?t(f,l):f}return s}(this.updatedConfig());return e?JSON.stringify(n):n},Vr.prototype.call=function(n,r){var i=this;return Object(B.oe)(function(){n=L(n);for(var t=new Pr,e=0;e<i.inputs.length;++e)t.add(i.inputs[e],n[e]);return Dr(i.outputs,t,r)})},Vr.prototype.computeMask=function(e,n){var r=this;return Object(B.oe)(function(){var t;return e=L(e),t=null==n?D(null,e.length):L(n),r.runInternalGraph(e,t)[1]})},Vr.prototype.computeOutputShape=function(t){var e=tn(t);if(e.length!==this.inputLayers.length)throw new ot("Invalid inputShape argument "+t+": model has "+this.inputLayers.length+" tensor inputs.");for(var n={},r=0;r<e.length;r++){var i=this.inputLayers[r],o=e[r];n[E=i.name+"_0_0"]=o}var a=Object.keys(this.nodesByDepth).map(function(t){return parseInt(t,10)}).sort(st);if(1<a.length)for(var s=0,u=a;s<u.length;s++)for(var c=u[s],l=0,f=this.nodesByDepth[c];l<f.length;l++){var h=f[l];if(i=h.outboundLayer,-1===this.inputLayers.map(function(t){return t.id}).indexOf(i.id)){for(var p=[],d=0;d<h.inboundLayers.length;d++){var m=h.inboundLayers[d],g=h.nodeIndices[d],y=h.tensorIndices[d],v=n[E=m.name+"_"+g+"_"+y];p.push(v)}var b=tn(i.computeOutputShape(T(p))),w=i.inboundNodes.indexOf(h);for(d=0;d<b.length;d++)n[E=i.name+"_"+w+"_"+d]=b[d]}}var _=[],x=[];for(r=0;r<this.outputLayers.length;r++){i=this.outputLayers[r],w=this.outputLayersNodeIndices[r],y=this.outputLayersTensorIndices[r];var E=i.name+"_"+w+"_"+y;x.push(E)}for(r=0;r<x.length;r++){var S=x[r];at(S in n),_.push(n[S])}return T(_)},Vr.prototype.runInternalGraph=function(t,e){null==e&&(e=D(null,t.length));for(var n={},r=0;r<this.inputs.length;++r){var i=this.inputs[r],o=t[r],a=e[r];n[i.id]=[o,a]}for(var s=0,u=Object.keys(this.nodesByDepth).map(function(t){return parseInt(t,10)}).sort(st);s<u.length;s++)for(var c=u[s],l=0,f=this.nodesByDepth[c];l<f.length;l++){for(var h=f[l],p=h.outboundLayer,d=h.inputTensors,m=h.outputTensors,g=new Array,y=0,v=d;y<v.length;y++)(i=v[y]).id in n&&g.push(n[i.id]);if(g.length===d.length){var b={},w=void 0,_=void 0,x=void 0,E=void 0;if(null!=h.callArgs&&(b=h.callArgs),1===g.length){var S=g[0],N=S[0],I=S[1];null==b.mask&&(b.mask=I),x=L(p.call(N,b)),E=L(p.computeMask(N,I)),w=[N],_=[I]}else w=g.map(function(t){return t[0]}),_=g.map(function(t){return t[1]}),null==b.mask&&(b.mask=_),x=L(p.call(w,b)),E=L(p.computeMask(w,_));if(p.activityRegularizer)throw new R("Model invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");for(r=0;r<m.length;++r)i=m[r],o=x[r],a=E[r],n[i.id]=[o,a]}}for(var O=[],k=[],A=[],C=0,P=this.outputs;C<P.length;C++){at((i=P[C]).id in n,"Could not compute output "+i.name+" : "+i.id);var T=n[i.id],M=T[0];a=T[1],A.push(M.shape),O.push(M),k.push(a)}return[O,k,A]},Vr.prototype.buildNodeConversionMap=function(t){for(var e,n={},r=0,i=this.layers;r<i.length;r++){var o=i[r];e=o instanceof Vr?1:0;for(var a=0;a<o.inboundNodes.length;a++){var s=Vr.nodeKey(o,a);this.containerNodes.has(s)&&(n[s]=e,e+=1)}}return n},Vr.prototype.getLayer=function(t,e){if(null!=e){if(this.layers.length<=e)throw new ot("Was asked to retrieve layer at index "+e+", but model only has "+this.layers.length+" layer(s).");return this.layers[e]}if(null==t)throw new ot("Provide either a layer name or layer index");for(var n=0,r=this.layers;n<r.length;n++){var i=r[n];if(i.name===t)return i}throw new ot("No such layer: "+t)},Vr.prototype.calculateLosses=function(){var a=this;return Object(B.oe)(function(){for(var t=[],e=0,n=a.layers;e<n.length;e++)for(var r=n[e],i=0;i<r.inboundNodes.length;++i){var o=Vr.nodeKey(r,i);a.containerNodes.has(o)&&t.push.apply(t,r.calculateLosses())}return t})},Vr.prototype.getConfig=function(){for(var t={name:this.name},e=this.buildNodeConversionMap(this.layers),n=[],r=0,i=this.layers;r<i.length;r++){for(var o=(v=i[r]).getClassName(),a=v.getConfig(),s=[],u=0;u<v.inboundNodes.length;u++){var c=v.inboundNodes[u],l=Vr.nodeKey(v,u),f={};if(this.containerNodes.has(l)){if(c.callArgs)try{JSON.stringify(c.callArgs),f=c.callArgs}catch(t){console.warn("Layer "+v.name+" was passed non-serializable keyword arguments: "+c.callArgs+". They will not be included in the serialized model (and thus will be missing at deserialization time)."),f={}}if(0<c.inboundLayers.length){for(var h=[],p=0;p<c.inboundLayers.length;p++){var d=c.inboundLayers[p],m=c.nodeIndices[p],g=c.tensorIndices[p];null==(w=e[Vr.nodeKey(d,m)])&&(w=0),h.push([d.name,w,g,f])}s.push(h)}}}n.push({name:v.name,className:o,config:a,inboundNodes:s})}t.layers=n;var y=[];for(p=0;p<this.inputLayers.length;p++){var v=this.inputLayers[p];m=this.inputLayersNodeIndices[p],l=Vr.nodeKey(v,m),this.containerNodes.has(l)&&(null!==(w=e[l])&&void 0!==w||(w=0),g=this.inputLayersTensorIndices[p],y.push([v.name,w,g]))}t.inputLayers=y;var b=[];for(p=0;p<this.outputLayers.length;p++){var w;v=this.outputLayers[p],m=this.outputLayersNodeIndices[p],l=Vr.nodeKey(v,m),this.containerNodes.has(l)&&(null!==(w=e[l])&&void 0!==w||(w=0),g=this.outputLayersTensorIndices[p],b.push([v.name,w,g]))}return t.outputLayers=b,t},Vr.fromConfig=function(t,a,e,s){void 0===e&&(e={}),void 0===s&&(s=!1);var h={},n={};function p(t,e){t.name in n?n[t.name].push(e):n[t.name]=[e]}function r(t,e){for(var n,r=[],i=0,o=e;i<o.length;i++){var a=o[i],s=a[0],u=a[1],c=a[2];if(3===a.length)n={};else{if(4!==a.length)throw new ot("Improperly formatted model config for layer "+JSON.stringify(t)+": "+JSON.stringify(a));n=a[3]}if(!(s in h))return void p(t,e);var l=h[s];if(l.inboundNodes.length<=u)return void p(t,e);var f=l.inboundNodes[u];r.push(f.outputTensors[c])}0<r.length&&t.apply(T(r),n)}function i(t){var e=t.name,n=Or(t,null!=a.customObjects?a.customObjects:{});n.setFastWeightInitDuringBuild(s),h[e]=n;for(var r=0,i=t.inboundNodes;r<i.length;r++){var o=i[r];if(!(o instanceof Array))throw new ot("Corrupted configuration, expected array for nodeData: "+o);p(n,o)}}for(var o=a.name,u=a.layers,c=0,l=u;c<l.length;c++)i(m=l[c]);for(;!V(n);)for(var f=0,d=u;f<d.length;f++){var m=d[f];if((A=h[m.name]).name in n){var g=n[A.name];delete n[A.name];for(var y=0,v=g;y<v.length;y++)r(A,v[y])}}for(var b=[],w=[],_=0,x=a.inputLayers;_<x.length;_++){var E=(m=x[_])[0],S=m[1],N=m[2];at(E in h);var I=(A=h[E]).inboundNodes[S].outputTensors;b.push(I[N])}for(var O=0,k=a.outputLayers;O<k.length;O++){var A;E=(m=k[O])[0],S=m[1],N=m[2],at(E in h),I=(A=h[E]).inboundNodes[S].outputTensors,w.push(I[N])}return new t({inputs:b,outputs:w,name:o})},Object.defineProperty(Vr.prototype,"stateful",{get:function(){if(this._stateful)throw new ot("Container instance unexpectedly has _stateful = true. The statefulness of a Container is determined by the Layers it contains. Its _stateful property must remain the default false.");for(var t=0,e=this.layers;t<e.length;t++)if(e[t].stateful)return!0;return!1},enumerable:!0,configurable:!0}),Vr.prototype.resetStates=function(){var t=this;Object(B.oe)(function(){t.layers.forEach(function(t){t.stateful&&t.resetStates()})})},Vr);function Vr(t){var p=zr.call(this,{})||this;if(p.containerNodes=new Set,p.name=t.name,null==p.name){var e=p.getClassName().toLowerCase();p.name=rt(e)}if(p.supportsMasking=!1,p.trainable=!0,p.updatable=!0,Array.isArray(t.inputs)?p.inputs=t.inputs.slice():p.inputs=[t.inputs],Array.isArray(t.outputs)?p.outputs=t.outputs.slice():p.outputs=[t.outputs],ut(p.inputs).length!==p.inputs.length)throw new ot("The list of inputs passed to the model is redundant. All inputs should only appear once. Found: "+p.inputs.map(function(t){return t.name}));ut(p.outputs).length!==p.outputs.length&&console.warn("The list of outputs passed to the model is redundant. All outputs should only appear once. Found: "+p.outputs.map(function(t){return t.name})),p.inputLayers=[],p.inputLayersNodeIndices=[],p.inputLayersTensorIndices=[],p.outputLayers=[],p.outputLayersNodeIndices=[],p.outputLayersTensorIndices=[],p.layers=[];for(var n=0,r=p.outputs;n<r.length;n++){var i=(S=r[n]).sourceLayer,o=S.nodeIndex,a=S.tensorIndex;p.outputLayers.push(i),p.outputLayersNodeIndices.push(o),p.outputLayersTensorIndices.push(a)}for(var s=0,u=p.inputs;s<u.length;s++)i=(S=u[s]).sourceLayer,o=S.nodeIndex,a=S.tensorIndex,at(0===o,"input layer has >1 nodes"),at(0===a,"input layer has >1 tensors"),p.inputLayers.push(i),p.inputLayersNodeIndices.push(o),p.inputLayersTensorIndices.push(a);p.inputNames=[],p.outputNames=[],p.feedInputShapes=[],p.feedInputNames=[],p.feedOutputNames=[];for(var c=0;c<p.inputLayers.length;c++){if(!((i=p.inputLayers[c])instanceof _n))throw new TypeError("Input layers to a Model must be InputLayer objects. Received inputs: "+t.inputs+". Input "+c+" (0-based) originates from layer type "+i.getClassName()+".");p.inputNames.push(i.name),p.feedInputShapes.push(i.batchInputShape),p.feedInputNames.push(i.name)}for(var l=0,f=p.outputLayers;l<f.length;l++)i=f[l],p.outputNames.push(i.name);p.internalInputShapes=p.inputs.map(function(t){return t.shape}),p.internalOutputShapes=p.outputs.map(function(t){return t.shape});for(var h={},d={},m={},g={},y={},v=[],b=function(t,e,n,r,i,o){null!=r&&null!=i&&null!=o||(r=t.sourceLayer,i=t.nodeIndex,o=t.tensorIndex);var a=r.inboundNodes[i];if(-1!==n.indexOf(a))throw new it("The tensor "+t.name+' at layer "'+r.name+'" is part of a cycle.');if(-1===e.indexOf(a)){p.containerNodes.add(Vr.nodeKey(r,i)),r.id in y||(y[r.id]=Object.keys(y).length),-1===n.indexOf(a)&&n.push(a);for(var s=a.inboundLayers.length,u=0;u<s;u++){var c=a.inputTensors[u],l=a.inboundLayers[u],f=a.nodeIndices[u],h=a.tensorIndices[u];b(c,e,n,l,f,h)}for(e.push(a);0<=n.indexOf(a);)n.splice(n.indexOf(a),1);v.push(a)}},w=[],_=[],x=0,E=p.outputs;x<E.length;x++){var S=E[x];b(S,w,_)}for(var N=0,I=v.slice().reverse();N<I.length;N++){(d[(K=I[N]).id]=K).id in h||(h[K.id]=0);var O=h[K.id],k=null==m[K.outboundLayer.id]?0:m[K.outboundLayer.id];for(O=Math.max(O,k),m[K.outboundLayer.id]=O,g[K.outboundLayer.id]=K.outboundLayer,h[K.id]=O,c=0;c<K.inboundLayers.length;c++){var A=K.inboundLayers[c],C=(o=K.nodeIndices[c],A.inboundNodes[o]),P=null==h[C.id]?0:h[C.id];h[C.id]=Math.max(O+1,P),d[C.id]=C}}var T={};for(var M in h)(O=h[M])in T||(T[O]=[]),T[O].push(d[M]);var R={};for(var D in m)(O=m[D])in R||(R[O]=[]),R[O].push(g[D]);var j=Object.keys(R).map(function(t){return parseInt(t,10)}).sort(st);p.layers=[];for(var B=0,L=j;B<L.length;B++){var F=R[O=L[B]];F.sort(function(t,e){var n=y[t.id],r=y[e.id];return n<r?-1:r<n?1:0});for(var z=0,U=F;z<U.length;z++)i=U[z],p.layers.push(i)}p.layersByDepth=R,j=Object.keys(T).map(function(t){return parseInt(t,10)}).sort(st);for(var V=p.inputs.slice(),W=[],q=0,H=j;q<H.length;q++)for(var $=0,G=T[O=H[q]];$<G.length;$++){var K;if(null!=(i=(K=G[$]).outboundLayer)){for(var X=0,Y=K.inputTensors;X<Y.length;X++)if(S=Y[X],-1===V.indexOf(S))throw new it("Graph disconnected: cannot obtain value for tensor "+S+' at layer "'+i.name+'". The following previous layers were accessed without issue: '+W);for(var Z=0,J=K.outputTensors;Z<J.length;Z++)S=J[Z],V.push(S);W.push(i.name)}}p.nodesByDepth=T;for(var Q=p.layers.map(function(t){return t.name}),tt=function(e){var t=Q.filter(function(t){return t===e}).length;if(1!==t)throw new it('The name "'+e+'" is used '+t+" times in the model. All layer names should be unique. Layer names: "+JSON.stringify(Q))},et=0,nt=Q;et<nt.length;et++)tt(nt[et]);return p.outboundNodes=[],p.inboundNodes=[],new pn({outboundLayer:p,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:p.inputs,outputTensors:p.outputs,inputMasks:p.inputs.map(function(t){return null}),outputMasks:p.outputs.map(function(t){return null}),inputShapes:p.inputs.map(function(t){return t.shape}),outputShapes:p.outputs.map(function(t){return t.shape})}),p.built=!0,p._refCount=1,p}function Wr(t,e){if(1<t.outputs.length)throw new R("Support for training a model with multiple output tensors with a dataset object is not implemented yet.");B.ye.assert(Array.isArray(e)&&2===e.length,"Dataset iterator for fitDataset() is expected to generate an Array of length 2: `[xs, ys]`, but instead generates "+e);var n=e,r=n[0],i=n[1];if(r instanceof B.o)return B.ye.assert(1===t.inputs.length,"Model has multiple "+t.inputs.length+" inputs, hence it expects the input dataset to generate a dictionary of tensors  (with keys "+JSON.stringify(t.inputNames)+", but received a single tensor."),B.ye.assert(r.shape[0]===i.shape[0],"Mismatch in batch size between x and y tensors ("+r.shape[0]+" vs. "+i.shape[0]+")"),[r,i];var o=void 0;r=r;for(var a=[],s=0,u=t.inputNames;s<u.length;s++){var c=u[s];if(null==r[c])throw new ot("The feature data generated by the dataset lacks the required input key '"+c+"'.");a.push(r[c]),null==o?o=r[c].shape[0]:B.ye.assert(r[c].shape[0]===o,"Mismatch in batch size between x and y tensors ("+r[c].shape[0]+" vs. "+i.shape[0]+")")}return a.concat(i)}function qr(k,A,C){return N(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c,l,f,h,p,d,m,g,y,v,b,w,_,x,E,S,N,I,O;return P(this,function(t){switch(t.label){case 0:if(e=null!=C.batchesPerEpoch,B.ye.assert(null!=k.optimizer,"You must compile a model before training/testing. Use Model.compile(modelCompileConfig)."),B.ye.assert(null!=C,"For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call."),B.ye.assert(null!=C.epochs&&0<C.epochs&&Number.isInteger(C.epochs),"For fitDataset(), config.epochs is expected to be a positive integer, but got "+C.epochs),B.ye.assert(!e||0<C.batchesPerEpoch&&Number.isInteger(C.batchesPerEpoch),"For fitDataset(), config.batchesPerEpoch is expected to be a positive integer if specified, but got "+C.batchesPerEpoch),B.ye.assert(null==C.validationSplit,"`validationSplit` is not supported by `fitDataset()`. Use validationData instead."),k.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");k.isTraining=!0,t.label=1;case 1:return t.trys.push([1,,22,23]),n=null!=C.validationData,i=r=void 0,n&&(Hr(C.validationData)?B.ye.assert(null==C.validationBatches||0<C.validationBatches&&Number.isInteger(C.validationBatches),"For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, but got "+C.validationBatches):(o=function(t){if(3===t.length)throw new R("Validation with sample weights is not implemented yet.");return{xs:t[0],ys:t[1]}}(C.validationData),r=o.xs,i=o.ys)),a=k.makeTrainFunction(),s=k.getDedupedMetricsNames(),void 0,u=n?s.slice().concat(s.map(function(t){return"val_"+t})):s.slice(),c=Un(C.callbacks),l=null==C.verbose?1:C.verbose,f=qn(c,C.yieldEvery,l,C.epochs,null,null,function(t,e){var n=null;return null!=e.batchesPerEpoch?n=e.batchesPerEpoch:Number.isFinite(t.size)&&(n=t.size),n}(A,C),null,n,u),h=f.callbackList,p=f.history,h.setModel(k),k.history=p,[4,h.onTrainBegin()];case 2:return t.sent(),k.stopTraining_=!1,d=null==C.initialEpoch?0:C.initialEpoch,[4,A.iterator()];case 3:m=t.sent(),t.label=4;case 4:return d<C.epochs?(g={},[4,h.onEpochBegin(d)]):[3,19];case 5:return t.sent(),v=y=0,e?[3,7]:[4,A.iterator()];case 6:m=t.sent(),t.label=7;case 7:return!e||y<C.batchesPerEpoch?[4,m.next()]:[3,17];case 8:return b=t.sent(),e&&b.done?(console.warn("You provided `batchesPerEpoch` as "+C.batchesPerEpoch+", but your dataset iterator ran out of data after "+y+" batches; interrupting training. Make sure that your dataset can generate at least `batchesPerEpoch * epochs` batches (in this case, "+C.batchesPerEpoch*C.epochs+" batches). You may need to use the repeat() function when building your dataset."),[3,17]):null==b.value?[3,11]:(w=Wr(k,b.value),(_={}).batch=v,_.size=w[0].shape[0],[4,h.onBatchBegin(v,_)]);case 9:for(t.sent(),x=a(w),Object(B.qb)(w),O=0;O<s.length;++O)E=s[O],S=x[O],_[E]=S,Object(B.Zb)(S);return[4,h.onBatchEnd(v,_)];case 10:t.sent(),Nn(_),v++,y++,t.label=11;case 11:return(e?y>=C.batchesPerEpoch:b.done)?n?(N=void 0,Hr(C.validationData)?(I=L,[4,k.evaluateDataset(C.validationData,{batches:C.validationBatches})]):[3,13]):[3,15]:[3,16];case 12:return N=I.apply(void 0,[t.sent()]),[3,14];case 13:N=L(k.evaluate(r,i,{batchSize:null==C.validationBatchSize?32:C.validationBatchSize,verbose:0})),t.label=14;case 14:for(O=0;O<k.metricsNames.length;++O)g["val_"+k.metricsNames[O]]=N[O];t.label=15;case 15:return[3,17];case 16:return k.stopTraining_?[3,17]:[3,7];case 17:return[4,h.onEpochEnd(d,g)];case 18:return t.sent(),d++,k.stopTraining_?[3,19]:[3,4];case 19:return[4,h.onTrainEnd()];case 20:return t.sent(),[4,k.history.syncData()];case 21:return t.sent(),[2,k.history];case 22:return k.isTraining=!1,[7];case 23:return[2]}})})}function Hr(t){return"function"==typeof t.iterator}function $r(t){B.ye.assert(0<t&&Number.isInteger(t),"batchSize is required to be a positive integer, but got "+t)}function Gr(t,e,n){return null==t?[null]:Array.isArray(t)?t.map(function(t){return Ft(t,e,n-e)}):Ft(t,e,n-e)}function Kr(t,e){return Object(B.oe)(function(){return null==t?null:Array.isArray(t)?t.map(function(t){return Kr(t,e)}):Gt(t,"int32"===e.dtype?e:e.toInt())})}function Xr(t,e){for(var n=[],r=0,i=null;r<t;)(i=r+e)>=t&&(i=t),n.push([r,i]),r=i;return n}function Yr(w,_,x,E){return void 0===E&&(E={}),N(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c,l,f,h,p,d,m,g,y,v,b;return P(this,function(t){switch(t.label){case 0:if(w.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");w.isTraining=!0,t.label=1;case 1:if(t.trys.push([1,,3,4]),$r(s=null==E.batchSize?32:E.batchSize),u=w.standardizeUserData(_,x,!1,s),e=u[0],n=u[1],c=!1,l=void 0,null!=E.validationData&&0<E.validationData.length){if(c=!0,2!==E.validationData.length)throw 3===E.validationData.length?new R("validationData including sample weights is not supported yet."):new ot("When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; "+E.validationData+" is invalid.");r=E.validationData[0],i=E.validationData[1],f=w.standardizeUserData(r,i,!0,s),o=f[0],a=f[1],l=o.concat(a)}else null!=E.validationSplit&&0<E.validationSplit&&E.validationSplit<1?(c=!0,h=Math.floor(e[0].shape[0]*(1-E.validationSplit)),p=e[0].shape[0],o=Gr(e,h,p),e=Gr(e,0,h),a=Gr(n,h,p),n=Gr(n,0,h),l=o.concat(a)):null!=E.validationSteps&&(c=!0);return d=e.concat(n),w.checkTrainableWeightsConsistency(),m=w.makeTrainFunction(),g=w.getDedupedMetricsNames(),v=y=void 0,v=c?(w.makeTestFunction(),y=w.testFunction,g.slice().concat(g.map(function(t){return"val_"+t}))):(y=null,l=[],g.slice()),b=Un(E.callbacks),[4,function(m,g,y,v,b,u,c,l,w,_,x,f,h,E,p,S){return N(this,void 0,void 0,function(){var d,i,o,e,a,n,r,s;return P(this,function(t){switch(t.label){case 0:if(null==b&&(b=32),null==u&&(u=1),null==x&&(x=!0),null==h&&(h=0),d=!1,null!=w&&null!=_&&(d=!0),null!=p&&(d=!0,null==E))throw new ot("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");return null!=(i=m.checkNumSamples(y,b,E,"steps_per_epoch"))&&(o=jt(0,i)),null==c&&(c=1),e=qn(l,S,c,u,h,i,E,b,d,f),a=e.callbackList,n=e.history,a.setModel(m),m.history=n,[4,a.onTrainBegin()];case 1:t.sent(),m.stopTraining_=!1,r=function(e){var f,h,p,n,r;return P(this,function(t){switch(t.label){case 0:return[4,a.onEpochBegin(e)];case 1:if(t.sent(),f={},null==E)return[3,2];throw new R("stepsPerEpoch mode is not implemented yet.");case 2:if("batch"===x)throw new R("batch shuffling is not implemneted yet");x&&B.ye.shuffle(o),h=Object(B.he)(o),p=Xr(i,b),n=function(c){var l;return P(this,function(t){switch(t.label){case 0:return l={},[4,a.onBatchBegin(c,l)];case 1:return t.sent(),Object(B.oe)(function(){var t=p[c][0],e=p[c][1],n=Ft(h,t,e-t);l.batch=c,l.size=e-t;for(var r=Kr(y,n),i=g(r),o=0;o<v.length;++o){var a=v[o],s=i[o];l[a]=s,Object(B.Zb)(s)}if(c===p.length-1&&d){var u=m.testLoop(w,_,b);for(o=0;o<v.length;++o)a=v[o],s=u[o],Object(B.Zb)(s),f["val_"+a]=s}}),[4,a.onBatchEnd(c,l)];case 2:return t.sent(),Nn(l),m.stopTraining_?[2,"break"]:[2]}})},r=0,t.label=3;case 3:return r<p.length?[5,n(r)]:[3,6];case 4:if("break"===t.sent())return[3,6];t.label=5;case 5:return++r,[3,3];case 6:h.dispose(),t.label=7;case 7:return[4,a.onEpochEnd(e,f)];case 8:return t.sent(),m.stopTraining_?[2,"break"]:[2]}})},s=h,t.label=2;case 2:return s<u?[5,r(s)]:[3,5];case 3:if("break"===t.sent())return[3,5];t.label=4;case 4:return++s,[3,2];case 5:return[4,a.onTrainEnd()];case 6:return t.sent(),[4,m.history.syncData()];case 7:return t.sent(),[2,m.history]}})})}(w,m,d,g,s,E.epochs,E.verbose,b,y,l,E.shuffle,v,E.initialEpoch,null,null,E.yieldEvery)];case 2:return[2,t.sent()];case 3:return w.isTraining=!1,Jr(e,_),Jr(n,x),Jr(o,r),Jr(a,i),[7];case 4:return[2]}})})}function Zr(t){var e=[];t instanceof B.o&&(t=[t]);for(var n=0;n<t.length;++n){var r=t[n];if(1===r.rank)e.push(Lt(r,1));else{if(0===r.rank)throw new Error("Expected tensor to be at least 1D, but received a 0D tensor (scalar).");e.push(r)}}return e}function Jr(t,e){if(null!=t){var n=[];if(e instanceof B.o)n.push(e.id);else if(Array.isArray(e))e.forEach(function(t){return n.push(t.id)});else if(null!=e)for(var r in e){var i=e[r];n.push(i.id)}var o=[];if(t instanceof B.o)-1===n.indexOf(t.id)&&o.push(t);else if(Array.isArray(t))t.forEach(function(t){-1===n.indexOf(t.id)&&o.push(t)});else if(null!=t)for(var a in t){var s=t[a];-1===n.indexOf(s.id)&&o.push(s)}o.forEach(function(t){t.isDisposed||t.dispose()})}}function Qr(t){return Array.isArray(t)}function ti(t){return!function(t){return t instanceof B.o}(t)&&!Qr(t)}function ei(t,e,n,r,i){if(void 0===r&&(r=!0),void 0===i&&(i=""),null==e||0===e.length){if(null!=t){var o=!1;if(Qr(t)&&0<t.length)o=!0;else if(ti(t)){for(var a in t)if(t.hasOwnProperty(a)){o=!0;break}}else o=!0;if(o)throw new ot("Error when checking model "+i+" expected no data, but got "+t)}return[]}if(null==t)return e.map(function(t){return null});var s;if(ti(t)){t=t,s=[];for(var u=0,c=e;u<c.length;u++){var l=c[u];if(null==t[l])throw new ot('No data provided for "'+l+'". Need data for each key in: '+e);s.push(t[l])}}else if(Qr(t)){if((t=t).length!==e.length)throw new ot("Error when checking model "+i+": the Array of Tensors that you are passing to your model is not the size the model expected. Expected to see "+e.length+" Tensor(s), but instead got the following list of Tensor(s): "+t);s=t}else{if(t=t,1<e.length)throw new ot("The model "+i+" expects "+e.length+" Tensor(s), but only received one Tensor. Found: Tensor with shape "+t.shape);s=[t]}if(s=Zr(s),null!=n)for(var f=0;f<e.length;++f)if(null!=n[f]){var h=s[f];if(h.shape.length!==n[f].length)throw new ot("Error when checking "+i+": expected "+e[f]+" to have "+n[f].length+" dimension(s). but got array with shape "+h.shape);for(var p=0;p<n[f].length;++p)if(0!==p||r){var d=h.shape[p],m=n[f][p];if(null!=m&&0<=m&&d!==m)throw new ot("Error when checking "+i+": expected "+e[f]+" to have shape ["+n[f]+"], but got array with shape ["+h.shape+"].")}}return s}function ni(t,e,n,r,i){var o;if(void 0===r&&(r=!0),void 0===i&&(i=""),Array.isArray(t)){if(t.length!==e.length)throw new ot("Error when checking model "+i+": the Array of Tensors that you are passing to your model is not the size the the model expected. Expected to see "+e.length+" Tensor(s), but instead got "+t.length+" Tensors(s).");o=t}else{if(1<e.length)throw new ot("The model expects "+e.length+" "+i+" Tensors, but only received one Tensor. Found: array with shape "+JSON.stringify(t.shape)+".");o=[t]}if(null!=n)for(var a=0;a<e.length;++a)if(null!=n[a]){var s=o[a];if(s.shape.length!==n[a].length)throw new ot("Error when checking "+i+": expected "+e[a]+" to have "+n[a].length+" dimension(s), but got array with shape "+JSON.stringify(s.shape));for(var u=0;u<n[a].length;++u)if(0!==u||r){var c=s.shape[u],l=n[a][u];if(null!=l&&l!==c)throw new ot("Error when checking "+i+": expected "+e[a]+" to have shape "+JSON.stringify(n[a])+" but got array with shape "+JSON.stringify(s.shape)+".")}}}var ri,ii=(u(oi,ri=Ur),oi.prototype.summary=function(t,e,n){if(void 0===n&&(n=console.log),!this.built)throw new ot("This model has never been called, thus its weights have not been created yet. So no summary can be displayed. Build the model first (e.g., by calling it on some test data).");Er(this,t,e,n)},oi.prototype.compile=function(t){var h=this;if(null==t.loss&&(t.loss=[]),this.loss=t.loss,"string"==typeof t.optimizer)this.optimizer=function(t){var e={Adagrad:function(){return B.te.adagrad(.01)},Adadelta:function(){return B.te.adadelta(1,.95,f())},Adam:function(){return B.te.adam(.001,.9,.999,f())},Adamax:function(){return B.te.adamax(.002,.9,.999,f(),0)},RMSProp:function(){return B.te.rmsprop(.001,.9,0,f())},SGD:function(){return B.te.sgd(.01)}};if(e.adagrad=e.Adagrad,e.adadelta=e.Adadelta,e.adam=e.Adam,e.adamax=e.Adamax,e.rmsprop=e.RMSProp,e.sgd=e.SGD,t in e)return e[t]();throw new ot("Unknown Optimizer "+t)}(t.optimizer);else{if(!(t.optimizer instanceof B.j))throw new ot("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer=t.optimizer}var e=[];if(Array.isArray(t.loss)||"string"==typeof t.loss||"function"==typeof t.loss)if(Array.isArray(t.loss)){if(t.loss.length!==this.outputs.length)throw new ot("When passing an Array as loss, it should have one entry per model output. The model has "+this.outputs.length+" output(s), but you passed loss="+t.loss+".");var n=t.loss;e=n.map(function(t){return ar(t)})}else{var r=ar(t.loss);this.outputs.forEach(function(t){e.push(r)})}else{for(var i in t.loss=t.loss,t.loss)if(-1===this.outputNames.indexOf(i))throw new ot('Unknown entry in loss dictionary: "'+i+'". Only expected the following keys: '+this.outputNames);for(var o=0,a=this.outputNames;o<a.length;o++){var s=a[o];null==t.loss[s]&&console.warn('Output "'+s+'" is missing from loss dictionary. We assume this was done on purpose, and we will not be expecting data to be passed to '+s+" during training"),e.push(ar(t.loss[s]))}}this.lossFunctions=e,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(var u=0;u<this.outputs.length;++u){var c=this.internalOutputShapes[u],l=this.outputNames[u];this.feedOutputNames.push(l),this.feedOutputShapes.push(c),this.feedLossFns.push(this.lossFunctions[u])}var p=[];this.metrics=t.metrics,this.metricsNames=["loss"],this.metricsTensors=[],Ot("loss",function(){for(var t=0;t<h.outputs.length;++t)if(-1===p.indexOf(t)){var e=h.lossFunctions[t];1<h.outputs.length&&(h.metricsTensors.push([e,t]),h.metricsNames.push(h.outputNames[t]+"_loss"))}});var d=function(e,t){if(null==e||Array.isArray(e)&&0===e.length)return t.map(function(t){return[]});if(Array.isArray(e))return t.map(function(t){return e});if(null==e)throw new TypeError("Type of metrics argument not understood. Expected an Array or Object, found: "+e);for(var n=[],r=0,i=t;r<i.length;r++){var o=i[r],a=e.hasOwnProperty(o)?e[o]:[];Array.isArray(a)||(a=[a]),n.push(a)}return n}(t.metrics,this.outputNames);Ot("metric",function(){for(var t=function(f){if(-1!==p.indexOf(f))return"continue";!function(t){for(var u,c,l,e=function(t){if(-1!==["accuracy","acc","crossentropy","ce"].indexOf(t)){var e=h.internalOutputShapes[f];1===e[e.length-1]||h.lossFunctions[f]===nr?-1!==["accuracy","acc"].indexOf(t)?c=sr:-1!==["crossentropy","ce"].indexOf(t)&&(c=hr):h.lossFunctions[f]===er?-1!==["accuracy","acc"].indexOf(t)?c=pr:-1!==["crossentropy","ce"].indexOf(t)&&(c=xr):-1!==["accuracy","acc"].indexOf(t)?c=ur:-1!==["crossentropy","ce"].indexOf(t)&&(c=wr);var n=void 0;-1!==["accuracy","acc"].indexOf(t)?n="acc":-1!==["crossentropy","ce"].indexOf(t)&&(n="ce"),l=c,u=""+n}else{var r=function(t){var e={binaryAccuracy:sr,categoricalAccuracy:ur,precision:lr,categoricalCrossentropy:wr,sparseCategoricalCrossentropy:xr,mse:dr,MSE:mr,mae:gr,MAE:yr,mape:vr,MAPE:br,cosine:_r};if("string"==typeof t&&t in e)return e[t];if("string"!=typeof t&&null!=t)return t;throw new ot("Unknown metric "+t)}(t);l=r,u=""+t}var i,o,a,s;Ot(u,function(){i=l}),o=f,a=u,s=i,1<h.outputNames.length&&(a=h.outputNames[o]+"_"+a),h.metricsNames.push(a),h.metricsTensors.push([s,o])},n=0,r=d[f];n<r.length;n++)e(r[n])}()},e=0;e<h.outputs.length;++e)t(e)}),this.collectedTrainableWeights=this.trainableWeights},oi.prototype.checkTrainableWeightsConsistency=function(){null!=this.collectedTrainableWeights&&this.trainableWeights.length!==this.collectedTrainableWeights.length&&console.warn("Discrepancy between trainableweights and collected trainable weights. Did you set `model.trainable` without calling `model.compile()` afterwards?")},oi.prototype.evaluate=function(t,e,n){void 0===n&&(n={});var r=null==n.batchSize?32:n.batchSize;$r(r);var i=this.standardizeUserData(t,e,!0,r);try{var o=i[0].concat(i[1]);this.makeTestFunction();var a=this.testFunction;return T(this.testLoop(a,o,r,n.verbose,n.steps))}finally{Jr(i[0],t),Jr(i[1],e)}},oi.prototype.evaluateDataset=function(e,n){return N(this,void 0,void 0,function(){return P(this,function(t){return this.makeTestFunction(),[2,function(p,o,d){return N(this,void 0,void 0,function(){var s,u,c,l,e,f,h,n,r,i;return P(this,function(t){switch(t.label){case 0:if(s=null!=(d=d||{}).batches,u=p.testFunction,c=[],0<d.verbose)throw new R("Verbose mode is not implemented yet.");return B.ye.assert(!s||0<d.batches&&Number.isInteger(d.batches),"Test loop expects `batches` to be a positive integer, but received "+JSON.stringify(d.batches)),function(t){return"function"==typeof t.next}(o)?(e=o,[3,3]):[3,1];case 1:return[4,o.iterator()];case 2:e=t.sent(),t.label=3;case 3:l=e,h=f=0,n=function(){var e,n,r,i,o,a;return P(this,function(t){switch(t.label){case 0:return[4,l.next()];case 1:if((e=t.sent()).value){if(n=Wr(p,e.value),r=Object(B.oe)(function(){return u(n)}),Object(B.qb)(n),0===h)for(a=0;a<r.length;++a)c.push(O(0));for(i=n[0].shape[0],o=function(t){var e=r[t],n=c[t];c[t]=Object(B.oe)(function(){return Object(B.u)(c[t],Object(B.Hc)(O(i),e))}),0<h&&Object(B.qb)(n)},a=0;a<r.length;++a)o(a);Object(B.qb)(r),f+=i,++h}return e.done?(s&&console.warn("Your dataset iterator ran out of data during evaluateDataset(). Interrupting evalution. Make sure that your dataset can generate at least `batches` batches (in this case, "+d.batches+" batches). You may need to use the repeat() function when building your dataset."),[2,"break"]):[2]}})},t.label=4;case 4:return!s||h<d.batches?[5,n()]:[3,6];case 5:return"break"===t.sent()?[3,6]:[3,4];case 6:for(r=function(t){var e=c[t];c[t]=Object(B.oe)(function(){return Object(B.sb)(c[t],O(f))}),Object(B.qb)(e)},i=0;i<c.length;++i)r(i);return[2,T(c)]}})})}(this,e,n)]})})},oi.prototype.checkNumSamples=function(t,e,n,r){var i;if(void 0===r&&(r="steps"),null!=n){if((i=null)!=e)throw new ot("If "+r+" is set, batchSize must be null or undefined.Got batchSize = "+e)}else{if(null==t)throw new ot("Either the input data should have a defined shape, or "+r+" shoud be specified.");i=Array.isArray(t)?t[0].shape[0]:t.shape[0]}return i},oi.prototype.execute=function(t,e){if(Array.isArray(e)&&0===e.length)throw new ot("`outputs` is an empty Array, which is not allowed.");var n=Array.isArray(e),r=n?e:[e],i=this.retrieveSymbolicTensors(r),o=new Pr;if(t instanceof B.o&&(t=[t]),Array.isArray(t)){if(t.length!==this.inputs.length)throw new ot("The number of inputs provided ("+t.length+") does not match the number of inputs of this model ("+this.inputs.length+").");for(var a=0;a<this.inputs.length;++a)o.add(this.inputs[a],t[a])}else for(var s=0,u=this.inputs;s<u.length;s++){var c=u[s],l=t[c.name];if(null==l)throw new ot("No value is provided for the model's input "+c.name);o.add(c,l)}var f=Dr(i,o);return n?f:f[0]},oi.prototype.retrieveSymbolicTensors=function(n){for(var t=D(null,n.length),e=n.length,r=0,i=this.layers;r<i.length;r++){for(var o=i[r],a=Array.isArray(o.output)?o.output:[o.output],s=a.map(function(t){return t.name}),u=0;u<n.length;++u){var c=s.indexOf(n[u]);if(-1!==c&&(t[u]=a[c],e--),0===e)break}if(0===e)break}if(0<e){var l=[];throw t.forEach(function(t,e){null==t&&l.push(n[e])}),new ot("Cannot find SymbolicTensors for output name(s): "+JSON.stringify(l))}return t},oi.prototype.predictLoop=function(u,i,o){var c=this;return void 0===i&&(i=32),void 0===o&&(o=!1),Object(B.oe)(function(){var t=c.checkNumSamples(u);if(o)throw new R("Verbose predictLoop() is not implemented yet.");for(var s=Xr(t,i),n=c.outputs.map(function(t){return[]}),e=function(a){Object(B.oe)(function(){var t=s[a][0],e=s[a][1],n=Gr(u,t,e),r=[];if(Array.isArray(n))for(var i=0;i<n.length;++i)r.push({key:c.inputs[i],value:n[i]});else r.push({key:c.inputs[0],value:n});var o=new Pr(r);return Dr(c.outputs,o)}).forEach(function(t,e){return n[e].push(t)})},r=0;r<s.length;++r)e(r);return T(n.map(function(t){return Object(B.Y)(t,0)}))})},oi.prototype.predict=function(t,e){void 0===e&&(e={});var n=Zr(t);ni(n,this.inputNames,this.feedInputShapes,!1);try{var r=null==e.batchSize?32:e.batchSize;return $r(r),this.predictLoop(n,r)}finally{Jr(n,t)}},oi.prototype.predictOnBatch=function(t){return ni(t,this.inputNames,this.feedInputShapes,!0),this.predictLoop(t,t.shape[0])},oi.prototype.standardizeUserData=function(t,e,n,r){if(void 0===n&&(n=!0),null==this.optimizer)throw new it("You must compile a model before training/testing. Use Model.compile(modelCompileArgs).");for(var i=[],o=0;o<this.feedOutputShapes.length;++o){var a=this.feedOutputShapes[o];this.feedLossFns[o]===er?i.push(a.slice(0,a.length-1).concat([1])):i.push(a)}if(function(t,e,n){var r=ut(t.map(function(t){return t.shape[0]}));r.sort();var i=ut(e.map(function(t){return t.shape[0]}));if(i.sort(),1<r.length)throw new ot("All input Tensors (x) should have the same number of samples. Got array shapes: "+JSON.stringify(t.map(function(t){return t.shape})));if(1<i.length)throw new ot("All target Tensors (y) should have the same number of samples. Got array shapes: "+JSON.stringify(e.map(function(t){return t.shape})));if(0<r.length&&0<i.length&&!B.ye.arraysEqual(r,i))throw new ot("Input Tensors should have the same number of samples as target Tensors. Found "+r[0]+" input sample(s) and "+i[0]+" target sample(s).")}(t=ei(t,this.feedInputNames,this.feedInputShapes,!1,"input"),e=ei(e,this.feedOutputNames,i,!1,"target")),function(t,e,n){for(var r=[$n,nr,tr],i=0;i<t.length;++i){var o=t[i],a=e[i],s=n[i];if(null!=a){if(a===tr&&1===o.shape[o.shape.length-1])throw new ot("You are passing a target array of shape "+o.shape+" while using a loss 'categorical_crossentropy'. 'categorical_crossentropy'expects targets to be binary matrices (1s and 0s) of shape [samples, classes].");if(-1!==r.indexOf(a))for(var u=o.shape.slice(1),c=s.slice(1),l=0;l<u.length;++l){var f=u[l],h=c[l];if(null!=h&&f!==h)throw new ot("A target Tensor with shape "+o.shape+" was passed for an output of shape "+s+", while using a loss function that expects targets to have the same shape as the output.")}}}}(e,this.feedLossFns,this.feedOutputShapes),this.stateful&&null!=r&&0<r&&t[0].shape[0]%r!=0)throw new ot("In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size "+r+". Found: "+t[0].shape[0]+" sample(s).");return[t,e,null]},oi.prototype.testLoop=function(h,p,d,m,g){var y=this;return void 0===m&&(m=0),Object(B.oe)(function(){var t=y.checkNumSamples(p,d,g,"steps"),e=[];if(0<m)throw new R("Verbose mode is not implemented yet.");if(null!=g)throw new R("steps mode in testLoop() is not implemented yet");for(var n=Xr(t,d),r=Object(B.he)(jt(0,t)),i=0;i<n.length;++i){var o=n[i][0],a=n[i][1],s=Ft(r,o,a-o),u=Kr(p,s),c=h(u);if(0===i)for(var l=0;l<c.length;++l)e.push(O(0));for(l=0;l<c.length;++l){var f=c[l];e[l]=Object(B.u)(e[l],Object(B.Hc)(O(a-o),f))}}for(l=0;l<e.length;++l)e[l]=Object(B.sb)(e[l],O(t));return e})},oi.prototype.getDedupedMetricsNames=function(){for(var t=this.metricsNames,e=[],n=0;n<t.length;++n){var r=t[n],i=r;1<C(t,r)&&(i+="_"+C(t.slice(0,n),r)),e.push(i)}return e},oi.prototype.makeTrainFunction=function(){var h=this;return function(t){var c=t.slice(0,h.inputs.length),l=t.slice(h.inputs.length,h.inputs.length+h.outputs.length),f=[],e=h.collectedTrainableWeights.map(function(t){return t.read()});return[h.optimizer.minimize(function(){for(var t=[],e=0;e<h.inputs.length;++e)t.push({key:h.inputs[e],value:c[e]});var n,r=new Pr(t),i=Dr(h.outputs,r,{training:!0});for(e=0;e<h.lossFunctions.length;++e){var o=(0,h.lossFunctions[e])(l[e],i[e]);Object(B.yc)(o),n=0===e?o:Object(B.u)(n,o)}for(e=0;e<h.metricsTensors.length;++e){var a=h.metricsTensors[e][0],s=h.metricsTensors[e][1],u=Object(B.yc)(a(l[s],i[s]));Object(B.Zb)(u),f.push(u)}return n=Object(B.yc)(n),h.calculateLosses().forEach(function(t){n=Object(B.u)(n,t)}),n},!0,e)].concat(f)}},oi.prototype.makeTestFunction=function(){var d=this;this.testFunction=function(p){return Object(B.oe)(function(){for(var t,e=[],n=p.slice(0,d.inputs.length),r=p.slice(d.inputs.length,d.inputs.length+d.outputs.length),i=[],o=0;o<d.inputs.length;++o)i.push({key:d.inputs[o],value:n[o]});var a=new Pr(i),s=Dr(d.outputs,a);for(o=0;o<d.lossFunctions.length;++o){var u=d.lossFunctions[o],c=Object(B.yc)(u(r[o],s[o]));t=0===o?c:Object(B.u)(t,c),e.push(t)}for(o=0;o<d.metricsTensors.length;++o){var l=d.metricsTensors[o][0],f=d.metricsTensors[o][1],h=Object(B.yc)(l(r[f],s[f]));e.push(h)}return e})}},oi.prototype.fit=function(e,n,r){return void 0===r&&(r={}),N(this,void 0,void 0,function(){return P(this,function(t){return[2,Yr(this,e,n,r)]})})},oi.prototype.fitDataset=function(e,n){return N(this,void 0,void 0,function(){return P(this,function(t){return[2,qr(this,e,n)]})})},oi.prototype.trainOnBatch=function(h,p){return N(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c,l,f;return P(this,function(t){switch(t.label){case 0:e=this.standardizeUserData(h,p),n=e[0],r=e[1],i=this.makeTrainFunction(),o=i(n.concat(r)),a=[],s=0,u=o,t.label=1;case 1:return s<u.length?(c=u[s],f=(l=a).push,[4,c.data()]):[3,4];case 2:f.apply(l,[t.sent()[0]]),t.label=3;case 3:return s++,[3,1];case 4:return Object(B.qb)(o),[2,T(a)]}})})},oi.prototype.getNamedWeights=function(t){for(var e={},n=null!=t&&t.trainableOnly,r=n?this.trainableWeights:this.weights,i=this.getWeights(n),o=0;o<r.length;++o)n&&!r[o].trainable||(e[r[o].originalName]=i[o]);return e},Object.defineProperty(oi.prototype,"stopTraining",{set:function(t){this.stopTraining_=t},enumerable:!0,configurable:!0}),oi.prototype.save=function(i,o){return N(this,void 0,void 0,function(){var e,n,r;return P(this,function(t){switch(t.label){case 0:if("string"==typeof i){if(0===(e=B.Xb.getSaveHandlers(i)).length)throw new ot("Cannot find any save handlers for URL '"+i+"'");if(1<e.length)throw new ot("Found more than one ("+e.length+") save handlers for URL '"+i+"'");i=e[0]}if(null==i.save)throw new ot("Model.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");return[4,B.Xb.encodeWeights(this.getNamedWeights(o))];case 1:return n=t.sent(),r=this.toJSON(null,!1),[2,i.save({modelTopology:r,weightData:n.data,weightSpecs:n.specs})]}})})},oi.className="Model",oi);function oi(t){var e=ri.call(this,t)||this;return e.isTraining=!1,e}function ai(n,r){return N(this,void 0,void 0,function(){var e;return P(this,function(t){if(null==r&&(r={}),"string"==typeof n){if(0===(e=B.Xb.getLoadHandlers(n)).length)e.push(B.Xb.browserHTTPRequest(n,null,null,null,r.onProgress));else if(1<e.length)throw new ot("Found more than one ("+e.length+") load handlers for URL '"+n+"'");n=e[0]}return[2,function(a,s,u){return N(this,void 0,void 0,function(){var e,n,r,i,o;return P(this,function(t){switch(t.label){case 0:if(null==u&&(u={}),null==a.load)throw new ot("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");return[4,a.load()];case 1:if(e=t.sent(),null!=(n=e.modelTopology).model_config&&(n=n.model_config),r=null==u.strict||u.strict,i=null!=e.weightData&&null!=e.weightSpecs&&r,o=Or(Ar(n),s,i),null!=e.weightData){if(null==e.weightSpecs)throw new ot("Model artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.");!!1,o.loadWeights(B.Xb.decodeWeights(e.weightData,e.weightSpecs),!1,!0,r)}return[2,o]}})})}(n,void 0,r)]})})}B.Bd.registerClass(ii);var si,ui=(u(ci,si=ii),ci.prototype.checkShape=function(t){if(t.inboundNodes[0].outputTensors[0].shape.some(function(t){return t<0}))throw new ot("Negative dimension size caused by adding layer "+t.name+" with input shape ["+t.inboundNodes[0].inputTensors[0].shape+"]")},ci.prototype.add=function(t){var e,n=t instanceof ci||t instanceof ii;if(n){if(1!==(e=t).outputs.length)throw new ot("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");if(1!==e.inputs.length)throw new ot("All layers in a Sequential model should have a single input tensor. For multi-input layers, use the functional API.")}if(0===this.outputs.length){if(0===t.inboundNodes.length){if(null==t.batchInputShape)throw new ot("The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.");var r=En({batchShape:t.batchInputShape,dtype:t.dtype,name:t.name+"_input"});t.apply(r)}if(n)this.outputs=e.outputs,this.inputs=e.inputs;else{if(1!==t.inboundNodes.length)throw new ot("A layer added to a Sequential model must not already be connected somewhere else. Model received layer "+t.name+" which has "+t.inboundNodes.length+" pre-existing inbound connections.");if(1!==t.inboundNodes[0].outputTensors.length)throw new ot("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(t),this.outputs=[t.inboundNodes[0].outputTensors[0]],this.inputs=function t(e,n,r){if((null==n||null!=r&&0<r)&&(n=e.sourceLayer,r=e.nodeIndex),0===n.inboundNodes.length)return[e];var i=n.inboundNodes[r];if(0===i.inboundLayers.length)return i.inputTensors;for(var o=[],a=0;a<i.inboundLayers.length;a++)for(var s=0,u=t(i.inputTensors[a],i.inboundLayers[a],i.nodeIndices[a]);s<u.length;s++){var c=u[s];-1===o.indexOf(c)&&o.push(c)}return o}(this.outputs[0])}this.inboundNodes=[],new pn({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:D(null,this.inputs.length),outputMasks:[null],inputShapes:this.inputs.map(function(t){return t.shape}),outputShapes:this.outputs[0].shape})}else{var i=t.apply(this.outputs[0]);if(Array.isArray(i))throw new TypeError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(t),this.outputs=[i],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}this.layers.push(t),this.built=!1},ci.prototype.pop=function(){if(0===this.layers.length)throw new TypeError("There are no layers in the model.");if(this.layers.pop(),0===this.layers.length)this.outputs=[],this.inboundNodes=[],this.outboundNodes=[];else{var t=this.layers.length-1;this.layers[t].outboundNodes=[],this.outputs=[this.layers[t].output],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}},ci.prototype.call=function(t,e){return null==this.model&&this.build(),this.model.call(t,e)},ci.prototype.build=function(t){if(nn(t),0===this.inputs.length||0===this.outputs.length)throw new TypeError("Sequential model cannot be built: model is empty. Add some layers first.");this.model=new ii({inputs:this.inputs,outputs:this.outputs[0],name:this.name+"_model"}),this.model.trainable=this.trainable,this.model.updatable=this.updatable,this.supportsMasking=this.model.supportsMasking,this.inputLayers=this.model.inputLayers,this.inputLayersNodeIndices=this.model.inputLayersNodeIndices,this.inputLayersTensorIndices=this.model.inputLayersTensorIndices,this.outputLayers=this.model.outputLayers,this.outputLayersNodeIndices=this.model.outputLayersNodeIndices,this.outputLayersTensorIndices=this.model.outputLayersTensorIndices,this.nodesByDepth=this.model.nodesByDepth,this.containerNodes=this.model.containerNodes,this.outputNames=this.model.outputNames,this.inputNames=this.model.inputNames,this.built=!0},ci.prototype.countParams=function(){return this.built||this.build(),si.prototype.countParams.call(this)},ci.prototype.summary=function(t,e,n){void 0===n&&(n=console.log),this.built||this.build(),si.prototype.summary.call(this,t,e,n)},ci.prototype.setWeights=function(t){null==this.model&&this.build(),this.model.setWeights(t)},Object.defineProperty(ci.prototype,"updatable",{get:function(){return this._updatable},set:function(t){this.built&&(this.model.updatable=t),this._updatable=t},enumerable:!0,configurable:!0}),ci.prototype.evaluate=function(t,e,n){if(void 0===n&&(n={}),!this.built)throw new it("The model needs to be compiled before being used.");return this.model.evaluate(t,e,n)},ci.prototype.evaluateDataset=function(e,n){return N(this,void 0,void 0,function(){return P(this,function(t){if(!this.built)throw new it("The model needs to be compiled before being used.");return[2,this.model.evaluateDataset(e,n)]})})},ci.prototype.predict=function(t,e){return void 0===e&&(e={}),null==this.model&&this.build(),this.model.predict(t,e)},ci.prototype.predictOnBatch=function(t){return null==this.model&&this.build(),this.model.predictOnBatch(t)},ci.prototype.compile=function(t){this.build(),this.model.compile(t),this.optimizer=this.model.optimizer,this.loss=this.model.loss,this.metrics=this.model.metrics,this.metricsTensors=this.model.metricsTensors,this.metricsNames=this.model.metricsNames},ci.prototype.fit=function(e,n,r){return void 0===r&&(r={}),N(this,void 0,void 0,function(){return P(this,function(t){if(!this.built)throw new it("The model needs to be compiled before being used.");return[2,this.model.fit(e,n,r)]})})},ci.prototype.fitDataset=function(e,n){return N(this,void 0,void 0,function(){return P(this,function(t){if(!this.built)throw new it("The model needs to be compiled before being used.");return[2,this.model.fitDataset(e,n)]})})},ci.prototype.trainOnBatch=function(e,n){return N(this,void 0,void 0,function(){return P(this,function(t){return[2,this.model.trainOnBatch(e,n)]})})},ci.fromConfig=function(t,e,n,r){var i;void 0===n&&(n={}),void 0===r&&(r=!1);var o={};if(e instanceof Array){if(null==e[0].className||"Merge"===e[0].className)throw new ot("Legacy serialization format not supported yet.");i=e}else B.ye.assert(null!=e.layers,"When the config data for a Sequential model is not an Array, it must be an Object that contains the 'layers' field."),i=e.layers,delete e.layers,o=e;var a=new t(o);if(!(a instanceof ci))throw new R("Sequential.fromConfig called on non-Sequential input: "+a);for(var s=0,u=i;s<u.length;s++){var c=Or(u[s],void 0,r);r&&c.setFastWeightInitDuringBuild(!0),a.add(c)}return a},Object.defineProperty(ci.prototype,"stopTraining",{set:function(t){this.model.stopTraining=t},enumerable:!0,configurable:!0}),ci.prototype.getConfig=function(){for(var t=[],e=0,n=this.layers;e<n.length;e++){var r=n[e];t.push({className:r.getClassName(),config:r.getConfig()})}return t},ci.className="Sequential",ci);function ci(t){var e=si.call(this,{inputs:[],outputs:[]})||this;if(t=t||{},e.trainable=!0,e._updatable=!0,e.built=!1,e.name=null!=t.name?t.name:rt("sequential_"),null!=t.layers)for(var n=0,r=t.layers;n<r.length;n++){var i=r[n];e.add(i)}return e}function li(t){return new ii(t)}function fi(t){return new ui(t)}function hi(t,e){return void 0===e&&(e=!0),Object(B.mb)("tf.loadModel() is deprecated and will be removed in TensorFlow.js 1.0. Please switch to tf.loadLayersModel()."),ai(t,{strict:e})}function pi(t,e){return null==e&&(e={}),ai(t,e)}function di(t){return En(t)}function mi(t,e){Vn.registerCallbackConstructor(t,e)}B.Bd.registerClass(ui);var gi,yi,vi=(u(_i,yi=B.Bd.Serializable),_i.prototype.getConfig=function(){return{}},_i),bi=(u(wi,gi=vi),wi.prototype.apply=function(t,e){return void 0===e&&(e=1),function(t,e){if(void 0===e&&(e=1),1!==e)throw new R("Support for alpha values other than 1 ("+e+") is not implemented yet.");return Object(B.vb)(t)}(t,e)},wi.className="elu",wi);function wi(){return null!==gi&&gi.apply(this,arguments)||this}function _i(){return null!==yi&&yi.apply(this,arguments)||this}B.Bd.registerClass(bi);var xi,Ei=(u(Si,xi=vi),Si.prototype.apply=function(t){return Object(B.zd)(t)},Si.className="selu",Si);function Si(){return null!==xi&&xi.apply(this,arguments)||this}B.Bd.registerClass(Ei);var Ni,Ii=(u(Oi,Ni=vi),Oi.prototype.apply=function(t){return Object(B.nd)(t)},Oi.className="relu",Oi);function Oi(){return null!==Ni&&Ni.apply(this,arguments)||this}B.Bd.registerClass(Ii);var ki,Ai=(u(Ci,ki=vi),Ci.prototype.apply=function(t){return Object(B.oe)(function(){return Object(B.Bc)(O(6),Object(B.nd)(t))})},Ci.className="relu6",Ci);function Ci(){return null!==ki&&ki.apply(this,arguments)||this}B.Bd.registerClass(Ai);var Pi,Ti=(u(Mi,Pi=vi),Mi.prototype.apply=function(t){return t},Mi.className="linear",Mi);function Mi(){return null!==Pi&&Pi.apply(this,arguments)||this}B.Bd.registerClass(Ti);var Ri,Di=(u(ji,Ri=vi),ji.prototype.apply=function(t){return Object(B.Ed)(t)},ji.className="sigmoid",ji);function ji(){return null!==Ri&&Ri.apply(this,arguments)||this}B.Bd.registerClass(Di);var Bi,Li=(u(Fi,Bi=vi),Fi.prototype.apply=function(t){return function(e){return Object(B.oe)(function(){var t=Object(B.u)(O(.5),Object(B.Hc)(O(.2),e));return Object(B.V)(t,0,1)})}(t)},Fi.className="hardSigmoid",Fi);function Fi(){return null!==Bi&&Bi.apply(this,arguments)||this}B.Bd.registerClass(Li);var zi,Ui=(u(Vi,zi=vi),Vi.prototype.apply=function(t){return Object(B.Od)(t)},Vi.className="softplus",Vi);function Vi(){return null!==zi&&zi.apply(this,arguments)||this}B.Bd.registerClass(Ui);var Wi,qi=(u(Hi,Wi=vi),Hi.prototype.apply=function(t){return function(t){return Object(B.oe)(function(){return Object(B.sb)(t,Object(B.u)(O(1),Object(B.r)(t)))})}(t)},Hi.className="softsign",Hi);function Hi(){return null!==Wi&&Wi.apply(this,arguments)||this}B.Bd.registerClass(qi);var $i,Gi=(u(Ki,$i=vi),Ki.prototype.apply=function(t){return Object(B.fe)(t)},Ki.className="tanh",Ki);function Ki(){return null!==$i&&$i.apply(this,arguments)||this}B.Bd.registerClass(Gi);var Xi,Yi=(u(Zi,Xi=vi),Zi.prototype.apply=function(t,e){return void 0===e&&(e=-1),Object(B.Nd)(t,e)},Zi.className="softmax",Zi);function Zi(){return null!==Xi&&Xi.apply(this,arguments)||this}function Ji(t){return t.getClassName()}function Qi(t,e){return void 0===e&&(e={}),U(t,B.Bd.SerializationMap.getMap().classNameMap,e,"activation")}function to(t){return null==t?Qi({className:"linear",config:{}}):"string"==typeof t?Qi({className:t,config:{}}):t instanceof vi?t:Qi(t)}B.Bd.registerClass(Yi);var eo,no,ro=(u(ao,no=B.Bd.Serializable),ao),io=(u(oo,eo=ro),oo.prototype.apply=function(e){var n=this;return Object(B.oe)(function(){var t=Object(B.He)([1]);return n.hasL1&&(t=Object(B.u)(t,Object(B.de)(Object(B.Hc)(n.l1,Object(B.r)(e))))),n.hasL2&&(t=Object(B.u)(t,Object(B.de)(Object(B.Hc)(n.l2,Kt(e))))),t.asScalar()})},oo.prototype.getConfig=function(){return{l1:this.l1.dataSync()[0],l2:this.l2.dataSync()[0]}},oo.fromConfig=function(t,e){return new t({l1:e.l1,l2:e.l2})},oo.className="L1L2",oo);function oo(t){var e=eo.call(this)||this,n=null==t||null==t.l1?.01:t.l1,r=null==t||null==t.l2?.01:t.l2;return e.hasL1=0!==n,e.hasL2=0!==r,e.l1=O(n),e.l2=O(r),e}function ao(){return null!==no&&no.apply(this,arguments)||this}B.Bd.registerClass(io);var so={l1l2:"L1L2"};function uo(t){return z(t)}function co(t,e){return void 0===e&&(e={}),U(t,B.Bd.SerializationMap.getMap().classNameMap,e,"regularizer")}function lo(t){return null==t?null:"string"==typeof t?co({className:t in so?so[t]:t,config:{}}):t instanceof ro?t:co(t)}var fo,ho=(u(po,fo=mn),po.prototype.call=function(t,e){t=en(t);var n=Object(B.nd)(t);return null!=this.maxValue&&(n=Object(B.V)(n,0,this.maxValue)),n},po.prototype.computeOutputShape=function(t){return t},po.prototype.getConfig=function(){var t={maxValue:this.maxValue},e=fo.prototype.getConfig.call(this);return Object.assign(t,e),t},po.className="ReLU",po);function po(t){var e=fo.call(this,null==t?{}:t)||this;return e.supportsMasking=!0,null!=t&&(e.maxValue=t.maxValue),e}B.Bd.registerClass(ho);var mo,go=(u(yo,mo=mn),yo.prototype.call=function(t,e){var n=en(t);return Object(B.ac)(n,this.alpha)},yo.prototype.computeOutputShape=function(t){return t},yo.prototype.getConfig=function(){var t={alpha:this.alpha},e=mo.prototype.getConfig.call(this);return Object.assign(t,e),t},yo.className="LeakyReLU",yo);function yo(t){var e=mo.call(this,null==t?{}:t)||this;return e.DEFAULT_ALPHA=.3,null==t&&(t={}),e.alpha=null==t.alpha?e.DEFAULT_ALPHA:t.alpha,e}B.Bd.registerClass(go);var vo,bo=(u(wo,vo=mn),wo.prototype.build=function(t){var e=(t=nn(t)).slice(1);if(null!=this.sharedAxes)for(var n=0,r=this.sharedAxes;n<r.length;n++)e[(o=r[n])-1]=1;this.alpha=this.addWeight("alpha",e,"float32",this.alphaInitializer,this.alphaRegularizer,!0,this.alphaConstraint);var i={};if(null!=this.sharedAxes)for(var o=1;o<t.length;++o)i[o]=t[o];this.inputSpec=[new ln({ndim:t.length,axes:i})],this.built=!0},wo.prototype.call=function(t,e){return t=en(t),Object(B.dd)(t,this.alpha.read())},wo.prototype.getConfig=function(){var t={alphaInitializer:Ye(this.alphaInitializer),alphaRegularizer:uo(this.alphaRegularizer),alphaConstraint:dt(this.alphaConstraint),sharedAxes:this.sharedAxes},e=vo.prototype.getConfig.call(this);return Object.assign(t,e),t},wo.className="PReLU",wo);function wo(t){var e=vo.call(this,null==t?{}:t)||this;if(e.DEFAULT_ALPHA_INITIALIZER="zeros",null==t&&(t={}),e.supportsMasking=!0,e.alphaInitializer=Ze(t.alphaInitializer||e.DEFAULT_ALPHA_INITIALIZER),e.alphaRegularizer=lo(t.alphaRegularizer),e.alphaConstraint=gt(t.alphaConstraint),null==t.sharedAxes)e.sharedAxes=null;else if(Array.isArray(t.sharedAxes))e.sharedAxes=t.sharedAxes;else{if("number"!=typeof t.sharedAxes)throw new ot("Expected sharedAxes to be a number or an array of numbers, but got "+t.sharedAxes);e.sharedAxes=[t.sharedAxes]}return e}B.Bd.registerClass(bo);var _o,xo=(u(Eo,_o=mn),Eo.prototype.call=function(t,e){var n=en(t);return Object(B.vb)(n)},Eo.prototype.computeOutputShape=function(t){return t},Eo.prototype.getConfig=function(){var t={alpha:this.alpha},e=_o.prototype.getConfig.call(this);return Object.assign(t,e),t},Eo.className="ELU",Eo);function Eo(t){var e=_o.call(this,null==t?{}:t)||this;if(e.DEFAULT_ALPHA=1,null==t&&(t={}),null!=t.alpha&&t.alpha!==e.DEFAULT_ALPHA)throw new R("Non-default alpha value ("+t.alpha+") is not supported by the ELU layer yet.");return e.alpha=null==t.alpha?e.DEFAULT_ALPHA:t.alpha,e}B.Bd.registerClass(xo);var So,No=(u(Io,So=mn),Io.prototype.call=function(t,e){var n=en(t);return n.mul(Bt(n.greater(this.thetaTensor),"float32"))},Io.prototype.computeOutputShape=function(t){return t},Io.prototype.getConfig=function(){var t={theta:this.theta},e=So.prototype.getConfig.call(this);return Object.assign(t,e),t},Io.className="ThresholdedReLU",Io);function Io(t){var e=So.call(this,null==t?{}:t)||this;return e.DEFAULT_THETA=1,null==t&&(t={}),e.theta=null==t.theta?e.DEFAULT_THETA:t.theta,e.thetaTensor=O(e.theta),e}B.Bd.registerClass(No);var Oo,ko=(u(Ao,Oo=mn),Ao.prototype.call=function(t,e){var n=en(t);return this.softmax(n,this.axis)},Ao.prototype.computeOutputShape=function(t){return t},Ao.prototype.getConfig=function(){var t={axis:this.axis},e=Oo.prototype.getConfig.call(this);return Object.assign(t,e),t},Ao.className="Softmax",Ao);function Ao(t){var e=Oo.call(this,null==t?{}:t)||this;return e.DEFAULT_AXIS=1,null==t&&(t={}),e.softmax=(new Yi).apply,e.axis=null==t.axis?e.DEFAULT_AXIS:t.axis,e}function Co(t,e,n){if("number"==typeof t)return D(t,e);if(t.length!==e)throw new ot("The "+n+" argument must be a tuple of "+e+" integers. Received: "+t.length+" elements.");for(var r=0;r<e;++r){var i=t[r];if((o=i)!==parseInt(o.toString(),10))throw new ot("The "+n+" argument must be a tuple of "+e+" integers. Received: "+JSON.stringify(t)+" including a non-integer number "+i)}var o;return t}function Po(t,e,n,r,i){return void 0===i&&(i=1),null==t?t:(o="same"===n?t:t-(e+(e-1)*(i-1))+1,Math.floor((o+r-1)/r));var o}function To(t,e,n,r){if(null==t)return null;if("valid"===r)t=t*e+Dt([n-e,0]);else{if("same"!==r)throw new ot("Unsupport padding mode: "+r+".");t*=e}return t}function Mo(t,e){return Object(B.oe)(function(){return Et(e),"channelsFirst"===e?Object(B.ue)(t,[0,2,3,1]):t})}B.Bd.registerClass(ko);var Ro,Do,jo,Bo=(u(Vo,jo=mn),Vo.verifyArgs=function(t){if(at("kernelSize"in t,"required key 'kernelSize' not in config"),"number"!=typeof t.kernelSize&&!q(t.kernelSize,"number",1,2))throw new ot("BaseConv expects config.kernelSize to be number or number[] with length 1 or 2, but received "+JSON.stringify(t.kernelSize)+".")},Vo.prototype.getConfig=function(){var t={kernelSize:this.kernelSize,strides:this.strides,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,activation:Ji(this.activation),useBias:this.useBias,biasInitializer:Ye(this.biasInitializer),biasRegularizer:uo(this.biasRegularizer),activityRegularizer:uo(this.activityRegularizer),biasConstraint:dt(this.biasConstraint)},e=jo.prototype.getConfig.call(this);return Object.assign(t,e),t},Vo),Lo=(u(Uo,Do=Bo),Uo.prototype.build=function(t){t=nn(t);var e="channelsFirst"===this.dataFormat?1:t.length-1;if(null==t[e])throw new ot("The channel dimension of the input should be defined. Found "+t[e]);var n,r=t[e],i=this.kernelSize.concat([r,this.filters]);this.kernel=this.addWeight("kernel",i,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[{ndim:this.rank+2,axes:(n={},n[e]=r,n)}],this.built=!0},Uo.prototype.call=function(n,t){var r=this;return Object(B.oe)(function(){var t;n=en(n);var e=null==r.bias?null:r.bias.read();if(1===r.rank)t=function(e,n,r,i,o,a,s){return void 0===i&&(i=1),void 0===o&&(o="valid"),void 0===s&&(s=1),Object(B.oe)(function(){if(null==a&&(a="channelsLast"),Et(a),3!==e.shape.length)throw new ot("The input of a conv1dWithBias operation should be 3, but is "+e.shape.length+" instead.");if(3!==n.shape.length)throw new ot("The kernel for a conv1dWithBias operation should be 3, but is "+n.shape.length+" instead");if(null!=r&&1!==r.shape.length)throw new ot("The bias for a conv1dWithBias operation should be 1, but is "+n.shape.length+" instead");if("channelsFirst"===a&&(e=Object(B.ue)(e,[0,2,1])),"causal"===o)throw new R("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");var t=Object(B.db)(e,n,i,"same"===o?"same":"valid","NWC",s);return null!=r&&(t=Xt(t,r)),t})}(n,r.kernel.read(),e,r.strides[0],r.padding,r.dataFormat,r.dilationRate[0]);else if(2===r.rank)t=function(e,n,r,i,o,a,s){return void 0===i&&(i=[1,1]),void 0===o&&(o="valid"),Object(B.oe)(function(){if(null==a&&(a="channelsLast"),Et(a),3!==e.rank&&4!==e.rank)throw new ot("conv2dWithBias expects input to be of rank 3 or 4, but received "+e.rank+".");if(3!==n.rank&&4!==n.rank)throw new ot("conv2dWithBias expects kernel to be of rank 3 or 4, but received "+e.rank+".");var t=Mo(e,a);if("causal"===o)throw new R("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");return t=Object(B.eb)(t,n,i,"same"===o?"same":"valid","NHWC",s),null!=r&&(t=Xt(t,r)),"channelsFirst"===a&&(t=Object(B.ue)(t,[0,3,1,2])),t})}(n,r.kernel.read(),e,r.strides,r.padding,r.dataFormat,r.dilationRate);else if(3===r.rank)throw new R("3D convolution is not implemented yet.");return null!=r.activation&&(t=r.activation.apply(t)),t})},Uo.prototype.computeOutputShape=function(t){t=nn(t);for(var e=[],n="channelsLast"===this.dataFormat?t.slice(1,t.length-1):t.slice(2),r=0;r<n.length;++r){var i=Po(n[r],this.kernelSize[r],this.padding,this.strides[r],"number"==typeof this.dilationRate?this.dilationRate:this.dilationRate[r]);e.push(i)}var o=[t[0]];return"channelsLast"===this.dataFormat?(o=o.concat(e)).push(this.filters):(o.push(this.filters),o=o.concat(e)),o},Uo.prototype.getConfig=function(){var t={filters:this.filters,kernelInitializer:Ye(this.kernelInitializer),kernelRegularizer:uo(this.kernelRegularizer),kernelConstraint:dt(this.kernelConstraint)},e=Do.prototype.getConfig.call(this);return Object.assign(t,e),t},Uo.verifyArgs=function(t){if(!("filters"in t)||"number"!=typeof t.filters||t.filters<1)throw new ot("Convolution layer expected config.filters to be a 'number' > 0 but got "+JSON.stringify(t.filters))},Uo),Fo=(u(zo,Ro=Lo),zo.prototype.getConfig=function(){var t=Ro.prototype.getConfig.call(this);return delete t.rank,t},zo.verifyArgs=function(t){if("number"!=typeof t.kernelSize&&!q(t.kernelSize,"number",1,2))throw new ot("Conv2D expects config.kernelSize to be number or number[] with length 1 or 2, but received "+JSON.stringify(t.kernelSize)+".")},zo.className="Conv2D",zo);function zo(t){var e=Ro.call(this,2,t)||this;return zo.verifyArgs(t),e}function Uo(t,e){var n=Do.call(this,t,e)||this;return n.kernel=null,Uo.verifyArgs(e),n.filters=e.filters,n.kernelInitializer=Ze(e.kernelInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.kernelConstraint=gt(e.kernelConstraint),n.kernelRegularizer=lo(e.kernelRegularizer),n}function Vo(t,e){var n=jo.call(this,e)||this;if(n.bias=null,n.DEFAULT_KERNEL_INITIALIZER="glorotNormal",n.DEFAULT_BIAS_INITIALIZER="zeros",Vo.verifyArgs(e),n.rank=t,1!==n.rank&&2!==n.rank)throw new R("Convolution layer for rank other than 1 or 2 ("+n.rank+") is not implemented yet.");if(n.kernelSize=Co(e.kernelSize,t,"kernelSize"),n.strides=Co(null==e.strides?1:e.strides,t,"strides"),n.padding=null==e.padding?"valid":e.padding,St(n.padding),n.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,Et(n.dataFormat),n.activation=to(e.activation),n.useBias=null==e.useBias||e.useBias,n.biasInitializer=Ze(e.biasInitializer||n.DEFAULT_BIAS_INITIALIZER),n.biasConstraint=gt(e.biasConstraint),n.biasRegularizer=lo(e.biasRegularizer),n.activityRegularizer=lo(e.activityRegularizer),n.dilationRate=Co(null==e.dilationRate?1:e.dilationRate,t,"dilationRate"),1===n.rank&&Array.isArray(n.dilationRate)&&1!==n.dilationRate.length)throw new ot("dilationRate must be a number or an array of a single number for 1D convolution, but received "+JSON.stringify(n.dilationRate));if(2===n.rank)if("number"==typeof n.dilationRate)n.dilationRate=[n.dilationRate,n.dilationRate];else if(2!==n.dilationRate.length)throw new ot("dilationRate must be a number or array of two numbers for 2D convolution, but received "+JSON.stringify(n.dilationRate));return n}B.Bd.registerClass(Fo);var Wo,qo=(u(Ho,Wo=Fo),Ho.prototype.build=function(t){if(4!==(t=nn(t)).length)throw new ot("Input should have rank 4; Received input shape: "+JSON.stringify(t));var e="channelsFirst"===this.dataFormat?1:t.length-1;if(null==t[e])throw new ot("The channel dimension of the inputs should be defined. Found `None`.");var n,r=t[e],i=this.kernelSize.concat([this.filters,r]);this.kernel=this.addWeight("kernel",i,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new ln({ndim:4,axes:(n={},n[e]=r,n)})],this.built=!0},Ho.prototype.call=function(p,t){var d=this;return Object(B.oe)(function(){var t=en(p);if(4!==t.shape.length)throw new ot("Conv2DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-"+t.shape.length);var e,n,r=t.shape,i=r[0];n="channelsFirst"===d.dataFormat?(e=2,3):(e=1,2);var o=r[e],a=r[n],s=d.kernelSize[0],u=d.kernelSize[1],c=d.strides[0],l=d.strides[1],f=[i,To(o,c,s,d.padding),To(a,l,u,d.padding),d.filters];"channelsLast"!==d.dataFormat&&(t=Object(B.ue)(t,[0,2,3,1]));var h=Object(B.gb)(t,d.kernel.read(),f,d.strides,d.padding);return"channelsLast"!==d.dataFormat&&(h=Object(B.ue)(h,[0,3,1,2])),null!=d.bias&&(h=Xt(h,d.bias.read(),d.dataFormat)),null!=d.activation&&(h=d.activation.apply(h)),h})},Ho.prototype.computeOutputShape=function(t){var e,n,r,i=(t=nn(t)).slice();r="channelsFirst"===this.dataFormat?(e=1,n=2,3):(e=3,n=1,2);var o=this.kernelSize[0],a=this.kernelSize[1],s=this.strides[0],u=this.strides[1];return i[e]=this.filters,i[n]=To(i[n],s,o,this.padding),i[r]=To(i[r],u,a,this.padding),i},Ho.prototype.getConfig=function(){var t=Wo.prototype.getConfig.call(this);return delete t.dilationRate,t},Ho.className="Conv2DTranspose",Ho);function Ho(t){var e=Wo.call(this,t)||this;if(e.inputSpec=[new ln({ndim:4})],"same"!==e.padding&&"valid"!==e.padding)throw new ot("Conv2DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode "+e.padding);return e}B.Bd.registerClass(qo);var $o,Go,Ko=(u(Zo,Go=Lo),Zo.prototype.build=function(t){if((t=nn(t)).length<this.rank+2)throw new ot("Inputs to SeparableConv"+this.rank+"D should have rank "+(this.rank+2)+", but received input shape: "+JSON.stringify(t));var e,n="channelsFirst"===this.dataFormat?1:t.length-1;if(null==t[n]||t[n]<0)throw new ot("The channel dimension of the inputs should be defined, but found "+JSON.stringify(t[n]));for(var r=t[n],i=this.kernelSize.concat([r,this.depthMultiplier]),o=[],a=0;a<this.rank;++a)o.push(1);o.push(r*this.depthMultiplier,this.filters),this.depthwiseKernel=this.addWeight("depthwise_kernel",i,"float32",this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.pointwiseKernel=this.addWeight("pointwise_kernel",o,"float32",this.pointwiseInitializer,this.pointwiseRegularizer,!0,this.pointwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.inputSpec=[new ln({ndim:this.rank+2,axes:(e={},e[n]=r,e)})],this.built=!0},Zo.prototype.call=function(e,t){var n=this;return Object(B.oe)(function(){var t;if(e=en(e),1===n.rank)throw new R("1D separable convolution is not implemented yet.");return 2===n.rank&&("channelsFirst"===n.dataFormat&&(e=Object(B.ue)(e,[0,2,3,1])),t=Object(B.Ad)(e,n.depthwiseKernel.read(),n.pointwiseKernel.read(),n.strides,n.padding,n.dilationRate,"NHWC")),n.useBias&&(t=Xt(t,n.bias.read(),n.dataFormat)),null!=n.activation&&(t=n.activation.apply(t)),"channelsFirst"===n.dataFormat&&(t=Object(B.ue)(t,[0,3,1,2])),t})},Zo.prototype.getConfig=function(){var t=Go.prototype.getConfig.call(this);return delete t.rank,delete t.kernelInitializer,delete t.kernelRegularizer,delete t.kernelConstraint,t.depthwiseInitializer=Ye(this.depthwiseInitializer),t.pointwiseInitializer=Ye(this.pointwiseInitializer),t.depthwiseRegularizer=uo(this.depthwiseRegularizer),t.pointwiseRegularizer=uo(this.pointwiseRegularizer),t.depthwiseConstraint=dt(this.depthwiseConstraint),t.pointwiseConstraint=dt(this.pointwiseConstraint),t},Zo.className="SeparableConv",Zo),Xo=(u(Yo,$o=Ko),Yo.className="SeparableConv2D",Yo);function Yo(t){return $o.call(this,2,t)||this}function Zo(t,e){var n=Go.call(this,t,e)||this;if(n.DEFAULT_DEPTHWISE_INITIALIZER="glorotUniform",n.DEFAULT_POINTWISE_INITIALIZER="glorotUniform",n.depthwiseKernel=null,(n.pointwiseKernel=null)==e.filters)throw new ot("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(null!=e.kernelInitializer||null!=e.kernelRegularizer||null!=e.kernelConstraint)throw new ot("Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.");if(null!=e.padding&&"same"!==e.padding&&"valid"!==e.padding)throw new ot("SeparableConv"+n.rank+"D supports only padding modes: 'same' and 'valid', but received "+JSON.stringify(e.padding));return n.depthMultiplier=null==e.depthMultiplier?1:e.depthMultiplier,n.depthwiseInitializer=Ze(e.depthwiseInitializer||n.DEFAULT_DEPTHWISE_INITIALIZER),n.depthwiseRegularizer=lo(e.depthwiseRegularizer),n.depthwiseConstraint=gt(e.depthwiseConstraint),n.pointwiseInitializer=Ze(e.depthwiseInitializer||n.DEFAULT_POINTWISE_INITIALIZER),n.pointwiseRegularizer=lo(e.pointwiseRegularizer),n.pointwiseConstraint=gt(e.pointwiseConstraint),n}B.Bd.registerClass(Xo);var Jo,Qo=(u(ta,Jo=Lo),ta.prototype.getConfig=function(){var t=Jo.prototype.getConfig.call(this);return delete t.rank,delete t.dataFormat,t},ta.verifyArgs=function(t){if("number"!=typeof t.kernelSize&&!q(t.kernelSize,"number",1,1))throw new ot("Conv1D expects config.kernelSize to be number or number[] with length 1, but received "+JSON.stringify(t.kernelSize)+".")},ta.className="Conv1D",ta);function ta(t){var e=Jo.call(this,1,t)||this;return ta.verifyArgs(t),e.inputSpec=[{ndim:3}],e}B.Bd.registerClass(Qo);var ea,na=(u(ra,ea=mn),ra.prototype.computeOutputShape=function(t){return"channelsFirst"===this.dataFormat?[t[0],t[1],t[2]-this.cropping[0][0]-this.cropping[0][1],t[3]-this.cropping[1][0]-this.cropping[1][1]]:[t[0],t[1]-this.cropping[0][0]-this.cropping[0][1],t[2]-this.cropping[1][0]-this.cropping[1][1],t[3]]},ra.prototype.call=function(t,e){var n=this;return Object(B.oe)(function(){return t=en(t),"channelsLast"===n.dataFormat?Ut(Ut(t,n.cropping[0][0],t.shape[1]-n.cropping[0][0]-n.cropping[0][1],2),n.cropping[1][0],t.shape[2]-n.cropping[1][1]-n.cropping[1][0],3):Ut(Ut(t,n.cropping[0][0],t.shape[2]-n.cropping[0][0]-n.cropping[0][1],3),n.cropping[1][0],t.shape[3]-n.cropping[1][1]-n.cropping[1][0],4)})},ra.prototype.getConfig=function(){var t={cropping:this.cropping,dataFormat:this.dataFormat},e=ea.prototype.getConfig.call(this);return Object.assign(t,e),t},ra.className="Cropping2D",ra);function ra(t){var e=ea.call(this,t)||this;return"number"==typeof t.cropping?e.cropping=[[t.cropping,t.cropping],[t.cropping,t.cropping]]:"number"==typeof t.cropping[0]?e.cropping=[[t.cropping[0],t.cropping[0]],[t.cropping[1],t.cropping[1]]]:e.cropping=t.cropping,e.dataFormat=void 0===t.dataFormat?"channelsLast":t.dataFormat,e.inputSpec=[{ndim:4}],e}B.Bd.registerClass(na);var ia,oa=(u(aa,ia=mn),aa.prototype.computeOutputShape=function(t){if("channelsFirst"!==this.dataFormat)return e=null==t[1]?null:this.size[0]*t[1],n=null==t[2]?null:this.size[1]*t[2],[t[0],e,n,t[3]];var e=null==t[2]?null:this.size[0]*t[2],n=null==t[3]?null:this.size[1]*t[3];return[t[0],t[1],e,n]},aa.prototype.call=function(o,t){var a=this;return Object(B.oe)(function(){var t=en(o),e=t.shape;if("channelsFirst"!==a.dataFormat)return n=a.size[0]*e[1],r=a.size[1]*e[2],t.resizeNearestNeighbor([n,r]);t=Object(B.ue)(t,[0,2,3,1]);var n=a.size[0]*e[2],r=a.size[1]*e[3],i=t.resizeNearestNeighbor([n,r]);return Object(B.ue)(i,[0,3,1,2])})},aa.prototype.getConfig=function(){var t={size:this.size,dataFormat:this.dataFormat},e=ia.prototype.getConfig.call(this);return Object.assign(t,e),t},aa.className="UpSampling2D",aa);function aa(t){var e=ia.call(this,t)||this;return e.DEFAULT_SIZE=[2,2],e.inputSpec=[{ndim:4}],e.size=null==t.size?e.DEFAULT_SIZE:t.size,e.dataFormat=null==t.dataFormat?"channelsLast":t.dataFormat,e}B.Bd.registerClass(oa);var sa,ua=(u(ca,sa=Bo),ca.prototype.build=function(t){if((t=nn(t)).length<4)throw new ot("Inputs to DepthwiseConv2D should have rank 4. Received input shape: "+JSON.stringify(t)+".");var e="channelsFirst"===this.dataFormat?1:3;if(null==t[e]||t[e]<0)throw new ot("The channel dimension of the inputs to DepthwiseConv2D should be defined, but is not ("+t[e]+").");var n=t[e],r=[this.kernelSize[0],this.kernelSize[1],n,this.depthMultiplier];this.depthwiseKernel=this.addWeight("depthwise_kernel",r,null,this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[n*this.depthMultiplier],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0},ca.prototype.call=function(e,t){var n=this;return Object(B.oe)(function(){var t=function(e,n,r,i,o,a){return void 0===r&&(r=[1,1]),void 0===i&&(i="valid"),Object(B.oe)(function(){null==o&&(o="channelsLast"),Et(o);var t=Mo(e,o);if(4!==e.rank)throw new ot("Input for depthwiseConv2d is required to be 4-D, but is instead "+e.rank+"-D");if(4!==n.rank)throw new ot("depthwiseKernel is required to be 4-D, but is instead "+n.rank+"-D");return t=Object(B.ob)(t,n,r,"same"===i?"same":"valid","NHWC",a),"channelsFirst"===o&&(t=Object(B.ue)(t,[0,3,1,2])),t})}(e=en(e),n.depthwiseKernel.read(),n.strides,n.padding,n.dataFormat,null);return n.useBias&&(t=Xt(t,n.bias.read(),n.dataFormat)),null!=n.activation&&(t=n.activation.apply(t)),t})},ca.prototype.computeOutputShape=function(t){t=nn(t);var e="channelsFirst"===this.dataFormat?t[2]:t[1],n="channelsFirst"===this.dataFormat?t[3]:t[2],r="channelsFirst"===this.dataFormat?t[1]*this.depthMultiplier:t[3]*this.depthMultiplier,i=Po(e,this.kernelSize[0],this.padding,this.strides[0]),o=Po(n,this.kernelSize[1],this.padding,this.strides[1]);return"channelsFirst"===this.dataFormat?[t[0],r,i,o]:[t[0],i,o,r]},ca.prototype.getConfig=function(){var t=sa.prototype.getConfig.call(this);return t.depthMultiplier=this.depthMultiplier,t.depthwiseInitializer=Ye(this.depthwiseInitializer),t.depthwiseRegularizer=uo(this.depthwiseRegularizer),t.depthwiseConstraint=dt(this.depthwiseRegularizer),t},ca.className="DepthwiseConv2D",ca);function ca(t){var e=sa.call(this,2,t)||this;return e.depthwiseKernel=null,e.depthMultiplier=null==t.depthMultiplier?1:t.depthMultiplier,e.depthwiseInitializer=Ze(t.depthwiseInitializer||e.DEFAULT_KERNEL_INITIALIZER),e.depthwiseConstraint=gt(t.depthwiseConstraint),e.depthwiseRegularizer=lo(t.depthwiseRegularizer),e}B.Bd.registerClass(ua);var la,fa=(u(ha,la=mn),ha.prototype.getNoiseShape=function(t){if(null==this.noiseShape)return this.noiseShape;for(var e=t.shape,n=[],r=0;r<this.noiseShape.length;++r)n.push(null==this.noiseShape[r]?e[r]:this.noiseShape[r]);return n},ha.prototype.call=function(r,i){var o=this;return Object(B.oe)(function(){o.invokeCallHook(r,i);var t=en(r);if(null!=o.noiseShape&&!B.ye.arraysEqual(t.shape,o.noiseShape))throw new R("Non-default noise shape is not implemented in Dropout layer yet: "+JSON.stringify(o.noiseShape));if(0<o.rate&&o.rate<1){var e=null!=i.training&&i.training,n=o.getNoiseShape(t);return Zt(function(){return Yt(t,o.rateScalar,n,o.seed)},function(){return t},e)}return r})},ha.prototype.getConfig=function(){var t={rate:this.rate,noiseShape:this.noiseShape,seed:this.seed},e=la.prototype.getConfig.call(this);return Object.assign(t,e),t},ha.prototype.dispose=function(){var t=la.prototype.dispose.call(this);return this.rateScalar.isDisposed||(this.rateScalar.dispose(),t.numDisposedVariables++),t},ha.className="Dropout",ha);function ha(t){var e=la.call(this,t)||this;if(e.rate=Math.max(Math.min(t.rate,1),0),e.rateScalar=O(e.rate),e.noiseShape=t.noiseShape,e.seed=t.seed,null!=e.seed)throw new R("Non-default seed is not implemented in Dropout layer yet: "+e.seed);return e.supportsMasking=!0,e}B.Bd.registerClass(fa);var pa,da=(u(ma,pa=mn),ma.prototype.build=function(t){var e,n=(t=nn(t))[t.length-1];null==this.kernel&&(this.kernel=this.addWeight("kernel",[n,this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint))),this.inputSpec=[{minNDim:2,axes:(e={},e[-1]=n,e)}],this.built=!0},ma.prototype.computeOutputShape=function(t){var e=(t=nn(t)).slice();return e[e.length-1]=this.units,e},ma.prototype.call=function(e,n){var r=this;return Object(B.oe)(function(){r.invokeCallHook(e,n);var t=$t(en(e),r.kernel.read());return null!=r.bias&&(t=Xt(t,r.bias.read())),null!=r.activation&&(t=r.activation.apply(t)),t})},ma.prototype.getConfig=function(){var t={units:this.units,activation:Ji(this.activation),useBias:this.useBias,kernelInitializer:Ye(this.kernelInitializer),biasInitializer:Ye(this.biasInitializer),kernelRegularizer:uo(this.kernelRegularizer),biasRegularizer:uo(this.biasRegularizer),activityRegularizer:uo(this.activityRegularizer),kernelConstraint:dt(this.kernelConstraint),biasConstraint:dt(this.biasConstraint)},e=pa.prototype.getConfig.call(this);return Object.assign(t,e),t},ma.className="Dense",ma);function ma(t){var e=pa.call(this,t)||this;if(e.activation=null,e.useBias=!0,e.kernel=null,e.bias=null,e.DEFAULT_KERNEL_INITIALIZER="glorotNormal",e.DEFAULT_BIAS_INITIALIZER="zeros",null==t.batchInputShape&&null==t.inputShape&&null!=t.inputDim){var n=null;null!=t.batchSize&&(n=t.batchSize),e.batchInputShape=[n,t.inputDim]}return e.units=t.units,e.activation=to(t.activation),null!=t.useBias&&(e.useBias=t.useBias),e.kernelInitializer=Ze(t.kernelInitializer||e.DEFAULT_KERNEL_INITIALIZER),e.biasInitializer=Ze(t.biasInitializer||e.DEFAULT_BIAS_INITIALIZER),e.kernelConstraint=gt(t.kernelConstraint),e.biasConstraint=gt(t.biasConstraint),e.kernelRegularizer=lo(t.kernelRegularizer),e.biasRegularizer=lo(t.biasRegularizer),e.activityRegularizer=lo(t.activityRegularizer),e.supportsMasking=!0,e.inputSpec=[{minNDim:2}],e}B.Bd.registerClass(da);var ga,ya=(u(va,ga=mn),va.prototype.computeOutputShape=function(t){for(var e=0,n=(t=nn(t)).slice(1);e<n.length;e++)if(null==n[e])throw new ot('The shape of the input to "Flatten" is not fully defined (got '+t.slice(1)+'). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.');return[t[0],Tt(t,1)]},va.prototype.call=function(t,e){var n=this;return Object(B.oe)(function(){return n.invokeCallHook(t,e),function(t){if(t.rank<=1)throw new ot("batchFlatten requires a minimum rank of 2. Got rank: "+t.rank+".");var e=[t.shape[0],Tt(t.shape,1)];return t.reshape(e)}(en(t))})},va.className="Flatten",va);function va(t){var e=ga.call(this,t||{})||this;return e.inputSpec=[{minNDim:3}],e}B.Bd.registerClass(ya);var ba,wa=(u(_a,ba=mn),_a.prototype.call=function(e,n){var r=this;return Object(B.oe)(function(){r.invokeCallHook(e,n);var t=en(e);return r.activation.apply(t)})},_a.prototype.getConfig=function(){var t={activation:Ji(this.activation)},e=ba.prototype.getConfig.call(this);return Object.assign(t,e),t},_a.className="Activation",_a);function _a(t){var e=ba.call(this,t)||this;return e.supportsMasking=!0,e.activation=to(t.activation),e}B.Bd.registerClass(wa);var xa,Ea=(u(Sa,xa=mn),Sa.prototype.computeOutputShape=function(t){return[t[0],this.n,t[1]]},Sa.prototype.call=function(t,e){var n=this;return Object(B.oe)(function(){return function(t,e){return Object(B.oe)(function(){if(2!==t.shape.length)throw new ot("repeat() expects a rank-2 tensor, but received a rank-"+t.shape.length+" tensor.");return qt(Lt(t,1),[1,e,1])})}(t=en(t),n.n)})},Sa.prototype.getConfig=function(){var t={n:this.n},e=xa.prototype.getConfig.call(this);return Object.assign(t,e),t},Sa.className="RepeatVector",Sa);function Sa(t){var e=xa.call(this,t)||this;return e.n=t.n,e.inputSpec=[{ndim:2}],e}B.Bd.registerClass(Ea);var Na,Ia=(u(Oa,Na=mn),Oa.prototype.isUnknown=function(t){return t<0||null==t},Oa.prototype.fixUnknownDimension=function(t,e){for(var n="Total size of new array must be unchanged.",r=e.slice(),i=1,o=null,a=0;a<r.length;++a){var s=r[a];if(this.isUnknown(s)){if(null!==o)throw new ot("Can only specifiy one unknown dimension.");o=a}else i*=s}var u=Tt(t);if(null!==o){if(0===i||u%i!=0)throw new ot(n);r[o]=u/i}else if(u!==i)throw new ot(n);return r},Oa.prototype.computeOutputShape=function(t){for(var e=!1,n=0;n<t.length;++n)if(this.isUnknown(t[n])){e=!0;break}return e?t.slice(0,1).concat(this.targetShape):t.slice(0,1).concat(this.fixUnknownDimension(t.slice(1),this.targetShape))},Oa.prototype.call=function(r,i){var o=this;return Object(B.oe)(function(){o.invokeCallHook(r,i);var t=en(r),e=t.shape,n=e.slice(0,1).concat(o.fixUnknownDimension(e.slice(1),o.targetShape));return t.reshape(n)})},Oa.prototype.getConfig=function(){var t={targetShape:this.targetShape},e=Na.prototype.getConfig.call(this);return Object.assign(t,e),t},Oa.className="Reshape",Oa);function Oa(t){var e=Na.call(this,t)||this;e.targetShape=t.targetShape;for(var n=0;n<e.targetShape.length;++n)e.isUnknown(e.targetShape[n])&&(e.targetShape[n]=null);return e}B.Bd.registerClass(Ia);var ka,Aa=(u(Ca,ka=mn),Ca.prototype.computeOutputShape=function(n){var r=(n=nn(n)).slice();return this.dims.forEach(function(t,e){r[e+1]=n[t]}),r},Ca.prototype.call=function(t,e){return Object(B.ue)(en(t),this.dimsIncludingBatch)},Ca.prototype.getConfig=function(){var t={dims:this.dims},e=ka.prototype.getConfig.call(this);return Object.assign(t,e),t},Ca.className="Permute",Ca);function Ca(t){var e=ka.call(this,t)||this;if(null==t.dims)throw new Error("Required configuration field `dims` is missing during Permute constructor call.");if(!Array.isArray(t.dims))throw new Error("Permute constructor requires `dims` to be an Array, but received "+t.dims+" instead.");var n=jt(1,t.dims.length+1);if(!B.ye.arraysEqual(t.dims.slice().sort(),n))throw new Error("Invalid permutation `dims`: "+JSON.stringify(t.dims)+" `dims` must contain consecutive integers starting from 1.");return e.dims=t.dims,e.dimsIncludingBatch=[0].concat(e.dims),e.inputSpec=[new ln({ndim:e.dims.length+1})],e}B.Bd.registerClass(Aa);var Pa,Ta=(u(Ma,Pa=mn),Ma.prototype.build=function(t){this.embeddings=this.addWeight("embeddings",[this.inputDim,this.outputDim],this.dtype,this.embeddingsInitializer,this.embeddingsRegularizer,!0,this.embeddingsConstraint),this.built=!0},Ma.prototype.warnOnIncompatibleInputShape=function(t){},Ma.prototype.computeMask=function(t,e){var n=this;return Object(B.oe)(function(){return n.maskZero?(t=en(t),Object(B.Oc)(t,Object(B.Ie)(t))):null})},Ma.prototype.computeOutputShape=function(t){if(t=nn(t),null==this.inputLength)return t.concat([this.outputDim]);var e=L(this.inputLength);if(e.length!==t.length-1)throw new ot('"inputLength" is '+this.inputLength+", but received input shape has shape "+t);for(var n=0,r=0;r<e.length;++r){var i=e[r],o=t[r+1];if(null!=i&&null!=o&&i!==o)throw new ot('"inputLength" is '+this.inputLength+", but received input shape has shape "+t);null==i&&(e[n]=o),n++}return[t[0]].concat(e,[this.outputDim])},Ma.prototype.call=function(e,n){var r=this;return Object(B.oe)(function(){r.invokeCallHook(e,n);var t=en(e);return"int32"!==t.dtype&&(t=Bt(t,"int32")),Gt(r.embeddings.read(),t.as1D()).reshape(nn(r.computeOutputShape(t.shape)))})},Ma.prototype.getConfig=function(){var t={inputDim:this.inputDim,outputDim:this.outputDim,embeddingsInitializer:Ye(this.embeddingsInitializer),embeddingsRegularizer:uo(this.embeddingsRegularizer),activityRegularizer:uo(this.activityRegularizer),embeddingsConstraint:dt(this.embeddingsConstraint),maskZero:this.maskZero,inputLength:this.inputLength},e=Pa.prototype.getConfig.call(this);return Object.assign(t,e),t},Ma.className="Embedding",Ma);function Ma(t){var e=Pa.call(this,t)||this;if(e.embeddings=null,e.DEFAULT_EMBEDDINGS_INITIALIZER="randomUniform",null==t.batchInputShape&&null==t.inputShape){var n=null;null!=t.batchSize&&(n=t.batchSize),null==t.inputLength?e.batchInputShape=[n,null]:e.batchInputShape=[n].concat(L(t.inputLength))}return e.inputDim=t.inputDim,e.outputDim=t.outputDim,e.embeddingsInitializer=Ze(t.embeddingsInitializer||e.DEFAULT_EMBEDDINGS_INITIALIZER),e.embeddingsRegularizer=lo(t.embeddingsRegularizer),e.activityRegularizer=lo(t.activityRegularizer),e.embeddingsConstraint=gt(t.embeddingsConstraint),e.maskZero=t.maskZero,e.supportsMasking=t.maskZero,e.inputLength=t.inputLength,e}B.Bd.registerClass(Ta);var Ra,Da,ja=(u(Fa,Da=mn),Fa.prototype.mergeFunction=function(t){throw new R},Fa.prototype.computeElementwiseOpOutputShape=function(t,e){if(null==t||null==e)return null;if(t.length<e.length)return this.computeElementwiseOpOutputShape(e,t);if(0===e.length)return t;for(var n=t.slice(0,t.length-e.length),r=0;r<e.length;++r){var i=t[t.length-e.length+r],o=e[r];if(null==i||null==o||i<0||o<0)n.push(null);else if(1===i)n.push(o);else if(1===o)n.push(i);else{if(i!==o)throw new ot("Operands could not be broadcast together with shapes "+JSON.stringify(t)+" "+JSON.stringify(e));n.push(i)}}return n},Fa.prototype.build=function(t){if(Array.isArray(t)&&!Array.isArray(t[0])&&(t=[nn(t)]),(t=t).length<2)throw new ot("A merge layer should be called on an Array of at least 2 inputs. Got "+t.length+" input(s).");for(var e=[],n=0,r=t;n<r.length;n++)null!=(a=r[n])&&null!==a[0]&&e.push(a[0]);if(1<(e=ut(e)).length)throw new ot("Can not merge tensors with different batch sizes. Got tensors with shapes: "+JSON.stringify(t)+".");for(var i=null==t[0]?null:t[0].slice(1),o=1;o<t.length;++o){var a=null==t[o]?null:t[o].slice(1);i=this.computeElementwiseOpOutputShape(i,a)}var s=t.map(function(t){return t.length});-1===t.indexOf(null)&&1===ut(s).length?this.reshapeRequired=!1:this.reshapeRequired=!0},Fa.prototype.call=function(b,t){var w=this;return Object(B.oe)(function(){if(b=b,w.reshapeRequired){var t=[],e=b.map(function(t){return t.rank});if(-1===e.indexOf(null)){for(var n=Dt(e),r=0,i=b;r<i.length;r++){for(var o=(l=i[r]).rank,a=0;a<n-o;++a)l=Lt(l,1);t.push(l)}return w.mergeFunction(t)}for(var s=!1,u=0,c=b;u<c.length;u++){var l;if(null==(o=(l=c[u]).rank)){var f=l.shape,h=f[0],p=f.slice(1).concat([h]),d=l.reshape([h].concat(Tt(f.slice(1))));d=(d=Object(B.ue)(d,[1,0])).reshape(p),t.push(d),s=!0}else if(1<o){var m=jt(1,o).concat([0]);t.push(Object(B.ue)(l,m)),s=!0}else t.push(l)}var g=w.mergeFunction(t),y=g.rank;if(s)if(null==y){var v=g.shape;p=[h=v[v.length-1]].concat(v.slice(0,v.length-1)),g=Object(B.ue)(g.reshape([-1,h]),[1,0]).reshape(p)}else 1<y&&(m=[y-1].concat(jt(0,y-1)),g=Object(B.ue)(g,m));return g}return w.mergeFunction(b)})},Fa.prototype.computeOutputShape=function(t){var e;e=null==(t=t)[0]?null:t[0].slice(1);for(var n=1;n<t.length;++n){var r=null==t[n]?null:t[n].slice(1);e=this.computeElementwiseOpOutputShape(e,r)}for(var i=[],o=0,a=t;o<a.length;o++)null!=(r=a[o])&&null!==r[0]&&i.push(r[0]);return 1===(i=ut(i)).length?i.concat(e):[null].concat(e)},Fa.prototype.computeMask=function(n,r){return Object(B.oe)(function(){if(null==r)return null;if(!Array.isArray(r))throw new ot("`mask` should be an Array");if(!Array.isArray(n))throw new ot("`inputs` should be an Array");if(r.length!==n.length)throw new ot("The Array 'inputs' and 'mask' are expected to have the same length, but have different lengths ("+n.length+" vs "+r.length+")");if(r.every(function(t){return null==t}))return null;for(var t=(r=r.map(function(t){return null==t?t:Object(B.Cb)(t,0)}))[0],e=1;e<r.length-1;++e)t=Object(B.nc)(t,r[e]);return t})},Fa),Ba=(u(La,Ra=ja),La.prototype.mergeFunction=function(n){return Object(B.oe)(function(){for(var t=n[0].clone(),e=1;e<n.length;++e)t=Object(B.u)(t,n[e]);return t})},La.className="Add",La);function La(t){return Ra.call(this,t)||this}function Fa(t){var e=Da.call(this,t||{})||this;return e.supportsMasking=!0,e}B.Bd.registerClass(Ba);var za,Ua=(u(Va,za=ja),Va.prototype.mergeFunction=function(n){return Object(B.oe)(function(){for(var t=n[0].clone(),e=1;e<n.length;++e)t=Object(B.Hc)(t,n[e]);return t})},Va.className="Multiply",Va);function Va(t){return za.call(this,t)||this}B.Bd.registerClass(Ua);var Wa,qa=(u(Ha,Wa=ja),Ha.prototype.mergeFunction=function(n){return Object(B.oe)(function(){for(var t=n[0].clone(),e=1;e<n.length;++e)t=Object(B.u)(t,n[e]);return Object(B.Hc)(O(1/n.length),t)})},Ha.className="Average",Ha);function Ha(t){return Wa.call(this,t)||this}B.Bd.registerClass(qa);var $a,Ga=(u(Ka,$a=ja),Ka.prototype.mergeFunction=function(n){return Object(B.oe)(function(){for(var t=n[0],e=1;e<n.length;++e)t=Object(B.wc)(t,n[e]);return t})},Ka.className="Maximum",Ka);function Ka(t){return $a.call(this,t)||this}B.Bd.registerClass(Ga);var Xa,Ya=(u(Za,Xa=ja),Za.prototype.mergeFunction=function(n){return Object(B.oe)(function(){for(var t=n[0],e=1;e<n.length;++e)t=Object(B.Bc)(t,n[e]);return t})},Za.className="Minimum",Za);function Za(t){return Xa.call(this,t)||this}B.Bd.registerClass(Ya);var Ja,Qa=(u(ts,Ja=ja),ts.prototype.build=function(t){if(!Array.isArray(t)||!Array.isArray(t[0])||1===t.length)throw new ot("A `Concatenate` layer should be called on a list of at least 2 inputs");for(var e=!0,n=0,r=t=t;n<r.length;n++)if(null!=(l=r[n])){e=!1;break}if(!e){for(var i=[],o=0;o<t.length;++o){var a=t[o].slice();a.splice(this.axis,1);for(var s=!1,u=0,c=i;u<c.length;u++){var l=c[u];if(B.ye.arraysEqual(l,a)){s=!0;break}}s||i.push(a)}if(1<i.length)throw new ot("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(t))}},ts.prototype.mergeFunction=function(t){var e=this;return Object(B.oe)(function(){return Vt(t,e.axis)})},ts.prototype.computeOutputShape=function(t){if(!Array.isArray(t)||!Array.isArray(t[0]))throw new ot("A `Concatenate` layer should be called on a list of inputs.");for(var e=t,n=e[0].slice(),r=this.axis<0?n.length+this.axis:this.axis,i=0,o=e.slice(1);i<o.length;i++){var a=o[i];if(null==n[r]||null==a[r]){n[r]=null;break}n[r]+=a[r]}return n},ts.prototype.computeMask=function(i,o){var a=this;if(null==o)return null;if(!Array.isArray(o))throw new ot("`mask` should be an array for Concatenate");if(!Array.isArray(i))throw new ot("`inputs` should be an array for Concatenate");if(o.length!==i.length)throw new ot("Mismatch in the length of mask ("+o.length+") and the legnth of inputs ("+i.length+")");return Object(B.oe)(function(){var e=!0;if(o.forEach(function(t){null==t||(e=!1)}),e)return null;for(var t=[],n=0;n<i.length;++n)null==o[n]?t.push(Object(B.Sc)(i[n]).asType("bool")):o[n].rank<i[n].rank?t.push(Object(B.Cb)(o[n],-1)):t.push(o[n]);var r=Object(B.Y)(t,a.axis);return Object(B.x)(r,-1,!1)})},ts.prototype.getConfig=function(){var t={axis:this.axis},e=Ja.prototype.getConfig.call(this);return Object.assign(t,e),t},ts.className="Concatenate",ts);function ts(t){var e=Ja.call(this,t)||this;return e.DEFAULT_AXIS=-1,null==t&&(t={}),e.axis=null==t.axis?e.DEFAULT_AXIS:t.axis,e.supportsMasking=!0,e.reshapeRequired=!1,e}function es(t,e){for(;t<0;)t+=e;return t}B.Bd.registerClass(Qa);var ns,rs=(u(is,ns=ja),is.prototype.build=function(t){B.ye.assert(Array.isArray(t)&&2===t.length&&Array.isArray(t[0])&&Array.isArray(t[1]),"A `Dot` layer should be called on a list of exactly 2 inputs.");var e=t[0],n=t[1];if(3<e.length||3<n.length)throw new R("Dot layer does not support tensors of 4D or higher rank yet.");var r=this.interpretAxes(e,n);if(e[r[0]]!==n[r[1]])throw new ot("Dimension incompatibility: "+e[r[0]]+" !== "+n[r[1]])},is.prototype.mergeFunction=function(n){if(2!==n.length)throw new ot("A `Dot` layer must be called on exactly 2 inputs, but received "+n.length+" input(s).");var t,e=n[0],r=n[1];return t=Array.isArray(this.axes)?this.axes.map(function(t,e){return es(t,n[e].shape.length)}):[es(this.axes,e.shape.length),es(this.axes,r.shape.length)],this.normalize&&(e=Hn(e,t[0]),r=Hn(r,t[1])),function(u,c,t){if(3<u.shape.length||3<c.shape.length)throw new R("batchDot is not implemented for tensors of 4D or higher rank yet");if(B.ye.assert(2<=u.shape.length,"batchDot requires the rank of x to be >= 2, but got "+u.shape.length),B.ye.assert(2<=u.shape.length,"batchDot requires the rank of y to be >= 2, but got "+c.shape.length),"number"==typeof t&&(t=[t,t]),"complex64"===u.dtype||"complex64"===c.dtype)throw new R("batchDot is not implemented for complex64-type Tensors yet.");var l=u.shape.length,f=c.shape.length;null==t&&(t=[l-1,f-2]);var h=t;return Object(B.oe)(function(){var t,e;if(f<l){t=l-f;for(var n=[],r=0;r<t;++r)n.push(1);c=c.reshape(c.shape.concat(n))}else if(l<f){for(t=f-l,n=[],r=0;r<t;++r)n.push(1);u=u.reshape(u.shape.concat(n))}else t=0;if(2===u.shape.length&&2===c.shape.length)e=h[0]===h[1]?u.mulStrict(c).sum(h[0]):u.transpose([1,0]).mulStrict(c).sum(h[1]);else{var i=h[0]!==u.shape.length-1,o=h[1]===c.shape.length-1;e=u.matMul(c,i,o)}if(0<t){var a,s=[];for(r=a=f<l?l+f-3:l-1;r<a+t;++r)s.push(r);e=e.squeeze(s)}return 1===e.shape.length&&(e=e.expandDims(1)),e})}(e,r,t)},is.prototype.interpretAxes=function(t,e){return Array.isArray(this.axes)?this.axes:[es(this.axes,t.length),es(this.axes,e.length)]},is.prototype.computeOutputShape=function(t){B.ye.assert(Array.isArray(t)&&2===t.length&&Array.isArray(t[0])&&Array.isArray(t[1]),"A `Dot` layer should be called on a list of exactly 2 inputs.");var e=t[0].slice(),n=t[1].slice();if(3<e.length||3<n.length)throw new R("Dot layer does not support tensors of 4D or higher rank yet.");var r=this.interpretAxes(e,n);e.splice(r[0],1),n.splice(r[1],1),n.splice(0,1);var i=e.concat(n);return 1===i.length&&i.push(1),i},is.prototype.computeMask=function(t,e){return null},is.prototype.getConfig=function(){var t={axes:this.axes,normalize:this.normalize},e=ns.prototype.getConfig.call(this);return Object.assign(t,e),t},is.className="Dot",is);function is(t){var e=ns.call(this,t)||this;return e.axes=t.axes,e.normalize=null!=t.normalize&&t.normalize,e.supportsMasking=!0,e.reshapeRequired=!1,e}function os(t,e,n,r,i,o){var a;if(void 0===o&&(o=.001),2===t.rank)a=Object(B.J)(t,e,n,r,i,o);else if(3===t.rank)a=Object(B.K)(t,e,n,r,i,o);else{if(4!==t.rank)throw new R("batchNormalization is not implemented for array of rank "+t.rank+" yet");a=Object(B.L)(t,e,n,r,i,o)}return a}function as(t,e,n,r,i){return void 0===i&&(i=.001),B.ye.arraysEqual(r.slice().sort(),jt(0,t.rank-1))?function(r,i,o,a,s){return void 0===s&&(s=.001),Object(B.oe)(function(){var t=Object(B.Fc)(r,a),e=t.mean,n=t.variance;return[os(r,e,n,o,i,s),e,n]})}(t,e,n,r,i):function(f,h,p,d,m){return void 0===m&&(m=.001),Object(B.oe)(function(){for(var t=Object(B.Fc)(f,d),e=t.mean,n=t.variance,r=[],i=0,o=jt(0,f.rank);i<o.length;i++){var a=o[i];-1!==d.indexOf(a)?r.push(1):r.push(f.shape[a])}var s=e.reshape(r),u=n.reshape(r),c=null==h?null:h.reshape(r),l=null==p?null:p.reshape(r);return[os(f,s,u,l,c,m),e,n]})}(t,e,n,r,i)}B.Bd.registerClass(rs);var ss,us=(u(cs,ss=mn),cs.prototype.build=function(t){t=nn(t);var e=0<=this.axis?this.axis:this.axis+t.length,n=t[e];if(null==n)throw new ot("Axis "+e+" of input tensor should have a defined dimension but the layer received an input with shape "+JSON.stringify(t)+".");this.inputSpec=[new ln({ndim:t.length,axes:(r={},r[e]=n,r)})];var r,i=[n];this.scale&&(this.gamma=this.addWeight("gamma",i,null,this.gammaInitializer,this.gammaRegularizer,!0,this.gammaConstraint)),this.center&&(this.beta=this.addWeight("beta",i,null,this.betaInitializer,this.betaRegularizer,!0,this.betaConstraint)),this.movingMean=this.addWeight("moving_mean",i,null,this.movingMeanInitializer,null,!1),this.movingVariance=this.addWeight("moving_variance",i,null,this.movingVarianceInitializer,null,!1),this.built=!0},cs.prototype.call=function(d,m){var g=this;return Object(B.oe)(function(){var t=null!=m.training&&m.training,i=en(d),e=i.shape,n=e.length,r=jt(0,n),o=0<=g.axis?g.axis:g.axis+n;r.splice(o,1);var a=D(1,n);a[o]=e[o];var s=r.slice();s.sort();var u=!B.ye.arraysEqual(s,jt(0,n).slice(0,n-1));if(!t)return function(){if(u){var t=g.movingMean.read().reshape(a),e=g.movingVariance.read().reshape(a),n=g.center?g.beta.read().reshape(a):null,r=g.scale?g.gamma.read().reshape(a):null;return os(i,t,e,n,r,g.epsilon)}return os(i,g.movingMean.read(),g.movingVariance.read(),null==g.beta?null:g.beta.read(),null==g.gamma?null:g.gamma.read(),g.epsilon)}();function c(r,i,o){Object(B.oe)(function(){var t=O(1).sub(O(o)),e=r.read(),n=e.sub(i).mul(t);r.write(e.sub(n))})}var l=as(i,g.gamma.read(),g.beta.read(),r,g.epsilon),f=l[0],h=l[1],p=l[2];return c(g.movingMean,h,g.momentum),c(g.movingVariance,p,g.momentum),f})},cs.prototype.getConfig=function(){var t={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:Ye(this.betaInitializer),gammaInitializer:Ye(this.gammaInitializer),movingMeanInitializer:Ye(this.movingMeanInitializer),movingVarianceInitializer:Ye(this.movingVarianceInitializer),betaRegularizer:uo(this.betaRegularizer),gammaRegularizer:uo(this.gammaRegularizer),betaConstraint:dt(this.betaConstraint),gammaConstraint:dt(this.gammaConstraint)},e=ss.prototype.getConfig.call(this);return Object.assign(t,e),t},cs.className="BatchNormalization",cs);function cs(t){var e=this;return null==t&&(t={}),(e=ss.call(this,t)||this).supportsMasking=!0,e.axis=null==t.axis?-1:t.axis,e.momentum=null==t.momentum?.99:t.momentum,e.epsilon=null==t.epsilon?.001:t.epsilon,e.center=null==t.center||t.center,e.scale=null==t.scale||t.scale,e.betaInitializer=Ze(t.betaInitializer||"zeros"),e.gammaInitializer=Ze(t.gammaInitializer||"ones"),e.movingMeanInitializer=Ze(t.movingMeanInitializer||"zeros"),e.movingVarianceInitializer=Ze(t.movingVarianceInitializer||"ones"),e.betaConstraint=gt(t.betaConstraint),e.gammaConstraint=gt(t.gammaConstraint),e.betaRegularizer=lo(t.betaRegularizer),e.gammaRegularizer=lo(t.gammaRegularizer),e}B.Bd.registerClass(us);var ls,fs=(u(hs,ls=mn),hs.prototype.computeOutputShape=function(t){var e,n;return t=nn(t),"channelsFirst"===this.dataFormat?(e=null!=t[2]&&0<=t[2]?t[2]+this.padding[0][0]+this.padding[0][1]:null,n=null!=t[3]&&0<=t[3]?t[3]+this.padding[1][0]+this.padding[1][1]:null,[t[0],t[1],e,n]):(e=null!=t[1]&&0<=t[1]?t[1]+this.padding[0][0]+this.padding[0][1]:null,n=null!=t[2]&&0<=t[2]?t[2]+this.padding[1][0]+this.padding[1][1]:null,[t[0],e,n,t[3]])},hs.prototype.call=function(t,e){var n=this;return Object(B.oe)(function(){return function(e,n,r){return Object(B.oe)(function(){if(4!==e.rank)throw new ot("temporalPadding expects input tensor to be 4-D, but received a "+e.rank+"-D tensor.");if(null==n&&(n=[[1,1],[1,1]]),2!==n.length||2!==n[0].length||2!==n[1].length)throw new ot("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");if(null==r&&(r="channelsLast"),"channelsLast"!==r&&"channelsFirst"!==r)throw new ot("Unknown data format: "+r+". Supported data formats are 'channelsLast' and 'channelsFirst.");var t;return t="channelsFirst"===r?[[0,0],[0,0],n[0],n[1]]:[[0,0],n[0],n[1],[0,0]],Object(B.Vc)(e,t)})}(en(t),n.padding,n.dataFormat)})},hs.prototype.getConfig=function(){var t={padding:this.padding,dataFormat:this.dataFormat},e=ls.prototype.getConfig.call(this);return Object.assign(t,e),t},hs.className="ZeroPadding2D",hs);function hs(t){var e=this;if(null==t&&(t={}),(e=ls.call(this,t)||this).dataFormat=null==t.dataFormat?"channelsLast":t.dataFormat,null==t.padding)e.padding=[[1,1],[1,1]];else if("number"==typeof t.padding)e.padding=[[t.padding,t.padding],[t.padding,t.padding]];else{if(t.padding=t.padding,2!==t.padding.length)throw new ot("ZeroPadding2D expects padding to be a length-2 array, but received a length-"+t.padding.length+" array.");var n=void 0,r=void 0;if("number"==typeof t.padding[0])n=[t.padding[0],t.padding[0]],r=[t.padding[1],t.padding[1]];else{if(t.padding=t.padding,2!==t.padding[0].length)throw new ot("ZeroPadding2D expects height padding to be a length-2 array, but received a length-"+t.padding[0].length+" array.");if(n=t.padding[0],2!==t.padding[1].length)throw new ot("ZeroPadding2D expects width padding to be a length-2 array, but received a length-"+t.padding[1].length+" array.");r=t.padding[1]}e.padding=[n,r]}return e.inputSpec=[new ln({ndim:4})],e}function ps(n,r,i,o,a,s){return Object(B.oe)(function(){var t;Et(a),function(t){W(wt,"PoolMode",t)}(s),St(o),null==i&&(i=[1,1]),null==o&&(o="valid"),null==a&&(a="channelsLast"),null==s&&(s="max"),n=Mo(n,a);var e="same"===o?"same":"valid";return t="max"===s?Object(B.vc)(n,r,i,e):Object(B.G)(n,r,i,e),"channelsFirst"===a&&(t=Object(B.ue)(t,[0,3,1,2])),t})}B.Bd.registerClass(fs);var ds,ms,gs=(u(bs,ms=mn),bs.prototype.computeOutputShape=function(t){var e=Po((t=nn(t))[1],this.poolSize[0],this.padding,this.strides[0]);return[t[0],e,t[2]]},bs.prototype.call=function(e,n){var r=this;return Object(B.oe)(function(){r.invokeCallHook(e,n),e=Lt(en(e),2);var t=r.poolingFunction(en(e),[r.poolSize[0],1],[r.strides[0],1],r.padding,"channelsLast");return Object(B.Xd)(t,[2])})},bs.prototype.getConfig=function(){var t={poolSize:this.poolSize,padding:this.padding,strides:this.strides},e=ms.prototype.getConfig.call(this);return Object.assign(t,e),t},bs),ys=(u(vs,ds=gs),vs.prototype.poolingFunction=function(t,e,n,r,i){return Et(i),St(r),ps(t,e,n,r,i,"max")},vs.className="MaxPooling1D",vs);function vs(t){return ds.call(this,t)||this}function bs(t){var e=this;if(null==t.poolSize&&(t.poolSize=2),e=ms.call(this,t)||this,"number"==typeof t.poolSize)e.poolSize=[t.poolSize];else{if(!Array.isArray(t.poolSize)||1!==t.poolSize.length||"number"!=typeof t.poolSize[0])throw new ot("poolSize for 1D convolutional layer must be a number or an Array of a single number, but received "+JSON.stringify(t.poolSize));e.poolSize=t.poolSize}if(null==t.strides)e.strides=e.poolSize;else if("number"==typeof t.strides)e.strides=[t.strides];else{if(!Array.isArray(t.strides)||1!==t.strides.length||"number"!=typeof t.strides[0])throw new ot("strides for 1D convolutional layer must be a number or an Array of a single number, but received "+JSON.stringify(t.strides));e.strides=t.strides}return e.padding=null==t.padding?"valid":t.padding,St(e.padding),e.inputSpec=[new ln({ndim:3})],e}B.Bd.registerClass(ys);var ws,_s=(u(xs,ws=gs),xs.prototype.poolingFunction=function(t,e,n,r,i){return Et(i),St(r),ps(t,e,n,r,i,"avg")},xs.className="AveragePooling1D",xs);function xs(t){return ws.call(this,t)||this}B.Bd.registerClass(_s);var Es,Ss,Ns=(u(ks,Ss=mn),ks.prototype.computeOutputShape=function(t){t=nn(t);var e="channelsFirst"===this.dataFormat?t[2]:t[1],n="channelsFirst"===this.dataFormat?t[3]:t[2];return e=Po(e,this.poolSize[0],this.padding,this.strides[0]),n=Po(n,this.poolSize[1],this.padding,this.strides[1]),"channelsFirst"===this.dataFormat?[t[0],t[1],e,n]:[t[0],e,n,t[3]]},ks.prototype.call=function(t,e){var n=this;return Object(B.oe)(function(){return n.invokeCallHook(t,e),n.poolingFunction(en(t),n.poolSize,n.strides,n.padding,n.dataFormat)})},ks.prototype.getConfig=function(){var t={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},e=Ss.prototype.getConfig.call(this);return Object.assign(t,e),t},ks),Is=(u(Os,Es=Ns),Os.prototype.poolingFunction=function(t,e,n,r,i){return Et(i),St(r),ps(t,e,n,r,i,"max")},Os.className="MaxPooling2D",Os);function Os(t){return Es.call(this,t)||this}function ks(t){var e=this;if(null==t.poolSize&&(t.poolSize=[2,2]),(e=Ss.call(this,t)||this).poolSize=Array.isArray(t.poolSize)?t.poolSize:[t.poolSize,t.poolSize],null==t.strides)e.strides=e.poolSize;else if(Array.isArray(t.strides)){if(2!==t.strides.length)throw new ot("If the strides property of a 2D pooling layer is an Array, it is expected to have a length of 2, but received length "+t.strides.length+".");e.strides=t.strides}else e.strides=[t.strides,t.strides];return e.padding=null==t.padding?"valid":t.padding,e.dataFormat=null==t.dataFormat?"channelsLast":t.dataFormat,Et(e.dataFormat),St(e.padding),e.inputSpec=[new ln({ndim:4})],e}B.Bd.registerClass(Is);var As,Cs=(u(Ps,As=Ns),Ps.prototype.poolingFunction=function(t,e,n,r,i){return Et(i),St(r),ps(t,e,n,r,i,"avg")},Ps.className="AveragePooling2D",Ps);function Ps(t){return As.call(this,t)||this}B.Bd.registerClass(Cs);var Ts,Ms,Rs=(u(Bs,Ms=mn),Bs.prototype.computeOutputShape=function(t){return[t[0],t[2]]},Bs.prototype.call=function(t,e){throw new R},Bs),Ds=(u(js,Ts=Rs),js.prototype.call=function(e,t){return Object(B.oe)(function(){var t=en(e);return Object(B.yc)(t,1)})},js.className="GlobalAveragePooling1D",js);function js(t){return Ts.call(this,t||{})||this}function Bs(t){var e=Ms.call(this,t)||this;return e.inputSpec=[new ln({ndim:3})],e}B.Bd.registerClass(Ds);var Ls,Fs=(u(zs,Ls=Rs),zs.prototype.call=function(e,t){return Object(B.oe)(function(){var t=en(e);return Object(B.uc)(t,1)})},zs.className="GlobalMaxPooling1D",zs);function zs(t){return Ls.call(this,t||{})||this}B.Bd.registerClass(Fs);var Us,Vs,Ws=(u($s,Vs=mn),$s.prototype.computeOutputShape=function(t){return t=t,"channelsLast"===this.dataFormat?[t[0],t[3]]:[t[0],t[1]]},$s.prototype.call=function(t,e){throw new R},$s.prototype.getConfig=function(){var t={dataFormat:this.dataFormat},e=Vs.prototype.getConfig.call(this);return Object.assign(t,e),t},$s),qs=(u(Hs,Us=Ws),Hs.prototype.call=function(e,t){var n=this;return Object(B.oe)(function(){var t=en(e);return"channelsLast"===n.dataFormat?Object(B.yc)(t,[1,2]):Object(B.yc)(t,[2,3])})},Hs.className="GlobalAveragePooling2D",Hs);function Hs(){return null!==Us&&Us.apply(this,arguments)||this}function $s(t){var e=Vs.call(this,t)||this;return e.dataFormat=null==t.dataFormat?"channelsLast":t.dataFormat,Et(e.dataFormat),e.inputSpec=[new ln({ndim:4})],e}B.Bd.registerClass(qs);var Gs,Ks=(u(Xs,Gs=Ws),Xs.prototype.call=function(e,t){var n=this;return Object(B.oe)(function(){var t=en(e);return"channelsLast"===n.dataFormat?Object(B.uc)(t,[1,2]):Object(B.uc)(t,[2,3])})},Xs.className="GlobalMaxPooling2D",Xs);function Xs(){return null!==Gs&&Gs.apply(this,arguments)||this}function Ys(t,e,n,r){if(Array.isArray(t)){if(null!=e||null!=n)throw new ot("When inputs is an array, neither initialState or constants should be provided");null!=r&&(n=t.slice(t.length-r,t.length),t=t.slice(0,t.length-r)),1<t.length&&(e=t.slice(1,t.length)),t=t[0]}function i(t){return null==t||Array.isArray(t)?t:[t]}return{inputs:t,initialState:e=i(e),constants:n=i(n)}}function Zs(f,h,p,d,m,g,y,v){return void 0===d&&(d=!1),void 0===y&&(y=!1),void 0===v&&(v=!1),Object(B.oe)(function(){var t=h.shape.length;if(t<3)throw new ot("Input should be at least 3D, but is "+t+"D.");var e=[1,0].concat(jt(2,t));if(h=Object(B.ue)(h,e),null!=g)throw new R("The rnn() functoin of the deeplearn.js backend does not support constants yet.");y&&console.warn("Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend."),null!=m&&((m=m.asType("bool").asType("float32")).rank===t-1&&(m=Object(B.Cb)(m,-1)),m=Object(B.ue)(m,e)),d&&(h=Object(B.pd)(h,0),null!=m&&(m=Object(B.pd)(m,0)));var r,o,a=[],s=p,n=h.shape[0],u=Object(B.xe)(h);null!=m&&(o=Object(B.xe)(m));for(var i,c=function(t){var e=u[t],i=Object(B.oe)(function(){return f(e,s)});if(null==m)r=i[0],s=i[1];else{var n=Object(B.oe)(function(){var n=o[t],r=Object(B.Sc)(n).sub(n);return{output:i[0].mul(n).addStrict(s[0].mul(r)),newStates:s.map(function(t,e){return i[1][e].mul(n).addStrict(t.mul(r))})}});r=n.output,s=n.newStates}v&&a.push(r)},l=0;l<n;++l)c(l);return v&&(i=Object(B.Yd)(a,1)),[r,i,s]})}B.Bd.registerClass(Ks);var Js,Qs=(u(tu,Js=mn),tu.prototype.getStates=function(){return null==this.states_?jt(0,Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1).map(function(t){return null}):this.states_},tu.prototype.setStates=function(t){this.states_=t},tu.prototype.computeOutputShape=function(t){Qe(t)&&(t=t[0]),t=t;var e=this.cell.stateSize;Array.isArray(e)||(e=[e]);var n,r=e[0];if(n=this.returnSequences?[t[0],t[1],r]:[t[0],r],this.returnState){for(var i=[],o=0,a=e;o<a.length;o++){var s=a[o];i.push([t[0],s])}return[n].concat(i)}return n},tu.prototype.computeMask=function(t,n){var r=this;return Object(B.oe)(function(){Array.isArray(n)&&(n=n[0]);var t=r.returnSequences?n:null;if(r.returnState){var e=r.states.map(function(t){return null});return[t].concat(e)}return t})},Object.defineProperty(tu.prototype,"states",{get:function(){if(null!=this.states_)return this.states_;for(var t=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1,e=[],n=0;n<t;++n)e.push(null);return e},set:function(t){this.states_=t},enumerable:!0,configurable:!0}),tu.prototype.build=function(t){if(null!=this.numConstants)throw new R("Constants support is not implemented in RNN yet.");Qe(t)&&(t=t[0]),t=t;var e=this.stateful?t[0]:null,n=t[t.length-1];this.inputSpec[0]=new ln({shape:[e,null,n]});var r,i=[t[0]].concat(t.slice(2));if(this.cell.build(i),r=Array.isArray(this.cell.stateSize)?this.cell.stateSize:[this.cell.stateSize],null!=this.stateSpec){if(!B.ye.arraysEqual(this.stateSpec.map(function(t){return t.shape[t.shape.length-1]}),r))throw new ot("An initialState was passed that is not compatible with cell.stateSize. Received stateSpec="+this.stateSpec+"; However cell.stateSize is "+this.cell.stateSize)}else this.stateSpec=r.map(function(t){return new ln({shape:[null,t]})});this.stateful&&this.resetStates()},tu.prototype.resetStates=function(o,a){var s=this;void 0===a&&(a=!1),Object(B.oe)(function(){if(!s.stateful)throw new b("Cannot call resetStates() on an RNN Layer that is not stateful.");var e=s.inputSpec[0].shape[0];if(null==e)throw new ot("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(null==s.states_)Array.isArray(s.cell.stateSize)?s.states_=s.cell.stateSize.map(function(t){return Object(B.He)([e,t])}):s.states_=[Object(B.He)([e,s.cell.stateSize])];else if(null==o)Object(B.qb)(s.states_),null!=s.keptStates&&(Object(B.qb)(s.keptStates),s.keptStates=[]),Array.isArray(s.cell.stateSize)?s.states_=s.cell.stateSize.map(function(t){return Object(B.He)([e,t])}):s.states_[0]=Object(B.He)([e,s.cell.stateSize]);else{if(Array.isArray(o)||(o=[o]),o.length!==s.states_.length)throw new ot("Layer "+s.name+" expects "+s.states_.length+" state(s), but it received "+o.length+" state value(s). Input received: "+o);!0===a?s.keptStates.push(s.states_.slice()):Object(B.qb)(s.states_);for(var t=0;t<s.states_.length;++t){var n=o[t],r=Array.isArray(s.cell.stateSize)?s.cell.stateSize[t]:s.cell.stateSize,i=[e,r];if(!B.ye.arraysEqual(n.shape,i))throw new ot("State "+t+" is incompatible with layer "+s.name+": expected shape="+i+", received shape="+n.shape);s.states_[t]=n}}s.states_.forEach(function(t){return Object(B.Zb)(t)})})},tu.prototype.apply=function(t,e){var n=null==e?null:e.initialState,r=null==e?null:e.constants;null==e&&(e={});var i=Ys(t,n,r,this.numConstants);t=i.inputs,n=i.initialState,r=i.constants;var o=[],a=[];if(null!=n){e.initialState=n,o=o.concat(n),this.stateSpec=[];for(var s=0,u=n;s<u.length;s++){var c=u[s];this.stateSpec.push(new ln({shape:c.shape}))}a=a.concat(this.stateSpec)}if(null!=r&&(e.constants=r,o=o.concat(r),this.numConstants=r.length),o[0]instanceof fn){var l=[t].concat(o),f=this.inputSpec.concat(a),h=this.inputSpec;this.inputSpec=f;var p=Js.prototype.apply.call(this,l,e);return this.inputSpec=h,p}return Js.prototype.apply.call(this,t,e)},tu.prototype.call=function(l,f){var h=this;return Object(B.oe)(function(){var t=null==f?null:f.mask,e=null==f?null:f.training,n=null==f?null:f.initialState;l=en(l),null==n&&(n=h.stateful?h.states_:h.getInitialState(l));var r=Array.isArray(h.cell.stateSize)?h.cell.stateSize.length:1;if(n.length!==r)throw new ot("RNN Layer has "+r+" state(s) but was passed "+n.length+" initial state(s).");h.unroll&&console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");var i={training:e},o=Zs(function(t,e){var n=h.cell.call([t].concat(e),i);return[n[0],n.slice(1)]},l,n,h.goBackwards,t,null,h.unroll,h.returnSequences),a=o[0],s=o[1],u=o[2];h.stateful&&h.resetStates(u,e);var c=h.returnSequences?s:a;return h.returnState?[c].concat(u):c})},tu.prototype.getInitialState=function(t){var n=this;return Object(B.oe)(function(){var e=Object(B.He)(t.shape);return e=Lt(e=Object(B.de)(e,[1,2])),Array.isArray(n.cell.stateSize)?n.cell.stateSize.map(function(t){return 1<t?qt(e,[1,t]):e}):1<n.cell.stateSize?[qt(e,[1,n.cell.stateSize])]:[e]})},Object.defineProperty(tu.prototype,"trainableWeights",{get:function(){return this.trainable?this.cell.trainableWeights:[]},enumerable:!0,configurable:!0}),Object.defineProperty(tu.prototype,"nonTrainableWeights",{get:function(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights},enumerable:!0,configurable:!0}),tu.prototype.setFastWeightInitDuringBuild=function(t){Js.prototype.setFastWeightInitDuringBuild.call(this,t),null!=this.cell&&this.cell.setFastWeightInitDuringBuild(t)},tu.prototype.getConfig=function(){var t={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};null!=this.numConstants&&(t.numConstants=this.numConstants);var e=this.cell.getConfig();t.cell={className:this.cell.getClassName(),config:e};var n=Js.prototype.getConfig.call(this);return Object.assign(t,n),t},tu.className="RNN",tu);function tu(t){var e,n=Js.call(this,t)||this;if(null==t.cell)throw new ot("cell property is missing for the constructor of RNN.");if(null==(e=Array.isArray(t.cell)?new Eu({cells:t.cell}):t.cell).stateSize)throw new ot("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");return n.cell=e,n.returnSequences=null!=t.returnSequences&&t.returnSequences,n.returnState=null!=t.returnState&&t.returnState,n.goBackwards=null!=t.goBackwards&&t.goBackwards,n._stateful=null!=t.stateful&&t.stateful,n.unroll=null!=t.unroll&&t.unroll,n.supportsMasking=!0,n.inputSpec=[new ln({ndim:3})],n.stateSpec=null,n.states_=null,n.numConstants=null,n.keptStates=[],n}B.Bd.registerClass(Qs);var eu,nu,ru=(u(au,nu=mn),au),iu=(u(ou,eu=ru),ou.prototype.build=function(t){t=nn(t),this.kernel=this.addWeight("kernel",[t[t.length-1],this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0},ou.prototype.call=function(a,s){var u=this;return Object(B.oe)(function(){if(2!==(a=a).length)throw new ot("SimpleRNNCell expects 2 input Tensors, got "+a.length+".");var t=a[1];a=a[0];var e,n=null!=s.training&&s.training;0<u.dropout&&u.dropout<1&&null==u.dropoutMask&&(u.dropoutMask=Nu(function(){return Object(B.Sc)(a)},u.dropout,n)),0<u.recurrentDropout&&u.recurrentDropout<1&&null==u.recurrentDropoutMask&&(u.recurrentDropoutMask=Nu(function(){return Object(B.Sc)(t)},u.recurrentDropout,n));var r=u.dropoutMask,i=u.recurrentDropoutMask;e=$t(null!=r?Object(B.Hc)(a,r):a,u.kernel.read()),null!=u.bias&&(e=Xt(e,u.bias.read())),null!=i&&(t=Object(B.Hc)(t,i));var o=Object(B.u)(e,$t(t,u.recurrentKernel.read()));return null!=u.activation&&(o=u.activation.apply(o)),[o,o]})},ou.prototype.getConfig=function(){var t={units:this.units,activation:Ji(this.activation),useBias:this.useBias,kernelInitializer:Ye(this.kernelInitializer),recurrentInitializer:Ye(this.recurrentInitializer),biasInitializer:Ye(this.biasInitializer),kernelRegularizer:uo(this.kernelRegularizer),recurrentRegularizer:uo(this.recurrentRegularizer),biasRegularizer:uo(this.biasRegularizer),activityRegularizer:uo(this.activityRegularizer),kernelConstraint:dt(this.kernelConstraint),recurrentConstraint:dt(this.recurrentConstraint),biasConstraint:dt(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout},e=eu.prototype.getConfig.call(this);return Object.assign(t,e),t},ou.className="SimpleRNNCell",ou);function ou(t){var e=eu.call(this,t)||this;return e.DEFAULT_ACTIVATION="tanh",e.DEFAULT_KERNEL_INITIALIZER="glorotNormal",e.DEFAULT_RECURRENT_INITIALIZER="orthogonal",e.DEFAULT_BIAS_INITIALIZER="zeros",e.units=t.units,e.activation=to(null==t.activation?e.DEFAULT_ACTIVATION:t.activation),e.useBias=null==t.useBias||t.useBias,e.kernelInitializer=Ze(t.kernelInitializer||e.DEFAULT_KERNEL_INITIALIZER),e.recurrentInitializer=Ze(t.recurrentInitializer||e.DEFAULT_RECURRENT_INITIALIZER),e.biasInitializer=Ze(t.biasInitializer||e.DEFAULT_BIAS_INITIALIZER),e.kernelRegularizer=lo(t.kernelRegularizer),e.recurrentRegularizer=lo(t.recurrentRegularizer),e.biasRegularizer=lo(t.biasRegularizer),e.kernelConstraint=gt(t.kernelConstraint),e.recurrentConstraint=gt(t.recurrentConstraint),e.biasConstraint=gt(t.biasConstraint),e.dropout=Rt([1,Dt([0,null==t.dropout?0:t.dropout])]),e.recurrentDropout=Rt([1,Dt([0,null==t.recurrentDropout?0:t.recurrentDropout])]),e.stateSize=e.units,e.dropoutMask=null,e.recurrentDropoutMask=null,e}function au(){return null!==nu&&nu.apply(this,arguments)||this}B.Bd.registerClass(iu);var su,uu=(u(cu,su=Qs),cu.prototype.call=function(r,i){var o=this;return Object(B.oe)(function(){null!=o.cell.dropoutMask&&(Object(B.qb)(o.cell.dropoutMask),o.cell.dropoutMask=null),null!=o.cell.recurrentDropoutMask&&(Object(B.qb)(o.cell.recurrentDropoutMask),o.cell.recurrentDropoutMask=null);var t=null==i?null:i.mask,e=null==i?null:i.training,n=null==i?null:i.initialState;return su.prototype.call.call(o,r,{mask:t,training:e,initialState:n})})},Object.defineProperty(cu.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(cu.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(cu.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(cu.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(cu.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(cu.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(cu.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(cu.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(cu.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(cu.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(cu.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(cu.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(cu.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(cu.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),cu.prototype.getConfig=function(){var t={units:this.units,activation:Ji(this.activation),useBias:this.useBias,kernelInitializer:Ye(this.kernelInitializer),recurrentInitializer:Ye(this.recurrentInitializer),biasInitializer:Ye(this.biasInitializer),kernelRegularizer:uo(this.kernelRegularizer),recurrentRegularizer:uo(this.recurrentRegularizer),biasRegularizer:uo(this.biasRegularizer),activityRegularizer:uo(this.activityRegularizer),kernelConstraint:dt(this.kernelConstraint),recurrentConstraint:dt(this.recurrentConstraint),biasConstraint:dt(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout},e=su.prototype.getConfig.call(this);return delete e.cell,Object.assign(t,e),t},cu.className="SimpleRNN",cu);function cu(t){return t.cell=new iu(t),su.call(this,t)||this}B.Bd.registerClass(uu);var lu,fu=(u(hu,lu=ru),hu.prototype.build=function(t){var e=(t=nn(t))[t.length-1];this.kernel=this.addWeight("kernel",[e,3*this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,3*this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[3*this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0},hu.prototype.call=function(x,E){var S=this;return Object(B.oe)(function(){if(2!==(x=x).length)throw new ot("GRUCell expects 2 input Tensors (inputs, h, c), got "+x.length+".");var t=null!=E.training&&E.training,e=x[1];x=x[0],0<S.dropout&&S.dropout<1&&null==S.dropoutMask&&(S.dropoutMask=Nu(function(){return Object(B.Sc)(x)},S.dropout,t,3)),0<S.recurrentDropout&&S.recurrentDropout<1&&null==S.recurrentDropoutMask&&(S.recurrentDropoutMask=Nu(function(){return Object(B.Sc)(e)},S.recurrentDropout,t,3));var n,r,i,o=S.dropoutMask,a=S.recurrentDropoutMask;0<S.dropout&&S.dropout<1&&(x=Object(B.Hc)(x,o[0]));var s=$t(x,S.kernel.read());S.useBias&&(s=Xt(s,S.bias.read())),0<S.recurrentDropout&&S.recurrentDropout<1&&(e=Object(B.Hc)(e,a[0]));var u=S.recurrentKernel.read(),c=Object(B.Sd)(u,[2*S.units,S.units],u.rank-1),l=c[0],f=c[1],h=$t(e,l),p=Object(B.Sd)(s,3,s.rank-1),d=p[0],m=p[1],g=p[2],y=Object(B.Sd)(h,2,h.rank-1),v=y[0],b=y[1];n=S.recurrentActivation.apply(Object(B.u)(d,v)),r=S.recurrentActivation.apply(Object(B.u)(m,b));var w=$t(Object(B.Hc)(r,e),f);i=S.activation.apply(Object(B.u)(g,w));var _=Object(B.u)(Object(B.Hc)(n,e),Object(B.Hc)(Object(B.u)(O(1),Object(B.Lc)(n)),i));return[_,_]})},hu.prototype.getConfig=function(){var t={units:this.units,activation:Ji(this.activation),recurrentActivation:Ji(this.recurrentActivation),useBias:this.useBias,kernelInitializer:Ye(this.kernelInitializer),recurrentInitializer:Ye(this.recurrentInitializer),biasInitializer:Ye(this.biasInitializer),kernelRegularizer:uo(this.kernelRegularizer),recurrentRegularizer:uo(this.recurrentRegularizer),biasRegularizer:uo(this.biasRegularizer),activityRegularizer:uo(this.activityRegularizer),kernelConstraint:dt(this.kernelConstraint),recurrentConstraint:dt(this.recurrentConstraint),biasConstraint:dt(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},e=lu.prototype.getConfig.call(this);return Object.assign(t,e),t},hu.className="GRUCell",hu);function hu(t){var e=lu.call(this,t)||this;return e.DEFAULT_ACTIVATION="tanh",e.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",e.DEFAULT_KERNEL_INITIALIZER="glorotNormal",e.DEFAULT_RECURRENT_INITIALIZER="orthogonal",e.DEFAULT_BIAS_INITIALIZER="zeros",e.units=t.units,e.activation=to(void 0===t.activation?e.DEFAULT_ACTIVATION:t.activation),e.recurrentActivation=to(void 0===t.recurrentActivation?e.DEFAULT_RECURRENT_ACTIVATION:t.recurrentActivation),e.useBias=null==t.useBias||t.useBias,e.kernelInitializer=Ze(t.kernelInitializer||e.DEFAULT_KERNEL_INITIALIZER),e.recurrentInitializer=Ze(t.recurrentInitializer||e.DEFAULT_RECURRENT_INITIALIZER),e.biasInitializer=Ze(t.biasInitializer||e.DEFAULT_BIAS_INITIALIZER),e.kernelRegularizer=lo(t.kernelRegularizer),e.recurrentRegularizer=lo(t.recurrentRegularizer),e.biasRegularizer=lo(t.biasRegularizer),e.kernelConstraint=gt(t.kernelConstraint),e.recurrentConstraint=gt(t.recurrentConstraint),e.biasConstraint=gt(t.biasConstraint),e.dropout=Rt([1,Dt([0,null==t.dropout?0:t.dropout])]),e.recurrentDropout=Rt([1,Dt([0,null==t.recurrentDropout?0:t.recurrentDropout])]),e.implementation=t.implementation,e.stateSize=e.units,e.dropoutMask=null,e.recurrentDropoutMask=null,e}B.Bd.registerClass(fu);var pu,du=(u(mu,pu=Qs),mu.prototype.call=function(r,i){var o=this;return Object(B.oe)(function(){null!=o.cell.dropoutMask&&(Object(B.qb)(o.cell.dropoutMask),o.cell.dropoutMask=null),null!=o.cell.recurrentDropoutMask&&(Object(B.qb)(o.cell.recurrentDropoutMask),o.cell.recurrentDropoutMask=null);var t=null==i?null:i.mask,e=null==i?null:i.training,n=null==i?null:i.initialState;return pu.prototype.call.call(o,r,{mask:t,training:e,initialState:n})})},Object.defineProperty(mu.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(mu.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(mu.prototype,"recurrentActivation",{get:function(){return this.cell.recurrentActivation},enumerable:!0,configurable:!0}),Object.defineProperty(mu.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(mu.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(mu.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(mu.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(mu.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(mu.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(mu.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(mu.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(mu.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(mu.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(mu.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(mu.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),Object.defineProperty(mu.prototype,"implementation",{get:function(){return this.cell.implementation},enumerable:!0,configurable:!0}),mu.prototype.getConfig=function(){var t={units:this.units,activation:Ji(this.activation),recurrentActivation:Ji(this.recurrentActivation),useBias:this.useBias,kernelInitializer:Ye(this.kernelInitializer),recurrentInitializer:Ye(this.recurrentInitializer),biasInitializer:Ye(this.biasInitializer),kernelRegularizer:uo(this.kernelRegularizer),recurrentRegularizer:uo(this.recurrentRegularizer),biasRegularizer:uo(this.biasRegularizer),activityRegularizer:uo(this.activityRegularizer),kernelConstraint:dt(this.kernelConstraint),recurrentConstraint:dt(this.recurrentConstraint),biasConstraint:dt(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},e=pu.prototype.getConfig.call(this);return delete e.cell,Object.assign(t,e),t},mu.fromConfig=function(t,e){return 0===e.implmentation&&(e.implementation=1),new t(e)},mu.className="GRU",mu);function mu(t){return 0===t.implementation&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),t.cell=new fu(t),pu.call(this,t)||this}B.Bd.registerClass(du);var gu,yu=(u(vu,gu=ru),vu.prototype.build=function(t){var e,n,r,i=(t=nn(t))[t.length-1];if(this.kernel=this.addWeight("kernel",[i,4*this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,4*this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){if(this.unitForgetBias){var o=this.biasInitializer,a=this.units;(u(s,r=ne),s.prototype.apply=function(t,e){var n=o.apply([a]),r=(new se).apply([a]),i=o.apply([2*a]);return Wt(Wt(n,r),i)},n=s).className="CustomInit",e=new n}else e=this.biasInitializer;this.bias=this.addWeight("bias",[4*this.units],null,e,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;function s(){return null!==r&&r.apply(this,arguments)||this}this.built=!0},vu.prototype.call=function(g,y){var v=this;return Object(B.oe)(function(){var t=null!=y.training&&y.training;if(3!==(g=g).length)throw new ot("LSTMCell expects 3 input Tensors (inputs, h, c), got "+g.length+".");var e=g[1],n=g[2];g=g[0],0<v.dropout&&v.dropout<1&&null==v.dropoutMask&&(v.dropoutMask=Nu(function(){return Object(B.Sc)(g)},v.dropout,t,4)),0<v.recurrentDropout&&v.recurrentDropout<1&&null==v.recurrentDropoutMask&&(v.recurrentDropoutMask=Nu(function(){return Object(B.Sc)(e)},v.recurrentDropout,t,4));var r,i,o,a,s=v.dropoutMask,u=v.recurrentDropoutMask;0<v.dropout&&v.dropout<1&&(g=Object(B.Hc)(g,s[0]));var c=$t(g,v.kernel.read());0<v.recurrentDropout&&v.recurrentDropout<1&&(e=Object(B.Hc)(e,u[0])),c=Object(B.u)(c,$t(e,v.recurrentKernel.read())),v.useBias&&(c=Xt(c,v.bias.read()));var l=Object(B.Sd)(c,4,c.rank-1),f=l[0],h=l[1],p=l[2],d=l[3];r=v.recurrentActivation.apply(f),i=v.recurrentActivation.apply(h),o=Object(B.u)(Object(B.Hc)(i,n),Object(B.Hc)(r,v.activation.apply(p))),a=v.recurrentActivation.apply(d);var m=Object(B.Hc)(a,v.activation.apply(o));return[m,m,o]})},vu.prototype.getConfig=function(){var t={units:this.units,activation:Ji(this.activation),recurrentActivation:Ji(this.recurrentActivation),useBias:this.useBias,kernelInitializer:Ye(this.kernelInitializer),recurrentInitializer:Ye(this.recurrentInitializer),biasInitializer:Ye(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:uo(this.kernelRegularizer),recurrentRegularizer:uo(this.recurrentRegularizer),biasRegularizer:uo(this.biasRegularizer),activityRegularizer:uo(this.activityRegularizer),kernelConstraint:dt(this.kernelConstraint),recurrentConstraint:dt(this.recurrentConstraint),biasConstraint:dt(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},e=gu.prototype.getConfig.call(this);return Object.assign(t,e),t},vu.className="LSTMCell",vu);function vu(t){var e=gu.call(this,t)||this;return e.DEFAULT_ACTIVATION="tanh",e.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",e.DEFAULT_KERNEL_INITIALIZER="glorotNormal",e.DEFAULT_RECURRENT_INITIALIZER="orthogonal",e.DEFAULT_BIAS_INITIALIZER="zeros",e.units=t.units,e.activation=to(void 0===t.activation?e.DEFAULT_ACTIVATION:t.activation),e.recurrentActivation=to(void 0===t.recurrentActivation?e.DEFAULT_RECURRENT_ACTIVATION:t.recurrentActivation),e.useBias=null==t.useBias||t.useBias,e.kernelInitializer=Ze(t.kernelInitializer||e.DEFAULT_KERNEL_INITIALIZER),e.recurrentInitializer=Ze(t.recurrentInitializer||e.DEFAULT_RECURRENT_INITIALIZER),e.biasInitializer=Ze(t.biasInitializer||e.DEFAULT_BIAS_INITIALIZER),e.unitForgetBias=t.unitForgetBias,e.kernelRegularizer=lo(t.kernelRegularizer),e.recurrentRegularizer=lo(t.recurrentRegularizer),e.biasRegularizer=lo(t.biasRegularizer),e.kernelConstraint=gt(t.kernelConstraint),e.recurrentConstraint=gt(t.recurrentConstraint),e.biasConstraint=gt(t.biasConstraint),e.dropout=Rt([1,Dt([0,null==t.dropout?0:t.dropout])]),e.recurrentDropout=Rt([1,Dt([0,null==t.recurrentDropout?0:t.recurrentDropout])]),e.implementation=t.implementation,e.stateSize=[e.units,e.units],e.dropoutMask=null,e.recurrentDropoutMask=null,e}B.Bd.registerClass(yu);var bu,wu=(u(_u,bu=Qs),_u.prototype.call=function(r,i){var o=this;return Object(B.oe)(function(){null!=o.cell.dropoutMask&&(Object(B.qb)(o.cell.dropoutMask),o.cell.dropoutMask=null),null!=o.cell.recurrentDropoutMask&&(Object(B.qb)(o.cell.recurrentDropoutMask),o.cell.recurrentDropoutMask=null);var t=null==i?null:i.mask,e=null==i?null:i.training,n=null==i?null:i.initialState;return bu.prototype.call.call(o,r,{mask:t,training:e,initialState:n})})},Object.defineProperty(_u.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(_u.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(_u.prototype,"recurrentActivation",{get:function(){return this.cell.recurrentActivation},enumerable:!0,configurable:!0}),Object.defineProperty(_u.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(_u.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(_u.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(_u.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(_u.prototype,"unitForgetBias",{get:function(){return this.cell.unitForgetBias},enumerable:!0,configurable:!0}),Object.defineProperty(_u.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(_u.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(_u.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(_u.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(_u.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(_u.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(_u.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(_u.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),Object.defineProperty(_u.prototype,"implementation",{get:function(){return this.cell.implementation},enumerable:!0,configurable:!0}),_u.prototype.getConfig=function(){var t={units:this.units,activation:Ji(this.activation),recurrentActivation:Ji(this.recurrentActivation),useBias:this.useBias,kernelInitializer:Ye(this.kernelInitializer),recurrentInitializer:Ye(this.recurrentInitializer),biasInitializer:Ye(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:uo(this.kernelRegularizer),recurrentRegularizer:uo(this.recurrentRegularizer),biasRegularizer:uo(this.biasRegularizer),activityRegularizer:uo(this.activityRegularizer),kernelConstraint:dt(this.kernelConstraint),recurrentConstraint:dt(this.recurrentConstraint),biasConstraint:dt(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},e=bu.prototype.getConfig.call(this);return delete e.cell,Object.assign(t,e),t},_u.fromConfig=function(t,e){return 0===e.implmentation&&(e.implementation=1),new t(e)},_u.className="LSTM",_u);function _u(t){return 0===t.implementation&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),t.cell=new yu(t),bu.call(this,t)||this}B.Bd.registerClass(wu);var xu,Eu=(u(Su,xu=ru),Object.defineProperty(Su.prototype,"stateSize",{get:function(){for(var t=[],e=0,n=this.cells.slice().reverse();e<n.length;e++){var r=n[e];Array.isArray(r.stateSize)?t.push.apply(t,r.stateSize):t.push(r.stateSize)}return t},enumerable:!0,configurable:!0}),Su.prototype.call=function(f,h){var p=this;return Object(B.oe)(function(){for(var t=(f=f).slice(1),e=[],n=0,r=p.cells.slice().reverse();n<r.length;n++){var i=r[n];Array.isArray(i.stateSize)?e.push(t.splice(0,i.stateSize.length)):e.push(t.splice(0,1))}e.reverse();for(var o,a=[],s=0;s<p.cells.length;++s)i=p.cells[s],t=e[s],o=0===s?[f[0]].concat(t):[o[0]].concat(t),o=i.call(o,h),a.push(o.slice(1));t=[];for(var u=0,c=a.slice().reverse();u<c.length;u++){var l=c[u];t.push.apply(t,l)}return[o[0]].concat(t)})},Su.prototype.build=function(t){var e;Qe(t)&&(t=t[0]),t=t;for(var n=0,r=this.cells;n<r.length;n++){var i=r[n];i.build(t),e=Array.isArray(i.stateSize)?i.stateSize[0]:i.stateSize,t=[t[0],e]}this.built=!0},Su.prototype.getConfig=function(){for(var t=[],e=0,n=this.cells;e<n.length;e++){var r=n[e];t.push({className:this.getClassName(),config:r.getConfig()})}var i={cells:t},o=xu.prototype.getConfig.call(this);return Object.assign(i,o),i},Su.fromConfig=function(t,e,n){void 0===n&&(n={});for(var r=[],i=0,o=e.cells;i<o.length;i++){var a=o[i];r.push(Or(a,n))}return new t({cells:r})},Object.defineProperty(Su.prototype,"trainableWeights",{get:function(){if(!this.trainable)return[];for(var t=[],e=0,n=this.cells;e<n.length;e++){var r=n[e];t.push.apply(t,r.trainableWeights)}return t},enumerable:!0,configurable:!0}),Object.defineProperty(Su.prototype,"nonTrainableWeights",{get:function(){for(var t=[],e=0,n=this.cells;e<n.length;e++){var r=n[e];t.push.apply(t,r.nonTrainableWeights)}if(this.trainable)return t;for(var i=[],o=0,a=this.cells;o<a.length;o++)r=a[o],i.push.apply(i,r.trainableWeights);return i.concat(t)},enumerable:!0,configurable:!0}),Su.prototype.getWeights=function(){for(var t=[],e=0,n=this.cells;e<n.length;e++){var r=n[e];t.push.apply(t,r.weights)}return sn(t)},Su.prototype.setWeights=function(t){for(var e=[],n=0,r=this.cells;n<r.length;n++)for(var i=r[n],o=i.weights.length,a=t.splice(o),s=0;s<i.weights.length;++s)e.push([i.weights[s],a[s]]);un(e)},Su.className="StackedRNNCells",Su);function Su(t){var e=xu.call(this,t)||this;return e.cells=t.cells,e}function Nu(t,e,n,r){function i(){return Yt(t(),O(e))}if(void 0===n&&(n=null),void 0===r&&(r=1),1<r){for(var o=[],a=0;a<r;a++)o.push(Zt(i,t,n));return o.forEach(function(t){return Object(B.Zb)(t)}),o}return Object(B.Zb)(Zt(i,t,n))}B.Bd.registerClass(Eu);var Iu,Ou,ku=(u(Pu,Ou=mn),Pu.prototype.build=function(t){this.built=!0},Object.defineProperty(Pu.prototype,"trainable",{get:function(){return null!=this.layer&&this.layer.trainable},set:function(t){null!=this.layer&&(this.layer.trainable=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Pu.prototype,"trainableWeights",{get:function(){return this.layer.trainableWeights},enumerable:!0,configurable:!0}),Object.defineProperty(Pu.prototype,"nonTrainableWeights",{get:function(){return this.layer.nonTrainableWeights},enumerable:!0,configurable:!0}),Object.defineProperty(Pu.prototype,"updates",{get:function(){return this.layer._updates},enumerable:!0,configurable:!0}),Object.defineProperty(Pu.prototype,"losses",{get:function(){return this.layer.losses},enumerable:!0,configurable:!0}),Pu.prototype.getWeights=function(){return this.layer.getWeights()},Pu.prototype.setWeights=function(t){this.layer.setWeights(t)},Pu.prototype.getConfig=function(){var t={layer:{className:this.layer.getClassName(),config:this.layer.getConfig()}},e=Ou.prototype.getConfig.call(this);return Object.assign(t,e),t},Pu.prototype.setFastWeightInitDuringBuild=function(t){Ou.prototype.setFastWeightInitDuringBuild.call(this,t),null!=this.layer&&this.layer.setFastWeightInitDuringBuild(t)},Pu.fromConfig=function(t,e,n){void 0===n&&(n={});var r=Or(e.layer,n);delete e.layer;var i={layer:r};return Object.assign(i,e),new t(i)},Pu),Au=(u(Cu,Iu=ku),Cu.prototype.build=function(t){if((t=nn(t)).length<3)throw new ot("TimeDistributed layer expects an input shape >= 3D, but received input shape "+JSON.stringify(t));this.inputSpec=[{shape:t}];var e=[t[0]].concat(t.slice(2));this.layer.built||(this.layer.build(e),this.layer.built=!0),Iu.prototype.build.call(this,t)},Cu.prototype.computeOutputShape=function(t){var e=[(t=nn(t))[0]].concat(t.slice(2)),n=this.layer.computeOutputShape(e),r=t[1];return[n[0],r].concat(n.slice(1))},Cu.prototype.call=function(t,n){var r=this;return Object(B.oe)(function(){return Zs(function(t,e){return[en(r.layer.call(t,n)),[]]},t=en(t),[],!1,null,null,!1,!0)[1]})},Cu.className="TimeDistributed",Cu);function Cu(t){var e=Iu.call(this,t)||this;return e.supportsMasking=!0,e}function Pu(t){var e=Ou.call(this,t)||this;return e.layer=t.layer,e}B.Bd.registerClass(Au);var Tu,Mu=(u(Ru,Tu=ku),Object.defineProperty(Ru.prototype,"trainable",{get:function(){return this._trainable},set:function(t){this._trainable=t,null!=this.forwardLayer&&(this.forwardLayer.trainable=t),null!=this.backwardLayer&&(this.backwardLayer.trainable=t)},enumerable:!0,configurable:!0}),Ru.prototype.getWeights=function(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())},Ru.prototype.setWeights=function(t){var e=t.length,n=Math.floor(e/2);this.forwardLayer.setWeights(t.slice(0,n)),this.backwardLayer.setWeights(t.slice(n))},Ru.prototype.computeOutputShape=function(t){var e,n,r,i=this.forwardLayer.computeOutputShape(t);return Array.isArray(i)&&Array.isArray(i[0])||(i=[i]),i=i,this.returnState&&(r=i.slice(1)),e=e=i[0],n="concat"===this.mergeMode?(e[e.length-1]*=2,[e]):null==this.mergeMode?[e,e.slice()]:[e],this.returnState?null==this.mergeMode?n.concat(r).concat(r.slice()):[e].concat(r).concat(r.slice()):T(n)},Ru.prototype.apply=function(t,e){var n=null==e?null:e.initialState,r=null==e?null:e.constants;null==e&&(e={});var i=Ys(t,n,r,this.numConstants);if(t=i.inputs,n=i.initialState,r=i.constants,Array.isArray(t)&&(n=t.slice(1),t=t[0]),(null==n||0===n.length)&&null==r)return Tu.prototype.apply.call(this,t,e);var o=[],a=[];if(null!=n){var s=n.length;if(0<s%2)throw new ot("When passing `initialState` to a Bidrectional RNN, the state should be an Array containing the states of the underlying RNNs.");e.initialState=n,o.push.apply(o,n);var u=n.map(function(t){return new ln({shape:t.shape})});this.forwardLayer.stateSpec=u.slice(0,s/2),this.backwardLayer.stateSpec=u.slice(s/2),a.push.apply(a,u)}if(null!=r)throw new R("Support for constants in Bidirectional layers is not implemented yet.");for(var c=o[0]instanceof fn,l=0,f=o;l<f.length;l++)if(f[l]instanceof fn!=c)throw new ot("The initial state of a Bidirectional layer cannot be specified as a mix of symbolic and non-symbolic tensors");if(c){var h=[t].concat(o),p=this.inputSpec.concat(a),d=this.inputSpec;this.inputSpec=p;var m=Tu.prototype.apply.call(this,h,e);return this.inputSpec=d,m}return Tu.prototype.apply.call(this,t,e)},Ru.prototype.call=function(s,u){var c=this;return Object(B.oe)(function(){if(null!=u.mask)throw new R("The support for masking is not implemented for Bidirectional layers yet.");var t,e,n,r,i=u.initialState;if(null==i)t=c.forwardLayer.call(s,u),e=c.backwardLayer.call(s,u);else{var o=i.slice(0,i.length/2),a=i.slice(i.length/2);t=c.forwardLayer.call(s,Object.assign(u,{initialState:o})),e=c.backwardLayer.call(s,Object.assign(u,{initialState:a}))}return c.returnState&&(Array.isArray(t)&&(n=t.slice(1).concat(e.slice(1))),t=t[0],e=e[0]),c.returnSequences&&(e=Object(B.pd)(e,1)),"concat"===c.mergeMode?r=Vt([t,e]):"sum"===c.mergeMode?r=Object(B.u)(t,e):"ave"===c.mergeMode?r=Object(B.Hc)(O(.5),Object(B.u)(t,e)):"mul"===c.mergeMode?r=Object(B.Hc)(t,e):null==c.mergeMode&&(r=[t,e]),c.returnState?null==c.mergeMode?r.concat(n):[r].concat(n):r})},Ru.prototype.resetStates=function(t){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()},Ru.prototype.build=function(t){var e=this;Ot(this.forwardLayer.name,function(){e.forwardLayer.build(t)}),Ot(this.backwardLayer.name,function(){e.backwardLayer.build(t)}),this.built=!0},Object.defineProperty(Ru.prototype,"trainableWeights",{get:function(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)},enumerable:!0,configurable:!0}),Object.defineProperty(Ru.prototype,"nonTrainableWeights",{get:function(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)},enumerable:!0,configurable:!0}),Ru.prototype.setFastWeightInitDuringBuild=function(t){Tu.prototype.setFastWeightInitDuringBuild.call(this,t),null!=this.forwardLayer&&this.forwardLayer.setFastWeightInitDuringBuild(t),null!=this.backwardLayer&&this.backwardLayer.setFastWeightInitDuringBuild(t)},Ru.prototype.getConfig=function(){var t={mergeMode:this.mergeMode},e=Tu.prototype.getConfig.call(this);return Object.assign(t,e),t},Ru.fromConfig=function(t,e){var n=Or(e.layer);if(delete e.layer,null!=e.numConstants)throw new R("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");var r=e;return r.layer=n,new t(r)},Ru.className="Bidirectional",Ru);function Ru(t){var e=Tu.call(this,t)||this,n=t.layer.getConfig();if(e.forwardLayer=Or({className:t.layer.getClassName(),config:n}),n.goBackwards=!0!==n.goBackwards,e.backwardLayer=Or({className:t.layer.getClassName(),config:n}),e.forwardLayer.name="forward_"+e.forwardLayer.name,e.backwardLayer.name="backward_"+e.backwardLayer.name,function(t){W(_t,"BidirectionalMergeMode",t)}(t.mergeMode),e.mergeMode=t.mergeMode,t.weights)throw new R("weights support is not implemented for Bidirectional layer yet.");return e._stateful=t.layer.stateful,e.returnSequences=t.layer.returnSequences,e.returnState=t.layer.returnState,e.supportsMasking=!0,e._trainable=!0,e.inputSpec=t.layer.inputSpec,e.numConstants=null,e}function Du(t){return new _s(t)}function ju(t){return new Cs(t)}function Bu(t){return new Fs(t)}function Lu(t){return new Ks(t)}function Fu(t){return new ys(t)}function zu(t){return new Is(t)}B.Bd.registerClass(Mu);var Uu=Bu,Vu=Lu,Wu=Fu,qu=zu,Hu=Object.freeze({inputLayer:function(t){return new _n(t)},elu:function(t){return new xo(t)},reLU:function(t){return new ho(t)},leakyReLU:function(t){return new go(t)},prelu:function(t){return new bo(t)},softmax:function(t){return new ko(t)},thresholdedReLU:function(t){return new No(t)},conv1d:function(t){return new Qo(t)},conv2d:function(t){return new Fo(t)},conv2dTranspose:function(t){return new qo(t)},separableConv2d:function(t){return new Xo(t)},cropping2D:function(t){return new na(t)},upSampling2d:function(t){return new oa(t)},depthwiseConv2d:function(t){return new ua(t)},activation:function(t){return new wa(t)},dense:function(t){return new da(t)},dropout:function(t){return new fa(t)},flatten:function(t){return new ya(t)},repeatVector:function(t){return new Ea(t)},reshape:function(t){return new Ia(t)},permute:function(t){return new Aa(t)},embedding:function(t){return new Ta(t)},add:function(t){return new Ba(t)},average:function(t){return new qa(t)},concatenate:function(t){return new Qa(t)},maximum:function(t){return new Ga(t)},minimum:function(t){return new Ya(t)},multiply:function(t){return new Ua(t)},dot:function(t){return new rs(t)},batchNormalization:function(t){return new us(t)},zeroPadding2d:function(t){return new fs(t)},averagePooling1d:Du,avgPool1d:function(t){return Du(t)},avgPooling1d:function(t){return Du(t)},averagePooling2d:ju,avgPool2d:function(t){return ju(t)},avgPooling2d:function(t){return ju(t)},globalAveragePooling1d:function(t){return new Ds(t)},globalAveragePooling2d:function(t){return new qs(t)},globalMaxPooling1d:Bu,globalMaxPooling2d:Lu,maxPooling1d:Fu,maxPooling2d:zu,gru:function(t){return new du(t)},gruCell:function(t){return new fu(t)},lstm:function(t){return new wu(t)},lstmCell:function(t){return new yu(t)},simpleRNN:function(t){return new uu(t)},simpleRNNCell:function(t){return new iu(t)},rnn:function(t){return new Qs(t)},stackedRNNCells:function(t){return new Eu(t)},bidirectional:function(t){return new Mu(t)},timeDistributed:function(t){return new Au(t)},globalMaxPool1d:Uu,globalMaxPool2d:Vu,maxPool1d:Wu,maxPool2d:qu,Layer:mn,RNN:Qs,RNNCell:ru,input:di});var $u=Object.freeze({binaryAccuracy:function(t,e){return sr(t,e)},binaryCrossentropy:function(t,e){return hr(t,e)},sparseCategoricalAccuracy:function(t,e){return pr(t,e)},categoricalAccuracy:function(t,e){return ur(t,e)},categoricalCrossentropy:function(t,e){return wr(t,e)},precision:function(t,e){return lr(t,e)},recall:function(t,e){return fr(t,e)},cosineProximity:function(t,e){return or(t,e)},meanAbsoluteError:function(t,e){return Gn(t,e)},meanAbsolutePercentageError:function(t,e){return Kn(t,e)},MAPE:function(t,e){return Kn(t,e)},mape:function(t,e){return Kn(t,e)},meanSquaredError:function(t,e){return $n(t,e)},MSE:function(t,e){return $n(t,e)},mse:function(t,e){return $n(t,e)}}),Gu=Object.freeze({modelFromJSON:function(c,l){return N(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u;return P(this,function(t){switch(t.label){case 0:return"modelTopology"in c||(c={modelTopology:c}),null!=(e=(c=c).modelTopology).model_config&&(e=e.model_config),n=Ar(e),r=Or(n,l),null==c.weightsManifest?[3,2]:[4,B.Xb.loadWeights(c.weightsManifest,c.pathPrefix,r.weights.map(function(t){return t.originalName}))];case 1:for(i=t.sent(),o={},a=0,s=r.weights;a<s.length;a++)u=s[a],o[u.originalName]=i[u.originalName];r.loadWeights(o,null,!0),t.label=2;case 2:return[2,r]}})})}});var Ku,Xu=Object.freeze({l1l2:function(t){return new io(t)},l1:function(t){return function(t){return new io({l1:null!=t?t.l1:null,l2:0})}(t)},l2:function(t){return function(t){return new io({l2:null!=t?t.l2:null,l1:0})}(t)}}),Yu=(u(Zu,Ku=An),Zu.prototype.setModel=function(t){if(!(t instanceof ii))throw new Error("model must be a Model, not some other Container");this.model=t},Zu);function Zu(){var t=null!==Ku&&Ku.apply(this,arguments)||this;return t.model=null,t}var Ju=n(104),Qu=n(105),tc={"tfjs-core":B.De,"tfjs-data":Qu.version_data,"tfjs-layers":Cr,"tfjs-converter":Ju.g,tfjs:"0.15.3"};function ec(o,a,s,u){return new(s||(s=Promise))(function(t,e){function n(t){try{i(u.next(t))}catch(t){e(t)}}function r(t){try{i(u.throw(t))}catch(t){e(t)}}function i(e){e.done?t(e.value):new s(function(t){t(e.value)}).then(n,r)}i((u=u.apply(o,a||[])).next())})}function nc(n,r){var i,o,a,t,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(a=2&e[0]?o.return:e[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,e[1])).done)return a;switch(o=0,a&&(e=[2&e[0],a.value]),e[0]){case 0:case 1:a=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,o=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){s.label=e[1];break}if(6===e[0]&&s.label<a[1]){s.label=a[1],a=e;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(e);break}a[2]&&s.ops.pop(),s.trys.pop();continue}e=r.call(n,s)}catch(t){e=[6,t],o=0}finally{i=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}var rc={1:{name:"/m/01g317",id:1,displayName:"person"},2:{name:"/m/0199g",id:2,displayName:"bicycle"},3:{name:"/m/0k4j",id:3,displayName:"car"},4:{name:"/m/04_sv",id:4,displayName:"motorcycle"},5:{name:"/m/05czz6l",id:5,displayName:"airplane"},6:{name:"/m/01bjv",id:6,displayName:"bus"},7:{name:"/m/07jdr",id:7,displayName:"train"},8:{name:"/m/07r04",id:8,displayName:"truck"},9:{name:"/m/019jd",id:9,displayName:"boat"},10:{name:"/m/015qff",id:10,displayName:"traffic light"},11:{name:"/m/01pns0",id:11,displayName:"fire hydrant"},13:{name:"/m/02pv19",id:13,displayName:"stop sign"},14:{name:"/m/015qbp",id:14,displayName:"parking meter"},15:{name:"/m/0cvnqh",id:15,displayName:"bench"},16:{name:"/m/015p6",id:16,displayName:"bird"},17:{name:"/m/01yrx",id:17,displayName:"cat"},18:{name:"/m/0bt9lr",id:18,displayName:"dog"},19:{name:"/m/03k3r",id:19,displayName:"horse"},20:{name:"/m/07bgp",id:20,displayName:"sheep"},21:{name:"/m/01xq0k1",id:21,displayName:"cow"},22:{name:"/m/0bwd_0j",id:22,displayName:"elephant"},23:{name:"/m/01dws",id:23,displayName:"bear"},24:{name:"/m/0898b",id:24,displayName:"zebra"},25:{name:"/m/03bk1",id:25,displayName:"giraffe"},27:{name:"/m/01940j",id:27,displayName:"backpack"},28:{name:"/m/0hnnb",id:28,displayName:"umbrella"},31:{name:"/m/080hkjn",id:31,displayName:"handbag"},32:{name:"/m/01rkbr",id:32,displayName:"tie"},33:{name:"/m/01s55n",id:33,displayName:"suitcase"},34:{name:"/m/02wmf",id:34,displayName:"frisbee"},35:{name:"/m/071p9",id:35,displayName:"skis"},36:{name:"/m/06__v",id:36,displayName:"snowboard"},37:{name:"/m/018xm",id:37,displayName:"sports ball"},38:{name:"/m/02zt3",id:38,displayName:"kite"},39:{name:"/m/03g8mr",id:39,displayName:"baseball bat"},40:{name:"/m/03grzl",id:40,displayName:"baseball glove"},41:{name:"/m/06_fw",id:41,displayName:"skateboard"},42:{name:"/m/019w40",id:42,displayName:"surfboard"},43:{name:"/m/0dv9c",id:43,displayName:"tennis racket"},44:{name:"/m/04dr76w",id:44,displayName:"bottle"},46:{name:"/m/09tvcd",id:46,displayName:"wine glass"},47:{name:"/m/08gqpm",id:47,displayName:"cup"},48:{name:"/m/0dt3t",id:48,displayName:"fork"},49:{name:"/m/04ctx",id:49,displayName:"knife"},50:{name:"/m/0cmx8",id:50,displayName:"spoon"},51:{name:"/m/04kkgm",id:51,displayName:"bowl"},52:{name:"/m/09qck",id:52,displayName:"banana"},53:{name:"/m/014j1m",id:53,displayName:"apple"},54:{name:"/m/0l515",id:54,displayName:"sandwich"},55:{name:"/m/0cyhj_",id:55,displayName:"orange"},56:{name:"/m/0hkxq",id:56,displayName:"broccoli"},57:{name:"/m/0fj52s",id:57,displayName:"carrot"},58:{name:"/m/01b9xk",id:58,displayName:"hot dog"},59:{name:"/m/0663v",id:59,displayName:"pizza"},60:{name:"/m/0jy4k",id:60,displayName:"donut"},61:{name:"/m/0fszt",id:61,displayName:"cake"},62:{name:"/m/01mzpv",id:62,displayName:"chair"},63:{name:"/m/02crq1",id:63,displayName:"couch"},64:{name:"/m/03fp41",id:64,displayName:"potted plant"},65:{name:"/m/03ssj5",id:65,displayName:"bed"},67:{name:"/m/04bcr3",id:67,displayName:"dining table"},70:{name:"/m/09g1w",id:70,displayName:"toilet"},72:{name:"/m/07c52",id:72,displayName:"tv"},73:{name:"/m/01c648",id:73,displayName:"laptop"},74:{name:"/m/020lf",id:74,displayName:"mouse"},75:{name:"/m/0qjjc",id:75,displayName:"remote"},76:{name:"/m/01m2v",id:76,displayName:"keyboard"},77:{name:"/m/050k8",id:77,displayName:"cell phone"},78:{name:"/m/0fx9l",id:78,displayName:"microwave"},79:{name:"/m/029bxz",id:79,displayName:"oven"},80:{name:"/m/01k6s3",id:80,displayName:"toaster"},81:{name:"/m/0130jx",id:81,displayName:"sink"},82:{name:"/m/040b_t",id:82,displayName:"refrigerator"},84:{name:"/m/0bt_c3",id:84,displayName:"book"},85:{name:"/m/01x3z",id:85,displayName:"clock"},86:{name:"/m/02s195",id:86,displayName:"vase"},87:{name:"/m/01lsmm",id:87,displayName:"scissors"},88:{name:"/m/0kmg4",id:88,displayName:"teddy bear"},89:{name:"/m/03wvsk",id:89,displayName:"hair drier"},90:{name:"/m/012xff",id:90,displayName:"toothbrush"}},ic="https://storage.googleapis.com/tfjs-models/savedmodel/";function oc(n){return void 0===n&&(n="lite_mobilenet_v2"),ec(this,void 0,void 0,function(){var e;return nc(this,function(t){switch(t.label){case 0:if(null==r)throw new Error("Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this model.");if(-1===["mobilenet_v1","mobilenet_v2","lite_mobilenet_v2"].indexOf(n))throw new Error("ObjectDetection constructed with invalid base model "+n+". Valid names are 'mobilenet_v1', 'mobilenet_v2' and 'lite_mobilenet_v2'.");return[4,(e=new ac(n)).load()];case 1:return t.sent(),[2,e]}})})}var ac=(sc.prototype.getPrefix=function(t){return"lite_mobilenet_v2"===t?"ssd"+t:"ssd_"+t},sc.prototype.load=function(){return ec(this,void 0,void 0,function(){var e,n,r=this;return nc(this,function(t){switch(t.label){case 0:return e=this,[4,Object(Ju.d)(this.modelPath,this.weightPath)];case 1:return e.model=t.sent(),[4,this.model.executeAsync(Object(B.He)([1,300,300,3]))];case 2:return(n=t.sent()).map(function(e){return ec(r,void 0,void 0,function(){return nc(this,function(t){switch(t.label){case 0:return[4,e.data()];case 1:return[2,t.sent()]}})})}),n.map(function(e){return ec(r,void 0,void 0,function(){return nc(this,function(t){return[2,e.dispose()]})})}),[2]}})})},sc.prototype.infer=function(p,d){return ec(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c,l,f,h;return nc(this,function(t){switch(t.label){case 0:return e=Object(B.oe)(function(){return p instanceof B.o||(p=Object(B.Jb)(p)),p.expandDims(0)}),n=e.shape[1],r=e.shape[2],[4,this.model.executeAsync(e)];case 1:return i=t.sent(),o=i[0].dataSync(),a=i[1].dataSync(),e.dispose(),Object(B.qb)(i),s=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||0<e--)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}(this.calculateMaxScores(o,i[0].shape[1],i[0].shape[2]),2),u=s[0],c=s[1],l=Object(B.Nb)(),Object(B.Cd)("cpu"),f=Object(B.oe)(function(){var t=Object(B.ie)(a,[i[1].shape[1],i[1].shape[3]]);return B.Wb.nonMaxSuppression(t,u,d,.5,.5)}),h=f.dataSync(),f.dispose(),Object(B.Cd)(l),[2,this.buildDetectedObjects(r,n,a,u,h,c)]}})})},sc.prototype.buildDetectedObjects=function(t,e,n,r,i,o){for(var a=i.length,s=[],u=0;u<a;u++){for(var c=[],l=0;l<4;l++)c[l]=n[4*i[u]+l];var f=c[0]*e,h=c[1]*t,p=c[2]*e,d=c[3]*t;c[0]=h,c[1]=f,c[2]=d-h,c[3]=p-f,s.push({bbox:c,class:rc[o[i[u]]+1].displayName,score:r[i[u]]})}return s},sc.prototype.calculateMaxScores=function(t,e,n){for(var r=[],i=[],o=0;o<e;o++){for(var a=Number.MIN_VALUE,s=-1,u=0;u<n;u++)t[o*n+u]>a&&(a=t[o*n+u],s=u);r[o]=a,i[o]=s}return[r,i]},sc.prototype.detect=function(e,n){return void 0===n&&(n=20),ec(this,void 0,void 0,function(){return nc(this,function(t){return[2,this.infer(e,n)]})})},sc.prototype.dispose=function(){this.model&&this.model.dispose()},sc);function sc(t){this.modelPath=ic+this.getPrefix(t)+"/tensorflowjs_model.pb",this.weightPath=ic+this.getPrefix(t)+"/weights_manifest.json"}function uc(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}function cc(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){uc(r,e,n,i,o,"next",t)}function o(t){uc(r,e,n,i,o,"throw",t)}i(void 0)})}}function lc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}
/**
 * @license
 * Copyright 2018 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 fc=function(){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.webcamElement=t}var n;return function(t,e,n){e&&lc(t.prototype,e),n&&lc(t,n)}(e,[{key:"capture",value:function(){var e=this;return B.oe(function(){var t=B.R.fromPixels(e.webcamElement);return e.cropImage(t).expandDims(0).toFloat().div(B.xd(127)).sub(B.xd(1))})}},{key:"cropImage",value:function(t){var e=Math.min(t.shape[0],t.shape[1]),n=t.shape[0]/2-e/2,r=t.shape[1]/2-e/2;return t.slice([n,r,0],[e,e,3])}},{key:"adjustVideoSize",value:function(t,e){var n=t/e;e<=t?this.webcamElement.width=n*this.webcamElement.height:t<e&&(this.webcamElement.height=this.webcamElement.width/n)}},{key:"setup",value:(n=cc(regeneratorRuntime.mark(function t(r){var i=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise(function(e,n){var t=navigator;navigator.getUserMedia=navigator.getUserMedia||t.webkitGetUserMedia||t.mozGetUserMedia||t.msGetUserMedia,navigator.getUserMedia?navigator.getUserMedia(r,function(t){i.webcamElement.srcObject=t,i.webcamElement.addEventListener("loadeddata",cc(regeneratorRuntime.mark(function t(){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:i.adjustVideoSize(i.webcamElement.videoWidth,i.webcamElement.videoHeight),e();case 2:case"end":return t.stop()}},t)})),!1)},function(t){n()}):n()}));case 1:case"end":return t.stop()}},t)})),function(t){return n.apply(this,arguments)})}]),e}();
/**
 * @license
 * Copyright 2018 Google LLC
 *
 * 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
 *
 *     https://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.
 * =============================================================================
 */function hc(){return/iPhone|iPad|iPod/i.test(navigator.userAgent)}function pc(){return hc()||/Android/i.test(navigator.userAgent)}function dc(t){return t.length?t.map(function(t){return t.style.display="none"}):t.style.display="none"}function mc(t){return t.length?t.map(function(t){return t.style.display="block"}):t.style.display="block"}function gc(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}function yc(s){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=s.apply(t,a);function i(t){gc(r,e,n,i,o,"next",t)}function o(t){gc(r,e,n,i,o,"throw",t)}i(void 0)})}}function vc(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function bc(){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,bc),vc(this,"loadModel",yc(regeneratorRuntime.mark(function t(){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,oc();case 2:return n.model=t.sent,t.abrupt("return",n.model);case 5:case"end":return t.stop()}},t)}))),vc(this,"initiateWebcam",yc(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n.webcam=new fc(document.getElementById("webcam")),n.webcam.webcamElement.width=window.innerWidth,n.webcam.webcamElement.height=window.innerHeight,t.prev=3,e=pc()?"environment":"user",pc()||n.webcam.webcamElement.classList.add("flip-horizontally"),t.next=8,n.webcam.setup({video:{facingMode:e},audio:!1});case 8:console.log("WebCam sccessfully initialized"),t.next=14;break;case 11:return t.prev=11,t.t0=t.catch(3),t.abrupt("return",t.t0);case 14:case"end":return t.stop()}},t,null,[[3,11]])}))),vc(this,"runPredictions",yc(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=n.webcam.webcamElement,t.next=3,n.model.detect(e);case 3:return n.predictions=t.sent,t.abrupt("return",n.predictions);case 5:case"end":return t.stop()}},t)}))),this.webcam,this.predictions,this.model}var wc=n(152),_c=n.n(wc),xc=["can","water bottle","bottle","beer bottle","jar","envelope","cardboard box","box","newspaper","magazine","beer glass","plate","toilet paper"],Ec=["lightbulb","nappy","syringe","sunglasses","bagel","cheeseburger","hotdog","broccoli","cucumber","mushroom","strawberry","orange","lemon","pineapple","banana","pizza","umbrella","handbag","fork","spoon","knife","banana","apple","sandwich","orange","broccoli","carrot","donut","toothbrush"];n(617);function Sc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Nc(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ic=function(){function t(){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Nc(this,"init",function(){r.recognitionFeature.loadModel().then(function(){r.startButton.classList.remove("blinking"),r.startButton.innerText="Start",r.startButton.onclick=function(){return r.start()}})}),Nc(this,"predict",function(){r.recognitionFeature.runPredictions().then(function(t){t.length&&(r.resultDiv.innerText="",r.resultDiv.innerHTML="Is it a ".concat(t[0].class.split(",")[0],"?"),dc([r.classificationDiv,r.guessButton]),r.classifyItem(t[0].class.split(",")[0]))})}),Nc(this,"classifyItem",function(e){var t=_c()(xc,function(t){return e===t}),n=_c()(Ec,function(t){return e===t});t?r.displayButtons("yellow"):n?r.displayButtons("red"):r.displayButtons("none")}),Nc(this,"displayButtons",function(t){mc([r.confirmationButtons,r.resultDiv]);var e=document.getElementById("yes"),n=document.getElementById("no");e.onclick=function(){return r.displayClassification(t)},n.onclick=function(){return r.predict()}}),Nc(this,"displayClassification",function(t){var e;switch(r.showClassification(),t){case"yellow":e="It is recyclable! Throw it in the ".concat(t," bin! üéâ"),r.showFinalMessage(e);break;case"red":e="It is not recyclable üò¢Throw it in the ".concat(t," bin."),r.showFinalMessage(e);break;case"none":e="Mmmm, I don't seem to know yet how to classify that but...\n\n        Is it made of soft plastic, aluminium, paper, glass or cardboard?",r.displayLastButtons()}r.resultDiv.innerHTML=e}),Nc(this,"displayLastButtons",function(){mc([r.confirmationButtons,r.resultDiv]);var t=document.getElementById("yes"),e=document.getElementById("no");t.onclick=function(){return r.showFinalMessage("You can probably throw it in the yellow bin!! üéâ")},e.onclick=function(){return r.showFinalMessage("Mmmm... better put it in the red bin")}}),Nc(this,"showFinalMessage",function(t){r.resultDiv.innerHTML=t,dc(r.confirmationButtons),mc(r.doneButton),r.doneButton.onclick=function(){mc(r.guessButton),dc([r.classificationDiv,r.doneButton,r.resultDiv])}}),Nc(this,"showClassification",function(){mc(r.classificationDiv)}),this.confirmationButtons=document.getElementById("confirmation-buttons"),this.classificationDiv=document.getElementById("recycling-classification"),this.doneButton=document.getElementById("next"),this.resultDiv=document.getElementById("result"),this.guessButton=document.getElementById("guess-button"),this.startButton=document.getElementsByClassName("start-button")[0],this.introBlock=document.getElementsByClassName("intro")[0],this.feedSection=document.getElementsByClassName("feed")[0],this.recognitionFeature=new bc}return function(t,e,n){e&&Sc(t.prototype,e),n&&Sc(t,n)}(t,[{key:"start",value:function(){var t=this;dc(this.introBlock),mc(this.feedSection),this.recognitionFeature.initiateWebcam().then(function(){t.guessButton.classList.remove("blinking"),t.guessButton.innerText="Is this recyclable?",t.guessButton.onclick=function(){t.predict()}}).catch(function(){dc(t.guessButton),t.resultDiv.innerHTML="Webcam not available. This demo requires webcam access."})}}]),t}();window.onload=function(){(new Ic).init()}}]);