!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=237)}([function(e,t,n){"use strict";(function(e,r,i,o){n.d(t,"fd",function(){return fc}),n.d(t,"yb",function(){return pc}),n.d(t,"gb",function(){return mc}),n.d(t,"gc",function(){return gc}),n.d(t,"de",function(){return tc}),n.d(t,"tc",function(){return eu}),n.d(t,"lb",function(){return be}),n.d(t,"Hb",function(){return Gu}),n.d(t,"ed",function(){return Zu}),n.d(t,"Nd",function(){return ec}),n.d(t,"Yd",function(){return V}),n.d(t,"ee",function(){return nc}),n.d(t,"a",function(){return ic}),n.d(t,"b",function(){return oc}),n.d(t,"c",function(){return ac}),n.d(t,"d",function(){return sc}),n.d(t,"g",function(){return cc}),n.d(t,"h",function(){return rc}),n.d(t,"i",function(){return lc}),n.d(t,"l",function(){return uc}),n.d(t,"m",function(){return ee}),n.d(t,"n",function(){return X}),n.d(t,"be",function(){return ne}),n.d(t,"o",function(){return te}),n.d(t,"j",function(){return bt}),n.d(t,"k",function(){return Ms}),n.d(t,"e",function(){return ge}),n.d(t,"f",function(){return me}),n.d(t,"Gb",function(){return Xs}),n.d(t,"Ob",function(){return Ws}),n.d(t,"Zb",function(){return Fs}),n.d(t,"Ac",function(){return Je}),n.d(t,"H",function(){return jo}),n.d(t,"I",function(){return Fo}),n.d(t,"J",function(){return zo}),n.d(t,"G",function(){return Vo}),n.d(t,"Q",function(){return et}),n.d(t,"Qc",function(){return tt}),n.d(t,"Fb",function(){return nt}),n.d(t,"R",function(){return hi}),n.d(t,"S",function(){return di}),n.d(t,"T",function(){return fi}),n.d(t,"U",function(){return pi}),n.d(t,"V",function(){return mi}),n.d(t,"sd",function(){return gi}),n.d(t,"W",function(){return Qo}),n.d(t,"X",function(){return ea}),n.d(t,"eb",function(){return ta}),n.d(t,"dd",function(){return na}),n.d(t,"Y",function(){return ra}),n.d(t,"ac",function(){return Go}),n.d(t,"jb",function(){return Ko}),n.d(t,"Bc",function(){return Yo}),n.d(t,"Uc",function(){return ia}),n.d(t,"Vc",function(){return oa}),n.d(t,"Wc",function(){return aa}),n.d(t,"Xc",function(){return sa}),n.d(t,"Yc",function(){return ua}),n.d(t,"cc",function(){return ca}),n.d(t,"E",function(){return la}),n.d(t,"kd",function(){return ha}),n.d(t,"ld",function(){return da}),n.d(t,"md",function(){return fa}),n.d(t,"nd",function(){return pa}),n.d(t,"od",function(){return ma}),n.d(t,"p",function(){return io}),n.d(t,"q",function(){return oo}),n.d(t,"r",function(){return ao}),n.d(t,"z",function(){return so}),n.d(t,"A",function(){return uo}),n.d(t,"B",function(){return co}),n.d(t,"D",function(){return lo}),n.d(t,"N",function(){return ho}),n.d(t,"O",function(){return fo}),n.d(t,"Z",function(){return po}),n.d(t,"ab",function(){return mo}),n.d(t,"ob",function(){return go}),n.d(t,"pb",function(){return bo}),n.d(t,"rb",function(){return yo}),n.d(t,"ub",function(){return vo}),n.d(t,"Rb",function(){return _o}),n.d(t,"Sb",function(){return wo}),n.d(t,"Tb",function(){return xo}),n.d(t,"sc",function(){return Eo}),n.d(t,"Rc",function(){return So}),n.d(t,"Zc",function(){return Co}),n.d(t,"ad",function(){return Oo}),n.d(t,"gd",function(){return Ao}),n.d(t,"hd",function(){return Mo}),n.d(t,"id",function(){return No}),n.d(t,"jd",function(){return ko}),n.d(t,"qd",function(){return Io}),n.d(t,"td",function(){return To}),n.d(t,"ud",function(){return Po}),n.d(t,"zd",function(){return Ro}),n.d(t,"Ed",function(){return Do}),n.d(t,"Fd",function(){return Lo}),n.d(t,"v",function(){return ba}),n.d(t,"w",function(){return ya}),n.d(t,"x",function(){return va}),n.d(t,"y",function(){return _a}),n.d(t,"Ub",function(){return wa}),n.d(t,"bc",function(){return xa}),n.d(t,"fc",function(){return Ea}),n.d(t,"hc",function(){return Sa}),n.d(t,"mc",function(){return Ca}),n.d(t,"Dd",function(){return Oa}),n.d(t,"mb",function(){return Aa}),n.d(t,"nb",function(){return Ma}),n.d(t,"Bb",function(){return Na}),n.d(t,"Cb",function(){return ka}),n.d(t,"Db",function(){return Ia}),n.d(t,"Eb",function(){return Ta}),n.d(t,"Kb",function(){return Pa}),n.d(t,"Lb",function(){return Ra}),n.d(t,"Mb",function(){return Da}),n.d(t,"Nb",function(){return La}),n.d(t,"vc",function(){return Ba}),n.d(t,"wc",function(){return ja}),n.d(t,"s",function(){return Fa}),n.d(t,"t",function(){return za}),n.d(t,"u",function(){return Va}),n.d(t,"C",function(){return Ua}),n.d(t,"hb",function(){return Wa}),n.d(t,"ib",function(){return $a}),n.d(t,"vb",function(){return qa}),n.d(t,"dc",function(){return Ha}),n.d(t,"ec",function(){return Ga}),n.d(t,"ic",function(){return Ka}),n.d(t,"jc",function(){return Ya}),n.d(t,"kc",function(){return Xa}),n.d(t,"lc",function(){return Za}),n.d(t,"oc",function(){return Ja}),n.d(t,"pc",function(){return Qa}),n.d(t,"Hc",function(){return es}),n.d(t,"Ic",function(){return ts}),n.d(t,"vd",function(){return ns}),n.d(t,"wd",function(){return rs}),n.d(t,"Bd",function(){return is}),n.d(t,"Cd",function(){return os}),n.d(t,"kb",function(){return ds}),n.d(t,"Jb",function(){return fs}),n.d(t,"Jc",function(){return ps}),n.d(t,"Sc",function(){return ms}),n.d(t,"cd",function(){return gs}),n.d(t,"Vb",function(){return as}),n.d(t,"Wb",function(){return ss}),n.d(t,"Xb",function(){return us}),n.d(t,"Yb",function(){return cs}),n.d(t,"fe",function(){return ls}),n.d(t,"ge",function(){return hs}),n.d(t,"L",function(){return Mi}),n.d(t,"Rd",function(){return Ai}),n.d(t,"Kc",function(){return Ni}),n.d(t,"K",function(){return ki}),n.d(t,"M",function(){return Ii}),n.d(t,"P",function(){return Ti}),n.d(t,"bb",function(){return Pi}),n.d(t,"db",function(){return Ri}),n.d(t,"qb",function(){return Di}),n.d(t,"sb",function(){return Li}),n.d(t,"wb",function(){return Bi}),n.d(t,"rc",function(){return ji}),n.d(t,"xc",function(){return Fi}),n.d(t,"Cc",function(){return zi}),n.d(t,"Dc",function(){return Vi}),n.d(t,"Ec",function(){return Ui}),n.d(t,"Fc",function(){return Wi}),n.d(t,"Gc",function(){return $i}),n.d(t,"Mc",function(){return qi}),n.d(t,"Nc",function(){return Hi}),n.d(t,"Oc",function(){return Gi}),n.d(t,"Tc",function(){return Ki}),n.d(t,"rd",function(){return Yi}),n.d(t,"xd",function(){return Xi}),n.d(t,"yd",function(){return Zi}),n.d(t,"Pd",function(){return Ji}),n.d(t,"Vd",function(){return Qi}),n.d(t,"Xd",function(){return eo}),n.d(t,"tb",function(){return ft}),n.d(t,"Pb",function(){return pt}),n.d(t,"yc",function(){return ht}),n.d(t,"Pc",function(){return mt}),n.d(t,"bd",function(){return it}),n.d(t,"Gd",function(){return rt}),n.d(t,"Hd",function(){return ot}),n.d(t,"Id",function(){return at}),n.d(t,"Jd",function(){return st}),n.d(t,"Kd",function(){return ut}),n.d(t,"Ld",function(){return ct}),n.d(t,"Md",function(){return lt}),n.d(t,"he",function(){return dt}),n.d(t,"zc",function(){return xt}),n.d(t,"ie",function(){return Et}),n.d(t,"Ud",function(){return bs}),n.d(t,"pd",function(){return Qe}),n.d(t,"Qb",function(){return ys}),n.d(t,"uc",function(){return vs}),n.d(t,"xb",function(){return xs}),n.d(t,"Wd",function(){return Es}),n.d(t,"F",function(){return Ss}),n.d(t,"qc",function(){return Cs}),n.d(t,"nc",function(){return Os}),n.d(t,"Ad",function(){return As}),n.d(t,"Sd",function(){return Ns}),n.d(t,"Td",function(){return dc}),n.d(t,"Od",function(){return Ce}),n.d(t,"Ib",function(){return Oe}),n.d(t,"fb",function(){return Ae}),n.d(t,"Qd",function(){return Me}),n.d(t,"Lc",function(){return Ne}),n.d(t,"cb",function(){return Ee}),n.d(t,"zb",function(){return ye}),n.d(t,"Ab",function(){return ve}),n.d(t,"Zd",function(){return _e}),n.d(t,"ae",function(){return we}),n.d(t,"ce",function(){return xe});
/**
 * @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 a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};function s(e,t){function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e};function c(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})}function l(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function h(e){for(var t=e.length,n=0,r=0;t>0;)r=Math.random()*t|0,n=e[--t],e[t]=e[r],e[r]=n}function d(e,t,n){return Math.max(e,Math.min(t,n))}function f(e,t){var n=Math.random();return t*n+(1-n)*e}function p(e,t){if(!e)throw new Error("string"==typeof t?t:t())}function m(e,t,n){void 0===n&&(n=""),p(_(e,t),n+" Shapes "+e+" and "+t+" must match")}function g(e){p(null!=e,"The input to the tensor constructor must be a non-null value.")}function b(e,t){if(void 0===t&&(t=[]),Array.isArray(e))for(var n=0;n<e.length;++n)b(e[n],t);else t.push(e);return t}function y(e){var t=e;if(T(e))return[e.length];if(!Array.isArray(e))return[];for(var n=[];t instanceof Array;)n.push(t.length),t=t[0];return e instanceof Array&&function e(t,n,r){if(r=r||[],t instanceof Array){p(n.length>0,function(){return"Element arr["+r.join("][")+"] should be a primitive, but is an array of "+t.length+" elements"}),p(t.length===n[0],function(){return"Element arr["+r.join("][")+"] should have "+n[0]+" elements, but has "+t.length+" elements"});for(var i=n.slice(1),o=0;o<t.length;++o)e(t[o],i,r.concat(o))}else p(0===n.length,function(){return"Element arr["+r.join("][")+"] is a primitive, but should be an array of "+n[0]+" elements"})}(e,n,[]),n}function v(e){if(0===e.length)return 1;for(var t=e[0],n=1;n<e.length;n++)t*=e[n];return t}function _(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function w(e){return e%1==0}function x(e){if(null!=Math.tanh)return Math.tanh(e);if(e===1/0)return 1;if(e===-1/0)return-1;var t=Math.exp(2*e);return(t-1)/(t+1)}function E(e){for(var t=Math.floor(Math.sqrt(e));t>1;--t)if(e%t==0)return[t,e/t];return[1,e]}function S(e,t){return t<=e.length?e:e+" ".repeat(t-e.length)}function C(e,t,n){return void 0===t&&(t=function(e){return 0}),new Promise(function(r,i){var o=0,a=function(){if(e())r();else{var s=t(++o);null!=n&&o>=n?i():setTimeout(a,s)}};a()})}function O(e,t){for(var n=1,r=-1,i=0;i<e.length;++i)if(e[i]>=0)n*=e[i];else if(-1===e[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(e[i]<0)throw Error("Shapes can not be < 0. Found "+e[i]+" at dim "+i);if(-1===r){if(t>0&&t!==n)throw Error("Size("+t+") must match the product of shape "+e);return e}if(0===n)throw Error("Cannot infer the missing size in ["+e+"] when there are 0 elements");if(t%n!=0)throw Error("The implicit shape can't be a fractional number. Got "+t+" / "+n);var o=e.slice();return o[r]=t/n,o}function A(e,t){for(var n=[],r=[],i=0,o=0;o<e.length;++o){if(null!=t){if(t[i]===o&&1!==e[o])throw new Error("Can't squeeze axis "+o+" since its dim '"+e[o]+"' is not 1");(null==t[i]||t[i]>o)&&1===e[o]&&(n.push(e[o]),r.push(o)),t[i]<=o&&i++}1!==e[o]&&(n.push(e[o]),r.push(o))}return{newShape:n,keptDims:r}}function M(e,t){var n=null;if(null==e||"float32"===e)n=new Float32Array(t);else if("int32"===e)n=new Int32Array(t);else{if("bool"!==e)throw new Error("Unknown data type "+e);n=new Uint8Array(t)}return n}function N(e,t,n){if("float32"===t)for(var r=0;r<e.length;r++)if(isNaN(e[r]))throw Error("The result of the '"+n+"' has NaNs.")}function k(e,t){if("float32"!==t)for(var n=0;n<e.length;n++)if(isNaN(e[n]))throw Error("NaN is not a valid value for dtype: '"+t+"'.")}function I(e,t){return!("complex64"===t||"float32"===t&&"complex64"!==e||"int32"===t&&"float32"!==e&&"complex64"!==e||"bool"===t&&"bool"===e)}function T(e){return e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array}function P(e){if("float32"===e||"int32"===e)return 4;if("complex64"===e)return 8;if("bool"===e)return 1;throw new Error("Unknown dtype "+e)}function R(e){return!!(e&&e.constructor&&e.call&&e.apply)}function D(e,t){for(var n=t;n<e;++n)if(e%n==0)return n;return e}function L(e){var t=e.length;if(t<2)return[];var n=new Array(t-1);n[t-2]=e[t-1];for(var r=t-3;r>=0;--r)n[r]=n[r+1]*e[r+1];return n}function B(e,t,n){return function(e,t){return e instanceof Float32Array&&"float32"===t||e instanceof Int32Array&&"int32"===t||e instanceof Uint8Array&&"bool"===t}(e,t)?e:(Array.isArray(e)&&(e=b(e)),function(e,t,n){if(null==t||"float32"===t||"complex64"===t)return new Float32Array(e);if("int32"===t)return n&&k(e,t),new Int32Array(e);if("bool"===t){for(var r=new Uint8Array(e.length),i=0;i<r.length;++i)0!==Math.round(e[i])&&(r[i]=1);return r}throw new Error("Unknown data type "+t)}(e,t,n))}function j(e,t){for(var n=F(e,t),r=0;r<n.length;r++)n[r]=1;return n}function F(e,t){if(null==t||"float32"===t||"complex64"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t)return new Uint8Array(e);throw new Error("Unknown data type "+t)}function z(){if("undefined"!=typeof performance)return performance.now();if(void 0!==e){var t=e.hrtime();return 1e3*t[0]+t[1]/1e6}throw new Error("Cannot measure time in this environment. You should run tf.js in the browser or in Node.js")}var V=Object.freeze({shuffle:h,clamp:d,randUniform:f,distSquared:function(e,t){for(var n=0,r=0;r<e.length;r++){var i=Number(e[r])-Number(t[r]);n+=i*i}return n},assert:p,assertShapesMatch:m,assertNonNull:g,flatten:b,inferShape:y,sizeFromShape:v,isScalarShape:function(e){return 0===e.length},arraysEqual:_,isInt:w,tanh:x,sizeToSquarishShape:E,createShuffledIndices:function(e){for(var t=new Uint32Array(e),n=0;n<e;++n)t[n]=n;return h(t),t},rightPad:S,repeatedTry:C,inferFromImplicitShape:O,squeezeShape:A,getTypedArrayFromDType:M,checkComputationForNaN:N,checkConversionForNaN:k,hasEncodingLoss:I,isTypedArray:T,bytesPerElement:P,isFunction:R,nearestDivisor:D,computeStrides:L,toTypedArray:B,makeOnesTypedArray:j,makeZerosTypedArray:F,now:z}),U=function(){function e(e,t){this.backendTimer=e,this.logger=t,null==t&&(this.logger=new W)}return e.prototype.profileKernel=function(e,t){var n,r=this,i=this.backendTimer.time(function(){n=t()});return(Array.isArray(n)?n:[n]).forEach(function(t){var n=t.dataSync();N(n,t.dtype,e),i.then(function(i){r.logger.logKernelProfile(e,t,n,i.kernelMs)})}),n},e}(),W=function(){function e(){}return e.prototype.logKernelProfile=function(e,t,n,r){var i=S(r+"ms",9),o=S(e,25),a=t.rank,s=t.size,u=S(t.shape.toString(),14);console.log("%c"+o+"\t%c"+i+"\t%c"+a+"D "+u+"\t%c"+s,"font-weight:bold","color:red","color:blue","color: orange")},e}(),$=20,q=3,H=7;function G(e,t,n,r){var i=L(t),o=function(e,t,n,r){var i=v(t),o=r[r.length-1],a=new Array(o).fill(0),s=t.length,u="complex64"===n?Y(e):e;if(s>1)for(var c=0;c<i/o;c++)for(var l=c*o,h=0;h<o;h++)a[h]=Math.max(a[h],K(u[l+h],0).length);return a}(e,t,n,i),a=t.length,s=function e(t,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?[K(Y(t)[0],0)]:[t[0].toString()];if(1===c){if(u>$){var l=q*s,h=Array.from(t.subarray(0,l)),d=Array.from(t.subarray(u-q*s,u));return"complex64"===r&&(h=Y(h),d=Y(d)),["["+h.map(function(e,t){return K(e,o[t])}).join(", ")+", ..., "+d.map(function(e,t){return K(e,o[u-q+t])}).join(", ")+"]"]}return["["+("complex64"===r?Y(t):Array.from(t)).map(function(e,t){return K(e,o[t])}).join(", ")+"]"]}var f=n.slice(1),p=i.slice(1),m=i[0]*s,g=[];if(u>$){for(var b=0;b<q;b++){var y=(v=b*m)+m;g.push.apply(g,e(t.subarray(v,y),f,r,p,o,!1))}for(g.push("..."),b=u-q;b<u;b++)y=(v=b*m)+m,g.push.apply(g,e(t.subarray(v,y),f,r,p,o,b===u-1))}else for(b=0;b<u;b++){var v;y=(v=b*m)+m,g.push.apply(g,e(t.subarray(v,y),f,r,p,o,b===u-1))}var _=2===c?",":"";g[0]="["+g[0]+_;for(b=1;b<g.length-1;b++)g[b]=" "+g[b]+_;var w=",\n";for(b=2;b<c;b++)w+="\n";return g[g.length-1]=" "+g[g.length-1]+"]"+(a?"":w),g}(e,t,n,i,o),u=["Tensor"];return r&&(u.push("  dtype: "+n),u.push("  rank: "+a),u.push("  shape: ["+t+"]"),u.push("  values:")),u.push(s.map(function(e){return"    "+e}).join("\n")),u.join("\n")}function K(e,t){return S(Array.isArray(e)?parseFloat(e[0].toFixed(H))+" + "+parseFloat(e[1].toFixed(H))+"j":parseFloat(e.toFixed(H)).toString(),t)}function Y(e){for(var t=[],n=0;n<e.length;n+=2)t.push([e[n],e[n+1]]);return t}var X=function(){function e(e,t,n){if(this.dtype=t,this.shape=e.slice(),this.size=v(e),null!=n){var r=n.length;p(r===this.size,"Length of values '"+r+"' does not match the size inferred by the shape '"+this.size+"'.")}if("complex64"===t)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||M(t,v(this.shape)),this.strides=L(e)}return e.prototype.set=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];0===t.length&&(t=[0]),p(t.length===this.rank,"The number of provided coordinates ("+t.length+") must match the rank ("+this.rank+")");var r=this.locToIndex(t);this.values[r]=e},e.prototype.get=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];0===e.length&&(e=[0]);for(var n=e[e.length-1],r=0;r<e.length-1;++r)n+=this.strides[r]*e[r];return this.values[n]},e.prototype.locToIndex=function(e){if(0===this.rank)return 0;if(1===this.rank)return e[0];for(var t=e[e.length-1],n=0;n<e.length-1;++n)t+=this.strides[n]*e[n];return t},e.prototype.indexToLoc=function(e){if(0===this.rank)return[];if(1===this.rank)return[e];for(var t=new Array(this.shape.length),n=0;n<t.length-1;++n)t[n]=Math.floor(e/this.strides[n]),e-=t[n]*this.strides[n];return t[t.length-1]=e,t},Object.defineProperty(e.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),e.prototype.toTensor=function(){return ee.make(this.shape,{values:this.values},this.dtype)},e}(),Z=null,J=null;function Q(e){Z=e}var ee=function(){function e(t,n,r,i){this.isDisposedInternal=!1,this.shape=t.slice(),this.dtype=n||"float32",this.size=v(t),null!=r&&p(this.size===r.length,"Based on the provided shape, ["+t+"], and dtype "+this.dtype+", the tensor should have "+this.size+" values but has "+r.length),this.strides=L(t),this.dataId=null!=i?i:{},this.id=e.nextId++,this.rankType=this.rank<5?this.rank.toString():"higher",Z().registerTensor(this),null!=r&&Z().write(this.dataId,r)}return e.make=function(t,n,r){return new e(t,r,n.values,n.dataId)},e.prototype.flatten=function(){return this.throwIfDisposed(),this.as1D()},e.prototype.asScalar=function(){return this.throwIfDisposed(),p(1===this.size,"The array must have only 1 element."),this.reshape([])},e.prototype.as1D=function(){return this.throwIfDisposed(),this.reshape([this.size])},e.prototype.as2D=function(e,t){return this.throwIfDisposed(),this.reshape([e,t])},e.prototype.as3D=function(e,t,n){return this.throwIfDisposed(),this.reshape([e,t,n])},e.prototype.as4D=function(e,t,n,r){return this.throwIfDisposed(),this.reshape([e,t,n,r])},e.prototype.asType=function(e){return this.throwIfDisposed(),J.cast(this,e)},Object.defineProperty(e.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),e.prototype.get=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];p(e.length===this.rank,"Number of coordinates in get() must match the rank of the tensor"),p("complex64"!==this.dtype,"Tensor.get() is not supported for complex64 tensors yet."),this.throwIfDisposed(),0===e.length&&(e=[0]);for(var n=e[e.length-1],r=0;r<e.length-1;++r)n+=this.strides[r]*e[r];return this.dataSync()[n]},e.prototype.buffer=function(){return J.buffer(this.shape,this.dtype,this.dataSync())},e.prototype.data=function(){return c(this,void 0,void 0,function(){return l(this,function(e){return this.throwIfDisposed(),[2,Z().read(this.dataId)]})})},e.prototype.dataSync=function(){return this.throwIfDisposed(),Z().readSync(this.dataId)},e.prototype.dispose=function(){this.isDisposed||(Z().disposeTensor(this),this.isDisposedInternal=!0)},Object.defineProperty(e.prototype,"isDisposed",{get:function(){return this.isDisposedInternal},enumerable:!0,configurable:!0}),e.prototype.throwIfDisposed=function(){if(this.isDisposed)throw new Error("Tensor is disposed.")},e.prototype.toFloat=function(){return this.asType("float32")},e.prototype.toInt=function(){return this.asType("int32")},e.prototype.toBool=function(){return this.asType("bool")},e.prototype.print=function(e){return void 0===e&&(e=!1),J.print(this,e)},e.prototype.reshape=function(e){return this.throwIfDisposed(),J.reshape(this,e)},e.prototype.reshapeAs=function(e){return this.throwIfDisposed(),this.reshape(e.shape)},e.prototype.expandDims=function(e){return void 0===e&&(e=0),J.expandDims(this,e)},e.prototype.cumsum=function(e,t,n){return void 0===e&&(e=0),void 0===t&&(t=!1),void 0===n&&(n=!1),J.cumsum(this,e,t,n)},e.prototype.squeeze=function(e){return this.throwIfDisposed(),J.squeeze(this,e)},e.prototype.clone=function(){return this.throwIfDisposed(),J.clone(this)},e.prototype.toString=function(e){return void 0===e&&(e=!1),G(this.dataSync(),this.shape,this.dtype,e)},e.prototype.tile=function(e){return this.throwIfDisposed(),J.tile(this,e)},e.prototype.gather=function(e,t){return void 0===t&&(t=0),this.throwIfDisposed(),J.gather(this,e,t)},e.prototype.matMul=function(e,t,n){return void 0===t&&(t=!1),void 0===n&&(n=!1),this.throwIfDisposed(),J.matMul(this,e,t,n)},e.prototype.dot=function(e){return this.throwIfDisposed(),J.dot(this,e)},e.prototype.norm=function(e,t,n){return void 0===e&&(e="euclidean"),void 0===t&&(t=null),void 0===n&&(n=!1),this.throwIfDisposed(),J.norm(this,e,t,n)},e.prototype.slice=function(e,t){return this.throwIfDisposed(),J.slice(this,e,t)},e.prototype.reverse=function(e){return this.throwIfDisposed(),J.reverse(this,e)},e.prototype.concat=function(e,t){return void 0===t&&(t=0),this.throwIfDisposed(),J.concat([this,e],t)},e.prototype.split=function(e,t){return void 0===t&&(t=0),this.throwIfDisposed(),J.split(this,e,t)},e.prototype.stack=function(e,t){return void 0===t&&(t=0),J.stack([this,e],t)},e.prototype.unstack=function(e,t){return void 0===t&&(t=0),J.unstack(this,t)},e.prototype.pad=function(e,t){return void 0===t&&(t=0),J.pad(this,e,t)},e.prototype.batchNormalization=function(e,t,n,r,i){return void 0===n&&(n=.001),this.throwIfDisposed(),J.batchNormalization(this,e,t,n,r,i)},e.prototype.all=function(e,t){return void 0===e&&(e=null),void 0===t&&(t=!1),this.throwIfDisposed(),J.all(this,e,t)},e.prototype.any=function(e,t){return void 0===e&&(e=null),void 0===t&&(t=!1),this.throwIfDisposed(),J.any(this,e,t)},e.prototype.logSumExp=function(e,t){return void 0===e&&(e=null),void 0===t&&(t=!1),this.throwIfDisposed(),J.logSumExp(this,e,t)},e.prototype.sum=function(e,t){return void 0===e&&(e=null),void 0===t&&(t=!1),this.throwIfDisposed(),J.sum(this,e,t)},e.prototype.mean=function(e,t){return void 0===e&&(e=null),void 0===t&&(t=!1),this.throwIfDisposed(),J.mean(this,e,t)},e.prototype.min=function(e,t){return void 0===e&&(e=null),void 0===t&&(t=!1),this.throwIfDisposed(),J.min(this,e,t)},e.prototype.max=function(e,t){return void 0===e&&(e=null),void 0===t&&(t=!1),this.throwIfDisposed(),J.max(this,e,t)},e.prototype.argMin=function(e){return void 0===e&&(e=null),this.throwIfDisposed(),J.argMin(this,e)},e.prototype.argMax=function(e){return void 0===e&&(e=null),this.throwIfDisposed(),J.argMax(this,e)},e.prototype.cast=function(e){return this.throwIfDisposed(),J.cast(this,e)},e.prototype.add=function(e){return this.throwIfDisposed(),J.add(this,e)},e.prototype.addStrict=function(e){return this.throwIfDisposed(),J.addStrict(this,e)},e.prototype.atan2=function(e){return this.throwIfDisposed(),J.atan2(this,e)},e.prototype.sub=function(e){return this.throwIfDisposed(),J.sub(this,e)},e.prototype.subStrict=function(e){return this.throwIfDisposed(),J.subStrict(this,e)},e.prototype.pow=function(e){return this.throwIfDisposed(),J.pow(this,e)},e.prototype.powStrict=function(e){return this.throwIfDisposed(),J.powStrict(this,e)},e.prototype.mul=function(e){return this.throwIfDisposed(),J.mul(this,e)},e.prototype.mulStrict=function(e){return this.throwIfDisposed(),J.mulStrict(this,e)},e.prototype.div=function(e){return this.throwIfDisposed(),J.div(this,e)},e.prototype.floorDiv=function(e){return this.throwIfDisposed(),J.floorDiv(this,e)},e.prototype.divStrict=function(e){return this.throwIfDisposed(),J.divStrict(this,e)},e.prototype.minimum=function(e){return this.throwIfDisposed(),J.minimum(this,e)},e.prototype.minimumStrict=function(e){return this.throwIfDisposed(),J.minimumStrict(this,e)},e.prototype.maximum=function(e){return this.throwIfDisposed(),J.maximum(this,e)},e.prototype.maximumStrict=function(e){return this.throwIfDisposed(),J.maximumStrict(this,e)},e.prototype.mod=function(e){return this.throwIfDisposed(),J.mod(this,e)},e.prototype.modStrict=function(e){return this.throwIfDisposed(),J.modStrict(this,e)},e.prototype.squaredDifference=function(e){return this.throwIfDisposed(),J.squaredDifference(this,e)},e.prototype.squaredDifferenceStrict=function(e){return this.throwIfDisposed(),J.squaredDifferenceStrict(this,e)},e.prototype.transpose=function(e){return this.throwIfDisposed(),J.transpose(this,e)},e.prototype.notEqual=function(e){return this.throwIfDisposed(),J.notEqual(this,e)},e.prototype.notEqualStrict=function(e){return this.throwIfDisposed(),J.notEqualStrict(this,e)},e.prototype.less=function(e){return this.throwIfDisposed(),J.less(this,e)},e.prototype.lessStrict=function(e){return this.throwIfDisposed(),J.lessStrict(this,e)},e.prototype.equal=function(e){return this.throwIfDisposed(),J.equal(this,e)},e.prototype.equalStrict=function(e){return this.throwIfDisposed(),J.equalStrict(this,e)},e.prototype.lessEqual=function(e){return this.throwIfDisposed(),J.lessEqual(this,e)},e.prototype.lessEqualStrict=function(e){return this.throwIfDisposed(),J.lessEqualStrict(this,e)},e.prototype.greater=function(e){return this.throwIfDisposed(),J.greater(this,e)},e.prototype.greaterStrict=function(e){return this.throwIfDisposed(),J.greaterStrict(this,e)},e.prototype.greaterEqual=function(e){return this.throwIfDisposed(),J.greaterEqual(this,e)},e.prototype.greaterEqualStrict=function(e){return this.throwIfDisposed(),J.greaterEqualStrict(this,e)},e.prototype.logicalAnd=function(e){return this.throwIfDisposed(),J.logicalAnd(this,e)},e.prototype.logicalOr=function(e){return this.throwIfDisposed(),J.logicalOr(this,e)},e.prototype.logicalNot=function(){return this.throwIfDisposed(),J.logicalNot(this)},e.prototype.logicalXor=function(e){return this.throwIfDisposed(),J.logicalXor(this,e)},e.prototype.where=function(e,t){return this.throwIfDisposed(),J.where(e,this,t)},e.prototype.neg=function(){return this.throwIfDisposed(),J.neg(this)},e.prototype.ceil=function(){return this.throwIfDisposed(),J.ceil(this)},e.prototype.floor=function(){return this.throwIfDisposed(),J.floor(this)},e.prototype.sign=function(){return this.throwIfDisposed(),J.sign(this)},e.prototype.exp=function(){return this.throwIfDisposed(),J.exp(this)},e.prototype.expm1=function(){return this.throwIfDisposed(),J.expm1(this)},e.prototype.log=function(){return this.throwIfDisposed(),J.log(this)},e.prototype.log1p=function(){return this.throwIfDisposed(),J.log1p(this)},e.prototype.sqrt=function(){return this.throwIfDisposed(),J.sqrt(this)},e.prototype.rsqrt=function(){return this.throwIfDisposed(),J.rsqrt(this)},e.prototype.square=function(){return this.throwIfDisposed(),J.square(this)},e.prototype.reciprocal=function(){return this.throwIfDisposed(),J.reciprocal(this)},e.prototype.abs=function(){return this.throwIfDisposed(),J.abs(this)},e.prototype.clipByValue=function(e,t){return this.throwIfDisposed(),J.clipByValue(this,e,t)},e.prototype.relu=function(){return this.throwIfDisposed(),J.relu(this)},e.prototype.elu=function(){return this.throwIfDisposed(),J.elu(this)},e.prototype.selu=function(){return this.throwIfDisposed(),J.selu(this)},e.prototype.leakyRelu=function(e){return void 0===e&&(e=.2),this.throwIfDisposed(),J.leakyRelu(this,e)},e.prototype.prelu=function(e){return this.throwIfDisposed(),J.prelu(this,e)},e.prototype.sigmoid=function(){return this.throwIfDisposed(),J.sigmoid(this)},e.prototype.logSigmoid=function(){return this.throwIfDisposed(),J.logSigmoid(this)},e.prototype.softplus=function(){return this.throwIfDisposed(),J.softplus(this)},e.prototype.zerosLike=function(){return this.throwIfDisposed(),J.zerosLike(this)},e.prototype.onesLike=function(){return this.throwIfDisposed(),J.onesLike(this)},e.prototype.sin=function(){return this.throwIfDisposed(),J.sin(this)},e.prototype.cos=function(){return this.throwIfDisposed(),J.cos(this)},e.prototype.tan=function(){return this.throwIfDisposed(),J.tan(this)},e.prototype.asin=function(){return this.throwIfDisposed(),J.asin(this)},e.prototype.acos=function(){return this.throwIfDisposed(),J.acos(this)},e.prototype.atan=function(){return this.throwIfDisposed(),J.atan(this)},e.prototype.sinh=function(){return this.throwIfDisposed(),J.sinh(this)},e.prototype.cosh=function(){return this.throwIfDisposed(),J.cosh(this)},e.prototype.tanh=function(){return this.throwIfDisposed(),J.tanh(this)},e.prototype.asinh=function(){return this.throwIfDisposed(),J.asinh(this)},e.prototype.acosh=function(){return this.throwIfDisposed(),J.acosh(this)},e.prototype.atanh=function(){return this.throwIfDisposed(),J.atanh(this)},e.prototype.erf=function(){return this.throwIfDisposed(),J.erf(this)},e.prototype.round=function(){return this.throwIfDisposed(),J.round(this)},e.prototype.step=function(e){return void 0===e&&(e=0),this.throwIfDisposed(),J.step(this,e)},e.prototype.softmax=function(e){return void 0===e&&(e=-1),this.throwIfDisposed(),J.softmax(this,e)},e.prototype.resizeBilinear=function(e,t){return void 0===t&&(t=!1),this.throwIfDisposed(),J.image.resizeBilinear(this,e,t)},e.prototype.resizeNearestNeighbor=function(e,t){return void 0===t&&(t=!1),this.throwIfDisposed(),J.image.resizeNearestNeighbor(this,e,t)},e.prototype.conv1d=function(e,t,n,r,i,o){return void 0===r&&(r="NWC"),void 0===i&&(i=1),this.throwIfDisposed(),J.conv1d(this,e,t,n,r,i,o)},e.prototype.conv2d=function(e,t,n,r,i,o){return void 0===r&&(r="NHWC"),void 0===i&&(i=[1,1]),this.throwIfDisposed(),J.conv2d(this,e,t,n,r,i,o)},e.prototype.conv2dTranspose=function(e,t,n,r,i){return this.throwIfDisposed(),J.conv2dTranspose(this,e,t,n,r,i)},e.prototype.depthwiseConv2D=function(e,t,n,r,i,o){return void 0===r&&(r="NHWC"),void 0===i&&(i=[1,1]),this.throwIfDisposed(),J.depthwiseConv2d(this,e,t,n,r,i,o)},e.prototype.separableConv2d=function(e,t,n,r,i,o){return void 0===i&&(i=[1,1]),void 0===o&&(o="NHWC"),this.throwIfDisposed(),J.separableConv2d(this,e,t,n,r,i,o)},e.prototype.avgPool=function(e,t,n,r){return this.throwIfDisposed(),J.avgPool(this,e,t,n,r)},e.prototype.maxPool=function(e,t,n,r){return this.throwIfDisposed(),J.maxPool(this,e,t,n,r)},e.prototype.localResponseNormalization=function(e,t,n,r){return void 0===e&&(e=5),void 0===t&&(t=1),void 0===n&&(n=1),void 0===r&&(r=.5),J.localResponseNormalization(this,e,t,n,r)},e.prototype.variable=function(e,t,n){return void 0===e&&(e=!0),this.throwIfDisposed(),te.variable(this,e,t,n)},e.prototype.unsortedSegmentSum=function(e,t){return this.throwIfDisposed(),J.unsortedSegmentSum(this,e,t)},e.prototype.batchToSpaceND=function(e,t){return this.throwIfDisposed(),J.batchToSpaceND(this,e,t)},e.prototype.spaceToBatchND=function(e,t){return this.throwIfDisposed(),J.spaceToBatchND(this,e,t)},e.prototype.topk=function(e,t){return void 0===e&&(e=1),void 0===t&&(t=!0),this.throwIfDisposed(),J.topk(this,e,t)},e.prototype.stridedSlice=function(e,t,n,r,i){return void 0===r&&(r=0),void 0===i&&(i=0),this.throwIfDisposed(),J.stridedSlice(this,e,t,n,r,i)},e.prototype.depthToSpace=function(e,t){return this.throwIfDisposed(),J.depthToSpace(this,e,t)},e.nextId=0,e}();Object.defineProperty(ee,Symbol.hasInstance,{value:function(e){return!!e&&null!=e.shape&&null!=e.dtype}});var te=function(e){function t(n,r,i){void 0===r&&(r=!0);var o=e.call(this,n.shape,n.dtype,null,n.dataId)||this;o.trainable=r,o.name=i,null==o.name&&(o.name=t.nextVarId.toString(),t.nextVarId++);try{Z().registerVariable(o)}catch(e){throw Z().disposeTensor(o),e}return o}return s(t,e),t.variable=function(e,n,r,i){return void 0===n&&(n=!0),null!=i&&i!==e.dtype&&(e=e.asType(i)),new t(e,n,r)},t.prototype.assign=function(e){if(e.dtype!==this.dtype)throw new Error("dtype of the new value ("+e.dtype+") and previous value ("+this.dtype+") must match");if(!_(e.shape,this.shape))throw new Error("shape of the new value ("+e.shape+") and previous value ("+this.shape+") must match");Z().disposeTensor(this),this.dataId=e.dataId,Z().registerTensor(this)},t.nextVarId=0,t}(ee);Object.defineProperty(te,Symbol.hasInstance,{value:function(e){return e instanceof ee&&null!=e.assign&&e.assign instanceof Function}});var ne=te.variable;function re(e,t){p(e.dtype===t.dtype,"The dtypes of the first("+e.dtype+") and second("+t.dtype+") input must match")}function ie(e){var t=[];return function e(t,n,r){if(null!=t)if(t instanceof ee)n.push(t);else if(function(e){return Array.isArray(e)||"object"==typeof e}(t)){var i=t;for(var o in i){var a=i[o];r.has(a)||(r.add(a),e(a,n,r))}}}(e,t,new Set),t}var oe,ae=function(){function e(e,t,n){this.backend=e,this.safeMode=t,this.debugMode=n,this.registeredVariables={},this.refCounter=new WeakMap,this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numDataBuffers=0,this.profiling=!1,this.gradientScopeCount=0,this.customGradientDepth=0,this.keepTensors=new Set,this.activeScope={track:[],name:"default scope"},this.scopeStack=[this.activeScope],this.profiler=new U(e),this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null}}return e.prototype.tidy=function(e,t,n){var r=this;void 0===n&&(n=!1);var i,o=null;if(null==t){if("function"!=typeof e)throw new Error("Please provide a function to tidy()");t=e}else{if("string"!=typeof e&&!(e instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if("function"!=typeof t)throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");o=e}return this.scopedRun(function(){return r.startScope(o,n)},function(){return r.endScope(i,n)},function(){return(i=t())instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),i})},e.prototype.scopedRun=function(e,t,n){e();try{var r=n();return t(),r}catch(e){throw t(),e}},e.prototype.runKernel=function(e,t,n){var r,i=this,o=[],a=function(e){return o.push(e),e},s=this.activeScope.name,u=this.numBytes,c=this.numTensors;if(this.scopedRun(function(){return i.customGradientDepth++},function(){return i.customGradientDepth--},function(){r=i.debugMode()?i.profiler.profileKernel(s,function(){return e(i.backend,a)}):e(i.backend,a)}),this.shouldRecord()){var l={id:this.nextTapeNodeId++,name:s,inputs:t,outputs:Array.isArray(r)?r:[r]};null!=n&&(l.gradient=function(e){return n(e,o)}),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(t).map(function(e){return t[e].shape}),outputShape:Array.isArray(r)?r.map(function(e){return e.shape}):r.shape}),r},e.prototype.registerTensor=function(e){var t=this.refCounter.has(e.dataId)?this.refCounter.get(e.dataId):0;this.numTensors++,0===t&&(this.numDataBuffers++,"complex64"!==e.dtype&&(this.numBytes+=v(e.shape)*P(e.dtype)),this.backend.register(e.dataId,e.shape,e.dtype)),this.refCounter.set(e.dataId,t+1),e instanceof te||this.track(e)},e.prototype.registerVariable=function(e){if(null!=this.registeredVariables[e.name])throw new Error("Variable with name "+e.name+" was already registered");this.registeredVariables[e.name]=e},e.prototype.disposeTensor=function(e){if(this.refCounter.has(e.dataId)){this.keepTensors.has(e.id)&&this.keepTensors.delete(e.id),this.numTensors--;var t=this.refCounter.get(e.dataId);t<=1?(this.refCounter.delete(e.dataId),this.backend.disposeData(e.dataId),this.numDataBuffers--,"complex64"!==e.dtype&&(this.numBytes-=v(e.shape)*P(e.dtype))):this.refCounter.set(e.dataId,t-1)}},e.prototype.disposeVariables=function(){for(var e in this.registeredVariables){var t=this.registeredVariables[e];this.disposeTensor(t),delete this.registeredVariables[e]}},e.prototype.memory=function(){var e=this.backend.memory();return e.numTensors=this.numTensors,e.numDataBuffers=this.numDataBuffers,e.numBytes=this.numBytes,e},e.prototype.profile=function(e){return c(this,void 0,void 0,function(){var t,n;return l(this,function(r){return this.profiling=!0,t=this.numBytes,n=this.numTensors,this.activeProfile.kernels=[],this.activeProfile.result=e(),this.profiling=!1,this.activeProfile.peakBytes=Math.max.apply(Math,this.activeProfile.kernels.map(function(e){return e.totalBytesSnapshot})),this.activeProfile.newBytes=this.numBytes-t,this.activeProfile.newTensors=this.numTensors-n,[2,this.activeProfile]})})},e.prototype.shouldRecord=function(){return null!=this.activeTape&&0===this.customGradientDepth},e.prototype.addTapeNode=function(e,t,n){var r={};e.forEach(function(e,t){r[t]=e});var i={id:this.nextTapeNodeId++,name:this.activeScope.name,inputs:r,outputs:[t],gradient:function(e){var t={};return n(e).forEach(function(e,n){t[n]=function(){return e}}),t}};this.activeTape.push(i)},e.prototype.keep=function(e){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(e.id),e},e.prototype.startScope=function(e,t){void 0===t&&(t=!1),t&&0===this.gradientScopeCount&&(this.activeTape=[]),t&&this.gradientScopeCount++;var n={track:[],name:"unnamed scope"};e&&(n.name=e),this.scopeStack.push(n),this.activeScope=n},e.prototype.endScope=function(e,t){var n=this;void 0===t&&(t=!1),t&&(this.gradientScopeCount--,0===this.gradientScopeCount&&(this.activeTape=null));var r=new Set(this.keepTensors),i=ie(e);i.forEach(function(e){return r.add(e.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?{track:[],name:"default scope"}:this.scopeStack[this.scopeStack.length-1],i.forEach(function(e){!n.keepTensors.has(e.id)&&function(e,t){for(var n=0;n<t.length;n++)if(t[n].id===e.id)return!0;return!1}(e,s.track)&&n.track(e)})},e.prototype.gradients=function(e,t,n,r){var i=this;return void 0===r&&(r=!1),p(t.length>0,"gradients() received an empty list of xs."),this.tidy("gradients",function(){var o=e();p(o instanceof ee,"The result y returned by f() must be a tensor.");var a=function(e,t,n){for(var r={},i={},o=0;o<t.length;o++)r[t[o].id]=!0;for(o=0;o<e.length;o++){var a=(p=e[o]).inputs;for(var s in a){for(var u=a[s],c=!1,l=0;l<t.length;l++)if(r[u.id]){p.outputs.forEach(function(e){return r[e.id]=!0}),c=!0,i[p.id]=!0;break}if(c)break}}var h={};h[n.id]=!0;var d={};for(o=e.length-1;o>=0;o--)for(a=(p=e[o]).inputs,l=0;l<p.outputs.length;l++)if(h[p.outputs[l].id]){for(var s in a)h[a[s].id]=!0,d[p.id]=!0;break}var f=[];for(o=0;o<e.length;o++){var p;if(i[(p=e[o]).id]&&d[p.id]){var m={};for(var s in p.inputs){var g=p.inputs[s];r[g.id]&&(m[s]=g)}var b=Object.assign({},p);b.inputs=m,b.outputs=p.outputs,f.push(b)}}return f}(i.activeTape,t,o);if(!r&&0===a.length&&t.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");var s={};return s[o.id]=null==n?function(e){var t=j(v(e),"float32");return ee.make(e,{values:t})}(o.shape):n,function(e,t){for(var n=function(n){var r=t[n],i=[];if(r.outputs.forEach(function(t){var n=e[t.id];if(null!=n)i.push(n);else{var r=ee.make(t.shape,{values:F(t.size,t.dtype)},t.dtype);i.push(r)}}),null==r.gradient)throw new Error("Cannot compute gradient: gradient function not found for "+r.name+".");var o=r.gradient(1===r.outputs.length?i[0]:i);for(var a in r.inputs){if(!(a in o))throw new Error("Cannot backprop through input "+a+". Available gradients found: "+Object.keys(o)+".");var s=o[a](),u=r.inputs[a];if(!_(s.shape,u.shape))throw new Error("Error in gradient for op "+r.name+". The gradient of input '"+a+"' has shape '"+s.shape+"', which does not match the shape of the input '"+u.shape+"'");if(null==e[u.id])e[u.id]=s;else{var c=e[u.id];e[u.id]=c.add(s),c.dispose()}}},r=t.length-1;r>=0;r--)n(r)}(s,a),{value:o,grads:t.map(function(e){return s[e.id]})}},!0)},e.prototype.customGrad=function(e){var t=this;return p(R(e),"The f passed in customGrad(f) must be a function."),function(){for(var n,r,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return p(i.every(function(e){return e instanceof ee}),"The args passed in customGrad(f)(x1, x2,...) must all be tensors"),t.scopedRun(function(){return t.customGradientDepth++},function(){return t.customGradientDepth--},function(){r=t.tidy(e.name,function(){var t=e.apply(void 0,i),r=t.value,o=t.gradFunc;return p(r instanceof ee,"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),p(R(o),"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),n=o,r},!0)}),t.shouldRecord()&&t.addTapeNode(i,r,function(e){var t=n(e),r=Array.isArray(t)?t:[t];return p(r.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(...)."),p(r.every(function(e){return e instanceof ee}),"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors."),r}),r}},e.prototype.write=function(e,t){this.backend.write(e,t)},e.prototype.readSync=function(e){return this.backend.readSync(e)},e.prototype.read=function(e){return this.backend.read(e)},e.prototype.fromPixels=function(e,t){return this.backend.fromPixels(e,t)},e.prototype.time=function(e){return c(this,void 0,void 0,function(){var t,n;return l(this,function(r){switch(r.label){case 0:return t=z(),[4,this.backend.time(e)];case 1:return(n=r.sent()).wallMs=z()-t,[2,n]}})})},e.prototype.track=function(e){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 this.activeScope.track.push(e),e},e}();!function(e){e[e.NUMBER=0]="NUMBER",e[e.BOOLEAN=1]="BOOLEAN",e[e.STRING=2]="STRING"}(oe||(oe={}));var se=[{name:"DEBUG",type:oe.BOOLEAN},{name:"IS_BROWSER",type:oe.BOOLEAN},{name:"WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",type:oe.NUMBER},{name:"WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",type:oe.BOOLEAN},{name:"WEBGL_VERSION",type:oe.NUMBER},{name:"WEBGL_RENDER_FLOAT32_ENABLED",type:oe.BOOLEAN},{name:"WEBGL_DOWNLOAD_FLOAT_ENABLED",type:oe.BOOLEAN},{name:"WEBGL_FENCE_API_ENABLED",type:oe.BOOLEAN},{name:"BACKEND",type:oe.STRING},{name:"EPSILON",type:oe.NUMBER}];function ue(e,t){var n;try{n=de(e,t)}catch(e){return!1}return null!=n&&(fe(n),!0)}var ce="tfjsflags";function le(){var e={};if("undefined"==typeof window||void 0===window.location)return e;var t=function(e){var t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return function(e,t,n){e[decodeURIComponent(t)]=decodeURIComponent(n||"")}(t,n[0],n[1]),n.join("=")}),t}(window.location.search);if(ce in t){var n={};t[ce].split(",").forEach(function(e){var t=e.split(":"),r=t[0],i=t[1];n[r]=i}),se.forEach(function(t){t.name in n&&(console.log("Setting feature override from URL "+t.name+": "+n[t.name]),t.type===oe.NUMBER?e[t.name]=+n[t.name]:t.type===oe.BOOLEAN?e[t.name]="true"===n[t.name]:t.type===oe.STRING?e[t.name]=n[t.name]:console.warn("Unknown URL param: "+t.name+"."))})}return e}function he(e,t){return null!=e.getExtension(t)}function de(e,t){if(0===e||!t)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");var n=document.createElement("canvas");return 1===e?n.getContext("webgl")||n.getContext("experimental-webgl"):n.getContext("webgl2")}function fe(e){if(null!=e){var t=e.getExtension("WEBGL_lose_context");if(null==t)throw new Error("Extension WEBGL_lose_context not supported on this browser.");t.loseContext()}}function pe(e,t){var n=e.createFramebuffer(),r=e.createTexture();e.bindTexture(e.TEXTURE_2D,r);var i=2===t?e.RGBA32F:e.RGBA;e.texImage2D(e.TEXTURE_2D,0,i,1,1,0,e.RGBA,e.FLOAT,null),e.bindFramebuffer(e.FRAMEBUFFER,n),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0);var o=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(r),e.deleteFramebuffer(n),o}var me=function(){function t(e){this.features={},this.engines={},this.registry={},null!=e&&(this.features=e),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.")}return t.setBackend=function(e,t){if(void 0===t&&(t=!1),!(e in ge.registry))throw new Error("Backend name '"+e+"' not found in registry");ge.initBackend(e,t)},t.getBackend=function(){return ge.initDefaultBackend(),ge.backendName},t.disposeVariables=function(){ge.engine.disposeVariables()},t.memory=function(){return ge.engine.memory()},t.profile=function(e){return ge.engine.profile(e)},t.tidy=function(e,t,n){return void 0===n&&(n=!1),ge.engine.tidy(e,t,n)},t.dispose=function(e){ie(e).forEach(function(e){return e.dispose()})},t.keep=function(e){return ge.engine.keep(e)},t.time=function(e){return ge.engine.time(e)},t.prototype.get=function(e){return e in this.features?this.features[e]:(this.features[e]=this.evaluateFeature(e),this.features[e])},t.prototype.getFeatures=function(){return this.features},t.prototype.set=function(e,t){this.features[e]=t},t.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(e,t){return t.entry.priority-e.entry.priority})[0].name},t.prototype.evaluateFeature=function(t){if("DEBUG"===t)return!1;if("IS_BROWSER"===t)return"undefined"!=typeof window;if("IS_NODE"===t)return void 0!==e&&void 0!==e.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("IS_TEST"===t)return!1;if("BACKEND"===t)return this.getBestBackendName();if("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"===t){var n=this.get("WEBGL_VERSION");return 0===n?0:n>0?0:function(e,t){if(0===e)return 0;var n,r=de(e,t);return n=he(r,"EXT_disjoint_timer_query_webgl2")&&2===e?2:he(r,"EXT_disjoint_timer_query")?1:0,null!=r&&fe(r),n}(n,this.get("IS_BROWSER"))}if("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE"===t)return this.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&!function(){var e=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(e)||/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(e.substr(0,4))}();if("HAS_WEBGL"===t)return this.get("WEBGL_VERSION")>0;if("WEBGL_VERSION"===t)return ue(2,this.get("IS_BROWSER"))?2:ue(1,this.get("IS_BROWSER"))?1:0;if("WEBGL_RENDER_FLOAT32_ENABLED"===t)return function(e,t){if(0===e)return!1;var n=de(e,t);if(1===e){if(!he(n,"OES_texture_float"))return!1}else if(!he(n,"EXT_color_buffer_float"))return!1;var r=pe(n,e);return fe(n),r}(this.get("WEBGL_VERSION"),this.get("IS_BROWSER"));if("WEBGL_DOWNLOAD_FLOAT_ENABLED"===t)return function(e,t){if(0===e)return!1;var n=de(e,t);if(1===e){if(!he(n,"OES_texture_float"))return!1;if(!he(n,"WEBGL_color_buffer_float"))return!1}else if(!he(n,"EXT_color_buffer_float"))return!1;var r=pe(n,e);return fe(n),r}(this.get("WEBGL_VERSION"),this.get("IS_BROWSER"));if("WEBGL_FENCE_API_ENABLED"===t)return function(e,t){if(2!==e)return!1;var n=de(e,t),r=null!=n.fenceSync;return fe(n),r}(this.get("WEBGL_VERSION"),this.get("IS_BROWSER"));if("TEST_EPSILON"===t)return 32===this.backend.floatPrecision()?.001:.1;if("EPSILON"===t)return 32===this.backend.floatPrecision()?1e-7:.001;throw new Error("Unknown feature "+t+".")},t.prototype.setFeatures=function(e){this.features=Object.assign({},e)},t.prototype.reset=function(){this.features=le(),null!=this.globalEngine&&(this.globalEngine=null)},t.prototype.initBackend=function(e,t){var n=this;if(void 0===t&&(t=!1),this.backendName=e,this.engines[e])this.globalEngine=this.engines[e];else{var r=this.findBackend(e);this.globalEngine=new ae(r,t,function(){return n.get("DEBUG")}),this.engines[e]=this.globalEngine}},Object.defineProperty(t.prototype,"backend",{get:function(){return this.engine.backend},enumerable:!0,configurable:!0}),t.prototype.findBackend=function(e){return e in this.registry?this.registry[e].backend:null},t.prototype.registerBackend=function(e,t,n,r){var i=this;if(void 0===n&&(n=1),e in this.registry)return console.warn(e+" backend was already registered. Reusing existing backend"),null!=r&&r(function(){return i.engine}),!1;try{var o=t();return this.registry[e]={backend:o,priority:n},!0}catch(t){return console.warn("Registration of backend "+e+" failed"),console.warn(t.stack||t.message),!1}},t.prototype.removeBackend=function(e){if(!(e in this.registry))throw new Error(e+" backend not found in registry");this.registry[e].backend.dispose(),delete this.registry[e],e in this.engines&&delete this.engines[e]},Object.defineProperty(t.prototype,"engine",{get:function(){return this.initDefaultBackend(),this.globalEngine},enumerable:!0,configurable:!0}),t.prototype.initDefaultBackend=function(){null==this.globalEngine&&this.initBackend(this.get("BACKEND"),!1)},t}();var ge=function(){var t=function(){var t;if("undefined"!=typeof window)t=window;else{if(void 0===e)throw new Error("Could not find a global object");t=e}return t}();return null==t.ENV&&(t.ENV=new me(le()),Q(function(){return t.ENV.engine})),t.ENV}(),be=Object.freeze({Environment:me,ENV:ge});function ye(e){return p(R(e),"The f passed in grad(f) must be a function"),function(t,n){return p(t instanceof ee,"The x passed in grad(f)(x) must be a tensor"),p(null==n||n instanceof ee,"The dy passed in grad(f)(x, dy) must be a tensor"),ge.engine.tidy(function(){var r=ge.engine.gradients(function(){return e(t)},[t],n),i=r.value,o=r.grads;return null!=n&&m(i.shape,n.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),Se(o),o[0]})}}function ve(e){return p(R(e),"The f passed in grads(f) must be a function"),function(t,n){return p(Array.isArray(t)&&t.every(function(e){return e instanceof ee}),"The args passed in grads(f)(args) must be an array of tensors"),p(null==n||n instanceof ee,"The dy passed in grads(f)(args, dy) must be a tensor"),ge.engine.tidy(function(){var r=ge.engine.gradients(function(){return e.apply(void 0,t)},t,n),i=r.value,o=r.grads;return null!=n&&m(i.shape,n.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Se(o),o})}}function _e(e){return p(R(e),"The f passed in valueAndGrad(f) must be a function"),function(t,n){p(t instanceof ee,"The x passed in valueAndGrad(f)(x) must be a tensor"),p(null==n||n instanceof ee,"The dy passed in valueAndGrad(f)(x, dy) must be a tensor");var r=ge.engine.gradients(function(){return e(t)},[t],n),i=r.grads,o=r.value;return Se(i),{grad:i[0],value:o}}}function we(e){return p(R(e),"The f passed in valueAndGrads(f) must be a function"),function(t,n){p(Array.isArray(t)&&t.every(function(e){return e instanceof ee}),"The args passed in valueAndGrads(f)(args) must be array of tensors"),p(null==n||n instanceof ee,"The dy passed in valueAndGrads(f)(args, dy) must be a tensor");var r=ge.engine.gradients(function(){return e.apply(void 0,t)},t,n);return null!=n&&m(r.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),Se(r.grads),r}}function xe(e,t){if(p(R(e),"The f passed in variableGrads(f) must be a function"),p(null==t||Array.isArray(t)&&t.every(function(e){return e instanceof te}),"The varList passed in variableGrads(f, varList) must be an array of variables"),null==t)for(var n in t=[],ge.engine.registeredVariables)t.push(ge.engine.registeredVariables[n]);var r=t.length;p((t=t.filter(function(e){return e.trainable})).length>0,"variableGrads() expects at least one of the input variables to be trainable, but none of the "+r+" variables is trainable.");var i=ge.engine.gradients(e,t,null,!0),o=i.value,a=i.grads;p(a.some(function(e){return null!=e}),"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()."),p(0===o.rank,"The f passed in variableGrads(f) must return a scalar, but it returned a rank-"+o.rank+" tensor");var s={};return t.forEach(function(e,t){null!=a[t]&&(s[e.name]=a[t])}),{value:o,grads:s}}function Ee(e){return ge.engine.customGrad(e)}function Se(e){if(e.filter(function(e){return null==e}).length>0)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=me.tidy,Oe=me.keep,Ae=me.dispose,Me=me.time,Ne=me.profile;function ke(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];ge.get("IS_TEST")||console.warn.apply(console,e)}function Ie(e,t,n,r){void 0===r&&(r=!0);var i=[];if(r)(i=i.concat(t.slice(0))).push(e[0]/n),i=i.concat(e.slice(1));else{i=i.concat(e[0]);for(var o=t.length,a=0;a<o;++a)i=i.concat([e[a+1]/t[a],t[a]]);i=i.concat(e.slice(o+1))}return i}function Te(e,t,n){void 0===n&&(n=!0);var r=[];if(n){r.push(t);for(var i=t+1;i<e;++i)i<=2*t?(r.push(i),r.push(i-(t+1))):r.push(i)}else{var o=[],a=[];for(i=1;i<e;++i)i>=2*t+1||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 Pe(e,t,n,r){void 0===r&&(r=!0);var i=[];r?i.push(e[0]/n):i.push(e[0]*n);for(var o=1;o<e.length;++o)o<=t.length?r?i.push(t[o-1]*e[o]):i.push(e[o]/t[o-1]):i.push(e[o]);return i}function Re(e,t){for(var n=[0],r=0;r<t;++r)n.push(e[r][0]);return n}function De(e,t,n){for(var r=e.slice(0,1),i=0;i<n;++i)r.push(e[i+1]-t[i][0]-t[i][1]);return r}function Le(e,t){for(var n=0;n<e.length;++n)if(e[e.length-n-1]!==t-1-n)return!1;return!0}function Be(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 je(e,t){return function(e,t,n){for(var r=e.length+t.length,i=[],o=0,a=0,s=0;s<r;s++)-1===n.indexOf(s)?i.push(e[o++]):i.push(t[a++]);return i}(e,t.map(function(e){return 1}),t)}function Fe(e,t){var n=t.length;return p((e=null==e?t.map(function(e,t){return t}):[].concat(e)).every(function(e){return e>=-n&&e<n}),"All values in axis param must be in range [-"+n+", "+n+") but got axis "+e),p(e.every(function(e){return w(e)}),"All values in axis param must be integers but got axis "+e),e.map(function(e){return e<0?n+e:e})}function ze(e,t,n){p(Le(t,n),e+" supports only inner-most axes for now. Got axes "+t+" and rank-"+n+" input.")}function Ve(e,t){if(Le(e,t))return null;for(var n=[],r=0;r<t;++r)-1===e.indexOf(r)&&n.push(r);return e.forEach(function(e){return n.push(e)}),n}function Ue(e){return e.map(function(e,t){return[t,e]}).sort(function(e,t){return e[1]-t[1]}).map(function(e){return e[0]})}function We(e,t){for(var n=[],r=t-e;r<t;++r)n.push(r);return n}function $e(e,t){for(var n=e[0].slice(),r=1;r<e.length;r++)n[t]+=e[r][t];return n}var qe=30;function He(e){return e<=qe?e:D(e,Math.floor(Math.sqrt(e)))}function Ge(e,t,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");for(var c=[],l=[],h=[],d=0;d<e.length;d++)c[d]=Ke(i,t,r,e,d),l[d]=Ye(o,n,r,e,d),u&1<<d&&(l[d]=c[d]+1,h.push(d));var f=new Array(e.length).fill(0);return f=f.map(function(e,t){for(var n=0,i=c[t];!(r[t]>0?i>=l[t]:i<=l[t]);i+=r[t])n+=1;return n}),[c,f,h]}function Ke(e,t,n,r,i){var o=t[i];e&1<<i&&(o=n[i]>0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);var a=r[i];return o<0&&(o+=a),d(0,o,a-1)}function Ye(e,t,n,r,i){var o=t[i];e&1<<i&&(o=n[i]>0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);var a=r[i];return o<0&&(o+=a),n[i]>0?d(0,o,a):d(-1,o,a-1)}function Xe(e,t,n,r){if(void 0===r&&(r="float32"),r=r||"float32",e instanceof ee)return e;if(!T(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e)throw new Error("Argument '"+t+"' passed to '"+n+"' must be a Tensor or TensorLike, but got "+e.constructor.name);var i=y(e);return T(e)||Array.isArray(e)||(e=[e]),ee.make(i,{values:B(e,r,ge.get("DEBUG"))},r)}function Ze(e,t,n){if(!Array.isArray(e))throw new Error("Argument "+t+" passed to "+n+" must be a `Tensor[]` or `TensorLike[]`");return e.map(function(e,r){return Xe(e,t+"["+r+"]",n)})}function Je(e){var t=Object.keys(e);if(1!==t.length)throw new Error("Please provide an object with a single key (operation name) mapping to a function. Got an object with "+t.length+" keys.");var n=t[0],r=e[n];n.endsWith("_")&&(n=n.substring(0,n.length-1));var i=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];ge.engine.startScope(n);try{var i=r.apply(void 0,e);return i instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),ge.engine.endScope(i),i}catch(e){throw ge.engine.endScope(null),e}};return Object.defineProperty(i,"name",{value:n,configurable:!0}),i}var Qe=Je({softmax_:function(e,t){void 0===t&&(t=-1);var n=Xe(e,"logits","softmax");if(-1===t&&(t=n.rank-1),t!==n.rank-1)throw Error("Softmax along a non-last dimension is not yet supported. Logits was rank "+n.rank+" and dim was "+t);return Ee(function(e){var n=e.logSumExp([t],!0),r=e.toFloat().sub(n).exp();return{value:r,gradFunc:function(e){var n=e.mul(r);return n.sub(n.sum([t],!0).mul(r))}}})(n)}});var et=Je({complex_:function(e,t){var n=Xe(e,"real","complex"),r=Xe(t,"imag","complex");return m(n.shape,r.shape,"real and imag shapes, "+n.shape+" and "+r.shape+", must match in call to tf.complex()."),ge.engine.runKernel(function(e){return e.complex(n,r)},{$real:n,$imag:r})}}),tt=Je({real_:function(e){var t=Xe(e,"input","real");return ge.engine.runKernel(function(e){return e.real(t)},{$input:t})}}),nt=Je({imag_:function(e){var t=Xe(e,"input","imag");return ge.engine.runKernel(function(e){return e.imag(t)},{$input:t})}});function rt(e,t,n){if(void 0===n&&(n="float32"),"complex64"===n)throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!T(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e)throw new Error("values passed to tensor(values) must be an array of numbers or booleans, or a TypedArray");var r=y(e);return null!=t&&1!==r.length&&m(t,r,"Error creating a new Tensor. Inferred shape ("+r+") does not match the provided shape ("+t+"). "),T(e)||Array.isArray(e)||(e=[e]),t=t||r,ee.make(t,{values:B(e,n,ge.get("DEBUG"))},n)}function it(e,t){if(void 0===t&&(t="float32"),(T(e)||Array.isArray(e))&&"complex64"!==t)throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean)");return rt(e,[],t)}function ot(e,t){void 0===t&&(t="float32"),g(e);var n=y(e);if(1!==n.length)throw new Error("tensor1d() requires values to be a flat/TypedArray");return rt(e,n,t)}function at(e,t,n){if(void 0===n&&(n="float32"),g(e),null!=t&&2!==t.length)throw new Error("tensor2d() requires shape to have two numbers");var r=y(e);if(2!==r.length&&1!==r.length)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return rt(e,t=t||r,n)}function st(e,t,n){if(void 0===n&&(n="float32"),g(e),null!=t&&3!==t.length)throw new Error("tensor3d() requires shape to have three numbers");var r=y(e);if(3!==r.length&&1!==r.length)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return rt(e,t=t||r,n)}function ut(e,t,n){if(void 0===n&&(n="float32"),g(e),null!=t&&4!==t.length)throw new Error("tensor4d() requires shape to have four numbers");var r=y(e);if(4!==r.length&&1!==r.length)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return rt(e,t=t||r,n)}function ct(e,t,n){if(void 0===n&&(n="float32"),g(e),null!=t&&5!==t.length)throw new Error("tensor5d() requires shape to have five numbers");var r=y(e);if(5!==r.length&&1!==r.length)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return rt(e,t=t||r,n)}function lt(e,t,n){if(void 0===n&&(n="float32"),g(e),null!=t&&6!==t.length)throw new Error("tensor6d() requires shape to have six numbers");var r=y(e);if(6!==r.length&&1!==r.length)throw new Error("tensor6d() requires values to be number[][][][] or flat/TypedArray");if(1===r.length&&null==t)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return rt(e,t=t||r,n)}function ht(e,t){if(void 0===t&&(t="float32"),"complex64"===t){var n=ht(e,"float32"),r=ht(e,"float32");return et(n,r)}var i=j(v(e),t);return ee.make(e,{values:i},t)}function dt(e,t){if(void 0===t&&(t="float32"),"complex64"===t){var n=dt(e,"float32"),r=dt(e,"float32");return et(n,r)}var i=F(v(e),t);return ee.make(e,{values:i},t)}function ft(e,t,n){void 0===n&&(n="float32");var r=M(n,v(e));return r.fill(t),ee.make(e,{values:r},n)}function pt(e,t,n){if(0===n)throw new Error("Cannot request zero samples");var r=(t-e)/(n-1),i=F(n,"float32");i[0]=e;for(var o=1;o<i.length;o++)i[o]=i[o-1]+r;return ot(i,"float32")}function mt(e,t,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(e===t||e<t&&n<0||t<e&&n>1)return dt([0],r);var i=F(Math.abs(Math.ceil((t-e)/n)),r);t<e&&1===n&&(n=-1),i[0]=e;for(var o=1;o<i.length;o++)i[o]=i[o-1]+n;return ot(i,r)}var gt,bt,yt,vt,_t,wt,xt=Je({onesLike_:function(e){var t=Xe(e,"x","onesLike");return ht(t.shape,t.dtype)}}),Et=Je({zerosLike_:function(e){var t=Xe(e,"x","zerosLike");return dt(t.shape,t.dtype)}});!function(e){e.float32="float32",e.int32="int32",e.bool="bool"}(gt||(gt={})),function(e){e.R0="R0",e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.R5="R5",e.R6="R6"}(bt||(bt={})),function(e){e.float32="float32",e.int32="int32",e.bool="int32",e.complex64="complex64"}(yt||(yt={})),function(e){e.float32="float32",e.int32="int32",e.bool="bool",e.complex64="complex64"}(vt||(vt={})),function(e){e.float32="float32",e.int32="float32",e.bool="float32",e.complex64="complex64"}(_t||(_t={})),function(e){e.float32="complex64",e.int32="complex64",e.bool="complex64",e.complex64="complex64"}(wt||(wt={}));var St={float32:_t,int32:yt,bool:vt,complex64:wt};function Ct(e,t){return St[e][t]}function Ot(e){return Ct(e,"int32")}function At(e,t,n){if("complex64"===t){if("complex64"===e.dtype)return e.clone();var r=dt(e.shape),i=e.toFloat(),o=n.complex(i,r);return r.dispose(),i.dispose(),o}if(!I(e.dtype,t))return ee.make(e.shape,{dataId:e.dataId},t);if("complex64"===e.dtype){var a=n.real(e);return o=a.cast(t),a.dispose(),o}if("int32"===t)return n.int(e);if("bool"===t){var s=it(0,e.dtype);return o=n.notEqual(e,s),s.dispose(),o}throw new Error("Error in Cast: unknown dtype argument ("+t+")")}function Mt(e,t){return ee.make(t,{dataId:e.dataId},e.dtype)}function Nt(e,t){if(e.length!==t.length)throw new Error("Cannot merge real and imag arrays of different lengths. real:"+e.length+", imag: "+t.length+".");for(var n=new Float32Array(2*e.length),r=0;r<n.length;r+=2)n[r]=e[r/2],n[r+1]=t[r/2];return n}function kt(e,t,n,r,i){for(var o=Array.from(t).map(function(e,t){return{score:e,boxIndex:t}}).filter(function(e){return e.score>i}).sort(function(e,t){return t.score-e.score}),a=[],s=0;s<o.length;s++){var u=o[s],c=u.score,l=u.boxIndex;if(c<i)break;for(var h=!1,d=a.length-1;d>=0;--d)if(It(e,l,a[d])>=r){h=!0;break}if(!h&&(a.push(l),a.length>=n))break}return ot(a,"int32")}function It(e,t,n){var r=e.subarray(4*t,4*t+4),i=e.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]),h=Math.max(i[0],i[2]),d=Math.max(i[1],i[3]),f=(s-o)*(u-a),p=(h-c)*(d-l);if(f<=0||p<=0)return 0;var m=Math.max(o,c),g=Math.max(a,l),b=Math.min(s,h),y=Math.min(u,d),v=Math.max(b-m,0)*Math.max(y-g,0);return v/(f+p-v)}function Tt(e,t,n){var r=Array(e.rank).fill(0),i=e.shape.slice();return t.map(function(t){i[n]=t;var o=e.slice(r,i);return r[n]+=t,o})}function Pt(e,t,n,r,i){for(var o=t[t.length-1],a=[e.length/o,o],s=a[0],u=a[1],c=M(n,s*r),l=M("int32",s*r),h=0;h<s;h++){for(var d=h*u,f=e.subarray(d,d+u),p=[],m=0;m<f.length;m++)p.push({value:f[m],index:m});p.sort(function(e,t){return t.value-e.value});var g=h*r,b=c.subarray(g,g+r),y=l.subarray(g,g+r);for(m=0;m<r;m++)b[m]=p[m].value,y[m]=p[m].index}var v=t.slice();return v[v.length-1]=r,[rt(c,v,n),rt(l,v,"int32")]}var Rt=function(e,t,n){this.variableNames=["A"];var r=e.windowSize,i=e.batchSize,o=e.inSize,a=Math.ceil(o/r);n||this.variableNames.push("bestIndicesA"),this.outputShape=[i,a];var s="max"===t?">":"<",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 = 0;\n        float bestValue = getA(batch, inOffset);\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    "},Dt=function(e){this.variableNames=["dy"],this.outputShape=e.inShape;var t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,i=e.strideWidth,o=t-1-e.padInfo.top,a=n-1-e.padInfo.left,s=1/(t*n);this.userCode="\n      const ivec2 pads = ivec2("+o+", "+a+");\n      const float avgMultiplier = float("+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 < "+t+"; wR++) {\n          float dyR = float(dyRCorner + wR) / "+r+".0;\n\n          if (dyR < 0.0 || dyR >= "+e.outHeight+".0 || fract(dyR) > 0.0) {\n            continue;\n          }\n          int idyR = int(dyR);\n\n          for (int wC = 0; wC < "+n+"; wC++) {\n            float dyC = float(dyCCorner + wC) / "+i+".0;\n\n            if (dyC < 0.0 || dyC >= "+e.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 Lt(e,t){for(var n=e.length,r=[],i=0;i<n;i++){var o=n-1-i,a=e[o]||1;(t[t.length-1-i]||1)>1&&1===a&&r.unshift(o)}return r}function Bt(e,t){for(var n=[],r=0;r<t.length;r++){var i=e[e.length-r-1],o=t.length-r-1,a=t[o];(null==i||1===i&&a>1)&&n.unshift(o)}return n}function jt(e,t){for(var n=[],r=Math.max(e.length,t.length),i=0;i<r;i++){var o=e[e.length-i-1];null==o&&(o=1);var a=t[t.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 "+e+" and "+t+".");n.unshift(o)}}return n}var Ft=function(e,t,n,r,i,o){this.outputShape=[],this.supportsBroadcasting=!0,this.variableNames=["x","mean","variance"],jt(e,t),jt(e,n);var a="0.0";null!=r&&(jt(e,r),this.variableNames.push("offset"),a="getOffsetAtOutCoords()");var s="1.0";null!=i&&(jt(e,i),this.variableNames.push("scale"),s="getScaleAtOutCoords()"),this.outputShape=e,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((x - mean) * inv + offset);\n      }\n    "},zt="return areal * breal - aimag * bimag;",Vt="return areal * bimag + aimag * breal;",Ut=function(e,t,n){this.variableNames=["AReal","AImag","BReal","BImag"],this.supportsBroadcasting=!0,this.outputShape=jt(t,n),this.userCode="\n      float binaryOpComplex(\n          float areal, float aimag, float breal, float bimag) {\n        "+e+"\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    "},Wt="return a + b;",$t="return a - b;",qt=function(){function e(e,t,n){this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.outputShape=jt(t,n),this.userCode="\n      uniform float NAN;\n      float binaryOperation(float a, float b) {\n        "+e+"\n      }\n\n      void main() {\n        float a = getAAtOutCoords();\n        float b = getBAtOutCoords();\n        setOutput(binaryOperation(a, b));\n      }\n    "}return e.prototype.getCustomSetupFunc=function(){var e=this;return function(t,n){null==e.startLoc&&(e.startLoc=t.getUniformLocationNoThrow(n,"NAN"),null==e.startLoc)||t.gl.uniform1f(e.startLoc,NaN)}},e}(),Ht=function(e,t,n){this.variableNames=["A"],this.outputShape=e,this.userCode="\n      void main() {\n        float value = getAAtOutCoords();\n        if (isNaN(value)) {\n          setOutput(value);\n          return;\n        }\n\n        setOutput(clamp(value, float("+t+"), float("+n+")));\n      }\n    "},Gt=function(e,t){this.variableNames=["A","B"],this.outputShape=[],this.outputShape=$e([e,t],1),this.userCode="\n      void main() {\n        ivec2 coords = getOutputCoords();\n        int yR = coords.x;\n        int yC = coords.y;\n\n        float value = 0.0;\n        if (yC < "+e[1]+") {\n          value = getA(yR, yC);\n        } else {\n          yC -= "+e[1]+";\n          value = getB(yR, yC);\n        }\n\n        setOutput(value);\n      }\n    "},Kt=function(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;var t=e.strideHeight,n=e.strideWidth,r=e.padInfo.top,i=e.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 < "+e.batchSize+"; b++) {\n          for (int yR = 0; yR < "+e.outHeight+"; yR++) {\n            int xR = wR + yR * "+t+" - "+r+";\n\n            if (xR < 0 || xR >= "+e.inHeight+") {\n              continue;\n            }\n\n            for (int yC = 0; yC < "+e.outWidth+"; yC++) {\n              int xC = wC + yC * "+n+" - "+i+";\n\n              if (xC < 0 || xC >= "+e.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    "},Yt=function(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;var t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,i=e.strideWidth,o=t-1-e.padInfo.top,a=n-1-e.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 < "+t+"; wR++) {\n          float dyR = float(dyRCorner + wR) / "+r+".0;\n\n          if (dyR < 0.0 || dyR >= "+e.outHeight+".0 || fract(dyR) > 0.0) {\n            continue;\n          }\n          int idyR = int(dyR);\n\n          int wRPerm = "+t+" - 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 >= "+e.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 < "+e.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    "},Xt=function(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;var t=e.strideHeight,n=e.strideWidth,r=e.padInfo.top,i=e.padInfo.left,o=e.outChannels/e.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 < "+e.batchSize+"; b++) {\n          for (int yR = 0; yR < "+e.outHeight+"; yR++) {\n            int xR = wR + yR * "+t+" - "+r+";\n\n            if (xR < 0 || xR >= "+e.inHeight+") {\n              continue;\n            }\n\n            for (int yC = 0; yC < "+e.outWidth+"; yC++) {\n              int xC = wC + yC * "+n+" - "+i+";\n\n              if (xC < 0 || xC >= "+e.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    "},Zt=function(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;var t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,i=e.strideWidth,o=t-1-e.padInfo.top,a=n-1-e.padInfo.left,s=e.outChannels/e.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 < "+t+"; wR++) {\n          float dyR = float(dyRCorner + wR) / "+r+".0;\n\n          if (dyR < 0.0 || dyR >= "+e.outHeight+".0 || fract(dyR) > 0.0) {\n            continue;\n          }\n          int idyR = int(dyR);\n\n          int wRPerm = "+t+" - 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 >= "+e.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    "},Jt=function(e){this.variableNames=["x","W"],this.outputShape=e.outShape;var t=e.padInfo.top,n=e.padInfo.left,r=e.strideHeight,i=e.strideWidth,o=e.dilationHeight,a=e.dilationWidth,s=e.filterHeight,u=e.filterWidth,c=4*Math.floor(e.inChannels/4),l=e.inChannels%4;this.userCode="\n      const ivec2 strides = ivec2("+r+", "+i+");\n      const ivec2 pads = ivec2("+t+", "+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 >= "+e.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 >= "+e.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    "},Qt=function(e){this.variableNames=["x","W"],this.outputShape=e.outShape;var t=e.inHeight,n=e.inWidth,r=e.padInfo.top,i=e.padInfo.left,o=e.strideHeight,a=e.strideWidth,s=e.dilationHeight,u=e.dilationWidth,c=e.filterHeight,l=e.filterWidth,h=e.outChannels/e.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 / "+h+";\n        int q = d2 - d1 * "+h+";\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 >= "+t+") {\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    "},en=function(e,t,n,r,i){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];var o=e[0],a=e[1],s=e[2],u=e[3],c=t[0],l=n[0],h=n[1];this.outputShape=[c,l,h,u];var d="bilinear"===r?1:0,f=[a-1+".0",s-1+".0"],p=f[0],m=f[1],g=l>1?[""+(a-1)/(l-1),"(y2-y1) * height_ratio","y1*"+p+" + float(y)*(height_scale)"]:["0.0","0.0","0.5 * (y1+y2) * "+p],b=g[0],y=g[1],v=g[2],_=h>1?[""+(s-1)/(h-1),"(x2-x1) * width_ratio","x1*"+m+" + float(x)*(width_scale)"]:["0.0","0.0","0.5 * (x1+x2) * "+m],w=_[0],x=_[1],E=_[2];this.userCode="\n      const float height_ratio = float("+b+");\n      const float width_ratio = float("+w+");\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 = "+y+";\n        float width_scale = "+x+";\n\n        float in_y = "+v+";\n        if( in_y < 0.0 || in_y > "+p+" ) {\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("+d+" == 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 tn(e,t,n,r){var i=e.map(function(e){var t=v(e.shapeInfo.logicalShape);return e.shapeInfo.isUniform?"uniform float "+e.name+(t>1?"["+t+"]":"")+";":"uniform sampler2D "+e.name+";"});i=i.join("\n");var o,a=e.map(function(e){return function(e,t,n){var r=function(e){var t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1)+"Flat",r=v(e.shapeInfo.logicalShape);if(e.shapeInfo.isUniform)return 1===r?"float "+n+"(int index) {return "+t+";}":"\n      float "+n+"(int index) {\n        for (int i = 0; i < "+r+"; i++) {\n          if (i == index) {\n            return "+t+"[i];\n          }\n        }\n      }\n    ";var i=e.shapeInfo.texShape,o=i[0],a=i[1];return 1===a&&1===o?"\n      float "+n+"(int index) {\n        return sampleTexture("+t+", halfCR);\n      }\n    ":1===a?"\n      float "+n+"(int index) {\n        vec2 uv = vec2(0.5, (float(index) + 0.5) / "+o+".0);\n        return sampleTexture("+t+", uv);\n      }\n    ":1===o?"\n      float "+n+"(int index) {\n        vec2 uv = vec2((float(index) + 0.5) / "+a+".0, 0.5);\n        return sampleTexture("+t+", uv);\n      }\n    ":"\n    float "+n+"(int index) {\n      vec2 uv = UVfrom1D("+o+", "+a+", index);\n      return sampleTexture("+t+", uv);\n    }\n  "}(e);return r+=nn(e),(n||_(e.shapeInfo.logicalShape,t.logicalShape))&&(r+=function(e,t,n){var r=e.name,i=r.charAt(0).toUpperCase()+r.slice(1),o="get"+i+"AtOutCoords",a=Lt(e.shapeInfo.logicalShape,t.logicalShape),s=e.shapeInfo.logicalShape.length,u=t.logicalShape.length,c=n&&(u>s||a.length>0),l=function(e){for(var t=0;t<e.length;t++)if(e[t]!==t)return!1;return!0}(a),h=e.shapeInfo.isUniform;if(c&&!l)return function(e,t,n,r){var i=e.shapeInfo.logicalShape.length,o=t.logicalShape.length,a="int";2===o?a="ivec2":3===o?a="ivec3":4===o&&(a="ivec4");var s=Lt(e.shapeInfo.logicalShape,t.logicalShape),u=o-i;return"\n    float "+r+"() {\n      "+a+" coords = getOutputCoords();\n      "+(0===i?"":o<2&&s.length>=1?"coords = 0;":s.map(function(e){return"coords["+(e+u)+"] = 0;"}).join("\n"))+"\n      return get"+n+"("+(o<2&&i>0?"coords":e.shapeInfo.logicalShape.map(function(e,t){return"coords["+(t+u)+"]"}).join(", "))+");\n    }\n  "}(e,t,i,o);var d=v(e.shapeInfo.logicalShape),f="";c&&l&&(f="\n        int mainPart = index / "+d+";\n        index -= mainPart * "+d+";\n      ");var p=t.texShape;if(h)return 1===d?"float "+o+"() {return "+r+";}":"\n      float "+o+"() {\n        ivec2 resTexRC = ivec2(resultUV.yx *\n                              vec2("+p[0]+", "+p[1]+"));\n        int index = resTexRC.x * "+p[1]+" + resTexRC.y;\n        "+f+"\n        return get"+i+"Flat(index);\n      }\n    ";var m=e.shapeInfo.texShape;return _(m,p)?"\n      float "+o+"() {\n        return sampleTexture("+r+", resultUV);\n      }\n    ":"\n    float "+o+"() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2("+p[0]+", "+p[1]+"));\n      int index = resTexRC.x * "+p[1]+" + resTexRC.y;\n      "+f+"\n      int texR = index / "+m[1]+";\n      int texC = index - texR * "+m[1]+";\n      vec2 uv = (vec2(texC, texR) + halfCR) /\n                 vec2("+m[1]+".0, "+m[0]+".0);\n\n      return sampleTexture("+r+", uv);\n    }\n  "}(e,t,n)),r}(e,t,r)}).join("\n"),s=t.texShape;return o=t.isPacked?function(e,t){switch(e.length){case 0:return"\n    int getOutputCoords() {\n      return 0;\n    }\n  ";case 2:return function(e,t){return"\n    ivec2 getOutputCoords() {\n      return 2 * ivec2(resultUV.yx * vec2("+Math.ceil(t[0]/2)+", "+Math.ceil(t[1]/2)+"));\n    }\n  "}(0,t);default:throw new Error(e.length+"-D output packed sampling is not yet supported")}}(t.logicalShape,s):function(e,t){switch(e.length){case 0:return"\n    int getOutputCoords() {\n      return 0;\n    }\n  ";case 1:return function(e,t){return 1===t[0]?"\n      int getOutputCoords() {\n        return int(resultUV.x * "+t[1]+".0);\n      }\n    ":1===t[1]?"\n      int getOutputCoords() {\n        return int(resultUV.y * "+t[0]+".0);\n      }\n    ":"\n    int getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2("+t[0]+", "+t[1]+"));\n      return resTexRC.x * "+t[1]+" + resTexRC.y;\n    }\n  "}(0,t);case 2:return function(e,t){return _(e,t)?"\n      ivec2 getOutputCoords() {\n        return ivec2(resultUV.yx * vec2("+t[0]+", "+t[1]+"));\n      }\n    ":1===e[1]?"\n      ivec2 getOutputCoords() {\n        ivec2 resTexRC = ivec2(resultUV.yx *\n                               vec2("+t[0]+", "+t[1]+"));\n        int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n        return ivec2(index, 0);\n      }\n    ":1===e[0]?"\n      ivec2 getOutputCoords() {\n        ivec2 resTexRC = ivec2(resultUV.yx *\n                               vec2("+t[0]+", "+t[1]+"));\n        int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n        return ivec2(0, index);\n      }\n    ":"\n    ivec2 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2("+t[0]+", "+t[1]+"));\n      int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n      int r = index / "+e[1]+";\n      int c = index - r * "+e[1]+";\n      return ivec2(r, c);\n    }\n  "}(e,t);case 3:return function(e,t){var n=e[1]*e[2],r=e[2];return"\n    ivec3 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n                             vec2("+t[0]+", "+t[1]+"));\n      int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n      int r = index / "+n+";\n      index -= r * "+n+";\n      int c = index / "+r+";\n      int d = index - c * "+r+";\n      return ivec3(r, c, d);\n    }\n  "}(e,t);case 4:return function(e,t){var n=e[3],r=e[2]*n,i=e[1]*r;return"\n    ivec4 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n        vec2("+t[0]+", "+t[1]+"));\n      int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n\n      int r = index / "+i+";\n      index -= r * "+i+";\n\n      int c = index / "+r+";\n      index -= c * "+r+";\n\n      int d = index / "+n+";\n      int d2 = index - d * "+n+";\n\n      return ivec4(r, c, d, d2);\n    }\n  "}(e,t);case 5:return function(e,t){var n=e[4],r=e[3]*n,i=e[2]*r,o=e[1]*i;return"\n    ivec5 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx * vec2("+t[0]+",\n                             "+t[1]+"));\n\n      int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n\n      int r = index / "+o+";\n      index -= r * "+o+";\n\n      int c = index / "+i+";\n      index -= c * "+i+";\n\n      int d = index / "+r+";\n      index -= d * "+r+";\n\n      int d2 = index  / "+n+";\n      int d3 = index - d2 * "+n+";\n\n      ivec5 outShape = ivec5(r, c, d, d2, d3);\n      return outShape;\n    }\n  "}(e,t);case 6:return function(e,t){var n=e[5],r=e[4]*n,i=e[3]*r,o=e[2]*i,a=e[1]*o;return"\n    ivec6 getOutputCoords() {\n      ivec2 resTexRC = ivec2(resultUV.yx *\n        vec2("+t[0]+", "+t[1]+"));\n      int index = resTexRC.x * "+t[1]+" + resTexRC.y;\n\n      int r = index / "+a+";\n      index -= r * "+a+";\n\n      int c = index / "+o+";\n      index -= c * "+o+";\n\n      int d = index / "+i+";\n      index -= d * "+i+";\n\n      int d2 = index / "+r+";\n      index -= d2 * "+r+";\n\n      int d3 = index / "+n+";\n      int d4 = index - d3 * "+n+";\n\n      ivec6 result = ivec6(r, c, d, d2, d3, d4);\n      return result;\n    }\n  "}(e,t);default:throw new Error(e.length+"-D output sampling is not yet supported")}}(t.logicalShape,s),[an,rn,on,i,o,a,n].join("\n")}function nn(e){var t=e.shapeInfo.logicalShape;switch(t.length){case 0:return function(e){var t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1);return e.shapeInfo.isUniform?"float "+n+"() {return "+t+";}":"\n    float "+n+"() {\n      return sampleTexture("+t+", halfCR);\n    }\n  "}(e);case 1:return function(e){var t=e.name,n="get"+t.charAt(0).toUpperCase()+t.slice(1);return"\n    float "+n+"(int index) {\n      return "+n+"Flat(index);\n    }\n  "}(e);case 2:return function(e){var t=e.shapeInfo.logicalShape,n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),i=e.shapeInfo.texShape;if(null!=i&&_(t,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=A(t),s=a.newShape,u=a.keptDims,c=s;if(c.length<t.length)return"\n      "+nn(un(e,c))+"\n      float "+r+"(int row, int col) {\n        return "+r+"("+cn(["row","col"],u)+");\n      }\n    ";if(e.shapeInfo.isUniform)return"\n      float "+r+"(int row, int col) {\n        int index = row * "+t[1]+" + col;\n        return "+r+"Flat(index);\n      }\n    ";var l=i[0],h=i[1];return 1===h?"\n    float "+r+"(int row, int col) {\n      int index = row * "+t[1]+" + col;\n      vec2 uv = vec2(0.5, (float(index) + 0.5) / "+l+".0);\n      return sampleTexture("+n+", uv);\n    }\n  ":1===l?"\n    float "+r+"(int row, int col) {\n      int index = row * "+t[1]+" + col;\n      vec2 uv = vec2((float(index) + 0.5) / "+h+".0, 0.5);\n      return sampleTexture("+n+", uv);\n    }\n  ":"\n  float "+r+"(int row, int col) {\n    vec2 uv = UVfrom2D("+l+", "+h+", "+t[1]+", row, col);\n    return sampleTexture("+n+", uv);\n  }\n"}(e);case 3:return function(e){var t=e.shapeInfo.logicalShape,n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),i=t[1]*t[2],o=t[2],a=A(t),s=a.newShape,u=a.keptDims,c=s;if(c.length<t.length)return"\n        "+nn(un(e,c))+"\n        float "+r+"(int row, int col, int depth) {\n          return "+r+"("+cn(["row","col","depth"],u)+");\n        }\n      ";if(e.shapeInfo.isUniform)return"\n      float "+r+"(int row, int col, int depth) {\n        int index = row * "+i+" + col * "+o+" + depth;\n        return "+r+"Flat(index);\n      }\n    ";var l=e.shapeInfo.texShape,h=l[0],d=l[1];return d===i?"\n        float "+r+"(int row, int col, int depth) {\n          int texR = row;\n          int texC = col * "+o+" + depth;\n          vec2 uv = (vec2(texC, texR) + halfCR) /\n                     vec2("+d+".0, "+h+".0);\n          return sampleTexture("+n+", uv);\n        }\n      ":d===o?"\n    float "+r+"(int row, int col, int depth) {\n      int texR = row * "+t[1]+" + col;\n      int texC = depth;\n      vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+d+".0, "+h+".0);\n      return sampleTexture("+n+", uv);\n    }\n  ":"\n      float "+r+"(int row, int col, int depth) {\n        vec2 uv = UVfrom3D(\n            "+h+", "+d+", "+i+", "+o+", row, col, depth);\n        return sampleTexture("+n+", uv);\n      }\n  "}(e);case 4:return function(e){var t=e.shapeInfo.logicalShape,n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),i=t[3],o=t[2]*i,a=t[1]*o,s=A(t),u=s.newShape,c=s.keptDims;if(u.length<t.length)return"\n      "+nn(un(e,u))+"\n      float "+r+"(int row, int col, int depth, int depth2) {\n        return "+r+"("+cn(["row","col","depth","depth2"],c)+");\n      }\n    ";if(e.shapeInfo.isUniform)return"\n      float "+r+"(int row, int col, int depth, int depth2) {\n        int index = row * "+a+" + col * "+o+" +\n            depth * "+i+" + depth2;\n        return "+r+"Flat(index);\n      }\n    ";var l=e.shapeInfo.texShape,h=l[0],d=l[1];return d===a?"\n      float "+r+"(int row, int col, int depth, int depth2) {\n        int texR = row;\n        int texC = col * "+o+" + depth * "+i+" + depth2;\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                   vec2("+d+".0, "+h+".0);\n        return sampleTexture("+n+", uv);\n      }\n    ":d===i?"\n      float "+r+"(int row, int col, int depth, int depth2) {\n        int texR = row * "+t[1]*t[2]+" + col * "+t[2]+" + depth;\n        int texC = depth2;\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                  vec2("+d+".0, "+h+".0);\n        return sampleTexture("+n+", uv);\n      }\n    ":"\n    float "+r+"(int row, int col, int depth, int depth2) {\n      vec2 uv = UVfrom4D("+h+", "+d+", "+a+", "+o+",\n          "+i+", row, col, depth, depth2);\n      return sampleTexture("+n+", uv);\n    }\n  "}(e);case 5:return function(e){var t=e.shapeInfo.logicalShape,n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),i=t[4],o=t[3]*i,a=t[2]*o,s=t[1]*a,u=A(t),c=u.newShape,l=u.keptDims;if(c.length<t.length)return"\n      "+nn(un(e,c))+"\n      float "+r+"(int row, int col, int depth, int depth2, int depth3) {\n        return "+r+"("+cn(["row","col","depth","depth2","depth3"],l)+");\n      }\n    ";if(e.shapeInfo.isUniform)return"\n      float "+r+"(int row, int col, int depth, int depth2, int depth3) {\n        int index = row * "+s+" + col * "+a+" +\n            depth * "+o+" + depth2 * "+i+" + depth3;\n        return "+r+"Flat(index);\n      }\n    ";var h=e.shapeInfo.texShape,d=h[0],f=h[1];return f===s?"\n      float "+r+"(int row, int col, int depth, int depth2, int depth3) {\n        int texR = row;\n        int texC = col * "+a+" + depth * "+o+" +\n                   depth2 * "+i+" + depth3;\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                   vec2("+f+".0, "+d+".0);\n        return sampleTexture("+n+", uv);\n      }\n    ":f===i?"\n      float "+r+"(int row, int col, int depth, int depth2, int depth3) {\n        int texR = row * "+t[1]*t[2]+" + col * "+t[2]+" +\n                   depth * "+t[3]+" + depth2;\n        int texC = depth3;\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                  vec2("+f+".0, "+d+".0);\n        return sampleTexture("+n+", uv);\n      }\n    ":"\n    float "+r+"(int row, int col, int depth, int depth2, int depth3) {\n      vec2 uv = UVfrom5D("+d+", "+f+", "+s+", "+a+",\n          "+o+", "+i+", row, col, depth, depth2, depth3);\n      return sampleTexture("+n+", uv);\n    }\n  "}(e);case 6:return function(e){var t=e.shapeInfo.logicalShape,n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),i=t[5],o=t[4]*i,a=t[3]*o,s=t[2]*a,u=t[1]*s,c=A(t),l=c.newShape,h=c.keptDims;if(l.length<t.length)return"\n      "+nn(un(e,l))+"\n      float "+r+"(int row, int col, int depth,\n                    int depth2, int depth3, int depth4) {\n        return "+r+"("+cn(["row","col","depth","depth2","depth3","depth4"],h)+");\n      }\n    ";if(e.shapeInfo.isUniform)return"\n      float "+r+"(int row, int col, int depth,\n                  int depth2, int depth3, int depth4) {\n        int index = row * "+u+" + col * "+s+" +\n            depth * "+a+" + depth2 * "+o+" + depth3 * "+o+"\n            + depth4\n        return "+r+"Flat(index);\n      }\n    ";var d=e.shapeInfo.texShape,f=d[0],p=d[1];return p===u?"\n      float "+r+"(int row, int col, int depth,\n                    int depth2, int depth3, int depth4) {\n        int texR = row;\n        int texC = col * "+s+" + depth * "+a+" + depth2;\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                   vec2("+p+".0, "+f+".0);\n        return sampleTexture("+n+", uv);\n      }\n    ":p===i?"\n      float "+r+"(int row, int col, int depth,\n                    int depth2, int depth3, int depth4) {\n        int texR = row * "+t[1]*t[2]+" + col * "+t[2]+" + depth;\n        int texC = depth4;\n        vec2 uv = (vec2(texC, texR) + halfCR) /\n                  vec2("+p+".0, "+f+".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      vec2 uv = UVfrom6D("+f+", "+p+", "+u+", "+s+",\n          "+a+", "+o+", "+i+"\n          ,row, col, depth, depth2, depth3, depth4);\n      return sampleTexture("+n+", uv);\n    }\n  "}(e);default:throw new Error(t.length+"-D input sampling is not yet supported")}}var rn="\n  float sampleTexture(sampler2D textureSampler, vec2 uv) {\n    return texture2D(textureSampler, uv).r;\n  }\n",on="\n  void setOutput(float val) {\n    gl_FragColor = vec4(val, 0, 0, 0);\n  }\n",an="\n  precision highp float;\n  precision highp int;\n  varying vec2 resultUV;\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  bool isNaN(float val) {\n    return (val < 0.0 || 0.0 < val || val == 0.0) ? false : true;\n  }\n\n  bool hasNaN(vec4 values) {\n    vec4 v1 = values * values;\n    vec4 v2 = values * values;\n    return any(notEqual(v1, v2));\n  }\n\n  float getNaN(vec4 values) {\n    return dot(vec4(1), values);\n  }\n\n  int round(float value) {\n    return int(floor(value + 0.5));\n  }\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  \nvec2 UVfrom1D(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}\n\n  \nvec2 UVfrom2D(int texNumR, int texNumC, int numC, int row, int col) {\n  int index = row * numC + col;\n  int texR = index / texNumC;\n  int texC = index - texR * texNumC;\n  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n\n  \nvec2 UVfrom3D(int texNumR, int texNumC, int stride0,\n    int stride1, int row, int col, int depth) {\n  // Explicitly use integer operations as dot() only works on floats.\n  int index = row * stride0 + col * stride1 + depth;\n  int texR = index / texNumC;\n  int texC = index - texR * texNumC;\n  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n\n  \nvec2 UVfrom4D(int texNumR, int texNumC, int stride0,\n    int stride1, int stride2, int row, int col, int depth,\n    int depth2) {\n  // Explicitly use integer operations as dot() only works on floats.\n  int index = row * stride0 + col * stride1 + depth * stride2 + depth2;\n  int texR = index / texNumC;\n  int texC = index - texR * texNumC;\n  return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n\n  \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\n  \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\n";function sn(e){if(e<=1)return"int";if(2===e)return"ivec2";if(3===e)return"ivec3";if(4===e)return"ivec4";if(5===e)return"ivec5";if(6===e)return"ivec6";throw Error("GPU for rank "+e+" is not yet supported")}function un(e,t){var n=JSON.parse(JSON.stringify(e));return n.shapeInfo.logicalShape=t,n}function cn(e,t){return t.map(function(t){return e[t]}).join(", ")}var ln=function(e,t,n){this.variableNames=["x"],this.outputShape=e;var r=e.length,i=e[e.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        "+sn(r)+" coords = getOutputCoords();\n        int end = "+hn(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 && "+t+") {\n            continue;\n          }\n          "+hn(r,"coords")+" = idx;\n          val += getX("+function(e,t){if(1===e)return""+t;if(2===e)return t+".x, "+t+".y";if(3===e)return t+".x, "+t+".y, "+t+".z";if(4===e)return t+".x, "+t+".y, "+t+".z, "+t+".w";throw Error("Cumulative sum for rank "+e+" is not yet supported")}(r,"coords")+");\n        }\n        setOutput(val);\n      }\n    "};function hn(e,t){if(1===e)return""+t;if(2===e)return t+".y";if(3===e)return t+".z";if(4===e)return t+".w";throw Error("Cumulative sum for rank "+e+" is not yet supported")}var dn,fn,pn=function(){function e(e,t,n){this.variableNames=["x"],this.outputShape=[],this.outputShape=e,this.blockSize=t,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 / "+t+";\n      int offset_h = imod(h, "+t+");\n      int in_w = w / "+t+";\n      int offset_w = imod(w, "+t+");\n      int offset_d = (offset_h * "+t+" + offset_w) *\n        "+this.getOutputDepthSize()+";\n      int in_d = d + offset_d;\n\n      float result = "+this.getInputSamplingString()+";\n      setOutput(result);\n    }\n  "}return e.prototype.getHeightCoordString=function(){return"NHWC"===this.dataFormat?"coords[1]":"coords[2]"},e.prototype.getWidthCoordString=function(){return"NHWC"===this.dataFormat?"coords[2]":"coords[3]"},e.prototype.getDepthCoordString=function(){return"NHWC"===this.dataFormat?"coords[3]":"coords[1]"},e.prototype.getOutputDepthSize=function(){return"NHWC"===this.dataFormat?this.outputShape[3]:this.outputShape[1]},e.prototype.getInputSamplingString=function(){return"NHWC"===this.dataFormat?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"},e}(),mn=function(e){this.variableNames=["A"],this.outputShape=e,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        gl_FragColor = encode_float(x);\n      }\n    "},gn=function(e){this.variableNames=["A"];var t=e[0],n=e[1];this.outputShape=e,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("+n+".0, "+t+".0);\n\n        vec4 values = 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    "},bn=function(e,t,n){this.variableNames=["A","indices"];var r=e.slice();r[n]=t,this.outputShape=r,this.rank=r.length;var i=sn(this.rank),o=function(e,t){var n=e.length;if(n>4)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<e.length;o++)o===t?i.push("int(getIndices("+r[o]+"))"):i.push(""+r[o]);return i.join()}(e,n);this.userCode="\n      void main() {\n        "+i+" resRC = getOutputCoords();\n        setOutput(getA("+o+"));\n      }\n    "};function yn(e,t){return[t,e]}function vn(e,t){return e*t}function _n(e,t,n){var r=function(e,t){if(e%t!=0)throw new Error("unpackedSize ("+e+") must be a multiple of "+t);return e/t}(e.length,n);if(t.length<r)throw new Error("matrix length ("+t.length+") must be >= "+r);for(var i=0,o=0;o<e.length;o+=n)t[i++]=e[o]}function wn(e,t){return[Math.ceil(t/2),Math.ceil(e/2)]}function xn(e,t){var n=wn(e,t);return n[0]*n[1]*4}!function(e){e[e.RENDER=0]="RENDER",e[e.UPLOAD=1]="UPLOAD",e[e.PIXELS=2]="PIXELS",e[e.DOWNLOAD=3]="DOWNLOAD",e[e.PACK=4]="PACK"}(dn||(dn={})),function(e){e[e.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",e[e.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",e[e.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",e[e.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32"}(fn||(fn={}));var En=null;function Sn(e){var t=document.createElement("canvas");return t.width=1,t.height=1,Cn(t,e)}function Cn(e,t){var n,r=ge.get("WEBGL_VERSION");if(2===r?n=e.getContext("webgl2",t):1===r&&(n=e.getContext("webgl",t)||e.getContext("experimental-webgl",t)),0===r||null==n)throw new Error("This browser does not support WebGL.");return n}function On(e,t){var n=t();return Nn(e),n}var An=!1;function Mn(e){An=e}function Nn(e){if(An){var t=e.getError();if(t!==e.NO_ERROR)throw new Error("WebGL Error: "+kn(e,t))}}function kn(e,t){switch(t){case e.NO_ERROR:return"NO_ERROR";case e.INVALID_ENUM:return"INVALID_ENUM";case e.INVALID_VALUE:return"INVALID_VALUE";case e.INVALID_OPERATION:return"INVALID_OPERATION";case e.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case e.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case e.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return"Unknown error code "+t}}function In(e,t){return er(e,function(){return e.getExtension(t)},'Extension "'+t+'" not supported on this browser.')}function Tn(e,t){var n=er(e,function(){return e.createShader(e.VERTEX_SHADER)},"Unable to create vertex WebGLShader.");if(On(e,function(){return e.shaderSource(n,t)}),On(e,function(){return e.compileShader(n)}),!1===e.getShaderParameter(n,e.COMPILE_STATUS))throw console.log(e.getShaderInfoLog(n)),new Error("Failed to compile vertex shader.");return n}function Pn(e,t){var n=er(e,function(){return e.createShader(e.FRAGMENT_SHADER)},"Unable to create fragment WebGLShader.");if(On(e,function(){return e.shaderSource(n,t)}),On(e,function(){return e.compileShader(n)}),!1===e.getShaderParameter(n,e.COMPILE_STATUS))throw function(e,t){var n=Rn.exec(t);if(null==n)return console.log("Couldn't parse line number in error: "+t),void console.log(e);for(var r=+n[1],i=e.split("\n"),o=i.length.toString().length+2,a=i.map(function(e,t){return S((t+1).toString(),o)+e}),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),h=a.slice(r);console.log(c.join("\n")),console.log(t.split("\n")[0]),console.log("%c "+S(l[0],s),"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(h.join("\n"))}(t,e.getShaderInfoLog(n)),new Error("Failed to compile fragment shader.");return n}var Rn=/ERROR: [0-9]+:([0-9]+):/g;function Dn(e){return er(e,function(){return e.createProgram()},"Unable to create WebGLProgram.")}function Ln(e,t){if(On(e,function(){return e.linkProgram(t)}),!1===e.getProgramParameter(t,e.LINK_STATUS))throw console.log(e.getProgramInfoLog(t)),new Error("Failed to link vertex and fragment shaders.")}function Bn(e,t){if(On(e,function(){return e.validateProgram(t)}),!1===e.getProgramParameter(t,e.VALIDATE_STATUS))throw console.log(e.getProgramInfoLog(t)),new Error("Shader program validation failed.")}function jn(e,t){var n=er(e,function(){return e.createBuffer()},"Unable to create WebGLBuffer");return On(e,function(){return e.bindBuffer(e.ARRAY_BUFFER,n)}),On(e,function(){return e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW)}),n}function Fn(e,t){var n=er(e,function(){return e.createBuffer()},"Unable to create WebGLBuffer");return On(e,function(){return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n)}),On(e,function(){return e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW)}),n}function zn(e){return null!=En?En:En=On(e,function(){return e.getParameter(e.MAX_TEXTURE_SIZE)})}function Vn(){return 2===ge.get("WEBGL_VERSION")?1:4}function Un(e){return er(e,function(){return e.createTexture()},"Unable to create WebGLTexture.")}function Wn(e,t,n){var r=zn(e);if(t<=0||n<=0){var i="["+t+"x"+n+"]";throw new Error("Requested texture size "+i+" is invalid.")}if(t>r||n>r)throw i="["+t+"x"+n+"]",new Error("Requested texture size "+i+" greater than WebGL maximum on this browser / GPU ["+r+"x"+r+"].")}function $n(e){return er(e,function(){return e.createFramebuffer()},"Unable to create WebGLFramebuffer.")}function qn(e,t,n,r,i,o,a){var s=e.getAttribLocation(t,n);return-1!==s&&(On(e,function(){return e.bindBuffer(e.ARRAY_BUFFER,r)}),On(e,function(){return e.vertexAttribPointer(s,i,e.FLOAT,!1,o,a)}),On(e,function(){return e.enableVertexAttribArray(s)}),!0)}function Hn(e,t,n){tr(e,n),On(e,function(){return e.activeTexture(e.TEXTURE0+n)}),On(e,function(){return e.bindTexture(e.TEXTURE_2D,t)})}function Gn(e,t,n){return er(e,function(){return e.getUniformLocation(t,n)},'uniform "'+n+'" not present in program.')}function Kn(e,t,n){return e.getUniformLocation(t,n)}function Yn(e,t,n,r,i){On(e,function(){return Hn(e,n,i)}),On(e,function(){return e.uniform1i(r,i)})}function Xn(e,t,n){On(e,function(){return e.bindFramebuffer(e.FRAMEBUFFER,n)}),On(e,function(){return e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)})}function Zn(e,t){On(e,function(){return e.bindFramebuffer(e.FRAMEBUFFER,t)}),On(e,function(){return e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0)})}function Jn(e){var t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+Qn(e,t))}function Qn(e,t){switch(t){case e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case e.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return"unknown error "+t}}function er(e,t,n){var r=On(e,function(){return t()});if(null==r)throw new Error(n);return r}function tr(e,t){var n=e.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,r=t+e.TEXTURE0;if(r<e.TEXTURE0||r>n)throw new Error("textureUnit must be in [gl.TEXTURE0, gl.TEXTURE"+n+"].")}function nr(e,t){2!==t.length&&(t=A(t).newShape);var n=zn(e),r=v(t);return t.length<=1&&r<=n?[r,1]:2===t.length&&t[0]<=n&&t[1]<=n?t:3===t.length&&t[0]<=n&&t[1]*t[2]<=n?[t[0],t[1]*t[2]]:4===t.length&&t[0]<=n&&t[1]*t[2]*t[3]<=n?[t[0],t[1]*t[2]*t[3]]:E(r)}var rr=Object.freeze({createWebGLRenderingContext:Sn,createWebGLRenderingContextFromCanvas:Cn,callAndCheck:On,enableDebugWebGLErrorChecking:Mn,checkWebGLError:Nn,getWebGLErrorMessage:kn,getExtensionOrThrow:In,createVertexShader:Tn,createFragmentShader:Pn,createProgram:Dn,linkProgram:Ln,validateProgram:Bn,createStaticVertexBuffer:jn,createStaticIndexBuffer:Fn,queryMaxTextureSize:zn,getNumChannels:Vn,createTexture:Un,validateTextureSize:Wn,createFramebuffer:$n,bindVertexBufferToProgramAttribute:qn,bindTextureUnit:Hn,unbindTextureUnit:function(e,t){tr(e,t),On(e,function(){return e.activeTexture(e.TEXTURE0+t)}),On(e,function(){return e.bindTexture(e.TEXTURE_2D,null)})},getProgramUniformLocationOrThrow:Gn,getProgramUniformLocation:Kn,bindTextureToProgramUniformSampler:Yn,bindCanvasToFramebuffer:function(e){On(e,function(){return e.bindFramebuffer(e.FRAMEBUFFER,null)}),On(e,function(){return e.viewport(0,0,e.canvas.width,e.canvas.height)}),On(e,function(){return e.scissor(0,0,e.canvas.width,e.canvas.height)})},bindColorTextureToFramebuffer:Xn,unbindColorTextureFromFramebuffer:Zn,validateFramebuffer:Jn,getFramebufferErrorMessage:Qn,getTextureShapeFromLogicalShape:nr});function ir(){return{alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0}}function or(e){var t,n={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};return On(t=null!=e?Cn(e,n):Sn(n),function(){return t.disable(t.DEPTH_TEST)}),On(t,function(){return t.disable(t.STENCIL_TEST)}),On(t,function(){return t.disable(t.BLEND)}),On(t,function(){return t.disable(t.DITHER)}),On(t,function(){return t.disable(t.POLYGON_OFFSET_FILL)}),On(t,function(){return t.disable(t.SAMPLE_COVERAGE)}),On(t,function(){return t.enable(t.SCISSOR_TEST)}),On(t,function(){return t.enable(t.CULL_FACE)}),On(t,function(){return t.cullFace(t.BACK)}),t}function ar(e){return Tn(e,"\n    precision highp float;\n    attribute vec3 clipSpacePos;\n    attribute vec2 uv;\n    varying vec2 resultUV;\n\n    void main() {\n      gl_Position = vec4(clipSpacePos, 1);\n      resultUV = uv;\n    }")}function sr(e){return jn(e,new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]))}function ur(e){return Fn(e,new Uint16Array([0,1,2,2,1,3]))}function cr(e,t){var n,r,i,o,a,s,u,c=e;return 2===ge.get("WEBGL_VERSION")?(n=c.R32F,r=c.R16F,i=c.RGBA32F,o=c.RED,a=4,s=1,u=c.HALF_FLOAT):(n=e.RGBA,r=e.RGBA,i=c.RGBA,o=e.RGBA,a=4,s=4,u=null!=t?t.HALF_FLOAT_OES:null),{internalFormatFloat:n,internalFormatHalfFloat:r,internalFormatPackedFloat:i,textureFormatFloat:o,downloadTextureFormat:e.RGBA,downloadUnpackNumChannels:a,defaultNumChannels:s,textureTypeHalfFloat:u}}function lr(e,t,n,r,i,o){Wn(e,t,n);var a=Un(e),s=e.TEXTURE_2D;return On(e,function(){return e.bindTexture(s,a)}),On(e,function(){return e.texParameteri(s,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE)}),On(e,function(){return e.texParameteri(s,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}),On(e,function(){return e.texParameteri(s,e.TEXTURE_MIN_FILTER,e.NEAREST)}),On(e,function(){return e.texParameteri(s,e.TEXTURE_MAG_FILTER,e.NEAREST)}),On(e,function(){return e.texImage2D(s,0,r,t,n,0,i,o,null)}),On(e,function(){return e.bindTexture(e.TEXTURE_2D,null)}),a}function hr(e,t,n,r){var i=yn(t,n);return lr(e,i[0],i[1],r.internalFormatFloat,r.textureFormatFloat,e.FLOAT)}function dr(e,t,n,r){var i=yn(t,n);return lr(e,i[0],i[1],r.internalFormatFloat,r.textureFormatFloat,r.textureTypeHalfFloat)}function fr(e,t,n,r){var i=yn(t,n);return lr(e,i[0],i[1],e.RGBA,e.RGBA,e.UNSIGNED_BYTE)}function pr(e,t,n,r){var i=wn(t,n);return lr(e,i[0],i[1],r.internalFormatPackedFloat,e.RGBA,e.FLOAT)}function mr(e,t,n){return On(e,function(){return e.bindBuffer(e.ARRAY_BUFFER,n)}),qn(e,t,"clipSpacePos",n,3,20,0)&&qn(e,t,"uv",n,2,20,12)}function gr(e,t,n){On(e,function(){return e.bindTexture(e.TEXTURE_2D,t)}),On(e,function(){return e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)}),On(e,function(){return e.bindTexture(e.TEXTURE_2D,null)})}function br(e,t,n,r,i,o){Wn(e,n,r),On(e,function(){return e.bindTexture(e.TEXTURE_2D,t)}),On(e,function(){return e.texSubImage2D(e.TEXTURE_2D,0,0,0,n,r,o,e.FLOAT,i)}),On(e,function(){return e.bindTexture(e.TEXTURE_2D,null)})}function yr(e,t,n,r,i,o,a){var s,u=yn(n,r),c=u[0],l=u[1];1===a.defaultNumChannels?s=i:function(e,t,n){var r=vn(e.length,n);if(t.length<r)throw new Error("unpackedArray length ("+t.length+") must be >= "+r);for(var i=0,o=0;o<e.length;++o)t[i]=e[o],i+=n}(i,s=new Float32Array(vn(i.length,o)),o),br(e,t,c,l,s,a.textureFormatFloat)}function vr(e,t,n,r,i,o){var a=wn(n,r),s=a[0],u=a[1],c=new Float32Array(xn(n,r));(function(e,t,n,r){var i=xn(t,n);if(r.length<i)throw new Error("packedRGBA length ("+r.length+") must be >= "+i);for(var o=wn(t,n),a=o[0],s=o[1],u=n%2==1,c=t%2==1,l=Math.floor(n/2),h=Math.floor(t/2),d=u?4:0,f=n,p=0,m=0;m<h;++m){for(var g=2*m*n,b=0;b<l;++b){var y=g+2*b;r[p]=e[y],r[p+1]=e[y+1],r[p+2]=e[y+f],r[p+3]=e[y+f+1],p+=4}p+=d}if(u){y=n-1,p=4*(a-1);var v=2*n;for(d=4*a,m=0;m<h;++m)r[p]=e[y],r[p+2]=e[y+n],y+=v,p+=d}if(c)for(y=(t-1)*n,p=(s-1)*a*4,b=0;b<l;++b)r[p++]=e[y++],r[p++]=e[y++],p+=2;u&&c&&(r[r.length-4]=e[e.length-1])})(i,n,r,c),br(e,t,s,u,c,e.RGBA)}function _r(e,t,n,r,i){var o=t;if(2===ge.get("WEBGL_VERSION")){var a=e,s=a.createBuffer();On(e,function(){return e.bindBuffer(a.PIXEL_PACK_BUFFER,s)});var u=4*vn(n*r,i.downloadUnpackNumChannels);On(e,function(){return e.bufferData(a.PIXEL_PACK_BUFFER,u,e.STATIC_DRAW)}),On(e,function(){return a.readPixels(0,0,r,n,e.RGBA,e.FLOAT,0)}),On(e,function(){return e.bindBuffer(a.PIXEL_PACK_BUFFER,null)}),o=s}return o}function wr(e,t,n,r,i){var o=e,a=new Float32Array(vn(n*r,i.downloadUnpackNumChannels));o.bindBuffer(e.ARRAY_BUFFER,t),o.getBufferSubData(e.ARRAY_BUFFER,0,a),o.bindBuffer(e.ARRAY_BUFFER,null);var s=new Float32Array(n*r);return _n(a,s,i.downloadUnpackNumChannels),s}function xr(e,t,n,r){var i=yn(t,n),o=i[0],a=i[1],s=new Float32Array(vn(t*n,r.downloadUnpackNumChannels));On(e,function(){return e.readPixels(0,0,o,a,r.downloadTextureFormat,e.FLOAT,s)});var u=new Float32Array(t*n);return _n(s,u,r.downloadUnpackNumChannels),u}function Er(e,t,n,r){var i=yn(t,n),o=i[0],a=i[1],s=new Uint8Array(vn(t*n,4));return On(e,function(){return e.readPixels(0,0,o,a,r.downloadTextureFormat,e.UNSIGNED_BYTE,s)}),new Float32Array(s.buffer)}function Sr(e,t,n,r){var i=wn(t,n),o=i[0],a=i[1],s=new Float32Array(xn(t,n));On(e,function(){return e.readPixels(0,0,o,a,e.RGBA,e.FLOAT,s)});var u=new Float32Array(t*n);return function(e,t,n,r){var i=t*n;if(i<r.length)throw new Error("matrix length ("+r.length+") must be >= "+i);for(var o=n%2==1,a=t%2==1,s=Math.floor(n/2),u=Math.floor(t/2),c=wn(t,n),l=c[0],h=c[1],d=o?4:0,f=n+(o?1:0),p=0,m=0,g=n,b=0;b<u;++b){for(var y=0;y<s;++y)r[m++]=e[p++],r[m++]=e[p++],r[g++]=e[p++],r[g++]=e[p++];p+=d,m+=f,g+=f}if(o){p=4*(l-1);var v=n-1;for(d=4*l,f=2*n,b=0;b<u;++b)r[v]=e[p],r[v+n]=e[p+2],p+=d,v+=f}if(a)for(p=(h-1)*l*4,v=(t-1)*n,y=0;y<s;++y)r[v++]=e[p++],r[v++]=e[p++],p+=2;return o&&a&&(r[r.length-1]=e[e.length-4]),r}(s,t,n,u)}var Cr=Object.freeze({getWebGLContextAttributes:ir,createWebGLContext:or,createVertexShader:ar,createVertexBuffer:sr,createIndexBuffer:ur,getTextureConfig:cr,createFloat32MatrixTexture:hr,createFloat16MatrixTexture:dr,createUnsignedBytesMatrixTexture:fr,createPackedMatrixTexture:pr,bindVertexProgramAttributeStreams:mr,uploadPixelDataToTexture:gr,uploadMatrixToTexture:yr,uploadMatrixToPackedTexture:vr,maybeCreateBufferFromOutputTexture:_r,downloadFloat32MatrixFromBuffer:wr,downloadFloat32MatrixFromOutputTexture:xr,downloadByteEncodedFloatMatrixFromOutputTexture:Er,downloadMatrixFromPackedOutputTexture:Sr}),Or=function(){function e(e){this.outputTexture=null,this.program=null,this.disposed=!1,this.autoDebugValidate=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[],this.gl=null!=e?e:or(),1===ge.get("WEBGL_VERSION")?(this.textureFloatExtension=In(this.gl,"OES_texture_float"),this.colorBufferFloatExtension=this.gl.getExtension("WEBGL_color_buffer_float"),ge.get("WEBGL_RENDER_FLOAT32_ENABLED")||(this.textureHalfFloatExtension=In(this.gl,"OES_texture_half_float"),this.colorBufferHalfFloatExtension=this.gl.getExtension("EXT_color_buffer_half_float"))):this.colorBufferFloatExtension=In(this.gl,"EXT_color_buffer_float"),this.loseContextExtension=In(this.gl,"WEBGL_lose_context"),this.vertexBuffer=sr(this.gl),this.indexBuffer=ur(this.gl),this.framebuffer=$n(this.gl),this.textureConfig=cr(this.gl,this.textureHalfFloatExtension)}return e.prototype.dispose=function(){var e=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 t=this.gl;On(t,function(){return t.finish()}),On(t,function(){return t.bindFramebuffer(t.FRAMEBUFFER,null)}),On(t,function(){return t.deleteFramebuffer(e.framebuffer)}),On(t,function(){return t.bindBuffer(t.ARRAY_BUFFER,null)}),On(t,function(){return t.deleteBuffer(e.vertexBuffer)}),On(t,function(){return t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}),On(t,function(){return t.deleteBuffer(e.indexBuffer)}),this.loseContextExtension.loseContext(),this.disposed=!0}},e.prototype.enableAutomaticDebugValidation=function(e){this.autoDebugValidate=e,Mn(e)},e.prototype.createFloat32MatrixTexture=function(e,t){return this.throwIfDisposed(),hr(this.gl,e,t,this.textureConfig)},e.prototype.createFloat16MatrixTexture=function(e,t){return this.throwIfDisposed(),dr(this.gl,e,t,this.textureConfig)},e.prototype.createUnsignedBytesMatrixTexture=function(e,t){return this.throwIfDisposed(),fr(this.gl,e,t,this.textureConfig)},e.prototype.uploadPixelDataToTexture=function(e,t){this.throwIfDisposed(),gr(this.gl,e,t)},e.prototype.createPackedMatrixTexture=function(e,t){return this.throwIfDisposed(),pr(this.gl,e,t,this.textureConfig)},e.prototype.deleteMatrixTexture=function(e){var t=this;this.throwIfDisposed(),this.outputTexture===e&&(Zn(this.gl,this.framebuffer),this.outputTexture=null),On(this.gl,function(){return t.gl.deleteTexture(e)})},e.prototype.uploadMatrixToTexture=function(e,t,n,r){this.throwIfDisposed();var i=Vn();return yr(this.gl,e,t,n,r,i,this.textureConfig)},e.prototype.uploadMatrixToPackedTexture=function(e,t,n,r){return this.throwIfDisposed(),vr(this.gl,e,t,n,r,this.textureConfig)},e.prototype.downloadFloat32MatrixFromOutputTexture=function(e,t,n){var r=this;return this.downloadMatrixDriver(e,function(){return xr(r.gl,t,n,r.textureConfig)})},e.prototype.downloadByteEncodedFloatMatrixFromOutputTexture=function(e,t,n){var r=this;return this.downloadMatrixDriver(e,function(){return Er(r.gl,t,n,r.textureConfig)})},e.prototype.downloadFloat32MatrixFromBuffer=function(e,t,n){return wr(this.gl,e,t,n,this.textureConfig)},e.prototype.maybeCreateBufferFromTexture=function(e,t,n){this.bindTextureToFrameBuffer(e);var r=_r(this.gl,e,t,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),r},e.prototype.createAndWaitForFence=function(){var e=this.createFence(this.gl);return this.pollFence(e)},e.prototype.createFence=function(e){var t,n,r=this;if(ge.get("WEBGL_FENCE_API_ENABLED")){var i=e,o=i.fenceSync(i.SYNC_GPU_COMMANDS_COMPLETE,0);e.flush(),n=function(){var e=i.clientWaitSync(o,0,0);return e===i.ALREADY_SIGNALED||e===i.CONDITION_SATISFIED},t=o}else ge.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(t=this.beginQuery(),this.endQuery(),n=function(){return r.isQueryAvailable(t,ge.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}):n=function(){return!0};return{query:t,isFencePassed:n}},e.prototype.downloadMatrixFromPackedTexture=function(e,t,n){var r=this;return this.downloadMatrixDriver(e,function(){return Sr(r.gl,t,n,r.textureConfig)})},e.prototype.createProgram=function(e){this.throwIfDisposed();var t=this.gl,n=Pn(t,e),r=ar(t),i=Dn(t);return On(t,function(){return t.attachShader(i,r)}),On(t,function(){return t.attachShader(i,n)}),Ln(t,i),this.autoDebugValidate&&Bn(t,i),this.vertexAttrsAreBound||(this.setProgram(i),this.vertexAttrsAreBound=mr(t,this.program,this.vertexBuffer)),i},e.prototype.deleteProgram=function(e){var t=this;this.throwIfDisposed(),e===this.program&&(this.program=null),null!=e&&On(this.gl,function(){return t.gl.deleteProgram(e)})},e.prototype.setProgram=function(e){var t=this;this.throwIfDisposed(),this.program=e,null!=this.program&&this.autoDebugValidate&&Bn(this.gl,this.program),On(this.gl,function(){return t.gl.useProgram(e)})},e.prototype.getUniformLocation=function(e,t,n){return void 0===n&&(n=!0),this.throwIfDisposed(),n?Gn(this.gl,e,t):Kn(this.gl,e,t)},e.prototype.getAttributeLocation=function(e,t){var n=this;return this.throwIfDisposed(),On(this.gl,function(){return n.gl.getAttribLocation(e,t)})},e.prototype.getUniformLocationNoThrow=function(e,t){return this.throwIfDisposed(),this.gl.getUniformLocation(e,t)},e.prototype.setInputMatrixTexture=function(e,t,n){this.throwIfDisposed(),this.throwIfNoProgram(),Yn(this.gl,this.program,e,t,n)},e.prototype.setOutputMatrixTexture=function(e,t,n){this.setOutputMatrixTextureDriver(e,n,t)},e.prototype.setOutputPackedMatrixTexture=function(e,t,n){this.throwIfDisposed();var r=wn(t,n),i=r[0],o=r[1];this.setOutputMatrixTextureDriver(e,i,o)},e.prototype.setOutputMatrixWriteRegion=function(e,t,n,r){this.setOutputMatrixWriteRegionDriver(n,e,r,t)},e.prototype.setOutputPackedMatrixWriteRegion=function(e,t,n,r){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")},e.prototype.debugValidate=function(){null!=this.program&&Bn(this.gl,this.program),Jn(this.gl)},e.prototype.executeProgram=function(){this.throwIfDisposed(),this.throwIfNoProgram();var e=this.gl;this.autoDebugValidate&&this.debugValidate(),On(e,function(){return e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)})},e.prototype.blockUntilAllProgramsCompleted=function(){var e=this;this.throwIfDisposed(),On(this.gl,function(){return e.gl.finish()})},e.prototype.getQueryTimerExtension=function(){return null==this.disjointQueryTimerExtension&&(this.disjointQueryTimerExtension=In(this.gl,2===ge.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension},e.prototype.getQueryTimerExtensionWebGL2=function(){return this.getQueryTimerExtension()},e.prototype.getQueryTimerExtensionWebGL1=function(){return this.getQueryTimerExtension()},e.prototype.beginQuery=function(){if(2===ge.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var e=this.gl,t=this.getQueryTimerExtensionWebGL2(),n=e.createQuery();return e.beginQuery(t.TIME_ELAPSED_EXT,n),n}var r=this.getQueryTimerExtensionWebGL1(),i=r.createQueryEXT();return r.beginQueryEXT(r.TIME_ELAPSED_EXT,i),i},e.prototype.endQuery=function(){if(2!==ge.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var e=this.getQueryTimerExtensionWebGL1();e.endQueryEXT(e.TIME_ELAPSED_EXT)}else{var t=this.gl,n=this.getQueryTimerExtensionWebGL2();t.endQuery(n.TIME_ELAPSED_EXT)}},e.prototype.waitForQueryAndGetTime=function(e){return c(this,void 0,void 0,function(){var t=this;return l(this,function(n){switch(n.label){case 0:return[4,C(function(){return t.isQueryAvailable(e,ge.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))})];case 1:return n.sent(),[2,this.getQueryTime(e,ge.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))]}})})},e.prototype.getQueryTime=function(e,t){if(0===t)return null;if(2===t){var n=this.gl;return n.getQueryParameter(e,n.QUERY_RESULT)/1e6}var r=this.getQueryTimerExtensionWebGL1();return r.getQueryObjectEXT(e,r.QUERY_RESULT_EXT)/1e6},e.prototype.isQueryAvailable=function(e,t){if(0===t)return!0;if(2===t){var n=this.gl,r=this.getQueryTimerExtensionWebGL2(),i=n.getQueryParameter(e,n.QUERY_RESULT_AVAILABLE);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(r.GPU_DISJOINT_EXT)),i&&!this.disjoint}return i=(r=this.getQueryTimerExtensionWebGL1()).getQueryObjectEXT(e,r.QUERY_RESULT_AVAILABLE_EXT),null==this.disjoint&&(this.disjoint=this.gl.getParameter(r.GPU_DISJOINT_EXT)),i&&!this.disjoint},e.prototype.pollFence=function(e){var t=this;return new Promise(function(n){t.addItemToPoll(function(){return e.isFencePassed()},function(){return n()})})},e.prototype.pollItems=function(){for(var e=function(e){for(var t=0,n=e.length-1,r=-1;t<=n;){var i=t+n>>1;e[i]()?(r=i,t=i+1):n=i-1}return r}(this.itemsToPoll.map(function(e){return e.isDoneFn})),t=0;t<=e;++t)(0,this.itemsToPoll[t].resolveFn)();this.itemsToPoll=this.itemsToPoll.slice(e+1)},e.prototype.addItemToPoll=function(e,t){var n=this;this.itemsToPoll.push({isDoneFn:e,resolveFn:t}),this.itemsToPoll.length>1||C(function(){return n.pollItems(),0===n.itemsToPoll.length})},e.prototype.bindTextureToFrameBuffer=function(e){this.throwIfDisposed(),Xn(this.gl,e,this.framebuffer),this.autoDebugValidate&&Jn(this.gl)},e.prototype.unbindTextureToFrameBuffer=function(){null!=this.outputTexture?(Xn(this.gl,this.outputTexture,this.framebuffer),this.autoDebugValidate&&Jn(this.gl)):Zn(this.gl,this.framebuffer)},e.prototype.downloadMatrixDriver=function(e,t){this.bindTextureToFrameBuffer(e);var n=t();return this.unbindTextureToFrameBuffer(),n},e.prototype.setOutputMatrixTextureDriver=function(e,t,n){this.throwIfDisposed();var r=this.gl;Xn(r,e,this.framebuffer),this.autoDebugValidate&&Jn(r),this.outputTexture=e,On(r,function(){return r.viewport(0,0,t,n)}),On(r,function(){return r.scissor(0,0,t,n)})},e.prototype.setOutputMatrixWriteRegionDriver=function(e,t,n,r){var i=this;this.throwIfDisposed(),On(this.gl,function(){return i.gl.scissor(e,t,n,r)})},e.prototype.throwIfDisposed=function(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")},e.prototype.throwIfNoProgram=function(){if(null==this.program)throw new Error("No GPU program is currently set.")},e}();function Ar(e,t){if(e.length!==t.length)throw Error("Binary was compiled with "+e.length+" inputs, but was executed with "+t.length+" inputs");e.forEach(function(e,n){var r=e.logicalShape,i=t[n],o=i.shape;if(!_(r,o))throw Error("Binary was compiled with different shapes than the current args. Shapes "+r+" and "+o+" must match");if(!e.isUniform||!i.isUniform){var a=e.texShape,s=i.isUniform?null:i.texData.texShape;if(!_(a,s))throw Error("Binary was compiled with different texture shapes than the current args. Shape "+a+" and "+s+" must match")}})}var Mr=function(e,t,n,r,i){this.variableNames=["x"],this.outputShape=[];var o,a=t,s=e[3]-1;this.outputShape=e;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    "},Nr=function(e,t,n,r,i){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=e,this.depth=e[3],this.depthRadius=t,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 - "+t+")));\n          int depthEnd = int(min(float("+this.depth+"),\n              float(d + "+t+" + 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    "},kr=function(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;var t=e.filterHeight,n=e.filterWidth,r=e.strideHeight,i=e.strideWidth,o=t-1-e.padInfo.top,a=n-1-e.padInfo.left,s=t*n-1;this.userCode="\n      const ivec2 pads = ivec2("+o+", "+a+");\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 < "+t+"; wR++) {\n          float dyR = float(dyRCorner + wR) / "+r+".0;\n\n          if (dyR < 0.0 || dyR >= "+e.outHeight+".0 || fract(dyR) > 0.0) {\n            continue;\n          }\n          int idyR = int(dyR);\n\n          for (int wC = 0; wC < "+n+"; wC++) {\n            float dyC = float(dyCCorner + wC) / "+i+".0;\n\n            if (dyC < 0.0 || dyC >= "+e.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 = "+s+" - 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 * "+n+" + wC;\n            float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n            dotProd += dyValue * mask;\n          }\n        }\n        setOutput(dotProd);\n      }\n    "},Ir=function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1),this.variableNames=["matrixA","matrixB"];var i=e[0],o=n?e[2]:e[1],a=r?t[1]:t[2],s=n?e[1]:e[2];this.outputShape=[i,o,a];var u=function(e,t){return n?"batch, "+t+" + "+e+", aRow":"batch, aRow, "+t+" + "+e},c=function(e,t){return r?"batch, bCol, "+t+" + "+e:"batch, "+t+" + "+e+", bCol"},l=4*Math.floor(s/4),h=s%4;this.userCode=" float dotARowBCol(int batch, int aRow, int bCol) {\n      float result = 0.0;\n      for (int i = 0; i < "+l+"; i += 4) {\n        vec4 a = vec4(\n          getMatrixA("+u(0,"i")+"),\n          getMatrixA("+u(1,"i")+"),\n          getMatrixA("+u(2,"i")+"),\n          getMatrixA("+u(3,"i")+")\n        );\n        vec4 b = vec4(\n          getMatrixB("+c(0,"i")+"),\n          getMatrixB("+c(1,"i")+"),\n          getMatrixB("+c(2,"i")+"),\n          getMatrixB("+c(3,"i")+")\n        );\n\n        result += dot(a, b);\n      }\n\n      if ("+(1===h)+") {\n        result += getMatrixA("+u(0,l)+") *\n          getMatrixB("+c(0,l)+");\n      } else if ("+(2===h)+") {\n        vec2 a = vec2(\n          getMatrixA("+u(0,l)+"),\n          getMatrixA("+u(1,l)+")\n        );\n        vec2 b = vec2(\n          getMatrixB("+c(0,l)+"),\n          getMatrixB("+c(1,l)+")\n        );\n        result += dot(a, b);\n      } else if ("+(3===h)+") {\n        vec3 a = vec3(\n          getMatrixA("+u(0,l)+"),\n          getMatrixA("+u(1,l)+"),\n          getMatrixA("+u(2,l)+")\n        );\n        vec3 b = vec3(\n          getMatrixB("+c(0,l)+"),\n          getMatrixB("+c(1,l)+"),\n          getMatrixB("+c(2,l)+")\n        );\n        result += dot(a, b);\n      }\n\n      return result;\n    }\n\n    void main() {\n      ivec3 resBRC = getOutputCoords();\n      setOutput(dotARowBCol(resBRC.x, resBRC.y, resBRC.z));\n    }\n    "},Tr=function(e,t,n,r,i){void 0===r&&(r=!1),void 0===i&&(i=!1),this.variableNames=["matrixA","matrixB"],this.outputShape=n;var o=r?e[0]:e[1],a=Math.ceil(o/2),s=r?"resultUV.t, center":"center, resultUV.t",u=i?"center, resultUV.s":"resultUV.s, center",c=r?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],l=i?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"];this.userCode="\n      const float sharedDimension = "+a+".0;\n\n      vec4 dot2x2ARowBCol() {\n        vec4 result = vec4(0);\n        for (int ii = 0; ii < "+a+"; ii++) {\n          float i = float(ii);\n          float center = (i + 0.5) / sharedDimension;\n          vec4 a = texture2D(matrixA, vec2("+s+"));\n          vec4 b = texture2D(matrixB, vec2("+u+"));\n\n          result += ("+c[0]+" * "+l[0]+") + ("+c[1]+" * "+l[1]+");\n        }\n        return result;\n      }\n\n      void main() {\n        gl_FragColor = dot2x2ARowBCol();\n      }\n    "},Pr=function(){function e(e,t,n){this.variableNames=["probs"],this.outputShape=[e,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 < "+(t-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("+(t-1)+"));\n      }\n    "}return e.prototype.getCustomSetupFunc=function(e){var t=this;return function(n,r){null==t.seedLoc&&(t.seedLoc=n.getUniformLocation(r,"seed")),n.gl.uniform1f(t.seedLoc,e)}},e}(),Rr=function(e,t,n,r){this.variableNames=["indices"],this.outputShape=[e,t],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    "},Dr=function(e){this.variableNames=["A"],this.outputShape=e,this.userCode="\n      void main() {\n        ivec2 rc = getOutputCoords();\n\n        int r = rc.x;\n        int c = rc.y;\n        int rp1 = r + 1;\n        int cp1 = c + 1;\n\n        bool cEdge = cp1 >= "+e[1]+";\n        bool rEdge = rp1 >= "+e[0]+";\n\n        gl_FragColor = vec4(\n            getA(r, c),\n            cEdge ? 0. : getA(r, cp1),\n            rEdge ? 0. : getA(rp1, c),\n            rEdge || cEdge ? 0. : getA(rp1, cp1)\n          );\n      }\n    "},Lr=function(e,t,n){this.variableNames=["x"],this.outputShape=t.map(function(t,n){return t[0]+e[n]+t[1]});var r=e.length,i=sn(r),o=t.map(function(e){return e[0]}).join(","),a=t.map(function(t,n){return t[0]+e[n]}).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("+n+"));\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("+n+"));\n          } else {\n            setOutput(getX(outC - start));\n          }\n        }\n      "},Br=function(e,t,n){if(this.variableNames=["x"],"avg"===t&&n)throw new Error("Cannot compute positions for average pool.");var r=e.filterHeight,i=e.filterWidth,o=e.strideHeight,a=e.strideWidth,s=e.padInfo.top,u=e.padInfo.left;this.outputShape=e.outShape;var c="avg"===t,l="0.0";if(c||(l="-1.0 / 0.0"),n)this.userCode="\n        const ivec2 strides = ivec2("+o+", "+a+");\n        const ivec2 pads = ivec2("+s+", "+u+");\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 < "+r+"; wR++) {\n            int xR = xRCorner + wR;\n\n            if (xR < 0 || xR >= "+e.inHeight+") {\n              continue;\n            }\n\n            for (int wC = 0; wC < "+i+"; wC++) {\n              int xC = xCCorner + wC;\n\n              if (xC < 0 || xC >= "+e.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 * "+i+" + wC;\n              }\n            }\n          }\n          setOutput(float(minMaxPosition));\n        }\n      ";else{var h=t+"("+t+"("+t+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"avg"===t&&(h="avgValue / count");var d=4*Math.floor(i/4),f=i%4,p="\n      if ("+c+") {\n        avgValue += dot(values, ones);\n      } else {\n        minMaxValue = max(values, minMaxValue);\n      }\n    ";this.userCode="\n      const ivec2 strides = ivec2("+o+", "+a+");\n      const ivec2 pads = ivec2("+s+", "+u+");\n      const float initializationValue = "+l+";\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 >= "+e.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("+l+");\n        float avgValue = 0.0;\n        count = 0.0;\n\n        for (int wR = 0; wR < "+r+"; wR++) {\n          int xR = xRCorner + wR;\n\n          if (xR < 0 || xR >= "+e.inHeight+") {\n            continue;\n          }\n\n          for (int wC = 0; wC < "+d+"; wC += 4) {\n            int xC = xCCorner + wC;\n\n            vec4 values = vec4(\n              getValue(batch, xR, xC, d),\n              getValue(batch, xR, xC + 1, d),\n              getValue(batch, xR, xC + 2, d),\n              getValue(batch, xR, xC + 3, d)\n            );\n\n            "+p+"\n          }\n\n          int xC = xCCorner + "+d+";\n          if ("+(1===f)+") {\n            vec4 values = vec4(\n              getValue(batch, xR, xC, d),\n              initializationValue,\n              initializationValue,\n              initializationValue\n            );\n\n            "+p+"\n          } else if ("+(2===f)+") {\n            vec4 values = vec4(\n              getValue(batch, xR, xC, d),\n              getValue(batch, xR, xC + 1, d),\n              initializationValue,\n              initializationValue\n            );\n\n            "+p+"\n          } else if ("+(3===f)+") {\n            vec4 values = vec4(\n              getValue(batch, xR, xC, d),\n              getValue(batch, xR, xC + 1, d),\n              getValue(batch, xR, xC + 2, d),\n              initializationValue\n            );\n\n            "+p+"\n          }\n        }\n        setOutput("+h+");\n      }\n    "}},jr=function(e,t){this.variableNames=["x"];var n=e.windowSize,r=e.batchSize,i=e.inSize,o=Math.ceil(i/n);this.outputShape=[r,o];var a="0.0",s="";"min"===t?(a="1.0 / 0.0",s="min"):"max"===t&&(a="-1.0 / 0.0",s="max");var u=t+"("+t+"("+t+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"sum"===t?u="sumValue":"all"===t?u="allValue":"any"===t&&(u="anyValue");var c=4*Math.floor(n/4),l=n%4,h="\n      if ("+("sum"===t)+") {\n        sumValue += dot(values, ones);\n      } else {\n        minMaxValue = "+s+"(values, minMaxValue);\n      }\n    ",d="vec4";"all"===t?(a="1.0",h="\n        bool reducedAllValue = all(values);\n        float floatedReducedAllValue = float(reducedAllValue);\n        allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);\n      ",d="bvec4"):"any"===t&&(a="0.0",h="\n        bool reducedAnyValue = any(values);\n        float floatedReducedAnyValue = float(reducedAnyValue);\n        anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);\n      ",d="bvec4");var f="";i%n>0&&(f="\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        "+f+"\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 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          "+d+" values = "+d+"(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            getValue(batch, inIdx + 2),\n            getValue(batch, inIdx + 3)\n          );\n\n          "+h+"\n        }\n\n        int inIdx = inOffset + "+c+";\n        if ("+(1===l)+") {\n          "+d+" values = "+d+"(\n            getValue(batch, inIdx),\n            initializationValue,\n            initializationValue,\n            initializationValue\n          );\n\n          "+h+"\n        } else if ("+(2===l)+") {\n          "+d+" values = "+d+"(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            initializationValue,\n            initializationValue\n          );\n\n          "+h+"\n        } else if ("+(3===l)+") {\n          "+d+" values = "+d+"(\n            getValue(batch, inIdx),\n            getValue(batch, inIdx + 1),\n            getValue(batch, inIdx + 2),\n            initializationValue\n          );\n\n          "+h+"\n        }\n        setOutput("+u+");\n      }\n    "},Fr=function(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t.shape;var r=t.shape,i=r[1],o=r[2],a=e.shape,s=a[1],u=a[2],c=[n&&s>1?i-1:i,n&&u>1?o-1:o],l=[n&&s>1?s-1:s,n&&u>1?u-1:u],h=c[0]/l[0],d=c[1]/l[1],f=1/h,p=1/d,m=2*Math.ceil(f)+2,g=2*Math.ceil(p)+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("+h+");\n        const float widthScale = float("+d+");\n\n        const float invHeightScale = float("+f+");\n        const float invWidthScale = float("+p+");\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    "},zr=function(e,t,n,r){this.variableNames=["A"],this.outputShape=[];var i=e[0],o=e[1],a=e[2],s=e[3];this.outputShape=[i,t,n,s];var u=[r&&t>1?o-1:o,r&&n>1?a-1:a],c=[r&&t>1?t-1:t,r&&n>1?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    "},Vr=function(e,t,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t.shape;var r=t.shape,i=r[1],o=r[2],a=e.shape,s=a[1],u=a[2],c=[n&&s>1?i-1:i,n&&u>1?o-1:o],l=[n&&s>1?s-1:s,n&&u>1?u-1:u],h=c[0]/l[0],d=c[1]/l[1],f=1/h,p=1/d,m=2*Math.ceil(f)+2,g=2*Math.ceil(p)+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("+h+");\n        const float widthScale = float("+d+");\n\n        const float invHeightScale = float("+f+");\n        const float invWidthScale = float("+p+");\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    "},Ur=function(e,t,n,r){this.variableNames=["A"],this.outputShape=[];var i=e[0],o=e[1],a=e[2],s=e[3];this.outputShape=[i,t,n,s];var u=[r&&t>1?o-1:o,r&&n>1?a-1:a],c=[r&&t>1?t-1:t,r&&n>1?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    "},Wr=function(e,t){this.variableNames=["x"];var n=e.length;if(n>4)throw new Error("WebGL backend: Reverse of rank-"+n+" tensor is not yet supported");if(this.outputShape=e,1!==n){var r=e.map(function(n,r){return function(n){return-1!==t.indexOf(n)&&1!==e[n]?e[n]+" - coords["+n+"] - 1":"coords["+n+"]"}(r)}).join(","),i=sn(n);this.userCode="\n      void main() {\n        "+i+" coords = getOutputCoords();\n        setOutput(getX("+r+"));\n      }\n    "}else this.userCode="\n        void main() {\n          int coord = getOutputCoords();\n          setOutput(getX("+e[0]+" - coord - 1));\n        }\n      "},$r=function(e,t){this.variableNames=["x","segmentIds"];var n=e.windowSize,r=e.batchSize,i=e.inSize,o=e.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, filter);\n    ",l="";i%n>0&&(l="\n        if (inIdx < 0 || inIdx >= "+i+") {\n          return initializationValue;\n        }\n      ");var h="";i%n>0&&(h="\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        "+h+"\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 filter = 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 filter = 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 filter = 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 filter = 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    "},qr=function(e,t,n){var r,i;if(this.variableNames=["c","a","b"],this.outputShape=t,n>4)throw Error("Where for rank "+n+" is not yet supported");if(1===n)i="resRC",r="resRC";else{for(var o=["resRC.x","resRC.y","resRC.z","resRC.w"],a=[],s=[],u=0;u<t.length;u++)s.push(""+o[u]),u<e&&a.push(""+o[u]);r=a.join(),i=s.join()}var c=sn(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    "},Hr=function(){function e(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;var t=sn(this.rank),n=function(e){if(1===e)return"sourceLoc";if(2===e)return"sourceLoc.x, sourceLoc.y";if(3===e)return"sourceLoc.x, sourceLoc.y, sourceLoc.z";if(4===e)return"sourceLoc.x, sourceLoc.y, sourceLoc.z, sourceLoc.w";throw Error("Slicing for rank "+e+" is not yet supported")}(this.rank);this.userCode="\n      uniform "+t+" start;\n\n      void main() {\n        "+t+" sourceLoc = start + getOutputCoords();\n        setOutput(getSource("+n+"));\n      }\n    "}return e.prototype.getCustomSetupFunc=function(e){var t=this;if(e.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+e.length+")");return function(n,r){if(null!=t.startLoc||(t.startLoc=n.getUniformLocationNoThrow(r,"start"),null!=t.startLoc))if(1===t.rank)n.gl.uniform1i(t.startLoc,e[0]);else if(2===t.rank)n.gl.uniform2i(t.startLoc,e[0],e[1]);else if(3===t.rank)n.gl.uniform3i(t.startLoc,e[0],e[1],e[2]);else{if(4!==t.rank)throw Error("Slicing for rank "+t.rank+" is not yet supported");n.gl.uniform4i(t.startLoc,e[0],e[1],e[2],e[3])}}},e}();var Gr=function(e,t,n,r){this.variableNames=["x"];var i=n.filter(function(e,t){return-1===r.indexOf(t)});this.outputShape=i;var o=n.length,a=sn(n.length),s=sn(i.length),u="";if(1===o)u="coords * strides + begin";else{var c=0;u=n.map(function(e,t){return-1===r.indexOf(t)?(c++,1===i.length?"coords * strides["+t+"] + begin["+t+"]":"coords["+(c-1)+"] * strides["+t+"] + begin["+t+"]"):"begin["+t+"]"}).join(",")}this.userCode="\n      "+a+" begin = "+a+"("+e+");\n      "+a+" strides = "+a+"("+t+");\n\n      void main() {\n        "+s+" coords = getOutputCoords();\n        setOutput(getX("+u+"));\n      }\n    "},Kr=function(){function e(e){this.gpgpu=e,this.numUsedTextures=0,this.numFreeTextures=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}return e.prototype.acquireTexture=function(e,t){var n,r=Yr(t),i=Xr(e,r);if(i in this.freeTextures||(this.freeTextures[i]=[]),i in this.usedTextures||(this.usedTextures[i]=[]),this.freeTextures[i].length>0){this.numFreeTextures--,this.numUsedTextures++,this.log();var o=this.freeTextures[i].shift();return this.usedTextures[i].push(o),o}return this.numUsedTextures++,this.log(),r===fn.PACKED_2X2_FLOAT32?n=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):r===fn.UNPACKED_FLOAT32?n=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):r===fn.UNPACKED_FLOAT16?n=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):r===fn.PACKED_4X1_UNSIGNED_BYTE&&(n=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[i].push(n),n},e.prototype.releaseTexture=function(e,t,n){var r=Xr(t,Yr(n));r in this.freeTextures||(this.freeTextures[r]=[]),this.freeTextures[r].push(e),this.numFreeTextures++,this.numUsedTextures--;var i=this.usedTextures[r],o=i.indexOf(e);if(o<0)throw new Error("Cannot release a texture that was never provided by this texture manager");i.splice(o,1),this.log()},e.prototype.log=function(){if(this.logEnabled){var e=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",this.numFreeTextures+" / "+this.numUsedTextures,"("+e+")")}},e.prototype.getNumUsedTextures=function(){return this.numUsedTextures},e.prototype.getNumFreeTextures=function(){return this.numFreeTextures},e.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}},e}();function Yr(e){if(e===dn.DOWNLOAD||e===dn.PIXELS)return fn.PACKED_4X1_UNSIGNED_BYTE;if(e===dn.UPLOAD)return fn.UNPACKED_FLOAT32;if(e===dn.RENDER)return ge.get("WEBGL_RENDER_FLOAT32_ENABLED")?fn.UNPACKED_FLOAT32:fn.UNPACKED_FLOAT16;if(e===dn.PACK)return fn.PACKED_2X2_FLOAT32;throw new Error("Unknown logical texture type "+e)}function Xr(e,t){return e[0]+"_"+e[1]+"_"+t}var Zr=function(e,t){this.variableNames=["A"];for(var n=new Array(e.length),r=0;r<n.length;r++)n[r]=e[r]*t[r];this.outputShape=n,this.rank=n.length;var i=sn(this.rank),o=function(e){var t=e.length;if(t>5)throw Error("Tile for rank "+t+" is not yet supported");if(1===t)return"imod(resRC, "+e[0]+")";for(var n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],r=[],i=0;i<e.length;i++)r.push("imod("+n[i]+", "+e[i]+")");return r.join()}(e);this.userCode="\n      void main() {\n        "+i+" resRC = getOutputCoords();\n        setOutput(getA("+o+"));\n      }\n    "};var Jr=function(e,t){this.variableNames=["A"];for(var n=new Array(e.length),r=0;r<n.length;r++)n[r]=e[t[r]];this.outputShape=n,this.rank=n.length;var i=sn(this.rank),o=function(e){var t=e.length;if(t>6)throw Error("Transpose for rank "+t+" is not yet supported");for(var n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],r=new Array(t),i=0;i<e.length;i++)r[e[i]]=n[i];return r.join()}(t);this.userCode="\n    void main() {\n      "+i+" resRC = getOutputCoords();\n      setOutput(getA("+o+"));\n    }\n    "};var Qr=1.7580993408473768,ei=1.0507009873554805,ti=function(){function e(e,t){this.variableNames=["A"],this.outputShape=e,this.userCode="\n      uniform float NAN;\n      float unaryOperation(float x) {\n        "+t+"\n      }\n\n      void main() {\n        float x = getAAtOutCoords();\n        float y = unaryOperation(x);\n\n        setOutput(y);\n      }\n    "}return e.prototype.getCustomSetupFunc=function(){var e=this;return function(t,n){null==e.startLoc&&(e.startLoc=t.getUniformLocationNoThrow(n,"NAN"),null==e.startLoc)||t.gl.uniform1f(e.startLoc,NaN)}},e}(),ni="if (isNaN(x)) return x;",ri=ni+"\n  return (x < 0.0) ? 0.0 : x;\n",ii="\n  // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.\n  // see: https://arxiv.org/abs/1706.02515\n  float scaleAlpha = "+Qr+";\n  float scale = "+ei+";\n  return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n";var oi=ni+"\n  return sin(x);\n",ai=ni+"\n  return cos(x);\n",si=ni+"\n  return atan(x);\n",ui=ni+"\n  if (x < 1.0) return NAN;\n  return log(x + sqrt(x * x - 1.0));",ci=ni+"\n  if ((x < -1.0) || (x > 1.0)) return NAN;\n  return (log(1.0 + x) - log(1.0 - x)) / 2.0;",li=function(e){this.variableNames=["A"],this.outputShape=e,this.userCode="\n      const vec2 onePixel = 1. / vec2("+e[1]+", "+e[0]+");\n\n      void main() {\n        ivec2 rc = getOutputCoords();\n        vec2 modCoord = mod(vec2(rc.y, rc.x), 2.);\n\n        vec4 packedInput = texture2D(A,\n          resultUV - step(1., modCoord) * onePixel);\n\n        setOutput(\n          modCoord.x == 0. ?\n            (modCoord.y == 0. ? packedInput.r : packedInput.b) :\n            (modCoord.y == 0. ? packedInput.g : packedInput.a)\n        );\n      }\n    "};var hi=Je({concat_:function(e,t){void 0===t&&(t=0),p(e.length>=1,"Pass at least one tensor to concat");var n=Ze(e,"tensors","concat");t=Fe(t,n[0].shape)[0];var r=$e(n.map(function(e){return e.shape}),t);if(0===v(r))return rt([],r);if(1===(n=n.filter(function(e){return e.size>0})).length)return n[0];var i=n.map(function(e){return e.shape});!function(e,t){var n=e[0].length;e.forEach(function(e,t){p(e.length===n,"Error in concat"+n+"D: rank of tensors["+t+"] must be the same as the rank of the rest ("+n+")")}),p(t>=0&&t<n,"Error in concat"+n+"D: axis must be between 0 and "+(n-1)+".");var r=e[0];e.forEach(function(e,i){for(var o=0;o<n;o++)p(o===t||e[o]===r[o],"Error in concat"+n+"D: Shape of tensors["+i+"] ("+e+") does not match the shape of the rest ("+r+") along the non-concatenated axis "+i+".")})}(i,t);var o=n;return ge.engine.runKernel(function(e){return e.concat(n,t)},o,function(e){var n=i.map(function(e){return e[t]});return gi(e,n,t).map(function(e){return function(){return e}})})}}),di=Je({concat1d_:function(e){return hi(e,0)}}),fi=Je({concat2d_:function(e,t){return hi(e,t)}}),pi=Je({concat3d_:function(e,t){return hi(e,t)}}),mi=Je({concat4d_:function(e,t){return hi(e,t)}}),gi=Je({split_:function(e,t,n){void 0===n&&(n=0);var r,i=Xe(e,"x","split");return n=Fe(n,i.shape)[0],"number"==typeof t?(p(i.shape[n]%t==0,"Number of splits must evenly divide the axis."),r=Array(t).fill(i.shape[n]/t)):(p(i.shape[n]===t.reduce(function(e,t){return e+t}),"The sum of sizes must match the size of the axis dimension."),r=t),ge.engine.runKernel(function(e){return e.split(i,r,n)},{$x:i},function(e){return{$x:function(){return hi(e,n)}}})}});"undefined"!=typeof window?window:void 0!==r||"undefined"!=typeof self&&self;function bi(e,t){return e(t={exports:{}},t.exports),t.exports}var yi=bi(function(e){!function(e,t,n){function r(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function i(e,t){var n=new function(e){var t,n=this,r=(t=4022871197,function(e){e=e.toString();for(var n=0;n<e.length;n++){var r=.02519603282416938*(t+=e.charCodeAt(n));r-=t=r>>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}(e),i=t&&t.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+1.1102230246251565e-16*(2097152*o()|0)},o.quick=o,i&&("object"==typeof i&&r(i,n),o.state=function(){return r(n,{})}),o}t&&t.exports?t.exports=i:this.alea=i}(0,e)}),vi=bi(function(e){!function(e,t,n){function r(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function i(e,t){var n=new function(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r<n.length+64;r++)t.x^=0|n.charCodeAt(r),t.next()}(e),i=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,i&&("object"==typeof i&&r(i,n),o.state=function(){return r(n,{})}),o}t&&t.exports?t.exports=i:this.xor128=i}(0,e)}),_i=bi(function(e){!function(e,t,n){function r(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function i(e,t){var n=new function(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r<n.length+64;r++)t.x^=0|n.charCodeAt(r),r==n.length&&(t.d=t.x<<10^t.x>>>4),t.next()}(e),i=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,i&&("object"==typeof i&&r(i,n),o.state=function(){return r(n,{})}),o}t&&t.exports?t.exports=i:this.xorwow=i}(0,e)}),wi=bi(function(e){!function(e,t,n){function r(e,t){return t.x=e.x.slice(),t.i=e.i,t}function i(e,t){null==e&&(e=+new Date);var n=new function(e){var t=this;t.next=function(){var e,n,r=t.x,i=t.i;return e=r[i],n=(e^=e>>>7)^e<<24,n^=(e=r[i+1&7])^e>>>10,n^=(e=r[i+3&7])^e>>>3,n^=(e=r[i+4&7])^e<<7,e=r[i+7&7],n^=(e^=e<<13)^e<<9,r[i]=n,t.i=i+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n<t.length;++n)r[7&n]=r[7&n]<<15^t.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],e.x=r,e.i=0,n=256;n>0;--n)e.next()}(t,e)}(e),i=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,i&&(i.x&&r(i,n),o.state=function(){return r(n,{})}),o}t&&t.exports?t.exports=i:this.xorshift7=i}(0,e)}),xi=bi(function(e){!function(e,t,n){function r(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function i(e,t){null==e&&(e=+new Date);var n=new function(e){var t=this;t.next=function(){var e,n,r=t.w,i=t.X,o=t.i;return t.w=r=r+1640531527|0,n=i[o+34&127],e=i[o=o+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=i[o]=n^e,t.i=o,n+(r^r>>>16)|0},function(e,t){var n,r,i,o,a,s=[],u=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,u=Math.max(u,t.length)),i=0,o=-32;o<u;++o)t&&(r^=t.charCodeAt((o+32)%t.length)),0===o&&(a=r),r^=r<<10,r^=r>>>15,r^=r<<4,r^=r>>>13,o>=0&&(a=a+1640531527|0,i=0==(n=s[127&o]^=r+a)?i+1:0);for(i>=128&&(s[127&(t&&t.length||0)]=-1),i=127,o=512;o>0;--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;e.w=a,e.X=s,e.i=i}(t,e)}(e),i=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,i&&(i.X&&r(i,n),o.state=function(){return r(n,{})}),o}t&&t.exports?t.exports=i:this.xor4096=i}(0,e)}),Ei=bi(function(e){!function(e,t,n){function r(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function i(e,t){var n=new function(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,i=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^i,i=i-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^i,t.a=i-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r<n.length+20;r++)t.b^=0|n.charCodeAt(r),t.next()}(e),i=t&&t.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},o.int32=n.next,o.quick=o,i&&("object"==typeof i&&r(i,n),o.state=function(){return r(n,{})}),o}t&&t.exports?t.exports=i:this.tychei=i}(0,e)}),Si=bi(function(e){!function(t,r){var i,o=this,a=256,s=6,u="random",c=r.pow(a,s),l=r.pow(2,52),h=2*l,d=a-1;function f(e,n,f){var b=[],y=m(function e(t,n){var r,i=[],o=typeof t;if(n&&"object"==o)for(r in t)try{i.push(e(t[r],n-1))}catch(e){}return i.length?i:"string"==o?t:t+"\0"}((n=1==n?{entropy:!0}:n||{}).entropy?[e,g(t)]:null==e?function(){try{var e;return i&&(e=i.randomBytes)?e=e(a):(e=new Uint8Array(a),(o.crypto||o.msCrypto).getRandomValues(e)),g(e)}catch(e){var n=o.navigator,r=n&&n.plugins;return[+new Date,o,r,o.screen,g(t)]}}():e,3),b),v=new function(e){var t,n=e.length,r=this,i=0,o=r.i=r.j=0,s=r.S=[];for(n||(e=[n++]);i<a;)s[i]=i++;for(i=0;i<a;i++)s[i]=s[o=d&o+e[i%n]+(t=s[i])],s[o]=t;(r.g=function(e){for(var t,n=0,i=r.i,o=r.j,s=r.S;e--;)t=s[i=d&i+1],n=n*a+s[d&(s[i]=s[o=d&o+t])+(s[o]=t)];return r.i=i,r.j=o,n})(a)}(b),_=function(){for(var e=v.g(s),t=c,n=0;e<l;)e=(e+n)*a,t*=a,n=v.g(1);for(;e>=h;)e/=2,t/=2,n>>>=1;return(e+n)/t};return _.int32=function(){return 0|v.g(4)},_.quick=function(){return v.g(4)/4294967296},_.double=_,m(g(v.S),t),(n.pass||f||function(e,t,n,i){return i&&(i.S&&p(i,v),e.state=function(){return p(v,{})}),n?(r[u]=e,t):e})(_,y,"global"in n?n.global:this==r,n.state)}function p(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function m(e,t){for(var n,r=e+"",i=0;i<r.length;)t[d&i]=d&(n^=19*t[d&i])+r.charCodeAt(i++);return g(t)}function g(e){return String.fromCharCode.apply(0,e)}if(r["seed"+u]=f,m(r.random(),t),e.exports){e.exports=f;try{i=n(190)}catch(e){}}}([],Math)});Si.alea=yi,Si.xor128=vi,Si.xorwow=_i,Si.xorshift7=wi,Si.xor4096=xi,Si.tychei=Ei;var Ci=Si.alea,Oi=function(){function e(e,t,n,r,i){this.mean=e,this.stdDev=t,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=Ci(o.toString())}return e.prototype.nextValue=function(){if(!isNaN(this.nextVal)){var e=this.nextVal;return this.nextVal=NaN,e}for(var t,n,r=!1;!r;){var i=void 0,o=void 0,a=void 0;do{a=(i=2*this.random()-1)*i+(o=2*this.random()-1)*o}while(a>=1||0===a);var s=Math.sqrt(-2*Math.log(a)/a);t=this.mean+this.stdDev*i*s,n=this.mean+this.stdDev*o*s,this.truncated&&!this.isValidTruncated(t)||(r=!0)}return this.truncated&&!this.isValidTruncated(n)||(this.nextVal=this.convertValue(n)),this.convertValue(t)},e.prototype.convertValue=function(e){return null==this.dtype||"float32"===this.dtype?e:Math.round(e)},e.prototype.isValidTruncated=function(e){return e<=this.upper&&e>=this.lower},e}();function Ai(e,t){return c(this,void 0,void 0,function(){var n,r,i,o,a,s,u,c,h,d,f,p,m,g,b,y,v,_,w,x;return l(this,function(l){switch(l.label){case 0:if(2!==(n=Xe(e,"img","toPixels","int32")).rank&&3!==n.rank)throw new Error("toPixels only supports rank 2 or 3 tensors, got rank "+n.rank+".");if(r=n.shape.slice(0,2),i=r[0],o=r[1],(a=2===n.rank?1:n.shape[2])>4||2===a)throw new Error("toPixels only supports depth of size 1, 3 or 4 but got "+a);return s=n.min(),u=n.max(),[4,s.data()];case 1:return c=l.sent()[0],[4,u.data()];case 2:if(h=l.sent()[0],s.dispose(),u.dispose(),"float32"===n.dtype){if(c<0||h>1)throw new Error("Tensor values for a float32 Tensor must be in the range [0 - 1] but got range ["+c+" - "+h+"].")}else{if("int32"!==n.dtype)throw new Error("Unsupported type for toPixels: "+n.dtype+". Please use float32 or int32 tensors.");if(c<0||h>255)throw new Error("Tensor values for a int32 Tensor must be in the range [0 - 255] but got range ["+c+" - "+h+"].")}return[4,n.data()];case 3:for(d=l.sent(),f="float32"===n.dtype?255:1,p=new Uint8ClampedArray(o*i*4),m=0;m<i*o;++m)g=void 0,b=void 0,y=void 0,v=void 0,1===a?(g=d[m]*f,b=d[m]*f,y=d[m]*f,v=255):3===a?(g=d[3*m]*f,b=d[3*m+1]*f,y=d[3*m+2]*f,v=255):4===a&&(g=d[4*m]*f,b=d[4*m+1]*f,y=d[4*m+2]*f,v=d[4*m+3]*f),p[0+(_=4*m)]=Math.round(g),p[_+1]=Math.round(b),p[_+2]=Math.round(y),p[_+3]=Math.round(v);return null!=t&&(t.width=o,t.height=i,w=t.getContext("2d"),x=new ImageData(p,o,i),w.putImageData(x,0,0)),n!==e&&n.dispose(),[2,p]}})})}function Mi(e,t,n){return void 0===t&&(t="float32"),new X(e,t,n)}function Ni(e,t){void 0===t&&(t=!1),console.log(e.toString(t))}var ki=Je({batchToSpaceND_:function(e,t,n){var r=Xe(e,"x","batchToSpaceND"),i=t.reduce(function(e,t){return e*t});return p(r.rank>=1+t.length,"input rank should be > than [blockShape] but got "+r.rank),p(n.length===t.length,"crops.shape[0] must be equal to [blockShape] but got "+n.length),p(r.shape[0]%i==0,"input tensor batch must be divisible by prod( blockShape )"),ge.engine.runKernel(function(e){return e.batchToSpaceND(r,t,n)},{$x:r},function(e){return{$x:function(){return e.spaceToBatchND(t,n)}}})}}),Ii=Je({cast_:function(e,t){var n=Xe(e,"x","cast");return ge.engine.runKernel(function(e){return e.cast(n,t)},{$x:n},function(e){return{$x:function(){return e.clone()}}})}}),Ti=Je({clone_:function(e){var t=Xe(e,"x","clone");return ge.engine.runKernel(function(e){return ee.make(t.shape,{dataId:t.dataId},t.dtype)},{$x:t},function(e){return{$x:function(){return e.toFloat()}}})}}),Pi=Je({cumsum_:function(e,t,n,r){void 0===t&&(t=0),void 0===n&&(n=!1),void 0===r&&(r=!1);var i=Xe(e,"x","cumsum"),o=Ve([t|=0],i.rank),a=i;null!=o&&(a=i.transpose(o));var s=We(1,i.rank)[0],u=ge.engine.runKernel(function(e){return e.cumsum(a,s,n,r)},{permutedX:a},function(e){return{permutedX:function(){return e.cumsum(t,n,!r)}}});return null!=o&&(u=u.transpose(o)),u}}),Ri=Je({depthToSpace_:function(e,t,n){void 0===n&&(n="NHWC");var r=Xe(e,"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 p(i*t>=0,"Negative dimension size caused by overflow when multiplying\n      "+i+" and "+t+"  for depthToSpace with input shape\n      "+r.shape),p(o*t>=0,"Negative dimension size caused by overflow when multiplying\n      "+o+" and "+t+" for depthToSpace with input shape\n          "+r.shape),p(a%(t*t)==0,"Dimension size must be evenly divisible by "+t*t+" but is "+a+" for depthToSpace with input shape "+r.shape),ge.engine.runKernel(function(e){return e.depthToSpace(r,t,n)},{$x:r})}}),Di=Je({expandDims_:function(e,t){void 0===t&&(t=0);var n=Xe(e,"x","expandDims");p(t<=n.rank,"Axis must be <= rank of the tensor");var r=n.shape.slice();return t<0&&(p(-(n.rank+1)<=t,"Axis must be in the interval ["+-(n.rank+1)+", "+n.rank+"]"),t=n.rank+t+1),r.splice(t,0,1),Ki(n,r)}}),Li=Je({eye_:function(e,t,n,r){void 0===r&&(r="float32"),null==t&&(t=e);for(var i=Mi([e,t],r),o=e<=t?e:t,a=0;a<o;++a)i.set(1,a,a);var s=i.toTensor().as2D(e,t);if(null==n)return s;if(1===n.length)return Ji(Di(s,0),[n[0],1,1]);if(2===n.length)return Ji(Di(Di(s,0),0),[n[0],n[1],1,1]);if(3===n.length)return Ji(Di(Di(Di(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.")}}),Bi=Je({fromPixels_:function(e,t){if(void 0===t&&(t=3),t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");return ge.engine.fromPixels(e,t)}}),ji=Je({multinomial_:function(e,t,n,r){void 0===r&&(r=!1);var i=Xe(e,"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(a>2)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=ge.engine.runKernel(function(e){return e.multinomial(s,r,t,n)},{logits2D:s});return 1===a?u.as1D():u}}),Fi=Je({oneHot_:function(e,t,n,r){void 0===n&&(n=1),void 0===r&&(r=0);var i=Xe(e,"indices","oneHot","int32");if(p("int32"===i.dtype,"Indices must be of dtype `int32`"),t<2)throw new Error("Error in oneHot: depth must be >=2, but it is "+t);return ge.engine.runKernel(function(e){return e.oneHot(i,t,n,r)},{$indices:i},function(e){return{$indices:function(){return Et(i)}}})}}),zi=Je({pad_:function(e,t,n){void 0===n&&(n=0);var r=Xe(e,"x","pad");if(0===r.rank)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");var i=t.map(function(e){return e[0]});return ge.engine.runKernel(function(e){return e.pad(r,t,n)},{$x:r},function(e){return{$x:function(){return e.slice(i,r.shape)}}})}}),Vi=Je({pad1d_:function(e,t,n){return void 0===n&&(n=0),p(2===t.length,"Invalid number of paddings. Must be length of 2."),zi(e,[t],n)}}),Ui=Je({pad2d_:function(e,t,n){return void 0===n&&(n=0),p(2===t.length&&2===t[0].length&&2===t[1].length,"Invalid number of paddings. Must be length of 2 each."),zi(e,t,n)}}),Wi=Je({pad3d_:function(e,t,n){return void 0===n&&(n=0),p(3===t.length&&2===t[0].length&&2===t[1].length&&2===t[2].length,"Invalid number of paddings. Must be length of 2 each."),zi(e,t,n)}}),$i=Je({pad4d_:function(e,t,n){return void 0===n&&(n=0),p(4===t.length&&2===t[0].length&&2===t[1].length&&2===t[2].length&&2===t[3].length,"Invalid number of paddings. Must be length of 2 each."),zi(e,t,n)}}),qi=Je({rand_:function(e,t,n){var r=v(e),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]=t();return ee.make(e,{values:i},n)}}),Hi=Je({randomNormal_:function(e,t,n,r,i){if(void 0===t&&(t=0),void 0===n&&(n=1),null!=r&&"bool"===r)throw new Error("Unsupported data type "+r);for(var o=new Oi(t,n,r,!1,i),a=Mi(e,r),s=0;s<a.values.length;s++)a.values[s]=o.nextValue();return a.toTensor()}}),Gi=Je({randomUniform_:function(e,t,n,r){void 0===t&&(t=0),void 0===n&&(n=1),void 0===r&&(r="float32");for(var i=Mi(e,r),o=0;o<i.values.length;o++)i.values[o]=f(t,n);return i.toTensor()}}),Ki=Je({reshape_:function(e,t){var n=Xe(e,"x","reshape");return t=O(t,n.size),p(n.size===v(t),"new shape and old shape must have the same number of elements."),ge.engine.runKernel(function(e){return e.reshape(n,t)},{$x:n},function(e){return{$x:function(){return e.reshape(n.shape)}}})}}),Yi=Je({spaceToBatchND_:function(e,t,n){var r=Xe(e,"x","spaceToBatchND");return p(r.rank>=1+t.length,"input rank "+r.rank+" should be > than [blockShape] "+t.length),p(n.length===t.length,"paddings.shape[0] "+n.length+" must be equal to [blockShape] "+t.length),p(r.shape.reduce(function(e,r,i){return i>0&&i<=t.length?e&&(r+n[i-1][0]+n[i-1][1])%t[i-1]==0:e},!0),"input spatial dimensions "+r.shape.slice(1)+" with paddings "+n.toString()+" must be divisible by blockShapes "+t.toString()),ge.engine.runKernel(function(e){return e.spaceToBatchND(r,t,n)},{$x:r},function(e){return{$x:function(){return e.batchToSpaceND(t,n)}}})}}),Xi=Je({squeeze_:function(e,t){var n=Xe(e,"x","squeeze");return Ki(n,A(n.shape,t).newShape)}}),Zi=Je({stack_:function(e,t){void 0===t&&(t=0);var n=Ze(e,"tensors","stack");if(p(n.length>=1,"Pass at least one tensor to tf.stack"),1===n.length)return n[0].expandDims(t);var r=n[0].rank,i=n[0].shape,o=n[0].dtype;p(t<=r,"Axis must be <= rank of the tensor"),n.forEach(function(e){m(i,e.shape,"All tensors passed to stack must have matching shapes")}),n.forEach(function(e){p(o===e.dtype,"All tensors passed to stack must have matching dtypes")});var a=n.map(function(e){return e.expandDims(t)});return hi(a,t)}}),Ji=Je({tile_:function(e,t){var n=Xe(e,"x","tile");return p(n.rank===t.length,"Error in transpose: rank of input "+n.rank+" must match length of reps "+t+"."),ge.engine.runKernel(function(e){return e.tile(n,t)},{$x:n},function(e){return{$x:function(){var r=Et(n);if(1===n.rank)for(var i=0;i<t[0];++i)r=r.add(e.slice([i*n.shape[0]],[n.shape[0]]));else if(2===n.rank)for(i=0;i<t[0];++i)for(var o=0;o<t[1];++o)r=r.add(e.slice([i*n.shape[0],o*n.shape[1]],[n.shape[0],n.shape[1]]));else if(3===n.rank)for(i=0;i<t[0];++i)for(o=0;o<t[1];++o)for(var a=0;a<t[2];++a)r=r.add(e.slice([i*n.shape[0],o*n.shape[1],a*n.shape[2]],[n.shape[0],n.shape[1],n.shape[2]]));else{if(4!==n.rank)throw new Error("Gradient for tile operation is not implemented for rank-"+n.rank+" tensors yet.");for(i=0;i<t[0];++i)for(o=0;o<t[1];++o)for(a=0;a<t[2];++a)for(var s=0;s<t[3];++s)r=r.add(e.slice([i*n.shape[0],o*n.shape[1],a*n.shape[2],s*n.shape[3]],[n.shape[0],n.shape[1],n.shape[2],n.shape[3]]))}return r}}})}}),Qi=Je({truncatedNormal_:function(e,t,n,r,i){if(void 0===t&&(t=0),void 0===n&&(n=1),null!=r&&"bool"===r)throw new Error("Unsupported data type "+r);for(var o=new Oi(t,n,r,!0,i),a=Mi(e,r),s=0;s<a.values.length;s++)a.values[s]=o.nextValue();return a.toTensor()}}),eo=Je({unstack_:function(e,t){void 0===t&&(t=0);for(var n,r=Xe(e,"x","unstack"),i=r.shape[t],o=Array(r.rank-1).fill(0),a=0,s=0;s<r.rank;s++)s!==t&&(o[a]=r.shape[s],a++);n=Array(i).fill(1);var u=Array(r.rank).fill(0),c=r.shape.slice();return n.map(function(e){c[t]=e;var n=r.slice(u,c);return u[t]+=e,n.reshape(o)})}});function to(e,t){for(var n=[],r=0;r<t.length;r++)t[r]&&n.push(r);var i=Mi(e,"int32"),o=Mi([n.length,e.length],"int32");for(r=0;r<n.length;r++){var a=i.indexToLoc(n[r]),s=r*e.length;o.values.set(a,s)}return o.toTensor()}var no=300,ro=function(){function e(e,t){if(void 0===t&&(t=!0),this.gpgpu=e,this.delayedStorage=t,this.texData=new WeakMap,this.pendingRead=new WeakMap,this.pendingDisposal=new WeakSet,this.lruDataGPU=[],this.numBytesInGPU=0,this.uploadWaitMs=0,this.downloadWaitMs=0,this.binaryCache={},this.disposed=!1,ge.get("WEBGL_VERSION")<1)throw new Error("WebGL is not supported on this device");ge.get("IS_BROWSER")&&(this.canvas=document.createElement("canvas")),null==e?(this.gpgpu=new Or(or(this.canvas)),this.gpgpuCreatedLocally=!0):this.gpgpuCreatedLocally=!1,this.NUM_BYTES_BEFORE_PAGING=window.screen.height*window.screen.width*window.devicePixelRatio*no,this.textureManager=new Kr(this.gpgpu)}return e.prototype.register=function(e,t,n){if(this.texData.has(e))throw new Error("Data buffer is already registered");this.texData.set(e,{shape:t,dtype:n,values:null,texture:null,complexTensors:null,texShape:null,usage:dn.RENDER})},e.prototype.fromPixels=function(e,t){if(null==e)throw new Error("pixels passed to tf.fromPixels() can not be null");var n=[e.height,e.width],r=[e.height,e.width,t];if(!(e instanceof HTMLVideoElement||e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof ImageData))throw new Error("pixels passed to tf.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement or ImageData, but was "+e.constructor.name);if(e instanceof HTMLVideoElement){if(null==this.fromPixelsCanvas){if(!ge.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.fromPixelsCanvas=document.createElement("canvas")}this.fromPixelsCanvas.width=e.width,this.fromPixelsCanvas.height=e.height,this.fromPixelsCanvas.getContext("2d").drawImage(e,0,0,e.width,e.height),e=this.fromPixelsCanvas}var i=ee.make(n,{},"int32");this.texData.get(i.dataId).usage=dn.PIXELS,this.gpgpu.uploadPixelDataToTexture(this.getTexture(i.dataId),e);var o=new gn(r),a=this.compileAndRun(o,[i]);return i.dispose(),a},e.prototype.write=function(e,t){if(null==t)throw new Error("MathBackendWebGL.write(): values can not be null");this.throwIfNoData(e);var n=this.texData.get(e),r=n.texture,i=n.texShape,o=n.usage;if("complex64"===n.dtype)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");null!=r&&(this.releaseTexture(e,r,i,o),n.texture=null,n.texShape=null),n.usage=dn.UPLOAD,n.values=t,this.delayedStorage||this.uploadToGPU(e)},e.prototype.readSync=function(e){this.throwIfNoData(e);var t=this.texData.get(e),n=t.shape,r=t.texture,i=t.values,o=t.texShape,a=t.dtype,s=t.complexTensors;if(null!=i)return this.cacheOnCPU(e),i;var u,c,l=null!=this.activeTimers;return l&&(u=performance.now()),c="complex64"===a?Nt(s.real.dataSync(),s.imag.dataSync()):this.getValuesFromTexture(r,e,a,o,n),l&&(this.downloadWaitMs+=performance.now()-u),this.cacheOnCPU(e,c),t.values},e.prototype.read=function(e){return c(this,void 0,void 0,function(){var t,n,r,i,o,a,s,u,c,h;return l(this,function(l){switch(l.label){case 0:if(this.pendingRead.has(e))return t=this.pendingRead.get(e),[2,new Promise(function(e){return t.push(e)})];if(this.throwIfNoData(e),n=this.texData.get(e),r=n.shape,i=n.texture,o=n.values,a=n.texShape,s=n.dtype,null!=o)return this.cacheOnCPU(e),[2,o];if(this.pendingRead.set(e,[]),!ge.get("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&2===ge.get("WEBGL_VERSION"))throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");return u=this.gpgpu.maybeCreateBufferFromTexture(i,a[0],a[1]),[4,this.gpgpu.createAndWaitForFence()];case 1:return l.sent(),c=u instanceof WebGLTexture?this.getValuesFromTexture(i,e,s,a,r):this.gpgpu.downloadFloat32MatrixFromBuffer(u,a[0],a[1]),this.cacheOnCPU(e,c),h=this.pendingRead.get(e),this.pendingRead.delete(e),h.forEach(function(e){return e(c)}),this.pendingDisposal.has(e)&&(this.pendingDisposal.delete(e),this.disposeData(e)),[2,c]}})})},e.prototype.getValuesFromTexture=function(e,t,n,r,i){if(ge.get("WEBGL_DOWNLOAD_FLOAT_ENABLED"))return this.texData.get(t).usage===dn.PACK?this.gpgpu.downloadMatrixFromPackedTexture(e,r[0],r[1]):this.gpgpu.downloadFloat32MatrixFromOutputTexture(e,r[0],r[1]);var o=ee.make(i,{});this.texData.get(o.dataId).usage=dn.DOWNLOAD;var a=ee.make(i,{dataId:t},n),s=new mn(i);this.compileAndRun(s,[a],o,null,!1);var u=this.texData.get(o.dataId),c=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(u.texture,u.texShape[0],u.texShape[1]);return a.dispose(),o.dispose(),c},e.prototype.time=function(e){return c(this,void 0,void 0,function(){var t,n,r,i,o,a;return l(this,function(s){switch(s.label){case 0:return t=this.activeTimers,n=[],r=!1,null==this.programTimersStack?(this.programTimersStack=n,r=!0):this.activeTimers.push(n),this.activeTimers=n,e(),i=b(this.activeTimers),this.activeTimers=t,r&&(this.programTimersStack=null),[4,Promise.all(i).then(function(e){var t=0;return e.forEach(function(e){return t+=e}),t})];case 1:return o=s.sent(),a={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:o,wallMs:null},this.uploadWaitMs=0,this.downloadWaitMs=0,[2,a]}})})},e.prototype.memory=function(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU}},e.prototype.startTimer=function(){return ge.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?this.gpgpu.beginQuery():{startMs:performance.now(),endMs:null}},e.prototype.endTimer=function(e){return ge.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(this.gpgpu.endQuery(),e):(e.endMs=performance.now(),e)},e.prototype.getQueryTime=function(e){return c(this,void 0,void 0,function(){var t;return l(this,function(n){return ge.get("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?[2,this.gpgpu.waitForQueryAndGetTime(e)]:[2,(t=e).endMs-t.startMs]})})},e.prototype.disposeData=function(e){if(!this.pendingDisposal.has(e))if(this.pendingRead.has(e))this.pendingDisposal.add(e);else if(this.texData.has(e)){var t=this.texData.get(e),n=t.texture,r=t.texShape,i=t.usage,o=t.complexTensors;null!=n&&this.releaseTexture(e,n,r,i),null!=o&&(o.real.dispose(),o.imag.dispose()),this.texData.delete(e)}},e.prototype.getTexture=function(e){return this.uploadToGPU(e),this.texData.get(e).texture},e.prototype.getGPGPUContext=function(){return this.gpgpu},e.prototype.getCanvas=function(){return this.canvas},e.prototype.complex=function(e,t){var n=ee.make(e.shape,{},"complex64");return this.texData.get(n.dataId).complexTensors={real:ge.engine.keep(e.clone()),imag:ge.engine.keep(t.clone())},n},e.prototype.real=function(e){return this.texData.get(e.dataId).complexTensors.real.clone()},e.prototype.imag=function(e){return this.texData.get(e.dataId).complexTensors.imag.clone()},e.prototype.slice=function(e,t,n){var r=new Hr(n),i=r.getCustomSetupFunc(t);return this.compileAndRun(r,[e],null,i)},e.prototype.stridedSlice=function(e,t,n,r,i,o,a,s,u){var c=Ge(e.shape,t,n,r,i,o,a,s,u),l=c[0],h=c[1],d=c[2],f=h.filter(function(e,t){return-1===d.indexOf(t)});if(f.some(function(e){return 0===e}))return rt([],f);var p=new Gr(l,r,h,d);return this.compileAndRun(p,[e])},e.prototype.reverse=function(e,t){var n=new Wr(e.shape,t);return this.compileAndRun(n,[e])},e.prototype.concat2Tensors=function(e,t,n){var r=$e([e.shape,t.shape],n),i=e.as2D(-1,v(e.shape.slice(n))),o=t.as2D(-1,v(t.shape.slice(n))),a=new Gt(i.shape,o.shape);return this.compileAndRun(a,[i,o]).reshape(r)},e.prototype.concat=function(e,t){if(1===e.length)return e[0];for(var n=e[0],r=1;r<e.length;++r)n=this.concat2Tensors(n,e[r],t);return n},e.prototype.neg=function(e){var t=new ti(e.shape,"return -x;");return this.compileAndRun(t,[e])},e.prototype.batchMatMul=function(e,t,n,r){var i=n?e.shape[2]:e.shape[1],o=r?t.shape[1]:t.shape[2];if(ge.get("WEBGL_RENDER_FLOAT32_ENABLED")&&1===e.shape[0]&&1===t.shape[0]&&_(nr(this.gpgpu.gl,[i,o]),[i,o])){var a=e.as2D(e.shape[1],e.shape[2]),s=t.as2D(t.shape[1],t.shape[2]),u=new Dr(a.shape),c=ee.make(a.shape,{});this.texData.get(c.dataId).usage=dn.PACK;var l=this.compileAndRun(u,[a],c),h=new Dr(s.shape),d=ee.make(s.shape,{});this.texData.get(d.dataId).usage=dn.PACK;var f=this.compileAndRun(h,[s],d),p=new Tr(l.shape,f.shape,[i,o],n,r),m=ee.make(p.outputShape,{});this.texData.get(m.dataId).usage=dn.PACK;var g=this.compileAndRun(p,[l,f],m),b=new li(g.shape),y=this.compileAndRun(b,[g]);return c.dispose(),d.dispose(),m.dispose(),y.reshape([1,g.shape[0],g.shape[1]])}return this.compileAndRun(new Ir(e.shape,t.shape,n,r),[e,t])},e.prototype.multiply=function(e,t){if("complex64"===e.dtype){var n=this.texData.get(e.dataId),r=this.texData.get(t.dataId),i=new Ut(zt,e.shape,t.shape),o=new Ut(Vt,e.shape,t.shape),a=[this.makeComplexComponentTensorHandle(e,n.complexTensors.real),this.makeComplexComponentTensorHandle(e,n.complexTensors.imag),this.makeComplexComponentTensorHandle(t,r.complexTensors.real),this.makeComplexComponentTensorHandle(t,r.complexTensors.imag)],s=this.compileAndRun(i,a),u=this.compileAndRun(o,a),c=this.complex(s,u);return s.dispose(),u.dispose(),c}var l=new qt("return a * b;",e.shape,t.shape),h=this.makeOutputArray(l.outputShape,e.dtype);return this.compileAndRun(l,[e,t],h)},e.prototype.batchNormalization=function(e,t,n,r,i,o){var a=[e,t,n],s=null;null!=o&&(s=o.shape,a.push(o));var u=null;null!=i&&(u=i.shape,a.push(i));var c=new Ft(e.shape,t.shape,n.shape,s,u,r);return this.compileAndRun(c,a)},e.prototype.localResponseNormalization4D=function(e,t,n,r,i){var o=new Mr(e.shape,t,n,r,i);return this.compileAndRun(o,[e])},e.prototype.LRNGrad=function(e,t,n,r,i,o,a){var s=new Nr(t.shape,r,i,o,a);return this.compileAndRun(s,[t,n,e])},e.prototype.tile=function(e,t){var n=new Zr(e.shape,t);return this.compileAndRun(n,[e])},e.prototype.pad=function(e,t,n){var r=new Lr(e.shape,t,n);return this.compileAndRun(r,[e])},e.prototype.transpose=function(e,t){var n=new Jr(e.shape,t);return this.compileAndRun(n,[e])},e.prototype.gather=function(e,t,n){var r=new bn(e.shape,t.size,n);return this.compileAndRun(r,[e,t])},e.prototype.batchToSpaceND=function(e,t,n){p(e.rank<=4,"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet");var r=t.reduce(function(e,t){return e*t}),i=Ie(e.shape,t,r),o=Te(i.length,t.length),a=Pe(e.shape,t,r),s=Re(n,t.length),u=De(a,n,t.length);return e.reshape(i).transpose(o).reshape(a).slice(s,u)},e.prototype.spaceToBatchND=function(e,t,n){p(e.rank<=4,"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet");var r=t.reduce(function(e,t){return e*t}),i=[[0,0]];i.push.apply(i,n);for(var o=1+t.length;o<e.shape.length;++o)i.push([0,0]);var a=e.pad(i),s=Ie(a.shape,t,r,!1),u=Te(s.length,t.length,!1),c=Pe(a.shape,t,r,!1);return a.reshape(s).transpose(u).reshape(c)},e.prototype.reduce=function(e,t,n){var r=e.shape[0],i=e.shape[1],o=He(i),a=new jr({windowSize:o,inSize:i,batchSize:r},t),s=a.outputShape,u=s[0],c=s[1],l=this.makeOutputArray([u,c],n);return this.compileAndRun(a,[e],l),1===l.shape[1]?l:this.reduce(l,t,n)},e.prototype.argReduce=function(e,t,n){void 0===n&&(n=null);var r=e.shape[0],i=e.shape[1];null!=n&&(r=n.shape[0],i=n.shape[1]);var o=He(i),a=new Rt({windowSize:o,inSize:i,batchSize:r},t,null==n),s=a.outputShape,u=s[0],c=s[1],l=this.makeOutputArray([u,c],"int32"),h=[e];return null!=n&&h.push(n),this.compileAndRun(a,h,l),1===l.shape[1]?l:this.argReduce(e,t,l)},e.prototype.sum=function(e,t){ze("sum",t,e.rank);var n=Be(e.shape,t),r=n[0],i=v(n[1]),o=e.as2D(-1,i),a=Ot(e.dtype);return this.reduce(o,"sum",a).reshape(r)},e.prototype.unsortedSegmentSum=function(e,t,n){var r=0,i=Ve([r],e.rank),o=e;null!=i&&(o=e.transpose(i),r=We(1,e.rank)[0]);var a=function(e,t,n){for(var r=[],i=e.length,o=0;o<i;o++)o!==t?r.push(e[o]):r.push(n);return r}(o.shape,r,n),s=v([o.shape[r]]),u=o.as2D(-1,s),c=Ot(e.dtype),l=this.segOpCompute(u,"unsortedSegmentSum",t,c,n).reshape(a);return null!=i&&(l=l.transpose(Ue(i))),l},e.prototype.segOpCompute=function(e,t,n,r,i){var o=e.shape[0],a=e.shape[1],s=function(e,t){var n,r=!1;for(e<=qe?(n=e,r=!0):n=D(e,Math.floor(Math.sqrt(e)));!r;){if(n>t||n===e){r=!0;break}n=D(e,n+1)}return n}(a,i),u=new $r({windowSize:s,inSize:a,batchSize:o,numSegments:i},t),c=u.outputShape,l=c[0],h=c[1],d=this.makeOutputArray([l,h],r);return this.compileAndRun(u,[e,n],d),d.shape[1]===i?d:(n=mt(0,i).tile([a/s]),this.segOpCompute(d,t,n,r,i))},e.prototype.argMin=function(e,t){var n=[t];ze("argMin",n,e.rank);var r=Be(e.shape,n),i=r[0],o=v(r[1]),a=e.as2D(-1,o);return this.argReduce(a,"min").reshape(i)},e.prototype.argMax=function(e,t){var n=[t];ze("argMax",n,e.rank);var r=Be(e.shape,n),i=r[0],o=v(r[1]),a=e.as2D(-1,o);return this.argReduce(a,"max").reshape(i)},e.prototype.cumsum=function(e,t,n,r){if(t!==e.rank-1)throw new Error("WebGL cumsum shader expects an inner-most axis="+(e.rank-1)+" but got axis="+t);var i=new ln(e.shape,n,r);return this.compileAndRun(i,[e])},e.prototype.equal=function(e,t){var n=new qt("return float(a == b);",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[e,t],r)},e.prototype.notEqual=function(e,t){var n=new qt("return float(a != b);",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[e,t],r)},e.prototype.less=function(e,t){var n=new qt("return float(a < b);",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[e,t],r)},e.prototype.lessEqual=function(e,t){var n=new qt("return float(a <= b);",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[e,t],r)},e.prototype.greater=function(e,t){var n=new qt("return float(a > b);",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[e,t],r)},e.prototype.greaterEqual=function(e,t){var n=new qt("return float(a >= b);",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[e,t],r)},e.prototype.logicalNot=function(e){var t=new ti(e.shape,"return float(!(x >= 1.0));");return this.compileAndRun(t,[e])},e.prototype.logicalAnd=function(e,t){var n=new qt("return float(a >= 1.0 && b >= 1.0);",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[e,t],r)},e.prototype.logicalOr=function(e,t){var n=new qt("return float(a >= 1.0 || b >= 1.0);",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"bool");return this.compileAndRun(n,[e,t],r)},e.prototype.select=function(e,t,n){var r=new qr(e.rank,t.shape,t.rank),i=this.makeOutputArray(r.outputShape,Ct(t.dtype,n.dtype));return this.compileAndRun(r,[e,t,n],i)},e.prototype.where=function(e){ke("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");var t=e.dataSync();return to(e.shape,t)},e.prototype.topk=function(e,t,n){return Pt(e.dataSync(),e.shape,e.dtype,t)},e.prototype.min=function(e,t){ze("min",t,e.rank);var n=Be(e.shape,t),r=n[0],i=v(n[1]),o=e.as2D(-1,i);return this.reduce(o,"min",o.dtype).reshape(r)},e.prototype.minimum=function(e,t){var n=new qt("\n  if (isNaN(a)) return a;\n  if (isNaN(b)) return b;\n\n  return min(a, b);\n",e.shape,t.shape);return this.compileAndRun(n,[e,t])},e.prototype.mod=function(e,t){var n=new qt("if (b == 0.0) return NAN;\n  return mod(a, b);",e.shape,t.shape),r=n.getCustomSetupFunc();return this.compileAndRun(n,[e,t],null,r)},e.prototype.max=function(e,t){ze("max",t,e.rank);var n=Be(e.shape,t),r=n[0],i=v(n[1]),o=e.as2D(-1,i);return this.reduce(o,"max",o.dtype).reshape(r)},e.prototype.maximum=function(e,t){var n=new qt("\n  if (isNaN(a)) return a;\n  if (isNaN(b)) return b;\n\n  return max(a, b);\n",e.shape,t.shape);return this.compileAndRun(n,[e,t])},e.prototype.all=function(e,t){ze("all",t,e.rank);var n=Be(e.shape,t),r=n[0],i=v(n[1]),o=e.as2D(-1,i);return this.reduce(o,"all",o.dtype).reshape(r)},e.prototype.any=function(e,t){ze("any",t,e.rank);var n=Be(e.shape,t),r=n[0],i=v(n[1]),o=e.as2D(-1,i);return this.reduce(o,"any",o.dtype).reshape(r)},e.prototype.squaredDifference=function(e,t){var n=new qt("return (a - b) * (a - b);",e.shape,t.shape);return this.compileAndRun(n,[e,t])},e.prototype.realDivide=function(e,t){var n=new qt("if (a == b) return 1.0;\n  return a / b;",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"float32");return this.compileAndRun(n,[e,t],r)},e.prototype.floorDiv=function(e,t){var n=new qt("\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",e.shape,t.shape),r=this.makeOutputArray(n.outputShape,"int32");return this.compileAndRun(n,[e,t],r)},e.prototype.add=function(e,t){if("complex64"===e.dtype&&"complex64"===t.dtype)return this.complexSeparableBinaryOp(e,t,Wt);var n=new qt(Wt,e.shape,t.shape),r=this.makeOutputArray(n.outputShape,Ct(e.dtype,t.dtype));return this.compileAndRun(n,[e,t],r)},e.prototype.complexSeparableBinaryOp=function(e,t,n){var r=this,i=this.texData.get(e.dataId),o=this.texData.get(t.dataId),a=[[i.complexTensors.real,o.complexTensors.real],[i.complexTensors.imag,o.complexTensors.imag]].map(function(i){var o=i[0],a=i[1],s=new qt(n,e.shape,t.shape),u=r.makeOutputArray(s.outputShape,Ct(o.dtype,a.dtype)),c=r.makeComplexComponentTensorHandle(e,o),l=r.makeComplexComponentTensorHandle(t,a);return r.compileAndRun(s,[c,l],u)}),s=a[0],u=a[1],c=this.complex(s,u);return s.dispose(),u.dispose(),c},e.prototype.makeComplexComponentTensorHandle=function(e,t){return{dataId:t.dataId,dtype:t.dtype,shape:e.shape}},e.prototype.addN=function(e){for(var t=e[0],n=1;n<e.length;n++)t=this.add(t,e[n]);return t},e.prototype.subtract=function(e,t){if("complex64"===e.dtype&&"complex64"===t.dtype)return this.complexSeparableBinaryOp(e,t,$t);var n=new qt($t,e.shape,t.shape),r=this.makeOutputArray(n.outputShape,Ct(e.dtype,t.dtype));return this.compileAndRun(n,[e,t],r)},e.prototype.pow=function(e,t){var n=new qt("\nif(a < 0.0 && floor(b) < b){\n  return NAN;\n}\nreturn (round(mod(b, 2.0)) == 0 || round(mod(b, 2.0)) == 2) ?\n    pow(abs(a), b) : sign(a) * pow(abs(a), b);\n",e.shape,t.shape),r=n.getCustomSetupFunc(),i=this.makeOutputArray(n.outputShape,Ct(e.dtype,t.dtype));return this.compileAndRun(n,[e,t],i,r)},e.prototype.ceil=function(e){var t=new ti(e.shape,"return ceil(x);");return this.compileAndRun(t,[e])},e.prototype.floor=function(e){var t=new ti(e.shape,"return floor(x);");return this.compileAndRun(t,[e])},e.prototype.sign=function(e){var t=new ti(e.shape,"\n  if (isNaN(x)) { return 0.0; }\n  return sign(x);\n");return this.compileAndRun(t,[e])},e.prototype.round=function(e){var t=new ti(e.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(t,[e])},e.prototype.exp=function(e){var t=new ti(e.shape,"return exp(x);");return this.compileAndRun(t,[e])},e.prototype.expm1=function(e){var t=new ti(e.shape,"return exp(x) - 1.0;");return this.compileAndRun(t,[e])},e.prototype.log=function(e){var t=new ti(e.shape,"if (x < 0.0) return NAN;\n  return log(x);"),n=t.getCustomSetupFunc();return this.compileAndRun(t,[e],null,n)},e.prototype.log1p=function(e){var t=new ti(e.shape,"return log(1.0 + x);");return this.compileAndRun(t,[e])},e.prototype.sqrt=function(e){var t=new ti(e.shape,"return sqrt(x);");return this.compileAndRun(t,[e])},e.prototype.rsqrt=function(e){var t=new ti(e.shape,"return inversesqrt(x);");return this.compileAndRun(t,[e])},e.prototype.square=function(e){var t=new ti(e.shape,"return x * x;");return this.compileAndRun(t,[e])},e.prototype.reciprocal=function(e){var t=new ti(e.shape,"return 1.0 / x;");return this.compileAndRun(t,[e])},e.prototype.relu=function(e){var t=new ti(e.shape,ri);return this.compileAndRun(t,[e])},e.prototype.elu=function(e){var t=new ti(e.shape,"return (x >= 0.0) ? x : (exp(x) - 1.0);");return this.compileAndRun(t,[e])},e.prototype.eluDer=function(e,t){var n=new qt("return (b >= 1.0) ? a : a * (b + 1.0);",e.shape,t.shape);return this.compileAndRun(n,[e,t])},e.prototype.selu=function(e){var t=new ti(e.shape,ii);return this.compileAndRun(t,[e])},e.prototype.int=function(e){var t=new ti(e.shape,"return float(int(x));"),n=this.makeOutputArray(t.outputShape,"int32");return this.compileAndRun(t,[e],n)},e.prototype.clip=function(e,t,n){var r=new Ht(e.shape,t,n);return this.compileAndRun(r,[e])},e.prototype.abs=function(e){var t=new ti(e.shape,"return abs(x);");return this.compileAndRun(t,[e])},e.prototype.sigmoid=function(e){var t=new ti(e.shape,"return 1.0 / (1.0 + exp(-1.0 * x));");return this.compileAndRun(t,[e])},e.prototype.softplus=function(e){var t=new ti(e.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(t,[e])},e.prototype.sin=function(e){var t=new ti(e.shape,oi);return this.compileAndRun(t,[e])},e.prototype.cos=function(e){var t=new ti(e.shape,ai);return this.compileAndRun(t,[e])},e.prototype.tan=function(e){var t=new ti(e.shape,"return tan(x);");return this.compileAndRun(t,[e])},e.prototype.asin=function(e){var t=new ti(e.shape,"return asin(x);");return this.compileAndRun(t,[e])},e.prototype.acos=function(e){var t=new ti(e.shape,"return acos(x);");return this.compileAndRun(t,[e])},e.prototype.atan=function(e){var t=new ti(e.shape,si);return this.compileAndRun(t,[e])},e.prototype.atan2=function(e,t){var n=new qt("\n  if (isNaN(a)) return a;\n  if (isNaN(b)) return b;\n\n  return atan(a, b);\n",e.shape,t.shape);return this.compileAndRun(n,[e,t])},e.prototype.sinh=function(e){var t=new ti(e.shape,"\n  float e2x = exp(x);\n  return (e2x - 1.0 / e2x) / 2.0;\n");return this.compileAndRun(t,[e])},e.prototype.cosh=function(e){var t=new ti(e.shape,"\n  float e2x = exp(-x);\n  return (e2x + 1.0 / e2x) / 2.0;\n");return this.compileAndRun(t,[e])},e.prototype.tanh=function(e){var t=new ti(e.shape,"\n  float e2x = exp(-2.0 * abs(x));\n  return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n");return this.compileAndRun(t,[e])},e.prototype.asinh=function(e){var t=new ti(e.shape,"return log(x + sqrt(x * x + 1.0));");return this.compileAndRun(t,[e])},e.prototype.acosh=function(e){var t=new ti(e.shape,ui),n=t.getCustomSetupFunc();return this.compileAndRun(t,[e],null,n)},e.prototype.atanh=function(e){var t=new ti(e.shape,ci),n=t.getCustomSetupFunc();return this.compileAndRun(t,[e],null,n)},e.prototype.erf=function(e){var t=new ti(e.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(t,[e])},e.prototype.step=function(e,t){var n=new ti(e.shape,function(e){return void 0===e&&(e=0),ni+"\n    return x > 0.0 ? 1.0 : float("+e+");\n  "}(t));return this.compileAndRun(n,[e])},e.prototype.conv2d=function(e,t,n){var r=new Jt(n);return this.compileAndRun(r,[e,t])},e.prototype.conv2dDerInput=function(e,t,n){var r=new Yt(n);return this.compileAndRun(r,[e,t])},e.prototype.conv2dDerFilter=function(e,t,n){var r=new Kt(n);return this.compileAndRun(r,[e,t])},e.prototype.depthwiseConv2D=function(e,t,n){var r=new Qt(n);return this.compileAndRun(r,[e,t])},e.prototype.depthwiseConv2DDerInput=function(e,t,n){var r=new Zt(n);return this.compileAndRun(r,[e,t])},e.prototype.depthwiseConv2DDerFilter=function(e,t,n){var r=new Xt(n);return this.compileAndRun(r,[e,t])},e.prototype.maxPool=function(e,t){var n=new Br(t,"max",!1),r=this.makeOutputArray(n.outputShape,e.dtype);return this.compileAndRun(n,[e],r)},e.prototype.avgPool=function(e,t){var n=new Br(t,"avg",!1),r=this.makeOutputArray(n.outputShape,"float32");return this.compileAndRun(n,[e],r)},e.prototype.maxPoolBackprop=function(e,t,n,r){var i=new Br(r,"max",!0),o=this.compileAndRun(i,[t]),a=new kr(r),s=this.makeOutputArray(a.outputShape,t.dtype),u=this.compileAndRun(a,[e,o],s);return o.dispose(),u},e.prototype.avgPoolBackprop=function(e,t,n){var r=new Dt(n),i=this.makeOutputArray(r.outputShape,t.dtype);return this.compileAndRun(r,[e],i)},e.prototype.cast=function(e,t){return At(e,t,this)},e.prototype.reshape=function(e,t){return Mt(e,t)},e.prototype.resizeBilinear=function(e,t,n,r){var i=new zr(e.shape,t,n,r);return this.compileAndRun(i,[e])},e.prototype.resizeBilinearBackprop=function(e,t,n){var r=new Fr(e,t,n);return this.compileAndRun(r,[e])},e.prototype.resizeNearestNeighbor=function(e,t,n,r){var i=new Ur(e.shape,t,n,r);return this.compileAndRun(i,[e])},e.prototype.resizeNearestNeighborBackprop=function(e,t,n){var r=new Vr(e,t,n);return this.compileAndRun(r,[e])},e.prototype.multinomial=function(e,t,n,r){var i=t?e:Qe(e),o=i.shape[0],a=i.shape[1],s=new Pr(o,a,n),u=this.makeOutputArray(s.outputShape,"int32"),c=s.getCustomSetupFunc(r);return this.compileAndRun(s,[i],u,c)},e.prototype.oneHot=function(e,t,n,r){var i=new Rr(e.size,t,n,r);return this.compileAndRun(i,[e])},e.prototype.nonMaxSuppression=function(e,t,n,r,i){return ke("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead"),kt(e.dataSync(),t.dataSync(),n,r,i)},e.prototype.cropAndResize=function(e,t,n,r,i,o){var a=new en(e.shape,t.shape,r,i,o);return this.compileAndRun(a,[e,t,n])},e.prototype.depthToSpace=function(e,t,n){p(t>1,"blockSize should be > 1 for depthToSpace, but was: "+t);var r=e.shape[0],i=("NHWC"===n?e.shape[1]:e.shape[2])*t,o=("NHWC"===n?e.shape[2]:e.shape[3])*t,a=("NHWC"===n?e.shape[3]:e.shape[1])/(t*t),s=new pn("NHWC"===n?[r,i,o,a]:[r,a,i,o],t,n);return this.compileAndRun(s,[e])},e.prototype.split=function(e,t,n){return Tt(e,t,n)},e.prototype.makeOutputArray=function(e,t){return ee.make(e,{},t)},e.prototype.compileAndRun=function(e,t,n,r,i){var o=this;if(void 0===i&&(i=!0),null==n&&(n=this.makeOutputArray(e.outputShape,t[0].dtype)),0===n.size)return this.texData.get(n.dataId).values=M(n.dtype,0),n;var a=t.map(function(e){if("complex64"===e.dtype)throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");var t=o.texData.get(e.dataId);return null==t.texture&&v(e.shape)<=32?{shape:e.shape,texData:null,isUniform:!0,uniformValues:o.readSync(e.dataId)}:(o.uploadToGPU(e.dataId),{shape:e.shape,texData:t,isUniform:!1})});this.uploadToGPU(n.dataId);var s,u={shape:n.shape,texData:this.texData.get(n.dataId),isUniform:!1},c=function(e,t,n){var r="";t.concat(n).forEach(function(e){r+=e.shape+"_"+(e.isUniform?"uniform":e.texData.texShape)});var i=e.userCode,o=(!0===e.supportsBroadcasting).toString();return e.constructor.name+"_"+o+"_"+r+"_"+i}(e,a,u),l=this.getAndSaveBinary(c,function(){return function(e,t,n,r){for(var i=t.userCode,o=n.map(function(e,n){var r={logicalShape:e.shape,texShape:e.isUniform?null:e.texData.texShape,isUniform:e.isUniform,isPacked:!e.isUniform&&e.texData.usage===dn.PACK};return{name:t.variableNames[n],shapeInfo:r}}),a=o.map(function(e){return e.shapeInfo}),s={logicalShape:r.shape,texShape:r.texData.texShape,isUniform:!1,isPacked:r.texData.usage===dn.PACK},u=tn(o,s,i,!0===t.supportsBroadcasting),c=e.createProgram(u),l={},h=0;h<t.variableNames.length;h++){var d=t.variableNames[h];l[d]=e.getUniformLocation(c,d,!1)}return{program:t,source:u,webGLProgram:c,uniformLocations:l,gpgpu:e,inShapeInfos:a,outShapeInfo:s}}(o.gpgpu,e,a,u)}),h=null!=this.activeTimers;if(h&&(s=this.startTimer()),function(e,t,n,r){Ar(e.inShapeInfos,t),Ar([e.outShapeInfo],[n]);var i=n.texData.texture,o=n.texData.texShape,a=e.gpgpu;n.texData.usage===dn.PACK?a.setOutputPackedMatrixTexture(i,o[0],o[1]):a.setOutputMatrixTexture(i,o[0],o[1]),a.setProgram(e.webGLProgram),t.forEach(function(t,n){var r=e.program.variableNames[n],i=e.uniformLocations[r];if(null!=i){if(t.isUniform){if(1===v(t.shape))a.gl.uniform1f(i,t.uniformValues[0]);else{var o=t.uniformValues;o instanceof Float32Array||(o=new Float32Array(o)),a.gl.uniform1fv(i,o)}return}var s=t.texData.texture;a.setInputMatrixTexture(s,i,n)}}),null!=r&&r(a,e.webGLProgram),a.executeProgram()}(l,a,u,r),i&&this.numBytesInGPU>this.NUM_BYTES_BEFORE_PAGING)for(var d=this.numBytesInGPU-this.NUM_BYTES_BEFORE_PAGING;d>0&&this.lruDataGPU.length>0;){var f=this.lruDataGPU.shift(),p=this.texData.get(f),m=p.shape,g=p.dtype;d-=this.computeBytes(m,g),this.read(f)}return h&&(s=this.endTimer(s),this.activeTimers.push(this.getQueryTime(s))),n},e.prototype.getAndSaveBinary=function(e,t){return e in this.binaryCache||(this.binaryCache[e]=t()),this.binaryCache[e]},e.prototype.getTextureManager=function(){return this.textureManager},e.prototype.dispose=function(){if(!this.disposed){for(var e in this.binaryCache)this.gpgpu.deleteProgram(this.binaryCache[e].webGLProgram);this.textureManager.dispose(),this.canvas.remove(),null!=this.fromPixelsCanvas&&this.fromPixelsCanvas.remove(),this.gpgpuCreatedLocally&&this.gpgpu.dispose(),this.disposed=!0}},e.prototype.floatPrecision=function(){var e=this;return Ce(function(){return e.abs(it(1e-8)).get()>0?32:16})},e.prototype.throwIfNoData=function(e){if(!this.texData.has(e))throw new Error("WebGL backend: No data found for this tensor. Did you change your backend in the middle of the program? New backends can't use Tensors created with previous backends")},e.prototype.uploadToGPU=function(e){this.throwIfNoData(e);var t=this.texData.get(e),n=t.shape,r=t.values,i=t.texture,o=(t.dtype,t.usage);if(null==i){var a,s=null!=this.activeTimers;s&&(a=performance.now());var u=nr(this.gpgpu.gl,n);t.texShape=u;var c=this.acquireTexture(e,u,o);t.texture=c,null!=r&&(this.gpgpu.uploadMatrixToTexture(c,u[0],u[1],function(e,t){return e instanceof Float32Array?e:new Float32Array(e)}(r)),t.values=null,s&&(this.uploadWaitMs+=performance.now()-a))}else this.lruDataGPU.indexOf(e)>=0&&(this.lruDataGPU.splice(this.lruDataGPU.indexOf(e),1),this.lruDataGPU.push(e))},e.prototype.cacheOnCPU=function(e,t){var n=this.delayedStorage,r=this.texData.get(e),i=r.texture,o=r.texShape,a=r.dtype,s=r.usage;n&&null!=i&&(this.releaseTexture(e,i,o,s),r.texture=null,r.texShape=null),r.usage=dn.UPLOAD,null!=t&&(r.values=function(e,t){if("float32"===t||"complex64"===t)return e;if("int32"===t||"bool"===t){for(var n="int32"===t?new Int32Array(e.length):new Uint8Array(e.length),r=0;r<n.length;++r)n[r]=Math.round(e[r]);return n}throw new Error("Unknown dtype "+t)}(t,a))},e.prototype.releaseTexture=function(e,t,n,r){var i=this.texData.get(e),o=i.shape,a=i.dtype,s=this.lruDataGPU.indexOf(e);s>=0&&this.lruDataGPU.splice(s,1),this.numBytesInGPU-=this.computeBytes(o,a),this.textureManager.releaseTexture(t,n,r)},e.prototype.acquireTexture=function(e,t,n){var r=this.texData.get(e),i=r.shape,o=r.dtype;return this.lruDataGPU.push(e),this.numBytesInGPU+=this.computeBytes(i,o),this.textureManager.acquireTexture(t,n)},e.prototype.computeBytes=function(e,t){return v(e)*P(t)},e}();ge.get("IS_BROWSER")&&ge.registerBackend("webgl",function(){return new ro},2,Q);var io=Je({abs_:function(e){var t=Xe(e,"x","abs");return ge.engine.runKernel(function(e){return e.abs(t)},{$x:t},function(e){return{$x:function(){return e.mulStrict(t.toFloat().step(-1))}}})}}),oo=Je({acos_:function(e){var t=Xe(e,"x","acos");return ge.engine.runKernel(function(e){return e.acos(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(it(1).sub(t.toFloat().square()).sqrt()).neg()}}})}}),ao=Je({acosh_:function(e){var t=Xe(e,"x","acosh");return ge.engine.runKernel(function(e){return e.acosh(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(t.toFloat().square().sub(it(1)).sqrt())}}})}}),so=Je({asin_:function(e){var t=Xe(e,"x","asin");return ge.engine.runKernel(function(e){return e.asin(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(it(1).sub(t.toFloat().square()).sqrt())}}})}}),uo=Je({asinh_:function(e){var t=Xe(e,"x","asinh");return ge.engine.runKernel(function(e){return e.asinh(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(it(1).add(t.toFloat().square()).sqrt())}}})}}),co=Je({atan_:function(e){var t=Xe(e,"x","atan");return ge.engine.runKernel(function(e){return e.atan(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(it(1).add(t.toFloat().square()))}}})}}),lo=Je({atanh_:function(e){var t=Xe(e,"x","atanh");return ge.engine.runKernel(function(e){return e.atanh(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(it(1).sub(t.toFloat().square()))}}})}}),ho=Je({ceil_:function(e){var t=Xe(e,"x","ceil");return ge.engine.runKernel(function(e){return e.ceil(t)},{$x:t},function(e){return{$x:function(){return Et(e)}}})}}),fo=Je({clipByValue_:function(e,t,n){var r=Xe(e,"x","clipByValue");return p(t<=n,"Error in clip: min ("+t+") must be less than or equal to max ("+n+")."),ge.engine.runKernel(function(e){return e.clip(r,t,n)},{$x:r},function(e){return{$x:function(){return e.where(r.greaterEqual(it(t)).logicalAnd(r.lessEqual(it(n))),Et(e))}}})}}),po=Je({cos_:function(e){var t=Xe(e,"x","cos");return ge.engine.runKernel(function(e){return e.cos(t)},{$x:t},function(e){return{$x:function(){return t.toFloat().sin().neg().mulStrict(e)}}})}}),mo=Je({cosh_:function(e){var t=Xe(e,"x","cosh");return ge.engine.runKernel(function(e){return e.cosh(t)},{$x:t},function(e){return{$x:function(){return t.toFloat().sinh().mulStrict(e)}}})}}),go=Je({erf_:function(e){var t=Xe(e,"x","erf");return p("int32"===t.dtype||"float32"===t.dtype,"Input dtype must be `int32` or `float32`."),"int32"===t.dtype&&(t=t.toFloat()),ge.engine.runKernel(function(e){return e.erf(t)},{$x:t},function(e){return{$x:function(){return e.mulStrict(it(2/Math.sqrt(Math.PI)).mul(t.square().neg().exp()))}}})}}),bo=Je({exp_:function(e){var t=Xe(e,"x","exp");return ge.engine.runKernel(function(e,n){return n(e.exp(t))},{$x:t},function(e,t){var n=t[0];return{$x:function(){return e.mulStrict(n)}}})}}),yo=Je({expm1_:function(e){var t=Xe(e,"x","expm1");return ge.engine.runKernel(function(e){return e.expm1(t)},{$x:t},function(e){return{$x:function(){return e.mulStrict(t.exp())}}})}}),vo=Je({floor_:function(e){var t=Xe(e,"x","floor");return ge.engine.runKernel(function(e){return e.floor(t)},{$x:t},function(e){return{$x:function(){return Et(e)}}})}}),_o=Je({log_:function(e){var t=Xe(e,"x","log");return ge.engine.runKernel(function(e){return e.log(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(t.toFloat())}}})}}),wo=Je({log1p_:function(e){var t=Xe(e,"x","log1p");return ge.engine.runKernel(function(e){return e.log1p(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(t.add(it(1)))}}})}}),xo=Je({logSigmoid_:function(e){var t=Xe(e,"x","logSigmoid");return ge.engine.runKernel(function(e){return e.softplus(t.neg()).neg()},{$x:t},function(e){return{$x:function(){return e.mulStrict(t.neg().sigmoid())}}})}}),Eo=Je({neg_:function(e){var t=Xe(e,"x","neg");return ge.engine.runKernel(function(e){return e.neg(t)},{$x:t},function(e){return{$x:function(){return e.neg()}}})}}),So=Je({reciprocal_:function(e){var t=Xe(e,"x","reciprocal");return ge.engine.runKernel(function(e){return e.reciprocal(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(t.square().neg())}}})}}),Co=Je({round_:function(e){var t=Xe(e,"x","round");return ge.engine.runKernel(function(e){return e.round(t)},{$x:t},function(e){return{$x:function(){return Et(e)}}})}}),Oo=Je({rsqrt_:function(e){var t=Xe(e,"x","rsqrt");return ge.engine.runKernel(function(e){return e.rsqrt(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(t.pow(it(1.5)).mul(it(2))).neg()}}})}}),Ao=Je({sigmoid_:function(e){var t=Xe(e,"x","sigmoid");return ge.engine.runKernel(function(e,n){return n(e.sigmoid(t))},{$x:t},function(e,t){var n=t[0];return{$x:function(){return e.mulStrict(n.mul(it(1).sub(n)))}}})}}),Mo=Je({sign_:function(e){var t=Xe(e,"x","sign");return ge.engine.runKernel(function(e){return e.sign(t)},{$x:t},function(e){return{$x:function(){return Et(e)}}})}}),No=Je({sin_:function(e){var t=Xe(e,"x","sin");return ge.engine.runKernel(function(e){return e.sin(t)},{$x:t},function(e){return{$x:function(){return t.toFloat().cos().mulStrict(e)}}})}}),ko=Je({sinh_:function(e){var t=Xe(e,"x","sinh");return ge.engine.runKernel(function(e){return e.sinh(t)},{$x:t},function(e){return{$x:function(){return t.toFloat().cosh().mulStrict(e)}}})}}),Io=Je({softplus_:function(e){var t=Xe(e,"x","softplus");return ge.engine.runKernel(function(e){return e.softplus(t)},{$x:t},function(e){return{$x:function(){return e.mulStrict(t.sigmoid())}}})}}),To=Je({sqrt_:function(e){var t=Xe(e,"x","sqrt");return ge.engine.runKernel(function(e){return e.sqrt(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(t.toFloat().sqrt().mul(it(2)))}}})}}),Po=Je({square_:function(e){var t=Xe(e,"x","square");return ge.engine.runKernel(function(e){return e.square(t)},{$x:t},function(e){return{$x:function(){return e.mulStrict(t.toFloat().mul(it(2)))}}})}}),Ro=Je({step_:function(e,t){void 0===t&&(t=0);var n=Xe(e,"x","step");return ge.engine.runKernel(function(e){return e.step(n,t)},{$x:n},function(e){return{$x:function(){return Et(e)}}})}}),Do=Je({tan_:function(e){var t=Xe(e,"x","tan");return ge.engine.runKernel(function(e){return e.tan(t)},{$x:t},function(e){return{$x:function(){return e.divStrict(t.cos().square())}}})}}),Lo=Je({tanh_:function(e){var t=Xe(e,"x","tanh");return ge.engine.runKernel(function(e,n){return n(e.tanh(t))},{$x:t},function(e,t){var n=t[0];return{$x:function(){return it(1).sub(n.square()).mulStrict(e)}}})}});function Bo(e){return null==e?null:0===e.rank?e.as1D():1===e.rank?e:2===e.rank?e.as4D(1,1,e.shape[0],e.shape[1]):3===e.rank?e.as4D(1,e.shape[0],e.shape[1],e.shape[2]):e}var jo=Je({batchNormalization2d_:function(e,t,n,r,i,o){void 0===r&&(r=.001);var a,s,u=Xe(e,"x","batchNormalization"),c=Xe(t,"mean","batchNormalization"),l=Xe(n,"variance","batchNormalization");return null!=i&&(a=Xe(i,"scale","batchNormalization")),null!=o&&(s=Xe(o,"offset","batchNormalization")),p(2===u.rank,"Error in batchNormalization3D: x must be rank 3 but got rank "+u.rank+"."),p(2===c.rank||1===c.rank,"Error in batchNormalization2D: mean must be rank 2 or rank 1 but got rank "+c.rank+"."),p(2===l.rank||1===l.rank,"Error in batchNormalization2D: variance must be rank 2 or rank 1 but got rank "+l.rank+"."),null!=a&&p(2===a.rank||1===a.rank,"Error in batchNormalization2D: scale must be rank 2 or rank 1 but got rank "+a.rank+"."),null!=s&&p(2===s.rank||1===s.rank,"Error in batchNormalization2D: offset must be rank 2 or rank 1 but got rank "+s.rank+"."),Vo(u,c,l,r,a,s)}}),Fo=Je({batchNormalization3d_:function(e,t,n,r,i,o){void 0===r&&(r=.001);var a,s,u=Xe(e,"x","batchNormalization"),c=Xe(t,"mean","batchNormalization"),l=Xe(n,"variance","batchNormalization");return null!=i&&(a=Xe(i,"scale","batchNormalization")),null!=o&&(s=Xe(o,"offset","batchNormalization")),p(3===u.rank,"Error in batchNormalization3D: x must be rank 3 but got rank "+u.rank+"."),p(3===c.rank||1===c.rank,"Error in batchNormalization3D: mean must be rank 3 or rank 1 but got rank "+c.rank+"."),p(3===l.rank||1===l.rank,"Error in batchNormalization3D: variance must be rank 3 or rank 1 but got rank "+l.rank+"."),null!=a&&p(3===a.rank||1===a.rank,"Error in batchNormalization3D: scale must be rank 3 or rank 1 but got rank "+a.rank+"."),null!=s&&p(3===s.rank||1===s.rank,"Error in batchNormalization3D: offset must be rank 3 or rank 1 but got rank "+s.rank+"."),Vo(u,c,l,r,a,s)}}),zo=Je({batchNormalization4d_:function(e,t,n,r,i,o){void 0===r&&(r=.001);var a,s,u=Xe(e,"x","batchNormalization"),c=Xe(t,"mean","batchNormalization"),l=Xe(n,"variance","batchNormalization");return null!=i&&(a=Xe(i,"scale","batchNormalization")),null!=o&&(s=Xe(o,"offset","batchNormalization")),p(4===u.rank,"Error in batchNormalization4D: x must be rank 4 but got rank "+u.rank+"."),p(4===c.rank||1===c.rank,"Error in batchNormalization4D: mean must be rank 4 or rank 1 but got rank "+c.rank+"."),p(4===l.rank||1===l.rank,"Error in batchNormalization4D: variance must be rank 4 or rank 1 but got rank "+l.rank+"."),null!=a&&p(4===a.rank||1===a.rank,"Error in batchNormalization4D: scale must be rank 4 or rank 1 but got rank "+a.rank+"."),null!=s&&p(4===s.rank||1===s.rank,"Error in batchNormalization4D: offset must be rank 4 or rank 1 but got rank "+s.rank+"."),Vo(u,c,l,r,a,s)}}),Vo=Je({batchNormalization_:function(e,t,n,r,i,o){void 0===r&&(r=.001);var a,s,u,c=Xe(e,"x","batchNormalization"),l=Xe(t,"mean","batchNormalization"),h=Xe(n,"variance","batchNormalization");return null!=i&&(a=Xe(i,"scale","batchNormalization")),null!=o&&(s=Xe(o,"offset","batchNormalization")),p(l.rank===h.rank,"Batch normalization gradient requires mean and variance to have equal ranks."),p(null==s||l.rank===s.rank,"Batch normalization gradient requires mean and offset to have equal ranks."),p(null==a||l.rank===a.rank,"Batch normalization gradient requires mean and scale to have equal ranks."),u=0===c.rank||1===c.rank?c.as4D(1,1,1,c.size):2===c.rank?c.as4D(1,1,c.shape[0],c.shape[1]):3===c.rank?c.as4D(1,c.shape[0],c.shape[1],c.shape[2]):c,ge.engine.runKernel(function(e){return e.batchNormalization(u,Bo(l),Bo(h),r,Bo(a),Bo(s))},{$x:c,$mean:l,$variance:h,$scale:a,$offset:s},function(e){var t=null==a?it(1):a,n=Bt(l.shape,u.shape),i=[];if(1===l.rank){for(var o=0;o<u.shape.length-1;++o)i.push(u.shape[o]);i.push(1)}var s=c.sub(l),d=e.mul(t),f=Oo(h.add(it(r))),p=f.mul(f).mul(f).mul(it(-.5));return{$x:function(){return 1===l.rank?e.mul(Ji(f.as4D(1,1,1,l.shape[0]),i)).mul(t).reshape(c.shape):e.mul(f).mul(t).reshape(c.shape)},$mean:function(){var e=f.mul(it(-1)).mul(d);return 1===l.rank&&(e=e.sum(n)),e.reshape(l.shape)},$variance:function(){var e=p.mul(s).mul(d);return 1===l.rank&&(e=e.sum(n)),e.reshape(l.shape)},$scale:function(){var t=s.mul(f),r=e.mul(t);return 1===l.rank&&(r=r.sum(n)),r.reshape(l.shape)},$offset:function(){var t=e;return 1===l.rank&&(t=t.sum(n)),t.reshape(l.shape)}}}).reshape(c.shape)}});function Uo(e,t,n,r,i,o){void 0===o&&(o="channelsLast");var a,s=$o(t),u=s[0],c=s[1];if("channelsLast"===o)a=[u,c,e[3],e[3]];else{if("channelsFirst"!==o)throw new Error("Unknown dataFormat "+o);a=[u,c,e[1],e[1]]}return Wo(e,a,n,1,r,i,!1,o)}function Wo(e,t,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],h=u[2],d=u[3];if("channelsLast"===s)c=e[0],l=e[1],h=e[2],d=e[3];else{if("channelsFirst"!==s)throw new Error("Unknown dataFormat "+s);c=e[0],d=e[1],l=e[2],h=e[3]}var f,m=t[0],g=t[1],b=t[3],y=$o(n),v=y[0],_=y[1],x=$o(r),E=x[0],S=x[1],C=function(e,t,n,r,i,o,a,s){var u,c,l;if("number"==typeof e){u={top:e,bottom:e,left:e,right:e,type:0===e?"VALID":"NUMBER"};var h=function(e,t,n,r,i,o){null==i&&(i=function(e,t,n,r){void 0===r&&(r=1);var i=qo(t,r);return Math.floor((e[0]*(n-1)-n+i)/2)}(e,t,r));var a=e[0],s=e[1],u=Ho((a-t+2*i)/r+1,o);p(w(u),"The output # of rows ("+u+") must be an integer. Change the stride and/or zero pad parameters");var c=Ho((s-t+2*i)/r+1,o);return p(w(c),"The output # of columns ("+c+") must be an integer. Change the stride and/or zero pad parameters"),[u,c,n]}([t,n,1],o,1,r,e,s);c=h[0],l=h[1]}else if("same"===e){var d=((c=Math.ceil(t/r))-1)*r+o-t,f=((l=Math.ceil(n/i))-1)*i+a-n,m=Math.floor(d/2),g=d-m,b=Math.floor(f/2);u={top:m,bottom:g,left:b,right:f-b,type:"SAME"}}else{if("valid"!==e)throw Error("Unknown padding parameter: "+e);u={top:0,bottom:0,left:0,right:0,type:"VALID"},c=Math.ceil((t-o+1)/r),l=Math.ceil((n-a+1)/i)}return{padInfo:u,outHeight:c,outWidth:l}}(i,l,h,v,_,qo(m,E),qo(g,S),o),O=C.padInfo,A=C.outHeight,M=C.outWidth,N=a?b*d:b;return"channelsFirst"===s?f=[c,N,A,M]:"channelsLast"===s&&(f=[c,A,M,N]),{batchSize:c,dataFormat:s,inHeight:l,inWidth:h,inChannels:d,outHeight:A,outWidth:M,outChannels:N,padInfo:O,strideHeight:v,strideWidth:_,filterHeight:m,filterWidth:g,dilationHeight:E,dilationWidth:S,inShape:e,outShape:f,filterShape:t}}function $o(e){return"number"==typeof e?[e,e]:e}function qo(e,t){return t<=1?e:e+(e-1)*(t-1)}function Ho(e,t){if(!t)return e;switch(t){case"round":return Math.round(e);case"ceil":return Math.ceil(e);case"floor":return Math.floor(e);default:throw new Error("Unknown roundingMode "+t)}}var Go=Je({matMul_:function(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);var i=Xe(e,"a","matMul"),o=Xe(t,"b","matMul"),a=n?i.shape[i.rank-2]:i.shape[i.rank-1],s=r?o.shape[o.rank-1]:o.shape[o.rank-2],u=n?i.shape[i.rank-1]:i.shape[i.rank-2],c=r?o.shape[o.rank-2]:o.shape[o.rank-1],l=i.shape.slice(0,-2),h=o.shape.slice(0,-2),d=v(l),f=v(h);p(i.rank>=2&&o.rank>=2&&i.rank===o.rank,"Error in matMul: inputs must have the same rank of at least 2, got ranks "+i.rank+" and "+o.rank+"."),p(_(l,h),"Error in matMul: outer dimensions ("+l+") and ("+h+") of Tensors with shapes "+i.shape+" and "+o.shape+" must match."),p(a===s,"Error in matMul: inner shapes ("+a+") and ("+s+") of Tensors with shapes "+i.shape+" and "+o.shape+" and transposeA="+n+" and transposeB="+r+" must match.");var m=i.shape.slice(0,-2).concat([u,c]),g=n?i.as3D(d,a,u):i.as3D(d,u,a),b=r?o.as3D(f,c,s):o.as3D(f,s,c);return ge.engine.runKernel(function(e){return e.batchMatMul(g,b,n,r)},{$a:g,$b:b},function(e){return n||r?!n&&r?{$a:function(){return e.matMul(b.toFloat(),!1,!1)},$b:function(){return e.matMul(g.toFloat(),!0,!1)}}:n&&!r?{$a:function(){return b.toFloat().matMul(e,!1,!0)},$b:function(){return g.toFloat().matMul(e,!1,!1)}}:{$a:function(){return b.toFloat().matMul(e,!0,!0)},$b:function(){return e.matMul(g.toFloat(),!0,!0)}}:{$a:function(){return e.matMul(b.toFloat(),!1,!0)},$b:function(){return g.toFloat().matMul(e,!0,!1)}}}).reshape(m)}}),Ko=Je({dot_:function(e,t){var n=Xe(e,"t1","dot"),r=Xe(t,"t2","dot");p(!(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 p(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]))}}),Yo=Je({outerProduct_:function(e,t){var n=Xe(e,"v1","outerProduct"),r=Xe(t,"v2","outerProduct");return p(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 Xo(e,t,n,r,i,o){p(e.length===t.rank,"Length of inShape ("+e.length+") and rank of dy ("+t.rank+") must match");var a=e,s=t,u=!1;3===t.rank&&(u=!0,s=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]),a=[1,e[0],e[1],e[2]]);var c=a[3],l=s.shape[3];p(4===a.length,"Error in conv2dDerInput: inShape must be length 4, but got length "+a.length+"."),p(4===s.rank,"Error in conv2dDerInput: dy must be rank 4, but got rank "+s.rank),p(4===n.rank,"Error in conv2dDerInput: filter must be rank 4, but got rank "+n.rank),p(c===n.shape[2],"Error in conv2dDerInput: depth of input ("+c+") must match input depth for filter "+n.shape[2]+"."),p(l===n.shape[3],"Error in conv2dDerInput: depth of output ("+l+") must match output depth for filter "+n.shape[3]+"."),null!=o&&p(w(i),"Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+i+".");var h=Wo(a,n.shape,r,1,i,o),d=ge.engine.runKernel(function(e){return e.conv2dDerInput(s,n,h)},{dy4D:s});return u?d.as3D(d.shape[1],d.shape[2],d.shape[3]):d}function Zo(e){var t=function(e){return"number"==typeof e?[e,e]:e}(e),n=t[0],r=t[1];return 1===n&&1===r}function Jo(e,t){return Zo(e)||Zo(t)}var Qo=Je({conv1d_:function(e,t,n,r,i,o,a){void 0===i&&(i="NWC"),void 0===o&&(o=1);var s=Xe(e,"x","conv1d"),u=Xe(t,"filter","conv1d"),c=s,l=!1;2===s.rank&&(l=!0,c=s.as3D(1,s.shape[0],s.shape[1])),p(3===c.rank,"Error in conv1d: input must be rank 3, but got rank "+c.rank+"."),p(3===u.rank,"Error in conv1d: filter must be rank 3, but got rank "+u.rank+"."),null!=a&&p(w(r),"Error in conv1d: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+r+"."),p(c.shape[2]===u.shape[1],"Error in conv1d: depth of input ("+c.shape[2]+") must match input depth for filter "+u.shape[1]+"."),p(Jo(n,o),"Error in conv1D: Either stride or dilation must be 1. Got stride "+n+" and dilation '"+o+"'"),p("NWC"===i,"Error in conv1d: got dataFormat of "+i+" but only NWC is currently supported.");var h=u.as4D(1,u.shape[0],u.shape[1],u.shape[2]),d=c.as4D(c.shape[0],1,c.shape[1],c.shape[2]),f=ea(d,h,[1,n],r,"NHWC",[1,o],a);return l?f.as2D(f.shape[2],f.shape[3]):f.as3D(f.shape[0],f.shape[2],f.shape[3])}}),ea=Je({conv2d_:function(e,t,n,r,i,o,a){void 0===i&&(i="NHWC"),void 0===o&&(o=[1,1]);var s=Xe(e,"x","conv2d"),u=Xe(t,"filter","conv2d"),c=s,l=!1;3===s.rank&&(l=!0,c=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),p(4===c.rank,"Error in conv2d: input must be rank 4, but got rank "+c.rank+"."),p(4===u.rank,"Error in conv2d: filter must be rank 4, but got rank "+u.rank+"."),null!=a&&p(w(r),"Error in conv2d: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+r+"."),p(c.shape[3]===u.shape[2],"Error in conv2d: depth of input ("+c.shape[3]+") must match input depth for filter "+u.shape[2]+"."),p(Jo(n,o),"Error in conv2D: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+o+"'"),p("NHWC"===i,"Error in conv2d: got dataFormat of "+i+" but only NHWC is currently supported.");var h,d=Wo(c.shape,u.shape,n,o,r,a);if(1===d.filterHeight&&1===d.filterWidth&&1===d.dilationHeight&&1===d.dilationWidth&&1===d.strideHeight&&1===d.strideWidth&&"SAME"===d.padInfo.type){var f=c.reshape([-1,d.inChannels]),m=u.reshape([d.inChannels,d.outChannels]);h=Go(f,m).reshape(d.outShape)}else h=ge.engine.runKernel(function(e){return e.conv2d(c,u,d)},{x:c,$filter:u},function(e){return p(Zo(o),"Error in gradient of conv2D: dilation rates greater than 1 are notyet supported in gradients. Got dilations '"+o+"'"),{x:function(){return Xo(c.shape,e,u,n,r)},$filter:function(){return function(e,t,n,r,i,o){var a=e;3===e.rank&&(a=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]));var s=t;3===s.rank&&(s=t.as4D(1,t.shape[0],t.shape[1],t.shape[2])),p(4===a.rank,"Error in conv2dDerFilter: input must be rank 4, but got shape "+a.shape+"."),p(4===s.rank,"Error in conv2dDerFilter: dy must be rank 4, but got shape "+s.shape+"."),p(4===n.length,"Error in conv2dDerFilter: filterShape must be length 4, but got "+n+"."),p(a.shape[3]===n[2],"Error in conv2dDerFilter: depth of input "+a.shape[3]+") must match input depth in filter ("+n[2]+"."),p(s.shape[3]===n[3],"Error in conv2dDerFilter: depth of dy ("+s.shape[3]+") must match output depth for filter ("+n[3]+")."),null!=o&&p(w(i),"Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+i+".");var u=Wo(a.shape,n,r,1,i,o);return ge.engine.runKernel(function(e){return e.conv2dDerFilter(a,s,u)},{x4D:a,dy4D:s})}(c,e,u.shape,n,r)}}});return l?h.as3D(h.shape[1],h.shape[2],h.shape[3]):h}}),ta=Je({depthwiseConv2d_:function(e,t,n,r,i,o,a){void 0===i&&(i="NHWC"),void 0===o&&(o=[1,1]);var s=Xe(e,"x","depthwiseConv2d"),u=Xe(t,"filter","depthwiseConv2d"),c=s,l=!1;3===s.rank&&(l=!0,c=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),p(4===c.rank,"Error in depthwiseConv2d: input must be rank 4, but got rank "+c.rank+"."),p(4===u.rank,"Error in depthwiseConv2d: filter must be rank 4, but got rank "+u.rank+"."),p(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]),p(Jo(n,o),"Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+o+"'"),null!=a&&p(w(r),"Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+r+".");var h=Wo(c.shape,u.shape,n,o,r,a,!0),d=ge.engine.runKernel(function(e){return e.depthwiseConv2D(c,u,h)},{x:c,$filter:u},function(e){return p(Zo(o),"Error in gradient of depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+o+"'"),{x:function(){return function(e,t,n,r){var i=t,o=!1;3===t.rank&&(o=!0,i=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var a=ge.engine.runKernel(function(e){return e.depthwiseConv2DDerInput(i,n,r)},{dy4D:i});return o?a.as3D(a.shape[1],a.shape[2],a.shape[3]):a}(c.shape,e,u,h)},$filter:function(){return function(e,t,n,r){var i=e;3===e.rank&&(i=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]));var o=t;return 3===o.rank&&(o=t.as4D(1,t.shape[0],t.shape[1],t.shape[2])),ge.engine.runKernel(function(e){return e.depthwiseConv2DDerFilter(i,o,r)},{x4D:i,dy4D:o})}(c,e,u.shape,h)}}});return l?d.as3D(d.shape[1],d.shape[2],d.shape[3]):d}}),na=Je({separableConv2d_:function(e,t,n,r,i,o,a){void 0===o&&(o=[1,1]),void 0===a&&(a="NHWC");var s=Xe(e,"x","separableConv2d"),u=Xe(t,"depthwiseFilter","separableConv2d"),c=Xe(n,"pointwiseFilter","separableConv2d"),l=s,h=!1;if(3===s.rank&&(h=!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");p(4===l.rank,"Error in separableConv2d: input must be rank 4, but got rank "+l.rank+"."),p(4===u.rank,"Error in separableConv2d: depthwise filter must be rank 4, but got rank "+u.rank+"."),p(4===c.rank,"Error in separableConv2d: pointwise filter must be rank 4, but got rank "+u.rank+"."),p(1===c.shape[0],"Error in separableConv2d: the first dimension of pointwise filter  must be 1, but got "+c.shape[0]+"."),p(1===c.shape[1],"Error in separableConv2d: the second dimension of pointwise filter  must be 1, but got "+c.shape[1]+".");var d=u.shape[2],f=u.shape[3];p(c.shape[2]===d*f,"Error in separableConv2d: the third dimension of pointwise filter must be "+d*f+", but got "+c.shape[2]+".");var m=ta(l,u,r,i,a,o),g=ea(m,c,1,"valid",a);return h?g.as3D(g.shape[1],g.shape[2],g.shape[3]):g}}),ra=Je({conv2dTranspose_:function(e,t,n,r,i,o){return Xo(n,Xe(e,"x","conv2dTranspose"),Xe(t,"filter","conv2dTranspose"),r,i,o)}});var ia=Je({reverse_:function(e,t){var n=Xe(e,"x","reverse");if(0===n.rank)return n.clone();var r=Fe(t,n.shape);return ge.engine.runKernel(function(e){return e.reverse(n,r)},{$x:n},function(e){return{$x:function(){return e.reverse(r)}}}).reshapeAs(n)}}),oa=Je({reverse1d_:function(e){var t=Xe(e,"x","reverse");return p(1===t.rank,"Error in reverse1D: x must be rank 1 but got\n             rank "+t.rank+"."),ia(t,0)}}),aa=Je({reverse2d_:function(e,t){var n=Xe(e,"x","reverse");return p(2===n.rank,"Error in reverse2D: x must be rank 2 but got\n             rank "+n.rank+"."),ia(n,t)}}),sa=Je({reverse3d_:function(e,t){var n=Xe(e,"x","reverse");return p(3===n.rank,"Error in reverse3D: x must be rank 3 but got\n             rank "+n.rank+"."),ia(n,t)}}),ua=Je({reverse4d_:function(e,t){var n=Xe(e,"x","reverse");return p(4===n.rank,"Error in reverse4D: x must be rank 4 but got\n             rank "+n.rank+"."),ia(n,t)}});var ca=Je({maxPool_:function(e,t,n,r,i){var o=Xe(e,"x","maxPool"),a=o,s=!1;3===o.rank&&(s=!0,a=o.as4D(1,o.shape[0],o.shape[1],o.shape[2])),p(4===a.rank,"Error in maxPool: input must be rank 4 but got rank "+a.rank+"."),null!=i&&p(w(r),"Error in maxPool: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+r+".");var u=Uo(a.shape,t,n,r,i),c=ge.engine.runKernel(function(e,t){return t(e.maxPool(a,u))},{x:a},function(e,i){var o=i[0];return{x:function(){return function(e,t,n,r,i,o,a){var s=Xe(e,"dy","maxPoolBackprop"),u=Xe(t,"input","maxPoolBackprop"),c=Xe(n,"output","maxPoolBackprop");p(u.rank===s.rank,"Rank of input ("+u.rank+") does not match rank of dy ("+s.rank+")"),p(4===s.rank,"Error in maxPoolBackprop: dy must be rank 4 but got rank "+s.rank+"."),p(4===u.rank,"Error in maxPoolBackprop: input must be rank 4 but got rank "+u.rank+"."),null!=a&&p(w(o),"Error in maxPoolBackprop: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+o+".");var l=Uo(u.shape,r,i,o,a);return ge.engine.runKernel(function(e){return e.maxPoolBackprop(s,u,c,l)},{$dy:s,$input:u})}(e,a,o,t,n,r)}}});return s?c.as3D(c.shape[1],c.shape[2],c.shape[3]):c}}),la=Je({avgPool_:function(e,t,n,r,i){var o=Xe(e,"x","avgPool");p("float32"===o.dtype,"The input dtype to avgPool must be float32");var a=o,s=!1;3===o.rank&&(s=!0,a=o.as4D(1,o.shape[0],o.shape[1],o.shape[2])),p(4===a.rank,"Error in avgPool: x must be rank 4 but got rank "+a.rank+"."),null!=i&&p(w(r),"Error in avgPool: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+r+".");var u=Uo(a.shape,t,n,r),c=ge.engine.runKernel(function(e){return e.avgPool(a,u)},{x:a},function(e){return{x:function(){return function(e,t,n,r,i){var o=Xe(e,"dy","avgPoolBackprop"),a=Xe(t,"input","avgPoolBackprop");p(a.rank===o.rank,"Rank of input ("+a.rank+") does not match rank of dy ("+o.rank+")");var s=a,u=o,c=!1;3===a.rank&&(c=!0,s=a.as4D(1,a.shape[0],a.shape[1],a.shape[2]),u=o.as4D(1,o.shape[0],o.shape[1],o.shape[2])),p(4===u.rank,"Error in avgPoolBackprop: dy must be rank 4 but got rank "+u.rank+"."),p(4===s.rank,"Error in avgPoolBackprop: input must be rank 4 but got rank "+s.rank+".");var l=Uo(s.shape,n,r,i),h=ge.engine.runKernel(function(e){return e.avgPoolBackprop(u,s,l)},{dy4D:u,input4D:s});return c?h.as3D(h.shape[1],h.shape[2],h.shape[3]):h}(e,a,t,n,r)}}});return c=c.cast(o.dtype),s?c.as3D(c.shape[1],c.shape[2],c.shape[3]):c}});var ha=Je({slice_:function(e,t,n){var r,i,o=Xe(e,"x","slice");if(0===o.rank)throw new Error("Slicing scalar is not possible");r="number"==typeof t?[t].concat(new Array(o.rank-1).fill(0)):t.length<o.rank?t.concat(new Array(o.rank-t.length).fill(0)):t.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(e,t){return e>=0?e:(p(-1===e,"Bad value in size"),o.shape[t]-r[t])}),function(e,t,n){p(e.rank===t.length,"Error in slice"+e.rank+"D: Length of begin "+t+" must match the rank of the array ("+e.rank+")."),p(e.rank===n.length,"Error in slice"+e.rank+"D: Length of size "+n+" must match the rank of the array ("+e.rank+").");for(var r=0;r<e.rank;++r)p(t[r]+n[r]<=e.shape[r],"Error in slice"+e.rank+"D: begin["+r+"] + size["+r+"] ("+(t[r]+n[r])+") would overflow input.shape["+r+"] ("+e.shape[r]+")")}(o,r,i);var a=o.shape;return ge.engine.runKernel(function(e){return e.slice(o,r,i)},{$x:o},function(e){for(var t=[],n=0;n<e.rank;n++)t.push([r[n],a[n]-r[n]-i[n]]);return{$x:function(){return e.pad(t)}}})}}),da=Je({slice1d_:function(e,t,n){var r=Xe(e,"x","slice1d");return p(1===r.rank,"slice1d expects a rank-1 tensor, but got a rank-"+r.rank+" tensor"),ha(r,[t],[n])}}),fa=Je({slice2d_:function(e,t,n){var r=Xe(e,"x","slice2d");return p(2===r.rank,"slice1d expects a rank-2 tensor, but got a rank-"+r.rank+" tensor"),ha(r,t,n)}}),pa=Je({slice3d_:function(e,t,n){var r=Xe(e,"x","slice3d");return p(3===r.rank,"slice1d expects a rank-3 tensor, but got a rank-"+r.rank+" tensor"),ha(r,t,n)}}),ma=Je({slice4d_:function(e,t,n){var r=Xe(e,"x","slice4d");return p(4===r.rank,"slice1d expects a rank-4 tensor, but got a rank-"+r.rank+" tensor"),ha(r,t,n)}});function ga(e,t,n,r,i){var o=t[0];return o.rank<n.rank&&(o=o.reshape(je(o.shape,r))),e.rank<n.rank&&(e=e.reshape(je(e.shape,r))),{$x:function(){var t=e.mul(n.equal(o).cast(e.dtype));return null==i?t:t.transpose(i)}}}var ba=Je({all_:function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1);var r=Xe(e,"x","all","bool");p("bool"===r.dtype,"Error Tensor must be of type bool. Got: "+r.dtype);var i=Fe(t,r.shape),o=i,a=Ve(o,r.rank);null!=a&&(r=r.transpose(a),o=We(o.length,r.rank));var s=ge.engine.runKernel(function(e){return e.all(r,o)},{$x:r});if(n){var u=je(s.shape,i);return s.reshape(u)}return s}}),ya=Je({any_:function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1);var r=Xe(e,"x","any","bool");p("bool"===r.dtype,"Error Tensor must be of type bool. Got: "+r.dtype);var i=Fe(t,r.shape),o=i,a=Ve(o,r.rank);null!=a&&(r=r.transpose(a),o=We(o.length,r.rank));var s=ge.engine.runKernel(function(e){return e.any(r,o)},{$x:r});if(n){var u=je(s.shape,i);return s.reshape(u)}return s}}),va=Je({argMax_:function(e,t){void 0===t&&(t=0);var n=Xe(e,"x","argMax");null==t&&(t=0);var r=Fe(t,n.shape),i=Ve(r,n.rank);return null!=i&&(n=n.transpose(i),r=We(r.length,n.rank)),ge.engine.runKernel(function(e){return e.argMax(n,r[0])},{$x:n},function(e){return{$x:function(){return Et(n)}}})}}),_a=Je({argMin_:function(e,t){void 0===t&&(t=0);var n=Xe(e,"x","argMin");null==t&&(t=0);var r=Fe(t,n.shape),i=Ve(r,n.rank);return null!=i&&(n=n.transpose(i),r=We(r.length,n.rank)),ge.engine.runKernel(function(e){return e.argMin(n,r[0])},{$x:n},function(e){return{$x:function(){return Et(n)}}})}}),wa=Je({logSumExp_:function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1);var r=Xe(e,"x","logSumExp"),i=Fe(t,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=je(s.shape,i);return s.reshape(u)}return s}}),xa=Je({max_:function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1);var r=Xe(e,"x","max"),i=r,o=Fe(t,r.shape),a=o,s=Ve(a,r.rank);null!=s&&(r=r.transpose(s),a=We(a.length,r.rank));var u=ge.engine.runKernel(function(e,t){return t(e.max(r,a))},{$x:r},function(e,t){return ga(e,t,i,o,s)});if(n){var c=je(u.shape,o);u=u.reshape(c)}return u}}),Ea=Je({mean_:function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1);var r=Xe(e,"x","mean"),i=Fe(t,r.shape),o=v(Be(r.shape,i)[1]);return Ee(function(e){var r=it(o);return{value:(r.dtype===e.dtype?e:e.cast(r.dtype)).div(r).sum(t,n),gradFunc:function(t){var n=e.shape.slice();return i.forEach(function(e){n[e]=1}),t.reshape(n).mul(ht(e.shape,"float32")).div(r)}}})(r)}}),Sa=Je({min_:function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1);var r=Xe(e,"x","min"),i=r,o=Fe(t,r.shape),a=o,s=Ve(a,r.rank);null!=s&&(r=r.transpose(s),a=We(a.length,r.rank));var u=ge.engine.runKernel(function(e,t){return t(e.min(r,a))},{$x:r},function(e,t){return ga(e,t,i,o,s)});if(n){var c=je(u.shape,o);u=u.reshape(c)}return u}}),Ca=Je({moments_:function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1);var r=Fe(t,(e=Xe(e,"x","moments")).shape),i=e.mean(r,n),o=i.shape;return n||(o=je(i.shape,r)),{mean:i,variance:e.toFloat().sub(i.reshape(o)).square().mean(r,n)}}}),Oa=Je({sum_:function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=!1);var r=Xe(e,"x","sum");"bool"===r.dtype&&(r=r.toInt());var i=Fe(t,r.shape);return Ee(function(e){var t=Ve(i,e.rank),r=i,o=e;null!=t&&(o=e.transpose(t),r=We(r.length,e.rank));var a=ge.engine.runKernel(function(e){return e.sum(o,r)},{permutedX:o});if(n){var s=je(a.shape,i);a=a.reshape(s)}return{value:a,gradFunc:function(t){var n=e.shape.slice();return i.forEach(function(e){n[e]=1}),t.reshape(n).mul(ht(e.shape,"float32"))}}})(r)}});var Aa=Je({equal_:function(e,t){var n=Xe(e,"a","equal"),r=Xe(t,"b","equal");return re(n,r),jt(n.shape,r.shape),ge.engine.runKernel(function(e){return e.equal(n,r)},{$a:n,$b:r})}}),Ma=Je({equalStrict_:function(e,t){var n=Xe(e,"a","equalStrict"),r=Xe(t,"b","equalStrict");return m(n.shape,r.shape,"Error in equalStrict: "),n.equal(r)}}),Na=Je({greater_:function(e,t){var n=Xe(e,"a","greater"),r=Xe(t,"b","greater");return re(n,r),jt(n.shape,r.shape),ge.engine.runKernel(function(e){return e.greater(n,r)},{$a:n,$b:r})}}),ka=Je({greaterEqual_:function(e,t){var n=Xe(e,"a","greaterEqual"),r=Xe(t,"b","greaterEqual");return re(n,r),jt(n.shape,r.shape),ge.engine.runKernel(function(e){return e.greaterEqual(n,r)},{$a:n,$b:r},function(e){return{$a:function(){return Et(n)},$b:function(){return Et(r)}}})}}),Ia=Je({greaterEqualStrict_:function(e,t){var n=Xe(e,"a","greaterEqualStrict"),r=Xe(t,"b","greaterEqualStrict");return m(n.shape,r.shape,"Error in greaterEqualStrict: "),n.greaterEqual(r)}}),Ta=Je({greaterStrict_:function(e,t){var n=Xe(e,"a","greaterStrict"),r=Xe(t,"b","greaterStrict");return m(n.shape,r.shape,"Error in greaterStrict: "),n.greater(r)}}),Pa=Je({less_:function(e,t){var n=Xe(e,"a","less"),r=Xe(t,"b","less");return re(n,r),jt(n.shape,r.shape),ge.engine.runKernel(function(e){return e.less(n,r)},{$a:n,$b:r})}}),Ra=Je({lessEqual_:function(e,t){var n=Xe(e,"a","lessEqual"),r=Xe(t,"b","lessEqual");return re(n,r),jt(n.shape,r.shape),ge.engine.runKernel(function(e){return e.lessEqual(n,r)},{$a:n,$b:r})}}),Da=Je({lessEqualStrict_:function(e,t){var n=Xe(e,"a","lessEqualStrict"),r=Xe(t,"b","lessEqualStrict");return m(n.shape,r.shape,"Error in lessEqualStrict: "),n.lessEqual(r)}}),La=Je({lessStrict_:function(e,t){var n=Xe(e,"a","lessStrict"),r=Xe(t,"b","lessStrict");return m(n.shape,r.shape,"Error in lessStrict: "),n.less(r)}}),Ba=Je({notEqual_:function(e,t){var n=Xe(e,"a","notEqual"),r=Xe(t,"b","notEqual");return re(n,r),jt(n.shape,r.shape),ge.engine.runKernel(function(e){return e.notEqual(n,r)},{$a:n,$b:r})}}),ja=Je({notEqualStrict_:function(e,t){var n=Xe(e,"a","notEqualStrict"),r=Xe(t,"b","notEqualStrict");return m(n.shape,r.shape,"Error in notEqualStrict: "),n.notEqual(r)}});var Fa=Je({add_:function(e,t){var n=Xe(e,"a","add"),r=Xe(t,"b","add");re(n,r);var i=jt(n.shape,r.shape);return ge.engine.runKernel(function(e){return e.add(n,r)},{$a:n,$b:r},function(e){return{$a:function(){var t=e,r=Bt(n.shape,i);return r.length>0&&(t=t.sum(r)),t.reshape(n.shape)},$b:function(){var t=e,n=Bt(r.shape,i);return n.length>0&&(t=t.sum(n)),t.reshape(r.shape)}}})}}),za=Je({addN_:function(e){p(Array.isArray(e),function(){return"The argument passed to tf.addN() must be a list of tensors"}),p(e.length>=1,function(){return"Must pass at least one tensor to tf.addN(), but got "+e.length});var t=e.map(function(e,t){return Xe(e,"tensors"+t,"addN")}),n=t[0];t.forEach(function(e){if(e.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),t.forEach(function(e){if(!_(e.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});var r=t;return ge.engine.runKernel(function(e){return e.addN(t)},r,function(e){var n={};return t.forEach(function(t,r){n[r]=function(){return e.clone()}}),n})}}),Va=Je({addStrict_:function(e,t){return m(e.shape,t.shape,"Error in addStrict: "),e.add(t)}}),Ua=Je({atan2_:function(e,t){var n=Xe(e,"a","atan2"),r=Xe(t,"b","atan2");re(n,r);var i=jt(n.shape,r.shape);return ge.engine.runKernel(function(e){return e.atan2(n,r)},{$a:n,$b:r},function(e){return{$a:function(){var t=Fa(n.square(),r.square()),o=e.mul(r.div(t)),a=Bt(n.shape,i);return a.length>0&&(o=o.sum(a)),o.reshape(n.shape)},$b:function(){var t=Fa(n.square(),r.square()),o=Eo(e.mul(n.div(t))),a=Bt(r.shape,i);return a.length>0&&(o=o.sum(a)),o.reshape(r.shape)}}})}}),Wa=Je({div_:function(e,t){var n,r=Xe(e,"a","div"),i=Xe(t,"b","div");if(re(r,i),"int32"===r.dtype&&"int32"===i.dtype)return qa(r,i);n=function(e){return e.realDivide(r,i)};var o=jt(r.shape,i.shape);return ge.engine.runKernel(n,{$a:r,$b:i},function(e){return{$a:function(){var t=e.div(i.toFloat()),n=Bt(r.shape,o);return n.length>0?t.sum(n).reshape(r.shape):t},$b:function(){var t=e.mul(r.toFloat()),n=Bt(i.shape,o);n.length>0&&(t=t.sum(n).reshape(i.shape));var a=i.square();return t.div(a.toFloat()).neg()}}})}}),$a=Je({divStrict_:function(e,t){return m(e.shape,t.shape,"Error in divideStrict: "),e.div(t)}}),qa=Je({floorDiv_:function(e,t){var n=Xe(e,"a","floorDiv"),r=Xe(t,"b","floorDiv");re(n,r);var i=jt(n.shape,r.shape);return ge.engine.runKernel(function(e){return e.floorDiv(n,r)},{$a:n,$b:r},function(e){return{$a:function(){var t=e.div(r.toFloat()),o=Bt(n.shape,i);return o.length>0?t.sum(o).reshape(n.shape):t},$b:function(){var t=e.mul(n.toFloat()),o=Bt(r.shape,i);o.length>0&&(t=t.sum(o).reshape(r.shape));var a=r.square();return t.div(a.toFloat()).neg()}}})}}),Ha=Je({maximum_:function(e,t){var n=Xe(e,"a","maximum"),r=Xe(t,"b","maximum");return re(n,r),"bool"===n.dtype&&(n=n.toInt()),"bool"===r.dtype&&(r=r.toInt()),jt(n.shape,r.shape),ge.engine.runKernel(function(e){return e.maximum(n,r)},{$a:n,$b:r},function(e){return{$a:function(){return e.mul(n.greaterEqual(r).toFloat())},$b:function(){return e.mul(n.less(r).toFloat())}}})}}),Ga=Je({maximumStrict_:function(e,t){return m(e.shape,t.shape,"Error in maximumStrict: "),e.maximum(t)}}),Ka=Je({minimum_:function(e,t){var n=Xe(e,"a","minimum"),r=Xe(t,"b","minimum");return re(n,r),"bool"===n.dtype&&(n=n.toInt()),"bool"===r.dtype&&(r=r.toInt()),jt(n.shape,r.shape),ge.engine.runKernel(function(e){return e.minimum(n,r)},{$a:n,$b:r},function(e){return{$a:function(){return e.mul(n.lessEqual(r).toFloat())},$b:function(){return e.mul(n.greater(r).toFloat())}}})}}),Ya=Je({minimumStrict_:function(e,t){return m(e.shape,t.shape,"Error in minimumStrict: "),e.minimum(t)}}),Xa=Je({mod_:function(e,t){var n=Xe(e,"a","mod"),r=Xe(t,"b","mod");re(n,r);var i=jt(n.shape,r.shape);return ge.engine.runKernel(function(e){return e.mod(n,r)},{$a:n,$b:r},function(e){return{$a:function(){var t=Bt(n.shape,i);return t.length>0?e.sum(t).reshape(n.shape):e},$b:function(){var t=e.mul(n.div(r).floor().neg()),o=Bt(r.shape,i);return o.length>0?t.sum(o).reshape(r.shape):t}}})}}),Za=Je({modStrict_:function(e,t){return m(e.shape,t.shape,"Error in modStrict: "),e.mod(t)}}),Ja=Je({mul_:function(e,t){var n=Xe(e,"a","mul"),r=Xe(t,"b","mul");re(n,r);var i=jt(n.shape,r.shape);return ge.engine.runKernel(function(e){return e.multiply(n,r)},{$a:n,$b:r},function(e){return{$a:function(){var t=e.mul(r.toFloat()),o=Bt(n.shape,i);return o.length>0?t.sum(o).reshape(n.shape):t},$b:function(){var t=e.mul(n.toFloat()),o=Bt(r.shape,i);return o.length>0?t.sum(o).reshape(r.shape):t}}})}}),Qa=Je({mulStrict_:function(e,t){return m(e.shape,t.shape,"Error in multiplyStrict: "),e.mul(t)}}),es=Je({pow_:function(e,t){var n=Xe(e,"base","pow"),r=Xe(t,"exp","pow"),i=jt(n.shape,r.shape);return e=n.cast(Ct(n.dtype,r.dtype)),t=r.cast(Ct(n.dtype,r.dtype)),ge.engine.runKernel(function(e,t){return t(e.pow(n,r))},{$base:n,$exp:r},function(e,t){var o=t[0];return{$base:function(){var t=e.mul(r.toFloat().mul(o.div(n))),a=Bt(n.shape,i);return a.length>0&&(t=t.sum(a)),t.reshape(n.shape)},$exp:function(){var t=e.mul(o.mul(n.log()).toFloat()),a=Bt(r.shape,i);return a.length>0&&(t=t.sum(a)),t.reshape(r.shape)}}})}}),ts=Je({powStrict_:function(e,t){return m(e.shape,t.shape,"Error in powStrict: "),e.pow(t)}}),ns=Je({squaredDifference_:function(e,t){var n=Xe(e,"a","squaredDifference"),r=Xe(t,"b","squaredDifference");return re(n,r),jt(n.shape,r.shape),ge.engine.runKernel(function(e){return e.squaredDifference(n,r)},{$a:n,$b:r},function(e){var t=it(2);return{$a:function(){return e.mul(n.sub(r).mul(t))},$b:function(){return e.mul(r.sub(n).mul(t))}}})}}),rs=Je({squaredDifferenceStrict_:function(e,t){return m(e.shape,t.shape,"Error in squaredDifferenceStrict: "),e.squaredDifference(t)}}),is=Je({sub_:function(e,t){var n=Xe(e,"a","sub"),r=Xe(t,"b","sub");re(n,r);var i=jt(n.shape,r.shape);return ge.engine.runKernel(function(e){return e.subtract(n,r)},{$a:n,$b:r},function(e){return{$a:function(){var t=e,r=Bt(n.shape,i);return r.length>0&&(t=t.sum(r)),t.reshape(n.shape)},$b:function(){var t=e,n=Bt(r.shape,i);return n.length>0&&(t=t.sum(n)),t.neg().reshape(r.shape)}}})}}),os=Je({subStrict_:function(e,t){return m(e.shape,t.shape,"Error in subStrict: "),e.sub(t)}});var as=Je({logicalAnd_:function(e,t){var n=Xe(e,"a","logicalAnd","bool"),r=Xe(t,"b","logicalAnd","bool");return p("bool"===n.dtype&&"bool"===r.dtype,"Error Array must be of type bool."),jt(n.shape,r.shape),ge.engine.runKernel(function(e){return e.logicalAnd(n,r)},{$a:n,$b:r})}}),ss=Je({logicalNot_:function(e){var t=Xe(e,"x","logicalNot","bool");return p("bool"===t.dtype,"Error Array must be of type bool."),ge.engine.runKernel(function(e){return e.logicalNot(t)},{$x:t})}}),us=Je({logicalOr_:function(e,t){var n=Xe(e,"a","logicalOr","bool"),r=Xe(t,"b","logicalOr","bool");return p("bool"===n.dtype&&"bool"===r.dtype,"Error Array must be of type bool."),jt(n.shape,r.shape),ge.engine.runKernel(function(e){return e.logicalOr(n,r)},{$a:n,$b:r})}}),cs=Je({logicalXor_:function(e,t){var n=Xe(e,"a","logicalXor","bool"),r=Xe(t,"b","logicalXor","bool");return p("bool"===n.dtype&&"bool"===r.dtype,"Error Array must be of type bool."),jt(n.shape,r.shape),us(e,t).logicalAnd(as(e,t).logicalNot())}}),ls=Je({where_:function(e,t,n){var r=Xe(t,"a","where"),i=Xe(n,"b","where"),o=Xe(e,"condition","where","bool");return p("bool"===o.dtype,"Error Condition must be of type bool."),m(r.shape,i.shape,"Error in where: "),1===o.rank?p(o.shape[0]===r.shape[0],"The first dimension of `a` must match the size of `condition`."):m(o.shape,i.shape,"Error in where: "),ge.engine.runKernel(function(e){return e.select(o,r,i)},{$condition:o,$a:r,$b:i},function(e){return{$condition:function(){return Et(o)},$a:function(){return e.mul(o.cast(r.dtype))},$b:function(){return e.mul(o.logicalNot().cast(i.dtype))}}})}}),hs=function(e){return c(this,void 0,void 0,function(){var t,n,r;return l(this,function(i){switch(i.label){case 0:return p("bool"===(t=Xe(e,"condition","where","bool")).dtype,"Condition must be of type bool."),[4,t.data()];case 1:return n=i.sent(),r=to(t.shape,n),e!==t&&t.dispose(),[2,r]}})})};var ds=Je({elu_:function(e){var t=Xe(e,"x","elu");return ge.engine.runKernel(function(e,n){return n(e.elu(t))},{$x:t},function(e,t){var n=t[0];return{$x:function(){return ge.engine.runKernel(function(t){return t.eluDer(e,n)},{dy:e,y:n})}}})}}),fs=Je({leakyRelu_:function(e,t){void 0===t&&(t=.2);var n=Xe(e,"x","leakyRelu");return Ha(it(t).mul(n),n)}}),ps=Je({prelu_:function(e,t){var n=Xe(e,"x","prelu"),r=Xe(t,"alpha","prelu"),i=it(0);return Ha(i,n).add(r.mul(Ka(i,n)))}}),ms=Je({relu_:function(e){var t=Xe(e,"x","relu");return"bool"===t.dtype?t.toInt():ge.engine.runKernel(function(e){return e.relu(t)},{$x:t},function(e){var n=t.step();return{$x:function(){return e.mulStrict(n.toFloat())}}})}}),gs=Je({selu_:function(e){var t=Xe(e,"x","selu");return ge.engine.runKernel(function(e){return e.selu(t)},{$x:t},function(e){return{$x:function(){var n=t.greater(it(0)),r=it(Qr),i=it(ei),o=e.mul(i),a=e.mul(r).mul(t.toFloat().exp());return ls(n,o,a)}}})}});var bs=Je({transpose_:function(e,t){var n=Xe(e,"x","transpose");return null==t&&(t=n.shape.map(function(e,t){return t}).reverse()),p(n.rank===t.length,"Error in transpose: rank of input "+n.rank+" must match length of perm "+t+"."),t.forEach(function(e){p(e>=0&&e<n.rank,"All entries in 'perm' must be between 0 and "+(n.rank-1)+" but got "+t)}),n.rank<=1?n.clone():ge.engine.runKernel(function(e){return e.transpose(n,t)},{$x:n},function(e){var n=Ue(t);return{$x:function(){return e.transpose(n)}}})}});var ys=Je({localResponseNormalization_:function(e,t,n,r,i){void 0===t&&(t=5),void 0===n&&(n=1),void 0===r&&(r=1),void 0===i&&(i=.5);var o=Xe(e,"x","localResponseNormalization");p(4===o.rank||3===o.rank,"Error in localResponseNormalization: x must be rank 3 or 4 but got\n               rank "+o.rank+"."),p(w(t),"Error in localResponseNormalization: depthRadius must be an integer\n                     but got depthRadius "+t+".");var a=o,s=!1;3===o.rank&&(s=!0,a=o.as4D(1,o.shape[0],o.shape[1],o.shape[2]));var u=ge.engine.runKernel(function(e,o){return o(e.localResponseNormalization4D(a,t,n,r,i))},{x4D:a},function(e,o){var s=o[0];return{x4D:function(){return ge.engine.runKernel(function(o){return o.LRNGrad(e,a,s,t,n,r,i)},{})}}});return s?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}});var vs=Je({norm_:function(e,t,n,r){void 0===t&&(t="euclidean"),void 0===n&&(n=null),void 0===r&&(r=!1);var i=function e(t,n,r){if(void 0===r&&(r=null),0===t.rank)return t.abs();if(1!==t.rank&&null===r)return e(t.reshape([-1]),n,r);if(1===t.rank||"number"==typeof r||r instanceof Array&&1===r.length){if(1===n)return t.abs().sum(r);if(n===1/0)return t.abs().max(r);if(n===-1/0)return t.abs().min(r);if("euclidean"===n||2===n)return t.abs().pow(it(2,"int32")).sum(r).sqrt();throw new Error("Error in norm: invalid ord value: "+n)}if(r instanceof Array&&2===r.length){if(1===n)return t.abs().sum(r[0]).max(r[1]-1);if(n===1/0)return t.abs().sum(r[1]).max(r[0]);if(n===-1/0)return t.abs().sum(r[1]).min(r[0]);if("fro"===n||"euclidean"===n)return t.square().sum(r).sqrt();throw new Error("Error in norm: invalid ord value: "+n)}throw new Error("Error in norm: invalid axis: "+r)}(e=Xe(e,"x","norm"),t,n),o=i.shape;if(r){var a=Fe(n,e.shape);o=je(i.shape,a)}return i.reshape(o)}});function _s(e,t){for(var n=[],r=e;r<t;++r)n.push(r);return n}function ws(e){for(var t=[],n=0;n<e.length;++n)for(var r=0;r<e[n].length;++r)t.push(e[n][r]);return t}var xs=Je({gather_:function(e,t,n){void 0===n&&(n=0);var r=Xe(e,"x","gather"),i=Xe(t,"indices","gather","int32");return p("int32"===i.dtype,"Indices must be of dtype `int32`"),n=Fe(n,r.shape)[0],ge.engine.runKernel(function(e){return e.gather(r,i,n)},{$x:r},function(e){return{$x:function(){if(0===n)return Es(e,i,r.shape[n]);var t=r.shape,o=i.size,a=t.slice(0,n),s=a.length,u=t.slice(n,t.length).slice(1),c=u.length,l=_s(0,s),h=_s(s+1,s+1+c),d=ws([a,[o],u]),f=e.reshape(d),p=i.reshape([o]),m=ws([[s],l,h]),g=f.transpose(m),b=Es(g,p,r.shape[n]),y=Ue(m);return b.transpose(y)}}})}}),Es=Je({unsortedSegmentSum_:function(e,t,n){var r=Xe(e,"x","unsortedSegmentSum"),i=Xe(t,"segmentIds","unsortedSegmentSum","int32");return p("int32"===i.dtype,"segmentIds must be of dtype `int32`"),p(w(n),"numSegments must be of dtype int"),ge.engine.runKernel(function(e){return e.unsortedSegmentSum(r,i,n)},{$x:r},function(e){return{$x:function(){return function(e,t){for(var n=Ha(t,Et(t)),r=xs(e,n),i=ka(t,it(0,"int32")),o=r.rank-i.rank,a=0;a<o;++a)i=Di(i,a+1);i=as(i,ht(r.shape,"bool"));var s=Et(r);return ls(i,r,s)}(e,i)}}})}});var Ss=Je({basicLSTMCell_:function(e,t,n,r,i,o){var a=Xe(e,"forgetBias","basicLSTMCell"),s=Xe(t,"lstmKernel","basicLSTMCell"),u=Xe(n,"lstmBias","basicLSTMCell"),c=Xe(r,"data","basicLSTMCell"),l=Xe(i,"c","basicLSTMCell"),h=Xe(o,"h","basicLSTMCell"),d=c.concat(h,1).matMul(s).add(u),f=d.shape[0],p=d.shape[1]/4,m=[f,p],g=d.slice([0,0],m),b=d.slice([0,p],m),y=d.slice([0,2*p],m),v=d.slice([0,3*p],m),_=g.sigmoid().mulStrict(b.tanh()).addStrict(l.mulStrict(a.add(y).sigmoid()));return[_,_.tanh().mulStrict(v.sigmoid())]}}),Cs=Je({multiRNNCell_:function(e,t,n,r){for(var i=Xe(t,"data","multiRNNCell"),o=Ze(n,"c","multiRNNCell"),a=Ze(r,"h","multiRNNCell"),s=i,u=[],c=0;c<e.length;c++){var l=e[c](s,o[c],a[c]);u.push(l[0]),u.push(l[1]),s=l[1]}var h=[],d=[];for(c=0;c<u.length;c+=2)h.push(u[c]),d.push(u[c+1]);return[h,d]}});var Os=Je({movingAverage_:function(e,t,n,r,i){void 0===i&&(i=!0);var o=Xe(e,"v","movingAverage"),a=Xe(t,"x","movingAverage"),s=Xe(n,"decay","movingAverage");re(o,a),p(_(o.shape,a.shape),"Shape mismatch in v and x");var u=it(1),c=u.sub(s),l=a.sub(o).mul(c);if(i){p(null!=r,"When using zeroDebias: true, step is required.");var h=Xe(r,"step","movingAverage");l=l.div(u.sub(es(s,h)))}return o.add(l)}});var As=Je({stridedSlice_:function(e,t,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=Xe(e,"x","stridedSlice");return ge.engine.runKernel(function(e){return e.stridedSlice(c,t,n,r,i,o,a,s,u)},{$x:c})}});var Ms,Ns=Je({topk_:function(e,t,n){void 0===t&&(t=1),void 0===n&&(n=!0);var r=Xe(e,"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(t>i)throw new Error("'k' passed to topk() must be <= the last dimension ("+i+") but got "+t);var o=ge.engine.runKernel(function(e){return e.topk(r,t,n)},{$x:r});return{values:o[0],indices:o[1]}}});!function(e){e[e.NONE=0]="NONE",e[e.MEAN=1]="MEAN",e[e.SUM=2]="SUM",e[e.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"}(Ms||(Ms={}));var ks=Je({absoluteDifference_:function(e,t,n,r){void 0===r&&(r=Ms.SUM_BY_NONZERO_WEIGHTS);var i=Xe(e,"labels","absoluteDifference"),o=Xe(t,"predictions","absoluteDifference"),a=null;null!=n&&(a=Xe(n,"weights","absoluteDifference")),m(i.shape,o.shape,"Error in absoluteDifference: ");var s=i.sub(o).abs();return Is(s,a,r)}}),Is=Je({computeWeightedLoss_:function(e,t,n){void 0===n&&(n=Ms.SUM_BY_NONZERO_WEIGHTS);var r=Xe(e,"losses","computeWeightedLoss"),i=null;null!=t&&(i=Xe(t,"weights","computeWeightedLoss"));var o=null==i?r:r.mul(i);if(n===Ms.NONE)return o;if(n===Ms.SUM)return o.sum();if(n===Ms.MEAN){if(null==i)return o.mean();var a=v(r.shape)/v(i.shape),s=o.sum().div(i.sum());return a>1?s.div(it(a)):s}if(n===Ms.SUM_BY_NONZERO_WEIGHTS){if(null==i)return o.sum().div(it(r.size));var u=i.mul(ht(r.shape)).notEqual(it(0)).sum().toFloat();return o.sum().div(u)}throw Error("Unknown reduction: "+n)}}),Ts=Je({cosineDistance_:function(e,t,n,r,i){void 0===i&&(i=Ms.SUM_BY_NONZERO_WEIGHTS);var o=Xe(e,"labels","cosineDistance"),a=Xe(t,"predictions","cosineDistance"),s=null;null!=r&&(s=Xe(r,"weights","cosineDistance")),m(o.shape,a.shape,"Error in cosineDistance: ");var u=it(1).sub(o.mul(a).sum(n,!0));return Is(u,s,i)}}),Ps=Je({hingeLoss_:function(e,t,n,r){void 0===r&&(r=Ms.SUM_BY_NONZERO_WEIGHTS);var i=Xe(e,"labels","hingeLoss"),o=Xe(t,"predictions","hingeLoss"),a=null;null!=n&&(a=Xe(n,"weights","hingeLoss")),m(i.shape,o.shape,"Error in hingeLoss: ");var s=it(1);i=it(2).mul(i).sub(s);var u=s.sub(i.mul(o)).relu();return Is(u,a,r)}}),Rs=Je({huberLoss_:function(e,t,n,r,i){void 0===r&&(r=1),void 0===i&&(i=Ms.SUM_BY_NONZERO_WEIGHTS);var o=Xe(e,"labels","huberLoss"),a=Xe(t,"predictions","huberLoss"),s=null;null!=n&&(s=Xe(n,"weights","huberLoss")),m(o.shape,a.shape,"Error in huberLoss: ");var u=it(r),c=a.sub(o).abs(),l=Ka(c,u),h=c.sub(l),d=it(.5).mul(l.square()).add(u.mul(h));return Is(d,s,i)}}),Ds=Je({logLoss_:function(e,t,n,r,i){void 0===r&&(r=1e-7),void 0===i&&(i=Ms.SUM_BY_NONZERO_WEIGHTS);var o=Xe(e,"labels","logLoss"),a=Xe(t,"predictions","logLoss"),s=null;null!=n&&(s=Xe(n,"weights","logLoss")),m(o.shape,a.shape,"Error in logLoss: ");var u=it(1),c=it(r),l=o.mul(a.add(c).log()).neg().sub(u.sub(o).mul(u.sub(a).add(c).log()));return Is(l,s,i)}}),Ls=Je({meanSquaredError_:function(e,t,n,r){void 0===r&&(r=Ms.SUM_BY_NONZERO_WEIGHTS);var i=Xe(e,"labels","meanSquaredError"),o=Xe(t,"predictions","meanSquaredError"),a=null;null!=n&&(a=Xe(n,"weights","meanSquaredError")),m(i.shape,o.shape,"Error in meanSquaredError: ");var s=i.squaredDifference(o);return Is(s,a,r)}}),Bs=Je({sigmoidCrossEntropy_:function(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=Ms.SUM_BY_NONZERO_WEIGHTS);var o=Xe(e,"multiClassLabels","sigmoidCrossEntropy"),a=Xe(t,"logits","sigmoidCrossEntropy"),s=null;if(null!=n&&(s=Xe(n,"weights","sigmoidCrossEntropy")),m(o.shape,a.shape,"Error in sigmoidCrossEntropy: "),r>0){var u=it(r),c=it(1),l=it(.5);o=o.mul(c.sub(u)).add(l.mul(u))}var h=function(e,t){var n=Xe(e,"labels","sigmoidCrossEntropyWithLogits"),r=Xe(t,"logits","sigmoidCrossEntropyWithLogits");m(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 Is(h,s,i)}}),js=Je({softmaxCrossEntropy_:function(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=Ms.SUM_BY_NONZERO_WEIGHTS);var o=Xe(e,"onehotLabels","softmaxCrossEntropy"),a=Xe(t,"logits","softmaxCrossEntropy"),s=null;if(null!=n&&(s=Xe(n,"weights","softmaxCrossEntropy")),m(o.shape,a.shape,"Error in softmaxCrossEntropy: "),r>0){var u=it(r),c=it(1),l=it(o.shape[1]);o=o.mul(c.sub(u)).add(u.div(l))}var h=function(e,t,n){if(void 0===n&&(n=-1),-1===n&&(n=t.rank-1),n!==t.rank-1)throw Error("Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank "+t.rank+" and dim was "+n);return Ee(function(e,t){var r=t.logSumExp([n],!0),i=t.toFloat().sub(r);return{value:i.mul(e).neg().sum([n]),gradFunc:function(t){var r=je(t.shape,[n]);return[t.reshape(r).mul(e.toFloat().sub(i.exp())),t.reshape(r).mul(i.exp().sub(e.toFloat()))]}}})(e,t)}(o,a);return Is(h,s,i)}}),Fs=Object.freeze({get Reduction(){return Ms},absoluteDifference:ks,computeWeightedLoss:Is,cosineDistance:Ts,hingeLoss:Ps,huberLoss:Rs,logLoss:Ds,meanSquaredError:Ls,sigmoidCrossEntropy:Bs,softmaxCrossEntropy:js});function zs(e,t){return void 0===t&&(t=!1),ge.engine.tidy(function(){if(2!==e.shape.length)throw new Error("qr2d() requires a 2D Tensor, but got a "+e.shape.length+"D Tensor.");for(var n=e.shape[0],r=e.shape[1],i=Li(n),o=e.clone(),a=at([[1]],[1,1]),s=a.clone(),u=n>=r?r:n,c=function(e){var t,u=o,c=s,l=i;t=ge.engine.tidy(function(){var t=o.slice([e,e],[n-e,1]),u=t.norm(),c=o.slice([e,e],[1,1]),l=c.sign().neg(),h=c.sub(l.mul(u)),d=t.div(h);s=1===d.shape[0]?a.clone():a.concat(d.slice([1,0],[d.shape[0]-1,d.shape[1]]),0);var f=l.matMul(h).div(u).neg(),p=o.slice([e,0],[n-e,r]),m=f.mul(s);o=0===e?p.sub(m.matMul(s.transpose().matMul(p))):o.slice([0,0],[e,r]).concat(p.sub(m.matMul(s.transpose().matMul(p))),0);var g=i.slice([0,e],[n,i.shape[1]-e]);return i=0===e?g.sub(g.matMul(s).matMul(m.transpose())):i.slice([0,0],[n,e]).concat(g.sub(g.matMul(s).matMul(m.transpose())),1),[s,o,i]}),s=t[0],o=t[1],i=t[2],Ae([u,c,l])},l=0;l<u;++l)c(l);return!t&&n>r&&(i=i.slice([0,0],[n,r]),o=o.slice([0,0],[r,r])),[i,o]})}var Vs=Je({gramSchmidt_:function(e){var t;if(Array.isArray(e)){t=!1,p(null!=e&&e.length>0,"Gram-Schmidt process: input must not be null, undefined, or empty");for(var n=e[0].shape[0],r=1;r<e.length;++r)p(e[r].shape[0]===n,"Gram-Schmidt: Non-unique lengths found in the input vectors: ("+e[r].shape[0]+" vs. "+n+")")}else t=!0,e=gi(e,e.shape[0],0).map(function(e){return Xi(e,[0])});p(e.length<=e[0].shape[0],"Gram-Schmidt: Number of vectors ("+e.length+") exceeds number of dimensions ("+e[0].shape[0]+").");var i=[],o=e,a=function(e){i.push(ge.engine.tidy(function(){var t=o[e];if(e>0)for(var n=0;n<e;++n){var r=Oa(i[n].mulStrict(t)).mul(i[n]);t=t.sub(r)}return t.div(vs(t,"euclidean"))}))};for(r=0;r<e.length;++r)a(r);return t?Zi(i,0):i}}),Us=Je({qr_:function(e,t){if(void 0===t&&(t=!1),e.rank<2)throw new Error("qr() requires input tensor to have a rank >= 2, but got rank "+e.rank);if(2===e.rank)return zs(e,t);var n=e.shape.slice(0,e.shape.length-2).reduce(function(e,t){return e*t}),r=[],i=[];return eo(e.reshape([n,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0).forEach(function(e){var n=zs(e,t),o=n[0],a=n[1];r.push(o),i.push(a)}),[Zi(r,0).reshape(e.shape),Zi(i,0).reshape(e.shape)]}}),Ws=Object.freeze({gramSchmidt:Vs,qr:Us});function $s(e,t,n,r,i){null==r&&(r=.5),null==i&&(i=Number.NEGATIVE_INFINITY);var o=e.shape[0];return n=Math.min(n,o),p(0<=r&&r<=1,"iouThreshold must be in [0, 1], but was '"+r+"'"),p(2===e.rank,"boxes must be a 2D tensor, but was of rank '"+e.rank+"'"),p(4===e.shape[1],"boxes must have 4 columns, but 2nd dimension was "+e.shape[1]),p(1===t.rank,"scores must be a 1D tensor"),p(t.shape[0]===o,"scores has incompatible shape with boxes. Expected "+o+", but was "+t.shape[0]),{maxOutputSize:n,iouThreshold:r,scoreThreshold:i}}var qs=Je({resizeBilinear_:function(e,t,n){void 0===n&&(n=!1);var r=Xe(e,"images","resizeBilinear");p(3===r.rank||4===r.rank,"Error in resizeBilinear: x must be rank 3 or 4, but got rank "+r.rank+"."),p(2===t.length,"Error in resizeBilinear: new shape must 2D, but got shape "+t+".");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=t[0],s=t[1],u=ge.engine.runKernel(function(e,t){return e.resizeBilinear(i,a,s,n)},{batchImages:i},function(e,t){return{batchImages:function(){return ge.engine.runKernel(function(t){return t.resizeBilinearBackprop(e,i,n)},{})}}});return o?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),Hs=Je({resizeNearestNeighbor_:function(e,t,n){void 0===n&&(n=!1);var r=Xe(e,"images","resizeNearestNeighbor");p(3===r.rank||4===r.rank,"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank "+r.rank+"."),p(2===t.length,"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+t+"."),p("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=t[0],s=t[1],u=ge.engine.runKernel(function(e,t){return e.resizeNearestNeighbor(i,a,s,n)},{batchImages:i},function(e,t){return{batchImages:function(){return ge.engine.runKernel(function(t){return t.resizeNearestNeighborBackprop(e,i,n)},{})}}});return o?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),Gs=Je({nonMaxSuppression_:function(e,t,n,r,i){void 0===r&&(r=.5),void 0===i&&(i=Number.NEGATIVE_INFINITY);var o=Xe(e,"boxes","nonMaxSuppression"),a=Xe(t,"scores","nonMaxSuppression"),s=$s(o,a,n,r,i);return n=s.maxOutputSize,r=s.iouThreshold,i=s.scoreThreshold,ge.engine.runKernel(function(e){return e.nonMaxSuppression(o,a,n,r,i)},{$boxes:o})}}),Ks=function(e,t,n,r,i){return void 0===r&&(r=.5),void 0===i&&(i=Number.NEGATIVE_INFINITY),c(this,void 0,void 0,function(){var o,a,s,u,c,h;return l(this,function(l){switch(l.label){case 0:return o=Xe(e,"boxes","nonMaxSuppressionAsync"),a=Xe(t,"scores","nonMaxSuppressionAsync"),s=$s(o,a,n,r,i),n=s.maxOutputSize,r=s.iouThreshold,i=s.scoreThreshold,[4,o.data()];case 1:return u=l.sent(),[4,a.data()];case 2:return c=l.sent(),h=kt(u,c,n,r,i),o!==e&&o.dispose(),a!==t&&a.dispose(),[2,h]}})})},Ys=function(e,t,n,r,i,o){var a=Xe(e,"image","cropAndResize","float32"),s=Xe(t,"boxes","cropAndResize","float32"),u=Xe(n,"boxInd","cropAndResize","int32");i=i||"bilinear",o=o||0;var c=s.shape[0];return p(4===a.rank,"Error in cropAndResize: image must be rank 4,but got rank "+a.rank+"."),p(2===s.rank&&4===s.shape[1],"Error in cropAndResize: boxes must be have size ["+c+",4] but had shape "+s.shape+"."),p(1===u.rank&&u.shape[0]===c,"Error in cropAndResize: boxInd must be have size ["+c+"] but had shape "+s.shape+"."),p("int32"===u.dtype,"Error in cropAndResize: boxInd must be of dtype int32, but got dtype "+u.dtype+"."),p(2===r.length,"Error in cropAndResize: cropSize must be of length 2, but got length "+r.length+"."),p(r[0]>=1&&r[1]>=1,"cropSize must be atleast [1,1], but was "+r),p("bilinear"===i||"nearest"===i,"method must be bilinear or nearest, but was "+i),ge.engine.runKernel(function(e,t){return e.cropAndResize(a,s,u,r,i,o)},{$image:a,$boxes:s})},Xs=Object.freeze({resizeBilinear:qs,resizeNearestNeighbor:Hs,nonMaxSuppression:Gs,nonMaxSuppressionAsync:Ks,cropAndResize:Ys}),Zs=Object.freeze({image:Xs,linalg:Ws,losses:Fs,op:Je,batchNormalization2d:jo,batchNormalization3d:Fo,batchNormalization4d:zo,batchNormalization:Vo,complex:et,real:tt,imag:nt,concat:hi,concat1d:di,concat2d:fi,concat3d:pi,concat4d:mi,split:gi,conv1d:Qo,conv2d:ea,depthwiseConv2d:ta,separableConv2d:na,conv2dTranspose:ra,matMul:Go,dot:Ko,outerProduct:Yo,reverse:ia,reverse1d:oa,reverse2d:aa,reverse3d:sa,reverse4d:ua,maxPool:ca,avgPool:la,slice:ha,slice1d:da,slice2d:fa,slice3d:pa,slice4d:ma,abs:io,acos:oo,acosh:ao,asin:so,asinh:uo,atan:co,atanh:lo,ceil:ho,clipByValue:fo,cos:po,cosh:mo,erf:go,exp:bo,expm1:yo,floor:vo,log:_o,log1p:wo,logSigmoid:xo,neg:Eo,reciprocal:So,round:Co,rsqrt:Oo,sigmoid:Ao,sign:Mo,sin:No,sinh:ko,softplus:Io,sqrt:To,square:Po,step:Ro,tan:Do,tanh:Lo,all:ba,any:ya,argMax:va,argMin:_a,logSumExp:wa,max:xa,mean:Ea,min:Sa,moments:Ca,sum:Oa,equal:Aa,equalStrict:Ma,greater:Na,greaterEqual:ka,greaterEqualStrict:Ia,greaterStrict:Ta,less:Pa,lessEqual:Ra,lessEqualStrict:Da,lessStrict:La,notEqual:Ba,notEqualStrict:ja,add:Fa,addN:za,addStrict:Va,atan2:Ua,div:Wa,divStrict:$a,floorDiv:qa,maximum:Ha,maximumStrict:Ga,minimum:Ka,minimumStrict:Ya,mod:Xa,modStrict:Za,mul:Ja,mulStrict:Qa,pow:es,powStrict:ts,squaredDifference:ns,squaredDifferenceStrict:rs,sub:is,subStrict:os,elu:ds,leakyRelu:fs,prelu:ps,relu:ms,selu:gs,logicalAnd:as,logicalNot:ss,logicalOr:us,logicalXor:cs,where:ls,whereAsync:hs,buffer:Mi,toPixels:Ai,print:Ni,batchToSpaceND:ki,cast:Ii,clone:Ti,cumsum:Pi,depthToSpace:Ri,expandDims:Di,eye:Li,fromPixels:Bi,multinomial:ji,oneHot:Fi,pad:zi,pad1d:Vi,pad2d:Ui,pad3d:Wi,pad4d:$i,rand:qi,randomNormal:Hi,randomUniform:Gi,reshape:Ki,spaceToBatchND:Yi,squeeze:Xi,stack:Zi,tile:Ji,truncatedNormal:Qi,unstack:eo,fill:ft,linspace:pt,ones:ht,range:mt,scalar:it,tensor:rt,tensor1d:ot,tensor2d:at,tensor3d:st,tensor4d:ut,tensor5d:ct,tensor6d:lt,zeros:dt,onesLike:xt,zerosLike:Et,transpose:bs,softmax:Qe,localResponseNormalization:ys,norm:vs,gather:xs,unsortedSegmentSum:Es,basicLSTMCell:Ss,multiRNNCell:Cs,movingAverage:Os,stridedSlice:As,topk:Ns}),Js=function(){function e(){this.blockSize=48,this.data=new WeakMap,this.firstUse=!0,ge.get("IS_BROWSER")&&(this.canvas=document.createElement("canvas"))}return e.prototype.register=function(e,t,n){if(this.firstUse&&(this.firstUse=!1,ge.get("IS_NODE")&&ke("\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(e))throw new Error("Data buffer is already registered");this.data.set(e,{dtype:n})},e.prototype.write=function(e,t){if(null==t)throw new Error("MathBackendCPU.write(): values can not be null");this.throwIfNoData(e),this.data.get(e).values=t},e.prototype.fromPixels=function(e,t){if(null==e)throw new Error("pixels passed to tf.fromPixels() can not be null");var n,r;if(ge.get("IS_NODE")&&null==e.getContext)throw new Error("When running in node, pixels must be an HTMLCanvasElement like the one returned by the `canvas` npm package");if(null!=e.getContext)n=e.getContext("2d").getImageData(0,0,e.width,e.height).data;else if(e instanceof ImageData)n=e.data;else{if(!(e instanceof HTMLImageElement||e instanceof HTMLVideoElement))throw new Error("pixels passed to tf.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement or ImageData, but was "+e.constructor.name);if(null==this.canvas)throw new Error("Can't read pixels from HTMLImageElement outside the browser.");this.canvas.width=e.width,this.canvas.height=e.height,this.canvas.getContext("2d").drawImage(e,0,0,e.width,e.height),n=this.canvas.getContext("2d").getImageData(0,0,e.width,e.height).data}if(4===t)r=new Int32Array(n);else{var i=e.width*e.height;r=new Int32Array(i*t);for(var o=0;o<i;o++)for(var a=0;a<t;++a)r[o*t+a]=n[4*o+a]}return st(r,[e.height,e.width,t],"int32")},e.prototype.read=function(e){return c(this,void 0,void 0,function(){return l(this,function(t){return[2,this.readSync(e)]})})},e.prototype.readSync=function(e){this.throwIfNoData(e);var t=this.data.get(e),n=t.dtype,r=t.complexTensors;return"complex64"===n?Nt(r.real.dataSync(),r.imag.dataSync()):this.data.get(e).values},e.prototype.disposeData=function(e){if(this.data.has(e)){var t=this.data.get(e).complexTensors;null!=t&&(t.real.dispose(),t.imag.dispose()),this.data.delete(e)}},e.prototype.time=function(e){return c(this,void 0,void 0,function(){var t;return l(this,function(n){return t=z(),e(),[2,{kernelMs:z()-t}]})})},e.prototype.memory=function(){return{unreliable:!0}},e.prototype.throwIfNoData=function(e){if(!this.data.has(e))throw new Error("CPU backend: No data found for this tensor. Did you change your backend in the middle of the program? New backends can't use Tensors created with previous backends")},e.prototype.complex=function(e,t){var n=ee.make(e.shape,{},"complex64");return this.data.get(n.dataId).complexTensors={real:ge.engine.keep(e.clone()),imag:ge.engine.keep(t.clone())},n},e.prototype.real=function(e){return this.data.get(e.dataId).complexTensors.real.clone()},e.prototype.imag=function(e){return this.data.get(e.dataId).complexTensors.imag.clone()},e.prototype.assertNotComplex=function(e,t){Array.isArray(e)||(e=[e]),e.forEach(function(e){null!=e&&p("complex64"!==e.dtype,t+" does not support complex64 tensors.")})},e.prototype.slice=function(e,t,n){this.assertNotComplex(e,"slice");for(var r=Mi(n,e.dtype),i=0;i<r.size;++i){var o=r.indexToLoc(i),a=o.map(function(e,n){return e+t[n]});r.set.apply(r,[e.get.apply(e,a)].concat(o))}return r.toTensor()},e.prototype.stridedSlice=function(e,t,n,r,i,o,a,s,u){this.assertNotComplex(e,"stridedSlice");var c=Ge(e.shape,t,n,r,i,o,a,s,u),l=c[0],h=c[1],d=c[2],f=h.filter(function(e,t){return-1===d.indexOf(t)});if(f.some(function(e){return 0===e}))return rt([],f);for(var p=Mi(h,e.dtype),m=0;m<p.size;m++){for(var g=p.indexToLoc(m),b=new Array(g.length),y=0;y<b.length;y++)b[y]=g[y]*r[y]+l[y];p.set.apply(p,[e.get.apply(e,b)].concat(g))}return p.toTensor().reshape(f)},e.prototype.reverse=function(e,t){this.assertNotComplex(e,"reverse");for(var n=Mi(e.shape,e.dtype),r=e.buffer(),i=function(i){var o=n.indexToLoc(i),a=o.slice();t.forEach(function(t){return a[t]=e.shape[t]-1-a[t]}),n.set.apply(n,[r.get.apply(r,a)].concat(o))},o=0;o<n.size;o++)i(o);return n.toTensor()},e.prototype.concat=function(e,t){this.assertNotComplex(e,"concat");var n=e.map(function(e){var n=v(e.shape.slice(t));return e.as2D(-1,n)}),r=$e(n.map(function(e){return e.shape}),1),i=Mi(r,e[0].dtype).values;if(1===n[0].shape[0]){var o=0;n.forEach(function(e){i.set(e.dataSync(),o),o+=e.size})}else{var a=0;n.forEach(function(e){for(var t=e.dataSync(),n=0,o=0;o<e.shape[0];++o)for(var s=o*r[1]+a,u=0;u<e.shape[1];++u)i[s+u]=t[n++];a+=e.shape[1]})}var s=$e(e.map(function(e){return e.shape}),t);return rt(i,s,e[0].dtype)},e.prototype.neg=function(e){return this.assertNotComplex(e,"neg"),this.multiply(it(-1),e)},e.prototype.add=function(e,t){return"complex64"===e.dtype||"complex64"===t.dtype?this.broadcastedBinaryComplexOp(e.cast("complex64"),t.cast("complex64"),function(e,t,n,r){return{real:e+n,imag:t+r}}):this.broadcastedBinaryOp(e,t,Ct(e.dtype,t.dtype),function(e,t){return e+t})},e.prototype.addN=function(e){this.assertNotComplex(e,"addN");for(var t=e.map(function(e){return e.dataSync()}),n=Mi(e[0].shape,e[0].dtype),r=n.values,i=0;i<e.length;i++)for(var o=t[i],a=0;a<r.length;a++)r[a]+=o[a];return n.toTensor()},e.prototype.subtract=function(e,t){return"complex64"===e.dtype||"complex64"===t.dtype?this.broadcastedBinaryComplexOp(e.cast("complex64"),t.cast("complex64"),function(e,t,n,r){return{real:e-n,imag:t-r}}):this.broadcastedBinaryOp(e,t,Ct(e.dtype,t.dtype),function(e,t){return e-t})},e.prototype.pow=function(e,t){return this.assertNotComplex([e,t],"pow"),this.broadcastedBinaryOp(e,t,e.dtype,function(e,t){return Math.pow(e,t)})},e.prototype.batchMatMul=function(e,t,n,r){this.assertNotComplex([e,t],"matMul");for(var i=n?e.shape[1]:e.shape[2],o=n?e.shape[2]:e.shape[1],a=r?t.shape[1]:t.shape[2],s=e.shape[0],u=e.dataSync(),c=t.dataSync(),l=n?[e.strides[0],1,e.strides[1]]:[e.strides[0],e.strides[1],1],h=l[0],d=l[1],f=l[2],p=r?[1,t.strides[1],t.strides[0]]:[t.strides[1],1,t.strides[0]],m=p[0],g=p[1],b=p[2],y=o*a,v=new Float32Array(s*y),_=this.blockSize,w=0;w<s;w++)for(var x=0;x<o;x+=_)for(var E=0;E<a;E+=_)for(var S=0;S<i;S+=_)for(var C=Math.min(x+_,o),O=Math.min(E+_,a),A=Math.min(S+_,i),M=x;M<C;M++)for(var N=E;N<O;N++){for(var k=0,I=S;I<A;I++)k+=u[w*h+M*d+I*f]*c[I*m+N*g+w*b];v[w*y+(M*a+N)]+=k}return st(v,[s,o,a])},e.prototype.multiply=function(e,t){return"complex64"===e.dtype||"complex64"===t.dtype?this.broadcastedBinaryComplexOp(e.cast("complex64"),t.cast("complex64"),function(e,t,n,r){return{real:e*n-t*r,imag:e*r+t*n}}):this.broadcastedBinaryOp(e,t,Ct(e.dtype,t.dtype),function(e,t){return e*t})},e.prototype.realDivide=function(e,t){return this.assertNotComplex([e,t],"realDivide"),this.broadcastedBinaryOp(e,t,"float32",function(e,t){return e/t})},e.prototype.floorDiv=function(e,t){return this.assertNotComplex([e,t],"floorDiv"),this.broadcastedBinaryOp(e,t,"int32",function(e,t){return Math.floor(e/t)})},e.prototype.sum=function(e,t){this.assertNotComplex(e,"sum"),ze("sum",t,e.rank);for(var n=Be(e.shape,t),r=n[0],i=n[1],o=dt(r,Ct(e.dtype,"int32")),a=v(i),s=o.dataSync(),u=e.dataSync(),c=0;c<s.length;++c){for(var l=c*a,h=0,d=0;d<a;++d)h+=u[l+d];s[c]=h}return o},e.prototype.unsortedSegmentSum=function(e,t,n){this.assertNotComplex(e,"unsortedSegmentSum");for(var r=[],i=e.rank-t.rank,o=0;o<i;++o)t=t.expandDims(o+1);for(o=0;o<n;++o){var a=it(o,"int32"),s=Aa(a,t).asType("float32").mul(e).sum(0);r.push(s)}return Zi(r)},e.prototype.argMin=function(e,t){this.assertNotComplex(e,"argMin");var n=[t];ze("argMin",n,e.rank);for(var r=Be(e.shape,n),i=r[0],o=r[1],a=dt(i,"int32"),s=v(o),u=a.dataSync(),c=e.dataSync(),l=0;l<u.length;++l){for(var h=l*s,d=c[h],f=0,p=0;p<s;++p){var m=c[h+p];m<d&&(d=m,f=p)}u[l]=f}return a},e.prototype.argMax=function(e,t){this.assertNotComplex(e,"argMax");var n=[t];ze("argMax",n,e.rank);for(var r=Be(e.shape,n),i=r[0],o=r[1],a=dt(i,"int32"),s=v(o),u=a.dataSync(),c=e.dataSync(),l=0;l<u.length;++l){for(var h=l*s,d=c[h],f=0,p=0;p<s;++p){var m=c[h+p];m>d&&(d=m,f=p)}u[l]=f}return a},e.prototype.cumsum=function(e,t,n,r){if(this.assertNotComplex(e,"cumsum"),t!==e.rank-1)throw new Error("backend.cumsum in CPU expects an inner-most axis="+(e.rank-1)+" but got axis="+t);for(var i=Ct(e.dtype,"int32"),o=dt(e.shape,i),a=o.dataSync(),s=e.dataSync(),u=e.shape[e.rank-1],c=r?function(e,t){return e+u-t-1}:function(e,t){return e+t},l=0;l<s.length;l+=u)for(var h=0;h<u;h++){var d=c(l,h);if(0===h)a[d]=n?0:s[d];else{var f=c(l,h-1);a[d]=n?s[f]+a[f]:s[d]+a[f]}}return o},e.prototype.equal=function(e,t){return this.assertNotComplex([e,t],"equal"),this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e===t?1:0})},e.prototype.notEqual=function(e,t){return this.assertNotComplex([e,t],"notEqual"),this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e!==t?1:0})},e.prototype.less=function(e,t){return this.assertNotComplex([e,t],"less"),this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e<t?1:0})},e.prototype.lessEqual=function(e,t){return this.assertNotComplex([e,t],"lessEqual"),this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e<=t?1:0})},e.prototype.greater=function(e,t){return this.assertNotComplex([e,t],"greater"),this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e>t?1:0})},e.prototype.greaterEqual=function(e,t){return this.assertNotComplex([e,t],"greaterEqual"),this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e>=t?1:0})},e.prototype.logicalNot=function(e){this.assertNotComplex(e,"logicalNot");for(var t=e.dataSync(),n=new Int32Array(t.length),r=0;r<t.length;++r)n[r]=t[r]?0:1;return ee.make(e.shape,{values:n},"bool")},e.prototype.logicalAnd=function(e,t){return this.assertNotComplex([e,t],"logicalAnd"),this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e&&t})},e.prototype.logicalOr=function(e,t){return this.assertNotComplex([e,t],"logicalOr"),this.broadcastedBinaryOp(e,t,"bool",function(e,t){return e||t})},e.prototype.select=function(e,t,n){this.assertNotComplex([e,t,n],"select");for(var r=e.dataSync(),i=t.dataSync(),o=n.dataSync(),a=dt(t.shape,Ct(t.dtype,n.dtype)),s=a.dataSync(),u=0,c=0===e.rank||e.rank>1||1===t.rank?1:t.shape[1],l=0;l<r.length;l++)for(var h=0;h<c;h++)1===r[l]?s[u++]=i[l]:s[u++]=o[l];return a},e.prototype.where=function(e){this.assertNotComplex([e],"where");var t=e.dataSync();return to(e.shape,t)},e.prototype.topk=function(e,t,n){return this.assertNotComplex(e,"topk"),Pt(e.dataSync(),e.shape,e.dtype,t)},e.prototype.min=function(e,t){this.assertNotComplex(e,"min"),ze("min",t,e.rank);for(var n=Be(e.shape,t),r=n[0],i=n[1],o=dt(r,e.dtype),a=v(i),s=o.dataSync(),u=e.dataSync(),c=0;c<s.length;++c){for(var l=c*a,h=u[l],d=0;d<a;++d){var f=u[l+d];f<h&&(h=f)}s[c]=h}return o},e.prototype.minimum=function(e,t){return this.assertNotComplex([e,t],"minimum"),this.broadcastedBinaryOp(e,t,e.dtype,function(e,t){return Math.min(e,t)})},e.prototype.mod=function(e,t){return this.assertNotComplex([e,t],"mod"),this.broadcastedBinaryOp(e,t,e.dtype,function(e,t){var n=e%t;return e<0&&t<0||e>=0&&t>=0?n:(n+t)%t})},e.prototype.max=function(e,t){this.assertNotComplex(e,"max"),ze("max",t,e.rank);for(var n=Be(e.shape,t),r=n[0],i=n[1],o=dt(r,e.dtype),a=v(i),s=o.dataSync(),u=e.dataSync(),c=0;c<s.length;++c){for(var l=c*a,h=u[l],d=0;d<a;++d){var f=u[l+d];f>h&&(h=f)}s[c]=h}return o},e.prototype.maximum=function(e,t){return this.assertNotComplex([e,t],"maximum"),this.broadcastedBinaryOp(e,t,e.dtype,function(e,t){return Math.max(e,t)})},e.prototype.all=function(e,t){this.assertNotComplex(e,"all"),ze("all",t,e.rank);for(var n=Be(e.shape,t),r=n[0],i=n[1],o=dt(r,e.dtype),a=v(i),s=o.dataSync(),u=e.dataSync(),c=0;c<s.length;++c){for(var l=c*a,h=u[l],d=0;d<a;++d){var f=u[l+d];h=h&&f}s[c]=h}return o},e.prototype.any=function(e,t){this.assertNotComplex(e,"any"),ze("any",t,e.rank);for(var n=Be(e.shape,t),r=n[0],i=n[1],o=dt(r,e.dtype),a=v(i),s=o.dataSync(),u=e.dataSync(),c=0;c<s.length;++c){for(var l=c*a,h=u[l],d=0;d<a;++d){var f=u[l+d];h=h||f}s[c]=h}return o},e.prototype.squaredDifference=function(e,t){return this.assertNotComplex([e,t],"squaredDifference"),this.broadcastedBinaryOp(e,t,e.dtype,function(e,t){var n=e-t;return n*n})},e.prototype.ceil=function(e){this.assertNotComplex(e,"ceil");for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r)n[r]=Math.ceil(t[r]);return ee.make(e.shape,{values:n})},e.prototype.floor=function(e){this.assertNotComplex(e,"floor");for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r)n[r]=Math.floor(t[r]);return ee.make(e.shape,{values:n})},e.prototype.sign=function(e){this.assertNotComplex(e,"x");for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r)t[r]<0?n[r]=-1:t[r]>0?n[r]=1:n[r]=0;return ee.make(e.shape,{values:n})},e.prototype.round=function(e){this.assertNotComplex(e,"round");for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r){var i=Math.floor(t[r]);t[r]-i<.5?n[r]=Math.floor(t[r]):t[r]-i>.5?n[r]=Math.ceil(t[r]):n[r]=i%2==0?i:i+1}return ee.make(e.shape,{values:n})},e.prototype.exp=function(e){this.assertNotComplex(e,"exp");for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r)n[r]=Math.exp(t[r]);return ee.make(e.shape,{values:n})},e.prototype.expm1=function(e){this.assertNotComplex(e,"expm1");for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r)n[r]=Math.expm1(t[r]);return ee.make(e.shape,{values:n})},e.prototype.log=function(e){this.assertNotComplex(e,"log");for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r){var i=t[r];n[r]=Math.log(i)}return ee.make(e.shape,{values:n})},e.prototype.log1p=function(e){this.assertNotComplex(e,"log1p");for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r){var i=t[r];n[r]=Math.log1p(i)}return ee.make(e.shape,{values:n})},e.prototype.sqrt=function(e){this.assertNotComplex(e,"sqrt");for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r){var i=t[r];n[r]=Math.sqrt(i)}return ee.make(e.shape,{values:n})},e.prototype.rsqrt=function(e){this.assertNotComplex(e,"rsqrt");for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r){var i=t[r];n[r]=1/Math.sqrt(i)}return ee.make(e.shape,{values:n})},e.prototype.square=function(e){this.assertNotComplex(e,"square");for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r){var i=t[r];n[r]=i*i}return ee.make(e.shape,{values:n})},e.prototype.reciprocal=function(e){this.assertNotComplex(e,"reciprocal");for(var t=e.dataSync(),n=new Float32Array(t.length),r=0;r<t.length;++r)n[r]=1/t[r];return ee.make(e.shape,{values:n})},e.prototype.relu=function(e){this.assertNotComplex(e,"relu");for(var t=dt(e.shape,e.dtype),n=t.dataSync(),r=e.dataSync(),i=0;i<r.length;++i)n[i]=Math.max(0,r[i]);return t},e.prototype.elu=function(e){this.assertNotComplex(e,"elu");for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r){var i=n[r];t[r]=i>=0?i:Math.exp(i)-1}return ee.make(e.shape,{values:t})},e.prototype.eluDer=function(e,t){this.assertNotComplex([e,t],"eluDer");for(var n=new Float32Array(t.size),r=t.dataSync(),i=e.dataSync(),o=0;o<r.length;++o){var a=r[o];n[o]=a>=1?i[o]:i[o]*(a+1)}return ee.make(t.shape,{values:n})},e.prototype.selu=function(e){this.assertNotComplex(e,"selu");for(var t=Qr,n=ei,r=new Float32Array(e.size),i=e.dataSync(),o=0;o<i.length;++o){var a=i[o];r[o]=a>=0?n*a:t*(Math.exp(a)-1)}return ee.make(e.shape,{values:r})},e.prototype.clip=function(e,t,n){this.assertNotComplex(e,"clip");for(var r=new Float32Array(e.size),i=e.dataSync(),o=0;o<i.length;++o){var a=i[o];r[o]=a>n?n:a<t?t:a}return ee.make(e.shape,{values:r})},e.prototype.abs=function(e){this.assertNotComplex(e,"abs");for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.abs(n[r]);return ee.make(e.shape,{values:t})},e.prototype.int=function(e){this.assertNotComplex(e,"int");for(var t=new Int32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=n[r];return ee.make(e.shape,{values:t},"int32")},e.prototype.sigmoid=function(e){this.assertNotComplex(e,"sigmoid");for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=1/(1+Math.exp(-n[r]));return ee.make(e.shape,{values:t})},e.prototype.softplus=function(e){this.assertNotComplex(e,"softplus");for(var t=Math.log(1.1920928955078125e-7)+2,n=new Float32Array(e.size),r=e.dataSync(),i=0;i<r.length;++i){var o,a=r[i]>-t,s=r[i]<t,u=Math.exp(r[i]);o=s?u:a?r[i]:Math.log(1+u),n[i]=o}return ee.make(e.shape,{values:n})},e.prototype.sin=function(e){this.assertNotComplex(e,"sin");for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.sin(n[r]);return ee.make(e.shape,{values:t})},e.prototype.cos=function(e){this.assertNotComplex(e,"cos");for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.cos(n[r]);return ee.make(e.shape,{values:t})},e.prototype.tan=function(e){this.assertNotComplex(e,"tan");for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.tan(n[r]);return ee.make(e.shape,{values:t})},e.prototype.asin=function(e){this.assertNotComplex(e,"asin");for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.asin(n[r]);return ee.make(e.shape,{values:t})},e.prototype.acos=function(e){this.assertNotComplex(e,"acos");for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.acos(n[r]);return ee.make(e.shape,{values:t})},e.prototype.atan=function(e){this.assertNotComplex(e,"atan");for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.atan(n[r]);return ee.make(e.shape,{values:t})},e.prototype.atan2=function(e,t){return this.assertNotComplex([e,t],"atan2"),this.broadcastedBinaryOp(e,t,e.dtype,function(e,t){return Math.atan2(e,t)})},e.prototype.sinh=function(e){this.assertNotComplex(e,"sinh");for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.sinh(n[r]);return ee.make(e.shape,{values:t})},e.prototype.cosh=function(e){this.assertNotComplex(e,"cosh");for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.cosh(n[r]);return ee.make(e.shape,{values:t})},e.prototype.tanh=function(e){this.assertNotComplex(e,"tanh");for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=x(n[r]);return ee.make(e.shape,{values:t})},e.prototype.asinh=function(e){this.assertNotComplex(e,"asinh");for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.asinh(n[r]);return ee.make(e.shape,{values:t})},e.prototype.acosh=function(e){this.assertNotComplex(e,"acosh");for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.acosh(n[r]);return ee.make(e.shape,{values:t})},e.prototype.atanh=function(e){this.assertNotComplex(e,"atanh");for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r)t[r]=Math.atanh(n[r]);return ee.make(e.shape,{values:t})},e.prototype.erf=function(e){this.assertNotComplex(e,"erf");for(var t=new Float32Array(e.size),n=e.dataSync(),r=0;r<n.length;++r){var i=n[r],o=1/(1+.3275911*i);t[r]=1-((((1.061405429*o-1.453152027)*o+1.421413741)*o-.284496736)*o+.254829592)*o*Math.exp(-i*i)}return ee.make(e.shape,{values:t})},e.prototype.step=function(e,t){void 0===t&&(t=0),this.assertNotComplex(e,"step");for(var n=new Float32Array(e.size),r=e.dataSync(),i=0;i<r.length;++i){var o=r[i];isNaN(o)?n[i]=NaN:n[i]=o>0?1:t}return ee.make(e.shape,{values:n})},e.prototype.conv2d=function(e,t,n){this.assertNotComplex([e,t],"conv2d");for(var r=n.filterHeight,i=n.filterWidth,o=n.dilationHeight,a=n.dilationWidth,s=n.padInfo.left,u=n.padInfo.top,c=Mi(n.outShape,e.dtype),l=e.dataSync(),h=t.dataSync(),d=c.values,f=0;f<n.batchSize;++f)for(var p=f*e.strides[0],m=f*c.strides[0],g=0;g<n.outHeight;++g)for(var b=m+g*c.strides[1],y=g*n.strideHeight-s,v=0;v<r;v++){var _=y+v*o;if(!(_<0||_>=n.inHeight))for(var w=v*t.strides[0],x=p+_*e.strides[1],E=0;E<n.outWidth;++E)for(var S=b+E*n.outChannels,C=E*n.strideWidth-u,O=0;O<i;O++){var A=C+O*a;if(!(A<0||A>=n.inWidth))for(var M=w+O*t.strides[1],N=x+A*n.inChannels,k=M,I=0;I<n.inChannels;++I){for(var T=l[N+I],P=0;P<n.outChannels;++P)d[S+P]+=T*h[k+P];k+=n.outChannels}}}return c.toTensor()},e.prototype.conv2dDerInput=function(e,t,n){this.assertNotComplex([e,t],"conv2dDerInput");for(var r=Mi(n.inShape,"float32"),i=r.values,o=r.strides,a=o[0],s=o[1],u=o[2],c=e.dataSync(),l=e.strides,h=l[0],d=l[1],f=l[2],p=t.dataSync(),m=t.strides,g=m[0],b=m[1],y=m[2],v=n.batchSize,_=n.filterHeight,w=n.filterWidth,x=n.inChannels,E=n.inHeight,S=n.inWidth,C=n.outChannels,O=n.outHeight,A=n.outWidth,M=n.strideHeight,N=n.strideWidth,k=_-1-n.padInfo.top,I=w-1-n.padInfo.left,T=0;T<v;++T)for(var P=0;P<x;++P)for(var R=0;R<E;++R)for(var D=R-k,L=Math.max(0,Math.ceil(D/M)),B=Math.min(O,(_+D)/M),j=0;j<S;++j){for(var F=j-I,z=Math.max(0,Math.ceil(F/N)),V=Math.min(A,(w+F)/N),U=0,W=L;W<B;++W)for(var $=W*M-D,q=z;q<V;++q)for(var H=h*T+d*W+f*q,G=g*(_-1-$)+b*(w-1-(q*N-F))+y*P,K=0;K<C;++K)U+=c[H+K]*p[G+K];i[a*T+s*R+u*j+P]=U}return r.toTensor()},e.prototype.conv2dDerFilter=function(e,t,n){this.assertNotComplex([e,t],"conv2dDerFilter");for(var r=n.strideHeight,i=n.strideWidth,o=n.filterHeight,a=n.filterWidth,s=Mi(n.filterShape,"float32"),u=n.padInfo.left,c=n.padInfo.top,l=0;l<o;++l)for(var h=Math.max(0,Math.ceil((c-l)/r)),d=Math.min(n.outHeight,(n.inHeight+c-l)/r),f=0;f<a;++f)for(var p=Math.max(0,Math.ceil((u-f)/i)),m=Math.min(n.outWidth,(n.inWidth+u-f)/i),g=0;g<n.inChannels;++g)for(var b=0;b<n.outChannels;++b){for(var y=0,v=0;v<n.batchSize;++v)for(var _=h;_<d;++_)for(var w=l+_*r-c,x=p;x<m;++x){var E=f+x*i-u;y+=e.get(v,w,E,g)*t.get(v,_,x,b)}s.set(y,l,f,g,b)}return s.toTensor()},e.prototype.depthwiseConv2D=function(e,t,n){this.assertNotComplex([e,t],"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=Mi(n.outShape,e.dtype),h=e.dataSync(),d=t.dataSync(),f=l.values,p=0;p<n.batchSize;++p)for(var m=p*e.strides[0],g=p*l.strides[0],b=0;b<n.outHeight;++b)for(var y=g+b*l.strides[1],v=b*n.strideHeight-s,_=0;_<r;++_){var w=v+_*o;if(!(w<0||w>=n.inHeight))for(var x=_*t.strides[0],E=m+w*e.strides[1],S=0;S<n.outWidth;++S)for(var C=y+S*l.strides[2],O=S*n.strideWidth-u,A=0;A<i;++A){var M=O+A*a;if(!(M<0||M>=n.inWidth))for(var N=x+A*t.strides[1],k=E+M*n.inChannels,I=C,T=N,P=0;P<n.inChannels;++P){for(var R=h[k+P],D=0;D<c;++D)f[I+D]+=R*d[T+D];I+=c,T+=c}}}return l.toTensor()},e.prototype.depthwiseConv2DDerInput=function(e,t,n){this.assertNotComplex([e,t],"depthwiseConv2DDerInput");for(var r=Mi(n.inShape,"float32"),i=r.values,o=r.strides,a=o[0],s=o[1],u=o[2],c=e.dataSync(),l=e.strides,h=l[0],d=l[1],f=l[2],p=t.dataSync(),m=t.strides,g=m[0],b=m[1],y=m[2],v=n.batchSize,_=n.filterHeight,w=n.filterWidth,x=n.inChannels,E=n.inHeight,S=n.inWidth,C=n.outChannels,O=n.outHeight,A=n.outWidth,M=n.strideHeight,N=n.strideWidth,k=_-1-n.padInfo.top,I=w-1-n.padInfo.left,T=C/x,P=0;P<v;++P)for(var R=0;R<x;++R)for(var D=0;D<E;++D)for(var L=D-k,B=Math.max(0,Math.ceil(L/M)),j=Math.min(O,(_+L)/M),F=0;F<S;++F){for(var z=F-I,V=Math.max(0,Math.ceil(z/N)),U=Math.min(A,(w+z)/N),W=0,$=B;$<j;++$)for(var q=$*M-L,H=V;H<U;++H)for(var G=h*P+d*$+f*H,K=g*(_-1-q)+b*(w-1-(H*N-z))+y*R,Y=0;Y<T;++Y)W+=c[G+(R*T+Y)]*p[K+Y];i[a*P+s*D+u*F+R]=W}return r.toTensor()},e.prototype.depthwiseConv2DDerFilter=function(e,t,n){this.assertNotComplex([e,t],"depthwiseConv2DDerFilter");for(var r=n.strideHeight,i=n.strideWidth,o=n.filterHeight,a=n.filterWidth,s=Mi(n.filterShape,"float32"),u=n.padInfo.left,c=n.padInfo.top,l=n.outChannels/n.inChannels,h=0;h<o;++h)for(var d=Math.max(0,Math.ceil((c-h)/r)),f=Math.min(n.outHeight,(n.inHeight+c-h)/r),p=0;p<a;++p)for(var m=Math.max(0,Math.ceil((u-p)/i)),g=Math.min(n.outWidth,(n.inWidth+u-p)/i),b=0;b<n.outChannels;++b){for(var y=Math.trunc(b/l),v=b%l,_=0,w=0;w<n.batchSize;++w)for(var x=d;x<f;++x)for(var E=h+x*r-c,S=m;S<g;++S){var C=p+S*i-u;_+=e.get(w,E,C,y)*t.get(w,x,S,b)}s.set(_,h,p,y,v)}return s.toTensor()},e.prototype.tile=function(e,t){this.assertNotComplex(e,"tile");for(var n=new Array(e.rank),r=0;r<n.length;r++)n[r]=e.shape[r]*t[r];var i=Mi(n,e.dtype),o=e.buffer();for(r=0;r<i.values.length;++r){for(var a=i.indexToLoc(r),s=new Array(e.rank),u=0;u<s.length;u++)s[u]=a[u]%e.shape[u];var c=o.locToIndex(s);i.values[r]=o.values[c]}return i.toTensor()},e.prototype.pad=function(e,t,n){this.assertNotComplex(e,"pad");var r=t.map(function(t,n){return t[0]+e.shape[n]+t[1]}),i=t.map(function(e){return e[0]}),o=e.buffer(),a=Mi(r,e.dtype);0!==n&&a.values.fill(n);for(var s=0;s<e.size;s++){var u=o.indexToLoc(s),c=u.map(function(e,t){return e+i[t]});a.set.apply(a,[e.get.apply(e,u)].concat(c))}return a.toTensor()},e.prototype.transpose=function(e,t){this.assertNotComplex(e,"transpose");for(var n=new Array(e.rank),r=0;r<n.length;r++)n[r]=e.shape[t[r]];var i=e.dataSync(),o=Mi(n,e.dtype),a=e.buffer();for(r=0;r<e.size;++r){for(var s=a.indexToLoc(r),u=new Array(s.length),c=0;c<u.length;c++)u[c]=s[t[c]];var l=o.locToIndex(u);o.values[l]=i[r]}return o.toTensor()},e.prototype.gather=function(e,t,n){this.assertNotComplex([e,t],"gather");var r=e.shape.slice(),i=t.dataSync();r[n]=i.length;for(var o=Mi(r,e.dtype),a=e.buffer(),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()},e.prototype.batchToSpaceND=function(e,t,n){this.assertNotComplex([e],"batchToSpaceND");var r=t.reduce(function(e,t){return e*t}),i=Ie(e.shape,t,r),o=Te(i.length,t.length),a=Pe(e.shape,t,r),s=Re(n,t.length),u=De(a,n,t.length);return e.reshape(i).transpose(o).reshape(a).slice(s,u)},e.prototype.spaceToBatchND=function(e,t,n){this.assertNotComplex([e],"spaceToBatchND");var r=t.reduce(function(e,t){return e*t}),i=[[0,0]];i.push.apply(i,n);for(var o=1+t.length;o<e.shape.length;++o)i.push([0,0]);var a=e.pad(i),s=Ie(a.shape,t,r,!1),u=Te(s.length,t.length,!1),c=Pe(a.shape,t,r,!1);return a.reshape(s).transpose(u).reshape(c)},e.prototype.pool=function(e,t,n){this.assertNotComplex(e,"pool");for(var r=t.strideHeight,i=t.strideWidth,o=t.filterHeight,a=t.filterWidth,s=Mi(t.outShape,"float32"),u=t.padInfo.top,c=t.padInfo.left,l="max"===n?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,h=0;h<t.batchSize;++h)for(var d=0;d<t.inChannels;++d)for(var f=0;f<t.outHeight;++f)for(var p=f*r-u,m=Math.max(0,p),g=Math.min(t.inHeight,o+p),b=0;b<t.outWidth;++b){for(var y=b*i-c,v=Math.max(0,y),_=Math.min(t.inWidth,a+y),w=l,x=0,E=0,S=m;S<g;++S){for(var C=v;C<_;++C){var O=e.get(h,S,C,d);"max"===n&&O>w?w=O:"avg"===n&&(x+=O,E++)}if(isNaN(w))break}s.set("avg"===n?x/E:w,h,f,b,d)}return s.toTensor()},e.prototype.maxPool=function(e,t){return this.pool(e,t,"max")},e.prototype.maxPoolPositions=function(e,t){for(var n=Mi(t.outShape,"int32"),r=t.strideHeight,i=t.strideWidth,o=t.filterHeight,a=t.filterWidth,s=t.padInfo.top,u=t.padInfo.left,c=0;c<t.batchSize;++c)for(var l=0;l<t.inChannels;++l)for(var h=0;h<t.outHeight;++h)for(var d=h*r-s,f=Math.max(0,d),p=Math.min(t.inHeight,o+d),m=0;m<t.outWidth;++m){for(var g=m*i-u,b=Math.max(0,g),y=Math.min(t.inWidth,a+g),v=Number.NEGATIVE_INFINITY,_=-1,w=f;w<p;++w)for(var x=w-d,E=b;E<y;++E){var S=E-g,C=e.get(c,w,E,l);C>v&&(v=C,_=x*a+S)}n.set(_,c,h,m,l)}return n.toTensor()},e.prototype.maxPoolBackprop=function(e,t,n,r){this.assertNotComplex([t,n],"maxPoolBackprop");for(var i=this.maxPoolPositions(t,r),o=r.strideHeight,a=r.strideWidth,s=r.filterHeight,u=r.filterWidth,c=u-1-r.padInfo.left,l=s-1-r.padInfo.top,h=Mi(t.shape,"float32"),d=0;d<r.batchSize;++d)for(var f=0;f<r.inChannels;++f)for(var p=0;p<r.inHeight;++p)for(var m=0;m<r.inWidth;++m){for(var g=p-l,b=m-c,y=0,v=0;v<s;++v){var _=(g+v)/o;if(!(_<0||_>=r.outHeight||Math.floor(_)!==_))for(var w=0;w<u;++w){var x=(b+w)/a;if(!(x<0||x>=r.outWidth||Math.floor(x)!==x)){var E=s*u-1-i.get(d,_,x,f)===v*u+w?1:0;0!==E&&(y+=e.get(d,_,x,f)*E)}}}h.set(y,d,p,m,f)}return h.toTensor()},e.prototype.avgPoolBackprop=function(e,t,n){this.assertNotComplex([e,t],"avgPoolBackprop");for(var r=n.strideHeight,i=n.strideWidth,o=n.filterHeight,a=n.filterWidth,s=a-1-n.padInfo.left,u=o-1-n.padInfo.top,c=Mi(t.shape,"float32"),l=1/(o*a),h=0;h<n.batchSize;++h)for(var d=0;d<n.inChannels;++d)for(var f=0;f<n.inHeight;++f)for(var p=0;p<n.inWidth;++p){for(var m=f-u,g=p-s,b=0,y=0;y<o;++y){var v=(m+y)/r;if(!(v<0||v>=n.outHeight||Math.floor(v)!==v))for(var _=0;_<a;++_){var w=(g+_)/i;w<0||w>=n.outWidth||Math.floor(w)!==w||(b+=e.get(h,v,w,d))}}c.set(b*l,h,f,p,d)}return c.toTensor()},e.prototype.cast=function(e,t){return At(e,t,this)},e.prototype.reshape=function(e,t){return Mt(e,t)},e.prototype.avgPool=function(e,t){return this.assertNotComplex(e,"avgPool"),this.pool(e,t,"avg").toFloat()},e.prototype.resizeBilinear=function(e,t,n,r){this.assertNotComplex(e,"resizeBilinear");for(var i=e.shape,o=i[0],a=i[1],s=i[2],u=i[3],c=Mi([o,t,n,u],e.dtype),l=[r&&t>1?a-1:a,r&&n>1?s-1:s],h=[r&&t>1?t-1:t,r&&n>1?n-1:n],d=0;d<o;d++)for(var f=0;f<t;f++)for(var p=0;p<n;p++)for(var m=0;m<u;m++){var g=l[0]*f/h[0],b=l[1]*p/h[1],y=Math.floor(g),v=Math.min(a-1,Math.ceil(g)),_=Math.floor(b),w=Math.min(s-1,Math.ceil(b)),x=e.get(d,y,_,m),E=e.get(d,v,_,m),S=b-_,C=x+(e.get(d,y,w,m)-x)*S,O=C+(E+(e.get(d,v,w,m)-E)*S-C)*(g-y);c.set(O,d,f,p,m)}return c.toTensor()},e.prototype.resizeBilinearBackprop=function(e,t,n){this.assertNotComplex([e,t],"resizeBilinearBackprop");for(var r=t.shape,i=r[0],o=r[1],a=r[2],s=r[3],u=e.shape,c=u[1],l=u[2],h=Mi([i,o,a,s],t.dtype),d=[n&&c>1?o-1:o,n&&l>1?a-1:a],f=[n&&c>1?c-1:c,n&&l>1?l-1:l],p=d[0]/f[0],m=d[1]/f[1],g=0;g<i;g++)for(var b=0;b<c;b++)for(var y=b*p,v=Math.floor(y),_=Math.min(Math.ceil(y),o-1),w=y-v,x=1-w,E=0;E<l;E++)for(var S=E*m,C=Math.floor(S),O=Math.min(Math.ceil(S),a-1),A=S-C,M=1-A,N=0;N<s;N++){var k=e.get(g,b,E,N),I=h.get(g,v,C,N);I+=k*x*M,h.set(I,g,v,C,N);var T=h.get(g,v,O,N);T+=k*x*A,h.set(T,g,v,O,N);var P=h.get(g,_,C,N);P+=k*w*M,h.set(P,g,_,C,N);var R=h.get(g,_,O,N);R+=k*w*A,h.set(R,g,_,O,N)}return h.toTensor()},e.prototype.resizeNearestNeighbor=function(e,t,n,r){this.assertNotComplex(e,"resizeNearestNeighbor");for(var i=e.shape,o=i[0],a=i[1],s=i[2],u=i[3],c=Mi([o,t,n,u],e.dtype),l=[r&&t>1?a-1:a,r&&n>1?s-1:s],h=[r&&t>1?t-1:t,r&&n>1?n-1:n],d=0;d<o;d++)for(var f=0;f<t;f++)for(var p=0;p<n;p++)for(var m=0;m<u;m++){var g=l[0]*f/h[0],b=l[1]*p/h[1],y=Math.min(a-1,r?Math.round(g):Math.floor(g)),v=Math.min(s-1,r?Math.round(b):Math.floor(b)),_=e.get(d,y,v,m);c.set(_,d,f,p,m)}return c.toTensor()},e.prototype.resizeNearestNeighborBackprop=function(e,t,n){this.assertNotComplex([e,t],"resizeNearestNeighborBackprop");for(var r=t.shape,i=r[0],o=r[1],a=r[2],s=r[3],u=e.shape,c=u[1],l=u[2],h=Mi([i,o,a,s],t.dtype),d=[n&&c>1?o-1:o,n&&l>1?a-1:a],f=[n&&c>1?c-1:c,n&&l>1?l-1:l],p=1/(d[0]/f[0]),m=1/(d[1]/f[1]),g=2*Math.ceil(p)+2,b=2*Math.ceil(m)+2,y=0;y<i;y++)for(var v=0;v<o;v++)for(var _=0;_<a;_++)for(var w=Math.floor(v*p),x=Math.floor(w-g/2),E=Math.floor(_*m),S=Math.floor(E-b/2),C=0;C<s;C++){for(var O=0,A=0;A<g;A++){var M=A+x;if(!(M<0||M>=c))for(var N=0;N<b;N++){var k=N+S;if(!(k<0||k>=l)){var I=d[0]*(M/f[0]),T=d[1]*(k/f[1]),P=Math.min(o-1,n?Math.round(I):Math.floor(I)),R=Math.min(a-1,n?Math.round(T):Math.floor(T));v===P&&_===R&&(O+=e.get(y,M,k,C))}}}h.set(O,y,v,_,C)}return h.toTensor()},e.prototype.batchNormalization=function(e,t,n,r,i,o){this.assertNotComplex([e,t,n,i,o],"batchNormalization");for(var a=e.dataSync(),s=t.dataSync(),u=n.dataSync(),c=i?i.dataSync():new Float32Array([1]),l=o?o.dataSync():new Float32Array([0]),h=new Float32Array(a.length),d=l.length,f=c.length,p=u.length,m=s.length,g=0,b=0,y=0,v=0,_=0;_<a.length;++_)h[_]=l[g++]+(a[_]-s[b++])*c[y++]/Math.sqrt(u[v++]+r),g>=d&&(g=0),b>=m&&(b=0),y>=f&&(y=0),v>=p&&(v=0);return ut(h,e.shape)},e.prototype.localResponseNormalization4D=function(e,t,n,r,i){this.assertNotComplex(e,"localResponseNormalization4D");var o=e.shape[3],a=o-1,s=e.dataSync(),u=v(e.shape),c=new Float32Array(u);function l(e){for(var n=e%o,r=e-n+Math.max(0,n-t),i=e-n+Math.min(n+t,a),u=0;r<=i;r++){var c=s[r];u+=c*c}return u}for(var h=0;h<u;h++){var d=l(h),f=s[h]*Math.pow(n+r*d,-i);c[h]=f}return ut(c,e.shape)},e.prototype.LRNGrad=function(e,t,n,r,i,o,a){this.assertNotComplex(e,"LRNGrad");for(var s=e.shape[3],u=e.dataSync(),c=t.dataSync(),l=n.dataSync(),h=new Float32Array(v(e.shape)),d=v(e.shape),f=0;f<d;f++){for(var p=f%s,m=f-p+Math.max(0,p-r),g=f-p+Math.min(s,p+r+1),b=0,y=m;y<g;y++)b+=Math.pow(c[y],2);for(b=o*b+i,y=m;y<g;y++){var _=-2*o*a*c[y]*l[f]/b;f===y&&(_+=Math.pow(b,-a)),_*=u[f],h[y]+=_}}return ut(h,e.shape)},e.prototype.multinomial=function(e,t,n,r){this.assertNotComplex(e,"multinomial");for(var i=t?e:Qe(e),o=i.shape[0],a=i.shape[1],s=dt([o,n],"int32"),u=s.dataSync(),c=i.dataSync(),l=0;l<o;++l){var h=l*a,d=new Float32Array(a-1);d[0]=c[h];for(var f=1;f<d.length;++f)d[f]=d[f-1]+c[h+f];for(var p=Ci(r.toString()),m=l*n,g=0;g<n;++g){var b=p();u[m+g]=d.length;for(var y=0;y<d.length;y++)if(b<d[y]){u[m+g]=y;break}}}return s},e.prototype.oneHot=function(e,t,n,r){this.assertNotComplex(e,"oneHot");var i=new Float32Array(e.size*t);i.fill(r);for(var o=0;o<e.size;++o)e.get(o)>=0&&e.get(o)<t&&(i[o*t+e.get(o)]=n);return at(i,[e.size,t],"int32")},e.prototype.nonMaxSuppression=function(e,t,n,r,i){return this.assertNotComplex(e,"nonMaxSuppression"),kt(e.dataSync(),t.dataSync(),n,r,i)},e.prototype.depthToSpace=function(e,t,n){p("NHWC"===n,"Only NHWC dataFormat supported on CPU for depthToSpace. Got "+n),p(t>1,"blockSize should be > 1 for depthToSpace, but was: "+t);for(var r=e.shape[0],i=e.shape[1],o=e.shape[2],a=e.shape[3],s=i*t,u=o*t,c=a/(t*t),l=e.dataSync(),h=new Float32Array(r*s*u*c),d=0,f=0;f<r;++f)for(var m=0;m<s;++m)for(var g=Math.floor(m/t),b=m%t,y=0;y<u;++y)for(var v=Math.floor(y/t),_=(b*t+y%t)*c,w=0;w<c;++w){var x=w+_+a*(v+o*(g+i*f));h[d++]=l[x]}return ut(h,[r,s,u,c])},e.prototype.broadcastedBinaryOp=function(e,t,n,r){var i=jt(e.shape,t.shape),o=Mi(i,n),a=e.dataSync(),s=t.dataSync(),u=Lt(e.shape,i),c=Lt(t.shape,i),l=o.values;if(u.length+c.length===0)for(var h=0;h<l.length;++h)l[h]=r(a[h%a.length],s[h%s.length]);else{var d=e.buffer(),f=t.buffer(),p=function(n){var i=o.indexToLoc(n),h=i.slice(-e.rank);u.forEach(function(e){return h[e]=0});var p=d.locToIndex(h),m=i.slice(-t.rank);c.forEach(function(e){return m[e]=0});var g=f.locToIndex(m);l[n]=r(a[p],s[g])};for(h=0;h<l.length;++h)p(h)}return o.toTensor()},e.prototype.broadcastedBinaryComplexOp=function(e,t,n){var r=jt(e.shape,t.shape),i=Mi(r,"float32"),o=Mi(r,"float32"),a=e.dataSync(),s=t.dataSync(),u=Lt(e.shape,r),c=Lt(t.shape,r),l=i.values,h=o.values;if(u.length+c.length===0)for(var d=0;d<l.length;d++){var f=d%a.length,p=d%s.length,m=n(a[2*f],a[2*f+1],s[2*p],s[2*p+1]);l[d]=m.real,h[d]=m.imag}else{var g=this.data.get(e.dataId).complexTensors.real.buffer(),b=this.data.get(t.dataId).complexTensors.real.buffer(),y=function(r){var o=i.indexToLoc(r),d=o.slice(-e.rank);u.forEach(function(e){return d[e]=0});var f=g.locToIndex(d),p=o.slice(-t.rank);c.forEach(function(e){return p[e]=0});var m=b.locToIndex(p),y=n(a[2*f],a[2*f+1],s[2*m],s[2*m+1]);l[r]=y.real,h[r]=y.imag};for(d=0;d<l.length;d++)y(d)}return this.complex(i.toTensor(),o.toTensor())},e.prototype.split=function(e,t,n){return Tt(e,t,n)},e.prototype.dispose=function(){},e.prototype.floatPrecision=function(){return 32},e.prototype.cropAndResize=function(e,t,n,r,i,o){for(var a=e.shape,s=a[0],u=a[1],c=a[2],l=a[3],h=t.shape[0],d=r[0],f=r[1],p=Mi([h,d,f,l]),m=t.dataSync(),g=n.dataSync(),b=e.dataSync(),y=e.strides,v=p.strides,_=0;_<h;_++){var w=4*_,x=m[w],E=m[w+1],S=m[w+2],C=m[w+3],O=g[_];if(!(O>=s))for(var A=d>1?(S-x)*(u-1)/(d-1):0,M=f>1?(C-E)*(c-1)/(f-1):0,N=0;N<d;N++){var k=d>1?x*(u-1)+N*A:.5*(x+S)*(u-1);if(k<0||k>u-1)for(var I=0;I<f;I++)for(var T=0;T<l;T++){var P=T+I*v[2]+N*v[1]+_*v[0];p.values[P]=o}else if("bilinear"===i){var R=Math.floor(k),D=Math.ceil(k),L=k-R;for(I=0;I<f;I++)if((q=f>1?E*(c-1)+I*M:.5*(E+C)*(c-1))<0||q>c-1)for(T=0;T<l;T++)P=T+I*v[2]+N*v[1]+_*v[0],p.values[P]=o;else{var B=Math.floor(q),j=Math.ceil(q),F=q-B;for(T=0;T<l;T++){var z=b[P=T+B*y[2]+R*y[1]+O*y[0]],V=b[P=T+j*y[2]+R*y[1]+O*y[0]],U=b[P=T+B*y[2]+D*y[1]+O*y[0]],W=z+(V-z)*F,$=U+(b[P=T+j*y[2]+D*y[1]+O*y[0]]-U)*F;P=T+I*v[2]+N*v[1]+_*v[0],p.values[P]=W+($-W)*L}}}else for(I=0;I<f;++I){var q;if((q=f>1?E*(c-1)+I*M:.5*(E+C)*(c-1))<0||q>c-1)for(T=0;T<l;T++)P=T+I*v[2]+N*v[1]+_*v[0],p.values[P]=o;else{var H=Math.round(q),G=Math.round(k);for(T=0;T<l;T++){var K=T+H*y[2]+G*y[1]+O*y[0],Y=T+I*v[2]+N*v[1]+_*v[0];p.values[Y]=b[K]}}}}}return p.toTensor()},e}();ge.registerBackend("cpu",function(){return new Js},1,Q);var Qs="undefined"!=typeof requestAnimationFrame?requestAnimationFrame:i;function eu(){return new Promise(function(e){return Qs(function(){return e()})})}var tu={float32:4,int32:4,uint16:2,uint8:1,bool:1};function nu(e,t){for(var n={},r=0,i=function(t){var i=t.name,o=t.dtype,a=t.shape,s=v(a),u=void 0;if("quantization"in t){var c=t.quantization;if("uint8"!==c.dtype&&"uint16"!==c.dtype)throw new Error("Weight "+t.name+" has unknown quantization dtype "+c.dtype+". Supported quantization dtypes are: 'uint8' and 'uint16'.");var l=tu[c.dtype],h=e.slice(r,r+s*l),d="uint8"===c.dtype?new Uint8Array(h):new Uint16Array(h);if("float32"===o)u=Float32Array.from(d,function(e){return e*c.scale+c.min});else{if("int32"!==o)throw new Error("Unsupported dtype in weight '"+i+"': "+o);u=Int32Array.from(d,function(e){return Math.round(e*c.scale+c.min)})}r+=s*l}else{var f=tu[o];if(h=e.slice(r,r+s*f),"float32"===o)u=new Float32Array(h);else if("int32"===o)u=new Int32Array(h);else{if("bool"!==o)throw new Error("Unsupported dtype in weight '"+i+"': "+o);u=new Uint8Array(h)}r+=s*f}var p=void 0;if("float32"===o)p=rt(u,a,"float32");else if("int32"===o)p=rt(u,a,"int32");else{if("bool"!==o)throw new Error("Unsupported dtype in weight '"+i+"': "+o);p=rt(u,a,"bool")}n[i]=p},o=0,a=t;o<a.length;o++)i(a[o]);return n}var ru=void 0!==o&&("undefined"==typeof Blob||"undefined"==typeof atob||"undefined"==typeof btoa);function iu(e){return ru?o.byteLength(e):new Blob([e]).size}function ou(e){var t=0;e.forEach(function(e){t+=e.byteLength});var n=new Uint8Array(t),r=0;return e.forEach(function(e){n.set(new Uint8Array(e),r),r+=e.byteLength}),n.buffer}function au(e){for(e=e.trim();e.endsWith("/");)e=e.slice(0,e.length-1);var t=e.split("/");return t[t.length-1]}function su(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:null==e.modelTopology?0:iu(JSON.stringify(e.modelTopology)),weightSpecsBytes:null==e.weightSpecs?0:iu(JSON.stringify(e.weightSpecs)),weightDataBytes:null==e.weightData?0:e.weightData.byteLength}}var uu=function(){function e(){this.saveRouters=[],this.loadRouters=[]}return e.getInstance=function(){return null==e.instance&&(e.instance=new e),e.instance},e.registerSaveRouter=function(t){e.getInstance().saveRouters.push(t)},e.registerLoadRouter=function(t){e.getInstance().loadRouters.push(t)},e.getSaveHandlers=function(t){return e.getHandlers(t,"save")},e.getLoadHandlers=function(t){return e.getHandlers(t,"load")},e.getHandlers=function(e,t){var n=[];return("load"===t?this.getInstance().loadRouters:this.getInstance().saveRouters).forEach(function(t){var r=t(e);null!==r&&n.push(r)}),n},e}(),cu="://",lu=function(){function e(){this.managers={}}return e.getInstance=function(){return null==e.instance&&(e.instance=new e),e.instance},e.registerManager=function(t,n){p(null!=t,"scheme must not be undefined or null."),t.endsWith(cu)&&(t=t.slice(0,t.indexOf(cu))),p(t.length>0,"scheme must not be an empty string.");var r=e.getInstance();p(null==r.managers[t],"A model store manager is already registered for scheme '"+t+"'."),r.managers[t]=n},e.getManager=function(e){var t=this.getInstance().managers[e];if(null==t)throw new Error("Cannot find model manager for scheme '"+e+"'");return t},e.getSchemes=function(){return Object.keys(this.getInstance().managers)},e}();function hu(e){if(-1===e.indexOf(cu))throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+lu.getSchemes().join(","));return{scheme:e.split(cu)[0],path:e.split(cu)[1]}}function du(e,t,n){return void 0===n&&(n=!1),c(this,void 0,void 0,function(){var r,i,o,a,s,u,c,h,d;return l(this,function(l){switch(l.label){case 0:return p(e!==t,"Old path and new path are the same: '"+e+"'"),p((r=uu.getLoadHandlers(e)).length>0,"Copying failed because no load handler is found for source URL "+e+"."),p(r.length<2,"Copying failed because more than one ("+r.length+") load handlers for source URL "+e+"."),i=r[0],p((o=uu.getSaveHandlers(t)).length>0,"Copying failed because no save handler is found for destination URL "+t+"."),p(o.length<2,"Copying failed because more than one ("+r.length+") save handlers for destination URL "+t+"."),a=o[0],s=hu(e).scheme,u=hu(e).path,c=s===hu(e).scheme,[4,i.load()];case 1:return h=l.sent(),n&&c?[4,lu.getManager(s).removeModel(u)]:[3,3];case 2:l.sent(),l.label=3;case 3:return[4,a.save(h)];case 4:return d=l.sent(),!n||c?[3,6]:[4,lu.getManager(s).removeModel(u)];case 5:l.sent(),l.label=6;case 6:return[2,d.modelArtifactsInfo]}})})}var fu="models_store",pu="model_info_store";function mu(){if(!ge.get("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");var e=window,t=e.indexedDB||e.mozIndexedDB||e.webkitIndexedDB||e.msIndexedDB||e.shimIndexedDB;if(null==t)throw new Error("The current browser does not appear to support IndexedDB.");return t}function gu(e){var t=e.result;t.createObjectStore(fu,{keyPath:"modelPath"}),t.createObjectStore(pu,{keyPath:"modelPath"})}var bu=function(){function e(e){if(this.indexedDB=mu(),null==e||!e)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=e}return e.prototype.save=function(e){return c(this,void 0,void 0,function(){return l(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)]})})},e.prototype.load=function(){return c(this,void 0,void 0,function(){return l(this,function(e){return[2,this.databaseAction(this.modelPath)]})})},e.prototype.databaseAction=function(e,t){var n=this;return new Promise(function(e,r){var i=n.indexedDB.open("tensorflowjs",1);i.onupgradeneeded=function(){return gu(i)},i.onsuccess=function(){var o=i.result;if(null==t){var a=o.transaction(fu,"readonly"),s=a.objectStore(fu).get(n.modelPath);s.onsuccess=function(){if(null==s.result)return o.close(),r(new Error("Cannot find model with path '"+n.modelPath+"' in IndexedDB."));e(s.result.modelArtifacts)},s.onerror=function(e){return o.close(),r(s.error)},a.oncomplete=function(){return o.close()}}else{var u,c=su(t),l=o.transaction(pu,"readwrite"),h=l.objectStore(pu),d=h.put({modelPath:n.modelPath,modelArtifactsInfo:c});d.onsuccess=function(){var i=(u=o.transaction(fu,"readwrite")).objectStore(fu).put({modelPath:n.modelPath,modelArtifacts:t,modelArtifactsInfo:c});i.onsuccess=function(){return e({modelArtifactsInfo:c})},i.onerror=function(e){var t=(h=l.objectStore(pu)).delete(n.modelPath);t.onsuccess=function(){return o.close(),r(i.error)},t.onerror=function(e){return o.close(),r(i.error)}}},d.onerror=function(e){return o.close(),r(d.error)},l.oncomplete=function(){null==u?o.close():u.oncomplete=function(){return o.close()}}}},i.onerror=function(e){return r(i.error)}})},e.URL_SCHEME="indexeddb://",e}(),yu=function(e){return ge.get("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(bu.URL_SCHEME)?function(e){return new bu(e)}(e.slice(bu.URL_SCHEME.length)):null};uu.registerSaveRouter(yu),uu.registerLoadRouter(yu);var vu=function(){function e(){this.indexedDB=mu()}return e.prototype.listModels=function(){return c(this,void 0,void 0,function(){var e=this;return l(this,function(t){return[2,new Promise(function(t,n){var r=e.indexedDB.open("tensorflowjs",1);r.onupgradeneeded=function(){return gu(r)},r.onsuccess=function(){var e=r.result,i=e.transaction(pu,"readonly"),o=i.objectStore(pu).getAll();o.onsuccess=function(){for(var e={},n=0,r=o.result;n<r.length;n++){var i=r[n];e[i.modelPath]=i.modelArtifactsInfo}t(e)},o.onerror=function(t){return e.close(),n(o.error)},i.oncomplete=function(){return e.close()}},r.onerror=function(e){return n(r.error)}})]})})},e.prototype.removeModel=function(e){return c(this,void 0,void 0,function(){var t=this;return l(this,function(n){return e=function(e){return e.startsWith(bu.URL_SCHEME)?e.slice(bu.URL_SCHEME.length):e}(e),[2,new Promise(function(n,r){var i=t.indexedDB.open("tensorflowjs",1);i.onupgradeneeded=function(){return gu(i)},i.onsuccess=function(){var t,o=i.result,a=o.transaction(pu,"readwrite"),s=a.objectStore(pu),u=s.get(e);u.onsuccess=function(){if(null==u.result)return o.close(),r(new Error("Cannot find model with path '"+e+"' in IndexedDB."));var i=s.delete(e),a=function(){var i=(t=o.transaction(fu,"readwrite")).objectStore(fu).delete(e);i.onsuccess=function(){return n(u.result.modelArtifactsInfo)},i.onerror=function(e){return r(u.error)}};i.onsuccess=a,i.onerror=function(e){return a(),o.close(),r(u.error)}},u.onerror=function(e){return o.close(),r(u.error)},a.oncomplete=function(){null==t?o.close():t.oncomplete=function(){return o.close()}}},i.onerror=function(e){return r(i.error)}})]})})},e}();if(ge.get("IS_BROWSER"))try{lu.registerManager(bu.URL_SCHEME,new vu)}catch(e){}var _u="/",wu="tensorflowjs_models",xu="info",Eu="model_topology",Su="weight_specs",Cu="weight_data";function Ou(e){return{info:[wu,e,xu].join(_u),topology:[wu,e,Eu].join(_u),weightSpecs:[wu,e,Su].join(_u),weightData:[wu,e,Cu].join(_u)}}function Au(e){var t=e.split(_u);if(t.length<3)throw new Error("Invalid key format: "+e);return t.slice(1,t.length-1).join(_u)}var Mu=function(){function e(e){if(!ge.get("IS_BROWSER")||void 0===window.localStorage)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,null==e||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=Ou(this.modelPath)}return e.prototype.save=function(e){return c(this,void 0,void 0,function(){var t,n,r,i;return l(this,function(a){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");t=JSON.stringify(e.modelTopology),n=JSON.stringify(e.weightSpecs),r=su(e);try{return this.LS.setItem(this.keys.info,JSON.stringify(r)),this.LS.setItem(this.keys.topology,t),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,function(e){return ru?o.from(e).toString("base64"):btoa(String.fromCharCode.apply(null,new Uint8Array(e)))}(e.weightData)),[2,{modelArtifactsInfo:r}]}catch(e){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]})})},e.prototype.load=function(){return c(this,void 0,void 0,function(){var e,t,n,r,i;return l(this,function(a){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(t={},null==(n=JSON.parse(this.LS.getItem(this.keys.topology))))throw new Error("In local storage, the topology of model '"+this.modelPath+"' is missing.");if(t.modelTopology=n,null==(r=JSON.parse(this.LS.getItem(this.keys.weightSpecs))))throw new Error("In local storage, the weight specs of model '"+this.modelPath+"' are missing.");if(t.weightSpecs=r,null==(i=this.LS.getItem(this.keys.weightData)))throw new Error("In local storage, the binary weight values of model '"+this.modelPath+"' are missing.");return t.weightData=function(e){if(ru){var t=o.from(e,"base64");return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}for(var n=atob(e),r=new Uint8Array(n.length),i=0;i<n.length;++i)r.set([n.charCodeAt(i)],i);return r.buffer}(i),[2,t]})})},e.URL_SCHEME="localstorage://",e}(),Nu=function(e){return ge.get("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Mu.URL_SCHEME)?function(e){return new Mu(e)}(e.slice(Mu.URL_SCHEME.length)):null};uu.registerSaveRouter(Nu),uu.registerLoadRouter(Nu);var ku=function(){function e(){p(ge.get("IS_BROWSER"),"Current environment is not a web browser"),p(void 0!==window.localStorage,"Current browser does not appear to support localStorage"),this.LS=window.localStorage}return e.prototype.listModels=function(){return c(this,void 0,void 0,function(){var e,t,n,r,i,o;return l(this,function(a){for(e={},t=wu+_u,n=_u+xu,r=0;r<this.LS.length;++r)(i=this.LS.key(r)).startsWith(t)&&i.endsWith(n)&&(o=Au(i),e[o]=JSON.parse(this.LS.getItem(i)));return[2,e]})})},e.prototype.removeModel=function(e){return c(this,void 0,void 0,function(){var t,n;return l(this,function(r){if(e=function(e){return e.startsWith(Mu.URL_SCHEME)?e.slice(Mu.URL_SCHEME.length):e}(e),t=Ou(e),null==this.LS.getItem(t.info))throw new Error("Cannot find model at path '"+e+"'");return n=JSON.parse(this.LS.getItem(t.info)),this.LS.removeItem(t.info),this.LS.removeItem(t.topology),this.LS.removeItem(t.weightSpecs),this.LS.removeItem(t.weightData),[2,n]})})},e}();if(ge.get("IS_BROWSER"))try{lu.registerManager(Mu.URL_SCHEME,new ku)}catch(e){}var Iu="model",Tu=".json",Pu=".weights.bin",Ru=function(){function e(t){if(!ge.get("IS_BROWSER"))throw new Error("triggerDownloads() cannot proceed because the current environment is not a browser.");t.startsWith(e.URL_SCHEME)&&(t=t.slice(e.URL_SCHEME.length)),null!=t&&0!==t.length||(t=Iu),this.modelTopologyFileName=t+Tu,this.weightDataFileName=t+Pu}return e.prototype.save=function(e){return c(this,void 0,void 0,function(){var t,n,r,i,o,a;return l(this,function(s){if(t=window.URL.createObjectURL(new Blob([e.weightData],{type:"application/octet-stream"})),e.modelTopology instanceof ArrayBuffer)throw new Error("DownloadTrigger.save() does not support saving model topology in binary formats yet.");return n=[{paths:["./"+this.weightDataFileName],weights:e.weightSpecs}],r={modelTopology:e.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!=e.weightData&&((a=null==this.weightDataAnchor?document.createElement("a"):this.weightDataAnchor).download=this.weightDataFileName,a.href=t,a.click()),[2,{modelArtifactsInfo:su(e)}]})})},e.URL_SCHEME="downloads://",e}(),Du=function(){function e(e){if(null==e||e.length<1)throw new Error("When calling browserFiles, at least 1 file is required, but received "+e);this.files=e}return e.prototype.load=function(){return c(this,void 0,void 0,function(){var e,t,n=this;return l(this,function(r){return e=this.files[0],t=this.files.slice(1),[2,new Promise(function(r,i){var o=new FileReader;o.onload=function(o){var a=JSON.parse(o.target.result),s=a.modelTopology;if(null!=s){0===t.length&&r({modelTopology:s});var u=a.weightsManifest;if(null!=u){var c;try{c=n.checkManifestAndWeightFiles(u,t)}catch(e){return void i(e)}var l=[],h=[],d=[];u.forEach(function(e){e.paths.forEach(function(e){h.push(e),d.push(null)}),l.push.apply(l,e.weights)}),u.forEach(function(e){e.paths.forEach(function(e){var t=new FileReader;t.onload=function(t){var n=t.target.result,i=h.indexOf(e);d[i]=n,-1===d.indexOf(null)&&r({modelTopology:s,weightSpecs:l,weightData:ou(d)})},t.onerror=function(t){i("Failed to weights data from file of path '"+e+"'.")},t.readAsArrayBuffer(c[e])})})}else i(new Error("weightManifest field is missing from file "+e.name))}else i(new Error("modelTopology field is missing from file "+e.name))},o.onerror=function(t){i("Failed to read model topology and weights manifest JSON from file '"+e.name+"'. BrowserFiles supports loading Keras-style tf.Model artifacts only.")},o.readAsText(e)})]})})},e.prototype.checkManifestAndWeightFiles=function(e,t){for(var n=[],r=t.map(function(e){return au(e.name)}),i={},o=0,a=e;o<a.length;o++)a[o].paths.forEach(function(e){var o=au(e);if(-1!==n.indexOf(o))throw new Error("Duplicate file basename found in weights manifest: '"+o+"'");if(n.push(o),-1===r.indexOf(o))throw new Error("Weight file with basename '"+o+"' is not provided.");i[e]=t[r.indexOf(o)]});if(n.length!==t.length)throw new Error("Mismatch in the number of files in weights manifest ("+n.length+") and the number of weight files provided ("+t.length+").");return i},e}();function Lu(e,t){return c(this,void 0,void 0,function(){var n,r;return l(this,function(i){switch(i.label){case 0:return n=e.map(function(e){return fetch(e,t)}),[4,Promise.all(n)];case 1:return r=i.sent(),[4,Promise.all(r.map(function(e){return e.arrayBuffer()}))];case 2:return[2,i.sent()]}})})}uu.registerSaveRouter(function(e){return ge.get("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Ru.URL_SCHEME)?function(e){return void 0===e&&(e="model"),new Ru(e)}(e.slice(Ru.URL_SCHEME.length)):null});var Bu=function(){function e(e,t){if(this.DEFAULT_METHOD="POST","undefined"==typeof fetch)throw new Error("browserHTTPRequest is not supported outside the web browser without a fetch polyfill.");if(p(null!=e&&e.length>0,"URL path for browserHTTPRequest must not be null, undefined or empty."),Array.isArray(e)&&p(2===e.length,"URL paths for browserHTTPRequest must have a length of 2, (actual length is "+e.length+")."),this.path=e,null!=t&&null!=t.body)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t||{}}return e.prototype.save=function(e){return c(this,void 0,void 0,function(){var t,n,r,i;return l(this,function(o){switch(o.label){case 0:if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");return(t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit)).body=new FormData,n=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],r={modelTopology:e.modelTopology,weightsManifest:n},t.body.append("model.json",new Blob([JSON.stringify(r)],{type:"application/json"}),"model.json"),null!=e.weightData&&t.body.append("model.weights.bin",new Blob([e.weightData],{type:"application/octet-stream"}),"model.weights.bin"),[4,fetch(this.path,t)];case 1:if(200===(i=o.sent()).status)return[2,{modelArtifactsInfo:su(e),responses:[i]}];throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+i.status+".")}})})},e.prototype.load=function(){return c(this,void 0,void 0,function(){return l(this,function(e){return[2,Array.isArray(this.path)?this.loadBinaryModel():this.loadJSONModel()]})})},e.prototype.loadBinaryTopology=function(){return c(this,void 0,void 0,function(){var e;return l(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,fetch(this.path[0],this.requestInit)];case 1:return[4,t.sent().arrayBuffer()];case 2:return[2,t.sent()];case 3:throw e=t.sent(),new Error(this.path[0]+" not found. "+e);case 4:return[2]}})})},e.prototype.loadBinaryModel=function(){return c(this,void 0,void 0,function(){var e,t,n,r,i,o,a,s;return l(this,function(u){switch(u.label){case 0:return e=this.loadBinaryTopology(),[4,fetch(this.path[1],this.requestInit)];case 1:return t=u.sent(),[4,Promise.all([e,t])];case 2:return n=u.sent(),r=n[0],[4,n[1].json()];case 3:return null==(i=u.sent())?[3,5]:[4,this.loadWeights(i)];case 4:s=u.sent(),o=s[0],a=s[1],u.label=5;case 5:return[2,{modelTopology:r,weightSpecs:o,weightData:a}]}})})},e.prototype.loadJSONModel=function(){return c(this,void 0,void 0,function(){var e,t,n,r,i,o,a;return l(this,function(s){switch(s.label){case 0:return[4,fetch(this.path,this.requestInit)];case 1:return[4,s.sent().json()];case 2:if(e=s.sent(),t=e.modelTopology,n=e.weightsManifest,null==t&&null==n)throw new Error("The JSON from HTTP path "+this.path+" contains neither model topology or manifest for weights.");return null==n?[3,4]:(o=e.weightsManifest,[4,this.loadWeights(o)]);case 3:a=s.sent(),r=a[0],i=a[1],s.label=4;case 4:return[2,{modelTopology:t,weightSpecs:r,weightData:i}]}})})},e.prototype.loadWeights=function(e){return c(this,void 0,void 0,function(){var t,n,r,i,o,a,s,u,c;return l(this,function(l){switch(l.label){case 0:for(t=Array.isArray(this.path)?this.path[1]:this.path,n=[],r=0,i=e;r<i.length;r++)o=i[r],n.push.apply(n,o.weights);return(a=t.substring(0,t.lastIndexOf("/"))).endsWith("/")||(a+="/"),s=[],e.forEach(function(e){e.paths.forEach(function(e){s.push(a+e)})}),u=[n],c=ou,[4,Lu(s,this.requestInit)];case 1:return[2,u.concat([c.apply(void 0,[l.sent()])])]}})})},e.URL_SCHEME_REGEX=/^https?:\/\//,e}();function ju(e){return null!=e.match(Bu.URL_SCHEME_REGEX)}var Fu=function(e){return"undefined"==typeof fetch?null:(Array.isArray(e)?e.every(function(e){return ju(e)}):ju(e))?zu(e):null};function zu(e,t){return new Bu(e,t)}uu.registerSaveRouter(Fu),uu.registerLoadRouter(Fu);var Vu=function(){function e(e,t,n){this.modelTopology=e,this.weightSpecs=t,this.weightData=n}return e.prototype.load=function(){return c(this,void 0,void 0,function(){var e;return l(this,function(t){return e={},null!=this.modelTopology&&(e=u({modelTopology:this.modelTopology},e)),null!=this.weightSpecs&&this.weightSpecs.length>0&&(e=u({weightSpecs:this.weightSpecs},e)),null!=this.weightData&&this.weightData.byteLength>0&&(e=u({weightData:this.weightData},e)),[2,e]})})},e}(),Uu=function(){function e(e){this.saveHandler=e}return e.prototype.save=function(e){return c(this,void 0,void 0,function(){return l(this,function(t){return[2,this.saveHandler(e)]})})},e}();var Wu=uu.registerSaveRouter,$u=uu.registerLoadRouter,qu=uu.getSaveHandlers,Hu=uu.getLoadHandlers,Gu=Object.freeze({browserFiles:function(e){return new Du(e)},browserHTTPRequest:zu,concatenateArrayBuffers:ou,decodeWeights:nu,encodeWeights:function(e){return c(this,void 0,void 0,function(){var t,n,r,i;return l(this,function(o){switch(o.label){case 0:for(r in t=[],n=[],e){if("float32"!==(i=e[r]).dtype&&"int32"!==i.dtype&&"bool"!==i.dtype)throw new Error("Unsupported dtype in weight '"+r+"': "+i.dtype);t.push({name:r,shape:i.shape,dtype:i.dtype}),n.push(i.data())}return[4,Promise.all(n)];case 1:return[2,{data:function(e){if(null===e)throw new Error("Invalid input value: "+JSON.stringify(e));var t=0,n=[];e.forEach(function(e){if(t+=e.byteLength,n.push(e.byteLength===e.buffer.byteLength?e:new e.constructor(e)),!(e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array))throw new Error("Unsupported TypedArray subtype: "+e.constructor.name)});var r=new Uint8Array(t),i=0;return n.forEach(function(e){r.set(new Uint8Array(e.buffer),i),i+=e.byteLength}),r.buffer}(o.sent()),specs:t}]}})})},fromMemory:function(e,t,n){return new Vu(e,t,n)},getLoadHandlers:Hu,getModelArtifactsInfoForJSON:su,getSaveHandlers:qu,loadWeights:function(e,t,n,r){return void 0===t&&(t=""),c(this,void 0,void 0,function(){var i,o,a,s,u,c,h,d,f,p;return l(this,function(l){switch(l.label){case 0:if(i=e.map(function(){return!1}),o={},a=null!=n?n.map(function(){return!1}):[],s=[],e.forEach(function(e,t){var r=0;e.weights.forEach(function(e){var u="quantization"in e?e.quantization.dtype:e.dtype,c=tu[u]*v(e.shape),l=function(){i[t]=!0,null==o[t]&&(o[t]=[]),o[t].push({manifestEntry:e,groupOffset:r,sizeBytes:c})};null!=n?n.forEach(function(t,n){t===e.name&&(l(),a[n]=!0)}):l(),s.push(e.name),r+=c})}),!a.every(function(e){return e}))throw u=n.filter(function(e,t){return!a[t]}),new Error("Could not find weights in manifest with names: "+u.join(", ")+". \nManifest JSON has weights with names: "+s.join(", ")+".");return c=i.reduce(function(e,t,n){return t&&e.push(n),e},[]),h=[],c.forEach(function(n){e[n].paths.forEach(function(e){var n=t+(t.endsWith("/")?"":"/")+e;h.push(n)})}),[4,Lu(h,r)];case 1:return d=l.sent(),f={},p=0,c.forEach(function(t){for(var n=e[t].paths.length,r=0,i=0;i<n;i++)r+=d[p+i].byteLength;for(var a=new ArrayBuffer(r),s=new Uint8Array(a),u=0,c=0;c<n;c++){var l=new Uint8Array(d[p+c]);s.set(l,u),u+=l.byteLength}o[t].forEach(function(e){var t=nu(a.slice(e.groupOffset,e.groupOffset+e.sizeBytes),[e.manifestEntry]);for(var n in t)f[n]=t[n]}),p+=n}),[2,f]}})})},registerLoadRouter:$u,registerSaveRouter:Wu,withSaveHandler:function(e){return new Uu(e)},copyModel:function(e,t){return c(this,void 0,void 0,function(){return l(this,function(n){switch(n.label){case 0:return[4,du(e,t,!1)];case 1:return[2,n.sent()]}})})},listModels:function(){return c(this,void 0,void 0,function(){var e,t,n,r,i,o,a;return l(this,function(s){switch(s.label){case 0:e=lu.getSchemes(),t={},n=0,r=e,s.label=1;case 1:return n<r.length?(i=r[n],[4,lu.getManager(i).listModels()]):[3,4];case 2:for(a in o=s.sent())t[i+cu+a]=o[a];s.label=3;case 3:return n++,[3,1];case 4:return[2,t]}})})},moveModel:function(e,t){return c(this,void 0,void 0,function(){return l(this,function(n){switch(n.label){case 0:return[4,du(e,t,!0)];case 1:return[2,n.sent()]}})})},removeModel:function(e){return c(this,void 0,void 0,function(){var t;return l(this,function(n){switch(n.label){case 0:return t=hu(e),[4,lu.getManager(t.scheme).removeModel(t.path)];case 1:return[2,n.sent()]}})})}}),Ku=function(){function e(){}return e.prototype.getClassName=function(){return this.constructor.className},e.fromConfig=function(e,t){return new e(t)},e}(),Yu=function(){function e(){this.classNameMap={}}return e.getMap=function(){return null==e.instance&&(e.instance=new e),e.instance},e.register=function(t){e.getMap().classNameMap[t.className]=[t,t.fromConfig]},e}();function Xu(e){p(null!=e.className,"Class being registered does not have the static className property defined."),p("string"==typeof e.className,"className is required to be a string, but got type "+typeof e.className),p(e.className.length>0,"Class being registered has an empty-string as its className, which is disallowed."),Yu.register(e)}var Zu=Object.freeze({Serializable:Ku,SerializationMap:Yu,registerClass:Xu});function Ju(e,t,n){if(null==n&&(n=ge.get("TEST_EPSILON")),e instanceof ee||t instanceof ee){if(e instanceof ee&&t instanceof ee){if(e.dtype!==t.dtype)throw new Error("Arrays are of different type actual: "+e.dtype+" vs expected: "+t.dtype+".");if(!_(e.shape,t.shape))throw new Error("Arrays are of different shape actual: "+e.shape+" vs expected: "+t.shape+".")}}else{var r=e.constructor.name,i=t.constructor.name;if(r!==i)throw new Error("Arrays are of different type actual: "+r+" vs expected: "+i)}var o,a;if(o=e instanceof ee?e.dataSync():e,a=t instanceof ee?t.dataSync():t,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(!Qu(u,Number(c),n))throw new Error("Arrays differ: actual["+s+"] = "+u+", expected["+s+"] = "+c+".\nActual:   "+o+".\nExpected: "+a+".")}}function Qu(e,t,n){return!(!isNaN(e)||!isNaN(t))||!(isNaN(e)||isNaN(t)||Math.abs(e-t)>n)}var ec=Object.freeze({WEBGL_ENVS:{HAS_WEBGL:!0},NODE_ENVS:{IS_NODE:!0},CHROME_ENVS:{IS_CHROME:!0},BROWSER_ENVS:{IS_BROWSER:!0},CPU_ENVS:{HAS_WEBGL:!1},ALL_ENVS:{},expectArraysClose:Ju,expectPromiseToFail:function(e,t){e().then(function(){return t.fail()},function(){return t()})},expectArraysEqual:function(e,t){return Ju(e,t,0)},expectNumbersClose:function(e,t,n){if(null==n&&(n=ge.get("TEST_EPSILON")),!Qu(e,t,n))throw new Error("Numbers differ: actual === "+e+", expected === "+t)},expectValuesInRange:function(e,t,n){var r;r=e instanceof ee?e.dataSync():e;for(var i=0;i<r.length;i++)if(r[i]<t||r[i]>n)throw new Error("Value out of range:"+r[i]+" low: "+t+", high: "+n)},expectArrayBuffersEqual:function(e,t){expect(new Float32Array(e)).toEqual(new Float32Array(t))}}),tc="0.13.0",nc=Object.freeze({gpgpu_util:Cr,webgl_util:rr,MathBackendWebGL:ro,GPGPUContext:Or}),rc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s(t,e),t.prototype.minimize=function(e,t,n){void 0===t&&(t=!1);var r=this.computeGradients(e,n),i=r.value,o=r.grads;return this.applyGradients(o),Object.keys(o).forEach(function(e){return o[e].dispose()}),t?i:(i.dispose(),null)},t.prototype.computeGradients=function(e,t){return xe(e,t)},t}(Ku),ic=function(e){function t(t,n,r){void 0===r&&(r=null);var i=e.call(this)||this;return i.learningRate=t,i.rho=n,i.epsilon=r,i.accumulatedGrads={},i.accumulatedUpdates={},i.c=Oe(it(-t)),i.rhoScalar=Oe(it(n)),i.oneMinusRho=Oe(it(1-n)),null===r&&(r=ge.get("EPSILON")),i.epsilonScalar=Oe(it(r)),i}return s(t,e),t.prototype.applyGradients=function(e){var t=this,n=function(n){var i=ge.engine.registeredVariables[n];null==r.accumulatedGrads[n]&&Ce(function(){t.accumulatedGrads[n]=Et(i).variable(!1)}),null==r.accumulatedUpdates[n]&&Ce(function(){t.accumulatedUpdates[n]=Et(i).variable(!1)});var o=e[n],a=r.accumulatedGrads[n],s=r.accumulatedUpdates[n];Ce(function(){var e=t.rhoScalar.mul(a).add(t.oneMinusRho.mul(o.square())),r=s.add(t.epsilonScalar).sqrt().div(a.add(t.epsilonScalar).sqrt()).mul(o),u=t.rhoScalar.mul(s).add(t.oneMinusRho.mul(r.square()));t.accumulatedGrads[n].assign(e),t.accumulatedUpdates[n].assign(u);var c=t.c.mul(r).add(i);i.assign(c)})},r=this;for(var i in e)n(i)},t.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()}))},t.prototype.getConfig=function(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}},t.fromConfig=function(e,t){return new e(t.learningRate,t.rho,t.epsilon)},t.className="AdadeltaOptimizer",t}(rc);Xu(ic);var oc=function(e){function t(t,n){void 0===n&&(n=.1);var r=e.call(this)||this;return r.learningRate=t,r.initialAccumulatorValue=n,r.accumulatedGrads={},r.c=Oe(it(-t)),r.epsilon=Oe(it(ge.get("EPSILON"))),r}return s(t,e),t.prototype.applyGradients=function(e){var t=this,n=function(n){var i=ge.engine.registeredVariables[n];null==r.accumulatedGrads[n]&&Ce(function(){t.accumulatedGrads[n]=ft(i.shape,t.initialAccumulatorValue).variable(!1)});var o=e[n],a=r.accumulatedGrads[n];Ce(function(){var e=a.add(o.square());t.accumulatedGrads[n].assign(e);var r=t.c.mul(o.div(e.add(t.epsilon).sqrt())).add(i);i.assign(r)})},r=this;for(var i in e)n(i)},t.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()})},t.prototype.getConfig=function(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}},t.fromConfig=function(e,t){return new e(t.learningRate,t.initialAccumulatorValue)},t.className="AdagradOptimizer",t}(rc);Xu(oc);var ac=function(e){function t(t,n,r,i){void 0===i&&(i=null);var o=e.call(this)||this;return o.learningRate=t,o.beta1=n,o.beta2=r,o.epsilon=i,o.accumulatedFirstMoment={},o.accumulatedSecondMoment={},o.c=Oe(it(-t)),o.beta1Scalar=Oe(it(n)),o.beta2Scalar=Oe(it(r)),Ce(function(){o.accBeta1=it(n).variable(),o.accBeta2=it(r).variable()}),o.oneMinusBeta1=Oe(it(1-n)),o.oneMinusBeta2=Oe(it(1-r)),o.one=Oe(it(1)),null===i&&(i=ge.get("EPSILON")),o.epsScalar=Oe(it(i)),o}return s(t,e),t.prototype.applyGradients=function(e){var t=this;Ce(function(){var n=t.one.sub(t.accBeta1),r=t.one.sub(t.accBeta2);for(var i in e){var o=ge.engine.registeredVariables[i];if(null==t.accumulatedFirstMoment[i]){var a=!1;t.accumulatedFirstMoment[i]=Et(o).variable(a)}null==t.accumulatedSecondMoment[i]&&(a=!1,t.accumulatedSecondMoment[i]=Et(o).variable(a));var s=e[i],u=t.accumulatedFirstMoment[i],c=t.accumulatedSecondMoment[i],l=t.beta1Scalar.mul(u).add(t.oneMinusBeta1.mul(s)),h=t.beta2Scalar.mul(c).add(t.oneMinusBeta2.mul(s.square())),d=l.div(n),f=h.div(r);t.accumulatedFirstMoment[i].assign(l),t.accumulatedSecondMoment[i].assign(h);var p=t.c.mul(d.div(t.epsScalar.add(f.sqrt()))).add(o);o.assign(p)}t.accBeta1.assign(t.accBeta1.mul(t.beta1Scalar)),t.accBeta2.assign(t.accBeta2.mul(t.beta2Scalar))})},t.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()})},t.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}},t.fromConfig=function(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)},t.className="AdamOptimizer",t}(rc);Xu(ac);var sc=function(e){function t(t,n,r,i,o){void 0===i&&(i=null),void 0===o&&(o=0);var a=e.call(this)||this;return a.learningRate=t,a.beta1=n,a.beta2=r,a.epsilon=i,a.decay=o,a.accumulatedFirstMoment={},a.accumulatedWeightedInfNorm={},a.c=Oe(it(-t)),a.beta1Scalar=Oe(it(n)),a.beta2Scalar=Oe(it(r)),a.decayScalar=Oe(it(o)),Ce(function(){a.iteration=it(0).variable(),a.accBeta1=it(n).variable()}),a.oneMinusBeta1=Oe(it(1-n)),a.one=Oe(it(1)),null===i&&(i=ge.get("EPSILON")),a.epsScalar=Oe(it(i)),a}return s(t,e),t.prototype.applyGradients=function(e){var t=this;Ce(function(){var n=t.one.sub(t.accBeta1),r=t.c.div(t.one.add(t.decayScalar.mul(t.iteration)));for(var i in e){var o=ge.engine.registeredVariables[i];if(null==t.accumulatedFirstMoment[i]){var a=!1;t.accumulatedFirstMoment[i]=Et(o).variable(a)}null==t.accumulatedWeightedInfNorm[i]&&(a=!1,t.accumulatedWeightedInfNorm[i]=Et(o).variable(a));var s=e[i],u=t.accumulatedFirstMoment[i],c=t.accumulatedWeightedInfNorm[i],l=t.beta1Scalar.mul(u).add(t.oneMinusBeta1.mul(s)),h=t.beta2Scalar.mul(c),d=s.abs(),f=h.maximum(d);t.accumulatedFirstMoment[i].assign(l),t.accumulatedWeightedInfNorm[i].assign(f);var p=r.div(n).mul(l.div(t.epsScalar.add(f))).add(o);o.assign(p)}t.iteration.assign(t.iteration.add(t.one)),t.accBeta1.assign(t.accBeta1.mul(t.beta1Scalar))})},t.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()})},t.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}},t.fromConfig=function(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)},t.className="AdamaxOptimizer",t}(rc);Xu(sc);var uc=function(e){function t(t){var n=e.call(this)||this;return n.learningRate=t,n.setLearningRate(t),n}return s(t,e),t.prototype.applyGradients=function(e){var t=this;Object.keys(e).forEach(function(n){var r=e[n],i=ge.engine.registeredVariables[n];Ce(function(){var e=t.c.mul(r).add(i);i.assign(e)})})},t.prototype.setLearningRate=function(e){this.learningRate=e,null!=this.c&&this.c.dispose(),this.c=Oe(it(-e))},t.prototype.dispose=function(){this.c.dispose()},t.prototype.getConfig=function(){return{learningRate:this.learningRate}},t.fromConfig=function(e,t){return new e(t.learningRate)},t.className="SGDOptimizer",t}(rc);Xu(uc);var cc=function(e){function t(t,n,r){void 0===r&&(r=!1);var i=e.call(this,t)||this;return i.learningRate=t,i.momentum=n,i.useNesterov=r,i.m=it(i.momentum),i.accumulations={},i}return s(t,e),t.prototype.applyGradients=function(e){var t=this,n=function(n){var i=ge.engine.registeredVariables[n];null==r.accumulations[n]&&Ce(function(){t.accumulations[n]=Et(i).variable(!1)});var o=r.accumulations[n],a=e[n];Ce(function(){var e,r=t.m.mul(o).add(a);e=t.useNesterov?t.c.mul(a.add(r.mul(t.m))).add(i):t.c.mul(r).add(i),t.accumulations[n].assign(r),i.assign(e)})},r=this;for(var i in e)n(i)},t.prototype.dispose=function(){if(e.prototype.dispose.call(this),this.m.dispose(),null!=this.accumulations)for(var t in this.accumulations)this.accumulations[t].dispose()},t.prototype.setMomentum=function(e){this.momentum=e},t.prototype.getConfig=function(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}},t.fromConfig=function(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)},t.className="MomentumOptimizer",t}(uc);Xu(cc);var lc=function(e){function t(t,n,r,i,o){void 0===n&&(n=.9),void 0===r&&(r=0),void 0===i&&(i=null),void 0===o&&(o=!1);var a=e.call(this)||this;return a.learningRate=t,a.decay=n,a.momentum=r,a.epsilon=i,a.accumulatedMeanSquares={},a.accumulatedMeanGrads={},a.accumulatedMoments={},a.c=Oe(it(t)),a.decayScalar=Oe(it(n)),a.momentumScalar=Oe(it(r)),a.oneMinusDecay=Oe(it(1-n)),a.centered=o,null===i&&(i=ge.get("EPSILON")),a.epsilonScalar=Oe(it(i)),a}return s(t,e),t.prototype.applyGradients=function(e){var t=this,n=function(n){var i=ge.engine.registeredVariables[n];null==r.accumulatedMeanSquares[n]&&Ce(function(){t.accumulatedMeanSquares[n]=Et(i).variable(!1)}),null==r.accumulatedMeanGrads[n]&&r.centered&&Ce(function(){t.accumulatedMeanGrads[n]=Et(i).variable(!1)}),null==r.accumulatedMoments[n]&&Ce(function(){t.accumulatedMoments[n]=Et(i).variable(!1)});var o=r.accumulatedMeanSquares[n],a=r.accumulatedMeanGrads[n],s=r.accumulatedMoments[n],u=e[n];Ce(function(){var e=t.decayScalar.mul(o).add(t.oneMinusDecay.mul(u.square()));if(t.centered){var r=t.decayScalar.mul(a).add(t.oneMinusDecay.mul(u)),c=t.momentumScalar.mul(s).add(t.c.mul(u).div(e.sub(r.square().add(t.epsilonScalar)).sqrt()));t.accumulatedMeanSquares[n].assign(e),t.accumulatedMeanGrads[n].assign(r),t.accumulatedMoments[n].assign(c);var l=i.sub(c);i.assign(l)}else{var h=t.decayScalar.mul(o).add(t.oneMinusDecay.mul(u.square()));c=t.momentumScalar.mul(s).add(t.c.mul(u).div(h.add(t.epsilonScalar).sqrt())),t.accumulatedMeanSquares[n].assign(h),t.accumulatedMoments[n].assign(c),l=i.sub(c),i.assign(l)}})},r=this;for(var i in e)n(i)},t.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()})},t.prototype.getConfig=function(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}},t.fromConfig=function(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)},t.className="RMSPropOptimizer",t}(rc);Xu(lc);var hc=function(){function e(){}return e.sgd=function(e){return new uc(e)},e.momentum=function(e,t,n){return void 0===n&&(n=!1),new cc(e,t,n)},e.rmsprop=function(e,t,n,r,i){return void 0===t&&(t=.9),void 0===n&&(n=0),void 0===r&&(r=null),void 0===i&&(i=!1),new lc(e,t,n,r,i)},e.adam=function(e,t,n,r){return void 0===e&&(e=.001),void 0===t&&(t=.9),void 0===n&&(n=.999),void 0===r&&(r=null),new ac(e,t,n,r)},e.adadelta=function(e,t,n){return void 0===e&&(e=.001),void 0===t&&(t=.95),void 0===n&&(n=null),new ic(e,t,n)},e.adamax=function(e,t,n,r,i){return void 0===e&&(e=.002),void 0===t&&(t=.9),void 0===n&&(n=.999),void 0===r&&(r=null),void 0===i&&(i=0),new sc(e,t,n,r,i)},e.adagrad=function(e,t){return void 0===t&&(t=.1),new oc(e,t)},e}(),dc={sgd:hc.sgd,momentum:hc.momentum,adadelta:hc.adadelta,adagrad:hc.adagrad,rmsprop:hc.rmsprop,adamax:hc.adamax,adam:hc.adam},fc=me.setBackend,pc=me.getBackend,mc=me.disposeVariables,gc=me.memory;!function(e){J=e}(Zs)}).call(this,n(12),n(11),n(93).setImmediate,n(5).Buffer)},function(e,t,n){"use strict";n.r(t);n(17);
/**
@license
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/let r=0;function i(){}i.prototype.__mixinApplications,i.prototype.__mixinSet;const o=function(e){let t=e.__mixinApplications;t||(t=new WeakMap,e.__mixinApplications=t);let n=r++;return function(r){let i=r.__mixinSet;if(i&&i[n])return r;let o=t,a=o.get(r);a||(a=e(r),o.set(r,a));let s=Object.create(a.__mixinSet||i||null);return s[n]=!0,a.__mixinSet=s,a}};
/**
@license
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
const a=n(35).a,s=o(e=>{return class extends e{static createProperties(e){const t=this.prototype;for(let n in e)n in t||t._createPropertyAccessor(n)}static attributeNameForProperty(e){return e.toLowerCase()}static typeForProperty(e){}_createPropertyAccessor(e,t){this._addPropertyToAttributeMap(e),this.hasOwnProperty("__dataHasAccessor")||(this.__dataHasAccessor=Object.assign({},this.__dataHasAccessor)),this.__dataHasAccessor[e]||(this.__dataHasAccessor[e]=!0,this._definePropertyAccessor(e,t))}_addPropertyToAttributeMap(e){if(this.hasOwnProperty("__dataAttributes")||(this.__dataAttributes=Object.assign({},this.__dataAttributes)),!this.__dataAttributes[e]){const t=this.constructor.attributeNameForProperty(e);this.__dataAttributes[t]=e}}_definePropertyAccessor(e,t){Object.defineProperty(this,e,{get(){return this._getProperty(e)},set:t?function(){}:function(t){this._setProperty(e,t)}})}constructor(){super(),this.__dataEnabled=!1,this.__dataReady=!1,this.__dataInvalid=!1,this.__data={},this.__dataPending=null,this.__dataOld=null,this.__dataInstanceProps=null,this.__serializing=!1,this._initializeProperties()}ready(){this.__dataReady=!0,this._flushProperties()}_initializeProperties(){for(let e in this.__dataHasAccessor)this.hasOwnProperty(e)&&(this.__dataInstanceProps=this.__dataInstanceProps||{},this.__dataInstanceProps[e]=this[e],delete this[e])}_initializeInstanceProperties(e){Object.assign(this,e)}_setProperty(e,t){this._setPendingProperty(e,t)&&this._invalidateProperties()}_getProperty(e){return this.__data[e]}_setPendingProperty(e,t,n){let r=this.__data[e],i=this._shouldPropertyChange(e,t,r);return i&&(this.__dataPending||(this.__dataPending={},this.__dataOld={}),!this.__dataOld||e in this.__dataOld||(this.__dataOld[e]=r),this.__data[e]=t,this.__dataPending[e]=t),i}_invalidateProperties(){!this.__dataInvalid&&this.__dataReady&&(this.__dataInvalid=!0,a.run(()=>{this.__dataInvalid&&(this.__dataInvalid=!1,this._flushProperties())}))}_enableProperties(){this.__dataEnabled||(this.__dataEnabled=!0,this.__dataInstanceProps&&(this._initializeInstanceProperties(this.__dataInstanceProps),this.__dataInstanceProps=null),this.ready())}_flushProperties(){const e=this.__data,t=this.__dataPending,n=this.__dataOld;this._shouldPropertiesChange(e,t,n)&&(this.__dataPending=null,this.__dataOld=null,this._propertiesChanged(e,t,n))}_shouldPropertiesChange(e,t,n){return Boolean(t)}_propertiesChanged(e,t,n){}_shouldPropertyChange(e,t,n){return n!==t&&(n==n||t==t)}attributeChangedCallback(e,t,n,r){t!==n&&this._attributeToProperty(e,n),super.attributeChangedCallback&&super.attributeChangedCallback(e,t,n,r)}_attributeToProperty(e,t,n){if(!this.__serializing){const r=this.__dataAttributes,i=r&&r[e]||e;this[i]=this._deserializeValue(t,n||this.constructor.typeForProperty(i))}}_propertyToAttribute(e,t,n){this.__serializing=!0,n=arguments.length<3?this[e]:n,this._valueToNodeAttribute(this,n,t||this.constructor.attributeNameForProperty(e)),this.__serializing=!1}_valueToNodeAttribute(e,t,n){const r=this._serializeValue(t);void 0===r?e.removeAttribute(n):e.setAttribute(n,r)}_serializeValue(e){switch(typeof e){case"boolean":return e?"":void 0;default:return null!=e?e.toString():void 0}}_deserializeValue(e,t){switch(t){case Boolean:return null!==e;case Number:return Number(e);default:return e}}}});const u=o(e=>{const t=s(e);function n(e){const t=Object.getPrototypeOf(e);return t.prototype instanceof i?t:null}function r(e){if(!e.hasOwnProperty(JSCompiler_renameProperty("__ownProperties",e))){let t=null;e.hasOwnProperty(JSCompiler_renameProperty("properties",e))&&e.properties&&(t=
/**
@license
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
function(e){const t={};for(let n in e){const r=e[n];t[n]="function"==typeof r?{type:r}:r}return t}(e.properties)),e.__ownProperties=t}return e.__ownProperties}class i extends t{static get observedAttributes(){const e=this._properties;return e?Object.keys(e).map(e=>this.attributeNameForProperty(e)):[]}static finalize(){if(!this.hasOwnProperty(JSCompiler_renameProperty("__finalized",this))){const e=n(this);e&&e.finalize(),this.__finalized=!0,this._finalizeClass()}}static _finalizeClass(){const e=r(this);e&&this.createProperties(e)}static get _properties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("__properties",this))){const e=n(this);this.__properties=Object.assign({},e&&e._properties,r(this))}return this.__properties}static typeForProperty(e){const t=this._properties[e];return t&&t.type}_initializeProperties(){this.constructor.finalize(),super._initializeProperties()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._enableProperties()}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback()}}return i}),c={},l=/([A-Z])/g;
/**
@license
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/function h(e){return c[e]||(c[e]=e.replace(l,"-$1").toLowerCase())}
/**
 * @license
 * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at
 * http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at
 * http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at
 * http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at
 * http://polymer.github.io/PATENTS.txt
 */const d=new Map;class f{constructor(e,t,n,r=N){this.strings=e,this.values=t,this.type=n,this.partCallback=r}getHTML(){const e=this.strings.length-1;let t="",n=!0;for(let r=0;r<e;r++){const e=this.strings[r];t+=e;const i=v(e);t+=(n=i>-1?i<e.length:n)?g:m}return t+=this.strings[e]}getTemplateElement(){const e=document.createElement("template");return e.innerHTML=this.getHTML(),e}}class p extends f{getHTML(){return`<svg>${super.getHTML()}</svg>`}getTemplateElement(){const e=super.getTemplateElement(),t=e.content,n=t.firstChild;return t.removeChild(n),I(t,n.firstChild),e}}const m=`{{lit-${String(Math.random()).slice(2)}}}`,g=`\x3c!--${m}--\x3e`,b=new RegExp(`${m}|${g}`),y=/[ \x09\x0a\x0c\x0d]([^\0-\x1F\x7F-\x9F \x09\x0a\x0c\x0d"'>=/]+)[ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*)$/;function v(e){const t=e.lastIndexOf(">");return e.indexOf("<",t+1)>-1?e.length:t}class _{constructor(e,t,n,r,i){this.type=e,this.index=t,this.name=n,this.rawName=r,this.strings=i}}const w=e=>-1!==e.index;class x{constructor(e,t){this.parts=[],this.element=t;const n=this.element.content,r=document.createTreeWalker(n,133,null,!1);let i=-1,o=0;const a=[];let s,u;for(;r.nextNode();){i++,s=u;const t=u=r.currentNode;if(1===t.nodeType){if(!t.hasAttributes())continue;const n=t.attributes;let r=0;for(let e=0;e<n.length;e++)n[e].value.indexOf(m)>=0&&r++;for(;r-- >0;){const r=e.strings[o],a=y.exec(r)[1],s=n.getNamedItem(a),u=s.value.split(b);this.parts.push(new _("attribute",i,s.name,a,u)),t.removeAttribute(s.name),o+=u.length-1}}else if(3===t.nodeType){const e=t.nodeValue;if(e.indexOf(m)<0)continue;const n=t.parentNode,r=e.split(b),s=r.length-1;o+=s;for(let e=0;e<s;e++)n.insertBefore(""===r[e]?document.createComment(""):document.createTextNode(r[e]),t),this.parts.push(new _("node",i++));n.insertBefore(""===r[s]?document.createComment(""):document.createTextNode(r[s]),t),a.push(t)}else if(8===t.nodeType&&t.nodeValue===m){const e=t.parentNode,n=t.previousSibling;null===n||n!==s||n.nodeType!==Node.TEXT_NODE?e.insertBefore(document.createComment(""),t):i--,this.parts.push(new _("node",i++)),a.push(t),null===t.nextSibling?e.insertBefore(document.createComment(""),t):i--,u=s,o++}}for(const e of a)e.parentNode.removeChild(e)}}const E=(e,t)=>S(t)?(t=t(e),C):null===t?void 0:t,S=e=>"function"==typeof e&&!0===e.__litDirective,C={},O=e=>null===e||!("object"==typeof e||"function"==typeof e);class A{constructor(e,t,n,r){this.instance=e,this.element=t,this.name=n,this.strings=r,this.size=r.length-1,this._previousValues=[]}_interpolate(e,t){const n=this.strings,r=n.length-1;let i="";for(let o=0;o<r;o++){i+=n[o];const r=E(this,e[t+o]);if(r&&r!==C&&(Array.isArray(r)||"string"!=typeof r&&r[Symbol.iterator]))for(const e of r)i+=e;else i+=r}return i+n[r]}_equalToPreviousValues(e,t){for(let n=t;n<t+this.size;n++)if(this._previousValues[n]!==e[n]||!O(e[n]))return!1;return!0}setValue(e,t){if(this._equalToPreviousValues(e,t))return;const n=this.strings;let r;2===n.length&&""===n[0]&&""===n[1]?(r=E(this,e[t]),Array.isArray(r)&&(r=r.join(""))):r=this._interpolate(e,t),r!==C&&this.element.setAttribute(this.name,r),this._previousValues=e}}class M{constructor(e,t,n){this.instance=e,this.startNode=t,this.endNode=n,this._previousValue=void 0}setValue(e){if((e=E(this,e))!==C)if(O(e)){if(e===this._previousValue)return;this._setText(e)}else e instanceof f?this._setTemplateResult(e):Array.isArray(e)||e[Symbol.iterator]?this._setIterable(e):e instanceof Node?this._setNode(e):void 0!==e.then?this._setPromise(e):this._setText(e)}_insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}_setNode(e){this._previousValue!==e&&(this.clear(),this._insert(e),this._previousValue=e)}_setText(e){const t=this.startNode.nextSibling;e=void 0===e?"":e,t===this.endNode.previousSibling&&t.nodeType===Node.TEXT_NODE?t.textContent=e:this._setNode(document.createTextNode(e)),this._previousValue=e}_setTemplateResult(e){const t=this.instance._getTemplate(e);let n;this._previousValue&&this._previousValue.template===t?n=this._previousValue:(n=new k(t,this.instance._partCallback,this.instance._getTemplate),this._setNode(n._clone()),this._previousValue=n),n.update(e.values)}_setIterable(e){Array.isArray(this._previousValue)||(this.clear(),this._previousValue=[]);const t=this._previousValue;let n=0;for(const r of e){let e=t[n];if(void 0===e){let r=this.startNode;if(n>0){r=t[n-1].endNode=document.createTextNode(""),this._insert(r)}e=new M(this.instance,r,this.endNode),t.push(e)}e.setValue(r),n++}if(0===n)this.clear(),this._previousValue=void 0;else if(n<t.length){const e=t[n-1];t.length=n,this.clear(e.endNode.previousSibling),e.endNode=this.endNode}}_setPromise(e){this._previousValue=e,e.then(t=>{this._previousValue===e&&this.setValue(t)})}clear(e=this.startNode){T(this.startNode.parentNode,e.nextSibling,this.endNode)}}const N=(e,t,n)=>{if("attribute"===t.type)return new A(e,n,t.name,t.strings);if("node"===t.type)return new M(e,n,n.nextSibling);throw new Error(`Unknown part type ${t.type}`)};class k{constructor(e,t,n){this._parts=[],this.template=e,this._partCallback=t,this._getTemplate=n}update(e){let t=0;for(const n of this._parts)n?void 0===n.size?(n.setValue(e[t]),t++):(n.setValue(e,t),t+=n.size):t++}_clone(){const e=this.template.element.content.cloneNode(!0),t=this.template.parts;if(t.length>0){const n=document.createTreeWalker(e,133,null,!1);let r=-1;for(let e=0;e<t.length;e++){const i=t[e],o=w(i);if(o)for(;r<i.index;)r++,n.nextNode();this._parts.push(o?this._partCallback(this,i,n.currentNode):void 0)}}return e}}const I=(e,t,n=null,r=null)=>{let i=t;for(;i!==n;){const t=i.nextSibling;e.insertBefore(i,r),i=t}},T=(e,t,n=null)=>{let r=t;for(;r!==n;){const t=r.nextSibling;e.removeChild(r),r=t}},P=NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT;const R=e=>{let t=1;const n=document.createTreeWalker(e,P,null,!1);for(;n.nextNode();)t++;return t},D=(e,t=-1)=>{for(let n=t+1;n<e.length;n++){const t=e[n];if(w(t))return n}return-1};
/**
 * @license
 * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at
 * http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at
 * http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at
 * http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at
 * http://polymer.github.io/PATENTS.txt
 */
const L=(e,t)=>`${e}--${t}`,B=e=>t=>{const n=L(t.type,e);let r=d.get(n);void 0===r&&(r=new Map,d.set(n,r));let i=r.get(t.strings);if(void 0===i){const n=t.getTemplateElement();"object"==typeof window.ShadyCSS&&window.ShadyCSS.prepareTemplateDom(n,e),i=new x(t,n),r.set(t.strings,i)}return i},j=["html","svg"];function F(e){j.forEach(t=>{const n=d.get(L(t,e));void 0!==n&&n.forEach(e=>{const{element:{content:t}}=e,n=t.querySelectorAll("style");!function(e,t){const{element:{content:n},parts:r}=e,i=document.createTreeWalker(n,P,null,!1);let o=0,a=r[0],s=-1,u=0;const c=[];let l=null;for(;i.nextNode();){s++;const e=i.currentNode;for(e.previousSibling===l&&(l=null),t.has(e)&&(c.push(e),null===l&&(l=e)),null!==l&&u++;void 0!==a&&a.index===s;)a.index=null!==l?-1:a.index-u,a=r[++o]}c.forEach(e=>e.parentNode.removeChild(e))}(e,new Set(Array.from(n)))})})}const z=new Set,V=(e,t,n)=>{if(!z.has(n)){z.add(n);const r=document.createElement("template");if(Array.from(e.querySelectorAll("style")).forEach(e=>{r.content.appendChild(e)}),window.ShadyCSS.prepareTemplateStyles(r,n),F(n),window.ShadyCSS.nativeShadow){const n=r.content.querySelector("style");null!==n&&(e.insertBefore(n,e.firstChild),function(e,t,n=null){const{element:{content:r},parts:i}=e;if(null===n||void 0===n)return void r.appendChild(t);const o=document.createTreeWalker(r,P,null,!1);let a=D(i),s=0,u=-1;for(;o.nextNode();)for(u++,o.currentNode===n&&(n.parentNode.insertBefore(t,n),s=R(t));-1!==a&&i[a].index===u;){if(s>0){for(;-1!==a;)i[a].index+=s,a=D(i,a);return}a=D(i,a)}}(t,n.cloneNode(!0),t.element.content.firstChild))}}};
/**
 * @license
 * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at
 * http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at
 * http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at
 * http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at
 * http://polymer.github.io/PATENTS.txt
 */
const U=(e,...t)=>new f(e,t,"html",$),W=(e,...t)=>new p(e,t,"svg",$),$=(e,t,n)=>{if("attribute"===t.type){if("on-"===t.rawName.substr(0,3)){return new class{constructor(e,t,n){this.instance=e,this.element=t,this.eventName=n}setValue(e){const t=E(this,e);t!==this._listener&&(null==t?this.element.removeEventListener(this.eventName,this):null==this._listener&&this.element.addEventListener(this.eventName,this),this._listener=t)}handleEvent(e){"function"==typeof this._listener?this._listener.call(this.element,e):"function"==typeof this._listener.handleEvent&&this._listener.handleEvent(e)}}(e,n,t.rawName.slice(3))}const r=t.name.substr(t.name.length-1);if("$"===r){const r=t.name.slice(0,-1);return new A(e,n,r,t.strings)}if("?"===r){return new class extends A{setValue(e,t){const n=this.strings;if(2!==n.length||""!==n[0]||""!==n[1])throw new Error("boolean attributes can only contain a single expression");{const n=E(this,e[t]);if(n===C)return;n?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name)}}}(e,n,t.name.slice(0,-1),t.strings)}return new class extends A{setValue(e,t){const n=this.strings;let r;this._equalToPreviousValues(e,t)||((r=2===n.length&&""===n[0]&&""===n[1]?E(this,e[t]):this._interpolate(e,t))!==C&&(this.element[this.name]=r),this._previousValues=e)}}(e,n,t.rawName,t.strings)}return N(e,t,n)};function q(e,t){for(const n in t){const r=!0===t[n]?"":t[n];r||""===r||0===r?e.getAttribute(n)!==r&&e.setAttribute(n,String(r)):e.hasAttribute(n)&&e.removeAttribute(n)}}function H(e){const t=[];for(const n in e){e[n]&&t.push(n)}return t.join(" ")}function G(e){const t=[];for(const n in e){const r=e[n];(r||0===r)&&t.push(`${h(n)}: ${r}`)}return t.join("; ")}n.d(t,"renderAttributes",function(){return q}),n.d(t,"classString",function(){return H}),n.d(t,"styleString",function(){return G}),n.d(t,"LitElement",function(){return K}),n.d(t,"html",function(){return U}),n.d(t,"svg",function(){return W});class K extends(u(HTMLElement)){constructor(){super(...arguments),this.__renderComplete=null,this.__resolveRenderComplete=null,this.__isInvalid=!1,this.__isChanging=!1}ready(){this._root=this._createRoot(),super.ready(),this._firstRendered()}connectedCallback(){window.ShadyCSS&&this._root&&window.ShadyCSS.styleElement(this),super.connectedCallback()}_firstRendered(){}_createRoot(){return this.attachShadow({mode:"open"})}_shouldPropertiesChange(e,t,n){const r=this._shouldRender(e,t,n);return!r&&this.__resolveRenderComplete&&this.__resolveRenderComplete(!1),r}_shouldRender(e,t,n){return!0}_propertiesChanged(e,t,n){super._propertiesChanged(e,t,n);const r=this._render(e);r&&void 0!==this._root&&this._applyRender(r,this._root),this._didRender(e,t,n),this.__resolveRenderComplete&&this.__resolveRenderComplete(!0)}_flushProperties(){this.__isChanging=!0,this.__isInvalid=!1,super._flushProperties(),this.__isChanging=!1}_shouldPropertyChange(e,t,n){const r=super._shouldPropertyChange(e,t,n);return r&&this.__isChanging&&console.trace("Setting properties in response to other properties changing "+`considered harmful. Setting '${e}' from `+`'${this._getProperty(e)}' to '${t}'.`),r}_render(e){throw new Error("_render() not implemented")}_applyRender(e,t){!function(e,t,n){const r=B(n),i=r(e);let o=t.__templateInstance;if(void 0!==o&&o.template===i&&o._partCallback===e.partCallback)return void o.update(e.values);o=new k(i,e.partCallback,r),t.__templateInstance=o;const a=o._clone();o.update(e.values);const s=t instanceof ShadowRoot?t.host:void 0;void 0!==s&&"object"==typeof window.ShadyCSS&&(V(a,i,n),window.ShadyCSS.styleElement(s)),T(t,t.firstChild),t.appendChild(a)}(e,t,this.localName)}_didRender(e,t,n){}requestRender(){this._invalidateProperties()}_invalidateProperties(){this.__isInvalid=!0,super._invalidateProperties()}get renderComplete(){return this.__renderComplete||(this.__renderComplete=new Promise(e=>{this.__resolveRenderComplete=(t=>{this.__resolveRenderComplete=this.__renderComplete=null,e(t)})}),!this.__isInvalid&&this.__resolveRenderComplete&&Promise.resolve().then(()=>this.__resolveRenderComplete(!1))),this.__renderComplete}}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){"use strict";function r(e){return t=>(n,r)=>{Object.defineProperty(n,r,{get(){return e(this.shadowRoot,t)},enumerable:!0,configurable:!0})}}Object.defineProperty(t,"__esModule",{value:!0}),t.customElement=function(e){return t=>{if(e)if(t.hasOwnProperty("is")){if(e!==t.is)throw new Error("custom element tag names do not match: "+`(${e} !== ${t.is})`)}else Object.defineProperty(t,"is",{value:e});window.customElements.define(t.is,t)}},t.property=function(e){return(t,n)=>{!function(e,t,n){e.constructor.hasOwnProperty("properties")||Object.defineProperty(e.constructor,"properties",{value:{}});const r=Object.assign({},e.constructor.properties[t],n);r.type||console.error(`A type could not be found for ${t}. `+"Set a type or configure Metadata Reflection API support."),e.constructor.properties[t]=r}(t,n,e)}},t.query=r((e,t)=>e.querySelector(t)),t.queryAll=r((e,t)=>e.querySelectorAll(t))},function(e,t,n){var r=n(5),i=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=a),o(i,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";(function(e){
/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
 * @license  MIT
 */
var r=n(192),i=n(191),o=n(92);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,n){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return h(this,e)}return c(this,e,t,n)}function c(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=d(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!u.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|p(t,n),i=(e=s(e,r)).write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(u.isBuffer(t)){var n=0|f(t.length);return 0===(e=s(e,n)).length?e:(t.copy(e,0,0,n),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||function(e){return e!=e}(t.length)?s(e,0):d(e,t);if("Buffer"===t.type&&o(t.data))return d(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function h(e,t){if(l(t),e=s(e,t<0?0:0|f(t)),!u.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function d(e,t){var n=t.length<0?0:0|f(t.length);e=s(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function f(e){if(e>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(e).length;default:if(r)return z(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,i){var o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var l=-1;for(o=n;o<s;o++)if(c(e,o)===c(t,-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(n+u>s&&(n=s-u),o=n;o>=0;o--){for(var h=!0,d=0;d<u;d++)if(c(e,o+d)!==c(t,d)){h=!1;break}if(h)return o}return-1}function y(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[n+a]=s}return a}function v(e,t,n,r){return U(z(t,e.length-n),e,n,r)}function _(e,t,n,r){return U(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function w(e,t,n,r){return _(e,t,n,r)}function x(e,t,n,r){return U(V(t),e,n,r)}function E(e,t,n,r){return U(function(e,t){for(var n,r,i,o=[],a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function S(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,a,s,u,c=e[i],l=null,h=c>239?4:c>223?3:c>191?2:1;if(i+h<=n)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=h}return function(e){var t=e.length;if(t<=O)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=O));return n}(r)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=a(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,n){return c(null,e,t,n)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,n){return function(e,t,n,r){return l(t),t<=0?s(e,t):void 0!==n?"string"==typeof r?s(e,t).fill(n,r):s(e,t).fill(n):s(e,t)}(null,e,t,n)},u.allocUnsafe=function(e){return h(null,e)},u.allocUnsafeSlow=function(e){return h(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},u.isEncoding=function(e){switch(String(e).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}},u.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=u.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,i),i+=a.length}return r},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?C(this,0,e):function(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return A(this,t,n);case"latin1":case"binary":return M(this,t,n);case"base64":return S(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,n,r,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var o=i-r,a=n-t,s=Math.min(o,a),c=this.slice(r,i),l=e.slice(t,n),h=0;h<s;++h)if(c[h]!==l[h]){o=c[h],a=l[h];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},u.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},u.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)},u.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return y(this,e,t,n);case"utf8":case"utf-8":return v(this,e,t,n);case"ascii":return _(this,e,t,n);case"latin1":case"binary":return w(this,e,t,n);case"base64":return x(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;function A(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function M(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function N(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=F(e[o]);return i}function k(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function I(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function T(e,t,n,r,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function P(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function R(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function D(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(e,t,n,r,o){return o||D(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,o){return o||D(e,0,n,8),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n,r=this.length;if(e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=u.prototype;else{var i=t-e;n=new u(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},u.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},u.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUInt8=function(e,t){return t||I(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||I(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||I(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||I(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||I(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||I(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||I(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||I(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||I(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||I(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||T(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},u.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||T(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):R(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);T(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<n&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);T(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):R(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||T(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):R(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return L(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return L(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<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),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},u.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var a=u.isBuffer(e)?e:z(new u(e,r).toString()),s=a.length;for(o=0;o<n-t;++o)this[o+t]=a[o%s]}return this};var j=/[^+\/0-9A-Za-z-_]/g;function F(e){return e<16?"0"+e.toString(16):e.toString(16)}function z(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],a=0;a<r;++a){if((n=e.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=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((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function V(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(j,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function U(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(11))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(8),i={labelColor:"black",backgroundColor:"white",buttonBorderColor:"#AEB0B5",buttonBorderWidth:"2px",buttonFontSize:"18px",buttonFontWeight:"normal",buttonJustifyContent:"center",accentColor:"#235BEC",accentOffColor:"#aaaaaa",accentBorderRadius:"0%",bodyFontFamily:"Karla",titleFontFamily:"Poppins",iconSize:"25px",fillColor:"black",outlineBorderColor:"#AEB0B5"},o=e=>`var(--${r.camelCaseToHyphenated(e)}, ${i[e]})`;t.labelColor=o("labelColor"),t.backgroundColor=o("backgroundColor"),t.titleFontFamily=o("titleFontFamily"),t.bodyFontFamily=o("bodyFontFamily"),t.buttonBackgroundColor=`var(--button-background-color, ${t.backgroundColor})`,t.buttonBorderColor=o("buttonBorderColor"),t.buttonBorderWidth=o("buttonBorderWidth"),t.buttonFontSize=o("buttonFontSize"),t.buttonFontWeight=o("buttonFontWeight"),t.buttonJustifyContent=o("buttonJustifyContent"),t.buttonLabelColor=`var(--button-label-color, ${t.labelColor})`,t.accentColor=o("accentColor"),t.accentOffColor=o("accentOffColor"),t.accentBorderRadius=o("accentBorderRadius"),t.iconSize=o("iconSize"),t.fillColor=o("fillColor"),t.outlineBorderColor=o("outlineBorderColor")},function(e,t,n){(function(e){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var a;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{a=n(154).Buffer}catch(e){}function s(e,t,n){for(var r=0,i=Math.min(e.length,n),o=t;o<i;o++){var a=e.charCodeAt(o)-48;r<<=4,r|=a>=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return r}function u(e,t,n,r){for(var i=0,o=Math.min(e.length,n),a=t;a<o;a++){var s=e.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/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=e.length-6,r=0;n>=t;n-=6)i=s(e,n,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,r++);n+6!==t&&(i=s(e,t,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(e,l,l+r,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(e,l,e.length,t),l=0;l<a;l++)h*=t;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","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"],l=[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],h=[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 d(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.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,h=67108863&u,d=Math.min(c,t.length-1),f=Math.max(0,c-e.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(e,t){var n;if(e=e||10,t=0|t||1,16===e||"hex"===e){n="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);n=0!==(o=s>>>24-i&16777215)||a!==this.length-1?c[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var d=l[e],f=h[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(e);n=(p=p.idivn(f)).isZero()?m+n:c[d-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return r(void 0!==a),this.toArrayLike(a,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===t,c=new e(o),l=this.clone();if(u){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>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},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;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()},o.prototype.sub=function(e){return this.clone().isub(e)};var f=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],b=8191&g,y=g>>>13,v=0|a[3],_=8191&v,w=v>>>13,x=0|a[4],E=8191&x,S=x>>>13,C=0|a[5],O=8191&C,A=C>>>13,M=0|a[6],N=8191&M,k=M>>>13,I=0|a[7],T=8191&I,P=I>>>13,R=0|a[8],D=8191&R,L=R>>>13,B=0|a[9],j=8191&B,F=B>>>13,z=0|s[0],V=8191&z,U=z>>>13,W=0|s[1],$=8191&W,q=W>>>13,H=0|s[2],G=8191&H,K=H>>>13,Y=0|s[3],X=8191&Y,Z=Y>>>13,J=0|s[4],Q=8191&J,ee=J>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,le=0|s[8],he=8191&le,de=le>>>13,fe=0|s[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(c+(r=Math.imul(h,V))|0)+((8191&(i=(i=Math.imul(h,U))+Math.imul(d,V)|0))<<13)|0;c=((o=Math.imul(d,U))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,U))+Math.imul(m,V)|0,o=Math.imul(m,U);var be=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(b,V),i=(i=Math.imul(b,U))+Math.imul(y,V)|0,o=Math.imul(y,U),r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,q)|0;var ye=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(_,V),i=(i=Math.imul(_,U))+Math.imul(w,V)|0,o=Math.imul(w,U),r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,q)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,K)|0;var ve=(c+(r=r+Math.imul(h,X)|0)|0)+((8191&(i=(i=i+Math.imul(h,Z)|0)+Math.imul(d,X)|0))<<13)|0;c=((o=o+Math.imul(d,Z)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(E,V),i=(i=Math.imul(E,U))+Math.imul(S,V)|0,o=Math.imul(S,U),r=r+Math.imul(_,$)|0,i=(i=i+Math.imul(_,q)|0)+Math.imul(w,$)|0,o=o+Math.imul(w,q)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,Z)|0;var _e=(c+(r=r+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(O,V),i=(i=Math.imul(O,U))+Math.imul(A,V)|0,o=Math.imul(A,U),r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(_,G)|0,i=(i=i+Math.imul(_,K)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,K)|0,r=r+Math.imul(b,X)|0,i=(i=i+Math.imul(b,Z)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,Z)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var we=(c+(r=r+Math.imul(h,ne)|0)|0)+((8191&(i=(i=i+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;c=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(N,V),i=(i=Math.imul(N,U))+Math.imul(k,V)|0,o=Math.imul(k,U),r=r+Math.imul(O,$)|0,i=(i=i+Math.imul(O,q)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,q)|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(_,X)|0,i=(i=i+Math.imul(_,Z)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,Z)|0,r=r+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var xe=(c+(r=r+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ae)|0)+Math.imul(d,oe)|0))<<13)|0;c=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(T,V),i=(i=Math.imul(T,U))+Math.imul(P,V)|0,o=Math.imul(P,U),r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,q)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(O,G)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,ee)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var Ee=(c+(r=r+Math.imul(h,ue)|0)|0)+((8191&(i=(i=i+Math.imul(h,ce)|0)+Math.imul(d,ue)|0))<<13)|0;c=((o=o+Math.imul(d,ce)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(D,V),i=(i=Math.imul(D,U))+Math.imul(L,V)|0,o=Math.imul(L,U),r=r+Math.imul(T,$)|0,i=(i=i+Math.imul(T,q)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(N,G)|0,i=(i=i+Math.imul(N,K)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,K)|0,r=r+Math.imul(O,X)|0,i=(i=i+Math.imul(O,Z)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,Z)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(_,ne)|0,i=(i=i+Math.imul(_,re)|0)+Math.imul(w,ne)|0,o=o+Math.imul(w,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,r=r+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,ce)|0;var Se=(c+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;c=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(j,V),i=(i=Math.imul(j,U))+Math.imul(F,V)|0,o=Math.imul(F,U),r=r+Math.imul(D,$)|0,i=(i=i+Math.imul(D,q)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,q)|0,r=r+Math.imul(T,G)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,r=r+Math.imul(N,X)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,Z)|0,r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(_,oe)|0,i=(i=i+Math.imul(_,ae)|0)+Math.imul(w,oe)|0,o=o+Math.imul(w,ae)|0,r=r+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0,r=r+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,he)|0,o=o+Math.imul(m,de)|0;var Ce=(c+(r=r+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(d,pe)|0))<<13)|0;c=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(j,$),i=(i=Math.imul(j,q))+Math.imul(F,$)|0,o=Math.imul(F,q),r=r+Math.imul(D,G)|0,i=(i=i+Math.imul(D,K)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(T,X)|0,i=(i=i+Math.imul(T,Z)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,Z)|0,r=r+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,ee)|0,r=r+Math.imul(O,ne)|0,i=(i=i+Math.imul(O,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(_,ue)|0,i=(i=i+Math.imul(_,ce)|0)+Math.imul(w,ue)|0,o=o+Math.imul(w,ce)|0,r=r+Math.imul(b,he)|0,i=(i=i+Math.imul(b,de)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,de)|0;var Oe=(c+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;c=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(j,G),i=(i=Math.imul(j,K))+Math.imul(F,G)|0,o=Math.imul(F,K),r=r+Math.imul(D,X)|0,i=(i=i+Math.imul(D,Z)|0)+Math.imul(L,X)|0,o=o+Math.imul(L,Z)|0,r=r+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,ee)|0,r=r+Math.imul(N,ne)|0,i=(i=i+Math.imul(N,re)|0)+Math.imul(k,ne)|0,o=o+Math.imul(k,re)|0,r=r+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,r=r+Math.imul(_,he)|0,i=(i=i+Math.imul(_,de)|0)+Math.imul(w,he)|0,o=o+Math.imul(w,de)|0;var Ae=(c+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,me)|0)+Math.imul(y,pe)|0))<<13)|0;c=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,Z))+Math.imul(F,X)|0,o=Math.imul(F,Z),r=r+Math.imul(D,Q)|0,i=(i=i+Math.imul(D,ee)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(T,ne)|0,i=(i=i+Math.imul(T,re)|0)+Math.imul(P,ne)|0,o=o+Math.imul(P,re)|0,r=r+Math.imul(N,oe)|0,i=(i=i+Math.imul(N,ae)|0)+Math.imul(k,oe)|0,o=o+Math.imul(k,ae)|0,r=r+Math.imul(O,ue)|0,i=(i=i+Math.imul(O,ce)|0)+Math.imul(A,ue)|0,o=o+Math.imul(A,ce)|0,r=r+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(S,he)|0,o=o+Math.imul(S,de)|0;var Me=(c+(r=r+Math.imul(_,pe)|0)|0)+((8191&(i=(i=i+Math.imul(_,me)|0)+Math.imul(w,pe)|0))<<13)|0;c=((o=o+Math.imul(w,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(j,Q),i=(i=Math.imul(j,ee))+Math.imul(F,Q)|0,o=Math.imul(F,ee),r=r+Math.imul(D,ne)|0,i=(i=i+Math.imul(D,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,ae)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,ae)|0,r=r+Math.imul(N,ue)|0,i=(i=i+Math.imul(N,ce)|0)+Math.imul(k,ue)|0,o=o+Math.imul(k,ce)|0,r=r+Math.imul(O,he)|0,i=(i=i+Math.imul(O,de)|0)+Math.imul(A,he)|0,o=o+Math.imul(A,de)|0;var Ne=(c+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(S,pe)|0))<<13)|0;c=((o=o+Math.imul(S,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,r=Math.imul(j,ne),i=(i=Math.imul(j,re))+Math.imul(F,ne)|0,o=Math.imul(F,re),r=r+Math.imul(D,oe)|0,i=(i=i+Math.imul(D,ae)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,ae)|0,r=r+Math.imul(T,ue)|0,i=(i=i+Math.imul(T,ce)|0)+Math.imul(P,ue)|0,o=o+Math.imul(P,ce)|0,r=r+Math.imul(N,he)|0,i=(i=i+Math.imul(N,de)|0)+Math.imul(k,he)|0,o=o+Math.imul(k,de)|0;var ke=(c+(r=r+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,me)|0)+Math.imul(A,pe)|0))<<13)|0;c=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(j,oe),i=(i=Math.imul(j,ae))+Math.imul(F,oe)|0,o=Math.imul(F,ae),r=r+Math.imul(D,ue)|0,i=(i=i+Math.imul(D,ce)|0)+Math.imul(L,ue)|0,o=o+Math.imul(L,ce)|0,r=r+Math.imul(T,he)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(P,he)|0,o=o+Math.imul(P,de)|0;var Ie=(c+(r=r+Math.imul(N,pe)|0)|0)+((8191&(i=(i=i+Math.imul(N,me)|0)+Math.imul(k,pe)|0))<<13)|0;c=((o=o+Math.imul(k,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(j,ue),i=(i=Math.imul(j,ce))+Math.imul(F,ue)|0,o=Math.imul(F,ce),r=r+Math.imul(D,he)|0,i=(i=i+Math.imul(D,de)|0)+Math.imul(L,he)|0,o=o+Math.imul(L,de)|0;var Te=(c+(r=r+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(P,pe)|0))<<13)|0;c=((o=o+Math.imul(P,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(j,he),i=(i=Math.imul(j,de))+Math.imul(F,he)|0,o=Math.imul(F,de);var Pe=(c+(r=r+Math.imul(D,pe)|0)|0)+((8191&(i=(i=i+Math.imul(D,me)|0)+Math.imul(L,pe)|0))<<13)|0;c=((o=o+Math.imul(L,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Re=(c+(r=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(F,pe)|0))<<13)|0;return c=((o=Math.imul(F,me))+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,u[0]=ge,u[1]=be,u[2]=ye,u[3]=ve,u[4]=_e,u[5]=we,u[6]=xe,u[7]=Ee,u[8]=Se,u[9]=Ce,u[10]=Oe,u[11]=Ae,u[12]=Me,u[13]=Ne,u[14]=ke,u[15]=Ie,u[16]=Te,u[17]=Pe,u[18]=Re,0!==c&&(u[19]=c,n.length++),n};function p(e,t,n){return(new m).mulp(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(f=d),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?f(this,e,t):n<63?d(this,e,t):n<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.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,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var l=o-c,h=(0|e.words[l])*(0|t.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>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,e,t):p(this,e,t)},m.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},m.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(1&e)<<t-i-1,e>>=1;return r},m.prototype.permute=function(e,t,n,r,i,o){for(var a=0;a<o;a++)r[a]=t[e[a]],i[a]=n[e[a]]},m.prototype.transform=function(e,t,n,r,i,o){this.permute(o,e,t,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 h=u,d=c,f=0;f<a;f++){var p=n[l+f],m=r[l+f],g=n[l+f+a],b=r[l+f+a],y=h*g-d*b;b=h*b+d*g,g=y,n[l+f]=p+g,r[l+f]=m+b,n[l+f+a]=p-g,r[l+f+a]=m-b,f!==s&&(y=u*h-c*d,d=u*d+c*h,h=y)}},m.prototype.guessLen13b=function(e,t){var n=1|Math.max(t,e),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},m.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=e[r];e[r]=e[n-r-1],e[n-r-1]=i,i=t[r],t[r]=-t[n-r-1],t[n-r-1]=-i}},m.prototype.normalize13b=function(e,t){for(var n=0,r=0;r<t/2;r++){var i=8192*Math.round(e[2*r+1]/t)+Math.round(e[2*r]/t)+n;e[r]=67108863&i,n=i<67108864?0:i/67108864|0}return e},m.prototype.convert13b=function(e,t,n,i){for(var o=0,a=0;a<t;a++)o+=0|e[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*t;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},m.prototype.stub=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=0;return t},m.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.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),h=new Array(r),d=n.words;d.length=r,this.convert13b(e.words,e.length,a,r),this.convert13b(t.words,t.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,l,h,r,i);for(var f=0;f<r;f++){var p=s[f]*l[f]-u[f]*h[f];u[f]=s[f]*h[f]+u[f]*l[f],s[f]=p}return this.conjugate(s,u,r),this.transform(s,u,d,o,r,i),this.conjugate(d,o,r),this.normalize13b(d,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),p(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,o=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var i=n.sqr();r<t.length;r++,i=i.sqr())0!==t[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<n;this.words[t]=u|a,a=s>>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=n;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n)&&!!(this.words[n]&i)},o.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,n){var i,o,a=e.length+n;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,a=0|i.words[i.length-1];0!==(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==t){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(i,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(t*n+(0|this.words[i]))%e;return n},o.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*t;this.words[n]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++c;for(var l=n.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;0==(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(s),a.isub(u)):(n.isub(t),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new o(1),s=new o(0),u=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,l=1;0==(t.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(n.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(n.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new x(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){x.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}b.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):n.strip(),n},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},i(y,b),y.prototype.split=function(e,t){for(var n=Math.min(e.length,9),r=0;r<n;r++)t.words[r]=e.words[r];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=4194303&i,r=10;r<e.length;r++){var o=0|e.words[r];e.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,e.words[r-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(v,b),i(_,b),i(w,b),w.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new v;else if("p192"===e)t=new _;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new w}return g[e]=t,t},x.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},x.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},x.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},x.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},x.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},x.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},x.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},x.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},x.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},x.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},x.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},x.prototype.isqr=function(e){return this.imul(e,e.clone())},x.prototype.sqr=function(e){return this.mul(e,e)},x.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,i),d=this.pow(e,i.addn(1).iushrn(1)),f=this.pow(e,i),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();r(g<p);var b=this.pow(h,new o(1).iushln(p-g-1));d=d.redMul(b),h=b.redSqr(),f=f.redMul(h),p=g}return d},x.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},x.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var i=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var c=t.words[r],l=u-1;l>=0;l--){var h=c>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===r&&0===l)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}u=26}return i},x.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},x.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new E(e)},i(E,x),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)}).call(this,n(155)(e))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isElement=(e=>e.nodeType===Node.ELEMENT_NODE),t.fastMap=((e,t,n)=>{n=n||[];for(let r=0;r<e.length;r++)n[r]=t(e[r],r,e);return n}),t.empty=(e=>{for(;e.length;)e.pop();return e}),t.supportsWASM=(()=>{const e="object"==typeof WebAssembly&&function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,3,2,1,0,5,3,1,0,1,7,8,1,4,116,101,115,116,0,0,10,16,1,14,0,32,0,65,1,54,2,0,32,0,40,2,0,11]),t=new WebAssembly.Module(e);return 0!==new WebAssembly.Instance(t,{}).exports.test(4)}();return()=>e})();const r=navigator.userAgent;t.isIOS11=(()=>(r.indexOf("iPad")>0||r.indexOf("iPhone")>0)&&r.indexOf("OS 11_")>0),t.bind=((e,t)=>e[t]=e[t].bind(e)),t.bindAll=((e,n)=>n.forEach(n=>t.bind(e,n))),t.clamp=((e,t=0,n=1)=>Math.min(n,Math.max(t,e))),t.scalemap=((e,t,n,r,i)=>r+(e-t)/(n-t)*(i-r)),t.scaleToFill=((e,t,n,r,i=0,o={})=>{const a=e-2*i;let s=r/(t-2*i);a*s<n&&(s=n/a);const u=.5*(n-e*s),c=.5*(r-t*s);return o.left=u,o.top=c,o.width=e*s,o.height=t*s,o.scale=s,o}),t.distance=((e,t)=>{const n=e.map((e,n)=>t[n]-e);return Math.sqrt(n[0]*n[0]+n[1]*n[1])}),t.setBooleanAttribute=((e,t,n)=>n?e.setAttribute(t,"true"):e.removeAttribute(t)),t.camelCaseToHyphenated=(e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()),t.computeStyleResult=((e,t,n)=>{const r=document.createElement("div");r.style.display="none",r.style[t]=n,e.appendChild(r);const i=window.getComputedStyle(r)[t];return r.parentElement&&r.parentElement.removeChild(r),i}),t.cssColorToArray=(e=>{return function(e){let t=0,n=e.length;const r=[];for(t=0;t<n;t++)r[t]=parseFloat(e[t]);return r}(function(){var t=e.substr(0,e.length-1);const n=t.indexOf("(");return t.substr(n+1,t.length).split(",")}())})},function(e,t,n){"use strict";var r=t;r.version=n(148).version,r.utils=n(147),r.rand=n(70),r.curve=n(29),r.curves=n(142),r.ec=n(134),r.eddsa=n(130)},function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=n,n.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)}},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){var n,r,i=e.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(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var u,c=[],l=!1,h=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&f())}function f(){if(!l){var e=s(d);l=!0;for(var t=c.length;t;){for(u=c,c=[];++h<t;)u&&u[h].run();h=-1,t=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)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new p(e,t)),1!==c.length||l||s(f)},p.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(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){"use strict";var r=n(10),i=n(2);function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function s(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}else for(var r=0;r<e.length;r++){var i=e.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}else for(r=0;r<e.length;r++)n[r]=0|e[r];return n},t.toHex=function(e){for(var t="",n=0;n<e.length;n++)t+=a(e[n].toString(16));return t},t.htonl=o,t.toHex32=function(e,t){for(var n="",r=0;r<e.length;r++){var i=e[r];"little"===t&&(i=o(i)),n+=s(i.toString(16))}return n},t.zero2=a,t.zero8=s,t.join32=function(e,t,n,i){var o=n-t;r(o%4==0);for(var a=new Array(o/4),s=0,u=t;s<a.length;s++,u+=4){var c;c="big"===i?e[u]<<24|e[u+1]<<16|e[u+2]<<8|e[u+3]:e[u+3]<<24|e[u+2]<<16|e[u+1]<<8|e[u],a[s]=c>>>0}return a},t.split32=function(e,t){for(var n=new Array(4*e.length),r=0,i=0;r<e.length;r++,i+=4){var o=e[r];"big"===t?(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},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,n){return e+t+n>>>0},t.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},t.sum32_5=function(e,t,n,r,i){return e+t+n+r+i>>>0},t.sum64=function(e,t,n,r){var i=e[t],o=r+e[t+1]>>>0,a=(o<r?1:0)+n+i;e[t]=a>>>0,e[t+1]=o},t.sum64_hi=function(e,t,n,r){return(t+r>>>0<t?1:0)+e+n>>>0},t.sum64_lo=function(e,t,n,r){return t+r>>>0},t.sum64_4_hi=function(e,t,n,r,i,o,a,s){var u=0,c=t;return u+=(c=c+r>>>0)<t?1:0,u+=(c=c+o>>>0)<o?1:0,e+n+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},t.sum64_4_lo=function(e,t,n,r,i,o,a,s){return t+r+o+s>>>0},t.sum64_5_hi=function(e,t,n,r,i,o,a,s,u,c){var l=0,h=t;return l+=(h=h+r>>>0)<t?1:0,l+=(h=h+o>>>0)<o?1:0,l+=(h=h+s>>>0)<s?1:0,e+n+i+a+u+(l+=(h=h+c>>>0)<c?1:0)>>>0},t.sum64_5_lo=function(e,t,n,r,i,o,a,s,u,c){return t+r+o+s+c>>>0},t.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},t.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},t.shr64_hi=function(e,t,n){return e>>>n},t.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0}},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(6),o=n(1),a=n(3),s=n(98),u=n(8),c=(e,t=[])=>{if(e.parentNode){const n=e.parentNode.host,r=n||e.parentNode;t.push(r),c(r,t)}return t},l=(e,t,n=[])=>Array.from(e.children).reduce((e,n)=>(t.indexOf(n)>-1?l(n,t,e):u.isElement(n)&&e.push(n),e),n);class h extends o.LitElement{constructor(){super(...arguments),this.open=!1,this.closable=!1,this.exclusive=!1,this.priority=0}static _showOnTop(){h._openModals.sort((e,t)=>t.priority-e.priority),h._openModals.forEach((e,t)=>{0===t?(e.setAttribute("aria-hidden","false"),e.style.display="inherit",e.style.zIndex="100000",e.focus()):(e.setAttribute("aria-hidden","true"),e.style.display="none",e.style.zIndex=null)})}static _findHideableElements(e){const t=c(e);return l(document.body,t).filter(u.isElement).filter(e=>!(e instanceof h)).filter(e=>!(e instanceof s.SnackBarElement))}_open(){const e=h._openModals.length,t=document.activeElement;t===this||t===document.body||!t||t instanceof h||(this._returnFocusTo=t),-1===h._openModals.indexOf(this)&&(this.dispatchEvent(new CustomEvent("open")),h._openModals.push(this)),h._findHideableElements(this).forEach(e=>{h._hiddenElements.has(e)||h._hiddenElements.set(e,{tabIndex:e.getAttribute("tabindex"),ariaHidden:e.getAttribute("aria-hidden"),display:e.style.display}),e.setAttribute("tabindex","-1"),e.setAttribute("aria-hidden","true"),this.exclusive&&(e.style.display="none")}),h._openModals.length&&!e&&this.dispatchEvent(new CustomEvent("modal-open",{bubbles:!0}))}_close(){const e=h._openModals.length,t=h._openModals.indexOf(this);if(-1!==t&&(this.dispatchEvent(new CustomEvent("close")),h._openModals.splice(t,1)),this.setAttribute("aria-hidden","true"),this.style.display="none",0===h._openModals.length)if(h._hiddenElements.forEach(({tabIndex:e,ariaHidden:t,display:n},r)=>{null!==e?r.setAttribute("tabindex",e):r.removeAttribute("tabindex"),null!==t?r.setAttribute("aria-hidden",t):r.removeAttribute("aria-hidden"),r.style.display=null!==n?n:null}),h._hiddenElements.clear(),this.dispatchEvent(new CustomEvent("resize",{bubbles:!0})),this._returnFocusTo)this._returnFocusTo.focus(),this._returnFocusTo=null;else{const e=document.querySelector("acc-side-panel");e&&e.focus()}e&&!h._openModals.length&&this.dispatchEvent(new CustomEvent("modal-close",{bubbles:!0}))}focus(){super.focus();const e=this.shadowRoot.querySelector(".container");e&&e.focus()}_propertiesChanged(e,t,n){(t&&t.hasOwnProperty("open")||t&&t.hasOwnProperty("exclusive"))&&(e.open?this._open():this._close()),h._showOnTop(),super._propertiesChanged(e,t,n)}_didRender(e,t,n){h._showOnTop()}_render(e){return o.html`<style>

            :host {
                position: absolute;
            }

            :host .container {
                position: fixed;
                color: ${i.labelColor};
                width: 100%;
                height: 100%;
                top: 0px;
                left: 0px;
                overflow: hidden;
            }
            </style>
            ${this.open?o.html`
                <div tabindex="0" class="container" style="display: ${e.open?"block":"none"}; : ''}">
                    ${this._renderModalBody(e)}
                </div>
            `:o.html``}
        `}_handleCloseClick(){this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close"))}}h._openModals=[],h._hiddenElements=new Map,r([a.property({type:Boolean})],h.prototype,"open",void 0),r([a.property({type:Boolean})],h.prototype,"closable",void 0),r([a.property({type:Boolean})],h.prototype,"exclusive",void 0),r([a.property({type:Number})],h.prototype,"priority",void 0),t.AbstractModalElement=h},function(e,t,n){var r=n(4).Buffer,i=n(48).Transform,o=n(45).StringDecoder;function a(e){i.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}n(2)(a,i),a.prototype.update=function(e,t,n){"string"==typeof e&&(e=r.from(e,t));var i=this._update(e);return this.hashMode?this:(n&&(i=this._toString(i,n)),i)},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(e,t,n){var r;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){r=e}finally{n(r)}},a.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},a.prototype._finalOrDigest=function(e){var t=this.__final()||r.alloc(0);return e&&(t=this._toString(t,e,!0)),t},a.prototype._toString=function(e,t,n){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var r=this._decoder.write(e);return n&&(r+=this._decoder.end()),r},e.exports=a},function(e,t,n){"use strict";var r=n(32),i=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=h;var o=n(25);o.inherits=n(2);var a=n(90),s=n(46);o.inherits(h,a);for(var u=i(s.prototype),c=0;c<u.length;c++){var l=u[c];h.prototype[l]||(h.prototype[l]=s.prototype[l])}function h(e){if(!(this instanceof h))return new h(e);a.call(this,e),s.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",d)}function d(){this.allowHalfOpen||this._writableState.ended||r.nextTick(f,this)}function f(e){e.end()}Object.defineProperty(h.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(h.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),h.prototype._destroy=function(e,t){this.push(null),this.end(),r.nextTick(t,e)}},function(e,t){
/**
@license
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
window.JSCompiler_renameProperty=function(e){return e}},function(e,t,n){var r=n(4).Buffer;function i(e,t){this._block=r.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}i.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=r.from(e,t));for(var n=this._block,i=this._blockSize,o=e.length,a=this._len,s=0;s<o;){for(var u=a%i,c=Math.min(o-s,i-u),l=0;l<c;l++)n[u+l]=e[s+l];s+=c,(a+=c)%i==0&&this._update(n)}return this._len+=o,this},i.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=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 e?o.toString(e):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},function(e,t,n){"use strict";(function(t,r){var i=n(4).Buffer,o=t.crypto||t.msCrypto;o&&o.getRandomValues?e.exports=function(e,n){if(e>65536)throw new Error("requested too many random bytes");var a=new t.Uint8Array(e);e>0&&o.getRandomValues(a);var s=i.from(a.buffer);if("function"==typeof n)return r.nextTick(function(){n(null,s)});return s}: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(11),n(12))},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(27);class o{constructor(e,t,n="unnamed"){this.__onTriggerHandler=t,this.name=n,this.allowPropagation=!1,this.__keysDown=[],this.pattern=e,this.connect()}set pattern(e){if(this.__directShortcut=e,"string"==typeof e){let t=e.replace(".","\\.").replace("(","\\(").replace(")","\\)").replace("[","\\[").replace("]","\\]").replace(/(Space|Spacebar)/i," ").replace(/(Ctr|Ctrl)/i,"Control");this.__shortcutRegExp=new RegExp(t,"gi")}else this.__shortcutRegExp=e}get pattern(){return this.__directShortcut}connect(){this.__isConnected||(document.addEventListener("keydown",this.__onKeyDown,!0),document.addEventListener("keyup",this.__onKeyUp,!0),this.__isConnected=!0)}disconnect(){this.__isConnected&&(document.removeEventListener("keydown",this.__onKeyDown,!0),document.removeEventListener("keyup",this.__onKeyUp,!0),this.__isConnected=!1)}isConnected(){return this.__isConnected}matches(){const e=this.__keysDown.join(" ");return!!this.__shortcutRegExp.test(e)}__onKeyDown(e){this.pattern&&this.__keysDown.push(e.key)}__onKeyUp(e){this.pattern&&(this.matches()&&(this.__onTriggerHandler(this),this.allowPropagation&&e.stopPropagation()),this.__keysDown=[])}}r([i.default],o.prototype,"__onKeyDown",null),r([i.default],o.prototype,"__onKeyUp",null),t.KeyboardShortcutObserver=o},function(e,t,n){var r=t;r.Reporter=n(123).Reporter,r.DecoderBuffer=n(65).DecoderBuffer,r.EncoderBuffer=n(65).EncoderBuffer,r.Node=n(122)},function(e,t,n){var r=t;r.bignum=n(7),r.define=n(126).define,r.base=n(21),r.constants=n(64),r.decoders=n(120),r.encoders=n(118)},function(e,t,n){"use strict";var r=n(13),i=n(10);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}t.BlockHash=o,o.prototype.update=function(e,t){if(e=r.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=r.join32(e,0,e.length-n,this.endian);for(var i=0;i<e.length;i+=this._delta32)this._update(e,i,i+this._delta32)}return this},o.prototype.digest=function(e){return this.update(this._pad()),i(null===this.pending),this._digest(e)},o.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(e<<=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++]=e>>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>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(e,t,n){(function(t){e.exports=function(e,n){for(var r=Math.min(e.length,n.length),i=new t(r),o=0;o<r;++o)i[o]=e[o]^n[o];return i}}).call(this,n(5).Buffer)},function(e,t,n){(function(e){function n(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===n(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===n(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===n(e)},t.isError=function(e){return"[object Error]"===n(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,n(5).Buffer)},function(e,t,n){"use strict";var r=n(2),i=n(49),o=n(44),a=n(43),s=n(15);function u(e){s.call(this,"digest"),this._hash=e}r(u,s),u.prototype._update=function(e){this._hash.update(e)},u.prototype._final=function(){return this._hash.digest()},e.exports=function(e){return"md5"===(e=e.toLowerCase())?new i:"rmd160"===e||"ripemd160"===e?new o:new u(a(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e,t,n){var i=n.value;if("function"!=typeof i)throw new Error("@autobind decorator can only be applied to methods not: "+(void 0===i?"undefined":r(i)));var o=!1;return{configurable:!0,get:function(){if(o||this===e.prototype||this.hasOwnProperty(t)||"function"!=typeof i)return i;var n=i.bind(this);return o=!0,Object.defineProperty(this,t,{configurable:!0,get:function(){return n},set:function(e){i=e,delete this[t]}}),o=!1,n},set:function(e){i=e}}}t.default=function(){return 1===arguments.length?function(e){var t=void 0;"undefined"!=typeof Reflect&&"function"==typeof Reflect.ownKeys?t=Reflect.ownKeys(e.prototype):(t=Object.getOwnPropertyNames(e.prototype),"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(e.prototype))));return t.forEach(function(t){if("constructor"!==t){var n=Object.getOwnPropertyDescriptor(e.prototype,t);"function"==typeof n.value&&Object.defineProperty(e.prototype,t,i(e,t,n))}}),e}.apply(void 0,arguments):i.apply(void 0,arguments)}},function(e,t,n){(function(t){var r=n(127),i=n(115),o=n(114),a=n(41),s=n(81);function u(e){var n;"object"!=typeof e||t.isBuffer(e)||(n=e.passphrase,e=e.key),"string"==typeof e&&(e=new t(e));var u,c,l=o(e,n),h=l.tag,d=l.data;switch(h){case"CERTIFICATE":c=r.certificate.decode(d,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(c||(c=r.PublicKey.decode(d,"der")),u=c.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.RSAPublicKey.decode(c.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return c.subjectPrivateKey=c.subjectPublicKey,{type:"ec",data:c};case"1.2.840.10040.4.1":return c.algorithm.params.pub_key=r.DSAparam.decode(c.subjectPublicKey.data,"der"),{type:"dsa",data:c.algorithm.params};default:throw new Error("unknown key id "+u)}throw new Error("unknown key type "+h);case"ENCRYPTED PRIVATE KEY":d=function(e,n){var r=e.algorithm.decrypt.kde.kdeparams.salt,o=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),u=i[e.algorithm.decrypt.cipher.algo.join(".")],c=e.algorithm.decrypt.cipher.iv,l=e.subjectPrivateKey,h=parseInt(u.split("-")[1],10)/8,d=s.pbkdf2Sync(n,r,o,h),f=a.createDecipheriv(u,d,c),p=[];return p.push(f.update(l)),p.push(f.final()),t.concat(p)}(d=r.EncryptedPrivateKey.decode(d,"der"),n);case"PRIVATE KEY":switch(u=(c=r.PrivateKey.decode(d,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.RSAPrivateKey.decode(c.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:c.algorithm.curve,privateKey:r.ECPrivateKey.decode(c.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return c.algorithm.params.priv_key=r.DSAparam.decode(c.subjectPrivateKey,"der"),{type:"dsa",params:c.algorithm.params};default:throw new Error("unknown key id "+u)}throw new Error("unknown key type "+h);case"RSA PUBLIC KEY":return r.RSAPublicKey.decode(d,"der");case"RSA PRIVATE KEY":return r.RSAPrivateKey.decode(d,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:r.DSAPrivateKey.decode(d,"der")};case"EC PRIVATE KEY":return{curve:(d=r.ECPrivateKey.decode(d,"der")).parameters.value,privateKey:d.privateKey};default:throw new Error("unknown key type "+h)}}e.exports=u,u.signature=r.signature}).call(this,n(5).Buffer)},function(e,t,n){"use strict";var r=t;r.base=n(146),r.short=n(145),r.mont=n(144),r.edwards=n(143)},function(e,t,n){var r=n(4).Buffer,i=n(49);e.exports=function(e,t,n,o){if(r.isBuffer(e)||(e=r.from(e,"binary")),t&&(r.isBuffer(t)||(t=r.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var a=n/8,s=r.alloc(a),u=r.alloc(o||0),c=r.alloc(0);a>0||o>0;){var l=new i;l.update(c),l.update(e),t&&l.update(t),c=l.digest();var h=0;if(a>0){var d=s.length-a;h=Math.min(a,c.length),c.copy(s,d,0,h),a-=h}if(h<c.length&&o>0){var f=u.length-o,p=Math.min(o,c.length-h);c.copy(u,f,h,h+p),o-=p}}return c.fill(0),{key:s,iv:u}}},function(e,t,n){var r=n(4).Buffer;function i(e){r.isBuffer(e)||(e=r.from(e));for(var t=e.length/4|0,n=new Array(t),i=0;i<t;i++)n[i]=e.readUInt32BE(4*i);return n}function o(e){for(;0<e.length;e++)e[0]=0}function a(e,t,n,r,i){for(var o,a,s,u,c=n[0],l=n[1],h=n[2],d=n[3],f=e[0]^t[0],p=e[1]^t[1],m=e[2]^t[2],g=e[3]^t[3],b=4,y=1;y<i;y++)o=c[f>>>24]^l[p>>>16&255]^h[m>>>8&255]^d[255&g]^t[b++],a=c[p>>>24]^l[m>>>16&255]^h[g>>>8&255]^d[255&f]^t[b++],s=c[m>>>24]^l[g>>>16&255]^h[f>>>8&255]^d[255&p]^t[b++],u=c[g>>>24]^l[f>>>16&255]^h[p>>>8&255]^d[255&m]^t[b++],f=o,p=a,m=s,g=u;return o=(r[f>>>24]<<24|r[p>>>16&255]<<16|r[m>>>8&255]<<8|r[255&g])^t[b++],a=(r[p>>>24]<<24|r[m>>>16&255]<<16|r[g>>>8&255]<<8|r[255&f])^t[b++],s=(r[m>>>24]<<24|r[g>>>16&255]<<16|r[f>>>8&255]<<8|r[255&p])^t[b++],u=(r[g>>>24]<<24|r[f>>>16&255]<<16|r[p>>>8&255]<<8|r[255&m])^t[b++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<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,n[a]=c,r[c]=a;var l=e[a],h=e[l],d=e[h],f=257*e[c]^16843008*c;i[0][a]=f<<24|f>>>8,i[1][a]=f<<16|f>>>16,i[2][a]=f<<8|f>>>24,i[3][a]=f,f=16843009*d^65537*h^257*l^16843008*a,o[0][c]=f<<24|f>>>8,o[1][c]=f<<16|f>>>16,o[2][c]=f<<8|f>>>24,o[3][c]=f,0===a?a=s=1:(a=l^e[e[e[d^l]]],s^=e[e[s]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function c(e){this._key=i(e),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=4*(n+1),i=[],o=0;o<t;o++)i[o]=e[o];for(o=t;o<r;o++){var a=i[o-1];o%t==0?(a=a<<8|a>>>24,a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a],a^=s[o/t|0]<<24):t>6&&o%t==4&&(a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a]),i[o]=i[o-t]^a}for(var c=[],l=0;l<r;l++){var h=r-l,d=i[h-(l%4?0:4)];c[l]=l<4||h<=4?d:u.INV_SUB_MIX[0][u.SBOX[d>>>24]]^u.INV_SUB_MIX[1][u.SBOX[d>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[d>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&d]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=c},c.prototype.encryptBlockRaw=function(e){return a(e=i(e),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},c.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),n=r.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n},c.prototype.decryptBlock=function(e){var t=(e=i(e))[1];e[1]=e[3],e[3]=t;var n=a(e,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=r.allocUnsafe(16);return o.writeUInt32BE(n[0],0),o.writeUInt32BE(n[3],4),o.writeUInt32BE(n[2],8),o.writeUInt32BE(n[1],12),o},c.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},e.exports.AES=c},function(e,t,n){"use strict";(function(t){!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,n,r,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,a,s=arguments.length;switch(s){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,n)});case 3:return t.nextTick(function(){e.call(null,n,r)});case 4:return t.nextTick(function(){e.call(null,n,r,i)});default:for(o=new Array(s-1),a=0;a<o.length;)o[a++]=arguments[a];return t.nextTick(function(){e.apply(null,o)})}}}:e.exports=t}).call(this,n(12))},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!function(e){return"number"==typeof e}(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,a,s,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}if(o(n=this._events[e]))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(i(n))for(s=Array.prototype.slice.call(arguments,1),a=(c=n.slice()).length,u=0;u<a;u++)c[u].apply(this,s);return!0},n.prototype.addListener=function(e,t){var a;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?i(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,i(this._events[e])&&!this._events[e].warned&&(a=o(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&a>0&&this._events[e].length>a&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},n.prototype.removeListener=function(e,t){var n,o,a,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(a=(n=this._events[e]).length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(s=a;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){o=s;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global){__webpack_require__.d(__webpack_exports__,"a",function(){return FrozenModel}),__webpack_require__.d(__webpack_exports__,"b",function(){return loadFrozenModel}),__webpack_require__.d(__webpack_exports__,"c",function(){return version});var _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e};
/**
 * @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.
 * =============================================================================
 */function __awaiter(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})}function __generator(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var commonjsGlobal="undefined"!=typeof window?window:void 0!==global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var aspromise=asPromise;function asPromise(e,t){for(var n=new Array(arguments.length-1),r=0,i=2,o=!0;i<arguments.length;)n[r++]=arguments[i++];return new Promise(function(i,a){n[r]=function(e){if(o)if(o=!1,e)a(e);else{for(var t=new Array(arguments.length-1),n=0;n<t.length;)t[n++]=arguments[n];i.apply(null,t)}};try{e.apply(t||null,n)}catch(e){o&&(o=!1,a(e))}})}var base64_1=createCommonjsModule(function(e,t){var n=t;n.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&"="===e.charAt(t);)++n;return Math.ceil(3*e.length)/4-n};for(var r=new Array(64),i=new Array(123),o=0;o<64;)i[r[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;n.encode=function(e,t,n){for(var i,o=null,a=[],s=0,u=0;t<n;){var c=e[t++];switch(u){case 0:a[s++]=r[c>>2],i=(3&c)<<4,u=1;break;case 1:a[s++]=r[i|c>>4],i=(15&c)<<2,u=2;break;case 2:a[s++]=r[i|c>>6],a[s++]=r[63&c],u=0}s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,a)),s=0)}return u&&(a[s++]=r[i],a[s++]=61,1===u&&(a[s++]=61)),o?(s&&o.push(String.fromCharCode.apply(String,a.slice(0,s))),o.join("")):String.fromCharCode.apply(String,a.slice(0,s))},n.decode=function(e,t,n){for(var r,o=n,a=0,s=0;s<e.length;){var u=e.charCodeAt(s++);if(61===u&&a>1)break;if(void 0===(u=i[u]))throw Error("invalid encoding");switch(a){case 0:r=u,a=1;break;case 1:t[n++]=r<<2|(48&u)>>4,r=u,a=2;break;case 2:t[n++]=(15&r)<<4|(60&u)>>2,r=u,a=3;break;case 3:t[n++]=(3&r)<<6|u,a=0}}if(1===a)throw Error("invalid encoding");return n-o},n.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}}),eventemitter=EventEmitter;function EventEmitter(){this._listeners={}}EventEmitter.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this},EventEmitter.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var n=this._listeners[e],r=0;r<n.length;)n[r].fn===t?n.splice(r,1):++r;return this},EventEmitter.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],r=1;r<arguments.length;)n.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,n)}return this};var float_1=factory(factory);function factory(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),r=128===n[3];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3]}function o(e,r,i){t[0]=e,r[i]=n[3],r[i+1]=n[2],r[i+2]=n[1],r[i+3]=n[0]}function a(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],t[0]}function s(e,r){return n[3]=e[r],n[2]=e[r+1],n[1]=e[r+2],n[0]=e[r+3],t[0]}e.writeFloatLE=r?i:o,e.writeFloatBE=r?o:i,e.readFloatLE=r?a:s,e.readFloatBE=r?s:a}():function(){function t(e,t,n,r){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,n,r);else if(isNaN(t))e(2143289344,n,r);else if(t>3.4028234663852886e38)e((i<<31|2139095040)>>>0,n,r);else if(t<1.1754943508222875e-38)e((i<<31|Math.round(t/1.401298464324817e-45))>>>0,n,r);else{var o=Math.floor(Math.log(t)/Math.LN2);e((i<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,n,r)}}function n(e,t,n){var r=e(t,n),i=2*(r>>31)+1,o=r>>>23&255,a=8388607&r;return 255===o?a?NaN:i*(1/0):0===o?1.401298464324817e-45*i*a:i*Math.pow(2,o-150)*(a+8388608)}e.writeFloatLE=t.bind(null,writeUintLE),e.writeFloatBE=t.bind(null,writeUintBE),e.readFloatLE=n.bind(null,readUintLE),e.readFloatBE=n.bind(null,readUintBE)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),r=128===n[7];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3],r[i+4]=n[4],r[i+5]=n[5],r[i+6]=n[6],r[i+7]=n[7]}function o(e,r,i){t[0]=e,r[i]=n[7],r[i+1]=n[6],r[i+2]=n[5],r[i+3]=n[4],r[i+4]=n[3],r[i+5]=n[2],r[i+6]=n[1],r[i+7]=n[0]}function a(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],n[4]=e[r+4],n[5]=e[r+5],n[6]=e[r+6],n[7]=e[r+7],t[0]}function s(e,r){return n[7]=e[r],n[6]=e[r+1],n[5]=e[r+2],n[4]=e[r+3],n[3]=e[r+4],n[2]=e[r+5],n[1]=e[r+6],n[0]=e[r+7],t[0]}e.writeDoubleLE=r?i:o,e.writeDoubleBE=r?o:i,e.readDoubleLE=r?a:s,e.readDoubleBE=r?s:a}():function(){function t(e,t,n,r,i,o){var a=r<0?1:0;if(a&&(r=-r),0===r)e(0,i,o+t),e(1/r>0?0:2147483648,i,o+n);else if(isNaN(r))e(0,i,o+t),e(2146959360,i,o+n);else if(r>1.7976931348623157e308)e(0,i,o+t),e((a<<31|2146435072)>>>0,i,o+n);else{var s;if(r<2.2250738585072014e-308)e((s=r/5e-324)>>>0,i,o+t),e((a<<31|s/4294967296)>>>0,i,o+n);else{var u=Math.floor(Math.log(r)/Math.LN2);1024===u&&(u=1023),e(4503599627370496*(s=r*Math.pow(2,-u))>>>0,i,o+t),e((a<<31|u+1023<<20|1048576*s&1048575)>>>0,i,o+n)}}}function n(e,t,n,r,i){var o=e(r,i+t),a=e(r,i+n),s=2*(a>>31)+1,u=a>>>20&2047,c=4294967296*(1048575&a)+o;return 2047===u?c?NaN:s*(1/0):0===u?5e-324*s*c:s*Math.pow(2,u-1075)*(c+4503599627370496)}e.writeDoubleLE=t.bind(null,writeUintLE,0,4),e.writeDoubleBE=t.bind(null,writeUintBE,4,0),e.readDoubleLE=n.bind(null,readUintLE,0,4),e.readDoubleBE=n.bind(null,readUintBE,4,0)}(),e}function writeUintLE(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function writeUintBE(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=255&e}function readUintLE(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function readUintBE(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+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(e){}return null}var utf8_1=createCommonjsModule(function(e,t){var n=t;n.length=function(e){for(var t=0,n=0,r=0;r<e.length;++r)(n=e.charCodeAt(r))<128?t+=1:n<2048?t+=2:55296==(64512&n)&&56320==(64512&e.charCodeAt(r+1))?(++r,t+=4):t+=3;return t},n.read=function(e,t,n){if(n-t<1)return"";for(var r,i=null,o=[],a=0;t<n;)(r=e[t++])<128?o[a++]=r:r>191&&r<224?o[a++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[a++]=55296+(r>>10),o[a++]=56320+(1023&r)):o[a++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],a>8191&&((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(e,t,n){for(var r,i,o=n,a=0;a<e.length;++a)(r=e.charCodeAt(a))<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296==(64512&r)&&56320==(64512&(i=e.charCodeAt(a+1)))?(r=65536+((1023&r)<<10)+(1023&i),++a,t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128);return n-o}}),pool_1=pool;function pool(e,t,n){var r=n||8192,i=r>>>1,o=null,a=r;return function(n){if(n<1||n>i)return e(n);a+n>r&&(o=e(r),a=0);var s=t.call(o,a,a+=n);return 7&a&&(a=1+(7|a)),s}}var longbits=LongBits;function LongBits(e,t){this.lo=e>>>0,this.hi=t>>>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(e){if(0===e)return zero;var t=e<0;t&&(e=-e);var n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new LongBits(n,r)},LongBits.from=function(e){if("number"==typeof e)return LongBits.fromNumber(e);if(minimal.isString(e)){if(!minimal.Long)return LongBits.fromNumber(parseInt(e,10));e=minimal.Long.fromString(e)}return e.low||e.high?new LongBits(e.low>>>0,e.high>>>0):zero},LongBits.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},LongBits.prototype.toLong=function(e){return minimal.Long?new minimal.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var charCodeAt=String.prototype.charCodeAt;LongBits.fromHash=function(e){return e===zeroHash?zero:new LongBits((charCodeAt.call(e,0)|charCodeAt.call(e,1)<<8|charCodeAt.call(e,2)<<16|charCodeAt.call(e,3)<<24)>>>0,(charCodeAt.call(e,4)|charCodeAt.call(e,5)<<8|charCodeAt.call(e,6)<<16|charCodeAt.call(e,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 e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},LongBits.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},LongBits.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10};var minimal=createCommonjsModule(function(e,t){var n=t;function r(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;++i)void 0!==e[r[i]]&&n||(e[r[i]]=t[r[i]]);return e}function i(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&r(this,n)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}n.asPromise=aspromise,n.base64=base64_1,n.EventEmitter=eventemitter,n.float=float_1,n.inquire=inquire_1,n.utf8=utf8_1,n.pool=pool_1,n.LongBits=longbits,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isNode=Boolean(commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),n.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"==typeof e||e instanceof String},n.isObject=function(e){return e&&"object"==typeof e},n.isset=n.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!=typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"==typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.Long=commonjsGlobal.dcodeIO&&commonjsGlobal.dcodeIO.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=r,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=i,n.ProtocolError=i("ProtocolError"),n.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},n.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}}),writer=Writer,BufferWriter,LongBits$1=minimal.LongBits,base64=minimal.base64,utf8=minimal.utf8;function Op(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function noop(){}function State(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function Writer(){this.len=0,this.head=new Op(noop,0,0),this.tail=this.head,this.states=null}function writeByte(e,t,n){t[n]=255&e}function writeVarint32(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=e}function VarintOp(e,t){this.len=e,this.next=void 0,this.val=t}function writeVarint64(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function writeFixed32(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}Writer.create=minimal.Buffer?function(){return(Writer.create=function(){return new BufferWriter})()}:function(){return new Writer},Writer.alloc=function(e){return new minimal.Array(e)},minimal.Array!==Array&&(Writer.alloc=minimal.pool(Writer.alloc,minimal.Array.prototype.subarray)),Writer.prototype._push=function(e,t,n){return this.tail=this.tail.next=new Op(e,t,n),this.len+=t,this},VarintOp.prototype=Object.create(Op.prototype),VarintOp.prototype.fn=writeVarint32,Writer.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new VarintOp((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},Writer.prototype.int32=function(e){return e<0?this._push(writeVarint64,10,LongBits$1.fromNumber(e)):this.uint32(e)},Writer.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},Writer.prototype.uint64=function(e){var t=LongBits$1.from(e);return this._push(writeVarint64,t.length(),t)},Writer.prototype.int64=Writer.prototype.uint64,Writer.prototype.sint64=function(e){var t=LongBits$1.from(e).zzEncode();return this._push(writeVarint64,t.length(),t)},Writer.prototype.bool=function(e){return this._push(writeByte,1,e?1:0)},Writer.prototype.fixed32=function(e){return this._push(writeFixed32,4,e>>>0)},Writer.prototype.sfixed32=Writer.prototype.fixed32,Writer.prototype.fixed64=function(e){var t=LongBits$1.from(e);return this._push(writeFixed32,4,t.lo)._push(writeFixed32,4,t.hi)},Writer.prototype.sfixed64=Writer.prototype.fixed64,Writer.prototype.float=function(e){return this._push(minimal.float.writeFloatLE,4,e)},Writer.prototype.double=function(e){return this._push(minimal.float.writeDoubleLE,8,e)};var writeBytes=minimal.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};Writer.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(writeByte,1,0);if(minimal.isString(e)){var n=Writer.alloc(t=base64.length(e));base64.decode(e,n,0),e=n}return this.uint32(t)._push(writeBytes,t,e)},Writer.prototype.string=function(e){var t=utf8.length(e);return t?this.uint32(t)._push(utf8.write,t,e):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 e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},Writer.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},Writer._configure=function(e){BufferWriter=e};var writer_buffer=BufferWriter$1;(BufferWriter$1.prototype=Object.create(writer.prototype)).constructor=BufferWriter$1;var Buffer=minimal.Buffer;function BufferWriter$1(){writer.call(this)}BufferWriter$1.alloc=function(e){return(BufferWriter$1.alloc=minimal._Buffer_allocUnsafe)(e)};var writeBytesBuffer=Buffer&&Buffer.prototype instanceof Uint8Array&&"set"===Buffer.prototype.set.name?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]};function writeStringBuffer(e,t,n){e.length<40?minimal.utf8.write(e,t,n):t.utf8Write(e,n)}BufferWriter$1.prototype.bytes=function(e){minimal.isString(e)&&(e=minimal._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(writeBytesBuffer,t,e),this},BufferWriter$1.prototype.string=function(e){var t=Buffer.byteLength(e);return this.uint32(t),t&&this._push(writeStringBuffer,t,e),this};var reader=Reader,BufferReader,LongBits$2=minimal.LongBits,utf8$1=minimal.utf8;function indexOutOfRange(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function Reader(e){this.buf=e,this.pos=0,this.len=e.length}var create_array="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Reader(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Reader(e);throw Error("illegal buffer")};function readLongVarint(){var e=new LongBits$2(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function readFixed32_end(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-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(e){return(Reader.create=function(e){return minimal.Buffer.isBuffer(e)?new BufferReader(e):create_array(e)})(e)}:create_array,Reader.prototype._slice=minimal.Array.prototype.subarray||minimal.Array.prototype.slice,Reader.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return e}}(),Reader.prototype.int32=function(){return 0|this.uint32()},Reader.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|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 e=minimal.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},Reader.prototype.double=function(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var e=minimal.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},Reader.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw indexOutOfRange(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},Reader.prototype.string=function(){var e=this.bytes();return utf8$1.read(e,0,e.length)},Reader.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw indexOutOfRange(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw indexOutOfRange(this)}while(128&this.buf[this.pos++]);return this},Reader.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},Reader._configure=function(e){BufferReader=e;var t=minimal.Long?"toLong":"toNumber";minimal.merge(Reader.prototype,{int64:function(){return readLongVarint.call(this)[t](!1)},uint64:function(){return readLongVarint.call(this)[t](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[t](!1)},fixed64:function(){return readFixed64.call(this)[t](!0)},sfixed64:function(){return readFixed64.call(this)[t](!1)}})};var reader_buffer=BufferReader$1;function BufferReader$1(e){reader.call(this,e)}(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 e=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len))};var service=Service;function Service(e,t,n){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");minimal.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(n)}(Service.prototype=Object.create(minimal.EventEmitter.prototype)).constructor=Service,Service.prototype.rpcCall=function e(t,n,r,i,o){if(!i)throw TypeError("request must be specified");var a=this;if(!o)return minimal.asPromise(e,a,t,n,r,i);if(a.rpcImpl)try{return a.rpcImpl(t,n[a.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(e,n){if(e)return a.emit("error",e,t),o(e);if(null!==n){if(!(n instanceof r))try{n=r[a.responseDelimited?"decodeDelimited":"decode"](n)}catch(e){return a.emit("error",e,t),o(e)}return a.emit("data",n,t),o(null,n)}a.end(!0)})}catch(e){return a.emit("error",e,t),void setTimeout(function(){o(e)},0)}else setTimeout(function(){o(Error("already ended"))},0)},Service.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this};var rpc_1=createCommonjsModule(function(e,t){t.Service=service}),roots={},indexMinimal=createCommonjsModule(function(e,t){var n=t;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={});$root.tensorflow=function(){var e,t,n={};return n.Any=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.typeUrl="",e.prototype.value=$util.newBuffer([]),e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.Any;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.typeUrl=e.string();break;case 2:r.value=e.bytes();break;default:e.skipType(7&i)}}return r},e}(),n.DataType=(e={},(t=Object.create(e))[e[0]="DT_INVALID"]=0,t[e[1]="DT_FLOAT"]=1,t[e[2]="DT_DOUBLE"]=2,t[e[3]="DT_INT32"]=3,t[e[4]="DT_UINT8"]=4,t[e[5]="DT_INT16"]=5,t[e[6]="DT_INT8"]=6,t[e[7]="DT_STRING"]=7,t[e[8]="DT_COMPLEX64"]=8,t[e[9]="DT_INT64"]=9,t[e[10]="DT_BOOL"]=10,t[e[11]="DT_QINT8"]=11,t[e[12]="DT_QUINT8"]=12,t[e[13]="DT_QINT32"]=13,t[e[14]="DT_BFLOAT16"]=14,t[e[101]="DT_FLOAT_REF"]=101,t[e[102]="DT_DOUBLE_REF"]=102,t[e[103]="DT_INT32_REF"]=103,t[e[104]="DT_UINT8_REF"]=104,t[e[105]="DT_INT16_REF"]=105,t[e[106]="DT_INT8_REF"]=106,t[e[107]="DT_STRING_REF"]=107,t[e[108]="DT_COMPLEX64_REF"]=108,t[e[109]="DT_INT64_REF"]=109,t[e[110]="DT_BOOL_REF"]=110,t[e[111]="DT_QINT8_REF"]=111,t[e[112]="DT_QUINT8_REF"]=112,t[e[113]="DT_QINT32_REF"]=113,t[e[114]="DT_BFLOAT16_REF"]=114,t),n.TensorShape=function(){function e(e){if(this.dim=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.dim=$util.emptyArray,e.prototype.unknownRank=!1,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.TensorShape;e.pos<n;){var i=e.uint32();switch(i>>>3){case 2:r.dim&&r.dim.length||(r.dim=[]),r.dim.push($root.tensorflow.TensorShape.Dim.decode(e,e.uint32()));break;case 3:r.unknownRank=e.bool();break;default:e.skipType(7&i)}}return r},e.Dim=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.size=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.name="",e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.TensorShape.Dim;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.size=e.int64();break;case 2:r.name=e.string();break;default:e.skipType(7&i)}}return r},e}(),e}(),n.Tensor=function(){function e(e){if(this.floatVal=[],this.doubleVal=[],this.intVal=[],this.stringVal=[],this.scomplexVal=[],this.int64Val=[],this.boolVal=[],this.uint32Val=[],this.uint64Val=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.dtype=0,e.prototype.tensorShape=null,e.prototype.versionNumber=0,e.prototype.tensorContent=$util.newBuffer([]),e.prototype.floatVal=$util.emptyArray,e.prototype.doubleVal=$util.emptyArray,e.prototype.intVal=$util.emptyArray,e.prototype.stringVal=$util.emptyArray,e.prototype.scomplexVal=$util.emptyArray,e.prototype.int64Val=$util.emptyArray,e.prototype.boolVal=$util.emptyArray,e.prototype.uint32Val=$util.emptyArray,e.prototype.uint64Val=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.Tensor;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.dtype=e.int32();break;case 2:r.tensorShape=$root.tensorflow.TensorShape.decode(e,e.uint32());break;case 3:r.versionNumber=e.int32();break;case 4:r.tensorContent=e.bytes();break;case 5:if(r.floatVal&&r.floatVal.length||(r.floatVal=[]),2==(7&i))for(var o=e.uint32()+e.pos;e.pos<o;)r.floatVal.push(e.float());else r.floatVal.push(e.float());break;case 6:if(r.doubleVal&&r.doubleVal.length||(r.doubleVal=[]),2==(7&i))for(o=e.uint32()+e.pos;e.pos<o;)r.doubleVal.push(e.double());else r.doubleVal.push(e.double());break;case 7:if(r.intVal&&r.intVal.length||(r.intVal=[]),2==(7&i))for(o=e.uint32()+e.pos;e.pos<o;)r.intVal.push(e.int32());else r.intVal.push(e.int32());break;case 8:r.stringVal&&r.stringVal.length||(r.stringVal=[]),r.stringVal.push(e.bytes());break;case 9:if(r.scomplexVal&&r.scomplexVal.length||(r.scomplexVal=[]),2==(7&i))for(o=e.uint32()+e.pos;e.pos<o;)r.scomplexVal.push(e.float());else r.scomplexVal.push(e.float());break;case 10:if(r.int64Val&&r.int64Val.length||(r.int64Val=[]),2==(7&i))for(o=e.uint32()+e.pos;e.pos<o;)r.int64Val.push(e.int64());else r.int64Val.push(e.int64());break;case 11:if(r.boolVal&&r.boolVal.length||(r.boolVal=[]),2==(7&i))for(o=e.uint32()+e.pos;e.pos<o;)r.boolVal.push(e.bool());else r.boolVal.push(e.bool());break;case 16:if(r.uint32Val&&r.uint32Val.length||(r.uint32Val=[]),2==(7&i))for(o=e.uint32()+e.pos;e.pos<o;)r.uint32Val.push(e.uint32());else r.uint32Val.push(e.uint32());break;case 17:if(r.uint64Val&&r.uint64Val.length||(r.uint64Val=[]),2==(7&i))for(o=e.uint32()+e.pos;e.pos<o;)r.uint64Val.push(e.uint64());else r.uint64Val.push(e.uint64());break;default:e.skipType(7&i)}}return r},e}(),n.AttrValue=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}var t;return e.prototype.list=null,e.prototype.s=$util.newBuffer([]),e.prototype.i=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.f=0,e.prototype.b=!1,e.prototype.type=0,e.prototype.shape=null,e.prototype.tensor=null,e.prototype.placeholder="",e.prototype.func=null,Object.defineProperty(e.prototype,"value",{get:$util.oneOfGetter(t=["list","s","i","f","b","type","shape","tensor","placeholder","func"]),set:$util.oneOfSetter(t)}),e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.AttrValue;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.list=$root.tensorflow.AttrValue.ListValue.decode(e,e.uint32());break;case 2:r.s=e.bytes();break;case 3:r.i=e.int64();break;case 4:r.f=e.float();break;case 5:r.b=e.bool();break;case 6:r.type=e.int32();break;case 7:r.shape=$root.tensorflow.TensorShape.decode(e,e.uint32());break;case 8:r.tensor=$root.tensorflow.Tensor.decode(e,e.uint32());break;case 9:r.placeholder=e.string();break;case 10:r.func=$root.tensorflow.NameAttrList.decode(e,e.uint32());break;default:e.skipType(7&i)}}return r},e.ListValue=function(){function e(e){if(this.s=[],this.i=[],this.f=[],this.b=[],this.type=[],this.shape=[],this.tensor=[],this.func=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.s=$util.emptyArray,e.prototype.i=$util.emptyArray,e.prototype.f=$util.emptyArray,e.prototype.b=$util.emptyArray,e.prototype.type=$util.emptyArray,e.prototype.shape=$util.emptyArray,e.prototype.tensor=$util.emptyArray,e.prototype.func=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.AttrValue.ListValue;e.pos<n;){var i=e.uint32();switch(i>>>3){case 2:r.s&&r.s.length||(r.s=[]),r.s.push(e.bytes());break;case 3:if(r.i&&r.i.length||(r.i=[]),2==(7&i))for(var o=e.uint32()+e.pos;e.pos<o;)r.i.push(e.int64());else r.i.push(e.int64());break;case 4:if(r.f&&r.f.length||(r.f=[]),2==(7&i))for(o=e.uint32()+e.pos;e.pos<o;)r.f.push(e.float());else r.f.push(e.float());break;case 5:if(r.b&&r.b.length||(r.b=[]),2==(7&i))for(o=e.uint32()+e.pos;e.pos<o;)r.b.push(e.bool());else r.b.push(e.bool());break;case 6:if(r.type&&r.type.length||(r.type=[]),2==(7&i))for(o=e.uint32()+e.pos;e.pos<o;)r.type.push(e.int32());else r.type.push(e.int32());break;case 7:r.shape&&r.shape.length||(r.shape=[]),r.shape.push($root.tensorflow.TensorShape.decode(e,e.uint32()));break;case 8:r.tensor&&r.tensor.length||(r.tensor=[]),r.tensor.push($root.tensorflow.Tensor.decode(e,e.uint32()));break;case 9:r.func&&r.func.length||(r.func=[]),r.func.push($root.tensorflow.NameAttrList.decode(e,e.uint32()));break;default:e.skipType(7&i)}}return r},e}(),e}(),n.NameAttrList=function(){function e(e){if(this.attr={},e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.name="",e.prototype.attr=$util.emptyObject,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n,r=void 0===t?e.len:e.pos+t,i=new $root.tensorflow.NameAttrList;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:i.name=e.string();break;case 2:e.skip().pos++,i.attr===$util.emptyObject&&(i.attr={}),n=e.string(),e.pos++,i.attr[n]=$root.tensorflow.AttrValue.decode(e,e.uint32());break;default:e.skipType(7&o)}}return i},e}(),n.NodeDef=function(){function e(e){if(this.input=[],this.attr={},e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.name="",e.prototype.op="",e.prototype.input=$util.emptyArray,e.prototype.device="",e.prototype.attr=$util.emptyObject,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n,r=void 0===t?e.len:e.pos+t,i=new $root.tensorflow.NodeDef;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:i.name=e.string();break;case 2:i.op=e.string();break;case 3:i.input&&i.input.length||(i.input=[]),i.input.push(e.string());break;case 4:i.device=e.string();break;case 5:e.skip().pos++,i.attr===$util.emptyObject&&(i.attr={}),n=e.string(),e.pos++,i.attr[n]=$root.tensorflow.AttrValue.decode(e,e.uint32());break;default:e.skipType(7&o)}}return i},e}(),n.VersionDef=function(){function e(e){if(this.badConsumers=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.producer=0,e.prototype.minConsumer=0,e.prototype.badConsumers=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.VersionDef;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.producer=e.int32();break;case 2:r.minConsumer=e.int32();break;case 3:if(r.badConsumers&&r.badConsumers.length||(r.badConsumers=[]),2==(7&i))for(var o=e.uint32()+e.pos;e.pos<o;)r.badConsumers.push(e.int32());else r.badConsumers.push(e.int32());break;default:e.skipType(7&i)}}return r},e}(),n.GraphDef=function(){function e(e){if(this.node=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.node=$util.emptyArray,e.prototype.versions=null,e.prototype.library=null,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.GraphDef;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.node&&r.node.length||(r.node=[]),r.node.push($root.tensorflow.NodeDef.decode(e,e.uint32()));break;case 4:r.versions=$root.tensorflow.VersionDef.decode(e,e.uint32());break;case 2:r.library=$root.tensorflow.FunctionDefLibrary.decode(e,e.uint32());break;default:e.skipType(7&i)}}return r},e}(),n.CollectionDef=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}var t;return e.prototype.nodeList=null,e.prototype.bytesList=null,e.prototype.int64List=null,e.prototype.floatList=null,e.prototype.anyList=null,Object.defineProperty(e.prototype,"kind",{get:$util.oneOfGetter(t=["nodeList","bytesList","int64List","floatList","anyList"]),set:$util.oneOfSetter(t)}),e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.CollectionDef;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.nodeList=$root.tensorflow.CollectionDef.NodeList.decode(e,e.uint32());break;case 2:r.bytesList=$root.tensorflow.CollectionDef.BytesList.decode(e,e.uint32());break;case 3:r.int64List=$root.tensorflow.CollectionDef.Int64List.decode(e,e.uint32());break;case 4:r.floatList=$root.tensorflow.CollectionDef.FloatList.decode(e,e.uint32());break;case 5:r.anyList=$root.tensorflow.CollectionDef.AnyList.decode(e,e.uint32());break;default:e.skipType(7&i)}}return r},e.NodeList=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.value=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.CollectionDef.NodeList;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.value&&r.value.length||(r.value=[]),r.value.push(e.string());break;default:e.skipType(7&i)}}return r},e}(),e.BytesList=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.value=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.CollectionDef.BytesList;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.value&&r.value.length||(r.value=[]),r.value.push(e.bytes());break;default:e.skipType(7&i)}}return r},e}(),e.Int64List=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.value=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.CollectionDef.Int64List;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:if(r.value&&r.value.length||(r.value=[]),2==(7&i))for(var o=e.uint32()+e.pos;e.pos<o;)r.value.push(e.int64());else r.value.push(e.int64());break;default:e.skipType(7&i)}}return r},e}(),e.FloatList=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.value=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.CollectionDef.FloatList;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:if(r.value&&r.value.length||(r.value=[]),2==(7&i))for(var o=e.uint32()+e.pos;e.pos<o;)r.value.push(e.float());else r.value.push(e.float());break;default:e.skipType(7&i)}}return r},e}(),e.AnyList=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.value=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.CollectionDef.AnyList;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.value&&r.value.length||(r.value=[]),r.value.push($root.tensorflow.Any.decode(e,e.uint32()));break;default:e.skipType(7&i)}}return r},e}(),e}(),n.SaverDef=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}var t,n;return e.prototype.filenameTensorName="",e.prototype.saveTensorName="",e.prototype.restoreOpName="",e.prototype.maxToKeep=0,e.prototype.sharded=!1,e.prototype.keepCheckpointEveryNHours=0,e.prototype.version=0,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.SaverDef;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.filenameTensorName=e.string();break;case 2:r.saveTensorName=e.string();break;case 3:r.restoreOpName=e.string();break;case 4:r.maxToKeep=e.int32();break;case 5:r.sharded=e.bool();break;case 6:r.keepCheckpointEveryNHours=e.float();break;case 7:r.version=e.int32();break;default:e.skipType(7&i)}}return r},e.CheckpointFormatVersion=(t={},(n=Object.create(t))[t[0]="LEGACY"]=0,n[t[1]="V1"]=1,n[t[2]="V2"]=2,n),e}(),n.TensorInfo=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}var t;return e.prototype.name="",e.prototype.cooSparse=null,e.prototype.dtype=0,e.prototype.tensorShape=null,Object.defineProperty(e.prototype,"encoding",{get:$util.oneOfGetter(t=["name","cooSparse"]),set:$util.oneOfSetter(t)}),e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.TensorInfo;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.name=e.string();break;case 4:r.cooSparse=$root.tensorflow.TensorInfo.CooSparse.decode(e,e.uint32());break;case 2:r.dtype=e.int32();break;case 3:r.tensorShape=$root.tensorflow.TensorShape.decode(e,e.uint32());break;default:e.skipType(7&i)}}return r},e.CooSparse=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.valuesTensorName="",e.prototype.indicesTensorName="",e.prototype.denseShapeTensorName="",e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.TensorInfo.CooSparse;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.valuesTensorName=e.string();break;case 2:r.indicesTensorName=e.string();break;case 3:r.denseShapeTensorName=e.string();break;default:e.skipType(7&i)}}return r},e}(),e}(),n.SignatureDef=function(){function e(e){if(this.inputs={},this.outputs={},e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.inputs=$util.emptyObject,e.prototype.outputs=$util.emptyObject,e.prototype.methodName="",e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n,r=void 0===t?e.len:e.pos+t,i=new $root.tensorflow.SignatureDef;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:e.skip().pos++,i.inputs===$util.emptyObject&&(i.inputs={}),n=e.string(),e.pos++,i.inputs[n]=$root.tensorflow.TensorInfo.decode(e,e.uint32());break;case 2:e.skip().pos++,i.outputs===$util.emptyObject&&(i.outputs={}),n=e.string(),e.pos++,i.outputs[n]=$root.tensorflow.TensorInfo.decode(e,e.uint32());break;case 3:i.methodName=e.string();break;default:e.skipType(7&o)}}return i},e}(),n.AssetFileDef=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.tensorInfo=null,e.prototype.filename="",e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.AssetFileDef;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.tensorInfo=$root.tensorflow.TensorInfo.decode(e,e.uint32());break;case 2:r.filename=e.string();break;default:e.skipType(7&i)}}return r},e}(),n.OpDef=function(){function e(e){if(this.inputArg=[],this.outputArg=[],this.attr=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.name="",e.prototype.inputArg=$util.emptyArray,e.prototype.outputArg=$util.emptyArray,e.prototype.attr=$util.emptyArray,e.prototype.deprecation=null,e.prototype.summary="",e.prototype.description="",e.prototype.isCommutative=!1,e.prototype.isAggregate=!1,e.prototype.isStateful=!1,e.prototype.allowsUninitializedInput=!1,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.OpDef;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.name=e.string();break;case 2:r.inputArg&&r.inputArg.length||(r.inputArg=[]),r.inputArg.push($root.tensorflow.OpDef.ArgDef.decode(e,e.uint32()));break;case 3:r.outputArg&&r.outputArg.length||(r.outputArg=[]),r.outputArg.push($root.tensorflow.OpDef.ArgDef.decode(e,e.uint32()));break;case 4:r.attr&&r.attr.length||(r.attr=[]),r.attr.push($root.tensorflow.OpDef.AttrDef.decode(e,e.uint32()));break;case 8:r.deprecation=$root.tensorflow.OpDef.OpDeprecation.decode(e,e.uint32());break;case 5:r.summary=e.string();break;case 6:r.description=e.string();break;case 18:r.isCommutative=e.bool();break;case 16:r.isAggregate=e.bool();break;case 17:r.isStateful=e.bool();break;case 19:r.allowsUninitializedInput=e.bool();break;default:e.skipType(7&i)}}return r},e.ArgDef=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.name="",e.prototype.description="",e.prototype.type=0,e.prototype.typeAttr="",e.prototype.numberAttr="",e.prototype.typeListAttr="",e.prototype.isRef=!1,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.OpDef.ArgDef;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.name=e.string();break;case 2:r.description=e.string();break;case 3:r.type=e.int32();break;case 4:r.typeAttr=e.string();break;case 5:r.numberAttr=e.string();break;case 6:r.typeListAttr=e.string();break;case 16:r.isRef=e.bool();break;default:e.skipType(7&i)}}return r},e}(),e.AttrDef=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.name="",e.prototype.type="",e.prototype.defaultValue=null,e.prototype.description="",e.prototype.hasMinimum=!1,e.prototype.minimum=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.allowedValues=null,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.OpDef.AttrDef;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.name=e.string();break;case 2:r.type=e.string();break;case 3:r.defaultValue=$root.tensorflow.AttrValue.decode(e,e.uint32());break;case 4:r.description=e.string();break;case 5:r.hasMinimum=e.bool();break;case 6:r.minimum=e.int64();break;case 7:r.allowedValues=$root.tensorflow.AttrValue.decode(e,e.uint32());break;default:e.skipType(7&i)}}return r},e}(),e.OpDeprecation=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.version=0,e.prototype.explanation="",e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.OpDef.OpDeprecation;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.version=e.int32();break;case 2:r.explanation=e.string();break;default:e.skipType(7&i)}}return r},e}(),e}(),n.OpList=function(){function e(e){if(this.op=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.op=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.OpList;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.op&&r.op.length||(r.op=[]),r.op.push($root.tensorflow.OpDef.decode(e,e.uint32()));break;default:e.skipType(7&i)}}return r},e}(),n.MetaGraphDef=function(){function e(e){if(this.collectionDef={},this.signatureDef={},this.assetFileDef=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.metaInfoDef=null,e.prototype.graphDef=null,e.prototype.saverDef=null,e.prototype.collectionDef=$util.emptyObject,e.prototype.signatureDef=$util.emptyObject,e.prototype.assetFileDef=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n,r=void 0===t?e.len:e.pos+t,i=new $root.tensorflow.MetaGraphDef;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:i.metaInfoDef=$root.tensorflow.MetaGraphDef.MetaInfoDef.decode(e,e.uint32());break;case 2:i.graphDef=$root.tensorflow.GraphDef.decode(e,e.uint32());break;case 3:i.saverDef=$root.tensorflow.SaverDef.decode(e,e.uint32());break;case 4:e.skip().pos++,i.collectionDef===$util.emptyObject&&(i.collectionDef={}),n=e.string(),e.pos++,i.collectionDef[n]=$root.tensorflow.CollectionDef.decode(e,e.uint32());break;case 5:e.skip().pos++,i.signatureDef===$util.emptyObject&&(i.signatureDef={}),n=e.string(),e.pos++,i.signatureDef[n]=$root.tensorflow.SignatureDef.decode(e,e.uint32());break;case 6:i.assetFileDef&&i.assetFileDef.length||(i.assetFileDef=[]),i.assetFileDef.push($root.tensorflow.AssetFileDef.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return i},e.MetaInfoDef=function(){function e(e){if(this.tags=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.metaGraphVersion="",e.prototype.strippedOpList=null,e.prototype.anyInfo=null,e.prototype.tags=$util.emptyArray,e.prototype.tensorflowVersion="",e.prototype.tensorflowGitVersion="",e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.MetaGraphDef.MetaInfoDef;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.metaGraphVersion=e.string();break;case 2:r.strippedOpList=$root.tensorflow.OpList.decode(e,e.uint32());break;case 3:r.anyInfo=$root.tensorflow.Any.decode(e,e.uint32());break;case 4:r.tags&&r.tags.length||(r.tags=[]),r.tags.push(e.string());break;case 5:r.tensorflowVersion=e.string();break;case 6:r.tensorflowGitVersion=e.string();break;default:e.skipType(7&i)}}return r},e}(),e}(),n.SavedModel=function(){function e(e){if(this.metaGraphs=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.savedModelSchemaVersion=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.metaGraphs=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.SavedModel;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.savedModelSchemaVersion=e.int64();break;case 2:r.metaGraphs&&r.metaGraphs.length||(r.metaGraphs=[]),r.metaGraphs.push($root.tensorflow.MetaGraphDef.decode(e,e.uint32()));break;default:e.skipType(7&i)}}return r},e}(),n.FunctionDefLibrary=function(){function e(e){if(this.function=[],this.gradient=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.function=$util.emptyArray,e.prototype.gradient=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.FunctionDefLibrary;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.function&&r.function.length||(r.function=[]),r.function.push($root.tensorflow.FunctionDef.decode(e,e.uint32()));break;case 2:r.gradient&&r.gradient.length||(r.gradient=[]),r.gradient.push($root.tensorflow.GradientDef.decode(e,e.uint32()));break;default:e.skipType(7&i)}}return r},e}(),n.FunctionDef=function(){function e(e){if(this.attr={},this.nodeDef=[],this.ret={},e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.signature=null,e.prototype.attr=$util.emptyObject,e.prototype.nodeDef=$util.emptyArray,e.prototype.ret=$util.emptyObject,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n,r=void 0===t?e.len:e.pos+t,i=new $root.tensorflow.FunctionDef;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:i.signature=$root.tensorflow.OpDef.decode(e,e.uint32());break;case 5:e.skip().pos++,i.attr===$util.emptyObject&&(i.attr={}),n=e.string(),e.pos++,i.attr[n]=$root.tensorflow.AttrValue.decode(e,e.uint32());break;case 3:i.nodeDef&&i.nodeDef.length||(i.nodeDef=[]),i.nodeDef.push($root.tensorflow.NodeDef.decode(e,e.uint32()));break;case 4:e.skip().pos++,i.ret===$util.emptyObject&&(i.ret={}),n=e.string(),e.pos++,i.ret[n]=e.string();break;default:e.skipType(7&o)}}return i},e}(),n.GradientDef=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.functionName="",e.prototype.gradientFunc="",e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var n=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.GradientDef;e.pos<n;){var i=e.uint32();switch(i>>>3){case 1:r.functionName=e.string();break;case 2:r.gradientFunc=e.string();break;default:e.skipType(7&i)}}return r},e}(),n}();var compiled_api=$root,compiled_api_1=compiled_api.tensorflow;function getParamValue(e,t,n,r){var i=t.params[e];if(i&&void 0!==i.inputIndex){if("tensor"===i.type)return getTensor(t.inputNames[i.inputIndex],n,r);if("tensors"===i.type)return(0===i.inputIndex?0===i.inputParamLength?t.inputNames:t.inputNames.slice(i.inputIndex,-i.inputParamLength):t.inputNames.splice(i.inputIndex)).map(function(e){return getTensor(e,n,r)});var o=Array.prototype.slice.call(getTensor(t.inputNames.slice(i.inputIndex)[0],n,r).dataSync());return"number"===i.type?o[0]:o}return i&&i.value}function getTensor(e,t,n){var r=parseNodeName(e),i=r[0],o=r[1],a=n.currentContextIds.find(function(e){return!!t[getNodeNameWithContextId(i,e)]});return void 0!==a?t[getNodeNameWithContextId(i,a)][o]:void 0}function getNodeNameAndIndex(e,t){var n=parseNodeName(e),r=n[0],i=n[1];return[getNodeNameWithContextId(r,t&&t.currentContextId),i]}function getNodeNameWithContextId(e,t){return t?e+"-"+t:e}function parseNodeName(e){var t=e.lastIndexOf(":");return-1===t?[e,0]:[e.substring(0,t),Number(e.substring(t+1))]}function split$1(e,t){for(var n=[],r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));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}]}],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:"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}]}],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}]}],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}]}],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:"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"}]}],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"}]}],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"},{tfParamName:"axis",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:"axis",type:"number"}]},{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}]}],sliceJoin=Object.freeze({json:json$13}),json$14=[{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[]"}]}],transformation=Object.freeze({json:json$14}),CONTROL_FLOW_OPS=["Switch","Merge","Enter","Exit","NextIteration"],DYNAMIC_SHAPE_OPS=["NonMaxSuppressionV2","NonMaxSuppressionV3","Where"],OperationMapper=function(){function e(){var e=[arithmetic,basicMath,control,convolution,creation,dynamic,evaluation,logical,image$1,graph,matrices,normalization,reduction,sliceJoin,transformation],t=[].concat.apply([],e.map(function(e){return e.json}));this.opMappers=t.reduce(function(e,t){return e[t.tfOpName]=t,e},{})}return Object.defineProperty(e,"Instance",{get:function(){return this._instance||(this._instance=new this)},enumerable:!0,configurable:!0}),e.prototype.isControlFlow=function(e){return CONTROL_FLOW_OPS.some(function(t){return t===e.op})},e.prototype.isDynamicShape=function(e){return DYNAMIC_SHAPE_OPS.some(function(t){return t===e.op})},e.prototype.transformGraph=function(e){var t=this,n=!1,r=!1,i=[],o=[],a=e.node.reduce(function(e,a){return e[a.name]=t.mapNode(a),t.isControlFlow(a)&&(n=!0),t.isDynamicShape(a)&&(r=!0),"Placeholder"===a.op&&i.push(e[a.name]),"Const"===a.op&&o.push(e[a.name]),e},{}),s=[],u=[];return Object.keys(a).forEach(function(e){var t=a[e];t.inputNames.forEach(function(e){var n=getNodeNameAndIndex(e)[0];t.inputs.push(a[n]),a[n].children.push(t)}),0===t.inputs.length&&s.push(t)}),Object.keys(a).forEach(function(e){var t=a[e];0===t.children.length&&u.push(t)}),{nodes:a,inputs:s,outputs:u,weights:o,placeholders:i,withControlFlow:n,withDynamicShape:r}},e.prototype.mapNode=function(e){var t=this,n=this.opMappers[e.op];if(void 0===n)throw new Error("Tensorflow Op is not supported: "+e.op);var r={name:e.name,op:n.dlOpName,category:n.category,inputNames:(e.input||[]).map(function(e){return e.startsWith("^")?e.substr(1):e}),inputs:[],children:[],params:{}};return n.params&&(r.params=n.params.reduce(function(n,r){var i=r.tfInputIndex,o=r.tfInputParamLength,a=r.type,s=void 0;if(void 0===i)switch(r.type){case"string":void 0===(s=t.getStringParam(e.attr,r.tfParamName,r.defaultValue))&&r.tfParamNameDeprecated&&(s=t.getStringParam(e.attr,r.tfParamNameDeprecated,r.defaultValue));break;case"number":void 0===(s=t.getNumberParam(e.attr,r.tfParamName,r.defaultValue))&&r.tfParamNameDeprecated&&(s=t.getNumberParam(e.attr,r.tfParamNameDeprecated,r.defaultValue));break;case"number[]":void 0===(s=t.getNumericArrayParam(e.attr,r.tfParamName,r.defaultValue))&&r.tfParamNameDeprecated&&(s=t.getNumericArrayParam(e.attr,r.tfParamNameDeprecated,r.defaultValue));break;case"bool":void 0===(s=t.getBoolParam(e.attr,r.tfParamName,r.defaultValue))&&r.tfParamNameDeprecated&&(s=t.getBoolParam(e.attr,r.tfParamNameDeprecated,r.defaultValue));break;case"shape":void 0===(s=t.getTensorShapeParam(e.attr,r.tfParamName,r.defaultValue))&&r.tfParamNameDeprecated&&(s=t.getTensorShapeParam(e.attr,r.tfParamNameDeprecated,r.defaultValue));break;case"dtype":void 0===(s=t.getDtypeParam(e.attr,r.tfParamName,r.defaultValue))&&r.tfParamNameDeprecated&&(s=t.getDtypeParam(e.attr,r.tfParamNameDeprecated,r.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error("Unsupported param type: "+r.type+" for op: "+e.op)}return n[r.dlParamName]={value:s,inputIndex:i,type:a,inputParamLength:o},n},{})),r},e.prototype.getStringParam=function(e,t,n,r){void 0===r&&(r=!1);var i=e[t];if(void 0!==i){var o=String.fromCharCode.apply(null,i.s);return r?o:o.toLowerCase()}return n},e.prototype.getBoolParam=function(e,t,n){var r=e[t];return r?r.b:n},e.prototype.getNumberParam=function(e,t,n){var r=e[t],i=r?r[r.value]:n;return"number"==typeof i?i:i.toInt()},e.prototype.getDtypeParam=function(e,t,n){var r=e[t];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},e.prototype.getTensorShapeParam=function(e,t,n){var r=e[t];return r&&r.shape?r.shape.dim.map(function(e){return"number"==typeof e.size?e.size:e.size.toInt()}):n},e.prototype.getNumericArrayParam=function(e,t,n){var r=e[t];return r?(r.list.f&&r.list.f.length?r.list.f:r.list.i).map(function(e){return"number"==typeof e?e:e.toInt()}):n},e}(),executeOp=function(e,t,n){switch(e.op){case"add":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.s)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];case"addN":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.t)(getParamValue("tensors",e,t,n))];case"mod":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.kc)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];case"mul":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.oc)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];case"div":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.hb)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];case"floorDiv":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.vb)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];case"sub":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Bd)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];case"minimum":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ic)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];case"maximum":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.dc)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];case"pow":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Hc)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];case"squaredDifference":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.vd)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];default:throw TypeError("Node type "+e.op+" is not implemented")}},executeOp$1=function(e,t,n){switch(e.op){case"abs":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.p)(getParamValue("x",e,t,n))];case"acos":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.q)(getParamValue("x",e,t,n))];case"acosh":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.r)(getParamValue("x",e,t,n))];case"asin":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.z)(getParamValue("x",e,t,n))];case"asinh":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.A)(getParamValue("x",e,t,n))];case"atan":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.B)(getParamValue("x",e,t,n))];case"atanh":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.D)(getParamValue("x",e,t,n))];case"ceil":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.N)(getParamValue("x",e,t,n))];case"cos":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Z)(getParamValue("x",e,t,n))];case"cosh":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ab)(getParamValue("x",e,t,n))];case"elu":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.kb)(getParamValue("x",e,t,n))];case"erf":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ob)(getParamValue("x",e,t,n))];case"exp":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.pb)(getParamValue("x",e,t,n))];case"expm1":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.rb)(getParamValue("x",e,t,n))];case"floor":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ub)(getParamValue("x",e,t,n))];case"log":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Rb)(getParamValue("x",e,t,n))];case"log1p":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Sb)(getParamValue("x",e,t,n))];case"neg":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.sc)(getParamValue("x",e,t,n))];case"reciprocal":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Rc)(getParamValue("x",e,t,n))];case"relu":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Sc)(getParamValue("x",e,t,n))];case"round":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Zc)(getParamValue("x",e,t,n))];case"selu":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.cd)(getParamValue("x",e,t,n))];case"sigmoid":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.gd)(getParamValue("x",e,t,n))];case"sin":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.id)(getParamValue("x",e,t,n))];case"sign":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.hd)(getParamValue("x",e,t,n))];case"sinh":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.jd)(getParamValue("x",e,t,n))];case"softplus":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.qd)(getParamValue("x",e,t,n))];case"sqrt":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.td)(getParamValue("x",e,t,n))];case"square":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ud)(getParamValue("x",e,t,n))];case"tanh":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Fd)(getParamValue("x",e,t,n))];case"tan":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Ed)(getParamValue("x",e,t,n))];case"clipByValue":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.O)(getParamValue("x",e,t,n),getParamValue("clipValueMin",e,t,n),getParamValue("clipValueMax",e,t,n))];case"rsqrt":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.hb)(Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.bd)(1,"float32"),Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.td)(getTensor(e.inputNames[0],t,n)))];default:throw TypeError("Node type "+e.op+" is not implemented")}},TensorArray=function(){function e(t,n,r,i,o,a,s){this.name=t,this.dtype=n,this.maxSize=r,this.elementShape=i,this.identicalElementShapes=o,this.dynamicSize=a,this.clearAfterRead=s,this.tensors=[],this.closed_=!1,this.id=e.nextId++}return Object.defineProperty(e.prototype,"closed",{get:function(){return this.closed_},enumerable:!0,configurable:!0}),e.prototype.clearAndClose=function(){this.tensors.forEach(function(e){return e.tensor.dispose()}),this.tensors=[],this.closed_=!0},e.prototype.size=function(){return this.tensors.length},e.prototype.read=function(e){if(this.closed_)throw new Error("TensorArray "+this.name+" has already been closed.");if(e<0||e>=this.tensors.length)throw new Error("Tried to read from index "+e+", but array size is: "+this.tensors.length);var t=this.tensors[e];if(t.cleared)throw new Error("TensorArray "+this.name+": Could not read index "+e+" twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).");return this.clearAfterRead&&(t.cleared=!0),t.read=!0,t.tensor},e.prototype.readMany=function(e){var t=this;return e.map(function(e){return t.read(e)})},e.prototype.write=function(e,t){if(this.closed_)throw new Error("TensorArray "+this.name+" has already been closed.");if(e<0||!this.dynamicSize&&e>=this.maxSize)throw new Error("Tried to write to index "+e+", but array is not resizeable and size is: "+this.maxSize);var n=this.tensors[e]||{};if(t.dtype!==this.dtype)throw new Error("TensorArray "+this.name+": Could not write to TensorArray index "+e+",\n          because the value dtype is "+t.dtype+", but TensorArray dtype is "+this.dtype+".");if(0===this.size()&&0===this.elementShape.length&&(this.elementShape=t.shape),this.assertShapesMatch(this.elementShape,t.shape,"TensorArray "+this.name+": Could not write to TensorArray index "+e+"."),n&&n.read)throw new Error("TensorArray "+this.name+": Could not write to TensorArray index "+e+", because it has already been read.");if(n&&n.written)throw new Error("TensorArray "+this.name+": Could not write to TensorArray index "+e+", because it has already been written.");n.tensor=t,n.written=!0,this.tensors[e]=n},e.prototype.writeMany=function(e,t){var n=this;if(e.length!==t.length)throw new Error("TensorArray "+this.name+": could not write multiple tensors,because the index size: "+e.length+" is not the same as tensors size: "+t.length+".");e.forEach(function(e,r){return n.write(e,t[r])})},e.prototype.gather=function(e,t){if(t&&t!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but gather requested dtype "+t);if(!e){e=[];for(var n=0;n<this.size();n++)e.push(n)}if(0===e.length)return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Gd)([],[0].concat(this.elementShape));var r=this.readMany(e);return this.assertShapesMatch(this.elementShape,r[0].shape,"TensorArray shape mismatch: "),Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.yd)(r,0)},e.prototype.concat=function(e){if(e&&e!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but concat requested dtype "+e);if(0===this.size())return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Gd)([],[0].concat(this.elementShape));for(var t=[],n=0;n<this.size();n++)t.push(n);var r=this.readMany(t);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__.R)(r,0)},e.prototype.scatter=function(e,t){if(t.dtype!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but tensor has dtype "+t.dtype);if(e.length!==t.shape[0])throw new Error("Expected len(indices) == tensor.shape[0], but saw: "+e.length+" vs. "+t.shape[0]);var n=Math.max.apply(Math,e);if(!this.dynamicSize&&n>=this.maxSize)throw new Error("Max index must be < array size ("+n+"  vs. "+this.maxSize+")");this.writeMany(e,Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Xd)(t,0))},e.prototype.split=function(e,t){var n=this;if(t.dtype!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but tensor has dtype "+t.dtype);var r=0,i=e.map(function(e){return r+=e});if(r!==t.shape[0])throw new Error("Expected sum of lengths to be equal to\n          tensor.shape[0], but sum of lengths is\n        "+r+", and tensor's shape is: "+t.shape);if(!this.dynamicSize&&e.length!==this.maxSize)throw new Error("TensorArray's size is not equal to the size of lengths ("+this.maxSize+" vs. "+e.length+"), and the TensorArray is not marked as dynamically resizeable");var o=0===r?0:t.size/r,a=[];Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Od)(function(){t=t.reshape([1,r,o]);for(var s=0;s<e.length;++s){var u=[0,0===s?0:i[s-1],0],c=[1,e[s],o];a[s]=Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.kd)(t,u,c).reshape(n.elementShape)}return a});for(var s=[],u=0;u<e.length;u++)s[u]=u;this.writeMany(s,a)},e.prototype.assertShapesMatch=function(e,t,n){void 0===n&&(n=""),_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Yd.assert(this.arraysEqual(e,t),n+" Shapes "+e+" and "+t+" must match")},e.prototype.arraysEqual=function(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(-1!==e[n]&&-1!==t[n]&&e[n]!==t[n])return!1;return!0},e.nextId=0,e}();function executeOp$2(e,t,n){return __awaiter(this,void 0,void 0,function(){var r,i,o,a,s,u,c,l,h,d,f,p,m,g,b,y,v,_,w,x,E,S,C,O,A,M,N,k,I,T,P,R,D,L,B;return __generator(this,function(j){switch(j.label){case 0:switch(e.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",e,t,n)]];case 2:return r=getParamValue("pred",e,t,n),i=getParamValue("data",e,t,n),[4,r.data()];case 3:return[2,j.sent()[0]?[void 0,i]:[i,void 0]];case 4:return[2,(o=e.inputNames.find(function(e){return void 0!==getTensor(e,t,n)}))?[getTensor(o,t,n)]:void 0];case 5:return a=getParamValue("frameName",e,t,n),s=getParamValue("tensor",e,t,n),n.enterFrame(a),[2,[s]];case 6:return u=getParamValue("tensor",e,t,n),n.exitFrame(),[2,[u]];case 7:return c=getParamValue("tensor",e,t,n),n.nextIteration(),[2,[c]];case 8:return l=getParamValue("size",e,t,n),h=getParamValue("dtype",e,t,n),d=getParamValue("elementShape",e,t,n),f=getParamValue("dynamicSize",e,t,n),p=getParamValue("clearAfterRead",e,t,n),m=getParamValue("identicalElementShapes",e,t,n),g=getParamValue("name",e,t,n),b=new TensorArray(g,h,l,d,m,f,p),n.addTensorArray(b),[2,[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.bd)(b.id),Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.bd)(1)]];case 9:return y=getParamValue("tensorArrayId",e,t,n),v=getParamValue("index",e,t,n),_=getParamValue("tensor",e,t,n),n.getTensorArray(y).write(v,_),[2,[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.bd)(1)]];case 10:return w=getParamValue("tensorArrayId",e,t,n),x=getParamValue("index",e,t,n),[2,[n.getTensorArray(w).read(x)]];case 11:return E=getParamValue("tensorArrayId",e,t,n),S=getParamValue("indices",e,t,n),C=getParamValue("dtype",e,t,n),[2,[n.getTensorArray(E).gather(S,C)]];case 12:return O=getParamValue("tensorArrayId",e,t,n),A=getParamValue("indices",e,t,n),M=getParamValue("tensor",e,t,n),n.getTensorArray(O).scatter(A,M),[2,[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.bd)(1)]];case 13:return N=getParamValue("tensorArrayId",e,t,n),k=n.getTensorArray(N),I=getParamValue("dtype",e,t,n),[2,[k.concat(I)]];case 14:return T=getParamValue("tensorArrayId",e,t,n),P=getParamValue("tensor",e,t,n),R=getParamValue("lengths",e,t,n),n.getTensorArray(T).split(R,P),[2,[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.bd)(1)]];case 15:return D=getParamValue("tensorArrayId",e,t,n),L=n.getTensorArray(D),[2,[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.bd)(L.size(),"int32")]];case 16:return B=getParamValue("tensorArrayId",e,t,n),n.getTensorArray(B).clearAndClose(),[2,[]];case 17:throw TypeError("Node type "+e.op+" is not implemented")}})})}var executeOp$3=function(e,t,n){switch(e.op){case"conv1d":var r=getParamValue("stride",e,t,n),i=getParamValue("pad",e,t,n),o=getParamValue("dataFormat",e,t,n).toUpperCase(),a=getParamValue("dilation",e,t,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.W)(getParamValue("x",e,t,n),getParamValue("filter",e,t,n),r,i,o,a)];case"conv2d":r=getParamValue("strides",e,t,n),i=getParamValue("pad",e,t,n),o=getParamValue("dataFormat",e,t,n).toUpperCase();var s=getParamValue("dilations",e,t,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.X)(getParamValue("x",e,t,n),getParamValue("filter",e,t,n),[r[1],r[2]],i,o,[s[0],s[1]])];case"conv2dTranspose":var u=getParamValue("outputShape",e,t,n);return r=getParamValue("strides",e,t,n),i=getParamValue("pad",e,t,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Y)(getParamValue("x",e,t,n),getParamValue("filter",e,t,n),u,[r[1],r[2]],i)];case"depthwiseConv2d":return r=getParamValue("strides",e,t,n),i=getParamValue("pad",e,t,n),s=getParamValue("dilations",e,t,n),o=getParamValue("dataFormat",e,t,n).toUpperCase(),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.eb)(getParamValue("input",e,t,n),getParamValue("filter",e,t,n),[r[1],r[2]],i,o,[s[0],s[1]])];case"avgPool":r=getParamValue("strides",e,t,n),i=getParamValue("pad",e,t,n);var c=getParamValue("kernelSize",e,t,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.E)(getParamValue("x",e,t,n),[c[1],c[2]],[r[1],r[2]],i)];case"maxPool":return r=getParamValue("strides",e,t,n),i=getParamValue("pad",e,t,n),c=getParamValue("kernelSize",e,t,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.cc)(getParamValue("x",e,t,n),[c[1],c[2]],[r[1],r[2]],i)];default:throw TypeError("Node type "+e.op+" is not implemented")}},executeOp$4=function(e,t,n){switch(e.op){case"fill":var r=getParamValue("shape",e,t,n),i=getParamValue("dtype",e,t,n),o=getParamValue("value",e,t,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.tb)(r,o,i)];case"linspace":var a=getParamValue("start",e,t,n),s=getParamValue("stop",e,t,n),u=getParamValue("num",e,t,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Pb)(a,s,u)];case"oneHot":var c=getParamValue("indices",e,t,n),l=getParamValue("depth",e,t,n),h=getParamValue("onValue",e,t,n),d=getParamValue("offValue",e,t,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.xc)(c,l,h,d)];case"ones":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.yc)(getParamValue("shape",e,t,n),getParamValue("dtype",e,t,n))];case"onesLike":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.zc)(getParamValue("x",e,t,n))];case"randomUniform":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Oc)(getParamValue("shape",e,t,n),getParamValue("minval",e,t,n),getParamValue("maxval",e,t,n),getParamValue("dtype",e,t,n))];case"range":a=getParamValue("start",e,t,n);var f=getParamValue("stop",e,t,n),p=getParamValue("step",e,t,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Pc)(a,f,p,getParamValue("dtype",e,t,n))];case"truncatedNormal":r=getParamValue("shape",e,t,n);var m=getParamValue("mean",e,t,n),g=getParamValue("stdDev",e,t,n),b=getParamValue("seed",e,t,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Vd)(r,m,g,getParamValue("dtype",e,t,n),b)];case"zeros":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.he)(getParamValue("shape",e,t,n),getParamValue("dtype",e,t,n))];case"zerosLike":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ie)(getParamValue("x",e,t,n))];default:throw TypeError("Node type "+e.op+" is not implemented")}};function executeOp$5(e,t,n){return __awaiter(this,void 0,void 0,function(){var r,i,o,a,s;return __generator(this,function(u){switch(u.label){case 0:switch(e.op){case"nonMaxSuppression":return[3,1];case"whereAsync":return[3,3]}return[3,5];case 1:return r=getParamValue("boxes",e,t,n),i=getParamValue("scores",e,t,n),o=getParamValue("maxOutputSize",e,t,n),a=getParamValue("iouThreshold",e,t,n),s=getParamValue("scoreThreshold",e,t,n),[4,_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Gb.nonMaxSuppressionAsync(r,i,o,a,s)];case 2:return[2,[u.sent()]];case 3:return[4,Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ge)(getParamValue("condition",e,t,n))];case 4:return[2,[u.sent()]];case 5:throw TypeError("Node type "+e.op+" is not implemented")}})})}var executeOp$6=function(e,t,n){switch(e.op){case"topK":var r=getParamValue("x",e,t,n),i=getParamValue("k",e,t,n),o=getParamValue("sorted",e,t,n),a=Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Sd)(r,i,o);return[a.values,a.indices];default:throw TypeError("Node type "+e.op+" is not implemented")}},executeOp$7=function(e,t,n){switch(e.op){case"const":return t[e.name];case"placeholder":var r=getParamValue("default",e,t,n);return[getTensor(e.name,t,n)||r];case"identity":case"stopGradient":case"fakeQuantWithMinMaxVars":return[getParamValue("x",e,t,n)];case"snapshot":return[getParamValue("x",e,t,n).clone()];case"shape":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Hd)(getParamValue("x",e,t,n).shape,"int32")];case"shapeN":return getParamValue("x",e,t,n).map(function(e){return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Hd)(e.shape)});case"size":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.bd)(getParamValue("x",e,t,n).size,"int32")];case"rank":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.bd)(getParamValue("x",e,t,n).rank,"int32")];case"noop":return[];case"print":var i=getParamValue("x",e,t,n),o=getParamValue("data",e,t,n),a=getParamValue("message",e,t,n),s=getParamValue("summarize",e,t,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 "+e.op+" is not implemented")}},executeOp$8=function(e,t,n){switch(e.op){case"resizeBilinear":var r=getParamValue("images",e,t,n),i=getParamValue("size",e,t,n),o=getParamValue("alignCorners",e,t,n);return[_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Gb.resizeBilinear(r,[i[0],i[1]],o)];case"resizeNearestNeighbor":return r=getParamValue("images",e,t,n),i=getParamValue("size",e,t,n),o=getParamValue("alignCorners",e,t,n),[_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Gb.resizeNearestNeighbor(r,[i[0],i[1]],o)];default:throw TypeError("Node type "+e.op+" is not implemented")}},executeOp$9=function(e,t,n){switch(e.op){case"equal":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.mb)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];case"notEqual":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.vc)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];case"greater":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Bb)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];case"greaterEqual":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Cb)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];case"less":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Kb)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];case"lessEqual":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Lb)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];case"logicalAnd":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Vb)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];case"logicalNot":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Wb)(getParamValue("a",e,t,n))];case"logicalOr":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Xb)(getParamValue("a",e,t,n),getParamValue("b",e,t,n))];case"where":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.fe)(getParamValue("condition",e,t,n),getParamValue("a",e,t,n),getParamValue("b",e,t,n))];default:throw TypeError("Node type "+e.op+" is not implemented")}},executeOp$10=function(e,t,n){switch(e.op){case"matMul":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ac)(getParamValue("a",e,t,n),getParamValue("b",e,t,n),getParamValue("transposeA",e,t,n),getParamValue("transposeB",e,t,n))];case"transpose":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Ud)(getParamValue("x",e,t,n),getParamValue("perm",e,t,n))];default:throw TypeError("Node type "+e.op+" is not implemented")}},executeOp$11=function(e,t,n){switch(e.op){case"batchNormalization":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.G)(getParamValue("x",e,t,n),getParamValue("mean",e,t,n),getParamValue("variance",e,t,n),getParamValue("epsilon",e,t,n),getParamValue("scale",e,t,n),getParamValue("offset",e,t,n))];case"localResponseNormalization":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Qb)(getParamValue("x",e,t,n),getParamValue("radius",e,t,n),getParamValue("bias",e,t,n),getParamValue("alpha",e,t,n),getParamValue("beta",e,t,n))];case"softmax":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.pd)(getParamValue("x",e,t,n))];default:throw TypeError("Node type "+e.op+" is not implemented")}},executeOp$12=function(e,t,n){switch(e.op){case"max":var r=getParamValue("axis",e,t,n),i=getParamValue("keepDims",e,t,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.bc)(getParamValue("x",e,t,n),r,i)];case"mean":return r=getParamValue("axis",e,t,n),i=getParamValue("keepDims",e,t,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.fc)(getParamValue("x",e,t,n),r,i)];case"min":return r=getParamValue("axis",e,t,n),i=getParamValue("keepDims",e,t,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.hc)(getParamValue("x",e,t,n),r,i)];case"sum":return r=getParamValue("axis",e,t,n),i=getParamValue("keepDims",e,t,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Dd)(getParamValue("x",e,t,n),r,i)];case"all":return r=getParamValue("axis",e,t,n),i=getParamValue("keepDims",e,t,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.v)(getParamValue("x",e,t,n),r,i)];case"any":return r=getParamValue("axis",e,t,n),i=getParamValue("keepDims",e,t,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.w)(getParamValue("x",e,t,n),r,i)];case"argMax":return r=getParamValue("axis",e,t,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.x)(getParamValue("x",e,t,n),r)];case"argMin":return r=getParamValue("axis",e,t,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.y)(getParamValue("x",e,t,n),r)];default:throw TypeError("Node type "+e.op+" is not implemented")}},executeOp$13=function(e,t,n){switch(e.op){case"concat":var r=getParamValue("axis",e,t,n),i=getParamValue("tensors",e,t,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.R)(i,r)];case"gather":r=getParamValue("axis",e,t,n);var o=getParamValue("x",e,t,n),a=getParamValue("indices",e,t,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.xb)(o,a,r)];case"reverse":return r=getParamValue("axis",e,t,n),o=getParamValue("x",e,t,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Uc)(o,r)];case"slice":var s=getParamValue("begin",e,t,n),u=getParamValue("size",e,t,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.kd)(getParamValue("x",e,t,n),s,u)];case"stridedSlice":s=getParamValue("begin",e,t,n);var c=getParamValue("end",e,t,n),l=getParamValue("strides",e,t,n),h=getParamValue("beginMask",e,t,n),d=getParamValue("endMask",e,t,n),f=getParamValue("ellipsisMask",e,t,n),p=getParamValue("newAxisMask",e,t,n),m=getParamValue("shrinkAxisMask",e,t,n),g=getParamValue("x",e,t,n);if(1===s.length&&g.shape.length>1)for(var b=1;b<g.shape.length;b++)s.push(0),c.push(g.shape[b]),l.push(l[0]);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Ad)(g,s,c,l,h,d,f,p,m)];case"stack":return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Od)(function(){var r=getParamValue("axis",e,t,n),i=getParamValue("tensors",e,t,n),o=i[0].shape,a=i[0].squeeze().shape,s=i.map(function(e){var t=_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Yd.arraysEqual(e.shape,o);if(!t&&!_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Yd.arraysEqual(e.squeeze().shape,a))throw new Error("the input tensors shape does not match");return t?e:e.reshape(o)});return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.yd)(s,r)]});case"unstack":return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Od)(function(){var r=getParamValue("axis",e,t,n),i=getParamValue("tensor",e,t,n);return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Xd)(i,r)});case"tile":var y=getParamValue("reps",e,t,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Pd)(getParamValue("x",e,t,n),y)];case"split":r=getParamValue("axis",e,t,n);var v=getParamValue("numOrSizeSplits",e,t,n);return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.sd)(getParamValue("x",e,t,n),v,r);default:throw TypeError("Node type "+e.op+" is not implemented")}},executeOp$14=function(e,t,n){switch(e.op){case"cast":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.M)(getParamValue("x",e,t,n),getParamValue("dtype",e,t,n))];case"expandDims":var r=getParamValue("axis",e,t,n);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.qb)(getParamValue("x",e,t,n),r)];case"squeeze":return r=getParamValue("axis",e,t,n),[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.xd)(getParamValue("x",e,t,n),r)];case"reshape":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Tc)(getParamValue("x",e,t,n),getParamValue("shape",e,t,n))];case"pad":return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Cc)(getParamValue("x",e,t,n),split$1(getParamValue("padding",e,t,n),2),getParamValue("constantValue",e,t,n))];case"spaceToBatchND":var i=getParamValue("blockShape",e,t,n),o=split$1(getParamValue("paddings",e,t,n),2);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.rd)(getParamValue("x",e,t,n),i,o)];case"batchToSpaceND":i=getParamValue("blockShape",e,t,n);var a=split$1(getParamValue("crops",e,t,n),2);return[Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.K)(getParamValue("x",e,t,n),i,a)];default:throw TypeError("Node type "+e.op+" is not implemented")}};function executeOp$15(e,t,n){switch(e.category){case"arithmetic":return executeOp(e,t,n);case"basic_math":return executeOp$1(e,t,n);case"control":return executeOp$2(e,t,n);case"convolution":return executeOp$3(e,t,n);case"creation":return executeOp$4(e,t,n);case"dynamic":return executeOp$5(e,t,n);case"evaluation":return executeOp$6(e,t,n);case"image":return executeOp$8(e,t,n);case"graph":return executeOp$7(e,t,n);case"logical":return executeOp$9(e,t,n);case"matrices":return executeOp$10(e,t,n);case"normalization":return executeOp$11(e,t,n);case"reduction":return executeOp$12(e,t,n);case"slice_join":return executeOp$13(e,t,n);case"transformation":return executeOp$14(e,t,n);default:throw TypeError("Node type "+e.op+" is not implemented")}}var ExecutionContext=function(){function e(e,t){this.weightMap=e,this.tensorArrayMap=t,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}return e.prototype.newFrame=function(e,t){return{id:e,frameName:t,iterationId:0}},Object.defineProperty(e.prototype,"currentContext",{get:function(){return this.contexts},set:function(e){this.contexts!==e&&(this.contexts=e,this.generateCurrentContextIds())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentContextId",{get:function(){return this._currentContextIds[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentContextIds",{get:function(){return this._currentContextIds},enumerable:!0,configurable:!0}),e.prototype.generateCurrentContextIds=function(){for(var e=[],t=0;t<this.contexts.length-1;t++){var n=this.contexts.slice(0,this.contexts.length-t);e.push(this.contextIdforContexts(n))}e.push(""),this._currentContextIds=e},e.prototype.contextIdforContexts=function(e){return e?e.map(function(e){return 0===e.id&&0===e.iterationId?"":e.frameName+"-"+e.iterationId}).join("/"):""},e.prototype.enterFrame=function(e){this.contexts&&(this.lastId++,this.contexts=this.contexts.slice(),this.contexts.push(this.newFrame(this.lastId,e)),this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)))},e.prototype.exitFrame=function(){if(!(this.contexts&&this.contexts.length>1))throw new Error("Cannot exit frame, the context is empty");this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift()},e.prototype.nextIteration=function(){if(!(this.contexts&&this.contexts.length>0))throw new Error("Cannot increase frame iteration, the context is empty");this.contexts=this.contexts.slice(),this.lastId++;var e=Object.assign({},this.contexts[this.contexts.length-1]);e.iterationId+=1,e.id=this.lastId,this.contexts.splice(-1,1,e),this._currentContextIds.splice(0,1,this.contextIdforContexts(this.contexts))},e.prototype.getWeight=function(e){return this.weightMap[e]},e.prototype.addTensorArray=function(e){this.tensorArrayMap[e.id]=e},e.prototype.getTensorArray=function(e){return this.tensorArrayMap[e]},e}(),GraphExecutor=function(){function e(e){this.graph=e,this.compiledMap=new Map,this._weightMap={},this.SEPERATOR=",",this.placeholders=e.placeholders,this._outputs=e.outputs,this.compile()}return Object.defineProperty(e.prototype,"weightMap",{get:function(){return this._weightMap},set:function(e){var t=Object.keys(e).map(function(t){return e[t].map(function(e){return e.id})});this.weightIds=[].concat.apply([],t),this._weightMap=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputs",{get:function(){return this.placeholders.map(function(e){return{name:e.name,shape:e.params.shape?e.params.shape.value:void 0,dtype:e.params.dtype?e.params.dtype.value:void 0}})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputs",{get:function(){return this._outputs.map(function(e){return{name:e.name,shape:e.params.shape?e.params.shape.value:void 0,dtype:e.params.dtype?e.params.dtype.value:void 0}})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputNodes",{get:function(){return this.placeholders.map(function(e){return e.name})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputNodes",{get:function(){return this.outputs.map(function(e){return e.name})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isControlFlowModel",{get:function(){return this.graph.withControlFlow},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDynamicShapeModel",{get:function(){return this.graph.withDynamicShape},enumerable:!0,configurable:!0}),e.prototype.compile=function(e){if(!this.graph.withControlFlow&&!this.graph.withDynamicShape){var t=[],n=e||this.graph.placeholders,r=n.map(function(e){return e.name}).sort().join(this.SEPERATOR);if(!this.compiledMap.get(r)){for(var i=n.concat(this.graph.weights),o={};i.length>0;){var a=i.pop();o[a.name]=!0,t.push(a),a.children.forEach(function(e){!o[e.name]&&e.inputNames.every(function(e){var t=getNodeNameAndIndex(e)[0];return o[t]})&&i.push(e)})}this.compiledMap.set(r,t)}}},e.prototype.execute=function(e,t,n){var r=this;void 0===t&&(t=!0);var i=Object.keys(e).sort();this.checkInput(e,t),this.checkInputShapeAndType(e,t),this.compile(i.map(function(e){return r.graph.nodes[e]}));var o=this.calculateOutputs(n);this.checkOutput(this.compiledMap.get(i.join(this.SEPERATOR)),o);var a={};return Object(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Od)(function(){for(var t=new ExecutionContext(r._weightMap,a),n=__assign({},r.weightMap,e),s=r.compiledMap.get(i.join(r.SEPERATOR)),u=0;u<s.length;u++){var c=s[u];if(n[c.name]||(n[c.name]=executeOp$15(c,n,t)),o.every(function(e){return!!n[e]}))break}return r.findOutputs(n,t,o)})},e.prototype.executeAsync=function(e,t){return __awaiter(this,void 0,void 0,function(){var n,r,i,o,a,s,u,c=this;return __generator(this,function(l){switch(l.label){case 0:return this.checkInput(e,!1),this.checkInputShapeAndType(e,!1),n={},r=new ExecutionContext(this._weightMap,n),[4,this.executeWithControlFlow(e,r)];case 1:return i=l.sent(),o=this.findOutputs(i,r,t),a=Object.keys(o).map(function(e){return o[e].id}),s=Object.keys(e).map(function(t){return e[t].map(function(e){return e.id})}),u=[].concat.apply([],s),Object.keys(i).forEach(function(e){i[e].forEach(function(e){e&&-1===a.indexOf(e.id)&&-1===u.indexOf(e.id)&&-1===c.weightIds.indexOf(e.id)&&e.dispose()})}),[2,o]}})})},e.prototype.executeWithControlFlow=function(e,t){return __awaiter(this,void 0,void 0,function(){var n,r,i,o,a,s,u=this;return __generator(this,function(c){switch(c.label){case 0:n=Object.keys(e),r=n.map(function(e){return u.graph.nodes[e]}),i=r.concat(this.graph.weights).map(function(e){return{node:e,contexts:t.currentContext}}),o=__assign({},this.weightMap,e),a={},c.label=1;case 1:return i.length>0?(s=this.processStack(r,i,t,o,a),[4,Promise.all(s)]):[3,3];case 2:return c.sent(),[3,1];case 3:return[2,o]}})})},e.prototype.processStack=function(e,t,n,r,i){for(var o=this,a=[],s=function(){var s=t.pop();n.currentContext=s.contexts;var c="";if("enter"===s.node.op&&getParamValue("isConstant",s.node,r,n)&&(c=getNodeNameAndIndex(s.node.name,n)[0]),-1===e.indexOf(s.node)){var l=executeOp$15(s.node,r,n);c||(c=getNodeNameAndIndex(s.node.name,n)[0]);var h=n.currentContext;l instanceof Promise?a.push(l.then(function(e){return r[c]=e,n.currentContext=h,o.processChildNodes(s.node,t,n,r,i),e})):(r[c]=l,u.processChildNodes(s.node,t,n,r,i))}else u.processChildNodes(s.node,t,n,r,i)},u=this;t.length>0;)s();return a},e.prototype.processChildNodes=function(e,t,n,r,i){e.children.forEach(function(e){var o=getNodeNameAndIndex(e.name,n)[0];i[o]||("merge"===e.op?e.inputNames.some(function(e){return!!getTensor(e,r,n)})&&(i[o]=!0,t.push({contexts:n.currentContext,node:e})):e.inputNames.every(function(e){return!!getTensor(e,r,n)})&&(i[o]=!0,t.push({contexts:n.currentContext,node:e})))})},e.prototype.calculateOutputs=function(e){return!e||e instanceof Array||(e=[e]),e||this.graph.outputs.map(function(e){return e.name})},e.prototype.findOutputs=function(e,t,n){return this.calculateOutputs(n).reduce(function(n,r){return n[r]=getTensor(r,e,t),n},{})},e.prototype.dispose=function(){var e=this;Object.keys(this.weightMap).forEach(function(t){return e.weightMap[t].forEach(function(e){return e.dispose()})})},e.prototype.checkInputShapeAndType=function(e,t){void 0===t&&(t=!0),this.placeholders.forEach(function(n){var r=e[n.name];if(t||r){var i=r[0];if(n.params.shape&&n.params.shape.value){var o=n.params.shape.value,a=o.length===i.shape.length&&i.shape.every(function(e,t){return-1===o[t]||o[t]===e});_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Yd.assert(a,"The shape of dict['"+n.name+"'] provided in model.execute(dict) must be ["+o+"], but was ["+i.shape+"]")}n.params.dtype&&n.params.dtype.value&&_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Yd.assert(i.dtype===n.params.dtype.value,"The dtype of dict['"+n.name+"'] provided in model.execute(dict) must be "+n.params.dtype.value+", but was "+i.dtype)}})},e.prototype.checkInput=function(e,t){var n=this;void 0===t&&(t=!0);var r=Object.keys(e),i=[],o=[];this.inputNodes.forEach(function(e){-1===r.indexOf(e)&&i.push(e)}),r.forEach(function(e){-1===n.inputNodes.indexOf(e)&&o.push(e)});var a=o.filter(function(e){return!n.graph.nodes[e]});if(i.length>0&&t)throw new Error("The dict provided in model.execute(dict) has the keys ["+r+"], but is missing the required keys: ["+i+"].");if(o.length>0&&t)throw new Error("The dict provided in model.execute(dict) has unused keys: ["+o+"]. Please provide only the following keys: ["+this.inputNodes+"].");if(a.length>0)throw new Error("The dict provided in model.execute(dict) has keys: ["+a+"] not part of model graph.")},e.prototype.checkOutput=function(e,t){var n=e.map(function(e){return e.name}),r=[];if(t.forEach(function(e){-1===n.indexOf(e)&&r.push(e)}),r.length>0)throw new Error("The following outputs are not be generated by the execution: ["+r+"].")},e}(),FrozenModel=function(){function e(e,t,n){this.modelUrl=e,this.weightManifestUrl=t,this.requestOption=n,this.version="n/a"}return Object.defineProperty(e.prototype,"modelVersion",{get:function(){return this.version},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputNodes",{get:function(){return this.executor.inputNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputNodes",{get:function(){return this.executor.outputNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputs",{get:function(){return this.executor.inputs},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputs",{get:function(){return this.executor.outputs},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"weights",{get:function(){return this.executor.weightMap},enumerable:!0,configurable:!0}),e.prototype.findIOHandler=function(){var e=[this.modelUrl,this.weightManifestUrl];if(this.requestOption)this.handler=_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Hb.browserHTTPRequest(e,this.requestOption);else{var t=_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Hb.getLoadHandlers(e);if(0===t.length)t.push(_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Hb.browserHTTPRequest(e,this.requestOption));else if(t.length>1)throw new Error("Found more than one ("+t.length+") load handlers for URL '"+[e]+"'");this.handler=t[0]}},e.prototype.load=function(){return __awaiter(this,void 0,void 0,function(){var e,t,n;return __generator(this,function(r){switch(r.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=r.sent(),t=compiled_api_1.GraphDef.decode(new Uint8Array(e.modelTopology)),this.version=t.versions.producer+"."+t.versions.minConsumer,n=_tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.Hb.decodeWeights(e.weightData,e.weightSpecs),this.executor=new GraphExecutor(OperationMapper.Instance.transformGraph(t)),this.executor.weightMap=this.convertTensorMapToTensorsMap(n),[2,!0]}})})},e.prototype.predict=function(e,t){return this.execute_(e,!0,this.outputNodes)},e.prototype.constructTensorMap=function(e){var t=e instanceof _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.m?[e]:e;if(t.length!==this.inputNodes.length)throw new Error("Input tensor count mismatch,the frozen model has "+this.inputNodes.length+" placeholders, while there are "+t.length+" input tensors.");return this.inputNodes.reduce(function(e,n,r){return e[n]=t[r],e},{})},e.prototype.execute=function(e,t){return this.execute_(e,!1,t)},e.prototype.execute_=function(e,t,n){if(void 0===t&&(t=!0),n=n||this.outputNodes,(e instanceof _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.m||Array.isArray(e))&&(e=this.constructTensorMap(e)),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(e),t,n),i=Object.keys(r);return Array.isArray(n)&&n.length>1?n.map(function(e){return r[e]}):r[i[0]]},e.prototype.executeAsync=function(e,t){return __awaiter(this,void 0,void 0,function(){var n,r;return __generator(this,function(i){switch(i.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 t=t||this.outputNodes,(e instanceof _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.m||Array.isArray(e))&&(e=this.constructTensorMap(e)),[4,this.executor.executeAsync(this.convertTensorMapToTensorsMap(e),t)];case 1:return n=i.sent(),r=Object.keys(n),[2,Array.isArray(t)&&t.length>1?t.map(function(e){return n[e]}):n[r[0]]]}})})},e.prototype.convertTensorMapToTensorsMap=function(e){return Object.keys(e).reduce(function(t,n){return t[n]=[e[n]],t},{})},e.prototype.dispose=function(){this.executor.dispose()},e}();function loadFrozenModel(e,t,n){return __awaiter(this,void 0,void 0,function(){var r;return __generator(this,function(i){switch(i.label){case 0:return[4,(r=new FrozenModel(e,t,n)).load()];case 1:return i.sent(),[2,r]}})})}var version="0.6.0"}).call(this,__webpack_require__(11))},function(e,t,n){"use strict";n.d(t,"a",function(){return u});n(17);
/**
@license
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
let r=0,i=0,o=[],a=0,s=document.createTextNode("");new window.MutationObserver(function(){const e=o.length;for(let t=0;t<e;t++){let e=o[t];if(e)try{e()}catch(e){setTimeout(()=>{throw e})}}o.splice(0,e),i+=e}).observe(s,{characterData:!0});const u={run:e=>(s.textContent=a++,o.push(e),r++),cancel(e){const t=e-i;if(t>=0){if(!o[t])throw new Error("invalid async handle: "+e);o[t]=null}}}},function(e,t,n){"use strict";n.r(t);n(17);
/**
@license
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/function r(e,t,n){return{index:e,removed:t,addedCount:n}}const i=0,o=1,a=2,s=3;function u(e,t,n,u,l,h){let d,f=0,p=0,m=Math.min(n-t,h-l);if(0==t&&0==l&&(f=function(e,t,n){for(let r=0;r<n;r++)if(!c(e[r],t[r]))return r;return n}(e,u,m)),n==e.length&&h==u.length&&(p=function(e,t,n){let r=e.length,i=t.length,o=0;for(;o<n&&c(e[--r],t[--i]);)o++;return o}(e,u,m-f)),l+=f,h-=p,(n-=p)-(t+=f)==0&&h-l==0)return[];if(t==n){for(d=r(t,[],0);l<h;)d.removed.push(u[l++]);return[d]}if(l==h)return[r(t,[],n-t)];let g=function(e){let t=e.length-1,n=e[0].length-1,r=e[t][n],u=[];for(;t>0||n>0;){if(0==t){u.push(a),n--;continue}if(0==n){u.push(s),t--;continue}let c,l=e[t-1][n-1],h=e[t-1][n],d=e[t][n-1];(c=h<d?h<l?h:l:d<l?d:l)==l?(l==r?u.push(i):(u.push(o),r=l),t--,n--):c==h?(u.push(s),t--,r=h):(u.push(a),n--,r=d)}return u.reverse(),u}(function(e,t,n,r,i,o){let a=o-i+1,s=n-t+1,u=new Array(a);for(let e=0;e<a;e++)u[e]=new Array(s),u[e][0]=e;for(let e=0;e<s;e++)u[0][e]=e;for(let n=1;n<a;n++)for(let o=1;o<s;o++)if(c(e[t+o-1],r[i+n-1]))u[n][o]=u[n-1][o-1];else{let e=u[n-1][o]+1,t=u[n][o-1]+1;u[n][o]=e<t?e:t}return u}(e,t,n,u,l,h));d=void 0;let b=[],y=t,v=l;for(let e=0;e<g.length;e++)switch(g[e]){case i:d&&(b.push(d),d=void 0),y++,v++;break;case o:d||(d=r(y,[],0)),d.addedCount++,y++,d.removed.push(u[v]),v++;break;case a:d||(d=r(y,[],0)),d.addedCount++,y++;break;case s:d||(d=r(y,[],0)),d.removed.push(u[v]),v++}return d&&b.push(d),b}function c(e,t){return e===t}var l=n(35);
/**
@license
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
function h(e){return"slot"===e.localName}n.d(t,"FlattenedNodesObserver",function(){return d});class d{static getFlattenedNodes(e){return h(e)?(e=e).assignedNodes({flatten:!0}):Array.from(e.childNodes).map(e=>h(e)?(e=e).assignedNodes({flatten:!0}):[e]).reduce((e,t)=>e.concat(t),[])}constructor(e,t){this._shadyChildrenObserver=null,this._nativeChildrenObserver=null,this._connected=!1,this._target=e,this.callback=t,this._effectiveNodes=[],this._observer=null,this._scheduled=!1,this._boundSchedule=(()=>{this._schedule()}),this.connect(),this._schedule()}connect(){h(this._target)?this._listenSlots([this._target]):this._target.children&&(this._listenSlots(this._target.children),window.ShadyDOM?this._shadyChildrenObserver=ShadyDOM.observeChildren(this._target,e=>{this._processMutations(e)}):(this._nativeChildrenObserver=new MutationObserver(e=>{this._processMutations(e)}),this._nativeChildrenObserver.observe(this._target,{childList:!0}))),this._connected=!0}disconnect(){h(this._target)?this._unlistenSlots([this._target]):this._target.children&&(this._unlistenSlots(this._target.children),window.ShadyDOM&&this._shadyChildrenObserver?(ShadyDOM.unobserveChildren(this._shadyChildrenObserver),this._shadyChildrenObserver=null):this._nativeChildrenObserver&&(this._nativeChildrenObserver.disconnect(),this._nativeChildrenObserver=null)),this._connected=!1}_schedule(){this._scheduled||(this._scheduled=!0,l.a.run(()=>this.flush()))}_processMutations(e){this._processSlotMutations(e),this.flush()}_processSlotMutations(e){if(e)for(let t=0;t<e.length;t++){let n=e[t];n.addedNodes&&this._listenSlots(n.addedNodes),n.removedNodes&&this._unlistenSlots(n.removedNodes)}}flush(){if(!this._connected)return!1;window.ShadyDOM&&ShadyDOM.flush(),this._nativeChildrenObserver?this._processSlotMutations(this._nativeChildrenObserver.takeRecords()):this._shadyChildrenObserver&&this._processSlotMutations(this._shadyChildrenObserver.takeRecords()),this._scheduled=!1;let e={target:this._target,addedNodes:[],removedNodes:[]},t=this.constructor.getFlattenedNodes(this._target),n=function(e,t){return u(e,0,e.length,t,0,t.length)}(t,this._effectiveNodes);for(let t,r=0;r<n.length&&(t=n[r]);r++)for(let n,r=0;r<t.removed.length&&(n=t.removed[r]);r++)e.removedNodes.push(n);for(let r,i=0;i<n.length&&(r=n[i]);i++)for(let n=r.index;n<r.index+r.addedCount;n++)e.addedNodes.push(t[n]);this._effectiveNodes=t;let r=!1;return(e.addedNodes.length||e.removedNodes.length)&&(r=!0,this.callback.call(this._target,e)),r}_listenSlots(e){for(let t=0;t<e.length;t++){let n=e[t];h(n)&&n.addEventListener("slotchange",this._boundSchedule)}}_unlistenSlots(e){for(let t=0;t<e.length;t++){let n=e[t];h(n)&&n.removeEventListener("slotchange",this._boundSchedule)}}}},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),o=n(6),{FlattenedNodesObserver:a}=n(36),s=n(3);class u extends i.LitElement{constructor(){super(),this.slides=[],this.closeButton="Start Playing",this.caption="",this.video="",this.alt="",this.transition=!1}get nextSlide(){let e=this.slides.indexOf(this.currentSlide);return++e}get prevSlide(){let e=this.slides.indexOf(this.currentSlide);return--e}set currentSlideId(e){const t=this.slides[e];this.transition=!0,this.currentSlide=t,this.caption="",this.alt="",setTimeout(()=>{this.transition=!1,this.alt=t.alt,this.caption=t.caption,this.video=t.video},250)}get currentSlideId(){return this.slides.indexOf(this.currentSlide)}_clickHandler(e){e.preventDefault()}_navigate(e){const t=e.target;this.currentSlideId=t.getAttribute("data-slide"),e.preventDefault()}connectedCallback(){super.connectedCallback(),this.__nodesObserver=new a(this,this._handleNodesObserverUpdate)}_handleNodesObserverUpdate(e){e.addedNodes.forEach(e=>{"ACC-SLIDE"===e.tagName&&this.slides.push({image:e.image,video:e.video,caption:e.caption,alt:e.alt})}),this.currentSlide=this.slides[0],this.currentSlideId=0,this.requestRender()}_nextSlide(){this.dispatchEvent(new CustomEvent("next-slide",{bubbles:!0,composed:!0})),this.currentSlideId=this.nextSlide}_previousSlide(){this.dispatchEvent(new CustomEvent("previous-slide",{bubbles:!0,composed:!0})),this.currentSlideId=this.prevSlide}_render(){return i.html`
            <style>
                
                .slideshow-container {
                    font-family: ${o.bodyFontFamily};
                    background-color: var(--background-color);
                    display: block;
                }
                
                .slides {
                    position: relative;
                    height: 400px;
                    transition: opacity 0.25s ease-out;
                    opacity : 1;
                    display: block;
                }

                button[disabled]{
                    opacity: 0.25;
                    pointer-events: none;
                }
                
                img, video {
                    width: 100%;
                    height: 300px;
                    margin-bottom: 40px;
                }
                
                p {
                    text-align: center;
                    font-size: 18px;
                    color: ${o.labelColor};
                    max-width: 70%;
                    margin: 0px auto;
                }
                
                ul {
                    display: flex;
                    justify-content: center;
                    padding: 0;
                    margin: 0;
                    list-style: none;
                    width: 100%;
                    margin-top: 30px;
                    height: 30px;
                }
                
                li {
                    margin: 5px;
                    padding: 0;
                }
                
                li button {
                    border: none;
                    display: block;
                    width: 0;
                    height: 0;
                    padding: 5px;
                    border-radius: 100%;
                    background: ${o.outlineBorderColor};
                    cursor: pointer;
                }
                
                li button.current {
                    background: ${o.accentColor};
                }
                
                .nav-arrow {
                    position: absolute;
                    top: 350px;
                    margin: 0px;
                    background: transparent;
                    border: none;
                    z-index: 2;
                }
                
                .nav-arrow-previous {
                    left: 0px;
                }
                
                .nav-arrow-next {
                    right: 0px;
                }

                #slideshow-start-button{
                    width: 150px;
                    border: none;
                    color: ${o.accentColor};
                    font-size: 18px;
                    font-family: ${o.bodyFontFamily};
                    cursor: pointer;
                    display: block;
                    position: relative;
                    margin: 40px auto 10px;
                    background-color: transparent;
                }

                #alt-text, #live-caption{
                    height: 0px;
                    position: absolute;
                    overflow: hidden;
                }

            </style>
            <div aria-label$="Carousel. ${this.slides.length.toString()} Slides" class="slideshow-container">                

                <button
                    class="nav-arrow nav-arrow-previous"
                    aria-label="Previous slide"
                    disabled?=${this.prevSlide<0}
                    on-click="${this._previousSlide.bind(this)}">
                    <acc-icon icon="previous"></acc-icon>
                </button>

                <div class="slides" style="opacity:${this.transition?"0":"1"}" aria-label="Slide Content">
                    <img id="alt-text" alt$="${this.alt}"" src="">
                    <video aria-hidden="true" src$="${this.video}" playsinline muted autoplay></video>
                    <p id="caption" 
                        aria-live="polite" 
                        aria-atomic="true" 
                        aria-relevant="text">${this.caption}</p>
                </div>
                                
                <button
                    class="nav-arrow nav-arrow-next"
                    aria-label="Next slide"
                    disabled?=${this.nextSlide>this.slides.length-1}
                    on-click="${this._nextSlide.bind(this)}">
                    <acc-icon icon="next"></acc-icon>
                </button>

                <ul>
                    ${this.slides&&this.slides.map((e,t)=>i.html`
                        <li>
                            <button
                                on-click="${e=>this._navigate(e)}"
                                data-slide$="${t}"
                                class$="${this.currentSlideId===t?"current":""}"
                                aria-label$="Jump to slide ${(t+1).toString()}"></button>
                        </li>
                    `)}
                </ul>
                    

                 <button 
                    id="slideshow-start-button"
                    on-click="${()=>this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}">
                    ${this.closeButton}
                </button>

            </div>
           
        `}}r([s.property({type:String})],u.prototype,"closeButton",void 0),r([s.property({type:String})],u.prototype,"caption",void 0),r([s.property({type:String})],u.prototype,"video",void 0),r([s.property({type:String})],u.prototype,"alt",void 0),r([s.property({type:Boolean})],u.prototype,"transition",void 0),t.SlideshowElement=u,customElements.define("acc-slideshow",u)},function(e,t,n){var r=t;r.utils=n(13),r.common=n(23),r.sha=n(141),r.ripemd=n(137),r.hmac=n(136),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(e,t,n){(function(t){var r=n(7),i=n(19);function o(e,n){var i=function(e){var t=a(e);return{blinder:t.toRed(r.mont(e.modulus)).redPow(new r(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}(n),o=n.modulus.byteLength(),s=(r.mont(n.modulus),new r(e).mul(i.blinder).umod(n.modulus)),u=s.toRed(r.mont(n.prime1)),c=s.toRed(r.mont(n.prime2)),l=n.coefficient,h=n.prime1,d=n.prime2,f=u.redPow(n.exponent1),p=c.redPow(n.exponent2);f=f.fromRed(),p=p.fromRed();var m=f.isub(p).imul(l).umod(h);return m.imul(d),p.iadd(m),new t(p.imul(i.unblinder).umod(n.modulus).toArray(!1,o))}function a(e){for(var t=e.modulus.byteLength(),n=new r(i(t));n.cmp(e.modulus)>=0||!n.umod(e.prime1)||!n.umod(e.prime2);)n=new r(i(t));return n}e.exports=o,o.getr=a}).call(this,n(5).Buffer)},function(e,t,n){var r={ECB:n(165),CBC:n(164),CFB:n(163),CFB8:n(162),CFB1:n(161),OFB:n(160),CTR:n(77),GCM:n(77)},i=n(75);for(var o in i)i[o].module=r[i[o].mode];e.exports=i},function(e,t,n){var r=n(166),i=n(158),o=n(75);t.createCipher=t.Cipher=r.createCipher,t.createCipheriv=t.Cipheriv=r.createCipheriv,t.createDecipher=t.Decipher=i.createDecipher,t.createDecipheriv=t.Decipheriv=i.createDecipheriv,t.listCiphers=t.getCiphers=function(){return Object.keys(o)}},function(e,t,n){"use strict";t.utils=n(171),t.Cipher=n(170),t.DES=n(169),t.CBC=n(168),t.EDE=n(167)},function(e,t,n){(t=e.exports=function(e){e=e.toLowerCase();var n=t[e];if(!n)throw new Error(e+" is not supported (we accept pull requests)");return new n}).sha=n(180),t.sha1=n(179),t.sha224=n(178),t.sha256=n(86),t.sha384=n(177),t.sha512=n(85)},function(e,t,n){"use strict";var r=n(5).Buffer,i=n(2),o=n(91),a=new Array(16),s=[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],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],c=[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],l=[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],h=[0,1518500249,1859775393,2400959708,2840853838],d=[1352829926,1548603684,1836072691,2053994217,0];function f(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(e,t){return e<<t|e>>>32-t}function m(e,t,n,r,i,o,a,s){return p(e+(t^n^r)+o+a|0,s)+i|0}function g(e,t,n,r,i,o,a,s){return p(e+(t&n|~t&r)+o+a|0,s)+i|0}function b(e,t,n,r,i,o,a,s){return p(e+((t|~n)^r)+o+a|0,s)+i|0}function y(e,t,n,r,i,o,a,s){return p(e+(t&r|n&~r)+o+a|0,s)+i|0}function v(e,t,n,r,i,o,a,s){return p(e+(t^(n|~r))+o+a|0,s)+i|0}i(f,o),f.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,f=0|this._e,_=0|this._a,w=0|this._b,x=0|this._c,E=0|this._d,S=0|this._e,C=0;C<80;C+=1){var O,A;C<16?(O=m(n,r,i,o,f,e[s[C]],h[0],c[C]),A=v(_,w,x,E,S,e[u[C]],d[0],l[C])):C<32?(O=g(n,r,i,o,f,e[s[C]],h[1],c[C]),A=y(_,w,x,E,S,e[u[C]],d[1],l[C])):C<48?(O=b(n,r,i,o,f,e[s[C]],h[2],c[C]),A=b(_,w,x,E,S,e[u[C]],d[2],l[C])):C<64?(O=y(n,r,i,o,f,e[s[C]],h[3],c[C]),A=g(_,w,x,E,S,e[u[C]],d[3],l[C])):(O=v(n,r,i,o,f,e[s[C]],h[4],c[C]),A=m(_,w,x,E,S,e[u[C]],d[4],l[C])),n=f,f=o,o=p(i,10),i=r,r=O,_=S,S=E,E=p(x,10),x=w,w=A}var M=this._b+i+E|0;this._b=this._c+o+S|0,this._c=this._d+f+_|0,this._d=this._e+n+w|0,this._e=this._a+r+x|0,this._a=M},f.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(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 e=r.alloc?r.alloc(20):new r(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=f},function(e,t,n){"use strict";var r=n(4).Buffer,i=r.isEncoding||function(e){switch((e=""+e)&&e.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(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=l,this.end=h,t=3;break;default:return this.write=d,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"ï¿½";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"ï¿½";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"ï¿½"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function l(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function d(e){return e.toString(this.encoding)}function f(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"ï¿½":t},o.prototype.text=function(e,t){var n=function(e,t,n){var r=t.length-1;if(r<n)return 0;var i=a(t[r]);if(i>=0)return i>0&&(e.lastNeed=i-1),i;if(--r<n||-2===i)return 0;if((i=a(t[r]))>=0)return i>0&&(e.lastNeed=i-2),i;if(--r<n||-2===i)return 0;if((i=a(t[r]))>=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";(function(t,r,i){var o=n(32);function a(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=y;var s,u=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?r:o.nextTick;y.WritableState=b;var c=n(25);c.inherits=n(2);var l={deprecate:n(186)},h=n(89),d=n(4).Buffer,f=i.Uint8Array||function(){};var p,m=n(88);function g(){}function b(e,t){s=s||n(16),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,c=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(c||0===c)?c:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===e.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(o.nextTick(i,r),o.nextTick(S,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(i(r),e._writableState.errorEmitted=!0,e.emit("error",r),S(e,t))}(e,n,r,t,i);else{var a=x(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||w(e,n),r?u(_,e,n,a,i):_(e,n,a,i)}}(t,e)},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 a(this)}function y(e){if(s=s||n(16),!(p.call(y,this)||this instanceof s))return new y(e);this._writableState=new b(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function v(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function _(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),S(e,t)}function w(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),o=t.corkedRequestsFree;o.entry=n;for(var s=0,u=!0;n;)i[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;i.allBuffers=u,v(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new a(t),t.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,h=n.callback;if(v(e,t,!1,t.objectMode?1:c.length,c,l,h),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function x(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function E(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),S(e,t)})}function S(e,t){var n=x(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,o.nextTick(E,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}c.inherits(y,h),b.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(b.prototype,"buffer",{get:l.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(e){return!!p.call(this,e)||this===y&&(e&&e._writableState instanceof b)}})):p=function(e){return e instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(e,t,n){var r=this._writableState,i=!1,a=!r.objectMode&&function(e){return d.isBuffer(e)||e instanceof f}(e);return a&&!d.isBuffer(e)&&(e=function(e){return d.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=g),r.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),o.nextTick(t,n)}(this,n):(a||function(e,t,n,r){var i=!0,a=!1;return null===n?a=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),o.nextTick(r,a),i=!1),i}(this,r,e,n))&&(r.pendingcb++,i=function(e,t,n,r,i,o){if(!n){var a=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=d.from(t,n));return t}(t,r,i);r!==a&&(n=!0,i="buffer",r=a)}var s=t.objectMode?1:r.length;t.length+=s;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else v(e,t,!1,s,r,i,o);return u}(this,r,a,e,t,n)),i},y.prototype.cork=function(){this._writableState.corked++},y.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||w(this,e))},y.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,S(e,t),n&&(t.finished?o.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),y.prototype.destroy=m.destroy,y.prototype._undestroy=m.undestroy,y.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(12),n(93).setImmediate,n(11))},function(e,t,n){(t=e.exports=n(90)).Stream=t,t.Readable=t,t.Writable=n(46),t.Duplex=n(16),t.Transform=n(87),t.PassThrough=n(185)},function(e,t,n){e.exports=i;var r=n(33).EventEmitter;function i(){r.call(this)}n(2)(i,r),i.Readable=n(47),i.Writable=n(184),i.Duplex=n(183),i.Transform=n(182),i.PassThrough=n(181),i.Stream=i,i.prototype.pipe=function(e,t){var n=this;function i(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(n.on("end",s),n.on("close",u));var a=!1;function s(){a||(a=!0,e.end())}function u(){a||(a=!0,"function"==typeof e.destroy&&e.destroy())}function c(e){if(l(),0===r.listenerCount(this,"error"))throw e}function l(){n.removeListener("data",i),e.removeListener("drain",o),n.removeListener("end",s),n.removeListener("close",u),n.removeListener("error",c),e.removeListener("error",c),n.removeListener("end",l),n.removeListener("close",l),e.removeListener("close",l)}return n.on("error",c),e.on("error",c),n.on("end",l),n.on("close",l),e.on("close",l),e.emit("pipe",n),e}},function(e,t,n){"use strict";(function(t){var r=n(2),i=n(91),o=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function s(e,t){return e<<t|e>>>32-t}function u(e,t,n,r,i,o,a){return s(e+(t&n|~t&r)+i+o|0,a)+t|0}function c(e,t,n,r,i,o,a){return s(e+(t&r|n&~r)+i+o|0,a)+t|0}function l(e,t,n,r,i,o,a){return s(e+(t^n^r)+i+o|0,a)+t|0}function h(e,t,n,r,i,o,a){return s(e+(n^(t|~r))+i+o|0,a)+t|0}r(a,i),a.prototype._update=function(){for(var e=o,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,r=this._b,i=this._c,a=this._d;r=h(r=h(r=h(r=h(r=l(r=l(r=l(r=l(r=c(r=c(r=c(r=c(r=u(r=u(r=u(r=u(r,i=u(i,a=u(a,n=u(n,r,i,a,e[0],3614090360,7),r,i,e[1],3905402710,12),n,r,e[2],606105819,17),a,n,e[3],3250441966,22),i=u(i,a=u(a,n=u(n,r,i,a,e[4],4118548399,7),r,i,e[5],1200080426,12),n,r,e[6],2821735955,17),a,n,e[7],4249261313,22),i=u(i,a=u(a,n=u(n,r,i,a,e[8],1770035416,7),r,i,e[9],2336552879,12),n,r,e[10],4294925233,17),a,n,e[11],2304563134,22),i=u(i,a=u(a,n=u(n,r,i,a,e[12],1804603682,7),r,i,e[13],4254626195,12),n,r,e[14],2792965006,17),a,n,e[15],1236535329,22),i=c(i,a=c(a,n=c(n,r,i,a,e[1],4129170786,5),r,i,e[6],3225465664,9),n,r,e[11],643717713,14),a,n,e[0],3921069994,20),i=c(i,a=c(a,n=c(n,r,i,a,e[5],3593408605,5),r,i,e[10],38016083,9),n,r,e[15],3634488961,14),a,n,e[4],3889429448,20),i=c(i,a=c(a,n=c(n,r,i,a,e[9],568446438,5),r,i,e[14],3275163606,9),n,r,e[3],4107603335,14),a,n,e[8],1163531501,20),i=c(i,a=c(a,n=c(n,r,i,a,e[13],2850285829,5),r,i,e[2],4243563512,9),n,r,e[7],1735328473,14),a,n,e[12],2368359562,20),i=l(i,a=l(a,n=l(n,r,i,a,e[5],4294588738,4),r,i,e[8],2272392833,11),n,r,e[11],1839030562,16),a,n,e[14],4259657740,23),i=l(i,a=l(a,n=l(n,r,i,a,e[1],2763975236,4),r,i,e[4],1272893353,11),n,r,e[7],4139469664,16),a,n,e[10],3200236656,23),i=l(i,a=l(a,n=l(n,r,i,a,e[13],681279174,4),r,i,e[0],3936430074,11),n,r,e[3],3572445317,16),a,n,e[6],76029189,23),i=l(i,a=l(a,n=l(n,r,i,a,e[9],3654602809,4),r,i,e[12],3873151461,11),n,r,e[15],530742520,16),a,n,e[2],3299628645,23),i=h(i,a=h(a,n=h(n,r,i,a,e[0],4096336452,6),r,i,e[7],1126891415,10),n,r,e[14],2878612391,15),a,n,e[5],4237533241,21),i=h(i,a=h(a,n=h(n,r,i,a,e[12],1700485571,6),r,i,e[3],2399980690,10),n,r,e[10],4293915773,15),a,n,e[1],2240044497,21),i=h(i,a=h(a,n=h(n,r,i,a,e[8],1873313359,6),r,i,e[15],4264355552,10),n,r,e[6],2734768916,15),a,n,e[13],1309151649,21),i=h(i,a=h(a,n=h(n,r,i,a,e[4],4149444226,6),r,i,e[11],3174756917,10),n,r,e[2],718787259,15),a,n,e[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+a|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(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 e=new t(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=a}).call(this,n(5).Buffer)},function(e,t,n){var r,i=n(33).EventEmitter,o=n(2),a=n(200),s={requestAnimationFrame:a,cancelAnimationFrame:a.cancel};function u(){return!0}function c(e){e=e||{},this.__delay=e.delay||0,this.fixedDelta=!!e.fixedDelta,this.frameCount=0,this.deltaTime=0,this.elapsedTime=0,this.__running=!1,this.__completed=!1,this.setFPS(e.fps||1/0),this.setRequestAnimationFrameObject(e.requestAnimationFrameObject||s)}function l(e){var n,r=Date.now();if(e.__running)return e;t.running+=1,e.__running=!0,e.__lastTime=r,e.deltaTime=0,e.emit("start",e.deltaTime,0,e.frameCount);var i=e.requestAnimationFrameObject,o=function(){if(i!==e.requestAnimationFrameObject)return i=e.requestAnimationFrameObject,void e.requestAnimationFrameObject.requestAnimationFrame(o);e.__isReadyForUpdate()&&e.update(),e.__running?n=e.requestAnimationFrameObject.requestAnimationFrame(o):e.requestAnimationFrameObject.cancelAnimationFrame(n)};return e.requestAnimationFrameObject.requestAnimationFrame(o),e}for(var h in o(c,i),r={off:i.prototype.removeListener,trigger:i.prototype.emit,complete:function(){return this.stop(),this.__completed=!0,this.emit("complete",this.frameCount,this.deltaTime),this},dispose:function(){return this.stop(),this.removeAllListeners(),this},getDeltaTime:function(){return this.deltaTime},getElapsedTime:function(){return this.elapsedTime},getFPS:function(){return this.deltaTime>0?1e3/this.deltaTime:0},getFPSLimit:function(){return this.__fps},getFrameCount:function(){return this.frameCount},getRequestAnimationFrameObject:function(){return this.requestAnimationFrameObject},isRunning:function(){return this.__running},isCompleted:function(){return this.__completed},reset:function(){return this.stop(),this.__completed=!1,this.__lastTime=0,this.deltaTime=0,this.elapsedTime=0,this.frameCount=0,this.emit("reset",0,0,this.frameCount),this},setFPS:function(e){return this.__fps=e,this.__isReadyForUpdate=function(e){var t=1e3/e,n=Date.now();if(e<=0||e===1/0)return u;var r=Math.ceil(1e3/60)/2;return function(){var e=Date.now();return!(e-n<t-r||(n=e,0))}}(e),this},setRequestAnimationFrameObject:function(e){if("function"!=typeof e.requestAnimationFrame||"function"!=typeof e.cancelAnimationFrame)throw new Error("Invalid object provide to `setRequestAnimationFrameObject`");return this.requestAnimationFrameObject=e,this},start:function(){var e=this;return this.__delay?setTimeout(function(){l(e)},this.__delay):l(this),this},stop:function(){return this.__running&&(this.__running=!1,t.running-=1,this.emit("stop",this.deltaTime,this.elapsedTime,this.frameCount)),this},update:function(){this.frameCount++;var e=Date.now();return this.__lastTime=this.__lastTime||e,this.deltaTime=this.fixedDelta||t.globalFixedDelta?1e3/Math.min(60,this.__fps):e-this.__lastTime,this.elapsedTime+=this.deltaTime,this.__lastTime=e,this.emit("update",this.deltaTime,this.elapsedTime,this.frameCount),this}})c.prototype[h]=r[h];function d(e,t){1===arguments.length&&"function"==typeof e&&(t=e,e={});var n=new c(e);return t&&n.on("update",t),n}function f(e,t){return"function"==typeof e.bind?e.bind(t):function(){return e.apply(t,arguments)}}e.exports=t=d,t.bound=function(e,t){for(var n,r=d(e,t),i=function(e){for(var t=Object.keys(e),n=[],r=0;r<t.length;r++)"function"==typeof e[t[r]]&&n.push(t[r]);return n}(c.prototype),o=!!Function.prototype.bind,a=0;a<i.length;a++)r[n=i[a]]=o?r[n].bind(r):f(r[n],r);return r},t.Animitter=c,t.globalFixedDelta=!1,t.EventEmitter=i,t.running=0,Date.now=Date.now||function(){return(new Date).getTime()}},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(52),o=n(8),a=n(1),s=n(3);class u extends CustomEvent{constructor(e,t){super(e,t)}}u.CHANGE="change",u.INITIALIZING="initializing",u.READY="ready",u.TICK="tick",u.INPUT="input",u.STOP="stop",t.ACCInputEvent=u;class c extends CustomEvent{constructor(e){super(c.ERROR,{detail:{message:e.message}})}}c.ERROR="error",t.ACCErrorEvent=c,t.isAbstractInputElement=(e=>["selected","initialized","controls"].every(t=>void 0!==e[t]));class l extends a.LitElement{constructor(){super(),this.controls=!1,this.smoothing=0,this.selected=!1,this.contentSelector="",this.disableClamp=!1,this.hasControls=!1,this.targetPosition=[0,0],this._lastFoundTargetPosition=[0,0],this.position=[-1,-1],this._lastFoundPosition=[-1,-1],this.__isInitializing=!1,this.__isReady=!1,this.__hasTickedSinceReady=!1,this._wasAborted=!1,["_dispatchInitializing","_dispatchReady","_dispatchStop","_dispatchTick"].forEach(e=>this[e]=this[e].bind(this))}get isInitializing(){return this.__isInitializing}get isReady(){return this.__isReady}set contentElement(e){const t=this.__contentEl!==e,n=this.__contentEl;this.__contentEl=e,t&&this._contentElementChanged(e,n)}get contentElement(){return!this.__contentEl&&this.contentSelector&&(this.contentElement=document.querySelector(this.contentSelector)),this.__contentEl}_createEvent(e,t=!0,n=!0){const r={detail:{inputType:this.inputType,target:this,position:this.position},bubbles:t,composed:n};return new u(e,r)}_stepTowardsTarget(){const e=this.position,t=this._lastFoundPosition,n=this.targetPosition,r=this._lastFoundTargetPosition,{smoothing:a}=this;if(i.equal(e,t))return!1;if(0===a||!this.__hasTickedSinceReady||i.distance(e,t)<1e-5)i.copy(t,e),i.copy(r,n);else{const s=o.scalemap(a,0,1,.95,0);this.position=i.add(e,i.scale(i.sub(t,e),s)),this.targetPosition=i.add(n,i.scale(i.sub(r,n),s))}return!0}_shouldDispatchInput(){return this._stepTowardsTarget()}get canInitialize(){return!this._wasAborted&&!this.__isInitializing}dispatchEvent(e){return super.dispatchEvent(e)}_dispatchChange(){this.dispatchEvent(this._createEvent(u.CHANGE))}_dispatchInitializing(){this.__isInitializing=!0,this.dispatchEvent(this._createEvent(u.INITIALIZING))}_dispatchReady(){this.__isInitializing=!1,this.__isReady=!0,this.__hasTickedSinceReady=!1,this.dispatchEvent(this._createEvent(u.READY))}_dispatchTick(){this._shouldDispatchInput()&&this.__dispatchInput(),this.dispatchEvent(this._createEvent("tick")),this.__hasTickedSinceReady=!0}_dispatchError(e){super.dispatchEvent(new CustomEvent("error",{detail:{message:e.message,name:e.name,stack:e.stack},bubbles:!0,composed:!0}))}_dispatchStop(){this.__isInitializing&&(this._wasAborted=!0),this.__isInitializing=!1,this.__isReady=!1,this.dispatchEvent(this._createEvent("stop"))}__dispatchInput(){this.dispatchEvent(this._createEvent("input"))}_propertiesChanged(e,t,n){if(super._propertiesChanged(e,t,n),t&&n){if(t.contentSelector&&(this.contentElement=null,this.contentElement,"complete"!==document.readyState)){const e=()=>{this.contentElement,(this.contentElement||"complete"===document.readyState)&&document.removeEventListener("readystatechange",e)};document.addEventListener("readystatechange",e)}t.controls&&!n.controls?(this.setAttribute("controls","true"),this.dispatchEvent(this._createEvent("controlsopen"))):!t.controls&&n.controls&&(this.removeAttribute("controls"),this.dispatchEvent(this._createEvent("controlsclose"))),!t.selected&&n.selected?this.stop():t.selected&&!n.selected&&this.initialize()}}_contentElementChanged(e,t){}_render(e){return a.html``}setTargetPosition([e,t]){this._lastFoundTargetPosition[0]=e,this._lastFoundTargetPosition[1]=t;const n=this.contentElement.getBoundingClientRect(),r=o.scalemap(e,0,n.width,-1,1),i=o.scalemap(t,0,n.height,-1,1);this._lastFoundPosition[0]=r,this._lastFoundPosition[1]=i,this._dispatchTick()}setPosition([e,t]){this._lastFoundPosition[0]=e,this._lastFoundPosition[1]=t;const n=this.contentElement.getBoundingClientRect(),r=o.scalemap(e,-1,1,0,n.width),i=o.scalemap(t,-1,1,0,n.height);this._lastFoundTargetPosition[0]=r,this._lastFoundTargetPosition[1]=i,this._dispatchTick()}_shouldPropertyChange(e,t,n){if("smoothing"===e){if(t<0||t>1)return!1}return super._shouldPropertyChange(e,t,n)}}r([s.property({type:Boolean})],l.prototype,"controls",void 0),r([s.property({type:Number})],l.prototype,"smoothing",void 0),r([s.property({type:Boolean})],l.prototype,"selected",void 0),r([s.property({type:String})],l.prototype,"contentSelector",void 0),r([s.property({type:Boolean})],l.prototype,"disableClamp",void 0),t.AbstractInputElement=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(8),i=e=>e,o=e=>e*e;t.add=((e,t,n)=>r.fastMap(e,(e,n)=>e+t[n],n)),t.angleBetween=((e,t)=>Math.atan2(t[1]-e[1],t[0]-e[0])),t.copy=((e,t=[NaN,NaN])=>r.fastMap(e,i,t)),t.distance=((e,t)=>Math.sqrt(o(t[0]-e[0])+o(t[1]-e[1]))),t.equal=((e,t)=>e[0]===t[0]&&e[1]===t[1]),t.lerp=function(e,t,n,r=[NaN,NaN]){return r[0]=(t[0]-e[0])*n+e[0],r[1]=(t[1]-e[1])*n+e[1],r},t.magnitude=(([e,t])=>e*e+t*t),t.normalize=((e,n=[NaN,NaN])=>{let r=t.magnitude(e);const[i,o]=e;return r>0&&(r=1/Math.sqrt(r),n[0]=i*r,n[1]=o*r),n}),t.scale=((e,t,n)=>r.fastMap(e,(e,n)=>e*((e=>Array.isArray(e)&&2===e.length&&"number"==typeof e[0])(t)?t[n]:t),n)),t.sub=((e,t,n)=>r.fastMap(e,(e,n)=>e-t[n],n)),t.toCartesian=function([e,t],n=[NaN,NaN]){return n[0]=e*Math.cos(t),n[1]=e*Math.sin(t),n},t.toPolar=function([e,t],n=[NaN,NaN]){return n[0]=Math.sqrt(e*e+t*t),n[1]=Math.atan2(t,e),n}},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(20),o=n(1),a=n(6),s=n(3),u=n(27),c=n(8);class l extends o.LitElement{constructor(){super(...arguments),this.shortcut="",this.label="",this.disabled=!1,this.hideLabel=!1}connectedCallback(){super.connectedCallback(),this.__shortcutObserver=new i.KeyboardShortcutObserver(this.shortcut,this._handleShortcut,"focus group")}disconnectedCallback(){this.__shortcutObserver.disconnect(),super.disconnectedCallback()}_propertiesChanged(e,t,n){if(t)return t.hasOwnProperty("disabled")&&(c.setBooleanAttribute(this,"disabled",this.disabled),this.setAttribute("aria-hidden",e.disabled)),t.hasOwnProperty("shortcut")&&this.__shortcutObserver&&(this.__shortcutObserver.pattern=e.shortcut),super._propertiesChanged(e,t,n)}_handleShortcut(){this.focus(),this.dispatchEvent(new CustomEvent("shortcut",{bubbles:!0}))}focus(){if(super.focus(),this.disabled)return;const e=this.shadowRoot.querySelector("h2");e&&e.focus()}_render({label:e,disabled:t}){return o.html`
        <style>

            :host([disabled]) * {
                opacity: 0.5;
                pointer-events: none;
            }
            .container {
                padding: 30px 24px;
                border-bottom: 1px solid ${a.outlineBorderColor};
            }

            .title {
                font-family: ${a.bodyFontFamily};
                font-size: 18px;
                padding: 0;
                font-weight: 700;
                text-transform: capitalize;
                display: block;
                margin: 0 0 20px 0;
            }
        </style>
        <div class="container" aria-label="${e} Group" tabIndex="${t?-1:0}">
            ${!this.hideLabel&&this.label&&""!=this.label?o.html`<h2 tabindex="-1" class="title">${e}</h2>`:""}
            <slot tabIndex="${t?-1:0}"></slot>
        </div>
        `}}r([s.property({type:String})],l.prototype,"shortcut",void 0),r([s.property({type:String})],l.prototype,"label",void 0),r([s.property({type:Boolean})],l.prototype,"disabled",void 0),r([s.property({type:Boolean})],l.prototype,"hideLabel",void 0),r([u.default],l.prototype,"_handleShortcut",null),t.GroupElement=l,customElements.define("acc-group",l)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(1),i=n(6);t.getLabelTemplate=function(e,t){let n=r.html``;return""!==e&&(n=r.html`
            <style type="text/css">
            label {
                font-family: ${i.bodyFontFamily};
                font-size: 18px;
                padding: 0px 0px 20px 0px;
                font-weight: 700;
                text-transform: capitalize;
                display: block;
                cursor: pointer;
                color: ${i.labelColor};
            }
            </style>
            <label for$="${t}">${e}</label>
            `),n}},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),o=n(8),a=n(27),s=n(3),u=n(54),{FlattenedNodesObserver:c}=n(36);t.isOptgroupElement=(e=>e&&"ACC-OPTGROUP"===e.tagName),t.isSelectableElement=(e=>"boolean"==typeof e.selected);class l extends i.LitElement{constructor(){super(...arguments),this.hideLabel=!1,this._nodeChildSelector="acc-item",this._groups=[],this._groupObservers=[],this._nodes=[]}_propertiesChanged(e,t,n){super._propertiesChanged(e,t,n),t&&t.label&&(this.labelHtml=u.getLabelTemplate(t.label,this.id))}connectedCallback(){super.connectedCallback(),this.__nodesObserver=new c(this,this._handleNodesObserverUpdate)}disconnectedCallback(){this.__nodesObserver.disconnect(),super.disconnectedCallback()}select(e){if(this.__deselectAllNodes(e),!e.selected){const t={detail:{target:e},bubbles:!0,composed:!0};o.isElement(e)&&(e.selected=!0),this.dispatchEvent(new CustomEvent("select",t)),this.requestRender()}}get selected(){return this._nodes[this.selectedIndex]}get selectedIndex(){for(let e=0;e<this._nodes.length;e++){if(this._nodes[e].selected)return e}return-1}set selectedIndex(e){this._nodes[e]&&this.select(this._nodes[e])}__deselectAllNodes(e){const t="number"==typeof e?this._nodes[e]:e;for(let e=0;e<this._nodes.length;e++)this._nodes[e]!==t&&(this._nodes[e].selected=!1)}_handleSlotNodeChanged(e){t.isSelectableElement(e.target)&&e.target.selected&&this.select(e.target),this.requestRender()}_handleNodesObserverUpdate(e){if(e.removedNodes.forEach(e=>t.isSelectableElement(e)&&this._removeNode(e)),e.removedNodes.forEach(e=>t.isOptgroupElement(e)&&this._removeGroup(e)),e.addedNodes.forEach(e=>t.isOptgroupElement(e)&&this._addGroup(e)),e.addedNodes.forEach(e=>t.isSelectableElement(e)&&this._addNode(e)),e.addedNodes.filter(e=>o.isElement(e)&&!t.isOptgroupElement(e)&&!t.isSelectableElement(e)).forEach(e=>{console.warn(`ignoring element ${e.tagName}, it is not a selectable element`)}),-1===this.selectedIndex&&this._nodes.length)for(let e=0;e<this._nodes.length;e++){const n=this._nodes[e];if(!(t.isOptgroupElement(n.parentElement)&&n.parentElement.disabled)){this.select(n);break}}this.requestRender()}_addGroup(e){const n=e=>{t.isSelectableElement(e)&&this._addNode(e)},r=e=>{t.isSelectableElement(e)&&this._removeNode(e)},i=new c(e,e=>{e.removedNodes.forEach(r),e.addedNodes.forEach(n),this.requestRender()});this._groups.push(e),this._groupObservers.push(i);for(let t of e.children)n(t)}_removeGroup(e){const n=this._groups.indexOf(e);if(-1===n)return;const r=this._groupObservers[n];if(!r)throw new Error("Has group but does not have observer!");for(let n of e.children)t.isSelectableElement(n)&&this._removeNode(n);r.disconnect(),this._groups.splice(n,1),this._groupObservers.splice(n,1)}_addNode(e){this._nodes.indexOf(e)>-1||(e.addEventListener("change",this._handleSlotNodeChanged),this._nodes=Array.from(this.querySelectorAll(this._nodeChildSelector)||[]))}_removeNode(e){const t=this._nodes.indexOf(e);t<0||(this._nodes[t].removeEventListener("change",this._handleSlotNodeChanged),this._nodes.splice(t,1))}}r([s.property({type:Boolean})],l.prototype,"hideLabel",void 0),r([s.property({type:String})],l.prototype,"label",void 0),r([s.property({type:String})],l.prototype,"id",void 0),r([s.property({type:Boolean})],l.prototype,"disabled",void 0),r([a.default],l.prototype,"_handleSlotNodeChanged",null),t.AbstractSelectLitElement=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(6),i=n(1),o={pause:n(235),play:n(234),stop:n(233),menu:n(232),close:n(231),replay:n(230),code:n(229),down:n(228),link:n(227),next:n(226),previous:n(225),"volume-on":n(224),"volume-off":n(223),chrome:n(222),badges:n(221)};customElements.define("acc-icon",class extends i.LitElement{constructor(){super(),this.icon="",this._iconElement=document.createElement("i")}static get properties(){return{icon:String}}_render(){return o[this.icon]&&(this._iconElement.innerHTML=o[this.icon],this.setAttribute("aria-label",this.icon)),i.html`
            <style>
                svg {
                    margin: auto;
                    display: block;
                }

                svg {
                    fill: ${r.fillColor};
                }
            </style>
            ${this._iconElement}
        `}})},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),o=n(3);n(37);const a=n(14);class s extends a.AbstractModalElement{constructor(){super(),this.closeButton="Start Playing",this.priority=2,this.exclusive=!0}_handleCloseClick(){this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close-clicked",{bubbles:!0}))}focus(){super.focus();const e=this.shadowRoot.querySelector("h2");e&&e.focus()}_renderModalBody({closeButton:e}){return i.html`
            <style>

                :host([dark]), [dark] {
                    --background-color: black;
                    --button-fill: black;
                }

                :host {
                    --background-color: white;
                    --button-fill: white;
                }

                #content {
                    background-color: var(--background-color);
                    position: absolute;
                    width: 100%;
                    height: 100%;
                    left: 0px;
                    top: 0px;
                }

                acc-slideshow {
                    height: 530px;
                    width: 700px;
                    max-width: 100%;
                    display: block;
                    position: absolute;
                    top: 50%;
                    left: 50%;
                    transform: translate(-50%, -50%);
                }

                h2 {
                    height: 0px;
                    overflow: hidden;
                }

            </style>
            <div id="content">
                <h2 tabindex="-1">Tutorial</h2>
                <acc-slideshow closeButton="${e}" on-close=${this._handleCloseClick.bind(this)}>
                    <slot></slot>
                </acc-slideshow>
            </div>
        `}}r([o.property({type:String})],s.prototype,"closeButton",void 0),t.Tutorial=s,customElements.define("acc-tutorial",s)},function(e,t,n){(function(t){var r=n(7);e.exports=function(e,n){return new t(e.toRed(r.mont(n.modulus)).redPow(new r(n.publicExponent)).fromRed().toArray())}}).call(this,n(5).Buffer)},function(e,t){e.exports=function(e,t){for(var n=e.length,r=-1;++r<n;)e[r]^=t[r];return e}},function(e,t,n){(function(t){var r=n(26);function i(e){var n=new t(4);return n.writeUInt32BE(e,0),n}e.exports=function(e,n){for(var o,a=new t(""),s=0;a.length<n;)o=i(s++),a=t.concat([a,r("sha1").update(e).update(o).digest()]);return a.slice(0,n)}}).call(this,n(5).Buffer)},function(e){e.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(e,t,n){var r=n(2),i=n(5).Buffer,o=n(22),a=o.base,s=o.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){a.Node.call(this,"der",e)}function l(e){return e<10?"0"+e:e}e.exports=u,u.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},r(c,a.Node),c.prototype._encodeComposite=function(e,t,n,r){var o,a=function(e,t,n,r){var i;"seqof"===e?e="seq":"setof"===e&&(e="set");if(s.tagByName.hasOwnProperty(e))i=s.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return r.error("Unknown tag: "+e);i=e}if(i>=31)return r.error("Multi-octet tag encoding unsupported");t||(i|=32);return i|=s.tagClassByName[n||"universal"]<<6}(e,t,n,this.reporter);if(r.length<128)return(o=new i(2))[0]=a,o[1]=r.length,this._createEncoderBuffer([o,r]);for(var u=1,c=r.length;c>=256;c>>=8)u++;(o=new i(2+u))[0]=a,o[1]=128|u;c=1+u;for(var l=r.length;l>0;c--,l>>=8)o[c]=255&l;return this._createEncoderBuffer([o,r])},c.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var n=new i(2*e.length),r=0;r<e.length;r++)n.writeUInt16BE(e.charCodeAt(r),2*r);return this._createEncoderBuffer(n)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):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(t)?this._createEncoderBuffer(e):"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},c.prototype._encodeObjid=function(e,t,n){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s\.]+/g);for(var r=0;r<e.length;r++)e[r]|=0}else if(Array.isArray(e)){e=e.slice();for(r=0;r<e.length;r++)e[r]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!n){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}var o=0;for(r=0;r<e.length;r++){var a=e[r];for(o++;a>=128;a>>=7)o++}var s=new i(o),u=s.length-1;for(r=e.length-1;r>=0;r--){a=e[r];for(s[u--]=127&a;(a>>=7)>0;)s[u--]=128|127&a}return this._createEncoderBuffer(s)},c.prototype._encodeTime=function(e,t){var n,r=new Date(e);return"gentime"===t?n=[l(r.getFullYear()),l(r.getUTCMonth()+1),l(r.getUTCDate()),l(r.getUTCHours()),l(r.getUTCMinutes()),l(r.getUTCSeconds()),"Z"].join(""):"utctime"===t?n=[l(r.getFullYear()%100),l(r.getUTCMonth()+1),l(r.getUTCDate()),l(r.getUTCHours()),l(r.getUTCMinutes()),l(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(n,"octstr")},c.prototype._encodeNull=function(){return this._createEncoderBuffer("")},c.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!i.isBuffer(e)){var n=e.toArray();!e.sign&&128&n[0]&&n.unshift(0),e=new i(n)}if(i.isBuffer(e)){var r=e.length;0===e.length&&r++;var o=new i(r);return e.copy(o),0===e.length&&(o[0]=0),this._createEncoderBuffer(o)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);r=1;for(var a=e;a>=256;a>>=8)r++;for(a=(o=new Array(r)).length-1;a>=0;a--)o[a]=255&e,e>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new i(o))},c.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},c.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},c.prototype._skipDefault=function(e,t,n){var r,i=this._baseState;if(null===i.default)return!1;var o=e.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,t,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(e,t,n){var r=n(2),i=n(22),o=i.base,a=i.bignum,s=i.constants.der;function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.Node.call(this,"der",e)}function l(e,t){var n=e.readUInt8(t);if(e.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=e.readUInt8(t),e.isError(o))return o;n<<=7,n|=127&o}}else n&=31;return{cls:r,primitive:i,tag:n,tagStr:s.tag[n]}}function h(e,t,n){var r=e.readUInt8(n);if(e.isError(r))return r;if(!t&&128===r)return null;if(0==(128&r))return r;var i=127&r;if(i>4)return e.error("length octect is too long");r=0;for(var o=0;o<i;o++){r<<=8;var a=e.readUInt8(n);if(e.isError(a))return a;r|=a}return r}e.exports=u,u.prototype.decode=function(e,t){return e instanceof o.DecoderBuffer||(e=new o.DecoderBuffer(e,t)),this.tree._decode(e,t)},r(c,o.Node),c.prototype._peekTag=function(e,t,n){if(e.isEmpty())return!1;var r=e.save(),i=l(e,'Failed to peek tag: "'+t+'"');return e.isError(i)?i:(e.restore(r),i.tag===t||i.tagStr===t||i.tagStr+"of"===t||n)},c.prototype._decodeTag=function(e,t,n){var r=l(e,'Failed to decode tag of "'+t+'"');if(e.isError(r))return r;var i=h(e,r.primitive,'Failed to get length of "'+t+'"');if(e.isError(i))return i;if(!n&&r.tag!==t&&r.tagStr!==t&&r.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(r.primitive||null!==i)return e.skip(i,'Failed to match body of: "'+t+'"');var o=e.save(),a=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(a)?a:(i=e.offset-o.offset,e.restore(o),e.skip(i,'Failed to match body of: "'+t+'"'))},c.prototype._skipUntilEnd=function(e,t){for(;;){var n=l(e,t);if(e.isError(n))return n;var r,i=h(e,n.primitive,t);if(e.isError(i))return i;if(r=n.primitive||null!==i?e.skip(i):this._skipUntilEnd(e,t),e.isError(r))return r;if("end"===n.tagStr)break}},c.prototype._decodeList=function(e,t,n,r){for(var i=[];!e.isEmpty();){var o=this._peekTag(e,"end");if(e.isError(o))return o;var a=n.decode(e,"der",r);if(e.isError(a)&&o)break;i.push(a)}return i},c.prototype._decodeStr=function(e,t){if("bitstr"===t){var n=e.readUInt8();return e.isError(n)?n:{unused:n,data:e.raw()}}if("bmpstr"===t){var r=e.raw();if(r.length%2==1)return e.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"===t){var a=e.raw().toString("ascii");return this._isNumstr(a)?a:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){var s=e.raw().toString("ascii");return this._isPrintstr(s)?s:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},c.prototype._decodeObjid=function(e,t,n){for(var r,i=[],o=0;!e.isEmpty();){var a=e.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)),t){var c=t[r.join(" ")];void 0===c&&(c=t[r.join(".")]),void 0!==c&&(r=c)}return r},c.prototype._decodeTime=function(e,t){var n=e.raw().toString();if("gentime"===t)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"!==t)return e.error("Decoding "+t+" 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(e){return null},c.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},c.prototype._decodeInt=function(e,t){var n=e.raw(),r=new a(n);return t&&(r=t[r.toString(10)]||r),r},c.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree}},function(e,t,n){var r=t;r._reverse=function(e){var t={};return Object.keys(e).forEach(function(n){(0|n)==n&&(n|=0);var r=e[n];t[r]=n}),t},r.der=n(121)},function(e,t,n){var r=n(2),i=n(21).Reporter,o=n(5).Buffer;function a(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function s(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof s||(e=new s(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}r(a,i),t.DecoderBuffer=a,a.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},a.prototype.restore=function(e){var t=new a(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,i.prototype.restore.call(this,e.reporter),t},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},a.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var n=new a(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n},a.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},t.EncoderBuffer=s,s.prototype.join=function(e,t){return e||(e=new o(this.length)),t||(t=0),0===this.length?e:(Array.isArray(this.value)?this.value.forEach(function(n){n.join(e,t),t+=n.length}):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):o.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length),e)}},function(e,t,n){"use strict";var r=n(13),i=n(23),o=n(10),a=r.rotr64_hi,s=r.rotr64_lo,u=r.shr64_hi,c=r.shr64_lo,l=r.sum64,h=r.sum64_hi,d=r.sum64_lo,f=r.sum64_4_hi,p=r.sum64_4_lo,m=r.sum64_5_hi,g=r.sum64_5_lo,b=i.BlockHash,y=[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 v(){if(!(this instanceof v))return new v;b.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=y,this.W=new Array(160)}function _(e,t,n,r,i){var o=e&n^~e&i;return o<0&&(o+=4294967296),o}function w(e,t,n,r,i,o){var a=t&r^~t&o;return a<0&&(a+=4294967296),a}function x(e,t,n,r,i){var o=e&n^e&i^n&i;return o<0&&(o+=4294967296),o}function E(e,t,n,r,i,o){var a=t&r^t&o^r&o;return a<0&&(a+=4294967296),a}function S(e,t){var n=a(e,t,28)^a(t,e,2)^a(t,e,7);return n<0&&(n+=4294967296),n}function C(e,t){var n=s(e,t,28)^s(t,e,2)^s(t,e,7);return n<0&&(n+=4294967296),n}function O(e,t){var n=a(e,t,14)^a(e,t,18)^a(t,e,9);return n<0&&(n+=4294967296),n}function A(e,t){var n=s(e,t,14)^s(e,t,18)^s(t,e,9);return n<0&&(n+=4294967296),n}function M(e,t){var n=a(e,t,1)^a(e,t,8)^u(e,t,7);return n<0&&(n+=4294967296),n}function N(e,t){var n=s(e,t,1)^s(e,t,8)^c(e,t,7);return n<0&&(n+=4294967296),n}function k(e,t){var n=a(e,t,19)^a(t,e,29)^u(e,t,6);return n<0&&(n+=4294967296),n}function I(e,t){var n=s(e,t,19)^s(t,e,29)^c(e,t,6);return n<0&&(n+=4294967296),n}r.inherits(v,b),e.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(e,t){for(var n=this.W,r=0;r<32;r++)n[r]=e[t+r];for(;r<n.length;r+=2){var i=k(n[r-4],n[r-3]),o=I(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=M(n[r-30],n[r-29]),c=N(n[r-30],n[r-29]),l=n[r-32],h=n[r-31];n[r]=f(i,o,a,s,u,c,l,h),n[r+1]=p(i,o,a,s,u,c,l,h)}},v.prototype._update=function(e,t){this._prepareBlock(e,t);var n=this.W,r=this.h[0],i=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],f=this.h[6],p=this.h[7],b=this.h[8],y=this.h[9],v=this.h[10],M=this.h[11],N=this.h[12],k=this.h[13],I=this.h[14],T=this.h[15];o(this.k.length===n.length);for(var P=0;P<n.length;P+=2){var R=I,D=T,L=O(b,y),B=A(b,y),j=_(b,y,v,M,N),F=w(b,y,v,M,N,k),z=this.k[P],V=this.k[P+1],U=n[P],W=n[P+1],$=m(R,D,L,B,j,F,z,V,U,W),q=g(R,D,L,B,j,F,z,V,U,W);R=S(r,i),D=C(r,i),L=x(r,i,a,s,u),B=E(r,i,a,s,u,c);var H=h(R,D,L,B),G=d(R,D,L,B);I=N,T=k,N=v,k=M,v=b,M=y,b=h(f,p,$,q),y=d(p,p,$,q),f=u,p=c,u=a,c=s,a=r,s=i,r=h($,q,H,G),i=d($,q,H,G)}l(this.h,0,r,i),l(this.h,2,a,s),l(this.h,4,u,c),l(this.h,6,f,p),l(this.h,8,b,y),l(this.h,10,v,M),l(this.h,12,N,k),l(this.h,14,I,T)},v.prototype._digest=function(e){return"hex"===e?r.toHex32(this.h,"big"):r.split32(this.h,"big")}},function(e,t,n){"use strict";var r=n(13),i=n(23),o=n(68),a=n(10),s=r.sum32,u=r.sum32_4,c=r.sum32_5,l=o.ch32,h=o.maj32,d=o.s0_256,f=o.s1_256,p=o.g0_256,m=o.g1_256,g=i.BlockHash,b=[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 y(){if(!(this instanceof y))return new y;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=b,this.W=new Array(64)}r.inherits(y,g),e.exports=y,y.blockSize=512,y.outSize=256,y.hmacStrength=192,y.padLength=64,y.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=u(m(n[r-2]),n[r-7],p(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],g=this.h[2],b=this.h[3],y=this.h[4],v=this.h[5],_=this.h[6],w=this.h[7];for(a(this.k.length===n.length),r=0;r<n.length;r++){var x=c(w,f(y),l(y,v,_),this.k[r],n[r]),E=s(d(i),h(i,o,g));w=_,_=v,v=y,y=s(b,x),b=g,g=o,o=i,i=s(x,E)}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],g),this.h[3]=s(this.h[3],b),this.h[4]=s(this.h[4],y),this.h[5]=s(this.h[5],v),this.h[6]=s(this.h[6],_),this.h[7]=s(this.h[7],w)},y.prototype._digest=function(e){return"hex"===e?r.toHex32(this.h,"big"):r.split32(this.h,"big")}},function(e,t,n){"use strict";var r=n(13).rotr32;function i(e,t,n){return e&t^~e&n}function o(e,t,n){return e&t^e&n^t&n}function a(e,t,n){return e^t^n}t.ft_1=function(e,t,n,r){return 0===e?i(t,n,r):1===e||3===e?a(t,n,r):2===e?o(t,n,r):void 0},t.ch32=i,t.maj32=o,t.p32=a,t.s0_256=function(e){return r(e,2)^r(e,13)^r(e,22)},t.s1_256=function(e){return r(e,6)^r(e,11)^r(e,25)},t.g0_256=function(e){return r(e,7)^r(e,18)^e>>>3},t.g1_256=function(e){return r(e,17)^r(e,19)^e>>>10}},function(e,t,n){"use strict";var r=t;function i(e){return 1===e.length?"0"+e:e}function o(e){for(var t="",n=0;n<e.length;n++)t+=i(e[n].toString(16));return t}r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var r=0;r<e.length;r++)n[r]=0|e[r];return n}if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16));else for(r=0;r<e.length;r++){var i=e.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(e,t){return"hex"===t?o(e):e}},function(e,t,n){var r;function i(e){this.rand=e}if(e.exports=function(e){return r||(r=new i(null)),r.generate(e)},e.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n<t.length;n++)t[n]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(i.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=n(153);if("function"!=typeof o.randomBytes)throw new Error("Not supported");i.prototype._rand=function(e){return o.randomBytes(e)}}catch(e){}},function(e,t,n){var r=n(7),i=n(70);function o(e){this.rand=e||new i.Rand}e.exports=o,o.create=function(e){return new o(e)},o.prototype._randbelow=function(e){var t=e.bitLength(),n=Math.ceil(t/8);do{var i=new r(this.rand.generate(n))}while(i.cmp(e)>=0);return i},o.prototype._randrange=function(e,t){var n=t.sub(e);return e.add(this._randbelow(n))},o.prototype.test=function(e,t,n){var i=e.bitLength(),o=r.mont(e),a=new r(1).toRed(o);t||(t=Math.max(1,i/48|0));for(var s=e.subn(1),u=0;!s.testn(u);u++);for(var c=e.shrn(u),l=s.toRed(o);t>0;t--){var h=this._randrange(new r(2),s);n&&n(h);var d=h.toRed(o).redPow(c);if(0!==d.cmp(a)&&0!==d.cmp(l)){for(var f=1;f<u;f++){if(0===(d=d.redSqr()).cmp(a))return!1;if(0===d.cmp(l))break}if(f===u)return!1}}return!0},o.prototype.getDivisor=function(e,t){var n=e.bitLength(),i=r.mont(e),o=new r(1).toRed(i);t||(t=Math.max(1,n/48|0));for(var a=e.subn(1),s=0;!a.testn(s);s++);for(var u=e.shrn(s),c=a.toRed(i);t>0;t--){var l=this._randrange(new r(2),a),h=e.gcd(l);if(0!==h.cmpn(1))return h;var d=l.toRed(i).redPow(u);if(0!==d.cmp(o)&&0!==d.cmp(c)){for(var f=1;f<s;f++){if(0===(d=d.redSqr()).cmp(o))return d.fromRed().subn(1).gcd(e);if(0===d.cmp(c))break}if(f===s)return(d=d.redSqr()).fromRed().subn(1).gcd(e)}}return!1}},function(e,t,n){var r=n(19);e.exports=y,y.simpleSieve=g,y.fermatTest=b;var i=n(7),o=new i(24),a=new(n(71)),s=new i(1),u=new i(2),c=new i(5),l=(new i(16),new i(8),new i(10)),h=new i(3),d=(new i(7),new i(11)),f=new i(4),p=(new i(12),null);function m(){if(null!==p)return p;var e=[];e[0]=2;for(var t=1,n=3;n<1048576;n+=2){for(var r=Math.ceil(Math.sqrt(n)),i=0;i<t&&e[i]<=r&&n%e[i]!=0;i++);t!==i&&e[i]<=r||(e[t++]=n)}return p=e,e}function g(e){for(var t=m(),n=0;n<t.length;n++)if(0===e.modn(t[n]))return 0===e.cmpn(t[n]);return!0}function b(e){var t=i.mont(e);return 0===u.toRed(t).redPow(e.subn(1)).fromRed().cmpn(1)}function y(e,t){if(e<16)return new i(2===t||5===t?[140,123]:[140,39]);var n,p;for(t=new i(t);;){for(n=new i(r(Math.ceil(e/8)));n.bitLength()>e;)n.ishrn(1);if(n.isEven()&&n.iadd(s),n.testn(1)||n.iadd(u),t.cmp(u)){if(!t.cmp(c))for(;n.mod(l).cmp(h);)n.iadd(f)}else for(;n.mod(o).cmp(d);)n.iadd(f);if(g(p=n.shrn(1))&&g(n)&&b(p)&&b(n)&&a.test(p)&&a.test(n))return n}}},function(e,t,n){var r=n(31),i=n(4).Buffer,o=n(15);function a(e,t,n,a){o.call(this),this._cipher=new r.AES(t),this._prev=i.from(n),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._mode=e}n(2)(a,o),a.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},a.prototype._final=function(){this._cipher.scrub()},e.exports=a},function(e,t,n){var r=n(31),i=n(4).Buffer,o=n(15),a=n(2),s=n(159),u=n(24),c=n(76);function l(e,t,n,a){o.call(this);var u=i.alloc(4,0);this._cipher=new r.AES(t);var l=this._cipher.encryptBlock(u);this._ghash=new s(l),n=function(e,t,n){if(12===t.length)return e._finID=i.concat([t,i.from([0,0,0,1])]),i.concat([t,i.from([0,0,0,2])]);var r=new s(n),o=t.length,a=o%16;r.update(t),a&&(a=16-a,r.update(i.alloc(a,0))),r.update(i.alloc(8,0));var u=8*o,l=i.alloc(8);l.writeUIntBE(u,0,8),r.update(l),e._finID=r.state;var h=i.from(e._finID);return c(h),h}(this,n,l),this._prev=i.from(n),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}a(l,o),l.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=i.alloc(t,0),this._ghash.update(t))}this._called=!0;var n=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(n),this._len+=e.length,n},l.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var n=0;e.length!==t.length&&n++;for(var r=Math.min(e.length,t.length),i=0;i<r;++i)n+=e[i]^t[i];return n}(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()},l.prototype.getAuthTag=function(){if(this._decrypt||!i.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},l.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},l.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length},e.exports=l},function(e){e.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(e,t){e.exports=function(e){for(var t,n=e.length;n--;){if(255!==(t=e.readUInt8(n))){t++,e.writeUInt8(t,n);break}e.writeUInt8(0,n)}}},function(e,t,n){var r=n(24),i=n(4).Buffer,o=n(76);function a(e){var t=e._cipher.encryptBlockRaw(e._prev);return o(e._prev),t}t.encrypt=function(e,t){var n=Math.ceil(t.length/16),o=e._cache.length;e._cache=i.concat([e._cache,i.allocUnsafe(16*n)]);for(var s=0;s<n;s++){var u=a(e),c=o+16*s;e._cache.writeUInt32BE(u[0],c+0),e._cache.writeUInt32BE(u[1],c+4),e._cache.writeUInt32BE(u[2],c+8),e._cache.writeUInt32BE(u[3],c+12)}var l=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),r(t,l)}},function(e,t,n){var r=n(83),i=n(44),o=n(43),a=n(80),s=n(79),u=n(4).Buffer,c=u.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function h(e,t,n){var a=function(e){return"rmd160"===e||"ripemd160"===e?i:"md5"===e?r:function(t){return o(e).update(t).digest()}}(e),s="sha512"===e||"sha384"===e?128:64;t.length>s?t=a(t):t.length<s&&(t=u.concat([t,c],s));for(var h=u.allocUnsafe(s+l[e]),d=u.allocUnsafe(s+l[e]),f=0;f<s;f++)h[f]=54^t[f],d[f]=92^t[f];var p=u.allocUnsafe(s+n+4);h.copy(p,0,0,s),this.ipad1=p,this.ipad2=h,this.opad=d,this.alg=e,this.blocksize=s,this.hash=a,this.size=l[e]}h.prototype.run=function(e,t){return e.copy(t,this.blocksize),this.hash(t).copy(this.opad,this.blocksize),this.hash(this.opad)},e.exports=function(e,t,n,r,i){a(e,t,n,r),u.isBuffer(e)||(e=u.from(e,s)),u.isBuffer(t)||(t=u.from(t,s));var o=new h(i=i||"sha1",e,t.length),c=u.allocUnsafe(r),d=u.allocUnsafe(t.length+4);t.copy(d,0,0,t.length);for(var f=0,p=l[i],m=Math.ceil(r/p),g=1;g<=m;g++){d.writeUInt32BE(g,t.length);for(var b=o.run(d,o.ipad1),y=b,v=1;v<n;v++){y=o.run(y,o.ipad2);for(var _=0;_<p;_++)b[_]^=y[_]}b.copy(c,f),f+=p}return c}},function(e,t,n){(function(t){var n;t.browser?n="utf-8":n=parseInt(t.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary";e.exports=n}).call(this,n(12))},function(e,t,n){(function(t){var n=Math.pow(2,30)-1;function r(e,n){if("string"!=typeof e&&!t.isBuffer(e))throw new TypeError(n+" must be a buffer or string")}e.exports=function(e,t,i,o){if(r(e,"Password"),r(t,"Salt"),"number"!=typeof i)throw new TypeError("Iterations not a number");if(i<0)throw new TypeError("Bad iterations");if("number"!=typeof o)throw new TypeError("Key length not a number");if(o<0||o>n||o!=o)throw new TypeError("Bad key length")}}).call(this,n(5).Buffer)},function(e,t,n){t.pbkdf2=n(174),t.pbkdf2Sync=n(78)},function(e){e.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(e,t,n){var r=n(49);e.exports=function(e){return(new r).update(e).digest()}},function(e,t,n){"use strict";var r=n(2),i=n(176),o=n(15),a=n(4).Buffer,s=n(83),u=n(44),c=n(43),l=a.alloc(128);function h(e,t){o.call(this,"digest"),"string"==typeof t&&(t=a.from(t));var n="sha512"===e||"sha384"===e?128:64;(this._alg=e,this._key=t,t.length>n)?t=("rmd160"===e?new u:c(e)).update(t).digest():t.length<n&&(t=a.concat([t,l],n));for(var r=this._ipad=a.allocUnsafe(n),i=this._opad=a.allocUnsafe(n),s=0;s<n;s++)r[s]=54^t[s],i[s]=92^t[s];this._hash="rmd160"===e?new u:c(e),this._hash.update(r)}r(h,o),h.prototype._update=function(e){this._hash.update(e)},h.prototype._final=function(){var e=this._hash.digest();return("rmd160"===this._alg?new u:c(this._alg)).update(this._opad).update(e).digest()},e.exports=function(e,t){return"rmd160"===(e=e.toLowerCase())||"ripemd160"===e?new h("rmd160",t):"md5"===e?new i(s,t):new h(e,t)}},function(e,t,n){var r=n(2),i=n(18),o=n(4).Buffer,a=[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],s=new Array(160);function u(){this.init(),this._w=s,i.call(this,128,112)}function c(e,t,n){return n^e&(t^n)}function l(e,t,n){return e&t|n&(e|t)}function h(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function d(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function f(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function m(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function b(e,t){return e>>>0<t>>>0?1:0}r(u,i),u.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},u.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,s=0|this._eh,u=0|this._fh,y=0|this._gh,v=0|this._hh,_=0|this._al,w=0|this._bl,x=0|this._cl,E=0|this._dl,S=0|this._el,C=0|this._fl,O=0|this._gl,A=0|this._hl,M=0;M<32;M+=2)t[M]=e.readInt32BE(4*M),t[M+1]=e.readInt32BE(4*M+4);for(;M<160;M+=2){var N=t[M-30],k=t[M-30+1],I=f(N,k),T=p(k,N),P=m(N=t[M-4],k=t[M-4+1]),R=g(k,N),D=t[M-14],L=t[M-14+1],B=t[M-32],j=t[M-32+1],F=T+L|0,z=I+D+b(F,T)|0;z=(z=z+P+b(F=F+R|0,R)|0)+B+b(F=F+j|0,j)|0,t[M]=z,t[M+1]=F}for(var V=0;V<160;V+=2){z=t[V],F=t[V+1];var U=l(n,r,i),W=l(_,w,x),$=h(n,_),q=h(_,n),H=d(s,S),G=d(S,s),K=a[V],Y=a[V+1],X=c(s,u,y),Z=c(S,C,O),J=A+G|0,Q=v+H+b(J,A)|0;Q=(Q=(Q=Q+X+b(J=J+Z|0,Z)|0)+K+b(J=J+Y|0,Y)|0)+z+b(J=J+F|0,F)|0;var ee=q+W|0,te=$+U+b(ee,q)|0;v=y,A=O,y=u,O=C,u=s,C=S,s=o+Q+b(S=E+J|0,E)|0,o=i,E=x,i=r,x=w,r=n,w=_,n=Q+te+b(_=J+ee|0,J)|0}this._al=this._al+_|0,this._bl=this._bl+w|0,this._cl=this._cl+x|0,this._dl=this._dl+E|0,this._el=this._el+S|0,this._fl=this._fl+C|0,this._gl=this._gl+O|0,this._hl=this._hl+A|0,this._ah=this._ah+n+b(this._al,_)|0,this._bh=this._bh+r+b(this._bl,w)|0,this._ch=this._ch+i+b(this._cl,x)|0,this._dh=this._dh+o+b(this._dl,E)|0,this._eh=this._eh+s+b(this._el,S)|0,this._fh=this._fh+u+b(this._fl,C)|0,this._gh=this._gh+y+b(this._gl,O)|0,this._hh=this._hh+v+b(this._hl,A)|0},u.prototype._hash=function(){var e=o.allocUnsafe(64);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+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),e},e.exports=u},function(e,t,n){var r=n(2),i=n(18),o=n(4).Buffer,a=[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],s=new Array(64);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(e,t,n){return n^e&(t^n)}function l(e,t,n){return e&t|n&(e|t)}function h(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function d(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function f(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function p(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}r(u,i),u.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},u.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,u=0|this._f,m=0|this._g,g=0|this._h,b=0;b<16;++b)t[b]=e.readInt32BE(4*b);for(;b<64;++b)t[b]=p(t[b-2])+t[b-7]+f(t[b-15])+t[b-16]|0;for(var y=0;y<64;++y){var v=g+d(s)+c(s,u,m)+a[y]+t[y]|0,_=h(n)+l(n,r,i)|0;g=m,m=u,u=s,s=o+v|0,o=i,i=r,r=n,n=v+_|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0,this._f=u+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},u.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=u},function(e,t,n){"use strict";e.exports=o;var r=n(16),i=n(25);function o(e){if(!(this instanceof o))return new o(e);r.call(this,e),this._transformState={afterTransform:function(e,t){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,null!=t&&this.push(t),r(e);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,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",a)}function a(){var e=this;"function"==typeof this._flush?this._flush(function(t,n){s(e,t,n)}):s(this,null,null)}function s(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}i.inherits=n(2),i.inherits(o,r),o.prototype.push=function(e,t){return this._transformState.needTransform=!1,r.prototype.push.call(this,e,t)},o.prototype._transform=function(e,t,n){throw new Error("_transform() is not implemented")},o.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},o.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},o.prototype._destroy=function(e,t){var n=this;r.prototype._destroy.call(this,e,function(e){t(e),n.emit("close")})}},function(e,t,n){"use strict";var r=n(32);function i(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var n=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||r.nextTick(i,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(r.nextTick(i,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)}),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(e,t,n){e.exports=n(33).EventEmitter},function(e,t,n){"use strict";(function(t,r){var i=n(32);e.exports=v;var o,a=n(92);v.ReadableState=y;n(33).EventEmitter;var s=function(e,t){return e.listeners(t).length},u=n(89),c=n(4).Buffer,l=t.Uint8Array||function(){};var h=n(25);h.inherits=n(2);var d=n(189),f=void 0;f=d&&d.debuglog?d.debuglog("stream"):function(){};var p,m=n(188),g=n(88);h.inherits(v,u);var b=["error","close","destroy","pause","resume"];function y(e,t){o=o||n(16),e=e||{};var r=t instanceof o;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,a=e.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(a||0===a)?a:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,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=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(p||(p=n(45).StringDecoder),this.decoder=new p(e.encoding),this.encoding=e.encoding)}function v(e){if(o=o||n(16),!(this instanceof v))return new v(e);this._readableState=new y(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function _(e,t,n,r,i){var o,a=e._readableState;null===t?(a.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,S(e)}(e,a)):(i||(o=function(e,t){var n;(function(e){return c.isBuffer(e)||e instanceof l})(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(a,t)),o?e.emit("error",o):a.objectMode||t&&t.length>0?("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),r?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):w(e,a,t,!0):a.ended?e.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||0!==t.length?w(e,a,t,!1):O(e,a)):w(e,a,t,!1))):r||(a.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(a)}function w(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&S(e)),O(e,t)}Object.defineProperty(v.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),v.prototype.destroy=g.destroy,v.prototype._undestroy=g.undestroy,v.prototype._destroy=function(e,t){this.push(null),t(e)},v.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=c.from(e,t),t=""),n=!0),_(this,e,t,!1,n)},v.prototype.unshift=function(e){return _(this,e,null,!0,!1)},v.prototype.isPaused=function(){return!1===this._readableState.flowing},v.prototype.setEncoding=function(e){return p||(p=n(45).StringDecoder),this._readableState.decoder=new p(e),this._readableState.encoding=e,this};var x=8388608;function E(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=x?e=x:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function S(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(f("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(C,e):C(e))}function C(e){f("emit readable"),e.emit("readable"),k(e)}function O(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(A,e,t))}function A(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(f("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function M(e){f("readable nexttick read 0"),e.read(0)}function N(e,t){t.reading||(f("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),k(e),t.flowing&&!t.reading&&e.read(0)}function k(e){var t=e._readableState;for(f("flow",t.flowing);t.flowing&&null!==e.read(););}function I(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,r=1,i=n.data;e-=i.length;for(;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0===(e-=a)){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=c.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),0===(e-=a)){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function T(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(P,t,e))}function P(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function R(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}v.prototype.read=function(e){f("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return f("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?T(this):S(this),null;if(0===(e=E(e,t))&&t.ended)return 0===t.length&&T(this),null;var r,i=t.needReadable;return f("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&f("length less than watermark",i=!0),t.ended||t.reading?f("reading or ended",i=!1):i&&(f("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=E(n,t))),null===(r=e>0?I(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&T(this)),null!==r&&this.emit("data",r),r},v.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},v.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,f("pipe count=%d opts=%j",o.pipesCount,t);var u=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?l:v;function c(t,r){f("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,f("cleanup"),e.removeListener("close",b),e.removeListener("finish",y),e.removeListener("drain",h),e.removeListener("error",g),e.removeListener("unpipe",c),n.removeListener("end",l),n.removeListener("end",v),n.removeListener("data",m),d=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||h())}function l(){f("onend"),e.end()}o.endEmitted?i.nextTick(u):n.once("end",u),e.on("unpipe",c);var h=function(e){return function(){var t=e._readableState;f("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,k(e))}}(n);e.on("drain",h);var d=!1;var p=!1;function m(t){f("ondata"),p=!1,!1!==e.write(t)||p||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==R(o.pipes,e))&&!d&&(f("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,p=!0),n.pause())}function g(t){f("onerror",t),v(),e.removeListener("error",g),0===s(e,"error")&&e.emit("error",t)}function b(){e.removeListener("finish",y),v()}function y(){f("onfinish"),e.removeListener("close",b),v()}function v(){f("unpipe"),n.unpipe(e)}return n.on("data",m),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?a(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",g),e.once("close",b),e.once("finish",y),e.emit("pipe",n),o.flowing||(f("pipe resume"),n.resume()),e},v.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,n);return this}var a=R(t.pipes,e);return-1===a?this:(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n),this)},v.prototype.on=function(e,t){var n=u.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&S(this):i.nextTick(M,this))}return n},v.prototype.addListener=v.prototype.on,v.prototype.resume=function(){var e=this._readableState;return e.flowing||(f("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(N,e,t))}(this,e)),this},v.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this},v.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",function(){if(f("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){(f("wrapped data"),n.decoder&&(i=n.decoder.write(i)),!n.objectMode||null!==i&&void 0!==i)&&((n.objectMode||i&&i.length)&&(t.push(i)||(r=!0,e.pause())))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<b.length;o++)e.on(b[o],this.emit.bind(this,b[o]));return this._read=function(t){f("wrapped _read",t),r&&(r=!1,e.resume())},this},Object.defineProperty(v.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),v._fromList=I}).call(this,n(11),n(12))},function(e,t,n){"use strict";var r=n(4).Buffer,i=n(48).Transform;function o(e){i.call(this),this._block=r.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}n(2)(o,i),o.prototype._transform=function(e,t,n){var r=null;try{this.update(e,t)}catch(e){r=e}n(r)},o.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},o.prototype.update=function(e,t){if(function(e,t){if(!r.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");r.isBuffer(e)||(e=r.from(e,t));for(var n=this._block,i=0;this._blockOffset+e.length-i>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)n[o++]=e[i++];this._update(),this._blockOffset=0}for(;i<e.length;)n[this._blockOffset++]=e[i++];for(var a=0,s=8*e.length;s>0;++a)this._length[a]+=s,(s=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*s);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},o.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=o},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(193),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(11))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r={facingMode:"user",width:640,height:480,frameRate:30};function i(e=document.createElement("video"),t=r){return window.navigator.mediaDevices&&window.navigator.mediaDevices.getUserMedia?window.navigator.mediaDevices.getUserMedia({video:t}).then(t=>(e.srcObject=t,e),()=>Promise.reject("Could not open your camera. You may have denied access.")):Promise.reject("Your browser does not support WebRTC. Please try another one.")}t.getWebcam=i;const o=e=>(e=>e.srcObject&&e.srcObject instanceof MediaStream)(e)?e.srcObject:null;t.stopAllTracks=(e=>{e.pause(),o(e).getTracks().forEach(e=>e.stop())});t.WebcamCanvas=class{constructor(){this.domElement=document.createElement("canvas"),this.domElement.classList.add("webcam"),this.ctx=this.domElement.getContext("2d"),this.video=document.createElement("video"),this.resize=this.resize.bind(this)}initialize(e){return this.__promiseGetWebcam&&this.__promiseHasResized||(this.__promiseHasResized=new Promise(e=>{const t=()=>{this.video.videoWidth*this.video.videoHeight<4?console.log("video not sized yet"):(this.resize(),this.video.removeEventListener("timeupdate",t),e())};this.video.addEventListener("timeupdate",t)}),this.__promiseGetWebcam=i(this.video,e).then(e=>e.play().then(()=>e))),Promise.all([this.__promiseGetWebcam,this.__promiseHasResized]).then(()=>this)}getFrameRate(){const e=o(this.video);if(e){const t=e.getVideoTracks();if(t&&t[0])return t[0].getSettings().frameRate}return 30}getImageData(e=0,t=0,n=this.domElement.width,r=this.domElement.height){return this.ctx.getImageData(0,0,n,r)}update(){this.ctx.setTransform(-1,0,0,1,this.domElement.width,0),this.ctx.drawImage(this.video,0,0,this.domElement.width,this.domElement.height),this.ctx.setTransform(1,0,0,1,0,0)}resize(){return this.domElement.width!==this.video.videoWidth||(this.domElement.height,this.video.videoHeight),this.domElement.width=this.video.videoWidth,this.domElement.height=this.video.videoHeight,this}stop(){return this.__promiseGetWebcam?this.__promiseGetWebcam.then(()=>{t.stopAllTracks(this.video),this.__promiseGetWebcam=this.__promiseHasResized=null}):Promise.resolve()}}},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(6),o=n(1),a=n(3),s=n(54),u=(e,t,n,r)=>{let i=0,o=n-t,a=r-t;return a=1*a/o,i/=o,o=1,a};class c extends o.LitElement{constructor(){super(),this.name="",this.label="",this.min="0",this.max="100",this.step="1",this.value="",this.inlineLabel=!1,this.disabled=!1,this.labelHtml=o.html`0`}changeGradient(e){this.value=e.currentTarget.value,this.dispatchEvent(new CustomEvent(e.type,{bubbles:!0,detail:{inputEvent:e}}));let t=parseFloat(e.currentTarget.value),n=u(this.name,parseFloat(this.min),parseFloat(this.max),t);this.shadowRoot.querySelector(".range-slider__range").style.backgroundImage="-webkit-gradient(linear, left top, right top, "+`color-stop(${n}, ${i.accentColor}), `+"color-stop("+n+", #D8D8D8))"}_propertiesChanged(e,t,n){t&&(t&&t.label&&(this.labelHtml=s.getLabelTemplate(t.label,this.id),this.requestRender()),super._propertiesChanged(e,t,n))}_render({id:e,name:t,min:n,max:r,step:a,value:s}){const c=o.html`
            <input class="range-slider__range"
               on-input=${e=>this.changeGradient(e)}
               id="${this.id}"
               name="${t}"
               type="range"
               min="${n}"
               max="${r}"
               step="${a}"
               disabled?="${this.disabled}"
               aria-label="${t}"
               value="${s}"></input>
        `;return o.html`
            <style>

            :host([inline]), [inline] {
                display: inline-block;
            }

            :host([inline]) .range-slider label,
            :host([inline]) input[type="range"],
            *[inline] .range-slider label,
            *[inline] input[type="range"] {
                display: inline-block;
                max-width: 50%;
                vertical-align: middle;
            }

            :host([inline]) .range-slider label,
            *[inline] .range-slider label {
                padding: 0;
                padding-right: 4px;
                flex-shrink: 1;
                display: flex;
                align-self: flex-start;
            }




            input[type="range"]{
                -webkit-appearance: none;
                -moz-apperance: none;
                height: 19px;
                width: 100%;
                display: block;
                border-top: 8px solid var(--background-color, white);
                border-bottom: 8px solid var(--background-color, white);
                box-sizing: border-box;
                background-image: -webkit-gradient(
                    linear,
                    left top,
                    right top,
                    color-stop(${""!==s?u(t,n,r,s):.5}, ${i.accentColor}),
                    color-stop(${""!==s?u(t,n,r,s):.5}, #D8D8D8)
                );
                margin: 0px;
            }



            input[type='range']::-webkit-slider-thumb {
                -webkit-appearance: none !important;
                background-color: ${i.accentColor};
                height: 18px;
                width: 18px;
                border-radius: 50%;
            }

            input[type='range']::-moz-range-thumb {
                -webkit-appearance: none !important;
                background-color: ${i.accentColor};
                height: 18px;
                width: 18px;
                border-radius: 50%;
                border: none;
            }

            input[type='range']::-moz-range-track  {
                width: 100%;
                height: 0px;
            }

            .range-slider label {
                float: left;
                display: ${this.inlineLabel?"inline-block":"block"};
                color: ${i.labelColor};
                flex-shrink: auto;
            }

            [inline] #input-container {
                display: flex;
                flex-direction: row;
                flex-shrink: auto;
            }

            [inline] input[type="range"] {
                padding-right: 16px;
            }

            #input-container {
                position: relative;
                height: 30px;
                display: block;
                overflow: hidden;
                padding-right: 5px;
                padding-top: 1px;
                padding-left: 14px;
            }

            .range-slider__range[disabled] {
                pointer-events: none;
                opacity: 0.5;
            }
            </style>

            <div class="range-slider">
                ${this.labelHtml}
                ${this.inlineLabel?o.html`<span id="input-container">${c}</span>`:c}
            </div>
        `}}r([a.property({type:String})],c.prototype,"name",void 0),r([a.property({type:String})],c.prototype,"label",void 0),r([a.property({type:String})],c.prototype,"min",void 0),r([a.property({type:String})],c.prototype,"max",void 0),r([a.property({type:String})],c.prototype,"step",void 0),r([a.property({type:String})],c.prototype,"value",void 0),r([a.property({type:Boolean})],c.prototype,"inlineLabel",void 0),r([a.property({type:Boolean})],c.prototype,"disabled",void 0),customElements.define("acc-range",c)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),o=n(3);class a extends i.LitElement{constructor(){super(...arguments),this.label="",this.disabled=!1}_render({label:e}){return i.html`
            <style>
                :host {
                    display: none;
                }
            </style>
            <span aria-label=${e}>${e}</span>
        `}}r([o.property({type:String})],a.prototype,"label",void 0),r([o.property({type:Boolean})],a.prototype,"disabled",void 0),t.OptgroupElement=a,customElements.define("acc-optgroup",a)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),o=n(3);class a extends i.LitElement{constructor(){super(...arguments),this.icon="",this.name="",this.label="",this.value="",this.selected=!1,this.disabled=!1}_propertiesChanged(e,t,n){return t&&this.dispatchEvent(new CustomEvent("change",{detail:{changed:t,previous:n}})),super._propertiesChanged(e,t,n)}_render(e){return i.html``}}r([o.property({type:String})],a.prototype,"icon",void 0),r([o.property({type:String})],a.prototype,"name",void 0),r([o.property({type:String})],a.prototype,"label",void 0),r([o.property({type:String})],a.prototype,"value",void 0),r([o.property({type:Boolean})],a.prototype,"selected",void 0),r([o.property({type:Boolean})],a.prototype,"disabled",void 0),t.ItemElement=a,customElements.define("acc-item",a)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(6),o=n(1),a=n(3),s=n(14);class u extends o.LitElement{constructor(){super(...arguments),this.duration=3,this.dismissable=!1,this.error=!1,this.message=""}get open(){return this.hasAttribute("open")}connectedCallback(){super.connectedCallback(),this.addEventListener("show",()=>{if(this.error){const e=this.shadowRoot.querySelector("p");setTimeout(()=>{e.focus()},10)}})}_propertiesChanged(e,t={},n={}){super._propertiesChanged(e,t,n),t.message&&this.show()}show(){const e=this.__lastMessageChange=Date.now();this.setAttribute("open","true"),this.duration>0&&!this.error&&setTimeout(()=>{this.__lastMessageChange===e&&this.hide()},1e3*this.duration),this.dispatchEvent(new CustomEvent("show"))}hide(){this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("hide")),this.__previousFocus&&this.error&&this.__previousFocus.focus(),this.__previousFocus=null}_didRender(){const e=this.shadowRoot.querySelector("p");e.innerHTML=this.message,e.setAttribute("tabindex","0");const t=document.activeElement;t===this||t===document.body||!t||t instanceof s.AbstractModalElement||(this.__previousFocus=t)}_render({duration:e,message:t}){return o.html`
            <style>
                :host([open]) {
                    display: block;
                    opacity: 1;
                }

                :host {
                    display: none;
                    box-shadow: 1px 1px rgba(0, 0, 0, 0.25);
                    position: fixed;
                    bottom: 40px;
                    left: 50%;
                    transform: translate(-50%, 0%);
                    background-color: ${i.backgroundColor};
                    border: 1px solid rgba(0,0,0,0.25);
                    color: ${i.labelColor};
                    min-width: 100px;
                    text-align: center;
                    z-index: 10000;
                    opacity: 0;
                    transition: opacity 1s ease-in;
                }

                .container {
                    display: flex;
                    padding: 0 16px;
                }

                .container[error]{
                    border: 2px solid red;
                    background-color: rgba(255, 0, 0, 0.31);
                }

                strong {
                    color: ${i.accentColor};
                }

                .column {
                    display: inline-flex;
                    box-sizing: border-box;
                    padding: 0 8px;
                }

                .left {
                    max-width: 75%;
                }

                .right {
                    text-align: right;
                    margin-left: 50px;
                }

                p {
                    min-width: 100%;
                    float: left;
                }
                
                .left p {
                    min-width: 75%;
                }

                button {
                    font-size: 100%;
                    cursor: pointer;
                    float: left;
                    border: 0;
                    color: ${i.accentColor};
                    font-weight: bold;
                    background-color: transparent;
                }

            </style>
            <div class="container" error?=${this.error}>
                ${this.dismissable?o.html`
                        <div class="column left">
                            <p aria-atomic="true" aria-live="assertive"></p>
                        </div>
                        <div class="column right">
                            <button on-click=${()=>this.hide()}>DISMISS</button>
                        </div>
                    `:o.html`<p aria-atomic="true" aria-live="assertive"></p>`}
            </div>
        `}}r([a.property({type:Number})],u.prototype,"duration",void 0),r([a.property({type:Boolean})],u.prototype,"dismissable",void 0),r([a.property({type:Boolean})],u.prototype,"error",void 0),r([a.property({type:String})],u.prototype,"message",void 0),t.SnackBarElement=u,customElements.define("acc-snackbar",u)},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"version",function(){return Ci}),n.d(r,"setBackend",function(){return i.fd}),n.d(r,"getBackend",function(){return i.yb}),n.d(r,"disposeVariables",function(){return i.gb}),n.d(r,"memory",function(){return i.gc}),n.d(r,"version_core",function(){return i.de}),n.d(r,"nextFrame",function(){return i.tc}),n.d(r,"environment",function(){return i.lb}),n.d(r,"io",function(){return i.Hb}),n.d(r,"serialization",function(){return i.ed}),n.d(r,"test_util",function(){return i.Nd}),n.d(r,"util",function(){return i.Yd}),n.d(r,"webgl",function(){return i.ee}),n.d(r,"AdadeltaOptimizer",function(){return i.a}),n.d(r,"AdagradOptimizer",function(){return i.b}),n.d(r,"AdamOptimizer",function(){return i.c}),n.d(r,"AdamaxOptimizer",function(){return i.d}),n.d(r,"MomentumOptimizer",function(){return i.g}),n.d(r,"Optimizer",function(){return i.h}),n.d(r,"RMSPropOptimizer",function(){return i.i}),n.d(r,"SGDOptimizer",function(){return i.l}),n.d(r,"Tensor",function(){return i.m}),n.d(r,"TensorBuffer",function(){return i.n}),n.d(r,"variable",function(){return i.be}),n.d(r,"Variable",function(){return i.o}),n.d(r,"Rank",function(){return i.j}),n.d(r,"Reduction",function(){return i.k}),n.d(r,"ENV",function(){return i.e}),n.d(r,"Environment",function(){return i.f}),n.d(r,"image",function(){return i.Gb}),n.d(r,"linalg",function(){return i.Ob}),n.d(r,"losses",function(){return i.Zb}),n.d(r,"op",function(){return i.Ac}),n.d(r,"batchNormalization2d",function(){return i.H}),n.d(r,"batchNormalization3d",function(){return i.I}),n.d(r,"batchNormalization4d",function(){return i.J}),n.d(r,"batchNormalization",function(){return i.G}),n.d(r,"complex",function(){return i.Q}),n.d(r,"real",function(){return i.Qc}),n.d(r,"imag",function(){return i.Fb}),n.d(r,"concat",function(){return i.R}),n.d(r,"concat1d",function(){return i.S}),n.d(r,"concat2d",function(){return i.T}),n.d(r,"concat3d",function(){return i.U}),n.d(r,"concat4d",function(){return i.V}),n.d(r,"split",function(){return i.sd}),n.d(r,"conv1d",function(){return i.W}),n.d(r,"conv2d",function(){return i.X}),n.d(r,"depthwiseConv2d",function(){return i.eb}),n.d(r,"separableConv2d",function(){return i.dd}),n.d(r,"conv2dTranspose",function(){return i.Y}),n.d(r,"matMul",function(){return i.ac}),n.d(r,"dot",function(){return i.jb}),n.d(r,"outerProduct",function(){return i.Bc}),n.d(r,"reverse",function(){return i.Uc}),n.d(r,"reverse1d",function(){return i.Vc}),n.d(r,"reverse2d",function(){return i.Wc}),n.d(r,"reverse3d",function(){return i.Xc}),n.d(r,"reverse4d",function(){return i.Yc}),n.d(r,"maxPool",function(){return i.cc}),n.d(r,"avgPool",function(){return i.E}),n.d(r,"slice",function(){return i.kd}),n.d(r,"slice1d",function(){return i.ld}),n.d(r,"slice2d",function(){return i.md}),n.d(r,"slice3d",function(){return i.nd}),n.d(r,"slice4d",function(){return i.od}),n.d(r,"abs",function(){return i.p}),n.d(r,"acos",function(){return i.q}),n.d(r,"acosh",function(){return i.r}),n.d(r,"asin",function(){return i.z}),n.d(r,"asinh",function(){return i.A}),n.d(r,"atan",function(){return i.B}),n.d(r,"atanh",function(){return i.D}),n.d(r,"ceil",function(){return i.N}),n.d(r,"clipByValue",function(){return i.O}),n.d(r,"cos",function(){return i.Z}),n.d(r,"cosh",function(){return i.ab}),n.d(r,"erf",function(){return i.ob}),n.d(r,"exp",function(){return i.pb}),n.d(r,"expm1",function(){return i.rb}),n.d(r,"floor",function(){return i.ub}),n.d(r,"log",function(){return i.Rb}),n.d(r,"log1p",function(){return i.Sb}),n.d(r,"logSigmoid",function(){return i.Tb}),n.d(r,"neg",function(){return i.sc}),n.d(r,"reciprocal",function(){return i.Rc}),n.d(r,"round",function(){return i.Zc}),n.d(r,"rsqrt",function(){return i.ad}),n.d(r,"sigmoid",function(){return i.gd}),n.d(r,"sign",function(){return i.hd}),n.d(r,"sin",function(){return i.id}),n.d(r,"sinh",function(){return i.jd}),n.d(r,"softplus",function(){return i.qd}),n.d(r,"sqrt",function(){return i.td}),n.d(r,"square",function(){return i.ud}),n.d(r,"step",function(){return i.zd}),n.d(r,"tan",function(){return i.Ed}),n.d(r,"tanh",function(){return i.Fd}),n.d(r,"all",function(){return i.v}),n.d(r,"any",function(){return i.w}),n.d(r,"argMax",function(){return i.x}),n.d(r,"argMin",function(){return i.y}),n.d(r,"logSumExp",function(){return i.Ub}),n.d(r,"max",function(){return i.bc}),n.d(r,"mean",function(){return i.fc}),n.d(r,"min",function(){return i.hc}),n.d(r,"moments",function(){return i.mc}),n.d(r,"sum",function(){return i.Dd}),n.d(r,"equal",function(){return i.mb}),n.d(r,"equalStrict",function(){return i.nb}),n.d(r,"greater",function(){return i.Bb}),n.d(r,"greaterEqual",function(){return i.Cb}),n.d(r,"greaterEqualStrict",function(){return i.Db}),n.d(r,"greaterStrict",function(){return i.Eb}),n.d(r,"less",function(){return i.Kb}),n.d(r,"lessEqual",function(){return i.Lb}),n.d(r,"lessEqualStrict",function(){return i.Mb}),n.d(r,"lessStrict",function(){return i.Nb}),n.d(r,"notEqual",function(){return i.vc}),n.d(r,"notEqualStrict",function(){return i.wc}),n.d(r,"add",function(){return i.s}),n.d(r,"addN",function(){return i.t}),n.d(r,"addStrict",function(){return i.u}),n.d(r,"atan2",function(){return i.C}),n.d(r,"div",function(){return i.hb}),n.d(r,"divStrict",function(){return i.ib}),n.d(r,"floorDiv",function(){return i.vb}),n.d(r,"maximum",function(){return i.dc}),n.d(r,"maximumStrict",function(){return i.ec}),n.d(r,"minimum",function(){return i.ic}),n.d(r,"minimumStrict",function(){return i.jc}),n.d(r,"mod",function(){return i.kc}),n.d(r,"modStrict",function(){return i.lc}),n.d(r,"mul",function(){return i.oc}),n.d(r,"mulStrict",function(){return i.pc}),n.d(r,"pow",function(){return i.Hc}),n.d(r,"powStrict",function(){return i.Ic}),n.d(r,"squaredDifference",function(){return i.vd}),n.d(r,"squaredDifferenceStrict",function(){return i.wd}),n.d(r,"sub",function(){return i.Bd}),n.d(r,"subStrict",function(){return i.Cd}),n.d(r,"elu",function(){return i.kb}),n.d(r,"leakyRelu",function(){return i.Jb}),n.d(r,"prelu",function(){return i.Jc}),n.d(r,"relu",function(){return i.Sc}),n.d(r,"selu",function(){return i.cd}),n.d(r,"logicalAnd",function(){return i.Vb}),n.d(r,"logicalNot",function(){return i.Wb}),n.d(r,"logicalOr",function(){return i.Xb}),n.d(r,"logicalXor",function(){return i.Yb}),n.d(r,"where",function(){return i.fe}),n.d(r,"whereAsync",function(){return i.ge}),n.d(r,"buffer",function(){return i.L}),n.d(r,"toPixels",function(){return i.Rd}),n.d(r,"print",function(){return i.Kc}),n.d(r,"batchToSpaceND",function(){return i.K}),n.d(r,"cast",function(){return i.M}),n.d(r,"clone",function(){return i.P}),n.d(r,"cumsum",function(){return i.bb}),n.d(r,"depthToSpace",function(){return i.db}),n.d(r,"expandDims",function(){return i.qb}),n.d(r,"eye",function(){return i.sb}),n.d(r,"fromPixels",function(){return i.wb}),n.d(r,"multinomial",function(){return i.rc}),n.d(r,"oneHot",function(){return i.xc}),n.d(r,"pad",function(){return i.Cc}),n.d(r,"pad1d",function(){return i.Dc}),n.d(r,"pad2d",function(){return i.Ec}),n.d(r,"pad3d",function(){return i.Fc}),n.d(r,"pad4d",function(){return i.Gc}),n.d(r,"rand",function(){return i.Mc}),n.d(r,"randomNormal",function(){return i.Nc}),n.d(r,"randomUniform",function(){return i.Oc}),n.d(r,"reshape",function(){return i.Tc}),n.d(r,"spaceToBatchND",function(){return i.rd}),n.d(r,"squeeze",function(){return i.xd}),n.d(r,"stack",function(){return i.yd}),n.d(r,"tile",function(){return i.Pd}),n.d(r,"truncatedNormal",function(){return i.Vd}),n.d(r,"unstack",function(){return i.Xd}),n.d(r,"fill",function(){return i.tb}),n.d(r,"linspace",function(){return i.Pb}),n.d(r,"ones",function(){return i.yc}),n.d(r,"range",function(){return i.Pc}),n.d(r,"scalar",function(){return i.bd}),n.d(r,"tensor",function(){return i.Gd}),n.d(r,"tensor1d",function(){return i.Hd}),n.d(r,"tensor2d",function(){return i.Id}),n.d(r,"tensor3d",function(){return i.Jd}),n.d(r,"tensor4d",function(){return i.Kd}),n.d(r,"tensor5d",function(){return i.Ld}),n.d(r,"tensor6d",function(){return i.Md}),n.d(r,"zeros",function(){return i.he}),n.d(r,"onesLike",function(){return i.zc}),n.d(r,"zerosLike",function(){return i.ie}),n.d(r,"transpose",function(){return i.Ud}),n.d(r,"softmax",function(){return i.pd}),n.d(r,"localResponseNormalization",function(){return i.Qb}),n.d(r,"norm",function(){return i.uc}),n.d(r,"gather",function(){return i.xb}),n.d(r,"unsortedSegmentSum",function(){return i.Wd}),n.d(r,"basicLSTMCell",function(){return i.F}),n.d(r,"multiRNNCell",function(){return i.qc}),n.d(r,"movingAverage",function(){return i.nc}),n.d(r,"stridedSlice",function(){return i.Ad}),n.d(r,"topk",function(){return i.Sd}),n.d(r,"train",function(){return i.Td}),n.d(r,"tidy",function(){return i.Od}),n.d(r,"keep",function(){return i.Ib}),n.d(r,"dispose",function(){return i.fb}),n.d(r,"time",function(){return i.Qd}),n.d(r,"profile",function(){return i.Lc}),n.d(r,"customGrad",function(){return i.cb}),n.d(r,"grad",function(){return i.zb}),n.d(r,"grads",function(){return i.Ab}),n.d(r,"valueAndGrad",function(){return i.Zd}),n.d(r,"valueAndGrads",function(){return i.ae}),n.d(r,"variableGrads",function(){return i.ce}),n.d(r,"constraints",function(){return Y}),n.d(r,"initializers",function(){return Xe}),n.d(r,"layers",function(){return _i}),n.d(r,"metrics",function(){return wi}),n.d(r,"regularizers",function(){return xi}),n.d(r,"CallbackList",function(){return gt}),n.d(r,"CustomCallback",function(){return _t}),n.d(r,"History",function(){return vt}),n.d(r,"Callback",function(){return Ei}),n.d(r,"SymbolicTensor",function(){return st}),n.d(r,"Model",function(){return En}),n.d(r,"input",function(){return Nn}),n.d(r,"loadModel",function(){return Mn}),n.d(r,"model",function(){return On}),n.d(r,"registerCallbackConstructor",function(){return kn}),n.d(r,"sequential",function(){return An}),n.d(r,"RNN",function(){return Xr}),n.d(r,"Sequential",function(){return Cn}),n.d(r,"LayerVariable",function(){return rt}),n.d(r,"version_layers",function(){return sn}),n.d(r,"FrozenModel",function(){return Si.a}),n.d(r,"loadFrozenModel",function(){return Si.b}),n.d(r,"version_converter",function(){return Si.c});var i=n(0),o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};
/**
 * @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.
 * =============================================================================
 */function a(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e};function u(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})}function c(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var l=i.e.get("EPSILON");function h(){return l}var d=0;function f(){return d++}var p={};function m(e){return void 0===e&&(e=""),e in p||(p[e]=0),p[e]+=1,e+p[e].toString()}var g={float32:{},int32:{}},b="float32";function y(e,t){return void 0===t&&(t=b),null==g[t][e]&&(g[t][e]=Object(i.bd)(e,t),Object(i.Ib)(g[t][e])),g[t][e]}var v=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return a(t,e),t}(Error),_=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return a(t,e),t}(Error),w=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return a(t,e),t}(Error),x=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return a(t,e),t}(Error),E=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return a(t,e),t}(Error);!function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}a(t,e)}(Error);function S(e,t){if(Array.isArray(e)){for(var n=[],r=0;r<t;r++)n=n.concat(e);return n}return(n=new Array(t)).fill(e),n}function C(e,t){if(!e)throw new E(t)}function O(e,t){for(var n=0,r=0,i=e;r<i.length;r++)i[r]===t&&n++;return n}function A(e){return 1===e.length?e[0]:e}function M(e){return Array.isArray(e)?e:[e]}function N(e){var t=e.replace(/(.)([A-Z][a-z0-9]+)/g,"$1_$2").replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase();return"_"!==t[0]?t:"private"+t}function k(e){return e.length<=1?e:-1===e.indexOf("_")?e:e.replace(/[_]+(\w|$)/g,function(e,t){return t.toUpperCase()})}var I={};function T(e){return null===e||void 0===e?null:{className:e.getClassName(),config:e.getConfig()}}function P(e,t,n,r){if(void 0===t&&(t={}),void 0===n&&(n={}),void 0===r&&(r="object"),"string"==typeof e){var i=e,o=void 0;if(i in n)o=n[i];else if(i in I)o=I[i];else if(null==(o=t[i]))throw new w("Unknown "+r+": "+e+". 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 o}var a=e;if(null==a.className||null==a.config)throw new w(r+": Improper config format: "+JSON.stringify(a)+".\n'className' and 'config' must set.");var u,c,l,h=a.className,d=void 0,f=void 0;if(h in n?(d=(u=n.get(h))[0],f=u[1]):h in I?(d=(c=I.className)[0],f=c[1]):h in t&&(d=(l=t[h])[0],f=l[1]),null==d)throw new w("Unknown "+r+": "+h+". 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!=f){for(var p={},m=0,g=Object.keys(I);m<g.length;m++)p[E=g[m]]=I[E];for(var b=0,y=Object.keys(n);b<y.length;b++)p[E=y[b]]=n[E];a.config.customObjects=p;for(var v=s({},I),_=0,x=Object.keys(n);_<x.length;_++){var E=x[_];I[E]=n[E]}var S=f(d,a.config);return I=s({},v),S}v=s({},I);for(var C=0,O=Object.keys(n);C<O.length;C++)E=O[C],I[E]=n[E];return S=new d(a.config),I=s({},v),S}function R(e,t){return-1*function(e,t){return e<t?-1:e>t?1:0}(e,t)}function D(e){if(null==e)return e;for(var t=[],n=0,r=e;n<r.length;n++){var i=r[n];-1===t.indexOf(i)&&t.push(i)}return t}function L(e){if(null==e)throw new w("Invalid value in obj: "+JSON.stringify(e));for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}function B(e,t,n){if(null!=n&&e.indexOf(n)<0)throw new w(n+" is not a valid "+t+".  Valid values are "+e+" or null/undefined.")}function j(e,t,n,r){return void 0===n&&(n=0),void 0===r&&(r=1/0),C(n>=0),C(r>=n),Array.isArray(e)&&e.length>=n&&e.length<=r&&e.every(function(e){return typeof e===t})}function F(e,t){return Object(i.Od)(function(){return Object(i.td)(Object(i.Dd)(Object(i.pc)(e,e),t,!0))})}var z=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.getConfig=function(){return{}},t}(i.ed.Serializable),V=function(e){function t(t){var n=e.call(this)||this;return n.defaultMaxValue=2,n.defaultAxis=0,n.maxValue=null!=t.maxValue?t.maxValue:n.defaultMaxValue,n.axis=null!=t.axis?t.axis:n.defaultAxis,n}return a(t,e),t.prototype.apply=function(e){var t=this;return Object(i.Od)(function(){var n=F(e,t.axis),r=Object(i.O)(n,0,t.maxValue);return Object(i.oc)(e,Object(i.hb)(r,Object(i.s)(y(h()),n)))})},t.prototype.getConfig=function(){return{maxValue:this.maxValue,axis:this.axis}},t.className="MaxNorm",t}(z);i.ed.registerClass(V);var U=function(e){function t(t){var n=e.call(this)||this;return n.defaultAxis=0,n.axis=null!=t.axis?t.axis:n.defaultAxis,n}return a(t,e),t.prototype.apply=function(e){var t=this;return Object(i.Od)(function(){return Object(i.hb)(e,Object(i.s)(y(h()),F(e,t.axis)))})},t.prototype.getConfig=function(){return{axis:this.axis}},t.className="UnitNorm",t}(z);i.ed.registerClass(U);var W=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.apply=function(e){return Object(i.Sc)(e)},t.className="NonNeg",t}(z);i.ed.registerClass(W);var $=function(e){function t(t){var n=e.call(this)||this;return n.defaultMinValue=0,n.defaultMaxValue=1,n.defaultRate=1,n.defaultAxis=0,n.minValue=null!=t.minValue?t.minValue:n.defaultMinValue,n.maxValue=null!=t.maxValue?t.maxValue:n.defaultMaxValue,n.rate=null!=t.rate?t.rate:n.defaultRate,n.axis=null!=t.axis?t.axis:n.defaultAxis,n}return a(t,e),t.prototype.apply=function(e){var t=this;return Object(i.Od)(function(){var n=F(e,t.axis),r=Object(i.s)(Object(i.oc)(y(t.rate),Object(i.O)(n,t.minValue,t.maxValue)),Object(i.oc)(y(1-t.rate),n));return Object(i.oc)(e,Object(i.hb)(r,Object(i.s)(y(h()),n)))})},t.prototype.getConfig=function(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}},t.className="MinMaxNorm",t}(z);i.ed.registerClass($);var q={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function H(e){return T(e)}function G(e,t){return void 0===t&&(t={}),P(e,i.ed.SerializationMap.getMap().classNameMap,t,"constraint")}function K(e){return null==e?null:"string"==typeof e?G({className:e in q?q[e]:e,config:{}}):e instanceof z?e:G(e)}var Y=Object.freeze({maxNorm:function(e){return new V(e)},unitNorm:function(e){return new U(e)},nonNeg:function(){return new W},minMaxNorm:function(e){return new $(e)}}),X=new Map,Z=["channelsFirst","channelsLast"];function J(e){B(Z,"DataFormat",e)}var Q=["valid","same","causal"];function ee(e){B(Q,"PaddingMode",e)}var te=["max","avg"];var ne=[],re="/";function ie(e,t){ne.push(e);try{var n=t();return ne.pop(),n}catch(e){throw ne.pop(),e}}function oe(e){if(!ue(e))throw new Error("Not a valid tensor name: '"+e+"'");return(0===ne.length?"":ne.join(re)+re)+e}function ae(e){if(!ue(e))throw new Error("Not a valid tensor name: '"+e+"'");X.has(e)||X.set(e,0);var t=X.get(e);if(X.set(e,X.get(e)+1),t>0){var n=e+"_"+t;return X.set(n,1),n}return e}var se=new RegExp(/^[A-Za-z][A-Za-z0-9\._\/]*$/);function ue(e){return!!e.match(se)}function ce(e){return e===parseInt(e.toString(),10)}function le(e,t,n){null==t&&(t=0),null==n&&(n=e.length);for(var r=1,i=t;i<n;++i)r*=e[i];return r}function he(e){return e=Array.isArray(e)?new Float32Array(e):e,Object(i.Hd)(e)}function de(e){return Object(i.hc)(he(e)).dataSync()[0]}function fe(e){return Object(i.bc)(he(e)).dataSync()[0]}function pe(e,t){if(t<e)throw new w("end ("+t+") < begin ("+e+") is forbidden.");for(var n=[],r=e;r<t;++r)n.push(r);return n}function me(e,t){return e.asType(t)}function ge(e,t){void 0===t&&(t=-1);var n=e.shape.slice();return t<0&&(t=n.length+t+1),n.splice(t,0,1),e.reshape(n)}function be(e,t,n){return Object(i.Od)(function(){switch(e.rank){case 1:return Object(i.ld)(e,t,n);case 2:return Object(i.md)(e,[t,0],[n,e.shape[1]]);case 3:return Object(i.nd)(e,[t,0,0],[n,e.shape[1],e.shape[2]]);case 4:return Object(i.od)(e,[t,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3]]);default:throw new w("sliceAlongFirstAxis() received an unsupported tensor rank: "+e.rank)}})}function ye(e,t,n){return Object(i.Od)(function(){switch(e.rank){case 1:return Object(i.ld)(e,t,n);case 2:return Object(i.md)(e,[0,t],[e.shape[0],n]);case 3:return Object(i.nd)(e,[0,0,t],[e.shape[0],e.shape[1],n]);case 4:return Object(i.od)(e,[0,0,0,t],[e.shape[0],e.shape[1],e.shape[2],n]);default:throw new w("sliceAlongLastAxis() received an unsupported tensor rank: "+e.rank)}})}function ve(e,t,n,r){return Object(i.Od)(function(){switch(e.rank){case 1:return Object(i.ld)(e,t,n);case 2:switch(r){case 1:return be(e,t,n);case 2:return ye(e,t,n);default:throw new w("The axis is not within the rank of the tensor "+r)}case 3:switch(r){case 1:return be(e,t,n);case 2:return Object(i.nd)(e,[0,t,0],[e.shape[0],n,e.shape[2]]);case 3:return ye(e,t,n);default:throw new w("The axis is not within the rank of the tensor "+r)}case 4:switch(r){case 1:return be(e,t,n);case 2:return Object(i.od)(e,[0,t,0,0],[e.shape[0],n,e.shape[2],e.shape[3]]);case 3:return Object(i.od)(e,[0,0,t,0],[e.shape[0],e.shape[1],n,e.shape[3]]);case 4:return ye(e,t,n);default:throw new w("The axis is not within the rank of the tensor "+r)}default:throw new w("sliceAlongLastAxis() received an unsupported tensor rank: "+e.rank)}})}function _e(e,t){var n;return void 0===t&&(t=-1),t<0&&(t=0!==(n=e[0].rank)?n:0),t===e[0].rank&&(t=-1),Object(i.R)(e,t)}function we(e,t){switch(e.rank){case 1:return Object(i.S)([e,t]);case 2:return Object(i.T)([e,t],0);case 3:return Object(i.U)([e,t],0);case 4:return Object(i.V)([e,t],0);default:throw new w("concatAlongFirstAxis() received an unsupported tensor rank: "+e.rank)}}function xe(e,t){if(Array.isArray(t)||(t=[t]),e.rank!==t.length)throw new w("The length of input n ("+t.length+") does not match the number of dimensions in input x ("+e.rank+")");return Object(i.Pd)(e,t)}function Ee(e,t,n,r,o){return void 0===t&&(t=0),void 0===n&&(n=1),Object(i.Nc)(e,t,n,r,o)}function Se(e,t){if(e.rank<2||t.rank<2)throw new x("dot requires both inputs to be rank >= 2 but got x shape = "+e.shape+" and y shape = "+t.shape);if(t.rank>=3&&(r=e.shape.slice(-1)[0])!==(s=t.shape.slice(-2)[0]))throw new x("If rank y >= 3, then the second last dim of y must equal the last dim of x but got x shape = "+e.shape+" and  y shape = "+t.shape);if(2===e.rank&&2===t.rank)return Object(i.ac)(e,t);var n=e.shape.slice(),r=n.pop();e=e.reshape([-1,r]);var o=t.shape.slice(),a=o.pop(),s=o.pop(),u=o.concat([a]),c=Array.from({length:t.rank},function(e,n){return 0===n?t.rank-2:n<=t.rank-2?n-1:n});t=t.transpose(c).reshape([s,-1]);var l=n.concat(u);return Object(i.ac)(e,t).reshape(l)}function Ce(e,t,n){return Object(i.Od)(function(){return t=Array.isArray(t)?Object(i.Hd)(t,"int32"):t.toInt(),Object(i.xb)(e,t,n)})}function Oe(e){return Object(i.pc)(e,e)}function Ae(e,t,n){return Object(i.Od)(function(){if(null==n&&(n="channelsLast"),J(n),1!==t.rank&&t.rank!==e.rank)throw new w("Unexpected bias dimensions: "+t.rank+"; expected it to be 1 or "+e.rank);var r,i=t.shape;if(5===e.rank)"channelsFirst"===n?r=1===i.length?e.add(t.reshape([1,i[0],1,1,1])):e.add(t.reshape([1,i[3],i[0],i[1],i[2]])):"channelsLast"===n&&(r=1===i.length?e.add(t.reshape([1,1,1,1,i[0]])):e.add(t.reshape([1].concat(i))));else if(4===e.rank)"channelsFirst"===n?r=1===i.length?e.add(t.reshape([1,i[0],1,1])):e.add(t.reshape([1,i[2],i[0],i[1]])):"channelsLast"===n&&(r=1===i.length?e.add(t.reshape([1,1,1,i[0]])):e.add(t.reshape([1].concat(i))));else if(3===e.rank)"channelsFirst"===n?r=1===i.length?e.add(t.reshape([1,i[0],1])):e.add(t.reshape([1,i[1],i[0]])):"channelsLast"===n&&(r=1===i.length?e.add(t.reshape([1,1,i[0]])):e.add(t.reshape([1].concat(i))));else{if(!(e.rank<3))throw new w("Unsupported input rank by biasAdd: "+e.rank);r=e.add(t)}return r})}function Me(e,t,n,r){return Object(i.Od)(function(){if(null!=n&&!i.Yd.arraysEqual(e.shape,n))throw new x("Non-default noise shape is not implemented yet: "+JSON.stringify(n));if(null!=r)throw new x("seed is not implemented for dropout yet.");var o=Object(i.zd)(Object(i.s)(Object(i.sc)(t),Object(i.Oc)(e.shape,0,1,"float32")));return o=Object(i.oc)(Object(i.hb)(y(1),Object(i.Bd)(y(1),t)),o),Object(i.oc)(e,o)})}function Ne(e,t,n){return void 0===n&&(n=!1),n?e():t()}var ke=["fanIn","fanOut","fanAvg"];var Ie=["normal","uniform"];var Te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.fromConfigUsesCustomObjects=function(){return!1},t.prototype.getConfig=function(){return{}},t}(i.ed.Serializable),Pe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.apply=function(e,t){return Object(i.he)(e,t)},t.className="Zeros",t}(Te);i.ed.registerClass(Pe);var Re=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.apply=function(e,t){return Object(i.yc)(e,t)},t.className="Ones",t}(Te);i.ed.registerClass(Re);var De=function(e){function t(t){var n=e.call(this)||this;if("object"!=typeof t)throw new w("Expected argument of type ConstantConfig but got "+t);if(void 0===t.value)throw new w("config must have value set but got "+t);return n.value=t.value,n}return a(t,e),t.prototype.apply=function(e,t){var n=this;return Object(i.Od)(function(){return Object(i.oc)(Object(i.bd)(n.value),Object(i.yc)(e,t))})},t.prototype.getConfig=function(){return{value:this.value}},t.className="Constant",t}(Te);i.ed.registerClass(De);var Le=function(e){function t(t){var n=e.call(this)||this;return n.DEFAULT_MINVAL=-.05,n.DEFAULT_MAXVAL=.05,n.minval=t.minval||n.DEFAULT_MINVAL,n.maxval=t.maxval||n.DEFAULT_MAXVAL,n.seed=t.seed,n}return a(t,e),t.prototype.apply=function(e,t){return Object(i.Oc)(e,this.minval,this.maxval,t)},t.prototype.getConfig=function(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}},t.className="RandomUniform",t}(Te);i.ed.registerClass(Le);var Be=function(e){function t(t){var n=e.call(this)||this;return n.DEFAULT_MEAN=0,n.DEFAULT_STDDEV=.05,n.mean=t.mean||n.DEFAULT_MEAN,n.stddev=t.stddev||n.DEFAULT_STDDEV,n.seed=t.seed,n}return a(t,e),t.prototype.apply=function(e,t){if("float32"!==(t=t||"float32")&&"int32"!==t)throw new x("randomNormal does not support dType "+t+".");return Ee(e,this.mean,this.stddev,t,this.seed)},t.prototype.getConfig=function(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}},t.className="RandomNormal",t}(Te);i.ed.registerClass(Be);var je=function(e){function t(t){var n=e.call(this)||this;return n.DEFAULT_MEAN=0,n.DEFAULT_STDDEV=.05,n.mean=t.mean||n.DEFAULT_MEAN,n.stddev=t.stddev||n.DEFAULT_STDDEV,n.seed=t.seed,n}return a(t,e),t.prototype.apply=function(e,t){if("float32"!==(t=t||"float32")&&"int32"!==t)throw new x("truncatedNormal does not support dType "+t+".");return Object(i.Vd)(e,this.mean,this.stddev,t,this.seed)},t.prototype.getConfig=function(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}},t.className="TruncatedNormal",t}(Te);i.ed.registerClass(je);var Fe=function(e){function t(t){var n=e.call(this)||this;return n.gain=null!=t.gain?Object(i.bd)(t.gain):y(1),n}return a(t,e),t.prototype.apply=function(e,t){var n=this;return Object(i.Od)(function(){if(2!==e.length||e[0]!==e[1])throw new w("Identity matrix initializer can only be used for 2D square matrices.");return Object(i.oc)(n.gain,Object(i.sb)(e[0]))})},t.prototype.getConfig=function(){return{gain:this.gain.get()}},t.className="Identity",t}(Te);i.ed.registerClass(Fe);var ze=function(e){function t(t){var n=e.call(this)||this;if(t.scale<0)throw new w("scale must be a positive float. Got: "+t.scale);return n.scale=null==t.scale?1:t.scale,n.mode=t.mode,function(e){B(ke,"FanMode",e)}(n.mode),n.distribution=t.distribution,function(e){B(Ie,"Distribution",e)}(n.distribution),n.seed=t.seed,n}return a(t,e),t.prototype.apply=function(e,t){var n=function(e,t){var n,r;if(void 0===t&&(t="channelsLast"),J(t),2===e.length)n=e[0],r=e[1];else if(-1!==[3,4,5].indexOf(e.length))if("channelsFirst"===t){var i=le(e,2);n=e[1]*i,r=e[0]*i}else"channelsLast"===t&&(i=le(e,0,e.length-2),n=e[e.length-2]*i,r=e[e.length-1]*i);else{var o=le(e);n=Math.sqrt(o),r=Math.sqrt(o)}return[n,r]}(e),r=n[0],o=n[1],a=this.scale;if("fanIn"===this.mode?a/=Math.max(1,r):"fanOut"===this.mode?a/=Math.max(1,o):a/=Math.max(1,(r+o)/2),"normal"===this.distribution){var s=Math.sqrt(a);if("float32"!==(t=t||"float32")&&"int32"!==t)throw new x(this.getClassName()+" does not support dType "+t+".");return Object(i.Vd)(e,0,s,t,this.seed)}var u=Math.sqrt(3*a);return Object(i.Oc)(e,-u,u,t)},t.prototype.getConfig=function(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}},t.className="VarianceScaling",t}(Te);i.ed.registerClass(ze);var Ve=function(e){function t(t){return e.call(this,{scale:1,mode:"fanAvg",distribution:"uniform",seed:null==t?null:t.seed})||this}return a(t,e),t.prototype.getClassName=function(){return ze.className},t}(ze),Ue=function(e){function t(t){return e.call(this,{scale:1,mode:"fanAvg",distribution:"normal",seed:null==t?null:t.seed})||this}return a(t,e),t.prototype.getClassName=function(){return ze.className},t}(ze),We=function(e){function t(t){return e.call(this,{scale:2,mode:"fanIn",distribution:"normal",seed:null==t?null:t.seed})||this}return a(t,e),t.prototype.getClassName=function(){return ze.className},t}(ze),$e=function(e){function t(t){return e.call(this,{scale:1,mode:"fanIn",distribution:"normal",seed:null==t?null:t.seed})||this}return a(t,e),t.prototype.getClassName=function(){return ze.className},t}(ze),qe=function(e){function t(t){var n=e.call(this)||this;if(n.DEFAULT_GAIN=1,n.gain=null==t.gain?n.DEFAULT_GAIN:t.gain,n.seed=t.seed,null!=n.seed)throw new x("Random seed is not implemented for Orthogonal Initializer yet.");return n}return a(t,e),t.prototype.apply=function(e,t){var n=this;return Object(i.Od)(function(){if(2!==e.length)throw new x("The Orthogonal Initializer does not support non-2D shapes yet.");e[0]*e[1]>2e3&&console.warn("Orthogonal initializer is being called on a matrix with more than 2000 ("+e[0]*e[1]+") elements: Slowness may result.");var t=Ee(e[0]>e[1]?[e[1],e[0]]:e,0,1,"float32"),r=i.Ob.gramSchmidt(t);return e[0]>e[1]&&(r=r.transpose()),Object(i.oc)(y(n.gain),r)})},t.prototype.getConfig=function(){return{gain:this.gain,seed:this.seed}},t.className="Orthogonal",t}(Te);i.ed.registerClass(qe);var He={constant:"Constant",glorotNormal:"GlorotNormal",glorotUniform:"GlorotUniform",heNormal:"HeNormal",identity:"Identity",leCunNormal:"LeCunNormal",ones:"Ones",orthogonal:"Orthogonal",randomNormal:"RandomNormal",randomUniform:"RandomUniform",truncatedNormal:"TruncatedNormal",varianceScaling:"VarianceScaling",zeros:"Zeros"};function Ge(e,t){return void 0===t&&(t={}),P(e,i.ed.SerializationMap.getMap().classNameMap,t,"initializer")}function Ke(e){return T(e)}function Ye(e){if("string"==typeof e){var t=e in He?He[e]:e;return"GlorotUniform"===t?new Ve:"GlorotNormal"===t?new Ue:"HeNormal"===t?new We:"LeCunNormal"===t?new $e:Ge({className:t,config:{}})}return e instanceof Te?e:Ge(e)}var Xe=Object.freeze({zeros:function(){return new Pe},ones:function(){return new Re},constant:function(e){return new De(e)},randomUniform:function(e){return new Le(e)},randomNormal:function(e){return new Be(e)},truncatedNormal:function(e){return new je(e)},identity:function(e){return new Fe(e)},varianceScaling:function(e){return new ze(e)},glorotUniform:function(e){return new Ve(e)},glorotNormal:function(e){return new Ue(e)},heNormal:function(e){return new We(e)},leCunNormal:function(e){return new $e(e)},orthogonal:function(e){return new qe(e)}});function Ze(e){return Array.isArray(e)&&Array.isArray(e[0])}function Je(e){return 0===e.length?[]:Array.isArray(e[0])?e:[e]}function Qe(e){var t;if(Array.isArray(e)){if(1!==e.length)throw new w("Expected Tensor length to be 1; got "+e.length);t=e[0]}else t=e;return t}function et(e){if(Array.isArray(e)&&Array.isArray(e[0])){if(1===e.length)return(e=e)[0];throw new w("Expected exactly 1 Shape; got "+e.length)}return e}function tt(e){for(var t=0,n=0,r=e;n<r.length;n++){var i=r[n];0===i.shape.length?t+=1:t+=i.shape.reduce(function(e,t){return e*t})}return t}var nt="Variable",rt=function(){function e(e,t,n,r,o){void 0===t&&(t="float32"),void 0===n&&(n=nt),void 0===r&&(r=!0),void 0===o&&(o=null),this.dtype=null==t?"float32":t,this.shape=e.shape,this.id=f(),n=null==n?nt:n,this.originalName=oe(n),this.name=ae(this.originalName),this.trainable=r,this.constraint=o,this.val=Object(i.be)(e,this.trainable,this.name,this.dtype)}return e.prototype.read=function(){return this.assertNotDisposed(),this.val},e.prototype.write=function(e){return this.assertNotDisposed(),function(e,t){if(e.shape.toString()!==t.shape.toString())throw new Error("Shape mismatch: "+JSON.stringify(e.shape)+" vs. "+JSON.stringify(t.shape))}(this.val,e),this.val.id!==e.id&&(this.val.assign(e),null!=this.constraint&&this.val.assign(this.constraint.apply(this.val))),this},e.prototype.dispose=function(){this.assertNotDisposed(),this.val.dispose()},e.prototype.assertNotDisposed=function(){if(this.val.isDisposed)throw new Error("LayersVariable "+this.name+" is already disposed.")},e}();function it(e){return e.map(function(e){return e.read()})}function ot(e){e.map(function(e){e[0].write(e[1])})}var at=function(e){this.dtype=e.dtype,this.shape=e.shape,null!=e.shape?this.ndim=e.shape.length:this.ndim=e.ndim,this.maxNDim=e.maxNDim,this.minNDim=e.minNDim,this.axes=e.axes||{}},st=function(e,t,n,r,i,o,a){this.dtype=e,this.shape=t,this.sourceLayer=n,this.inputs=r,this.callArgs=i,this.outputTensorIndex=a,this.id=f(),null!=o&&(this.originalName=oe(o),this.name=ae(this.originalName)),this.rank=t.length},ut=0,ct=function(){function e(e,t){this.callArgs=t,this.id=ut++,this.outboundLayer=e.outboundLayer,this.inboundLayers=e.inboundLayers,this.nodeIndices=e.nodeIndices,this.tensorIndices=e.tensorIndices,this.inputTensors=e.inputTensors,this.outputTensors=e.outputTensors,this.inputMasks=e.inputMasks,this.outputMasks=e.outputMasks,this.inputShapes=e.inputShapes,this.outputShapes=e.outputShapes;for(var n=0,r=e.inboundLayers;n<r.length;n++){var i=r[n];null!=i&&i.outboundNodes.push(this)}e.outboundLayer.inboundNodes.push(this)}return e.prototype.getConfig=function(){for(var e=[],t=0,n=this.inboundLayers;t<n.length;t++){var r=n[t];null!=r?e.push(r.name):e.push(null)}return{outboundLayer:this.outboundLayer?this.outboundLayer.name:null,inboundLayers:e,nodeIndices:this.nodeIndices,tensorIndices:this.tensorIndices}},e}(),lt=0,ht=function(e){function t(t){var n=e.call(this)||this;n._callHook=null,n._addedWeightNames=[],n._stateful=!1,n.id=lt++,n.activityRegularizer=null,n.inputSpec=null,n.supportsMasking=!1,n._trainableWeights=[],n._nonTrainableWeights=[],n._losses=[],n._updates=[],n._built=!1,n.inboundNodes=[],n.outboundNodes=[];var r=t.name;if(!r){var i=n.getClassName();r=N(i)+"_"+m(i)}if(n.name=r,n.trainable=null==t.trainable||t.trainable,n.updatable=null==t.updatable||t.updatable,null!=t.inputShape||null!=t.batchInputShape){var o=void 0;if(null!=t.batchInputShape)o=t.batchInputShape;else if(null!=t.inputShape){var a=null;null!=t.batchSize&&(a=t.batchSize),o=[a].concat(t.inputShape)}n.batchInputShape=o;var s=t.dtype;null==s&&(s=t.inputDType),null==s&&(s="float32"),n.dtype=s}return null!=t.weights?n.initialWeights=t.weights:n.initialWeights=null,n._refCount=null,n}return a(t,e),t.nodeKey=function(e,t){return e.name+"_ib-"+t.toString()},t.prototype.getNodeAtIndex=function(e,t){if(0===this.inboundNodes.length)throw new _("The layer has never been called and thus has no defined "+t+".");if(this.inboundNodes.length<=e)throw new w("Asked to get "+t+" at node "+e+", but the layer has only "+this.inboundNodes.length+" inbound nodes.");return this.inboundNodes[e]},t.prototype.getInputAt=function(e){return A(this.getNodeAtIndex(e,"input").inputTensors)},t.prototype.getOutputAt=function(e){return A(this.getNodeAtIndex(e,"output").outputTensors)},Object.defineProperty(t.prototype,"input",{get:function(){if(this.inboundNodes.length>1)throw new v("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 v("Layer "+this.name+" is not connected, no input to return.");return A(this.getNodeAtIndex(0,"input").inputTensors)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"output",{get:function(){if(0===this.inboundNodes.length)throw new v("Layer "+this.name+" has no inbound nodes.");if(this.inboundNodes.length>1)throw new v("Layer "+this.name+' has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use `getOutputAt(nodeIndex)` instead.');return A(this.getNodeAtIndex(0,"output").outputTensors)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"losses",{get:function(){return this._losses},enumerable:!0,configurable:!0}),t.prototype.calculateLosses=function(){return this.losses.map(function(e){return e()})},Object.defineProperty(t.prototype,"updates",{get:function(){return this._updates},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"built",{get:function(){return this._built},set:function(e){this._built=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"trainableWeights",{get:function(){return this.trainable?this._trainableWeights:[]},set:function(e){this._trainableWeights=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nonTrainableWeights",{get:function(){return this.trainable?this._nonTrainableWeights:this._trainableWeights.concat(this._nonTrainableWeights)},set:function(e){this._nonTrainableWeights=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"weights",{get:function(){return this.trainableWeights.concat(this.nonTrainableWeights)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stateful",{get:function(){return this._stateful},enumerable:!0,configurable:!0}),t.prototype.resetStates=function(){if(!this.stateful)throw new Error("Cannot call the resetStates() method of a non-stateful Layer object.")},t.prototype.assertInputCompatibility=function(e){if(e=M(e),null!=this.inputSpec&&0!==this.inputSpec.length){var t=M(this.inputSpec);if(e.length!==t.length)throw new w("Layer "+this.name+" expects "+t.length+" inputs, but it received "+e.length+" input tensors. Input received: "+e);for(var n=0;n<e.length;n++){var r=e[n],i=t[n];if(null!=i){var o=r.rank;if(null!=i.ndim&&o!==i.ndim)throw new w("Input "+n+" is incompatible with layer "+this.name+": expected ndim="+i.ndim+", found ndim="+o);if(null!=i.maxNDim&&o>i.maxNDim)throw new w("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 w("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 w("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=u>=0?a[u]:a[a.length+u];if(null!=c&&-1===[c,null].indexOf(l))throw new w("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 h=0;h<i.shape.length;++h){var d=i.shape[h],f=r.shape[h];if(null!=d&&null!=f&&d!==f)throw new w("Input "+n+" is incompatible with layer "+this.name+": expected shape="+i.shape+", found shape=${xShape}.")}}}}},t.prototype.call=function(e,t){return e},t.prototype.invokeCallHook=function(e,t){null!=this._callHook&&this._callHook(e,t)},t.prototype.setCallHook=function(e){this._callHook=e},t.prototype.clearCallHook=function(){this._callHook=null},t.prototype.apply=function(e,t){var n=this;t=t||{},this.assertNotDisposed();for(var r=M(e),i=!0,o=0,a=r;o<a.length;o++)if(!(a[o]instanceof st)){i=!1;break}for(var s=!0,u=0,c=r;u<c.length;u++)if(c[u]instanceof st){s=!1;break}if(i===s)throw new w("Arguments to apply() must be all SymbolicTensors or all Tensors");return ie(this.name,function(){if(!n.built){n.assertInputCompatibility(e);for(var i=[],o=0,a=M(e);o<a.length;o++){var u=a[o];i.push(u.shape)}n.build(A(i)),n.built=!0,n.initialWeights&&n.setWeights(n.initialWeights),null===n._refCount&&s&&(n._refCount=1)}if(n.assertInputCompatibility(e),s){for(var c=[],l=0,h=M(m=n.call(e,t));l<h.length;l++){var d=h[l];-1!==r.indexOf(d)&&(d=d.clone()),c.push(d)}if(m=A(c),null!=n.activityRegularizer)throw new x("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return m}var f=function(e){for(var t=[],n=0,r=e=M(e);n<r.length;n++){var i=r[n];t.push(i.shape)}return A(t)}(e),p=n.computeOutputShape(f),m=void 0,g="float32";if(n.warnOnIncompatibleInputShape(Array.isArray(e)?f[0]:f),m=null!=p&&p.length>0&&Array.isArray(p[0])?p.map(function(r,i){return new st(g,r,n,M(e),t,n.name,i)}):new st(g,p,n,M(e),t,n.name),n.addInboundNode(e,m,null,null,f,p,t),n._refCount++,null!=n.activityRegularizer)throw new x("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return m})},t.prototype.warnOnIncompatibleInputShape=function(e){if(null!=this.batchInputShape)if(e.length!==this.batchInputShape.length)console.warn("The rank of the input tensor provided (shape: "+JSON.stringify(e)+") does not match that of the batchInputShape ("+JSON.stringify(this.batchInputShape)+") of the layer "+this.name);else{var t=!1;this.batchInputShape.forEach(function(n,r){null!=n&&null!=e[r]&&e[r]!==n&&(t=!0)}),t&&console.warn("The shape of the input tensor ("+JSON.stringify(e)+") does not match the expectation of layer "+this.name+": "+JSON.stringify(this.batchInputShape))}},Object.defineProperty(t.prototype,"outputShape",{get:function(){if(null==this.inboundNodes||0===this.inboundNodes.length)throw new v("The layer "+this.name+" has never been called and thus has no defined output shape.");for(var e=[],t=0,n=this.inboundNodes;t<n.length;t++){var r=n[t],i=JSON.stringify(r.outputShapes);-1===e.indexOf(i)&&e.push(i)}if(1===e.length){var o=this.inboundNodes[0].outputShapes;return Array.isArray(o)&&Array.isArray(o[0])&&1===o.length?o[0]:o}throw new v("The layer "+this.name+' has multiple inbound nodes with different output shapes. Hence the notion of "outut shape" is ill-defined for the layer.')},enumerable:!0,configurable:!0}),t.prototype.countParams=function(){if(!this.built)throw new _("You tried to call countParams() on "+this.name+", but the layer is not built yet. Build it first by calling build(batchInputShape).");return tt(this.weights)},t.prototype.build=function(e){this.built=!0},t.prototype.getWeights=function(e){return void 0===e&&(e=!1),it(e?this.trainableWeights:this.weights)},t.prototype.setWeights=function(e){var t=this;Object(i.Od)(function(){var n=t.weights;if(n.length!==e.length)throw new w('You called setWeights(weights) on layer "'+t.name+'" with a weight list of length '+e.length+", but the layer was expecting "+n.length+" weights. Provided weights: "+e+"...");if(0!==n.length){for(var r=[],o=it(n),a=0;a<o.length;++a){var s=o[a],u=n[a],c=e[a];if(!i.Yd.arraysEqual(s.shape,c.shape))throw new w("Layer weight shape "+s.shape+" not compatible with provided weight shape "+c.shape);r.push([u,c])}ot(r)}})},t.prototype.addWeight=function(e,t,n,r,i,o,a){if(-1!==this._addedWeightNames.indexOf(e))throw new w("Duplicate weight name "+e+" for layer "+this.name);this._addedWeightNames.push(e),null==n&&(n="float32");var s=new rt(r.apply(t,n),n,e,o,a);return null!=i&&this.addLoss(function(){return i.apply(s.read())}),null==o&&(o=!0),o?this._trainableWeights.push(s):this._nonTrainableWeights.push(s),s},t.prototype.addLoss=function(e){var t;null==e||Array.isArray(e)&&0===e.length||(e=M(e),void 0!==this._losses&&null!==this._losses&&(t=this.losses).push.apply(t,e))},t.prototype.computeOutputShape=function(e){return e},t.prototype.computeMask=function(e,t){var n=this;if(!this.supportsMasking){if(null!=t){if(!Array.isArray(t))throw new TypeError("Layer "+this.name+" does not support masking,but was passed an inputMask.");t.forEach(function(e){if(null!=e)throw new TypeError("Layer "+n.name+" does not support masking,but was passed an inputMask.")})}return null}return t},t.prototype.addInboundNode=function(e,t,n,r,i,o,a){void 0===a&&(a=null);var s=M(e);t=M(t),n=M(n),r=M(r),i=Je(i),o=Je(o);for(var u=[],c=[],l=[],h=0,d=s;h<d.length;h++){var f=d[h];u.push(f.sourceLayer),c.push(f.nodeIndex),l.push(f.tensorIndex)}new ct({outboundLayer:this,inboundLayers:u,nodeIndices:c,tensorIndices:l,inputTensors:s,outputTensors:t,inputMasks:n,outputMasks:r,inputShapes:i,outputShapes:o},a);for(var p=0;p<t.length;p++)t[p].sourceLayer=this,t[p].nodeIndex=this.inboundNodes.length-1,t[p].tensorIndex=p},t.prototype.getConfig=function(){var e={name:this.name,trainable:this.trainable};return null!=this.batchInputShape&&(e.batchInputShape=this.batchInputShape),null!=this.dtype&&(e.dtype=this.dtype),e},t.prototype.disposeWeights=function(){return this.weights.forEach(function(e){return e.dispose()}),this.weights.length},t.prototype.assertNotDisposed=function(){if(0===this._refCount)throw new Error("Layer '"+this.name+"' is already disposed.")},t.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 e=0;return 0==--this._refCount&&(e=this.disposeWeights()),{refCountAfterDispose:this._refCount,numDisposedVariables:e}},t}(i.ed.Serializable);var dt=function(e){function t(t){var n=e.call(this,{dtype:t.dtype,name:null!=t.name?t.name:m("input").toString()})||this;if(null==t.batchSize&&(t.batchSize=null),null==t.sparse&&(t.sparse=!1),n.trainable=!1,n.built=!0,n.sparse=t.sparse,null!=t.inputShape&&null!=t.batchInputShape)throw new w("Only provide the inputShape OR batchInputShape argument to inputLayer, not both at the same time.");var r=t.batchInputShape;if(null==r){if(null==t.inputShape)throw new w("An InputLayer should be passed either a `batchInputShape` or an `inputShape`.");r=[t.batchSize].concat(t.inputShape)}else if(null!=t.batchSize)throw new w("Cannot specify batchSize if batchInputShape isspecified when creating an InputLayer.");var i=t.dtype||"float32";n.batchInputShape=r,n.dtype=i,n.inputSpec=[{shape:r}];var o=new st(n.dtype,n.batchInputShape,n,[],{},n.name);return o.nodeIndex=0,o.tensorIndex=0,new ct({outboundLayer:n,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:[o],outputTensors:[o],inputMasks:[null],outputMasks:[null],inputShapes:[r],outputShapes:[r]}),n}return a(t,e),t.prototype.apply=function(e,t){throw new w("Cannot pass any input to an InputLayer's apply() method. InputLayer name: "+this.name)},t.prototype.dispose=function(){return{refCountAfterDispose:this._refCount,numDisposedVariables:0}},t.prototype.getConfig=function(){return{batchInputShape:this.batchInputShape,dtype:this.dtype,sparse:this.sparse,name:this.name}},t.className="InputLayer",t}(ht);function ft(e){if(null==e.batchShape&&null==e.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!=e.batchShape&&null!=e.shape)throw new w("Please provide either a `shape` or `batchShape` argument to Input, but not both.");var t=e.batchShape;null!=e.shape&&null==t&&(t=[null].concat(e.shape));var n=e.dtype;return null==n&&(n="float32"),new dt({batchInputShape:t,name:e.name,dtype:n,sparse:e.sparse}).inboundNodes[0].outputTensors[0]}function pt(e){return u(this,void 0,void 0,function(){var t,n,r,o,a,s,u,l;return c(this,function(c){switch(c.label){case 0:if(null==e)return[2];for(o in t=[],n=[],r=[],e)"number"!=typeof(a=e[o])&&(s=a,t.push(s.data()),n.push(o),r.push(s));return[4,Promise.all(t)];case 1:for(u=c.sent(),l=0;l<u.length;++l)e[n[l]]=u[l][0];return Object(i.fb)(r),[2]}})})}i.ed.registerClass(dt);var mt=function(){function e(){this.validationData=null}return e.prototype.setParams=function(e){this.params=e},e.prototype.onEpochBegin=function(e,t){return u(this,void 0,void 0,function(){return c(this,function(e){return[2]})})},e.prototype.onEpochEnd=function(e,t){return u(this,void 0,void 0,function(){return c(this,function(e){return[2]})})},e.prototype.onBatchBegin=function(e,t){return u(this,void 0,void 0,function(){return c(this,function(e){return[2]})})},e.prototype.onBatchEnd=function(e,t){return u(this,void 0,void 0,function(){return c(this,function(e){return[2]})})},e.prototype.onTrainBegin=function(e){return u(this,void 0,void 0,function(){return c(this,function(e){return[2]})})},e.prototype.onTrainEnd=function(e){return u(this,void 0,void 0,function(){return c(this,function(e){return[2]})})},e.prototype.setModel=function(e){},e}(),gt=function(){function e(e,t){void 0===t&&(t=10),null==e&&(e=[]),this.callbacks=e,this.queueLength=t}return e.prototype.append=function(e){this.callbacks.push(e)},e.prototype.setParams=function(e){for(var t=0,n=this.callbacks;t<n.length;t++)n[t].setParams(e)},e.prototype.setModel=function(e){for(var t=0,n=this.callbacks;t<n.length;t++)n[t].setModel(e)},e.prototype.onEpochBegin=function(e,t){return u(this,void 0,void 0,function(){var n,r;return c(this,function(i){switch(i.label){case 0:null==t&&(t={}),n=0,r=this.callbacks,i.label=1;case 1:return n<r.length?[4,r[n].onEpochBegin(e,t)]:[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},e.prototype.onEpochEnd=function(e,t){return u(this,void 0,void 0,function(){var n,r;return c(this,function(i){switch(i.label){case 0:null==t&&(t={}),n=0,r=this.callbacks,i.label=1;case 1:return n<r.length?[4,r[n].onEpochEnd(e,t)]:[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},e.prototype.onBatchBegin=function(e,t){return u(this,void 0,void 0,function(){var n,r;return c(this,function(i){switch(i.label){case 0:null==t&&(t={}),n=0,r=this.callbacks,i.label=1;case 1:return n<r.length?[4,r[n].onBatchBegin(e,t)]:[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},e.prototype.onBatchEnd=function(e,t){return u(this,void 0,void 0,function(){var n,r;return c(this,function(i){switch(i.label){case 0:null==t&&(t={}),n=0,r=this.callbacks,i.label=1;case 1:return n<r.length?[4,r[n].onBatchEnd(e,t)]:[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},e.prototype.onTrainBegin=function(e){return u(this,void 0,void 0,function(){var t,n;return c(this,function(r){switch(r.label){case 0:null==e&&(e={}),t=0,n=this.callbacks,r.label=1;case 1:return t<n.length?[4,n[t].onTrainBegin(e)]:[3,4];case 2:r.sent(),r.label=3;case 3:return t++,[3,1];case 4:return[2]}})})},e.prototype.onTrainEnd=function(e){return u(this,void 0,void 0,function(){var t,n;return c(this,function(r){switch(r.label){case 0:null==e&&(e={}),t=0,n=this.callbacks,r.label=1;case 1:return t<n.length?[4,n[t].onTrainEnd(e)]:[3,4];case 2:r.sent(),r.label=3;case 3:return t++,[3,1];case 4:return[2]}})})},e}(),bt=function(){function e(e){this.yieldEvery=e,this.batchCount=0,this.batchDurationsMillis=[],this.autoYieldEveryBatches=null,this.batchStartMillis=i.Yd.now()}return e.prototype.resolveOneTensorInLogs=function(e){return u(this,void 0,void 0,function(){var t,n,r,i,o;return c(this,function(a){switch(a.label){case 0:for(n in t=[],e)t.push(n);r=0,a.label=1;case 1:return r<t.length?(i=t[r],"number"==typeof(o=e[i])?[3,3]:[4,o.data()]):[3,4];case 2:return a.sent(),[3,4];case 3:return r++,[3,1];case 4:return[2]}})})},e.prototype.maybeYieldOnBatch=function(t){return u(this,void 0,void 0,function(){var n,r;return c(this,function(o){switch(o.label){case 0:return"auto"!==this.yieldEvery?[3,7]:(this.batchCount++,null!=this.autoYieldEveryBatches?[3,3]:[4,this.resolveOneTensorInLogs(t)]);case 1:return o.sent(),n=i.Yd.now(),[4,Object(i.tc)()];case 2:return o.sent(),this.batchCount>e.SKIP_FIRST_BATCHES&&(this.batchDurationsMillis.push(n-this.batchStartMillis),this.batchDurationsMillis.length>=e.DECISION_BATCH_COUNT&&(r=this.batchDurationsMillis.reduce(function(e,t){return e+t})/this.batchDurationsMillis.length,this.autoYieldEveryBatches=Math.round(e.THRESHOLD_MILLIS/r),this.autoYieldEveryBatches<1&&(this.autoYieldEveryBatches=1))),this.batchStartMillis=i.Yd.now(),this.lastYieldBatchCount=this.batchCount,[3,6];case 3:return this.batchCount-this.lastYieldBatchCount>=this.autoYieldEveryBatches?[4,Object(i.tc)()]:[3,6];case 4:return o.sent(),[4,this.resolveOneTensorInLogs(t)];case 5:o.sent(),this.lastYieldBatchCount=this.batchCount,o.label=6;case 6:return[3,9];case 7:return"batch"!==this.yieldEvery?[3,9]:[4,Object(i.tc)()];case 8:o.sent(),o.label=9;case 9:return[2]}})})},e.prototype.maybeYieldOnEpoch=function(){return u(this,void 0,void 0,function(){return c(this,function(e){switch(e.label){case 0:return"epoch"!==this.yieldEvery?[3,2]:[4,Object(i.tc)()];case 1:e.sent(),e.label=2;case 2:return[2]}})})},e.SKIP_FIRST_BATCHES=1,e.DECISION_BATCH_COUNT=2,e.THRESHOLD_MILLIS=16,e}(),yt=function(e){function t(t){var n=e.call(this)||this;return n.yieldEvery=t||"auto",n}return a(t,e),t.prototype.onTrainBegin=function(e){return u(this,void 0,void 0,function(){return c(this,function(e){return this.autoYielder=new bt(this.yieldEvery),[2]})})},t.prototype.onEpochBegin=function(e){return u(this,void 0,void 0,function(){return c(this,function(e){return this.seen=0,this.totals={},[2]})})},t.prototype.onBatchEnd=function(e,t){return u(this,void 0,void 0,function(){var e,n,r,o,a=this;return c(this,function(s){switch(s.label){case 0:return[4,this.autoYielder.maybeYieldOnBatch(t)];case 1:for(o in s.sent(),null==t&&(t={}),e=null==t.size?0:t.size,this.seen+=e,n=function(n){var o=t[n];if("number"==typeof o)r.totals.hasOwnProperty(n)||(r.totals[n]=0),r.totals[n]=r.totals[n]+o*e;else{var s=void 0;n in r.totals?s=r.totals[n]:r.totals[n]=y(0),r.totals[n]=Object(i.Od)(function(){return Object(i.s)(a.totals[n],Object(i.oc)(o,y(e)))}),null!=s&&s.dispose()}},r=this,t)n(o);return[2]}})})},t.prototype.onEpochEnd=function(e,t){return u(this,void 0,void 0,function(){var e,n,r,o,a,s=this;return c(this,function(u){switch(u.label){case 0:return[4,this.autoYielder.maybeYieldOnEpoch()];case 1:if(u.sent(),null!=t)for(e=function(e){if(null==n.totals[e])return"continue";"number"==typeof n.totals[e]?t[e]=n.totals[e]/n.seen:Object(i.Od)(function(){t[e]=Object(i.oc)(Object(i.hb)(y(1),y(s.seen)),s.totals[e]),s.totals[e].dispose(),Object(i.Ib)(t[e])})},n=this,r=0,o=this.params.metrics;r<o.length;r++)a=o[r],e(a);return[2]}})})},t}(mt),vt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.onTrainBegin=function(e){return u(this,void 0,void 0,function(){return c(this,function(e){return this.epoch=[],this.history={},[2]})})},t.prototype.onEpochEnd=function(e,t){return u(this,void 0,void 0,function(){var n;return c(this,function(r){for(n in null==t&&(t={}),this.epoch.push(e),t)null==this.history[n]&&(this.history[n]=[]),this.history[n].push(t[n]);return[2]})})},t.prototype.syncData=function(){return u(this,void 0,void 0,function(){var e,t,n,r,i,o,a,s,u;return c(this,function(c){switch(c.label){case 0:for(r in e=[],t=[],n=[],this.history)for(i=this.history[r],o=0;o<i.length;++o)"number"!=typeof i[o]&&(a=i[o],e.push(a.data()),t.push(r),n.push(o));return[4,Promise.all(e)];case 1:for(s=c.sent(),u=0;u<s.length;++u)this.history[t[u]][n[u]].dispose(),this.history[t[u]][n[u]]=s[u][0];return[2]}})})},t}(mt),_t=function(e){function t(t){var n=e.call(this)||this;return n.trainBegin=t.onTrainBegin,n.trainEnd=t.onTrainEnd,n.epochBegin=t.onEpochBegin,n.epochEnd=t.onEpochEnd,n.batchBegin=t.onBatchBegin,n.batchEnd=t.onBatchEnd,n}return a(t,e),t.prototype.onEpochBegin=function(e,t){return u(this,void 0,void 0,function(){return c(this,function(n){switch(n.label){case 0:return null==this.epochBegin?[3,3]:[4,pt(t)];case 1:return n.sent(),[4,this.epochBegin(e,t)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},t.prototype.onEpochEnd=function(e,t){return u(this,void 0,void 0,function(){return c(this,function(n){switch(n.label){case 0:return null==this.epochEnd?[3,3]:[4,pt(t)];case 1:return n.sent(),[4,this.epochEnd(e,t)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},t.prototype.onBatchBegin=function(e,t){return u(this,void 0,void 0,function(){return c(this,function(n){switch(n.label){case 0:return null==this.batchBegin?[3,3]:[4,pt(t)];case 1:return n.sent(),[4,this.batchBegin(e,t)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},t.prototype.onBatchEnd=function(e,t){return u(this,void 0,void 0,function(){return c(this,function(n){switch(n.label){case 0:return null==this.batchEnd?[3,3]:[4,pt(t)];case 1:return n.sent(),[4,this.batchEnd(e,t)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},t.prototype.onTrainBegin=function(e){return u(this,void 0,void 0,function(){return c(this,function(t){switch(t.label){case 0:return null==this.trainBegin?[3,3]:[4,pt(e)];case 1:return t.sent(),[4,this.trainBegin(e)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},t.prototype.onTrainEnd=function(e){return u(this,void 0,void 0,function(){return c(this,function(t){switch(t.label){case 0:return null==this.trainEnd?[3,3]:[4,pt(e)];case 1:return t.sent(),[4,this.trainEnd(e)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},t}(mt);var wt=function(){function e(){}return e.registerCallbackConstructor=function(t,n){i.Yd.assert(t>=0&&Number.isInteger(t),"Verbosity level is expected to be an integer >= 0, but got "+t),e.checkForDuplicate(n),null==e.constructors[t]&&(e.constructors[t]=[]),e.constructors[t].push(n)},e.checkForDuplicate=function(t){for(var n in e.constructors)e.constructors[+n].forEach(function(e){if(e===t)throw new w("Duplicate callback constructor.")})},e.clear=function(){e.constructors={}},e.createCallbacks=function(t){var n=[];for(var r in e.constructors){var i=+r;t>=i&&n.push.apply(n,e.constructors[i])}return n.map(function(e){return new e})},e}();function xt(e,t){return Object(i.Od)(function(){var n=Object(i.Dd)(Oe(e),t,!0),r=Object(i.oc)(Object(i.bd)(h()),Object(i.zc)(e)),o=Object(i.td)(Object(i.dc)(n,r));return Object(i.hb)(e,o)})}function Et(e,t){return Object(i.Od)(function(){return Object(i.fc)(Oe(Object(i.Bd)(t,e)),-1)})}function St(e,t){return Object(i.Od)(function(){return Object(i.fc)(Object(i.p)(Object(i.Bd)(t,e)),-1)})}function Ct(e,t){return Object(i.Od)(function(){var n=Object(i.Bd)(e,t),r=Object(i.O)(Object(i.p)(e),h(),Number.MAX_VALUE),o=Object(i.p)(Object(i.hb)(n,r));return Object(i.oc)(y(100),Object(i.fc)(o,-1))})}function Ot(e,t){return Object(i.Od)(function(){var n=y(1),r=Object(i.O)(t,h(),Number.MAX_VALUE),o=Object(i.Rb)(Object(i.s)(n,r)),a=Object(i.O)(e,h(),Number.MAX_VALUE),s=Object(i.Rb)(Object(i.s)(n,a));return Object(i.fc)(Oe(Object(i.Bd)(o,s)),-1)})}function At(e,t){return Object(i.Od)(function(){var n=y(0),r=y(1),o=Object(i.dc)(n,Object(i.Bd)(r,Object(i.oc)(e,t)));return Object(i.fc)(Oe(o),-1)})}function Mt(e,t){return Object(i.Od)(function(){var n=y(0),r=y(1),o=Object(i.dc)(n,Object(i.Bd)(r,Object(i.oc)(e,t)));return Object(i.fc)(o,-1)})}function Nt(e,t){return Object(i.Od)(function(){var n=y(0),r=y(1),o=Object(i.Dd)(Object(i.oc)(e,t),-1),a=Object(i.bc)(Object(i.oc)(Object(i.Bd)(r,e),t),-1);return Object(i.dc)(n,Object(i.s)(r,Object(i.Bd)(a,o)))})}function kt(e,t){return Object(i.Od)(function(){var n=y(Math.log(2)),r=Object(i.Bd)(t,e),o=Object(i.Bd)(Object(i.s)(r,Object(i.qd)(Object(i.oc)(y(-2),r))),n);return Object(i.fc)(o,-1)})}function It(e,t,n){return void 0===n&&(n=!1),Object(i.Od)(function(){if(n)t=Object(i.pd)(t);else{var r=Object(i.Dd)(t,t.shape.length-1,!0);t=Object(i.hb)(t,r)}return t=Object(i.O)(t,h(),1-h()),Object(i.sc)(Object(i.Dd)(Object(i.oc)(e.toFloat(),Object(i.Rb)(t)),t.shape.length-1))})}function Tt(e,t,n){return void 0===n&&(n=!1),Object(i.Od)(function(){var r=Object(i.ub)(function(e){var t=[le(e.shape)];return e.reshape(t)}(e)).toInt(),o=t.shape;return It(Object(i.xc)(r,o[o.length-1]).reshape(o),t,n)})}function Pt(e,t){return Object(i.Od)(function(){var n;return n=Object(i.O)(t,h(),1-h()),n=Object(i.Rb)(Object(i.hb)(n,Object(i.Bd)(Object(i.zc)(n),n))),Object(i.fc)(function(e,t){return Object(i.Od)(function(){var n=Object(i.dc)(t,Object(i.ie)(t)),r=Object(i.oc)(t,e),o=Object(i.Rb)(Object(i.s)(y(1),Object(i.pb)(Object(i.sc)(Object(i.p)(t)))));return Object(i.s)(Object(i.Bd)(n,r),o)})}(e,n),-1)})}function Rt(e,t){return Object(i.Od)(function(){var n=Object(i.O)(e,h(),1),r=Object(i.O)(t,h(),1);return Object(i.Dd)(Object(i.oc)(e,Object(i.Rb)(Object(i.hb)(n,r))),-1)})}function Dt(e,t){return Object(i.Od)(function(){var n=Object(i.Rb)(Object(i.s)(y(h()),t));return Object(i.fc)(Object(i.Bd)(t,Object(i.oc)(e,n)),-1)})}function Lt(e,t){return Object(i.Od)(function(){var n=xt(e,-1),r=xt(t,-1),o=Object(i.oc)(n,r);return Object(i.sc)(Object(i.Dd)(o,-1))})}function Bt(e){var t={meanSquaredError:Et,meanAbsoluteError:St,meanAbsolutePercentageError:Ct,meanSquaredLogarithmicError:Ot,squaredHinge:At,hinge:Mt,categoricalHinge:Nt,logcosh:kt,categoricalCrossentropy:It,sparseCategoricalCrossentropy:Tt,binaryCrossentropy:Pt,kullbackLeiblerDivergence:Rt,poisson:Dt,cosineProximity:Lt};if("string"==typeof e){if(e in t)return t[e];var n="Unknown loss "+e;throw e.toLowerCase().includes("softmaxcrossentropy")&&(n="Unknown loss "+e+'. Use "categoricalCrossentropy" as the string name for tf.losses.softmaxCrossEntropy'),new w(n)}return e}function jt(e,t){return Object(i.Od)(function(){var n=Object(i.oc)(y(.5),Object(i.zc)(t)),r=me(Object(i.Bb)(t,n),e.dtype);return Object(i.fc)(Object(i.mb)(e,r),-1)})}function Ft(e,t){return Object(i.Od)(function(){return me(Object(i.mb)(Object(i.x)(e,-1),Object(i.x)(t,-1)),"float32")})}function zt(e,t){return Object(i.Od)(function(){var n=y(1);return Object(i.Vb)(e.equal(n),t.equal(n)).sum().cast("float32")})}function Vt(e,t){return Object(i.Od)(function(){var n=y(0),r=zt(e,t),o=function(e,t){return Object(i.Od)(function(){var n=y(1),r=y(0);return Object(i.Vb)(e.equal(r),t.equal(n)).sum().cast("float32")})}(e,t),a=r.add(o);return Object(i.fe)(Object(i.Bb)(a,n),r.div(a),n).cast("float32")})}function Ut(e,t){return Object(i.Od)(function(){var n=y(0),r=zt(e,t),o=function(e,t){return Object(i.Od)(function(){var n=y(1),r=y(0);return Object(i.Vb)(e.equal(n),t.equal(r)).sum().cast("float32")})}(e,t),a=r.add(o);return Object(i.fe)(Object(i.Bb)(a,n),r.div(a),n).cast("float32")})}function Wt(e,t){return Pt(e,t)}function $t(e,t){throw new x}var qt=Et,Ht=Et,Gt=St,Kt=St,Yt=Ct,Xt=Ct,Zt=It,Jt=Lt,Qt=Tt;function en(e,t,n,r){void 0===r&&(r=console.log);var i,o=function(e){var t=!0,n=[],r=[];for(var i in e.nodesByDepth)n.push(e.nodesByDepth[i]);for(var o=0,a=n;o<a.length;o++){var s=a[o];if(s.length>1||1===s.length&&s[0].inboundLayers.length>1){t=!1;break}r.push.apply(r,s)}if(t)for(var u=0,c=e.layers;u<c.length;u++){for(var l=!1,h=0,d=c[u].inboundNodes;h<d.length;h++){var f=d[h];if(-1!==r.indexOf(f)){if(l){t=!1;break}l=!0}}if(!t)break}return t}(e),a=["Layer (type)","Output shape","Param #"];if(o?(t=t||65,n=n||[.45,.85,1]):(t=t||98,n=n||[.33,.55,.67,1]),n[n.length-1]<=1&&(n=n.map(function(e){return Math.floor(t*e)})),!o)for(var s in a.push("Receives inputs"),i=[],e.nodesByDepth)i.push.apply(i,e.nodesByDepth[s]);r("_".repeat(t)),tn(a,n,r),r("=".repeat(t));for(var u=e.layers,c=0;c<u.length;++c)o?nn(u[c],n,r):rn(u[c],n,i,r),r((c===u.length-1?"=":"_").repeat(t));e.checkTrainableWeightsConsistency();var l=function(e){return null!=e.collectedTrainableWeights?tt(e.collectedTrainableWeights):tt(e.trainableWeights)}(e),h=tt(e.nonTrainableWeights);r("Total params: "+(l+h)),r("Trainable params: "+l),r("Non-trainable params: "+h),r("_".repeat(t))}function tn(e,t,n){void 0===n&&(n=console.log);for(var r="",i=0;i<e.length;++i)i>0&&(r=r.slice(0,r.length-1)+" "),r=(r+=e[i]).slice(0,t[i]),r+=" ".repeat(t[i]-r.length);n(r)}function nn(e,t,n){var r;try{r=JSON.stringify(e.outputShape)}catch(e){r="multiple"}tn([e.name+" ("+e.getClassName()+")",r,e.countParams().toString()],t,n)}function rn(e,t,n,r){var i;try{i=JSON.stringify(e.outputShape)}catch(e){i="multiple"}for(var o=[],a=0,s=e.inboundNodes;a<s.length;a++){var u=s[a];if(!(null!=n&&n.length>0&&-1===n.indexOf(u)))for(var c=0;c<u.inboundLayers.length;++c){var l=u.inboundLayers[c].name,h=u.nodeIndices[c],d=u.tensorIndices[c];o.push(l+"["+h+"]["+d+"]")}}var f=e.name,p=e.getClassName(),m=0===o.length?"":o[0];for(tn([f+" ("+p+")",i,e.countParams().toString(),m],t,r),c=1;c<o.length;++c)tn(["","","",o[c]],t,r)}function on(e,t){return void 0===t&&(t={}),P(e,i.ed.SerializationMap.getMap().classNameMap,t,"layer")}function an(e,t,n){return("inboundNodes"===e||"outputLayers"===e||"inputLayers"===e)&&0===t&&"string"==typeof n}var sn="0.8.0";function un(e,t,n,r){if(!n.startsWith("2."))throw new w("Unsupported Keras version in weights being loaded: "+n);return t}function cn(e,t,n){var r=function(e){switch(e){case"float32":return"float32";default:throw new w("Invalid dtype: "+e)}}(e);return i.m.make(t,{values:0===t.length?n:i.Yd.flatten(n)},r)}var ln=function(e){function t(n){var r=e.call(this,{})||this;if(r.containerNodes=new Set,r.name=n.name,null==r.name){var i=r.getClassName().toLowerCase();r.name=m(i)}if(r.supportsMasking=!1,r.trainable=!0,r.updatable=!0,Array.isArray(n.inputs)?r.inputs=n.inputs.slice():r.inputs=[n.inputs],Array.isArray(n.outputs)?r.outputs=n.outputs.slice():r.outputs=[n.outputs],D(r.inputs).length!==r.inputs.length)throw new w("The list of inputs passed to the model is redundant. All inputs should only appear once. Found: "+r.inputs.map(function(e){return e.name}));D(r.outputs).length!==r.outputs.length&&console.warn("The list of outputs passed to the model is redundant. All outputs should only appear once. Found: "+r.outputs.map(function(e){return e.name})),r.inputLayers=[],r.inputLayersNodeIndices=[],r.inputLayersTensorIndices=[],r.outputLayers=[],r.outputLayersNodeIndices=[],r.outputLayersTensorIndices=[],r.layers=[];for(var o=0,a=r.outputs;o<a.length;o++){var s=(k=a[o]).sourceLayer,u=k.nodeIndex,c=k.tensorIndex;r.outputLayers.push(s),r.outputLayersNodeIndices.push(u),r.outputLayersTensorIndices.push(c)}for(var l=0,h=r.inputs;l<h.length;l++)s=(k=h[l]).sourceLayer,u=k.nodeIndex,c=k.tensorIndex,C(0===u,"input layer has >1 nodes"),C(0===c,"input layer has >1 tensors"),r.inputLayers.push(s),r.inputLayersNodeIndices.push(u),r.inputLayersTensorIndices.push(c);r.inputNames=[],r.outputNames=[],r.feedInputShapes=[],r.feedInputNames=[],r.feedOutputNames=[];for(var d=0;d<r.inputLayers.length;d++){if(!((s=r.inputLayers[d])instanceof dt))throw new TypeError("Input layers to a Model must be InputLayer objects. Received inputs: "+n.inputs+". Input "+d+" (0-based) originates from layer type "+s.getClassName()+".");r.inputNames.push(s.name),r.feedInputShapes.push(s.batchInputShape),r.feedInputNames.push(s.name)}for(var f=0,p=r.outputLayers;f<p.length;f++)s=p[f],r.outputNames.push(s.name);r.internalInputShapes=r.inputs.map(function(e){return e.shape}),r.internalOutputShapes=r.outputs.map(function(e){return e.shape});for(var g={},b={},y={},v={},x={},E=[],S=function(e,n,i,o,a,s){null!=o&&null!=a&&null!=s||(o=e.sourceLayer,a=e.nodeIndex,s=e.tensorIndex);var u=o.inboundNodes[a];if(-1!==i.indexOf(u))throw new _("The tensor "+e.name+' at layer "'+o.name+'" is part of a cycle.');if(-1===n.indexOf(u)){r.containerNodes.add(t.nodeKey(o,a)),o.id in x||(x[o.id]=Object.keys(x).length),-1===i.indexOf(u)&&i.push(u);for(var c=u.inboundLayers.length,l=0;l<c;l++){var h=u.inputTensors[l],d=u.inboundLayers[l],f=u.nodeIndices[l],p=u.tensorIndices[l];S(h,n,i,d,f,p)}for(n.push(u);i.indexOf(u)>=0;)i.splice(i.indexOf(u),1);E.push(u)}},O=[],A=[],M=0,N=r.outputs;M<N.length;M++){var k=N[M];S(k,O,A)}for(var I=0,T=E.slice().reverse();I<T.length;I++){b[(ne=T[I]).id]=ne,ne.id in g||(g[ne.id]=0);var P=g[ne.id],L=null==y[ne.outboundLayer.id]?0:y[ne.outboundLayer.id];for(P=Math.max(P,L),y[ne.outboundLayer.id]=P,v[ne.outboundLayer.id]=ne.outboundLayer,g[ne.id]=P,d=0;d<ne.inboundLayers.length;d++){var B=ne.inboundLayers[d],j=(u=ne.nodeIndices[d],B.inboundNodes[u]),F=null==g[j.id]?0:g[j.id];g[j.id]=Math.max(P+1,F),b[j.id]=j}}var z={};for(var V in g)(P=g[V])in z||(z[P]=[]),z[P].push(b[V]);var U={};for(var W in y)(P=y[W])in U||(U[P]=[]),U[P].push(v[W]);var $=Object.keys(U).map(function(e){return parseInt(e,10)}).sort(R);r.layers=[];for(var q=0,H=$;q<H.length;q++){var G=U[P=H[q]];G.sort(function(e,t){var n=x[e.id],r=x[t.id];return n<r?-1:n>r?1:0});for(var K=0,Y=G;K<Y.length;K++)s=Y[K],r.layers.push(s)}r.layersByDepth=U,$=Object.keys(z).map(function(e){return parseInt(e,10)}).sort(R);for(var X=r.inputs.slice(),Z=[],J=0,Q=$;J<Q.length;J++)for(var ee=0,te=z[P=Q[J]];ee<te.length;ee++){var ne;if(null!=(s=(ne=te[ee]).outboundLayer)){for(var re=0,ie=ne.inputTensors;re<ie.length;re++)if(k=ie[re],-1===X.indexOf(k))throw new _("Graph disconnected: cannot obtain value for tensor "+k+' at layer "'+s.name+'". The following previous layers were accessed without issue: '+Z);for(var oe=0,ae=ne.outputTensors;oe<ae.length;oe++)k=ae[oe],X.push(k);Z.push(s.name)}}r.nodesByDepth=z;for(var se=r.layers.map(function(e){return e.name}),ue=function(e){var t=se.filter(function(t){return t===e}).length;if(1!==t)throw new _('The name "'+e+'" is used '+t+" times in the model. All layer names should be unique. Layer names: "+JSON.stringify(se))},ce=0,le=se;ce<le.length;ce++)ue(le[ce]);return r.outboundNodes=[],r.inboundNodes=[],new ct({outboundLayer:r,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:r.inputs,outputTensors:r.outputs,inputMasks:r.inputs.map(function(e){return null}),outputMasks:r.outputs.map(function(e){return null}),inputShapes:r.inputs.map(function(e){return e.shape}),outputShapes:r.outputs.map(function(e){return e.shape})}),r.built=!0,r._refCount=1,r}return a(t,e),t.prototype.assertNotDisposed=function(){if(0===this._refCount)throw new Error("Container '"+this.name+"' is already disposed.")},t.prototype.dispose=function(){this.assertNotDisposed();var e={refCountAfterDispose:null,numDisposedVariables:0};if(0==--this._refCount)for(var t=0,n=this.layers;t<n.length;t++){var r=n[t];e.numDisposedVariables+=r.dispose().numDisposedVariables}return e.refCountAfterDispose=this._refCount,e},Object.defineProperty(t.prototype,"trainableWeights",{get:function(){if(this._trainableWeights.length>0)throw new w("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 e=[],t=0,n=this.layers;t<n.length;t++){var r=n[t];e=e.concat(r.trainableWeights)}return e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nonTrainableWeights",{get:function(){for(var e=[],t=0,n=this.layers;t<n.length;t++){var r=n[t];e.push.apply(e,r.nonTrainableWeights)}if(!this.trainable){for(var i=[],o=0,a=this.layers;o<a.length;o++)r=a[o],i.push.apply(i,r.trainableWeights);return i.concat(e)}return e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"weights",{get:function(){return this.trainableWeights.concat(this.nonTrainableWeights)},enumerable:!0,configurable:!0}),t.prototype.loadWeights=function(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1),void 0===r&&(r=!0),n?function(e,t,n){void 0===n&&(n=!0);for(var r={},i=0,o=0,a=t;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 w("Duplicate weight name: "+c.originalName);r[c.originalName]=c,i++}var l=[];for(var h in e){if(null!=r[h])l.push([r[h],e[h]]);else if(n)throw new w("Provided weight data has no target variable: "+h);delete r[h]}if(n){var d=[];for(var f in r)d.push(f);if(d.length>0)throw new w(d.length+" of "+i+" weights are not set: "+d)}ot(l)}(e,this.layers,r):function(e,t,n){void 0===n&&(n=!1);for(var r=e.keras_version,o=(e.backend,t.map(function(e){return e.name})),a={},s=0,u=t;s<u.length;s++)null!=(v=u[s]).name&&(null==a[v.name]&&(a[v.name]=[]),a[v.name].push(v));for(var c=e.weights,l=[],h=0;h<o.length;++h){var d=o[h],f=c[d];null==f&&(f=[]);for(var p=[],m=0;m<f.length;++m){var g=f[m];p.push(new rt(cn(g.dtype,g.shape,g.value)))}for(var b=0,y=a[d];b<y.length;b++){var v,_=(v=y[b]).weights;if((p=un(0,p,r)).length!==_.length){if(!n)throw new w("Layer #"+h+' (named "'+v.name+'") expects '+_.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 "+_.length+").")}for(var x=0;x<p.length;++x)!n||i.Yd.arraysEqual(_[x].shape,p[x].shape)?l.push([_[x],p[x].read()]):console.warn("Skipping loading of weights for layer "+v.name+" due to mismatch in shape ("+_[x].shape+" vs "+p[x].shape+")")}}ot(l)}(e,this.layers,t)},t.prototype.updatedConfig=function(){var e=this.getConfig();return{className:this.getClassName(),config:e,kerasVersion:"tfjs-layers "+sn,backend:"TensorFlow.js"}},t.prototype.toJSON=function(e,t){void 0===t&&(t=!0);var n=function e(t,n){if(null===t||void 0===t)return null;if("string"==typeof t)return N(t);if("number"==typeof t||"boolean"==typeof t)return t;if(t instanceof Array){for(var r=[],i=t.length,o=0;o<i;++o){var a=t[o];an(n,o,a)?r.push(a):r.push(e(a,n))}return r}for(var s={},u=0,c=Object.keys(t);u<c.length;u++){var l=c[u],h=t[l];s[N(l)]="name"!==l&&"className"!==l||"string"!=typeof h?e(h,l):h}return s}(this.updatedConfig());return t?JSON.stringify(n):n},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){var r;return e=M(e),r="mask"in t?M(t.mask):S(null,e.length),n.runInternalGraph(e,r)[0]})},t.prototype.computeMask=function(e,t){var n=this;return Object(i.Od)(function(){var r;return e=M(e),r=null==t?S(null,e.length):M(t),n.runInternalGraph(e,r)[1]})},t.prototype.computeOutputShape=function(e){var t=Je(e);if(t.length!==this.inputLayers.length)throw new w("Invalid inputShape argument "+e+": model has "+this.inputLayers.length+" tensor inputs.");for(var n={},r=0;r<t.length;r++){var i=this.inputLayers[r],o=t[r];n[S=i.name+"_0_0"]=o}var a=Object.keys(this.nodesByDepth).map(function(e){return parseInt(e,10)}).sort(R);if(a.length>1)for(var s=0,u=a;s<u.length;s++)for(var c=u[s],l=0,h=this.nodesByDepth[c];l<h.length;l++){var d=h[l];if(i=d.outboundLayer,-1===this.inputLayers.map(function(e){return e.id}).indexOf(i.id)){for(var f=[],p=0;p<d.inboundLayers.length;p++){var m=d.inboundLayers[p],g=d.nodeIndices[p],b=d.tensorIndices[p],y=n[S=m.name+"_"+g+"_"+b];f.push(y)}var v=Je(i.computeOutputShape(A(f))),_=i.inboundNodes.indexOf(d);for(p=0;p<v.length;p++)n[S=i.name+"_"+_+"_"+p]=v[p]}}var x=[],E=[];for(r=0;r<this.outputLayers.length;r++){i=this.outputLayers[r],_=this.outputLayersNodeIndices[r],b=this.outputLayersTensorIndices[r];var S=i.name+"_"+_+"_"+b;E.push(S)}for(r=0;r<E.length;r++){var O=E[r];C(O in n),x.push(n[O])}return A(x)},t.prototype.runInternalGraph=function(e,t){null==t&&(t=S(null,e.length));for(var n={},r=0;r<this.inputs.length;++r){var i=this.inputs[r],o=e[r],a=t[r];n[i.id]=[o,a]}for(var s=0,u=Object.keys(this.nodesByDepth).map(function(e){return parseInt(e,10)}).sort(R);s<u.length;s++)for(var c=u[s],l=0,h=this.nodesByDepth[c];l<h.length;l++){for(var d=h[l],f=d.outboundLayer,p=d.inputTensors,m=d.outputTensors,g=new Array,b=0,y=p;b<y.length;b++)(i=y[b]).id in n&&g.push(n[i.id]);if(g.length===p.length){var v={},_=void 0,w=void 0,E=void 0,O=void 0;if(null!=d.callArgs&&(v=d.callArgs),1===g.length){var A=g[0],N=A[0],k=A[1];null==v.mask&&(v.mask=k),E=M(f.call(N,v)),O=M(f.computeMask(N,k)),_=[N],w=[k]}else _=g.map(function(e){return e[0]}),w=g.map(function(e){return e[1]}),null==v.mask&&(v.mask=w),E=M(f.call(_,v)),O=M(f.computeMask(_,w));if(f.activityRegularizer)throw new x("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=E[r],a=O[r],n[i.id]=[o,a]}}for(var I=[],T=[],P=[],D=0,L=this.outputs;D<L.length;D++){C((i=L[D]).id in n,"Could not compute output "+i.name+" : "+i.id);var B=n[i.id],j=B[0];a=B[1],P.push(j.shape),I.push(j),T.push(a)}return[I,T,P]},t.prototype.buildNodeConversionMap=function(e){for(var n,r={},i=0,o=this.layers;i<o.length;i++){var a=o[i];n=a instanceof t?1:0;for(var s=0;s<a.inboundNodes.length;s++){var u=t.nodeKey(a,s);u in this.containerNodes&&(r[u]=n,n+=1)}}return r},t.prototype.getLayer=function(e,t){if(null!=t){if(this.layers.length<=t)throw new w("Was asked to retrieve layer at index "+t+", but model only has "+this.layers.length+" layer(s).");return this.layers[t]}if(null==e)throw new w("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===e)return i}throw new w("No such layer: "+e)},t.prototype.calculateLosses=function(){var e=this;return Object(i.Od)(function(){for(var n=[],r=0,i=e.layers;r<i.length;r++)for(var o=i[r],a=0;a<o.inboundNodes.length;++a){var s=t.nodeKey(o,a);e.containerNodes.has(s)&&n.push.apply(n,o.calculateLosses())}return n})},t.prototype.getConfig=function(){for(var e={name:this.name},n=this.buildNodeConversionMap(this.layers),r=[],i=0,o=this.layers;i<o.length;i++){for(var a=(v=o[i]).getClassName(),s=v.getConfig(),u=[],c=0;c<v.inboundNodes.length;c++){var l=v.inboundNodes[c],h=t.nodeKey(v,c),d={};if(this.containerNodes.has(h)){if(l.callArgs)try{JSON.stringify(l.callArgs),d=l.callArgs}catch(e){console.warn("Layer "+v.name+" was passed non-serializable keyword arguments: "+l.callArgs+". They will not be included in the serialized model (and thus will be missing at deserialization time)."),d={}}if(l.inboundLayers.length>0){for(var f=[],p=0;p<l.inboundLayers.length;p++){var m=l.inboundLayers[p],g=l.nodeIndices[p],b=l.tensorIndices[p];null!==(w=n[t.nodeKey(m,g)])&&void 0!==w||(w=0),f.push([m.name,w,b,d])}u.push(f)}}}r.push({name:v.name,className:a,config:s,inboundNodes:u})}e.layers=r;var y=[];for(p=0;p<this.inputLayers.length;p++){var v=this.inputLayers[p];g=this.inputLayersNodeIndices[p],h=t.nodeKey(v,g),this.containerNodes.has(h)&&(null!==(w=n[h])&&void 0!==w||(w=0),b=this.inputLayersTensorIndices[p],y.push([v.name,w,b]))}e.inputLayers=y;var _=[];for(p=0;p<this.outputLayers.length;p++){var w;if(v=this.outputLayers[p],g=this.outputLayersNodeIndices[p],h=t.nodeKey(v,g),this.containerNodes.has(h))null!==(w=n[h])&&void 0!==w||(w=0),b=this.outputLayersTensorIndices[p],_.push([v.name,w,b])}return e.outputLayers=_,e},t.fromConfig=function(e,t){var n={},r={};function i(e,t){e.name in r?r[e.name].push(t):r[e.name]=[t]}function o(e,t){for(var r,o=[],a=0,s=t;a<s.length;a++){var u=s[a],c=u[0],l=u[1],h=u[2];if(3===u.length)r={};else{if(4!==u.length)throw new w("Improperly formatted model config for layer "+JSON.stringify(e)+": "+JSON.stringify(u));r=u[3]}if(!(c in n))return void i(e,t);var d=n[c];if(d.inboundNodes.length<=l)return void i(e,t);var f=d.inboundNodes[l];o.push(f.outputTensors[h])}o.length>0&&e.apply(A(o),r)}function a(e){var r=e.name,o=on(e,null!=t.customObjects?t.customObjects:{});n[r]=o;for(var a=0,s=e.inboundNodes;a<s.length;a++){var u=s[a];if(!(u instanceof Array))throw new w("Corrupted configuration, expected array for nodeData: "+u);i(o,u)}}for(var s=t.name,u=t.layers,c=0,l=u;c<l.length;c++)a(f=l[c]);for(;!L(r);)for(var h=0,d=u;h<d.length;h++){var f=d[h];if((N=n[f.name]).name in r){for(var p=0,m=r[N.name];p<m.length;p++)o(N,m[p]);delete r[N.name]}}for(var g=[],b=[],y=0,v=t.inputLayers;y<v.length;y++){var _=(f=v[y])[0],x=f[1],E=f[2];C(_ in n);var S=(N=n[_]).inboundNodes[x].outputTensors;g.push(S[E])}for(var O=0,M=t.outputLayers;O<M.length;O++){var N;_=(f=M[O])[0],x=f[1],E=f[2],C(_ in n),S=(N=n[_]).inboundNodes[x].outputTensors,b.push(S[E])}return new e({inputs:g,outputs:b,name:s})},Object.defineProperty(t.prototype,"stateful",{get:function(){if(this._stateful)throw new w("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 e=0,t=this.layers;e<t.length;e++)if(t[e].stateful)return!0;return!1},enumerable:!0,configurable:!0}),t.prototype.resetStates=function(){var e=this;Object(i.Od)(function(){e.layers.forEach(function(e){e.stateful&&e.resetStates()})})},t}(ht);var hn,dn=function(){function e(t){if(this.id2Value={},t instanceof e)for(var n in t.id2Value)this.id2Value[n]=t.id2Value[n];else{if(null==t)return;for(var r=0,i=t;r<i.length;r++){var o=i[r];this.add(o.key,o.value)}}}return e.prototype.add=function(e,t){if(null!=this.id2Value[e.id])throw new w("Duplicate key: name="+e.name+", id="+e.id);return this.id2Value[e.id]=function(e,t){if(null!=e.shape){if(e.shape.length!==t.shape.length)throw new w("The rank of feed ("+t.shape.length+") does not match the rank of the key ("+e.shape.length+").");for(var n=0;n<e.shape.length;++n)if(null!=e.shape[n]&&e.shape[n]!==t.shape[n])throw new w("The "+n+"-th dimension of the feed ("+t.shape[n]+") is incompatible with that of the key ("+e.shape[n]+").")}if(null==e.dtype||e.dtype===t.dtype)return t;try{return Object(i.M)(t,e.dtype)}catch(n){throw new w("The dtype of the feed ("+t.dtype+") can not be cast to the dtype of the key '"+e.name+"' ("+e.dtype+").")}}(e,t),this},e.prototype.addFeed=function(e){this.add(e.key,e.value)},e.prototype.hasKey=function(e){return null!=this.id2Value[e.id]},e.prototype.getValue=function(e){if(null==this.id2Value[e.id])throw new w("Nonexistent key: "+JSON.stringify(e));return this.id2Value[e.id]},e}();function fn(e,t,n){for(var r=Array.isArray(e),i=r?e:[e],o=[],a=new dn(t),s=0,u=i;s<u.length;s++){var c=u[s];o.push(pn(c,a,n))}return r?o:o[0]}function pn(e,t,n){if(t.hasKey(e))return t.getValue(e);if(e.sourceLayer instanceof dt)throw new w("Missing a feed value for SymbolicTensor from InputLayer '"+dt.name+"'");for(var r=[],i=0,o=e.inputs;i<o.length;i++){var a=pn(o[i],t,n);r.push(a)}var s=e.sourceLayer.apply(r,n);Array.isArray(s)||(s=[s]);for(var u=function(e){var t;if(1===e.sourceLayer.inboundNodes.length)t=e.sourceLayer.output;else{for(var n=null,r=0;r<e.sourceLayer.inboundNodes.length;++r)for(var i=0,o=e.sourceLayer.inboundNodes[r].outputTensors;i<o.length;i++)if(o[i].id===e.id){n=r;break}t=e.sourceLayer.getOutputAt(n)}return t}(e),c=Array.isArray(u)?u:[u],l=0;l<c.length;++l)t.add(c[l],s[l]);return 1===s.length?s[0]:s[e.outputTensorIndex]}function mn(e){return Array.isArray(e)}function gn(e){return!function(e){return e instanceof i.m}(e)&&!mn(e)}function bn(e,t,n,r,i){if(void 0===r&&(r=!0),void 0===i&&(i=""),null==t||0===t.length){if(null!=e){var o=!1;if(mn(e)&&e.length>0)o=!0;else if(gn(e)){for(var a in e)if(e.hasOwnProperty(a)){o=!0;break}}else o=!0;if(o)throw new w("Error when checking model "+i+" expected no data, but got "+e)}return[]}if(null==e)return t.map(function(e){return null});var s;if(gn(e)){e=e,s=[];for(var u=0,c=t;u<c.length;u++){var l=c[u];if(null==e[l])throw new w('No data provided for "'+l+'". Need data for each key in: '+t);s.push(e[l])}}else if(mn(e)){if((e=e).length!==t.length)throw new w("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 "+t.length+" Tensor(s), but instead got the following list of Tensor(s): "+e);s=e}else{if(e=e,t.length>1)throw new w("The model "+i+" expects "+t.length+" Tensor(s), but only received one Tensor. Found: Tensor with shape "+e.shape);s=[e]}for(var h=0;h<t.length;++h)1===(d=s[h]).shape.length&&(s[h]=ge(d,1));if(null!=n)for(h=0;h<t.length;++h)if(null!=n[h]){var d;if((d=s[h]).shape.length!==n[h].length)throw new w("Error when checking "+i+": expected "+t[h]+" to have "+n[h].length+" dimension(s). but got array with shape "+d.shape);for(var f=0;f<n[h].length;++f)if(0!==f||r){var p=d.shape[f],m=n[h][f];if(null!=m&&m>=0&&p!==m)throw new w("Error when checking "+i+": expected "+t[h]+" to have shape ["+n[h]+"], but got array with shape ["+d.shape+"].")}}return s}function yn(e,t){for(var n=[],r=0,i=null;r<e;)(i=r+t)>=e&&(i=e),n.push([r,i]),r=i;return n}function vn(e,t,n){return null==e?[null]:Array.isArray(e)?e.map(function(e){return be(e,t,n-t)}):be(e,t,n-t)}function _n(e,t){return Object(i.Od)(function(){return null==e?null:Array.isArray(e)?e.map(function(e){return _n(e,t)}):Ce(e,"int32"===t.dtype?t:t.toInt())})}function wn(e,t,n,r,i){var o;if(void 0===r&&(r=!0),void 0===i&&(i=""),Array.isArray(e)){if(e.length!==t.length)throw new w("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 "+t.length+" Tensor(s), but instead got "+e.length+" Tensors(s).");o=e}else{if(t.length>1)throw new w("The model expects "+t.length+" "+i+" Tensors, but only received one Tensor. Found: array with shape "+JSON.stringify(e.shape)+".");o=[e]}if(null!=n)for(var a=0;a<t.length;++a)if(null!=n[a]){var s=o[a];if(s.shape.length!==n[a].length)throw new w("Error when checking "+i+": expected "+t[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 w("Error when checking "+i+": expected "+t[a]+" to have shape "+JSON.stringify(n[a])+" but got array with shape "+JSON.stringify(s.shape)+".")}}}function xn(e){i.Yd.assert(e>0&&Number.isInteger(e),"batchSize is required to be a positive integer, but got "+e)}!function(e){e[e.SILENT=0]="SILENT",e[e.VERBOSE=1]="VERBOSE"}(hn||(hn={}));var En=function(e){function t(t){var n=e.call(this,t)||this;return n.isTraining=!1,n}return a(t,e),t.prototype.summary=function(e,t,n){if(void 0===n&&(n=console.log),!this.built)throw new w("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).");en(this,e,t,n)},t.prototype.compile=function(e){var t=this;if(null==e.loss&&(e.loss=[]),this.loss=e.loss,"string"==typeof e.optimizer)this.optimizer=function(e){var t={Adagrad:function(){return i.Td.adagrad(.01)},Adadelta:function(){return i.Td.adadelta(1,.95,h())},Adam:function(){return i.Td.adam(.001,.9,.999,h())},Adamax:function(){return i.Td.adamax(.002,.9,.999,h(),0)},RMSProp:function(){return i.Td.rmsprop(.001,.9,0,h())},SGD:function(){return i.Td.sgd(.01)}};if(t.adagrad=t.Adagrad,t.adadelta=t.Adadelta,t.adam=t.Adam,t.adamax=t.Adamax,t.rmsprop=t.RMSProp,t.sgd=t.SGD,e in t)return t[e]();throw new w("Unknown Optimizer "+e)}(e.optimizer);else{if(!(e.optimizer instanceof i.h))throw new w("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer=e.optimizer}var n=[];if(Array.isArray(e.loss)||"string"==typeof e.loss||"function"==typeof e.loss)if(Array.isArray(e.loss)){if(e.loss.length!==this.outputs.length)throw new w("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="+e.loss+".");var r=e.loss;n=r.map(function(e){return Bt(e)})}else{var o=Bt(e.loss);this.outputs.map(function(e){n.push(o)})}else{for(var a in e.loss=e.loss,e.loss)if(-1===this.outputNames.indexOf(a))throw new w('Unknown entry in loss dictionary: "'+a+'". Only expect the following keys: '+this.outputNames);for(var s in this.outputNames)null==e.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"),n.push(Bt(e.loss[s]))}this.lossFunctions=n,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 d=[];this.metrics=e.metrics,this.metricsNames=["loss"],this.metricsTensors=[],ie("loss",function(){for(var e=0;e<t.outputs.length;++e)if(-1===d.indexOf(e)){var n=t.lossFunctions[e];t.outputs.length>1&&(t.metricsTensors.push([n,e]),t.metricsNames.push(t.outputNames[e]+"_loss"))}});var f=function(e,t){if(null==e||Array.isArray(e)&&0===e.length)return t.map(function(e){return[]});if(Array.isArray(e))return t.map(function(t){return e});if(null!=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}throw new TypeError("Type of metrics argument not understood. Expected an Array or Object, found: "+e)}(e.metrics,this.outputNames);ie("metric",function(){for(var e=function(e){if(-1!==d.indexOf(e))return"continue";!function(n){for(var r,i,o,a=function(n){if(-1!==["accuracy","acc","crossentropy","ce"].indexOf(n)){var a=t.internalOutputShapes[e];1===a[a.length-1]||t.lossFunctions[e]===Pt?-1!==["accuracy","acc"].indexOf(n)?i=jt:-1!==["crossentropy","ce"].indexOf(n)&&(i=Wt):t.lossFunctions[e]===Tt?-1!==["accuracy","acc"].indexOf(n)?i=$t:-1!==["crossentropy","ce"].indexOf(n)&&(i=Qt):-1!==["accuracy","acc"].indexOf(n)?i=Ft:-1!==["crossentropy","ce"].indexOf(n)&&(i=Zt);var s=void 0;-1!==["accuracy","acc"].indexOf(n)?s="acc":-1!==["crossentropy","ce"].indexOf(n)&&(s="ce"),o=i,r=""+s}else{var u=function(e){var t={binaryAccuracy:jt,categoricalAccuracy:Ft,precision:Vt,categoricalCrossentropy:Zt,sparseCategoricalCrossentropy:Qt,mse:qt,MSE:Ht,mae:Gt,MAE:Kt,mape:Yt,MAPE:Xt,cosine:Jt};if("string"==typeof e&&e in t)return t[e];if("string"!=typeof e&&null!=e)return e;throw new w("Unknown metric "+e)}(n);o=u,r=""+n}var c;ie(r,function(){c=o}),function(e,n,r){t.outputNames.length>1&&(n=t.outputNames[e]+"_"+n),t.metricsNames.push(n),t.metricsTensors.push([r,e])}(e,r,c)},s=0,u=f[e];s<u.length;s++)a(u[s])}()},n=0;n<t.outputs.length;++n)e(n)}),this.collectedTrainableWeights=this.trainableWeights},t.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?")},t.prototype.evaluate=function(e,t,n){void 0===n&&(n={});var r=null==n.batchSize?32:n.batchSize;xn(r);var i=this.standardizeUserData(e,t,!0,r),o=i[0].concat(i[1]);this.makeTestFunction();var a=this.testFunction;return A(this.testLoop(a,o,r,n.verbose,n.steps))},t.prototype.checkNumSamples=function(e,t,n,r){var i;if(void 0===r&&(r="steps"),null!=n){if(i=null,null!=t)throw new w("If "+r+" is set, batchSize must be null or undefined.Got batchSize = "+t)}else{if(null==e)throw new w("Either the input data should have a defined shape, or "+r+" shoud be specified.");i=Array.isArray(e)?e[0].shape[0]:e.shape[0]}return i},t.prototype.execute=function(e,t){if(Array.isArray(t)&&0===t.length)throw new w("`outputs` is an empty Array, which is not allowed.");var n=Array.isArray(t),r=n?t:[t],o=this.retrieveSymbolicTensors(r),a=new dn;if(e instanceof i.m&&(e=[e]),Array.isArray(e)){if(e.length!==this.inputs.length)throw new w("The number of inputs provided ("+e.length+") does not match the number of inputs of this model ("+this.inputs.length+").");for(var s=0;s<this.inputs.length;++s)a.add(this.inputs[s],e[s])}else for(var u=0,c=this.inputs;u<c.length;u++){var l=c[u],h=e[l.name];if(null==h)throw new w("No value is provided for the model's input "+l.name);a.add(l,h)}var d=fn(o,a);return n?d:d[0]},t.prototype.retrieveSymbolicTensors=function(e){for(var t=S(null,e.length),n=e.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(e){return e.name}),u=0;u<e.length;++u){var c=s.indexOf(e[u]);if(-1!==c&&(t[u]=a[c],n--),0===n)break}if(0===n)break}if(n>0){var l=[];throw t.forEach(function(t,n){null==t&&l.push(e[n])}),new w("Cannot find SymbolicTensors for output name(s): "+JSON.stringify(l))}return t},t.prototype.predictLoop=function(e,t,n){var r=this;return void 0===t&&(t=32),void 0===n&&(n=!1),Object(i.Od)(function(){var o=r.checkNumSamples(e);if(n)throw new x("Verbose predictLoop() is not implemented yet.");for(var a=yn(o,t),s=[],u=function(t){var n=Object(i.Od)(function(){var n=a[t][0],i=a[t][1],o=vn(e,n,i),s=[];if(Array.isArray(o))for(var u=0;u<o.length;++u)s.push({key:r.inputs[u],value:o[u]});else s.push({key:r.inputs[0],value:o});var c=new dn(s);return fn(r.outputs,c)});if(0===t)for(var o=0,u=n;o<u.length;o++){var c=u[o];s.push(c)}else for(var l=0;l<n.length;++l)s[l]=we(s[l],n[l])},c=0;c<a.length;++c)u(c);return A(s)})},t.prototype.predict=function(e,t){void 0===t&&(t={}),wn(e,this.inputNames,this.feedInputShapes,!1);var n=null==t.batchSize?32:t.batchSize;return xn(n),this.predictLoop(e,n)},t.prototype.predictOnBatch=function(e){return wn(e,this.inputNames,this.feedInputShapes,!0),this.predictLoop(e,e.shape[0])},t.prototype.standardizeUserData=function(e,t,n,r){if(void 0===n&&(n=!0),null==this.optimizer)throw new _("You must compile a model before training/testing. Use Model.compile(modelCompileConfig).");for(var o=[],a=0;a<this.feedOutputShapes.length;++a){var s=this.feedOutputShapes[a];this.feedLossFns[a]===Tt?o.push(s.slice(0,s.length-1).concat([1])):o.push(s)}if(function(e,t,n){var r=D(e.map(function(e){return e.shape[0]}));r.sort();var o=D(t.map(function(e){return e.shape[0]}));if(o.sort(),r.length>1)throw new w("All input Tensors (x) should have the same number of samples. Got array shapes: "+JSON.stringify(e.map(function(e){return e.shape})));if(o.length>1)throw new w("All target Tensors (y) should have the same number of samples. Got array shapes: "+JSON.stringify(t.map(function(e){return e.shape})));if(r.length>0&&o.length>0&&!i.Yd.arraysEqual(r,o))throw new w("Input Tensors should have the same number of samples as target Tensors. Found "+r[0]+" input sample(s) and "+o[0]+" target sample(s).")}(e=bn(e,this.feedInputNames,this.feedInputShapes,!1,"input"),t=bn(t,this.feedOutputNames,o,!1,"target")),function(e,t,n){for(var r=[Et,Pt,It],i=0;i<e.length;++i){var o=e[i],a=t[i],s=n[i];if(null!=a){if(a===It&&1===o.shape[o.shape.length-1])throw new w("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 h=u[l],d=c[l];if(null!=d&&h!==d)throw new w("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.")}}}}(t,this.feedLossFns,this.feedOutputShapes),this.stateful&&null!=r&&r>0&&e[0].shape[0]%r!=0)throw new w("In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size "+r+". Found: "+e[0].shape[0]+" sample(s).");return[e,t,null]},t.prototype.fitLoop=function(e,t,n,r,o,a,s,l,h,d,f,p,m,g,b){return u(this,void 0,void 0,function(){var u,y,v,_,E,S,C,O,A=this;return c(this,function(M){switch(M.label){case 0:if(null==r&&(r=32),null==o&&(o=1),null==d&&(d=!0),null==p&&(p=0),u=!1,null!=l&&null!=h&&(u=!0),null!=g&&(u=!0,null==m))throw new w("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");return null!=(y=this.checkNumSamples(t,r,m,"steps_per_epoch"))&&(v=pe(0,y)),null==a&&(a=1),this.history=new vt,_=[new yt(b)].concat(wt.createCallbacks(a)),null!=s&&_.push.apply(_,s),_.push(this.history),(E=new gt(_)).setModel(this),E.setParams({epochs:o,initialEpoch:p,samples:y,steps:m,batchSize:r,verbose:a,doValidation:u,metrics:f}),[4,E.onTrainBegin()];case 1:M.sent(),this.stopTraining_=!1,S=function(o){var a,s,f,p,g;return c(this,function(b){switch(b.label){case 0:return[4,E.onEpochBegin(o)];case 1:if(b.sent(),a={},null==m)return[3,2];throw new x("stepsPerEpoch mode is not implemented yet.");case 2:if("batch"===d)throw new x("batch shuffling is not implemneted yet");d&&i.Yd.shuffle(v),s=Object(i.Hd)(v),f=yn(y,r),p=function(o){var d;return c(this,function(c){switch(c.label){case 0:return d={},[4,E.onBatchBegin(o,d)];case 1:return c.sent(),Object(i.Od)(function(){var c=f[o][0],p=f[o][1],m=be(s,c,p-c);d.batch=o,d.size=p-c;for(var g=_n(t,m),b=e(g),y=0;y<n.length;++y){var v=n[y],_=b[y];d[v]=_,Object(i.Ib)(_)}if(o===f.length-1&&u){var w=A.testLoop(l,h,r);for(y=0;y<n.length;++y)v=n[y],_=w[y],Object(i.Ib)(_),a["val_"+v]=_}}),[4,E.onBatchEnd(o,d)];case 2:return c.sent(),function(e){if(null!=e)for(var t in e){var n=e[t];"number"!=typeof n&&n.dispose()}}(d),C.stopTraining_?[2,"break"]:[2]}})},g=0,b.label=3;case 3:return g<f.length?[5,p(g)]:[3,6];case 4:if("break"===b.sent())return[3,6];b.label=5;case 5:return++g,[3,3];case 6:s.dispose(),b.label=7;case 7:return[4,E.onEpochEnd(o,a)];case 8:return b.sent(),C.stopTraining_?[2,"break"]:[2]}})},C=this,O=p,M.label=2;case 2:return O<o?[5,S(O)]:[3,5];case 3:if("break"===M.sent())return[3,5];M.label=4;case 4:return++O,[3,2];case 5:return[4,E.onTrainEnd()];case 6:return M.sent(),[4,this.history.syncData()];case 7:return M.sent(),[2,this.history]}})})},t.prototype.testLoop=function(e,t,n,r,o){var a=this;return void 0===r&&(r=0),Object(i.Od)(function(){var s=a.checkNumSamples(t,n,o,"steps"),u=[];if(1===r)throw new x("Verbose mode is not implemented yet.");if(null!=o)throw new x("steps mode in testLoop() is not implemented yet");for(var c=yn(s,n),l=Object(i.Hd)(pe(0,s)),h=0;h<c.length;++h){var d=c[h][0],f=c[h][1],p=be(l,d,f-d),m=_n(t,p),g=e(m);if(0===h)for(var b=0;b<g.length;++b)u.push(y(0));for(b=0;b<g.length;++b){var v=g[b];u[b]=Object(i.s)(u[b],Object(i.oc)(y(f-d),v))}}for(b=0;b<u.length;++b)u[b]=Object(i.hb)(u[b],y(s));return u})},t.prototype.getDedupedMetricsNames=function(){for(var e=this.metricsNames,t=[],n=0;n<e.length;++n){var r=e[n],i=r;O(e,r)>1&&(i+="_"+O(e.slice(0,n),r)),t.push(i)}return t},t.prototype.makeTestFunction=function(){var e=this;this.testFunction=function(t){return Object(i.Od)(function(){for(var n,r=[],o=t.slice(0,e.inputs.length),a=t.slice(e.inputs.length,e.inputs.length+e.outputs.length),s=[],u=0;u<e.inputs.length;++u)s.push({key:e.inputs[u],value:o[u]});var c=new dn(s),l=fn(e.outputs,c);for(u=0;u<e.lossFunctions.length;++u){var h=e.lossFunctions[u],d=Object(i.fc)(h(a[u],l[u]));n=0===u?d:Object(i.s)(n,d),r.push(n)}for(u=0;u<e.metricsTensors.length;++u){var f=e.metricsTensors[u][0],p=e.metricsTensors[u][1],m=Object(i.fc)(f(a[p],l[p]));r.push(m)}return r})}},t.prototype.fit=function(e,t,n){return void 0===n&&(n={}),u(this,void 0,void 0,function(){var r,o,a,s,u,l,h,d,f,p,m,g,b,y,v,_,E,S,C,O=this;return c(this,function(c){switch(c.label){case 0:if(this.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");this.isTraining=!0,c.label=1;case 1:if(c.trys.push([1,,3,4]),xn(r=null==n.batchSize?32:n.batchSize),o=this.standardizeUserData(e,t,!1,r),a=o[0],s=o[1],u=!1,l=void 0,h=void 0,d=void 0,f=!1,null!=n.validationData&&n.validationData.length>0){if(u=!0,2!==n.validationData.length)throw 3===n.validationData.length?new x("validationData including sample weights is not supported yet."):new w("When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; "+n.validationData+" is invalid.");l=n.validationData[0],h=n.validationData[1],p=this.standardizeUserData(l,h,!0,r),l=p[0],h=p[1],d=l.concat(h)}else null!=n.validationSplit&&n.validationSplit>0&&n.validationSplit<1?(u=!0,m=Math.floor(a[0].shape[0]*(1-n.validationSplit)),g=a[0].shape[0],l=vn(a,m,g),a=vn(a,0,m),h=vn(s,m,g),s=vn(s,0,m),f=!0,d=l.concat(h)):null!=n.validationSteps&&(u=!0);return b=a.concat(s),this.checkTrainableWeightsConsistency(),y=function(e){var t=e.slice(0,O.inputs.length),n=e.slice(O.inputs.length,O.inputs.length+O.outputs.length),r=[],o=O.collectedTrainableWeights.map(function(e){return e.read()});return[O.optimizer.minimize(function(){for(var e=[],o=0;o<O.inputs.length;++o)e.push({key:O.inputs[o],value:t[o]});var a,s=new dn(e),u=fn(O.outputs,s,{training:!0});for(o=0;o<O.lossFunctions.length;++o){var c=(0,O.lossFunctions[o])(n[o],u[o]);Object(i.fc)(c),a=0===o?c:Object(i.s)(a,c)}for(o=0;o<O.metricsTensors.length;++o){var l=O.metricsTensors[o][0],h=O.metricsTensors[o][1],d=Object(i.fc)(l(n[h],u[h]));Object(i.Ib)(d),r.push(d)}return a=Object(i.fc)(a),O.calculateLosses().forEach(function(e){a=Object(i.s)(a,e)}),a},!0,o)].concat(r)},v=this.getDedupedMetricsNames(),_=void 0,E=void 0,u?(this.makeTestFunction(),_=this.testFunction,E=v.slice().concat(v.map(function(e){return"val_"+e}))):(_=null,d=[],E=v.slice()),S=function(e){return null==e?null:e instanceof mt?[e]:Array.isArray(e)&&e[0]instanceof mt?e:M(e).map(function(e){return new _t(e)})}(n.callbacks),[4,this.fitLoop(y,b,v,r,n.epochs,n.verbose,S,_,d,n.shuffle,E,n.initialEpoch,null,null,n.yieldEvery)];case 2:return C=c.sent(),f&&(d.forEach(function(e){return e.dispose()}),a.forEach(function(e){return e.dispose()}),s.forEach(function(e){return e.dispose()})),this.isTraining=!1,[2,C];case 3:return this.isTraining=!1,[7];case 4:return[2]}})})},t.prototype.getNamedWeights=function(e){for(var t={},n=null!=e&&e.trainableOnly,r=n?this.trainableWeights:this.weights,i=this.getWeights(n),o=0;o<r.length;++o)n&&!r[o].trainable||(t[r[o].originalName]=i[o]);return t},Object.defineProperty(t.prototype,"stopTraining",{set:function(e){this.stopTraining_=e},enumerable:!0,configurable:!0}),t.prototype.save=function(e,t){return u(this,void 0,void 0,function(){var n,r,o,a,s;return c(this,function(u){switch(u.label){case 0:if("string"==typeof e){if(0===(n=i.Hb.getSaveHandlers(e)).length)throw new w("Cannot find any save handlers for URL '"+e+"'");if(n.length>1)throw new w("Found more than one ("+n.length+") save handlers for URL '"+e+"'");e=n[0]}if(null==e.save)throw new w("Model.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");return[4,i.Hb.encodeWeights(this.getNamedWeights(t))];case 1:return r=u.sent(),o=!1,a=null,s=this.toJSON(a,o),[2,e.save({modelTopology:s,weightData:r.data,weightSpecs:r.specs})]}})})},t.className="Model",t}(ln);function Sn(e,t){return void 0===t&&(t=!0),u(this,void 0,void 0,function(){var n;return c(this,function(r){if("string"==typeof e){if(0===(n=i.Hb.getLoadHandlers(e)).length)n.push(i.Hb.browserHTTPRequest(e));else if(n.length>1)throw new w("Found more than one ("+n.length+") load handlers for URL '"+e+"'");e=n[0]}return[2,function(e,t,n){return void 0===n&&(n=!0),u(this,void 0,void 0,function(){var r,o,a,s,u;return c(this,function(c){switch(c.label){case 0:if(null==e.load)throw new w("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");return[4,e.load()];case 1:if(r=c.sent(),null!=(o=r.modelTopology).model_config&&(o=o.model_config),a=on(function e(t,n){if(null===t)return null;if("string"==typeof t)return k(t);if("number"==typeof t||"boolean"==typeof t)return t;if(t instanceof Array){for(var r=[],i=t.length,o=0;o<i;++o){var a=t[o];an(n,o,a)?r.push(a):r.push(e(a,n))}return r}for(var s={},u=0,c=Object.keys(t);u<c.length;u++){var l=c[u],h=t[l];if("name"===l&&"string"==typeof h)s[l]=h;else{var d=k(l);s[d]=e(h,d)}}return s}(o),t),null!=r.weightData){if(null==r.weightSpecs)throw new w("Model artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.");s=!1,u=!0,a.loadWeights(i.Hb.decodeWeights(r.weightData,r.weightSpecs),s,u,n)}return[2,a]}})})}(e,void 0,t)]})})}i.ed.registerClass(En);var Cn=function(e){function t(t){var n=e.call(this,{inputs:[],outputs:[]})||this;if(t=t||{},n.trainable=!0,n._updatable=!0,n.built=!1,n.name=null!=t.name?t.name:m("sequential_"),null!=t.layers)for(var r=0,i=t.layers;r<i.length;r++){var o=i[r];n.add(o)}return n}return a(t,e),t.prototype.checkShape=function(e){if(e.inboundNodes[0].outputTensors[0].shape.some(function(e){return e<0}))throw new w("Negative dimension size caused by adding layer "+e.name+" with input shape ["+e.inboundNodes[0].inputTensors[0].shape+"]")},t.prototype.add=function(e){var n,r=e instanceof t||e instanceof En;if(r){if(1!==(n=e).outputs.length)throw new w("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");if(1!==n.inputs.length)throw new w("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===e.inboundNodes.length){if(null==e.batchInputShape)throw new w("The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.");var i=ft({batchShape:e.batchInputShape,dtype:e.dtype,name:e.name+"_input"});e.apply(i)}if(r)this.outputs=n.outputs,this.inputs=n.inputs;else{if(1!==e.inboundNodes.length)throw new w("A layer added to a Sequential model must not already be connected somewhere else. Model received layer "+e.name+" which has "+e.inboundNodes.length+" pre-existing inbound connections.");if(1!==e.inboundNodes[0].outputTensors.length)throw new w("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[e.inboundNodes[0].outputTensors[0]],this.inputs=function e(t,n,r){if((null==n||null!=r&&r>0)&&(n=t.sourceLayer,r=t.nodeIndex),0===n.inboundNodes.length)return[t];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=e(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 ct({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:S(null,this.inputs.length),outputMasks:[null],inputShapes:this.inputs.map(function(e){return e.shape}),outputShapes:this.outputs[0].shape})}else{var o=e.apply(this.outputs[0]);if(Array.isArray(o))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(e),this.outputs=[o],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}this.layers.push(e),this.built=!1},t.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 e=this.layers.length-1;this.layers[e].outboundNodes=[],this.outputs=[this.layers[e].output],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}},t.prototype.call=function(e,t){return null==this.model&&this.build(),this.model.call(e,t)},t.prototype.build=function(e){if(et(e),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 En({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},t.prototype.countParams=function(){return this.built||this.build(),e.prototype.countParams.call(this)},t.prototype.summary=function(t,n,r){void 0===r&&(r=console.log),this.built||this.build(),e.prototype.summary.call(this,t,n,r)},t.prototype.setWeights=function(e){null==this.model&&this.build(),this.model.setWeights(e)},Object.defineProperty(t.prototype,"updatable",{get:function(){return this._updatable},set:function(e){this.built&&(this.model.updatable=e),this._updatable=e},enumerable:!0,configurable:!0}),t.prototype.evaluate=function(e,t,n){if(void 0===n&&(n={}),!this.built)throw new _("The model needs to be compiled before being used.");return this.model.evaluate(e,t,n)},t.prototype.predict=function(e,t){return void 0===t&&(t={}),null==this.model&&this.build(),this.model.predict(e,t)},t.prototype.predictOnBatch=function(e){return null==this.model&&this.build(),this.model.predictOnBatch(e)},t.prototype.compile=function(e){this.build(),this.model.compile(e),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},t.prototype.fit=function(e,t,n){return void 0===n&&(n={}),u(this,void 0,void 0,function(){return c(this,function(r){if(!this.built)throw new _("The model needs to be compiled before being used.");return[2,this.model.fit(e,t,n)]})})},t.fromConfig=function(e,n){var r=new e({});if(!(r instanceof t))throw new w("Sequential.fromConfig called on non-Sequential input: "+r);if(!(n instanceof Array))throw new w("Sequential.fromConfig called without an array of configs");if(null==n[0].className||"Merge"===n[0].className)throw new w("Legacy serialization format not supported yet.");for(var i=0,o=n;i<o.length;i++){var a=on(o[i]);r.add(a)}return r},Object.defineProperty(t.prototype,"stopTraining",{set:function(e){this.model.stopTraining=e},enumerable:!0,configurable:!0}),t.prototype.getConfig=function(){for(var e=[],t=0,n=this.layers;t<n.length;t++){var r=n[t];e.push({className:r.getClassName(),config:r.getConfig()})}return e},t.className="Sequential",t}(En);function On(e){return new En(e)}function An(e){return new Cn(e)}function Mn(e,t){return void 0===t&&(t=!0),Sn(e,t)}function Nn(e){return ft(e)}function kn(e,t){wt.registerCallbackConstructor(e,t)}i.ed.registerClass(Cn);var In=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.getConfig=function(){return{}},t}(i.ed.Serializable),Tn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.apply=function(e,t){return void 0===t&&(t=1),function(e,t){if(void 0===t&&(t=1),1!==t)throw new x("Support for alpha values other than 1 ("+t+") is not implemented yet.");return Object(i.kb)(e)}(e,t)},t.className="elu",t}(In);i.ed.registerClass(Tn);var Pn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.apply=function(e){return Object(i.cd)(e)},t.className="selu",t}(In);i.ed.registerClass(Pn);var Rn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.apply=function(e){return Object(i.Sc)(e)},t.className="relu",t}(In);i.ed.registerClass(Rn);var Dn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.apply=function(e){return Object(i.Od)(function(){return Object(i.ic)(y(6),Object(i.Sc)(e))})},t.className="relu6",t}(In);i.ed.registerClass(Dn);var Ln=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.apply=function(e){return e},t.className="linear",t}(In);i.ed.registerClass(Ln);var Bn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.apply=function(e){return Object(i.gd)(e)},t.className="sigmoid",t}(In);i.ed.registerClass(Bn);var jn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.apply=function(e){return function(e){return Object(i.Od)(function(){var t=Object(i.s)(y(.5),Object(i.oc)(y(.2),e));return Object(i.O)(t,0,1)})}(e)},t.className="hardSigmoid",t}(In);i.ed.registerClass(jn);var Fn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.apply=function(e){return Object(i.qd)(e)},t.className="softplus",t}(In);i.ed.registerClass(Fn);var zn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.apply=function(e){return function(e){return Object(i.Od)(function(){return Object(i.hb)(e,Object(i.s)(y(1),Object(i.p)(e)))})}(e)},t.className="softsign",t}(In);i.ed.registerClass(zn);var Vn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.apply=function(e){return Object(i.Fd)(e)},t.className="tanh",t}(In);i.ed.registerClass(Vn);var Un=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.apply=function(e,t){return void 0===t&&(t=-1),Object(i.pd)(e,t)},t.className="softmax",t}(In);function Wn(e){return e.getClassName()}function $n(e,t){return void 0===t&&(t={}),P(e,i.ed.SerializationMap.getMap().classNameMap,t,"activation")}function qn(e){return null==e?$n({className:"linear",config:{}}):"string"==typeof e?$n({className:e,config:{}}):e instanceof In?e:$n(e)}i.ed.registerClass(Un);var Hn=function(e){function t(t){var n=e.call(this,null==t?{}:t)||this;return n.supportsMasking=!0,null!=t&&(n.maxValue=t.maxValue),n}return a(t,e),t.prototype.call=function(e,t){e=Qe(e);var n=Object(i.Sc)(e);return null!=this.maxValue&&(n=Object(i.O)(n,0,this.maxValue)),n},t.prototype.computeOutputShape=function(e){return e},t.prototype.getConfig=function(){var t={maxValue:this.maxValue},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="ReLU",t}(ht);i.ed.registerClass(Hn);var Gn=function(e){function t(t){var n=e.call(this,null==t?{}:t)||this;return n.DEFAULT_ALPHA=.3,null==t&&(t={}),n.alpha=null==t.alpha?n.DEFAULT_ALPHA:t.alpha,n}return a(t,e),t.prototype.call=function(e,t){var n=Qe(e);return Object(i.Jb)(n,this.alpha)},t.prototype.computeOutputShape=function(e){return e},t.prototype.getConfig=function(){var t={alpha:this.alpha},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="LeakyReLU",t}(ht);i.ed.registerClass(Gn);var Kn=function(e){function t(t){var n=e.call(this,null==t?{}:t)||this;if(n.DEFAULT_ALPHA=1,null==t&&(t={}),null!=t.alpha&&t.alpha!==n.DEFAULT_ALPHA)throw new x("Non-default alpha value ("+t.alpha+") is not supported by the ELU layer yet.");return n.alpha=null==t.alpha?n.DEFAULT_ALPHA:t.alpha,n}return a(t,e),t.prototype.call=function(e,t){var n=Qe(e);return Object(i.kb)(n)},t.prototype.computeOutputShape=function(e){return e},t.prototype.getConfig=function(){var t={alpha:this.alpha},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="ELU",t}(ht);i.ed.registerClass(Kn);var Yn=function(e){function t(t){var n=e.call(this,null==t?{}:t)||this;return n.DEFAULT_THETA=1,null==t&&(t={}),n.theta=null==t.theta?n.DEFAULT_THETA:t.theta,n.thetaTensor=y(n.theta),n}return a(t,e),t.prototype.call=function(e,t){var n=Qe(e);return n.mul(me(n.greater(this.thetaTensor),"float32"))},t.prototype.computeOutputShape=function(e){return e},t.prototype.getConfig=function(){var t={theta:this.theta},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="ThresholdedReLU",t}(ht);i.ed.registerClass(Yn);var Xn=function(e){function t(t){var n=e.call(this,null==t?{}:t)||this;return n.DEFAULT_AXIS=1,null==t&&(t={}),n.softmax=(new Un).apply,n.axis=null==t.axis?n.DEFAULT_AXIS:t.axis,n}return a(t,e),t.prototype.call=function(e,t){var n=Qe(e);return this.softmax(n,this.axis)},t.prototype.computeOutputShape=function(e){return e},t.prototype.getConfig=function(){var t={axis:this.axis},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="Softmax",t}(ht);i.ed.registerClass(Xn);var Zn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t}(i.ed.Serializable),Jn=function(e){function t(t){var n=e.call(this)||this,r=null==t||null==t.l1?.01:t.l1,i=null==t||null==t.l2?.01:t.l2;return n.hasL1=0!==r,n.hasL2=0!==i,n.l1=y(r),n.l2=y(i),n}return a(t,e),t.prototype.apply=function(e){var t=this;return Object(i.Od)(function(){var n=Object(i.he)([1]);return t.hasL1&&(n=Object(i.s)(n,Object(i.Dd)(Object(i.oc)(t.l1,Object(i.p)(e))))),t.hasL2&&(n=Object(i.s)(n,Object(i.Dd)(Object(i.oc)(t.l2,Oe(e))))),n.asScalar()})},t.prototype.getConfig=function(){return{l1:this.l1.dataSync()[0],l2:this.l2.dataSync()[0]}},t.fromConfig=function(e,t){return new e({l1:t.l1,l2:t.l2})},t.className="L1L2",t}(Zn);i.ed.registerClass(Jn);var Qn={l1l2:"L1L2"};function er(e){return T(e)}function tr(e,t){return void 0===t&&(t={}),P(e,i.ed.SerializationMap.getMap().classNameMap,t,"regularizer")}function nr(e){return null==e?null:"string"==typeof e?tr({className:e in Qn?Qn[e]:e,config:{}}):e instanceof Zn?e:tr(e)}function rr(e,t,n){if("number"==typeof e)return S(e,t);if(e.length!==t)throw new w("The "+n+" argument must be a tuple of "+t+" integers. Received: "+e.length+" elements.");for(var r=0;r<t;++r){var i=e[r];if(!ce(i))throw new w("The "+n+" argument must be a tuple of "+t+" integers. Received: "+JSON.stringify(e)+" including a non-integer number "+i)}return e}function ir(e,t,n,r,i){return void 0===i&&(i=1),null==e?e:(o="same"===n?e:e-(t+(t-1)*(i-1))+1,Math.floor((o+r-1)/r));var o}function or(e,t,n,r){if(null==e)return null;if("valid"===r)e=e*t+fe([n-t,0]);else{if("same"!==r)throw new w("Unsupport padding mode: "+r+".");e*=t}return e}function ar(e,t){return Object(i.Od)(function(){return J(t),"channelsFirst"===t?Object(i.Ud)(e,[0,2,3,1]):e})}var sr=function(e){function t(n,r){var i=e.call(this,r)||this;if(i.bias=null,i.DEFAULT_KERNEL_INITIALIZER="glorotNormal",i.DEFAULT_BIAS_INITIALIZER="zeros",t.verifyConfig(r),i.rank=n,1!==i.rank&&2!==i.rank)throw new x("Convolution layer for rank other than 1 or 2 ("+i.rank+") is not implemented yet.");if(i.kernelSize=rr(r.kernelSize,n,"kernelSize"),i.strides=rr(null==r.strides?1:r.strides,n,"strides"),i.padding=null==r.padding?"valid":r.padding,ee(i.padding),i.dataFormat=null==r.dataFormat?"channelsLast":r.dataFormat,J(i.dataFormat),i.activation=qn(r.activation),i.useBias=null==r.useBias||r.useBias,i.biasInitializer=Ye(r.biasInitializer||i.DEFAULT_BIAS_INITIALIZER),i.biasConstraint=K(r.biasConstraint),i.biasRegularizer=nr(r.biasRegularizer),i.activityRegularizer=nr(r.activityRegularizer),i.dilationRate=rr(null==r.dilationRate?1:r.dilationRate,n,"dilationRate"),1===i.rank&&Array.isArray(i.dilationRate)&&1!==i.dilationRate.length)throw new w("dilationRate must be a number or an array of a single number for 1D convolution, but received "+JSON.stringify(i.dilationRate));if(2===i.rank)if("number"==typeof i.dilationRate)i.dilationRate=[i.dilationRate,i.dilationRate];else if(2!==i.dilationRate.length)throw new w("dilationRate must be a number or array of two numbers for 2D convolution, but received "+JSON.stringify(i.dilationRate));return i}return a(t,e),t.verifyConfig=function(e){if(C("kernelSize"in e,"required key 'kernelSize' not in config"),"number"!=typeof e.kernelSize&&!j(e.kernelSize,"number",1,2))throw new w("BaseConv expects config.kernelSize to be number or number[] with length 1 or 2, but received "+JSON.stringify(e.kernelSize)+".")},t.prototype.getConfig=function(){var t={kernelSize:this.kernelSize,strides:this.strides,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,activation:Wn(this.activation),useBias:this.useBias,biasInitializer:Ke(this.biasInitializer),biasRegularizer:er(this.biasRegularizer),activityRegularizer:er(this.activityRegularizer),biasConstraint:H(this.biasConstraint)},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t}(ht),ur=function(e){function t(n,r){var i=e.call(this,n,r)||this;return i.kernel=null,t.verifyConfig(r),i.filters=r.filters,i.kernelInitializer=Ye(r.kernelInitializer||i.DEFAULT_KERNEL_INITIALIZER),i.kernelConstraint=K(r.kernelConstraint),i.kernelRegularizer=nr(r.kernelRegularizer),i}return a(t,e),t.prototype.build=function(e){e=et(e);var t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t])throw new w("The channel dimension of the input should be defined. Found "+e[t]);var n,r=e[t],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[t]=r,n)}],this.built=!0},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){var t;e=Qe(e);var r=null==n.bias?null:n.bias.read();if(1===n.rank)t=function(e,t,n,r,o,a,s){return void 0===r&&(r=1),void 0===o&&(o="valid"),void 0===s&&(s=1),Object(i.Od)(function(){if(null==a&&(a="channelsLast"),J(a),3!==e.shape.length)throw new w("The input of a conv1dWithBias operation should be 3, but is "+e.shape.length+" instead.");if(3!==t.shape.length)throw new w("The kernel for a conv1dWithBias operation should be 3, but is "+t.shape.length+" instead");if(null!=n&&1!==n.shape.length)throw new w("The bias for a conv1dWithBias operation should be 1, but is "+t.shape.length+" instead");if("channelsFirst"===a&&(e=Object(i.Ud)(e,[0,2,1])),"causal"===o)throw new x("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");var u=Object(i.W)(e,t,r,"same"===o?"same":"valid","NWC",s);return null!=n&&(u=Ae(u,n)),u})}(e,n.kernel.read(),r,n.strides[0],n.padding,n.dataFormat,n.dilationRate[0]);else if(2===n.rank)t=function(e,t,n,r,o,a,s){return void 0===r&&(r=[1,1]),void 0===o&&(o="valid"),Object(i.Od)(function(){if(null==a&&(a="channelsLast"),J(a),3!==e.rank&&4!==e.rank)throw new w("conv2dWithBias expects input to be of rank 3 or 4, but received "+e.rank+".");if(3!==t.rank&&4!==t.rank)throw new w("conv2dWithBias expects kernel to be of rank 3 or 4, but received "+e.rank+".");var u=ar(e,a);if("causal"===o)throw new x("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");return u=Object(i.X)(u,t,r,"same"===o?"same":"valid","NHWC",s),null!=n&&(u=Ae(u,n)),"channelsFirst"===a&&(u=Object(i.Ud)(u,[0,3,1,2])),u})}(e,n.kernel.read(),r,n.strides,n.padding,n.dataFormat,n.dilationRate);else if(3===n.rank)throw new x("3D convolution is not implemented yet.");return null!=n.activation&&(t=n.activation.apply(t)),t})},t.prototype.computeOutputShape=function(e){e=et(e);for(var t=[],n="channelsLast"===this.dataFormat?e.slice(1,e.length-1):e.slice(2),r=0;r<n.length;++r){var i=ir(n[r],this.kernelSize[r],this.padding,this.strides[r],"number"==typeof this.dilationRate?this.dilationRate:this.dilationRate[r]);t.push(i)}var o=[e[0]];return"channelsLast"===this.dataFormat?(o=o.concat(t)).push(this.filters):(o.push(this.filters),o=o.concat(t)),o},t.prototype.getConfig=function(){var t={filters:this.filters,kernelInitializer:Ke(this.kernelInitializer),kernelRegularizer:er(this.kernelRegularizer),kernelConstraint:H(this.kernelConstraint)},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.verifyConfig=function(e){if(!("filters"in e)||"number"!=typeof e.filters||e.filters<1)throw new w("Convolution layer expected config.filters to be a 'number' > 0 but got "+JSON.stringify(e.filters))},t}(sr),cr=function(e){function t(n){var r=e.call(this,2,n)||this;return t.verifyConfig(n),r}return a(t,e),t.prototype.getConfig=function(){var t=e.prototype.getConfig.call(this);return delete t.rank,t},t.verifyConfig=function(e){if("number"!=typeof e.kernelSize&&!j(e.kernelSize,"number",1,2))throw new w("Conv2D expects config.kernelSize to be number or number[] with length 1 or 2, but received "+JSON.stringify(e.kernelSize)+".")},t.className="Conv2D",t}(ur);i.ed.registerClass(cr);var lr=function(e){function t(t){var n=e.call(this,t)||this;if(n.inputSpec=[new at({ndim:4})],"same"!==n.padding&&"valid"!==n.padding)throw new w("Conv2DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode "+n.padding);return n}return a(t,e),t.prototype.build=function(e){if(4!==(e=et(e)).length)throw new w("Input should have rank 4; Received input shape: "+JSON.stringify(e));var t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t])throw new w("The channel dimension of the inputs should be defined. Found `None`.");var n,r=e[t],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 at({ndim:4,axes:(n={},n[t]=r,n)})],this.built=!0},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){var t=Qe(e);if(4!==t.shape.length)throw new w("Conv2DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-"+t.shape.length);var r,o,a=t.shape,s=a[0];"channelsFirst"===n.dataFormat?(r=2,o=3):(r=1,o=2);var u=a[r],c=a[o],l=n.kernelSize[0],h=n.kernelSize[1],d=n.strides[0],f=n.strides[1],p=[s,or(u,d,l,n.padding),or(c,f,h,n.padding),n.filters];"channelsLast"!==n.dataFormat&&(t=Object(i.Ud)(t,[0,2,3,1]));var m=Object(i.Y)(t,n.kernel.read(),p,n.strides,n.padding);return"channelsLast"!==n.dataFormat&&(m=Object(i.Ud)(m,[0,3,1,2])),null!=n.bias&&(m=Ae(m,n.bias.read(),n.dataFormat)),null!=n.activation&&(m=n.activation.apply(m)),m})},t.prototype.computeOutputShape=function(e){var t,n,r,i=(e=et(e)).slice();"channelsFirst"===this.dataFormat?(t=1,n=2,r=3):(t=3,n=1,r=2);var o=this.kernelSize[0],a=this.kernelSize[1],s=this.strides[0],u=this.strides[1];return i[t]=this.filters,i[n]=or(i[n],s,o,this.padding),i[r]=or(i[r],u,a,this.padding),i},t.prototype.getConfig=function(){var t=e.prototype.getConfig.call(this);return delete t.dilationRate,t},t.className="Conv2DTranspose",t}(cr);i.ed.registerClass(lr);var hr=function(e){function t(t){return e.call(this,2,t)||this}return a(t,e),t.className="SeparableConv2D",t}(function(e){function t(t,n){var r=e.call(this,t,n)||this;if(r.DEFAULT_DEPTHWISE_INITIALIZER="glorotUniform",r.DEFAULT_POINTWISE_INITIALIZER="glorotUniform",r.depthwiseKernel=null,r.pointwiseKernel=null,null==n.filters)throw new w("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(null!=n.kernelInitializer||null!=n.kernelRegularizer||null!=n.kernelConstraint)throw new w("Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.");if(null!=n.padding&&"same"!==n.padding&&"valid"!==n.padding)throw new w("SeparableConv"+r.rank+"D supports only padding modes: 'same' and 'valid', but received "+JSON.stringify(n.padding));return r.depthMultiplier=null==n.depthMultiplier?1:n.depthMultiplier,r.depthwiseInitializer=Ye(n.depthwiseInitializer||r.DEFAULT_DEPTHWISE_INITIALIZER),r.depthwiseRegularizer=nr(n.depthwiseRegularizer),r.depthwiseConstraint=K(n.depthwiseConstraint),r.pointwiseInitializer=Ye(n.depthwiseInitializer||r.DEFAULT_POINTWISE_INITIALIZER),r.pointwiseRegularizer=nr(n.pointwiseRegularizer),r.pointwiseConstraint=K(n.pointwiseConstraint),r}return a(t,e),t.prototype.build=function(e){if((e=et(e)).length<this.rank+2)throw new w("Inputs to SeparableConv"+this.rank+"D should have rank "+(this.rank+2)+", but received input shape: "+JSON.stringify(e));var t,n="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[n]||e[n]<0)throw new w("The channel dimension of the inputs should be defined, but found "+JSON.stringify(e[n]));for(var r=e[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 at({ndim:this.rank+2,axes:(t={},t[n]=r,t)})],this.built=!0},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){var t;if(e=Qe(e),1===n.rank)throw new x("1D separable convolution is not implemented yet.");return 2===n.rank&&("channelsFirst"===n.dataFormat&&(e=Object(i.Ud)(e,[0,2,3,1])),t=Object(i.dd)(e,n.depthwiseKernel.read(),n.pointwiseKernel.read(),n.strides,n.padding,n.dilationRate,"NHWC")),n.useBias&&(t=Ae(t,n.bias.read(),n.dataFormat)),null!=n.activation&&(t=n.activation.apply(t)),"channelsFirst"===n.dataFormat&&(t=Object(i.Ud)(t,[0,3,1,2])),t})},t.prototype.getConfig=function(){var t=e.prototype.getConfig.call(this);return delete t.rank,delete t.kernelInitializer,delete t.kernelRegularizer,delete t.kernelConstraint,t.depthwiseInitializer=Ke(this.depthwiseInitializer),t.pointwiseInitializer=Ke(this.pointwiseInitializer),t.depthwiseRegularizer=er(this.depthwiseRegularizer),t.pointwiseRegularizer=er(this.pointwiseRegularizer),t.depthwiseConstraint=H(this.depthwiseConstraint),t.pointwiseConstraint=H(this.pointwiseConstraint),t},t.className="SeparableConv",t}(ur));i.ed.registerClass(hr);var dr=function(e){function t(n){var r=e.call(this,1,n)||this;return t.verifyConfig(n),r.inputSpec=[{ndim:3}],r}return a(t,e),t.prototype.getConfig=function(){var t=e.prototype.getConfig.call(this);return delete t.rank,delete t.dataFormat,t},t.verifyConfig=function(e){if("number"!=typeof e.kernelSize&&!j(e.kernelSize,"number",1,1))throw new w("Conv1D expects config.kernelSize to be number or number[] with length 1, but received "+JSON.stringify(e.kernelSize)+".")},t.className="Conv1D",t}(ur);i.ed.registerClass(dr);var fr=function(e){function t(t){var n=e.call(this,t)||this;return"number"==typeof t.cropping?n.cropping=[[t.cropping,t.cropping],[t.cropping,t.cropping]]:"number"==typeof t.cropping[0]?n.cropping=[[t.cropping[0],t.cropping[0]],[t.cropping[1],t.cropping[1]]]:n.cropping=t.cropping,n.dataFormat=void 0===t.dataFormat?"channelsLast":t.dataFormat,n.inputSpec=[{ndim:4}],n}return a(t,e),t.prototype.computeOutputShape=function(e){return"channelsFirst"===this.dataFormat?[e[0],e[1],e[2]-this.cropping[0][0]-this.cropping[0][1],e[3]-this.cropping[1][0]-this.cropping[1][1]]:[e[0],e[1]-this.cropping[0][0]-this.cropping[0][1],e[2]-this.cropping[1][0]-this.cropping[1][1],e[3]]},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){return e=Qe(e),"channelsLast"===n.dataFormat?ve(ve(e,n.cropping[0][0],e.shape[1]-n.cropping[0][0]-n.cropping[0][1],2),n.cropping[1][0],e.shape[2]-n.cropping[1][1]-n.cropping[1][0],3):ve(ve(e,n.cropping[0][0],e.shape[2]-n.cropping[0][0]-n.cropping[0][1],3),n.cropping[1][0],e.shape[3]-n.cropping[1][1]-n.cropping[1][0],4)})},t.prototype.getConfig=function(){var t={cropping:this.cropping,dataFormat:this.dataFormat},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="Cropping2D",t}(ht);i.ed.registerClass(fr);var pr=function(e){function t(t){var n=e.call(this,t)||this;return n.DEFAULT_SIZE=[2,2],n.inputSpec=[{ndim:4}],n.size=null==t.size?n.DEFAULT_SIZE:t.size,n.dataFormat=null==t.dataFormat?"channelsLast":t.dataFormat,n}return a(t,e),t.prototype.computeOutputShape=function(e){if("channelsFirst"===this.dataFormat){var t=null==e[2]?null:this.size[0]*e[2],n=null==e[3]?null:this.size[1]*e[3];return[e[0],e[1],t,n]}return t=null==e[1]?null:this.size[0]*e[1],n=null==e[2]?null:this.size[1]*e[2],[e[0],t,n,e[3]]},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){var t=Qe(e),r=t.shape;if("channelsFirst"===n.dataFormat){t=Object(i.Ud)(t,[0,2,3,1]);var o=n.size[0]*r[2],a=n.size[1]*r[3],s=t.resizeNearestNeighbor([o,a]);return Object(i.Ud)(s,[0,3,1,2])}return o=n.size[0]*r[1],a=n.size[1]*r[2],t.resizeNearestNeighbor([o,a])})},t.prototype.getConfig=function(){var t={size:this.size,dataFormat:this.dataFormat},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="UpSampling2D",t}(ht);i.ed.registerClass(pr);var mr=function(e){function t(t){var n=e.call(this,2,t)||this;return n.depthwiseKernel=null,n.depthMultiplier=null==t.depthMultiplier?1:t.depthMultiplier,n.depthwiseInitializer=Ye(t.depthwiseInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.depthwiseConstraint=K(t.depthwiseConstraint),n.depthwiseRegularizer=nr(t.depthwiseRegularizer),n}return a(t,e),t.prototype.build=function(e){if((e=et(e)).length<4)throw new w("Inputs to DepthwiseConv2D should have rank 4. Received input shape: "+JSON.stringify(e)+".");var t="channelsFirst"===this.dataFormat?1:3;if(null==e[t]||e[t]<0)throw new w("The channel dimension of the inputs to DepthwiseConv2D should be defined, but is not ("+e[t]+").");var n=e[t],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},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){var t=function(e,t,n,r,o,a){return void 0===n&&(n=[1,1]),void 0===r&&(r="valid"),Object(i.Od)(function(){null==o&&(o="channelsLast"),J(o);var s=ar(e,o);if(4!==e.rank)throw new w("Input for depthwiseConv2d is required to be 4-D, but is instead "+e.rank+"-D");if(4!==t.rank)throw new w("depthwiseKernel is required to be 4-D, but is instead "+t.rank+"-D");return s=Object(i.eb)(s,t,n,"same"===r?"same":"valid","NHWC",a),"channelsFirst"===o&&(s=Object(i.Ud)(s,[0,3,1,2])),s})}(e=Qe(e),n.depthwiseKernel.read(),n.strides,n.padding,n.dataFormat,null);return n.useBias&&(t=Ae(t,n.bias.read(),n.dataFormat)),null!=n.activation&&(t=n.activation.apply(t)),t})},t.prototype.computeOutputShape=function(e){e=et(e);var t="channelsFirst"===this.dataFormat?e[2]:e[1],n="channelsFirst"===this.dataFormat?e[3]:e[2],r="channelsFirst"===this.dataFormat?e[1]*this.depthMultiplier:e[3]*this.depthMultiplier,i=ir(t,this.kernelSize[0],this.padding,this.strides[0]),o=ir(n,this.kernelSize[1],this.padding,this.strides[1]);return"channelsFirst"===this.dataFormat?[e[0],r,i,o]:[e[0],i,o,r]},t.prototype.getConfig=function(){var t=e.prototype.getConfig.call(this);return t.depthMultiplier=this.depthMultiplier,t.depthwiseInitializer=Ke(this.depthwiseInitializer),t.depthwiseRegularizer=er(this.depthwiseRegularizer),t.depthwiseConstraint=H(this.depthwiseRegularizer),t},t.className="DepthwiseConv2D",t}(sr);i.ed.registerClass(mr);var gr=function(e){function t(t){var n=e.call(this,t)||this;if(n.rate=Math.max(Math.min(t.rate,1),0),n.rateScalar=y(n.rate),n.noiseShape=t.noiseShape,n.seed=t.seed,null!=n.seed)throw new x("Non-default seed is not implemented in Dropout layer yet: "+n.seed);return n.supportsMasking=!0,n}return a(t,e),t.prototype.getNoiseShape=function(e){if(null==this.noiseShape)return this.noiseShape;for(var t=e.shape,n=[],r=0;r<this.noiseShape.length;++r)n.push(null==this.noiseShape[r]?t[r]:this.noiseShape[r]);return n},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){n.invokeCallHook(e,t);var r=Qe(e);if(null!=n.noiseShape&&!i.Yd.arraysEqual(r.shape,n.noiseShape))throw new x("Non-default noise shape is not implemented in Dropout layer yet: "+JSON.stringify(n.noiseShape));if(0<n.rate&&n.rate<1){var o=null!=t.training&&t.training,a=n.getNoiseShape(r);return Ne(function(){return Me(r,n.rateScalar,a,n.seed)},function(){return r},o)}return e})},t.prototype.getConfig=function(){var t={rate:this.rate,noiseShape:this.noiseShape,seed:this.seed},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="Dropout",t}(ht);i.ed.registerClass(gr);var br=function(e){function t(t){var n=e.call(this,t)||this;if(n.activation=null,n.useBias=!0,n.kernel=null,n.bias=null,n.DEFAULT_KERNEL_INITIALIZER="glorotNormal",n.DEFAULT_BIAS_INITIALIZER="zeros",null==t.batchInputShape&&null==t.inputShape&&null!=t.inputDim){var r=null;null!=t.batchSize&&(r=t.batchSize),n.batchInputShape=[r,t.inputDim]}return n.units=t.units,n.activation=qn(t.activation),null!=t.useBias&&(n.useBias=t.useBias),n.kernelInitializer=Ye(t.kernelInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.biasInitializer=Ye(t.biasInitializer||n.DEFAULT_BIAS_INITIALIZER),n.kernelConstraint=K(t.kernelConstraint),n.biasConstraint=K(t.biasConstraint),n.kernelRegularizer=nr(t.kernelRegularizer),n.biasRegularizer=nr(t.biasRegularizer),n.activityRegularizer=nr(t.activityRegularizer),n.inputSpec=[{minNDim:2}],n}return a(t,e),t.prototype.build=function(e){var t,n=(e=et(e))[e.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:(t={},t[-1]=n,t)}],this.built=!0},t.prototype.computeOutputShape=function(e){var t=(e=et(e)).slice();return t[t.length-1]=this.units,t},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){n.invokeCallHook(e,t);var r=Se(Qe(e),n.kernel.read());return null!=n.bias&&(r=Ae(r,n.bias.read())),null!=n.activation&&(r=n.activation.apply(r)),r})},t.prototype.getConfig=function(){var t={units:this.units,activation:Wn(this.activation),useBias:this.useBias,kernelInitializer:Ke(this.kernelInitializer),biasInitializer:Ke(this.biasInitializer),kernelRegularizer:er(this.kernelRegularizer),biasRegularizer:er(this.biasRegularizer),activityRegularizer:er(this.activityRegularizer),kernelConstraint:H(this.kernelConstraint),biasConstraint:H(this.biasConstraint)},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="Dense",t}(ht);i.ed.registerClass(br);var yr=function(e){function t(t){var n=e.call(this,t||{})||this;return n.inputSpec=[{minNDim:3}],n}return a(t,e),t.prototype.computeOutputShape=function(e){for(var t=0,n=(e=et(e)).slice(1);t<n.length;t++)if(null==n[t])throw new w('The shape of the input to "Flatten" is not fully defined (got '+e.slice(1)+'). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.');return[e[0],le(e,1)]},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){return n.invokeCallHook(e,t),function(e){if(e.rank<=1)throw new w("batchFlatten requires a minimum rank of 2. Got rank: "+e.rank+".");var t=[e.shape[0],le(e.shape,1)];return e.reshape(t)}(Qe(e))})},t.className="Flatten",t}(ht);i.ed.registerClass(yr);var vr=function(e){function t(t){var n=e.call(this,t)||this;return n.supportsMasking=!0,n.activation=qn(t.activation),n}return a(t,e),t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){n.invokeCallHook(e,t);var r=Qe(e);return n.activation.apply(r)})},t.prototype.getConfig=function(){var t={activation:Wn(this.activation)},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="Activation",t}(ht);i.ed.registerClass(vr);var _r=function(e){function t(t){var n=e.call(this,t)||this;return n.n=t.n,n.inputSpec=[{ndim:2}],n}return a(t,e),t.prototype.computeOutputShape=function(e){return[e[0],this.n,e[1]]},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){return function(e,t){return Object(i.Od)(function(){if(2!==e.shape.length)throw new w("repeat() expects a rank-2 tensor, but received a rank-"+e.shape.length+" tensor.");return xe(ge(e,1),[1,t,1])})}(e=Qe(e),n.n)})},t.prototype.getConfig=function(){var t={n:this.n},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="RepeatVector",t}(ht);i.ed.registerClass(_r);var wr=function(e){function t(t){var n=e.call(this,t)||this;n.targetShape=t.targetShape;for(var r=0;r<n.targetShape.length;++r)n.isUnknown(n.targetShape[r])&&(n.targetShape[r]=null);return n}return a(t,e),t.prototype.isUnknown=function(e){return e<0||null==e},t.prototype.fixUnknownDimension=function(e,t){for(var n="Total size of new array must be unchanged.",r=t.slice(),i=1,o=null,a=0;a<r.length;++a){var s=r[a];if(this.isUnknown(s)){if(null!==o)throw new w("Can only specifiy one unknown dimension.");o=a}else i*=s}var u=le(e);if(null!==o){if(0===i||u%i!=0)throw new w(n);r[o]=u/i}else if(u!==i)throw new w(n);return r},t.prototype.computeOutputShape=function(e){for(var t=!1,n=0;n<e.length;++n)if(this.isUnknown(e[n])){t=!0;break}return t?e.slice(0,1).concat(this.targetShape):e.slice(0,1).concat(this.fixUnknownDimension(e.slice(1),this.targetShape))},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){n.invokeCallHook(e,t);var r=Qe(e),i=r.shape,o=i.slice(0,1).concat(n.fixUnknownDimension(i.slice(1),n.targetShape));return r.reshape(o)})},t.prototype.getConfig=function(){var t={targetShape:this.targetShape},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="Reshape",t}(ht);i.ed.registerClass(wr);var xr=function(e){function t(t){var n=e.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 r=pe(1,t.dims.length+1);if(!i.Yd.arraysEqual(t.dims.slice().sort(),r))throw new Error("Invalid permutation `dims`: "+JSON.stringify(t.dims)+" `dims` must contain consecutive integers starting from 1.");return n.dims=t.dims,n.dimsIncludingBatch=[0].concat(n.dims),n.inputSpec=[new at({ndim:n.dims.length+1})],n}return a(t,e),t.prototype.computeOutputShape=function(e){var t=(e=et(e)).slice();return this.dims.forEach(function(n,r){t[r+1]=e[n]}),t},t.prototype.call=function(e,t){return Object(i.Ud)(Qe(e),this.dimsIncludingBatch)},t.prototype.getConfig=function(){var t={dims:this.dims},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="Permute",t}(ht);i.ed.registerClass(xr);var Er=function(e){function t(t){var n=e.call(this,t)||this;if(n.embeddings=null,n.DEFAULT_EMBEDDINGS_INITIALIZER="randomUniform",null==t.batchInputShape&&null==t.inputShape){var r=null;null!=t.batchSize&&(r=t.batchSize),null==t.inputLength?n.batchInputShape=[r,null]:n.batchInputShape=[r].concat(M(t.inputLength))}return n.inputDim=t.inputDim,n.outputDim=t.outputDim,n.embeddingsInitializer=Ye(t.embeddingsInitializer||n.DEFAULT_EMBEDDINGS_INITIALIZER),n.embeddingsRegularizer=nr(t.embeddingsRegularizer),n.activityRegularizer=nr(t.activityRegularizer),n.embeddingsConstraint=K(t.embeddingsConstraint),n.maskZero=t.maskZero,n.inputLength=t.inputLength,n}return a(t,e),t.prototype.build=function(e){this.embeddings=this.addWeight("embeddings",[this.inputDim,this.outputDim],this.dtype,this.embeddingsInitializer,this.embeddingsRegularizer,!0,this.embeddingsConstraint),this.built=!0},t.prototype.warnOnIncompatibleInputShape=function(e){},t.prototype.computeMask=function(e,t){throw new x("computeMask has not been implemented for Embedding yet")},t.prototype.computeOutputShape=function(e){if(e=et(e),null==this.inputLength)return e.concat([this.outputDim]);var t=M(this.inputLength);if(t.length!==e.length-1)throw new w('"inputLength" is '+this.inputLength+", but received input shape has shape "+e);for(var n=0,r=0;r<t.length;++r){var i=t[r],o=e[r+1];if(null!=i&&null!=o&&i!==o)throw new w('"inputLength" is '+this.inputLength+", but received input shape has shape "+e);null==i&&(t[n]=o),n++}return[e[0]].concat(t,[this.outputDim])},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){n.invokeCallHook(e,t);var r=Qe(e);return"int32"!==r.dtype&&(r=me(r,"int32")),Ce(n.embeddings.read(),r.as1D()).reshape(et(n.computeOutputShape(r.shape)))})},t.prototype.getConfig=function(){var t={inputDim:this.inputDim,outputDim:this.outputDim,embeddingsInitializer:Ke(this.embeddingsInitializer),embeddingsRegularizer:er(this.embeddingsRegularizer),activityRegularizer:er(this.activityRegularizer),embeddingsConstraint:H(this.embeddingsConstraint),maskZero:this.maskZero,inputLength:this.inputLength},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="Embedding",t}(ht);i.ed.registerClass(Er);var Sr=function(e){function t(t){var n=e.call(this,t||{})||this;return n.supportsMasking=!0,n}return a(t,e),t.prototype.mergeFunction=function(e){throw new x},t.prototype.computeElementwiseOpOutputShape=function(e,t){if(null==e||null==t)return null;if(e.length<t.length)return this.computeElementwiseOpOutputShape(t,e);if(0===t.length)return e;for(var n=e.slice(0,e.length-t.length),r=0;r<t.length;++r){var i=e[e.length-t.length+r],o=t[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 w("Operands could not be broadcast together with shapes "+JSON.stringify(e)+" "+JSON.stringify(t));n.push(i)}}return n},t.prototype.build=function(e){if(Array.isArray(e)&&!Array.isArray(e[0])&&(e=[et(e)]),(e=e).length<2)throw new w("A merge layer should be called on an Array of at least 2 inputs. Got "+e.length+" input(s).");for(var t=[],n=0,r=e;n<r.length;n++)null!=(a=r[n])&&null!==a[0]&&t.push(a[0]);if((t=D(t)).length>1)throw new w("Can not merge tensors with different batch sizes. Got tensors with shapes: "+JSON.stringify(e)+".");for(var i=null==e[0]?null:e[0].slice(1),o=1;o<e.length;++o){var a=null==e[o]?null:e[o].slice(1);i=this.computeElementwiseOpOutputShape(i,a)}var s=e.map(function(e){return e.length});-1===e.indexOf(null)&&1===D(s).length?this.reshapeRequired=!1:this.reshapeRequired=!0},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){if(e=e,n.reshapeRequired){var t=[],r=e.map(function(e){return e.rank});if(-1===r.indexOf(null)){for(var o=fe(r),a=0,s=e;a<s.length;a++){for(var u=(f=s[a]).rank,c=0;c<o-u;++c)f=ge(f,1);t.push(f)}return n.mergeFunction(t)}for(var l=!1,h=0,d=e;h<d.length;h++){var f;if(null==(u=(f=d[h]).rank)){var p=f.shape,m=p[0],g=p.slice(1).concat([m]),b=f.reshape([m].concat(le(p.slice(1))));b=(b=Object(i.Ud)(b,[1,0])).reshape(g),t.push(b),l=!0}else if(u>1){var y=pe(1,u).concat([0]);t.push(Object(i.Ud)(f,y)),l=!0}else t.push(f)}var v=n.mergeFunction(t),_=v.rank;if(l)if(null==_){var w=v.shape;g=[m=w[w.length-1]].concat(w.slice(0,w.length-1)),v=Object(i.Ud)(v.reshape([-1,m]),[1,0]).reshape(g)}else _>1&&(y=[_-1].concat(pe(0,_-1)),v=Object(i.Ud)(v,y));return v}return n.mergeFunction(e)})},t.prototype.computeOutputShape=function(e){var t;t=null==(e=e)[0]?null:e[0].slice(1);for(var n=1;n<e.length;++n){var r=null==e[n]?null:e[n].slice(1);t=this.computeElementwiseOpOutputShape(t,r)}for(var i=[],o=0,a=e;o<a.length;o++)null!=(r=a[o])&&null!==r[0]&&i.push(r[0]);return 1===(i=D(i)).length?i.concat(t):[null].concat(t)},t}(ht),Cr=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.mergeFunction=function(e){return Object(i.Od)(function(){for(var t=e[0].clone(),n=1;n<e.length;++n)t=Object(i.s)(t,e[n]);return t})},t.className="Add",t}(Sr);i.ed.registerClass(Cr);var Or=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.mergeFunction=function(e){return Object(i.Od)(function(){for(var t=e[0].clone(),n=1;n<e.length;++n)t=Object(i.oc)(t,e[n]);return t})},t.className="Multiply",t}(Sr);i.ed.registerClass(Or);var Ar=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.mergeFunction=function(e){return Object(i.Od)(function(){for(var t=e[0].clone(),n=1;n<e.length;++n)t=Object(i.s)(t,e[n]);return Object(i.oc)(y(1/e.length),t)})},t.className="Average",t}(Sr);i.ed.registerClass(Ar);var Mr=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.mergeFunction=function(e){return Object(i.Od)(function(){for(var t=e[0],n=1;n<e.length;++n)t=Object(i.dc)(t,e[n]);return t})},t.className="Maximum",t}(Sr);i.ed.registerClass(Mr);var Nr=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.mergeFunction=function(e){return Object(i.Od)(function(){for(var t=e[0],n=1;n<e.length;++n)t=Object(i.ic)(t,e[n]);return t})},t.className="Minimum",t}(Sr);i.ed.registerClass(Nr);var kr=function(e){function t(t){var n=e.call(this,t)||this;return n.DEFAULT_AXIS=-1,null==t&&(t={}),n.axis=null==t.axis?n.DEFAULT_AXIS:t.axis,n.supportsMasking=!0,n.reshapeRequired=!1,n}return a(t,e),t.prototype.build=function(e){if(!Array.isArray(e)||!Array.isArray(e[0])||1===e.length)throw new w("A `Concatenate` layer should be called on a list of at least 2 inputs");for(var t=!0,n=0,r=e=e;n<r.length;n++)if(null!=(h=r[n])){t=!1;break}if(!t){for(var o=[],a=0;a<e.length;++a){var s=e[a].slice();s.splice(this.axis,1);for(var u=!1,c=0,l=o;c<l.length;c++){var h=l[c];if(i.Yd.arraysEqual(h,s)){u=!0;break}}u||o.push(s)}if(o.length>1)throw new w("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(e))}},t.prototype.mergeFunction=function(e){var t=this;return Object(i.Od)(function(){return _e(e,t.axis)})},t.prototype.computeOutputShape=function(e){if(!Array.isArray(e)||!Array.isArray(e[0]))throw new w("A `Concatenate` layer should be called on a list of inputs.");for(var t=e,n=t[0].slice(),r=this.axis<0?n.length+this.axis:this.axis,i=0,o=t.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},t.prototype.getConfig=function(){var t={axis:this.axis},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="Concatenate",t}(Sr);function Ir(e,t,n,r,o,a){var s;if(void 0===a&&(a=.001),2===e.rank)s=Object(i.H)(e,t,n,a,o,r);else if(3===e.rank)s=Object(i.I)(e,t,n,a,o,r);else{if(4!==e.rank)throw new x("batchNormalization is not implememnted for array of rank "+e.rank+" yet");s=Object(i.J)(e,t,n,a,o,r)}return s}function Tr(e,t,n,r,o){return void 0===o&&(o=.001),i.Yd.arraysEqual(r.slice().sort(),pe(0,e.rank-1))?function(e,t,n,r,o){return void 0===o&&(o=.001),Object(i.Od)(function(){var a=Object(i.mc)(e,r),s=a.mean,u=a.variance;return[Ir(e,s,u,n,t,o),s,u]})}(e,t,n,r,o):function(e,t,n,r,o){return void 0===o&&(o=.001),Object(i.Od)(function(){for(var a=Object(i.mc)(e,r),s=a.mean,u=a.variance,c=[],l=0,h=pe(0,e.rank);l<h.length;l++){var d=h[l];-1!==r.indexOf(d)?c.push(1):c.push(e.shape[d])}var f=s.reshape(c),p=u.reshape(c),m=null==t?null:t.reshape(c),g=null==n?null:n.reshape(c);return[Ir(e,f,p,g,m,o),s,u]})}(e,t,n,r,o)}i.ed.registerClass(kr);var Pr=function(e){function t(t){var n=this;return null==t&&(t={}),(n=e.call(this,t)||this).supportsMasking=!0,n.axis=null==t.axis?-1:t.axis,n.momentum=null==t.momentum?.99:t.momentum,n.epsilon=null==t.epsilon?.001:t.epsilon,n.center=null==t.center||t.center,n.scale=null==t.scale||t.scale,n.betaInitializer=Ye(t.betaInitializer||"zeros"),n.gammaInitializer=Ye(t.gammaInitializer||"ones"),n.movingMeanInitializer=Ye(t.movingMeanInitializer||"zeros"),n.movingVarianceInitializer=Ye(t.movingVarianceInitializer||"ones"),n.betaConstraint=K(t.betaConstraint),n.gammaConstraint=K(t.gammaConstraint),n.betaRegularizer=nr(t.betaRegularizer),n.gammaRegularizer=nr(t.gammaRegularizer),n.stepCount=0,n}return a(t,e),t.prototype.build=function(e){e=et(e);var t=this.axis>=0?this.axis:this.axis+e.length,n=e[t];if(null==n)throw new w("Axis "+t+" of input tensor should have a defined dimension but the layer received an input with shape "+JSON.stringify(e)+".");this.inputSpec=[new at({ndim:e.length,axes:(r={},r[t]=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},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){var r=null!=t.training&&t.training,o=Qe(e),a=o.shape,s=a.length,u=pe(0,s),c=n.axis>=0?n.axis:n.axis+s;u.splice(c,1);var l=S(1,s);l[c]=a[c];var h=u.slice();h.sort();var d=!i.Yd.arraysEqual(h,pe(0,s).slice(0,s-1));if(!r)return function(){if(d){var e=n.movingMean.read().reshape(l),t=n.movingVariance.read().reshape(l),r=n.center?n.beta.read().reshape(l):null,i=n.scale?n.gamma.read().reshape(l):null;return Ir(o,e,t,r,i,n.epsilon)}return Ir(o,n.movingMean.read(),n.movingVariance.read(),null==n.beta?null:n.beta.read(),null==n.gamma?null:n.gamma.read(),n.epsilon)}();var f=Tr(o,n.gamma.read(),n.beta.read(),u,n.epsilon),p=f[0],m=f[1],g=f[2],b=le(u.map(function(e){return o.shape[e]})),v=g.mul(y(b/(b-(1+n.epsilon))));return function(){n.stepCount++;var e=Object(i.nc)(n.movingMean.read(),m,n.momentum,n.stepCount);n.movingMean.write(e);var t=Object(i.nc)(n.movingVariance.read(),v,n.momentum,n.stepCount);n.movingVariance.write(t)}(),p})},t.prototype.getConfig=function(){var t={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:Ke(this.betaInitializer),gammaInitializer:Ke(this.gammaInitializer),movingMeanInitializer:Ke(this.movingMeanInitializer),movingVarianceInitializer:Ke(this.movingVarianceInitializer),betaRegularizer:er(this.betaRegularizer),gammaRegularizer:er(this.gammaRegularizer),betaConstraint:H(this.betaConstraint),gammaConstraint:H(this.gammaConstraint)},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="BatchNormalization",t}(ht);i.ed.registerClass(Pr);var Rr=function(e){function t(t){var n=this;if(null==t&&(t={}),(n=e.call(this,t)||this).dataFormat=null==t.dataFormat?"channelsLast":t.dataFormat,null==t.padding)n.padding=[[1,1],[1,1]];else if("number"==typeof t.padding)n.padding=[[t.padding,t.padding],[t.padding,t.padding]];else{if(t.padding=t.padding,2!==t.padding.length)throw new w("ZeroPadding2D expects padding to be a length-2 array, but received a length-"+t.padding.length+" array.");var r=void 0,i=void 0;if("number"==typeof t.padding[0])r=[t.padding[0],t.padding[0]],i=[t.padding[1],t.padding[1]];else{if(t.padding=t.padding,2!==t.padding[0].length)throw new w("ZeroPadding2D expects height padding to be a length-2 array, but received a length-"+t.padding[0].length+" array.");if(r=t.padding[0],2!==t.padding[1].length)throw new w("ZeroPadding2D expects width padding to be a length-2 array, but received a length-"+t.padding[1].length+" array.");i=t.padding[1]}n.padding=[r,i]}return n.inputSpec=[new at({ndim:4})],n}return a(t,e),t.prototype.computeOutputShape=function(e){var t,n;return e=et(e),"channelsFirst"===this.dataFormat?(t=null!=e[2]&&e[2]>=0?e[2]+this.padding[0][0]+this.padding[0][1]:null,n=null!=e[3]&&e[3]>=0?e[3]+this.padding[1][0]+this.padding[1][1]:null,[e[0],e[1],t,n]):(t=null!=e[1]&&e[1]>=0?e[1]+this.padding[0][0]+this.padding[0][1]:null,n=null!=e[2]&&e[2]>=0?e[2]+this.padding[1][0]+this.padding[1][1]:null,[e[0],t,n,e[3]])},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){return function(e,t,n){return Object(i.Od)(function(){if(4!==e.rank)throw new w("temporalPadding expects input tensor to be 4-D, but received a "+e.rank+"-D tensor.");if(null==t&&(t=[[1,1],[1,1]]),2!==t.length||2!==t[0].length||2!==t[1].length)throw new w("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");if(null==n&&(n="channelsLast"),"channelsLast"!==n&&"channelsFirst"!==n)throw new w("Unknown data format: "+n+". Supported data formats are 'channelsLast' and 'channelsFirst.");var r;return r="channelsFirst"===n?[[0,0],[0,0],t[0],t[1]]:[[0,0],t[0],t[1],[0,0]],Object(i.Cc)(e,r)})}(Qe(e),n.padding,n.dataFormat)})},t.prototype.getConfig=function(){var t={padding:this.padding,dataFormat:this.dataFormat},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="ZeroPadding2D",t}(ht);function Dr(e,t,n,r,o,a){return Object(i.Od)(function(){var s;J(o),function(e){B(te,"PoolMode",e)}(a),ee(r),null==n&&(n=[1,1]),null==r&&(r="valid"),null==o&&(o="channelsLast"),null==a&&(a="max"),e=ar(e,o);var u="same"===r?"same":"valid";return s="max"===a?Object(i.cc)(e,t,n,u):Object(i.E)(e,t,n,u),"channelsFirst"===o&&(s=Object(i.Ud)(s,[0,3,1,2])),s})}i.ed.registerClass(Rr);var Lr=function(e){function t(t){var n=this;if(null==t.poolSize&&(t.poolSize=2),n=e.call(this,t)||this,"number"==typeof t.poolSize)n.poolSize=[t.poolSize];else{if(!Array.isArray(t.poolSize)||1!==t.poolSize.length||"number"!=typeof t.poolSize[0])throw new w("poolSize for 1D convolutional layer must be a number or an Array of a single number, but received "+JSON.stringify(t.poolSize));n.poolSize=t.poolSize}if(null==t.strides)n.strides=n.poolSize;else if("number"==typeof t.strides)n.strides=[t.strides];else{if(!Array.isArray(t.strides)||1!==t.strides.length||"number"!=typeof t.strides[0])throw new w("strides for 1D convolutional layer must be a number or an Array of a single number, but received "+JSON.stringify(t.strides));n.strides=t.strides}return n.padding=null==t.padding?"valid":t.padding,ee(n.padding),n.inputSpec=[new at({ndim:3})],n}return a(t,e),t.prototype.computeOutputShape=function(e){var t=ir((e=et(e))[1],this.poolSize[0],this.padding,this.strides[0]);return[e[0],t,e[2]]},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){n.invokeCallHook(e,t),e=ge(Qe(e),2);var r=n.poolingFunction(Qe(e),[n.poolSize[0],1],[n.strides[0],1],n.padding,"channelsLast");return Object(i.xd)(r,[2])})},t.prototype.getConfig=function(){var t={poolSize:this.poolSize,padding:this.padding,strides:this.strides},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t}(ht),Br=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.poolingFunction=function(e,t,n,r,i){return J(i),ee(r),Dr(e,t,n,r,i,"max")},t.className="MaxPooling1D",t}(Lr);i.ed.registerClass(Br);var jr=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.poolingFunction=function(e,t,n,r,i){return J(i),ee(r),Dr(e,t,n,r,i,"avg")},t.className="AveragePooling1D",t}(Lr);i.ed.registerClass(jr);var Fr=function(e){function t(t){var n=this;if(null==t.poolSize&&(t.poolSize=[2,2]),(n=e.call(this,t)||this).poolSize=Array.isArray(t.poolSize)?t.poolSize:[t.poolSize,t.poolSize],null==t.strides)n.strides=n.poolSize;else if(Array.isArray(t.strides)){if(2!==t.strides.length)throw new w("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+".");n.strides=t.strides}else n.strides=[t.strides,t.strides];return n.padding=null==t.padding?"valid":t.padding,n.dataFormat=null==t.dataFormat?"channelsLast":t.dataFormat,J(n.dataFormat),ee(n.padding),n.inputSpec=[new at({ndim:4})],n}return a(t,e),t.prototype.computeOutputShape=function(e){e=et(e);var t="channelsFirst"===this.dataFormat?e[2]:e[1],n="channelsFirst"===this.dataFormat?e[3]:e[2];return t=ir(t,this.poolSize[0],this.padding,this.strides[0]),n=ir(n,this.poolSize[1],this.padding,this.strides[1]),"channelsFirst"===this.dataFormat?[e[0],e[1],t,n]:[e[0],t,n,e[3]]},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){return n.invokeCallHook(e,t),n.poolingFunction(Qe(e),n.poolSize,n.strides,n.padding,n.dataFormat)})},t.prototype.getConfig=function(){var t={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t}(ht),zr=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.poolingFunction=function(e,t,n,r,i){return J(i),ee(r),Dr(e,t,n,r,i,"max")},t.className="MaxPooling2D",t}(Fr);i.ed.registerClass(zr);var Vr=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.poolingFunction=function(e,t,n,r,i){return J(i),ee(r),Dr(e,t,n,r,i,"avg")},t.className="AveragePooling2D",t}(Fr);i.ed.registerClass(Vr);var Ur=function(e){function t(t){var n=e.call(this,t)||this;return n.inputSpec=[new at({ndim:3})],n}return a(t,e),t.prototype.computeOutputShape=function(e){return[e[0],e[2]]},t.prototype.call=function(e,t){throw new x},t}(ht),Wr=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.call=function(e,t){return Object(i.Od)(function(){var t=Qe(e);return Object(i.fc)(t,1)})},t.className="GlobalAveragePooling1D",t}(Ur);i.ed.registerClass(Wr);var $r=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.call=function(e,t){return Object(i.Od)(function(){var t=Qe(e);return Object(i.bc)(t,1)})},t.className="GlobalMaxPooling1D",t}(Ur);i.ed.registerClass($r);var qr=function(e){function t(t){var n=e.call(this,t)||this;return n.dataFormat=null==t.dataFormat?"channelsLast":t.dataFormat,J(n.dataFormat),n.inputSpec=[new at({ndim:4})],n}return a(t,e),t.prototype.computeOutputShape=function(e){return e=e,"channelsLast"===this.dataFormat?[e[0],e[3]]:[e[0],e[1]]},t.prototype.call=function(e,t){throw new x},t.prototype.getConfig=function(){var t={dataFormat:this.dataFormat},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t}(ht),Hr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){var t=Qe(e);return"channelsLast"===n.dataFormat?Object(i.fc)(t,[1,2]):Object(i.fc)(t,[2,3])})},t.className="GlobalAveragePooling2D",t}(qr);i.ed.registerClass(Hr);var Gr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){var t=Qe(e);return"channelsLast"===n.dataFormat?Object(i.bc)(t,[1,2]):Object(i.bc)(t,[2,3])})},t.className="GlobalMaxPooling2D",t}(qr);function Kr(e,t,n,r){if(Array.isArray(e)){if(null!=t||null!=n)throw new w("When inputs is an array, neither initialState or constants should be provided");null!=r&&(n=e.slice(e.length-r,e.length),e=e.slice(0,e.length-r)),e.length>1&&(t=e.slice(1,e.length)),e=e[0]}function i(e){return null==e||Array.isArray(e)?e:[e]}return{inputs:e,initialState:t=i(t),constants:n=i(n)}}function Yr(e,t,n,r,o,a,s,u){void 0===r&&(r=!1),void 0===s&&(s=!1),void 0===u&&(u=!1);var c=t.shape.length;if(c<3)throw new w("Input should be at least 3D, but is "+c+"D.");var l,h,d=[1,0].concat(pe(2,c));if(t=Object(i.Ud)(t,d),null!=o)throw new x("The rnn() function of the deeplearn.js backend does not support masking yet.");if(null!=a)throw new x("The rnn() functoin of the deeplearn.js backend does not support constants yet.");s&&console.warn("Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend."),r&&(t=Object(i.Uc)(t,0));for(var f=n,p=t.shape[0],m=function(n){var r=be(t,n,1);r=r.reshape(r.shape.slice(1));var o=Object(i.Od)(function(){return e(r,f)});if(h=o[0],u)if(0===n)l=h.expandDims(1);else{var a=Object(i.R)([l,h.expandDims(1)],1);l.dispose(),l=a}f=o[1]},g=0;g<p;++g)m(g);return[h,l,f]}i.ed.registerClass(Gr);var Xr=function(e){function t(t){var n,r=e.call(this,t)||this;if(null==t.cell)throw new w("cell property is missing for the constructor of RNN.");if(null==(n=Array.isArray(t.cell)?new ii({cells:t.cell}):t.cell).stateSize)throw new w("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");return r.cell=n,r.returnSequences=null!=t.returnSequences&&t.returnSequences,r.returnState=null!=t.returnState&&t.returnState,r.goBackwards=null!=t.goBackwards&&t.goBackwards,r._stateful=null!=t.stateful&&t.stateful,r.unroll=null!=t.unroll&&t.unroll,r.supportsMasking=!0,r.inputSpec=[new at({ndim:3})],r.stateSpec=null,r.states=null,r.numConstants=null,r.keptStates=[],r}return a(t,e),t.prototype.getStates=function(){return null==this.states?pe(0,Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1).map(function(e){return null}):this.states},t.prototype.setStates=function(e){this.states=e},t.prototype.computeOutputShape=function(e){Ze(e)&&(e=e[0]),e=e;var t=this.cell.stateSize;Array.isArray(t)||(t=[t]);var n,r=t[0];if(n=this.returnSequences?[e[0],e[1],r]:[e[0],r],this.returnState){for(var i=[],o=0,a=t;o<a.length;o++){var s=a[o];i.push([e[0],s])}return[n].concat(i)}return n},t.prototype.computeMask=function(e,t){throw new x("computeMask has not been implemented for RNN yet")},t.prototype.build=function(e){if(null!=this.numConstants)throw new x("Constants support is not implemented in RNN yet.");Ze(e)&&(e=e[0]),e=e;var t=this.stateful?e[0]:null,n=e[e.length-1];this.inputSpec[0]=new at({shape:[t,null,n]});var r,o=[e[0]].concat(e.slice(2));if(this.cell.build(o),r=Array.isArray(this.cell.stateSize)?this.cell.stateSize:[this.cell.stateSize],null!=this.stateSpec){if(!i.Yd.arraysEqual(this.stateSpec.map(function(e){return e.shape[e.shape.length-1]}),r))throw new w("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(e){return new at({shape:[null,e]})});this.stateful&&this.resetStates()},t.prototype.resetStates=function(e){var t=this;Object(i.Od)(function(){if(!t.stateful)throw new v("Cannot call resetStates() on an RNN Layer that is not stateful.");var n=t.inputSpec[0].shape[0];if(null==n)throw new w("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==t.states)Array.isArray(t.cell.stateSize)?t.states=t.cell.stateSize.map(function(e){return Object(i.he)([n,e])}):t.states=[Object(i.he)([n,t.cell.stateSize])];else if(null==e)Object(i.fb)(t.states),null!=t.keptStates&&(Object(i.fb)(t.keptStates),t.keptStates=[]),Array.isArray(t.cell.stateSize)?t.states=t.cell.stateSize.map(function(e){return Object(i.he)([n,e])}):t.states[0]=Object(i.he)([n,t.cell.stateSize]);else{if(t.keptStates.push(t.states.slice()),Array.isArray(e)||(e=[e]),e.length!==t.states.length)throw new w("Layer "+t.name+" expects "+t.states.length+" state(s), but it received "+e.length+" state value(s). Input received: "+e);for(var r=0;r<t.states.length;++r){var o=e[r],a=Array.isArray(t.cell.stateSize)?t.cell.stateSize[r]:t.cell.stateSize,s=[n,a];if(!i.Yd.arraysEqual(o.shape,s))throw new w("State "+r+" is incompatible with layer "+t.name+": expected shape="+s+", received shape="+o.shape);t.states[r]=o}}t.states.forEach(function(e){return Object(i.Ib)(e)})})},t.prototype.apply=function(t,n){var r=null==n?null:n.initialState,i=null==n?null:n.constants;null==n&&(n={});var o=Kr(t,r,i,this.numConstants);t=o.inputs,r=o.initialState,i=o.constants;var a=[],s=[];if(null!=r){n.initialState=r,a=a.concat(r),this.stateSpec=[];for(var u=0,c=r;u<c.length;u++){var l=c[u];this.stateSpec.push(new at({shape:l.shape}))}s=s.concat(this.stateSpec)}if(null!=i&&(n.constants=i,a=a.concat(i),this.numConstants=i.length),a[0]instanceof st){var h=[t].concat(a),d=this.inputSpec.concat(s),f=this.inputSpec;this.inputSpec=d;var p=e.prototype.apply.call(this,h,n);return this.inputSpec=f,p}return e.prototype.apply.call(this,t,n)},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){var r=null==t?null:t.mask,i=null==t?null:t.training,o=null==t?null:t.initialState;if(e=Qe(e),null==o&&(o=n.stateful?n.states:n.getInitialState(e)),null!=r)throw new x("Masking is not implemented for RNN yet");var a=Array.isArray(n.cell.stateSize)?n.cell.stateSize.length:1;if(o.length!==a)throw new w("RNN Layer has "+a+" state(s) but was passed "+o.length+" initial state(s).");n.unroll&&console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");var s={training:i},u=Yr(function(e,t){var r=n.cell.call([e].concat(t),s);return[r[0],r.slice(1)]},e,o,n.goBackwards,null,null,n.unroll,n.returnSequences),c=u[0],l=u[1],h=u[2];n.stateful&&n.resetStates(h);var d=n.returnSequences?l:c;return n.returnState?[d].concat(h):d})},t.prototype.getInitialState=function(e){var t=this;return Object(i.Od)(function(){var n=Object(i.he)(e.shape);return n=ge(n=Object(i.Dd)(n,[1,2])),Array.isArray(t.cell.stateSize)?t.cell.stateSize.map(function(e){return e>1?xe(n,[1,e]):n}):t.cell.stateSize>1?[xe(n,[1,t.cell.stateSize])]:[n]})},Object.defineProperty(t.prototype,"trainableWeights",{get:function(){return this.trainable?this.cell.trainableWeights:[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nonTrainableWeights",{get:function(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights},enumerable:!0,configurable:!0}),t.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 n=this.cell.getConfig();t.cell={className:this.cell.getClassName(),config:n};var r=e.prototype.getConfig.call(this);return Object.assign(t,r),t},t.className="RNN",t}(ht);i.ed.registerClass(Xr);var Zr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t}(ht),Jr=function(e){function t(t){var n=e.call(this,t)||this;return n.DEFAULT_ACTIVATION="tanh",n.DEFAULT_KERNEL_INITIALIZER="glorotNormal",n.DEFAULT_RECURRENT_INITIALIZER="orthogonal",n.DEFAULT_BIAS_INITIALIZER="zeros",n.units=t.units,n.activation=qn(null==t.activation?n.DEFAULT_ACTIVATION:t.activation),n.useBias=null==t.useBias||t.useBias,n.kernelInitializer=Ye(t.kernelInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.recurrentInitializer=Ye(t.recurrentInitializer||n.DEFAULT_RECURRENT_INITIALIZER),n.biasInitializer=Ye(t.biasInitializer||n.DEFAULT_BIAS_INITIALIZER),n.kernelRegularizer=nr(t.kernelRegularizer),n.recurrentRegularizer=nr(t.recurrentRegularizer),n.biasRegularizer=nr(t.biasRegularizer),n.kernelConstraint=K(t.kernelConstraint),n.recurrentConstraint=K(t.recurrentConstraint),n.biasConstraint=K(t.biasConstraint),n.dropout=de([1,fe([0,null==t.dropout?0:t.dropout])]),n.recurrentDropout=de([1,fe([0,null==t.recurrentDropout?0:t.recurrentDropout])]),n.stateSize=n.units,n.dropoutMask=null,n.recurrentDropoutMask=null,n}return a(t,e),t.prototype.build=function(e){e=et(e),this.kernel=this.addWeight("kernel",[e[e.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},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){if(2!==(e=e).length)throw new w("SimpleRNNCell expects 2 input Tensors, got "+e.length+".");var r=e[1];e=e[0];var o,a=null!=t.training&&t.training;0<n.dropout&&n.dropout<1&&null==n.dropoutMask&&(n.dropoutMask=oi(function(){return Object(i.zc)(e)},n.dropout,a)),0<n.recurrentDropout&&n.recurrentDropout<1&&null==n.recurrentDropoutMask&&(n.recurrentDropoutMask=oi(function(){return Object(i.zc)(r)},n.recurrentDropout,a));var s=n.dropoutMask,u=n.recurrentDropoutMask;o=Se(null!=s?Object(i.oc)(e,s):e,n.kernel.read()),null!=n.bias&&(o=Ae(o,n.bias.read())),null!=u&&(r=Object(i.oc)(r,u));var c=Object(i.s)(o,Se(r,n.recurrentKernel.read()));return null!=n.activation&&(c=n.activation.apply(c)),[c,c]})},t.prototype.getConfig=function(){var t={units:this.units,activation:Wn(this.activation),useBias:this.useBias,kernelInitializer:Ke(this.kernelInitializer),recurrentInitializer:Ke(this.recurrentInitializer),biasInitializer:Ke(this.biasInitializer),kernelRegularizer:er(this.kernelRegularizer),recurrentRegularizer:er(this.recurrentRegularizer),biasRegularizer:er(this.biasRegularizer),activityRegularizer:er(this.activityRegularizer),kernelConstraint:H(this.kernelConstraint),recurrentConstraint:H(this.recurrentConstraint),biasConstraint:H(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="SimpleRNNCell",t}(Zr);i.ed.registerClass(Jr);var Qr=function(e){function t(t){return t.cell=new Jr(t),e.call(this,t)||this}return a(t,e),t.prototype.call=function(t,n){var r=this;return Object(i.Od)(function(){null!=r.cell.dropoutMask&&(Object(i.fb)(r.cell.dropoutMask),r.cell.dropoutMask=null),null!=r.cell.recurrentDropoutMask&&(Object(i.fb)(r.cell.recurrentDropoutMask),r.cell.recurrentDropoutMask=null);var o=null==n?null:n.mask,a=null==n?null:n.training,s=null==n?null:n.initialState;return e.prototype.call.call(r,t,{mask:o,training:a,initialState:s})})},Object.defineProperty(t.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),t.prototype.getConfig=function(){var t={units:this.units,activation:Wn(this.activation),useBias:this.useBias,kernelInitializer:Ke(this.kernelInitializer),recurrentInitializer:Ke(this.recurrentInitializer),biasInitializer:Ke(this.biasInitializer),kernelRegularizer:er(this.kernelRegularizer),recurrentRegularizer:er(this.recurrentRegularizer),biasRegularizer:er(this.biasRegularizer),activityRegularizer:er(this.activityRegularizer),kernelConstraint:H(this.kernelConstraint),recurrentConstraint:H(this.recurrentConstraint),biasConstraint:H(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout},n=e.prototype.getConfig.call(this);return delete n.cell,Object.assign(t,n),t},t.className="SimpleRNN",t}(Xr);i.ed.registerClass(Qr);var ei=function(e){function t(t){var n=e.call(this,t)||this;return n.DEFAULT_ACTIVATION="tanh",n.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",n.DEFAULT_KERNEL_INITIALIZER="glorotNormal",n.DEFAULT_RECURRENT_INITIALIZER="orthogonal",n.DEFAULT_BIAS_INITIALIZER="zeros",n.units=t.units,n.activation=qn(void 0===t.activation?n.DEFAULT_ACTIVATION:t.activation),n.recurrentActivation=qn(void 0===t.recurrentActivation?n.DEFAULT_RECURRENT_ACTIVATION:t.recurrentActivation),n.useBias=null==t.useBias||t.useBias,n.kernelInitializer=Ye(t.kernelInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.recurrentInitializer=Ye(t.recurrentInitializer||n.DEFAULT_RECURRENT_INITIALIZER),n.biasInitializer=Ye(t.biasInitializer||n.DEFAULT_BIAS_INITIALIZER),n.kernelRegularizer=nr(t.kernelRegularizer),n.recurrentRegularizer=nr(t.recurrentRegularizer),n.biasRegularizer=nr(t.biasRegularizer),n.kernelConstraint=K(t.kernelConstraint),n.recurrentConstraint=K(t.recurrentConstraint),n.biasConstraint=K(t.biasConstraint),n.dropout=de([1,fe([0,null==t.dropout?0:t.dropout])]),n.recurrentDropout=de([1,fe([0,null==t.recurrentDropout?0:t.recurrentDropout])]),n.implementation=t.implementation,n.stateSize=n.units,n.dropoutMask=null,n.recurrentDropoutMask=null,n}return a(t,e),t.prototype.build=function(e){var t=(e=et(e))[e.length-1];this.kernel=this.addWeight("kernel",[t,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},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){if(2!==(e=e).length)throw new w("GRUCell expects 2 input Tensors (inputs, h, c), got "+e.length+".");var r=null!=t.training&&t.training,o=e[1];e=e[0],0<n.dropout&&n.dropout<1&&null==n.dropoutMask&&(n.dropoutMask=oi(function(){return Object(i.zc)(e)},n.dropout,r,3)),0<n.recurrentDropout&&n.recurrentDropout<1&&null==n.recurrentDropoutMask&&(n.recurrentDropoutMask=oi(function(){return Object(i.zc)(o)},n.recurrentDropout,r,3));var a,s,u,c=n.dropoutMask,l=n.recurrentDropoutMask;if(1===n.implementation){var h=ye(n.kernel.read(),0,n.units),d=ye(n.kernel.read(),n.units,n.units),f=ye(n.kernel.read(),2*n.units,n.units),p=ye(n.recurrentKernel.read(),0,n.units),m=ye(n.recurrentKernel.read(),n.units,n.units),g=ye(n.recurrentKernel.read(),2*n.units,n.units),b=void 0,v=void 0,_=void 0;0<n.dropout&&n.dropout<1?(b=Object(i.oc)(e,c[0]),v=Object(i.oc)(e,c[1]),_=Object(i.oc)(e,c[2])):(b=e,v=e,_=e);var x=Se(b,h),E=Se(v,d),S=Se(_,f);if(n.useBias){var C=be(n.bias.read(),0,n.units),O=be(n.bias.read(),n.units,n.units),A=be(n.bias.read(),2*n.units,n.units);x=Ae(x,C),E=Ae(E,O),S=Ae(S,A)}var M=void 0,N=void 0,k=void 0;0<n.recurrentDropout&&n.recurrentDropout<1?(M=Object(i.oc)(o,l[0]),N=Object(i.oc)(o,l[1]),k=Object(i.oc)(o,l[2])):(M=o,N=o,k=o),a=n.recurrentActivation.apply(Object(i.s)(x,Se(M,p))),s=n.recurrentActivation.apply(Object(i.s)(E,Se(N,m))),u=n.activation.apply(Object(i.s)(S,Se(Object(i.oc)(s,k),g)))}else{0<n.dropout&&n.dropout<1&&(e=Object(i.oc)(e,c[0]));var I=Se(e,n.kernel.read());n.useBias&&(I=Ae(I,n.bias.read())),0<n.dropout&&n.dropout<1&&(o=Object(i.oc)(o,l[0]));var T=Se(o,ye(n.recurrentKernel.read(),0,2*n.units)),P=(x=ye(I,0,n.units),E=ye(I,n.units,n.units),ye(T,0,n.units)),R=ye(T,n.units,n.units);a=n.recurrentActivation.apply(Object(i.s)(x,P)),s=n.recurrentActivation.apply(Object(i.s)(E,R)),S=ye(I,2*n.units,n.units);var D=Se(Object(i.oc)(s,o),ye(n.recurrentKernel.read(),2*n.units,n.units));u=n.activation.apply(Object(i.s)(S,D))}var L=Object(i.s)(Object(i.oc)(a,o),Object(i.oc)(Object(i.s)(y(1),Object(i.sc)(a)),u));return[L,L]})},t.prototype.getConfig=function(){var t={units:this.units,activation:Wn(this.activation),recurrentActivation:Wn(this.recurrentActivation),useBias:this.useBias,kernelInitializer:Ke(this.kernelInitializer),recurrentInitializer:Ke(this.recurrentInitializer),biasInitializer:Ke(this.biasInitializer),kernelRegularizer:er(this.kernelRegularizer),recurrentRegularizer:er(this.recurrentRegularizer),biasRegularizer:er(this.biasRegularizer),activityRegularizer:er(this.activityRegularizer),kernelConstraint:H(this.kernelConstraint),recurrentConstraint:H(this.recurrentConstraint),biasConstraint:H(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="GRUCell",t}(Zr);i.ed.registerClass(ei);var ti=function(e){function t(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 ei(t),e.call(this,t)||this}return a(t,e),t.prototype.call=function(t,n){var r=this;return Object(i.Od)(function(){null!=r.cell.dropoutMask&&(Object(i.fb)(r.cell.dropoutMask),r.cell.dropoutMask=null),null!=r.cell.recurrentDropoutMask&&(Object(i.fb)(r.cell.recurrentDropoutMask),r.cell.recurrentDropoutMask=null);var o=null==n?null:n.mask,a=null==n?null:n.training,s=null==n?null:n.initialState;return e.prototype.call.call(r,t,{mask:o,training:a,initialState:s})})},Object.defineProperty(t.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentActivation",{get:function(){return this.cell.recurrentActivation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"implementation",{get:function(){return this.cell.implementation},enumerable:!0,configurable:!0}),t.prototype.getConfig=function(){var t={units:this.units,activation:Wn(this.activation),recurrentActivation:Wn(this.recurrentActivation),useBias:this.useBias,kernelInitializer:Ke(this.kernelInitializer),recurrentInitializer:Ke(this.recurrentInitializer),biasInitializer:Ke(this.biasInitializer),kernelRegularizer:er(this.kernelRegularizer),recurrentRegularizer:er(this.recurrentRegularizer),biasRegularizer:er(this.biasRegularizer),activityRegularizer:er(this.activityRegularizer),kernelConstraint:H(this.kernelConstraint),recurrentConstraint:H(this.recurrentConstraint),biasConstraint:H(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},n=e.prototype.getConfig.call(this);return delete n.cell,Object.assign(t,n),t},t.fromConfig=function(e,t){return 0===t.implmentation&&(t.implementation=1),new e(t)},t.className="GRU",t}(Xr);i.ed.registerClass(ti);var ni=function(e){function t(t){var n=e.call(this,t)||this;return n.DEFAULT_ACTIVATION="tanh",n.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",n.DEFAULT_KERNEL_INITIALIZER="glorotNormal",n.DEFAULT_RECURRENT_INITIALIZER="orthogonal",n.DEFAULT_BIAS_INITIALIZER="zeros",n.units=t.units,n.activation=qn(void 0===t.activation?n.DEFAULT_ACTIVATION:t.activation),n.recurrentActivation=qn(void 0===t.recurrentActivation?n.DEFAULT_RECURRENT_ACTIVATION:t.recurrentActivation),n.useBias=null==t.useBias||t.useBias,n.kernelInitializer=Ye(t.kernelInitializer||n.DEFAULT_KERNEL_INITIALIZER),n.recurrentInitializer=Ye(t.recurrentInitializer||n.DEFAULT_RECURRENT_INITIALIZER),n.biasInitializer=Ye(t.biasInitializer||n.DEFAULT_BIAS_INITIALIZER),n.unitForgetBias=t.unitForgetBias,n.kernelRegularizer=nr(t.kernelRegularizer),n.recurrentRegularizer=nr(t.recurrentRegularizer),n.biasRegularizer=nr(t.biasRegularizer),n.kernelConstraint=K(t.kernelConstraint),n.recurrentConstraint=K(t.recurrentConstraint),n.biasConstraint=K(t.biasConstraint),n.dropout=de([1,fe([0,null==t.dropout?0:t.dropout])]),n.recurrentDropout=de([1,fe([0,null==t.recurrentDropout?0:t.recurrentDropout])]),n.implementation=t.implementation,n.stateSize=[n.units,n.units],n.dropoutMask=null,n.recurrentDropoutMask=null,n}return a(t,e),t.prototype.build=function(e){var t,n,r=(e=et(e))[e.length-1];if(this.kernel=this.addWeight("kernel",[r,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 i=this.biasInitializer,o=this.units;t=new((n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.apply=function(e,t){var n=i.apply([o]),r=(new Re).apply([o]),a=i.apply([2*o]);return we(we(n,r),a)},t}(Te)).className="CustomInit",n)}else t=this.biasInitializer;this.bias=this.addWeight("bias",[4*this.units],null,t,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){var r=null!=t.training&&t.training;if(3!==(e=e).length)throw new w("LSTMCell expects 3 input Tensors (inputs, h, c), got "+e.length+".");var o=e[1],a=e[2];e=e[0],0<n.dropout&&n.dropout<1&&null==n.dropoutMask&&(n.dropoutMask=oi(function(){return Object(i.zc)(e)},n.dropout,r,4)),0<n.recurrentDropout&&n.recurrentDropout<1&&null==n.recurrentDropoutMask&&(n.recurrentDropoutMask=oi(function(){return Object(i.zc)(o)},n.recurrentDropout,r,4));var s,u,c,l,h=n.dropoutMask,d=n.recurrentDropoutMask;if(1===n.implementation){var f=ye(n.kernel.read(),0,n.units),p=ye(n.kernel.read(),n.units,n.units),m=ye(n.kernel.read(),2*n.units,n.units),g=ye(n.kernel.read(),3*n.units,n.units),b=ye(n.recurrentKernel.read(),0,n.units),y=ye(n.recurrentKernel.read(),n.units,n.units),v=ye(n.recurrentKernel.read(),2*n.units,n.units),_=ye(n.recurrentKernel.read(),3*n.units,n.units),x=void 0,E=void 0,S=void 0,C=void 0;0<n.dropout&&n.dropout<1?(x=Object(i.oc)(e,h[0]),E=Object(i.oc)(e,h[1]),S=Object(i.oc)(e,h[2]),C=Object(i.oc)(e,h[3])):(x=e,E=e,S=e,C=e);var O=Se(x,f),A=Se(E,p),M=Se(S,m),N=Se(C,g);if(n.useBias){var k=be(n.bias.read(),0,n.units),I=be(n.bias.read(),n.units,n.units),T=be(n.bias.read(),2*n.units,n.units),P=be(n.bias.read(),3*n.units,n.units);O=Ae(O,k),A=Ae(A,I),M=Ae(M,T),N=Ae(N,P)}var R=void 0,D=void 0,L=void 0,B=void 0;0<n.recurrentDropout&&n.recurrentDropout<1?(R=Object(i.oc)(o,d[0]),D=Object(i.oc)(o,d[1]),L=Object(i.oc)(o,d[2]),B=Object(i.oc)(o,d[3])):(R=o,D=o,L=o,B=o),s=n.recurrentActivation.apply(Object(i.s)(O,Se(R,b))),u=n.recurrentActivation.apply(Object(i.s)(A,Se(D,y))),c=Object(i.s)(Object(i.oc)(u,a),Object(i.oc)(s,n.activation.apply(Object(i.s)(M,Se(L,v))))),l=n.recurrentActivation.apply(Object(i.s)(N,Se(B,_)))}else{0<n.dropout&&n.dropout<1&&(e=Object(i.oc)(e,h[0]));var j=Se(e,n.kernel.read());0<n.recurrentDropout&&n.recurrentDropout<1&&(o=Object(i.oc)(o,d[0])),j=Object(i.s)(j,Se(o,n.recurrentKernel.read())),n.useBias&&(j=Ae(j,n.bias.read()));var F=ye(j,0,n.units),z=ye(j,n.units,n.units),V=ye(j,2*n.units,n.units),U=ye(j,3*n.units,n.units);s=n.recurrentActivation.apply(F),u=n.recurrentActivation.apply(z),c=Object(i.s)(Object(i.oc)(u,a),Object(i.oc)(s,n.activation.apply(V))),l=n.recurrentActivation.apply(U)}var W=Object(i.oc)(l,n.activation.apply(c));return[W,W,c]})},t.prototype.getConfig=function(){var t={units:this.units,activation:Wn(this.activation),recurrentActivation:Wn(this.recurrentActivation),useBias:this.useBias,kernelInitializer:Ke(this.kernelInitializer),recurrentInitializer:Ke(this.recurrentInitializer),biasInitializer:Ke(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:er(this.kernelRegularizer),recurrentRegularizer:er(this.recurrentRegularizer),biasRegularizer:er(this.biasRegularizer),activityRegularizer:er(this.activityRegularizer),kernelConstraint:H(this.kernelConstraint),recurrentConstraint:H(this.recurrentConstraint),biasConstraint:H(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.className="LSTMCell",t}(Zr);i.ed.registerClass(ni);var ri=function(e){function t(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 ni(t),e.call(this,t)||this}return a(t,e),t.prototype.call=function(t,n){var r=this;return Object(i.Od)(function(){null!=r.cell.dropoutMask&&(Object(i.fb)(r.cell.dropoutMask),r.cell.dropoutMask=null),null!=r.cell.recurrentDropoutMask&&(Object(i.fb)(r.cell.recurrentDropoutMask),r.cell.recurrentDropoutMask=null);var o=null==n?null:n.mask,a=null==n?null:n.training,s=null==n?null:n.initialState;return e.prototype.call.call(r,t,{mask:o,training:a,initialState:s})})},Object.defineProperty(t.prototype,"units",{get:function(){return this.cell.units},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activation",{get:function(){return this.cell.activation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentActivation",{get:function(){return this.cell.recurrentActivation},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useBias",{get:function(){return this.cell.useBias},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelInitializer",{get:function(){return this.cell.kernelInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentInitializer",{get:function(){return this.cell.recurrentInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasInitializer",{get:function(){return this.cell.biasInitializer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"unitForgetBias",{get:function(){return this.cell.unitForgetBias},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelRegularizer",{get:function(){return this.cell.kernelRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentRegularizer",{get:function(){return this.cell.recurrentRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasRegularizer",{get:function(){return this.cell.biasRegularizer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"kernelConstraint",{get:function(){return this.cell.kernelConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentConstraint",{get:function(){return this.cell.recurrentConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"biasConstraint",{get:function(){return this.cell.biasConstraint},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dropout",{get:function(){return this.cell.dropout},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"recurrentDropout",{get:function(){return this.cell.recurrentDropout},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"implementation",{get:function(){return this.cell.implementation},enumerable:!0,configurable:!0}),t.prototype.getConfig=function(){var t={units:this.units,activation:Wn(this.activation),recurrentActivation:Wn(this.recurrentActivation),useBias:this.useBias,kernelInitializer:Ke(this.kernelInitializer),recurrentInitializer:Ke(this.recurrentInitializer),biasInitializer:Ke(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:er(this.kernelRegularizer),recurrentRegularizer:er(this.recurrentRegularizer),biasRegularizer:er(this.biasRegularizer),activityRegularizer:er(this.activityRegularizer),kernelConstraint:H(this.kernelConstraint),recurrentConstraint:H(this.recurrentConstraint),biasConstraint:H(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation},n=e.prototype.getConfig.call(this);return delete n.cell,Object.assign(t,n),t},t.fromConfig=function(e,t){return 0===t.implmentation&&(t.implementation=1),new e(t)},t.className="LSTM",t}(Xr);i.ed.registerClass(ri);var ii=function(e){function t(t){var n=e.call(this,t)||this;return n.cells=t.cells,n}return a(t,e),Object.defineProperty(t.prototype,"stateSize",{get:function(){for(var e=[],t=0,n=this.cells.slice().reverse();t<n.length;t++){var r=n[t];Array.isArray(r.stateSize)?e.push.apply(e,r.stateSize):e.push(r.stateSize)}return e},enumerable:!0,configurable:!0}),t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){for(var r=(e=e).slice(1),i=[],o=0,a=n.cells.slice().reverse();o<a.length;o++){var s=a[o];Array.isArray(s.stateSize)?i.push(r.splice(0,s.stateSize.length)):i.push(r.splice(0,1))}i.reverse();for(var u,c=[],l=0;l<n.cells.length;++l)s=n.cells[l],r=i[l],u=0===l?[e[0]].concat(r):[u[0]].concat(r),u=s.call(u,t),c.push(u.slice(1));r=[];for(var h=0,d=c.slice().reverse();h<d.length;h++){var f=d[h];r.push.apply(r,f)}return[u[0]].concat(r)})},t.prototype.build=function(e){var t;Ze(e)&&(e=e[0]),e=e;for(var n=0,r=this.cells;n<r.length;n++){var i=r[n];i.build(e),t=Array.isArray(i.stateSize)?i.stateSize[0]:i.stateSize,e=[e[0],t]}this.built=!0},t.prototype.getConfig=function(){for(var t=[],n=0,r=this.cells;n<r.length;n++){var i=r[n];t.push({className:this.getClassName(),config:i.getConfig()})}var o={cells:t},a=e.prototype.getConfig.call(this);return Object.assign(o,a),o},t.fromConfig=function(e,t,n){void 0===n&&(n={});for(var r=[],i=0,o=t.cells;i<o.length;i++){var a=o[i];r.push(on(a,n))}return new e({cells:r})},Object.defineProperty(t.prototype,"trainableWeights",{get:function(){if(!this.trainable)return[];for(var e=[],t=0,n=this.cells;t<n.length;t++){var r=n[t];e.push.apply(e,r.trainableWeights)}return e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nonTrainableWeights",{get:function(){for(var e=[],t=0,n=this.cells;t<n.length;t++){var r=n[t];e.push.apply(e,r.nonTrainableWeights)}if(!this.trainable){for(var i=[],o=0,a=this.cells;o<a.length;o++)r=a[o],i.push.apply(i,r.trainableWeights);return i.concat(e)}return e},enumerable:!0,configurable:!0}),t.prototype.getWeights=function(){for(var e=[],t=0,n=this.cells;t<n.length;t++){var r=n[t];e.push.apply(e,r.weights)}return it(e)},t.prototype.setWeights=function(e){for(var t=[],n=0,r=this.cells;n<r.length;n++)for(var i=r[n],o=i.weights.length,a=e.splice(o),s=0;s<i.weights.length;++s)t.push([i.weights[s],a[s]]);ot(t)},t.className="StackedRNNCells",t}(Zr);function oi(e,t,n,r){function o(){return Me(e(),y(t))}if(void 0===n&&(n=null),void 0===r&&(r=1),r>1){for(var a=[],s=0;s<r;s++)a.push(Ne(o,e,n));return a.forEach(function(e){return Object(i.Ib)(e)}),a}return Object(i.Ib)(Ne(o,e,n))}i.ed.registerClass(ii);var ai=function(e){function t(t){var n=e.call(this,t)||this;return n.layer=t.layer,n}return a(t,e),t.prototype.build=function(e){this.built=!0},Object.defineProperty(t.prototype,"trainable",{get:function(){return null!=this.layer&&this.layer.trainable},set:function(e){null!=this.layer&&(this.layer.trainable=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"trainableWeights",{get:function(){return this.layer.trainableWeights},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nonTrainableWeights",{get:function(){return this.layer.nonTrainableWeights},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"updates",{get:function(){return this.layer._updates},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"losses",{get:function(){return this.layer.losses},enumerable:!0,configurable:!0}),t.prototype.getWeights=function(){return this.layer.getWeights()},t.prototype.setWeights=function(e){this.layer.setWeights(e)},t.prototype.getConfig=function(){var t={layer:{className:this.layer.getClassName(),config:this.layer.getConfig()}},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.fromConfig=function(e,t,n){void 0===n&&(n={});var r=on(t.layer,n);delete t.layer;var i={layer:r};return Object.assign(i,t),new e(i)},t}(ht),si=function(e){function t(t){var n=e.call(this,t)||this;return n.supportsMasking=!0,n}return a(t,e),t.prototype.build=function(t){if((t=et(t)).length<3)throw new w("TimeDistributed layer expects an input shape >= 3D, but received input shape "+JSON.stringify(t));this.inputSpec=[{shape:t}];var n=[t[0]].concat(t.slice(2));this.layer.built||(this.layer.build(n),this.layer.built=!0),e.prototype.build.call(this,t)},t.prototype.computeOutputShape=function(e){var t=[(e=et(e))[0]].concat(e.slice(2)),n=this.layer.computeOutputShape(t),r=e[1];return[n[0],r].concat(n.slice(1))},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){return Yr(function(e,r){return[Qe(n.layer.call(e,t)),[]]},e=Qe(e),[],!1,null,null,!1,!0)[1]})},t.className="TimeDistributed",t}(ai);i.ed.registerClass(si);var ui=["sum","mul","concat","ave"];var ci=function(e){function t(t){var n=e.call(this,t)||this,r=t.layer.getConfig();if(n.forwardLayer=on({className:t.layer.getClassName(),config:r}),r.goBackwards=!0!==r.goBackwards,n.backwardLayer=on({className:t.layer.getClassName(),config:r}),n.forwardLayer.name="forward_"+n.forwardLayer.name,n.backwardLayer.name="backward_"+n.backwardLayer.name,function(e){B(ui,"BidirectionalMergeMode",e)}(t.mergeMode),n.mergeMode=t.mergeMode,t.weights)throw new x("weights support is not implemented for Bidirectional layer yet.");return n._stateful=t.layer.stateful,n.returnSequences=t.layer.returnSequences,n.returnState=t.layer.returnState,n.supportsMasking=!0,n._trainable=!0,n.inputSpec=t.layer.inputSpec,n.numConstants=null,n}return a(t,e),Object.defineProperty(t.prototype,"trainable",{get:function(){return this._trainable},set:function(e){this._trainable=e,null!=this.forwardLayer&&(this.forwardLayer.trainable=e),null!=this.backwardLayer&&(this.backwardLayer.trainable=e)},enumerable:!0,configurable:!0}),t.prototype.getWeights=function(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())},t.prototype.setWeights=function(e){var t=e.length,n=Math.floor(t/2);this.forwardLayer.setWeights(e.slice(0,n)),this.backwardLayer.setWeights(e.slice(n))},t.prototype.computeOutputShape=function(e){var t,n,r,i=this.forwardLayer.computeOutputShape(e);return Array.isArray(i)&&Array.isArray(i[0])||(i=[i]),i=i,this.returnState?(r=i.slice(1),t=i[0]):t=i[0],t=t,"concat"===this.mergeMode?(t[t.length-1]*=2,n=[t]):n=null==this.mergeMode?[t,t.slice()]:[t],this.returnState?null==this.mergeMode?n.concat(r).concat(r.slice()):[t].concat(r).concat(r.slice()):A(n)},t.prototype.apply=function(t,n){var r=null==n?null:n.initialState,i=null==n?null:n.constants;null==n&&(n={});var o=Kr(t,r,i,this.numConstants);if(t=o.inputs,r=o.initialState,i=o.constants,Array.isArray(t)&&(r=t.slice(1),t=t[0]),(null==r||0===r.length)&&null==i)return e.prototype.apply.call(this,t,n);var a=[],s=[];if(null!=r){var u=r.length;if(u%2>0)throw new w("When passing `initialState` to a Bidrectional RNN, the state should be an Array containing the states of the underlying RNNs.");n.initialState=r,a.push.apply(a,r);var c=r.map(function(e){return new at({shape:e.shape})});this.forwardLayer.stateSpec=c.slice(0,u/2),this.backwardLayer.stateSpec=c.slice(u/2),s.push.apply(s,c)}if(null!=i)throw new x("Support for constants in Bidirectional layers is not implemented yet.");for(var l=a[0]instanceof st,h=0,d=a;h<d.length;h++)if(d[h]instanceof st!==l)throw new w("The initial state of a Bidirectional layer cannot be specified as a mix of symbolic and non-symbolic tensors");if(l){var f=[t].concat(a),p=this.inputSpec.concat(s),m=this.inputSpec;this.inputSpec=p;var g=e.prototype.apply.call(this,f,n);return this.inputSpec=m,g}return e.prototype.apply.call(this,t,n)},t.prototype.call=function(e,t){var n=this;return Object(i.Od)(function(){if(null!=t.mask)throw new x("The support for masking is not implemented for Bidirectional layers yet.");var r,o,a,s,u=t.initialState;if(null==u)r=n.forwardLayer.call(e,t),o=n.backwardLayer.call(e,t);else{var c=u.slice(0,u.length/2),l=u.slice(u.length/2);r=n.forwardLayer.call(e,Object.assign(t,{initialState:c})),o=n.backwardLayer.call(e,Object.assign(t,{initialState:l}))}return n.returnState&&(Array.isArray(r)&&(a=r.slice(1).concat(o.slice(1))),r=r[0],o=o[0]),n.returnSequences&&(o=Object(i.Uc)(o,1)),"concat"===n.mergeMode?s=_e([r,o]):"sum"===n.mergeMode?s=Object(i.s)(r,o):"ave"===n.mergeMode?s=Object(i.oc)(y(.5),Object(i.s)(r,o)):"mul"===n.mergeMode?s=Object(i.oc)(r,o):null==n.mergeMode&&(s=[r,o]),n.returnState?null==n.mergeMode?s.concat(a):[s].concat(a):s})},t.prototype.resetStates=function(e){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()},t.prototype.build=function(e){var t=this;ie(this.forwardLayer.name,function(){t.forwardLayer.build(e)}),ie(this.backwardLayer.name,function(){t.backwardLayer.build(e)}),this.built=!0},Object.defineProperty(t.prototype,"trainableWeights",{get:function(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nonTrainableWeights",{get:function(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)},enumerable:!0,configurable:!0}),t.prototype.getConfig=function(){var t={mergeMode:this.mergeMode},n=e.prototype.getConfig.call(this);return Object.assign(t,n),t},t.fromConfig=function(e,t){var n=on(t.layer);if(delete t.layer,null!=t.numConstants)throw new x("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");var r=t;return r.layer=n,new e(r)},t.className="Bidirectional",t}(ai);function li(e){return new jr(e)}function hi(e){return new Vr(e)}function di(e){return new $r(e)}function fi(e){return new Gr(e)}function pi(e){return new Br(e)}function mi(e){return new zr(e)}i.ed.registerClass(ci);var gi=di,bi=fi,yi=pi,vi=mi,_i=Object.freeze({inputLayer:function(e){return new dt(e)},elu:function(e){return new Kn(e)},reLU:function(e){return new Hn(e)},leakyReLU:function(e){return new Gn(e)},softmax:function(e){return new Xn(e)},thresholdedReLU:function(e){return new Yn(e)},conv1d:function(e){return new dr(e)},conv2d:function(e){return new cr(e)},conv2dTranspose:function(e){return new lr(e)},separableConv2d:function(e){return new hr(e)},cropping2D:function(e){return new fr(e)},upSampling2d:function(e){return new pr(e)},depthwiseConv2d:function(e){return new mr(e)},activation:function(e){return new vr(e)},dense:function(e){return new br(e)},dropout:function(e){return new gr(e)},flatten:function(e){return new yr(e)},repeatVector:function(e){return new _r(e)},reshape:function(e){return new wr(e)},permute:function(e){return new xr(e)},embedding:function(e){return new Er(e)},add:function(e){return new Cr(e)},average:function(e){return new Ar(e)},concatenate:function(e){return new kr(e)},maximum:function(e){return new Mr(e)},minimum:function(e){return new Nr(e)},multiply:function(e){return new Or(e)},batchNormalization:function(e){return new Pr(e)},zeroPadding2d:function(e){return new Rr(e)},averagePooling1d:li,avgPool1d:function(e){return li(e)},avgPooling1d:function(e){return li(e)},averagePooling2d:hi,avgPool2d:function(e){return hi(e)},avgPooling2d:function(e){return hi(e)},globalAveragePooling1d:function(e){return new Wr(e)},globalAveragePooling2d:function(e){return new Hr(e)},globalMaxPooling1d:di,globalMaxPooling2d:fi,maxPooling1d:pi,maxPooling2d:mi,gru:function(e){return new ti(e)},gruCell:function(e){return new ei(e)},lstm:function(e){return new ri(e)},lstmCell:function(e){return new ni(e)},simpleRNN:function(e){return new Qr(e)},simpleRNNCell:function(e){return new Jr(e)},rnn:function(e){return new Xr(e)},stackedRNNCells:function(e){return new ii(e)},bidirectional:function(e){return new ci(e)},timeDistributed:function(e){return new si(e)},globalMaxPool1d:gi,globalMaxPool2d:bi,maxPool1d:yi,maxPool2d:vi,Layer:ht,RNN:Xr,RNNCell:Zr,input:Nn});var wi=Object.freeze({binaryAccuracy:function(e,t){return jt(e,t)},binaryCrossentropy:function(e,t){return Wt(e,t)},categoricalAccuracy:function(e,t){return Ft(e,t)},categoricalCrossentropy:function(e,t){return Zt(e,t)},precision:function(e,t){return Vt(e,t)},recall:function(e,t){return Ut(e,t)},cosineProximity:function(e,t){return Lt(e,t)},meanAbsoluteError:function(e,t){return St(e,t)},meanAbsolutePercentageError:function(e,t){return Ct(e,t)},MAPE:function(e,t){return Ct(e,t)},mape:function(e,t){return Ct(e,t)},meanSquaredError:function(e,t){return Et(e,t)},MSE:function(e,t){return Et(e,t)},mse:function(e,t){return Et(e,t)}});var xi=Object.freeze({l1l2:function(e){return new Jn(e)},l1:function(e){return function(e){return new Jn({l1:null!=e?e.l1:null,l2:0})}(e)},l2:function(e){return function(e){return new Jn({l2:null!=e?e.l2:null,l1:0})}(e)}}),Ei=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.model=null,t}return a(t,e),t.prototype.setModel=function(e){if(!(e instanceof En))throw new Error("model must be a Model, not some other Container");this.model=e},t}(mt),Si=n(34),Ci={"tfjs-core":i.de,"tfjs-layers":sn,"tfjs-converter":Si.c,tfjs:"0.13.0"};function Oi(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})}function Ai(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}n.d(t,"decodeMultiplePoses",function(){return ro}),n.d(t,"decodeSinglePose",function(){return go}),n.d(t,"load",function(){return vo}),n.d(t,"PoseNet",function(){return yo}),n.d(t,"checkpoints",function(){return ho}),n.d(t,"partIds",function(){return ki}),n.d(t,"partNames",function(){return Mi}),n.d(t,"poseChain",function(){return Ii}),n.d(t,"getAdjacentKeyPoints",function(){return Pi}),n.d(t,"getBoundingBox",function(){return Li}),n.d(t,"getBoundingBoxPoints",function(){return Bi});var Mi=["nose","leftEye","rightEye","leftEar","rightEar","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle"],Ni=Mi.length,ki=Mi.reduce(function(e,t,n){return e[t]=n,e},{}),Ii=[["nose","leftEye"],["leftEye","leftEar"],["nose","rightEye"],["rightEye","rightEar"],["nose","leftShoulder"],["leftShoulder","leftElbow"],["leftElbow","leftWrist"],["leftShoulder","leftHip"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["nose","rightShoulder"],["rightShoulder","rightElbow"],["rightElbow","rightWrist"],["rightShoulder","rightHip"],["rightHip","rightKnee"],["rightKnee","rightAnkle"]],Ti=[["leftHip","leftShoulder"],["leftElbow","leftShoulder"],["leftElbow","leftWrist"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["rightHip","rightShoulder"],["rightElbow","rightShoulder"],["rightElbow","rightWrist"],["rightHip","rightKnee"],["rightKnee","rightAnkle"],["leftShoulder","rightShoulder"],["leftHip","rightHip"]].map(function(e){var t=e[0],n=e[1];return[ki[t],ki[n]]});function Pi(e,t){return Ti.reduce(function(n,r){var i=r[0],o=r[1];return function(e,t,n){return e<n||t<n}(e[i].score,e[o].score,t)?n:(n.push([e[i],e[o]]),n)},[])}var Ri=Number.NEGATIVE_INFINITY,Di=Number.POSITIVE_INFINITY;function Li(e){return e.reduce(function(e,t){var n=e.maxX,r=e.maxY,i=e.minX,o=e.minY,a=t.position,s=a.x,u=a.y;return{maxX:Math.max(n,s),maxY:Math.max(r,u),minX:Math.min(i,s),minY:Math.min(o,u)}},{maxX:Ri,maxY:Ri,minX:Di,minY:Di})}function Bi(e){var t=Li(e),n=t.minX,r=t.minY,i=t.maxX,o=t.maxY;return[{x:n,y:r},{x:i,y:r},{x:i,y:o},{x:n,y:o}]}function ji(e,t){return void 0===t&&(t="float32"),Oi(this,void 0,void 0,function(){var n;return Ai(this,function(r){switch(r.label){case 0:return[4,e.data()];case 1:return n=r.sent(),[2,new i.n(e.shape,t,n)]}})})}function Fi(e,t,n){return{score:e.score,keypoints:e.keypoints.map(function(e){var r=e.score,i=e.part,o=e.position;return{score:r,part:i,position:{x:o.x*t,y:o.y*n}}})}}function zi(e,t,n){var r=t*e-1;return r-r%n+1}function Vi(e){return Math.floor(e/2)}var Ui=function(){function e(e,t){this.priorityQueue=new Array(e),this.numberOfElements=-1,this.getElementValue=t}return e.prototype.enqueue=function(e){this.priorityQueue[++this.numberOfElements]=e,this.swim(this.numberOfElements)},e.prototype.dequeue=function(){var e=this.priorityQueue[0];return this.exchange(0,this.numberOfElements--),this.sink(0),this.priorityQueue[this.numberOfElements+1]=null,e},e.prototype.empty=function(){return-1===this.numberOfElements},e.prototype.size=function(){return this.numberOfElements+1},e.prototype.all=function(){return this.priorityQueue.slice(0,this.numberOfElements+1)},e.prototype.max=function(){return this.priorityQueue[0]},e.prototype.swim=function(e){for(;e>0&&this.less(Vi(e),e);)this.exchange(e,Vi(e)),e=Vi(e)},e.prototype.sink=function(e){for(;2*e<=this.numberOfElements;){var t=2*e;if(t<this.numberOfElements&&this.less(t,t+1)&&t++,!this.less(e,t))break;this.exchange(e,t),e=t}},e.prototype.getValueAt=function(e){return this.getElementValue(this.priorityQueue[e])},e.prototype.less=function(e,t){return this.getValueAt(e)<this.getValueAt(t)},e.prototype.exchange=function(e,t){var n=this.priorityQueue[e];this.priorityQueue[e]=this.priorityQueue[t],this.priorityQueue[t]=n},e}();function Wi(e,t,n,r,i,o){for(var a=o.shape,s=a[0],u=a[1],c=!0,l=Math.max(n-i,0),h=Math.min(n+i+1,s),d=l;d<h;++d){for(var f=Math.max(r-i,0),p=Math.min(r+i+1,u),m=f;m<p;++m)if(o.get(d,m,e)>t){c=!1;break}if(!c)break}return c}function $i(e,t,n,r){return{y:r.get(e,t,n),x:r.get(e,t,n+Ni)}}function qi(e,t,n){var r=$i(e.heatmapY,e.heatmapX,e.id,n),i=r.y,o=r.x;return{x:e.heatmapX*t+o,y:e.heatmapY*t+i}}function Hi(e,t,n){return e<t?t:e>n?n:e}function Gi(e,t){return{x:e.x+t.x,y:e.y+t.y}}var Ki=Ii.map(function(e){var t=e[0],n=e[1];return[ki[t],ki[n]]}),Yi=Ki.map(function(e){return e[1]}),Xi=Ki.map(function(e){return e[0]});function Zi(e,t,n,r){return{y:Hi(Math.round(e.y/t),0,n-1),x:Hi(Math.round(e.x/t),0,r-1)}}function Ji(e,t,n,r,i,o,a){var s=r.shape,u=s[0],c=s[1],l=function(e,t,n){var r=n.shape[2]/2;return{y:n.get(t.y,t.x,e),x:n.get(t.y,t.x,r+e)}}(e,Zi(t.position,o,u,c),a),h=Zi(Gi(t.position,l),o,u,c),d=$i(h.y,h.x,n,i),f=r.get(h.y,h.x,n);return{position:Gi({x:h.x*o,y:h.y*o},{x:d.x,y:d.y}),part:Mi[n],score:f}}function Qi(e,t,n,r,i,o){var a=t.shape[2],s=Yi.length,u=new Array(a),c=e.part,l=e.score,h=qi(c,r,n);u[c.id]={score:l,part:Mi[c.id],position:h};for(var d=s-1;d>=0;--d){var f=Yi[d],p=Xi[d];u[f]&&!u[p]&&(u[p]=Ji(d,u[f],p,t,n,r,o))}for(d=0;d<s;++d)f=Xi[d],p=Yi[d],u[f]&&!u[p]&&(u[p]=Ji(d,u[f],p,t,n,r,i));return u}function eo(e,t,n,r){var i=n.x,o=n.y;return e.some(function(e){var n=e.keypoints[r].position;return function(e,t,n,r){var i=n-e,o=r-t;return i*i+o*o}(o,i,n.y,n.x)<=t})}function to(e,t,n){return n.reduce(function(n,r,i){var o=r.position,a=r.score;return eo(e,t,o,i)||(n+=a),n},0)/n.length}var no=1;function ro(e,t,n,r,i,o,a,s){return void 0===a&&(a=.5),void 0===s&&(s=20),Oi(this,void 0,void 0,function(){var u,c,l,h,d,f,p,m,g,b,y,v;return Ai(this,function(_){switch(_.label){case 0:return u=[],[4,function(e){return Oi(this,void 0,void 0,function(){return Ai(this,function(t){return[2,Promise.all(e.map(function(e){return ji(e,"float32")}))]})})}([e,t,n,r])];case 1:for(c=_.sent(),l=c[0],h=c[1],d=c[2],f=c[3],p=function(e,t,n){for(var r=n.shape,i=r[0],o=r[1],a=r[2],s=new Ui(i*o*a,function(e){return e.score}),u=0;u<i;++u)for(var c=0;c<o;++c)for(var l=0;l<a;++l){var h=n.get(u,c,l);h<e||Wi(l,h,u,c,t,n)&&s.enqueue({score:h,part:{heatmapY:u,heatmapX:c,id:l}})}return s}(a,no,l),m=s*s;u.length<o&&!p.empty();)g=p.dequeue(),b=qi(g.part,i,h),eo(u,m,b,g.part.id)||(y=Qi(g,l,h,i,d,f),v=to(u,m,y),u.push({keypoints:y,score:v}));return[2,u]}})})}var io=function(){function e(e){this.urlPath=e,"/"!==this.urlPath.charAt(this.urlPath.length-1)&&(this.urlPath+="/")}return e.prototype.loadManifest=function(){var e=this;return new Promise(function(t,n){var r=new XMLHttpRequest;r.open("GET",e.urlPath+"manifest.json"),r.onload=function(){e.checkpointManifest=JSON.parse(r.responseText),t()},r.onerror=function(t){throw new Error("manifest.json not found at "+e.urlPath+". "+t)},r.send()})},e.prototype.getCheckpointManifest=function(){var e=this;return null==this.checkpointManifest?new Promise(function(t,n){e.loadManifest().then(function(){t(e.checkpointManifest)})}):new Promise(function(t,n){t(e.checkpointManifest)})},e.prototype.getAllVariables=function(){var e=this;return null!=this.variables?new Promise(function(t,n){t(e.variables)}):new Promise(function(t,n){e.getCheckpointManifest().then(function(n){for(var r=Object.keys(e.checkpointManifest),i=[],o=0;o<r.length;o++)i.push(e.getVariable(r[o]));Promise.all(i).then(function(n){e.variables={};for(var i=0;i<n.length;i++)e.variables[r[i]]=n[i];t(e.variables)})})})},e.prototype.getVariable=function(e){var t=this;if(!(e in this.checkpointManifest))throw new Error("Cannot load non-existant variable "+e);var n=function(n,r){var o=new XMLHttpRequest;o.responseType="arraybuffer";var a=t.checkpointManifest[e].filename;o.open("GET",t.urlPath+a),o.onload=function(){if(404===o.status)throw new Error("Not found variable "+e);var r=new Float32Array(o.response),a=i.m.make(t.checkpointManifest[e].shape,{values:r});n(a)},o.onerror=function(t){throw new Error("Could not fetch variable "+e+": "+t)},o.send()};return null==this.checkpointManifest?new Promise(function(e,r){t.loadManifest().then(function(){new Promise(n).then(e)})}):new Promise(n)},e}(),oo=[8,16,32];function ao(e){i.Yd.assert("number"==typeof e,"outputStride is not a number"),i.Yd.assert(oo.indexOf(e)>=0,"outputStride of "+e+" is invalid. It must be either 8, 16, or 32")}function so(e){i.Yd.assert("number"==typeof e,"imageScaleFactor is not a number"),i.Yd.assert(e>=.2&&e<=1,"imageScaleFactor must be between 0.2 and 1.0")}var uo={100:[["conv2d",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",2],["separableConv",1]],75:[["conv2d",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1]],50:[["conv2d",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",2],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1],["separableConv",1]]};var co=function(){function e(e,t){this.PREPROCESS_DIVISOR=Object(i.bd)(127.5),this.ONE=Object(i.bd)(1),this.variables=e,this.convolutionDefinitions=t}return e.prototype.predict=function(e,t){var n=this,r=Object(i.M)(e,"float32").div(this.PREPROCESS_DIVISOR).sub(this.ONE);return function(e,t){var n=1,r=1;return e.map(function(e,i){var o,a,s=e[0],u=e[1];return n===t?(o=1,a=r,r*=u):(o=u,a=1,n*=u),{blockId:i,convType:s,stride:o,rate:a,outputStride:n}})}(this.convolutionDefinitions,t).reduce(function(e,t){var r=t.blockId,i=t.stride,o=t.convType,a=t.rate;if("conv2d"===o)return n.conv(e,i,r);if("separableConv"===o)return n.separableConv(e,i,r,a);throw Error("Unknown conv type of "+o)},r)},e.prototype.convToOutput=function(e,t){return e.conv2d(this.weights(t),1,"same").add(this.biases(t))},e.prototype.conv=function(e,t,n){return e.conv2d(this.weights("Conv2d_"+String(n)),t,"same").add(this.biases("Conv2d_"+String(n))).clipByValue(0,6)},e.prototype.separableConv=function(e,t,n,r){void 0===r&&(r=1);var i="Conv2d_"+String(n)+"_depthwise",o="Conv2d_"+String(n)+"_pointwise";return e.depthwiseConv2D(this.depthwiseWeights(i),t,"same","NHWC",r).add(this.biases(i)).clipByValue(0,6).conv2d(this.weights(o),[1,1],"same").add(this.biases(o)).clipByValue(0,6)},e.prototype.weights=function(e){return this.variables["MobilenetV1/"+e+"/weights"]},e.prototype.biases=function(e){return this.variables["MobilenetV1/"+e+"/biases"]},e.prototype.depthwiseWeights=function(e){return this.variables["MobilenetV1/"+e+"/depthwise_weights"]},e.prototype.dispose=function(){for(var e in this.variables)this.variables[e].dispose()},e}(),lo="https://storage.googleapis.com/tfjs-models/weights/posenet/",ho={1.01:{url:lo+"mobilenet_v1_101/",architecture:uo[100]},1:{url:lo+"mobilenet_v1_100/",architecture:uo[100]},.75:{url:lo+"mobilenet_v1_075/",architecture:uo[75]},.5:{url:lo+"mobilenet_v1_050/",architecture:uo[50]}};function fo(e){var t=e.shape,n=t[0],r=t[1],o=t[2];return Object(i.Od)(function(){var t=e.reshape([n*r,o]).argMax(0),a=t.div(Object(i.bd)(r,"int32")).expandDims(1),s=function(e,t){return Object(i.Od)(function(){var n=e.div(Object(i.bd)(t,"int32"));return e.sub(n.mul(Object(i.bd)(t,"int32")))})}(t,r).expandDims(1);return Object(i.R)([a,s],1)})}function po(e,t,n,r){return{y:r.get(e,t,n),x:r.get(e,t,n+Ni)}}function mo(e,t,n){return Object(i.Od)(function(){var r=function(e,t){for(var n=[],r=0;r<Ni;r++){var o=po(e.get(r,0).valueOf(),e.get(r,1).valueOf(),r,t),a=o.x,s=o.y;n.push(s),n.push(a)}return Object(i.Id)(n,[Ni,2])}(e,n);return e.toTensor().mul(Object(i.bd)(t,"int32")).toFloat().add(r)})}function go(e,t,n){return Oi(this,void 0,void 0,function(){var r,i,o,a,s,u,c,l,h,d;return Ai(this,function(f){switch(f.label){case 0:return r=0,i=fo(e),[4,Promise.all([ji(e),ji(t),ji(i,"int32")])];case 1:return o=f.sent(),a=o[0],s=o[1],u=o[2],[4,ji(c=mo(u,n,s))];case 2:return l=f.sent(),h=Array.from(function(e,t){for(var n=t.shape[0],r=new Float32Array(n),i=0;i<n;i++){var o=t.get(i,0),a=t.get(i,1);r[i]=e.get(o,a,i)}return r}(a,u)),d=h.map(function(e,t){return r+=e,{position:{y:l.get(t,0),x:l.get(t,1)},part:Mi[t],score:e}}),i.dispose(),c.dispose(),[2,{keypoints:d,score:r/d.length}]}})})}function bo(e,t,n,r){var o=e instanceof i.m?e:Object(i.wb)(e);return r?o.reverse(1).resizeBilinear([t,n]):o.resizeBilinear([t,n])}var yo=function(){function e(e){this.mobileNet=e}return e.prototype.predictForSinglePose=function(e,t){var n=this;return void 0===t&&(t=16),ao(t),Object(i.Od)(function(){var r=n.mobileNet.predict(e,t),i=n.mobileNet.convToOutput(r,"heatmap_2"),o=n.mobileNet.convToOutput(r,"offset_2");return{heatmapScores:i.sigmoid(),offsets:o}})},e.prototype.predictForMultiPose=function(e,t){var n=this;return void 0===t&&(t=16),Object(i.Od)(function(){var r=n.mobileNet.predict(e,t),i=n.mobileNet.convToOutput(r,"heatmap_2"),o=n.mobileNet.convToOutput(r,"offset_2"),a=n.mobileNet.convToOutput(r,"displacement_fwd_2"),s=n.mobileNet.convToOutput(r,"displacement_bwd_2");return{heatmapScores:i.sigmoid(),offsets:o,displacementFwd:a,displacementBwd:s}})},e.prototype.estimateSinglePose=function(e,t,n,r){return void 0===t&&(t=.5),void 0===n&&(n=!1),void 0===r&&(r=16),Oi(this,void 0,void 0,function(){var o,a,s,u,c,l,h,d,f,p=this;return Ai(this,function(m){switch(m.label){case 0:return ao(r),so(t),o=e instanceof i.m?[e.shape[0],e.shape[1]]:[e.height,e.width],a=o[0],s=o[1],u=zi(t,a,r),c=zi(t,s,r),l=Object(i.Od)(function(){var t=bo(e,u,c,n);return p.predictForSinglePose(t,r)}),h=l.heatmapScores,d=l.offsets,[4,go(h,d,r)];case 1:return f=m.sent(),h.dispose(),d.dispose(),[2,Fi(f,a/u,s/c)]}})})},e.prototype.estimateMultiplePoses=function(e,t,n,r,o,a,s){return void 0===t&&(t=.5),void 0===n&&(n=!1),void 0===r&&(r=16),void 0===o&&(o=5),void 0===a&&(a=.5),void 0===s&&(s=20),Oi(this,void 0,void 0,function(){var u,c,l,h,d,f,p,m,g,b,y,v=this;return Ai(this,function(_){switch(_.label){case 0:return ao(r),so(t),u=e instanceof i.m?[e.shape[0],e.shape[1]]:[e.height,e.width],c=u[0],l=u[1],h=zi(t,c,r),d=zi(t,l,r),f=Object(i.Od)(function(){var t=bo(e,h,d,n);return v.predictForMultiPose(t,r)}),p=f.heatmapScores,m=f.offsets,g=f.displacementFwd,b=f.displacementBwd,[4,ro(p,m,g,b,r,o,a,s)];case 1:return y=_.sent(),p.dispose(),m.dispose(),g.dispose(),b.dispose(),[2,function(e,t,n){return 1===n&&1===t?e:e.map(function(e){return Fi(e,n,t)})}(y,c/h,l/d)]}})})},e.prototype.dispose=function(){this.mobileNet.dispose()},e}();function vo(e){return void 0===e&&(e=1.01),Oi(this,void 0,void 0,function(){var t,n;return Ai(this,function(o){switch(o.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.");return t=Object.keys(ho),i.Yd.assert("number"==typeof e,"got multiplier type of "+typeof e+" when it should be a number."),i.Yd.assert(t.indexOf(e.toString())>=0,"invalid multiplier value of "+e+".  No checkpoint exists for that multiplier. Must be one of "+t.join(",")+"."),[4,_o.load(e)];case 1:return n=o.sent(),[2,new yo(n)]}})})}var _o={load:function(e){return Oi(void 0,void 0,void 0,function(){var t,n;return Ai(this,function(r){switch(r.label){case 0:return t=ho[e],[4,new io(t.url).getAllVariables()];case 1:return n=r.sent(),[2,new co(n,t.architecture)]}})})}}},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),o=n(6),a=n(3),s=n(14);class u extends s.AbstractModalElement{constructor(){super(),this.usermedia=!1,this.webaudio=!1,this.webgl=!1,this.ios=!1,this.priority=10,this.exclusive=!0}connectedCallback(){super.connectedCallback();let e=!1;this.webaudio&&!this.hasWebAudio()&&(e=!0),this.usermedia&&!this.hasUserMedia()&&(e=!0),this.webgl&&!this.hasWebGL()&&(e=!0),this.ios&&this.isIos()&&(e=!0),e&&this.setAttribute("open","")}_isDefined(e){return void 0!==e}hasUserMedia(){return this._isDefined(navigator.mediaDevices)&&this._isDefined(navigator.mediaDevices.getUserMedia)}hasWebAudio(){return this._isDefined(AudioContext)}hasWebGL(){let e=null;const t=document.createElement("canvas");try{e=t.getContext("webgl")}catch(t){e=null}if(null==e)try{e=t.getContext("experimental-webgl")}catch(t){e=null}return null!==e}isIos(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!("MSStream"in window)}_renderModalBody(){return i.html`
            <style>
                #fallback {
                    background-color: var(--background-color, white);
                    width: 100%;
                    height: 100%;
                    position: absolute;
                    top: 0px;
                    left: 0px;
                    font-family: ${o.bodyFontFamily};
                    color: var(--label-color, black);
                }

                #fallback #text {
                    position: absolute;
                    top: 50%;
                    left: 50%;
                    transform: translate(-50%, -50%);
                    max-width: 400px;
                    font-size: 18px;
                }
            </style>
            <div id="fallback">
                <div id="text">
                    Oops! Your browser does not support the technologies used in this experiment. 
                <br><br>
                    For the best experience, try Chrome on Desktop. 
                </div>
            </div>
           
        `}}r([a.property({type:Boolean})],u.prototype,"usermedia",void 0),r([a.property({type:Boolean})],u.prototype,"webaudio",void 0),r([a.property({type:Boolean})],u.prototype,"webgl",void 0),r([a.property({type:Boolean})],u.prototype,"ios",void 0),t.FallbackElement=u,customElements.define("acc-fallback",u)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const o=n(6),a=n(1),s=n(3);n(37);const u=n(14);class c extends u.AbstractModalElement{constructor(){super(),this.label="Input Selection",this.selectedIndex=0,this.bodySupported=!0,this.priority=2}connectedCallback(){super.connectedCallback();const e=document.createElement("acc-fallback");this.bodySupported=e.hasUserMedia()&&e.hasWebGL(),this.bodySupported||this._closeClicked()}_closeClicked(){this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("input",{composed:!0,bubbles:!0,detail:{type:this.selectedIndex?"body":"keyboard"}}))}_renderModalBody(){const e=(e,t,n,r,o)=>a.html`
                <div 
                    disabled?=${o}
                    class$="option ${this.selectedIndex===e?"selected":""}">
                    <div aria-hidden="true" id="title">${t}</div>
                    <div aria-hidden="true" id="img">${n}</div>
                    <div aria-hidden="true" id="text">${r}<br>${o?"(not supported)":""}</div>
                    <button 
                        disabled?=${o}
                        aria-role="radio"
                        aria-pressed$=${this.selectedIndex===e}
                        on-click=${t=>i(this,void 0,void 0,function*(){this.selectedIndex=e,yield this.renderComplete,t.target.focus()})}>${r}</button>
                </div>
            `;return a.html`
            <style>

                :host([dark]), [dark] {
                    --background-color: black;
                    --button-fill: black;
                }

                :host {
                    --background-color: white;
                    --button-fill: white;
                }

                #content {
                    background-color: var(--background-color);
                    position: absolute;
                    width: 100%;
                    height: 100%;
                    left: 0px;
                    top: 0px;
                }

                h2 {
                    color: var(--fill-color);
                    text-align: center;
                }

                #close-button{
                    width: 150px;
                    height: 50px;
                    display: inline-block;
                    border: none;
                    color: white;
                    font-size: 0.8em;
                    font-family: ${o.bodyFontFamily};
                    cursor: pointer;
                    font-weight: bold;
                    background-color: ${o.accentColor};
                    font-size: 16px;
                    margin: 50px auto 0;
                    display: block;
                }

                :host([dark]) #close-button, [dark] #close-button {
                    color: black;
                }

                #group {
                    position: absolute;
                    top: 50%;
                    left: 50%;
                    transform: translate(-50%, -50%);
                    --option-size: 310px;
                    --option-margin: 100px;
                    width: calc(var(--option-size) * 2 + var(--option-margin));
                }

                #selections {
                    position: relative;
                    display: block;
                    height: var(--option-size);
                }

                .option {
                    position: relative;
                    display: inline-block;
                    width: var(--option-size);
                    height: var(--option-size);
                    --option-color: black;
                }

                :host([dark]) .option, [dark] .option {
                    --option-color: white;
                }

                .option.selected {
                    --option-color: ${o.accentColor};
                    color: var(--option-color);
                }

                .option:nth-child(2){
                    float: right;
                }

                .option[disabled]{
                    opacity: 0.25;
                    pointer-events: none;
                }

                .option #title{
                    width: 100%;
                    text-align: center;
                    font-size: 20px;
                    margin-top: 30px;
                    font-weight: bold;
                    color: var(--option-color);
                }

                .option #img {
                    position: absolute;
                    top: 0px;
                    width: 100%;
                }

                #img svg {
                    width: 100%;
                    height: 100%;
                }

                .option #text {
                    position: absolute;
                    top: 78%;
                    width: 100%;
                    text-align: center;
                    color: var(--option-color);
                }

                .option button {
                    box-sizing: border-box;
                    width: 94%;
                    height: 94%;
                    top: 3%;
                    left: 3%;
                    position: absolute;
                    -webkit-appearance: none;
                    -moz-appearance: none;
                    appearance: none;
                    background-color: transparent;
                    border: 2px solid var(--option-color);
                    opacity: 0.5;
                    color: transparent;
                }

            </style>
            <div id="content">
                <h2>${this.label}</h2>
                <div id="group">
                    <div id="selections" aria-role="radiogroup">
                        ${e(0,"Keyboard/Mouse",h,"Use keyboard, mouse or touch.",!1)}
                        ${e(1,"Body",l,"Use body tracking via your webcam.",!this.bodySupported)}
                    </div>
                    <button 
                        id="close-button"
                        on-click="${this._closeClicked.bind(this)}">
                        Continue
                    </button>
                </div>
            </div>
        `}}r([s.property({type:String})],c.prototype,"label",void 0),r([s.property({type:Number})],c.prototype,"selectedIndex",void 0),r([s.property({type:Boolean})],c.prototype,"bodySupported",void 0),t.InputSelectionScreen=c,customElements.define("acc-input-selection",c);const l=a.html`<?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 380 360" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <!-- Generator: Sketch 51.2 (57519) - http://www.bohemiancoding.com/sketch -->
    <title>Input Method - Body</title>
    <desc>Created with Sketch.</desc>
    <defs></defs>
    <g id="Input-Method---Body" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
        <g id="Group-2" transform="translate(131.000000, 108.000000)" fill-rule="nonzero">
            <path d="M59.5,90 C82.4198171,90 101,71.4198171 101,48.5 C101,25.5801829 82.4198171,7 59.5,7 C36.5801829,7 18,25.5801829 18,48.5 C18,71.4198171 36.5801829,90 59.5,90 Z M59.5,93 C34.9233286,93 15,73.0766714 15,48.5 C15,23.9233286 34.9233286,4 59.5,4 C84.0766714,4 104,23.9233286 104,48.5 C104,73.0766714 84.0766714,93 59.5,93 Z" id="Oval-2" fill="#AAAAAA"></path>
            <circle id="Oval" fill="#AAAAAA" cx="60" cy="28" r="3"></circle>
            <circle id="Oval" fill="#AAAAAA" cx="85" cy="28" r="3"></circle>
            <path d="M79.8322471,57.0585366 C80.352203,56.4136045 81.2965313,56.3122913 81.9414634,56.8322471 C82.5863955,57.352203 82.6877087,58.2965313 82.1677529,58.9414634 C80.3857658,61.1517676 76.5830182,62.5 72.3749721,62.5 C68.4187435,62.5 64.8105143,61.3061331 62.9149035,59.3200126 C62.3429312,58.7207304 62.3650703,57.771241 62.9643526,57.1992687 C63.5636348,56.6272964 64.5131242,56.6494355 65.0850965,57.2487177 C66.3403955,58.5639535 69.1694131,59.5 72.3749721,59.5 C75.7590439,59.5 78.7063459,58.4550587 79.8322471,57.0585366 Z" id="Stroke-1" fill="#AAAAAA"></path>
            <path d="M71.0108993,28.1804971 C70.9112136,27.3580895 71.4970954,26.6105851 72.3195029,26.5108993 C73.1419105,26.4112136 73.8894149,26.9970954 73.9891007,27.8195029 L75.9891007,44.3195029 C76.0887864,45.1419105 75.5029046,45.8894149 74.6804971,45.9891007 C73.8580895,46.0887864 73.1105851,45.5029046 73.0108993,44.6804971 L71.0108993,28.1804971 Z" id="Path-3" fill="#AAAAAA"></path>
            <path d="M122.9243,9.18233904 C123.375882,8.86438868 123.999711,8.97271826 124.317661,9.42429994 C124.635611,9.87588162 124.527282,10.4997106 124.0757,10.817661 L121.377419,12.7174711 C120.925837,13.0354215 120.302008,12.9270919 119.984058,12.4755102 C119.666108,12.0239286 119.774437,11.4000996 120.226019,11.0821492 L122.9243,9.18233904 Z M116.955375,13.3849495 C117.406957,13.0669991 118.030786,13.1753287 118.348736,13.6269104 C118.666686,14.078492 118.558357,14.702321 118.106775,15.0202714 L115.408494,16.9200815 C114.956912,17.2380319 114.333083,17.1297023 114.015133,16.6781207 C113.697183,16.226539 113.805512,15.60271 114.257094,15.2847596 L116.955375,13.3849495 Z M110.98645,17.5875599 C111.438032,17.2696095 112.061861,17.3779391 112.379811,17.8295208 C112.697761,18.2811025 112.589432,18.9049314 112.13785,19.2228818 L109.439569,21.122692 C108.987987,21.4406423 108.364158,21.3323127 108.046208,20.8807311 C107.728258,20.4291494 107.836587,19.8053204 108.288169,19.4873701 L110.98645,17.5875599 Z M105.017525,21.7901703 C105.469107,21.4722199 106.092936,21.5805495 106.410886,22.0321312 C106.728836,22.4837129 106.620507,23.1075418 106.168925,23.4254922 L103.470644,25.3253024 C103.019062,25.6432528 102.395233,25.5349232 102.077283,25.0833415 C101.759333,24.6317598 101.867662,24.0079308 102.319244,23.6899805 L105.017525,21.7901703 Z M99.0486002,25.9927807 C99.5001818,25.6748304 100.124011,25.7831599 100.441961,26.2347416 C100.759912,26.6863233 100.651582,27.3101523 100.2,27.6281026 L97.5017192,29.5279128 C97.0501375,29.8458632 96.4263085,29.7375336 96.1083582,29.2859519 C95.7904078,28.8343702 95.8987374,28.2105413 96.3503191,27.8925909 L99.0486002,25.9927807 Z M93.0796752,30.1953911 C93.5312569,29.8774408 94.1550859,29.9857704 94.4730362,30.437352 C94.7909866,30.8889337 94.682657,31.5127627 94.2310753,31.8307131 L91.5327942,33.7305232 C91.0812126,34.0484736 90.4573836,33.940144 90.1394332,33.4885623 C89.8214828,33.0369807 89.9298124,32.4131517 90.3813941,32.0952013 L93.0796752,30.1953911 Z M87.1107503,34.3980016 C87.562332,34.0800512 88.1861609,34.1883808 88.5041113,34.6399625 C88.8220617,35.0915441 88.7137321,35.7153731 88.2621504,36.0333235 L85.5638693,37.9331336 C85.1122876,38.251084 84.4884586,38.1427544 84.1705083,37.6911727 C83.8525579,37.2395911 83.9608875,36.6157621 84.4124692,36.2978117 L87.1107503,34.3980016 Z M81.1418253,38.600612 C81.593407,38.2826616 82.217236,38.3909912 82.5351864,38.8425729 C82.8531367,39.2941545 82.7448071,39.9179835 82.2932255,40.2359339 L79.5949443,42.1357441 C79.1433627,42.4536944 78.5195337,42.3453648 78.2015833,41.8937832 C77.883633,41.4422015 77.9919625,40.8183725 78.4435442,40.5004221 L81.1418253,38.600612 Z M75.1729004,42.8032224 C75.6244821,42.485272 76.2483111,42.5936016 76.5662614,43.0451833 C76.8842118,43.496765 76.7758822,44.1205939 76.3243005,44.4385443 L75.0757001,45.317661 C74.6241184,45.6356113 74.0002894,45.5272817 73.682339,45.0757001 C73.3643887,44.6241184 73.4727183,44.0002894 73.9242999,43.682339 L75.1729004,42.8032224 Z" id="Path-3" fill="#0054FF"></path>
            <g id="Group" transform="translate(114.000000, 0.000000)" fill="#0054FF">
                <path d="M10,18 C14.418278,18 18,14.418278 18,10 C18,5.581722 14.418278,2 10,2 C5.581722,2 2,5.581722 2,10 C2,14.418278 5.581722,18 10,18 Z M10,20 C4.4771525,20 0,15.5228475 0,10 C0,4.4771525 4.4771525,0 10,0 C15.5228475,0 20,4.4771525 20,10 C20,15.5228475 15.5228475,20 10,20 Z" id="Oval"></path>
                <path d="M10,18 C14.418278,18 18,14.418278 18,10 C18,5.581722 14.418278,2 10,2 C5.581722,2 2,5.581722 2,10 C2,14.418278 5.581722,18 10,18 Z" id="Path" fill-opacity="0.75"></path>
            </g>
            <path d="M19.1273201,139.5 L12.6729764,103.347012 C12.5015257,102.386658 13.2094762,101.5 14.1477195,101.5 L104.147719,101.5 C105.08597,101.5 105.793923,102.386672 105.622459,103.347032 L99.1676616,139.5 L96.1162754,139.5 L102.343208,104.623288 L15.9522071,104.623288 L22.1786991,139.5 L19.1273201,139.5 Z" id="Combined-Shape" fill="#AAAAAA"></path>
            <path d="M3.43507214,139.499591 L0.259372305,139.499591 L12.5829895,102.549411 C12.8547233,101.734666 13.7094242,101.303518 14.4920175,101.586416 C15.2746108,101.869314 15.6887443,102.759129 15.4170105,103.573875 L3.43507214,139.499591 Z" id="Combined-Shape" fill="#AAAAAA"></path>
            <path d="M117.941036,139.499591 L114.765337,139.499591 L102.783398,103.573875 C102.511664,102.759129 102.925798,101.869314 103.708391,101.586416 C104.490984,101.303518 105.345685,101.734666 105.617419,102.549411 L117.941036,139.499591 Z" id="Combined-Shape" fill="#AAAAAA"></path>
        </g>
    </g>
</svg>`,h=a.html`<?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 380 360" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <!-- Generator: Sketch 51.2 (57519) - http://www.bohemiancoding.com/sketch -->
    <title>Input Method - KeyboardMouse</title>
    <desc>Created with Sketch.</desc>
    <defs></defs>
    <g id="Input-Method---KeyboardMouse" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
        <path d="M99,212.962963 C98.4477153,212.962963 98,212.515248 98,211.962963 L98,186.037037 C98,185.484752 98.4477153,185.037037 99,185.037037 L124.925926,185.037037 C125.478211,185.037037 125.925926,185.484752 125.925926,186.037037 L125.925926,211.962963 C125.925926,212.515248 125.478211,212.962963 124.925926,212.962963 L99,212.962963 Z M123.925926,210.962963 L123.925926,187.037037 L100,187.037037 L100,210.962963 L123.925926,210.962963 Z" id="Stroke-6" fill="#AAAAAA" fill-rule="nonzero"></path>
        <path d="M136.037037,212.962963 C135.484752,212.962963 135.037037,212.515248 135.037037,211.962963 L135.037037,186.037037 C135.037037,185.484752 135.484752,185.037037 136.037037,185.037037 L161.962963,185.037037 C162.515248,185.037037 162.962963,185.484752 162.962963,186.037037 L162.962963,211.962963 C162.962963,212.515248 162.515248,212.962963 161.962963,212.962963 L136.037037,212.962963 Z M160.962963,210.962963 L160.962963,187.037037 L137.037037,187.037037 L137.037037,210.962963 L160.962963,210.962963 Z" id="Stroke-8" fill="#AAAAAA" fill-rule="nonzero"></path>
        <path d="M136.037037,175.925926 C135.484752,175.925926 135.037037,175.478211 135.037037,174.925926 L135.037037,149 C135.037037,148.447715 135.484752,148 136.037037,148 L161.962963,148 C162.515248,148 162.962963,148.447715 162.962963,149 L162.962963,174.925926 C162.962963,175.478211 162.515248,175.925926 161.962963,175.925926 L136.037037,175.925926 Z M160.962963,173.925926 L160.962963,150 L137.037037,150 L137.037037,173.925926 L160.962963,173.925926 Z" id="Stroke-10" fill="#AAAAAA" fill-rule="nonzero"></path>
        <path d="M173.074074,212.962963 C172.521789,212.962963 172.074074,212.515248 172.074074,211.962963 L172.074074,186.037037 C172.074074,185.484752 172.521789,185.037037 173.074074,185.037037 L199,185.037037 C199.552285,185.037037 200,185.484752 200,186.037037 L200,211.962963 C200,212.515248 199.552285,212.962963 199,212.962963 L173.074074,212.962963 Z M198,210.962963 L198,187.037037 L174.074074,187.037037 L174.074074,210.962963 L198,210.962963 Z" id="Stroke-11" fill="#AAAAAA" fill-rule="nonzero"></path>
        <path d="M153.045003,196.038238 C153.65799,195.480978 154.606662,195.526153 155.163922,196.139139 C155.721183,196.752125 155.676008,197.700798 155.063022,198.258058 L149.758238,203.080589 C149.186106,203.600709 148.312351,203.600709 147.740219,203.080589 L142.435435,198.258058 C141.822449,197.700798 141.777274,196.752125 142.334534,196.139139 C142.891795,195.526153 143.840467,195.480978 144.453454,196.038238 L148.749228,199.943488 L153.045003,196.038238 Z" id="Stroke-14" fill="#3F3F3F" fill-rule="nonzero"></path>
        <path d="M115.117626,203.045003 C115.674887,203.65799 115.629712,204.606662 115.016725,205.163922 C114.403739,205.721183 113.455066,205.676008 112.897806,205.063022 L108.075275,199.758238 C107.555155,199.186106 107.555155,198.312351 108.075275,197.740219 L112.897806,192.435435 C113.455066,191.822449 114.403739,191.777274 115.016725,192.334534 C115.629712,192.891795 115.674887,193.840467 115.117626,194.453454 L111.212376,198.749228 L115.117626,203.045003 Z" id="Stroke-15" fill="#3F3F3F" fill-rule="nonzero"></path>
        <path d="M184.001201,194.453454 C183.443941,193.840467 183.489115,192.891795 184.102102,192.334534 C184.715088,191.777274 185.663761,191.822449 186.221021,192.435435 L191.043552,197.740219 C191.563672,198.312351 191.563672,199.186106 191.043552,199.758238 L186.221021,205.063022 C185.663761,205.676008 184.715088,205.721183 184.102102,205.163922 C183.489115,204.606662 183.443941,203.65799 184.001201,203.045003 L187.906451,198.749228 L184.001201,194.453454 Z" id="Stroke-16" fill="#3F3F3F" fill-rule="nonzero"></path>
        <path d="M144.453454,166.043552 C143.840467,166.600812 142.891795,166.555638 142.334534,165.942651 C141.777274,165.329665 141.822449,164.380992 142.435435,163.823732 L147.740219,159.001201 C148.312351,158.481081 149.186106,158.481081 149.758238,159.001201 L155.063022,163.823732 C155.676008,164.380992 155.721183,165.329665 155.163922,165.942651 C154.606662,166.555638 153.65799,166.600812 153.045003,166.043552 L148.749228,162.138302 L144.453454,166.043552 Z" id="Stroke-13" fill="#3F3F3F" fill-rule="nonzero"></path>
        <g id="Group" transform="translate(218.500000, 150.500000)" fill-rule="nonzero">
            <path d="M10,18 C14.418278,18 18,14.418278 18,10 C18,5.581722 14.418278,2 10,2 C5.581722,2 2,5.581722 2,10 C2,14.418278 5.581722,18 10,18 Z M10,20 C4.4771525,20 0,15.5228475 0,10 C0,4.4771525 4.4771525,0 10,0 C15.5228475,0 20,4.4771525 20,10 C20,15.5228475 15.5228475,20 10,20 Z" id="Oval" fill="#2455F0"></path>
            <path d="M10,18 C14.418278,18 18,14.418278 18,10 C18,5.581722 14.418278,2 10,2 C5.581722,2 2,5.581722 2,10 C2,14.418278 5.581722,18 10,18 Z" id="Path" fill-opacity="0.75" fill="#0054FF"></path>
        </g>
        <g id="Cursor" transform="translate(232.000000, 163.000000)" fill="#AAAAAA" fill-rule="nonzero">
            <path d="M18.5495709,40.7398682 C17.7577664,42.2296972 15.5905808,42.1300869 14.9387799,40.5739056 L-1.57202815,1.15418338 C-2.26408281,-0.49810415 -0.601865953,-2.15700269 1.04903534,-1.46164764 L40.3592677,15.0957135 C41.9104481,15.7490664 42.0100723,17.9094547 40.5256046,18.7027935 L26.1898602,26.3641946 L18.5495709,40.7398682 Z M4.00919002,4.125497 L16.9979214,35.1362252 L22.9436978,23.9488818 C23.1301165,23.5981235 23.4167598,23.3108203 23.7670884,23.1235954 L34.938982,17.1530398 L4.00919002,4.125497 Z" id="Stroke-2"></path>
            <path d="M24.5779075,27.4062905 C23.8012347,26.6208905 23.8083095,25.3545803 24.5937095,24.5779075 C25.3791095,23.8012347 26.6454197,23.8083095 27.4220925,24.5937095 L49.0501763,46.4648206 C49.8268491,47.2502206 49.8197743,48.5165308 49.0343743,49.2932036 C48.2489743,50.0698764 46.9826641,50.0628016 46.2059913,49.2774016 L24.5779075,27.4062905 Z" id="Stroke-4"></path>
        </g>
    </g>
</svg>`},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(6),o=n(1),a=n(3);n(53);class s extends o.LitElement{constructor(){super(...arguments),this.link="/"}_tutorialClicked(){this.dispatchEvent(new CustomEvent("tutorial",{bubbles:!0,composed:!0}));const e=document.querySelector("acc-tutorial");e&&e.setAttribute("open","true")}focus(){this.shadowRoot.querySelector("#tutorial").focus()}_aboutClicked(){this.dispatchEvent(new CustomEvent("about",{bubbles:!0,composed:!0}))}_render(){return o.html`
            <style>
                :host {

                }

                #tutorial {
                    font-family: ${i.bodyFontFamily};
                    font-size: 18px;
                    color: ${i.labelColor};
                    padding: 15px 0;
                    border: none;
                    width: 100%;
                    background-color: transparent;
                    text-align: left;
                    cursor: pointer;
                }

                acc-icon {
                    float: right;
                    display: inline-block;
                }

            </style>
            <acc-group label="Learn More">
               <acc-link label="About" on-click=${this._aboutClicked.bind(this)} external path="${this.link}"></acc-link>
               <button tabindex="0" on-click=${this._tutorialClicked.bind(this)} id="tutorial">Tutorial</button>
            </acc-group>
        `}}r([a.property({type:String})],s.prototype,"link",void 0),t.LearnMoreGroup=s,customElements.define("acc-learn-more-group",s)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),o=n(3);class a extends i.LitElement{constructor(){super(...arguments),this.video="",this.image="",this.caption="",this.alt=""}_propertiesChanged(e,t,n){""===e.alt&&console.warn("slide image needs alt text"),super._propertiesChanged(e,t,n)}_render(e){return i.html`<slot></slot>`}}r([o.property({type:String})],a.prototype,"video",void 0),r([o.property({type:String})],a.prototype,"image",void 0),r([o.property({type:String})],a.prototype,"caption",void 0),r([o.property({type:String})],a.prototype,"alt",void 0),t.SlideElement=a,customElements.define("acc-slide",a)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(6),o=n(1),a=n(3),s=n(14);class u extends s.AbstractModalElement{constructor(){super(),this.label="Creatability Project",this.subtitle="subtitle goes here",this.image="",this.alt="",this.closable=!1,this.priority=1,this.exclusive=!0}set badges(e){const t=document.createElement("div");t.innerHTML=e,this._badges=t,this.requestRender()}_firstRendered(){this.setAttribute("open","true")}_propertiesChanged(e,t,n){""===e.alt&&console.warn("splash image needs alt text"),super._propertiesChanged(e,t,n)}_startPlaying(){this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("start")),this._unmute()}_unmute(){const e=document.querySelector("acc-quiet-group");e&&e.start()}_startHowTo(){const e=document.querySelector("acc-tutorial");this.dispatchEvent(new CustomEvent("tutorial")),e&&e.setAttribute("open","true"),this.removeAttribute("open"),this._unmute()}_renderModalBody(){const e=o.html`
            <div id="mobile-content">
                This experiment hasnâ€™t been optimized for all phones and smaller devices. 
                For the best experience, visit it on Chrome on desktop. 
                Or if you want, <a on-click="${this._startPlaying.bind(this)}" href="#">give it a try and start playing.</a>
            </div>
        `,t=window.screen.width<600||window.screen.height<600,n=o.html`
            <div id="splash-content">
                <img src="${this.image}" alt="${this.alt}">
                <h1>${this.label}</h1>
                <p>${this.subtitle}</p>
                <p id="buttons">
                    <button on-click="${this._startPlaying.bind(this)}">Start Playing</button>
                    <button on-click="${this._startHowTo.bind(this)}">Tutorial</button>
                </p>
                <p id="byline">
                    <slot></slot>
                </p>
            </div>
            <footer>
                <div id="badges" role="img" aria-label="This is an ai experiment. Made with some friends at Google.">
                ${this._badges?o.html`${this._badges}`:o.html`<acc-icon icon="badges" aria-hidden="true"></acc-icon>`}   
                </div>
                <div id="tands">
                    <a href="https://policies.google.com/privacy" target="_blank">Privacy</a> 
                    &amp; 
                    <a href="https://policies.google.com/terms" target="_blank">Terms</a>
                </div>
            </footer>

        `;return o.html`
            <style>
                :host {
                    z-index: 10;
                    font-family: ${i.bodyFontFamily};
                    font-size: 14px;
                }

                :host([dark]), [dark]{
                    --background-color: black;
                }

                #content {
                    background-color: var(--background-color);
                    position: absolute;
                    width: 100%;
                    height: 100%;
                    top: 0px;
                    left: 0px;
                    display: block;
                    overflow: none;
                }

                #splash-content {
                    position: absolute;
                    transform: translate(-50%, -50%);
                    top: 45%;
                    left: 50%;
                    width: 700px;
                    height: 580px;
                    max-width: 100%;
                }

                #mobile-content {
                    position: absolute;
                    transform: translate(-50%, -50%);
                    top: 50%;
                    left: 50%;
                    width: 300px;
                    max-width: 100%;
                    font-size: 16px;
                }

                @media only screen and (max-height: 650px) {

                    :host {
                        font-size: 13px;
                    }

                    #splash-content {
                        top: 0px;
                        transform: translate(-50%, 0);
                    }

                    #badges {
                        width: 220px!important;
                    }

                    img {
                        height: 100px!important;
                    }
                }

                img {
                    display: block;
                    margin: 0 auto;
                    height: 153px;
                    width: auto;
                }

                h1 {
                    font-family: ${i.titleFontFamily};
                    font-weight: 700;
                    margin: 0;
                    padding: 0;
                    text-align: center;
                    font-size: 5.8em;
                }

                p {
                    max-width: 540px;
                    min-width: 320px;
                    width: 90%;
                    margin: 30px auto 40px auto;
                    text-align: center;
                    font-size: 1.5em;
                    line-height: 1.4em;
                }



                a, a:visited, ::slotted(a), ::slotted(a:visited){
                    color: ${i.accentColor};
                }

                #byline {
                    font-size: 15px;
                    line-height: 24px;
                    max-width: 420px;
                }

                button {
                    width: 150px;
                    height: 50px;
                    display: inline-block;
                    border: none;
                    color: white;
                    font-size: 0.8em;
                    font-family: ${i.bodyFontFamily};
                    cursor: pointer;
                    font-weight: bold;
                }

                :host([dark]) button, [dark] button{
                    color: black;
                }

                :host([dark]) button:nth-child(1), [dark] button:nth-child(1) {
                    background-color: #5FB95D;
                }

                button:nth-child(1) {
                    background-color: #0D8700;
                }

                button:nth-child(1){
                    margin-right: 10px;
                }

                button:nth-child(2){
                    margin-left: 10px;
                    background-color: ${i.accentColor};
                }

                footer {
                    position: absolute;
                    bottom: 0;
                    width: 100%;
                    height: 100px;
                }

                #tands {
                    position: absolute;
                    bottom: 15px;
                    right: 15px;
                }

                #tands a {
                    color: var(--label-color);
                    text-decoration: none;
                }

                #badges {
                    position: absolute;
                    left: 15px;
                    bottom: 15px;
                    width: 260px;
                    --fill-color: #444;
                }
                :host([dark]) #badges, [dark] #badges {
                    --fill-color: white;
                }

            </style>
            <div id="content">
                ${t?e:n}
            </div>
        `}}r([a.property({type:String})],u.prototype,"label",void 0),r([a.property({type:String})],u.prototype,"subtitle",void 0),r([a.property({type:String})],u.prototype,"image",void 0),r([a.property({type:String})],u.prototype,"alt",void 0),t.SplashScreen=u,customElements.define("acc-splash",u)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(6),o=n(1),a=n(3),s=n(53);class u extends s.GroupElement{constructor(){super(),this.label="Keyboard Shortcuts"}_render({label:e,shortcut:t}){return o.html`
            <style>
                :host {

                }

                ul {
                    list-style: none;
                    padding: 0px;
                    margin: 0px;
                }

                #hidden {
                    height: 0px;
                    overflow: hidden;
                    width: 100%;
                }

            </style>
            <acc-group shortcut="${t}" label="${e}">
                <div id="hidden">
                    To activate these key commands, screen reader quick navigation 
                    features should be turned off. If you are using JAWS you will 
                    have to turn off Virtual PC Cursor (insert+z). If you are using NVDA, 
                    turn Browse Mode off (insert or caps lock + spacebar). 
                    If you are using VoiceOver, turn off Quick Nav (left+right arrow).
                </div>
                <ul>
                    <slot></slot>
                </ul>
            </acc-group>
        `}}t.ShortcutGroup=u;class c extends o.LitElement{constructor(){super(...arguments),this.key="",this.command=""}_render(){return o.html`
            <style>
                :host {
                    font-family: ${i.bodyFontFamily};
                    color: ${i.labelColor};
                    line-height: 30px;
                }

                #command {
                    font-weight: bold;
                }

                #key {
                    font-style: italic;
                }

            </style>
            <li>
                <span id="command">${this.command}:</span>
                <span id="key">${this.key}</span>
            </li>
        `}}r([a.property({type:String})],c.prototype,"key",void 0),r([a.property({type:String})],c.prototype,"command",void 0),t.ShortcutItem=c,customElements.define("acc-shortcut-item",c),customElements.define("acc-shortcut-group",u)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(20),o=n(8),a=n(1),s=n(36),u=n(3),c=n(27),l=e=>e&&"function"==typeof e.focus,h=e=>"object"==typeof e.canvas&&"function"==typeof e.canvas.getContext;class d extends a.LitElement{constructor(){super(),this.inputSelector="acc-input-mode-select",this.grayscale=!1,this.webcam=!1,this.webcamOpacity=1,this.mounted=!1,this.disabled=!1,this.shortcut="",this.__nodesObserver=new s.FlattenedNodesObserver(this,e=>{e.addedNodes.forEach(e=>this._onAddNode(e))})}set inputElement(e){this.__inputElement&&this.__inputElement.removeEventListener("tick",this._onTick),this.__inputElement=e,!this.disabled&&this.__inputElement&&this.__inputElement.addEventListener("tick",this._onTick)}get inputElement(){return this.__inputElement||(this.inputElement=document.querySelector(this.inputSelector)),this.__inputElement}connectedCallback(){const e=()=>{this.inputElement||setTimeout(e,10)};e(),this.__shortcutObserver=new i.KeyboardShortcutObserver(this.shortcut,this._handleShortcut,"content focus"),window.addEventListener("resize",this._onResize),super.connectedCallback()}disconnectedCallback(){this.__shortcutObserver.disconnect(),window.removeEventListener("resize",this._onResize),super.disconnectedCallback()}_handleShortcut(){for(let e of this.children)if(l(e))return void e.focus();this.focus(),this.dispatchEvent(new CustomEvent("shortcut"))}_propertiesChanged(e,t,n){if(t)return void 0!==t.shortcut&&this.__shortcutObserver&&(this.__shortcutObserver.pattern=this.shortcut),o.setBooleanAttribute(this,"grayscale",e.grayscale),o.setBooleanAttribute(this,"webcam",e.webcam),o.setBooleanAttribute(this,"mounted",e.mounted),o.setBooleanAttribute(this,"disabled",e.disabled),e.disabled!==n.disabled&&(e.disabled&&this.__inputElement?this.__inputElement.removeEventListener("tick",this._onTick):this.__inputElement&&this.__inputElement.addEventListener("tick",this._onTick)),super._propertiesChanged(e,t,n)}_onResize(){const e=this.shadowRoot.querySelector(".wrapper");e.style.height=`${window.innerHeight}px`,e.style.width=this.__calcWidth(),this._updateWebcamCanvas(),this.dispatchEvent(new CustomEvent("resize",{bubbles:!1}))}_onTick(e){const t=e.target,{__bgCtx:n}=this;if(h(t)){if(0===n.canvas.width){const e=this.clientWidth,t=this.clientHeight;if(0===e||0===t)return;n.canvas.width=e,n.canvas.height=t}const e=o.scaleToFill(t.canvas.width,t.canvas.height,n.canvas.width,n.canvas.height);n.drawImage(t.canvas,e.left,e.top,e.width,e.height)}else n.clearRect(0,0,n.canvas.width,n.canvas.height)}_onAddNode(e){if(o.isElement(e)&&"CANVAS"===e.tagName){const t=e;t.contentEditable="true",t.tabIndex=0}}__calcWidth(){let e="";if(this.mounted){const t=document.querySelector("acc-side-panel");e=t?`${window.innerWidth-t.clientWidth}px`:"100%"}else e="inherit";return e}_didRender(e,t,n){return this.childNodes.forEach(e=>this._onAddNode(e)),this._updateWebcamCanvas(),super._didRender(e,t,n)}_render({mounted:e,webcamOpacity:t}){return a.html`<style>
                :host {
                    display: block;
                    position:relative;
                    overflow: hidden;
                }

                :host([mounted]) {
                    position: absolute;
                    top: 0;
                    right: 0;
                    height: 100%;
                    /*min-width: calc(100% - 300px);*/
                }

                :host([grayscale]) .webcam-canvas {
                    filter: grayscale(100%);
                }

                .webcam-canvas {
                }

                .slot-container {
                    position: absolute;
                    top: 0;
                    left: 0;
                    width: 100%;
                    height: 100%;
                }

            </style>
            <div class="wrapper" style="width: ${this.__calcWidth()}; height: ${window.innerHeight}px;" role="section" arial-label="${e?"right content":"content"}">
                <canvas class="webcam-canvas" style="opacity: ${t};"></canvas>
                <div class="slot-container">
                    <slot></slot>
                </div>
            </div>`}_updateWebcamCanvas(){const e=this.shadowRoot.querySelector(".webcam-canvas");e.width=this.clientWidth,e.height=this.clientHeight,this.__bgCtx=e.getContext("2d")}}r([u.property({type:String})],d.prototype,"inputSelector",void 0),r([u.property({type:Boolean})],d.prototype,"grayscale",void 0),r([u.property({type:Boolean})],d.prototype,"webcam",void 0),r([u.property({type:Number})],d.prototype,"webcamOpacity",void 0),r([u.property({type:Boolean})],d.prototype,"mounted",void 0),r([u.property({type:Boolean})],d.prototype,"disabled",void 0),r([u.property({type:String})],d.prototype,"shortcut",void 0),r([c.default],d.prototype,"_handleShortcut",null),r([c.default],d.prototype,"_onResize",null),r([c.default],d.prototype,"_onTick",null),t.ContentElement=d,customElements.define("acc-content",d)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(6),o=n(1),a=n(14),s=n(3);n(95);const u=(e,t)=>{const n={},r=document.createElement("div");r.style.display="none",Object.assign(r.style,t),e.appendChild(r);const i=window.getComputedStyle(r);for(let e in t)n[e]=i[e];return r.parentElement&&r.parentElement.removeChild(r),n},c=(e,t)=>e.map((e,n)=>o.html`<acc-item value="${e}" selected?=${e===t} label=${e}></option>`),l=e=>e&&void 0!==e.host;class h extends a.AbstractModalElement{constructor(){super(),this.amplification=1,this.smoothing=0,this.parts=[],this.imageScaleFactor=.5,this.inputSelector="acc-pose-input",this.__accentColor="white",this.__centerColor="white",this._onTick=this._onTick.bind(this)}focusHeader(){const e=this.shadowRoot.querySelector("#header");e&&e.focus()}_onTick(e){if(!this.__ctx||!this.__content)return;const{__ctx:t}=this,n=e.target;t.canvas.width=this.__content.clientWidth,t.canvas.height=this.__content.clientHeight,t.lineWidth=1,n.renderInputData(t),n.renderCenter(t,this.__centerColor),n.renderCursor(t,this.__accentColor)}_propertiesChanged(e,t,n){return t&&"boolean"==typeof t.open&&(t.open&&this.inputElement?this.inputElement.addEventListener("tick",this._onTick):this.inputElement&&this.inputElement.removeEventListener("tick",this._onTick)),super._propertiesChanged(e,t,n)}_firstRendered(){setTimeout(()=>{const{backgroundColor:e,color:t}=u(this.shadowRoot,{backgroundColor:i.accentColor,color:i.labelColor});this.__accentColor=e,this.__centerColor=t,this.inputElement=document.querySelector(this.inputSelector),this.inputElement&&this.open&&this.inputElement.addEventListener("tick",this._onTick)},16),super._firstRendered()}_didRender(e,t,n){const r=this.shadowRoot.querySelector("acc-content");r&&l(this.parentNode)&&(this.__content=r,r.inputElement=this.parentNode.host);const i=this.shadowRoot.querySelector("#input-visualization");if(t&&t.amplification){const e=this.shadowRoot.querySelector("acc-range");e&&e.focus()}if(i)return this.__ctx=i.getContext("2d"),super._didRender(e,t,n)}_renderModalBody(e){const t=this,n=(e="change",n=!1)=>{t.dispatchEvent(new CustomEvent(e,{detail:{target:t,part:t.part,amplification:t.amplification,imageScaleFactor:t.imageScaleFactor,smoothing:t.smoothing},composed:n,bubbles:n}))};return o.html`
            <style>


                @media ( max-height: 640px ) {
                    acc-content {
                        width: 320px;
                        height: 240px;
                    }
                }

                @media ( min-height: 641px ) and ( max-height: 760px ) {
                    acc-content {
                        width: 480px;
                        height: 360px;
                    }

                    #modal-body {
                    }
                }

                @media( min-height: 760px ) {
                    acc-content {
                        width: 640px;
                        height: 480px;
                    }
                }
                :host {
                    font-family: ${i.bodyFontFamily};
                }

                .container {
                    background-color: ${i.backgroundColor};
                    text-align: center;
                }


                acc-content {
                    background-color: white;
                    margin: 20px auto;
                }

                h2 {
                    font-family: ${i.bodyFontFamily};
                    color: ${i.labelColor};
                    display: inline-block;
                }

                h4 {
                    display: inline-block;
                }

                :host() * {
                }

                :host([debug]) .controls-row,
                :host([debug]) .controls-row-item,
                *[debug] .controls-row,
                *[debug] .controls-row-item {
                    border: 1px solid red;
                }

                .inner-container {
                    position: relative;
                    top: 50%;
                    width: auto;
                    transform: translate(0, -50%);
                }

                .controls-row {
                    display: flex;
                    flex-direction: row;
                    flex-wrap: wrap;
                    max-width: 960px;
                    margin: 0 auto;
                    padding: 8px;
                }

                .box {
                    box-sizing: border-box;
                    border: 1px solid black;
                }

                .controls-row-item {
                    align-self: baseline;
                    display: inline-flex;
                    order: 1;
                    flex-basis: auto;
                    flex-grow: 1;
                    flex-shrink: 1;
                    text-align: center;
                }


                a.reset-centerpoint {
                    font-family: ${i.bodyFontFamily};
                    color: ${i.accentColor};
                    text-decoration: none;
                    font-weight: 700;
                }

                .amp-value {
                    color: ${i.labelColor};
                    padding-left: 8px;
                    min-width: 24px;
                }

                .done {
                    --background-color: ${i.accentColor}:
                    --accent-color: ${i.backgroundColor};
                    width: 100px;
                }

                *[inline] .centerpoint-buttons {
                    display: flex;
                    flex-direction: row;
                    flex-shrink: 1;
                    flex-basis: auto;
                }

                .centerpoint-button {
                    padding: 0 8px;
                    display: inline-block;
                    width: auto;
                    --button-label-color: ${i.accentColor};

                    --button-border-width: 0;
                    font-weight: bold;
                    font-size: 14px;
                }
                label {
                    font-weight: bold;
                }

                .help-container {
                    cursor: pointer;
                    position: absolute;
                    top: 16px;
                    right: 16px;
                    font-size: 18px;
                    color: ${i.accentColor};
                    font-weight: bold;
                    width: 80px;
                    text-align: right;
                    background: transparent;
                    border: 0;
                }

                .help-container svg {
                    position: absolute;
                    top: 0;
                    left: 0;
                }

                .help-container span {
                    position: relative;
                    top: 50%;
                    transform: translate(0, -50%);
                }

                #help-question-mark {
                    fill: ${i.accentColor};
                }

                .control-pairing {
                    display: inline-flex;
                    flex-direction: row;
                    align-items: baseline;
                    margin: auto;
                }

                .control-pairing label {
                    flex-direction: row;
                    flex-basis: auto;
                }


                .centerpoint-buttons {
                    flex-direction: row;
                    flex-basis: auto;
                }

                .centerpoint-divider {
                    align-items: baseline;
                }

                #part {
                    margin: auto;
                }


                .close {
                    margin: 40px auto;
                    --button-background-color: ${i.accentColor};
                    --button-label-color: ${i.backgroundColor};
                    --button-border-color: ${i.accentColor};

                    text-align: right;
                    width: 150px;
                }

            </style>
            <div class="inner-container">
                <h2 id="header" tabindex="0">Body Tracking Settings</h2>
                <acc-content id="content-container" grayscale webcamopacity="0.5" disabled?=${!e.open}>
                    <canvas id="input-visualization" width="640" height="480">
                        Visualization of body tracking data.
                    </canvas>
                </acc-content>
                <div class="controls-row">
                    <div class="controls-row-item">
                        <acc-select label="Body Part:" id="part" on-change=${function(e){const r=e.detail.value;"part"===this.id&&(t.part=r),console.log("self.part: "+t.part),n()}} inline>
                            ${c(this.parts,this.part)}
                        </acc-select>
                    </div>
                    <div class="controls-row-item">
                        <div class="control-pairing">
                            <acc-range
                                min="1"
                                max="6"
                                step="0.1"
                                label="Amplification:"
                                value="${this.amplification}"
                                on-input="${function(e){t.amplification=parseFloat(this.value),n();const r=t.shadowRoot.querySelector(".amp-value");r&&(r.innerHTML=`${t.amplification.toFixed(1)}x`)}}"
                                inline></acc-range>
                            <span class="amp-value">${this.amplification.toFixed(1)}x</span>
                        </div>
                    </div>
                    <div class="controls-row-item">
                        <div class="control-pairing">
                            <label style="font-size: 18px;">Centerpoint:</label>
                            <span class="centerpoint-buttons">
                                <acc-button
                                    class="centerpoint-button"
                                    label="Use current position"
                                    on-click=${()=>n("center",!0)}></acc-button>
                                    <span class="centerpoint-divider"> | </span>
                                <acc-button
                                    class="centerpoint-button"
                                    label="Reset"
                                    on-click=${()=>n("resetcenter",!0)}></acc-button>
                            </span>
                        </div>
                    </div>
                </div>
                <acc-button class="close" label="Done" on-click=${()=>this._handleCloseClick()}></acc-button>
            </div>
            <button class="help-container" role="button" on-click=${()=>n("help")}>
                <svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                    <path id="help-question-mark" d="M12,2 C6.48,2 2,6.48 2,12 C2,17.52 6.48,22 12,22 C17.52,22 22,17.52 22,12 C22,6.48 17.52,2 12,2 L12,2 Z M13,19 L11,19 L11,17 L13,17 L13,19 L13,19 Z M15.07,11.25 L14.17,12.17 C13.45,12.9 13,13.5 13,15 L11,15 L11,14.5 C11,13.4 11.45,12.4 12.17,11.67 L13.41,10.41 C13.78,10.05 14,9.55 14,9 C14,7.9 13.1,7 12,7 C10.9,7 10,7.9 10,9 L8,9 C8,6.79 9.79,5 12,5 C14.21,5 16,6.79 16,9 C16,9.88 15.64,10.68 15.07,11.25 L15.07,11.25 Z" id="Shape" fill="#000000"></path>
                </svg>
                Help
            </button>
        `}_shouldRender(e,t,n){if(!t)return super._shouldRender(e,t,n);const r=Object.keys(t);return!(1===r.length&&t.amplification||r.length<3&&t.part&&t.amplification)&&super._shouldRender(e,t,n)}}r([s.property({type:Number})],h.prototype,"amplification",void 0),r([s.property({type:Number})],h.prototype,"smoothing",void 0),r([s.property({type:String})],h.prototype,"part",void 0),r([s.property({type:Array})],h.prototype,"parts",void 0),r([s.property({type:Number})],h.prototype,"imageScaleFactor",void 0),r([s.property({type:String})],h.prototype,"inputSelector",void 0),customElements.define("acc-pose-input-calibration",h)},function(e,t,n){"use strict";(function(e,r){function i(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var o=n(4),a=n(19),s=o.Buffer,u=o.kMaxLength,c=e.crypto||e.msCrypto,l=Math.pow(2,32)-1;function h(e,t){if("number"!=typeof e||e!=e)throw new TypeError("offset must be a number");if(e>l||e<0)throw new TypeError("offset must be a uint32");if(e>u||e>t)throw new RangeError("offset out of range")}function d(e,t,n){if("number"!=typeof e||e!=e)throw new TypeError("size must be a number");if(e>l||e<0)throw new TypeError("size must be a uint32");if(e+t>n||e>u)throw new RangeError("buffer too small")}function f(e,t,n,i){if(r.browser){var o=e.buffer,s=new Uint8Array(o,t,n);return c.getRandomValues(s),i?void r.nextTick(function(){i(null,e)}):e}if(!i)return a(n).copy(e,t),e;a(n,function(n,r){if(n)return i(n);r.copy(e,t),i(null,e)})}c&&c.getRandomValues||!r.browser?(t.randomFill=function(t,n,r,i){if(!(s.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof n)i=n,n=0,r=t.length;else if("function"==typeof r)i=r,r=t.length-n;else if("function"!=typeof i)throw new TypeError('"cb" argument must be a function');return h(n,t.length),d(r,n,t.length),f(t,n,r,i)},t.randomFillSync=function(t,n,r){void 0===n&&(n=0);if(!(s.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');h(n,t.length),void 0===r&&(r=t.length-n);return d(r,n,t.length),f(t,n,r)}):(t.randomFill=i,t.randomFillSync=i)}).call(this,n(11),n(12))},function(e,t,n){(function(t){var r=n(28),i=n(60),o=n(59),a=n(7),s=n(39),u=n(26),c=n(58);e.exports=function(e,n,l){var h;h=e.padding?e.padding:l?1:4;var d,f=r(e),p=f.modulus.byteLength();if(n.length>p||new a(n).cmp(f.modulus)>=0)throw new Error("decryption error");d=l?c(new a(n),f):s(n,f);var m=new t(p-d.length);if(m.fill(0),d=t.concat([m,d],p),4===h)return function(e,n){e.modulus;var r=e.modulus.byteLength(),a=(n.length,u("sha1").update(new t("")).digest()),s=a.length;if(0!==n[0])throw new Error("decryption error");var c=n.slice(1,s+1),l=n.slice(s+1),h=o(c,i(l,s)),d=o(l,i(h,r-s-1));if(function(e,n){e=new t(e),n=new t(n);var r=0,i=e.length;e.length!==n.length&&(r++,i=Math.min(e.length,n.length));var o=-1;for(;++o<i;)r+=e[o]^n[o];return r}(a,d.slice(0,s)))throw new Error("decryption error");var f=s;for(;0===d[f];)f++;if(1!==d[f++])throw new Error("decryption error");return d.slice(f)}(f,d);if(1===h)return function(e,t,n){var r=t.slice(0,2),i=2,o=0;for(;0!==t[i++];)if(i>=t.length){o++;break}var a=t.slice(2,i-1);t.slice(i-1,i);("0002"!==r.toString("hex")&&!n||"0001"!==r.toString("hex")&&n)&&o++;a.length<8&&o++;if(o)throw new Error("decryption error");return t.slice(i)}(0,d,l);if(3===h)return d;throw new Error("unknown padding")}}).call(this,n(5).Buffer)},function(e,t,n){(function(t){var r=n(28),i=n(19),o=n(26),a=n(60),s=n(59),u=n(7),c=n(58),l=n(39);e.exports=function(e,n,h){var d;d=e.padding?e.padding:h?1:4;var f,p=r(e);if(4===d)f=function(e,n){var r=e.modulus.byteLength(),c=n.length,l=o("sha1").update(new t("")).digest(),h=l.length,d=2*h;if(c>r-d-2)throw new Error("message too long");var f=new t(r-c-d-2);f.fill(0);var p=r-h-1,m=i(h),g=s(t.concat([l,f,new t([1]),n],p),a(m,p)),b=s(m,a(g,h));return new u(t.concat([new t([0]),b,g],r))}(p,n);else if(1===d)f=function(e,n,r){var o,a=n.length,s=e.modulus.byteLength();if(a>s-11)throw new Error("message too long");r?(o=new t(s-a-3)).fill(255):o=function(e,n){var r,o=new t(e),a=0,s=i(2*e),u=0;for(;a<e;)u===s.length&&(s=i(2*e),u=0),(r=s[u++])&&(o[a++]=r);return o}(s-a-3);return new u(t.concat([new t([0,r?1:2]),o,new t([0]),n],s))}(p,n,h);else{if(3!==d)throw new Error("unknown padding");if((f=new u(n)).cmp(p.modulus)>=0)throw new Error("data too long for modulus")}return h?l(f,p):c(f,p)}}).call(this,n(5).Buffer)},function(e,t,n){t.publicEncrypt=n(110),t.privateDecrypt=n(109),t.privateEncrypt=function(e,n){return t.publicEncrypt(e,n,!0)},t.publicDecrypt=function(e,n){return t.privateDecrypt(e,n,!0)}},function(e,t,n){(function(t){var r=n(9),i=n(7);e.exports=function(e){return new a(e)};var o={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 a(e){this.curveType=o[e],this.curveType||(this.curveType={name:e}),this.curve=new r.ec(this.curveType.name),this.keys=void 0}function s(e,n,r){Array.isArray(e)||(e=e.toArray());var i=new t(e);if(r&&i.length<r){var o=new t(r-i.length);o.fill(0),i=t.concat([o,i])}return n?i.toString(n):i}o.p224=o.secp224r1,o.p256=o.secp256r1=o.prime256v1,o.p192=o.secp192r1=o.prime192v1,o.p384=o.secp384r1,o.p521=o.secp521r1,a.prototype.generateKeys=function(e,t){return this.keys=this.curve.genKeyPair(),this.getPublicKey(e,t)},a.prototype.computeSecret=function(e,n,r){return n=n||"utf8",t.isBuffer(e)||(e=new t(e,n)),s(this.curve.keyFromPublic(e).getPublic().mul(this.keys.getPrivate()).getX(),r,this.curveType.byteLength)},a.prototype.getPublicKey=function(e,t){var n=this.keys.getPublic("compressed"===t,!0);return"hybrid"===t&&(n[n.length-1]%2?n[0]=7:n[0]=6),s(n,e)},a.prototype.getPrivateKey=function(e){return s(this.keys.getPrivate(),e)},a.prototype.setPublicKey=function(e,n){return n=n||"utf8",t.isBuffer(e)||(e=new t(e,n)),this.keys._importPublic(e),this},a.prototype.setPrivateKey=function(e,n){n=n||"utf8",t.isBuffer(e)||(e=new t(e,n));var r=new i(e);return r=r.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(r),this}}).call(this,n(5).Buffer)},function(e,t,n){(function(t){var r=n(7),i=n(9).ec,o=n(28),a=n(61);function s(e,t){if(e.cmpn(0)<=0)throw new Error("invalid sig");if(e.cmp(t)>=t)throw new Error("invalid sig")}e.exports=function(e,n,u,c,l){var h=o(u);if("ec"===h.type){if("ecdsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");return function(e,t,n){var r=a[n.data.algorithm.curve.join(".")];if(!r)throw new Error("unknown curve "+n.data.algorithm.curve.join("."));var o=new i(r),s=n.data.subjectPrivateKey.data;return o.verify(t,e,s)}(e,n,h)}if("dsa"===h.type){if("dsa"!==c)throw new Error("wrong public key type");return function(e,t,n){var i=n.data.p,a=n.data.q,u=n.data.g,c=n.data.pub_key,l=o.signature.decode(e,"der"),h=l.s,d=l.r;s(h,a),s(d,a);var f=r.mont(i),p=h.invm(a);return 0===u.toRed(f).redPow(new r(t).mul(p).mod(a)).fromRed().mul(c.toRed(f).redPow(d.mul(p).mod(a)).fromRed()).mod(i).mod(a).cmp(d)}(e,n,h)}if("rsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");n=t.concat([l,n]);for(var d=h.modulus.byteLength(),f=[1],p=0;n.length+f.length+2<d;)f.push(255),p++;f.push(0);for(var m=-1;++m<n.length;)f.push(n[m]);f=new t(f);var g=r.mont(h.modulus);e=(e=new r(e).toRed(g)).redPow(new r(h.publicExponent)),e=new t(e.fromRed().toArray());var b=p<8?1:0;for(d=Math.min(e.length,f.length),e.length!==f.length&&(b=1),m=-1;++m<d;)b|=e[m]^f[m];return 0===b}}).call(this,n(5).Buffer)},function(e,t,n){(function(t){var r=/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,i=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----/m,o=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m,a=n(30),s=n(41);e.exports=function(e,n){var u,c=e.toString(),l=c.match(r);if(l){var h="aes"+l[1],d=new t(l[2],"hex"),f=new t(l[3].replace(/[\r\n]/g,""),"base64"),p=a(n,d.slice(0,8),parseInt(l[1],10)).key,m=[],g=s.createDecipheriv(h,p,d);m.push(g.update(f)),m.push(g.final()),u=t.concat(m)}else{var b=c.match(o);u=new t(b[2].replace(/[\r\n]/g,""),"base64")}return{tag:c.match(i)[1],data:u}}}).call(this,n(5).Buffer)},function(e){e.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(e,t,n){"use strict";var r=n(22),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())}),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)})}),h=r.define("Validity",function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))}),d=r.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),f=r.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int(),this.key("serialNumber").int(),this.key("signature").use(a),this.key("issuer").use(l),this.key("validity").use(h),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(d).optional())}),p=r.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(f),this.key("signatureAlgorithm").use(a),this.key("signatureValue").bitstr())});e.exports=p},function(e,t,n){var r=n(2),i=n(62);function o(e){i.call(this,e),this.enc="pem"}r(o,i),e.exports=o,o.prototype.encode=function(e,t){for(var n=i.prototype.encode.call(this,e).toString("base64"),r=["-----BEGIN "+t.label+"-----"],o=0;o<n.length;o+=64)r.push(n.slice(o,o+64));return r.push("-----END "+t.label+"-----"),r.join("\n")}},function(e,t,n){var r=t;r.der=n(62),r.pem=n(117)},function(e,t,n){var r=n(2),i=n(5).Buffer,o=n(63);function a(e){o.call(this,e),this.enc="pem"}r(a,o),e.exports=a,a.prototype.decode=function(e,t){for(var n=e.toString().split(/[\r\n]+/g),r=t.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,u=-1,c=0;c<n.length;c++){var l=n[c].match(a);if(null!==l&&l[2]===r){if(-1!==s){if("END"!==l[1])break;u=c;break}if("BEGIN"!==l[1])break;s=c}}if(-1===s||-1===u)throw new Error("PEM section not found for: "+r);var h=n.slice(s+1,u).join("");h.replace(/[^a-z0-9\+\/=]+/gi,"");var d=new i(h,"base64");return o.prototype.decode.call(this,d,t)}},function(e,t,n){var r=t;r.der=n(63),r.pem=n(119)},function(e,t,n){var r=n(64);t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=r._reverse(t.tagClass),t.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"},t.tagByName=r._reverse(t.tag)},function(e,t,n){var r=n(21).Reporter,i=n(21).EncoderBuffer,o=n(21).DecoderBuffer,a=n(10),s=["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"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function c(e,t){var n={};this._baseState=n,n.enc=e,n.parent=t||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())}e.exports=c;var l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];c.prototype.clone=function(){var e=this._baseState,t={};l.forEach(function(n){t[n]=e[n]});var n=new this.constructor(t.parent);return n._baseState=t,n},c.prototype._wrap=function(){var e=this._baseState;u.forEach(function(t){this[t]=function(){var n=new this.constructor(this);return e.children.push(n),n[t].apply(n,arguments)}},this)},c.prototype._init=function(e){var t=this._baseState;a(null===t.parent),e.call(this),t.children=t.children.filter(function(e){return e._baseState.parent===this},this),a.equal(t.children.length,1,"Root node can have only one child")},c.prototype._useArgs=function(e){var t=this._baseState,n=e.filter(function(e){return e instanceof this.constructor},this);e=e.filter(function(e){return!(e instanceof this.constructor)},this),0!==n.length&&(a(null===t.children),t.children=n,n.forEach(function(e){e._baseState.parent=this},this)),0!==e.length&&(a(null===t.args),t.args=e,t.reverseArgs=e.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach(function(n){n==(0|n)&&(n|=0);var r=e[n];t[r]=n}),t}))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach(function(e){c.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}}),s.forEach(function(e){c.prototype[e]=function(){var t=this._baseState,n=Array.prototype.slice.call(arguments);return a(null===t.tag),t.tag=e,this._useArgs(n),this}}),c.prototype.use=function(e){a(e);var t=this._baseState;return a(null===t.use),t.use=e,this},c.prototype.optional=function(){return this._baseState.optional=!0,this},c.prototype.def=function(e){var t=this._baseState;return a(null===t.default),t.default=e,t.optional=!0,this},c.prototype.explicit=function(e){var t=this._baseState;return a(null===t.explicit&&null===t.implicit),t.explicit=e,this},c.prototype.implicit=function(e){var t=this._baseState;return a(null===t.explicit&&null===t.implicit),t.implicit=e,this},c.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},c.prototype.key=function(e){var t=this._baseState;return a(null===t.key),t.key=e,this},c.prototype.any=function(){return this._baseState.any=!0,this},c.prototype.choice=function(e){var t=this._baseState;return a(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},c.prototype.contains=function(e){var t=this._baseState;return a(null===t.use),t.contains=e,this},c.prototype._decode=function(e,t){var n=this._baseState;if(null===n.parent)return e.wrapResult(n.children[0]._decode(e,t));var r,i=n.default,a=!0,s=null;if(null!==n.key&&(s=e.enterKey(n.key)),n.optional){var u=null;if(null!==n.explicit?u=n.explicit:null!==n.implicit?u=n.implicit:null!==n.tag&&(u=n.tag),null!==u||n.any){if(a=this._peekTag(e,u,n.any),e.isError(a))return a}else{var c=e.save();try{null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),a=!0}catch(e){a=!1}e.restore(c)}}if(n.obj&&a&&(r=e.enterObject()),a){if(null!==n.explicit){var l=this._decodeTag(e,n.explicit);if(e.isError(l))return l;e=l}var h=e.offset;if(null===n.use&&null===n.choice){if(n.any)c=e.save();var d=this._decodeTag(e,null!==n.implicit?n.implicit:n.tag,n.any);if(e.isError(d))return d;n.any?i=e.raw(c):e=d}if(t&&t.track&&null!==n.tag&&t.track(e.path(),h,e.length,"tagged"),t&&t.track&&null!==n.tag&&t.track(e.path(),e.offset,e.length,"content"),i=n.any?i:null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),e.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach(function(n){n._decode(e,t)}),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){var f=new o(i);i=this._getUse(n.contains,e._reporterState.obj)._decode(f,t)}}return n.obj&&a&&(i=e.leaveObject(r)),null===n.key||null===i&&!0!==a?null!==s&&e.exitKey(s):e.leaveKey(s,n.key,i),i},c.prototype._decodeGeneric=function(e,t,n){var r=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,r.args[0],n):/str$/.test(e)?this._decodeStr(t,e,n):"objid"===e&&r.args?this._decodeObjid(t,r.args[0],r.args[1],n):"objid"===e?this._decodeObjid(t,null,null,n):"gentime"===e||"utctime"===e?this._decodeTime(t,e,n):"null_"===e?this._decodeNull(t,n):"bool"===e?this._decodeBool(t,n):"objDesc"===e?this._decodeStr(t,e,n):"int"===e||"enum"===e?this._decodeInt(t,r.args&&r.args[0],n):null!==r.use?this._getUse(r.use,t._reporterState.obj)._decode(t,n):t.error("unknown tag: "+e)},c.prototype._getUse=function(e,t){var n=this._baseState;return n.useDecoder=this._use(e,t),a(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},c.prototype._decodeChoice=function(e,t){var n=this._baseState,r=null,i=!1;return Object.keys(n.choice).some(function(o){var a=e.save(),s=n.choice[o];try{var u=s._decode(e,t);if(e.isError(u))return!1;r={type:o,value:u},i=!0}catch(t){return e.restore(a),!1}return!0},this),i?r:e.error("Choice not matched")},c.prototype._createEncoderBuffer=function(e){return new i(e,this.reporter)},c.prototype._encode=function(e,t,n){var r=this._baseState;if(null===r.default||r.default!==e){var i=this._encodeValue(e,t,n);if(void 0!==i&&!this._skipDefault(i,t,n))return i}},c.prototype._encodeValue=function(e,t,n){var i=this._baseState;if(null===i.parent)return i.children[0]._encode(e,t||new r);var o=null;if(this.reporter=t,i.optional&&void 0===e){if(null===i.default)return;e=i.default}var a=null,s=!1;if(i.any)o=this._createEncoderBuffer(e);else if(i.choice)o=this._encodeChoice(e,t);else if(i.contains)a=this._getUse(i.contains,n)._encode(e,t),s=!0;else if(i.children)a=i.children.map(function(n){if("null_"===n._baseState.tag)return n._encode(null,t,e);if(null===n._baseState.key)return t.error("Child should have a key");var r=t.enterKey(n._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");var i=n._encode(e[n._baseState.key],t,e);return t.leaveKey(r),i},this).filter(function(e){return e}),a=this._createEncoderBuffer(a);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return t.error("Too many args for : "+i.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");var u=this.clone();u._baseState.implicit=null,a=this._createEncoderBuffer(e.map(function(n){var r=this._baseState;return this._getUse(r.args[0],e)._encode(n,t)},u))}else null!==i.use?o=this._getUse(i.use,n)._encode(e,t):(a=this._encodePrimitive(i.tag,e),s=!0);if(!i.any&&null===i.choice){var c=null!==i.implicit?i.implicit:i.tag,l=null===i.implicit?"universal":"context";null===c?null===i.use&&t.error("Tag could be omitted only for .use()"):null===i.use&&(o=this._encodeComposite(c,s,l,a))}return null!==i.explicit&&(o=this._encodeComposite(i.explicit,!1,"context",o)),o},c.prototype._encodeChoice=function(e,t){var n=this._baseState,r=n.choice[e.type];return r||a(!1,e.type+" not found in "+JSON.stringify(Object.keys(n.choice))),r._encode(e.value,t)},c.prototype._encodePrimitive=function(e,t){var n=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&n.args)return this._encodeObjid(t,n.reverseArgs[0],n.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,n.args&&n.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},c.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},c.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}},function(e,t,n){var r=n(2);function i(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function o(e,t){this.path=e,this.rethrow(t)}t.Reporter=i,i.prototype.isError=function(e){return e instanceof o},i.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},i.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},i.prototype.enterKey=function(e){return this._reporterState.path.push(e)},i.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},i.prototype.leaveKey=function(e,t,n){var r=this._reporterState;this.exitKey(e),null!==r.obj&&(r.obj[t]=n)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},i.prototype.leaveObject=function(e){var t=this._reporterState,n=t.obj;return t.obj=e,n},i.prototype.error=function(e){var t,n=this._reporterState,r=e instanceof o;if(t=r?e:new o(n.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),e.message||e,e.stack),!n.options.partial)throw t;return r||n.errors.push(t),t},i.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},r(o,Error),o.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},function(e,t){var n=[].indexOf;e.exports=function(e,t){if(n)return e.indexOf(t);for(var r=0;r<e.length;++r)if(e[r]===t)return r;return-1}},function(module,exports,__webpack_require__){var indexOf=__webpack_require__(124),Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var n in e)t.push(n);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n++)t(e[n],n,e)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(e,t,n){Object.defineProperty(e,t,{writable:!0,enumerable:!1,configurable:!0,value:n})}}catch(e){return function(e,t,n){e[t]=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(e){if(!(this instanceof Script))return new Script(e);this.code=e};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 t=Script.createContext(e),n=this.runInContext(t);return forEach(Object_keys(t),function(n){e[n]=t[n]}),n},forEach(Object_keys(Script.prototype),function(e){exports[e]=Script[e]=function(t){var n=Script(t);return n[e].apply(n,[].slice.call(arguments,1))}}),exports.createScript=function(e){return exports.Script(e)},exports.createContext=Script.createContext=function(e){var t=new Context;return"object"==typeof e&&forEach(Object_keys(e),function(n){t[n]=e[n]}),t}},function(e,t,n){var r=n(22),i=n(2);function o(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}t.define=function(e,t){return new o(e,t)},o.prototype._createNamed=function(e){var t;try{t=n(125).runInThisContext("(function "+this.name+"(entity) {\n  this._initNamed(entity);\n})")}catch(e){t=function(e){this._initNamed(e)}}return i(t,e),t.prototype._initNamed=function(t){e.call(this,t)},new t(this)},o.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(r.decoders[e])),this.decoders[e]},o.prototype.decode=function(e,t,n){return this._getDecoder(t).decode(e,n)},o.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(r.encoders[e])),this.encoders[e]},o.prototype.encode=function(e,t,n){return this._getEncoder(t).encode(e,n)}},function(e,t,n){"use strict";var r=n(22);t.certificate=n(116);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())});t.RSAPrivateKey=i;var o=r.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.RSAPublicKey=o;var a=r.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())});t.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())});t.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())});t.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())});t.DSAPrivateKey=l,t.DSAparam=r.define("DSAparam",function(){this.int()});var h=r.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(d),this.key("publicKey").optional().explicit(1).bitstr())});t.ECPrivateKey=h;var d=r.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});t.signature=r.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},function(e,t,n){"use strict";var r=n(7),i=n(9).utils,o=i.assert,a=i.cachedProperty,s=i.parseBytes;function u(e,t){this.eddsa=e,"object"!=typeof t&&(t=s(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),o(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof r&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.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()},e.exports=u},function(e,t,n){"use strict";var r=n(9).utils,i=r.assert,o=r.parseBytes,a=r.cachedProperty;function s(e,t){this.eddsa=e,this._secret=o(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=o(t.pub)}s.fromPublic=function(e,t){return t instanceof s?t:new s(e,{pub:t})},s.fromSecret=function(e,t){return t instanceof s?t:new s(e,{secret:t})},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 e=this.eddsa,t=this.hash(),n=e.encodingLength-1,r=t.slice(0,e.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(e){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},s.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},s.prototype.getSecret=function(e){return i(this._secret,"KeyPair is public only"),r.encode(this.secret(),e)},s.prototype.getPublic=function(e){return r.encode(this.pubBytes(),e)},e.exports=s},function(e,t,n){"use strict";var r=n(38),i=n(9),o=i.utils,a=o.assert,s=o.parseBytes,u=n(129),c=n(128);function l(e){if(a("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof l))return new l(e);e=i.curves[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=r.sha512}e.exports=l,l.prototype.sign=function(e,t){e=s(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),o=this.encodePoint(i),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),u=r.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:o})},l.prototype.verify=function(e,t,n){e=s(e),t=this.makeSignature(t);var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(o)},l.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return o.intFromLE(e.digest()).umod(this.curve.n)},l.prototype.keyFromPublic=function(e){return u.fromPublic(this,e)},l.prototype.keyFromSecret=function(e){return u.fromSecret(this,e)},l.prototype.makeSignature=function(e){return e instanceof c?e:new c(this,e)},l.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},l.prototype.decodePoint=function(e){var t=(e=o.parseBytes(e)).length-1,n=e.slice(0,t).concat(-129&e[t]),r=0!=(128&e[t]),i=o.intFromLE(n);return this.curve.pointFromY(i,r)},l.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},l.prototype.decodeInt=function(e){return o.intFromLE(e)},l.prototype.isPoint=function(e){return e instanceof this.pointClass}},function(e,t,n){"use strict";var r=n(7),i=n(9).utils,o=i.assert;function a(e,t){if(e instanceof a)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new r(e.r,16),this.s=new r(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function s(e,t){var n=e[t.place++];if(!(128&n))return n;for(var r=15&n,i=0,o=0,a=t.place;o<r;o++,a++)i<<=8,i|=e[a];return t.place=a,i}function u(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t<n;)t++;return 0===t?e:e.slice(t)}function c(e,t){if(t<128)e.push(t);else{var n=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}e.exports=a,a.prototype._importDER=function(e,t){e=i.toArray(e,t);var n=new function(){this.place=0};if(48!==e[n.place++])return!1;if(s(e,n)+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var o=s(e,n),a=e.slice(n.place,o+n.place);if(n.place+=o,2!==e[n.place++])return!1;var u=s(e,n);if(e.length!==u+n.place)return!1;var c=e.slice(n.place,u+n.place);return 0===a[0]&&128&a[1]&&(a=a.slice(1)),0===c[0]&&128&c[1]&&(c=c.slice(1)),this.r=new r(a),this.s=new r(c),this.recoveryParam=null,!0},a.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=u(t),n=u(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];c(r,t.length),(r=r.concat(t)).push(2),c(r,n.length);var o=r.concat(n),a=[48];return c(a,o.length),a=a.concat(o),i.encode(a,e)}},function(e,t,n){"use strict";var r=n(7),i=n(9).utils.assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=o,o.fromPublic=function(e,t,n){return t instanceof o?t:new o(e,{pub:t,pubEnc:n})},o.fromPrivate=function(e,t,n){return t instanceof o?t:new o(e,{priv:t,privEnc:n})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.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(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new r(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.mul(this.priv).getX()},o.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},function(e,t,n){"use strict";var r=n(38),i=n(69),o=n(10);function a(e){if(!(this instanceof a))return new a(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),n=i.toArray(e.nonce,e.nonceEnc||"hex"),r=i.toArray(e.pers,e.persEnc||"hex");o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}e.exports=a,a.prototype._init=function(e,t,n){var r=e.concat(t).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},a.prototype._hmac=function(){return new r.hmac(this.hash,this.K)},a.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},a.prototype.reseed=function(e,t,n,r){"string"!=typeof t&&(r=n,n=t,t=null),e=i.toArray(e,t),n=i.toArray(n,r),o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},a.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(r=n,n=t,t=null),n&&(n=i.toArray(n,r||"hex"),this._update(n));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var a=o.slice(0,e);return this._update(n),this._reseed++,i.encode(a,t)}},function(e,t,n){"use strict";var r=n(7),i=n(133),o=n(9),a=o.utils.assert,s=n(132),u=n(131);function c(e){if(!(this instanceof c))return new c(e);"string"==typeof e&&(a(o.curves.hasOwnProperty(e),"Unknown curve "+e),e=o.curves[e]),e instanceof o.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=c,c.prototype.keyPair=function(e){return new s(this,e)},c.prototype.keyFromPrivate=function(e,t){return s.fromPrivate(this,e,t)},c.prototype.keyFromPublic=function(e,t){return s.fromPublic(this,e,t)},c.prototype.genKeyPair=function(e){e||(e={});for(var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||o.rand(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),a=this.n.sub(new r(2));;){var s=new r(t.generate(n));if(!(s.cmp(a)>0))return s.iaddn(1),this.keyFromPrivate(s)}},c.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},c.prototype.sign=function(e,t,n,o){"object"==typeof n&&(o=n,n=null),o||(o={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new r(e,16));for(var a=this.n.byteLength(),s=t.getPrivate().toArray("be",a),c=e.toArray("be",a),l=new i({hash:this.hash,entropy:s,nonce:c,pers:o.pers,persEnc:o.persEnc||"utf8"}),h=this.n.sub(new r(1)),d=0;;d++){var f=o.k?o.k(d):new r(l.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(h)>=0)){var p=this.g.mul(f);if(!p.isInfinity()){var m=p.getX(),g=m.umod(this.n);if(0!==g.cmpn(0)){var b=f.invm(this.n).mul(g.mul(t.getPrivate()).iadd(e));if(0!==(b=b.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==m.cmp(g)?2:0);return o.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),y^=1),new u({r:g,s:b,recoveryParam:y})}}}}}},c.prototype.verify=function(e,t,n,i){e=this._truncateToN(new r(e,16)),n=this.keyFromPublic(n,i);var o=(t=new u(t,"hex")).r,a=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,c=a.invm(this.n),l=c.mul(e).umod(this.n),h=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(l,n.getPublic(),h)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(l,n.getPublic(),h)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},c.prototype.recoverPubKey=function(e,t,n,i){a((3&n)===n,"The recovery param is more than two bits"),t=new u(t,i);var o=this.n,s=new r(e),c=t.r,l=t.s,h=1&n,d=n>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");c=d?this.curve.pointFromX(c.add(this.curve.n),h):this.curve.pointFromX(c,h);var f=t.r.invm(o),p=o.sub(s).mul(f).umod(o),m=l.mul(f).umod(o);return this.g.mulAdd(p,c,m)},c.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new u(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")}},function(e,t){e.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(e,t,n){"use strict";var r=n(13),i=n(10);function o(e,t,n){if(!(this instanceof o))return new o(e,t,n);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(r.toArray(t,n))}e.exports=o,o.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},o.prototype.update=function(e,t){return this.inner.update(e,t),this},o.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},function(e,t,n){"use strict";var r=n(13),i=n(23),o=r.rotl32,a=r.sum32,s=r.sum32_3,u=r.sum32_4,c=i.BlockHash;function l(){if(!(this instanceof l))return new l;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function h(e,t,n,r){return e<=15?t^n^r:e<=31?t&n|~t&r:e<=47?(t|~n)^r:e<=63?t&r|n&~r:t^(n|~r)}function d(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function f(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}r.inherits(l,c),t.ripemd160=l,l.blockSize=512,l.outSize=160,l.hmacStrength=192,l.padLength=64,l.prototype._update=function(e,t){for(var n=this.h[0],r=this.h[1],i=this.h[2],c=this.h[3],l=this.h[4],y=n,v=r,_=i,w=c,x=l,E=0;E<80;E++){var S=a(o(u(n,h(E,r,i,c),e[p[E]+t],d(E)),g[E]),l);n=l,l=c,c=o(i,10),i=r,r=S,S=a(o(u(y,h(79-E,v,_,w),e[m[E]+t],f(E)),b[E]),x),y=x,x=w,w=o(_,10),_=v,v=S}S=s(this.h[1],i,w),this.h[1]=s(this.h[2],c,x),this.h[2]=s(this.h[3],l,y),this.h[3]=s(this.h[4],n,v),this.h[4]=s(this.h[0],r,_),this.h[0]=S},l.prototype._digest=function(e){return"hex"===e?r.toHex32(this.h,"little"):r.split32(this.h,"little")};var p=[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],m=[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],g=[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],b=[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(e,t,n){"use strict";var r=n(13),i=n(66);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),e.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(e){return"hex"===e?r.toHex32(this.h.slice(0,12),"big"):r.split32(this.h.slice(0,12),"big")}},function(e,t,n){"use strict";var r=n(13),i=n(67);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),e.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(e){return"hex"===e?r.toHex32(this.h.slice(0,7),"big"):r.split32(this.h.slice(0,7),"big")}},function(e,t,n){"use strict";var r=n(13),i=n(23),o=n(68),a=r.rotl32,s=r.sum32,u=r.sum32_5,c=o.ft_1,l=i.BlockHash,h=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}r.inherits(d,l),e.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=a(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],l=this.h[2],d=this.h[3],f=this.h[4];for(r=0;r<n.length;r++){var p=~~(r/20),m=u(a(i,5),c(p,o,l,d),f,n[r],h[p]);f=d,d=l,l=a(o,30),o=i,i=m}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],l),this.h[3]=s(this.h[3],d),this.h[4]=s(this.h[4],f)},d.prototype._digest=function(e){return"hex"===e?r.toHex32(this.h,"big"):r.split32(this.h,"big")}},function(e,t,n){"use strict";t.sha1=n(140),t.sha224=n(139),t.sha256=n(67),t.sha384=n(138),t.sha512=n(66)},function(e,t,n){"use strict";var r,i=t,o=n(38),a=n(9),s=a.utils.assert;function u(e){"short"===e.type?this.curve=new a.curve.short(e):"edwards"===e.type?this.curve=new a.curve.edwards(e):this.curve=new a.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var n=new u(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:n}),n}})}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(135)}catch(e){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(e,t,n){"use strict";var r=n(29),i=n(9),o=n(7),a=n(2),s=r.base,u=i.utils.assert;function c(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,s.call(this,"edwards",e),this.a=new o(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new o(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new o(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),u(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function l(e,t,n,r,i){s.BasePoint.call(this,e,"projective"),null===t&&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 o(t,16),this.y=new o(n,16),this.z=r?new o(r,16):this.curve.one,this.t=i&&new o(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()))))}a(c,s),e.exports=c,c.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},c.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},c.prototype.jpoint=function(e,t,n,r){return this.point(e,t,n,r)},c.prototype.pointFromX=function(e,t){(e=new o(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),a=r.redMul(i.redInvm()),s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");var u=s.fromRed().isOdd();return(t&&!u||!t&&u)&&(s=s.redNeg()),this.point(e,s)},c.prototype.pointFromY=function(e,t){(e=new o(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=n.redSub(this.c2),i=n.redMul(this.d).redMul(this.c2).redSub(this.a),a=r.redMul(i.redInvm());if(0===a.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==t&&(s=s.redNeg()),this.point(s,e)},c.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),r=t.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return 0===r.cmp(i)},a(l,s.BasePoint),c.prototype.pointFromJSON=function(e){return l.fromJSON(this,e)},c.prototype.point=function(e,t,n,r){return new l(this,e,t,n,r)},l.fromJSON=function(e,t){return new l(e,t[0],t[1],t[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 e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=r.redAdd(t),a=o.redSub(n),s=r.redSub(t),u=i.redMul(a),c=o.redMul(s),l=i.redMul(s),h=a.redMul(o);return this.curve.point(u,c,h,l)},l.prototype._projDbl=function(){var e,t,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)e=r.redSub(i).redSub(o).redMul(a.redSub(this.curve.two)),t=a.redMul(c.redSub(o)),n=a.redSqr().redSub(a).redSub(a);else{var s=this.z.redSqr(),u=a.redSub(s).redISub(s);e=r.redSub(i).redISub(o).redMul(u),t=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);e=this.curve._mulC(r.redISub(c)).redMul(u),t=this.curve._mulC(c).redMul(i.redISub(o)),n=c.redMul(u)}return this.curve.point(e,t,n)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},l.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),a=i.redSub(r),s=i.redAdd(r),u=n.redAdd(t),c=o.redMul(a),l=s.redMul(u),h=o.redMul(u),d=a.redMul(s);return this.curve.point(c,l,d,h)},l.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),c=i.redAdd(s),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),h=r.redMul(u).redMul(l);return this.curve.twisted?(t=r.redMul(c).redMul(a.redSub(this.curve._mulA(o))),n=u.redMul(c)):(t=r.redMul(c).redMul(a.redSub(o)),n=this.curve._mulC(u).redMul(c)),this.curve.point(h,t,n)},l.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},l.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},l.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},l.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},l.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),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(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},l.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}},l.prototype.toP=l.prototype.normalize,l.prototype.mixedAdd=l.prototype.add},function(e,t,n){"use strict";var r=n(29),i=n(7),o=n(2),a=r.base,s=n(9).utils;function u(e){a.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.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(e,t,n){a.BasePoint.call(this,e,"projective"),null===t&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,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),e.exports=u,u.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},o(c,a.BasePoint),u.prototype.decodePoint=function(e,t){return this.point(s.toArray(e,t),1)},u.prototype.point=function(e,t){return new c(this,e,t)},u.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.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 e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.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(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),a=i.redMul(r),s=t.z.redMul(o.redAdd(a).redSqr()),u=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},c.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;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(e){return 0===this.getX().cmp(e.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(e,t,n){"use strict";var r=n(29),i=n(9),o=n(7),a=n(2),s=r.base,u=i.utils.assert;function c(e){s.call(this,"short",e),this.a=new o(e.a,16).toRed(this.red),this.b=new o(e.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(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function l(e,t,n,r){s.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new o(t,16),this.y=new o(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 h(e,t,n,r){s.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new o(0)):(this.x=new o(t,16),this.y=new o(n,16),this.z=new o(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}a(c,s),e.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new o(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new o(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?n=i[0]:(n=i[1],u(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map(function(e){return{a:new o(e.a,16),b:new o(e.b,16)}}):this._getEndoBasis(n)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:o.mont(e),n=new o(2).toRed(t).redInvm(),r=n.redNeg(),i=new o(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,n,r,i,a,s,u,c,l,h=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,f=this.n.clone(),p=new o(1),m=new o(0),g=new o(0),b=new o(1),y=0;0!==d.cmpn(0);){var v=f.div(d);c=f.sub(v.mul(d)),l=g.sub(v.mul(p));var _=b.sub(v.mul(m));if(!r&&c.cmp(h)<0)t=u.neg(),n=p,r=c.neg(),i=l;else if(r&&2==++y)break;u=c,f=d,d=c,g=p,p=l,b=m,m=_}a=c.neg(),s=l;var w=r.sqr().add(i.sqr());return a.sqr().add(s.sqr()).cmp(w)>=0&&(a=t,s=n),r.negative&&(r=r.neg(),i=i.neg()),a.negative&&(a=a.neg(),s=s.neg()),[{a:r,b:i},{a:a,b:s}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).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:e.sub(a).sub(s),k2:u.add(c).neg()}},c.prototype.pointFromX=function(e,t){(e=new o(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.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(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<e.length;o++){var a=this._endoSplit(t[o]),s=e[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},a(l,s.BasePoint),c.prototype.point=function(e,t,n){return new l(this,e,t,n)},c.prototype.pointFromJSON=function(e,t){return l.fromJSON(this,e,t)},l.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,r=function(e){return n.point(e.x.redMul(n.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(r)}}}return t}},l.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]},l.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},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)+">"},l.prototype.isInfinity=function(){return this.inf},l.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},l.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).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)},l.prototype.getX=function(){return this.x.fromRed()},l.prototype.getY=function(){return this.y.fromRed()},l.prototype.mul=function(e){return e=new o(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},l.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},l.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},l.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},l.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.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 t},l.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},a(h,s.BasePoint),c.prototype.jpoint=function(e,t,n){return new h(this,e,t,n)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),a=e.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),h=r.redMul(c),d=u.redSqr().redIAdd(l).redISub(h).redISub(h),f=u.redMul(h.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(d,f,p)},h.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).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),h=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(h)).redISub(i.redMul(c)),f=this.z.redMul(a);return this.curve.jpoint(h,d,f)},h.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,n=0;n<e;n++)t=t.dbl();return t}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<e;n++){var l=o.redSqr(),h=c.redSqr(),d=h.redSqr(),f=l.redAdd(l).redIAdd(l).redIAdd(r.redMul(u)),p=o.redMul(h),m=f.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),b=f.redMul(g);b=b.redIAdd(b).redISub(d);var y=c.redMul(s);n+1<e&&(u=u.redMul(d)),o=m,s=y,c=b}return this.curve.jpoint(o,c.redMul(i),s)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},h.prototype._zeroDbl=function(){var e,t,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),e=u,t=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),h=this.y.redSqr(),d=h.redSqr(),f=this.x.redAdd(h).redSqr().redISub(l).redISub(d);f=f.redIAdd(f);var p=l.redAdd(l).redIAdd(l),m=p.redSqr(),g=d.redIAdd(d);g=(g=g.redIAdd(g)).redIAdd(g),e=m.redISub(f).redISub(f),t=p.redMul(f.redISub(e)).redISub(g),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(e,t,n)},h.prototype._threeDbl=function(){var e,t,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);e=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),h=this.y.redSqr(),d=this.x.redMul(h),f=this.x.redSub(l).redMul(this.x.redAdd(l));f=f.redAdd(f).redIAdd(f);var p=d.redIAdd(d),m=(p=p.redIAdd(p)).redAdd(p);e=f.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(h).redISub(l);var g=h.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=f.redMul(p.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,n)},h.prototype._dbl=function(){var e=this.curve.a,t=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=t.redSqr(),a=n.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(i)),u=t.redAdd(t),c=(u=u.redIAdd(u)).redMul(a),l=s.redSqr().redISub(c.redAdd(c)),h=c.redISub(l),d=a.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=s.redMul(h).redISub(d),p=n.redAdd(n).redMul(r);return this.curve.jpoint(l,f,p)},h.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),r=t.redSqr(),i=e.redAdd(e).redIAdd(e),o=i.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).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=t.redMul(c);l=(l=l.redIAdd(l)).redIAdd(l);var h=this.x.redMul(s).redISub(l);h=(h=h.redIAdd(h)).redIAdd(h);var d=this.y.redMul(c.redMul(u.redISub(c)).redISub(a.redMul(s)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=this.z.redAdd(a).redSqr().redISub(n).redISub(s);return this.curve.jpoint(h,d,f)},h.prototype.mul=function(e,t){return e=new o(e,t),this.curve._wnafMul(this,e)},h.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(0!==this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0))return!1;var r=t.redMul(this.z),i=n.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(r)).cmpn(0)},h.prototype.eqXToP=function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(n))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(t);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},h.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)+">"},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(e,t,n){"use strict";var r=n(7),i=n(9).utils,o=i.getNAF,a=i.getJSF,s=i.assert;function u(e,t){this.type=e,this.p=new r(t.p,16),this.red=t.prime?r.red(t.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=t.n&&new r(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.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||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(e,t){s(e.precomputed);var n=e._getDoubles(),r=o(t,1),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;for(var a=[],u=0;u<r.length;u+=n.step){var c=0;for(t=u+n.step-1;t>=u;t--)c=(c<<1)+r[t];a.push(c)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),d=i;d>0;d--){for(u=0;u<a.length;u++){(c=a[u])===d?h=h.mixedAdd(n.points[u]):c===-d&&(h=h.mixedAdd(n.points[u].neg()))}l=l.add(h)}return l.toP()},u.prototype._wnafMul=function(e,t){var n=4,r=e._getNAFPoints(n);n=r.wnd;for(var i=r.points,a=o(t,n),u=this.jpoint(null,null,null),c=a.length-1;c>=0;c--){for(t=0;c>=0&&0===a[c];c--)t++;if(c>=0&&t++,u=u.dblp(t),c<0)break;var l=a[c];s(0!==l),u="affine"===e.type?l>0?u.mixedAdd(i[l-1>>1]):u.mixedAdd(i[-l-1>>1].neg()):l>0?u.add(i[l-1>>1]):u.add(i[-l-1>>1].neg())}return"affine"===e.type?u.toP():u},u.prototype._wnafMulAdd=function(e,t,n,r,i){for(var s=this._wnafT1,u=this._wnafT2,c=this._wnafT3,l=0,h=0;h<r;h++){var d=(C=t[h])._getNAFPoints(e);s[h]=d.wnd,u[h]=d.points}for(h=r-1;h>=1;h-=2){var f=h-1,p=h;if(1===s[f]&&1===s[p]){var m=[t[f],null,null,t[p]];0===t[f].y.cmp(t[p].y)?(m[1]=t[f].add(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg())):0===t[f].y.cmp(t[p].y.redNeg())?(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].add(t[p].neg())):(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],b=a(n[f],n[p]);l=Math.max(b[0].length,l),c[f]=new Array(l),c[p]=new Array(l);for(var y=0;y<l;y++){var v=0|b[0][y],_=0|b[1][y];c[f][y]=g[3*(v+1)+(_+1)],c[p][y]=0,u[f]=m}}else c[f]=o(n[f],s[f]),c[p]=o(n[p],s[p]),l=Math.max(c[f].length,l),l=Math.max(c[p].length,l)}var w=this.jpoint(null,null,null),x=this._wnafT4;for(h=l;h>=0;h--){for(var E=0;h>=0;){var S=!0;for(y=0;y<r;y++)x[y]=0|c[y][h],0!==x[y]&&(S=!1);if(!S)break;E++,h--}if(h>=0&&E++,w=w.dblp(E),h<0)break;for(y=0;y<r;y++){var C,O=x[y];0!==O&&(O>0?C=u[y][O-1>>1]:O<0&&(C=u[y][-O-1>>1].neg()),w="affine"===C.type?w.mixedAdd(C):w.add(C))}}for(h=0;h<r;h++)u[h]=null;return i?w:w.toP()},u.BasePoint=c,c.prototype.eq=function(){throw new Error("Not implemented")},c.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(e,t){e=i.toArray(e,t);var n=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*n)return 6===e[0]?s(e[e.length-1]%2==0):7===e[0]&&s(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((2===e[0]||3===e[0])&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),3===e[0]);throw new Error("Unknown point format")},c.prototype.encodeCompressed=function(e){return this.encode(e,!0)},c.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},c.prototype.encode=function(e,t){return i.encode(this._encode(t),e)},c.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},c.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},c.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)r=r.dbl();n.push(r)}return{step:e,points:n}},c.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)t[i]=t[i-1].add(r);return{wnd:e,points:t}},c.prototype._getBeta=function(){return null},c.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t}},function(e,t,n){"use strict";var r=t,i=n(7),o=n(10),a=n(69);r.assert=o,r.toArray=a.toArray,r.zero2=a.zero2,r.toHex=a.toHex,r.encode=a.encode,r.getNAF=function(e,t){for(var n=[],r=1<<t+1,i=e.clone();i.cmpn(1)>=0;){var o;if(i.isOdd()){var a=i.andln(r-1);o=a>(r>>1)-1?(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)?t+1:1,u=1;u<s;u++)n.push(0);i.iushrn(s)}return n},r.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r=0,i=0;e.cmpn(-r)>0||t.cmpn(-i)>0;){var o,a,s,u=e.andln(3)+r&3,c=t.andln(3)+i&3;3===u&&(u=-1),3===c&&(c=-1),o=0==(1&u)?0:3!=(s=e.andln(7)+r&7)&&5!==s||2!==c?u:-u,n[0].push(o),a=0==(1&c)?0:3!=(s=t.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),e.iushrn(1),t.iushrn(1)}return n},r.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new i(e,"hex","le")}},function(e){e.exports={_args:[["elliptic@6.4.1","/Users/ymann/Development/acc-creativity/components"]],_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/ymann/Development/acc-creativity/components",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(e,t,n){(function(t){var r=n(84),i=n(39),o=n(9).ec,a=n(7),s=n(28),u=n(61);function c(e,n,i,o){if((e=new t(e.toArray())).length<n.byteLength()){var a=new t(n.byteLength()-e.length);a.fill(0),e=t.concat([a,e])}var s=i.length,u=function(e,n){e=(e=l(e,n)).mod(n);var r=new t(e.toArray());if(r.length<n.byteLength()){var i=new t(n.byteLength()-r.length);i.fill(0),r=t.concat([i,r])}return r}(i,n),c=new t(s);c.fill(1);var h=new t(s);return h.fill(0),h=r(o,h).update(c).update(new t([0])).update(e).update(u).digest(),c=r(o,h).update(c).digest(),{k:h=r(o,h).update(c).update(new t([1])).update(e).update(u).digest(),v:c=r(o,h).update(c).digest()}}function l(e,t){var n=new a(e),r=(e.length<<3)-t.bitLength();return r>0&&n.ishrn(r),n}function h(e,n,i){var o,a;do{for(o=new t(0);8*o.length<e.bitLength();)n.v=r(i,n.k).update(n.v).digest(),o=t.concat([o,n.v]);a=l(o,e),n.k=r(i,n.k).update(n.v).update(new t([0])).digest(),n.v=r(i,n.k).update(n.v).digest()}while(-1!==a.cmp(e));return a}function d(e,t,n,r){return e.toRed(a.mont(n)).redPow(t).fromRed().mod(r)}e.exports=function(e,n,r,f,p){var m=s(n);if(m.curve){if("ecdsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong private key type");return function(e,n){var r=u[n.curve.join(".")];if(!r)throw new Error("unknown curve "+n.curve.join("."));var i=new o(r).keyFromPrivate(n.privateKey).sign(e);return new t(i.toDER())}(e,m)}if("dsa"===m.type){if("dsa"!==f)throw new Error("wrong private key type");return function(e,n,r){for(var i,o=n.params.priv_key,s=n.params.p,u=n.params.q,f=n.params.g,p=new a(0),m=l(e,u).mod(u),g=!1,b=c(o,u,e,r);!1===g;)i=h(u,b,r),p=d(f,i,s,u),0===(g=i.invm(u).imul(m.add(o.mul(p))).mod(u)).cmpn(0)&&(g=!1,p=new a(0));return function(e,n){e=e.toArray(),n=n.toArray(),128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n));var r=[48,e.length+n.length+4,2,e.length];return r=r.concat(e,[2,n.length],n),new t(r)}(p,g)}(e,m,r)}if("rsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong private key type");e=t.concat([p,e]);for(var g=m.modulus.byteLength(),b=[0,1];e.length+b.length+1<g;)b.push(255);b.push(0);for(var y=-1;++y<e.length;)b.push(e[y]);return i(b,m)},e.exports.getKey=c,e.exports.makeKey=h}).call(this,n(5).Buffer)},function(e,t,n){(function(t){var r=n(26),i=n(48),o=n(2),a=n(149),s=n(113),u=n(82);function c(e){i.Writable.call(this);var t=u[e];if(!t)throw new Error("Unknown message digest");this._hashType=t.hash,this._hash=r(t.hash),this._tag=t.id,this._signType=t.sign}function l(e){i.Writable.call(this);var t=u[e];if(!t)throw new Error("Unknown message digest");this._hash=r(t.hash),this._tag=t.id,this._signType=t.sign}function h(e){return new c(e)}function d(e){return new l(e)}Object.keys(u).forEach(function(e){u[e].id=new t(u[e].id,"hex"),u[e.toLowerCase()]=u[e]}),o(c,i.Writable),c.prototype._write=function(e,t,n){this._hash.update(e),n()},c.prototype.update=function(e,n){return"string"==typeof e&&(e=new t(e,n)),this._hash.update(e),this},c.prototype.sign=function(e,t){this.end();var n=this._hash.digest(),r=a(n,e,this._hashType,this._signType,this._tag);return t?r.toString(t):r},o(l,i.Writable),l.prototype._write=function(e,t,n){this._hash.update(e),n()},l.prototype.update=function(e,n){return"string"==typeof e&&(e=new t(e,n)),this._hash.update(e),this},l.prototype.verify=function(e,n,r){"string"==typeof n&&(n=new t(n,r)),this.end();var i=this._hash.digest();return s(n,i,e,this._signType,this._tag)},e.exports={Sign:h,Verify:d,createSign:h,createVerify:d}}).call(this,n(5).Buffer)},function(e,t,n){(function(t){var r=n(7),i=new(n(71)),o=new r(24),a=new r(11),s=new r(10),u=new r(3),c=new r(7),l=n(72),h=n(19);function d(e,n){return n=n||"utf8",t.isBuffer(e)||(e=new t(e,n)),this._pub=new r(e),this}function f(e,n){return n=n||"utf8",t.isBuffer(e)||(e=new t(e,n)),this._priv=new r(e),this}e.exports=m;var p={};function m(e,t,n){this.setGenerator(t),this.__prime=new r(e),this._prime=r.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,n?(this.setPublicKey=d,this.setPrivateKey=f):this._primeCode=8}function g(e,n){var r=new t(e.toArray());return n?r.toString(n):r}Object.defineProperty(m.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(e,t){var n=t.toString("hex"),r=[n,e.toString(16)].join("_");if(r in p)return p[r];var h,d=0;if(e.isEven()||!l.simpleSieve||!l.fermatTest(e)||!i.test(e))return d+=1,d+="02"===n||"05"===n?8:4,p[r]=d,d;switch(i.test(e.shrn(1))||(d+=2),n){case"02":e.mod(o).cmp(a)&&(d+=8);break;case"05":(h=e.mod(s)).cmp(u)&&h.cmp(c)&&(d+=8);break;default:d+=4}return p[r]=d,d}(this.__prime,this.__gen)),this._primeCode}}),m.prototype.generateKeys=function(){return this._priv||(this._priv=new r(h(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},m.prototype.computeSecret=function(e){var n=(e=(e=new r(e)).toRed(this._prime)).redPow(this._priv).fromRed(),i=new t(n.toArray()),o=this.getPrime();if(i.length<o.length){var a=new t(o.length-i.length);a.fill(0),i=t.concat([a,i])}return i},m.prototype.getPublicKey=function(e){return g(this._pub,e)},m.prototype.getPrivateKey=function(e){return g(this._priv,e)},m.prototype.getPrime=function(e){return g(this.__prime,e)},m.prototype.getGenerator=function(e){return g(this._gen,e)},m.prototype.setGenerator=function(e,n){return n=n||"utf8",t.isBuffer(e)||(e=new t(e,n)),this.__gen=e,this._gen=new r(e),this}}).call(this,n(5).Buffer)},function(e){e.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(e,t){},function(e,t){},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){(function(e){var r=n(72),i=n(152),o=n(151);var a={binary:!0,hex:!0,base64:!0};t.DiffieHellmanGroup=t.createDiffieHellmanGroup=t.getDiffieHellman=function(t){var n=new e(i[t].prime,"hex"),r=new e(i[t].gen,"hex");return new o(n,r)},t.createDiffieHellman=t.DiffieHellman=function t(n,i,s,u){return e.isBuffer(i)||void 0===a[i]?t(n,"binary",i,s):(i=i||"binary",u=u||"binary",s=s||new e([2]),e.isBuffer(s)||(s=new e(s,u)),"number"==typeof n?new o(r(n,s),s,!0):(e.isBuffer(n)||(n=new e(n,i)),new o(n,s,!0)))}}).call(this,n(5).Buffer)},function(e,t){t["des-ecb"]={key:8,iv:0},t["des-cbc"]=t.des={key:8,iv:8},t["des-ede3-cbc"]=t.des3={key:24,iv:8},t["des-ede3"]={key:24,iv:0},t["des-ede-cbc"]={key:16,iv:8},t["des-ede"]={key:16,iv:0}},function(e,t,n){var r=n(74),i=n(4).Buffer,o=n(40),a=n(73),s=n(15),u=n(31),c=n(30);function l(e,t,n){s.call(this),this._cache=new h,this._last=void 0,this._cipher=new u.AES(t),this._prev=i.from(n),this._mode=e,this._autopadding=!0}function h(){this.cache=i.allocUnsafe(0)}function d(e,t,n){var s=o[e.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof n&&(n=i.from(n)),"GCM"!==s.mode&&n.length!==s.iv)throw new TypeError("invalid iv length "+n.length);if("string"==typeof t&&(t=i.from(t)),t.length!==s.key/8)throw new TypeError("invalid key length "+t.length);return"stream"===s.type?new a(s.module,t,n,!0):"auth"===s.type?new r(s.module,t,n,!0):new l(s.module,t,n)}n(2)(l,s),l.prototype._update=function(e){var t,n;this._cache.add(e);for(var r=[];t=this._cache.get(this._autopadding);)n=this._mode.decrypt(this,t),r.push(n);return i.concat(r)},l.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return function(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");var n=-1;for(;++n<t;)if(e[n+(16-t)]!==t)throw new Error("unable to decrypt data");if(16===t)return;return e.slice(0,16-t)}(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")},l.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},h.prototype.add=function(e){this.cache=i.concat([this.cache,e])},h.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},h.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=function(e,t){var n=o[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var r=c(t,!1,n.key,n.iv);return d(e,r.key,r.iv)},t.createDecipheriv=d},function(e,t,n){var r=n(4).Buffer,i=r.alloc(16,0);function o(e){var t=r.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function a(e){this.h=e,this.state=r.alloc(16,0),this.cache=r.allocUnsafe(0)}a.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},a.prototype._multiply=function(){for(var e,t,n=function(e){return[e.readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.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]),t=0!=(1&n[3]),e=3;e>0;e--)n[e]=n[e]>>>1|(1&n[e-1])<<31;n[0]=n[0]>>>1,t&&(n[0]=n[0]^225<<24)}this.state=o(r)},a.prototype.update=function(e){var t;for(this.cache=r.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},a.prototype.final=function(e,t){return this.cache.length&&this.ghash(r.concat([this.cache,i],16)),this.ghash(o([0,e,0,t])),this.state},e.exports=a},function(e,t,n){(function(e){var r=n(24);function i(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}t.encrypt=function(t,n){for(;t._cache.length<n.length;)t._cache=e.concat([t._cache,i(t)]);var o=t._cache.slice(0,n.length);return t._cache=t._cache.slice(n.length),r(n,o)}}).call(this,n(5).Buffer)},function(e,t,n){var r=n(4).Buffer;function i(e,t,n){for(var r,i,a,s=-1,u=0;++s<8;)r=e._cipher.encryptBlock(e._prev),i=t&1<<7-s?128:0,u+=(128&(a=r[0]^i))>>s%8,e._prev=o(e._prev,n?i:a);return u}function o(e,t){var n=e.length,i=-1,o=r.allocUnsafe(e.length);for(e=r.concat([e,r.from([t])]);++i<n;)o[i]=e[i]<<1|e[i+1]>>7;return o}t.encrypt=function(e,t,n){for(var o=t.length,a=r.allocUnsafe(o),s=-1;++s<o;)a[s]=i(e,t[s],n);return a}},function(e,t,n){var r=n(4).Buffer;function i(e,t,n){var i=e._cipher.encryptBlock(e._prev)[0]^t;return e._prev=r.concat([e._prev.slice(1),r.from([n?t:i])]),i}t.encrypt=function(e,t,n){for(var o=t.length,a=r.allocUnsafe(o),s=-1;++s<o;)a[s]=i(e,t[s],n);return a}},function(e,t,n){var r=n(4).Buffer,i=n(24);function o(e,t,n){var o=t.length,a=i(t,e._cache);return e._cache=e._cache.slice(o),e._prev=r.concat([e._prev,n?t:a]),a}t.encrypt=function(e,t,n){for(var i,a=r.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=r.allocUnsafe(0)),!(e._cache.length<=t.length)){a=r.concat([a,o(e,t,n)]);break}i=e._cache.length,a=r.concat([a,o(e,t.slice(0,i),n)]),t=t.slice(i)}return a}},function(e,t,n){var r=n(24);t.encrypt=function(e,t){var n=r(t,e._prev);return e._prev=e._cipher.encryptBlock(n),e._prev},t.decrypt=function(e,t){var n=e._prev;e._prev=t;var i=e._cipher.decryptBlock(t);return r(i,n)}},function(e,t){t.encrypt=function(e,t){return e._cipher.encryptBlock(t)},t.decrypt=function(e,t){return e._cipher.decryptBlock(t)}},function(e,t,n){var r=n(40),i=n(74),o=n(4).Buffer,a=n(73),s=n(15),u=n(31),c=n(30);function l(e,t,n){s.call(this),this._cache=new d,this._cipher=new u.AES(t),this._prev=o.from(n),this._mode=e,this._autopadding=!0}n(2)(l,s),l.prototype._update=function(e){var t,n;this._cache.add(e);for(var r=[];t=this._cache.get();)n=this._mode.encrypt(this,t),r.push(n);return o.concat(r)};var h=o.alloc(16,16);function d(){this.cache=o.allocUnsafe(0)}function f(e,t,n){var s=r[e.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=o.from(t)),t.length!==s.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof n&&(n=o.from(n)),"GCM"!==s.mode&&n.length!==s.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===s.type?new a(s.module,t,n):"auth"===s.type?new i(s.module,t,n):new l(s.module,t,n)}l.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(h))throw this._cipher.scrub(),new Error("data not multiple of block length")},l.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},d.prototype.add=function(e){this.cache=o.concat([this.cache,e])},d.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},d.prototype.flush=function(){for(var e=16-this.cache.length,t=o.allocUnsafe(e),n=-1;++n<e;)t.writeUInt8(e,n);return o.concat([this.cache,t])},t.createCipheriv=f,t.createCipher=function(e,t){var n=r[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var i=c(t,!1,n.key,n.iv);return f(e,i.key,i.iv)}},function(e,t,n){"use strict";var r=n(10),i=n(2),o=n(42),a=o.Cipher,s=o.DES;function u(e){a.call(this,e);var t=new function(e,t){r.equal(t.length,24,"Invalid key length");var n=t.slice(0,8),i=t.slice(8,16),o=t.slice(16,24);this.ciphers="encrypt"===e?[s.create({type:"encrypt",key:n}),s.create({type:"decrypt",key:i}),s.create({type:"encrypt",key:o})]:[s.create({type:"decrypt",key:o}),s.create({type:"encrypt",key:i}),s.create({type:"decrypt",key:n})]}(this.type,this.options.key);this._edeState=t}i(u,a),e.exports=u,u.create=function(e){return new u(e)},u.prototype._update=function(e,t,n,r){var i=this._edeState;i.ciphers[0]._update(e,t,n,r),i.ciphers[1]._update(n,r,n,r),i.ciphers[2]._update(n,r,n,r)},u.prototype._pad=s.prototype._pad,u.prototype._unpad=s.prototype._unpad},function(e,t,n){"use strict";var r=n(10),i=n(2),o={};t.instantiate=function(e){function t(t){e.call(this,t),this._cbcInit()}i(t,e);for(var n=Object.keys(o),r=0;r<n.length;r++){var a=n[r];t.prototype[a]=o[a]}return t.create=function(e){return new t(e)},t},o._cbcInit=function(){var e=new function(e){r.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;t<this.iv.length;t++)this.iv[t]=e[t]}(this.options.iv);this._cbcState=e},o._update=function(e,t,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]^=e[t+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,e,t,n,r);for(s=0;s<this.blockSize;s++)n[r+s]^=a[s];for(s=0;s<this.blockSize;s++)a[s]=e[t+s]}}},function(e,t,n){"use strict";var r=n(10),i=n(2),o=n(42),a=o.utils,s=o.Cipher;function u(e){s.call(this,e);var t=new function(){this.tmp=new Array(2),this.keys=null};this._desState=t,this.deriveKeys(t,e.key)}i(u,s),e.exports=u,u.create=function(e){return new u(e)};var c=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];u.prototype.deriveKeys=function(e,t){e.keys=new Array(32),r.equal(t.length,this.blockSize,"Invalid key length");var n=a.readUInt32BE(t,0),i=a.readUInt32BE(t,4);a.pc1(n,i,e.tmp,0),n=e.tmp[0],i=e.tmp[1];for(var o=0;o<e.keys.length;o+=2){var s=c[o>>>1];n=a.r28shl(n,s),i=a.r28shl(i,s),a.pc2(n,i,e.keys,o)}},u.prototype._update=function(e,t,n,r){var i=this._desState,o=a.readUInt32BE(e,t),s=a.readUInt32BE(e,t+4);a.ip(o,s,i.tmp,0),o=i.tmp[0],s=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,s,i.tmp,0):this._decrypt(i,o,s,i.tmp,0),o=i.tmp[0],s=i.tmp[1],a.writeUInt32BE(n,o,r),a.writeUInt32BE(n,s,r+4)},u.prototype._pad=function(e,t){for(var n=e.length-t,r=t;r<e.length;r++)e[r]=n;return!0},u.prototype._unpad=function(e){for(var t=e[e.length-1],n=e.length-t;n<e.length;n++)r.equal(e[n],t);return e.slice(0,e.length-t)},u.prototype._encrypt=function(e,t,n,r,i){for(var o=t,s=n,u=0;u<e.keys.length;u+=2){var c=e.keys[u],l=e.keys[u+1];a.expand(s,e.tmp,0),c^=e.tmp[0],l^=e.tmp[1];var h=a.substitute(c,l),d=s;s=(o^a.permute(h))>>>0,o=d}a.rip(s,o,r,i)},u.prototype._decrypt=function(e,t,n,r,i){for(var o=n,s=t,u=e.keys.length-2;u>=0;u-=2){var c=e.keys[u],l=e.keys[u+1];a.expand(o,e.tmp,0),c^=e.tmp[0],l^=e.tmp[1];var h=a.substitute(c,l),d=o;o=(s^a.permute(h))>>>0,s=d}a.rip(o,s,r,i)}},function(e,t,n){"use strict";var r=n(10);function i(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}e.exports=i,i.prototype._init=function(){},i.prototype.update=function(e){return 0===e.length?[]:"decrypt"===this.type?this._updateDecrypt(e):this._updateEncrypt(e)},i.prototype._buffer=function(e,t){for(var n=Math.min(this.buffer.length-this.bufferOff,e.length-t),r=0;r<n;r++)this.buffer[this.bufferOff+r]=e[t+r];return this.bufferOff+=n,n},i.prototype._flushBuffer=function(e,t){return this._update(this.buffer,0,e,t),this.bufferOff=0,this.blockSize},i.prototype._updateEncrypt=function(e){var t=0,n=0,r=(this.bufferOff+e.length)/this.blockSize|0,i=new Array(r*this.blockSize);0!==this.bufferOff&&(t+=this._buffer(e,t),this.bufferOff===this.buffer.length&&(n+=this._flushBuffer(i,n)));for(var o=e.length-(e.length-t)%this.blockSize;t<o;t+=this.blockSize)this._update(e,t,i,n),n+=this.blockSize;for(;t<e.length;t++,this.bufferOff++)this.buffer[this.bufferOff]=e[t];return i},i.prototype._updateDecrypt=function(e){for(var t=0,n=0,r=Math.ceil((this.bufferOff+e.length)/this.blockSize)-1,i=new Array(r*this.blockSize);r>0;r--)t+=this._buffer(e,t),n+=this._flushBuffer(i,n);return t+=this._buffer(e,t),i},i.prototype.final=function(e){var t,n;return e&&(t=this.update(e)),n="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(n):n},i.prototype._pad=function(e,t){if(0===t)return!1;for(;t<e.length;)e[t++]=0;return!0},i.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var e=new Array(this.blockSize);return this._update(this.buffer,0,e,0),e},i.prototype._unpad=function(e){return e},i.prototype._finalDecrypt=function(){r.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var e=new Array(this.blockSize);return this._flushBuffer(e,0),this._unpad(e)}},function(e,t,n){"use strict";t.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},t.writeUInt32BE=function(e,t,n){e[0+n]=t>>>24,e[1+n]=t>>>16&255,e[2+n]=t>>>8&255,e[3+n]=255&t},t.ip=function(e,t,n,r){for(var i=0,o=0,a=6;a>=0;a-=2){for(var 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=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1}n[r+0]=i>>>0,n[r+1]=o>>>0},t.rip=function(e,t,n,r){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)i<<=1,i|=t>>>s+a&1,i<<=1,i|=e>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=t>>>s+a&1,o<<=1,o|=e>>>s+a&1;n[r+0]=i>>>0,n[r+1]=o>>>0},t.pc1=function(e,t,n,r){for(var i=0,o=0,a=7;a>=5;a--){for(var 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(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;n[r+0]=i>>>0,n[r+1]=o>>>0},t.r28shl=function(e,t){return e<<t&268435455|e>>>28-t};var r=[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];t.pc2=function(e,t,n,i){for(var o=0,a=0,s=r.length>>>1,u=0;u<s;u++)o<<=1,o|=e>>>r[u]&1;for(u=s;u<r.length;u++)a<<=1,a|=t>>>r[u]&1;n[i+0]=o>>>0,n[i+1]=a>>>0},t.expand=function(e,t,n){var r=0,i=0;r=(1&e)<<5|e>>>27;for(var o=23;o>=15;o-=4)r<<=6,r|=e>>>o&63;for(o=11;o>=3;o-=4)i|=e>>>o&63,i<<=6;i|=(31&e)<<1|e>>>31,t[n+0]=r>>>0,t[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];t.substitute=function(e,t){for(var n=0,r=0;r<4;r++){n<<=4,n|=i[64*r+(e>>>18-6*r&63)]}for(r=0;r<4;r++){n<<=4,n|=i[256+64*r+(t>>>18-6*r&63)]}return n>>>0};var o=[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];t.permute=function(e){for(var t=0,n=0;n<o.length;n++)t<<=1,t|=e>>>o[n]&1;return t>>>0},t.padSplit=function(e,t,n){for(var r=e.toString(2);r.length<t;)r="0"+r;for(var i=[],o=0;o<t;o+=n)i.push(r.slice(o,o+n));return i.join(" ")}},function(e,t,n){var r=n(15),i=n(42),o=n(2),a=n(4).Buffer,s={"des-ede3-cbc":i.CBC.instantiate(i.EDE),"des-ede3":i.EDE,"des-ede-cbc":i.CBC.instantiate(i.EDE),"des-ede":i.EDE,"des-cbc":i.CBC.instantiate(i.DES),"des-ecb":i.DES};function u(e){r.call(this);var t,n=e.mode.toLowerCase(),i=s[n];t=e.decrypt?"decrypt":"encrypt";var o=e.key;a.isBuffer(o)||(o=a.from(o)),"des-ede"!==n&&"des-ede-cbc"!==n||(o=a.concat([o,o.slice(0,8)]));var u=e.iv;a.isBuffer(u)||(u=a.from(u)),this._des=i.create({key:o,iv:u,type:t})}s.des=s["des-cbc"],s.des3=s["des-ede3-cbc"],e.exports=u,o(u,r),u.prototype._update=function(e){return a.from(this._des.update(e))},u.prototype._final=function(){return a.from(this._des.final())}},function(e,t,n){var r=n(172),i=n(41),o=n(40),a=n(157),s=n(30);function u(e,t,n){if(e=e.toLowerCase(),o[e])return i.createCipheriv(e,t,n);if(a[e])return new r({key:t,iv:n,mode:e});throw new TypeError("invalid suite type")}function c(e,t,n){if(e=e.toLowerCase(),o[e])return i.createDecipheriv(e,t,n);if(a[e])return new r({key:t,iv:n,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}t.createCipher=t.Cipher=function(e,t){var n,r;if(e=e.toLowerCase(),o[e])n=o[e].key,r=o[e].iv;else{if(!a[e])throw new TypeError("invalid suite type");n=8*a[e].key,r=a[e].iv}var i=s(t,!1,n,r);return u(e,i.key,i.iv)},t.createCipheriv=t.Cipheriv=u,t.createDecipher=t.Decipher=function(e,t){var n,r;if(e=e.toLowerCase(),o[e])n=o[e].key,r=o[e].iv;else{if(!a[e])throw new TypeError("invalid suite type");n=8*a[e].key,r=a[e].iv}var i=s(t,!1,n,r);return c(e,i.key,i.iv)},t.createDecipheriv=t.Decipheriv=c,t.listCiphers=t.getCiphers=function(){return Object.keys(a).concat(i.getCiphers())}},function(e,t,n){(function(t,r){var i,o=n(80),a=n(79),s=n(78),u=n(4).Buffer,c=t.crypto&&t.crypto.subtle,l={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"},h=[];function d(e,t,n,r,i){return c.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then(function(e){return c.deriveBits({name:"PBKDF2",salt:t,iterations:n,hash:{name:i}},e,r<<3)}).then(function(e){return u.from(e)})}e.exports=function(e,n,f,p,m,g){"function"==typeof m&&(g=m,m=void 0);var b=l[(m=m||"sha1").toLowerCase()];if(!b||"function"!=typeof t.Promise)return r.nextTick(function(){var t;try{t=s(e,n,f,p,m)}catch(e){return g(e)}g(null,t)});if(o(e,n,f,p),"function"!=typeof g)throw new Error("No callback provided to pbkdf2");u.isBuffer(e)||(e=u.from(e,a)),u.isBuffer(n)||(n=u.from(n,a)),function(e,t){e.then(function(e){r.nextTick(function(){t(null,e)})},function(e){r.nextTick(function(){t(e)})})}(function(e){if(t.process&&!t.process.browser)return Promise.resolve(!1);if(!c||!c.importKey||!c.deriveBits)return Promise.resolve(!1);if(void 0!==h[e])return h[e];var n=d(i=i||u.alloc(8),i,10,128,e).then(function(){return!0}).catch(function(){return!1});return h[e]=n,n}(b).then(function(t){return t?d(e,n,f,p,b):s(e,n,f,p,m)}),g)}}).call(this,n(11),n(12))},function(e,t,n){e.exports=n(82)},function(e,t,n){"use strict";var r=n(2),i=n(4).Buffer,o=n(15),a=i.alloc(128),s=64;function u(e,t){o.call(this,"digest"),"string"==typeof t&&(t=i.from(t)),this._alg=e,this._key=t,t.length>s?t=e(t):t.length<s&&(t=i.concat([t,a],s));for(var n=this._ipad=i.allocUnsafe(s),r=this._opad=i.allocUnsafe(s),u=0;u<s;u++)n[u]=54^t[u],r[u]=92^t[u];this._hash=[n]}r(u,o),u.prototype._update=function(e){this._hash.push(e)},u.prototype._final=function(){var e=this._alg(i.concat(this._hash));return this._alg(i.concat([this._opad,e]))},e.exports=u},function(e,t,n){var r=n(2),i=n(85),o=n(18),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 e=a.allocUnsafe(48);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+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),e},e.exports=u},function(e,t,n){var r=n(2),i=n(86),o=n(18),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 e=a.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=u},function(e,t,n){var r=n(2),i=n(18),o=n(4).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(e){return e<<1|e>>>31}function l(e){return e<<5|e>>>27}function h(e){return e<<30|e>>>2}function d(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}r(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,u=0;u<16;++u)t[u]=e.readInt32BE(4*u);for(;u<80;++u)t[u]=c(t[u-3]^t[u-8]^t[u-14]^t[u-16]);for(var f=0;f<80;++f){var p=~~(f/20),m=l(n)+d(p,r,i,o)+s+t[f]+a[p]|0;s=o,o=i,i=h(r),r=n,n=m}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,n){var r=n(2),i=n(18),o=n(4).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(e){return e<<5|e>>>27}function l(e){return e<<30|e>>>2}function h(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}r(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,u=0;u<16;++u)t[u]=e.readInt32BE(4*u);for(;u<80;++u)t[u]=t[u-3]^t[u-8]^t[u-14]^t[u-16];for(var d=0;d<80;++d){var f=~~(d/20),p=c(n)+h(f,r,i,o)+s+t[d]+a[f]|0;s=o,o=i,i=l(r),r=n,n=p}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,n){e.exports=n(47).PassThrough},function(e,t,n){e.exports=n(47).Transform},function(e,t,n){e.exports=n(16)},function(e,t,n){e.exports=n(46)},function(e,t,n){"use strict";e.exports=o;var r=n(87),i=n(25);function o(e){if(!(this instanceof o))return new o(e);r.call(this,e)}i.inherits=n(2),i.inherits(o,r),o.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){(function(t){function n(e){try{if(!t.localStorage)return!1}catch(e){return!1}var n=t.localStorage[e];return null!=n&&"true"===String(n).toLowerCase()}e.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}}).call(this,n(11))},function(e,t){},function(e,t,n){"use strict";var r=n(4).Buffer,i=n(187);function o(e,t,n){e.copy(t,n)}e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t=r.allocUnsafe(e>>>0),n=this.head,i=0;n;)o(n.data,t,i),i+=n.data.length,n=n.next;return t},e}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){"use strict";t.randomBytes=t.rng=t.pseudoRandomBytes=t.prng=n(19),t.createHash=t.Hash=n(26),t.createHmac=t.Hmac=n(84);var r=n(175),i=Object.keys(r),o=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(i);t.getHashes=function(){return o};var a=n(81);t.pbkdf2=a.pbkdf2,t.pbkdf2Sync=a.pbkdf2Sync;var s=n(173);t.Cipher=s.Cipher,t.createCipher=s.createCipher,t.Cipheriv=s.Cipheriv,t.createCipheriv=s.createCipheriv,t.Decipher=s.Decipher,t.createDecipher=s.createDecipher,t.Decipheriv=s.Decipheriv,t.createDecipheriv=s.createDecipheriv,t.getCiphers=s.getCiphers,t.listCiphers=s.listCiphers;var u=n(156);t.DiffieHellmanGroup=u.DiffieHellmanGroup,t.createDiffieHellmanGroup=u.createDiffieHellmanGroup,t.getDiffieHellman=u.getDiffieHellman,t.createDiffieHellman=u.createDiffieHellman,t.DiffieHellman=u.DiffieHellman;var c=n(150);t.createSign=c.createSign,t.Sign=c.Sign,t.createVerify=c.createVerify,t.Verify=c.Verify,t.createECDH=n(112);var l=n(111);t.publicEncrypt=l.publicEncrypt,t.privateEncrypt=l.privateEncrypt,t.publicDecrypt=l.publicDecrypt,t.privateDecrypt=l.privateDecrypt;var h=n(108);t.randomFill=h.randomFill,t.randomFillSync=h.randomFillSync,t.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},t.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(e,t){t.read=function(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,c=u>>1,l=-7,h=n?i-1:0,d=n?-1:1,f=e[t+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+e[t+h],h+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+e[t+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(t*u-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;e[n+f]=255&a,f+=p,a/=256,c-=8);e[n+f-p]|=128*m}},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){for(var t,n=c(e),r=n[0],a=n[1],s=new o(function(e,t,n){return 3*(t+n)/4-n}(0,r,a)),u=0,l=a>0?r-4:r,h=0;h<l;h+=4)t=i[e.charCodeAt(h)]<<18|i[e.charCodeAt(h+1)]<<12|i[e.charCodeAt(h+2)]<<6|i[e.charCodeAt(h+3)],s[u++]=t>>16&255,s[u++]=t>>8&255,s[u++]=255&t;2===a&&(t=i[e.charCodeAt(h)]<<2|i[e.charCodeAt(h+1)]>>4,s[u++]=255&t);1===a&&(t=i[e.charCodeAt(h)]<<10|i[e.charCodeAt(h+1)]<<4|i[e.charCodeAt(h+2)]>>2,s[u++]=t>>8&255,s[u++]=255&t);return s},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=0,s=n-i;a<s;a+=16383)o.push(h(e,a,a+16383>s?s:a+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)r[s]=a[s],i[a.charCodeAt(s)]=s;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function h(e,t,n){for(var r,i=[],o=t;o<n;o+=3)r=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),i.push(l(r));return i.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,i=1,o={},a=!1,s=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick(function(){l(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?function(){var t="setImmediate$"+Math.random()+"$",n=function(n){n.source===e&&"string"==typeof n.data&&0===n.data.indexOf(t)&&l(+n.data.slice(t.length))};e.addEventListener?e.addEventListener("message",n,!1):e.attachEvent("onmessage",n),r=function(n){e.postMessage(t+n,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){l(e.data)},r=function(t){e.port2.postMessage(t)}}():s&&"onreadystatechange"in s.createElement("script")?function(){var e=s.documentElement;r=function(t){var n=s.createElement("script");n.onreadystatechange=function(){l(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}():r=function(e){setTimeout(l,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var a={callback:e,args:t};return o[i]=a,r(i),i++},u.clearImmediate=c}function c(e){delete o[e]}function l(e){if(a)setTimeout(l,0,e);else{var t=o[e];if(t){a=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(n,r)}}(t)}finally{c(e),a=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(11),n(12))},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const o=n(6),a=n(8),s=n(52),u=n(8),c=n(1),l=n(51),h=n(99),d=n(94),f=n(8),p=n(3);n(57);const m=n(50),g=e=>"function"==typeof e.focusHeader,b=(e,t=[0,0])=>{if((e=>"number"==typeof e.width&&"number"===e.height)(e))return t[0]=e.width,t[1]=e.height,t;if(Math.min(e.clientWidth,e.clientHeight)>0)return t[0]=e.clientWidth,t[1]=e.clientHeight,t;const n=e.getBoundingClientRect();return Math.min(n.width,n.height)>0?(t[0]=n.width,t[1]=n.height,t):t},y=[NaN,NaN],v={};t.transformCameraPoints=((e,t,n,r,i)=>{const{scale:o,left:a,top:s}=u.scaleToFill(e,t,n,r,0,v);for(let e=0;e<i.length;e++){const t=i[e];let[n,r]=t;n*=o,r*=o,n+=a,r+=s,t[0]=n,t[1]=r}return i});const _={nose:"Nose",leftEye:"Right Eye",rightEye:"Left Eye",leftEar:"Right Ear",rightEar:"Left Ear",leftShoulder:"Right Shoulder",rightShoulder:"Left Shoulder",leftElbow:"Right Elbow",rightElbow:"Left Elbow",leftWrist:"Right Wrist",rightWrist:"Left Wrist",leftHip:"Right Hip",rightHip:"Left Hip",leftKnee:"Right Knee",rightKnee:"Left Knee",leftAnkle:"Right Ankle",rightAnkle:"Left Ankle"};t.keypointParts=["nose","leftEye","rightEye","leftEar","rightEar","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle"];const w=["nose","leftWrist","rightWrist","leftElbow","rightElbow","leftKnee","rightKnee","leftAnkle","rightAnkle"].map(e=>_[e]);t.parts=t.keypointParts;t.ACCPoseInputEvent=class extends l.ACCInputEvent{constructor(e,t){super(e,t)}};const x=[NaN,NaN];class E extends l.AbstractInputElement{constructor(){super(),this.inputType="pose",this.inputName="Body",this.preamplifiedTargetPosition=[0,0],this.amplification=1,this.part="nose",this.target="",this.multiplier=1.01,this.imageScaleFactor=.33,this.help=!1,this.keypointEase=.5,this._webcamCanvas=new d.WebcamCanvas,this._loop=m(),this.__easedKeypointMap={},this.__lastSourcePosition=[0,0],this.hasControls=!0,this._handleNewFrame=this._handleNewFrame.bind(this),this._handleStop=this._handleStop.bind(this),this._loop.on("update",this._handleNewFrame),this._loop.on("start",this._dispatchReady),this._loop.on("stop",this._handleStop)}_createEvent(e,t=!0,n=!0){const r={detail:{inputType:this.inputType,target:this,position:this.position,part:this.part,pose:this.pose},bubbles:t,composed:n};return new l.ACCInputEvent(e,r)}computePartPosition(e,n=[NaN,NaN]){if(!this.pose||!this.pose.keypoints)return n[0]=n[1]=NaN,n;let r,i;if("sternum"===e){const e=this.pose.keypoints[5].position,t=this.pose.keypoints[6].position;r=.5*(e.x-t.x)+t.x,i=.5*(e.y-t.y)+t.y}else{const n=this.pose.keypoints[t.keypointParts.indexOf(e)].position;r=n.x,i=n.y}return n[0]=r,n[1]=i,n}getPartPosition(e,t=[NaN,NaN]){const n=this.__easedKeypointMap[e];return n&&(t[0]=n[0],t[1]=n[1]),t}getPartPositionNormalized(e,t=[NaN,NaN]){const n=this.getPartPosition(e,t),r=f.scalemap(n[0],0,this.canvas.width,-1,1),i=f.scalemap(n[1],0,this.canvas.height,-1,1);return t[0]=r,t[1]=i,t}getPartPositionProjected(e,t=this.contentElement){return this.projectPosition(this.getPartPosition(e),t)}projectPosition(e,n=this.contentElement){const[r,i]=b(n);return t.transformCameraPoints(this.canvas.width,this.canvas.height,r,i,[e])[0]}get canvas(){return this._webcamCanvas.domElement}initialize(){return i(this,void 0,void 0,function*(){if(this._dispatchInitializing(),/(iPad|iPhone|Crios)/g.test(navigator.userAgent)){const e=new Error("Body tracking is not supported on iOS.");throw this._dispatchError(e),e}this._input||(this._input=yield h.load(this.multiplier));try{yield this._webcamCanvas.initialize()}catch(e){throw this._dispatchError(new Error(e)),e}this.sourceCenter||this.resetCenter(),this._loop.setFPS(this._webcamCanvas.getFrameRate()),this._loop.start()})}_handleStop(){this._dispatchStop(),this._webcamCanvas.stop()}_handleNewFrame(){this.__estimating||this._updatePose()}_propertiesChanged(e,t,n){super._propertiesChanged(e,t,n),t&&t.hasOwnProperty("help")&&(u.setBooleanAttribute(this,"help",e.help),this._dispatchChange())}_updatePose(){return i(this,void 0,void 0,function*(){this._estimating=!0,this._webcamCanvas.update();const e=(yield this._input.estimateMultiplePoses(this._webcamCanvas.domElement,this.imageScaleFactor,!1,16,1))[0];if(this._estimating=!1,this.pose=e,this.pose){const e=[NaN,NaN];for(let n=0;n<t.keypointParts.length;n++){const r=t.keypointParts[n],i=this.computePartPosition(r),o=this.__easedKeypointMap[r];if(!o||isNaN(o[0])||isNaN(o[1]))this.__easedKeypointMap[r]=i;else{const t=s.scale(s.sub(i,o,e),this.keypointEase,e);s.add(o,t,o)}}if(this.contentElement){const e=this.getPartPosition(this.part);s.copy(e,this.preamplifiedTargetPosition),this.projectPosition(this.preamplifiedTargetPosition);const t=s.sub(e,this.sourceCenter),n=s.scale(t,this.amplification);if(s.add(this.sourceCenter,n,this.__lastSourcePosition),s.add(this.sourceCenter,n,this._lastFoundTargetPosition),this.projectPosition(this._lastFoundTargetPosition),!this.disableClamp){const e=b(this.contentElement,x);this._lastFoundTargetPosition[0]=u.clamp(this._lastFoundTargetPosition[0],0,e[0]),this._lastFoundTargetPosition[1]=u.clamp(this._lastFoundTargetPosition[1],0,e[1])}}this._lastFoundPosition=this.getPartPositionNormalized(this.part)}this._dispatchTick()})}getAllPositionsProjected(e=t.keypointParts,n=this.contentElement){const[r,i]=b(n);return e.reduce((e,n)=>(e[n]||(e[n]=t.transformCameraPoints(640,480,r,i,[this.getPartPosition(n)])[0]),e),{})}renderCenter(e,t="black",n=3,r=16,i=8){if(!this.isReady)return;s.copy(this.sourceCenter,y);const o=this.projectPosition(y,e.canvas);e.strokeStyle=t,e.lineWidth=n,e.beginPath(),e.moveTo(o[0]-r,o[1]),e.lineTo(o[0]+r,o[1]),e.moveTo(o[0],o[1]-r),e.lineTo(o[0],o[1]+r),e.stroke()}renderCursor(e,t="blue"){if(!this.isReady)return;const{__lastSourcePosition:n}=this,[r,i]=this.projectPosition(this.getPartPosition(this.part),e.canvas),[o,a]=this.projectPosition(n,e.canvas);e.strokeStyle=e.fillStyle=t,e.beginPath(),e.moveTo(r,i),e.lineTo(o,a),e.stroke(),e.beginPath(),e.arc(o,a,16,0,2*Math.PI),e.fill()}renderInputData(e,t="rgba(96,96,96, 0.85)",n=4){if(!this.isReady)return;e.strokeStyle=e.fillStyle=t;const r=[NaN,NaN],i=[];[["nose"],["leftShoulder","rightShoulder","rightHip","leftHip","leftShoulder"],["leftShoulder","leftElbow","leftWrist"],["rightShoulder","rightElbow","rightWrist"]].forEach(t=>{t.length>1&&(e.beginPath(),t.forEach((t,n)=>{this.getPartPosition(t,r),this.projectPosition(r,e.canvas),0===n?e.moveTo(r[0],r[1]):e.lineTo(r[0],r[1])}),e.stroke()),t.forEach(t=>{-1===i.indexOf(t)&&(this.getPartPosition(t,r),this.projectPosition(r,e.canvas),e.beginPath(),e.arc(r[0],r[1],n,0,2*Math.PI),e.fill(),i.push(t))})})}resetCenter(){this.sourceCenter=[this.canvas.width/2,this.canvas.height/2]}setCenterToCurrentPosition(){this.sourceCenter=this.getPartPosition(this.part)}stop(){this._loop.stop()}_didRender(e,t,n){return t&&t.hasOwnProperty("controls")&&t.controls&&setTimeout(()=>{const e=this.shadowRoot.querySelector("acc-pose-input-calibration");e&&g(e)&&e.focusHeader()},16),super._didRender(e,t,n)}_render({amplification:e,controls:t,help:n,imageScaleFactor:r,part:i,smoothing:s}){let u=!1;const l=a.computeStyleResult(this.shadowRoot,"color",o.backgroundColor);if(l){const e=a.cssColorToArray(l);e&&(u=(e[0]+e[1]+e[2])/3<128)}const h=u?"-dark":"";return c.html`
            <style>

            </style>
            <acc-pose-input-calibration
                closable
                tabIndex="0"
                on-center=${()=>this.setCenterToCurrentPosition()}
                on-resetcenter=${()=>this.resetCenter()}
                amplification="${e}"
                imageScaleFactor="${r}"
                smoothing="${s}"
                parts="${w}"
                part="${_[i]}"
                open?=${t}
                fullscreen
                on-change=${e=>{this.amplification=e.detail.amplification,this.part=(()=>{for(let t in _)if(_[t]===e.detail.part)return t})(),this.imageScaleFactor=e.detail.imageScaleFactor,this.smoothing=e.detail.smoothing,this._dispatchChange()}}
                on-help=${()=>this.help=!0}
                on-close=${()=>{console.log("POSE INPUT CONTROLS ON CLOSE"),this.controls=!1}}
                on-close-click=${()=>this.controls=!1}>
            </acc-pose-input-calibration>
            <acc-tutorial
                dark?=${u}
                closebutton="Back to settings"
                aria-live="polite"
                aria-atomic="true"
                on-close=${()=>this.help=!1}
                open?=${n}>
                <acc-slide
                    video="//storage.googleapis.com/acc-components/camera-tutorial-01${h}.mp4"
                    alt="Animation demonstrating moving your nose to control the cursor."
                    caption="Here's how to use your camera. A blue dot will follow the position of your nose."></acc-slide>
                <acc-slide
                    video="//storage.googleapis.com/acc-components/camera-tutorial-02${h}.mp4"
                    alt="Animation showing how to use the slider to amplify your cursors movement."
                    caption="Use the slider to help reach all parts of the screen. This works best if you're centered."></acc-slide>
                <acc-slide
                    video="//storage.googleapis.com/acc-components/camera-tutorial-03${h}.mp4"
                    alt="Animation demonstrating how the centerpoint works and how to move it."
                    caption="Or, you can move the centerpoint to you."></acc-slide>
                <acc-slide
                    video="//storage.googleapis.com/acc-components/camera-tutorial-04${h}.mp4"
                    alt="Animation of using the pop up button to select a different body part to track."
                    caption="You can also track different parts of your body, like your wrist or shoulder."></acc-slide>
            </acc-tutorial>
        `}}r([p.property({type:Number})],E.prototype,"amplification",void 0),r([p.property({type:String})],E.prototype,"part",void 0),r([p.property({type:String})],E.prototype,"target",void 0),r([p.property({type:Number})],E.prototype,"multiplier",void 0),r([p.property({type:Number})],E.prototype,"imageScaleFactor",void 0),r([p.property({type:Boolean})],E.prototype,"help",void 0),r([p.property({type:Number})],E.prototype,"keypointEase",void 0),t.PoseInputElement=E,customElements.define("acc-pose-input",E)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(1),i=n(14);customElements.define("acc-mouse-input-calibration",class extends i.AbstractModalElement{_renderModalBody(e){return r.html`
            <div style="display: none;">
                <h3>Mouse Input</h3>
                <p>placeholder</p>
            </div>
        `}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=e=>0===e.type.indexOf("touch")&&!!e.touches,i=e=>(e=>null!==e&&e===e.window)(e)?e:9===e.nodeType&&(e.defaultView||e.parentWindow),o=e=>"function"==typeof e.appendChild;function a(e,t=!0,n={x:0,y:0}){let r,a;if(o(e)){if(!(a=e.ownerDocument))return n;if(!a.body.contains(e))return n;if(void 0!==e.getBoundingClientRect){const t=e.getBoundingClientRect();n.x=t.left,n.y=t.top}r=i(a)}else n.x=e.left,n.y=e.top,r=window,a=document;const s={x:0,y:0},u=document.documentElement;return t||(s.y=r.pageYOffset||u.scrollTop,s.x=r.pageXOffset||u.scrollLeft),n.y=n.y+s.y-(u.clientTop||0),n.x=n.x+s.x-(u.clientLeft||0),n}t.elementOffset=a;const s={x:0,y:0};function u(e,t,n,r,i){if(!n&&!r)throw new Error("mousePosition requires either element or offset be provided");return n&&!r&&(r=a(n,!1,s)),r=r,(i=i||{x:-1,y:-1}).x=e-r.x,i.y=t-r.y,i}t.mousePosition=u,t.mousePositionFromEvent=function(e,t,n,i){let a,s;if(r(e)?e.touches&&e.touches[0]?(a=e.touches[0].clientX,s=e.touches[0].clientY):(a=NaN,s=NaN):(a=e.clientX,s=e.clientY),!t&&o(e.target)&&(t=e.target),!t)throw new Error("mousePositionFromEvent requires an element parameter");return u(a,s,t,n,i)}},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const o=n(8),a=n(1),s=n(8),u=n(3),c=n(51),l=n(196),h=n(50);var d;!function(e){e[e.MOUSE=0]="MOUSE",e[e.KEYBOARD=1]="KEYBOARD",e[e.TOUCH=2]="TOUCH"}(d||(d={}));class f extends c.AbstractInputElement{constructor(){super(),this.inputType="mouse",this.inputName="Keyboard / Mouse",this.pressed=!1,this.amplification=1,this.enableKeyboard=!1,this.disableTouchPreventsDefault=!1,this._loop=h(),this.__lastDispatchedPressed=!1,this._handleMouseMove=this._handleMouseMove.bind(this),this.__handleKeyDown=this.__handleKeyDown.bind(this),this._loop.on("update",this._dispatchTick),this._loop.on("start",()=>console.log("loop started"))}get mode(){switch(this.__mode){case d.KEYBOARD:return"keyboard";case d.TOUCH:return"touch";default:return"mouse"}}connectedCallback(){super.connectedCallback()}__handleKeyDown(e){if(!this.contentElement||!this.enableKeyboard)return;let t=this.contentElement.clientWidth,n=this.contentElement.clientHeight;if(!t||!n){const e=this.contentElement.getBoundingClientRect();t=e.width,n=e.height}if(!t||!n)return;const r=this.amplification/Math.min(t,n)*2;this.pressed=!1,isFinite(this._lastFoundPosition[0]+this._lastFoundPosition[1])||(this._lastFoundPosition[0]=0,this._lastFoundPosition[1]=0);let i=!1;switch(e.keyCode){case 37:this._lastFoundTargetPosition[0]-=this.amplification,this._lastFoundPosition[0]-=r,i=!0;break;case 38:this._lastFoundTargetPosition[1]-=this.amplification,this._lastFoundPosition[1]-=r,i=!0;break;case 39:this._lastFoundTargetPosition[0]+=this.amplification,this._lastFoundPosition[0]+=r,i=!0;break;case 40:this._lastFoundTargetPosition[1]+=this.amplification,this._lastFoundPosition[1]+=r,i=!0}i&&(this.__mode=d.KEYBOARD),this.disableClamp||(this._lastFoundTargetPosition[0]=o.clamp(this._lastFoundTargetPosition[0],0,t),this._lastFoundTargetPosition[1]=o.clamp(this._lastFoundTargetPosition[1],0,n))}_handleMouseMove(e){const t=l.mousePositionFromEvent(e,this.contentElement);if(this.disableTouchPreventsDefault||-1!==e.type.indexOf("mouse")||e.preventDefault(),this.pressed=e.buttons>0,this.__mode=d.MOUSE,0===e.type.indexOf("touch")&&(this.__mode=d.TOUCH,"touchend"===e.type?this.pressed=!1:this.pressed=!0),isFinite(t.x)&&isFinite(t.y)){const e=this.contentElement.getBoundingClientRect(),n=s.scalemap(t.x,0,e.width,-1,1),r=s.scalemap(t.y,0,e.height,-1,1);this._lastFoundTargetPosition[0]=t.x,this._lastFoundTargetPosition[1]=t.y,this._lastFoundPosition[0]=n,this._lastFoundPosition[1]=r}}initialize(){return i(this,void 0,void 0,function*(){if(!this.isReady)return this._dispatchInitializing(),Promise.resolve().then(()=>(this.__start(),this))})}_render({controls:e}){return a.html`
            <acc-mouse-input-calibration
                tabIndex="0"
                on-close-click=${()=>this.removeAttribute("controls")}
                open?=${e}>
            </acc-mouse-input-calibration>
        `}_shouldDispatchInput(){const e=this.pressed!==this.__lastDispatchedPressed||super._shouldDispatchInput();return this.__lastDispatchedPressed=this.pressed,e}__start(){this.__addEvents(),this._dispatchReady(),this._loop.start()}_contentElementChanged(e,t){this.__removeEvents(t),this.__addEvents()}__addEvents(){this.contentElement&&(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend"].forEach(e=>this.contentElement.addEventListener(e,this._handleMouseMove)),this.contentElement.addEventListener("keydown",this.__handleKeyDown))}__removeEvents(e=this.contentElement){e&&(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend"].forEach(t=>e.removeEventListener(t,this._handleMouseMove)),e.removeEventListener("keydown",this.__handleKeyDown))}stop(){this.__removeEvents(),this._loop.stop(),this._dispatchStop()}}r([u.property({type:Number})],f.prototype,"amplification",void 0),r([u.property({type:Boolean})],f.prototype,"enableKeyboard",void 0),r([u.property({type:Boolean})],f.prototype,"disableTouchPreventsDefault",void 0),customElements.define("acc-mouse-input",f)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),o=n(14),a=n(8),s=n(3);class u extends o.AbstractModalElement{constructor(){super(),this.smoothing=0,this.minHorizontal=-1,this.maxHorizontal=1,this.minVertical=-1,this.maxVertical=1,this.originHorizontal=0,this.originVertical=0,this._handleInputChange=this._handleInputChange.bind(this)}_renderModalBody({sensitivity:e,minHorizontal:t,maxHorizontal:n,minVertical:r,maxVertical:o,smoothing:a,originHorizontal:s,originVertical:u}){return i.html`
            <h4>Sensitivity (alters all)</h4>
            <acc-range
                id="sensitivity"
                name="sensitivity"
                on-input=${this._handleInputChange}
                min="0"
                max="1"
                step="0.01"
                value=${e}> </acc-range>
            <label for="sensitivity">Sensitivity</label>
            <h4>Smoothing</h4>
            <input
                id="smoothing"
                name="smoothing"
                on-input=${this._handleInputChange}
                type="range"
                min="0"
                max="1"
                step="0.05"
                value="${a}">
            <label for="smoothing">Smoothing</label>
            <h4>Horizontal Rotation Range</h4>
            <acc-range
                id="minHorizontal"
                name="minHorizontal"
                on-input=${this._handleInputChange}
                min="-3"
                max="3"
                step="0.01"
                value="${t}"></acc-range>
            <label for="minHorizontal">min ${t}</label>
            <acc-range
                id="originHorizontal"
                name="originHorizontal"
                on-input=${this._handleInputChange}
                min="-3"
                max="3"
                step="0.01"
                value="${s}"></acc-range>
            <label for="originHorizontal">origin ${s}</label>

                <acc-range
                id="maxHorizontal"
                name="maxHorizontal"
                on-input=${this._handleInputChange}
                min="-3"
                max="3"
                step="0.01"
                value="${n}"></acc-range>
            <label for="maxHorizontal">max ${n}</label>
            </div>

            <div>
            <h4>Vertical Rotation Range</h4>
                <acc-range
                id="minVertical"
                name="minVertical"
                on-input=${this._handleInputChange}
                min="-3"
                max="3"
                step="0.01"
                value="${r}"></acc-range>
            <label for="minVertical">min ${r}</label>

            <acc-range
                id="originVertical"
                name="originVertical"
                on-input=${this._handleInputChange}
                min="-3"
                max="3"
                step="0.01"
                value="${u}"></acc-range>
            <label for="originVertical">origin ${u}</label>

            <acc-range
                id="maxVertical"
                name="maxVertical"
                on-input=${this._handleInputChange}
                min="-3"
                max="3"
                step="0.01"
                value="${o}"> </acc-range>
        `}_handleInputChange(e){const t=e.detail.inputEvent.currentTarget,n={minHorizontal:-1,maxHorizontal:1,minVertical:-1,maxVertical:1,originHorizontal:0,originVertical:0};if("sensitivity"===t.name){const e=a.scalemap(Number(t.value),0,1,3,0);Object.keys(n).forEach(t=>{const r=n[t];this.shadowRoot.querySelector(`[name=${t}]`).value=(e*r).toString()})}const r=Object.keys(n).reduce((e,t)=>{const n=this.shadowRoot.querySelector(`[name=${t}]`);return e[t]=Number(n.value),e},{}),i=this.shadowRoot.querySelector('[name="smoothing"]'),o=Number(i.value);this.dispatchEvent(new CustomEvent("input",{detail:{name:t.name,value:t.value,ranges:r,smoothing:o}}))}}r([s.property({type:Number})],u.prototype,"smoothing",void 0),r([s.property({type:Number})],u.prototype,"minHorizontal",void 0),r([s.property({type:Number})],u.prototype,"maxHorizontal",void 0),r([s.property({type:Number})],u.prototype,"minVertical",void 0),r([s.property({type:Number})],u.prototype,"maxVertical",void 0),r([s.property({type:Number})],u.prototype,"originHorizontal",void 0),r([s.property({type:Number})],u.prototype,"originVertical",void 0),customElements.define("acc-face-rotation-input-calibration",u)},function(e,t,n){(function(t){(function(){var n,r,i,o,a,s;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:void 0!==t&&null!==t&&t.hrtime?(e.exports=function(){return(n()-a)/1e6},r=t.hrtime,o=(n=function(){var e;return 1e9*(e=r())[0]+e[1]})(),s=1e9*t.uptime(),a=o-s):Date.now?(e.exports=function(){return Date.now()-i},i=Date.now()):(e.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(this)}).call(this,n(12))},function(e,t,n){(function(t){for(var r=n(199),i="undefined"==typeof window?t:window,o=["moz","webkit"],a="AnimationFrame",s=i["request"+a],u=i["cancel"+a]||i["cancelRequest"+a],c=0;!s&&c<o.length;c++)s=i[o[c]+"Request"+a],u=i[o[c]+"Cancel"+a]||i[o[c]+"CancelRequest"+a];if(!s||!u){var l=0,h=0,d=[];s=function(e){if(0===d.length){var t=r(),n=Math.max(0,1e3/60-(t-l));l=n+t,setTimeout(function(){var e=d.slice(0);d.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(l)}catch(e){setTimeout(function(){throw e},0)}},Math.round(n))}return d.push({handle:++h,callback:e,cancelled:!1}),h},u=function(e){for(var t=0;t<d.length;t++)d[t].handle===e&&(d[t].cancelled=!0)}}e.exports=function(e){return s.call(i,e)},e.exports.cancel=function(){u.apply(i,arguments)},e.exports.polyfill=function(e){e||(e=i),e.requestAnimationFrame=s,e.cancelAnimationFrame=u}}).call(this,n(11))},function(module,exports,__webpack_require__){(function(process){var require=function(){};window.initializeBRF=function initializeBRF(brfv4){var brfv4SDK=function(brfv4SDK){brfv4SDK=brfv4SDK||{};var Module=void 0!==brfv4SDK?brfv4SDK:{},moduleOverrides={},key;for(key in Module)Module.hasOwnProperty(key)&&(moduleOverrides[key]=Module[key]);Module.arguments=[],Module.thisProgram="./this.program",Module.quit=function(e,t){throw t},Module.preRun=[],Module.postRun=[];var ENVIRONMENT_IS_WEB=!1,ENVIRONMENT_IS_WORKER=!1,ENVIRONMENT_IS_NODE=!1,ENVIRONMENT_IS_SHELL=!1,nodeFS,nodePath;if(Module.ENVIRONMENT)if("WEB"===Module.ENVIRONMENT)ENVIRONMENT_IS_WEB=!0;else if("WORKER"===Module.ENVIRONMENT)ENVIRONMENT_IS_WORKER=!0;else if("NODE"===Module.ENVIRONMENT)ENVIRONMENT_IS_NODE=!0;else{if("SHELL"!==Module.ENVIRONMENT)throw new Error("Module['ENVIRONMENT'] value is not valid. must be one of: WEB|WORKER|NODE|SHELL.");ENVIRONMENT_IS_SHELL=!0}else ENVIRONMENT_IS_WEB="object"==typeof window,ENVIRONMENT_IS_WORKER="function"==typeof importScripts,ENVIRONMENT_IS_NODE="object"==typeof process&&"function"==typeof require&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER,ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_NODE?(Module.read=function(e,t){var n;return nodeFS||(nodeFS=require("fs")),nodePath||(nodePath=require("path")),e=nodePath.normalize(e),n=nodeFS.readFileSync(e),t?n:n.toString()},Module.readBinary=function(e){var t=Module.read(e,!0);return t.buffer||(t=new Uint8Array(t)),assert(t.buffer),t},process.argv.length>1&&(Module.thisProgram=process.argv[1].replace(/\\/g,"/")),Module.arguments=process.argv.slice(2),process.on("uncaughtException",function(e){if(!(e instanceof ExitStatus))throw e}),process.on("unhandledRejection",function(e,t){process.exit(1)}),Module.inspect=function(){return"[Emscripten Module object]"}):ENVIRONMENT_IS_SHELL?("undefined"!=typeof read&&(Module.read=function(e){return read(e)}),Module.readBinary=function(e){var t;return"function"==typeof readbuffer?new Uint8Array(readbuffer(e)):(assert("object"==typeof(t=read(e,"binary"))),t)},"undefined"!=typeof scriptArgs?Module.arguments=scriptArgs:void 0!==arguments&&(Module.arguments=arguments),"function"==typeof quit&&(Module.quit=function(e,t){quit(e)})):(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)&&(Module.read=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},ENVIRONMENT_IS_WORKER&&(Module.readBinary=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),Module.readAsync=function(e,t,n){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(){200==r.status||0==r.status&&r.response?t(r.response):n()},r.onerror=n,r.send(null)},void 0!==arguments&&(Module.arguments=arguments),Module.setWindowTitle=function(e){document.title=e});for(key in Module.print="undefined"!=typeof console?console.log.bind(console):"undefined"!=typeof print?print:null,Module.printErr="undefined"!=typeof printErr?printErr:"undefined"!=typeof console&&console.warn.bind(console)||Module.print,Module.print=Module.print,Module.printErr=Module.printErr,moduleOverrides)moduleOverrides.hasOwnProperty(key)&&(Module[key]=moduleOverrides[key]);moduleOverrides=void 0;var STACK_ALIGN=16;function staticAlloc(e){assert(!staticSealed);var t=STATICTOP;return STATICTOP=STATICTOP+e+15&-16,t}function alignMemory(e,t){return t||(t=STACK_ALIGN),e=Math.ceil(e/t)*t}var functionPointers=new Array(0);function dynCall(e,t,n){return n&&n.length?Module["dynCall_"+e].apply(null,[t].concat(n)):Module["dynCall_"+e].call(null,t)}var GLOBAL_BASE=1024,ABORT=0,EXITSTATUS=0;function assert(e,t){e||abort("Assertion failed: "+t)}function getCFunc(e){var t=Module["_"+e];return assert(t,"Cannot call unknown function "+e+", make sure it is exported"),t}var JSfuncs={stackSave:function(){stackSave()},stackRestore:function(){stackRestore()},arrayToC:function(e){var t=stackAlloc(e.length);return writeArrayToMemory(e,t),t},stringToC:function(e){var t=0;if(null!==e&&void 0!==e&&0!==e){var n=1+(e.length<<2);stringToUTF8(e,t=stackAlloc(n),n)}return t}},toC={string:JSfuncs.stringToC,array:JSfuncs.arrayToC};function ccall(e,t,n,r,i){var o=getCFunc(e),a=[],s=0;if(r)for(var u=0;u<r.length;u++){var c=toC[n[u]];c?(0===s&&(s=stackSave()),a[u]=c(r[u])):a[u]=r[u]}var l=o.apply(null,a);return"string"===t&&(l=Pointer_stringify(l)),0!==s&&stackRestore(s),l}function cwrap(e,t,n){n=n||[];var r=getCFunc(e),i=n.every(function(e){return"number"===e});return"string"!==t&&i?r:function(){return ccall(e,t,n,arguments)}}function Pointer_stringify(e,t){if(0===t||!e)return"";for(var n,r=0,i=0;r|=n=HEAPU8[e+i>>0],(0!=n||t)&&(i++,!t||i!=t););t||(t=i);var o="";if(r<128){for(var a;t>0;)a=String.fromCharCode.apply(String,HEAPU8.subarray(e,e+Math.min(t,1024))),o=o?o+a:a,e+=1024,t-=1024;return o}return UTF8ToString(e)}var UTF8Decoder="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function UTF8ArrayToString(e,t){for(var n=t;e[n];)++n;if(n-t>16&&e.subarray&&UTF8Decoder)return UTF8Decoder.decode(e.subarray(t,n));for(var r,i,o,a,s,u="";;){if(!(r=e[t++]))return u;if(128&r)if(i=63&e[t++],192!=(224&r))if(o=63&e[t++],224==(240&r)?r=(15&r)<<12|i<<6|o:(a=63&e[t++],240==(248&r)?r=(7&r)<<18|i<<12|o<<6|a:(s=63&e[t++],r=248==(252&r)?(3&r)<<24|i<<18|o<<12|a<<6|s:(1&r)<<30|i<<24|o<<18|a<<12|s<<6|63&e[t++])),r<65536)u+=String.fromCharCode(r);else{var c=r-65536;u+=String.fromCharCode(55296|c>>10,56320|1023&c)}else u+=String.fromCharCode((31&r)<<6|i);else u+=String.fromCharCode(r)}}function UTF8ToString(e){return UTF8ArrayToString(HEAPU8,e)}function stringToUTF8Array(e,t,n,r){if(!(r>0))return 0;for(var i=n,o=n+r-1,a=0;a<e.length;++a){var s=e.charCodeAt(a);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),s<=127){if(n>=o)break;t[n++]=s}else if(s<=2047){if(n+1>=o)break;t[n++]=192|s>>6,t[n++]=128|63&s}else if(s<=65535){if(n+2>=o)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|63&s}else if(s<=2097151){if(n+3>=o)break;t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}else if(s<=67108863){if(n+4>=o)break;t[n++]=248|s>>24,t[n++]=128|s>>18&63,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}else{if(n+5>=o)break;t[n++]=252|s>>30,t[n++]=128|s>>24&63,t[n++]=128|s>>18&63,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}}return t[n]=0,n-i}function stringToUTF8(e,t,n){return stringToUTF8Array(e,HEAPU8,t,n)}function lengthBytesUTF8(e){for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r>=55296&&r<=57343&&(r=65536+((1023&r)<<10)|1023&e.charCodeAt(++n)),r<=127?++t:t+=r<=2047?2:r<=65535?3:r<=2097151?4:r<=67108863?5:6}return t}var UTF16Decoder="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function stringToUTF32(e,t,n){if(void 0===n&&(n=2147483647),n<4)return 0;for(var r=t,i=r+n-4,o=0;o<e.length;++o){var a=e.charCodeAt(o);if(a>=55296&&a<=57343)a=65536+((1023&a)<<10)|1023&e.charCodeAt(++o);if(HEAP32[t>>2]=a,(t+=4)+4>i)break}return HEAP32[t>>2]=0,t-r}function lengthBytesUTF32(e){for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r>=55296&&r<=57343&&++n,t+=4}return t}function allocateUTF8(e){var t=lengthBytesUTF8(e)+1,n=_malloc(t);return n&&stringToUTF8Array(e,HEAP8,n,t),n}function allocateUTF8OnStack(e){var t=lengthBytesUTF8(e)+1,n=stackAlloc(t);return stringToUTF8Array(e,HEAP8,n,t),n}var WASM_PAGE_SIZE=65536,ASMJS_PAGE_SIZE=16777216,buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64,STATIC_BASE,STATICTOP,staticSealed,STACK_BASE,STACKTOP,STACK_MAX,DYNAMIC_BASE,DYNAMICTOP_PTR;function alignUp(e,t){return e%t>0&&(e+=t-e%t),e}function updateGlobalBuffer(e){Module.buffer=buffer=e}function updateGlobalBufferViews(){Module.HEAP8=HEAP8=new Int8Array(buffer),Module.HEAP16=HEAP16=new Int16Array(buffer),Module.HEAP32=HEAP32=new Int32Array(buffer),Module.HEAPU8=HEAPU8=new Uint8Array(buffer),Module.HEAPU16=HEAPU16=new Uint16Array(buffer),Module.HEAPU32=HEAPU32=new Uint32Array(buffer),Module.HEAPF32=HEAPF32=new Float32Array(buffer),Module.HEAPF64=HEAPF64=new Float64Array(buffer)}function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with  -s TOTAL_MEMORY=X  with X higher than the current value "+TOTAL_MEMORY+", (2) compile with  -s ALLOW_MEMORY_GROWTH=1  which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with  -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0,staticSealed=!1;var TOTAL_STACK=Module.TOTAL_STACK||67108864,TOTAL_MEMORY=Module.TOTAL_MEMORY||268435456;function getTotalMemory(){return TOTAL_MEMORY}if(TOTAL_MEMORY<TOTAL_STACK&&Module.printErr("TOTAL_MEMORY should be larger than TOTAL_STACK, was "+TOTAL_MEMORY+"! (TOTAL_STACK="+TOTAL_STACK+")"),Module.buffer?buffer=Module.buffer:("object"==typeof WebAssembly&&"function"==typeof WebAssembly.Memory?(Module.wasmMemory=new WebAssembly.Memory({initial:TOTAL_MEMORY/WASM_PAGE_SIZE,maximum:TOTAL_MEMORY/WASM_PAGE_SIZE}),buffer=Module.wasmMemory.buffer):buffer=new ArrayBuffer(TOTAL_MEMORY),Module.buffer=buffer),updateGlobalBufferViews(),HEAP32[0]=1668509029,HEAP16[1]=25459,115!==HEAPU8[2]||99!==HEAPU8[3])throw"Runtime error: expected the system to be little-endian!";function callRuntimeCallbacks(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var n=t.func;"number"==typeof n?void 0===t.arg?Module.dynCall_v(n):Module.dynCall_vi(n,t.arg):n(void 0===t.arg?null:t.arg)}else t()}}var __ATPRERUN__=[],__ATINIT__=[],__ATMAIN__=[],__ATEXIT__=[],__ATPOSTRUN__=[],runtimeInitialized=!1,runtimeExited=!1;function preRun(){if(Module.preRun)for("function"==typeof Module.preRun&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){runtimeInitialized||(runtimeInitialized=!0,callRuntimeCallbacks(__ATINIT__))}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__),runtimeExited=!0}function postRun(){if(Module.postRun)for("function"==typeof Module.postRun&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(e){__ATPRERUN__.unshift(e)}function addOnPostRun(e){__ATPOSTRUN__.unshift(e)}function writeArrayToMemory(e,t){HEAP8.set(e,t)}function writeAsciiToMemory(e,t,n){for(var r=0;r<e.length;++r)HEAP8[t++>>0]=e.charCodeAt(r);n||(HEAP8[t>>0]=0)}var Math_abs=Math.abs,Math_cos=Math.cos,Math_sin=Math.sin,Math_tan=Math.tan,Math_acos=Math.acos,Math_asin=Math.asin,Math_atan=Math.atan,Math_atan2=Math.atan2,Math_exp=Math.exp,Math_log=Math.log,Math_sqrt=Math.sqrt,Math_ceil=Math.ceil,Math_floor=Math.floor,Math_pow=Math.pow,Math_imul=Math.imul,Math_fround=Math.fround,Math_round=Math.round,Math_min=Math.min,Math_max=Math.max,Math_clz32=Math.clz32,Math_trunc=Math.trunc,runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null;function addRunDependency(e){runDependencies++,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies)}function removeRunDependency(e){if(runDependencies--,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies),0==runDependencies&&(null!==runDependencyWatcher&&(clearInterval(runDependencyWatcher),runDependencyWatcher=null),dependenciesFulfilled)){var t=dependenciesFulfilled;dependenciesFulfilled=null,t()}}Module.preloadedImages={},Module.preloadedAudios={};var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(e){return String.prototype.startsWith?e.startsWith(dataURIPrefix):0===e.indexOf(dataURIPrefix)}function integrateWasmJS(){var e="BRFv4_JS_TK190218_v4.0.5_trial.wast",t="",n="BRFv4_JS_TK190218_v4.0.5_trial.temp.asm.js";"function"==typeof Module.locateFile&&(isDataURI(e)||(e=Module.locateFile(e)),isDataURI(t)||(t=Module.locateFile(t)),isDataURI(n)||(n=Module.locateFile(n)));var r={global:null,env:null,asm2wasm:{"f64-rem":function(e,t){return e%t},debugger:function(){}},parent:Module},i=null;function o(){try{if(Module.wasmBinary)return new Uint8Array(Module.wasmBinary);if(Module.readBinary)return Module.readBinary(t);throw"on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS)"}catch(e){abort(e)}}function a(e,n,a){if("object"!=typeof WebAssembly)return Module.printErr("no native wasm support detected"),!1;if(!(Module.wasmMemory instanceof WebAssembly.Memory))return Module.printErr("no native wasm Memory in use"),!1;function s(e,t){(i=e.exports).memory&&function(e){var t=Module.buffer;e.byteLength<t.byteLength&&Module.printErr("the new buffer in mergeMemory is smaller than the previous one. in native wasm, we should grow memory here");var n=new Int8Array(t);new Int8Array(e).set(n),updateGlobalBuffer(e),updateGlobalBufferViews()}(i.memory),Module.asm=i,Module.usingWasm=!0,removeRunDependency("wasm-instantiate")}if(n.memory=Module.wasmMemory,r.global={NaN:NaN,Infinity:1/0},r["global.Math"]=Math,r.env=n,addRunDependency("wasm-instantiate"),Module.instantiateWasm)try{return Module.instantiateWasm(r,s)}catch(e){return Module.printErr("Module.instantiateWasm callback failed with error: "+e),!1}function u(e){s(e.instance,e.module)}function c(e){(Module.wasmBinary||!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER||"function"!=typeof fetch?new Promise(function(e,t){e(o())}):fetch(t,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+t+"'";return e.arrayBuffer()}).catch(function(){return o()})).then(function(e){return WebAssembly.instantiate(e,r)}).then(e).catch(function(e){Module.printErr("failed to asynchronously prepare wasm: "+e),abort(e)})}return Module.wasmBinary||"function"!=typeof WebAssembly.instantiateStreaming||isDataURI(t)||"function"!=typeof fetch?c(u):WebAssembly.instantiateStreaming(fetch(t,{credentials:"same-origin"}),r).then(u).catch(function(e){Module.printErr("wasm streaming compile failed: "+e),Module.printErr("falling back to ArrayBuffer instantiation"),c(u)}),{}}Module.asmPreload=Module.asm;var s=Module.reallocBuffer;Module.reallocBuffer=function(e){return"asmjs"===u?s(e):function(e){e=alignUp(e,Module.usingWasm?WASM_PAGE_SIZE:ASMJS_PAGE_SIZE);var t=Module.buffer.byteLength;if(Module.usingWasm)try{return-1!==Module.wasmMemory.grow((e-t)/65536)?Module.buffer=Module.wasmMemory.buffer:null}catch(e){return null}}(e)};var u="";Module.asm=function(e,t,n){if(!(t=function(e){return e}(t)).table){var r=Module.wasmTableSize;void 0===r&&(r=1024);var i=Module.wasmMaxTableSize;"object"==typeof WebAssembly&&"function"==typeof WebAssembly.Table?t.table=void 0!==i?new WebAssembly.Table({initial:r,maximum:i,element:"anyfunc"}):new WebAssembly.Table({initial:r,element:"anyfunc"}):t.table=new Array(r),Module.wasmTable=t.table}var o;return t.memoryBase||(t.memoryBase=Module.STATIC_BASE),t.tableBase||(t.tableBase=0),(o=a(0,t))||abort("no binaryen method succeeded. consider enabling more options, like interpreting, if you want that: https://github.com/kripken/emscripten/wiki/WebAssembly#binaryen-methods"),o}}integrateWasmJS();var ASM_CONSTS=[function($0){eval(brfv4.Module.Pointer_stringify($0))},function(e,t,n,r,i,o,a,s,u,c){return brfv4.Module.ok(brfv4.Module,e,t,n,r,i,o,a,s,u,c)},function(){brfv4.onBRFv4Loaded()},function(){brfv4.onBRFv4Initialized()}];function _emscripten_asm_const_i(e){return ASM_CONSTS[e]()}function _emscripten_asm_const_ii(e,t){return ASM_CONSTS[e](t)}function _emscripten_asm_const_iiiiiiiiiii(e,t,n,r,i,o,a,s,u,c,l){return ASM_CONSTS[e](t,n,r,i,o,a,s,u,c,l)}STATIC_BASE=GLOBAL_BASE,STATICTOP=STATIC_BASE+8650592,__ATINIT__.push({func:function(){__GLOBAL__I_000101()}},{func:function(){__GLOBAL__sub_I_BRFManagerJS_cpp()}},{func:function(){__GLOBAL__sub_I_iostream_cpp()}});var STATIC_BUMP=8650592;function __ZSt18uncaught_exceptionv(){return!!__ZSt18uncaught_exceptionv.uncaught_exception}function ___assert_fail(e,t,n,r){abort("Assertion failed: "+Pointer_stringify(e)+", at: "+[t?Pointer_stringify(t):"unknown filename",n,r?Pointer_stringify(r):"unknown function"])}function ___cxa_pure_virtual(){throw ABORT=!0,"Pure virtual function called!"}function ___lock(){}Module.STATIC_BASE=STATIC_BASE,Module.STATIC_BUMP=STATIC_BUMP,STATICTOP+=16;var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86};function ___setErrNo(e){return Module.___errno_location&&(HEAP32[Module.___errno_location()>>2]=e),e}function ___map_file(e,t){return ___setErrNo(ERRNO_CODES.EPERM),-1}var SYSCALLS={varargs:0,get:function(e){return SYSCALLS.varargs+=4,HEAP32[SYSCALLS.varargs-4>>2]},getStr:function(){return Pointer_stringify(SYSCALLS.get())},get64:function(){var e=SYSCALLS.get(),t=SYSCALLS.get();return assert(e>=0?0===t:-1===t),e},getZero:function(){assert(0===SYSCALLS.get())}};function ___syscall140(e,t){SYSCALLS.varargs=t;try{var n=SYSCALLS.getStreamFromFD(),r=(SYSCALLS.get(),SYSCALLS.get()),i=SYSCALLS.get(),o=SYSCALLS.get(),a=r;return FS.llseek(n,a,o),HEAP32[i>>2]=n.position,n.getdents&&0===a&&0===o&&(n.getdents=null),0}catch(e){return"undefined"!=typeof FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall145(e,t){SYSCALLS.varargs=t;try{var n=SYSCALLS.getStreamFromFD(),r=SYSCALLS.get(),i=SYSCALLS.get();return SYSCALLS.doReadv(n,r,i)}catch(e){return"undefined"!=typeof FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall146(e,t){SYSCALLS.varargs=t;try{var n=SYSCALLS.get(),r=SYSCALLS.get(),i=SYSCALLS.get(),o=0;___syscall146.buffers||(___syscall146.buffers=[null,[],[]],___syscall146.printChar=function(e,t){var n=___syscall146.buffers[e];assert(n),0===t||10===t?((1===e?Module.print:Module.printErr)(UTF8ArrayToString(n,0)),n.length=0):n.push(t)});for(var a=0;a<i;a++){for(var s=HEAP32[r+8*a>>2],u=HEAP32[r+(8*a+4)>>2],c=0;c<u;c++)___syscall146.printChar(n,HEAPU8[s+c]);o+=u}return o}catch(e){return"undefined"!=typeof FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall54(e,t){SYSCALLS.varargs=t;try{return 0}catch(e){return"undefined"!=typeof FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall6(e,t){SYSCALLS.varargs=t;try{var n=SYSCALLS.getStreamFromFD();return FS.close(n),0}catch(e){return"undefined"!=typeof FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___syscall91(e,t){SYSCALLS.varargs=t;try{var n=SYSCALLS.get(),r=SYSCALLS.get(),i=SYSCALLS.mappings[n];if(!i)return 0;if(r===i.len){var o=FS.getStream(i.fd);SYSCALLS.doMsync(n,o,r,i.flags),FS.munmap(o),SYSCALLS.mappings[n]=null,i.allocated&&_free(i.malloc)}return 0}catch(e){return"undefined"!=typeof FS&&e instanceof FS.ErrnoError||abort(e),-e.errno}}function ___unlock(){}function _abort(){Module.abort()}var _environ=STATICTOP;function ___buildEnvironment(e){var t,n;___buildEnvironment.called?(n=HEAP32[_environ>>2],t=HEAP32[n>>2]):(___buildEnvironment.called=!0,ENV.USER=ENV.LOGNAME="web_user",ENV.PATH="/",ENV.PWD="/",ENV.HOME="/home/web_user",ENV.LANG="C.UTF-8",ENV._=Module.thisProgram,t=staticAlloc(1024),n=staticAlloc(256),HEAP32[n>>2]=t,HEAP32[_environ>>2]=n);var r=[],i=0;for(var o in e)if("string"==typeof e[o]){var a=o+"="+e[o];r.push(a),i+=a.length}if(i>1024)throw new Error("Environment size exceeded TOTAL_ENV_SIZE!");for(var s=0;s<r.length;s++){writeAsciiToMemory(a=r[s],t),HEAP32[n+4*s>>2]=t,t+=a.length+1}HEAP32[n+4*r.length>>2]=0}STATICTOP+=16;var ENV={};function _getenv(e){return 0===e?0:(e=Pointer_stringify(e),ENV.hasOwnProperty(e)?(_getenv.ret&&_free(_getenv.ret),_getenv.ret=allocateUTF8(ENV[e]),_getenv.ret):0)}function _emscripten_memcpy_big(e,t,n){return HEAPU8.set(HEAPU8.subarray(t,t+n),e),e}function _pthread_cond_wait(){return 0}function __isLeapYear(e){return e%4==0&&(e%100!=0||e%400==0)}function __arraySum(e,t){for(var n=0,r=0;r<=t;n+=e[r++]);return n}var __MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31],__MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];function __addDays(e,t){for(var n=new Date(e.getTime());t>0;){var r=__isLeapYear(n.getFullYear()),i=n.getMonth(),o=(r?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR)[i];if(!(t>o-n.getDate()))return n.setDate(n.getDate()+t),n;t-=o-n.getDate()+1,n.setDate(1),i<11?n.setMonth(i+1):(n.setMonth(0),n.setFullYear(n.getFullYear()+1))}return n}function _strftime(e,t,n,r){var i=HEAP32[r+40>>2],o={tm_sec:HEAP32[r>>2],tm_min:HEAP32[r+4>>2],tm_hour:HEAP32[r+8>>2],tm_mday:HEAP32[r+12>>2],tm_mon:HEAP32[r+16>>2],tm_year:HEAP32[r+20>>2],tm_wday:HEAP32[r+24>>2],tm_yday:HEAP32[r+28>>2],tm_isdst:HEAP32[r+32>>2],tm_gmtoff:HEAP32[r+36>>2],tm_zone:i?Pointer_stringify(i):""},a=Pointer_stringify(n),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S"};for(var u in s)a=a.replace(new RegExp(u,"g"),s[u]);var c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l=["January","February","March","April","May","June","July","August","September","October","November","December"];function h(e,t,n){for(var r="number"==typeof e?e.toString():e||"";r.length<t;)r=n[0]+r;return r}function d(e,t){return h(e,t,"0")}function f(e,t){function n(e){return e<0?-1:e>0?1:0}var r;return 0===(r=n(e.getFullYear()-t.getFullYear()))&&0===(r=n(e.getMonth()-t.getMonth()))&&(r=n(e.getDate()-t.getDate())),r}function p(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function m(e){var t=__addDays(new Date(e.tm_year+1900,0,1),e.tm_yday),n=new Date(t.getFullYear(),0,4),r=new Date(t.getFullYear()+1,0,4),i=p(n),o=p(r);return f(i,t)<=0?f(o,t)<=0?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var g={"%a":function(e){return c[e.tm_wday].substring(0,3)},"%A":function(e){return c[e.tm_wday]},"%b":function(e){return l[e.tm_mon].substring(0,3)},"%B":function(e){return l[e.tm_mon]},"%C":function(e){return d((e.tm_year+1900)/100|0,2)},"%d":function(e){return d(e.tm_mday,2)},"%e":function(e){return h(e.tm_mday,2," ")},"%g":function(e){return m(e).toString().substring(2)},"%G":function(e){return m(e)},"%H":function(e){return d(e.tm_hour,2)},"%I":function(e){var t=e.tm_hour;return 0==t?t=12:t>12&&(t-=12),d(t,2)},"%j":function(e){return d(e.tm_mday+__arraySum(__isLeapYear(e.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,e.tm_mon-1),3)},"%m":function(e){return d(e.tm_mon+1,2)},"%M":function(e){return d(e.tm_min,2)},"%n":function(){return"\n"},"%p":function(e){return e.tm_hour>=0&&e.tm_hour<12?"AM":"PM"},"%S":function(e){return d(e.tm_sec,2)},"%t":function(){return"\t"},"%u":function(e){return new Date(e.tm_year+1900,e.tm_mon+1,e.tm_mday,0,0,0,0).getDay()||7},"%U":function(e){var t=new Date(e.tm_year+1900,0,1),n=0===t.getDay()?t:__addDays(t,7-t.getDay()),r=new Date(e.tm_year+1900,e.tm_mon,e.tm_mday);if(f(n,r)<0){var i=__arraySum(__isLeapYear(r.getFullYear())?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,r.getMonth()-1)-31,o=31-n.getDate()+i+r.getDate();return d(Math.ceil(o/7),2)}return 0===f(n,t)?"01":"00"},"%V":function(e){var t,n=new Date(e.tm_year+1900,0,4),r=new Date(e.tm_year+1901,0,4),i=p(n),o=p(r),a=__addDays(new Date(e.tm_year+1900,0,1),e.tm_yday);return f(a,i)<0?"53":f(o,a)<=0?"01":(t=i.getFullYear()<e.tm_year+1900?e.tm_yday+32-i.getDate():e.tm_yday+1-i.getDate(),d(Math.ceil(t/7),2))},"%w":function(e){return new Date(e.tm_year+1900,e.tm_mon+1,e.tm_mday,0,0,0,0).getDay()},"%W":function(e){var t=new Date(e.tm_year,0,1),n=1===t.getDay()?t:__addDays(t,0===t.getDay()?1:7-t.getDay()+1),r=new Date(e.tm_year+1900,e.tm_mon,e.tm_mday);if(f(n,r)<0){var i=__arraySum(__isLeapYear(r.getFullYear())?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,r.getMonth()-1)-31,o=31-n.getDate()+i+r.getDate();return d(Math.ceil(o/7),2)}return 0===f(n,t)?"01":"00"},"%y":function(e){return(e.tm_year+1900).toString().substring(2)},"%Y":function(e){return e.tm_year+1900},"%z":function(e){var t=e.tm_gmtoff,n=t>=0;return t=(t=Math.abs(t)/60)/60*100+t%60,(n?"+":"-")+String("0000"+t).slice(-4)},"%Z":function(e){return e.tm_zone},"%%":function(){return"%"}};for(var u in g)a.indexOf(u)>=0&&(a=a.replace(new RegExp(u,"g"),g[u](o)));var b=intArrayFromString(a,!1);return b.length>t?0:(writeArrayToMemory(b,e),b.length-1)}function _strftime_l(e,t,n,r){return _strftime(e,t,n,r)}function intArrayFromString(e,t,n){var r=n>0?n:lengthBytesUTF8(e)+1,i=new Array(r),o=stringToUTF8Array(e,i,0,i.length);return t&&(i.length=o),i}___buildEnvironment(ENV),DYNAMICTOP_PTR=staticAlloc(4),STACK_BASE=STACKTOP=alignMemory(STATICTOP),STACK_MAX=STACK_BASE+TOTAL_STACK,DYNAMIC_BASE=alignMemory(STACK_MAX),HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE,staticSealed=!0,Module.wasmTableSize=714,Module.wasmMaxTableSize=714,Module.asmGlobalArg={},Module.asmLibraryArg={abort:abort,enlargeMemory:enlargeMemory,getTotalMemory:getTotalMemory,abortOnCannotGrowMemory:abortOnCannotGrowMemory,__ZSt18uncaught_exceptionv:__ZSt18uncaught_exceptionv,___assert_fail:___assert_fail,___cxa_pure_virtual:___cxa_pure_virtual,___lock:___lock,___map_file:___map_file,___setErrNo:___setErrNo,___syscall140:___syscall140,___syscall145:___syscall145,___syscall146:___syscall146,___syscall54:___syscall54,___syscall6:___syscall6,___syscall91:___syscall91,___unlock:___unlock,_abort:_abort,_emscripten_asm_const_i:_emscripten_asm_const_i,_emscripten_asm_const_ii:_emscripten_asm_const_ii,_emscripten_asm_const_iiiiiiiiiii:_emscripten_asm_const_iiiiiiiiiii,_emscripten_memcpy_big:_emscripten_memcpy_big,_getenv:_getenv,_pthread_cond_wait:_pthread_cond_wait,_strftime_l:_strftime_l,DYNAMICTOP_PTR:DYNAMICTOP_PTR,STACKTOP:STACKTOP};var asm=Module.asm(Module.asmGlobalArg,Module.asmLibraryArg,buffer);Module.asm=asm;var __GLOBAL__I_000101=Module.__GLOBAL__I_000101=function(){return Module.asm.__GLOBAL__I_000101.apply(null,arguments)},__GLOBAL__sub_I_BRFManagerJS_cpp=Module.__GLOBAL__sub_I_BRFManagerJS_cpp=function(){return Module.asm.__GLOBAL__sub_I_BRFManagerJS_cpp.apply(null,arguments)},__GLOBAL__sub_I_iostream_cpp=Module.__GLOBAL__sub_I_iostream_cpp=function(){return Module.asm.__GLOBAL__sub_I_iostream_cpp.apply(null,arguments)},__brf_addOpticalFlowPoints=Module.__brf_addOpticalFlowPoints=function(){return Module.asm.__brf_addOpticalFlowPoints.apply(null,arguments)},__brf_get_allDetectedFaces=Module.__brf_get_allDetectedFaces=function(){return Module.asm.__brf_get_allDetectedFaces.apply(null,arguments)},__brf_get_allDetectedFaces_length=Module.__brf_get_allDetectedFaces_length=function(){return Module.asm.__brf_get_allDetectedFaces_length.apply(null,arguments)},__brf_get_face_bounds=Module.__brf_get_face_bounds=function(){return Module.asm.__brf_get_face_bounds.apply(null,arguments)},__brf_get_face_candideTriangles=Module.__brf_get_face_candideTriangles=function(){return Module.asm.__brf_get_face_candideTriangles.apply(null,arguments)},__brf_get_face_candideTriangles_length=Module.__brf_get_face_candideTriangles_length=function(){return Module.asm.__brf_get_face_candideTriangles_length.apply(null,arguments)},__brf_get_face_candideVertices=Module.__brf_get_face_candideVertices=function(){return Module.asm.__brf_get_face_candideVertices.apply(null,arguments)},__brf_get_face_candideVertices_length=Module.__brf_get_face_candideVertices_length=function(){return Module.asm.__brf_get_face_candideVertices_length.apply(null,arguments)},__brf_get_face_lastState=Module.__brf_get_face_lastState=function(){return Module.asm.__brf_get_face_lastState.apply(null,arguments)},__brf_get_face_nextState=Module.__brf_get_face_nextState=function(){return Module.asm.__brf_get_face_nextState.apply(null,arguments)},__brf_get_face_points=Module.__brf_get_face_points=function(){return Module.asm.__brf_get_face_points.apply(null,arguments)},__brf_get_face_points_length=Module.__brf_get_face_points_length=function(){return Module.asm.__brf_get_face_points_length.apply(null,arguments)},__brf_get_face_refRect=Module.__brf_get_face_refRect=function(){return Module.asm.__brf_get_face_refRect.apply(null,arguments)},__brf_get_face_rotationX=Module.__brf_get_face_rotationX=function(){return Module.asm.__brf_get_face_rotationX.apply(null,arguments)},__brf_get_face_rotationY=Module.__brf_get_face_rotationY=function(){return Module.asm.__brf_get_face_rotationY.apply(null,arguments)},__brf_get_face_rotationZ=Module.__brf_get_face_rotationZ=function(){return Module.asm.__brf_get_face_rotationZ.apply(null,arguments)},__brf_get_face_scale=Module.__brf_get_face_scale=function(){return Module.asm.__brf_get_face_scale.apply(null,arguments)},__brf_get_face_state=Module.__brf_get_face_state=function(){return Module.asm.__brf_get_face_state.apply(null,arguments)},__brf_get_face_translationX=Module.__brf_get_face_translationX=function(){return Module.asm.__brf_get_face_translationX.apply(null,arguments)},__brf_get_face_translationY=Module.__brf_get_face_translationY=function(){return Module.asm.__brf_get_face_translationY.apply(null,arguments)},__brf_get_face_triangles=Module.__brf_get_face_triangles=function(){return Module.asm.__brf_get_face_triangles.apply(null,arguments)},__brf_get_face_triangles_length=Module.__brf_get_face_triangles_length=function(){return Module.asm.__brf_get_face_triangles_length.apply(null,arguments)},__brf_get_face_vertices=Module.__brf_get_face_vertices=function(){return Module.asm.__brf_get_face_vertices.apply(null,arguments)},__brf_get_face_vertices_length=Module.__brf_get_face_vertices_length=function(){return Module.asm.__brf_get_face_vertices_length.apply(null,arguments)},__brf_get_faces_length=Module.__brf_get_faces_length=function(){return Module.asm.__brf_get_faces_length.apply(null,arguments)},__brf_get_mergedDetectedFaces=Module.__brf_get_mergedDetectedFaces=function(){return Module.asm.__brf_get_mergedDetectedFaces.apply(null,arguments)},__brf_get_mergedDetectedFaces_length=Module.__brf_get_mergedDetectedFaces_length=function(){return Module.asm.__brf_get_mergedDetectedFaces_length.apply(null,arguments)},__brf_get_mode=Module.__brf_get_mode=function(){return Module.asm.__brf_get_mode.apply(null,arguments)},__brf_get_opticalFlowCheckPointsValidBeforeTracking=Module.__brf_get_opticalFlowCheckPointsValidBeforeTracking=function(){return Module.asm.__brf_get_opticalFlowCheckPointsValidBeforeTracking.apply(null,arguments)},__brf_get_opticalFlowPointStates=Module.__brf_get_opticalFlowPointStates=function(){return Module.asm.__brf_get_opticalFlowPointStates.apply(null,arguments)},__brf_get_opticalFlowPointStates_length=Module.__brf_get_opticalFlowPointStates_length=function(){return Module.asm.__brf_get_opticalFlowPointStates_length.apply(null,arguments)},__brf_get_opticalFlowPoints=Module.__brf_get_opticalFlowPoints=function(){return Module.asm.__brf_get_opticalFlowPoints.apply(null,arguments)},__brf_get_opticalFlowPoints_length=Module.__brf_get_opticalFlowPoints_length=function(){return Module.asm.__brf_get_opticalFlowPoints_length.apply(null,arguments)},__brf_init=Module.__brf_init=function(){return Module.asm.__brf_init.apply(null,arguments)},__brf_reset=Module.__brf_reset=function(){return Module.asm.__brf_reset.apply(null,arguments)},__brf_set_faceDetectionParams=Module.__brf_set_faceDetectionParams=function(){return Module.asm.__brf_set_faceDetectionParams.apply(null,arguments)},__brf_set_faceDetectionRoi=Module.__brf_set_faceDetectionRoi=function(){return Module.asm.__brf_set_faceDetectionRoi.apply(null,arguments)},__brf_set_faceTrackingResetParams=Module.__brf_set_faceTrackingResetParams=function(){return Module.asm.__brf_set_faceTrackingResetParams.apply(null,arguments)},__brf_set_faceTrackingStartParams=Module.__brf_set_faceTrackingStartParams=function(){return Module.asm.__brf_set_faceTrackingStartParams.apply(null,arguments)},__brf_set_mode=Module.__brf_set_mode=function(){return Module.asm.__brf_set_mode.apply(null,arguments)},__brf_set_numFacesToTrack=Module.__brf_set_numFacesToTrack=function(){return Module.asm.__brf_set_numFacesToTrack.apply(null,arguments)},__brf_set_opticalFlowCheckPointsValidBeforeTracking=Module.__brf_set_opticalFlowCheckPointsValidBeforeTracking=function(){return Module.asm.__brf_set_opticalFlowCheckPointsValidBeforeTracking.apply(null,arguments)},__brf_set_opticalFlowParams=Module.__brf_set_opticalFlowParams=function(){return Module.asm.__brf_set_opticalFlowParams.apply(null,arguments)},__brf_update=Module.__brf_update=function(){return Module.asm.__brf_update.apply(null,arguments)},_free=Module._free=function(){return Module.asm._free.apply(null,arguments)},_main=Module._main=function(){return Module.asm._main.apply(null,arguments)},_malloc=Module._malloc=function(){return Module.asm._malloc.apply(null,arguments)},stackAlloc=Module.stackAlloc=function(){return Module.asm.stackAlloc.apply(null,arguments)},stackRestore=Module.stackRestore=function(){return Module.asm.stackRestore.apply(null,arguments)},stackSave=Module.stackSave=function(){return Module.asm.stackSave.apply(null,arguments)},dynCall_ii=Module.dynCall_ii=function(){return Module.asm.dynCall_ii.apply(null,arguments)},dynCall_iii=Module.dynCall_iii=function(){return Module.asm.dynCall_iii.apply(null,arguments)},dynCall_iiii=Module.dynCall_iiii=function(){return Module.asm.dynCall_iiii.apply(null,arguments)},dynCall_iiiii=Module.dynCall_iiiii=function(){return Module.asm.dynCall_iiiii.apply(null,arguments)},dynCall_iiiiid=Module.dynCall_iiiiid=function(){return Module.asm.dynCall_iiiiid.apply(null,arguments)},dynCall_iiiiii=Module.dynCall_iiiiii=function(){return Module.asm.dynCall_iiiiii.apply(null,arguments)},dynCall_iiiiiid=Module.dynCall_iiiiiid=function(){return Module.asm.dynCall_iiiiiid.apply(null,arguments)},dynCall_iiiiiii=Module.dynCall_iiiiiii=function(){return Module.asm.dynCall_iiiiiii.apply(null,arguments)},dynCall_iiiiiiii=Module.dynCall_iiiiiiii=function(){return Module.asm.dynCall_iiiiiiii.apply(null,arguments)},dynCall_iiiiiiiii=Module.dynCall_iiiiiiiii=function(){return Module.asm.dynCall_iiiiiiiii.apply(null,arguments)},dynCall_iiiiij=Module.dynCall_iiiiij=function(){return Module.asm.dynCall_iiiiij.apply(null,arguments)},dynCall_v=Module.dynCall_v=function(){return Module.asm.dynCall_v.apply(null,arguments)},dynCall_vi=Module.dynCall_vi=function(){return Module.asm.dynCall_vi.apply(null,arguments)},dynCall_viddddd=Module.dynCall_viddddd=function(){return Module.asm.dynCall_viddddd.apply(null,arguments)},dynCall_vii=Module.dynCall_vii=function(){return Module.asm.dynCall_vii.apply(null,arguments)},dynCall_viii=Module.dynCall_viii=function(){return Module.asm.dynCall_viii.apply(null,arguments)},dynCall_viiii=Module.dynCall_viiii=function(){return Module.asm.dynCall_viiii.apply(null,arguments)},dynCall_viiiid=Module.dynCall_viiiid=function(){return Module.asm.dynCall_viiiid.apply(null,arguments)},dynCall_viiiii=Module.dynCall_viiiii=function(){return Module.asm.dynCall_viiiii.apply(null,arguments)},dynCall_viiiiii=Module.dynCall_viiiiii=function(){return Module.asm.dynCall_viiiiii.apply(null,arguments)},dynCall_viijii=Module.dynCall_viijii=function(){return Module.asm.dynCall_viijii.apply(null,arguments)},initialStackTop;function ExitStatus(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}Module.asm=asm,Module.cwrap=cwrap,Module.Pointer_stringify=Pointer_stringify,Module.stringToUTF32=stringToUTF32,Module.lengthBytesUTF32=lengthBytesUTF32,Module.dynCall=dynCall,Module.then=function(e){if(Module.calledRun)e(Module);else{var t=Module.onRuntimeInitialized;Module.onRuntimeInitialized=function(){t&&t(),e(Module)}}return Module},ExitStatus.prototype=new Error,ExitStatus.prototype.constructor=ExitStatus;var calledMain=!1;function run(e){function t(){Module.calledRun||(Module.calledRun=!0,ABORT||(ensureInitRuntime(),preMain(),Module.onRuntimeInitialized&&Module.onRuntimeInitialized(),Module._main&&shouldRunNow&&Module.callMain(e),postRun()))}e=e||Module.arguments,runDependencies>0||(preRun(),runDependencies>0||Module.calledRun||(Module.setStatus?(Module.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Module.setStatus("")},1),t()},1)):t()))}function exit(e,t){t&&Module.noExitRuntime&&0===e||(Module.noExitRuntime||(ABORT=!0,EXITSTATUS=e,STACKTOP=initialStackTop,exitRuntime(),Module.onExit&&Module.onExit(e)),ENVIRONMENT_IS_NODE&&process.exit(e),Module.quit(e,new ExitStatus(e)))}function abort(e){throw Module.onAbort&&Module.onAbort(e),void 0!==e?(Module.print(e),Module.printErr(e),e=JSON.stringify(e)):e="",ABORT=!0,EXITSTATUS=1,"abort("+e+"). Build with -s ASSERTIONS=1 for more info."}if(dependenciesFulfilled=function e(){Module.calledRun||run(),Module.calledRun||(dependenciesFulfilled=e)},Module.callMain=function(e){e=e||[],ensureInitRuntime();var t=e.length+1,n=stackAlloc(4*(t+1));HEAP32[n>>2]=allocateUTF8OnStack(Module.thisProgram);for(var r=1;r<t;r++)HEAP32[(n>>2)+r]=allocateUTF8OnStack(e[r-1]);HEAP32[(n>>2)+t]=0;try{exit(Module._main(t,n,0),!0)}catch(e){if(e instanceof ExitStatus)return;if("SimulateInfiniteLoop"==e)return void(Module.noExitRuntime=!0);var i=e;e&&"object"==typeof e&&e.stack&&(i=[e,e.stack]),Module.printErr("exception thrown: "+i),Module.quit(1,e)}finally{calledMain=!0}},Module.run=run,Module.exit=exit,Module.abort=abort,Module.preInit)for("function"==typeof Module.preInit&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.pop()();var shouldRunNow=!0;return Module.noInitialRun&&(shouldRunNow=!1),Module.noExitRuntime=!0,run(),brfv4SDK};module.exports=brfv4SDK,function(e){e.defaultValue=function(e,t){return void 0!==e?e:t},e.Point=function(t,n){this.x=e.defaultValue(t,0),this.y=e.defaultValue(n,0)},e.Point.prototype.setTo=function(t,n){this.x=e.defaultValue(t,0),this.y=e.defaultValue(n,0)},e.Rectangle=function(t,n,r,i){this.x=e.defaultValue(t,0),this.y=e.defaultValue(n,0),this.width=e.defaultValue(r,0),this.height=e.defaultValue(i,0)},e.Rectangle.prototype.setTo=function(t,n,r,i){this.x=e.defaultValue(t,0),this.y=e.defaultValue(n,0),this.width=e.defaultValue(r,0),this.height=e.defaultValue(i,0)},e.BRFMode={FACE_DETECTION:"mode_face_detection",FACE_TRACKING:"mode_face_tracking",POINT_TRACKING:"mode_point_tracking"},e.BRFState={FACE_DETECTION:"state_face_detection",FACE_TRACKING_START:"state_face_tracking_start",FACE_TRACKING:"state_face_tracking",RESET:"state_reset"},e.BRFFace=function(){this.lastState=e.BRFState.RESET,this.state=e.BRFState.RESET,this.nextState=e.BRFState.RESET,this.vertices=[],this.triangles=[],this.points=[],this.bounds=new e.Rectangle(0,0,0,0),this.refRect=new e.Rectangle(0,0,0,0),this.candideVertices=[],this.candideTriangles=[],this.scale=1,this.translationX=0,this.translationY=0,this.rotationX=0,this.rotationY=0,this.rotationZ=0}}(brfv4),function(e){e.sdkReady=!1,e.sdkInitialized=!1,e.onBRFv4Loaded=function(){e.sdkReady=!0},e.onBRFv4Initialized=function(){e.sdkInitialized=!0},e.BRFv4Context=function(){var t=this,n="number",r="number",i=[],o=new Float32Array(1).BYTES_PER_ELEMENT,a=new Uint8Array(1).BYTES_PER_ELEMENT,s=e,u=function(e,t,n,r){var i=n*o,a=s._malloc(i);e(a);t(r,new Float32Array(s.HEAPU8.buffer,a,n)),s._free(a)},c=function(e,t,n,r,i){var a=r*o,u=s._malloc(a);e(t,u);n(i,new Float32Array(s.HEAPU8.buffer,u,r)),s._free(u)},l=function(e,t,n,r,i){var o=r*a,u=s._malloc(o);e(t,u),n(i,new Uint8Array(s.HEAPU8.buffer,u,r)),s._free(u)},h=function(e){e.splice(0,e.length)},d=function(e,t){var n=0,r=t.length;for(e.length>r?e.splice(r,e.length-r):e.length=r;n<r;)e[n]=t[n],++n},f=function(e,t){var n=0,r=t.length;for(e.length>r?e.splice(r,e.length-r):e.length=r;n<r;)e[n]=1==t[n],++n},p=function(e,t){var n=0,r=t.length;for(e.length>r?e.splice(r,e.length-r):e.length=r;n<r;)e[n]=t[n],++n},m=function(e,t){e.x=t[0],e.y=t[1],e.width=t[2],e.height=t[3]},g=function(t,n){var r,i=0,o=0,a=n.length/4;if(t.length>a&&t.splice(a,t.length-a),t.length<a)for(i=t.length;i<a;)t[i]=new e.Rectangle(0,0,0,0),++i;for(i=0;i<a;)(r=t[i]).x=n[o++],r.y=n[o++],r.width=n[o++],r.height=n[o++],++i},b=function(t,n){var r,i=0,o=0,a=n.length/2;if(t.length>a&&t.splice(a,t.length-a),t.length<a)for(i=t.length;i<a;)t[i]=new e.Point(0,0),++i;for(i=0;i<a;)(r=t[i]).x=n[o++],r.y=n[o++],++i},y=s.cwrap("_brf_init",null,[n,n,n,n,n,n,"string"]);t.imageDataPtr=null,t.init=function(e,n,r,i,o,a,u){null!=t.imageDataPtr&&(s._free(t.imageDataPtr),t.imageDataPtr=null),y(e,n,r,i,o,a,u)};var v=s.cwrap("_brf_update",n,["number"]);t.update=function(e){var n=t.imageDataPtr;if(null==n){var r=e.length*a;n=s._malloc(r),t.imageDataPtr=n}s.HEAPU8.set(e,n);v(n)};var _=s.cwrap("_brf_reset",null,i);t.reset=function(){_()};var w=s.cwrap("_brf_get_mode","string",i);t.getMode=function(){return w()};var x=s.cwrap("_brf_set_mode",null,["string"]);t.setMode=function(e){x(e)};var E=s.cwrap("_brf_set_faceDetectionParams",null,[n,n,n,n]);t.setFaceDetectionParams=function(e,t,n,r){E(e,t,n,r)};var S=s.cwrap("_brf_set_faceDetectionRoi",null,[n,n,n,n]);t.setFaceDetectionRoi=function(e,t,n,r){S(e,t,n,r)};var C=s.cwrap("_brf_get_allDetectedFaces_length",n,i),O=s.cwrap("_brf_get_allDetectedFaces",n,["number"]);t.getAllDetectedFaces=function(e){var t=4*C();t<=0?h(e):u(O,g,t,e)};var A=s.cwrap("_brf_get_mergedDetectedFaces_length",n,i),M=s.cwrap("_brf_get_mergedDetectedFaces",n,["number"]);t.getMergedDetectedFaces=function(e){var t=4*A();t<=0?h(e):u(M,g,t,e)};var N=s.cwrap("_brf_set_numFacesToTrack",null,[n]);t.setNumFacesToTrack=function(e){N(e)};var k=s.cwrap("_brf_set_faceTrackingStartParams",null,[r,r,r,r,r]);t.setFaceTrackingStartParams=function(e,t,n,r,i){k(e,t,n,r,i)};var I=s.cwrap("_brf_set_faceTrackingResetParams",null,[r,r,r,r,r]);t.setFaceTrackingResetParams=function(e,t,n,r,i){I(e,t,n,r,i)};var T=s.cwrap("_brf_get_faces_length",n,i),P=s.cwrap("_brf_get_face_lastState","string",[n]),R=s.cwrap("_brf_get_face_state","string",[n]),D=s.cwrap("_brf_get_face_nextState","string",[n]),L=s.cwrap("_brf_get_face_vertices_length",n,[n]),B=s.cwrap("_brf_get_face_vertices",n,[n,"number"]),j=s.cwrap("_brf_get_face_triangles_length",n,[n]),F=s.cwrap("_brf_get_face_triangles",n,[n,"number"]),z=s.cwrap("_brf_get_face_points_length",n,[n]),V=s.cwrap("_brf_get_face_points",n,[n,"number"]),U=s.cwrap("_brf_get_face_bounds",n,[n,"number"]),W=s.cwrap("_brf_get_face_refRect",n,[n,"number"]),$=s.cwrap("_brf_get_face_candideVertices_length",n,[n]),q=s.cwrap("_brf_get_face_candideVertices",n,[n,"number"]),H=s.cwrap("_brf_get_face_candideTriangles_length",n,[n]),G=s.cwrap("_brf_get_face_candideTriangles",n,[n,"number"]),K=s.cwrap("_brf_get_face_scale",r,[n]),Y=s.cwrap("_brf_get_face_translationX",r,[n]),X=s.cwrap("_brf_get_face_translationY",r,[n]),Z=s.cwrap("_brf_get_face_rotationX",r,[n]),J=s.cwrap("_brf_get_face_rotationY",r,[n]),Q=s.cwrap("_brf_get_face_rotationZ",r,[n]);t.getFaces=function(t){var n=T();!function(t,n){var r=0,i=n;if(t.length>i&&t.splice(i,t.length-i),t.length<i)for(r=t.length;r<i;)t[r]=new e.BRFFace,++r}(t,n);for(var r=0,i=0;i<n;i++){var a=t[i];a.lastState=P(i),a.state=R(i),a.nextState=D(i),(r=L(i))<=0?h(a.vertices):c(B,i,p,r,a.vertices),0==a.triangles.length&&((r=j(i))<=0?h(a.triangles):l(F,i,d,r,a.triangles)),(r=2*z(i))<=0?h(a.points):c(V,i,b,r,a.points),c(U,i,m,r=4*o,a.bounds),c(W,i,m,r,a.refRect),(r=$(i))<=0?h(a.candideVertices):c(q,i,p,r,a.candideVertices),0==a.candideTriangles.length&&((r=H(i))<=0?h(a.candideTriangles):l(G,i,d,r,a.candideTriangles)),a.scale=K(i),a.translationX=Y(i),a.translationY=X(i),a.rotationX=Z(i),a.rotationY=J(i),a.rotationZ=Q(i)}};var ee=s.cwrap("_brf_set_opticalFlowParams",null,[n,n,n,r]);t.setOpticalFlowParams=function(e,t,n,r){ee(e,t,n,r)};var te=s.cwrap("_brf_addOpticalFlowPoints",n,["number",n]);t.addOpticalFlowPoints=function(e){var t=2*e.length,n=new Float32Array(t);!function(e,t){for(var n,r=0,i=0,o=e.length;r<o;)n=e[r],t[i++]=n.x,t[i++]=n.y,++r}(e,n);var r=n.length*o,i=s._malloc(r);new Uint8Array(s.HEAPU8.buffer,i,r).set(new Uint8Array(n.buffer));te(i,t);s._free(i)};var ne=s.cwrap("_brf_get_opticalFlowPoints_length",n,i),re=s.cwrap("_brf_get_opticalFlowPoints",n,["number"]);t.getOpticalFlowPoints=function(e){var t=2*ne();t<=0?h(e):u(re,b,t,e)};var ie=s.cwrap("_brf_get_opticalFlowPointStates_length",n,i),oe=s.cwrap("_brf_get_opticalFlowPointStates",n,["number"]);t.getOpticalFlowPointStates=function(e){var t=ie();t<=0?h(e):function(e,t,n,r){var i=n*a,o=s._malloc(i);e(o),t(r,new Uint8Array(s.HEAPU8.buffer,o,n)),s._free(o)}(oe,f,t,e)};var ae=s.cwrap("_brf_get_opticalFlowCheckPointsValidBeforeTracking","number",i);t.getOpticalFlowCheckPointsValidBeforeTracking=function(){return 1==ae()};var se=s.cwrap("_brf_set_opticalFlowCheckPointsValidBeforeTracking",null,["number"]);t.setOpticalFlowCheckPointsValidBeforeTracking=function(e){se(e=1==e?1:0)}},e.Module=brfv4SDK(e),e.BRFv4ContextManager=function(){var t=new e.BRFv4Context,n=[],r=[],i=[],o=[],a=[],s=function(){t.getOpticalFlowPoints(o),t.getOpticalFlowPointStates(a),t.getAllDetectedFaces(n),t.getMergedDetectedFaces(r),t.getFaces(i)};this.init=function(e,n,r){if(null==e)throw'BRFManager init is missing the first parameter "src : BitmapData". Refer to the SDK examples for the correct usage.';if(null==n)throw'BRFManager constructor is missing the second parameter "imageRoi : Rectangle". Refer to the SDK examples for the correct usage.';if(null==r||r.length<8)throw'BRFManager constructor is missing the third parameter "appId : String (length >= 8)". Refer to the SDK examples for the correct usage.';null!=t&&t.init(e.width,e.height,n.x,n.y,n.width,n.height,r)},this.update=function(e){if(null==t)throw"BRFv4Context is not available. Call init first.";if(null==e)throw"BRFManager.update: BitmapData must NOT be null.";t.update(e),s()},this.reset=function(){if(null==t)throw"BRFv4Context is not available. Call init first.";t.reset(),s()},this.getMode=function(){if(null==t)throw"BRFv4Context is not available. Call init first.";return t.getMode()},this.setMode=function(e){if(null==t)throw"BRFv4Context is not available. Call init first.";t.setMode(e)},this.setFaceDetectionParams=function(e,n,r,i){if(null==t)throw"BRFv4Context is not available. Call init first.";t.setFaceDetectionParams(e,n,r,i)},this.setFaceDetectionRoi=function(e){if(null==t)throw"BRFv4Context is not available. Call init first.";t.setFaceDetectionRoi(e.x,e.y,e.width,e.height)},this.getAllDetectedFaces=function(){return n},this.getMergedDetectedFaces=function(){return r},this.setNumFacesToTrack=function(e){if(null==t)throw"BRFv4Context is not available. Call init first.";t.setNumFacesToTrack(e)},this.setFaceTrackingStartParams=function(e,n,r,i,o){if(null==t)throw"BRFv4Context is not available. Call init first.";t.setFaceTrackingStartParams(e,n,r,i,o)},this.setFaceTrackingResetParams=function(e,n,r,i,o){if(null==t)throw"BRFv4Context is not available. Call init first.";t.setFaceTrackingResetParams(e,n,r,i,o)},this.getFaces=function(){return i},this.setOpticalFlowParams=function(e,n,r,i){if(null==t)throw"BRFv4Context is not available. Call init first.";t.setOpticalFlowParams(e,n,r,i)},this.addOpticalFlowPoints=function(e){if(null==t)throw"BRFv4Context is not available. Call init first.";t.addOpticalFlowPoints(e),s()},this.getOpticalFlowPoints=function(){return o},this.getOpticalFlowPointStates=function(){return a},this.getOpticalFlowCheckPointsValidBeforeTracking=function(){if(null==t)throw"BRFv4Context is not available. Call init first.";return t.getOpticalFlowCheckPointsValidBeforeTracking()},this.setOpticalFlowCheckPointsValidBeforeTracking=function(e){if(null==t)throw"BRFv4Context is not available. Call init first.";t.setOpticalFlowCheckPointsValidBeforeTracking(e)}},e.BRFManager=e.BRFv4ContextManager}(brfv4)},exports.initializeBRF=initializeBRF}).call(this,__webpack_require__(12))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(8),{initializeBRF:i}=n(201);!function(e){e.FACE_DETECTION="mode_face_detection",e.FACE_TRACKING="mode_face_tracking",e.POINT_TRACKING="mode_point_tracking"}(t.BRFMode||(t.BRFMode={})),function(e){e.FACE_DETECTION="state_face_detection",e.FACE_TRACKING_START="state_face_tracking_start",e.FACE_TRACKING="state_face_tracking",e.RESET="state_reset"}(t.BRFState||(t.BRFState={})),t.load=function(e,t,n){if(console.log("init load-brfv4"),r.supportsWASM()||n(new Error("WASM Not Supported")),!i)throw new Error("initializeBRF is undefined");const o={locateFile:t=>e+t};return i(o),console.log("initialize brf"),function e(){o.sdkReady?t(o):setTimeout(e,32)}(),o}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(202),{Animitter:i}=n(50);t.INPUT_FACE="input-face";let o=null;t.FaceInput=class extends i{constructor(e=null,n){super(),this.faceTrackIndex=54,this.type=t.INPUT_FACE,this.faces=[],this.brfWAsmURL=n,this.webcamCanvas=e}setWebcamCanvas(e){return this.webcamCanvas=e,this}initialize(){return new Promise((e,t)=>{const n=e=>{t(e)};if(!this.brfWAsmURL)return void n(new Error("face input requires a valid path to its WebAssembly binary"));const i=t=>{o=t,this.brf=t,this.webcamCanvas.initialize().then(n=>{if(this.setFPS(n.getFrameRate()),!this.brfManager){this.brfManager=new t.BRFManager;const e=new t.Rectangle(0,0,n.domElement.width,n.domElement.height);this.brfManager.init(e,e,"com.funstuff.js.coolthing")}e(this)})};o?i(o):r.load(this.brfWAsmURL,i,n)})}update(e,t,n){this.webcamCanvas.update();try{this.brfManager.update(this.webcamCanvas.getImageData().data)}catch(e){if(e)return void this.emit("error",e)}const i=this.brfManager.getFaces();this.faces=i;for(let e=0;e<i.length;e++){const t=i[e];if((t.state===r.BRFState.FACE_TRACKING_START||t.state===r.BRFState.FACE_TRACKING)&&t.vertices.length>this.faceTrackIndex+1){const e=[t.vertices[this.faceTrackIndex],t.vertices[this.faceTrackIndex+1]];this.emit("input",{position:e,face:t})}}return super.update(e,t,n)}stop(){super.stop(),this.webcamCanvas.stop()}}},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(52),o=n(51),a=n(1),s=n(203),u=n(94),c=n(8),l=n(3);class h extends o.ACCInputEvent{constructor(e,t){super(e,t)}}class d extends o.AbstractInputElement{constructor(){super(),this.minHorizontal=-1,this.maxHorizontal=1,this.minVertical=-1,this.maxVertical=1,this.inputType="face",this.inputName="Face",this._webcamCanvas=new u.WebcamCanvas,this._handleInput=this._handleInput.bind(this),this._handleStop=this._handleStop.bind(this),this._handleError=this._handleError.bind(this),this._handleEditorInput=this._handleEditorInput.bind(this)}_createEvent(e,t=!0,n=!0){const r={detail:{target:this,inputType:this.inputType,position:this.position,face:this.face},bubbles:t,composed:n};return new h(e,r)}_render({controls:e,maxHorizontal:t,minHorizontal:n,minVertical:r,maxVertical:i,smoothing:o}){return a.html`<style>
            .editor {
                display: block;
            }

            </style>
            <acc-face-rotation-input-calibration
                class="editor"
                on-close-click=${()=>this.removeAttribute("controls")}
                on-input=${this._handleEditorInput}
                open?="${e}"
                minHorizontal="${n}"
                maxHorizontal="${t}"
                minVertical="${r}"
                maxVertical="${i}"
                smoothing="${o}"
            </acc-face-input-calibration>
        `}get face(){return this.faces[0]}get faces(){return this._input?this._input.faces:[]}get canvas(){return this._webcamCanvas.domElement}initialize(){return this.canInitialize||this._dispatchError(new Error("can not initialize input at this time")),this._dispatchInitializing(),this.__initializingPromise=this.__initializingPromise||(()=>(this._input=new s.FaceInput(this._webcamCanvas,this.wasmSrc),this._input.on("input",this._handleInput),this._input.on("stop",this._handleStop),this._input.on("error",this._handleError),this._input.on("update",this._dispatchTick),this._input.on("start",this._dispatchReady),this._input.initialize().then(()=>{if(!this._wasAborted)return this._input.start(),this;this._wasAborted=!1}).catch(e=>{if(!this.wasmSrc){const e="element's required wasmSrc property not set, must point to valid Face tracking WebAssembly binary";return Promise.reject(new Error(e))}return Promise.reject(e)})))(),this.__initializingPromise}getLipDistance(){if(!this.face)return 0;const e=this.face.vertices,t=[e[54],e[55]],n=[e[124],e[125]],r=[e[132],e[133]];return i.distance(n,r)/i.distance(n,t)}_handleStop(){this.__initializingPromise=null,this._dispatchStop()}_handleInput({face:e}){const t=this.minHorizontal,n=this.maxHorizontal,r=this.minVertical,i=this.maxVertical,o=c.scalemap(e.rotationY,t,n,1,-1),a=c.scalemap(e.rotationX,r,i,-1,1);this._lastFoundPosition[0]=o,this._lastFoundPosition[1]=a}_handleError(e){this._dispatchError(e)}_handleEditorInput(e){this.smoothing=e.detail.smoothing;const t=e.detail.ranges;Object.keys(t).forEach(e=>{const n=t[e];this[e]=n})}stop(){this._input.stop()}dispatchEvent(e){return super.dispatchEvent(e)}}r([l.property({type:Number})],d.prototype,"minHorizontal",void 0),r([l.property({type:Number})],d.prototype,"maxHorizontal",void 0),r([l.property({type:Number})],d.prototype,"minVertical",void 0),r([l.property({type:Number})],d.prototype,"maxVertical",void 0),r([l.property({type:String})],d.prototype,"wasmSrc",void 0),t.FaceRotationInputElement=d,customElements.define("acc-face-rotation-input",d)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),o=n(3);class a extends i.LitElement{constructor(){super(),this.command="change to",this.commands={},this.allowed=!0;"webkitSpeechRecognition"in window&&(this.recognition=new webkitSpeechRecognition,this.recognition.lang="en-US",this.recognition.continuous=!0,this.recognition.interimResults=!0,console.log("ready"),this.recognition.onstart=(e=>{console.log("on start",e),clearTimeout(this.errorTimeout),this.errorTimeout=setTimeout(()=>{this.recognition.abort()},1e4)}),this.recognition.onresult=(e=>{clearTimeout(this.errorTimeout),this.errorTimeout=setTimeout(()=>{this.recognition.abort()},1e4);for(let t=e.resultIndex;t<e.results.length;++t)if(e.results[t]){const n=e.results[t][0].transcript.trim().toLowerCase();if(this.commands[n]&&this.recentMatch!==this.commands[n]){this.recentMatch=this.commands[n];const e={detail:{transcript:this.commands[n]}};this.dispatchEvent(new CustomEvent("onresult",e))}}}),this.recognition.onerror=(e=>{"not-allowed"===e.error?this.dispatchEvent(new CustomEvent("notallowed")):this.cancelledFromIdle=!0,this.shadowRoot.querySelector("#voice-command").checked=!1}),this.recognition.onend=(e=>{if(this.allowed){this.cancelledFromIdle=!0,this.shadowRoot.querySelector("#voice-command").checked=!1}}))}toggle(){const e=this.shadowRoot.querySelector("acc-toggle");e.checked=!e.checked}onToggle(e){this.recognition&&(e.detail.checked?(this.recognition.start(),this.cancelledFromIdle=!1,this.on=!0,this.dispatchEvent(new CustomEvent("on"))):(this.recognition.stop(),setTimeout(()=>{this.cancelledFromIdle=!1},100),this.on=!1,this.dispatchEvent(new CustomEvent("off",{detail:{fromIdle:this.cancelledFromIdle}}))))}_render({command:e,helpText:t}){return"webkitSpeechRecognition"in window?i.html`
            <style type="text/css">
                .command {
                    text-transform: capitalize;
                }

                p {
                    font-family: 'Karla';
                    line-height: 22px;
                    font-size: 18px;
                }
                ::slotted(strong) {
                    font-weight: 700;
                }
            </style>
            <acc-group>
                <acc-toggle
                on-change="${e=>this.onToggle(e)}"
                id="voice-command" label="Voice Command"></acc-toggle>
                <p><slot></slot></p>
            </acc-group>
        `:i.html``}}r([o.property({type:String})],a.prototype,"command",void 0),r([o.property({type:String})],a.prototype,"helpText",void 0),r([o.property({type:Object})],a.prototype,"commands",void 0),r([o.property({type:Boolean})],a.prototype,"on",void 0),t.VoiceCommandElement=a,customElements.define("acc-voice-command",a)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(1);class i extends r.LitElement{static get properties(){return{opened:Boolean,selectors:String}}constructor(){super()}_clickHandler(e){this.opened=!1,this.dispatchEvent(new CustomEvent("closed"))}_propertiesChanged(e,t,n){if(super._propertiesChanged(e,t,n),t&&void 0!==t.opened){let e=document.querySelectorAll(this.selectors);t.opened?e.forEach(e=>{e.setAttribute("data-display",window.getComputedStyle(e).display),e.style.display="none",e.setAttribute("aria-hidden","true")}):e.forEach(e=>{let t="block";e.getAttribute("data-display")&&(t=e.getAttribute("data-display")),e.style.display=t,e.setAttribute("aria-hidden","false")})}}_didRender(e,t,n){if(t&&t.opened){const e=this.shadowRoot.querySelector("#content");setTimeout(()=>{e.focus()},100)}}_render({opened:e}){return r.html`
            <style>
                .overlay {
                    position: fixed;
                    top: 0;
                    left: 0;
                    width: 100%;
                    height: 100%;
                    background: #fff;
                    z-index: 4;
                }
                
                #content {
                    outline: none;
                    height: 100vh;
                }
                         
                .close {
                    padding: 67px 0px 0px 53px;
                    display: inline-block;
                    font-size: 24px;
                    text-decoration: none;
                    color: #000;
                    border: none;
                }

            </style>
            <div aria-label="Overlay" class="overlay" style$="display: ${e?"block":"none"}">
                <button  tabindex="2" class="close" on-click="${e=>this._clickHandler(e)}" aria-label="Close overlay">
                    <svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" 
                        xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                        <title>Close Icon</title>
                        <defs></defs>
                        <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
                            <g transform="translate(-55.000000, -67.000000)" fill="#000000">
                                <polygon id="Fill-1" points="63 67 55 75 63 83 64.41 81.59 58.83 76 71 76 71 74 58.83 74 64.42 68.41"></polygon>
                            </g>
                        </g>
                    </svg>
                </button>
                <div id="content" tabindex="1">
                    <slot></slot>    
                </div>
            </div>
        `}}t.OverlayElement=i,customElements.define("acc-overlay",i)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),o=n(6),a=n(3);class s extends i.LitElement{constructor(){super(...arguments),this.label="",this.path="",this.external=!1}_render({path:e,external:t,label:n}){return i.html`
            <style>
                a.container {
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    padding: 15px 0;
                    text-decoration: none;
                }

                .icon {
                    justify-content: center;
                    align-items: center;
                }

                .label {
                    font-family: 'Karla', sans-serif;
                    font-size: 18px;
                    color: ${o.labelColor};
                }


            </style>

            <a
                class="container"
                href="${e}"
                target="_blank">
                    <div class="label">${n}</div>
                    <div aria-hidden="true" class="icon" style$="display: ${1==t?"flex":"none"}">
                        <acc-icon icon="link"></acc-icon>
                    </div>
            </a>

        `}}r([a.property({type:String})],s.prototype,"label",void 0),r([a.property({type:String})],s.prototype,"path",void 0),r([a.property({type:Boolean})],s.prototype,"external",void 0),t.LinkElement=s,customElements.define("acc-link",s)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(6),i=n(55),o=n(1);n(96);const a=e=>e&&"string"==typeof e.label&&void 0!==e.value,s=e=>o.html`<optgroup label=${e.label} disabled?=${e.disabled}>
        ${Array.from(e.children).map(e=>a(e)?u(e):"")}
    </optgroup>`,u=e=>o.html`<option value="${e.value}" label="${e.label}" selected="${e.selected}">${e.label}</option>`;class c extends i.AbstractSelectLitElement{get items(){return this._nodes}get selected(){return super.selected}get value(){return this.selected?this.selected.value||this.selected.label:void 0}focus(){super.focus(),this.shadowRoot.querySelector("select").focus()}_render({label:e}){this.selectedIndex;const t=this.items.some(e=>!!e.icon),n=e=>e&&i.isOptgroupElement(e.parentElement)?e.parentElement.label:null,c=this;return o.html`
        <style>

            :host {
                padding: 5px;
            }

            :host select, button {
            }

            :host([inline]) .select-style,
            :host([inline]) label,
            *[inline] .select-style,
            *[inline] label {
                display: inline-block;
                width: auto;
            }

            :host([disabled]),
            acc-icon[disabled],
            select[disabled] {
                pointer-events: none;
                opacity: 0.25;
            }

            :host([inline]) label,
            *[inline] label {
                padding: 0 8px 0 0;
            }

            :host([inline]) select,
            *[inline] select {
                width: auto;
                display: inline-block;
                padding: 0 30px 0 0;
            }

            :host([inline]) .container,
            *[inline] .container {
                display: flex;
                align-items: baseline;
            }
            .container {
                display: inline-block;
                width: 100%;
            }

            label {
                font-family: ${r.bodyFontFamily};
                font-size: 18px;
                padding: 0px 0px 20px 0px;
                font-weight: 700;
                text-transform: capitalize;
                display: block;
                cursor: pointer;
                color: ${r.labelColor};
            }

            select {
                width: 100%;
                padding-right: 0px;
                height: 30px;
                cursor: pointer;
                display: inline-block;
                position: relative;
                font-size: 18px;
                font-family: ${r.bodyFontFamily};
                text-transform: capitalize;
                color: ${r.labelColor};
                background-color: ${r.backgroundColor};
                -moz-appearance:none; /* Firefox */
                -webkit-appearance:none; /* Safari and Chrome */
                appearance:none;
                border: 0;
            }

            select option,  select optgroup{
                color: black;
                background-color: white;
            }

            .select-style {
                position: relative;
                margin: 0;
                border: none;
                width: 100%;
                height: 34px;
                overflow: hidden;
                background-color: ${r.backgroundColor};
                text-decoration: none;

                display: flex;
                align-items: center;
            }

            .select-style:hover,
            .select-style:focus,
            .select-style:active {
                cursor: pointer;
            }

            ::slotted(.icon-face) {
                padding-right: 17px;
            }

            .icon-arrow {
                z-index: 1;
                position: absolute;
                right: 4px;
                top: 3px;
                display: block;
                padding: 3px;
                pointer-events: none;
            }

            .icon {
                display: flex;
                width: var(--icon-size, 25px);
                height: var(--icon-size, 25px);
                justify-content: center;
                margin-right: 17px;
                align-items: center;
                background-size: 100% auto;
                background-repeat: no-repeat;
                background-position: center;
            }

            #Shape {
                fill: ${r.labelColor};
            }
        </style>
        <div class="container">
            <label for="select-ui">${e}</label>
            <div class="select-style">
                ${t?o.html`
                    <div class="icon" style$="background-image: url(${this.selected&&this.selected.icon}); display: ${t?"flex":"none"}">
                    </div>
                    `:""}
                <select
                    id="select-ui"
                    class="accessibility-selector"
                    disabled?="${this.disabled}"
                    on-input="${function(e){const t=this,r=!!c.selected&&(c.selected.value||c.selected.label),i=n(c.selected),o=e=>e&&e.value===t.value&&e.label===t.selectedOptions[0].label;let a=c.items[this.selectedIndex];if(!o(a))for(let e=0;e<c.items.length;e++)if(o(c.items[e])){a=c.items[e];break}if(!a)throw new Error("Selected an item that didnt exist in map");let s=a.value||a.label;const u=n(a);s=0===s.indexOf("right")?s.replace("right","left"):s.replace("left","right");const l={detail:{target:e.target,value:s,group:u,previous:r,previousGroup:i}};c.select(a),c.dispatchEvent(new CustomEvent("change",l))}}" id="select">
                    ${Array.from(this.children).map(e=>i.isOptgroupElement(e)?s(e):a(e)?u(e):"")}
                </select>
                <acc-icon disabled?="${this.disabled}" aria-hidden="true" icon="down" class="icon-arrow"></acc-icon>
            </div>
        </div>
        `}}t.SelectElement=c,customElements.define("acc-select",c)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(20),o=n(1),a=n(3),s=n(6),u=n(14);class c extends o.LitElement{constructor(){super(),this.shortcut="Shift p",this.paused=!1,this._pauseScreen=document.createElement("acc-pause-screen")}connectedCallback(){super.connectedCallback(),this.__shortcutObserver=new i.KeyboardShortcutObserver(this.shortcut,()=>{this._clicked(),this.dispatchEvent(new CustomEvent("pause-keyboard-shortcut",{bubbles:!0,composed:!0}))},"pause / resume"),document.body.appendChild(this._pauseScreen),this._pauseScreen.addEventListener("close",()=>{this.paused=!1,this._addSnackbar()}),this.hasAttribute("dark")&&this._pauseScreen.setAttribute("dark","")}disconnectedCallback(){this.__shortcutObserver.disconnect(),super.disconnectedCallback(),document.body.removeChild(this._pauseScreen)}_propertiesChanged(e,t,n){return t&&void 0!==t.shortcut&&this.__shortcutObserver&&(this.__shortcutObserver.pattern=this.shortcut),t&&void 0!==t.paused&&(this.dispatchEvent(new CustomEvent("pause",{bubbles:!0,composed:!0,detail:{paused:this.paused}})),e.paused?this._pauseScreen.setAttribute("open",""):this._pauseScreen.removeAttribute("open")),super._propertiesChanged(e,t,n)}_addSnackbar(){const e=document.querySelector("acc-snackbar");e&&(this.paused?e.setAttribute("message","Pausing experience."):e.setAttribute("message","Resuming experience."))}focus(){this.shadowRoot.querySelector("button").focus()}_clicked(e){e&&this.dispatchEvent(new CustomEvent("pause-clicked",{bubbles:!0,composed:!0})),this.paused=!this.paused,this._addSnackbar()}_render(){return o.html`
        <style>
            :host {
                --margin: 16px;
                --button-width: 60px;
                --button-height: 40px;
            }

            button{
                z-index: 3;
                box-sizing: border-box;
                background-color: var(--background-color);
                border: 1px solid ${s.outlineBorderColor};
                cursor:pointer;
                width: var(--button-width);
                height: var(--button-height);
            }

            svg {
                fill: var(--fill-color);
            }

        </style>
        <button
            title="Pause toggle (${this.shortcut})"
            on-click=${this._clicked.bind(this)}
            aria-label="pause" aria-pressed$="${this.paused}">
            <acc-icon icon=${this.paused?"play":"pause"}></acc-icon>
        </button>
        `}}r([a.property({type:String})],c.prototype,"shortcut",void 0),r([a.property({type:Boolean})],c.prototype,"paused",void 0),t.PauseButtonElement=c,customElements.define("acc-pause-button",c);class l extends u.AbstractModalElement{_keydown(e){-1!==[17,18,91,93,16,9,37,38,39,40].indexOf(e.keyCode)||!this.open||e.metaKey||e.shiftKey||(e.preventDefault(),e.stopPropagation(),this.removeAttribute("open"))}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._keydown.bind(this))}disconnecteCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._keydown.bind(this))}focus(){super.focus();const e=this.shadowRoot.querySelector("#text");e&&e.focus()}_renderModalBody(){return o.html`
            <style>

                :host([dark]), [dark] {
                    --overlay-background-color: rgba(34, 34, 51, 0.9);
                    --background-color: rgb(34, 34, 51);
                }

                :host {
                    --overlay-background-color: rgba(255, 255, 255, 0.8);
                    --background-color: white;
                }

                #pause-screen {
                    position: fixed;
                    width: 100%;
                    height: 100%;
                    z-index: 3;
                    top: 0px;
                    left: 0px;
                    background-color: var(--overlay-background-color);
                    transition: background-color 0.2s;
                }

                #pause-screen #text {
                    position: absolute;
                    width: 520px;
                    text-align: center;
                    top: 50%;
                    left: 50%;
                    transform: translate(-50%, -50%);
                    font-size: 30px;
                    color: ${s.accentColor};
                    font-family: 'Karla', sans-serif;
                }
            </style>
            <div id="pause-screen"
                on-click=${()=>this.open=!1}>
                <div id="text" tabindex="0">
                    Click, tap or press any key to resume
                </div>
            </div>
        `}}t.PauseScreen=l,customElements.define("acc-pause-screen",l)},function(e,t,n){var r;!function(n){"use strict";function i(){if(i.prototype._singleton)throw new Error("WebMidi is a singleton, it cannot be instantiated directly.");i.prototype._singleton=this,this._inputs=[],this._outputs=[],this._userHandlers={},this._stateChangeQueue=[],this._processingStateChange=!1,this._midiInterfaceEvents=["connected","disconnected"],this._notes=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],this._semitones={C:0,D:2,E:4,F:5,G:7,A:9,B:11},Object.defineProperties(this,{MIDI_SYSTEM_MESSAGES:{value:{sysex:240,timecode:241,songposition:242,songselect:243,tuningrequest:246,sysexend:247,clock:248,start:250,continue:251,stop:252,activesensing:254,reset:255,midimessage:0,unknownsystemmessage:-1},writable:!1,enumerable:!0,configurable:!1},MIDI_CHANNEL_MESSAGES:{value:{noteoff:8,noteon:9,keyaftertouch:10,controlchange:11,channelmode:11,programchange:12,channelaftertouch:13,pitchbend:14},writable:!1,enumerable:!0,configurable:!1},MIDI_REGISTERED_PARAMETER:{value:{pitchbendrange:[0,0],channelfinetuning:[0,1],channelcoarsetuning:[0,2],tuningprogram:[0,3],tuningbank:[0,4],modulationrange:[0,5],azimuthangle:[61,0],elevationangle:[61,1],gain:[61,2],distanceratio:[61,3],maximumdistance:[61,4],maximumdistancegain:[61,5],referencedistanceratio:[61,6],panspreadangle:[61,7],rollangle:[61,8]},writable:!1,enumerable:!0,configurable:!1},MIDI_CONTROL_CHANGE_MESSAGES:{value:{bankselectcoarse:0,modulationwheelcoarse:1,breathcontrollercoarse:2,footcontrollercoarse:4,portamentotimecoarse:5,dataentrycoarse:6,volumecoarse:7,balancecoarse:8,pancoarse:10,expressioncoarse:11,effectcontrol1coarse:12,effectcontrol2coarse:13,generalpurposeslider1:16,generalpurposeslider2:17,generalpurposeslider3:18,generalpurposeslider4:19,bankselectfine:32,modulationwheelfine:33,breathcontrollerfine:34,footcontrollerfine:36,portamentotimefine:37,dataentryfine:38,volumefine:39,balancefine:40,panfine:42,expressionfine:43,effectcontrol1fine:44,effectcontrol2fine:45,holdpedal:64,portamento:65,sustenutopedal:66,softpedal:67,legatopedal:68,hold2pedal:69,soundvariation:70,resonance:71,soundreleasetime:72,soundattacktime:73,brightness:74,soundcontrol6:75,soundcontrol7:76,soundcontrol8:77,soundcontrol9:78,soundcontrol10:79,generalpurposebutton1:80,generalpurposebutton2:81,generalpurposebutton3:82,generalpurposebutton4:83,reverblevel:91,tremololevel:92,choruslevel:93,celestelevel:94,phaserlevel:95,databuttonincrement:96,databuttondecrement:97,nonregisteredparametercoarse:98,nonregisteredparameterfine:99,registeredparametercoarse:100,registeredparameterfine:101},writable:!1,enumerable:!0,configurable:!1},MIDI_CHANNEL_MODE_MESSAGES:{value:{allsoundoff:120,resetallcontrollers:121,localcontrol:122,allnotesoff:123,omnimodeoff:124,omnimodeon:125,monomodeon:126,polymodeon:127},writable:!1,enumerable:!0,configurable:!1},octaveOffset:{value:0,writable:!0,enumerable:!0,configurable:!1}}),Object.defineProperties(this,{supported:{enumerable:!0,get:function(){return"requestMIDIAccess"in navigator}},enabled:{enumerable:!0,get:function(){return void 0!==this.interface}.bind(this)},inputs:{enumerable:!0,get:function(){return this._inputs}.bind(this)},outputs:{enumerable:!0,get:function(){return this._outputs}.bind(this)},sysexEnabled:{enumerable:!0,get:function(){return!(!this.interface||!this.interface.sysexEnabled)}.bind(this)},time:{enumerable:!0,get:function(){return performance.now()}}})}function o(e){var t=this;this._userHandlers={channel:{},system:{}},this._midiInput=e,Object.defineProperties(this,{connection:{enumerable:!0,get:function(){return t._midiInput.connection}},id:{enumerable:!0,get:function(){return t._midiInput.id}},manufacturer:{enumerable:!0,get:function(){return t._midiInput.manufacturer}},name:{enumerable:!0,get:function(){return t._midiInput.name}},state:{enumerable:!0,get:function(){return t._midiInput.state}},type:{enumerable:!0,get:function(){return t._midiInput.type}}}),this._initializeUserHandlers(),this._midiInput.onmidimessage=this._onMidiMessage.bind(this)}function a(e){var t=this;this._midiOutput=e,Object.defineProperties(this,{connection:{enumerable:!0,get:function(){return t._midiOutput.connection}},id:{enumerable:!0,get:function(){return t._midiOutput.id}},manufacturer:{enumerable:!0,get:function(){return t._midiOutput.manufacturer}},name:{enumerable:!0,get:function(){return t._midiOutput.name}},state:{enumerable:!0,get:function(){return t._midiOutput.state}},type:{enumerable:!0,get:function(){return t._midiOutput.type}}})}var s=new i;i.prototype.enable=function(e,t){return this.enabled?void 0:this.supported?void navigator.requestMIDIAccess({sysex:t}).then(function(t){function n(){clearTimeout(r),this._updateInputsAndOutputs(),this.interface.onstatechange=this._onInterfaceStateChange.bind(this),"function"==typeof e&&e.call(this),i.forEach(function(e){this._onInterfaceStateChange(e)}.bind(this))}var r,i=[],o=[];this.interface=t,this._resetInterfaceUserHandlers(),this.interface.onstatechange=function(e){i.push(e)};for(var a=t.inputs.values(),s=a.next();s&&!s.done;s=a.next())o.push(s.value.open());for(var u=t.outputs.values(),c=u.next();c&&!c.done;c=u.next())o.push(c.value.open());r=setTimeout(n.bind(this),200),Promise&&Promise.all(o).catch(function(e){}).then(n.bind(this))}.bind(this),function(t){"function"==typeof e&&e.call(this,t)}.bind(this)):void("function"==typeof e&&e(new Error("The Web MIDI API is not supported by your browser.")))},i.prototype.disable=function(){if(!this.supported)throw new Error("The Web MIDI API is not supported by your browser.");this.interface&&(this.interface.onstatechange=void 0),this.interface=void 0,this._inputs=[],this._outputs=[],this._resetInterfaceUserHandlers()},i.prototype.addListener=function(e,t){if(!this.enabled)throw new Error("WebMidi must be enabled before adding event listeners.");if("function"!=typeof t)throw new TypeError("The 'listener' parameter must be a function.");if(!(this._midiInterfaceEvents.indexOf(e)>=0))throw new TypeError("The specified event type is not supported.");return this._userHandlers[e].push(t),this},i.prototype.hasListener=function(e,t){if(!this.enabled)throw new Error("WebMidi must be enabled before checking event listeners.");if("function"!=typeof t)throw new TypeError("The 'listener' parameter must be a function.");if(!(this._midiInterfaceEvents.indexOf(e)>=0))throw new TypeError("The specified event type is not supported.");for(var n=0;n<this._userHandlers[e].length;n++)if(this._userHandlers[e][n]===t)return!0;return!1},i.prototype.removeListener=function(e,t){if(!this.enabled)throw new Error("WebMidi must be enabled before removing event listeners.");if(void 0!==t&&"function"!=typeof t)throw new TypeError("The 'listener' parameter must be a function.");if(this._midiInterfaceEvents.indexOf(e)>=0)if(t)for(var n=0;n<this._userHandlers[e].length;n++)this._userHandlers[e][n]===t&&this._userHandlers[e].splice(n,1);else this._userHandlers[e]=[];else{if(void 0!==e)throw new TypeError("The specified event type is not supported.");this._resetInterfaceUserHandlers()}return this},i.prototype.toMIDIChannels=function(e){var t;return(t="all"===e||void 0===e?["all"]:Array.isArray(e)?e:[e]).indexOf("all")>-1&&(t=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),t.map(function(e){return parseInt(e)}).filter(function(e){return e>=1&&16>=e})},i.prototype.getInputById=function(e){if(!this.enabled)throw new Error("WebMidi is not enabled.");for(var t=0;t<this.inputs.length;t++)if(this.inputs[t].id===e)return this.inputs[t];return!1},i.prototype.getOutputById=function(e){if(!this.enabled)throw new Error("WebMidi is not enabled.");for(var t=0;t<this.outputs.length;t++)if(this.outputs[t].id===e)return this.outputs[t];return!1},i.prototype.getInputByName=function(e){if(!this.enabled)throw new Error("WebMidi is not enabled.");for(var t=0;t<this.inputs.length;t++)if(~this.inputs[t].name.indexOf(e))return this.inputs[t];return!1},i.prototype.getOctave=function(e){return null!=e&&e>=0&&127>=e?Math.floor(Math.floor(e)/12-1)+Math.floor(s.octaveOffset):void 0},i.prototype.getOutputByName=function(e){if(!this.enabled)throw new Error("WebMidi is not enabled.");for(var t=0;t<this.outputs.length;t++)if(~this.outputs[t].name.indexOf(e))return this.outputs[t];return!1},i.prototype.guessNoteNumber=function(e){var t=!1;if(e&&e.toFixed&&e>=0&&127>=e?t=Math.round(e):parseInt(e)>=0&&parseInt(e)<=127?t=parseInt(e):("string"==typeof e||e instanceof String)&&(t=this.noteNameToNumber(e)),!1===t)throw new Error("Invalid input value ("+e+").");return t},i.prototype.noteNameToNumber=function(e){"string"!=typeof e&&(e="");var t=e.match(/([CDEFGAB])(#{0,2}|b{0,2})(-?\d+)/i);if(!t)throw new RangeError("Invalid note name.");var n=s._semitones[t[1].toUpperCase()],r=12*(parseInt(t[3])+1-Math.floor(s.octaveOffset))+n;if(t[2].toLowerCase().indexOf("b")>-1?r-=t[2].length:t[2].toLowerCase().indexOf("#")>-1&&(r+=t[2].length),0>r||r>127)throw new RangeError("Invalid note name or note outside valid range.");return r},i.prototype._updateInputsAndOutputs=function(){this._updateInputs(),this._updateOutputs()},i.prototype._updateInputs=function(){for(var e=0;e<this._inputs.length;e++){for(var t=!0,n=this.interface.inputs.values(),r=n.next();r&&!r.done;r=n.next())if(this._inputs[e]._midiInput===r.value){t=!1;break}t&&this._inputs.splice(e,1)}this.interface&&this.interface.inputs.forEach(function(e){for(var t=!0,n=0;n<this._inputs.length;n++)this._inputs[n]._midiInput===e&&(t=!1);t&&this._inputs.push(new o(e))}.bind(this))},i.prototype._updateOutputs=function(){for(var e=0;e<this._outputs.length;e++){for(var t=!0,n=this.interface.outputs.values(),r=n.next();r&&!r.done;r=n.next())if(this._outputs[e]._midiOutput===r.value){t=!1;break}t&&this._outputs.splice(e,1)}this.interface&&this.interface.outputs.forEach(function(e){for(var t=!0,n=0;n<this._outputs.length;n++)this._outputs[n]._midiOutput===e&&(t=!1);t&&this._outputs.push(new a(e))}.bind(this))},i.prototype._onInterfaceStateChange=function(e){this._updateInputsAndOutputs();var t={timestamp:e.timeStamp,type:e.port.state};this.interface&&"connected"===e.port.state?"output"===e.port.type?t.port=this.getOutputById(e.port.id):"input"===e.port.type&&(t.port=this.getInputById(e.port.id)):t.port={connection:"closed",id:e.port.id,manufacturer:e.port.manufacturer,name:e.port.name,state:e.port.state,type:e.port.type},this._userHandlers[e.port.state].forEach(function(e){e(t)})},i.prototype._resetInterfaceUserHandlers=function(){for(var e=0;e<this._midiInterfaceEvents.length;e++)this._userHandlers[this._midiInterfaceEvents[e]]=[]},o.prototype.addListener=function(e,t,n){var r=this;if(void 0===t&&(t="all"),Array.isArray(t)||(t=[t]),t.forEach(function(e){if("all"!==e&&!(e>=1&&16>=e))throw new RangeError("The 'channel' parameter is invalid.")}),"function"!=typeof n)throw new TypeError("The 'listener' parameter must be a function.");if(void 0!==s.MIDI_SYSTEM_MESSAGES[e])this._userHandlers.system[e]||(this._userHandlers.system[e]=[]),this._userHandlers.system[e].push(n);else{if(void 0===s.MIDI_CHANNEL_MESSAGES[e])throw new TypeError("The specified event type is not supported.");if(t.indexOf("all")>-1){t=[];for(var i=1;16>=i;i++)t.push(i)}this._userHandlers.channel[e]||(this._userHandlers.channel[e]=[]),t.forEach(function(t){r._userHandlers.channel[e][t]||(r._userHandlers.channel[e][t]=[]),r._userHandlers.channel[e][t].push(n)})}return this},o.prototype.on=o.prototype.addListener,o.prototype.hasListener=function(e,t,n){var r=this;if("function"!=typeof n)throw new TypeError("The 'listener' parameter must be a function.");if(void 0===t&&(t="all"),t.constructor!==Array&&(t=[t]),void 0!==s.MIDI_SYSTEM_MESSAGES[e]){for(var i=0;i<this._userHandlers.system[e].length;i++)if(this._userHandlers.system[e][i]===n)return!0}else if(void 0!==s.MIDI_CHANNEL_MESSAGES[e]){if(t.indexOf("all")>-1){t=[];for(var o=1;16>=o;o++)t.push(o)}return!!this._userHandlers.channel[e]&&t.every(function(t){var i=r._userHandlers.channel[e][t];return i&&i.indexOf(n)>-1})}return!1},o.prototype.removeListener=function(e,t,n){var r=this;if(void 0!==n&&"function"!=typeof n)throw new TypeError("The 'listener' parameter must be a function.");if(void 0===t&&(t="all"),t.constructor!==Array&&(t=[t]),void 0!==s.MIDI_SYSTEM_MESSAGES[e])if(void 0===n)this._userHandlers.system[e]=[];else for(var i=0;i<this._userHandlers.system[e].length;i++)this._userHandlers.system[e][i]===n&&this._userHandlers.system[e].splice(i,1);else if(void 0!==s.MIDI_CHANNEL_MESSAGES[e]){if(t.indexOf("all")>-1){t=[];for(var o=1;16>=o;o++)t.push(o)}if(!this._userHandlers.channel[e])return this;t.forEach(function(t){var i=r._userHandlers.channel[e][t];if(i)if(void 0===n)r._userHandlers.channel[e][t]=[];else for(var o=0;o<i.length;o++)i[o]===n&&i.splice(o,1)})}else{if(void 0!==e)throw new TypeError("The specified event type is not supported.");this._initializeUserHandlers()}return this},o.prototype._initializeUserHandlers=function(){for(var e in s.MIDI_CHANNEL_MESSAGES)s.MIDI_CHANNEL_MESSAGES.hasOwnProperty(e)&&(this._userHandlers.channel[e]={});for(var t in s.MIDI_SYSTEM_MESSAGES)s.MIDI_SYSTEM_MESSAGES.hasOwnProperty(t)&&(this._userHandlers.system[t]=[])},o.prototype._onMidiMessage=function(e){if(this._userHandlers.system.midimessage.length>0){var t={target:this,data:e.data,timestamp:e.timeStamp,type:"midimessage"};this._userHandlers.system.midimessage.forEach(function(e){e(t)})}e.data[0]<240?this._parseChannelEvent(e):e.data[0]<=255&&this._parseSystemEvent(e)},o.prototype._parseChannelEvent=function(e){var t,n,r=e.data[0]>>4,i=1+(15&e.data[0]);e.data.length>1&&(t=e.data[1],n=e.data.length>2?e.data[2]:void 0);var o={target:this,data:e.data,timestamp:e.timeStamp,channel:i};r===s.MIDI_CHANNEL_MESSAGES.noteoff||r===s.MIDI_CHANNEL_MESSAGES.noteon&&0===n?(o.type="noteoff",o.note={number:t,name:s._notes[t%12],octave:s.getOctave(t)},o.velocity=n/127,o.rawVelocity=n):r===s.MIDI_CHANNEL_MESSAGES.noteon?(o.type="noteon",o.note={number:t,name:s._notes[t%12],octave:s.getOctave(t)},o.velocity=n/127,o.rawVelocity=n):r===s.MIDI_CHANNEL_MESSAGES.keyaftertouch?(o.type="keyaftertouch",o.note={number:t,name:s._notes[t%12],octave:s.getOctave(t)},o.value=n/127):r===s.MIDI_CHANNEL_MESSAGES.controlchange&&t>=0&&119>=t?(o.type="controlchange",o.controller={number:t,name:this.getCcNameByNumber(t)},o.value=n):r===s.MIDI_CHANNEL_MESSAGES.channelmode&&t>=120&&127>=t?(o.type="channelmode",o.controller={number:t,name:this.getChannelModeByNumber(t)},o.value=n):r===s.MIDI_CHANNEL_MESSAGES.programchange?(o.type="programchange",o.value=t):r===s.MIDI_CHANNEL_MESSAGES.channelaftertouch?(o.type="channelaftertouch",o.value=t/127):r===s.MIDI_CHANNEL_MESSAGES.pitchbend?(o.type="pitchbend",o.value=((n<<7)+t-8192)/8192):o.type="unknownchannelmessage",this._userHandlers.channel[o.type]&&this._userHandlers.channel[o.type][i]&&this._userHandlers.channel[o.type][i].forEach(function(e){e(o)})},o.prototype.getCcNameByNumber=function(e){if(!((e=Math.floor(e))>=0&&119>=e))throw new RangeError("The control change number must be between 0 and 119.");for(var t in s.MIDI_CONTROL_CHANGE_MESSAGES)if(s.MIDI_CONTROL_CHANGE_MESSAGES.hasOwnProperty(t)&&e===s.MIDI_CONTROL_CHANGE_MESSAGES[t])return t},o.prototype.getChannelModeByNumber=function(e){if(!((e=Math.floor(e))>=120&&status<=127))throw new RangeError("The control change number must be between 120 and 127.");for(var t in s.MIDI_CHANNEL_MODE_MESSAGES)if(s.MIDI_CHANNEL_MODE_MESSAGES.hasOwnProperty(t)&&e===s.MIDI_CHANNEL_MODE_MESSAGES[t])return t},o.prototype._parseSystemEvent=function(e){var t=e.data[0],n={target:this,data:e.data,timestamp:e.timeStamp};t===s.MIDI_SYSTEM_MESSAGES.sysex?n.type="sysex":t===s.MIDI_SYSTEM_MESSAGES.timecode?n.type="timecode":t===s.MIDI_SYSTEM_MESSAGES.songposition?n.type="songposition":t===s.MIDI_SYSTEM_MESSAGES.songselect?(n.type="songselect",n.song=e.data[1]):t===s.MIDI_SYSTEM_MESSAGES.tuningrequest?n.type="tuningrequest":t===s.MIDI_SYSTEM_MESSAGES.clock?n.type="clock":t===s.MIDI_SYSTEM_MESSAGES.start?n.type="start":t===s.MIDI_SYSTEM_MESSAGES.continue?n.type="continue":t===s.MIDI_SYSTEM_MESSAGES.stop?n.type="stop":t===s.MIDI_SYSTEM_MESSAGES.activesensing?n.type="activesensing":t===s.MIDI_SYSTEM_MESSAGES.reset?n.type="reset":n.type="unknownsystemmessage",this._userHandlers.system[n.type]&&this._userHandlers.system[n.type].forEach(function(e){e(n)})},a.prototype.send=function(e,t,n){if(!(e>=128&&255>=e))throw new RangeError("The status byte must be an integer between 128 (0x80) and 255 (0xFF).");void 0===t&&(t=[]),Array.isArray(t)||(t=[t]);var r=[];return t.forEach(function(e,t){var n=Math.floor(e);if(!(n>=0&&255>=n))throw new RangeError("Data bytes must be integers between 0 (0x00) and 255 (0xFF).");r.push(n)}),this._midiOutput.send([e].concat(r),parseFloat(n)||0),this},a.prototype.sendSysex=function(e,t,n){if(!s.sysexEnabled)throw new Error("Sysex message support must first be activated.");return n=n||{},e=[].concat(e),t.forEach(function(e){if(0>e||e>127)throw new RangeError("The data bytes of a sysex message must be integers between 0 (0x00) and 127 (0x7F).")}),t=e.concat(t,s.MIDI_SYSTEM_MESSAGES.sysexend),this.send(s.MIDI_SYSTEM_MESSAGES.sysex,t,this._parseTimeParameter(n.time)),this},a.prototype.sendTimecodeQuarterFrame=function(e,t){return t=t||{},this.send(s.MIDI_SYSTEM_MESSAGES.timecode,e,this._parseTimeParameter(t.time)),this},a.prototype.sendSongPosition=function(e,t){e=Math.floor(e)||0,t=t||{};var n=e>>7&127,r=127&e;return this.send(s.MIDI_SYSTEM_MESSAGES.songposition,[n,r],this._parseTimeParameter(t.time)),this},a.prototype.sendSongSelect=function(e,t){if(e=Math.floor(e),t=t||{},!(e>=0&&127>=e))throw new RangeError("The song number must be between 0 and 127.");return this.send(s.MIDI_SYSTEM_MESSAGES.songselect,[e],this._parseTimeParameter(t.time)),this},a.prototype.sendTuningRequest=function(e){return e=e||{},this.send(s.MIDI_SYSTEM_MESSAGES.tuningrequest,void 0,this._parseTimeParameter(e.time)),this},a.prototype.sendClock=function(e){return e=e||{},this.send(s.MIDI_SYSTEM_MESSAGES.clock,void 0,this._parseTimeParameter(e.time)),this},a.prototype.sendStart=function(e){return e=e||{},this.send(s.MIDI_SYSTEM_MESSAGES.start,void 0,this._parseTimeParameter(e.time)),this},a.prototype.sendContinue=function(e){return e=e||{},this.send(s.MIDI_SYSTEM_MESSAGES.continue,void 0,this._parseTimeParameter(e.time)),this},a.prototype.sendStop=function(e){return e=e||{},this.send(s.MIDI_SYSTEM_MESSAGES.stop,void 0,this._parseTimeParameter(e.time)),this},a.prototype.sendActiveSensing=function(e){return e=e||{},this.send(s.MIDI_SYSTEM_MESSAGES.activesensing,[],this._parseTimeParameter(e.time)),this},a.prototype.sendReset=function(e){return e=e||{},this.send(s.MIDI_SYSTEM_MESSAGES.reset,void 0,this._parseTimeParameter(e.time)),this},a.prototype.stopNote=function(e,t,n){if("all"===e)return this.sendChannelMode("allnotesoff",0,t,n);var r=64;return(n=n||{}).rawVelocity?!isNaN(n.velocity)&&n.velocity>=0&&n.velocity<=127&&(r=n.velocity):!isNaN(n.velocity)&&n.velocity>=0&&n.velocity<=1&&(r=127*n.velocity),this._convertNoteToArray(e).forEach(function(e){s.toMIDIChannels(t).forEach(function(t){this.send((s.MIDI_CHANNEL_MESSAGES.noteoff<<4)+(t-1),[e,Math.round(r)],this._parseTimeParameter(n.time))}.bind(this))}.bind(this)),this},a.prototype.playNote=function(e,t,n){var r=64;if((n=n||{}).rawVelocity?!isNaN(n.velocity)&&n.velocity>=0&&n.velocity<=127&&(r=n.velocity):!isNaN(n.velocity)&&n.velocity>=0&&n.velocity<=1&&(r=127*n.velocity),n.time=this._parseTimeParameter(n.time),this._convertNoteToArray(e).forEach(function(e){s.toMIDIChannels(t).forEach(function(t){this.send((s.MIDI_CHANNEL_MESSAGES.noteon<<4)+(t-1),[e,Math.round(r)],n.time)}.bind(this))}.bind(this)),!isNaN(n.duration)){n.duration<=0&&(n.duration=0);var i=64;n.rawVelocity?!isNaN(n.release)&&n.release>=0&&n.release<=127&&(i=n.release):!isNaN(n.release)&&n.release>=0&&n.release<=1&&(i=127*n.release),this._convertNoteToArray(e).forEach(function(e){s.toMIDIChannels(t).forEach(function(t){this.send((s.MIDI_CHANNEL_MESSAGES.noteoff<<4)+(t-1),[e,Math.round(i)],(n.time||s.time)+n.duration)}.bind(this))}.bind(this))}return this},a.prototype.sendKeyAftertouch=function(e,t,n,r){var i=this;if(r=r||{},1>t||t>16)throw new RangeError("The channel must be between 1 and 16.");(isNaN(n)||0>n||n>1)&&(n=.5);var o=Math.round(127*n);return this._convertNoteToArray(e).forEach(function(e){s.toMIDIChannels(t).forEach(function(t){i.send((s.MIDI_CHANNEL_MESSAGES.keyaftertouch<<4)+(t-1),[e,o],i._parseTimeParameter(r.time))})}),this},a.prototype.sendControlChange=function(e,t,n,r){if(r=r||{},"string"==typeof e){if(!(e=s.MIDI_CONTROL_CHANGE_MESSAGES[e]))throw new TypeError("Invalid controller name.")}else if(!((e=Math.floor(e))>=0&&119>=e))throw new RangeError("Controller numbers must be between 0 and 119.");if(!((t=Math.floor(t)||0)>=0&&127>=t))throw new RangeError("Controller value must be between 0 and 127.");return s.toMIDIChannels(n).forEach(function(n){this.send((s.MIDI_CHANNEL_MESSAGES.controlchange<<4)+(n-1),[e,t],this._parseTimeParameter(r.time))}.bind(this)),this},a.prototype._selectRegisteredParameter=function(e,t,n){var r=this;if(e[0]=Math.floor(e[0]),!(e[0]>=0&&e[0]<=127))throw new RangeError("The control65 value must be between 0 and 127");if(e[1]=Math.floor(e[1]),!(e[1]>=0&&e[1]<=127))throw new RangeError("The control64 value must be between 0 and 127");return s.toMIDIChannels(t).forEach(function(i){r.sendControlChange(101,e[0],t,{time:n}),r.sendControlChange(100,e[1],t,{time:n})}),this},a.prototype._selectNonRegisteredParameter=function(e,t,n){var r=this;if(e[0]=Math.floor(e[0]),!(e[0]>=0&&e[0]<=127))throw new RangeError("The control63 value must be between 0 and 127");if(e[1]=Math.floor(e[1]),!(e[1]>=0&&e[1]<=127))throw new RangeError("The control62 value must be between 0 and 127");return s.toMIDIChannels(t).forEach(function(i){r.sendControlChange(99,e[0],t,{time:n}),r.sendControlChange(98,e[1],t,{time:n})}),this},a.prototype._setCurrentRegisteredParameter=function(e,t,n){var r=this;if((e=[].concat(e))[0]=Math.floor(e[0]),!(e[0]>=0&&e[0]<=127))throw new RangeError("The msb value must be between 0 and 127");return s.toMIDIChannels(t).forEach(function(i){r.sendControlChange(6,e[0],t,{time:n})}),e[1]=Math.floor(e[1]),e[1]>=0&&e[1]<=127&&s.toMIDIChannels(t).forEach(function(i){r.sendControlChange(38,e[1],t,{time:n})}),this},a.prototype._deselectRegisteredParameter=function(e,t){var n=this;return s.toMIDIChannels(e).forEach(function(r){n.sendControlChange(101,127,e,{time:t}),n.sendControlChange(100,127,e,{time:t})}),this},a.prototype.setRegisteredParameter=function(e,t,n,r){var i=this;if(r=r||{},!Array.isArray(e)){if(!s.MIDI_REGISTERED_PARAMETER[e])throw new Error("The specified parameter is not available.");e=s.MIDI_REGISTERED_PARAMETER[e]}return s.toMIDIChannels(n).forEach(function(o){i._selectRegisteredParameter(e,n,r.time),i._setCurrentRegisteredParameter(t,n,r.time),i._deselectRegisteredParameter(n,r.time)}),this},a.prototype.setNonRegisteredParameter=function(e,t,n,r){var i=this;if(r=r||{},!(e[0]>=0&&e[0]<=127&&e[1]>=0&&e[1]<=127))throw new Error("Position 0 and 1 of the 2-position parameter array must both be between 0 and 127.");return t=[].concat(t),s.toMIDIChannels(n).forEach(function(o){i._selectNonRegisteredParameter(e,n,r.time),i._setCurrentRegisteredParameter(t,n,r.time),i._deselectRegisteredParameter(n,r.time)}),this},a.prototype.incrementRegisteredParameter=function(e,t,n){var r=this;if(n=n||{},!Array.isArray(e)){if(!s.MIDI_REGISTERED_PARAMETER[e])throw new Error("The specified parameter is not available.");e=s.MIDI_REGISTERED_PARAMETER[e]}return s.toMIDIChannels(t).forEach(function(i){r._selectRegisteredParameter(e,t,n.time),r.sendControlChange(96,0,t,{time:n.time}),r._deselectRegisteredParameter(t,n.time)}),this},a.prototype.decrementRegisteredParameter=function(e,t,n){if(n=n||{},!Array.isArray(e)){if(!s.MIDI_REGISTERED_PARAMETER[e])throw new TypeError("The specified parameter is not available.");e=s.MIDI_REGISTERED_PARAMETER[e]}return s.toMIDIChannels(t).forEach(function(r){this._selectRegisteredParameter(e,t,n.time),this.sendControlChange(97,0,t,{time:n.time}),this._deselectRegisteredParameter(t,n.time)}.bind(this)),this},a.prototype.setPitchBendRange=function(e,t,n,r){var i=this;if(r=r||{},!((e=Math.floor(e)||0)>=0&&127>=e))throw new RangeError("The semitones value must be between 0 and 127");if(!((t=Math.floor(t)||0)>=0&&127>=t))throw new RangeError("The cents value must be between 0 and 127");return s.toMIDIChannels(n).forEach(function(o){i.setRegisteredParameter("pitchbendrange",[e,t],n,{time:r.time})}),this},a.prototype.setModulationRange=function(e,t,n,r){var i=this;if(r=r||{},!((e=Math.floor(e)||0)>=0&&127>=e))throw new RangeError("The semitones value must be between 0 and 127");if(!((t=Math.floor(t)||0)>=0&&127>=t))throw new RangeError("The cents value must be between 0 and 127");return s.toMIDIChannels(n).forEach(function(o){i.setRegisteredParameter("modulationrange",[e,t],n,{time:r.time})}),this},a.prototype.setMasterTuning=function(e,t,n){var r=this;if(n=n||{},-65>=(e=parseFloat(e)||0)||e>=64)throw new RangeError("The value must be a decimal number larger than -65 and smaller than 64.");var i=Math.floor(e)+64,o=e-Math.floor(e),a=(o=Math.round((o+1)/2*16383))>>7&127,u=127&o;return s.toMIDIChannels(t).forEach(function(e){r.setRegisteredParameter("channelcoarsetuning",i,t,{time:n.time}),r.setRegisteredParameter("channelfinetuning",[a,u],t,{time:n.time})}),this},a.prototype.setTuningProgram=function(e,t,n){var r=this;if(n=n||{},!((e=Math.floor(e))>=0&&127>=e))throw new RangeError("The program value must be between 0 and 127");return s.toMIDIChannels(t).forEach(function(i){r.setRegisteredParameter("tuningprogram",e,t,{time:n.time})}),this},a.prototype.setTuningBank=function(e,t,n){var r=this;if(n=n||{},!((e=Math.floor(e)||0)>=0&&127>=e))throw new RangeError("The bank value must be between 0 and 127");return s.toMIDIChannels(t).forEach(function(i){r.setRegisteredParameter("tuningbank",e,t,{time:n.time})}),this},a.prototype.sendChannelMode=function(e,t,n,r){if(r=r||{},"string"==typeof e){if(!(e=s.MIDI_CHANNEL_MODE_MESSAGES[e]))throw new TypeError("Invalid channel mode message name.")}else if(!((e=Math.floor(e))>=120&&127>=e))throw new RangeError("Channel mode numerical identifiers must be between 120 and 127.");if(0>(t=Math.floor(t)||0)||t>127)throw new RangeError("Value must be an integer between 0 and 127.");return s.toMIDIChannels(n).forEach(function(n){this.send((s.MIDI_CHANNEL_MESSAGES.channelmode<<4)+(n-1),[e,t],this._parseTimeParameter(r.time))}.bind(this)),this},a.prototype.sendProgramChange=function(e,t,n){var r=this;if(n=n||{},e=Math.floor(e),isNaN(e)||0>e||e>127)throw new RangeError("Program numbers must be between 0 and 127.");return s.toMIDIChannels(t).forEach(function(t){r.send((s.MIDI_CHANNEL_MESSAGES.programchange<<4)+(t-1),[e],r._parseTimeParameter(n.time))}),this},a.prototype.sendChannelAftertouch=function(e,t,n){var r=this;n=n||{},e=parseFloat(e),(isNaN(e)||0>e||e>1)&&(e=.5);var i=Math.round(127*e);return s.toMIDIChannels(t).forEach(function(e){r.send((s.MIDI_CHANNEL_MESSAGES.channelaftertouch<<4)+(e-1),[i],r._parseTimeParameter(n.time))}),this},a.prototype.sendPitchBend=function(e,t,n){var r=this;if(n=n||{},isNaN(e)||-1>e||e>1)throw new RangeError("Pitch bend value must be between -1 and 1.");var i=Math.round((e+1)/2*16383),o=i>>7&127,a=127&i;return s.toMIDIChannels(t).forEach(function(e){r.send((s.MIDI_CHANNEL_MESSAGES.pitchbend<<4)+(e-1),[a,o],r._parseTimeParameter(n.time))}),this},a.prototype._parseTimeParameter=function(e){var t,n;return"string"==typeof e&&"+"===e.substring(0,1)?(t=parseFloat(e))&&t>0&&(n=s.time+t):(t=parseFloat(e))>s.time&&(n=t),n},a.prototype._convertNoteToArray=function(e){var t=[];return Array.isArray(e)||(e=[e]),e.forEach(function(e){t.push(s.guessNoteNumber(e))}),t},void 0===(r=function(){return s}.apply(t,[]))||(e.exports=r)}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(1),i=n(210);class o extends r.LitElement{constructor(){super(),this.midis=[],i.enable(()=>{const e=[{label:"Off"}];i.outputs&&i.outputs.length>0&&(i.outputs.forEach(t=>{e.push({label:t.name,output:t})}),this.midis=e)})}get midis(){return this.midiOutputs}set midis(e){this.midiOutputs=e,this.requestRender()}changeHandler(e){let t;e.detail.value&&(t=this.midis[e.detail.value]);const n={detail:t};this.dispatchEvent(new CustomEvent("change",n))}_render(){return r.html`
        
        ${(e=>{if(this.midis.length>0)return r.html`
                <acc-group>
                    <acc-select id="midi-out" label="MIDI Out" on-change="${e=>this.changeHandler(e)}">
                    ${this.midis.map((e,t)=>r.html`<acc-item value="${t.toString()}" label="${e.label}"></acc-item>`)}
                    </acc-select>
                </acc-group>
            `})()}
        `}}t.MidiOutElement=o,customElements.define("acc-midi-out",o)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(1);n(56);const i=n(8);class o extends r.LitElement{connectedCallback(){super.connectedCallback(),this.addEventListener("pause",e=>{i.setBooleanAttribute(this.shadowRoot.querySelector("acc-mute-button"),"paused",e.detail.paused)})}focus(){this.shadowRoot.querySelector("acc-pause-button").focus()}start(){this.shadowRoot.querySelector("acc-mute-button").start()}get paused(){return this.shadowRoot.querySelector("acc-pause-button").paused}get muted(){return this.shadowRoot.querySelector("acc-mute-button").muted}_render(){return r.html`
            <style>

                :host([dark]) {
                    --overlay-background-color: rgba(34, 34, 51, 0.9);
                    --background-color: rgb(34, 34, 51);
                    --label-color: white;
                    --fill-color: white;
                }

                :host {
                    --overlay-background-color: rgba(255, 255, 255, 0.8);
                    --background-color: white;
                    --margin: 16px;
                    --button-width: 60px;
                    --button-height: 40px;
                }

                acc-pause-button, acc-mute-button {
                    top: var(--margin);
                    position: fixed;
                }

                acc-mute-button {
                    right: var(--margin);
                }

                acc-pause-button {
                    right: calc(var(--margin) * 2 + var(--button-width));
                }

            </style>
            <acc-pause-button dark?=${this.hasAttribute("dark")}></acc-pause-button>
            <acc-mute-button dark?=${this.hasAttribute("dark")}></acc-mute-button>
        `}}t.QuietGroup=o,customElements.define("acc-quiet-group",o)},function(e,t,n){window,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=18)}([function(e,t,n){(function(r){var i,o;
/**
 *  Tone.js
 *  @author Yotam Mann
 *  @license http://opensource.org/licenses/MIT MIT License
 *  @copyright 2014-2018 Yotam Mann
 */i=[n(36)],void 0===(o=function(e){"use strict";var t=function(){if(!(this instanceof t))throw new Error("constructor needs to be called with the 'new' keyword")};return t.prototype.toString=function(){for(var e in t){var n=e[0].match(/^[A-Z]$/),r=t[e]===this.constructor;if(t.isFunction(t[e])&&n&&r)return e}return"Tone"},t.prototype.dispose=function(){return this},t.prototype.set=function(e,n,r){if(t.isObject(e))r=n;else if(t.isString(e)){var i={};i[e]=n,e=i}e:for(var o in e){n=e[o];var a=this;if(-1!==o.indexOf(".")){for(var s=o.split("."),u=0;u<s.length-1;u++)if((a=a[s[u]])instanceof t){s.splice(0,u+1);var c=s.join(".");a.set(c,n);continue e}o=s[s.length-1]}var l=a[o];t.isUndef(l)||(t.Signal&&l instanceof t.Signal||t.Param&&l instanceof t.Param?l.value!==n&&(t.isUndef(r)?l.value=n:l.rampTo(n,r)):l instanceof AudioParam?l.value!==n&&(l.value=n):t.TimeBase&&l instanceof t.TimeBase?a[o]=n:l instanceof t?l.set(n):l!==n&&(a[o]=n))}return this},t.prototype.get=function(e){t.isUndef(e)?e=this._collectDefaults(this.constructor):t.isString(e)&&(e=[e]);for(var n={},r=0;r<e.length;r++){var i=e[r],o=this,a=n;if(-1!==i.indexOf(".")){for(var s=i.split("."),u=0;u<s.length-1;u++){var c=s[u];a[c]=a[c]||{},a=a[c],o=o[c]}i=s[s.length-1]}var l=o[i];t.isObject(e[i])?a[i]=l.get():t.Signal&&l instanceof t.Signal?a[i]=l.value:t.Param&&l instanceof t.Param?a[i]=l.value:l instanceof AudioParam?a[i]=l.value:l instanceof t?a[i]=l.get():!t.isFunction(l)&&t.isDefined(l)&&(a[i]=l)}return n},t.prototype._collectDefaults=function(e){var n=[];if(t.isDefined(e.defaults)&&(n=Object.keys(e.defaults)),t.isDefined(e._super))for(var r=this._collectDefaults(e._super),i=0;i<r.length;i++)-1===n.indexOf(r[i])&&n.push(r[i]);return n},t.defaults=function(e,n,r){var i={};if(1===e.length&&t.isObject(e[0]))i=e[0];else for(var o=0;o<n.length;o++)i[n[o]]=e[o];return t.isDefined(r.defaults)?t.defaultArg(i,r.defaults):t.isObject(r)?t.defaultArg(i,r):i},t.defaultArg=function(e,n){if(t.isObject(e)&&t.isObject(n)){var r={};for(var i in e)r[i]=t.defaultArg(n[i],e[i]);for(var o in n)r[o]=t.defaultArg(e[o],n[o]);return r}return t.isUndef(e)?n:e},t.prototype.log=function(){if(this.debug||this.toString()===t.global.TONE_DEBUG_CLASS){var e=Array.from(arguments);e.unshift(this.toString()+":"),console.log.apply(void 0,e)}},t.prototype.assert=function(e,t){if(!e)throw new Error(t)},t.connectSeries=function(){for(var e=arguments[0],n=1;n<arguments.length;n++){var r=arguments[n];e.connect(r),e=r}return t},t.isUndef=function(e){return void 0===e},t.isDefined=function(e){return!t.isUndef(e)},t.isFunction=function(e){return"function"==typeof e},t.isNumber=function(e){return"number"==typeof e},t.isObject=function(e){return"[object Object]"===Object.prototype.toString.call(e)&&e.constructor===Object},t.isBoolean=function(e){return"boolean"==typeof e},t.isArray=function(e){return Array.isArray(e)},t.isString=function(e){return"string"==typeof e},t.isNote=function(e){return t.isString(e)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(e)},t.noOp=function(){},t.prototype._readOnly=function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this._readOnly(e[t]);else Object.defineProperty(this,e,{writable:!1,enumerable:!0})},t.prototype._writable=function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this._writable(e[t]);else Object.defineProperty(this,e,{writable:!0})},t.State={Started:"started",Stopped:"stopped",Paused:"paused"},t.global=t.isUndef(r)?window:r,t.equalPowerScale=function(e){var t=.5*Math.PI;return Math.sin(e*t)},t.dbToGain=function(e){return Math.pow(10,e/20)},t.gainToDb=function(e){return Math.log(e)/Math.LN10*20},t.intervalToFrequencyRatio=function(e){return Math.pow(2,e/12)},t.prototype.now=function(){return t.context.now()},t.now=function(){return t.context.now()},t.prototype.immediate=function(){return t.context.currentTime},t.immediate=function(){return t.context.currentTime},t.extend=function(e,n){function r(){}t.isUndef(n)&&(n=t),r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e,e._super=n},t._audioContext=null,Object.defineProperty(t,"context",{get:function(){return t._audioContext},set:function(e){e.isContext?t._audioContext=e:t._audioContext=new t.Context(e),t.Context.emit("init",t._audioContext)}}),Object.defineProperty(t.prototype,"context",{get:function(){return t.context}}),t.setContext=function(e){t.context=e},Object.defineProperty(t.prototype,"blockTime",{get:function(){return 128/this.context.sampleRate}}),Object.defineProperty(t.prototype,"sampleTime",{get:function(){return 1/this.context.sampleRate}}),Object.defineProperty(t,"supported",{get:function(){var e=t.global.hasOwnProperty("AudioContext")||t.global.hasOwnProperty("webkitAudioContext"),n=t.global.hasOwnProperty("Promise");return e&&n}}),Object.defineProperty(t,"initialized",{get:function(){return Boolean(t.context)}}),t.getContext=function(e){if(t.initialized)e(t.context);else{var n=function(){e(t.context),t.Context.off("init",n)};t.Context.on("init",n)}return t},t.version=e,t}.apply(t,i))||(e.exports=o)}).call(this,n(37))},function(e,t,n){var r,i;r=[n(0),n(34),n(13),n(6)],void 0===(i=function(e){e.Context=function(){e.Emitter.call(this);var n=e.defaults(arguments,["context"],e.Context);if(!n.context&&(n.context=new e.global.AudioContext,!n.context))throw new Error("could not create AudioContext. Possibly too many AudioContexts running already.");for(this._context=n.context;this._context.rawContext;)this._context=this._context.rawContext;for(var r in this._context)this._defineProperty(this._context,r);this._latencyHint=n.latencyHint,this._constants={},this.lookAhead=n.lookAhead,this._computedUpdateInterval=0,this._ticker=new t(this.emit.bind(this,"tick"),n.clockSource,n.updateInterval),this._timeouts=new e.Timeline,this._timeoutIds=0,this.on("tick",this._timeoutLoop.bind(this)),this._context.onstatechange=function(e){this.emit("statechange",e)}.bind(this)},e.extend(e.Context,e.Emitter),e.Emitter.mixin(e.Context),e.Context.defaults={clockSource:"worker",latencyHint:"interactive",lookAhead:.1,updateInterval:.03},e.Context.prototype.isContext=!0,e.Context.prototype._defineProperty=function(t,n){e.isUndef(this[n])&&Object.defineProperty(this,n,{get:function(){return"function"==typeof t[n]?t[n].bind(t):t[n]},set:function(e){t[n]=e}})},e.Context.prototype.now=function(){return this._context.currentTime+this.lookAhead},Object.defineProperty(e.Context.prototype,"destination",{get:function(){return this.master?this.master:this._context.destination}}),e.Context.prototype.resume=function(){return"suspended"===this._context.state&&this._context instanceof AudioContext?this._context.resume():Promise.resolve()},e.Context.prototype.close=function(){var t=Promise.resolve();return this!==e.global.TONE_AUDIO_CONTEXT&&(t=this.rawContext.close()),t.then(function(){e.Context.emit("close",this)}.bind(this))},e.Context.prototype.getConstant=function(e){if(this._constants[e])return this._constants[e];for(var t=this._context.createBuffer(1,128,this._context.sampleRate),n=t.getChannelData(0),r=0;r<n.length;r++)n[r]=e;var i=this._context.createBufferSource();return i.channelCount=1,i.channelCountMode="explicit",i.buffer=t,i.loop=!0,i.start(0),this._constants[e]=i,i},e.Context.prototype._timeoutLoop=function(){for(var e=this.now();this._timeouts&&this._timeouts.length&&this._timeouts.peek().time<=e;)this._timeouts.shift().callback()},e.Context.prototype.setTimeout=function(e,t){this._timeoutIds++;var n=this.now();return this._timeouts.add({callback:e,time:n+t,id:this._timeoutIds}),this._timeoutIds},e.Context.prototype.clearTimeout=function(e){return this._timeouts.forEach(function(t){t.id===e&&this.remove(t)}),this},Object.defineProperty(e.Context.prototype,"updateInterval",{get:function(){return this._ticker.updateInterval},set:function(e){this._ticker.updateInterval=e}}),Object.defineProperty(e.Context.prototype,"rawContext",{get:function(){return this._context}}),Object.defineProperty(e.Context.prototype,"clockSource",{get:function(){return this._ticker.type},set:function(e){this._ticker.type=e}}),Object.defineProperty(e.Context.prototype,"latencyHint",{get:function(){return this._latencyHint},set:function(t){var n=t;if(this._latencyHint=t,e.isString(t))switch(t){case"interactive":n=.1,this._context.latencyHint=t;break;case"playback":n=.8,this._context.latencyHint=t;break;case"balanced":n=.25,this._context.latencyHint=t;break;case"fastest":this._context.latencyHint="interactive",n=.01}this.lookAhead=n,this.updateInterval=n/3}}),e.Context.prototype.dispose=function(){return this.close().then(function(){for(var t in e.Emitter.prototype.dispose.call(this),this._ticker.dispose(),this._ticker=null,this._timeouts.dispose(),this._timeouts=null,this._constants)this._constants[t].disconnect();this._constants=null}.bind(this))};var t=function(t,n,r){this._type=n,this._updateInterval=r,this._callback=e.defaultArg(t,e.noOp),this._createClock()};if(t.Type={Worker:"worker",Timeout:"timeout",Offline:"offline"},t.prototype._createWorker=function(){e.global.URL=e.global.URL||e.global.webkitURL;var t=new Blob(["var timeoutTime = "+(1e3*this._updateInterval).toFixed(1)+";self.onmessage = function(msg){\ttimeoutTime = parseInt(msg.data);};function tick(){\tsetTimeout(tick, timeoutTime);\tself.postMessage('tick');}tick();"]),n=URL.createObjectURL(t),r=new Worker(n);r.onmessage=this._callback.bind(this),this._worker=r},t.prototype._createTimeout=function(){this._timeout=setTimeout(function(){this._createTimeout(),this._callback()}.bind(this),1e3*this._updateInterval)},t.prototype._createClock=function(){if(this._type===t.Type.Worker)try{this._createWorker()}catch(e){this._type=t.Type.Timeout,this._createClock()}else this._type===t.Type.Timeout&&this._createTimeout()},Object.defineProperty(t.prototype,"updateInterval",{get:function(){return this._updateInterval},set:function(e){this._updateInterval=Math.max(e,128/44100),this._type===t.Type.Worker&&this._worker.postMessage(Math.max(1e3*e,1))}}),Object.defineProperty(t.prototype,"type",{get:function(){return this._type},set:function(e){this._disposeClock(),this._type=e,this._createClock()}}),t.prototype._disposeClock=function(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null),this._worker&&(this._worker.terminate(),this._worker.onmessage=null,this._worker=null)},t.prototype.dispose=function(){this._disposeClock(),this._callback=null},e.getContext(function(){var t=AudioNode.prototype.connect,n=AudioNode.prototype.disconnect;function r(n,r,i){if(n.input)return i=e.defaultArg(i,0),e.isArray(n.input)?this.connect(n.input[i]):this.connect(n.input,r,i);try{return n instanceof AudioNode?(t.call(this,n,r,i),n):(t.call(this,n,r),n)}catch(e){throw new Error("error connecting to node: "+n+"\n"+e)}}AudioNode.prototype.connect!==r&&(AudioNode.prototype.connect=r,AudioNode.prototype.disconnect=function(t,r,i){if(t&&t.input&&e.isArray(t.input))i=e.defaultArg(i,0),this.disconnect(t.input[i],r,0);else if(t&&t.input)this.disconnect(t.input,r,i);else try{t instanceof AudioParam?n.call(this,t,r):n.apply(this,arguments)}catch(e){throw new Error("error disconnecting node: "+t+"\n"+e)}})}),e.supported&&!e.initialized){if(e.global.TONE_AUDIO_CONTEXT||(e.global.TONE_AUDIO_CONTEXT=new e.Context),e.context=e.global.TONE_AUDIO_CONTEXT,!e.global.TONE_SILENCE_VERSION_LOGGING){var n="v";"dev"===e.version&&(n="");var r=" * Tone.js "+n+e.version+" * ";console.log("%c"+r,"background: #000; color: #fff")}}else e.supported||console.warn("This browser does not support Tone.js");return e.Context}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(1)],void 0===(i=function(e){return e.AudioNode=function(){e.call(this);var t=e.defaults(arguments,["context"],{context:e.context});this._context=t.context},e.extend(e.AudioNode),Object.defineProperty(e.AudioNode.prototype,"context",{get:function(){return this._context}}),e.AudioNode.prototype.createInsOuts=function(e,t){1===e?this.input=this.context.createGain():e>1&&(this.input=new Array(e)),1===t?this.output=this.context.createGain():t>1&&(this.output=new Array(t))},Object.defineProperty(e.AudioNode.prototype,"channelCount",{get:function(){return this.output.channelCount},set:function(e){return this.output.channelCount=e}}),Object.defineProperty(e.AudioNode.prototype,"channelCountMode",{get:function(){return this.output.channelCountMode},set:function(e){return this.output.channelCountMode=e}}),Object.defineProperty(e.AudioNode.prototype,"channelInterpretation",{get:function(){return this.output.channelInterpretation},set:function(e){return this.output.channelInterpretation=e}}),Object.defineProperty(e.AudioNode.prototype,"numberOfInputs",{get:function(){return this.input?e.isArray(this.input)?this.input.length:1:0}}),Object.defineProperty(e.AudioNode.prototype,"numberOfOutputs",{get:function(){return this.output?e.isArray(this.output)?this.output.length:1:0}}),e.AudioNode.prototype.connect=function(t,n,r){return e.isArray(this.output)?(n=e.defaultArg(n,0),this.output[n].connect(t,0,r)):this.output.connect(t,n,r),this},e.AudioNode.prototype.disconnect=function(t,n,r){e.isArray(this.output)?e.isNumber(t)?this.output[t].disconnect():(n=e.defaultArg(n,0),this.output[n].disconnect(t,0,r)):this.output.disconnect.apply(this.output,arguments)},e.AudioNode.prototype.chain=function(){for(var e=this,t=0;t<arguments.length;t++){var n=arguments[t];e.connect(n),e=n}return this},e.AudioNode.prototype.fan=function(){for(var e=0;e<arguments.length;e++)this.connect(arguments[e]);return this},e.global.AudioNode&&(AudioNode.prototype.chain=e.AudioNode.prototype.chain,AudioNode.prototype.fan=e.AudioNode.prototype.fan),e.AudioNode.prototype.dispose=function(){return e.isDefined(this.input)&&(this.input instanceof AudioNode&&this.input.disconnect(),this.input=null),e.isDefined(this.output)&&(this.output instanceof AudioNode&&this.output.disconnect(),this.output=null),this._context=null,this},e.AudioNode}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(11),n(5),n(2)],void 0===(i=function(e){"use strict";return e.Gain=function(){var t=e.defaults(arguments,["gain","units"],e.Gain);e.AudioNode.call(this,t),this.input=this.output=this._gainNode=this.context.createGain(),this.gain=new e.Param({param:this._gainNode.gain,units:t.units,value:t.gain,convert:t.convert}),this._readOnly("gain")},e.extend(e.Gain,e.AudioNode),e.Gain.defaults={gain:1,convert:!0},e.Gain.prototype.dispose=function(){e.AudioNode.prototype.dispose.call(this),this._gainNode.disconnect(),this._gainNode=null,this._writable("gain"),this.gain.dispose(),this.gain=null},e.Gain}.apply(t,r))||(e.exports=i)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,a,s,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}if(o(n=this._events[e]))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(i(n))for(s=Array.prototype.slice.call(arguments,1),a=(c=n.slice()).length,u=0;u<a;u++)c[u].apply(this,s);return!0},n.prototype.addListener=function(e,t){var a;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?i(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,i(this._events[e])&&!this._events[e].warned&&(a=o(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&a>0&&this._events[e].length>a&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},n.prototype.removeListener=function(e,t){var n,o,a,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(a=(n=this._events[e]).length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(s=a;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){o=s;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){var r,i;r=[n(0),n(10),n(8),n(30),n(1)],void 0===(i=function(e){return e.Type={Default:"number",Time:"time",Frequency:"frequency",TransportTime:"transportTime",Ticks:"ticks",NormalRange:"normalRange",AudioRange:"audioRange",Decibels:"db",Interval:"interval",BPM:"bpm",Positive:"positive",Gain:"gain",Cents:"cents",Degrees:"degrees",MIDI:"midi",BarsBeatsSixteenths:"barsBeatsSixteenths",Samples:"samples",Hertz:"hertz",Note:"note",Milliseconds:"milliseconds",Seconds:"seconds",Notation:"notation"},e.prototype.toSeconds=function(t){return e.isNumber(t)?t:e.isUndef(t)?this.now():e.isString(t)||e.isObject(t)?new e.Time(t).toSeconds():t instanceof e.TimeBase?t.toSeconds():void 0},e.prototype.toFrequency=function(t){return e.isNumber(t)?t:e.isString(t)||e.isUndef(t)||e.isObject(t)?new e.Frequency(t).valueOf():t instanceof e.TimeBase?t.toFrequency():void 0},e.prototype.toTicks=function(t){return e.isNumber(t)||e.isString(t)||e.isObject(t)?new e.TransportTime(t).toTicks():e.isUndef(t)?e.Transport.ticks:t instanceof e.TimeBase?t.toTicks():void 0},e}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(12)],void 0===(i=function(e){if(e.supported){!e.global.hasOwnProperty("AudioContext")&&e.global.hasOwnProperty("webkitAudioContext")&&(e.global.AudioContext=e.global.webkitAudioContext),AudioContext.prototype.close||(AudioContext.prototype.close=function(){return e.isFunction(this.suspend)&&this.suspend(),Promise.resolve()}),AudioContext.prototype.resume||(AudioContext.prototype.resume=function(){var e=this.createBuffer(1,1,this.sampleRate),t=this.createBufferSource();return t.buffer=e,t.connect(this.destination),t.start(0),Promise.resolve()}),!AudioContext.prototype.createGain&&AudioContext.prototype.createGainNode&&(AudioContext.prototype.createGain=AudioContext.prototype.createGainNode),!AudioContext.prototype.createDelay&&AudioContext.prototype.createDelayNode&&(AudioContext.prototype.createDelay=AudioContext.prototype.createDelayNode);var t=!1,n=new OfflineAudioContext(1,1,44100),r=new Uint32Array([1179011410,48,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,8,0,0,0,0]).buffer;try{var i=n.decodeAudioData(r);i&&e.isFunction(i.then)&&(t=!0)}catch(e){t=!1}t||(AudioContext.prototype._native_decodeAudioData=AudioContext.prototype.decodeAudioData,AudioContext.prototype.decodeAudioData=function(e){return new Promise(function(t,n){this._native_decodeAudioData(e,t,n)}.bind(this))})}}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(15),n(5),n(11),n(28),n(3)],void 0===(i=function(e){"use strict";return e.Signal=function(){var t=e.defaults(arguments,["value","units"],e.Signal);e.Param.call(this,t),this._constantSource=this.context.createConstantSource(),this._constantSource.start(0),this._param=this._constantSource.offset,this.value=t.value,this.output=this._constantSource,this.input=this._param=this.output.offset},e.extend(e.Signal,e.Param),e.Signal.defaults={value:0,units:e.Type.Default,convert:!0},e.Signal.prototype.connect=e.SignalBase.prototype.connect,e.Signal.prototype.disconnect=e.SignalBase.prototype.disconnect,e.Signal.prototype.getValueAtTime=function(t){return this._param.getValueAtTime?this._param.getValueAtTime(t):e.Param.prototype.getValueAtTime.call(this,t)},e.Signal.prototype.dispose=function(){return e.Param.prototype.dispose.call(this),this._constantSource.disconnect(),this._constantSource=null,this},e.Signal}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(9)],void 0===(i=function(e){e.Frequency=function(t,n){if(!(this instanceof e.Frequency))return new e.Frequency(t,n);e.TimeBase.call(this,t,n)},e.extend(e.Frequency,e.TimeBase),e.Frequency.prototype._expressions=Object.assign({},e.TimeBase.prototype._expressions,{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method:function(t){return"midi"===this._defaultUnits?t:e.Frequency.mtof(t)}},note:{regexp:/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i,method:function(n,r){var i=t[n.toLowerCase()]+12*(parseInt(r)+1);return"midi"===this._defaultUnits?i:e.Frequency.mtof(i)}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method:function(e,t,n){var r=1;return e&&"0"!==e&&(r*=this._beatsToUnits(this._getTimeSignature()*parseFloat(e))),t&&"0"!==t&&(r*=this._beatsToUnits(parseFloat(t))),n&&"0"!==n&&(r*=this._beatsToUnits(parseFloat(n)/4)),r}}}),e.Frequency.prototype.transpose=function(t){return new this.constructor(this.valueOf()*e.intervalToFrequencyRatio(t))},e.Frequency.prototype.harmonize=function(e){return e.map(function(e){return this.transpose(e)}.bind(this))},e.Frequency.prototype.toMidi=function(){return e.Frequency.ftom(this.valueOf())},e.Frequency.prototype.toNote=function(){var t=this.toFrequency(),r=Math.log2(t/e.Frequency.A4),i=Math.round(12*r)+57,o=Math.floor(i/12);return o<0&&(i+=-12*o),n[i%12]+o.toString()},e.Frequency.prototype.toSeconds=function(){return 1/e.TimeBase.prototype.toSeconds.call(this)},e.Frequency.prototype.toFrequency=function(){return e.TimeBase.prototype.toFrequency.call(this)},e.Frequency.prototype.toTicks=function(){var t=this._beatsToUnits(1),n=this.valueOf()/t;return Math.floor(n*e.Transport.PPQ)},e.Frequency.prototype._noArg=function(){return 0},e.Frequency.prototype._frequencyToUnits=function(e){return e},e.Frequency.prototype._ticksToUnits=function(t){return 1/(60*t/(e.Transport.bpm.value*e.Transport.PPQ))},e.Frequency.prototype._beatsToUnits=function(t){return 1/e.TimeBase.prototype._beatsToUnits.call(this,t)},e.Frequency.prototype._secondsToUnits=function(e){return 1/e},e.Frequency.prototype._defaultUnits="hz";var t={cbb:-2,cb:-1,c:0,"c#":1,cx:2,dbb:0,db:1,d:2,"d#":3,dx:4,ebb:2,eb:3,e:4,"e#":5,ex:6,fbb:3,fb:4,f:5,"f#":6,fx:7,gbb:5,gb:6,g:7,"g#":8,gx:9,abb:7,ab:8,a:9,"a#":10,ax:11,bbb:9,bb:10,b:11,"b#":12,bx:13},n=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];return e.Frequency.A4=440,e.Frequency.mtof=function(t){return e.Frequency.A4*Math.pow(2,(t-69)/12)},e.Frequency.ftom=function(t){return 69+Math.round(12*Math.log2(t/e.Frequency.A4))},e.Frequency}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0)],void 0===(i=function(e){return e.TimeBase=function(t,n){if(!(this instanceof e.TimeBase))return new e.TimeBase(t,n);if(this._val=t,this._units=n,e.isUndef(this._units)&&e.isString(this._val)&&parseFloat(this._val)==this._val&&"+"!==this._val.charAt(0))this._val=parseFloat(this._val),this._units=this._defaultUnits;else if(t&&t.constructor===this.constructor)this._val=t._val,this._units=t._units;else if(t instanceof e.TimeBase)switch(this._defaultUnits){case"s":this._val=t.toSeconds();break;case"i":this._val=t.toTicks();break;case"hz":this._val=t.toFrequency();break;case"midi":this._val=t.toMidi();break;default:throw new Error("Unrecognized default units "+this._defaultUnits)}},e.extend(e.TimeBase),e.TimeBase.prototype._expressions={n:{regexp:/^(\d+)n(\.?)$/i,method:function(e,t){e=parseInt(e);var n="."===t?1.5:1;return 1===e?this._beatsToUnits(this._getTimeSignature())*n:this._beatsToUnits(4/e)*n}},t:{regexp:/^(\d+)t$/i,method:function(e){return e=parseInt(e),this._beatsToUnits(8/(3*parseInt(e)))}},m:{regexp:/^(\d+)m$/i,method:function(e){return this._beatsToUnits(parseInt(e)*this._getTimeSignature())}},i:{regexp:/^(\d+)i$/i,method:function(e){return this._ticksToUnits(parseInt(e))}},hz:{regexp:/^(\d+(?:\.\d+)?)hz$/i,method:function(e){return this._frequencyToUnits(parseFloat(e))}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/,method:function(e,t,n){var r=0;return e&&"0"!==e&&(r+=this._beatsToUnits(this._getTimeSignature()*parseFloat(e))),t&&"0"!==t&&(r+=this._beatsToUnits(parseFloat(t))),n&&"0"!==n&&(r+=this._beatsToUnits(parseFloat(n)/4)),r}},s:{regexp:/^(\d+(?:\.\d+)?)s$/,method:function(e){return this._secondsToUnits(parseFloat(e))}},samples:{regexp:/^(\d+)samples$/,method:function(e){return parseInt(e)/this.context.sampleRate}},default:{regexp:/^(\d+(?:\.\d+)?)$/,method:function(e){return this._expressions[this._defaultUnits].method.call(this,e)}}},e.TimeBase.prototype._defaultUnits="s",e.TimeBase.prototype._getBpm=function(){return e.Transport?e.Transport.bpm.value:120},e.TimeBase.prototype._getTimeSignature=function(){return e.Transport?e.Transport.timeSignature:4},e.TimeBase.prototype._getPPQ=function(){return e.Transport?e.Transport.PPQ:192},e.TimeBase.prototype._now=function(){return this.now()},e.TimeBase.prototype._frequencyToUnits=function(e){return 1/e},e.TimeBase.prototype._beatsToUnits=function(e){return 60/this._getBpm()*e},e.TimeBase.prototype._secondsToUnits=function(e){return e},e.TimeBase.prototype._ticksToUnits=function(e){return e*(this._beatsToUnits(1)/this._getPPQ())},e.TimeBase.prototype._noArg=function(){return this._now()},e.TimeBase.prototype.valueOf=function(){if(e.isUndef(this._val))return this._noArg();if(e.isString(this._val)&&e.isUndef(this._units)){for(var t in this._expressions)if(this._expressions[t].regexp.test(this._val.trim())){this._units=t;break}}else if(e.isObject(this._val)){var n=0;for(var r in this._val){var i=this._val[r];n+=new this.constructor(r).valueOf()*i}return n}if(e.isDefined(this._units)){var o=this._expressions[this._units],a=this._val.toString().trim().match(o.regexp);return a?o.method.apply(this,a.slice(1)):o.method.call(this,parseFloat(this._val))}return this._val},e.TimeBase.prototype.toSeconds=function(){return this.valueOf()},e.TimeBase.prototype.toFrequency=function(){return 1/this.toSeconds()},e.TimeBase.prototype.toSamples=function(){return this.toSeconds()*this.context.sampleRate},e.TimeBase.prototype.toMilliseconds=function(){return 1e3*this.toSeconds()},e.TimeBase.prototype.dispose=function(){this._val=null,this._units=null},e.TimeBase}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(9),n(8)],void 0===(i=function(e){return e.Time=function(t,n){if(!(this instanceof e.Time))return new e.Time(t,n);e.TimeBase.call(this,t,n)},e.extend(e.Time,e.TimeBase),e.Time.prototype._expressions=Object.assign({},e.TimeBase.prototype._expressions,{quantize:{regexp:/^@(.+)/,method:function(t){if(e.Transport){var n=new this.constructor(t);return this._secondsToUnits(e.Transport.nextSubdivision(n))}return 0}},now:{regexp:/^\+(.+)/,method:function(e){return this._now()+new this.constructor(e)}}}),e.Time.prototype.quantize=function(t,n){n=e.defaultArg(n,1);var r=new this.constructor(t),i=this.valueOf();return i+(Math.round(i/r)*r-i)*n},e.Time.prototype.toNotation=function(){for(var t=this.toSeconds(),n=["1m"],r=1;r<8;r++){var i=Math.pow(2,r);n.push(i+"n."),n.push(i+"n"),n.push(i+"t")}n.push("0");var o=n[0],a=e.Time(n[0]).toSeconds();return n.forEach(function(n){var r=e.Time(n).toSeconds();Math.abs(r-t)<Math.abs(a-t)&&(o=n,a=r)}),o},e.Time.prototype.toBarsBeatsSixteenths=function(){var e=this._beatsToUnits(1),t=this.valueOf()/e;t=parseFloat(t.toFixed(4));var n=Math.floor(t/this._getTimeSignature()),r=t%1*4;return t=Math.floor(t)%this._getTimeSignature(),(r=r.toString()).length>3&&(r=parseFloat(parseFloat(r).toFixed(3))),[n,t,r].join(":")},e.Time.prototype.toTicks=function(){var e=this._beatsToUnits(1),t=this.valueOf()/e;return Math.round(t*this._getPPQ())},e.Time.prototype.toSeconds=function(){return this.valueOf()},e.Time.prototype.toMidi=function(){return e.Frequency.ftom(this.toFrequency())},e.Time}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(5),n(2),n(13)],void 0===(i=function(e){"use strict";return e.Param=function(){var t=e.defaults(arguments,["param","units","convert"],e.Param);e.AudioNode.call(this,t),this._param=this.input=t.param,this.units=t.units,this.convert=t.convert,this.overridden=!1,this._events=new e.Timeline(1e3),e.isDefined(t.value)&&this._param&&this.setValueAtTime(t.value,0)},e.extend(e.Param,e.AudioNode),e.Param.defaults={units:e.Type.Default,convert:!0,param:void 0},Object.defineProperty(e.Param.prototype,"value",{get:function(){var e=this.now();return this._toUnits(this.getValueAtTime(e))},set:function(e){this._initialValue=this._fromUnits(e),this.cancelScheduledValues(this.context.currentTime),this.setValueAtTime(e,this.context.currentTime)}}),Object.defineProperty(e.Param.prototype,"minValue",{get:function(){return this.units===e.Type.Time||this.units===e.Type.Frequency||this.units===e.Type.NormalRange||this.units===e.Type.Positive||this.units===e.Type.BPM?0:this.units===e.Type.AudioRange?-1:this.units===e.Type.Decibels?-1/0:this._param.minValue}}),Object.defineProperty(e.Param.prototype,"maxValue",{get:function(){return this.units===e.Type.NormalRange||this.units===e.Type.AudioRange?1:this._param.maxValue}}),e.Param.prototype._fromUnits=function(t){if(!this.convert&&!e.isUndef(this.convert)||this.overridden)return t;switch(this.units){case e.Type.Time:return this.toSeconds(t);case e.Type.Frequency:return this.toFrequency(t);case e.Type.Decibels:return e.dbToGain(t);case e.Type.NormalRange:return Math.min(Math.max(t,0),1);case e.Type.AudioRange:return Math.min(Math.max(t,-1),1);case e.Type.Positive:return Math.max(t,0);default:return t}},e.Param.prototype._toUnits=function(t){if(!this.convert&&!e.isUndef(this.convert))return t;switch(this.units){case e.Type.Decibels:return e.gainToDb(t);default:return t}},e.Param.prototype._minOutput=1e-5,e.Param.AutomationType={Linear:"linearRampToValueAtTime",Exponential:"exponentialRampToValueAtTime",Target:"setTargetAtTime",SetValue:"setValueAtTime",Cancel:"cancelScheduledValues"},e.Param.prototype.setValueAtTime=function(t,n){return n=this.toSeconds(n),t=this._fromUnits(t),this._events.add({type:e.Param.AutomationType.SetValue,value:t,time:n}),this.log(e.Param.AutomationType.SetValue,t,n),this._param.setValueAtTime(t,n),this},e.Param.prototype.getValueAtTime=function(t){t=this.toSeconds(t);var n=this._events.getAfter(t),r=this._events.get(t),i=e.defaultArg(this._initialValue,this._param.defaultValue),o=i;if(null===r)o=i;else if(r.type===e.Param.AutomationType.Target){var a,s=this._events.getBefore(r.time);a=null===s?i:s.value,o=this._exponentialApproach(r.time,a,r.value,r.constant,t)}else o=null===n?r.value:n.type===e.Param.AutomationType.Linear?this._linearInterpolate(r.time,r.value,n.time,n.value,t):n.type===e.Param.AutomationType.Exponential?this._exponentialInterpolate(r.time,r.value,n.time,n.value,t):r.value;return o},e.Param.prototype.setRampPoint=function(e){e=this.toSeconds(e);var t=this.getValueAtTime(e);return this.cancelAndHoldAtTime(e),0===t&&(t=this._minOutput),this.setValueAtTime(this._toUnits(t),e),this},e.Param.prototype.linearRampToValueAtTime=function(t,n){return t=this._fromUnits(t),n=this.toSeconds(n),this._events.add({type:e.Param.AutomationType.Linear,value:t,time:n}),this.log(e.Param.AutomationType.Linear,t,n),this._param.linearRampToValueAtTime(t,n),this},e.Param.prototype.exponentialRampToValueAtTime=function(t,n){return t=this._fromUnits(t),t=Math.max(this._minOutput,t),n=this.toSeconds(n),this._events.add({type:e.Param.AutomationType.Exponential,time:n,value:t}),this.log(e.Param.AutomationType.Exponential,t,n),this._param.exponentialRampToValueAtTime(t,n),this},e.Param.prototype.exponentialRampTo=function(e,t,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialRampToValueAtTime(e,n+this.toSeconds(t)),this},e.Param.prototype.linearRampTo=function(e,t,n){return n=this.toSeconds(n),this.setRampPoint(n),this.linearRampToValueAtTime(e,n+this.toSeconds(t)),this},e.Param.prototype.targetRampTo=function(e,t,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialApproachValueAtTime(e,n,t),this},e.Param.prototype.exponentialApproachValueAtTime=function(e,t,n){var r=Math.log(this.toSeconds(n)+1)/Math.log(200);return t=this.toSeconds(t),this.setTargetAtTime(e,t,r)},e.Param.prototype.setTargetAtTime=function(t,n,r){if(t=this._fromUnits(t),r<=0)throw new Error("timeConstant must be greater than 0");return n=this.toSeconds(n),this._events.add({type:e.Param.AutomationType.Target,value:t,time:n,constant:r}),this.log(e.Param.AutomationType.Target,t,n,r),this._param.setTargetAtTime(t,n,r),this},e.Param.prototype.setValueCurveAtTime=function(t,n,r,i){i=e.defaultArg(i,1),r=this.toSeconds(r),n=this.toSeconds(n),this.setValueAtTime(t[0]*i,n);for(var o=r/(t.length-1),a=1;a<t.length;a++)this.linearRampToValueAtTime(t[a]*i,n+a*o);return this},e.Param.prototype.cancelScheduledValues=function(t){return t=this.toSeconds(t),this._events.cancel(t),this._param.cancelScheduledValues(t),this.log(e.Param.AutomationType.Cancel,t),this},e.Param.prototype.cancelAndHoldAtTime=function(t){var n=this.getValueAtTime(t);this.log("cancelAndHoldAtTime",t,"value="+n),this._param.cancelScheduledValues(t);var r=this._events.get(t),i=this._events.getAfter(t);return r&&r.time===t?i?this._events.cancel(i.time):this._events.cancel(t+1e-6):i&&(this._events.cancel(i.time),i.type===e.Param.AutomationType.Linear?this.linearRampToValueAtTime(n,t):i.type===e.Param.AutomationType.Exponential&&this.exponentialRampToValueAtTime(n,t)),this._events.add({type:e.Param.AutomationType.SetValue,value:n,time:t}),this._param.setValueAtTime(n,t),this},e.Param.prototype.rampTo=function(t,n,r){return n=e.defaultArg(n,.1),this.units===e.Type.Frequency||this.units===e.Type.BPM||this.units===e.Type.Decibels?this.exponentialRampTo(t,n,r):this.linearRampTo(t,n,r),this},e.Param.prototype._exponentialApproach=function(e,t,n,r,i){return n+(t-n)*Math.exp(-(i-e)/r)},e.Param.prototype._linearInterpolate=function(e,t,n,r,i){return t+(i-e)/(n-e)*(r-t)},e.Param.prototype._exponentialInterpolate=function(e,t,n,r,i){return t*Math.pow(r/t,(i-e)/(n-e))},e.Param.prototype.dispose=function(){return e.AudioNode.prototype.dispose.call(this),this._param=null,this._events=null,this},e.Param}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0)],void 0===(i=function(e){if(e.supported){!e.global.hasOwnProperty("OfflineAudioContext")&&e.global.hasOwnProperty("webkitOfflineAudioContext")&&(e.global.OfflineAudioContext=e.global.webkitOfflineAudioContext);var t=new OfflineAudioContext(1,1,44100).startRendering();t&&e.isFunction(t.then)||(OfflineAudioContext.prototype._native_startRendering=OfflineAudioContext.prototype.startRendering,OfflineAudioContext.prototype.startRendering=function(){return new Promise(function(e){this.oncomplete=function(t){e(t.renderedBuffer)},this._native_startRendering()}.bind(this))})}}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0)],void 0===(i=function(e){"use strict";return e.Timeline=function(){var t=e.defaults(arguments,["memory"],e.Timeline);e.call(this),this._timeline=[],this.memory=t.memory},e.extend(e.Timeline),e.Timeline.defaults={memory:1/0},Object.defineProperty(e.Timeline.prototype,"length",{get:function(){return this._timeline.length}}),e.Timeline.prototype.add=function(t){if(e.isUndef(t.time))throw new Error("Tone.Timeline: events must have a time attribute");t.time=t.time.valueOf();var n=this._search(t.time);if(this._timeline.splice(n+1,0,t),this.length>this.memory){var r=this.length-this.memory;this._timeline.splice(0,r)}return this},e.Timeline.prototype.remove=function(e){var t=this._timeline.indexOf(e);return-1!==t&&this._timeline.splice(t,1),this},e.Timeline.prototype.get=function(t,n){n=e.defaultArg(n,"time");var r=this._search(t,n);return-1!==r?this._timeline[r]:null},e.Timeline.prototype.peek=function(){return this._timeline[0]},e.Timeline.prototype.shift=function(){return this._timeline.shift()},e.Timeline.prototype.getAfter=function(t,n){n=e.defaultArg(n,"time");var r=this._search(t,n);return r+1<this._timeline.length?this._timeline[r+1]:null},e.Timeline.prototype.getBefore=function(t,n){n=e.defaultArg(n,"time");var r=this._timeline.length;if(r>0&&this._timeline[r-1][n]<t)return this._timeline[r-1];var i=this._search(t,n);return i-1>=0?this._timeline[i-1]:null},e.Timeline.prototype.cancel=function(e){if(this._timeline.length>1){var t=this._search(e);if(t>=0)if(this._timeline[t].time===e){for(var n=t;n>=0&&this._timeline[n].time===e;n--)t=n;this._timeline=this._timeline.slice(0,t)}else this._timeline=this._timeline.slice(0,t+1);else this._timeline=[]}else 1===this._timeline.length&&this._timeline[0].time>=e&&(this._timeline=[]);return this},e.Timeline.prototype.cancelBefore=function(e){var t=this._search(e);return t>=0&&(this._timeline=this._timeline.slice(t+1)),this},e.Timeline.prototype.previousEvent=function(e){var t=this._timeline.indexOf(e);return t>0?this._timeline[t-1]:null},e.Timeline.prototype._search=function(t,n){if(0===this._timeline.length)return-1;n=e.defaultArg(n,"time");var r=0,i=this._timeline.length,o=i;if(i>0&&this._timeline[i-1][n]<=t)return i-1;for(;r<o;){var a=Math.floor(r+(o-r)/2),s=this._timeline[a],u=this._timeline[a+1];if(s[n]===t){for(var c=a;c<this._timeline.length;c++)this._timeline[c][n]===t&&(a=c);return a}if(s[n]<t&&u[n]>t)return a;s[n]>t?o=a:r=a+1}return-1},e.Timeline.prototype._iterate=function(t,n,r){n=e.defaultArg(n,0),r=e.defaultArg(r,this._timeline.length-1),this._timeline.slice(n,r+1).forEach(function(e){t.call(this,e)}.bind(this))},e.Timeline.prototype.forEach=function(e){return this._iterate(e),this},e.Timeline.prototype.forEachBefore=function(e,t){var n=this._search(e);return-1!==n&&this._iterate(t,0,n),this},e.Timeline.prototype.forEachAfter=function(e,t){var n=this._search(e);return this._iterate(t,n+1),this},e.Timeline.prototype.forEachBetween=function(e,t,n){var r=this._search(e),i=this._search(t);return-1!==r&&-1!==i?(this._timeline[r].time!==e&&(r+=1),this._timeline[i].time===t&&(i-=1),this._iterate(n,r,i)):-1===r&&this._iterate(n,0,i),this},e.Timeline.prototype.forEachFrom=function(e,t){for(var n=this._search(e);n>=0&&this._timeline[n].time>=e;)n--;return this._iterate(t,n+1),this},e.Timeline.prototype.forEachAtTime=function(e,t){var n=this._search(e);return-1!==n&&this._iterate(function(n){n.time===e&&t.call(this,n)},0,n),this},e.Timeline.prototype.dispose=function(){return e.prototype.dispose.call(this),this._timeline=null,this},e.Timeline}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(2)],void 0===(i=function(e){"use strict";return e.SignalBase=function(){e.AudioNode.call(this)},e.extend(e.SignalBase,e.AudioNode),e.SignalBase.prototype.connect=function(t,n,r){return e.Signal&&e.Signal===t.constructor||e.Param&&e.Param===t.constructor?(t._param.cancelScheduledValues(0),t._param.setValueAtTime(0,0),t.overridden=!0):t instanceof AudioParam&&(t.cancelScheduledValues(0),t.setValueAtTime(0,0)),e.AudioNode.prototype.connect.call(this,t,n,r),this},e.SignalBase}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(14),n(33)],void 0===(i=function(e){"use strict";return e.WaveShaper=function(t,n){e.SignalBase.call(this),this._shaper=this.input=this.output=this.context.createWaveShaper(),this._curve=null,Array.isArray(t)?this.curve=t:isFinite(t)||e.isUndef(t)?this._curve=new Float32Array(e.defaultArg(t,1024)):e.isFunction(t)&&(this._curve=new Float32Array(e.defaultArg(n,1024)),this.setMap(t))},e.extend(e.WaveShaper,e.SignalBase),e.WaveShaper.prototype.setMap=function(e){for(var t=new Array(this._curve.length),n=0,r=this._curve.length;n<r;n++){var i=n/(r-1)*2-1;t[n]=e(i,n)}return this.curve=t,this},Object.defineProperty(e.WaveShaper.prototype,"curve",{get:function(){return this._shaper.curve},set:function(e){this._curve=new Float32Array(e),this._shaper.curve=this._curve}}),Object.defineProperty(e.WaveShaper.prototype,"oversample",{get:function(){return this._shaper.oversample},set:function(e){if(!["none","2x","4x"].includes(e))throw new RangeError("Tone.WaveShaper: oversampling must be either 'none', '2x', or '4x'");this._shaper.oversample=e}}),e.WaveShaper.prototype.dispose=function(){return e.SignalBase.prototype.dispose.call(this),this._shaper.disconnect(),this._shaper=null,this._curve=null,this},e.WaveShaper}.apply(t,r))||(e.exports=i)},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">\n    <path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/>\n    \x3c!-- <path d="M0 0h24v24H0z" fill="none"/> --\x3e\n</svg>\n'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">\n    <path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/>\n    \x3c!-- <path d="M0 0h24v24H0z" fill="none"/> --\x3e\n</svg>\n'},function(e,t,n){"use strict";n.r(t);var r=n(4),i=n(17),o=n.n(i),a=n(16),s=n.n(a);class u extends r.EventEmitter{constructor(e){super(),this.element=document.createElement("button"),this.element.id="unmute-button",this.element.setAttribute("aria-pressed",!1),this.element.setAttribute("aria-label","mute"),"none"!==e&&e.appendChild(this.element),this.element.addEventListener("click",e=>{this.emit("click",e)}),this.mute=!0}get mute(){return this.element.classList.contains("muted")}set mute(e){this.element.setAttribute("aria-pressed",e),e?(this.element.classList.add("muted"),this.element.innerHTML=s.a):(this.element.classList.remove("muted"),this.element.innerHTML=o.a)}click(){this.element.click()}remove(){this.element.remove()}}var c=n(0),l=n.n(c);n(35),n(1),n(25);class h extends r.EventEmitter{constructor(e,t,n){super(),n&&n.context!==l.a.context?l.a.context=n.context:e&&e!==l.a.context&&(l.a.context=e),this.context=l.a.context,n&&n.Master!==l.a.Master?this.master=n.Master:this.master=this.context.master,this.context.addEventListener("statechange",e=>{this.emit("statechange",e)}),this.master.mute=t;let r=this.mute;const i=()=>{requestAnimationFrame(i),this.mute!==r&&(r=this.mute,this.emit("mute",this.mute))};i()}get state(){return this.context.state}get mute(){return this.master.mute||"running"!==this.state}set mute(e){"running"===this.state&&(this.master.mute=e)}resume(){return l.a.supported&&"running"!==this.state?this.context.resume():Promise.resolve()}started(){return"running"===this.state?Promise.resolve():new Promise(e=>{this.on("statechange",()=>{"running"===this.state&&e()})})}toggleMute(){this.mute=!this.mute}}const d="data:audio/mp3;base64,//MkxAAHiAICWABElBeKPL/RANb2w+yiT1g/gTok//lP/W/l3h8QO/OCdCqCW2Cw//MkxAQHkAIWUAhEmAQXWUOFW2dxPu//9mr60ElY5sseQ+xxesmHKtZr7bsqqX2L//MkxAgFwAYiQAhEAC2hq22d3///9FTV6tA36JdgBJoOGgc+7qvqej5Zu7/7uI9l//MkxBQHAAYi8AhEAO193vt9KGOq+6qcT7hhfN5FTInmwk8RkqKImTM55pRQHQSq//MkxBsGkgoIAABHhTACIJLf99nVI///yuW1uBqWfEu7CgNPWGpUadBmZ////4sL//MkxCMHMAH9iABEmAsKioqKigsLCwtVTEFNRTMuOTkuNVVVVVVVVVVVVVVVVVVV//MkxCkECAUYCAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV";class f{constructor(e){this.element=document.createElement("audio"),this.element.controls=!1,this.element.preload="auto",this.element.loop=!1,this.element.src=d,this.element.title=e}click(){this.element.play()}}const p=document.currentScript;n(23),n.d(t,"UnmuteButton",function(){return g});class m extends r.EventEmitter{constructor({container:e=document.body,tone:t=window.Tone,context:n=(t?t.context:null),title:r="Web Audio",mute:i=!1}={}){super(),this._button=new u(e),this._context=new h(n,i,t),this._audioElement=new f(r),this._context.on("mute",e=>{this._button.mute=e,this.emit(e?"mute":"unmute")}),this._button.on("click",()=>{"running"!==this._context.state?(this.start(),this.emit("click")):this._context.toggleMute()}),this._context.started().then(()=>{this.emit("start")}),this._button.mute=this._context.mute}get mute(){return this._context.mute}set mute(e){this._button.mute=e,this._context.mute=e}get element(){return this._button.element}get context(){return this._context.context}remove(){this._button.remove()}click(){this._button.click()}start(){"running"!==this._context.state&&(this._context.resume(),this._audioElement.click())}}function g(...e){return new m(...e)}!function(e){const t=p.getAttribute("data-add-button");if(p&&"true"===t){const t="true"===p.getAttribute("data-mute");"complete"===document.readyState?e({mute:t}):window.addEventListener("load",()=>e({mute:t}))}}(g)},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,r=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(e,t){var i,o=t.trim().replace(/^"(.*)"$/,function(e,t){return t}).replace(/^'(.*)'$/,function(e,t){return t});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(o)?e:(i=0===o.indexOf("//")?o:0===o.indexOf("/")?n+o:r+o.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")})}},function(e,t,n){var r,i,o={},a=(r=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===i&&(i=r.apply(this,arguments)),i}),s=function(e){var t={};return function(e){if("function"==typeof e)return e();if(void 0===t[e]){var n=function(e){return document.querySelector(e)}.call(this,e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}}(),u=null,c=0,l=[],h=n(19);function d(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=o[r.id];if(i){i.refs++;for(var a=0;a<i.parts.length;a++)i.parts[a](r.parts[a]);for(;a<r.parts.length;a++)i.parts.push(y(r.parts[a],t))}else{var s=[];for(a=0;a<r.parts.length;a++)s.push(y(r.parts[a],t));o[r.id]={id:r.id,refs:1,parts:s}}}}function f(e,t){for(var n=[],r={},i=0;i<e.length;i++){var o=e[i],a=t.base?o[0]+t.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 p(e,t){var n=s(e.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=l[l.length-1];if("top"===e.insertAt)r?r.nextSibling?n.insertBefore(t,r.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),l.push(t);else if("bottom"===e.insertAt)n.appendChild(t);else{if("object"!=typeof e.insertAt||!e.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=s(e.insertInto+" "+e.insertAt.before);n.insertBefore(t,i)}}function m(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=l.indexOf(e);t>=0&&l.splice(t,1)}function g(e){var t=document.createElement("style");return void 0===e.attrs.type&&(e.attrs.type="text/css"),b(t,e.attrs),p(e,t),t}function b(e,t){Object.keys(t).forEach(function(n){e.setAttribute(n,t[n])})}function y(e,t){var n,r,i,o;if(t.transform&&e.css){if(!(o=t.transform(e.css)))return function(){};e.css=o}if(t.singleton){var a=c++;n=u||(u=g(t)),r=w.bind(null,n,a,!1),i=w.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",b(t,e.attrs),p(e,t),t}(t),r=function(e,t,n){var r=n.css,i=n.sourceMap,o=void 0===t.convertToAbsoluteUrls&&i;(t.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=e.href;e.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,t),i=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=g(t),r=function(e,t){var n=t.css,r=t.media;if(r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,n),i=function(){m(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()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=a()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=f(e,t);return d(n,t),function(e){for(var r=[],i=0;i<n.length;i++){var a=n[i];(s=o[a.id]).refs--,r.push(s)}for(e&&d(f(e,t),t),i=0;i<r.length;i++){var s;if(0===(s=r[i]).refs){for(var u=0;u<s.parts.length;u++)s.parts[u]();delete o[s.id]}}}};var v,_=(v=[],function(e,t){return v[e]=t,v.filter(Boolean).join("\n")});function w(e,t,n,r){var i=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=_(t,i);else{var o=document.createTextNode(i),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(o,a[t]):e.appendChild(o)}}},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=function(e,t){var n,r=e[1]||"",i=e[3];if(!i)return r;if(t&&"function"==typeof btoa){var o=(n=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */"),a=i.sources.map(function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"});return[r].concat(a).concat([o]).join("\n")}return[r].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},i=0;i<this.length;i++){var o=this[i][0];"number"==typeof o&&(r[o]=!0)}for(i=0;i<e.length;i++){var a=e[i];"number"==typeof a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),t.push(a))}},t}},function(e,t,n){(e.exports=n(21)(!1)).push([e.i,"#unmute-button{--unmute-margin:8px;--unmute-size:24px;position:fixed;right:var(--unmute-margin);top:var(--unmute-margin);border-radius:50%;width:var(--unmute-size);height:var(--unmute-size);background-color:transparent;border:none;cursor:pointer}#unmute-button svg{position:absolute;left:0;top:0;width:100%;height:100%}",""])},function(e,t,n){var r=n(22);"string"==typeof r&&(r=[[e.i,r,""]]),n(20)(r,{hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(e.exports=r.locals)},function(e,t,n){var r,i;r=[n(0),n(7),n(3),n(2)],void 0===(i=function(e){"use strict";return e.Volume=function(){var t=e.defaults(arguments,["volume"],e.Volume);e.AudioNode.call(this,t),this.output=this.input=new e.Gain(t.volume,e.Type.Decibels),this._unmutedVolume=t.volume,this.volume=this.output.gain,this._readOnly("volume"),this.mute=t.mute},e.extend(e.Volume,e.AudioNode),e.Volume.defaults={volume:0,mute:!1},Object.defineProperty(e.Volume.prototype,"mute",{get:function(){return this.volume.value===-1/0},set:function(e){!this.mute&&e?(this._unmutedVolume=this.volume.value,this.volume.value=-1/0):this.mute&&!e&&(this.volume.value=this._unmutedVolume)}}),e.Volume.prototype.dispose=function(){return this.input.dispose(),e.AudioNode.prototype.dispose.call(this),this._writable("volume"),this.volume.dispose(),this.volume=null,this},e.Volume}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(24),n(1),n(2)],void 0===(i=function(e){"use strict";e.Master=function(){e.AudioNode.call(this),e.getContext(function(){this.createInsOuts(1,0),this._volume=this.output=new e.Volume,this.volume=this._volume.volume,this._readOnly("volume"),this.input.chain(this.output,this.context.destination),this.context.master=this}.bind(this))},e.extend(e.Master,e.AudioNode),e.Master.defaults={volume:0,mute:!1},e.Master.prototype.isMaster=!0,Object.defineProperty(e.Master.prototype,"mute",{get:function(){return this._volume.mute},set:function(e){this._volume.mute=e}}),e.Master.prototype.chain=function(){this.input.disconnect(),this.input.chain.apply(this.input,arguments),arguments[arguments.length-1].connect(this.output)},e.Master.prototype.dispose=function(){e.AudioNode.prototype.dispose.call(this),this._writable("volume"),this._volume.dispose(),this._volume=null,this.volume=null},e.AudioNode.prototype.toMaster=function(){return this.connect(this.context.master),this};var t=e.Master;return e.Master=new t,e.Context.on("init",function(n){n.master&&n.master.isMaster?e.Master=n.master:e.Master=new t}),e.Context.on("close",function(e){e.master&&e.master.isMaster&&e.master.dispose()}),e.Master}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(1),n(12)],void 0===(i=function(e){return e.OfflineContext=function(t,n,r){var i=new OfflineAudioContext(t,n*r,r);e.Context.call(this,{context:i,clockSource:"offline",lookAhead:0,updateInterval:128/r}),this._duration=n,this._currentTime=0},e.extend(e.OfflineContext,e.Context),e.OfflineContext.prototype.now=function(){return this._currentTime},e.OfflineContext.prototype.resume=function(){return Promise.resolve()},e.OfflineContext.prototype.render=function(){for(;this._duration-this._currentTime>=0;)this.emit("tick"),this._currentTime+=this.blockTime;return this._context.startRendering()},e.OfflineContext.prototype.close=function(){return this._context=null,Promise.resolve()},e.OfflineContext}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(26)],void 0===(i=function(e){if(e.supported){var t=navigator.userAgent.toLowerCase();t.includes("safari")&&!t.includes("chrome")&&t.includes("mobile")&&(e.OfflineContext.prototype.createBufferSource=function(){var e=this._context.createBufferSource(),t=e.start;return e.start=function(n){this.setTimeout(function(){t.call(e,n)}.bind(this),0)}.bind(this),e})}}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(6),n(27),n(1),n(3)],void 0===(i=function(e){if(e.supported&&!e.global.AudioContext.prototype.createConstantSource){var t=function(e){this.context=e;for(var t=e.createBuffer(1,128,e.sampleRate),n=t.getChannelData(0),r=0;r<n.length;r++)n[r]=1;this._bufferSource=e.createBufferSource(),this._bufferSource.channelCount=1,this._bufferSource.channelCountMode="explicit",this._bufferSource.buffer=t,this._bufferSource.loop=!0;var i=this._output=e.createGain();this.offset=i.gain,this._bufferSource.connect(i)};t.prototype.start=function(e){return this._bufferSource.start(e),this},t.prototype.stop=function(e){return this._bufferSource.stop(e),this},t.prototype.connect=function(){return this._output.connect.apply(this._output,arguments),this},t.prototype.disconnect=function(){return this._output.disconnect.apply(this._output,arguments),this},AudioContext.prototype.createConstantSource=function(){return new t(this)},e.Context.prototype.createConstantSource=function(){return new t(this)}}}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(3),n(2)],void 0===(i=function(e){"use strict";return e.Split=function(){e.AudioNode.call(this),this.createInsOuts(0,2),this._splitter=this.input=this.context.createChannelSplitter(2),this.left=this.output[0]=new e.Gain,this.right=this.output[1]=new e.Gain,this._splitter.connect(this.left,0,0),this._splitter.connect(this.right,1,0)},e.extend(e.Split,e.AudioNode),e.Split.prototype.dispose=function(){return e.AudioNode.prototype.dispose.call(this),this._splitter.disconnect(),this.left.dispose(),this.left=null,this.right.dispose(),this.right=null,this._splitter=null,this},e.Split}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(10)],void 0===(i=function(e){return e.TransportTime=function(t,n){if(!(this instanceof e.TransportTime))return new e.TransportTime(t,n);e.Time.call(this,t,n)},e.extend(e.TransportTime,e.Time),e.TransportTime.prototype._now=function(){return e.Transport.seconds},e.TransportTime}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(3),n(14)],void 0===(i=function(e){return e.Zero=function(){e.SignalBase.call(this),this._gain=this.input=this.output=new e.Gain,this.context.getConstant(0).connect(this._gain)},e.extend(e.Zero,e.SignalBase),e.Zero.prototype.dispose=function(){return e.SignalBase.prototype.dispose.call(this),this._gain.dispose(),this._gain=null,this},e.Zero}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(2)],void 0===(i=function(e){"use strict";return e.Merge=function(){e.AudioNode.call(this),this.createInsOuts(2,0),this.left=this.input[0]=new e.Gain,this.right=this.input[1]=new e.Gain,this._merger=this.output=this.context.createChannelMerger(2),this.left.connect(this._merger,0,0),this.right.connect(this._merger,0,1),this.left.channelCount=1,this.right.channelCount=1,this.left.channelCountMode="explicit",this.right.channelCountMode="explicit"},e.extend(e.Merge,e.AudioNode),e.Merge.prototype.dispose=function(){return e.AudioNode.prototype.dispose.call(this),this.left.dispose(),this.left=null,this.right.dispose(),this.right=null,this._merger.disconnect(),this._merger=null,this},e.Merge}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(6)],void 0===(i=function(e){if(e.supported){var t=navigator.userAgent.toLowerCase();if(t.includes("safari")&&!t.includes("chrome")){var n=function(e){for(var t in this._internalNode=this.input=this.output=e._native_createWaveShaper(),this._curve=null,this._internalNode)this._defineProperty(this._internalNode,t)};Object.defineProperty(n.prototype,"curve",{get:function(){return this._curve},set:function(e){this._curve=e;var t=new Float32Array(e.length+1);t.set(e,1),t[0]=e[0],this._internalNode.curve=t}}),n.prototype._defineProperty=function(t,n){e.isUndef(this[n])&&Object.defineProperty(this,n,{get:function(){return"function"==typeof t[n]?t[n].bind(t):t[n]},set:function(e){t[n]=e}})},e.global.AudioContext.prototype._native_createWaveShaper=e.global.AudioContext.prototype.createWaveShaper,e.global.AudioContext.prototype.createWaveShaper=function(){return new n(this)}}}}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0)],void 0===(i=function(e){"use strict";return e.Emitter=function(){e.call(this),this._events={}},e.extend(e.Emitter),e.Emitter.prototype.on=function(e,t){for(var n=e.split(/\W+/),r=0;r<n.length;r++){var i=n[r];this._events.hasOwnProperty(i)||(this._events[i]=[]),this._events[i].push(t)}return this},e.Emitter.prototype.once=function(e,t){var n=function(){t.apply(this,arguments),this.off(e,n)}.bind(this);return this.on(e,n),this},e.Emitter.prototype.off=function(t,n){for(var r=t.split(/\W+/),i=0;i<r.length;i++)if(t=r[i],this._events.hasOwnProperty(t))if(e.isUndef(n))this._events[t]=[];else for(var o=this._events[t],a=0;a<o.length;a++)o[a]===n&&o.splice(a,1);return this},e.Emitter.prototype.emit=function(e){if(this._events){var t=Array.apply(null,arguments).slice(1);if(this._events.hasOwnProperty(e))for(var n=this._events[e].slice(0),r=0,i=n.length;r<i;r++)n[r].apply(this,t)}return this},e.Emitter.mixin=function(t){var n=["on","once","off","emit"];t._events={};for(var r=0;r<n.length;r++){var i=n[r],o=e.Emitter.prototype[i];t[i]=o}return e.Emitter},e.Emitter.prototype.dispose=function(){return e.prototype.dispose.call(this),this._events=null,this},e.Emitter}.apply(t,r))||(e.exports=i)},function(e,t,n){var r,i;r=[n(0),n(15),n(32),n(31),n(29),n(3),n(7),n(1)],void 0===(i=function(e){if(e.supported&&!e.global.AudioContext.prototype.createStereoPanner){var t=function(t){this.context=t,this.pan=new e.Signal(0,e.Type.AudioRange);var n=new e.WaveShaper(function(t){return e.equalPowerScale((t+1)/2)},4096),r=new e.WaveShaper(function(t){return e.equalPowerScale(1-(t+1)/2)},4096),i=new e.Gain,o=new e.Gain,a=this.input=new e.Split;a._splitter.channelCountMode="explicit",(new e.Zero).fan(n,r);var s=this.output=new e.Merge;a.left.chain(i,s.left),a.right.chain(o,s.right),this.pan.chain(r,i.gain),this.pan.chain(n,o.gain)};t.prototype.disconnect=function(){this.output.disconnect.apply(this.output,arguments)},t.prototype.connect=function(){this.output.connect.apply(this.output,arguments)},AudioContext.prototype.createStereoPanner=function(){return new t(this)},e.Context.prototype.createStereoPanner=function(){return new t(this)}}}.apply(t,r))||(e.exports=i)},function(e,t){e.exports="13.3.6"},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n}]).UnmuteButton},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(20),o=n(1),a=n(3),s=n(213),u=n(6);class c extends o.LitElement{constructor(){super(),this.shortcut="Shift m",this.paused=!1,this._unpausedMuteState=!1,this._muteButton=s(),this._muteButton.remove()}get computedMute(){return!this._muteButton.mute}get muted(){return this.computedMute}connectedCallback(){super.connectedCallback(),this.__shortcutObserver=new i.KeyboardShortcutObserver(this.shortcut,()=>{this._clicked(),this.dispatchEvent(new CustomEvent("mute-keyboard-shortcut",{bubbles:!0,composed:!0}))},"mute / unmute"),this._muteButton.on("start",()=>{this.requestRender()}).on("mute",()=>{this.dispatchEvent(new CustomEvent("mute",{composed:!0,bubbles:!0,detail:{muted:!0}})),this.requestRender()}).on("unmute",()=>{this.dispatchEvent(new CustomEvent("mute",{composed:!0,bubbles:!0,detail:{muted:!1}})),this.requestRender()})}disconnectedCallback(){this.__shortcutObserver.disconnect(),super.disconnectedCallback()}_addSnackbar(){const e=document.querySelector("acc-snackbar");e&&(this.computedMute?e.setAttribute("message","Unmuting sound"):e.setAttribute("message","Muting sound"))}_propertiesChanged(e,t,n){return t&&void 0!==t.shortcut&&this.__shortcutObserver&&(this.__shortcutObserver.pattern=this.shortcut),t&&void 0!==t.paused&&(e.paused?(this._unpausedMuteState=this._muteButton.mute,this._muteButton.mute=!0):this._muteButton.mute=this._unpausedMuteState),super._propertiesChanged(e,t,n)}_clicked(e){e&&this.dispatchEvent(new CustomEvent("mute-clicked",{bubbles:!0,composed:!0})),this._muteButton.click(),setTimeout(()=>{this._addSnackbar()},20)}start(){this._muteButton.start()}_render(){return o.html`
        <style>
            :host {
                --margin: 16px;
                --button-width: 60px;
                --button-height: 40px;
            }

            button{
                z-index: 3;
                box-sizing: border-box;
                background-color: var(--background-color);
                border: 1px solid ${u.outlineBorderColor};
                cursor:pointer;
                width: var(--button-width);
                height: var(--button-height);
            }

            svg {
                fill: var(--fill-color);
            }
        </style>
        <button
            title="Mute toggle (${this.shortcut})"
            on-click=${this._clicked.bind(this)}
            aria-label="mute" aria-pressed$="${this.computedMute}">
            <acc-icon icon=${this.computedMute?"volume-on":"volume-off"}></acc-icon>
        </button>
        `}}r([a.property({type:String})],c.prototype,"shortcut",void 0),r([a.property({type:Boolean})],c.prototype,"paused",void 0),t.MuteButtonElement=c,customElements.define("acc-mute-button",c)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(6),o=n(1),a=n(55),s=n(3),u=n(54);class c extends a.AbstractSelectLitElement{constructor(){super(),this.contentSelector="acc-content",this.label="",this._nodeChildSelector="*"}set contentElement(e){this.items.forEach(t=>{t.contentElement=e})}get contentElement(){return this.selected&&this.selected.contentElement}get items(){return this._nodes}get selected(){return super.selected}get value(){return this.selected?this.selected.inputType:void 0}select(e){super.select(e)}showCameraSettings(){this._handleOptionsClicked(!0)}_propertiesChanged(e,t,n){super._propertiesChanged(e,t,n),t&&t.contentSelector&&this.items.forEach(t=>{t.contentSelector=e.target})}_handleOptionsClicked(e=!1){if(this.selected.controls=!this.selected.controls,this.selected.controls){const t=()=>{this.selected.removeEventListener("controlsclose",t);const n=this.shadowRoot.querySelector(".settings");n&&!e&&n.focus()};this.selected.addEventListener("controlsclose",t)}}_addNode(e){this.contentElement?e.contentElement=this.contentElement:e.contentSelector=this.contentSelector,super._addNode(e)}_render({label:e}){const t=this.selectedIndex,n=this.selected&&this.selected.hasControls,r=this;return o.html`
        <style>
            :host select, button {
                font-size: 18px;
            }

            select {
                width:100%;
                height: 30px;
                cursor: pointer;
                display: inline-block;
                position: relative;
                font-size: 18px;
                font-family: ${i.bodyFontFamily};
                text-transform: capitalize;
                background-color: ${i.backgroundColor};
                color: ${i.labelColor};
                -moz-appearance:none; /* Firefox */
                -webkit-appearance:none; /* Safari and Chrome */
                appearance:none;
                border: 0;

            }

            .select-style {
                position: relative;
                padding: 0 0px 20px 0px;
                margin: 0;
                border: none;
                width: 100%;
                overflow: hidden;
                background-color: ${i.backgroundColor};
                text-decoration: none;
                height: 40px;
                display: flex;
                align-items: center;
            }

            .select-style:hover,
            .select-style:focus,
            .select-style:active {
                cursor: pointer;
            }

            ::slotted(.icon-face) {
                padding-right: 17px;
            }

            .select:focus {
                outline-width: 1px;
                outline-style: dashed;
                outline-color: red;
            }
            .icon-arrow {
                z-index: 1;
                position: absolute;
                right: 4px;
                display: block;
                padding: 3px;
                pointer-events: none;
            }

            .icon {
                margin-right: 7px;
                justify-content: center;
                align-items: center;
                width: 28px;
            }

            </style>
            ${u.getLabelTemplate("Tracking","select")}
            <div class="select-style">
                <select class="accessibility-selector" on-input="${function(e){r.select(r.items[this.selectedIndex])}}" id="select">
                    ${this.items.map((e,n)=>{const r=n===t;return o.html`<option value="${e.inputType}" selected="${r}">${e.inputName}</option>`})}
                </select>

                <acc-icon icon="down" class="icon-arrow"></acc-icon>
            </div>

            <slot></slot>
            <acc-button
                aria-hidden$="${!n}"
                disabled?="${!n}"
                class="settings"
                label="Body Tracking Settings"
                on-click="${()=>this._handleOptionsClicked()}"></acc-button>
        `}}r([s.property({type:String})],c.prototype,"contentSelector",void 0),r([s.property({type:String})],c.prototype,"label",void 0),t.InputModeSelectElement=c,customElements.define("acc-input-mode-select",c)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(6),o=n(20),a=n(1),s=n(3),u=n(8),c=n(27);class l extends a.LitElement{constructor(){super(...arguments),this.disabled=!1,this.checked=!1,this.label="",this.shortcut=""}get value(){return String(this.checked)}connectedCallback(){super.connectedCallback(),this.__shortcutObserver=new o.KeyboardShortcutObserver(this.shortcut,this._handleShortcut,this.label)}disconnectedCallback(){super.disconnectedCallback(),this.__shortcutObserver.disconnect()}focus(){super.focus(),this.shadowRoot.querySelector("button").focus()}_handleShortcut(){this.checked=!this.checked,this.dispatchEvent(new CustomEvent("shortcut"))}_render({label:e,shortcut:t,checked:n}){const r=this.value;let o=`${e}, toggled ${n?"on":"off"} `;return t&&(o+=` (${t})`),a.html`
            <style>
                :host {
                    display: block;
                    width: 100%;
                    height: 50px;
                    user-select: none;
                    cursor: pointer;
                    color: ${i.labelColor};
                }

                button {
                    position: relative;
                    width: 100%;
                    height: 100%;
                    background: transparent;
                    border: none;
                    text-align: left;
                    cursor: pointer;
                }

                .indicator {
                    position: absolute;
                    top: 50%;
                    right: 20px;
                    transform: translate(0, -50%);
                    width: 32px;
                }

                :host([disabled]) {
                    pointer-events: none;
                    opacity: 0.25;
                }

                .title {
                    color: ${i.labelColor};
                    font-family: ${i.bodyFontFamily};
                    font-size: 18px;
                }

                :host([checked]) .indicator {
                    border: none;
                    opacity: 1;
                }

                .accent {
                    transition: fill 3s linear;
                }
                #on-indicator .accent {
                    fill: ${i.accentColor};
                }

                #off-indicator .accent {
                    fill: ${i.accentOffColor};
                }


            </style>
                <button role="checkbox" aria-checked$="${this.checked}" disabled?="${this.disabled}" title="${o}" on-click=${()=>this.checked=!this.checked}>
                <span class="title">${e||r}</span>
                <div class="indicator">
                    <svg id="off-indicator" style$="display: ${this.checked?"none":"block"}"
                        width="49px" height="28px" viewBox="0 0 49 28" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                        <title>Currently toggled off</title>
                        <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
                            <path class="accent" d="M38.3152174,21.25 L12.7717391,21.25 C7.79076087,21.25 3.83152174,17.375 3.83152174,12.5 C3.83152174,7.625 7.79076087,3.75 12.7717391,3.75 L38.3152174,3.75 C43.2961957,3.75 47.2554348,7.625 47.2554348,12.5 C47.2554348,17.375 43.2961957,21.25 38.3152174,21.25 Z" id="track" fill-opacity="0.26" fill="#221F1F"></path>
                            <ellipse class="accent" cx="12.7717391" cy="12.5" rx="12.5217391" ry="12.25"></ellipse>
                        </g>
                    </svg>

                    <svg id="on-indicator" style$="display: ${this.checked?"block":"none"}"
                        width="47px" height="27px" viewBox="0 0 47 27" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                        <title>Currently toggled on</title>
                        <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
                            <path class="accent" d="M42.2702703,12.5 C42.2702703,17.375 38.4162162,21.25 33.5675676,21.25 L8.7027027,21.25 C3.85405405,21.25 0,17.375 0,12.5 L0,12.5 C0,7.625 3.85405405,3.75 8.7027027,3.75 L33.5675676,3.75 C38.4162162,3.75 42.2702703,7.625 42.2702703,12.5 L42.2702703,12.5 L42.2702703,12.5 Z" id="track" fill="#0054FF" opacity="0.5"></path>
                            <ellipse class="accent" cx="33.5675676" cy="12.5" rx="12.1824324" ry="12.25"></ellipse>
                        </g>
                    </svg>
                </div>
            </button>
        `}_propertiesChanged(e,t,n){if(!t||!n)return;let r=!1;if(void 0!==t.shortcut&&this.__shortcutObserver&&(this.__shortcutObserver.pattern=this.shortcut),t.checked!==n.checked&&(u.setBooleanAttribute(this,"checked",e.checked),r=!0),t.disabled!==n.disabled&&(u.setBooleanAttribute(this,"disabled",e.disabled),r=!0),r){const e={detail:{target:this,checked:this.checked}};this.dispatchEvent(new CustomEvent("change",e))}super._propertiesChanged(e,t,n)}_shouldPropertyChange(e,t,n){return("checked"!==e||!this.disabled)&&super._shouldPropertyChange(e,t,n)}}r([s.property({type:Boolean})],l.prototype,"disabled",void 0),r([s.property({type:Boolean})],l.prototype,"checked",void 0),r([s.property({type:String})],l.prototype,"label",void 0),r([s.property({type:String})],l.prototype,"shortcut",void 0),r([c.default],l.prototype,"_handleShortcut",null),t.ToggleElement=l,customElements.define("acc-toggle",l)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(20),o=n(6),a=n(1),s=n(3),u=n(8);n(56);class c extends a.LitElement{constructor(){super(...arguments),this.icon="",this.label="",this.disabled=!1,this.shortcut=""}connectedCallback(){super.connectedCallback(),this.__shortcutObserver=new i.KeyboardShortcutObserver(this.shortcut,()=>{this.dispatchEvent(new CustomEvent("shortcut",{bubbles:!0,composed:!0})),this._dispatchClick()})}disconnectedCallback(){this.__shortcutObserver.disconnect(),super.disconnectedCallback()}_dispatchClick(){this.dispatchEvent(new MouseEvent("click"))}_propertiesChanged(e,t,n){t&&(void 0!==t.shortcut&&this.__shortcutObserver&&(this.__shortcutObserver.pattern=e.shortcut),void 0!==t.disabled&&u.setBooleanAttribute(this,"disabled",e.disabled),super._propertiesChanged(e,t,n))}focus(){super.focus();const e=this.shadowRoot.querySelector("button");e&&e.focus()}_render({label:e,icon:t}){let n="";return"play"===this.label.toLowerCase()?n="play":"stop"===this.label.toLowerCase()?n="stop":/(restart|clear)/gi.test(this.label)&&(n="replay"),a.html`
            <style>
                :host {
                    display: block;
                    width: 100%;
                    height: 50px;
                    user-select: none;
                    cursor: pointer;
                    margin: 8px 0px;
                }


                :host([disabled]) {
                    pointer-events: none;
                    opacity: 0.5;
                }


                button {
                    position: relative;
                    font-size: ${o.buttonFontSize};
                    font-weight: ${o.buttonFontWeight};
                    font-family: ${o.bodyFontFamily};
                    width: 100%;
                    border: ${o.buttonBorderWidth} solid ${o.buttonBorderColor};
                    display: flex;
                    align-items: center;
                    justify-content: ${o.buttonJustifyContent};
                    text-transform: capitalize;
                    padding: 10px 0px;
                    background-color: ${o.buttonBackgroundColor};
                    color: ${o.buttonLabelColor};
                }

                button:hover {
                    cursor: pointer;
                }

                .icon {
                    width: 16px;
                    height: 16px;
                    margin-right: 8px;
                }

                .label {
                    text-align: center;
                }

            </style>
            <button
                disabled?="${this.disabled}"
                tabindex="${this.disabled?-1:0}"
                aria-label="${e}">
                <img class="icon" aria-hidden="true" src="${t}" style="display: ${""===t?"none":"block"}"
                <span class="label">${e}</span>
            </button>


        `}}r([s.property({type:String})],c.prototype,"icon",void 0),r([s.property({type:String})],c.prototype,"label",void 0),r([s.property({type:Boolean})],c.prototype,"disabled",void 0),r([s.property({type:String})],c.prototype,"shortcut",void 0),t.ButtonElement=c,customElements.define("acc-button",c)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(97),i=n(1),o=n(55),a=n(8),s=n(6);class u extends o.AbstractSelectLitElement{constructor(){super(...arguments),this.label="",this.name="",this.type=""}static get properties(){return{label:{type:String,reflectToAttribute:!0,value:""},name:{type:String,value:""},type:String}}get value(){return this.selected?this.selected.value:void 0}get selectedRadioEl(){return this.shadowRoot.querySelector('acc-radio[aria-checked="true"]')}addItem(e,t=""){let n;if(a.isElement(e))n=e;else{const i=new r.ItemElement;i.label=e,i.icon=t,n=i}return this.appendChild(n),n}addItems(e){return e.map(e=>this.addItem(e))}_onRadioClick(e,t){this.select(this._nodes[t])}get items(){const e=[];for(let t=0;t<this._nodes.length;t++){const n=this._nodes[t];n instanceof r.ItemElement&&e.push(n)}return e}_render(){const e=this.selectedIndex;return i.html`
            <style>

                .title {
                    font-family: ${s.bodyFontFamily};
                    font-size: 18px;
                    padding: 0px 0px 20px 0px;
                    font-weight: 700;
                    text-transform: capitalize;
                    display: block;
                }

                .title:hover {
                    cursor: pointer;
                }
                fieldset {
                    margin: 0;
                    padding: 0;
                    outline: 0 transparent;
                    border: 0px transparent;
                }

            </style>

            ${this.label?i.html`<h2 class="title">${this.label}</h2>`:""}
            <fieldset role="radiogroup">
                ${this.items.map((t,n)=>{const r=n===e;return i.html`<acc-radio
                        role="radio"
                        disabled?="${this.disabled||t.disabled}"
                        aria-checked$="${r}"
                        icon=${t.icon}
                        selected?=${r}
                        on-click="${e=>this._onRadioClick(e,n)}"
                        name="${this.name}"
                        value=${t.value}
                        label=${t.label}
                        type=${this.type}>
                    </acc-radio>`})}
            </fieldset>
            <slot></slot>
        `}}t.RadioGroupElement=u,customElements.define("acc-radio-group",u)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(6),o=n(1),a=n(3);class s extends o.LitElement{constructor(){super(...arguments),this.icon="",this.name="",this.label="",this.type="",this.selected=!1,this.disabled=!1}focus(){setTimeout(()=>{this.shadowRoot.querySelector("button").focus()},100)}_render({icon:e,label:t,type:n}){return o.html`
            <style>
                :host {
                    position: relative;
                    display: block;
                    padding-bottom: 5px;
                    height: 45px;
                    background-color: transparent;
                    color: black;
                    cursor: pointer;
                    margin-bottom: 5px;
                }

                :host([disabled]) {
                    pointer-events: none;
                    opacity: 0.5;
                }

                :host button {
                    border: 0px solid transparent;
                    font-size: 18px;
                }

                .radio-outer {
                    position: absolute;
                    top: 50%;
                    right: 8px;
                    transform: translate(0, -50%);
                    width: 26px;
                    height: 26px;
                    box-sizing: border-box;
                    border: 3px solid ${i.accentColor};
                    border-radius: ${i.accentBorderRadius};
                }

                .radio-inner {
                    position: relative;
                    top: 4px;
                    left: 4px;
                    width: 12px;
                    height: 12px;
                    border-radius: ${i.accentBorderRadius};
                    background-color: transparent;
                }

                :host([selected]) .radio-inner {
                    background-color: ${i.accentColor};
                }

                button {
                    position: relative;
                    text-align: left;
                    width: 100%;
                    height: 100%;
                    background: transparent;
                    padding: 0;
                    display: flex;
                }

                .icon {
                    display: flex;
                    width: ${i.iconSize};
                    height: ${i.iconSize};
                    justify-content: center;
                    padding-right: 17px;
                }

                span {
                    font-family: ${i.bodyFontFamily};
                    font-size: 18px;
                    color: ${i.labelColor};
                }

            </style>
            <button disabled?="${this.disabled}" aria-checked?="${this.selected}">
                <div class="icon" style$="display: ${"icons"==n?"flex":"none"}">
                    <svg style$="display: ${"Jazz"==this.label?"flex":"none"}" width="18px" height="20px" viewBox="0 0 18 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                        <title>Jazz</title>
                        <defs>
                            <polygon id="path-1" points="0.000117631447 0 17.5054286 0 17.5054286 20 0.000117631447 20"></polygon>
                        </defs>
                        <g id="Global-Elements" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
                            <g id="Global-Elements-/-Global-Elements-02" transform="translate(-292.000000, -805.000000)">
                                <g id="Dropdown" transform="translate(289.000000, 738.000000)">
                                    <g id="Icons-/-Jazz" transform="translate(3.000000, 67.000000)">
                                        <g>
                                            <mask id="mask-2" fill="white">
                                                <use xlink:href="#path-1"></use>
                                            </mask>
                                            <g id="Clip-2"></g>
                                            <path d="M17.4697714,9.31533333 L15.4126286,4.31533333 C15.3594857,4.18616667 15.2532,4.08533333 15.1194857,4.03533333 C14.9866286,3.97783333 14.8357714,3.97783333 14.7029143,4.03533333 C11.9514857,5.39033333 10.3057714,7.80033333 10.3057714,10.5003333 L10.3057714,13.0003333 C10.3057714,13.552 9.84548571,14.0003333 9.2772,14.0003333 C8.70891429,14.0003333 8.24862857,13.552 8.24862857,13.0003333 L8.24862857,11.0003333 L6.70577143,11.0003333 C6.42205714,11.0003333 6.19148571,10.7761667 6.19148571,10.5003333 C6.19148571,10.2236667 6.42205714,10.0003333 6.70577143,10.0003333 L8.24862857,10.0003333 L8.24862857,9.00033333 L6.70577143,9.00033333 C6.42205714,9.00033333 6.19148571,8.77616667 6.19148571,8.50033333 C6.19148571,8.22366667 6.42205714,8.00033333 6.70577143,8.00033333 L8.24862857,8.00033333 L8.24862857,7.00033333 L6.70577143,7.00033333 C6.42205714,7.00033333 6.19148571,6.77616667 6.19148571,6.50033333 C6.19148571,6.2245 6.42205714,6.00033333 6.70577143,6.00033333 L8.24862857,6.00033333 L8.24862857,5.50033333 C8.24862857,2.46283333 5.71577143,0.000333333333 2.59148571,0.000333333333 L0.534342857,0.000333333333 C0.298628571,-0.00883333333 0.0860571429,0.1395 0.0209142857,0.360333333 C-0.0433714286,0.572833333 0.0449142857,0.801166667 0.236914286,0.920333333 C0.3372,0.980333333 0.441771429,1.03366667 0.549771429,1.08033333 C1.3272,1.44033333 3.10577143,2.28533333 3.10577143,5.50033333 L3.10577143,14.5003333 C3.10577143,17.6345 5.76977143,20.0003333 9.2772,20.0003333 C12.7846286,20.0003333 15.4486286,17.6345 15.4486286,14.5003333 C15.4486286,11.5003333 15.4486286,10.8103333 17.2229143,9.94533333 C17.4603429,9.82866667 17.5674857,9.55616667 17.4697714,9.31533333" id="Fill-1" fill="#000000" mask="url(#mask-2)"></path>
                                        </g>
                                    </g>
                                </g>
                            </g>
                        </g>
                    </svg>

                    <svg style$="display: ${"Orchestra"==this.label?"flex":"none"}"
                        width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                        <!-- Generator: Sketch 50.2 (55047) - http://www.bohemiancoding.com/sketch -->
                        <title>Icons / Orchestra</title>
                        <desc>Created with Sketch.</desc>
                        <defs></defs>
                        <g id="Global-Elements" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
                            <g id="Global-Elements-/-Global-Elements-02" transform="translate(-289.000000, -749.000000)" fill="#000000">
                                <g id="Dropdown" transform="translate(289.000000, 738.000000)">
                                    <g id="Icons-/-Orchestra" transform="translate(0.000000, 11.000000)">
                                        <path d="M12.4130026,12.6772437 C12.0190026,12.7412437 11.6390026,12.6682437 11.2990026,12.5112437 L12.0330026,11.6622437 C12.1160026,11.5662437 12.1110026,11.4222437 12.0210026,11.3312437 L10.3560026,9.64424369 C10.4290026,9.59324369 10.5070026,9.55224369 10.5660026,9.47924369 C10.8740026,9.10124369 11.3080026,8.85024369 11.7900026,8.77424369 C12.3120026,8.69024369 12.8330026,8.81424369 13.2610026,9.12524369 C13.6870026,9.43524369 13.9700026,9.89324369 14.0530026,10.4142437 C14.2250026,11.4902437 13.4890026,12.5042437 12.4130026,12.6772437 M18.4330026,3.43424369 C17.9400026,3.43424369 17.5410026,3.83424369 17.5410026,4.32524369 L17.5410026,5.13124369 L16.0480026,0.895243694 C15.8760026,0.408243694 15.3420026,0.153243694 14.8540026,0.323243694 C14.3670026,0.495243694 14.1110026,1.03024369 14.2820026,1.51724369 L15.8780026,6.04224369 L12.4220026,0.721243694 C12.1130026,0.247243694 11.4780026,0.113243694 11.0030026,0.420243694 C10.5280026,0.729243694 10.3930026,1.36424369 10.7020026,1.83924369 L13.3390026,5.89624369 L16.7250026,7.73024369 C16.9620026,7.85824369 17.0510026,8.15624369 16.9220026,8.39324369 C16.8340026,8.55624369 16.6650026,8.64924369 16.4920026,8.64924369 C16.4130026,8.64924369 16.3340026,8.63024369 16.2590026,8.59024369 C16.2590026,8.59024369 14.3460026,7.54724369 13.5060026,7.09524369 C13.5000026,7.09224369 12.5330026,6.56924369 11.2410026,6.83224369 C11.1580026,6.85124369 11.0760026,6.87224369 10.9950026,6.89624369 C10.8860026,6.92624369 10.7770026,6.95824369 10.6660026,7.00124369 C10.0170026,7.25124369 9.43600265,7.65424369 8.99200265,8.20224369 C8.98300265,8.21424369 8.97700265,8.22624369 8.96900265,8.23824369 L1.08100265,0.245243694 C0.946002648,0.100243694 0.751002648,0.00924369358 0.562002648,0.00424369358 C0.379002648,-0.0177563064 0.267002648,0.0482436936 0.163002648,0.145243694 C-0.0689973516,0.365243694 -0.0509973516,0.813243694 0.202002648,1.08524369 L8.75900265,10.2862437 C8.35000265,10.4642437 8.09800265,10.8862437 8.14700265,11.3562437 C8.28200265,12.6412437 9.26100265,13.7192437 9.97200265,14.2082437 L13.9760026,17.1312437 L13.9760026,19.9992437 L19.3240026,19.9992437 L19.3240026,4.32524369 C19.3240026,3.83424369 18.9260026,3.43424369 18.4330026,3.43424369" id="Fill-1"></path>
                                    </g>
                                </g>
                            </g>
                        </g>
                    </svg>
                </div>
                <span>${t}</span>
                <div class="radio-outer"><div class="radio-inner"></div></div>
            </button>

        `}}r([a.property({type:String})],s.prototype,"icon",void 0),r([a.property({type:String})],s.prototype,"name",void 0),r([a.property({type:String})],s.prototype,"label",void 0),r([a.property({type:String})],s.prototype,"type",void 0),r([a.property({type:Boolean})],s.prototype,"selected",void 0),r([a.property({type:Boolean})],s.prototype,"disabled",void 0),t.RadioElement=s,customElements.define("acc-radio",s)},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),o=n(3),a=n(14);class s extends a.AbstractModalElement{constructor(){super(),this.label="Loading",this.spinner=!0,this.closable=!1,this.priority=0}focus(){super.focus();const e=this.shadowRoot.querySelector("#label");e&&e.focus()}_renderModalBody(){return i.html`
        <style>
            .overlay {
                --color-gray : #D8D8D8;
                position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background: var(--background-color);
                z-index: 4;
            }

            .circular-loader {
                height: 100%;
                width: 100%;
                position: absolute;
                top: 0;
                left: 0;
                transition: all 0.1s linear;
            }

            .loader-path {
                stroke: var(--color-gray);
                stroke-dasharray: 180;
                animation: dash 1.5s linear 0s infinite;
                animation-fill-mode: both;
                stroke-linecap: round;
                transform-origin: center center;
            }

            .loader {
                width: 130px;
                height: 130px;
                position: absolute;
                left: 50%;
                top: 50%;
                transform: translate(-50%, -50%);
                margin-top: -30px;
            }

            @keyframes dash {
                0% {
                    stroke-dashoffset: 120;
                }
                50% {
                    stroke-dashoffset: 120;
                    transform:rotate(240deg);
                }
                100% {
                    stroke-dashoffset: 120;
                    transform:rotate(720deg);
                }
            }

            #label {
                position: absolute;
                position: absolute;
                top: calc(50% + 90px);
                text-align: center;
                font-size: 20px;
                color: var(--label-color);
                font-family: 'Karla', sans-serif;
                left: 50%;
                padding: 10px;
                transform: translate(-50%, 0);
            }

        </style>
        <div class="overlay"
            tabindex="0">
            <div id="label" tabindex="0">${this.label}</div>
            <div class="loader" aria-hidden="true">
                ${(e=>{if(this.spinner)return i.html`<svg class="circular-loader" viewBox="0 0 50 50">
                            <circle class="loader-path" cx="25" cy="25" r="20" fill="none" stroke-width="3" />
                        </svg>`})()}
            </div>
        </div>
        `}}r([o.property({type:String})],s.prototype,"label",void 0),r([o.property({type:Boolean})],s.prototype,"spinner",void 0),t.LoaderElement=s,customElements.define("acc-loader-element",class extends s{constructor(){super(),console.warn("DEPRECATED: use acc-loader instead of acc-loader-element")}}),customElements.define("acc-loader",s)},function(e,t){e.exports='<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  --\x3e\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 346 98" style="enable-background:new 0 0 346 98;" xml:space="preserve">\n<style type="text/css">\n\t.st0{}\n</style>\n<g>\n\t<polygon class="st0" points="231.1,16.4 229.4,16.4 229.4,9.9 226.8,16.4 225.5,16.4 222.9,9.9 222.9,16.4 221.1,16.4 221.1,6 \n\t\t222.8,6 226.1,13.7 229.4,6 231.1,6 \t"/>\n\t<path class="st0" d="M240,9.5v7h-1.6v-0.9c-0.4,0.7-1.3,1.1-2.1,1.1c-2.1,0-3.6-1.7-3.6-3.7c0-2,1.4-3.7,3.6-3.7\n\t\tc0.8,0,1.7,0.4,2.1,1.1V9.5H240z M238.4,12.9c0-1.2-0.8-2.2-2.1-2.2c-1.2,0-2,1-2,2.2c0,1.2,0.8,2.2,2,2.2\n\t\tC237.6,15.1,238.4,14.1,238.4,12.9"/>\n\t<path class="st0" d="M247.3,15.5c-0.4,0.7-1.3,1.1-2.1,1.1c-2.1,0-3.6-1.7-3.6-3.7c0-2,1.4-3.7,3.6-3.7c0.8,0,1.7,0.4,2.1,1.1V6\n\t\th1.6v10.4h-1.6V15.5z M247.3,12.9c0-1.2-0.8-2.2-2.1-2.2c-1.2,0-2,1-2,2.2c0,1.2,0.8,2.2,2,2.2C246.5,15.1,247.3,14.1,247.3,12.9"\n\t\t/>\n\t<path class="st0" d="M252.2,13.4c0.1,1,0.5,1.8,1.9,1.8c0.9,0,1.3-0.4,1.5-0.9h1.6c-0.2,1.2-1.3,2.3-3.1,2.3\n\t\tc-2.3,0-3.5-1.6-3.5-3.7c0-2.1,1.2-3.7,3.4-3.7c1.8,0,3.2,1.4,3.2,3.1c0,0.2,0,0.6-0.1,1H252.2z M252.2,12.2h3.5\n\t\tc0-1.1-0.7-1.7-1.7-1.7C252.9,10.5,252.2,11.1,252.2,12.2"/>\n\t<polygon class="st0" points="267.1,11.2 265.2,16.4 264.2,16.4 261.5,9.5 263.2,9.5 264.7,13.9 266.3,9.5 267.9,9.5 269.4,13.9 \n\t\t270.9,9.5 272.7,9.5 270,16.4 268.9,16.4 \t"/>\n\t<path class="st0" d="M274.5,5.7c0.7,0,1.2,0.5,1.2,1.2c0,0.7-0.5,1.2-1.2,1.2c-0.7,0-1.2-0.5-1.2-1.2\n\t\tC273.3,6.2,273.9,5.7,274.5,5.7 M273.7,9.5h1.6v7h-1.6V9.5z"/>\n\t<path class="st0" d="M281.3,16.4c-0.3,0-0.7,0.1-1.2,0.1c-0.8,0-2.3-0.1-2.3-2.4v-3.2h-1.2V9.5h1.2V7.3h1.6v2.1h1.6v1.4h-1.6v2.9\n\t\tc0,1.2,0.4,1.4,1,1.4c0.3,0,0.7,0,0.8-0.1V16.4z"/>\n\t<path class="st0" d="M282.6,6h1.6v4.5c0.4-0.7,1.2-1.1,2.3-1.1c1,0,1.7,0.4,2.1,0.9c0.3,0.5,0.4,1.1,0.4,2.1v4.1h-1.6v-3.6\n\t\tc0-1.2-0.3-2.1-1.5-2.1c-1.1,0-1.7,0.9-1.7,2.1v3.6h-1.6V6z"/>\n\t<path class="st0" d="M226.2,30.1c0,1.4-1.3,2.1-2.8,2.1c-1.5,0-2.8-0.9-2.8-2.5h1.6c0,0.9,0.6,1.2,1.3,1.2c0.6,0,1.1-0.2,1.1-0.8\n\t\tc0-0.7-0.7-0.7-2.2-1.3c-1-0.4-1.7-0.7-1.7-1.9c0-1.3,1.2-2,2.6-2c1.5,0,2.7,1,2.7,2.4h-1.6c0-0.7-0.3-1.1-1.1-1.1\n\t\tc-0.6,0-1,0.3-1,0.8c0,0.6,0.6,0.7,1.9,1.2C225.3,28.5,226.2,28.8,226.2,30.1"/>\n\t<path class="st0" d="M227.3,28.5c0-2,1.4-3.7,3.7-3.7c2.2,0,3.7,1.7,3.7,3.7c0,2-1.4,3.7-3.7,3.7C228.8,32.2,227.3,30.5,227.3,28.5\n\t\t M233,28.5c0-1.2-0.8-2.2-2.1-2.2c-1.2,0-2,1-2,2.2c0,1.2,0.8,2.2,2,2.2C232.2,30.8,233,29.7,233,28.5"/>\n\t<path class="st0" d="M245,32v-3.9c0-1.1-0.4-1.8-1.3-1.8c-0.8,0-1.5,0.5-1.5,2.2V32h-1.6v-3.9c0-1.1-0.4-1.8-1.3-1.8\n\t\tc-0.8,0-1.5,0.5-1.5,2.2V32h-1.6v-7h1.6v1c0.3-0.6,1-1.1,1.9-1.1c1.3,0,1.9,0.6,2.2,1.2c0.3-0.7,1.1-1.2,2.1-1.2\n\t\tc2.1,0,2.5,1.4,2.5,2.7V32H245z"/>\n\t<path class="st0" d="M249.8,29c0.1,1,0.5,1.8,1.9,1.8c0.9,0,1.3-0.4,1.5-0.9h1.6c-0.2,1.2-1.3,2.3-3.1,2.3c-2.3,0-3.5-1.6-3.5-3.7\n\t\tc0-2.1,1.2-3.7,3.4-3.7c1.8,0,3.2,1.4,3.2,3.1c0,0.2,0,0.6-0.1,1H249.8z M249.8,27.8h3.5c0-1.1-0.7-1.7-1.7-1.7\n\t\tC250.5,26.1,249.8,26.7,249.8,27.8"/>\n\t<path class="st0" d="M264.2,23c-0.2-0.1-0.5-0.1-0.7-0.1c-0.5,0-1.1,0-1.1,1.1v1h1.8v1.4h-1.8V32h-1.6v-5.6h-1.4v-1.4h1.4v-0.9\n\t\tc0-2.7,1.7-2.7,2.5-2.7c0.4,0,0.8,0.1,0.9,0.2V23z"/>\n\t<path class="st0" d="M269.8,26.6c-0.3-0.1-0.4-0.1-0.6-0.1c-1.4,0-2.1,0.8-2.1,2.5v3h-1.6v-7h1.6v1.1c0.3-0.6,1.2-1.2,2.1-1.2\n\t\tc0.3,0,0.5,0,0.6,0.1V26.6z"/>\n\t<path class="st0" d="M271.8,21.3c0.7,0,1.2,0.5,1.2,1.2c0,0.7-0.5,1.2-1.2,1.2c-0.7,0-1.2-0.5-1.2-1.2\n\t\tC270.6,21.9,271.1,21.3,271.8,21.3 M271,25.1h1.6v7H271V25.1z"/>\n\t<path class="st0" d="M275.8,29c0.1,1,0.5,1.8,1.9,1.8c0.9,0,1.3-0.4,1.5-0.9h1.6c-0.2,1.2-1.3,2.3-3.1,2.3c-2.3,0-3.5-1.6-3.5-3.7\n\t\tc0-2.1,1.2-3.7,3.4-3.7c1.8,0,3.2,1.4,3.2,3.1c0,0.2,0,0.6-0.1,1H275.8z M275.8,27.8h3.5c0-1.1-0.7-1.7-1.7-1.7\n\t\tC276.6,26.1,275.8,26.7,275.8,27.8"/>\n\t<path class="st0" d="M282.6,25.1h1.6v1c0.4-0.7,1.2-1.1,2.3-1.1c1,0,1.7,0.4,2.1,0.9c0.3,0.5,0.4,1.1,0.4,2.1V32h-1.6v-3.6\n\t\tc0-1.2-0.3-2.1-1.5-2.1c-1.1,0-1.7,0.9-1.7,2.1V32h-1.6V25.1z"/>\n\t<path class="st0" d="M296.2,31.1c-0.4,0.7-1.3,1.1-2.1,1.1c-2.1,0-3.6-1.7-3.6-3.7c0-2,1.4-3.7,3.6-3.7c0.8,0,1.7,0.4,2.1,1.1v-4.4\n\t\th1.6V32h-1.6V31.1z M296.2,28.5c0-1.2-0.8-2.2-2.1-2.2c-1.2,0-2,1-2,2.2c0,1.2,0.8,2.2,2,2.2C295.4,30.8,296.2,29.7,296.2,28.5"/>\n\t<path class="st0" d="M305,30.1c0,1.4-1.3,2.1-2.8,2.1c-1.5,0-2.8-0.9-2.8-2.5h1.6c0,0.9,0.6,1.2,1.3,1.2c0.6,0,1.1-0.2,1.1-0.8\n\t\tc0-0.7-0.7-0.7-2.2-1.3c-1-0.4-1.7-0.7-1.7-1.9c0-1.3,1.2-2,2.6-2c1.5,0,2.7,1,2.7,2.4h-1.6c0-0.7-0.3-1.1-1.1-1.1\n\t\tc-0.6,0-1,0.3-1,0.8c0,0.6,0.6,0.7,1.9,1.2C304,28.5,305,28.8,305,30.1"/>\n\t<path class="st0" d="M314.3,23c-0.2-0.1-0.5-0.1-0.7-0.1c-0.5,0-1.1,0-1.1,1.1v1h1.8v1.4h-1.8V32h-1.6v-5.6h-1.4v-1.4h1.4v-0.9\n\t\tc0-2.7,1.7-2.7,2.5-2.7c0.4,0,0.8,0.1,0.9,0.2V23z"/>\n\t<path class="st0" d="M320,26.6c-0.3-0.1-0.4-0.1-0.6-0.1c-1.4,0-2.1,0.8-2.1,2.5v3h-1.6v-7h1.6v1.1c0.3-0.6,1.2-1.2,2.1-1.2\n\t\tc0.3,0,0.5,0,0.6,0.1V26.6z"/>\n\t<path class="st0" d="M320.3,28.5c0-2,1.4-3.7,3.7-3.7c2.2,0,3.7,1.7,3.7,3.7c0,2-1.4,3.7-3.7,3.7C321.7,32.2,320.3,30.5,320.3,28.5\n\t\t M326,28.5c0-1.2-0.8-2.2-2.1-2.2c-1.2,0-2,1-2,2.2c0,1.2,0.8,2.2,2,2.2C325.2,30.8,326,29.7,326,28.5"/>\n\t<path class="st0" d="M338,32v-3.9c0-1.1-0.4-1.8-1.3-1.8c-0.8,0-1.5,0.5-1.5,2.2V32h-1.6v-3.9c0-1.1-0.4-1.8-1.3-1.8\n\t\tc-0.8,0-1.5,0.5-1.5,2.2V32h-1.6v-7h1.6v1c0.3-0.6,1-1.1,1.9-1.1c1.3,0,1.9,0.6,2.2,1.2c0.3-0.7,1.1-1.2,2.1-1.2\n\t\tc2.1,0,2.5,1.4,2.5,2.7V32H338z"/>\n\t<path class="st0" d="M267.1,70.7c0,5.2-4.1,9.1-9.1,9.1c-5,0-9.1-3.9-9.1-9.1c0-5.3,4.1-9.1,9.1-9.1\n\t\tC263,61.6,267.1,65.4,267.1,70.7 M263.1,70.7c0-3.3-2.4-5.5-5.1-5.5c-2.8,0-5.1,2.2-5.1,5.5c0,3.2,2.4,5.5,5.1,5.5\n\t\tC260.7,76.2,263.1,73.9,263.1,70.7"/>\n\t<path class="st0" d="M286.9,70.7c0,5.2-4.1,9.1-9.1,9.1c-5,0-9.1-3.9-9.1-9.1c0-5.3,4.1-9.1,9.1-9.1\n\t\tC282.8,61.6,286.9,65.4,286.9,70.7 M282.9,70.7c0-3.3-2.4-5.5-5.1-5.5c-2.8,0-5.1,2.2-5.1,5.5c0,3.2,2.4,5.5,5.1,5.5\n\t\tC280.5,76.2,282.9,73.9,282.9,70.7"/>\n\t<path class="st0" d="M305.9,62.2v16.3c0,6.7-4,9.5-8.6,9.5c-4.4,0-7.1-3-8.1-5.4l3.5-1.4c0.6,1.5,2.1,3.2,4.6,3.2\n\t\tc3,0,4.9-1.9,4.9-5.3v-1.3H302c-0.9,1.1-2.6,2.1-4.8,2.1c-4.5,0-8.7-4-8.7-9.1c0-5.1,4.2-9.1,8.7-9.1c2.2,0,3.9,1,4.8,2h0.1v-1.5\n\t\tH305.9z M302.4,70.7c0-3.2-2.1-5.5-4.9-5.5c-2.8,0-5.1,2.3-5.1,5.5c0,3.2,2.3,5.5,5.1,5.5C300.3,76.2,302.4,73.9,302.4,70.7"/>\n\t<rect x="308.6" y="52.5" class="st0" width="4" height="26.7"/>\n\t<path class="st0" d="M327.8,73.7l3.1,2.1c-1,1.5-3.4,4-7.6,4c-5.2,0-8.9-4-8.9-9.1c0-5.4,3.8-9.1,8.5-9.1c4.7,0,7,3.8,7.8,5.8\n\t\tl0.4,1l-12.2,5c0.9,1.8,2.4,2.8,4.4,2.8C325.3,76.2,326.7,75.2,327.8,73.7 M318.2,70.4l8.1-3.4c-0.4-1.1-1.8-1.9-3.4-1.9\n\t\tC321,65.1,318.1,66.9,318.2,70.4"/>\n\t<path class="st0" d="M234.4,79.8c-7.8,0-14.3-6.3-14.3-14.1s6.5-14.1,14.3-14.1c4.3,0,7.4,1.7,9.7,3.9l-2.7,2.7\n\t\tc-1.7-1.5-3.9-2.8-7-2.8c-5.7,0-10.1,4.6-10.1,10.3c0,5.7,4.4,10.3,10.1,10.3c3.7,0,5.8-1.5,7.1-2.8c1.1-1.1,1.8-2.7,2.1-4.9h-9.2\n\t\tv-3.9h13c0.1,0.7,0.2,1.5,0.2,2.4c0,2.9-0.8,6.5-3.3,9C241.7,78.4,238.6,79.8,234.4,79.8"/>\n\t<path class="st0" d="M17,50.5l-0.9-2.7H8.3l-0.9,2.7H3.8L11,29.6h2.4l7.2,20.9H17z M12.2,35.3l-2.9,9.5h5.8L12.2,35.3z"/>\n\t<path class="st0" d="M24.9,45.9c1.3,0,2.4,1.1,2.4,2.4c0,1.3-1.1,2.4-2.4,2.4c-1.3,0-2.4-1.1-2.4-2.4\n\t\tC22.5,46.9,23.6,45.9,24.9,45.9"/>\n\t<rect x="30.7" y="29.6" class="st0" width="3.6" height="20.9"/>\n\t<path class="st0" d="M39.7,45.9c1.3,0,2.4,1.1,2.4,2.4c0,1.3-1.1,2.4-2.4,2.4c-1.3,0-2.4-1.1-2.4-2.4\n\t\tC37.3,46.9,38.4,45.9,39.7,45.9"/>\n\t<polygon class="st0" points="9.3,60.9 9.3,66.8 17.9,66.8 17.9,69.9 9.3,69.9 9.3,75.7 17.9,75.7 17.9,78.7 5.8,78.7 5.8,57.8 \n\t\t17.9,57.8 17.9,60.9 \t"/>\n\t<polygon class="st0" points="32.9,78.7 29.1,78.7 26.4,74.3 23.8,78.7 20,78.7 24.6,71.7 20.1,64.8 23.9,64.8 26.4,69.2 29,64.8 \n\t\t32.8,64.8 28.3,71.7 \t"/>\n\t<path class="st0" d="M38.1,66.7c0.9-1.4,2.7-2.2,4.3-2.2c4.2,0,7.1,3.4,7.1,7.3c0,3.9-2.9,7.3-7.1,7.3c-1.6,0-3.4-0.8-4.3-2.2v8.9\n\t\th-3.3V64.8h3.3V66.7z M38.1,71.8c0,2.4,1.6,4.4,4.1,4.4c2.4,0,4.1-2,4.1-4.4s-1.6-4.4-4.1-4.4C39.7,67.4,38.1,69.4,38.1,71.8"/>\n\t<path class="st0" d="M54.2,72.8c0.1,2,1,3.6,3.7,3.6c1.9,0,2.6-0.8,3-1.8h3.3c-0.4,2.4-2.7,4.5-6.2,4.5c-4.7,0-7-3.2-7-7.3\n\t\tc0-4.2,2.5-7.3,6.9-7.3c3.6,0,6.4,2.7,6.4,6.3c0,0.5,0,1.1-0.1,2H54.2z M54.2,70.3h6.9c0-2.1-1.4-3.4-3.4-3.4\n\t\tC55.8,66.9,54.2,68.1,54.2,70.3"/>\n\t<path class="st0" d="M75.6,67.8c-0.5-0.1-0.8-0.1-1.3-0.1c-2.8,0-4.3,1.6-4.3,5v6h-3.3V64.8H70v2.2c0.6-1.3,2.4-2.4,4.3-2.4\n\t\tc0.5,0,0.9,0.1,1.3,0.2V67.8z"/>\n\t<path class="st0" d="M79.7,57.3c1.3,0,2.4,1.1,2.4,2.4c0,1.3-1.1,2.4-2.4,2.4c-1.3,0-2.4-1.1-2.4-2.4\n\t\tC77.3,58.4,78.4,57.3,79.7,57.3 M78.1,64.8h3.3v13.9h-3.3V64.8z"/>\n\t<path class="st0" d="M101.9,78.7v-7.8c0-2.2-0.8-3.6-2.6-3.6c-1.6,0-2.9,1-2.9,4.3v7.1h-3.3v-7.8c0-2.2-0.7-3.6-2.5-3.6\n\t\tc-1.6,0-3,1-3,4.3v7.1h-3.3V64.8h3.3v1.9c0.6-1.3,2.1-2.3,3.9-2.3c2.5,0,3.8,1.1,4.4,2.5c0.7-1.4,2.3-2.5,4.3-2.5\n\t\tc4.2,0,5,2.9,5,5.5v8.8H101.9z"/>\n\t<path class="st0" d="M110.5,72.8c0.1,2,1,3.6,3.7,3.6c1.9,0,2.6-0.8,3-1.8h3.3c-0.4,2.4-2.7,4.5-6.2,4.5c-4.7,0-7-3.2-7-7.3\n\t\tc0-4.2,2.5-7.3,6.9-7.3c3.6,0,6.4,2.7,6.4,6.3c0,0.5,0,1.1-0.1,2H110.5z M110.5,70.3h6.9c0-2.1-1.4-3.4-3.4-3.4\n\t\tC112,66.9,110.5,68.1,110.5,70.3"/>\n\t<path class="st0" d="M123,64.8h3.3v1.9c0.9-1.5,2.5-2.3,4.5-2.3c2,0,3.4,0.7,4.2,1.9c0.7,1,0.9,2.2,0.9,4.1v8.3h-3.3v-7.2\n\t\tc0-2.4-0.7-4.2-3-4.2c-2.3,0-3.3,1.8-3.3,4.2v7.2H123V64.8z"/>\n\t<path class="st0" d="M146.8,78.7c-0.5,0.1-1.5,0.2-2.4,0.2c-1.6,0-4.5-0.2-4.5-4.9v-6.5h-2.4v-2.7h2.4v-4.2h3.3v4.2h3.2v2.7h-3.2\n\t\tv5.7c0,2.4,0.7,2.7,2,2.7c0.5,0,1.3-0.1,1.6-0.1V78.7z"/>\n\t<polygon class="st0" points="6.4,7.5 3.8,7.5 3.8,6 10.7,6 10.7,7.5 8.1,7.5 8.1,16.4 6.4,16.4 \t"/>\n\t<path class="st0" d="M11.9,6h1.6v4.5c0.4-0.7,1.2-1.1,2.3-1.1c1,0,1.7,0.4,2.1,0.9c0.3,0.5,0.4,1.1,0.4,2.1v4.1h-1.6v-3.6\n\t\tc0-1.2-0.3-2.1-1.5-2.1c-1.1,0-1.7,0.9-1.7,2.1v3.6h-1.6V6z"/>\n\t<path class="st0" d="M21.1,5.7c0.7,0,1.2,0.5,1.2,1.2c0,0.7-0.5,1.2-1.2,1.2c-0.7,0-1.2-0.5-1.2-1.2C19.9,6.2,20.4,5.7,21.1,5.7\n\t\t M20.3,9.5h1.6v7h-1.6V9.5z"/>\n\t<path class="st0" d="M29.1,14.5c0,1.4-1.3,2.1-2.8,2.1c-1.5,0-2.8-0.9-2.8-2.5h1.6c0,0.9,0.6,1.2,1.3,1.2c0.6,0,1.1-0.2,1.1-0.8\n\t\tc0-0.7-0.7-0.7-2.2-1.3c-1-0.4-1.7-0.7-1.7-1.9c0-1.3,1.2-2,2.6-2c1.5,0,2.7,1,2.7,2.4h-1.6c0-0.7-0.3-1.1-1.1-1.1\n\t\tc-0.6,0-1,0.3-1,0.8c0,0.6,0.6,0.7,1.9,1.2C28.2,12.9,29.1,13.2,29.1,14.5"/>\n\t<path class="st0" d="M35.2,5.7c0.7,0,1.2,0.5,1.2,1.2c0,0.7-0.5,1.2-1.2,1.2c-0.7,0-1.2-0.5-1.2-1.2C34,6.2,34.5,5.7,35.2,5.7\n\t\t M34.4,9.5H36v7h-1.6V9.5z"/>\n\t<path class="st0" d="M43.2,14.5c0,1.4-1.3,2.1-2.8,2.1c-1.5,0-2.8-0.9-2.8-2.5h1.6c0,0.9,0.6,1.2,1.3,1.2c0.6,0,1.1-0.2,1.1-0.8\n\t\tc0-0.7-0.7-0.7-2.2-1.3c-1-0.4-1.7-0.7-1.7-1.9c0-1.3,1.2-2,2.6-2c1.5,0,2.7,1,2.7,2.4h-1.6c0-0.7-0.3-1.1-1.1-1.1\n\t\tc-0.6,0-1,0.3-1,0.8c0,0.6,0.6,0.7,1.9,1.2C42.2,12.9,43.2,13.2,43.2,14.5"/>\n\t<path class="st0" d="M55.3,9.5v7h-1.6v-0.9c-0.4,0.7-1.3,1.1-2.1,1.1c-2.1,0-3.6-1.7-3.6-3.7c0-2,1.4-3.7,3.6-3.7\n\t\tc0.8,0,1.7,0.4,2.1,1.1V9.5H55.3z M53.7,12.9c0-1.2-0.8-2.2-2.1-2.2c-1.2,0-2,1-2,2.2c0,1.2,0.8,2.2,2,2.2\n\t\tC52.9,15.1,53.7,14.1,53.7,12.9"/>\n\t<path class="st0" d="M57.4,9.5H59v1c0.4-0.7,1.2-1.1,2.3-1.1c1,0,1.7,0.4,2.1,0.9c0.3,0.5,0.4,1.1,0.4,2.1v4.1h-1.6v-3.6\n\t\tc0-1.2-0.3-2.1-1.5-2.1c-1.1,0-1.7,0.9-1.7,2.1v3.6h-1.6V9.5z"/>\n\t<rect x="181.8" y="5.3" class="st0" width="0.7" height="74.7"/>\n</g>\n</svg>\n'},function(e,t){e.exports='<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 237 120"><style>.st0{enable-background:new ;} .st1{}</style><title>This is a + Chrome + Experiment</title><g id="Page-1"><g id="Mobile-Home"><g id="Footer"><g id="google-logo---gray-_x2B_-This-is-a-_x2B_-Chrome-_x2B_-Experiment"><g id="This-is-a-_x2B_-Chrome-_x2B_-Experiment"><g class="st0"><path class="st1" d="M14.284 3.227h-5.5v15.1h-2.2v-15.1h-5.4v-1.9h13.1v1.9zM18.584 7.227c1-1.2 2.2-1.8 3.7-1.8 2.7 0 4 1.5 4 4.5v8.4h-2.2v-8.3c0-.9-.2-1.6-.6-2-.4-.4-1-.7-1.9-.7-.7 0-1.3.2-1.8.6s-.9.8-1.2 1.4v9h-2.2V.427h2.2v6.8zM29.584 2.327c0-.3.1-.6.3-.9s.5-.4 1-.4c.4 0 .7.1 1 .4.2.2.3.5.3.9s-.1.6-.3.9c-.2.2-.5.3-1 .3-.4 0-.7-.1-1-.3-.2-.2-.3-.5-.3-.9zm2.4 16h-2.2v-12.6h2.2v12.6zM42.784 15.027c0-.6-.2-1-.7-1.4s-1.2-.6-2.3-.8c-1.1-.2-2-.5-2.6-.8-.6-.3-1.1-.7-1.4-1.2-.3-.5-.5-1-.5-1.6 0-1 .4-1.9 1.3-2.6.9-.7 2-1.1 3.4-1.1s2.6.4 3.5 1.1c.9.7 1.3 1.7 1.3 2.8h-2.2c0-.6-.3-1.1-.8-1.5-.5-.4-1.1-.6-1.9-.6-.8 0-1.4.2-1.8.5-.4.3-.7.8-.7 1.3s.2.9.6 1.2c.4.3 1.2.5 2.2.8 1.1.2 1.9.5 2.6.9.7.3 1.2.7 1.5 1.2.3.5.5 1 .5 1.7 0 1.1-.5 2-1.4 2.7-.9.7-2.1 1-3.5 1-1 0-1.9-.2-2.7-.5-.8-.4-1.4-.9-1.8-1.5-.4-.6-.7-1.3-.7-2.1h2.2c0 .7.3 1.3.9 1.7.5.4 1.3.6 2.1.6s1.5-.2 2-.5.9-.8.9-1.3zM53.684 2.327c0-.3.1-.6.3-.9s.5-.4 1-.4c.4 0 .7.1 1 .4.2.2.3.5.3.9s-.1.6-.3.9c-.2.2-.5.3-1 .3-.4 0-.7-.1-1-.3-.2-.2-.3-.5-.3-.9zm2.3 16h-2.2v-12.6h2.2v12.6zM66.784 15.027c0-.6-.2-1-.7-1.4s-1.2-.6-2.3-.8c-1.1-.2-2-.5-2.6-.8-.6-.3-1.1-.7-1.4-1.2-.3-.5-.5-1-.5-1.6 0-1 .4-1.9 1.3-2.6.9-.7 2-1.1 3.4-1.1s2.6.4 3.5 1.1c.9.7 1.3 1.7 1.3 2.8h-2.2c0-.6-.3-1.1-.8-1.5-.5-.4-1.1-.6-1.9-.6-.8 0-1.4.2-1.8.5-.4.3-.7.8-.7 1.3s.2.9.6 1.2c.4.3 1.2.5 2.2.8 1.1.2 1.9.5 2.6.9.7.3 1.2.7 1.5 1.2.3.5.5 1 .5 1.7 0 1.1-.5 2-1.4 2.7-.9.7-2.1 1-3.5 1-1 0-1.9-.2-2.7-.5-.8-.4-1.4-.9-1.8-1.5-.4-.6-.7-1.3-.7-2.1h2.2c0 .7.3 1.3.9 1.7.5.4 1.3.6 2.1.6s1.5-.2 2-.5.9-.8.9-1.3zM85.384 18.327c-.1-.2-.2-.7-.3-1.3-1 1-2.2 1.6-3.6 1.6-1.2 0-2.3-.4-3.1-1.1-.8-.7-1.2-1.6-1.2-2.7 0-1.3.5-2.3 1.5-3.1 1-.7 2.4-1.1 4.2-1.1h2.1v-1c0-.8-.2-1.4-.7-1.8s-1.1-.7-2-.7c-.8 0-1.4.2-1.9.6s-.8.9-.8 1.4h-2c0-.6.2-1.2.7-1.8.4-.6 1.1-1.1 1.8-1.4s1.5-.4 2.5-.4c1.5 0 2.6.4 3.4 1.1.8.7 1.3 1.7 1.3 3v5.8c0 1.2.1 2.1.4 2.8v.1h-2.3zm-3.5-1.6c.7 0 1.3-.2 1.9-.5.6-.4 1-.8 1.3-1.4v-2.6h-1.7c-2.6 0-4 .8-4 2.3 0 .7.2 1.2.7 1.6s1.1.6 1.8.6z"/></g><g class="st0"><path class="st1" d="M30.384 53.327c-.4 3.5-1.7 6.3-3.9 8.2-2.2 1.9-5.1 2.9-8.8 2.9-3.9 0-7.1-1.4-9.5-4.2-2.3-2.9-3.5-6.7-3.5-11.4v-3.2c0-3.1.6-5.8 1.7-8.2s2.7-4.2 4.7-5.4c2-1.3 4.4-1.9 7.1-1.9 3.5 0 6.4 1 8.5 3 2.1 2 3.4 4.7 3.7 8.2h-4.4c-.4-2.7-1.2-4.6-2.5-5.8-1.3-1.2-3.1-1.8-5.4-1.8-2.8 0-5 1-6.6 3.1-1.6 2.1-2.4 5-2.4 8.9v3.2c0 3.6.8 6.5 2.3 8.7 1.5 2.1 3.6 3.2 6.4 3.2 2.4 0 4.3-.6 5.6-1.7s2.2-3 2.6-5.8h4.4zM39.984 42.127c1.9-2.3 4.3-3.5 7.3-3.5 5.2 0 7.9 3 7.9 8.9v16.4h-4.2v-16.4c0-1.8-.4-3.1-1.2-4-.8-.9-2.1-1.3-3.8-1.3-1.4 0-2.6.4-3.6 1.1-1 .7-1.9 1.7-2.4 2.9v17.7h-4.2v-35.2h4.2v13.4zM73.684 42.927c-.6-.1-1.3-.2-2.1-.2-2.8 0-4.7 1.2-5.7 3.6v17.6h-4.2v-24.8h4.1l.1 2.9c1.4-2.2 3.4-3.3 5.9-3.3.8 0 1.5.1 1.9.3v3.9zM75.984 51.327c0-2.4.5-4.6 1.4-6.6 1-1.9 2.3-3.4 4-4.5s3.7-1.6 5.8-1.6c3.4 0 6.1 1.2 8.2 3.5 2.1 2.3 3.1 5.5 3.1 9.3v.3c0 2.4-.5 4.6-1.4 6.5-.9 1.9-2.2 3.4-4 4.5-1.7 1.1-3.7 1.6-5.9 1.6-3.4 0-6.1-1.2-8.2-3.5-2.1-2.3-3.1-5.4-3.1-9.3v-.2zm4.3.5c0 2.8.6 5 1.9 6.6 1.3 1.7 3 2.5 5.1 2.5 2.2 0 3.9-.8 5.1-2.5 1.3-1.7 1.9-4.1 1.9-7.1 0-2.7-.6-4.9-1.9-6.6s-3-2.5-5.2-2.5c-2.1 0-3.8.8-5.1 2.5-1.2 1.6-1.8 4-1.8 7.1zM107.884 39.127l.1 2.8c1.8-2.1 4.3-3.2 7.4-3.2 3.5 0 5.8 1.3 7.1 4 .8-1.2 1.9-2.2 3.2-2.9s2.9-1.1 4.7-1.1c5.4 0 8.2 2.9 8.3 8.7v16.6h-4.2v-16.5c0-1.8-.4-3.1-1.2-4-.8-.9-2.2-1.3-4.1-1.3-1.6 0-2.9.5-3.9 1.4-1 .9-1.6 2.2-1.8 3.8v16.5h-4.3v-16.3c0-3.6-1.8-5.4-5.3-5.4-2.8 0-4.7 1.2-5.7 3.6v18.1h-4.2v-24.8h3.9zM155.384 64.427c-3.4 0-6.1-1.1-8.2-3.3s-3.2-5.2-3.2-8.9v-.8c0-2.5.5-4.7 1.4-6.6.9-1.9 2.3-3.5 3.9-4.5s3.5-1.6 5.5-1.6c3.2 0 5.7 1.1 7.5 3.2 1.8 2.1 2.7 5.2 2.7 9.1v1.8h-16.8c.1 2.4.8 4.4 2.1 5.9 1.4 1.5 3.1 2.3 5.2 2.3 1.5 0 2.8-.3 3.8-.9 1-.6 2-1.4 2.7-2.4l2.6 2c-1.9 3.1-5 4.7-9.2 4.7zm-.5-22.3c-1.7 0-3.2.6-4.3 1.9-1.2 1.2-1.9 3-2.2 5.2h12.4v-.3c-.1-2.2-.7-3.8-1.7-5-1-1.2-2.4-1.8-4.2-1.8z"/></g><g class="st0"><path class="st1" d="M24.784 94.327h-14.5v11.8h16.8v3.6h-21.2v-33.3h21v3.6h-16.6v10.8h14.5v3.5zM40.184 94.027l5.5-9.1h5l-8.1 12.3 8.4 12.6h-4.9l-5.7-9.3-5.7 9.3h-5.1l8.4-12.6-8.1-12.3h4.9l5.4 9.1zM76.184 97.627c0 3.8-.9 6.8-2.6 9.1-1.7 2.3-4.1 3.5-7 3.5-3 0-5.4-1-7.1-2.9v12h-4.2v-34.4h3.9l.2 2.8c1.7-2.1 4.1-3.2 7.2-3.2 3 0 5.3 1.1 7.1 3.4 1.7 2.2 2.6 5.4 2.6 9.4v.3zm-4.3-.5c0-2.8-.6-5-1.8-6.6-1.2-1.6-2.8-2.4-4.9-2.4-2.6 0-4.5 1.1-5.8 3.4v11.9c1.3 2.3 3.2 3.4 5.8 3.4 2 0 3.7-.8 4.9-2.4s1.8-4.1 1.8-7.3zM91.884 110.227c-3.4 0-6.1-1.1-8.2-3.3s-3.2-5.2-3.2-8.9v-.7c0-2.5.5-4.7 1.4-6.6.9-1.9 2.3-3.5 3.9-4.5 1.7-1.1 3.5-1.6 5.5-1.6 3.2 0 5.7 1.1 7.5 3.2 1.8 2.1 2.7 5.2 2.7 9.1v1.8h-16.7c.1 2.4.8 4.4 2.1 5.9 1.4 1.5 3.1 2.3 5.2 2.3 1.5 0 2.8-.3 3.8-.9 1-.6 2-1.4 2.7-2.4l2.6 2c-2 3-5.1 4.6-9.3 4.6zm-.5-22.2c-1.7 0-3.2.6-4.3 1.9-1.2 1.2-1.9 3-2.2 5.2h12.4v-.3c-.1-2.2-.7-3.8-1.7-5-1.1-1.2-2.5-1.8-4.2-1.8zM118.484 88.727c-.6-.1-1.3-.2-2.1-.2-2.8 0-4.7 1.2-5.7 3.6v17.6h-4.2v-24.8h4.1l.1 2.9c1.4-2.2 3.4-3.3 5.9-3.3.8 0 1.5.1 1.9.3v3.9zM122.384 78.327c0-.7.2-1.3.6-1.7.4-.5 1-.7 1.9-.7s1.5.2 1.9.7c.4.5.6 1.1.6 1.7s-.2 1.3-.6 1.7c-.4.5-1.1.7-1.9.7s-1.4-.2-1.9-.7-.6-1-.6-1.7zm4.6 31.5h-4.2v-24.9h4.2v24.9zM137.784 84.927l.1 2.8c1.8-2.1 4.3-3.2 7.4-3.2 3.5 0 5.8 1.3 7.1 4 .8-1.2 1.9-2.2 3.2-2.9 1.3-.7 2.9-1.1 4.7-1.1 5.4 0 8.2 2.9 8.3 8.7v16.6h-4.2v-16.4c0-1.8-.4-3.1-1.2-4-.8-.9-2.2-1.3-4.1-1.3-1.6 0-2.9.5-3.9 1.4-1 .9-1.6 2.2-1.8 3.8v16.5h-4.3v-16.3c0-3.6-1.8-5.4-5.3-5.4-2.8 0-4.7 1.2-5.7 3.6v18.1h-4.2v-24.9h3.9zM185.284 110.227c-3.4 0-6.1-1.1-8.2-3.3s-3.2-5.2-3.2-8.9v-.7c0-2.5.5-4.7 1.4-6.6.9-1.9 2.3-3.5 3.9-4.5 1.7-1.1 3.5-1.6 5.5-1.6 3.2 0 5.7 1.1 7.5 3.2 1.8 2.1 2.7 5.2 2.7 9.1v1.8h-16.8c.1 2.4.8 4.4 2.1 5.9 1.4 1.5 3.1 2.3 5.2 2.3 1.5 0 2.8-.3 3.8-.9 1-.6 2-1.4 2.7-2.4l2.6 2c-1.9 3-5 4.6-9.2 4.6zm-.5-22.2c-1.7 0-3.2.6-4.3 1.9s-1.9 3-2.2 5.2h12.4v-.3c-.1-2.2-.7-3.8-1.7-5-1-1.2-2.5-1.8-4.2-1.8zM203.884 84.927l.1 3.1c1.9-2.4 4.4-3.6 7.4-3.6 5.2 0 7.9 3 7.9 8.9v16.4h-4.2v-16.4c0-1.8-.4-3.1-1.2-4-.8-.9-2.1-1.3-3.8-1.3-1.4 0-2.6.4-3.6 1.1-1 .7-1.9 1.7-2.4 2.9v17.7h-4.2v-24.8h4zM231.584 78.927v6h4.6v3.3h-4.6v15.4c0 1 .2 1.7.6 2.2.4.5 1.1.7 2.1.7.5 0 1.2-.1 2-.3v3.4c-1.1.3-2.2.5-3.3.5-1.9 0-3.3-.6-4.3-1.7s-1.4-2.8-1.4-4.9v-15.3h-4.5v-3.3h4.5v-6h4.3z"/></g></g></g></g></g></g></svg>'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">\n    <path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/>\n    <path d="M0 0h24v24H0z" fill="none"/>\n</svg>\n'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">\n    <path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/>\n    <path d="M0 0h24v24H0z" fill="none"/>\n</svg>\n'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M11.67 3.87L9.9 2.1 0 12l9.9 9.9 1.77-1.77L3.54 12z"/><path fill="none" d="M0 0h24v24H0z"/></svg>'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M5.88 4.12L13.76 12l-7.88 7.88L8 22l10-10L8 2z"/><path fill="none" d="M0 0h24v24H0z"/></svg>'},function(e,t){e.exports='<svg width="14px" height="14px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n    <polygon points="0 0 0 20 20 20 20 12 18 12 18 18 2 18 2 2 8 2 8 0"></polygon>\n    <polygon points="11.707 0 11.707 2 17.293 2 8 11.293 9.414 12.707 18.707 3.414 18.707 9 20.707 9 20.707 0"></polygon>\n</svg>\n'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">\n    <path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/>\n    <path d="M0 0h24v24H0z" fill="none"/>\n</svg>\n'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">\n    <path fill="none" d="M0 0h24v24H0V0z"/>\n    <path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"/>\n</svg>\n'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">\n    <path d="M0 0h24v24H0z" fill="none"/>\n    <path d="M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"/>\n</svg>\n'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">\n    <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>\n    <path d="M0 0h24v24H0z" fill="none"/>\n</svg>\n'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">\n    <path d="M0 0h24v24H0z" fill="none"/>\n    <path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/>\n</svg>\n'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">\n    <path d="M0 0h24v24H0z" fill="none"/>\n    <path d="M6 6h12v12H6z"/>\n</svg>\n'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">\n    <path d="M8 5v14l11-7z"/>\n    <path d="M0 0h24v24H0z" fill="none"/>\n</svg>\n'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">\n    <path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/>\n    <path d="M0 0h24v24H0z" fill="none"/>\n</svg>\n'},function(e,t,n){"use strict";var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};Object.defineProperty(t,"__esModule",{value:!0});const i=n(6),o=n(1),a=n(3),s=n(8);n(56);const u=[e=>e,e=>`acc-${e}`,e=>`[name="${e}" i]`,e=>`[label="${e}" i]`,e=>`[value="${e}" i]`,e=>`.${e}`,e=>`#${e}`],c=e=>{if(e.value){if("string"==typeof e.value){if("true"===e.value.toLowerCase())return!0;if("false"===e.value.toLowerCase())return!1;if(isFinite(parseInt(e.value,10)))return parseInt(e.value,10)}return e.value}return e.selected?e.selected.value?e.selected.value:e.selected:null};class l extends o.LitElement{constructor(){super(...arguments),this.label="",this.disableSkipToContent=!1,this.closed=!1}bind(e,t,n){const r=this.query(e);r&&r.addEventListener("select",e=>{t[n]=c(r),console.log(`${t}.${n} = ${t[n]}`)})}getValue(e){const t=this.query(e);return t?c(t):null}query(e,t,n){const r=(()=>{let t=0;for(;t<u.length;){const n=this.querySelector(u[t](e));if(null!==n)return n;t++}const n=(e,t)=>{const r=e;if(r.value&&r.value.toLowerCase&&r.value.toLowerCase()===t.toLowerCase())return e;if(r.label&&r.label.toLowerCase&&r.label.toLowerCase()===t.toLowerCase())return e;let i=null;for(let r of e.children)if(i=n(r,t))return i};return n(this,e)})();return r&&"string"==typeof t&&"function"==typeof n&&r.addEventListener(t,n),r}focus(){this.shadowRoot.querySelector("h1").focus()}_didRender(e,t,n){if(t&&t.hasOwnProperty("closed")){const t=this.shadowRoot.querySelector(e.closed?".open-button":".close-button");t&&t.focus()}return super._didRender(e,t,n)}_propertiesChanged(e,t,n){t&&n&&(s.setBooleanAttribute(this,"closed",e.closed),e.closed!==n.closed&&setTimeout(()=>{this.dispatchEvent(new CustomEvent(e.closed?"close":"open",{bubbles:!0})),this.dispatchEvent(new CustomEvent("resize",{bubbles:!0}))},0),super._propertiesChanged(e,t,n))}_render({label:e,disableSkipToContent:t}){return o.html`
            <style>
                :host {
                    position: absolute;
                    top: 0;
                    left: 0;
                    color: ${i.buttonLabelColor};
                    z-index: 2;
                }

                .container {
                    height: calc(100vh - 95px);
                    width: 300px;
                    min-height: 100%;
                    background-color: ${i.backgroundColor};
                    overflow: auto;
                    border-right: 1px solid ${i.outlineBorderColor};
                }

                :host([closed]) .container {
                    display: none;
                }

                :host([closed]) .open-button {
                    display: inline-block;
                }

                :host([closed]) .container {
                    display: none;
                }

                :host::before {
                    padding-bottom: 110px;
                    position: relative;
                    display: block;
                    content: '';
                }

                #side-panel-nav {
                    padding-top: 24px;
                }


                header {
                    background: ${i.backgroundColor};
                    border-bottom: 1px solid ${i.outlineBorderColor};
                    border-right: 1px solid ${i.outlineBorderColor};
                    color: ${i.labelColor};
                    padding: 40px 24px 40px;
                    position: fixed;
                    top: 0;
                    width: 252px;
                    z-index: 2;
                }

                h1 {
                    font-family: ${i.titleFontFamily};
                    font-size: 26px;
                    font-weight: 700;
                    margin: 0;
                    padding: 0;
                }

                .close-button {
                    right: 30px;
                    width: 48px;
                    height: 48px;
                    position: absolute;
                    top: 50%;
                    border: none;
                    background: transparent;
                    transform: translateY(-50%);
                    display: flex;
                    justify-content: center;
                    flex-direction: column;
                    align-items: center;
                }

                .skip-to-content {
                    height: 1px;
                    clip: rect(1px, 1px, 1px, 1px);
                    color: ${i.accentColor};
                    font-weight: bold;
                    overflow: hidden;
                    opacity: 0;
                    width: 1px;
                    position: absolute;
                    top: 0;
                    left: -100px;
                    background-color: var(--background-color);
                    border: 1px solid ${i.outlineBorderColor};
                }

                .skip-to-content:focus, .skip-to-content.debug {
                    clip: auto;
                    height: 35px;
                    opacity: 1;
                    width: 50%;
                    z-index: 20;
                    position: absolute;
                    top: 100px;
                    left: 25%;
                    background-image: none;
                    background-color: ${i.buttonBackgroundColor};
                }

                .open-button {
                    --margin: 16px;
                    --button-width: 60px;
                    --button-height: 40px;
                    display: none;
                    position: absolute;
                    top: var(--margin);
                    left: var(--margin);
                    width: var(--button-width);
                    height: var(--button-height);
                    background-color: ${i.buttonBackgroundColor};
                    border: 1px solid ${i.outlineBorderColor};
                    box-sizing: border-box;
                }

                .open-button svg {
                    position: relative;
                    top: 4px;
                    width: 28px;
                }

                acc-button {
                    cursor: pointer;
                }

            </style>
            <button
                class="open-button"
                aria-label="Open Menu"
                on-click=${()=>this.closed=!1}>
                <acc-icon icon="menu"></acc-icon>
                </button>
            <section class="container" role="menubar" aria-label="left side panel">
                <header>
                    <h1 tabindex="-1">${e}</h1>
                    <button
                        class="close-button"
                        on-click=${()=>!(this.closed=!0)}
                        aria-label="Collapse menu">
                        <acc-icon icon="close"></acc-icon>
                    </button>
                    <button
                        tabindex="0"
                        aria-label="Skip to content"
                        class="skip-to-content"
                        style="width: 50%;"
                        on-click=${()=>!t&&this.skipToContent()}>Skip to Content</button>
                </header>
                <nav id="side-panel-nav">
                    <slot></slot>
                </nav>
            </section>
        `}skipToContent(){this.dispatchEvent(new CustomEvent("skiptocontent",{bubbles:!0}))}}r([a.property({type:String})],l.prototype,"label",void 0),r([a.property({type:Boolean})],l.prototype,"disableSkipToContent",void 0),r([a.property({type:Boolean})],l.prototype,"closed",void 0),t.SidePanel=l,customElements.define("acc-side-panel",l)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(236),n(220),n(219),n(218),n(97),n(96),n(217),n(216),n(215),n(214),n(212),n(211),n(209),n(208),n(53),n(95),n(207),n(206),n(205),n(204),n(198),n(197),n(195),n(194),n(107),n(98),n(106),n(105),n(104),n(37),n(103),n(57),n(102),n(101),n(100)}]);