docs.sheetjs.com/docz/static/tfjs/tf.min.js
2023-06-01 04:25:44 -04:00

19 lines
1.4 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @license
* Copyright 2023 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(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).tf=e.tf||{})}(this,(function(e){"use strict";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}))})),e}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function a(e){var t,n;function r(t,n){try{var o=e[t](n),s=o.value,u=s instanceof i;Promise.resolve(u?s.v:s).then((function(n){if(u){var i="return"===t?"return":"next";if(!s.k||n.done)return r(i,n);n=e[i](n).value}a(o.done?"return":"normal",n)}),(function(e){r("throw",e)}))}catch(e){a("throw",e)}}function a(e,a){switch(e){case"return":t.resolve({value:a,done:!0});break;case"throw":t.reject(a);break;default:t.resolve({value:a,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,a){return new Promise((function(i,o){var s={key:e,arg:a,resolve:i,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,a))}))},"function"!=typeof e.return&&(this.return=void 0)}function i(e,t){this.v=e,this.k=t}function o(){o=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function l(e,t,n,a){var i=t&&t.prototype instanceof f?t:f,o=Object.create(i.prototype),s=new T(a||[]);return r(o,"_invoke",{value:w(e,n,s)}),o}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var p={};function f(){}function d(){}function v(){}var m={};c(m,i,(function(){return this}));var g=Object.getPrototypeOf,y=g&&g(g(E([])));y&&y!==t&&n.call(y,i)&&(m=y);var b=v.prototype=f.prototype=Object.create(m);function x(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function a(r,i,o,s){var u=h(e[r],e,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){a("next",e,o,s)}),(function(e){a("throw",e,o,s)})):t.resolve(l).then((function(e){c.value=e,o(c)}),(function(e){return a("throw",e,o,s)}))}s(u.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){a(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function w(e,t,n){var r="suspendedStart";return function(a,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw i;return C()}for(n.method=a,n.arg=i;;){var o=n.delegate;if(o){var s=I(o,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=h(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function I(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var a=h(r,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,p;var i=a.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function E(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:C}}function C(){return{value:void 0,done:!0}}return d.prototype=v,r(b,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:d,configurable:!0}),d.displayName=c(v,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,c(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},x(k.prototype),c(k.prototype,s,(function(){return this})),e.AsyncIterator=k,e.async=function(t,n,r,a,i){void 0===i&&(i=Promise);var o=new k(l(t,n,r,a),i);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},x(b),c(b,u,"Generator"),c(b,i,(function(){return this})),c(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=E,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],o=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;S(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:E(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},e}function s(e){return s="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},s(e)}function u(e,t,n,r,a,i,o){try{var s=e[i](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,a)}function c(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function o(e){u(i,r,a,o,s,"next",e)}function s(e){u(i,r,a,o,s,"throw",e)}o(void 0)}))}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,F(r.key),r)}}function p(e,t,n){return t&&h(e.prototype,t),n&&h(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e,t,n){return(t=F(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},m(e,t)}function g(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function y(e,t,n){return y=g()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&m(a,n.prototype),a},y.apply(null,arguments)}function b(e){var t="function"==typeof Map?new Map:void 0;return b=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return y(e,arguments,v(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),m(r,e)},b(e)}function x(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function k(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return x(e)}function w(e){var t=g();return function(){var n,r=v(e);if(t){var a=v(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return k(this,n)}}function I(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=v(e)););return e}function N(){return N="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=I(e,t);if(r){var a=Object.getOwnPropertyDescriptor(r,t);return a.get?a.get.call(arguments.length<3?e:n):a.value}},N.apply(this,arguments)}function S(e,t){return E(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],u=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(e,t)||A(e,t)||_()}function T(e){return function(e){if(Array.isArray(e))return R(e)}(e)||C(e)||A(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e){if(Array.isArray(e))return e}function C(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function A(e,t){if(e){if("string"==typeof e)return R(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(e,t):void 0}}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function O(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=A(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function F(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}a.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},a.prototype.next=function(e){return this._invoke("next",e)},a.prototype.throw=function(e){return this._invoke("throw",e)},a.prototype.return=function(e){return this._invoke("return",e)};var D,M,L=function(e){return e&&e.Math==Math&&e},z=L("object"==("undefined"==typeof globalThis?"undefined":s(globalThis))&&globalThis)||L("object"==("undefined"==typeof window?"undefined":s(window))&&window)||L("object"==("undefined"==typeof self?"undefined":s(self))&&self)||L("object"==s(n)&&n)||function(){return this}()||Function("return this")(),P={},B=function(e){try{return!!e()}catch(e){return!0}},W=!B((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),V=!B((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),U=V,G=Function.prototype.call,j=U?G.bind(G):function(){return G.apply(G,arguments)},H={},q={}.propertyIsEnumerable,K=Object.getOwnPropertyDescriptor,X=K&&!q.call({1:2},1),Y=(H.f=X?function(e){var t=K(this,e);return!!t&&t.enumerable}:q,function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}),J=V,Z=Function.prototype,Q=Z.call,$=J&&Z.bind.bind(Q,Q),ee=J?$:function(e){return function(){return Q.apply(e,arguments)}},te=ee,ne=te({}.toString),re=te("".slice),ae=function(e){return re(ne(e),8,-1)},ie=B,oe=ae,se=Object,ue=ee("".split),ce=ie((function(){return!se("z").propertyIsEnumerable(0)}))?function(e){return"String"==oe(e)?ue(e,""):se(e)}:se,le=function(e){return null==e},he=le,pe=TypeError,fe=function(e){if(he(e))throw pe("Can't call method on "+e);return e},de=ce,ve=fe,me=function(e){return de(ve(e))},ge="object"==("undefined"==typeof document?"undefined":s(document))&&document.all,ye={all:ge,IS_HTMLDDA:void 0===ge&&void 0!==ge},be=ye.all,xe=ye.IS_HTMLDDA?function(e){return"function"==typeof e||e===be}:function(e){return"function"==typeof e},ke=xe,we=ye.all,Ie=ye.IS_HTMLDDA?function(e){return"object"==s(e)?null!==e:ke(e)||e===we}:function(e){return"object"==s(e)?null!==e:ke(e)},Ne=z,Se=xe,Te=function(e){return Se(e)?e:void 0},Ee=function(e,t){return arguments.length<2?Te(Ne[e]):Ne[e]&&Ne[e][t]},Ce=ee({}.isPrototypeOf),Ae="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Re=z,_e=Ae,Oe=Re.process,Fe=Re.Deno,De=Oe&&Oe.versions||Fe&&Fe.version,Me=De&&De.v8;Me&&(M=(D=Me.split("."))[0]>0&&D[0]<4?1:+(D[0]+D[1])),!M&&_e&&(!(D=_e.match(/Edge\/(\d+)/))||D[1]>=74)&&(D=_e.match(/Chrome\/(\d+)/))&&(M=+D[1]);var Le=M,ze=Le,Pe=B,Be=!!Object.getOwnPropertySymbols&&!Pe((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ze&&ze<41})),We=Be&&!Symbol.sham&&"symbol"==s(Symbol.iterator),Ve=Ee,Ue=xe,Ge=Ce,je=Object,He=We?function(e){return"symbol"==s(e)}:function(e){var t=Ve("Symbol");return Ue(t)&&Ge(t.prototype,je(e))},qe=String,Ke=function(e){try{return qe(e)}catch(e){return"Object"}},Xe=xe,Ye=Ke,Je=TypeError,Ze=function(e){if(Xe(e))return e;throw Je(Ye(e)+" is not a function")},Qe=Ze,$e=le,et=function(e,t){var n=e[t];return $e(n)?void 0:Qe(n)},tt=j,nt=xe,rt=Ie,at=TypeError,it=function(e,t){var n,r;if("string"===t&&nt(n=e.toString)&&!rt(r=tt(n,e)))return r;if(nt(n=e.valueOf)&&!rt(r=tt(n,e)))return r;if("string"!==t&&nt(n=e.toString)&&!rt(r=tt(n,e)))return r;throw at("Can't convert object to primitive value")},ot={exports:{}},st=!1,ut=z,ct=Object.defineProperty,lt=function(e,t){try{ct(ut,e,{value:t,configurable:!0,writable:!0})}catch(n){ut[e]=t}return t},ht=lt,pt="__core-js_shared__",ft=z[pt]||ht(pt,{}),dt=(ot.exports,ft);(ot.exports=function(e,t){return dt[e]||(dt[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.29.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.29.1/LICENSE",source:"https://github.com/zloirock/core-js"});var vt=ot.exports,mt=fe,gt=Object,yt=function(e){return gt(mt(e))},bt=yt,xt=ee({}.hasOwnProperty),kt=Object.hasOwn||function(e,t){return xt(bt(e),t)},wt=ee,It=0,Nt=Math.random(),St=wt(1..toString),Tt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+St(++It+Nt,36)},Et=vt,Ct=kt,At=Tt,Rt=Be,_t=We,Ot=z.Symbol,Ft=Et("wks"),Dt=_t?Ot.for||Ot:Ot&&Ot.withoutSetter||At,Mt=function(e){return Ct(Ft,e)||(Ft[e]=Rt&&Ct(Ot,e)?Ot[e]:Dt("Symbol."+e)),Ft[e]},Lt=j,zt=Ie,Pt=He,Bt=et,Wt=it,Vt=TypeError,Ut=Mt("toPrimitive"),Gt=function(e,t){if(!zt(e)||Pt(e))return e;var n,r=Bt(e,Ut);if(r){if(void 0===t&&(t="default"),n=Lt(r,e,t),!zt(n)||Pt(n))return n;throw Vt("Can't convert object to primitive value")}return void 0===t&&(t="number"),Wt(e,t)},jt=Gt,Ht=He,qt=function(e){var t=jt(e,"string");return Ht(t)?t:t+""},Kt=Ie,Xt=z.document,Yt=Kt(Xt)&&Kt(Xt.createElement),Jt=function(e){return Yt?Xt.createElement(e):{}},Zt=Jt,Qt=!W&&!B((function(){return 7!=Object.defineProperty(Zt("div"),"a",{get:function(){return 7}}).a})),$t=W,en=j,tn=H,nn=Y,rn=me,an=qt,on=kt,sn=Qt,un=Object.getOwnPropertyDescriptor,cn=(P.f=$t?un:function(e,t){if(e=rn(e),t=an(t),sn)try{return un(e,t)}catch(e){}if(on(e,t))return nn(!en(tn.f,e,t),e[t])},{}),ln=W&&B((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),hn=Ie,pn=String,fn=TypeError,dn=function(e){if(hn(e))return e;throw fn(pn(e)+" is not an object")},vn=W,mn=Qt,gn=ln,yn=dn,bn=qt,xn=TypeError,kn=Object.defineProperty,wn=Object.getOwnPropertyDescriptor,In="enumerable",Nn="configurable",Sn="writable",Tn=(cn.f=vn?gn?function(e,t,n){if(yn(e),t=bn(t),yn(n),"function"==typeof e&&"prototype"===t&&"value"in n&&Sn in n&&!n.writable){var r=wn(e,t);r&&r.writable&&(e[t]=n.value,n={configurable:Nn in n?n.configurable:r.configurable,enumerable:In in n?n.enumerable:r.enumerable,writable:!1})}return kn(e,t,n)}:kn:function(e,t,n){if(yn(e),t=bn(t),yn(n),mn)try{return kn(e,t,n)}catch(e){}if("get"in n||"set"in n)throw xn("Accessors not supported");return"value"in n&&(e[t]=n.value),e},cn),En=Y,Cn=W?function(e,t,n){return Tn.f(e,t,En(1,n))}:function(e,t,n){return e[t]=n,e},An={exports:{}},Rn=W,_n=kt,On=Function.prototype,Fn=Rn&&Object.getOwnPropertyDescriptor,Dn=_n(On,"name"),Mn={EXISTS:Dn,PROPER:Dn&&"something"===function(){}.name,CONFIGURABLE:Dn&&(!Rn||Rn&&Fn(On,"name").configurable)},Ln=xe,zn=ft,Pn=ee(Function.toString);Ln(zn.inspectSource)||(zn.inspectSource=function(e){return Pn(e)});var Bn,Wn,Vn,Un=zn.inspectSource,Gn=xe,jn=z.WeakMap,Hn=Gn(jn)&&/native code/.test(String(jn)),qn=Tt,Kn=vt("keys"),Xn=function(e){return Kn[e]||(Kn[e]=qn(e))},Yn={},Jn=Hn,Zn=z,Qn=Ie,$n=Cn,er=kt,tr=ft,nr=Xn,rr=Yn,ar="Object already initialized",ir=Zn.TypeError,or=Zn.WeakMap;if(Jn||tr.state){var sr=tr.state||(tr.state=new or);sr.get=sr.get,sr.has=sr.has,sr.set=sr.set,Bn=function(e,t){if(sr.has(e))throw ir(ar);return t.facade=e,sr.set(e,t),t},Wn=function(e){return sr.get(e)||{}},Vn=function(e){return sr.has(e)}}else{var ur=nr("state");rr[ur]=!0,Bn=function(e,t){if(er(e,ur))throw ir(ar);return t.facade=e,$n(e,ur,t),t},Wn=function(e){return er(e,ur)?e[ur]:{}},Vn=function(e){return er(e,ur)}}var cr={set:Bn,get:Wn,has:Vn,enforce:function(e){return Vn(e)?Wn(e):Bn(e,{})},getterFor:function(e){return function(t){var n;if(!Qn(t)||(n=Wn(t)).type!==e)throw ir("Incompatible receiver, "+e+" required");return n}}},lr=(An.exports,ee),hr=B,pr=xe,fr=kt,dr=W,vr=Mn.CONFIGURABLE,mr=Un,gr=cr.enforce,yr=cr.get,br=String,xr=Object.defineProperty,kr=lr("".slice),wr=lr("".replace),Ir=lr([].join),Nr=dr&&!hr((function(){return 8!==xr((function(){}),"length",{value:8}).length})),Sr=String(String).split("String"),Tr=An.exports=function(e,t,n){"Symbol("===kr(br(t),0,7)&&(t="["+wr(br(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!fr(e,"name")||vr&&e.name!==t)&&(dr?xr(e,"name",{value:t,configurable:!0}):e.name=t),Nr&&n&&fr(n,"arity")&&e.length!==n.arity&&xr(e,"length",{value:n.arity});try{n&&fr(n,"constructor")&&n.constructor?dr&&xr(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=gr(e);return fr(r,"source")||(r.source=Ir(Sr,"string"==typeof t?t:"")),e};Function.prototype.toString=Tr((function(){return pr(this)&&yr(this).source||mr(this)}),"toString");var Er=An.exports,Cr=xe,Ar=cn,Rr=Er,_r=lt,Or=function(e,t,n,r){r||(r={});var a=r.enumerable,i=void 0!==r.name?r.name:t;if(Cr(n)&&Rr(n,i,r),r.global)a?e[t]=n:_r(t,n);else{try{r.unsafe?e[t]&&(a=!0):delete e[t]}catch(e){}a?e[t]=n:Ar.f(e,t,{value:n,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return e},Fr={},Dr=Math.ceil,Mr=Math.floor,Lr=Math.trunc||function(e){var t=+e;return(t>0?Mr:Dr)(t)},zr=Lr,Pr=function(e){var t=+e;return t!=t||0===t?0:zr(t)},Br=Pr,Wr=Math.max,Vr=Math.min,Ur=function(e,t){var n=Br(e);return n<0?Wr(n+t,0):Vr(n,t)},Gr=Pr,jr=Math.min,Hr=function(e){return e>0?jr(Gr(e),9007199254740991):0},qr=Hr,Kr=function(e){return qr(e.length)},Xr=me,Yr=Ur,Jr=Kr,Zr=function(e){return function(t,n,r){var a,i=Xr(t),o=Jr(i),s=Yr(r,o);if(e&&n!=n){for(;o>s;)if((a=i[s++])!=a)return!0}else for(;o>s;s++)if((e||s in i)&&i[s]===n)return e||s||0;return!e&&-1}},Qr={includes:Zr(!0),indexOf:Zr(!1)},$r=kt,ea=me,ta=Qr.indexOf,na=Yn,ra=ee([].push),aa=function(e,t){var n,r=ea(e),a=0,i=[];for(n in r)!$r(na,n)&&$r(r,n)&&ra(i,n);for(;t.length>a;)$r(r,n=t[a++])&&(~ta(i,n)||ra(i,n));return i},ia=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],oa=aa,sa=ia.concat("length","prototype"),ua=(Fr.f=Object.getOwnPropertyNames||function(e){return oa(e,sa)},{}),ca=(ua.f=Object.getOwnPropertySymbols,Ee),la=Fr,ha=ua,pa=dn,fa=ee([].concat),da=ca("Reflect","ownKeys")||function(e){var t=la.f(pa(e)),n=ha.f;return n?fa(t,n(e)):t},va=kt,ma=da,ga=P,ya=cn,ba=function(e,t,n){for(var r=ma(t),a=ya.f,i=ga.f,o=0;o<r.length;o++){var s=r[o];va(e,s)||n&&va(n,s)||a(e,s,i(t,s))}},xa=B,ka=xe,wa=/#|\.prototype\./,Ia=function(e,t){var n=Sa[Na(e)];return n==Ea||n!=Ta&&(ka(t)?xa(t):!!t)},Na=Ia.normalize=function(e){return String(e).replace(wa,".").toLowerCase()},Sa=Ia.data={},Ta=Ia.NATIVE="N",Ea=Ia.POLYFILL="P",Ca=Ia,Aa=z,Ra=P.f,_a=Cn,Oa=Or,Fa=lt,Da=ba,Ma=Ca,La=function(e,t){var n,r,a,i,o,u=e.target,c=e.global,l=e.stat;if(n=c?Aa:l?Aa[u]||Fa(u,{}):(Aa[u]||{}).prototype)for(r in t){if(i=t[r],a=e.dontCallGetSet?(o=Ra(n,r))&&o.value:n[r],!Ma(c?r:u+(l?".":"#")+r,e.forced)&&void 0!==a){if(s(i)==s(a))continue;Da(i,a)}(e.sham||a&&a.sham)&&_a(i,"sham",!0),Oa(n,r,i,e)}},za={};za[Mt("toStringTag")]="z";var Pa,Ba="[object z]"===String(za),Wa=Ba,Va=xe,Ua=ae,Ga=Mt("toStringTag"),ja=Object,Ha="Arguments"==Ua(function(){return arguments}()),qa=Wa?Ua:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=ja(e),Ga))?n:Ha?Ua(t):"Object"==(r=Ua(t))&&Va(t.callee)?"Arguments":r},Ka=qa,Xa=String,Ya=function(e){if("Symbol"===Ka(e))throw TypeError("Cannot convert a Symbol value to a string");return Xa(e)},Ja={},Za=aa,Qa=ia,$a=Object.keys||function(e){return Za(e,Qa)},ei=W,ti=ln,ni=cn,ri=dn,ai=me,ii=$a,oi=(Ja.f=ei&&!ti?Object.defineProperties:function(e,t){ri(e);for(var n,r=ai(t),a=ii(t),i=a.length,o=0;i>o;)ni.f(e,n=a[o++],r[n]);return e},Ee("document","documentElement")),si=dn,ui=Ja,ci=ia,li=Yn,hi=oi,pi=Jt,fi=Xn("IE_PROTO"),di=function(){},vi=function(e){return"<script>"+e+"</"+"script>"},mi=function(e){e.write(vi("")),e.close();var t=e.parentWindow.Object;return e=null,t},gi=function(){try{Pa=new ActiveXObject("htmlfile")}catch(e){}var e,t;gi="undefined"!=typeof document?document.domain&&Pa?mi(Pa):((t=pi("iframe")).style.display="none",hi.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(vi("document.F=Object")),e.close(),e.F):mi(Pa);for(var n=ci.length;n--;)delete gi.prototype[ci[n]];return gi()};li[fi]=!0;var yi=Object.create||function(e,t){var n;return null!==e?(di.prototype=si(e),n=new di,di.prototype=null,n[fi]=e):n=gi(),void 0===t?n:ui.f(n,t)},bi={},xi=qt,ki=cn,wi=Y,Ii=function(e,t,n){var r=xi(t);r in e?ki.f(e,r,wi(0,n)):e[r]=n},Ni=Ur,Si=Kr,Ti=Ii,Ei=Array,Ci=Math.max,Ai=function(e,t,n){for(var r=Si(e),a=Ni(t,r),i=Ni(void 0===n?r:n,r),o=Ei(Ci(i-a,0)),s=0;a<i;a++,s++)Ti(o,s,e[a]);return o.length=s,o},Ri=ae,_i=me,Oi=Fr.f,Fi=Ai,Di="object"==("undefined"==typeof window?"undefined":s(window))&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Mi=(bi.f=function(e){return Di&&"Window"==Ri(e)?function(e){try{return Oi(e)}catch(e){return Fi(Di)}}(e):Oi(_i(e))},Er),Li=cn,zi=function(e,t,n){return n.get&&Mi(n.get,t,{getter:!0}),n.set&&Mi(n.set,t,{setter:!0}),Li.f(e,t,n)},Pi={},Bi=Mt,Wi=(Pi.f=Bi,z),Vi=Wi,Ui=kt,Gi=Pi,ji=cn.f,Hi=function(e){var t=Vi.Symbol||(Vi.Symbol={});Ui(t,e)||ji(t,e,{value:Gi.f(e)})},qi=j,Ki=Ee,Xi=Mt,Yi=Or,Ji=function(){var e=Ki("Symbol"),t=e&&e.prototype,n=t&&t.valueOf,r=Xi("toPrimitive");t&&!t[r]&&Yi(t,r,(function(e){return qi(n,this)}),{arity:1})},Zi=cn.f,Qi=kt,$i=Mt("toStringTag"),eo=function(e,t,n){e&&!n&&(e=e.prototype),e&&!Qi(e,$i)&&Zi(e,$i,{configurable:!0,value:t})},to=ae,no=ee,ro=function(e){if("Function"===to(e))return no(e)},ao=Ze,io=V,oo=ro(ro.bind),so=function(e,t){return ao(e),void 0===t?e:io?oo(e,t):function(){return e.apply(t,arguments)}},uo=ae,co=Array.isArray||function(e){return"Array"==uo(e)},lo=ee,ho=B,po=xe,fo=qa,vo=Un,mo=function(){},go=[],yo=Ee("Reflect","construct"),bo=/^\s*(?:class|function)\b/,xo=lo(bo.exec),ko=!bo.exec(mo),wo=function(e){if(!po(e))return!1;try{return yo(mo,go,e),!0}catch(e){return!1}},Io=function(e){if(!po(e))return!1;switch(fo(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ko||!!xo(bo,vo(e))}catch(e){return!0}};Io.sham=!0;var No=!yo||ho((function(){var e;return wo(wo.call)||!wo(Object)||!wo((function(){e=!0}))||e}))?Io:wo,So=co,To=No,Eo=Ie,Co=Mt("species"),Ao=Array,Ro=function(e){var t;return So(e)&&(t=e.constructor,(To(t)&&(t===Ao||So(t.prototype))||Eo(t)&&null===(t=t[Co]))&&(t=void 0)),void 0===t?Ao:t},_o=Ro,Oo=function(e,t){return new(_o(e))(0===t?0:t)},Fo=so,Do=ce,Mo=yt,Lo=Kr,zo=Oo,Po=ee([].push),Bo=function(e){var t=1==e,n=2==e,r=3==e,a=4==e,i=6==e,o=7==e,s=5==e||i;return function(u,c,l,h){for(var p,f,d=Mo(u),v=Do(d),m=Fo(c,l),g=Lo(v),y=0,b=h||zo,x=t?b(u,g):n||o?b(u,0):void 0;g>y;y++)if((s||y in v)&&(f=m(p=v[y],y,d),e))if(t)x[y]=f;else if(f)switch(e){case 3:return!0;case 5:return p;case 6:return y;case 2:Po(x,p)}else switch(e){case 4:return!1;case 7:Po(x,p)}return i?-1:r||a?a:x}},Wo={forEach:Bo(0),map:Bo(1),filter:Bo(2),some:Bo(3),every:Bo(4),find:Bo(5),findIndex:Bo(6),filterReject:Bo(7)},Vo=La,Uo=z,Go=j,jo=ee,Ho=W,qo=Be,Ko=B,Xo=kt,Yo=Ce,Jo=dn,Zo=me,Qo=qt,$o=Ya,es=Y,ts=yi,ns=$a,rs=Fr,as=bi,is=ua,os=P,ss=cn,us=Ja,cs=H,ls=Or,hs=zi,ps=vt,fs=Yn,ds=Tt,vs=Mt,ms=Pi,gs=Hi,ys=Ji,bs=eo,xs=cr,ks=Wo.forEach,ws=Xn("hidden"),Is="Symbol",Ns=xs.set,Ss=xs.getterFor(Is),Ts=Object.prototype,Es=Uo.Symbol,Cs=Es&&Es.prototype,As=Uo.TypeError,Rs=Uo.QObject,_s=os.f,Os=ss.f,Fs=as.f,Ds=cs.f,Ms=jo([].push),Ls=ps("symbols"),zs=ps("op-symbols"),Ps=ps("wks"),Bs=!Rs||!Rs.prototype||!Rs.prototype.findChild,Ws=Ho&&Ko((function(){return 7!=ts(Os({},"a",{get:function(){return Os(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=_s(Ts,t);r&&delete Ts[t],Os(e,t,n),r&&e!==Ts&&Os(Ts,t,r)}:Os,Vs=function(e,t){var n=Ls[e]=ts(Cs);return Ns(n,{type:Is,tag:e,description:t}),Ho||(n.description=t),n},Us=function(e,t,n){e===Ts&&Us(zs,t,n),Jo(e);var r=Qo(t);return Jo(n),Xo(Ls,r)?(n.enumerable?(Xo(e,ws)&&e[ws][r]&&(e[ws][r]=!1),n=ts(n,{enumerable:es(0,!1)})):(Xo(e,ws)||Os(e,ws,es(1,{})),e[ws][r]=!0),Ws(e,r,n)):Os(e,r,n)},Gs=function(e,t){Jo(e);var n=Zo(t),r=ns(n).concat(Ks(n));return ks(r,(function(t){Ho&&!Go(js,n,t)||Us(e,t,n[t])})),e},js=function(e){var t=Qo(e),n=Go(Ds,this,t);return!(this===Ts&&Xo(Ls,t)&&!Xo(zs,t))&&(!(n||!Xo(this,t)||!Xo(Ls,t)||Xo(this,ws)&&this[ws][t])||n)},Hs=function(e,t){var n=Zo(e),r=Qo(t);if(n!==Ts||!Xo(Ls,r)||Xo(zs,r)){var a=_s(n,r);return!a||!Xo(Ls,r)||Xo(n,ws)&&n[ws][r]||(a.enumerable=!0),a}},qs=function(e){var t=Fs(Zo(e)),n=[];return ks(t,(function(e){Xo(Ls,e)||Xo(fs,e)||Ms(n,e)})),n},Ks=function(e){var t=e===Ts,n=Fs(t?zs:Zo(e)),r=[];return ks(n,(function(e){!Xo(Ls,e)||t&&!Xo(Ts,e)||Ms(r,Ls[e])})),r};qo||(Es=function(){if(Yo(Cs,this))throw As("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?$o(arguments[0]):void 0,t=ds(e),n=function e(n){this===Ts&&Go(e,zs,n),Xo(this,ws)&&Xo(this[ws],t)&&(this[ws][t]=!1),Ws(this,t,es(1,n))};return Ho&&Bs&&Ws(Ts,t,{configurable:!0,set:n}),Vs(t,e)},ls(Cs=Es.prototype,"toString",(function(){return Ss(this).tag})),ls(Es,"withoutSetter",(function(e){return Vs(ds(e),e)})),cs.f=js,ss.f=Us,us.f=Gs,os.f=Hs,rs.f=as.f=qs,is.f=Ks,ms.f=function(e){return Vs(vs(e),e)},Ho&&(hs(Cs,"description",{configurable:!0,get:function(){return Ss(this).description}}),ls(Ts,"propertyIsEnumerable",js,{unsafe:!0}))),Vo({global:!0,constructor:!0,wrap:!0,forced:!qo,sham:!qo},{Symbol:Es}),ks(ns(Ps),(function(e){gs(e)})),Vo({target:Is,stat:!0,forced:!qo},{useSetter:function(){Bs=!0},useSimple:function(){Bs=!1}}),Vo({target:"Object",stat:!0,forced:!qo,sham:!Ho},{create:function(e,t){return void 0===t?ts(e):Gs(ts(e),t)},defineProperty:Us,defineProperties:Gs,getOwnPropertyDescriptor:Hs}),Vo({target:"Object",stat:!0,forced:!qo},{getOwnPropertyNames:qs}),ys(),bs(Es,Is),fs[ws]=!0;var Xs=Be&&!!Symbol.for&&!!Symbol.keyFor,Ys=La,Js=Ee,Zs=kt,Qs=Ya,$s=vt,eu=Xs,tu=$s("string-to-symbol-registry"),nu=$s("symbol-to-string-registry");Ys({target:"Symbol",stat:!0,forced:!eu},{for:function(e){var t=Qs(e);if(Zs(tu,t))return tu[t];var n=Js("Symbol")(t);return tu[t]=n,nu[n]=t,n}});var ru=La,au=kt,iu=He,ou=Ke,su=Xs,uu=vt("symbol-to-string-registry");ru({target:"Symbol",stat:!0,forced:!su},{keyFor:function(e){if(!iu(e))throw TypeError(ou(e)+" is not a symbol");if(au(uu,e))return uu[e]}});var cu=V,lu=Function.prototype,hu=lu.apply,pu=lu.call,fu="object"==("undefined"==typeof Reflect?"undefined":s(Reflect))&&Reflect.apply||(cu?pu.bind(hu):function(){return pu.apply(hu,arguments)}),du=ee([].slice),vu=co,mu=xe,gu=ae,yu=Ya,bu=ee([].push),xu=function(e){if(mu(e))return e;if(vu(e)){for(var t=e.length,n=[],r=0;r<t;r++){var a=e[r];"string"==typeof a?bu(n,a):"number"!=typeof a&&"Number"!=gu(a)&&"String"!=gu(a)||bu(n,yu(a))}var i=n.length,o=!0;return function(e,t){if(o)return o=!1,t;if(vu(this))return t;for(var r=0;r<i;r++)if(n[r]===e)return t}}},ku=La,wu=Ee,Iu=fu,Nu=j,Su=ee,Tu=B,Eu=xe,Cu=He,Au=du,Ru=xu,_u=Be,Ou=String,Fu=wu("JSON","stringify"),Du=Su(/./.exec),Mu=Su("".charAt),Lu=Su("".charCodeAt),zu=Su("".replace),Pu=Su(1..toString),Bu=/[\uD800-\uDFFF]/g,Wu=/^[\uD800-\uDBFF]$/,Vu=/^[\uDC00-\uDFFF]$/,Uu=!_u||Tu((function(){var e=wu("Symbol")();return"[null]"!=Fu([e])||"{}"!=Fu({a:e})||"{}"!=Fu(Object(e))})),Gu=Tu((function(){return'"\\udf06\\ud834"'!==Fu("\udf06\ud834")||'"\\udead"'!==Fu("\udead")})),ju=function(e,t){var n=Au(arguments),r=Ru(t);if(Eu(r)||void 0!==e&&!Cu(e))return n[1]=function(e,t){if(Eu(r)&&(t=Nu(r,this,Ou(e),t)),!Cu(t))return t},Iu(Fu,null,n)},Hu=function(e,t,n){var r=Mu(n,t-1),a=Mu(n,t+1);return Du(Wu,e)&&!Du(Vu,a)||Du(Vu,e)&&!Du(Wu,r)?"\\u"+Pu(Lu(e,0),16):e};Fu&&ku({target:"JSON",stat:!0,arity:3,forced:Uu||Gu},{stringify:function(e,t,n){var r=Au(arguments),a=Iu(Uu?ju:Fu,null,r);return Gu&&"string"==typeof a?zu(a,Bu,Hu):a}});var qu=ua,Ku=yt;La({target:"Object",stat:!0,forced:!Be||B((function(){qu.f(1)}))},{getOwnPropertySymbols:function(e){var t=qu.f;return t?t(Ku(e)):[]}});var Xu=La,Yu=W,Ju=ee,Zu=kt,Qu=xe,$u=Ce,ec=Ya,tc=zi,nc=ba,rc=z.Symbol,ac=rc&&rc.prototype;if(Yu&&Qu(rc)&&(!("description"in ac)||void 0!==rc().description)){var ic={},oc=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:ec(arguments[0]),t=$u(ac,this)?new rc(e):void 0===e?rc():rc(e);return""===e&&(ic[t]=!0),t};nc(oc,rc),oc.prototype=ac,ac.constructor=oc;var sc="Symbol(test)"==String(rc("test")),uc=Ju(ac.valueOf),cc=Ju(ac.toString),lc=/^Symbol\((.*)\)[^)]+$/,hc=Ju("".replace),pc=Ju("".slice);tc(ac,"description",{configurable:!0,get:function(){var e=uc(this);if(Zu(ic,e))return"";var t=cc(e),n=sc?pc(t,7,-1):hc(t,lc,"$1");return""===n?void 0:n}}),Xu({global:!0,constructor:!0,forced:!0},{Symbol:oc})}Hi("asyncIterator"),Hi("hasInstance"),Hi("isConcatSpreadable"),Hi("iterator"),Hi("match"),Hi("matchAll"),Hi("replace"),Hi("search"),Hi("species"),Hi("split");var fc=Ji;Hi("toPrimitive"),fc();var dc=Ee,vc=eo;Hi("toStringTag"),vc(dc("Symbol"),"Symbol"),Hi("unscopables");var mc=ee,gc=Ze,yc=function(e,t,n){try{return mc(gc(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}},bc=xe,xc=String,kc=TypeError,wc=function(e){if("object"==s(e)||bc(e))return e;throw kc("Can't set "+xc(e)+" as a prototype")},Ic=yc,Nc=dn,Sc=wc,Tc=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Ic(Object.prototype,"__proto__","set"))(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return Nc(n),Sc(r),t?e(n,r):n.__proto__=r,n}}():void 0),Ec=cn.f,Cc=function(e,t,n){n in e||Ec(e,n,{configurable:!0,get:function(){return t[n]},set:function(e){t[n]=e}})},Ac=xe,Rc=Ie,_c=Tc,Oc=function(e,t,n){var r,a;return _c&&Ac(r=t.constructor)&&r!==n&&Rc(a=r.prototype)&&a!==n.prototype&&_c(e,a),e},Fc=Ya,Dc=function(e,t){return void 0===e?arguments.length<2?"":t:Fc(e)},Mc=Ie,Lc=Cn,zc=function(e,t){Mc(t)&&"cause"in t&&Lc(e,"cause",t.cause)},Pc=Error,Bc=ee("".replace),Wc=String(Pc("zxcasd").stack),Vc=/\n\s*at [^:]*:[^\n]*/,Uc=Vc.test(Wc),Gc=function(e,t){if(Uc&&"string"==typeof e&&!Pc.prepareStackTrace)for(;t--;)e=Bc(e,Vc,"");return e},jc=Y,Hc=!B((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",jc(1,7)),7!==e.stack)})),qc=Cn,Kc=Gc,Xc=Hc,Yc=Error.captureStackTrace,Jc=function(e,t,n,r){Xc&&(Yc?Yc(e,t):qc(e,"stack",Kc(n,r)))},Zc=Ee,Qc=kt,$c=Cn,el=Ce,tl=Tc,nl=ba,rl=Cc,al=Oc,il=Dc,ol=zc,sl=Jc,ul=W,cl=function(e,t,n,r){var a="stackTraceLimit",i=r?2:1,o=e.split("."),s=o[o.length-1],u=Zc.apply(null,o);if(u){var c=u.prototype;if(Qc(c,"cause")&&delete c.cause,!n)return u;var l=Zc("Error"),h=t((function(e,t){var n=il(r?t:e,void 0),a=r?new u(e):new u;return void 0!==n&&$c(a,"message",n),sl(a,h,a.stack,2),this&&el(c,this)&&al(a,this,h),arguments.length>i&&ol(a,arguments[i]),a}));h.prototype=c,"Error"!==s?tl?tl(h,l):nl(h,l,{name:!0}):ul&&a in u&&(rl(h,u,a),rl(h,u,"prepareStackTrace")),nl(h,u);try{c.name!==s&&$c(c,"name",s),c.constructor=h}catch(e){}return h}},ll=La,hl=fu,pl=cl,fl="WebAssembly",dl=z.WebAssembly,vl=7!==Error("e",{cause:7}).cause,ml=function(e,t){var n={};n[e]=pl(e,t,vl),ll({global:!0,constructor:!0,arity:1,forced:vl},n)},gl=function(e,t){if(dl&&dl[e]){var n={};n[e]=pl("WebAssembly."+e,t,vl),ll({target:fl,stat:!0,constructor:!0,arity:1,forced:vl},n)}};ml("Error",(function(e){return function(t){return hl(e,this,arguments)}})),ml("EvalError",(function(e){return function(t){return hl(e,this,arguments)}})),ml("RangeError",(function(e){return function(t){return hl(e,this,arguments)}})),ml("ReferenceError",(function(e){return function(t){return hl(e,this,arguments)}})),ml("SyntaxError",(function(e){return function(t){return hl(e,this,arguments)}})),ml("TypeError",(function(e){return function(t){return hl(e,this,arguments)}})),ml("URIError",(function(e){return function(t){return hl(e,this,arguments)}})),gl("CompileError",(function(e){return function(t){return hl(e,this,arguments)}})),gl("LinkError",(function(e){return function(t){return hl(e,this,arguments)}})),gl("RuntimeError",(function(e){return function(t){return hl(e,this,arguments)}}));var yl=W,bl=B,xl=dn,kl=yi,wl=Dc,Il=Error.prototype.toString,Nl=bl((function(){if(yl){var e=kl(Object.defineProperty({},"name",{get:function(){return this===e}}));if("true"!==Il.call(e))return!0}return"2: 1"!==Il.call({message:1,name:2})||"Error"!==Il.call({})}))?function(){var e=xl(this),t=wl(e.name,"Error"),n=wl(e.message);return t?n?t+": "+n:t:n}:Il,Sl=Or,Tl=Nl,El=Error.prototype;El.toString!==Tl&&Sl(El,"toString",Tl);var Cl=!B((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Al=kt,Rl=xe,_l=yt,Ol=Cl,Fl=Xn("IE_PROTO"),Dl=Object,Ml=Dl.prototype,Ll=Ol?Dl.getPrototypeOf:function(e){var t=_l(e);if(Al(t,Fl))return t[Fl];var n=t.constructor;return Rl(n)&&t instanceof n?n.prototype:t instanceof Dl?Ml:null},zl={},Pl=zl,Bl=Mt("iterator"),Wl=Array.prototype,Vl=function(e){return void 0!==e&&(Pl.Array===e||Wl[Bl]===e)},Ul=qa,Gl=et,jl=le,Hl=zl,ql=Mt("iterator"),Kl=function(e){if(!jl(e))return Gl(e,ql)||Gl(e,"@@iterator")||Hl[Ul(e)]},Xl=j,Yl=Ze,Jl=dn,Zl=Ke,Ql=Kl,$l=TypeError,eh=function(e,t){var n=arguments.length<2?Ql(e):t;if(Yl(n))return Jl(Xl(n,e));throw $l(Zl(e)+" is not iterable")},th=j,nh=dn,rh=et,ah=function(e,t,n){var r,a;nh(e);try{if(!(r=rh(e,"return"))){if("throw"===t)throw n;return n}r=th(r,e)}catch(e){a=!0,r=e}if("throw"===t)throw n;if(a)throw r;return nh(r),n},ih=so,oh=j,sh=dn,uh=Ke,ch=Vl,lh=Kr,hh=Ce,ph=eh,fh=Kl,dh=ah,vh=TypeError,mh=function(e,t){this.stopped=e,this.result=t},gh=mh.prototype,yh=function(e,t,n){var r,a,i,o,u,c,l,h=n&&n.that,p=!(!n||!n.AS_ENTRIES),f=!(!n||!n.IS_RECORD),d=!(!n||!n.IS_ITERATOR),v=!(!n||!n.INTERRUPTED),m=ih(t,h),g=function(e){return r&&dh(r,"normal",e),new mh(!0,e)},y=function(e){return p?(sh(e),v?m(e[0],e[1],g):m(e[0],e[1])):v?m(e,g):m(e)};if(f)r=e.iterator;else if(d)r=e;else{if(!(a=fh(e)))throw vh(uh(e)+" is not iterable");if(ch(a)){for(i=0,o=lh(e);o>i;i++)if((u=y(e[i]))&&hh(gh,u))return u;return new mh(!1)}r=ph(e,a)}for(c=f?e.next:r.next;!(l=oh(c,r)).done;){try{u=y(l.value)}catch(e){dh(r,"throw",e)}if("object"==s(u)&&u&&hh(gh,u))return u}return new mh(!1)},bh=La,xh=Ce,kh=Ll,wh=Tc,Ih=ba,Nh=yi,Sh=Cn,Th=Y,Eh=zc,Ch=Jc,Ah=yh,Rh=Dc,_h=Mt("toStringTag"),Oh=Error,Fh=[].push,Dh=function(e,t){var n,r=xh(Mh,this);wh?n=wh(Oh(),r?kh(this):Mh):(n=r?this:Nh(Mh),Sh(n,_h,"Error")),void 0!==t&&Sh(n,"message",Rh(t)),Ch(n,Dh,n.stack,1),arguments.length>2&&Eh(n,arguments[2]);var a=[];return Ah(e,Fh,{that:a}),Sh(n,"errors",a),n};wh?wh(Dh,Oh):Ih(Dh,Oh,{name:!0});var Mh=Dh.prototype=Nh(Oh.prototype,{constructor:Th(1,Dh),message:Th(1,""),name:Th(1,"AggregateError")});bh({global:!0,constructor:!0,arity:2},{AggregateError:Dh});var Lh=La,zh=fu,Ph=B,Bh=cl,Wh="AggregateError",Vh=Ee(Wh),Uh=!Ph((function(){return 1!==Vh([1]).errors[0]}))&&Ph((function(){return 7!==Vh([1],Wh,{cause:7}).cause}));Lh({global:!0,constructor:!0,arity:2,forced:Uh},{AggregateError:Bh(Wh,(function(e){return function(t,n){return zh(e,this,arguments)}}),Uh,!0)});var Gh=Mt,jh=yi,Hh=cn.f,qh=Gh("unscopables"),Kh=Array.prototype;null==Kh[qh]&&Hh(Kh,qh,{configurable:!0,value:jh(null)});var Xh=function(e){Kh[qh][e]=!0},Yh=yt,Jh=Kr,Zh=Pr,Qh=Xh;La({target:"Array",proto:!0},{at:function(e){var t=Yh(this),n=Jh(t),r=Zh(e),a=r>=0?r:n+r;return a<0||a>=n?void 0:t[a]}}),Qh("at");var $h=TypeError,ep=function(e){if(e>9007199254740991)throw $h("Maximum allowed index exceeded");return e},tp=B,np=Le,rp=Mt("species"),ap=function(e){return np>=51||!tp((function(){var t=[];return(t.constructor={})[rp]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},ip=La,op=B,sp=co,up=Ie,cp=yt,lp=Kr,hp=ep,pp=Ii,fp=Oo,dp=ap,vp=Le,mp=Mt("isConcatSpreadable"),gp=vp>=51||!op((function(){var e=[];return e[mp]=!1,e.concat()[0]!==e})),yp=function(e){if(!up(e))return!1;var t=e[mp];return void 0!==t?!!t:sp(e)};ip({target:"Array",proto:!0,arity:1,forced:!gp||!dp("concat")},{concat:function(e){var t,n,r,a,i,o=cp(this),s=fp(o,0),u=0;for(t=-1,r=arguments.length;t<r;t++)if(yp(i=-1===t?o:arguments[t]))for(a=lp(i),hp(u+a),n=0;n<a;n++,u++)n in i&&pp(s,u,i[n]);else hp(u+1),pp(s,u++,i);return s.length=u,s}});var bp=Ke,xp=TypeError,kp=function(e,t){if(!delete e[t])throw xp("Cannot delete property "+bp(t)+" of "+bp(e))},wp=yt,Ip=Ur,Np=Kr,Sp=kp,Tp=Math.min,Ep=[].copyWithin||function(e,t){var n=wp(this),r=Np(n),a=Ip(e,r),i=Ip(t,r),o=arguments.length>2?arguments[2]:void 0,s=Tp((void 0===o?r:Ip(o,r))-i,r-a),u=1;for(i<a&&a<i+s&&(u=-1,i+=s-1,a+=s-1);s-- >0;)i in n?n[a]=n[i]:Sp(n,a),a+=u,i+=u;return n},Cp=Xh;La({target:"Array",proto:!0},{copyWithin:Ep}),Cp("copyWithin");var Ap=B,Rp=function(e,t){var n=[][e];return!!n&&Ap((function(){n.call(null,t||function(){return 1},1)}))},_p=Wo.every;La({target:"Array",proto:!0,forced:!Rp("every")},{every:function(e){return _p(this,e,arguments.length>1?arguments[1]:void 0)}});var Op=yt,Fp=Ur,Dp=Kr,Mp=function(e){for(var t=Op(this),n=Dp(t),r=arguments.length,a=Fp(r>1?arguments[1]:void 0,n),i=r>2?arguments[2]:void 0,o=void 0===i?n:Fp(i,n);o>a;)t[a++]=e;return t},Lp=Xh;La({target:"Array",proto:!0},{fill:Mp}),Lp("fill");var zp=Wo.filter;La({target:"Array",proto:!0,forced:!ap("filter")},{filter:function(e){return zp(this,e,arguments.length>1?arguments[1]:void 0)}});var Pp=La,Bp=Wo.find,Wp=Xh,Vp="find",Up=!0;Vp in[]&&Array(1).find((function(){Up=!1})),Pp({target:"Array",proto:!0,forced:Up},{find:function(e){return Bp(this,e,arguments.length>1?arguments[1]:void 0)}}),Wp(Vp);var Gp=La,jp=Wo.findIndex,Hp=Xh,qp="findIndex",Kp=!0;qp in[]&&Array(1).findIndex((function(){Kp=!1})),Gp({target:"Array",proto:!0,forced:Kp},{findIndex:function(e){return jp(this,e,arguments.length>1?arguments[1]:void 0)}}),Hp(qp);var Xp=so,Yp=ce,Jp=yt,Zp=Kr,Qp=function(e){var t=1==e;return function(n,r,a){for(var i,o=Jp(n),s=Yp(o),u=Xp(r,a),c=Zp(s);c-- >0;)if(u(i=s[c],c,o))switch(e){case 0:return i;case 1:return c}return t?-1:void 0}},$p={findLast:Qp(0),findLastIndex:Qp(1)},ef=$p.findLast,tf=Xh;La({target:"Array",proto:!0},{findLast:function(e){return ef(this,e,arguments.length>1?arguments[1]:void 0)}}),tf("findLast");var nf=$p.findLastIndex,rf=Xh;La({target:"Array",proto:!0},{findLastIndex:function(e){return nf(this,e,arguments.length>1?arguments[1]:void 0)}}),rf("findLastIndex");var af=co,of=Kr,sf=ep,uf=so,cf=function e(t,n,r,a,i,o,s,u){for(var c,l=i,h=0,p=!!s&&uf(s,u);h<a;)h in r&&(c=p?p(r[h],h,n):r[h],o>0&&af(c)?l=e(t,n,c,of(c),l,o-1)-1:(sf(l+1),t[l]=c),l++),h++;return l},lf=cf,hf=yt,pf=Kr,ff=Pr,df=Oo;La({target:"Array",proto:!0},{flat:function(){var e=arguments.length?arguments[0]:void 0,t=hf(this),n=pf(t),r=df(t,0);return r.length=lf(r,t,t,n,0,void 0===e?1:ff(e)),r}});var vf=cf,mf=Ze,gf=yt,yf=Kr,bf=Oo;La({target:"Array",proto:!0},{flatMap:function(e){var t,n=gf(this),r=yf(n);return mf(e),(t=bf(n,0)).length=vf(t,n,n,r,0,1,e,arguments.length>1?arguments[1]:void 0),t}});var xf=Wo.forEach,kf=Rp("forEach")?[].forEach:function(e){return xf(this,e,arguments.length>1?arguments[1]:void 0)};La({target:"Array",proto:!0,forced:[].forEach!=kf},{forEach:kf});var wf=dn,If=ah,Nf=function(e,t,n,r){try{return r?t(wf(n)[0],n[1]):t(n)}catch(t){If(e,"throw",t)}},Sf=so,Tf=j,Ef=yt,Cf=Nf,Af=Vl,Rf=No,_f=Kr,Of=Ii,Ff=eh,Df=Kl,Mf=Array,Lf=function(e){var t=Ef(e),n=Rf(this),r=arguments.length,a=r>1?arguments[1]:void 0,i=void 0!==a;i&&(a=Sf(a,r>2?arguments[2]:void 0));var o,s,u,c,l,h,p=Df(t),f=0;if(!p||this===Mf&&Af(p))for(o=_f(t),s=n?new this(o):Mf(o);o>f;f++)h=i?a(t[f],f):t[f],Of(s,f,h);else for(l=(c=Ff(t,p)).next,s=n?new this:[];!(u=Tf(l,c)).done;f++)h=i?Cf(c,a,[u.value,f],!0):u.value,Of(s,f,h);return s.length=f,s},zf=Mt("iterator"),Pf=!1;try{var Bf=0,Wf={next:function(){return{done:!!Bf++}},return:function(){Pf=!0}};Wf[zf]=function(){return this},Array.from(Wf,(function(){throw 2}))}catch(e){}var Vf=function(e,t){if(!t&&!Pf)return!1;var n=!1;try{var r={};r[zf]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(e){}return n},Uf=Lf;La({target:"Array",stat:!0,forced:!Vf((function(e){Array.from(e)}))},{from:Uf});var Gf=Qr.includes,jf=Xh;La({target:"Array",proto:!0,forced:B((function(){return!Array(1).includes()}))},{includes:function(e){return Gf(this,e,arguments.length>1?arguments[1]:void 0)}}),jf("includes");var Hf=La,qf=Qr.indexOf,Kf=Rp,Xf=ro([].indexOf),Yf=!!Xf&&1/Xf([1],1,-0)<0;Hf({target:"Array",proto:!0,forced:Yf||!Kf("indexOf")},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Yf?Xf(this,e,t)||0:qf(this,e,t)}}),La({target:"Array",stat:!0},{isArray:co});var Jf,Zf,Qf,$f=B,ed=xe,td=Ie,nd=Ll,rd=Or,ad=Mt("iterator"),id=!1;[].keys&&("next"in(Qf=[].keys())?(Zf=nd(nd(Qf)))!==Object.prototype&&(Jf=Zf):id=!0);var od=!td(Jf)||$f((function(){var e={};return Jf[ad].call(e)!==e}));od&&(Jf={}),ed(Jf[ad])||rd(Jf,ad,(function(){return this}));var sd={IteratorPrototype:Jf,BUGGY_SAFARI_ITERATORS:id},ud=sd.IteratorPrototype,cd=yi,ld=Y,hd=eo,pd=zl,fd=function(){return this},dd=function(e,t,n,r){var a=t+" Iterator";return e.prototype=cd(ud,{next:ld(+!r,n)}),hd(e,a,!1,!0),pd[a]=fd,e},vd=La,md=j,gd=xe,yd=dd,bd=Ll,xd=Tc,kd=eo,wd=Cn,Id=Or,Nd=zl,Sd=Mn.PROPER,Td=Mn.CONFIGURABLE,Ed=sd.IteratorPrototype,Cd=sd.BUGGY_SAFARI_ITERATORS,Ad=Mt("iterator"),Rd="keys",_d="values",Od="entries",Fd=function(){return this},Dd=function(e,t,n,r,a,i,o){yd(n,t,r);var s,u,c,l=function(e){if(e===a&&v)return v;if(!Cd&&e in f)return f[e];switch(e){case Rd:case _d:case Od:return function(){return new n(this,e)}}return function(){return new n(this)}},h=t+" Iterator",p=!1,f=e.prototype,d=f[Ad]||f["@@iterator"]||a&&f[a],v=!Cd&&d||l(a),m="Array"==t&&f.entries||d;if(m&&(s=bd(m.call(new e)))!==Object.prototype&&s.next&&(bd(s)!==Ed&&(xd?xd(s,Ed):gd(s[Ad])||Id(s,Ad,Fd)),kd(s,h,!0,!0)),Sd&&a==_d&&d&&d.name!==_d&&(Td?wd(f,"name",_d):(p=!0,v=function(){return md(d,this)})),a)if(u={values:l(_d),keys:i?v:l(Rd),entries:l(Od)},o)for(c in u)(Cd||p||!(c in f))&&Id(f,c,u[c]);else vd({target:t,proto:!0,forced:Cd||p},u);return f[Ad]!==v&&Id(f,Ad,v,{name:a}),Nd[t]=v,u},Md=function(e,t){return{value:e,done:t}},Ld=me,zd=Xh,Pd=zl,Bd=cr,Wd=cn.f,Vd=Dd,Ud=Md,Gd=W,jd="Array Iterator",Hd=Bd.set,qd=Bd.getterFor(jd),Kd=Vd(Array,"Array",(function(e,t){Hd(this,{type:jd,target:Ld(e),index:0,kind:t})}),(function(){var e=qd(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,Ud(void 0,!0)):Ud("keys"==n?r:"values"==n?t[r]:[r,t[r]],!1)}),"values"),Xd=Pd.Arguments=Pd.Array;if(zd("keys"),zd("values"),zd("entries"),Gd&&"values"!==Xd.name)try{Wd(Xd,"name",{value:"values"})}catch(e){}var Yd=La,Jd=ce,Zd=me,Qd=Rp,$d=ee([].join);Yd({target:"Array",proto:!0,forced:Jd!=Object||!Qd("join",",")},{join:function(e){return $d(Zd(this),void 0===e?",":e)}});var ev=fu,tv=me,nv=Pr,rv=Kr,av=Rp,iv=Math.min,ov=[].lastIndexOf,sv=!!ov&&1/[1].lastIndexOf(1,-0)<0,uv=av("lastIndexOf"),cv=sv||!uv?function(e){if(sv)return ev(ov,this,arguments)||0;var t=tv(this),n=rv(t),r=n-1;for(arguments.length>1&&(r=iv(r,nv(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:ov;La({target:"Array",proto:!0,forced:cv!==[].lastIndexOf},{lastIndexOf:cv});var lv=Wo.map;La({target:"Array",proto:!0,forced:!ap("map")},{map:function(e){return lv(this,e,arguments.length>1?arguments[1]:void 0)}});var hv=No,pv=Ii,fv=Array;La({target:"Array",stat:!0,forced:B((function(){function e(){}return!(fv.of.call(e)instanceof e)}))},{of:function(){for(var e=0,t=arguments.length,n=new(hv(this)?this:fv)(t);t>e;)pv(n,e,arguments[e++]);return n.length=t,n}});var dv=W,vv=co,mv=TypeError,gv=Object.getOwnPropertyDescriptor,yv=dv&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}()?function(e,t){if(vv(e)&&!gv(e,"length").writable)throw mv("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},bv=yt,xv=Kr,kv=yv,wv=ep;La({target:"Array",proto:!0,arity:1,forced:B((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=bv(this),n=xv(t),r=arguments.length;wv(n+r);for(var a=0;a<r;a++)t[n]=arguments[a],n++;return kv(t,n),n}});var Iv=Ze,Nv=yt,Sv=ce,Tv=Kr,Ev=TypeError,Cv=function(e){return function(t,n,r,a){Iv(n);var i=Nv(t),o=Sv(i),s=Tv(i),u=e?s-1:0,c=e?-1:1;if(r<2)for(;;){if(u in o){a=o[u],u+=c;break}if(u+=c,e?u<0:s<=u)throw Ev("Reduce of empty array with no initial value")}for(;e?u>=0:s>u;u+=c)u in o&&(a=n(a,o[u],u,i));return a}},Av={left:Cv(!1),right:Cv(!0)},Rv="undefined"!=typeof process&&"process"==ae(process),_v=Av.left;La({target:"Array",proto:!0,forced:!Rv&&Le>79&&Le<83||!Rp("reduce")},{reduce:function(e){var t=arguments.length;return _v(this,e,t,t>1?arguments[1]:void 0)}});var Ov=Av.right;La({target:"Array",proto:!0,forced:!Rv&&Le>79&&Le<83||!Rp("reduceRight")},{reduceRight:function(e){return Ov(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var Fv=La,Dv=co,Mv=ee([].reverse),Lv=[1,2];Fv({target:"Array",proto:!0,forced:String(Lv)===String(Lv.reverse())},{reverse:function(){return Dv(this)&&(this.length=this.length),Mv(this)}});var zv=La,Pv=co,Bv=No,Wv=Ie,Vv=Ur,Uv=Kr,Gv=me,jv=Ii,Hv=Mt,qv=du,Kv=ap("slice"),Xv=Hv("species"),Yv=Array,Jv=Math.max;zv({target:"Array",proto:!0,forced:!Kv},{slice:function(e,t){var n,r,a,i=Gv(this),o=Uv(i),s=Vv(e,o),u=Vv(void 0===t?o:t,o);if(Pv(i)&&(n=i.constructor,(Bv(n)&&(n===Yv||Pv(n.prototype))||Wv(n)&&null===(n=n[Xv]))&&(n=void 0),n===Yv||void 0===n))return qv(i,s,u);for(r=new(void 0===n?Yv:n)(Jv(u-s,0)),a=0;s<u;s++,a++)s in i&&jv(r,a,i[s]);return r.length=a,r}});var Zv=Wo.some;La({target:"Array",proto:!0,forced:!Rp("some")},{some:function(e){return Zv(this,e,arguments.length>1?arguments[1]:void 0)}});var Qv=Ai,$v=Math.floor,em=function(e,t){for(var n,r,a=e.length,i=1;i<a;){for(r=i,n=e[i];r&&t(e[r-1],n)>0;)e[r]=e[--r];r!==i++&&(e[r]=n)}return e},tm=function(e,t,n,r){for(var a=t.length,i=n.length,o=0,s=0;o<a||s<i;)e[o+s]=o<a&&s<i?r(t[o],n[s])<=0?t[o++]:n[s++]:o<a?t[o++]:n[s++];return e},nm=function e(t,n){var r=t.length,a=$v(r/2);return r<8?em(t,n):tm(t,e(Qv(t,0,a),n),e(Qv(t,a),n),n)},rm=Ae.match(/firefox\/(\d+)/i),am=!!rm&&+rm[1],im=/MSIE|Trident/.test(Ae),om=Ae.match(/AppleWebKit\/(\d+)\./),sm=!!om&&+om[1],um=La,cm=ee,lm=Ze,hm=yt,pm=Kr,fm=kp,dm=Ya,vm=B,mm=nm,gm=Rp,ym=am,bm=im,xm=Le,km=sm,wm=[],Im=cm(wm.sort),Nm=cm(wm.push),Sm=vm((function(){wm.sort(void 0)})),Tm=vm((function(){wm.sort(null)})),Em=gm("sort"),Cm=!vm((function(){if(xm)return xm<70;if(!(ym&&ym>3)){if(bm)return!0;if(km)return km<603;var e,t,n,r,a="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:n=3;break;case 68:case 71:n=4;break;default:n=2}for(r=0;r<47;r++)wm.push({k:t+r,v:n})}for(wm.sort((function(e,t){return t.v-e.v})),r=0;r<wm.length;r++)t=wm[r].k.charAt(0),a.charAt(a.length-1)!==t&&(a+=t);return"DGBEFHACIJK"!==a}}));um({target:"Array",proto:!0,forced:Sm||!Tm||!Em||!Cm},{sort:function(e){void 0!==e&&lm(e);var t=hm(this);if(Cm)return void 0===e?Im(t):Im(t,e);var n,r,a=[],i=pm(t);for(r=0;r<i;r++)r in t&&Nm(a,t[r]);for(mm(a,function(e){return function(t,n){return void 0===n?-1:void 0===t?1:void 0!==e?+e(t,n)||0:dm(t)>dm(n)?1:-1}}(e)),n=pm(a),r=0;r<n;)t[r]=a[r++];for(;r<i;)fm(t,r++);return t}});var Am=Ee,Rm=zi,_m=W,Om=Mt("species"),Fm=function(e){var t=Am(e);_m&&t&&!t[Om]&&Rm(t,Om,{configurable:!0,get:function(){return this}})};Fm("Array");var Dm=La,Mm=yt,Lm=Ur,zm=Pr,Pm=Kr,Bm=yv,Wm=ep,Vm=Oo,Um=Ii,Gm=kp,jm=ap("splice"),Hm=Math.max,qm=Math.min;Dm({target:"Array",proto:!0,forced:!jm},{splice:function(e,t){var n,r,a,i,o,s,u=Mm(this),c=Pm(u),l=Lm(e,c),h=arguments.length;for(0===h?n=r=0:1===h?(n=0,r=c-l):(n=h-2,r=qm(Hm(zm(t),0),c-l)),Wm(c+n-r),a=Vm(u,r),i=0;i<r;i++)(o=l+i)in u&&Um(a,i,u[o]);if(a.length=r,n<r){for(i=l;i<c-r;i++)s=i+n,(o=i+r)in u?u[s]=u[o]:Gm(u,s);for(i=c;i>c-r+n;i--)Gm(u,i-1)}else if(n>r)for(i=c-r;i>l;i--)s=i+n-1,(o=i+r-1)in u?u[s]=u[o]:Gm(u,s);for(i=0;i<n;i++)u[i+l]=arguments[i+2];return Bm(u,c-r+n),a}});var Km=Kr,Xm=function(e,t){for(var n=Km(e),r=new t(n),a=0;a<n;a++)r[a]=e[n-a-1];return r},Ym=Xm,Jm=me,Zm=Xh,Qm=Array;La({target:"Array",proto:!0},{toReversed:function(){return Ym(Jm(this),Qm)}}),Zm("toReversed");var $m=Kr,eg=function(e,t){for(var n=0,r=$m(t),a=new e(r);r>n;)a[n]=t[n++];return a},tg=z,ng=function(e){return tg[e].prototype},rg=La,ag=Ze,ig=me,og=eg,sg=Xh,ug=Array,cg=ee(ng("Array").sort);rg({target:"Array",proto:!0},{toSorted:function(e){void 0!==e&&ag(e);var t=ig(this),n=og(ug,t);return cg(n,e)}}),sg("toSorted");var lg=La,hg=Xh,pg=ep,fg=Kr,dg=Ur,vg=me,mg=Pr,gg=Array,yg=Math.max,bg=Math.min;lg({target:"Array",proto:!0},{toSpliced:function(e,t){var n,r,a,i,o=vg(this),s=fg(o),u=dg(e,s),c=arguments.length,l=0;for(0===c?n=r=0:1===c?(n=0,r=s-u):(n=c-2,r=bg(yg(mg(t),0),s-u)),a=pg(s+n-r),i=gg(a);l<u;l++)i[l]=o[l];for(;l<u+n;l++)i[l]=arguments[l-u+2];for(;l<a;l++)i[l]=o[l+r-n];return i}}),hg("toSpliced"),Xh("flat"),Xh("flatMap");var xg=yt,kg=Kr,wg=yv,Ig=kp,Ng=ep;La({target:"Array",proto:!0,arity:1,forced:1!==[].unshift(0)||!function(){try{Object.defineProperty([],"length",{writable:!1}).unshift()}catch(e){return e instanceof TypeError}}()},{unshift:function(e){var t=xg(this),n=kg(t),r=arguments.length;if(r){Ng(n+r);for(var a=n;a--;){var i=a+r;a in t?t[i]=t[a]:Ig(t,i)}for(var o=0;o<r;o++)t[o]=arguments[o]}return wg(t,n+r)}});var Sg=Kr,Tg=Pr,Eg=RangeError,Cg=function(e,t,n,r){var a=Sg(e),i=Tg(n),o=i<0?a+i:i;if(o>=a||o<0)throw Eg("Incorrect index");for(var s=new t(a),u=0;u<a;u++)s[u]=u===o?r:e[u];return s},Ag=Cg,Rg=me,_g=Array;La({target:"Array",proto:!0},{with:function(e,t){return Ag(Rg(this),_g,e,t)}});var Og="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,Fg=Or,Dg=function(e,t,n){for(var r in t)Fg(e,r,t[r],n);return e},Mg=Ce,Lg=TypeError,zg=function(e,t){if(Mg(t,e))return e;throw Lg("Incorrect invocation")},Pg=Pr,Bg=Hr,Wg=RangeError,Vg=function(e){if(void 0===e)return 0;var t=Pg(e),n=Bg(t);if(t!==n)throw Wg("Wrong length or index");return n},Ug=Array,Gg=Math.abs,jg=Math.pow,Hg=Math.floor,qg=Math.log,Kg=Math.LN2,Xg={pack:function(e,t,n){var r,a,i,o=Ug(n),s=8*n-t-1,u=(1<<s)-1,c=u>>1,l=23===t?jg(2,-24)-jg(2,-77):0,h=e<0||0===e&&1/e<0?1:0,p=0;for((e=Gg(e))!=e||e===1/0?(a=e!=e?1:0,r=u):(r=Hg(qg(e)/Kg),e*(i=jg(2,-r))<1&&(r--,i*=2),(e+=r+c>=1?l/i:l*jg(2,1-c))*i>=2&&(r++,i/=2),r+c>=u?(a=0,r=u):r+c>=1?(a=(e*i-1)*jg(2,t),r+=c):(a=e*jg(2,c-1)*jg(2,t),r=0));t>=8;)o[p++]=255&a,a/=256,t-=8;for(r=r<<t|a,s+=t;s>0;)o[p++]=255&r,r/=256,s-=8;return o[--p]|=128*h,o},unpack:function(e,t){var n,r=e.length,a=8*r-t-1,i=(1<<a)-1,o=i>>1,s=a-7,u=r-1,c=e[u--],l=127&c;for(c>>=7;s>0;)l=256*l+e[u--],s-=8;for(n=l&(1<<-s)-1,l>>=-s,s+=t;s>0;)n=256*n+e[u--],s-=8;if(0===l)l=1-o;else{if(l===i)return n?NaN:c?-1/0:1/0;n+=jg(2,t),l-=o}return(c?-1:1)*n*jg(2,l-t)}},Yg=z,Jg=ee,Zg=W,Qg=Og,$g=Mn,ey=Cn,ty=zi,ny=Dg,ry=B,ay=zg,iy=Pr,oy=Hr,sy=Vg,uy=Xg,cy=Ll,ly=Tc,hy=Fr.f,py=Mp,fy=Ai,dy=eo,vy=cr,my=$g.PROPER,gy=$g.CONFIGURABLE,yy="ArrayBuffer",by="DataView",xy="Wrong index",ky=vy.getterFor(yy),wy=vy.getterFor(by),Iy=vy.set,Ny=Yg.ArrayBuffer,Sy=Ny,Ty=Sy&&Sy.prototype,Ey=Yg.DataView,Cy=Ey&&Ey.prototype,Ay=Object.prototype,Ry=Yg.Array,_y=Yg.RangeError,Oy=Jg(py),Fy=Jg([].reverse),Dy=uy.pack,My=uy.unpack,Ly=function(e){return[255&e]},zy=function(e){return[255&e,e>>8&255]},Py=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},By=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},Wy=function(e){return Dy(e,23,4)},Vy=function(e){return Dy(e,52,8)},Uy=function(e,t,n){ty(e.prototype,t,{configurable:!0,get:function(){return n(this)[t]}})},Gy=function(e,t,n,r){var a=sy(n),i=wy(e);if(a+t>i.byteLength)throw _y(xy);var o=i.bytes,s=a+i.byteOffset,u=fy(o,s,s+t);return r?u:Fy(u)},jy=function(e,t,n,r,a,i){var o=sy(n),s=wy(e);if(o+t>s.byteLength)throw _y(xy);for(var u=s.bytes,c=o+s.byteOffset,l=r(+a),h=0;h<t;h++)u[c+h]=l[i?h:t-h-1]};if(Qg){var Hy=my&&Ny.name!==yy;if(ry((function(){Ny(1)}))&&ry((function(){new Ny(-1)}))&&!ry((function(){return new Ny,new Ny(1.5),new Ny(NaN),1!=Ny.length||Hy&&!gy})))Hy&&gy&&ey(Ny,"name",yy);else{(Sy=function(e){return ay(this,Ty),new Ny(sy(e))}).prototype=Ty;for(var qy,Ky=hy(Ny),Xy=0;Ky.length>Xy;)(qy=Ky[Xy++])in Sy||ey(Sy,qy,Ny[qy]);Ty.constructor=Sy}ly&&cy(Cy)!==Ay&&ly(Cy,Ay);var Yy=new Ey(new Sy(2)),Jy=Jg(Cy.setInt8);Yy.setInt8(0,2147483648),Yy.setInt8(1,2147483649),!Yy.getInt8(0)&&Yy.getInt8(1)||ny(Cy,{setInt8:function(e,t){Jy(this,e,t<<24>>24)},setUint8:function(e,t){Jy(this,e,t<<24>>24)}},{unsafe:!0})}else Ty=(Sy=function(e){ay(this,Ty);var t=sy(e);Iy(this,{type:yy,bytes:Oy(Ry(t),0),byteLength:t}),Zg||(this.byteLength=t,this.detached=!1)}).prototype,Ey=function(e,t,n){ay(this,Cy),ay(e,Ty);var r=ky(e),a=r.byteLength,i=iy(t);if(i<0||i>a)throw _y("Wrong offset");if(i+(n=void 0===n?a-i:oy(n))>a)throw _y("Wrong length");Iy(this,{type:by,buffer:e,byteLength:n,byteOffset:i,bytes:r.bytes}),Zg||(this.buffer=e,this.byteLength=n,this.byteOffset=i)},Cy=Ey.prototype,Zg&&(Uy(Sy,"byteLength",ky),Uy(Ey,"buffer",wy),Uy(Ey,"byteLength",wy),Uy(Ey,"byteOffset",wy)),ny(Cy,{getInt8:function(e){return Gy(this,1,e)[0]<<24>>24},getUint8:function(e){return Gy(this,1,e)[0]},getInt16:function(e){var t=Gy(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=Gy(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return By(Gy(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return By(Gy(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return My(Gy(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return My(Gy(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){jy(this,1,e,Ly,t)},setUint8:function(e,t){jy(this,1,e,Ly,t)},setInt16:function(e,t){jy(this,2,e,zy,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){jy(this,2,e,zy,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){jy(this,4,e,Py,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){jy(this,4,e,Py,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){jy(this,4,e,Wy,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){jy(this,8,e,Vy,t,arguments.length>2?arguments[2]:void 0)}});dy(Sy,yy),dy(Ey,by);var Zy={ArrayBuffer:Sy,DataView:Ey},Qy=Fm,$y="ArrayBuffer",eb=Zy.ArrayBuffer;La({global:!0,constructor:!0,forced:z.ArrayBuffer!==eb},{ArrayBuffer:eb}),Qy($y);var tb,nb,rb,ab=Og,ib=W,ob=z,sb=xe,ub=Ie,cb=kt,lb=qa,hb=Ke,pb=Cn,fb=Or,db=zi,vb=Ce,mb=Ll,gb=Tc,yb=Mt,bb=Tt,xb=cr.enforce,kb=cr.get,wb=ob.Int8Array,Ib=wb&&wb.prototype,Nb=ob.Uint8ClampedArray,Sb=Nb&&Nb.prototype,Tb=wb&&mb(wb),Eb=Ib&&mb(Ib),Cb=Object.prototype,Ab=ob.TypeError,Rb=yb("toStringTag"),_b=bb("TYPED_ARRAY_TAG"),Ob="TypedArrayConstructor",Fb=ab&&!!gb&&"Opera"!==lb(ob.opera),Db=!1,Mb={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Lb={BigInt64Array:8,BigUint64Array:8},zb=function(e){if(!ub(e))return!1;var t=lb(e);return cb(Mb,t)||cb(Lb,t)};for(tb in Mb)(rb=(nb=ob[tb])&&nb.prototype)?xb(rb).TypedArrayConstructor=nb:Fb=!1;for(tb in Lb)(rb=(nb=ob[tb])&&nb.prototype)&&(xb(rb).TypedArrayConstructor=nb);if((!Fb||!sb(Tb)||Tb===Function.prototype)&&(Tb=function(){throw Ab("Incorrect invocation")},Fb))for(tb in Mb)ob[tb]&&gb(ob[tb],Tb);if((!Fb||!Eb||Eb===Cb)&&(Eb=Tb.prototype,Fb))for(tb in Mb)ob[tb]&&gb(ob[tb].prototype,Eb);if(Fb&&mb(Sb)!==Eb&&gb(Sb,Eb),ib&&!cb(Eb,Rb))for(tb in Db=!0,db(Eb,Rb,{configurable:!0,get:function(){return ub(this)?this[_b]:void 0}}),Mb)ob[tb]&&pb(ob[tb],_b,tb);var Pb={NATIVE_ARRAY_BUFFER_VIEWS:Fb,TYPED_ARRAY_TAG:Db&&_b,aTypedArray:function(e){if(zb(e))return e;throw Ab("Target is not a typed array")},aTypedArrayConstructor:function(e){if(sb(e)&&(!gb||vb(Tb,e)))return e;throw Ab(hb(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n,r){if(ib){if(n)for(var a in Mb){var i=ob[a];if(i&&cb(i.prototype,e))try{delete i.prototype[e]}catch(n){try{i.prototype[e]=t}catch(e){}}}Eb[e]&&!n||fb(Eb,e,n?t:Fb&&Ib[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,n){var r,a;if(ib){if(gb){if(n)for(r in Mb)if((a=ob[r])&&cb(a,e))try{delete a[e]}catch(e){}if(Tb[e]&&!n)return;try{return fb(Tb,e,n?t:Fb&&Tb[e]||t)}catch(e){}}for(r in Mb)!(a=ob[r])||a[e]&&!n||fb(a,e,t)}},getTypedArrayConstructor:function e(t){var n=mb(t);if(ub(n)){var r=kb(n);return r&&cb(r,Ob)?r.TypedArrayConstructor:e(n)}},isView:function(e){if(!ub(e))return!1;var t=lb(e);return"DataView"===t||cb(Mb,t)||cb(Lb,t)},isTypedArray:zb,TypedArray:Tb,TypedArrayPrototype:Eb};La({target:"ArrayBuffer",stat:!0,forced:!Pb.NATIVE_ARRAY_BUFFER_VIEWS},{isView:Pb.isView});var Bb=No,Wb=Ke,Vb=TypeError,Ub=function(e){if(Bb(e))return e;throw Vb(Wb(e)+" is not a constructor")},Gb=dn,jb=Ub,Hb=le,qb=Mt("species"),Kb=function(e,t){var n,r=Gb(e).constructor;return void 0===r||Hb(n=Gb(r)[qb])?t:jb(n)},Xb=La,Yb=ro,Jb=B,Zb=dn,Qb=Ur,$b=Hr,ex=Kb,tx=Zy.ArrayBuffer,nx=Zy.DataView,rx=nx.prototype,ax=Yb(tx.prototype.slice),ix=Yb(rx.getUint8),ox=Yb(rx.setUint8);Xb({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:Jb((function(){return!new tx(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(ax&&void 0===t)return ax(Zb(this),e);for(var n=Zb(this).byteLength,r=Qb(e,n),a=Qb(void 0===t?n:t,n),i=new(ex(this,tx))($b(a-r)),o=new nx(this),s=new nx(i),u=0;r<a;)ox(s,u++,ix(o,r++));return i}}),La({global:!0,constructor:!0,forced:!Og},{DataView:Zy.DataView});var sx=La,ux=ee,cx=B((function(){return 120!==new Date(16e11).getYear()})),lx=ux(Date.prototype.getFullYear);sx({target:"Date",proto:!0,forced:cx},{getYear:function(){return lx(this)-1900}});var hx=La,px=Date,fx=ee(px.prototype.getTime);hx({target:"Date",stat:!0},{now:function(){return fx(new px)}});var dx=La,vx=ee,mx=Pr,gx=Date.prototype,yx=vx(gx.getTime),bx=vx(gx.setFullYear);dx({target:"Date",proto:!0},{setYear:function(e){yx(this);var t=mx(e);return bx(this,0<=t&&t<=99?t+1900:t)}}),La({target:"Date",proto:!0},{toGMTString:Date.prototype.toUTCString});var xx=Pr,kx=Ya,wx=fe,Ix=RangeError,Nx=function(e){var t=kx(wx(this)),n="",r=xx(e);if(r<0||r==1/0)throw Ix("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n},Sx=ee,Tx=Hr,Ex=Ya,Cx=fe,Ax=Sx(Nx),Rx=Sx("".slice),_x=Math.ceil,Ox=function(e){return function(t,n,r){var a,i,o=Ex(Cx(t)),s=Tx(n),u=o.length,c=void 0===r?" ":Ex(r);return s<=u||""==c?o:((i=Ax(c,_x((a=s-u)/c.length))).length>a&&(i=Rx(i,0,a)),e?o+i:i+o)}},Fx={start:Ox(!1),end:Ox(!0)},Dx=ee,Mx=B,Lx=Fx.start,zx=RangeError,Px=isFinite,Bx=Math.abs,Wx=Date.prototype,Vx=Wx.toISOString,Ux=Dx(Wx.getTime),Gx=Dx(Wx.getUTCDate),jx=Dx(Wx.getUTCFullYear),Hx=Dx(Wx.getUTCHours),qx=Dx(Wx.getUTCMilliseconds),Kx=Dx(Wx.getUTCMinutes),Xx=Dx(Wx.getUTCMonth),Yx=Dx(Wx.getUTCSeconds),Jx=Mx((function(){return"0385-07-25T07:06:39.999Z"!=Vx.call(new Date(-50000000000001))}))||!Mx((function(){Vx.call(new Date(NaN))}))?function(){if(!Px(Ux(this)))throw zx("Invalid time value");var e=this,t=jx(e),n=qx(e),r=t<0?"-":t>9999?"+":"";return r+Lx(Bx(t),r?6:4,0)+"-"+Lx(Xx(e)+1,2,0)+"-"+Lx(Gx(e),2,0)+"T"+Lx(Hx(e),2,0)+":"+Lx(Kx(e),2,0)+":"+Lx(Yx(e),2,0)+"."+Lx(n,3,0)+"Z"}:Vx,Zx=Jx;La({target:"Date",proto:!0,forced:Date.prototype.toISOString!==Zx},{toISOString:Zx});var Qx=yt,$x=Gt;La({target:"Date",proto:!0,arity:1,forced:B((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}))},{toJSON:function(e){var t=Qx(this),n=$x(t,"number");return"number"!=typeof n||isFinite(n)?t.toISOString():null}});var ek=dn,tk=it,nk=TypeError,rk=function(e){if(ek(this),"string"===e||"default"===e)e="string";else if("number"!==e)throw nk("Incorrect hint");return tk(this,e)},ak=kt,ik=Or,ok=rk,sk=Mt("toPrimitive"),uk=Date.prototype;ak(uk,sk)||ik(uk,sk,ok);var ck=ee,lk=Or,hk=Date.prototype,pk="Invalid Date",fk="toString",dk=ck(hk.toString),vk=ck(hk.getTime);String(new Date(NaN))!=pk&&lk(hk,fk,(function(){var e=vk(this);return e==e?dk(this):pk}));var mk=La,gk=ee,yk=Ya,bk=gk("".charAt),xk=gk("".charCodeAt),kk=gk(/./.exec),wk=gk(1..toString),Ik=gk("".toUpperCase),Nk=/[\w*+\-./@]/,Sk=function(e,t){for(var n=wk(e,16);n.length<t;)n="0"+n;return n};mk({global:!0},{escape:function(e){for(var t,n,r=yk(e),a="",i=r.length,o=0;o<i;)t=bk(r,o++),kk(Nk,t)?a+=t:a+=(n=xk(t,0))<256?"%"+Sk(n,2):"%u"+Ik(Sk(n,4));return a}});var Tk=ee,Ek=Ze,Ck=Ie,Ak=kt,Rk=du,_k=V,Ok=Function,Fk=Tk([].concat),Dk=Tk([].join),Mk={},Lk=function(e,t,n){if(!Ak(Mk,t)){for(var r=[],a=0;a<t;a++)r[a]="a["+a+"]";Mk[t]=Ok("C,a","return new C("+Dk(r,",")+")")}return Mk[t](e,n)},zk=_k?Ok.bind:function(e){var t=Ek(this),n=t.prototype,r=Rk(arguments,1),a=function(){var n=Fk(r,Rk(arguments));return this instanceof a?Lk(t,n.length,n):t.apply(e,n)};return Ck(n)&&(a.prototype=n),a},Pk=zk;La({target:"Function",proto:!0,forced:Function.bind!==Pk},{bind:Pk});var Bk=xe,Wk=Ie,Vk=cn,Uk=Ll,Gk=Er,jk=Mt("hasInstance"),Hk=Function.prototype;jk in Hk||Vk.f(Hk,jk,{value:Gk((function(e){if(!Bk(this)||!Wk(e))return!1;var t=this.prototype;if(!Wk(t))return e instanceof this;for(;e=Uk(e);)if(t===e)return!0;return!1}),jk)});var qk=W,Kk=Mn.EXISTS,Xk=ee,Yk=zi,Jk=Function.prototype,Zk=Xk(Jk.toString),Qk=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,$k=Xk(Qk.exec);qk&&!Kk&&Yk(Jk,"name",{configurable:!0,get:function(){try{return $k(Qk,Zk(this))[1]}catch(e){return""}}});var ew=z;La({global:!0,forced:ew.globalThis!==ew},{globalThis:ew}),eo(z.JSON,"JSON",!0);var tw={exports:{}},nw=B((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),rw=B,aw=Ie,iw=ae,ow=nw,sw=Object.isExtensible,uw=rw((function(){sw(1)}))||ow?function(e){return!!aw(e)&&((!ow||"ArrayBuffer"!=iw(e))&&(!sw||sw(e)))}:sw,cw=!B((function(){return Object.isExtensible(Object.preventExtensions({}))})),lw=(tw.exports,La),hw=ee,pw=Yn,fw=Ie,dw=kt,vw=cn.f,mw=Fr,gw=bi,yw=uw,bw=cw,xw=!1,kw=Tt("meta"),ww=0,Iw=function(e){vw(e,kw,{value:{objectID:"O"+ww++,weakData:{}}})},Nw=tw.exports={enable:function(){Nw.enable=function(){},xw=!0;var e=mw.f,t=hw([].splice),n={};n[kw]=1,e(n).length&&(mw.f=function(n){for(var r=e(n),a=0,i=r.length;a<i;a++)if(r[a]===kw){t(r,a,1);break}return r},lw({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:gw.f}))},fastKey:function(e,t){if(!fw(e))return"symbol"==s(e)?e:("string"==typeof e?"S":"P")+e;if(!dw(e,kw)){if(!yw(e))return"F";if(!t)return"E";Iw(e)}return e[kw].objectID},getWeakData:function(e,t){if(!dw(e,kw)){if(!yw(e))return!0;if(!t)return!1;Iw(e)}return e[kw].weakData},onFreeze:function(e){return bw&&xw&&yw(e)&&!dw(e,kw)&&Iw(e),e}};pw[kw]=!0;var Sw=tw.exports,Tw=La,Ew=z,Cw=ee,Aw=Ca,Rw=Or,_w=Sw,Ow=yh,Fw=zg,Dw=xe,Mw=le,Lw=Ie,zw=B,Pw=Vf,Bw=eo,Ww=Oc,Vw=function(e,t,n){var r=-1!==e.indexOf("Map"),a=-1!==e.indexOf("Weak"),i=r?"set":"add",o=Ew[e],s=o&&o.prototype,u=o,c={},l=function(e){var t=Cw(s[e]);Rw(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(a&&!Lw(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return a&&!Lw(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(a&&!Lw(e))&&t(this,0===e?0:e)}:function(e,n){return t(this,0===e?0:e,n),this})};if(Aw(e,!Dw(o)||!(a||s.forEach&&!zw((function(){(new o).entries().next()})))))u=n.getConstructor(t,e,r,i),_w.enable();else if(Aw(e,!0)){var h=new u,p=h[i](a?{}:-0,1)!=h,f=zw((function(){h.has(1)})),d=Pw((function(e){new o(e)})),v=!a&&zw((function(){for(var e=new o,t=5;t--;)e[i](t,t);return!e.has(-0)}));d||((u=t((function(e,t){Fw(e,s);var n=Ww(new o,e,u);return Mw(t)||Ow(t,n[i],{that:n,AS_ENTRIES:r}),n}))).prototype=s,s.constructor=u),(f||v)&&(l("delete"),l("has"),r&&l("get")),(v||p)&&l(i),a&&s.clear&&delete s.clear}return c[e]=u,Tw({global:!0,constructor:!0,forced:u!=o},c),Bw(u,e),a||n.setStrong(u,e,r),u},Uw=yi,Gw=zi,jw=Dg,Hw=so,qw=zg,Kw=le,Xw=yh,Yw=Dd,Jw=Md,Zw=Fm,Qw=W,$w=Sw.fastKey,eI=cr.set,tI=cr.getterFor,nI={getConstructor:function(e,t,n,r){var a=e((function(e,a){qw(e,i),eI(e,{type:t,index:Uw(null),first:void 0,last:void 0,size:0}),Qw||(e.size=0),Kw(a)||Xw(a,e[r],{that:e,AS_ENTRIES:n})})),i=a.prototype,o=tI(t),s=function(e,t,n){var r,a,i=o(e),s=u(e,t);return s?s.value=n:(i.last=s={index:a=$w(t,!0),key:t,value:n,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=s),r&&(r.next=s),Qw?i.size++:e.size++,"F"!==a&&(i.index[a]=s)),e},u=function(e,t){var n,r=o(e),a=$w(t);if("F"!==a)return r.index[a];for(n=r.first;n;n=n.next)if(n.key==t)return n};return jw(i,{clear:function(){for(var e=o(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,Qw?e.size=0:this.size=0},delete:function(e){var t=this,n=o(t),r=u(t,e);if(r){var a=r.next,i=r.previous;delete n.index[r.index],r.removed=!0,i&&(i.next=a),a&&(a.previous=i),n.first==r&&(n.first=a),n.last==r&&(n.last=i),Qw?n.size--:t.size--}return!!r},forEach:function(e){for(var t,n=o(this),r=Hw(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!u(this,e)}}),jw(i,n?{get:function(e){var t=u(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),Qw&&Gw(i,"size",{configurable:!0,get:function(){return o(this).size}}),a},setStrong:function(e,t,n){var r=t+" Iterator",a=tI(t),i=tI(r);Yw(e,t,(function(e,t){eI(this,{type:r,target:e,state:a(e),kind:t,last:void 0})}),(function(){for(var e=i(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?Jw("keys"==t?n.key:"values"==t?n.value:[n.key,n.value],!1):(e.target=void 0,Jw(void 0,!0))}),n?"entries":"values",!n,!0),Zw(t)}};Vw("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),nI);var rI=Math.log,aI=Math.log1p||function(e){var t=+e;return t>-1e-8&&t<1e-8?t-t*t/2:rI(1+t)},iI=La,oI=aI,sI=Math.acosh,uI=Math.log,cI=Math.sqrt,lI=Math.LN2;iI({target:"Math",stat:!0,forced:!sI||710!=Math.floor(sI(Number.MAX_VALUE))||sI(1/0)!=1/0},{acosh:function(e){var t=+e;return t<1?NaN:t>94906265.62425156?uI(t)+lI:oI(t-1+cI(t-1)*cI(t+1))}});var hI=La,pI=Math.asinh,fI=Math.log,dI=Math.sqrt;hI({target:"Math",stat:!0,forced:!(pI&&1/pI(0)>0)},{asinh:function e(t){var n=+t;return isFinite(n)&&0!=n?n<0?-e(-n):fI(n+dI(n*n+1)):n}});var vI=La,mI=Math.atanh,gI=Math.log;vI({target:"Math",stat:!0,forced:!(mI&&1/mI(-0)<0)},{atanh:function(e){var t=+e;return 0==t?t:gI((1+t)/(1-t))/2}});var yI=Math.sign||function(e){var t=+e;return 0==t||t!=t?t:t<0?-1:1},bI=La,xI=yI,kI=Math.abs,wI=Math.pow;bI({target:"Math",stat:!0},{cbrt:function(e){var t=+e;return xI(t)*wI(kI(t),1/3)}});var II=La,NI=Math.floor,SI=Math.log,TI=Math.LOG2E;II({target:"Math",stat:!0},{clz32:function(e){var t=e>>>0;return t?31-NI(SI(t+.5)*TI):32}});var EI=Math.expm1,CI=Math.exp,AI=!EI||EI(10)>22025.465794806718||EI(10)<22025.465794806718||-2e-17!=EI(-2e-17)?function(e){var t=+e;return 0==t?t:t>-1e-6&&t<1e-6?t+t*t/2:CI(t)-1}:EI,RI=La,_I=AI,OI=Math.cosh,FI=Math.abs,DI=Math.E;RI({target:"Math",stat:!0,forced:!OI||OI(710)===1/0},{cosh:function(e){var t=_I(FI(e)-1)+1;return(t+1/(t*DI*DI))*(DI/2)}});var MI=AI;La({target:"Math",stat:!0,forced:MI!=Math.expm1},{expm1:MI});var LI=yI,zI=Math.abs,PI=Math.pow,BI=PI(2,-52),WI=PI(2,-23),VI=PI(2,127)*(2-WI),UI=PI(2,-126),GI=Math.fround||function(e){var t,n,r=+e,a=zI(r),i=LI(r);return a<UI?i*function(e){return e+1/BI-1/BI}(a/UI/WI)*UI*WI:(n=(t=(1+WI/BI)*a)-(t-a))>VI||n!=n?i*(1/0):i*n};La({target:"Math",stat:!0},{fround:GI});var jI=La,HI=Math.hypot,qI=Math.abs,KI=Math.sqrt;jI({target:"Math",stat:!0,arity:2,forced:!!HI&&HI(1/0,NaN)!==1/0},{hypot:function(e,t){for(var n,r,a=0,i=0,o=arguments.length,s=0;i<o;)s<(n=qI(arguments[i++]))?(a=a*(r=s/n)*r+1,s=n):a+=n>0?(r=n/s)*r:n;return s===1/0?1/0:s*KI(a)}});var XI=La,YI=B,JI=Math.imul;XI({target:"Math",stat:!0,forced:YI((function(){return-5!=JI(4294967295,5)||2!=JI.length}))},{imul:function(e,t){var n=65535,r=+e,a=+t,i=n&r,o=n&a;return 0|i*o+((n&r>>>16)*o+i*(n&a>>>16)<<16>>>0)}});var ZI=Math.log,QI=Math.LOG10E,$I=Math.log10||function(e){return ZI(e)*QI};La({target:"Math",stat:!0},{log10:$I}),La({target:"Math",stat:!0},{log1p:aI});var eN=La,tN=Math.log,nN=Math.LN2;eN({target:"Math",stat:!0},{log2:function(e){return tN(e)/nN}}),La({target:"Math",stat:!0},{sign:yI});var rN=La,aN=B,iN=AI,oN=Math.abs,sN=Math.exp,uN=Math.E;rN({target:"Math",stat:!0,forced:aN((function(){return-2e-17!=Math.sinh(-2e-17)}))},{sinh:function(e){var t=+e;return oN(t)<1?(iN(t)-iN(-t))/2:(sN(t-1)-sN(-t-1))*(uN/2)}});var cN=La,lN=AI,hN=Math.exp;cN({target:"Math",stat:!0},{tanh:function(e){var t=+e,n=lN(t),r=lN(-t);return n==1/0?1:r==1/0?-1:(n-r)/(hN(t)+hN(-t))}}),eo(Math,"Math",!0),La({target:"Math",stat:!0},{trunc:Lr});var pN=ee(1..valueOf),fN="\t\n\v\f\r    \u2028\u2029\ufeff",dN=fe,vN=Ya,mN=fN,gN=ee("".replace),yN=RegExp("^["+mN+"]+"),bN=RegExp("(^|[^"+mN+"])["+mN+"]+$"),xN=function(e){return function(t){var n=vN(dN(t));return 1&e&&(n=gN(n,yN,"")),2&e&&(n=gN(n,bN,"$1")),n}},kN={start:xN(1),end:xN(2),trim:xN(3)},wN=La,IN=st,NN=W,SN=z,TN=Wi,EN=ee,CN=Ca,AN=kt,RN=Oc,_N=Ce,ON=He,FN=Gt,DN=B,MN=Fr.f,LN=P.f,zN=cn.f,PN=pN,BN=kN.trim,WN="Number",VN=SN.Number,UN=(TN.Number,VN.prototype),GN=SN.TypeError,jN=EN("".slice),HN=EN("".charCodeAt),qN=function(e){var t=FN(e,"number");return"bigint"==typeof t?t:KN(t)},KN=function(e){var t,n,r,a,i,o,s,u,c=FN(e,"number");if(ON(c))throw GN("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=BN(c),43===(t=HN(c,0))||45===t){if(88===(n=HN(c,2))||120===n)return NaN}else if(48===t){switch(HN(c,1)){case 66:case 98:r=2,a=49;break;case 79:case 111:r=8,a=55;break;default:return+c}for(o=(i=jN(c,2)).length,s=0;s<o;s++)if((u=HN(i,s))<48||u>a)return NaN;return parseInt(i,r)}return+c},XN=CN(WN,!VN(" 0o1")||!VN("0b1")||VN("+0x1")),YN=function(e){return _N(UN,e)&&DN((function(){PN(e)}))},JN=function(e){var t=arguments.length<1?0:VN(qN(e));return YN(this)?RN(Object(t),this,JN):t};JN.prototype=UN,XN&&(UN.constructor=JN),wN({global:!0,constructor:!0,wrap:!0,forced:XN},{Number:JN});var ZN=function(e,t){for(var n,r=NN?MN(t):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),a=0;r.length>a;a++)AN(t,n=r[a])&&!AN(e,n)&&zN(e,n,LN(t,n))};XN&&ZN(TN.Number,VN),La({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{EPSILON:Math.pow(2,-52)});var QN=z.isFinite,$N=Number.isFinite||function(e){return"number"==typeof e&&QN(e)};La({target:"Number",stat:!0},{isFinite:$N});var eS=Ie,tS=Math.floor,nS=Number.isInteger||function(e){return!eS(e)&&isFinite(e)&&tS(e)===e};La({target:"Number",stat:!0},{isInteger:nS}),La({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var rS=La,aS=nS,iS=Math.abs;rS({target:"Number",stat:!0},{isSafeInteger:function(e){return aS(e)&&iS(e)<=9007199254740991}}),La({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MAX_SAFE_INTEGER:9007199254740991}),La({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MIN_SAFE_INTEGER:-9007199254740991});var oS=z,sS=B,uS=Ya,cS=kN.trim,lS=ee("".charAt),hS=oS.parseFloat,pS=oS.Symbol,fS=pS&&pS.iterator,dS=1/hS("\t\n\v\f\r    \u2028\u2029\ufeff-0")!=-1/0||fS&&!sS((function(){hS(Object(fS))}))?function(e){var t=cS(uS(e)),n=hS(t);return 0===n&&"-"==lS(t,0)?-0:n}:hS,vS=dS;La({target:"Number",stat:!0,forced:Number.parseFloat!=vS},{parseFloat:vS});var mS=z,gS=B,yS=ee,bS=Ya,xS=kN.trim,kS=fN,wS=mS.parseInt,IS=mS.Symbol,NS=IS&&IS.iterator,SS=/^[+-]?0x/i,TS=yS(SS.exec),ES=8!==wS(kS+"08")||22!==wS(kS+"0x16")||NS&&!gS((function(){wS(Object(NS))}))?function(e,t){var n=xS(bS(e));return wS(n,t>>>0||(TS(SS,n)?16:10))}:wS,CS=ES;La({target:"Number",stat:!0,forced:Number.parseInt!=CS},{parseInt:CS});var AS=La,RS=ee,_S=Pr,OS=pN,FS=Nx,DS=$I,MS=B,LS=RangeError,zS=String,PS=isFinite,BS=Math.abs,WS=Math.floor,VS=Math.pow,US=Math.round,GS=RS(1..toExponential),jS=RS(FS),HS=RS("".slice),qS="-6.9000e-11"===GS(-69e-12,4)&&"1.25e+0"===GS(1.255,2)&&"1.235e+4"===GS(12345,3)&&"3e+1"===GS(25,0);AS({target:"Number",proto:!0,forced:!qS||!(MS((function(){GS(1,1/0)}))&&MS((function(){GS(1,-1/0)})))||!!MS((function(){GS(1/0,1/0),GS(NaN,1/0)}))},{toExponential:function(e){var t=OS(this);if(void 0===e)return GS(t);var n=_S(e);if(!PS(t))return String(t);if(n<0||n>20)throw LS("Incorrect fraction digits");if(qS)return GS(t,n);var r="",a="",i=0,o="",s="";if(t<0&&(r="-",t=-t),0===t)i=0,a=jS("0",n+1);else{var u=DS(t);i=WS(u);var c=0,l=VS(10,i-n);2*t>=(2*(c=US(t/l))+1)*l&&(c+=1),c>=VS(10,n+1)&&(c/=10,i+=1),a=zS(c)}return 0!==n&&(a=HS(a,0,1)+"."+HS(a,1)),0===i?(o="+",s="0"):(o=i>0?"+":"-",s=zS(BS(i))),r+(a+="e"+o+s)}});var KS=La,XS=ee,YS=Pr,JS=pN,ZS=Nx,QS=B,$S=RangeError,eT=String,tT=Math.floor,nT=XS(ZS),rT=XS("".slice),aT=XS(1..toFixed),iT=function e(t,n,r){return 0===n?r:n%2==1?e(t,n-1,r*t):e(t*t,n/2,r)},oT=function(e,t,n){for(var r=-1,a=n;++r<6;)a+=t*e[r],e[r]=a%1e7,a=tT(a/1e7)},sT=function(e,t){for(var n=6,r=0;--n>=0;)r+=e[n],e[n]=tT(r/t),r=r%t*1e7},uT=function(e){for(var t=6,n="";--t>=0;)if(""!==n||0===t||0!==e[t]){var r=eT(e[t]);n=""===n?r:n+nT("0",7-r.length)+r}return n};KS({target:"Number",proto:!0,forced:QS((function(){return"0.000"!==aT(8e-5,3)||"1"!==aT(.9,0)||"1.25"!==aT(1.255,2)||"1000000000000000128"!==aT(0xde0b6b3a7640080,0)}))||!QS((function(){aT({})}))},{toFixed:function(e){var t,n,r,a,i=JS(this),o=YS(e),s=[0,0,0,0,0,0],u="",c="0";if(o<0||o>20)throw $S("Incorrect fraction digits");if(i!=i)return"NaN";if(i<=-1e21||i>=1e21)return eT(i);if(i<0&&(u="-",i=-i),i>1e-21)if(n=(t=function(e){for(var t=0,n=e;n>=4096;)t+=12,n/=4096;for(;n>=2;)t+=1,n/=2;return t}(i*iT(2,69,1))-69)<0?i*iT(2,-t,1):i/iT(2,t,1),n*=4503599627370496,(t=52-t)>0){for(oT(s,0,n),r=o;r>=7;)oT(s,1e7,0),r-=7;for(oT(s,iT(10,r,1),0),r=t-1;r>=23;)sT(s,1<<23),r-=23;sT(s,1<<r),oT(s,1,1),sT(s,2),c=uT(s)}else oT(s,0,n),oT(s,1<<-t,0),c=uT(s)+nT("0",o);return c=o>0?u+((a=c.length)<=o?"0."+nT("0",o-a)+c:rT(c,0,a-o)+"."+rT(c,a-o)):u+c}});var cT=La,lT=B,hT=pN,pT=ee(1..toPrecision);cT({target:"Number",proto:!0,forced:lT((function(){return"1"!==pT(1,void 0)}))||!lT((function(){pT({})}))},{toPrecision:function(e){return void 0===e?pT(hT(this)):pT(hT(this),e)}});var fT=W,dT=ee,vT=j,mT=B,gT=$a,yT=ua,bT=H,xT=yt,kT=ce,wT=Object.assign,IT=Object.defineProperty,NT=dT([].concat),ST=!wT||mT((function(){if(fT&&1!==wT({b:1},wT(IT({},"a",{enumerable:!0,get:function(){IT(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach((function(e){t[e]=e})),7!=wT({},e)[n]||gT(wT({},t)).join("")!=r}))?function(e,t){for(var n=xT(e),r=arguments.length,a=1,i=yT.f,o=bT.f;r>a;)for(var s,u=kT(arguments[a++]),c=i?NT(gT(u),i(u)):gT(u),l=c.length,h=0;l>h;)s=c[h++],fT&&!vT(o,u,s)||(n[s]=u[s]);return n}:wT,TT=ST;La({target:"Object",stat:!0,arity:2,forced:Object.assign!==TT},{assign:TT}),La({target:"Object",stat:!0,sham:!W},{create:yi});var ET=z,CT=sm,AT=!B((function(){if(!(CT&&CT<535)){var e=Math.random();__defineSetter__.call(null,e,(function(){})),delete ET[e]}})),RT=Ze,_T=yt,OT=cn;W&&La({target:"Object",proto:!0,forced:AT},{__defineGetter__:function(e,t){OT.f(_T(this),e,{get:RT(t),enumerable:!0,configurable:!0})}});var FT=La,DT=W,MT=Ja.f;FT({target:"Object",stat:!0,forced:Object.defineProperties!==MT,sham:!DT},{defineProperties:MT});var LT=La,zT=W,PT=cn.f;LT({target:"Object",stat:!0,forced:Object.defineProperty!==PT,sham:!zT},{defineProperty:PT});var BT=Ze,WT=yt,VT=cn;W&&La({target:"Object",proto:!0,forced:AT},{__defineSetter__:function(e,t){VT.f(WT(this),e,{set:BT(t),enumerable:!0,configurable:!0})}});var UT=W,GT=ee,jT=$a,HT=me,qT=GT(H.f),KT=GT([].push),XT=function(e){return function(t){for(var n,r=HT(t),a=jT(r),i=a.length,o=0,s=[];i>o;)n=a[o++],UT&&!qT(r,n)||KT(s,e?[n,r[n]]:r[n]);return s}},YT={entries:XT(!0),values:XT(!1)},JT=YT.entries;La({target:"Object",stat:!0},{entries:function(e){return JT(e)}});var ZT=La,QT=cw,$T=B,eE=Ie,tE=Sw.onFreeze,nE=Object.freeze;ZT({target:"Object",stat:!0,forced:$T((function(){nE(1)})),sham:!QT},{freeze:function(e){return nE&&eE(e)?nE(tE(e)):e}});var rE=yh,aE=Ii;La({target:"Object",stat:!0},{fromEntries:function(e){var t={};return rE(e,(function(e,n){aE(t,e,n)}),{AS_ENTRIES:!0}),t}});var iE=La,oE=B,sE=me,uE=P.f,cE=W;iE({target:"Object",stat:!0,forced:!cE||oE((function(){uE(1)})),sham:!cE},{getOwnPropertyDescriptor:function(e,t){return uE(sE(e),t)}});var lE=da,hE=me,pE=P,fE=Ii;La({target:"Object",stat:!0,sham:!W},{getOwnPropertyDescriptors:function(e){for(var t,n,r=hE(e),a=pE.f,i=lE(r),o={},s=0;i.length>s;)void 0!==(n=a(r,t=i[s++]))&&fE(o,t,n);return o}});var dE=La,vE=B,mE=bi.f;dE({target:"Object",stat:!0,forced:vE((function(){return!Object.getOwnPropertyNames(1)}))},{getOwnPropertyNames:mE});var gE=yt,yE=Ll,bE=Cl;La({target:"Object",stat:!0,forced:B((function(){yE(1)})),sham:!bE},{getPrototypeOf:function(e){return yE(gE(e))}}),La({target:"Object",stat:!0},{hasOwn:kt});var xE=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};La({target:"Object",stat:!0},{is:xE});var kE=uw;La({target:"Object",stat:!0,forced:Object.isExtensible!==kE},{isExtensible:kE});var wE=La,IE=B,NE=Ie,SE=ae,TE=nw,EE=Object.isFrozen;wE({target:"Object",stat:!0,forced:TE||IE((function(){EE(1)}))},{isFrozen:function(e){return!NE(e)||(!(!TE||"ArrayBuffer"!=SE(e))||!!EE&&EE(e))}});var CE=La,AE=B,RE=Ie,_E=ae,OE=nw,FE=Object.isSealed;CE({target:"Object",stat:!0,forced:OE||AE((function(){FE(1)}))},{isSealed:function(e){return!RE(e)||(!(!OE||"ArrayBuffer"!=_E(e))||!!FE&&FE(e))}});var DE=yt,ME=$a;La({target:"Object",stat:!0,forced:B((function(){ME(1)}))},{keys:function(e){return ME(DE(e))}});var LE=La,zE=W,PE=AT,BE=yt,WE=qt,VE=Ll,UE=P.f;zE&&LE({target:"Object",proto:!0,forced:PE},{__lookupGetter__:function(e){var t,n=BE(this),r=WE(e);do{if(t=UE(n,r))return t.get}while(n=VE(n))}});var GE=La,jE=W,HE=AT,qE=yt,KE=qt,XE=Ll,YE=P.f;jE&&GE({target:"Object",proto:!0,forced:HE},{__lookupSetter__:function(e){var t,n=qE(this),r=KE(e);do{if(t=YE(n,r))return t.set}while(n=XE(n))}});var JE=La,ZE=Ie,QE=Sw.onFreeze,$E=cw,eC=B,tC=Object.preventExtensions;JE({target:"Object",stat:!0,forced:eC((function(){tC(1)})),sham:!$E},{preventExtensions:function(e){return tC&&ZE(e)?tC(QE(e)):e}});var nC=W,rC=zi,aC=Ie,iC=yt,oC=fe,sC=Object.getPrototypeOf,uC=Object.setPrototypeOf,cC=Object.prototype,lC="__proto__";if(nC&&sC&&uC&&!(lC in cC))try{rC(cC,lC,{configurable:!0,get:function(){return sC(iC(this))},set:function(e){var t=oC(this);(aC(e)||null===e)&&aC(t)&&uC(t,e)}})}catch(e){}var hC=La,pC=Ie,fC=Sw.onFreeze,dC=cw,vC=B,mC=Object.seal;hC({target:"Object",stat:!0,forced:vC((function(){mC(1)})),sham:!dC},{seal:function(e){return mC&&pC(e)?mC(fC(e)):e}}),La({target:"Object",stat:!0},{setPrototypeOf:Tc});var gC=qa,yC=Ba?{}.toString:function(){return"[object "+gC(this)+"]"},bC=yC;Ba||Or(Object.prototype,"toString",bC,{unsafe:!0});var xC=YT.values;La({target:"Object",stat:!0},{values:function(e){return xC(e)}});La({global:!0,forced:parseFloat!=dS},{parseFloat:dS});La({global:!0,forced:parseInt!=ES},{parseInt:ES});var kC,wC,IC,NC,SC=TypeError,TC=function(e,t){if(e<t)throw SC("Not enough arguments");return e},EC=/(?:ipad|iphone|ipod).*applewebkit/i.test(Ae),CC=z,AC=fu,RC=so,_C=xe,OC=kt,FC=B,DC=oi,MC=du,LC=Jt,zC=TC,PC=EC,BC=Rv,WC=CC.setImmediate,VC=CC.clearImmediate,UC=CC.process,GC=CC.Dispatch,jC=CC.Function,HC=CC.MessageChannel,qC=CC.String,KC=0,XC={},YC="onreadystatechange";FC((function(){kC=CC.location}));var JC=function(e){if(OC(XC,e)){var t=XC[e];delete XC[e],t()}},ZC=function(e){return function(){JC(e)}},QC=function(e){JC(e.data)},$C=function(e){CC.postMessage(qC(e),kC.protocol+"//"+kC.host)};WC&&VC||(WC=function(e){zC(arguments.length,1);var t=_C(e)?e:jC(e),n=MC(arguments,1);return XC[++KC]=function(){AC(t,void 0,n)},wC(KC),KC},VC=function(e){delete XC[e]},BC?wC=function(e){UC.nextTick(ZC(e))}:GC&&GC.now?wC=function(e){GC.now(ZC(e))}:HC&&!PC?(NC=(IC=new HC).port2,IC.port1.onmessage=QC,wC=RC(NC.postMessage,NC)):CC.addEventListener&&_C(CC.postMessage)&&!CC.importScripts&&kC&&"file:"!==kC.protocol&&!FC($C)?(wC=$C,CC.addEventListener("message",QC,!1)):wC=YC in LC("script")?function(e){DC.appendChild(LC("script")).onreadystatechange=function(){DC.removeChild(this),JC(e)}}:function(e){setTimeout(ZC(e),0)});var eA={set:WC,clear:VC},tA=function(){this.head=null,this.tail=null};tA.prototype={add:function(e){var t={item:e,next:null},n=this.tail;n?n.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var nA,rA,aA,iA,oA,sA=tA,uA=/ipad|iphone|ipod/i.test(Ae)&&"undefined"!=typeof Pebble,cA=/web0s(?!.*chrome)/i.test(Ae),lA=z,hA=so,pA=P.f,fA=eA.set,dA=sA,vA=EC,mA=uA,gA=cA,yA=Rv,bA=lA.MutationObserver||lA.WebKitMutationObserver,xA=lA.document,kA=lA.process,wA=lA.Promise,IA=pA(lA,"queueMicrotask"),NA=IA&&IA.value;if(!NA){var SA=new dA,TA=function(){var e,t;for(yA&&(e=kA.domain)&&e.exit();t=SA.get();)try{t()}catch(e){throw SA.head&&nA(),e}e&&e.enter()};vA||yA||gA||!bA||!xA?!mA&&wA&&wA.resolve?((iA=wA.resolve(void 0)).constructor=wA,oA=hA(iA.then,iA),nA=function(){oA(TA)}):yA?nA=function(){kA.nextTick(TA)}:(fA=hA(fA,lA),nA=function(){fA(TA)}):(rA=!0,aA=xA.createTextNode(""),new bA(TA).observe(aA,{characterData:!0}),nA=function(){aA.data=rA=!rA}),NA=function(e){SA.head||nA(),SA.add(e)}}var EA,CA,AA,RA=NA,_A=function(e,t){try{1==arguments.length?console.error(e):console.error(e,t)}catch(e){}},OA=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},FA=z.Promise,DA="object"==("undefined"==typeof Deno?"undefined":s(Deno))&&Deno&&"object"==s(Deno.version),MA=!DA&&!Rv&&"object"==("undefined"==typeof window?"undefined":s(window))&&"object"==("undefined"==typeof document?"undefined":s(document)),LA=z,zA=FA,PA=xe,BA=Ca,WA=Un,VA=Mt,UA=MA,GA=DA,jA=Le,HA=(zA&&zA.prototype,VA("species")),qA=!1,KA=PA(LA.PromiseRejectionEvent),XA=BA("Promise",(function(){var e=WA(zA),t=e!==String(zA);if(!t&&66===jA)return!0;if(!jA||jA<51||!/native code/.test(e)){var n=new zA((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};if((n.constructor={})[HA]=r,!(qA=n.then((function(){}))instanceof r))return!0}return!t&&(UA||GA)&&!KA})),YA={CONSTRUCTOR:XA,REJECTION_EVENT:KA,SUBCLASSING:qA},JA={},ZA=Ze,QA=TypeError,$A=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw QA("Bad Promise constructor");t=e,n=r})),this.resolve=ZA(t),this.reject=ZA(n)},eR=(JA.f=function(e){return new $A(e)},La),tR=Rv,nR=z,rR=j,aR=Or,iR=Tc,oR=eo,sR=Fm,uR=Ze,cR=xe,lR=Ie,hR=zg,pR=Kb,fR=eA.set,dR=RA,vR=_A,mR=OA,gR=sA,yR=cr,bR=FA,xR=JA,kR="Promise",wR=YA.CONSTRUCTOR,IR=YA.REJECTION_EVENT,NR=YA.SUBCLASSING,SR=yR.getterFor(kR),TR=yR.set,ER=bR&&bR.prototype,CR=bR,AR=ER,RR=nR.TypeError,_R=nR.document,OR=nR.process,FR=xR.f,DR=FR,MR=!!(_R&&_R.createEvent&&nR.dispatchEvent),LR="unhandledrejection",zR=function(e){var t;return!(!lR(e)||!cR(t=e.then))&&t},PR=function(e,t){var n,r,a,i=t.value,o=1==t.state,s=o?e.ok:e.fail,u=e.resolve,c=e.reject,l=e.domain;try{s?(o||(2===t.rejection&&GR(t),t.rejection=1),!0===s?n=i:(l&&l.enter(),n=s(i),l&&(l.exit(),a=!0)),n===e.promise?c(RR("Promise-chain cycle")):(r=zR(n))?rR(r,n,u,c):u(n)):c(i)}catch(e){l&&!a&&l.exit(),c(e)}},BR=function(e,t){e.notified||(e.notified=!0,dR((function(){for(var n,r=e.reactions;n=r.get();)PR(n,e);e.notified=!1,t&&!e.rejection&&VR(e)})))},WR=function(e,t,n){var r,a;MR?((r=_R.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),nR.dispatchEvent(r)):r={promise:t,reason:n},!IR&&(a=nR["on"+e])?a(r):e===LR&&vR("Unhandled promise rejection",n)},VR=function(e){rR(fR,nR,(function(){var t,n=e.facade,r=e.value;if(UR(e)&&(t=mR((function(){tR?OR.emit("unhandledRejection",r,n):WR(LR,n,r)})),e.rejection=tR||UR(e)?2:1,t.error))throw t.value}))},UR=function(e){return 1!==e.rejection&&!e.parent},GR=function(e){rR(fR,nR,(function(){var t=e.facade;tR?OR.emit("rejectionHandled",t):WR("rejectionhandled",t,e.value)}))},jR=function(e,t,n){return function(r){e(t,r,n)}},HR=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,BR(e,!0))},qR=function e(t,n,r){if(!t.done){t.done=!0,r&&(t=r);try{if(t.facade===n)throw RR("Promise can't be resolved itself");var a=zR(n);a?dR((function(){var r={done:!1};try{rR(a,n,jR(e,r,t),jR(HR,r,t))}catch(e){HR(r,e,t)}})):(t.value=n,t.state=1,BR(t,!1))}catch(e){HR({done:!1},e,t)}}};if(wR&&(AR=(CR=function(e){hR(this,AR),uR(e),rR(EA,this);var t=SR(this);try{e(jR(qR,t),jR(HR,t))}catch(e){HR(t,e)}}).prototype,(EA=function(e){TR(this,{type:kR,done:!1,notified:!1,parent:!1,reactions:new gR,rejection:!1,state:0,value:void 0})}).prototype=aR(AR,"then",(function(e,t){var n=SR(this),r=FR(pR(this,CR));return n.parent=!0,r.ok=!cR(e)||e,r.fail=cR(t)&&t,r.domain=tR?OR.domain:void 0,0==n.state?n.reactions.add(r):dR((function(){PR(r,n)})),r.promise})),CA=function(){var e=new EA,t=SR(e);this.promise=e,this.resolve=jR(qR,t),this.reject=jR(HR,t)},xR.f=FR=function(e){return e===CR||undefined===e?new CA(e):DR(e)},cR(bR)&&ER!==Object.prototype)){AA=ER.then,NR||aR(ER,"then",(function(e,t){var n=this;return new CR((function(e,t){rR(AA,n,e,t)})).then(e,t)}),{unsafe:!0});try{delete ER.constructor}catch(e){}iR&&iR(ER,AR)}eR({global:!0,constructor:!0,wrap:!0,forced:wR},{Promise:CR}),oR(CR,kR,!1,!0),sR(kR);var KR=FA,XR=YA.CONSTRUCTOR||!Vf((function(e){KR.all(e).then(void 0,(function(){}))})),YR=j,JR=Ze,ZR=JA,QR=OA,$R=yh;La({target:"Promise",stat:!0,forced:XR},{all:function(e){var t=this,n=ZR.f(t),r=n.resolve,a=n.reject,i=QR((function(){var n=JR(t.resolve),i=[],o=0,s=1;$R(e,(function(e){var u=o++,c=!1;s++,YR(n,t,e).then((function(e){c||(c=!0,i[u]=e,--s||r(i))}),a)})),--s||r(i)}));return i.error&&a(i.value),n.promise}});var e_=La,t_=YA.CONSTRUCTOR,n_=FA,r_=Ee,a_=xe,i_=Or,o_=n_&&n_.prototype;if(e_({target:"Promise",proto:!0,forced:t_,real:!0},{catch:function(e){return this.then(void 0,e)}}),a_(n_)){var s_=r_("Promise").prototype.catch;o_.catch!==s_&&i_(o_,"catch",s_,{unsafe:!0})}var u_=j,c_=Ze,l_=JA,h_=OA,p_=yh;La({target:"Promise",stat:!0,forced:XR},{race:function(e){var t=this,n=l_.f(t),r=n.reject,a=h_((function(){var a=c_(t.resolve);p_(e,(function(e){u_(a,t,e).then(n.resolve,r)}))}));return a.error&&r(a.value),n.promise}});var f_=j,d_=JA;La({target:"Promise",stat:!0,forced:YA.CONSTRUCTOR},{reject:function(e){var t=d_.f(this);return f_(t.reject,void 0,e),t.promise}});var v_=dn,m_=Ie,g_=JA,y_=function(e,t){if(v_(e),m_(t)&&t.constructor===e)return t;var n=g_.f(e);return(0,n.resolve)(t),n.promise},b_=La,x_=YA.CONSTRUCTOR,k_=y_;Ee("Promise");b_({target:"Promise",stat:!0,forced:x_},{resolve:function(e){return k_(this,e)}});var w_=j,I_=Ze,N_=JA,S_=OA,T_=yh;La({target:"Promise",stat:!0,forced:XR},{allSettled:function(e){var t=this,n=N_.f(t),r=n.resolve,a=n.reject,i=S_((function(){var n=I_(t.resolve),a=[],i=0,o=1;T_(e,(function(e){var s=i++,u=!1;o++,w_(n,t,e).then((function(e){u||(u=!0,a[s]={status:"fulfilled",value:e},--o||r(a))}),(function(e){u||(u=!0,a[s]={status:"rejected",reason:e},--o||r(a))}))})),--o||r(a)}));return i.error&&a(i.value),n.promise}});var E_=j,C_=Ze,A_=Ee,R_=JA,__=OA,O_=yh,F_="No one promise resolved";La({target:"Promise",stat:!0,forced:XR},{any:function(e){var t=this,n=A_("AggregateError"),r=R_.f(t),a=r.resolve,i=r.reject,o=__((function(){var r=C_(t.resolve),o=[],s=0,u=1,c=!1;O_(e,(function(e){var l=s++,h=!1;u++,E_(r,t,e).then((function(e){h||c||(c=!0,a(e))}),(function(e){h||c||(h=!0,o[l]=e,--u||i(new n(o,F_)))}))})),--u||i(new n(o,F_))}));return o.error&&i(o.value),r.promise}});var D_=La,M_=FA,L_=B,z_=Ee,P_=xe,B_=Kb,W_=y_,V_=Or,U_=M_&&M_.prototype;if(D_({target:"Promise",proto:!0,real:!0,forced:!!M_&&L_((function(){U_.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=B_(this,z_("Promise")),n=P_(e);return this.then(n?function(n){return W_(t,e()).then((function(){return n}))}:e,n?function(n){return W_(t,e()).then((function(){throw n}))}:e)}}),P_(M_)){var G_=z_("Promise").prototype.finally;U_.finally!==G_&&V_(U_,"finally",G_,{unsafe:!0})}var j_=fu,H_=Ze,q_=dn;La({target:"Reflect",stat:!0,forced:!B((function(){Reflect.apply((function(){}))}))},{apply:function(e,t,n){return j_(H_(e),t,q_(n))}});var K_=La,X_=fu,Y_=zk,J_=Ub,Z_=dn,Q_=Ie,$_=yi,eO=B,tO=Ee("Reflect","construct"),nO=Object.prototype,rO=[].push,aO=eO((function(){function e(){}return!(tO((function(){}),[],e)instanceof e)})),iO=!eO((function(){tO((function(){}))})),oO=aO||iO;K_({target:"Reflect",stat:!0,forced:oO,sham:oO},{construct:function(e,t){J_(e),Z_(t);var n=arguments.length<3?e:J_(arguments[2]);if(iO&&!aO)return tO(e,t,n);if(e==n){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var r=[null];return X_(rO,r,t),new(X_(Y_,e,r))}var a=n.prototype,i=$_(Q_(a)?a:nO),o=X_(e,i,t);return Q_(o)?o:i}});var sO=W,uO=dn,cO=qt,lO=cn;La({target:"Reflect",stat:!0,forced:B((function(){Reflect.defineProperty(lO.f({},1,{value:1}),1,{value:2})})),sham:!sO},{defineProperty:function(e,t,n){uO(e);var r=cO(t);uO(n);try{return lO.f(e,r,n),!0}catch(e){return!1}}});var hO=La,pO=dn,fO=P.f;hO({target:"Reflect",stat:!0},{deleteProperty:function(e,t){var n=fO(pO(e),t);return!(n&&!n.configurable)&&delete e[t]}});var dO=kt,vO=function(e){return void 0!==e&&(dO(e,"value")||dO(e,"writable"))},mO=j,gO=Ie,yO=dn,bO=vO,xO=P,kO=Ll;La({target:"Reflect",stat:!0},{get:function e(t,n){var r,a,i=arguments.length<3?t:arguments[2];return yO(t)===i?t[n]:(r=xO.f(t,n))?bO(r)?r.value:void 0===r.get?void 0:mO(r.get,i):gO(a=kO(t))?e(a,n,i):void 0}});var wO=dn,IO=P;La({target:"Reflect",stat:!0,sham:!W},{getOwnPropertyDescriptor:function(e,t){return IO.f(wO(e),t)}});var NO=dn,SO=Ll;La({target:"Reflect",stat:!0,sham:!Cl},{getPrototypeOf:function(e){return SO(NO(e))}}),La({target:"Reflect",stat:!0},{has:function(e,t){return t in e}});var TO=dn,EO=uw;La({target:"Reflect",stat:!0},{isExtensible:function(e){return TO(e),EO(e)}}),La({target:"Reflect",stat:!0},{ownKeys:da});var CO=Ee,AO=dn;La({target:"Reflect",stat:!0,sham:!cw},{preventExtensions:function(e){AO(e);try{var t=CO("Object","preventExtensions");return t&&t(e),!0}catch(e){return!1}}});var RO=La,_O=j,OO=dn,FO=Ie,DO=vO,MO=cn,LO=P,zO=Ll,PO=Y;var BO=B((function(){var e=function(){},t=MO.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));RO({target:"Reflect",stat:!0,forced:BO},{set:function e(t,n,r){var a,i,o,s=arguments.length<4?t:arguments[3],u=LO.f(OO(t),n);if(!u){if(FO(i=zO(t)))return e(i,n,r,s);u=PO(0)}if(DO(u)){if(!1===u.writable||!FO(s))return!1;if(a=LO.f(s,n)){if(a.get||a.set||!1===a.writable)return!1;a.value=r,MO.f(s,n,a)}else MO.f(s,n,PO(0,r))}else{if(void 0===(o=u.set))return!1;_O(o,s,r)}return!0}});var WO=dn,VO=wc,UO=Tc;UO&&La({target:"Reflect",stat:!0},{setPrototypeOf:function(e,t){WO(e),VO(t);try{return UO(e,t),!0}catch(e){return!1}}});var GO=z,jO=eo;La({global:!0},{Reflect:{}}),jO(GO.Reflect,"Reflect",!0);var HO=Ie,qO=ae,KO=Mt("match"),XO=function(e){var t;return HO(e)&&(void 0!==(t=e[KO])?!!t:"RegExp"==qO(e))},YO=dn,JO=function(){var e=YO(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},ZO=j,QO=kt,$O=Ce,eF=JO,tF=RegExp.prototype,nF=function(e){var t=e.flags;return void 0!==t||"flags"in tF||QO(e,"flags")||!$O(tF,e)?t:ZO(eF,e)},rF=B,aF=z.RegExp,iF=rF((function(){var e=aF("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),oF=iF||rF((function(){return!aF("a","y").sticky})),sF=iF||rF((function(){var e=aF("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),uF={BROKEN_CARET:sF,MISSED_STICKY:oF,UNSUPPORTED_Y:iF},cF=B,lF=z.RegExp,hF=cF((function(){var e=lF(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),pF=B,fF=z.RegExp,dF=pF((function(){var e=fF("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),vF=W,mF=z,gF=ee,yF=Ca,bF=Oc,xF=Cn,kF=Fr.f,wF=Ce,IF=XO,NF=Ya,SF=nF,TF=uF,EF=Cc,CF=Or,AF=B,RF=kt,_F=cr.enforce,OF=Fm,FF=hF,DF=dF,MF=Mt("match"),LF=mF.RegExp,zF=LF.prototype,PF=mF.SyntaxError,BF=gF(zF.exec),WF=gF("".charAt),VF=gF("".replace),UF=gF("".indexOf),GF=gF("".slice),jF=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,HF=/a/g,qF=/a/g,KF=new LF(HF)!==HF,XF=TF.MISSED_STICKY,YF=TF.UNSUPPORTED_Y,JF=vF&&(!KF||XF||FF||DF||AF((function(){return qF[MF]=!1,LF(HF)!=HF||LF(qF)==qF||"/a/i"!=LF(HF,"i")})));if(yF("RegExp",JF)){for(var ZF=function(e,t){var n,r,a,i,o,s,u=wF(zF,this),c=IF(e),l=void 0===t,h=[],p=e;if(!u&&c&&l&&e.constructor===ZF)return e;if((c||wF(zF,e))&&(e=e.source,l&&(t=SF(p))),e=void 0===e?"":NF(e),t=void 0===t?"":NF(t),p=e,FF&&"dotAll"in HF&&(r=!!t&&UF(t,"s")>-1)&&(t=VF(t,/s/g,"")),n=t,XF&&"sticky"in HF&&(a=!!t&&UF(t,"y")>-1)&&YF&&(t=VF(t,/y/g,"")),DF&&(i=function(e){for(var t,n=e.length,r=0,a="",i=[],o={},s=!1,u=!1,c=0,l="";r<=n;r++){if("\\"===(t=WF(e,r)))t+=WF(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:BF(jF,GF(e,r+1))&&(r+=2,u=!0),a+=t,c++;continue;case">"===t&&u:if(""===l||RF(o,l))throw new PF("Invalid capture group name");o[l]=!0,i[i.length]=[l,c],u=!1,l="";continue}u?l+=t:a+=t}return[a,i]}(e),e=i[0],h=i[1]),o=bF(LF(e,t),u?this:zF,ZF),(r||a||h.length)&&(s=_F(o),r&&(s.dotAll=!0,s.raw=ZF(function(e){for(var t,n=e.length,r=0,a="",i=!1;r<=n;r++)"\\"!==(t=WF(e,r))?i||"."!==t?("["===t?i=!0:"]"===t&&(i=!1),a+=t):a+="[\\s\\S]":a+=t+WF(e,++r);return a}(e),n)),a&&(s.sticky=!0),h.length&&(s.groups=h)),e!==p)try{xF(o,"source",""===p?"(?:)":p)}catch(e){}return o},QF=kF(LF),$F=0;QF.length>$F;)EF(ZF,LF,QF[$F++]);zF.constructor=ZF,ZF.prototype=zF,CF(mF,"RegExp",ZF,{constructor:!0})}OF("RegExp");var eD=W,tD=hF,nD=ae,rD=zi,aD=cr.get,iD=RegExp.prototype,oD=TypeError;eD&&tD&&rD(iD,"dotAll",{configurable:!0,get:function(){if(this!==iD){if("RegExp"===nD(this))return!!aD(this).dotAll;throw oD("Incompatible receiver, RegExp required")}}});var sD=j,uD=ee,cD=Ya,lD=JO,hD=uF,pD=yi,fD=cr.get,dD=hF,vD=dF,mD=vt("native-string-replace",String.prototype.replace),gD=RegExp.prototype.exec,yD=gD,bD=uD("".charAt),xD=uD("".indexOf),kD=uD("".replace),wD=uD("".slice),ID=function(){var e=/a/,t=/b*/g;return sD(gD,e,"a"),sD(gD,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),ND=hD.BROKEN_CARET,SD=void 0!==/()??/.exec("")[1];(ID||SD||ND||dD||vD)&&(yD=function(e){var t,n,r,a,i,o,s,u=this,c=fD(u),l=cD(e),h=c.raw;if(h)return h.lastIndex=u.lastIndex,t=sD(yD,h,l),u.lastIndex=h.lastIndex,t;var p=c.groups,f=ND&&u.sticky,d=sD(lD,u),v=u.source,m=0,g=l;if(f&&(d=kD(d,"y",""),-1===xD(d,"g")&&(d+="g"),g=wD(l,u.lastIndex),u.lastIndex>0&&(!u.multiline||u.multiline&&"\n"!==bD(l,u.lastIndex-1))&&(v="(?: "+v+")",g=" "+g,m++),n=new RegExp("^(?:"+v+")",d)),SD&&(n=new RegExp("^"+v+"$(?!\\s)",d)),ID&&(r=u.lastIndex),a=sD(gD,f?n:u,g),f?a?(a.input=wD(a.input,m),a[0]=wD(a[0],m),a.index=u.lastIndex,u.lastIndex+=a[0].length):u.lastIndex=0:ID&&a&&(u.lastIndex=u.global?a.index+a[0].length:r),SD&&a&&a.length>1&&sD(mD,a[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(a[i]=void 0)})),a&&p)for(a.groups=o=pD(null),i=0;i<p.length;i++)o[(s=p[i])[0]]=a[s[1]];return a});var TD=yD;La({target:"RegExp",proto:!0,forced:/./.exec!==TD},{exec:TD});var ED=W,CD=zi,AD=JO,RD=B,_D=z.RegExp,OD=_D.prototype,FD=ED&&RD((function(){var e=!0;try{_D(".","d")}catch(t){e=!1}var t={},n="",r=e?"dgimsy":"gimsy",a=function(e,r){Object.defineProperty(t,e,{get:function(){return n+=r,!0}})},i={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var o in e&&(i.hasIndices="d"),i)a(o,i[o]);return Object.getOwnPropertyDescriptor(OD,"flags").get.call(t)!==r||n!==r}));FD&&CD(OD,"flags",{configurable:!0,get:AD});var DD=W,MD=uF.MISSED_STICKY,LD=ae,zD=zi,PD=cr.get,BD=RegExp.prototype,WD=TypeError;DD&&MD&&zD(BD,"sticky",{configurable:!0,get:function(){if(this!==BD){if("RegExp"===LD(this))return!!PD(this).sticky;throw WD("Incompatible receiver, RegExp required")}}});var VD,UD,GD=La,jD=j,HD=xe,qD=dn,KD=Ya,XD=(VD=!1,(UD=/[ac]/).exec=function(){return VD=!0,/./.exec.apply(this,arguments)},!0===UD.test("abc")&&VD),YD=/./.test;GD({target:"RegExp",proto:!0,forced:!XD},{test:function(e){var t=qD(this),n=KD(e),r=t.exec;if(!HD(r))return jD(YD,t,n);var a=jD(r,t,n);return null!==a&&(qD(a),!0)}});var JD=Mn.PROPER,ZD=Or,QD=dn,$D=Ya,eM=B,tM=nF,nM="toString",rM=RegExp.prototype.toString,aM=eM((function(){return"/a/b"!=rM.call({source:"a",flags:"b"})})),iM=JD&&rM.name!=nM;(aM||iM)&&ZD(RegExp.prototype,nM,(function(){var e=QD(this);return"/"+$D(e.source)+"/"+$D(tM(e))}),{unsafe:!0}),Vw("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),nI);var oM=La,sM=fe,uM=Pr,cM=Ya,lM=B,hM=ee("".charAt);oM({target:"String",proto:!0,forced:lM((function(){return"\ud842"!=="𠮷".at(-2)}))},{at:function(e){var t=cM(sM(this)),n=t.length,r=uM(e),a=r>=0?r:n+r;return a<0||a>=n?void 0:hM(t,a)}});var pM=ee,fM=Pr,dM=Ya,vM=fe,mM=pM("".charAt),gM=pM("".charCodeAt),yM=pM("".slice),bM=function(e){return function(t,n){var r,a,i=dM(vM(t)),o=fM(n),s=i.length;return o<0||o>=s?e?"":void 0:(r=gM(i,o))<55296||r>56319||o+1===s||(a=gM(i,o+1))<56320||a>57343?e?mM(i,o):r:e?yM(i,o,o+2):a-56320+(r-55296<<10)+65536}},xM={codeAt:bM(!1),charAt:bM(!0)},kM=xM.codeAt;La({target:"String",proto:!0},{codePointAt:function(e){return kM(this,e)}});var wM=XO,IM=TypeError,NM=function(e){if(wM(e))throw IM("The method doesn't accept regular expressions");return e},SM=Mt("match"),TM=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[SM]=!1,"/./"[e](t)}catch(e){}}return!1},EM=La,CM=ro,AM=P.f,RM=Hr,_M=Ya,OM=NM,FM=fe,DM=TM,MM=CM("".endsWith),LM=CM("".slice),zM=Math.min,PM=DM("endsWith"),BM=!PM&&!!function(){var e=AM(String.prototype,"endsWith");return e&&!e.writable}();EM({target:"String",proto:!0,forced:!BM&&!PM},{endsWith:function(e){var t=_M(FM(this));OM(e);var n=arguments.length>1?arguments[1]:void 0,r=t.length,a=void 0===n?r:zM(RM(n),r),i=_M(e);return MM?MM(t,i,a):LM(t,a-i.length,a)===i}});var WM=La,VM=ee,UM=Ur,GM=RangeError,jM=String.fromCharCode,HM=String.fromCodePoint,qM=VM([].join);WM({target:"String",stat:!0,arity:1,forced:!!HM&&1!=HM.length},{fromCodePoint:function(e){for(var t,n=[],r=arguments.length,a=0;r>a;){if(t=+arguments[a++],UM(t,1114111)!==t)throw GM(t+" is not a valid code point");n[a]=t<65536?jM(t):jM(55296+((t-=65536)>>10),t%1024+56320)}return qM(n,"")}});var KM=La,XM=NM,YM=fe,JM=Ya,ZM=TM,QM=ee("".indexOf);KM({target:"String",proto:!0,forced:!ZM("includes")},{includes:function(e){return!!~QM(JM(YM(this)),JM(XM(e)),arguments.length>1?arguments[1]:void 0)}});var $M=xM.charAt,eL=Ya,tL=cr,nL=Dd,rL=Md,aL="String Iterator",iL=tL.set,oL=tL.getterFor(aL);nL(String,"String",(function(e){iL(this,{type:aL,string:eL(e),index:0})}),(function(){var e,t=oL(this),n=t.string,r=t.index;return r>=n.length?rL(void 0,!0):(e=$M(n,r),t.index+=e.length,rL(e,!1))}));var sL=ro,uL=Or,cL=TD,lL=B,hL=Mt,pL=Cn,fL=hL("species"),dL=RegExp.prototype,vL=function(e,t,n,r){var a=hL(e),i=!lL((function(){var t={};return t[a]=function(){return 7},7!=""[e](t)})),o=i&&!lL((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[fL]=function(){return n},n.flags="",n[a]=/./[a]),n.exec=function(){return t=!0,null},n[a](""),!t}));if(!i||!o||n){var s=sL(/./[a]),u=t(a,""[e],(function(e,t,n,r,a){var o=sL(e),u=t.exec;return u===cL||u===dL.exec?i&&!a?{done:!0,value:s(t,n,r)}:{done:!0,value:o(n,t,r)}:{done:!1}}));uL(String.prototype,e,u[0]),uL(dL,a,u[1])}r&&pL(dL[a],"sham",!0)},mL=xM.charAt,gL=function(e,t,n){return t+(n?mL(e,t).length:1)},yL=j,bL=dn,xL=xe,kL=ae,wL=TD,IL=TypeError,NL=function(e,t){var n=e.exec;if(xL(n)){var r=yL(n,e,t);return null!==r&&bL(r),r}if("RegExp"===kL(e))return yL(wL,e,t);throw IL("RegExp#exec called on incompatible receiver")},SL=j,TL=dn,EL=le,CL=Hr,AL=Ya,RL=fe,_L=et,OL=gL,FL=NL;vL("match",(function(e,t,n){return[function(t){var n=RL(this),r=EL(t)?void 0:_L(t,e);return r?SL(r,t,n):new RegExp(t)[e](AL(n))},function(e){var r=TL(this),a=AL(e),i=n(t,r,a);if(i.done)return i.value;if(!r.global)return FL(r,a);var o=r.unicode;r.lastIndex=0;for(var s,u=[],c=0;null!==(s=FL(r,a));){var l=AL(s[0]);u[c]=l,""===l&&(r.lastIndex=OL(a,CL(r.lastIndex),o)),c++}return 0===c?null:u}]}));var DL=La,ML=j,LL=ro,zL=dd,PL=Md,BL=fe,WL=Hr,VL=Ya,UL=dn,GL=le,jL=XO,HL=nF,qL=et,KL=Or,XL=B,YL=Kb,JL=gL,ZL=NL,QL=cr,$L=Mt("matchAll"),ez="RegExp String",tz="RegExp String Iterator",nz=QL.set,rz=QL.getterFor(tz),az=RegExp.prototype,iz=TypeError,oz=LL("".indexOf),sz=LL("".matchAll),uz=!!sz&&!XL((function(){sz("a",/./)})),cz=zL((function(e,t,n,r){nz(this,{type:tz,regexp:e,string:t,global:n,unicode:r,done:!1})}),ez,(function(){var e=rz(this);if(e.done)return PL(void 0,!0);var t=e.regexp,n=e.string,r=ZL(t,n);return null===r?(e.done=!0,PL(void 0,!0)):e.global?(""===VL(r[0])&&(t.lastIndex=JL(n,WL(t.lastIndex),e.unicode)),PL(r,!1)):(e.done=!0,PL(r,!1))})),lz=function(e){var t,n,r,a=UL(this),i=VL(e),o=YL(a,RegExp),s=VL(HL(a));return t=new o(o===RegExp?a.source:a,s),n=!!~oz(s,"g"),r=!!~oz(s,"u"),t.lastIndex=WL(a.lastIndex),new cz(t,i,n,r)};DL({target:"String",proto:!0,forced:uz},{matchAll:function(e){var t,n,r,a=BL(this);if(GL(e)){if(uz)return sz(a,e)}else{if(jL(e)&&(t=VL(BL(HL(e))),!~oz(t,"g")))throw iz("`.matchAll` does not allow non-global regexes");if(uz)return sz(a,e);if(r=qL(e,$L))return ML(r,e,a)}return n=VL(a),new RegExp(e,"g")[$L](n)}}),$L in az||KL(az,$L,lz);var hz=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Ae),pz=Fx.end;La({target:"String",proto:!0,forced:hz},{padEnd:function(e){return pz(this,e,arguments.length>1?arguments[1]:void 0)}});var fz=Fx.start;La({target:"String",proto:!0,forced:hz},{padStart:function(e){return fz(this,e,arguments.length>1?arguments[1]:void 0)}});var dz=La,vz=ee,mz=me,gz=yt,yz=Ya,bz=Kr,xz=vz([].push),kz=vz([].join);dz({target:"String",stat:!0},{raw:function(e){var t=mz(gz(e).raw),n=bz(t);if(!n)return"";for(var r=arguments.length,a=[],i=0;;){if(xz(a,yz(t[i++])),i===n)return kz(a,"");i<r&&xz(a,yz(arguments[i]))}}}),La({target:"String",proto:!0},{repeat:Nx});var wz=ee,Iz=yt,Nz=Math.floor,Sz=wz("".charAt),Tz=wz("".replace),Ez=wz("".slice),Cz=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Az=/\$([$&'`]|\d{1,2})/g,Rz=function(e,t,n,r,a,i){var o=n+e.length,s=r.length,u=Az;return void 0!==a&&(a=Iz(a),u=Cz),Tz(i,u,(function(i,u){var c;switch(Sz(u,0)){case"$":return"$";case"&":return e;case"`":return Ez(t,0,n);case"'":return Ez(t,o);case"<":c=a[Ez(u,1,-1)];break;default:var l=+u;if(0===l)return i;if(l>s){var h=Nz(l/10);return 0===h?i:h<=s?void 0===r[h-1]?Sz(u,1):r[h-1]+Sz(u,1):i}c=r[l-1]}return void 0===c?"":c}))},_z=fu,Oz=j,Fz=ee,Dz=vL,Mz=B,Lz=dn,zz=xe,Pz=le,Bz=Pr,Wz=Hr,Vz=Ya,Uz=fe,Gz=gL,jz=et,Hz=Rz,qz=NL,Kz=Mt("replace"),Xz=Math.max,Yz=Math.min,Jz=Fz([].concat),Zz=Fz([].push),Qz=Fz("".indexOf),$z=Fz("".slice),eP="$0"==="a".replace(/./,"$0"),tP=!!/./[Kz]&&""===/./[Kz]("a","$0"),nP=!Mz((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));Dz("replace",(function(e,t,n){var r=tP?"$":"$0";return[function(e,n){var r=Uz(this),a=Pz(e)?void 0:jz(e,Kz);return a?Oz(a,e,r,n):Oz(t,Vz(r),e,n)},function(e,a){var i=Lz(this),o=Vz(e);if("string"==typeof a&&-1===Qz(a,r)&&-1===Qz(a,"$<")){var s=n(t,i,o,a);if(s.done)return s.value}var u=zz(a);u||(a=Vz(a));var c=i.global;if(c){var l=i.unicode;i.lastIndex=0}for(var h=[];;){var p=qz(i,o);if(null===p)break;if(Zz(h,p),!c)break;""===Vz(p[0])&&(i.lastIndex=Gz(o,Wz(i.lastIndex),l))}for(var f,d="",v=0,m=0;m<h.length;m++){for(var g=Vz((p=h[m])[0]),y=Xz(Yz(Bz(p.index),o.length),0),b=[],x=1;x<p.length;x++)Zz(b,void 0===(f=p[x])?f:String(f));var k=p.groups;if(u){var w=Jz([g],b,y,o);void 0!==k&&Zz(w,k);var I=Vz(_z(a,void 0,w))}else I=Hz(g,o,y,b,k,a);y>=v&&(d+=$z(o,v,y)+I,v=y+g.length)}return d+$z(o,v)}]}),!nP||!eP||tP);var rP=La,aP=j,iP=ee,oP=fe,sP=xe,uP=le,cP=XO,lP=Ya,hP=et,pP=nF,fP=Rz,dP=Mt("replace"),vP=TypeError,mP=iP("".indexOf),gP=(iP("".replace),iP("".slice)),yP=Math.max,bP=function(e,t,n){return n>e.length?-1:""===t?n:mP(e,t,n)};rP({target:"String",proto:!0},{replaceAll:function(e,t){var n,r,a,i,o,s,u,c,l=oP(this),h=0,p=0,f="";if(!uP(e)){if(cP(e)&&(n=lP(oP(pP(e))),!~mP(n,"g")))throw vP("`.replaceAll` does not allow non-global regexes");if(r=hP(e,dP))return aP(r,e,l,t)}for(a=lP(l),i=lP(e),(o=sP(t))||(t=lP(t)),s=i.length,u=yP(1,s),h=bP(a,i,0);-1!==h;)c=o?lP(t(i,h,a)):fP(i,a,h,[],void 0,t),f+=gP(a,p,h)+c,p=h+s,h=bP(a,i,h+u);return p<a.length&&(f+=gP(a,p)),f}});var xP=j,kP=dn,wP=le,IP=fe,NP=xE,SP=Ya,TP=et,EP=NL;vL("search",(function(e,t,n){return[function(t){var n=IP(this),r=wP(t)?void 0:TP(t,e);return r?xP(r,t,n):new RegExp(t)[e](SP(n))},function(e){var r=kP(this),a=SP(e),i=n(t,r,a);if(i.done)return i.value;var o=r.lastIndex;NP(o,0)||(r.lastIndex=0);var s=EP(r,a);return NP(r.lastIndex,o)||(r.lastIndex=o),null===s?-1:s.index}]}));var CP=fu,AP=j,RP=ee,_P=vL,OP=dn,FP=le,DP=XO,MP=fe,LP=Kb,zP=gL,PP=Hr,BP=Ya,WP=et,VP=Ai,UP=NL,GP=TD,jP=B,HP=uF.UNSUPPORTED_Y,qP=4294967295,KP=Math.min,XP=[].push,YP=RP(/./.exec),JP=RP(XP),ZP=RP("".slice),QP=!jP((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));_P("split",(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=BP(MP(this)),a=void 0===n?qP:n>>>0;if(0===a)return[];if(void 0===e)return[r];if(!DP(e))return AP(t,r,e,a);for(var i,o,s,u=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),l=0,h=new RegExp(e.source,c+"g");(i=AP(GP,h,r))&&!((o=h.lastIndex)>l&&(JP(u,ZP(r,l,i.index)),i.length>1&&i.index<r.length&&CP(XP,u,VP(i,1)),s=i[0].length,l=o,u.length>=a));)h.lastIndex===i.index&&h.lastIndex++;return l===r.length?!s&&YP(h,"")||JP(u,""):JP(u,ZP(r,l)),u.length>a?VP(u,0,a):u}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:AP(t,this,e,n)}:t,[function(t,n){var a=MP(this),i=FP(t)?void 0:WP(t,e);return i?AP(i,t,a,n):AP(r,BP(a),t,n)},function(e,a){var i=OP(this),o=BP(e),s=n(r,i,o,a,r!==t);if(s.done)return s.value;var u=LP(i,RegExp),c=i.unicode,l=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(HP?"g":"y"),h=new u(HP?"^(?:"+i.source+")":i,l),p=void 0===a?qP:a>>>0;if(0===p)return[];if(0===o.length)return null===UP(h,o)?[o]:[];for(var f=0,d=0,v=[];d<o.length;){h.lastIndex=HP?0:d;var m,g=UP(h,HP?ZP(o,d):o);if(null===g||(m=KP(PP(h.lastIndex+(HP?d:0)),o.length))===f)d=zP(o,d,c);else{if(JP(v,ZP(o,f,d)),v.length===p)return v;for(var y=1;y<=g.length-1;y++)if(JP(v,g[y]),v.length===p)return v;d=f=m}}return JP(v,ZP(o,f)),v}]}),!QP,HP);var $P=La,eB=ro,tB=P.f,nB=Hr,rB=Ya,aB=NM,iB=fe,oB=TM,sB=eB("".startsWith),uB=eB("".slice),cB=Math.min,lB=oB("startsWith"),hB=!lB&&!!function(){var e=tB(String.prototype,"startsWith");return e&&!e.writable}();$P({target:"String",proto:!0,forced:!hB&&!lB},{startsWith:function(e){var t=rB(iB(this));aB(e);var n=nB(cB(arguments.length>1?arguments[1]:void 0,t.length)),r=rB(e);return sB?sB(t,r,n):uB(t,n,n+r.length)===r}});var pB=La,fB=fe,dB=Pr,vB=Ya,mB=ee("".slice),gB=Math.max,yB=Math.min;pB({target:"String",proto:!0,forced:!"".substr||"b"!=="ab".substr(-1)},{substr:function(e,t){var n,r,a=vB(fB(this)),i=a.length,o=dB(e);return o===1/0&&(o=0),o<0&&(o=gB(i+o,0)),(n=void 0===t?i:dB(t))<=0||n===1/0||o>=(r=yB(o+n,i))?"":mB(a,o,r)}});var bB=Mn.PROPER,xB=B,kB=fN,wB=function(e){return xB((function(){return!!kB[e]()||"…"!=="…"[e]()||bB&&kB[e].name!==e}))},IB=kN.trim;La({target:"String",proto:!0,forced:wB("trim")},{trim:function(){return IB(this)}});var NB=kN.end,SB=wB("trimEnd")?function(){return NB(this)}:"".trimEnd;La({target:"String",proto:!0,name:"trimEnd",forced:"".trimRight!==SB},{trimRight:SB});La({target:"String",proto:!0,name:"trimEnd",forced:"".trimEnd!==SB},{trimEnd:SB});var TB=kN.start,EB=wB("trimStart")?function(){return TB(this)}:"".trimStart;La({target:"String",proto:!0,name:"trimStart",forced:"".trimLeft!==EB},{trimLeft:EB});La({target:"String",proto:!0,name:"trimStart",forced:"".trimStart!==EB},{trimStart:EB});var CB=fe,AB=Ya,RB=/"/g,_B=ee("".replace),OB=function(e,t,n,r){var a=AB(CB(e)),i="<"+t;return""!==n&&(i+=" "+n+'="'+_B(AB(r),RB,"&quot;")+'"'),i+">"+a+"</"+t+">"},FB=B,DB=function(e){return FB((function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}))},MB=OB;La({target:"String",proto:!0,forced:DB("anchor")},{anchor:function(e){return MB(this,"a","name",e)}});var LB=OB;La({target:"String",proto:!0,forced:DB("big")},{big:function(){return LB(this,"big","","")}});var zB=OB;La({target:"String",proto:!0,forced:DB("blink")},{blink:function(){return zB(this,"blink","","")}});var PB=OB;La({target:"String",proto:!0,forced:DB("bold")},{bold:function(){return PB(this,"b","","")}});var BB=OB;La({target:"String",proto:!0,forced:DB("fixed")},{fixed:function(){return BB(this,"tt","","")}});var WB=OB;La({target:"String",proto:!0,forced:DB("fontcolor")},{fontcolor:function(e){return WB(this,"font","color",e)}});var VB=OB;La({target:"String",proto:!0,forced:DB("fontsize")},{fontsize:function(e){return VB(this,"font","size",e)}});var UB=OB;La({target:"String",proto:!0,forced:DB("italics")},{italics:function(){return UB(this,"i","","")}});var GB=OB;La({target:"String",proto:!0,forced:DB("link")},{link:function(e){return GB(this,"a","href",e)}});var jB=OB;La({target:"String",proto:!0,forced:DB("small")},{small:function(){return jB(this,"small","","")}});var HB=OB;La({target:"String",proto:!0,forced:DB("strike")},{strike:function(){return HB(this,"strike","","")}});var qB=OB;La({target:"String",proto:!0,forced:DB("sub")},{sub:function(){return qB(this,"sub","","")}});var KB=OB;La({target:"String",proto:!0,forced:DB("sup")},{sup:function(){return KB(this,"sup","","")}});var XB={exports:{}},YB=z,JB=B,ZB=Vf,QB=Pb.NATIVE_ARRAY_BUFFER_VIEWS,$B=YB.ArrayBuffer,eW=YB.Int8Array,tW=!QB||!JB((function(){eW(1)}))||!JB((function(){new eW(-1)}))||!ZB((function(e){new eW,new eW(null),new eW(1.5),new eW(e)}),!0)||JB((function(){return 1!==new eW(new $B(2),1,void 0).length})),nW=Pr,rW=RangeError,aW=function(e){var t=nW(e);if(t<0)throw rW("The argument can't be less than 0");return t},iW=aW,oW=RangeError,sW=function(e,t){var n=iW(e);if(n%t)throw oW("Wrong offset");return n},uW=qa,cW=function(e){var t=uW(e);return"BigInt64Array"==t||"BigUint64Array"==t},lW=Gt,hW=TypeError,pW=function(e){var t=lW(e,"number");if("number"==typeof t)throw hW("Can't convert number to bigint");return BigInt(t)},fW=so,dW=j,vW=Ub,mW=yt,gW=Kr,yW=eh,bW=Kl,xW=Vl,kW=cW,wW=Pb.aTypedArrayConstructor,IW=pW,NW=function(e){var t,n,r,a,i,o,s,u,c=vW(this),l=mW(e),h=arguments.length,p=h>1?arguments[1]:void 0,f=void 0!==p,d=bW(l);if(d&&!xW(d))for(u=(s=yW(l,d)).next,l=[];!(o=dW(u,s)).done;)l.push(o.value);for(f&&h>2&&(p=fW(p,arguments[2])),n=gW(l),r=new(wW(c))(n),a=kW(r),t=0;n>t;t++)i=f?p(l[t],t):l[t],r[t]=a?IW(i):+i;return r},SW=(XB.exports,La),TW=z,EW=j,CW=W,AW=tW,RW=Pb,_W=Zy,OW=zg,FW=Y,DW=Cn,MW=nS,LW=Hr,zW=Vg,PW=sW,BW=qt,WW=kt,VW=qa,UW=Ie,GW=He,jW=yi,HW=Ce,qW=Tc,KW=Fr.f,XW=NW,YW=Wo.forEach,JW=Fm,ZW=zi,QW=cn,$W=P,eV=Oc,tV=cr.get,nV=cr.set,rV=cr.enforce,aV=QW.f,iV=$W.f,oV=Math.round,sV=TW.RangeError,uV=_W.ArrayBuffer,cV=uV.prototype,lV=_W.DataView,hV=RW.NATIVE_ARRAY_BUFFER_VIEWS,pV=RW.TYPED_ARRAY_TAG,fV=RW.TypedArray,dV=RW.TypedArrayPrototype,vV=RW.aTypedArrayConstructor,mV=RW.isTypedArray,gV="BYTES_PER_ELEMENT",yV="Wrong length",bV=function(e,t){vV(e);for(var n=0,r=t.length,a=new e(r);r>n;)a[n]=t[n++];return a},xV=function(e,t){ZW(e,t,{configurable:!0,get:function(){return tV(this)[t]}})},kV=function(e){var t;return HW(cV,e)||"ArrayBuffer"==(t=VW(e))||"SharedArrayBuffer"==t},wV=function(e,t){return mV(e)&&!GW(t)&&t in e&&MW(+t)&&t>=0},IV=function(e,t){return t=BW(t),wV(e,t)?FW(2,e[t]):iV(e,t)},NV=function(e,t,n){return t=BW(t),!(wV(e,t)&&UW(n)&&WW(n,"value"))||WW(n,"get")||WW(n,"set")||n.configurable||WW(n,"writable")&&!n.writable||WW(n,"enumerable")&&!n.enumerable?aV(e,t,n):(e[t]=n.value,e)};CW?(hV||($W.f=IV,QW.f=NV,xV(dV,"buffer"),xV(dV,"byteOffset"),xV(dV,"byteLength"),xV(dV,"length")),SW({target:"Object",stat:!0,forced:!hV},{getOwnPropertyDescriptor:IV,defineProperty:NV}),XB.exports=function(e,t,n){var r=e.match(/\d+/)[0]/8,a=e+(n?"Clamped":"")+"Array",i="get"+e,o="set"+e,s=TW[a],u=s,c=u&&u.prototype,l={},h=function(e,t){aV(e,t,{get:function(){return function(e,t){var n=tV(e);return n.view[i](t*r+n.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,a){var i=tV(e);n&&(a=(a=oV(a))<0?0:a>255?255:255&a),i.view[o](t*r+i.byteOffset,a,!0)}(this,t,e)},enumerable:!0})};hV?AW&&(u=t((function(e,t,n,a){return OW(e,c),eV(UW(t)?kV(t)?void 0!==a?new s(t,PW(n,r),a):void 0!==n?new s(t,PW(n,r)):new s(t):mV(t)?bV(u,t):EW(XW,u,t):new s(zW(t)),e,u)})),qW&&qW(u,fV),YW(KW(s),(function(e){e in u||DW(u,e,s[e])})),u.prototype=c):(u=t((function(e,t,n,a){OW(e,c);var i,o,s,l=0,p=0;if(UW(t)){if(!kV(t))return mV(t)?bV(u,t):EW(XW,u,t);i=t,p=PW(n,r);var f=t.byteLength;if(void 0===a){if(f%r)throw sV(yV);if((o=f-p)<0)throw sV(yV)}else if((o=LW(a)*r)+p>f)throw sV(yV);s=o/r}else s=zW(t),i=new uV(o=s*r);for(nV(e,{buffer:i,byteOffset:p,byteLength:o,length:s,view:new lV(i)});l<s;)h(e,l++)})),qW&&qW(u,fV),c=u.prototype=jW(dV)),c.constructor!==u&&DW(c,"constructor",u),rV(c).TypedArrayConstructor=u,pV&&DW(c,pV,a);var p=u!=s;l[a]=u,SW({global:!0,constructor:!0,forced:p,sham:!hV},l),gV in u||DW(u,gV,r),gV in c||DW(c,gV,r),JW(a)}):XB.exports=function(){};var SV=XB.exports;SV("Float32",(function(e){return function(t,n,r){return e(this,t,n,r)}})),SV("Float64",(function(e){return function(t,n,r){return e(this,t,n,r)}})),SV("Int8",(function(e){return function(t,n,r){return e(this,t,n,r)}})),SV("Int16",(function(e){return function(t,n,r){return e(this,t,n,r)}})),SV("Int32",(function(e){return function(t,n,r){return e(this,t,n,r)}})),SV("Uint8",(function(e){return function(t,n,r){return e(this,t,n,r)}})),SV("Uint8",(function(e){return function(t,n,r){return e(this,t,n,r)}}),!0),SV("Uint16",(function(e){return function(t,n,r){return e(this,t,n,r)}})),SV("Uint32",(function(e){return function(t,n,r){return e(this,t,n,r)}}));var TV=Kr,EV=Pr,CV=Pb.aTypedArray;(0,Pb.exportTypedArrayMethod)("at",(function(e){var t=CV(this),n=TV(t),r=EV(e),a=r>=0?r:n+r;return a<0||a>=n?void 0:t[a]}));var AV=Pb,RV=ee(Ep),_V=AV.aTypedArray;(0,AV.exportTypedArrayMethod)("copyWithin",(function(e,t){return RV(_V(this),e,t,arguments.length>2?arguments[2]:void 0)}));var OV=Wo.every,FV=Pb.aTypedArray;(0,Pb.exportTypedArrayMethod)("every",(function(e){return OV(FV(this),e,arguments.length>1?arguments[1]:void 0)}));var DV=Mp,MV=pW,LV=qa,zV=j,PV=B,BV=Pb.aTypedArray,WV=Pb.exportTypedArrayMethod,VV=ee("".slice),UV=PV((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e}));WV("fill",(function(e){var t=arguments.length;BV(this);var n="Big"===VV(LV(this),0,3)?MV(e):+e;return zV(DV,this,n,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),UV);var GV=Kb,jV=Pb.aTypedArrayConstructor,HV=Pb.getTypedArrayConstructor,qV=function(e){return jV(GV(e,HV(e)))},KV=eg,XV=qV,YV=function(e,t){return KV(XV(e),t)},JV=Wo.filter,ZV=YV,QV=Pb.aTypedArray;(0,Pb.exportTypedArrayMethod)("filter",(function(e){var t=JV(QV(this),e,arguments.length>1?arguments[1]:void 0);return ZV(this,t)}));var $V=Wo.find,eU=Pb.aTypedArray;(0,Pb.exportTypedArrayMethod)("find",(function(e){return $V(eU(this),e,arguments.length>1?arguments[1]:void 0)}));var tU=Wo.findIndex,nU=Pb.aTypedArray;(0,Pb.exportTypedArrayMethod)("findIndex",(function(e){return tU(nU(this),e,arguments.length>1?arguments[1]:void 0)}));var rU=$p.findLast,aU=Pb.aTypedArray;(0,Pb.exportTypedArrayMethod)("findLast",(function(e){return rU(aU(this),e,arguments.length>1?arguments[1]:void 0)}));var iU=$p.findLastIndex,oU=Pb.aTypedArray;(0,Pb.exportTypedArrayMethod)("findLastIndex",(function(e){return iU(oU(this),e,arguments.length>1?arguments[1]:void 0)}));var sU=Wo.forEach,uU=Pb.aTypedArray;(0,Pb.exportTypedArrayMethod)("forEach",(function(e){sU(uU(this),e,arguments.length>1?arguments[1]:void 0)})),(0,Pb.exportTypedArrayStaticMethod)("from",NW,tW);var cU=Qr.includes,lU=Pb.aTypedArray;(0,Pb.exportTypedArrayMethod)("includes",(function(e){return cU(lU(this),e,arguments.length>1?arguments[1]:void 0)}));var hU=Qr.indexOf,pU=Pb.aTypedArray;(0,Pb.exportTypedArrayMethod)("indexOf",(function(e){return hU(pU(this),e,arguments.length>1?arguments[1]:void 0)}));var fU=z,dU=B,vU=ee,mU=Pb,gU=Kd,yU=Mt("iterator"),bU=fU.Uint8Array,xU=vU(gU.values),kU=vU(gU.keys),wU=vU(gU.entries),IU=mU.aTypedArray,NU=mU.exportTypedArrayMethod,SU=bU&&bU.prototype,TU=!dU((function(){SU[yU].call([1])})),EU=!!SU&&SU.values&&SU[yU]===SU.values&&"values"===SU.values.name,CU=function(){return xU(IU(this))};NU("entries",(function(){return wU(IU(this))}),TU),NU("keys",(function(){return kU(IU(this))}),TU),NU("values",CU,TU||!EU,{name:"values"}),NU(yU,CU,TU||!EU,{name:"values"});var AU=Pb.aTypedArray,RU=Pb.exportTypedArrayMethod,_U=ee([].join);RU("join",(function(e){return _U(AU(this),e)}));var OU=fu,FU=cv,DU=Pb.aTypedArray;(0,Pb.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return OU(FU,DU(this),t>1?[e,arguments[1]]:[e])}));var MU=Wo.map,LU=qV,zU=Pb.aTypedArray;(0,Pb.exportTypedArrayMethod)("map",(function(e){return MU(zU(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(LU(e))(t)}))}));var PU=Pb.aTypedArrayConstructor;(0,Pb.exportTypedArrayStaticMethod)("of",(function(){for(var e=0,t=arguments.length,n=new(PU(this))(t);t>e;)n[e]=arguments[e++];return n}),tW);var BU=Av.left,WU=Pb.aTypedArray;(0,Pb.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return BU(WU(this),e,t,t>1?arguments[1]:void 0)}));var VU=Av.right,UU=Pb.aTypedArray;(0,Pb.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return VU(UU(this),e,t,t>1?arguments[1]:void 0)}));var GU=Pb.aTypedArray,jU=Pb.exportTypedArrayMethod,HU=Math.floor;jU("reverse",(function(){for(var e,t=this,n=GU(t).length,r=HU(n/2),a=0;a<r;)e=t[a],t[a++]=t[--n],t[n]=e;return t}));var qU=z,KU=j,XU=Pb,YU=Kr,JU=sW,ZU=yt,QU=B,$U=qU.RangeError,eG=qU.Int8Array,tG=eG&&eG.prototype,nG=tG&&tG.set,rG=XU.aTypedArray,aG=XU.exportTypedArrayMethod,iG=!QU((function(){var e=new Uint8ClampedArray(2);return KU(nG,e,{length:1,0:3},1),3!==e[1]})),oG=iG&&XU.NATIVE_ARRAY_BUFFER_VIEWS&&QU((function(){var e=new eG(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));aG("set",(function(e){rG(this);var t=JU(arguments.length>1?arguments[1]:void 0,1),n=ZU(e);if(iG)return KU(nG,this,n,t);var r=this.length,a=YU(n),i=0;if(a+t>r)throw $U("Wrong length");for(;i<a;)this[t+i]=n[i++]}),!iG||oG);var sG=qV,uG=du,cG=Pb.aTypedArray;(0,Pb.exportTypedArrayMethod)("slice",(function(e,t){for(var n=uG(cG(this),e,t),r=sG(this),a=0,i=n.length,o=new r(i);i>a;)o[a]=n[a++];return o}),B((function(){new Int8Array(1).slice()})));var lG=Wo.some,hG=Pb.aTypedArray;(0,Pb.exportTypedArrayMethod)("some",(function(e){return lG(hG(this),e,arguments.length>1?arguments[1]:void 0)}));var pG=ro,fG=B,dG=Ze,vG=nm,mG=am,gG=im,yG=Le,bG=sm,xG=Pb.aTypedArray,kG=Pb.exportTypedArrayMethod,wG=z.Uint16Array,IG=wG&&pG(wG.prototype.sort),NG=!(!IG||fG((function(){IG(new wG(2),null)}))&&fG((function(){IG(new wG(2),{})}))),SG=!!IG&&!fG((function(){if(yG)return yG<74;if(mG)return mG<67;if(gG)return!0;if(bG)return bG<602;var e,t,n=new wG(516),r=Array(516);for(e=0;e<516;e++)t=e%4,n[e]=515-e,r[e]=e-2*t+3;for(IG(n,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(n[e]!==r[e])return!0}));kG("sort",(function(e){return void 0!==e&&dG(e),SG?IG(this,e):vG(xG(this),function(e){return function(t,n){return void 0!==e?+e(t,n)||0:n!=n?-1:t!=t?1:0===t&&0===n?1/t>0&&1/n<0?1:-1:t>n}}(e))}),!SG||NG);var TG=Hr,EG=Ur,CG=qV,AG=Pb.aTypedArray;(0,Pb.exportTypedArrayMethod)("subarray",(function(e,t){var n=AG(this),r=n.length,a=EG(e,r);return new(CG(n))(n.buffer,n.byteOffset+a*n.BYTES_PER_ELEMENT,TG((void 0===t?r:EG(t,r))-a))}));var RG=fu,_G=Pb,OG=B,FG=du,DG=z.Int8Array,MG=_G.aTypedArray,LG=_G.exportTypedArrayMethod,zG=[].toLocaleString,PG=!!DG&&OG((function(){zG.call(new DG(1))}));LG("toLocaleString",(function(){return RG(zG,PG?FG(MG(this)):MG(this),FG(arguments))}),OG((function(){return[1,2].toLocaleString()!=new DG([1,2]).toLocaleString()}))||!OG((function(){DG.prototype.toLocaleString.call([1,2])})));var BG=Xm,WG=Pb.aTypedArray,VG=Pb.getTypedArrayConstructor;(0,Pb.exportTypedArrayMethod)("toReversed",(function(){return BG(WG(this),VG(this))}));var UG=Ze,GG=eg,jG=Pb.aTypedArray,HG=Pb.getTypedArrayConstructor,qG=Pb.exportTypedArrayMethod,KG=ee(Pb.TypedArrayPrototype.sort);qG("toSorted",(function(e){void 0!==e&&UG(e);var t=jG(this),n=GG(HG(t),t);return KG(n,e)}));var XG=Pb.exportTypedArrayMethod,YG=B,JG=ee,ZG=z.Uint8Array,QG=ZG&&ZG.prototype||{},$G=[].toString,ej=JG([].join);YG((function(){$G.call({})}))&&($G=function(){return ej(this)});var tj=QG.toString!=$G;XG("toString",$G,tj);var nj=Cg,rj=cW,aj=Pr,ij=pW,oj=Pb.aTypedArray,sj=Pb.getTypedArrayConstructor,uj=Pb.exportTypedArrayMethod,cj=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(e){return 8===e}}();uj("with",{with:function(e,t){var n=oj(this),r=aj(e),a=rj(n)?ij(t):+t;return nj(n,sj(n),r,a)}}.with,!cj);var lj=La,hj=ee,pj=Ya,fj=String.fromCharCode,dj=hj("".charAt),vj=hj(/./.exec),mj=hj("".slice),gj=/^[\da-f]{2}$/i,yj=/^[\da-f]{4}$/i;lj({global:!0},{unescape:function(e){for(var t,n,r=pj(e),a="",i=r.length,o=0;o<i;){if("%"===(t=dj(r,o++)))if("u"===dj(r,o)){if(n=mj(r,o+1,o+5),vj(yj,n)){a+=fj(parseInt(n,16)),o+=5;continue}}else if(n=mj(r,o,o+2),vj(gj,n)){a+=fj(parseInt(n,16)),o+=2;continue}a+=t}return a}});var bj=ee,xj=Dg,kj=Sw.getWeakData,wj=zg,Ij=dn,Nj=le,Sj=Ie,Tj=yh,Ej=kt,Cj=cr.set,Aj=cr.getterFor,Rj=Wo.find,_j=Wo.findIndex,Oj=bj([].splice),Fj=0,Dj=function(e){return e.frozen||(e.frozen=new Mj)},Mj=function(){this.entries=[]},Lj=function(e,t){return Rj(e.entries,(function(e){return e[0]===t}))};Mj.prototype={get:function(e){var t=Lj(this,e);if(t)return t[1]},has:function(e){return!!Lj(this,e)},set:function(e,t){var n=Lj(this,e);n?n[1]=t:this.entries.push([e,t])},delete:function(e){var t=_j(this.entries,(function(t){return t[0]===e}));return~t&&Oj(this.entries,t,1),!!~t}};var zj,Pj={getConstructor:function(e,t,n,r){var a=e((function(e,a){wj(e,i),Cj(e,{type:t,id:Fj++,frozen:void 0}),Nj(a)||Tj(a,e[r],{that:e,AS_ENTRIES:n})})),i=a.prototype,o=Aj(t),s=function(e,t,n){var r=o(e),a=kj(Ij(t),!0);return!0===a?Dj(r).set(t,n):a[r.id]=n,e};return xj(i,{delete:function(e){var t=o(this);if(!Sj(e))return!1;var n=kj(e);return!0===n?Dj(t).delete(e):n&&Ej(n,t.id)&&delete n[t.id]},has:function(e){var t=o(this);if(!Sj(e))return!1;var n=kj(e);return!0===n?Dj(t).has(e):n&&Ej(n,t.id)}}),xj(i,n?{get:function(e){var t=o(this);if(Sj(e)){var n=kj(e);return!0===n?Dj(t).get(e):n?n[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),a}},Bj=cw,Wj=z,Vj=ee,Uj=Dg,Gj=Sw,jj=Vw,Hj=Pj,qj=Ie,Kj=cr.enforce,Xj=B,Yj=Hn,Jj=Object,Zj=Array.isArray,Qj=Jj.isExtensible,$j=Jj.isFrozen,eH=Jj.isSealed,tH=Jj.freeze,nH=Jj.seal,rH={},aH={},iH=!Wj.ActiveXObject&&"ActiveXObject"in Wj,oH=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},sH=jj("WeakMap",oH,Hj),uH=sH.prototype,cH=Vj(uH.set);if(Yj)if(iH){zj=Hj.getConstructor(oH,"WeakMap",!0),Gj.enable();var lH=Vj(uH.delete),hH=Vj(uH.has),pH=Vj(uH.get);Uj(uH,{delete:function(e){if(qj(e)&&!Qj(e)){var t=Kj(this);return t.frozen||(t.frozen=new zj),lH(this,e)||t.frozen.delete(e)}return lH(this,e)},has:function(e){if(qj(e)&&!Qj(e)){var t=Kj(this);return t.frozen||(t.frozen=new zj),hH(this,e)||t.frozen.has(e)}return hH(this,e)},get:function(e){if(qj(e)&&!Qj(e)){var t=Kj(this);return t.frozen||(t.frozen=new zj),hH(this,e)?pH(this,e):t.frozen.get(e)}return pH(this,e)},set:function(e,t){if(qj(e)&&!Qj(e)){var n=Kj(this);n.frozen||(n.frozen=new zj),hH(this,e)?cH(this,e,t):n.frozen.set(e,t)}else cH(this,e,t);return this}})}else Bj&&Xj((function(){var e=tH([]);return cH(new sH,e,1),!$j(e)}))&&Uj(uH,{set:function(e,t){var n;return Zj(e)&&($j(e)?n=rH:eH(e)&&(n=aH)),cH(this,e,t),n==rH&&tH(e),n==aH&&nH(e),this}});Vw("WeakSet",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Pj);for(var fH="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",dH={},vH=0;vH<66;vH++)dH[fH.charAt(vH)]=vH;var mH={itoc:fH,ctoi:dH},gH=La,yH=z,bH=Ee,xH=ee,kH=j,wH=B,IH=Ya,NH=kt,SH=TC,TH=mH.ctoi,EH=/[^\d+/a-z]/i,CH=/[\t\n\f\r ]+/g,AH=/[=]{1,2}$/,RH=bH("atob"),_H=String.fromCharCode,OH=xH("".charAt),FH=xH("".replace),DH=xH(EH.exec),MH=wH((function(){return""!==RH(" ")})),LH=!wH((function(){RH("a")})),zH=!MH&&!LH&&!wH((function(){RH()})),PH=!MH&&!LH&&1!==RH.length;gH({global:!0,bind:!0,enumerable:!0,forced:MH||LH||zH||PH},{atob:function(e){if(SH(arguments.length,1),zH||PH)return kH(RH,yH,e);var t,n,r=FH(IH(e),CH,""),a="",i=0,o=0;if(r.length%4==0&&(r=FH(r,AH,"")),r.length%4==1||DH(EH,r))throw new(bH("DOMException"))("The string is not correctly encoded","InvalidCharacterError");for(;t=OH(r,i++);)NH(TH,t)&&(n=o%4?64*n+TH[t]:TH[t],o++%4&&(a+=_H(255&n>>(-2*o&6))));return a}});var BH=La,WH=z,VH=Ee,UH=ee,GH=j,jH=B,HH=Ya,qH=TC,KH=mH.itoc,XH=VH("btoa"),YH=UH("".charAt),JH=UH("".charCodeAt),ZH=!!XH&&!jH((function(){XH()})),QH=!!XH&&jH((function(){return"bnVsbA=="!==XH(null)})),$H=!!XH&&1!==XH.length;BH({global:!0,bind:!0,enumerable:!0,forced:ZH||QH||$H},{btoa:function(e){if(qH(arguments.length,1),ZH||QH||$H)return GH(XH,WH,HH(e));for(var t,n,r=HH(e),a="",i=0,o=KH;YH(r,i)||(o="=",i%1);){if((n=JH(r,i+=3/4))>255)throw new(VH("DOMException"))("The string contains characters outside of the Latin1 range","InvalidCharacterError");a+=YH(o,63&(t=t<<8|n)>>8-i%1*8)}return a}});var eq={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},tq=Jt("span").classList,nq=tq&&tq.constructor&&tq.constructor.prototype,rq=nq===Object.prototype?void 0:nq,aq=z,iq=eq,oq=rq,sq=kf,uq=Cn,cq=function(e){if(e&&e.forEach!==sq)try{uq(e,"forEach",sq)}catch(t){e.forEach=sq}};for(var lq in iq)iq[lq]&&cq(aq[lq]&&aq[lq].prototype);cq(oq);var hq=z,pq=eq,fq=rq,dq=Kd,vq=Cn,mq=Mt,gq=mq("iterator"),yq=mq("toStringTag"),bq=dq.values,xq=function(e,t){if(e){if(e[gq]!==bq)try{vq(e,gq,bq)}catch(t){e[gq]=bq}if(e[yq]||vq(e,yq,t),pq[t])for(var n in dq)if(e[n]!==dq[n])try{vq(e,n,dq[n])}catch(t){e[n]=dq[n]}}};for(var kq in pq)xq(hq[kq]&&hq[kq].prototype,kq);xq(fq,"DOMTokenList");var wq=Rv,Iq=function(e){try{if(wq)return Function('return require("'+e+'")')()}catch(e){}},Nq={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}},Sq=La,Tq=Iq,Eq=Ee,Cq=B,Aq=yi,Rq=Y,_q=cn.f,Oq=Or,Fq=zi,Dq=kt,Mq=zg,Lq=dn,zq=Nl,Pq=Dc,Bq=Nq,Wq=Gc,Vq=cr,Uq=W,Gq="DOMException",jq="DATA_CLONE_ERR",Hq=Eq("Error"),qq=Eq(Gq)||function(){try{(new(Eq("MessageChannel")||Tq("worker_threads").MessageChannel)).port1.postMessage(new WeakMap)}catch(e){if(e.name==jq&&25==e.code)return e.constructor}}(),Kq=qq&&qq.prototype,Xq=Hq.prototype,Yq=Vq.set,Jq=Vq.getterFor(Gq),Zq="stack"in Hq(Gq),Qq=function(e){return Dq(Bq,e)&&Bq[e].m?Bq[e].c:0},$q=function(){Mq(this,eK);var e=arguments.length,t=Pq(e<1?void 0:arguments[0]),n=Pq(e<2?void 0:arguments[1],"Error"),r=Qq(n);if(Yq(this,{type:Gq,name:n,message:t,code:r}),Uq||(this.name=n,this.message=t,this.code=r),Zq){var a=Hq(t);a.name=Gq,_q(this,"stack",Rq(1,Wq(a.stack,1)))}},eK=$q.prototype=Aq(Xq),tK=function(e){return{enumerable:!0,configurable:!0,get:e}},nK=function(e){return tK((function(){return Jq(this)[e]}))};Uq&&(Fq(eK,"code",nK("code")),Fq(eK,"message",nK("message")),Fq(eK,"name",nK("name"))),_q(eK,"constructor",Rq(1,$q));var rK=Cq((function(){return!(new qq instanceof Hq)})),aK=rK||Cq((function(){return Xq.toString!==zq||"2: 1"!==String(new qq(1,2))})),iK=rK||Cq((function(){return 25!==new qq(1,"DataCloneError").code}));rK||25!==qq.DATA_CLONE_ERR||Kq.DATA_CLONE_ERR;Sq({global:!0,constructor:!0,forced:rK},{DOMException:rK?$q:qq});var oK=Eq(Gq),sK=oK.prototype;for(var uK in aK&&qq===oK&&Oq(sK,"toString",zq),iK&&Uq&&qq===oK&&Fq(sK,"code",tK((function(){return Qq(Lq(this).name)}))),Bq)if(Dq(Bq,uK)){var cK=Bq[uK],lK=cK.s,hK=Rq(6,cK.c);Dq(oK,lK)||_q(oK,lK,hK),Dq(sK,lK)||_q(sK,lK,hK)}var pK=La,fK=z,dK=Ee,vK=Y,mK=cn.f,gK=kt,yK=zg,bK=Oc,xK=Dc,kK=Nq,wK=Gc,IK=W,NK="DOMException",SK=dK("Error"),TK=dK(NK),EK=function(){yK(this,CK);var e=arguments.length,t=xK(e<1?void 0:arguments[0]),n=xK(e<2?void 0:arguments[1],"Error"),r=new TK(t,n),a=SK(t);return a.name=NK,mK(r,"stack",vK(1,wK(a.stack,1))),bK(r,this,EK),r},CK=EK.prototype=TK.prototype,AK="stack"in SK(NK),RK="stack"in new TK(1,2),_K=TK&&IK&&Object.getOwnPropertyDescriptor(fK,NK),OK=!(!_K||_K.writable&&_K.configurable),FK=AK&&!OK&&!RK;pK({global:!0,constructor:!0,forced:FK},{DOMException:FK?EK:TK});var DK=dK(NK),MK=DK.prototype;if(MK.constructor!==DK)for(var LK in mK(MK,"constructor",vK(1,DK)),kK)if(gK(kK,LK)){var zK=kK[LK],PK=zK.s;gK(DK,PK)||mK(DK,PK,vK(6,zK.c))}var BK="DOMException";eo(Ee(BK),BK);var WK=eA.clear;La({global:!0,bind:!0,enumerable:!0,forced:z.clearImmediate!==WK},{clearImmediate:WK});var VK="function"==typeof Bun&&Bun&&"string"==typeof Bun.version,UK=z,GK=fu,jK=xe,HK=VK,qK=Ae,KK=du,XK=TC,YK=UK.Function,JK=/MSIE .\./.test(qK)||HK&&function(){var e=UK.Bun.version.split(".");return e.length<3||0==e[0]&&(e[1]<3||3==e[1]&&0==e[2])}(),ZK=function(e,t){var n=t?2:1;return JK?function(r,a){var i=XK(arguments.length,1)>n,o=jK(r)?r:YK(r),s=i?KK(arguments,n):[],u=i?function(){GK(o,this,s)}:o;return t?e(u,a):e(u)}:e},QK=La,$K=z,eX=eA.set,tX=ZK,nX=$K.setImmediate?tX(eX,!1):eX;QK({global:!0,bind:!0,enumerable:!0,forced:$K.setImmediate!==nX},{setImmediate:nX});var rX=La,aX=RA,iX=Ze,oX=TC,sX=Rv,uX=z.process;rX({global:!0,enumerable:!0,dontCallGetSet:!0},{queueMicrotask:function(e){oX(arguments.length,1),iX(e);var t=sX&&uX.domain;aX(t?t.bind(e):e)}});var cX=La,lX=z,hX=zi,pX=W,fX=TypeError,dX=Object.defineProperty,vX=lX.self!==lX;try{if(pX){var mX=Object.getOwnPropertyDescriptor(lX,"self");!vX&&mX&&mX.get&&mX.enumerable||hX(lX,"self",{get:function(){return lX},set:function(e){if(this!==lX)throw fX("Illegal invocation");dX(lX,"self",{value:e,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})}else cX({global:!0,simple:!0,forced:vX},{self:lX})}catch(e){}var gX,yX=ee,bX=Map.prototype,xX={Map:Map,set:yX(bX.set),get:yX(bX.get),has:yX(bX.has),remove:yX(bX.delete),proto:bX},kX=ee,wX=Set.prototype,IX={Set:Set,add:kX(wX.add),has:kX(wX.has),remove:kX(wX.delete),proto:wX,$has:wX.has,$keys:wX.keys},NX=B,SX=Le,TX=MA,EX=DA,CX=Rv,AX=z.structuredClone,RX=!!AX&&!NX((function(){if(EX&&SX>92||CX&&SX>94||TX&&SX>97)return!1;var e=new ArrayBuffer(8),t=AX(e,{transfer:[e]});return 0!=e.byteLength||8!=t.byteLength})),_X=La,OX=z,FX=Ee,DX=ee,MX=B,LX=Tt,zX=xe,PX=No,BX=le,WX=Ie,VX=He,UX=yh,GX=dn,jX=qa,HX=kt,qX=Ii,KX=Cn,XX=Kr,YX=TC,JX=nF,ZX=xX,QX=IX,$X=Hc,eY=RX,tY=OX.Object,nY=OX.Array,rY=OX.Date,aY=OX.Error,iY=OX.EvalError,oY=OX.RangeError,sY=OX.ReferenceError,uY=OX.SyntaxError,cY=OX.TypeError,lY=OX.URIError,hY=OX.PerformanceMark,pY=OX.WebAssembly,fY=pY&&pY.CompileError||aY,dY=pY&&pY.LinkError||aY,vY=pY&&pY.RuntimeError||aY,mY=FX("DOMException"),gY=ZX.Map,yY=ZX.has,bY=ZX.get,xY=ZX.set,kY=QX.Set,wY=QX.add,IY=FX("Object","keys"),NY=DX([].push),SY=DX((!0).valueOf),TY=DX(1..valueOf),EY=DX("".valueOf),CY=DX(rY.prototype.getTime),AY=LX("structuredClone"),RY="DataCloneError",_Y="Transferring",OY=function(e){return!MX((function(){var t=new OX.Set([7]),n=e(t),r=e(tY(7));return n==t||!n.has(7)||"object"!=s(r)||7!=r}))&&e},FY=function(e,t){return!MX((function(){var n=new t,r=e({a:n,b:n});return!(r&&r.a===r.b&&r.a instanceof t&&r.a.stack===n.stack)}))},DY=OX.structuredClone,MY=!FY(DY,aY)||!FY(DY,mY)||(gX=DY,!!MX((function(){var e=gX(new OX.AggregateError([1],AY,{cause:3}));return"AggregateError"!=e.name||1!=e.errors[0]||e.message!=AY||3!=e.cause}))),LY=!DY&&OY((function(e){return new hY(AY,{detail:e}).detail})),zY=OY(DY)||LY,PY=function(e){throw new mY("Uncloneable type: "+e,RY)},BY=function(e,t){throw new mY((t||"Cloning")+" of "+e+" cannot be properly polyfilled in this engine",RY)},WY=function e(t,n){if(VX(t)&&PY("Symbol"),!WX(t))return t;if(n){if(yY(n,t))return bY(n,t)}else n=new gY;var r,a,i,o,s,u,c,l,h,p,f,d=jX(t),v=!1;switch(d){case"Array":i=nY(XX(t)),v=!0;break;case"Object":i={},v=!0;break;case"Map":i=new gY,v=!0;break;case"Set":i=new kY,v=!0;break;case"RegExp":i=new RegExp(t.source,JX(t));break;case"Error":switch(a=t.name){case"AggregateError":i=FX("AggregateError")([]);break;case"EvalError":i=iY();break;case"RangeError":i=oY();break;case"ReferenceError":i=sY();break;case"SyntaxError":i=uY();break;case"TypeError":i=cY();break;case"URIError":i=lY();break;case"CompileError":i=fY();break;case"LinkError":i=dY();break;case"RuntimeError":i=vY();break;default:i=aY()}v=!0;break;case"DOMException":i=new mY(t.message,t.name),v=!0;break;case"DataView":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":r=OX[d],WX(r)||BY(d),i=new r(e(t.buffer,n),t.byteOffset,"DataView"===d?t.byteLength:t.length);break;case"DOMQuad":try{i=new DOMQuad(e(t.p1,n),e(t.p2,n),e(t.p3,n),e(t.p4,n))}catch(e){zY?i=zY(t):BY(d)}break;case"FileList":if(o=function(){var e;try{e=new OX.DataTransfer}catch(t){try{e=new OX.ClipboardEvent("").clipboardData}catch(e){}}return e&&e.items&&e.files?e:null}()){for(s=0,u=XX(t);s<u;s++)o.items.add(e(t[s],n));i=o.files}else zY?i=zY(t):BY(d);break;case"ImageData":try{i=new ImageData(e(t.data,n),t.width,t.height,{colorSpace:t.colorSpace})}catch(e){zY?i=zY(t):BY(d)}break;default:if(zY)i=zY(t);else switch(d){case"BigInt":i=tY(t.valueOf());break;case"Boolean":i=tY(SY(t));break;case"Number":i=tY(TY(t));break;case"String":i=tY(EY(t));break;case"Date":i=new rY(CY(t));break;case"ArrayBuffer":(r=OX.DataView)||"function"==typeof t.slice||BY(d);try{if("function"!=typeof t.slice||t.resizable){u=t.byteLength,f="maxByteLength"in t?{maxByteLength:t.maxByteLength}:void 0,i=new ArrayBuffer(u,f),h=new r(t),p=new r(i);for(s=0;s<u;s++)p.setUint8(s,h.getUint8(s))}else i=t.slice(0)}catch(e){throw new mY("ArrayBuffer is detached",RY)}break;case"SharedArrayBuffer":i=t;break;case"Blob":try{i=t.slice(0,t.size,t.type)}catch(e){BY(d)}break;case"DOMPoint":case"DOMPointReadOnly":r=OX[d];try{i=r.fromPoint?r.fromPoint(t):new r(t.x,t.y,t.z,t.w)}catch(e){BY(d)}break;case"DOMRect":case"DOMRectReadOnly":r=OX[d];try{i=r.fromRect?r.fromRect(t):new r(t.x,t.y,t.width,t.height)}catch(e){BY(d)}break;case"DOMMatrix":case"DOMMatrixReadOnly":r=OX[d];try{i=r.fromMatrix?r.fromMatrix(t):new r(t)}catch(e){BY(d)}break;case"AudioData":case"VideoFrame":zX(t.clone)||BY(d);try{i=t.clone()}catch(e){PY(d)}break;case"File":try{i=new File([t],t.name,t)}catch(e){BY(d)}break;case"CropTarget":case"CryptoKey":case"FileSystemDirectoryHandle":case"FileSystemFileHandle":case"FileSystemHandle":case"GPUCompilationInfo":case"GPUCompilationMessage":case"ImageBitmap":case"RTCCertificate":case"WebAssembly.Module":BY(d);default:PY(d)}}if(xY(n,t,i),v)switch(d){case"Array":case"Object":for(c=IY(t),s=0,u=XX(c);s<u;s++)l=c[s],qX(i,l,e(t[l],n));break;case"Map":t.forEach((function(t,r){xY(i,e(r,n),e(t,n))}));break;case"Set":t.forEach((function(t){wY(i,e(t,n))}));break;case"Error":KX(i,"message",e(t.message,n)),HX(t,"cause")&&KX(i,"cause",e(t.cause,n)),"AggregateError"==a&&(i.errors=e(t.errors,n));case"DOMException":$X&&KX(i,"stack",e(t.stack,n))}return i},VY=function(e,t){if(!WX(e))throw cY("Transfer option cannot be converted to a sequence");var n=[];UX(e,(function(e){NY(n,GX(e))}));var r,a,i,o,s,u,c=0,l=XX(n);if(eY)for(o=DY(n,{transfer:n});c<l;)xY(t,n[c],o[c++]);else for(;c<l;){if(r=n[c++],yY(t,r))throw new mY("Duplicate transferable",RY);switch(a=jX(r)){case"ImageBitmap":i=OX.OffscreenCanvas,PX(i)||BY(a,_Y);try{(u=new i(r.width,r.height)).getContext("bitmaprenderer").transferFromImageBitmap(r),s=u.transferToImageBitmap()}catch(e){}break;case"AudioData":case"VideoFrame":zX(r.clone)&&zX(r.close)||BY(a,_Y);try{s=r.clone(),r.close()}catch(e){}break;case"ArrayBuffer":zX(r.transfer)||BY(a,_Y),s=r.transfer();break;case"MediaSourceHandle":case"MessagePort":case"OffscreenCanvas":case"ReadableStream":case"TransformStream":case"WritableStream":BY(a,_Y)}if(void 0===s)throw new mY("This object cannot be transferred: "+a,RY);xY(t,r,s)}};_X({global:!0,enumerable:!0,sham:!eY,forced:MY},{structuredClone:function(e){var t,n=YX(arguments.length,1)>1&&!BX(arguments[1])?GX(arguments[1]):void 0,r=n?n.transfer:void 0;return void 0!==r&&(t=new gY,VY(r,t)),WY(e,t)}});var UY=La,GY=z,jY=ZK(GY.setInterval,!0);UY({global:!0,bind:!0,forced:GY.setInterval!==jY},{setInterval:jY});var HY=La,qY=z,KY=ZK(qY.setTimeout,!0);HY({global:!0,bind:!0,forced:qY.setTimeout!==KY},{setTimeout:KY});var XY=B,YY=W,JY=Mt("iterator"),ZY=!XY((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,n="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),n+=r+e})),!t.size&&!YY||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[JY]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==n||"x"!==new URL("http://x",void 0).host})),QY=ee,$Y=2147483647,eJ=/[^\0-\u007E]/,tJ=/[.\u3002\uFF0E\uFF61]/g,nJ="Overflow: input needs wider integers to process",rJ=RangeError,aJ=QY(tJ.exec),iJ=Math.floor,oJ=String.fromCharCode,sJ=QY("".charCodeAt),uJ=QY([].join),cJ=QY([].push),lJ=QY("".replace),hJ=QY("".split),pJ=QY("".toLowerCase),fJ=function(e){return e+22+75*(e<26)},dJ=function(e,t,n){var r=0;for(e=n?iJ(e/700):e>>1,e+=iJ(e/t);e>455;)e=iJ(e/35),r+=36;return iJ(r+36*e/(e+38))},vJ=function(e){var t=[];e=function(e){for(var t=[],n=0,r=e.length;n<r;){var a=sJ(e,n++);if(a>=55296&&a<=56319&&n<r){var i=sJ(e,n++);56320==(64512&i)?cJ(t,((1023&a)<<10)+(1023&i)+65536):(cJ(t,a),n--)}else cJ(t,a)}return t}(e);var n,r,a=e.length,i=128,o=0,s=72;for(n=0;n<e.length;n++)(r=e[n])<128&&cJ(t,oJ(r));var u=t.length,c=u;for(u&&cJ(t,"-");c<a;){var l=$Y;for(n=0;n<e.length;n++)(r=e[n])>=i&&r<l&&(l=r);var h=c+1;if(l-i>iJ(($Y-o)/h))throw rJ(nJ);for(o+=(l-i)*h,i=l,n=0;n<e.length;n++){if((r=e[n])<i&&++o>$Y)throw rJ(nJ);if(r==i){for(var p=o,f=36;;){var d=f<=s?1:f>=s+26?26:f-s;if(p<d)break;var v=p-d,m=36-d;cJ(t,oJ(fJ(d+v%m))),p=iJ(v/m),f+=36}cJ(t,oJ(fJ(p))),s=dJ(o,h,c==u),o=0,c++}}o++,i++}return uJ(t,"")},mJ=function(e){var t,n,r=[],a=hJ(lJ(pJ(e),tJ,"."),".");for(t=0;t<a.length;t++)n=a[t],cJ(r,aJ(eJ,n)?"xn--"+vJ(n):n);return uJ(r,".")},gJ=La,yJ=z,bJ=j,xJ=ee,kJ=W,wJ=ZY,IJ=Or,NJ=zi,SJ=Dg,TJ=eo,EJ=dd,CJ=cr,AJ=zg,RJ=xe,_J=kt,OJ=so,FJ=qa,DJ=dn,MJ=Ie,LJ=Ya,zJ=yi,PJ=Y,BJ=eh,WJ=Kl,VJ=TC,UJ=nm,GJ=Mt("iterator"),jJ="URLSearchParams",HJ="URLSearchParamsIterator",qJ=CJ.set,KJ=CJ.getterFor(jJ),XJ=CJ.getterFor(HJ),YJ=Object.getOwnPropertyDescriptor,JJ=function(e){if(!kJ)return yJ[e];var t=YJ(yJ,e);return t&&t.value},ZJ=JJ("fetch"),QJ=JJ("Request"),$J=JJ("Headers"),eZ=QJ&&QJ.prototype,tZ=$J&&$J.prototype,nZ=yJ.RegExp,rZ=yJ.TypeError,aZ=yJ.decodeURIComponent,iZ=yJ.encodeURIComponent,oZ=xJ("".charAt),sZ=xJ([].join),uZ=xJ([].push),cZ=xJ("".replace),lZ=xJ([].shift),hZ=xJ([].splice),pZ=xJ("".split),fZ=xJ("".slice),dZ=/\+/g,vZ=Array(4),mZ=function(e){return vZ[e-1]||(vZ[e-1]=nZ("((?:%[\\da-f]{2}){"+e+"})","gi"))},gZ=function(e){try{return aZ(e)}catch(t){return e}},yZ=function(e){var t=cZ(e,dZ," "),n=4;try{return aZ(t)}catch(e){for(;n;)t=cZ(t,mZ(n--),gZ);return t}},bZ=/[!'()~]|%20/g,xZ={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},kZ=function(e){return xZ[e]},wZ=function(e){return cZ(iZ(e),bZ,kZ)},IZ=EJ((function(e,t){qJ(this,{type:HJ,iterator:BJ(KJ(e).entries),kind:t})}),"Iterator",(function(){var e=XJ(this),t=e.kind,n=e.iterator.next(),r=n.value;return n.done||(n.value="keys"===t?r.key:"values"===t?r.value:[r.key,r.value]),n}),!0),NZ=function(e){this.entries=[],this.url=null,void 0!==e&&(MJ(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===oZ(e,0)?fZ(e,1):e:LJ(e)))};NZ.prototype={type:jJ,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,n,r,a,i,o,s,u=WJ(e);if(u)for(n=(t=BJ(e,u)).next;!(r=bJ(n,t)).done;){if(i=(a=BJ(DJ(r.value))).next,(o=bJ(i,a)).done||(s=bJ(i,a)).done||!bJ(i,a).done)throw rZ("Expected sequence with length 2");uZ(this.entries,{key:LJ(o.value),value:LJ(s.value)})}else for(var c in e)_J(e,c)&&uZ(this.entries,{key:c,value:LJ(e[c])})},parseQuery:function(e){if(e)for(var t,n,r=pZ(e,"&"),a=0;a<r.length;)(t=r[a++]).length&&(n=pZ(t,"="),uZ(this.entries,{key:yZ(lZ(n)),value:yZ(sZ(n,"="))}))},serialize:function(){for(var e,t=this.entries,n=[],r=0;r<t.length;)e=t[r++],uZ(n,wZ(e.key)+"="+wZ(e.value));return sZ(n,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var SZ=function(){AJ(this,TZ);var e=arguments.length>0?arguments[0]:void 0,t=qJ(this,new NZ(e));kJ||(this.length=t.entries.length)},TZ=SZ.prototype;if(SJ(TZ,{append:function(e,t){VJ(arguments.length,2);var n=KJ(this);uZ(n.entries,{key:LJ(e),value:LJ(t)}),kJ||this.length++,n.updateURL()},delete:function(e){VJ(arguments.length,1);for(var t=KJ(this),n=t.entries,r=LJ(e),a=0;a<n.length;)n[a].key===r?hZ(n,a,1):a++;kJ||(this.length=n.length),t.updateURL()},get:function(e){VJ(arguments.length,1);for(var t=KJ(this).entries,n=LJ(e),r=0;r<t.length;r++)if(t[r].key===n)return t[r].value;return null},getAll:function(e){VJ(arguments.length,1);for(var t=KJ(this).entries,n=LJ(e),r=[],a=0;a<t.length;a++)t[a].key===n&&uZ(r,t[a].value);return r},has:function(e){VJ(arguments.length,1);for(var t=KJ(this).entries,n=LJ(e),r=0;r<t.length;)if(t[r++].key===n)return!0;return!1},set:function(e,t){VJ(arguments.length,1);for(var n,r=KJ(this),a=r.entries,i=!1,o=LJ(e),s=LJ(t),u=0;u<a.length;u++)(n=a[u]).key===o&&(i?hZ(a,u--,1):(i=!0,n.value=s));i||uZ(a,{key:o,value:s}),kJ||(this.length=a.length),r.updateURL()},sort:function(){var e=KJ(this);UJ(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,n=KJ(this).entries,r=OJ(e,arguments.length>1?arguments[1]:void 0),a=0;a<n.length;)r((t=n[a++]).value,t.key,this)},keys:function(){return new IZ(this,"keys")},values:function(){return new IZ(this,"values")},entries:function(){return new IZ(this,"entries")}},{enumerable:!0}),IJ(TZ,GJ,TZ.entries,{name:"entries"}),IJ(TZ,"toString",(function(){return KJ(this).serialize()}),{enumerable:!0}),kJ&&NJ(TZ,"size",{get:function(){return KJ(this).entries.length},configurable:!0,enumerable:!0}),TJ(SZ,jJ),gJ({global:!0,constructor:!0,forced:!wJ},{URLSearchParams:SZ}),!wJ&&RJ($J)){var EZ=xJ(tZ.has),CZ=xJ(tZ.set),AZ=function(e){if(MJ(e)){var t,n=e.body;if(FJ(n)===jJ)return t=e.headers?new $J(e.headers):new $J,EZ(t,"content-type")||CZ(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),zJ(e,{body:PJ(0,LJ(n)),headers:PJ(0,t)})}return e};if(RJ(ZJ)&&gJ({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return ZJ(e,arguments.length>1?AZ(arguments[1]):{})}}),RJ(QJ)){var RZ=function(e){return AJ(this,eZ),new QJ(e,arguments.length>1?AZ(arguments[1]):{})};eZ.constructor=RZ,RZ.prototype=eZ,gJ({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:RZ})}}var _Z,OZ={URLSearchParams:SZ,getState:KJ},FZ=La,DZ=W,MZ=ZY,LZ=z,zZ=so,PZ=ee,BZ=Or,WZ=zi,VZ=zg,UZ=kt,GZ=ST,jZ=Lf,HZ=Ai,qZ=xM.codeAt,KZ=mJ,XZ=Ya,YZ=eo,JZ=TC,ZZ=OZ,QZ=cr,$Z=QZ.set,eQ=QZ.getterFor("URL"),tQ=ZZ.URLSearchParams,nQ=ZZ.getState,rQ=LZ.URL,aQ=LZ.TypeError,iQ=LZ.parseInt,oQ=Math.floor,sQ=Math.pow,uQ=PZ("".charAt),cQ=PZ(/./.exec),lQ=PZ([].join),hQ=PZ(1..toString),pQ=PZ([].pop),fQ=PZ([].push),dQ=PZ("".replace),vQ=PZ([].shift),mQ=PZ("".split),gQ=PZ("".slice),yQ=PZ("".toLowerCase),bQ=PZ([].unshift),xQ="Invalid scheme",kQ="Invalid host",wQ="Invalid port",IQ=/[a-z]/i,NQ=/[\d+-.a-z]/i,SQ=/\d/,TQ=/^0x/i,EQ=/^[0-7]+$/,CQ=/^\d+$/,AQ=/^[\da-f]+$/i,RQ=/[\0\t\n\r #%/:<>?@[\\\]^|]/,_Q=/[\0\t\n\r #/:<>?@[\\\]^|]/,OQ=/^[\u0000-\u0020]+/,FQ=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,DQ=/[\t\n\r]/g,MQ=function(e){var t,n,r,a;if("number"==typeof e){for(t=[],n=0;n<4;n++)bQ(t,e%256),e=oQ(e/256);return lQ(t,".")}if("object"==s(e)){for(t="",r=function(e){for(var t=null,n=1,r=null,a=0,i=0;i<8;i++)0!==e[i]?(a>n&&(t=r,n=a),r=null,a=0):(null===r&&(r=i),++a);return a>n&&(t=r,n=a),t}(e),n=0;n<8;n++)a&&0===e[n]||(a&&(a=!1),r===n?(t+=n?":":"::",a=!0):(t+=hQ(e[n],16),n<7&&(t+=":")));return"["+t+"]"}return e},LQ={},zQ=GZ({},LQ,{" ":1,'"':1,"<":1,">":1,"`":1}),PQ=GZ({},zQ,{"#":1,"?":1,"{":1,"}":1}),BQ=GZ({},PQ,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),WQ=function(e,t){var n=qZ(e,0);return n>32&&n<127&&!UZ(t,e)?e:encodeURIComponent(e)},VQ={ftp:21,file:null,http:80,https:443,ws:80,wss:443},UQ=function(e,t){var n;return 2==e.length&&cQ(IQ,uQ(e,0))&&(":"==(n=uQ(e,1))||!t&&"|"==n)},GQ=function(e){var t;return e.length>1&&UQ(gQ(e,0,2))&&(2==e.length||"/"===(t=uQ(e,2))||"\\"===t||"?"===t||"#"===t)},jQ=function(e){return"."===e||"%2e"===yQ(e)},HQ={},qQ={},KQ={},XQ={},YQ={},JQ={},ZQ={},QQ={},$Q={},e$={},t$={},n$={},r$={},a$={},i$={},o$={},s$={},u$={},c$={},l$={},h$={},p$=function e(t,n,r){var a,i,o,s=XZ(t);if(n){if(i=this.parse(s))throw aQ(i);this.searchParams=null}else{if(void 0!==r&&(a=new e(r,!0)),i=this.parse(s,null,a))throw aQ(i);(o=nQ(new tQ)).bindURL(this),this.searchParams=o}};p$.prototype={type:"URL",parse:function(e,t,n){var r,a,i,o,s,u=this,c=t||HQ,l=0,h="",p=!1,f=!1,d=!1;for(e=XZ(e),t||(u.scheme="",u.username="",u.password="",u.host=null,u.port=null,u.path=[],u.query=null,u.fragment=null,u.cannotBeABaseURL=!1,e=dQ(e,OQ,""),e=dQ(e,FQ,"$1")),e=dQ(e,DQ,""),r=jZ(e);l<=r.length;){switch(a=r[l],c){case HQ:if(!a||!cQ(IQ,a)){if(t)return xQ;c=KQ;continue}h+=yQ(a),c=qQ;break;case qQ:if(a&&(cQ(NQ,a)||"+"==a||"-"==a||"."==a))h+=yQ(a);else{if(":"!=a){if(t)return xQ;h="",c=KQ,l=0;continue}if(t&&(u.isSpecial()!=UZ(VQ,h)||"file"==h&&(u.includesCredentials()||null!==u.port)||"file"==u.scheme&&!u.host))return;if(u.scheme=h,t)return void(u.isSpecial()&&VQ[u.scheme]==u.port&&(u.port=null));h="","file"==u.scheme?c=a$:u.isSpecial()&&n&&n.scheme==u.scheme?c=XQ:u.isSpecial()?c=QQ:"/"==r[l+1]?(c=YQ,l++):(u.cannotBeABaseURL=!0,fQ(u.path,""),c=c$)}break;case KQ:if(!n||n.cannotBeABaseURL&&"#"!=a)return xQ;if(n.cannotBeABaseURL&&"#"==a){u.scheme=n.scheme,u.path=HZ(n.path),u.query=n.query,u.fragment="",u.cannotBeABaseURL=!0,c=h$;break}c="file"==n.scheme?a$:JQ;continue;case XQ:if("/"!=a||"/"!=r[l+1]){c=JQ;continue}c=$Q,l++;break;case YQ:if("/"==a){c=e$;break}c=u$;continue;case JQ:if(u.scheme=n.scheme,a==_Z)u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,u.path=HZ(n.path),u.query=n.query;else if("/"==a||"\\"==a&&u.isSpecial())c=ZQ;else if("?"==a)u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,u.path=HZ(n.path),u.query="",c=l$;else{if("#"!=a){u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,u.path=HZ(n.path),u.path.length--,c=u$;continue}u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,u.path=HZ(n.path),u.query=n.query,u.fragment="",c=h$}break;case ZQ:if(!u.isSpecial()||"/"!=a&&"\\"!=a){if("/"!=a){u.username=n.username,u.password=n.password,u.host=n.host,u.port=n.port,c=u$;continue}c=e$}else c=$Q;break;case QQ:if(c=$Q,"/"!=a||"/"!=uQ(h,l+1))continue;l++;break;case $Q:if("/"!=a&&"\\"!=a){c=e$;continue}break;case e$:if("@"==a){p&&(h="%40"+h),p=!0,i=jZ(h);for(var v=0;v<i.length;v++){var m=i[v];if(":"!=m||d){var g=WQ(m,BQ);d?u.password+=g:u.username+=g}else d=!0}h=""}else if(a==_Z||"/"==a||"?"==a||"#"==a||"\\"==a&&u.isSpecial()){if(p&&""==h)return"Invalid authority";l-=jZ(h).length+1,h="",c=t$}else h+=a;break;case t$:case n$:if(t&&"file"==u.scheme){c=o$;continue}if(":"!=a||f){if(a==_Z||"/"==a||"?"==a||"#"==a||"\\"==a&&u.isSpecial()){if(u.isSpecial()&&""==h)return kQ;if(t&&""==h&&(u.includesCredentials()||null!==u.port))return;if(o=u.parseHost(h))return o;if(h="",c=s$,t)return;continue}"["==a?f=!0:"]"==a&&(f=!1),h+=a}else{if(""==h)return kQ;if(o=u.parseHost(h))return o;if(h="",c=r$,t==n$)return}break;case r$:if(!cQ(SQ,a)){if(a==_Z||"/"==a||"?"==a||"#"==a||"\\"==a&&u.isSpecial()||t){if(""!=h){var y=iQ(h,10);if(y>65535)return wQ;u.port=u.isSpecial()&&y===VQ[u.scheme]?null:y,h=""}if(t)return;c=s$;continue}return wQ}h+=a;break;case a$:if(u.scheme="file","/"==a||"\\"==a)c=i$;else{if(!n||"file"!=n.scheme){c=u$;continue}if(a==_Z)u.host=n.host,u.path=HZ(n.path),u.query=n.query;else if("?"==a)u.host=n.host,u.path=HZ(n.path),u.query="",c=l$;else{if("#"!=a){GQ(lQ(HZ(r,l),""))||(u.host=n.host,u.path=HZ(n.path),u.shortenPath()),c=u$;continue}u.host=n.host,u.path=HZ(n.path),u.query=n.query,u.fragment="",c=h$}}break;case i$:if("/"==a||"\\"==a){c=o$;break}n&&"file"==n.scheme&&!GQ(lQ(HZ(r,l),""))&&(UQ(n.path[0],!0)?fQ(u.path,n.path[0]):u.host=n.host),c=u$;continue;case o$:if(a==_Z||"/"==a||"\\"==a||"?"==a||"#"==a){if(!t&&UQ(h))c=u$;else if(""==h){if(u.host="",t)return;c=s$}else{if(o=u.parseHost(h))return o;if("localhost"==u.host&&(u.host=""),t)return;h="",c=s$}continue}h+=a;break;case s$:if(u.isSpecial()){if(c=u$,"/"!=a&&"\\"!=a)continue}else if(t||"?"!=a)if(t||"#"!=a){if(a!=_Z&&(c=u$,"/"!=a))continue}else u.fragment="",c=h$;else u.query="",c=l$;break;case u$:if(a==_Z||"/"==a||"\\"==a&&u.isSpecial()||!t&&("?"==a||"#"==a)){if(".."===(s=yQ(s=h))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(u.shortenPath(),"/"==a||"\\"==a&&u.isSpecial()||fQ(u.path,"")):jQ(h)?"/"==a||"\\"==a&&u.isSpecial()||fQ(u.path,""):("file"==u.scheme&&!u.path.length&&UQ(h)&&(u.host&&(u.host=""),h=uQ(h,0)+":"),fQ(u.path,h)),h="","file"==u.scheme&&(a==_Z||"?"==a||"#"==a))for(;u.path.length>1&&""===u.path[0];)vQ(u.path);"?"==a?(u.query="",c=l$):"#"==a&&(u.fragment="",c=h$)}else h+=WQ(a,PQ);break;case c$:"?"==a?(u.query="",c=l$):"#"==a?(u.fragment="",c=h$):a!=_Z&&(u.path[0]+=WQ(a,LQ));break;case l$:t||"#"!=a?a!=_Z&&("'"==a&&u.isSpecial()?u.query+="%27":u.query+="#"==a?"%23":WQ(a,LQ)):(u.fragment="",c=h$);break;case h$:a!=_Z&&(u.fragment+=WQ(a,zQ))}l++}},parseHost:function(e){var t,n,r;if("["==uQ(e,0)){if("]"!=uQ(e,e.length-1))return kQ;if(t=function(e){var t,n,r,a,i,o,s,u=[0,0,0,0,0,0,0,0],c=0,l=null,h=0,p=function(){return uQ(e,h)};if(":"==p()){if(":"!=uQ(e,1))return;h+=2,l=++c}for(;p();){if(8==c)return;if(":"!=p()){for(t=n=0;n<4&&cQ(AQ,p());)t=16*t+iQ(p(),16),h++,n++;if("."==p()){if(0==n)return;if(h-=n,c>6)return;for(r=0;p();){if(a=null,r>0){if(!("."==p()&&r<4))return;h++}if(!cQ(SQ,p()))return;for(;cQ(SQ,p());){if(i=iQ(p(),10),null===a)a=i;else{if(0==a)return;a=10*a+i}if(a>255)return;h++}u[c]=256*u[c]+a,2!=++r&&4!=r||c++}if(4!=r)return;break}if(":"==p()){if(h++,!p())return}else if(p())return;u[c++]=t}else{if(null!==l)return;h++,l=++c}}if(null!==l)for(o=c-l,c=7;0!=c&&o>0;)s=u[c],u[c--]=u[l+o-1],u[l+--o]=s;else if(8!=c)return;return u}(gQ(e,1,-1)),!t)return kQ;this.host=t}else if(this.isSpecial()){if(e=KZ(e),cQ(RQ,e))return kQ;if(t=function(e){var t,n,r,a,i,o,s,u=mQ(e,".");if(u.length&&""==u[u.length-1]&&u.length--,(t=u.length)>4)return e;for(n=[],r=0;r<t;r++){if(""==(a=u[r]))return e;if(i=10,a.length>1&&"0"==uQ(a,0)&&(i=cQ(TQ,a)?16:8,a=gQ(a,8==i?1:2)),""===a)o=0;else{if(!cQ(10==i?CQ:8==i?EQ:AQ,a))return e;o=iQ(a,i)}fQ(n,o)}for(r=0;r<t;r++)if(o=n[r],r==t-1){if(o>=sQ(256,5-t))return null}else if(o>255)return null;for(s=pQ(n),r=0;r<n.length;r++)s+=n[r]*sQ(256,3-r);return s}(e),null===t)return kQ;this.host=t}else{if(cQ(_Q,e))return kQ;for(t="",n=jZ(e),r=0;r<n.length;r++)t+=WQ(n[r],LQ);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return UZ(VQ,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&UQ(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,n=e.username,r=e.password,a=e.host,i=e.port,o=e.path,s=e.query,u=e.fragment,c=t+":";return null!==a?(c+="//",e.includesCredentials()&&(c+=n+(r?":"+r:"")+"@"),c+=MQ(a),null!==i&&(c+=":"+i)):"file"==t&&(c+="//"),c+=e.cannotBeABaseURL?o[0]:o.length?"/"+lQ(o,"/"):"",null!==s&&(c+="?"+s),null!==u&&(c+="#"+u),c},setHref:function(e){var t=this.parse(e);if(t)throw aQ(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new f$(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+MQ(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(XZ(e)+":",HQ)},getUsername:function(){return this.username},setUsername:function(e){var t=jZ(XZ(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var n=0;n<t.length;n++)this.username+=WQ(t[n],BQ)}},getPassword:function(){return this.password},setPassword:function(e){var t=jZ(XZ(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var n=0;n<t.length;n++)this.password+=WQ(t[n],BQ)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?MQ(e):MQ(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,t$)},getHostname:function(){var e=this.host;return null===e?"":MQ(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,n$)},getPort:function(){var e=this.port;return null===e?"":XZ(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=XZ(e))?this.port=null:this.parse(e,r$))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+lQ(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,s$))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=XZ(e))?this.query=null:("?"==uQ(e,0)&&(e=gQ(e,1)),this.query="",this.parse(e,l$)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=XZ(e))?("#"==uQ(e,0)&&(e=gQ(e,1)),this.fragment="",this.parse(e,h$)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var f$=function(e){var t=VZ(this,d$),n=JZ(arguments.length,1)>1?arguments[1]:void 0,r=$Z(t,new p$(e,!1,n));DZ||(t.href=r.serialize(),t.origin=r.getOrigin(),t.protocol=r.getProtocol(),t.username=r.getUsername(),t.password=r.getPassword(),t.host=r.getHost(),t.hostname=r.getHostname(),t.port=r.getPort(),t.pathname=r.getPathname(),t.search=r.getSearch(),t.searchParams=r.getSearchParams(),t.hash=r.getHash())},d$=f$.prototype,v$=function(e,t){return{get:function(){return eQ(this)[e]()},set:t&&function(e){return eQ(this)[t](e)},configurable:!0,enumerable:!0}};if(DZ&&(WZ(d$,"href",v$("serialize","setHref")),WZ(d$,"origin",v$("getOrigin")),WZ(d$,"protocol",v$("getProtocol","setProtocol")),WZ(d$,"username",v$("getUsername","setUsername")),WZ(d$,"password",v$("getPassword","setPassword")),WZ(d$,"host",v$("getHost","setHost")),WZ(d$,"hostname",v$("getHostname","setHostname")),WZ(d$,"port",v$("getPort","setPort")),WZ(d$,"pathname",v$("getPathname","setPathname")),WZ(d$,"search",v$("getSearch","setSearch")),WZ(d$,"searchParams",v$("getSearchParams")),WZ(d$,"hash",v$("getHash","setHash"))),BZ(d$,"toJSON",(function(){return eQ(this).serialize()}),{enumerable:!0}),BZ(d$,"toString",(function(){return eQ(this).serialize()}),{enumerable:!0}),rQ){var m$=rQ.createObjectURL,g$=rQ.revokeObjectURL;m$&&BZ(f$,"createObjectURL",zZ(m$,rQ)),g$&&BZ(f$,"revokeObjectURL",zZ(g$,rQ))}YZ(f$,"URL"),FZ({global:!0,constructor:!0,forced:!MZ,sham:!DZ},{URL:f$});var y$=j;La({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return y$(URL.prototype.toString,this)}});var b$=W,x$=ee,k$=zi,w$=URLSearchParams.prototype,I$=x$(w$.forEach);b$&&!("size"in w$)&&k$(w$,"size",{get:function(){var e=0;return I$(this,(function(){e++})),e},configurable:!0,enumerable:!0});var N$={exports:{}};!function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var a=t&&t.prototype instanceof g?t:g,i=Object.create(a.prototype),o=new A(r||[]);return i._invoke=function(e,t,n){var r=p;return function(a,i){if(r===d)throw new Error("Generator is already running");if(r===v){if("throw"===a)throw i;return _()}for(n.method=a,n.arg=i;;){var o=n.delegate;if(o){var s=T(o,n);if(s){if(s===m)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===p)throw r=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var u=h(e,t,n);if("normal"===u.type){if(r=n.done?v:f,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=v,n.method="throw",n.arg=u.arg)}}}(e,n,o),i}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var p="suspendedStart",f="suspendedYield",d="executing",v="completed",m={};function g(){}function y(){}function b(){}var x={};x[i]=function(){return this};var k=Object.getPrototypeOf,w=k&&k(k(R([])));w&&w!==n&&r.call(w,i)&&(x=w);var I=b.prototype=g.prototype=Object.create(x);function N(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(a,i,o,u){var c=h(e[a],e,i);if("throw"!==c.type){var l=c.arg,p=l.value;return p&&"object"===s(p)&&r.call(p,"__await")?t.resolve(p.__await).then((function(e){n("next",e,o,u)}),(function(e){n("throw",e,o,u)})):t.resolve(p).then((function(e){l.value=e,o(l)}),(function(e){return n("throw",e,o,u)}))}u(c.arg)}var a;this._invoke=function(e,r){function i(){return new t((function(t,a){n(e,r,t,a)}))}return a=a?a.then(i,i):i()}}function T(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,T(e,n),"throw"===n.method))return m;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var a=h(r,e.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,m;var i=a.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function R(e){if(e){var n=e[i];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,o=function n(){for(;++a<e.length;)if(r.call(e,a))return n.value=e[a],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}return{next:_}}function _(){return{value:t,done:!0}}return y.prototype=I.constructor=b,b.constructor=y,y.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,u,"GeneratorFunction")),e.prototype=Object.create(I),e},e.awrap=function(e){return{__await:e}},N(S.prototype),S.prototype[o]=function(){return this},e.AsyncIterator=S,e.async=function(t,n,r,a,i){void 0===i&&(i=Promise);var o=new S(l(t,n,r,a),i);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},N(I),c(I,u,"Generator"),I[i]=function(){return this},I.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=R,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function a(r,a){return s.type="throw",s.arg=e,n.next=r,a&&(n.method="next",n.arg=t),!!a}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return a("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return a(o.catchLoc,!0);if(this.prev<o.finallyLoc)return a(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return a(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return a(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;C(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:R(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}(N$);var S$=function(){function e(t,n){l(this,e),this.backend=t,this.dataMover=n,this.data=new WeakMap,this.dataIdsCount=0}return p(e,[{key:"get",value:function(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}},{key:"set",value:function(e,t){this.dataIdsCount++,this.data.set(e,t)}},{key:"has",value:function(e){return this.data.has(e)}},{key:"delete",value:function(e){return this.dataIdsCount--,this.data.delete(e)}},{key:"numDataIds",value:function(){return this.dataIdsCount}}]),e}(),T$=function(){function e(){l(this,e)}return p(e,[{key:"refCount",value:function(e){return E$("refCount")}},{key:"incRef",value:function(e){return E$("incRef")}},{key:"timerAvailable",value:function(){return!0}},{key:"time",value:function(e){return E$("time")}},{key:"read",value:function(e){return E$("read")}},{key:"readSync",value:function(e){return E$("readSync")}},{key:"readToGPU",value:function(e,t){return E$("readToGPU")}},{key:"numDataIds",value:function(){return E$("numDataIds")}},{key:"disposeData",value:function(e,t){return E$("disposeData")}},{key:"write",value:function(e,t,n){return E$("write")}},{key:"move",value:function(e,t,n,r,a){return E$("move")}},{key:"createTensorFromGPUData",value:function(e,t,n){return E$("createTensorFromGPUData")}},{key:"memory",value:function(){return E$("memory")}},{key:"floatPrecision",value:function(){return E$("floatPrecision")}},{key:"epsilon",value:function(){return 32===this.floatPrecision()?1e-7:1e-4}},{key:"dispose",value:function(){return E$("dispose")}}]),e}();function E$(e){throw new Error("'".concat(e,"' not yet implemented or not found in the registry. ")+"This kernel may not be supported by the tfjs backend you have chosen")}function C$(e){for(var t=e.length,n=0;t>0;)n=Math.random()*t|0,_$(e,--t,n)}function A$(e,t,n){return Math.max(e,Math.min(t,n))}function R$(e){return e%2==0?e:e+1}function _$(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function O$(e){for(var t=0,n=0;n<e.length;n++)t+=e[n];return t}function F$(e,t){if(!e)throw new Error("string"==typeof t?t:t())}function D$(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";F$(P$(e,t),(function(){return n+" Shapes ".concat(e," and ").concat(t," must match")}))}function M$(e){F$(null!=e,(function(){return"The input to the tensor constructor must be a non-null value."}))}function L$(e){if(0===e.length)return 1;for(var t=e[0],n=1;n<e.length;n++)t*=e[n];return t}function z$(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(null!==e[n]&&null!==t[n]&&e[n]!==t[n])return!1;return!0}function P$(e,t){if(e===t)return!0;if(null==e||null==t)return!1;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 B$(e){return e%1==0}function W$(e){var t=Math.ceil(Math.sqrt(e));return[t,Math.ceil(e/t)]}function V$(e,t){return t<=e.length?e:e+" ".repeat(t-e.length)}function U$(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e){return 0},n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;return new Promise((function(a,i){var o=0;!function s(){if(e())a();else{o++;var u=t(o);null!=n&&o>=n?i():null!=r?r(s,u):setTimeout(s,u)}}()}))}function G$(e,t){for(var n=1,r=-1,a=0;a<e.length;++a)if(e[a]>=0)n*=e[a];else if(-1===e[a]){if(-1!==r)throw Error("Shapes can only have 1 implicit size. "+"Found -1 at dim ".concat(r," and dim ").concat(a));r=a}else if(e[a]<0)throw Error("Shapes can not be < 0. Found ".concat(e[a]," at dim ").concat(a));if(-1===r){if(t>0&&t!==n)throw Error("Size(".concat(t,") must match the product of shape ").concat(e));return e}if(0===n)throw Error("Cannot infer the missing size in [".concat(e,"] when ")+"there are 0 elements");if(t%n!=0)throw Error("The implicit shape can't be a fractional number. "+"Got ".concat(t," / ").concat(n));var i=e.slice();return i[r]=t/n,i}function j$(e,t){var n=t.length;return F$((e=null==e?t.map((function(e,t){return t})):[].concat(e)).every((function(e){return e>=-n&&e<n})),(function(){return"All values in axis param must be in range [-".concat(n,", ").concat(n,") but ")+"got axis ".concat(e)})),F$(e.every((function(e){return B$(e)})),(function(){return"All values in axis param must be integers but "+"got axis ".concat(e)})),e.map((function(e){return e<0?n+e:e}))}function H$(e,t){for(var n=[],r=[],a=null!=t&&Array.isArray(t)&&0===t.length,i=null==t||a?null:j$(t,e).sort(),o=0,s=0;s<e.length;++s){if(null!=i){if(i[o]===s&&1!==e[s])throw new Error("Can't squeeze axis ".concat(s," since its dim '").concat(e[s],"' is not 1"));(null==i[o]||i[o]>s)&&1===e[s]&&(n.push(e[s]),r.push(s)),i[o]<=s&&o++}1!==e[s]&&(n.push(e[s]),r.push(s))}return{newShape:n,keptDims:r}}function q$(e,t){return K$(e,t)}function K$(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)n=new Uint8Array(t);else{if("string"!==e)throw new Error("Unknown data type ".concat(e));n=new Array(t)}return n}function X$(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(isNaN(r)||!isFinite(r))throw Error("A tensor of type ".concat(t," being uploaded contains ").concat(r,"."))}}function Y$(e){return"bool"===e||"complex64"===e||"float32"===e||"int32"===e||"string"===e}function J$(e,t){return"complex64"!==t&&(("float32"!==t||"complex64"===e)&&(("int32"!==t||"float32"===e||"complex64"===e)&&("bool"!==t||"bool"!==e)))}function Z$(e){if("float32"===e||"int32"===e)return 4;if("complex64"===e)return 8;if("bool"===e)return 1;throw new Error("Unknown dtype ".concat(e))}function Q$(e){if(null==e)return 0;var t=0;return e.forEach((function(e){return t+=e.length})),t}function $$(e){return"string"==typeof e||e instanceof String}function e0(e){return"boolean"==typeof e}function t0(e){return"number"==typeof e}function n0(e){return Array.isArray(e)?n0(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray?"int32":t0(e)?"float32":$$(e)?"string":e0(e)?"bool":"float32"}function r0(e){return!!(e&&e.constructor&&e.call&&e.apply)}function a0(e,t){for(var n=t;n<e;++n)if(e%n==0)return n;return e}function i0(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 o0(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=new Array;if(1===t.length)for(var i=t[0]*(r?2:1),o=0;o<i;o++)a[o]=n[e+o];else for(var s=t[0],u=t.slice(1),c=u.reduce((function(e,t){return e*t}))*(r?2:1),l=0;l<s;l++)a[l]=o0(e+l*c,u,n,r);return a}function s0(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(0===e.length)return t[0];var r=e.reduce((function(e,t){return e*t}))*(n?2:1);if(0===r)return[];if(r!==t.length)throw new Error("[".concat(e,"] does not match the input size ").concat(t.length).concat(n?" for a complex tensor":"","."));return o0(0,e,t,n)}function u0(e,t){if(Array.isArray(e))return e;if("float32"===t)return e instanceof Float32Array?e:new Float32Array(e);if("int32"===t)return e instanceof Int32Array?e:new Int32Array(e);if("bool"===t||"string"===t)return Uint8Array.from(new Int32Array(e));throw new Error("Unknown dtype ".concat(t))}function c0(e,t){for(var n=l0(e,t),r=0;r<n.length;r++)n[r]=1;return n}function l0(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 ".concat(t))}function h0(e,t){var n=e.reduce((function(e,t){return e*t}),1);if(null==t||"float32"===t)return s0(e,new Float32Array(n));if("int32"===t)return s0(e,new Int32Array(n));if("bool"===t)return s0(e,new Uint8Array(n));throw new Error("Unknown data type ".concat(t))}function p0(e){e.forEach((function(t){F$(Number.isInteger(t)&&t>=0,(function(){return"Tensor must have a shape comprised of positive integers but got "+"shape [".concat(e,"].")}))}))}function f0(e,t,n){if(0===t)return 0;if(1===t)return e[0];for(var r=e[e.length-1],a=0;a<e.length-1;++a)r+=n[a]*e[a];return r}function d0(e,t,n){if(0===t)return[];if(1===t)return[e];for(var r=new Array(t),a=0;a<r.length-1;++a)r[a]=Math.floor(e/n[a]),e-=r[a]*n[a];return r[r.length-1]=e,r}function v0(e){return e&&e.then&&"function"==typeof e.then}var m0,g0="tfjsflags",y0=function(){function e(t){l(this,e),this.global=t,this.flags={},this.flagRegistry={},this.urlFlags={},this.getQueryParams=b0,this.populateURLFlags()}var t;return p(e,[{key:"setPlatform",value:function(e,t){null!=this.platform&&(k0().getBool("IS_TEST")||k0().getBool("PROD")||console.warn("Platform ".concat(this.platformName," has already been set. ")+"Overwriting the platform with ".concat(e,"."))),this.platformName=e,this.platform=t}},{key:"registerFlag",value:function(e,t,n){if(this.flagRegistry[e]={evaluationFn:t,setHook:n},null!=this.urlFlags[e]){var r=this.urlFlags[e];k0().getBool("IS_TEST")||k0().getBool("PROD")||console.warn("Setting feature override from URL ".concat(e,": ").concat(r,".")),this.set(e,r)}}},{key:"getAsync",value:(t=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t in this.flags)){e.next=2;break}return e.abrupt("return",this.flags[t]);case 2:return e.next=4,this.evaluateFlag(t);case 4:return this.flags[t]=e.sent,e.abrupt("return",this.flags[t]);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"get",value:function(e){if(e in this.flags)return this.flags[e];var t=this.evaluateFlag(e);if(v0(t))throw new Error("Flag ".concat(e," cannot be synchronously evaluated. ")+"Please use getAsync() instead.");return this.flags[e]=t,this.flags[e]}},{key:"getNumber",value:function(e){return this.get(e)}},{key:"getBool",value:function(e){return this.get(e)}},{key:"getString",value:function(e){return this.get(e)}},{key:"getFlags",value:function(){return this.flags}},{key:"features",get:function(){return this.flags}},{key:"set",value:function(e,t){if(null==this.flagRegistry[e])throw new Error("Cannot set flag ".concat(e," as it has not been registered."));this.flags[e]=t,null!=this.flagRegistry[e].setHook&&this.flagRegistry[e].setHook(t)}},{key:"evaluateFlag",value:function(e){if(null==this.flagRegistry[e])throw new Error("Cannot evaluate flag '".concat(e,"': no evaluation function found."));return this.flagRegistry[e].evaluationFn()}},{key:"setFlags",value:function(e){this.flags=Object.assign({},e)}},{key:"reset",value:function(){this.flags={},this.urlFlags={},this.populateURLFlags()}},{key:"populateURLFlags",value:function(){var e=this;if(void 0!==this.global&&void 0!==this.global.location&&void 0!==this.global.location.search){var t=this.getQueryParams(this.global.location.search);if(g0 in t)t.tfjsflags.split(",").forEach((function(t){var n=S(t.split(":"),2),r=n[0],a=n[1];e.urlFlags[r]=function(e,t){var n=t.toLowerCase();return"true"===n||"false"===n?"true"===n:"".concat(+n)===n?+n:t}(0,a)}))}}}]),e}();function b0(e){var t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return x0(t,r[0],r[1]),r.join("=")})),t}function x0(e,t,n){e[decodeURIComponent(t)]=decodeURIComponent(n||"")}function k0(){return e.ENV}function w0(){if(null==m0){var e;if("undefined"!=typeof window)e=window;else if("undefined"!=typeof global)e=global;else if("undefined"!=typeof process)e=process;else{if("undefined"==typeof self)throw new Error("Could not find a global object");e=self}m0=e}return m0}function I0(e,t){var n,r=(null==(n=w0())._tfGlobals&&(n._tfGlobals=new Map),n._tfGlobals);if(r.has(e))return r.get(e);var a=t();return r.set(e,a),r.get(e)}e.ENV=null;var N0="Abs",S0="Acos",T0="Acosh",E0="Add",C0="AddN",A0="All",R0="Any",_0="ArgMax",O0="ArgMin",F0="Asin",D0="Asinh",M0="Atan",L0="Atanh",z0="Atan2",P0="AvgPool",B0="AvgPoolGrad",W0="AvgPool3D",V0="AvgPool3DGrad",U0="BatchMatMul",G0="BatchToSpaceND",j0="Bincount",H0="BitwiseAnd",q0="BroadcastTo",K0="BroadcastArgs",X0="Cast",Y0="Ceil",J0="ClipByValue",Z0="Complex",Q0="ComplexAbs",$0="Concat",e1="Conv2D",t1="Conv2DBackpropFilter",n1="Conv2DBackpropInput",r1="Conv3D",a1="Conv3DBackpropFilterV2",i1="Conv3DBackpropInputV2",o1="Cos",s1="Cosh",u1="Cumprod",c1="Cumsum",l1="CropAndResize",h1="DenseBincount",p1="DepthToSpace",f1="DepthwiseConv2dNative",d1="DepthwiseConv2dNativeBackpropFilter",v1="DepthwiseConv2dNativeBackpropInput",m1="Diag",g1="Dilation2D",y1="Dilation2DBackpropInput",b1="Dilation2DBackpropFilter",x1="Draw",k1="RealDiv",w1="Einsum",I1="Elu",N1="EluGrad",S1="Erf",T1="Equal",E1="Exp",C1="ExpandDims",A1="Expm1",R1="FFT",_1="Fill",O1="FlipLeftRight",F1="Floor",D1="FloorDiv",M1="FusedBatchNorm",L1="GatherV2",z1="GatherNd",P1="Greater",B1="GreaterEqual",W1="Identity",V1="IFFT",U1="Imag",G1="IsFinite",j1="IsInf",H1="IsNan",q1="LeakyRelu",K1="Less",X1="LessEqual",Y1="LinSpace",J1="Log",Z1="Log1p",Q1="LogicalAnd",$1="LogicalNot",e2="LogicalOr",t2="LogSoftmax",n2="LRN",r2="LRNGrad",a2="Max",i2="Maximum",o2="MaxPool",s2="MaxPoolGrad",u2="MaxPool3D",c2="MaxPool3DGrad",l2="MaxPoolWithArgmax",h2="Mean",p2="Min",f2="Minimum",d2="MirrorPad",v2="Mod",m2="Multinomial",g2="Multiply",y2="Neg",b2="NotEqual",x2="NonMaxSuppressionV3",k2="NonMaxSuppressionV4",w2="NonMaxSuppressionV5",I2="OnesLike",N2="OneHot",S2="Pack",T2="PadV2",E2="Pow",C2="Prelu",A2="Prod",R2="RaggedGather",_2="RaggedRange",O2="RaggedTensorToTensor",F2="Range",D2="Real",M2="Reciprocal",L2="Relu",z2="Reshape",P2="ResizeNearestNeighbor",B2="ResizeNearestNeighborGrad",W2="ResizeBilinear",V2="ResizeBilinearGrad",U2="Relu6",G2="Reverse",j2="Round",H2="Rsqrt",q2="ScatterNd",K2="TensorScatterUpdate",X2="SearchSorted",Y2="Select",J2="Selu",Z2="Slice",Q2="Sin",$2="Sinh",e3="Sign",t3="Sigmoid",n3="Softplus",r3="Sqrt",a3="Sum",i3="SpaceToBatchND",o3="SplitV",s3="Softmax",u3="SparseFillEmptyRows",c3="SparseReshape",l3="SparseSegmentMean",h3="SparseSegmentSum",p3="SparseToDense",f3="SquaredDifference",d3="Square",v3="StaticRegexReplace",m3="StridedSlice",g3="StringNGrams",y3="StringSplit",b3="StringToHashBucketFast",x3="Sub",k3="Tan",w3="Tanh",I3="Tile",N3="TopK",S3="Transform",T3="Transpose",E3="Unique",C3="Unpack",A3="UnsortedSegmentSum",R3="ZerosLike",_3="Step",O3="FromPixels",F3="RotateWithOffset",D3="_FusedMatMul",M3="FusedConv2D",L3="FusedDepthwiseConv2D";function z3(){var e;k0().getBool("IS_TEST")||k0().getBool("PROD")||(e=console).warn.apply(e,arguments)}var P3=I0("kernelRegistry",(function(){return new Map})),B3=I0("gradRegistry",(function(){return new Map}));function W3(e,t){var n=H3(e,t);return P3.get(n)}function V3(e){return B3.get(e)}function U3(e){for(var t=P3.entries(),n=[];;){var r=t.next(),a=r.done,i=r.value;if(a)break;var o=S(i,2),s=o[0],u=o[1];S(s.split("_"),1)[0]===e&&n.push(u)}return n}function G3(e){var t=e.kernelName,n=e.backendName,r=H3(t,n);P3.has(r)&&z3("The kernel '".concat(t,"' for backend ")+"'".concat(n,"' is already registered")),P3.set(r,e)}function j3(e){var t=e.kernelName;B3.has(t)&&k0().getBool("DEBUG")&&z3("Overriding the gradient for '".concat(t,"'")),B3.set(t,e)}function H3(e,t){return"".concat(t,"_").concat(e)}function q3(e){return e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray}var K3=Y3,X3=null;try{X3=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function Y3(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function J3(e){return!0===(e&&e.__isLong__)}Y3.prototype.__isLong__,Object.defineProperty(Y3.prototype,"__isLong__",{value:!0}),Y3.isLong=J3;var Z3={},Q3={};function $3(e,t){var n,r,a;return t?(a=0<=(e>>>=0)&&e<256)&&(r=Q3[e])?r:(n=t4(e,(0|e)<0?-1:0,!0),a&&(Q3[e]=n),n):(a=-128<=(e|=0)&&e<128)&&(r=Z3[e])?r:(n=t4(e,e<0?-1:0,!1),a&&(Z3[e]=n),n)}function e4(e,t){if(isNaN(e))return t?l4:c4;if(t){if(e<0)return l4;if(e>=o4)return v4}else{if(e<=-s4)return m4;if(e+1>=s4)return d4}return e<0?e4(-e,t).neg():t4(e%i4|0,e/i4|0,t)}function t4(e,t,n){return new Y3(e,t,n)}Y3.fromInt=$3,Y3.fromNumber=e4,Y3.fromBits=t4;var n4=Math.pow;function r4(e,t,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return c4;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||36<n)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return r4(e.substring(1),t,n).neg();for(var a=e4(n4(n,8)),i=c4,o=0;o<e.length;o+=8){var s=Math.min(8,e.length-o),u=parseInt(e.substring(o,o+s),n);if(s<8){var c=e4(n4(n,s));i=i.mul(c).add(e4(u))}else i=(i=i.mul(a)).add(e4(u))}return i.unsigned=t,i}function a4(e,t){return"number"==typeof e?e4(e,t):"string"==typeof e?r4(e,t):t4(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}Y3.fromString=r4,Y3.fromValue=a4;var i4=4294967296,o4=i4*i4,s4=o4/2,u4=$3(1<<24),c4=$3(0);Y3.ZERO=c4;var l4=$3(0,!0);Y3.UZERO=l4;var h4=$3(1);Y3.ONE=h4;var p4=$3(1,!0);Y3.UONE=p4;var f4=$3(-1);Y3.NEG_ONE=f4;var d4=t4(-1,2147483647,!1);Y3.MAX_VALUE=d4;var v4=t4(-1,-1,!0);Y3.MAX_UNSIGNED_VALUE=v4;var m4=t4(0,-2147483648,!1);Y3.MIN_VALUE=m4;var g4=Y3.prototype;g4.toInt=function(){return this.unsigned?this.low>>>0:this.low},g4.toNumber=function(){return this.unsigned?(this.high>>>0)*i4+(this.low>>>0):this.high*i4+(this.low>>>0)},g4.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(m4)){var t=e4(e),n=this.div(t),r=n.mul(t).sub(this);return n.toString(e)+r.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var a=e4(n4(e,6),this.unsigned),i=this,o="";;){var s=i.div(a),u=(i.sub(s.mul(a)).toInt()>>>0).toString(e);if((i=s).isZero())return u+o;for(;u.length<6;)u="0"+u;o=""+u+o}},g4.getHighBits=function(){return this.high},g4.getHighBitsUnsigned=function(){return this.high>>>0},g4.getLowBits=function(){return this.low},g4.getLowBitsUnsigned=function(){return this.low>>>0},g4.getNumBitsAbs=function(){if(this.isNegative())return this.eq(m4)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},g4.isZero=function(){return 0===this.high&&0===this.low},g4.eqz=g4.isZero,g4.isNegative=function(){return!this.unsigned&&this.high<0},g4.isPositive=function(){return this.unsigned||this.high>=0},g4.isOdd=function(){return 1==(1&this.low)},g4.isEven=function(){return 0==(1&this.low)},g4.equals=function(e){return J3(e)||(e=a4(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},g4.eq=g4.equals,g4.notEquals=function(e){return!this.eq(e)},g4.neq=g4.notEquals,g4.ne=g4.notEquals,g4.lessThan=function(e){return this.comp(e)<0},g4.lt=g4.lessThan,g4.lessThanOrEqual=function(e){return this.comp(e)<=0},g4.lte=g4.lessThanOrEqual,g4.le=g4.lessThanOrEqual,g4.greaterThan=function(e){return this.comp(e)>0},g4.gt=g4.greaterThan,g4.greaterThanOrEqual=function(e){return this.comp(e)>=0},g4.gte=g4.greaterThanOrEqual,g4.ge=g4.greaterThanOrEqual,g4.compare=function(e){if(J3(e)||(e=a4(e)),this.eq(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},g4.comp=g4.compare,g4.negate=function(){return!this.unsigned&&this.eq(m4)?m4:this.not().add(h4)},g4.neg=g4.negate,g4.add=function(e){J3(e)||(e=a4(e));var t=this.high>>>16,n=65535&this.high,r=this.low>>>16,a=65535&this.low,i=e.high>>>16,o=65535&e.high,s=e.low>>>16,u=0,c=0,l=0,h=0;return l+=(h+=a+(65535&e.low))>>>16,c+=(l+=r+s)>>>16,u+=(c+=n+o)>>>16,u+=t+i,t4((l&=65535)<<16|(h&=65535),(u&=65535)<<16|(c&=65535),this.unsigned)},g4.subtract=function(e){return J3(e)||(e=a4(e)),this.add(e.neg())},g4.sub=g4.subtract,g4.multiply=function(e){if(this.isZero())return c4;if(J3(e)||(e=a4(e)),X3)return t4(X3.mul(this.low,this.high,e.low,e.high),X3.get_high(),this.unsigned);if(e.isZero())return c4;if(this.eq(m4))return e.isOdd()?m4:c4;if(e.eq(m4))return this.isOdd()?m4:c4;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(u4)&&e.lt(u4))return e4(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,n=65535&this.high,r=this.low>>>16,a=65535&this.low,i=e.high>>>16,o=65535&e.high,s=e.low>>>16,u=65535&e.low,c=0,l=0,h=0,p=0;return h+=(p+=a*u)>>>16,l+=(h+=r*u)>>>16,h&=65535,l+=(h+=a*s)>>>16,c+=(l+=n*u)>>>16,l&=65535,c+=(l+=r*s)>>>16,l&=65535,c+=(l+=a*o)>>>16,c+=t*u+n*s+r*o+a*i,t4((h&=65535)<<16|(p&=65535),(c&=65535)<<16|(l&=65535),this.unsigned)},g4.mul=g4.multiply,g4.divide=function(e){if(J3(e)||(e=a4(e)),e.isZero())throw Error("division by zero");var t,n,r;if(X3)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?t4((this.unsigned?X3.div_u:X3.div_s)(this.low,this.high,e.low,e.high),X3.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?l4:c4;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return l4;if(e.gt(this.shru(1)))return p4;r=l4}else{if(this.eq(m4))return e.eq(h4)||e.eq(f4)?m4:e.eq(m4)?h4:(t=this.shr(1).div(e).shl(1)).eq(c4)?e.isNegative()?h4:f4:(n=this.sub(e.mul(t)),r=t.add(n.div(e)));if(e.eq(m4))return this.unsigned?l4:c4;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=c4}for(n=this;n.gte(e);){t=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(t)/Math.LN2),i=a<=48?1:n4(2,a-48),o=e4(t),s=o.mul(e);s.isNegative()||s.gt(n);)s=(o=e4(t-=i,this.unsigned)).mul(e);o.isZero()&&(o=h4),r=r.add(o),n=n.sub(s)}return r},g4.div=g4.divide,g4.modulo=function(e){return J3(e)||(e=a4(e)),X3?t4((this.unsigned?X3.rem_u:X3.rem_s)(this.low,this.high,e.low,e.high),X3.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},g4.mod=g4.modulo,g4.rem=g4.modulo,g4.not=function(){return t4(~this.low,~this.high,this.unsigned)},g4.and=function(e){return J3(e)||(e=a4(e)),t4(this.low&e.low,this.high&e.high,this.unsigned)},g4.or=function(e){return J3(e)||(e=a4(e)),t4(this.low|e.low,this.high|e.high,this.unsigned)},g4.xor=function(e){return J3(e)||(e=a4(e)),t4(this.low^e.low,this.high^e.high,this.unsigned)},g4.shiftLeft=function(e){return J3(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t4(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t4(0,this.low<<e-32,this.unsigned)},g4.shl=g4.shiftLeft,g4.shiftRight=function(e){return J3(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t4(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t4(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},g4.shr=g4.shiftRight,g4.shiftRightUnsigned=function(e){if(J3(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?t4(this.low>>>e|t<<32-e,t>>>e,this.unsigned):t4(32===e?t:t>>>e-32,0,this.unsigned)},g4.shru=g4.shiftRightUnsigned,g4.shr_u=g4.shiftRightUnsigned,g4.toSigned=function(){return this.unsigned?t4(this.low,this.high,!1):this},g4.toUnsigned=function(){return this.unsigned?this:t4(this.low,this.high,!0)},g4.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},g4.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},g4.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},Y3.fromBytes=function(e,t,n){return n?Y3.fromBytesLE(e,t):Y3.fromBytesBE(e,t)},Y3.fromBytesLE=function(e,t){return new Y3(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},Y3.fromBytesBE=function(e,t){return new Y3(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};var y4=r(K3),b4=y4||t({__proto__:null,default:y4},[K3]);function x4(e){return b4.fromString(e,!0,16)}var k4=x4("c3a5c85c97cb3127"),w4=x4("b492b66fbe98f273"),I4=x4("9ae16a3b2f90404f");function N4(e){return e.xor(e.shru(47))}function S4(e,t,n){var r=e.slice(t,t+n);return b4.fromBytes(Array.from(r),!0,!0)}function T4(e,t){return S4(e,t,8)}function E4(e,t){return S4(e,t,4)}function C4(e,t){return 0===t?e:e.shru(t).or(e.shl(64-t))}function A4(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:x4("9ddfea08eb382d69"),r=e.xor(t).mul(n);r=r.xor(r.shru(47));var a=t.xor(r).mul(n);return a=(a=a.xor(a.shru(47))).mul(n)}function R4(e,t,n,r){return function(e,t,n,r,a,i){a=a.add(e),i=C4(i.add(a).add(r),21);var o=a;return a=(a=a.add(t)).add(n),i=i.add(C4(a,44)),[a.add(r),i.add(o)]}(T4(e,t),T4(e,t+8),T4(e,t+16),T4(e,t+24),n,r)}function _4(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.length;if(t>=8){var n=I4.add(2*t),r=T4(e,0).add(I4),a=T4(e,t-8),i=C4(a,37).mul(n).add(r),o=C4(r,25).add(a).mul(n);return A4(i,o,n)}if(t>=4){var s=I4.add(2*t),u=E4(e,0);return A4(u.shl(3).add(t),E4(e,t-4),s)}if(t>0){var c=e[0],l=e[t>>1],h=e[t-1],p=c+(l<<8),f=t+(h<<2);return N4(I4.mul(p).xor(k4.mul(f))).mul(I4)}return I4}function O4(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.length,n=I4.add(2*t),r=T4(e,0).mul(w4),a=T4(e,8),i=T4(e,t-8).mul(n),o=T4(e,t-16).mul(I4);return A4(C4(r.add(a),43).add(C4(i,30)).add(o),r.add(C4(a.add(I4),18)).add(i),n)}function F4(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.length,n=I4.add(2*t),r=T4(e,0).mul(I4),a=T4(e,8),i=T4(e,t-8).mul(n),o=T4(e,t-16).mul(I4),s=C4(r.add(a),43).add(C4(i,30)).add(o),u=A4(s,r.add(C4(a.add(I4),18)).add(i),n),c=T4(e,16).mul(n),l=T4(e,24),h=s.add(T4(e,t-32)).mul(n),p=u.add(T4(e,t-24)).mul(n);return A4(C4(c.add(l),43).add(C4(h,30)).add(p),c.add(C4(l.add(r),18)).add(h),n)}function D4(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.length,n=b4.fromNumber(81,!0);if(t<=32)return t<=16?_4(e,t):O4(e,t);if(t<=64)return F4(e,t);var r=n,a=n.mul(w4).add(113),i=N4(a.mul(I4).add(113)).mul(I4),o=[b4.UZERO,b4.UZERO],s=[b4.UZERO,b4.UZERO];r=r.mul(I4).add(T4(e,0));var u=0,c=64*(t-1>>6),l=c+(t-1&63)-63;do{r=C4(r.add(a).add(o[0]).add(T4(e,u+8)),37).mul(w4),a=C4(a.add(o[1]).add(T4(e,u+48)),42).mul(w4),r=r.xor(s[1]),a=a.add(o[0]).add(T4(e,u+40)),i=C4(i.add(s[0]),33).mul(w4),o=R4(e,u,o[1].mul(w4),r.add(s[0])),s=R4(e,u+32,i.add(s[1]),a.add(T4(e,u+16)));var h=[r,i];i=h[0],r=h[1],u+=64}while(u!==c);var p=w4.add(i.and(255).shl(1));u=l,s[0]=s[0].add(t-1&63),o[0]=o[0].add(s[0]),s[0]=s[0].add(o[0]),r=C4(r.add(a).add(o[0]).add(T4(e,u+8)),37).mul(p),a=C4(a.add(o[1]).add(T4(e,u+48)),42).mul(p),r=r.xor(s[1].mul(9)),a=a.add(o[0].mul(9).add(T4(e,u+40))),i=C4(i.add(s[0]),33).mul(p),o=R4(e,u,o[1].mul(p),r.add(s[0])),s=R4(e,u+32,i.add(s[1]),a.add(T4(e,u+16)));var f=[r,i];return i=f[0],r=f[1],A4(A4(o[0],s[0],p).add(N4(a).mul(k4)).add(i),A4(o[1],s[1],p).add(r),p)}function M4(e,t){return"string"===t?B4(e):L4([e],t)}function L4(e,t){if("string"===t)throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=U4(e)),k0().getBool("DEBUG")&&X$(e,t),function(e,t){return e instanceof Float32Array&&"float32"===t||e instanceof Int32Array&&"int32"===t||e instanceof Uint8Array&&"bool"===t}(e,t))return e;if(null==t||"float32"===t||"complex64"===t)return new Float32Array(e);if("int32"===t)return new Int32Array(e);if("bool"===t){for(var n=new Uint8Array(e.length),r=0;r<n.length;++r)0!==Math.round(e[r])&&(n[r]=1);return n}throw new Error("Unknown data type ".concat(t))}function z4(){return k0().platform.now()}function P4(e,t){return k0().platform.fetch(e,t)}function B4(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf-8";return t=t||"utf-8",k0().platform.encode(e,t)}function W4(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf-8";return t=t||"utf-8",k0().platform.decode(e,t)}function V4(e){return null!=k0().platform.isTypedArray?k0().platform.isTypedArray(e):q3(e)}function U4(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null==t&&(t=[]),"boolean"==typeof e||"number"==typeof e||"string"==typeof e||v0(e)||null==e||V4(e)&&n)t.push(e);else if(Array.isArray(e)||V4(e))for(var r=0;r<e.length;++r)U4(e[r],t,n);else{for(var a=-1,i=0,o=Object.keys(e);i<o.length;i++){var s=o[i];/^([1-9]+[0-9]*|0)$/.test(s)&&(a=Math.max(a,Number(s)))}for(var u=0;u<=a;u++)U4(e[u],t,n)}return t}var G4={__proto__:null,arraysEqual:P$,arraysEqualWithNull:z$,assert:F$,assertNonNegativeIntegerDimensions:p0,assertNonNull:M$,assertShapesMatch:D$,bytesFromStringArray:Q$,bytesPerElement:Z$,checkConversionForErrors:X$,clamp:A$,computeStrides:i0,convertBackendValuesAndArrayBuffer:u0,createScalarValue:M4,createShuffledIndices:function(e){for(var t=new Uint32Array(e),n=0;n<e;++n)t[n]=n;return C$(t),t},decodeString:W4,distSquared:function(e,t){for(var n=0,r=0;r<e.length;r++){var a=Number(e[r])-Number(t[r]);n+=a*a}return n},encodeString:B4,fetch:P4,fingerPrint64:D4,flatten:U4,getArrayFromDType:K$,getTypedArrayFromDType:q$,hasEncodingLoss:J$,hexToLong:x4,indexToLoc:d0,inferDtype:n0,inferFromImplicitShape:G$,isBoolean:e0,isFunction:r0,isInt:B$,isNumber:t0,isPromise:v0,isScalarShape:function(e){return 0===e.length},isString:$$,isTypedArray:V4,isValidDtype:Y$,locToIndex:f0,makeOnesTypedArray:c0,makeZerosNestedTypedArray:h0,makeZerosTypedArray:l0,nearestDivisor:a0,nearestLargerEven:R$,now:z4,parseAxisParam:j$,randUniform:function(e,t){var n=Math.random();return t*n+(1-n)*e},repeatedTry:U$,rightPad:V$,shuffle:C$,shuffleCombo:function(e,t){if(e.length!==t.length)throw new Error("Array sizes must match to be shuffled together "+"First array length was ".concat(e.length)+"Second array length was ".concat(t.length));for(var n=e.length,r=0;n>0;)r=Math.random()*n|0,_$(e,--n,r),_$(t,n,r)},sizeFromShape:L$,sizeToSquarishShape:W$,squeezeShape:H$,sum:O$,swap:_$,tanh:function(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)},toNestedArray:s0,toTypedArray:L4},j4=function(){function e(t,n){l(this,e),this.backendTimer=t,this.logger=n,null==n&&(this.logger=new H4)}return p(e,[{key:"profileKernel",value:function(e,t,n){var r,a,i=function(){r=n()},o=z4();if(this.backendTimer.timerAvailable())a=this.backendTimer.time(i);else{i();var s,u=O(r);try{for(u.s();!(s=u.n()).done;){s.value.dataSync()}}catch(e){u.e(e)}finally{u.f()}a=Promise.resolve({kernelMs:z4()-o})}if(k0().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(var c=function(){var t=r[l];t.data().then((function(n){!function(e,t,n){if("float32"!==t)return!1;for(var r=0;r<e.length;r++){var a=e[r];if(isNaN(a)||!isFinite(a))return console.warn("Found ".concat(a," in the result of '").concat(n,"'")),!0}}(n,t.dtype,e)}))},l=0;l<r.length;l++)c();return{kernelName:e,outputs:r,inputs:t,timeMs:a.then((function(e){return e.kernelMs})),extraInfo:a.then((function(e){return null!=e.getExtraProfileInfo?e.getExtraProfileInfo():""}))}}},{key:"logKernelProfile",value:function(e){var t=this,n=e.kernelName,r=e.outputs,a=e.timeMs,i=e.inputs,o=e.extraInfo;r.forEach((function(e){Promise.all([e.data(),a,o]).then((function(r){t.logger.logKernelProfile(n,e,r[0],r[1],i,r[2])}))}))}}]),e}();var H4=function(){function e(){l(this,e)}return p(e,[{key:"logKernelProfile",value:function(e,t,n,r,a,i){var o="number"==typeof r?V$("".concat(r,"ms"),9):r.error,s=V$(e,25),u=t.rank,c=t.size,l=V$(t.shape.toString(),14),h="";for(var p in a){var f=a[p];if(null!=f){var d=f.shape||t.shape,v=d.length;h+="".concat(p,": ").concat(v,"D ").concat(v>0?d:""," ")}}console.log("%c".concat(s,"\t%c").concat(o,"\t%c").concat(u,"D ").concat(l,"\t%c").concat(c,"\t%c").concat(h,"\t%c").concat(i),"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}}]),e}();function q4(e,t,n){for(var r={},a={},i=0;i<t.length;i++)r[t[i].id]=!0;for(var o=0;o<e.length;o++){var s=e[o],u=s.inputs;for(var c in u){for(var l=u[c],h=!1,p=0;p<t.length;p++)if(r[l.id]){s.outputs.forEach((function(e){return r[e.id]=!0})),h=!0,a[s.id]=!0;break}if(h)break}}var f={};f[n.id]=!0;for(var d={},v=e.length-1;v>=0;v--)for(var m=e[v],g=m.inputs,y=0;y<m.outputs.length;y++)if(f[m.outputs[y].id]){for(var b in g)f[g[b].id]=!0,d[m.id]=!0;break}for(var x=[],k=0;k<e.length;k++){var w=e[k];if(a[w.id]&&d[w.id]){var I={};for(var N in w.inputs){var S=w.inputs[N];r[S.id]&&(I[N]=S)}var T=Object.assign({},w);T.inputs=I,T.outputs=w.outputs,x.push(T)}}return x}function K4(e,t,n,r){for(var a=function(){var a=t[i],o=[];if(a.outputs.forEach((function(t){var n=e[t.id];null!=n?o.push(n):o.push(null)})),null==a.gradient)throw new Error("Cannot compute gradient: gradient function not found "+"for ".concat(a.kernelName,"."));var s=a.gradient(o),u=function(t){if(!(t in s))throw new Error("Cannot backprop through input ".concat(t,". ")+"Available gradients found: ".concat(Object.keys(s),"."));var i=n((function(){return s[t]()}));if("float32"!==i.dtype)throw new Error("Error in gradient for op ".concat(a.kernelName,". The gradient of input ")+"".concat(t," must have 'float32' dtype, but has '").concat(i.dtype,"'"));var o=a.inputs[t];if(!P$(i.shape,o.shape))throw new Error("Error in gradient for op ".concat(a.kernelName,". The gradient of input ")+"'".concat(t,"' has shape '").concat(i.shape,"', which does not match ")+"the shape of the input '".concat(o.shape,"'"));if(null==e[o.id])e[o.id]=i;else{var u=e[o.id];e[o.id]=r(u,i),u.dispose()}};for(var c in a.inputs)u(c)},i=t.length-1;i>=0;i--)a()}function X4(e,t,n,r){var a=i0(t),i=function(e,t,n,r){var a=L$(t),i=r[r.length-1],o=new Array(i).fill(0),s=t.length,u="complex64"===n?Q4(e):e;if(s>1)for(var c=0;c<a/i;c++)for(var l=c*i,h=0;h<i;h++)o[h]=Math.max(o[h],Y4(u[l+h],0,n).length);return o}(e,t,n,a),o=t.length,s=Z4(e,t,n,a,i),u=["Tensor"];return r&&(u.push(" dtype: ".concat(n)),u.push(" rank: ".concat(o)),u.push(" shape: [".concat(t,"]")),u.push(" values:")),u.push(s.map((function(e){return" "+e})).join("\n")),u.join("\n")}function Y4(e,t,n){return V$(Array.isArray(e)?"".concat(parseFloat(e[0].toFixed(7))," + ")+"".concat(parseFloat(e[1].toFixed(7)),"j"):$$(e)?"'".concat(e,"'"):"bool"===n?J4(e):parseFloat(e.toFixed(7)).toString(),t)}function J4(e){return 0===e?"false":"true"}function Z4(e,t,n,r,a){var i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o="complex64"===n?2:1,s=t[0],u=t.length;if(0===u){if("complex64"===n){var c=Q4(e);return[Y4(c[0],0,n)]}return"bool"===n?[J4(e[0])]:[e[0].toString()]}if(1===u){if(s>20){var l=3*o,h=Array.from(e.slice(0,l)),p=Array.from(e.slice((s-3)*o,s*o));return"complex64"===n&&(h=Q4(h),p=Q4(p)),["["+h.map((function(e,t){return Y4(e,a[t],n)})).join(", ")+", ..., "+p.map((function(e,t){return Y4(e,a[s-3+t],n)})).join(", ")+"]"]}var f="complex64"===n?Q4(e):Array.from(e);return["["+f.map((function(e,t){return Y4(e,a[t],n)})).join(", ")+"]"]}var d=t.slice(1),v=r.slice(1),m=r[0]*o,g=[];if(s>20){for(var y=0;y<3;y++){var b=y*m,x=b+m;g.push.apply(g,T(Z4(e.slice(b,x),d,n,v,a,!1)))}g.push("...");for(var k=s-3;k<s;k++){var w=k*m,I=w+m;g.push.apply(g,T(Z4(e.slice(w,I),d,n,v,a,k===s-1)))}}else for(var N=0;N<s;N++){var S=N*m,E=S+m;g.push.apply(g,T(Z4(e.slice(S,E),d,n,v,a,N===s-1)))}var C=2===u?",":"";g[0]="["+(s>0?g[0]+C:"");for(var A=1;A<g.length-1;A++)g[A]=" "+g[A]+C;for(var R=",\n",_=2;_<u;_++)R+="\n";return g[g.length-1]=" "+g[g.length-1]+"]"+(i?"":R),g}function Q4(e){for(var t=[],n=0;n<e.length;n+=2)t.push([e[n],e[n+1]]);return t}var $4=function(){function e(t,n,r){var a=this;if(l(this,e),this.dtype=n,this.shape=t.slice(),this.size=L$(t),null!=r){var i=r.length;F$(i===this.size,(function(){return"Length of values '".concat(i,"' does not match the size ")+"inferred by the shape '".concat(a.size,"'.")}))}if("complex64"===n)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=r||K$(n,this.size),this.strides=i0(t)}return p(e,[{key:"set",value:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];0===r.length&&(r=[0]),F$(r.length===this.rank,(function(){return"The number of provided coordinates (".concat(r.length,") must ")+"match the rank (".concat(t.rank,")")}));var i=this.locToIndex(r);this.values[i]=e}},{key:"get",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];0===t.length&&(t=[0]);for(var r=0,a=0,i=t;a<i.length;a++){var o=i[a];if(o<0||o>=this.shape[r]){var s="Requested out of range element at ".concat(t,". ")+" Buffer shape=".concat(this.shape);throw new Error(s)}r++}for(var u=t[t.length-1],c=0;c<t.length-1;++c)u+=this.strides[c]*t[c];return this.values[u]}},{key:"locToIndex",value: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}},{key:"indexToLoc",value: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}},{key:"rank",get:function(){return this.shape.length}},{key:"toTensor",value:function(){return e5().makeTensor(this.values,this.shape,this.dtype)}}]),e}(),e5=null,t5=null;var n5=function(){function e(t,n,r,a){l(this,e),this.kept=!1,this.isDisposedInternal=!1,this.shape=t.slice(),this.dtype=n||"float32",this.size=L$(t),this.strides=i0(t),this.dataId=r,this.id=a,this.rankType=this.rank<5?this.rank.toString():"higher"}var t,n,r,a;return p(e,[{key:"rank",get:function(){return this.shape.length}},{key:"buffer",value:(a=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.data();case 2:return t=e.sent,e.abrupt("return",t5.buffer(this.shape,this.dtype,t));case 4:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"bufferSync",value:function(){return t5.buffer(this.shape,this.dtype,this.dataSync())}},{key:"array",value:(r=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.data();case 2:return t=e.sent,e.abrupt("return",s0(this.shape,t,"complex64"===this.dtype));case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"arraySync",value:function(){return s0(this.shape,this.dataSync(),"complex64"===this.dtype)}},{key:"data",value:(n=c(o().mark((function e(){var t,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.throwIfDisposed(),t=e5().read(this.dataId),"string"!==this.dtype){e.next=13;break}return e.next=5,t;case 5:return n=e.sent,e.prev=6,e.abrupt("return",n.map((function(e){return W4(e)})));case 10:throw e.prev=10,e.t0=e.catch(6),new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().");case 13:return e.abrupt("return",t);case 14:case"end":return e.stop()}}),e,this,[[6,10]])}))),function(){return n.apply(this,arguments)})},{key:"dataToGPU",value:function(e){return this.throwIfDisposed(),e5().readToGPU(this.dataId,e)}},{key:"dataSync",value:function(){this.throwIfDisposed();var e=e5().readSync(this.dataId);if("string"===this.dtype)try{return e.map((function(e){return W4(e)}))}catch(e){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return e}},{key:"bytes",value:(t=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.throwIfDisposed(),e.next=3,e5().read(this.dataId);case 3:if(t=e.sent,"string"!==this.dtype){e.next=8;break}return e.abrupt("return",t);case 8:return e.abrupt("return",new Uint8Array(t.buffer));case 9:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"dispose",value:function(){this.isDisposed||(e5().disposeTensor(this),this.isDisposedInternal=!0)}},{key:"isDisposed",get:function(){return this.isDisposedInternal}},{key:"throwIfDisposed",value:function(){if(this.isDisposed)throw new Error("Tensor is disposed.")}},{key:"print",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t5.print(this,e)}},{key:"clone",value:function(){return this.throwIfDisposed(),t5.clone(this)}},{key:"toString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.dataSync();return X4(t,this.shape,this.dtype,e)}},{key:"cast",value:function(e){return this.throwIfDisposed(),t5.cast(this,e)}},{key:"variable",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;return this.throwIfDisposed(),e5().makeVariable(this,e,t,n)}}]),e}();function r5(){return I0("Tensor",(function(){return n5}))}Object.defineProperty(n5,Symbol.hasInstance,{value:function(e){return!!e&&null!=e.data&&null!=e.dataSync&&null!=e.throwIfDisposed}}),r5();var a5,i5,o5,s5,u5,c5=function(e){d(n,e);var t=w(n);function n(e,r,a,i){var o;return l(this,n),(o=t.call(this,e.shape,e.dtype,e.dataId,i)).trainable=r,o.name=a,o}return p(n,[{key:"assign",value:function(e){if(e.dtype!==this.dtype)throw new Error("dtype of the new value (".concat(e.dtype,") and ")+"previous value (".concat(this.dtype,") must match"));if(!P$(e.shape,this.shape))throw new Error("shape of the new value (".concat(e.shape,") and ")+"previous value (".concat(this.shape,") must match"));e5().disposeTensor(this),this.dataId=e.dataId,e5().incRef(this,null)}},{key:"dispose",value:function(){e5().disposeVariable(this),this.isDisposedInternal=!0}}]),n}(n5);Object.defineProperty(c5,Symbol.hasInstance,{value:function(e){return e instanceof n5&&null!=e.assign&&e.assign instanceof Function}}),e.Rank=void 0,(a5=e.Rank||(e.Rank={})).R0="R0",a5.R1="R1",a5.R2="R2",a5.R3="R3",a5.R4="R4",a5.R5="R5",a5.R6="R6",function(e){e.float32="float32",e.int32="int32",e.bool="int32",e.complex64="complex64"}(i5||(i5={})),function(e){e.float32="float32",e.int32="int32",e.bool="bool",e.complex64="complex64"}(o5||(o5={})),function(e){e.float32="float32",e.int32="float32",e.bool="float32",e.complex64="complex64"}(s5||(s5={})),function(e){e.float32="complex64",e.int32="complex64",e.bool="complex64",e.complex64="complex64"}(u5||(u5={}));var l5={float32:s5,int32:i5,bool:o5,complex64:u5};function h5(e,t){if("string"===e||"string"===t){if("string"===e&&"string"===t)return"string";throw new Error("Can not upcast ".concat(e," with ").concat(t))}return l5[e][t]}function p5(e){return h5(e,"int32")}function f5(e){return null!=e&&"object"===s(e)&&"texture"in e&&e.texture instanceof WebGLTexture}function d5(e){return"undefined"!=typeof GPUBuffer&&null!=e&&"object"===s(e)&&"buffer"in e&&e.buffer instanceof GPUBuffer}function v5(e,t){if(e.dtype===t.dtype)return[e,t];var n=h5(e.dtype,t.dtype);return[e.cast(n),t.cast(n)]}function m5(e,t){F$(e.dtype===t.dtype,(function(){return"The dtypes of the first(".concat(e.dtype,") and")+" second(".concat(t.dtype,") input must match")}))}function g5(e,t){return t.some((function(t){return t.id===e.id}))}function y5(e){var t=[];return b5(e,t,new Set),t}function b5(e,t,n){if(null!=e)if(e instanceof n5)t.push(e);else if(r=e,Array.isArray(r)||"object"===s(r)){var r,a=e;for(var i in a){var o=a[i];n.has(o)||(n.add(o),b5(o,t,n))}}}var x5={__proto__:null,assertTypesMatch:m5,getTensorsInContainer:y5,isTensorInList:g5,makeTypesMatch:v5};function k5(e){return null!=e.kernelName}var w5=function(){function e(){l(this,e),this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map((function(e){return e.name}))))}}}return p(e,[{key:"dispose",value:function(){for(var e in this.registeredVariables)this.registeredVariables[e].dispose()}}]),e}(),I5=function(){function e(t){l(this,e),this.ENV=t,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new w5}var t,n,r,a;return p(e,[{key:"ready",value:(a=c(o().mark((function e(){var t,n,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==this.pendingBackendInit){e.next=2;break}return e.abrupt("return",this.pendingBackendInit.then((function(){})));case 2:if(null==this.backendInstance){e.next=4;break}return e.abrupt("return");case 4:t=this.getSortedBackends(),n=0;case 6:if(!(n<t.length)){e.next=18;break}return r=t[n],e.next=10,this.initializeBackend(r).success;case 10:if(!e.sent){e.next=15;break}return e.next=14,this.setBackend(r);case 14:return e.abrupt("return");case 15:n++,e.next=6;break;case 18:throw new Error("Could not initialize any backends, all backend initializations failed.");case 19:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"backend",get:function(){if(null!=this.pendingBackendInit)throw new Error("Backend '".concat(this.backendName,"' has not yet been initialized. Make ")+"sure to await tf.ready() or await tf.setBackend() before calling other methods");if(null==this.backendInstance){var e=this.initializeBackendsAndReturnBest(),t=e.name;if(e.asyncInit)throw new Error("The highest priority backend '".concat(t,"' has not yet been ")+"initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");this.setBackend(t)}return this.backendInstance}},{key:"backendNames",value:function(){return Object.keys(this.registryFactory)}},{key:"findBackend",value:function(e){if(!(e in this.registry)){if(!(e in this.registryFactory))return null;if(this.initializeBackend(e).asyncInit)return null}return this.registry[e]}},{key:"findBackendFactory",value:function(e){return e in this.registryFactory?this.registryFactory[e].factory:null}},{key:"registerBackend",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return e in this.registryFactory?(z3("".concat(e," backend was already registered. ")+"Reusing existing backend factory."),!1):(this.registryFactory[e]={factory:t,priority:n},!0)}},{key:"setBackend",value:(r=c(o().mark((function e(t){var n,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=this.registryFactory[t]){e.next=2;break}throw new Error("Backend name '".concat(t,"' not found in registry"));case 2:if(this.backendName=t,null!=this.registry[t]){e.next=16;break}if(this.backendInstance=null,n=this.initializeBackend(t),r=n.success,!n.asyncInit){e.next=12;break}return e.next=9,r;case 9:e.t0=e.sent,e.next=13;break;case 12:e.t0=r;case 13:if(e.t0){e.next=16;break}return e.abrupt("return",!1);case 16:return this.backendInstance=this.registry[t],this.setupRegisteredKernels(),this.profiler=new j4(this.backendInstance),e.abrupt("return",!0);case 20:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"setupRegisteredKernels",value:function(){var e=this;U3(this.backendName).forEach((function(t){null!=t.setupFunc&&t.setupFunc(e.backendInstance)}))}},{key:"disposeRegisteredKernels",value:function(e){var t=this;U3(e).forEach((function(n){null!=n.disposeFunc&&n.disposeFunc(t.registry[e])}))}},{key:"initializeBackend",value:function(e){var t=this,n=this.registryFactory[e];if(null==n)throw new Error("Cannot initialize backend ".concat(e,", no registration found."));try{var r=n.factory();if(!r||r instanceof T$||"function"!=typeof r.then)return this.registry[e]=r,{success:!0,asyncInit:!1};var a=++this.pendingBackendInitId,i=r.then((function(n){return!(a<t.pendingBackendInitId)&&(t.registry[e]=n,t.pendingBackendInit=null,!0)})).catch((function(n){return a<t.pendingBackendInitId||(t.pendingBackendInit=null,z3("Initialization of backend ".concat(e," failed")),z3(n.stack||n.message)),!1}));return this.pendingBackendInit=i,{success:i,asyncInit:!0}}catch(t){return z3("Initialization of backend ".concat(e," failed")),z3(t.stack||t.message),{success:!1,asyncInit:!1}}}},{key:"removeBackend",value:function(e){if(!(e in this.registryFactory))throw new Error("".concat(e," backend not found in registry"));this.backendName===e&&null!=this.pendingBackendInit&&this.pendingBackendInitId++,e in this.registry&&(this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e]),delete this.registryFactory[e],this.backendName===e&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)}},{key:"getSortedBackends",value:function(){var e=this;if(0===Object.keys(this.registryFactory).length)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort((function(t,n){return e.registryFactory[n].priority-e.registryFactory[t].priority}))}},{key:"initializeBackendsAndReturnBest",value:function(){for(var e=this.getSortedBackends(),t=0;t<e.length;t++){var n=e[t],r=this.initializeBackend(n),a=r.success,i=r.asyncInit;if(i||a)return{name:n,asyncInit:i}}throw new Error("Could not initialize any backends, all backend initializations failed.")}},{key:"moveData",value:function(e,t){var n=this.state.tensorInfo.get(t),r=n.backend,a=this.readSync(t),i=r.refCount(t);r.disposeData(t,!0),n.backend=e,e.move(t,a,n.shape,n.dtype,i),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++}},{key:"tidy",value:function(e,t){var n,r=this,a=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");a=e}return this.scopedRun((function(){return r.startScope(a)}),(function(){return r.endScope(n)}),(function(){return(n=t())instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),n}))}},{key:"scopedRun",value:function(e,t,n){e();try{var r=n();return t(),r}catch(e){throw t(),e}}},{key:"nextTensorId",value:function(){return e.nextTensorId++}},{key:"nextVariableId",value:function(){return e.nextVariableId++}},{key:"clone",value:function(e){var t=E5.runKernel(W1,{x:e}),n={x:e};return this.addTapeNode(this.state.activeScope.name,n,[t],(function(e){return{x:function(){var t={x:e},n={dtype:"float32"};return E5.runKernel(X0,t,n)}}}),[],{}),t}},{key:"runKernel",value:function(e,t,n){if(null==this.backendName&&this.backend,!(null!=W3(e,this.backendName)))throw new Error("Kernel '".concat(e,"' not registered for backend '").concat(this.backendName,"'"));return this.runKernelFunc({kernelName:e,inputs:t,attrs:n})}},{key:"shouldCheckForMemLeaks",value:function(){return this.ENV.getBool("IS_TEST")}},{key:"checkKernelForMemLeak",value:function(e,t,n){var r=this.backend.numDataIds(),a=0;n.forEach((function(e){a+="complex64"===e.dtype?3:1}));var i=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],o=r-t-a-i;if(o>0)throw new Error("Backend '".concat(this.backendName,"' has an internal memory leak ")+"(".concat(o," data ids) after running '").concat(e,"'"))}},{key:"runKernelFunc",value:function(e){var t,n,r,a=this,i=[],o=this.isTapeOn(),s=this.state.numBytes,u=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0),null==this.backendName&&this.backend;var c=k5(e)?e.kernelName:null!=this.state.activeScope?this.state.activeScope.name:"";if(k5(e)){var l=e.kernelName,h=e.inputs,p=e.attrs;null==this.backendName&&this.backend;var f=W3(l,this.backendName);F$(null!=f,(function(){return"Cannot find registered kernel '".concat(l,"' for backend '").concat(a.backendName,"'")})),n=function(){var e=a.backend.numDataIds();r=f.kernelFunc({inputs:h,attrs:p,backend:a.backend});var t=Array.isArray(r)?r:[r];a.shouldCheckForMemLeaks()&&a.checkKernelForMemLeak(l,e,t);var n=t.map((function(e){return null!=e.rank?e:a.makeTensorFromTensorInfo(e)}));if(o){var s=a.getTensorsForGradient(l,h,n);i=a.saveTensorsForBackwardMode(s)}return n}}else{var d=e.forwardFunc,v=function(e){o&&(i=e.map((function(e){return a.keep(a.clone(e))})))};n=function(){var e=a.backend.numDataIds();r=a.tidy((function(){return d(a.backend,v)}));var t=Array.isArray(r)?r:[r];return a.shouldCheckForMemLeaks()&&a.checkKernelForMemLeak(c,e,t),t}}var m,g=e.inputs,y=e.attrs,b=k5(e)?null:e.backwardsFunc;return this.scopedRun((function(){return a.state.kernelDepth++}),(function(){return a.state.kernelDepth--}),(function(){a.ENV.getBool("DEBUG")||a.state.profiling?(m=a.profiler.profileKernel(c,g,(function(){return n()})),a.ENV.getBool("DEBUG")&&a.profiler.logKernelProfile(m),t=m.outputs):t=n()})),o&&this.addTapeNode(c,g,t,b,i,y),this.state.profiling&&this.state.activeProfile.kernels.push({name:c,bytesAdded:this.state.numBytes-s,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-u,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(g).map((function(e){return null!=g[e]?g[e].shape:null})),outputShapes:t.map((function(e){return e.shape})),kernelTimeMs:m.timeMs,extraInfo:m.extraInfo}),Array.isArray(r)?t:t[0]}},{key:"saveTensorsForBackwardMode",value:function(e){var t=this,n=e.map((function(e){return t.keep(t.clone(e))}));return n}},{key:"getTensorsForGradient",value:function(e,t,n){var r=V3(e);if(null!=r){var a,i=r.inputsToSave||[],o=r.outputsToSave||[];r.saveAllInputs?(F$(Array.isArray(t),(function(){return"saveAllInputs is true, expected inputs to be an array."})),a=Object.keys(t).map((function(e){return t[e]}))):a=i.map((function(e){return t[e]}));var s=n.filter((function(e,t){return o[t]}));return a.concat(s)}return[]}},{key:"makeTensor",value:function(e,t,n,r){if(null==e)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",r=r||this.backend;var a=e;"string"===n&&$$(e[0])&&(a=e.map((function(e){return B4(e)})));var i=r.write(a,t,n),o=new n5(t,n,i,this.nextTensorId());if(this.trackTensor(o,r),"string"===n){var s=this.state.tensorInfo.get(i),u=Q$(a);this.state.numBytes+=u-s.bytes,s.bytes=u}return o}},{key:"makeTensorFromDataId",value:function(e,t,n,r){var a={dataId:e,shape:t,dtype:n=n||"float32"};return this.makeTensorFromTensorInfo(a,r)}},{key:"makeTensorFromTensorInfo",value:function(e,t){var n=e.dataId,r=e.shape,a=e.dtype,i=new n5(r,a,n,this.nextTensorId());return this.trackTensor(i,t),i}},{key:"makeVariable",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;n=n||this.nextVariableId().toString(),null!=r&&r!==e.dtype&&(e=e.cast(r));var a=new c5(e,t,n,this.nextTensorId());if(null!=this.state.registeredVariables[a.name])throw new Error("Variable with name ".concat(a.name," was already registered"));return this.state.registeredVariables[a.name]=a,this.incRef(a,this.backend),a}},{key:"trackTensor",value:function(e,t){this.state.numTensors++,"string"===e.dtype&&this.state.numStringTensors++;var n=0;"complex64"!==e.dtype&&"string"!==e.dtype&&(n=e.size*Z$(e.dtype)),this.state.numBytes+=n,this.state.tensorInfo.has(e.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(e.dataId,{backend:t||this.backend,dtype:e.dtype,shape:e.shape,bytes:n})),e instanceof c5||this.track(e)}},{key:"incRef",value:function(e,t){this.trackTensor(e,t),this.backend.incRef(e.dataId)}},{key:"removeDataId",value:function(e,t){this.state.tensorInfo.has(e)&&this.state.tensorInfo.get(e).backend===t&&(this.state.tensorInfo.delete(e),this.state.numDataBuffers--)}},{key:"disposeTensor",value:function(e){if(this.state.tensorInfo.has(e.dataId)){var t=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,"string"===e.dtype&&(this.state.numStringTensors--,this.state.numBytes-=t.bytes),"complex64"!==e.dtype&&"string"!==e.dtype){var n=e.size*Z$(e.dtype);this.state.numBytes-=n}t.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,t.backend)}}},{key:"disposeVariables",value:function(){for(var e in this.state.registeredVariables){var t=this.state.registeredVariables[e];this.disposeVariable(t)}}},{key:"disposeVariable",value:function(e){this.disposeTensor(e),null!=this.state.registeredVariables[e.name]&&delete this.state.registeredVariables[e.name]}},{key:"memory",value:function(){var e=this.backend.memory();return e.numTensors=this.state.numTensors,e.numDataBuffers=this.state.numDataBuffers,e.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(e.unreliable=!0,null==e.reasons&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}},{key:"profile",value:(n=c(o().mark((function e(t){var n,r,a,i,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.state.profiling=!0,n=this.state.numBytes,r=this.state.numTensors,this.state.activeProfile.kernels=[],e.next=6,t();case 6:this.state.activeProfile.result=e.sent,this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max.apply(Math,T(this.state.activeProfile.kernels.map((function(e){return e.totalBytesSnapshot})))),this.state.activeProfile.newBytes=this.state.numBytes-n,this.state.activeProfile.newTensors=this.state.numTensors-r,a=O(this.state.activeProfile.kernels),e.prev=12,a.s();case 14:if((i=a.n()).done){e.next=24;break}return s=i.value,e.next=18,s.kernelTimeMs;case 18:return s.kernelTimeMs=e.sent,e.next=21,s.extraInfo;case 21:s.extraInfo=e.sent;case 22:e.next=14;break;case 24:e.next=29;break;case 26:e.prev=26,e.t0=e.catch(12),a.e(e.t0);case 29:return e.prev=29,a.f(),e.finish(29);case 32:return e.abrupt("return",this.state.activeProfile);case 33:case"end":return e.stop()}}),e,this,[[12,26,29,32]])}))),function(e){return n.apply(this,arguments)})},{key:"isTapeOn",value:function(){return this.state.gradientDepth>0&&0===this.state.kernelDepth}},{key:"addTapeNode",value:function(e,t,n,r,a,i){var o=this,s={id:this.state.nextTapeNodeId++,kernelName:e,inputs:t,outputs:n,saved:a},u=V3(e);null!=u&&(r=u.gradFunc),null!=r&&(s.gradient=function(e){return e=e.map((function(e,t){if(null==e){var r=n[t],a=l0(r.size,r.dtype);return o.makeTensor(a,r.shape,r.dtype)}return e})),r(e.length>1?e:e[0],a,i)}),this.state.activeTape.push(s)}},{key:"keep",value:function(e){return e.kept=!0,e}},{key:"startTape",value:function(){0===this.state.gradientDepth&&(this.state.activeTape=[]),this.state.gradientDepth++}},{key:"endTape",value:function(){this.state.gradientDepth--}},{key:"startScope",value:function(e){var t={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(t.name=e),this.state.scopeStack.push(t),this.state.activeScope=t}},{key:"endScope",value:function(e){for(var t=this,n=y5(e),r=new Set(n.map((function(e){return e.id}))),a=0;a<this.state.activeScope.track.length;a++){var i=this.state.activeScope.track[a];i.kept||r.has(i.id)||i.dispose()}var o=this.state.scopeStack.pop();this.state.activeScope=0===this.state.scopeStack.length?null:this.state.scopeStack[this.state.scopeStack.length-1],n.forEach((function(e){e.kept||e.scopeId!==o.id||t.track(e)}))}},{key:"gradients",value:function(e,t,n){var r=this,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(F$(t.length>0,(function(){return"gradients() received an empty list of xs."})),null!=n&&"float32"!==n.dtype)throw new Error("dy must have 'float32' dtype, but has '".concat(n.dtype,"'"));var i=this.scopedRun((function(){return r.startTape()}),(function(){return r.endTape()}),(function(){return r.tidy("forward",e)}));F$(i instanceof n5,(function(){return"The result y returned by f() must be a tensor."}));var o=q4(this.state.activeTape,t,i);if(!a&&0===o.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.");return this.tidy("backward",(function(){var e={};e[i.id]=null==n?N5(i.shape):n,K4(e,o,(function(e){return r.tidy(e)}),C5);var a=t.map((function(t){return e[t.id]}));return 0===r.state.gradientDepth&&(r.state.activeTape.forEach((function(e){var t,n=O(e.saved);try{for(n.s();!(t=n.n()).done;){t.value.dispose()}}catch(e){n.e(e)}finally{n.f()}})),r.state.activeTape=null),{value:i,grads:a}}))}},{key:"customGrad",value:function(e){var t=this;return F$(r0(e),(function(){return"The f passed in customGrad(f) must be a function."})),function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];var i;F$(r.every((function(e){return e instanceof n5})),(function(){return"The args passed in customGrad(f)(x1, x2,...) must all be tensors"}));var o={};r.forEach((function(e,t){o[t]=e}));var s=function(t,n){return F$((i=e.apply(void 0,[].concat(r,[n]))).value instanceof n5,(function(){return"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"})),F$(r0(i.gradFunc),(function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."})),i.value},u=function(e,t){var n=i.gradFunc(e,t),a=Array.isArray(n)?n:[n];F$(a.length===r.length,(function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."})),F$(a.every((function(e){return e instanceof n5})),(function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors."}));var o={};return a.forEach((function(e,t){o[t]=function(){return e}})),o};return t.runKernelFunc({forwardFunc:s,backwardsFunc:u,inputs:o})}}},{key:"readSync",value:function(e){return this.state.tensorInfo.get(e).backend.readSync(e)}},{key:"read",value:function(e){return this.state.tensorInfo.get(e).backend.read(e)}},{key:"readToGPU",value:function(e,t){return this.state.tensorInfo.get(e).backend.readToGPU(e,t)}},{key:"time",value:(t=c(o().mark((function e(t){var n,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=z4(),e.next=3,this.backend.time(t);case 3:return(r=e.sent).wallMs=z4()-n,e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"track",value:function(e){return null!=this.state.activeScope&&(e.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(e)),e}},{key:"registeredVariables",get:function(){return this.state.registeredVariables}},{key:"reset",value:function(){for(var e in this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new w5,this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}}]),e}();function N5(e){var t=c0(L$(e),"float32");return E5.makeTensor(t,e,"float32")}function S5(){var t=w0();if(null==t._tfengine){var n=new y0(t);t._tfengine=new I5(n)}return function(t){e.ENV=t}(t._tfengine.ENV),e5=function(){return t._tfengine},t._tfengine}I5.nextTensorId=0,I5.nextVariableId=0;var T5,E5=S5();function C5(e,t){var n={a:e,b:t};return E5.runKernel(E0,n)}function A5(e){if(void 0!==T5)return T5;if(e||"undefined"!=typeof navigator&&null!=navigator){if(e||(e=navigator),"ReactNative"===e.product)return!0;var t=e.userAgent||e.vendor||("undefined"!=typeof window?window.opera:"");if(!t){var n=e;return n.userAgentData&&n.userAgentData.mobile}return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))}return!1}function R5(){return"undefined"!=typeof window&&null!=window.document||"undefined"!=typeof WorkerGlobalScope}var _5={__proto__:null,isBrowser:R5,isMobile:A5,mockIsMobile:function(e){T5=e}},O5=k0();function F5(e,t){var n=e;if(V4(e))return"string"===t?[]:[e.length];if(f5(e)){var r=e.channels||"RGBA";return[e.height,e.width*r.length]}if(d5(e))return[e.buffer.size/(null==t?4:Z$(t))];if(!Array.isArray(e))return[];for(var a=[];Array.isArray(n)||V4(n)&&"string"!==t;)a.push(n.length),n=n[0];return Array.isArray(e)&&k0().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&D5(e,a,[]),a}function D5(e,t,n){if(n=n||[],Array.isArray(e)||V4(e)){F$(t.length>0,(function(){return"Element arr[".concat(n.join("]["),"] should be a primitive, ")+"but is an array of ".concat(e.length," elements")})),F$(e.length===t[0],(function(){return"Element arr[".concat(n.join("]["),"] should have ").concat(t[0]," ")+"elements, but has ".concat(e.length," elements")}));for(var r=t.slice(1),a=0;a<e.length;++a)D5(e[a],r,n.concat(a))}else F$(0===t.length,(function(){return"Element arr[".concat(n.join("]["),"] is a primitive, ")+"but should be an array/TypedArray of ".concat(t[0]," elements")}))}function M5(e,t,n,r){if("string_or_numeric"!==e){if(null==e)throw new Error("Expected dtype cannot be null.");if("numeric"!==e&&e!==t||"numeric"===e&&"string"===t)throw new Error("Argument '".concat(n,"' passed to '").concat(r,"' must ")+"be ".concat(e," tensor, but got ").concat(t," tensor"))}}function L5(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"numeric";if(e instanceof n5)return M5(r,e.dtype,t,n),e;var a=n0(e);if("string"!==a&&["bool","int32","float32"].indexOf(r)>=0&&(a=r),M5(r,a,t,n),null==e||!V4(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e&&"string"!=typeof e){var i=null==e?"null":e.constructor.name;throw new Error("Argument '".concat(t,"' passed to '").concat(n,"' must be a ")+"Tensor or TensorLike, but got '".concat(i,"'"))}var o=F5(e,a);V4(e)||Array.isArray(e)||(e=[e]);var s=!0,u="string"!==a?L4(e,a):U4(e,[],s);return E5.makeTensor(u,o,a)}function z5(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"numeric";if(!Array.isArray(e))throw new Error("Argument ".concat(t," passed to ").concat(n," must be a ")+"`Tensor[]` or `TensorLike[]`");var a=e;return a.map((function(e,a){return L5(e,"".concat(t,"[").concat(a,"]"),n,r)}))}O5.registerFlag("DEBUG",(function(){return!1}),(function(e){e&&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.")})),O5.registerFlag("IS_BROWSER",(function(){return R5()})),O5.registerFlag("IS_NODE",(function(){return"undefined"!=typeof process&&void 0!==process.versions&&void 0!==process.versions.node})),O5.registerFlag("IS_CHROME",(function(){return"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)})),O5.registerFlag("IS_SAFARI",(function(){return"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor)})),O5.registerFlag("PROD",(function(){return!1})),O5.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",(function(){return O5.getBool("DEBUG")})),O5.registerFlag("DEPRECATION_WARNINGS_ENABLED",(function(){return!0})),O5.registerFlag("IS_TEST",(function(){return!1})),O5.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",(function(){return O5.getBool("DEBUG")})),O5.registerFlag("WRAP_TO_IMAGEBITMAP",(function(){return!1})),O5.registerFlag("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU",(function(){return!1})),O5.registerFlag("USE_SETTIMEOUTCUSTOM",(function(){return!1}));var P5="__op";function B5(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 "+"".concat(t.length," keys."));var n=t[0],r=e[n];n.endsWith("_")&&(n=n.substring(0,n.length-1)),n+=P5;var a=function(){E5.startScope(n);try{var e=r.apply(void 0,arguments);return v0(e)&&console.error("Cannot return a Promise inside of tidy."),E5.endScope(e),e}catch(e){throw E5.endScope(null),e}};return Object.defineProperty(a,"name",{value:n,configurable:!0}),a}var W5=B5({complex_:function(e,t){var n=L5(e,"real","complex"),r=L5(t,"imag","complex");D$(n.shape,r.shape,"real and imag shapes, ".concat(n.shape," and ").concat(r.shape,", ")+"must match in call to tf.complex().");var a={real:n,imag:r};return E5.runKernel(Z0,a)}});function V5(e,t,n,r){if(null==r)r=n0(e);else if("complex64"===r)throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(d5(e)||f5(e)){if("float32"!==r&&"int32"!==r)throw new Error("Creating tensor from GPU data only supports "+"'float32'|'int32' dtype, while the dtype is ".concat(r,"."));return E5.backend.createTensorFromGPUData(e,t||n,r)}if(!V4(e)&&!Array.isArray(e)&&"number"!=typeof e&&"boolean"!=typeof e&&"string"!=typeof e)throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(null!=t){p0(t);var a=L$(t),i=L$(n);F$(a===i,(function(){return"Based on the provided shape, [".concat(t,"], the tensor should have ")+"".concat(a," values but has ").concat(i)}));for(var o=0;o<n.length;++o){var s=n[o],u=o!==n.length-1||s!==L$(t.slice(o));F$(n[o]===t[o]||!u,(function(){return"Error creating a new Tensor. Inferred shape "+"(".concat(n,") does not match the provided ")+"shape (".concat(t,"). ")}))}}return V4(e)||Array.isArray(e)||(e=[e]),t=t||n,e="string"!==r?L4(e,r):U4(e,[],!0),E5.makeTensor(e,t,r)}function U5(e,t,n){return V5(e,t,F5(e,n),n)}var G5={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8},j5=function(){function e(t){if(l(this,e),this.shards=[],this.previousShardIndex=0,null!=t&&(t instanceof Array||(t=[t]),0!==(t=t.map((function(e){return V4(e)?e.buffer:e}))).length)){this.bufferUniformSize=t[0].byteLength;for(var n=0,r=0;r<t.length;r++){var a=t[r];r!==t.length-1&&a.byteLength!==this.bufferUniformSize&&(this.bufferUniformSize=void 0);var i=n+a.byteLength;this.shards.push({buffer:a,start:n,end:i}),n=i}0===this.shards.length&&(this.byteLength=0),this.byteLength=this.shards[this.shards.length-1].end}}return p(e,[{key:"slice",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.byteLength;if(0===this.shards.length)return new ArrayBuffer(0);if(e=isNaN(Number(e))?0:e,t=isNaN(Number(t))?0:t,e=Math.max(0,e),(t=Math.min(this.byteLength,t))<=e)return new ArrayBuffer(0);var n=this.findShardForByte(e);if(-1===n)throw new Error("Could not find start shard for byte ".concat(e));for(var r=t-e,a=new ArrayBuffer(r),i=new Uint8Array(a),o=0,s=n;s<this.shards.length;s++){var u=this.shards[s],c=e+o,l=c-u.start,h=o,p=Math.min(t,u.end),f=p-u.start,d=new Uint8Array(u.buffer,l,f-l);if(i.set(d,h),o+=d.length,t<u.end)break}return a}},{key:"findShardForByte",value:function(e){if(0===this.shards.length||e<0||e>=this.byteLength)return-1;if(null!=this.bufferUniformSize)return this.previousShardIndex=Math.floor(e/this.bufferUniformSize),this.previousShardIndex;function t(t){return e<t.start?-1:e>=t.end?1:0}if(0===t(this.shards[this.previousShardIndex]))return this.previousShardIndex;var n=function(e,t){var n=0,r=e.length;for(;n<=r;){var a=Math.floor((r-n)/2)+n,i=t(e[a]);if(0===i)return a;i<0?r=a:n=a+1}return-1}(this.shards,t);return-1===n?-1:(this.previousShardIndex=n,this.previousShardIndex)}}],[{key:"join",value:function(t){return new e(t).slice()}}]),e}();function H5(e,t){return q5.apply(this,arguments)}function q5(){return q5=c(o().mark((function e(t,n){var r,a,i,s,u,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],a=[],i=Array.isArray(t)?t.map((function(e){return e.name})):Object.keys(t),s=o().mark((function e(){var s,l,h,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=i[u],"float32"===(l=Array.isArray(t)?t[u].tensor:t[s]).dtype||"int32"===l.dtype||"bool"===l.dtype||"string"===l.dtype||"complex64"===l.dtype){e.next=4;break}throw new Error("Unsupported dtype in weight '".concat(s,"': ").concat(l.dtype));case 4:h={name:s,shape:l.shape,dtype:l.dtype},"string"===l.dtype?(p=new Promise(function(){var e=c(o().mark((function e(t){var n,r,a,i,s,u,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l.bytes();case 2:for(n=e.sent,r=n.reduce((function(e,t){return e+t.length}),0)+4*n.length,a=new Uint8Array(r),i=0,s=0;s<n.length;s++)u=n[s],c=new Uint8Array(new Uint32Array([u.length]).buffer),a.set(c,i),i+=4,a.set(u,i),i+=u.length;t(a);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),a.push(p)):a.push(l.data()),null!=n&&(h.group=n),r.push(h);case 8:case"end":return e.stop()}}),e)})),u=0;case 5:if(!(u<i.length)){e.next=10;break}return e.delegateYield(s(),"t0",7);case 7:++u,e.next=5;break;case 10:return e.next=12,Promise.all(a);case 12:return l=e.sent,e.abrupt("return",{data:X5(l),specs:r});case 14:case"end":return e.stop()}}),e)}))),q5.apply(this,arguments)}function K5(e,t){var n,r,a=new j5(e),i={},o=0,s=O(t);try{for(s.s();!(r=s.n()).done;){var u=r.value,c=u.name,l=u.dtype,h=u.shape,p=L$(h),f=void 0;if("quantization"in u){var d=u.quantization;if("uint8"===d.dtype||"uint16"===d.dtype){if(!("min"in d)||!("scale"in d))throw new Error("Weight ".concat(u.name," with quantization ").concat(d.dtype," ")+"doesn't have corresponding metadata min and scale.")}else{if("float16"!==d.dtype)throw new Error("Weight ".concat(u.name," has unknown ")+"quantization dtype ".concat(d.dtype,". ")+"Supported quantization dtypes are: 'uint8', 'uint16', and 'float16'.");if("float32"!==l)throw new Error("Weight ".concat(u.name," is quantized with ").concat(d.dtype," ")+"which only supports weights of type float32 not ".concat(l,"."))}var v=G5[d.dtype],m=a.slice(o,o+p*v),g="uint8"===d.dtype?new Uint8Array(m):new Uint16Array(m);if("float32"===l)if("uint8"===d.dtype||"uint16"===d.dtype){f=new Float32Array(g.length);for(var y=0;y<g.length;y++){var b=g[y];f[y]=b*d.scale+d.min}}else{if("float16"!==d.dtype)throw new Error("Unsupported quantization type ".concat(d.dtype," ")+"for weight type float32.");void 0===n&&(n=s6()),f=n(g)}else{if("int32"!==l)throw new Error("Unsupported dtype in weight '".concat(c,"': ").concat(l));if("uint8"!==d.dtype&&"uint16"!==d.dtype)throw new Error("Unsupported quantization type ".concat(d.dtype," ")+"for weight type int32.");f=new Int32Array(g.length);for(var x=0;x<g.length;x++){var k=g[x];f[x]=Math.round(k*d.scale+d.min)}}o+=p*v}else if("string"===l){var w=L$(u.shape);f=[];for(var I=0;I<w;I++){var N=new Uint32Array(a.slice(o,o+4))[0];o+=4;var S=new Uint8Array(a.slice(o,o+N));f.push(S),o+=N}}else{var T=G5[l],E=a.slice(o,o+p*T);if("float32"===l)f=new Float32Array(E);else if("int32"===l)f=new Int32Array(E);else if("bool"===l)f=new Uint8Array(E);else{if("complex64"!==l)throw new Error("Unsupported dtype in weight '".concat(c,"': ").concat(l));f=new Float32Array(E);for(var C=new Float32Array(f.length/2),A=new Float32Array(f.length/2),R=0;R<C.length;R++)C[R]=f[2*R],A[R]=f[2*R+1];var _=U5(C,h,"float32"),F=U5(A,h,"float32");i[c]=W5(_,F),_.dispose(),F.dispose()}o+=p*T}"complex64"!==l&&(i[c]=U5(f,h,l))}}catch(e){s.e(e)}finally{s.f()}return i}function X5(e){if(null===e)throw new Error("Invalid input value: ".concat(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: ".concat(e.constructor.name))}));var r=new Uint8Array(t),a=0;return n.forEach((function(e){r.set(new Uint8Array(e.buffer),a),a+=e.byteLength})),r.buffer}var Y5="undefined"!=typeof Buffer&&("undefined"==typeof Blob||"undefined"==typeof atob||"undefined"==typeof btoa);function J5(e){return Y5?Buffer.byteLength(e,"utf8"):new Blob([e]).size}function Z5(e){if(Y5)return Buffer.from(e).toString("base64");for(var t=new Uint8Array(e),n="",r=0,a=t.length;r<a;r++)n+=String.fromCharCode(t[r]);return btoa(n)}function Q5(e){if(Y5){var t=Buffer.from(e,"base64");return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}for(var n=atob(e),r=new Uint8Array(n.length),a=0;a<n.length;++a)r.set([n.charCodeAt(a)],a);return r.buffer}function $5(e){return j5.join(e)}function e6(e){for(e=e.trim();e.endsWith("/");)e=e.slice(0,e.length-1);var t=e.split("/");return t[t.length-1]}function t6(e,t){var n={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:t};return null!=e.signature&&(n.signature=e.signature),null!=e.userDefinedMetadata&&(n.userDefinedMetadata=e.userDefinedMetadata),null!=e.modelInitializer&&(n.modelInitializer=e.modelInitializer),null!=e.initializerSignature&&(n.initializerSignature=e.initializerSignature),null!=e.trainingConfig&&(n.trainingConfig=e.trainingConfig),n}function n6(e,t,n){var r={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy};if(null!=e.trainingConfig&&(r.trainingConfig=e.trainingConfig),null!=e.weightsManifest){if(!t)throw new Error("modelJSON has weightsManifest but weightSpecs is null");if(!n)throw new Error("modelJSON has weightsManifest but weightData is null");r.weightSpecs=t,r.weightData=n}return null!=e.signature&&(r.signature=e.signature),null!=e.userDefinedMetadata&&(r.userDefinedMetadata=e.userDefinedMetadata),null!=e.modelInitializer&&(r.modelInitializer=e.modelInitializer),null!=e.initializerSignature&&(r.initializerSignature=e.initializerSignature),r}function r6(e,t){return a6.apply(this,arguments)}function a6(){return a6=c(o().mark((function e(t,n){var r,a,i,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==t.weightsManifest){e.next=7;break}return e.next=3,n(t.weightsManifest);case 3:i=e.sent,s=S(i,2),r=s[0],a=s[1];case 7:return e.abrupt("return",n6(t,r,a));case 8:case"end":return e.stop()}}),e)}))),a6.apply(this,arguments)}function i6(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:J5(JSON.stringify(e.modelTopology)),weightSpecsBytes:null==e.weightSpecs?0:J5(JSON.stringify(e.weightSpecs)),weightDataBytes:null==e.weightData?0:new j5(e.weightData).byteLength}}function o6(e){var t,n=[],r=O(e);try{for(r.s();!(t=r.n()).done;){var a=t.value;n.push.apply(n,T(a.weights))}}catch(e){r.e(e)}finally{r.f()}return n}function s6(){var e=function(){var e=function(e){for(var t=e<<13,n=0;0==(8388608&t);)n-=8388608,t<<=1;return(t&=-8388609)|n+947912704},t=new Uint32Array(2048);t[0]=0;for(var n=1;n<1024;n++)t[n]=e(n);for(var r=1024;r<2048;r++)t[r]=939524096+(r-1024<<13);return t}(),t=function(){var e=new Uint32Array(64);e[0]=0,e[31]=1199570944,e[32]=2147483648,e[63]=3347054592;for(var t=1;t<31;t++)e[t]=t<<23;for(var n=33;n<63;n++)e[n]=2147483648+(n-32<<23);return e}(),n=function(){for(var e=new Uint32Array(64),t=0;t<64;t++)e[t]=1024;return e[0]=e[32]=0,e}();return function(r){for(var a=new ArrayBuffer(4*r.length),i=new Uint32Array(a),o=0;o<r.length;o++){var s=r[o],u=e[n[s>>10]+(1023&s)]+t[s>>10];i[o]=u}return new Float32Array(a)}}var u6=function(){function e(){l(this,e),this.saveRouters=[],this.loadRouters=[]}return p(e,null,[{key:"getInstance",value:function(){return null==e.instance&&(e.instance=new e),e.instance}},{key:"registerSaveRouter",value:function(t){e.getInstance().saveRouters.push(t)}},{key:"registerLoadRouter",value:function(t){e.getInstance().loadRouters.push(t)}},{key:"getSaveHandlers",value:function(t){return e.getHandlers(t,"save")}},{key:"getLoadHandlers",value:function(t,n){return e.getHandlers(t,"load",n)}},{key:"getHandlers",value:function(t,n,r){var a=[];return("load"===n?e.getInstance().loadRouters:e.getInstance().saveRouters).forEach((function(e){var n=e(t,r);null!==n&&a.push(n)})),a}}]),e}(),c6=function(e){return u6.getSaveHandlers(e)},l6=function(e,t){return u6.getLoadHandlers(e,t)},h6="tensorflowjs",p6="models_store",f6="model_info_store";function d6(){if(!k0().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");var e="undefined"==typeof window?self: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 v6(e){var t=e.result;t.createObjectStore(p6,{keyPath:"modelPath"}),t.createObjectStore(f6,{keyPath:"modelPath"})}var m6=function(){function e(t){if(l(this,e),this.indexedDB=d6(),null==t||!t)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=t}var t,n;return p(e,[{key:"save",value:(n=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t.modelTopology instanceof ArrayBuffer)){e.next=2;break}throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");case 2:return e.abrupt("return",this.databaseAction(this.modelPath,t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"load",value:(t=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.databaseAction(this.modelPath));case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"databaseAction",value:function(e,t){var n=this;return new Promise((function(e,r){var a=n.indexedDB.open(h6,1);a.onupgradeneeded=function(){return v6(a)},a.onsuccess=function(){var i=a.result;if(null==t){var o=i.transaction(p6,"readonly"),s=o.objectStore(p6).get(n.modelPath);s.onsuccess=function(){if(null==s.result)return i.close(),r(new Error("Cannot find model with path '".concat(n.modelPath,"' ")+"in IndexedDB."));e(s.result.modelArtifacts)},s.onerror=function(e){return i.close(),r(s.error)},o.oncomplete=function(){return i.close()}}else{var u,c,l=i6(t),h=i.transaction(f6,"readwrite"),p=h.objectStore(f6);try{u=p.put({modelPath:n.modelPath,modelArtifactsInfo:l})}catch(e){return r(e)}u.onsuccess=function(){var a,o=(c=i.transaction(p6,"readwrite")).objectStore(p6);try{a=o.put({modelPath:n.modelPath,modelArtifacts:t,modelArtifactsInfo:l})}catch(e){return r(e)}a.onsuccess=function(){return e({modelArtifactsInfo:l})},a.onerror=function(e){var t=(p=h.objectStore(f6)).delete(n.modelPath);t.onsuccess=function(){return i.close(),r(a.error)},t.onerror=function(e){return i.close(),r(a.error)}}},u.onerror=function(e){return i.close(),r(u.error)},h.oncomplete=function(){null==c?i.close():c.oncomplete=function(){return i.close()}}}},a.onerror=function(e){return r(a.error)}}))}}]),e}();m6.URL_SCHEME="indexeddb://";var g6=function(e){return k0().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(m6.URL_SCHEME)?(t=e.slice(m6.URL_SCHEME.length),new m6(t)):null;var t};function y6(e){return e.startsWith(m6.URL_SCHEME)?e.slice(m6.URL_SCHEME.length):e}u6.registerSaveRouter(g6),u6.registerLoadRouter(g6);var b6=function(){function e(){l(this,e),this.indexedDB=d6()}return p(e,[{key:"listModels",value:function(){var e=c(o().mark((function e(){var t=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var r=t.indexedDB.open(h6,1);r.onupgradeneeded=function(){return v6(r)},r.onsuccess=function(){var t=r.result,a=t.transaction(f6,"readonly"),i=a.objectStore(f6).getAll();i.onsuccess=function(){var t,n={},r=O(i.result);try{for(r.s();!(t=r.n()).done;){var a=t.value;n[a.modelPath]=a.modelArtifactsInfo}}catch(e){r.e(e)}finally{r.f()}e(n)},i.onerror=function(e){return t.close(),n(i.error)},a.oncomplete=function(){return t.close()}},r.onerror=function(e){return n(r.error)}})));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{key:"removeModel",value:function(){var e=c(o().mark((function e(t){var n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=y6(t),e.abrupt("return",new Promise((function(e,r){var a=n.indexedDB.open(h6,1);a.onupgradeneeded=function(){return v6(a)},a.onsuccess=function(){var n,i=a.result,o=i.transaction(f6,"readwrite"),s=o.objectStore(f6),u=s.get(t);u.onsuccess=function(){if(null==u.result)return i.close(),r(new Error("Cannot find model with path '".concat(t,"' ")+"in IndexedDB."));var a=s.delete(t),o=function(){var a=(n=i.transaction(p6,"readwrite")).objectStore(p6).delete(t);a.onsuccess=function(){return e(u.result.modelArtifactsInfo)},a.onerror=function(e){return r(u.error)}};a.onsuccess=o,a.onerror=function(e){return o(),i.close(),r(u.error)}},u.onerror=function(e){return i.close(),r(u.error)},o.oncomplete=function(){null==n?i.close():n.oncomplete=function(){return i.close()}}},a.onerror=function(e){return r(a.error)}})));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}]),e}(),x6="/",k6="tensorflowjs_models",w6="info",I6="model_topology",N6="weight_specs",S6="weight_data",T6="model_metadata";function E6(e){return{info:[k6,e,w6].join(x6),topology:[k6,e,I6].join(x6),weightSpecs:[k6,e,N6].join(x6),weightData:[k6,e,S6].join(x6),modelMetadata:[k6,e,T6].join(x6)}}function C6(e){for(var t=0,n=Object.values(e);t<n.length;t++){var r=n[t];window.localStorage.removeItem(r)}}function A6(e){var t=e.split(x6);if(t.length<3)throw new Error("Invalid key format: ".concat(e));return t.slice(1,t.length-1).join(x6)}function R6(e){return e.startsWith(_6.URL_SCHEME)?e.slice(_6.URL_SCHEME.length):e}var _6=function(){function e(t){if(l(this,e),!k0().getBool("IS_BROWSER")||"undefined"==typeof window||void 0===window.localStorage)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,null==t||!t)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=t,this.keys=E6(this.modelPath)}var t,n;return p(e,[{key:"save",value:(n=c(o().mark((function e(t){var n,r,a,i,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t.modelTopology instanceof ArrayBuffer)){e.next=4;break}throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");case 4:return n=JSON.stringify(t.modelTopology),r=JSON.stringify(t.weightSpecs),a=i6(t),i=j5.join(t.weightData),e.prev=8,this.LS.setItem(this.keys.info,JSON.stringify(a)),this.LS.setItem(this.keys.topology,n),this.LS.setItem(this.keys.weightSpecs,r),this.LS.setItem(this.keys.weightData,Z5(i)),s={format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,signature:null!=t.signature?t.signature:void 0,userDefinedMetadata:null!=t.userDefinedMetadata?t.userDefinedMetadata:void 0,modelInitializer:null!=t.modelInitializer?t.modelInitializer:void 0,initializerSignature:null!=t.initializerSignature?t.initializerSignature:void 0,trainingConfig:null!=t.trainingConfig?t.trainingConfig:void 0},this.LS.setItem(this.keys.modelMetadata,JSON.stringify(s)),e.abrupt("return",{modelArtifactsInfo:a});case 18:throw e.prev=18,e.t0=e.catch(8),C6(this.keys),new Error("Failed to save model '".concat(this.modelPath,"' to local storage: ")+"size quota being exceeded is a possible cause of this failure: "+"modelTopologyBytes=".concat(a.modelTopologyBytes,", ")+"weightSpecsBytes=".concat(a.weightSpecsBytes,", ")+"weightDataBytes=".concat(a.weightDataBytes,"."));case 22:case"end":return e.stop()}}),e,this,[[8,18]])}))),function(e){return n.apply(this,arguments)})},{key:"load",value:(t=c(o().mark((function e(){var t,n,r,a,i,s,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(t=JSON.parse(this.LS.getItem(this.keys.info)))){e.next=3;break}throw new Error("In local storage, there is no model with name '".concat(this.modelPath,"'"));case 3:if("JSON"===t.modelTopologyType){e.next=5;break}throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");case 5:if(n={},null!=(r=JSON.parse(this.LS.getItem(this.keys.topology)))){e.next=9;break}throw new Error("In local storage, the topology of model '".concat(this.modelPath,"' ")+"is missing.");case 9:if(n.modelTopology=r,null!=(a=JSON.parse(this.LS.getItem(this.keys.weightSpecs)))){e.next=13;break}throw new Error("In local storage, the weight specs of model '".concat(this.modelPath,"' ")+"are missing.");case 13:if(n.weightSpecs=a,null!=(i=this.LS.getItem(this.keys.modelMetadata))&&(s=JSON.parse(i),n.format=s.format,n.generatedBy=s.generatedBy,n.convertedBy=s.convertedBy,null!=s.signature&&(n.signature=s.signature),null!=s.userDefinedMetadata&&(n.userDefinedMetadata=s.userDefinedMetadata),null!=s.modelInitializer&&(n.modelInitializer=s.modelInitializer),null!=s.initializerSignature&&(n.initializerSignature=s.initializerSignature),null!=s.trainingConfig&&(n.trainingConfig=s.trainingConfig)),null!=(u=this.LS.getItem(this.keys.weightData))){e.next=19;break}throw new Error("In local storage, the binary weight values of model "+"'".concat(this.modelPath,"' are missing."));case 19:return n.weightData=Q5(u),e.abrupt("return",n);case 21:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}();_6.URL_SCHEME="localstorage://";var O6=function(e){return k0().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(_6.URL_SCHEME)?(t=e.slice(_6.URL_SCHEME.length),new _6(t)):null;var t};u6.registerSaveRouter(O6),u6.registerLoadRouter(O6);var F6=function(){function e(){l(this,e),F$(k0().getBool("IS_BROWSER"),(function(){return"Current environment is not a web browser"})),F$("undefined"==typeof window||void 0!==window.localStorage,(function(){return"Current browser does not appear to support localStorage"})),this.LS=window.localStorage}return p(e,[{key:"listModels",value:function(){var e=c(o().mark((function e(){var t,n,r,a,i,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t={},n=k6+x6,r=x6+w6,a=0;a<this.LS.length;++a)(i=this.LS.key(a)).startsWith(n)&&i.endsWith(r)&&(s=A6(i),t[s]=JSON.parse(this.LS.getItem(i)));return e.abrupt("return",t);case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"removeModel",value:function(){var e=c(o().mark((function e(t){var n,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=R6(t),n=E6(t),null!=this.LS.getItem(n.info)){e.next=4;break}throw new Error("Cannot find model at path '".concat(t,"'"));case 4:return r=JSON.parse(this.LS.getItem(n.info)),C6(n),e.abrupt("return",r);case 7:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()}]),e}(),D6="://",M6=function(){function e(){l(this,e),this.managers={}}return p(e,null,[{key:"getInstance",value:function(){return null==e.instance&&(e.instance=new e),e.instance}},{key:"registerManager",value:function(t,n){F$(null!=t,(function(){return"scheme must not be undefined or null."})),t.endsWith(D6)&&(t=t.slice(0,t.indexOf(D6))),F$(t.length>0,(function(){return"scheme must not be an empty string."}));var r=e.getInstance();F$(null==r.managers[t],(function(){return"A model store manager is already registered for scheme '".concat(t,"'.")})),r.managers[t]=n}},{key:"getManager",value:function(t){var n=e.getInstance().managers[t];if(null==n)throw new Error("Cannot find model manager for scheme '".concat(t,"'"));return n}},{key:"getSchemes",value:function(){return Object.keys(e.getInstance().managers)}}]),e}();function L6(e){if(-1===e.indexOf(D6))throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+"".concat(M6.getSchemes().join(",")));return{scheme:e.split(D6)[0],path:e.split(D6)[1]}}function z6(e,t){return P6.apply(this,arguments)}function P6(){return P6=c(o().mark((function e(t,n){var r,a,i,s,u,c,l,h,p,f,d=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=d.length>2&&void 0!==d[2]&&d[2],F$(t!==n,(function(){return"Old path and new path are the same: '".concat(t,"'")})),F$((a=u6.getLoadHandlers(t)).length>0,(function(){return"Copying failed because no load handler is found for source URL ".concat(t,".")})),F$(a.length<2,(function(){return"Copying failed because more than one (".concat(a.length,") ")+"load handlers for source URL ".concat(t,".")})),i=a[0],F$((s=u6.getSaveHandlers(n)).length>0,(function(){return"Copying failed because no save handler is found for destination "+"URL ".concat(n,".")})),F$(s.length<2,(function(){return"Copying failed because more than one (".concat(a.length,") ")+"save handlers for destination URL ".concat(n,".")})),u=s[0],c=L6(t).scheme,l=L6(t).path,h=c===L6(t).scheme,e.next=15,i.load();case 15:if(p=e.sent,!r||!h){e.next=19;break}return e.next=19,M6.getManager(c).removeModel(l);case 19:return e.next=21,u.save(p);case 21:if(f=e.sent,!r||h){e.next=25;break}return e.next=25,M6.getManager(c).removeModel(l);case 25:return e.abrupt("return",f.modelArtifactsInfo);case 26:case"end":return e.stop()}}),e)}))),P6.apply(this,arguments)}function B6(){return B6=c(o().mark((function e(){var t,n,r,a,i,s,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=M6.getSchemes(),n={},r=O(t),e.prev=3,r.s();case 5:if((a=r.n()).done){e.next=13;break}return i=a.value,e.next=9,M6.getManager(i).listModels();case 9:for(u in s=e.sent)n[i+D6+u]=s[u];case 11:e.next=5;break;case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(3),r.e(e.t0);case 18:return e.prev=18,r.f(),e.finish(18);case 21:return e.abrupt("return",n);case 22:case"end":return e.stop()}}),e,null,[[3,15,18,21]])}))),B6.apply(this,arguments)}function W6(){return(W6=c(o().mark((function e(t){var n,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=L6(t),r=M6.getManager(n.scheme),e.abrupt("return",r.removeModel(n.path));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function V6(){return(V6=c(o().mark((function e(t,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return!1,e.abrupt("return",z6(t,n,false));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function U6(){return(U6=c(o().mark((function e(t,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return!0,e.abrupt("return",z6(t,n,true));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var G6=function(){function e(){l(this,e),this.messageName="setTimeoutCustom",this.functionRefs=[],this.handledMessageCount=0,this.hasEventListener=!1}return p(e,[{key:"fetch",value:function(e){function t(t,n){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e,t){return fetch(e,t)}))},{key:"now",value:function(){return performance.now()}},{key:"encode",value:function(e,t){if("utf-8"!==t&&"utf8"!==t)throw new Error("Browser's encoder only supports utf-8, but got ".concat(t));return null==this.textEncoder&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}},{key:"decode",value:function(e,t){return new TextDecoder(t).decode(e)}},{key:"setTimeoutCustom",value:function(e,t){var n=this;"undefined"!=typeof window&&k0().getBool("USE_SETTIMEOUTCUSTOM")?(this.functionRefs.push(e),setTimeout((function(){window.postMessage({name:n.messageName,index:n.functionRefs.length-1},"*")}),t),this.hasEventListener||(this.hasEventListener=!0,window.addEventListener("message",(function(e){e.source===window&&e.data.name===n.messageName&&(e.stopPropagation(),(0,n.functionRefs[e.data.index])(),n.handledMessageCount++,n.handledMessageCount===n.functionRefs.length&&(n.functionRefs=[],n.handledMessageCount=0))}),!0))):setTimeout(e,t)}},{key:"isTypedArray",value:function(e){return q3(e)}}]),e}();if(k0().get("IS_BROWSER")){k0().setPlatform("browser",new G6);try{M6.registerManager(_6.URL_SCHEME,new F6)}catch(e){}try{M6.registerManager(m6.URL_SCHEME,new b6)}catch(e){}}var j6,H6=function(){return require("node-fetch")};var q6=function(){function e(){l(this,e),this.util=require("util"),this.textEncoder=new this.util.TextEncoder}return p(e,[{key:"fetch",value:function(e,t){return null!=k0().global.fetch?k0().global.fetch(e,t):(null==j6&&(j6=H6()),j6(e,t))}},{key:"now",value:function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}},{key:"encode",value:function(e,t){if("utf-8"!==t&&"utf8"!==t)throw new Error("Node built-in encoder only supports utf-8, but got ".concat(t));return this.textEncoder.encode(e)}},{key:"decode",value:function(e,t){return 0===e.length?"":new this.util.TextDecoder(t).decode(e)}},{key:"isTypedArray",value:function(e){return this.util.types.isFloat32Array(e)||this.util.types.isInt32Array(e)||this.util.types.isUint8Array(e)||this.util.types.isUint8ClampedArray(e)}}]),e}();function K6(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"float32",n=arguments.length>2?arguments[2]:void 0;return t=t||"float32",p0(e),new $4(e,t,n)}k0().get("IS_NODE")&&!k0().get("IS_BROWSER")&&k0().setPlatform("node",new q6);var X6=B5({cast_:function(e,t){var n=L5(e,"x","cast");if(!Y$(t))throw new Error("Failed to cast to unknown dtype ".concat(t));if("string"===t&&"string"!==n.dtype||"string"!==t&&"string"===n.dtype)throw new Error("Only strings can be casted to strings");var r={x:n},a={dtype:t};return E5.runKernel(X0,r,a)}});var Y6=B5({clone_:function(e){var t={x:L5(e,"x","clone","string_or_numeric")};return E5.runKernel(W1,t)}});function J6(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];console.log(e.toString(t))}function Z6(e){k0().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(e+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}function Q6(){return E5}function $6(){return E5.memory()}function e8(e,t){return E5.tidy(e,t)}function t8(e){y5(e).forEach((function(e){return e.dispose()}))}function n8(e){return E5.keep(e)}function r8(e){return E5.setBackend(e)}function a8(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return E5.registerBackend(e,t,n)}function i8(){return E5.backend}S5(),t5={buffer:K6,cast:X6,clone:Y6,print:J6};var o8=B5({add_:function(e,t){var n=L5(e,"a","add"),r=L5(t,"b","add"),a=S(v5(n,r),2),i={a:n=a[0],b:r=a[1]};return E5.runKernel(E0,i)}});var s8=B5({floorDiv_:function(e,t){var n=L5(e,"a","floorDiv"),r=L5(t,"b","floorDiv"),a=S(v5(n,r),2),i={a:n=a[0],b:r=a[1]};return E5.runKernel(D1,i)}});var u8=B5({div_:function(e,t){var n=L5(e,"a","div"),r=L5(t,"b","div"),a=S(v5(n,r),2);if(n=a[0],r=a[1],"int32"===n.dtype&&"int32"===r.dtype)return s8(n,r);var i={a:n,b:r};return E5.runKernel(k1,i,{})}});var c8=B5({mul_:function(e,t){var n=L5(e,"a","mul"),r=L5(t,"b","mul"),a=S(v5(n,r),2),i={a:n=a[0],b:r=a[1]};return E5.runKernel(g2,i)}});var l8=B5({abs_:function(e){var t=L5(e,"x","abs");if("complex64"===t.dtype){var n={x:t};return E5.runKernel(Q0,n)}var r={x:t};return E5.runKernel(N0,r)}});var h8=B5({acos_:function(e){var t={x:L5(e,"x","acos")};return E5.runKernel(S0,t)}});var p8=B5({acosh_:function(e){var t={x:L5(e,"x","acosh")};return E5.runKernel(T0,t)}});var f8=B5({addN_:function(e){F$(Array.isArray(e),(function(){return"The argument passed to tf.addN() must be a list of tensors"})),F$(e.length>=1,(function(){return"Must pass at least one tensor to tf.addN(), but got "+"".concat(e.length)}));var t=e.map((function(e,t){return L5(e,"tensors".concat(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(!P$(e.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")}));var r=t;return E5.runKernel(C0,r)}});var d8=B5({all_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=L5(e,"x","all","bool"),a={x:r},i={axis:t,keepDims:n};return E5.runKernel(A0,a,i)}});var v8=B5({any_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=L5(e,"x","any","bool"),a={x:r},i={axis:t,keepDims:n};return E5.runKernel(R0,a,i)}});var m8=B5({argMax_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=L5(e,"x","argMax"),r={x:n},a={axis:t};return E5.runKernel(_0,r,a)}});var g8=B5({argMin_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=L5(e,"x","argMin"),r={x:n},a={axis:t};return E5.runKernel(O0,r,a)}});var y8=B5({asin_:function(e){var t={x:L5(e,"x","asin")};return E5.runKernel(F0,t)}});var b8=B5({asinh_:function(e){var t={x:L5(e,"x","asinh")};return E5.runKernel(D0,t)}});var x8=B5({atan_:function(e){var t={x:L5(e,"x","atan")};return E5.runKernel(M0,t)}});var k8=B5({atan2_:function(e,t){var n=L5(e,"a","atan2"),r=L5(t,"b","atan2"),a=S(v5(n,r),2),i={a:n=a[0],b:r=a[1]};return E5.runKernel(z0,i)}});var w8=B5({atanh_:function(e){var t={x:L5(e,"x","atanh")};return E5.runKernel(L0,t)}});function I8(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"NHWC",i=arguments.length>5?arguments[5]:void 0,o=e[3],s=[].concat(T(t),[o]),u=P8(a);return T8(e,s,n,i,r,null,null,u)}function N8(e,t,n,r,a,i){var o,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"channelsLast",u=A8(t),c=S(u,2),l=c[0],h=c[1];if("channelsLast"===s)o=[l,h,e[3],e[3]];else{if("channelsFirst"!==s)throw new Error("Unknown dataFormat ".concat(s));o=[l,h,e[1],e[1]]}return T8(e,o,n,r,a,i,!1,s)}function S8(e,t,n,r,a,i){var o,s,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"NDHWC",c=R8(t),l=S(c,3),h=l[0],p=l[1],f=l[2];if("NDHWC"===u)s="channelsLast",o=[h,p,f,e[4],e[4]];else{if("NCDHW"!==u)throw new Error("Unknown dataFormat ".concat(u));s="channelsFirst",o=[h,p,f,e[1],e[1]]}return E8(e,o,n,r,a,!1,s,i)}function T8(e,t,n,r,a,i){var o=arguments.length>6&&void 0!==arguments[6]&&arguments[6],s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"channelsLast",u=-1,c=-1,l=-1,h=-1;if("channelsLast"===s){var p=S(e,4);u=p[0],c=p[1],l=p[2],h=p[3]}else{if("channelsFirst"!==s)throw new Error("Unknown dataFormat ".concat(s));var f=S(e,4);u=f[0],h=f[1],c=f[2],l=f[3]}var d,v=S(t,4),m=v[0],g=v[1],y=v[3],b=A8(n),x=S(b,2),k=x[0],w=x[1],I=A8(r),N=S(I,2),T=N[0],E=N[1],C=_8(m,T),A=_8(g,E),R=O8(a,c,l,k,w,C,A,i,s),_=R.padInfo,O=R.outHeight,F=R.outWidth,D=o?y*h:y;return"channelsFirst"===s?d=[u,D,O,F]:"channelsLast"===s&&(d=[u,O,F,D]),{batchSize:u,dataFormat:s,inHeight:c,inWidth:l,inChannels:h,outHeight:O,outWidth:F,outChannels:D,padInfo:_,strideHeight:k,strideWidth:w,filterHeight:m,filterWidth:g,effectiveFilterHeight:C,effectiveFilterWidth:A,dilationHeight:T,dilationWidth:E,inShape:e,outShape:d,filterShape:t}}function E8(e,t,n,r,a){var i=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"channelsLast",s=arguments.length>7?arguments[7]:void 0,u=-1,c=-1,l=-1,h=-1,p=-1;if("channelsLast"===o){var f=S(e,5);u=f[0],c=f[1],l=f[2],h=f[3],p=f[4]}else{if("channelsFirst"!==o)throw new Error("Unknown dataFormat ".concat(o));var d=S(e,5);u=d[0],p=d[1],c=d[2],l=d[3],h=d[4]}var v,m=S(t,5),g=m[0],y=m[1],b=m[2],x=m[4],k=R8(n),w=S(k,3),I=w[0],N=w[1],T=w[2],E=R8(r),C=S(E,3),A=C[0],R=C[1],_=C[2],O=_8(g,A),F=_8(y,R),D=_8(b,_),M=F8(a,c,l,h,I,N,T,O,F,D,s),L=M.padInfo,z=M.outDepth,P=M.outHeight,B=M.outWidth,W=i?x*p:x;return"channelsFirst"===o?v=[u,W,z,P,B]:"channelsLast"===o&&(v=[u,z,P,B,W]),{batchSize:u,dataFormat:o,inDepth:c,inHeight:l,inWidth:h,inChannels:p,outDepth:z,outHeight:P,outWidth:B,outChannels:W,padInfo:L,strideDepth:I,strideHeight:N,strideWidth:T,filterDepth:g,filterHeight:y,filterWidth:b,effectiveFilterDepth:O,effectiveFilterHeight:F,effectiveFilterWidth:D,dilationDepth:A,dilationHeight:R,dilationWidth:_,inShape:e,outShape:v,filterShape:t}}function C8(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=_8(t,r);return Math.floor((e[0]*(n-1)-n+a)/2)}function A8(e){return"number"==typeof e?[e,e,e]:2===e.length?[e[0],e[1],1]:e}function R8(e){return"number"==typeof e?[e,e,e]:e}function _8(e,t){return t<=1?e:e+(e-1)*(t-1)}function O8(e,t,n,r,a,i,o,u,c){var l,h,p;if("number"==typeof e){l={top:e,bottom:e,left:e,right:e,type:0===e?"VALID":"NUMBER"};var f=function(e,t,n,r,a){null==r&&(r=C8(e,t,n));var i=e[0],o=e[1];return[D8((i-t+2*r)/n+1,a),D8((o-t+2*r)/n+1,a)]}([t,n],i,r,e,u);h=f[0],p=f[1]}else if("same"===e){h=Math.ceil(t/r),p=Math.ceil(n/a);var d=Math.max(0,(h-1)*r+i-t),v=Math.max(0,(p-1)*a+o-n),m=Math.floor(d/2),g=d-m,y=Math.floor(v/2);l={top:m,bottom:g,left:y,right:v-y,type:"SAME"}}else if("valid"===e)l={top:0,bottom:0,left:0,right:0,type:"VALID"},h=Math.ceil((t-i+1)/r),p=Math.ceil((n-o+1)/a);else{if("object"!==s(e))throw Error("Unknown padding parameter: ".concat(e));var b="channelsLast"===c?e[1][0]:e[2][0],x="channelsLast"===c?e[1][1]:e[2][1],k="channelsLast"===c?e[2][0]:e[3][0],w="channelsLast"===c?e[2][1]:e[3][1];l={top:b,bottom:x,left:k,right:w,type:0===b&&0===x&&0===k&&0===w?"VALID":"EXPLICIT"},h=D8((t-i+b+x)/r+1,u),p=D8((n-o+k+w)/a+1,u)}return{padInfo:l,outHeight:h,outWidth:p}}function F8(e,t,n,r,a,i,o,s,u,c,l){var h,p,f,d;if("valid"===e&&(e=0),"number"==typeof e){h={top:e,bottom:e,left:e,right:e,front:e,back:e,type:0===e?"VALID":"NUMBER"};var v=function(e,t,n,r,a,i){null==a&&(a=C8(e,t[0],r[0]));for(var o=[0,0,0,n],s=0;s<3;s++)e[s]+2*a>=t[s]&&(o[s]=D8((e[s]-t[s]+2*a)/r[s]+1,i));return o}([t,n,r,1],[s,u,c],1,[a,i,o],e,l);p=v[0],f=v[1],d=v[2]}else{if("same"!==e)throw Error("Unknown padding parameter: ".concat(e));var m=((p=Math.ceil(t/a))-1)*a+s-t,g=((f=Math.ceil(n/i))-1)*i+u-n,y=((d=Math.ceil(r/o))-1)*o+c-r,b=Math.floor(m/2),x=m-b,k=Math.floor(g/2),w=g-k,I=Math.floor(y/2);h={top:k,bottom:w,left:I,right:y-I,front:b,back:x,type:"SAME"}}return{padInfo:h,outDepth:p,outHeight:f,outWidth:d}}function D8(e,t){if(!t)return Math.trunc(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 ".concat(t))}}function M8(e){var t=S(A8(e),3),n=t[0],r=t[1],a=t[2];return 1===n&&1===r&&1===a}function L8(e,t){return M8(e)||M8(t)}function z8(e){return A8(e).every((function(e){return e>0}))}function P8(e){if("NHWC"===e)return"channelsLast";if("NCHW"===e)return"channelsFirst";throw new Error("Unknown dataFormat ".concat(e))}function B8(e,t,n){if(null!=n){if("string"==typeof t)throw Error("Error in ".concat(e,": pad must be an integer when using ")+"dimRoundingMode ".concat(n," but got pad ").concat(t,"."));if("number"==typeof t)F$(B$(t),(function(){return"Error in ".concat(e,": pad must be an integer when using ")+"dimRoundingMode ".concat(n," but got pad ").concat(t,".")}));else{if("object"!==s(t))throw Error("Error in ".concat(e,": Unknown padding parameter: ").concat(t));t.forEach((function(t){t.forEach((function(t){F$(B$(t),(function(){return"Error in ".concat(e,": pad must be an integer when using ")+"dimRoundingMode ".concat(n," but got pad ").concat(t,".")}))}))}))}}}var W8=B5({reshape_:function(e,t){var n={x:L5(e,"x","reshape","string_or_numeric")},r={shape:t};return E5.runKernel(z2,n,r)}});var V8=B5({avgPool_:function(e,t,n,r,a){var i=L5(e,"x","avgPool","float32");F$(L8(n,1),(function(){return"Error in avgPool: Either strides or dilations must be 1. "+"Got strides ".concat(n," and dilations '").concat(1,"'")}));var o=i,s=!1;3===i.rank&&(s=!0,o=W8(i,[1,i.shape[0],i.shape[1],i.shape[2]])),F$(4===o.rank,(function(){return"Error in avgPool: x must be rank 4 but got rank ".concat(o.rank,".")})),B8("avgPool",r,a);var u={x:o},c={filterSize:t,strides:n,pad:r,dimRoundingMode:a},l=E5.runKernel(P0,u,c);return l=X6(l,i.dtype),s?W8(l,[l.shape[1],l.shape[2],l.shape[3]]):l}});var U8=B5({avgPool3d_:function(e,t,n,r,a){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"NDHWC",o=L5(e,"x","avgPool3d","float32"),s=o,u=!1;4===o.rank&&(u=!0,s=W8(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),F$(5===s.rank,(function(){return"Error in avgPool3d: x must be rank 5 but got rank ".concat(s.rank,".")})),F$("NDHWC"===i,(function(){return"Error in avgPool3d: Only NDHWC is currently supported, "+"but got dataFormat of ".concat(i)})),F$("number"==typeof n&&n>0||Array.isArray(n)&&n[0]>0&&n[1]>0&&n[2]>0,(function(){return"Error in avgPool3d: Stride must be > 0, but got '".concat(n,"'")})),B8("avgPool3d",r,a);var c={x:s},l={filterSize:t,strides:n,pad:r,dimRoundingMode:a,dataFormat:i},h=E5.runKernel(W0,c,l);return h=X6(h,s.dtype),u?W8(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}});var G8=B5({concat_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;F$(e.length>=1,(function(){return"Pass at least one tensor to concat"}));var n=z5(e,"tensors","concat","string_or_numeric");if("complex64"===n[0].dtype&&n.forEach((function(e){if("complex64"!==e.dtype)throw new Error("Cannot concatenate complex64 tensors with a tensor\n with dtype ".concat(e.dtype,". "))})),1===n.length)return Y6(n[0]);var r=n,a={axis:t};return E5.runKernel($0,r,a)}});var j8=B5({matMul_:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=L5(e,"a","matMul"),i=L5(t,"b","matMul"),o=v5(a,i),s=S(o,2),u={a:a=s[0],b:i=s[1]},c={transposeA:n,transposeB:r};return E5.runKernel(U0,u,c)}});var H8=B5({sigmoid_:function(e){var t={x:L5(e,"x","sigmoid","float32")};return E5.runKernel(t3,t)}});var q8=B5({slice_:function(e,t,n){var r=L5(e,"x","slice","string_or_numeric");if(0===r.rank)throw new Error("Slicing scalar is not possible");var a={x:r},i={begin:t,size:n};return E5.runKernel(Z2,a,i)}});var K8=B5({tanh_:function(e){var t={x:L5(e,"x","tanh","float32")};return E5.runKernel(w3,t)}});var X8=B5({basicLSTMCell_:function(e,t,n,r,a,i){var o=L5(e,"forgetBias","basicLSTMCell"),s=L5(t,"lstmKernel","basicLSTMCell"),u=L5(n,"lstmBias","basicLSTMCell"),c=L5(r,"data","basicLSTMCell"),l=L5(a,"c","basicLSTMCell"),h=L5(i,"h","basicLSTMCell"),p=G8([c,h],1),f=j8(p,s),d=o8(f,u),v=d.shape[0],m=d.shape[1]/4,g=[v,m],y=q8(d,[0,0],g),b=q8(d,[0,m],g),x=q8(d,[0,2*m],g),k=q8(d,[0,3*m],g),w=o8(c8(H8(y),K8(b)),c8(l,H8(o8(o,x))));return[w,c8(K8(w),H8(k))]}});var Y8=B5({batchToSpaceND_:function(e,t,n){var r=L5(e,"x","batchToSpaceND"),a=t.reduce((function(e,t){return e*t}));F$(r.rank>=1+t.length,(function(){return"input rank is ".concat(r.rank," but should be > than blockShape.length ").concat(t.length)})),F$(n.length===t.length,(function(){return"crops.length is ".concat(n.length," but should be equal to blockShape.length ").concat(t.length)})),F$(r.shape[0]%a==0,(function(){return"input tensor batch is ".concat(r.shape[0]," but is not divisible by the product of ")+"the elements of blockShape ".concat(t.join(" * ")," === ").concat(a)}));var i={x:r},o={blockShape:t,crops:n};return E5.runKernel(G0,i,o)}});var J8=B5({batchNorm_:function(e,t,n,r,a,i){null==i&&(i=.001);var o,s,u=L5(e,"x","batchNorm"),c=L5(t,"mean","batchNorm"),l=L5(n,"variance","batchNorm");null!=a&&(o=L5(a,"scale","batchNorm")),null!=r&&(s=L5(r,"offset","batchNorm")),F$(c.rank===l.rank,(function(){return"Batch normalization gradient requires mean and variance to have equal ranks."})),F$(null==s||c.rank===s.rank,(function(){return"Batch normalization gradient requires mean and offset to have equal ranks."})),F$(null==o||c.rank===o.rank,(function(){return"Batch normalization gradient requires mean and scale to have equal ranks."}));var h=function(e){return 0===e.rank||1===e.rank?W8(e,[1,1,1,e.size]):2===e.rank?W8(e,[1,1,e.shape[0],e.shape[1]]):3===e.rank?W8(e,[1,e.shape[0],e.shape[1],e.shape[2]]):e}(u),p={x:h,scale:o,offset:s,mean:c,variance:l},f={varianceEpsilon:i},d=E5.runKernel(M1,p,f);return W8(d,u.shape)}});var Z8=B5({batchNorm2d_:function(e,t,n,r,a,i){var o,s,u=L5(e,"x","batchNorm"),c=L5(t,"mean","batchNorm"),l=L5(n,"variance","batchNorm");return null!=a&&(o=L5(a,"scale","batchNorm")),null!=r&&(s=L5(r,"offset","batchNorm")),F$(2===u.rank,(function(){return"Error in batchNorm2D: x must be rank 2 but got rank "+"".concat(u.rank,".")})),F$(2===c.rank||1===c.rank,(function(){return"Error in batchNorm2D: mean must be rank 2 or rank 1 but "+"got rank ".concat(c.rank,".")})),F$(2===l.rank||1===l.rank,(function(){return"Error in batchNorm2D: variance must be rank 2 or rank 1 "+"but got rank ".concat(l.rank,".")})),null!=o&&F$(2===o.rank||1===o.rank,(function(){return"Error in batchNorm2D: scale must be rank 2 or rank 1 "+"but got rank ".concat(o.rank,".")})),null!=s&&F$(2===s.rank||1===s.rank,(function(){return"Error in batchNorm2D: offset must be rank 2 or rank 1 "+"but got rank ".concat(s.rank,".")})),J8(u,c,l,s,o,i)}});var Q8=B5({batchNorm3d_:function(e,t,n,r,a,i){var o,s,u=L5(e,"x","batchNorm"),c=L5(t,"mean","batchNorm"),l=L5(n,"variance","batchNorm");return null!=a&&(o=L5(a,"scale","batchNorm")),null!=r&&(s=L5(r,"offset","batchNorm")),F$(3===u.rank,(function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+"".concat(u.rank,".")})),F$(3===c.rank||1===c.rank,(function(){return"Error in batchNorm3D: mean must be rank 3 or rank 1 but "+"got rank ".concat(c.rank,".")})),F$(3===l.rank||1===l.rank,(function(){return"Error in batchNorm3D: variance must be rank 3 or rank 1 "+"but got rank ".concat(l.rank,".")})),null!=o&&F$(3===o.rank||1===o.rank,(function(){return"Error in batchNorm3D: scale must be rank 3 or rank 1 "+"but got rank ".concat(o.rank,".")})),null!=s&&F$(3===s.rank||1===s.rank,(function(){return"Error in batchNorm3D: offset must be rank 3 or rank 1 "+"but got rank ".concat(s.rank,".")})),J8(u,c,l,s,o,i)}});var $8=B5({batchNorm4d_:function(e,t,n,r,a,i){var o,s,u=L5(e,"x","batchNorm"),c=L5(t,"mean","batchNorm"),l=L5(n,"variance","batchNorm");return null!=a&&(o=L5(a,"scale","batchNorm")),null!=r&&(s=L5(r,"offset","batchNorm")),F$(4===u.rank,(function(){return"Error in batchNorm4D: x must be rank 4 but got rank "+"".concat(u.rank,".")})),F$(4===c.rank||1===c.rank,(function(){return"Error in batchNorm4D: mean must be rank 4 or rank 1 but "+"got rank ".concat(c.rank,".")})),F$(4===l.rank||1===l.rank,(function(){return"Error in batchNorm4D: variance must be rank 4 or rank 1 "+"but got rank ".concat(l.rank,".")})),null!=o&&F$(4===o.rank||1===o.rank,(function(){return"Error in batchNorm4D: scale must be rank 4 or rank 1 "+"but got rank ".concat(o.rank,".")})),null!=s&&F$(4===s.rank||1===s.rank,(function(){return"Error in batchNorm4D: offset must be rank 4 or rank 1 "+"but got rank ".concat(s.rank,".")})),J8(u,c,l,s,o,i)}});var e7=B5({bincount_:function(e,t,n){var r=L5(e,"x","bincount"),a=L5(t,"weights","bincount");F$("int32"===r.dtype,(function(){return"Error in bincount: input "+"dtype must be int32, but got ".concat(r.dtype)})),F$(n>=0,(function(){return"size must be non-negative, but got ".concat(n,".")})),F$(a.size===r.size||0===a.size,(function(){return"Error in bincount: weights must have the same size as input or"+"0-length, but got input shape: ".concat(r.shape,", weights shape: ")+"".concat(a.shape,".")}));var i={x:r,weights:a},o={size:n};return E5.runKernel(j0,i,o)}});var t7=B5({bitwiseAnd_:function(e,t){var n=L5(e,"x","bitwiseAnd"),r=L5(t,"y","bitwiseAnd");if(!P$(n.shape,r.shape))throw new Error("BitwiseAnd: Tensors must have the same shape. x: ".concat(n.shape,", y: ").concat(r.shape));if("int32"!==n.dtype||"int32"!==r.dtype)throw new Error("BitwiseAnd: Only supports 'int32' values in tensor, found type of x: ".concat(n.dtype," and type of y: ").concat(r.dtype));var a={a:n,b:r};return E5.runKernel(H0,a)}});var n7=B5({broadcastArgs_:function(e,t){var n=L5(e,"s0","broadcastArgs","int32"),r=L5(t,"s1","broadcastArgs","int32");if(1!==n.rank)throw new Error("broadcastArgs(): first input must be a vector (rank=1). "+"Has rank ".concat(n.rank));if(1!==r.rank)throw new Error("broadcastArgs(): second input must be a vector (rank=1). "+"Has rank ".concat(r.rank));var a={s0:n,s1:r};return E5.runKernel(K0,a)}});var r7=B5({broadcastTo_:function(e,t){var n=L5(e,"broadcastTo","x"),r=n.shape;if(p0(t),t.length<n.rank)throw new Error("broadcastTo(): shape.length=".concat(t.length," < input.rank=").concat(n.rank,"."));if(t.length>n.rank){for(var a=n.shape.slice();a.length<t.length;)a.unshift(1);n=W8(n,a)}for(var i=n.shape,o=Array.from(t),s=t.length-1;s>=0;s--)if(i[s]===t[s])o[s]=1;else if(1!==n.shape[s])throw new Error("broadcastTo(): [".concat(r,"] cannot be broadcast to [").concat(t,"]."));var u=o.map((function(e,t){return e>1?t:-1})).filter((function(e){return e>=0}));if(0===u.length)return Y6(n);var c={x:n},l={reps:o};return E5.runKernel(I3,c,l)}});var a7=B5({ceil_:function(e){var t={x:L5(e,"x","ceil","float32")};return E5.runKernel(Y0,t)}});function i7(e,t,n){p0(e);var r={shape:e,value:t,dtype:n=n||n0(t)};return E5.runKernel(_1,{},r)}var o7=B5({clipByValue_:function(e,t,n){var r=L5(e,"x","clipByValue");if(F$(t<=n,(function(){return"Error in clip: min (".concat(t,") must be ")+"less than or equal to max (".concat(n,").")})),t===n)return i7(r.shape,t,r.dtype);var a={x:r},i={clipValueMin:t,clipValueMax:n};return E5.runKernel(J0,a,i)}});var s7=B5({concat1d_:function(e){return G8(e,0)}});var u7=B5({concat2d_:function(e,t){return G8(e,t)}});var c7=B5({concat3d_:function(e,t){return G8(e,t)}});var l7=B5({concat4d_:function(e,t){return G8(e,t)}});var h7=B5({conv2d_:function(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"NHWC",i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[1,1],o=arguments.length>6?arguments[6]:void 0,s=L5(e,"x","conv2d","float32"),u=L5(t,"filter","conv2d","float32"),c=s,l=!1;3===s.rank&&(l=!0,c=W8(s,[1,s.shape[0],s.shape[1],s.shape[2]])),F$(4===c.rank,(function(){return"Error in conv2d: input must be rank 4, but got rank ".concat(c.rank,".")})),F$(4===u.rank,(function(){return"Error in conv2d: filter must be rank 4, but got rank "+"".concat(u.rank,".")})),B8("conv2d",r,o);var h="NHWC"===a?c.shape[3]:c.shape[1];F$(h===u.shape[2],(function(){return"Error in conv2d: depth of input (".concat(h,") must match ")+"input depth for filter ".concat(u.shape[2],".")})),F$(L8(n,i),(function(){return"Error in conv2D: Either strides or dilations must be 1. "+"Got strides ".concat(n," and dilations '").concat(i,"'")})),F$(z8(i),(function(){return"Error in conv2D: Dilated rates should be larger than 0."})),F$(z8(n),(function(){return"Error in conv2D: Strides should be larger than 0."}));var p={x:c,filter:u},f={strides:n,pad:r,dataFormat:a,dilations:i,dimRoundingMode:o},d=E5.runKernel(e1,p,f);return l?W8(d,[d.shape[1],d.shape[2],d.shape[3]]):d}});var p7=B5({conv1d_:function(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"NWC",i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,o=arguments.length>6?arguments[6]:void 0,s=L5(e,"x","conv1d"),u=L5(t,"filter","conv1d"),c=s,l=!1;2===s.rank&&(l=!0,c=W8(s,[1,s.shape[0],s.shape[1]])),F$(3===c.rank,(function(){return"Error in conv1d: input must be rank 3, but got rank ".concat(c.rank,".")})),F$(3===u.rank,(function(){return"Error in conv1d: filter must be rank 3, but got rank "+"".concat(u.rank,".")})),B8("conv1d",r,o),F$(c.shape[2]===u.shape[1],(function(){return"Error in conv1d: depth of input (".concat(c.shape[2],") must match ")+"input depth for filter ".concat(u.shape[1],".")})),F$(L8(n,i),(function(){return"Error in conv1D: Either stride or dilation must be 1. "+"Got stride ".concat(n," and dilation '").concat(i,"'")})),F$(z8(i),(function(){return"Error in conv1D: Dilated rates should be larger than 0."})),F$(z8(n),(function(){return"Error in conv1D: Stride should be larger than 0."})),F$("NWC"===a,(function(){return"Error in conv1d: got dataFormat of ".concat(a," but only NWC is currently supported.")}));var h=W8(u,[1,u.shape[0],u.shape[1],u.shape[2]]),p=W8(c,[c.shape[0],1,c.shape[1],c.shape[2]]),f=[1,n],d=[1,i],v="NHWC",m=h7(p,h,f,r,v,d,o);return W8(m,l?[m.shape[2],m.shape[3]]:[m.shape[0],m.shape[2],m.shape[3]])}});var f7=B5({conv2DBackpropInput_:function(e,t,n,r,a){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"NHWC",o=arguments.length>6?arguments[6]:void 0;F$(e.length===t.rank,(function(){return"Length of inShape "+"(".concat(e.length,") and rank of dy (").concat(t.rank,") must match")}));var s=e,u=t,c=!1;3===t.rank&&(c=!0,u=W8(t,[1,t.shape[0],t.shape[1],t.shape[2]]),s=[1,e[0],e[1],e[2]]),F$(4===s.length,(function(){return"Error in conv2dDerInput: inShape must be length 4, but got length "+"".concat(s.length,".")})),F$(4===u.rank,(function(){return"Error in conv2dDerInput: dy must be rank 4, but got "+"rank ".concat(u.rank)})),F$(4===n.rank,(function(){return"Error in conv2dDerInput: filter must be rank 4, but got "+"rank ".concat(n.rank)}));var l="NHWC"===i?s[3]:s[1],h="NHWC"===i?u.shape[3]:u.shape[1];F$(l===n.shape[2],(function(){return"Error in conv2dDerInput: depth of input (".concat(l,") must ")+"match input depth for filter ".concat(n.shape[2],".")})),F$(h===n.shape[3],(function(){return"Error in conv2dDerInput: depth of output (".concat(h,") must ")+"match output depth for filter ".concat(n.shape[3],".")})),B8("conv2dDerInput",a,o);var p={dy:u,filter:n},f={strides:r,pad:a,dataFormat:i,dimRoundingMode:o,inputShape:s},d=E5.runKernel(n1,p,f);return c?W8(d,[d.shape[1],d.shape[2],d.shape[3]]):d}});var d7=B5({conv2dTranspose_:function(e,t,n,r,a,i){var o=L5(e,"x","conv2dTranspose"),s=L5(t,"filter","conv2dTranspose");return f7(n,o,s,r,a,"NHWC",i)}});var v7=B5({conv3d_:function(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"NDHWC",i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[1,1,1],o=L5(e,"x","conv3d"),s=L5(t,"filter","conv3d"),u=o,c=!1;4===o.rank&&(c=!0,u=W8(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),F$(5===u.rank,(function(){return"Error in conv3d: input must be rank 5, but got rank ".concat(u.rank,".")})),F$(5===s.rank,(function(){return"Error in conv3d: filter must be rank 5, but got rank "+"".concat(s.rank,".")})),F$(u.shape[4]===s.shape[3],(function(){return"Error in conv3d: depth of input (".concat(u.shape[4],") must match ")+"input depth for filter ".concat(s.shape[3],".")})),F$(L8(n,i),(function(){return"Error in conv3D: Either strides or dilations must be 1. "+"Got strides ".concat(n," and dilations '").concat(i,"'")})),F$("NDHWC"===a,(function(){return"Error in conv3d: got dataFormat of ".concat(a," but only NDHWC is currently supported.")})),F$(z8(i),(function(){return"Error in conv3D: Dilated rates should be larger than 0."})),F$(z8(n),(function(){return"Error in conv3D: Strides should be larger than 0."}));var l={x:u,filter:s},h={strides:n,pad:r,dataFormat:a,dilations:i},p=E5.runKernel(r1,l,h);return c?W8(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}});var m7=B5({conv3DBackpropInput_:function(e,t,n,r,a){F$(e.length===t.rank,(function(){return"Length of inShape "+"(".concat(e.length,") and rank of dy (").concat(t.rank,") must match")}));var i=e,o=t,s=!1;4===t.rank&&(s=!0,o=W8(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]]),i=[1,e[0],e[1],e[2],e[3]]);var u=i[4],c=o.shape[4];F$(5===i.length,(function(){return"Error in conv3dDerInput: inShape must be length 5, but got length "+"".concat(i.length,".")})),F$(5===o.rank,(function(){return"Error in conv3dDerInput: dy must be rank 5, but got "+"rank ".concat(o.rank)})),F$(5===n.rank,(function(){return"Error in conv3dDerInput: filter must be rank 5, but got "+"rank ".concat(n.rank)})),F$(u===n.shape[3],(function(){return"Error in conv3dDerInput: depth of input (".concat(u,") must ")+"match input depth for filter ".concat(n.shape[3],".")})),F$(c===n.shape[4],(function(){return"Error in conv3dDerInput: depth of output (".concat(c,") must ")+"match output depth for filter ".concat(n.shape[4],".")}));var l={dy:o,filter:n},h={pad:a,strides:r,inputShape:i},p=E5.runKernel(i1,l,h);return s?W8(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}});var g7=B5({conv3dTranspose_:function(e,t,n,r,a){var i=L5(e,"x","conv3dTranspose"),o=L5(t,"filter","conv3dTranspose");return m7(n,i,o,r,a)}});var y7=B5({cos_:function(e){var t={x:L5(e,"x","cos","float32")};return E5.runKernel(o1,t)}});var b7=B5({cosh_:function(e){var t={x:L5(e,"x","cosh","float32")};return E5.runKernel(s1,t)}});var x7=B5({cumprod_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=L5(e,"x","cumprod"),i={x:a},o={axis:t,exclusive:n,reverse:r};return E5.runKernel(u1,i,o)}});var k7=B5({cumsum_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=L5(e,"x","cumsum"),i={x:a},o={axis:t,exclusive:n,reverse:r};return E5.runKernel(c1,i,o)}});var w7=B5({denseBincount_:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=L5(e,"x","denseBincount"),i=L5(t,"weights","denseBincount");F$("int32"===a.dtype,(function(){return"Error in denseBincount: input "+"dtype must be int32, but got ".concat(a.dtype)})),F$(a.rank<=2,(function(){return"Error in denseBincount: input must be at most rank 2, but got "+"rank ".concat(a.rank,".")})),F$(n>=0,(function(){return"size must be non-negative, but got ".concat(n,".")})),F$(i.size===a.size||0===i.size,(function(){return"Error in denseBincount: weights must have the same shape as x or "+"0-length, but got x shape: ".concat(a.shape,", weights shape: ")+"".concat(i.shape,".")}));var o={x:a,weights:i},s={size:n,binaryOutput:r};return E5.runKernel(h1,o,s)}});var I7=B5({depthToSpace_:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"NHWC",r=L5(e,"x","depthToSpace","float32"),a="NHWC"===n?r.shape[1]:r.shape[2],i="NHWC"===n?r.shape[2]:r.shape[3],o="NHWC"===n?r.shape[3]:r.shape[1];F$(t>1,(function(){return"blockSize should be > 1 for depthToSpace, but was: ".concat(t)})),F$(a*t>=0,(function(){return"Negative dimension size caused by overflow when multiplying\n ".concat(a," and ").concat(t," for depthToSpace with input shape\n ").concat(r.shape)})),F$(i*t>=0,(function(){return"Negative dimension size caused by overflow when multiplying\n ".concat(i," and ").concat(t," for depthToSpace with input shape\n ").concat(r.shape)})),F$(o%(t*t)==0,(function(){return"Dimension size must be evenly divisible by ".concat(t*t," but is ").concat(o," for depthToSpace with input shape ").concat(r.shape)}));var s={x:r},u={blockSize:t,dataFormat:n};return E5.runKernel(p1,s,u)}});var N7=B5({depthwiseConv2d_:function(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"NHWC",i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[1,1],o=arguments.length>6?arguments[6]:void 0,s=L5(e,"x","depthwiseConv2d","float32"),u=L5(t,"filter","depthwiseConv2d","float32"),c=s,l=!1;3===s.rank&&(l=!0,c=W8(s,[1,s.shape[0],s.shape[1],s.shape[2]])),F$(4===c.rank,(function(){return"Error in depthwiseConv2d: input must be rank 4, but got "+"rank ".concat(c.rank,".")})),F$(4===u.rank,(function(){return"Error in depthwiseConv2d: filter must be rank 4, but got rank "+"".concat(u.rank,".")}));var h="NHWC"===a?c.shape[3]:c.shape[1];F$(h===u.shape[2],(function(){return"Error in depthwiseConv2d: number of input channels "+"(".concat(h,") must match the inChannels dimension in ")+"filter ".concat(u.shape[2],".")})),B8("depthwiseConv2d",r,o);var p={x:c,filter:u},f={strides:n,pad:r,dataFormat:a,dilations:i,dimRoundingMode:o},d=E5.runKernel(f1,p,f);return l?W8(d,[d.shape[1],d.shape[2],d.shape[3]]):d}});var S7=B5({diag_:function(e){var t={x:L5(e,"x","diag")};return E5.runKernel(m1,t)}});var T7=B5({dilation2d_:function(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[1,1],i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"NHWC",o=L5(e,"x","dilation2d"),s=L5(t,"filter","dilation2d");F$(3===o.rank||4===o.rank,(function(){return"Error in dilation2d: input must be rank 3 or 4, but got rank "+"".concat(o.rank,".")})),F$(3===s.rank,(function(){return"Error in dilation2d: filter must be rank 3, but got rank "+"".concat(s.rank,".")})),F$("NHWC"===i,(function(){return"Error in dilation2d: Only NHWC is currently supported, "+"but got dataFormat of ".concat(i)}));var u=o,c=!1;3===o.rank&&(u=W8(o,[1,o.shape[0],o.shape[1],o.shape[2]]),c=!0),F$(u.shape[3]===s.shape[2],(function(){return"Error in dilation2d: input and filter must have the same depth: ".concat(u.shape[3]," vs ").concat(s.shape[2])}));var l={x:u,filter:s},h={strides:n,pad:r,dilations:a},p=E5.runKernel(g1,l,h);return c?W8(p,[p.shape[1],p.shape[2],p.shape[3]]):p}});function E7(e,t){for(var n=e.length,r=[],a=0;a<n;a++){var i=n-1-a,o=e[i]||1;(t[t.length-1-a]||1)>1&&1===o&&r.unshift(i)}return r}function C7(e,t){for(var n=[],r=0;r<t.length;r++){var a=e[e.length-r-1],i=t.length-r-1,o=t[i];(null==a||1===a&&o>1)&&n.unshift(i)}return n}function A7(e,t){for(var n=Math.max(e.length,t.length),r=new Array(n),a=0;a<n;a++){var i=e[e.length-a-1];null==i&&(i=1);var o=t[t.length-a-1];if(null==o&&(o=1),1===i)r[n-a-1]=o;else if(1===o)r[n-a-1]=i;else{if(i!==o){var s="Operands could not be broadcast together with shapes "+"".concat(e," and ").concat(t,".");throw Error(s)}r[n-a-1]=i}}return r}var R7={__proto__:null,assertAndGetBroadcastShape:A7,getBroadcastDims:E7,getReductionAxes:C7};var _7=B5({equal_:function(e,t){var n=L5(e,"a","equal","string_or_numeric"),r=L5(t,"b","equal","string_or_numeric"),a=S(v5(n,r),2);n=a[0],r=a[1],A7(n.shape,r.shape);var i={a:n,b:r};return E5.runKernel(T1,i)}});var O7=B5({where_:function(e,t,n){var r=L5(t,"a","where"),a=L5(n,"b","where"),i=L5(e,"condition","where","bool"),o=A7(A7(i.shape,r.shape),a.shape),s={condition:r7(i,o),t:r7(r,o),e:r7(a,o)};return E5.runKernel(Y2,s)}});var F7=B5({zerosLike_:function(e){var t={x:L5(e,"x","zerosLike")};return E5.runKernel(R3,t)}});var D7=B5({divNoNan_:function(e,t){var n=L5(e,"a","div"),r=L5(t,"b","div"),a=S(v5(n,r),2);n=a[0],r=a[1];var i=u8(n,r),o=F7(i),s=_7(r,o);return O7(s,o,i)}});var M7=B5({dot_:function(e,t){var n=L5(e,"t1","dot"),r=L5(t,"t2","dot");F$(!(1!==n.rank&&2!==n.rank||1!==r.rank&&2!==r.rank),(function(){return"Error in dot: inputs must all be rank 1 or 2, but got ranks "+"".concat(n.rank," and ").concat(r.rank,".")}));var a=1===n.rank?n.size:n.shape[1],i=1===r.rank?r.size:r.shape[0];if(F$(a===i,(function(){return"Error in dot: inner dimensions of inputs must match, but got "+"".concat(a," and ").concat(i,".")})),1===n.rank&&1===r.rank){var o=W8(n,[1,-1]),s=W8(r,[-1,1]),u=j8(o,s);return W8(u,[])}if(1===n.rank&&2===r.rank){var c=W8(n,[1,-1]),l=W8(r,[r.shape[0],r.shape[1]]),h=j8(c,l);return W8(h,[h.size])}if(2===n.rank&&1===r.rank){var p=W8(r,[-1,1]),f=j8(n,p);return W8(f,[f.size])}var d=W8(r,[r.shape[0],r.shape[1]]);return j8(n,d)}});var L7=B5({einsum_:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var a=n.map((function(e,t){return L5(e,"tensors".concat(t),"einsum")})),i={equation:e};return E5.runKernel(w1,a,i)}});var z7=B5({elu_:function(e){var t={x:L5(e,"x","elu","float32")};return E5.runKernel(I1,t)}});var P7=B5({ensureShape_:function(e,t){var n=L5(e,"x","ensureShape","string_or_numeric");if(!z$(n.shape,t))throw new Error("EnsureShape: Shape of tensor ".concat(n.shape," is not compatible with expected shape ").concat(t));return e}});var B7=B5({erf_:function(e){var t=L5(e,"x","erf");F$("int32"===t.dtype||"float32"===t.dtype,(function(){return"Input dtype must be `int32` or `float32`."})),"int32"===t.dtype&&(t=X6(t,"float32"));var n={x:t};return E5.runKernel(S1,n)}});function W7(e,t){for(var n=0;n<e.length;++n)if(e[e.length-n-1]!==t-1-n)return!1;return!0}function V7(e,t,n){for(var r=e.length+t.length,a=[],i=0,o=0,s=0;s<r;s++)-1===n.indexOf(s)?a.push(e[i++]):a.push(t[o++]);return a}function U7(e,t){for(var n=[],r=e.length,a=0;a<r;a++)-1===t.indexOf(a)&&n.push(e[a]);var i=t.map((function(t){return e[t]}));return[n,i]}function G7(e,t){return V7(e,t.map((function(e){return 1})),t)}function j7(e,t,n){F$(W7(t,n),(function(){return"".concat(e," supports only inner-most axes for now. ")+"Got axes ".concat(t," and rank-").concat(n," input.")}))}function H7(e,t){if(W7(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 q7(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 K7(e,t){for(var n=[],r=t-e;r<t;++r)n.push(r);return n}var X7=B5({max_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=L5(e,"x","max"),a={x:r},i={reductionIndices:t,keepDims:n};return E5.runKernel(a2,a,i)}});var Y7=B5({min_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=L5(e,"x","min"),a={x:r},i={axis:t,keepDims:n};return E5.runKernel(p2,a,i)}});var J7=B5({pow_:function(e,t){var n=L5(e,"base","pow"),r=L5(t,"exp","pow"),a=S(v5(n,r),2),i={a:n=a[0],b:r=a[1]};return E5.runKernel(E2,i)}});function Z7(e,t){if((V4(e)&&"string"!==t||Array.isArray(e))&&"complex64"!==t)throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if("string"===t&&V4(e)&&!(e instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return V5(e,[],[],t)}var Q7=B5({sqrt_:function(e){var t={x:L5(e,"x","sqrt","float32")};return E5.runKernel(r3,t)}});var $7=B5({square_:function(e){var t=L5(e,"x","square");return E5.runKernel("Square",{x:t},{})}});var e9=B5({sum_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=L5(e,"x","sum");"bool"===r.dtype&&(r=X6(r,"int32"));var a={x:r},i={axis:t,keepDims:n};return E5.runKernel(a3,a,i)}});function t9(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(0===e.rank)return l8(e);if(1!==e.rank&&null===n)return t9(W8(e,[-1]),t,n);if(1===e.rank||"number"==typeof n||Array.isArray(n)&&1===n.length){if(1===t)return e9(l8(e),n);if(t===1/0)return X7(l8(e),n);if(t===-1/0)return Y7(l8(e),n);if("euclidean"===t||2===t)return Q7(e9(J7(l8(e),Z7(2,"int32")),n));throw new Error("Error in norm: invalid ord value: ".concat(t))}if(Array.isArray(n)&&2===n.length){if(1===t)return X7(e9(l8(e),n[0]),n[1]-1);if(t===1/0)return X7(e9(l8(e),n[1]),n[0]);if(t===-1/0)return Y7(e9(l8(e),n[1]),n[0]);if("fro"===t||"euclidean"===t)return Q7(e9($7(e),n));throw new Error("Error in norm: invalid ord value: ".concat(t))}throw new Error("Error in norm: invalid axis: ".concat(n))}var n9=B5({norm_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"euclidean",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=t9(e=L5(e,"x","norm"),t,n),i=a.shape;if(r){var o=j$(n,e.shape);i=G7(a.shape,o)}return W8(a,i)}});var r9=B5({euclideanNorm_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return n9(e,"euclidean",t,n)}});var a9=B5({exp_:function(e){var t={x:L5(e,"x","exp")};return E5.runKernel(E1,t)}});var i9=B5({expandDims_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=L5(e,"x","expandDims","string_or_numeric");F$(t<=n.rank,(function(){return"Axis must be <= rank of the tensor"}));var r={input:n},a={dim:t};return E5.runKernel(C1,r,a)}});var o9=B5({expm1_:function(e){var t={x:L5(e,"x","expm1")};return E5.runKernel(A1,t)}});var s9=B5({tile_:function(e,t){var n=L5(e,"x","tile","string_or_numeric");F$(n.rank===t.length,(function(){return"Error in transpose: rank of input ".concat(n.rank," ")+"must match length of reps ".concat(t,".")}));var r={x:n},a={reps:t};return E5.runKernel(I3,r,a)}});var u9=B5({eye_:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"float32";null==t&&(t=e);for(var a=K6([e,t],r),i=e<=t?e:t,o=0;o<i;++o)a.set(1,o,o);var s=W8(a.toTensor(),[e,t]);if(null==n)return s;if(1===n.length)return s9(i9(s,0),[n[0],1,1]);if(2===n.length)return s9(i9(i9(s,0),0),[n[0],n[1],1,1]);if(3===n.length)return s9(i9(i9(i9(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 ".concat(n.length,"D."))}});var c9=B5({floor_:function(e){var t={x:L5(e,"x","floor","float32")};return E5.runKernel(F1,t)}});var l9=B5({gather_:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=L5(e,"x","gather"),i=L5(t,"indices","gather","int32"),o={x:a,indices:i},s={axis:n,batchDims:r};return E5.runKernel(L1,o,s)}});var h9=B5({greater_:function(e,t){var n=L5(e,"a","greater","string_or_numeric"),r=L5(t,"b","greater","string_or_numeric"),a=S(v5(n,r),2);n=a[0],r=a[1],A7(n.shape,r.shape);var i={a:n,b:r};return E5.runKernel(P1,i)}});var p9=B5({greaterEqual_:function(e,t){var n=L5(e,"a","greaterEqual","string_or_numeric"),r=L5(t,"b","greaterEqual","string_or_numeric"),a=S(v5(n,r),2);n=a[0],r=a[1],A7(n.shape,r.shape);var i={a:n,b:r};return E5.runKernel(B1,i)}});var f9=B5({imag_:function(e){var t={input:L5(e,"input","imag")};return E5.runKernel(U1,t)}});var d9=B5({isFinite_:function(e){var t={x:L5(e,"x","isFinite")};return E5.runKernel(G1,t)}});var v9=B5({isInf_:function(e){var t={x:L5(e,"x","isInf")};return E5.runKernel(j1,t)}});var m9=B5({isNaN_:function(e){var t={x:L5(e,"x","isNaN")};return E5.runKernel(H1,t)}});var g9=B5({leakyRelu_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2,n=L5(e,"x","leakyRelu"),r={x:n},a={alpha:t};return E5.runKernel(q1,r,a)}});var y9=B5({less_:function(e,t){var n=L5(e,"a","less","string_or_numeric"),r=L5(t,"b","less","string_or_numeric"),a=S(v5(n,r),2);n=a[0],r=a[1],A7(n.shape,r.shape);var i={a:n,b:r};return E5.runKernel(K1,i)}});var b9=B5({lessEqual_:function(e,t){var n=L5(e,"a","lessEqual","string_or_numeric"),r=L5(t,"b","lessEqual","string_or_numeric"),a=S(v5(n,r),2);n=a[0],r=a[1],A7(n.shape,r.shape);var i={a:n,b:r};return E5.runKernel(X1,i)}});function x9(e,t,n){if(n<=0)throw new Error("The number of values should be positive.");var r={start:e,stop:t,num:n};return E5.runKernel(Y1,{},r)}var k9=B5({localResponseNormalization_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,i=L5(e,"x","localResponseNormalization");F$(4===i.rank||3===i.rank,(function(){return"Error in localResponseNormalization: x must be rank 3 or 4 but got\n rank ".concat(i.rank,".")})),F$(B$(t),(function(){return"Error in localResponseNormalization: depthRadius must be an "+"integer but got depthRadius ".concat(t,".")}));var o=i,s=!1;3===i.rank&&(s=!0,o=W8(i,[1,i.shape[0],i.shape[1],i.shape[2]]));var u={x:o},c={depthRadius:t,bias:n,alpha:r,beta:a},l=E5.runKernel(n2,u,c);return s?W8(l,[l.shape[1],l.shape[2],l.shape[3]]):l}});var w9=B5({log_:function(e){var t={x:L5(e,"x","log","float32")};return E5.runKernel(J1,t)}});var I9=B5({log1p_:function(e){var t={x:L5(e,"x","log1p")};return E5.runKernel(Z1,t)}});function N9(e,t){F$(r0(e),(function(){return"The f passed in variableGrads(f) must be a function"})),F$(null==t||Array.isArray(t)&&t.every((function(e){return e instanceof c5})),(function(){return"The varList passed in variableGrads(f, varList) must be an array of variables"}));var n=null!=t;if(!n)for(var r in t=[],E5.registeredVariables)t.push(E5.registeredVariables[r]);var a=n?t.filter((function(e){return!e.trainable})):null,i=t.length;t=t.filter((function(e){return e.trainable})),F$(t.length>0,(function(){return"variableGrads() expects at least one of the input variables to "+"be trainable, but none of the ".concat(i," variables is ")+"trainable."}));var o=E5.gradients(e,t,null,!0),s=o.value,u=o.grads;F$(u.some((function(e){return null!=e})),(function(){return"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."})),F$(0===s.rank,(function(){return"The f passed in variableGrads(f) must return a scalar, but it "+"returned a rank-".concat(s.rank," tensor")}));var c={};return t.forEach((function(e,t){null!=u[t]&&(c[e.name]=u[t])})),null!=a&&a.forEach((function(e){return c[e.name]=null})),{value:s,grads:c}}function S9(e){return E5.customGrad(e)}function T9(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 E9=B5({neg_:function(e){var t={x:L5(e,"x","neg")};return E5.runKernel(y2,t)}});var C9=B5({softplus_:function(e){var t={x:L5(e,"x","softplus")};return E5.runKernel(n3,t)}});var A9=B5({logSigmoid_:function(e){var t=L5(e,"x","logSigmoid"),n=S9((function(e){return{value:E9(C9(E9(e))),gradFunc:function(t){return c8(t,H8(E9(e)))}}}));return n(t)}});var R9=B5({sub_:function(e,t){var n=L5(e,"a","sub"),r=L5(t,"b","sub"),a=S(v5(n,r),2),i={a:n=a[0],b:r=a[1]};return E5.runKernel(x3,i)}});var _9=B5({logSoftmax_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=L5(e,"logits","logSoftmax");if(-1===t&&(t=n.rank-1),t!==n.rank-1)throw Error("Log Softmax along a non-last dimension is not yet supported. "+"Logits was rank ".concat(n.rank," and axis was ").concat(t));var r=S9((function(e,n){var r=X7(e,t,!0),a=R9(e,r),i=R9(X6(a,"float32"),w9(e9(a9(a),t,!0)));n([i]);return{value:i,gradFunc:function(e,n){var r=S(n,1)[0],a=a9(r);return R9(e,c8(e9(e,t,!0),a))}}}));return r(n)}});var O9=B5({logSumExp_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=L5(e,"x","logSumExp"),a=j$(t,r.shape),i=X7(r,a,!0),o=R9(r,i),s=a9(o),u=e9(s,a),c=w9(u),l=o8(W8(i,c.shape),c);if(n){var h=G7(l.shape,a);return W8(l,h)}return l}});var F9=B5({logicalAnd_:function(e,t){var n=L5(e,"a","logicalAnd","bool"),r=L5(t,"b","logicalAnd","bool");A7(n.shape,r.shape);var a={a:n,b:r};return E5.runKernel(Q1,a)}});var D9=B5({logicalNot_:function(e){var t={x:L5(e,"x","logicalNot","bool")};return E5.runKernel($1,t)}});var M9=B5({logicalOr_:function(e,t){var n=L5(e,"a","logicalOr","bool"),r=L5(t,"b","logicalOr","bool");A7(n.shape,r.shape);var a={a:n,b:r};return E5.runKernel(e2,a)}});var L9=B5({logicalXor_:function(e,t){var n=L5(e,"a","logicalXor","bool"),r=L5(t,"b","logicalXor","bool");return A7(n.shape,r.shape),F9(M9(e,t),D9(F9(e,t)))}}),z9=2147483648;var P9=B5({searchSorted_:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"left",r=L5(e,"sortedSequence","searchSorted"),a=L5(t,"values","searchSorted"),i=r.shape[r.shape.length-1],o=a.shape[a.shape.length-1],s=W8(r,[-1,i]),u=W8(a,[-1,o]);if(s.rank<2)throw new Error("Sorted input argument must be at least 2-dimensional");if(s.shape[0]!==u.shape[0])throw new Error("Leading dimension of 'sortedSequence' and 'values' must match.");if(L$(u.shape)>=z9)throw new Error("values tensor size must less than ".concat(z9));if(s.shape[1]>=z9)throw new Error("trailing dim_size must less than ".concat(z9," for int32 output type, was ").concat(s.shape[1]));var c={sortedSequence:s,values:u},l={side:n};return E5.runKernel(X2,c,l)}});function B9(e,t){return P9(e,t,"left")}var W9=B5({maxPool_:function(e,t,n,r,a){var i=L5(e,"x","maxPool"),o=i,s=!1;3===i.rank&&(s=!0,o=W8(i,[1,i.shape[0],i.shape[1],i.shape[2]])),F$(4===o.rank,(function(){return"Error in maxPool: input must be rank 4 but got rank ".concat(o.rank,".")})),F$(L8(n,1),(function(){return"Error in maxPool: Either strides or dilations must be 1. "+"Got strides ".concat(n," and dilations '").concat(1,"'")})),B8("maxPool",r,a);var u={x:o},c={filterSize:t,strides:n,pad:r,dimRoundingMode:a},l=E5.runKernel(o2,u,c);return s?W8(l,[l.shape[1],l.shape[2],l.shape[3]]):l}});var V9=B5({maxPool3d_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[1,1,1],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"NDHWC",o=L5(e,"x","maxPool3d"),s=o,u=!1;4===o.rank&&(u=!0,s=W8(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]])),F$(5===s.rank,(function(){return"Error in maxPool3d: x must be rank 5 but got rank ".concat(s.rank,".")})),F$("NDHWC"===i,(function(){return"Error in maxPool3d: Only NDHWC is currently supported, "+"but got dataFormat of ".concat(i)})),B8("maxPool3d",r,a);var c={x:s},l={filterSize:t,strides:n,pad:r,dimRoundingMode:a,dataFormat:i},h=E5.runKernel(u2,c,l);return u?W8(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}});var U9=B5({maxPoolWithArgmax_:function(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=L5(e,"x","maxPoolWithArgmax"),o={x:i},s={filterSize:t,strides:n,pad:r,includeBatchInIndex:a},u=E5.runKernel(l2,o,s);return{result:u[0],indexes:u[1]}}});var G9=B5({maximum_:function(e,t){var n=L5(e,"a","maximum"),r=L5(t,"b","maximum"),a=S(v5(n,r),2);n=a[0],r=a[1],"bool"===n.dtype&&(n=X6(n,"int32"),r=X6(r,"int32")),A7(n.shape,r.shape);var i={a:n,b:r};return E5.runKernel(i2,i)}});var j9=B5({mean_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=L5(e,"x","mean"),a={x:r},i={axis:t,keepDims:n};return E5.runKernel(h2,a,i)}});function H9(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"float32";if(p0(e),"complex64"===t){var n=H9(e,"float32"),r=H9(e,"float32");return W5(n,r)}var a=l0(L$(e),t);return E5.makeTensor(a,e,t)}function q9(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"float32";if(p0(e),"complex64"===t){var n=q9(e,"float32"),r=H9(e,"float32");return W5(n,r)}var a=c0(L$(e),t);return E5.makeTensor(a,e,t)}function K9(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.indexing,a=void 0===r?"xy":r;if("xy"!==a&&"ij"!==a)throw new TypeError("".concat(a," is not a valid third argument to meshgrid"));if(void 0===e)return[];var i=L5(e,"x","meshgrid",e instanceof n5?e.dtype:"float32");if(void 0===t)return[i];var o=L5(t,"y","meshgrid",t instanceof n5?t.dtype:"float32"),s=L$(i.shape),u=L$(o.shape);return"xy"===a?(i=W8(i,[1,-1]),o=W8(o,[-1,1]),[j8(q9([u,1],i.dtype),i),j8(o,q9([1,s],o.dtype))]):(i=W8(i,[-1,1]),o=W8(o,[1,-1]),[j8(i,q9([1,u],i.dtype)),j8(q9([s,1],o.dtype),o)])}var X9=B5({minimum_:function(e,t){var n=L5(e,"a","minimum"),r=L5(t,"b","minimum"),a=S(v5(n,r),2);n=a[0],r=a[1],"bool"===n.dtype&&(n=X6(n,"int32"),r=X6(r,"int32")),A7(n.shape,r.shape);var i={a:n,b:r};return E5.runKernel(f2,i)}});var Y9=B5({mirrorPad_:function(e,t,n){F$("reflect"===n||"symmetric"===n,(function(){return"Invalid mode. Mode must be either reflect or symmetric. "+"Got ".concat(n,".")}));var r=L5(e,"x","mirrorPad");if(0===r.rank)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");F$(t.length===r.rank,(function(){return"Padding doesn't match input. Must be ".concat(r.rank,". ")+"Got ".concat(t.length,".")}));for(var a="reflect"===n?1:0,i=function(e){F$(2===t[e].length,(function(){return"Invalid number of paddings. Must be length of 2 each."})),F$(t[e][0]>=0&&t[e][0]<=r.shape[e]-a&&t[e][1]>=0&&t[e][1]<=r.shape[e]-a,(function(){return"Padding in dimension ".concat(e," cannot be greater than or equal ")+"to ".concat(r.shape[e]-a," or less than 0 for input of ")+"shape ".concat(r.shape)}))},o=0;o<r.rank;o++)i(o);var s={paddings:t,mode:n},u={x:r};return E5.runKernel(d2,u,s)}});var J9=B5({mod_:function(e,t){var n=L5(e,"a","mod"),r=L5(t,"b","mod"),a=S(v5(n,r),2),i={a:n=a[0],b:r=a[1]};return E5.runKernel(v2,i)}});var Z9=B5({moments_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=j$(t,(e=L5(e,"x","moments")).shape),a=j9(e,r,n),i=a.shape;n||(i=G7(a.shape,r));var o=$7(R9(X6(e,"float32"),W8(a,i))),s=j9(o,r,n);return{mean:a,variance:s}}});var Q9=B5({multiRNNCell_:function(e,t,n,r){for(var a=L5(t,"data","multiRNNCell"),i=z5(n,"c","multiRNNCell"),o=z5(r,"h","multiRNNCell"),s=a,u=[],c=0;c<e.length;c++){var l=e[c](s,i[c],o[c]);u.push(l[0]),u.push(l[1]),s=l[1]}for(var h=[],p=[],f=0;f<u.length;f+=2)h.push(u[f]),p.push(u[f+1]);return[h,p]}});var $9=B5({multinomial_:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=L5(e,"logits","multinomial"),i=a.size,o=a.rank;if(i<2)throw new Error("Error in multinomial: you need at least 2 outcomes, but got "+"".concat(i,"."));if(o>2)throw new Error("Rank of probabilities must be 1 or 2, but is ".concat(o));n=n||Math.random();var s=1===o?W8(a,[1,-1]):a,u={logits:s},c={numSamples:t,seed:n,normalized:r},l=E5.runKernel(m2,u,c);return 1===o?W8(l,[l.size]):l}});var eee=B5({notEqual_:function(e,t){var n=L5(e,"a","notEqual","string_or_numeric"),r=L5(t,"b","notEqual","string_or_numeric"),a=S(v5(n,r),2);n=a[0],r=a[1],A7(n.shape,r.shape);var i={a:n,b:r};return E5.runKernel(b2,i)}});var tee=B5({oneHot_:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"int32";if(t<2)throw new Error("Error in oneHot: depth must be >=2, but it is ".concat(t));var i=L5(e,"indices","oneHot","int32"),o={indices:i},s={dtype:a,depth:t,onValue:n,offValue:r};return E5.runKernel(N2,o,s)}});var nee=B5({onesLike_:function(e){var t={x:L5(e,"x","onesLike")};return E5.runKernel(I2,t)}});var ree=B5({outerProduct_:function(e,t){var n=L5(e,"v1","outerProduct"),r=L5(t,"v2","outerProduct");F$(1===n.rank&&1===r.rank,(function(){return"Error in outerProduct: inputs must be rank 1, but got ranks "+"".concat(n.rank," and ").concat(r.rank,".")}));var a=W8(n,[-1,1]),i=W8(r,[1,-1]);return j8(a,i)}});var aee=B5({pad_:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=L5(e,"x","pad");if(0===r.rank)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");var a={paddings:t,constantValue:n},i={x:r};return E5.runKernel(T2,i,a)}});var iee=B5({pad1d_:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return F$(2===t.length,(function(){return"Invalid number of paddings. Must be length of 2."})),aee(e,[t],n)}});var oee=B5({pad2d_:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return F$(2===t.length&&2===t[0].length&&2===t[1].length,(function(){return"Invalid number of paddings. Must be length of 2 each."})),aee(e,t,n)}});var see=B5({pad3d_:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return F$(3===t.length&&2===t[0].length&&2===t[1].length&&2===t[2].length,(function(){return"Invalid number of paddings. Must be length of 2 each."})),aee(e,t,n)}});var uee=B5({pad4d_:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return F$(4===t.length&&2===t[0].length&&2===t[1].length&&2===t[2].length&&2===t[3].length,(function(){return"Invalid number of paddings. Must be length of 2 each."})),aee(e,t,n)}});var cee=B5({spaceToBatchND_:function(e,t,n){var r=L5(e,"x","spaceToBatchND");F$(r.rank>=1+t.length,(function(){return"input rank ".concat(r.rank," should be > than [blockShape] ").concat(t.length)})),F$(n.length===t.length,(function(){return"paddings.shape[0] ".concat(n.length," must be equal to [blockShape] ").concat(t.length)})),F$(r.shape.reduce((function(e,r,a){return a>0&&a<=t.length?e&&(r+n[a-1][0]+n[a-1][1])%t[a-1]==0:e}),!0),(function(){return"input spatial dimensions ".concat(r.shape.slice(1)," with paddings ").concat(n.toString()," must be divisible by blockShapes ").concat(t.toString())}));var a={x:r},i={blockShape:t,paddings:n};return E5.runKernel(i3,a,i)}});var lee=B5({pool_:function(e,t,n,r,a,i,o){null==a&&(a=[1,1]),null==i&&(i=1),0===r&&(r="valid");var s=L5(e,"x","maxPool"),u=s,c=!1;3===s.rank&&(c=!0,u=W8(s,[1,s.shape[0],s.shape[1],s.shape[2]])),F$(L8(i,a),(function(){return"Error in pool: Either strides or dilations must be 1. "+"Got strides ".concat(i," and dilations '").concat(a,"'")}));var l,h=N8(u.shape,t,i,a,r),p=[h.dilationHeight,h.dilationWidth];l="same"===r?function(e,t){var n=e.map((function(e,n){return e+(e-1)*(t[n]-1)})).map((function(e){return e-1})),r=n.map((function(e){return Math.floor(e/2)})),a=n.map((function(e,t){return e-r[t]}));return n.map((function(e,t){return[r[t],a[t]]}))}([h.filterHeight,h.filterWidth],p):[[0,0],[0,0]];var f=1===p[0]&&1===p[1],d=function(e,t,n){var r=n.map((function(e){return e[0]})),a=n.map((function(e){return e[1]})),i=e.concat(r,a),o=t.map((function(e,t){return(e-i[t]%e)%e})),s=a.map((function(e,t){return e+o[t]})),u=t.map((function(e,t){return[r[t],s[t]]})),c=t.map((function(e,t){return[0,o[t]]}));return[u,c]}([h.inHeight,h.inWidth],p,l),v=S(d,2),m=v[0],g=v[1],y=f?r:"valid",b=f?u:cee(u,p,m),x=("avg"===n?function(){return V8(b,t,i,y,o)}:function(){return W9(b,t,i,y,o)})(),k=f?x:Y8(x,p,g);return c?W8(k,[k.shape[1],k.shape[2],k.shape[3]]):k}});var hee=B5({prelu_:function(e,t){var n={x:L5(e,"x","prelu"),alpha:L5(t,"alpha","prelu")};return E5.runKernel(C2,n)}});var pee=B5({prod_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=L5(e,"x","prod");"bool"===r.dtype&&(r=X6(r,"int32"));var a={x:r},i={axis:t,keepDims:n};return E5.runKernel(A2,a,i)}});var fee=B5({raggedGather_:function(e,t,n,r){var a={paramsNestedSplits:e.map((function(e,t){return L5(e,"tensors".concat(t),"raggedGather","int32")})),paramsDenseValues:L5(t,"paramsDenseValues","raggedGather"),indices:L5(n,"indices","raggedGather","int32")},i={outputRaggedRank:r},o=E5.runKernel(R2,a,i);return{outputNestedSplits:o.slice(0,o.length-1),outputDenseValues:o[o.length-1]}}});var dee=B5({raggedRange_:function(e,t,n){var r=L5(e,"starts","raggedRange"),a={starts:r,limits:L5(t,"limits","raggedRange",r.dtype),deltas:L5(n,"deltas","raggedRange",r.dtype)},i=E5.runKernel(_2,a);return{rtNestedSplits:i[0],rtDenseValues:i[1]}}});var vee=B5({raggedTensorToTensor_:function(e,t,n,r,a){var i=L5(e,"shape","raggedTensorToTensor","int32"),o=L5(t,"values","raggedTensorToTensor"),s={shape:i,values:o,defaultValue:L5(n,"defaultValue","raggedTensorToTensor",o.dtype),rowPartitionTensors:r.map((function(e,t){return L5(e,"tensors".concat(t),"raggedTensorToTensor","int32")}))},u={rowPartitionTypes:a};return E5.runKernel(O2,s,u)}});var mee=B5({rand_:function(e,t,n){p0(e);var r=L$(e),a=null;if(null==n||"float32"===n)a=new Float32Array(r);else if("int32"===n)a=new Int32Array(r);else{if("bool"!==n)throw new Error("Unknown data type ".concat(n));a=new Uint8Array(r)}for(var i=0;i<r;i++)a[i]=t();return E5.makeTensor(a,e,n)}}),gee={exports:{}};!function(e){!function(e,t,n){function r(e){var t=this,n=function(){var e=4022871197,t=function(t){t=String(t);for(var n=0;n<t.length;n++){var r=.02519603282416938*(e+=t.charCodeAt(n));r-=e=r>>>0,e=(r*=e)>>>0,e+=4294967296*(r-=e)}return 2.3283064365386963e-10*(e>>>0)};return t}();t.next=function(){var e=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=n(" "),t.s1=n(" "),t.s2=n(" "),t.s0-=n(e),t.s0<0&&(t.s0+=1),t.s1-=n(e),t.s1<0&&(t.s1+=1),t.s2-=n(e),t.s2<0&&(t.s2+=1),n=null}function a(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 r(e),i=t&&t.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.quick=o,i&&("object"==s(i)&&a(i,n),o.state=function(){return a(n,{})}),o}t&&t.exports?t.exports=i:n&&n.amd?n((function(){return i})):this.alea=i}(0,e,!1)}(gee);var yee=gee.exports,bee={exports:{}};!function(e){!function(e,t,n){function r(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()}function a(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 r(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"==s(i)&&a(i,n),o.state=function(){return a(n,{})}),o}t&&t.exports?t.exports=i:n&&n.amd?n((function(){return i})):this.xor128=i}(0,e,!1)}(bee);var xee=bee.exports,kee={exports:{}};!function(e){!function(e,t,n){function r(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()}function a(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 r(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"==s(i)&&a(i,n),o.state=function(){return a(n,{})}),o}t&&t.exports?t.exports=i:n&&n.amd?n((function(){return i})):this.xorwow=i}(0,e,!1)}(kee);var wee=kee.exports,Iee={exports:{}};!function(e){!function(e,t,n){function r(e){var t=this;t.next=function(){var e,n,r=t.x,a=t.i;return e=r[a],n=(e^=e>>>7)^e<<24,n^=(e=r[a+1&7])^e>>>10,n^=(e=r[a+3&7])^e>>>3,n^=(e=r[a+4&7])^e<<7,e=r[a+7&7],n^=(e^=e<<13)^e<<9,r[a]=n,t.i=a+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)}function a(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 r(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&&a(i,n),o.state=function(){return a(n,{})}),o}t&&t.exports?t.exports=i:n&&n.amd?n((function(){return i})):this.xorshift7=i}(0,e,!1)}(Iee);var Nee=Iee.exports,See={exports:{}};!function(e){!function(e,t,n){function r(e){var t=this;t.next=function(){var e,n,r=t.w,a=t.X,i=t.i;return t.w=r=r+1640531527|0,n=a[i+34&127],e=a[i=i+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=a[i]=n^e,t.i=i,n+(r^r>>>16)|0},function(e,t){var n,r,a,i,o,s=[],u=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,u=Math.max(u,t.length)),a=0,i=-32;i<u;++i)t&&(r^=t.charCodeAt((i+32)%t.length)),0===i&&(o=r),r^=r<<10,r^=r>>>15,r^=r<<4,r^=r>>>13,i>=0&&(o=o+1640531527|0,a=0==(n=s[127&i]^=r+o)?a+1:0);for(a>=128&&(s[127&(t&&t.length||0)]=-1),a=127,i=512;i>0;--i)r=s[a+34&127],n=s[a=a+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[a]=r^n;e.w=o,e.X=s,e.i=a}(t,e)}function a(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 r(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&&a(i,n),o.state=function(){return a(n,{})}),o}t&&t.exports?t.exports=i:n&&n.amd?n((function(){return i})):this.xor4096=i}(0,e,!1)}(See);var Tee=See.exports,Eee={exports:{}};!function(e){!function(e,t,n){function r(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,a=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^a,a=a-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^a,t.a=a-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()}function a(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 r(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"==s(i)&&a(i,n),o.state=function(){return a(n,{})}),o}t&&t.exports?t.exports=i:n&&n.amd?n((function(){return i})):this.tychei=i}(0,e,!1)}(Eee);var Cee=Eee.exports,Aee={exports:{}};!function(e){!function(t,n,r){var a,i=256,o=r.pow(i,6),u=r.pow(2,52),c=2*u,l=255;function h(e,s,l){var h=[],g=v(d((s=1==s?{entropy:!0}:s||{}).entropy?[e,m(n)]:null==e?function(){try{var e;return a&&(e=a.randomBytes)?e=e(i):(e=new Uint8Array(i),(t.crypto||t.msCrypto).getRandomValues(e)),m(e)}catch(e){var r=t.navigator,o=r&&r.plugins;return[+new Date,t,o,t.screen,m(n)]}}():e,3),h),y=new p(h),b=function(){for(var e=y.g(6),t=o,n=0;e<u;)e=(e+n)*i,t*=i,n=y.g(1);for(;e>=c;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|y.g(4)},b.quick=function(){return y.g(4)/4294967296},b.double=b,v(m(y.S),n),(s.pass||l||function(e,t,n,a){return a&&(a.S&&f(a,y),e.state=function(){return f(y,{})}),n?(r.random=e,t):e})(b,g,"global"in s?s.global:this==r,s.state)}function p(e){var t,n=e.length,r=this,a=0,o=r.i=r.j=0,s=r.S=[];for(n||(e=[n++]);a<i;)s[a]=a++;for(a=0;a<i;a++)s[a]=s[o=l&o+e[a%n]+(t=s[a])],s[o]=t;(r.g=function(e){for(var t,n=0,a=r.i,o=r.j,s=r.S;e--;)t=s[a=l&a+1],n=n*i+s[l&(s[a]=s[o=l&o+t])+(s[o]=t)];return r.i=a,r.j=o,n})(i)}function f(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function d(e,t){var n,r=[],a=s(e);if(t&&"object"==a)for(n in e)try{r.push(d(e[n],t-1))}catch(e){}return r.length?r:"string"==a?e:e+"\0"}function v(e,t){for(var n,r=e+"",a=0;a<r.length;)t[l&a]=l&(n^=19*t[l&a])+r.charCodeAt(a++);return m(t)}function m(e){return String.fromCharCode.apply(0,e)}if(v(r.random(),n),e.exports){e.exports=h;try{a=require("crypto")}catch(e){}}else r.seedrandom=h}("undefined"!=typeof self?self:n,[],Math)}(Aee);var Ree=Aee.exports,_ee=yee,Oee=xee,Fee=wee,Dee=Nee,Mee=Tee,Lee=Cee,zee=Ree;zee.alea=_ee,zee.xor128=Oee,zee.xorwow=Fee,zee.xorshift7=Dee,zee.xor4096=Mee,zee.tychei=Lee;var Pee=zee;function Bee(){return 32===E5.backend.floatPrecision()?.001:.1}function Wee(e,t,n){var r=!0;if((V4(e)||V4(t))&&(r=!1),V4(e)&&V4(t)&&(r=!0),r){var a=e.constructor.name,i=t.constructor.name;if(a!==i)throw new Error("Arrays are of different type. Actual: ".concat(a,". ")+"Expected: ".concat(i))}if(Array.isArray(e)&&Array.isArray(t)){var o=F5(e),s=F5(t);if(!P$(o,s))throw new Error("Arrays have different shapes. "+"Actual: [".concat(o,"]. Expected: [").concat(s,"]"))}var u=V4(e)?e:U4(e),c=V4(t)?t:U4(t);if(u.length!==c.length)throw new Error("Arrays have different lengths actual: ".concat(u.length," vs ")+"expected: ".concat(c.length,".\n")+"Actual: ".concat(u,".\n")+"Expected: ".concat(c,"."));for(var l=0;l<c.length;++l){var h=u[l],p=c[l];if(!n(h,p))throw new Error("Arrays differ: actual[".concat(l,"] = ").concat(h,", expected[").concat(l,"] = ").concat(p,".\n")+"Actual: ".concat(u,".\n")+"Expected: ".concat(c,"."))}"undefined"!=typeof expect&&expect().nothing()}function Vee(e,t,n){if(null==n&&(n=Bee()),!Uee(e,t,n))throw new Error("Numbers differ: actual === ".concat(e,", expected === ").concat(t));"undefined"!=typeof expect&&expect().nothing()}function Uee(e,t,n){return!isFinite(e)&&!isFinite(t)||!(isNaN(e)||isNaN(t)||Math.abs(e-t)>n)}function Gee(){return(Gee=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.play();case 2:if(!("requestVideoFrameCallback"in t)){e.next=5;break}return e.next=5,new Promise((function(e){t.requestVideoFrameCallback(e)}));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var jee={__proto__:null,TEST_EPSILON_FLOAT16:.1,createVideoElement:function(e){var t=document.createElement("video");return"playsInline"in t&&(t.playsInline=!0),t.muted=!0,t.loop=!0,t.style.position="fixed",t.style.left="0px",t.style.top="0px",t.preload="auto",t.appendChild(e),new Promise((function(e){t.addEventListener("loadeddata",(function(n){return e(t)})),t.load()}))},encodeStrings:function e(t){for(var n=0;n<t.length;n++){var r=t[n];Array.isArray(r)?e(r):t[n]=B4(r)}return t},expectArrayBuffersEqual:function(e,t){var n=new Float32Array(e),r=new Float32Array(t);if(n.length!==r.length)throw new Error("Expected ArrayBuffer to be of length "+"".concat(r.length,", but it was ").concat(n.length));for(var a=0;a<r.length;a++)if(n[a]!==r[a])throw new Error("Expected ArrayBuffer value at ".concat(a," to be ")+"".concat(r[a]," but got ").concat(n[a]," instead"))},expectArraysClose:function(e,t,n){return null==n&&(n=Bee()),Wee(e,t,(function(e,t){return Uee(e,t,n)}))},expectArraysEqual:function(e,t){var n="string"==typeof t||"number"==typeof t||"boolean"==typeof t?[t]:t;return $$(e)||$$(e[0])||$$(t)||$$(t[0])?Wee(e,n,(function(e,t){return e==t})):Wee(e,t,(function(e,t){return Uee(e,t,0)}))},expectNumbersClose:Vee,expectPromiseToFail:function(e,t){e().then((function(){return t.fail()}),(function(){return t()})),"undefined"!=typeof expect&&expect().nothing()},expectValuesInRange:function(e,t,n){for(var r=0;r<e.length;r++)if(e[r]<t||e[r]>n)throw new Error("Value out of range:".concat(e[r]," low: ").concat(t,", high: ").concat(n))},play:function(e){return Gee.apply(this,arguments)},testEpsilon:Bee},Hee=function(){function e(t,n,r,a,i){l(this,e),this.mean=t,this.stdDev=n,this.dtype=r,this.nextVal=NaN,this.truncated=a,this.truncated&&(this.upper=this.mean+2*this.stdDev,this.lower=this.mean-2*this.stdDev);var o=i||Math.random();this.random=Pee.alea(o.toString())}return p(e,[{key:"nextValue",value:function(){if(!isNaN(this.nextVal)){var e=this.nextVal;return this.nextVal=NaN,e}for(var t,n,r=!1;!r;){var a=void 0,i=void 0,o=void 0;do{o=(a=2*this.random()-1)*a+(i=2*this.random()-1)*i}while(o>=1||0===o);var s=Math.sqrt(-2*Math.log(o)/o);t=this.mean+this.stdDev*a*s,n=this.mean+this.stdDev*i*s,this.truncated&&!this.isValidTruncated(t)||(r=!0)}return this.truncated&&!this.isValidTruncated(n)||(this.nextVal=this.convertValue(n)),this.convertValue(t)}},{key:"convertValue",value:function(e){return null==this.dtype||"float32"===this.dtype?e:Math.round(e)}},{key:"isValidTruncated",value:function(e){return e<=this.upper&&e>=this.lower}}]),e}(),qee=function(){function e(t,n,r,a){l(this,e),this.alpha=t,this.beta=1/n,this.dtype=r;var i=a||Math.random();this.randu=Pee.alea(i.toString()),this.randn=new Hee(0,1,r,!1,this.randu()),this.d=t<1?t+2/3:t-1/3,this.c=1/Math.sqrt(9*this.d)}return p(e,[{key:"nextValue",value:function(){for(var e,t,n,r,a,i;;){do{r=this.randn.nextValue(),i=1+this.c*r}while(i<=0);if(i*=i*i,t=1-.331*(e=r*r)*e,n=.5*e+this.d*(1-i+Math.log(i)),(a=this.randu())<t||Math.log(a)<n)break}return i=1/this.beta*this.d*i,this.alpha<1&&(i*=Math.pow(this.randu(),1/this.alpha)),this.convertValue(i)}},{key:"convertValue",value:function(e){return"float32"===this.dtype?e:Math.round(e)}}]),e}(),Kee=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(l(this,e),this.canReturnFloat=function(){return null==t.dtype||"float32"===t.dtype},this.min=n,this.range=r-n,this.dtype=a,null==i&&(i=Math.random()),"number"==typeof i&&(i=i.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error("The difference between ".concat(n," - ").concat(r," <= 1 and dtype is not float"));this.random=Pee.alea(i)}return p(e,[{key:"convertValue",value:function(e){return this.canReturnFloat()?e:Math.round(e)}},{key:"nextValue",value:function(){return this.convertValue(this.min+this.range*this.random())}}]),e}();var Xee=B5({randomGamma_:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"float32",a=arguments.length>4?arguments[4]:void 0;if(p0(e),null==n&&(n=1),null==r&&(r="float32"),"float32"!==r&&"int32"!==r)throw new Error("Unsupported data type ".concat(r));for(var i=new qee(t,n,r,a),o=K6(e,r),s=0;s<o.values.length;s++)o.values[s]=i.nextValue();return o.toTensor()}});var Yee=B5({randomNormal_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;if(p0(e),null!=r&&"bool"===r)throw new Error("Unsupported data type ".concat(r));for(var i=new Hee(t,n,r,!1,a),o=K6(e,r),s=0;s<o.values.length;s++)o.values[s]=i.nextValue();return o.toTensor()}});var Jee=B5({randomStandardNormal_:function(e,t,n){if(null!=t&&"bool"===t)throw new Error("Unsupported data type ".concat(t));return Yee(e,0,1,t,n)}});var Zee=B5({randomUniform_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"float32",a=arguments.length>4?arguments[4]:void 0;p0(e);for(var i=K6(e,r),o=new Kee(t,n,null,a),s=0;s<i.values.length;s++)i.values[s]=o.nextValue();return i.toTensor()}});var Qee=B5({randomUniformInt_:function(e,t,n,r){return Zee(e,t,n,"int32",r)}});function $ee(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"float32";if(0===n)throw new Error("Cannot have a step of zero");var a={start:e,stop:t,step:n,dtype:r};return E5.runKernel(F2,{},a)}var ete=B5({real_:function(e){var t={input:L5(e,"input","real")};return E5.runKernel(D2,t)}});var tte=B5({reciprocal_:function(e){var t={x:L5(e,"x","reciprocal")};return E5.runKernel(M2,t)}});var nte=B5({relu_:function(e){var t={x:L5(e,"x","relu")};return E5.runKernel(L2,t)}});var rte=B5({relu6_:function(e){var t={x:L5(e,"x","relu6")};return E5.runKernel(U2,t)}});var ate=B5({reverse_:function(e,t){var n={x:L5(e,"x","reverse")},r={dims:t};return E5.runKernel(G2,n,r)}});var ite=B5({reverse1d_:function(e){var t=L5(e,"x","reverse");return F$(1===t.rank,(function(){return"Error in reverse1D: x must be rank 1 but got rank ".concat(t.rank,".")})),ate(t,0)}});var ote=B5({reverse2d_:function(e,t){var n=L5(e,"x","reverse");return F$(2===n.rank,(function(){return"Error in reverse2D: x must be rank 2 but got rank ".concat(n.rank,".")})),ate(n,t)}});var ste=B5({reverse3d_:function(e,t){var n=L5(e,"x","reverse");return F$(3===n.rank,(function(){return"Error in reverse3D: x must be rank 3 but got rank ".concat(n.rank,".")})),ate(n,t)}});var ute=B5({reverse4d_:function(e,t){var n=L5(e,"x","reverse");return F$(4===n.rank,(function(){return"Error in reverse4D: x must be rank 4 but got rank ".concat(n.rank,".")})),ate(n,t)}});var cte=B5({round_:function(e){var t={x:L5(e,"x","round")};return E5.runKernel(j2,t)}});var lte=B5({rsqrt_:function(e){var t={x:L5(e,"x","rsqrt","float32")};return E5.runKernel(H2,t)}});var hte=B5({selu_:function(e){var t={x:L5(e,"x","selu")};return E5.runKernel(J2,t)}});var pte=B5({separableConv2d_:function(e,t,n,r,a){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[1,1],o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"NHWC",s=L5(e,"x","separableConv2d"),u=L5(t,"depthwiseFilter","separableConv2d"),c=L5(n,"pointwiseFilter","separableConv2d"),l=s,h=!1;if(3===s.rank&&(h=!0,l=W8(s,[1,s.shape[0],s.shape[1],s.shape[2]])),"NCHW"===o)throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");F$(4===l.rank,(function(){return"Error in separableConv2d: input must be rank 4, but got "+"rank ".concat(l.rank,".")})),F$(4===u.rank,(function(){return"Error in separableConv2d: depthwise filter must be rank 4, but "+"got rank ".concat(u.rank,".")})),F$(4===c.rank,(function(){return"Error in separableConv2d: pointwise filter must be rank 4, but "+"got rank ".concat(u.rank,".")})),F$(1===c.shape[0],(function(){return"Error in separableConv2d: the first dimension of pointwise filter "+" must be 1, but got ".concat(c.shape[0],".")})),F$(1===c.shape[1],(function(){return"Error in separableConv2d: the second dimension of pointwise "+"filter must be 1, but got ".concat(c.shape[1],".")}));var p=u.shape[2],f=u.shape[3];F$(c.shape[2]===p*f,(function(){return"Error in separableConv2d: the third dimension of pointwise filter "+"must be ".concat(p*f,", ")+"but got ".concat(c.shape[2],".")}));var d=N7(l,u,r,a,o,i),v=1,m=h7(d,c,v,"valid",o);return h?W8(m,[m.shape[1],m.shape[2],m.shape[3]]):m}});function fte(){return fte=c(o().mark((function e(t,n){var r,a,i,s,u,c,l,h,p,f,d;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=L5(t,"x","setdiff1d"),a=L5(n,"y","setdiff1d"),F$(r.dtype===a.dtype,(function(){return"x and y should have the same dtype, but got x (".concat(r.dtype,") and y (").concat(a.dtype,").")})),F$(1===r.rank,(function(){return"x should be 1D tensor, but got x (".concat(r.shape,").")})),F$(1===a.rank,(function(){return"y should be 1D tensor, but got y (".concat(a.shape,").")})),e.next=7,r.data();case 7:return i=e.sent,e.next=10,a.data();case 10:for(s=e.sent,u=new Set(s),c=0,l=0;l<i.length;l++)u.has(i[l])||c++;for(h=new $4([c],r.dtype),p=new $4([c],"int32"),f=0,d=0;f<i.length;f++)u.has(i[f])||(h.values[d]=i[f],p.values[d]=f,d++);return e.abrupt("return",[h.toTensor(),p.toTensor()]);case 18:case"end":return e.stop()}}),e)}))),fte.apply(this,arguments)}var dte=function(e,t){return fte.apply(this,arguments)};var vte=B5({sign_:function(e){var t={x:L5(e,"x","sign")};return E5.runKernel(e3,t)}});var mte=B5({sin_:function(e){var t={x:L5(e,"x","sin","float32")};return E5.runKernel(Q2,t)}});var gte=B5({sinh_:function(e){var t={x:L5(e,"x","sinh")};return E5.runKernel($2,t)}});var yte=B5({slice1d_:function(e,t,n){var r=L5(e,"x","slice1d");return F$(1===r.rank,(function(){return"slice1d expects a rank-1 tensor, but got a rank-".concat(r.rank," tensor")})),q8(r,[t],[n])}});var bte=B5({slice2d_:function(e,t,n){var r=L5(e,"x","slice2d");return F$(2===r.rank,(function(){return"slice2d expects a rank-2 tensor, but got a rank-".concat(r.rank," tensor")})),q8(r,t,n)}});var xte=B5({slice3d_:function(e,t,n){var r=L5(e,"x","slice3d");return F$(3===r.rank,(function(){return"slice3d expects a rank-3 tensor, but got a rank-".concat(r.rank," tensor")})),q8(r,t,n)}});var kte=B5({slice4d_:function(e,t,n){var r=L5(e,"x","slice4d");return F$(4===r.rank,(function(){return"slice4d expects a rank-4 tensor, but got a rank-".concat(r.rank," tensor")})),q8(r,t,n)}});var wte=B5({softmax_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=L5(e,"logits","softmax","float32");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 ".concat(n.rank," and dim was ").concat(t));var r={logits:n},a={dim:t};return E5.runKernel(s3,r,a)}});var Ite=B5({fft_:function(e){F$("complex64"===e.dtype,(function(){return"The dtype for tf.spectral.fft() must be complex64 "+"but got ".concat(e.dtype,".")}));var t={input:e};return E5.runKernel(R1,t)}});var Nte=B5({ifft_:function(e){F$("complex64"===e.dtype,(function(){return"The dtype for tf.spectral.ifft() must be complex64 "+"but got ".concat(e.dtype,".")}));var t={input:e};return E5.runKernel(V1,t)}});var Ste=B5({irfft_:function(e){var t,n=e.shape[e.shape.length-1],r=e.size/n;if(n<=2){var a=W8(e,[r,n]);t=Nte(a)}else{var i=[r,2*(n-1)],o=W8(ete(e),[r,n]),s=W8(f9(e),[r,n]),u=ate(q8(o,[0,1],[r,n-2]),1),c=c8(ate(q8(s,[0,1],[r,n-2]),1),Z7(-1)),l=G8([o,u],1),h=G8([s,c],1),p=W8(W5(l,h),[i[0],i[1]]);t=Nte(p)}if(t=ete(t),3===e.rank&&0!==e.shape[0]){var f=t,d=e.shape[0];t=W8(t,[d,t.shape[0]/d,t.shape[1]]),f.dispose()}return t}});var Tte=B5({split_:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=L5(e,"x","split"),a={x:r},i={numOrSizeSplits:t,axis:n};return E5.runKernel(o3,a,i)}});var Ete=B5({rfft_:function(e,t){F$("float32"===e.dtype,(function(){return"The dtype for rfft() must be real value but got ".concat(e.dtype)}));var n,r=e.shape[e.shape.length-1],a=e.size/r;if(null!=t&&t<r){var i=e.shape.map((function(e){return 0})),o=e.shape.map((function(e){return e}));o[e.shape.length-1]=t,n=q8(e,i,o),r=t}else if(null!=t&&t>r){var s=e.shape.map((function(e){return e}));s[e.shape.length-1]=t-r,n=G8([e,H9(s)],e.shape.length-1),r=t}else n=e;var u=F7(n),c=W8(W5(n,u),[a,r]),l=Ite(c),h=Math.floor(r/2)+1,p=ete(l),f=f9(l),d=Tte(p,[h,r-h],p.shape.length-1),v=Tte(f,[h,r-h],f.shape.length-1),m=n.shape.slice();return m[n.shape.length-1]=h,W8(W5(d[0],v[0]),m)}});var Cte=B5({squaredDifference_:function(e,t){var n=L5(e,"a","squaredDifference"),r=L5(t,"b","squaredDifference"),a=S(v5(n,r),2);n=a[0],r=a[1],A7(n.shape,r.shape);var i={a:n,b:r};return E5.runKernel(f3,i,{})}});var Ate=B5({squeeze_:function(e,t){var n=L5(e,"x","squeeze","string_or_numeric");return W8(n,H$(n.shape,t).newShape)}});var Rte=B5({stack_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=z5(e,"tensors","stack","string_or_numeric");F$(n.length>=1,(function(){return"Pass at least one tensor to tf.stack"})),n.length>0&&F$(t<=n[0].rank,(function(){return"Axis must be <= rank of the tensor"}));var r=n,a={axis:t};return E5.runKernel(S2,r,a)}});var _te=B5({step_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=L5(e,"x","step"),r={x:n},a={alpha:t};return E5.runKernel(_3,r,a)}});var Ote=B5({stridedSlice_:function(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,u=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0,c=L5(e,"x","stridedSlice","string_or_numeric"),l={x:c},h={begin:t,end:n,strides:r,beginMask:a,endMask:i,ellipsisMask:o,newAxisMask:s,shrinkAxisMask:u};return E5.runKernel(m3,l,h)}});var Fte=B5({tan_:function(e){var t={x:L5(e,"x","tan","float32")};return E5.runKernel(k3,t)}});function Dte(e,t){M$(e);var n=F5(e,t);if(1!==n.length)throw new Error("tensor1d() requires values to be a flat/TypedArray");return V5(e,null,n,t)}function Mte(e,t,n){if(M$(e),null!=t&&2!==t.length)throw new Error("tensor2d() requires shape to have two numbers");var r=F5(e,n);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 V5(e,t,r,n)}function Lte(e,t,n){if(M$(e),null!=t&&3!==t.length)throw new Error("tensor3d() requires shape to have three numbers");var r=F5(e,n);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 V5(e,t,r,n)}function zte(e,t,n){if(M$(e),null!=t&&4!==t.length)throw new Error("tensor4d() requires shape to have four numbers");var r=F5(e,n);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 V5(e,t,r,n)}function Pte(e,t,n){if(M$(e),null!=t&&5!==t.length)throw new Error("tensor5d() requires shape to have five numbers");var r=F5(e,n);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 V5(e,t,r,n)}function Bte(e,t,n){if(M$(e),null!=t&&6!==t.length)throw new Error("tensor6d() requires shape to have six numbers");var r=F5(e,n);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 V5(e,t=t||r,r,n)}function Wte(e,t,n){var r=t.rank>1?t.shape[t.rank-1]:1,a=t.rank>1?t.rank-1:1,i="Must have updates.shape = indices.shape[:batchDim] + "+"shape[sliceDim:], got updates.shape: ".concat(n.shape)+", indices.shape: ".concat(t.shape,", shape: ").concat(e)+", sliceDim: ".concat(r,", and batchDim: ").concat(a,".");if(n.rank<a)throw new Error(i+" update.rank < ".concat(a,". "));if(e.length<r+(n.rank-a))throw new Error(i+" Output shape length < ".concat(r+(n.rank-a)));if(n.rank!==a+e.length-r)throw new Error(i+" update.rank != ".concat(a+e.length-r));for(var o=0;o<a;++o)if(n.shape[o]!==t.shape[o])throw new Error(i+" updates.shape[".concat(o,"] (").concat(n.shape[o],") != indices.shape[").concat(o,"] (").concat(t.shape[o],")."));for(var s=0;s<n.rank-a;++s)if(n.shape[s+a]!==e[s+r])throw new Error(i+" updates.shape[".concat(s+a,"] (").concat(n.shape[s+a],") != shape[").concat(s+a,"] (").concat(e[s+a],")"))}function Vte(e,t,n){if(t.rank<1)throw new Error("tf.scatterND() expects the indices to be rank 1 or higher,"+" but the rank was ".concat(t.rank,"."));if(e.rank<1)throw new Error("tf.scatterND() expects the updates to be rank 1 or higher,"+" but the rank was ".concat(e.rank,"."));if("int32"!==t.dtype)throw new Error("The dtype of 'indices' should be int32, but got dtype: ".concat(t.dtype));if(n.length<1)throw new Error("Output rank must be greater or equal to 1, but got shape: ".concat(n));if(0===n.length){if(0===t.size)throw new Error("Indices specified for empty output. indices shape: ".concat(t.shape));if(0===e.size)throw new Error("Updates specified for empty output. updates shape: ".concat(e.shape))}Wte(n,t,e)}function Ute(e,t,n){for(var r=t.shape.length,a=r>1?t.shape[r-1]:1,i=n.length,o=1,s=a;s<i;++s)o*=n[s];var u=a<1?1:a;return{sliceRank:a,numUpdates:L$(t.shape)/u,sliceSize:o,strides:[].concat(T(i0(n.slice(0,a))),[1]),outputSize:L$(n)}}var Gte={__proto__:null,calculateShapes:Ute,validateInput:Vte,validateUpdateShape:Wte};var jte=B5({tensorScatterUpdate_:function(e,t,n){var r=L5(e,"tensor","tensorScatterupdate"),a=L5(t,"indices","tensorScatterupdate","int32"),i=L5(n,"updates","tensorScatterupdate");if(Vte(i,a,r.shape),r.dtype!==i.dtype)throw new Error("tensor and updates must have the same dtype, instead they are ".concat(r.dtype," and ").concat(i.dtype,"."));var o={tensor:r,indices:a,updates:i};return E5.runKernel(K2,o,{})}});var Hte=B5({topk_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=L5(e,"x","topk");if(0===r.rank)throw new Error("topk() expects the input to be of rank 1 or higher");var a=r.shape[r.shape.length-1];if(t<0)throw new Error("'k' passed to topk() must be >= 0 but got ".concat(t));if(t>a)throw new Error("'k' passed to topk() must be <= the last dimension (".concat(a,") ")+"but got ".concat(t));var i={x:r},o={k:t,sorted:n},s=E5.runKernel(N3,i,o),u=S(s,2),c=u[0],l=u[1];return{values:c,indices:l}}});var qte=B5({truncatedNormal_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;if(p0(e),null!=r&&"bool"===r)throw new Error("Unsupported data type $ { dtype }");for(var i=new Hee(t,n,r,!0,a),o=K6(e,r),s=0;s<o.values.length;s++)o.values[s]=i.nextValue();return o.toTensor()}});var Kte=B5({unique_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=L5(e,"x","unique","string_or_numeric");F$(n.rank>0,(function(){return"The input tensor must be at least 1D"}));var r={x:n},a={axis:t},i=E5.runKernel(E3,r,a),o=S(i,2),s=o[0],u=o[1];return{values:s,indices:u}}});var Xte=B5({unsortedSegmentSum_:function(e,t,n){var r=L5(e,"x","unsortedSegmentSum"),a=L5(t,"segmentIds","unsortedSegmentSum","int32");F$(B$(n),(function(){return"numSegments must be of dtype int"}));var i={x:r,segmentIds:a},o={numSegments:n};return E5.runKernel(A3,i,o)}});var Yte=B5({unstack_:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=L5(e,"x","unstack","string_or_numeric");F$(t>=-n.shape.length&&t<n.shape.length,(function(){return"Axis = ".concat(t," is not in [-").concat(n.shape.length,", ").concat(n.shape.length,")")}));var r={value:n},a={axis:t};return E5.runKernel(C3,r,a)}});function Jte(e,t){return P9(e,t,"right")}function Zte(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;return E5.makeVariable(e,t,n,r)}function Qte(e,t){for(var n=[],r=0;r<t.length;r++)t[r]&&n.push(r);for(var a=K6(e,"int32"),i=K6([n.length,e.length],"int32"),o=0;o<n.length;o++){var s=a.indexToLoc(n[o]),u=o*e.length;i.values.set(s,u)}return i.toTensor()}function $te(){return($te=c(o().mark((function e(t){var n,r,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=L5(t,"condition","whereAsync","bool"),e.next=3,n.data();case 3:return r=e.sent,a=Qte(n.shape,r),t!==n&&n.dispose(),e.abrupt("return",a);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ene=function(e){return $te.apply(this,arguments)};function tne(){return tne=c(o().mark((function e(t,n,r){var a,i,s,u,c,l,h,p,f,d,v,m,g;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(a=L5(t,"tensor","boolMask"),i=L5(n,"mask","boolMask","bool"),s=null==r?0:r,u=i.rank,c=a.shape,F$(u>0,(function(){return"mask cannot be scalar"})),D$(c.slice(s,s+u),i.shape,"mask's shape must match the first K dimensions of tensor's shape,"),l=1,h=s;h<s+u;h++)l*=c[h];return p=c.slice(0,s).concat([l],c.slice(s+u)),f=W8(a,p),d=W8(i,[-1]),e.next=14,ene(d);case 14:return v=e.sent,m=Ate(v,[1]),g=l9(f,m,s),t!==a&&a.dispose(),n!==i&&i.dispose(),m.dispose(),f.dispose(),d.dispose(),v.dispose(),e.abrupt("return",g);case 24:case"end":return e.stop()}}),e)}))),tne.apply(this,arguments)}var nne=function(e,t,n){return tne.apply(this,arguments)};var rne=B5({transpose_:function(e,t,n){var r=L5(e,"x","transpose");if(null==t&&(t=r.shape.map((function(e,t){return t})).reverse()),F$(r.rank===t.length,(function(){return"Error in transpose: rank of input ".concat(r.rank," ")+"must match length of perm ".concat(t,".")})),t.forEach((function(e){F$(e>=0&&e<r.rank,(function(){return"All entries in 'perm' must be between 0 and ".concat(r.rank-1)+" but got ".concat(t)}))})),r.rank<=1)return r.clone();var a={x:r},i={perm:t};return"complex64"===r.dtype?e8((function(){var e=ete(r),t=f9(r);return e=E5.runKernel(T3,{x:e},i),t=E5.runKernel(T3,{x:t},i),n&&(t=E9(t)),W5(e,t)})):E5.runKernel(T3,a,i)}});var ane=B5({movingAverage_:function(e,t,n,r){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=L5(e,"v","movingAverage"),o=L5(t,"x","movingAverage"),s=L5(n,"decay","movingAverage");m5(i,o),F$(P$(i.shape,o.shape),(function(){return"Shape mismatch in v and x"}));var u=Z7(1),c=R9(u,s),l=c8(R9(o,i),c);if(a){F$(null!=r,(function(){return"When using zeroDebias: true, step is required."}));var h=L5(r,"step","movingAverage");l=u8(l,R9(u,J7(s,h)))}return o8(i,l)}});var ine=B5({scatterND_:function(e,t,n){p0(n);var r=L5(e,"indices","scatterND","int32"),a=L5(t,"updates","scatterND");Vte(a,r,n);var i={indices:r,updates:a},o={shape:n};return E5.runKernel(q2,i,o)}});function one(e,t,n,r){if("int32"!==e.dtype)throw new Error("tf.sparseToDense() expects the indices to be int32 type,"+" but the dtype was ".concat(e.dtype,"."));if(e.rank>2)throw new Error("sparseIndices should be a scalar, vector, or matrix,"+" but got shape ".concat(e.shape,"."));var a=e.rank>0?e.shape[0]:1,i=e.rank>1?e.shape[1]:1;if(n.length!==i)throw new Error("outputShape has incorrect number of elements:,"+" ".concat(n.length,", should be: ").concat(i,"."));var o=t.size;if(0!==t.rank&&(1!==t.rank||o!==a))throw new Error("sparseValues has incorrect shape "+"".concat(t.shape,", should be [] or [").concat(a,"]"));if(t.dtype!==r.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}var sne=B5({sparseToDense_:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;p0(n);var a=L5(e,"sparseIndices","sparseToDense","int32"),i=L5(t,"sparseValues","sparseToDense","string_or_numeric"),o=L5(r,"defaultValue","sparseToDense",i.dtype);one(a,i,n,o);var s={sparseIndices:a,sparseValues:i,defaultValue:o},u={outputShape:n};return E5.runKernel(p3,s,u)}});var une=B5({gatherND_:function(e,t){var n=L5(t,"indices","gatherND","int32"),r={params:L5(e,"x","gatherND","string_or_numeric"),indices:n};return E5.runKernel(z1,r)}});var cne=B5({dropout_:function(e,t,n,r){var a=L5(e,"x","dropout");if(F$("float32"===a.dtype,(function(){return"x has to be a floating point tensor since it's going to be "+"scaled, but got a ".concat(a.dtype," tensor instead.")})),F$(t>=0&&t<1,(function(){return"rate must be a float in the range [0, 1), but got ".concat(t,".")})),0===t)return e instanceof n5?a.clone():a;var i=function(e,t){if(null==t)return e.shape.slice();if(P$(e.shape,t))return t;if(e.shape.length===t.length){for(var n=[],r=0;r<e.shape.length;r++)null==t[r]&&null!=e.shape[r]?n.push(e.shape[r]):n.push(t[r]);return n}return t}(a,n),o=1-t,s=u8(c9(o8(Zee(i,0,1,"float32",r),o)),o);return c8(a,s)}});function lne(e){return Math.floor(Math.pow(2,Math.ceil(Math.log(e)/Math.log(2))))}function hne(e,t,n){for(var r=1-e%2,a=new Float32Array(e),i=0;i<e;++i){var o=2*Math.PI*i/(e+r-1);a[i]=t-n*Math.cos(o)}return Dte(a,"float32")}function pne(){return pne=c(o().mark((function e(t,n){var r,a,i,s,u,c,l,h,p,f,d,v,m,g,y,b=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=b.length>2&&void 0!==b[2]?b[2]:1,a=L5(t,"predictions","inTopK"),i=L5(n,"targets","inTopK"),F$(a.rank>1,(function(){return"inTopK() expects the predictions to be of rank 2 or higher, "+"but got ".concat(a.rank)})),F$(a.rank-1===i.rank,(function(){return"predictions rank should be 1 larger than targets rank, but got predictions rank "+"".concat(a.rank," and targets rank ").concat(i.rank)})),D$(a.shape.slice(0,a.shape.length-1),i.shape,"predictions's shape should be align with the targets' shape, except the last dimension."),s=a.shape[a.shape.length-1],F$(r>0&&r<=s,(function(){return"'k' passed to inTopK() must be > 0 && <= the predictions last "+"dimension (".concat(s,"), but got ").concat(r)})),e.next=10,a.data();case 10:return u=e.sent,e.next=13,i.data();case 13:c=e.sent,l=u.length/s,h=s,p=q$("bool",l),f=0;case 17:if(!(f<l)){e.next=35;break}for(d=f*h,v=u.subarray(d,d+h),m=[],g=0;g<v.length;g++)m.push({value:v[g],index:g});m.sort((function(e,t){return t.value-e.value})),p[f]=0,y=0;case 25:if(!(y<r)){e.next=32;break}if(m[y].index!==c[f]){e.next=29;break}return p[f]=1,e.abrupt("break",32);case 29:y++,e.next=25;break;case 32:f++,e.next=17;break;case 35:return t!==a&&a.dispose(),n!==i&&i.dispose(),e.abrupt("return",U5(p,i.shape,"bool"));case 38:case"end":return e.stop()}}),e)}))),pne.apply(this,arguments)}var fne=function(e,t){return pne.apply(this,arguments)};var dne=B5({conv2DBackpropFilter_:function(e,t,n,r,a){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"NHWC",o=arguments.length>6?arguments[6]:void 0,s=e;3===e.rank&&(s=W8(e,[1,e.shape[0],e.shape[1],e.shape[2]]));var u=t;3===u.rank&&(u=W8(t,[1,t.shape[0],t.shape[1],t.shape[2]])),F$(4===s.rank,(function(){return"Error in conv2dDerFilter: input must be rank 4, but got shape "+"".concat(s.shape,".")})),F$(4===u.rank,(function(){return"Error in conv2dDerFilter: dy must be rank 4, but got shape "+"".concat(u.shape,".")})),F$(4===n.length,(function(){return"Error in conv2dDerFilter: filterShape must be length 4, but got "+"".concat(n,".")}));var c="NHWC"===i?s.shape[3]:s.shape[1],l="NHWC"===i?u.shape[3]:u.shape[1];F$(c===n[2],(function(){return"Error in conv2dDerFilter: depth of input ".concat(c,") must ")+"match input depth in filter (".concat(n[2],".")})),F$(l===n[3],(function(){return"Error in conv2dDerFilter: depth of dy (".concat(l,") must ")+"match output depth for filter (".concat(n[3],").")})),B8("conv2dDerFilter",a,o);var h={x:s,dy:u},p={strides:r,pad:a,dataFormat:i,dimRoundingMode:o,filterShape:n};return E5.runKernel(t1,h,p)}});function vne(e,t,n){if(null==n||"linear"===n)return e;if("relu"===n)return c8(e,_te(t));throw new Error("Cannot compute gradient for fused activation ".concat(n,"."))}function mne(e,t){var n=t,r=C7(e.shape,t.shape);return r.length>0&&(n=e9(n,r)),W8(n,e.shape)}function gne(e,t,n,r){if("linear"===t)return e;if("relu"===t)return nte(e);if("elu"===t)return z7(e);if("relu6"===t)return rte(e);if("prelu"===t)return hee(e,n);if("leakyrelu"===t)return g9(e,r);if("sigmoid"===t)return H8(e);throw new Error("Unknown fused activation ".concat(t,"."))}var yne=function(e,t){return!(e>0)||"linear"===t};var bne=B5({fusedConv2d_:function(e){var t=e.x,n=e.filter,r=e.strides,a=e.pad,i=e.dataFormat,o=void 0===i?"NHWC":i,s=e.dilations,u=void 0===s?[1,1]:s,c=e.dimRoundingMode,l=e.bias,h=e.activation,p=void 0===h?"linear":h,f=e.preluActivationWeights,d=e.leakyreluAlpha;if(p=p||"linear",!1===yne(E5.state.gradientDepth,p)){F$("NHWC"===o,(function(){return"Error in fused conv2d: got dataFormat of ".concat(o," but ")+"only NHWC is currently supported for the case of gradient depth is 0 and the activation is not linear."}));var v=h7(t,n,r,a,o,u,c);return null!=l&&(v=o8(v,l)),gne(v,p,f,d)}var m=L5(t,"x","conv2d","float32"),g=L5(n,"filter","conv2d","float32"),y=m,b=!1;3===m.rank&&(b=!0,y=W8(m,[1,m.shape[0],m.shape[1],m.shape[2]])),F$(4===y.rank,(function(){return"Error in fused conv2d: input must be rank 4, but got rank "+"".concat(y.rank,".")})),F$(4===g.rank,(function(){return"Error in fused conv2d: filter must be rank 4, but got rank "+"".concat(g.rank,".")})),B8("fused conv2d",a,c);var x="NHWC"===o?y.shape[3]:y.shape[1];F$(g.shape[2]===x,(function(){return"Error in conv2d: depth of input (".concat(x,") must match ")+"input depth for filter ".concat(g.shape[2],".")})),F$(L8(r,u),(function(){return"Error in conv2D: Either strides or dilations must be 1. "+"Got strides ".concat(r," and dilations '").concat(u,"'")}));var k,w,I=T8(y.shape,g.shape,r,u,a,c);if(null!=l){var N=S(v5(k=L5(l,"bias","fused conv2d"),m),1);k=N[0],"NHWC"===o?A7(I.outShape,k.shape):(F$(k.shape.length<=1,(function(){return"Error in fused conv2d: only supports scalar or 1-D Tensor bias for NCHW format but got the bias of "+"rank-".concat(k.shape.length,".")})),F$(0===k.shape.length||k.shape[0]===I.outChannels||1===k.shape[0],(function(){return"Error in fused conv2d: bias shape (".concat(k.shape,") is not ")+"compatible with the number of output channels "+"(".concat(I.outChannels,")")})))}if(null!=f){var T=f.shape;if(F$(T.length<=1||3===T.length,(function(){return"Error in fused conv2d: only supports scalar, 1-D Tensor or 3-D Tensor PReLU activation weights but got a tensor of "+"rank-".concat(T.length,".")})),1===T.length)F$(1===T[0]||T[0]===I.outChannels,(function(){return"Error in fused conv2d: PReLU activation weights "+"(".concat(T,") is not compatible with the number of output ")+"channels (".concat(I.outChannels,").")}));else if(3===T.length)try{A7(T,I.outShape)}catch(e){var E="Error in fused conv2d: PReLU activation weights (".concat(T,") ")+"is not compatible with the output shape of the conv2d "+"(".concat(I.outShape,").");throw Error(E)}w=L5(f,"prelu weights","fused conv2d")}var C=function(e,t){F$("NHWC"===o,(function(){return"Error in gradient of fused conv2D: got dataFormat of ".concat(o," but only NHWC is currently supported.")}));var n=S(t,4),i=n[0],s=n[1],c=n[2],l=n[3],h=vne(e,c,p);F$(M8(u),(function(){return"Error in gradient of fused conv2D: dilation rates greater than 1 "+"are not yet supported in gradients. Got dilations '".concat(u,"'")}));var f=[f7(s.shape,h,i,r,a),dne(s,h,i.shape,r,a)];if(null!=l){var d=mne(l,h);f.push(d)}return f},A={x:y,filter:g,bias:k,preluActivationWeights:w},R={strides:r,pad:a,dataFormat:o,dilations:u,dimRoundingMode:c,activation:p,leakyreluAlpha:d};if(null==l){var _=S9((function(e,t,n){var r=E5.runKernel(M3,A,R);return n([t,e,r]),b&&(r=W8(r,[r.shape[1],r.shape[2],r.shape[3]])),{value:r,gradFunc:C}}));return _(y,g)}var O=S9((function(e,t,n,r){var a=E5.runKernel(M3,A,R);return r([t,e,a,n]),b&&(a=W8(a,[a.shape[1],a.shape[2],a.shape[3]])),{value:a,gradFunc:C}}));return O(y,g,k)}});var xne=B5({depthwiseConv2dNativeBackpropFilter_:function(e,t,n,r,a){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[1,1],o=arguments.length>6?arguments[6]:void 0,s=e;3===e.rank&&(s=W8(e,[1,e.shape[0],e.shape[1],e.shape[2]]));var u=t;3===u.rank&&(u=W8(t,[1,t.shape[0],t.shape[1],t.shape[2]]));var c={x:s,dy:u},l={strides:r,pad:a,dimRoundingMode:o,dilations:i,filterShape:n};return E5.runKernel(d1,c,l)}});var kne=B5({depthwiseConv2dNativeBackpropInput_:function(e,t,n,r,a){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[1,1],o=arguments.length>6?arguments[6]:void 0,s=t,u=!1;3===t.rank&&(u=!0,s=W8(t,[1,t.shape[0],t.shape[1],t.shape[2]]));var c={dy:s,filter:n},l={strides:r,pad:a,dimRoundingMode:o,dilations:i,inputShape:e},h=E5.runKernel(v1,c,l);return u?W8(h,[h.shape[1],h.shape[2],h.shape[3]]):h}});var wne=B5({fusedDepthwiseConv2d_:function(e){var t=e.x,n=e.filter,r=e.strides,a=e.pad,i=e.dataFormat,o=void 0===i?"NHWC":i,s=e.dilations,u=void 0===s?[1,1]:s,c=e.dimRoundingMode,l=e.bias,h=e.activation,p=void 0===h?"linear":h,f=e.preluActivationWeights,d=e.leakyreluAlpha;if(!1===yne(E5.state.gradientDepth,p)){var v=N7(t,n,r,a,o,u,c);return null!=l&&(v=o8(v,l)),gne(v,p,f,d)}var m=L5(t,"x","depthwiseConv2d","float32"),g=L5(n,"filter","depthwiseConv2d","float32"),y=m,b=!1;3===m.rank&&(b=!0,y=W8(m,[1,m.shape[0],m.shape[1],m.shape[2]])),F$(4===y.rank,(function(){return"Error in fused depthwiseConv2d: input must be rank 4, but got "+"rank ".concat(y.rank,".")})),F$(4===g.rank,(function(){return"Error in fused depthwiseConv2d: filter must be rank 4, "+"but got rank ".concat(g.rank,".")})),F$(y.shape[3]===g.shape[2],(function(){return"Error in fused depthwiseConv2d: number of input channels "+"(".concat(y.shape[3],") must match the inChannels dimension in ")+"filter ".concat(g.shape[2],".")})),null==u&&(u=[1,1]),F$(L8(r,u),(function(){return"Error in fused depthwiseConv2d: Either strides or dilations must "+"be 1. Got strides ".concat(r," and dilations '").concat(u,"'")})),B8("fused depthwiseConv2d",a,c);var x,k,w=T8(y.shape,g.shape,r,u,a,c,!0);if(null!=l){var I=S(v5(x=L5(l,"bias","fused conv2d"),m),1);x=I[0],A7(w.outShape,x.shape)}null!=f&&(k=L5(f,"prelu weights","fused depthwiseConv2d"));var N=function(e,t){F$(M8(u),(function(){return"Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations "+"'".concat(u,"'")}));var n=S(t,4),i=n[0],o=n[1],s=n[2],l=n[3],h=vne(e,s,p),f=kne(o.shape,h,i,r,a,u,c),d=xne(o,h,i.shape,r,a,u,c);return null!=l?[f,d,mne(x,h)]:[f,d]},T={x:y,filter:g,bias:x,preluActivationWeights:k},E={strides:r,pad:a,dataFormat:o,dilations:u,dimRoundingMode:c,activation:p,leakyreluAlpha:d};if(null==l){var C=S9((function(e,t,n){var r=E5.runKernel(L3,T,E);return n([t,e,r]),b&&(r=W8(r,[r.shape[1],r.shape[2],r.shape[3]])),{value:r,gradFunc:N}}));return C(y,g)}var A=S9((function(e,t,n,r){var a=E5.runKernel(L3,T,E);return r([t,e,a,n]),b&&(a=W8(a,[a.shape[1],a.shape[2],a.shape[3]])),{value:a,gradFunc:N}}));return A(y,g,x)}});var Ine=B5({fusedMatMul_:function(e){var t=e.a,n=e.b,r=e.transposeA,a=void 0!==r&&r,i=e.transposeB,o=void 0!==i&&i,s=e.bias,u=e.activation,c=void 0===u?"linear":u,l=e.preluActivationWeights,h=e.leakyreluAlpha,p=void 0===h?.2:h;if(!1===yne(E5.state.gradientDepth,c)){var f=j8(t,n,a,o);return null!=s&&(f=o8(f,s)),gne(f,c,l,p)}var d=L5(t,"a","fused matMul"),v=L5(n,"b","fused matMul"),m=S(v5(d,v),2);d=m[0],v=m[1];var g=a?d.shape[d.rank-2]:d.shape[d.rank-1],y=o?v.shape[v.rank-1]:v.shape[v.rank-2],b=a?d.shape[d.rank-1]:d.shape[d.rank-2],x=o?v.shape[v.rank-2]:v.shape[v.rank-1],k=d.shape.slice(0,-2),w=v.shape.slice(0,-2),I=L$(k),N=L$(w);F$(g===y,(function(){return"Error in fused matMul: inner shapes (".concat(g,") and (")+"".concat(y,") of Tensors with shapes ").concat(d.shape," and ")+"".concat(v.shape," and transposeA=").concat(a)+" and transposeB=".concat(o," must match.")}));var T,E,C=A7(d.shape.slice(0,-2),v.shape.slice(0,-2)).concat([b,x]),A=W8(d,a?[I,g,b]:[I,b,g]),R=W8(v,o?[N,x,y]:[N,y,x]);null!=s&&(T=S(v5(T=L5(s,"bias","fused matMul"),d),1)[0],A7(C,T.shape)),null!=l&&(E=L5(l,"prelu weights","fused matMul"));var _=function(e,t){var n,r,i=S(t,4),u=i[0],l=i[1],h=i[2],p=i[3],f=vne(W8(e,h.shape),h,c);return a||o?!a&&o?(n=j8(f,l,!1,!1),r=j8(f,u,!0,!1)):a&&!o?(n=j8(l,f,!1,!0),r=j8(u,f,!1,!1)):(n=j8(l,f,!0,!0),r=j8(f,u,!0,!0)):(n=j8(f,l,!1,!0),r=j8(u,f,!0,!1)),null!=s?[n,r,mne(p,f)]:[n,r]},O={a:A,b:R,bias:T,preluActivationWeights:E},F={transposeA:a,transposeB:o,activation:c,leakyreluAlpha:p};if(null==s){var D=S9((function(e,t,n){var r=E5.runKernel(D3,O,F);return n([e,t,r]),{value:W8(r,C),gradFunc:_}}));return D(A,R)}var M=S9((function(e,t,n,r){var a=E5.runKernel(D3,O,F);return r([e,t,a,n]),{value:W8(a,C),gradFunc:_}}));return M(A,R,T)}}),Nne={__proto__:null,conv2d:bne,depthwiseConv2d:wne,matMul:Ine};var Sne=B5({hammingWindow_:function(e){return hne(e,.54,.46)}});var Tne=B5({hannWindow_:function(e){return hne(e,.5,.5)}});var Ene=B5({frame_:function(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=0,o=[];i+t<=e.size;)o.push(q8(e,i,t)),i+=n;if(r)for(;i<e.size;){var s=i+t-e.size,u=G8([q8(e,i,t-s),i7([s],a)]);o.push(u),i+=n}return 0===o.length?Mte([],[0,t]):W8(G8(o),[o.length,t])}});var Cne=B5({stft_:function(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Tne;null==r&&(r=lne(t));var i=Ene(e,t,n),o=c8(i,a(t));return Ete(o,r)}});var Ane=B5({cropAndResize_:function(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"bilinear",i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=L5(e,"image","cropAndResize"),s=L5(t,"boxes","cropAndResize","float32"),u=L5(n,"boxInd","cropAndResize","int32"),c=s.shape[0];F$(4===o.rank,(function(){return"Error in cropAndResize: image must be rank 4,"+"but got rank ".concat(o.rank,".")})),F$(2===s.rank&&4===s.shape[1],(function(){return"Error in cropAndResize: boxes must be have size [".concat(c,",4] ")+"but had shape ".concat(s.shape,".")})),F$(1===u.rank&&u.shape[0]===c,(function(){return"Error in cropAndResize: boxInd must be have size [".concat(c,"] ")+"but had shape ".concat(s.shape,".")})),F$(2===r.length,(function(){return"Error in cropAndResize: cropSize must be of length 2, but got "+"length ".concat(r.length,".")})),F$(r[0]>=1&&r[1]>=1,(function(){return"cropSize must be atleast [1,1], but was ".concat(r)})),F$("bilinear"===a||"nearest"===a,(function(){return"method must be bilinear or nearest, but was ".concat(a)}));var l={image:o,boxes:s,boxInd:u},h={method:a,extrapolationValue:i,cropSize:r},p=E5.runKernel(l1,l,h);return p}});var Rne=B5({flipLeftRight_:function(e){var t=L5(e,"image","flipLeftRight","float32");F$(4===t.rank,(function(){return"Error in flipLeftRight: image must be rank 4,"+"but got rank ".concat(t.rank,".")}));var n={image:t};return E5.runKernel(O1,n,{})}});var _ne=B5({grayscaleToRGB_:function(e){var t=L5(e,"image","grayscaleToRGB"),n=t.rank-1,r=t.shape[n];F$(t.rank>=2,(function(){return"Error in grayscaleToRGB: images must be at least rank 2, "+"but got rank ".concat(t.rank,".")})),F$(1===r,(function(){return"Error in grayscaleToRGB: last dimension of a grayscale image "+"should be size 1, but got size ".concat(r,".")}));var a=new Array(t.rank);return a.fill(1,0,n),a[n]=3,s9(t,a)}});var One=B5({rotateWithOffset_:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,a=L5(e,"image","rotateWithOffset","float32");F$(4===a.rank,(function(){return"Error in rotateWithOffset: image must be rank 4,"+"but got rank ".concat(a.rank,".")}));var i={image:a},o={radians:t,fillValue:n,center:r},s=E5.runKernel(F3,i,o);return s}});function Fne(e,t,n,r,a,i){null==r&&(r=.5),null==a&&(a=Number.NEGATIVE_INFINITY),null==i&&(i=0);var o=e.shape[0];return n=Math.min(n,o),F$(0<=r&&r<=1,(function(){return"iouThreshold must be in [0, 1], but was '".concat(r,"'")})),F$(2===e.rank,(function(){return"boxes must be a 2D tensor, but was of rank '".concat(e.rank,"'")})),F$(4===e.shape[1],(function(){return"boxes must have 4 columns, but 2nd dimension was ".concat(e.shape[1])})),F$(1===t.rank,(function(){return"scores must be a 1D tensor"})),F$(t.shape[0]===o,(function(){return"scores has incompatible shape with boxes. Expected ".concat(o,", ")+"but was ".concat(t.shape[0])})),F$(0<=i&&i<=1,(function(){return"softNmsSigma must be in [0, 1], but was '".concat(i,"'")})),{maxOutputSize:n,iouThreshold:r,scoreThreshold:a,softNmsSigma:i}}var Dne=B5({nonMaxSuppression_:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Number.NEGATIVE_INFINITY,i=L5(e,"boxes","nonMaxSuppression","float32"),o=L5(t,"scores","nonMaxSuppression","float32"),s=Fne(i,o,n,r,a),u={maxOutputSize:n=s.maxOutputSize,iouThreshold:r=s.iouThreshold,scoreThreshold:a=s.scoreThreshold};return E5.runKernel(x2,{boxes:i,scores:o},u)}});function Mne(e,t,n){var r=function(e,t,n){return function(e,t,n){var r=0,a=e.length,i=0,o=!1;for(;r<a;){var s=n(t,e[i=r+(a-r>>>1)]);s>0?r=i+1:(a=i,o=!s)}return o?r:-r-1}(e,t,n||Lne)}(e,t,n),a=r<0?-(r+1):r;e.splice(a,0,t)}function Lne(e,t){return e>t?1:e<t?-1:0}function zne(e,t,n,r,a){return Wne(e,t,n,r,a,0)}function Pne(e,t,n,r,a,i){return Wne(e,t,n,r,a,0,!1,i,!0)}function Bne(e,t,n,r,a,i){return Wne(e,t,n,r,a,i,!0)}function Wne(e,t,n,r,a,i){for(var o=arguments.length>6&&void 0!==arguments[6]&&arguments[6],s=arguments.length>7&&void 0!==arguments[7]&&arguments[7],u=arguments.length>8&&void 0!==arguments[8]&&arguments[8],c=[],l=0;l<t.length;l++)t[l]>a&&c.push({score:t[l],boxIndex:l,suppressBeginIndex:0});c.sort(Gne);for(var h=i>0?-.5/i:0,p=[],f=[];p.length<n&&c.length>0;){var d=c.pop(),v=d.score,m=d.boxIndex,g=d.suppressBeginIndex;if(v<a)break;for(var y=!1,b=p.length-1;b>=g;--b){var x=Vne(e,m,p[b]);if(x>=r){y=!0;break}if(d.score=d.score*Une(r,h,x),d.score<=a)break}d.suppressBeginIndex=p.length,y||(d.score===v?(p.push(m),f.push(d.score)):d.score>a&&Mne(c,d,Gne))}var k=p.length,w=n-k;s&&w>0&&(p.push.apply(p,T(new Array(w).fill(0))),f.push.apply(f,T(new Array(w).fill(0))));var I={selectedIndices:p};return o&&(I.selectedScores=f),u&&(I.validOutputs=k),I}function Vne(e,t,n){var r=e.subarray(4*t,4*t+4),a=e.subarray(4*n,4*n+4),i=Math.min(r[0],r[2]),o=Math.min(r[1],r[3]),s=Math.max(r[0],r[2]),u=Math.max(r[1],r[3]),c=Math.min(a[0],a[2]),l=Math.min(a[1],a[3]),h=Math.max(a[0],a[2]),p=Math.max(a[1],a[3]),f=(s-i)*(u-o),d=(h-c)*(p-l);if(f<=0||d<=0)return 0;var v=Math.max(i,c),m=Math.max(o,l),g=Math.min(s,h),y=Math.min(u,p),b=Math.max(g-v,0)*Math.max(y-m,0);return b/(f+d-b)}function Une(e,t,n){var r=Math.exp(t*n*n);return n<=e?r:0}function Gne(e,t){return e.score-t.score||e.score===t.score&&t.boxIndex-e.boxIndex}function jne(){return jne=c(o().mark((function e(t,n,r){var a,i,s,u,c,l,h,p,f,d,v=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=v.length>3&&void 0!==v[3]?v[3]:.5,i=v.length>4&&void 0!==v[4]?v[4]:Number.NEGATIVE_INFINITY,s=L5(t,"boxes","nonMaxSuppressionAsync"),u=L5(n,"scores","nonMaxSuppressionAsync"),c=Fne(s,u,r,a,i),r=c.maxOutputSize,a=c.iouThreshold,i=c.scoreThreshold,e.next=10,Promise.all([s.data(),u.data()]);case 10:return l=e.sent,h=l[0],p=l[1],f=zne(h,p,r,a,i),d=f.selectedIndices,s!==t&&s.dispose(),u!==n&&u.dispose(),e.abrupt("return",Dte(d,"int32"));case 17:case"end":return e.stop()}}),e)}))),jne.apply(this,arguments)}var Hne=function(e,t,n){return jne.apply(this,arguments)};var qne=B5({nonMaxSuppressionWithScore_:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Number.NEGATIVE_INFINITY,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=L5(e,"boxes","nonMaxSuppression"),s=L5(t,"scores","nonMaxSuppression"),u=Fne(o,s,n,r,a,i),c={boxes:o,scores:s},l={maxOutputSize:n=u.maxOutputSize,iouThreshold:r=u.iouThreshold,scoreThreshold:a=u.scoreThreshold,softNmsSigma:i=u.softNmsSigma},h=E5.runKernel(w2,c,l);return{selectedIndices:h[0],selectedScores:h[1]}}});function Kne(){return Kne=c(o().mark((function e(t,n,r){var a,i,s,u,c,l,h,p,f,d,v,m,g=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=g.length>3&&void 0!==g[3]?g[3]:.5,i=g.length>4&&void 0!==g[4]?g[4]:Number.NEGATIVE_INFINITY,s=g.length>5&&void 0!==g[5]?g[5]:0,u=L5(t,"boxes","nonMaxSuppressionAsync"),c=L5(n,"scores","nonMaxSuppressionAsync"),l=Fne(u,c,r,a,i,s),r=l.maxOutputSize,a=l.iouThreshold,i=l.scoreThreshold,s=l.softNmsSigma,e.next=12,Promise.all([u.data(),c.data()]);case 12:return h=e.sent,p=h[0],f=h[1],d=Bne(p,f,r,a,i,s),v=d.selectedIndices,m=d.selectedScores,u!==t&&u.dispose(),c!==n&&c.dispose(),e.abrupt("return",{selectedIndices:Dte(v,"int32"),selectedScores:Dte(m)});case 19:case"end":return e.stop()}}),e)}))),Kne.apply(this,arguments)}var Xne=function(e,t,n){return Kne.apply(this,arguments)};var Yne=B5({nonMaxSuppressionPadded_:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Number.NEGATIVE_INFINITY,i=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=L5(e,"boxes","nonMaxSuppression"),s=L5(t,"scores","nonMaxSuppression"),u=Fne(o,s,n,r,a,null),c=u.maxOutputSize,l=u.iouThreshold,h=u.scoreThreshold,p={boxes:o,scores:s},f={maxOutputSize:c,iouThreshold:l,scoreThreshold:h,padToMaxOutputSize:i},d=E5.runKernel(k2,p,f);return{selectedIndices:d[0],validOutputs:d[1]}}});function Jne(){return Jne=c(o().mark((function e(t,n,r){var a,i,s,u,c,l,h,p,f,d,v,m,g,y,b,x,k=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=k.length>3&&void 0!==k[3]?k[3]:.5,i=k.length>4&&void 0!==k[4]?k[4]:Number.NEGATIVE_INFINITY,s=k.length>5&&void 0!==k[5]&&k[5],u=L5(t,"boxes","nonMaxSuppressionAsync"),c=L5(n,"scores","nonMaxSuppressionAsync"),l=Fne(u,c,r,a,i,null),h=l.maxOutputSize,p=l.iouThreshold,f=l.scoreThreshold,e.next=11,Promise.all([u.data(),c.data()]);case 11:return d=e.sent,v=S(d,2),m=v[0],g=v[1],y=Pne(m,g,h,p,f,s),b=y.selectedIndices,x=y.validOutputs,u!==t&&u.dispose(),c!==n&&c.dispose(),e.abrupt("return",{selectedIndices:Dte(b,"int32"),validOutputs:Z7(x,"int32")});case 19:case"end":return e.stop()}}),e)}))),Jne.apply(this,arguments)}var Zne=function(e,t,n){return Jne.apply(this,arguments)};var Qne=B5({resizeBilinear_:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=L5(e,"images","resizeBilinear");F$(3===a.rank||4===a.rank,(function(){return"Error in resizeBilinear: x must be rank 3 or 4, but got "+"rank ".concat(a.rank,".")})),F$(2===t.length,(function(){return"Error in resizeBilinear: new shape must 2D, but got shape "+"".concat(t,".")})),F$(!1===r||!1===n,(function(){return"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false."}));var i=a,o=!1;3===a.rank&&(o=!0,i=W8(a,[1,a.shape[0],a.shape[1],a.shape[2]])),S(t,0);var s={images:i},u={alignCorners:n,halfPixelCenters:r,size:t},c=E5.runKernel(W2,s,u);return o?W8(c,[c.shape[1],c.shape[2],c.shape[3]]):c}});var $ne=B5({resizeNearestNeighbor_:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=L5(e,"images","resizeNearestNeighbor");F$(3===a.rank||4===a.rank,(function(){return"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got "+"rank ".concat(a.rank,".")})),F$(2===t.length,(function(){return"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+"".concat(t,".")})),F$("float32"===a.dtype||"int32"===a.dtype,(function(){return"`images` must have `int32` or `float32` as dtype"})),F$(!1===r||!1===n,(function(){return"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false."}));var i=a,o=!1;3===a.rank&&(o=!0,i=W8(a,[1,a.shape[0],a.shape[1],a.shape[2]])),S(t,0);var s={images:i},u={alignCorners:n,halfPixelCenters:r,size:t},c=E5.runKernel(P2,s,u);return o?W8(c,[c.shape[1],c.shape[2],c.shape[3]]):c}});function ere(e,t){for(var n,r,a,i,o,s,u=Dte([-1]),c=Dte([0]),l=Dte([0]),h=0;h<e.size-1;h++){n=q8(e,0,h+1),r=q8(e,h+1),o=u8(e9(n),t),s=u8(e9(r),t);var p=e9(c8(n,$ee(0,n.size)));a=u8(p,e9(n));var f=i7(r.shape,n.size),d=o8($ee(0,r.size),f),v=c8(r,d);i=u8(e9(v),e9(r));var m=R9(a,i),g=R9(a,i),y=c8(o,s);l=c8(c8(y,m),g);var b=h9(l,c);c=O7(b,l,c),u=O7(b,Dte([h]),u)}return u}var tre=B5({threshold_:function(e){var t,n,r,a,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"binary",o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,u=L5(e,"image","threshold"),c=.2989,l=.587,h=.114,p=u.shape[0]*u.shape[1],f=c8(Dte([s]),255);if(F$(3===u.rank,(function(){return"Error in threshold: image must be rank 3,"+"but got rank ".concat(u.rank,".")})),F$(3===u.shape[2]||1===u.shape[2],(function(){return"Error in threshold: image color channel must be equal to 3 or 1"+"but got ".concat(u.shape[2],".")})),F$("int32"===u.dtype||"float32"===u.dtype,(function(){return"Error in dtype: image dtype must be int32 or float32,"+"but got dtype ".concat(u.dtype,".")})),F$("otsu"===i||"binary"===i,(function(){return"Method must be binary or otsu, but was ".concat(i)})),3===u.shape[2]){var d=Tte(u,[1,1,1],-1),v=S(d,3);t=v[0],n=v[1],r=v[2];var m=c8(t,c),g=c8(n,l),y=c8(r,h);a=o8(o8(m,g),y)}else a=e;if("otsu"===i){var b=e7(X6(cte(a),"int32"),U5([]),256);f=ere(b,p)}var x=o?b9(a,f):h9(a,f),k=X6(c8(x,255),"int32");return k}});var nre=B5({transform_:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"nearest",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"constant",a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=arguments.length>5?arguments[5]:void 0,o=L5(e,"image","transform","float32"),s=L5(t,"transforms","transform","float32");F$(4===o.rank,(function(){return"Error in transform: image must be rank 4,"+"but got rank ".concat(o.rank,".")})),F$(2===s.rank&&(s.shape[0]===o.shape[0]||1===s.shape[0])&&8===s.shape[1],(function(){return"Error in transform: Input transform should be batch x 8 or 1 x 8"})),F$(null==i||2===i.length,(function(){return"Error in transform: outputShape must be [height, width] or null, "+"but got ".concat(i,".")}));var u={image:o,transforms:s},c={interpolation:n,fillMode:r,fillValue:a,outputShape:i};return E5.runKernel(S3,u,c)}});var rre=B5({bandPart_:function(e,t,n){var r=L5(e,"a","bandPart");F$(r.rank>=2,(function(){return"bandPart(): Rank must be at least 2, got ".concat(r.rank,".")}));var a,i,o=r.shape,s=S(r.shape.slice(-2),2),u=s[0],c=s[1];"number"==typeof t?(F$(t%1==0,(function(){return"bandPart(): numLower must be an integer, got ".concat(t,".")})),F$(t<=u,(function(){return"bandPart(): numLower (".concat(t,")")+" must not be greater than the number of rows (".concat(u,").")})),a=L5(t<0?u:t,"numLower","bandPart")):(F$("int32"===t.dtype,(function(){return"bandPart(): numLower's dtype must be an int32."})),a=O7(y9(t,0),u,X9(t,u))),"number"==typeof n?(F$(n%1==0,(function(){return"bandPart(): numUpper must be an integer, got ".concat(n,".")})),F$(n<=c,(function(){return"bandPart(): numUpper (".concat(n,")")+" must not be greater than the number of columns (".concat(c,").")})),i=L5(n<0?c:n,"numUpper","bandPart")):(F$("int32"===n.dtype,(function(){return"bandPart(): numUpper's dtype must be an int32."})),i=O7(y9(n,0),c,X9(n,c)));var l=W8($ee(0,u,1,"int32"),[-1,1]),h=$ee(0,c,1,"int32"),p=R9(l,h),f=F9(b9(p,a),p9(p,E9(i))),d=H9([u,c],r.dtype);return W8(Rte(Yte(W8(r,[-1,u,c])).map((function(e){return O7(f,e,d)}))),o)}});var are=B5({gramSchmidt_:function(e){var t;if(Array.isArray(e)){t=!1,F$(null!=e&&e.length>0,(function(){return"Gram-Schmidt process: input must not be null, undefined, or empty"}));for(var n=e[0].shape[0],r=function(t){F$(e[t].shape[0]===n,(function(){return"Gram-Schmidt: Non-unique lengths found in the input vectors: "+"(".concat(e[t].shape[0]," vs. ").concat(n,")")}))},a=1;a<e.length;++a)r(a)}else t=!0,e=Tte(e,e.shape[0],0).map((function(e){return Ate(e,[0])}));F$(e.length<=e[0].shape[0],(function(){return"Gram-Schmidt: Number of vectors (".concat(e.length,") exceeds ")+"number of dimensions (".concat(e[0].shape[0],").")}));for(var i=[],o=e,s=function(e){i.push(E5.tidy((function(){var t=o[e];if(e>0)for(var n=0;n<e;++n){var r=c8(e9(c8(i[n],t)),i[n]);t=R9(t,r)}return u8(t,n9(t,"euclidean"))})))},u=0;u<e.length;++u)s(u);return t?Rte(i,0):i}});function ire(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return E5.tidy((function(){F$(2===e.shape.length,(function(){return"qr2d() requires a 2D Tensor, but got a ".concat(e.shape.length,"D Tensor.")}));for(var n=e.shape[0],r=e.shape[1],a=u9(n),i=Y6(e),o=Mte([[1]],[1,1]),s=Y6(o),u=n>=r?r:n,c=function(e){var t=i,u=s,c=a,l=S(E5.tidy((function(){var t=q8(i,[e,e],[n-e,1]),u=n9(t),c=q8(i,[e,e],[1,1]),l=O7(h9(c,0),Mte([[-1]]),Mte([[1]])),h=R9(c,c8(l,u)),p=u8(t,h);s=1===p.shape[0]?Y6(o):G8([o,q8(p,[1,0],[p.shape[0]-1,p.shape[1]])],0);var f=E9(u8(j8(l,h),u)),d=q8(i,[e,0],[n-e,r]),v=c8(f,s),m=rne(s);if(0===e)i=R9(d,j8(v,j8(m,d)));else{var g=R9(d,j8(v,j8(m,d)));i=G8([q8(i,[0,0],[e,r]),g],0)}var y=rne(v),b=q8(a,[0,e],[n,a.shape[1]-e]);if(0===e)a=R9(b,j8(j8(b,s),y));else{var x=R9(b,j8(j8(b,s),y));a=G8([q8(a,[0,0],[n,e]),x],1)}return[s,i,a]})),3);s=l[0],i=l[1],a=l[2],t8([t,u,c])},l=0;l<u;++l)c(l);return!t&&n>r&&(a=q8(a,[0,0],[n,r]),i=q8(i,[0,0],[r,r])),[a,i]}))}var ore,sre=B5({qr_:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(F$(e.rank>=2,(function(){return"qr() requires input tensor to have a rank >= 2, but got rank ".concat(e.rank)})),2===e.rank)return ire(e,t);var n=e.shape.slice(0,e.shape.length-2).reduce((function(e,t){return e*t})),r=Yte(W8(e,[n,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0),a=[],i=[];r.forEach((function(e){var n=S(ire(e,t),2),r=n[0],o=n[1];a.push(r),i.push(o)}));var o=W8(Rte(a,0),e.shape),s=W8(Rte(i,0),e.shape);return[o,s]}});e.Reduction=void 0,(ore=e.Reduction||(e.Reduction={}))[ore.NONE=0]="NONE",ore[ore.MEAN=1]="MEAN",ore[ore.SUM=2]="SUM",ore[ore.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS";var ure=B5({computeWeightedLoss_:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.Reduction.SUM_BY_NONZERO_WEIGHTS,a=L5(t,"losses","computeWeightedLoss"),i=null;null!=n&&(i=L5(n,"weights","computeWeightedLoss"));var o=null==i?a:c8(a,i);if(r===e.Reduction.NONE)return o;if(r===e.Reduction.SUM)return e9(o);if(r===e.Reduction.MEAN){if(null==i)return j9(o);var s=a.size/i.size,u=u8(e9(o),e9(i));return s>1?u8(u,Z7(s)):u}if(r===e.Reduction.SUM_BY_NONZERO_WEIGHTS){if(null==i)return u8(e9(o),Z7(a.size));var c=c8(i,q9(a.shape)),l=X6(e9(eee(c,Z7(0))),"float32");return u8(e9(o),l)}throw Error("Unknown reduction: ".concat(r))}});var cre=B5({absoluteDifference_:function(t,n,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.Reduction.SUM_BY_NONZERO_WEIGHTS,i=L5(t,"labels","absoluteDifference"),o=L5(n,"predictions","absoluteDifference"),s=null;null!=r&&(s=L5(r,"weights","absoluteDifference")),D$(i.shape,o.shape,"Error in absoluteDifference: ");var u=l8(R9(i,o));return ure(u,s,a)}});var lre=B5({cosineDistance_:function(t,n,r,a){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e.Reduction.SUM_BY_NONZERO_WEIGHTS,o=L5(t,"labels","cosineDistance"),s=L5(n,"predictions","cosineDistance"),u=null;null!=a&&(u=L5(a,"weights","cosineDistance")),D$(o.shape,s.shape,"Error in cosineDistance: ");var c=Z7(1),l=R9(c,e9(c8(o,s),r,!0));return ure(l,u,i)}});var hre=B5({hingeLoss_:function(t,n,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.Reduction.SUM_BY_NONZERO_WEIGHTS,i=L5(t,"labels","hingeLoss"),o=L5(n,"predictions","hingeLoss"),s=null;null!=r&&(s=L5(r,"weights","hingeLoss")),D$(i.shape,o.shape,"Error in hingeLoss: ");var u=Z7(1);i=R9(c8(Z7(2),i),u);var c=nte(R9(u,c8(i,o)));return ure(c,s,a)}});var pre=B5({huberLoss_:function(t,n,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e.Reduction.SUM_BY_NONZERO_WEIGHTS,o=L5(t,"labels","huberLoss"),s=L5(n,"predictions","huberLoss"),u=null;null!=r&&(u=L5(r,"weights","huberLoss")),D$(o.shape,s.shape,"Error in huberLoss: ");var c=Z7(a),l=l8(R9(s,o)),h=X9(l,c),p=R9(l,h),f=o8(c8(Z7(.5),$7(h)),c8(c,p));return ure(f,u,i)}});var fre=B5({logLoss_:function(t,n,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e-7,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e.Reduction.SUM_BY_NONZERO_WEIGHTS,o=L5(t,"labels","logLoss"),s=L5(n,"predictions","logLoss"),u=null;null!=r&&(u=L5(r,"weights","logLoss")),D$(o.shape,s.shape,"Error in logLoss: ");var c=Z7(1),l=Z7(a),h=E9(c8(o,w9(o8(s,l)))),p=c8(R9(c,o),w9(o8(R9(c,s),l))),f=R9(h,p);return ure(f,u,i)}});var dre=B5({meanSquaredError_:function(t,n,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.Reduction.SUM_BY_NONZERO_WEIGHTS,i=L5(t,"labels","meanSquaredError"),o=L5(n,"predictions","meanSquaredError"),s=null;null!=r&&(s=L5(r,"weights","meanSquaredError")),D$(i.shape,o.shape,"Error in meanSquaredError: ");var u=Cte(i,o);return ure(u,s,a)}});function vre(e,t){var n=L5(e,"labels","sigmoidCrossEntropyWithLogits"),r=L5(t,"logits","sigmoidCrossEntropyWithLogits");D$(n.shape,r.shape,"Error in sigmoidCrossEntropyWithLogits: ");var a=nte(r),i=c8(r,n),o=I9(a9(E9(l8(r))));return o8(R9(a,i),o)}var mre=B5({sigmoidCrossEntropy_:function(t,n,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e.Reduction.SUM_BY_NONZERO_WEIGHTS,o=L5(t,"multiClassLabels","sigmoidCrossEntropy"),s=L5(n,"logits","sigmoidCrossEntropy"),u=null;if(null!=r&&(u=L5(r,"weights","sigmoidCrossEntropy")),D$(o.shape,s.shape,"Error in sigmoidCrossEntropy: "),a>0){var c=Z7(a),l=Z7(1),h=Z7(.5);o=o8(c8(o,R9(l,c)),c8(h,c))}var p=vre(o,s);return ure(p,u,i)}});function gre(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(-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 ".concat(t.rank," ")+"and dim was ".concat(n));var r=S9((function(e,t,r){var a=O9(t,[n],!0),i=R9(X6(t,"float32"),a);r([e,i]);var o=E9(c8(i,e));return{value:e9(o,[n]),gradFunc:function(e,t){var r=S(t,2),a=r[0],i=r[1],o=G7(e.shape,[n]);return[c8(W8(e,o),R9(X6(a,"float32"),a9(i))),c8(W8(e,o),R9(a9(i),X6(a,"float32")))]}}}));return r(e,t)}var yre=B5({softmaxCrossEntropy_:function(t,n,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e.Reduction.SUM_BY_NONZERO_WEIGHTS,o=L5(t,"onehotLabels","softmaxCrossEntropy"),s=L5(n,"logits","softmaxCrossEntropy"),u=null;if(null!=r&&(u=L5(r,"weights","softmaxCrossEntropy")),D$(o.shape,s.shape,"Error in softmaxCrossEntropy: "),a>0){var c=Z7(a),l=Z7(1),h=Z7(o.shape[1]);o=o8(c8(o,R9(l,c)),u8(c,h))}var p=gre(o,s);return ure(p,u,i)}});var bre=B5({sparseFillEmptyRows_:function(e,t,n,r){var a=L5(e,"indices","sparseFillEmptyRows","int32"),i=L5(t,"values","sparseFillEmptyRows"),o=L5(n,"denseShape","sparseFillEmptyRows","int32"),s=L5(r,"defaultValue","sparseFillEmptyRows",i.dtype);if(2!==a.rank)throw new Error("Indices should be Tensor2D but received shape\n ".concat(a.shape));if(1!==i.rank)throw new Error("Values should be Tensor1D but received shape ".concat(i.shape));if(1!==o.rank)throw new Error("Dense shape should be Tensor1D but received shape ".concat(o.shape));if(0!==s.rank)throw new Error("Default value should be a scalar but received shape ".concat(s.shape));var u={indices:a,values:i,denseShape:o,defaultValue:s},c=E5.runKernel(u3,u);return{outputIndices:c[0],outputValues:c[1],emptyRowIndicator:c[2],reverseIndexMap:c[3]}}});var xre=B5({sparseReshape_:function(e,t,n){var r=L5(e,"inputIndices","sparseReshape","int32"),a=L5(t,"inputShape","sparseReshape","int32"),i=L5(n,"newShape","sparseReshape","int32");if(2!==r.rank)throw new Error("Input indices should be Tensor2D but received shape\n ".concat(r.shape));if(1!==a.rank)throw new Error("Input shape should be Tensor1D but received shape ".concat(a.shape));if(1!==i.rank)throw new Error("New shape should be Tensor1D but received shape ".concat(i.shape));var o={inputIndices:r,inputShape:a,newShape:i},s=E5.runKernel(c3,o);return{outputIndices:s[0],outputShape:s[1]}}});var kre=B5({sparseSegmentMean_:function(e,t,n){var r=L5(e,"data","sparseSegmentMean"),a=L5(t,"indices","sparseSegmentMean","int32"),i=L5(n,"segmentIds","sparseSegmentMean","int32");if(r.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.rank)throw new Error("Indices should be Tensor1D but received shape\n ".concat(a.shape));if(1!==i.rank)throw new Error("Segment ids should be Tensor1D but received shape\n ".concat(i.shape));var o={data:r,indices:a,segmentIds:i};return E5.runKernel(l3,o)}});var wre=B5({sparseSegmentSum_:function(e,t,n){var r=L5(e,"data","sparseSegmentSum"),a=L5(t,"indices","sparseSegmentSum","int32"),i=L5(n,"segmentIds","sparseSegmentSum","int32");if(r.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.rank)throw new Error("Indices should be Tensor1D but received shape\n ".concat(a.shape));if(1!==i.rank)throw new Error("Segment ids should be Tensor1D but received shape\n ".concat(i.shape));var o={data:r,indices:a,segmentIds:i};return E5.runKernel(h3,o)}});var Ire=B5({stringNGrams_:function(e,t,n,r,a,i,o,s){var u=L5(e,"data","stringNGrams","string");if("string"!==u.dtype)throw new Error("Data must be of datatype string");if(1!==u.shape.length)throw new Error("Data must be a vector, saw: ".concat(u.shape));var c=L5(t,"dataSplits","stringNGrams");if("int32"!==c.dtype)throw new Error("Data splits must be of datatype int32");var l={separator:n,nGramWidths:r,leftPad:a,rightPad:i,padWidth:o,preserveShortSequences:s},h={data:u,dataSplits:c},p=E5.runKernel(g3,h,l);return{nGrams:p[0],nGramsSplits:p[1]}}});var Nre=B5({stringSplit_:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=L5(e,"input","stringSplit","string"),a=L5(t,"delimiter","stringSplit","string");if(1!==r.rank)throw new Error("Input should be Tensor1D but received shape ".concat(r.shape));if(0!==a.rank)throw new Error("Delimiter should be a scalar but received shape ".concat(a.shape));var i={skipEmpty:n},o={input:r,delimiter:a},s=E5.runKernel(y3,o,i);return{indices:s[0],values:s[1],shape:s[2]}}});var Sre=B5({stringToHashBucketFast_:function(e,t){var n=L5(e,"input","stringToHashBucketFast","string"),r={numBuckets:t};if(t<=0)throw new Error("Number of buckets must be at least 1");var a={input:n};return E5.runKernel(b3,a,r)}});var Tre=B5({staticRegexReplace_:function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=L5(e,"input","staticRegexReplace","string"),i={pattern:t,rewrite:n,replaceGlobal:r};return E5.runKernel(v3,{x:a},i)}}),Ere={fft:Ite,ifft:Nte,rfft:Ete,irfft:Ste},Cre={hammingWindow:Sne,hannWindow:Tne,frame:Ene,stft:Cne},Are={flipLeftRight:Rne,grayscaleToRGB:_ne,resizeNearestNeighbor:$ne,resizeBilinear:Qne,rotateWithOffset:One,cropAndResize:Ane,nonMaxSuppression:Dne,nonMaxSuppressionAsync:Hne,nonMaxSuppressionWithScore:qne,nonMaxSuppressionWithScoreAsync:Xne,nonMaxSuppressionPadded:Yne,nonMaxSuppressionPaddedAsync:Zne,threshold:tre,transform:nre},Rre={bandPart:rre,gramSchmidt:are,qr:sre},_re={absoluteDifference:cre,computeWeightedLoss:ure,cosineDistance:lre,hingeLoss:hre,huberLoss:pre,logLoss:fre,meanSquaredError:dre,sigmoidCrossEntropy:mre,softmaxCrossEntropy:yre},Ore={sparseFillEmptyRows:bre,sparseReshape:xre,sparseSegmentMean:kre,sparseSegmentSum:wre},Fre={stringNGrams:Ire,stringSplit:Nre,stringToHashBucketFast:Sre,staticRegexReplace:Tre},Dre=function(){function e(){l(this,e)}return p(e,[{key:"getClassName",value:function(){return this.constructor.className}}],[{key:"fromConfig",value:function(e,t){return new e(t)}}]),e}(),Mre=function(){function e(){l(this,e),this.classNameMap={}}return p(e,null,[{key:"getMap",value:function(){return null==e.instance&&(e.instance=new e),e.instance}},{key:"register",value:function(t){e.getMap().classNameMap[t.className]=[t,t.fromConfig]}}]),e}();function Lre(e){F$(null!=e.className,(function(){return"Class being registered does not have the static className property defined."})),F$("string"==typeof e.className,(function(){return"className is required to be a string, but got type "+s(e.className)})),F$(e.className.length>0,(function(){return"Class being registered has an empty-string as its className, which is disallowed."})),Mre.register(e)}var zre={__proto__:null,Serializable:Dre,SerializationMap:Mre,registerClass:Lre},Pre=function(e){d(s,e);var t,n,r,a,i=w(s);function s(){return l(this,s),i.apply(this,arguments)}return p(s,[{key:"minimize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0,r=this.computeGradients(e,n),a=r.value,i=r.grads;if(null!=n){var o=n.map((function(e){return{name:e.name,tensor:i[e.name]}}));this.applyGradients(o)}else this.applyGradients(i);return t8(i),t?a:(a.dispose(),null)}},{key:"iterations",get:function(){return null==this.iterations_&&(this.iterations_=0),this.iterations_}},{key:"incrementIterations",value:function(){this.iterations_=this.iterations+1}},{key:"computeGradients",value:function(e,t){return N9(e,t)}},{key:"dispose",value:function(){null!=this.iterations_&&t8(this.iterations_)}},{key:"saveIterations",value:(a=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return null==this.iterations_&&(this.iterations_=0),e.abrupt("return",{name:"iter",tensor:Z7(this.iterations_,"int32")});case 2:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"getWeights",value:(r=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("getWeights() is not implemented for this optimizer yet.");case 1:case"end":return e.stop()}}),e)}))),function(){return r.apply(this,arguments)})},{key:"setWeights",value:(n=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("setWeights() is not implemented for this optimizer class "+"".concat(this.getClassName()));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"extractIterations",value:(t=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t[0].tensor.data();case 2:return this.iterations_=e.sent[0],e.abrupt("return",t.slice(1));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),s}(Dre);Object.defineProperty(Pre,Symbol.hasInstance,{value:function(e){return null!=e.minimize&&null!=e.computeGradients&&null!=e.applyGradients}});var Bre=function(e){d(a,e);var t,n,r=w(a);function a(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return l(this,a),(n=r.call(this)).learningRate=e,n.rho=t,n.epsilon=i,n.accumulatedGrads=[],n.accumulatedUpdates=[],null==i&&(n.epsilon=E5.backend.epsilon()),n}return p(a,[{key:"applyGradients",value:function(e){var t=this;(Array.isArray(e)?e.map((function(e){return e.name})):Object.keys(e)).forEach((function(n,r){var a=E5.registeredVariables[n];null==t.accumulatedGrads[r]&&(t.accumulatedGrads[r]={originalName:"".concat(n,"/accum_grad"),variable:e8((function(){return F7(a).variable(false)}))}),null==t.accumulatedUpdates[r]&&(t.accumulatedUpdates[r]={originalName:"".concat(n,"/accum_var"),variable:e8((function(){return F7(a).variable(false)}))});var i=Array.isArray(e)?e[r].tensor:e[n];if(null!=i){var o=t.accumulatedGrads[r].variable,s=t.accumulatedUpdates[r].variable;e8((function(){var e=o8(c8(o,t.rho),c8($7(i),1-t.rho)),n=c8(u8(Q7(o8(s,t.epsilon)),Q7(o8(o,t.epsilon))),i),r=o8(c8(s,t.rho),c8($7(n),1-t.rho));o.assign(e),s.assign(r);var u=o8(c8(n,-t.learningRate),a);a.assign(u)}))}})),this.incrementIterations()}},{key:"dispose",value:function(){null!=this.accumulatedUpdates&&(t8(this.accumulatedGrads.map((function(e){return e.variable}))),t8(this.accumulatedUpdates.map((function(e){return e.variable}))))}},{key:"getWeights",value:(n=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[].concat(T(this.accumulatedGrads),T(this.accumulatedUpdates)),e.next=3,this.saveIterations();case 3:return e.t0=e.sent,e.abrupt("return",[e.t0].concat(t.map((function(e){return{name:e.originalName,tensor:e.variable}}))));case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"setWeights",value:(t=c(o().mark((function e(t){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.extractIterations(t);case 2:t=e.sent,n=t.length/2,this.accumulatedGrads=t.slice(0,n).map((function(e){return{originalName:e.name,variable:e.tensor.variable(!1)}})),this.accumulatedUpdates=t.slice(n,2*n).map((function(e){return{originalName:e.name,variable:e.tensor.variable(!1)}}));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getConfig",value:function(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}}],[{key:"className",get:function(){return"Adadelta"}},{key:"fromConfig",value:function(e,t){return new e(t.learningRate,t.rho,t.epsilon)}}]),a}(Pre),Wre=function(e){d(a,e);var t,n,r=w(a);function a(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.1;return l(this,a),(t=r.call(this)).learningRate=e,t.initialAccumulatorValue=n,t.accumulatedGrads=[],t}return p(a,[{key:"applyGradients",value:function(e){var t=this;(Array.isArray(e)?e.map((function(e){return e.name})):Object.keys(e)).forEach((function(n,r){var a=E5.registeredVariables[n];if(null==t.accumulatedGrads[r]){t.accumulatedGrads[r]={originalName:"".concat(n,"/accumulator"),variable:e8((function(){return i7(a.shape,t.initialAccumulatorValue).variable(false)}))}}var i=Array.isArray(e)?e[r].tensor:e[n];if(null!=i){var o=t.accumulatedGrads[r].variable;e8((function(){var e=o8(o,$7(i));o.assign(e);var n=o8(c8(u8(i,Q7(o8(e,E5.backend.epsilon()))),-t.learningRate),a);a.assign(n)}))}})),this.incrementIterations()}},{key:"dispose",value:function(){null!=this.accumulatedGrads&&t8(this.accumulatedGrads.map((function(e){return e.variable})))}},{key:"getWeights",value:(n=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.saveIterations();case 2:return e.t0=e.sent,e.abrupt("return",[e.t0].concat(this.accumulatedGrads.map((function(e){return{name:e.originalName,tensor:e.variable}}))));case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"setWeights",value:(t=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.extractIterations(t);case 2:t=e.sent,this.accumulatedGrads=t.map((function(e){return{originalName:e.name,variable:e.tensor.variable(!1)}}));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getConfig",value:function(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}}],[{key:"className",get:function(){return"Adagrad"}},{key:"fromConfig",value:function(e,t){return new e(t.learningRate,t.initialAccumulatorValue)}}]),a}(Pre),Vre=function(e){d(a,e);var t,n,r=w(a);function a(e,t,n){var i,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return l(this,a),(i=r.call(this)).learningRate=e,i.beta1=t,i.beta2=n,i.epsilon=o,i.accumulatedFirstMoment=[],i.accumulatedSecondMoment=[],e8((function(){i.accBeta1=Z7(t).variable(),i.accBeta2=Z7(n).variable()})),null==o&&(i.epsilon=E5.backend.epsilon()),i}return p(a,[{key:"applyGradients",value:function(e){var t=this,n=Array.isArray(e)?e.map((function(e){return e.name})):Object.keys(e);e8((function(){var r=R9(1,t.accBeta1),a=R9(1,t.accBeta2);n.forEach((function(n,i){var o=E5.registeredVariables[n];null==t.accumulatedFirstMoment[i]&&(t.accumulatedFirstMoment[i]={originalName:"".concat(n,"/m"),variable:e8((function(){return F7(o).variable(false)}))}),null==t.accumulatedSecondMoment[i]&&(t.accumulatedSecondMoment[i]={originalName:"".concat(n,"/v"),variable:e8((function(){return F7(o).variable(false)}))});var s=Array.isArray(e)?e[i].tensor:e[n];if(null!=s){var u=t.accumulatedFirstMoment[i].variable,c=t.accumulatedSecondMoment[i].variable,l=o8(c8(u,t.beta1),c8(s,1-t.beta1)),h=o8(c8(c,t.beta2),c8($7(s),1-t.beta2)),p=u8(l,r),f=u8(h,a);u.assign(l),c.assign(h);var d=o8(c8(u8(p,o8(Q7(f),t.epsilon)),-t.learningRate),o);o.assign(d)}})),t.accBeta1.assign(c8(t.accBeta1,t.beta1)),t.accBeta2.assign(c8(t.accBeta2,t.beta2))})),this.incrementIterations()}},{key:"dispose",value:function(){this.accBeta1.dispose(),this.accBeta2.dispose(),null!=this.accumulatedFirstMoment&&t8(this.accumulatedFirstMoment.map((function(e){return e.variable}))),null!=this.accumulatedSecondMoment&&t8(this.accumulatedSecondMoment.map((function(e){return e.variable})))}},{key:"getWeights",value:(n=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[].concat(T(this.accumulatedFirstMoment),T(this.accumulatedSecondMoment)),e.next=3,this.saveIterations();case 3:return e.t0=e.sent,e.abrupt("return",[e.t0].concat(t.map((function(e){return{name:e.originalName,tensor:e.variable}}))));case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"setWeights",value:(t=c(o().mark((function e(t){var n,r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.extractIterations(t);case 2:t=e.sent,e8((function(){r.accBeta1.assign(J7(r.beta1,r.iterations_+1)),r.accBeta2.assign(J7(r.beta2,r.iterations_+1))})),n=t.length/2,this.accumulatedFirstMoment=t.slice(0,n).map((function(e){return{originalName:e.name,variable:e.tensor.variable(!1)}})),this.accumulatedSecondMoment=t.slice(n,2*n).map((function(e){return{originalName:e.name,variable:e.tensor.variable(!1)}}));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getConfig",value:function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}}}],[{key:"className",get:function(){return"Adam"}},{key:"fromConfig",value:function(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon)}}]),a}(Pre),Ure=function(e){d(a,e);var t,n,r=w(a);function a(e,t,n){var i,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return l(this,a),(i=r.call(this)).learningRate=e,i.beta1=t,i.beta2=n,i.epsilon=o,i.decay=s,i.accumulatedFirstMoment=[],i.accumulatedWeightedInfNorm=[],e8((function(){i.iteration=Z7(0).variable(),i.accBeta1=Z7(t).variable()})),null==o&&(i.epsilon=E5.backend.epsilon()),i}return p(a,[{key:"applyGradients",value:function(e){var t=this,n=Array.isArray(e)?e.map((function(e){return e.name})):Object.keys(e);e8((function(){var r=R9(1,t.accBeta1),a=u8(-t.learningRate,o8(c8(t.iteration,t.decay),1));n.forEach((function(n,i){var o=E5.registeredVariables[n];null==t.accumulatedFirstMoment[i]&&(t.accumulatedFirstMoment[i]={originalName:"".concat(n,"/m"),variable:F7(o).variable(false)}),null==t.accumulatedWeightedInfNorm[i]&&(t.accumulatedWeightedInfNorm[i]={originalName:"".concat(n,"/v"),variable:F7(o).variable(false)});var s=Array.isArray(e)?e[i].tensor:e[n];if(null!=s){var u=t.accumulatedFirstMoment[i].variable,c=t.accumulatedWeightedInfNorm[i].variable,l=o8(c8(u,t.beta1),c8(s,1-t.beta1)),h=c8(c,t.beta2),p=l8(s),f=G9(h,p);u.assign(l),c.assign(f);var d=o8(c8(u8(a,r),u8(l,o8(f,t.epsilon))),o);o.assign(d)}})),t.iteration.assign(o8(t.iteration,1)),t.accBeta1.assign(c8(t.accBeta1,t.beta1))})),this.incrementIterations()}},{key:"dispose",value:function(){this.accBeta1.dispose(),this.iteration.dispose(),null!=this.accumulatedFirstMoment&&t8(this.accumulatedFirstMoment.map((function(e){return e.variable}))),null!=this.accumulatedWeightedInfNorm&&t8(this.accumulatedWeightedInfNorm.map((function(e){return e.variable})))}},{key:"getWeights",value:(n=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("getWeights() is not implemented for Adamax yet.");case 1:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})},{key:"setWeights",value:(t=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("setWeights() is not implemented for Adamax yet.");case 1:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"getConfig",value:function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}}}],[{key:"className",get:function(){return"Adamax"}},{key:"fromConfig",value:function(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)}}]),a}(Pre),Gre=function(e){d(a,e);var t,n,r=w(a);function a(e){var t;return l(this,a),(t=r.call(this)).learningRate=e,t.setLearningRate(e),t}return p(a,[{key:"applyGradients",value:function(e){var t=this;(Array.isArray(e)?e.map((function(e){return e.name})):Object.keys(e)).forEach((function(n,r){var a=Array.isArray(e)?e[r].tensor:e[n];if(null!=a){var i=E5.registeredVariables[n];e8((function(){var e=o8(c8(t.c,a),i);i.assign(e)}))}})),this.incrementIterations()}},{key:"setLearningRate",value:function(e){this.learningRate=e,null!=this.c&&this.c.dispose(),this.c=n8(Z7(-e))}},{key:"dispose",value:function(){this.c.dispose()}},{key:"getWeights",value:(n=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.saveIterations();case 2:return e.t0=e.sent,e.abrupt("return",[e.t0]);case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"setWeights",value:(t=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.extractIterations(t);case 2:if(0===(t=e.sent).length){e.next=5;break}throw new Error("SGD optimizer does not have settable weights.");case 5:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getConfig",value:function(){return{learningRate:this.learningRate}}}],[{key:"className",get:function(){return"SGD"}},{key:"fromConfig",value:function(e,t){return new e(t.learningRate)}}]),a}(Pre),jre=function(e){d(a,e);var t,n,r=w(a);function a(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return l(this,a),(n=r.call(this,e)).learningRate=e,n.momentum=t,n.useNesterov=i,n.accumulations=[],n.m=Z7(n.momentum),n}return p(a,[{key:"applyGradients",value:function(e){var t=this;(Array.isArray(e)?e.map((function(e){return e.name})):Object.keys(e)).forEach((function(n,r){var a=E5.registeredVariables[n];if(null==t.accumulations[r]){t.accumulations[r]={originalName:"".concat(n,"/momentum"),variable:e8((function(){return F7(a).variable(false)}))}}var i=t.accumulations[r].variable,o=Array.isArray(e)?e[r].tensor:e[n];null!=o&&e8((function(){var e,n=o8(c8(t.m,i),o);e=t.useNesterov?o8(c8(t.c,o8(o,c8(n,t.m))),a):o8(c8(t.c,n),a),i.assign(n),a.assign(e)}))})),this.incrementIterations()}},{key:"dispose",value:function(){this.m.dispose(),null!=this.accumulations&&t8(this.accumulations.map((function(e){return e.variable})))}},{key:"setMomentum",value:function(e){this.momentum=e}},{key:"getWeights",value:(n=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.saveIterations();case 2:return e.t0=e.sent,e.abrupt("return",[e.t0].concat(this.accumulations.map((function(e){return{name:e.originalName,tensor:e.variable}}))));case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"setWeights",value:(t=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.extractIterations(t);case 2:t=e.sent,this.accumulations=t.map((function(e){return{originalName:e.name,variable:e.tensor.variable(!1)}}));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getConfig",value:function(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}}],[{key:"className",get:function(){return"Momentum"}},{key:"fromConfig",value:function(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)}}]),a}(Gre),Hre=function(e){d(a,e);var t,n,r=w(a);function a(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.9,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(l(this,a),(t=r.call(this)).learningRate=e,t.decay=n,t.momentum=i,t.epsilon=o,t.accumulatedMeanSquares=[],t.accumulatedMoments=[],t.accumulatedMeanGrads=[],t.centered=s,null==o&&(t.epsilon=E5.backend.epsilon()),null==e)throw new Error("learningRate for RMSPropOptimizer must be defined.");return t}return p(a,[{key:"applyGradients",value:function(e){var t=this;(Array.isArray(e)?e.map((function(e){return e.name})):Object.keys(e)).forEach((function(n,r){var a=E5.registeredVariables[n],i=!1;null==t.accumulatedMeanSquares[r]&&(t.accumulatedMeanSquares[r]={originalName:"".concat(n,"/rms"),variable:e8((function(){return F7(a).variable(i)}))}),null==t.accumulatedMoments[r]&&(t.accumulatedMoments[r]={originalName:"".concat(n,"/momentum"),variable:e8((function(){return F7(a).variable(i)}))}),null==t.accumulatedMeanGrads[r]&&t.centered&&(t.accumulatedMeanGrads[r]={originalName:"".concat(n,"/mg"),variable:e8((function(){return F7(a).variable(i)}))});var o=Array.isArray(e)?e[r].tensor:e[n];if(null!=o){var s=t.accumulatedMeanSquares[r].variable,u=t.accumulatedMoments[r].variable;e8((function(){var e=o8(c8(s,t.decay),c8($7(o),1-t.decay));if(t.centered){var n=t.accumulatedMeanGrads[r].variable,i=o8(c8(n,t.decay),c8(o,1-t.decay)),c=u8(c8(o,t.learningRate),Q7(R9(e,o8($7(i),t.epsilon)))),l=o8(c8(u,t.momentum),c);s.assign(e),n.assign(i),u.assign(l);var h=R9(a,l);a.assign(h)}else{var p=o8(c8(s,t.decay),c8($7(o),1-t.decay)),f=o8(c8(u,t.momentum),u8(c8(o,t.learningRate),Q7(o8(p,t.epsilon))));s.assign(p),u.assign(f);var d=R9(a,f);a.assign(d)}}))}})),this.incrementIterations()}},{key:"dispose",value:function(){null!=this.accumulatedMeanSquares&&t8(this.accumulatedMeanSquares.map((function(e){return e.variable}))),null!=this.accumulatedMeanGrads&&this.centered&&t8(this.accumulatedMeanGrads.map((function(e){return e.variable}))),null!=this.accumulatedMoments&&t8(this.accumulatedMoments.map((function(e){return e.variable})))}},{key:"getWeights",value:(n=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[].concat(T(this.accumulatedMeanSquares),T(this.accumulatedMoments)),this.centered&&t.push.apply(t,T(this.accumulatedMeanGrads)),e.next=4,this.saveIterations();case 4:return e.t0=e.sent,e.abrupt("return",[e.t0].concat(t.map((function(e){return{name:e.originalName,tensor:e.variable}}))));case 6:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"setWeights",value:(t=c(o().mark((function e(t){var n,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.extractIterations(t);case 2:t=e.sent,n=this.centered?t.length/3:t.length/2,r=!1,this.accumulatedMeanSquares=t.slice(0,n).map((function(e){return{originalName:e.name,variable:e.tensor.variable(r)}})),this.accumulatedMoments=t.slice(n,2*n).map((function(e){return{originalName:e.name,variable:e.tensor.variable(r)}})),this.centered&&(this.accumulatedMeanGrads=t.slice(2*n,3*n).map((function(e){return{originalName:e.name,variable:e.tensor.variable(r)}})));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getConfig",value:function(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}}}],[{key:"className",get:function(){return"RMSProp"}},{key:"fromConfig",value:function(e,t){return new e(t.learningRate,t.decay,t.momentum,t.epsilon,t.centered)}}]),a}(Pre),qre=[Bre,Wre,Vre,Ure,jre,Hre,Gre];function Kre(e){return new Promise((function(e){return setTimeout(e)})).then(e)}var Xre=function(){function e(t){if(l(this,e),!k0().getBool("IS_BROWSER"))throw new Error("browserDownloads() 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="model"),this.modelJsonFileName=t+".json",this.weightDataFileName=t+".weights.bin"}var t;return p(e,[{key:"save",value:(t=c(o().mark((function e(t){var n,r,a,i,s,u,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("undefined"!=typeof document){e.next=2;break}throw new Error("Browser downloads are not supported in this environment since `document` is not present");case 2:if(n=j5.join(t.weightData),r=window.URL.createObjectURL(new Blob([n],{type:"application/octet-stream"})),!(t.modelTopology instanceof ArrayBuffer)){e.next=8;break}throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");case 8:return a=[{paths:["./"+this.weightDataFileName],weights:t.weightSpecs}],i=t6(t,a),s=window.URL.createObjectURL(new Blob([JSON.stringify(i)],{type:"application/json"})),(u=null==this.modelJsonAnchor?document.createElement("a"):this.modelJsonAnchor).download=this.modelJsonFileName,u.href=s,e.next=16,Kre((function(){return u.dispatchEvent(new MouseEvent("click"))}));case 16:if(null==t.weightData){e.next=22;break}return(c=null==this.weightDataAnchor?document.createElement("a"):this.weightDataAnchor).download=this.weightDataFileName,c.href=r,e.next=22,Kre((function(){return c.dispatchEvent(new MouseEvent("click"))}));case 22:return e.abrupt("return",{modelArtifactsInfo:i6(t)});case 23:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}();Xre.URL_SCHEME="downloads://";var Yre=function(){function e(t){if(l(this,e),null==t||t.length<1)throw new Error("When calling browserFiles, at least 1 file is required, "+"but received ".concat(t));this.jsonFile=t[0],this.weightsFiles=t.slice(1)}var t;return p(e,[{key:"load",value:(t=c(o().mark((function e(){var t=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var r=new FileReader;r.onload=function(r){var a=JSON.parse(r.target.result),i=a.modelTopology;if(null!=i)if(null!=a.weightsManifest)if(0!==t.weightsFiles.length){var o=r6(a,(function(e){return t.loadWeights(e)}));e(o)}else e({modelTopology:i});else n(new Error("weightManifest field is missing from file ".concat(t.jsonFile.name)));else n(new Error("modelTopology field is missing from file ".concat(t.jsonFile.name)))},r.onerror=function(e){return n("Failed to read model topology and weights manifest JSON "+"from file '".concat(t.jsonFile.name,"'. BrowserFiles supports loading ")+"Keras-style tf.Model artifacts only.")},r.readAsText(t.jsonFile)})));case 1:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})},{key:"loadWeights",value:function(e){var t,n=this,r=[],a=[],i=O(e);try{for(i.s();!(t=i.n()).done;){var o=t.value;r.push.apply(r,T(o.weights)),a.push.apply(a,T(o.paths))}}catch(e){i.e(e)}finally{i.f()}var s=this.checkManifestAndWeightFiles(e),u=a.map((function(e){return n.loadWeightsFile(e,s[e])}));return Promise.all(u).then((function(e){return[r,e]}))}},{key:"loadWeightsFile",value:function(e,t){return new Promise((function(n,r){var a=new FileReader;a.onload=function(e){var t=e.target.result;n(t)},a.onerror=function(t){return r("Failed to weights data from file of path '".concat(e,"'."))},a.readAsArrayBuffer(t)}))}},{key:"checkManifestAndWeightFiles",value:function(e){var t,n=this,r=[],a=this.weightsFiles.map((function(e){return e6(e.name)})),i={},o=O(e);try{for(o.s();!(t=o.n()).done;){t.value.paths.forEach((function(e){var t=e6(e);if(-1!==r.indexOf(t))throw new Error("Duplicate file basename found in weights manifest: "+"'".concat(t,"'"));if(r.push(t),-1===a.indexOf(t))throw new Error("Weight file with basename '".concat(t,"' is not provided."));i[e]=n.weightsFiles[a.indexOf(t)]}))}}catch(e){o.e(e)}finally{o.f()}if(r.length!==this.weightsFiles.length)throw new Error("Mismatch in the number of files in weights manifest "+"(".concat(r.length,") and the number of weight files provided ")+"(".concat(this.weightsFiles.length,")."));return i}}]),e}();function Jre(e,t,n,r){!function(e){F$(null!=e&&Array.isArray(e)&&e.length>0,(function(){return"promises must be a none empty array"}))}(e),function(e,t){F$(e>=0&&e<=1,(function(){return"Progress fraction must be in range [0, 1], but "+"got startFraction ".concat(e)})),F$(t>=0&&t<=1,(function(){return"Progress fraction must be in range [0, 1], but "+"got endFraction ".concat(t)})),F$(t>=e,(function(){return"startFraction must be no more than endFraction, but "+"got startFraction ".concat(e," and endFraction ")+"".concat(t)}))}(n=null==n?0:n,r=null==r?1:r);var a=0;return Promise.all(e.map((function(i){return i.then((function(i){var o=n+ ++a/e.length*(r-n);return t(o),i})),i})))}function Zre(e,t){return Qre.apply(this,arguments)}function Qre(){return(Qre=c(o().mark((function e(t,n){var r,a,i,s,u,c,l,h,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==n&&(n={}),r=null==n.fetchFunc?k0().platform.fetch:n.fetchFunc,a=t.map((function(e){return r(e,n.requestInit,{isBinary:!0})})),i=0,s=.5,null!=n.onProgress){e.next=11;break}return e.next=8,Promise.all(a);case 8:e.t0=e.sent,e.next=14;break;case 11:return e.next=13,Jre(a,n.onProgress,i,s);case 13:e.t0=e.sent;case 14:if(u=e.t0,c=u.map((function(e){return e.arrayBuffer()})),l=.5,h=1,null!=n.onProgress){e.next=24;break}return e.next=21,Promise.all(c);case 21:e.t1=e.sent,e.next=27;break;case 24:return e.next=26,Jre(c,n.onProgress,l,h);case 26:e.t1=e.sent;case 27:return p=e.t1,e.abrupt("return",p);case 29:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $re(e){return eae.apply(this,arguments)}function eae(){return eae=c(o().mark((function e(t){var n,r,a,i,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:"",r=s.length>2?s[2]:void 0,a=s.length>3?s[3]:void 0,i=tae((function(e){return Zre(e,{requestInit:a})})),e.abrupt("return",i(t,n,r));case 6:case"end":return e.stop()}}),e)}))),eae.apply(this,arguments)}function tae(e){return function(){var t=c(o().mark((function t(n){var r,a,i,s,u,c,l,h,p,f,d,v,m=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=m.length>1&&void 0!==m[1]?m[1]:"",a=m.length>2?m[2]:void 0,i=n.map((function(){return!1})),s={},u=null!=a?a.map((function(){return!1})):[],c=[],n.forEach((function(e,t){var n=0;e.weights.forEach((function(e){var r="quantization"in e?e.quantization.dtype:e.dtype,o=G5[r]*L$(e.shape),l=function(){i[t]=!0,null==s[t]&&(s[t]=[]),s[t].push({manifestEntry:e,groupOffset:n,sizeBytes:o})};null!=a?a.forEach((function(t,n){t===e.name&&(l(),u[n]=!0)})):l(),c.push(e.name),n+=o}))})),u.every((function(e){return e}))){t.next=10;break}throw l=a.filter((function(e,t){return!u[t]})),new Error("Could not find weights in manifest with names: "+"".concat(l.join(", "),". \n")+"Manifest JSON has weights with names: "+"".concat(c.join(", "),"."));case 10:return h=i.reduce((function(e,t,n){return t&&e.push(n),e}),[]),p=[],h.forEach((function(e){n[e].paths.forEach((function(e){var t=r+(r.endsWith("/")?"":"/")+e;p.push(t)}))})),t.next=15,e(p);case 15:return f=t.sent,d={},v=0,h.forEach((function(e){var t=n[e].paths.length,r=new j5(f.slice(v,v+t));s[e].forEach((function(e){var t=K5(r.slice(e.groupOffset,e.groupOffset+e.sizeBytes),[e.manifestEntry]);for(var n in t)d[n]=t[n]})),v+=t})),t.abrupt("return",d);case 20:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}u6.registerSaveRouter((function(e){return k0().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Xre.URL_SCHEME)?function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"model";return new Xre(e)}(e.slice(Xre.URL_SCHEME.length)):null}));var nae=function(){function e(t,n){if(l(this,e),this.DEFAULT_METHOD="POST",null==n&&(n={}),this.weightPathPrefix=n.weightPathPrefix,this.onProgress=n.onProgress,this.weightUrlConverter=n.weightUrlConverter,null!=n.fetchFunc?(F$("function"==typeof n.fetchFunc,(function(){return"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"})),this.fetch=n.fetchFunc):this.fetch=k0().platform.fetch,F$(null!=t&&t.length>0,(function(){return"URL path for http must not be null, undefined or empty."})),Array.isArray(t)&&F$(2===t.length,(function(){return"URL paths for http must have a length of 2, "+"(actual length is ".concat(t.length,").")})),this.path=t,null!=n.requestInit&&null!=n.requestInit.body)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=n.requestInit||{}}var t,n;return p(e,[{key:"save",value:(n=c(o().mark((function e(t){var n,r,a,i,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t.modelTopology instanceof ArrayBuffer)){e.next=2;break}throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");case 2:return(n=Object.assign({method:this.DEFAULT_METHOD},this.requestInit)).body=new FormData,r=[{paths:["./model.weights.bin"],weights:t.weightSpecs}],a=t6(t,r),n.body.append("model.json",new Blob([JSON.stringify(a)],{type:"application/json"}),"model.json"),null!=t.weightData&&(i=j5.join(t.weightData),n.body.append("model.weights.bin",new Blob([i],{type:"application/octet-stream"}),"model.weights.bin")),e.next=10,this.fetch(this.path,n);case 10:if(!(s=e.sent).ok){e.next=15;break}return e.abrupt("return",{modelArtifactsInfo:i6(t),responses:[s]});case 15:throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+"".concat(s.status,"."));case 16:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"load",value:(t=c(o().mark((function e(){var t,n,r,a,i,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.fetch(this.path,this.requestInit);case 2:if((t=e.sent).ok){e.next=5;break}throw new Error("Request to ".concat(this.path," failed with status code ")+"".concat(t.status,". Please verify this URL points to ")+"the model JSON of the model to load.");case 5:return e.prev=5,e.next=8,t.json();case 8:n=e.sent,e.next=16;break;case 11:throw e.prev=11,e.t0=e.catch(5),r="Failed to parse model JSON of response from ".concat(this.path,"."),this.path.endsWith(".pb")?r+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":r+=" Please make sure the server is serving valid JSON for this request.",new Error(r);case 16:if(a=n.modelTopology,i=n.weightsManifest,null!=a||null!=i){e.next=20;break}throw new Error("The JSON from HTTP path ".concat(this.path," contains neither model ")+"topology or manifest for weights.");case 20:return e.abrupt("return",r6(n,(function(e){return s.loadWeights(e)})));case 21:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return t.apply(this,arguments)})},{key:"loadWeights",value:function(){var e=c(o().mark((function e(t){var n,r,a,i,s,u,c,l,h,p,f,d,v,m,g,y;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Array.isArray(this.path)?this.path[1]:this.path,r=rae(n),a=S(r,2),i=a[0],s=a[1],u=this.weightPathPrefix||i,c=o6(t),l=[],h=[],p=O(t);try{for(p.s();!(f=p.n()).done;){d=f.value,v=O(d.paths);try{for(v.s();!(m=v.n()).done;)g=m.value,null!=this.weightUrlConverter?h.push(this.weightUrlConverter(g)):l.push(u+g+s)}catch(e){v.e(e)}finally{v.f()}}}catch(e){p.e(e)}finally{p.f()}if(!this.weightUrlConverter){e.next=17;break}return e.t0=l.push,e.t1=l,e.t2=T,e.next=14,Promise.all(h);case 14:e.t3=e.sent,e.t4=(0,e.t2)(e.t3),e.t0.apply.call(e.t0,e.t1,e.t4);case 17:return e.next=19,Zre(l,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress});case 19:return y=e.sent,e.abrupt("return",[c,y]);case 21:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()}]),e}();function rae(e){var t=e.lastIndexOf("/"),n=e.lastIndexOf("?");return[e.substring(0,t)+"/",n>t?e.substring(n):""]}function aae(e){return null!=e.match(nae.URL_SCHEME_REGEX)}nae.URL_SCHEME_REGEX=/^https?:\/\//;var iae=function(e,t){if("undefined"==typeof fetch&&(null==t||null==t.fetchFunc))return null;return(Array.isArray(e)?e.every((function(e){return aae(e)})):aae(e))?oae(e,t):null};function oae(e,t){return new nae(e,t)}function sae(e,t){return oae(e,t)}u6.registerSaveRouter(iae),u6.registerLoadRouter(iae);var uae=function(){function e(t){l(this,e),this.modelArtifacts=t}return p(e,[{key:"load",value:function(){return this.modelArtifacts}}]),e}(),cae=function(){function e(t){l(this,e),this.saveHandler=t}return p(e,[{key:"save",value:function(e){return this.saveHandler(e)}}]),e}(),lae=p((function e(t){l(this,e),t.load&&(this.load=function(){return Promise.resolve(t.load())}),t.save&&(this.save=function(e){return Promise.resolve(t.save(e))})}));function hae(e,t,n,r){if(1===arguments.length){var a=null!=e.modelTopology||null!=e.weightSpecs;return a?new uae(e):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new uae({modelTopology:e}))}return console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new uae({modelTopology:e,weightSpecs:t,weightData:n,trainingConfig:r})}var pae={__proto__:null,CompositeArrayBuffer:j5,browserFiles:function(e){return new Yre(e)},browserHTTPRequest:sae,concatenateArrayBuffers:$5,copyModel:function(e,t){return V6.apply(this,arguments)},decodeWeights:K5,encodeWeights:H5,fromMemory:function(e,t,n,r){var a=arguments;return new lae(hae.apply(void 0,T(a)))},fromMemorySync:hae,getLoadHandlers:l6,getModelArtifactsForJSON:r6,getModelArtifactsForJSONSync:n6,getModelArtifactsInfoForJSON:i6,getSaveHandlers:c6,getWeightSpecs:o6,http:oae,isHTTPScheme:aae,listModels:function(){return B6.apply(this,arguments)},loadWeights:$re,moveModel:function(e,t){return U6.apply(this,arguments)},registerLoadRouter:function(e){return u6.registerLoadRouter(e)},registerSaveRouter:function(e){return u6.registerSaveRouter(e)},removeModel:function(e){return W6.apply(this,arguments)},weightsLoaderFactory:tae,withSaveHandler:function(e){return new cae(e)},withSaveHandlerSync:function(e){return new cae(e)}};var fae,dae={__proto__:null,confusionMatrix:B5({confusionMatrix_:function(e,t,n){var r=L5(e,"labels","confusionMatrix"),a=L5(t,"predictions","confusionMatrix");F$(null==n||n>0&&Number.isInteger(n),(function(){return"If provided, numClasses must be a positive integer, "+"but got ".concat(n)})),F$(1===r.rank,(function(){return"Expected the rank of labels to be 1, but got ".concat(r.rank)})),F$(1===a.rank,(function(){return"Expected the rank of predictions to be 1, "+"but got ".concat(a.rank)})),F$(r.shape[0]===a.shape[0],(function(){return"Mismatch in the number of examples: "+"".concat(r.shape[0]," vs. ").concat(a.shape[0],". ")+"Labels and predictions should have the same number of elements."})),F$(n>0&&Number.isInteger(n),(function(){return"numClasses is required to be a positive integer, but got "+"".concat(n)}));var i=tee(X6(r,"int32"),n),o=tee(X6(a,"int32"),n),s=rne(i),u=j8(s,o);return X6(u,"int32")}})},vae=!1;function mae(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;if(t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(null==e)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");var n=!1,r=!1,a=!1,i=!1,o=!1,s=!1;if(e.data instanceof Uint8Array)n=!0;else if("undefined"!=typeof ImageData&&e instanceof ImageData)r=!0;else if("undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement)a=!0;else if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement)i=!0;else if(null!=e.getContext)o=!0;else{if(!("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap))throw new Error("pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, "+"but was ".concat(e.constructor.name));s=!0}var u=W3(O3,E5.backendName);if(null!=u){var c={pixels:e},l={numChannels:t};return E5.runKernel(O3,c,l)}var h,p,f=a?[e.videoWidth,e.videoHeight]:[e.width,e.height],d=S(f,2),v=d[0],m=d[1];if(o)h=e.getContext("2d").getImageData(0,0,v,m).data;else if(r||n)h=e.data;else if(i||a||s){if(null==fae)if("undefined"==typeof document){if("undefined"==typeof OffscreenCanvas||"undefined"==typeof OffscreenCanvasRenderingContext2D)throw new Error("Cannot parse input in current context. Reason: OffscreenCanvas Context2D rendering is not supported.");fae=new OffscreenCanvas(1,1).getContext("2d")}else fae=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});fae.canvas.width=v,fae.canvas.height=m,fae.drawImage(e,0,0,v,m),h=fae.getImageData(0,0,v,m).data}if(4===t)p=new Int32Array(h);else{var g=v*m;p=new Int32Array(g*t);for(var y=0;y<g;y++)for(var b=0;b<t;++b)p[y*t+b]=h[4*y+b]}var x=[m,v,t];return Lte(p,x,"int32")}function gae(e){return"undefined"!=typeof window&&"undefined"!=typeof ImageBitmap&&window.hasOwnProperty("createImageBitmap")&&!(e instanceof ImageBitmap)&&function(e){return null!=e&&0!==e.width&&0!==e.height}(e)&&!function(e){return null!=e&&e.data instanceof Uint8Array}(e)}function yae(){return yae=c(o().mark((function e(t){var n,r,a,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=i.length>1&&void 0!==i[1]?i[1]:3,r=null,!k0().getBool("WRAP_TO_IMAGEBITMAP")||!gae(t)){e.next=15;break}return e.prev=3,e.next=6,createImageBitmap(t,{premultiplyAlpha:"none"});case 6:a=e.sent,e.next=12;break;case 9:e.prev=9,e.t0=e.catch(3),a=null;case 12:r=null!=a&&a.width===t.width&&a.height===t.height?a:t,e.next=16;break;case 15:r=t;case 16:return e.abrupt("return",mae(r,n));case 17:case"end":return e.stop()}}),e,null,[[3,9]])}))),yae.apply(this,arguments)}function bae(e){if(2!==e.rank&&3!==e.rank)throw new Error("toPixels only supports rank 2 or 3 tensors, got rank ".concat(e.rank,"."));var t=2===e.rank?1:e.shape[2];if(t>4||2===t)throw new Error("toPixels only supports depth of size "+"1, 3 or 4 but got ".concat(t));if("float32"!==e.dtype&&"int32"!==e.dtype)throw new Error("Unsupported type for toPixels: ".concat(e.dtype,".")+" Please use float32 or int32 tensors.")}function xae(){return xae=c(o().mark((function e(t,n){var r,a,i,s,u,c,l,h,p,f,d,v,m,g,y,b,x;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=L5(t,"img","toPixels"),t instanceof n5||(r=X6(a=r,"int32"),a.dispose()),bae(r),i=r.shape.slice(0,2),s=S(i,2),u=s[0],c=s[1],l=2===r.rank?1:r.shape[2],e.next=7,r.data();case 7:h=e.sent,p="float32"===r.dtype?255:1,f=new Uint8ClampedArray(c*u*4),d=0;case 11:if(!(d<u*c)){e.next=36;break}v=[0,0,0,255],m=0;case 14:if(!(m<l)){e.next=28;break}if(g=h[d*l+m],"float32"!==r.dtype){e.next=21;break}if(!(g<0||g>1)){e.next=19;break}throw new Error("Tensor values for a float32 Tensor must be in the "+"range [0 - 1] but encountered ".concat(g,"."));case 19:e.next=24;break;case 21:if("int32"!==r.dtype){e.next=24;break}if(!(g<0||g>255)){e.next=24;break}throw new Error("Tensor values for a int32 Tensor must be in the "+"range [0 - 255] but encountered ".concat(g,"."));case 24:1===l?(v[0]=g*p,v[1]=g*p,v[2]=g*p):v[m]=g*p;case 25:m++,e.next=14;break;case 28:f[(y=4*d)+0]=Math.round(v[0]),f[y+1]=Math.round(v[1]),f[y+2]=Math.round(v[2]),f[y+3]=Math.round(v[3]);case 33:++d,e.next=11;break;case 36:return null!=n&&(vae||(console.warn("tf.browser.toPixels is not efficient to draw tensor on canvas. Please try tf.browser.draw instead."),vae=!0),n.width=c,n.height=u,b=n.getContext("2d"),x=new ImageData(f,c,u),b.putImageData(x,0,0)),r!==t&&r.dispose(),e.abrupt("return",f);case 39:case"end":return e.stop()}}),e)}))),xae.apply(this,arguments)}var kae=B5({fromPixels_:mae}),wae={__proto__:null,draw:function(e,t,n){var r=L5(e,"img","draw");if(!(e instanceof n5)){var a=r;r=X6(a,"int32"),a.dispose()}bae(r),function(e){var t=(null==e?void 0:e.alpha)||1;if(t>1||t<0)throw new Error("Alpha value ".concat(t," is suppoed to be in range [0 - 1]."))}(null==n?void 0:n.imageOptions);var i={image:r},o={canvas:t,options:n};E5.runKernel(x1,i,o)},fromPixels:kae,fromPixelsAsync:function(e){return yae.apply(this,arguments)},toPixels:function(e,t){return xae.apply(this,arguments)}};function Iae(e,t){var n=e.shape.length,r=t.shape.length;if(n<1)throw new Error("tf.gatherND() expects the input to be rank 1 or higher,"+" but the rank was ".concat(n,"."));if(r<1)throw new Error("tf.gatherND() expects the indices to be rank 1 or higher,"+" but the rank was ".concat(r,"."));if("int32"!==t.dtype)throw new Error("tf.gatherND() expects the indices to be int32 type,"+" but the dtype was ".concat(t.dtype,"."));if(t.shape[r-1]>n)throw new Error("index innermost dimension length must be <= tensor rank; saw: "+"".concat(t.shape[r-1]," vs. ").concat(n));if(0===L$(e.shape))throw new Error("Requested more than 0 entries, but input is empty."+" Input shape: ".concat(e.shape,"."));for(var a=t.shape,i=a[a.length-1],o=1,s=0;s<a.length-1;++s)o*=a[s];var u=e.shape,c=a.slice();c.pop();for(var l=1,h=i;h<n;++h)l*=u[h],c.push(u[h]);var p=[].concat(T(i0(e.shape).map((function(e){return e/l}))),[1]).slice(0,i);return[c,o,l,p]}var Nae={__proto__:null,prepareAndValidate:Iae};function Sae(e,t,n){var r=e.shape.length;F$(r===t.length,(function(){return"Error in slice".concat(r,"D: Length of begin ").concat(t," must ")+"match the rank of the array (".concat(r,").")})),F$(r===n.length,(function(){return"Error in slice".concat(r,"D: Length of size ").concat(n," must ")+"match the rank of the array (".concat(r,").")}));for(var a=function(a){F$(t[a]+n[a]<=e.shape[a],(function(){return"Error in slice".concat(r,"D: begin[").concat(a,"] + size[").concat(a,"] ")+"(".concat(t[a]+n[a],") would overflow input.shape[").concat(a,"] (").concat(e.shape[a],")")}))},i=0;i<r;++i)a(i)}function Tae(e,t,n){for(var r=[],a=0;a<e.length;a++)r[a]=Math.ceil((t[a]-e[a])/n[a]);return r}function Eae(e,t,n,r){for(var a=T(e),i=a.length;i<r.length;i++)a.push(1);for(var o=0;o<n;o++)0===o?a[t]=1:(a.splice(t,0,1),a.pop());return a}function Cae(e,t,n){return n<=e?n:n-(t-1)}function Aae(e,t){for(var n=[],r=0;r<e;r++)n.push(t+r);return n}function Rae(e,t,n,r,a){for(var i=T(a),o=Aae(n,t),s=0;s<i.length;s++)if(o.indexOf(s)>-1)i[s]=0;else{var u=Cae(t,n,s),c=r[u];e&1<<u&&(c=0),i[s]=c}return i}function _ae(e,t,n,r,a){for(var i=T(a),o=Aae(n,t),s=0;s<i.length;s++)if(o.indexOf(s)>-1)i[s]=Number.MAX_SAFE_INTEGER;else{var u=Cae(t,n,s),c=r[u];e&1<<u&&(c=Number.MAX_SAFE_INTEGER),i[s]=c}for(var l=0;l<i.length;l++){var h=a[l];i[l]<0&&(i[l]+=h),i[l]=A$(0,i[l],a[l])}return i}function Oae(e,t,n){var r=e[t];return(n&1<<t||null==r)&&(r=1),r}function Fae(e,t,n,r,a,i){var o=t[a],s=n[a]||1;(e&1<<a||i&1<<a||null==o)&&(o=s>0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);var u=r[a];return o<0&&(o+=u),o=A$(0,o,u-1)}function Dae(e,t,n,r,a,i){var o=t[a],s=n[a]||1;(e&1<<a||i&1<<a||null==o)&&(o=s>0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);var u=r[a];return o<0&&(o+=u),o=s>0?A$(0,o,u):A$(-1,o,u-1)}function Mae(e,t,n){for(var r=n.length,a=0;a<n.length;a++)if(n[a]>1){r=a;break}for(var i=r+1;i<n.length;i++)if(t[i]>0||n[i]!==e[i])return!1;return!0}function Lae(e,t){for(var n=e.length>0?e[e.length-1]:1,r=0;r<e.length-1;r++)n+=e[r]*t[r];return n}function zae(e,t,n){var r,a,i=e.shape.length;return(r="number"==typeof t?[t].concat(T(new Array(i-1).fill(0))):t.length<i?t.concat(new Array(i-t.length).fill(0)):t.slice()).forEach((function(e){F$(-1!==e,(function(){return"slice() does not support negative begin indexing."}))})),a=(a=null==n?new Array(i).fill(-1):"number"==typeof n?[n].concat(T(new Array(i-1).fill(-1))):n.length<i?n.concat(new Array(i-n.length).fill(-1)):n).map((function(t,n){return t>=0?t:(F$(-1===t,(function(){return"Negative size values should be exactly -1 but got "+"".concat(t," for the slice() size at index ").concat(n,".")})),e.shape[n]-r[n])})),[r,a]}function Pae(e,t,n,r,a,i,o,s,u){var c;if(null==r?(c=new Array(t.length)).fill(1):c=r,null!=o&&0!=(o&o-1))throw new Error("Multiple ellipses in slice is not allowed.");for(var l=!1,h={dims:c.length,numAddAxisAfterEllipsis:0,begin:t.slice(),end:n.slice(),strides:c.slice(),beginMask:a,endMask:i,ellipsisMask:o,newAxisMask:s,shrinkAxisMask:u},p=0;p<h.dims;p++)l&&0!=(1<<p&s)&&h.numAddAxisAfterEllipsis++,1<<p&o&&(l=!0);l||(h.ellipsisMask|=1<<h.dims,h.dims++);var f={dims:e.length,beginMask:0,endMask:0,beginValid:!1,endValid:!1};!function(e,t){t.beginMask=0,t.endMask=0,t.shrinkAxisMask=0;var n=0;t.beginValid=null!=e.begin,t.endValid=null!=e.end,t.begin=new Array(t.dims),t.end=new Array(t.dims),t.strides=new Array(t.dims),t.finalShapeGatherIndices=[],t.finalShapeGatherIndicesSparse=[],t.inputShapeGatherIndicesSparse=new Array(t.dims);for(var r=0;r<e.dims;r++)if(1<<r&e.ellipsisMask)for(var a=Math.min(t.dims-(e.dims-r)+1+e.numAddAxisAfterEllipsis,t.dims);n<a;n++)t.begin[n]=0,t.end[n]=0,t.strides[n]=1,t.beginMask|=1<<n,t.endMask|=1<<n,t.finalShapeGatherIndices.push(n),t.finalShapeGatherIndicesSparse.push(-1),t.inputShapeGatherIndicesSparse[n]=r;else if(1<<r&e.newAxisMask)t.finalShapeGatherIndices.push(-2),t.finalShapeGatherIndicesSparse.push(-1);else{if(n===t.begin.length)throw Error("Index out of range using input dim ".concat(n,"; input ")+"has only ".concat(t.dims," dims, ").concat(t.begin.length,"."));null!=e.begin&&(t.begin[n]=e.begin[r]),null!=e.end&&(t.end[n]=e.end[r]),t.strides[n]=e.strides[r],e.beginMask&1<<r&&(t.beginMask|=1<<n),e.endMask&1<<r&&(t.endMask|=1<<n),e.shrinkAxisMask&1<<r?(t.finalShapeGatherIndices.push(-1),t.finalShapeGatherIndicesSparse.push(-1),t.shrinkAxisMask|=1<<n):(t.finalShapeGatherIndices.push(n),t.finalShapeGatherIndicesSparse.push(r)),t.inputShapeGatherIndicesSparse[n]=r,n++}}(h,f);for(var d=!0,v=!0,m=!0,g=[],y=[],b=0;b<e.length;++b){if(0===f.strides[b])throw Error("strides[".concat(b,"] must be non-zero"));var x=!!(f.shrinkAxisMask&1<<b),k=e[b];if(-1!==k){var w=[f.beginMask&1<<b,f.endMask&1<<b],I=[f.strides[b]>0?0:-1,f.strides[b]>0?k:k-1];if(x&&f.strides[b]<=0)throw Error("only stride 1 allowed on non-range indexing.");m=m&&1===f.strides[b];var N=!!(f.beginMask&1<<b&&f.endMask&1<<b);if(f.beginValid&&f.endValid){if(x){var S=f.begin[b]<0?k+f.begin[b]:f.begin[b];if(f.begin[b]=S,f.end[b]=f.begin[b]+1,S<0||S>=k)throw Error("slice index ".concat(f.begin[b]," of dimension ").concat(b," out of bounds."))}else f.begin[b]=Bae(f.begin[b],0,f.strides[b],k,w,I),f.end[b]=Bae(f.end[b],1,f.strides[b],k,w,I);var T=1===f.strides[b]&&0===f.begin[b]&&f.end[b]===k;d=d&&T,v=v&&(0===b&&1===f.strides[b]||T)}else d=d&&1===f.strides[b]&&N,v=v&&(0===b&&1===f.strides[b]||N);var E=void 0,C=!1;if(f.beginValid&&f.endValid?(E=f.end[b]-f.begin[b],C=!0):x?(E=1,C=!0):N&&k>=0&&(E=f.strides[b]<0?-k:k,C=!0),C){var A=void 0;A=0===E||E<0!=f.strides[b]<0?0:Math.trunc(E/f.strides[b])+(E%f.strides[b]!=0?1:0),g.push(A)}else g.push(-1)}else g.push(x?1:-1)}for(var R=0;R<f.finalShapeGatherIndices.length;++R){var _=f.finalShapeGatherIndices[R];_>=0?y.push(g[_]):-2===_&&y.push(1)}var O=y.filter((function(e,t){return-2!==f.finalShapeGatherIndices[t]}));return{finalShapeSparse:O,finalShape:y,isIdentity:d,sliceDim0:v,isSimpleSlice:m,begin:f.begin,end:f.end,strides:f.strides}}function Bae(e,t,n,r,a,i){if(a[t])return n>0?i[t]:i[t+1&1];var o=e<0?r+e:e;return o<i[0]?i[0]:o>i[1]?i[1]:o}var Wae,Vae={__proto__:null,assertParamsValid:Sae,computeFlatOffset:Lae,computeOutShape:Tae,getNormalizedAxes:function(e,t,n,r,a,i,o,s,u){var c=e.length,l=new Array(c),h=new Array(c),p=new Array(c);if(t.length&&n>0){var f=t[0],d=n+1;l=Rae(o,f,d,r,e),h=_ae(s,f,d,a,e),p=Eae(i,f,d,e)}else for(var v=0;v<c;v++)l[v]=Fae(o,r,i,e,v,u),h[v]=Dae(s,a,i,e,v,u),p[v]=Oae(i,v,u);return{begin:l,end:h,strides:p}},isSliceContinous:Mae,maskToAxes:function(e){for(var t=[],n=0;e>0;)1&e&&t.push(n),e/=2,n++;return t},parseSliceParams:zae,sliceInfo:Pae,startForAxis:Fae,startIndicesWithElidedDims:Rae,stopForAxis:Dae,stopIndicesWithElidedDims:_ae,stridesForAxis:Oae,stridesWithElidedDims:Eae},Uae="4.6.0",Gae=function(){function e(){l(this,e)}return p(e,null,[{key:"sgd",value:function(e){return new Gre(e)}},{key:"momentum",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return new jre(e,t,n)}},{key:"rmsprop",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.9,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return new Hre(e,t,n,r,a)}},{key:"adam",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.001,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.9,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.999,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return new Vre(e,t,n,r)}},{key:"adadelta",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.001,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.95,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return new Bre(e,t,n)}},{key:"adamax",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.002,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.9,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.999,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return new Ure(e,t,n,r,a)}},{key:"adagrad",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.1;return new Wre(e,t)}}]),e}(),jae=Gae,Hae="undefined"!=typeof requestAnimationFrame?requestAnimationFrame:"undefined"!=typeof setImmediate?setImmediate:function(e){return e()};function qae(){return new Promise((function(e){return Hae((function(){return e()}))}))}function Kae(e,t){var n=e[0].length;e.forEach((function(e,t){F$(e.length===n,(function(){return"Error in concat".concat(n,"D: rank of tensors[").concat(t,"] must be the same ")+"as the rank of the rest (".concat(n,")")}))})),F$(t>=0&&t<n,(function(){return"Error in concat".concat(n,"D: axis must be between 0 and ").concat(n-1,".")}));var r=e[0];e.forEach((function(e,a){for(var i=0;i<n;i++)F$(i===t||e[i]===r[i],(function(){return"Error in concat".concat(n,"D: Shape of tensors[").concat(a,"] (").concat(e,") ")+"does not match the shape of the rest (".concat(r,") ")+"along the non-concatenated axis ".concat(a,".")}))}))}function Xae(e,t){for(var n=e[0].slice(),r=1;r<e.length;r++)n[t]+=e[r][t];return n}function Yae(e,t,n){var r=new Array;if(null==n&&null==t)return r;if(null==t)for(;r.length<e+n.length;)r.push(-1);else r=t.slice();if(null==n)return r;if(e+n.length!==r.length)throw new Error("rt input.shape and shape=".concat(t," are incompatible: rt input.rank = ").concat(e+n.length,", but shape.rank = ").concat(r.length));for(var a=1;a<n.length;++a){var i=n[a],o=r[r.length-n.length+a],s=r[o];if(i>=0)if(s>=0){if(s!==i)throw new Error("rt input.shape and shape=".concat(t," are incompatible: rt input.shape[").concat(a+e,"] = ").concat(i," but shape[").concat(a+e,"] = ").concat(s))}else r[o]=i}return r}function Jae(e){var t,n={FIRST_DIM_SIZE:Wae.FIRST_DIM_SIZE,VALUE_ROWIDS:Wae.VALUE_ROWIDS,ROW_LENGTHS:Wae.ROW_LENGTHS,ROW_SPLITS:Wae.ROW_SPLITS,ROW_LIMITS:Wae.ROW_LIMITS,ROW_STARTS:Wae.ROW_STARTS},r=[],a=O(e);try{for(a.s();!(t=a.n()).done;){var i=t.value;if(!(i in n))break;r.push(n[i])}}catch(e){a.e(e)}finally{a.f()}return r}function Zae(e){return 0===e.length?0:e[0]===Wae.FIRST_DIM_SIZE?e.length-1:e.length}function Qae(e,t){if(null!=e&&null!=t){var n=e.length,r=t.length;if(n>=r)throw new Error("defaultValue.shape=".concat(e," and ragged tensor flatValues.shape=").concat(t,", are incompatible: defaultValue.rank = ").concat(n," must be less than ragged tensor input flatValues.rank = ").concat(r,")"));for(var a=0;a<Math.min(n,r-1);++a){var i=e[a],o=t[a+1];if(i>=0&&o>=0&&1!==i&&i!==o)throw new Error("defaultValue.shape=".concat(e,", and ragged tensor input flatValues.shape=").concat(t," are incompatible: defaultValue.shape[").concat(a-e.length,"] = ").concat(i," but ragged tensor input.flatValues.shape[").concat(a-e.length,"] = ").concat(o))}}}!function(e){e[e.FIRST_DIM_SIZE=0]="FIRST_DIM_SIZE",e[e.VALUE_ROWIDS=1]="VALUE_ROWIDS",e[e.ROW_LENGTHS=2]="ROW_LENGTHS",e[e.ROW_SPLITS=3]="ROW_SPLITS",e[e.ROW_LIMITS=4]="ROW_LIMITS",e[e.ROW_STARTS=5]="ROW_STARTS"}(Wae||(Wae={}));function $ae(e){return e<=30?e:a0(e,Math.floor(Math.sqrt(e)))}function eie(e,t,n){return[n*("number"==typeof e?e:e[0]),t*("number"==typeof e?e:e[1])]}function tie(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=[];if(r)(a=a.concat(t.slice(0))).push(e[0]/n),a=a.concat(e.slice(1));else{a=a.concat(e[0]);for(var i=t.length,o=0;o<i;++o)a=a.concat([e[o+1]/t[o],t[o]]);a=a.concat(e.slice(i+1))}return a}function nie(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=[];if(n){r.push(t);for(var a=t+1;a<e;++a)a<=2*t?(r.push(a),r.push(a-(t+1))):r.push(a)}else{for(var i=[],o=[],s=1;s<e;++s)s>=2*t+1||s%2==1?o.push(s):i.push(s);r.push.apply(r,i),r.push(0),r.push.apply(r,o)}return r}function rie(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=[];r?a.push(e[0]/n):a.push(e[0]*n);for(var i=1;i<e.length;++i)i<=t.length?r?a.push(t[i-1]*e[i]):a.push(e[i]/t[i-1]):a.push(e[i]);return a}function aie(e,t){for(var n=[0],r=0;r<t;++r)n.push(e[r][0]);return n}function iie(e,t,n){for(var r=e.slice(0,1),a=0;a<n;++a)r.push(e[a+1]-t[a][0]-t[a][1]);return r}var oie=1.7580993408473768,sie=1.0507009873554805,uie=.3275911,cie=.254829592,lie=-.284496736,hie=1.421413741,pie=-1.453152027,fie=1.061405429;function die(e,t){if(e.length!==t.length)throw new Error("Cannot merge real and imag arrays of different lengths. real:"+"".concat(e.length,", imag: ").concat(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 vie(e){for(var t=new Float32Array(e.length/2),n=new Float32Array(e.length/2),r=0;r<e.length;r+=2)t[r/2]=e[r],n[r/2]=e[r+1];return{real:t,imag:n}}function mie(e){for(var t=Math.ceil(e.length/4),n=new Float32Array(t),r=new Float32Array(t),a=0;a<e.length;a+=4)n[Math.floor(a/4)]=e[a],r[Math.floor(a/4)]=e[a+1];return{real:n,imag:r}}function gie(e){for(var t=Math.floor(e.length/4),n=new Float32Array(t),r=new Float32Array(t),a=2;a<e.length;a+=4)n[Math.floor(a/4)]=e[a],r[Math.floor(a/4)]=e[a+1];return{real:n,imag:r}}function yie(e,t){return{real:e[2*t],imag:e[2*t+1]}}function bie(e,t,n,r){e[2*r]=t,e[2*r+1]=n}function xie(e,t){for(var n=new Float32Array(e/2),r=new Float32Array(e/2),a=0;a<Math.ceil(e/2);a++){var i=(t?2:-2)*Math.PI*(a/e);n[a]=Math.cos(i),r[a]=Math.sin(i)}return{real:n,imag:r}}function kie(e,t,n){var r=(n?2:-2)*Math.PI*(e/t);return{real:Math.cos(r),imag:Math.sin(r)}}var wie="->",Iie=/->/g;function Nie(e,t){var n=((e=e.replace(/\s/g,"")).length-e.replace(Iie,"").length)/wie.length;if(n<1)throw new Error("Equations without an arrow are not supported.");if(n>1)throw new Error('Equation must contain exactly one arrow ("'.concat(wie,'").'));var r=S(e.split(wie),2),a=r[0],i=r[1];F$(-1===a.indexOf("..."),(function(){return'The ellipsis notation ("'.concat("...",'") is not supported yet.')}));var o=a.split(","),s=o.length;if(t!==s)throw new Error("Expected ".concat(s," input tensors, received ").concat(t));if(s>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");for(var u=[],c=function(){var e=i[l];if(!o.some((function(t){return-1!==t.indexOf(e)})))throw new Error("Output subscripts contain the label ".concat(e," ")+"not present in the input subscripts.");-1===u.indexOf(e)&&u.push(e)},l=0;l<i.length;++l)c();for(var h=0;h<a.length;++h){var p=a[h];-1===u.indexOf(p)&&","!==p&&u.push(p)}for(var f=new Array(o.length),d=0;d<s;++d){if(new Set(o[d].split("")).size!==o[d].length)throw new Error("Found duplicate axes in input component ".concat(o[d],". ")+"Support for duplicate axes in input is not implemented yet.");f[d]=[];for(var v=0;v<o[d].length;++v)f[d].push(u.indexOf(o[d][v]))}for(var m=u.length,g=[],y=i.length;y<m;++y)g.push(y);return{allDims:u,summedDims:g,idDims:f}}function Sie(e,t){var n=new Array(e);n.fill(-1);for(var r=0;r<t.length;++r)n[t[r]]=r;for(var a=[],i=0;i<e;++i)-1===n[i]&&a.push(i);return{permutationIndices:n=n.filter((function(e){return-1!==e})),expandDims:a}}function Tie(e,t,n){for(var r=new Array(e),a=function(e){for(var a=n[e].shape,i=function(n){void 0===r[t[e][n]]?r[t[e][n]]=a[n]:F$(r[t[e][n]]===a[n],(function(){return"Expected dimension ".concat(r[t[e][n]]," at axis ").concat(n," ")+"of input shaped ".concat(JSON.stringify(a),", ")+"but got dimension ".concat(a[n])}))},o=0;o<t[e].length;++o)i(o)},i=0;i<n.length;++i)a(i)}function Eie(e,t){var n,r=e,a=[];0===e.length&&r.push(-1),n=e.length+1;for(var i=0;i<n;++i)a.push([]);for(var o=[],s=0;s<r.length;++s){var u,c=O(Aie(t,r[s]));try{for(c.s();!(u=c.n()).done;){var l=u.value;-1===o.indexOf(l)&&(a[s].push(l),o.push(l))}}catch(e){c.e(e)}finally{c.f()}}return{path:r,steps:a}}function Cie(e){return e.every((function(e,t){return e===t}))}function Aie(e,t){for(var n=[],r=0;r<e.length;++r)0!==e[r].length&&-1===e[r].indexOf(t)&&-1!==t||n.push(r);return n}function Rie(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[];if("number"==typeof t)F$(e.shape[n]%t==0,(function(){return"Number of splits must evenly divide the axis."})),r=new Array(t).fill(e.shape[n]/t);else{var a=t.reduce((function(e,t){return-1===t&&(e+=1),e}),0);F$(a<=1,(function(){return"There should be only one negative value in split array."}));var i=t.indexOf(-1);if(-1!==i){var o=t.reduce((function(e,t){return t>0?e+t:e}));t[i]=e.shape[n]-o}F$(e.shape[n]===t.reduce((function(e,t){return e+t})),(function(){return"The sum of sizes must match the size of the axis dimension."})),r=t}return r}function _ie(e){return"Received SparseTensor with denseShape[0] = 0 but\n indices.shape[0] = ".concat(e)}function Oie(e,t){return"indices(".concat(e,", 0) is invalid: ").concat(t," < 0")}function Fie(e,t,n){return"indices(".concat(e,", 0) is invalid: ").concat(t," >= ").concat(n)}function Die(e,t){return"only one output dimension may be -1, not both ".concat(e," and ").concat(t)}function Mie(e,t){return"size ".concat(e," must be non-negative, not ").concat(t)}function Lie(){return"reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero"}function zie(e,t){var n=L$(e),r=L$(t);return"Input to reshape is a SparseTensor with ".concat(n,"\n dense values, but the requested shape requires a multiple of ").concat(r,". inputShape=").concat(e," outputShape= ").concat(t)}function Pie(e,t){var n=L$(e),r=L$(t);return"Input to reshape is a tensor with ".concat(n," dense values, but the requested shape has ").concat(r,". inputShape=").concat(e," outputShape=").concat(t)}function Bie(){return"segment ids must be >= 0"}function Wie(){return"segment ids are not increasing"}function Vie(e,t){return"Segment id ".concat(e," out of range [0, ").concat(t,"), possibly because segmentIds input is not sorted.")}function Uie(e,t,n){return"Bad: indices[".concat(e,"] == ").concat(t," out of range [0, ").concat(n,")")}function Gie(e,t){var n,r=!1;for(e<=30?(n=e,r=!0):n=a0(e,Math.floor(Math.sqrt(e)));!r;)n>t||n===e?r=!0:n=a0(e,n+1);return n}function jie(e,t,n){for(var r=[],a=e.length,i=0;i<a;i++)i!==t?r.push(e[i]):r.push(n);return r}function Hie(e,t,n,r){var a=t.shape.length,i=e.shape.length;if(0!==r&&(r<-a||r>a))throw new Error("Expect batchDims in the range of [-".concat(a,", ").concat(a,"], but got ").concat(r));if(r<0&&(r+=a),r>i)throw new Error("batchDims (".concat(r,") must be less than rank(x) (\n ").concat(i,")."));if(n<r)throw new Error("batchDims (".concat(r,") must be less than or equal to axis (").concat(n,")."));for(var o=0;o<r;++o)if(e.shape[o]!==t.shape[o])throw new Error("x.shape[".concat(o,"]: ").concat(e.shape[o]," should be equal to indices.shape[").concat(o,"]: ").concat(t.shape[o],"."));for(var s=e.shape[n],u=[],c=1,l=1,h=1,p=0;p<r;++p)u.push(e.shape[p]),c*=e.shape[p];for(var f=r;f<n;f++)u.push(e.shape[f]),l*=e.shape[f];for(var d=r;d<a;d++)u.push(t.shape[d]);for(var v=n+1;v<i;v++)u.push(e.shape[v]),h*=e.shape[v];return{batchSize:c,sliceSize:h,outerSize:l,dimSize:s,outputShape:u}}function qie(e){try{return e.map((function(e){return W4(e)}))}catch(e){throw new Error("Failed to decode encoded string bytes into utf-8, error: ".concat(e))}}function Kie(e){return e.map((function(e){return B4(e)}))}var Xie={__proto__:null,ERF_A1:cie,ERF_A2:lie,ERF_A3:hie,ERF_A4:pie,ERF_A5:fie,ERF_P:uie,PARALLELIZE_THRESHOLD:30,get RowPartitionType(){return Wae},SELU_SCALE:sie,SELU_SCALEALPHA:oie,applyActivation:gne,assertAndGetBroadcastShape:A7,assertAxesAreInnerMostDims:j7,assertParamsConsistent:Kae,assignToTypedArray:bie,axesAreInnerMostDims:W7,calculateShapes:Ute,checkEinsumDimSizes:Tie,checkPadOnDimRoundingMode:B8,combineLocations:V7,combineRaggedTensorToTensorShapes:Yae,complexWithEvenIndex:mie,complexWithOddIndex:gie,computeConv2DInfo:T8,computeConv3DInfo:E8,computeDefaultPad:C8,computeDilation2DInfo:I8,computeOptimalWindowSize:$ae,computeOutAndReduceShapes:U7,computeOutShape:Xae,computePool2DInfo:N8,computePool3DInfo:S8,convertConv2DDataFormat:P8,decodeEinsumEquation:Nie,eitherStridesOrDilationsAreOne:L8,expandShapeToKeepDim:G7,exponent:kie,exponents:xie,fromStringArrayToUint8:Kie,fromUint8ToStringArray:qie,getAxesPermutation:H7,getBroadcastDims:E7,getComplexWithIndex:yie,getEinsumComputePath:Eie,getEinsumPermutation:Sie,getFusedBiasGradient:mne,getFusedDyActivation:vne,getImageCenter:eie,getInnerMostAxes:K7,getPermuted:nie,getRaggedRank:Zae,getReductionAxes:C7,getReshaped:tie,getReshapedPermuted:rie,getRowPartitionTypesHelper:Jae,getSliceBeginCoords:aie,getSliceSize:iie,getSparseFillEmptyRowsIndicesDenseShapeMismatch:_ie,getSparseFillEmptyRowsNegativeIndexErrorMessage:Oie,getSparseFillEmptyRowsOutOfRangeIndexErrorMessage:Fie,getSparseReshapeEmptyTensorZeroOutputDimErrorMessage:Lie,getSparseReshapeInputOutputMismatchErrorMessage:Pie,getSparseReshapeInputOutputMultipleErrorMessage:zie,getSparseReshapeMultipleNegativeOneOutputDimErrorMessage:Die,getSparseReshapeNegativeOutputDimErrorMessage:Mie,getSparseSegmentReductionIndicesOutOfRangeErrorMessage:Uie,getSparseSegmentReductionNegativeSegmentIdsErrorMessage:Bie,getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage:Wie,getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage:Vie,getUndoAxesPermutation:q7,isIdentityPermutation:Cie,log:function(){var e;k0().getBool("IS_TEST")||k0().getBool("PROD")||(e=console).log.apply(e,arguments)},mergeRealAndImagArrays:die,prepareAndValidate:Iae,prepareSplitSize:Rie,segment_util:{__proto__:null,collectGatherOpShapeInfo:Hie,computeOutShape:jie,segOpComputeOptimalWindowSize:Gie},shouldFuse:yne,slice_util:Vae,splitRealAndImagArrays:vie,stridesOrDilationsArePositive:z8,tupleValuesAreOne:M8,upcastType:h5,validateDefaultValueShape:Qae,validateInput:Vte,validateUpdateShape:Wte,warn:z3},Yie={__proto__:null,nonMaxSuppressionV3Impl:zne,nonMaxSuppressionV4Impl:Pne,nonMaxSuppressionV5Impl:Bne,whereImpl:Qte};!function(){var e,t=O(qre);try{for(t.s();!(e=t.n()).done;){Lre(e.value)}}catch(e){t.e(e)}finally{t.f()}}();var Jie={kernelName:N0,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return c8(e,_te(X6(n,"float32"),-1))}}}},Zie={kernelName:S0,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){var t=$7(X6(n,"float32")),r=Q7(R9(Z7(1),t));return E9(u8(e,r))}}}},Qie={kernelName:T0,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){var t=Q7(R9($7(X6(n,"float32")),1));return u8(e,t)}}}},$ie={kernelName:E0,inputsToSave:["a","b"],gradFunc:function(e,t){var n=S(t,2),r=n[0],a=n[1],i=A7(r.shape,a.shape);return{a:function(){var t=e,n=C7(r.shape,i);return n.length>0&&(t=e9(t,n)),W8(t,r.shape)},b:function(){var t=e,n=C7(a.shape,i);return n.length>0&&(t=e9(t,n)),W8(t,a.shape)}}}},eoe={kernelName:C0,saveAllInputs:!0,gradFunc:function(e,t){var n={};return t.forEach((function(t,r){n[r]=function(){return e.clone()}})),n}},toe={kernelName:_0,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return F7(n)}}}},noe={kernelName:O0,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return F7(n)}}}},roe={kernelName:F0,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return u8(e,Q7(R9(Z7(1),$7(X6(n,"float32")))))}}}},aoe={kernelName:D0,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){var t=Q7(o8(Z7(1),$7(X6(n,"float32"))));return u8(e,t)}}}},ioe={kernelName:z0,inputsToSave:["a","b"],gradFunc:function(e,t){var n=S(t,2),r=n[0],a=n[1],i=A7(r.shape,a.shape);return{a:function(){var t=o8($7(r),$7(a)),n=c8(e,u8(a,t)),o=C7(r.shape,i);return o.length>0&&(n=e9(n,o)),W8(n,r.shape)},b:function(){var t=o8($7(r),$7(a)),n=E9(c8(e,u8(r,t))),o=C7(a.shape,i);return o.length>0&&(n=e9(n,o)),W8(n,a.shape)}}}},ooe={kernelName:M0,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return u8(e,o8($7(X6(n,"float32")),1))}}}},soe={kernelName:L0,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return u8(e,R9(Z7(1),$7(X6(n,"float32"))))}}}};var uoe=B5({avgPool3dGrad_:function(e,t,n,r,a,i){var o=L5(e,"dy","avgPool3dGrad"),s=L5(t,"input","avgPool3dGrad"),u=o,c=s,l=!1;4===s.rank&&(l=!0,u=W8(o,[1,o.shape[0],o.shape[1],o.shape[2],o.shape[3]]),c=W8(s,[1,s.shape[0],s.shape[1],s.shape[2],s.shape[3]])),F$(5===u.rank,(function(){return"Error in avgPool3dGrad: dy must be rank 5 but got rank "+"".concat(u.rank,".")})),F$(5===c.rank,(function(){return"Error in avgPool3dGrad: input must be rank 5 but got rank "+"".concat(c.rank,".")})),B8("avgPool3dGrad",a,i);var h={dy:u,input:c},p={filterSize:n,strides:r,pad:a,dimRoundingMode:i},f=E5.runKernel(V0,h,p);return l?W8(f,[f.shape[1],f.shape[2],f.shape[3],f.shape[4]]):f}}),coe={kernelName:W0,inputsToSave:["x"],gradFunc:function(e,t,n){var r=S(t,1)[0],a=n.filterSize,i=n.strides,o=n.pad,s=n.dimRoundingMode;return{x:function(){return uoe(e,r,a,i,o,s)}}}};var loe=B5({avgPoolGrad_:function(e,t,n,r,a){var i=L5(e,"dy","avgPoolGrad"),o=L5(t,"input","avgPoolGrad");F$(o.rank===i.rank,(function(){return"Rank of input (".concat(o.rank,") does not match rank of dy (").concat(i.rank,")")}));var s=o,u=i,c=!1;3===o.rank&&(c=!0,s=W8(o,[1,o.shape[0],o.shape[1],o.shape[2]]),u=W8(i,[1,i.shape[0],i.shape[1],i.shape[2]])),F$(4===u.rank,(function(){return"Error in avgPoolGrad: dy must be rank 4 but got rank "+"".concat(u.rank,".")})),F$(4===s.rank,(function(){return"Error in avgPoolGrad: input must be rank 4 but got rank "+"".concat(s.rank,".")}));var l={dy:u,input:s},h={filterSize:n,strides:r,pad:a},p=E5.runKernel(B0,l,h);return c?W8(p,[p.shape[1],p.shape[2],p.shape[3]]):p}}),hoe={kernelName:P0,inputsToSave:["x"],gradFunc:function(e,t,n){var r=S(t,1)[0],a=n.filterSize,i=n.strides,o=n.pad;return{x:function(){return loe(e,r,a,i,o)}}}},poe={kernelName:U0,inputsToSave:["a","b"],gradFunc:function(e,t,n){var r=S(t,2),a=r[0],i=r[1],o=n.transposeA,s=n.transposeB;return o||s?!o&&s?{a:function(){return j8(e,i,!1,!1)},b:function(){return j8(e,a,!0,!1)}}:o&&!s?{a:function(){return j8(i,e,!1,!0)},b:function(){return j8(a,e,!1,!1)}}:{a:function(){return j8(i,e,!0,!0)},b:function(){return j8(e,a,!0,!0)}}:{a:function(){return j8(e,i,!1,!0)},b:function(){return j8(a,e,!0,!1)}}}},foe={kernelName:G0,gradFunc:function(e,t,n){var r=n.blockShape,a=n.crops;return{x:function(){return cee(e,r,a)}}}},doe={kernelName:q0,gradFunc:function(e,t,n){for(var r=n,a=r.inputShape,i=r.shape,o=Array.from(i),s=a.length-1;s>=0;s--)if(a[s]===i[s])o[s]=1;else if(1!==a[s])throw new Error("broadcastTo(): [".concat(a,"] cannot be broadcast to [").concat(i,"]."));for(var u=[],c=0;c<o.length;c++)o[c]>1&&u.push(c);return{x:function(){return e9(e,u,!0)}}}},voe={kernelName:X0,gradFunc:function(e){return{x:function(){return e.clone()}}}},moe={kernelName:Y0,gradFunc:function(e){return{x:function(){return F7(e)}}}},goe={kernelName:J0,inputsToSave:["x"],gradFunc:function(e,t,n){var r=S(t,1)[0],a=n.clipValueMin,i=n.clipValueMax;return{x:function(){return O7(F9(p9(r,a),b9(r,i)),e,F7(e))}}}},yoe={kernelName:Q0,inputsToSave:["x"],gradFunc:Jie.gradFunc},boe={kernelName:$0,saveAllInputs:!0,gradFunc:function(e,t,n){var r=t.map((function(e){return e.shape})),a=j$(n.axis,t[0].shape)[0],i=r.map((function(e){return e[a]}));return Tte(e,i,a).map((function(e){return function(){return e}}))}},xoe={kernelName:e1,inputsToSave:["x","filter"],gradFunc:function(e,t,n){var r=S(t,2),a=r[0],i=r[1],o=n.dilations,s=n.strides,u=n.pad,c=n.dataFormat;return F$(M8(o),(function(){return"Error in gradient of conv2D: dilation rates greater than 1 "+"are not yet supported in gradients. Got dilations '".concat(o,"'")})),{x:function(){return f7(a.shape,e,i,s,u,c)},filter:function(){return dne(a,e,i.shape,s,u,c)}}}},koe={kernelName:n1,inputsToSave:["dy","filter"],gradFunc:function(e,t,n){var r=S(t,2),a=r[0],i=r[1],o=n.strides,s=n.pad,u=n.dataFormat,c=n.dimRoundingMode;return{dy:function(){return h7(e,i,o,s,u,1,c)},filter:function(){return dne(e,a,i.shape,o,s,u,c)}}}};var woe=B5({conv3DBackpropFilter_:function(e,t,n,r,a){var i=e;4===e.rank&&(i=W8(e,[1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]]));var o=t;4===o.rank&&(o=W8(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]])),F$(5===i.rank,(function(){return"Error in conv3dDerFilter: input must be rank 5, but got shape "+"".concat(i.shape,".")})),F$(5===o.rank,(function(){return"Error in conv3dDerFilter: dy must be rank 5, but got shape "+"".concat(o.shape,".")})),F$(5===n.length,(function(){return"Error in conv3dDerFilter: filterShape must be length 5, but got "+"".concat(n,".")})),F$(i.shape[4]===n[3],(function(){return"Error in conv3dDerFilter: depth of input ".concat(i.shape[4],") must ")+"match input depth in filter (".concat(n[3],".")})),F$(o.shape[4]===n[4],(function(){return"Error in conv3dDerFilter: depth of dy (".concat(o.shape[4],") must ")+"match output depth for filter (".concat(n[4],").")}));var s={x:i,dy:o},u={strides:r,pad:a,filterShape:n};return E5.runKernel(a1,s,u)}}),Ioe={kernelName:r1,inputsToSave:["x","filter"],gradFunc:function(e,t,n){var r=n.dilations,a=n.strides,i=n.pad;F$(M8(r),(function(){return"Error in gradient of conv3D: dilation rates greater than 1 are "+"not yet supported in gradients. Got dilations '".concat(r,"'")}));var o=S(t,2),s=o[0],u=o[1];return{x:function(){return m7(s.shape,e,u,a,i)},filter:function(){return woe(s,e,u.shape,a,i)}}}},Noe={kernelName:o1,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return c8(E9(mte(X6(n,"float32"))),e)}}}},Soe={kernelName:s1,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return c8(gte(X6(n,"float32")),e)}}}},Toe={kernelName:c1,inputsToSave:["x"],gradFunc:function(e,t,n){var r=S(t,1)[0],a=n.axis,i=n.exclusive,o=n.reverse;return{x:function(){var t=H7([a],r.rank),n=k7(e,a,i,!o);return null!=t&&(n=rne(n,t)),n}}}},Eoe={kernelName:f1,inputsToSave:["x","filter"],gradFunc:function(e,t,n){var r=n.dilations,a=n.strides,i=n.pad,o=n.dimRoundingMode,s=null==r?[1,1]:r;F$(M8(s),(function(){return"Error in gradient of depthwiseConv2dNative: dilation rates greater than 1 are not yet supported. Got dilations "+"'".concat(s,"'")}));var u=S(t,2),c=u[0],l=u[1];return F$(4===c.rank,(function(){return"Error in gradient of depthwiseConv2dNative: input must be "+"rank 4, but got rank ".concat(c.rank,".")})),F$(4===l.rank,(function(){return"Error in gradient of depthwiseConv2dNative: filter must be "+"rank 4, but got rank ".concat(l.rank,".")})),F$(c.shape[3]===l.shape[2],(function(){return"Error in gradient of depthwiseConv2d: number of input "+"channels (".concat(c.shape[3],") must match the inChannels dimension ")+"in filter ".concat(l.shape[2],".")})),F$(L8(a,s),(function(){return"Error in gradient of depthwiseConv2d: Either strides or "+"dilations must be 1. Got strides ".concat(a," and dilations ")+"'".concat(s,"'.")})),B8("depthwiseConv2d",i,o),{x:function(){return kne(c.shape,e,l,a,i,s,o)},filter:function(){return xne(c,e,l.shape,a,i,s,o)}}}},Coe={kernelName:g1,inputsToSave:["x","filter"],gradFunc:function(e,t,n){var r=S(t,2),a=r[0],i=r[1],o={x:a,filter:i,dy:e},s={x:a,filter:i,dy:e};return{x:function(){return E5.runKernel(y1,o,n)},filter:function(){return E5.runKernel(b1,s,n)}}}},Aoe={kernelName:I1,outputsToSave:[!0],gradFunc:function(e,t){var n={dy:e,y:S(t,1)[0]};return{x:function(){return E5.runKernel(N1,n)}}}},Roe={kernelName:S1,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0],r=c8(a9(E9($7(n))),2/Math.sqrt(Math.PI));return{x:function(){return c8(e,r)}}}},_oe={kernelName:E1,outputsToSave:[!0],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return c8(e,n)}}}},Ooe={kernelName:C1,inputsToSave:["input"],gradFunc:function(e,t){var n=S(t,1)[0];return{input:function(){return W8(e,n.shape)}}}},Foe={kernelName:A1,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return c8(e,a9(n))}}}},Doe={kernelName:F1,gradFunc:function(e){return{x:function(){return F7(e)}}}},Moe={kernelName:D1,inputsToSave:["a","b"],gradFunc:function(e,t){var n=S(t,2),r=n[0],a=n[1],i=A7(r.shape,a.shape);return{a:function(){var t=u8(e,X6(a,"float32")),n=C7(r.shape,i);return n.length>0?W8(e9(t,n),r.shape):t},b:function(){var t=c8(e,X6(r,"float32")),n=C7(a.shape,i);n.length>0&&(t=W8(e9(t,n),a.shape));var o=$7(a);return E9(u8(t,X6(o,"float32")))}}}},Loe={kernelName:M1,inputsToSave:["x","mean","variance","scale"],gradFunc:function(e,t,n){var r=n.varianceEpsilon,a=S(t,4),i=a[0],o=a[1],s=a[2],u=a[3],c=null==u?Z7(1):u,l=C7(o.shape,i.shape),h=[];if(1===o.rank){for(var p=0;p<i.shape.length-1;++p)h.push(i.shape[p]);h.push(1)}var f=R9(i,o),d=c8(e,c),v=lte(o8(s,Z7(r))),m=c8(c8(c8(v,v),v),Z7(-.5));return{x:function(){return 1===o.rank?W8(c8(c8(e,s9(W8(v,[1,1,1,o.shape[0]]),h)),c),i.shape):W8(c8(c8(e,v),c),i.shape)},mean:function(){var e=c8(c8(v,Z7(-1)),d);return 1===o.rank&&(e=e9(e,l)),W8(e,o.shape)},variance:function(){var e=c8(c8(m,f),d);return 1===o.rank&&(e=e9(e,l)),W8(e,o.shape)},scale:function(){var t=c8(f,v),n=c8(e,t);return 1===o.rank&&(n=e9(n,l)),W8(n,o.shape)},offset:function(){var t=e;return 1===o.rank&&(t=e9(t,l)),W8(t,o.shape)}}}},zoe={kernelName:L1,inputsToSave:["x","indices"],gradFunc:function(e,t,n){var r=S(t,2),a=r[0],i=r[1],o=n.axis,s=j$(o,a.shape)[0];return{x:function(){var t=a.shape,n=i.size,r=t.slice(0,s),u=r.length,c=t.slice(o,t.length).slice(1),l=c.length,h=Poe(0,u),p=Poe(u+1,u+1+l),f=Boe([r,[n],c]),d=W8(e,f),v=W8(i,[n]),m=Boe([[u],h,p]),g=rne(d,m),y=Xte(g,v,a.shape[s]),b=q7(m);return y=rne(y,b)},indices:function(){return i}}}};function Poe(e,t){for(var n=[],r=e;r<t;++r)n.push(r);return n}function Boe(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 Woe={kernelName:B1,inputsToSave:["a","b"],gradFunc:function(e,t){var n=S(t,2),r=n[0],a=n[1];return{a:function(){return F7(r)},b:function(){return F7(a)}}}},Voe={kernelName:W1,gradFunc:function(e){return{x:function(){return X6(e,"float32")}}}},Uoe={kernelName:G1,gradFunc:function(e){return{x:function(){return F7(e)}}}},Goe={kernelName:j1,gradFunc:function(e){return{x:function(){return F7(e)}}}},joe={kernelName:H1,gradFunc:function(e){return{x:function(){return F7(e)}}}},Hoe={kernelName:q1,inputsToSave:["x"],gradFunc:function(e,t,n){var r=S(t,1)[0],a=n.alpha,i=h9(r,0);return{x:function(){return O7(i,e,c8(e,a))}}}},qoe={kernelName:Z1,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return u8(e,o8(n,1))}}}},Koe={kernelName:J1,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return u8(e,X6(n,"float32"))}}}},Xoe={kernelName:t2,inputsToSave:[],outputsToSave:[!0],gradFunc:function(e,t,n){var r=S(t,1)[0],a=n.axis;return{logits:function(){var t=a9(r);return R9(e,c8(e9(e,a,!0),t))}}}};var Yoe=B5({localResponseNormalizationBackprop_:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:.5,s={x:e,y:t,dy:n},u={depthRadius:r,bias:a,alpha:i,beta:o};return E5.runKernel(r2,s,u)}}),Joe={kernelName:n2,inputsToSave:["x"],outputsToSave:[!0],gradFunc:function(e,t,n){var r=S(t,2),a=r[0],i=r[1],o=n.depthRadius,s=n.bias,u=n.alpha,c=n.beta;return{x:function(){return Yoe(a,i,e,o,s,u,c)}}}};function Zoe(e,t,n,r){return t.rank<n.rank&&(t=W8(t,G7(t.shape,r))),e.rank<n.rank&&(e=W8(e,G7(e.shape,r))),{x:function(){return c8(e,X6(_7(n,t),e.dtype))}}}var Qoe={kernelName:a2,inputsToSave:["x"],outputsToSave:[!0],gradFunc:function(e,t,n){var r=n.reductionIndices,a=t[0],i=Zoe(e,t[1],a,j$(r,a.shape));return{x:function(){return i.x()}}}},$oe={kernelName:i2,inputsToSave:["a","b"],gradFunc:function(e,t){var n=S(t,2),r=n[0],a=n[1];return{a:function(){return c8(e,X6(p9(r,a),"float32"))},b:function(){return c8(e,X6(y9(r,a),"float32"))}}}};var ese=B5({maxPool3dGrad_:function(e,t,n,r,a,i,o){var s=L5(e,"dy","maxPool3dGrad"),u=L5(t,"input","maxPool3dGrad"),c=L5(n,"output","maxPool3dGrad"),l=s,h=u,p=c,f=!1;4===u.rank&&(f=!0,l=W8(s,[1,s.shape[0],s.shape[1],s.shape[2],s.shape[3]]),h=W8(u,[1,u.shape[0],u.shape[1],u.shape[2],u.shape[3]]),p=W8(c,[1,c.shape[0],c.shape[1],c.shape[2],c.shape[3]])),F$(5===l.rank,(function(){return"Error in maxPool3dGrad: dy must be rank 5 but got rank "+"".concat(l.rank,".")})),F$(5===h.rank,(function(){return"Error in maxPool3dGrad: input must be rank 5 but got rank "+"".concat(h.rank,".")})),F$(5===p.rank,(function(){return"Error in maxPool3dGrad: output must be rank 5 but got rank "+"".concat(p.rank,".")})),B8("maxPool3dGrad",i,o);var d={dy:l,input:h,output:p},v={filterSize:r,strides:a,pad:i,dimRoundingMode:o},m=E5.runKernel(c2,d,v);return f?W8(m,[m.shape[1],m.shape[2],m.shape[3],m.shape[4]]):m}}),tse={kernelName:u2,inputsToSave:["x"],outputsToSave:[!0],gradFunc:function(e,t,n){var r=S(t,2),a=r[0],i=r[1],o=n.filterSize,s=n.strides,u=n.pad,c=n.dimRoundingMode;return{x:function(){return ese(e,a,i,o,s,u,c)}}}};var nse=B5({maxPoolGrad_:function(e,t,n,r,a,i,o){var s=L5(e,"dy","maxPoolGrad"),u=L5(t,"input","maxPoolGrad"),c=L5(n,"output","maxPoolGrad");F$(u.rank===s.rank,(function(){return"Rank of input (".concat(u.rank,") does not match rank of dy ")+"(".concat(s.rank,")")})),F$(4===s.rank,(function(){return"Error in maxPoolGrad: dy must be rank 4 but got rank "+"".concat(s.rank,".")})),F$(4===u.rank,(function(){return"Error in maxPoolGrad: input must be rank 4 but got rank "+"".concat(u.rank,".")})),B8("maxPoolGrad",i,o);var l={dy:s,input:u,output:c},h={filterSize:r,strides:a,pad:i,dimRoundingMode:o};return E5.runKernel(s2,l,h)}}),rse={kernelName:o2,inputsToSave:["x"],outputsToSave:[!0],gradFunc:function(e,t,n){var r=S(t,2),a=r[0],i=r[1],o=n.filterSize,s=n.strides,u=n.pad;return{x:function(){return nse(e,a,i,o,s,u)}}}},ase={kernelName:d2,inputsToSave:["x"],gradFunc:function(e,t,n){var r=t[0],a=n.paddings.map((function(e){return e[0]}));return{x:function(){return q8(e,a,r.shape)}}}},ise={kernelName:T2,inputsToSave:["x"],gradFunc:function(e,t,n){var r=t[0],a=n.paddings.map((function(e){return e[0]}));return{x:function(){return q8(e,a,r.shape)}}}},ose={kernelName:E2,inputsToSave:["a","b"],outputsToSave:[!0],gradFunc:function(e,t){var n=S(t,3),r=n[0],a=n[1],i=n[2],o=r,s=a,u=A7(o.shape,s.shape);return{a:function(){var t=X6(s,"float32"),n=c8(e,c8(t,J7(o,R9(t,Z7(1))))),r=C7(o.shape,u);return r.length>0&&(n=e9(n,r)),W8(n,o.shape)},b:function(){var t=h9(o,0),n=O7(t,w9(o),F7(o)),r=c8(e,c8(i,n)),a=C7(s.shape,u);return a.length>0&&(r=e9(r,a)),W8(r,s.shape)}}}};function sse(e,t,n){var r=e.shape.length,a=r-n.length,i=H7(n,r),o=e;null!=i&&(o=rne(e,i));var s=o.shape.slice(),u=s.splice(r-n.length,n.length).reduce((function(e,t){return e*t}),1);s.push(u);var c=function(e,t,n){var r=e.shape.slice();r[n]=1;var a=W8(t,r),i=x7(e,n,!0,!1),o=x7(e,n,!0,!0),s=c8(i,o);return c8(a,s)}(o.reshape(s),t,a);if(c=c.reshape(o.shape),null!=i){var l=q7(i);c=rne(c,l)}return c}var use={kernelName:J2,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){var t=h9(n,Z7(0)),r=Z7(oie),a=Z7(sie),i=c8(e,a),o=c8(c8(e,r),a9(X6(n,"float32")));return O7(t,i,o)}}}},cse={kernelName:i3,gradFunc:function(e,t,n){var r=n.blockShape,a=n.paddings;return{x:function(){return Y8(e,r,a)}}}},lse={kernelName:o3,gradFunc:function(e,t,n){var r=n.axis;return{x:function(){return G8(e,r)}}}},hse={kernelName:I3,inputsToSave:["x"],gradFunc:function(e,t,n){var r=S(t,1)[0],a=n.reps;return{x:function(){var t=F7(r);if(1===r.rank)for(var n=0;n<a[0];++n)t=o8(t,q8(e,[n*r.shape[0]],[r.shape[0]]));else if(2===r.rank)for(var i=0;i<a[0];++i)for(var o=0;o<a[1];++o)t=o8(t,q8(e,[i*r.shape[0],o*r.shape[1]],[r.shape[0],r.shape[1]]));else if(3===r.rank)for(var s=0;s<a[0];++s)for(var u=0;u<a[1];++u)for(var c=0;c<a[2];++c)t=o8(t,q8(e,[s*r.shape[0],u*r.shape[1],c*r.shape[2]],[r.shape[0],r.shape[1],r.shape[2]]));else{if(4!==r.rank)throw new Error("Gradient for tile operation is not implemented for rank-"+"".concat(r.rank," tensors yet."));for(var l=0;l<a[0];++l)for(var h=0;h<a[1];++h)for(var p=0;p<a[2];++p)for(var f=0;f<a[3];++f)t=o8(t,q8(e,[l*r.shape[0],h*r.shape[1],p*r.shape[2],f*r.shape[3]],[r.shape[0],r.shape[1],r.shape[2],r.shape[3]]))}return t}}}};for(var pse=0,fse=[Jie,Zie,Qie,$ie,eoe,toe,noe,roe,aoe,ioe,ooe,soe,coe,hoe,poe,foe,doe,voe,moe,goe,yoe,boe,koe,xoe,Ioe,Noe,Soe,Toe,Eoe,Coe,{kernelName:k1,inputsToSave:["a","b"],gradFunc:function(e,t){var n=S(t,2),r=n[0],a=n[1],i=A7(r.shape,a.shape);return{a:function(){var t=u8(e,X6(a,"float32")),n=C7(r.shape,i);return n.length>0?W8(e9(t,n),r.shape):t},b:function(){var t=c8(e,X6(r,"float32")),n=C7(a.shape,i);n.length>0&&(t=W8(e9(t,n),a.shape));var o=$7(a);return E9(u8(t,X6(o,"float32")))}}}},Aoe,Roe,_oe,Ooe,Foe,Moe,Doe,Loe,zoe,Woe,Voe,Uoe,Goe,joe,Hoe,qoe,Koe,Xoe,Joe,Qoe,Qoe,$oe,tse,rse,{kernelName:h2,inputsToSave:["x"],gradFunc:function(e,t,n){var r=S(t,1)[0],a=j$(n.axis,r.shape),i=L$(U7(r.shape,a)[1]);return{x:function(){var t=r.shape.slice();a.forEach((function(e){t[e]=1}));var n=W8(e,t);return u8(c8(n,q9(r.shape,"float32")),i)}}}},{kernelName:p2,inputsToSave:["x"],outputsToSave:[!0],gradFunc:function(e,t,n){var r=n.axis,a=S(t,2),i=a[0],o=Zoe(e,a[1],i,j$(r,i.shape));return{x:function(){return o.x()}}}},{kernelName:f2,inputsToSave:["a","b"],gradFunc:function(e,t){var n=S(t,2),r=n[0],a=n[1];return{a:function(){return c8(e,X6(b9(r,a),"float32"))},b:function(){return c8(e,X6(h9(r,a),"float32"))}}}},ase,{kernelName:v2,inputsToSave:["a","b"],gradFunc:function(e,t){var n=S(t,2),r=n[0],a=n[1],i=A7(r.shape,a.shape);return{a:function(){var t=C7(r.shape,i);return t.length>0?W8(e9(e,t),r.shape):e},b:function(){var t=c8(e,E9(c9(u8(r,a)))),n=C7(a.shape,i);return n.length>0?W8(e9(t,n),a.shape):t}}}},{kernelName:g2,inputsToSave:["a","b"],gradFunc:function(e,t){var n=S(t,2),r=n[0],a=n[1],i=A7(r.shape,a.shape);return{a:function(){var t=c8(e,X6(a,"float32")),n=C7(r.shape,i);return n.length>0?W8(e9(t,n),r.shape):t},b:function(){var t=c8(e,X6(r,"float32")),n=C7(a.shape,i);return n.length>0?W8(e9(t,n),a.shape):t}}}},{kernelName:y2,gradFunc:function(e){return{x:function(){return E9(e)}}}},{kernelName:N2,inputsToSave:["indices"],gradFunc:function(e,t){var n=t[0];return{indices:function(){return H9(n.shape,"float32")}}}},{kernelName:I2,gradFunc:function(e){return{x:function(){return F7(e)}}}},{kernelName:S2,saveAllInputs:!0,gradFunc:function(e,t,n){var r=n.axis;return Yte(e,r).map((function(e){return function(){return e}}))}},ise,ise,ose,{kernelName:C2,inputsToSave:["x","alpha"],gradFunc:function(e,t){var n=S(t,2),r=n[0],a=n[1],i=h9(r,0);return{x:function(){return O7(i,e,c8(e,a))},alpha:function(){var t=O7(i,F7(e),c8(e,r)),n=C7(a.shape,e.shape);return n.length>0&&(t=e9(t,n)),W8(t,a.shape)}}}},{kernelName:A2,inputsToSave:["x"],gradFunc:function(e,t,n){var r=S(t,1)[0],a=n.axis,i=[];return i=null==a?r.shape.map((function(e,t){return t})):"number"==typeof a?[a]:a,{x:function(){return sse(r,e,i)}}}},{kernelName:M2,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return u8(e,E9($7(n)))}}}},{kernelName:U2,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0],r=c8(b9(n,6),_te(n));return{x:function(){return c8(e,X6(r,"float32"))}}}},{kernelName:L2,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return c8(e,X6(_te(n),"float32"))}}}},{kernelName:z2,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return W8(e,n.shape)}}}},{kernelName:W2,inputsToSave:["images"],gradFunc:function(e,t,n){var r={dy:e,images:S(t,1)[0]};return{images:function(){return E5.runKernel(V2,r,n)}}}},{kernelName:P2,inputsToSave:["images"],gradFunc:function(e,t,n){var r={dy:e,images:S(t,1)[0]};return{images:function(){return E5.runKernel(B2,r,n)}}}},{kernelName:G2,gradFunc:function(e,t,n){var r=j$(n.dims,e.shape);return{x:function(){return ate(e,r)}}}},{kernelName:j2,gradFunc:function(e){return{x:function(){return F7(e)}}}},{kernelName:H2,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return E9(u8(e,c8(J7(n,1.5),2)))}}}},{kernelName:Y2,inputsToSave:["condition"],gradFunc:function(e,t){var n=S(t,1)[0];return{condition:function(){return X6(F7(n),"float32")},t:function(){return c8(e,X6(n,e.dtype))},e:function(){return c8(e,X6(D9(n),e.dtype))}}}},use,{kernelName:t3,outputsToSave:[!0],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return c8(e,c8(n,R9(Z7(1),n)))}}}},{kernelName:e3,gradFunc:function(e){return{x:function(){return F7(e)}}}},{kernelName:Q2,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return c8(y7(X6(n,"float32")),e)}}}},{kernelName:$2,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return c8(b7(X6(n,"float32")),e)}}}},{kernelName:Z2,inputsToSave:["x"],gradFunc:function(e,t,n){for(var r=S(t,1)[0],a=n.begin,i=n.size,o=r.shape,s=S(zae(r,a,i),2),u=s[0],c=s[1],l=[],h=0;h<e.rank;h++)l.push([u[h],o[h]-u[h]-c[h]]);return{x:function(){return aee(e,l)}}}},{kernelName:s3,outputsToSave:[!0],gradFunc:function(e,t,n){var r=S(t,1)[0],a=n.dim,i=c8(e,r);return{logits:function(){return R9(i,c8(e9(i,[a],true),r))}}}},{kernelName:n3,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return c8(e,H8(n))}}}},cse,cse,lse,lse,{kernelName:r3,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return u8(e,c8(Q7(X6(n,"float32")),2))}}}},{kernelName:f3,inputsToSave:["a","b"],gradFunc:function(e,t){var n=S(t,2),r=n[0],a=n[1],i=Z7(2);return{a:function(){return c8(e,c8(i,R9(r,a)))},b:function(){return c8(e,c8(i,R9(a,r)))}}}},{kernelName:d3,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return c8(e,c8(X6(n,"float32"),2))}}}},{kernelName:_3,gradFunc:function(e){return{x:function(){return F7(e)}}}},{kernelName:x3,inputsToSave:["a","b"],gradFunc:function(e,t){var n=S(t,2),r=n[0],a=n[1],i=A7(r.shape,a.shape);return{a:function(){var t=e,n=C7(r.shape,i);return n.length>0&&(t=e9(t,n)),W8(t,r.shape)},b:function(){var t=e,n=C7(a.shape,i);return n.length>0&&(t=e9(t,n)),W8(E9(t),a.shape)}}}},{kernelName:a3,inputsToSave:["x"],gradFunc:function(e,t,n){var r=S(t,1)[0],a=r.shape.slice();j$(n.axis,r.shape).forEach((function(e){a[e]=1}));var i=W8(e,a),o=c8(i,q9(r.shape,"float32"));return{x:function(){return o}}}},{kernelName:k3,inputsToSave:["x"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return u8(e,$7(y7(n)))}}}},{kernelName:w3,outputsToSave:[!0],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return c8(R9(Z7(1),$7(n)),e)}}}},hse,{kernelName:T3,gradFunc:function(e,t,n){var r=q7(n.perm);return{x:function(){return rne(e,r)}}}},{kernelName:C3,gradFunc:function(e,t,n){var r=n.axis;return{value:function(){return Rte(e,r)}}}},{kernelName:A3,inputsToSave:["segmentIds"],gradFunc:function(e,t){var n=S(t,1)[0];return{x:function(){return function(e,t){for(var n=G9(t,F7(t)),r=l9(e,n),a=p9(t,Z7(0,"int32")),i=r.rank-a.rank,o=0;o<i;++o)a=i9(a,o+1);a=F9(a,q9(r.shape,"bool"));var s=F7(r);return O7(a,r,s)}(e,n)}}}},{kernelName:R3,gradFunc:function(e){return{x:function(){return F7(e)}}}}];pse<fse.length;pse++){j3(fse[pse])}r5().prototype.abs=function(){return this.throwIfDisposed(),l8(this)},r5().prototype.acos=function(){return this.throwIfDisposed(),h8(this)},r5().prototype.acosh=function(){return this.throwIfDisposed(),p8(this)},r5().prototype.add=function(e){return this.throwIfDisposed(),o8(this,e)},r5().prototype.all=function(e,t){return this.throwIfDisposed(),d8(this,e,t)},r5().prototype.any=function(e,t){return this.throwIfDisposed(),v8(this,e,t)},r5().prototype.argMax=function(e){return this.throwIfDisposed(),m8(this,e)},r5().prototype.argMin=function(e){return this.throwIfDisposed(),g8(this,e)},r5().prototype.asScalar=function(){return this.throwIfDisposed(),F$(1===this.size,(function(){return"The array must have only 1 element."})),W8(this,[])},r5().prototype.asType=function(e){return this.throwIfDisposed(),X6(this,e)},r5().prototype.as1D=function(){return this.throwIfDisposed(),W8(this,[this.size])},r5().prototype.as2D=function(e,t){return this.throwIfDisposed(),W8(this,[e,t])},r5().prototype.as3D=function(e,t,n){return this.throwIfDisposed(),W8(this,[e,t,n])},r5().prototype.as4D=function(e,t,n,r){return this.throwIfDisposed(),W8(this,[e,t,n,r])},r5().prototype.as5D=function(e,t,n,r,a){return this.throwIfDisposed(),W8(this,[e,t,n,r,a])},r5().prototype.asin=function(){return this.throwIfDisposed(),y8(this)},r5().prototype.asinh=function(){return this.throwIfDisposed(),b8(this)},r5().prototype.atan=function(){return this.throwIfDisposed(),x8(this)},r5().prototype.atan2=function(e){return this.throwIfDisposed(),k8(this,e)},r5().prototype.atanh=function(){return this.throwIfDisposed(),w8(this)},r5().prototype.avgPool=function(e,t,n,r){return this.throwIfDisposed(),V8(this,e,t,n,r)},r5().prototype.batchToSpaceND=function(e,t){return this.throwIfDisposed(),Y8(this,e,t)},r5().prototype.batchNorm=function(e,t,n,r,a){return this.throwIfDisposed(),J8(this,e,t,n,r,a)},r5().prototype.broadcastTo=function(e){return this.throwIfDisposed(),r7(this,e)},r5().prototype.cast=function(e){return this.throwIfDisposed(),X6(this,e)},r5().prototype.ceil=function(){return this.throwIfDisposed(),a7(this)},r5().prototype.clipByValue=function(e,t){return this.throwIfDisposed(),o7(this,e,t)},r5().prototype.concat=function(e,t){return this.throwIfDisposed(),e instanceof n5&&(e=[e]),G8([this].concat(T(e)),t)},r5().prototype.conv1d=function(e,t,n,r,a,i){return this.throwIfDisposed(),p7(this,e,t,n,r,a,i)},r5().prototype.conv2dTranspose=function(e,t,n,r,a){return this.throwIfDisposed(),d7(this,e,t,n,r,a)},r5().prototype.conv2d=function(e,t,n,r,a,i){return this.throwIfDisposed(),h7(this,e,t,n,r,a,i)},r5().prototype.cos=function(){return this.throwIfDisposed(),y7(this)},r5().prototype.cosh=function(){return this.throwIfDisposed(),b7(this)},r5().prototype.cumprod=function(e,t,n){return this.throwIfDisposed(),x7(this,e,t,n)},r5().prototype.cumsum=function(e,t,n){return this.throwIfDisposed(),k7(this,e,t,n)},r5().prototype.depthToSpace=function(e,t){return this.throwIfDisposed(),I7(this,e,t)},r5().prototype.depthwiseConv2d=function(e,t,n,r,a,i){return this.throwIfDisposed(),N7(this,e,t,n,r,a,i)},r5().prototype.dilation2d=function(e,t,n,r,a){return this.throwIfDisposed(),T7(this,e,t,n,r,a)},r5().prototype.divNoNan=function(e){return this.throwIfDisposed(),D7(this,e)},r5().prototype.div=function(e){return this.throwIfDisposed(),u8(this,e)},r5().prototype.dot=function(e){return this.throwIfDisposed(),M7(this,e)},r5().prototype.elu=function(){return this.throwIfDisposed(),z7(this)},r5().prototype.equal=function(e){return this.throwIfDisposed(),_7(this,e)},r5().prototype.erf=function(){return this.throwIfDisposed(),B7(this)},r5().prototype.euclideanNorm=function(e,t){return this.throwIfDisposed(),r9(this,e,t)},r5().prototype.exp=function(){return this.throwIfDisposed(),a9(this)},r5().prototype.expandDims=function(e){return this.throwIfDisposed(),i9(this,e)},r5().prototype.expm1=function(){return this.throwIfDisposed(),o9(this)},r5().prototype.fft=function(){return this.throwIfDisposed(),Ite(this)},r5().prototype.flatten=function(){return this.throwIfDisposed(),W8(this,[this.size])},r5().prototype.floor=function(){return this.throwIfDisposed(),c9(this)},r5().prototype.floorDiv=function(e){return this.throwIfDisposed(),s8(this,e)},r5().prototype.gather=function(e,t,n){return this.throwIfDisposed(),l9(this,e,t,n)},r5().prototype.greaterEqual=function(e){return this.throwIfDisposed(),p9(this,e)},r5().prototype.greater=function(e){return this.throwIfDisposed(),h9(this,e)},r5().prototype.ifft=function(){return this.throwIfDisposed(),Nte(this)},r5().prototype.irfft=function(){return this.throwIfDisposed(),Ste(this)},r5().prototype.isFinite=function(){return this.throwIfDisposed(),d9(this)},r5().prototype.isInf=function(){return this.throwIfDisposed(),v9(this)},r5().prototype.isNaN=function(){return this.throwIfDisposed(),m9(this)},r5().prototype.leakyRelu=function(e){return this.throwIfDisposed(),g9(this,e)},r5().prototype.lessEqual=function(e){return this.throwIfDisposed(),b9(this,e)},r5().prototype.less=function(e){return this.throwIfDisposed(),y9(this,e)},r5().prototype.localResponseNormalization=function(e,t,n,r){return this.throwIfDisposed(),k9(this,e,t,n,r)},r5().prototype.logSigmoid=function(){return this.throwIfDisposed(),A9(this)},r5().prototype.logSoftmax=function(e){return this.throwIfDisposed(),_9(this,e)},r5().prototype.logSumExp=function(e,t){return this.throwIfDisposed(),O9(this,e,t)},r5().prototype.log=function(){return this.throwIfDisposed(),w9(this)},r5().prototype.log1p=function(){return this.throwIfDisposed(),I9(this)},r5().prototype.logicalAnd=function(e){return this.throwIfDisposed(),F9(this,e)},r5().prototype.logicalNot=function(){return this.throwIfDisposed(),D9(this)},r5().prototype.logicalOr=function(e){return this.throwIfDisposed(),M9(this,e)},r5().prototype.logicalXor=function(e){return this.throwIfDisposed(),L9(this,e)},r5().prototype.matMul=function(e,t,n){return this.throwIfDisposed(),j8(this,e,t,n)},r5().prototype.maxPool=function(e,t,n,r){return this.throwIfDisposed(),W9(this,e,t,n,r)},r5().prototype.max=function(e,t){return this.throwIfDisposed(),X7(this,e,t)},r5().prototype.maximum=function(e){return this.throwIfDisposed(),G9(this,e)},r5().prototype.mean=function(e,t){return this.throwIfDisposed(),j9(this,e,t)},r5().prototype.min=function(e,t){return this.throwIfDisposed(),Y7(this,e,t)},r5().prototype.minimum=function(e){return this.throwIfDisposed(),X9(this,e)},r5().prototype.mirrorPad=function(e,t){return this.throwIfDisposed(),Y9(this,e,t)},r5().prototype.mod=function(e){return this.throwIfDisposed(),J9(this,e)},r5().prototype.mul=function(e){return this.throwIfDisposed(),c8(this,e)},r5().prototype.neg=function(){return this.throwIfDisposed(),E9(this)},r5().prototype.norm=function(e,t,n){return this.throwIfDisposed(),n9(this,e,t,n)},r5().prototype.notEqual=function(e){return this.throwIfDisposed(),eee(this,e)},r5().prototype.oneHot=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.throwIfDisposed(),tee(this,e,t,n)},r5().prototype.onesLike=function(){return this.throwIfDisposed(),nee(this)},r5().prototype.pad=function(e,t){return this.throwIfDisposed(),aee(this,e,t)},r5().prototype.pool=function(e,t,n,r,a,i){return this.throwIfDisposed(),lee(this,e,t,n,r,a,i)},r5().prototype.pow=function(e){return this.throwIfDisposed(),J7(this,e)},r5().prototype.prelu=function(e){return this.throwIfDisposed(),hee(this,e)},r5().prototype.prod=function(e,t){return this.throwIfDisposed(),pee(this,e,t)},r5().prototype.reciprocal=function(){return this.throwIfDisposed(),tte(this)},r5().prototype.relu=function(){return this.throwIfDisposed(),nte(this)},r5().prototype.relu6=function(){return this.throwIfDisposed(),rte(this)},r5().prototype.reshapeAs=function(e){return this.throwIfDisposed(),W8(this,e.shape)},r5().prototype.reshape=function(e){return this.throwIfDisposed(),W8(this,e)},r5().prototype.resizeBilinear=function(e,t,n){return this.throwIfDisposed(),Qne(this,e,t,n)},r5().prototype.resizeNearestNeighbor=function(e,t,n){return this.throwIfDisposed(),$ne(this,e,t,n)},r5().prototype.reverse=function(e){return this.throwIfDisposed(),ate(this,e)},r5().prototype.rfft=function(){return this.throwIfDisposed(),Ete(this)},r5().prototype.round=function(){return this.throwIfDisposed(),cte(this)},r5().prototype.rsqrt=function(){return this.throwIfDisposed(),lte(this)},r5().prototype.selu=function(){return this.throwIfDisposed(),hte(this)},r5().prototype.separableConv2d=function(e,t,n,r,a,i){return this.throwIfDisposed(),pte(this,e,t,n,r,a,i)},r5().prototype.sigmoid=function(){return this.throwIfDisposed(),H8(this)},r5().prototype.sign=function(){return this.throwIfDisposed(),vte(this)},r5().prototype.sin=function(){return this.throwIfDisposed(),mte(this)},r5().prototype.sinh=function(){return this.throwIfDisposed(),gte(this)},r5().prototype.slice=function(e,t){return this.throwIfDisposed(),q8(this,e,t)},r5().prototype.softmax=function(e){return this.throwIfDisposed(),wte(this,e)},r5().prototype.softplus=function(){return this.throwIfDisposed(),C9(this)},r5().prototype.spaceToBatchND=function(e,t){return this.throwIfDisposed(),cee(this,e,t)},r5().prototype.split=function(e,t){return this.throwIfDisposed(),Tte(this,e,t)},r5().prototype.sqrt=function(){return this.throwIfDisposed(),Q7(this)},r5().prototype.square=function(){return this.throwIfDisposed(),$7(this)},r5().prototype.squaredDifference=function(e){return this.throwIfDisposed(),Cte(this,e)},r5().prototype.squeeze=function(e){return this.throwIfDisposed(),Ate(this,e)},r5().prototype.stack=function(e,t){this.throwIfDisposed();var n=e instanceof n5?[this,e]:[this].concat(T(e));return Rte(n,t)},r5().prototype.step=function(e){return this.throwIfDisposed(),_te(this,e)},r5().prototype.stridedSlice=function(e,t,n,r,a,i,o,s){return this.throwIfDisposed(),Ote(this,e,t,n,r,a,i,o,s)},r5().prototype.sub=function(e){return this.throwIfDisposed(),R9(this,e)},r5().prototype.sum=function(e,t){return this.throwIfDisposed(),e9(this,e,t)},r5().prototype.tan=function(){return this.throwIfDisposed(),Fte(this)},r5().prototype.tanh=function(){return this.throwIfDisposed(),K8(this)},r5().prototype.tile=function(e){return this.throwIfDisposed(),s9(this,e)},r5().prototype.toBool=function(){return this.throwIfDisposed(),X6(this,"bool")},r5().prototype.toFloat=function(){return this.throwIfDisposed(),X6(this,"float32")},r5().prototype.toInt=function(){return this.throwIfDisposed(),X6(this,"int32")},r5().prototype.topk=function(e,t){return this.throwIfDisposed(),Hte(this,e,t)},r5().prototype.transpose=function(e){return this.throwIfDisposed(),rne(this,e)},r5().prototype.unique=function(e){return this.throwIfDisposed(),Kte(this,e)},r5().prototype.unsortedSegmentSum=function(e,t){return this.throwIfDisposed(),Xte(this,e,t)},r5().prototype.unstack=function(e){return this.throwIfDisposed(),Yte(this,e)},r5().prototype.where=function(e,t){return this.throwIfDisposed(),O7(e,this,t)},r5().prototype.zerosLike=function(){return this.throwIfDisposed(),F7(this)};var dse=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),r=t.call(this,e),Object.setPrototypeOf(x(r),n.prototype),r}return p(n)}(b(Error)),vse=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),r=t.call(this,e),Object.setPrototypeOf(x(r),n.prototype),r}return p(n)}(b(Error)),mse=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),r=t.call(this,e),Object.setPrototypeOf(x(r),n.prototype),r}return p(n)}(b(Error)),gse=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),r=t.call(this,e),Object.setPrototypeOf(x(r),n.prototype),r}return p(n)}(b(Error)),yse=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),r=t.call(this,e),Object.setPrototypeOf(x(r),n.prototype),r}return p(n)}(b(Error)),bse=(Error,function(){function e(t){l(this,e),this.maxEntries=t||100,this.cache=new Map}return p(e,[{key:"get",value:function(e){var t;return this.cache.has(e)&&(t=this.cache.get(e),this.cache.delete(e),this.cache.set(e,t)),t}},{key:"put",value:function(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxEntries){var n=this.cache.keys().next().value;this.cache.delete(n)}this.cache.set(e,t)}},{key:"getMaxEntries",value:function(){return this.maxEntries}},{key:"setMaxEntries",value:function(e){if(e<0)throw new Error("The maxEntries of LRU caches must be at least 0, but got ".concat(e,"."));if(this.maxEntries>e)for(var t=0;t<this.maxEntries-e;t++){var n=this.cache.keys().next().value;this.cache.delete(n)}this.maxEntries=e}}]),e}());function xse(e,t){if(Array.isArray(e)){for(var n=[],r=0;r<t;r++)n=n.concat(e);return n}var a=new Array(t);return a.fill(e),a}function kse(e,t){if(!e)throw new yse(t)}function wse(e,t){var n,r=0,a=O(e);try{for(a.s();!(n=a.n()).done;){n.value===t&&r++}}catch(e){a.e(e)}finally{a.f()}return r}function Ise(e){return 1===e.length?e[0]:e}function Nse(e){return Array.isArray(e)?e:[e]}function Sse(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 Tse(e){return e.length<=1||-1===e.indexOf("_")?e:e.replace(/[_]+(\w|$)/g,(function(e,t){return t.toUpperCase()}))}var Ese={};function Cse(e){if(null==e)return null;var t={};return t.className=e.getClassName(),t.config=e.getConfig(),t}function Ase(e){if(null!=e&&"object"===s(e))if(Array.isArray(e))e.forEach((function(e){return Ase(e)}));else for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t],a=e[r];null!=a&&"object"===s(a)&&(Array.isArray(a)||"ndarray"!==a.type||"number"!=typeof a.value?Ase(a):e[r]=a.value)}}function Rse(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"object",a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if("string"==typeof e){var i,o=e;if(o in n)i=n[o];else if(o in Ese)i=Ese[o];else if(null==(i=t[o]))throw new mse("Unknown ".concat(r,": ").concat(e,". ")+"This may be due to one of the following reasons:\n"+"1. The ".concat(r," is defined in Python, in which ")+"case it needs to be ported to TensorFlow.js or your JavaScript code.\n"+"2. The custom ".concat(r," is defined in JavaScript, ")+"but is not registered properly with tf.serialization.registerClass().");return i}var s=e;if(null==s.className||null==s.config)throw new mse("".concat(r,": Improper config format: ")+"".concat(JSON.stringify(s),".\n")+"'className' and 'config' must set.");var u,c,l=s.className;if(l in n){var h=S(n[l],2);u=h[0],c=h[1]}else if(l in Ese){var p=S(Ese.className,2);u=p[0],c=p[1]}else if(l in t){var f=S(t[l],2);u=f[0],c=f[1]}if(null==u)throw new mse("Unknown ".concat(r,": ").concat(l,". ")+"This may be due to one of the following reasons:\n"+"1. The ".concat(r," is defined in Python, in which ")+"case it needs to be ported to TensorFlow.js or your JavaScript code.\n"+"2. The custom ".concat(r," is defined in JavaScript, ")+"but is not registered properly with tf.serialization.registerClass().");if(null!=c){for(var d={},v=0,m=Object.keys(Ese);v<m.length;v++){var g=m[v];d[g]=Ese[g]}for(var y=0,b=Object.keys(n);y<b.length;y++){var x=b[y];d[x]=n[x]}var k=s.config;k.customObjects=d;for(var w=Object.assign({},Ese),I=0,N=Object.keys(n);I<N.length;I++){var T=N[I];Ese[T]=n[T]}Ase(s.config);var E=c(u,s.config,n,a);return Ese=Object.assign({},w),E}for(var C=Object.assign({},Ese),A=0,R=Object.keys(n);A<R.length;A++){var _=R[A];Ese[_]=n[_]}var O=new u(s.config);return Ese=Object.assign({},C),O}function _se(e,t){return-1*function(e,t){return e<t?-1:e>t?1:0}(e,t)}function Ose(e){if(null==e)return e;var t,n=[],r=O(e);try{for(r.s();!(t=r.n()).done;){var a=t.value;-1===n.indexOf(a)&&n.push(a)}}catch(e){r.e(e)}finally{r.f()}return n}function Fse(e){if(null==e)throw new mse("Invalid value in obj: ".concat(JSON.stringify(e)));for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}function Dse(e,t,n){if(null!=n&&e.indexOf(n)<0)throw new mse("".concat(n," is not a valid ").concat(t,". Valid values are ").concat(e," or null/undefined."))}function Mse(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0;return kse(n>=0),kse(r>=n),Array.isArray(e)&&e.length>=n&&e.length<=r&&e.every((function(e){return s(e)===t}))}function Lse(e,t){Array.isArray(e)?(F$(e.length>0,(function(){return"".concat(t," is unexpectedly an empty array.")})),e.forEach((function(e,n){return Lse(e,"element ".concat(n+1," of ").concat(t))}))):F$(Number.isInteger(e)&&e>0,(function(){return"Expected ".concat(t," to be a positive integer, but got ")+"".concat(zse(e),".")}))}function zse(e){return null===e?"null":Array.isArray(e)?"["+e.map((function(e){return zse(e)})).join(",")+"]":"string"==typeof e?'"'.concat(e,'"'):"".concat(e)}function Pse(e){return"relu"===e?"relu":"linear"===e?"linear":"elu"===e?"elu":null}var Bse=0;function Wse(){return Bse++}var Vse={};function Use(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e in Vse||(Vse[e]=0),Vse[e]+=1,e+Vse[e].toString()}var Gse=["channelsFirst","channelsLast"],jse=["nearest","bilinear"],Hse=["valid","same","causal"],qse=["max","avg"],Kse=["sum","mul","concat","ave"],Xse=new Map;function Yse(e){Dse(Gse,"DataFormat",e)}function Jse(e){Dse(Hse,"PaddingMode",e)}function Zse(e){Dse(qse,"PoolMode",e)}var Qse=[];function $se(e,t){Qse.push(e);try{var n=t();return Qse.pop(),n}catch(e){throw Qse.pop(),e}}function eue(e){if(!aue(e))throw new Error("Not a valid tensor name: '"+e+"'");return(0===Qse.length?"":Qse.join("/")+"/")+e}function tue(e){if(!aue(e))throw new Error("Not a valid tensor name: '"+e+"'");Xse.has(e)||Xse.set(e,0);var t=Xse.get(e);if(Xse.set(e,Xse.get(e)+1),t>0){var n="".concat(e,"_").concat(t);return Xse.set(n,1),n}return e}var nue,rue=new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);function aue(e){return!!e.match(rue)}function iue(e,t,n){null==t&&(t=0),null==n&&(n=e.length);for(var r=1,a=t;a<n;++a)r*=e[a];return r}function oue(e){if(0===e.length)return Number.NaN;for(var t=Number.POSITIVE_INFINITY,n=0;n<e.length;n++){var r=e[n];r<t&&(t=r)}return t}function sue(e){if(0===e.length)return Number.NaN;for(var t=Number.NEGATIVE_INFINITY,n=0;n<e.length;n++){var r=e[n];r>t&&(t=r)}return t}function uue(e,t){if(t<e)throw new mse("end (".concat(t,") < begin (").concat(e,") is forbidden."));for(var n=[],r=e;r<t;++r)n.push(r);return n}function cue(){return null==nue&&(nue=i8().epsilon()),nue}function lue(e,t){return X6(e,t)}function hue(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=e.shape.slice();return t<0&&(t=n.length+t+1),n.splice(t,0,1),W8(e,n)}function pue(e){var t=[iue(e.shape)];return W8(e,t)}function fue(e,t,n){return e8((function(){switch(e.rank){case 1:return yte(e,t,n);case 2:return bte(e,[t,0],[n,e.shape[1]]);case 3:return xte(e,[t,0,0],[n,e.shape[1],e.shape[2]]);case 4:return kte(e,[t,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3]]);case 5:return q8(e,[t,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4]]);case 6:return q8(e,[t,0,0,0,0,0],[n,e.shape[1],e.shape[2],e.shape[3],e.shape[4],e.shape[5]]);default:throw new mse("sliceAlongFirstAxis() received an unsupported tensor rank: "+"".concat(e.rank))}}))}function due(e,t,n){return e8((function(){switch(e.rank){case 1:return yte(e,t,n);case 2:return bte(e,[0,t],[e.shape[0],n]);case 3:return xte(e,[0,0,t],[e.shape[0],e.shape[1],n]);case 4:return kte(e,[0,0,0,t],[e.shape[0],e.shape[1],e.shape[2],n]);default:throw new mse("sliceAlongLastAxis() received an unsupported tensor rank: "+"".concat(e.rank))}}))}function vue(e,t,n,r){return e8((function(){switch(e.rank){case 1:return yte(e,t,n);case 2:switch(r){case 1:return fue(e,t,n);case 2:return due(e,t,n);default:throw new mse("The axis is not within the rank of the tensor "+"".concat(r))}case 3:switch(r){case 1:return fue(e,t,n);case 2:return xte(e,[0,t,0],[e.shape[0],n,e.shape[2]]);case 3:return due(e,t,n);default:throw new mse("The axis is not within the rank of the tensor "+"".concat(r))}case 4:switch(r){case 1:return fue(e,t,n);case 2:return kte(e,[0,t,0,0],[e.shape[0],n,e.shape[2],e.shape[3]]);case 3:return kte(e,[0,0,t,0],[e.shape[0],e.shape[1],n,e.shape[3]]);case 4:return due(e,t,n);default:throw new mse("The axis is not within the rank of the tensor "+"".concat(r))}default:throw new mse("sliceAlongLastAxis() received an unsupported tensor rank: "+"".concat(e.rank))}}))}function mue(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return n<0&&(n=0!==(t=e[0].rank)?t:0),n===e[0].rank&&(n=-1),G8(e,n)}function gue(e,t){switch(e.rank){case 1:return s7([e,t]);case 2:return u7([e,t],0);case 3:return c7([e,t],0);case 4:return l7([e,t],0);default:throw new mse("concatAlongFirstAxis() received an unsupported "+"tensor rank: ".concat(e.rank))}}function yue(e,t){if(Array.isArray(t)||(t=[t]),e.rank!==t.length)throw new mse("The length of input n (".concat(t.length,") does not match ")+"the number of dimensions in input x (".concat(e.rank,")"));return s9(e,t)}function bue(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return Yee(e,t,n,r,a)}function xue(e,t,n,r){if(e.rank<2||t.rank<2)throw new gse("dot requires both inputs to be rank >= 2"+" but got x shape = ".concat(e.shape," and y shape = ").concat(t.shape));if(t.rank>=3&&e.shape.slice(-1)[0]!==t.shape.slice(-2)[0])throw new gse("If rank y >= 3, then the second last dim"+" of y must equal the last dim of x but got x shape = ".concat(e.shape," and ")+" y shape = ".concat(t.shape));if(2===e.rank&&2===t.rank){return Ine({a:e,b:t,transposeA:!1,transposeB:!1,bias:r?Iue(e.rank,r,"channelsLast"):null,activation:n})}var a=e.shape.slice(),i=a.pop();e=W8(e,[-1,i]);var o=t.shape.slice(),s=o.pop(),u=o.pop(),c=[].concat(T(o),[s]),l=Array.from({length:t.rank},(function(e,n){return 0===n?t.rank-2:n<=t.rank-2?n-1:n}));t=W8(rne(t,l),[u,-1]);var h=[].concat(T(a),T(c));return W8(Ine({a:e,b:t,transposeA:!1,transposeB:!1,bias:r?Iue(e.rank,r,"channelsLast"):null,activation:n}),h)}function kue(e,t,n){return e8((function(){return t=Array.isArray(t)?Dte(t,"int32"):X6(t,"int32"),l9(e,t,n)}))}function wue(e){return c8(e,e)}function Iue(e,t,n){var r=t.shape;if(1!==t.rank&&t.rank!==e)throw new mse("Unexpected bias dimensions: ".concat(t.rank)+"; expected it to be 1 or ".concat(e));if(5===e){if("channelsFirst"===n)return 1===r.length?W8(t,[1,r[0],1,1,1]):W8(t,[1,r[3],r[0],r[1],r[2]]);if("channelsLast"===n)return 1===r.length?W8(t,[1,1,1,1,r[0]]):W8(t,[1].concat(r))}else if(4===e){if("channelsFirst"===n)return 1===r.length?W8(t,[1,r[0],1,1]):W8(t,[1,r[2],r[0],r[1]]);if("channelsLast"===n)return 1===r.length?W8(t,[1,1,1,r[0]]):W8(t,[1].concat(r))}else if(3===e){if("channelsFirst"===n)return 1===r.length?W8(t,[1,r[0],1]):W8(t,[1,r[1],r[0]]);if("channelsLast"===n)return 1===r.length?W8(t,[1,1,r[0]]):W8(t,[1].concat(r))}else if(e<3)return t;throw new mse("Unsupported input rank by biasAdd: ".concat(t.rank))}function Nue(e,t,n){return e8((function(){return null==n&&(n="channelsLast"),Yse(n),o8(e,Iue(e.rank,t,n))}))}function Sue(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(1!==t)throw new gse("Support for alpha values other than 1 (".concat(t,") is not implemented ")+"yet.");return z7(e)}function Tue(e,t,n,r){return e8((function(){return cne(e,t,n,r)}))}function Eue(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return n?e():t()}var Cue=["fanIn","fanOut","fanAvg"],Aue=["normal","uniform","truncatedNormal"];var Rue=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"fromConfigUsesCustomObjects",value:function(){return!1}},{key:"getConfig",value:function(){return{}}}]),n}(Dre),_ue=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e,t){return H9(e,t)}}]),n}(Rue);_ue.className="Zeros",Lre(_ue);var Oue=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e,t){return q9(e,t)}}]),n}(Rue);Oue.className="Ones",Lre(Oue);var Fue=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),r=t.call(this),"object"!==s(e))throw new mse("Expected argument of type ConstantConfig but got ".concat(e));if(void 0===e.value)throw new mse("config must have value set but got ".concat(e));return r.value=e.value,r}return p(n,[{key:"apply",value:function(e,t){var n=this;return e8((function(){return c8(Z7(n.value),q9(e,t))}))}},{key:"getConfig",value:function(){return{value:this.value}}}]),n}(Rue);Fue.className="Constant",Lre(Fue);var Due=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this)).DEFAULT_MINVAL=-.05,r.DEFAULT_MAXVAL=.05,r.minval=e.minval||r.DEFAULT_MINVAL,r.maxval=e.maxval||r.DEFAULT_MAXVAL,r.seed=e.seed,r}return p(n,[{key:"apply",value:function(e,t){return Zee(e,this.minval,this.maxval,t,this.seed)}},{key:"getConfig",value:function(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}}}]),n}(Rue);Due.className="RandomUniform",Lre(Due);var Mue=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this)).DEFAULT_MEAN=0,r.DEFAULT_STDDEV=.05,r.mean=e.mean||r.DEFAULT_MEAN,r.stddev=e.stddev||r.DEFAULT_STDDEV,r.seed=e.seed,r}return p(n,[{key:"apply",value:function(e,t){if("float32"!==(t=t||"float32")&&"int32"!==t)throw new gse("randomNormal does not support dType ".concat(t,"."));return bue(e,this.mean,this.stddev,t,this.seed)}},{key:"getConfig",value:function(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}}]),n}(Rue);Mue.className="RandomNormal",Lre(Mue);var Lue=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this)).DEFAULT_MEAN=0,r.DEFAULT_STDDEV=.05,r.mean=e.mean||r.DEFAULT_MEAN,r.stddev=e.stddev||r.DEFAULT_STDDEV,r.seed=e.seed,r}return p(n,[{key:"apply",value:function(e,t){if("float32"!==(t=t||"float32")&&"int32"!==t)throw new gse("truncatedNormal does not support dType ".concat(t,"."));return qte(e,this.mean,this.stddev,t,this.seed)}},{key:"getConfig",value:function(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}}]),n}(Rue);Lue.className="TruncatedNormal",Lre(Lue);var zue=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this)).gain=null!=e.gain?e.gain:1,r}return p(n,[{key:"apply",value:function(e,t){var n=this;return e8((function(){if(2!==e.length||e[0]!==e[1])throw new mse("Identity matrix initializer can only be used for 2D square matrices.");return c8(n.gain,u9(e[0]))}))}},{key:"getConfig",value:function(){return{gain:this.gain}}}]),n}(Rue);zue.className="Identity",Lre(zue);var Pue=function(e){d(n,e);var t=w(n);function n(e){var r,a;if(l(this,n),r=t.call(this),e.scale<0)throw new mse("scale must be a positive float. Got: ".concat(e.scale));return r.scale=null==e.scale?1:e.scale,r.mode=null==e.mode?"fanIn":e.mode,a=r.mode,Dse(Cue,"FanMode",a),r.distribution=null==e.distribution?"normal":e.distribution,function(e){Dse(Aue,"Distribution",e)}(r.distribution),r.seed=e.seed,r}return p(n,[{key:"apply",value:function(e,t){var n=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"channelsLast";if(Yse(r),2===e.length)t=e[0],n=e[1];else if(-1!==[3,4,5].indexOf(e.length)){if("channelsFirst"===r){var a=iue(e,2);t=e[1]*a,n=e[0]*a}else if("channelsLast"===r){var i=iue(e,0,e.length-2);t=e[e.length-2]*i,n=e[e.length-1]*i}}else{var o=iue(e);t=Math.sqrt(o),n=Math.sqrt(o)}return[t,n]}(e),r=n[0],a=n[1],i=this.scale;if("fanIn"===this.mode?i/=Math.max(1,r):"fanOut"===this.mode?i/=Math.max(1,a):i/=Math.max(1,(r+a)/2),"normal"===this.distribution){var o=Math.sqrt(i);if("float32"!==(t=t||"float32")&&"int32"!==t)throw new gse("".concat(this.getClassName()," does not support dType ").concat(t,"."));return qte(e,0,o,t,this.seed)}var s=Math.sqrt(3*i);return Zee(e,-s,s,t,this.seed)}},{key:"getConfig",value:function(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}}}]),n}(Rue);Pue.className="VarianceScaling",Lre(Pue);var Bue=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,{scale:1,mode:"fanAvg",distribution:"uniform",seed:null==e?null:e.seed})}return p(n,[{key:"getClassName",value:function(){return Pue.className}}]),n}(Pue);Bue.className="GlorotUniform",Lre(Bue);var Wue=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,{scale:1,mode:"fanAvg",distribution:"normal",seed:null==e?null:e.seed})}return p(n,[{key:"getClassName",value:function(){return Pue.className}}]),n}(Pue);Wue.className="GlorotNormal",Lre(Wue);var Vue=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,{scale:2,mode:"fanIn",distribution:"normal",seed:null==e?null:e.seed})}return p(n,[{key:"getClassName",value:function(){return Pue.className}}]),n}(Pue);Vue.className="HeNormal",Lre(Vue);var Uue=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,{scale:2,mode:"fanIn",distribution:"uniform",seed:null==e?null:e.seed})}return p(n,[{key:"getClassName",value:function(){return Pue.className}}]),n}(Pue);Uue.className="HeUniform",Lre(Uue);var Gue=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,{scale:1,mode:"fanIn",distribution:"normal",seed:null==e?null:e.seed})}return p(n,[{key:"getClassName",value:function(){return Pue.className}}]),n}(Pue);Gue.className="LeCunNormal",Lre(Gue);var jue=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,{scale:1,mode:"fanIn",distribution:"uniform",seed:null==e?null:e.seed})}return p(n,[{key:"getClassName",value:function(){return Pue.className}}]),n}(Pue);jue.className="LeCunUniform",Lre(jue);var Hue=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this)).DEFAULT_GAIN=1,r.ELEMENTS_WARN_SLOW=2e3,r.gain=null==e.gain?r.DEFAULT_GAIN:e.gain,r.seed=e.seed,r}return p(n,[{key:"apply",value:function(e,t){var n=this;return e8((function(){if(e.length<2)throw new gse("Shape must be at least 2D.");if("int32"!==t&&"float32"!==t&&void 0!==t)throw new TypeError("Unsupported data type ".concat(t,"."));var r=L$(e.slice(0,-1)),a=e[e.length-1],i=r*a;i>n.ELEMENTS_WARN_SLOW&&console.warn("Orthogonal initializer is being called on a matrix with more "+"than ".concat(n.ELEMENTS_WARN_SLOW," (").concat(i,") elements: ")+"Slowness may result.");var o=bue([Math.max(a,r),Math.min(a,r)],0,1,t,n.seed),s=Rre.qr(o,!1),u=s[0],c=s[1].flatten().stridedSlice([0],[Math.min(a,r)*Math.min(a,r)],[Math.min(a,r)+1]);return u=c8(u,c.sign()),r<a&&(u=u.transpose()),c8(Z7(n.gain),u.reshape(e))}))}},{key:"getConfig",value:function(){return{gain:this.gain,seed:this.seed}}}]),n}(Rue);Hue.className="Orthogonal",Lre(Hue);var que={constant:"Constant",glorotNormal:"GlorotNormal",glorotUniform:"GlorotUniform",heNormal:"HeNormal",heUniform:"HeUniform",identity:"Identity",leCunNormal:"LeCunNormal",leCunUniform:"LeCunUniform",ones:"Ones",orthogonal:"Orthogonal",randomNormal:"RandomNormal",randomUniform:"RandomUniform",truncatedNormal:"TruncatedNormal",varianceScaling:"VarianceScaling",zeros:"Zeros"};function Kue(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Rse(e,Mre.getMap().classNameMap,t,"initializer")}function Xue(e){return Cse(e)}function Yue(e){if("string"==typeof e){var t=e in que?que[e]:e;if("GlorotNormal"===t)return new Wue;if("GlorotUniform"===t)return new Bue;if("HeNormal"===t)return new Vue;if("HeUniform"===t)return new Uue;if("LeCunNormal"===t)return new Gue;if("LeCunUniform"===t)return new jue;var n={};return n.className=t,n.config={},Kue(n)}return e instanceof Rue?e:Kue(e)}function Jue(e){return Array.isArray(e)&&Array.isArray(e[0])}function Zue(e){return 0===e.length?[]:Array.isArray(e[0])?e:[e]}function Que(e){var t;if(Array.isArray(e)){if(1!==e.length)throw new mse("Expected Tensor length to be 1; got ".concat(e.length));t=e[0]}else t=e;return t}function $ue(e){if(Array.isArray(e)&&Array.isArray(e[0])){if(1===e.length)return e[0];throw new mse("Expected exactly 1 Shape; got ".concat(e.length))}return e}function ece(e){var t,n=0,r=O(e);try{for(r.s();!(t=r.n()).done;){var a=t.value;0===a.shape.length?n+=1:n+=a.shape.reduce((function(e,t){return e*t}))}}catch(e){r.e(e)}finally{r.f()}return n}var tce="Variable",nce=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"float32",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:tce,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;l(this,e),this.dtype=null==n?"float32":n,this.shape=t.shape,this.id=Wse(),r=null==r?tce:r,this.originalName=eue(r),this.name=tue(this.originalName),this.trainable_=a,this.constraint=i,this.val=Zte(t,this.trainable_,this.name,this.dtype)}return p(e,[{key:"read",value:function(){return this.assertNotDisposed(),this.val}},{key:"write",value: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}},{key:"dispose",value:function(){this.assertNotDisposed(),this.val.dispose()}},{key:"assertNotDisposed",value:function(){if(this.val.isDisposed)throw new Error("LayersVariable ".concat(this.name," is already disposed."))}},{key:"trainable",get:function(){return this.trainable_},set:function(e){this.trainable_=e,this.val.trainable=e}}]),e}();function rce(e){return e.map((function(e){return e.read()}))}function ace(e){e.forEach((function(e){e[0].write(e[1])}))}var ice=p((function e(t){l(this,e),this.dtype=t.dtype,this.shape=t.shape,null!=t.shape?this.ndim=t.shape.length:this.ndim=t.ndim,this.maxNDim=t.maxNDim,this.minNDim=t.minNDim,this.axes=t.axes||{}})),oce=p((function e(t,n,r,a,i,o,s){l(this,e),this.dtype=t,this.shape=n,this.sourceLayer=r,this.inputs=a,this.callArgs=i,this.outputTensorIndex=s,this.id=Wse(),null!=o&&(this.originalName=eue(o),this.name=tue(this.originalName)),this.rank=n.length})),sce=0,uce=function(){function e(t,n){l(this,e),this.callArgs=n,this.id=sce++,this.outboundLayer=t.outboundLayer,this.inboundLayers=t.inboundLayers,this.nodeIndices=t.nodeIndices,this.tensorIndices=t.tensorIndices,this.inputTensors=t.inputTensors,this.outputTensors=t.outputTensors,this.inputMasks=t.inputMasks,this.outputMasks=t.outputMasks,this.inputShapes=t.inputShapes,this.outputShapes=t.outputShapes;var r,a=O(t.inboundLayers);try{for(a.s();!(r=a.n()).done;){var i=r.value;null!=i&&i.outboundNodes.push(this)}}catch(e){a.e(e)}finally{a.f()}t.outboundLayer.inboundNodes.push(this)}return p(e,[{key:"getConfig",value:function(){var e,t=[],n=O(this.inboundLayers);try{for(n.s();!(e=n.n()).done;){var r=e.value;null!=r?t.push(r.name):t.push(null)}}catch(e){n.e(e)}finally{n.f()}return{outboundLayer:this.outboundLayer?this.outboundLayer.name:null,inboundLayers:t,nodeIndices:this.nodeIndices,tensorIndices:this.tensorIndices}}}]),e}(),cce=0,lce=function(e){d(n,e);var t=w(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};l(this,n),(e=t.call(this))._callHook=null,e._addedWeightNames=[],e._stateful=!1,e.id=cce++,e.activityRegularizer=null,e.inputSpec=null,e.supportsMasking=!1,e._trainableWeights=[],e._nonTrainableWeights=[],e._losses=[],e._updates=[],e._built=!1,e.inboundNodes=[],e.outboundNodes=[];var a=r.name;if(!a){var i=e.getClassName();a=Sse(i)+"_"+Use(i)}if(e.name=a,e.trainable_=null==r.trainable||r.trainable,null!=r.inputShape||null!=r.batchInputShape){var o;if(null!=r.batchInputShape)o=r.batchInputShape;else if(null!=r.inputShape){var s=null;null!=r.batchSize&&(s=r.batchSize),o=[s].concat(r.inputShape)}e.batchInputShape=o;var u=r.dtype;null==u&&(u=r.inputDType),null==u&&(u="float32"),e.dtype=u}return null!=r.weights?e.initialWeights=r.weights:e.initialWeights=null,e._refCount=null,e.fastWeightInitDuringBuild=!1,e}return p(n,[{key:"getNodeAtIndex",value:function(e,t){if(0===this.inboundNodes.length)throw new vse("The layer has never been called "+"and thus has no defined ".concat(t,"."));if(this.inboundNodes.length<=e)throw new mse("Asked to get ".concat(t," at node ").concat(e,", ")+"but the layer has only ".concat(this.inboundNodes.length," inbound nodes."));return this.inboundNodes[e]}},{key:"getInputAt",value:function(e){return Ise(this.getNodeAtIndex(e,"input").inputTensors)}},{key:"getOutputAt",value:function(e){return Ise(this.getNodeAtIndex(e,"output").outputTensors)}},{key:"input",get:function(){if(this.inboundNodes.length>1)throw new dse("Layer ".concat(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 dse("Layer ".concat(this.name)+" is not connected, no input to return.");return Ise(this.getNodeAtIndex(0,"input").inputTensors)}},{key:"output",get:function(){if(0===this.inboundNodes.length)throw new dse("Layer ".concat(this.name)+" has no inbound nodes.");if(this.inboundNodes.length>1)throw new dse("Layer ".concat(this.name)+' has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use `getOutputAt(nodeIndex)` instead.');return Ise(this.getNodeAtIndex(0,"output").outputTensors)}},{key:"losses",get:function(){return this._losses}},{key:"calculateLosses",value:function(){return this.losses.map((function(e){return e()}))}},{key:"updates",get:function(){return this._updates}},{key:"built",get:function(){return this._built},set:function(e){this._built=e}},{key:"trainable",get:function(){return this.trainable_},set:function(e){this._trainableWeights.forEach((function(t){return t.trainable=e})),this.trainable_=e}},{key:"trainableWeights",get:function(){return this.trainable_?this._trainableWeights.filter((function(e){return e.trainable})):[]},set:function(e){this._trainableWeights=e}},{key:"nonTrainableWeights",get:function(){return this.trainable?this._trainableWeights.filter((function(e){return!e.trainable})).concat(this._nonTrainableWeights):this._trainableWeights.concat(this._nonTrainableWeights)},set:function(e){this._nonTrainableWeights=e}},{key:"weights",get:function(){return this.trainableWeights.concat(this.nonTrainableWeights)}},{key:"stateful",get:function(){return this._stateful}},{key:"resetStates",value:function(){if(!this.stateful)throw new Error("Cannot call the resetStates() method of a non-stateful Layer object.")}},{key:"assertInputCompatibility",value:function(e){if(e=Nse(e),null!=this.inputSpec&&0!==this.inputSpec.length){var t=Nse(this.inputSpec);if(e.length!==t.length)throw new mse("Layer ".concat(this.name," expects ").concat(t.length," inputs, ")+"but it received ".concat(e.length," input tensors. ")+"Input received: ".concat(e));for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(null!=a){var i=r.rank;if(null!=a.ndim&&i!==a.ndim)throw new mse("Input ".concat(n," is incompatible with layer ").concat(this.name,": ")+"expected ndim=".concat(a.ndim,", found ndim=").concat(i));if(null!=a.maxNDim&&i>a.maxNDim)throw new mse("Input ".concat(n," is incompatible with layer ").concat(this.name)+": expected max_ndim=".concat(a.maxNDim,", found ndim=").concat(i));if(null!=a.minNDim&&i<a.minNDim)throw new mse("Input ".concat(n," is incompatible with layer ").concat(this.name)+": expected min_ndim=".concat(a.minNDim,", found ndim=").concat(i,"."));if(null!=a.dtype&&r.dtype!==a.dtype)throw new mse("Input ".concat(n," is incompatible with layer ").concat(this.name," ")+": expected dtype=".concat(a.dtype,", found dtype=").concat(r.dtype,"."));if(a.axes){var o=r.shape;for(var s in a.axes){var u=Number(s),c=a.axes[s],l=u>=0?o[u]:o[o.length+u];if(null!=c&&-1===[c,null].indexOf(l))throw new mse("Input ".concat(n," is incompatible with layer ")+"".concat(this.name,": expected axis ").concat(u," of input shape to ")+"have value ".concat(c," but got shape ").concat(o,"."))}}if(null!=a.shape)for(var h=0;h<a.shape.length;++h){var p=a.shape[h],f=r.shape[h];if(null!=p&&null!=f&&p!==f)throw new mse("Input ".concat(n," is incompatible with layer ")+"".concat(this.name,": expected shape=").concat(a.shape,", ")+"found shape=".concat(r.shape,"."))}}}}}},{key:"call",value:function(e,t){return e}},{key:"invokeCallHook",value:function(e,t){null!=this._callHook&&this._callHook(e,t)}},{key:"setCallHook",value:function(e){this._callHook=e}},{key:"clearCallHook",value:function(){this._callHook=null}},{key:"apply",value:function(e,t){var n=this;t=t||{},this.assertNotDisposed();var r,a=Nse(e),i=!0,o=O(a);try{for(o.s();!(r=o.n()).done;){if(!(r.value instanceof oce)){i=!1;break}}}catch(e){o.e(e)}finally{o.f()}var s,u=!0,c=O(a);try{for(c.s();!(s=c.n()).done;){if(s.value instanceof oce){u=!1;break}}}catch(e){c.e(e)}finally{c.f()}if(i===u)throw new mse("Arguments to apply() must be all SymbolicTensors or all Tensors");return $se(this.name,(function(){if(!n.built){n.assertInputCompatibility(e);var r,i=[],o=O(Nse(e));try{for(o.s();!(r=o.n()).done;){var s=r.value;i.push(s.shape)}}catch(e){o.e(e)}finally{o.f()}n.build(Ise(i)),n.built=!0,n.initialWeights&&n.setWeights(n.initialWeights),null===n._refCount&&u&&(n._refCount=1)}if(n.assertInputCompatibility(e),u){var c,l=n.call(e,t),h=[],p=O(Nse(l));try{for(p.s();!(c=p.n()).done;){var f=c.value;-1!==a.indexOf(f)&&(f=f.clone()),h.push(f)}}catch(e){p.e(e)}finally{p.f()}if(l=Ise(h),null!=n.activityRegularizer)throw new gse("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return l}var d,v=function(e){e=Nse(e);var t,n=[],r=O(e);try{for(r.s();!(t=r.n()).done;){var a=t.value;n.push(a.shape)}}catch(e){r.e(e)}finally{r.f()}return Ise(n)}(e),m=n.computeOutputShape(v),g="float32";if(n.warnOnIncompatibleInputShape(Array.isArray(e)?v[0]:v),d=null!=m&&m.length>0&&Array.isArray(m[0])?m.map((function(r,a){return new oce(g,r,n,Nse(e),t,n.name,a)})):new oce(g,m,n,Nse(e),t,n.name),n.addInboundNode(e,d,null,null,v,m,t),n._refCount++,null!=n.activityRegularizer)throw new gse("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return d}))}},{key:"warnOnIncompatibleInputShape",value:function(e){if(null!=this.batchInputShape)if(e.length!==this.batchInputShape.length)console.warn("The rank of the input tensor provided (shape: "+"".concat(JSON.stringify(e),") does not match that of the ")+"batchInputShape (".concat(JSON.stringify(this.batchInputShape),") ")+"of the layer ".concat(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 "+"(".concat(JSON.stringify(e),") does not ")+"match the expectation of layer ".concat(this.name,": ")+"".concat(JSON.stringify(this.batchInputShape)))}}},{key:"outputShape",get:function(){if(null==this.inboundNodes||0===this.inboundNodes.length)throw new dse("The layer ".concat(this.name," has never been called and thus has no ")+"defined output shape.");var e,t=[],n=O(this.inboundNodes);try{for(n.s();!(e=n.n()).done;){var r=e.value,a=JSON.stringify(r.outputShapes);-1===t.indexOf(a)&&t.push(a)}}catch(e){n.e(e)}finally{n.f()}if(1===t.length){var i=this.inboundNodes[0].outputShapes;return Array.isArray(i)&&Array.isArray(i[0])&&1===i.length?i[0]:i}throw new dse("The layer ".concat(this.name," has multiple inbound nodes with different ")+'output shapes. Hence the notion of "output shape" is ill-defined for the layer.')}},{key:"countParams",value:function(){if(!this.built)throw new vse("You tried to call countParams() on ".concat(this.name,", ")+"but the layer is not built yet. Build it first by calling build(batchInputShape).");return ece(this.weights)}},{key:"build",value:function(e){this.built=!0}},{key:"getWeights",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return rce(e?this.trainableWeights:this.weights)}},{key:"setWeights",value:function(e){var t=this;e8((function(){var n=t.weights;if(n.length!==e.length)throw new mse('You called setWeights(weights) on layer "'.concat(t.name,'" ')+"with a weight list of length ".concat(e.length,", ")+"but the layer was expecting ".concat(n.length," weights. ")+"Provided weights: ".concat(e,"..."));if(0!==n.length){for(var r=[],a=rce(n),i=0;i<a.length;++i){var o=a[i],s=n[i],u=e[i];if(!P$(o.shape,u.shape))throw new mse("Layer weight shape ".concat(o.shape," ")+"not compatible with provided weight shape ".concat(u.shape));r.push([s,u])}ace(r)}}))}},{key:"addWeight",value:function(e,t,n,r,a,i,o,s){if(-1!==this._addedWeightNames.indexOf(e))throw new mse("Duplicate weight name ".concat(e," for layer ").concat(this.name));this._addedWeightNames.push(e),null==n&&(n="float32"),this.fastWeightInitDuringBuild&&(r=null!=s?s():Yue("zeros"));var u=r.apply(t,n),c=new nce(u,n,e,i,o);return u.dispose(),null!=a&&this.addLoss((function(){return a.apply(c.read())})),null==i&&(i=!0),i?this._trainableWeights.push(c):this._nonTrainableWeights.push(c),c}},{key:"setFastWeightInitDuringBuild",value:function(e){this.fastWeightInitDuringBuild=e}},{key:"addLoss",value:function(e){var t;null==e||Array.isArray(e)&&0===e.length||(e=Nse(e),void 0!==this._losses&&null!==this._losses&&(t=this.losses).push.apply(t,T(e)))}},{key:"computeOutputShape",value:function(e){return e}},{key:"computeMask",value:function(e,t){var n=this;if(!this.supportsMasking){if(null!=t){if(!Array.isArray(t))throw new TypeError("Layer ".concat(this.name," does not support masking, ")+"but was passed an inputMask.");t.forEach((function(e){if(null!=e)throw new TypeError("Layer ".concat(n.name," does not support masking, ")+"but was passed an inputMask.")}))}return null}return t}},{key:"addInboundNode",value:function(e,t,n,r,a,i){var o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,s=Nse(e);t=Nse(t),n=Nse(n),r=Nse(r),a=Zue(a),i=Zue(i);var u,c=[],l=[],h=[],p=O(s);try{for(p.s();!(u=p.n()).done;){var f=u.value;c.push(f.sourceLayer),l.push(f.nodeIndex),h.push(f.tensorIndex)}}catch(e){p.e(e)}finally{p.f()}new uce({outboundLayer:this,inboundLayers:c,nodeIndices:l,tensorIndices:h,inputTensors:s,outputTensors:t,inputMasks:n,outputMasks:r,inputShapes:a,outputShapes:i},o);for(var d=0;d<t.length;d++)t[d].sourceLayer=this,t[d].nodeIndex=this.inboundNodes.length-1,t[d].tensorIndex=d}},{key:"getConfig",value: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}},{key:"disposeWeights",value:function(){return this.weights.forEach((function(e){return e.dispose()})),this.weights.length}},{key:"assertNotDisposed",value:function(){if(0===this._refCount)throw new Error("Layer '".concat(this.name,"' is already disposed."))}},{key:"dispose",value:function(){if(!this.built)throw new Error("Cannot dispose Layer ".concat(this.name," because it has not been ")+"built yet.");if(null===this._refCount)throw new Error("Cannot dispose Layer ".concat(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}}}],[{key:"nodeKey",value:function(e,t){return e.name+"_ib-"+t.toString()}}]),n}(Dre);function hce(e,t,n){if((null==t||null!=n&&n>0)&&(t=e.sourceLayer,n=e.nodeIndex),0===t.inboundNodes.length)return[e];var r=t.inboundNodes[n];if(0===r.inboundLayers.length)return r.inputTensors;for(var a=[],i=0;i<r.inboundLayers.length;i++){var o,s=O(hce(r.inputTensors[i],r.inboundLayers[i],r.nodeIndices[i]));try{for(s.s();!(o=s.n()).done;){var u=o.value;-1===a.indexOf(u)&&a.push(u)}}catch(e){s.e(e)}finally{s.f()}}return a}var pce=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),r=t.call(this,{dtype:e.dtype,name:null!=e.name?e.name:Use("input").toString()}),null==e.batchSize&&(e.batchSize=null),null==e.sparse&&(e.sparse=!1),r.trainable=!1,r.built=!0,r.sparse=e.sparse,null!=e.inputShape&&null!=e.batchInputShape)throw new mse("Only provide the inputShape OR batchInputShape argument to inputLayer, not both at the same time.");var a=e.batchInputShape;if(null==a){if(null==e.inputShape)throw new mse("An InputLayer should be passed either a `batchInputShape` or an `inputShape`.");a=[e.batchSize].concat(e.inputShape)}else if(null!=e.batchSize)throw new mse("Cannot specify batchSize if batchInputShape is specified when creating an InputLayer.");var i=e.dtype||"float32";r.batchInputShape=a,r.dtype=i,r.inputSpec=[{shape:a}];var o=new oce(r.dtype,r.batchInputShape,x(r),[],{},r.name);return o.nodeIndex=0,o.tensorIndex=0,new uce({outboundLayer:x(r),inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:[o],outputTensors:[o],inputMasks:[null],outputMasks:[null],inputShapes:[a],outputShapes:[a]}),r}return p(n,[{key:"apply",value:function(e,t){throw new mse("Cannot pass any input to an "+"InputLayer's apply() method. InputLayer name: ".concat(this.name))}},{key:"dispose",value:function(){return{refCountAfterDispose:this._refCount,numDisposedVariables:0}}},{key:"getConfig",value:function(){return{batchInputShape:this.batchInputShape,dtype:this.dtype,sparse:this.sparse,name:this.name}}}]),n}(lce);function fce(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 mse("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 pce({batchInputShape:t,name:e.name,dtype:n,sparse:e.sparse}).inboundNodes[0].outputTensors[0]}pce.className="InputLayer",Lre(pce);var dce=function(){function e(t){if(l(this,e),this.id2Value={},this.id2Mask={},this.name2Id={},t instanceof e)for(var n in t.id2Value)this.id2Value[n]=t.id2Value[n],n in t.id2Mask&&(this.id2Mask[n]=t.id2Mask[n]);else{if(null==t)return;var r,a=O(t);try{for(a.s();!(r=a.n()).done;){var i=r.value;this.add(i.key,i.value)}}catch(e){a.e(e)}finally{a.f()}}}return p(e,[{key:"add",value:function(e,t,n){if(null!=this.id2Value[e.id])throw new mse("Duplicate key: name=".concat(e.name,", id=").concat(e.id));return this.id2Value[e.id]=function(e,t){if(null==e.dtype||e.dtype===t.dtype)return t;try{return X6(t,e.dtype)}catch(n){throw new mse("The dtype of the feed (".concat(t.dtype,") can not be cast to the dtype ")+"of the key '".concat(e.name,"' (").concat(e.dtype,")."))}}(e,t),this.name2Id[e.name]=e.id,null!=n&&(this.id2Mask[e.id]=n),this}},{key:"addFeed",value:function(e){this.add(e.key,e.value)}},{key:"hasKey",value:function(e){return null!=this.id2Value[e.id]}},{key:"names",value:function(){return Object.keys(this.name2Id)}},{key:"getValue",value:function(e){if(e instanceof oce){if(null==this.id2Value[e.id])throw new mse("Nonexistent key: ".concat(e.name));return this.id2Value[e.id]}var t=this.name2Id[e];if(null==t)throw new mse("Feed dict has no SymbolicTensor name: ".concat(e));return this.id2Value[t]}},{key:"getMask",value:function(e){if(e instanceof oce){if(null==this.id2Value[e.id])throw new mse("Nonexistent key: ".concat(e.name));return this.id2Mask[e.id]}var t=this.name2Id[e];if(null==t)throw new mse("Feed dict has no SymbolicTensor name: ".concat(e));return this.id2Mask[t]}},{key:"disposeMasks",value:function(){null!=this.id2Mask&&t8(this.id2Mask)}}]),e}(),vce=new bse,mce=new bse;function gce(e,t,n,r){var a,i=null!=n&&n.training,o=Array.isArray(e),s=o?e:[e],u=s.map((function(e){return e.name})),c=[],l=t.names(),h=O(u);try{for(h.s();!(a=h.n()).done;){var p=a.value;-1!==l.indexOf(p)?c.push(t.getValue(p)):c.push(null)}}catch(e){h.e(e)}finally{h.f()}null!=r&&(r.maxNumTensors=-1/0,r.minNumTensors=1/0);var f,d=u.join(",")+"|"+t.names().sort().join(","),v=vce.get(d);if(null==v){var m=function(e,t){F$(null!=e&&e.length>0,(function(){return"Expected at least one fetch, got none"}));var n=[],r={};if(1===e.length){var a=bce(e[0],t);n=a.sorted,r=a.recipientMap}else{var i,o=new Set,s=O(e);try{for(s.s();!(i=s.n()).done;){var u,c=bce(i.value,t),l=c.sorted,h=c.recipientMap,p=O(l);try{for(p.s();!(u=p.n()).done;){var f=u.value;o.has(f.name)||(n.push(f),o.add(f.name))}}catch(e){p.e(e)}finally{p.f()}var d=function(e){null==r[e]&&(r[e]=new Set),h[e].forEach((function(t){return r[e].add(t)}))};for(var v in h)d(v)}}catch(e){s.e(e)}finally{s.f()}}return{sorted:n,recipientCounts:yce(r)}}(s,t);v=m.sorted,f=m.recipientCounts,vce.put(d,v),mce.put(d,f)}f={},i||Object.assign(f,mce.get(d));for(var g=new dce(t),y=0;y<v.length;++y){if(null!=r){var b=$6().numTensors;b>r.maxNumTensors&&(r.maxNumTensors=b),b<r.minNumTensors&&(r.minNumTensors=b)}var x=v[y],k=x.sourceLayer;if(!(k instanceof pce)){var w,I=[],N=[],S=[],T=!1,E=O(x.inputs);try{for(E.s();!(w=E.n()).done;){var C=w.value,A=g.getValue(C),R=g.getMask(C);I.push(A),N.push(R),null!=R&&(T=!0),i||(f[C.name]--,0!==f[C.name]||t.hasKey(C)||-1!==u.indexOf(C.name)||A.isDisposed||!0===C.sourceLayer.stateful||S.push(A))}}catch(e){E.e(e)}finally{E.f()}T&&((n=n||{}).mask=N[0]);var _=Nse(k.apply(I,n)),F=null;k.supportsMasking&&(F=k.computeMask(I,N));for(var D=xce(x),M=Array.isArray(D)?D:[D],L=0;L<M.length;++L){g.hasKey(M[L])||g.add(M[L],_[L],Array.isArray(F)?F[0]:F);var z=u.indexOf(M[L].name);-1!==z&&(c[z]=_[L])}i||t8(S)}}return g.disposeMasks(),o?c:c[0]}function yce(e){var t={};for(var n in e)t[n]=e[n].size;return t}function bce(e,t){var n,r=new Set,a=[],i={},o=O(t.names());try{for(o.s();!(n=o.n()).done;){var s=n.value;r.add(s)}}catch(e){o.e(e)}finally{o.f()}var u=[],c=[];for(u.push(e);u.length>0;){var l=u[u.length-1];if(r.has(l.name))u.pop();else{var h=c[c.length-1]===u.length-1;if(0===l.inputs.length||h)u.pop(),a.push(l),r.add(l.name),h&&c.pop();else{c.push(u.length-1);var p,f=O(l.inputs);try{for(f.s();!(p=f.n()).done;){var d=p.value;null==i[d.name]&&(i[d.name]=new Set),i[d.name].add(l.name),r.has(d.name)||u.push(d)}}catch(e){f.e(e)}finally{f.f()}}}}return{sorted:a,recipientMap:i}}function xce(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){var a,i=O(e.sourceLayer.inboundNodes[r].outputTensors);try{for(i.s();!(a=i.n()).done;){if(a.value.id===e.id){n=r;break}}}catch(e){i.e(e)}finally{i.f()}}t=e.sourceLayer.getOutputAt(n)}return t}function kce(e,t){return e8((function(){return Q7(e9(c8(e,e),t,!0))}))}k0().registerFlag("TOPOLOGICAL_SORT_CACHE_MAX_ENTRIES",(function(){return 100}),(function(e){null!=vce&&vce.setMaxEntries(e),null!=mce&&mce.setMaxEntries(e)}));var wce=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"getConfig",value:function(){return{}}}]),n}(Dre),Ice=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this)).defaultMaxValue=2,r.defaultAxis=0,r.maxValue=null!=e.maxValue?e.maxValue:r.defaultMaxValue,r.axis=null!=e.axis?e.axis:r.defaultAxis,r}return p(n,[{key:"apply",value:function(e){var t=this;return e8((function(){var n=kce(e,t.axis),r=o7(n,0,t.maxValue);return c8(e,u8(r,o8(cue(),n)))}))}},{key:"getConfig",value:function(){return{maxValue:this.maxValue,axis:this.axis}}}]),n}(wce);Ice.className="MaxNorm",Lre(Ice);var Nce=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this)).defaultAxis=0,r.axis=null!=e.axis?e.axis:r.defaultAxis,r}return p(n,[{key:"apply",value:function(e){var t=this;return e8((function(){return u8(e,o8(cue(),kce(e,t.axis)))}))}},{key:"getConfig",value:function(){return{axis:this.axis}}}]),n}(wce);Nce.className="UnitNorm",Lre(Nce);var Sce=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e){return nte(e)}}]),n}(wce);Sce.className="NonNeg",Lre(Sce);var Tce=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this)).defaultMinValue=0,r.defaultMaxValue=1,r.defaultRate=1,r.defaultAxis=0,r.minValue=null!=e.minValue?e.minValue:r.defaultMinValue,r.maxValue=null!=e.maxValue?e.maxValue:r.defaultMaxValue,r.rate=null!=e.rate?e.rate:r.defaultRate,r.axis=null!=e.axis?e.axis:r.defaultAxis,r}return p(n,[{key:"apply",value:function(e){var t=this;return e8((function(){var n=kce(e,t.axis),r=o8(c8(t.rate,o7(n,t.minValue,t.maxValue)),c8(1-t.rate,n));return c8(e,u8(r,o8(cue(),n)))}))}},{key:"getConfig",value:function(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}}}]),n}(wce);Tce.className="MinMaxNorm",Lre(Tce);var Ece={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function Cce(e){return Cse(e)}function Ace(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Rse(e,Mre.getMap().classNameMap,t,"constraint")}function Rce(e){return null==e?null:"string"==typeof e?Ace({className:e in Ece?Ece[e]:e,config:{}}):e instanceof wce?e:Ace(e)}var _ce={__proto__:null,maxNorm:function(e){return new Ice(e)},minMaxNorm:function(e){return new Tce(e)},nonNeg:function(){return new Sce},unitNorm:function(e){return new Nce(e)}};var Oce,Fce={__proto__:null,constant:function(e){return new Fue(e)},glorotNormal:function(e){return new Wue(e)},glorotUniform:function(e){return new Bue(e)},heNormal:function(e){return new Vue(e)},heUniform:function(e){return new Uue(e)},identity:function(e){return new zue(e)},leCunNormal:function(e){return new Gue(e)},leCunUniform:function(e){return new jue(e)},ones:function(){return new Oue},orthogonal:function(e){return new Hue(e)},randomNormal:function(e){return new Mue(e)},randomUniform:function(e){return new Due(e)},truncatedNormal:function(e){return new Lue(e)},varianceScaling:function(e){return new Pue(e)},zeros:function(){return new _ue}};function Dce(e){return Mce.apply(this,arguments)}function Mce(){return Mce=c(o().mark((function e(t){var n,r,a,i,s,u,c,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=t){e.next=2;break}return e.abrupt("return");case 2:for(i in n=[],r=[],a=[],t)"number"!=typeof(s=t[i])&&(u=s,n.push(u.data()),r.push(i),a.push(u));if(!(n.length>0)){e.next=12;break}return e.next=9,Promise.all(n);case 9:for(c=e.sent,l=0;l<c.length;++l)t[r[l]]=c[l][0];t8(a);case 12:case"end":return e.stop()}}),e)}))),Mce.apply(this,arguments)}function Lce(e){if(null!=e)for(var t in e){var n=e[t];"number"!=typeof n&&n.dispose()}}!function(e){e[e.SILENT=0]="SILENT",e[e.VERBOSE=1]="VERBOSE"}(Oce||(Oce={}));var zce=function(){function e(){l(this,e),this.validationData=null}var t,n,r,a,i,s;return p(e,[{key:"setParams",value:function(e){this.params=e}},{key:"onEpochBegin",value:(s=c(o().mark((function e(t,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(e,t){return s.apply(this,arguments)})},{key:"onEpochEnd",value:(i=c(o().mark((function e(t,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(e,t){return i.apply(this,arguments)})},{key:"onBatchBegin",value:(a=c(o().mark((function e(t,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(e,t){return a.apply(this,arguments)})},{key:"onBatchEnd",value:(r=c(o().mark((function e(t,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(e,t){return r.apply(this,arguments)})},{key:"onTrainBegin",value:(n=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(e){return n.apply(this,arguments)})},{key:"onTrainEnd",value:(t=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"setModel",value:function(e){}}]),e}(),Pce=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;l(this,e),null==t&&(t=[]),this.callbacks=t,this.queueLength=n}var t,n,r,a,i,s;return p(e,[{key:"append",value:function(e){this.callbacks.push(e)}},{key:"setParams",value:function(e){var t,n=O(this.callbacks);try{for(n.s();!(t=n.n()).done;){t.value.setParams(e)}}catch(e){n.e(e)}finally{n.f()}}},{key:"setModel",value:function(e){var t,n=O(this.callbacks);try{for(n.s();!(t=n.n()).done;){t.value.setModel(e)}}catch(e){n.e(e)}finally{n.f()}}},{key:"onEpochBegin",value:(s=c(o().mark((function e(t,n){var r,a,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:null==n&&(n={}),r=O(this.callbacks),e.prev=2,r.s();case 4:if((a=r.n()).done){e.next=10;break}return i=a.value,e.next=8,i.onEpochBegin(t,n);case 8:e.next=4;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),r.e(e.t0);case 15:return e.prev=15,r.f(),e.finish(15);case 18:case"end":return e.stop()}}),e,this,[[2,12,15,18]])}))),function(e,t){return s.apply(this,arguments)})},{key:"onEpochEnd",value:(i=c(o().mark((function e(t,n){var r,a,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:null==n&&(n={}),r=O(this.callbacks),e.prev=2,r.s();case 4:if((a=r.n()).done){e.next=10;break}return i=a.value,e.next=8,i.onEpochEnd(t,n);case 8:e.next=4;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),r.e(e.t0);case 15:return e.prev=15,r.f(),e.finish(15);case 18:case"end":return e.stop()}}),e,this,[[2,12,15,18]])}))),function(e,t){return i.apply(this,arguments)})},{key:"onBatchBegin",value:(a=c(o().mark((function e(t,n){var r,a,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:null==n&&(n={}),r=O(this.callbacks),e.prev=2,r.s();case 4:if((a=r.n()).done){e.next=10;break}return i=a.value,e.next=8,i.onBatchBegin(t,n);case 8:e.next=4;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),r.e(e.t0);case 15:return e.prev=15,r.f(),e.finish(15);case 18:case"end":return e.stop()}}),e,this,[[2,12,15,18]])}))),function(e,t){return a.apply(this,arguments)})},{key:"onBatchEnd",value:(r=c(o().mark((function e(t,n){var r,a,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:null==n&&(n={}),r=O(this.callbacks),e.prev=2,r.s();case 4:if((a=r.n()).done){e.next=10;break}return i=a.value,e.next=8,i.onBatchEnd(t,n);case 8:e.next=4;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),r.e(e.t0);case 15:return e.prev=15,r.f(),e.finish(15);case 18:case"end":return e.stop()}}),e,this,[[2,12,15,18]])}))),function(e,t){return r.apply(this,arguments)})},{key:"onTrainBegin",value:(n=c(o().mark((function e(t){var n,r,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:null==t&&(t={}),n=O(this.callbacks),e.prev=2,n.s();case 4:if((r=n.n()).done){e.next=10;break}return a=r.value,e.next=8,a.onTrainBegin(t);case 8:e.next=4;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),n.e(e.t0);case 15:return e.prev=15,n.f(),e.finish(15);case 18:case"end":return e.stop()}}),e,this,[[2,12,15,18]])}))),function(e){return n.apply(this,arguments)})},{key:"onTrainEnd",value:(t=c(o().mark((function e(t){var n,r,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:null==t&&(t={}),n=O(this.callbacks),e.prev=2,n.s();case 4:if((r=n.n()).done){e.next=10;break}return a=r.value,e.next=8,a.onTrainEnd(t);case 8:e.next=4;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),n.e(e.t0);case 15:return e.prev=15,n.f(),e.finish(15);case 18:case"end":return e.stop()}}),e,this,[[2,12,15,18]])}))),function(e){return t.apply(this,arguments)})}]),e}(),Bce=function(e){d(i,e);var t,n,r,a=w(i);function i(){return l(this,i),a.call(this)}return p(i,[{key:"onEpochBegin",value:(r=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.seen=0,this.totals={};case 2:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"onBatchEnd",value:(n=c(o().mark((function e(t,n){var r,a,i,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:null==n&&(n={}),r=null==n.size?0:n.size,this.seen+=r,a=o().mark((function e(t){var a,i,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"number"==typeof(a=n[t])?(s.totals.hasOwnProperty(t)||(s.totals[t]=0),s.totals[t]=s.totals[t]+a*r):(t in s.totals?i=s.totals[t]:s.totals[t]=0,u=e8((function(){return o8(s.totals[t],c8(a,r))})),s.totals[t]=u,null!=i&&i.dispose());case 2:case"end":return e.stop()}}),e)})),e.t0=o().keys(n);case 5:if((e.t1=e.t0()).done){e.next=10;break}return i=e.t1.value,e.delegateYield(a(i),"t2",8);case 8:e.next=5;break;case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"onEpochEnd",value:(t=c(o().mark((function e(t,n){var r,a,i,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==n){e.next=20;break}r=O(this.params.metrics),e.prev=2,i=o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.value,null!=s.totals[t]){e.next=3;break}return e.abrupt("return","continue");case 3:"number"==typeof s.totals[t]?n[t]=s.totals[t]/s.seen:e8((function(){var e=c8(u8(1,s.seen),s.totals[t]);n[t]=e,s.totals[t].dispose(),n8(n[t])}));case 4:case"end":return e.stop()}}),e)})),r.s();case 5:if((a=r.n()).done){e.next=12;break}return e.delegateYield(i(),"t0",7);case 7:if("continue"!==e.t0){e.next=10;break}return e.abrupt("continue",10);case 10:e.next=5;break;case 12:e.next=17;break;case 14:e.prev=14,e.t1=e.catch(2),r.e(e.t1);case 17:return e.prev=17,r.f(),e.finish(17);case 20:case"end":return e.stop()}}),e,this,[[2,14,17,20]])}))),function(e,n){return t.apply(this,arguments)})}]),i}(zce),Wce=function(e){d(i,e);var t,n,r,a=w(i);function i(){return l(this,i),a.apply(this,arguments)}return p(i,[{key:"onTrainBegin",value:(r=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.epoch=[],this.history={};case 2:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"onEpochEnd",value:(n=c(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r in null==n&&(n={}),this.epoch.push(t),n)null==this.history[r]&&(this.history[r]=[]),this.history[r].push(n[r]);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"syncData",value:(t=c(o().mark((function e(){var t,n,r,a,i,s,u,c,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(a in t=[],n=[],r=[],this.history)for(i=this.history[a],s=0;s<i.length;++s)"number"!=typeof i[s]&&(u=i[s],t.push(u.data()),n.push(a),r.push(s));return e.next=6,Promise.all(t);case 6:for(c=e.sent,l=0;l<c.length;++l)this.history[n[l]][r[l]].dispose(),this.history[n[l]][r[l]]=c[l][0];case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),i}(zce),Vce=function(e){d(f,e);var t,n,r,a,i,s,u,h=w(f);function f(e,t){var n;if(l(this,f),(n=h.call(this)).currentEpoch=0,n.nowFunc=e.nowFunc,n.nextFrameFunc=e.nextFrameFunc||qae,n.yieldEvery=t||"auto","auto"===n.yieldEvery&&(n.yieldEvery=125),"never"===n.yieldEvery&&null!=e.onYield)throw new Error("yieldEvery is `never` but you provided an `onYield` callback. Either change `yieldEvery` or remove the callback");return t0(n.yieldEvery)&&(n.maybeWait=function(e,t,n){var r,a=null!=n?n():z4();return function(){var i=null!=n?n():z4();return i-a<t?r:(a=i,r=e.apply(void 0,arguments))}}(n.maybeWait.bind(x(n)),n.yieldEvery,n.nowFunc)),n.trainBegin=e.onTrainBegin,n.trainEnd=e.onTrainEnd,n.epochBegin=e.onEpochBegin,n.epochEnd=e.onEpochEnd,n.batchBegin=e.onBatchBegin,n.batchEnd=e.onBatchEnd,n.yield=e.onYield,n}return p(f,[{key:"maybeWait",value:(u=c(o().mark((function e(t,n,r){var a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=[],null==this.yield){e.next=5;break}return e.next=4,Dce(r);case 4:a.push(this.yield(t,n,r));case 5:return a.push(this.nextFrameFunc()),e.next=8,Promise.all(a);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return u.apply(this,arguments)})},{key:"onEpochBegin",value:(s=c(o().mark((function e(t,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.currentEpoch=t,null==this.epochBegin){e.next=6;break}return e.next=4,Dce(n);case 4:return e.next=6,this.epochBegin(t,n);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"onEpochEnd",value:(i=c(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=[],null==this.epochEnd){e.next=5;break}return e.next=4,Dce(n);case 4:r.push(this.epochEnd(t,n));case 5:return"epoch"===this.yieldEvery&&r.push(this.nextFrameFunc()),e.next=8,Promise.all(r);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"onBatchBegin",value:(a=c(o().mark((function e(t,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==this.batchBegin){e.next=5;break}return e.next=3,Dce(n);case 3:return e.next=5,this.batchBegin(t,n);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"onBatchEnd",value:(r=c(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=[],null==this.batchEnd){e.next=5;break}return e.next=4,Dce(n);case 4:r.push(this.batchEnd(t,n));case 5:return"batch"===this.yieldEvery?r.push(this.nextFrameFunc()):t0(this.yieldEvery)&&r.push(this.maybeWait(this.currentEpoch,t,n)),e.next=8,Promise.all(r);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"onTrainBegin",value:(n=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==this.trainBegin){e.next=5;break}return e.next=3,Dce(t);case 3:return e.next=5,this.trainBegin(t);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"onTrainEnd",value:(t=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==this.trainEnd){e.next=5;break}return e.next=3,Dce(t);case 3:return e.next=5,this.trainEnd(t);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),f}(zce);function Uce(e,t){return null==e&&(e={}),e instanceof zce?[e]:Array.isArray(e)&&e[0]instanceof zce?e:Nse(e).map((function(e){return new Vce(e,t)}))}var Gce=function(){function e(){l(this,e)}return p(e,null,[{key:"registerCallbackConstructor",value:function(t,n){F$(t>=0&&Number.isInteger(t),(function(){return"Verbosity level is expected to be an integer >= 0, "+"but got ".concat(t)})),e.checkForDuplicate(n),null==e.constructors[t]&&(e.constructors[t]=[]),e.constructors[t].push(n)}},{key:"checkForDuplicate",value:function(t){for(var n in e.constructors){e.constructors[+n].forEach((function(e){if(e===t)throw new mse("Duplicate callback constructor.")}))}}},{key:"clear",value:function(){e.constructors={}}},{key:"createCallbacks",value:function(t){var n=[];for(var r in e.constructors){var a=+r;t>=a&&n.push.apply(n,T(e.constructors[a]))}return n.map((function(e){return new e}))}}]),e}();function jce(e,t,n,r,a,i,o,s,u){var c=new Wce,l=[new Bce].concat(T(Gce.createCallbacks(t)));null!=e&&l.push.apply(l,T(e)),l.push(c);var h=new Pce(l);return h.setParams({epochs:n,initialEpoch:r,samples:a,steps:i,batchSize:o,verbose:t,doValidation:s,metrics:u}),{callbackList:h,history:c}}function Hce(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Rse(e,Mre.getMap().classNameMap,t,"layer",n)}function qce(e,t){return e8((function(){"float32"!==e.dtype&&(e=X6(e,"float32"));var n=e9(wue(e),t,!0),r=i7(n.shape,cue()),a=Q7(G9(n,r));return u8(e,a)}))}function Kce(e,t){return e8((function(){return j9(wue(R9(t,e)),-1)}))}function Xce(e,t){return e8((function(){return j9(l8(R9(t,e)),-1)}))}function Yce(e,t){return e8((function(){var n=R9(e,t),r=o7(l8(e),cue(),Number.MAX_VALUE),a=l8(u8(n,r));return c8(100,j9(a,-1))}))}function Jce(e,t){return e8((function(){var n=o7(t,cue(),Number.MAX_VALUE),r=w9(o8(1,n)),a=o7(e,cue(),Number.MAX_VALUE),i=w9(o8(1,a));return j9(wue(R9(r,i)),-1)}))}function Zce(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e8((function(){if(n)t=wte(t);else{var r=e9(t,t.shape.length-1,!0);t=u8(t,r)}return t=o7(t,cue(),1-cue()),E9(e9(c8(X6(e,"float32"),w9(t)),t.shape.length-1))}))}function Qce(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e8((function(){var r=X6(c9(pue(e)),"int32"),a=(t=o7(t,cue(),1-cue())).shape;return Zce(W8(tee(r,a[a.length-1]),a),t,n)}))}function $ce(e,t){return e8((function(){var n;return n=o7(t,cue(),1-cue()),n=w9(u8(n,R9(1,n))),j9(function(e,t){if(!P$(e.shape,t.shape))throw new mse("logits and labels must have the same shape, but got shapes "+"".concat(JSON.stringify(e.shape)," and ").concat(JSON.stringify(t.shape)));return e8((function(){var n=nte(t),r=E9(l8(t));return o8(R9(n,c8(t,e)),I9(a9(r)))}))}(e,n),-1)}))}function ele(e,t){return e8((function(){var n=o7(e,cue(),1),r=o7(t,cue(),1);return e9(c8(e,w9(u8(n,r))),-1)}))}function tle(e,t){return e8((function(){var n=qce(e,-1),r=qce(t,-1),a=c8(n,r);return E9(e9(a,-1))}))}Gce.constructors={};var nle={meanSquaredError:Kce,meanAbsoluteError:Xce,meanAbsolutePercentageError:Yce,meanSquaredLogarithmicError:Jce,squaredHinge:function(e,t){return e8((function(){var n=G9(0,R9(1,c8(e,t)));return j9(wue(n),-1)}))},hinge:function(e,t){return e8((function(){var n=G9(0,R9(1,c8(e,t)));return j9(n,-1)}))},categoricalHinge:function(e,t){return e8((function(){var n=e9(c8(e,t),-1),r=X7(c8(R9(1,e),t),-1);return G9(0,o8(1,R9(r,n)))}))},logcosh:function(e,t){return e8((function(){var n=Math.log(2),r=R9(t,e),a=R9(o8(r,C9(c8(-2,r))),n);return j9(a,-1)}))},categoricalCrossentropy:Zce,sparseCategoricalCrossentropy:Qce,binaryCrossentropy:$ce,kullbackLeiblerDivergence:ele,poisson:function(e,t){return e8((function(){var n=w9(o8(cue(),t));return j9(R9(t,c8(e,n)),-1)}))},cosineProximity:tle};function rle(e){if("string"==typeof e){if(e in nle)return nle[e];var t="Unknown loss ".concat(e);throw e.toLowerCase().includes("softmaxcrossentropy")&&(t="Unknown loss ".concat(e,". ")+'Use "categoricalCrossentropy" as the string name for tf.losses.softmaxCrossEntropy'),new mse(t)}return e}function ale(e,t){return e8((function(){var n=c8(.5,nee(t)),r=lue(h9(t,n),e.dtype);return j9(_7(e,r),-1)}))}function ile(e,t){return e8((function(){return lue(_7(m8(e,-1),m8(t,-1)),"float32")}))}function ole(e,t){return e8((function(){return X6(e9(F9(_7(e,1),_7(t,1))),"float32")}))}function sle(e,t){return e8((function(){var n=ole(e,t),r=function(e,t){return e8((function(){return X6(e9(F9(_7(e,0),_7(t,1))),"float32")}))}(e,t),a=o8(n,r);return X6(O7(h9(a,0),u8(n,a),0),"float32")}))}function ule(e,t){return e8((function(){var n=ole(e,t),r=function(e,t){return e8((function(){return X6(e9(F9(_7(e,1),_7(t,0))),"float32")}))}(e,t),a=o8(n,r);return X6(O7(h9(a,0),u8(n,a),0),"float32")}))}function cle(e,t){return $ce(e,t)}function lle(e,t){return e.rank===t.rank&&(e=Ate(e,[e.rank-1])),(t=m8(t,-1)).dtype!==e.dtype&&(t=X6(t,e.dtype)),X6(_7(e,t),"float32")}var hle=Zce,ple=Qce,fle={binaryAccuracy:ale,categoricalAccuracy:ile,precision:sle,categoricalCrossentropy:hle,sparseCategoricalCrossentropy:ple,mse:Kce,MSE:Kce,mae:Xce,MAE:Xce,mape:Yce,MAPE:Yce,cosine:tle};function dle(e){if(kse(null!==e,"Unknown LossOrMetricFn ".concat(e)),"string"==typeof e)return e;for(var t,n=0,r=Object.keys(nle);n<r.length;n++){var a=r[n];if(nle[a]===e){t=a;break}}if(void 0!==t)return t;for(var i=0,o=Object.keys(fle);i<o.length;i++){var s=o[i];if(fle[s]===e){t=s;break}}return void 0!==t?t:e.name}var vle=1048576;function mle(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null==e||"object"!==s(e)||Object.getPrototypeOf(e)!==Object.prototype||!gle(e))throw new Error("User-defined metadata is expected to be a JSON object, but is not.");if(n){var r=JSON.stringify(e);r.length>vle&&console.warn('User-defined metadata of model "'.concat(t,'" is too large in ')+"size (length=".concat(r.length," when serialized). It is not ")+"recommended to store such large objects in user-defined metadata. Please make sure its serialized length is <= "+"".concat(vle,"."))}}function gle(e){if(null===e)return!0;if("object"===s(e)){if(Object.getPrototypeOf(e)===Object.prototype){for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t];if("string"!=typeof r)return!1;if(!gle(e[r]))return!1}return!0}if(Array.isArray(e)){var a,i=O(e);try{for(i.s();!(a=i.n()).done;){if(!gle(a.value))return!1}}catch(e){i.e(e)}finally{i.f()}return!0}return!1}var o=s(e);return"string"===o||"number"===o||"boolean"===o}function yle(e,t,n){var r,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:console.log,i=xle(e),o=["Layer (type)","Input Shape","Output shape","Param #"];if(i?(t=t||90,n=n||[.32,.61,.89,1]):(t=t||115,n=n||[.24,.48,.7,.8,1]),n[n.length-1]<=1&&(n=n.map((function(e){return Math.floor(t*e)}))),!i)for(var s in o.push("Receives inputs"),r=[],e.nodesByDepth){var u;(u=r).push.apply(u,T(e.nodesByDepth[s]))}a("_".repeat(t)),kle(o,n,a),a("=".repeat(t));for(var c=e.layers,l=0;l<c.length;++l)i?wle(c[l],n,a):Ile(c[l],n,r,a),a((l===c.length-1?"=":"_").repeat(t));e.checkTrainableWeightsConsistency();var h=ble(e),p=ece(e.nonTrainableWeights);a("Total params: ".concat(h+p)),a("Trainable params: ".concat(h)),a("Non-trainable params: ".concat(p)),a("_".repeat(t))}function ble(e){return null!=e.collectedTrainableWeights?ece(e.collectedTrainableWeights):ece(e.trainableWeights)}function xle(e){var t=!0,n=[],r=[];for(var a in e.nodesByDepth)n.push(e.nodesByDepth[a]);for(var i=0,o=n;i<o.length;i++){var s=o[i];if(s.length>1||1===s.length&&s[0].inboundLayers.length>1){t=!1;break}r.push.apply(r,T(s))}if(t){var u,c=O(e.layers);try{for(c.s();!(u=c.n()).done;){var l,h=u.value,p=!1,f=O(h.inboundNodes);try{for(f.s();!(l=f.n()).done;){var d=l.value;if(-1!==r.indexOf(d)){if(p){t=!1;break}p=!0}}}catch(e){f.e(e)}finally{f.f()}if(!t)break}}catch(e){c.e(e)}finally{c.f()}}return t}function kle(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:console.log,r="",a=0;a<e.length;++a)a>0&&(r=r.slice(0,r.length-1)+" "),r=(r+=e[a]).slice(0,t[a]),r+=" ".repeat(t[a]-r.length);n(r)}function wle(e,t,n){var r,a;try{a=e.inboundNodes.map((function(e){return JSON.stringify(e.inputShapes)})).join(",")}catch(e){a="multiple"}try{r=JSON.stringify(e.outputShape)}catch(e){r="multiple"}var i=e.name,o=e.getClassName();kle(["".concat(i," (").concat(o,")"),a,r,e.countParams().toString()],t,n)}function Ile(e,t,n,r){var a,i;try{i=e.inboundNodes.map((function(e){return JSON.stringify(e.inputShapes)})).join(",")}catch(e){i="multiple"}try{a=JSON.stringify(e.outputShape)}catch(e){a="multiple"}var o,s=[],u=O(e.inboundNodes);try{for(u.s();!(o=u.n()).done;){var c=o.value;if(!(null!=n&&n.length>0&&-1===n.indexOf(c)))for(var l=0;l<c.inboundLayers.length;++l){var h=c.inboundLayers[l].name,p=c.nodeIndices[l],f=c.tensorIndices[l];s.push("".concat(h,"[").concat(p,"][").concat(f,"]"))}}}catch(e){u.e(e)}finally{u.f()}var d=e.name,v=e.getClassName(),m=0===s.length?"":s[0];kle(["".concat(d," (").concat(v,")"),i,a,e.countParams().toString(),m],t,r);for(var g=1;g<s.length;++g)kle(["","","","",s[g]],t,r)}function Nle(e,t,n){return("inboundNodes"===e||"outputLayers"===e||"inputLayers"===e)&&0===t&&"string"==typeof n}function Sle(e,t){if(null===e)return null;if("string"==typeof e)return Tse(e);if("number"==typeof e||"boolean"==typeof e)return e;if(e instanceof Array){for(var n=[],r=e.length,a=0;a<r;++a){var i=e[a];Nle(t,a,i)?n.push(i):n.push(Sle(i,t))}return n}for(var o={},s=0,u=Object.keys(e);s<u.length;s++){var c=u[s],l=e[c];if("name"===c&&"string"==typeof l)o[c]=l;else{var h=Tse(c);o[h]=Sle(l,h)}}return o}function Tle(e,t){if(null==e)return null;if("string"==typeof e)return Sse(e);if("number"==typeof e||"boolean"==typeof e)return e;if(e instanceof Array){for(var n=[],r=e.length,a=0;a<r;++a){var i=e[a];Nle(t,a,i)?n.push(i):n.push(Tle(i,t))}return n}for(var o={},s=0,u=Object.keys(e);s<u.length;s++){var c=u[s],l=e[c],h=Sse(c);o[h]="name"!==c&&"className"!==c||"string"!=typeof l?Tle(l,c):l}return o}var Ele="4.6.0",Cle=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),(r=t.call(this,{})).containerNodes=new Set,r.name=e.name,null==r.name){var a=r.getClassName().toLowerCase();r.name=Use(a)}if(r.supportsMasking=!1,r.trainable_=!0,Array.isArray(e.inputs)?r.inputs=e.inputs.slice():r.inputs=[e.inputs],Array.isArray(e.outputs)?r.outputs=e.outputs.slice():r.outputs=[e.outputs],Ose(r.inputs).length!==r.inputs.length)throw new mse("The list of inputs passed to the model is redundant. All inputs should only appear once. Found: "+"".concat(r.inputs.map((function(e){return e.name}))));Ose(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: "+"".concat(r.outputs.map((function(e){return e.name})))),r.inputLayers=[],r.inputLayersNodeIndices=[],r.inputLayersTensorIndices=[],r.outputLayers=[],r.outputLayersNodeIndices=[],r.outputLayersTensorIndices=[],r.layers=[],r.internalContainerRefs=[];var i,o=O(r.outputs);try{for(o.s();!(i=o.n()).done;){var s=i.value,u=s.sourceLayer,c=s.nodeIndex,h=s.tensorIndex;r.outputLayers.push(u),r.outputLayersNodeIndices.push(c),r.outputLayersTensorIndices.push(h)}}catch(e){o.e(e)}finally{o.f()}var p,f=O(r.inputs);try{for(f.s();!(p=f.n()).done;){var d=p.value,v=d.sourceLayer,m=d.nodeIndex,g=d.tensorIndex;kse(0===m,"input layer has >1 nodes"),kse(0===g,"input layer has >1 tensors"),r.inputLayers.push(v),r.inputLayersNodeIndices.push(m),r.inputLayersTensorIndices.push(g)}}catch(e){f.e(e)}finally{f.f()}r.inputNames=[],r.outputNames=[],r.feedInputShapes=[],r.feedInputNames=[],r.feedOutputNames=[];for(var y=0;y<r.inputLayers.length;y++){var b=r.inputLayers[y];if(!(b instanceof pce))throw new TypeError("Input layers to a LayersModel must be InputLayer objects. "+"Received inputs: ".concat(e.inputs,". ")+"Input ".concat(y," (0-based) originates ")+"from layer type ".concat(b.getClassName(),"."));r.inputNames.push(b.name),r.feedInputShapes.push(b.batchInputShape),r.feedInputNames.push(b.name)}var k,w=O(r.outputLayers);try{for(w.s();!(k=w.n()).done;){var I=k.value;r.outputNames.push(I.name)}}catch(e){w.e(e)}finally{w.f()}r.internalInputShapes=r.inputs.map((function(e){return e.shape})),r.internalOutputShapes=r.outputs.map((function(e){return e.shape}));var N,S={},T={},E={},C={},A={},R=[],_=function e(t,a,i,o,s,u){null!=o&&null!=s&&null!=u||(o=t.sourceLayer,s=t.nodeIndex,u=t.tensorIndex);var c=o.inboundNodes[s];if(-1!==i.indexOf(c))throw new vse("The tensor ".concat(t.name,' at layer "').concat(o.name,'" ')+"is part of a cycle.");if(-1===a.indexOf(c)){r.containerNodes.add(n.nodeKey(o,s)),o.id in A||(A[o.id]=Object.keys(A).length),-1===i.indexOf(c)&&i.push(c);for(var l=c.inboundLayers.length,h=0;h<l;h++){e(c.inputTensors[h],a,i,c.inboundLayers[h],c.nodeIndices[h],c.tensorIndices[h])}for(a.push(c);i.indexOf(c)>=0;)i.splice(i.indexOf(c),1);R.push(c)}},F=[],D=[],M=O(r.outputs);try{for(M.s();!(N=M.n()).done;){_(N.value,F,D)}}catch(e){M.e(e)}finally{M.f()}var L,z=O(R.slice().reverse());try{for(z.s();!(L=z.n()).done;){var P=L.value;T[P.id]=P,P.id in S||(S[P.id]=0);var B=S[P.id],W=null==E[P.outboundLayer.id]?0:E[P.outboundLayer.id];B=Math.max(B,W),E[P.outboundLayer.id]=B,C[P.outboundLayer.id]=P.outboundLayer,S[P.id]=B;for(var V=0;V<P.inboundLayers.length;V++){var U=P.inboundLayers[V],G=P.nodeIndices[V],j=U.inboundNodes[G],H=null==S[j.id]?0:S[j.id];S[j.id]=Math.max(B+1,H),T[j.id]=j}}}catch(e){z.e(e)}finally{z.f()}var q={};for(var K in S){var X=S[K];X in q||(q[X]=[]),q[X].push(T[K])}var Y={};for(var J in E){var Z=E[J];Z in Y||(Y[Z]=[]),Y[Z].push(C[J])}var Q=Object.keys(Y).map((function(e){return parseInt(e,10)})).sort(_se);r.layers=[];var $,ee=O(Q);try{for(ee.s();!($=ee.n()).done;){var te=Y[$.value];te.sort((function(e,t){var n=A[e.id],r=A[t.id];return n<r?-1:n>r?1:0}));var ne,re=O(te);try{for(re.s();!(ne=re.n()).done;){var ae=ne.value;ae instanceof n&&r.internalContainerRefs.push(ae),r.layers.push(ae)}}catch(e){re.e(e)}finally{re.f()}}}catch(e){ee.e(e)}finally{ee.f()}r.layersByDepth=Y,Q=Object.keys(q).map((function(e){return parseInt(e,10)})).sort(_se);var ie,oe=r.inputs.slice(),se=[],ue=O(Q);try{for(ue.s();!(ie=ue.n()).done;){var ce,le=O(q[ie.value]);try{for(le.s();!(ce=le.n()).done;){var he=ce.value,pe=he.outboundLayer;if(null!=pe){var fe,de=O(he.inputTensors);try{for(de.s();!(fe=de.n()).done;){var ve=fe.value;if(-1===oe.indexOf(ve))throw new vse("Graph disconnected: cannot obtain value for tensor ".concat(ve)+' at layer "'.concat(pe.name,'". ')+"The following previous layers were accessed without "+"issue: ".concat(se))}}catch(e){de.e(e)}finally{de.f()}var me,ge=O(he.outputTensors);try{for(ge.s();!(me=ge.n()).done;){var ye=me.value;oe.push(ye)}}catch(e){ge.e(e)}finally{ge.f()}se.push(pe.name)}}}catch(e){le.e(e)}finally{le.f()}}}catch(e){ue.e(e)}finally{ue.f()}r.nodesByDepth=q;var be,xe=r.layers.map((function(e){return e.name})),ke=O(xe);try{var we=function(){var e=be.value,t=xe.filter((function(t){return t===e})).length;if(1!==t)throw new vse('The name "'.concat(e,'" is used ').concat(t," times ")+"in the model. All layer names should be unique. Layer names: "+JSON.stringify(xe))};for(ke.s();!(be=ke.n()).done;)we()}catch(e){ke.e(e)}finally{ke.f()}return r.outboundNodes=[],r.inboundNodes=[],new uce({outboundLayer:x(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 p(n,[{key:"assertNotDisposed",value:function(){if(0===this._refCount)throw new Error("Container '".concat(this.name,"' is already disposed."))}},{key:"dispose",value:function(){this.assertNotDisposed();var e={refCountAfterDispose:null,numDisposedVariables:0};if(0==--this._refCount){var t,n=O(this.layers);try{for(n.s();!(t=n.n()).done;){var r=t.value;e.numDisposedVariables+=r.dispose().numDisposedVariables}}catch(e){n.e(e)}finally{n.f()}var a,i=O(this.internalContainerRefs);try{for(i.s();!(a=i.n()).done;){var o=a.value;e.numDisposedVariables+=o.dispose().numDisposedVariables}}catch(e){i.e(e)}finally{i.f()}}return e.refCountAfterDispose=this._refCount,e}},{key:"trainable",get:function(){return this.trainable_},set:function(e){this.layers.forEach((function(t){t._trainableWeights.forEach((function(t){return t.trainable=e}))})),this.trainable_=e}},{key:"trainableWeights",get:function(){if(this._trainableWeights.length>0)throw new mse("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[];var e,t=[],n=O(this.layers);try{for(n.s();!(e=n.n()).done;){var r=e.value;t=t.concat(r.trainableWeights)}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"nonTrainableWeights",get:function(){var e,t=[],n=O(this.layers);try{for(n.s();!(e=n.n()).done;){var r=e.value;t.push.apply(t,T(r.nonTrainableWeights))}}catch(e){n.e(e)}finally{n.f()}if(!this.trainable){var a,i=[],o=O(this.layers);try{for(o.s();!(a=o.n()).done;){var s=a.value;i.push.apply(i,T(s.trainableWeights))}}catch(e){o.e(e)}finally{o.f()}return i.concat(t)}return t}},{key:"weights",get:function(){return this.trainableWeights.concat(this.nonTrainableWeights)}},{key:"loadWeights",value:function(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r={},a=0,i=O(this.layers);try{for(i.s();!(t=i.n()).done;){var o,s=t.value,u=O(s.weights);try{for(u.s();!(o=u.n()).done;){var c=o.value;if(null!=r[c.originalName])throw new mse("Duplicate weight name: ".concat(c.originalName));r[c.originalName]=c,a++}}catch(e){u.e(e)}finally{u.f()}}}catch(e){i.e(e)}finally{i.f()}var l=[];for(var h in e){var p=h;if(null==r[h]){var f=h.split("/"),d=f.slice(0,-2).concat([f[f.length-1]]);p=d.join("/")}if(null!=r[p])l.push([r[p],e[h]]);else if(n)throw new mse("Provided weight data has no target variable: ".concat(h));delete r[p]}if(n){var v=[];for(var m in r)v.push(m);if(v.length>0)throw new mse("".concat(v.length," of ").concat(a," weights are not set: ")+"".concat(v))}ace(l)}},{key:"updatedConfig",value:function(){var e=this.getConfig(),t={};return t.className=this.getClassName(),t.config=e,t.kerasVersion="tfjs-layers ".concat(Ele),t.backend="TensorFlow.js",t}},{key:"toJSON",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=Tle(this.updatedConfig());return t?JSON.stringify(n):n}},{key:"call",value:function(e,t){var n=this;return e8((function(){e=Nse(e);for(var r=new dce,a=0;a<n.inputs.length;++a)r.add(n.inputs[a],e[a]);return gce(n.outputs,r,t)}))}},{key:"computeMask",value:function(e,t){var n=this;return e8((function(){var r;return e=Nse(e),r=null==t?xse(null,e.length):Nse(t),n.runInternalGraph(e,r)[1]}))}},{key:"computeOutputShape",value:function(e){var t=Zue(e);if(t.length!==this.inputLayers.length)throw new mse("Invalid inputShape argument ".concat(e,": ")+"model has ".concat(this.inputLayers.length," tensor inputs."));for(var n={},r=0;r<t.length;r++){var a=this.inputLayers[r],i=t[r];n[a.name+"_0_0"]=i}var o=Object.keys(this.nodesByDepth).map((function(e){return parseInt(e,10)})).sort(_se);if(o.length>1){var s,u=O(o);try{for(u.s();!(s=u.n()).done;){var c,l=s.value,h=O(this.nodesByDepth[l]);try{for(h.s();!(c=h.n()).done;){var p=c.value,f=p.outboundLayer;if(-1===this.inputLayers.map((function(e){return e.id})).indexOf(f.id)){for(var d=[],v=0;v<p.inboundLayers.length;v++){var m=p.inboundLayers[v],g=p.nodeIndices[v],y=p.tensorIndices[v],b=n["".concat(m.name,"_").concat(g,"_").concat(y)];d.push(b)}for(var x=Zue(f.computeOutputShape(Ise(d))),k=f.inboundNodes.indexOf(p),w=0;w<x.length;w++){n["".concat(f.name,"_").concat(k,"_").concat(w)]=x[w]}}}}catch(e){h.e(e)}finally{h.f()}}}catch(e){u.e(e)}finally{u.f()}}for(var I=[],N=[],S=0;S<this.outputLayers.length;S++){var T=this.outputLayers[S],E=this.outputLayersNodeIndices[S],C=this.outputLayersTensorIndices[S],A="".concat(T.name,"_").concat(E,"_").concat(C);N.push(A)}for(var R=0;R<N.length;R++){var _=N[R];kse(_ in n),I.push(n[_])}return Ise(I)}},{key:"runInternalGraph",value:function(e,t){null==t&&(t=xse(null,e.length));for(var n={},r=0;r<this.inputs.length;++r){var a=this.inputs[r],i=e[r],o=t[r];n[a.id]=[i,o]}var s,u=Object.keys(this.nodesByDepth).map((function(e){return parseInt(e,10)})).sort(_se),c=O(u);try{for(c.s();!(s=c.n()).done;){var l,h=s.value,p=O(this.nodesByDepth[h]);try{for(p.s();!(l=p.n()).done;){var f,d=l.value,v=d.outboundLayer,m=d.inputTensors,g=d.outputTensors,y=new Array,b=O(m);try{for(b.s();!(f=b.n()).done;){var x=f.value;x.id in n&&y.push(n[x.id])}}catch(e){b.e(e)}finally{b.f()}if(y.length===m.length){var k={},w=void 0,I=void 0,N=void 0,T=void 0;if(null!=d.callArgs&&(k=d.callArgs),1===y.length){var E=S(y[0],2),C=E[0],A=E[1];null==k.mask&&(k.mask=A),N=Nse(v.call(C,k)),T=Nse(v.computeMask(C,A)),w=[C],I=[A]}else w=y.map((function(e){return e[0]})),I=y.map((function(e){return e[1]})),null==k.mask&&(k.mask=I),N=Nse(v.call(w,k)),T=Nse(v.computeMask(w,I));if(v.activityRegularizer)throw new gse("LayersModel invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");for(var R=0;R<g.length;++R){var _=g[R],F=N[R],D=T[R];n[_.id]=[F,D]}}}}catch(e){p.e(e)}finally{p.f()}}}catch(e){c.e(e)}finally{c.f()}var M,L=[],z=[],P=[],B=O(this.outputs);try{for(B.s();!(M=B.n()).done;){var W=M.value;kse(W.id in n,"Could not compute output ".concat(W.name," : ").concat(W.id));var V=S(n[W.id],2),U=V[0],G=V[1];P.push(U.shape),L.push(U),z.push(G)}}catch(e){B.e(e)}finally{B.f()}return[L,z,P]}},{key:"buildNodeConversionMap",value:function(e){var t,r,a={},i=O(this.layers);try{for(i.s();!(r=i.n()).done;){var o=r.value;t=o instanceof n?1:0;for(var s=0;s<o.inboundNodes.length;s++){var u=n.nodeKey(o,s);this.containerNodes.has(u)&&(a[u]=t,t+=1)}}}catch(e){i.e(e)}finally{i.f()}return a}},{key:"getLayer",value:function(e,t){if(null!=t){if(this.layers.length<=t)throw new mse("Was asked to retrieve layer at index ".concat(t,", but model only ")+"has ".concat(this.layers.length," layer(s)."));return this.layers[t]}if(null==e)throw new mse("Provide either a layer name or layer index");var n,r=O(this.layers);try{for(r.s();!(n=r.n()).done;){var a=n.value;if(a.name===e)return a}}catch(e){r.e(e)}finally{r.f()}throw new mse("No such layer: ".concat(e))}},{key:"calculateLosses",value:function(){var e=this;return e8((function(){var t,r=[],a=O(e.layers);try{for(a.s();!(t=a.n()).done;)for(var i=t.value,o=0;o<i.inboundNodes.length;++o){var s=n.nodeKey(i,o);e.containerNodes.has(s)&&r.push.apply(r,T(i.calculateLosses()))}}catch(e){a.e(e)}finally{a.f()}return r}))}},{key:"getConfig",value:function(){var e,t={name:this.name},r=this.buildNodeConversionMap(this.layers),a=[],i=O(this.layers);try{for(i.s();!(e=i.n()).done;){for(var o=e.value,s=o.getClassName(),u=o.getConfig(),c=[],l=0;l<o.inboundNodes.length;l++){var h=o.inboundNodes[l],p=n.nodeKey(o,l),f={};if(this.containerNodes.has(p)){if(h.callArgs)try{JSON.stringify(h.callArgs),f=h.callArgs}catch(e){console.warn("Layer ".concat(o.name," was passed ")+"non-serializable keyword arguments: "+"".concat(h.callArgs,". They will not be included ")+"in the serialized model (and thus will be missing at deserialization time)."),f={}}if(h.inboundLayers.length>0){for(var d=[],v=0;v<h.inboundLayers.length;v++){var m=h.inboundLayers[v],g=h.nodeIndices[v],y=h.tensorIndices[v],b=r[n.nodeKey(m,g)];null==b&&(b=0),d.push([m.name,b,y,f])}c.push(d)}}}var x={};x.name=o.name,x.className=s,x.config=u,x.inboundNodes=c,a.push(x)}}catch(e){i.e(e)}finally{i.f()}t.layers=a;for(var k=[],w=0;w<this.inputLayers.length;w++){var I=this.inputLayers[w],N=this.inputLayersNodeIndices[w],S=n.nodeKey(I,N);if(this.containerNodes.has(S)){var T=r[S];null==T&&(T=0);var E=this.inputLayersTensorIndices[w];k.push([I.name,T,E])}}t.inputLayers=k;for(var C=[],A=0;A<this.outputLayers.length;A++){var R=this.outputLayers[A],_=this.outputLayersNodeIndices[A],F=n.nodeKey(R,_);if(this.containerNodes.has(F)){var D=r[F];null==D&&(D=0);var M=this.outputLayersTensorIndices[A];C.push([R.name,D,M])}}return t.outputLayers=C,t}},{key:"stateful",get:function(){if(this._stateful)throw new mse("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.");var e,t=O(this.layers);try{for(t.s();!(e=t.n()).done;){if(e.value.stateful)return!0}}catch(e){t.e(e)}finally{t.f()}return!1}},{key:"resetStates",value:function(){var e=this;e8((function(){e.layers.forEach((function(e){e.stateful&&e.resetStates()}))}))}}],[{key:"fromConfig",value:function(e,t){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r={},a={};function i(e,t){e.name in a?a[e.name].push(t):a[e.name]=[t]}function o(e,t){var n,a,o=[],s=O(t);try{for(s.s();!(a=s.n()).done;){var u=a.value,c=u[0],l=u[1],h=u[2];if(n=null==u[3]?{}:u[3],!(c in r))return void i(e,t);var p=r[c];if(p.inboundNodes.length<=l)return void i(e,t);var f=p.inboundNodes[l];o.push(f.outputTensors[h])}}catch(e){s.e(e)}finally{s.f()}o.length>0&&e.apply(Ise(o),n)}function s(e){var a=e.name,o=Hce(e,null!=t.customObjects?t.customObjects:{});o.setFastWeightInitDuringBuild(n),r[a]=o,e.inboundNodes.forEach((function(e){if(!(e instanceof Array))throw new mse("Corrupted configuration, expected array for nodeData: ".concat(e));i(o,e)}))}var u,c=t.name,l=t.layers,h=O(l);try{for(h.s();!(u=h.n()).done;){var p=u.value;s(p)}}catch(e){h.e(e)}finally{h.f()}for(;!Fse(a);){var f,d=O(l);try{for(d.s();!(f=d.n()).done;){var v=f.value,m=r[v.name];if(m.name in a){var g=a[m.name];delete a[m.name];var y,b=O(g);try{for(b.s();!(y=b.n()).done;){var x=y.value;o(m,x)}}catch(e){b.e(e)}finally{b.f()}}}}catch(e){d.e(e)}finally{d.f()}}var k,w=[],I=[],N=t.inputLayers,S=O(N);try{for(S.s();!(k=S.n()).done;){var T=k.value,E=T[0],C=T[1],A=T[2];kse(E in r);var R=r[E],_=R.inboundNodes[C].outputTensors;w.push(_[A])}}catch(e){S.e(e)}finally{S.f()}var F,D=t.outputLayers,M=O(D);try{for(M.s();!(F=M.n()).done;){var L=F.value,z=L[0],P=L[1],B=L[2];kse(z in r);var W=r[z],V=W.inboundNodes[P].outputTensors;I.push(V[B])}}catch(e){M.e(e)}finally{M.f()}return new e({inputs:w,outputs:I,name:c})}}]),n}(lce);function Ale(e,t,n){var r=t.length;if(null==e||Array.isArray(e)&&0===e.length)return t.map((function(e){return null}));if(1===r)return Array.isArray(e)&&1===e.length?e:"object"===s(e)&&t[0]in e?[e[t[0]]]:[e];if(Array.isArray(e)){if(e.length!==r)throw new Error("Provided ".concat(n," is an array of ").concat(e.length," ")+"element(s), but the model has ".concat(r," outputs. ")+"Make sure a set of weights is provided for each model output.");return e}if("object"===s(e)&&Object.keys(e).length>0&&"object"===s(e[Object.keys(e)[0]])){var a=[];return t.forEach((function(t){t in e?a.push(e[t]):a.push(null)})),a}throw new Error("The model has multiple (".concat(r,") outputs, ")+"so ".concat(n," must be either an array with ")+"".concat(r," elements or an object with ").concat(t," keys. ")+"Provided ".concat(n," not understood: ").concat(JSON.stringify(e)))}function Rle(e,t){return Ale(e,t,"classWeight")}function _le(e,t,n,r){return Ole.apply(this,arguments)}function Ole(){return(Ole=c(o().mark((function e(t,n,r,a){var i,s,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==n&&null==a){e.next=2;break}throw new Error("Support sampleWeight is not implemented yet");case 2:if(null==r){e.next=15;break}return i=e8((function(){if(1===t.shape.length)return Y6(t);if(2===t.shape.length){if(t.shape[1]>1){return m8(t,1)}if(1===t.shape[1])return W8(t,[t.shape[0]]);throw new Error("Encountered unexpected last-dimension size (".concat(t.shape[1],") ")+"during handling of class weights. The size is expected to be >= 1.")}throw new Error("Unexpected rank of target (y) tensor (".concat(t.rank,") during ")+"handling of class weights. The rank is expected to be 1 or 2.")})),e.t0=Array,e.next=7,i.data();case 7:return e.t1=e.sent,s=e.t0.from.call(e.t0,e.t1),t8(i),u=[],s.forEach((function(e){if(null==r[e])throw new Error("classWeight must contain all classes in the training data. "+"The class ".concat(e," exists in the data but not in ")+"classWeight");u.push(r[e])})),e.abrupt("return",Dte(u,"float32"));case 15:return e.abrupt("return",null);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fle(e,t){return c8(e,t)}function Dle(e,t){var n,r,a=t;n=a.xs,r=a.ys,F$(null!=n&&null!=r,(function(){return"A Dataset iterator for fitDataset() is expected to generate objects of the form `{xs: xVal, ys: yVal}`, where the two values may be `tf.Tensor`, an array of Tensors, or a map of string to Tensor. The provided Dataset instead generates "+"".concat(t)}));var i=Mle("input",e.inputNames,n),o=Mle("output",e.outputNames,r),s=i[0].shape[0];F$(i.length===e.inputs.length,(function(){return"LayersModel has ".concat(e.inputs.length," inputs, but the dataset ")+"provides ".concat(i.length," inputs. (Expected input keys: ")+"".concat(JSON.stringify(e.inputNames),")")})),F$(o.length===e.outputs.length,(function(){return"LayersModel has ".concat(e.outputs.length," outputs, but the dataset ")+"provides ".concat(o.length," outputs. (Expected output keys: ")+"".concat(JSON.stringify(e.outputNames),")")}));for(var u=function(t){F$(i[t].shape[0]===s,(function(){return"Batch size mismatch: input "+"".concat(e.inputNames[t]," has ").concat(i[t].shape[0],"; ")+"expected ".concat(s," based on input ").concat(e.inputNames[0],".")}))},c=0;c<i.length;c++)u(c);for(var l=function(t){F$(o[t].shape[0]===s,(function(){return"Batch size mismatch: output "+"".concat(e.outputNames[t]," has ").concat(o[t].shape[0],"; ")+"expected ".concat(s," based on input ").concat(e.inputNames[0],".")}))},h=0;h<o.length;h++)l(h);return{xs:i,ys:o}}function Mle(e,t,n){if(n instanceof n5)return[n];if(Array.isArray(n))return F$(n.length===t.length,(function(){return"Received an array of ".concat(n.length," Tensors, but expected ").concat(t.length," to match the ").concat(e," keys ").concat(t,".")})),n;var r,a=[],i=O(t);try{for(i.s();!(r=i.n()).done;){var o=r.value;if(null==n[o])throw new mse("The feature data generated by the dataset lacks the required "+"".concat(e," key '").concat(o,"'."));a.push(n[o])}}catch(e){i.e(e)}finally{i.f()}return a}function Lle(e){if(3===e.length)throw new gse("Validation with sample weights is not implemented yet.");return{xs:e[0],ys:e[1]}}function zle(e,t,n){return Ple.apply(this,arguments)}function Ple(){return Ple=c(o().mark((function e(t,n,r){var a,i,s,u,c,l,h,p,f,d,v,m,g,y,b,x,k,w,I,N,S,T,E,C,A,R,_,O,F,D,M,L,z;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=null!=r.batchesPerEpoch,F$(null!=t.optimizer,(function(){return"You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig)."})),F$(null!=r,(function(){return"For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call."})),F$(null!=r.epochs&&r.epochs>0&&Number.isInteger(r.epochs),(function(){return"For fitDataset(), config.epochs is expected to be a positive "+"integer, but got ".concat(r.epochs)})),F$(!a||r.batchesPerEpoch>0&&Number.isInteger(r.batchesPerEpoch),(function(){return"For fitDataset(), config.batchesPerEpoch is expected to be a "+"positive integer if specified, but got ".concat(r.batchesPerEpoch)})),F$(null==r.validationSplit,(function(){return"`validationSplit` is not supported by `fitDataset()`. Use validationData instead."})),!t.isTraining){e.next=8;break}throw new Error("Cannot start training because another fit() call is ongoing.");case 8:return t.isTraining=!0,e.prev=9,(i=null!=r.validationData)&&(Wle(r.validationData)?F$(null==r.validationBatches||r.validationBatches>0&&Number.isInteger(r.validationBatches),(function(){return"For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, "+"but got ".concat(r.validationBatches)})):(c=Lle(r.validationData),s=c.xs,u=c.ys)),l=t.makeTrainFunction(),h=t.getDedupedMetricsNames(),p=i?h.slice().concat(h.map((function(e){return"val_"+e}))):h.slice(),f=Uce(r.callbacks,r.yieldEvery),d=null==r.verbose?1:r.verbose,v=jce(f,d,r.epochs,null,null,Ble(n,r),null,i,p),m=v.callbackList,g=v.history,m.setModel(t),t.history=g,e.next=22,m.onTrainBegin();case 22:return t.stopTraining_=!1,y=null==r.initialEpoch?0:r.initialEpoch,e.next=26,n.iterator();case 26:b=e.sent;case 27:if(!(y<r.epochs)){e.next=98;break}return x={},e.next=31,m.onEpochBegin(y);case 31:if(k=0,w=0,a){e.next=37;break}return e.next=36,n.iterator();case 36:b=e.sent;case 37:if(a&&!(k<r.batchesPerEpoch)){e.next=91;break}return e.next=40,b.next();case 40:if(I=e.sent,!a||!I.done){e.next=44;break}return console.warn("You provided `batchesPerEpoch` as "+"".concat(r.batchesPerEpoch,", ")+"but your dataset iterator ran out of data after "+"".concat(k," batches; ")+"interrupting training. Make sure that your dataset can generate at least `batchesPerEpoch * epochs` batches (in this case, "+"".concat(r.batchesPerEpoch*r.epochs," batches). ")+"You may need to use the repeat() function when building your dataset."),e.abrupt("break",91);case 44:if(null==I.value){e.next=73;break}return N=Dle(t,I.value),S=N.xs,T=N.ys,(E={}).batch=w,E.size=S[0].shape[0],e.next=51,m.onBatchBegin(w,E);case 51:if(C=[],null==r.classWeight){e.next=64;break}A=Rle(r.classWeight,t.outputNames),R=0;case 55:if(!(R<A.length)){e.next=64;break}return e.t0=C,e.next=59,_le(T[R],null,A[R]);case 59:e.t1=e.sent,e.t0.push.call(e.t0,e.t1);case 61:++R,e.next=55;break;case 64:for(_=S.concat(T).concat(C),O=l(_),t8(_),F=0;F<h.length;++F)D=h[F],M=O[F],E[D]=M,n8(M);return e.next=70,m.onBatchEnd(w,E);case 70:Lce(E),w++,k++;case 73:if(!(a?k>=r.batchesPerEpoch:I.done)){e.next=87;break}if(!i){e.next=86;break}if(L=void 0,!Wle(r.validationData)){e.next=84;break}return e.t2=Nse,e.next=80,t.evaluateDataset(r.validationData,{batches:r.validationBatches});case 80:e.t3=e.sent,L=(0,e.t2)(e.t3),e.next=85;break;case 84:L=Nse(t.evaluate(s,u,{batchSize:null==r.validationBatchSize?32:r.validationBatchSize,verbose:0}));case 85:for(z=0;z<t.metricsNames.length;++z)x["val_".concat(t.metricsNames[z])]=L[z];case 86:return e.abrupt("break",91);case 87:if(!t.stopTraining_){e.next=89;break}return e.abrupt("break",91);case 89:e.next=37;break;case 91:return e.next=93,m.onEpochEnd(y,x);case 93:if(y++,!t.stopTraining_){e.next=96;break}return e.abrupt("break",98);case 96:e.next=27;break;case 98:return e.next=100,m.onTrainEnd();case 100:return e.next=102,t.history.syncData();case 102:return e.abrupt("return",t.history);case 103:return e.prev=103,t.isTraining=!1,e.finish(103);case 106:case"end":return e.stop()}}),e,null,[[9,,103,106]])}))),Ple.apply(this,arguments)}function Ble(e,t){var n=null;return null!=t.batchesPerEpoch?n=t.batchesPerEpoch:Number.isFinite(e.size)&&(n=e.size),n}function Wle(e){return"function"==typeof e.iterator}function Vle(e){return"function"==typeof e.next}function Ule(e,t,n){return Gle.apply(this,arguments)}function Gle(){return Gle=c(o().mark((function e(t,n,r){var a,i,s,u,c,l,h,p,f;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=null!=(r=r||{}).batches,i=t.testFunction,s=[],!(r.verbose>0)){e.next=6;break}throw new gse("Verbose mode is not implemented yet.");case 6:if(F$(!a||r.batches>0&&Number.isInteger(r.batches),(function(){return"Test loop expects `batches` to be a positive integer, but "+"received ".concat(JSON.stringify(r.batches))})),!Vle(n)){e.next=11;break}e.t0=n,e.next=14;break;case 11:return e.next=13,n.iterator();case 13:e.t0=e.sent;case 14:u=e.t0,c=0,l=0,h=o().mark((function e(){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.next();case 2:if(n=e.sent,s=e8((function(){if(n.value){var e=Dle(t,n.value),r=e.xs,a=e.ys,o=r.concat(a),u=e8((function(){return i(o)}));if(t8(o),0===l)for(var h=0;h<u.length;++h)s.push(Z7(0));for(var p=o[0].shape[0],f=function(e){var t=u[e],n=s[e];s[e]=e8((function(){return o8(s[e],c8(p,t))})),l>0&&t8(n)},d=0;d<u.length;++d)f(d);t8(u),c+=p,++l}return s})),!n.done){e.next=7;break}return a&&console.warn("Your dataset iterator ran out of data during evaluateDataset(). Interrupting evalution. Make sure that your dataset can generate at least `batches` "+"batches (in this case, ".concat(r.batches," batches). ")+"You may need to use the repeat() function when building your dataset."),e.abrupt("return","break");case 7:case"end":return e.stop()}}),e)}));case 18:if(a&&!(l<r.batches)){e.next=25;break}return e.delegateYield(h(),"t1",20);case 20:if("break"!==e.t1){e.next=23;break}return e.abrupt("break",25);case 23:e.next=18;break;case 25:for(p=0;p<s.length;++p)f=s[p],s[p]=u8(s[p],c),t8(f);return e.abrupt("return",Ise(s));case 27:case"end":return e.stop()}}),e)}))),Gle.apply(this,arguments)}function jle(e){F$(e>0&&Number.isInteger(e),(function(){return"batchSize is required to be a positive integer, but got ".concat(e)}))}function Hle(e,t,n){return null==e?[null]:Array.isArray(e)?e.map((function(e){return fue(e,t,n-t)})):fue(e,t,n-t)}function qle(e,t){return e8((function(){return null==e?null:Array.isArray(e)?e.map((function(e){return qle(e,t)})):kue(e,"int32"===t.dtype?t:X6(t,"int32"))}))}function Kle(e,t){for(var n=[],r=0,a=null;r<e;)(a=r+t)>=e&&(a=e),n.push([r,a]),r=a;return n}function Xle(e){var t=[];e instanceof n5&&(e=[e]);for(var n=0;n<e.length;++n){var r=e[n];if(1===r.rank)t.push(hue(r,1));else{if(0===r.rank)throw new Error("Expected tensor to be at least 1D, but received a 0D tensor (scalar).");t.push(r)}}return t}function Yle(e,t){if(null!=e){var n=[];if(t instanceof n5)n.push(t.id);else if(Array.isArray(t))t.forEach((function(e){return n.push(e.id)}));else if(null!=t)for(var r in t){var a=t[r];n.push(a.id)}var i=[];if(e instanceof n5)-1===n.indexOf(e.id)&&i.push(e);else if(Array.isArray(e))e.forEach((function(e){-1===n.indexOf(e.id)&&i.push(e)}));else if(null!=e)for(var o in e){var s=e[o];-1===n.indexOf(s.id)&&i.push(s)}i.forEach((function(e){e.isDisposed||e.dispose()}))}}function Jle(e){return Array.isArray(e)}function Zle(e){return!function(e){return e instanceof n5}(e)&&!Jle(e)}function Qle(e,t,n){var r,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";if(null==t||0===t.length){if(null!=e){var o=!1;if(Jle(e)&&e.length>0)o=!0;else if(Zle(e)){for(var s in e)if(e.hasOwnProperty(s)){o=!0;break}}else o=!0;if(o)throw new mse("Error when checking model ".concat(i," expected no data, ")+"but got ".concat(e))}return[]}if(null==e)return t.map((function(e){return null}));if(Zle(e)){r=[];var u,c=O(t);try{for(c.s();!(u=c.n()).done;){var l=u.value;if(null==e[l])throw new mse('No data provided for "'.concat(l,'". Need data for each key in: ')+"".concat(t));r.push(e[l])}}catch(e){c.e(e)}finally{c.f()}}else if(Jle(e)){if(e.length!==t.length)throw new mse("Error when checking model ".concat(i,": the Array of ")+"Tensors that you are passing to your model is not the size the "+"model expected. Expected to see ".concat(t.length," Tensor(s), but ")+"instead got the following list of Tensor(s): ".concat(e));r=e}else{if(t.length>1)throw new mse("The model ".concat(i," expects ").concat(t.length," Tensor(s), ")+"but only received one Tensor. Found: Tensor with shape ".concat(e.shape));r=[e]}if(r=Xle(r),null!=n)for(var h=0;h<t.length;++h)if(null!=n[h]){var p=r[h];if(p.shape.length!==n[h].length)throw new mse("Error when checking ".concat(i,": expected ").concat(t[h]," ")+"to have ".concat(n[h].length," dimension(s). but got array with ")+"shape ".concat(p.shape));for(var f=0;f<n[h].length;++f)if(0!==f||a){var d=p.shape[f],v=n[h][f];if(null!=v&&v>=0&&d!==v)throw new mse("".concat(i," expected a batch of elements where each ")+"example has shape [".concat(n[h].slice(1,n[h].length),"] ")+"(i.e.,tensor shape [*,".concat(n[h].slice(1,n[h].length),"])")+" but the ".concat(i," received an input with ").concat(p.shape[0])+" examples, each with shape [".concat(p.shape.slice(1,p.shape.length),"]")+" (tensor shape [".concat(p.shape,"])"))}}return r}function $le(e,t,n){var r=Ose(e.map((function(e){return e.shape[0]})));r.sort();var a=Ose(t.map((function(e){return e.shape[0]})));if(a.sort(),r.length>1)throw new mse("All input Tensors (x) should have the same number of samples. Got array shapes: "+"".concat(JSON.stringify(e.map((function(e){return e.shape})))));if(a.length>1)throw new mse("All target Tensors (y) should have the same number of samples. Got array shapes: "+"".concat(JSON.stringify(t.map((function(e){return e.shape})))));if(r.length>0&&a.length>0&&!P$(r,a))throw new mse("Input Tensors should have the same number of samples as target "+"Tensors. Found ".concat(r[0]," input sample(s) and ").concat(a[0]," target ")+"sample(s).")}function ehe(e,t,n){for(var r=[Kce,$ce,Zce],a=0;a<e.length;++a){var i=e[a],o=t[a],s=n[a];if(null!=o){if(o===Zce&&1===i.shape[i.shape.length-1])throw new mse("You are passing a target array of shape ".concat(i.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(o))for(var u=i.shape.slice(1),c=s.slice(1),l=0;l<u.length;++l){var h=u[l],p=c[l];if(null!=p&&h!==p)throw new mse("A target Tensor with shape ".concat(i.shape," was passed for an ")+"output of shape ".concat(s,", while using a loss function that ")+"expects targets to have the same shape as the output.")}}}}function the(e,t,n){var r,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";if(Array.isArray(e)){if(e.length!==t.length)throw new mse("Error when checking model ".concat(i,": the Array of ")+"Tensors that you are passing to your model is not the size the "+"the model expected. Expected to see ".concat(t.length," Tensor(s),")+" but instead got ".concat(e.length," Tensors(s)."));r=e}else{if(t.length>1)throw new mse("The model expects ".concat(t.length," ").concat(i," Tensors, ")+"but only received one Tensor. Found: array with shape "+"".concat(JSON.stringify(e.shape),"."));r=[e]}if(null!=n)for(var o=0;o<t.length;++o)if(null!=n[o]){var s=r[o];if(s.shape.length!==n[o].length)throw new mse("Error when checking ".concat(i,": expected ").concat(t[o]," ")+"to have ".concat(n[o].length," dimension(s), but got array with ")+"shape ".concat(JSON.stringify(s.shape)));for(var u=0;u<n[o].length;++u)if(0!==u||a){var c=s.shape[u],l=n[o][u];if(null!=l&&l!==c)throw new mse("Error when checking ".concat(i,": expected ")+"".concat(t[o]," to have shape ").concat(JSON.stringify(n[o])," but ")+"got array with shape ".concat(JSON.stringify(s.shape),"."))}}}var nhe=function(e){d(m,e);var t,n,r,a,i,u,h,f=w(m);function m(e){var t;return l(this,m),(t=f.call(this,e)).isTraining=!1,t}return p(m,[{key:"summary",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:console.log;if(!this.built)throw new mse("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).");yle(this,e,t,n)}},{key:"compile",value: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 jae.adagrad(.01)},Adadelta:function(){return jae.adadelta(1,.95,cue())},Adam:function(){return jae.adam(.001,.9,.999,cue())},Adamax:function(){return jae.adamax(.002,.9,.999,cue(),0)},RMSProp:function(){return jae.rmsprop(.001,.9,0,cue())},SGD:function(){return jae.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 mse("Unknown Optimizer ".concat(e))}(e.optimizer),this.isOptimizerOwned=!0;else{if(!(e.optimizer instanceof Pre))throw new mse("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer_=e.optimizer,this.isOptimizerOwned=!1}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 mse("When passing an Array as loss, it should have one entry per "+"model output. The model has ".concat(this.outputs.length," output(s), ")+"but you passed loss=".concat(e.loss,"."));var r=e.loss;n=r.map((function(e){return rle(e)}))}else{var a=rle(e.loss);this.outputs.forEach((function(e){n.push(a)}))}else{for(var i in e.loss=e.loss,e.loss)if(-1===this.outputNames.indexOf(i))throw new mse('Unknown entry in loss dictionary: "'.concat(i,'". ')+"Only expected the following keys: ".concat(this.outputNames));var o,u=O(this.outputNames);try{for(u.s();!(o=u.n()).done;){var c=o.value;null==e.loss[c]&&console.warn('Output "'.concat(c,'" is missing from loss dictionary. We assume ')+"this was done on purpose, and we will not be expecting data "+"to be passed to ".concat(c," during training")),n.push(rle(e.loss[c]))}}catch(e){u.e(e)}finally{u.f()}}this.lossFunctions=n,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(var l=0;l<this.outputs.length;++l){var h=this.internalOutputShapes[l],p=this.outputNames[l];this.feedOutputNames.push(p),this.feedOutputShapes.push(h),this.feedLossFns.push(this.lossFunctions[l])}var f=[];this.metrics=e.metrics,this.metricsNames=["loss"],this.metricsTensors=[],$se("loss",(function(){for(var e=0;e<t.outputs.length;++e)if(-1===f.indexOf(e)){var n=t.lossFunctions[e];t.outputs.length>1&&(t.metricsTensors.push([n,e]),t.metricsNames.push(t.outputNames[e]+"_loss"))}}));var d=function(e,t){if(null==e||Array.isArray(e)&&0===e.length)return t.map((function(e){return[]}));var n;if("string"==typeof e||"function"==typeof e)n=[e];else{if(!Array.isArray(e)&&"object"!==s(e))throw new TypeError("Type of metrics argument not understood. Expected an string,"+"function, Array, or Object, found: ".concat(e));n=e}if(Array.isArray(n))return t.map((function(e){return n}));var r,a=[],i=O(t);try{for(i.s();!(r=i.n()).done;){var o=r.value,u=n.hasOwnProperty(o)?n[o]:[];Array.isArray(u)||(u=[u]),a.push(u)}}catch(e){i.e(e)}finally{i.f()}return a}(e.metrics,this.outputNames);$se("metric",(function(){for(var e=function(e){if(-1!==f.indexOf(e))return"continue";!function(n){var r,a,i,o,s=O(n);try{var u=function(){var n,s=o.value;if("string"==typeof s&&-1!==["accuracy","acc","crossentropy","ce"].indexOf(s)){var u,c=t.internalOutputShapes[e];1===c[c.length-1]||t.lossFunctions[e]===$ce?-1!==["accuracy","acc"].indexOf(s)?a=ale:-1!==["crossentropy","ce"].indexOf(s)&&(a=cle):t.lossFunctions[e]===Qce?-1!==["accuracy","acc"].indexOf(s)?a=lle:-1!==["crossentropy","ce"].indexOf(s)&&(a=ple):-1!==["accuracy","acc"].indexOf(s)?a=ile:-1!==["crossentropy","ce"].indexOf(s)&&(a=hle),-1!==["accuracy","acc"].indexOf(s)?u="acc":-1!==["crossentropy","ce"].indexOf(s)&&(u="ce"),i=a,r=""+u}else{var l=function(e){if("string"==typeof e&&e in fle)return fle[e];if("string"!=typeof e&&null!=e)return e;throw new mse("Unknown metric ".concat(e))}(s);i=l,r=""+dle(s)}$se(r,(function(){n=i})),function(e,n,r){t.outputNames.length>1&&(n=t.outputNames[e]+"_"+n),t.metricsNames.push(n),t.metricsTensors.push([r,e])}(e,r,n)};for(s.s();!(o=s.n()).done;)u()}catch(e){s.e(e)}finally{s.f()}}(d[e])},n=0;n<t.outputs.length;++n)e(n)})),this.collectedTrainableWeights=this.trainableWeights}},{key:"checkTrainableWeightsConsistency",value: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?")}},{key:"evaluate",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=null==n.batchSize?32:n.batchSize;jle(r);var a=!0,i=this.standardizeUserDataXY(e,t,a,r);try{var o=i[0].concat(i[1]);this.makeTestFunction();var s=this.testFunction,u=this.testLoop(s,o,r,n.verbose,n.steps);return Ise(u)}finally{Yle(i[0],e),Yle(i[1],t)}}},{key:"evaluateDataset",value:(h=c(o().mark((function e(t,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.makeTestFunction(),e.abrupt("return",Ule(this,t,n));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"checkNumSamples",value:function(e,t,n){var r,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"steps";if(null!=n){if(r=null,null!=t)throw new mse("If ".concat(a," is set, batchSize must be null or undefined.")+"Got batchSize = ".concat(t))}else{if(null==e)throw new mse("Either the input data should have a defined shape, or "+"".concat(a," shoud be specified."));r=Array.isArray(e)?e[0].shape[0]:e.shape[0]}return r}},{key:"execute",value:function(e,t){if(Array.isArray(t)&&0===t.length)throw new mse("`outputs` is an empty Array, which is not allowed.");var n=Array.isArray(t),r=n?t:[t],a=this.retrieveSymbolicTensors(r),i=new dce;if(e instanceof n5&&(e=[e]),Array.isArray(e)){if(e.length!==this.inputs.length)throw new mse("The number of inputs provided (".concat(e.length,") ")+"does not match the number of inputs of this model "+"(".concat(this.inputs.length,")."));for(var o=0;o<this.inputs.length;++o)i.add(this.inputs[o],e[o])}else{var s,u=O(this.inputs);try{for(u.s();!(s=u.n()).done;){var c=s.value,l=e[c.name];if(null==l)throw new mse("No value is provided for the model's input ".concat(c.name));i.add(c,l)}}catch(e){u.e(e)}finally{u.f()}}var h=gce(a,i);return n?h:h[0]}},{key:"retrieveSymbolicTensors",value:function(e){var t,n=xse(null,e.length),r=e.length,a=O(this.layers);try{for(a.s();!(t=a.n()).done;){for(var i=t.value,o=Array.isArray(i.output)?i.output:[i.output],s=o.map((function(e){return e.name})),u=0;u<e.length;++u){var c=s.indexOf(e[u]);if(-1!==c&&(n[u]=o[c],r--),0===r)break}if(0===r)break}}catch(e){a.e(e)}finally{a.f()}if(r>0){var l=[];throw n.forEach((function(t,n){null==t&&l.push(e[n])})),new mse("Cannot find SymbolicTensors for output name(s): "+"".concat(JSON.stringify(l)))}return n}},{key:"predictLoop",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e8((function(){var a=t.checkNumSamples(e);if(r)throw new gse("Verbose predictLoop() is not implemented yet.");for(var i=Kle(a,n),o=t.outputs.map((function(e){return[]})),s=function(n){e8((function(){var r=i[n][0],a=i[n][1],o=Hle(e,r,a),s=[];if(Array.isArray(o))for(var u=0;u<o.length;++u)s.push({key:t.inputs[u],value:o[u]});else s.push({key:t.inputs[0],value:o});var c=new dce(s);return gce(t.outputs,c)})).forEach((function(e,t){return o[t].push(e)}))},u=0;u<i.length;++u)s(u);return Ise(o.map((function(e){return G8(e,0)})))}))}},{key:"predict",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Xle(e);the(n,this.inputNames,this.feedInputShapes,!1);try{var r=null==t.batchSize?32:t.batchSize;return jle(r),this.predictLoop(n,r)}finally{Yle(n,e)}}},{key:"predictOnBatch",value:function(e){the(e,this.inputNames,this.feedInputShapes,!0);var t=(Array.isArray(e)?e[0]:e).shape[0];return this.predictLoop(e,t)}},{key:"standardizeUserDataXY",value:function(e,t){var n=arguments.length>3?arguments[3]:void 0;if(null==this.optimizer_)throw new vse("You must compile a model before training/testing. Use LayersModel.compile(modelCompileArgs).");for(var r=[],a=0;a<this.feedOutputShapes.length;++a){var i=this.feedOutputShapes[a],o=this.feedLossFns[a];o===Qce?r.push(i.slice(0,i.length-1).concat([1])):r.push(i)}if($le(e=Qle(e,this.feedInputNames,this.feedInputShapes,!1,"input"),t=Qle(t,this.feedOutputNames,r,!1,"target")),ehe(t,this.feedLossFns,this.feedOutputShapes),this.stateful&&null!=n&&n>0&&e[0].shape[0]%n!=0)throw new mse("In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size "+"".concat(n,". Found: ").concat(e[0].shape[0]," sample(s)."));return[e,t]}},{key:"standardizeUserData",value:(u=c(o().mark((function e(t,n,r,a){var i,s,u,c,l,h,p,f,d,v=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=!(v.length>4&&void 0!==v[4])||v[4],s=v.length>5?v[5]:void 0,u=this.standardizeUserDataXY(t,n,i,s),c=S(u,2),l=c[0],h=c[1],null==r){e.next=5;break}throw new Error("sample weight is not supported yet.");case 5:if(p=null,null==a){e.next=19;break}f=Rle(a,this.outputNames),p=[],d=0;case 10:if(!(d<f.length)){e.next=19;break}return e.t0=p,e.next=14,_le(h[d],null,f[d]);case 14:e.t1=e.sent,e.t0.push.call(e.t0,e.t1);case 16:++d,e.next=10;break;case 19:return e.abrupt("return",[l,h,p]);case 20:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r){return u.apply(this,arguments)})},{key:"testLoop",value:function(e,t,n){var r=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4?arguments[4]:void 0;return e8((function(){var o=r.checkNumSamples(t,n,i,"steps"),s=[];if(a>0)throw new gse("Verbose mode is not implemented yet.");if(null!=i)throw new gse("steps mode in testLoop() is not implemented yet");for(var u=Kle(o,n),c=Dte(uue(0,o)),l=0;l<u.length;++l){var h=u[l][0],p=u[l][1],f=fue(c,h,p-h),d=qle(t,f),v=e(d);if(0===l)for(var m=0;m<v.length;++m)s.push(Z7(0));for(var g=0;g<v.length;++g){var y=v[g];s[g]=o8(s[g],c8(p-h,y))}}for(var b=0;b<s.length;++b)s[b]=u8(s[b],o);return s}))}},{key:"getDedupedMetricsNames",value:function(){for(var e=this.metricsNames,t=[],n=0;n<e.length;++n){var r=e[n],a=r;if(wse(e,r)>1){var i=wse(e.slice(0,n),r);a+="_".concat(i)}t.push(a)}return t}},{key:"makeTrainFunction",value:function(){var e=this;return function(t){var n=[],r=t.slice(0,e.inputs.length),a=t.slice(e.inputs.length,e.inputs.length+e.outputs.length),i=t.slice(e.inputs.length+e.outputs.length,e.inputs.length+2*e.outputs.length),o=[],s=e.collectedTrainableWeights.map((function(e){return e.read()}));return[e.optimizer_.minimize((function(){for(var t=[],s=0;s<e.inputs.length;++s)t.push({key:e.inputs[s],value:r[s]});for(var u,c=new dce(t),l=gce(e.outputs,c,{training:!0}),h=0;h<e.lossFunctions.length;++h){var p=(0,e.lossFunctions[h])(a[h],l[h]);null!=i[h]&&(p=Fle(p,i[h]));var f=j9(p);n.push(f),u=0===h?p:o8(u,p)}for(var d=0;d<e.metricsTensors.length;++d){var v=void 0;if(e.outputs.length>1&&d<e.outputs.length)v=n[d];else{var m=e.metricsTensors[d][0],g=e.metricsTensors[d][1];v=j9(m(a[g],l[g]))}n8(v),o.push(v)}return u=j9(u),e.calculateLosses().forEach((function(e){u=o8(u,e)})),u}),!0,s)].concat(o)}}},{key:"makeTestFunction",value:function(){var e=this;this.testFunction=function(t){return e8((function(){for(var n,r=[],a=t.slice(0,e.inputs.length),i=t.slice(e.inputs.length,e.inputs.length+e.outputs.length),o=[],s=0;s<e.inputs.length;++s)o.push({key:e.inputs[s],value:a[s]});for(var u=new dce(o),c=gce(e.outputs,u),l=0;l<e.lossFunctions.length;++l){var h=e.lossFunctions[l],p=j9(h(i[l],c[l]));n=0===l?p:o8(n,p),r.push(n)}for(var f=0;f<e.metricsTensors.length;++f){var d=e.metricsTensors[f][0],v=e.metricsTensors[f][1],m=j9(d(i[v],c[v]));r.push(m)}return r}))}}},{key:"fit",value:(i=c(o().mark((function e(t,n){var r,a,i,s,u,c,l,h,p,f,d,v,m,g,y,b,x,k,w,I,N,S,T,E,C,A,R=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=R.length>2&&void 0!==R[2]?R[2]:{},!this.isTraining){e.next=3;break}throw new Error("Cannot start training because another fit() call is ongoing.");case 3:return this.isTraining=!0,e.prev=4,jle(d=null==r.batchSize?32:r.batchSize),v=!1,e.next=10,this.standardizeUserData(t,n,r.sampleWeight,r.classWeight,v,d);case 10:if(m=e.sent,a=m[0],i=m[1],f=m[2],g=!1,!(null!=r.validationData&&r.validationData.length>0)){e.next=36;break}if(g=!0,2!==r.validationData.length){e.next=22;break}c=r.validationData[0],l=r.validationData[1],e.next=27;break;case 22:if(3!==r.validationData.length){e.next=26;break}throw new gse("validationData including sample weights is not supported yet.");case 26:throw new mse("When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; "+"".concat(r.validationData," is invalid."));case 27:return b=!0,e.next=30,this.standardizeUserData(c,l,null,null,b,d);case 30:x=e.sent,h=x[0],p=x[1],y=h.concat(p),e.next=37;break;case 36:null!=r.validationSplit&&r.validationSplit>0&&r.validationSplit<1?(g=!0,k=Math.floor(a[0].shape[0]*(1-r.validationSplit)),w=a[0].shape[0],h=Hle(a,k,w),s=a,a=Hle(a,0,k),p=Hle(i,k,w),u=i,i=Hle(i,0,k),y=h.concat(p)):null!=r.validationSteps&&(g=!0);case 37:return I=a.concat(i).concat(f),this.checkTrainableWeightsConsistency(),N=this.makeTrainFunction(),S=this.getDedupedMetricsNames(),g?(this.makeTestFunction(),T=this.testFunction,E=S.slice().concat(S.map((function(e){return"val_"+e})))):(T=null,y=[],E=S.slice()),C=Uce(r.callbacks,r.yieldEvery),e.next=45,this.fitLoop(N,I,S,d,r.epochs,r.verbose,C,T,y,r.shuffle,E,r.initialEpoch,null,null);case 45:return A=e.sent,e.abrupt("return",A);case 47:return e.prev=47,this.isTraining=!1,Yle(a,t),Yle(i,n),Yle(s,t),Yle(u,n),Yle(h,c),Yle(p,l),null!=f&&t8(f),e.finish(47);case 57:case"end":return e.stop()}}),e,this,[[4,,47,57]])}))),function(e,t){return i.apply(this,arguments)})},{key:"fitLoop",value:(a=c(o().mark((function e(t,n,r,a,i,s,u,c,l,h,p,f,d,v){var m,g,y,b,x,k,w,I,N=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==a&&(a=32),null==i&&(i=1),null==h&&(h=!0),null==f&&(f=0),m=!1,null!=c&&null!=l&&(m=!0),null==v){e.next=10;break}if(m=!0,null!=d){e.next=10;break}throw new mse("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");case 10:return null!=(g=this.checkNumSamples(n,a,d,"steps_per_epoch"))&&(y=uue(0,g)),null==s&&(s=1),b=jce(u,s,i,f,g,d,a,m,p),x=b.callbackList,k=b.history,x.setModel(this),this.history=k,e.next=18,x.onTrainBegin();case 18:this.stopTraining_=!1,w=o().mark((function e(){var i,s,u,p,f;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,x.onEpochBegin(I);case 2:if(i={},null==d){e.next=7;break}throw new gse("stepsPerEpoch mode is not implemented yet.");case 7:if("batch"!==h){e.next=11;break}throw new gse("batch shuffling is not implemneted yet");case 11:h&&C$(y);case 12:s=Dte(y),u=Kle(g,a),p=o().mark((function e(h){var p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return p={},e.next=3,x.onBatchBegin(h,p);case 3:return e8((function(){var e=u[h][0],o=u[h][1],f=fue(s,e,o-e);p.batch=h,p.size=o-e;for(var d=qle(n,f),v=t(d),g=0;g<r.length;++g){var y=r[g],b=v[g];p[y]=b,n8(b)}if(h===u.length-1&&m)for(var x=N.testLoop(c,l,a),k=0;k<r.length;++k){var w=r[k],I=x[k];n8(I),i["val_"+w]=I}})),e.next=6,x.onBatchEnd(h,p);case 6:if(Lce(p),!N.stopTraining_){e.next=9;break}return e.abrupt("return","break");case 9:case"end":return e.stop()}}),e)})),f=0;case 16:if(!(f<u.length)){e.next=24;break}return e.delegateYield(p(f),"t0",18);case 18:if("break"!==e.t0){e.next=21;break}return e.abrupt("break",24);case 21:++f,e.next=16;break;case 24:s.dispose();case 25:return e.next=27,x.onEpochEnd(I,i);case 27:if(!N.stopTraining_){e.next=29;break}return e.abrupt("return","break");case 29:case"end":return e.stop()}}),e)})),I=f;case 21:if(!(I<i)){e.next=29;break}return e.delegateYield(w(),"t0",23);case 23:if("break"!==e.t0){e.next=26;break}return e.abrupt("break",29);case 26:++I,e.next=21;break;case 29:return e.next=31,x.onTrainEnd();case 31:return e.next=33,this.history.syncData();case 33:return e.abrupt("return",this.history);case 34:case"end":return e.stop()}}),e,this)}))),function(e,t,n,r,i,o,s,u,c,l,h,p,f,d){return a.apply(this,arguments)})},{key:"fitDataset",value:(r=c(o().mark((function e(t,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",zle(this,t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"trainOnBatch",value:(n=c(o().mark((function e(t,n){var r,a,i,s,u,c,l,h,p,f;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.standardizeUserData(t,n);case 2:r=e.sent,a=r[0],i=r[1],s=this.makeTrainFunction(),u=s(a.concat(i)),c=[],l=O(u),e.prev=9,l.s();case 11:if((h=l.n()).done){e.next=19;break}return p=h.value,e.next=15,p.data();case 15:f=e.sent,c.push(f[0]);case 17:e.next=11;break;case 19:e.next=24;break;case 21:e.prev=21,e.t0=e.catch(9),l.e(e.t0);case 24:return e.prev=24,l.f(),e.finish(24);case 27:return t8(u),Yle(r[0],t),Yle(r[1],n),e.abrupt("return",Ise(c));case 31:case"end":return e.stop()}}),e,this,[[9,21,24,27]])}))),function(e,t){return n.apply(this,arguments)})},{key:"getNamedWeights",value:function(e){for(var t=[],n=null!=e&&e.trainableOnly,r=n?this.trainableWeights:this.weights,a=this.getWeights(n),i=0;i<r.length;++i)n&&!r[i].trainable||t.push({name:r[i].originalName,tensor:a[i]});return t}},{key:"stopTraining",get:function(){return this.stopTraining_},set:function(e){this.stopTraining_=e}},{key:"optimizer",get:function(){return this.optimizer_},set:function(e){this.optimizer_!==e&&(this.optimizer_=e,this.isOptimizerOwned=!1)}},{key:"dispose",value:function(){var e=N(v(m.prototype),"dispose",this).call(this);if(0===e.refCountAfterDispose&&null!=this.optimizer&&this.isOptimizerOwned){var t=$6().numTensors;this.optimizer_.dispose(),e.numDisposedVariables+=t-$6().numTensors}return e}},{key:"getLossIdentifiers",value:function(){var e;if("string"==typeof this.loss)e=Sse(this.loss);else if(Array.isArray(this.loss)){var t,n=O(this.loss);try{for(n.s();!(t=n.n()).done;){if("string"!=typeof t.value)throw new Error("Serialization of non-string loss is not supported.")}}catch(e){n.e(e)}finally{n.f()}e=this.loss.map((function(e){return Sse(e)}))}else{var r=Object.keys(this.loss);e={};for(var a=this.loss,i=0,o=r;i<o.length;i++){var s=o[i];if("string"!=typeof a[s])throw new Error("Serialization of non-string loss is not supported.");e[s]=Sse(a[s])}}return e}},{key:"getMetricIdentifiers",value:function(){if("string"==typeof this.metrics||"function"==typeof this.metrics)return[Sse(dle(this.metrics))];if(Array.isArray(this.metrics))return this.metrics.map((function(e){return Sse(dle(e))}));var e={};for(var t in this.metrics)e[t]=Sse(dle(this.metrics[t]));return e}},{key:"getTrainingConfig",value:function(){return{loss:this.getLossIdentifiers(),metrics:this.getMetricIdentifiers(),optimizer_config:{class_name:this.optimizer.getClassName(),config:this.optimizer.getConfig()}}}},{key:"loadTrainingConfig",value:function(e){if(null!=e.weighted_metrics)throw new Error("Loading weight_metrics is not supported yet.");if(null!=e.loss_weights)throw new Error("Loading loss_weights is not supported yet.");if(null!=e.sample_weight_mode)throw new Error("Loading sample_weight_mode is not supported yet.");var t,n,r=Hce(Sle(e.optimizer_config));if("string"==typeof e.loss)t=Tse(e.loss);else if(Array.isArray(e.loss))t=e.loss.map((function(e){return Tse(e)}));else if(null!=e.loss)for(var a in t={},e.loss)t[a]=Tse(e.loss[a]);if(Array.isArray(e.metrics))n=e.metrics.map((function(e){return Tse(e)}));else if(null!=e.metrics)for(var i in n={},e.metrics)n[i]=Tse(e.metrics[i]);this.compile({loss:t,metrics:n,optimizer:r})}},{key:"save",value:(t=c(o().mark((function e(t,n){var r,a,i,s,u,c,l,h,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t){e.next=9;break}if(0!==(r=c6(t)).length){e.next=6;break}throw new mse("Cannot find any save handlers for URL '".concat(t,"'"));case 6:if(!(r.length>1)){e.next=8;break}throw new mse("Found more than one (".concat(r.length,") save handlers for ")+"URL '".concat(t,"'"));case 8:t=r[0];case 9:if(null!=t.save){e.next=11;break}throw new mse("LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");case 11:return e.next=13,H5(this.getNamedWeights(n));case 13:if(a=e.sent,i=this.toJSON(null,!1),s={modelTopology:i,format:"layers-model",generatedBy:"TensorFlow.js tfjs-layers v".concat(Ele),convertedBy:null},null==n||!n.includeOptimizer||null==this.optimizer){e.next=34;break}return s.trainingConfig=this.getTrainingConfig(),c="optimizer",e.t0=pae,e.next=25,this.optimizer.getWeights();case 25:return e.t1=e.sent,e.t2=c,e.next=29,e.t0.encodeWeights.call(e.t0,e.t1,e.t2);case 29:l=e.sent,h=l.data,p=l.specs,(u=a.specs).push.apply(u,T(p)),a.data=$5([a.data,h]);case 34:return null!=this.userDefinedMetadata&&(mle(this.userDefinedMetadata,this.name,!0),s.userDefinedMetadata=this.userDefinedMetadata),s.weightData=a.data,s.weightSpecs=a.specs,e.abrupt("return",t.save(s));case 38:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"setUserDefinedMetadata",value:function(e){mle(e,this.name),this.userDefinedMetadata=e}},{key:"getUserDefinedMetadata",value:function(){return this.userDefinedMetadata}}]),m}(Cle);nhe.className="Model",Lre(nhe);var rhe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n)}(nhe);function ahe(){return ahe=c(o().mark((function e(t,n){var r,a,i,s,u,c,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("modelTopology"in t||(t={modelTopology:t}),null!=(r=t.modelTopology).model_config&&(r=r.model_config),a=Sle(r),i=Hce(a,n),null==t.weightsManifest){e.next=15;break}return e.next=9,$re(t.weightsManifest,t.pathPrefix,i.weights.map((function(e){return e.originalName})));case 9:s=e.sent,u={},c=O(i.weights);try{for(c.s();!(l=c.n()).done;)h=l.value,u[h.originalName]=s[h.originalName]}catch(e){c.e(e)}finally{c.f()}i.loadWeights(u),t8(s);case 15:return e.abrupt("return",i);case 16:case"end":return e.stop()}}),e)}))),ahe.apply(this,arguments)}function ihe(){return(ihe=c(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==n&&(n={}),"string"!=typeof t){e.next=10;break}if(0!==(r=l6(t,n)).length){e.next=7;break}r.push(sae(t,n)),e.next=9;break;case 7:if(!(r.length>1)){e.next=9;break}throw new mse("Found more than one (".concat(r.length,") load handlers for ")+"URL '".concat(t,"'"));case 9:t=r[0];case 10:return e.abrupt("return",ohe(t,void 0,n));case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ohe(e,t,n){return she.apply(this,arguments)}function she(){return she=c(o().mark((function e(t,n,r){var a,i,s,u,c,l,h,p,f;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==r&&(r={}),null!=t.load){e.next=3;break}throw new mse("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");case 3:return e.next=5,t.load();case 5:if(a=e.sent,null!=(i=a.modelTopology).model_config&&(i=i.model_config),s=null==r.strict||r.strict,u=null!=a.weightData&&null!=a.weightSpecs&&s,c=Hce(Sle(i),n,u),null!=(l=a.trainingConfig)&&c.loadTrainingConfig(l),null!=a.userDefinedMetadata&&c.setUserDefinedMetadata(a.userDefinedMetadata),null==a.weightData){e.next=24;break}if(null!=a.weightSpecs){e.next=17;break}throw new mse("LayersModel artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.");case 17:if(h=uhe(a.weightData,a.weightSpecs),p=h.modelWeights,f=h.optimizerWeights,c.loadWeights(p,s),!(null!=c.optimizer&&f.length>0)){e.next=22;break}return e.next=22,c.optimizer.setWeights(f);case 22:t8(p),t8(f.map((function(e){return e.tensor})));case 24:return e.abrupt("return",c);case 25:case"end":return e.stop()}}),e)}))),she.apply(this,arguments)}function uhe(e,t){var n=K5(e,t),r={},a=[];return t.forEach((function(e){"optimizer"===e.group?a.push({name:e.name,tensor:n[e.name]}):r[e.name]=n[e.name]})),{modelWeights:r,optimizerWeights:a}}rhe.className="Functional",Lre(rhe);var che=function(e){d(a,e);var t,n,r=w(a);function a(e){var t;if(l(this,a),e=e||{},(t=r.call(this,{inputs:[],outputs:[]})).trainable=!0,t.built=!1,t.name=null!=e.name?e.name:Use("sequential_"),null!=e.layers){var n,i=O(e.layers);try{for(i.s();!(n=i.n()).done;){var o=n.value;t.add(o)}}catch(e){i.e(e)}finally{i.f()}}return t}return p(a,[{key:"checkShape",value:function(e){if(e.inboundNodes[0].outputTensors[0].shape.some((function(e){return e<0})))throw new mse("Negative dimension size caused by adding layer "+"".concat(e.name," with input shape [")+"".concat(e.inboundNodes[0].inputTensors[0].shape,"]"))}},{key:"add",value:function(e){var t,n=e instanceof a||e instanceof nhe;if(n){if(1!==(t=e).outputs.length)throw new mse("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");if(1!==t.inputs.length)throw new mse("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 mse("The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.");var r=fce({batchShape:e.batchInputShape,dtype:e.dtype,name:e.name+"_input"});e.apply(r)}if(n)this.outputs=t.outputs,this.inputs=t.inputs;else{if(1!==e.inboundNodes.length)throw new mse("A layer added to a Sequential model must not already be "+"connected somewhere else. LayersModel received layer ".concat(e.name," ")+"which has ".concat(e.inboundNodes.length," pre-existing inbound ")+"connections.");if(1!==e.inboundNodes[0].outputTensors.length)throw new mse("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=hce(this.outputs[0])}this.inboundNodes=[],new uce({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:xse(null,this.inputs.length),outputMasks:[null],inputShapes:this.inputs.map((function(e){return e.shape})),outputShapes:this.outputs[0].shape})}else{var i=e.apply(this.outputs[0]);if(Array.isArray(i))throw new TypeError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[i],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}this.layers.push(e),this.built=!1}},{key:"pop",value: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]}}},{key:"call",value:function(e,t){return null==this.model&&this.build(),this.model.call(e,t)}},{key:"build",value:function(e){if($ue(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 nhe({inputs:this.inputs,outputs:this.outputs[0],name:this.name+"_model"}),this.model.trainable=this.trainable,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}},{key:"countParams",value:function(){return this.built||this.build(),N(v(a.prototype),"countParams",this).call(this)}},{key:"summary",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:console.log;this.built||this.build(),N(v(a.prototype),"summary",this).call(this,e,t,n)}},{key:"setWeights",value:function(e){null==this.model&&this.build(),this.model.setWeights(e)}},{key:"evaluate",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!this.built)throw new vse("The model needs to be compiled before being used.");return this.model.evaluate(e,t,n)}},{key:"evaluateDataset",value:function(){var e=c(o().mark((function e(t,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.built){e.next=2;break}throw new vse("The model needs to be compiled before being used.");case 2:return e.abrupt("return",this.model.evaluateDataset(t,n));case 3:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"predict",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return null==this.model&&this.build(),this.model.predict(e,t)}},{key:"predictOnBatch",value:function(e){return null==this.model&&this.build(),this.model.predictOnBatch(e)}},{key:"compile",value:function(e){this.build(),this.model.compile(e),this.optimizer_=this.model.optimizer,this.isOptimizerOwned=this.model.isOptimizerOwned,this.loss=this.model.loss,this.metrics=this.model.metrics,this.metricsTensors=this.model.metricsTensors,this.metricsNames=this.model.metricsNames}},{key:"optimizer",get:function(){return null==this.model?void 0:this.model.optimizer},set:function(e){this.model.optimizer=e}},{key:"fit",value:(n=c(o().mark((function e(t,n){var r,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=a.length>2&&void 0!==a[2]?a[2]:{},this.built){e.next=3;break}throw new vse("The model needs to be compiled before being used.");case 3:return e.abrupt("return",this.model.fit(t,n,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"fitDataset",value:function(){var e=c(o().mark((function e(t,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.built){e.next=2;break}throw new vse("The model needs to be compiled before being used.");case 2:return e.abrupt("return",this.model.fitDataset(t,n));case 3:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"trainOnBatch",value:(t=c(o().mark((function e(t,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.model.trainOnBatch(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"stopTraining",get:function(){if(null==this.model)throw new mse("Cannot get the stopTraining property of a sequential model before it is compiled.");return this.model.stopTraining},set:function(e){if(null==this.model)throw new mse("Cannot set the stopTraining property of a sequential model before it is compiled.");this.model.stopTraining=e}},{key:"getConfig",value:function(){var e,t=[],n=O(this.layers);try{for(n.s();!(e=n.n()).done;){var r=e.value,a={};a.className=r.getClassName(),a.config=r.getConfig(),t.push(a)}}catch(e){n.e(e)}finally{n.f()}return{name:this.name,layers:t}}}],[{key:"fromConfig",value:function(e,t){var n,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i={};if(t instanceof Array){if(null==t[0].className||"Merge"===t[0].className)throw new mse("Legacy serialization format not supported yet.");n=t}else F$(null!=t.layers,(function(){return"When the config data for a Sequential model is not an Array, it must be an Object that contains the 'layers' field."})),n=t.layers,delete t.layers,i=t;var o=new e(i);if(!(o instanceof a))throw new gse("Sequential.fromConfig called on non-Sequential input: ".concat(o));var s,u=O(n);try{for(u.s();!(s=u.n()).done;){var c=s.value,l=void 0,h=Hce(c,l,r);r&&h.setFastWeightInitDuringBuild(!0),o.add(h)}}catch(e){u.e(e)}finally{u.f()}return o}}]),a}(nhe);function lhe(e){return fce(e)}che.className="Sequential",Lre(che);var hhe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"getConfig",value:function(){return{}}}]),n}(Dre),phe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Sue(e,t)}}]),n}(hhe);phe.className="elu",Lre(phe);var fhe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e){return hte(e)}}]),n}(hhe);fhe.className="selu",Lre(fhe);var dhe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e){return nte(e)}}]),n}(hhe);dhe.className="relu",Lre(dhe);var vhe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e){return e8((function(){return X9(6,nte(e))}))}}]),n}(hhe);vhe.className="relu6",Lre(vhe);var mhe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e){return e}}]),n}(hhe);mhe.className="linear",Lre(mhe);var ghe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e){return H8(e)}}]),n}(hhe);ghe.className="sigmoid",Lre(ghe);var yhe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e){return function(e){return e8((function(){var t=o8(.5,c8(.2,e));return o7(t,0,1)}))}(e)}}]),n}(hhe);yhe.className="hardSigmoid",Lre(yhe);var bhe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e){return C9(e)}}]),n}(hhe);bhe.className="softplus",Lre(bhe);var xhe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e){return function(e){return e8((function(){return u8(e,o8(l8(e),1))}))}(e)}}]),n}(hhe);xhe.className="softsign",Lre(xhe);var khe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e){return K8(e)}}]),n}(hhe);khe.className="tanh",Lre(khe);var whe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return wte(e,t)}}]),n}(hhe);whe.className="softmax",Lre(whe);var Ihe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return _9(e,t)}}]),n}(hhe);Ihe.className="logSoftmax",Lre(Ihe);var Nhe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e8((function(){return c8(H8(c8(e,t)),e)}))}}]),n}(hhe);Nhe.className="swish",Lre(Nhe);var She=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e){return e8((function(){return c8(e,K8(C9(e)))}))}}]),n}(hhe);function The(e){return e.getClassName()}function Ehe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Rse(e,Mre.getMap().classNameMap,t,"activation")}function Che(e){if(null==e){var t={className:"linear",config:{}};return Ehe(t)}if("string"==typeof e){var n={};return n.className=e,n.config={},Ehe(n)}return e instanceof hhe?e:Ehe(e)}function Ahe(e){if(null!=e&&"object"!==s(e))throw new Error("Argument to L1L2 regularizer's constructor is expected to be an "+"object, but received: ".concat(e))}She.className="mish",Lre(She);var Rhe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n)}(Dre),_he=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),r=t.call(this),Ahe(e),r.l1=null==e||null==e.l1?.01:e.l1,r.l2=null==e||null==e.l2?.01:e.l2,r.hasL1=0!==r.l1,r.hasL2=0!==r.l2,r}return p(n,[{key:"apply",value:function(e){var t=this;return e8((function(){var n=H9([1]);return t.hasL1&&(n=o8(n,e9(c8(t.l1,l8(e))))),t.hasL2&&(n=o8(n,e9(c8(t.l2,wue(e))))),W8(n,[])}))}},{key:"getConfig",value:function(){return{l1:this.l1,l2:this.l2}}}],[{key:"fromConfig",value:function(e,t){return new e({l1:t.l1,l2:t.l2})}}]),n}(Rhe);_he.className="L1L2",Lre(_he);var Ohe={l1l2:"L1L2"};function Fhe(e){return Cse(e)}function Dhe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Rse(e,Mre.getMap().classNameMap,t,"regularizer")}function Mhe(e){return null==e?null:"string"==typeof e?Dhe({className:e in Ohe?Ohe[e]:e,config:{}}):e instanceof Rhe?e:Dhe(e)}var Lhe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,null==e?{}:e)).supportsMasking=!0,null!=e&&(r.maxValue=e.maxValue),r}return p(n,[{key:"call",value:function(e,t){e=Que(e);var n=nte(e);return null!=this.maxValue&&(n=o7(n,0,this.maxValue)),n}},{key:"computeOutputShape",value:function(e){return e}},{key:"getConfig",value:function(){var e={maxValue:this.maxValue},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);Lhe.className="ReLU",Lre(Lhe);var zhe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,null==e?{}:e)).DEFAULT_ALPHA=.3,null==e&&(e={}),r.alpha=null==e.alpha?r.DEFAULT_ALPHA:e.alpha,r}return p(n,[{key:"call",value:function(e,t){var n=Que(e);return g9(n,this.alpha)}},{key:"computeOutputShape",value:function(e){return e}},{key:"getConfig",value:function(){var e={alpha:this.alpha},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);zhe.className="LeakyReLU",Lre(zhe);var Phe=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),(r=t.call(this,null==e?{}:e)).DEFAULT_ALPHA_INITIALIZER="zeros",null==e&&(e={}),r.supportsMasking=!0,r.alphaInitializer=Yue(e.alphaInitializer||r.DEFAULT_ALPHA_INITIALIZER),r.alphaRegularizer=Mhe(e.alphaRegularizer),r.alphaConstraint=Rce(e.alphaConstraint),null==e.sharedAxes)r.sharedAxes=null;else if(Array.isArray(e.sharedAxes))r.sharedAxes=e.sharedAxes;else{if("number"!=typeof e.sharedAxes)throw new mse("Expected sharedAxes to be a number or an array of numbers, "+"but got ".concat(e.sharedAxes));r.sharedAxes=[e.sharedAxes]}return r}return p(n,[{key:"build",value:function(e){var t=(e=$ue(e)).slice(1);if(null!=this.sharedAxes){var n,r=O(this.sharedAxes);try{for(r.s();!(n=r.n()).done;){t[n.value-1]=1}}catch(e){r.e(e)}finally{r.f()}}this.alpha=this.addWeight("alpha",t,"float32",this.alphaInitializer,this.alphaRegularizer,!0,this.alphaConstraint);var a={};if(null!=this.sharedAxes)for(var i=1;i<e.length;++i)a[i]=e[i];this.inputSpec=[new ice({ndim:e.length,axes:a})],this.built=!0}},{key:"call",value:function(e,t){return e=Que(e),hee(e,this.alpha.read())}},{key:"getConfig",value:function(){var e={alphaInitializer:Xue(this.alphaInitializer),alphaRegularizer:Fhe(this.alphaRegularizer),alphaConstraint:Cce(this.alphaConstraint),sharedAxes:this.sharedAxes},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);Phe.className="PReLU",Lre(Phe);var Bhe=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),(r=t.call(this,null==e?{}:e)).DEFAULT_ALPHA=1,null==e&&(e={}),null!=e.alpha&&e.alpha!==r.DEFAULT_ALPHA)throw new gse("Non-default alpha value (".concat(e.alpha,") is not supported by the ")+"ELU layer yet.");return r.alpha=null==e.alpha?r.DEFAULT_ALPHA:e.alpha,r}return p(n,[{key:"call",value:function(e,t){var n=Que(e);return z7(n)}},{key:"computeOutputShape",value:function(e){return e}},{key:"getConfig",value:function(){var e={alpha:this.alpha},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);Bhe.className="ELU",Lre(Bhe);var Whe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,null==e?{}:e)).DEFAULT_THETA=1,null==e&&(e={}),r.theta=null==e.theta?r.DEFAULT_THETA:e.theta,r}return p(n,[{key:"call",value:function(e,t){var n=Que(e);return c8(n,X6(h9(n,this.theta),"float32"))}},{key:"computeOutputShape",value:function(e){return e}},{key:"getConfig",value:function(){var e={theta:this.theta},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);Whe.className="ThresholdedReLU",Lre(Whe);var Vhe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,null==e?{}:e)).DEFAULT_AXIS=1,null==e&&(e={}),r.softmax=(new whe).apply,r.axis=null==e.axis?r.DEFAULT_AXIS:e.axis,r}return p(n,[{key:"call",value:function(e,t){var n=Que(e);return this.softmax(n,this.axis)}},{key:"computeOutputShape",value:function(e){return e}},{key:"getConfig",value:function(){var e={axis:this.axis},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);function Uhe(e,t,n){if("number"==typeof e)return xse(e,t);if(e.length!==t)throw new mse("The ".concat(n," argument must be an integer or tuple of ").concat(t," integers.")+" Received: ".concat(e.length," elements."));for(var r=0;r<t;++r){var a=e[r];if((i=a)!==parseInt(i.toString(),10))throw new mse("The ".concat(n," argument must be an integer or tuple of ").concat(t)+" integers. Received: ".concat(JSON.stringify(e)," including a")+" non-integer number ".concat(a))}return e;var i}function Ghe(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(null==e)return e;var i,o=t+(t-1)*(a-1);return i="same"===n?e:e-o+1,Math.floor((i+r-1)/r)}function jhe(e,t,n,r){if(null==e)return null;if("valid"===r)e=e*t+sue([n-t,0]);else{if("same"!==r)throw new mse("Unsupport padding mode: ".concat(r,"."));e*=t}return e}function Hhe(e,t){return e8((function(){return Yse(t),"channelsFirst"===t?rne(e,[0,2,3,1]):e}))}function qhe(e,t){return e8((function(){return Yse(t),"channelsFirst"===t?rne(e,[0,2,3,4,1]):e}))}function Khe(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"valid",i=arguments.length>5?arguments[5]:void 0,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1;return e8((function(){if(null==i&&(i="channelsLast"),Yse(i),3!==e.shape.length)throw new mse("The input of a conv1dWithBias operation should be 3, but is "+"".concat(e.shape.length," instead."));if(3!==t.shape.length)throw new mse("The kernel for a conv1dWithBias operation should be 3, but is "+"".concat(t.shape.length," instead"));if(null!=n&&1!==n.shape.length)throw new mse("The bias for a conv1dWithBias operation should be 1, but is "+"".concat(t.shape.length," instead"));if("channelsFirst"===i&&(e=rne(e,[0,2,1])),"causal"===a)throw new gse("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");var s=p7(e,t,r,"same"===a?"same":"valid","NWC",o);return null!=n&&(s=Nue(s,n)),s}))}function Xhe(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[1,1],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"valid",i=arguments.length>5?arguments[5]:void 0,o=arguments.length>6?arguments[6]:void 0,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;return e8((function(){if(null==i&&(i="channelsLast"),Yse(i),3!==e.rank&&4!==e.rank)throw new mse("conv2dWithBiasActivation expects input to be of rank 3 or 4, "+"but received ".concat(e.rank,"."));if(3!==t.rank&&4!==t.rank)throw new mse("conv2dWithBiasActivation expects kernel to be of rank 3 or 4, "+"but received ".concat(e.rank,"."));var u=Hhe(e,i);if("causal"===a)throw new gse("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");return u=bne({x:u,filter:t,strides:r,pad:"same"===a?"same":"valid",dilations:o,dataFormat:"NHWC",bias:n,activation:s}),"channelsFirst"===i&&(u=rne(u,[0,3,1,2])),u}))}function Yhe(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[1,1,1],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"valid",i=arguments.length>5?arguments[5]:void 0,o=arguments.length>6?arguments[6]:void 0;return e8((function(){if(null==i&&(i="channelsLast"),Yse(i),4!==e.rank&&5!==e.rank)throw new mse("conv3dWithBias expects input to be of rank 4 or 5, but received "+"".concat(e.rank,"."));if(4!==t.rank&&5!==t.rank)throw new mse("conv3dWithBias expects kernel to be of rank 4 or 5, but received "+"".concat(e.rank,"."));var s=qhe(e,i);if("causal"===a)throw new gse("The support for CAUSAL padding mode in conv3dWithBias is not implemented yet.");return s=v7(s,t,r,"same"===a?"same":"valid","NDHWC",o),null!=n&&(s=Nue(s,n)),"channelsFirst"===i&&(s=rne(s,[0,4,1,2,3])),s}))}Vhe.className="Softmax",Lre(Vhe);var Jhe=function(e){d(n,e);var t=w(n);function n(e,r){var a;if(l(this,n),(a=t.call(this,r)).bias=null,a.DEFAULT_KERNEL_INITIALIZER="glorotNormal",a.DEFAULT_BIAS_INITIALIZER="zeros",n.verifyArgs(r),a.rank=e,Lse(a.rank,"rank"),1!==a.rank&&2!==a.rank&&3!==a.rank)throw new gse("Convolution layer for rank other than 1, 2, or 3 (".concat(a.rank,") is ")+"not implemented yet.");if(a.kernelSize=Uhe(r.kernelSize,e,"kernelSize"),a.strides=Uhe(null==r.strides?1:r.strides,e,"strides"),a.padding=null==r.padding?"valid":r.padding,Jse(a.padding),a.dataFormat=null==r.dataFormat?"channelsLast":r.dataFormat,Yse(a.dataFormat),a.activation=Che(r.activation),a.useBias=null==r.useBias||r.useBias,a.biasInitializer=Yue(r.biasInitializer||a.DEFAULT_BIAS_INITIALIZER),a.biasConstraint=Rce(r.biasConstraint),a.biasRegularizer=Mhe(r.biasRegularizer),a.activityRegularizer=Mhe(r.activityRegularizer),a.dilationRate=Uhe(null==r.dilationRate?1:r.dilationRate,e,"dilationRate"),1===a.rank&&Array.isArray(a.dilationRate)&&1!==a.dilationRate.length)throw new mse("dilationRate must be a number or an array of a single number for 1D convolution, but received "+"".concat(JSON.stringify(a.dilationRate)));if(2===a.rank){if("number"==typeof a.dilationRate)a.dilationRate=[a.dilationRate,a.dilationRate];else if(2!==a.dilationRate.length)throw new mse("dilationRate must be a number or array of two numbers for 2D "+"convolution, but received ".concat(JSON.stringify(a.dilationRate)))}else if(3===a.rank)if("number"==typeof a.dilationRate)a.dilationRate=[a.dilationRate,a.dilationRate,a.dilationRate];else if(3!==a.dilationRate.length)throw new mse("dilationRate must be a number or array of three numbers for 3D "+"convolution, but received ".concat(JSON.stringify(a.dilationRate)));return a}return p(n,[{key:"getConfig",value:function(){var e={kernelSize:this.kernelSize,strides:this.strides,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,activation:The(this.activation),useBias:this.useBias,biasInitializer:Xue(this.biasInitializer),biasRegularizer:Fhe(this.biasRegularizer),activityRegularizer:Fhe(this.activityRegularizer),biasConstraint:Cce(this.biasConstraint)},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}],[{key:"verifyArgs",value:function(e){if(kse("kernelSize"in e,"required key 'kernelSize' not in config"),"number"!=typeof e.kernelSize&&!Mse(e.kernelSize,"number",1,3))throw new mse("BaseConv expects config.kernelSize to be number or number[] with "+"length 1, 2, or 3, but received ".concat(JSON.stringify(e.kernelSize),"."))}}]),n}(lce),Zhe=function(e){d(n,e);var t=w(n);function n(e,r){var a;return l(this,n),(a=t.call(this,e,r)).kernel=null,n.verifyArgs(r),a.filters=r.filters,Lse(a.filters,"filters"),a.kernelInitializer=Yue(r.kernelInitializer||a.DEFAULT_KERNEL_INITIALIZER),a.kernelConstraint=Rce(r.kernelConstraint),a.kernelRegularizer=Mhe(r.kernelRegularizer),a}return p(n,[{key:"build",value:function(e){e=$ue(e);var t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t])throw new mse("The channel dimension of the input should be defined. "+"Found ".concat(e[t]));var n=e[t],r=this.kernelSize.concat([n,this.filters]);this.kernel=this.addWeight("kernel",r,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:f({},t,n)}],this.built=!0}},{key:"call",value:function(e,t){var n=this;return e8((function(){var t;e=Que(e);var r=null==n.bias?null:n.bias.read(),a=Pse(n.activation.getClassName());if(null!=a&&2===n.rank)t=Xhe(e,n.kernel.read(),r,n.strides,n.padding,n.dataFormat,n.dilationRate,a);else{if(1===n.rank)t=Khe(e,n.kernel.read(),r,n.strides[0],n.padding,n.dataFormat,n.dilationRate[0]);else if(2===n.rank)t=Xhe(e,n.kernel.read(),r,n.strides,n.padding,n.dataFormat,n.dilationRate);else{if(3!==n.rank)throw new gse("convolutions greater than 3D are not implemented yet.");t=Yhe(e,n.kernel.read(),r,n.strides,n.padding,n.dataFormat,n.dilationRate)}null!=n.activation&&(t=n.activation.apply(t))}return t}))}},{key:"computeOutputShape",value:function(e){e=$ue(e);for(var t=[],n="channelsLast"===this.dataFormat?e.slice(1,e.length-1):e.slice(2),r=0;r<n.length;++r){var a=Ghe(n[r],this.kernelSize[r],this.padding,this.strides[r],"number"==typeof this.dilationRate?this.dilationRate:this.dilationRate[r]);t.push(a)}var i=[e[0]];return"channelsLast"===this.dataFormat?(i=i.concat(t)).push(this.filters):(i.push(this.filters),i=i.concat(t)),i}},{key:"getConfig",value:function(){var e={filters:this.filters,kernelInitializer:Xue(this.kernelInitializer),kernelRegularizer:Fhe(this.kernelRegularizer),kernelConstraint:Cce(this.kernelConstraint)},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}],[{key:"verifyArgs",value:function(e){if(!("filters"in e)||"number"!=typeof e.filters||e.filters<1)throw new mse("Convolution layer expected config.filters to be a 'number' > 0 "+"but got ".concat(JSON.stringify(e.filters)))}}]),n}(Jhe),Qhe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),r=t.call(this,2,e),n.verifyArgs(e),r}return p(n,[{key:"getConfig",value:function(){var e=N(v(n.prototype),"getConfig",this).call(this);return delete e.rank,e}}],[{key:"verifyArgs",value:function(e){if("number"!=typeof e.kernelSize&&!Mse(e.kernelSize,"number",1,2))throw new mse("Conv2D expects config.kernelSize to be number or number[] with "+"length 1 or 2, but received ".concat(JSON.stringify(e.kernelSize),"."))}}]),n}(Zhe);Qhe.className="Conv2D",Lre(Qhe);var $he=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),r=t.call(this,3,e),n.verifyArgs(e),r}return p(n,[{key:"getConfig",value:function(){var e=N(v(n.prototype),"getConfig",this).call(this);return delete e.rank,e}}],[{key:"verifyArgs",value:function(e){if("number"!=typeof e.kernelSize&&(!Array.isArray(e.kernelSize)||1!==e.kernelSize.length&&3!==e.kernelSize.length))throw new mse("Conv3D expects config.kernelSize to be number or"+" [number, number, number], but received ".concat(JSON.stringify(e.kernelSize),"."))}}]),n}(Zhe);$he.className="Conv3D",Lre($he);var epe=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),(r=t.call(this,e)).inputSpec=[new ice({ndim:4})],"same"!==r.padding&&"valid"!==r.padding)throw new mse("Conv2DTranspose currently supports only padding modes 'same' "+"and 'valid', but received padding mode ".concat(r.padding));return r}return p(n,[{key:"build",value:function(e){if(4!==(e=$ue(e)).length)throw new mse("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 mse("The channel dimension of the inputs should be defined. Found `None`.");var n=e[t],r=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",r,"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 ice({ndim:4,axes:f({},t,n)})],this.built=!0}},{key:"call",value:function(e,t){var n=this;return e8((function(){var t=Que(e);if(4!==t.shape.length)throw new mse("Conv2DTranspose.call() expects input tensor to be rank-4, but "+"received a tensor of rank-".concat(t.shape.length));var r,a,i=t.shape,o=i[0];"channelsFirst"===n.dataFormat?(r=2,a=3):(r=1,a=2);var s=i[r],u=i[a],c=n.kernelSize[0],l=n.kernelSize[1],h=n.strides[0],p=n.strides[1],f=[o,jhe(s,h,c,n.padding),jhe(u,p,l,n.padding),n.filters];"channelsLast"!==n.dataFormat&&(t=rne(t,[0,2,3,1]));var d=d7(t,n.kernel.read(),f,n.strides,n.padding);return"channelsLast"!==n.dataFormat&&(d=rne(d,[0,3,1,2])),null!=n.bias&&(d=Nue(d,n.bias.read(),n.dataFormat)),null!=n.activation&&(d=n.activation.apply(d)),d}))}},{key:"computeOutputShape",value:function(e){var t,n,r,a=(e=$ue(e)).slice();"channelsFirst"===this.dataFormat?(t=1,n=2,r=3):(t=3,n=1,r=2);var i=this.kernelSize[0],o=this.kernelSize[1],s=this.strides[0],u=this.strides[1];return a[t]=this.filters,a[n]=jhe(a[n],s,i,this.padding),a[r]=jhe(a[r],u,o,this.padding),a}},{key:"getConfig",value:function(){var e=N(v(n.prototype),"getConfig",this).call(this);return delete e.dilationRate,e}}]),n}(Qhe);epe.className="Conv2DTranspose",Lre(epe);var tpe=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),(r=t.call(this,e)).inputSpec=[new ice({ndim:5})],"same"!==r.padding&&"valid"!==r.padding)throw new mse("Conv3DTranspose currently supports only padding modes 'same' "+"and 'valid', but received padding mode ".concat(r.padding));return r}return p(n,[{key:"build",value:function(e){if(5!==(e=$ue(e)).length)throw new mse("Input should have rank 5; Received input shape: "+JSON.stringify(e));var t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t])throw new mse("The channel dimension of the inputs should be defined. Found `None`.");var n=e[t],r=this.kernelSize.concat([this.filters,n]);this.kernel=this.addWeight("kernel",r,"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 ice({ndim:5,axes:f({},t,n)})],this.built=!0}},{key:"call",value:function(e,t){var n=this;return e8((function(){var t=Que(e);if(5!==t.shape.length)throw new mse("Conv3DTranspose.call() expects input tensor to be rank-4, but "+"received a tensor of rank-".concat(t.shape.length));var r,a,i,o=t.shape,s=o[0];"channelsFirst"===n.dataFormat?(i=2,r=3,a=4):(i=1,r=2,a=3);var u=o[i],c=o[r],l=o[a],h=n.kernelSize[0],p=n.kernelSize[1],f=n.kernelSize[2],d=n.strides[0],v=n.strides[1],m=n.strides[2],g=[s,jhe(u,d,h,n.padding),jhe(c,v,p,n.padding),jhe(l,m,f,n.padding),n.filters];"channelsLast"!==n.dataFormat&&(t=rne(t,[0,2,3,4,1]));var y=g7(t,n.kernel.read(),g,n.strides,n.padding);return"channelsLast"!==n.dataFormat&&(y=rne(y,[0,4,1,2,3])),null!==n.bias&&(y=Nue(y,n.bias.read(),n.dataFormat)),null!==n.activation&&(y=n.activation.apply(y)),y}))}},{key:"computeOutputShape",value:function(e){var t,n,r,a,i=(e=$ue(e)).slice();"channelsFirst"===this.dataFormat?(t=1,n=2,r=3,a=4):(t=4,n=1,r=2,a=3);var o=this.kernelSize[0],s=this.kernelSize[1],u=this.kernelSize[2],c=this.strides[0],l=this.strides[1],h=this.strides[2];return i[t]=this.filters,i[n]=jhe(i[n],c,o,this.padding),i[r]=jhe(i[r],l,s,this.padding),i[a]=jhe(i[a],h,u,this.padding),i}},{key:"getConfig",value:function(){var e=N(v(n.prototype),"getConfig",this).call(this);return delete e.dilationRate,e}}]),n}($he);tpe.className="Conv3DTranspose",Lre(tpe);var npe=function(e){d(n,e);var t=w(n);function n(e,r){var a;if(l(this,n),(a=t.call(this,e,r)).DEFAULT_DEPTHWISE_INITIALIZER="glorotUniform",a.DEFAULT_POINTWISE_INITIALIZER="glorotUniform",a.depthwiseKernel=null,a.pointwiseKernel=null,null==r.filters)throw new mse("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(null!=r.kernelInitializer||null!=r.kernelRegularizer||null!=r.kernelConstraint)throw new mse("Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.");if(null!=r.padding&&"same"!==r.padding&&"valid"!==r.padding)throw new mse("SeparableConv".concat(a.rank,"D supports only padding modes: ")+"'same' and 'valid', but received ".concat(JSON.stringify(r.padding)));return a.depthMultiplier=null==r.depthMultiplier?1:r.depthMultiplier,a.depthwiseInitializer=Yue(r.depthwiseInitializer||a.DEFAULT_DEPTHWISE_INITIALIZER),a.depthwiseRegularizer=Mhe(r.depthwiseRegularizer),a.depthwiseConstraint=Rce(r.depthwiseConstraint),a.pointwiseInitializer=Yue(r.depthwiseInitializer||a.DEFAULT_POINTWISE_INITIALIZER),a.pointwiseRegularizer=Mhe(r.pointwiseRegularizer),a.pointwiseConstraint=Rce(r.pointwiseConstraint),a}return p(n,[{key:"build",value:function(e){if((e=$ue(e)).length<this.rank+2)throw new mse("Inputs to SeparableConv".concat(this.rank,"D should have rank ")+"".concat(this.rank+2,", but received input shape: ")+"".concat(JSON.stringify(e)));var t="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[t]||e[t]<0)throw new mse("The channel dimension of the inputs should be defined, "+"but found ".concat(JSON.stringify(e[t])));for(var n=e[t],r=this.kernelSize.concat([n,this.depthMultiplier]),a=[],i=0;i<this.rank;++i)a.push(1);a.push(n*this.depthMultiplier,this.filters);var o=!0;this.depthwiseKernel=this.addWeight("depthwise_kernel",r,"float32",this.depthwiseInitializer,this.depthwiseRegularizer,o,this.depthwiseConstraint),this.pointwiseKernel=this.addWeight("pointwise_kernel",a,"float32",this.pointwiseInitializer,this.pointwiseRegularizer,o,this.pointwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,o,this.biasConstraint):this.bias=null,this.inputSpec=[new ice({ndim:this.rank+2,axes:f({},t,n)})],this.built=!0}},{key:"call",value:function(e,t){var n=this;return e8((function(){var t;if(e=Que(e),1===n.rank)throw new gse("1D separable convolution is not implemented yet.");return 2===n.rank&&("channelsFirst"===n.dataFormat&&(e=rne(e,[0,2,3,1])),t=pte(e,n.depthwiseKernel.read(),n.pointwiseKernel.read(),n.strides,n.padding,n.dilationRate,"NHWC")),n.useBias&&(t=Nue(t,n.bias.read(),n.dataFormat)),null!=n.activation&&(t=n.activation.apply(t)),"channelsFirst"===n.dataFormat&&(t=rne(t,[0,3,1,2])),t}))}},{key:"getConfig",value:function(){var e=N(v(n.prototype),"getConfig",this).call(this);return delete e.rank,delete e.kernelInitializer,delete e.kernelRegularizer,delete e.kernelConstraint,e.depthwiseInitializer=Xue(this.depthwiseInitializer),e.pointwiseInitializer=Xue(this.pointwiseInitializer),e.depthwiseRegularizer=Fhe(this.depthwiseRegularizer),e.pointwiseRegularizer=Fhe(this.pointwiseRegularizer),e.depthwiseConstraint=Cce(this.depthwiseConstraint),e.pointwiseConstraint=Cce(this.pointwiseConstraint),e}}]),n}(Zhe);npe.className="SeparableConv";var rpe=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,2,e)}return p(n)}(npe);rpe.className="SeparableConv2D",Lre(rpe);var ape=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),r=t.call(this,1,e),n.verifyArgs(e),r.inputSpec=[{ndim:3}],r}return p(n,[{key:"getConfig",value:function(){var e=N(v(n.prototype),"getConfig",this).call(this);return delete e.rank,delete e.dataFormat,e}}],[{key:"verifyArgs",value:function(e){if("number"!=typeof e.kernelSize&&!Mse(e.kernelSize,"number",1,1))throw new mse("Conv1D expects config.kernelSize to be number or number[] with "+"length 1, but received ".concat(JSON.stringify(e.kernelSize),"."))}}]),n}(Zhe);ape.className="Conv1D",Lre(ape);var ipe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),r=t.call(this,e),"number"==typeof e.cropping?r.cropping=[[e.cropping,e.cropping],[e.cropping,e.cropping]]:"number"==typeof e.cropping[0]?r.cropping=[[e.cropping[0],e.cropping[0]],[e.cropping[1],e.cropping[1]]]:r.cropping=e.cropping,r.dataFormat=void 0===e.dataFormat?"channelsLast":e.dataFormat,r.inputSpec=[{ndim:4}],r}return p(n,[{key:"computeOutputShape",value: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]]}},{key:"call",value:function(e,t){var n=this;return e8((function(){if(e=Que(e),"channelsLast"===n.dataFormat){var t=vue(e,n.cropping[0][0],e.shape[1]-n.cropping[0][0]-n.cropping[0][1],2);return vue(t,n.cropping[1][0],e.shape[2]-n.cropping[1][1]-n.cropping[1][0],3)}var r=vue(e,n.cropping[0][0],e.shape[2]-n.cropping[0][0]-n.cropping[0][1],3);return vue(r,n.cropping[1][0],e.shape[3]-n.cropping[1][1]-n.cropping[1][0],4)}))}},{key:"getConfig",value:function(){var e={cropping:this.cropping,dataFormat:this.dataFormat},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);ipe.className="Cropping2D",Lre(ipe);var ope=function(e){d(n,e);var t=w(n);function n(e){var r,a;return l(this,n),(r=t.call(this,e)).DEFAULT_SIZE=[2,2],r.inputSpec=[{ndim:4}],r.size=null==e.size?r.DEFAULT_SIZE:e.size,r.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,Yse(r.dataFormat),r.interpolation=null==e.interpolation?"nearest":e.interpolation,a=r.interpolation,Dse(jse,"InterpolationFormat",a),r}return p(n,[{key:"computeOutputShape",value: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]}var r=null==e[1]?null:this.size[0]*e[1],a=null==e[2]?null:this.size[1]*e[2];return[e[0],r,a,e[3]]}},{key:"call",value:function(e,t){var n=this;return e8((function(){var t=Que(e),r=t.shape;if("channelsFirst"===n.dataFormat){t=rne(t,[0,2,3,1]);var a=n.size[0]*r[2],i=n.size[1]*r[3],o="nearest"===n.interpolation?Are.resizeNearestNeighbor(t,[a,i]):Are.resizeBilinear(t,[a,i]);return rne(o,[0,3,1,2])}var s=n.size[0]*r[1],u=n.size[1]*r[2];return"nearest"===n.interpolation?Are.resizeNearestNeighbor(t,[s,u]):Are.resizeBilinear(t,[s,u])}))}},{key:"getConfig",value:function(){var e={size:this.size,dataFormat:this.dataFormat,interpolation:this.interpolation},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);ope.className="UpSampling2D",Lre(ope);var spe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,2,e)).depthwiseKernel=null,r.depthMultiplier=null==e.depthMultiplier?1:e.depthMultiplier,r.depthwiseInitializer=Yue(e.depthwiseInitializer||r.DEFAULT_KERNEL_INITIALIZER),r.depthwiseConstraint=Rce(e.depthwiseConstraint),r.depthwiseRegularizer=Mhe(e.depthwiseRegularizer),r}return p(n,[{key:"build",value:function(e){if((e=$ue(e)).length<4)throw new mse("Inputs to DepthwiseConv2D should have rank 4. "+"Received input shape: ".concat(JSON.stringify(e),"."));var t="channelsFirst"===this.dataFormat?1:3;if(null==e[t]||e[t]<0)throw new mse("The channel dimension of the inputs to DepthwiseConv2D should "+"be defined, but is not (".concat(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}},{key:"call",value:function(e,t){var n=this;return e8((function(){var t=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[1,1],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"valid",a=arguments.length>4?arguments[4]:void 0,i=arguments.length>5?arguments[5]:void 0;return e8((function(){null==a&&(a="channelsLast"),Yse(a);var o=Hhe(e,a);if(4!==e.rank)throw new mse("Input for depthwiseConv2d is required to be 4-D, but is instead "+"".concat(e.rank,"-D"));if(4!==t.rank)throw new mse("depthwiseKernel is required to be 4-D, but is instead "+"".concat(t.rank,"-D"));return o=N7(o,t,n,"same"===r?"same":"valid","NHWC",i),"channelsFirst"===a&&(o=rne(o,[0,3,1,2])),o}))}(e=Que(e),n.depthwiseKernel.read(),n.strides,n.padding,n.dataFormat,null);return n.useBias&&(t=Nue(t,n.bias.read(),n.dataFormat)),null!=n.activation&&(t=n.activation.apply(t)),t}))}},{key:"computeOutputShape",value:function(e){e=$ue(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,a=Ghe(t,this.kernelSize[0],this.padding,this.strides[0]),i=Ghe(n,this.kernelSize[1],this.padding,this.strides[1]);return"channelsFirst"===this.dataFormat?[e[0],r,a,i]:[e[0],a,i,r]}},{key:"getConfig",value:function(){var e=N(v(n.prototype),"getConfig",this).call(this);return e.depthMultiplier=this.depthMultiplier,e.depthwiseInitializer=Xue(this.depthwiseInitializer),e.depthwiseRegularizer=Fhe(this.depthwiseRegularizer),e.depthwiseConstraint=Cce(this.depthwiseRegularizer),e}}]),n}(Jhe);function upe(e,t,n,r){if(Array.isArray(e)){if(null!=t||null!=n)throw new mse("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 a(e){return null==e||Array.isArray(e)?e:[e]}return{inputs:e,initialState:t=a(t),constants:n=a(n)}}function cpe(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4?arguments[4]:void 0,i=arguments.length>5?arguments[5]:void 0,o=arguments.length>6&&void 0!==arguments[6]&&arguments[6],s=arguments.length>7&&void 0!==arguments[7]&&arguments[7];return e8((function(){var u=t.shape.length;if(u<3)throw new mse("Input should be at least 3D, but is ".concat(u,"D."));var c=[1,0].concat(uue(2,u));if(t=rne(t,c),null!=i)throw new gse("The rnn() functoin of the deeplearn.js backend does not support constants yet.");o&&console.warn("Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend."),null!=a&&((a=X6(X6(a,"bool"),"float32")).rank===u-1&&(a=i9(a,-1)),a=rne(a,c)),r&&(t=ate(t,0),null!=a&&(a=ate(a,0)));var l,h,p=[],f=n,d=t.shape[0],v=Yte(t);null!=a&&(h=Yte(a));for(var m,g=function(t){var n=v[t],r=e8((function(){return e(n,f)}));if(null==a)l=r[0],f=r[1];else{var i=e8((function(){var e=h[t],n=R9(nee(e),e);return{output:o8(c8(r[0],e),c8(f[0],n)),newStates:f.map((function(t,a){return o8(c8(r[1][a],e),c8(t,n))}))}}));l=i.output,f=i.newStates}s&&p.push(l)},y=0;y<d;++y)g(y);if(s){m=Rte(p,1)}return[l,m,f]}))}spe.className="DepthwiseConv2D",Lre(spe);var lpe=function(e){d(n,e);var t=w(n);function n(e){var r,a;if(l(this,n),r=t.call(this,e),null==e.cell)throw new mse("cell property is missing for the constructor of RNN.");if(null==(a=Array.isArray(e.cell)?new ype({cells:e.cell}):e.cell).stateSize)throw new mse("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");return r.cell=a,r.returnSequences=null!=e.returnSequences&&e.returnSequences,r.returnState=null!=e.returnState&&e.returnState,r.goBackwards=null!=e.goBackwards&&e.goBackwards,r._stateful=null!=e.stateful&&e.stateful,r.unroll=null!=e.unroll&&e.unroll,r.supportsMasking=!0,r.inputSpec=[new ice({ndim:3})],r.stateSpec=null,r.states_=null,r.numConstants=null,r.keptStates=[],r}return p(n,[{key:"getStates",value:function(){return null==this.states_?uue(0,Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1).map((function(e){return null})):this.states_}},{key:"setStates",value:function(e){this.states_=e}},{key:"computeOutputShape",value:function(e){Jue(e)&&(e=e[0]);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){var a,i=[],o=O(t);try{for(o.s();!(a=o.n()).done;){var s=a.value;i.push([e[0],s])}}catch(e){o.e(e)}finally{o.f()}return[n].concat(i)}return n}},{key:"computeMask",value:function(e,t){var n=this;return e8((function(){Array.isArray(t)&&(t=t[0]);var e=n.returnSequences?t:null;if(n.returnState){var r=n.states.map((function(e){return null}));return[e].concat(r)}return e}))}},{key:"states",get:function(){if(null==this.states_){for(var e=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1,t=[],n=0;n<e;++n)t.push(null);return t}return this.states_},set:function(e){this.states_=e}},{key:"build",value:function(e){if(null!=this.numConstants)throw new gse("Constants support is not implemented in RNN yet.");Jue(e)&&(e=e[0]);var t=this.stateful?e[0]:null,n=e.slice(2);this.inputSpec[0]=new ice({shape:[t,null].concat(T(n))});var r,a=[e[0]].concat(e.slice(2));if(this.cell.build(a),r=Array.isArray(this.cell.stateSize)?this.cell.stateSize:[this.cell.stateSize],null!=this.stateSpec){if(!P$(this.stateSpec.map((function(e){return e.shape[e.shape.length-1]})),r))throw new mse("An initialState was passed that is not compatible with "+"cell.stateSize. Received stateSpec=".concat(this.stateSpec,"; ")+"However cell.stateSize is ".concat(this.cell.stateSize))}else this.stateSpec=r.map((function(e){return new ice({shape:[null,e]})}));this.stateful&&this.resetStates()}},{key:"resetStates",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e8((function(){if(!t.stateful)throw new dse("Cannot call resetStates() on an RNN Layer that is not stateful.");var r=t.inputSpec[0].shape[0];if(null==r)throw new mse("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 H9([r,e])})):t.states_=[H9([r,t.cell.stateSize])];else if(null==e)t8(t.states_),null!=t.keptStates&&(t8(t.keptStates),t.keptStates=[]),Array.isArray(t.cell.stateSize)?t.states_=t.cell.stateSize.map((function(e){return H9([r,e])})):t.states_[0]=H9([r,t.cell.stateSize]);else{if(Array.isArray(e)||(e=[e]),e.length!==t.states_.length)throw new mse("Layer ".concat(t.name," expects ").concat(t.states_.length," state(s), ")+"but it received ".concat(e.length," state value(s). Input ")+"received: ".concat(e));!0===n?t.keptStates.push(t.states_.slice()):t8(t.states_);for(var a=0;a<t.states_.length;++a){var i=e[a],o=Array.isArray(t.cell.stateSize)?t.cell.stateSize[a]:t.cell.stateSize,s=[r,o];if(!P$(i.shape,s))throw new mse("State ".concat(a," is incompatible with layer ").concat(t.name,": ")+"expected shape=".concat(s,", received shape=").concat(i.shape));t.states_[a]=i}}t.states_=t.states_.map((function(e){return n8(e.clone())}))}))}},{key:"apply",value:function(e,t){var r=null==t?null:t.initialState,a=null==t?null:t.constants;null==t&&(t={});var i=upe(e,r,a,this.numConstants);e=i.inputs,r=i.initialState,a=i.constants;var o=[],s=[];if(null!=r){t.initialState=r,o=o.concat(r),this.stateSpec=[];var u,c=O(r);try{for(c.s();!(u=c.n()).done;){var l=u.value;this.stateSpec.push(new ice({shape:l.shape}))}}catch(e){c.e(e)}finally{c.f()}s=s.concat(this.stateSpec)}if(null!=a&&(t.constants=a,o=o.concat(a),this.numConstants=a.length),o[0]instanceof oce){var h=[e].concat(o),p=this.inputSpec.concat(s),f=this.inputSpec;this.inputSpec=p;var d=N(v(n.prototype),"apply",this).call(this,h,t);return this.inputSpec=f,d}return N(v(n.prototype),"apply",this).call(this,e,t)}},{key:"call",value:function(e,t){var n=this;return e8((function(){var r=null==t?null:t.mask,a=null==t?null:t.training,i=null==t?null:t.initialState;e=Que(e),null==i&&(i=n.stateful?n.states_:n.getInitialState(e));var o=Array.isArray(n.cell.stateSize)?n.cell.stateSize.length:1;if(i.length!==o)throw new mse("RNN Layer has ".concat(o," state(s) but was passed ")+"".concat(i.length," initial state(s)."));n.unroll&&console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");var s={training:a},u=cpe((function(e,t){var r=n.cell.call([e].concat(t),s);return[r[0],r.slice(1)]}),e,i,n.goBackwards,r,null,n.unroll,n.returnSequences),c=u[0],l=u[1],h=u[2];n.stateful&&n.resetStates(h,a);var p=n.returnSequences?l:c;return n.returnState?[p].concat(h):p}))}},{key:"getInitialState",value:function(e){var t=this;return e8((function(){var n=H9(e.shape);return n=hue(n=e9(n,[1,2])),Array.isArray(t.cell.stateSize)?t.cell.stateSize.map((function(e){return e>1?yue(n,[1,e]):n})):t.cell.stateSize>1?[yue(n,[1,t.cell.stateSize])]:[n]}))}},{key:"trainableWeights",get:function(){return this.trainable?this.cell.trainableWeights:[]}},{key:"nonTrainableWeights",get:function(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights}},{key:"setFastWeightInitDuringBuild",value:function(e){N(v(n.prototype),"setFastWeightInitDuringBuild",this).call(this,e),null!=this.cell&&this.cell.setFastWeightInitDuringBuild(e)}},{key:"getConfig",value:function(){var e=N(v(n.prototype),"getConfig",this).call(this),t={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};null!=this.numConstants&&(t.numConstants=this.numConstants);var r=this.cell.getConfig();return this.getClassName()===n.className&&(t.cell={className:this.cell.getClassName(),config:r}),Object.assign(Object.assign(Object.assign({},r),e),t)}}],[{key:"fromConfig",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.cell,a=Hce(r,n);return new e(Object.assign(t,{cell:a}))}}]),n}(lce);lpe.className="RNN",Lre(lpe);var hpe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n)}(lce),ppe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).DEFAULT_ACTIVATION="tanh",r.DEFAULT_KERNEL_INITIALIZER="glorotNormal",r.DEFAULT_RECURRENT_INITIALIZER="orthogonal",r.DEFAULT_BIAS_INITIALIZER="zeros",r.units=e.units,Lse(r.units,"units"),r.activation=Che(null==e.activation?r.DEFAULT_ACTIVATION:e.activation),r.useBias=null==e.useBias||e.useBias,r.kernelInitializer=Yue(e.kernelInitializer||r.DEFAULT_KERNEL_INITIALIZER),r.recurrentInitializer=Yue(e.recurrentInitializer||r.DEFAULT_RECURRENT_INITIALIZER),r.biasInitializer=Yue(e.biasInitializer||r.DEFAULT_BIAS_INITIALIZER),r.kernelRegularizer=Mhe(e.kernelRegularizer),r.recurrentRegularizer=Mhe(e.recurrentRegularizer),r.biasRegularizer=Mhe(e.biasRegularizer),r.kernelConstraint=Rce(e.kernelConstraint),r.recurrentConstraint=Rce(e.recurrentConstraint),r.biasConstraint=Rce(e.biasConstraint),r.dropout=oue([1,sue([0,null==e.dropout?0:e.dropout])]),r.recurrentDropout=oue([1,sue([0,null==e.recurrentDropout?0:e.recurrentDropout])]),r.dropoutFunc=e.dropoutFunc,r.stateSize=r.units,r.dropoutMask=null,r.recurrentDropoutMask=null,r}return p(n,[{key:"build",value:function(e){e=$ue(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}},{key:"call",value:function(e,t){var n=this;return e8((function(){if(2!==e.length)throw new mse("SimpleRNNCell expects 2 input Tensors, got ".concat(e.length,"."));var r=e[1];e=e[0];var a,i=null!=t.training&&t.training;0<n.dropout&&n.dropout<1&&null==n.dropoutMask&&(n.dropoutMask=bpe({ones:function(){return nee(e)},rate:n.dropout,training:i,dropoutFunc:n.dropoutFunc})),0<n.recurrentDropout&&n.recurrentDropout<1&&null==n.recurrentDropoutMask&&(n.recurrentDropoutMask=bpe({ones:function(){return nee(r)},rate:n.recurrentDropout,training:i,dropoutFunc:n.dropoutFunc}));var o=n.dropoutMask,s=n.recurrentDropoutMask;a=xue(null!=o?c8(e,o):e,n.kernel.read()),null!=n.bias&&(a=Nue(a,n.bias.read())),null!=s&&(r=c8(r,s));var u=o8(a,xue(r,n.recurrentKernel.read()));return null!=n.activation&&(u=n.activation.apply(u)),[u,u]}))}},{key:"getConfig",value:function(){var e=N(v(n.prototype),"getConfig",this).call(this),t={units:this.units,activation:The(this.activation),useBias:this.useBias,kernelInitializer:Xue(this.kernelInitializer),recurrentInitializer:Xue(this.recurrentInitializer),biasInitializer:Xue(this.biasInitializer),kernelRegularizer:Fhe(this.kernelRegularizer),recurrentRegularizer:Fhe(this.recurrentRegularizer),biasRegularizer:Fhe(this.biasRegularizer),activityRegularizer:Fhe(this.activityRegularizer),kernelConstraint:Cce(this.kernelConstraint),recurrentConstraint:Cce(this.recurrentConstraint),biasConstraint:Cce(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout};return Object.assign(Object.assign({},e),t)}}]),n}(hpe);ppe.className="SimpleRNNCell",Lre(ppe);var fpe=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),e.cell=new ppe(e),t.call(this,e)}return p(n,[{key:"call",value:function(e,t){var r=this;return e8((function(){null!=r.cell.dropoutMask&&(t8(r.cell.dropoutMask),r.cell.dropoutMask=null),null!=r.cell.recurrentDropoutMask&&(t8(r.cell.recurrentDropoutMask),r.cell.recurrentDropoutMask=null);var a=null==t?null:t.mask,i=null==t?null:t.training,o=null==t?null:t.initialState;return N(v(n.prototype),"call",r).call(r,e,{mask:a,training:i,initialState:o})}))}}],[{key:"fromConfig",value:function(e,t){return new e(t)}}]),n}(lpe);fpe.className="SimpleRNN",Lre(fpe);var dpe=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),(r=t.call(this,e)).DEFAULT_ACTIVATION="tanh",r.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",r.DEFAULT_KERNEL_INITIALIZER="glorotNormal",r.DEFAULT_RECURRENT_INITIALIZER="orthogonal",r.DEFAULT_BIAS_INITIALIZER="zeros",e.resetAfter)throw new mse("GRUCell does not support reset_after parameter set to true.");return r.units=e.units,Lse(r.units,"units"),r.activation=Che(void 0===e.activation?r.DEFAULT_ACTIVATION:e.activation),r.recurrentActivation=Che(void 0===e.recurrentActivation?r.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),r.useBias=null==e.useBias||e.useBias,r.kernelInitializer=Yue(e.kernelInitializer||r.DEFAULT_KERNEL_INITIALIZER),r.recurrentInitializer=Yue(e.recurrentInitializer||r.DEFAULT_RECURRENT_INITIALIZER),r.biasInitializer=Yue(e.biasInitializer||r.DEFAULT_BIAS_INITIALIZER),r.kernelRegularizer=Mhe(e.kernelRegularizer),r.recurrentRegularizer=Mhe(e.recurrentRegularizer),r.biasRegularizer=Mhe(e.biasRegularizer),r.kernelConstraint=Rce(e.kernelConstraint),r.recurrentConstraint=Rce(e.recurrentConstraint),r.biasConstraint=Rce(e.biasConstraint),r.dropout=oue([1,sue([0,null==e.dropout?0:e.dropout])]),r.recurrentDropout=oue([1,sue([0,null==e.recurrentDropout?0:e.recurrentDropout])]),r.dropoutFunc=e.dropoutFunc,r.implementation=e.implementation,r.stateSize=r.units,r.dropoutMask=null,r.recurrentDropoutMask=null,r}return p(n,[{key:"build",value:function(e){var t=(e=$ue(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}},{key:"call",value:function(e,t){var n=this;return e8((function(){if(2!==e.length)throw new mse("GRUCell expects 2 input Tensors (inputs, h, c), got "+"".concat(e.length,"."));var r=null!=t.training&&t.training,a=e[1];e=e[0],0<n.dropout&&n.dropout<1&&null==n.dropoutMask&&(n.dropoutMask=bpe({ones:function(){return nee(e)},rate:n.dropout,training:r,count:3,dropoutFunc:n.dropoutFunc})),0<n.recurrentDropout&&n.recurrentDropout<1&&null==n.recurrentDropoutMask&&(n.recurrentDropoutMask=bpe({ones:function(){return nee(a)},rate:n.recurrentDropout,training:r,count:3,dropoutFunc:n.dropoutFunc}));var i,o,s,u=n.dropoutMask,c=n.recurrentDropoutMask;0<n.dropout&&n.dropout<1&&(e=c8(e,u[0]));var l=xue(e,n.kernel.read());n.useBias&&(l=Nue(l,n.bias.read())),0<n.recurrentDropout&&n.recurrentDropout<1&&(a=c8(a,c[0]));var h=n.recurrentKernel.read(),p=S(Tte(h,[2*n.units,n.units],h.rank-1),2),f=p[0],d=p[1],v=xue(a,f),m=S(Tte(l,3,l.rank-1),3),g=m[0],y=m[1],b=m[2],x=S(Tte(v,2,v.rank-1),2),k=x[0],w=x[1];i=n.recurrentActivation.apply(o8(g,k)),o=n.recurrentActivation.apply(o8(y,w));var I=xue(c8(o,a),d);s=n.activation.apply(o8(b,I));var N=o8(c8(i,a),c8(o8(1,E9(i)),s));return[N,N]}))}},{key:"getConfig",value:function(){var e=N(v(n.prototype),"getConfig",this).call(this),t={units:this.units,activation:The(this.activation),recurrentActivation:The(this.recurrentActivation),useBias:this.useBias,kernelInitializer:Xue(this.kernelInitializer),recurrentInitializer:Xue(this.recurrentInitializer),biasInitializer:Xue(this.biasInitializer),kernelRegularizer:Fhe(this.kernelRegularizer),recurrentRegularizer:Fhe(this.recurrentRegularizer),biasRegularizer:Fhe(this.biasRegularizer),activityRegularizer:Fhe(this.activityRegularizer),kernelConstraint:Cce(this.kernelConstraint),recurrentConstraint:Cce(this.recurrentConstraint),biasConstraint:Cce(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation,resetAfter:!1};return Object.assign(Object.assign({},e),t)}}]),n}(hpe);dpe.className="GRUCell",Lre(dpe);var vpe=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),0===e.implementation&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),e.cell=new dpe(e),t.call(this,e)}return p(n,[{key:"call",value:function(e,t){var r=this;return e8((function(){null!=r.cell.dropoutMask&&(t8(r.cell.dropoutMask),r.cell.dropoutMask=null),null!=r.cell.recurrentDropoutMask&&(t8(r.cell.recurrentDropoutMask),r.cell.recurrentDropoutMask=null);var a=null==t?null:t.mask,i=null==t?null:t.training,o=null==t?null:t.initialState;return N(v(n.prototype),"call",r).call(r,e,{mask:a,training:i,initialState:o})}))}}],[{key:"fromConfig",value:function(e,t){return 0===t.implmentation&&(t.implementation=1),new e(t)}}]),n}(lpe);vpe.className="GRU",Lre(vpe);var mpe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).DEFAULT_ACTIVATION="tanh",r.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",r.DEFAULT_KERNEL_INITIALIZER="glorotNormal",r.DEFAULT_RECURRENT_INITIALIZER="orthogonal",r.DEFAULT_BIAS_INITIALIZER="zeros",r.units=e.units,Lse(r.units,"units"),r.activation=Che(void 0===e.activation?r.DEFAULT_ACTIVATION:e.activation),r.recurrentActivation=Che(void 0===e.recurrentActivation?r.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),r.useBias=null==e.useBias||e.useBias,r.kernelInitializer=Yue(e.kernelInitializer||r.DEFAULT_KERNEL_INITIALIZER),r.recurrentInitializer=Yue(e.recurrentInitializer||r.DEFAULT_RECURRENT_INITIALIZER),r.biasInitializer=Yue(e.biasInitializer||r.DEFAULT_BIAS_INITIALIZER),r.unitForgetBias=e.unitForgetBias,r.kernelRegularizer=Mhe(e.kernelRegularizer),r.recurrentRegularizer=Mhe(e.recurrentRegularizer),r.biasRegularizer=Mhe(e.biasRegularizer),r.kernelConstraint=Rce(e.kernelConstraint),r.recurrentConstraint=Rce(e.recurrentConstraint),r.biasConstraint=Rce(e.biasConstraint),r.dropout=oue([1,sue([0,null==e.dropout?0:e.dropout])]),r.recurrentDropout=oue([1,sue([0,null==e.recurrentDropout?0:e.recurrentDropout])]),r.dropoutFunc=e.dropoutFunc,r.implementation=e.implementation,r.stateSize=[r.units,r.units],r.dropoutMask=null,r.recurrentDropoutMask=null,r}return p(n,[{key:"build",value:function(e){var t,n,r=(e=$ue(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 a=this.biasInitializer,i=this.units;n=new(t=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e,t){var n=a.apply([i]),r=(new Oue).apply([i]),o=a.apply([2*i]);return gue(gue(n,r),o)}}]),n}(Rue),t.className="CustomInit",t)}else n=this.biasInitializer;this.bias=this.addWeight("bias",[4*this.units],null,n,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0}},{key:"call",value:function(e,t){var n=this;return e8((function(){var r=null!=t.training&&t.training;if(3!==e.length)throw new mse("LSTMCell expects 3 input Tensors (inputs, h, c), got "+"".concat(e.length,"."));var a=e[1],i=e[2];e=e[0],0<n.dropout&&n.dropout<1&&null==n.dropoutMask&&(n.dropoutMask=bpe({ones:function(){return nee(e)},rate:n.dropout,training:r,count:4,dropoutFunc:n.dropoutFunc})),0<n.recurrentDropout&&n.recurrentDropout<1&&null==n.recurrentDropoutMask&&(n.recurrentDropoutMask=bpe({ones:function(){return nee(a)},rate:n.recurrentDropout,training:r,count:4,dropoutFunc:n.dropoutFunc}));var o,s,u,c,l=n.dropoutMask,h=n.recurrentDropoutMask;0<n.dropout&&n.dropout<1&&(e=c8(e,l[0]));var p=xue(e,n.kernel.read());0<n.recurrentDropout&&n.recurrentDropout<1&&(a=c8(a,h[0])),p=o8(p,xue(a,n.recurrentKernel.read())),n.useBias&&(p=Nue(p,n.bias.read()));var f=S(Tte(p,4,p.rank-1),4),d=f[0],v=f[1],m=f[2],g=f[3];o=n.recurrentActivation.apply(d),s=n.recurrentActivation.apply(v),u=o8(c8(s,i),c8(o,n.activation.apply(m))),c=n.recurrentActivation.apply(g);var y=c8(c,n.activation.apply(u));return[y,y,u]}))}},{key:"getConfig",value:function(){var e=N(v(n.prototype),"getConfig",this).call(this),t={units:this.units,activation:The(this.activation),recurrentActivation:The(this.recurrentActivation),useBias:this.useBias,kernelInitializer:Xue(this.kernelInitializer),recurrentInitializer:Xue(this.recurrentInitializer),biasInitializer:Xue(this.biasInitializer),unitForgetBias:this.unitForgetBias,kernelRegularizer:Fhe(this.kernelRegularizer),recurrentRegularizer:Fhe(this.recurrentRegularizer),biasRegularizer:Fhe(this.biasRegularizer),activityRegularizer:Fhe(this.activityRegularizer),kernelConstraint:Cce(this.kernelConstraint),recurrentConstraint:Cce(this.recurrentConstraint),biasConstraint:Cce(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout,implementation:this.implementation};return Object.assign(Object.assign({},e),t)}}]),n}(hpe);mpe.className="LSTMCell",Lre(mpe);var gpe=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),0===e.implementation&&console.warn("`implementation=0` has been deprecated, and now defaults to `implementation=1`. Please update your layer call."),e.cell=new mpe(e),t.call(this,e)}return p(n,[{key:"call",value:function(e,t){var r=this;return e8((function(){null!=r.cell.dropoutMask&&(t8(r.cell.dropoutMask),r.cell.dropoutMask=null),null!=r.cell.recurrentDropoutMask&&(t8(r.cell.recurrentDropoutMask),r.cell.recurrentDropoutMask=null);var a=null==t?null:t.mask,i=null==t?null:t.training,o=null==t?null:t.initialState;return N(v(n.prototype),"call",r).call(r,e,{mask:a,training:i,initialState:o})}))}}],[{key:"fromConfig",value:function(e,t){return 0===t.implmentation&&(t.implementation=1),new e(t)}}]),n}(lpe);gpe.className="LSTM",Lre(gpe);var ype=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).cells=e.cells,r}return p(n,[{key:"stateSize",get:function(){var e,t=[],n=O(this.cells.slice().reverse());try{for(n.s();!(e=n.n()).done;){var r=e.value;Array.isArray(r.stateSize)?t.push.apply(t,T(r.stateSize)):t.push(r.stateSize)}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"call",value:function(e,t){var n=this;return e8((function(){var r,a=e.slice(1),i=[],o=O(n.cells.slice().reverse());try{for(o.s();!(r=o.n()).done;){var s=r.value;Array.isArray(s.stateSize)?i.push(a.splice(0,s.stateSize.length)):i.push(a.splice(0,1))}}catch(e){o.e(e)}finally{o.f()}i.reverse();for(var u,c=[],l=0;l<n.cells.length;++l){var h=n.cells[l];a=i[l],u=0===l?[e[0]].concat(a):[u[0]].concat(a),u=h.call(u,t),c.push(u.slice(1))}a=[];var p,f=O(c.slice().reverse());try{for(f.s();!(p=f.n()).done;){var d,v=p.value;(d=a).push.apply(d,T(v))}}catch(e){f.e(e)}finally{f.f()}return[u[0]].concat(a)}))}},{key:"build",value:function(e){var t;Jue(e)&&(e=e[0]),this.cells.forEach((function(n,r){$se("RNNCell_".concat(r),(function(){n.build(e),t=Array.isArray(n.stateSize)?n.stateSize[0]:n.stateSize,e=[e[0],t]}))})),this.built=!0}},{key:"getConfig",value:function(){var e=N(v(n.prototype),"getConfig",this).call(this),t={cells:this.cells.map((function(e){return{className:e.getClassName(),config:e.getConfig()}}))};return Object.assign(Object.assign({},e),t)}},{key:"trainableWeights",get:function(){if(!this.trainable)return[];var e,t=[],n=O(this.cells);try{for(n.s();!(e=n.n()).done;){var r=e.value;t.push.apply(t,T(r.trainableWeights))}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"nonTrainableWeights",get:function(){var e,t=[],n=O(this.cells);try{for(n.s();!(e=n.n()).done;){var r=e.value;t.push.apply(t,T(r.nonTrainableWeights))}}catch(e){n.e(e)}finally{n.f()}if(!this.trainable){var a,i=[],o=O(this.cells);try{for(o.s();!(a=o.n()).done;){var s=a.value;i.push.apply(i,T(s.trainableWeights))}}catch(e){o.e(e)}finally{o.f()}return i.concat(t)}return t}},{key:"getWeights",value:function(){var e,t=[],n=O(this.cells);try{for(n.s();!(e=n.n()).done;){var r=e.value;t.push.apply(t,T(r.weights))}}catch(e){n.e(e)}finally{n.f()}return rce(t)}},{key:"setWeights",value:function(e){var t,n=[],r=O(this.cells);try{for(r.s();!(t=r.n()).done;)for(var a=t.value,i=a.weights.length,o=e.splice(i),s=0;s<a.weights.length;++s)n.push([a.weights[s],o[s]])}catch(e){r.e(e)}finally{r.f()}ace(n)}}],[{key:"fromConfig",value:function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=[],i=O(t.cells);try{for(i.s();!(n=i.n()).done;){var o=n.value;a.push(Hce(o,r))}}catch(e){i.e(e)}finally{i.f()}return new e({cells:a})}}]),n}(hpe);function bpe(e){var t=e.ones,n=e.rate,r=e.training,a=void 0!==r&&r,i=e.count,o=void 0===i?1:i,s=e.dropoutFunc,u=function(){return null!=s?s(t(),n):Tue(t(),n)},c=function(){return Eue(u,t,a)};return!o||o<=1?n8(c().clone()):Array(o).fill(void 0).map(c).map((function(e){return n8(e.clone())}))}ype.className="StackedRNNCells",Lre(ype);var xpe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n},kpe=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),e.unroll)throw new gse("Unrolling is not possible with convolutional RNNs.");if(Array.isArray(e.cell))throw new gse("It is not possible at the moment to stack convolutional cells.");return(r=t.call(this,e)).inputSpec=[new ice({ndim:5})],r}return p(n,[{key:"call",value:function(e,t){var r=this;return e8((function(){if(null!=r.cell.dropoutMask&&(t8(r.cell.dropoutMask),r.cell.dropoutMask=null),null!=r.cell.recurrentDropoutMask&&(t8(r.cell.recurrentDropoutMask),r.cell.recurrentDropoutMask=null),t&&t.constants)throw new mse("ConvRNN2D cell does not support constants");var a=null==t?null:t.mask,i=null==t?null:t.training,o=null==t?null:t.initialState;return N(v(n.prototype),"call",r).call(r,e,{mask:a,training:i,initialState:o})}))}},{key:"computeOutputShape",value:function(e){var t=this.computeSingleOutputShape(e);return this.returnSequences||(t=[t[0]].concat(T(t.slice(2)))),this.returnState&&(t=[t].concat(T(Array(2).fill([e[0]].concat(T(t.slice(-3))))))),t}},{key:"getInitialState",value:function(e){var t=this;return e8((function(){var n=t.cell.stateSize,r=e.shape,a=t.computeSingleOutputShape(r),i=H9([a[0]].concat(T(a.slice(2))));return Array.isArray(n)?Array(n.length).fill(i):[i]}))}},{key:"resetStates",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e8((function(){if(!t.stateful)throw new dse("Cannot call resetStates() on an RNN Layer that is not stateful.");var r=t.inputSpec[0].shape,a=t.computeSingleOutputShape(r),i=[a[0]].concat(T(a.slice(2)));if(null==r[0])throw new mse("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.getStates())Array.isArray(t.cell.stateSize)?t.states_=t.cell.stateSize.map((function(){return H9(i)})):t.states_=[H9(i)];else if(null==e)t8(t.states_),null!=t.keptStates&&(t8(t.keptStates),t.keptStates=[]),Array.isArray(t.cell.stateSize)?t.states_=t.cell.stateSize.map((function(){return H9(i)})):t.states_[0]=H9(i);else{if(Array.isArray(e)||(e=[e]),e.length!==t.states_.length)throw new mse("Layer ".concat(t.name," expects ").concat(t.states_.length," state(s), ")+"but it received ".concat(e.length," state value(s). Input ")+"received: ".concat(e));n?t.keptStates.push(t.states_.slice()):t8(t.states_);for(var o=0;o<t.states_.length;++o){var s=e[o],u=i;if(!P$(s.shape,u))throw new mse("State ".concat(o," is incompatible with layer ").concat(t.name,": ")+"expected shape=".concat(u,", received shape=").concat(s.shape));t.states_[o]=s}}t.states_=t.states_.map((function(e){return n8(e.clone())}))}))}},{key:"computeSingleOutputShape",value:function(e){var t=this.cell,n=t.dataFormat,r=t.filters,a=t.kernelSize,i=t.padding,o=t.strides,s=t.dilationRate,u="channelsFirst"===n,c=e[u?3:2],l=e[u?4:3],h=Ghe(c,a[0],i,o[0],s[0]),p=Ghe(l,a[1],i,o[1],s[1]);return[].concat(T(e.slice(0,2)),T(u?[r,h,p]:[h,p,r]))}}]),n}(lpe);kpe.className="ConvRNN2D";var wpe=function(e){d(n,e);var t=w(n);function n(e){var r;l(this,n);var a=e.filters,i=e.kernelSize,o=e.strides,s=e.padding,u=e.dataFormat,c=e.dilationRate;return(r=t.call(this,Object.assign(Object.assign({},e),{units:a}))).filters=a,Lse(r.filters,"filters"),r.kernelSize=Uhe(i,2,"kernelSize"),r.kernelSize.forEach((function(e){return Lse(e,"kernelSize")})),r.strides=Uhe(o||1,2,"strides"),r.strides.forEach((function(e){return Lse(e,"strides")})),r.padding=s||"valid",Jse(r.padding),r.dataFormat=u||"channelsLast",Yse(r.dataFormat),r.dilationRate=Uhe(c||1,2,"dilationRate"),r.dilationRate.forEach((function(e){return Lse(e,"dilationRate")})),r}return p(n,[{key:"build",value:function(e){var t;e=$ue(e);var n="channelsFirst"===this.dataFormat?1:e.length-1;if(null==e[n])throw new mse("The channel dimension of the input should be defined. "+"Found ".concat(e[n]));var r=e[n],a=this.kernelSize.concat([r,4*this.filters]);this.kernel=this.addWeight("kernel",a,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint);var i=this.kernelSize.concat([this.filters,4*this.filters]);if(this.recurrentKernel=this.addWeight("recurrent_kernel",i,null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){var o;if(this.unitForgetBias){var s=this.biasInitializer,u=this.filters;o=new(t=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"apply",value:function(e,t){return mue([s.apply([u]),q9([u]),s.apply([2*u])])}}]),n}(Rue),t.className="CustomInit",t)}else o=this.biasInitializer;this.bias=this.addWeight("bias",[4*this.filters],null,o,this.biasRegularizer,!0,this.biasConstraint)}this.built=!0}},{key:"call",value:function(e,t){var n=this;return e8((function(){if(3!==e.length)throw new mse("ConvLSTM2DCell expects 3 input Tensors (inputs, h, c), got "+"".concat(e.length,"."));var r=t.training||!1,a=e[0],i=e[1],o=e[2];0<n.dropout&&n.dropout<1&&null==n.dropoutMask&&(n.dropoutMask=bpe({ones:function(){return nee(a)},rate:n.dropout,training:r,count:4,dropoutFunc:n.dropoutFunc}));var s=n.dropoutMask,u=function(e,t,n){return t&&t[n]?c8(t[n],e):e},c=u(a,s,0),l=u(a,s,1),h=u(a,s,2),p=u(a,s,3);0<n.recurrentDropout&&n.recurrentDropout<1&&null==n.recurrentDropoutMask&&(n.recurrentDropoutMask=bpe({ones:function(){return nee(i)},rate:n.recurrentDropout,training:r,count:4,dropoutFunc:n.dropoutFunc}));var f=n.recurrentDropoutMask,d=u(i,f,0),v=u(i,f,1),m=u(i,f,2),g=u(i,f,3),y=S(Tte(n.kernel.read(),4,3),4),b=y[0],x=y[1],k=y[2],w=y[3],I=S(n.useBias?Tte(n.bias.read(),4):[null,null,null,null],4),N=I[0],T=I[1],E=I[2],C=I[3];c=n.inputConv(c,b,N,n.padding),l=n.inputConv(l,x,T,n.padding),h=n.inputConv(h,k,E,n.padding),p=n.inputConv(p,w,C,n.padding);var A=S(Tte(n.recurrentKernel.read(),4,3),4),R=A[0],_=A[1],O=A[2],F=A[3];d=n.recurrentConv(d,R),v=n.recurrentConv(v,_),m=n.recurrentConv(m,O),g=n.recurrentConv(g,F);var D=n.recurrentActivation.apply(o8(c,d)),M=n.recurrentActivation.apply(o8(l,v)),L=o8(c8(M,o),c8(D,n.activation.apply(o8(h,m)))),z=c8(n.recurrentActivation.apply(o8(p,g)),n.activation.apply(L));return[z,z,L]}))}},{key:"getConfig",value:function(){var e=N(v(n.prototype),"getConfig",this).call(this),t=(e.units,xpe(e,["units"])),r={filters:this.filters,kernelSize:this.kernelSize,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,strides:this.strides};return Object.assign(Object.assign({},t),r)}},{key:"inputConv",value:function(e,t,n,r){var a=h7(e,t,this.strides,r||"valid","channelsFirst"===this.dataFormat?"NCHW":"NHWC",this.dilationRate);return n?Nue(a,n,this.dataFormat):a}},{key:"recurrentConv",value:function(e,t){return h7(e,t,1,"same","channelsFirst"===this.dataFormat?"NCHW":"NHWC")}}]),n}(mpe);wpe.className="ConvLSTM2DCell",Lre(wpe);var Ipe=function(e){d(n,e);var t=w(n);function n(e){l(this,n);var r=new wpe(e);return t.call(this,Object.assign(Object.assign({},e),{cell:r}))}return p(n,null,[{key:"fromConfig",value:function(e,t){return new e(t)}}]),n}(kpe);Ipe.className="ConvLSTM2D",Lre(Ipe);var Npe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).rate=Math.max(Math.min(e.rate,1),0),r.noiseShape=e.noiseShape,r.seed=e.seed,r.supportsMasking=!0,r}return p(n,[{key:"getNoiseShape",value: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}},{key:"call",value:function(e,t){var n=this;return e8((function(){n.invokeCallHook(e,t);var r=Que(e);if(0<n.rate&&n.rate<1){var a=null!=t.training&&t.training,i=n.getNoiseShape(r);return Eue((function(){return Tue(r,n.rate,i,n.seed)}),(function(){return r}),a)}return e}))}},{key:"getConfig",value:function(){var e={rate:this.rate,noiseShape:this.noiseShape,seed:this.seed},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}},{key:"dispose",value:function(){return N(v(n.prototype),"dispose",this).call(this)}}]),n}(lce);Npe.className="Dropout",Lre(Npe);var Spe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).inputSpec=[{ndim:3}],r}return p(n,[{key:"getNoiseShape",value:function(e){var t=e.shape;return[t[0],1,t[2]]}}]),n}(Npe);Spe.className="SpatialDropout1D",Lre(Spe);var Tpe=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),(r=t.call(this,e)).activation=null,r.useBias=!0,r.kernel=null,r.bias=null,r.DEFAULT_KERNEL_INITIALIZER="glorotNormal",r.DEFAULT_BIAS_INITIALIZER="zeros",null==e.batchInputShape&&null==e.inputShape&&null!=e.inputDim){var a=null;null!=e.batchSize&&(a=e.batchSize),r.batchInputShape=[a,e.inputDim]}return r.units=e.units,Lse(r.units,"units"),r.activation=Che(e.activation),null!=e.useBias&&(r.useBias=e.useBias),r.kernelInitializer=Yue(e.kernelInitializer||r.DEFAULT_KERNEL_INITIALIZER),r.biasInitializer=Yue(e.biasInitializer||r.DEFAULT_BIAS_INITIALIZER),r.kernelConstraint=Rce(e.kernelConstraint),r.biasConstraint=Rce(e.biasConstraint),r.kernelRegularizer=Mhe(e.kernelRegularizer),r.biasRegularizer=Mhe(e.biasRegularizer),r.activityRegularizer=Mhe(e.activityRegularizer),r.supportsMasking=!0,r.inputSpec=[{minNDim:2}],r}return p(n,[{key:"build",value:function(e){var t=(e=$ue(e))[e.length-1];null==this.kernel&&(this.kernel=this.addWeight("kernel",[t,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:f({},-1,t)}],this.built=!0}},{key:"computeOutputShape",value:function(e){var t=(e=$ue(e)).slice();return t[t.length-1]=this.units,t}},{key:"call",value:function(e,t){var n=this;return e8((function(){n.invokeCallHook(e,t);var r,a=Que(e),i=Pse(n.activation.getClassName());return null!=i?r=xue(a,n.kernel.read(),i,n.bias?n.bias.read():null):(r=xue(a,n.kernel.read()),null!=n.bias&&(r=Nue(r,n.bias.read())),null!=n.activation&&(r=n.activation.apply(r))),r}))}},{key:"getConfig",value:function(){var e={units:this.units,activation:The(this.activation),useBias:this.useBias,kernelInitializer:Xue(this.kernelInitializer),biasInitializer:Xue(this.biasInitializer),kernelRegularizer:Fhe(this.kernelRegularizer),biasRegularizer:Fhe(this.biasRegularizer),activityRegularizer:Fhe(this.activityRegularizer),kernelConstraint:Cce(this.kernelConstraint),biasConstraint:Cce(this.biasConstraint)},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);Tpe.className="Dense",Lre(Tpe);var Epe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),e=e||{},(r=t.call(this,e)).inputSpec=[{minNDim:3}],r.dataFormat=e.dataFormat,r}return p(n,[{key:"computeOutputShape",value:function(e){var t,n=O((e=$ue(e)).slice(1));try{for(n.s();!(t=n.n()).done;){if(null==t.value)throw new mse('The shape of the input to "Flatten" is not fully defined '+"(got ".concat(e.slice(1),"). Make sure to pass a complete ")+'"input_shape" or "batch_input_shape" argument to the first layer in your model.')}}catch(e){n.e(e)}finally{n.f()}return[e[0],iue(e,1)]}},{key:"call",value:function(e,t){var n=this;return e8((function(){n.invokeCallHook(e,t);var r=Que(e);if("channelsFirst"===n.dataFormat&&r.rank>1){for(var a=[0],i=2;i<r.rank;++i)a.push(i);a.push(1),r=rne(r,a)}return function(e){if(e.rank<=1)throw new mse("batchFlatten requires a minimum rank of 2. Got rank: ".concat(e.rank,"."));var t=[e.shape[0],iue(e.shape,1)];return W8(e,t)}(r)}))}},{key:"getConfig",value:function(){var e={};null!=this.dataFormat&&(e.dataFormat=this.dataFormat);var t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);Epe.className="Flatten",Lre(Epe);var Cpe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).supportsMasking=!0,r.activation=Che(e.activation),r}return p(n,[{key:"call",value:function(e,t){var n=this;return e8((function(){n.invokeCallHook(e,t);var r=Que(e);return n.activation.apply(r)}))}},{key:"getConfig",value:function(){var e={activation:The(this.activation)},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);Cpe.className="Activation",Lre(Cpe);var Ape=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).n=e.n,r.inputSpec=[{ndim:2}],r}return p(n,[{key:"computeOutputShape",value:function(e){return[e[0],this.n,e[1]]}},{key:"call",value:function(e,t){var n=this;return e8((function(){return e=Que(e),t=e,r=n.n,e8((function(){if(2!==t.shape.length)throw new mse("repeat() expects a rank-2 tensor, but received a "+"rank-".concat(t.shape.length," tensor."));return yue(hue(t,1),[1,r,1])}));var t,r}))}},{key:"getConfig",value:function(){var e={n:this.n},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);Ape.className="RepeatVector",Lre(Ape);var Rpe=function(e){d(n,e);var t=w(n);function n(e){var r;l(this,n),(r=t.call(this,e)).targetShape=e.targetShape;for(var a=0;a<r.targetShape.length;++a)r.isUnknown(r.targetShape[a])&&(r.targetShape[a]=null);return r}return p(n,[{key:"isUnknown",value:function(e){return e<0||null==e}},{key:"fixUnknownDimension",value:function(e,t){for(var n="Total size of new array must be unchanged.",r=t.slice(),a=1,i=null,o=0;o<r.length;++o){var s=r[o];if(this.isUnknown(s)){if(null!==i)throw new mse("Can only specifiy one unknown dimension.");i=o}else a*=s}var u=iue(e);if(null!==i){if(0===a||u%a!=0)throw new mse(n);r[i]=u/a}else if(u!==a)throw new mse(n);return r}},{key:"computeOutputShape",value: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))}},{key:"call",value:function(e,t){var n=this;return e8((function(){n.invokeCallHook(e,t);var r=Que(e),a=r.shape,i=a.slice(0,1).concat(n.fixUnknownDimension(a.slice(1),n.targetShape));return W8(r,i)}))}},{key:"getConfig",value:function(){var e={targetShape:this.targetShape},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);Rpe.className="Reshape",Lre(Rpe);var _pe=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),r=t.call(this,e),null==e.dims)throw new Error("Required configuration field `dims` is missing during Permute constructor call.");if(!Array.isArray(e.dims))throw new Error("Permute constructor requires `dims` to be an Array, but received "+"".concat(e.dims," instead."));var a=uue(1,e.dims.length+1);if(!P$(e.dims.slice().sort(),a))throw new Error("Invalid permutation `dims`: "+JSON.stringify(e.dims)+" `dims` must contain consecutive integers starting from 1.");return r.dims=e.dims,r.dimsIncludingBatch=[0].concat(r.dims),r.inputSpec=[new ice({ndim:r.dims.length+1})],r}return p(n,[{key:"computeOutputShape",value:function(e){var t=(e=$ue(e)).slice();return this.dims.forEach((function(n,r){t[r+1]=e[n]})),t}},{key:"call",value:function(e,t){return rne(Que(e),this.dimsIncludingBatch)}},{key:"getConfig",value:function(){var e={dims:this.dims},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);_pe.className="Permute",Lre(_pe);var Ope=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,null==e?{}:e)).supportsMasking=!0,r.maskValue=null!=e?null==e.maskValue?0:e.maskValue:0,r}return p(n,[{key:"computeOutputShape",value:function(e){return e}},{key:"getConfig",value:function(){var e=N(v(n.prototype),"getConfig",this).call(this),t={maskValue:this.maskValue};return Object.assign(t,e),t}},{key:"computeMask",value:function(e,t){var n=Que(e);return v8(eee(n,this.maskValue),-1)}},{key:"call",value:function(e,t){var n=this;return e8((function(){n.invokeCallHook(e,t);var r=Que(e),a=v8(eee(r,n.maskValue),-1,!0);return c8(r,X6(a,r.dtype))}))}}]),n}(lce);Ope.className="Masking",Lre(Ope);var Fpe=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),(r=t.call(this,e)).embeddings=null,r.DEFAULT_EMBEDDINGS_INITIALIZER="randomUniform",null==e.batchInputShape&&null==e.inputShape){var a=null;null!=e.batchSize&&(a=e.batchSize),null==e.inputLength?r.batchInputShape=[a,null]:r.batchInputShape=[a].concat(Nse(e.inputLength))}return r.inputDim=e.inputDim,Lse(r.inputDim,"inputDim"),r.outputDim=e.outputDim,Lse(r.outputDim,"outputDim"),r.embeddingsInitializer=Yue(e.embeddingsInitializer||r.DEFAULT_EMBEDDINGS_INITIALIZER),r.embeddingsRegularizer=Mhe(e.embeddingsRegularizer),r.activityRegularizer=Mhe(e.activityRegularizer),r.embeddingsConstraint=Rce(e.embeddingsConstraint),r.maskZero=e.maskZero,r.supportsMasking=e.maskZero,r.inputLength=e.inputLength,r}return p(n,[{key:"build",value:function(e){this.embeddings=this.addWeight("embeddings",[this.inputDim,this.outputDim],this.dtype,this.embeddingsInitializer,this.embeddingsRegularizer,!0,this.embeddingsConstraint),this.built=!0}},{key:"warnOnIncompatibleInputShape",value:function(e){}},{key:"computeMask",value:function(e,t){var n=this;return e8((function(){return n.maskZero?(e=Que(e),eee(e,F7(e))):null}))}},{key:"computeOutputShape",value:function(e){if(e=$ue(e),null==this.inputLength)return[].concat(T(e),[this.outputDim]);var t=Nse(this.inputLength);if(t.length!==e.length-1)throw new mse('"inputLength" is '.concat(this.inputLength,", but received ")+"input shape has shape ".concat(e));for(var n=0,r=0;r<t.length;++r){var a=t[r],i=e[r+1];if(null!=a&&null!=i&&a!==i)throw new mse('"inputLength" is '.concat(this.inputLength,", but received ")+"input shape has shape ".concat(e));null==a&&(t[n]=i),n++}return[e[0]].concat(T(t),[this.outputDim])}},{key:"call",value:function(e,t){var n=this;return e8((function(){n.invokeCallHook(e,t);var r=Que(e);"int32"!==r.dtype&&(r=lue(r,"int32"));var a=kue(n.embeddings.read(),W8(r,[r.size]));return W8(a,$ue(n.computeOutputShape(r.shape)))}))}},{key:"getConfig",value:function(){var e={inputDim:this.inputDim,outputDim:this.outputDim,embeddingsInitializer:Xue(this.embeddingsInitializer),embeddingsRegularizer:Fhe(this.embeddingsRegularizer),activityRegularizer:Fhe(this.activityRegularizer),embeddingsConstraint:Cce(this.embeddingsConstraint),maskZero:this.maskZero,inputLength:this.inputLength},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);Fpe.className="Embedding",Lre(Fpe);var Dpe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e||{})).supportsMasking=!0,r}return p(n,[{key:"mergeFunction",value:function(e){throw new gse}},{key:"computeElementwiseOpOutputShape",value: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 a=e[e.length-t.length+r],i=t[r];if(null==a||null==i||a<0||i<0)n.push(null);else if(1===a)n.push(i);else if(1===i)n.push(a);else{if(a!==i)throw new mse("Operands could not be broadcast together with shapes "+JSON.stringify(e)+" "+JSON.stringify(t));n.push(a)}}return n}},{key:"build",value:function(e){if(Array.isArray(e)&&!Array.isArray(e[0])&&(e=[$ue(e)]),e.length<2)throw new mse("A merge layer should be called on an Array of at least 2 inputs."+" Got ".concat(e.length," input(s)."));var t,n=[],r=O(e);try{for(r.s();!(t=r.n()).done;){var a=t.value;null!=a&&null!==a[0]&&n.push(a[0])}}catch(e){r.e(e)}finally{r.f()}if((n=Ose(n)).length>1)throw new mse("Can not merge tensors with different batch sizes. "+"Got tensors with shapes: ".concat(JSON.stringify(e),"."));for(var i=null==e[0]?null:e[0].slice(1),o=1;o<e.length;++o){var s=null==e[o]?null:e[o].slice(1);i=this.computeElementwiseOpOutputShape(i,s)}var u=e.map((function(e){return e.length}));-1===e.indexOf(null)&&1===Ose(u).length?this.reshapeRequired=!1:this.reshapeRequired=!0}},{key:"call",value:function(e,t){var n=this;return e8((function(){if(n.reshapeRequired){var t=[],r=e.map((function(e){return e.rank}));if(-1===r.indexOf(null)){var a,i=sue(r),o=O(e);try{for(o.s();!(a=o.n()).done;){for(var s=a.value,u=s.rank,c=0;c<i-u;++c)s=hue(s,1);t.push(s)}}catch(e){o.e(e)}finally{o.f()}return n.mergeFunction(t)}var l,h=!1,p=O(e);try{for(p.s();!(l=p.n()).done;){var f=l.value,d=f.rank;if(null==d){var v=f.shape,m=v[0],g=v.slice(1).concat([m]),y=W8(f,[m].concat(iue(v.slice(1))));y=rne(y,[1,0]),y=W8(y,g),t.push(y),h=!0}else if(d>1){var b=uue(1,d).concat([0]);t.push(rne(f,b)),h=!0}else t.push(f)}}catch(e){p.e(e)}finally{p.f()}var x=n.mergeFunction(t),k=x.rank;if(h)if(null==k){var w=x.shape,I=w[w.length-1],N=[I].concat(w.slice(0,w.length-1));x=W8(rne(W8(x,[-1,I]),[1,0]),N)}else if(k>1){var S=[k-1].concat(uue(0,k-1));x=rne(x,S)}return x}return n.mergeFunction(e)}))}},{key:"computeOutputShape",value:function(e){var t;t=null==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)}var a,i=[],o=O(e);try{for(o.s();!(a=o.n()).done;){var s=a.value;null!=s&&null!==s[0]&&i.push(s[0])}}catch(e){o.e(e)}finally{o.f()}return t=1===(i=Ose(i)).length?i.concat(t):[null].concat(t)}},{key:"computeMask",value:function(e,t){return e8((function(){if(null==t)return null;if(!Array.isArray(t))throw new mse("`mask` should be an Array");if(!Array.isArray(e))throw new mse("`inputs` should be an Array");if(t.length!==e.length)throw new mse("The Array 'inputs' and 'mask' are expected to have the same length, but have different lengths "+"(".concat(e.length," vs ").concat(t.length,")"));if(t.every((function(e){return null==e})))return null;for(var n=(t=t.map((function(e){return null==e?e:i9(e,0)})))[0],r=1;r<t.length-1;++r)n=F9(n,t[r]);return n}))}}]),n}(lce),Mpe=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,e)}return p(n,[{key:"mergeFunction",value:function(e){return e8((function(){for(var t=e[0].clone(),n=1;n<e.length;++n)t=o8(t,e[n]);return t}))}}]),n}(Dpe);Mpe.className="Add",Lre(Mpe);var Lpe=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,e)}return p(n,[{key:"mergeFunction",value:function(e){return e8((function(){for(var t=e[0].clone(),n=1;n<e.length;++n)t=c8(t,e[n]);return t}))}}]),n}(Dpe);Lpe.className="Multiply",Lre(Lpe);var zpe=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,e)}return p(n,[{key:"mergeFunction",value:function(e){return e8((function(){for(var t=e[0].clone(),n=1;n<e.length;++n)t=o8(t,e[n]);return c8(1/e.length,t)}))}}]),n}(Dpe);zpe.className="Average",Lre(zpe);var Ppe=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,e)}return p(n,[{key:"mergeFunction",value:function(e){return e8((function(){for(var t=e[0],n=1;n<e.length;++n)t=G9(t,e[n]);return t}))}}]),n}(Dpe);Ppe.className="Maximum",Lre(Ppe);var Bpe=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,e)}return p(n,[{key:"mergeFunction",value:function(e){return e8((function(){for(var t=e[0],n=1;n<e.length;++n)t=X9(t,e[n]);return t}))}}]),n}(Dpe);Bpe.className="Minimum",Lre(Bpe);var Wpe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).DEFAULT_AXIS=-1,null==e&&(e={}),r.axis=null==e.axis?r.DEFAULT_AXIS:e.axis,r.supportsMasking=!0,r.reshapeRequired=!1,r}return p(n,[{key:"build",value:function(e){if(!Array.isArray(e)||!Array.isArray(e[0])||1===e.length)throw new mse("A `Concatenate` layer should be called on a list of at least 2 inputs");var t,n=!0,r=O(e);try{for(r.s();!(t=r.n()).done;){if(null!=t.value){n=!1;break}}}catch(e){r.e(e)}finally{r.f()}if(!n){for(var a=[],i=0;i<e.length;++i){var o=e[i].slice();o.splice(this.axis,1);var s,u=!1,c=O(a);try{for(c.s();!(s=c.n()).done;){if(P$(s.value,o)){u=!0;break}}}catch(e){c.e(e)}finally{c.f()}u||a.push(o)}if(a.length>1)throw new mse("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(e))}}},{key:"mergeFunction",value:function(e){var t=this;return e8((function(){return mue(e,t.axis)}))}},{key:"computeOutputShape",value:function(e){if(!Array.isArray(e)||!Array.isArray(e[0]))throw new mse("A `Concatenate` layer should be called on a list of inputs.");var t,n=e,r=n[0].slice(),a=this.axis<0?r.length+this.axis:this.axis,i=O(n.slice(1));try{for(i.s();!(t=i.n()).done;){var o=t.value;if(null==r[a]||null==o[a]){r[a]=null;break}r[a]+=o[a]}}catch(e){i.e(e)}finally{i.f()}return r}},{key:"computeMask",value:function(e,t){var n=this;if(null==t)return null;if(!Array.isArray(t))throw new mse("`mask` should be an array for Concatenate");if(!Array.isArray(e))throw new mse("`inputs` should be an array for Concatenate");if(t.length!==e.length)throw new mse("Mismatch in the length of mask (".concat(t.length,") ")+"and the legnth of inputs (".concat(e.length,")"));return e8((function(){var r=!0;if(t.forEach((function(e){null==e||(r=!1)})),r)return null;for(var a=[],i=0;i<e.length;++i)null==t[i]?a.push(X6(nee(e[i]),"bool")):t[i].rank<e[i].rank?a.push(i9(t[i],-1)):a.push(t[i]);var o=G8(a,n.axis);return d8(o,-1,!1)}))}},{key:"getConfig",value:function(){var e={axis:this.axis},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(Dpe);function Vpe(e,t){for(;e<0;)e+=t;return e}Wpe.className="Concatenate",Lre(Wpe);var Upe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).axes=e.axes,r.normalize=null!=e.normalize&&e.normalize,r.supportsMasking=!0,r.reshapeRequired=!1,r}return p(n,[{key:"build",value:function(e){F$(Array.isArray(e)&&2===e.length&&Array.isArray(e[0])&&Array.isArray(e[1]),(function(){return"A `Dot` layer should be called on a list of exactly 2 inputs."}));var t=e[0],n=e[1];if(t.length>3||n.length>3)throw new gse("Dot layer does not support tensors of 4D or higher rank yet.");var r=this.interpretAxes(t,n);if(t[r[0]]!==n[r[1]])throw new mse("Dimension incompatibility: "+"".concat(t[r[0]]," !== ").concat(n[r[1]]))}},{key:"mergeFunction",value:function(e){if(2!==e.length)throw new mse("A `Dot` layer must be called on exactly 2 inputs, "+"but received ".concat(e.length," input(s)."));var t,n=e[0],r=e[1];return t=Array.isArray(this.axes)?this.axes.map((function(t,n){return Vpe(t,e[n].shape.length)})):[Vpe(this.axes,n.shape.length),Vpe(this.axes,r.shape.length)],this.normalize&&(n=qce(n,t[0]),r=qce(r,t[1])),function(e,t,n){if(e.shape.length>3||t.shape.length>3)throw new gse("batchDot is not implemented for tensors of 4D or higher rank yet");if(F$(e.shape.length>=2,(function(){return"batchDot requires the rank of x to be >= 2, "+"but got ".concat(e.shape.length)})),F$(e.shape.length>=2,(function(){return"batchDot requires the rank of y to be >= 2, "+"but got ".concat(t.shape.length)})),"number"==typeof n&&(n=[n,n]),"complex64"===e.dtype||"complex64"===t.dtype)throw new gse("batchDot is not implemented for complex64-type Tensors yet.");var r=e.shape.length,a=t.shape.length;null==n&&(n=[r-1,a-2]);var i=n;return e8((function(){var n,o;if(r>a){n=r-a;for(var s=[],u=0;u<n;++u)s.push(1);t=W8(t,t.shape.concat(s))}else if(a>r){n=a-r;for(var c=[],l=0;l<n;++l)c.push(1);e=W8(e,e.shape.concat(c))}else n=0;if(2===e.shape.length&&2===t.shape.length)o=i[0]===i[1]?e9(c8(e,t),i[0]):e9(c8(rne(e,[1,0]),t),i[1]);else{var h=i[0]!==e.shape.length-1,p=i[1]===t.shape.length-1;o=j8(e,t,h,p)}if(n>0){for(var f,d=[],v=f=r>a?r+a-3:r-1;v<f+n;++v)d.push(v);o=Ate(o,d)}return 1===o.shape.length&&(o=i9(o,1)),o}))}(n,r,t)}},{key:"interpretAxes",value:function(e,t){return Array.isArray(this.axes)?this.axes:[Vpe(this.axes,e.length),Vpe(this.axes,t.length)]}},{key:"computeOutputShape",value:function(e){F$(Array.isArray(e)&&2===e.length&&Array.isArray(e[0])&&Array.isArray(e[1]),(function(){return"A `Dot` layer should be called on a list of exactly 2 inputs."}));var t=e[0].slice(),n=e[1].slice();if(t.length>3||n.length>3)throw new gse("Dot layer does not support tensors of 4D or higher rank yet.");var r=this.interpretAxes(t,n);t.splice(r[0],1),n.splice(r[1],1),n.splice(0,1);var a=t.concat(n);return 1===a.length&&a.push(1),a}},{key:"computeMask",value:function(e,t){return null}},{key:"getConfig",value:function(){var e={axes:this.axes,normalize:this.normalize},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(Dpe);Upe.className="Dot",Lre(Upe);var Gpe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).supportsMasking=!0,r.stddev=e.stddev,r}return p(n,[{key:"computeOutputShape",value:function(e){return e}},{key:"getConfig",value:function(){var e=N(v(n.prototype),"getConfig",this).call(this),t={stddev:this.stddev};return Object.assign(t,e),t}},{key:"call",value:function(e,t){var n=this;return e8((function(){n.invokeCallHook(e,t);var r=Que(e);return Eue((function(){return o8(bue(r.shape,0,n.stddev),r)}),(function(){return r}),t.training||!1)}))}}]),n}(lce);Gpe.className="GaussianNoise",Lre(Gpe);var jpe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).supportsMasking=!0,r.rate=e.rate,r}return p(n,[{key:"computeOutputShape",value:function(e){return e}},{key:"getConfig",value:function(){var e=N(v(n.prototype),"getConfig",this).call(this),t={rate:this.rate};return Object.assign(t,e),t}},{key:"call",value:function(e,t){var n=this;return e8((function(){n.invokeCallHook(e,t);var r=Que(e);if(n.rate>0&&n.rate<1){return Eue((function(){var e=Math.sqrt(n.rate/(1-n.rate));return c8(r,bue(r.shape,1,e))}),(function(){return r}),t.training||!1)}return r}))}}]),n}(lce);jpe.className="GaussianDropout",Lre(jpe);var Hpe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).supportsMasking=!0,r.rate=e.rate,r.noiseShape=e.noiseShape,r}return p(n,[{key:"_getNoiseShape",value:function(e){return this.noiseShape||Que(e).shape}},{key:"computeOutputShape",value:function(e){return e}},{key:"getConfig",value:function(){var e=N(v(n.prototype),"getConfig",this).call(this),t={rate:this.rate};return Object.assign(t,e),t}},{key:"call",value:function(e,t){var n=this;return e8((function(){if(n.rate<1&&n.rate>0){var r=n._getNoiseShape(e);return Eue((function(){var t=Que(e),a=-1.7580993408473766,i=p9(Zee(r),n.rate);i=lue(i,"float32");var o=Math.pow((1-n.rate)*(1+n.rate*Math.pow(a,2)),-.5),s=-o*a*n.rate,u=o8(c8(t,i),c8(o8(i,-1),a));return o8(c8(u,o),s)}),(function(){return Que(e)}),t.training||!1)}return e}))}}]),n}(lce);function qpe(e,t,n,r,a){var i,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.001;if(2===e.rank)i=Z8(e,t,n,r,a,o);else if(3===e.rank)i=Q8(e,t,n,r,a,o);else{if(4!==e.rank)throw new gse("batchNormalization is not implemented for array of rank ".concat(e.rank," ")+"yet");i=$8(e,t,n,r,a,o)}return i}function Kpe(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.001;return e8((function(){var i=Z9(e,r),o=i.mean,s=i.variance;return[qpe(e,o,s,n,t,a),o,s]}))}function Xpe(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.001;return e8((function(){var i,o=Z9(e,r),s=o.mean,u=o.variance,c=[],l=O(uue(0,e.rank));try{for(l.s();!(i=l.n()).done;){var h=i.value;-1!==r.indexOf(h)?c.push(1):c.push(e.shape[h])}}catch(e){l.e(e)}finally{l.f()}var p=W8(s,c),f=W8(u,c),d=null==t?null:W8(t,c),v=null==n?null:W8(n,c);return[qpe(e,p,f,v,d,a),s,u]}))}Hpe.className="AlphaDropout",Lre(Hpe);var Ype=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),null==e&&(e={}),(r=t.call(this,e)).supportsMasking=!0,r.axis=null==e.axis?-1:e.axis,r.momentum=null==e.momentum?.99:e.momentum,r.epsilon=null==e.epsilon?.001:e.epsilon,r.center=null==e.center||e.center,r.scale=null==e.scale||e.scale,r.betaInitializer=Yue(e.betaInitializer||"zeros"),r.gammaInitializer=Yue(e.gammaInitializer||"ones"),r.movingMeanInitializer=Yue(e.movingMeanInitializer||"zeros"),r.movingVarianceInitializer=Yue(e.movingVarianceInitializer||"ones"),r.betaConstraint=Rce(e.betaConstraint),r.gammaConstraint=Rce(e.gammaConstraint),r.betaRegularizer=Mhe(e.betaRegularizer),r.gammaRegularizer=Mhe(e.gammaRegularizer),r}return p(n,[{key:"build",value:function(e){e=$ue(e);var t=this.axis>=0?this.axis:this.axis+e.length,n=e[t];if(null==n)throw new mse("Axis ".concat(t," of input tensor should have a defined dimension but ")+"the layer received an input with shape "+"".concat(JSON.stringify(e),"."));this.inputSpec=[new ice({ndim:e.length,axes:f({},t,n)})];var r=[n];this.scale&&(this.gamma=this.addWeight("gamma",r,null,this.gammaInitializer,this.gammaRegularizer,!0,this.gammaConstraint)),this.center&&(this.beta=this.addWeight("beta",r,null,this.betaInitializer,this.betaRegularizer,!0,this.betaConstraint)),this.movingMean=this.addWeight("moving_mean",r,null,this.movingMeanInitializer,null,!1),this.movingVariance=this.addWeight("moving_variance",r,null,this.movingVarianceInitializer,null,!1),this.built=!0}},{key:"call",value:function(e,t){var n=this;return e8((function(){var r=null!=t.training&&t.training,a=Que(e),i=a.shape,o=i.length,s=uue(0,o),u=n.axis>=0?n.axis:n.axis+o;s.splice(u,1);var c=xse(1,o);c[u]=i[u];var l=s.slice();l.sort();var h=!P$(l,uue(0,o).slice(0,o-1));if(!r)return function(){if(h){var e=W8(n.movingMean.read(),c),t=W8(n.movingVariance.read(),c),r=n.center?W8(n.beta.read(),c):null,i=n.scale?W8(n.gamma.read(),c):null;return qpe(a,e,t,r,i,n.epsilon)}return qpe(a,n.movingMean.read(),n.movingVariance.read(),null==n.beta?null:n.beta.read(),null==n.gamma?null:n.gamma.read(),n.epsilon)}();var p=function(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.001;return P$(r.slice().sort(),uue(0,e.rank-1))?Kpe(e,t,n,r,a):Xpe(e,t,n,r,a)}(a,n.gamma.read(),n.beta.read(),s,n.epsilon),f=S(p,3),d=f[0],v=f[1],m=f[2],g=function(e,t,n){e8((function(){var r=1-n,a=e.read(),i=c8(R9(a,t),r);e.write(R9(a,i))}))};return g(n.movingMean,v,n.momentum),g(n.movingVariance,m,n.momentum),d}))}},{key:"getConfig",value:function(){var e={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:Xue(this.betaInitializer),gammaInitializer:Xue(this.gammaInitializer),movingMeanInitializer:Xue(this.movingMeanInitializer),movingVarianceInitializer:Xue(this.movingVarianceInitializer),betaRegularizer:Fhe(this.betaRegularizer),gammaRegularizer:Fhe(this.gammaRegularizer),betaConstraint:Cce(this.betaConstraint),gammaConstraint:Cce(this.gammaConstraint)},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);Ype.className="BatchNormalization",Lre(Ype);var Jpe=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),null==e&&(e={}),(r=t.call(this,e)).axis=null==e.axis?-1:e.axis,"number"==typeof r.axis){if(!Number.isInteger(r.axis))throw new Error("Expected axis to be an integer, but received ".concat(r.axis))}else{if(!Array.isArray(r.axis))throw new Error("Expected axis to be an integer or an array of integers, "+"but received ".concat(JSON.stringify(r.axis)));var a,i=O(r.axis);try{for(i.s();!(a=i.n()).done;){var o=a.value;if(!Number.isInteger(o))throw new Error("Expected axis to be an array of integers, "+"but received ".concat(JSON.stringify(r.axis)))}}catch(e){i.e(e)}finally{i.f()}}return r.epsilon=null==e.epsilon?.001:e.epsilon,r.center=null==e.center||e.center,r.scale=null==e.scale||e.scale,r.betaInitializer=Yue(e.betaInitializer||"zeros"),r.gammaInitializer=Yue(e.gammaInitializer||"ones"),r.betaRegularizer=Mhe(e.betaRegularizer),r.gammaRegularizer=Mhe(e.gammaRegularizer),r.supportsMasking=!0,r}return p(n,[{key:"build",value:function(e){var t=(e=$ue(e)).length;"number"==typeof this.axis&&(this.axis=[this.axis]);for(var n=0;n<this.axis.length;++n)this.axis[n]<0&&(this.axis[n]+=t);var r,a=O(this.axis);try{for(a.s();!(r=a.n()).done;){var i=r.value;if(i<0||i>=t)throw new Error("Invalid axis: ".concat(i))}}catch(e){a.e(e)}finally{a.f()}if(this.axis.length!==Ose(this.axis).length)throw new Error("Found duplicate axes in: ".concat(this.axis));var o=this.axis.map((function(t){return e[t]}));this.scale?this.gamma=this.addWeight("gamma",o,"float32",this.gammaInitializer,this.gammaRegularizer,true):this.gamma=null,this.center?this.beta=this.addWeight("beta",o,"float32",this.betaInitializer,this.betaRegularizer,true):this.beta=null,this.built=!0}},{key:"call",value:function(e,t){var n=this,r=Que(e),a=r.shape,i=a.length;return e8((function(){var e,t=Z9(r,n.axis,!0),o=t.mean,s=t.variance,u=xse(1,i),c=O(n.axis);try{for(c.s();!(e=c.n()).done;){var l=e.value;u[l]=a[l]}}catch(e){c.e(e)}finally{c.f()}for(var h=function(e){return null!=e&&e.shape.length!==i?W8(e,u):e},p=n.scale?h(n.gamma.read()):null,f=n.center?h(n.beta.read()):null,d=[],v=[],m=0;m<i;++m)-1!==n.axis.indexOf(m)?(d.push(a[m]),v.push(1)):(d.push(1),v.push(a[m]));return o=s9(o,d),s=s9(s,d),null!=p&&(p=s9(p,v)),null!=f&&(f=s9(f,v)),qpe(r,o,s,f,p,n.epsilon)}))}},{key:"getConfig",value:function(){var e={axis:this.axis,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:Xue(this.betaInitializer),gammaInitializer:Xue(this.gammaInitializer),betaRegularizer:Fhe(this.betaRegularizer),gammaRegularizer:Fhe(this.gammaRegularizer)},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);Jpe.className="LayerNormalization",Lre(Jpe);var Zpe=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),null==e&&(e={}),(r=t.call(this,e)).dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,null==e.padding)r.padding=[[1,1],[1,1]];else if("number"==typeof e.padding)r.padding=[[e.padding,e.padding],[e.padding,e.padding]];else{if(e.padding=e.padding,2!==e.padding.length)throw new mse("ZeroPadding2D expects padding to be a length-2 array, but "+"received a length-".concat(e.padding.length," array."));var a,i;if("number"==typeof e.padding[0])a=[e.padding[0],e.padding[0]],i=[e.padding[1],e.padding[1]];else{if(e.padding=e.padding,2!==e.padding[0].length)throw new mse("ZeroPadding2D expects height padding to be a length-2 array, "+"but received a length-".concat(e.padding[0].length," array."));if(a=e.padding[0],2!==e.padding[1].length)throw new mse("ZeroPadding2D expects width padding to be a length-2 array, "+"but received a length-".concat(e.padding[1].length," array."));i=e.padding[1]}r.padding=[a,i]}return r.inputSpec=[new ice({ndim:4})],r}return p(n,[{key:"computeOutputShape",value:function(e){var t,n;return e=$ue(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]])}},{key:"call",value:function(e,t){var n=this;return e8((function(){return t=Que(e),r=n.padding,a=n.dataFormat,e8((function(){if(4!==t.rank)throw new mse("temporalPadding expects input tensor to be 4-D, but received a "+"".concat(t.rank,"-D tensor."));if(null==r&&(r=[[1,1],[1,1]]),2!==r.length||2!==r[0].length||2!==r[1].length)throw new mse("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");if(null==a&&(a="channelsLast"),"channelsLast"!==a&&"channelsFirst"!==a)throw new mse("Unknown data format: ".concat(a,". ")+"Supported data formats are 'channelsLast' and 'channelsFirst.");var e;return e="channelsFirst"===a?[[0,0],[0,0],r[0],r[1]]:[[0,0],r[0],r[1],[0,0]],aee(t,e)}));var t,r,a}))}},{key:"getConfig",value:function(){var e={padding:this.padding,dataFormat:this.dataFormat},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);function Qpe(e,t,n,r,a,i){return e8((function(){var o;Yse(a),Zse(i),Jse(r),null==n&&(n=[1,1]),null==r&&(r="valid"),null==a&&(a="channelsLast"),null==i&&(i="max"),e=Hhe(e,a);var s="same"===r?"same":"valid";return o="max"===i?W9(e,t,n,s):V8(e,t,n,s),"channelsFirst"===a&&(o=rne(o,[0,3,1,2])),o}))}function $pe(e,t,n,r,a,i){return e8((function(){var o;Yse(a),Zse(i),Jse(r),null==n&&(n=[1,1,1]),null==r&&(r="valid"),null==a&&(a="channelsLast"),null==i&&(i="max"),e=qhe(e,a);var s="same"===r?"same":"valid";return o="max"===i?V9(e,t,n,s):U8(e,t,n,s),"channelsFirst"===a&&(o=rne(o,[0,4,1,2,3])),o}))}Zpe.className="ZeroPadding2D",Lre(Zpe);var efe=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),null==e.poolSize&&(e.poolSize=2),r=t.call(this,e),"number"==typeof e.poolSize)r.poolSize=[e.poolSize];else{if(!Array.isArray(e.poolSize)||1!==e.poolSize.length||"number"!=typeof e.poolSize[0])throw new mse("poolSize for 1D convolutional layer must be a number or an Array of a single number, but received "+"".concat(JSON.stringify(e.poolSize)));r.poolSize=e.poolSize}if(Lse(r.poolSize,"poolSize"),null==e.strides)r.strides=r.poolSize;else if("number"==typeof e.strides)r.strides=[e.strides];else{if(!Array.isArray(e.strides)||1!==e.strides.length||"number"!=typeof e.strides[0])throw new mse("strides for 1D convolutional layer must be a number or an Array of a single number, but received "+"".concat(JSON.stringify(e.strides)));r.strides=e.strides}return Lse(r.strides,"strides"),r.padding=null==e.padding?"valid":e.padding,Jse(r.padding),r.inputSpec=[new ice({ndim:3})],r}return p(n,[{key:"computeOutputShape",value:function(e){var t=Ghe((e=$ue(e))[1],this.poolSize[0],this.padding,this.strides[0]);return[e[0],t,e[2]]}},{key:"call",value:function(e,t){var n=this;return e8((function(){n.invokeCallHook(e,t),e=hue(Que(e),2);var r=n.poolingFunction(Que(e),[n.poolSize[0],1],[n.strides[0],1],n.padding,"channelsLast");return Ate(r,[2])}))}},{key:"getConfig",value:function(){var e={poolSize:this.poolSize,padding:this.padding,strides:this.strides},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce),tfe=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,e)}return p(n,[{key:"poolingFunction",value:function(e,t,n,r,a){return Yse(a),Jse(r),Qpe(e,t,n,r,a,"max")}}]),n}(efe);tfe.className="MaxPooling1D",Lre(tfe);var nfe=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,e)}return p(n,[{key:"poolingFunction",value:function(e,t,n,r,a){return Yse(a),Jse(r),Qpe(e,t,n,r,a,"avg")}}]),n}(efe);nfe.className="AveragePooling1D",Lre(nfe);var rfe=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),null==e.poolSize&&(e.poolSize=[2,2]),(r=t.call(this,e)).poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize],null==e.strides)r.strides=r.poolSize;else if(Array.isArray(e.strides)){if(2!==e.strides.length)throw new mse("If the strides property of a 2D pooling layer is an Array, it is expected to have a length of 2, but received length "+"".concat(e.strides.length,"."));r.strides=e.strides}else r.strides=[e.strides,e.strides];return Lse(r.poolSize,"poolSize"),Lse(r.strides,"strides"),r.padding=null==e.padding?"valid":e.padding,r.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,Yse(r.dataFormat),Jse(r.padding),r.inputSpec=[new ice({ndim:4})],r}return p(n,[{key:"computeOutputShape",value:function(e){e=$ue(e);var t="channelsFirst"===this.dataFormat?e[2]:e[1],n="channelsFirst"===this.dataFormat?e[3]:e[2];return t=Ghe(t,this.poolSize[0],this.padding,this.strides[0]),n=Ghe(n,this.poolSize[1],this.padding,this.strides[1]),"channelsFirst"===this.dataFormat?[e[0],e[1],t,n]:[e[0],t,n,e[3]]}},{key:"call",value:function(e,t){var n=this;return e8((function(){return n.invokeCallHook(e,t),n.poolingFunction(Que(e),n.poolSize,n.strides,n.padding,n.dataFormat)}))}},{key:"getConfig",value:function(){var e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce),afe=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,e)}return p(n,[{key:"poolingFunction",value:function(e,t,n,r,a){return Yse(a),Jse(r),Qpe(e,t,n,r,a,"max")}}]),n}(rfe);afe.className="MaxPooling2D",Lre(afe);var ife=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,e)}return p(n,[{key:"poolingFunction",value:function(e,t,n,r,a){return Yse(a),Jse(r),Qpe(e,t,n,r,a,"avg")}}]),n}(rfe);ife.className="AveragePooling2D",Lre(ife);var ofe=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),null==e.poolSize&&(e.poolSize=[2,2,2]),(r=t.call(this,e)).poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize,e.poolSize],null==e.strides)r.strides=r.poolSize;else if(Array.isArray(e.strides)){if(3!==e.strides.length)throw new mse("If the strides property of a 3D pooling layer is an Array, it is expected to have a length of 3, but received length "+"".concat(e.strides.length,"."));r.strides=e.strides}else r.strides=[e.strides,e.strides,e.strides];return Lse(r.poolSize,"poolSize"),Lse(r.strides,"strides"),r.padding=null==e.padding?"valid":e.padding,r.dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,Yse(r.dataFormat),Jse(r.padding),r.inputSpec=[new ice({ndim:5})],r}return p(n,[{key:"computeOutputShape",value:function(e){e=$ue(e);var t="channelsFirst"===this.dataFormat?e[2]:e[1],n="channelsFirst"===this.dataFormat?e[3]:e[2],r="channelsFirst"===this.dataFormat?e[4]:e[3];return t=Ghe(t,this.poolSize[0],this.padding,this.strides[0]),n=Ghe(n,this.poolSize[1],this.padding,this.strides[1]),r=Ghe(r,this.poolSize[2],this.padding,this.strides[2]),"channelsFirst"===this.dataFormat?[e[0],e[1],t,n,r]:[e[0],t,n,r,e[4]]}},{key:"call",value:function(e,t){var n=this;return e8((function(){return n.invokeCallHook(e,t),n.poolingFunction(Que(e),n.poolSize,n.strides,n.padding,n.dataFormat)}))}},{key:"getConfig",value:function(){var e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce),sfe=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,e)}return p(n,[{key:"poolingFunction",value:function(e,t,n,r,a){return Yse(a),Jse(r),$pe(e,t,n,r,a,"max")}}]),n}(ofe);sfe.className="MaxPooling3D",Lre(sfe);var ufe=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,e)}return p(n,[{key:"poolingFunction",value:function(e,t,n,r,a){return Yse(a),Jse(r),$pe(e,t,n,r,a,"avg")}}]),n}(ofe);ufe.className="AveragePooling3D",Lre(ufe);var cfe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).inputSpec=[new ice({ndim:3})],r}return p(n,[{key:"computeOutputShape",value:function(e){return[e[0],e[2]]}},{key:"call",value:function(e,t){throw new gse}}]),n}(lce),lfe=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,e||{})}return p(n,[{key:"call",value:function(e,t){return e8((function(){var t=Que(e);return j9(t,1)}))}}]),n}(cfe);lfe.className="GlobalAveragePooling1D",Lre(lfe);var hfe=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,e||{})}return p(n,[{key:"call",value:function(e,t){return e8((function(){var t=Que(e);return X7(t,1)}))}}]),n}(cfe);hfe.className="GlobalMaxPooling1D",Lre(hfe);var pfe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).dataFormat=null==e.dataFormat?"channelsLast":e.dataFormat,Yse(r.dataFormat),r.inputSpec=[new ice({ndim:4})],r}return p(n,[{key:"computeOutputShape",value:function(e){return"channelsLast"===this.dataFormat?[e[0],e[3]]:[e[0],e[1]]}},{key:"call",value:function(e,t){throw new gse}},{key:"getConfig",value:function(){var e={dataFormat:this.dataFormat},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce),ffe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"call",value:function(e,t){var n=this;return e8((function(){var t=Que(e);return"channelsLast"===n.dataFormat?j9(t,[1,2]):j9(t,[2,3])}))}}]),n}(pfe);ffe.className="GlobalAveragePooling2D",Lre(ffe);var dfe=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"call",value:function(e,t){var n=this;return e8((function(){var t=Que(e);return"channelsLast"===n.dataFormat?X7(t,[1,2]):X7(t,[2,3])}))}}]),n}(pfe);dfe.className="GlobalMaxPooling2D",Lre(dfe);var vfe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).layer=e.layer,r}return p(n,[{key:"build",value:function(e){this.built=!0}},{key:"trainable",get:function(){return null!=this.layer&&this.layer.trainable},set:function(e){null!=this.layer&&(this.layer.trainable=e)}},{key:"trainableWeights",get:function(){return this.layer.trainableWeights}},{key:"nonTrainableWeights",get:function(){return this.layer.nonTrainableWeights}},{key:"updates",get:function(){return this.layer._updates}},{key:"losses",get:function(){return this.layer.losses}},{key:"getWeights",value:function(){return this.layer.getWeights()}},{key:"setWeights",value:function(e){this.layer.setWeights(e)}},{key:"getConfig",value:function(){var e={layer:{className:this.layer.getClassName(),config:this.layer.getConfig()}},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}},{key:"setFastWeightInitDuringBuild",value:function(e){N(v(n.prototype),"setFastWeightInitDuringBuild",this).call(this,e),null!=this.layer&&this.layer.setFastWeightInitDuringBuild(e)}}],[{key:"fromConfig",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.layer,a=Hce(r,n);delete t.layer;var i={layer:a};return Object.assign(i,t),new e(i)}}]),n}(lce),mfe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).supportsMasking=!0,r}return p(n,[{key:"build",value:function(e){if((e=$ue(e)).length<3)throw new mse("TimeDistributed layer expects an input shape >= 3D, but received "+"input shape ".concat(JSON.stringify(e)));this.inputSpec=[{shape:e}];var t=[e[0]].concat(e.slice(2));this.layer.built||(this.layer.build(t),this.layer.built=!0),N(v(n.prototype),"build",this).call(this,e)}},{key:"computeOutputShape",value:function(e){var t=[(e=$ue(e))[0]].concat(e.slice(2)),n=this.layer.computeOutputShape(t),r=e[1];return[n[0],r].concat(n.slice(1))}},{key:"call",value:function(e,t){var n=this;return e8((function(){return cpe((function(e,r){return[Que(n.layer.call(e,t)),[]]}),e=Que(e),[],!1,null,null,!1,!0)[1]}))}}]),n}(vfe);mfe.className="TimeDistributed",Lre(mfe);var gfe=function(e){d(n,e);var t=w(n);function n(e){var r;l(this,n),r=t.call(this,e);var a=e.layer.getConfig(),i={};i.className=e.layer.getClassName(),i.config=a,r.forwardLayer=Hce(i),a.goBackwards=!0!==a.goBackwards;var o,s={};if(s.className=e.layer.getClassName(),s.config=a,r.backwardLayer=Hce(s),r.forwardLayer.name="forward_"+r.forwardLayer.name,r.backwardLayer.name="backward_"+r.backwardLayer.name,r.mergeMode=void 0===e.mergeMode?"concat":e.mergeMode,o=r.mergeMode,Dse(Kse,"BidirectionalMergeMode",o),e.weights)throw new gse("weights support is not implemented for Bidirectional layer yet.");return r._stateful=e.layer.stateful,r.returnSequences=e.layer.returnSequences,r.returnState=e.layer.returnState,r.supportsMasking=!0,r._trainable=!0,r.inputSpec=e.layer.inputSpec,r.numConstants=null,r}return p(n,[{key:"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)}},{key:"getWeights",value:function(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())}},{key:"setWeights",value:function(e){var t=e.length,n=Math.floor(t/2);this.forwardLayer.setWeights(e.slice(0,n)),this.backwardLayer.setWeights(e.slice(n))}},{key:"computeOutputShape",value:function(e){var t,n,r,a=this.forwardLayer.computeOutputShape(e);return Array.isArray(a)&&Array.isArray(a[0])||(a=[a]),this.returnState?(r=a.slice(1),t=a[0]):t=a[0],"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()):Ise(n)}},{key:"apply",value:function(e,t){var r=null==t?null:t.initialState,a=null==t?null:t.constants;null==t&&(t={});var i=upe(e,r,a,this.numConstants);if(e=i.inputs,r=i.initialState,a=i.constants,Array.isArray(e)&&(r=e.slice(1),e=e[0]),(null==r||0===r.length)&&null==a)return N(v(n.prototype),"apply",this).call(this,e,t);var o=[],s=[];if(null!=r){var u=r.length;if(u%2>0)throw new mse("When passing `initialState` to a Bidrectional RNN, the state should be an Array containing the states of the underlying RNNs.");t.initialState=r,o.push.apply(o,T(r));var c=r.map((function(e){return new ice({shape:e.shape})}));this.forwardLayer.stateSpec=c.slice(0,u/2),this.backwardLayer.stateSpec=c.slice(u/2),s.push.apply(s,T(c))}if(null!=a)throw new gse("Support for constants in Bidirectional layers is not implemented yet.");for(var l=o[0]instanceof oce,h=0,p=o;h<p.length;h++){if(p[h]instanceof oce!==l)throw new mse("The initial state of a Bidirectional layer cannot be specified as a mix of symbolic and non-symbolic tensors")}if(l){var f=[e].concat(o),d=this.inputSpec.concat(s),m=this.inputSpec;this.inputSpec=d;var g=N(v(n.prototype),"apply",this).call(this,f,t);return this.inputSpec=m,g}return N(v(n.prototype),"apply",this).call(this,e,t)}},{key:"call",value:function(e,t){var n=this;return e8((function(){var r,a,i,o,s=t.initialState;if(null==s)r=n.forwardLayer.call(e,t),a=n.backwardLayer.call(e,t);else{var u=s.slice(0,s.length/2),c=s.slice(s.length/2);r=n.forwardLayer.call(e,Object.assign(t,{initialState:u})),a=n.backwardLayer.call(e,Object.assign(t,{initialState:c}))}return n.returnState&&(Array.isArray(r)&&(i=r.slice(1).concat(a.slice(1))),r=r[0],a=a[0]),n.returnSequences&&(a=ate(a,1)),"concat"===n.mergeMode?o=mue([r,a]):"sum"===n.mergeMode?o=o8(r,a):"ave"===n.mergeMode?o=c8(.5,o8(r,a)):"mul"===n.mergeMode?o=c8(r,a):null==n.mergeMode&&(o=[r,a]),n.returnState?null==n.mergeMode?o.concat(i):[o].concat(i):o}))}},{key:"resetStates",value:function(e){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()}},{key:"build",value:function(e){var t=this;$se(this.forwardLayer.name,(function(){t.forwardLayer.build(e)})),$se(this.backwardLayer.name,(function(){t.backwardLayer.build(e)})),this.built=!0}},{key:"computeMask",value:function(e,t){var n;if(Array.isArray(t)&&(t=t[0]),n=this.returnSequences?null==this.mergeMode?[t,t]:t:null==this.mergeMode?[null,null]:null,this.returnState){var r=this.forwardLayer.states.map((function(e){return null}));return Array.isArray(n)?n.concat(r).concat(r):[n].concat(r).concat(r)}return n}},{key:"trainableWeights",get:function(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)}},{key:"nonTrainableWeights",get:function(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)}},{key:"setFastWeightInitDuringBuild",value:function(e){N(v(n.prototype),"setFastWeightInitDuringBuild",this).call(this,e),null!=this.forwardLayer&&this.forwardLayer.setFastWeightInitDuringBuild(e),null!=this.backwardLayer&&this.backwardLayer.setFastWeightInitDuringBuild(e)}},{key:"getConfig",value:function(){var e={mergeMode:this.mergeMode},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}],[{key:"fromConfig",value:function(e,t){var n=Hce(t.layer);if(delete t.layer,null!=t.numConstants)throw new gse("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");var r=t;return r.layer=n,new e(r)}}]),n}(vfe);gfe.className="Bidirectional",Lre(gfe);var yfe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).scale=e.scale,e.offset?r.offset=e.offset:r.offset=0,r}return p(n,[{key:"getConfig",value:function(){var e={scale:this.scale,offset:this.offset},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}},{key:"call",value:function(e,t){var n=this;return e8((function(){return"float32"!==(e=Que(e)).dtype&&(e=lue(e,"float32")),o8(c8(e,n.scale),n.offset)}))}}]),n}(lce);yfe.className="Rescaling",Lre(yfe);var bfe=Are.resizeBilinear,xfe=Are.cropAndResize,kfe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).height=e.height,r.width=e.width,r}return p(n,[{key:"centerCrop",value:function(e,t,n,r,a,i,o,s){return e8((function(){var u,c=!1,l=[t/i,n/o,(r+t)/i,(a+n)/o],h=[];3===e.rank?(c=!0,u=Rte([e])):u=e;for(var p=0;p<u.shape[0];p++)h.push(l);var f=U5(h,[h.length,4]),d=$ee(0,h.length,1,"int32"),v=xfe(u,f,d,[r,a],"nearest");return lue(c?Que(Yte(v)):v,s)}))}},{key:"upsize",value:function(e,t,n,r){return e8((function(){return lue(bfe(e,[t,n]),r)}))}},{key:"call",value:function(e,t){var n=this;return e8((function(){var t=Que(e),r=t.dtype,a=t.shape,i=a[a.length-3],o=a[a.length-2],s=0;i!==n.height&&(s=Math.floor((i-n.height)/2));var u=0;return o!==n.width&&0===(u=Math.floor((o-n.width)/2))&&(u=1),s>=0&&u>=0?n.centerCrop(t,s,u,n.height,n.width,i,o,r):n.upsize(e,n.height,n.width,r)}))}},{key:"getConfig",value:function(){var e={height:this.height,width:this.width},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}},{key:"computeOutputShape",value:function(e){var t=(e=$ue(e)).length-3,n=e.length-2;return e[t]=this.height,e[n]=this.width,e}}]),n}(lce);kfe.className="CenterCrop",Lre(kfe);var wfe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).numTokens=e.numTokens,e.outputMode?r.outputMode=e.outputMode:r.outputMode="multiHot",r}return p(n,[{key:"getConfig",value:function(){var e={numTokens:this.numTokens,outputMode:this.outputMode},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}},{key:"computeOutputShape",value:function(e){return null==(e=$ue(e))?[this.numTokens]:"oneHot"===this.outputMode&&1!==e[e.length-1]?(e.push(this.numTokens),e):(e[e.length-1]=this.numTokens,e)}},{key:"call",value:function(e,t){var n=this;return e8((function(){var r;if("int32"!==(e=Que(e)).dtype&&(e=lue(e,"int32")),void 0!==t.countWeights){if("count"!==n.outputMode)throw new mse("countWeights is not used when outputMode !== count.\n Received countWeights=".concat(t.countWeights));r=Que(t.countWeights)}var a=X7(e),i=Y7(e),o=h9(n.numTokens,a).bufferSync().get(0),s=p9(i,0).bufferSync().get(0);if(!o||!s)throw new mse("Input values must be between 0 < values <="+" numTokens with numTokens=".concat(n.numTokens));return function(e,t,n,r){var a=Que(e);if("int32"!==a.dtype&&(a=lue(a,"int32")),"int"===t)return a;var i=a.shape;if(0===a.rank&&(a=i9(a,-1)),"oneHot"===t&&1!==a.shape[a.shape.length-1]&&(a=i9(a,-1)),a.rank>2)throw new mse("When outputMode is not int, maximum output rank is 2"+" Received outputMode ".concat(t," and input shape ").concat(i)+" which would result in output rank ".concat(a.rank,"."));var o,s=["multiHot","oneHot"].includes(t);if(o=w7(a,void 0!==r&&"count"===t?r:[],n,s),"tfIdf"!==t)return o;if(r)return c8(o,r);throw new mse("When outputMode is 'tfIdf', weights must be provided.")}(e,n.outputMode,n.numTokens,r)}))}}]),n}(lce);wfe.className="CategoryEncoding",Lre(wfe);var Ife=new Set(["bilinear","nearest"]),Nfe=function(e){d(n,e);var t=w(n);function n(e){var r;if(l(this,n),(r=t.call(this,e)).height=e.height,r.width=e.width,e.interpolation){if(!Ife.has(e.interpolation))throw new mse("Invalid interpolation parameter: ".concat(e.interpolation," is not implemented"));r.interpolation=e.interpolation}else r.interpolation="bilinear";return r.cropToAspectRatio=Boolean(e.cropToAspectRatio),r}return p(n,[{key:"computeOutputShape",value:function(e){var t=(e=$ue(e))[2];return[this.height,this.width,t]}},{key:"getConfig",value:function(){var e={height:this.height,width:this.width,interpolation:this.interpolation,cropToAspectRatio:this.cropToAspectRatio},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}},{key:"call",value:function(e,t){var n=this;return e8((function(){var t=[n.height,n.width];if("bilinear"===n.interpolation)return Are.resizeBilinear(e,t,!n.cropToAspectRatio);if("nearest"===n.interpolation)return Are.resizeNearestNeighbor(e,t,!n.cropToAspectRatio);throw new Error("Interpolation is ".concat(n.interpolation," but only ").concat(T(Ife)," are supported"))}))}}]),n}(lce);Nfe.className="Resizing",Lre(Nfe);var Sfe=function(){function e(t){l(this,e),this.seed=t}return p(e,[{key:"next",value:function(){if(void 0!==this.seed)return this.seed++}}]),e}();Sfe.className="RandomSeed";var Tfe=function(e){d(n,e);var t=w(n);function n(e){var r;return l(this,n),(r=t.call(this,e)).randomGenerator=new Sfe(e.seed),r}return p(n,[{key:"getConfig",value:function(){var e={seed:this.randomGenerator.seed},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}}]),n}(lce);Tfe.className="BaseRandomLayer";var Efe=new Set(["bilinear","nearest"]),Cfe=function(e){d(n,e);var t=w(n);function n(e){var r;l(this,n),r=t.call(this,e);var a=e.factor,i=e.interpolation,o=void 0===i?"bilinear":i;if(r.factor=a,Array.isArray(r.factor)&&2===r.factor.length)r.widthLower=r.factor[0],r.widthUpper=r.factor[1];else{if(Array.isArray(r.factor)||!(r.factor>0))throw new mse("Invalid factor: ".concat(r.factor,". Must be positive number or tuple of 2 numbers"));r.widthLower=-r.factor,r.widthUpper=r.factor}if(r.widthLower<-1||r.widthUpper<-1)throw new mse("factor must have values larger than -1. Got: ".concat(r.factor));if(r.widthUpper<r.widthLower)throw new mse("factor cannot have upper bound less than lower bound.\n Got upper bound: ".concat(r.widthUpper,".\n Got lower bound: ").concat(r.widthLower,"\n "));if(o){if(!Efe.has(o))throw new mse("Invalid interpolation parameter: ".concat(o," is not implemented"));r.interpolation=o}return r}return p(n,[{key:"getConfig",value:function(){var e={factor:this.factor,interpolation:this.interpolation},t=N(v(n.prototype),"getConfig",this).call(this);return Object.assign(e,t),e}},{key:"computeOutputShape",value:function(e){var t=(e=$ue(e))[2];return[this.imgHeight,-1,t]}},{key:"call",value:function(e,t){var n=this;return e8((function(){var t=Que(e);n.imgHeight=t.shape[t.shape.length-3];var r=t.shape[t.shape.length-2];n.widthFactor=Zee([1],1+n.widthLower,1+n.widthUpper,"float32",n.randomGenerator.next());var a=n.widthFactor.dataSync()[0]*r;a=Math.round(a);var i=[n.imgHeight,a];switch(n.interpolation){case"bilinear":return Are.resizeBilinear(e,i);case"nearest":return Are.resizeNearestNeighbor(e,i);default:throw new Error("Interpolation is ".concat(n.interpolation,"\n but only ").concat(T(Efe)," are supported"))}}))}}]),n}(Tfe);function Afe(e){return new nfe(e)}function Rfe(e){return new ife(e)}function _fe(e){return new ufe(e)}function Ofe(e){return new hfe(e)}function Ffe(e){return new dfe(e)}function Dfe(e){return new tfe(e)}function Mfe(e){return new afe(e)}Cfe.className="RandomWidth",Lre(Cfe);var Lfe={__proto__:null,Layer:lce,RNN:lpe,RNNCell:hpe,activation:function(e){return new Cpe(e)},add:function(e){return new Mpe(e)},alphaDropout:function(e){return new Hpe(e)},average:function(e){return new zpe(e)},averagePooling1d:Afe,averagePooling2d:Rfe,averagePooling3d:_fe,avgPool1d:function(e){return Afe(e)},avgPool2d:function(e){return Rfe(e)},avgPool3d:function(e){return _fe(e)},avgPooling1d:function(e){return Afe(e)},avgPooling2d:function(e){return Rfe(e)},avgPooling3d:function(e){return _fe(e)},batchNormalization:function(e){return new Ype(e)},bidirectional:function(e){return new gfe(e)},categoryEncoding:function(e){return new wfe(e)},centerCrop:function(e){return new kfe(e)},concatenate:function(e){return new Wpe(e)},conv1d:function(e){return new ape(e)},conv2d:function(e){return new Qhe(e)},conv2dTranspose:function(e){return new epe(e)},conv3d:function(e){return new $he(e)},conv3dTranspose:function(e){return new tpe(e)},convLstm2d:function(e){return new Ipe(e)},convLstm2dCell:function(e){return new wpe(e)},cropping2D:function(e){return new ipe(e)},dense:function(e){return new Tpe(e)},depthwiseConv2d:function(e){return new spe(e)},dot:function(e){return new Upe(e)},dropout:function(e){return new Npe(e)},elu:function(e){return new Bhe(e)},embedding:function(e){return new Fpe(e)},flatten:function(e){return new Epe(e)},gaussianDropout:function(e){return new jpe(e)},gaussianNoise:function(e){return new Gpe(e)},globalAveragePooling1d:function(e){return new lfe(e)},globalAveragePooling2d:function(e){return new ffe(e)},globalMaxPool1d:Ofe,globalMaxPool2d:Ffe,globalMaxPooling1d:Ofe,globalMaxPooling2d:Ffe,gru:function(e){return new vpe(e)},gruCell:function(e){return new dpe(e)},input:lhe,inputLayer:function(e){return new pce(e)},layerNormalization:function(e){return new Jpe(e)},leakyReLU:function(e){return new zhe(e)},lstm:function(e){return new gpe(e)},lstmCell:function(e){return new mpe(e)},masking:function(e){return new Ope(e)},maxPool1d:Dfe,maxPool2d:Mfe,maxPooling1d:Dfe,maxPooling2d:Mfe,maxPooling3d:function(e){return new sfe(e)},maximum:function(e){return new Ppe(e)},minimum:function(e){return new Bpe(e)},multiply:function(e){return new Lpe(e)},permute:function(e){return new _pe(e)},prelu:function(e){return new Phe(e)},randomWidth:function(e){return new Cfe(e)},reLU:function(e){return new Lhe(e)},repeatVector:function(e){return new Ape(e)},rescaling:function(e){return new yfe(e)},reshape:function(e){return new Rpe(e)},resizing:function(e){return new Nfe(e)},rnn:function(e){return new lpe(e)},separableConv2d:function(e){return new rpe(e)},simpleRNN:function(e){return new fpe(e)},simpleRNNCell:function(e){return new ppe(e)},softmax:function(e){return new Vhe(e)},spatialDropout1d:function(e){return new Spe(e)},stackedRNNCells:function(e){return new ype(e)},thresholdedReLU:function(e){return new Whe(e)},timeDistributed:function(e){return new mfe(e)},upSampling2d:function(e){return new ope(e)},zeroPadding2d:function(e){return new Zpe(e)}};var zfe={__proto__:null,MAPE:function(e,t){return Yce(e,t)},MSE:function(e,t){return Kce(e,t)},binaryAccuracy:function(e,t){return ale(e,t)},binaryCrossentropy:function(e,t){return cle(e,t)},categoricalAccuracy:function(e,t){return ile(e,t)},categoricalCrossentropy:function(e,t){return hle(e,t)},cosineProximity:function(e,t){return tle(e,t)},mape:function(e,t){return Yce(e,t)},meanAbsoluteError:function(e,t){return Xce(e,t)},meanAbsolutePercentageError:function(e,t){return Yce(e,t)},meanSquaredError:function(e,t){return Kce(e,t)},mse:function(e,t){return Kce(e,t)},precision:function(e,t){return sle(e,t)},recall:function(e,t){return ule(e,t)},sparseCategoricalAccuracy:function(e,t){return lle(e,t)}},Pfe={__proto__:null,modelFromJSON:function(e,t){return ahe.apply(this,arguments)}};var Bfe={__proto__:null,l1:function(e){return Ahe(t=e),new _he({l1:null!=t?t.l1:null,l2:0});var t},l1l2:function(e){return new _he(e)},l2:function(e){return Ahe(t=e),new _he({l2:null!=t?t.l2:null,l1:0});var t}},Wfe=function(e){d(n,e);var t=w(n);function n(){var e;return l(this,n),(e=t.apply(this,arguments)).model=null,e}return p(n,[{key:"setModel",value:function(e){if(!(e instanceof nhe))throw new Error("model must be a LayersModel, not some other Container");this.model=e}}]),n}(zce);function Vfe(e,t){return e<t}function Ufe(e,t){return e>t}var Gfe=function(e){d(i,e);var t,n,r,a=w(i);function i(e){var t;if(l(this,i),t=a.call(this),null==e&&(e={}),e.restoreBestWeights)throw new gse("restoreBestWeights = True is not implemented in EarlyStopping yet.");return t.monitor=e.monitor||"val_loss",t.minDelta=Math.abs(e.minDelta||0),t.patience=e.patience||0,t.verbose=e.verbose||0,t.mode=e.mode||"auto",t.baseline=e.baseline,-1===["auto","min","max"].indexOf(t.mode)&&(console.warn("EarlyStopping mode '".concat(t.mode,"' is invalid. ")+"Falling back to mode 'auto'."),t.mode="auto"),"min"===t.mode?t.monitorFunc=Vfe:"max"===t.mode||-1!==t.monitor.indexOf("acc")?t.monitorFunc=Ufe:t.monitorFunc=Vfe,t.monitorFunc===Vfe&&(t.minDelta*=-1),t}return p(i,[{key:"onTrainBegin",value:(r=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.wait=0,this.stoppedEpoch=0,null!=this.baseline?this.best=this.baseline:this.best=this.monitorFunc===Vfe?1/0:-1/0;case 3:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"onEpochEnd",value:(n=c(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Dce(n);case 2:if(null!=(r=this.getMonitorValue(n))){e.next=5;break}return e.abrupt("return");case 5:this.monitorFunc(r-this.minDelta,this.best)?(this.best=r,this.wait=0):(this.wait++,this.wait>=this.patience&&(this.stoppedEpoch=t,this.model.stopTraining=!0));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"onTrainEnd",value:(t=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.stoppedEpoch>0&&this.verbose&&console.log("Epoch ".concat(this.stoppedEpoch,": early stopping."));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getMonitorValue",value:function(e){null==e&&(e={});var t=e[this.monitor];return null==t&&console.warn("Metric for EarlyStopping ".concat(this.monitor," is not available. ")+"Available metrics are: ".concat(Object.keys(e))),t}}]),i}(Wfe);var jfe,Hfe,qfe={earlyStopping:function(e){return new Gfe(e)}};k0().registerFlag("KEEP_INTERMEDIATE_TENSORS",(function(){return!1}),(function(e){e&&console.warn("Keep intermediate tensors is ON. This will print the values of all intermediate tensors during model inference. Not all models support this mode. For details, check e2e/benchmarks/ model_config.js. This significantly impacts performance.")})),function(e){e[e.DT_INVALID=0]="DT_INVALID",e[e.DT_FLOAT=1]="DT_FLOAT",e[e.DT_DOUBLE=2]="DT_DOUBLE",e[e.DT_INT32=3]="DT_INT32",e[e.DT_UINT8=4]="DT_UINT8",e[e.DT_INT16=5]="DT_INT16",e[e.DT_INT8=6]="DT_INT8",e[e.DT_STRING=7]="DT_STRING",e[e.DT_COMPLEX64=8]="DT_COMPLEX64",e[e.DT_INT64=9]="DT_INT64",e[e.DT_BOOL=10]="DT_BOOL",e[e.DT_QINT8=11]="DT_QINT8",e[e.DT_QUINT8=12]="DT_QUINT8",e[e.DT_QINT32=13]="DT_QINT32",e[e.DT_BFLOAT16=14]="DT_BFLOAT16",e[e.DT_QINT16=15]="DT_QINT16",e[e.DT_QUINT16=16]="DT_QUINT16",e[e.DT_UINT16=17]="DT_UINT16",e[e.DT_COMPLEX128=18]="DT_COMPLEX128",e[e.DT_HALF=19]="DT_HALF",e[e.DT_RESOURCE=20]="DT_RESOURCE",e[e.DT_VARIANT=21]="DT_VARIANT",e[e.DT_UINT32=22]="DT_UINT32",e[e.DT_UINT64=23]="DT_UINT64",e[e.DT_FLOAT_REF=101]="DT_FLOAT_REF",e[e.DT_DOUBLE_REF=102]="DT_DOUBLE_REF",e[e.DT_INT32_REF=103]="DT_INT32_REF",e[e.DT_UINT8_REF=104]="DT_UINT8_REF",e[e.DT_INT16_REF=105]="DT_INT16_REF",e[e.DT_INT8_REF=106]="DT_INT8_REF",e[e.DT_STRING_REF=107]="DT_STRING_REF",e[e.DT_COMPLEX64_REF=108]="DT_COMPLEX64_REF",e[e.DT_INT64_REF=109]="DT_INT64_REF",e[e.DT_BOOL_REF=110]="DT_BOOL_REF",e[e.DT_QINT8_REF=111]="DT_QINT8_REF",e[e.DT_QUINT8_REF=112]="DT_QUINT8_REF",e[e.DT_QINT32_REF=113]="DT_QINT32_REF",e[e.DT_BFLOAT16_REF=114]="DT_BFLOAT16_REF",e[e.DT_QINT16_REF=115]="DT_QINT16_REF",e[e.DT_QUINT16_REF=116]="DT_QUINT16_REF",e[e.DT_UINT16_REF=117]="DT_UINT16_REF",e[e.DT_COMPLEX128_REF=118]="DT_COMPLEX128_REF",e[e.DT_HALF_REF=119]="DT_HALF_REF",e[e.DT_RESOURCE_REF=120]="DT_RESOURCE_REF",e[e.DT_VARIANT_REF=121]="DT_VARIANT_REF",e[e.DT_UINT32_REF=122]="DT_UINT32_REF",e[e.DT_UINT64_REF=123]="DT_UINT64_REF"}(jfe||(jfe={})),function(e){!function(e){e[e.LEGACY=0]="LEGACY",e[e.V1=1]="V1",e[e.V2=2]="V2"}(e.CheckpointFormatVersion||(e.CheckpointFormatVersion={}))}(Hfe||(Hfe={}));var Kfe={};function Xfe(e){return Kfe[e]}function Yfe(e,t,n,r,a){var i=t.inputParams[e];if(i&&void 0!==i.inputIndexStart){var o=i.inputIndexStart,s=0===i.inputIndexEnd?void 0:void 0===i.inputIndexEnd?o+1:i.inputIndexEnd,u=o<0?t.inputNames.length+o:o;if("tensor"===i.type)return Jfe(t.inputNames[u],n,r,a);if("tensors"===i.type){var c=t.inputs.slice(o,s),l=t.inputNames.slice(o,s).filter((function(e,t){var n;return"NoOp"!==(null===(n=c[t])||void 0===n?void 0:n.op)}));return l.map((function(e){return Jfe(e,n,r,a)}))}var h=Jfe(t.inputNames[u],n,r,a),p=h.dataSync();return"number"===i.type?p[0]:s0(h.shape,p)}var f=t.attrParams[e];return f&&f.value}function Jfe(e,t,n,r){var a=S(ede(e,n),2),i=a[0],o=a[1];if(null!=r){var s=r.getHashTableHandleByName(i);if(null!=s)return s}var u=n.currentContextIds.find((function(e){return!!t[$fe(i,e)]}));return void 0!==u?t[$fe(i,u)][o]:void 0}function Zfe(e,t,n){return t[$fe(e,n.currentContextId)]}function Qfe(e,t){var n=S(ede(e,t),3),r=n[0],a=n[1],i=n[2];return[$fe(r,t&&t.currentContextId),a,i]}function $fe(e,t){return t?"".concat(e,"-").concat(t):e}function ede(e,t){if(""===e)return["",0,void 0];var n=null!=t&&null!=t.parseNodeNameCache;if(n){var r=t.parseNodeNameCache.get(e);if(null!=r)return r}var a,i=e.split(":");if(1===i.length)a=[e,0,void 0];else{var o=i[0],s=3===i.length?i[1]:void 0;a=[o,Number(i[i.length-1]),s]}return n&&t.parseNodeNameCache.set(e,a),a}function tde(e,t,n){var r=Yfe("pad",e,t,n);if("explicit"===r){r=Yfe("explicitPaddings",e,t,n);for(var a=[[0,0],[0,0],[0,0],[0,0]],i=0;i<4;i++)a[i][0]=r[2*i],a[i][1]=r[2*i+1];return a}return r}function nde(e){return e.kept?e:Y6(e)}var rde={__proto__:null,json:[{tfOpName:"Add",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddV2",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddN",category:"arithmetic",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"BiasAdd",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"Sub",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"RealDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Div",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"DivNoNan",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mul",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Maximum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Minimum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Pow",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SquaredDifference",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorMod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]},ade={__proto__:null,json:[{tfOpName:"Abs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan2",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ceil",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ClipByValue",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"clipValueMin",type:"number"},{start:2,name:"clipValueMax",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Complex",category:"basic_math",inputs:[{start:0,name:"real",type:"tensor"},{start:1,name:"imag",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ComplexAbs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Elu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Exp",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Floor",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Imag",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Neg",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Real",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Prelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"alpha",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu6",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Selu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sigmoid",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Rsqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Square",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sign",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Round",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Expm1",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log1p",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Softplus",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Erf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LeakyRelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"alpha",name:"alpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsNan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsFinite",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsInf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]},ide={__proto__:null,json:[{tfOpName:"EmptyTensorList",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"maxNumElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"LoopCond",category:"control",inputs:[{start:0,name:"pred",type:"tensor"}]},{tfOpName:"Switch",category:"control",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"pred",type:"tensor"}]},{tfOpName:"Merge",category:"control",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"Enter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"frame_name",name:"frameName",type:"string"},{tfName:"is_constant",name:"isConstant",type:"bool"}]},{tfOpName:"Exit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NextIteration",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayV3",category:"control",inputs:[{start:0,name:"size",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"dynamic_size",name:"dynamicSize",type:"bool"},{tfName:"clear_after_read",name:"clearAfterRead",type:"bool"},{tfName:"identical_element_shapes",name:"identicalElementShapes",type:"bool"},{tfName:"tensor_array_name",name:"name",type:"string"}]},{tfOpName:"TensorArrayWriteV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayReadV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayGatherV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"}]},{tfOpName:"TensorArrayScatterV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArrayConcatV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape_except0",name:"elementShapeExcept0",type:"shape",notSupported:!0}]},{tfOpName:"TensorArraySplitV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"tensor",type:"tensor"},{start:2,name:"lengths",type:"number[]"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArraySizeV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}]},{tfOpName:"TensorArrayCloseV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"}]},{tfOpName:"StatelessIf",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"If",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"StatelessWhile",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"While",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"TensorListScatter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListScatterV2",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"},{start:3,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGather",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListSetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListReserve",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListFromTensor",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListStack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"},{tfName:"num_elements",name:"numElements",type:"dtype"}]},{tfOpName:"TensorListSplit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"},{start:2,name:"lengths",type:"number[]"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListConcat",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}],attrs:[{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListConcatV2",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}],attrs:[{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPopBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPushBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListLength",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}]},{tfOpName:"TensorListResize",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"size",type:"number"}]}]},ode={__proto__:null,json:[{tfOpName:"AvgPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[],notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPoolWithArgmax",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"include_batch_in_index",name:"includeBatchInIndex",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AvgPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Conv1D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"stride",name:"stride",type:"number"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NWC"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"dilation",name:"dilation",type:"number",defaultValue:1}]},{tfOpName:"Conv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"useCudnnOnGpu",name:"useCudnnOnGpu",type:"bool"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"_FusedConv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"use_cudnn_on_gpu",name:"useCudnnOnGpu",type:"bool",defaultValue:!0},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number",defaultValue:.2}]},{tfOpName:"Conv2DBackpropInput",category:"convolution",inputs:[{start:2,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:0,name:"outputShape",type:"number[]"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]",notSupported:!0}]},{tfOpName:"DepthwiseConv2d",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"DepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"FusedDepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]}]},{tfOpName:"Conv3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"Dilation2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"rates",name:"dilations",type:"number[]"},{tfName:"padding",name:"pad",type:"string"}]}]},sde={__proto__:null,json:[{tfOpName:"Fill",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"},{start:1,name:"value",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"LinSpace",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"num",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"OneHot",category:"creation",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"depth",type:"number"},{start:2,name:"onValue",type:"number",defaultValue:1},{start:3,name:"offValue",type:"number",defaultValue:0}],attrs:[{tfName:"axis",name:"axis",type:"number",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Ones",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"OnesLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"RandomStandardNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"RandomUniform",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number",defaultValue:0},{tfName:"maxval",name:"maxval",type:"number",defaultValue:1},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"RandomUniformInt",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number"},{tfName:"maxval",name:"maxval",type:"number"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Range",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"step",type:"number",defaultValue:0}],attrs:[{tfName:"Tidx",name:"dtype",type:"dtype"}]},{tfOpName:"TruncatedNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"means",name:"mean",type:"number",defaultValue:0},{tfName:"stddev",name:"stdDev",type:"number",defaultValue:1},{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Zeros",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"ZerosLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Multinomial",category:"creation",inputs:[{start:0,name:"logits",type:"tensor"},{start:1,name:"numSamples",type:"number"}],attrs:[{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number"},{tfName:"T",name:"dtype",type:"dtype"},{tfName:"output_dtype",name:"output_dtype",type:"dtype"}]}]},ude={__proto__:null,json:[{tfOpName:"NonMaxSuppressionV2",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV3",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV4",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"T_threshold",name:"threshold",type:"dtype",notSupported:!0},{tfName:"pad_to_max_output_size",name:"padToMaxOutputSize",type:"bool"}]},{tfOpName:"NonMaxSuppressionV5",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"},{start:5,name:"softNmsSigma",type:"number"}]},{tfOpName:"Where",category:"dynamic",inputs:[{start:0,name:"condition",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ListDiff",category:"dynamic",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]},cde={__proto__:null,json:[{tfOpName:"LowerBound",category:"evaluation",inputs:[{start:0,name:"sortedSequence",type:"tensor"},{start:1,name:"values",type:"tensor"}]},{tfOpName:"TopKV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"k",type:"number"}],attrs:[{tfName:"sorted",name:"sorted",type:"bool"}]},{tfOpName:"UpperBound",category:"evaluation",inputs:[{start:0,name:"sortedSequence",type:"tensor"},{start:1,name:"values",type:"tensor"}]},{tfOpName:"Unique",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"UniqueV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]}]},lde={__proto__:null,json:[{tfOpName:"PlaceholderWithDefault",category:"graph",inputs:[{start:0,name:"default",type:"tensor"}],attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Placeholder",category:"graph",attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Const",category:"graph"},{tfOpName:"Identity",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IdentityN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Snapshot",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Rank",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Size",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Shape",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"ShapeN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Print",category:"graph",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"data",type:"tensors"}],attrs:[{tfName:"message",name:"message",type:"string"},{tfName:"first_n",name:"firstN",type:"number",notSupported:!0},{tfName:"summarize",name:"summarize",type:"number",defaultValue:3}]},{tfOpName:"NoOp",category:"graph",inputs:[]},{tfOpName:"StopGradient",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"FakeQuantWithMinMaxVars",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"min",name:"min",type:"number"},{tfName:"max",name:"max",type:"number"}]}]},hde={__proto__:null,json:[{tfOpName:"HashTable",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"HashTableV2",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"LookupTableImport",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableImportV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFind",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFindV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableSize",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"LookupTableSizeV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"InitializeTable",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}]},{tfOpName:"InitializeTableV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}]}]},pde={__proto__:null,json:[{tfOpName:"ResizeBilinear",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ResizeNearestNeighbor",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"CropAndResize",category:"image",inputs:[{start:0,name:"image",type:"tensor"},{start:1,name:"boxes",type:"tensor"},{start:2,name:"boxInd",type:"tensor"},{start:3,name:"cropSize",type:"number[]"}],attrs:[{tfName:"method",name:"method",type:"string"},{tfName:"extrapolation_value",name:"extrapolationValue",type:"number"}]},{tfOpName:"ImageProjectiveTransformV3",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"transforms",type:"tensor"},{start:2,name:"outputShape",type:"number[]"},{start:3,name:"fillValue",type:"number"}],attrs:[{tfName:"interpolation",name:"interpolation",type:"string"},{tfName:"fill_mode",name:"fillMode",type:"string"}]}]},fde={__proto__:null,json:[{tfOpName:"Equal",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NotEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Greater",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"GreaterEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Less",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LessEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalAnd",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalNot",category:"logical",inputs:[{start:0,name:"a",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalOr",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Select",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SelectV2",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BitwiseAnd",category:"logical",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}]}]},dde={__proto__:null,json:[{tfOpName:"_FusedMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMulV2",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Transpose",category:"matrices",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"perm",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Einsum",category:"matrices",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"equation",name:"equation",type:"string"},{tfName:"N",name:"n",type:"number",defaultValue:2},{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"MatrixBandPart",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"numLower",type:"tensor"},{start:1,name:"numUpper",type:"tensor"}]}]},vde={__proto__:null,json:[{tfOpName:"EuclideanNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool",defaultValue:!1}]},{tfOpName:"FusedBatchNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV2",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV3",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"LRN",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"depth_radius",name:"radius",type:"number",defaultValue:5},{tfName:"bias",name:"bias",type:"number",defaultValue:1},{tfName:"alpha",name:"alpha",type:"number",defaultValue:1},{tfName:"beta",name:"beta",type:"number",defaultValue:.5}]},{tfOpName:"Softmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"LogSoftmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]}]},mde={__proto__:null,json:[{tfOpName:"Bincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}]},{tfOpName:"DenseBincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}],attrs:[{tfName:"binary_output",name:"binaryOutput",type:"bool"}]},{tfOpName:"Max",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Mean",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Min",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Sum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"All",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Any",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"ArgMax",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"ArgMin",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"Prod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cumprod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}],attrs:[{tfName:"exclusive",name:"exclusive",type:"bool"},{tfName:"reverse",name:"reverse",type:"bool"}]},{tfOpName:"Cumsum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}],attrs:[{tfName:"exclusive",name:"exclusive",type:"bool"},{tfName:"reverse",name:"reverse",type:"bool"}]}]},gde={__proto__:null,json:[{tfOpName:"ConcatV2",category:"slice_join",inputs:[{start:0,end:-1,name:"tensors",type:"tensors"},{start:-1,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"Concat",category:"slice_join",inputs:[{start:1,end:0,name:"tensors",type:"tensors"},{start:0,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"GatherV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"axis",type:"number",defaultValue:0}],attrs:[{tfName:"batch_dims",name:"batchDims",type:"number",defaultValue:0}]},{tfOpName:"Gather",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",notSupported:!0}]},{tfOpName:"Reverse",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"dims",type:"bool[]"}]},{tfOpName:"ReverseV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}]},{tfOpName:"Slice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"size",type:"number[]"}]},{tfOpName:"StridedSlice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"end",type:"number[]"},{start:3,name:"strides",type:"number[]"}],attrs:[{tfName:"begin_mask",name:"beginMask",type:"number",defaultValue:0},{tfName:"end_mask",name:"endMask",type:"number",defaultValue:0},{tfName:"new_axis_mask",name:"newAxisMask",type:"number",defaultValue:0},{tfName:"ellipsis_mask",name:"ellipsisMask",type:"number",defaultValue:0},{tfName:"shrink_axis_mask",name:"shrinkAxisMask",type:"number",defaultValue:0}]},{tfOpName:"Pack",category:"slice_join",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0}]},{tfOpName:"Unpack",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0},{tfName:"num",name:"num",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Tile",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"reps",type:"number[]"}]},{tfOpName:"Split",category:"slice_join",inputs:[{start:0,name:"axis",type:"number",defaultValue:0},{start:1,name:"x",type:"tensor"}],attrs:[{tfName:"num_split",name:"numOrSizeSplits",type:"number",defaultValue:1}]},{tfOpName:"SplitV",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"numOrSizeSplits",type:"number[]"},{start:2,name:"axis",type:"number",defaultValue:0}]},{tfOpName:"ScatterNd",category:"slice_join",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"shape",type:"number[]"}]},{tfOpName:"GatherNd",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}]},{tfOpName:"SparseToDense",category:"slice_join",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!1,notSupported:!0}]},{tfOpName:"TensorScatterUpdate",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"values",type:"tensor"}]}]},yde={__proto__:null,json:[{tfOpName:"SparseFillEmptyRows",category:"sparse",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"denseShape",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}]},{tfOpName:"SparseReshape",category:"sparse",inputs:[{start:0,name:"inputIndices",type:"tensor"},{start:1,name:"inputShape",type:"tensor"},{start:2,name:"newShape",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SparseSegmentMean",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]},{tfOpName:"SparseSegmentSum",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]}]},bde={__proto__:null,json:[{tfOpName:"FFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"RFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]},{tfOpName:"IRFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]}]},xde={__proto__:null,json:[{tfOpName:"StaticRegexReplace",category:"string",inputs:[{start:0,name:"input",type:"tensor"}],attrs:[{tfName:"pattern",name:"pattern",type:"string"},{tfName:"rewrite",name:"rewrite",type:"string"},{tfName:"replace_global",name:"replaceGlobal",type:"bool"}]},{tfOpName:"StringNGrams",category:"string",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"dataSplits",type:"tensor"}],attrs:[{tfName:"separator",name:"separator",type:"string"},{tfName:"ngram_widths",name:"nGramWidths",type:"number[]"},{tfName:"left_pad",name:"leftPad",type:"string"},{tfName:"right_pad",name:"rightPad",type:"string"},{tfName:"pad_width",name:"padWidth",type:"number"},{tfName:"preserve_short_sequences",name:"preserveShortSequences",type:"bool"}],outputs:["ngrams","ngrams_splits"]},{tfOpName:"StringSplit",category:"string",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"delimiter",type:"tensor"}],attrs:[{tfName:"skip_empty",name:"skipEmpty",type:"bool"}],outputs:["indices","values","shape"]},{tfOpName:"StringToHashBucketFast",category:"string",inputs:[{start:0,name:"input",type:"tensor"}],attrs:[{tfName:"num_buckets",name:"numBuckets",type:"number"}]}]},kde={__proto__:null,json:[{tfOpName:"Cast",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"SrcT",name:"sdtype",type:"dtype",notSupported:!0},{tfName:"DstT",name:"dtype",type:"dtype"}]},{tfOpName:"ExpandDims",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"MirrorPad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"mode",name:"mode",type:"string"}]},{tfOpName:"Pad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"constant_value",name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"PadV2",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"},{start:2,name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"Reshape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"EnsureShape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"Squeeze",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"axis",tfDeprecatedName:"squeeze_dims",name:"axis",type:"number[]"}]},{tfOpName:"SpaceToBatchND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"paddings",type:"number[]"}]},{tfOpName:"BatchToSpaceND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"crops",type:"number[]"}]},{tfOpName:"DepthToSpace",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"block_size",name:"blockSize",type:"number"},{tfName:"data_format",name:"dataFormat",type:"string"}]},{tfOpName:"BroadcastTo",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}],attrs:[]},{tfOpName:"BroadcastArgs",category:"transformation",inputs:[{start:0,name:"s0",type:"tensor"},{start:1,name:"s1",type:"tensor"}],attrs:[]}]},wde=function(){function e(){var t;l(this,e);var n=[rde,ade,ide,ode,sde,ude,cde,lde,hde,pde,fde,dde,vde,mde,gde,yde,bde,xde,kde],r=(t=[]).concat.apply(t,T(n.map((function(e){return e.json}))));this.opMappers=r.reduce((function(e,t){return e[t.tfOpName]=t,e}),{})}return p(e,[{key:"transformGraph",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.node,a=[],i=[],o=[],s=r.reduce((function(e,n){return e[n.name]=t.mapNode(n),n.op.startsWith("Placeholder")?a.push(e[n.name]):"Const"===n.op?i.push(e[n.name]):null!=n.input&&0!==n.input.length||o.push(e[n.name]),e}),{}),u=[],c=[],l={},h={};null!=n&&(l=this.mapSignatureEntries(n.inputs),h=this.mapSignatureEntries(n.outputs));var p=Object.keys(s);p.forEach((function(e){var t=s[e];t.inputNames.forEach((function(e,n){var r=S(Qfe(e),3),a=r[0],i=r[2],o=s[a];if(null!=o.outputs){var u=o.outputs.indexOf(i);if(-1!==u){var c="".concat(a,":").concat(u);t.inputNames[n]=c}}t.inputs.push(o),o.children.push(t)}))})),0===Object.keys(h).length?p.forEach((function(e){var t=s[e];0===t.children.length&&c.push(t)})):Object.keys(h).forEach((function(e){var t=S(Qfe(e),1)[0],n=s[t];null!=n&&(n.signatureKey=h[e],c.push(n))})),Object.keys(l).length>0?Object.keys(l).forEach((function(e){var t=S(Qfe(e),1)[0],n=s[t];n&&(n.signatureKey=l[e],u.push(n))})):u=a;var f={};null!=e.library&&null!=e.library.function&&(f=e.library.function.reduce((function(e,n){return e[n.signature.name]=t.mapFunction(n),e}),{}));var d={nodes:s,inputs:u,outputs:c,weights:i,placeholders:a,signature:n,functions:f};return o.length>0&&(d.initNodes=o),d}},{key:"mapSignatureEntries",value:function(e){return Object.keys(e||{}).reduce((function(t,n){return t[e[n].name]=n,t}),{})}},{key:"mapNode",value:function(e){var t=Xfe(e.op)||this.opMappers[e.op]||{};null==e.attr&&(e.attr={});var n={name:e.name,op:e.op,category:t.category,inputNames:(e.input||[]).map((function(e){return e.startsWith("^")?e.slice(1):e})),inputs:[],children:[],inputParams:{},attrParams:{},rawAttrs:e.attr,outputs:t.outputs};return null!=t.inputs&&(n.inputParams=t.inputs.reduce((function(e,t){return e[t.name]={type:t.type,inputIndexStart:t.start,inputIndexEnd:t.end},e}),{})),null!=t.attrs&&(n.attrParams=t.attrs.reduce((function(t,n){var r=n.type,a=void 0;switch(n.type){case"string":void 0===(a=Nde(e.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(a=Nde(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"string[]":void 0===(a=Dde(e.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(a=Dde(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"number":void 0===(a=Tde(e.attr,n.tfName,n.defaultValue||0))&&n.tfDeprecatedName&&(a=Tde(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"number[]":void 0===(a=Fde(e.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(a=Fde(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"bool":void 0===(a=Sde(e.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(a=Sde(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"bool[]":void 0===(a=Lde(e.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(a=Lde(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"shape":void 0===(a=Ode(e.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(a=Ode(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"shape[]":void 0===(a=Mde(e.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(a=Mde(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"dtype":void 0===(a=Ade(e.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(a=Ade(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"dtype[]":void 0===(a=Rde(e.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(a=Rde(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"func":void 0===(a=Cde(e.attr,n.tfName,n.defaultValue))&&n.tfDeprecatedName&&(a=Cde(e.attr,n.tfDeprecatedName,n.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error("Unsupported param type: ".concat(n.type," for op: ").concat(e.op))}return t[n.name]={value:a,type:r},t}),{})),n}},{key:"mapFunction",value:function(e){var t=this,n=e.nodeDef,r=[],a={};null!=n&&(a=n.reduce((function(e,n){return e[n.name]=t.mapNode(n),"Const"===n.op&&r.push(e[n.name]),e}),{}));var i=[],o=[];e.signature.inputArg.forEach((function(e){var t=S(Qfe(e.name),1)[0],n={name:t,op:"Placeholder",inputs:[],inputNames:[],category:"graph",inputParams:{},attrParams:{dtype:{value:Ede(e.type),type:"dtype"}},children:[]};n.signatureKey=e.name,i.push(n),a[t]=n})),Object.keys(a).forEach((function(e){var t=a[e];t.inputNames.forEach((function(e,n){var r=S(Qfe(e),3),i=r[0],o=r[2],s=a[i];if(null!=s.outputs){var u=s.outputs.indexOf(o);if(-1!==u){var c="".concat(i,":").concat(u);t.inputNames[n]=c}}t.inputs.push(s),s.children.push(t)}))}));var s=e.ret;e.signature.outputArg.forEach((function(e){var t=S(Qfe(s[e.name]),2),n=t[0],r=t[1],i=a[n];null!=i&&(i.defaultOutput=r,o.push(i))}));var u=this.mapArgsToSignature(e);return{nodes:a,inputs:i,outputs:o,weights:r,placeholders:[],signature:u}}},{key:"mapArgsToSignature",value:function(e){var t=this;return{methodName:e.signature.name,inputs:e.signature.inputArg.reduce((function(e,n){return e[n.name]=t.mapArgToTensorInfo(n),e}),{}),outputs:e.signature.outputArg.reduce((function(n,r){return n[r.name]=t.mapArgToTensorInfo(r,e.ret),n}),{})}}},{key:"mapArgToTensorInfo",value:function(e,t){var n=e.name;return null!=t&&(n=t[n]),{name:n,dtype:e.type}}}],[{key:"Instance",get:function(){return this._instance||(this._instance=new this)}}]),e}();function Ide(e,t){var n=Array.isArray(e)?String.fromCharCode.apply(null,e):function(e){var t=k0().global;if(void 0!==t.atob)return t.atob(e);if("undefined"!=typeof Buffer)return new Buffer(e,"base64").toString();throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()")}(e);return t?n:n.toLowerCase()}function Nde(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=e[t];return null!=a?Ide(a.s,r):n}function Sde(e,t,n){var r=e[t];return r?r.b:n}function Tde(e,t,n){var r=e[t]||{},a=null!=r.i?r.i:null!=r.f?r.f:n;return"number"==typeof a?a:parseInt(a,10)}function Ede(e){switch("string"==typeof e&&(e=jfe[e]),e){case jfe.DT_FLOAT:case jfe.DT_HALF:return"float32";case jfe.DT_INT32:case jfe.DT_INT64:case jfe.DT_INT8:case jfe.DT_UINT8:return"int32";case jfe.DT_BOOL:return"bool";case jfe.DT_DOUBLE:return"float32";case jfe.DT_STRING:return"string";default:return null}}function Cde(e,t,n){var r=e[t];return r&&r.func?r.func.name:n}function Ade(e,t,n){var r=e[t];return r&&r.type?Ede(r.type):n}function Rde(e,t,n){var r=e[t];return r&&r.list&&r.list.type?r.list.type.map((function(e){return Ede(e)})):n}function _de(e){if(!e.unknownRank)return null!=e.dim?e.dim.map((function(e){return"number"==typeof e.size?e.size:parseInt(e.size,10)})):[]}function Ode(e,t,n){var r=e[t];return r&&r.shape?_de(r.shape):n}function Fde(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:parseInt(e,10)})):n}function Dde(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=e[t];return a&&a.list&&a.list.s?a.list.s.map((function(e){return Ide(e,r)})):n}function Mde(e,t,n){var r=e[t];return r&&r.list&&r.list.shape?r.list.shape.map((function(e){return _de(e)})):n}function Lde(e,t,n){var r=e[t];return r&&r.list&&r.list.b?r.list.b:n}var zde=function(){function e(t,n,r){var a=this;l(this,e),this.node=t,this.tensorMap=n,this.context=r,this.inputs=[],this.attrs={},this.inputs=t.inputNames.map((function(e){return a.getInput(e)})),null!=t.rawAttrs&&(this.attrs=Object.keys(t.rawAttrs).reduce((function(e,t){return e[t]=a.getAttr(t),e}),{}))}return p(e,[{key:"getInput",value:function(e){return Jfe(e,this.tensorMap,this.context)}},{key:"getAttr",value:function(e,t){var n=this.node.rawAttrs[e];if(null!=n.tensor)return Jfe(e,this.tensorMap,this.context);if(null!=n.i||null!=n.f)return Tde(this.node.rawAttrs,e,t);if(null!=n.s)return Nde(this.node.rawAttrs,e,t);if(null!=n.b)return Sde(this.node.rawAttrs,e,t);if(null!=n.shape)return Ode(this.node.rawAttrs,e,t);if(null!=n.type)return Ade(this.node.rawAttrs,e,t);if(null!=n.list){if(null!=n.list.i||null!=n.list.f)return Fde(this.node.rawAttrs,e,t);if(null!=n.list.s)return Dde(this.node.rawAttrs,e,t);if(null!=n.list.shape)return Mde(this.node.rawAttrs,e,t);if(null!=n.list.b)return Lde(this.node.rawAttrs,e,t);if(null!=n.list.type)return Rde(this.node.rawAttrs,e,t)}return t}}]),e}(),Pde={__proto__:null,OP_SCOPE_SUFFIX:P5,abs:l8,acos:h8,acosh:p8,add:o8,addN:f8,all:d8,any:v8,argMax:m8,argMin:g8,asin:y8,asinh:b8,atan:x8,atan2:k8,atanh:w8,avgPool:V8,avgPool3d:U8,basicLSTMCell:X8,batchNorm:J8,batchNorm2d:Z8,batchNorm3d:Q8,batchNorm4d:$8,batchToSpaceND:Y8,bincount:e7,bitwiseAnd:t7,booleanMaskAsync:nne,broadcastArgs:n7,broadcastTo:r7,buffer:K6,cast:X6,ceil:a7,clipByValue:o7,clone:Y6,complex:W5,concat:G8,concat1d:s7,concat2d:u7,concat3d:c7,concat4d:l7,conv1d:p7,conv2d:h7,conv2dTranspose:d7,conv3d:v7,conv3dTranspose:g7,cos:y7,cosh:b7,cosineWindow:hne,cumprod:x7,cumsum:k7,denseBincount:w7,depthToSpace:I7,depthwiseConv2d:N7,diag:S7,dilation2d:T7,div:u8,divNoNan:D7,dot:M7,dropout:cne,einsum:L7,elu:z7,enclosingPowerOfTwo:lne,ensureShape:P7,equal:_7,erf:B7,euclideanNorm:r9,exp:a9,expandDims:i9,expm1:o9,eye:u9,fft:Ite,fill:i7,floor:c9,floorDiv:s8,fused:Nne,gather:l9,gatherND:une,greater:h9,greaterEqual:p9,ifft:Nte,imag:f9,image:Are,inTopKAsync:fne,irfft:Ste,isFinite:d9,isInf:v9,isNaN:m9,leakyRelu:g9,less:y9,lessEqual:b9,linalg:Rre,linspace:x9,localResponseNormalization:k9,log:w9,log1p:I9,logSigmoid:A9,logSoftmax:_9,logSumExp:O9,logicalAnd:F9,logicalNot:D9,logicalOr:M9,logicalXor:L9,losses:_re,lowerBound:B9,matMul:j8,max:X7,maxPool:W9,maxPool3d:V9,maxPoolWithArgmax:U9,maximum:G9,mean:j9,meshgrid:K9,min:Y7,minimum:X9,mirrorPad:Y9,mod:J9,moments:Z9,movingAverage:ane,mul:c8,multiRNNCell:Q9,multinomial:$9,neg:E9,norm:n9,notEqual:eee,oneHot:tee,ones:q9,onesLike:nee,op:B5,outerProduct:ree,pad:aee,pad1d:iee,pad2d:oee,pad3d:see,pad4d:uee,pool:lee,pow:J7,prelu:hee,print:J6,prod:pee,raggedGather:fee,raggedRange:dee,raggedTensorToTensor:vee,rand:mee,randomGamma:Xee,randomNormal:Yee,randomStandardNormal:Jee,randomUniform:Zee,randomUniformInt:Qee,range:$ee,real:ete,reciprocal:tte,relu:nte,relu6:rte,reshape:W8,reverse:ate,reverse1d:ite,reverse2d:ote,reverse3d:ste,reverse4d:ute,rfft:Ete,round:cte,rsqrt:lte,scalar:Z7,scatterND:ine,searchSorted:P9,selu:hte,separableConv2d:pte,setdiff1dAsync:dte,sigmoid:H8,sign:vte,signal:Cre,sin:mte,sinh:gte,slice:q8,slice1d:yte,slice2d:bte,slice3d:xte,slice4d:kte,softmax:wte,softplus:C9,spaceToBatchND:cee,sparse:Ore,sparseToDense:sne,spectral:Ere,split:Tte,sqrt:Q7,square:$7,squaredDifference:Cte,squeeze:Ate,stack:Rte,step:_te,stridedSlice:Ote,string:Fre,sub:R9,sum:e9,tan:Fte,tanh:K8,tensor:U5,tensor1d:Dte,tensor2d:Mte,tensor3d:Lte,tensor4d:zte,tensor5d:Pte,tensor6d:Bte,tensorScatterUpdate:jte,tile:s9,topk:Hte,transpose:rne,truncatedNormal:qte,unique:Kte,unsortedSegmentSum:Xte,unstack:Yte,upperBound:Jte,variable:Zte,where:O7,whereAsync:ene,zeros:H9,zerosLike:F7},Bde=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pde;switch(e.op){case"BiasAdd":case"AddV2":case"Add":return[r.add(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"AddN":return[r.addN(Yfe("tensors",e,t,n))];case"FloorMod":case"Mod":return[r.mod(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"Mul":return[r.mul(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"RealDiv":case"Div":return[r.div(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"DivNoNan":return[r.divNoNan(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"FloorDiv":return[r.floorDiv(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"Sub":return[r.sub(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"Minimum":return[r.minimum(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"Maximum":return[r.maximum(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"Pow":return[r.pow(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"SquaredDifference":return[r.squaredDifference(Yfe("a",e,t,n),Yfe("b",e,t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}},Wde=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pde;switch(e.op){case"Abs":case"ComplexAbs":return[r.abs(Yfe("x",e,t,n))];case"Acos":return[r.acos(Yfe("x",e,t,n))];case"Acosh":return[r.acosh(Yfe("x",e,t,n))];case"Asin":return[r.asin(Yfe("x",e,t,n))];case"Asinh":return[r.asinh(Yfe("x",e,t,n))];case"Atan":return[r.atan(Yfe("x",e,t,n))];case"Atan2":return[r.atan2(Yfe("x",e,t,n),Yfe("y",e,t,n))];case"Atanh":return[r.atanh(Yfe("x",e,t,n))];case"Ceil":return[r.ceil(Yfe("x",e,t,n))];case"Complex":return[r.complex(Yfe("real",e,t,n),Yfe("imag",e,t,n))];case"Cos":return[r.cos(Yfe("x",e,t,n))];case"Cosh":return[r.cosh(Yfe("x",e,t,n))];case"Elu":return[r.elu(Yfe("x",e,t,n))];case"Erf":return[r.erf(Yfe("x",e,t,n))];case"Exp":return[r.exp(Yfe("x",e,t,n))];case"Expm1":return[r.expm1(Yfe("x",e,t,n))];case"Floor":return[r.floor(Yfe("x",e,t,n))];case"Log":return[r.log(Yfe("x",e,t,n))];case"Log1p":return[r.log1p(Yfe("x",e,t,n))];case"Imag":return[r.imag(Yfe("x",e,t,n))];case"Neg":return[r.neg(Yfe("x",e,t,n))];case"Reciprocal":return[r.reciprocal(Yfe("x",e,t,n))];case"Real":return[r.real(Yfe("x",e,t,n))];case"Relu":return[r.relu(Yfe("x",e,t,n))];case"Round":return[r.round(Yfe("x",e,t,n))];case"Selu":return[r.selu(Yfe("x",e,t,n))];case"Sigmoid":return[r.sigmoid(Yfe("x",e,t,n))];case"Sin":return[r.sin(Yfe("x",e,t,n))];case"Sign":return[r.sign(Yfe("x",e,t,n))];case"Sinh":return[r.sinh(Yfe("x",e,t,n))];case"Softplus":return[r.softplus(Yfe("x",e,t,n))];case"Sqrt":return[r.sqrt(Yfe("x",e,t,n))];case"Square":return[r.square(Yfe("x",e,t,n))];case"Tanh":return[r.tanh(Yfe("x",e,t,n))];case"Tan":return[r.tan(Yfe("x",e,t,n))];case"ClipByValue":return[r.clipByValue(Yfe("x",e,t,n),Yfe("clipValueMin",e,t,n),Yfe("clipValueMax",e,t,n))];case"Relu6":return[r.relu6(Yfe("x",e,t,n))];case"Rsqrt":return[r.rsqrt(Jfe(e.inputNames[0],t,n))];case"LeakyRelu":return[r.leakyRelu(Yfe("x",e,t,n),Yfe("alpha",e,t,n))];case"Prelu":return[r.prelu(Yfe("x",e,t,n),Yfe("alpha",e,t,n))];case"IsNan":return[r.isNaN(Jfe(e.inputNames[0],t,n))];case"IsInf":return[r.isInf(Jfe(e.inputNames[0],t,n))];case"IsFinite":return[r.isFinite(Jfe(e.inputNames[0],t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};function Vde(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if("number"!=typeof e&&"number"!=typeof t){F$(e.length===t.length,(function(){return n+" Shapes ".concat(e," and ").concat(t," must match")}));for(var r=0;r<e.length;r++){var a=e[r],i=t[r];F$(a<0||i<0||a===i,(function(){return n+" Shapes ".concat(e," and ").concat(t," must match")}))}}}function Ude(e){return"number"!=typeof e&&!e.some((function(e){return e<0}))}function Gde(e,t,n){var r=jde(e,n),a=!Ude(r);if(a&&0===t.length)throw new Error("Tried to calculate elements of an empty list"+" with non-fully-defined elementShape: ".concat(r));if(a&&t.forEach((function(e){r=jde(e.shape,r)})),!Ude(r))throw new Error("Non-fully-defined elementShape: ".concat(r));return r}function jde(e,t){if("number"==typeof e)return t;if("number"==typeof t)return e;if(e.length!==t.length)throw new Error("Incompatible ranks during merge: ".concat(e," vs. ").concat(t));for(var n=[],r=0;r<e.length;++r){var a=e[r],i=t[r];if(a>=0&&i>=0&&a!==i)throw new Error("Incompatible shape during merge: ".concat(e," vs. ").concat(t));n[r]=a>=0?a:i}return n}var Hde=function(){function e(t,n,r,a,i,o,s){l(this,e),this.name=t,this.dtype=n,this.maxSize=r,this.elementShape=a,this.identicalElementShapes=i,this.dynamicSize=o,this.clearAfterRead=s,this.tensors=[],this.closed_=!1,this.idTensor=Z7(0),n8(this.idTensor)}return p(e,[{key:"id",get:function(){return this.idTensor.id}},{key:"closed",get:function(){return this.closed_}},{key:"clearAndClose",value:function(e){this.tensors.forEach((function(t){null!=e&&e.has(t.tensor.id)||t.tensor.dispose()})),this.tensors=[],this.closed_=!0,this.idTensor.dispose()}},{key:"size",value:function(){return this.tensors.length}},{key:"read",value:function(e){if(this.closed_)throw new Error("TensorArray ".concat(this.name," has already been closed."));if(e<0||e>=this.size())throw new Error("Tried to read from index ".concat(e,", but array size is: ").concat(this.size()));var t=this.tensors[e];if(t.cleared)throw new Error("TensorArray ".concat(this.name,": Could not read index ").concat(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}},{key:"readMany",value:function(e){var t=this;return e.map((function(e){return t.read(e)}))}},{key:"write",value:function(e,t){if(this.closed_)throw new Error("TensorArray ".concat(this.name," has already been closed."));if(e<0||!this.dynamicSize&&e>=this.maxSize)throw new Error("Tried to write to index ".concat(e,", but array is not resizeable and size is: ").concat(this.maxSize));var n=this.tensors[e]||{};if(t.dtype!==this.dtype)throw new Error("TensorArray ".concat(this.name,": Could not write to TensorArray index ").concat(e,",\n because the value dtype is ").concat(t.dtype,", but TensorArray dtype is ").concat(this.dtype,"."));if(0!==this.size()||null!=this.elementShape&&0!==this.elementShape.length||(this.elementShape=t.shape),Vde(this.elementShape,t.shape,"TensorArray ".concat(this.name,": Could not write to TensorArray index ").concat(e,".")),n.read)throw new Error("TensorArray ".concat(this.name,": Could not write to TensorArray index ").concat(e,", because it has already been read."));if(n.written)throw new Error("TensorArray ".concat(this.name,": Could not write to TensorArray index ").concat(e,", because it has already been written."));n.tensor=t,n8(t),n.written=!0,this.tensors[e]=n}},{key:"writeMany",value:function(e,t){var n=this;if(e.length!==t.length)throw new Error("TensorArray ".concat(this.name,": could not write multiple tensors,")+"because the index size: ".concat(e.length," is not the same as tensors size: ").concat(t.length,"."));e.forEach((function(e,r){return n.write(e,t[r])}))}},{key:"gather",value:function(e,t){if(t&&t!==this.dtype)throw new Error("TensorArray dtype is ".concat(this.dtype," but gather requested dtype ").concat(t));if(e)e=e.slice(0,this.size());else{e=[];for(var n=0;n<this.size();n++)e.push(n)}if(0===e.length)return U5([],[0].concat(this.elementShape));var r=this.readMany(e);return Vde(this.elementShape,r[0].shape,"TensorArray shape mismatch: "),Rte(r,0)}},{key:"concat",value:function(e){if(e&&e!==this.dtype)throw new Error("TensorArray dtype is ".concat(this.dtype," but concat requested dtype ").concat(e));if(0===this.size())return U5([],[0].concat(this.elementShape));for(var t=[],n=0;n<this.size();n++)t.push(n);var r=this.readMany(t);return Vde(this.elementShape,r[0].shape,"TensorArray shape mismatch: tensor array shape (".concat(this.elementShape,") vs first tensor shape (").concat(r[0].shape,")")),G8(r,0)}},{key:"scatter",value:function(e,t){if(t.dtype!==this.dtype)throw new Error("TensorArray dtype is ".concat(this.dtype," but tensor has dtype ").concat(t.dtype));if(e.length!==t.shape[0])throw new Error("Expected len(indices) == tensor.shape[0], but saw: ".concat(e.length," vs. ").concat(t.shape[0]));var n=Math.max.apply(Math,T(e));if(!this.dynamicSize&&n>=this.maxSize)throw new Error("Max index must be < array size (".concat(n," vs. ").concat(this.maxSize,")"));this.writeMany(e,Yte(t,0))}},{key:"split",value:function(e,t){var n=this;if(t.dtype!==this.dtype)throw new Error("TensorArray dtype is ".concat(this.dtype," but tensor has dtype ").concat(t.dtype));var r=0,a=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 ".concat(r,", and tensor's shape is: ").concat(t.shape));if(!this.dynamicSize&&e.length!==this.maxSize)throw new Error("TensorArray's size is not equal to the size of lengths (".concat(this.maxSize," vs. ").concat(e.length,"), ")+"and the TensorArray is not marked as dynamically resizeable");var i=0===r?0:t.size/r,o=[];e8((function(){t=W8(t,[1,r,i]);for(var s=0;s<e.length;++s){var u=[0,0===s?0:a[s-1],0],c=[1,e[s],i];o[s]=W8(q8(t,u,c),n.elementShape)}return o}));for(var s=[],u=0;u<e.length;u++)s[u]=u;this.writeMany(s,o)}}]),e}(),qde=function(){function e(t,n,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1;l(this,e),this.tensors=t,this.elementShape=n,this.elementDtype=r,null!=t&&t.forEach((function(e){if(r!==e.dtype)throw new Error("Invalid data types; op elements ".concat(r,", but list elements ").concat(e.dtype));Vde(n,e.shape,"TensorList shape mismatch: "),n8(e)})),this.idTensor=Z7(0),this.maxNumElements=a,n8(this.idTensor)}return p(e,[{key:"id",get:function(){return this.idTensor.id}},{key:"copy",value:function(){return new e(T(this.tensors),this.elementShape,this.elementDtype)}},{key:"clearAndClose",value:function(e){this.tensors.forEach((function(t){null!=e&&e.has(t.id)||t.dispose()})),this.tensors.length=0,this.idTensor.dispose()}},{key:"size",value:function(){return this.tensors.length}},{key:"stack",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(t!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(t,", but list elements ").concat(this.elementDtype));if(-1!==r&&this.tensors.length!==r)throw new Error("Operation expected a list with ".concat(r," elements but got a list with ").concat(this.tensors.length," elements."));Vde(e,this.elementShape,"TensorList shape mismatch: ");var a=Gde(this.elementShape,this.tensors,e);return e8((function(){var e=n.tensors.map((function(e){return W8(e,a)}));return Rte(e,0)}))}},{key:"popBack",value:function(e,t){if(t!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(t,", but list elements ").concat(this.elementDtype));if(0===this.size())throw new Error("Trying to pop from an empty list.");var n=Gde(this.elementShape,this.tensors,e),r=this.tensors.pop();return r.kept=!1,Vde(r.shape,e,"TensorList shape mismatch: "),W8(r,n)}},{key:"pushBack",value:function(e){if(e.dtype!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(e.dtype,", but list elements ").concat(this.elementDtype));if(Vde(e.shape,this.elementShape,"TensorList shape mismatch: "),this.maxNumElements===this.size())throw new Error("Trying to push element into a full list.");n8(e),this.tensors.push(e)}},{key:"resize",value:function(t){if(t<0)throw new Error("TensorListResize expects size to be non-negative. Got: ".concat(t));if(-1!==this.maxNumElements&&t>this.maxNumElements)throw new Error("TensorListResize input size ".concat(t," is greater maxNumElement ").concat(this.maxNumElements,"."));var n=new e([],this.elementShape,this.elementDtype,this.maxNumElements);n.tensors.length=t;for(var r=0;r<Math.min(this.tensors.length,t);++r)n.tensors[r]=this.tensors[r];return n}},{key:"getItem",value:function(e,t,n){if(n!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(n,", but list elements ").concat(this.elementDtype));if(e<0||e>this.tensors.length)throw new Error("Trying to access element ".concat(e," in a list with ").concat(this.tensors.length," elements."));if(null==this.tensors[e])throw new Error("element at index ".concat(e," is null."));Vde(this.tensors[e].shape,t,"TensorList shape mismatch: ");var r=Gde(this.elementShape,this.tensors,t);return W8(this.tensors[e],r)}},{key:"setItem",value:function(e,t){if(t.dtype!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(t.dtype,", but list elements ").concat(this.elementDtype));if(e<0||-1!==this.maxNumElements&&e>=this.maxNumElements)throw new Error("Trying to set element ".concat(e," in a list with max ").concat(this.maxNumElements," elements."));Vde(this.elementShape,t.shape,"TensorList shape mismatch: "),n8(t),null!=this.tensors[e]&&(this.tensors[e].kept=!1),this.tensors[e]=t}},{key:"gather",value:function(e,t,n){var r=this;if(t!==this.elementDtype)throw new Error("Invalid data types; op elements ".concat(t,", but list elements ").concat(this.elementDtype));Vde(this.elementShape,n,"TensorList shape mismatch: "),e=e.slice(0,this.size());var a=Gde(this.elementShape,this.tensors,n);return 0===e.length?U5([],[0].concat(a)):e8((function(){var t=e.map((function(e){return W8(r.tensors[e],a)}));return Rte(t,0)}))}},{key:"concat",value:function(e,t){var n=this;if(e&&e!==this.elementDtype)throw new Error("TensorList dtype is ".concat(this.elementDtype," but concat requested dtype ").concat(e));Vde(this.elementShape,t,"TensorList shape mismatch: ");var r=Gde(this.elementShape,this.tensors,t);return 0===this.size()?U5([],[0].concat(r)):e8((function(){var e=n.tensors.map((function(e){return W8(e,r)}));return G8(e,0)}))}}]),e}();function Kde(e,t,n){var r=e.dtype;if(e.shape.length<1)throw new Error("Tensor must be at least a vector, but saw shape: ".concat(e.shape));if(e.dtype!==n)throw new Error("Invalid data types; op elements ".concat(e.dtype,", but list elements ").concat(n));Vde(e.shape.slice(1),t,"TensorList shape mismatch: ");var a=Yte(e);return new qde(a,t,r)}function Xde(e,t,n,r){return new qde([],e,t,r)}function Yde(e,t,n,r){if(t.length!==e.shape[0])throw new Error("Expected len(indices) == tensor.shape[0], but saw: ".concat(t.length," vs. ").concat(e.shape[0]));var a=Math.max.apply(Math,T(t));if(null!=r&&-1!==r&&a>=r)throw new Error("Max index must be < array size (".concat(a," vs. ").concat(r,")"));var i=new qde([],n,e.dtype,r),o=Yte(e,0);return t.forEach((function(e,t){i.setItem(e,o[t])})),i}function Jde(e,t,n){var r=0,a=t.map((function(e){return r+=e}));if(r!==e.shape[0])throw new Error("Expected sum of lengths to be equal to\n tensor.shape[0], but sum of lengths is\n ".concat(r,", and tensor's shape is: ").concat(e.shape));for(var i=jde(e.shape.slice(1),n),o=0===r?0:e.size/r,s=e8((function(){var n=[];e=W8(e,[1,r,o]);for(var s=0;s<t.length;++s){var u=[0,0===s?0:a[s-1],0],c=[1,t[s],o];n[s]=W8(q8(e,u,c),i)}return e.dispose(),n})),u=new qde([],n,e.dtype,t.length),c=0;c<s.length;c++)u.setItem(c,s[c]);return u}var Zde=function(){var e=c(o().mark((function e(t,n,r){var a,i,s,u,c,l,h,p,f,d,v,m,g,y,b,x,k,w,I,N,S,T,E,C,A,R,_,O,F,D,M,L,z,P,B,W,V,U,G,j,H,q,K,X,Y,J,Z,Q,$,ee,te,ne,re,ae,ie,oe,se,ue,ce,le,he,pe,fe,de,ve,me,ge,ye,be,xe,ke,we,Ie,Ne,Se,Te,Ee,Ce,Ae,Re,_e,Oe,Fe,De,Me,Le,ze,Pe,Be,We,Ve,Ue,Ge,je,He,qe,Ke,Xe,Ye,Je,Ze,Qe,$e,et,tt,nt,rt,at,it,ot;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t.op,e.next="If"===e.t0||"StatelessIf"===e.t0?3:"While"===e.t0||"StatelessWhile"===e.t0?15:"LoopCond"===e.t0?33:"Switch"===e.t0?35:"Merge"===e.t0?46:"Enter"===e.t0?51:"Exit"===e.t0?55:"NextIteration"===e.t0?58:"TensorArrayV3"===e.t0?61:"TensorArrayWriteV3"===e.t0?71:"TensorArrayReadV3"===e.t0?77:"TensorArrayGatherV3"===e.t0?81:"TensorArrayScatterV3"===e.t0?86:"TensorArrayConcatV3"===e.t0?92:"TensorArraySplitV3"===e.t0?96:"TensorArraySizeV3"===e.t0?102:"TensorArrayCloseV3"===e.t0?105:"TensorListSetItem"===e.t0?109:"TensorListGetItem"===e.t0?115:"TensorListScatterV2"===e.t0||"TensorListScatter"===e.t0?121:"TensorListReserve"===e.t0||"EmptyTensorList"===e.t0?128:"TensorListGather"===e.t0?136:"TensorListStack"===e.t0?142:"TensorListFromTensor"===e.t0?148:"TensorListConcat"===e.t0||"TensorListConcatV2"===e.t0?154:"TensorListPushBack"===e.t0?159:"TensorListPopBack"===e.t0?164:"TensorListSplit"===e.t0?169:"TensorListLength"===e.t0?175:"TensorListResize"===e.t0?178:184;break;case 3:return a=Yfe("thenBranch",t,n,r),i=Yfe("elseBranch",t,n,r),s=Yfe("cond",t,n,r),u=Yfe("args",t,n,r),e.next=9,s.data();case 9:if(!e.sent[0]){e.next=14;break}return e.abrupt("return",r.functionMap[a].executeFunctionAsync(u,r.tensorArrayMap,r.tensorListMap));case 14:return e.abrupt("return",r.functionMap[i].executeFunctionAsync(u,r.tensorArrayMap,r.tensorListMap));case 15:return c=Yfe("body",t,n,r),l=Yfe("cond",t,n,r),h=Yfe("args",t,n,r),e.next=20,r.functionMap[l].executeFunctionAsync(h,r.tensorArrayMap,r.tensorListMap);case 20:return p=e.sent,f=h.map((function(e){return e.id})),e.next=24,p[0].data();case 24:d=e.sent,p.forEach((function(e){e.kept||-1!==f.indexOf(e.id)||e.dispose()})),v=h,m=o().mark((function e(){var t,n,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=v,e.next=3,r.functionMap[c].executeFunctionAsync(v,r.tensorArrayMap,r.tensorListMap);case 3:return v=e.sent,n=v.map((function(e){return e.id})),t.forEach((function(e){e.kept||-1!==f.indexOf(e.id)||-1!==n.indexOf(e.id)||e.dispose()})),e.next=8,r.functionMap[l].executeFunctionAsync(v,r.tensorArrayMap,r.tensorListMap);case 8:return a=e.sent,e.next=11,a[0].data();case 11:d=e.sent,a.forEach((function(e){e.kept||-1!==f.indexOf(e.id)||-1!==n.indexOf(e.id)||e.dispose()}));case 13:case"end":return e.stop()}}),e)}));case 28:if(!d[0]){e.next=32;break}return e.delegateYield(m(),"t1",30);case 30:e.next=28;break;case 32:return e.abrupt("return",v);case 33:return g=Yfe("pred",t,n,r),e.abrupt("return",[nde(g)]);case 35:return y=Yfe("pred",t,n,r),(b=Yfe("data",t,n,r)).kept||(b=nde(b)),e.next=40,y.data();case 40:if(!e.sent[0]){e.next=44;break}e.t2=[void 0,b],e.next=45;break;case 44:e.t2=[b,void 0];case 45:return e.abrupt("return",e.t2);case 46:if(x=t.inputNames.find((function(e){return void 0!==Jfe(e,n,r)})),!x){e.next=50;break}return k=Jfe(x,n,r),e.abrupt("return",[nde(k)]);case 50:return e.abrupt("return",void 0);case 51:return w=Yfe("frameName",t,n,r),I=Yfe("tensor",t,n,r),r.enterFrame(w),e.abrupt("return",[nde(I)]);case 55:return N=Yfe("tensor",t,n,r),r.exitFrame(),e.abrupt("return",[nde(N)]);case 58:return S=Yfe("tensor",t,n,r),r.nextIteration(),e.abrupt("return",[nde(S)]);case 61:return T=Yfe("size",t,n,r),E=Yfe("dtype",t,n,r),C=Yfe("elementShape",t,n,r),A=Yfe("dynamicSize",t,n,r),R=Yfe("clearAfterRead",t,n,r),_=Yfe("identicalElementShapes",t,n,r),O=Yfe("name",t,n,r),F=new Hde(O,E,T,C,_,A,R),r.addTensorArray(F),e.abrupt("return",[F.idTensor,Z7(1)]);case 71:return D=Yfe("tensorArrayId",t,n,r),M=Yfe("index",t,n,r),L=Yfe("tensor",t,n,r),(z=r.getTensorArray(D.id)).write(M,L),e.abrupt("return",[z.idTensor]);case 77:return P=Yfe("tensorArrayId",t,n,r),B=Yfe("index",t,n,r),W=r.getTensorArray(P.id),e.abrupt("return",[W.read(B)]);case 81:return V=Yfe("tensorArrayId",t,n,r),U=Yfe("indices",t,n,r),G=Yfe("dtype",t,n,r),j=r.getTensorArray(V.id),e.abrupt("return",[j.gather(U,G)]);case 86:return H=Yfe("tensorArrayId",t,n,r),q=Yfe("indices",t,n,r),K=Yfe("tensor",t,n,r),(X=r.getTensorArray(H.id)).scatter(q,K),e.abrupt("return",[X.idTensor]);case 92:return Y=Yfe("tensorArrayId",t,n,r),J=r.getTensorArray(Y.id),Z=Yfe("dtype",t,n,r),e.abrupt("return",[J.concat(Z)]);case 96:return Q=Yfe("tensorArrayId",t,n,r),$=Yfe("tensor",t,n,r),ee=Yfe("lengths",t,n,r),(te=r.getTensorArray(Q.id)).split(ee,$),e.abrupt("return",[te.idTensor]);case 102:return ne=Yfe("tensorArrayId",t,n,r),re=r.getTensorArray(ne.id),e.abrupt("return",[Z7(re.size(),"int32")]);case 105:return ae=Yfe("tensorArrayId",t,n,r),(ie=r.getTensorArray(ae.id)).clearAndClose(),e.abrupt("return",[ie.idTensor]);case 109:return oe=Yfe("tensorListId",t,n,r),se=Yfe("index",t,n,r),ue=Yfe("tensor",t,n,r),(ce=r.getTensorList(oe.id)).setItem(se,ue),e.abrupt("return",[ce.idTensor]);case 115:return le=Yfe("tensorListId",t,n,r),he=Yfe("index",t,n,r),pe=Yfe("elementShape",t,n,r),fe=Yfe("elementDType",t,n,r),de=r.getTensorList(le.id),e.abrupt("return",[de.getItem(he,pe,fe)]);case 121:return ve=Yfe("indices",t,n,r),me=Yfe("tensor",t,n,r),ge=Yfe("elementShape",t,n,r),ye=Yfe("numElements",t,n,r),be=Yde(me,ve,ge,ye),r.addTensorList(be),e.abrupt("return",[be.idTensor]);case 128:return xe=Yfe("elementShape",t,n,r),ke=Yfe("elementDType",t,n,r),we="TensorListReserve"===t.op?"numElements":"maxNumElements",Ie=Yfe(we,t,n,r),Ne="TensorListReserve"===t.op?-1:Ie,Se=Xde(xe,ke,0,Ne),r.addTensorList(Se),e.abrupt("return",[Se.idTensor]);case 136:return Te=Yfe("tensorListId",t,n,r),Ee=Yfe("indices",t,n,r),Ce=Yfe("elementShape",t,n,r),Ae=Yfe("elementDType",t,n,r),Re=r.getTensorList(Te.id),e.abrupt("return",[Re.gather(Ee,Ae,Ce)]);case 142:return _e=Yfe("tensorListId",t,n,r),Oe=Yfe("elementShape",t,n,r),Fe=Yfe("elementDType",t,n,r),De=Yfe("numElements",t,n,r),Me=r.getTensorList(_e.id),e.abrupt("return",[Me.stack(Oe,Fe,De)]);case 148:return Le=Yfe("tensor",t,n,r),ze=Yfe("elementShape",t,n,r),Pe=Yfe("elementDType",t,n,r),Be=Kde(Le,ze,Pe),r.addTensorList(Be),e.abrupt("return",[Be.idTensor]);case 154:return We=Yfe("tensorListId",t,n,r),Ve=r.getTensorList(We.id),Ue=Yfe("dtype",t,n,r),Ge=Yfe("elementShape",t,n,r),e.abrupt("return",[Ve.concat(Ue,Ge)]);case 159:return je=Yfe("tensorListId",t,n,r),He=Yfe("tensor",t,n,r),(qe=r.getTensorList(je.id)).pushBack(He),e.abrupt("return",[qe.idTensor]);case 164:return Ke=Yfe("tensorListId",t,n,r),Xe=Yfe("elementShape",t,n,r),Ye=Yfe("elementDType",t,n,r),Je=r.getTensorList(Ke.id),e.abrupt("return",[Je.popBack(Xe,Ye)]);case 169:return Ze=Yfe("tensor",t,n,r),Qe=Yfe("elementShape",t,n,r),$e=Yfe("lengths",t,n,r),et=Jde(Ze,$e,Qe),r.addTensorList(et),e.abrupt("return",[et.idTensor]);case 175:return tt=Yfe("tensorListId",t,n,r),nt=r.getTensorList(tt.id),e.abrupt("return",[Z7(nt.size(),"int32")]);case 178:return rt=Yfe("tensorListId",t,n,r),at=Yfe("size",t,n,r),it=r.getTensorList(rt.id),ot=it.resize(at),r.addTensorList(ot),e.abrupt("return",[ot.idTensor]);case 184:throw TypeError("Node type ".concat(t.op," is not implemented"));case 185:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}();function Qde(e,t,n){var r=S(Yfe("fusedOps",e,t,n),2),a=r[0],i=r[1],o="biasadd"===a,s=!o,u="prelu"===i,c="fusedbatchnorm"===a,l=Yfe("numArgs",e,t,n);if(o){if(u&&2!==l)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!u&&o&&1!==l)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias.")}if(c)throw new Error("FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported");var h=Yfe("strides",e,t,n),p=tde(e,t,n),f=Yfe("dataFormat",e,t,n).toUpperCase(),d=Yfe("dilations",e,t,n),v=S(Yfe("args",e,t,n),2),m=v[0],g=v[1];return s&&(g=m,m=void 0),{stride:h,pad:p,dataFormat:f,dilations:d,biasArg:m,preluArg:g,activationFunc:i,leakyreluAlpha:Yfe("leakyreluAlpha",e,t,n)}}var $de=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pde;switch(e.op){case"Conv1D":var a=Yfe("stride",e,t,n),i=Yfe("pad",e,t,n),o=Yfe("dataFormat",e,t,n).toUpperCase(),s=Yfe("dilation",e,t,n);return[r.conv1d(Yfe("x",e,t,n),Yfe("filter",e,t,n),a,i,o,s)];case"Conv2D":var u=Yfe("strides",e,t,n),c=tde(e,t,n),l=Yfe("dataFormat",e,t,n).toUpperCase(),h=Yfe("dilations",e,t,n);return[r.conv2d(Yfe("x",e,t,n),Yfe("filter",e,t,n),[u[1],u[2]],c,l,[h[1],h[2]])];case"_FusedConv2D":var p=Qde(e,t,n),f=p.stride,d=p.pad,v=p.dataFormat,m=p.dilations,g=p.biasArg,y=p.preluArg,b=p.activationFunc,x=p.leakyreluAlpha;return[r.fused.conv2d({x:Yfe("x",e,t,n),filter:Yfe("filter",e,t,n),strides:[f[1],f[2]],pad:d,dataFormat:v,dilations:[m[1],m[2]],bias:g,activation:b,preluActivationWeights:y,leakyreluAlpha:x})];case"FusedDepthwiseConv2dNative":var k=Qde(e,t,n),w=k.stride,I=k.pad,N=k.dataFormat,S=k.dilations,T=k.biasArg,E=k.preluArg,C=k.activationFunc,A=k.leakyreluAlpha;return[r.fused.depthwiseConv2d({x:Yfe("x",e,t,n),filter:Yfe("filter",e,t,n),strides:[w[1],w[2]],pad:I,dataFormat:N,dilations:[S[1],S[2]],bias:T,activation:C,preluActivationWeights:E,leakyreluAlpha:A})];case"Conv2DBackpropInput":case"Conv2dTranspose":var R=Yfe("outputShape",e,t,n),_=Yfe("strides",e,t,n),O=tde(e,t,n);return[r.conv2dTranspose(Yfe("x",e,t,n),Yfe("filter",e,t,n),R,[_[1],_[2]],O)];case"DepthwiseConv2dNative":case"DepthwiseConv2d":var F=Yfe("strides",e,t,n),D=tde(e,t,n),M=Yfe("dilations",e,t,n),L=Yfe("dataFormat",e,t,n).toUpperCase();return[r.depthwiseConv2d(Yfe("input",e,t,n),Yfe("filter",e,t,n),[F[1],F[2]],D,L,[M[1],M[2]])];case"Conv3D":var z=Yfe("strides",e,t,n),P=Yfe("pad",e,t,n),B=Yfe("dataFormat",e,t,n).toUpperCase(),W=Yfe("dilations",e,t,n);return[r.conv3d(Yfe("x",e,t,n),Yfe("filter",e,t,n),[z[1],z[2],z[3]],P,B,[W[1],W[2],W[3]])];case"AvgPool":var V=Yfe("strides",e,t,n),U=Yfe("pad",e,t,n),G=Yfe("kernelSize",e,t,n);return[r.avgPool(Yfe("x",e,t,n),[G[1],G[2]],[V[1],V[2]],U)];case"MaxPool":var j=Yfe("strides",e,t,n),H=Yfe("pad",e,t,n),q=Yfe("kernelSize",e,t,n);return[r.maxPool(Yfe("x",e,t,n),[q[1],q[2]],[j[1],j[2]],H)];case"MaxPoolWithArgmax":var K=Yfe("strides",e,t,n),X=Yfe("pad",e,t,n),Y=Yfe("kernelSize",e,t,n),J=Yfe("includeBatchInIndex",e,t,n),Z=r.maxPoolWithArgmax(Yfe("x",e,t,n),[Y[1],Y[2]],[K[1],K[2]],X,J),Q=Z.result,$=Z.indexes;return[Q,$];case"AvgPool3D":var ee=Yfe("strides",e,t,n),te=Yfe("pad",e,t,n),ne=Yfe("kernelSize",e,t,n);return[r.avgPool3d(Yfe("x",e,t,n),[ne[1],ne[2],ne[3]],[ee[1],ee[2],ee[3]],te)];case"MaxPool3D":var re=Yfe("strides",e,t,n),ae=Yfe("pad",e,t,n),ie=Yfe("kernelSize",e,t,n);return[r.maxPool3d(Yfe("x",e,t,n),[ie[1],ie[2],ie[3]],[re[1],re[2],re[3]],ae)];case"Dilation2D":var oe=Yfe("strides",e,t,n),se=Yfe("pad",e,t,n),ue=Yfe("dilations",e,t,n),ce=oe[1],le=oe[2],he=ue[1],pe=ue[2];return[r.dilation2d(Yfe("x",e,t,n),Yfe("filter",e,t,n),[ce,le],se,[he,pe],"NHWC")];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}},eve=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pde;switch(e.op){case"Fill":var a=Yfe("shape",e,t,n),i=Yfe("dtype",e,t,n),o=Yfe("value",e,t,n);return[r.fill(a,o,i)];case"LinSpace":var s=Yfe("start",e,t,n),u=Yfe("stop",e,t,n),c=Yfe("num",e,t,n);return[r.linspace(s,u,c)];case"Multinomial":var l=Yfe("logits",e,t,n),h=Yfe("numSamples",e,t,n),p=Yfe("seed",e,t,n);return[r.multinomial(l,h,p)];case"OneHot":var f=Yfe("indices",e,t,n),d=Yfe("depth",e,t,n),v=Yfe("onValue",e,t,n),m=Yfe("offValue",e,t,n),g=Yfe("dtype",e,t,n);return[r.oneHot(f,d,v,m,g)];case"Ones":return[r.ones(Yfe("shape",e,t,n),Yfe("dtype",e,t,n))];case"OnesLike":return[r.onesLike(Yfe("x",e,t,n))];case"RandomStandardNormal":return[r.randomStandardNormal(Yfe("shape",e,t,n),Yfe("dtype",e,t,n),Yfe("seed",e,t,n))];case"RandomUniform":return[r.randomUniform(Yfe("shape",e,t,n),Yfe("minval",e,t,n),Yfe("maxval",e,t,n),Yfe("dtype",e,t,n))];case"RandomUniformInt":return[r.randomUniformInt(Yfe("shape",e,t,n),Yfe("minval",e,t,n),Yfe("maxval",e,t,n),Yfe("seed",e,t,n))];case"Range":var y=Yfe("start",e,t,n),b=Yfe("stop",e,t,n),x=Yfe("step",e,t,n);return[r.range(y,b,x,Yfe("dtype",e,t,n))];case"TruncatedNormal":var k=Yfe("shape",e,t,n),w=Yfe("mean",e,t,n),I=Yfe("stdDev",e,t,n),N=Yfe("seed",e,t,n);return[r.truncatedNormal(k,w,I,Yfe("dtype",e,t,n),N)];case"Zeros":return[r.zeros(Yfe("shape",e,t,n),Yfe("dtype",e,t,n))];case"ZerosLike":return[r.zerosLike(Yfe("x",e,t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};function tve(e,t,n){return{boxes:Yfe("boxes",e,t,n),scores:Yfe("scores",e,t,n),maxOutputSize:Yfe("maxOutputSize",e,t,n),iouThreshold:Yfe("iouThreshold",e,t,n),scoreThreshold:Yfe("scoreThreshold",e,t,n),softNmsSigma:Yfe("softNmsSigma",e,t,n)}}var nve=function(){var e=c(o().mark((function e(t,n,r,a){var i,s,u,c,l,h,p,f,d,v,m,g,y,b,x,k,w,I,N,S,T,E,C,A,R,_=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=_.length>4&&void 0!==_[4]?_[4]:Pde,e.t0=t.op,e.next="NonMaxSuppressionV5"===e.t0?4:"NonMaxSuppressionV4"===e.t0?9:"NonMaxSuppressionV3"===e.t0||"NonMaxSuppressionV2"===e.t0?15:"Where"===e.t0?20:"ListDiff"===e.t0?27:28;break;case 4:return s=tve(t,n,r),u=s.boxes,c=s.scores,l=s.maxOutputSize,h=s.iouThreshold,p=s.scoreThreshold,f=s.softNmsSigma,e.next=7,i.image.nonMaxSuppressionWithScoreAsync(u,c,l,h,p,f);case 7:return d=e.sent,e.abrupt("return",[d.selectedIndices,d.selectedScores]);case 9:return v=tve(t,n,r),m=v.boxes,g=v.scores,y=v.maxOutputSize,b=v.iouThreshold,x=v.scoreThreshold,k=Yfe("padToMaxOutputSize",t,n,r),e.next=13,i.image.nonMaxSuppressionPaddedAsync(m,g,y,b,x,k);case 13:return w=e.sent,e.abrupt("return",[w.selectedIndices,w.validOutputs]);case 15:return I=tve(t,n,r),N=I.boxes,S=I.scores,T=I.maxOutputSize,E=I.iouThreshold,C=I.scoreThreshold,e.next=18,i.image.nonMaxSuppressionAsync(N,S,T,E,C);case 18:return e.t1=e.sent,e.abrupt("return",[e.t1]);case 20:return A=i.cast(Yfe("condition",t,n,r),"bool"),e.next=23,i.whereAsync(A);case 23:return e.t2=e.sent,R=[e.t2],A.dispose(),e.abrupt("return",R);case 27:return e.abrupt("return",i.setdiff1dAsync(Yfe("x",t,n,r),Yfe("y",t,n,r)));case 28:throw TypeError("Node type ".concat(t.op," is not implemented"));case 29:case"end":return e.stop()}}),e)})));return function(t,n,r,a){return e.apply(this,arguments)}}(),rve=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pde;switch(e.op){case"LowerBound":var a=Yfe("sortedSequence",e,t,n),i=Yfe("values",e,t,n);return[r.lowerBound(a,i)];case"TopKV2":var o=Yfe("x",e,t,n),s=Yfe("k",e,t,n),u=Yfe("sorted",e,t,n),c=r.topk(o,s,u);return[c.values,c.indices];case"UpperBound":var l=Yfe("sortedSequence",e,t,n),h=Yfe("values",e,t,n);return[r.upperBound(l,h)];case"Unique":var p=Yfe("x",e,t,n),f=r.unique(p);return[f.values,f.indices];case"UniqueV2":var d=Yfe("x",e,t,n),v=Yfe("axis",e,t,n),m=r.unique(d,v);return[m.values,m.indices];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}},ave=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pde;switch(e.op){case"Const":return t[e.name];case"PlaceholderWithDefault":var a=Yfe("default",e,t,n);return[Jfe(e.name,t,n)||a];case"Placeholder":return[Jfe(e.name,t,n)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":var i=Yfe("x",e,t,n);return[nde(i)];case"IdentityN":return Yfe("x",e,t,n).map((function(e){return nde(e)}));case"Snapshot":var o=Yfe("x",e,t,n);return[nde(o)];case"Shape":return[r.tensor1d(Yfe("x",e,t,n).shape,"int32")];case"ShapeN":return Yfe("x",e,t,n).map((function(e){return r.tensor1d(e.shape)}));case"Size":return[r.scalar(Yfe("x",e,t,n).size,"int32")];case"Rank":return[r.scalar(Yfe("x",e,t,n).rank,"int32")];case"NoOp":return[r.scalar(1)];case"Print":var s=Yfe("x",e,t,n),u=Yfe("data",e,t,n),c=Yfe("message",e,t,n),l=Yfe("summarize",e,t,n);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(c);for(var h=0;h<u.length;h++)console.log(Array.prototype.slice.call(u[h].dataSync()).slice(0,l));return[s];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}},ive=function(){function e(t,n){l(this,e),this.keyDType=t,this.valueDType=n,this.handle=Z7(0),this.tensorMap=new Map,n8(this.handle)}var t,n;return p(e,[{key:"id",get:function(){return this.handle.id}},{key:"clearAndClose",value:function(){this.tensorMap.forEach((function(e){return e.dispose()})),this.tensorMap.clear(),this.handle.dispose()}},{key:"size",value:function(){return this.tensorMap.size}},{key:"tensorSize",value:function(){return Z7(this.size(),"int32")}},{key:"import",value:(n=c(o().mark((function e(t,n){var r,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.checkKeyAndValueTensor(t,n),e.next=3,t.data();case 3:return r=e.sent,this.tensorMap.forEach((function(e){return e.dispose()})),this.tensorMap.clear(),e.abrupt("return",e8((function(){var e=Yte(n),t=r.length,i=e.length;F$(t===i,(function(){return"The number of elements doesn't match, keys has "+"".concat(t," elements, the values has ").concat(i," ")+"elements."}));for(var o=0;o<t;o++){var s=r[o],u=e[o];n8(u),a.tensorMap.set(s,u)}return a.handle})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"find",value:(t=c(o().mark((function e(t,n){var r,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.checkKeyAndValueTensor(t,n),e.next=3,t.data();case 3:return r=e.sent,e.abrupt("return",e8((function(){for(var e=[],t=0;t<r.length;t++){var i=r[t],o=a.findWithDefault(i,n);e.push(o)}return Rte(e)})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"findWithDefault",value:function(e,t){var n=this.tensorMap.get(e);return null!=n?n:t}},{key:"checkKeyAndValueTensor",value:function(e,t){if(e.dtype!==this.keyDType)throw new Error("Expect key dtype ".concat(this.keyDType,", but got ")+"".concat(e.dtype));if(t.dtype!==this.valueDType)throw new Error("Expect value dtype ".concat(this.valueDType,", but got ")+"".concat(t.dtype))}}]),e}(),ove=function(){var e=c(o().mark((function e(t,n,r,a){var i,s,u,c,l,h,p,f,d,v,m,g,y,b;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t.op,e.next="HashTable"===e.t0||"HashTableV2"===e.t0?3:"InitializeTable"===e.t0||"InitializeTableV2"===e.t0||"LookupTableImport"===e.t0||"LookupTableImportV2"===e.t0?13:"LookupTableFind"===e.t0||"LookupTableFindV2"===e.t0?21:"LookupTableSize"===e.t0||"LookupTableSizeV2"===e.t0?29:32;break;case 3:if(null==(i=a.getHashTableHandleByName(t.name))){e.next=8;break}return e.abrupt("return",[i]);case 8:return s=Yfe("keyDType",t,n,r),u=Yfe("valueDType",t,n,r),c=new ive(s,u),a.addHashTable(t.name,c),e.abrupt("return",[c.handle]);case 13:return l=Yfe("tableHandle",t,n,r,a),h=Yfe("keys",t,n,r),p=Yfe("values",t,n,r),f=a.getHashTableById(l.id),e.next=19,f.import(h,p);case 19:return e.t1=e.sent,e.abrupt("return",[e.t1]);case 21:return d=Yfe("tableHandle",t,n,r,a),v=Yfe("keys",t,n,r),m=Yfe("defaultValue",t,n,r),g=a.getHashTableById(d.id),e.next=27,g.find(v,m);case 27:return e.t2=e.sent,e.abrupt("return",[e.t2]);case 29:return y=Yfe("tableHandle",t,n,r,a),b=a.getHashTableById(y.id),e.abrupt("return",[b.tensorSize()]);case 32:throw TypeError("Node type ".concat(t.op," is not implemented"));case 33:case"end":return e.stop()}}),e)})));return function(t,n,r,a){return e.apply(this,arguments)}}(),sve=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pde;switch(e.op){case"ResizeBilinear":var a=Yfe("images",e,t,n),i=Yfe("size",e,t,n),o=Yfe("alignCorners",e,t,n),s=Yfe("halfPixelCenters",e,t,n);return[r.image.resizeBilinear(a,[i[0],i[1]],o,s)];case"ResizeNearestNeighbor":var u=Yfe("images",e,t,n),c=Yfe("size",e,t,n),l=Yfe("alignCorners",e,t,n),h=Yfe("halfPixelCenters",e,t,n);return[r.image.resizeNearestNeighbor(u,[c[0],c[1]],l,h)];case"CropAndResize":var p=Yfe("image",e,t,n),f=Yfe("boxes",e,t,n),d=Yfe("boxInd",e,t,n),v=Yfe("cropSize",e,t,n),m=Yfe("method",e,t,n),g=Yfe("extrapolationValue",e,t,n);return[r.image.cropAndResize(p,f,d,v,m,g)];case"ImageProjectiveTransformV3":var y=Yfe("images",e,t,n),b=Yfe("transforms",e,t,n),x=Yfe("outputShape",e,t,n),k=Yfe("fillValue",e,t,n),w=Yfe("interpolation",e,t,n),I=Yfe("fillMode",e,t,n);return[r.image.transform(y,b,w.toLowerCase(),I.toLowerCase(),k,x)];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}},uve=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pde;switch(e.op){case"Equal":return[r.equal(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"NotEqual":return[r.notEqual(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"Greater":return[r.greater(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"GreaterEqual":return[r.greaterEqual(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"Less":return[r.less(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"LessEqual":return[r.lessEqual(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"LogicalAnd":return[r.logicalAnd(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"LogicalNot":return[r.logicalNot(Yfe("a",e,t,n))];case"LogicalOr":return[r.logicalOr(Yfe("a",e,t,n),Yfe("b",e,t,n))];case"Select":case"SelectV2":return[r.where(Yfe("condition",e,t,n),Yfe("a",e,t,n),Yfe("b",e,t,n))];case"BitwiseAnd":return[r.bitwiseAnd(Yfe("a",e,t,n),Yfe("b",e,t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}},cve=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pde;switch(e.op){case"BatchMatMul":case"BatchMatMulV2":case"MatMul":return[r.matMul(Yfe("a",e,t,n),Yfe("b",e,t,n),Yfe("transposeA",e,t,n),Yfe("transposeB",e,t,n))];case"Einsum":return[r.einsum.apply(r,[Yfe("equation",e,t,n)].concat(T(Yfe("tensors",e,t,n))))];case"Transpose":return[r.transpose(Yfe("x",e,t,n),Yfe("perm",e,t,n))];case"_FusedMatMul":var a=Yfe("fusedOps",e,t,n),i=S(a,2),o=i[0],s=i[1],u="biasadd"===o,c="prelu"===s,l=Yfe("numArgs",e,t,n),h=Yfe("leakyreluAlpha",e,t,n);if(u){if(c&&2!==l)throw new Error("Fused MatMul with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!c&&1!==l)throw new Error("Fused MatMul with BiasAdd must have one extra argument: bias.")}var p=Yfe("args",e,t,n),f=S(p,2),d=f[0],v=f[1];return[r.fused.matMul({a:Yfe("a",e,t,n),b:Yfe("b",e,t,n),transposeA:Yfe("transposeA",e,t,n),transposeB:Yfe("transposeB",e,t,n),bias:d,activation:s,preluActivationWeights:v,leakyreluAlpha:h})];case"MatrixBandPart":return[r.linalg.bandPart(Yfe("a",e,t,n),Yfe("numLower",e,t,n),Yfe("numUpper",e,t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}},lve=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pde;switch(e.op){case"EuclideanNorm":return[r.euclideanNorm(Yfe("x",e,t,n),Yfe("axis",e,t,n),Yfe("keepDims",e,t,n))];case"FusedBatchNorm":case"FusedBatchNormV2":case"FusedBatchNormV3":return[r.batchNorm(Yfe("x",e,t,n),Yfe("mean",e,t,n),Yfe("variance",e,t,n),Yfe("offset",e,t,n),Yfe("scale",e,t,n),Yfe("epsilon",e,t,n))];case"LRN":return[r.localResponseNormalization(Yfe("x",e,t,n),Yfe("radius",e,t,n),Yfe("bias",e,t,n),Yfe("alpha",e,t,n),Yfe("beta",e,t,n))];case"Softmax":return[r.softmax(Yfe("x",e,t,n))];case"LogSoftmax":return[r.logSoftmax(Yfe("x",e,t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}},hve=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pde;switch(e.op){case"RaggedGather":var a=r.raggedGather(Yfe("paramsNestedSplits",e,t,n),Yfe("paramsDenseValues",e,t,n),Yfe("indices",e,t,n),Yfe("outputRaggedRank",e,t,n)),i=a.outputNestedSplits,o=a.outputDenseValues;return i.concat(o);case"RaggedRange":var s=r.raggedRange(Yfe("starts",e,t,n),Yfe("limits",e,t,n),Yfe("splits",e,t,n)),u=s.rtNestedSplits,c=s.rtDenseValues;return[u,c];case"RaggedTensorToTensor":return[r.raggedTensorToTensor(Yfe("shape",e,t,n),Yfe("values",e,t,n),Yfe("defaultValue",e,t,n),Yfe("rowPartitionTensors",e,t,n),Yfe("rowPartitionTypes",e,t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}},pve=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pde;switch(e.op){case"Max":var a=Yfe("axis",e,t,n),i=Yfe("keepDims",e,t,n);return[r.max(Yfe("x",e,t,n),a,i)];case"Mean":var o=Yfe("axis",e,t,n),s=Yfe("keepDims",e,t,n);return[r.mean(Yfe("x",e,t,n),o,s)];case"Min":var u=Yfe("axis",e,t,n),c=Yfe("keepDims",e,t,n);return[r.min(Yfe("x",e,t,n),u,c)];case"Sum":var l=Yfe("axis",e,t,n),h=Yfe("keepDims",e,t,n);return[r.sum(Yfe("x",e,t,n),l,h)];case"All":var p=Yfe("axis",e,t,n),f=Yfe("keepDims",e,t,n);return[r.all(Yfe("x",e,t,n),p,f)];case"Any":var d=Yfe("axis",e,t,n),v=Yfe("keepDims",e,t,n);return[r.any(Yfe("x",e,t,n),d,v)];case"ArgMax":var m=Yfe("axis",e,t,n);return[r.argMax(Yfe("x",e,t,n),m)];case"ArgMin":var g=Yfe("axis",e,t,n);return[r.argMin(Yfe("x",e,t,n),g)];case"Prod":var y=Yfe("axis",e,t,n),b=Yfe("keepDims",e,t,n);return[r.prod(Yfe("x",e,t,n),y,b)];case"Cumprod":var x=Yfe("axis",e,t,n),k=Yfe("exclusive",e,t,n),w=Yfe("reverse",e,t,n);return[r.cumprod(Yfe("x",e,t,n),x,k,w)];case"Cumsum":var I=Yfe("axis",e,t,n),N=Yfe("exclusive",e,t,n),S=Yfe("reverse",e,t,n);return[r.cumsum(Yfe("x",e,t,n),I,N,S)];case"Bincount":var T=Yfe("x",e,t,n),E=Yfe("weights",e,t,n),C=Yfe("size",e,t,n);return[r.bincount(T,E,C)];case"DenseBincount":var A=Yfe("x",e,t,n),R=Yfe("weights",e,t,n),_=Yfe("size",e,t,n),O=Yfe("binaryOutput",e,t,n);return[r.denseBincount(A,R,_,O)];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}},fve=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pde;switch(e.op){case"ConcatV2":case"Concat":var a=Yfe("n",e,t,n),i=Yfe("axis",e,t,n),o=Yfe("tensors",e,t,n);return o=o.slice(0,a),[r.concat(o,i)];case"Gather":var s=Yfe("x",e,t,n),u=Yfe("indices",e,t,n);return[r.gather(s,r.cast(u,"int32"),0)];case"GatherV2":var c=Yfe("axis",e,t,n),l=Yfe("batchDims",e,t,n),h=Yfe("x",e,t,n),p=Yfe("indices",e,t,n);return[r.gather(h,r.cast(p,"int32"),c,l)];case"Reverse":for(var f=Yfe("dims",e,t,n),d=[],v=0;v<f.length;v++)f[v]&&d.push(v);var m=Yfe("x",e,t,n);return[r.reverse(m,d)];case"ReverseV2":var g=Yfe("axis",e,t,n),y=Yfe("x",e,t,n);return[r.reverse(y,g)];case"Slice":var b=Yfe("begin",e,t,n),x=Yfe("size",e,t,n);return[r.slice(Yfe("x",e,t,n),b,x)];case"StridedSlice":var k=Yfe("begin",e,t,n),w=Yfe("end",e,t,n),I=Yfe("strides",e,t,n),N=Yfe("beginMask",e,t,n),S=Yfe("endMask",e,t,n),T=Yfe("ellipsisMask",e,t,n),E=Yfe("newAxisMask",e,t,n),C=Yfe("shrinkAxisMask",e,t,n),A=Yfe("x",e,t,n);return[r.stridedSlice(A,k,w,I,N,S,T,E,C)];case"Pack":return e8((function(){var a=Yfe("axis",e,t,n),i=Yfe("tensors",e,t,n),o=i[0].shape,s=r.squeeze(i[0]).shape,u=i.map((function(e){var t=P$(e.shape,o);if(!t&&!P$(r.squeeze(e).shape,s))throw new Error("the input tensors shape does not match");return t?e:r.reshape(e,o)}));return[r.stack(u,a)]}));case"Unpack":var R=Yfe("axis",e,t,n),_=Yfe("tensor",e,t,n);return r.unstack(_,R);case"Tile":var O=Yfe("reps",e,t,n);return[r.tile(Yfe("x",e,t,n),O)];case"Split":case"SplitV":var F=Yfe("axis",e,t,n),D=Yfe("numOrSizeSplits",e,t,n),M=Yfe("x",e,t,n);return r.split(M,D,F);case"ScatterNd":var L=Yfe("indices",e,t,n),z=Yfe("values",e,t,n),P=Yfe("shape",e,t,n);return[r.scatterND(L,z,P)];case"GatherNd":var B=Yfe("x",e,t,n),W=Yfe("indices",e,t,n);return[r.gatherND(B,W)];case"SparseToDense":var V=Yfe("sparseIndices",e,t,n),U=Yfe("outputShape",e,t,n),G=Yfe("sparseValues",e,t,n),j=Yfe("defaultValue",e,t,n);return[r.sparseToDense(V,G,U,G.dtype===j.dtype?j:r.cast(j,G.dtype))];case"TensorScatterUpdate":var H=Yfe("indices",e,t,n),q=Yfe("values",e,t,n),K=Yfe("tensor",e,t,n);return[r.tensorScatterUpdate(K,H,q)];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}},dve=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pde;switch(e.op){case"SparseFillEmptyRows":var a=r.sparse.sparseFillEmptyRows(Yfe("indices",e,t,n),Yfe("values",e,t,n),Yfe("denseShape",e,t,n),Yfe("defaultValue",e,t,n)),i=a.outputIndices,o=a.outputValues,s=a.emptyRowIndicator,u=a.reverseIndexMap;return[i,o,s,u];case"SparseReshape":var c=r.sparse.sparseReshape(Yfe("inputIndices",e,t,n),Yfe("inputShape",e,t,n),Yfe("newShape",e,t,n)),l=c.outputIndices,h=c.outputShape;return[l,h];case"SparseSegmentMean":var p=r.sparse.sparseSegmentMean(Yfe("data",e,t,n),Yfe("indices",e,t,n),Yfe("segmentIds",e,t,n));return[p];case"SparseSegmentSum":var f=r.sparse.sparseSegmentSum(Yfe("data",e,t,n),Yfe("indices",e,t,n),Yfe("segmentIds",e,t,n));return[f];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}},vve=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pde;switch(e.op){case"FFT":return[r.fft(Yfe("x",e,t,n))];case"IFFT":return[r.ifft(Yfe("x",e,t,n))];case"RFFT":return[r.rfft(Yfe("x",e,t,n))];case"IRFFT":return[r.irfft(Yfe("x",e,t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}},mve=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pde;switch(e.op){case"StaticRegexReplace":return[r.string.staticRegexReplace(Yfe("input",e,t,n),Yfe("pattern",e,t,n),Yfe("rewrite",e,t,n),Yfe("replaceGlobal",e,t,n))];case"StringNGrams":var a=r.string.stringNGrams(Yfe("data",e,t,n),Yfe("dataSplits",e,t,n),Yfe("separator",e,t,n),Yfe("nGramWidths",e,t,n),Yfe("leftPad",e,t,n),Yfe("rightPad",e,t,n),Yfe("padWidth",e,t,n),Yfe("preserveShortSequences",e,t,n)),i=a.nGrams,o=a.nGramsSplits;return[i,o];case"StringSplit":var s=r.string.stringSplit(Yfe("input",e,t,n),Yfe("delimiter",e,t,n),Yfe("skipEmpty",e,t,n)),u=s.indices,c=s.values,l=s.shape;return[u,c,l];case"StringToHashBucketFast":var h=r.string.stringToHashBucketFast(Yfe("input",e,t,n),Yfe("numBuckets",e,t,n));return[h];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}},gve=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pde;switch(e.op){case"Cast":return[r.cast(Yfe("x",e,t,n),Yfe("dtype",e,t,n))];case"ExpandDims":var a=Yfe("axis",e,t,n);return[r.expandDims(Yfe("x",e,t,n),a)];case"Squeeze":var i=Yfe("axis",e,t,n);return[r.squeeze(Yfe("x",e,t,n),i)];case"Reshape":return[r.reshape(Yfe("x",e,t,n),Yfe("shape",e,t,n))];case"EnsureShape":return[r.ensureShape(Yfe("x",e,t,n),Yfe("shape",e,t,n))];case"MirrorPad":return[r.mirrorPad(Yfe("x",e,t,n),Yfe("padding",e,t,n),Yfe("mode",e,t,n))];case"PadV2":case"Pad":return[r.pad(Yfe("x",e,t,n),Yfe("padding",e,t,n),Yfe("constantValue",e,t,n))];case"SpaceToBatchND":var o=Yfe("blockShape",e,t,n),s=Yfe("paddings",e,t,n);return[r.spaceToBatchND(Yfe("x",e,t,n),o,s)];case"BatchToSpaceND":var u=Yfe("blockShape",e,t,n),c=Yfe("crops",e,t,n);return[r.batchToSpaceND(Yfe("x",e,t,n),u,c)];case"DepthToSpace":var l=Yfe("blockSize",e,t,n),h=Yfe("dataFormat",e,t,n).toUpperCase();return[r.depthToSpace(Yfe("x",e,t,n),l,h)];case"BroadcastTo":return[r.broadcastTo(Yfe("x",e,t,n),Yfe("shape",e,t,n))];case"BroadcastArgs":return[r.broadcastArgs(Yfe("s0",e,t,n),Yfe("s1",e,t,n))];default:throw TypeError("Node type ".concat(e.op," is not implemented"))}};function yve(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e8,i=function(e,t,n){switch(e.category){case"arithmetic":return a((function(){return Bde(e,t,n)}));case"basic_math":return a((function(){return Wde(e,t,n)}));case"control":return Zde(e,t,n);case"convolution":return a((function(){return $de(e,t,n)}));case"creation":return a((function(){return eve(e,t,n)}));case"dynamic":return nve(e,t,n);case"evaluation":return a((function(){return rve(e,t,n)}));case"image":return a((function(){return sve(e,t,n)}));case"graph":return a((function(){return ave(e,t,n)}));case"logical":return a((function(){return uve(e,t,n)}));case"matrices":return a((function(){return cve(e,t,n)}));case"normalization":return a((function(){return lve(e,t,n)}));case"ragged":return a((function(){return hve(e,t,n)}));case"reduction":return a((function(){return pve(e,t,n)}));case"slice_join":return a((function(){return fve(e,t,n)}));case"sparse":return a((function(){return dve(e,t,n)}));case"spectral":return a((function(){return vve(e,t,n)}));case"string":return a((function(){return mve(e,t,n)}));case"transformation":return a((function(){return gve(e,t,n)}));case"hash_table":return ove(e,t,n,r);case"custom":var i=Xfe(e.op);if(i&&i.customExecutor)return i.customExecutor(new zde(e,t,n));throw TypeError("Custom op ".concat(e.op," is not registered."));default:throw TypeError("Unknown op '".concat(e.op,"'. File an issue at ")+"https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()")}}(e,t,n);return v0(i)?i.then((function(e){return[].concat(e)})):[].concat(i)}var bve=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=arguments.length>4?arguments[4]:void 0;l(this,e),this.weightMap=t,this.tensorArrayMap=n,this.tensorListMap=r,this.functionMap=a,this.parseNodeNameCache=i,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}return p(e,[{key:"newFrame",value:function(e,t){return{id:e,frameName:t,iterationId:0}}},{key:"currentContext",get:function(){return this.contexts},set:function(e){this.contexts!==e&&(this.contexts=e,this.generateCurrentContextIds())}},{key:"currentContextId",get:function(){return this._currentContextIds[0]}},{key:"currentContextIds",get:function(){return this._currentContextIds}},{key:"generateCurrentContextIds",value: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}},{key:"contextIdforContexts",value:function(e){return e?e.map((function(e){return 0===e.id&&0===e.iterationId?"":"".concat(e.frameName,"-").concat(e.iterationId)})).join("/"):""}},{key:"enterFrame",value: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)))}},{key:"exitFrame",value: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()}},{key:"nextIteration",value: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))}},{key:"getWeight",value:function(e){return this.weightMap[e]}},{key:"addTensorArray",value:function(e){this.tensorArrayMap[e.id]=e}},{key:"getTensorArray",value:function(e){return this.tensorArrayMap[e]}},{key:"addTensorList",value:function(e){this.tensorListMap[e.id]=e}},{key:"getTensorList",value:function(e){return this.tensorListMap[e]}},{key:"dispose",value:function(e){for(var t in this.tensorArrayMap)this.tensorArrayMap[t].clearAndClose(e);for(var n in this.tensorListMap)this.tensorListMap[n].clearAndClose(e)}}]),e}();function xve(e,t,n,r){var a=new Set,i=[],o=null,s=null,u=new Set,c=new Set(Object.keys(e).map((function(e){return ede(e)[0]})));r=r||[];for(var l=new Set(r.map((function(e){return ede(e.name)[0]}))),h=T(t);h.length>0;){var p=h.pop();(Tve(p)||Eve(p)||Cve(p))&&null==o&&(s=(o=p).children.map((function(e){return e.name})).filter((function(e){return a.has(e)}))),a.add(p.name),null==n[p.name]&&(c.has(p.name)||l.has(p.name)||(0!==p.inputs.length?p.inputs.forEach((function(e){u.has(e.name)||(u.add(e.name),h.push(e))})):i.push(p.name)))}return{inputs:e,outputs:t,usedNodes:a,missingInputs:i,dynamicNode:o,syncInputs:s}}function kve(e,t){var n=t.usedNodes,r=t.inputs,a=Object.keys(r).map((function(e){return ede(e)[0]})).map((function(t){return e.nodes[t]})),i=e.initNodes||[],o=function(e){return n.has("string"==typeof e?e:e.name)};function s(e){return T(new Map(e.map((function(e){return[e.name,e]}))).values())}var u,c=s([].concat(T(a),T(e.weights),T(i))).filter(o),l=s([].concat(T(c),T(Object.values(e.nodes)))).filter(o),h=new Map(l.map((function(e){return[e.name,e]}))),p={},f=O(l);try{for(f.s();!(u=f.n()).done;){var d=u.value;p[d.name]=p[d.name]||0;var v,m=O(d.children);try{for(m.s();!(v=m.n()).done;){var g=v.value;o(g)||(p[g.name]=Number.POSITIVE_INFINITY),p[g.name]=(p[g.name]||0)+1}}catch(e){m.e(e)}finally{m.f()}}}catch(e){f.e(e)}finally{f.f()}for(var y=Object.entries(p).filter((function(e){return 0===S(e,2)[1]})).map((function(e){return S(e,1)[0]})),b=T(y);y.length>0;){var x,k=y.pop(),w=O(h.get(k).children.filter(o));try{for(w.s();!(x=w.n()).done;){var I=x.value;0==--p[I.name]&&(b.push(I.name),y.push(I.name))}}catch(e){w.e(e)}finally{w.f()}}var N=function(e,t){var n=new Map(e.map((function(e){return[e.name,e]}))),r=t.map((function(e){return e.name})),a=new Set(r);for(;r.length>0;){var i,o=r.pop(),s=O(n.get(o).children);try{for(s.s();!(i=s.n()).done;){var u=i.value;n.has(u.name)&&!a.has(u.name)&&(a.add(u.name),r.push(u.name))}}catch(e){s.e(e)}finally{s.f()}}var c=e.filter((function(e){return a.has(e.name)}));return c}(b.map((function(e){return h.get(e)})),c);return function(e,t){var n,r=new Map(e.map((function(e,t){return[e.name,t]}))),a=new Set(t.map((function(e){return e.name}))),i=function(e){return a.has("string"==typeof e?e:e.name)},o=new Set(e.map((function(e){return e.name}))),s=function(e){return o.has("string"==typeof e?e:e.name)},u=O(e);try{for(u.s();!(n=u.n()).done;){var c,l=n.value,h=O(l.children.filter(s));try{for(h.s();!(c=h.n()).done;){var p=c.value;if(!r.has(p.name))throw new wve("Child ".concat(p.name," of node ").concat(l.name," is unreachable."));if(r.get(l.name)>r.get(p.name))throw new wve("Node ".concat(l.name," is scheduled to run after its child ").concat(p.name,"."))}}catch(e){h.e(e)}finally{h.f()}if(!i(l)){var f,d=O(l.inputs);try{for(d.s();!(f=d.n()).done;){var v=f.value;if(!r.has(v.name))throw new wve("Input ".concat(v.name," of node ").concat(l.name," is unreachable."));if(r.get(v.name)>r.get(l.name))throw new wve("Node ".concat(l.name," is scheduled to run before its input ").concat(v.name,"."))}}catch(e){d.e(e)}finally{d.f()}}}}catch(e){u.e(e)}finally{u.f()}}(N,c),N}var wve=function(e){d(n,e);var t=w(n);function n(e){return l(this,n),t.call(this,"NodesExecutionOrderError: ".concat(e))}return p(n)}(b(Error));var Ive=new Set(["Switch","Merge","Enter","Exit","NextIteration","StatelessIf","StatelessWhile","if","While"]),Nve=new Set(["NonMaxSuppressionV2","NonMaxSuppressionV3","NonMaxSuppressionV5","Where"]),Sve=new Set(["HashTable","HashTableV2","LookupTableImport","LookupTableImportV2","LookupTableFind","LookupTableFindV2","LookupTableSize","LookupTableSizeV2"]);function Tve(e){return Ive.has(e.op)}function Eve(e){return Nve.has(e.op)}function Cve(e){return Sve.has(e.op)}var Ave=function(){function e(t,n){var r=this;l(this,e),this.graph=t,this.parent=n,this.compiledMap=new Map,this.parseNodeNameCache=new Map,this._weightMap={},this.SEPARATOR=",",this._functions={},this._functionExecutorMap={},this.keepIntermediateTensors=!1,this._outputs=t.outputs,this._inputs=t.inputs,this._initNodes=t.initNodes,this._signature=t.signature,this._functions=t.functions,null!=t.functions&&Object.keys(t.functions).forEach((function(n){r._functionExecutorMap[n]=new e(t.functions[n],r)}))}var t,n,r,a;return p(e,[{key:"weightIds",get:function(){return this.parent?this.parent.weightIds:this._weightIds}},{key:"functionExecutorMap",get:function(){return this.parent?this.parent.functionExecutorMap:this._functionExecutorMap}},{key:"weightMap",get:function(){return this.parent?this.parent.weightMap:this._weightMap},set:function(e){var t,n=Object.keys(e).map((function(t){return e[t].map((function(e){return e.id}))}));this._weightIds=(t=[]).concat.apply(t,T(n)),this._weightMap=e}},{key:"resourceManager",set:function(e){this._resourceManager=e}},{key:"inputs",get:function(){return this._inputs.map((function(e){return{name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0}}))}},{key:"outputs",get:function(){return this._outputs.map((function(e){return{name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0}}))}},{key:"inputNodes",get:function(){return this._inputs.map((function(e){return e.signatureKey||e.name}))}},{key:"outputNodes",get:function(){return this._outputs.map((function(e){var t=e.signatureKey||e.name;return e.defaultOutput?"".concat(t,":").concat(e.defaultOutput):t}))}},{key:"functions",get:function(){var e=this;return Object.keys(this._functions).reduce((function(t,n){return t[n]=e._functions[n].signature,t}),{})}},{key:"getCompilationKey",value:function(e,t){var n=e.map((function(e){return e.name})).sort(),r=t.map((function(e){return e.name})).sort();return n.join(this.SEPARATOR)+"--"+r.join(this.SEPARATOR)}},{key:"compile",value:function(e,t){var n=xve(e,t,this.weightMap,this._initNodes),r=n.missingInputs,a=n.dynamicNode,i=n.syncInputs;if(null!=a)throw new Error("This execution contains the node '".concat(a.name,"', which has ")+"the dynamic op '".concat(a.op,"'. Please use ")+"model.executeAsync() instead. Alternatively, to avoid the "+"dynamic ops, specify the inputs [".concat(i,"]"));if(r.length>0){var o=t.map((function(e){return e.name})),s=Object.keys(e);throw new Error("Cannot compute the outputs [".concat(o,"] from the provided inputs ")+"[".concat(s,"]. Missing the following inputs: [").concat(r,"]"))}var u=kve(this.graph,n),c=function(e){for(var t=new Map(e.map((function(e,t){return[e.name,t]}))),n=Number.MAX_SAFE_INTEGER,r=e.map((function(e,t){return Tve(e)?n:t})),a=function(e){var n=r[t.get(e.name)];return null==n?-1:n},i=e.map((function(e,t){return e.children.map(a).reduce((function(e,t){return Math.max(e,t)}),r[t])})),o=new Map,s=0;s<e.length;++s){var u=i[s];if(u!==n){var c=e[s],l=e[u];o.has(l.name)||o.set(l.name,[]),o.get(l.name).push(c)}}return o}(u);return{orderedNodes:u,nodeLiveUntilMap:c}}},{key:"cloneAndKeepTensor",value:function(e){if(null==e)return null;var t=e.clone();return n8(t),t}},{key:"cloneTensorList",value:function(e){var t=this;if(!e)return null;var n=e.map((function(e){return t.cloneAndKeepTensor(e)}));return n}},{key:"cloneTensorMap",value:function(e){var t=this;return Object.fromEntries(Object.entries(e).map((function(e){var n=S(e,2),r=n[0],a=n[1];return[r,t.cloneTensorList(a)]})))}},{key:"execute",value:function(e,t){var n=this;this.disposeIntermediateTensors(),e=this.mapInputs(e);var r=Object.keys(e).sort();this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t);var a=r.map((function(e){return n.graph.nodes[ede(e)[0]]})),i=t.map((function(e){return ede(e)[0]})),o=new Set(i),s=i.map((function(e){return n.graph.nodes[e]}));0===s.length&&(s=this._outputs);var u=this.getCompilationKey(a,s),c=this.compiledMap.get(u);null==c&&(c=this.compile(e,s),this.compiledMap.set(u,c));try{this.keepIntermediateTensors=k0().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(e){this.keepIntermediateTensors=!1,console.warn(e.message)}var l={},h={};return e8((function(){var r=new bve(n.weightMap,l,h,n.functionExecutorMap,n.parseNodeNameCache),a=Object.assign({},n.weightMap);n.keepIntermediateTensors&&(n.clonedTensorsMap=n.cloneTensorMap(n.weightMap)),Object.keys(e).forEach((function(t){var i=S(ede(t,r),2),o=i[0],s=[];s[i[1]]=e[t],a[o]=s,n.keepIntermediateTensors&&(n.clonedTensorsMap[o]=n.cloneTensorList(s))}));var i,s=n.getFrozenTensorIds(a),u=c,p=u.orderedNodes,f=u.nodeLiveUntilMap,d=O(p);try{for(d.s();!(i=d.n()).done;){var v=i.value;if(!a[v.name]){var m=yve(v,a,r,n._resourceManager);if(v0(m))throw new Error("The execution of the op '".concat(v.op,"' returned a promise. ")+"Please use model.executeAsync() instead.");a[v.name]=m,n.keepIntermediateTensors&&(n.clonedTensorsMap[v.name]=n.cloneTensorList(m)),n.checkTensorForDisposalWithNodeLiveUntilInfo(v,a,r,s,o,f.get(v.name))}}}catch(e){d.e(e)}finally{d.f()}return null==n.parent&&r.dispose(s),t.map((function(e){return Jfe(e,a,r)}))}))}},{key:"getFrozenTensorIds",value:function(e){var t=[].concat.apply([],Object.keys(e).map((function(t){return e[t]})).map((function(e){return e.map((function(e){return e.id}))})));return new Set(t)}},{key:"checkTensorForDisposal",value:function(e,t,n,r,a,i,o){if(!Tve(t)&&!i.has(e)){var s,u=O(n[e]);try{for(u.s();!(s=u.n()).done;){var c=s.value;null!=c&&(o[c.id]=(o[c.id]||0)+t.children.length)}}catch(e){u.e(e)}finally{u.f()}var l,h=O(t.inputs);try{for(h.s();!(l=h.n()).done;){var p=l.value;if(!Tve(p)){var f=Zfe(p.name,n,r);if(null!=f){var d,v=O(f);try{for(v.s();!(d=v.n()).done;){var m=d.value;if(m&&!m.kept&&!a.has(m.id)){var g=o[m.id];1===g?(m.dispose(),delete o[m.id]):null!=g&&o[m.id]--}}}catch(e){v.e(e)}finally{v.f()}}}}}catch(e){h.e(e)}finally{h.f()}}}},{key:"checkTensorForDisposalWithNodeLiveUntilInfo",value:function(e,t,n,r,a,i){function o(e){return Tve(e)||a.has(e.name)}if(!Tve(e)&&null!=i){var s,u=O(i);try{for(u.s();!(s=u.n()).done;){var c=s.value;if(!o(c)){var l,h=O(Zfe(c.name,t,n));try{for(h.s();!(l=h.n()).done;){var p=l.value;!p||p.kept||r.has(p.id)||p.dispose()}}catch(e){h.e(e)}finally{h.f()}}}}catch(e){u.e(e)}finally{u.f()}}}},{key:"executeAsync",value:(a=c(o().mark((function e(t,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._executeAsync(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"disposeIntermediateTensors",value:function(){this.clonedTensorsMap&&(Object.values(this.clonedTensorsMap).forEach((function(e){var t,n=O(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;r&&!r.isDisposed&&r.dispose()}}catch(e){n.e(e)}finally{n.f()}})),this.clonedTensorsMap=null)}},{key:"getIntermediateTensors",value:function(){return this.clonedTensorsMap}},{key:"_executeAsync",value:(r=c(o().mark((function e(t,n){var r,a,i,s,u,c,l,h,p,f=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=f.length>2&&void 0!==f[2]&&f[2],a=f.length>3&&void 0!==f[3]?f[3]:{},i=f.length>4&&void 0!==f[4]?f[4]:{},this.disposeIntermediateTensors(),r||(t=this.mapInputs(t),this.checkInputs(t),this.checkInputShapeAndType(t),n=this.mapOutputs(n),this.checkOutputs(n));try{this.keepIntermediateTensors=k0().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(e){this.keepIntermediateTensors=!1,console.warn(e.message)}return s=new bve(this.weightMap,a,i,this.functionExecutorMap,this.parseNodeNameCache),this.keepIntermediateTensors&&(this.clonedTensorsMap=this.cloneTensorMap(this.weightMap)),e.next=10,this.executeWithControlFlow(t,s,n,r);case 10:return u=e.sent,c=n.map((function(e){return Jfe(e,u,s)})),l=c.map((function(e){return e.id})),h=Object.keys(t).map((function(e){return t[e].id})),p=new Set([].concat(T(l),T(h),T(this.weightIds))),Object.values(u).forEach((function(e){e.forEach((function(e){!e||e.isDisposed||p.has(e.id)||e.dispose()}))})),null==this.parent&&s.dispose(p),e.abrupt("return",c);case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"executeFunctionAsync",value:(n=c(o().mark((function e(t,n,r){var a,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.reduce((function(e,t,n){return e[i.inputs[n].name]=t,e}),{}),e.abrupt("return",this._executeAsync(a,this.outputNodes,!0,n,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"executeWithControlFlow",value:(t=c(o().mark((function e(t,n,r,a){var i,s,u,c,l,h,p,f,d,v,m,g,y,b,x,k,w,I,N=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=Object.keys(t),s=i.map((function(e){return N.graph.nodes[ede(e)[0]]})),u=r.map((function(e){return ede(e)[0]})),c=new Set(u),0===(l=u.map((function(e){return N.graph.nodes[e]}))).length&&(l=this._outputs),h=xve(t,l,this.weightMap,this._initNodes),p=h.usedNodes,f=h.missingInputs,d=h.dynamicNode,v=h.syncInputs,m=[].concat(T(s),T(this.graph.weights),T(this._initNodes||[])).map((function(e){return{node:e,contexts:n.currentContext}})),g=Object.assign({},this.weightMap),Object.keys(t).forEach((function(e){var n=S(ede(e),2),r=n[0],a=[];a[n[1]]=t[e],g[r]=a})),y={},b=this.getFrozenTensorIds(g),x={};case 13:if(!(m.length>0)){e.next=19;break}return k=this.processStack(s,m,n,g,x,b,c,y,p),e.next=17,Promise.all(k);case 17:e.next=13;break;case 19:if(null!=d||a||console.warn("This model execution did not contain any nodes with control flow or dynamic output shapes. You can use model.execute() instead."),w=l.filter((function(e){return!Tve(e)&&!Jfe(e.name,g,n)})).map((function(e){return e.name})),!(w.length>0)){e.next=25;break}throw I="",null!=d&&(I="Alternatively, to avoid the dynamic ops, use model.execute() "+"and specify the inputs [".concat(v,"]")),new Error("Cannot compute the outputs [".concat(w,"] from the provided ")+"inputs [".concat(i,"]. Consider providing the following inputs: ")+"[".concat(f,"]. ").concat(I));case 25:return e.abrupt("return",g);case 26:case"end":return e.stop()}}),e,this)}))),function(e,n,r,a){return t.apply(this,arguments)})},{key:"processStack",value:function(e,t,n,r,a,i,o,s,u){for(var c=this,l=[],h=function(){var e=t.pop();n.currentContext=e.contexts;var h="";if("Enter"===e.node.op&&Yfe("isConstant",e.node,r,n)){var p=S(Qfe(e.node.name,n),1);h=p[0]}if(null==r[e.node.name]){var f=yve(e.node,r,n,c._resourceManager);if(!h){var d=S(Qfe(e.node.name,n),1);h=d[0]}var v=n.currentContext;v0(f)?l.push(f.then((function(l){return r[h]=l,c.keepIntermediateTensors&&(c.clonedTensorsMap[h]=c.cloneTensorList(l)),n.currentContext=v,c.checkTensorForDisposal(h,e.node,r,n,i,o,s),c.processChildNodes(e.node,t,n,r,a,u),l}))):(r[h]=f,c.keepIntermediateTensors&&(c.clonedTensorsMap[h]=c.cloneTensorList(f)),c.checkTensorForDisposal(h,e.node,r,n,i,o,s),c.processChildNodes(e.node,t,n,r,a,u))}else c.processChildNodes(e.node,t,n,r,a,u)};t.length>0;)h();return l}},{key:"processChildNodes",value:function(e,t,n,r,a,i){e.children.forEach((function(e){var o=S(Qfe(e.name,n),1)[0];!a[o]&&i.has(e.name)&&("Merge"===e.op?e.inputNames.some((function(e){return!!Jfe(e,r,n)}))&&(a[o]=!0,t.push({contexts:n.currentContext,node:e})):e.inputNames.every((function(e){return!!Jfe(e,r,n)}))&&(a[o]=!0,t.push({contexts:n.currentContext,node:e})))}))}},{key:"dispose",value:function(){var e=this;Object.keys(this.weightMap).forEach((function(t){return e.weightMap[t].forEach((function(e){return e.dispose()}))}))}},{key:"checkInputShapeAndType",value:function(e){var t=this;Object.keys(e).forEach((function(n){var r=e[n],a=S(ede(n),1)[0],i=t.graph.nodes[a];if(i.attrParams.shape&&i.attrParams.shape.value){var o=i.attrParams.shape.value,s=o.length===r.shape.length&&r.shape.every((function(e,t){return-1===o[t]||o[t]===e}));F$(s,(function(){return"The shape of dict['".concat(i.name,"'] provided in ")+"model.execute(dict) must be [".concat(o,"], but was ")+"[".concat(r.shape,"]")}))}i.attrParams.dtype&&i.attrParams.dtype.value&&F$(r.dtype===i.attrParams.dtype.value,(function(){return"The dtype of dict['".concat(i.name,"'] provided in ")+"model.execute(dict) must be "+"".concat(i.attrParams.dtype.value,", but was ").concat(r.dtype)}))}))}},{key:"mapInputs",value:function(e){var t,n,r={};for(var a in e){var i=null===(n=null===(t=this._signature)||void 0===t?void 0:t.inputs)||void 0===n?void 0:n[a];null!=i?r[i.name]=e[a]:r[a]=e[a]}return r}},{key:"checkInputs",value:function(e){var t=this,n=Object.keys(e).filter((function(e){var n=S(ede(e),1)[0];return null==t.graph.nodes[n]}));if(n.length>0)throw new Error("The dict provided in model.execute(dict) has "+"keys: [".concat(n,"] that are not part of graph"))}},{key:"mapOutputs",value:function(e){var t=this;return e.map((function(e){var n,r,a=null===(r=null===(n=t._signature)||void 0===n?void 0:n.outputs)||void 0===r?void 0:r[e];return null!=a?a.name:e}),{})}},{key:"checkOutputs",value:function(e){var t=this;e.forEach((function(e){var n=S(ede(e),1)[0];if(!t.graph.nodes[n])throw new Error("The output '".concat(e,"' is not found in the graph"))}))}}]),e}(),Rve=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};l(this,e),this.hashTableNameToHandle=t,this.hashTableMap=n}return p(e,[{key:"addHashTable",value:function(e,t){this.hashTableNameToHandle[e]=t.handle,this.hashTableMap[t.id]=t}},{key:"getHashTableHandleByName",value:function(e){return this.hashTableNameToHandle[e]}},{key:"getHashTableById",value:function(e){return this.hashTableMap[e]}},{key:"dispose",value:function(){for(var e in this.hashTableMap)this.hashTableMap[e].clearAndClose(),delete this.hashTableMap[e];for(var t in this.hashTableNameToHandle)this.hashTableNameToHandle[t].dispose(),delete this.hashTableNameToHandle[t]}}]),e}(),_ve=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:pae;l(this,e),this.modelUrl=t,this.loadOptions=n,this.version="n/a",this.io=r,null==n&&(this.loadOptions={}),this.resourceManager=new Rve}var t,n,r,a;return p(e,[{key:"modelVersion",get:function(){return this.version}},{key:"inputNodes",get:function(){return this.executor.inputNodes}},{key:"outputNodes",get:function(){return this.executor.outputNodes}},{key:"inputs",get:function(){return this.executor.inputs}},{key:"outputs",get:function(){return this.executor.outputs}},{key:"weights",get:function(){return this.executor.weightMap}},{key:"metadata",get:function(){return this.artifacts.userDefinedMetadata}},{key:"modelSignature",get:function(){return this.signature}},{key:"modelStructuredOutputKeys",get:function(){return this.structuredOutputKeys}},{key:"findIOHandler",value:function(){var e=this.modelUrl;if(null!=e.load)this.handler=e;else if(null!=this.loadOptions.requestInit)this.handler=this.io.browserHTTPRequest(e,this.loadOptions);else{var t=this.io.getLoadHandlers(e,this.loadOptions);if(0===t.length)t.push(this.io.browserHTTPRequest(e,this.loadOptions));else if(t.length>1)throw new Error("Found more than one (".concat(t.length,") load handlers for ")+"URL '".concat([e],"'"));this.handler=t[0]}}},{key:"load",value:function(){var e=this;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.");var t=this.handler.load();return v0(t)?t.then((function(t){return e.loadSync(t)})):this.loadSync(t)}},{key:"loadSync",value:function(e){this.artifacts=e;var t=this.artifacts.modelTopology,n=this.artifacts.signature;if(null!=this.artifacts.userDefinedMetadata){var r=this.artifacts.userDefinedMetadata;null!=r.signature&&(n=r.signature),null!=r.structuredOutputKeys&&(this.structuredOutputKeys=r.structuredOutputKeys)}this.signature=n,this.version="".concat(t.versions.producer,".").concat(t.versions.minConsumer);var a=this.io.decodeWeights(this.artifacts.weightData,this.artifacts.weightSpecs);if(this.executor=new Ave(wde.Instance.transformGraph(t,this.signature)),this.executor.weightMap=this.convertTensorMapToTensorsMap(a),this.executor.resourceManager=this.resourceManager,null!=e.modelInitializer&&null!=e.modelInitializer.node){var i=wde.Instance.transformGraph(e.modelInitializer);this.initializer=new Ave(i),this.initializer.weightMap=this.executor.weightMap,this.initializer.resourceManager=this.resourceManager,this.initializerSignature=e.initializerSignature}return!0}},{key:"save",value:(a=c(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t){e.next=9;break}if(0!==(r=this.io.getSaveHandlers(t)).length){e.next=6;break}throw new Error("Cannot find any save handlers for URL '".concat(t,"'"));case 6:if(!(r.length>1)){e.next=8;break}throw new Error("Found more than one (".concat(r.length,") save handlers for ")+"URL '".concat(t,"'"));case 8:t=r[0];case 9:if(null!=t.save){e.next=11;break}throw new Error("GraphModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");case 11:return e.abrupt("return",t.save(this.artifacts));case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"addStructuredOutputNames",value:function(e){var t=this;if(this.structuredOutputKeys){var n={};return(e instanceof n5?[e]:e).forEach((function(e,r){return n[t.structuredOutputKeys[r]]=e})),n}return e}},{key:"predict",value:function(e,t){var n=this.execute(e,this.outputNodes);return this.addStructuredOutputNames(n)}},{key:"predictAsync",value:(r=c(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeAsync(t,this.outputNodes);case 2:return r=e.sent,e.abrupt("return",this.addStructuredOutputNames(r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"normalizeInputs",value:function(e){var t,n=this;if(!(e instanceof n5||Array.isArray(e))){var r=null===(t=this.signature)||void 0===t?void 0:t.inputs;if(null!=r)for(var a in r){var i=r[a];null!=i.resourceId&&(e[a]=this.resourceIdToCapturedInput[i.resourceId])}return e}e=Array.isArray(e)?e:[e];var o=Object.keys(this.resourceIdToCapturedInput).length;if(e.length+o!==this.inputNodes.length)throw new Error("Input tensor count mismatch, the graph model has ".concat(this.inputNodes.length-o," non-resource placeholders, while there are ").concat(e.length," input tensors provided."));var s=0;return this.inputNodes.reduce((function(t,r){var a,i,o,u=null===(o=null===(i=null===(a=n.signature)||void 0===a?void 0:a.inputs)||void 0===i?void 0:i[r])||void 0===o?void 0:o.resourceId;return t[r]=null!=u?n.resourceIdToCapturedInput[u]:e[s++],t}),{})}},{key:"normalizeOutputs",value:function(e){return e=e||this.outputNodes,Array.isArray(e)?e:[e]}},{key:"executeInitializerGraph",value:function(){return null==this.initializer?[]:null==this.initializerSignature?this.initializer.execute({},[]):this.initializer.execute({},Object.keys(this.initializerSignature.outputs))}},{key:"executeInitializerGraphAsync",value:(n=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=this.initializer){e.next=2;break}return e.abrupt("return",[]);case 2:if(null!=this.initializerSignature){e.next=6;break}return e.abrupt("return",this.initializer.executeAsync({},[]));case 6:return e.abrupt("return",this.initializer.executeAsync({},Object.keys(this.initializerSignature.outputs)));case 7:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"setResourceIdToCapturedInput",value:function(e){if(this.resourceIdToCapturedInput={},this.initializerSignature)for(var t=this.initializerSignature.outputs,n=Object.keys(t),r=0;r<n.length;r++){var a=t[n[r]];this.resourceIdToCapturedInput[a.resourceId]=e[r]}}},{key:"execute",value:function(e,t){null==this.resourceIdToCapturedInput&&this.setResourceIdToCapturedInput(this.executeInitializerGraph()),e=this.normalizeInputs(e),t=this.normalizeOutputs(t);var n=this.executor.execute(e,t);return n.length>1?n:n[0]}},{key:"executeAsync",value:(t=c(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=this.resourceIdToCapturedInput){e.next=6;break}return e.t0=this,e.next=4,this.executeInitializerGraphAsync();case 4:e.t1=e.sent,e.t0.setResourceIdToCapturedInput.call(e.t0,e.t1);case 6:return t=this.normalizeInputs(t),n=this.normalizeOutputs(n),e.next=10,this.executor.executeAsync(t,n);case 10:return r=e.sent,e.abrupt("return",r.length>1?r:r[0]);case 12:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"getIntermediateTensors",value:function(){return this.executor.getIntermediateTensors()}},{key:"disposeIntermediateTensors",value:function(){this.executor.disposeIntermediateTensors()}},{key:"convertTensorMapToTensorsMap",value:function(e){return Object.keys(e).reduce((function(t,n){return t[n]=[e[n]],t}),{})}},{key:"dispose",value:function(){this.executor.dispose(),this.initializer&&(this.initializer.dispose(),this.resourceIdToCapturedInput&&t8(this.resourceIdToCapturedInput)),this.resourceManager.dispose()}}]),e}();function Ove(){return Ove=c(o().mark((function e(t){var n,r,a,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=i.length>1&&void 0!==i[1]?i[1]:{},r=i.length>2&&void 0!==i[2]?i[2]:pae,null!=t){e.next=4;break}throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");case 4:return null==n&&(n={}),n.fromTFHub&&"string"==typeof t&&(t=Fve(t)),a=new _ve(t,n,r),e.next=9,a.load();case 9:return e.abrupt("return",a);case 10:case"end":return e.stop()}}),e)}))),Ove.apply(this,arguments)}function Fve(e){return e.endsWith("/")||(e+="/"),"".concat(e).concat("model.json").concat("?tfjs-format=file")}var Dve="4.6.0";function Mve(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Map,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Set;if(null==e)return null;if("function"==typeof Blob&&e instanceof Blob)return e.slice();if(r.has(e))throw new Error("Circular references are not supported.");if(n.has(e))return n.get(e);var a=t(e);if(a.recurse&&null!==a.value)throw new Error("A deep map function may not return both a value and recurse=true.");if(a.recurse){if(Vve(e)){var i=Array.isArray(e)?[]:{};for(var o in r.add(e),e){var s=e[o],u=Mve(s,t,n,r);i[o]=u}return r.delete(e),e.__proto__&&(i.__proto__=e.__proto__),i}throw new Error("Can't recurse into non-iterable type: ".concat(e))}return n.set(e,a.value),a.value}function Lve(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pve;return zve(e,t)}function zve(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set,r=e[0];if(n.has(r))throw new Error("Circular references are not supported.");var a=t(e);if(a.recurse&&null!==a.value)throw new Error("A deep zip function may not return both a value and recurse=true.");if(a.recurse){if(Vve(r)){var i=Array.isArray(r)?[]:{};n.add(r);var o=function(r){var a=zve(e.map((function(e){return e[r]})),t,n);i[r]=a};for(var s in r)o(s);return n.delete(r),i}throw new Error("Can't recurse into non-iterable type: ".concat(r))}return a.value}function Pve(e){return null===e?null:Vve(e[0])?{value:null,recurse:!0}:{value:e,recurse:!1}}function Bve(e,t){return Wve.apply(this,arguments)}function Wve(){return Wve=c(o().mark((function e(t,n){var r,a,i,s,u,c,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=new Map,Mve(t,n,r),a=0,i=Array.from(r.keys());case 3:if(!(a<i.length)){e.next=14;break}if(s=i[a],!v0(u=r.get(s))){e.next=11;break}return e.next=9,u;case 9:c=e.sent,r.set(s,c);case 11:a++,e.next=3;break;case 14:return l=Mve(t,n,r),e.abrupt("return",l);case 16:case"end":return e.stop()}}),e)}))),Wve.apply(this,arguments)}function Vve(e){var t=!1;k0().get("IS_BROWSER")?t=e instanceof TextDecoder:t=e instanceof require("string_decoder").StringDecoder;return null!=e&&!ArrayBuffer.isView(e)&&(Array.isArray(e)||"object"===s(e)&&!(e instanceof n5)&&!(e instanceof Promise)&&!t)}function Uve(e){return null==e||(null===(t=e)||"object"!==s(t)&&"function"!=typeof t)||Array.isArray(e)||"object"===s(e)&&e instanceof n5||V4(e);var t}function Gve(e){return function(e,t){return Mve(e,t)}(e,jve)}function jve(e){return e instanceof n5?{value:e.clone(),recurse:!1}:Vve(e)?{value:null,recurse:!0}:{value:e,recurse:!1}}var Hve=function(){function e(t){if(l(this,e),this.capacity=t,this.begin=0,this.end=0,null==t)throw new RangeError("Can't create a ring buffer of unknown capacity.");if(t<1)throw new RangeError("Can't create ring buffer of capacity < 1.");this.data=new Array(t),this.doubledCapacity=2*t}return p(e,[{key:"wrap",value:function(e){for(;e<0;)e+=this.doubledCapacity;return e%this.doubledCapacity}},{key:"get",value:function(e){if(e<0)throw new RangeError("Can't get item at a negative index.");return this.data[e%this.capacity]}},{key:"set",value:function(e,t){if(e<0)throw new RangeError("Can't set item at a negative index.");this.data[e%this.capacity]=t}},{key:"length",value:function(){var e=this.end-this.begin;return e<0&&(e=this.doubledCapacity+e),e}},{key:"isFull",value:function(){return this.length()===this.capacity}},{key:"isEmpty",value:function(){return 0===this.length()}},{key:"push",value:function(e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.set(this.end,e),this.end=this.wrap(this.end+1)}},{key:"pushAll",value:function(e){var t,n=O(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;this.push(r)}}catch(e){n.e(e)}finally{n.f()}}},{key:"pop",value:function(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");this.end=this.wrap(this.end-1);var e=this.get(this.end);return this.set(this.end,void 0),e}},{key:"unshift",value:function(e){if(this.isFull())throw new RangeError("Ring buffer is full.");this.begin=this.wrap(this.begin-1),this.set(this.begin,e)}},{key:"shift",value:function(){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");var e=this.get(this.begin);return this.set(this.begin,void 0),this.begin=this.wrap(this.begin+1),e}},{key:"shuffleExcise",value:function(e){if(this.isEmpty())throw new RangeError("Ring buffer is empty.");var t=this.wrap(this.begin+e),n=this.get(t);return this.set(t,this.pop()),n}}]),e}(),qve=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.call(this,n.INITIAL_CAPACITY)}return p(n,[{key:"isFull",value:function(){return!1}},{key:"push",value:function(e){N(v(n.prototype),"isFull",this).call(this)&&this.expand(),N(v(n.prototype),"push",this).call(this,e)}},{key:"unshift",value:function(e){N(v(n.prototype),"isFull",this).call(this)&&this.expand(),N(v(n.prototype),"unshift",this).call(this,e)}},{key:"expand",value:function(){for(var e=2*this.capacity,t=new Array(e),n=this.length(),r=0;r<n;r++)t[r]=this.get(this.wrap(this.begin+r));this.data=t,this.capacity=e,this.doubledCapacity=2*this.capacity,this.begin=0,this.end=n}}]),n}(Hve);function Kve(e){return new $ve(e)}function Xve(e){return new eme(e)}function Yve(e,t){return new hme(e,t)}function Jve(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Zve.FAIL;return new pme(e,t)}qve.INITIAL_CAPACITY=32;var Zve,Qve=function(){function e(){l(this,e)}var t,n,r,a,i;return p(e,[{key:"toArray",value:function(){var e=c(o().mark((function e(){var t,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.next=3,this.next();case 3:n=e.sent;case 4:if(n.done){e.next=11;break}return t.push(n.value),e.next=8,this.next();case 8:n=e.sent,e.next=4;break;case 11:return e.abrupt("return",t);case 12:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"toArrayForTest",value:(i=c(o().mark((function e(){var t,n,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.prefetch(100),n=[],e.next=4,t.next();case 4:r=e.sent;case 5:if(r.done){e.next=12;break}return n.push(r.value),e.next=9,t.next();case 9:r=e.sent,e.next=5;break;case 12:return e.abrupt("return",n);case 13:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"resolveFully",value:(a=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.next();case 2:t=e.sent;case 3:if(t.done){e.next=9;break}return e.next=6,this.next();case 6:t=e.sent,e.next=3;break;case 9:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"resolveWhile",value:(r=c(o().mark((function e(t){var n,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.next();case 2:n=e.sent,r=t(n.value);case 4:if(n.done||!r){e.next=11;break}return e.next=7,this.next();case 7:n=e.sent,r=t(n.value),e.next=4;break;case 11:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"handleErrors",value:function(e){return new sme(this,e)}},{key:"filter",value:function(e){return new ime(this,e)}},{key:"map",value:function(e){return new ome(this,e)}},{key:"mapAsync",value:function(e){return new ume(this,e)}},{key:"serialMapAsync",value:function(e){return new ume(this,e).serial()}},{key:"flatmap",value:function(e){return new lme(this,e)}},{key:"forEachAsync",value:(n=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.map(t).resolveFully());case 1:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"serialForEach",value:(t=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.serialMapAsync(t).resolveWhile((function(e){return!0===e})));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"rowMajorBatch",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return new ame(this,e,t)}},{key:"columnMajorBatch",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Pve,r=this.rowMajorBatch(e,t);return r.map((function(e){return Lve(e,n)}))}},{key:"concatenate",value:function(e,t){return new hme(Kve([this,e]),t)}},{key:"take",value:function(e){return e<0||null==e?this:new rme(this,e)}},{key:"skip",value:function(e){return e<0||null==e?this:new nme(this,e)}},{key:"prefetch",value:function(e){return new fme(this,e)}},{key:"shuffle",value:function(e,t){return new dme(this,e,t)}},{key:"serial",value:function(){return new tme(this)}}]),e}(),$ve=function(e){d(r,e);var t,n=w(r);function r(e){var t;return l(this,r),(t=n.call(this)).items=e,t.trav=0,t}return p(r,[{key:"summary",value:function(){return"Array of ".concat(this.items.length," items")}},{key:"next",value:(t=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this.trav>=this.items.length)){e.next=2;break}return e.abrupt("return",{value:null,done:!0});case 2:return t=this.items[this.trav],this.trav++,e.abrupt("return",{value:Gve(t),done:!1});case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),r}(Qve),eme=function(e){d(r,e);var t,n=w(r);function r(e){var t;return l(this,r),(t=n.call(this)).nextFn=e,t}return p(r,[{key:"summary",value:function(){return"Function call"}},{key:"next",value:(t=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.abrupt("return",this.nextFn());case 4:throw e.prev=4,e.t0=e.catch(0),e.t0.message="Error thrown while iterating through a dataset: ".concat(e.t0.message),e.t0;case 8:case"end":return e.stop()}}),e,this,[[0,4]])}))),function(){return t.apply(this,arguments)})}]),r}(Qve),tme=function(e){d(a,e);var t,n,r=w(a);function a(e){var t;return l(this,a),(t=r.call(this)).upstream=e,t.lastRead=Promise.resolve({value:null,done:!1}),t}return p(a,[{key:"summary",value:function(){return"".concat(this.upstream.summary()," -> Serial")}},{key:"next",value:(n=c(o().mark((function e(){var t=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.lastRead=this.lastRead.then((function(){return t.serialNext()})),e.abrupt("return",this.lastRead);case 2:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"serialNext",value:(t=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.upstream.next());case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),a}(Qve),nme=function(e){d(a,e);var t,n,r=w(a);function a(e,t){var n;return l(this,a),(n=r.call(this)).upstream=e,n.maxCount=t,n.count=0,n.lastRead=Promise.resolve({value:null,done:!1}),n}return p(a,[{key:"summary",value:function(){return"".concat(this.upstream.summary()," -> Skip")}},{key:"next",value:(n=c(o().mark((function e(){var t=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.lastRead=this.lastRead.then((function(){return t.serialNext()})),e.abrupt("return",this.lastRead);case 2:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"serialNext",value:(t=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this.count++<this.maxCount)){e.next=9;break}return e.next=3,this.upstream.next();case 3:if(!(t=e.sent).done){e.next=6;break}return e.abrupt("return",t);case 6:t8(t.value),e.next=0;break;case 9:return e.abrupt("return",this.upstream.next());case 10:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),a}(Qve),rme=function(e){d(r,e);var t,n=w(r);function r(e,t){var a;return l(this,r),(a=n.call(this)).upstream=e,a.maxCount=t,a.count=0,a}return p(r,[{key:"summary",value:function(){return"".concat(this.upstream.summary()," -> Take")}},{key:"next",value:(t=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this.count++>=this.maxCount)){e.next=2;break}return e.abrupt("return",{value:null,done:!0});case 2:return e.abrupt("return",this.upstream.next());case 3:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),r}(Qve),ame=function(e){d(a,e);var t,n,r=w(a);function a(e,t){var n,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return l(this,a),(n=r.call(this)).upstream=e,n.batchSize=t,n.enableSmallLastBatch=i,n.lastRead=Promise.resolve({value:null,done:!1}),n}return p(a,[{key:"summary",value:function(){return"".concat(this.upstream.summary()," -> RowMajorBatch")}},{key:"next",value:(n=c(o().mark((function e(){var t=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.lastRead=this.lastRead.then((function(){return t.serialNext()})),e.abrupt("return",this.lastRead);case 2:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"serialNext",value:(t=c(o().mark((function e(){var t,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[];case 1:if(!(t.length<this.batchSize)){e.next=12;break}return e.next=4,this.upstream.next();case 4:if(!(n=e.sent).done){e.next=9;break}if(!(this.enableSmallLastBatch&&t.length>0)){e.next=8;break}return e.abrupt("return",{value:t,done:!1});case 8:return e.abrupt("return",{value:null,done:!0});case 9:t.push(n.value),e.next=1;break;case 12:return e.abrupt("return",{value:t,done:!1});case 13:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),a}(Qve),ime=function(e){d(a,e);var t,n,r=w(a);function a(e,t){var n;return l(this,a),(n=r.call(this)).upstream=e,n.predicate=t,n.lastRead=Promise.resolve({value:null,done:!1}),n}return p(a,[{key:"summary",value:function(){return"".concat(this.upstream.summary()," -> Filter")}},{key:"next",value:(n=c(o().mark((function e(){var t=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.lastRead=this.lastRead.then((function(){return t.serialNext()})),e.abrupt("return",this.lastRead);case 2:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"serialNext",value:(t=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=3,this.upstream.next();case 3:if(!(t=e.sent).done&&!this.predicate(t.value)){e.next=6;break}return e.abrupt("return",t);case 6:t8(t.value),e.next=0;break;case 9:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),a}(Qve),ome=function(e){d(r,e);var t,n=w(r);function r(e,t){var a;return l(this,r),(a=n.call(this)).upstream=e,a.transform=t,a}return p(r,[{key:"summary",value:function(){return"".concat(this.upstream.summary()," -> Map")}},{key:"next",value:(t=c(o().mark((function e(){var t,n,r,a,i,s,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.upstream.next();case 2:if(!(t=e.sent).done){e.next=5;break}return e.abrupt("return",{value:null,done:!0});case 5:n=y5(t.value),r=this.transform(t.value),a=y5(r),i=O(n);try{for(i.s();!(s=i.n()).done;)g5(u=s.value,a)||u.dispose()}catch(e){i.e(e)}finally{i.f()}return e.abrupt("return",{value:r,done:!1});case 11:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),r}(Qve),sme=function(e){d(a,e);var t,n,r=w(a);function a(e,t){var n;return l(this,a),(n=r.call(this)).upstream=e,n.handler=t,n.count=0,n.lastRead=Promise.resolve({value:null,done:!1}),n}return p(a,[{key:"summary",value:function(){return"".concat(this.upstream.summary()," -> handleErrors")}},{key:"next",value:(n=c(o().mark((function e(){var t=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.lastRead=this.lastRead.then((function(){return t.serialNext()})),e.abrupt("return",this.lastRead);case 2:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"serialNext",value:(t=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=1,e.next=4,this.upstream.next();case 4:return e.abrupt("return",e.sent);case 7:if(e.prev=7,e.t0=e.catch(1),this.handler(e.t0)){e.next=11;break}return e.abrupt("return",{value:null,done:!0});case 11:e.next=0;break;case 13:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(){return t.apply(this,arguments)})}]),a}(Qve),ume=function(e){d(r,e);var t,n=w(r);function r(e,t){var a;return l(this,r),(a=n.call(this)).upstream=e,a.transform=t,a}return p(r,[{key:"summary",value:function(){return"".concat(this.upstream.summary()," -> AsyncMap")}},{key:"next",value:(t=c(o().mark((function e(){var t,n,r,a,i,s,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.upstream.next();case 2:if(!(t=e.sent).done){e.next=5;break}return e.abrupt("return",{value:null,done:!0});case 5:return n=y5(t.value),e.next=8,this.transform(t.value);case 8:r=e.sent,a=y5(r),i=O(n);try{for(i.s();!(s=i.n()).done;)g5(u=s.value,a)||u.dispose()}catch(e){i.e(e)}finally{i.f()}return e.abrupt("return",{value:r,done:!1});case 13:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),r}(Qve),cme=function(e){d(a,e);var t,n,r=w(a);function a(){var e;return l(this,a),(e=r.call(this)).outputQueue=new qve,e.lastRead=Promise.resolve({value:null,done:!1}),e}return p(a,[{key:"next",value:(n=c(o().mark((function e(){var t=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.lastRead=this.lastRead.then((function(){return t.serialNext()})),e.abrupt("return",this.lastRead);case 2:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"serialNext",value:(t=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==this.outputQueue.length()){e.next=7;break}return e.next=3,this.pump();case 3:if(e.sent){e.next=5;break}return e.abrupt("return",{value:null,done:!0});case 5:e.next=0;break;case 7:return e.abrupt("return",{value:this.outputQueue.shift(),done:!1});case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),a}(Qve),lme=function(e){d(r,e);var t,n=w(r);function r(e,t){var a;return l(this,r),(a=n.call(this)).upstream=e,a.transform=t,a}return p(r,[{key:"summary",value:function(){return"".concat(this.upstream.summary()," -> Flatmap")}},{key:"pump",value:(t=c(o().mark((function e(){var t,n,r,a,i,s,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.upstream.next();case 2:if(!(t=e.sent).done){e.next=5;break}return e.abrupt("return",!1);case 5:n=y5(t.value),r=this.transform(t.value),a=y5(r),this.outputQueue.pushAll(r),i=O(n);try{for(i.s();!(s=i.n()).done;)g5(u=s.value,a)||u.dispose()}catch(e){i.e(e)}finally{i.f()}return e.abrupt("return",!0);case 12:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),r}(cme),hme=function(e){d(a,e);var t,n,r=w(a);function a(e,t){var n;return l(this,a),(n=r.call(this)).baseErrorHandler=t,n.lastRead=null,n.iterator=null,n.moreIterators=e,n}return p(a,[{key:"summary",value:function(){return"".concat("TODO: fill in upstream of chained summaries"," -> Chained")}},{key:"next",value:(n=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.lastRead=this.readFromChain(this.lastRead),e.abrupt("return",this.lastRead);case 2:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"readFromChain",value:(t=c(o().mark((function e(t){var n,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t;case 2:if(null!=this.iterator){e.next=10;break}return e.next=5,this.moreIterators.next();case 5:if(!(n=e.sent).done){e.next=8;break}return e.abrupt("return",{value:null,done:!0});case 8:this.iterator=n.value,null!=this.baseErrorHandler&&(this.iterator=this.iterator.handleErrors(this.baseErrorHandler));case 10:return e.next=12,this.iterator.next();case 12:if(!(r=e.sent).done){e.next=16;break}return this.iterator=null,e.abrupt("return",this.readFromChain(t));case 16:return e.abrupt("return",r);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),a}(Qve);!function(e){e[e.FAIL=0]="FAIL",e[e.SHORTEST=1]="SHORTEST",e[e.LONGEST=2]="LONGEST"}(Zve||(Zve={}));var pme=function(e){d(a,e);var t,n,r=w(a);function a(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Zve.FAIL;return l(this,a),(t=r.call(this)).iterators=e,t.mismatchMode=n,t.count=0,t.currentPromise=null,t}return p(a,[{key:"summary",value:function(){return"{".concat("TODO: fill in upstream of zip summaries","} -> Zip")}},{key:"nextState",value:(n=c(o().mark((function e(t){var n,r,a,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=function(e){return e instanceof Qve?{value:e.next().then((function(e){return n++,e.done&&r++,e.value})),recurse:!1}:{value:null,recurse:!0}},e.next=3,t;case 3:return n=0,r=0,e.next=7,Bve(this.iterators,a);case 7:if(i=e.sent,n!==r){e.next=10;break}return e.abrupt("return",{value:null,done:!0});case 10:if(!(r>0)){e.next=16;break}e.t0=this.mismatchMode,e.next=e.t0===Zve.FAIL?14:e.t0===Zve.SHORTEST?15:(e.t0,Zve.LONGEST,16);break;case 14:throw new Error("Zipped streams should have the same length. "+"Mismatched at element ".concat(this.count,"."));case 15:return e.abrupt("return",{value:null,done:!0});case 16:return this.count++,e.abrupt("return",{value:i,done:!1});case 18:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"next",value:(t=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.currentPromise=this.nextState(this.currentPromise),e.abrupt("return",this.currentPromise);case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),a}(Qve),fme=function(e){d(n,e);var t=w(n);function n(e,r){var a;return l(this,n),(a=t.call(this)).upstream=e,a.bufferSize=r,a.buffer=new Hve(r),a}return p(n,[{key:"summary",value:function(){return"".concat(this.upstream.summary()," -> Prefetch")}},{key:"refill",value:function(){for(;!this.buffer.isFull();){var e=this.upstream.next();this.buffer.push(e)}}},{key:"next",value:function(){return this.refill(),this.buffer.shift()}}]),n}(Qve),dme=function(e){d(a,e);var t,n,r=w(a);function a(e,t,n){var i;return l(this,a),(i=r.call(this,e,t)).upstream=e,i.windowSize=t,i.upstreamExhausted=!1,i.random=Pee.alea(n||z4().toString()),i.lastRead=Promise.resolve({value:null,done:!1}),i}return p(a,[{key:"next",value:(n=c(o().mark((function e(){var t=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.lastRead=this.lastRead.then((function(){return t.serialNext()})),e.abrupt("return",this.lastRead);case 2:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"randomInt",value:function(e){return Math.floor(this.random()*e)}},{key:"chooseIndex",value:function(){return this.randomInt(this.buffer.length())}},{key:"serialNext",value:(t=c(o().mark((function e(){var t,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.upstreamExhausted||this.refill();case 1:if(this.buffer.isEmpty()){e.next=14;break}return t=this.chooseIndex(),e.next=5,this.buffer.shuffleExcise(t);case 5:if(!(n=e.sent).done){e.next=10;break}this.upstreamExhausted=!0,e.next=12;break;case 10:return this.refill(),e.abrupt("return",n);case 12:e.next=1;break;case 14:return e.abrupt("return",{value:null,done:!0});case 15:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),a}(fme),vme=function(){function e(){l(this,e),this.size=null}var t,n;return p(e,[{key:"batch",value:function(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this;return F$(e>0,(function(){return"batchSize needs to be positive, but it is\n ".concat(e)})),t=this.size===1/0||null==this.size?this.size:n?Math.ceil(this.size/e):Math.floor(this.size/e),mme(c(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.iterator();case 2:return t.abrupt("return",t.sent.columnMajorBatch(e,n,gme));case 3:case"end":return t.stop()}}),t)}))),t)}},{key:"concatenate",value:function(e){var t,n=this;return t=this.size===1/0||e.size===1/0?1/0:null!=this.size&&null!=e.size?this.size+e.size:null,mme(c(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.iterator();case 2:return t.t0=t.sent,t.next=5,e.iterator();case 5:return t.t1=t.sent,t.abrupt("return",t.t0.concatenate.call(t.t0,t.t1));case 7:case"end":return t.stop()}}),t)}))),t)}},{key:"filter",value:function(e){var t,n=this;return t=this.size===1/0?1/0:null,mme(c(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.iterator();case 2:return t.abrupt("return",t.sent.filter((function(t){return e8((function(){return e(t)}))})));case 3:case"end":return t.stop()}}),t)}))),t)}},{key:"forEachAsync",value:(n=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.iterator();case 2:return e.abrupt("return",e.sent.forEachAsync(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"map",value:function(e){var t=this;return mme(c(o().mark((function n(){return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.iterator();case 2:return n.abrupt("return",n.sent.map((function(t){return e8((function(){return e(t)}))})));case 3:case"end":return n.stop()}}),n)}))),this.size)}},{key:"mapAsync",value:function(e){var t=this;return mme(c(o().mark((function n(){return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.iterator();case 2:return n.abrupt("return",n.sent.mapAsync(e));case 3:case"end":return n.stop()}}),n)}))),this.size)}},{key:"prefetch",value:function(e){if(null==e)throw new RangeError("`Dataset.prefetch()` requires bufferSize to be specified.");var t=this;return mme(c(o().mark((function n(){return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.iterator();case 2:return n.abrupt("return",n.sent.prefetch(e));case 3:case"end":return n.stop()}}),n)}))),this.size)}},{key:"repeat",value:function(e){var t,n=this;return t=null!=this.size&&e>0?this.size*e:0===e?0:null!=this.size&&(void 0===e||e<0)?1/0:null,mme(c(o().mark((function t(){var r;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=Xve(c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.iterator();case 2:return e.t0=e.sent,e.abrupt("return",{value:e.t0,done:!1});case 4:case"end":return e.stop()}}),e)})))),t.abrupt("return",Yve(r.take(e)));case 2:case"end":return t.stop()}}),t)}))),t)}},{key:"skip",value:function(e){var t,n=this;return t=null!=this.size&&e>=0&&this.size>=e?this.size-e:null!=this.size&&(this.size<e||void 0===e||e<0)?0:null,mme(c(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.iterator();case 2:return t.abrupt("return",t.sent.skip(e));case 3:case"end":return t.stop()}}),t)}))),t)}},{key:"shuffle",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(null==e||e<0)throw null==this.size?new RangeError("`Dataset.shuffle()` requires bufferSize to be specified."):new RangeError("`Dataset.shuffle()` requires bufferSize to be specified. If your data fits in main memory (for regular JS objects), and/or GPU memory (for `tf.Tensor`s), consider setting "+"bufferSize to the dataset size (".concat(this.size," elements)"));var r=this,a=Pee.alea(t||z4().toString());return mme(c(o().mark((function t(){var i;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=a.int32(),n&&(i+=a.int32()),t.next=4,r.iterator();case 4:return t.abrupt("return",t.sent.shuffle(e,i.toString()));case 5:case"end":return t.stop()}}),t)}))),this.size)}},{key:"take",value:function(e){var t,n=this;return t=null!=this.size&&this.size>e?e:null!=this.size&&this.size<=e?this.size:null,mme(c(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.iterator();case 2:return t.abrupt("return",t.sent.take(e));case 3:case"end":return t.stop()}}),t)}))),t)}},{key:"toArray",value:function(){var e=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.size!==1/0){e.next=2;break}throw new Error("Can not convert infinite data stream to array.");case 2:return e.next=4,this.iterator();case 4:return e.abrupt("return",e.sent.toArray());case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"toArrayForTest",value:(t=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.size!==1/0){e.next=2;break}throw new Error("Can not convert infinite data stream to array.");case 2:return e.next=4,this.iterator();case 4:return e.abrupt("return",e.sent.toArrayForTest());case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}();function mme(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return new(function(n){d(i,n);var r,a=w(i);function i(){var e;return l(this,i),(e=a.apply(this,arguments)).size=t,e}return p(i,[{key:"iterator",value:(r=c(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e());case 1:case"end":return t.stop()}}),t)}))),function(){return r.apply(this,arguments)})}]),i}(vme))}function gme(e){return null===e?null:Uve(e[0])?{value:function(e){if(0===e.length)throw new Error("Can't make a batch of zero elements.");return e[0]instanceof n5?Rte(e):U5(e)}(e),recurse:!1}:{value:null,recurse:!0}}vme.MAX_BUFFER_SIZE=1e4;var yme=function(e){d(r,e);var t,n=w(r);function r(e){var t;return l(this,r),(t=n.call(this)).input=e,t}return p(r,[{key:"iterator",value:(t=c(o().mark((function e(){var t,n,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.input.iterator();case 2:return t=e.sent,n=t.decodeUTF8(),r=n.split("\n").map((function(e){return e.endsWith("\r")&&(e=e.slice(0,-1)),e})),e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),r}(vme),bme='"',xme=Symbol("out"),kme=Symbol("field"),wme=Symbol("quote"),Ime=Symbol("quoteafterquote"),Nme=Symbol("quoteinquote"),Sme=function(e){d(s,e);var t,n,r,a,i=w(s);function s(e,t){var n;return l(this,s),(n=i.call(this)).input=e,n.hasHeader=!0,n.fullColumnNames=null,n.columnNamesValidated=!1,n.columnConfigs=null,n.configuredColumnsOnly=!1,n.delimiter=",",n.delimWhitespace=!1,n.base=new yme(e),t||(t={}),n.hasHeader=!1!==t.hasHeader,n.fullColumnNames=t.columnNames,n.columnConfigs=t.columnConfigs,n.configuredColumnsOnly=t.configuredColumnsOnly,t.delimWhitespace?(F$(null==t.delimiter,(function(){return"Delimiter should not be provided when delimWhitespace is true."})),n.delimWhitespace=!0,n.delimiter=" "):n.delimiter=t.delimiter?t.delimiter:",",n}return p(s,[{key:"columnNames",value:(a=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.columnNamesValidated){e.next=3;break}return e.next=3,this.setColumnNames();case 3:return e.abrupt("return",this.configuredColumnsOnly?Object.keys(this.columnConfigs):this.fullColumnNames);case 4:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"setColumnNames",value:(r=c(o().mark((function e(){var t,n,r,a,i,s,u=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.maybeReadHeaderLine();case 2:if(t=e.sent,this.fullColumnNames||t){e.next=7;break}throw new Error("Column names must be provided if there is no header line.");case 7:this.fullColumnNames&&t&&F$(t.length===this.fullColumnNames.length,(function(){return"The length of provided columnNames ("+u.fullColumnNames.length.toString()+") does not match the length of the header line read from file ("+t.length.toString()+")."}));case 8:if(this.fullColumnNames||(this.fullColumnNames=t),n=this.fullColumnNames.reduce((function(e,t){return e[t]=e[t]+1||1,e}),{}),F$(0===(r=Object.keys(n).filter((function(e){return n[e]>1}))).length,(function(){return"Duplicate column names found: "+r.toString()})),!this.columnConfigs){e.next=22;break}a=0,i=Object.keys(this.columnConfigs);case 14:if(!(a<i.length)){e.next=22;break}if(s=i[a],-1!==this.fullColumnNames.indexOf(s)){e.next=19;break}throw new Error('The key "'+s+'" provided in columnConfigs does not match any of the column names ('+this.fullColumnNames.toString()+").");case 19:a++,e.next=14;break;case 22:this.columnNamesValidated=!0;case 23:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"maybeReadHeaderLine",value:(n=c(o().mark((function e(){var t,n,r,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.hasHeader){e.next=14;break}return e.next=3,this.base.iterator();case 3:return t=e.sent,e.next=6,t.next();case 6:if(!(n=e.sent).done){e.next=9;break}throw new Error("No data was found for CSV parsing.");case 9:return r=n.value,a=this.parseRow(r,!1),e.abrupt("return",a);case 14:return e.abrupt("return",null);case 15:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"iterator",value:(t=c(o().mark((function e(){var t,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.columnNamesValidated){e.next=3;break}return e.next=3,this.setColumnNames();case 3:return e.next=5,this.base.iterator();case 5:return t=e.sent,this.hasHeader&&(t=t.skip(1)),e.abrupt("return",t.map((function(e){return n.makeDataElement(e)})));case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"makeDataElement",value:function(e){for(var t=this.parseRow(e),n={},r={},a=0;a<this.fullColumnNames.length;a++){var i=this.fullColumnNames[a],o=this.columnConfigs?this.columnConfigs[i]:null;if(!this.configuredColumnsOnly||o){var s=t[a],u=null;if(""===s)if(o&&void 0!==o.default)u=o.default;else{if(o&&(o.required||o.isLabel))throw new Error("Required column ".concat(i," is empty in this line: ").concat(e));u=void 0}else{var c=Number(s);if(isNaN(c))u=o&&"bool"===o.dtype?this.getBoolean(s):s;else if(o&&o.dtype)switch(o.dtype){case"float32":default:u=c;break;case"int32":u=Math.floor(c);break;case"bool":u=this.getBoolean(s)}else u=c}o&&o.isLabel?r[i]=u:n[i]=u}}return 0===Object.keys(r).length?n:{xs:n,ys:r}}},{key:"getBoolean",value:function(e){return"1"===e||"true"===e.toLowerCase()?1:0}},{key:"parseRow",value:function(e){for(var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=[],r=0,a=e.length,i=xme,o=0;o<a;o++)switch(i){case xme:switch(e.charAt(o)){case bme:r=o+1,i=wme;break;case this.delimiter:if(r=o+1," "===this.delimiter&&this.delimWhitespace)break;n.push(""),i=xme;break;default:i=kme,r=o}break;case kme:if(e.charAt(o)===this.delimiter)n.push(e.substring(r,o)),i=xme,r=o+1;break;case wme:if(e.charAt(o)===bme)i=Ime;break;case Ime:switch(e.charAt(o)){case this.delimiter:n.push(e.substring(r,o-1)),i=xme,r=o+1;break;case bme:i=wme;break;default:i=Nme}break;case Nme:if(e.charAt(o)===bme)i=wme}if(i===Ime?n.push(e.substring(r,a-1)):n.push(e.substring(r)),t&&n.length!==this.fullColumnNames.length)throw new Error("Invalid row in csv file. Should have ".concat(this.fullColumnNames.length," elements in a row, but got ").concat(n));return n}}]),s}(vme),Tme=function(e){d(u,e);var t,n,r,a,i,s=w(u);function u(e){var t;l(this,u),(t=s.call(this)).microphoneConfig=e,t.isClosed=!1,t.fftSize=e.fftSize||1024;var n=Math.log2(t.fftSize);if(t.fftSize<0||n<4||n>14||!Number.isInteger(n))throw new Error("Invalid fftSize: it must be a power of 2 between "+"2 to 4 and 2 to 14, but got ".concat(t.fftSize));if(t.numFrames=e.numFramesPerSpectrogram||43,t.sampleRateHz=e.sampleRateHz,t.columnTruncateLength=e.columnTruncateLength||t.fftSize,t.audioTrackConstraints=e.audioTrackConstraints,t.smoothingTimeConstant=e.smoothingTimeConstant||0,t.includeSpectrogram=!1!==e.includeSpectrogram,t.includeWaveform=!0===e.includeWaveform,!t.includeSpectrogram&&!t.includeWaveform)throw new Error("Both includeSpectrogram and includeWaveform are false. At least one type of data should be returned.");return t}return p(u,[{key:"summary",value:function(){return"microphone"}},{key:"start",value:(i=c(o().mark((function e(){var t,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,navigator.mediaDevices.getUserMedia({audio:null==this.audioTrackConstraints||this.audioTrackConstraints,video:!1});case 3:this.stream=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new Error("Error thrown while initializing video stream: ".concat(e.t0.message));case 9:if(this.stream){e.next=11;break}throw new Error("Could not obtain audio from microphone.");case 11:if(t=window.AudioContext||window.webkitAudioContext,this.audioContext=new t,this.sampleRateHz){e.next=17;break}this.sampleRateHz=this.audioContext.sampleRate,e.next=19;break;case 17:if(this.audioContext.sampleRate===this.sampleRateHz){e.next=19;break}throw new Error("Mismatch in sampling rate: "+"Expected: ".concat(this.sampleRateHz,"; ")+"Actual: ".concat(this.audioContext.sampleRate));case 19:return n=this.audioContext.createMediaStreamSource(this.stream),this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2*this.fftSize,this.analyser.smoothingTimeConstant=this.smoothingTimeConstant,n.connect(this.analyser),this.freqData=new Float32Array(this.fftSize),this.timeData=new Float32Array(this.fftSize),e.abrupt("return");case 27:case"end":return e.stop()}}),e,this,[[0,6]])}))),function(){return i.apply(this,arguments)})},{key:"next",value:(a=c(o().mark((function e(){var t,n,r,a,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isClosed){e.next=2;break}return e.abrupt("return",{value:null,done:!0});case 2:return e.next=4,this.getAudioData();case 4:return r=e.sent,this.includeSpectrogram&&(a=this.flattenQueue(r.freqDataQueue),t=this.getTensorFromAudioDataArray(a,[this.numFrames,this.columnTruncateLength,1])),this.includeWaveform&&(i=this.flattenQueue(r.timeDataQueue),n=this.getTensorFromAudioDataArray(i,[this.numFrames*this.fftSize,1])),e.abrupt("return",{value:{spectrogram:t,waveform:n},done:!1});case 8:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"capture",value:(r=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.next();case 2:return e.abrupt("return",e.sent.value);case 3:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getAudioData",value:(n=c(o().mark((function e(){var t,n,r,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],n=[],r=0,e.abrupt("return",new Promise((function(e){var i=setInterval((function(){a.includeSpectrogram&&(a.analyser.getFloatFrequencyData(a.freqData),a.freqData[0]===-1/0&&e({freqDataQueue:t,timeDataQueue:n}),t.push(a.freqData.slice(0,a.columnTruncateLength))),a.includeWaveform&&(a.analyser.getFloatTimeDomainData(a.timeData),n.push(a.timeData.slice())),++r===a.numFrames&&(clearInterval(i),e({freqDataQueue:t,timeDataQueue:n}))}),a.fftSize/a.sampleRateHz*1e3)})));case 4:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})},{key:"stop",value:function(){this.isClosed||(this.isClosed=!0,this.analyser.disconnect(),this.audioContext.close(),null!=this.stream&&this.stream.getTracks().length>0&&this.stream.getTracks()[0].stop())}},{key:"toArray",value:function(){throw new Error("Can not convert infinite audio stream to array.")}},{key:"getSampleRate",value:function(){return this.sampleRateHz}},{key:"flattenQueue",value:function(e){var t=e[0].length,n=new Float32Array(e.length*t);return e.forEach((function(e,r){return n.set(e,r*t)})),n}},{key:"getTensorFromAudioDataArray",value:function(e,t){var n=new Float32Array(L$(t));return n.set(e,n.length-e.length),U5(n,t)}}],[{key:"create",value:(t=c(o().mark((function e(){var t,n,r=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=r.length>0&&void 0!==r[0]?r[0]:{},k0().get("IS_BROWSER")){e.next=3;break}throw new Error("microphone API is only supported in browser environment.");case 3:return n=new u(t),e.next=6,n.start();case 6:return e.abrupt("return",n);case 7:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})}]),u}(Qve),Eme=function(e){d(s,e);var t,n,r,a,i=w(s);function s(e,t){var n;if(l(this,s),(n=i.call(this)).webcamVideoElement=e,n.webcamConfig=t,n.isClosed=!0,n.resize=!1,n.needToResize())if(n.resize=!0,n.cropSize=[n.webcamConfig.resizeHeight,n.webcamConfig.resizeWidth],n.cropBoxInd=Dte([0],"int32"),n.webcamConfig.centerCrop){var r=1*n.webcamConfig.resizeWidth/n.webcamVideoElement.width,a=1*n.webcamConfig.resizeHeight/n.webcamVideoElement.height,o=(1-r)/2,u=(1-a)/2,c=o+r,h=a+u;n.cropBox=Mte([u,o,h,c],[1,4])}else n.cropBox=Mte([0,0,1,1],[1,4]);return n}return p(s,[{key:"summary",value:function(){return"webcam"}},{key:"start",value:(a=c(o().mark((function e(){var t=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.webcamConfig.facingMode&&F$("user"===this.webcamConfig.facingMode||"environment"===this.webcamConfig.facingMode,(function(){return"Invalid webcam facing mode: ".concat(t.webcamConfig.facingMode,". ")+"Please provide 'user' or 'environment'"})),e.prev=1,e.next=4,navigator.mediaDevices.getUserMedia({video:{deviceId:this.webcamConfig.deviceId,facingMode:this.webcamConfig.facingMode?this.webcamConfig.facingMode:"user",width:this.webcamVideoElement.width,height:this.webcamVideoElement.height}});case 4:this.stream=e.sent,e.next=11;break;case 7:throw e.prev=7,e.t0=e.catch(1),e.t0.message="Error thrown while initializing video stream: ".concat(e.t0.message),e.t0;case 11:if(this.stream){e.next=13;break}throw new Error("Could not obtain video from webcam.");case 13:try{this.webcamVideoElement.srcObject=this.stream}catch(e){console.log(e),this.webcamVideoElement.src=window.URL.createObjectURL(this.stream)}return this.webcamVideoElement.play(),this.isClosed=!1,e.abrupt("return",new Promise((function(e){t.webcamVideoElement.onloadedmetadata=function(){e()}})));case 17:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(){return a.apply(this,arguments)})},{key:"next",value:(r=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isClosed){e.next=2;break}return e.abrupt("return",{value:null,done:!0});case 2:e.prev=2,t=kae(this.webcamVideoElement),e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(2),new Error("Error thrown converting video to pixels: ".concat(JSON.stringify(e.t0)));case 9:if(!this.resize){e.next=22;break}return e.prev=10,e.abrupt("return",{value:this.cropAndResizeFrame(t),done:!1});case 14:throw e.prev=14,e.t1=e.catch(10),new Error("Error thrown cropping the video: ".concat(e.t1.message));case 17:return e.prev=17,t.dispose(),e.finish(17);case 20:e.next=23;break;case 22:return e.abrupt("return",{value:t,done:!1});case 23:case"end":return e.stop()}}),e,this,[[2,6],[10,14,17,20]])}))),function(){return r.apply(this,arguments)})},{key:"needToResize",value:function(){return!(!this.webcamConfig.resizeWidth||!this.webcamConfig.resizeHeight||this.webcamVideoElement.width===this.webcamConfig.resizeWidth&&this.webcamVideoElement.height===this.webcamConfig.resizeHeight)}},{key:"cropAndResizeFrame",value:function(e){var t=this;return e8((function(){var n,r=i9(X6(e,"float32"),0),a=(n=Are.cropAndResize(r,t.cropBox,t.cropBoxInd,t.cropSize,"bilinear")).shape;return W8(n,a.slice(1))}))}},{key:"capture",value:(n=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.next();case 2:return e.abrupt("return",e.sent.value);case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"stop",value:function(){this.stream.getTracks().forEach((function(e){return e.stop()}));try{this.webcamVideoElement.srcObject=null}catch(e){console.log(e),this.webcamVideoElement.src=null}this.isClosed=!0}},{key:"toArray",value:function(){throw new Error("Can not convert infinite video stream to array.")}}],[{key:"create",value:(t=c(o().mark((function e(t){var n,r,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.length>1&&void 0!==a[1]?a[1]:{},k0().get("IS_BROWSER")){e.next=3;break}throw new Error("tf.data.webcam is only supported in browser environment.");case 3:if(t){e.next=9;break}if(t=document.createElement("video"),n.resizeWidth&&n.resizeHeight){e.next=7;break}throw new Error("Please provide webcam video element, or resizeWidth and resizeHeight to create a hidden video element.");case 7:t.width=n.resizeWidth,t.height=n.resizeHeight;case 9:return r=new s(t,n),e.next=12,r.start();case 12:return e.abrupt("return",r);case 13:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),s}(Qve),Cme=p((function e(){l(this,e)})),Ame=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"split",value:function(e){return new Rme(this,e)}}]),n}(Qve),Rme=function(e){d(r,e);var t,n=w(r);function r(e,t){var a;return l(this,r),(a=n.call(this)).upstream=e,a.impl=new _me(e,t),a}return p(r,[{key:"summary",value:function(){return this.impl.summary()}},{key:"next",value:(t=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.impl.next());case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),r}(Ame),_me=function(e){d(r,e);var t,n=w(r);function r(e,t){var a;return l(this,r),(a=n.call(this)).upstream=e,a.separator=t,a.carryover="",a}return p(r,[{key:"summary",value:function(){return"".concat(this.upstream.summary()," -> Split('").concat(this.separator,"')")}},{key:"pump",value:(t=c(o().mark((function e(){var t,n,r,a,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.upstream.next();case 2:if(!(t=e.sent).done){e.next=9;break}if(""!==this.carryover){e.next=6;break}return e.abrupt("return",!1);case 6:return this.outputQueue.push(this.carryover),this.carryover="",e.abrupt("return",!0);case 9:(n=t.value.split(this.separator))[0]=this.carryover+n[0],r=O(n.slice(0,-1));try{for(r.s();!(a=r.n()).done;)i=a.value,this.outputQueue.push(i)}catch(e){r.e(e)}finally{r.f()}return this.carryover=n[n.length-1],e.abrupt("return",!0);case 15:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),r}(cme),Ome=function(e){d(n,e);var t=w(n);function n(){return l(this,n),t.apply(this,arguments)}return p(n,[{key:"decodeUTF8",value:function(){return new Fme(this)}}]),n}(Qve),Fme=function(e){d(r,e);var t,n=w(r);function r(e){var t;return l(this,r),(t=n.call(this)).upstream=e,t.impl=new Dme(e),t}return p(r,[{key:"summary",value:function(){return this.impl.summary()}},{key:"next",value:(t=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.impl.next());case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),r}(Ame),Dme=function(e){d(r,e);var t,n=w(r);function r(e){var t;if(l(this,r),(t=n.call(this)).upstream=e,k0().get("IS_BROWSER"))t.decoder=new TextDecoder("utf-8");else{var a=require("string_decoder").StringDecoder;t.decoder=new a("utf8")}return t}return p(r,[{key:"summary",value:function(){return"".concat(this.upstream.summary()," -> Utf8")}},{key:"pump",value:(t=c(o().mark((function e(){var t,n,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.upstream.next();case 2:if(!(t=e.sent).done){e.next=7;break}return e.abrupt("return",!1);case 7:n=t.value;case 8:return r=k0().get("IS_BROWSER")?this.decoder.decode(n,{stream:!0}):this.decoder.write(Buffer.from(n.buffer)),this.outputQueue.push(r),e.abrupt("return",!0);case 11:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),r}(cme),Mme=function(e){d(r,e);var t,n=w(r);function r(e){var t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return l(this,r),(t=n.call(this)).file=e,t.options=a,F$(e instanceof Uint8Array||!!k0().get("IS_BROWSER")&&(e instanceof File||e instanceof Blob),(function(){return"FileChunkIterator only supports File, Blob and Uint8Array right now."})),t.offset=a.offset||0,t.chunkSize=a.chunkSize||1048576,t}return p(r,[{key:"summary",value:function(){return"FileChunks ".concat(this.file)}},{key:"next",value:(t=c(o().mark((function e(){var t,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this.offset>=(this.file instanceof Uint8Array?this.file.byteLength:this.file.size))){e.next=2;break}return e.abrupt("return",{value:null,done:!0});case 2:return t=new Promise((function(e,t){var r=n.offset+n.chunkSize;if(n.file instanceof Uint8Array)e(new Uint8Array(n.file.slice(n.offset,r)));else{var a=new FileReader;a.onload=function(n){var r=a.result;if(r instanceof ArrayBuffer&&(r=new Uint8Array(r)),!(r instanceof Uint8Array))return t(new TypeError("FileReader returned unknown type."));e(r)},a.onabort=function(e){return t(new Error("Aborted"))},a.onerror=function(e){return t(new Error(e.type))};var i=n.file.slice(n.offset,r);a.readAsArrayBuffer(i)}n.offset=r})),e.next=5,t;case 5:return e.t0=e.sent,e.abrupt("return",{value:e.t0,done:!1});case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),r}(Ome);function Lme(e){return zme.apply(this,arguments)}function zme(){return zme=c(o().mark((function e(t){var n,r,a,i,s,u,c=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=c.length>1&&void 0!==c[1]?c[1]:{},r=c.length>2?c[2]:void 0,"string"==typeof t?a=t:(a=t.url,i=Pme(t)),e.next=5,(r||P4)(a,i);case 5:if(!(s=e.sent).ok){e.next=15;break}return e.t0=Uint8Array,e.next=10,s.arrayBuffer();case 10:return e.t1=e.sent,u=new e.t0(e.t1),e.abrupt("return",new Mme(u,n));case 15:throw new Error(s.statusText);case 16:case"end":return e.stop()}}),e)}))),zme.apply(this,arguments)}var Pme=function(e){return{method:e.method,headers:e.headers,body:e.body,mode:e.mode,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,integrity:e.integrity}};function Bme(e){return"string"==typeof e&&"file://"===e.slice(0,7)}var Wme=function(e){d(r,e);var t,n=w(r);function r(e){var t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return l(this,r),(t=n.call(this)).input=e,t.options=a,t}return p(r,[{key:"iterator",value:(t=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Bme(this.input)&&k0().get("IS_NODE")&&(t=require("fs"),this.input=t.readFileSync(this.input.slice(7))),e.abrupt("return",new Mme(this.input,this.options));case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),r}(Cme),Vme=function(e){d(r,e);var t,n=w(r);function r(e){var t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return l(this,r),(t=n.call(this)).url=e,t.fileOptions=a,t}return p(r,[{key:"iterator",value:(t=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Bme(this.url)){e.next=4;break}return e.abrupt("return",new Wme(this.url,this.fileOptions).iterator());case 4:return e.abrupt("return",Lme(this.url,this.fileOptions));case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),r}(Cme);function Ume(){return(Ume=c(o().mark((function e(t,n){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Eme.create(t,n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Gme(){return(Gme=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Tme.create(t));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var jme="4.6.0",Hme={__proto__:null,CSVDataset:Sme,Dataset:vme,FileDataSource:Wme,TextLineDataset:yme,URLDataSource:Vme,array:function(e){return mme(c(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Kve(e));case 1:case"end":return t.stop()}}),t)}))),e.length)},csv:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Sme(new Vme(e),t)},func:function(e){var t=Xve(e);return mme(c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t);case 1:case"end":return e.stop()}}),e)}))))},generator:function(e){return mme(c(o().mark((function t(){var n;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e();case 2:return n=t.sent,t.abrupt("return",Xve((function(){return n.next()})));case 4:case"end":return t.stop()}}),t)}))))},microphone:function(e){return Gme.apply(this,arguments)},version_data:jme,webcam:function(e,t){return Ume.apply(this,arguments)},zip:function(e){if(!Vve(e))throw new Error("The argument to zip() must be an object or array.");var t;if(Array.isArray(e))for(var n=0;n<e.length;n++)t=null==t?e[n].size:Math.min(t,e[n].size);else if(e instanceof Object)for(var r in e)t=null==t?e[r].size:Math.min(t,e[r].size);return mme(c(o().mark((function t(){var n;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Bve(e,(function(e){if(e instanceof vme)return{value:e.iterator(),recurse:!1};if(Vve(e))return{value:null,recurse:!0};throw new Error("Leaves of the structure passed to zip() must be Datasets, not primitives.")}));case 2:return n=t.sent,t.abrupt("return",Jve(n,Zve.SHORTEST));case 4:case"end":return t.stop()}}),t)}))),t)}};function qme(e,t){Array.isArray(e)||(e=[e]),e.forEach((function(e){null!=e&&F$("complex64"!==e.dtype,(function(){return"".concat(t," does not support complex64 tensors in the CPU backend.")}))}))}var Kme=Qte,Xme=function(e){d(a,e);var t,n,r=w(a);function a(){var e;return l(this,a),(e=r.call(this)).blockSize=48,e.firstUse=!0,e.data=new S$(x(e),Q6()),e}return p(a,[{key:"nextDataId",value:function(){return a.nextDataId++}},{key:"write",value:function(e,t,n){this.firstUse&&(this.firstUse=!1,k0().get("IS_NODE")&&z3("\n============================\nHi, looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, visit https://github.com/tensorflow/tfjs-node for more details. \n============================"));var r={id:this.nextDataId()};return this.data.set(r,{values:e,dtype:n,refCount:1}),r}},{key:"makeTensorInfo",value:function(e,t,n){var r;if("string"===t&&null!=n&&n.length>0&&$$(n[0])){var a=n.map((function(e){return B4(e)}));r=this.write(a,e,t)}else r=this.write(n,e,t);return{dataId:r,shape:e,dtype:t}}},{key:"refCount",value:function(e){return this.data.has(e)?this.data.get(e).refCount:0}},{key:"incRef",value:function(e){this.data.get(e).refCount++}},{key:"decRef",value:function(e){this.data.has(e)&&this.data.get(e).refCount--}},{key:"move",value:function(e,t,n,r,a){this.data.set(e,{values:t,dtype:r,refCount:a})}},{key:"numDataIds",value:function(){return this.data.numDataIds()}},{key:"read",value:(n=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.readSync(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"readSync",value:function(e){var t=this.data.get(e),n=t.dtype,r=t.complexTensorInfos;return"complex64"===n?die(this.readSync(r.real.dataId),this.readSync(r.imag.dataId)):u0(this.data.get(e).values,n)}},{key:"bufferSync",value:function(e){var t=this.readSync(e.dataId);if("string"===e.dtype)try{var n=t.map((function(e){return W4(e)}));return K6(e.shape,e.dtype,n)}catch(e){throw new Error("Failed to decode encoded string bytes into utf-8")}return K6(e.shape,e.dtype,t)}},{key:"makeOutput",value:function(e,t,n){return Q6().makeTensorFromTensorInfo(this.makeTensorInfo(t,n,e),this)}},{key:"disposeData",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.data.has(e)){if(this.data.get(e).refCount--,!t&&this.data.get(e).refCount>0)return!1;var n=this.data.get(e),r=n.complexTensorInfos;null!=r&&(this.disposeData(r.real.dataId,!0),this.disposeData(r.imag.dataId,!0)),this.data.delete(e)}return!0}},{key:"disposeIntermediateTensorInfo",value:function(e){this.disposeData(e.dataId)}},{key:"time",value:(t=c(o().mark((function e(t){var n,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=z4(),t(),r=z4()-n,e.abrupt("return",{kernelMs:r});case 4:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"memory",value:function(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}}},{key:"where",value:function(e){qme([e],"where");var t=this.readSync(e.dataId);return Kme(e.shape,t)}},{key:"dispose",value:function(){}},{key:"floatPrecision",value:function(){return 32}},{key:"epsilon",value:function(){return N(v(a.prototype),"epsilon",this).call(this)}}]),a}(T$);function Yme(e){for(var t=new Float32Array(e.length),n=0;n<e.length;++n)t[n]=Math.abs(e[n]);return t}Xme.nextDataId=0;var Jme={kernelName:N0,backendName:"cpu",kernelFunc:function(e){var t=e.inputs.x,n=e.backend;qme(t,"abs");var r=new Float32Array(L$(t.shape));return r=Yme(n.data.get(t.dataId).values),n.makeOutput(r,t.shape,t.dtype)}};function Zme(e){return function(t,n,r,a,i){var o=A7(t,n),s=o.length,u=i0(o),c=q$(i,L$(o)),l=t.length,h=n.length,p=i0(t),f=i0(n),d=E7(t,o),v=E7(n,o);if(d.length+v.length===0)for(var m=0;m<c.length;++m)c[m]=e(r[m%r.length],a[m%a.length]);else for(var g=function(){var t=d0(y,s,u),n=t.slice(-l);d.forEach((function(e){return n[e]=0}));var i=f0(n,l,p),o=t.slice(-h);v.forEach((function(e){return o[e]=0}));var m=f0(o,h,f);c[y]=e(r[i],a[m])},y=0;y<c.length;++y)g();return[c,o]}}function Qme(e){var t=e.inputs,n=e.backend,r=t.real,a=t.imag,i=n.data.get(r.dataId).values,o=n.data.get(a.dataId).values,s=n.makeTensorInfo(r.shape,"complex64");return n.data.get(s.dataId).complexTensorInfos={real:n.makeTensorInfo(r.shape,"float32",i),imag:n.makeTensorInfo(a.shape,"float32",o)},s}var $me={kernelName:Z0,backendName:"cpu",kernelFunc:Qme};function ege(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"float32";if("complex64"===n){var r=ege(e,t,"float32"),a=ege(e,t,"float32");return Qme({inputs:{real:r,imag:a},backend:e})}var i=l0(L$(t),n);return e.makeTensorInfo(t,n,i)}function tge(e){var t=e.inputs,n=e.backend,r=t.x;return n.incRef(r.dataId),{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}var nge={kernelName:W1,backendName:"cpu",kernelFunc:tge};function rge(e){var t=e.inputs,n=e.backend,r=t.input,a=n.data.get(r.dataId).complexTensorInfos.real,i=n.data.get(a.dataId).values;return n.makeTensorInfo(a.shape,a.dtype,i)}var age={kernelName:D2,backendName:"cpu",kernelFunc:rge};function ige(e,t,n,r){if("int32"===r)return[t,"int32",Int32Array.from(e)];if("bool"===r){var a=L4([0],n),i=S(Zme((function(e,t){return e!==t?1:0}))(t,[],e,a,"bool"),2),o=i[0];return[i[1],"bool",o]}throw new Error("Error in Cast: failed to cast ".concat(n," to ").concat(r))}function oge(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.dtype;if("complex64"===i){if("complex64"===a.dtype)return tge({inputs:{x:a},backend:n});var o=ege(n,a.shape,a.dtype),s=oge({inputs:{x:a},backend:n,attrs:{dtype:"float32"}}),u=Qme({inputs:{real:s,imag:o},backend:n});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(s),u}if("complex64"===a.dtype){var c=rge({inputs:{input:a},backend:n}),l=oge({inputs:{x:c},backend:n,attrs:{dtype:i}});return n.disposeIntermediateTensorInfo(c),l}if(!J$(a.dtype,i)){var h=tge({inputs:{x:a},backend:n});return{dataId:h.dataId,shape:h.shape,dtype:i}}var p=S(ige(n.data.get(a.dataId).values,a.shape,a.dtype,i),3),f=p[0],d=p[1],v=p[2];return n.makeTensorInfo(f,d,v)}var sge={kernelName:X0,backendName:"cpu",kernelFunc:oge};function uge(e,t,n,r){return null==n?function(n){var a=n.inputs,i=n.backend,o=a.a,s=a.b,u=i;qme([o,s],e);var c=u.data.get(o.dataId).values,l=u.data.get(s.dataId).values,h="string"===o.dtype?qie(c):c,p="string"===o.dtype?qie(l):l,f=r||o.dtype,d=S(t(o.shape,s.shape,h,p,f),2),v=d[0],m=d[1];return u.makeTensorInfo(m,f,v)}:function(e){var a=e.inputs,i=e.backend,o=a.a,s=a.b,u=i;if("complex64"===o.dtype||"complex64"===s.dtype){var c=oge({inputs:{x:o},backend:u,attrs:{dtype:"complex64"}}),l=u.data.get(c.dataId),h=l.complexTensorInfos.real,p=l.complexTensorInfos.imag,f=u.data.get(h.dataId).values,d=u.data.get(p.dataId).values,v=oge({inputs:{x:s},backend:u,attrs:{dtype:"complex64"}}),m=u.data.get(v.dataId),g=m.complexTensorInfos.real,y=m.complexTensorInfos.imag,b=u.data.get(g.dataId).values,x=u.data.get(y.dataId).values,k=S(n(o.shape,s.shape,f,d,b,x),3),w=k[0],I=k[1],N=k[2],T=u.makeTensorInfo(N,"float32",w),E=u.makeTensorInfo(N,"float32",I),C=Qme({inputs:{real:T,imag:E},backend:u});return u.disposeIntermediateTensorInfo(c),u.disposeIntermediateTensorInfo(v),u.disposeIntermediateTensorInfo(T),u.disposeIntermediateTensorInfo(E),C}var A=u.data.get(o.dataId).values,R=u.data.get(s.dataId).values,_=r||o.dtype,O=S(t(o.shape,s.shape,A,R,_),2),F=O[0],D=O[1];return u.makeTensorInfo(D,_,F)}}function cge(e){return function(t,n,r,a,i,o){var s=A7(t,n),u=L$(s),c=s.length,l=i0(s),h=q$("float32",u),p=q$("float32",u),f=E7(t,s),d=E7(n,s),v=die(r,a),m=die(i,o),g=t.length,y=i0(t),b=n.length,x=i0(n);if(f.length+d.length===0)for(var k=0;k<h.length;k++){var w=k%v.length,I=k%m.length,N=e(v[2*w],v[2*w+1],m[2*I],m[2*I+1]);h[k]=N.real,p[k]=N.imag}else for(var S=function(){var t=d0(T,c,l),n=t.slice(-g);f.forEach((function(e){return n[e]=0}));var r=f0(n,g,y),a=t.slice(-b);d.forEach((function(e){return a[e]=0}));var i=f0(a,b,x),o=e(v[2*r],v[2*r+1],m[2*i],m[2*i+1]);h[T]=o.real,p[T]=o.imag},T=0;T<h.length;T++)S();return[h,p,s]}}var lge=Zme((function(e,t){return e+t})),hge=cge((function(e,t,n,r){return{real:e+n,imag:t+r}})),pge=uge(E0,lge,hge),fge={kernelName:E0,backendName:"cpu",kernelFunc:pge};function dge(e,t,n,r,a){for(var i=L$(r),o=l0(a,n),s=0;s<e.length;s++){var u=e[s];if(u<0)throw new Error("Input x must be non-negative!");u>=a||(o[u]+=i>0?t[s]:1)}return o}function vge(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=e.shape[0],i=e.shape[1],o=K6([a,n],t.dtype),s=0;s<a;s++)for(var u=0;u<i;u++){var c=e.get(s,u);if(c<0)throw new Error("Input x must be non-negative!");c>=n||(r?o.set(1,s,c):t.size>0?o.set(o.get(s,c)+t.get(s,u),s,c):o.set(o.get(s,c)+1,s,c))}return o}var mge=Zme((function(e,t){return e&t})),gge=uge(H0,mge),yge={kernelName:H0,backendName:"cpu",kernelFunc:gge};function bge(e){return function(t,n,r){for(var a=K$(n,t.length),i=0;i<t.length;++i)a[i]=e(t[i],r);return a}}function xge(e,t,n){return kge(e,bge(t),n)}function kge(e,t,n){return function(r){var a=r.inputs,i=r.attrs,o=r.backend,s=a.x;qme(s,e);var u,c=o,l=c.data.get(s.dataId).values;if("string"===s.dtype){if(!Array.isArray(l))throw new Error("String tensor's value was not an instance of Array");u=qie(l)}else u=l;var h=n||s.dtype,p=t(u,h,i);return c.makeTensorInfo(s.shape,h,p)}}var wge=bge((function(e){return Math.ceil(e)})),Ige=kge(Y0,wge),Nge={kernelName:Y0,backendName:"cpu",kernelFunc:Ige};function Sge(e,t,n,r){var a=K$(n,L$(t));if(r&&"string"!==n){var i=0;e.forEach((function(e){var t=L$(e.shape);a.set(e.vals,i),i+=t}))}else{var o=0;e.forEach((function(e){for(var r="string"===n?qie(e.vals):e.vals,i=0,s=0;s<e.shape[0];++s)for(var u=s*t[1]+o,c=0;c<e.shape[1];++c)a[u+c]=r[i++];o+=e.shape[1]}))}return a}var Tge=Zme((function(e,t){return e===t?1:0})),Ege=uge(T1,Tge,null,"bool"),Cge={kernelName:T1,backendName:"cpu",kernelFunc:Ege},Age=bge((function(e){return Math.exp(e)})),Rge=kge(E1,Age,"float32"),_ge={kernelName:E1,backendName:"cpu",kernelFunc:Rge},Oge=bge((function(e){return Math.expm1(e)})),Fge=kge(A1,Oge),Dge={kernelName:A1,backendName:"cpu",kernelFunc:Fge},Mge=bge((function(e){return Math.floor(e)})),Lge=kge(F1,Mge),zge={kernelName:F1,backendName:"cpu",kernelFunc:Lge},Pge=Zme((function(e,t){return Math.floor(e/t)})),Bge=uge(D1,Pge,null,"int32"),Wge={kernelName:D1,backendName:"cpu",kernelFunc:Bge};function Vge(e,t,n,r,a,i,o,s,u){for(var c=K6([r,i],n),l=0;l<r;l++){for(var h=[],p=0,f=0;f<a;f++){var d=e[l*a+f];p+=d*o[f],h.push(d)}if(p<0||p>=u/i)throw new Error("Invalid indices: ".concat(h," does not index into ").concat(s));for(var v=0;v<i;v++)c.values[l*i+v]=t.get.apply(t,T(t.indexToLoc(p*i+v)))}return c}function Uge(e,t,n){for(var r=K6(n,e.dtype),a=0;a<r.size;++a){var i=r.indexToLoc(a).slice(),o=i[0],s=i[2],u=t.locToIndex([o,s]);i[2]=t.values[u];var c=e.locToIndex(i);0<=c&&c<e.values.length&&(r.values[a]=e.values[c])}return r}var Gge=Zme((function(e,t){return e>t?1:0})),jge=uge(P1,Gge,null,"bool"),Hge={kernelName:P1,backendName:"cpu",kernelFunc:jge},qge=Zme((function(e,t){return e>=t?1:0})),Kge=uge(B1,qge,null,"bool"),Xge={kernelName:B1,backendName:"cpu",kernelFunc:Kge},Yge=Zme((function(e,t){return e<t?1:0})),Jge=uge(K1,Yge,null,"bool"),Zge={kernelName:K1,backendName:"cpu",kernelFunc:Jge},Qge=Zme((function(e,t){return e<=t?1:0})),$ge=uge(X1,Qge,null,"bool"),eye={kernelName:X1,backendName:"cpu",kernelFunc:$ge};function tye(e,t,n){var r=(t-e)/(n-1),a=l0(n,"float32");a[0]=e;for(var i=1;i<a.length;i++)a[i]=a[i-1]+r;return a}var nye=bge((function(e){return Math.log(e)})),rye=kge(J1,nye),aye={kernelName:J1,backendName:"cpu",kernelFunc:rye};function iye(e,t,n,r){for(var a=q$(r,L$(n)),i=0;i<a.length;++i){for(var o=i*t,s=e[o],u=0;u<t;++u){var c=e[o+u];(Number.isNaN(c)||c>s)&&(s=c)}a[i]=s}return a}var oye=Zme((function(e,t){return Math.max(e,t)})),sye=uge(i2,oye),uye={kernelName:i2,backendName:"cpu",kernelFunc:sye},cye=Zme((function(e,t){return Math.min(e,t)})),lye=uge(f2,cye),hye={kernelName:f2,backendName:"cpu",kernelFunc:lye},pye=Zme((function(e,t){return e*t})),fye=cge((function(e,t,n,r){return{real:e*n-t*r,imag:e*r+t*n}})),dye=uge(g2,pye,fye),vye={kernelName:g2,backendName:"cpu",kernelFunc:dye};function mye(e,t,n){var r=M4(-1,n);return pye([],t,r,e,n)}var gye={kernelName:y2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.x;qme(r,"neg");var a=S(mye(n.data.get(r.dataId).values,r.shape,r.dtype),2),i=a[0],o=a[1];return n.makeTensorInfo(o,r.dtype,i)}},yye=Zme((function(e,t){return e!==t?1:0})),bye=uge(b2,yye,null,"bool"),xye={kernelName:b2,backendName:"cpu",kernelFunc:bye};function kye(e,t,n,r,a){for(var i=t.length,o=L$(t),s=i0(t),u=i0(a),c=q$(n,L$(a)),l=0;l<o;++l){for(var h=d0(l,i,s),p=new Array(h.length),f=0;f<p.length;f++)p[f]=h[r[f]];c[f0(p,i,u)]=e[l]}return c}function wye(e){var t=e.inputs,n=e.attrs,r=e.backend,a=t.x,i=n.perm;qme(a,"transpose");for(var o=a.shape.length,s=new Array(o),u=0;u<s.length;u++)s[u]=a.shape[i[u]];var c=kye(r.data.get(a.dataId).values,a.shape,a.dtype,i,s);return{dataId:r.write(c,s,a.dtype),shape:s,dtype:a.dtype}}var Iye={kernelName:T3,backendName:"cpu",kernelFunc:wye};function Nye(e,t,n,r){for(var a=S(U7(e,r),2),i=a[0],o=a[1],s=h5(t,"int32"),u=l0(L$(i),s),c=L$(o),l=0;l<u.length;++l){for(var h=l*c,p=1,f=0;f<c;++f)p*=n[h+f];u[l]=p}return{outVals:u,outShape:i,outDtype:s}}var Sye={kernelName:A2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.axis,o=r.keepDims;qme(a,"prod");var s=a.shape.length,u=j$(i,a.shape),c=H7(u,s),l=u,h=a,p=[];null!=c&&(h=wye({inputs:{x:a},backend:n,attrs:{perm:c}}),p.push(h),l=K7(l.length,s));var f=n.data.get(h.dataId).values,d=Nye(h.shape,h.dtype,f,l),v=d.outVals,m=d.outShape,g=d.outDtype,y=m;return o&&(y=G7(m,u)),p.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),n.makeTensorInfo(y,g,v)}};function Tye(e,t,n,r){var a=[],i=0,o=t.length-1+n.length,s=new Array(o).fill(null).map((function(){return[0]}));!function(e,t){for(var n=0;n<e.length;++n){var r=e[n],a=n===e.length-1?t:e[n+1].length;if(0===r.length)throw new Error("Ragged splits may not be empty");if(r[0]<0)throw new Error("Ragged splits must be non-negative");if(r[r.length-1]>a)throw new Error("Ragged splits must not point past values");for(var i=1;i<r.length;++i)if(r[i-1]>r[i])throw new Error("Ragged splits must be sorted in ascending order")}}(n,r);for(var u=1,c=0;c<t.length-1;++c){u*=t[c];for(var l=t[c+1],h=1;h<u+1;++h)s[c].push(h*l)}for(var p=0;p<e.length;++p){for(var f=e[p],d=e[p]+1,v=0;v<n.length;++v){var m=n[v],g=v+t.length-1;if(g>=0)for(var y=s[g],b=y[y.length-1]-m[f],x=f;x<d;++x)s[g].push(m[x+1]+b);f=m[f],d=m[d]}d!==f&&(a.push([f,d]),i+=d-f)}return{outSplits:s,valueSlices:a,numValues:i}}function Eye(e,t){for(var n=e.slice(0,t);n.length<t;)n.push(1);for(var r=t;r<e.length;r++)n[t-1]*=e[r];return n}function Cye(e,t,n,r,a){var i=t.slice();i[0]=a;var o=K$(n,L$(i)),s=e.length;return function(e,t,n,r,a,i){var o,s=Eye(t,2)[1],u=Eye(i,2)[1],c=0,l=O(n);try{for(l.s();!(o=l.n()).done;)for(var h=o.value,p=h[0];p<h[1];++p){for(var f=0;f<r;++f)a[c*u+f]=e[p*s+f];++c}}catch(e){l.e(e)}finally{l.f()}}(e,t,r,0===s?0:s/t[0],o,i),[o,i]}function Aye(e,t,n,r,a,i,o,s){if(0===e.length)throw new Error("paramsNestedSplits must be non empty");if(0===t[0].length)throw new Error("Split tensors must not be scalars");if(function(e,t,n){e.forEach((function(e,r){if(e<0||e>=n){var a=d0(r,t.length,i0(t)).join(",");throw new Error("indices[".concat(a,"] = ").concat(e," is not in [0, ").concat(n,")"))}}))}(i,o,t[0][0]-1),0===r.length)throw new Error("params.rank must be nonzero");var u=Tye(i,o,e,r[0]),c=u.outSplits,l=u.valueSlices,h=u.numValues,p=function(e){for(var t=[],n=function(){var n=K$("int32",e[r].length);t.push(n),e[r].forEach((function(e,t){return n[t]=e}))},r=0;r<e.length;++r)n();return t}(c),f=Cye(n,r,a,l,h);return[p,f[0],f[1]]}var Rye=2147483647;function _ye(e,t,n,r,a,i,o){if(t.length>1)throw new Error("starts must be a scalar or vector");if(a.length>1)throw new Error("limits must be a scalar or vector");if(o.length>1)throw new Error("deltas must be a scalar or vector");var s=0===t.length,u=0===a.length,c=0===o.length,l=[];s||l.push(t[0]),u||l.push(a[0]),c||l.push(o[0]);for(var h=1;h<l.length;++h)if(l[h]!==l[h-1])throw new Error("starts, limits, and deltas must have the same shape");var p=0===l.length?1:l[0],f=K$("int32",p+1);f[0]=0;for(var d=0;d<p;++d){var v=s?e[0]:e[d],m=u?r[0]:r[d],g=c?i[0]:i[d];if(0===g)throw new Error("Requires delta != 0");var y=void 0;if(g>0&&m<v||g<0&&m>v)y=0;else if((y=Math.ceil(Math.abs((m-v)/g)))>Rye)throw new Error("Requires ((limit - start) / delta) <= ".concat(Rye));f[d+1]=f[d]+y}for(var b=K$(n,f[p]),x=0,k=0;k<p;++k)for(var w=f[k+1]-f[k],I=s?e[0]:e[k],N=c?i[0]:i[k],S=0;S<w;++S)b[x++]=I,I+=N;return[f,b]}var Oye=Wae,Fye=function(){function e(t,n,r,a,i,o,s,u,c,h){l(this,e),this.shape=t,this.shapeShape=n,this.values=r,this.valuesShape=a,this.valuesDType=i,this.defaultValue=o,this.defaultValueShape=s,this.rowPartitionValues=u,this.rowPartitionValuesShapes=c,this.rowPartitionTypes=Jae(h),this.raggedRank=Zae(this.rowPartitionTypes)}return p(e,[{key:"getRowPartitionTypeByDimension",value:function(e){return this.rowPartitionTypes[0]===Oye.FIRST_DIM_SIZE?this.rowPartitionTypes[e+1]:this.rowPartitionTypes[e]}},{key:"getRowPartitionTensor",value:function(e){return this.rowPartitionTypes[0]===Oye.FIRST_DIM_SIZE?this.rowPartitionValues[e+1]:this.rowPartitionValues[e]}},{key:"getMaxWidth",value:function(t){var n=this.getRowPartitionTensor(t-1);switch(this.getRowPartitionTypeByDimension(t-1)){case Oye.VALUE_ROWIDS:return e.getMaxWidthValueRowID(n);case Oye.ROW_SPLITS:return e.getMaxWidthRowSplit(n);default:throw new Error("Cannot handle partition type ".concat(Oye[this.getRowPartitionTypeByDimension(t-1)]))}}},{key:"tensorShapeFromTensor",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(0===t.length){if(-1===e[0])return[];throw new Error("The only valid scalar shape tensor is the fully unknown shape specified as -1.")}return Mye(e,n)}},{key:"calculateOutputSize",value:function(e){var t=this.valuesShape;Qae(this.defaultValueShape,t);var n=this.tensorShapeFromTensor(this.shape,this.shapeShape),r=Yae(this.raggedRank,n,t);r[0]<0&&(r[0]=e);for(var a=1;a<=this.raggedRank;++a)r[a]<0&&(r[a]=this.getMaxWidth(a));return r}},{key:"calculateFirstParentOutputIndex",value:function(e,t,n){for(var r=Math.min(e,n),a=[],i=0,o=0;o<r;++o,i+=t)a.push(i);for(var s=r;s<e;++s)a.push(-1);return F$(a.length===e,(function(){return"Final length of result must be equal to firstDimension."})),a}},{key:"calculateOutputIndexRowSplit",value:function(e,t,n,r){for(var a=e.length,i=[],o=0;o<a-1;++o){var s=e[o+1]-e[o],u=Math.min(r,s),c=t[o];-1===c&&(u=0);for(var l=0;l<u;++l)i.push(c),c+=n;for(var h=0;h<s-u;++h)i.push(-1)}if(a>0&&i.length!==e[a-1])throw new Error("Invalid row split size.");return i}},{key:"calculateOutputIndexValueRowID",value:function(e,t,n,r){var a=e.length,i=[];if(0===a)return[];var o=0,s=e[0];if(s>=t.length)throw new Error("Got currentValueRowId=".concat(s,", which is not less than ").concat(t.length));var u=t[s];i.push(u);for(var c=1;c<a;++c){var l=e[c];if(l===s)u>=0&&(++o<r?u+=n:u=-1);else{if(o=0,s=l,l>=t.length)throw new Error("Got nextValueRowId=".concat(l," which is not less than ").concat(t.length));u=t[l]}i.push(u)}if(i.length!==e.length)throw new Error("Invalid row ids.");return i}},{key:"calculateOutputIndex",value:function(e,t,n,r){var a=this.getRowPartitionTensor(e),i=this.getRowPartitionTypeByDimension(e);switch(i){case Oye.VALUE_ROWIDS:return this.calculateOutputIndexValueRowID(a,t,n,r);case Oye.ROW_SPLITS:if(a.length-1>t.length)throw new Error("Row partition size is greater than output size: ".concat(a.length-1," > ").concat(t.length));return this.calculateOutputIndexRowSplit(a,t,n,r);default:throw new Error("Unsupported partition type: ".concat(Oye[i]))}}},{key:"getFirstDimensionSize",value:function(){var e=this.rowPartitionValues[0];if(0===this.rowPartitionTypes.length)throw new Error("No row_partition_types given.");var t=this.rowPartitionTypes[0];switch(t){case Oye.FIRST_DIM_SIZE:return e[0];case Oye.VALUE_ROWIDS:throw new Error("Cannot handle VALUE_ROWIDS in first dimension.");case Oye.ROW_SPLITS:return this.rowPartitionValuesShapes[0][0]-1;default:throw new Error("Cannot handle type ".concat(Oye[t]))}}},{key:"compute",value:function(){if(this.rowPartitionValues[0].length<=0)throw new Error("Invalid first partition input. Tensor requires at least one element.");var e=this.getFirstDimensionSize(),t=this.calculateOutputSize(e),n=new Array(this.raggedRank+1);n[n.length-1]=1;for(var r=n.length-2;r>=0;--r)n[r]=n[r+1]*t[r+1];var a=Mye(t,!1),i=K$(this.valuesDType,L$(a));if(n[0]*t[0]>0){for(var o=this.calculateFirstParentOutputIndex(e,n[0],t[0]),s=1;s<=this.raggedRank;++s){o=this.calculateOutputIndex(s-1,o,n[s],t[s])}this.setOutput(this.raggedRank,o,i,a)}return[a,i]}},{key:"setOutput",value:function(e,t,n,r){if(0!==n.length){var a=this.values,i=n,o=r.slice(),s=L$(o=o.slice(e+1)),u=t.length,c=this.defaultValue;if(c.length!==s&&1!==c.length){var l=this.defaultValueShape;e8((function(){var e=W8(c,l),t=r7(e,o);c=t.dataSync()}))}for(var h=0,p=0,f=0,d=0;d<=u;++d){var v=d<u?t[d]:-1;if(v!==f){if(p<f){var m=a.subarray(h*s);Dye(i.subarray(p*s),m,(f-p)*s)}if(d>=u){var g=n.length;v=Math.floor(g/s)}if(v>f)if(1===this.defaultValue.length)i.subarray(f*s,v*s).fill(this.defaultValue[0]),f=v;else for(;v>f;){Dye(i.slice(f*s),c,s),++f}v<0?(h=d+1,p=f):(h=d,f=(p=f)+1)}else++f}}}}],[{key:"getMaxWidthRowSplit",value:function(e){var t=e.length;if(0===t||1===t)return 0;for(var n=0,r=0;r<t-1;++r){var a=e[r+1]-e[r];a>n&&(n=a)}return n}},{key:"getMaxWidthValueRowID",value:function(e){var t=e.length;if(0===t)return 0;for(var n=0,r=e[0],a=0,i=1;i<t;++i){var o=e[i];o!==r&&(r=o,a=Math.max(i-n,a),n=i)}return Math.max(t-n,a)}}]),e}();function Dye(e,t,n){for(var r=0;r<n;r++)e[r]=t[r]}function Mye(e,t){var n,r=[],a=O(e);try{for(a.s();!(n=a.n()).done;){var i=n.value;if(i<0){if(!t)throw new Error("Dimension ".concat(i," must be >= 0"));if(i<-1)throw new Error("Dimension ".concat(i," must be >= -1"));i=-1}r.push(i)}}catch(e){a.e(e)}finally{a.f()}return r}function Lye(e,t,n,r,a,i,o,s,u,c){return new Fye(e,t,n,r,a,i,o,s,u,c).compute()}function zye(e,t,n,r){if(e===t||e<t&&n<0||t<e&&n>1)return l0(0,r);var a=l0(Math.abs(Math.ceil((t-e)/n)),r);t<e&&1===n&&(n=-1),a[0]=e;for(var i=1;i<a.length;i++)a[i]=a[i-1]+n;return a}var Pye=bge((function(e){return 1/Math.sqrt(e)})),Bye=kge(H2,Pye),Wye={kernelName:H2,backendName:"cpu",kernelFunc:Bye};function Vye(e,t,n,r,a,i,o,s,u,c){var l=[r/a,a],h=e.values,p=t.values;if(0===r)return K6(n,t.dtype);var f=u instanceof $4?u:K6(l,t.dtype);"string"==typeof u||"number"==typeof u?f.values.fill(u):"boolean"==typeof u&&f.values.fill(+u);for(var d=0;d<i;d++){for(var v=[],m=0,g=0;g<o;g++){var y=h[d*o+g];v.push(y),m+=y*s[g]}if(m<0||m>=r/a)throw new Error("Invalid indices: ".concat(v," does not index into ").concat(n));for(var b=0;b<a;b++)c?f.values[m*a+b]+=p[d*a+b]:f.values[m*a+b]=0===t.rank?p[0]:p[d*a+b]}return f}var Uye=bge((function(e){return 1/(1+Math.exp(-e))})),Gye=xge(t3,(function(e){return 1/(1+Math.exp(-e))})),jye={kernelName:t3,backendName:"cpu",kernelFunc:Gye};function Hye(e,t,n,r,a){var i=Mae(r,t,n),o=L$(n),s=i0(r);if(i){var u=Lae(t,s);return"string"===a?e.slice(u,u+o):e.subarray(u,u+o)}for(var c=K6(r,a,"string"===a?qie(e):e),l=K6(n,a),h=0;h<l.size;++h){var p=l.indexToLoc(h),f=p.map((function(e,n){return e+t[n]}));l.set.apply(l,[c.get.apply(c,T(f))].concat(T(p)))}return"string"===a?Kie(l.values):l.values}function qye(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.begin,o=r.size;qme(a,"slice");var s=S(zae(a,i,o),2),u=s[0],c=s[1];Sae(a,u,c);var l=Hye(n.data.get(a.dataId).values,u,c,a.shape,a.dtype);return n.makeTensorInfo(c,a.dtype,l)}var Kye={kernelName:Z2,backendName:"cpu",kernelFunc:qye};function Xye(e,t,n,r,a,i,o){var s=t[0],u=i[0],c=new Array(u),l=new Array(s),h=t[1];if(0===u){if(0!==s)throw new Error(_ie(s));return[K$(n,0),[0,h],K$(a,0),c,l]}for(var p=!0,f=0,d=new Array(u).fill(0),v=0;v<s;++v){var m=e[v*h];if(m<0)throw new Error(Oie(v,m));if(m>=u)throw new Error(Fie(v,m,u));++d[m],p=p&&m>=f,f=m}for(var g=!0,y=0;y<u;++y){var b=0===d[y];c[y]=b,g=g&&!b,d[y]=Math.max(d[y],1),y>0&&(d[y]+=d[y-1])}if(g&&p){for(var x=e,k=r,w=0;w<s;++w)l[w]=w;return[x,[s,h],k,c,l]}for(var I=d[u-1],N=K$(n,I*h),S=K$(a,I),T=new Array(u).fill(0),E=0;E<s;++E){var C=e[E*h],A=T[C],R=(0===C?0:d[C-1])+A;T[C]++;for(var _=0;_<h;++_)N[R*h+_]=e[E*h+_];S[R]=r[E],l[E]=R}for(var O=0;O<u;++O){if(0===T[O]){var F=0===O?0:d[O-1];N[F*h+0]=O;for(var D=1;D<h;++D)N[F*h+D]=0;S[F]=o}}return[N,[I,h],S,c,l]}function Yye(e,t,n,r,a){for(var i=L$(r),o=t[0],s=a.length,u=[],c=1,l=-1,h=0;h<s;++h){var p=a[h];if(-1===p){if(-1!==l)throw new Error(Die(l,h));l=h,u.push(1)}else{if(p<0)throw new Error(Mie(h,p));c*=p,u.push(p)}}if(-1!==l){if(c<=0)throw new Error("reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero");var f=Math.trunc(i/c);if(c*f!==i)throw new Error(zie(r,u));u[l]=f}if(L$(u)!==i)throw new Error(Pie(r,u));var d=r.length,v=[];if(d>0){v[d-1]=1;for(var m=d-2;m>=0;--m)v[m]=v[m+1]*r[m+1]}var g=[];if(s>0){g[s-1]=1;for(var y=s-2;y>=0;--y)g[y]=g[y+1]*u[y+1]}for(var b=K$(n,o*s),x=0;x<o;++x){for(var k=0,w=0;w<d;++w)k+=e[x*d+w]*v[w];for(var I=0;I<s;++I)b[x*s+I]=Math.trunc(k/g[I]),k%=g[I]}return[b,[o,s],u]}function Jye(e,t,n,r,a){var i=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,s=r.length,u=[t[0],e.length/t[0]],c=u[1],l=s>0?a[s-1]+1:0,h=l;if(h<0)throw new Error("segment ids must be >= 0");var p=t.slice();p[0]=h;var f=p.reduce((function(e,t){return e*t}),1),d=K$(n,f);if(0===s)return h>0&&d.fill(o),[d,p];if(h<=0)throw new Error("segment ids must be >= 0");for(var v=0,m=1,g=0,y=a[v];;){var b=0;if(m<s){if(y===(b=a[m])){++m;continue}if(y>=b)throw new Error("segment ids are not increasing")}if(y<0||y>=h)throw new Error(Vie(y,h));y>g&&d.fill(o,g*c,y*c);for(var x=v;x<m;++x){var k=r[x];if(k<0||k>=u[0])throw new Error(Uie(x,r[x],u[0]));for(var w=0;w<c;w++)d[y*c+w]+=e[k*c+w]}if(i)for(var I=0;I<c;I++)d[y*c+I]/=m-v;if(v=m,g=y+1,y=b,++m>s)break}return g<h&&d.fill(o,g*c,h*c),[d,p]}var Zye=bge((function(e){return Math.sqrt(e)})),Qye=xge(r3,(function(e){return Math.sqrt(e)})),$ye={kernelName:r3,backendName:"cpu",kernelFunc:Qye},ebe=Zme((function(e,t){var n=e-t;return n*n})),tbe=uge(f3,ebe),nbe={kernelName:f3,backendName:"cpu",kernelFunc:tbe},rbe=bge((function(e,t){var n=t.pattern,r=t.replaceGlobal,a=t.rewrite;return e.replace(new RegExp(n,r?"g":""),a)})),abe=kge(v3,rbe),ibe={kernelName:v3,backendName:"cpu",kernelFunc:abe};function obe(e,t,n,r){for(var a=K6(e,t.dtype),i=0;i<a.size;i++){for(var o=a.indexToLoc(i),s=new Array(o.length),u=0;u<s.length;u++)s[u]=o[u]*n[u]+r[u];a.set.apply(a,[t.get.apply(t,s)].concat(T(o)))}return a}var sbe=function(){function e(t,n,r,a,i,o){l(this,e),this.separator=B4(t),this.nGramWidths=n,this.leftPad=B4(r),this.rightPad=B4(a),this.padWidth=i,this.preserveShort=o}return p(e,[{key:"getPadWidth",value:function(e){return Math.min(this.padWidth<0?e-1:this.padWidth,e-1)}},{key:"getNumNGrams",value:function(e,t){var n=this.getPadWidth(t);return Math.max(0,e+2*n-t+1)}},{key:"createNGrams",value:function(e,t,n,r,a,i){for(var o=this,s=function(){var s=o.getPadWidth(i),c=Math.max(0,s-u),l=Math.max(0,s-(a-(u+1))),h=i-(c+l),p=t+(c>0?0:u-s),f=0;f+=c*o.leftPad.length;for(var d=0;d<h;++d)f+=e[p+d].length;f+=l*o.rightPad.length,f+=(c+l+h-1)*o.separator.length,n[r+u]=new Uint8Array(f);for(var v=n[r+u],m=0,g=function(e){return e.forEach((function(e){return v[m++]=e}))},y=0;y<c;++y)g(o.leftPad),g(o.separator);for(var b=0;b<h-1;++b)g(e[p+b]),g(o.separator);if(h>0){g(e[p+h-1]);for(var x=0;x<l;++x)g(o.separator),g(o.rightPad)}else{for(var k=0;k<l-1;++k)g(o.rightPad),g(o.separator);g(o.rightPad)}},u=0;u<a;++u)s()}},{key:"compute",value:function(e,t){var n=this,r=e.length,a=t.length;if(a>0){var i=t[0];if(0!==i)throw new Error("First split value must be 0, got ".concat(i));for(var o=1;o<a;++o){var s=t[o]>=i;if(!(s=s&&t[o]<=r))throw new Error("Invalid split value ".concat(t[o],", must be in [").concat(i,", ").concat(r,"]"));i=t[o]}if(i!==r)throw new Error("Last split value must be data size. Expected ".concat(r,", got ").concat(i))}var u=a-1,c=K$("int32",a);if(0===r||0===a){for(var l=new Array(r),h=0;h<=u;++h)c[h]=0;return[l,c]}c[0]=0;for(var p=function(){var e=t[f]-t[f-1],r=0;n.nGramWidths.forEach((function(t){r+=n.getNumNGrams(e,t)})),n.preserveShort&&e>0&&0===r&&(r=1),c[f]=c[f-1]+r},f=1;f<=u;++f)p();for(var d=new Array(c[u]),v=function(r){var a=t[r],i=c[r];if(n.nGramWidths.forEach((function(o){var s=t[r+1]-t[r],u=n.getNumNGrams(s,o);n.createNGrams(e,a,d,i,u,o),i+=u})),n.preserveShort&&i===c[r]){var o=t[r+1]-t[r];if(0===o)return"continue";var s=o+2*n.padWidth;n.createNGrams(e,a,d,i,1,s)}},m=0;m<u;++m)v(m);return[d,c]}}]),e}();function ube(e,t,n,r,a,i,o,s){return new sbe(n,r,a,i,o,s).compute(e,t)}function cbe(e,t,n,r){if(e.length)if(0!==t.length)if(1!==t.length){for(var a=0,i=0;i<e.length+1;i++)if(i===e.length||-1!==t.indexOf(e[i])){var o=e.subarray(a,i);n&&0===o.length||r.push(o),a=i+1}}else{for(var s=t[0],u=e.indexOf(s);-1!==u;){var c=e.subarray(0,u);n&&0===c.length||r.push(c),u=(e=e.subarray(u+1)).indexOf(s)}n&&0===e.length||r.push(e)}else for(var l=0;l<e.length;++l)r.push(e.subarray(l,l+1))}function lbe(e,t,n){for(var r=e.length,a=[],i=0,o=0,s=new Array(r),u=0;u<r;++u){var c=a.length;cbe(e[u],t,n,a);var l=a.length-c;s[u]=l,i+=l,o=Math.max(o,l)}for(var h=K$("int32",2*i),p=new Array(i),f=[r,o],d=0,v=0;v<r;++v)for(var m=0;m<s[v];++m)h[2*d]=v,h[2*d+1]=m,p[d]=a[d],++d;return[h,p,f]}function hbe(e,t){for(var n=K$("int32",e.length),r=0;r<e.length;++r)n[r]=D4(e[r]).modulo(t).getLowBitsUnsigned();return n}var pbe=Zme((function(e,t){return e-t})),fbe=cge((function(e,t,n,r){return{real:e-n,imag:t-r}})),dbe=uge(x3,pbe,fbe),vbe={kernelName:x3,backendName:"cpu",kernelFunc:dbe};function mbe(e,t){for(var n=new Array(e.rank),r=0;r<n.length;r++)n[r]=e.shape[r]*t[r];for(var a=K6(n,e.dtype),i=0;i<a.values.length;++i){for(var o=a.indexToLoc(i),s=new Array(e.rank),u=0;u<s.length;u++)s[u]=o[u]%e.shape[u];var c=e.locToIndex(s);a.values[i]=e.values[c]}return a}var gbe=function(e,t){var n=t.value-e.value;return 0===n?e.index-t.index:n};function ybe(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.length-1;r>n;){if(r-n>600){var a=r-n+1,i=t-n+1,o=Math.log(a),s=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*s*(a-s)/a)*Math.sign(i-a/2),c=Math.max(n,Math.floor(t-i*s/a+u)),l=Math.min(r,Math.floor(t+(a-i)*s/a+u));ybe(e,t,c,l)}var h=e[t],p=n,f=r;for(_$(e,n,t),gbe(e[r],h)>0&&_$(e,n,r);p<f;){for(_$(e,p,f),p++,f--;gbe(e[p],h)<0;)p+=1;for(;gbe(e[f],h)>0;)f-=1}0===gbe(e[n],h)?_$(e,n,f):_$(e,f+=1,r),f<=t&&(n=f+1),t<=f&&(r=f-1)}}function bbe(e,t,n,r,a){for(var i=t[t.length-1],o=e.length/i,s=i,u=q$(n,o*r),c=q$("int32",o*r),l=function(){var t=h*s,n=e.subarray(t,t+s),i=new Array(n.length);n.forEach((function(e,t){return i[t]={value:e,index:t}})),r<i.length&&(ybe(i,r),i=i.slice(0,r)),a&&i.sort(gbe);for(var o=h*r,l=u.subarray(o,o+r),p=c.subarray(o,o+r),f=0;f<r;f++)l[f]=i[f].value,p[f]=i[f].index},h=0;h<o;h++)l();var p=t.slice();return p[p.length-1]=r,[K6(p,n,u),K6(p,"int32",c)]}function xbe(e,t,n,r){for(var a=j$(t,n)[0],i=[1,n[0],1],o=0;o<a;o++)i[0]*=n[o];i[1]=n[a];for(var s=a+1;s<n.length;s++)i[2]*=n[s];for(var u=new Map,c=new Int32Array(n[a]),l=new $4(i,r,e),h=[],p=1===i[0]&&1===i[2],f=0;f<n[a];f++){var d=void 0;if(p)d=e[f].toString();else{for(var v=[],m=0;m<i[0];m++)for(var g=0;g<i[2];g++)v.push(l.get(m,f,g));d=v.join(",")}var y=u.get(d);if(null!=y)c[f]=y;else{var b=u.size;u.set(d,b),c[f]=b,h.push(f)}}var x=i.slice();x[1]=u.size;var k=new $4(x,r);h.forEach((function(e,t){for(var n=0;n<i[0];n++)for(var r=0;r<i[2];r++)k.set(l.get(n,e,r),n,t,r)}));var w=n.slice();return w[a]=x[1],{outputValues:k.values,outputShape:w,indices:c}}var kbe={__proto__:null,addImpl:lge,bincountImpl:dge,bincountReduceImpl:vge,bitwiseAndImpl:mge,castImpl:ige,ceilImpl:wge,concatImpl:Sge,equalImpl:Tge,expImpl:Age,expm1Impl:Oge,floorDivImpl:Pge,floorImpl:Mge,gatherNdImpl:Vge,gatherV2Impl:Uge,greaterEqualImpl:qge,greaterImpl:Gge,lessEqualImpl:Qge,lessImpl:Yge,linSpaceImpl:tye,logImpl:nye,maxImpl:iye,maximumImpl:oye,minimumImpl:cye,multiplyImpl:pye,negImpl:mye,notEqualImpl:yye,prodImpl:Nye,raggedGatherImpl:Aye,raggedRangeImpl:_ye,raggedTensorToTensorImpl:Lye,rangeImpl:zye,rsqrtImpl:Pye,scatterImpl:Vye,sigmoidImpl:Uye,simpleAbsImpl:Yme,sliceImpl:Hye,sparseFillEmptyRowsImpl:Xye,sparseReshapeImpl:Yye,sparseSegmentReductionImpl:Jye,sqrtImpl:Zye,squaredDifferenceImpl:ebe,staticRegexReplaceImpl:rbe,stridedSliceImpl:obe,stringNGramsImpl:ube,stringSplitImpl:lbe,stringToHashBucketFastImpl:hbe,subImpl:pbe,tileImpl:mbe,topKImpl:bbe,transposeImpl:kye,uniqueImpl:xbe},wbe="4.6.0";a8("cpu",(function(){return new Xme}),1);var Ibe=xge(I1,(function(e){return e>=0?e:Math.exp(e)-1})),Nbe={kernelName:I1,backendName:"cpu",kernelFunc:Ibe};function Sbe(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.alpha;qme([a],"leakyRelu");for(var o=L$(a.shape),s=n.data.get(a.dataId).values,u=q$("float32",o),c=0;c<s.length;c++)u[c]=s[c]<0?i*s[c]:s[c];return n.makeTensorInfo(a.shape,"float32",u)}var Tbe={kernelName:q1,backendName:"cpu",kernelFunc:Sbe},Ebe=Zme((function(e,t){return e<0?t*e:e}));function Cbe(e){var t=e.inputs,n=e.backend,r=t.x,a=t.alpha;qme([r,a],"prelu");var i=n.data.get(r.dataId).values,o=n.data.get(a.dataId).values,s=S(Ebe(r.shape,a.shape,i,o,"float32"),2),u=s[0],c=s[1];return n.makeTensorInfo(c,"float32",u)}var Abe={kernelName:C2,backendName:"cpu",kernelFunc:Cbe},Rbe=xge(L2,(function(e){return Math.max(0,e)})),_be={kernelName:L2,backendName:"cpu",kernelFunc:Rbe},Obe=xge(U2,(function(e){return Math.min(Math.max(0,e),6)})),Fbe={kernelName:U2,backendName:"cpu",kernelFunc:Obe};function Dbe(e,t,n,r,a){if("linear"===n)return tge({inputs:{x:t},backend:e});if("relu"===n)return Rbe({inputs:{x:t},backend:e});if("elu"===n)return Ibe({inputs:{x:t},backend:e});if("relu6"===n)return Obe({inputs:{x:t},backend:e});if("prelu"===n)return Cbe({inputs:{x:t,alpha:r},backend:e});if("leakyrelu"===n)return Sbe({inputs:{x:t},backend:e,attrs:{alpha:a}});if("sigmoid"===n)return Gye({inputs:{x:t},backend:e});throw new Error("Activation ".concat(n," has not been implemented for the CPU backend."))}function Mbe(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.shape,o=L$(a.shape),s=G$(i,o),u=L$(s);F$(o===u,(function(){return"The new shape (".concat(s,") has ").concat(u," elements and the old ")+"shape (".concat(a.shape,") has ").concat(o," elements. The new shape and old ")+"shape must have the same number of elements."})),n.incRef(a.dataId);var c=n.data.get(a.dataId);if(null!=c.complexTensorInfos){var l=c.complexTensorInfos.real,h=c.complexTensorInfos.imag;l.shape=s,h.shape=s}return{dataId:a.dataId,shape:s,dtype:a.dtype}}var Lbe={kernelName:z2,backendName:"cpu",kernelFunc:Mbe};function zbe(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.a,i=t.b,o=r.transposeA,s=r.transposeB;qme([a,i],"matMul");var u=a.shape.length,c=i.shape.length,l=o?a.shape[u-2]:a.shape[u-1],h=s?i.shape[c-1]:i.shape[c-2],p=o?a.shape[u-1]:a.shape[u-2],f=s?i.shape[c-2]:i.shape[c-1],d=a.shape.slice(0,-2),v=i.shape.slice(0,-2),m=L$(d),g=L$(v),y=A7(a.shape.slice(0,-2),i.shape.slice(0,-2)).concat([p,f]);F$(l===h,(function(){return"Error in matMul: inner shapes (".concat(l,") and (")+"".concat(h,") of Tensors with shapes ").concat(a.shape," and ")+"".concat(i.shape," and transposeA=").concat(o)+" and transposeB=".concat(s," must match.")}));for(var b=s?[g,f,h]:[g,h,f],x=Mbe({inputs:{x:a},backend:n,attrs:{shape:o?[m,l,p]:[m,p,l]}}),k=Mbe({inputs:{x:i},backend:n,attrs:{shape:b}}),w=o?x.shape[1]:x.shape[2],I=o?x.shape[2]:x.shape[1],N=s?k.shape[1]:k.shape[2],T=Math.max(m,g),E=n.data.get(x.dataId).values,C=n.data.get(k.dataId).values,A=i0(x.shape),R=i0(k.shape),_=S(o?[A[0],1,A[1]]:[A[0],A[1],1],3),O=_[0],F=_[1],D=_[2],M=S(s?[1,R[1],R[0]]:[R[1],1,R[0]],3),L=M[0],z=M[1],P=M[2],B=I*N,W=K6([T,I,N],x.dtype),V=W.values,U=n.blockSize,G=0;G<T;G++)for(var j=G%m,H=G%g,q=0;q<I;q+=U)for(var K=Math.min(q+U,I),X=0;X<N;X+=U)for(var Y=Math.min(X+U,N),J=0;J<w;J+=U)for(var Z=Math.min(J+U,w),Q=q;Q<K;Q++)for(var $=X;$<Y;$++){for(var ee=0,te=J;te<Z;te++){ee+=E[j*O+Q*F+te*D]*C[te*L+$*z+H*P]}V[G*B+(Q*N+$)]+=ee}return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(k),n.makeTensorInfo(y,W.dtype,W.values)}var Pbe={kernelName:U0,backendName:"cpu",kernelFunc:zbe};var Bbe={kernelName:D3,backendName:"cpu",kernelFunc:function(e){var t,n,r,a=e.inputs,i=e.backend,o=e.attrs,s=a.a,u=a.b,c=a.bias,l=a.preluActivationWeights,h=o.transposeA,p=o.transposeB,f=o.activation,d=o.leakyreluAlpha,v=[];t=zbe({inputs:{a:s,b:u},attrs:{transposeA:h,transposeB:p},backend:i}),c&&(n=pge({inputs:{a:t,b:c},backend:i}),v.push(t),t=n),f&&(r=Dbe(i,t,f,l,d),v.push(t),t=r);for(var m=0,g=v;m<g.length;m++){var y=g[m];i.disposeIntermediateTensorInfo(y)}return t}},Wbe=xge(S0,(function(e){return Math.acos(e)})),Vbe={kernelName:S0,backendName:"cpu",kernelFunc:Wbe},Ube=xge(T0,(function(e){return Math.acosh(e)})),Gbe={kernelName:T0,backendName:"cpu",kernelFunc:Ube};var jbe={kernelName:C0,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t;qme(t,"addN");for(var a=r.map((function(e){return n.data.get(e.dataId).values})),i=K6(r[0].shape,r[0].dtype),o=i.values,s=0;s<r.length;s++)for(var u=a[s],c=0;c<o.length;c++)o[c]+=u[c];return n.makeTensorInfo(i.shape,i.dtype,i.values)}};var Hbe={kernelName:A0,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.axis,o=r.keepDims;qme(a,"all");var s=j$(i,a.shape),u=s,c=H7(u,a.shape.length),l=a;null!=c&&(l=wye({inputs:{x:a},backend:n,attrs:{perm:c}}),u=K7(u.length,a.shape.length)),j7("all",u,l.shape.length);for(var h=S(U7(l.shape,u),2),p=h[0],f=L$(h[1]),d=l0(L$(p),l.dtype),v=n.data.get(l.dataId).values,m=0;m<d.length;++m){for(var g=m*f,y=v[g],b=0;b<f;++b){var x=v[g+b];y=y&&x}d[m]=y}null!=c&&n.disposeIntermediateTensorInfo(l);var k=n.makeTensorInfo(p,l.dtype,d);if(o){var w=Mbe({inputs:{x:k},backend:n,attrs:{shape:G7(p,s)}});return n.disposeIntermediateTensorInfo(k),w}return k}};var qbe={kernelName:R0,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.axis,o=r.keepDims;qme(a,"any");var s=j$(i,a.shape),u=s,c=H7(u,a.shape.length),l=a;null!=c&&(l=wye({inputs:{x:a},backend:n,attrs:{perm:c}}),u=K7(u.length,a.shape.length)),j7("any",u,l.shape.length);for(var h=S(U7(l.shape,u),2),p=h[0],f=L$(h[1]),d=l0(L$(p),l.dtype),v=n.data.get(l.dataId).values,m=0;m<d.length;++m){for(var g=m*f,y=v[g],b=0;b<f;++b){var x=v[g+b];y=y||x}d[m]=y}null!=c&&n.disposeIntermediateTensorInfo(l);var k=n.makeTensorInfo(p,l.dtype,d);if(o){var w=Mbe({inputs:{x:k},backend:n,attrs:{shape:G7(p,s)}});return n.disposeIntermediateTensorInfo(k),w}return k}};var Kbe={kernelName:_0,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.axis;qme(a,"argMax");var o=j$(i,a.shape),s=H7(o,a.shape.length),u=a,c=[];null!=s&&(u=wye({inputs:{x:a},backend:n,attrs:{perm:s}}),c.push(u),o=K7(o.length,u.shape.length)),j7("argMax",o=[o[0]],u.shape.length);for(var l=S(U7(u.shape,o),2),h=l[0],p=l[1],f=l0(L$(h),"int32"),d=L$(p),v=n.data.get(u.dataId).values,m=0;m<f.length;++m){for(var g=m*d,y=v[g],b=0,x=0;x<d;++x){var k=v[g+x];k>y&&(y=k,b=x)}f[m]=b}return c.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),n.makeTensorInfo(h,"int32",f)}};var Xbe={kernelName:O0,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.axis;qme(a,"argMin");var o=j$(i,a.shape),s=H7(o,a.shape.length),u=a,c=[];null!=s&&(u=wye({inputs:{x:a},backend:n,attrs:{perm:s}}),c.push(u),o=K7(o.length,u.shape.length)),j7("argMin",o=[o[0]],u.shape.length);for(var l=S(U7(u.shape,o),2),h=l[0],p=l[1],f=l0(L$(h),"int32"),d=L$(p),v=n.data.get(u.dataId).values,m=0;m<f.length;++m){for(var g=m*d,y=v[g],b=0,x=0;x<d;++x){var k=v[g+x];k<y&&(y=k,b=x)}f[m]=b}return c.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),n.makeTensorInfo(h,"int32",f)}},Ybe=xge(F0,(function(e){return Math.asin(e)})),Jbe={kernelName:F0,backendName:"cpu",kernelFunc:Ybe},Zbe=xge(D0,(function(e){return Math.asinh(e)})),Qbe={kernelName:D0,backendName:"cpu",kernelFunc:Zbe},$be=xge(M0,(function(e){return Math.atan(e)})),exe={kernelName:M0,backendName:"cpu",kernelFunc:$be},txe=Zme((function(e,t){return Math.atan2(e,t)})),nxe=uge(z0,txe),rxe={kernelName:z0,backendName:"cpu",kernelFunc:nxe},axe=xge(L0,(function(e){return Math.atanh(e)})),ixe={kernelName:L0,backendName:"cpu",kernelFunc:axe};function oxe(e,t,n,r,a,i){for(var o=a.strideHeight,s=a.strideWidth,u=a.dilationHeight,c=a.dilationWidth,l=a.effectiveFilterHeight,h=a.effectiveFilterWidth,p=a.padInfo.top,f=a.padInfo.left,d="max"===i?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,v=K6(a.outShape,n),m=v.values,g=a.outShape[1]*a.outShape[2]*a.outShape[3],y=a.outShape[2]*a.outShape[3],b=a.outShape[3],x=0;x<a.batchSize;++x)for(var k=x*g,w=x*r[0],I=0;I<a.inChannels;++I)for(var N=0;N<a.outHeight;++N)for(var S=N*o-p,T=Math.max(0,S),E=Math.min(a.inHeight,l+S),C=k+N*y,A=0;A<a.outWidth;++A){for(var R=A*s-f,_=Math.max(0,R),O=Math.min(a.inWidth,h+R),F=d,D=0,M=0,L=T;L<E;L+=u){for(var z=w+L*r[1],P=_;P<O;P+=c){var B=e[z+P*r[2]+I];"max"===i&&B>F?F=B:"avg"===i&&(D+=B,M++)}if(isNaN(F))break}m[C+A*b+I]="avg"===i?D/M:F}return v}function sxe(e,t,n,r){for(var a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=K6(r.outShape,"int32"),s=r.strideHeight,u=r.strideWidth,c=r.dilationHeight,l=r.dilationWidth,h=r.effectiveFilterHeight,p=r.effectiveFilterWidth,f=r.padInfo.top,d=r.padInfo.left,v=K6(t,n,e),m=0;m<r.batchSize;++m)for(var g=0;g<r.inChannels;++g)for(var y=0;y<r.outHeight;++y){for(var b=y*s-f,x=b;x<0;)x+=c;for(var k=Math.min(r.inHeight,h+b),w=0;w<r.outWidth;++w){for(var I=w*u-d,N=I;N<0;)N+=l;for(var S=Math.min(r.inWidth,p+I),T=Number.NEGATIVE_INFINITY,E=-1,C=x;C<k;C+=c)for(var A=C-b,R=N;R<S;R+=l){var _=R-I,O=v.get(m,C,R,g);O>T&&(T=O,E=a?i?((m*r.inHeight+C)*r.inWidth+R)*r.inChannels+g:(C*r.inWidth+R)*r.inChannels+g:A*p+_)}o.set(E,m,y,w,g)}}return o}function uxe(e,t,n,r,a,i){for(var o=a.strideDepth,s=a.strideHeight,u=a.strideWidth,c=a.dilationDepth,l=a.dilationHeight,h=a.dilationWidth,p=a.effectiveFilterDepth,f=a.effectiveFilterHeight,d=a.effectiveFilterWidth,v=a.padInfo.front,m=a.padInfo.top,g=a.padInfo.left,y="max"===i?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,b=K6(a.outShape,n),x=b.values,k=a.outShape[1]*a.outShape[2]*a.outShape[3]*a.outShape[4],w=a.outShape[2]*a.outShape[3]*a.outShape[4],I=a.outShape[3]*a.outShape[4],N=a.outShape[4],S=0;S<a.batchSize;++S)for(var T=S*k,E=S*r[0],C=0;C<a.inChannels;++C)for(var A=0;A<a.outDepth;++A){for(var R=A*o-v,_=R;_<0;)_+=c;for(var O=Math.min(a.inDepth,p+R),F=T+A*w,D=0;D<a.outHeight;++D){for(var M=D*s-m,L=M;L<0;)L+=l;for(var z=Math.min(a.inHeight,f+M),P=F+D*I,B=0;B<a.outWidth;++B){for(var W=B*u-g,V=W;V<0;)V+=h;for(var U=Math.min(a.inWidth,d+W),G=P+B*N,j=y,H=0,q=0,K=_;K<O;K+=c){for(var X=E+K*r[1],Y=L;Y<z;Y+=l){for(var J=X+Y*r[2],Z=V;Z<U;Z+=h){var Q=e[J+Z*r[3]+C];if("max"===i&&Q>j?j=Q:"avg"===i&&(H+=Q,q++),isNaN(j))break}if(isNaN(j))break}if(isNaN(j))break}x[G+C]="avg"===i?H/Math.max(q,1):j}}}return b}var cxe={kernelName:P0,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x;qme(a,"avgPool");var i=r.filterSize,o=r.strides,s=r.pad,u=r.dimRoundingMode;F$(L8(o,1),(function(){return"Error in avgPool: Either strides or dilations must be 1. "+"Got strides ".concat(o," and dilations '").concat(1,"'")}));var c,l=N8(a.shape,i,o,1,s,u);if(1===l.filterWidth&&1===l.filterHeight&&P$(l.inShape,l.outShape))c=tge({inputs:{x:a},backend:n});else{var h=n.data.get(a.dataId).values,p=i0(a.shape),f=oxe(h,a.shape,a.dtype,p,l,"avg");c=n.makeTensorInfo(l.outShape,a.dtype,f.values)}return c}};var lxe={kernelName:W0,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.filterSize,o=r.strides,s=r.pad,u=r.dimRoundingMode,c=r.dataFormat;qme(a,"avgPool3d");var l=S8(a.shape,i,o,1,s,u,c),h=uxe(n.data.get(a.dataId).values,a.shape,a.dtype,i0(a.shape),l,"avg");return n.makeTensorInfo(h.shape,"float32",h.values)}};var hxe={kernelName:V0,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.dy,i=t.input,o=r.filterSize,s=r.strides,u=r.pad,c=r.dimRoundingMode;qme([a,i],"avgPool3DGrad");for(var l=S8(i.shape,o,s,1,u,c),h=l.strideDepth,p=l.strideHeight,f=l.strideWidth,d=l.filterDepth,v=l.filterHeight,m=l.filterWidth,g=l.dilationDepth,y=l.dilationHeight,b=l.dilationWidth,x=l.effectiveFilterDepth,k=l.effectiveFilterHeight,w=l.effectiveFilterWidth,I=x-1-l.padInfo.front,N=w-1-l.padInfo.left,S=k-1-l.padInfo.top,T=K6(i.shape,"float32"),E=1/(d*v*m),C=n.bufferSync(a),A=0;A<l.batchSize;++A)for(var R=0;R<l.inChannels;++R)for(var _=0;_<l.inDepth;++_)for(var O=0;O<l.inHeight;++O)for(var F=0;F<l.inWidth;++F){for(var D=_-I,M=O-S,L=F-N,z=0,P=0;P<x;P+=g){var B=(D+P)/h;if(!(B<0||B>=l.outDepth||Math.floor(B)!==B))for(var W=0;W<k;W+=y){var V=(M+W)/p;if(!(V<0||V>=l.outHeight||Math.floor(V)!==V))for(var U=0;U<w;U+=b){var G=(L+U)/f;if(!(G<0||G>=l.outWidth||Math.floor(G)!==G))z+=C.get(A,B,V,G,R)}}}T.set(z*E,A,_,O,F,R)}return n.makeTensorInfo(T.shape,T.dtype,T.values)}};var pxe={kernelName:B0,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.dy,i=t.input,o=i;qme([a,i],"avgPoolGrad");for(var s=r.filterSize,u=r.strides,c=r.pad,l=N8(o.shape,s,u,1,c),h=l.strideHeight,p=l.strideWidth,f=l.filterHeight,d=l.filterWidth,v=l.dilationHeight,m=l.dilationWidth,g=l.effectiveFilterHeight,y=l.effectiveFilterWidth,b=y-1-l.padInfo.left,x=g-1-l.padInfo.top,k=K6(o.shape,"float32"),w=1/(f*d),I=n.data.get(a.dataId).values,N=K6(a.shape,"float32",I),S=0;S<l.batchSize;++S)for(var T=0;T<l.inChannels;++T)for(var E=0;E<l.inHeight;++E)for(var C=0;C<l.inWidth;++C){for(var A=E-x,R=C-b,_=0,O=0;O<g;O+=v){var F=(A+O)/h;if(!(F<0||F>=l.outHeight||Math.floor(F)!==F))for(var D=0;D<y;D+=m){var M=(R+D)/p;if(!(M<0||M>=l.outWidth||Math.floor(M)!==M))_+=N.get(S,F,M,T)}}k.set(_*w,S,E,C,T)}return n.makeTensorInfo(k.shape,k.dtype,k.values)}};var fxe={kernelName:M1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.scale,o=t.offset,s=t.mean,u=t.variance;F$(s.shape.length===u.shape.length,(function(){return"Batch normalization gradient requires mean and variance to have equal ranks."})),F$(null==o||s.shape.length===o.shape.length,(function(){return"Batch normalization gradient requires mean and offset to have equal ranks."})),F$(null==i||s.shape.length===i.shape.length,(function(){return"Batch normalization gradient requires mean and scale to have equal ranks."})),qme([a,s,u,i,o],"batchNorm");var c=r.varianceEpsilon;null==c&&(c=.001);for(var l=n.data.get(a.dataId).values,h=n.data.get(s.dataId).values,p=n.data.get(u.dataId).values,f=i?n.data.get(i.dataId).values:new Float32Array([1]),d=o?n.data.get(o.dataId).values:new Float32Array([0]),v=new Float32Array(l.length),m=d.length,g=f.length,y=p.length,b=h.length,x=0,k=0,w=0,I=0,N=0;N<l.length;++N)v[N]=d[x++]+(l[N]-h[k++])*f[w++]/Math.sqrt(p[I++]+c),x>=m&&(x=0),k>=b&&(k=0),w>=g&&(w=0),I>=y&&(I=0);return n.makeTensorInfo(a.shape,a.dtype,v)}};var dxe={kernelName:G0,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.blockShape,o=r.crops;qme([a],"batchToSpaceND");var s=i.reduce((function(e,t){return e*t})),u=tie(a.shape,i,s),c=nie(u.length,i.length),l=rie(a.shape,i,s),h=aie(o,i.length),p=iie(l,o,i.length),f=Mbe({inputs:{x:a},backend:n,attrs:{shape:u}}),d=wye({inputs:{x:f},backend:n,attrs:{perm:c}}),v=Mbe({inputs:{x:d},backend:n,attrs:{shape:l}}),m=qye({inputs:{x:v},backend:n,attrs:{begin:h,size:p}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(v),m}};var vxe={kernelName:j0,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.weights,o=r.size,s=dge(n.data.get(a.dataId).values,n.data.get(i.dataId).values,i.dtype,i.shape,o);return n.makeTensorInfo([o],i.dtype,s)}};var mxe={kernelName:K0,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.s0,a=t.s1,i=n.data.get(r.dataId).values,o=n.data.get(a.dataId).values,s=A7(Array.from(i),Array.from(o));return n.makeTensorInfo([s.length],"int32",Int32Array.from(s))}},gxe=xge(J0,(function(e,t){var n=t;return e>n.clipValueMax?n.clipValueMax:e<n.clipValueMin?n.clipValueMin:e})),yxe={kernelName:J0,backendName:"cpu",kernelFunc:gxe},bxe={kernelName:Q0,backendName:"cpu",kernelFunc:function(e){for(var t=e.inputs.x,n=e.backend,r=new Float32Array(L$(t.shape)),a=n.data.get(t.dataId),i=a.complexTensorInfos.real,o=a.complexTensorInfos.imag,s=n.data.get(i.dataId).values,u=n.data.get(o.dataId).values,c=0;c<s.length;c++){var l=s[c],h=u[c];r[c]=Math.hypot(l,h)}return n.makeOutput(r,t.shape,"float32")}};function xxe(e){var t=e.inputs,n=e.backend,r=t.input,a=n.data.get(r.dataId).complexTensorInfos.imag,i=n.data.get(a.dataId).values;return n.makeTensorInfo(a.shape,a.dtype,i)}var kxe={kernelName:U1,backendName:"cpu",kernelFunc:xxe};function wxe(e){var t=e.inputs,n=e.backend,r=j$(e.attrs.axis,t[0].shape)[0];Kae(t.map((function(e){return e.shape})),r);var a=Xae(t.map((function(e){return e.shape})),r);if(0===L$(a))return n.makeTensorInfo(a,t[0].dtype,[]);var i=t.filter((function(e){return L$(e.shape)>0}));if(1===i.length)return tge({inputs:{x:i[0]},backend:n});if("complex64"===i[0].dtype){var o=i.map((function(e){return rge({inputs:{input:e},backend:n})})),s=i.map((function(e){return xxe({inputs:{input:e},backend:n})})),u=wxe({inputs:o,backend:n,attrs:{axis:r}}),c=wxe({inputs:s,backend:n,attrs:{axis:r}}),l=Qme({inputs:{real:u,imag:c},backend:n});return o.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),s.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(c),l}var h=i.map((function(e){var t=L$(e.shape.slice(r));return Mbe({inputs:{x:e},backend:n,attrs:{shape:[-1,t]}})})),p=h.map((function(e){return{vals:n.data.get(e.dataId).values,shape:e.shape}}));a=Xae(h.map((function(e){return e.shape})),1);var f=1===h[0].shape[0],d=Sge(p,a,t[0].dtype,f),v=Xae(i.map((function(e){return e.shape})),r),m=n.makeTensorInfo(v,t[0].dtype,d);return h.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),m}var Ixe={kernelName:$0,backendName:"cpu",kernelFunc:wxe};function Nxe(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.filter,o=r.strides,s=r.pad,u=r.dataFormat,c=r.dilations,l=r.dimRoundingMode;qme([a,i],"conv2d");for(var h=P8(u),p=T8(a.shape,i.shape,o,c,s,l,!1,h),f=p.filterHeight,d=p.filterWidth,v=p.dilationHeight,m=p.dilationWidth,g=p.padInfo.left,y=p.padInfo.top,b="channelsLast"===p.dataFormat,x=new $4(p.outShape,a.dtype),k=i0(a.shape),w=i0(i.shape),I=k[0],N=b?k[1]:k[2],S=b?k[2]:1,T=b?1:k[1],E=x.strides[0],C=b?x.strides[1]:x.strides[2],A=b?x.strides[2]:1,R=b?1:x.strides[1],_=n.data.get(a.dataId).values,O=n.data.get(i.dataId).values,F=x.values,D=0;D<p.batchSize;++D)for(var M=D*I,L=D*E,z=0;z<p.outHeight;++z)for(var P=L+z*C,B=z*p.strideHeight-y,W=0;W<f;++W){var V=B+W*v;if(!(V<0||V>=p.inHeight))for(var U=W*w[0],G=M+V*N,j=0;j<p.outWidth;++j)for(var H=P+j*A,q=j*p.strideWidth-g,K=0;K<d;++K){var X=q+K*m;if(!(X<0||X>=p.inWidth))for(var Y=G+X*S,J=U+K*w[1],Z=0;Z<p.inChannels;++Z){for(var Q=_[Y+Z*T],$=0;$<p.outChannels;++$)F[H+$*R]+=Q*O[J+$];J+=p.outChannels}}}return n.makeTensorInfo(x.shape,x.dtype,F)}var Sxe={kernelName:e1,backendName:"cpu",kernelFunc:Nxe};var Txe={kernelName:t1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.dy,o=r.strides,s=r.pad,u=r.dataFormat,c=r.dimRoundingMode,l=r.filterShape;qme([a,i],"conv2dBackpropFilter");for(var h=P8(u),p=T8(a.shape,l,o,1,s,c,!1,h),f=p.strideHeight,d=p.strideWidth,v=p.filterHeight,m=p.filterWidth,g="channelsLast"===p.dataFormat,y=new $4(p.filterShape,"float32"),b=p.padInfo.left,x=p.padInfo.top,k=n.data.get(a.dataId).values,w=n.data.get(i.dataId).values,I=new $4(a.shape,a.dtype,k),N=new $4(i.shape,i.dtype,w),S=0;S<v;++S)for(var T=Math.max(0,Math.ceil((x-S)/f)),E=Math.min(p.outHeight,(p.inHeight+x-S)/f),C=0;C<m;++C)for(var A=Math.max(0,Math.ceil((b-C)/d)),R=Math.min(p.outWidth,(p.inWidth+b-C)/d),_=0;_<p.inChannels;++_)for(var O=0;O<p.outChannels;++O){for(var F=0,D=0;D<p.batchSize;++D)for(var M=T;M<E;++M)for(var L=S+M*f-x,z=A;z<R;++z){var P=C+z*d-b;F+=g?I.get(D,L,P,_)*N.get(D,M,z,O):I.get(D,_,L,P)*N.get(D,O,M,z)}y.set(F,S,C,_,O)}return n.makeTensorInfo(y.shape,y.dtype,y.values)}};var Exe={kernelName:n1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.dy,i=t.filter,o=r.inputShape,s=r.strides,u=r.pad,c=r.dataFormat,l=r.dimRoundingMode;qme([a,i],"conv2dBackpropInput");var h=i0(i.shape),p=i0(a.shape),f=P8(c),d=T8(o,i.shape,s,1,u,l,!1,f),v=new $4(d.inShape,"float32"),m=v.values,g=n.data.get(a.dataId).values,y=n.data.get(i.dataId).values,b=S(h,3),x=b[0],k=b[1],w=b[2],I=d.batchSize,N=d.filterHeight,T=d.filterWidth,E=d.inChannels,C=d.inHeight,A=d.inWidth,R=d.outChannels,_=d.outHeight,O=d.outWidth,F=d.strideHeight,D=d.strideWidth;f=d.dataFormat;for(var M=N-1-d.padInfo.top,L=T-1-d.padInfo.left,z="channelsLast"===f,P=v.strides[0],B=z?v.strides[1]:v.strides[2],W=z?v.strides[2]:1,V=z?1:v.strides[1],U=p[0],G=z?p[1]:p[2],j=z?p[2]:1,H=z?1:p[1],q=0;q<I;++q)for(var K=0;K<E;++K)for(var X=0;X<C;++X)for(var Y=X-M,J=Math.max(0,Math.ceil(Y/F)),Z=Math.min(_,(N+Y)/F),Q=0;Q<A;++Q){for(var $=Q-L,ee=Math.max(0,Math.ceil($/D)),te=Math.min(O,(T+$)/D),ne=0,re=J;re<Z;++re)for(var ae=re*F-Y,ie=ee;ie<te;++ie)for(var oe=U*q+G*re+j*ie,se=x*(N-1-ae)+k*(T-1-(ie*D-$))+w*K,ue=0;ue<R;++ue){ne+=g[oe+H*ue]*y[se+ue]}m[P*q+B*X+W*Q+V*K]=ne}return n.makeTensorInfo(v.shape,v.dtype,v.values)}};var Cxe={kernelName:r1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.filter,o=r.strides,s=r.pad,u=r.dilations;qme([a,i],"conv3d");for(var c=E8(a.shape,i.shape,o,u,s),l=c.filterDepth,h=c.filterHeight,p=c.filterWidth,f=c.dilationDepth,d=c.dilationHeight,v=c.dilationWidth,m=c.padInfo,g=m.front,y=m.left,b=m.top,x=new $4(c.outShape,a.dtype),k=n.data.get(a.dataId).values,w=n.data.get(i.dataId).values,I=x.values,N=i0(a.shape),S=i0(i.shape),T=0;T<c.batchSize;++T)for(var E=T*N[0],C=T*x.strides[0],A=0;A<c.outDepth;++A)for(var R=C+A*x.strides[1],_=A*c.strideDepth-g,O=0;O<l;++O){var F=_+O*f;if(!(F<0||F>=c.inDepth))for(var D=O*S[0],M=E+F*N[1],L=0;L<c.outHeight;++L)for(var z=R+L*x.strides[2],P=L*c.strideHeight-b,B=0;B<h;++B){var W=P+B*d;if(!(W<0||W>=c.inHeight))for(var V=D+B*S[1],U=M+W*N[2],G=0;G<c.outWidth;++G)for(var j=z+G*c.outChannels,H=G*c.strideWidth-y,q=0;q<p;++q){var K=H+q*v;if(!(K<0||K>=c.inWidth))for(var X=V+q*S[2],Y=U+K*c.inChannels,J=X,Z=0;Z<c.inChannels;++Z){for(var Q=k[Y+Z],$=0;$<c.outChannels;++$)I[j+$]+=Q*w[J+$];J+=c.outChannels}}}}return n.makeTensorInfo(x.shape,x.dtype,x.values)}};var Axe={kernelName:a1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.dy,o=r.strides,s=r.pad,u=r.filterShape;qme([a,i],"conv3dBackpropFilterV2");for(var c=i0(a.shape),l=i0(i.shape),h=E8(a.shape,u,o,1,s),p=h.strideDepth,f=h.strideHeight,d=h.strideWidth,v=h.filterDepth,m=h.filterHeight,g=h.filterWidth,y=new $4(h.filterShape,"float32"),b=y.values,x=S(y.strides,4),k=x[0],w=x[1],I=x[2],N=x[3],T=n.data.get(i.dataId).values,E=S(l,4),C=E[0],A=E[1],R=E[2],_=E[3],O=n.data.get(a.dataId).values,F=S(c,4),D=F[0],M=F[1],L=F[2],z=F[3],P=h.padInfo.front,B=h.padInfo.left,W=h.padInfo.top,V=0;V<v;++V)for(var U=Math.max(0,Math.ceil((P-V)/p)),G=Math.min(h.outDepth,(h.inDepth+P-V)/p),j=V*k,H=0;H<m;++H)for(var q=Math.max(0,Math.ceil((W-H)/f)),K=Math.min(h.outHeight,(h.inHeight+W-H)/f),X=H*w+j,Y=0;Y<g;++Y)for(var J=Math.max(0,Math.ceil((B-Y)/d)),Z=Math.min(h.outWidth,(h.inWidth+B-Y)/d),Q=Y*I+X,$=0;$<h.inChannels;++$)for(var ee=$*N+Q,te=0;te<h.outChannels;++te){for(var ne=0,re=0;re<h.batchSize;++re)for(var ae=re*D,ie=re*C,oe=U;oe<G;++oe)for(var se=(V+oe*p-P)*M+ae,ue=oe*A+ie,ce=q;ce<K;++ce)for(var le=(H+ce*f-W)*L+se,he=ce*R+ue,pe=J;pe<Z;++pe){var fe=pe*_+he;ne+=O[(Y+pe*d-B)*z+le+$]*T[fe+te]}b[ee+te]=ne}return n.makeTensorInfo(y.shape,y.dtype,y.values)}};var Rxe={kernelName:i1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.dy,i=t.filter,o=r.pad,s=r.strides,u=r.inputShape;qme([a],"conv3dBackpropInputV2");for(var c=i0(a.shape),l=i0(i.shape),h=E8(u,i.shape,s,1,o),p=new $4(h.inShape,"float32"),f=p.values,d=S(p.strides,4),v=d[0],m=d[1],g=d[2],y=d[3],b=n.data.get(a.dataId).values,x=S(c,4),k=x[0],w=x[1],I=x[2],N=x[3],T=n.data.get(i.dataId).values,E=S(l,4),C=E[0],A=E[1],R=E[2],_=E[3],O=h.batchSize,F=h.filterDepth,D=h.filterHeight,M=h.filterWidth,L=h.inChannels,z=h.inDepth,P=h.inHeight,B=h.inWidth,W=h.outChannels,V=h.outDepth,U=h.outHeight,G=h.outWidth,j=h.strideDepth,H=h.strideHeight,q=h.strideWidth,K=F-1-h.padInfo.front,X=D-1-h.padInfo.top,Y=M-1-h.padInfo.left,J=0;J<O;++J)for(var Z=0;Z<L;++Z)for(var Q=0;Q<z;++Q)for(var $=Q-K,ee=Math.max(0,Math.ceil($/j)),te=Math.min(V,(F+$)/j),ne=0;ne<P;++ne)for(var re=ne-X,ae=Math.max(0,Math.ceil(re/H)),ie=Math.min(U,(D+re)/H),oe=0;oe<B;++oe){for(var se=oe-Y,ue=Math.max(0,Math.ceil(se/q)),ce=Math.min(G,(M+se)/q),le=0,he=ee;he<te;++he)for(var pe=he*j-$,fe=ae;fe<ie;++fe)for(var de=fe*H-re,ve=ue;ve<ce;++ve)for(var me=k*J+w*he+I*fe+N*ve,ge=C*(F-1-pe)+A*(D-1-de)+R*(M-1-(ve*q-se))+_*Z,ye=0;ye<W;++ye){le+=b[me+ye]*T[ge+ye]}f[v*J+m*Q+g*ne+y*oe+Z]=le}return n.makeTensorInfo(p.shape,p.dtype,p.values)}},_xe=xge(o1,(function(e){return Math.cos(e)})),Oxe={kernelName:o1,backendName:"cpu",kernelFunc:_xe},Fxe=xge(s1,(function(e){return Math.cosh(e)})),Dxe={kernelName:s1,backendName:"cpu",kernelFunc:Fxe};var Mxe={kernelName:l1,backendName:"cpu",kernelFunc:function(e){for(var t=e.inputs,n=e.backend,r=e.attrs,a=t.image,i=t.boxes,o=t.boxInd,s=r.cropSize,u=r.method,c=r.extrapolationValue,l=S(a.shape,4),h=l[0],p=l[1],f=l[2],d=l[3],v=i.shape[0],m=S(s,2),g=m[0],y=m[1],b=K6([v,g,y,d],"float32"),x=n.data.get(i.dataId).values,k=n.data.get(o.dataId).values,w=n.data.get(a.dataId).values,I=i0(a.shape),N=i0(b.shape),T=0;T<v;T++){var E=4*T,C=x[E],A=x[E+1],R=x[E+2],_=x[E+3],O=k[T];if(!(O>=h))for(var F=g>1?(R-C)*(p-1)/(g-1):0,D=y>1?(_-A)*(f-1)/(y-1):0,M=0;M<g;M++){var L=g>1?C*(p-1)+M*F:.5*(C+R)*(p-1);if(L<0||L>p-1)for(var z=0;z<y;z++)for(var P=0;P<d;P++){var B=P+z*N[2]+M*N[1]+T*N[0];b.values[B]=c}else if("bilinear"===u)for(var W=Math.floor(L),V=Math.ceil(L),U=L-W,G=0;G<y;G++){var j=y>1?A*(f-1)+G*D:.5*(A+_)*(f-1);if(j<0||j>f-1)for(var H=0;H<d;H++){var q=H+G*N[2]+M*N[1]+T*N[0];b.values[q]=c}else for(var K=Math.floor(j),X=Math.ceil(j),Y=j-K,J=0;J<d;J++){var Z=J+K*I[2]+W*I[1]+O*I[0],Q=w[Z],$=w[Z=J+X*I[2]+W*I[1]+O*I[0]],ee=w[Z=J+K*I[2]+V*I[1]+O*I[0]],te=Q+($-Q)*Y,ne=ee+(w[Z=J+X*I[2]+V*I[1]+O*I[0]]-ee)*Y;Z=J+G*N[2]+M*N[1]+T*N[0],b.values[Z]=te+(ne-te)*U}}else for(var re=0;re<y;++re){var ae=y>1?A*(f-1)+re*D:.5*(A+_)*(f-1);if(ae<0||ae>f-1)for(var ie=0;ie<d;ie++){var oe=ie+re*N[2]+M*N[1]+T*N[0];b.values[oe]=c}else for(var se=Math.round(ae),ue=Math.round(L),ce=0;ce<d;ce++){var le=ce+se*I[2]+ue*I[1]+O*I[0],he=ce+re*N[2]+M*N[1]+T*N[0];b.values[he]=w[le]}}}}return n.makeTensorInfo(b.shape,b.dtype,b.values)}};var Lxe={kernelName:u1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.axis,o=r.exclusive,s=r.reverse;qme(a,"cumprod");var u=H7([i],a.shape.length),c=a;null!=u&&(c=wye({inputs:{x:a},backend:n,attrs:{perm:u}}));var l=K7(1,a.shape.length)[0];if(l!==c.shape.length-1)throw new Error("backend.cumprod in CPU expects an inner-most "+"axis=".concat(c.shape.length-1," but got axis=").concat(l));for(var h=h5(c.dtype,"int32"),p=c0(L$(c.shape),h),f=n.data.get(c.dataId).values,d=c.shape[c.shape.length-1],v=s?function(e,t){return e+d-t-1}:function(e,t){return e+t},m=0;m<f.length;m+=d)for(var g=0;g<d;g++){var y=v(m,g);if(0===g)p[y]=o?1:f[y];else{var b=v(m,g-1);p[y]=o?f[b]*p[b]:f[y]*p[b]}}var x=n.makeTensorInfo(c.shape,h,p);if(null!=u){var k=wye({inputs:{x:x},backend:n,attrs:{perm:q7(u)}});return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(c),k}return x}};var zxe={kernelName:c1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.axis,o=r.exclusive,s=r.reverse;qme(a,"cumsum");var u=H7([i],a.shape.length),c=a;null!=u&&(c=wye({inputs:{x:a},backend:n,attrs:{perm:u}}));var l=K7(1,a.shape.length)[0];if(l!==c.shape.length-1)throw new Error("backend.cumsum in CPU expects an inner-most "+"axis=".concat(c.shape.length-1," but got axis=").concat(l));for(var h=h5(c.dtype,"int32"),p=l0(L$(c.shape),h),f=n.data.get(c.dataId).values,d=c.shape[c.shape.length-1],v=s?function(e,t){return e+d-t-1}:function(e,t){return e+t},m=0;m<f.length;m+=d)for(var g=0;g<d;g++){var y=v(m,g);if(0===g)p[y]=o?0:f[y];else{var b=v(m,g-1);p[y]=o?f[b]+p[b]:f[y]+p[b]}}var x=n.makeTensorInfo(c.shape,h,p);if(null!=u){var k=wye({inputs:{x:x},backend:n,attrs:{perm:q7(u)}});return n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(c),k}return x}};var Pxe={kernelName:h1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.weights,o=r.size,s=r.binaryOutput;if(1===a.shape.length){var u=dge(n.data.get(a.dataId).values,n.data.get(i.dataId).values,i.dtype,i.shape,o);return n.makeTensorInfo([o],i.dtype,u)}if(2===a.shape.length){var c=vge(n.bufferSync(a),n.bufferSync(i),o,s);return n.makeTensorInfo(c.shape,i.dtype,c.values)}throw new Error("Error in denseBincount: input must be at most rank 2, but got rank"+"".concat(a.shape.length,"."))}};var Bxe={kernelName:p1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.blockSize,o=r.dataFormat;F$("NHWC"===o,(function(){return"Only NHWC dataFormat supported on CPU for depthToSpace. Got ".concat(o)}));for(var s=a.shape[0],u=a.shape[1],c=a.shape[2],l=a.shape[3],h=u*i,p=c*i,f=l/(i*i),d=n.data.get(a.dataId).values,v=new Float32Array(s*h*p*f),m=0,g=0;g<s;++g)for(var y=0;y<h;++y)for(var b=Math.floor(y/i),x=y%i,k=0;k<p;++k)for(var w=Math.floor(k/i),I=(x*i+k%i)*f,N=0;N<f;++N){var S=N+I+l*(w+c*(b+u*g));v[m++]=d[S]}return n.makeTensorInfo([s,h,p,f],a.dtype,v)}};function Wxe(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.filter,o=r.strides,s=r.pad,u=r.dilations,c=r.dimRoundingMode;qme([a,i],"depthwiseConv2DNative");var l=i0(a.shape),h=i0(i.shape),p=u;null==p&&(p=[1,1]),F$(L8(o,p),(function(){return"Error in depthwiseConv2d: Either strides or dilations must be "+"1. Got strides ".concat(o," and dilations '").concat(p,"'")}));for(var f=T8(a.shape,i.shape,o,p,s,c,!0),d=f.filterHeight,v=f.filterWidth,m=f.dilationHeight,g=f.dilationWidth,y=f.padInfo,b=y.left,x=y.top,k=f.outChannels/f.inChannels,w=new $4(f.outShape,a.dtype),I=n.data.get(a.dataId).values,N=n.data.get(i.dataId).values,S=w.values,T=0;T<f.batchSize;++T)for(var E=T*l[0],C=T*w.strides[0],A=0;A<f.outHeight;++A)for(var R=C+A*w.strides[1],_=A*f.strideHeight-x,O=0;O<d;++O){var F=_+O*m;if(!(F<0||F>=f.inHeight))for(var D=O*h[0],M=E+F*l[1],L=0;L<f.outWidth;++L)for(var z=R+L*w.strides[2],P=L*f.strideWidth-b,B=0;B<v;++B){var W=P+B*g;if(!(W<0||W>=f.inWidth))for(var V=D+B*h[1],U=M+W*f.inChannels,G=z,j=V,H=0;H<f.inChannels;++H){for(var q=I[U+H],K=0;K<k;++K)S[G+K]+=q*N[j+K];G+=k,j+=k}}}return n.makeTensorInfo(w.shape,w.dtype,w.values)}var Vxe={kernelName:f1,backendName:"cpu",kernelFunc:Wxe};var Uxe={kernelName:d1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.dy,o=r.strides,s=r.dilations,u=r.pad,c=r.dimRoundingMode,l=r.filterShape;qme([a,i],"depthwiseConv2dNativeBackpropFilter");for(var h=T8(a.shape,l,o,s,u,c,!0),p=h.strideHeight,f=h.strideWidth,d=h.filterHeight,v=h.filterWidth,m=new $4(h.filterShape,"float32"),g=h.padInfo.left,y=h.padInfo.top,b=h.outChannels/h.inChannels,x=n.data.get(a.dataId).values,k=new $4(a.shape,a.dtype,x),w=n.data.get(i.dataId).values,I=new $4(i.shape,i.dtype,w),N=0;N<d;++N)for(var S=Math.max(0,Math.ceil((y-N)/p)),T=Math.min(h.outHeight,(h.inHeight+y-N)/p),E=0;E<v;++E)for(var C=Math.max(0,Math.ceil((g-E)/f)),A=Math.min(h.outWidth,(h.inWidth+g-E)/f),R=0;R<h.outChannels;++R){for(var _=Math.trunc(R/b),O=R%b,F=0,D=0;D<h.batchSize;++D)for(var M=S;M<T;++M)for(var L=N+M*p-y,z=C;z<A;++z){var P=E+z*f-g;F+=k.get(D,L,P,_)*I.get(D,M,z,R)}m.set(F,N,E,_,O)}return n.makeTensorInfo(m.shape,m.dtype,m.values)}};var Gxe={kernelName:v1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.dy,i=t.filter,o=r.strides,s=r.dilations,u=r.pad,c=r.dimRoundingMode,l=r.inputShape;qme([a,i],"depthwiseConv2DNativeBackpropInput");for(var h=i0(a.shape),p=i0(i.shape),f=T8(l,i.shape,o,s,u,c,!0),d=new $4(f.inShape,"float32"),v=d.values,m=S(d.strides,3),g=m[0],y=m[1],b=m[2],x=n.data.get(a.dataId).values,k=S(h,3),w=k[0],I=k[1],N=k[2],T=n.data.get(i.dataId).values,E=S(p,3),C=E[0],A=E[1],R=E[2],_=f.batchSize,O=f.filterHeight,F=f.filterWidth,D=f.inChannels,M=f.inHeight,L=f.inWidth,z=f.outChannels,P=f.outHeight,B=f.outWidth,W=f.strideHeight,V=f.strideWidth,U=O-1-f.padInfo.top,G=F-1-f.padInfo.left,j=z/D,H=0;H<_;++H)for(var q=0;q<D;++q)for(var K=0;K<M;++K)for(var X=K-U,Y=Math.max(0,Math.ceil(X/W)),J=Math.min(P,(O+X)/W),Z=0;Z<L;++Z){for(var Q=Z-G,$=Math.max(0,Math.ceil(Q/V)),ee=Math.min(B,(F+Q)/V),te=0,ne=Y;ne<J;++ne)for(var re=ne*W-X,ae=$;ae<ee;++ae)for(var ie=w*H+I*ne+N*ae,oe=C*(O-1-re)+A*(F-1-(ae*V-Q))+R*q,se=0;se<j;++se){te+=x[ie+(q*j+se)]*T[oe+se]}v[g*H+y*K+b*Z+q]=te}return n.makeTensorInfo(d.shape,d.dtype,d.values)}};var jxe={kernelName:m1,backendName:"cpu",kernelFunc:function(e){for(var t=e.inputs,n=e.backend,r=t.x,a=L$(r.shape),i=n.data.get(r.dataId).values,o=K6([a,a],r.dtype),s=o.values,u=0;u<i.length;u++)s[u*a+u]=i[u];var c=[].concat(T(r.shape),T(r.shape));return n.makeTensorInfo(c,o.dtype,o.values)}},Hxe={kernelName:g1,backendName:"cpu",kernelFunc:function(e){for(var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.filter,o=r.strides,s=r.pad,u=r.dilations,c=n,l=c.data.get(a.dataId).values,h=a.shape.length,p=c.data.get(i.dataId).values,f=i.shape.length,d=I8(a.shape,i.shape,o,s,"NHWC",u),v=d.batchSize,m=d.inHeight,g=d.inWidth,y=d.inChannels,b=d.outHeight,x=d.outWidth,k=d.padInfo,w=d.strideHeight,I=d.strideWidth,N=d.filterHeight,S=d.filterWidth,T=d.dilationHeight,E=d.dilationWidth,C=d.outShape,A=L$(C),R=C.length,_=K$(a.dtype,A),O=0;O<v;++O)for(var F=0;F<b;++F)for(var D=F*w-k.top,M=0;M<x;++M)for(var L=M*I-k.left,z=0;z<y;++z){for(var P=Number.MIN_SAFE_INTEGER,B=0;B<N;++B){var W=D+B*T;if(W>=0&&W<m)for(var V=0;V<S;++V){var U=L+V*E;if(U>=0&&U<g){var G=f0([O,W,U,z],h,i0(a.shape)),j=f0([B,V,z],f,i0(i.shape)),H=l[G]+p[j];H>P&&(P=H)}}}_[f0([O,F,M,z],R,i0(C))]=P}return{dataId:c.write(L4(_,a.dtype),C,a.dtype),shape:C,dtype:a.dtype}}},qxe={kernelName:b1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.filter,o=t.dy,s=r.strides,u=r.pad,c=r.dilations,l=n,h=s0(a.shape,l.data.get(a.dataId).values),p=s0(i.shape,l.data.get(i.dataId).values),f=I8(a.shape,i.shape,s,u,"NHWC",c),d=f.batchSize,v=f.inHeight,m=f.inWidth,g=f.inChannels,y=f.outHeight,b=f.outWidth,x=f.padInfo,k=f.strideHeight,w=f.strideWidth,I=f.filterHeight,N=f.filterWidth,S=f.dilationHeight,T=f.dilationWidth,E=f.outShape;F$(o.rank===E.length,(function(){return"Error in ".concat(b1,", dy ")+"must have the same rank as output ".concat(E.length,", but got ")+"".concat(o.rank)}));for(var C=s0(E,l.data.get(o.dataId).values),A=h0(i.shape,i.dtype),R=0;R<d;++R)for(var _=0;_<y;++_)for(var O=_*k-x.top,F=0;F<b;++F)for(var D=F*w-x.left,M=0;M<g;++M){for(var L=Number.MIN_SAFE_INTEGER,z=0,P=0,B=0;B<I;++B){var W=O+B*S;if(W>=0&&W<v)for(var V=0;V<N;++V){var U=D+V*T;if(U>=0&&U<m){var G=h[R][W][U][M]+p[B][V][M];G>L&&(L=G,z=B,P=V)}}}A[z][P][M]+=C[R][_][F][M]}return{dataId:l.write(L4(A,a.dtype),i.shape,i.dtype),shape:i.shape,dtype:i.dtype}}},Kxe={kernelName:y1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.filter,o=t.dy,s=r.strides,u=r.pad,c=r.dilations,l=n,h=s0(a.shape,l.data.get(a.dataId).values),p=s0(i.shape,l.data.get(i.dataId).values),f=I8(a.shape,i.shape,s,u,"NHWC",c),d=f.batchSize,v=f.inHeight,m=f.inWidth,g=f.inChannels,y=f.outHeight,b=f.outWidth,x=f.padInfo,k=f.strideHeight,w=f.strideWidth,I=f.filterHeight,N=f.filterWidth,S=f.dilationHeight,T=f.dilationWidth,E=f.outShape;F$(o.rank===E.length,(function(){return"Error in ".concat(y1,", dy ")+"must have the same rank as output ".concat(E.length,", but got ")+"".concat(o.rank)}));for(var C=s0(E,l.data.get(o.dataId).values),A=h0(a.shape,a.dtype),R=0;R<d;++R)for(var _=0;_<y;++_)for(var O=_*k-x.top,F=0;F<b;++F)for(var D=F*w-x.left,M=0;M<g;++M){for(var L=Number.MIN_SAFE_INTEGER,z=O<0?0:O,P=D<0?0:D,B=0;B<I;++B){var W=O+B*S;if(W>=0&&W<v)for(var V=0;V<N;++V){var U=D+V*T;if(U>=0&&U<m){var G=h[R][W][U][M]+p[B][V][M];G>L&&(L=G,z=W,P=U)}}}A[R][z][P][M]+=C[R][_][F][M]}return{dataId:l.write(L4(A,a.dtype),a.shape,a.dtype),shape:a.shape,dtype:a.dtype}}};var Xxe={kernelName:x1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.image,i=r.canvas,o=r.options||{},s=o.contextOptions,u=o.imageOptions,c=(null==u?void 0:u.alpha)||1,l=(null==s?void 0:s.contextType)||"2d";if("2d"!==l)throw new Error("Context type ".concat(s.contextType," is not supported by the CPU backend."));var h=i.getContext(l,(null==s?void 0:s.contextAttributes)||{});if(null==h)throw new Error("Could not get the context with ".concat(l," type."));for(var p=S(a.shape.slice(0,2),2),f=p[0],d=p[1],v=2===a.shape.length?1:a.shape[2],m=n.data.get(a.dataId).values,g="float32"===a.dtype?255:1,y=new Uint8ClampedArray(d*f*4),b=0;b<f*d;++b){for(var x=[0,0,0,255*c],k=0;k<v;k++){var w=m[b*v+k];if("float32"===a.dtype){if(w<0||w>1)throw new Error("Tensor values for a float32 Tensor must be in the "+"range [0 - 1] but encountered ".concat(w,"."))}else if("int32"===a.dtype&&(w<0||w>255))throw new Error("Tensor values for a int32 Tensor must be in the "+"range [0 - 255] but encountered ".concat(w,"."));1===v?(x[0]=w*g,x[1]=w*g,x[2]=w*g):x[k]=w*g}var I=4*b;y[I+0]=Math.round(x[0]),y[I+1]=Math.round(x[1]),y[I+2]=Math.round(x[2]),y[I+3]=Math.round(x[3])}i.width=d,i.height=f;var N=new ImageData(y,d,f);return h.putImageData(N,0,0),a}};function Yxe(e){var t,n=e.inputs,r=e.backend,a=e.attrs,i=n.x,o=a.axis,s=a.keepDims;qme(i,"sum");var u=(t="bool"===i.dtype?oge({inputs:{x:i},backend:r,attrs:{dtype:"int32"}}):tge({inputs:{x:i},backend:r})).shape.length,c=j$(o,t.shape),l=H7(c,u),h=c,p=t;null!=l&&(p=wye({inputs:{x:t},backend:r,attrs:{perm:l}}),h=K7(h.length,u)),j7("sum",h,p.shape.length);for(var f=S(U7(p.shape,h),2),d=f[0],v=f[1],m=ege(r,d,h5(p.dtype,"int32")),g=L$(v),y=r.data.get(m.dataId).values,b=r.data.get(p.dataId).values,x=0;x<y.length;++x){for(var k=x*g,w=0,I=0;I<g;++I)w+=b[k+I];y[x]=w}if(s){var N=m;m=Mbe({inputs:{x:m},backend:r,attrs:{shape:G7(m.shape,c)}}),r.disposeIntermediateTensorInfo(N)}return r.disposeIntermediateTensorInfo(t),null!=l&&r.disposeIntermediateTensorInfo(p),m}var Jxe={kernelName:a3,backendName:"cpu",kernelFunc:Yxe};var Zxe={kernelName:w1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t,a=Nie(e.attrs.equation,r.length),i=a.allDims,o=a.summedDims,s=a.idDims;Tie(i.length,s,r);for(var u=Eie(o,s),c=u.path,l=u.steps,h=l.length,p=null,f=i.length,d=[],v=0;v<h;++v){var m,g=O(l[v]);try{for(g.s();!(m=g.n()).done;){var y=m.value,b=Sie(f,s[y]),x=b.permutationIndices,k=b.expandDims,w=void 0;Cie(x)?w=r[y]:(w=wye({inputs:{x:r[y]},backend:n,attrs:{perm:x}}),d.push(w));for(var I=w.shape.slice(),N=0;N<k.length;++N)I.splice(k[N],0,1);P$(w.shape,I)||(w=Mbe({inputs:{x:w},backend:n,attrs:{shape:I}}),d.push(w)),null===p?p=w:(p=dye({inputs:{a:w,b:p},backend:n}),d.push(p))}}catch(e){g.e(e)}finally{g.f()}v<h-1&&(c[v]>=0&&(p=Yxe({inputs:{x:p},backend:n,attrs:{axis:c[v]-(i.length-f),keepDims:!1}}),d.push(p)),f--)}for(var S=0,T=d;S<T.length;S++){var E=T[S];E!==p&&n.disposeIntermediateTensorInfo(E)}return p}};var Qxe={kernelName:N1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.dy,a=t.y;qme([r,a],"eluGrad");for(var i=new Float32Array(L$(a.shape)),o=n.data.get(a.dataId).values,s=n.data.get(r.dataId).values,u=0;u<o.length;++u){var c=o[u];i[u]=c>=0?s[u]:s[u]*(c+1)}return n.makeTensorInfo(a.shape,"float32",i)}},$xe=xge(S1,(function(e){var t=Math.sign(e),n=Math.abs(e),r=1/(1+.3275911*n);return t*(1-((((1.061405429*r-1.453152027)*r+1.421413741)*r-.284496736)*r+.254829592)*r*Math.exp(-n*n))})),eke={kernelName:S1,backendName:"cpu",kernelFunc:$xe};function tke(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.input,i=r.dim,o=a.shape.length,s=a.shape.slice(),u=i;return i<0&&(F$(-(o+1)<=i,(function(){return"Axis must be in the interval [".concat(-(o+1),", ").concat(o,"]")})),u=o+i+1),s.splice(u,0,1),Mbe({inputs:{x:a},backend:n,attrs:{shape:s}})}var nke={kernelName:C1,backendName:"cpu",kernelFunc:tke},rke=Zme((function(e,t){return e/t})),ake=uge(k1,rke),ike={kernelName:k1,backendName:"cpu",kernelFunc:ake};function oke(e,t,n){for(var r=e.shape,a=r[0],i=r[1],o=n.data.get(e.dataId),s=o.complexTensorInfos.real,u=o.complexTensorInfos.imag,c=[a,i],l=L$(c),h=q$("float32",l),p=q$("float32",l),f=0;f<a;f++){for(var d=qye({inputs:{x:s},backend:n,attrs:{begin:[f,0],size:[1,i]}}),v=qye({inputs:{x:u},backend:n,attrs:{begin:[f,0],size:[1,i]}}),m=Qme({inputs:{real:d,imag:v},backend:n}),g=ske(m,t,n),y=die(g.real,g.imag),b=0;b<i;b++){var x=yie(y,b);h[f*i+b]=x.real,p[f*i+b]=x.imag}n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(v),n.disposeIntermediateTensorInfo(m)}var k=n.makeTensorInfo(c,"float32",h),w=n.makeTensorInfo(c,"float32",p),I=Qme({inputs:{real:k,imag:w},backend:n});return n.disposeIntermediateTensorInfo(k),n.disposeIntermediateTensorInfo(w),I}function ske(e,t,n){var r=L$(e.shape),a=n.data.get(e.dataId),i=n.data.get(a.complexTensorInfos.real.dataId).values,o=n.data.get(a.complexTensorInfos.imag.dataId).values;if(0==((g=r)&g-1)){var s=uke(i,o,r,t,n),u=[e.shape[0],e.shape[1]];if(t){var c=n.makeTensorInfo(u,"float32",s.real),l=n.makeTensorInfo(u,"float32",s.imag),h=n.makeTensorInfo([],"float32",M4(r,"float32")),p=tge({inputs:{x:h},backend:n}),f=ike.kernelFunc({inputs:{a:c,b:h},backend:n}),d=ike.kernelFunc({inputs:{a:l,b:p},backend:n}),v=n.data.get(f.dataId).values,m=n.data.get(d.dataId).values;return n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(l),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(d),{real:v,imag:m}}return s}var g,y=function(e,t,n){for(var r=new Float32Array(2*t),a=0;a<t;a++){for(var i=0,o=0,s=0;s<t;s++){var u=kie(a*s,t,n),c=yie(e,s);i+=c.real*u.real-c.imag*u.imag,o+=c.real*u.imag+c.imag*u.real}n&&(i/=t,o/=t),bie(r,i,o,a)}return r}(die(i,o),r,t);return vie(y)}function uke(e,t,n,r,a){if(1===n)return{real:e,imag:t};var i=die(e,t),o=n/2,s=mie(i),u=s.real,c=s.imag,l=[u.length],h=a.makeTensorInfo(l,"float32",u),p=a.makeTensorInfo(l,"float32",c),f=Qme({inputs:{real:h,imag:p},backend:a}),d=gie(i),v=d.real,m=d.imag,g=[v.length],y=a.makeTensorInfo(g,"float32",v),b=a.makeTensorInfo(g,"float32",m),x=Qme({inputs:{real:y,imag:b},backend:a}),k=uke(u,c,o,r,a),w=k.real,I=k.imag,N=[w.length],S=a.makeTensorInfo(N,"float32",w),T=a.makeTensorInfo(N,"float32",I),E=Qme({inputs:{real:S,imag:T},backend:a}),C=uke(v,m,o,r,a),A=C.real,R=C.imag,_=[A.length],O=a.makeTensorInfo(_,"float32",A),F=a.makeTensorInfo(_,"float32",R),D=Qme({inputs:{real:O,imag:F},backend:a}),M=xie(n,r),L=[M.real.length],z=a.makeTensorInfo(L,"float32",M.real),P=a.makeTensorInfo(L,"float32",M.imag),B=Qme({inputs:{real:z,imag:P},backend:a}),W=dye({inputs:{a:B,b:D},backend:a}),V=pge({inputs:{a:E,b:W},backend:a}),U=dbe({inputs:{a:E,b:W},backend:a}),G=rge({inputs:{input:V},backend:a}),j=rge({inputs:{input:U},backend:a}),H=xxe({inputs:{input:V},backend:a}),q=xxe({inputs:{input:U},backend:a}),K=wxe({inputs:[G,j],backend:a,attrs:{axis:0}}),X=wxe({inputs:[H,q],backend:a,attrs:{axis:0}}),Y=a.data.get(K.dataId).values,J=a.data.get(X.dataId).values;return a.disposeIntermediateTensorInfo(h),a.disposeIntermediateTensorInfo(p),a.disposeIntermediateTensorInfo(f),a.disposeIntermediateTensorInfo(y),a.disposeIntermediateTensorInfo(b),a.disposeIntermediateTensorInfo(x),a.disposeIntermediateTensorInfo(S),a.disposeIntermediateTensorInfo(T),a.disposeIntermediateTensorInfo(E),a.disposeIntermediateTensorInfo(O),a.disposeIntermediateTensorInfo(F),a.disposeIntermediateTensorInfo(D),a.disposeIntermediateTensorInfo(z),a.disposeIntermediateTensorInfo(P),a.disposeIntermediateTensorInfo(B),a.disposeIntermediateTensorInfo(W),a.disposeIntermediateTensorInfo(V),a.disposeIntermediateTensorInfo(U),a.disposeIntermediateTensorInfo(G),a.disposeIntermediateTensorInfo(H),a.disposeIntermediateTensorInfo(j),a.disposeIntermediateTensorInfo(q),a.disposeIntermediateTensorInfo(K),a.disposeIntermediateTensorInfo(X),{real:Y,imag:J}}var cke={kernelName:R1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.input,a=L$(r.shape),i=r.shape[r.shape.length-1],o=Mbe({inputs:{x:r},backend:n,attrs:{shape:[a/i,i]}}),s=oke(o,!1,n),u=Mbe({inputs:{x:s},backend:n,attrs:{shape:r.shape}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(s),u}};function lke(e){var t=e.backend,n=e.attrs,r=n.shape,a=n.value,i=n.dtype||n0(a),o=K$(i,L$(r));return function(e,t,n){e.fill(t)}(o,a),t.makeTensorInfo(r,i,o)}var hke={kernelName:_1,backendName:"cpu",kernelFunc:lke};var pke={kernelName:O1,backendName:"cpu",kernelFunc:function(e){for(var t=e.inputs,n=(e.attrs,e.backend),r=t.image,a=n,i=q$(r.dtype,L$(r.shape)),o=S(r.shape,4),s=o[0],u=o[1],c=o[2],l=o[3],h=a.data.get(r.dataId).values,p=0;p<s;p++)for(var f=p*c*u*l,d=0;d<u;d++)for(var v=d*(c*l),m=0;m<c;m++)for(var g=m*l,y=0;y<l;y++){var b=Math.round(c-m-1),x=f+v+g+y,k=h[x];if(b>=0&&b<c)k=h[f+v+b*l+y];i[x]=k}return{dataId:a.write(i,r.shape,r.dtype),shape:r.shape,dtype:r.dtype}}};var fke={kernelName:M3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.filter,o=t.bias,s=t.preluActivationWeights,u=r.strides,c=r.pad,l=r.dataFormat,h=r.dilations,p=r.dimRoundingMode,f=r.activation,d=r.leakyreluAlpha,v=Nxe({inputs:{x:a,filter:i},backend:n,attrs:{strides:u,pad:c,dataFormat:l,dilations:h,dimRoundingMode:p}});if(o){var m=v;if("NCHW"===l&&1===o.shape.length&&1!==o.shape[0]){var g=Mbe({inputs:{x:o},backend:n,attrs:{shape:[o.shape[0],1,1]}});v=pge({inputs:{a:v,b:g},backend:n}),n.disposeIntermediateTensorInfo(g)}else v=pge({inputs:{a:v,b:o},backend:n});n.disposeIntermediateTensorInfo(m)}if(f){var y=v;if("NCHW"===l&&"prelu"===f&&1===s.shape.length&&1!==s.shape[0]){var b=Mbe({inputs:{x:s},backend:n,attrs:{shape:[s.shape[0],1,1]}});v=Dbe(n,v,f,b,d),n.disposeIntermediateTensorInfo(b)}else v=Dbe(n,v,f,s,d);n.disposeIntermediateTensorInfo(y)}return v}};var dke={kernelName:L3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.filter,o=t.bias,s=t.preluActivationWeights,u=r.strides,c=r.pad,l=r.dataFormat,h=r.dilations,p=r.dimRoundingMode,f=r.activation,d=r.leakyreluAlpha,v=Wxe({inputs:{x:a,filter:i},backend:n,attrs:{strides:u,pad:c,dataFormat:l,dilations:h,dimRoundingMode:p}});if(o){var m=v;v=pge({inputs:{a:v,b:o},backend:n}),n.disposeIntermediateTensorInfo(m)}if(f){var g=v;v=Dbe(n,v,f,s,d),n.disposeIntermediateTensorInfo(g)}return v}};var vke={kernelName:z1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.params,a=t.indices,i=L$(r.shape),o=a.shape,s=o[o.length-1],u=S(Iae(r,a),4),c=u[0],l=u[1],h=u[2],p=u[3];if(0===l)return n.makeTensorInfo(c,r.dtype,[]);var f=Vge(n.data.get(a.dataId).values,n.bufferSync(r),r.dtype,l,s,h,p,r.shape,i);return n.makeTensorInfo(c,r.dtype,f.values)}};var mke={kernelName:L1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.indices,o=r.axis,s=r.batchDims;qme([a,i],"gatherV2");for(var u=j$(o,a.shape)[0],c=n.data.get(i.dataId).values,l=a.shape[u],h=function(){var e=c[p];F$(e<=l-1&&e>=0,(function(){return"GatherV2: the index value ".concat(e," is not in [0, ").concat(l-1,"]")}))},p=0;p<c.length;++p)h();var f=s;null==s&&(f=0);var d=L$(i.shape),v=Hie(a,i,u,f),m=Mbe({inputs:{x:a},backend:n,attrs:{shape:[v.batchSize,v.outerSize,v.dimSize,v.sliceSize]}}),g=Mbe({inputs:{x:i},backend:n,attrs:{shape:[v.batchSize,d/v.batchSize]}}),y=[v.batchSize,v.outerSize,d/v.batchSize,v.sliceSize],b=n.bufferSync(g),x=Uge(n.bufferSync(m),b,y);return n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(g),n.makeTensorInfo(v.outputShape,x.dtype,x.values)}};var gke={kernelName:V1,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.input,a=L$(r.shape),i=r.shape[r.shape.length-1],o=Mbe({inputs:{x:r},backend:n,attrs:{shape:[a/i,i]}}),s=oke(o,!0,n),u=Mbe({inputs:{x:s},backend:n,attrs:{shape:r.shape}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(s),u}},yke=xge(G1,(function(e){return Number.isFinite(e)?1:0}),"bool"),bke={kernelName:G1,backendName:"cpu",kernelFunc:yke},xke=xge(j1,(function(e){return Math.abs(e)===1/0?1:0}),"bool"),kke={kernelName:j1,backendName:"cpu",kernelFunc:xke},wke=xge(H1,(function(e){return Number.isNaN(e)?1:0}),"bool"),Ike={kernelName:H1,backendName:"cpu",kernelFunc:wke};var Nke={kernelName:Y1,backendName:"cpu",kernelFunc:function(e){var t=e.backend,n=e.attrs,r=tye(n.start,n.stop,n.num);return t.makeTensorInfo([r.length],"float32",r)}},Ske=xge(Z1,(function(e){return Math.log1p(e)})),Tke={kernelName:Z1,backendName:"cpu",kernelFunc:Ske},Eke=Zme((function(e,t){return e&&t})),Cke=uge(Q1,Eke,null,"bool"),Ake={kernelName:Q1,backendName:"cpu",kernelFunc:Cke},Rke=xge($1,(function(e){return e?0:1}),"bool"),_ke={kernelName:$1,backendName:"cpu",kernelFunc:Rke},Oke=Zme((function(e,t){return e||t})),Fke=uge(e2,Oke,null,"bool"),Dke={kernelName:e2,backendName:"cpu",kernelFunc:Fke};var Mke={kernelName:n2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.depthRadius,o=r.bias,s=r.alpha,u=r.beta;qme(a,"LRN");var c=a.shape[3],l=c-1,h=n.data.get(a.dataId).values,p=L$(a.shape),f=new Float32Array(p);function d(e){for(var t=e%c,n=e-t+Math.max(0,t-i),r=e-t+Math.min(t+i,l),a=0;n<=r;n++){var o=h[n];a+=o*o}return a}for(var v=0;v<p;v++){var m=d(v),g=h[v]*Math.pow(o+s*m,-u);f[v]=g}return n.makeTensorInfo(a.shape,a.dtype,f)}};var Lke={kernelName:r2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.y,o=t.dy,s=r.depthRadius,u=r.bias,c=r.alpha,l=r.beta;qme(o,"LRNGrad");for(var h=L$(o.shape),p=o.shape[3],f=n.data.get(o.dataId).values,d=n.data.get(a.dataId).values,v=n.data.get(i.dataId).values,m=new Float32Array(h),g=h,y=0;y<g;y++){for(var b=y%p,x=y-b+Math.max(0,b-s),k=y-b+Math.min(p,b+s+1),w=0,I=x;I<k;I++)w+=Math.pow(d[I],2);w=c*w+u;for(var N=x;N<k;N++){var S=-2*c*l*d[N]*v[y]/w;y===N&&(S+=Math.pow(w,-l)),S*=f[y],m[N]+=S}}return n.makeTensorInfo(o.shape,a.dtype,m)}};function zke(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.reductionIndices,o=r.keepDims,s=n,u=a.shape,c=u.length,l=j$(i,u),h=l,p=H7(h,c),f=s.data.get(a.dataId).values;if(null!=p){for(var d=new Array(c),v=0;v<d.length;v++)d[v]=u[p[v]];f=kye(f,u,a.dtype,p,d),h=K7(h.length,c),u=d}qme(a,"max"),j7("max",h,c);var m=S(U7(u,h),2),g=m[0],y=iye(f,L$(m[1]),g,a.dtype),b=s.write(y,g,a.dtype),x=g;o&&(x=G7(g,l));return{dataId:b,shape:x,dtype:a.dtype}}var Pke={kernelName:a2,backendName:"cpu",kernelFunc:zke};var Bke={kernelName:o2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x;qme(a,"maxPool");var i=r.filterSize,o=r.strides,s=r.pad,u=r.dimRoundingMode;F$(L8(o,1),(function(){return"Error in maxPool: Either strides or dilations must be 1. "+"Got strides ".concat(o," and dilations '").concat(1,"'")}));var c,l=N8(a.shape,i,o,1,s,u);if(1===l.filterWidth&&1===l.filterHeight&&P$(l.inShape,l.outShape))c=tge({inputs:{x:a},backend:n});else{var h=n.data.get(a.dataId).values,p=i0(a.shape),f=oxe(h,a.shape,a.dtype,p,l,"max");c=n.makeTensorInfo(l.outShape,a.dtype,f.values)}return c}};var Wke={kernelName:u2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.filterSize,o=r.strides,s=r.pad,u=r.dimRoundingMode,c=r.dataFormat;qme(a,"maxPool3d");var l=S8(a.shape,i,o,1,s,u,c),h=uxe(n.data.get(a.dataId).values,a.shape,a.dtype,i0(a.shape),l,"max");return n.makeTensorInfo(h.shape,"float32",h.values)}};var Vke={kernelName:c2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.dy,i=t.input,o=r.filterSize,s=r.strides,u=r.pad,c=r.dimRoundingMode;qme([a,i],"maxPool3DGrad");for(var l=S8(i.shape,o,s,1,u,c),h=function(e,t){for(var n=K6(t.outShape,"int32"),r=t.strideDepth,a=t.strideHeight,i=t.strideWidth,o=t.dilationDepth,s=t.dilationHeight,u=t.dilationWidth,c=t.effectiveFilterDepth,l=t.effectiveFilterHeight,h=t.effectiveFilterWidth,p=t.padInfo.front,f=t.padInfo.top,d=t.padInfo.left,v=0;v<t.batchSize;++v)for(var m=0;m<t.inChannels;++m)for(var g=0;g<t.outDepth;++g){for(var y=g*r-p,b=y;b<0;)b+=o;for(var x=Math.min(t.inDepth,c+y),k=0;k<t.outHeight;++k){for(var w=k*a-f,I=w;I<0;)I+=s;for(var N=Math.min(t.inHeight,l+w),S=0;S<t.outWidth;++S){for(var T=S*i-d,E=T;E<0;)E+=u;for(var C=Math.min(t.inWidth,h+T),A=Number.NEGATIVE_INFINITY,R=-1,_=b;_<x;_+=o)for(var O=_-y,F=I;F<N;F+=s)for(var D=F-w,M=E;M<C;M+=u){var L=M-T,z=e.get(v,_,F,M,m);z>=A&&(A=z,R=O*l*h+D*l+L)}n.set(R,v,g,k,S,m)}}}return n}(n.bufferSync(i),l),p=l.strideDepth,f=l.strideHeight,d=l.strideWidth,v=l.dilationDepth,m=l.dilationHeight,g=l.dilationWidth,y=l.effectiveFilterDepth,b=l.effectiveFilterHeight,x=l.effectiveFilterWidth,k=y-1-l.padInfo.front,w=x-1-l.padInfo.left,I=b-1-l.padInfo.top,N=K6(i.shape,"float32"),S=n.bufferSync(a),T=0;T<l.batchSize;++T)for(var E=0;E<l.inChannels;++E)for(var C=0;C<l.inDepth;++C)for(var A=0;A<l.inHeight;++A)for(var R=0;R<l.inWidth;++R){for(var _=C-k,O=A-I,F=R-w,D=0,M=0;M<y;M+=v){var L=(_+M)/p;if(!(L<0||L>=l.outDepth||Math.floor(L)!==L))for(var z=0;z<b;z+=m){var P=(O+z)/f;if(!(P<0||P>=l.outHeight||Math.floor(P)!==P))for(var B=0;B<x;B+=g){var W=(F+B)/d;if(!(W<0||W>=l.outWidth||Math.floor(W)!==W)){var V=y*b*x-1-h.get(T,L,P,W,E)===M*b*x+z*x+B?1:0;if(0!==V)D+=S.get(T,L,P,W,E)*V}}}}N.set(D,T,C,A,R,E)}return n.makeTensorInfo(N.shape,N.dtype,N.values)}};var Uke={kernelName:s2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.dy,i=t.input,o=i;qme([i,t.output],"maxPoolGrad");for(var s=r.filterSize,u=r.strides,c=r.pad,l=r.dimRoundingMode,h=N8(o.shape,s,u,1,c,l),p=n.data.get(o.dataId).values,f=K6(h.outShape,o.dtype,sxe(p,o.shape,o.dtype,h).values),d=h.strideHeight,v=h.strideWidth,m=h.dilationHeight,g=h.dilationWidth,y=h.effectiveFilterHeight,b=h.effectiveFilterWidth,x=b-1-h.padInfo.left,k=y-1-h.padInfo.top,w=K6(o.shape,"float32"),I=n.data.get(a.dataId).values,N=K6(a.shape,"float32",I),S=0;S<h.batchSize;++S)for(var T=0;T<h.inChannels;++T)for(var E=0;E<h.inHeight;++E)for(var C=0;C<h.inWidth;++C){for(var A=E-k,R=C-x,_=0,O=0;O<y;O+=m){var F=(A+O)/d;if(!(F<0||F>=h.outHeight||Math.floor(F)!==F))for(var D=0;D<b;D+=g){var M=(R+D)/v;if(!(M<0||M>=h.outWidth||Math.floor(M)!==M)){var L=y*b-1-f.get(S,F,M,T)===O*b+D?1:0;if(0!==L)_+=N.get(S,F,M,T)*L}}}w.set(_,S,E,C,T)}return n.makeTensorInfo(w.shape,w.dtype,w.values)}};var Gke={kernelName:l2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.attrs,r=e.backend,a=t.x,i=n.filterSize,o=n.strides,s=n.pad,u=n.includeBatchInIndex,c=r;qme(a,"MaxPoolWithArgmax");var l=c.data.get(a.dataId).values,h=N8(a.shape,i,o,[1,1],s),p=function(e,t,n,r,a){var i=oxe(e,0,n,i0(t),a,"max"),o=sxe(e,t,n,a,!0,r);return[i.values,o.values]}(l,a.shape,a.dtype,u,h),f=S(p,2),d=f[0],v=f[1],m=c.write(d,h.outShape,a.dtype),g=c.write(v,h.outShape,a.dtype);return[{dataId:m,shape:h.outShape,dtype:a.dtype},{dataId:g,shape:h.outShape,dtype:"int32"}]}};var jke={kernelName:h2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.axis,o=r.keepDims,s=j$(i,a.shape),u=L$(U7(a.shape,s)[1]),c=[],l=n.makeTensorInfo([],"float32",new Float32Array([u]));c.push(l);var h=oge({inputs:{x:a},backend:n,attrs:{dtype:"float32"}});c.push(h);var p=ake({inputs:{a:h,b:l},backend:n});c.push(p);var f=Yxe({inputs:{x:p},backend:n,attrs:{axis:i,keepDims:o}});return c.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),f}};var Hke={kernelName:p2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.axis,o=r.keepDims;qme(a,"min");var s=j$(i,a.shape),u=s,c=H7(u,a.shape.length),l=a;null!=c&&(l=wye({inputs:{x:a},backend:n,attrs:{perm:c}}),u=K7(u.length,a.shape.length)),j7("min",u,l.shape.length);for(var h=S(U7(l.shape,u),2),p=h[0],f=L$(h[1]),d=l0(L$(p),l.dtype),v=n.data.get(l.dataId).values,m=0;m<d.length;++m){for(var g=m*f,y=v[g],b=0;b<f;++b){var x=v[g+b];(Number.isNaN(x)||x<y)&&(y=x)}d[m]=y}null!=c&&n.disposeIntermediateTensorInfo(l);var k=n.makeTensorInfo(p,l.dtype,d);if(o){var w=Mbe({inputs:{x:k},backend:n,attrs:{shape:G7(p,s)}});return n.disposeIntermediateTensorInfo(k),w}return k}};var qke={kernelName:d2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.paddings,o=r.mode;qme(a,"mirrorPad");for(var s=i.map((function(e,t){return e[0]+a.shape[t]+e[1]})),u=i.map((function(e){return e[0]})),c=i.map((function(e,t){return e[0]+a.shape[t]})),l="reflect"===o?0:1,h=n.data.get(a.dataId).values,p=a.shape.length,f=i0(a.shape),d=L$(s),v=s.length,m=i0(s),g=q$(a.dtype,d),y=0;y<d;y++){for(var b=d0(y,v,m),x=0;x<v;x++)b[x]<u[x]?b[x]=2*u[x]-b[x]-l:b[x]>=c[x]&&(b[x]=2*(c[x]-1)-b[x]+l);b=b.map((function(e,t){return e-u[t]}));var k=f0(b,p,f);g[y]=h[k]}return{dataId:n.write(g,s,a.dtype),shape:s,dtype:a.dtype}}},Kke=Zme((function(e,t){var n=e%t;return e<0&&t<0||e>=0&&t>=0?n:(n+t)%t})),Xke=uge(v2,Kke),Yke={kernelName:v2,backendName:"cpu",kernelFunc:Xke};function Jke(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.logits,i=r.dim,o=a.shape.length,s=i;if(-1===s&&(s=o-1),s!==o-1)throw Error("Softmax along a non-last dimension is not yet supported. "+"Logits was rank ".concat(o," and dim was ").concat(s));var u=j$([s],a.shape),c=zke({inputs:{x:a},backend:n,attrs:{reductionIndices:u,keepDims:!1}}),l=G7(c.shape,u),h=Mbe({inputs:{x:c},backend:n,attrs:{shape:l}}),p=dbe({inputs:{a:a,b:h},backend:n}),f=Rge({inputs:{x:p},backend:n}),d=Yxe({inputs:{x:f},backend:n,attrs:{axis:u,keepDims:!1}}),v=Mbe({inputs:{x:d},backend:n,attrs:{shape:l}}),m=ake({inputs:{a:f,b:v},backend:n});return n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(v),m}var Zke={kernelName:s3,backendName:"cpu",kernelFunc:Jke};var Qke={kernelName:m2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.logits,i=r.numSamples,o=r.seed,s=r.normalized;qme(a,"multinomial");for(var u=s?a:Jke({inputs:{logits:a},backend:n,attrs:{dim:-1}}),c=u.shape[0],l=u.shape[1],h=n.data.get(u.dataId).values,p=[c,i],f=l0(L$(p),"int32"),d=0;d<c;++d){var v=d*l,m=new Float32Array(l-1);m[0]=h[v];for(var g=1;g<m.length;++g)m[g]=m[g-1]+h[v+g];for(var y=Pee.alea(o.toString()),b=d*i,x=0;x<i;++x){var k=y();f[b+x]=m.length;for(var w=0;w<m.length;w++)if(k<m[w]){f[b+x]=w;break}}}return s||n.disposeIntermediateTensorInfo(u),n.makeTensorInfo(p,"int32",f)}},$ke=zne;var ewe={kernelName:x2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.boxes,i=t.scores,o=r.maxOutputSize,s=r.iouThreshold,u=r.scoreThreshold;qme(a,"NonMaxSuppression");var c=n.data.get(a.dataId).values,l=n.data.get(i.dataId).values,h=$ke(c,l,o,s,u).selectedIndices;return n.makeTensorInfo([h.length],"int32",new Int32Array(h))}},twe=Pne;var nwe={kernelName:k2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.boxes,i=t.scores,o=r.maxOutputSize,s=r.iouThreshold,u=r.scoreThreshold,c=r.padToMaxOutputSize;qme(a,"NonMaxSuppressionPadded");var l=n.data.get(a.dataId).values,h=n.data.get(i.dataId).values,p=twe(l,h,o,s,u,c),f=p.selectedIndices,d=p.validOutputs;return[n.makeTensorInfo([f.length],"int32",new Int32Array(f)),n.makeTensorInfo([],"int32",new Int32Array([d]))]}},rwe=Bne;var awe={kernelName:w2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.boxes,i=t.scores,o=r.maxOutputSize,s=r.iouThreshold,u=r.scoreThreshold,c=r.softNmsSigma;qme(a,"NonMaxSuppressionWithScore");var l=n.data.get(a.dataId).values,h=n.data.get(i.dataId).values,p=rwe(l,h,o,s,u,c),f=p.selectedIndices,d=p.selectedScores;return[n.makeTensorInfo([f.length],"int32",new Int32Array(f)),n.makeTensorInfo([d.length],"float32",new Float32Array(d))]}};var iwe={kernelName:N2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.indices,i=r.dtype,o=r.depth,s=r.onValue,u=r.offValue;qme(a,"oneHot");var c=L$(a.shape),l=new Float32Array(c*o);l.fill(u);for(var h=n.data.get(a.dataId).values,p=0;p<c;++p)h[p]>=0&&h[p]<o&&(l[p*o+h[p]]=s);return n.makeTensorInfo([].concat(T(a.shape),[o]),i,l)}};function owe(e){var t=e.inputs,n=e.backend,r=t.x;if("string"===r.dtype)throw new Error("zerosLike is not supported for string tensors");if("complex64"===r.dtype){var a=rge({inputs:{input:r},backend:n}),i=owe({inputs:{x:a},backend:n}),o=xxe({inputs:{input:r},backend:n}),s=owe({inputs:{x:o},backend:n}),u=Qme({inputs:{real:i,imag:s},backend:n});return n.disposeIntermediateTensorInfo(a),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(s),u}return lke({backend:n,attrs:{shape:r.shape,value:0,dtype:r.dtype}})}var swe={kernelName:R3,backendName:"cpu",kernelFunc:owe};var uwe={kernelName:I2,backendName:"cpu",kernelFunc:function e(t){var n=t.inputs,r=t.backend,a=n.x;if("string"===a.dtype)throw new Error("onesLike is not supported for string tensors");if("complex64"===a.dtype){var i=rge({inputs:{input:a},backend:r}),o=e({inputs:{x:i},backend:r}),s=xxe({inputs:{input:a},backend:r}),u=owe({inputs:{x:s},backend:r}),c=Qme({inputs:{real:o,imag:u},backend:r});return r.disposeIntermediateTensorInfo(i),r.disposeIntermediateTensorInfo(o),r.disposeIntermediateTensorInfo(s),r.disposeIntermediateTensorInfo(u),c}return lke({backend:r,attrs:{shape:a.shape,value:1,dtype:a.dtype}})}};function cwe(e){var t=e.inputs,n=e.backend,r=e.attrs.axis;if(1===t.length)return tke({inputs:{input:t[0]},backend:n,attrs:{dim:r}});var a=t[0].shape,i=t[0].dtype;t.forEach((function(e){D$(a,e.shape,"All tensors passed to stack must have matching shapes"),F$(i===e.dtype,(function(){return"All tensors passed to stack must have matching dtypes"}))}));var o=[],s=wxe({inputs:t.map((function(e){var t=tke({inputs:{input:e},backend:n,attrs:{dim:r}});return o.push(t),t})),backend:n,attrs:{axis:r}});return o.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),s}var lwe={kernelName:S2,backendName:"cpu",kernelFunc:cwe};var hwe={kernelName:T2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.paddings,o=r.constantValue;qme(a,"pad");var s=i.map((function(e,t){return e[0]+a.shape[t]+e[1]})),u=i.map((function(e){return e[0]})),c=n.data.get(a.dataId).values,l=L$(a.shape),h=a.shape.length,p=i0(a.shape),f=L$(s),d=s.length,v=i0(s),m=q$(a.dtype,f);0!==o&&m.fill(o);for(var g=0;g<l;g++){m[f0(d0(g,h,p).map((function(e,t){return e+u[t]})),d,v)]=c[g]}return{dataId:n.write(m,s,a.dtype),shape:s,dtype:a.dtype}}},pwe=Zme((function(e,t){return Math.pow(e,t)})),fwe=uge(E2,pwe),dwe={kernelName:E2,backendName:"cpu",kernelFunc:fwe};var vwe={kernelName:R2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.paramsNestedSplits,i=t.paramsDenseValues,o=t.indices,s=(r.outputRaggedRank,a.map((function(e){return n.data.get(e.dataId).values}))),u=a.map((function(e){return e.shape})),c=n.data.get(i.dataId).values,l=n.data.get(o.dataId).values,h=S(Aye(s,u,c,i.shape,i.dtype,l,o.shape),3),p=h[0],f=h[1],d=h[2],v=p.map((function(e){return n.makeTensorInfo([e.length],"int32",e)})),m=n.makeTensorInfo(d,i.dtype,f);return v.concat([m])}};var mwe={kernelName:_2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.starts,a=t.limits,i=t.deltas,o=n.data.get(r.dataId).values,s=n.data.get(a.dataId).values,u=n.data.get(i.dataId).values,c=S(_ye(o,r.shape,r.dtype,s,a.shape,u,i.shape),2),l=c[0],h=c[1];return[n.makeTensorInfo([l.length],"int32",l),n.makeTensorInfo([h.length],r.dtype,h)]}};var gwe={kernelName:O2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.shape,i=t.values,o=t.defaultValue,s=t.rowPartitionTensors,u=r.rowPartitionTypes,c=n.data.get(a.dataId).values,l=n.data.get(i.dataId).values,h=n.data.get(o.dataId).values,p=s.map((function(e){return n.data.get(e.dataId).values})),f=s.map((function(e){return e.shape})),d=S(Lye(c,a.shape,l,i.shape,i.dtype,h,o.shape,p,f,u),2),v=d[0],m=d[1];return n.makeTensorInfo(v,i.dtype,m)}};var ywe={kernelName:F2,backendName:"cpu",kernelFunc:function(e){var t=e.backend,n=e.attrs,r=n.start,a=n.stop,i=n.dtype,o=zye(r,a,n.step,i);return t.makeTensorInfo([o.length],i,o)}},bwe=xge(M2,(function(e){return 1/e})),xwe={kernelName:M2,backendName:"cpu",kernelFunc:bwe};var kwe={kernelName:W2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.images,i=r.alignCorners,o=r.halfPixelCenters,s=r.size;qme(a,"resizeBilinear");for(var u=i0(a.shape),c=S(s,2),l=c[0],h=c[1],p=S(a.shape,4),f=p[0],d=p[1],v=p[2],m=p[3],g=n.data.get(a.dataId).values,y=new Float32Array(L$([f,l,h,m])),b=[i&&l>1?d-1:d,i&&h>1?v-1:v],x=[i&&l>1?l-1:l,i&&h>1?h-1:h],k=0,w=b[0]/x[0],I=b[1]/x[1],N=0;N<f;N++)for(var T=0;T<l;T++){var E=void 0;E=o?w*(T+.5)-.5:w*T;for(var C=Math.max(0,Math.floor(E)),A=E-C,R=Math.min(d-1,Math.ceil(E)),_=N*u[0]+C*u[1],O=N*u[0]+R*u[1],F=0;F<h;F++){var D=void 0;D=o?I*(F+.5)-.5:I*F;for(var M=Math.max(0,Math.floor(D)),L=D-M,z=Math.min(v-1,Math.ceil(D)),P=_+M*u[2],B=O+M*u[2],W=_+z*u[2],V=O+z*u[2],U=0;U<m;U++){var G=g[P+U],j=g[B+U],H=G+(g[W+U]-G)*L,q=H+(j+(g[V+U]-j)*L-H)*A;y[k++]=q}}}return n.makeTensorInfo([f,l,h,m],"float32",y)}};var wwe={kernelName:V2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.images,i=t.dy,o=r.alignCorners;qme([i,a],"resizeBilinearGrad");for(var s=i0(a.shape),u=S(a.shape,4),c=u[0],l=u[1],h=u[2],p=u[3],f=S(i.shape,3),d=f[1],v=f[2],m=new Float32Array(c*l*h*p),g=[o&&d>1?l-1:l,o&&v>1?h-1:h],y=[o&&d>1?d-1:d,o&&v>1?v-1:v],b=g[0]/y[0],x=g[1]/y[1],k=n.data.get(i.dataId).values,w=0,I=0;I<c;I++)for(var N=I*s[0],T=0;T<d;T++)for(var E=T*b,C=Math.floor(E),A=Math.min(Math.ceil(E),l-1),R=N+C*s[1],_=N+A*s[1],O=E-C,F=1-O,D=0;D<v;D++)for(var M=D*x,L=Math.floor(M),z=Math.min(Math.ceil(M),h-1),P=M-L,B=1-P,W=R+L*s[2],V=R+z*s[2],U=_+L*s[2],G=_+z*s[2],j=F*B,H=F*P,q=O*B,K=O*P,X=0;X<p;X++){var Y=k[w++];m[W+X]+=Y*j,m[V+X]+=Y*H,m[U+X]+=Y*q,m[G+X]+=Y*K}return n.makeTensorInfo([c,h,l,p],"float32",m)}};var Iwe={kernelName:P2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.images,i=r.alignCorners,o=r.halfPixelCenters,s=r.size;qme(a,"resizeNearestNeighbor");for(var u=i0(a.shape),c=S(s,2),l=c[0],h=c[1],p=S(a.shape,4),f=p[0],d=p[1],v=p[2],m=p[3],g=n.data.get(a.dataId).values,y=new Float32Array(f*l*h*m),b=[i&&l>1?d-1:d,i&&h>1?v-1:v],x=[i&&l>1?l-1:l,i&&h>1?h-1:h],k=b[0]/x[0],w=b[1]/x[1],I=0,N=0;N<f;N++)for(var T=N*u[0],E=0;E<l;E++){var C=o?k*(E+.5):k*E,A=Math.min(d-1,i?Math.round(C):Math.floor(C));o&&(A=Math.max(0,A));for(var R=T+A*u[1],_=0;_<h;_++){var O=o?w*(_+.5):w*_,F=Math.min(v-1,i?Math.round(O):Math.floor(O));o&&(F=Math.max(0,F));for(var D=R+F*u[2],M=0;M<m;M++){var L=g[D+M];y[I++]=L}}}return n.makeTensorInfo([f,l,h,m],a.dtype,y)}};var Nwe={kernelName:B2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.images,i=t.dy,o=r.alignCorners;qme([i,a],"resizeNearestNeighborGrad");for(var s=i0(a.shape),u=i0(i.shape),c=S(a.shape,4),l=c[0],h=c[1],p=c[2],f=c[3],d=S(i.shape,3),v=d[1],m=d[2],g=new Float32Array(l*h*p*f),y=n.data.get(i.dataId).values,b=[o&&v>1?h-1:h,o&&m>1?p-1:p],x=[o&&v>1?v-1:v,o&&m>1?m-1:m],k=b[0]/x[0],w=b[1]/x[1],I=1/k,N=1/w,T=2*Math.ceil(I)+2,E=2*Math.ceil(N)+2,C=0;C<l;C++)for(var A=C*s[0],R=0;R<h;R++)for(var _=A+R*s[1],O=Math.floor(R*I),F=Math.floor(O-T/2),D=0;D<p;D++)for(var M=_+D*s[2],L=Math.floor(D*N),z=Math.floor(L-E/2),P=0;P<f;P++){for(var B=0,W=0;W<T;W++){var V=W+F;if(!(V<0||V>=v)){var U=A+V*u[1],G=V*k;if(R===Math.min(h-1,o?Math.round(G):Math.floor(G)))for(var j=0;j<E;j++){var H=j+z;if(!(H<0||H>=m)){var q=U+H*u[2],K=H*w;D===Math.min(p-1,o?Math.round(K):Math.floor(K))&&(B+=y[q+P])}}}}g[M+P]=B}return n.makeTensorInfo(a.shape,a.dtype,g)}};var Swe={kernelName:G2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.dims;qme(a,"reverse");var o=a.shape.length,s=j$(i,a.shape);if(0===o)return tge({inputs:{x:a},backend:n});for(var u=new $4(a.shape,a.dtype),c=n.bufferSync(a),l=function(){var e=u.indexToLoc(h),t=e.slice();s.forEach((function(e){return t[e]=a.shape[e]-1-t[e]})),u.set.apply(u,[c.get.apply(c,T(t))].concat(T(e)))},h=0;h<u.size;h++)l();return n.makeTensorInfo(u.shape,u.dtype,u.values)}},Twe={kernelName:F3,backendName:"cpu",kernelFunc:function(e){for(var t=e.inputs,n=e.attrs,r=e.backend,a=t.image,i=n.radians,o=n.fillValue,s=n.center,u=r,c=q$(a.dtype,L$(a.shape)),l=S(a.shape,4),h=l[0],p=l[1],f=l[2],d=l[3],v=S(eie(s,p,f),2),m=v[0],g=v[1],y=Math.sin(i),b=Math.cos(i),x=u.data.get(a.dataId).values,k=0;k<h;k++)for(var w=k*f*p*d,I=0;I<p;I++)for(var N=I*(f*d),T=0;T<f;T++)for(var E=T*d,C=0;C<d;C++){var A=[h,I,T,C],R=A[2],_=A[1],O=(R-m)*b-(_-g)*y,F=(R-m)*y+(_-g)*b;O=Math.round(O+m),F=Math.round(F+g);var D=o;if("number"!=typeof o&&(D=3===C?255:o[C]),O>=0&&O<f&&F>=0&&F<p)D=x[w+F*(f*d)+O*d+C];c[w+N+E+C]=D}return{dataId:u.write(c,a.shape,a.dtype),shape:a.shape,dtype:a.dtype}}},Ewe=xge(j2,(function(e){var t=Math.floor(e);return e-t<.5?Math.floor(e):e-t>.5?Math.ceil(e):t%2==0?t:t+1})),Cwe={kernelName:j2,backendName:"cpu",kernelFunc:Ewe};var Awe={kernelName:q2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.indices,i=t.updates,o=r.shape,s=Ute(0,a,o),u=s.sliceRank,c=s.numUpdates,l=s.sliceSize,h=s.strides,p=s.outputSize,f=Vye(n.bufferSync(a),n.bufferSync(i),o,p,l,c,u,h,0,!0);return n.makeTensorInfo(o,f.dtype,f.values)}};function Rwe(e,t){for(var n=0,r=e.length,a=0;n<r;)e[a=Math.floor((n+r)/2)]<t?n=a+1:r=a;return r}function _we(e,t){for(var n=0,r=e.length,a=0;n<r;)e[a=Math.floor((n+r)/2)]<=t?n=a+1:r=a;return r}var Owe={kernelName:X2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.sortedSequence,i=t.values,o=r.side,s=function(e,t,n,r,a,i){for(var o=K$("int32",n*a),s=0;s<n;++s)for(var u=e.slice(s*r,(s+1)*r),c=s*a,l=0;l<a;++l)o[c+l]="left"===i?Rwe(u,t[l+c]):_we(u,t[l+c]);return o}(n.data.get(a.dataId).values,n.data.get(i.dataId).values,a.shape[0],a.shape[1],i.shape[1],o);return n.makeTensorInfo(i.shape,"int32",s)}};var Fwe={kernelName:Y2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.condition,a=t.t,i=t.e;qme([r,a,i],"select");for(var o=r.shape.length,s=n.data.get(r.dataId).values,u=n.data.get(a.dataId).values,c=n.data.get(i.dataId).values,l=h5(a.dtype,i.dtype),h=l0(L$(a.shape),l),p=0,f=0===o||o>1||1===a.shape.length?1:L$(a.shape.slice(1)),d=0;d<s.length;d++)for(var v=0;v<f;v++)1===s[d]?h[p++]=u[d]:h[p++]=c[d];return n.makeTensorInfo(a.shape,l,h)}},Dwe=xge(J2,(function(e){return e>=0?1.0507009873554805*e:1.7580993408473768*(Math.exp(e)-1)})),Mwe={kernelName:J2,backendName:"cpu",kernelFunc:Dwe},Lwe=xge(e3,(function(e){return e<0?-1:e>0?1:0})),zwe={kernelName:e3,backendName:"cpu",kernelFunc:Lwe},Pwe=xge(Q2,(function(e){return Math.sin(e)})),Bwe={kernelName:Q2,backendName:"cpu",kernelFunc:Pwe},Wwe=xge($2,(function(e){return Math.sinh(e)})),Vwe={kernelName:$2,backendName:"cpu",kernelFunc:Wwe},Uwe=Math.log(1.1920928955078125e-7)+2,Gwe=xge(n3,(function(e){var t=e>-Uwe,n=e<Uwe,r=Math.exp(e);return n?r:t?e:Math.log(1+r)})),jwe={kernelName:n3,backendName:"cpu",kernelFunc:Gwe};var Hwe={kernelName:i3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.blockShape,o=r.paddings;qme([a],"spaceToBatchND");var s=L$(i),u=[[0,0]];u.push.apply(u,T(o));for(var c=1+i.length;c<a.shape.length;++c)u.push([0,0]);var l=hwe.kernelFunc({inputs:{x:a},backend:n,attrs:{paddings:u,constantValue:0}}),h=tie(l.shape,i,s,!1),p=nie(h.length,i.length,!1),f=rie(l.shape,i,s,!1),d=Mbe({inputs:{x:l},backend:n,attrs:{shape:h}}),v=wye({inputs:{x:d},backend:n,attrs:{perm:p}}),m=Mbe({inputs:{x:v},backend:n,attrs:{shape:f}});return n.disposeIntermediateTensorInfo(l),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(v),m}};var qwe={kernelName:u3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.indices,a=t.values,i=t.denseShape,o=t.defaultValue;if(1!==i.shape.length)throw new Error("Dense shape must be a vector, saw:\n ".concat(i.shape));if(2!==r.shape.length)throw new Error("Indices must be a matrix, saw:\n ".concat(r.shape));if(1!==a.shape.length)throw new Error("Values must be a vector, saw:\n ".concat(a.shape));if(0!==o.shape.length)throw new Error("Default value must be a scalar, saw:\n ".concat(o.shape));var s=n.data.get(r.dataId).values,u=n.data.get(a.dataId).values,c=n.data.get(i.dataId).values,l=n.data.get(o.dataId).values[0],h=S(Xye(s,r.shape,r.dtype,u,a.dtype,c,l),5),p=h[0],f=h[1],d=h[2],v=h[3],m=h[4];return[n.makeTensorInfo(f,r.dtype,p),n.makeTensorInfo([f[0]],a.dtype,d),n.makeTensorInfo([v.length],"bool",new Uint8Array(v.map((function(e){return Number(e)})))),n.makeTensorInfo([m.length],r.dtype,new Int32Array(m))]}};var Kwe={kernelName:c3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.inputIndices,a=t.inputShape,i=t.newShape;if(2!==r.shape.length)throw new Error("Input indices should be a matrix but received shape\n ".concat(r.shape));if(1!==a.shape.length)throw new Error("Input shape should be a vector but received shape\n ".concat(a.shape));if(1!==i.shape.length)throw new Error("Target shape should be a vector but received shape ".concat(i.shape));var o=Array.from(n.data.get(a.dataId).values),s=n.data.get(r.dataId).values,u=Array.from(n.data.get(i.dataId).values),c=S(Yye(s,r.shape,r.dtype,o,u),3),l=c[0],h=c[1],p=c[2];return[n.makeTensorInfo(h,r.dtype,l),n.makeTensorInfo([p.length],i.dtype,new Int32Array(p))]}};var Xwe={kernelName:l3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.data,a=t.indices,i=t.segmentIds;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.shape.length)throw new Error("Indices should be a vector but received shape\n ".concat(a.shape));if(1!==i.shape.length)throw new Error("Segment ids should be a vector but received shape\n ".concat(i.shape));if(a.shape[0]!==i.shape[0])throw new Error("segmentIds and indices should have same size.");var o=n.data.get(r.dataId).values,s=n.data.get(a.dataId).values,u=n.data.get(i.dataId).values,c=S(Jye(o,r.shape,r.dtype,s,u,!0),2),l=c[0],h=c[1];return n.makeTensorInfo(h,r.dtype,l)}};var Ywe={kernelName:h3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.data,a=t.indices,i=t.segmentIds;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.shape.length)throw new Error("Indices should be a vector but received shape\n ".concat(a.shape));if(1!==i.shape.length)throw new Error("Segment ids should be a vector but received shape\n ".concat(i.shape));if(a.shape[0]!==i.shape[0])throw new Error("segmentIds and indices should have same size.");var o=n.data.get(r.dataId).values,s=n.data.get(a.dataId).values,u=n.data.get(i.dataId).values,c=S(Jye(o,r.shape,r.dtype,s,u),2),l=c[0],h=c[1];return n.makeTensorInfo(h,r.dtype,l)}};var Jwe={kernelName:p3,backendName:"cpu",kernelFunc:function(e){var t,n=e.inputs,r=e.backend,a=e.attrs,i=n.sparseIndices,o=n.sparseValues,s=n.defaultValue,u=a.outputShape,c=Ute(0,i,u),l=c.sliceRank,h=c.numUpdates,p=c.sliceSize,f=c.strides,d=c.outputSize,v=!1,m=r.bufferSync(i);switch(o.dtype){case"bool":t=Vye(m,r.bufferSync(o),u,d,p,h,l,f,Boolean(r.data.get(s.dataId).values[0]),v);break;case"float32":t=Vye(m,r.bufferSync(o),u,d,p,h,l,f,r.data.get(s.dataId).values[0],v);break;case"int32":t=Vye(m,r.bufferSync(o),u,d,p,h,l,f,r.data.get(s.dataId).values[0],v);break;case"string":t=Vye(m,r.bufferSync(o),u,d,p,h,l,f,W4(r.data.get(s.dataId).values[0]),v);break;default:throw new Error("Unsupported type ".concat(o.dtype))}return r.makeTensorInfo(u,t.dtype,t.values)}};var Zwe={kernelName:o3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.numOrSizeSplits,o=j$(r.axis,a.shape)[0],s=Rie(a,i,o),u=new Array(a.shape.length).fill(0),c=a.shape.slice();return s.map((function(e){var t=T(c);t[o]=e;var r=qye({inputs:{x:a},backend:n,attrs:{begin:u,size:t}});return u[o]+=e,r}))}},Qwe={kernelName:d3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.x,a=n;qme(r,"square");for(var i=a.data.get(r.dataId).values,o=new Float32Array(i.length),s=0;s<i.length;++s){var u=i[s];o[s]=u*u}return{dataId:a.write(o,r.shape,r.dtype),shape:r.shape,dtype:r.dtype}}},$we=xge(_3,(function(e,t){var n=t;return isNaN(e)?NaN:e>0?1:n.alpha})),eIe={kernelName:_3,backendName:"cpu",kernelFunc:$we};var tIe={kernelName:m3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.begin,o=r.end,s=r.strides,u=r.beginMask,c=r.endMask,l=r.ellipsisMask,h=r.newAxisMask,p=r.shrinkAxisMask;qme(a,"stridedSlice");var f,d=Pae(a.shape,i,o,s,u,c,l,h,p),v=d.finalShapeSparse,m=d.finalShape,g=d.isIdentity,y=d.sliceDim0,b=d.isSimpleSlice,x=d.begin,k=d.end,w=d.strides;if(g)f=Mbe({inputs:{x:a},backend:n,attrs:{shape:m}});else if(y||b){F$(a.shape.length>=1,(function(){return"Input must have rank at least 1, got: ".concat(a.shape.length)}));var I=Tae(x,k,w),N=qye({inputs:{x:a},backend:n,attrs:{begin:x,size:I}});f=Mbe({inputs:{x:N},backend:n,attrs:{shape:m}}),n.disposeIntermediateTensorInfo(N)}else{var S=obe(v,n.bufferSync(a),w,x);f=n.makeTensorInfo(m,S.dtype,S.values)}return f}};var nIe={kernelName:g3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=r.separator,i=r.nGramWidths,o=r.leftPad,s=r.rightPad,u=r.padWidth,c=r.preserveShortSequences,l=t.data,h=t.dataSplits,p=S(ube(n.data.get(l.dataId).values,n.data.get(h.dataId).values,a,i,o,s,u,c),2),f=p[0],d=p[1];return[n.makeTensorInfo([f.length],"string",f),n.makeTensorInfo(h.shape,"int32",d)]}};var rIe={kernelName:y3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs.skipEmpty,a=t.input,i=t.delimiter;if("string"!==a.dtype)throw new Error("Input must be of datatype string");if(1!==a.shape.length)throw new Error("Input must be a vector, got shape: ".concat(a.shape));if(0!==i.shape.length)throw new Error("Delimiter must be a scalar, got shape: ".concat(i.shape));var o=S(lbe(n.data.get(a.dataId).values,n.data.get(i.dataId).values[0],r),3),s=o[0],u=o[1],c=o[2],l=u.length;return[n.makeTensorInfo([l,2],"int32",s),n.makeTensorInfo([l],"string",u),n.makeTensorInfo([2],"int32",new Int32Array(c))]}};var aIe={kernelName:b3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs.numBuckets,a=t.input;if("string"!==a.dtype)throw new Error("Input must be of datatype string");if(r<=0)throw new Error("Number of buckets must be at least 1");var i=hbe(n.data.get(a.dataId).values,r);return n.makeTensorInfo(a.shape,"int32",i)}},iIe=xge(k3,(function(e){return Math.tan(e)})),oIe={kernelName:k3,backendName:"cpu",kernelFunc:iIe},sIe=xge(w3,(function(e){return Math.tanh(e)}));var uIe={kernelName:K2,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.tensor,a=t.indices,i=t.updates,o=Ute(0,a,r.shape),s=o.sliceRank,u=o.numUpdates,c=o.sliceSize,l=o.strides,h=o.outputSize,p=n.bufferSync(a),f=n.bufferSync(i),d=n.bufferSync(r),v=Vye(p,f,r.shape,h,c,u,s,l,d,!1);return n.makeTensorInfo(r.shape,v.dtype,v.values)}};var cIe={kernelName:I3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.reps;qme(a,"tile");var o=mbe(n.bufferSync(a),i);return n.makeTensorInfo(o.shape,o.dtype,o.values)}};var lIe={kernelName:N3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.k,o=r.sorted;qme(a,"topk");var s=S(bbe(n.data.get(a.dataId).values,a.shape,a.dtype,i,o),2),u=s[0],c=s[1];return[n.makeTensorInfo(u.shape,u.dtype,u.values),n.makeTensorInfo(c.shape,c.dtype,c.values)]}};var hIe={kernelName:S3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.attrs,r=e.backend,a=t.image,i=t.transforms,o=n.interpolation,s=n.fillMode,u=n.fillValue,c=n.outputShape,l=S(a.shape,4),h=l[0],p=l[1],f=l[2],d=l[3],v=S(null!=c?c:[p,f],2),m=v[0],g=v[1],y=[h,m,g,d],b=i0(a.shape),x=b[0],k=b[1],w=b[2],I=i0(y),N=I[0],T=I[1],E=I[2],C=q$(a.dtype,L$(y));C.fill(u);for(var A=r.data.get(a.dataId).values,R=r.data.get(i.dataId).values,_=0;_<h;++_){for(var O=1===i.shape[0]?R:R.subarray(8*_,8*_+8),F=0;F<m;++F)for(var D=0;D<g;++D)for(var M=0;M<d;++M){var L=void 0,z=O[6]*D+O[7]*F+1;if(0!==z){var P=(O[0]*D+O[1]*F+O[2])/z,B=(O[3]*D+O[4]*F+O[5])/z,W=pIe(P,f,s),V=pIe(B,p,s);switch(o){case"nearest":L=dIe(A,p,f,x,k,w,_,V,W,M,u);break;case"bilinear":L=vIe(A,p,f,x,k,w,_,V,W,M,u);break;default:throw new Error("Error in Transform: Expect 'nearest' or "+"'bilinear', but got ".concat(o))}C[_*N+F*T+D*E+M]=L}}return r.makeTensorInfo(y,a.dtype,C)}return{dataId:r.write(C,y,a.dtype),shape:a.shape,dtype:a.dtype}}};function pIe(e,t,n){switch(n){case"reflect":return function(e,t){var n=e;if(n<0)if(t<=1)n=0;else{var r=2*t;n<r&&(n=r*Math.trunc(-n/r)+n),n=n<-t?n+r:-n-1}else if(n>t-1)if(t<=1)n=0;else{var a=2*t;(n-=a*Math.trunc(n/a))>=t&&(n=a-n-1)}return A$(0,n,t-1)}(e,t);case"wrap":return function(e,t){var n=e;if(n<0)if(t<=1)n=0;else{var r=t-1;n+=t*(Math.trunc(-n/r)+1)}else if(n>t-1)if(t<=1)n=0;else{var a=t-1;n-=t*Math.trunc(n/a)}return A$(0,n,t-1)}(e,t);case"nearest":return function(e,t){return A$(0,e,t-1)}(e,t);default:return function(e,t){return e}(e)}}function fIe(e,t,n,r,a,i,o,s,u,c,l){return 0<=s&&s<t&&0<=u&&u<n?e[o*r+s*a+u*i+c]:l}function dIe(e,t,n,r,a,i,o,s,u,c,l){return fIe(e,t,n,r,a,i,o,Math.round(s),Math.round(u),c,l)}function vIe(e,t,n,r,a,i,o,s,u,c,l){var h=Math.floor(s),p=Math.floor(u),f=h+1,d=p+1;return(f-s)*((d-u)*fIe(e,t,n,r,a,i,o,h,p,c,l)+(u-p)*fIe(e,t,n,r,a,i,o,h,d,c,l))+(s-h)*((d-u)*fIe(e,t,n,r,a,i,o,f,p,c,l)+(u-p)*fIe(e,t,n,r,a,i,o,f,d,c,l))}var mIe={kernelName:E3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.attrs,r=e.backend,a=n.axis,i=t.x;qme(i,"unique");var o=xbe(r.data.get(i.dataId).values,a,i.shape,i.dtype),s=o.outputValues,u=o.outputShape,c=o.indices;return[r.makeTensorInfo(u,i.dtype,s),r.makeTensorInfo([c.length],"int32",c)]}};var gIe={kernelName:C3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.value,i=r.axis;i<0&&(i+=a.shape.length);for(var o=a.shape.length,s=a.shape[i],u=new Array(o-1),c=0,l=0;l<o;l++)l!==i&&(u[c++]=a.shape[l]);var h=new Array(o).fill(0),p=a.shape.slice();p[i]=1;for(var f=new Array(s),d=0;d<f.length;d++){h[i]=d;var v=qye({inputs:{x:a},backend:n,attrs:{begin:h,size:p}});f[d]=Mbe({inputs:{x:v},backend:n,attrs:{shape:u}}),n.disposeIntermediateTensorInfo(v)}return f}};for(var yIe={kernelName:A3,backendName:"cpu",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.segmentIds,o=r.numSegments;qme(a,"unsortedSegmentSum");for(var s=[],u=[],c=a.shape.length-i.shape.length,l=i,h=0;h<c;++h){var p=tke({inputs:{input:l},backend:n,attrs:{dim:h+1}});l=p,u.push(p)}for(var f=0;f<o;++f){var d=M4(f,"int32"),v=n.makeTensorInfo([],"int32",d),m=Ege({inputs:{a:v,b:l},backend:n}),g=oge({inputs:{x:m},backend:n,attrs:{dtype:"float32"}}),y=dye({inputs:{a:g,b:a},backend:n}),b=Yxe({inputs:{x:y},backend:n,attrs:{axis:0,keepDims:!1}});s.push(b),u.push(v),u.push(m),u.push(g),u.push(y),u.push(b)}var x=cwe({inputs:s,backend:n,attrs:{axis:0}});return u.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),x}},bIe=0,xIe=[Bbe,Jme,Vbe,Gbe,fge,jbe,Hbe,qbe,Kbe,Xbe,Jbe,Qbe,exe,rxe,ixe,cxe,lxe,hxe,pxe,Pbe,fxe,dxe,vxe,yge,mxe,sge,Nge,yxe,$me,bxe,Ixe,Sxe,Txe,Exe,Cxe,Axe,Rxe,Oxe,Dxe,Mxe,Lxe,zxe,Pxe,Bxe,Vxe,Uxe,Gxe,jxe,Hxe,qxe,Kxe,Xxe,Zxe,Nbe,Qxe,Cge,eke,_ge,nke,Dge,cke,hke,pke,zge,Wge,fke,dke,vke,mke,Hge,Xge,nge,gke,kxe,bke,kke,Ike,Tbe,Zge,eye,Nke,aye,Tke,Ake,_ke,Dke,Mke,Lke,Pke,uye,Bke,Wke,Vke,Uke,Gke,jke,Hke,hye,qke,Yke,Qke,vye,gye,ewe,nwe,awe,xye,iwe,uwe,lwe,hwe,dwe,Abe,Sye,vwe,mwe,gwe,ywe,age,ike,xwe,_be,Fbe,Lbe,kwe,wwe,Iwe,Nwe,Swe,Twe,Cwe,Wye,Awe,Owe,Fwe,Mwe,jye,zwe,Bwe,Vwe,Kye,Zke,jwe,Hwe,qwe,Kwe,Xwe,Ywe,Jwe,Zwe,$ye,Qwe,nbe,ibe,eIe,tIe,nIe,rIe,aIe,vbe,Jxe,oIe,{kernelName:w3,backendName:"cpu",kernelFunc:sIe},uIe,cIe,lIe,hIe,Iye,mIe,gIe,yIe,swe];bIe<xIe.length;bIe++){G3(xIe[bIe])}var kIe,wIe,IIe,NIe={},SIe={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function TIe(e,t){NIe[e]=t}function EIe(e,t){if(!(e in NIe)||null!=t){var n=function(e,t){if(1!==e&&2!==e)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");var n=null==t?function(e){if(k0().getBool("IS_SAFARI")||"undefined"==typeof OffscreenCanvas||2!==e){if("undefined"!=typeof document)return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}return new OffscreenCanvas(300,150)}(e):t;n.addEventListener("webglcontextlost",(function(t){t.preventDefault(),delete NIe[e]}),!1),k0().getBool("SOFTWARE_WEBGL_ENABLED")&&(SIe.failIfMajorPerformanceCaveat=!1);if(1===e)return n.getContext("webgl",SIe)||n.getContext("experimental-webgl",SIe);return n.getContext("webgl2",SIe)}(e,t);if(null===n)return console.log("Could not get context for WebGL version",e),null;NIe[e]=n}var r=NIe[e];return null==r||r.isContextLost()?(delete NIe[e],EIe(e)):(r.disable(r.DEPTH_TEST),r.disable(r.STENCIL_TEST),r.disable(r.BLEND),r.disable(r.DITHER),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SAMPLE_COVERAGE),r.enable(r.SCISSOR_TEST),r.enable(r.CULL_FACE),r.cullFace(r.BACK),NIe[e])}function CIe(e,t){return[t,e]}function AIe(e){var t=L$(e);return W$(Math.ceil(t/4))}function RIe(e,t){return[Math.max(1,Math.ceil(t/2)),Math.max(1,Math.ceil(e/2))]}function _Ie(e,t){var n,r,a,i,o,s,u,c,l,h,p=e;return 2===k0().getNumber("WEBGL_VERSION")?(n=p.R32F,r=p.R16F,a=p.RGBA16F,i=p.RGBA32F,o=p.RED,u=4,c=1,l=p.HALF_FLOAT,h=p.FLOAT,s=p.RGBA8):(n=e.RGBA,r=e.RGBA,a=e.RGBA,i=p.RGBA,o=e.RGBA,u=4,c=4,l=null!=t?t.HALF_FLOAT_OES:null,h=e.FLOAT,s=e.RGBA),{internalFormatFloat:n,internalFormatHalfFloat:r,internalFormatPackedHalfFloat:a,internalFormatPackedFloat:i,textureFormatFloat:o,downloadTextureFormat:s,downloadUnpackNumChannels:u,defaultNumChannels:c,textureTypeHalfFloat:l,textureTypeFloat:h}}function OIe(e,t){var n=t();return k0().getBool("DEBUG")&&function(e){var t=e.getError();if(t!==e.NO_ERROR)throw new Error("WebGL Error: "+DIe(e,t))}(e),n}!function(e){e[e.DENSE=0]="DENSE",e[e.SHARED_BATCH=1]="SHARED_BATCH"}(kIe||(kIe={})),function(e){e[e.RENDER=0]="RENDER",e[e.UPLOAD=1]="UPLOAD",e[e.PIXELS=2]="PIXELS",e[e.DOWNLOAD=3]="DOWNLOAD"}(wIe||(wIe={})),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",e[e.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16"}(IIe||(IIe={}));function FIe(e){return!!(k0().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||0===e||5.96e-8<Math.abs(e)&&Math.abs(e)<65504)}function DIe(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 ".concat(t)}}function MIe(e,t){return iNe(e,(function(){return e.getExtension(t)}),'Extension "'+t+'" not supported on this browser.')}function LIe(e,t){var n=iNe(e,(function(){return e.createShader(e.VERTEX_SHADER)}),"Unable to create vertex WebGLShader.");if(OIe(e,(function(){return e.shaderSource(n,t)})),OIe(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 zIe(e,t){var n=iNe(e,(function(){return e.createShader(e.FRAGMENT_SHADER)}),"Unable to create fragment WebGLShader.");if(OIe(e,(function(){return e.shaderSource(n,t)})),OIe(e,(function(){return e.compileShader(n)})),k0().get("ENGINE_COMPILE_ONLY"))return n;if(!1===e.getShaderParameter(n,e.COMPILE_STATUS))throw VIe(t,e.getShaderInfoLog(n)),new Error("Failed to compile fragment shader.");return n}var PIe,BIe,WIe=/ERROR: [0-9]+:([0-9]+):/g;function VIe(e,t){var n=WIe.exec(t);if(null==n)return console.log("Couldn't parse line number in error: ".concat(t)),void console.log(e);for(var r=+n[1],a=e.split("\n"),i=a.length.toString().length+2,o=a.map((function(e,t){return V$((t+1).toString(),i)+e})),s=0,u=0;u<o.length;u++)s=Math.max(o[u].length,s);var c=o.slice(0,r-1),l=o.slice(r-1,r),h=o.slice(r);console.log(c.join("\n")),console.log(t.split("\n")[0]),console.log("%c ".concat(V$(l[0],s)),"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(h.join("\n"))}function UIe(e){return iNe(e,(function(){return e.createProgram()}),"Unable to create WebGLProgram.")}function GIe(e,t){if(OIe(e,(function(){return e.linkProgram(t)})),!k0().get("ENGINE_COMPILE_ONLY")&&!1===e.getProgramParameter(t,e.LINK_STATUS))throw console.log(e.getProgramInfoLog(t)),new Error("Failed to link vertex and fragment shaders.")}function jIe(e,t){if(OIe(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 HIe(e,t){var n=iNe(e,(function(){return e.createBuffer()}),"Unable to create WebGLBuffer");return OIe(e,(function(){return e.bindBuffer(e.ARRAY_BUFFER,n)})),OIe(e,(function(){return e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW)})),n}function qIe(e,t){var n=iNe(e,(function(){return e.createBuffer()}),"Unable to create WebGLBuffer");return OIe(e,(function(){return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n)})),OIe(e,(function(){return e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW)})),n}function KIe(e){return iNe(e,(function(){return e.createTexture()}),"Unable to create WebGLTexture.")}function XIe(e,t){var n=k0().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(e<=0||t<=0){var r="[".concat(e,"x").concat(t,"]");throw new Error("Requested texture size "+r+" is invalid.")}if(e>n||t>n){var a="[".concat(e,"x").concat(t,"]"),i="[".concat(n,"x").concat(n,"]");throw new Error("Requested texture size "+a+" greater than WebGL maximum on this browser / GPU "+i+".")}}function YIe(e){return iNe(e,(function(){return e.createFramebuffer()}),"Unable to create WebGLFramebuffer.")}function JIe(e,t,n,r,a,i,o){var s=e.getAttribLocation(t,n);return-1!==s&&(OIe(e,(function(){return e.bindBuffer(e.ARRAY_BUFFER,r)})),OIe(e,(function(){return e.vertexAttribPointer(s,a,e.FLOAT,!1,i,o)})),OIe(e,(function(){return e.enableVertexAttribArray(s)})),!0)}function ZIe(e,t,n){oNe(e,n),OIe(e,(function(){return e.activeTexture(e.TEXTURE0+n)})),OIe(e,(function(){return e.bindTexture(e.TEXTURE_2D,t)}))}function QIe(e,t,n){return iNe(e,(function(){return e.getUniformLocation(t,n)}),'uniform "'+n+'" not present in program.')}function $Ie(e,t,n){return e.getUniformLocation(t,n)}function eNe(e,t,n,r){OIe(e,(function(){return ZIe(e,t,r)})),OIe(e,(function(){return e.uniform1i(n,r)}))}function tNe(e,t,n){OIe(e,(function(){return e.bindFramebuffer(e.FRAMEBUFFER,n)})),OIe(e,(function(){return e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}))}function nNe(e,t){OIe(e,(function(){return e.bindFramebuffer(e.FRAMEBUFFER,t)})),OIe(e,(function(){return e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0)}))}function rNe(e){var t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+aNe(e,t))}function aNe(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 ".concat(t)}}function iNe(e,t,n){var r=OIe(e,(function(){return t()}));if(null==r)throw new Error(n);return r}function oNe(e,t){var n=e.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,r=t+e.TEXTURE0;if(r<e.TEXTURE0||r>n){var a="[gl.TEXTURE0, gl.TEXTURE".concat(n,"]");throw new Error("textureUnit must be in ".concat(a,"."))}}function sNe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return L$(e.slice(0,e.length-t))}function uNe(e){if(0===e.length)throw Error("Cannot get rows and columns of an empty shape array.");return[e.length>1?e[e.length-2]:1,e[e.length-1]]}function cNe(e){var t=[1,1,1];return 0===e.length||1===e.length&&1===e[0]||(t=[sNe(e)].concat(T(uNe(e)))),t}function lNe(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=k0().getNumber("WEBGL_MAX_TEXTURE_SIZE"),r=k0().getNumber("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE");if(r===1/0&&k0().getBool("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE")&&(r=n/2),t&&(n*=2,r*=2,1===(e=e.map((function(t,n){return n>=e.length-2?R$(e[n]):e[n]}))).length&&(e=[2,e[0]])),2!==e.length){var a=H$(e);e=a.newShape}var i=L$(e),o=null;e.length<=1&&i<=n?o=[1,i]:2===e.length&&e[0]<=n&&e[1]<=n?o=e:3===e.length&&e[0]*e[1]<=n&&e[2]<=n?o=[e[0]*e[1],e[2]]:3===e.length&&e[0]<=n&&e[1]*e[2]<=n?o=[e[0],e[1]*e[2]]:4===e.length&&e[0]*e[1]*e[2]<=n&&e[3]<=n?o=[e[0]*e[1]*e[2],e[3]]:4===e.length&&e[0]<=n&&e[1]*e[2]*e[3]<=n&&(o=[e[0],e[1]*e[2]*e[3]]);var s=null!=o&&Math.max.apply(Math,T(o))>r&&Math.min.apply(Math,T(o))<=(t?2:1)&&Math.min.apply(Math,T(o))>0;if(null==o||s)if(t){var u=sNe(e),c=2,l=2;if(e.length){var h=uNe(e),p=S(h,2);c=p[0],l=p[1]}o=W$(i=u*(c/2)*(l/2)).map((function(e){return 2*e}))}else o=W$(i);return o}function hNe(e){return e%2==0}function pNe(e,t){if(P$(e=e.slice(-2),t=t.slice(-2)))return!0;if(!e.length||!t.length)return!0;if(0===e[0]||0===e[1]||0===t[0]||0===t[1])return!0;if(e.length!==t.length){var n=e[e.length-1],r=t[t.length-1];if(n===r)return!0;if(hNe(n)&&hNe(r)&&(1===e[0]||1===t[0]))return!0}return e[1]===t[1]&&hNe(e[0])&&hNe(t[0])}function fNe(e){if(null==PIe){var t=EIe(e);PIe=t.getParameter(t.MAX_TEXTURE_SIZE)}return PIe}function dNe(e){if(null==BIe){var t=EIe(e);BIe=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,BIe)}function vNe(e){if(0===e)return 0;var t=EIe(e);return mNe(t,"EXT_disjoint_timer_query_webgl2")&&2===e?2:mNe(t,"EXT_disjoint_timer_query")?1:0}function mNe(e,t){return null!=e.getExtension(t)}function gNe(e){try{if(null!=EIe(e))return!0}catch(e){return console.log("Error when getting WebGL context: ",e),!1}return!1}function yNe(e){if(0===e)return!1;var t=EIe(e);if(1===e){if(!mNe(t,"OES_texture_float"))return!1}else if(!mNe(t,"EXT_color_buffer_float"))return!1;return xNe(t)}function bNe(e){if(0===e)return!1;var t=EIe(e);if(1!==e){if(mNe(t,"EXT_color_buffer_float"))return xNe(t);var n="EXT_color_buffer_half_float";if(mNe(t,n)){var r=t.getExtension(n);return function(e,t){var n=_Ie(e,t),r=e.createTexture();e.bindTexture(e.TEXTURE_2D,r);var a=1,i=1;e.texImage2D(e.TEXTURE_2D,0,n.internalFormatHalfFloat,a,i,0,n.textureFormatFloat,n.textureTypeHalfFloat,null);var o=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,o),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0);var s=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(r),e.deleteFramebuffer(o),s}(t,r)}return!1}return!!mNe(t,"OES_texture_float")&&(!!mNe(t,"WEBGL_color_buffer_float")&&xNe(t))}function xNe(e){var t=_Ie(e),n=e.createTexture();e.bindTexture(e.TEXTURE_2D,n);e.texImage2D(e.TEXTURE_2D,0,t.internalFormatFloat,1,1,0,t.textureFormatFloat,t.textureTypeFloat,null);var r=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0);var a=e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE;return e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteTexture(n),e.deleteFramebuffer(r),a}function kNe(e){return 2===e&&null!=EIe(e).fenceSync}function wNe(e,t){Array.isArray(e)||(e=[e]),e.forEach((function(e){null!=e&&F$("complex64"!==e.dtype,(function(){return"".concat(t," does not support complex64 tensors ")+"in the WebGL backend."}))}))}var INe={__proto__:null,assertNotComplex:wNe,bindCanvasToFramebuffer:function(e){OIe(e,(function(){return e.bindFramebuffer(e.FRAMEBUFFER,null)})),OIe(e,(function(){return e.viewport(0,0,e.canvas.width,e.canvas.height)})),OIe(e,(function(){return e.scissor(0,0,e.canvas.width,e.canvas.height)}))},bindColorTextureToFramebuffer:tNe,bindTextureToProgramUniformSampler:eNe,bindTextureUnit:ZIe,bindVertexBufferToProgramAttribute:JIe,callAndCheck:OIe,canBeRepresented:FIe,createFragmentShader:zIe,createFramebuffer:YIe,createProgram:UIe,createStaticIndexBuffer:qIe,createStaticVertexBuffer:HIe,createTexture:KIe,createVertexShader:LIe,getBatchDim:sNe,getExtensionOrThrow:MIe,getFramebufferErrorMessage:aNe,getMaxTexturesInShader:dNe,getNumChannels:function(){return 2===k0().getNumber("WEBGL_VERSION")?1:4},getProgramUniformLocation:$Ie,getProgramUniformLocationOrThrow:QIe,getRowsCols:uNe,getShapeAs3D:cNe,getTextureShapeFromLogicalShape:lNe,getWebGLDisjointQueryTimerVersion:vNe,getWebGLErrorMessage:DIe,getWebGLMaxTextureSize:fNe,hasExtension:mNe,isCapableOfRenderingToFloatTexture:yNe,isDownloadFloatTextureEnabled:bNe,isReshapeFree:pNe,isWebGLFenceEnabled:kNe,isWebGLVersionEnabled:gNe,linkProgram:GIe,logShaderSourceAndInfoLog:VIe,resetMaxTextureSize:function(){PIe=null},resetMaxTexturesInShader:function(){BIe=null},unbindColorTextureFromFramebuffer:nNe,unbindTextureUnit:function(e,t){oNe(e,t),OIe(e,(function(){return e.activeTexture(e.TEXTURE0+t)})),OIe(e,(function(){return e.bindTexture(e.TEXTURE_2D,null)}))},validateFramebuffer:rNe,validateProgram:jIe,validateTextureSize:XIe},NNe=k0();function SNe(){var e,t,n,r,a,i,o,s,u,c;return 2===k0().getNumber("WEBGL_VERSION")?(e="#version 300 es",t="in",n="out",r="in",a="texture",i="outputColor",o="out vec4 outputColor;",s=k0().getBool("WEBGL2_ISNAN_CUSTOM")?"\n bool isnan_custom(float val) {\n uint floatToUint = floatBitsToUint(val);\n return (floatToUint & 0x7fffffffu) > 0x7f800000u;\n }\n\n bvec4 isnan_custom(vec4 val) {\n return bvec4(isnan_custom(val.x),\n isnan_custom(val.y), isnan_custom(val.z), isnan_custom(val.w));\n }\n\n #define isnan(value) isnan_custom(value)\n ":"",u="",c="\n #define round(value) newRound(value)\n int newRound(float value) {\n return int(floor(value + 0.5));\n }\n\n ivec4 newRound(vec4 value) {\n return ivec4(floor(value + vec4(0.5)));\n }\n "):(e="",t="attribute",n="varying",r="varying",a="texture2D",i="gl_FragColor",o="",s="\n #define isnan(value) isnan_custom(value)\n bool isnan_custom(float val) {\n return (val > 0. || val < 1. || val == 0.) ? false : true;\n }\n bvec4 isnan_custom(vec4 val) {\n return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w));\n }\n ",u="\n uniform float INFINITY;\n\n bool isinf(float val) {\n return abs(val) == INFINITY;\n }\n bvec4 isinf(vec4 val) {\n return equal(abs(val), vec4(INFINITY));\n }\n ",c="\n int round(float value) {\n return int(floor(value + 0.5));\n }\n\n ivec4 round(vec4 value) {\n return ivec4(floor(value + vec4(0.5)));\n }\n "),{version:e,attribute:t,varyingVs:n,varyingFs:r,texture2D:a,output:i,defineOutput:o,defineSpecialNaN:s,defineSpecialInf:u,defineRound:c}}function TNe(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"index",r=i0(t);return r.map((function(t,a){var i="int ".concat(e[a]," = ").concat(n," / ").concat(t),o=a===r.length-1?"int ".concat(e[a+1]," = ").concat(n," - ").concat(e[a]," * ").concat(t):"index -= ".concat(e[a]," * ").concat(t);return"".concat(i,"; ").concat(o,";")})).join("")}function ENe(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"index",r=i0(t);return r.map((function(t,a){var i="int ".concat(e[a]," = ").concat(n," / outShapeStrides[").concat(a,"]"),o=a===r.length-1?"int ".concat(e[a+1]," = ").concat(n," - ").concat(e[a]," * outShapeStrides[").concat(a,"]"):"index -= ".concat(e[a]," * outShapeStrides[").concat(a,"]");return"".concat(i,"; ").concat(o,";")})).join("")}function CNe(e,t){var n=e.length,r=e.map((function(e){return"".concat(t,"[").concat(e,"]")})),a=new Array(n-1);a[n-2]=r[n-1];for(var i=n-3;i>=0;--i)a[i]="(".concat(a[i+1]," * ").concat(r[i+1],")");return a}function ANe(e){var t=i0(e).map((function(e){return e.toString()}));return"\n int getFlatIndex(ivec3 coords) {\n return coords.x * ".concat(t[0]," + coords.y * ").concat(t[1]," + coords.z;\n }\n")}NNe.registerFlag("HAS_WEBGL",(function(){return NNe.getNumber("WEBGL_VERSION")>0})),NNe.registerFlag("WEBGL_VERSION",(function(){return gNe(2)?2:gNe(1)?1:0})),NNe.registerFlag("WEBGL_CHECK_NUMERICAL_PROBLEMS",(function(){return!1})),NNe.registerFlag("WEBGL_BUFFER_SUPPORTED",(function(){return 2===NNe.get("WEBGL_VERSION")})),NNe.registerFlag("WEBGL_CPU_FORWARD",(function(){return!0})),NNe.registerFlag("WEBGL_FORCE_F16_TEXTURES",(function(){return!1})),NNe.registerFlag("WEBGL_PACK",(function(){return NNe.getBool("HAS_WEBGL")})),NNe.registerFlag("WEBGL_PACK_NORMALIZATION",(function(){return NNe.getBool("WEBGL_PACK")})),NNe.registerFlag("WEBGL_PACK_CLIP",(function(){return NNe.getBool("WEBGL_PACK")})),NNe.registerFlag("WEBGL_PACK_DEPTHWISECONV",(function(){return NNe.getBool("WEBGL_PACK")})),NNe.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",(function(){return NNe.getBool("WEBGL_PACK")})),NNe.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",(function(){return NNe.getBool("WEBGL_PACK")})),NNe.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",(function(){return NNe.getBool("WEBGL_PACK")})),NNe.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",(function(){return NNe.getBool("WEBGL_PACK")})),NNe.registerFlag("WEBGL_PACK_REDUCE",(function(){return NNe.getBool("WEBGL_PACK")})),NNe.registerFlag("WEBGL_LAZILY_UNPACK",(function(){return NNe.getBool("WEBGL_PACK")})),NNe.registerFlag("WEBGL_CONV_IM2COL",(function(){return NNe.getBool("WEBGL_PACK")})),NNe.registerFlag("WEBGL_MAX_TEXTURE_SIZE",(function(){return fNe(NNe.getNumber("WEBGL_VERSION"))})),NNe.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",(function(){return dNe(NNe.getNumber("WEBGL_VERSION"))})),NNe.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",(function(){var e=NNe.getNumber("WEBGL_VERSION");return 0===e?0:vNe(e)})),NNe.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",(function(){return NNe.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&!A5()})),NNe.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",(function(){return yNe(NNe.getNumber("WEBGL_VERSION"))})),NNe.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",(function(){return!NNe.getBool("WEBGL_FORCE_F16_TEXTURES")&&NNe.getBool("WEBGL_RENDER_FLOAT32_CAPABLE")})),NNe.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",(function(){return bNe(NNe.getNumber("WEBGL_VERSION"))})),NNe.registerFlag("WEBGL_FENCE_API_ENABLED",(function(){return kNe(NNe.getNumber("WEBGL_VERSION"))})),NNe.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",(function(){return NNe.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0})),NNe.registerFlag("WEBGL_DELETE_TEXTURE_THRESHOLD",(function(){return-1}),(function(e){if(e<0&&-1!==e)throw new Error("WEBGL_DELETE_TEXTURE_THRESHOLD must be -1 (indicating never "+"delete) or at least 0, but got ".concat(e,"."))})),NNe.registerFlag("WEBGL_FLUSH_THRESHOLD",(function(){return A5()?1:-1}),(function(e){if(e<0&&-1!==e)throw new Error("WEBGL_FLUSH_THRESHOLD must be -1 (indicating never "+"manual flush) or at least 0, but got ".concat(e,"."))})),NNe.registerFlag("CPU_HANDOFF_SIZE_THRESHOLD",(function(){return 128})),NNe.registerFlag("WEBGL_USE_SHAPES_UNIFORMS",(function(){return!1})),NNe.registerFlag("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD",(function(){return 1e5})),NNe.registerFlag("TOPK_K_CPU_HANDOFF_THRESHOLD",(function(){return 128})),NNe.registerFlag("WEBGL_EXP_CONV",(function(){return!1})),NNe.registerFlag("SOFTWARE_WEBGL_ENABLED",(function(){return NNe.getBool("IS_TEST")})),NNe.registerFlag("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE",(function(){return 1/0})),NNe.registerFlag("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE",(function(){return!1})),NNe.registerFlag("WEBGL2_ISNAN_CUSTOM",(function(){return!1})),NNe.registerFlag("ENGINE_COMPILE_ONLY",(function(){return!1}));var RNe="\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",_Ne=E7;function ONe(e,t,n){var r=[];if(e.forEach((function(e){var t=L$(e.shapeInfo.logicalShape);if(e.shapeInfo.isUniform?r.push("uniform float ".concat(e.name).concat(t>1?"[".concat(t,"]"):"",";")):(r.push("uniform sampler2D ".concat(e.name,";")),r.push("uniform int offset".concat(e.name,";"))),n.enableShapeUniforms){switch(ZNe(n.packedInputs,e.shapeInfo.logicalShape,e.shapeInfo.texShape).uniformShape.length){case 1:r.push("uniform int ".concat(e.name,"Shape;"));break;case 2:r.push("uniform ivec2 ".concat(e.name,"Shape;"));break;case 3:r.push("uniform ivec3 ".concat(e.name,"Shape;"));break;case 4:r.push("uniform ivec4 ".concat(e.name,"Shape;"))}r.push("uniform ivec2 ".concat(e.name,"TexShape;"))}})),n.enableShapeUniforms){switch(t.logicalShape.length){case 1:r.push("uniform int outShape;");break;case 2:r.push("uniform ivec2 outShape;"),r.push("uniform int outShapeStrides;");break;case 3:r.push("uniform ivec3 outShape;"),r.push("uniform ivec2 outShapeStrides;");break;case 4:r.push("uniform ivec4 outShape;"),r.push("uniform ivec3 outShapeStrides;")}r.push("uniform ivec2 outTexShape;")}n.customUniforms&&n.customUniforms.forEach((function(e){r.push("uniform ".concat(e.type," ").concat(e.name).concat(e.arrayIndex?"[".concat(e.arrayIndex,"]"):"",";"))}));var a,i,o=r.join("\n"),s=e.map((function(e){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0,a="";a+=n?DNe(e,r):FNe(e,r);var i=e.shapeInfo.logicalShape,o=t.logicalShape;i.length<=o.length&&(a+=n?XNe(e,t):YNe(e,t));return a}(e,t,n.packedInputs,n.enableShapeUniforms)})).join("\n"),u=t.texShape,c=SNe(),l=function(e){return"\n float sampleTexture(sampler2D textureSampler, vec2 uv) {\n return ".concat(e.texture2D,"(textureSampler, uv).r;\n }\n ")}(c),h=function(e){return"".concat(e.version,"\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n ").concat(e.varyingFs," vec2 resultUV;\n ").concat(e.defineOutput,"\n const vec2 halfCR = vec2(0.5, 0.5);\n\n struct ivec5\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n };\n\n struct ivec6\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n int v;\n };\n\n uniform float NAN;\n ").concat(e.defineSpecialNaN,"\n ").concat(e.defineSpecialInf,"\n ").concat(e.defineRound,"\n\n int imod(int x, int y) {\n return x - y * (x / y);\n }\n\n int idiv(int a, int b, float sign) {\n int res = a / b;\n int mod = imod(a, b);\n if (sign < 0. && mod != 0) {\n res -= 1;\n }\n return res;\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 ").concat(MNe,"\n ").concat(LNe,"\n ").concat(zNe,"\n ")}(c);return t.isPacked?(a=function(e,t,n){switch(e.length){case 0:return"\n int getOutputCoords() {\n return 0;\n }\n ";case 1:return function(e,t,n){var r=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];if(1===r[0])return n?"\n int getOutputCoords() {\n return 2 * int(resultUV.x * ceil(float(outTexShape[1]) / 2.0));\n }\n ":"\n int getOutputCoords() {\n return 2 * int(resultUV.x * ".concat(r[1],".0);\n }\n ");if(1===r[1])return n?"\n int getOutputCoords() {\n return 2 * int(resultUV.y * ceil(float(outTexShape[0]) / 2.0));\n }\n ":"\n int getOutputCoords() {\n return 2 * int(resultUV.y * ".concat(r[0],".0);\n }\n ");if(n)return"\n int getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n return 2 * (resTexRC.x * packedTexShape[1] + resTexRC.y);\n }\n ";return"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(r[0],", ").concat(r[1],"));\n return 2 * (resTexRC.x * ").concat(r[1]," + resTexRC.y);\n }\n ")}(0,t,n);case 2:return function(e,t,n){var r=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)];if(P$(e,t))return n?"\n ivec2 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n return 2 * ivec2(resultUV.yx * vec2(packedTexShape[0], packedTexShape[1]));\n }\n ":"\n ivec2 getOutputCoords() {\n return 2 * ivec2(resultUV.yx * vec2(".concat(r[0],", ").concat(r[1],"));\n }\n ");var a=Math.ceil(e[1]/2);if(n)return"\n ivec2 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n int texelsInLogicalRow = int(ceil(float(outShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec2(r, c);\n }\n ";return"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(r[0],", ").concat(r[1],"));\n\n int index = resTexRC.x * ").concat(r[1]," + resTexRC.y;\n int r = 2 * (index / ").concat(a,");\n int c = imod(index, ").concat(a,") * 2;\n\n return ivec2(r, c);\n }\n ")}(e,t,n);case 3:return function(e,t,n){if(n)return"\n ivec3 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n int texelsInLogicalRow = int(ceil(float(outShape[2]) / 2.0));\n int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n\n int b = index / texelsInBatch;\n index -= b * texelsInBatch;\n\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec3(b, r, c);\n }\n ";var r=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],a=Math.ceil(e[2]/2),i=a*Math.ceil(e[1]/2);return"\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(r[0],", ").concat(r[1],"));\n int index = resTexRC.x * ").concat(r[1]," + resTexRC.y;\n\n int b = index / ").concat(i,";\n index -= b * ").concat(i,";\n\n int r = 2 * (index / ").concat(a,");\n int c = imod(index, ").concat(a,") * 2;\n\n return ivec3(b, r, c);\n }\n ")}(e,t,n);default:return function(e,t,n){if(n)return"\n ivec4 getOutputCoords() {\n ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0));\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(packedTexShape[0], packedTexShape[1]));\n int index = resTexRC.x * packedTexShape[1] + resTexRC.y;\n\n int texelsInLogicalRow = int(ceil(float(outShape[3]) / 2.0));\n int texelsInBatch = texelsInLogicalRow * int(ceil(float(outShape[2]) / 2.0));\n int texelsInBatchN = texelsInBatch * outShape[1];\n\n int b2 = index / texelsInBatchN;\n index -= b2 * texelsInBatchN;\n\n int b = index / texelsInBatch;\n index -= b * texelsInBatch;\n\n int r = 2 * (index / texelsInLogicalRow);\n int c = imod(index, texelsInLogicalRow) * 2;\n\n return ivec4(b2, b, r, c);\n }\n ";for(var r=[Math.ceil(t[0]/2),Math.ceil(t[1]/2)],a=Math.ceil(e[e.length-1]/2),i=a*Math.ceil(e[e.length-2]/2),o=i,s="",u="b, r, c",c=2;c<e.length-1;c++)o*=e[e.length-c-1],s="\n int b".concat(c," = index / ").concat(o,";\n index -= b").concat(c," * ").concat(o,";\n ")+s,u="b".concat(c,", ")+u;return"\n ivec".concat(e.length," getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(").concat(r[0],", ").concat(r[1],"));\n int index = resTexRC.x * ").concat(r[1]," + resTexRC.y;\n\n ").concat(s,"\n\n int b = index / ").concat(i,";\n index -= b * ").concat(i,";\n\n int r = 2 * (index / ").concat(a,");\n int c = imod(index, ").concat(a,") * 2;\n\n return ivec").concat(e.length,"(").concat(u,");\n }\n ")}(e,t,n)}}(t.logicalShape,u,n.enableShapeUniforms),i=function(e){return"\n void setOutput(vec4 val) {\n ".concat(e.output," = val;\n }\n ")}(c)):(a=function(e,t,n){switch(e.length){case 0:return"\n int getOutputCoords() {\n return 0;\n }\n ";case 1:return function(e,t,n){if(1===t[0])return n?"\n int getOutputCoords() {\n return int(resultUV.x * float(outTexShape[1]));\n }\n ":"\n int getOutputCoords() {\n return int(resultUV.x * ".concat(t[1],".0);\n }\n ");if(1===t[1])return n?"\n int getOutputCoords() {\n return int(resultUV.y * float(outTexShape[0]));\n }\n ":"\n int getOutputCoords() {\n return int(resultUV.y * ".concat(t[0],".0);\n }\n ");if(n)return"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n return resTexRC.x * outTexShape[1] + resTexRC.y;\n }\n ";return"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(t[0],", ").concat(t[1],"));\n return resTexRC.x * ").concat(t[1]," + resTexRC.y;\n }\n ")}(0,t,n);case 2:return function(e,t,n){if(P$(e,t))return n?"\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2(outTexShape[0], outTexShape[1]));\n }\n ":"\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2(".concat(t[0],", ").concat(t[1],"));\n }\n ");if(1===e[1])return n?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n return ivec2(index, 0);\n }\n ":"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(t[0],", ").concat(t[1],"));\n int index = resTexRC.x * ").concat(t[1]," + resTexRC.y;\n return ivec2(index, 0);\n }\n ");if(1===e[0])return n?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n return ivec2(0, index);\n }\n ":"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(t[0],", ").concat(t[1],"));\n int index = resTexRC.x * ").concat(t[1]," + resTexRC.y;\n return ivec2(0, index);\n }\n ");if(n)return"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n int r = index / outShape[1];\n int c = index - r * outShape[1];\n return ivec2(r, c);\n }\n ";return"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(t[0],", ").concat(t[1],"));\n int index = resTexRC.x * ").concat(t[1]," + resTexRC.y;\n int r = index / ").concat(e[1],";\n int c = index - r * ").concat(e[1],";\n return ivec2(r, c);\n }\n ")}(e,t,n);case 3:return function(e,t,n){if(n){var r=ENe(["r","c","d"],e);return"\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n ".concat(r,"\n return ivec3(r, c, d);\n }\n")}var a=TNe(["r","c","d"],e);return"\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(t[0],", ").concat(t[1],"));\n int index = resTexRC.x * ").concat(t[1]," + resTexRC.y;\n ").concat(a,"\n return ivec3(r, c, d);\n }\n ")}(e,t,n);case 4:return function(e,t,n){if(n){var r=ENe(["r","c","d","d2"],e);return"\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(outTexShape[0], outTexShape[1]));\n int index = resTexRC.x * outTexShape[1] + resTexRC.y;\n ".concat(r,"\n return ivec4(r, c, d, d2);\n }\n ")}var a=TNe(["r","c","d","d2"],e);return"\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(t[0],", ").concat(t[1],"));\n int index = resTexRC.x * ").concat(t[1]," + resTexRC.y;\n ").concat(a,"\n return ivec4(r, c, d, d2);\n }\n ")}(e,t,n);case 5:return r=t,a=TNe(["r","c","d","d2","d3"],e),"\n ivec5 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(".concat(r[0],",\n ").concat(r[1],"));\n\n int index = resTexRC.x * ").concat(r[1]," + resTexRC.y;\n\n ").concat(a,"\n\n ivec5 outShape = ivec5(r, c, d, d2, d3);\n return outShape;\n }\n ");case 6:return function(e,t){var n=TNe(["r","c","d","d2","d3","d4"],e);return"\n ivec6 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2(".concat(t[0],", ").concat(t[1],"));\n int index = resTexRC.x * ").concat(t[1]," + resTexRC.y;\n\n ").concat(n,"\n\n ivec6 result = ivec6(r, c, d, d2, d3, d4);\n return result;\n }\n ")}(e,t);default:throw new Error("".concat(e.length,"-D output sampling is not yet supported"))}var r,a}(t.logicalShape,u,n.enableShapeUniforms),i=function(e){return"\n void setOutput(float val) {\n ".concat(e.output," = vec4(val, 0, 0, 0);\n }\n ")}(c)),n.packedInputs&&(h+=PNe),[h,l,i,o,a,s,n.userCode].join("\n")}function FNe(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.shapeInfo.logicalShape;switch(n.length){case 0:return WNe(e,t);case 1:return VNe(e,t);case 2:return UNe(e,t);case 3:return GNe(e,t);case 4:return jNe(e,t);case 5:return HNe(e);case 6:return qNe(e);default:throw new Error("".concat(n.length,"-D input sampling")+" is not yet supported")}}function DNe(e,t){var n,r,a;switch(e.shapeInfo.logicalShape.length){case 0:return n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),a=SNe(),"\n vec4 ".concat(r,"() {\n return ").concat(a.texture2D,"(").concat(n,", halfCR);\n }\n ");case 1:return function(e,t){var n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),a=e.shapeInfo.texShape,i=SNe();if(t)return"\n vec4 ".concat(r,"(int index) {\n ivec2 packedTexShape = ivec2(ceil(float(").concat(n,"TexShape[0]) / 2.0), ceil(float(").concat(n,"TexShape[1]) / 2.0));\n vec2 uv = packedUVfrom1D(\n packedTexShape[0], packedTexShape[1], index);\n return ").concat(i.texture2D,"(").concat(n,", uv);\n }\n ");var o=[Math.ceil(a[0]/2),Math.ceil(a[1]/2)];return"\n vec4 ".concat(r,"(int index) {\n vec2 uv = packedUVfrom1D(\n ").concat(o[0],", ").concat(o[1],", index);\n return ").concat(i.texture2D,"(").concat(n,", uv);\n }\n ")}(e,t);case 2:return function(e,t){var n=e.shapeInfo.logicalShape,r=e.name,a="get"+r.charAt(0).toUpperCase()+r.slice(1),i=e.shapeInfo.texShape,o=i[0],s=i[1],u=SNe();if(null!=i&&P$(n,i))return t?"\n vec4 ".concat(a,"(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(").concat(r,"TexShape[1], ").concat(r,"TexShape[0]);\n\n return ").concat(u.texture2D,"(").concat(r,", uv);\n }\n "):"\n vec4 ".concat(a,"(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(").concat(s,".0, ").concat(o,".0);\n\n return ").concat(u.texture2D,"(").concat(r,", uv);\n }\n ");if(t)return"\n vec4 ".concat(a,"(int row, int col) {\n ivec2 packedTexShape = ivec2(ceil(float(").concat(r,"TexShape[0]) / 2.0), ceil(float(").concat(r,"TexShape[1]) / 2.0));\n int valuesPerRow = int(ceil(float(").concat(r,"Shape[1]) / 2.0));\n vec2 uv = packedUVfrom2D(valuesPerRow, packedTexShape[0], packedTexShape[1], row, col);\n return ").concat(u.texture2D,"(").concat(r,", uv);\n }\n ");var c=[Math.ceil(i[0]/2),Math.ceil(i[1]/2)],l=Math.ceil(n[1]/2);return"\n vec4 ".concat(a,"(int row, int col) {\n vec2 uv = packedUVfrom2D(").concat(l,", ").concat(c[0],", ").concat(c[1],", row, col);\n return ").concat(u.texture2D,"(").concat(r,", uv);\n }\n ")}(e,t);case 3:return function(e,t){var n=e.shapeInfo.logicalShape,r=e.name,a="get"+r.charAt(0).toUpperCase()+r.slice(1),i=e.shapeInfo.texShape,o=[Math.ceil(i[0]/2),Math.ceil(i[1]/2)];if(1===n[0]){var s=[1,2],u=QNe(e,n.slice(1)),c=["b","row","col"];return"\n ".concat(DNe(u,t),"\n vec4 ").concat(a,"(int b, int row, int col) {\n return ").concat(a,"(").concat($Ne(c,s),");\n }\n ")}var l=SNe();if(t)return"\n vec4 ".concat(a,"(int b, int row, int col) {\n ivec2 packedTexShape = ivec2(ceil(float(").concat(r,"TexShape[0]) / 2.0), ceil(float(").concat(r,"TexShape[1]) / 2.0));\n int valuesPerRow = int(ceil(float(").concat(r,"Shape[2]) / 2.0));\n int texelsInBatch = valuesPerRow * int(ceil(float(").concat(r,"Shape[1]) / 2.0));\n vec2 uv = packedUVfrom3D(\n packedTexShape[0], packedTexShape[1], texelsInBatch, valuesPerRow, b, row, col);\n return ").concat(l.texture2D,"(").concat(r,", uv);\n }\n ");var h=o[0],p=o[1],f=Math.ceil(n[2]/2),d=f*Math.ceil(n[1]/2);return"\n vec4 ".concat(a,"(int b, int row, int col) {\n vec2 uv = packedUVfrom3D(\n ").concat(h,", ").concat(p,", ").concat(d,", ").concat(f,", b, row, col);\n return ").concat(l.texture2D,"(").concat(r,", uv);\n }\n ")}(e,t);default:return function(e,t){var n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),a=SNe();if(t)return"\n vec4 ".concat(r,"(int b2, int b, int row, int col) {\n int valuesPerRow = int(ceil(float(").concat(n,"Shape[3]) / 2.0));\n int texelsInBatch = valuesPerRow * int(ceil(float(").concat(n,"Shape[2]) / 2.0));\n int index = b * texelsInBatch + (row / 2) * valuesPerRow + (col / 2);\n texelsInBatch *= ").concat(n,"Shape[1];\n index = b2 * texelsInBatch + index;\n ivec2 packedTexShape = ivec2(ceil(float(").concat(n,"TexShape[0]) / 2.0), ceil(float(").concat(n,"TexShape[1]) / 2.0));\n int texR = index / packedTexShape[1];\n int texC = index - texR * packedTexShape[1];\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(packedTexShape[1], packedTexShape[0]); return ").concat(a.texture2D,"(").concat(n,", uv);\n }\n ");for(var i=e.shapeInfo.logicalShape,o=i.length,s=e.shapeInfo.texShape,u=[Math.ceil(s[0]/2),Math.ceil(s[1]/2)],c=u[0],l=u[1],h=Math.ceil(i[o-1]/2),p=h*Math.ceil(i[o-2]/2),f="int b, int row, int col",d="b * ".concat(p," + (row / 2) * ").concat(h," + (col / 2)"),v=2;v<o-1;v++)f="int b".concat(v,", ")+f,p*=i[o-v-1],d="b".concat(v," * ").concat(p," + ")+d;return"\n vec4 ".concat(r,"(").concat(f,") {\n int index = ").concat(d,";\n int texR = index / ").concat(l,";\n int texC = index - texR * ").concat(l,";\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(").concat(l,", ").concat(c,");\n return ").concat(a.texture2D,"(").concat(n,", uv);\n }\n ")}(e,t)}}var MNe="\nvec2 uvFromFlat(int texNumR, int texNumC, int index) {\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\nvec2 packedUVfrom1D(int texNumR, int texNumC, int index) {\n int texelIndex = index / 2;\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",LNe="\nvec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR,\n int texNumC, int row, int col) {\n int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",zNe="\nvec2 packedUVfrom3D(int texNumR, int texNumC,\n int texelsInBatch, int texelsInLogicalRow, int b,\n int row, int col) {\n int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",PNe="\n float getChannel(vec4 frag, vec2 innerDims) {\n vec2 modCoord = mod(innerDims, 2.);\n return modCoord.x == 0. ?\n (modCoord.y == 0. ? frag.r : frag.g) :\n (modCoord.y == 0. ? frag.b : frag.a);\n }\n float getChannel(vec4 frag, int dim) {\n float modCoord = mod(float(dim), 2.);\n return modCoord == 0. ? frag.r : frag.g;\n }\n";function BNe(e){return"offset".concat(e)}function WNe(e,t){var n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1);if(e.shapeInfo.isUniform)return"float ".concat(r,"() {return ").concat(n,";}");var a=S(e.shapeInfo.texShape,2),i=a[0],o=a[1];if(1===i&&1===o)return"\n float ".concat(r,"() {\n return sampleTexture(").concat(n,", halfCR);\n }\n ");var s=BNe(n);if(t)return"\n float ".concat(r,"() {\n vec2 uv = uvFromFlat(").concat(n,"TexShape[0], ").concat(n,"TexShape[1], ").concat(s,");\n return sampleTexture(").concat(n,", uv);\n }\n ");var u=S(e.shapeInfo.texShape,2),c=u[0],l=u[1];return"\n float ".concat(r,"() {\n vec2 uv = uvFromFlat(").concat(c,", ").concat(l,", ").concat(s,");\n return sampleTexture(").concat(n,", uv);\n }\n ")}function VNe(e,t){var n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1);if(e.shapeInfo.isUniform)return"\n float ".concat(r,"(int index) {\n ").concat(KNe(e),"\n }\n ");var a=e.shapeInfo.texShape,i=a[0],o=a[1];if(1===o&&1===i)return"\n float ".concat(r,"(int index) {\n return sampleTexture(").concat(n,", halfCR);\n }\n ");var s=BNe(n);return 1===o?t?"\n float ".concat(r,"(int index) {\n vec2 uv = vec2(0.5, (float(index + ").concat(s,") + 0.5) / float(").concat(n,"TexShape[0]));\n return sampleTexture(").concat(n,", uv);\n }\n "):"\n float ".concat(r,"(int index) {\n vec2 uv = vec2(0.5, (float(index + ").concat(s,") + 0.5) / ").concat(i,".0);\n return sampleTexture(").concat(n,", uv);\n }\n "):1===i?t?"\n float ".concat(r,"(int index) {\n vec2 uv = vec2((float(index + ").concat(s,") + 0.5) / float(").concat(n,"TexShape[1]), 0.5);\n return sampleTexture(").concat(n,", uv);\n }\n "):"\n float ".concat(r,"(int index) {\n vec2 uv = vec2((float(index + ").concat(s,") + 0.5) / ").concat(o,".0, 0.5);\n return sampleTexture(").concat(n,", uv);\n }\n "):t?"\n float ".concat(r,"(int index) {\n vec2 uv = uvFromFlat(").concat(n,"TexShape[0], ").concat(n,"TexShape[1], index + ").concat(s,");\n return sampleTexture(").concat(n,", uv);\n }\n "):"\n float ".concat(r,"(int index) {\n vec2 uv = uvFromFlat(").concat(i,", ").concat(o,", index + ").concat(s,");\n return sampleTexture(").concat(n,", uv);\n }\n ")}function UNe(e,t){var n=e.shapeInfo.logicalShape,r=e.name,a="get"+r.charAt(0).toUpperCase()+r.slice(1),i=e.shapeInfo.texShape;if(null!=i&&P$(n,i)){if(t)return"\n float ".concat(a,"(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(").concat(r,"TexShape[1], ").concat(r,"TexShape[0]);\n return sampleTexture(").concat(r,", uv);\n }\n ");var o=i[0],s=i[1];return"\n float ".concat(a,"(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(").concat(s,".0, ").concat(o,".0);\n return sampleTexture(").concat(r,", uv);\n }\n ")}var u=H$(n),c=u.newShape,l=u.keptDims,h=c;if(h.length<n.length){var p=QNe(e,h);return"\n ".concat(FNe(p,t),"\n float ").concat(a,"(int row, int col) {\n return ").concat(a,"(").concat($Ne(["row","col"],l),");\n }\n ")}if(e.shapeInfo.isUniform)return"\n float ".concat(a,"(int row, int col) {\n int index = round(dot(vec2(row, col), vec2(").concat(n[1],", 1)));\n ").concat(KNe(e),"\n }\n ");var f=i[0],d=i[1],v=BNe(r);return 1===d?t?"\n float ".concat(a,"(int row, int col) {\n float index = dot(vec3(row, col, ").concat(v,"), vec3(").concat(r,"Shape[1], 1, 1));\n vec2 uv = vec2(0.5, (index + 0.5) / float(").concat(r,"TexShape[0]));\n return sampleTexture(").concat(r,", uv);\n }\n "):"\n float ".concat(a,"(int row, int col) {\n float index = dot(vec3(row, col, ").concat(v,"), vec3(").concat(n[1],", 1, 1));\n vec2 uv = vec2(0.5, (index + 0.5) / ").concat(f,".0);\n return sampleTexture(").concat(r,", uv);\n }\n "):1===f?t?"\n float ".concat(a,"(int row, int col) {\n float index = dot(vec3(row, col, ").concat(v,"), vec3(").concat(r,"Shape[1], 1, 1));\n vec2 uv = vec2((index + 0.5) / float(").concat(r,"TexShape[1]), 0.5);\n return sampleTexture(").concat(r,", uv);\n }\n "):"\n float ".concat(a,"(int row, int col) {\n float index = dot(vec3(row, col, ").concat(v,"), vec3(").concat(n[1],", 1, 1));\n vec2 uv = vec2((index + 0.5) / ").concat(d,".0, 0.5);\n return sampleTexture(").concat(r,", uv);\n }\n "):t?"\n float ".concat(a,"(int row, int col) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ").concat(r,"Shape[1] + col + ").concat(v,";\n vec2 uv = uvFromFlat(").concat(r,"TexShape[0], ").concat(r,"TexShape[1], index);\n return sampleTexture(").concat(r,", uv);\n }\n "):"\n float ".concat(a,"(int row, int col) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ").concat(n[1]," + col + ").concat(v,";\n vec2 uv = uvFromFlat(").concat(f,", ").concat(d,", index);\n return sampleTexture(").concat(r,", uv);\n }\n")}function GNe(e,t){var n=e.shapeInfo.logicalShape,r=e.name,a="get"+r.charAt(0).toUpperCase()+r.slice(1),i=n[1]*n[2],o=n[2],s=H$(n),u=s.newShape,c=s.keptDims,l=u;if(l.length<n.length){var h=QNe(e,l);return"\n ".concat(FNe(h,t),"\n float ").concat(a,"(int row, int col, int depth) {\n return ").concat(a,"(").concat($Ne(["row","col","depth"],c),");\n }\n ")}if(e.shapeInfo.isUniform)return"\n float ".concat(a,"(int row, int col, int depth) {\n int index = round(dot(vec3(row, col, depth),\n vec3(").concat(i,", ").concat(o,", 1)));\n ").concat(KNe(e),"\n }\n ");var p=e.shapeInfo.texShape,f=p[0],d=p[1],v=e.shapeInfo.flatOffset;if(d===i&&null==v)return t?"\n float ".concat(a,"(int row, int col, int depth) {\n int stride1 = ").concat(r,"Shape[2];\n float texR = float(row);\n float texC = dot(vec2(col, depth), vec2(stride1, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(r,"TexShape[1], ").concat(r,"TexShape[0]);\n return sampleTexture(").concat(r,", uv);\n }\n "):"\n float ".concat(a,"(int row, int col, int depth) {\n float texR = float(row);\n float texC = dot(vec2(col, depth), vec2(").concat(o,", 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(d,".0, ").concat(f,".0);\n return sampleTexture(").concat(r,", uv);\n }\n ");if(d===o&&null==v)return t?"\n float ".concat(a,"(int row, int col, int depth) {\n float texR = dot(vec2(row, col), vec2(").concat(r,"Shape[1], 1));\n float texC = float(depth);\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(").concat(r,"TexShape[1], ").concat(r,"TexShape[0]);\n return sampleTexture(").concat(r,", uv);\n }\n "):"\n float ".concat(a,"(int row, int col, int depth) {\n float texR = dot(vec2(row, col), vec2(").concat(n[1],", 1));\n float texC = float(depth);\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(").concat(d,".0, ").concat(f,".0);\n return sampleTexture(").concat(r,", uv);\n }\n ");var m=BNe(r);return t?"\n float ".concat(a,"(int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int stride0 = ").concat(r,"Shape[1] * ").concat(r,"Shape[2];\n int stride1 = ").concat(r,"Shape[2];\n int index = row * stride0 + col * stride1 + depth + ").concat(m,";\n vec2 uv = uvFromFlat(").concat(r,"TexShape[0], ").concat(r,"TexShape[1], index);\n return sampleTexture(").concat(r,", uv);\n }\n "):"\n float ".concat(a,"(int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ").concat(i," + col * ").concat(o," + depth + ").concat(m,";\n vec2 uv = uvFromFlat(").concat(f,", ").concat(d,", index);\n return sampleTexture(").concat(r,", uv);\n }\n ")}function jNe(e,t){var n=e.shapeInfo.logicalShape,r=e.name,a="get"+r.charAt(0).toUpperCase()+r.slice(1),i=n[3],o=n[2]*i,s=n[1]*o,u=H$(n),c=u.newShape,l=u.keptDims;if(c.length<n.length){var h=QNe(e,c);return"\n ".concat(FNe(h,t),"\n float ").concat(a,"(int row, int col, int depth, int depth2) {\n return ").concat(a,"(").concat($Ne(["row","col","depth","depth2"],l),");\n }\n ")}if(e.shapeInfo.isUniform)return"\n float ".concat(a,"(int row, int col, int depth, int depth2) {\n int index = round(dot(vec4(row, col, depth, depth2),\n vec4(").concat(s,", ").concat(o,", ").concat(i,", 1)));\n ").concat(KNe(e),"\n }\n ");var p=e.shapeInfo.flatOffset,f=e.shapeInfo.texShape,d=f[0],v=f[1],m="int stride2 = ".concat(r,"Shape[3];"),g="int stride1 = ".concat(r,"Shape[2] * stride2;"),y="int stride0 = ".concat(r,"Shape[1] * stride1;");if(v===s&&null==p)return t?"\n float ".concat(a,"(int row, int col, int depth, int depth2) {\n ").concat(m,"\n ").concat(g,"\n float texR = float(row);\n float texC =\n dot(vec3(col, depth, depth2),\n vec3(stride1, stride2, 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(r,"TexShape[1], ").concat(r,"TexShape[0]);\n return sampleTexture(").concat(r,", uv);\n }\n "):"\n float ".concat(a,"(int row, int col, int depth, int depth2) {\n float texR = float(row);\n float texC =\n dot(vec3(col, depth, depth2),\n vec3(").concat(o,", ").concat(i,", 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(v,".0, ").concat(d,".0);\n return sampleTexture(").concat(r,", uv);\n }\n ");if(v===i&&null==p)return t?"\n float ".concat(a,"(int row, int col, int depth, int depth2) {\n float texR = dot(vec3(row, col, depth),\n vec3(").concat(r,"Shape[1] * ").concat(r,"Shape[2], ").concat(r,"Shape[2], 1));\n float texC = float(depth2);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(r,"TexShape[1], ").concat(r,"TexShape[0]);\n return sampleTexture(").concat(r,", uv);\n }\n "):"\n float ".concat(a,"(int row, int col, int depth, int depth2) {\n float texR = dot(vec3(row, col, depth),\n vec3(").concat(n[1]*n[2],", ").concat(n[2],", 1));\n float texC = float(depth2);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(v,".0, ").concat(d,".0);\n return sampleTexture(").concat(r,", uv);\n }\n ");var b=BNe(r);return t?"\n float ".concat(a,"(int row, int col, int depth, int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n ").concat(m,"\n ").concat(g,"\n ").concat(y,"\n int index = row * stride0 + col * stride1 +\n depth * stride2 + depth2;\n vec2 uv = uvFromFlat(").concat(r,"TexShape[0], ").concat(r,"TexShape[1], index + ").concat(b,");\n return sampleTexture(").concat(r,", uv);\n }\n "):"\n float ".concat(a,"(int row, int col, int depth, int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ").concat(s," + col * ").concat(o," +\n depth * ").concat(i," + depth2;\n vec2 uv = uvFromFlat(").concat(d,", ").concat(v,", index + ").concat(b,");\n return sampleTexture(").concat(r,", uv);\n }\n ")}function HNe(e){var t=e.shapeInfo.logicalShape,n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),a=t[4],i=t[3]*a,o=t[2]*i,s=t[1]*o,u=H$(t),c=u.newShape,l=u.keptDims;if(c.length<t.length){var h=QNe(e,c);return"\n ".concat(FNe(h),"\n float ").concat(r,"(int row, int col, int depth, int depth2, int depth3) {\n return ").concat(r,"(").concat($Ne(["row","col","depth","depth2","depth3"],l),");\n }\n ")}if(e.shapeInfo.isUniform)return"\n float ".concat(r,"(int row, int col, int depth, int depth2, int depth3) {\n float index = dot(\n vec4(row, col, depth, depth2),\n vec4(").concat(s,", ").concat(o,", ").concat(i,", ").concat(a,")) +\n depth3;\n ").concat(KNe(e),"\n }\n ");var p=e.shapeInfo.flatOffset,f=e.shapeInfo.texShape,d=f[0],v=f[1];if(v===s&&null==p)return"\n float ".concat(r,"(int row, int col, int depth, int depth2, int depth3) {\n int texR = row;\n float texC = dot(vec4(col, depth, depth2, depth3),\n vec4(").concat(o,", ").concat(i,", ").concat(a,", 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(v,".0, ").concat(d,".0);\n return sampleTexture(").concat(n,", uv);\n }\n ");if(v===a&&null==p)return"\n float ".concat(r,"(int row, int col, int depth, int depth2, int depth3) {\n float texR = dot(\n vec4(row, col, depth, depth2),\n vec4(").concat(t[1]*t[2]*t[3],",\n ").concat(t[2]*t[3],", ").concat(t[3],", 1));\n int texC = depth3;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(v,".0, ").concat(d,".0);\n return sampleTexture(").concat(n,", uv);\n }\n ");var m=BNe(n);return"\n float ".concat(r,"(int row, int col, int depth, int depth2, int depth3) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ").concat(s," + col * ").concat(o," + depth * ").concat(i," +\n depth2 * ").concat(a," + depth3 + ").concat(m,";\n vec2 uv = uvFromFlat(").concat(d,", ").concat(v,", index);\n return sampleTexture(").concat(n,", uv);\n }\n ")}function qNe(e){var t=e.shapeInfo.logicalShape,n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),a=H$(t),i=a.newShape,o=a.keptDims;if(i.length<t.length){var s=QNe(e,i);return"\n ".concat(FNe(s),"\n float ").concat(r,"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n return ").concat(r,"(").concat($Ne(["row","col","depth","depth2","depth3","depth4"],o),");\n }\n ")}var u=t[5],c=t[4]*u,l=t[3]*c,h=t[2]*l,p=t[1]*h;if(e.shapeInfo.isUniform)return"\n float ".concat(r,"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n int index = round(dot(\n vec4(row, col, depth, depth2),\n vec4(").concat(p,", ").concat(h,", ").concat(l,", ").concat(c,")) +\n dot(\n vec2(depth3, depth4),\n vec2(").concat(u,", 1)));\n ").concat(KNe(e),"\n }\n ");var f=e.shapeInfo.flatOffset,d=e.shapeInfo.texShape,v=d[0],m=d[1];if(m===p&&null==f)return"\n float ".concat(r,"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n int texR = row;\n float texC = dot(vec4(col, depth, depth2, depth3),\n vec4(").concat(h,", ").concat(l,", ").concat(c,", ").concat(u,")) +\n float(depth4);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(m,".0, ").concat(v,".0);\n return sampleTexture(").concat(n,", uv);\n }\n ");if(m===u&&null==f)return"\n float ".concat(r,"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n float texR = dot(vec4(row, col, depth, depth2),\n vec4(").concat(t[1]*t[2]*t[3]*t[4],",\n ").concat(t[2]*t[3]*t[4],",\n ").concat(t[3]*t[4],",\n ").concat(t[4],")) + float(depth3);\n int texC = depth4;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(").concat(m,".0, ").concat(v,".0);\n return sampleTexture(").concat(n,", uv);\n }\n ");var g=BNe(n);return"\n float ".concat(r,"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * ").concat(p," + col * ").concat(h," + depth * ").concat(l," +\n depth2 * ").concat(c," + depth3 * ").concat(u," + depth4 + ").concat(g,";\n vec2 uv = uvFromFlat(").concat(v,", ").concat(m,", index);\n return sampleTexture(").concat(n,", uv);\n }\n ")}function KNe(e){var t=e.name,n=L$(e.shapeInfo.logicalShape);return n<2?"return ".concat(t,";"):"\n for (int i = 0; i < ".concat(n,"; i++) {\n if (i == index) {\n return ").concat(t,"[i];\n }\n }\n ")}function XNe(e,t){var n,r=e.name,a=r.charAt(0).toUpperCase()+r.slice(1),i="get"+a+"AtOutCoords",o=e.shapeInfo.logicalShape.length,s=t.logicalShape.length,u=_Ne(e.shapeInfo.logicalShape,t.logicalShape),c=JNe(s),l=s-o,h=["x","y","z","w","u","v"];n=0===o?"":s<2&&u.length>=1?"coords = 0;":u.map((function(e){return"coords.".concat(h[e+l]," = 0;")})).join("\n");var p="";p=s<2&&o>0?"coords":e.shapeInfo.logicalShape.map((function(e,t){return"coords.".concat(h[t+l])})).join(", ");var f="return outputValue;",d=1===L$(e.shapeInfo.logicalShape),v=1===L$(t.logicalShape);if(1!==o||d||v){if(d&&!v)f=1===s?"\n return vec4(outputValue.x, outputValue.x, 0., 0.);\n ":"\n return vec4(outputValue.x);\n ";else if(u.length){var m=o-2,g=o-1;u.indexOf(m)>-1&&u.indexOf(g)>-1?f="return vec4(outputValue.x);":u.indexOf(m)>-1?f="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":u.indexOf(g)>-1&&(f="return vec4(outputValue.xx, outputValue.zz);")}}else f="\n return vec4(outputValue.xy, outputValue.xy);\n ";return"\n vec4 ".concat(i,"() {\n ").concat(c," coords = getOutputCoords();\n ").concat(n,"\n vec4 outputValue = get").concat(a,"(").concat(p,");\n ").concat(f,"\n }\n ")}function YNe(e,t){var n=e.name,r=n.charAt(0).toUpperCase()+n.slice(1),a="get"+r+"AtOutCoords",i=t.texShape,o=e.shapeInfo.texShape,s=e.shapeInfo.logicalShape.length,u=t.logicalShape.length;if(!e.shapeInfo.isUniform&&s===u&&null==e.shapeInfo.flatOffset&&P$(o,i))return"\n float ".concat(a,"() {\n return sampleTexture(").concat(n,", resultUV);\n }\n ");var c,l=JNe(u),h=_Ne(e.shapeInfo.logicalShape,t.logicalShape),p=u-s,f=["x","y","z","w","u","v"];c=0===s?"":u<2&&h.length>=1?"coords = 0;":h.map((function(e){return"coords.".concat(f[e+p]," = 0;")})).join("\n");var d="";return d=u<2&&s>0?"coords":e.shapeInfo.logicalShape.map((function(e,t){return"coords.".concat(f[t+p])})).join(", "),"\n float ".concat(a,"() {\n ").concat(l," coords = getOutputCoords();\n ").concat(c,"\n return get").concat(r,"(").concat(d,");\n }\n ")}function JNe(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 ".concat(e," is not yet supported"))}function ZNe(e,t,n){var r=H$(t),a=r.newShape,i=r.keptDims,o=t.length,s=e&&3===o&&1===t[0],u=s?t.slice(1):a,c=!e&&o>1&&!P$(t,n)&&a.length<o||s;return{useSqueezeShape:c,uniformShape:c?u:t,keptDims:i}}function QNe(e,t){var n=JSON.parse(JSON.stringify(e));return n.shapeInfo.logicalShape=t,n}function $Ne(e,t){return t.map((function(t){return e[t]})).join(", ")}function eSe(e,t,n,r){var a=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.isPacked,flatOffset:null};return null!=e.texData&&null!=e.texData.slice&&e.texData.slice.flatOffset>0&&(r.flatOffset=e.texData.slice.flatOffset),{name:t.variableNames[n],shapeInfo:r}})),i=a.map((function(e){return e.shapeInfo})),o={logicalShape:r.shape,texShape:r.texData.texShape,isUniform:!1,isPacked:r.texData.isPacked,flatOffset:null},s=ONe(a,o,t),u=zIe(e.gl,s),c=e.createProgram(u);return k0().get("ENGINE_COMPILE_ONLY")?{program:t,fragmentShader:u,source:s,webGLProgram:c,inShapeInfos:i,outShapeInfo:o,variablesLocations:null,customUniformLocations:null,infLoc:null,nanLoc:null,outShapeLocation:null,outShapeStridesLocation:null,outTexShapeLocation:null}:(e.buildVao(c),Object.assign({program:t,fragmentShader:u,source:s,webGLProgram:c,inShapeInfos:i,outShapeInfo:o},tSe(e,t,c)))}function tSe(e,t,n){var r,a,i,o,s=[],u=[],c=null;o=e.getUniformLocation(n,"NAN",!1),1===k0().getNumber("WEBGL_VERSION")&&(c=e.getUniformLocation(n,"INFINITY",!1));var l,h=!1,p=O(t.variableNames);try{for(p.s();!(l=p.n()).done;){var f=l.value,d={name:f,uniform:e.getUniformLocation(n,f,h),offset:e.getUniformLocation(n,"offset".concat(f),h)};t.enableShapeUniforms&&(d.shape=e.getUniformLocation(n,"".concat(f,"Shape"),h),d.texShape=e.getUniformLocation(n,"".concat(f,"TexShape"),h)),s.push(d)}}catch(e){p.e(e)}finally{p.f()}if(t.enableShapeUniforms&&(r=e.getUniformLocation(n,"outShape",h),i=e.getUniformLocation(n,"outShapeStrides",h),a=e.getUniformLocation(n,"outTexShape",h)),t.customUniforms){var v,m=O(t.customUniforms);try{for(m.s();!(v=m.n()).done;){var g=v.value;u.push(e.getUniformLocation(n,g.name,h))}}catch(e){m.e(e)}finally{m.f()}}return{variablesLocations:s,customUniformLocations:u,infLoc:c,nanLoc:o,outShapeLocation:r,outShapeStridesLocation:i,outTexShapeLocation:a}}function nSe(e,t){if(e.length!==t.length)throw Error("Binary was compiled with ".concat(e.length," inputs, but ")+"was executed with ".concat(t.length," inputs"));e.forEach((function(e,n){var r=e.logicalShape,a=t[n],i=a.shape;if(!P$(r,i))throw Error("Binary was compiled with different shapes than "+"the current args. Shapes ".concat(r," and ").concat(i," must match"));if(!e.isUniform||!a.isUniform){var o=e.texShape,s=a.isUniform?null:a.texData.texShape;if(!P$(o,s))throw Error("Binary was compiled with different texture shapes than the"+" current args. Shape ".concat(o," and ").concat(s," must match"))}}))}function rSe(e,t,n,r,a){t.program.enableShapeUniforms||(nSe(t.inShapeInfos,n),nSe([t.outShapeInfo],[r]));var i=r.texData.texture,o=r.texData.texShape;r.texData.isPacked?e.setOutputPackedMatrixTexture(i.texture,o[0],o[1]):e.setOutputMatrixTexture(i.texture,o[0],o[1]),e.setProgram(t.webGLProgram),e.bindVertexArray(t.webGLProgram.vao),1===k0().getNumber("WEBGL_VERSION")&&null!==t.infLoc&&e.gl.uniform1f(t.infLoc,1/0),null!==t.nanLoc&&e.gl.uniform1f(t.nanLoc,NaN);for(var s=0;s<n.length;++s){var u=n[s],c=t.variablesLocations[s],l=c.uniform,h=c.offset,p=c.shape,f=c.texShape;if(p){var d=ZNe(t.program.packedInputs,u.shape,u.texData.texShape).uniformShape;switch(d.length){case 1:e.gl.uniform1iv(p,new Int32Array(d));break;case 2:e.gl.uniform2iv(p,new Int32Array(d));break;case 3:e.gl.uniform3iv(p,new Int32Array(d));break;case 4:e.gl.uniform4iv(p,new Int32Array(d))}}if(f&&e.gl.uniform2i(f,u.texData.texShape[0],u.texData.texShape[1]),null!=l)if(u.isUniform)if(L$(u.shape)<2)e.gl.uniform1f(l,u.uniformValues[0]);else{var v=u.uniformValues;v instanceof Float32Array||(v=new Float32Array(v)),e.gl.uniform1fv(l,v)}else null!=u.texData.slice&&null!=h&&e.gl.uniform1i(h,u.texData.slice.flatOffset),e.setInputMatrixTexture(u.texData.texture.texture,l,s)}var m=t.outShapeLocation;if(m)switch(r.shape.length){case 1:e.gl.uniform1iv(m,new Int32Array(r.shape));break;case 2:e.gl.uniform2iv(m,new Int32Array(r.shape));break;case 3:e.gl.uniform3iv(m,new Int32Array(r.shape));break;case 4:e.gl.uniform4iv(m,new Int32Array(r.shape))}if(t.outShapeStridesLocation){var g=i0(r.shape);switch(r.shape.length){case 2:e.gl.uniform1iv(t.outShapeStridesLocation,new Int32Array(g));break;case 3:e.gl.uniform2iv(t.outShapeStridesLocation,new Int32Array(g));break;case 4:e.gl.uniform3iv(t.outShapeStridesLocation,new Int32Array(g))}}if(t.outTexShapeLocation&&e.gl.uniform2i(t.outTexShapeLocation,r.texData.texShape[0],r.texData.texShape[1]),t.program.customUniforms&&a)for(var y=0;y<t.program.customUniforms.length;++y){var b=t.program.customUniforms[y],x=t.customUniformLocations[y],k=a[y];if("float"===b.type)e.gl.uniform1fv(x,k);else if("vec2"===b.type)e.gl.uniform2fv(x,k);else if("vec3"===b.type)e.gl.uniform3fv(x,k);else if("vec4"===b.type)e.gl.uniform4fv(x,k);else if("int"===b.type)e.gl.uniform1iv(x,k);else if("ivec2"===b.type)e.gl.uniform2iv(x,k);else if("ivec3"===b.type)e.gl.uniform3iv(x,k);else{if("ivec4"!==b.type)throw Error("uniform type ".concat(b.type," is not supported yet."));e.gl.uniform4iv(x,k)}}e.executeProgram()}function aSe(e,t,n){var r="";t.concat(n).forEach((function(t){var a=null!=t.texData&&null!=t.texData.slice&&t.texData.slice.flatOffset>0;if(e.enableShapeUniforms&&!t.isUniform){var i=t.texData.texShape,o=ZNe(e.packedInputs,t.shape,i),s=o.useSqueezeShape,u=o.uniformShape,c=o.keptDims,l="",h="",p="";if(1===u.length&&e.packedInputs){var f=[Math.ceil(i[0]/2),Math.ceil(i[1]/2)];l="".concat(f[0]>1,"_").concat(f[1]>1)}else if(2!==u.length||e.packedInputs){if(u.length>2&&!e.packedInputs){var d=i0(u);p="".concat(d[0]===i[1],"_").concat(d[d.length-1]===i[1])}}else h="".concat(u[0]>1,"_").concat(u[1]>1);var v=t.shape.length,m=2===u.length&&P$(t.shape,i),g=1===L$(t.shape),y=E7(t.shape,n.shape),b=!e.packedInputs&&v===n.shape.length&&P$(i,n.texData.texShape),x=e.packedInputs||u.length>2?"":"".concat(i[0]>1,"_").concat(i[1]>1);r+="".concat(v,"_").concat(b,"_").concat(s?c:"","_").concat(u.length,"_").concat(g,"_").concat(y,"_").concat(m,"_").concat(l,"_").concat(h,"_").concat(p,"_").concat(x,"_").concat(a)}else{var k=t.isUniform?"uniform":t.texData.texShape;r+="".concat(t.shape,"_").concat(k,"_").concat(a)}}));var a=e.userCode,i=e.constructor.name;return i+="_"+r+"_"+a+"".concat(k0().getNumber("WEBGL_VERSION"))}function iSe(e){return k0().getBool("WEBGL_USE_SHAPES_UNIFORMS")&&e<=4}var oSe=p((function e(t){l(this,e),this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=kIe.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];var n=SNe();this.outputShape=t,this.enableShapeUniforms=iSe(this.outputShape.length),this.userCode="\n ivec3 outCoordsFromFlatIndex(int index) {\n ".concat(this.enableShapeUniforms?ENe(["r","c","d"],t):TNe(["r","c","d"],t),"\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));\n int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getA(rc.x, rc.y, rc.z);\n }\n\n ").concat(n.output," = result;\n }\n ")})),sSe=p((function e(t){l(this,e),this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=kIe.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];var n=SNe();this.outputShape=t,this.enableShapeUniforms=iSe(this.outputShape.length),this.userCode="\n ivec3 outCoordsFromFlatIndex(int index) {\n ".concat(this.enableShapeUniforms?ENe(["r","c","d"],t):TNe(["r","c","d"],t),"\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2(texShape[0], texShape[1]));\n int index = 4 * (resTexRC.x * texShape[1] + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getChannel(getA(rc.x, rc.y, rc.z), vec2(rc.y, rc.z));\n }\n\n ").concat(n.output," = result;\n }\n ")})),uSe=p((function e(t){l(this,e),this.variableNames=["A"],this.outTexUsage=wIe.DOWNLOAD;var n=SNe();this.outputShape=t,this.userCode="\n ".concat(RNe,"\n\n void main() {\n float x = getAAtOutCoords();\n ").concat(n.output," = encode_float(x);\n }\n ")})),cSe=p((function e(t){l(this,e),this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=wIe.DOWNLOAD;var n=SNe();this.outputShape=t,this.userCode="\n ".concat(RNe,"\n\n void main() {\n ivec3 coords = getOutputCoords();\n float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z));\n ").concat(n.output," = encode_float(x);\n }\n ")})),lSe={R:0,G:1,B:2,A:3},hSe=p((function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"RGBA";l(this,e),this.variableNames=["A"],this.customUniforms=[{name:"texShape",type:"ivec2"}];var a=SNe();this.outputShape=t,this.enableShapeUniforms=iSe(this.outputShape.length);var i="result";n&&(i="floor(result * 255. + 0.5)");for(var o="",s=0;s<r.length;s++){var u=r[s];o+="\n if(offset == ".concat(s,") {\n result = values[").concat(lSe[u],"];\n }")}this.userCode="\n ".concat(this.enableShapeUniforms?"\n int getFlatIndex(ivec3 coords) {\n return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z;\n }\n":ANe(t),"\n\n void main() {\n ivec3 coords = getOutputCoords();\n int flatIndex = getFlatIndex(coords);\n float result = 0.;\n int offset = imod(flatIndex, ").concat(r.length,");\n\n flatIndex = idiv(flatIndex, ").concat(r.length,", 1.);\n\n int r = flatIndex / texShape[1];\n if (r < texShape[0]) {\n int c = imod(flatIndex, texShape[1]);\n vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);\n vec4 values = ").concat(a.texture2D,"(A, uv);\n ").concat(o,"\n }\n ").concat(a.output," = vec4(").concat(i,", 0., 0., 0.);\n }\n ")})),pSe=p((function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];l(this,e),this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.customUniforms=[{name:"texShape",type:"ivec2"}];var r=SNe();this.outputShape=t,this.enableShapeUniforms=iSe(this.outputShape.length);var a="",i="result";n&&(i="floor(result * 255. + 0.5)");for(var o=0;o<=1;o++)for(var s=0;s<=1;s++){var u=2*o+s;a+="\n localCoords = coords;\n if(localCoords[2] + ".concat(s," < ").concat(this.enableShapeUniforms?"outShape[2]":"".concat(t[2]),") {\n localCoords[2] += ").concat(s,";\n if (localCoords[1] + ").concat(o," < ").concat(this.enableShapeUniforms?"outShape[1]":"".concat(t[1]),") {\n localCoords[1] += ").concat(o,";\n\n flatIndex = getFlatIndex(localCoords);\n offset = imod(flatIndex, 4);\n\n flatIndex = idiv(flatIndex, 4, 1.);\n\n int r = flatIndex / texShape[1];\n int c = imod(flatIndex, texShape[1]);\n vec2 uv = (vec2(c, r) + halfCR) / vec2(texShape[1], texShape[0]);\n values = ").concat(r.texture2D,"(A, uv);\n\n if (offset == 0) {\n result[").concat(u,"] = values[0];\n } else if (offset == 1) {\n result[").concat(u,"] = values[1];\n } else if (offset == 2) {\n result[").concat(u,"] = values[2];\n } else {\n result[").concat(u,"] = values[3];\n }\n }\n }\n ")}this.userCode="\n ".concat(this.enableShapeUniforms?"\n int getFlatIndex(ivec3 coords) {\n return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z;\n }\n":ANe(t),"\n\n void main() {\n ivec3 coords = getOutputCoords();\n\n vec4 result = vec4(0.);\n int flatIndex, r, c, offset;\n ivec3 localCoords;\n vec2 uv;\n vec4 values;\n\n ").concat(a,"\n\n ").concat(r.output," = ").concat(i,";\n }\n ")}));function fSe(e){var t=SNe();return LIe(e,"".concat(t.version,"\n precision highp float;\n ").concat(t.attribute," vec3 clipSpacePos;\n ").concat(t.attribute," vec2 uv;\n ").concat(t.varyingVs," vec2 resultUV;\n\n void main() {\n gl_Position = vec4(clipSpacePos, 1);\n resultUV = uv;\n }"))}function dSe(e){return HIe(e,new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]))}function vSe(e){return qIe(e,new Uint16Array([0,1,2,2,1,3]))}function mSe(e,t,n,r,a,i){XIe(t,n);var o=KIe(e),s=e.TEXTURE_2D;return OIe(e,(function(){return e.bindTexture(s,o)})),OIe(e,(function(){return e.texParameteri(s,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE)})),OIe(e,(function(){return e.texParameteri(s,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)})),OIe(e,(function(){return e.texParameteri(s,e.TEXTURE_MIN_FILTER,e.NEAREST)})),OIe(e,(function(){return e.texParameteri(s,e.TEXTURE_MAG_FILTER,e.NEAREST)})),1===k0().getNumber("WEBGL_VERSION")?OIe(e,(function(){return e.texImage2D(s,0,r,t,n,0,a,i,null)})):OIe(e,(function(){return e.texStorage2D(s,1,r,t,n)})),OIe(e,(function(){return e.bindTexture(e.TEXTURE_2D,null)})),{texture:o,texShape:[n,t]}}function gSe(e){return e.internalFormatFloat}function ySe(e,t,n,r){var a=S(CIe(t,n),2);return mSe(e,a[0],a[1],gSe(r),r.textureFormatFloat,e.FLOAT)}function bSe(e){return e.internalFormatHalfFloat}function xSe(e,t,n,r){var a=S(CIe(t,n),2);return mSe(e,a[0],a[1],bSe(r),r.textureFormatFloat,r.textureTypeHalfFloat)}function kSe(e){return e.downloadTextureFormat}function wSe(e,t,n,r){var a=S(CIe(t,n),2);return mSe(e,a[0],a[1],kSe(r),e.RGBA,e.UNSIGNED_BYTE)}function ISe(e){return e.internalFormatPackedFloat}function NSe(e,t,n,r){var a=S(RIe(t,n),2);return mSe(e,a[0],a[1],ISe(r),e.RGBA,e.FLOAT)}function SSe(e){return e.internalFormatPackedHalfFloat}function TSe(e,t,n,r){var a=S(RIe(t,n),2);return mSe(e,a[0],a[1],SSe(r),e.RGBA,r.textureTypeHalfFloat)}function ESe(e,t,n){return OIe(e,(function(){return e.bindBuffer(e.ARRAY_BUFFER,n)})),JIe(e,t,"clipSpacePos",n,3,20,0)&&JIe(e,t,"uv",n,2,20,12)}function CSe(e,t,n,r,a,i){var o,s,u;OIe(e,(function(){return e.bindTexture(e.TEXTURE_2D,t)})),a instanceof Uint8Array?(o=new Uint8Array(n*r*4),s=e.UNSIGNED_BYTE,u=e.RGBA):(o=new Float32Array(n*r*4),s=e.FLOAT,u=i.internalFormatPackedFloat),o.set(a),2===k0().getNumber("WEBGL_VERSION")?OIe(e,(function(){return e.texSubImage2D(e.TEXTURE_2D,0,0,0,n,r,e.RGBA,s,o)})):OIe(e,(function(){return e.texImage2D(e.TEXTURE_2D,0,u,n,r,0,e.RGBA,s,o)})),OIe(e,(function(){return e.bindTexture(e.TEXTURE_2D,null)}))}function ASe(e,t,n){OIe(e,(function(){return e.bindTexture(e.TEXTURE_2D,t)})),n.data instanceof Uint8Array?2===k0().getNumber("WEBGL_VERSION")?OIe(e,(function(){return e.texSubImage2D(e.TEXTURE_2D,0,0,0,n.width,n.height,e.RGBA,e.UNSIGNED_BYTE,n.data)})):OIe(e,(function(){return e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data)})):2===k0().getNumber("WEBGL_VERSION")?OIe(e,(function(){return e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,n)})):OIe(e,(function(){return e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)})),OIe(e,(function(){return e.bindTexture(e.TEXTURE_2D,null)}))}function RSe(e,t,n,r){var a=e.createBuffer();OIe(e,(function(){return e.bindBuffer(e.PIXEL_PACK_BUFFER,a)}));var i=16*t*n;return OIe(e,(function(){return e.bufferData(e.PIXEL_PACK_BUFFER,i,e.STREAM_READ)})),OIe(e,(function(){return e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,0)})),OIe(e,(function(){return e.bindBuffer(e.PIXEL_PACK_BUFFER,null)})),a}function _Se(e,t,n){var r=e,a=new Float32Array(n);return r.bindBuffer(r.PIXEL_PACK_BUFFER,t),r.getBufferSubData(r.PIXEL_PACK_BUFFER,0,a),r.bindBuffer(r.PIXEL_PACK_BUFFER,null),a}function OSe(e,t,n,r){var a=S(CIe(t,n),2),i=a[0],o=a[1],s=new Uint8Array(t*n*4);return OIe(e,(function(){return e.readPixels(0,0,i,o,r.downloadTextureFormat,e.UNSIGNED_BYTE,s)})),new Float32Array(s.buffer)}function FSe(e,t,n,r,a,i,o,s){var u=e,c=new Float32Array(function(e,t){var n=S(RIe(e,t),2);return n[0]*n[1]*4}(i,o));return u.bindBuffer(u.PIXEL_PACK_BUFFER,t),u.getBufferSubData(u.PIXEL_PACK_BUFFER,0,c),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),c}function DSe(e,t,n){var r=new Float32Array(t*n*4);return OIe(e,(function(){return e.readPixels(0,0,n,t,e.RGBA,e.FLOAT,r)})),r}var MSe={__proto__:null,bindVertexProgramAttributeStreams:ESe,createBufferFromOutputTexture:RSe,createFloat16MatrixTexture:xSe,createFloat16PackedMatrixTexture:TSe,createFloat32MatrixTexture:ySe,createIndexBuffer:vSe,createPackedMatrixTexture:NSe,createUnsignedBytesMatrixTexture:wSe,createVertexBuffer:dSe,createVertexShader:fSe,downloadByteEncodedFloatMatrixFromOutputTexture:OSe,downloadFloat32MatrixFromBuffer:_Se,downloadMatrixFromPackedOutputTexture:DSe,downloadPackedMatrixFromBuffer:FSe,getInternalFormatForFloat16MatrixTexture:bSe,getInternalFormatForFloat16PackedMatrixTexture:SSe,getInternalFormatForFloat32MatrixTexture:gSe,getInternalFormatForPackedMatrixTexture:ISe,getInternalFormatForUnsignedBytesMatrixTexture:kSe,uploadDenseMatrixToTexture:CSe,uploadPixelDataToTexture:ASe},LSe=function(){function e(t){l(this,e),this.outputTexture=null,this.program=null,this.disposed=!1,this.itemsToPoll=[];var n=k0().getNumber("WEBGL_VERSION");if(null!=t?(this.gl=t,TIe(n,t)):this.gl=EIe(n),t=this.gl,2===k0().getNumber("WEBGL_VERSION")){var r=t;this.createVertexArray=function(){return OIe(r,(function(){return r.createVertexArray()}))},this.bindVertexArray=function(e){return OIe(r,(function(){return r.bindVertexArray(e)}))},this.deleteVertexArray=function(e){return OIe(r,(function(){return r.deleteVertexArray(e)}))},this.getVertexArray=function(){return OIe(r,(function(){return r.getParameter(r.VERTEX_ARRAY_BINDING)}))}}else if(null!=t){var a=t.getExtension("OES_vertex_array_object");if(null==a)throw new Error("All WebGL1 implementations are expected to offer OES_vertex_array_object.");this.createVertexArray=function(){return OIe(t,(function(){return a.createVertexArrayOES()}))},this.bindVertexArray=function(e){return OIe(t,(function(){return a.bindVertexArrayOES(e)}))},this.deleteVertexArray=function(e){return OIe(t,(function(){return a.deleteVertexArrayOES(e)}))},this.getVertexArray=function(){return OIe(t,(function(){return t.getParameter(a.VERTEX_ARRAY_BINDING_OES)}))}}var i="WEBGL_color_buffer_float",o="EXT_color_buffer_half_float";if(this.parallelCompilationExtension=this.gl.getExtension("KHR_parallel_shader_compile"),1===k0().getNumber("WEBGL_VERSION")){var s="OES_texture_half_float";if(this.textureFloatExtension=MIe(this.gl,"OES_texture_float"),mNe(this.gl,s))this.textureHalfFloatExtension=MIe(this.gl,s);else if(k0().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");if(this.colorBufferFloatExtension=this.gl.getExtension(i),mNe(this.gl,o))this.colorBufferHalfFloatExtension=MIe(this.gl,o);else if(k0().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.")}else if(i="EXT_color_buffer_float",mNe(this.gl,i))this.colorBufferFloatExtension=this.gl.getExtension(i);else{if(!mNe(this.gl,o))throw new Error("GL context does not support color renderable floats");this.colorBufferHalfFloatExtension=this.gl.getExtension(o)}this.vertexBuffer=dSe(this.gl),this.indexBuffer=vSe(this.gl),this.framebuffer=YIe(this.gl),this.textureConfig=_Ie(this.gl,this.textureHalfFloatExtension)}var t;return p(e,[{key:"debug",get:function(){return k0().getBool("DEBUG")}},{key:"dispose",value: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;OIe(t,(function(){return t.finish()})),OIe(t,(function(){return t.bindFramebuffer(t.FRAMEBUFFER,null)})),OIe(t,(function(){return t.deleteFramebuffer(e.framebuffer)})),OIe(t,(function(){return t.bindBuffer(t.ARRAY_BUFFER,null)})),OIe(t,(function(){return t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)})),OIe(t,(function(){return t.deleteBuffer(e.indexBuffer)})),this.disposed=!0}}},{key:"createFloat32MatrixTexture",value:function(e,t){return this.throwIfDisposed(),ySe(this.gl,e,t,this.textureConfig)}},{key:"createFloat16MatrixTexture",value:function(e,t){return this.throwIfDisposed(),xSe(this.gl,e,t,this.textureConfig)}},{key:"createUnsignedBytesMatrixTexture",value:function(e,t){return this.throwIfDisposed(),wSe(this.gl,e,t,this.textureConfig)}},{key:"uploadPixelDataToTexture",value:function(e,t){this.throwIfDisposed(),ASe(this.gl,e,t)}},{key:"uploadDenseMatrixToTexture",value:function(e,t,n,r){this.throwIfDisposed(),CSe(this.gl,e,t,n,r,this.textureConfig)}},{key:"createFloat16PackedMatrixTexture",value:function(e,t){return this.throwIfDisposed(),TSe(this.gl,e,t,this.textureConfig)}},{key:"createPackedMatrixTexture",value:function(e,t){return this.throwIfDisposed(),NSe(this.gl,e,t,this.textureConfig)}},{key:"deleteMatrixTexture",value:function(e){var t=this;this.throwIfDisposed(),this.outputTexture===e&&(nNe(this.gl,this.framebuffer),this.outputTexture=null),OIe(this.gl,(function(){return t.gl.deleteTexture(e)}))}},{key:"downloadByteEncodedFloatMatrixFromOutputTexture",value:function(e,t,n){var r=this;return this.downloadMatrixDriver(e,(function(){return OSe(r.gl,t,n,r.textureConfig)}))}},{key:"downloadPackedMatrixFromBuffer",value:function(e,t,n,r,a,i){return FSe(this.gl,e,0,0,0,a,i,this.textureConfig)}},{key:"downloadFloat32MatrixFromBuffer",value:function(e,t){return _Se(this.gl,e,t)}},{key:"createBufferFromTexture",value:function(e,t,n){this.bindTextureToFrameBuffer(e);var r=RSe(this.gl,t,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),r}},{key:"createAndWaitForFence",value:function(){var e=this.createFence(this.gl);return this.pollFence(e)}},{key:"createFence",value:function(e){var t,n,r=this;if(k0().getBool("WEBGL_FENCE_API_ENABLED")){var a=e,i=a.fenceSync(a.SYNC_GPU_COMMANDS_COMPLETE,0);e.flush(),n=function(){var e=a.clientWaitSync(i,0,0);return e===a.ALREADY_SIGNALED||e===a.CONDITION_SATISFIED},t=i}else k0().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(t=this.beginQuery(),this.endQuery(),n=function(){return r.isQueryAvailable(t,k0().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}):n=function(){return!0};return{query:t,isFencePassed:n}}},{key:"downloadMatrixFromPackedTexture",value:function(e,t,n){var r=this;return this.downloadMatrixDriver(e,(function(){return DSe(r.gl,t,n)}))}},{key:"createProgram",value:function(e){var t=this;this.throwIfDisposed();var n=this.gl;null==this.vertexShader&&(this.vertexShader=fSe(n));var r=UIe(n);OIe(n,(function(){return n.attachShader(r,t.vertexShader)})),OIe(n,(function(){return n.attachShader(r,e)})),GIe(n,r);var a=Object.assign(r,{vao:this.createVertexArray()});return this.debug&&jIe(n,a),a}},{key:"buildVao",value:function(e){var t=this;this.setProgram(e),this.bindVertexArray(e.vao);var n=this.gl;OIe(n,(function(){return n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.indexBuffer)})),ESe(n,e,this.vertexBuffer)}},{key:"deleteProgram",value:function(e){var t=this;this.throwIfDisposed(),e===this.program&&(this.program=null),null!=e&&(OIe(this.gl,(function(){return t.gl.deleteProgram(e)})),this.deleteVertexArray(e.vao))}},{key:"setProgram",value:function(e){var t=this;this.throwIfDisposed(),this.program=e,null!=this.program&&this.debug&&jIe(this.gl,this.program),OIe(this.gl,(function(){return t.gl.useProgram(e)}))}},{key:"getUniformLocation",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.throwIfDisposed(),n?QIe(this.gl,e,t):$Ie(this.gl,e,t)}},{key:"getAttributeLocation",value:function(e,t){var n=this;return this.throwIfDisposed(),OIe(this.gl,(function(){return n.gl.getAttribLocation(e,t)}))}},{key:"getUniformLocationNoThrow",value:function(e,t){return this.throwIfDisposed(),this.gl.getUniformLocation(e,t)}},{key:"setInputMatrixTexture",value:function(e,t,n){this.throwIfDisposed(),this.throwIfNoProgram(),eNe(this.gl,e,t,n)}},{key:"setOutputMatrixTexture",value:function(e,t,n){this.setOutputMatrixTextureDriver(e,n,t)}},{key:"setOutputPackedMatrixTexture",value:function(e,t,n){this.throwIfDisposed();var r=S(RIe(t,n),2),a=r[0],i=r[1];this.setOutputMatrixTextureDriver(e,a,i)}},{key:"setOutputMatrixWriteRegion",value:function(e,t,n,r){this.setOutputMatrixWriteRegionDriver(n,e,r,t)}},{key:"setOutputPackedMatrixWriteRegion",value:function(e,t,n,r){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")}},{key:"debugValidate",value:function(){null!=this.program&&jIe(this.gl,this.program),rNe(this.gl)}},{key:"executeProgram",value:function(){this.throwIfDisposed(),this.throwIfNoProgram();var e=this.gl;if(this.debug){var t=this.getVertexArray();console.assert(t===this.program.vao,"VAO changed between setProgram and executeProgram!"),this.debugValidate()}OIe(e,(function(){return e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}))}},{key:"blockUntilAllProgramsCompleted",value:function(){var e=this;this.throwIfDisposed(),OIe(this.gl,(function(){return e.gl.finish()}))}},{key:"getQueryTimerExtension",value:function(){return null==this.disjointQueryTimerExtension&&(this.disjointQueryTimerExtension=MIe(this.gl,2===k0().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension}},{key:"getQueryTimerExtensionWebGL2",value:function(){return this.getQueryTimerExtension()}},{key:"getQueryTimerExtensionWebGL1",value:function(){return this.getQueryTimerExtension()}},{key:"beginQuery",value:function(){if(2===k0().getNumber("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(),a=r.createQueryEXT();return r.beginQueryEXT(r.TIME_ELAPSED_EXT,a),a}},{key:"endQuery",value:function(){if(2!==k0().getNumber("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)}}},{key:"waitForQueryAndGetTime",value:(t=c(o().mark((function e(t){var n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,U$((function(){return n.disposed||n.isQueryAvailable(t,k0().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}));case 2:return e.abrupt("return",this.getQueryTime(t,k0().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"getQueryTime",value: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}},{key:"isQueryAvailable",value:function(e,t){if(0===t)return!0;if(2===t){var n=this.gl,r=this.getQueryTimerExtensionWebGL2(),a=n.getQueryParameter(e,n.QUERY_RESULT_AVAILABLE);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(r.GPU_DISJOINT_EXT)),a&&!this.disjoint}var i=this.getQueryTimerExtensionWebGL1(),o=i.getQueryObjectEXT(e,i.QUERY_RESULT_AVAILABLE_EXT);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(i.GPU_DISJOINT_EXT)),o&&!this.disjoint}},{key:"pollFence",value:function(e){var t=this;return new Promise((function(n){t.addItemToPoll((function(){return e.isFencePassed()}),(function(){return n()}))}))}},{key:"pollItems",value:function(){for(var e=function(e){for(var t=0;t<e.length;++t){if(!e[t]())break}return t-1}(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)}},{key:"addItemToPoll",value:function(e,t){var n=this;if(this.itemsToPoll.push({isDoneFn:e,resolveFn:t}),!(this.itemsToPoll.length>1)){var r=void 0;"setTimeoutCustom"in k0().platform&&(r=k0().platform.setTimeoutCustom.bind(k0().platform)),U$((function(){return n.pollItems(),0===n.itemsToPoll.length}),(function(){return 0}),null,r)}}},{key:"bindTextureToFrameBuffer",value:function(e){this.throwIfDisposed(),tNe(this.gl,e,this.framebuffer),this.debug&&rNe(this.gl)}},{key:"unbindTextureToFrameBuffer",value:function(){null!=this.outputTexture?(tNe(this.gl,this.outputTexture,this.framebuffer),this.debug&&rNe(this.gl)):nNe(this.gl,this.framebuffer)}},{key:"downloadMatrixDriver",value:function(e,t){this.bindTextureToFrameBuffer(e);var n=t();return this.unbindTextureToFrameBuffer(),n}},{key:"setOutputMatrixTextureDriver",value:function(e,t,n){this.throwIfDisposed();var r=this.gl;tNe(r,e,this.framebuffer),this.debug&&rNe(r),this.outputTexture=e,OIe(r,(function(){return r.viewport(0,0,t,n)})),OIe(r,(function(){return r.scissor(0,0,t,n)}))}},{key:"setOutputMatrixWriteRegionDriver",value:function(e,t,n,r){var a=this;this.throwIfDisposed(),OIe(this.gl,(function(){return a.gl.scissor(e,t,n,r)}))}},{key:"throwIfDisposed",value:function(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")}},{key:"throwIfNoProgram",value:function(){if(null==this.program)throw new Error("No GPU program is currently set.")}}]),e}();var zSe=lge,PSe=dge,BSe=vge,WSe=mge,VSe=ige,USe=wge,GSe=Sge,jSe=Tge,HSe=Age,qSe=Oge,KSe=Mge,XSe=Vge,YSe=Uge,JSe=Gge,ZSe=qge,QSe=Yge,$Se=Qge,eTe=tye,tTe=nye,nTe=iye,rTe=oye,aTe=cye,iTe=pye,oTe=mye,sTe=yye,uTe=Nye,cTe=Aye,lTe=_ye,hTe=Lye,pTe=zye,fTe=Pye,dTe=Vye,vTe=Uye,mTe=Yme,gTe=Hye,yTe=Xye,bTe=Yye,xTe=Jye,kTe=Zye,wTe=rbe,ITe=obe,NTe=ube,STe=lbe,TTe=hbe,ETe=pbe,CTe=mbe,ATe=bbe,RTe=kye,_Te=xbe;function OTe(e,t){return["x","y","z","w","u","v"].slice(0,t).map((function(t){return"".concat(e,".").concat(t)}))}function FTe(e,t){return 1===t?[e]:OTe(e,t)}var DTe=function(){function e(t){if(l(this,e),this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outputShape=t,this.rank=t.length,this.enableShapeUniforms=iSe(this.outputShape.length),0===this.rank)this.userCode="\n void main() {\n setOutput(vec4(getA(), 0., 0., 0.));\n }\n ";else{var n=FTe("rc",this.rank),r=JNe(this.rank),a=this.getOutOfBoundsCondition(n),i=this.getSetup(n),o=this.getOutput(n);this.userCode="\n void main() {\n ".concat(r," rc = getOutputCoords();\n\n if(").concat(a,") {\n setOutput(vec4(0));\n } else {\n ").concat(i,"\n\n setOutput(vec4(").concat(o,"));\n }\n }\n ")}}return p(e,[{key:"getSourceCoordsArr",value:function(e){for(var t=[],n=0;n<=1;n++)for(var r=0;r<=1;r++){for(var a="".concat(0===n?"r":"rp1",", ").concat(0===r?"c":"cp1"),i=2;i<this.rank;i++)a="".concat(e[e.length-1-i],",")+a;t.push(a)}return t}},{key:"getOutOfBoundsCondition",value:function(e){if(1===this.rank)return"rc > ".concat(this.enableShapeUniforms?"outShape":this.outputShape[0]);for(var t="",n=this.rank-2;n<this.rank;n++)t+="".concat(e[n]," >= ").concat(this.enableShapeUniforms?"outShape[".concat(n,"]"):this.outputShape[n]),n<this.rank-1&&(t+="||");return t}},{key:"getSetup",value:function(e){if(1===this.rank)return"";var t=e.slice(-2),n=this.enableShapeUniforms?"outShape[".concat(this.rank," - 1]"):this.outputShape[this.rank-1],r=this.enableShapeUniforms?"outShape[".concat(this.rank," - 2]"):this.outputShape[this.rank-2];return"\n int r = ".concat(t[0],";\n int c = ").concat(t[1],";\n int rp1 = r + 1;\n int cp1 = c + 1;\n\n bool cEdge = cp1 >= ").concat(n,";\n bool rEdge = rp1 >= ").concat(r,";\n ")}},{key:"getOutput",value:function(e){var t=this.getSourceCoordsArr(e);if(1===this.rank){var n=this.enableShapeUniforms?"outShape":this.outputShape[0];return"getA(rc), (rc + 1 >= ".concat(n," ? 0. : getA(rc + 1)), 0, 0")}return"getA(".concat(t[0],"),\n cEdge ? 0. : getA(").concat(t[1],"),\n rEdge ? 0. : getA(").concat(t[2],"),\n rEdge || cEdge ? 0. : getA(").concat(t[3],")")}}]),e}(),MTe=p((function e(t,n){l(this,e),this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"inputShape",type:"ivec3"}],this.outputShape=t,this.enableShapeUniforms=iSe(this.outputShape.length);for(var r,a,i,o="",s=0;s<4;s++){var u="thisRC = rc;";s%2==1&&(u+="thisRC.z += 1;"),s>1&&(u+="thisRC.y += 1;"),o+="\n ".concat(u,"\n ").concat(s>0?"if(thisRC.y < rows && thisRC.z < cols){":"","\n int flatIndex = getFlatIndex(thisRC);\n\n ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);\n vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));\n\n result[").concat(s,"] =\n getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);\n ").concat(s>0?"}":"","\n ")}this.userCode="\n ".concat((r=n,a=this.enableShapeUniforms,i=a?function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"index",r=e.map((function(e,t){return t})),a=CNe(r,t);return a.map((function(t,r){var i="int ".concat(e[r]," = ").concat(n," / ").concat(a[r]),o=r===a.length-1?"int ".concat(e[r+1]," = ").concat(n," - ").concat(e[r]," * ").concat(a[r]):"index -= ".concat(e[r]," * ").concat(a[r]);return"".concat(i,"; ").concat(o,";")})).join("")}(["r","c","d"],"inputShape"):TNe(["r","c","d"],r),"\n ivec3 inputCoordsFromReshapedOutCoords(int index) {\n ".concat(i,"\n return ivec3(r, c, d);\n }\n ")),"\n ").concat(this.enableShapeUniforms?"\n int getFlatIndex(ivec3 coords) {\n return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z;\n }\n":ANe(t),"\n\n void main() {\n ivec3 rc = getOutputCoords();\n\n vec4 result = vec4(0.);\n\n ivec3 thisRC;\n int rows = ").concat(this.enableShapeUniforms?"outShape[1]":t[1],";\n int cols = ").concat(this.enableShapeUniforms?"outShape[2]":t[2],";\n\n ").concat(o,"\n\n setOutput(result);\n }\n ")}));var LTe=function(){function e(t){l(this,e),this.gpgpu=t,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0,this.freeTextures={},this.usedTextures={},this.logEnabled=!1}return p(e,[{key:"acquireTexture",value:function(e,t,n){var r=PTe(t,n),a=BTe(e,r,n);a in this.freeTextures||(this.freeTextures[a]=[]),a in this.usedTextures||(this.usedTextures[a]=[]);var i,o=zTe(e,r,this.gpgpu.gl,this.gpgpu.textureConfig,n);if(this.freeTextures[a].length>0){this.numFreeTextures--,this.numUsedTextures++,this._numBytesFree-=o,this.log();var s=this.freeTextures[a].pop();return this.usedTextures[a].push(s),s}return r===IIe.PACKED_2X2_FLOAT32?i=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):r===IIe.PACKED_2X2_FLOAT16?i=this.gpgpu.createFloat16PackedMatrixTexture(e[0],e[1]):r===IIe.UNPACKED_FLOAT32?i=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):r===IIe.UNPACKED_FLOAT16?i=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):r===IIe.PACKED_4X1_UNSIGNED_BYTE&&(i=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[a].push(i),this.numUsedTextures++,this._numBytesAllocated+=o,this.log(),i}},{key:"releaseTexture",value:function(e,t,n,r){if(null!=this.freeTextures){var a=PTe(n,r),i=BTe(t,a,r);i in this.freeTextures||(this.freeTextures[i]=[]);var o=zTe(t,a,this.gpgpu.gl,this.gpgpu.textureConfig,r),s=k0().get("WEBGL_DELETE_TEXTURE_THRESHOLD");-1!==s&&this._numBytesAllocated>s?(this.gpgpu.deleteMatrixTexture(e.texture),this._numBytesAllocated-=o):(this.freeTextures[i].push(e),this.numFreeTextures++,this._numBytesFree+=o),this.numUsedTextures--;var u=this.usedTextures[i],c=u&&u.indexOf(e);if(null==c||c<0)throw new Error("Cannot release a texture that was never provided by this texture manager");u[c]=u[u.length-1],u.pop(),this.log()}}},{key:"log",value:function(){if(this.logEnabled){var e=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used","".concat(this.numFreeTextures," / ").concat(this.numUsedTextures),"(".concat(e,")"));var t=this._numBytesFree/this._numBytesAllocated;console.log("Bytes allocated: ".concat(this._numBytesAllocated)),console.log("Bytes unused: ".concat(this._numBytesFree," (").concat(Math.round(100*t),"%)"))}}},{key:"numBytesAllocated",get:function(){return this._numBytesAllocated}},{key:"numBytesFree",get:function(){return this._numBytesFree}},{key:"getNumUsedTextures",value:function(){return this.numUsedTextures}},{key:"getNumFreeTextures",value:function(){return this.numFreeTextures}},{key:"dispose",value:function(){var e=this;if(null!=this.freeTextures){for(var t in this.freeTextures)this.freeTextures[t].forEach((function(t){e.gpgpu.deleteMatrixTexture(t.texture)}));for(var n in this.usedTextures)this.usedTextures[n].forEach((function(t){e.gpgpu.deleteMatrixTexture(t.texture)}));this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0}}}]),e}();function zTe(e,t,n,r,a){var i,o=function(e,t){switch(e){case IIe.PACKED_2X2_FLOAT32:return ISe(t);case IIe.PACKED_2X2_FLOAT16:return SSe(t);case IIe.UNPACKED_FLOAT32:return gSe(t);case IIe.UNPACKED_FLOAT16:return bSe(t);case IIe.PACKED_4X1_UNSIGNED_BYTE:return kSe(t);default:throw new Error("Unknown physical texture type ".concat(e))}}(t,r);if(a){var s=S(RIe(e[0],e[1]),2);i=s[0]*s[1]}else{var u=S(CIe(e[0],e[1]),2);i=u[0]*u[1]}var c=function(e,t){var n=e;if(t===n.R32F)return 4;if(t===n.R16F)return 2;if(t===n.RGBA32F)return 16;if(t===e.RGBA)return 16;if(t===n.RGBA16F)return 8;if(t===n.RGBA8)return 4;throw new Error("Unknown internal format ".concat(t))}(n,o);return i*c}function PTe(e,t){if(e===wIe.UPLOAD)return IIe.PACKED_2X2_FLOAT32;if(e===wIe.RENDER||null==e)return function(e){return k0().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?e?IIe.PACKED_2X2_FLOAT32:IIe.UNPACKED_FLOAT32:e?IIe.PACKED_2X2_FLOAT16:IIe.UNPACKED_FLOAT16}(t);if(e===wIe.DOWNLOAD||e===wIe.PIXELS)return IIe.PACKED_4X1_UNSIGNED_BYTE;throw new Error("Unknown logical texture type ".concat(e))}function BTe(e,t,n){return"".concat(e[0],"_").concat(e[1],"_").concat(t,"_").concat(n)}var WTe=p((function e(t,n){l(this,e),this.variableNames=["A"],this.outputShape=t,this.enableShapeUniforms=iSe(this.outputShape.length),this.userCode="\n float unaryOperation(float x) {\n ".concat(n,"\n }\n\n void main() {\n float x = getAAtOutCoords();\n float y = unaryOperation(x);\n\n setOutput(y);\n }\n ")})),VTe="if (isnan(x)) return x;",UTe="return x;",GTe="return abs(x);";var jTe="return (x >= 0.0) ? x : (exp(x) - 1.0);",HTe=VTe+"\n return (x < 0.0) ? 0.0 : x;\n",qTe=VTe+"\n return (x < 0.0) ? 0.0 : min(6.0, x);\n",KTe="return x;",XTe="return 1.0 / (1.0 + exp(-1.0 * x));",YTe="return x;",JTe="\n vec4 result;\n\n result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);\n result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);\n result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);\n result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);\n\n return result;\n",ZTe="\n vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n",QTe="\n vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n",$Te="return 1.0 / (1.0 + exp(-1.0 * x));",eEe=p((function e(t,n){l(this,e),this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t,this.enableShapeUniforms=iSe(this.outputShape.length),this.userCode="\n vec4 unaryOperation(vec4 x) {\n ".concat(n,"\n }\n\n void main() {\n vec4 x = getAAtOutCoords();\n vec4 y = unaryOperation(x);\n\n setOutput(y);\n }\n ")})),tEe=p((function e(t){l(this,e),this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=t,this.enableShapeUniforms=iSe(this.outputShape.length);var n=t.length,r=FTe("rc",n),a=JNe(n),i=function(e,t){if(1===e)return"rc";for(var n="",r=0;r<e;r++)n+=t[r],r<e-1&&(n+=",");return n}(n,r),o=r.slice(-2),s=n<=1?"rc":"vec2(".concat(o.join(","),")");this.userCode="\n void main() {\n ".concat(a," rc = getOutputCoords();\n vec4 packedInput = getA(").concat(i,");\n\n setOutput(getChannel(packedInput, ").concat(s,"));\n }\n ")})),nEe=Qte,rEe={};var aEe=k0().getNumber("CPU_HANDOFF_SIZE_THRESHOLD");var iEe=function(e){d(s,e);var t,n,r,a,i=w(s);function s(e){var t,n,r;if(l(this,s),(t=i.call(this)).pendingRead=new WeakMap,t.pendingDisposal=new WeakSet,t.dataRefCount=new WeakMap,t.numBytesInGPU=0,t.uploadWaitMs=0,t.downloadWaitMs=0,t.lastGlFlushTime=0,t.warnedAboutMemory=!1,t.pendingDeletes=0,t.disposed=!1,!k0().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");if(null!=e){if(e instanceof LSe)n=e;else{var a=EIe(k0().getNumber("WEBGL_VERSION"),e);n=new LSe(a)}t.binaryCache={},t.gpgpuCreatedLocally=!1}else{var o=EIe(k0().getNumber("WEBGL_VERSION"));n=new LSe(o),t.binaryCache=((r=k0().getNumber("WEBGL_VERSION"))in rEe||(rEe[r]={}),rEe[r]),t.gpgpuCreatedLocally=!0}return t.gpgpu=n,t.canvas=t.gpgpu.gl.canvas,t.textureManager=new LTe(t.gpgpu),t.numMBBeforeWarning=null==k0().global.screen?1024:k0().global.screen.height*k0().global.screen.width*window.devicePixelRatio*600/1024/1024,t.texData=new S$(x(t),Q6()),t}return p(s,[{key:"nextDataId",value:function(){return s.nextDataId++}},{key:"numDataIds",value:function(){return this.texData.numDataIds()-this.pendingDeletes}},{key:"writeTexture",value:function(e,t,n,r,a,i){var o=this.makeTensorInfo(t,n),s=this.texData.get(o.dataId);s.isPacked=!1,s.texture={texture:e,texShape:[r,a]},s.texShape=[r,a];var u=cNe(t),c=new hSe(u,!1,i),l=this.runWebGLProgram(c,[o],n,[[r,a]]);return l.shape=t,s.texture=null,this.disposeIntermediateTensorInfo(o),l.dataId}},{key:"write",value:function(e,t,n){if((k0().getBool("WEBGL_CHECK_NUMERICAL_PROBLEMS")||k0().getBool("DEBUG"))&&this.checkNumericalProblems(e),"complex64"===n&&null!=e)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");var r={id:this.nextDataId()};return this.texData.set(r,{shape:t,dtype:n,values:e,usage:wIe.UPLOAD,refCount:1}),r}},{key:"refCount",value:function(e){return this.texData.has(e)?this.texData.get(e).refCount:0}},{key:"incRef",value:function(e){this.texData.get(e).refCount++}},{key:"decRef",value:function(e){this.texData.has(e)&&this.texData.get(e).refCount--}},{key:"move",value:function(e,t,n,r,a){if(k0().getBool("DEBUG")&&this.checkNumericalProblems(t),"complex64"===r)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(e,{shape:n,dtype:r,values:t,usage:wIe.UPLOAD,refCount:a})}},{key:"disposeIntermediateTensorInfo",value:function(e){this.disposeData(e.dataId)}},{key:"readSync",value:function(e){var t=this.texData.get(e),n=t.values,r=t.dtype,a=t.complexTensorInfos,i=t.slice,o=t.shape,s=t.isPacked;if(null!=i){var u;u=s?new eEe(o,KTe):new WTe(o,KTe);var c=this.runWebGLProgram(u,[{dataId:e,shape:o,dtype:r}],r),l=this.readSync(c.dataId);return this.disposeIntermediateTensorInfo(c),l}if(null!=n)return this.convertAndCacheOnCPU(e);if("string"===r)return n;var h,p,f=null!=this.activeTimers;(f&&(h=z4()),"complex64"===r)?p=die(this.readSync(a.real.dataId),this.readSync(a.imag.dataId)):p=this.getValuesFromTexture(e);return f&&(this.downloadWaitMs+=z4()-h),this.convertAndCacheOnCPU(e,p)}},{key:"read",value:(a=c(o().mark((function e(t){var n,r,a,i,s,u,c,l,h,p,f,d,v,m,g,y,b,x,k,w,I,N,S;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.pendingRead.has(t)){e.next=3;break}return n=this.pendingRead.get(t),e.abrupt("return",new Promise((function(e){return n.push(e)})));case 3:if(r=this.texData.get(t),a=r.values,i=r.shape,s=r.slice,u=r.dtype,c=r.complexTensorInfos,l=r.isPacked,null==s){e.next=11;break}return h=l?new eEe(i,KTe):new WTe(i,KTe),p=this.runWebGLProgram(h,[{dataId:t,shape:i,dtype:u}],u),f=this.read(p.dataId),this.disposeIntermediateTensorInfo(p),e.abrupt("return",f);case 11:if(null==a){e.next=13;break}return e.abrupt("return",this.convertAndCacheOnCPU(t));case 13:if(!k0().getBool("DEBUG")){e.next=16;break}if(k0().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")||2!==k0().getNumber("WEBGL_VERSION")){e.next=16;break}throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");case 16:if(d=null,"complex64"!==u&&k0().get("WEBGL_BUFFER_SUPPORTED")&&(v=this.decode(t),g=this.texData.get(v.dataId),d=(m=this.gpgpu).createBufferFromTexture.apply(m,[g.texture.texture].concat(T(AIe(i))))),this.pendingRead.set(t,[]),"complex64"===u){e.next=22;break}return e.next=22,this.gpgpu.createAndWaitForFence();case 22:if("complex64"!==u){e.next=31;break}return e.next=25,Promise.all([this.read(c.real.dataId),this.read(c.imag.dataId)]);case 25:b=e.sent,x=b[0],k=b[1],y=die(x,k),e.next=32;break;case 31:null==d?y=this.getValuesFromTexture(t):(w=L$(i),y=this.gpgpu.downloadFloat32MatrixFromBuffer(d,w));case 32:return null!=v&&this.disposeIntermediateTensorInfo(v),null!=d&&OIe(I=this.gpgpu.gl,(function(){return I.deleteBuffer(d)})),N=this.convertAndCacheOnCPU(t,y),S=this.pendingRead.get(t),this.pendingRead.delete(t),S.forEach((function(e){return e(N)})),this.pendingDisposal.has(t)&&(this.pendingDisposal.delete(t),this.disposeData(t)&&Q6().removeDataId(t,this),this.pendingDeletes--),e.abrupt("return",N);case 40:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"readToGPU",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.texData.get(e),r=n.values,a=n.shape,i=n.slice,o=n.dtype,s=n.isPacked,u=n.texture;if("complex64"===o)throw new Error("Does not support reading texture for complex64 dtype.");if(null!=i){var c;c=s?new eEe(a,KTe):new WTe(a,KTe);var l=this.runWebGLProgram(c,[{dataId:e,shape:a,dtype:o}],o),h=this.readToGPU(l,t);return this.disposeIntermediateTensorInfo(l),h}if(null==u)throw null!=r?new Error("Data is not on GPU but on CPU."):new Error("There is no data on GPU or CPU.");var p=this.decode(e,t.customTexShape),f=Q6().makeTensorFromTensorInfo(p),d=this.texData.get(p.dataId);return Object.assign({tensorRef:f},d.texture)}},{key:"bufferSync",value:function(e){var t=this.readSync(e.dataId);if("string"===e.dtype)try{var n=t.map((function(e){return W4(e)}));return K6(e.shape,e.dtype,n)}catch(e){throw new Error("Failed to decode encoded string bytes into utf-8")}return K6(e.shape,e.dtype,t)}},{key:"checkNumericalProblems",value:function(e){if(null!=e)for(var t=0;t<e.length;t++){var n=e[t];if(!FIe(n)){if(k0().getBool("WEBGL_RENDER_FLOAT32_CAPABLE"))throw Error("The value ".concat(n," cannot be represented with your ")+"current settings. Consider enabling float32 rendering: 'tf.env().set('WEBGL_RENDER_FLOAT32_ENABLED', true);'");throw Error("The value ".concat(n," cannot be represented on this device."))}}}},{key:"getValuesFromTexture",value:function(e){var t=this.texData.get(e),n=t.shape,r=t.dtype,a=t.isPacked,i=L$(n);if(k0().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")){var o,s=this.decode(e),u=this.texData.get(s.dataId),c=(o=this.gpgpu).downloadMatrixFromPackedTexture.apply(o,[u.texture.texture].concat(T(AIe(n)))).subarray(0,i);return this.disposeIntermediateTensorInfo(s),c}var l=k0().getBool("WEBGL_PACK")&&!0===a,h=l?cNe(n):n,p=l?new cSe(h):new uSe(h),f=this.runWebGLProgram(p,[{shape:h,dtype:r,dataId:e}],"float32"),d=this.texData.get(f.dataId),v=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(d.texture.texture,d.texShape[0],d.texShape[1]).subarray(0,i);return this.disposeIntermediateTensorInfo(f),v}},{key:"timerAvailable",value:function(){return k0().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0}},{key:"time",value:function(e){var t=this,n=this.activeTimers,r=[],a=!1;null==this.programTimersStack?(this.programTimersStack=r,a=!0):this.activeTimers.push(r),this.activeTimers=r,e();var i=U4(this.activeTimers.map((function(e){return e.query}))).filter((function(e){return null!=e})),s=U4(this.activeTimers.map((function(e){return e.name}))).filter((function(e){return null!=e}));this.activeTimers=n,a&&(this.programTimersStack=null);var u={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null};return c(o().mark((function e(){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(k0().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0)){e.next=8;break}return e.next=3,Promise.all(i);case 3:n=e.sent,u.kernelMs=O$(n),u.getExtraProfileInfo=function(){return n.map((function(e,t){return{name:s[t],ms:e}})).map((function(e){return"".concat(e.name,": ").concat(e.ms)})).join(", ")},e.next=9;break;case 8:u.kernelMs={error:"WebGL query timers are not supported in this environment."};case 9:return t.uploadWaitMs=0,t.downloadWaitMs=0,e.abrupt("return",u);case 12:case"end":return e.stop()}}),e)})))()}},{key:"memory",value:function(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU,numBytesInGPUAllocated:this.textureManager.numBytesAllocated,numBytesInGPUFree:this.textureManager.numBytesFree}}},{key:"startTimer",value:function(){return k0().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:z4(),endMs:null}}},{key:"endTimer",value:function(e){return k0().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),e):(e.endMs=z4(),e)}},{key:"getQueryTime",value:(r=c(o().mark((function e(t){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(k0().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0)){e.next=2;break}return e.abrupt("return",this.gpgpu.waitForQueryAndGetTime(t));case 2:return n=t,e.abrupt("return",n.endMs-n.startMs);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"disposeData",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.pendingDisposal.has(e))return!1;if(!this.texData.has(e))return!0;if(t?this.texData.get(e).refCount=0:this.texData.get(e).refCount--,!t&&this.texData.get(e).refCount>0)return!1;if(this.pendingRead.has(e))return this.pendingDisposal.add(e),this.pendingDeletes++,!1;this.releaseGPUData(e);var n=this.texData.get(e),r=n.complexTensorInfos;return null!=r&&(this.disposeData(r.real.dataId,t),this.disposeData(r.imag.dataId,t)),this.texData.delete(e),!0}},{key:"releaseGPUData",value:function(e){var t=this.texData.get(e),n=t.texture,r=t.dtype,a=t.texShape,i=t.usage,o=t.isPacked,s=t.slice,u=s&&s.origDataId||e,c=this.dataRefCount.get(u);c>1?this.dataRefCount.set(u,c-1):(this.dataRefCount.delete(u),null!=n&&(this.numBytesInGPU-=this.computeBytes(a,r),this.textureManager.releaseTexture(n,a,i,o)));var l=this.texData.get(e);l.texture=null,l.texShape=null,l.isPacked=!1,l.slice=null}},{key:"getTexture",value:function(e){return this.uploadToGPU(e),this.texData.get(e).texture.texture}},{key:"getDataInfo",value:function(e){return this.texData.get(e)}},{key:"shouldExecuteOnCPU",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:aEe;return k0().getBool("WEBGL_CPU_FORWARD")&&e.every((function(e){return null==t.texData.get(e.dataId).texture&&L$(e.shape)<n}))}},{key:"getGPGPUContext",value:function(){return this.gpgpu}},{key:"where",value:function(e){z3("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");var t=e.dataSync();return nEe(e.shape,t)}},{key:"packedUnaryOp",value:function(e,t,n){var r=new eEe(e.shape,t),a=this.compileAndRun(r,[e],n);return Q6().makeTensorFromTensorInfo(a)}},{key:"abs",value:function(e){if(this.shouldExecuteOnCPU([e])&&"complex64"!==e.dtype){var t=mTe(this.texData.get(e.dataId).values);return this.makeOutput(e.shape,e.dtype,t)}if(k0().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(e,GTe,e.dtype);var n=new WTe(e.shape,GTe),r=this.compileAndRun(n,[e]);return Q6().makeTensorFromTensorInfo(r)}},{key:"makeTensorInfo",value:function(e,t,n){var r;if("string"===t&&null!=n&&n.length>0&&$$(n[0])){var a=n.map((function(e){return B4(e)}));r=this.write(a,e,t)}else r=this.write(n,e,t);return this.texData.get(r).usage=null,{dataId:r,shape:e,dtype:t}}},{key:"makeOutput",value:function(e,t,n){return Q6().makeTensorFromTensorInfo(this.makeTensorInfo(e,t,n),this)}},{key:"unpackTensor",value:function(e){var t=new tEe(e.shape);return this.runWebGLProgram(t,[e],e.dtype)}},{key:"packTensor",value:function(e){var t=new DTe(e.shape);return this.runWebGLProgram(t,[e],e.dtype,null,!0)}},{key:"packedReshape",value:function(e,t){var n=[sNe(e.shape)].concat(T(uNe(e.shape))),r={dtype:e.dtype,shape:n,dataId:e.dataId},a=[sNe(t)].concat(T(uNe(t))),i=new MTe(a,n),o=[n],s=this.runWebGLProgram(i,[r],e.dtype,o,!0);return{dataId:s.dataId,shape:t,dtype:s.dtype}}},{key:"decode",value:function(e,t){var n=this.texData.get(e),r=n.isPacked,a=n.shape,i=n.dtype;null!=t&&F$(L$(a)<=t[0]*t[1]*4,(function(){return"customTexShape is too small. Row * Column * 4 should be equal or larger than the size of the tensor data."}));var o,s=cNe(a);o=r?new sSe(s):new oSe(s);var u=[null!=t?t:AIe(s)];return{dtype:i,shape:a,dataId:this.runWebGLProgram(o,[{shape:s,dtype:i,dataId:e}],i,u,!0,t).dataId}}},{key:"runWebGLProgram",value:function(e,t,n,r){var a=this,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=arguments.length>5?arguments[5]:void 0,s=this.makeTensorInfo(e.outputShape,n),u=this.texData.get(s.dataId);if(e.packedOutput&&(u.isPacked=!0),e.outPackingScheme===kIe.DENSE){var c=null!=o?o:AIe(e.outputShape);u.texShape=c.map((function(e){return 2*e}))}if(null!=e.outTexUsage&&(u.usage=e.outTexUsage),0===L$(s.shape))return u.values=q$(s.dtype,0),s;var l=[],h=t.map((function(t){if("complex64"===t.dtype)throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");var n=a.texData.get(t.dataId);if(null==n.texture){if(!e.packedInputs&&L$(t.shape)<=k0().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:t.shape,texData:null,isUniform:!0,uniformValues:n.values};e.packedInputs&&(n.isPacked=!0,n.shape=t.shape)}if(a.uploadToGPU(t.dataId),!!n.isPacked!=!!e.packedInputs)t=n.isPacked?a.unpackTensor(t):a.packTensor(t),l.push(t),n=a.texData.get(t.dataId);else if(n.isPacked&&!pNe(n.shape,t.shape)){var r=t,i=t.shape;t.shape=n.shape,t=a.packedReshape(t,i),l.push(t),n=a.texData.get(t.dataId),r.shape=i}return{shape:t.shape,texData:n,isUniform:!1}}));this.uploadToGPU(s.dataId);var p,f={shape:s.shape,texData:u,isUniform:!1},d=aSe(e,h,f),v=this.getAndSaveBinary(d,(function(){return eSe(a.gpgpu,e,h,f)})),m=null!=this.activeTimers;m&&(p=this.startTimer()),k0().get("ENGINE_COMPILE_ONLY")||rSe(this.gpgpu,v,h,f,r),l.forEach((function(e){return a.disposeIntermediateTensorInfo(e)})),m&&(p=this.endTimer(p),this.activeTimers.push({name:e.constructor.name,query:this.getQueryTime(p)}));var g=k0().get("WEBGL_FLUSH_THRESHOLD");if(g>0){var y=z4();y-this.lastGlFlushTime>g&&(this.gpgpu.gl.flush(),this.lastGlFlushTime=y)}if(!k0().getBool("WEBGL_LAZILY_UNPACK")&&u.isPacked&&!1===i){var b=this.unpackTensor(s);return this.disposeIntermediateTensorInfo(s),b}return s}},{key:"compileAndRun",value:function(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];n=n||t[0].dtype;var i=this.runWebGLProgram(e,t,n,r,a);return i}},{key:"getAndSaveBinary",value:function(e,t){return e in this.binaryCache||(this.binaryCache[e]=t()),this.binaryCache[e]}},{key:"getTextureManager",value:function(){return this.textureManager}},{key:"dispose",value:function(){var e=this;if(!this.disposed){if(!k0().getBool("IS_TEST"))Object.keys(this.binaryCache).forEach((function(t){e.gpgpu.deleteProgram(e.binaryCache[t].webGLProgram),delete e.binaryCache[t]}));this.textureManager.dispose(),null!=this.canvas&&"undefined"!=typeof HTMLCanvasElement&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0}}},{key:"floatPrecision",value:function(){var e=this;return null==this.floatPrecisionValue&&(this.floatPrecisionValue=e8((function(){if(!k0().get("WEBGL_RENDER_FLOAT32_ENABLED")){var t=k0().getBool("DEBUG");k0().set("DEBUG",!1);var n=e.abs(Z7(1e-8)).dataSync()[0];if(k0().set("DEBUG",t),n>0)return 32}return 16}))),this.floatPrecisionValue}},{key:"epsilon",value:function(){return 32===this.floatPrecision()?1e-7:1e-4}},{key:"uploadToGPU",value:function(e){var t=this.texData.get(e),n=t.shape,r=t.dtype,a=t.values,i=t.texture,o=t.usage,s=t.isPacked;if(null==i){var u,c=null!=this.activeTimers;c&&(u=z4());var l=t.texShape;if(null==l&&(l=lNe(n,s),t.texShape=l),null!=a){var h,p=cNe(n),f=l[1],d=l[0],v=a instanceof Uint8Array||a instanceof Uint8ClampedArray;if(s||!v){var m=S(RIe(l[0],l[1]),2);f=m[0],d=m[1]}h=s?new pSe(p,v):new hSe(p,v);var g=v?[d,f]:l,y=this.makeTensorInfo(g,r),b=this.texData.get(y.dataId);b.usage=v?wIe.PIXELS:wIe.UPLOAD,b.texShape=g,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(y.dataId),f,d,a);var x=[[d,f]],k=this.runWebGLProgram(h,[y],r,x,!0),w=this.texData.get(k.dataId);t.texShape=w.texShape,t.isPacked=w.isPacked,t.usage=w.usage,k0().get("ENGINE_COMPILE_ONLY")?this.disposeData(k.dataId):(t.texture=w.texture,t.values=null,this.texData.delete(k.dataId)),this.disposeIntermediateTensorInfo(y),c&&(this.uploadWaitMs+=z4()-u)}else{var I=this.acquireTexture(l,o,r,s);t.texture=I}}}},{key:"convertAndCacheOnCPU",value:function(e,t){var n=this.texData.get(e),r=n.dtype;return null!=t&&(n.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 ".concat(t))}(t,r)),n.values}},{key:"acquireTexture",value:function(e,t,n,r){if(this.numBytesInGPU+=this.computeBytes(e,n),!this.warnedAboutMemory&&this.numBytesInGPU>1024*this.numMBBeforeWarning*1024){var a=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn("High memory usage in GPU: ".concat(a," MB, ")+"most likely due to a memory leak")}return this.textureManager.acquireTexture(e,t,r)}},{key:"computeBytes",value:function(e,t){return e[0]*e[1]*Z$(t)}},{key:"checkCompileCompletion",value:function(){for(var e=0,t=Object.entries(this.binaryCache);e<t.length;e++){var n=S(t[e],2)[1];this.checkCompletion_(n)}}},{key:"checkCompileCompletionAsync",value:(n=c(o().mark((function e(){var t,n,r,a,i,s,u,c,l=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=[],!this.gpgpu.parallelCompilationExtension){e.next=6;break}for(n=0,r=Object.entries(this.binaryCache);n<r.length;n++)a=S(r[n],2),i=a[1],t.push(this.checkCompletionAsync_(i));return e.abrupt("return",Promise.all(t));case 6:s=o().mark((function e(){var n,r,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=S(c[u],2),r=n[1],a=new Promise((function(e){try{l.checkCompletion_(r),e(!0)}catch(e){throw e}})),t.push(a);case 3:case"end":return e.stop()}}),e)})),u=0,c=Object.entries(this.binaryCache);case 8:if(!(u<c.length)){e.next=13;break}return e.delegateYield(s(),"t0",10);case 10:u++,e.next=8;break;case 13:return e.abrupt("return",Promise.all(t));case 14:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"checkCompletionAsync_",value:(t=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.gpgpu.gl.getProgramParameter(t.webGLProgram,this.gpgpu.parallelCompilationExtension.COMPLETION_STATUS_KHR)){e.next=4;break}return e.abrupt("return",this.checkCompletion_(t));case 4:return e.next=6,qae();case 6:return e.abrupt("return",this.checkCompletionAsync_(t));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"checkCompletion_",value:function(e){if(!1===this.gpgpu.gl.getProgramParameter(e.webGLProgram,this.gpgpu.gl.LINK_STATUS)){if(console.log(this.gpgpu.gl.getProgramInfoLog(e.webGLProgram)),!1===this.gpgpu.gl.getShaderParameter(e.fragmentShader,this.gpgpu.gl.COMPILE_STATUS))throw VIe(e.source,this.gpgpu.gl.getShaderInfoLog(e.fragmentShader)),new Error("Failed to compile fragment shader.");throw new Error("Failed to link vertex and fragment shaders.")}return!0}},{key:"getUniformLocations",value:function(){for(var e=0,t=Object.values(this.binaryCache);e<t.length;e++){var n=t[e];this.gpgpu.buildVao(n.webGLProgram);var r=tSe(this.gpgpu,n.program,n.webGLProgram),a=r.variablesLocations,i=r.customUniformLocations,o=r.infLoc,s=r.nanLoc,u=r.outShapeLocation,c=r.outShapeStridesLocation,l=r.outTexShapeLocation;n.variablesLocations=a,n.customUniformLocations=i,n.infLoc=o,n.nanLoc=s,n.outShapeLocation=u,n.outShapeStridesLocation=c,n.outTexShapeLocation=l}}},{key:"createTensorFromGPUData",value:function(e,t,n){e.channels=e.channels||"RGBA";var r=e.texture,a=e.height,i=e.width,o=e.channels,s=Q6().backend;if(!s.gpgpu.gl.isTexture(r))throw new Error("The texture is invalid. Also, please make sure the texture and the TFJS WebGL backend are using the same canvas. If you want to use your own custom canvas, you have to create and use the custom TFJS WebGL backend created from the canvas through 'new tf.MathBackendWebGL(customCanvas)'.");var u=s.writeTexture(r,t,n,a,i,o);return Q6().makeTensorFromDataId(u,t,n,s)}}]),s}(T$);iEe.nextDataId=0;var oEe="4.6.0";function sEe(){k0().set("WEBGL_FORCE_F16_TEXTURES",!0)}R5()&&a8("webgl",(function(){return new iEe}),2);var uEe={forceHalfFloat:sEe},cEe=p((function e(t,n,r){l(this,e),this.variableNames=["A","B"],this.outputShape=A7(n,r),this.enableShapeUniforms=iSe(this.outputShape.length),this.userCode="\n float binaryOperation(float a, float b) {\n ".concat(t,"\n }\n\n void main() {\n float a = getAAtOutCoords();\n float b = getBAtOutCoords();\n setOutput(binaryOperation(a, b));\n }\n ")})),lEe="\n result.r = isNaN.r ? NAN : result.r;\n result.g = isNaN.g ? NAN : result.g;\n result.b = isNaN.b ? NAN : result.b;\n result.a = isNaN.a ? NAN : result.a;\n",hEe=p((function e(t,n,r){var a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];l(this,e),this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=A7(n,r);var i=this.outputShape.length;this.enableShapeUniforms=iSe(i);var o="";if(a)if(0===i||1===L$(this.outputShape))o="\n result.y = 0.;\n result.z = 0.;\n result.w = 0.;\n ";else{var s=JNe(i);if(o="\n ".concat(s," coords = getOutputCoords();\n "),1===i)this.enableShapeUniforms?o+="\n result.y = (coords + 1) >= outShape ? 0. : result.y;\n result.z = 0.;\n result.w = 0.;\n ":o+="\n result.y = (coords + 1) >= ".concat(this.outputShape[0]," ? 0. : result.y;\n result.z = 0.;\n result.w = 0.;\n ");else{var u=FTe("coords",i);this.enableShapeUniforms?o+="\n bool nextRowOutOfBounds =\n (".concat(u[i-2]," + 1) >= outShape[").concat(i," - 2];\n bool nextColOutOfBounds =\n (").concat(u[i-1]," + 1) >= outShape[").concat(i," - 1];\n result.y = nextColOutOfBounds ? 0. : result.y;\n result.z = nextRowOutOfBounds ? 0. : result.z;\n result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n "):o+="\n bool nextRowOutOfBounds =\n (".concat(u[i-2]," + 1) >= ").concat(this.outputShape[i-2],";\n bool nextColOutOfBounds =\n (").concat(u[i-1]," + 1) >= ").concat(this.outputShape[i-1],";\n result.y = nextColOutOfBounds ? 0. : result.y;\n result.z = nextRowOutOfBounds ? 0. : result.z;\n result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n ")}}this.userCode="\n vec4 binaryOperation(vec4 a, vec4 b) {\n ".concat(t,"\n }\n\n void main() {\n vec4 a = getAAtOutCoords();\n vec4 b = getBAtOutCoords();\n\n vec4 result = binaryOperation(a, b);\n ").concat(o,"\n\n setOutput(result);\n }\n ")}));function pEe(e){var t=e.inputs,n=e.backend,r=t.x;return n.incRef(r.dataId),{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}var fEe={kernelName:W1,backendName:"webgl",kernelFunc:pEe};function dEe(e){var t=e.inputs,n=e.backend,r=t.real,a=t.imag,i=n.makeTensorInfo(r.shape,"complex64"),o=n.texData.get(i.dataId),s=pEe({inputs:{x:r},backend:n}),u=pEe({inputs:{x:a},backend:n});return o.complexTensorInfos={real:s,imag:u},i}var vEe={kernelName:Z0,backendName:"webgl",kernelFunc:dEe},mEe="return (a < 0.) ? b * a : a;",gEe="\n vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n";var yEe={kernelName:q1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.alpha,o=n.makeTensorInfo([],"float32",M4(i,"float32")),s=k0().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new hEe(gEe,a.shape,o.shape):new cEe(mEe,a.shape,o.shape),u=n.runWebGLProgram(s,[a,o],"float32");return n.disposeIntermediateTensorInfo(o),u}},bEe="return (a < 0.) ? b * a : a;",xEe="\n vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n";var kEe={kernelName:C2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.x,a=t.alpha,i=k0().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new hEe(xEe,r.shape,a.shape):new cEe(bEe,r.shape,a.shape);return n.runWebGLProgram(i,[r,a],"float32")}};function wEe(e){var t=e.opSnippet,n=e.packedOpSnippet,r=e.cpuKernelImpl,a=e.dtype;return function(e){var i,o=e.inputs,s=e.backend,u=o.x,c=s,l=a||u.dtype;if(c.shouldExecuteOnCPU([u])&&null!=r){var h=c.texData.get(u.dataId),p=r(h.values,l);return c.makeTensorInfo(u.shape,l,p)}return i=k0().getBool("WEBGL_PACK_UNARY_OPERATIONS")&&null!=n?new eEe(u.shape,n):new WTe(u.shape,t),c.runWebGLProgram(i,[u],l)}}function IEe(e){var t=e.opSnippet,n=e.packedOpSnippet,r=e.checkOutOfBounds,a=void 0!==r&&r,i=e.supportsComplex,o=void 0!==i&&i,s=e.cpuKernelImpl,u=e.dtype;return function(e){var r=e.inputs,i=e.backend,c=r.a,l=r.b,h=i;if(o&&"complex64"===c.dtype){var p=h.texData.get(c.dataId),f=h.texData.get(l.dataId),d=[[p.complexTensorInfos.real,f.complexTensorInfos.real],[p.complexTensorInfos.imag,f.complexTensorInfos.imag]].map((function(e){var n=S(e,2),r=n[0],a=n[1],i={dataId:r.dataId,dtype:r.dtype,shape:c.shape},o={dataId:a.dataId,dtype:a.dtype,shape:l.shape},s=new cEe(t,c.shape,l.shape);return h.runWebGLProgram(s,[i,o],h5(r.dtype,a.dtype))})),v=S(d,2),m=v[0],g=v[1],y=dEe({inputs:{real:m,imag:g},backend:h});return h.disposeIntermediateTensorInfo(m),h.disposeIntermediateTensorInfo(g),y}var b,x=u||h5(c.dtype,l.dtype);if(("string"===c.dtype||"string"===l.dtype||h.shouldExecuteOnCPU([c,l]))&&null!=s){var k=h.texData.get(c.dataId).values,w=h.texData.get(l.dataId).values,I="string"===c.dtype?qie(k):k,N="string"===c.dtype?qie(w):w,T=S(s(c.shape,l.shape,I,N,x),2),E=T[0],C=T[1],A=h.makeTensorInfo(C,x);return h.texData.get(A.dataId).values=E,A}return b=k0().getBool("WEBGL_PACK_BINARY_OPERATIONS")&&null!=n?new hEe(n,c.shape,l.shape,a):new cEe(t,c.shape,l.shape),h.runWebGLProgram(b,[c,l],x)}}function NEe(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("linear"===e)return t?YTe:UTe;if("relu"===e)return t?ZTe:HTe;if("elu"===e)return t?JTe:jTe;if("relu6"===e)return t?QTe:qTe;if("prelu"===e)return t?xEe:bEe;if("leakyrelu"===e)return t?gEe:mEe;if("sigmoid"===e)return t?$Te:XTe;throw new Error("Activation ".concat(e," has not been implemented for the WebGL backend."))}var SEe=p((function e(t,n,r){var a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,u=arguments.length>7&&void 0!==arguments[7]&&arguments[7],c=arguments.length>8&&void 0!==arguments[8]&&arguments[8];l(this,e),this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=r,this.enableShapeUniforms=iSe(this.outputShape.length);var h=a?t[1]:t[2],p=Math.ceil(h/2),f=a?"i * 2, rc.y":"rc.y, i * 2",d=i?"rc.z, i * 2":"i * 2, rc.z",v=a?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],m=i?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],g="",y="";s&&(g=u?"vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n ".concat(s,"\n }"):c?"vec4 activation(vec4 a) {\n vec4 b = getLeakyreluAlphaAtOutCoords();\n ".concat(s,"\n }"):"vec4 activation(vec4 x) {\n ".concat(s,"\n }"),y="result = activation(result);");var b=o?"result += getBiasAtOutCoords();":"";o&&this.variableNames.push("bias"),u&&this.variableNames.push("preluActivationWeights"),c&&this.variableNames.push("leakyreluAlpha");var x="rc.x",k="rc.x";t[0]<n[0]?x="imod(rc.x, ".concat(t[0],")"):n[0]<t[0]&&(k="imod(rc.x, ".concat(n[0],")")),this.userCode="\n ".concat(g,"\n // Don't use uniform for sharedDimensionPacked for performance.\n const float sharedDimension = ").concat(p,".0;\n\n vec4 dot2x2ARowBCol(ivec3 rc) {\n vec4 result = vec4(0);\n int batchA = ").concat(x,";\n int batchB = ").concat(k,";\n for (int i = 0; i < ").concat(p,"; i++) {\n vec4 a = getMatrixA(batchA, ").concat(f,");\n vec4 b = getMatrixB(batchB, ").concat(d,");\n\n // These swizzled products need to be separately added.\n // See: https://github.com/tensorflow/tfjs/issues/1735\n result += (").concat(v[0]," * ").concat(m[0],");\n result += (").concat(v[1]," * ").concat(m[1],");\n }\n return result;\n }\n\n void main() {\n ivec3 rc = getOutputCoords();\n vec4 result = dot2x2ARowBCol(rc);\n\n ").concat(b,"\n\n ").concat(y,"\n\n setOutput(result);\n }\n ")})),TEe="return areal * breal - aimag * bimag;",EEe="return areal * bimag + aimag * breal;",CEe=p((function e(t,n,r){l(this,e),this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=A7(n,r),this.userCode="\n float binaryOpComplex(\n float areal, float aimag, float breal, float bimag) {\n ".concat(t,"\n }\n\n void main() {\n float areal = getARealAtOutCoords();\n float aimag = getAImagAtOutCoords();\n float breal = getBRealAtOutCoords();\n float bimag = getBImagAtOutCoords();\n setOutput(binaryOpComplex(areal, aimag, breal, bimag));\n }\n ")})),AEe="return a * b;";function REe(e){var t,n=e.inputs,r=e.backend,a=n.a,i=n.b,o=h5(a.dtype,i.dtype);if("complex64"===a.dtype){var s=r.texData.get(a.dataId),u=r.texData.get(i.dataId),c=new CEe(TEe,a.shape,i.shape),l=new CEe(EEe,a.shape,i.shape),h=[{dataId:s.complexTensorInfos.real.dataId,dtype:s.complexTensorInfos.real.dtype,shape:a.shape},{dataId:s.complexTensorInfos.imag.dataId,dtype:s.complexTensorInfos.imag.dtype,shape:a.shape},{dataId:u.complexTensorInfos.real.dataId,dtype:u.complexTensorInfos.real.dtype,shape:i.shape},{dataId:u.complexTensorInfos.imag.dataId,dtype:u.complexTensorInfos.imag.dtype,shape:i.shape}],p=r.runWebGLProgram(c,h,"float32"),f=r.runWebGLProgram(l,h,"float32"),d=dEe({inputs:{real:p,imag:f},backend:r});return r.disposeIntermediateTensorInfo(p),r.disposeIntermediateTensorInfo(f),d}if(r.shouldExecuteOnCPU([a,i])){var v=r.texData.get(a.dataId),m=r.texData.get(i.dataId),g=S(iTe(a.shape,i.shape,v.values,m.values,o),2),y=g[0],b=g[1],x=r.makeTensorInfo(b,o);return r.texData.get(x.dataId).values=y,x}return t=k0().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new hEe(AEe,a.shape,i.shape):new cEe(AEe,a.shape,i.shape),r.runWebGLProgram(t,[a,i],o)}var _Ee={kernelName:g2,backendName:"webgl",kernelFunc:REe};function OEe(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.shape,o=n,s=L$(a.shape),u=G$(i,s),c=L$(u);F$(s===c,(function(){return"The new shape (".concat(u,") has ").concat(c," elements and the old ")+"shape (".concat(a.shape,") has ").concat(s," elements. The new shape and old ")+"shape must have the same number of elements."}));var l=o.texData.get(a.dataId);return!l.isPacked||pNe(a.shape,u)||null!==l.texture&&pNe(l.shape,u)?(o.incRef(a.dataId),{dataId:a.dataId,shape:u,dtype:a.dtype}):function(e,t,n){var r=[sNe(e.shape)].concat(T(uNe(e.shape))),a={dtype:e.dtype,shape:r,dataId:e.dataId},i=[sNe(t)].concat(T(uNe(t))),o=new MTe(i,r),s=[r],u=n.runWebGLProgram(o,[a],e.dtype,s,!0);return{dataId:u.dataId,shape:t,dtype:u.dtype}}(a,u,o)}var FEe={kernelName:z2,backendName:"webgl",kernelFunc:OEe},DEe=p((function e(t,n){l(this,e),this.variableNames=["x"];var r=t.windowSize,a=t.batchSize,i=t.inSize,o=t.outSize;this.outputShape=[a,o];var s=4*Math.floor(r/4),u=r%4,c="sumValue += dot(values, ones);";if(null!=n){var h=1/n;c="sumValue += dot(values * ".concat(B$(h)?h.toPrecision(2):h,", ones);")}var p="";i%r>0&&(p="\n if (inIdx < 0 || inIdx >= ".concat(i,") {\n return 0.0;\n }\n ")),this.userCode="\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n ".concat(p,"\n return getX(batch, inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * ").concat(r,";\n\n float sumValue = 0.0;\n\n for (int i = 0; i < ").concat(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 ").concat(c,"\n }\n\n int inIdx = inOffset + ").concat(s,";\n if (").concat(1===u,") {\n vec4 values = vec4(getValue(batch, inIdx), 0.0, 0.0, 0.0);\n\n ").concat(c,"\n } else if (").concat(2===u,") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1), 0.0, 0.0);\n\n ").concat(c,"\n } else if (").concat(3===u,") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2), 0.0);\n\n ").concat(c,"\n }\n setOutput(sumValue);\n }\n ")})),MEe=p((function e(t,n){l(this,e),this.variableNames=["x"];var r=t.windowSize,a=t.batchSize,i=t.inSize,o=t.outSize;this.outputShape=[a,o];var s="0.0",u="";"prod"===n?s="1.0":"min"===n?(s="1.0 / 1e-20",u="min"):"max"===n&&(s="-1.0 / 1e-20",u="max");var c="".concat(n,"(").concat(n,"(").concat(n,"(")+"minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"sum"===n?c="sumValue":"prod"===n?c="prodValue":"all"===n?c="allValue":"any"===n&&(c="anyValue");var h=4*Math.floor(r/4),p=r%4,f="\n if (".concat("sum"===n,") {\n sumValue += dot(values, ones);\n } else if (").concat("prod"===n,") {\n vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);\n prodValue *= tmp[0] * tmp[1];\n } else {\n minMaxValue = ").concat(u,"(values, minMaxValue);\n if (").concat("min"===n," || ").concat("max"===n,") {\n minMaxValue = ").concat(u,"(values, minMaxValue);\n bvec4 isNaN = isnan(values);\n if (isNaN.r || isNaN.g || isNaN.b || isNaN.a) {\n minMaxValue = vec4(NAN);\n }\n }\n }\n "),d="vec4";"all"===n?(s="1.0",f="\n bool reducedAllValue = all(values);\n float floatedReducedAllValue = float(reducedAllValue);\n allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);\n ",d="bvec4"):"any"===n&&(s="0.0",f="\n bool reducedAnyValue = any(values);\n float floatedReducedAnyValue = float(reducedAnyValue);\n anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);\n ",d="bvec4");var v="";i%r>0&&(v="\n if (inIdx < 0 || inIdx >= ".concat(i,") {\n return initializationValue;\n }\n ")),this.userCode="\n const float initializationValue = ".concat(s,";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n ").concat(v,"\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 * ").concat(r,";\n\n vec4 minMaxValue = vec4(").concat(s,");\n float prodValue = 1.0;\n float sumValue = 0.0;\n float allValue = 1.0;\n float anyValue = 0.0;\n\n for (int i = 0; i < ").concat(h,"; i += 4) {\n int inIdx = inOffset + i;\n ").concat(d," values = ").concat(d,"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n ").concat(f,"\n }\n\n int inIdx = inOffset + ").concat(h,";\n if (").concat(1===p,") {\n ").concat(d," values = ").concat(d,"(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ").concat(f,"\n } else if (").concat(2===p,") {\n ").concat(d," values = ").concat(d,"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n ").concat(f,"\n } else if (").concat(3===p,") {\n ").concat(d," values = ").concat(d,"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n ").concat(f,"\n }\n setOutput(").concat(c,");\n }\n ")}));function LEe(e,t,n,r){for(var a=function(e){for(var t=[];0===t.length||1!==t[t.length-1].outSize;){var n=t.length?t[t.length-1].outSize:e[1],r=$ae(n);t.push({inSize:n,windowSize:r,outSize:Math.ceil(n/r)})}return t}(e.shape),i=e,o=0;o<a.length;o++){var s,u=a[o],c=u.inSize,l=u.windowSize,h=u.outSize,p=void 0;p="mean"===n?0===o?new DEe({windowSize:l,inSize:c,batchSize:e.shape[0],outSize:h},c):new DEe({windowSize:l,inSize:c,batchSize:e.shape[0],outSize:h}):new MEe({windowSize:l,inSize:c,batchSize:e.shape[0],outSize:h},n),s=i,i=r.runWebGLProgram(p,[i],t),s.dataId!==e.dataId&&r.disposeIntermediateTensorInfo(s)}return i}var zEe=p((function e(t,n){l(this,e),this.variableNames=["A"];for(var r=new Array(t.length),a=0;a<r.length;a++)r[a]=t[n[a]];this.outputShape=r,this.rank=r.length;var i=JNe(this.rank),o=function(e){var t=e.length;if(t>6)throw Error("Transpose for rank ".concat(t," is not yet supported"));for(var n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],r=new Array(t),a=0;a<e.length;a++)r[e[a]]=n[a];return r.join()}(n);this.userCode="\n void main() {\n ".concat(i," resRC = getOutputCoords();\n setOutput(getA(").concat(o,"));\n }\n ")}));var PEe=p((function e(t,n){l(this,e),this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0;for(var r=new Array(t.length),a=0;a<r.length;a++)r[a]=t[n[a]];if(this.outputShape=r,this.rank=r.length,this.rank>6)throw Error("Packed transpose for rank ".concat(this.rank," is not yet supported."));for(var i=JNe(this.rank),o=OTe("rc",this.rank),s=new Array(this.rank),u=0;u<n.length;u++)s[n[u]]=o[u];var c="vec2(".concat(s.slice(-2).join(),")"),h="++".concat(o[this.rank-1]," < ").concat(r[this.rank-1]),p="getChannel(getA(".concat(s.join(),"), ").concat(c,")");this.userCode="\n void main() {\n ".concat(i," rc = getOutputCoords();\n vec4 result = vec4(0.);\n result[0] = ").concat(p,";\n if(").concat(h,") {\n result[1] = ").concat(p,";\n }\n --").concat(o[this.rank-1],";\n if(++").concat(o[this.rank-2]," < ").concat(r[this.rank-2],") {\n result[2] = ").concat(p,";\n if(").concat(h,") {\n result[3] = ").concat(p,";\n }\n }\n setOutput(result);\n }\n ")}));function BEe(e,t,n){var r=k0().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new PEe(e.shape,t):new zEe(e.shape,t);return n.runWebGLProgram(r,[e],e.dtype)}function WEe(e){var t=e.inputs,n=e.backend,r=e.attrs;return function(e,t,n,r){var a=t,i=e.shape.length,o=j$(a,e.shape),s=o,u=H7(s,i),c=null!=u,l=e;c&&(l=BEe(e,u,r),s=K7(s.length,i)),j7("sum",s,i);var h=S(U7(l.shape,s),2),p=h[0],f=h[1],d=p;n&&(d=G7(p,o));var v=L$(f),m=OEe({inputs:{x:l},attrs:{shape:[L$(e.shape)/v,v]},backend:r}),g=LEe(m,p5(e.dtype),"sum",r),y=OEe({inputs:{x:g},attrs:{shape:d},backend:r});return r.disposeIntermediateTensorInfo(m),r.disposeIntermediateTensorInfo(g),c&&r.disposeIntermediateTensorInfo(l),y}(t.x,r.axis,r.keepDims,n)}var VEe={kernelName:a3,backendName:"webgl",kernelFunc:WEe};function UEe(e){for(var t,n=e.inputs,r=e.backend,a=e.attrs,i=n.x,o=a.perm,s=r,u=i.shape.length,c=new Array(u),l=0;l<c.length;l++)c[l]=i.shape[o[l]];if(s.shouldExecuteOnCPU([i])){var h=s.texData.get(i.dataId).values,p=RTe(h,i.shape,i.dtype,o,c);t=s.makeTensorInfo(c,i.dtype),s.texData.get(t.dataId).values=p}else t=BEe(i,o,s);return t}var GEe={kernelName:T3,backendName:"webgl",kernelFunc:UEe};function jEe(e){var t=e.a,n=e.b,r=e.transposeA,a=e.transposeB,i=e.backend,o=e.bias,s=void 0===o?null:o,u=e.preluActivationWeights,c=void 0===u?null:u,l=e.leakyreluAlpha,h=void 0===l?0:l,p=e.activation,f=void 0===p?null:p,d=t.shape.length,v=n.shape.length,m=r?t.shape[d-2]:t.shape[d-1],g=a?n.shape[v-1]:n.shape[v-2],y=r?t.shape[d-1]:t.shape[d-2],b=a?n.shape[v-2]:n.shape[v-1],x=t.shape.slice(0,-2),k=n.shape.slice(0,-2),w=L$(x),I=L$(k),N=A7(t.shape.slice(0,-2),n.shape.slice(0,-2)).concat([y,b]);F$(m===g,(function(){return"Error in matMul: inner shapes (".concat(m,") and (")+"".concat(g,") of Tensors with shapes ").concat(t.shape," and ")+"".concat(n.shape," and transposeA=").concat(r)+" and transposeB=".concat(a," must match.")}));var S,T=r?[w,m,y]:[w,y,m],E=a?[I,b,g]:[I,g,b],C=OEe({inputs:{x:t},backend:i,attrs:{shape:T}}),A=OEe({inputs:{x:n},backend:i,attrs:{shape:E}}),R=[C,A],_=Math.max(w,I),O=r?C.shape[1]:C.shape[2],F=null!=s,D=null!=c,M="leakyrelu"===f,L=null!=f?NEe(f,!0):null;if((1===y||1===b)&&O>1e3&&!1===(F||D||M||null!=L)){var z=C,P=A;r&&(z=UEe({inputs:{x:C},backend:i,attrs:{perm:[0,2,1]}}),R.push(z)),a&&(P=UEe({inputs:{x:A},backend:i,attrs:{perm:[0,2,1]}}),R.push(P));var B=1===b,W=z;1!==b&&(W=OEe({inputs:{x:z},backend:i,attrs:{shape:[_,O,1]}}),R.push(W));var V=1===b?2:1,U=P;B&&(U=OEe({inputs:{x:P},backend:i,attrs:{shape:[_,1,O]}}),R.push(U));var G=REe({inputs:{a:W,b:U},backend:i});S=WEe({inputs:{x:G},backend:i,attrs:{axis:V,keepDims:!0}}),R.push(G)}else{var j=h5(t.dtype,n.dtype),H=new SEe(T,E,[_,y,b],r,a,F,L,D,M),q=[C,A];if(null!=s&&q.push(s),D&&q.push(c),M){var K=i.makeTensorInfo([],"float32",M4(h,"float32"));q.push(K),R.push(K)}S=i.runWebGLProgram(H,q,j)}var X=OEe({inputs:{x:S},backend:i,attrs:{shape:N}});R.push(S);for(var Y=0,J=R;Y<J.length;Y++){var Z=J[Y];i.disposeIntermediateTensorInfo(Z)}return X}var HEe={kernelName:D3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.a,i=t.b,o=t.bias,s=t.preluActivationWeights,u=r.transposeA,c=r.transposeB,l=r.activation;return jEe({a:a,b:i,transposeA:u,transposeB:c,backend:n,bias:o,preluActivationWeights:s,leakyreluAlpha:r.leakyreluAlpha,activation:l})}},qEe="return abs(x);";var KEe={kernelName:N0,backendName:"webgl",kernelFunc:function(e){var t,n=e.inputs,r=e.backend,a=n.x;if(r.shouldExecuteOnCPU([a])&&"complex64"!==a.dtype){var i=r.texData.get(a.dataId),o=mTe(i.values);return r.makeTensorInfo(a.shape,a.dtype,o)}return t=k0().getBool("WEBGL_PACK_UNARY_OPERATIONS")?new eEe(a.shape,qEe):new WTe(a.shape,qEe),r.runWebGLProgram(t,[a],a.dtype)}},XEe=wEe({opSnippet:"if (isnan(x)) return x;\n if (abs(x) > 1.) {\n return NAN;\n }\n return acos(x);\n"}),YEe={kernelName:S0,backendName:"webgl",kernelFunc:XEe},JEe=wEe({opSnippet:"if (isnan(x)) return x;\n if (x < 1.0) return NAN;\nreturn log(x + sqrt(x * x - 1.0));"}),ZEe={kernelName:T0,backendName:"webgl",kernelFunc:JEe},QEe="return a + b;",$Ee=IEe({opSnippet:QEe,packedOpSnippet:QEe,supportsComplex:!0,cpuKernelImpl:zSe}),eCe={kernelName:E0,backendName:"webgl",kernelFunc:$Ee},tCe=p((function e(t,n){l(this,e),this.outputShape=[],this.outputShape=t,this.variableNames=n.map((function(e,t){return"T".concat(t)}));var r=[];this.variableNames.forEach((function(e){r.push("float v".concat(e," = get").concat(e,"AtOutCoords();"))}));var a=this.variableNames.map((function(e){return"v".concat(e)})).join(" + ");this.userCode="\n void main() {\n ".concat(r.join("\n "),"\n\n float result = ").concat(a,";\n setOutput(result);\n }\n ")})),nCe=p((function e(t,n){l(this,e),this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t,this.variableNames=n.map((function(e,t){return"T".concat(t)}));var r=[];this.variableNames.forEach((function(e){r.push("vec4 v".concat(e," = get").concat(e,"AtOutCoords();"))}));var a=this.variableNames.map((function(e){return"v".concat(e)})).join(" + ");this.userCode="\n void main() {\n ".concat(r.join("\n "),"\n\n vec4 result = ").concat(a,";\n setOutput(result);\n }\n ")}));var rCe={kernelName:C0,backendName:"webgl",kernelFunc:function e(t){var n=t.inputs,r=t.backend,a=n;if(1===a.length)return pEe({inputs:{x:a[0]},backend:r});if(a.length>k0().get("WEBGL_MAX_TEXTURES_IN_SHADER")){var i=Math.floor(a.length/2),o=e({inputs:a.slice(0,i),backend:r}),s=e({inputs:a.slice(i),backend:r});return e({inputs:[o,s],backend:r})}var u=a.map((function(e){return e.dtype})).reduce((function(e,t){return h5(e,t)})),c=a.map((function(e){return e.shape})),l=k0().getBool("WEBGL_PACK")?new nCe(a[0].shape,c):new tCe(a[0].shape,c);return r.runWebGLProgram(l,a,u)}};var aCe={kernelName:A0,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.axis,o=r.keepDims,s=a.shape.length,u=j$(i,a.shape),c=u,l=H7(c,s),h=a;null!=l&&(h=UEe({inputs:{x:a},backend:n,attrs:{perm:l}}),c=K7(c.length,s)),j7("all",c,s);var p,f=S(U7(h.shape,c),2),d=f[0],v=OEe({inputs:{x:h},backend:n,attrs:{shape:[-1,L$(f[1])]}}),m=LEe(v,v.dtype,"all",n);return p=OEe(o?{inputs:{x:m},backend:n,attrs:{shape:G7(d,u)}}:{inputs:{x:m},backend:n,attrs:{shape:d}}),n.disposeIntermediateTensorInfo(v),n.disposeIntermediateTensorInfo(m),null!=l&&n.disposeIntermediateTensorInfo(h),p}};var iCe={kernelName:R0,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.axis,o=r.keepDims,s=a.shape.length,u=j$(i,a.shape),c=u,l=H7(c,s),h=a;null!=l&&(h=UEe({inputs:{x:a},backend:n,attrs:{perm:l}}),c=K7(c.length,s)),j7("any",c,s);var p,f=S(U7(h.shape,c),2),d=f[0],v=OEe({inputs:{x:h},backend:n,attrs:{shape:[-1,L$(f[1])]}}),m=LEe(v,v.dtype,"any",n);return p=OEe(o?{inputs:{x:m},backend:n,attrs:{shape:G7(d,u)}}:{inputs:{x:m},backend:n,attrs:{shape:d}}),n.disposeIntermediateTensorInfo(v),n.disposeIntermediateTensorInfo(m),null!=l&&n.disposeIntermediateTensorInfo(h),p}},oCe=p((function e(t,n,r){l(this,e),this.variableNames=["A"];var a=t.windowSize,i=t.batchSize,o=t.outSize;r||this.variableNames.push("bestIndicesA"),this.outputShape=[i,o];var s="max"===n?">":"<",u=r?"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 * ".concat(a,";\n\n int bestIndex = inOffset;\n float bestValue = getA(batch, bestIndex);\n\n for (int i = 0; i < ").concat(a,"; i++) {\n int inIdx = ").concat(u,";\n float candidate = getA(batch, inIdx);\n if (candidate ").concat(s," bestValue) {\n bestValue = candidate;\n bestIndex = inIdx;\n }\n }\n setOutput(float(bestIndex));\n }\n ")})),sCe=p((function e(t,n,r,a){l(this,e),this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,F$(t.length>2,(function(){return"Packed arg".concat(r.charAt(0).toUpperCase()+r.slice(1)," supports only inputs with rank above 2.")}));var i=t[t.length-1],o=Math.ceil(i/n);this.outputShape=t.slice(0,-1),o>1&&this.outputShape.push(o),a||this.variableNames.push("bestIndicesA");var s,u,c=this.outputShape,h=c.length,p=JNe(h),f=FTe("coords",h);if(1===o){var d=JNe(u=h+1);s="\n ".concat(d," sourceLocR = ").concat(d,"(").concat(f.join(),", 0);\n ++").concat(f[h-1],";\n ").concat(d," sourceLocG = ").concat(d,"(").concat(f.join(),", 0);\n ++").concat(f[h-2],";\n ").concat(d," sourceLocA = ").concat(d,"(").concat(f.join(),", 0);\n --").concat(f[h-1],";\n ").concat(d," sourceLocB = ").concat(d,"(").concat(f.join(),", 0);\n --").concat(f[h-2],";")}else u=h,s="\n ".concat(p," sourceLocR = coords;\n ++").concat(f[h-1],";\n ").concat(p," sourceLocG = coords;\n ++").concat(f[h-2],";\n ").concat(p," sourceLocA = coords;\n --").concat(f[h-1],";\n ").concat(p," sourceLocB = coords;\n --").concat(f[h-2],";");var v=["x","y","z","w","u","v"].slice(0,u),m="."+v[u-1],g=v.map((function(e){return"int "+e})),y=FTe("sourceLocR",u-1).concat("inIdx.r"),b=FTe("sourceLocG",u-1).concat("inIdx.g"),x=FTe("sourceLocB",u-1).concat("inIdx.b"),k=FTe("sourceLocA",u-1).concat("inIdx.a"),w="max"===r?"greaterThan":"lessThan",I=a?"":"\n inIdx = round(vec4(getBestIndicesAChannel(".concat(y.join(),"),\n getBestIndicesAChannel(").concat(b.join(),"),\n getBestIndicesAChannel(").concat(x.join(),"),\n getBestIndicesAChannel(").concat(k.join(),")));"),N="vec4(\n getAChannel(".concat(y.join(),"),\n hasNextCol ? getAChannel(").concat(b.join(),") : 0.,\n hasNextRow ? getAChannel(").concat(x.join(),") : 0.,\n hasNextRow && hasNextCol ? getAChannel(").concat(k.join(),") : 0.)"),S=a?"":"\n float getBestIndicesAChannel(".concat(g.join(),") {\n return getChannel(getBestIndicesA(").concat(v.join(),"),\n vec2(").concat(v.slice(-2).join(),"));\n }");this.userCode="\n float getAChannel(".concat(g.join(),") {\n return getChannel(getA(").concat(v.join(),"),\n vec2(").concat(v.slice(-2).join(),"));\n }\n ").concat(S,"\n void main() {\n ").concat(p," coords = getOutputCoords();\n bool hasNextCol = ").concat(f[h-1]," < ").concat(c[h-1]-1,";\n bool hasNextRow = ").concat(f[h-2]," < ").concat(c[h-2]-1,";\n ").concat(s,"\n ivec4 srcIdx = ivec4(sourceLocR").concat(m,", sourceLocG").concat(m,",\n sourceLocB").concat(m,", sourceLocA").concat(m,") * ").concat(n,";\n ivec4 inIdx = srcIdx;\n vec4 bestIndex = vec4(inIdx);\n vec4 bestValue = ").concat(N,";\n\n for (int i = 0; i < ").concat(n,"; i++) {\n inIdx = srcIdx;\n ").concat(I,"\n vec4 candidate = ").concat(N,";\n bvec4 nan = isnan(candidate);\n bvec4 replace = bvec4(\n vec4(").concat(w,"(candidate, bestValue)) * (vec4(1.0) - vec4(nan)));\n\n bestValue = vec4(replace.x ? candidate.x : bestValue.x,\n replace.y ? candidate.y : bestValue.y,\n replace.z ? candidate.z : bestValue.z,\n replace.w ? candidate.w : bestValue.w);\n bestIndex = mix(bestIndex, vec4(inIdx), vec4(replace));\n srcIdx++;\n }\n setOutput(bestIndex);\n }\n ")}));function uCe(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=t.shape[0],i=t.shape[1];null!=r&&(a=r.shape[0],i=r.shape[1]);var o=$ae(i),s={windowSize:o,inSize:i,batchSize:a,outSize:Math.ceil(i/o)},u=new oCe(s,n,null==r),c=[t];null!=r&&c.push(r);var l=e.runWebGLProgram(u,c,"int32");if(1===l.shape[1])return l;var h=uCe(e,t,n,l);return e.disposeIntermediateTensorInfo(l),h}function cCe(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=null!=r?r.shape:t.shape,i=a[a.length-1],o=$ae(i),s=new sCe(a,o,n,null==r),u=null==r?[t]:[t,r],c=e.runWebGLProgram(s,u,"int32");if(c.shape.length===t.shape.length){var l=cCe(e,t,n,c);return e.disposeIntermediateTensorInfo(c),l}return c}function lCe(e,t,n,r){var a=[n];if(j7("arg"+r.charAt(0).toUpperCase()+r.slice(1),a,t.shape.length),!k0().getBool("WEBGL_PACK_REDUCE")||t.shape.length<=2){var i=[],o=e.texData.get(t.dataId),s=t;null!==o&&o.isPacked&&(s=e.unpackTensor(t),i.push(s));var u=S(U7(s.shape,a),2),c=u[0],l=L$(u[1]),h=OEe({inputs:{x:s},backend:e,attrs:{shape:[-1,l]}});i.push(h);var p=uCe(e,h,r);i.push(p);var f=OEe({inputs:{x:p},backend:e,attrs:{shape:c}});return i.forEach((function(t){return e.disposeIntermediateTensorInfo(t)})),f}return cCe(e,t,r)}var hCe={kernelName:_0,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=j$(r.axis,a.shape),o=H7(i,a.shape.length),s=a,u=[];null!=o&&(s=UEe({inputs:{x:a},backend:n,attrs:{perm:o}}),u.push(s),i=K7(i.length,s.shape.length)),j7("argMax",[i[0]],s.shape.length);var c=lCe(n,s,i[0],"max");return u.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),c}};var pCe={kernelName:O0,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=j$(r.axis,a.shape),o=H7(i,a.shape.length),s=a,u=[];null!=o&&(s=UEe({inputs:{x:a},backend:n,attrs:{perm:o}}),u.push(s),i=K7(i.length,s.shape.length)),j7("argMin",[i[0]],s.shape.length);var c=lCe(n,s,i[0],"min");return u.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),c}},fCe=wEe({opSnippet:"if (isnan(x)) return x;\n if (abs(x) > 1.) {\n return NAN;\n }\n return asin(x);\n"}),dCe={kernelName:F0,backendName:"webgl",kernelFunc:fCe},vCe=wEe({opSnippet:"if (isnan(x)) return x;return log(x + sqrt(x * x + 1.0));"}),mCe={kernelName:D0,backendName:"webgl",kernelFunc:vCe},gCe=wEe({opSnippet:"if (isnan(x)) return x;\n return atan(x);\n"}),yCe={kernelName:M0,backendName:"webgl",kernelFunc:gCe},bCe=IEe({opSnippet:"\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return atan(a, b);\n",packedOpSnippet:"\n vec4 result = atan(a, b);\n bvec4 isNaNA = isnan(a);\n bvec4 isNaNB = isnan(b);\n bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n \n result.r = isNaN.r ? NAN : result.r;\n result.g = isNaN.g ? NAN : result.g;\n result.b = isNaN.b ? NAN : result.b;\n result.a = isNaN.a ? NAN : result.a;\n\n return result;\n"}),xCe={kernelName:z0,backendName:"webgl",kernelFunc:bCe},kCe=wEe({opSnippet:"if (isnan(x)) return x;\n if ((x < -1.0) || (x > 1.0)) return NAN;\nreturn (log(1.0 + x) - log(1.0 - x)) / 2.0;"}),wCe={kernelName:L0,backendName:"webgl",kernelFunc:kCe},ICe=p((function e(t,n,r){var a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(l(this,e),this.variableNames=["x"],"avg"===n&&r)throw new Error("Cannot compute positions for average pool.");var o=t.filterWidth,s=t.strideHeight,u=t.strideWidth,c=t.dilationHeight,h=t.dilationWidth,p=t.effectiveFilterHeight,f=t.effectiveFilterWidth,d=t.padInfo.top,v=t.padInfo.left;this.outputShape=t.outShape;var m="avg"===n,g="((batch * ".concat(t.inHeight," + xR) * ").concat(t.inWidth," + xC) * ").concat(t.inChannels," + d"),y="(xR * ".concat(t.inWidth," + xC) * ").concat(t.inChannels," + d"),b="0.0";if(m||(b="-1.0 / 1e-20"),r){var x=">=";this.userCode="\n const ivec2 strides = ivec2(".concat(s,", ").concat(u,");\n const ivec2 pads = ivec2(").concat(d,", ").concat(v,");\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 < ").concat(p,";\n wR += ").concat(c,") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ").concat(t.inHeight,") {\n continue;\n }\n\n for (int wC = 0; wC < ").concat(f,";\n wC += ").concat(h,") {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= ").concat(t.inWidth,") {\n continue;\n }\n\n float value = getX(batch, xR, xC, d);\n\n // If a min / max value has already been found, use it. If not,\n // use the current value.\n float currMinMaxValue = mix(\n value, minMaxValue, minMaxValueFound);\n if (value ").concat(x," currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = ").concat(a?i?g:y:"wR * ".concat(f," + wC"),";\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n ")}else{var k="max",w="".concat(n,"(").concat(n,"(").concat(n,"(")+"minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"avg"===n&&(w="avgValue / max(count, 1.0)");var I=4*Math.floor(o/4),N=o%4,S="\n if (".concat(m,") {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = ").concat(k,"(values, minMaxValue);\n }\n ");this.userCode="\n const ivec2 strides = ivec2(".concat(s,", ").concat(u,");\n const ivec2 pads = ivec2(").concat(d,", ").concat(v,");\n const float initializationValue = ").concat(b,";\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 >= ").concat(t.inWidth,") {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xR, xC, d);\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n vec4 minMaxValue = vec4(").concat(b,");\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wR = 0; wR < ").concat(p,";\n wR += ").concat(c,") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ").concat(t.inHeight,") {\n continue;\n }\n\n for (int wC = 0; wC < ").concat(I,"; wC += 4) {\n int xC = xCCorner + wC * ").concat(h,";\n\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ").concat(h,", d),\n getValue(batch, xR, xC + 2 * ").concat(h,", d),\n getValue(batch, xR, xC + 3 * ").concat(h,", d)\n );\n\n ").concat(S,"\n }\n\n int xC = xCCorner + ").concat(I,";\n if (").concat(1===N,") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ").concat(S,"\n } else if (").concat(2===N,") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ").concat(h,", d),\n initializationValue,\n initializationValue\n );\n\n ").concat(S,"\n } else if (").concat(3===N,") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + ").concat(h,", d),\n getValue(batch, xR, xC + 2 * ").concat(h,", d),\n initializationValue\n );\n\n ").concat(S,"\n }\n }\n setOutput(").concat(w,");\n }\n ")}})),NCe=p((function e(t,n,r){var a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(l(this,e),this.variableNames=["x"],"avg"===n&&r)throw new Error("Cannot compute positions for average pool.");var o=t.filterWidth,s=t.strideDepth,u=t.strideHeight,c=t.strideWidth,h=t.dilationDepth,p=t.dilationHeight,f=t.dilationWidth,d=t.effectiveFilterDepth,v=t.effectiveFilterHeight,m=t.effectiveFilterWidth,g=t.padInfo.front,y=t.padInfo.top,b=t.padInfo.left;this.outputShape=t.outShape;var x="avg"===n,k="0.0";if(x||(k="-1.0 / 1e-20"),r){var w=">=";this.userCode="\n const ivec3 strides =\n ivec3(".concat(s,", ").concat(u,", ").concat(c,");\n const ivec3 pads = ivec3(").concat(g,", ").concat(y,", ").concat(b,");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xDCorner = xCorner.x;\n int xRCorner = xCorner.y;\n int xCCorner = xCorner.z;\n\n // max/min x(?, ?, ?, ch) to get y(yD, yR, yC, ch).\n // ? = to be determined\n float minMaxValue = 0.0;\n float minMaxValueFound = 0.0;\n int minMaxPosition = 0;\n\n for (int wD = 0; wD < ").concat(d,";\n wD += ").concat(h,") {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= ").concat(t.inDepth,") {\n continue;\n }\n\n for (int wR = 0; wR < ").concat(v,";\n wR += ").concat(p,") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ").concat(t.inHeight,") {\n continue;\n }\n\n for (int wC = 0; wC < ").concat(m,";\n wC += ").concat(f,") {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= ").concat(t.inWidth,") {\n continue;\n }\n\n float value = getX(batch, xD, xR, xC, ch);\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 ").concat(w," currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = ").concat(a?i?"(((batch * ".concat(t.inDepth," + xD) * ").concat(t.inHeight," + xR) * ").concat(t.inWidth," + xC) * ").concat(t.inChannels," + ch"):"((xD * ".concat(t.inHeight," + xR) * ").concat(t.inWidth," + xC) * ").concat(t.inChannels," + ch"):"wD * ".concat(v," * ").concat(m," +\n wR * ").concat(m," + wC"),";\n }\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n ")}else{var I="max",N="".concat(n,"(").concat(n,"(").concat(n,"(")+"minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"avg"===n&&(N="avgValue / max(count, 1.0)");var S=4*Math.floor(o/4),T=o%4,E="\n if (".concat(x,") {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = ").concat(I,"(values, minMaxValue);\n }\n ");this.userCode="\n const ivec3 strides =\n ivec3(".concat(s,", ").concat(u,", ").concat(c,");\n const ivec3 pads = ivec3(").concat(g,", ").concat(y,", ").concat(b,");\n const float initializationValue = ").concat(k,";\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 xD, int xR, int xC, int ch) {\n if (xC < 0 || xC >= ").concat(t.inWidth,") {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xD, xR, xC, ch);\n }\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xDCorner = xCorner.x;\n int xRCorner = xCorner.y;\n int xCCorner = xCorner.z;\n\n // max/min x(?, ?, ?, d) to get y(yD, yR, yC, ch).\n // ? = to be determined\n vec4 minMaxValue = vec4(").concat(k,");\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wD = 0; wD < ").concat(d,";\n wD += ").concat(h,") {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= ").concat(t.inDepth,") {\n continue;\n }\n\n for (int wR = 0; wR < ").concat(v,";\n wR += ").concat(p,") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= ").concat(t.inHeight,") {\n continue;\n }\n\n for (int wC = 0; wC < ").concat(S,"; wC += 4) {\n int xC = xCCorner + wC * ").concat(f,";\n\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ").concat(f,", ch),\n getValue(batch, xD, xR, xC + 2 * ").concat(f,", ch),\n getValue(batch, xD, xR, xC + 3 * ").concat(f,", ch)\n );\n\n ").concat(E,"\n }\n\n int xC = xCCorner + ").concat(S,";\n if (").concat(1===T,") {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n ").concat(E,"\n } else if (").concat(2===T,") {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ").concat(f,", ch),\n initializationValue,\n initializationValue\n );\n\n ").concat(E,"\n } else if (").concat(3===T,") {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + ").concat(f,", ch),\n getValue(batch, xD, xR, xC + 2 * ").concat(f,", ch),\n initializationValue\n );\n\n ").concat(E,"\n }\n }\n }\n setOutput(").concat(N,");\n }\n ")}}));var SCe={kernelName:P0,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x;wNe(a,"avgPool");var i=r.filterSize,o=r.strides,s=r.pad,u=r.dimRoundingMode;F$(L8(o,1),(function(){return"Error in avgPool: Either strides or dilations must be 1. "+"Got strides ".concat(o," and dilations '").concat(1,"'")}));var c=N8(a.shape,i,o,1,s,u);if(1===c.filterWidth&&1===c.filterHeight&&P$(c.inShape,c.outShape))return pEe({inputs:{x:a},backend:n});var l=new ICe(c,"avg",!1);return n.runWebGLProgram(l,[a],"float32")}};var TCe={kernelName:W0,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.filterSize,o=r.strides,s=r.pad,u=r.dimRoundingMode,c=r.dataFormat,l=S8(a.shape,i,o,[1,1,1],s,u,c),h=new NCe(l,"avg",!1);return n.runWebGLProgram(h,[a],"float32")}},ECe=p((function e(t){l(this,e),this.variableNames=["dy"],this.outputShape=t.inShape;var n=t.filterHeight,r=t.filterWidth,a=t.strideHeight,i=t.strideWidth,o=t.dilationHeight,s=t.dilationWidth,u=t.effectiveFilterHeight,c=t.effectiveFilterWidth,h=u-1-t.padInfo.top,p=c-1-t.padInfo.left,f=1/(n*r);this.userCode="\n const ivec2 pads = ivec2(".concat(h,", ").concat(p,");\n const float avgMultiplier = float(").concat(f,");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < ").concat(u,";\n wR += ").concat(o,") {\n float dyR = float(dyRCorner + wR) / ").concat(a,".0;\n\n if (dyR < 0.0 || dyR >= ").concat(t.outHeight,".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ").concat(c,";\n wC+= ").concat(s,") {\n float dyC = float(dyCCorner + wC) / ").concat(i,".0;\n\n if (dyC < 0.0 || dyC >= ").concat(t.outWidth,".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n setOutput(dotProd);\n }\n ")})),CCe=p((function e(t){l(this,e),this.variableNames=["dy"],this.outputShape=t.inShape;var n=t.filterDepth,r=t.filterHeight,a=t.filterWidth,i=t.strideDepth,o=t.strideHeight,s=t.strideWidth,u=t.dilationDepth,c=t.dilationHeight,h=t.dilationWidth,p=t.effectiveFilterDepth,f=t.effectiveFilterHeight,d=t.effectiveFilterWidth,v=p-1-t.padInfo.front,m=f-1-t.padInfo.top,g=d-1-t.padInfo.left,y=1/(n*r*a);this.userCode="\n const ivec3 pads = ivec3(".concat(v,", ").concat(m,", ").concat(g,");\n const float avgMultiplier = float(").concat(y,");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyDCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n // Convolve dy(?, ?, ?, d) with pos mask(:, :, :, ch) to get\n // dx(xD, xR, xC, ch).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int wD = 0; wD < ").concat(p,";\n wD += ").concat(u,") {\n float dyD = float(dyDCorner + wD) / ").concat(i,".0;\n\n if (dyD < 0.0 || dyD >= ").concat(t.outDepth,".0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < ").concat(f,";\n wR += ").concat(c,") {\n float dyR = float(dyRCorner + wR) / ").concat(o,".0;\n\n if (dyR < 0.0 || dyR >= ").concat(t.outHeight,".0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ").concat(d,";\n wC += ").concat(h,") {\n float dyC = float(dyCCorner + wC) / ").concat(s,".0;\n\n if (dyC < 0.0 || dyC >= ").concat(t.outWidth,".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n }\n setOutput(dotProd);\n }\n ")}));var ACe={kernelName:V0,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.dy,i=t.input,o=r.filterSize,s=r.strides,u=r.pad,c=r.dimRoundingMode,l=S8(i.shape,o,s,[1,1,1],u,c),h=new CCe(l);return n.runWebGLProgram(h,[a],i.dtype)}};var RCe={kernelName:B0,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.dy,i=t.input,o=i;wNe([a,i],"avgPoolGrad");var s=r.filterSize,u=r.strides,c=r.pad,l=N8(o.shape,s,u,1,c),h=new ECe(l);return n.runWebGLProgram(h,[a],o.dtype)}};var _Ce={kernelName:U0,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs;return jEe({a:t.a,b:t.b,transposeA:r.transposeA,transposeB:r.transposeB,backend:n})}},OCe=p((function e(t,n,r,a,i,o){l(this,e),this.outputShape=[],this.variableNames=["x","mean","variance"],A7(t,n),A7(t,r);var s="0.0";null!=a&&(A7(t,a),this.variableNames.push("offset"),s="getOffsetAtOutCoords()");var u="1.0";null!=i&&(A7(t,i),this.variableNames.push("scale"),u="getScaleAtOutCoords()"),this.outputShape=t,this.userCode="\n void main() {\n float x = getXAtOutCoords();\n float mean = getMeanAtOutCoords();\n float variance = getVarianceAtOutCoords();\n float offset = ".concat(s,";\n float scale = ").concat(u,";\n float inv = scale * inversesqrt(variance + float(").concat(o,"));\n setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));\n }\n ")})),FCe=p((function e(t,n,r,a,i,o){l(this,e),this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],A7(t,n),A7(t,r);var s="vec4(0.0)";null!=a&&(A7(t,a),this.variableNames.push("offset"),s="getOffsetAtOutCoords()");var u="vec4(1.0)";null!=i&&(A7(t,i),this.variableNames.push("scale"),u="getScaleAtOutCoords()"),this.outputShape=t,this.userCode="\n void main() {\n vec4 offset = ".concat(s,";\n vec4 scale = ").concat(u,";\n\n vec4 x = getXAtOutCoords();\n vec4 mean = getMeanAtOutCoords();\n vec4 variance = getVarianceAtOutCoords();\n\n vec4 inv = scale * inversesqrt(variance + vec4(").concat(o,"));\n\n setOutput((x - mean) * inv + offset);\n }\n ")})),DCe={kernelName:M1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.mean,o=t.variance,s=t.offset,u=t.scale;F$(i.shape.length===o.shape.length,(function(){return"Batch normalization gradient requires mean and variance to have equal ranks."})),F$(null==s||i.shape.length===s.shape.length,(function(){return"Batch normalization gradient requires mean and offset to have equal ranks."})),F$(null==u||i.shape.length===u.shape.length,(function(){return"Batch normalization gradient requires mean and scale to have equal ranks."}));var c=r.varianceEpsilon;null==c&&(c=.001);var l=[a,i,o],h=null;null!=s&&(h=s.shape,l.push(s));var p=null;null!=u&&(p=u.shape,l.push(u));var f=k0().getBool("WEBGL_PACK_NORMALIZATION")?new FCe(a.shape,i.shape,o.shape,h,p,c):new OCe(a.shape,i.shape,o.shape,h,p,c);return n.runWebGLProgram(f,l,l[0].dtype)}},MCe=p((function e(t){l(this,e),this.variableNames=["source"],this.outputShape=t,this.rank=t.length;var n=JNe(this.rank);this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];var r,a=function(e){if(1===e)return"sourceLoc";if(e<=6)return LCe.slice(0,e).map((function(e){return"sourceLoc."+e})).join(",");throw Error("Slicing for rank ".concat(e," is not yet supported"))}(this.rank),i=t.map((function(e,t){return"sourceLoc.".concat(LCe[t]," = start[").concat(t,"] + coords.").concat(LCe[t],";")}));r="\n ".concat(n," sourceLoc;\n ").concat(n," coords = getOutputCoords();\n ").concat(i.join("\n"),"\n "),this.userCode="\n void main() {\n ".concat(r,"\n setOutput(getSource(").concat(a,"));\n }\n ")})),LCe=["x","y","z","w","u","v"];var zCe=p((function e(t){l(this,e),this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t,this.rank=t.length,this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];var n=JNe(this.rank),r=FTe("coords",this.rank),a=FTe("sourceLoc",this.rank),i=1===this.rank?"sourceLoc":"vec2(".concat(a.slice(-2).join(),")"),o="getChannel(getSource(".concat(a.join(),"), ").concat(i,")"),s="\n result.x = ".concat(o,";\n if (++").concat(r[this.rank-1]," < ").concat(t[this.rank-1],") {\n ++").concat(a[this.rank-1],";\n result.y = ").concat(o,";\n --").concat(a[this.rank-1],";\n }\n "),u=1===this.rank?"":"\n --".concat(r[this.rank-1],";\n if (++").concat(r[this.rank-2]," < ").concat(t[this.rank-2],") {\n ++").concat(a[this.rank-2],";\n result.z = ").concat(o,";\n if (++").concat(r[this.rank-1]," < ").concat(t[this.rank-1],") {\n ++").concat(a[this.rank-1],";\n result.w = ").concat(o,";\n }\n }\n "),c=this.rank<=4?"sourceLoc = coords +\n ".concat(n,"(").concat(t.map((function(e,t){return"start[".concat(t,"]")})).join(),");"):t.map((function(e,t){return"".concat(a[t]," = ").concat(r[t]," + start[").concat(t,"];")})).join("\n");this.userCode="\n void main() {\n ".concat(n," coords = getOutputCoords();\n ").concat(n," sourceLoc;\n ").concat(c,"\n vec4 result = vec4(0.);\n ").concat(s,"\n ").concat(u,"\n setOutput(result);\n }\n ")}));function PCe(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=S(zae(a,r.begin,r.size),2),o=i[0],s=i[1];if(Sae(a,o,s),0===L$(s))return n.makeTensorInfo(s,a.dtype,[]);if(n.shouldExecuteOnCPU([a])||"string"===a.dtype){var u=n.texData.get(a.dataId),c=gTe(u.values,o,s,a.shape,a.dtype);return n.makeTensorInfo(s,a.dtype,c)}var l=n.texData.get(a.dataId).isPacked,h=Mae(a.shape,o,s);if(l||!h){var p=k0().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new zCe(s):new MCe(s),f=[o];return n.runWebGLProgram(p,[a],a.dtype,f)}return n.uploadToGPU(a.dataId),function(e,t,n,r){var a=r.texData.get(e.dataId),i=r.makeTensorInfo(n,e.dtype),o=r.texData.get(i.dataId);Object.assign(o,a),o.refCount=1,o.shape=n,o.dtype=e.dtype;var s=Lae(t,i0(e.shape));a.slice&&(s+=a.slice.flatOffset),o.slice={flatOffset:s,origDataId:a.slice&&a.slice.origDataId||e.dataId};var u=r.dataRefCount.get(o.slice.origDataId)||1;return r.dataRefCount.set(o.slice.origDataId,u+1),i}(a,o,s,n)}var BCe={kernelName:Z2,backendName:"webgl",kernelFunc:PCe},WCe={kernelName:G0,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.blockShape,o=r.crops;F$(a.shape.length<=4,(function(){return"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet"}));var s=i.reduce((function(e,t){return e*t})),u=tie(a.shape,i,s),c=nie(u.length,i.length),l=rie(a.shape,i,s),h=aie(o,i.length),p=iie(l,o,i.length),f=[],d=OEe({inputs:{x:a},backend:n,attrs:{shape:u}}),v=UEe({inputs:{x:d},backend:n,attrs:{perm:c}}),m=OEe({inputs:{x:v},backend:n,attrs:{shape:l}}),g=PCe({inputs:{x:m},backend:n,attrs:{begin:h,size:p}});return f.push(d),f.push(v),f.push(m),f.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),g}};var VCe={kernelName:j0,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.weights,o=r.size,s=n.readSync(a.dataId),u=n.readSync(i.dataId),c=PSe(s,u,i.dtype,i.shape,o);return n.makeTensorInfo([o],i.dtype,c)}};var UCe={kernelName:H0,backendName:"webgl",kernelFunc:function(e){var t,n=e.inputs,r=e.backend,a=n.a,i=n.b,o=k0().getBool("WEBGL_PACK_BINARY_OPERATIONS"),s=k0().getNumber("WEBGL_VERSION");if(r.shouldExecuteOnCPU([a,i])||1===s){var u=r.texData.get(a.dataId).values,c=r.texData.get(i.dataId).values,l=S(WSe(a.shape,i.shape,u,c,a.dtype),2),h=l[0],p=l[1],f=r.makeTensorInfo(p,a.dtype);return r.texData.get(f.dataId).values=h,f}return t=o?new hEe("\n int r = int(a.r) & int(b.r);\n int g = int(a.g) & int(b.g);\n int rb = int(a.b) & int(b.b);\n int ra = int(a.a) & int(b.a);\n return vec4(r, g, rb, ra);\n",a.shape,i.shape,!1):new cEe("\n return float(int(a.r) & int(b.r));\n",a.shape,i.shape),r.runWebGLProgram(t,[a,i],a.dtype)}};var GCe={kernelName:K0,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.s0,a=t.s1,i=n.readSync(r.dataId),o=n.readSync(a.dataId),s=A7(Array.from(i),Array.from(o));return n.makeTensorInfo([s.length],"int32",Int32Array.from(s))}},jCe=IEe({opSnippet:"return float(a != b);",cpuKernelImpl:sTe,dtype:"bool"}),HCe={kernelName:b2,backendName:"webgl",kernelFunc:jCe};function qCe(e){var t=e.inputs,n=e.backend,r=t.input;return pEe({inputs:{x:n.texData.get(r.dataId).complexTensorInfos.real},backend:n})}var KCe={kernelName:D2,backendName:"webgl",kernelFunc:qCe};var XCe={kernelName:X0,backendName:"webgl",kernelFunc:function e(t){var n=t.inputs,r=t.backend,a=t.attrs,i=n.x,o=a.dtype;if("complex64"===o){if("complex64"===i.dtype)return pEe({inputs:{x:i},backend:r});var s=H9(i.shape),u=e({inputs:{x:i},backend:r,attrs:{dtype:"float32"}}),c=dEe({inputs:{real:u,imag:s},backend:r});return s.dispose(),r.disposeIntermediateTensorInfo(u),c}if("complex64"===i.dtype){var l=qCe({inputs:{input:i},backend:r}),h=e({inputs:{x:l},backend:r,attrs:{dtype:o}});return r.disposeIntermediateTensorInfo(l),h}if(!J$(i.dtype,o)){var p=pEe({inputs:{x:i},backend:r});return{dataId:p.dataId,shape:p.shape,dtype:o}}if(r.shouldExecuteOnCPU([i])){var f=r.texData.get(i.dataId).values,d=S(VSe(f,i.shape,i.dtype,o),3),v=d[0],m=d[1],g=d[2];return r.makeTensorInfo(v,m,g)}if("int32"===o)return function(e,t){var n=new WTe(e.shape,"return float(int(x));"),r=t.runWebGLProgram(n,[e],"int32");return{dataId:r.dataId,shape:r.shape,dtype:r.dtype}}(i,r);if("bool"===o){var y=r.makeTensorInfo([],"bool",q$("bool",1)),b=jCe({inputs:{a:i,b:y},backend:r});return r.disposeIntermediateTensorInfo(y),b}throw new Error("Error in Cast: failed to cast ".concat(i.dtype," to ").concat(o))}},YCe="return ceil(x);",JCe=wEe({opSnippet:YCe,packedOpSnippet:YCe,cpuKernelImpl:USe}),ZCe={kernelName:Y0,backendName:"webgl",kernelFunc:JCe},QCe=p((function e(t){l(this,e),this.variableNames=["A"],this.customUniforms=[{name:"minVal",type:"float"},{name:"maxVal",type:"float"}],this.outputShape=t,this.userCode="\n\n void main() {\n float value = getAAtOutCoords();\n if (isnan(value)) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, minVal, maxVal));\n }\n "})),$Ce=p((function e(t){l(this,e),this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"minVal",type:"float"},{name:"maxVal",type:"float"}],this.outputShape=t,this.userCode="\n void main() {\n vec4 value = getAAtOutCoords();\n\n if (any(isnan(value))) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, vec4(minVal), vec4(maxVal)));\n }\n "}));var eAe={kernelName:J0,backendName:"webgl",kernelFunc:function(e){var t,n=e.inputs,r=e.backend,a=e.attrs,i=n.x,o=a.clipValueMin,s=a.clipValueMax;t=k0().getBool("WEBGL_PACK_CLIP")?new $Ce(i.shape):new QCe(i.shape);var u=[[o],[s]];return r.runWebGLProgram(t,[i],i.dtype,u)}},tAe=p((function e(t){l(this,e),this.variableNames=["real","imag"],this.outputShape=t,this.userCode="\n void main() {\n float re = abs(getRealAtOutCoords());\n float im = abs(getImagAtOutCoords());\n float mx = max(re, im);\n\n // sadly the length function in glsl is not underflow-safe\n // (at least not on Intel GPUs). So the safe solution is\n // to ensure underflow-safety in all cases.\n setOutput(\n mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx))\n );\n }\n "}));function nAe(e,t){return{dataId:t.dataId,dtype:t.dtype,shape:e.shape}}var rAe={kernelName:Q0,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.x,a=n.texData.get(r.dataId),i=new tAe(r.shape),o=[nAe(r,a.complexTensorInfos.real),nAe(r,a.complexTensorInfos.imag)];return n.runWebGLProgram(i,o,o[0].dtype)}},aAe=p((function e(t){l(this,e),this.outputShape=[],this.outputShape=Xae(t,1),this.variableNames=t.map((function(e,t){return"T".concat(t)}));var n=new Array(t.length-1);n[0]=t[0][1];for(var r=1;r<n.length;r++)n[r]=n[r-1]+t[r][1];for(var a=["if (yC < ".concat(n[0],") setOutput(getT0(yR, yC));")],i=1;i<n.length;i++){var o=n[i-1];a.push("else if (yC < ".concat(n[i],") ")+"setOutput(getT".concat(i,"(yR, yC-").concat(o,"));"))}var s=n.length,u=n[n.length-1];a.push("else setOutput(getT".concat(s,"(yR, yC-").concat(u,"));")),this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int yR = coords.x;\n int yC = coords.y;\n\n ".concat(a.join("\n "),"\n }\n ")})),iAe=p((function e(t,n){l(this,e),this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[],this.outputShape=Xae(t,n);var r=this.outputShape,a=r.length,i=JNe(a),o=FTe("coords",a),s=["x","y","z","w","u","v"].slice(0,a);this.variableNames=t.map((function(e,t){return"T".concat(t)}));var u=new Array(t.length-1);u[0]=t[0][n];for(var c=1;c<u.length;c++)u[c]=u[c-1]+t[c][n];for(var h=s[n],p=s.slice(-2),f=s.join(),d="if (".concat(h," < ").concat(u[0],") {\n return getChannel(\n getT0(").concat(f,"), vec2(").concat(p.join(),"));\n }"),v=1;v<u.length;v++){var m=u[v-1];d+="\n if (".concat(h," < ").concat(u[v]," && ").concat(h," >= ").concat(u[v-1],") {\n return getChannel(\n getT").concat(v,"(").concat(oAe(s,h,m),"),\n vec2(").concat(oAe(p,h,m),"));\n }")}var g=u.length,y=u[u.length-1];d+="\n return getChannel(\n getT".concat(g,"(").concat(oAe(s,h,y),"),\n vec2(").concat(oAe(p,h,y),"));"),this.userCode="\n float getValue(".concat(s.map((function(e){return"int "+e})),") {\n ").concat(d,"\n }\n\n void main() {\n ").concat(i," coords = getOutputCoords();\n vec4 result = vec4(getValue(").concat(o,"), 0., 0., 0.);\n\n ").concat(o[a-1]," = ").concat(o[a-1]," + 1;\n if (").concat(o[a-1]," < ").concat(r[a-1],") {\n result.g = getValue(").concat(o,");\n }\n\n ").concat(o[a-2]," = ").concat(o[a-2]," + 1;\n if (").concat(o[a-2]," < ").concat(r[a-2],") {\n result.a = getValue(").concat(o,");\n }\n\n ").concat(o[a-1]," = ").concat(o[a-1]," - 1;\n if (").concat(o[a-2]," < ").concat(r[a-2]," &&\n ").concat(o[a-1]," < ").concat(r[a-1],") {\n result.b = getValue(").concat(o,");\n }\n setOutput(result);\n }\n ")}));function oAe(e,t,n){var r=e.indexOf(t);return e.map((function(e,t){return t===r?"".concat(e," - ").concat(n):e})).join()}function sAe(e){var t=e.inputs,n=e.backend,r=t.input;return pEe({inputs:{x:n.texData.get(r.dataId).complexTensorInfos.imag},backend:n})}var uAe={kernelName:U1,backendName:"webgl",kernelFunc:sAe};function cAe(e,t,n){var r=e[0].dtype;if("complex64"===r){var a=e.map((function(e){return qCe({inputs:{input:e},backend:n})})),i=e.map((function(e){return sAe({inputs:{input:e},backend:n})})),o=cAe(a,t,n),s=cAe(i,t,n),u=dEe({inputs:{real:o,imag:s},backend:n});return a.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),i.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(s),u}var c=n.shouldExecuteOnCPU(e);if("string"===r&&(c=!0),c){var l=e.map((function(e){var r=L$(e.shape.slice(t));return OEe({inputs:{x:e},backend:n,attrs:{shape:[-1,r]}})})),h=l.map((function(e){return{vals:n.readSync(e.dataId),shape:e.shape}})),p=Xae(l.map((function(e){return e.shape})),1),f=1===l[0].shape[0],d=GSe(h,p,r,f),v=Xae(e.map((function(e){return e.shape})),t),m=n.makeTensorInfo(v,r,d);return l.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),m}var g=e.filter((function(e){return L$(e.shape)>0})),y=k0().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&g[0].shape.length>1;if(1===g.length){var b=y?new WTe(e[0].shape,KTe):new eEe(e[0].shape,KTe);return n.runWebGLProgram(b,e,r)}var x=k0().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER");if(g.length>x){for(var k=[],w=0;w<g.length;w+=x){var I=g.slice(w,w+x);k.push(cAe(I,t,n))}for(var N=cAe(k,t,n),S=0,T=k;S<T.length;S++){var E=T[S];n.disposeIntermediateTensorInfo(E)}return N}if(y){var C=new iAe(g.map((function(e){return e.shape})),t);return n.runWebGLProgram(C,g,r)}var A=function(e,t,n){var r=Xae(e.map((function(e){return e.shape})),t);return{tensors2D:e.map((function(e){return OEe({inputs:{x:e},attrs:{shape:[-1,L$(e.shape.slice(t))]},backend:n})})),outShape:r}}(g,t,n),R=A.tensors2D,_=A.outShape,O=new aAe(R.map((function(e){return e.shape}))),F=n.runWebGLProgram(O,R,r);R.forEach((function(e){return n.disposeIntermediateTensorInfo(e)}));var D=OEe({inputs:{x:F},attrs:{shape:_},backend:n});return n.disposeIntermediateTensorInfo(F),D}function lAe(e){var t=e.inputs,n=e.backend,r=j$(e.attrs.axis,t[0].shape)[0];Kae(t.map((function(e){return e.shape})),r);var a=Xae(t.map((function(e){return e.shape})),r);if(0===L$(a))return n.makeTensorInfo(a,t[0].dtype,[]);var i=t.filter((function(e){return L$(e.shape)>0}));return 1===i.length?pEe({inputs:{x:i[0]},backend:n}):cAe(i,r,n)}var hAe={kernelName:$0,backendName:"webgl",kernelFunc:lAe},pAe=p((function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];l(this,e),this.variableNames=["x","W"],this.outputShape=t.outShape;var o=t.padInfo.top,s=t.padInfo.left,u=t.strideHeight,c=t.strideWidth,h=t.dilationHeight,p=t.dilationWidth,f=t.filterHeight,d=t.filterWidth,v=4*Math.floor(t.inChannels/4),m=t.inChannels%4,g="channelsLast"===t.dataFormat,y=g?1:2,b=g?2:3,x=g?3:1,k="",w="";r&&(k=a?"float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n ".concat(r,"\n }"):i?"float activation(float a) {\n float b = getLeakyreluAlphaAtOutCoords();\n ".concat(r,"\n }"):"\n float activation(float x) {\n ".concat(r,"\n }\n "),w="result = activation(result);");var I=n?"result += getBiasAtOutCoords();":"";n&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),i&&this.variableNames.push("leakyreluAlpha"),this.userCode="\n ".concat(k,"\n\n const ivec2 strides = ivec2(").concat(u,", ").concat(c,");\n const ivec2 pads = ivec2(").concat(o,", ").concat(s,");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d2 = coords[").concat(x,"];\n\n ivec2 xRCCorner =\n ivec2(coords[").concat(y,"], coords[").concat(b,"]) * 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 < ").concat(f,"; wR++) {\n int xR = xRCorner + wR * ").concat(h,";\n\n if (xR < 0 || xR >= ").concat(t.inHeight,") {\n continue;\n }\n\n for (int wC = 0; wC < ").concat(d,"; wC++) {\n int xC = xCCorner + wC * ").concat(p,";\n\n if (xC < 0 || xC >= ").concat(t.inWidth,") {\n continue;\n }\n\n for (int d1 = 0; d1 < ").concat(v,"; d1 += 4) {\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 if (").concat(g,") {\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 dotProd += dot(xValues, wValues);\n } else {\n vec4 xValues = vec4(\n getX(batch, d1, xR, xC),\n getX(batch, d1 + 1, xR, xC),\n getX(batch, d1 + 2, xR, xC),\n getX(batch, d1 + 3, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n\n if (").concat(1===m,") {\n\n if (").concat(g,") {\n dotProd +=\n getX(batch, xR, xC, ").concat(v,") *\n getW(wR, wC, ").concat(v,", d2);\n } else {\n dotProd +=\n getX(batch, ").concat(v,", xR, xC) *\n getW(wR, wC, ").concat(v,", d2);\n }\n\n } else if (").concat(2===m,") {\n vec2 wValues = vec2(\n getW(wR, wC, ").concat(v,", d2),\n getW(wR, wC, ").concat(v," + 1, d2)\n );\n\n if (").concat(g,") {\n vec2 xValues = vec2(\n getX(batch, xR, xC, ").concat(v,"),\n getX(batch, xR, xC, ").concat(v," + 1)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec2 xValues = vec2(\n getX(batch, ").concat(v,", xR, xC),\n getX(batch, ").concat(v," + 1, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n } else if (").concat(3===m,") {\n vec3 wValues = vec3(\n getW(wR, wC, ").concat(v,", d2),\n getW(wR, wC, ").concat(v," + 1, d2),\n getW(wR, wC, ").concat(v," + 2, d2)\n );\n\n if (").concat(g,") {\n vec3 xValues = vec3(\n getX(batch, xR, xC, ").concat(v,"),\n getX(batch, xR, xC, ").concat(v," + 1),\n getX(batch, xR, xC, ").concat(v," + 2)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec3 xValues = vec3(\n getX(batch, ").concat(v,", xR, xC),\n getX(batch, ").concat(v," + 1, xR, xC),\n getX(batch, ").concat(v," + 2, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n }\n }\n }\n\n float result = dotProd;\n ").concat(I,"\n ").concat(w,"\n setOutput(result);\n }\n ")})),fAe=p((function e(t){l(this,e),this.variableNames=["x","W"],this.outputShape=t.outShape;var n=t.padInfo.front,r=t.padInfo.top,a=t.padInfo.left,i=t.strideDepth,o=t.strideHeight,s=t.strideWidth,u=t.dilationDepth,c=t.dilationHeight,h=t.dilationWidth,p=t.filterDepth,f=t.filterHeight,d=t.filterWidth,v=4*Math.floor(t.inChannels/4),m=t.inChannels%4;this.userCode="\n const ivec3 strides = ivec3(".concat(i,", ").concat(o,", ").concat(s,");\n const ivec3 pads = ivec3(").concat(n,", ").concat(r,", ").concat(a,");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d2 = coords.u;\n\n ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xFCorner = xFRCCorner.x;\n int xRCorner = xFRCCorner.y;\n int xCCorner = xFRCCorner.z;\n\n // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get\n // y(yF, yR, yC, d2). ? = to be determined. : = across all\n // values in that axis.\n float dotProd = 0.0;\n for (int wF = 0; wF < ").concat(p,"; wF++) {\n int xF = xFCorner + wF * ").concat(u,";\n\n if (xF < 0 || xF >= ").concat(t.inDepth,") {\n continue;\n }\n\n for (int wR = 0; wR < ").concat(f,"; wR++) {\n int xR = xRCorner + wR * ").concat(c,";\n\n if (xR < 0 || xR >= ").concat(t.inHeight,") {\n continue;\n }\n\n for (int wC = 0; wC < ").concat(d,"; wC++) {\n int xC = xCCorner + wC * ").concat(h,";\n\n if (xC < 0 || xC >= ").concat(t.inWidth,") {\n continue;\n }\n\n for (int d1 = 0; d1 < ").concat(v,"; d1 += 4) {\n vec4 xValues = vec4(\n getX(batch, xF, xR, xC, d1),\n getX(batch, xF, xR, xC, d1 + 1),\n getX(batch, xF, xR, xC, d1 + 2),\n getX(batch, xF, xR, xC, d1 + 3)\n );\n vec4 wValues = vec4(\n getW(wF, wR, wC, d1, d2),\n getW(wF, wR, wC, d1 + 1, d2),\n getW(wF, wR, wC, d1 + 2, d2),\n getW(wF, wR, wC, d1 + 3, d2)\n );\n\n dotProd += dot(xValues, wValues);\n }\n\n if (").concat(1===m,") {\n dotProd +=\n getX(batch, xF, xR, xC, ").concat(v,") *\n getW(wF, wR, wC, ").concat(v,", d2);\n } else if (").concat(2===m,") {\n vec2 xValues = vec2(\n getX(batch, xF, xR, xC, ").concat(v,"),\n getX(batch, xF, xR, xC, ").concat(v," + 1)\n );\n vec2 wValues = vec2(\n getW(wF, wR, wC, ").concat(v,", d2),\n getW(wF, wR, wC, ").concat(v," + 1, d2)\n );\n dotProd += dot(xValues, wValues);\n } else if (").concat(3===m,") {\n vec3 xValues = vec3(\n getX(batch, xF, xR, xC, ").concat(v,"),\n getX(batch, xF, xR, xC, ").concat(v," + 1),\n getX(batch, xF, xR, xC, ").concat(v," + 2)\n );\n vec3 wValues = vec3(\n getW(wF, wR, wC, ").concat(v,", d2),\n getW(wF, wR, wC, ").concat(v," + 1, d2),\n getW(wF, wR, wC, ").concat(v," + 2, d2)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n ")})),dAe=p((function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];l(this,e),this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=t.outShape,this.enableShapeUniforms=iSe(this.outputShape.length);for(var o=t.padInfo.left,s=t.strideWidth,u=t.dilationWidth,c=t.filterHeight,h=t.filterWidth,p=h,f="\n int xR; int xC; int xCOffset;\n vec4 wTexel; vec4 previous; vec4 final;",d=0;d<h;d++)f+="\n vec4 xTexelC".concat(2*d,";\n int xTexelC").concat(2*d,"Ready;\n vec4 xTexelC").concat(2*d+1,";\n int xTexelC").concat(2*d+1,"Ready;\n vec4 xC").concat(d,";");f+="\n for (int r = 0; r < ".concat(c,"; r++) {\n for (int d1 = 0; d1 < ").concat(t.inChannels,"; d1 += 2) {\n ");for(var v=0;v<h;v++)f+="\n xTexelC".concat(2*v," = vec4(0.0);\n xTexelC").concat(2*v,"Ready = 0;\n xTexelC").concat(2*v+1," = vec4(0.0);\n xTexelC").concat(2*v+1,"Ready = 0;\n xC").concat(v," = vec4(0.0);");f+="\n xR = xRCorner + r * dilations[0];\n if (xR >=0 && xR < inDims[0]) {\n ";for(var m=0;m<(p+1)/2;m++){var g=2*m;if(f+="\n xC = xCCorner + ".concat(g*u,";\n "),1===s){if(g<h&&(o%2==1?(f+="\n xCOffset = xC + 1;\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC".concat(g,"Ready == 0) {\n xTexelC").concat(g," = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC").concat(g,".zw = vec2(0.0);\n }\n xTexelC").concat(g,"Ready = 1;\n }\n "),f+=1===u&&g>0?"\n xC".concat(g," = vec4(xTexelC").concat(g-2,".zw, xTexelC").concat(g,".xy);\n "):"\n xCOffset = xC + 1 - 2;\n\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n previous.zw = vec2(0.0);\n }\n\n xC".concat(g," = vec4(previous.zw, xTexelC").concat(g,".xy);\n } else {\n xC").concat(g," = vec4(0.0, 0.0, xTexelC").concat(g,".xy);\n }\n ")):f+="\n if (xC >= 0 && xC < inDims[1] && xTexelC".concat(g,"Ready == 0) {\n xTexelC").concat(g," = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC").concat(g,".zw = vec2(0.0);\n }\n xTexelC").concat(g,"Ready = 1;\n }\n\n xC").concat(g," = xTexelC").concat(g,";\n "),g+1<h)){var y=o%2==0?R$(u):u;u%2==0&&o%2==1||u%2!=0&&o%2!=1?(f+="\n xCOffset = xC + imod(pads[1], 2) + ".concat(y,";\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC").concat(g+1,"Ready == 0) {\n xTexelC").concat(g+1," = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC").concat(g+1,".zw = vec2(0.0);\n }\n xTexelC").concat(g+1,"Ready = 1;\n }\n "),f+=u>1?"\n xCOffset -= 2;\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n xC".concat(g+1," = vec4(previous.zw, xTexelC").concat(g+1,".xy);\n } else {\n xC").concat(g+1," = vec4(0.0, 0.0, xTexelC").concat(g+1,".xy);\n }\n "):"\n xC".concat(g+1," = vec4(xTexelC").concat(g,".zw, xTexelC").concat(g+1,".xy);\n ")):f+=1===y?"\n xC".concat(g+1," = xTexelC").concat(g,";\n "):"\n xCOffset = xC + ".concat(y,";\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC").concat(g+1,"Ready == 0) {\n xTexelC").concat(g+1," = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC").concat(g+1,".zw = vec2(0.0);\n }\n xTexelC").concat(g+1,"Ready = 1;\n }\n\n xC").concat(g+1," = xTexelC").concat(g+1,";\n ")}}else g<h&&(o%2==1?(f+="\n xCOffset = xC + 1 - strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC".concat(g,"Ready == 0) {\n xTexelC").concat(g," = getX(batch, xR, xCOffset, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC").concat(g,".zw = vec2(0.0);\n }\n xTexelC").concat(g,"Ready = 1;\n }\n\n if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC").concat(g+1,"Ready == 0) {\n xTexelC").concat(g+1," = getX(batch, xR, xC + 1, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xC + 2 >= inDims[1]) {\n xTexelC").concat(g+1,".zw = vec2(0.0);\n }\n xTexelC").concat(g+1,"Ready = 1;\n }\n\n xC").concat(g," = vec4(xTexelC").concat(g,".zw, xTexelC").concat(g+1,".zw);\n "),g+1<h&&(f+="\n final = vec4(0.0);\n xCOffset = xC + 1 + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1]) {\n final = getX(batch, xR, xCOffset, d1);\n }\n xC".concat(g+1," = vec4(xTexelC").concat(g+1,".xy, final.xy);\n "))):(f+="\n if(xC >= 0 && xC < inDims[1] && xTexelC".concat(g,"Ready == 0) {\n xTexelC").concat(g," = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC").concat(g,".zw = vec2(0.0);\n }\n xTexelC").concat(g,"Ready = 1;\n }\n\n xCOffset = xC + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC").concat(g+1,"Ready == 0) {\n xTexelC").concat(g+1," = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC").concat(g+1,".zw = vec2(0.);\n }\n xTexelC").concat(g+1,"Ready = 1;\n }\n\n xC").concat(g," = vec4(\n xTexelC").concat(g,".xy, xTexelC").concat(g+1,".xy);\n "),g+1<h&&(f+="\n xC".concat(g+1," = vec4(xTexelC").concat(g,".zw, xTexelC").concat(g+1,".zw);\n "))));g<h&&(f+="\n wTexel = getW(r, ".concat(g,", d1, d2);\n dotProd += xC").concat(g,".xxzz * vec4(wTexel.xy, wTexel.xy);\n if(d1 + 1 < ").concat(t.inChannels,") {\n dotProd += xC").concat(g,".yyww * vec4(wTexel.zw, wTexel.zw);\n }\n "),g+1<h&&(f+="\n wTexel = getW(r, ".concat(g+1,", d1, d2);\n dotProd += xC").concat(g+1,".xxzz * vec4(wTexel.xy, wTexel.xy);\n if(d1 + 1 < ").concat(t.inChannels,") {\n dotProd += xC").concat(g+1,".yyww * vec4(wTexel.zw, wTexel.zw);\n }\n ")))}f+="\n }\n ",f+="\n }\n ",f+="\n }\n ";var b="",x="";r&&(b=a?"vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n ".concat(r,"\n }"):i?"vec4 activation(vec4 a) {\n vec4 b = getLeakyreluAlphaAtOutCoords();\n ".concat(r,"\n }"):"vec4 activation(vec4 x) {\n ".concat(r,"\n }"),x="result = activation(result);");var k=n?"result += getBiasAtOutCoords();":"";n&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),i&&this.variableNames.push("leakyreluAlpha"),this.userCode="\n ".concat(b,"\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 xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.\n vec4 dotProd = vec4(0.000000000000001);\n\n ").concat(f,"\n\n vec4 result = dotProd - vec4(0.000000000000001);\n ").concat(k,"\n ").concat(x,"\n setOutput(result);\n }\n ")})),vAe=p((function e(t,n){l(this,e),this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"inputShape",type:"ivec4"},{name:"pad",type:"ivec2"},{name:"stride",type:"ivec2"},{name:"dilation",type:"ivec2"},{name:"inChannels",type:"int"},{name:"itemsPerBlockRow",type:"int"},{name:"outWidth",type:"int"}],this.outputShape=t,this.enableShapeUniforms=iSe(this.outputShape.length);for(var r=n.dataFormat,a=SNe(),i="channelsLast"===r,o=i?1:2,s=i?2:3,u=this.enableShapeUniforms?"if(blockIndex < outShape[2] && pos < outShape[1]) {":"if(blockIndex < ".concat(t[2]," && pos < ").concat(t[1],") {"),c="",h=0;h<=1;h++)for(var p=0;p<=1;p++)c+="\n blockIndex = rc.z + ".concat(p,";\n pos = rc.y + ").concat(h,";\n\n ").concat(u,"\n offsetY = int(blockIndex / outWidth) * stride[0] - pad[0];\n d0 = offsetY + dilation[0] * (pos / itemsPerBlockRow);\n\n if(d0 < inputShape[").concat(o,"] && d0 >= 0) {\n // Use custom imod instead mod. On Intel GPU, mod may generate\n // unexpected value.\n // https://github.com/tensorflow/tfjs/issues/5447\n offsetX = imod(blockIndex, outWidth) * stride[1] - pad[1];\n d1 = offsetX + dilation[1] * (imod(pos, itemsPerBlockRow) /\n inChannels);\n\n if(d1 < inputShape[").concat(s,"] && d1 >= 0) {\n\n ch = imod(pos, inChannels);\n\n if (").concat(i,") {\n innerDims = vec2(d1, ch);\n result[").concat(2*h+p,"] = getChannel(\n getA(rc.x, d0, int(innerDims.x),\n int(innerDims.y)), innerDims);\n } else {\n innerDims = vec2(d0, d1);\n result[").concat(2*h+p,"] = getChannel(\n getA(rc.x, ch, int(innerDims.x),\n int(innerDims.y)), innerDims);\n }\n }\n }\n }\n ");this.userCode="\n void main() {\n ivec3 rc = getOutputCoords();\n\n vec4 result = vec4(0);\n\n int blockIndex, pos, offsetY, d0, offsetX, d1, ch;\n vec2 innerDims;\n\n ".concat(c,"\n\n ").concat(a.output," = result;\n }\n ")}));function mAe(e,t){var n=e.length;return n>=3?[].concat(T(e.slice(0,-3)),t?[e[n-3]*e[n-2],e[n-1]]:[e[n-3],e[n-2]*e[n-1]]):!t&&1===n&&e[0]>1?[e[0],1]:null}function gAe(e){var t,n=e.x,r=e.filter,a=e.convInfo,i=e.backend,o=e.bias,s=void 0===o?null:o,u=e.preluActivationWeights,c=void 0===u?null:u,l=e.leakyreluAlpha,h=void 0===l?0:l,p=e.activation,f=void 0===p?null:p,d=n.shape,v=i.texData.get(n.dataId),m=a.inChannels,g=d[0]*d[1]*d[2],y=a.outChannels,b="channelsLast"===a.dataFormat,x=[];if(null!=c){var k=mAe(c.shape,b);null!=k&&(c=OEe({inputs:{x:c},backend:i,attrs:{shape:k}}),x.push(c))}if(null!=s){var w=mAe(s.shape,b);null!=w&&(s=OEe({inputs:{x:s},backend:i,attrs:{shape:w}}),x.push(s))}if(!((1===g||1===y)&&m>1e3)&&v.isPacked&&b&&null!=v.texture&&d[2]%2!=0&&P$(v.shape.slice(-3),d.slice(-3))){var I=d[0]*d[1]*(d[2]+1),N={dataId:n.dataId,shape:[1,I,a.inChannels],dtype:n.dtype},S=v.shape;v.shape=v.shape.slice(),v.shape[v.shape.length-2]++,F$(pNe(v.shape,N.shape),(function(){return"packed reshape ".concat(v.shape," to ").concat(N.shape," isn't free")}));var T=OEe({inputs:{x:r},backend:i,attrs:{shape:[1,a.inChannels,a.outChannels]}});x.push(T);var E=jEe({a:N,b:T,backend:i,transposeA:!1,transposeB:false,bias:s,activation:f,preluActivationWeights:c,leakyreluAlpha:h}),C=i.texData.get(E.dataId);F$(C.isPacked,(function(){return"batchMatMul result is expected to be packed"})),v.shape=S,C.shape=a.outShape,(t=pEe({inputs:{x:E},backend:i})).shape=a.outShape,x.push(E)}else{var A=a.outHeight*a.outWidth,R=OEe({inputs:{x:n},backend:i,attrs:{shape:b?[a.batchSize,A,a.inChannels]:[a.batchSize,a.inChannels,A]}}),_=OEe({inputs:{x:r},backend:i,attrs:{shape:[1,a.inChannels,a.outChannels]}}),O=jEe({a:b?R:_,b:b?_:R,transposeA:!b,transposeB:false,backend:i,bias:s,activation:f,preluActivationWeights:c,leakyreluAlpha:h});t=OEe({inputs:{x:O},backend:i,attrs:{shape:a.outShape}}),x.push(R),x.push(_),x.push(O)}for(var F=0,D=x;F<D.length;F++){var M=D[F];i.disposeIntermediateTensorInfo(M)}return t}function yAe(e){var t=e.x,n=e.filter,r=e.convInfo,a=e.backend,i=e.bias,o=void 0===i?null:i,s=e.preluActivationWeights,u=void 0===s?null:s,c=e.leakyreluAlpha,l=void 0===c?0:c,h=e.activation,p=void 0===h?null:h,f=r.filterWidth,d=r.filterHeight,v=r.inChannels,m=r.outWidth,g=r.outHeight,y="channelsLast"===r.dataFormat,b=f*d*v,x=g*m,k=[r.batchSize,b,x],w=[];if(null!=u){var I=mAe(u.shape,y);null!=I&&(u=OEe({inputs:{x:u},backend:a,attrs:{shape:I}}),w.push(u))}if(null!=o){var N=mAe(o.shape,y);null!=N&&(o=OEe({inputs:{x:o},backend:a,attrs:{shape:N}}),w.push(o))}var S=OEe({inputs:{x:n},backend:a,attrs:{shape:[1,b,L$(n.shape)/b]}});w.push(S);var T=new vAe(k,r),E=[t.shape,[r.padInfo.top,r.padInfo.left],[r.strideHeight,r.strideWidth],[r.dilationHeight,r.dilationWidth],[r.inChannels],[r.filterWidth*r.inChannels],[r.outWidth]],C=a.runWebGLProgram(T,[t],"float32",E),A=OEe({inputs:{x:C},backend:a,attrs:{shape:k}});w.push(C),w.push(A);var R=null!=o,_=null!=u,O="leakyrelu"===p,F=p?NEe(p,!0):null,D=new SEe(y?A.shape:S.shape,y?S.shape:A.shape,y?[r.batchSize,x,r.outChannels]:[r.batchSize,r.outChannels,x],!0,!1,R,F,_,O),M=y?[A,S]:[S,A];if(o&&M.push(o),_&&M.push(u),O){var L=a.makeTensorInfo([],"float32",M4(l,"float32"));M.push(L),w.push(L)}var z=a.runWebGLProgram(D,M,"float32"),P=OEe({inputs:{x:z},backend:a,attrs:{shape:r.outShape}});w.push(z);for(var B=0,W=w;B<W.length;B++){var V=W[B];a.disposeIntermediateTensorInfo(V)}return P}var bAe={kernelName:e1,backendName:"webgl",kernelFunc:function(e){var t,n=e.inputs,r=e.backend,a=e.attrs,i=n.x,o=n.filter,s=a.strides,u=a.pad,c=a.dataFormat,l=a.dilations,h=a.dimRoundingMode,p=P8(c),f=T8(i.shape,o.shape,s,l,u,h,!1,p);if(1!==f.filterHeight||1!==f.filterWidth||1!==f.dilationHeight||1!==f.dilationWidth||1!==f.strideHeight||1!==f.strideWidth||"SAME"!==f.padInfo.type&&"VALID"!==f.padInfo.type)if(f.strideWidth<=2&&"channelsLast"===p&&k0().getBool("WEBGL_EXP_CONV")){var d=new dAe(f),v=[[f.padInfo.top,f.padInfo.left],[f.strideHeight,f.strideWidth],[f.dilationHeight,f.dilationWidth],[f.inHeight,f.inWidth]];t=r.runWebGLProgram(d,[i,o],"float32",v)}else if(k0().getBool("WEBGL_CONV_IM2COL"))t=yAe({x:i,filter:o,convInfo:f,backend:r});else{var m=new pAe(f);t=r.runWebGLProgram(m,[i,o],"float32")}else t=gAe({x:i,filter:o,convInfo:f,backend:r});var g=OEe({inputs:{x:t},backend:r,attrs:{shape:f.outShape}});return r.disposeIntermediateTensorInfo(t),g}},xAe=p((function e(t){l(this,e),this.variableNames=["x","dy"],this.outputShape=t.filterShape;var n=t.strideHeight,r=t.strideWidth,a=t.padInfo.top,i=t.padInfo.left,o="channelsLast"===t.dataFormat;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 < ".concat(t.batchSize,"; b++) {\n for (int yR = 0; yR < ").concat(t.outHeight,"; yR++) {\n int xR = wR + yR * ").concat(n," - ").concat(a,";\n\n if (xR < 0 || xR >= ").concat(t.inHeight,") {\n continue;\n }\n\n for (int yC = 0; yC < ").concat(t.outWidth,"; yC++) {\n int xC = wC + yC * ").concat(r," - ").concat(i,";\n\n if (xC < 0 || xC >= ").concat(t.inWidth,") {\n continue;\n }\n\n ").concat(o?"float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);":"float dyValue = getDy(b, d2, yR, yC);\n float xValue = getX(b, d1, xR, xC);\n dotProd += (xValue * dyValue);","\n }\n }\n }\n setOutput(dotProd);\n }\n ")})),kAe=p((function e(t){l(this,e),this.variableNames=["dy","W"],this.outputShape=t.inShape;var n=t.filterHeight,r=t.filterWidth,a=t.strideHeight,i=t.strideWidth,o="channelsLast"===t.dataFormat,s=n-1-t.padInfo.top,u=r-1-t.padInfo.left,c=o?1:2,h=o?2:3,p=o?3:1;this.userCode="\n const ivec2 pads = ivec2(".concat(s,", ").concat(u,");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[").concat(p,"];\n\n ivec2 dyCorner = ivec2(coords[").concat(c,"], coords[").concat(h,"]) - 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 < ").concat(n,"; wR++) {\n float dyR = float(dyRCorner + wR) / ").concat(a,".0;\n\n if (dyR < 0.0 || dyR >= ").concat(t.outHeight,".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ").concat(n," - 1 - wR;\n\n for (int wC = 0; wC < ").concat(r,"; wC++) {\n float dyC = float(dyCCorner + wC) / ").concat(i,".0;\n\n if (dyC < 0.0 || dyC >= ").concat(t.outWidth,".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ").concat(r," - 1 - wC;\n\n for (int d2 = 0; d2 < ").concat(t.outChannels,"; d2++) {\n\n if (").concat(o,") {\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n } else {\n float xValue = getDy(batch, d2, idyR, idyC);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n\n }\n }\n }\n setOutput(dotProd);\n }\n ")})),wAe=p((function e(t){l(this,e),this.variableNames=["x","dy"],this.outputShape=t.filterShape;var n=t.strideDepth,r=t.strideHeight,a=t.strideWidth,i=t.padInfo.front,o=t.padInfo.top,s=t.padInfo.left;this.userCode="\n void main() {\n ivec5 coords = getOutputCoords();\n int wF = coords.x;\n int wR = coords.y;\n int wC = coords.z;\n int d1 = coords.w;\n int d2 = coords.u;\n\n float dotProd = 0.0;\n\n for (int b = 0; b < ".concat(t.batchSize,"; b++) {\n for (int yF = 0; yF < ").concat(t.outDepth,"; yF++) {\n int xF = wF + yF * ").concat(n," - ").concat(i,";\n\n if (xF < 0 || xF >= ").concat(t.inDepth,") {\n continue;\n }\n\n for (int yR = 0; yR < ").concat(t.outHeight,"; yR++) {\n int xR = wR + yR * ").concat(r," - ").concat(o,";\n\n if (xR < 0 || xR >= ").concat(t.inHeight,") {\n continue;\n }\n\n for (int yC = 0; yC < ").concat(t.outWidth,"; yC++) {\n int xC = wC + yC * ").concat(a," - ").concat(s,";\n\n if (xC < 0 || xC >= ").concat(t.inWidth,") {\n continue;\n }\n\n float dyValue = getDy(b, yF, yR, yC, d2);\n float xValue = getX(b, xF, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n ")})),IAe=p((function e(t){l(this,e),this.variableNames=["dy","W"],this.outputShape=t.inShape;var n=t.filterDepth,r=t.filterHeight,a=t.filterWidth,i=t.strideDepth,o=t.strideHeight,s=t.strideWidth,u=n-1-t.padInfo.front,c=r-1-t.padInfo.top,h=a-1-t.padInfo.left;this.userCode="\n const ivec3 pads = ivec3(".concat(u,", ").concat(c,", ").concat(h,");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d1 = coords.u;\n\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyFCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n float dotProd = 0.0;\n for (int wF = 0; wF < ").concat(n,"; wF++) {\n float dyF = float(dyFCorner + wF) / ").concat(i,".0;\n\n if (dyF < 0.0 || dyF >= ").concat(t.outDepth,".0 || fract(dyF) > 0.0) {\n continue;\n }\n int idyF = int(dyF);\n\n int wFPerm = ").concat(n," - 1 - wF;\n\n for (int wR = 0; wR < ").concat(r,"; wR++) {\n float dyR = float(dyRCorner + wR) / ").concat(o,".0;\n\n if (dyR < 0.0 || dyR >= ").concat(t.outHeight,".0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ").concat(r," - 1 - wR;\n\n for (int wC = 0; wC < ").concat(a,"; wC++) {\n float dyC = float(dyCCorner + wC) / ").concat(s,".0;\n\n if (dyC < 0.0 || dyC >= ").concat(t.outWidth,".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ").concat(a," - 1 - wC;\n\n for (int d2 = 0; d2 < ").concat(t.outChannels,"; d2++) {\n float xValue = getDy(batch, idyF, idyR, idyC, d2);\n float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n }\n }\n }\n setOutput(dotProd);\n }\n ")}));var NAe={kernelName:t1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.dy,o=r.strides,s=r.pad,u=r.dataFormat,c=r.dimRoundingMode,l=r.filterShape,h=P8(u),p=T8(a.shape,l,o,1,s,c,!1,h),f=new xAe(p);return n.runWebGLProgram(f,[a,i],"float32")}},SAe=p((function e(t){l(this,e),this.variableNames=["dy","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"strides",type:"vec2"}],this.outputShape=t.inShape,this.enableShapeUniforms=iSe(this.outputShape.length);var n=t.filterHeight,r=t.filterWidth,a=n-1-t.padInfo.top,i=r-1-t.padInfo.left;this.userCode="\n const ivec2 pads = ivec2(".concat(a,", ").concat(i,");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[3];\n\n ivec2 dyCorner = ivec2(coords[1], coords[2]) - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n vec4 result = vec4(0.);\n for (int wR = 0; wR < ").concat(n,"; wR++) {\n float dyR = float(dyRCorner + wR) / strides[0];\n if (dyR < 0.0 || dyR >= ").concat(t.outHeight,".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n int wRPerm = ").concat(n," - 1 - wR;\n\n for (int wC = 0; wC < ").concat(r,"; wC++) {\n int wCPerm = ").concat(r," - 1 - wC;\n\n float dyC = float(dyCCorner + wC) / strides[1];\n bool idyCVal = (dyC >= 0.0) && (dyC < ").concat(t.outWidth,".0)\n && (fract(dyC) == 0.0);\n int idyC = int(dyC);\n\n float dyC2 = float(dyCCorner + wC + 1) / strides[1];\n bool idyCVal2 = (dyC2 >= 0.0) && (dyC2 < ").concat(t.outWidth,".0)\n && (fract(dyC2) == 0.0);\n int idyC2 = int(dyC2);\n\n if (idyCVal && idyCVal2) {\n for (int d2 = 0; d2 < ").concat(t.outChannels,"; d2 += 2) {\n vec4 wValue = getW(wRPerm, wCPerm, d1, d2);\n vec4 dySample = getDy(batch, idyR, idyC, d2);\n vec4 dySample2 = (idyC / 2 == idyC2 / 2) ?\n dySample : getDy(batch, idyR, idyC2, d2);\n\n vec2 dyValue = mod(float(idyC), 2.) == 0. ?\n dySample.xy : dySample.zw;\n result.xy += vec2(dot(dyValue, wValue.xy),\n dot(dyValue, wValue.zw));\n\n dyValue = mod(float(idyC2), 2.) == 0. ?\n dySample2.xy : dySample2.zw;\n result.zw += vec2(dot(dyValue, wValue.xy),\n dot(dyValue, wValue.zw));\n }\n } else if (idyCVal) {\n for (int d2 = 0; d2 < ").concat(t.outChannels,"; d2 += 2) {\n vec4 wValue = getW(wRPerm, wCPerm, d1, d2);\n vec4 dySample = getDy(batch, idyR, idyC, d2);\n vec2 dyValue = mod(float(idyC), 2.) == 0. ?\n dySample.xy : dySample.zw;\n result.xy += vec2(dot(dyValue, wValue.xy),\n dot(dyValue, wValue.zw));\n }\n } else if (idyCVal2) {\n for (int d2 = 0; d2 < ").concat(t.outChannels,"; d2 += 2) {\n vec4 wValue = getW(wRPerm, wCPerm, d1, d2);\n vec4 dySample = getDy(batch, idyR, idyC2, d2);\n vec2 dyValue = mod(float(idyC2), 2.) == 0. ?\n dySample.xy : dySample.zw;\n result.zw += vec2(dot(dyValue, wValue.xy),\n dot(dyValue, wValue.zw));\n }\n }\n }\n }\n setOutput(result);\n }\n ")}));var TAe={kernelName:n1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.dy,i=t.filter,o=r.inputShape,s=r.strides,u=r.pad,c=r.dataFormat,l=r.dimRoundingMode,h=P8(c),p=T8(o,i.shape,s,1,u,l,!1,h);if(k0().getBool("WEBGL_PACK")&&"channelsLast"===h){var f=[[p.strideHeight,p.strideWidth]],d=new SAe(p);return n.runWebGLProgram(d,[a,i],"float32",f)}var v=new kAe(p);return n.runWebGLProgram(v,[a,i],"float32")}};var EAe={kernelName:r1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.filter,o=r.strides,s=r.pad,u=r.dilations,c=E8(a.shape,i.shape,o,u,s),l=new fAe(c);return n.runWebGLProgram(l,[a,i],"float32")}};var CAe={kernelName:a1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.dy,o=r.strides,s=r.pad,u=r.filterShape,c=E8(a.shape,u,o,1,s),l=new wAe(c);return n.runWebGLProgram(l,[a,i],"float32")}};var AAe,RAe={kernelName:i1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.dy,i=t.filter,o=r.pad,s=r.strides,u=E8(r.inputShape,i.shape,s,1,o),c=new IAe(u);return n.runWebGLProgram(c,[a,i],"float32")}},_Ae=wEe({opSnippet:"if (isnan(x)) return x;\n return cos(x);\n",packedOpSnippet:"\n vec4 result = cos(x);\n bvec4 isNaN = isnan(x);\n ".concat(lEe,"\n return result;\n")}),OAe={kernelName:o1,backendName:"webgl",kernelFunc:_Ae},FAe=wEe({opSnippet:"\n float e2x = exp(-x);\n return (e2x + 1.0 / e2x) / 2.0;\n"}),DAe={kernelName:s1,backendName:"webgl",kernelFunc:FAe},MAe=p((function e(t,n,r,a,i){l(this,e),this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];var o=S(t,4),s=o[0],u=o[1],c=o[2],h=o[3],p=S(n,1)[0],f=S(r,2),d=f[0],v=f[1];this.outputShape=[p,d,v,h];var m="bilinear"===a?1:0,g="".concat(u-1,".0"),y="".concat(c-1,".0"),b=S(d>1?["".concat((u-1)/(d-1)),"(y2-y1) * height_ratio","y1*".concat(g," + float(y)*(height_scale)")]:["0.0","0.0","0.5 * (y1+y2) * ".concat(g)],3),x=b[0],k=b[1],w=b[2],I=S(v>1?["".concat((c-1)/(v-1)),"(x2-x1) * width_ratio","x1*".concat(y," + float(x)*(width_scale)")]:["0.0","0.0","0.5 * (x1+x2) * ".concat(y)],3),N=I[0],T=I[1],E=I[2];this.userCode="\n const float height_ratio = float(".concat(x,");\n const float width_ratio = float(").concat(N,");\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 >= ").concat(s,") {\n return;\n }\n\n float height_scale = ").concat(k,";\n float width_scale = ").concat(T,";\n\n float in_y = ").concat(w,";\n if( in_y < 0.0 || in_y > ").concat(g," ) {\n setOutput(float(").concat(i,"));\n return;\n }\n float in_x = ").concat(E,";\n if( in_x < 0.0 || in_x > ").concat(y," ) {\n setOutput(float(").concat(i,"));\n return;\n }\n\n vec2 sourceFracIndexCR = vec2(in_x,in_y);\n if(").concat(m," == 1) {\n // Compute the four integer indices.\n ivec2 sourceFloorCR = ivec2(sourceFracIndexCR);\n ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR));\n\n float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d);\n float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d);\n float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d);\n float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d);\n\n vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR);\n\n float top = topLeft + (topRight - topLeft) * fracCR.x;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;\n float newValue = top + (bottom - top) * fracCR.y;\n setOutput(newValue);\n } else {\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestCR = ivec2(floor(\n sourceFracIndexCR + vec2(0.5,0.5)));\n float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d);\n setOutput(newValue);\n }\n }\n ")})),LAe={kernelName:l1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.image,i=t.boxes,o=t.boxInd,s=r.cropSize,u=r.method,c=r.extrapolationValue,l=new MAe(a.shape,i.shape,s,u,c);return n.runWebGLProgram(l,[a,i,o],"float32")}};!function(e){e.Prod="*",e.Sum="+"}(AAe||(AAe={}));var zAe=p((function e(t,n,r,a){l(this,e),this.op=t,this.outputShape=n,this.variableNames=["x"],this.customUniforms=[{name:"index",type:"float"}];var i=this.outputShape.length,o=this.op===AAe.Prod?"1.0":"0.0",s=r?o:"getX(".concat(PAe(i,"coords",this.op),")"),u=this.outputShape[this.outputShape.length-1],c="",h="";r?(c=a?"end != ".concat(u-1):"end != 0",h=a?"end + 1":"end - 1"):(c=a?"end + pow2 < ".concat(u):"end >= pow2",h=a?"end + pow2":"end - pow2"),this.userCode="\n void main() {\n ".concat(JNe(i)," coords = getOutputCoords();\n int end = ").concat(BAe(i,"coords",this.op),";\n float val = ").concat(s,";\n int pow2 = int(pow(2.0, index));\n if (").concat(c,") {\n int idx = ").concat(h,";\n ").concat(BAe(i,"coords",this.op)," = idx;\n val ").concat(this.op,"= getX(").concat(PAe(i,"coords",this.op),");\n }\n setOutput(val);\n }\n ")}));function PAe(e,t,n){if(1===e)return"".concat(t);if(2===e)return"".concat(t,".x, ").concat(t,".y");if(3===e)return"".concat(t,".x, ").concat(t,".y, ").concat(t,".z");if(4===e)return"".concat(t,".x, ").concat(t,".y, ").concat(t,".z, ").concat(t,".w");throw new Error("Cumulative ".concat(n," for rank ").concat(e," is not yet supported"))}function BAe(e,t,n){if(1===e)return"".concat(t);if(2===e)return"".concat(t,".y");if(3===e)return"".concat(t,".z");if(4===e)return"".concat(t,".w");throw new Error("Cumulative ".concat(n," for rank ").concat(e," is not yet supported"))}function WAe(e,t,n,r,a,i){var o=t.shape.length,s=H7([r],o),u=t;null!=s&&(u=UEe({inputs:{x:t},backend:n,attrs:{perm:s}}));var c=K7(1,o)[0];if(c!==o-1)throw new Error("WebGL cumprod shader expects an inner-most axis=".concat(t.shape.length-1," ")+"but got axis=".concat(r));for(var l=u.shape[c],h=pEe({inputs:{x:u},backend:n}),p=0;p<=Math.ceil(Math.log2(l))-1;p++){var f=new zAe(e,u.shape,!1,i),d=[[p]],v=h;h=n.runWebGLProgram(f,[h],h.dtype,d),n.disposeIntermediateTensorInfo(v)}if(a){var m=new zAe(e,u.shape,a,i),g=h;h=n.runWebGLProgram(m,[h],h.dtype),n.disposeIntermediateTensorInfo(g)}if(null!=s){var y=UEe({inputs:{x:h},backend:n,attrs:{perm:q7(s)}});return n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(u),y}return h}var VAe={kernelName:u1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.axis,o=r.exclusive,s=r.reverse;return WAe(AAe.Prod,a,n,i,o,s)}};var UAe={kernelName:c1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.axis,o=r.exclusive,s=r.reverse;return WAe(AAe.Sum,a,n,i,o,s)}};var GAe={kernelName:h1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.weights,o=r.size,s=r.binaryOutput;if(1===a.shape.length){var u=n.readSync(a.dataId),c=n.readSync(i.dataId),l=PSe(u,c,i.dtype,i.shape,o);return n.makeTensorInfo([o],i.dtype,l)}if(2===a.shape.length){var h=n.bufferSync(a),p=n.bufferSync(i),f=BSe(h,p,o,s);return n.makeTensorInfo(f.shape,i.dtype,f.values)}throw new Error("Error in denseBincount: input must be at most rank 2, but got rank"+"".concat(a.shape.length,"."))}},jAe=function(){function e(t,n,r){l(this,e),this.variableNames=["x"],this.outputShape=[],this.outputShape=t,this.blockSize=n,this.dataFormat=r,this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int h = ".concat(this.getHeightCoordString(),";\n int w = ").concat(this.getWidthCoordString(),";\n int d = ").concat(this.getDepthCoordString(),";\n\n int in_h = h / ").concat(n,";\n int offset_h = imod(h, ").concat(n,");\n int in_w = w / ").concat(n,";\n int offset_w = imod(w, ").concat(n,");\n int offset_d = (offset_h * ").concat(n," + offset_w) *\n ").concat(this.getOutputDepthSize(),";\n int in_d = d + offset_d;\n\n float result = ").concat(this.getInputSamplingString(),";\n setOutput(result);\n }\n ")}return p(e,[{key:"getHeightCoordString",value:function(){return"NHWC"===this.dataFormat?"coords[1]":"coords[2]"}},{key:"getWidthCoordString",value:function(){return"NHWC"===this.dataFormat?"coords[2]":"coords[3]"}},{key:"getDepthCoordString",value:function(){return"NHWC"===this.dataFormat?"coords[3]":"coords[1]"}},{key:"getOutputDepthSize",value:function(){return"NHWC"===this.dataFormat?this.outputShape[3]:this.outputShape[1]}},{key:"getInputSamplingString",value:function(){return"NHWC"===this.dataFormat?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"}}]),e}();var HAe={kernelName:p1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.blockSize,o=r.dataFormat,s=a.shape[0],u=("NHWC"===o?a.shape[1]:a.shape[2])*i,c=("NHWC"===o?a.shape[2]:a.shape[3])*i,l=("NHWC"===o?a.shape[3]:a.shape[1])/(i*i),h=new jAe("NHWC"===o?[s,u,c,l]:[s,l,u,c],i,o);return n.runWebGLProgram(h,[a],a.dtype)}},qAe=p((function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];l(this,e),this.variableNames=["x","W"],this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=t.outShape,this.enableShapeUniforms=iSe(this.outputShape.length);var o=t.filterHeight,s=t.filterWidth,u=t.outChannels/t.inChannels,c="",h="";r&&(c=a?"float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n ".concat(r,"\n }"):i?"float activation(float a) {\n float b = getLeakyreluAlphaAtOutCoords();\n ".concat(r,"\n }"):"\n float activation(float x) {\n ".concat(r,"\n }\n "),h="result = activation(result);");var p=n?"result += getBiasAtOutCoords();":"";n&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),i&&this.variableNames.push("leakyreluAlpha"),this.userCode="\n ".concat(c,"\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 / ").concat(u,";\n int q = d2 - d1 * ").concat(u,";\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 // TO DO(dsmilkov): Flatten the two for loops and vec4 the operations.\n for (int wR = 0; wR < ").concat(o,"; wR++) {\n int xR = xRCorner + wR * dilations[0];\n\n if (xR < 0 || xR >= inDims[0]) {\n continue;\n }\n\n for (int wC = 0; wC < ").concat(s,"; wC++) {\n int xC = xCCorner + wC * dilations[1];\n\n if (xC < 0 || xC >= inDims[1]) {\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\n float result = dotProd;\n ").concat(p,"\n ").concat(h,"\n setOutput(result);\n }\n ")})),KAe=p((function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];l(this,e),this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=t.outShape,this.enableShapeUniforms=iSe(this.outputShape.length);for(var o=t.outChannels/t.inChannels,s=t.padInfo.left,u=t.strideWidth,c=t.dilationWidth,h=t.filterHeight,p=t.filterWidth,f=p,d="\n int xR; int xC; int xCOffset;\n vec4 wTexel; vec4 previous; vec4 final;",v=0;v<p;v++)d+="\n vec4 xTexelC".concat(2*v,";\n int xTexelC").concat(2*v,"Ready;\n vec4 xTexelC").concat(2*v+1,";\n int xTexelC").concat(2*v+1,"Ready;\n vec4 xC").concat(v,";");d+="\n for (int r = 0; r < ".concat(h,"; r++) {\n ");for(var m=0;m<p;m++)d+="\n xTexelC".concat(2*m," = vec4(0.0);\n xTexelC").concat(2*m,"Ready = 0;\n xTexelC").concat(2*m+1," = vec4(0.0);\n xTexelC").concat(2*m+1,"Ready = 0;\n xC").concat(m," = vec4(0.0);");d+="\n xR = xRCorner + r * dilations[0];\n if (xR >=0 && xR < inDims[0]) {\n ";for(var g=0;g<(f+1)/2;g++){var y=2*g;if(d+="\n xC = xCCorner + ".concat(y*c,";\n "),1===u){if(y<p&&(s%2==1?(d+="\n xCOffset = xC + 1;\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC".concat(y,"Ready == 0) {\n xTexelC").concat(y," = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC").concat(y,".zw = vec2(0.0);\n }\n xTexelC").concat(y,"Ready = 1;\n }\n "),d+=1===c&&y>0?"\n xC".concat(y," = vec4(xTexelC").concat(y-2,".zw, xTexelC").concat(y,".xy);\n "):"\n xCOffset = xC + 1 - 2;\n\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n previous.zw = vec2(0.0);\n }\n\n xC".concat(y," = vec4(previous.zw, xTexelC").concat(y,".xy);\n } else {\n xC").concat(y," = vec4(0.0, 0.0, xTexelC").concat(y,".xy);\n }\n ")):d+="\n if (xC >= 0 && xC < inDims[1] && xTexelC".concat(y,"Ready == 0) {\n xTexelC").concat(y," = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC").concat(y,".zw = vec2(0.0);\n }\n xTexelC").concat(y,"Ready = 1;\n }\n\n xC").concat(y," = xTexelC").concat(y,";\n "),y+1<p)){var b=s%2==0?R$(c):c;c%2==0&&s%2==1||c%2!=0&&s%2!=1?(d+="\n xCOffset = xC + imod(pads[1], 2) + ".concat(b,";\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC").concat(y+1,"Ready == 0) {\n xTexelC").concat(y+1," = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC").concat(y+1,".zw = vec2(0.0);\n }\n xTexelC").concat(y+1,"Ready = 1;\n }\n "),d+=c>1?"\n xCOffset -= 2;\n if (xCOffset >= 0 && xCOffset < inDims[1]) {\n previous = getX(batch, xR, xCOffset, d1);\n xC".concat(y+1," = vec4(previous.zw, xTexelC").concat(y+1,".xy);\n } else {\n xC").concat(y+1," = vec4(0.0, 0.0, xTexelC").concat(y+1,".xy);\n }\n "):"\n xC".concat(y+1," = vec4(xTexelC").concat(y,".zw, xTexelC").concat(y+1,".xy);\n ")):d+=1===b?"\n xC".concat(y+1," = xTexelC").concat(y,";\n "):"\n xCOffset = xC + ".concat(b,";\n\n if (xCOffset >= 0 && xCOffset < inDims[1] && xTexelC").concat(y+1,"Ready == 0) {\n xTexelC").concat(y+1," = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC").concat(y+1,".zw = vec2(0.0);\n }\n xTexelC").concat(y+1,"Ready = 1;\n }\n\n xC").concat(y+1," = xTexelC").concat(y+1,";\n ")}}else y<p&&(s%2==1?(d+="\n xCOffset = xC + 1 - strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC".concat(y,"Ready == 0) {\n xTexelC").concat(y," = getX(batch, xR, xCOffset, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC").concat(y,".zw = vec2(0.0);\n }\n xTexelC").concat(y,"Ready = 1;\n }\n\n if(xC + 1 >= 0 && xC + 1 < inDims[1] && xTexelC").concat(y+1,"Ready == 0) {\n xTexelC").concat(y+1," = getX(batch, xR, xC + 1, d1);\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if (xC + 2 >= inDims[1]) {\n xTexelC").concat(y+1,".zw = vec2(0.0);\n }\n xTexelC").concat(y+1,"Ready = 1;\n }\n\n xC").concat(y," = vec4(xTexelC").concat(y,".zw, xTexelC").concat(y+1,".zw);\n "),y+1<p&&(d+="\n final = vec4(0.0);\n xCOffset = xC + 1 + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1]) {\n final = getX(batch, xR, xCOffset, d1);\n }\n xC".concat(y+1," = vec4(xTexelC").concat(y+1,".xy, final.xy);\n "))):(d+="\n if(xC >= 0 && xC < inDims[1] && xTexelC".concat(y,"Ready == 0) {\n xTexelC").concat(y," = getX(batch, xR, xC, d1);\n if (xC + 1 >= inDims[1]) {\n xTexelC").concat(y,".zw = vec2(0.0);\n }\n xTexelC").concat(y,"Ready = 1;\n }\n\n xCOffset = xC + strides[1];\n if(xCOffset >= 0 && xCOffset < inDims[1] && xTexelC").concat(y+1,"Ready == 0) {\n xTexelC").concat(y+1," = getX(batch, xR, xCOffset, d1);\n if (xCOffset + 1 >= inDims[1]) {\n xTexelC").concat(y+1,".zw = vec2(0.);\n }\n xTexelC").concat(y+1,"Ready = 1;\n }\n\n xC").concat(y," = vec4(\n xTexelC").concat(y,".xy, xTexelC").concat(y+1,".xy);\n "),y+1<p&&(d+="\n xC".concat(y+1," = vec4(xTexelC").concat(y,".zw, xTexelC").concat(y+1,".zw);\n "))));y<p&&(d+="\n wTexel = getW(r, ".concat(y,", d1, q);\n dotProd += xC").concat(y," * vec4(wTexel.xz, wTexel.xz);\n "),y+1<p&&(d+="\n wTexel = getW(r, ".concat(y+1,", d1, q);\n dotProd += xC").concat(y+1," * vec4(wTexel.xz, wTexel.xz);\n ")))}d+="\n }\n ",d+="\n }\n ";var x="",k="";r&&(x=a?"vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n ".concat(r,"\n }"):i?"vec4 activation(vec4 a) {\n vec4 b = getLeakyreluAlphaAtOutCoords();\n ".concat(r,"\n }"):"vec4 activation(vec4 x) {\n ".concat(r,"\n }"),k="result = activation(result);");var w=n?"result += getBiasAtOutCoords();":"";n&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),i&&this.variableNames.push("leakyreluAlpha"),this.userCode="\n ".concat(x,"\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 / ").concat(o,";\n int q = d2 - d1 * ").concat(o,";\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n //intialize dotProd with a small epsilon seems to reduce GPU accuracy loss.\n vec4 dotProd = vec4(0.000000000000001);\n\n ").concat(d,"\n\n vec4 result = dotProd - vec4(0.000000000000001);\n ").concat(w,"\n ").concat(k,"\n setOutput(result);\n }\n ")}));var XAe={kernelName:f1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.filter,o=r.strides,s=r.pad,u=r.dilations,c=r.dimRoundingMode,l=u;null==l&&(l=[1,1]),F$(L8(o,l),(function(){return"Error in depthwiseConv2d: Either strides or dilations must be "+"1. Got strides ".concat(o," and dilations '").concat(l,"'")}));var h,p=T8(a.shape,i.shape,o,l,s,c,!0);h=k0().getBool("WEBGL_PACK_DEPTHWISECONV")&&p.strideWidth<=2&&p.outChannels/p.inChannels==1?new KAe(p):new qAe(p);var f=[[p.padInfo.top,p.padInfo.left],[p.strideHeight,p.strideWidth],[p.dilationHeight,p.dilationWidth],[p.inHeight,p.inWidth]];return n.runWebGLProgram(h,[a,i],"float32",f)}},YAe=p((function e(t){l(this,e),this.variableNames=["x","dy"],this.outputShape=t.filterShape;var n=t.strideHeight,r=t.strideWidth,a=t.padInfo.top,i=t.padInfo.left,o=t.outChannels/t.inChannels;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int dm = coords.w;\n int d2 = d1 * ".concat(o," + dm;\n\n float dotProd = 0.0;\n\n // TO DO: Vec4 over the batch size\n for (int b = 0; b < ").concat(t.batchSize,"; b++) {\n for (int yR = 0; yR < ").concat(t.outHeight,"; yR++) {\n int xR = wR + yR * ").concat(n," - ").concat(a,";\n\n if (xR < 0 || xR >= ").concat(t.inHeight,") {\n continue;\n }\n\n for (int yC = 0; yC < ").concat(t.outWidth,"; yC++) {\n int xC = wC + yC * ").concat(r," - ").concat(i,";\n\n if (xC < 0 || xC >= ").concat(t.inWidth,") {\n continue;\n }\n\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n setOutput(dotProd);\n }\n ")})),JAe=p((function e(t){l(this,e),this.variableNames=["dy","W"],this.outputShape=t.inShape;var n=t.filterHeight,r=t.filterWidth,a=t.strideHeight,i=t.strideWidth,o=n-1-t.padInfo.top,s=r-1-t.padInfo.left,u=t.outChannels/t.inChannels;this.userCode="\n const ivec2 pads = ivec2(".concat(o,", ").concat(s,");\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 < ").concat(n,"; wR++) {\n float dyR = float(dyRCorner + wR) / ").concat(a,".0;\n\n if (dyR < 0.0 || dyR >= ").concat(t.outHeight,".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = ").concat(n," - 1 - wR;\n\n for (int wC = 0; wC < ").concat(r,"; wC++) {\n float dyC = float(dyCCorner + wC) / ").concat(i,".0;\n\n if (dyC < 0.0 || dyC >= ").concat(t.outWidth,".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = ").concat(r," - 1 - wC;\n\n // TO DO: Vec4 over the channelMul\n for (int dm = 0; dm < ").concat(u,"; dm++) {\n int d2 = d1 * ").concat(u," + 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 ")}));var ZAe={kernelName:d1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.dy,o=r.strides,s=r.dilations,u=r.pad,c=r.dimRoundingMode,l=r.filterShape,h=T8(a.shape,l,o,s,u,c,!0),p=new YAe(h);return n.runWebGLProgram(p,[a,i],"float32")}};var QAe={kernelName:v1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.dy,i=t.filter,o=r.strides,s=r.dilations,u=r.pad,c=r.dimRoundingMode,l=T8(r.inputShape,i.shape,o,s,u,c,!0),h=new JAe(l);return n.runWebGLProgram(h,[a,i],"float32")}},$Ae=p((function e(t){l(this,e),this.variableNames=["X"],this.outputShape=[t,t],this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0;\n setOutput(val);\n }\n "}));var eRe={kernelName:m1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.x,a=[].concat(T(r.shape),T(r.shape)),i=L$(r.shape),o=OEe({inputs:{x:r},backend:n,attrs:{shape:[i]}}),s=new $Ae(i),u=n.runWebGLProgram(s,[o],o.dtype),c=OEe({inputs:{x:u},backend:n,attrs:{shape:a}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(u),c}},tRe=p((function e(t){l(this,e),this.variableNames=["x","W"],this.outputShape=t.outShape;var n=t.inHeight,r=t.inWidth,a=t.padInfo,i=t.strideHeight,o=t.strideWidth,s=t.filterHeight,u=t.filterWidth,c=t.dilationHeight,h=t.dilationWidth,p=a.top,f=a.left;this.userCode="\n const ivec2 strides = ivec2(".concat(i,", ").concat(o,");\n const ivec2 pads = ivec2(").concat(p,", ").concat(f,");\n const float neg_infinity = -3.4e38;\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n int d1 = coords.w;\n ivec2 outTopLeftCorner =\n coords.yz * strides - pads;\n int hBeg = outTopLeftCorner.x;\n int wBeg = outTopLeftCorner.y;\n\n float curVal = neg_infinity;\n for (int h = 0; h < ").concat(s,"; h++) {\n int hIn = hBeg + h * ").concat(c,";\n\n if (hIn >= 0 && hIn < ").concat(n,") {\n for (int w = 0; w < ").concat(u,"; w++) {\n int wIn = wBeg + w * ").concat(h,";\n\n if (wIn >= 0 && wIn < ").concat(r,") {\n float xVal = getX(batch, hIn, wIn, d1);\n float wVal = getW(h, w, d1);\n\n float val = xVal + wVal;\n if (val > curVal) {\n curVal = val;\n }\n }\n }\n }\n }\n\n float result = curVal;\n setOutput(result);\n }\n ")}));var nRe={kernelName:g1,backendName:"webgl",kernelFunc:function(e){var t,n=e.inputs,r=e.backend,a=e.attrs,i=n.x,o=n.filter,s=a.strides,u=a.pad,c=a.dilations,l=I8(i.shape,o.shape,s,u,"NHWC",c),h=new tRe(l),p=OEe({inputs:{x:t=r.runWebGLProgram(h,[i,o],"float32")},backend:r,attrs:{shape:l.outShape}});return r.disposeIntermediateTensorInfo(t),p}};var rRe={kernelName:w1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t,a=Nie(e.attrs.equation,r.length),i=a.allDims,o=a.summedDims,s=a.idDims;Tie(i.length,s,r);for(var u=Eie(o,s),c=u.path,l=u.steps,h=l.length,p=null,f=i.length,d=[],v=0;v<h;++v){var m,g=O(l[v]);try{for(g.s();!(m=g.n()).done;){var y=m.value,b=Sie(f,s[y]),x=b.permutationIndices,k=b.expandDims,w=void 0;Cie(x)?w=r[y]:(w=UEe({inputs:{x:r[y]},backend:n,attrs:{perm:x}}),d.push(w));for(var I=w.shape.slice(),N=0;N<k.length;++N)I.splice(k[N],0,1);P$(w.shape,I)||(w=OEe({inputs:{x:w},backend:n,attrs:{shape:I}}),d.push(w)),null===p?p=w:(p=REe({inputs:{a:w,b:p},backend:n}),d.push(p))}}catch(e){g.e(e)}finally{g.f()}v<h-1&&(c[v]>=0&&(p=WEe({inputs:{x:p},backend:n,attrs:{axis:c[v]-(i.length-f),keepDims:!1}}),d.push(p)),f--)}for(var S=0,T=d;S<T.length;S++){var E=T[S];E!==p&&n.disposeIntermediateTensorInfo(E)}return p}},aRe=wEe({opSnippet:"return (x >= 0.0) ? x : (exp(x) - 1.0);",packedOpSnippet:"\n vec4 result;\n\n result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);\n result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);\n result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);\n result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);\n\n return result;\n"}),iRe={kernelName:I1,backendName:"webgl",kernelFunc:aRe},oRe={kernelName:N1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.dy,a=t.y,i=k0().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new hEe("\n vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));\n return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));\n",r.shape,a.shape):new cEe("return (b >= 0.0) ? a : a * (b + 1.0);",r.shape,a.shape);return n.runWebGLProgram(i,[r,a],r.dtype)}},sRe=IEe({opSnippet:"return float(a == b);",packedOpSnippet:"\n return vec4(equal(a, b));\n",dtype:"bool",cpuKernelImpl:jSe}),uRe={kernelName:T1,backendName:"webgl",kernelFunc:sRe},cRe=wEe({opSnippet:'\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 = '.concat(uie,";\n float a1 = ").concat(cie,";\n float a2 = ").concat(lie,";\n float a3 = ").concat(hie,";\n float a4 = ").concat(pie,";\n float a5 = ").concat(fie,";\n\n float sign = sign(x);\n x = abs(x);\n float t = 1.0 / (1.0 + p * x);\n return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x));\n")}),lRe={kernelName:S1,backendName:"webgl",kernelFunc:cRe},hRe=wEe({opSnippet:"if (isnan(x)) return x;\n return exp(x);\n",packedOpSnippet:"\n vec4 result = exp(x);\n bvec4 isNaN = isnan(x);\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n",cpuKernelImpl:HSe,dtype:"float32"}),pRe={kernelName:E1,backendName:"webgl",kernelFunc:hRe};function fRe(e){var t=e.inputs,n=e.attrs,r=e.backend,a=n.dim,i=t.input,o=i.shape.length,s=i.shape.slice(),u=a;return a<0&&(F$(-(o+1)<=a,(function(){return"Axis must be in the interval [".concat(-(o+1),", ").concat(o,"]")})),u=o+a+1),s.splice(u,0,1),OEe({inputs:{x:i},backend:r,attrs:{shape:s}})}var dRe={kernelName:C1,backendName:"webgl",kernelFunc:fRe},vRe="return exp(x) - 1.0;",mRe=wEe({opSnippet:vRe,packedOpSnippet:vRe,cpuKernelImpl:qSe}),gRe={kernelName:A1,backendName:"webgl",kernelFunc:mRe},yRe=p((function e(t,n,r){l(this,e),this.variableNames=["real","imag"];var a=n[1];this.outputShape=n;var i,o=r?"2.0 * ".concat(Math.PI):"-2.0 * ".concat(Math.PI),s=r?"".concat(a,".0"):"1.0";if("real"===t)i="return real * expR - imag * expI;";else{if("imag"!==t)throw new Error('FFT component must be either "real" or "imag", got '.concat(t,"."));i="return real * expI + imag * expR;"}this.userCode="\n const float exponentMultiplier = ".concat(o,";\n\n float unaryOpComplex(float real, float expR, float imag, float expI) {\n ").concat(i,"\n }\n\n float mulMatDFT(int batch, int index) {\n float indexRatio = float(index) / float(").concat(a,");\n float exponentMultiplierTimesIndexRatio =\n exponentMultiplier * indexRatio;\n\n float result = 0.0;\n\n for (int i = 0; i < ").concat(a,"; i++) {\n // x = (-2|2 * PI / N) * index * i;\n float x = exponentMultiplierTimesIndexRatio * float(i);\n float expR = cos(x);\n float expI = sin(x);\n float real = getReal(batch, i);\n float imag = getImag(batch, i);\n\n result +=\n unaryOpComplex(real, expR, imag, expI) / ").concat(s,";\n }\n\n return result;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n setOutput(mulMatDFT(coords[0], coords[1]));\n }\n ")}));function bRe(e,t,n){var r=n.texData.get(e.dataId),a=L$(e.shape),i=e.shape[e.shape.length-1],o=OEe({inputs:{x:e},backend:n,attrs:{shape:[a/i,i]}}),s=o.shape,u=new yRe("real",s,t),c=new yRe("imag",s,t),l=[{dataId:r.complexTensorInfos.real.dataId,dtype:r.complexTensorInfos.real.dtype,shape:s},{dataId:r.complexTensorInfos.imag.dataId,dtype:r.complexTensorInfos.imag.dtype,shape:s}],h=n.runWebGLProgram(u,l,"float32"),p=n.runWebGLProgram(c,l,"float32"),f=dEe({inputs:{real:h,imag:p},backend:n});n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p);var d=OEe({inputs:{x:f},backend:n,attrs:{shape:e.shape}});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(f),d}var xRe={kernelName:R1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend;return bRe(t.input,!1,n)}},kRe=p((function e(t,n){l(this,e),this.outputShape=[],this.customUniforms=[{name:"value",type:"float"}],this.variableNames=["x"],this.outputShape=t,this.userCode="\n void main() {\n // Input can be obtained from uniform value.\n setOutput(value);\n }\n "}));function wRe(e){var t=e.backend,n=e.attrs,r=n.shape,a=n.value,i=n.dtype;if("string"===(i=i||n0(a))){var o=K$(i,L$(r));return o.fill(a),t.makeTensorInfo(r,i,o)}var s=new kRe(r,a),u=[[a]];return t.runWebGLProgram(s,[],i,u)}var IRe,NRe={kernelName:_1,backendName:"webgl",kernelFunc:wRe},SRe=p((function e(t){l(this,e),this.variableNames=["Image"],this.outputShape=[];var n=t[2];this.outputShape=t,this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int x = coords[2];\n\n int coordX = ".concat(n," - x - 1;\n float outputValue;\n if(coordX >= 0 && coordX < ").concat(n,") {\n outputValue = getImage(coords[0], coords[1], coordX, coords[3]);\n } else {\n outputValue = getImage(coords[0], coords[1], coords[2], coords[3]);\n }\n setOutput(outputValue);\n }\n ")})),TRe={kernelName:O1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.image,a=n,i=new SRe(r.shape);return a.runWebGLProgram(i,[r],r.dtype)}},ERe="return floor(x);",CRe=wEe({opSnippet:ERe,packedOpSnippet:ERe,cpuKernelImpl:KSe}),ARe={kernelName:F1,backendName:"webgl",kernelFunc:CRe},RRe=IEe({opSnippet:"\n float s = sign(a) * sign(b);\n int ia = round(a);\n int ib = round(b);\n if (ib != 0) {\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n return float(idiv(ia, ib, s));\n } else {\n return NAN;\n }\n",packedOpSnippet:"\n ivec4 ia = round(a);\n ivec4 ib = round(b);\n bvec4 cond = notEqual(ib, ivec4(0));\n ivec4 result = ivec4(0);\n vec4 s = sign(a) * sign(b);\n\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n if (cond[0]) {\n result[0] = idiv(ia[0], ib[0], s[0]);\n }\n if (cond[1]) {\n result[1] = idiv(ia[1], ib[1], s[1]);\n }\n if (cond[2]) {\n result[2] = idiv(ia[2], ib[2], s[2]);\n }\n if (cond[3]) {\n result[3] = idiv(ia[3], ib[3], s[3]);\n }\n return vec4(result);\n",dtype:"int32"}),_Re={kernelName:D1,backendName:"webgl",kernelFunc:RRe},ORe=p((function e(t){l(this,e),this.variableNames=["A"];var n=SNe(),r=S(t,2),a=r[0],i=r[1];this.outputShape=t,this.userCode="\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(".concat(i,".0, ").concat(a,".0);\n\n vec4 values = ").concat(n.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 ")})),FRe=p((function e(t){l(this,e),this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;var n=SNe(),r=S(t,2),a=r[0],i=r[1];this.outputShape=t,this.userCode="\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n\n vec4 result = vec4(0.);\n\n for(int row=0; row<=1; row++) {\n for(int col=0; col<=1; col++) {\n texC = coords[1] + row;\n depth = coords[2] + col;\n\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2(".concat(i,".0, ").concat(a,".0);\n vec4 values = ").concat(n.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 result[row * 2 + col] = floor(value * 255.0 + 0.5);\n }\n }\n\n ").concat(n.output," = result;\n }\n ")})),DRe={kernelName:O3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.pixels,i=r.numChannels,o="undefined"!=typeof HTMLVideoElement&&a instanceof HTMLVideoElement,s="undefined"!=typeof HTMLImageElement&&a instanceof HTMLImageElement,u=S(o?[a.videoWidth,a.videoHeight]:[a.width,a.height],2),c=u[0],l=u[1],h=[l,c],p=[l,c,i];if(s||o){var f=k0().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU");null!=IRe&&f===MRe||(MRe=f,IRe=document.createElement("canvas").getContext("2d",{willReadFrequently:MRe})),IRe.canvas.width=c,IRe.canvas.height=l,IRe.drawImage(a,0,0,c,l),a=IRe.canvas}var d=n.makeTensorInfo(h,"int32");n.texData.get(d.dataId).usage=wIe.PIXELS,n.gpgpu.uploadPixelDataToTexture(n.getTexture(d.dataId),a);var v=k0().getBool("WEBGL_PACK")?new FRe(p):new ORe(p),m=n.runWebGLProgram(v,[d],"int32");return n.disposeData(d.dataId),m}},MRe=k0().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU");var LRe={kernelName:M3,backendName:"webgl",kernelFunc:function(e){var t,n=e.inputs,r=e.backend,a=e.attrs,i=n.x,o=n.filter,s=n.bias,u=n.preluActivationWeights,c=a.strides,l=a.pad,h=a.dataFormat,p=a.dilations,f=a.dimRoundingMode,d=a.activation,v=a.leakyreluAlpha,m=P8(h),g=T8(i.shape,o.shape,c,p,l,f,!1,m),y=[],b=null!=s,x=null!=u,k="leakyrelu"===d,w=function(){var e=[i,o],t=function(e,t){if("NCHW"===t&&1===e.shape.length&&1!==e.shape[0]){var n=OEe({inputs:{x:e},backend:r,attrs:{shape:[e.shape[0],1,1]}});return y.push(n),n}return e};if(b&&e.push(t(s,h)),x&&e.push(t(u,h)),k){var n=r.makeTensorInfo([],"float32",M4(v,"float32"));e.push(n),y.push(n)}return e};if(1!==g.filterHeight||1!==g.filterWidth||1!==g.dilationHeight||1!==g.dilationWidth||1!==g.strideHeight||1!==g.strideWidth||"SAME"!==g.padInfo.type&&"VALID"!==g.padInfo.type)if(g.strideWidth<=2&&"channelsLast"===m&&k0().getBool("WEBGL_EXP_CONV")){var I=d?NEe(d,!0):null,N=new dAe(g,b,I,x,k),S=[[g.padInfo.top,g.padInfo.left],[g.strideHeight,g.strideWidth],[g.dilationHeight,g.dilationWidth],[g.inHeight,g.inWidth]],T=w();t=r.runWebGLProgram(N,T,"float32",S)}else if(k0().getBool("WEBGL_CONV_IM2COL"))t=yAe({x:i,filter:o,convInfo:g,backend:r,bias:s,activation:d,preluActivationWeights:u,leakyreluAlpha:v});else{var E=d?NEe(d,!1):null,C=new pAe(g,b,E,x,k),A=w();t=r.runWebGLProgram(C,A,"float32")}else t=gAe({x:i,filter:o,convInfo:g,backend:r,bias:s,activation:d,preluActivationWeights:u,leakyreluAlpha:v});var R=OEe({inputs:{x:t},backend:r,attrs:{shape:g.outShape}});return y.push(t),y.forEach((function(e){return r.disposeIntermediateTensorInfo(e)})),R}};var zRe={kernelName:L3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.filter,o=t.bias,s=t.preluActivationWeights,u=r.strides,c=r.pad,l=r.dilations,h=r.dimRoundingMode,p=r.activation,f=r.leakyreluAlpha,d=[],v=l;null==v&&(v=[1,1]),F$(L8(u,v),(function(){return"Error in depthwiseConv2d: Either strides or dilations must be "+"1. Got strides ".concat(u," and dilations '").concat(v,"'")}));var m,g=T8(a.shape,i.shape,u,v,c,h,!0),y=k0().getBool("WEBGL_PACK_DEPTHWISECONV")&&g.strideWidth<=2&&g.outChannels/g.inChannels==1,b=p?NEe(p,y):null,x=[a,i],k=null!=o,w=null!=s,I="leakyrelu"===p;if(k&&x.push(o),w&&x.push(s),I){var N=n.makeTensorInfo([],"float32",M4(f,"float32"));x.push(N),d.push(N)}m=y?new KAe(g,k,b,w,I):new qAe(g,k,b,w,I);var S=[[g.padInfo.top,g.padInfo.left],[g.strideHeight,g.strideWidth],[g.dilationHeight,g.dilationWidth],[g.inHeight,g.inWidth]],T=n.runWebGLProgram(m,x,"float32",S);return d.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),T}},PRe=p((function e(t,n,r,a){l(this,e),this.sliceDim=t,this.strides=n,this.paramsShape=a,this.variableNames=["x","indices"],this.outputShape=r;for(var i=JNe(r.length),o="\n int index;",s=0;s<this.sliceDim;s++)o+="\n index = round(getIndices(coords[0], ".concat(s,"));\n out_of_bounds = out_of_bounds || index < 0;\n out_of_bounds = out_of_bounds || index >= ").concat(this.paramsShape[s],";\n flattenIndex += index * ").concat(this.strides[s],";");this.userCode="\n void main() {\n ".concat(i," coords = getOutputCoords();\n int flattenIndex = 0;\n bool out_of_bounds = false;\n\n ").concat(o,"\n\n setOutput(out_of_bounds ? 0.0 : getX(flattenIndex, coords[1]));\n }\n ")}));var BRe={kernelName:z1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.params,a=t.indices,i=a.shape,o=i[i.length-1],s=L$(r.shape),u=S(Iae(r,a),4),c=u[0],l=u[1],h=u[2],p=u[3],f=OEe({inputs:{x:a},backend:n,attrs:{shape:[l,o]}}),d=OEe({inputs:{x:r},backend:n,attrs:{shape:[L$(r.shape)/h,h]}});if(n.shouldExecuteOnCPU([r,a])||"string"===r.dtype){var v=n.readSync(a.dataId),m=n.bufferSync(r),g=XSe(v,m,r.dtype,l,o,h,p,r.shape,s);return n.makeTensorInfo(c,r.dtype,g.values)}var y=new PRe(o,p,[l,h],r.shape),b=n.runWebGLProgram(y,[d,f],d.dtype),x=OEe({inputs:{x:b},backend:n,attrs:{shape:c}});return n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(b),x}},WRe=p((function e(t,n){l(this,e),this.variableNames=["A","indices"],this.outputShape=n,this.rank=n.length;var r=JNe(this.rank),a=function(e,t){for(var n=["resRC.x","resRC.y","resRC.z","resRC.w"],r=[],a=0;a<e.length;a++)2===a?r.push("index"):r.push("".concat(n[a]));return r.join()}(t);this.userCode="\n void main() {\n ".concat(r," resRC = getOutputCoords();\n int index = int(getIndices(resRC.x, resRC.z));\n float inBounds = (index >= 0) && (index < ").concat(t[2],") ? 1.0 : 0.0;\n setOutput(inBounds * getA(").concat(a,"));\n }\n ")}));function VRe(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.indices,o=r.axis,s=r.batchDims,u=j$(o,a.shape)[0];if(k0().get("DEBUG"))for(var c=n.readSync(i.dataId),l=a.shape[u],h=function(){var e=c[p];F$(e<=l-1&&e>=0,(function(){return"GatherV2: the index value ".concat(e," is not in [0, ").concat(l-1,"]")}))},p=0;p<c.length;++p)h();var f=Hie(a,i,u,s),d=L$(i.shape),v=[],m=OEe({inputs:{x:a},backend:n,attrs:{shape:[f.batchSize,f.outerSize,f.dimSize,f.sliceSize]}}),g=OEe({inputs:{x:i},backend:n,attrs:{shape:[f.batchSize,d/f.batchSize]}});v.push(m),v.push(g);var y=[f.batchSize,f.outerSize,d/f.batchSize,f.sliceSize];if(n.shouldExecuteOnCPU([a,i])||"string"===a.dtype){var b=n.bufferSync(g),x=n.bufferSync(m),k=YSe(x,b,y);return v.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),n.makeTensorInfo(f.outputShape,k.dtype,k.values)}var w=new WRe(m.shape,y),I=n.runWebGLProgram(w,[m,g],m.dtype);v.push(I);var N=OEe({inputs:{x:I},backend:n,attrs:{shape:f.outputShape}});return v.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),N}var URe={kernelName:L1,backendName:"webgl",kernelFunc:VRe},GRe=IEe({opSnippet:"return float(a > b);",packedOpSnippet:"\n return vec4(greaterThan(a, b));\n",cpuKernelImpl:JSe,dtype:"bool"}),jRe={kernelName:P1,backendName:"webgl",kernelFunc:GRe},HRe=IEe({opSnippet:"return float(a >= b);",packedOpSnippet:"\n return vec4(greaterThanEqual(a, b));\n",dtype:"bool",cpuKernelImpl:ZSe}),qRe={kernelName:B1,backendName:"webgl",kernelFunc:HRe};var KRe={kernelName:V1,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend;return bRe(t.input,!0,n)}},XRe=wEe({opSnippet:"return float(!isnan(x) && !isinf(x));",dtype:"bool"}),YRe={kernelName:G1,backendName:"webgl",kernelFunc:XRe},JRe=wEe({opSnippet:"return float(isinf(x));",dtype:"bool"}),ZRe={kernelName:j1,backendName:"webgl",kernelFunc:JRe},QRe=wEe({opSnippet:"return float(isnan(x));",dtype:"bool"}),$Re={kernelName:H1,backendName:"webgl",kernelFunc:QRe},e_e=IEe({opSnippet:"return float(a < b);",packedOpSnippet:"\n return vec4(lessThan(a, b));\n",cpuKernelImpl:QSe,dtype:"bool"}),t_e={kernelName:K1,backendName:"webgl",kernelFunc:e_e},n_e=IEe({opSnippet:"return float(a <= b);",packedOpSnippet:"\n return vec4(lessThanEqual(a, b));\n",cpuKernelImpl:$Se,dtype:"bool"}),r_e={kernelName:X1,backendName:"webgl",kernelFunc:n_e};var a_e={kernelName:Y1,backendName:"webgl",kernelFunc:function(e){var t=e.backend,n=e.attrs,r=n.start,a=n.stop,i=n.num,o=eTe(r,a,i);return t.makeTensorInfo([o.length],"float32",o)}},i_e=wEe({opSnippet:"if (isnan(x)) return x;\n return x < 0.0 ? 0./0. : log(x);\n",packedOpSnippet:"\n vec4 result = log(x);\n bvec4 isNaN = isnan(x);\n result.r = isNaN.r ? x.r : (x.r < 0.0 ? 0./0. : result.r);\n result.g = isNaN.g ? x.g : (x.g < 0.0 ? 0./0. : result.g);\n result.b = isNaN.b ? x.b : (x.b < 0.0 ? 0./0. : result.b);\n result.a = isNaN.a ? x.a : (x.a < 0.0 ? 0./0. : result.a);\n return result;\n",cpuKernelImpl:tTe}),o_e={kernelName:J1,backendName:"webgl",kernelFunc:i_e},s_e=wEe({opSnippet:"if (isnan(x)) return x;\n return log(1.0 + x);\n"}),u_e={kernelName:Z1,backendName:"webgl",kernelFunc:s_e},c_e=IEe({opSnippet:"return float(a >= 1.0 && b >= 1.0);",packedOpSnippet:"\n return vec4(\n vec4(greaterThanEqual(a, vec4(1.0))) *\n vec4(greaterThanEqual(b, vec4(1.0))));\n",dtype:"bool"}),l_e={kernelName:Q1,backendName:"webgl",kernelFunc:c_e},h_e=wEe({opSnippet:"return float(!(x >= 1.0));"}),p_e={kernelName:$1,backendName:"webgl",kernelFunc:h_e},f_e=IEe({opSnippet:"return float(a >= 1.0 || b >= 1.0);",packedOpSnippet:"\n return min(\n vec4(greaterThanEqual(a, vec4(1.0))) +\n vec4(greaterThanEqual(b, vec4(1.0))),\n vec4(1.0));\n",dtype:"bool"}),d_e={kernelName:e2,backendName:"webgl",kernelFunc:f_e},v_e=p((function e(t,n,r,a,i){l(this,e),this.variableNames=["x"],this.outputShape=[];var o,s=n,u=t[3]-1;this.outputShape=t;var c="float(".concat(r,") + float(").concat(a,") * sum");o=.5===i?"inversesqrt(".concat(c,")"):1===i?"1.0/(".concat(c,")"):"exp(log(".concat(c,") * float(-").concat(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 = -".concat(s,"; j <= ").concat(s,"; j++) {\n int idx = d + j;\n if (idx >= 0 && idx <= ").concat(u,") {\n float z = getX(b, r, c, idx);\n sum += z * z;\n }\n }\n float val = x * ").concat(o,";\n setOutput(val);\n }\n ")})),m_e=p((function e(t,n,r,a,i){l(this,e),this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;var o,s=n,u=t[3]-1;this.outputShape=t;var c="float(".concat(r,") + float(").concat(a,") * sum");o=.5===i?"inversesqrt(".concat(c,")"):1===i?"1.0/(".concat(c,")"):"exp(log(".concat(c,") * float(-").concat(i,"));"),this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords.x;\n int r = coords.y;\n int c = coords.z;\n int d = coords.w;\n\n bool hasNextCol = d < ".concat(this.outputShape[3],";\n bool hasNextRow = c < ").concat(this.outputShape[2],";\n\n vec4 sum = vec4(0.);\n vec4 xFragAtOutputCoords = getX(b, r, c, d);\n\n vec4 xAtOutputCoords = vec4(\n getChannel(xFragAtOutputCoords, vec2(c, d)),\n hasNextCol ?\n getChannel(xFragAtOutputCoords, vec2(c, d + 1)) : 0.0,\n hasNextRow ?\n getChannel(xFragAtOutputCoords , vec2(c + 1, d)) : 0.0,\n (hasNextRow && hasNextCol) ?\n getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0\n );\n\n int firstChannel = d - ").concat(s,";\n vec2 cache = vec2(0.);\n if(firstChannel >= 0){\n vec4 firstChannelFrag = getX(b, r, c, firstChannel);\n cache.x = getChannel(firstChannelFrag, vec2(c, firstChannel));\n if(hasNextRow){\n cache.y = getChannel(firstChannelFrag, vec2(c + 1, firstChannel));\n }\n }\n\n ivec2 depth = ivec2(d, d + 1);\n for (int j = - ").concat(s,"; j <= ").concat(s,"; j++) {\n ivec2 idx = depth + j;\n bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0));\n bvec2 belowUpperBound = lessThanEqual(idx, ivec2(").concat(u,"));\n\n bool depthInRange = aboveLowerBound.x && belowUpperBound.x;\n bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y;\n\n if(depthInRange || depthPlusOneInRange){\n vec4 z = vec4(0.);\n vec4 xFragAtCurrentDepth;\n z.xz = cache.xy;\n if(depthPlusOneInRange && hasNextCol){\n xFragAtCurrentDepth = idx.y != d ?\n getX(b, r, c, idx.y) : xFragAtOutputCoords;\n z.y = getChannel(xFragAtCurrentDepth, vec2(c, idx.y));\n if(hasNextRow){\n z.w = getChannel(xFragAtCurrentDepth, vec2(c + 1, idx.y));\n }\n }\n cache.xy = z.yw;\n sum += z * z;\n }\n }\n vec4 result = xAtOutputCoords * ").concat(o,";\n setOutput(result);\n }\n ")})),g_e={kernelName:n2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.depthRadius,o=r.bias,s=r.alpha,u=r.beta,c=k0().getBool("WEBGL_PACK_NORMALIZATION")?new m_e(a.shape,i,o,s,u):new v_e(a.shape,i,o,s,u);return n.runWebGLProgram(c,[a],a.dtype)}},y_e=p((function e(t,n,r,a,i){l(this,e),this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=t,this.depth=t[3],this.depthRadius=n,this.bias=r,this.alpha=a,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 < ".concat(this.depth,"; ++d) {\n int depthBegin = int(max(0.0, float(d - ").concat(n,")));\n int depthEnd = int(min(float(").concat(this.depth,"),\n float(d + ").concat(n," + 1)));\n\n const int MIN_DEPTH_BEGIN = 0;\n const int MAX_DEPTH_END = ").concat(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(").concat(a,") * norm + float(").concat(r,");\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(").concat(a,")\n * float(").concat(i,")\n * getInputImage(b, r, c, k) * getOutputImage(b, r, c, d)\n / norm;\n if (k == d) {\n dyi += pow(norm, -1.0 * ").concat(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 ")})),b_e={kernelName:r2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.y,o=t.dy,s=r.depthRadius,u=r.bias,c=r.alpha,l=r.beta,h=new y_e(a.shape,s,u,c,l);return n.runWebGLProgram(h,[a,i,o],a.dtype)}};function x_e(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.reductionIndices,o=r.keepDims,s=a.shape.length,u=j$(i,a.shape),c=u,l=H7(c,s),h=null!=l,p=n.shouldExecuteOnCPU([a]),f=a;if(h){if(p){for(var d=n.texData.get(f.dataId).values,v=new Array(s),m=0;m<v.length;m++)v[m]=a.shape[l[m]];var g=RTe(d,a.shape,a.dtype,l,v);f=n.makeTensorInfo(v,a.dtype),n.texData.get(f.dataId).values=g}else f=BEe(a,l,n);c=K7(c.length,s)}j7("max",c,s);var y,b=S(U7(f.shape,c),2),x=b[0],k=b[1],w=x;if(o&&(w=G7(x,u)),p){var I=n.texData.get(f.dataId).values,N=nTe(I,L$(k),w,a.dtype);y=n.makeTensorInfo(w,a.dtype),n.texData.get(y.dataId).values=N}else y=function(e,t,n,r){var a=L$(t),i=OEe({inputs:{x:e},attrs:{shape:[L$(e.shape)/a,a]},backend:r}),o=LEe(i,e.dtype,"max",r),s=OEe({inputs:{x:o},attrs:{shape:n},backend:r});return r.disposeIntermediateTensorInfo(i),r.disposeIntermediateTensorInfo(o),s}(f,k,w,n);return h&&n.disposeIntermediateTensorInfo(f),y}var k_e={kernelName:a2,backendName:"webgl",kernelFunc:x_e},w_e=IEe({opSnippet:"\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return max(a, b);\n",packedOpSnippet:"\n vec4 result = vec4(max(a, b));\n bvec4 isNaNA = isnan(a);\n bvec4 isNaNB = isnan(b);\n bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n \n result.r = isNaN.r ? NAN : result.r;\n result.g = isNaN.g ? NAN : result.g;\n result.b = isNaN.b ? NAN : result.b;\n result.a = isNaN.a ? NAN : result.a;\n\n return result;\n",cpuKernelImpl:rTe}),I_e={kernelName:i2,backendName:"webgl",kernelFunc:w_e};var N_e={kernelName:o2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x;wNe(a,"maxPool");var i=r.filterSize,o=r.strides,s=r.pad,u=r.dimRoundingMode;F$(L8(o,1),(function(){return"Error in maxPool: Either strides or dilations must be 1. "+"Got strides ".concat(o," and dilations '").concat(1,"'")}));var c=N8(a.shape,i,o,1,s,u);if(1===c.filterWidth&&1===c.filterHeight&&P$(c.inShape,c.outShape))return pEe({inputs:{x:a},backend:n});var l=new ICe(c,"max",!1);return n.runWebGLProgram(l,[a],a.dtype)}};var S_e={kernelName:u2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.filterSize,o=r.strides,s=r.pad,u=r.dataFormat,c=r.dimRoundingMode,l=S8(a.shape,i,o,[1,1,1],s,c,u),h=new NCe(l,"max",!1);return n.runWebGLProgram(h,[a],a.dtype)}},T_e=p((function e(t){l(this,e),this.variableNames=["dy","maxPos"],this.outputShape=t.inShape;var n=t.strideHeight,r=t.strideWidth,a=t.dilationHeight,i=t.effectiveFilterHeight,o=t.effectiveFilterWidth,s=i-1-t.padInfo.top,u=o-1-t.padInfo.left,c=i*o-1;this.userCode="\n const ivec2 pads = ivec2(".concat(s,", ").concat(u,");\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 < ").concat(i,";\n wR += ").concat(a,") {\n float dyR = float(dyRCorner + wR) / ").concat(n,".0;\n\n if (dyR < 0.0 || dyR >= ").concat(t.outHeight,".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ").concat(o,"; wC++) {\n float dyC = float(dyCCorner + wC) / ").concat(r,".0;\n\n if (dyC < 0.0 || dyC >= ").concat(t.outWidth,".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n int maxPosValue = ").concat(c," - 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 * ").concat(o," + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n setOutput(dotProd);\n }\n ")})),E_e=p((function e(t){l(this,e),this.variableNames=["dy","maxPos"],this.outputShape=t.inShape;var n=t.strideDepth,r=t.strideHeight,a=t.strideWidth,i=t.dilationDepth,o=t.dilationHeight,s=t.dilationWidth,u=t.effectiveFilterDepth,c=t.effectiveFilterHeight,h=t.effectiveFilterWidth,p=u-1-t.padInfo.front,f=c-1-t.padInfo.top,d=h-1-t.padInfo.left,v=u*c*h-1;this.userCode="\n const ivec3 pads = ivec3(".concat(p,", ").concat(f,", ").concat(d,");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyDCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n // Convolve dy(?, ?, ?, ch) with pos mask(:, :, :, d) to get\n // dx(xD, xR, xC, ch).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int wD = 0; wD < ").concat(u,";\n wD += ").concat(i,") {\n float dyD = float(dyDCorner + wD) / ").concat(n,".0;\n\n if (dyD < 0.0 || dyD >= ").concat(t.outDepth,".0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < ").concat(c,";\n wR += ").concat(o,") {\n float dyR = float(dyRCorner + wR) / ").concat(r,".0;\n\n if (dyR < 0.0 || dyR >= ").concat(t.outHeight,".0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < ").concat(h,";\n wC += ").concat(s,") {\n float dyC = float(dyCCorner + wC) / ").concat(a,".0;\n\n if (dyC < 0.0 || dyC >= ").concat(t.outWidth,".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n int maxPosValue = ").concat(v," -\n int(getMaxPos(batch, idyD, idyR, idyC, ch));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue =\n wD * ").concat(c," * ").concat(h," +\n wR * ").concat(h," + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n }\n setOutput(dotProd);\n }\n ")}));var C_e={kernelName:c2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.dy,i=t.input,o=r.filterSize,s=r.strides,u=r.pad,c=r.dimRoundingMode,l=S8(i.shape,o,s,[1,1,1],u,c),h=new NCe(l,"max",!0),p=n.runWebGLProgram(h,[i],i.dtype),f=new E_e(l),d=n.runWebGLProgram(f,[a,p],i.dtype);return n.disposeIntermediateTensorInfo(p),d}};var A_e={kernelName:s2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.dy,i=t.input,o=i;wNe([i,t.output],"maxPoolGrad");var s=r.filterSize,u=r.strides,c=r.pad,l=r.dimRoundingMode,h=N8(o.shape,s,u,1,c,l),p=new ICe(h,"max",!0),f=n.runWebGLProgram(p,[o],o.dtype),d=new T_e(h),v=n.runWebGLProgram(d,[a,f],o.dtype);return n.disposeIntermediateTensorInfo(f),v}};var R_e={kernelName:l2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.attrs,r=e.backend,a=t.x,i=n.filterSize,o=n.strides,s=n.pad,u=n.includeBatchInIndex,c=r;F$(4===a.shape.length,(function(){return"Error in maxPool: input must be rank 4 but got rank ".concat(a.shape.length,".")}));var l=[1,1];F$(L8(o,l),(function(){return"Error in maxPool: Either strides or dilations must be 1. "+"Got strides ".concat(o," and dilations '").concat(l,"'")}));var h=N8(a.shape,i,o,l,s),p=function(e,t,n,r){var a=new ICe(n,"max",!1),i=r.runWebGLProgram(a,[e],"float32");return a=new ICe(n,"max",!0,!0,t),[i,r.runWebGLProgram(a,[e],"float32")]}(a,u,h,c),f=S(p,2);return[f[0],f[1]]}};var __e={kernelName:h2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.attrs,r=e.backend,a=t.x,i=n.keepDims,o=n.axis,s=r,u=a.shape.length,c=j$(o,a.shape),l=c,h=H7(l,u),p=null!=h,f=s.shouldExecuteOnCPU([a]),d=[],v=a;if(p){if(f){for(var m=s.texData.get(v.dataId).values,g=new Array(u),y=0;y<g.length;y++)g[y]=a.shape[h[y]];var b=RTe(m,a.shape,a.dtype,h,g);v=s.makeTensorInfo(g,a.dtype),s.texData.get(v.dataId).values=b}else v=BEe(a,h,s);d.push(v),l=K7(l.length,u)}j7("sum",l,u);var x=S(U7(v.shape,l),2),k=x[0],w=x[1],I=k;i&&(I=G7(k,c));for(var N=function(e,t,n,r){var a=L$(t),i=OEe({inputs:{x:e},attrs:{shape:[L$(e.shape)/a,a]},backend:r}),o=LEe(i,"float32","mean",r),s=OEe({inputs:{x:o},attrs:{shape:n},backend:r});return r.disposeIntermediateTensorInfo(i),r.disposeIntermediateTensorInfo(o),s}(v,w,I,s),T=0,E=d;T<E.length;T++){var C=E[T];s.disposeIntermediateTensorInfo(C)}return N}};var O_e={kernelName:p2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.axis,o=r.keepDims,s=a.shape.length,u=j$(i,a.shape),c=u,l=H7(c,s),h=a;null!=l&&(h=UEe({inputs:{x:a},backend:n,attrs:{perm:l}}),c=K7(c.length,a.shape.length)),j7("min",c,s);var p,f=S(U7(h.shape,c),2),d=f[0],v=OEe({inputs:{x:h},backend:n,attrs:{shape:[-1,L$(f[1])]}}),m=LEe(v,v.dtype,"min",n);return p=OEe(o?{inputs:{x:m},backend:n,attrs:{shape:G7(d,u)}}:{inputs:{x:m},backend:n,attrs:{shape:d}}),n.disposeIntermediateTensorInfo(v),n.disposeIntermediateTensorInfo(m),null!=l&&n.disposeIntermediateTensorInfo(h),p}},F_e=IEe({opSnippet:"\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return min(a, b);\n",packedOpSnippet:"\n vec4 result = vec4(min(a, b));\n bvec4 isNaNA = isnan(a);\n bvec4 isNaNB = isnan(b);\n bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w);\n \n result.r = isNaN.r ? NAN : result.r;\n result.g = isNaN.g ? NAN : result.g;\n result.b = isNaN.b ? NAN : result.b;\n result.a = isNaN.a ? NAN : result.a;\n\n return result;\n",cpuKernelImpl:aTe}),D_e={kernelName:f2,backendName:"webgl",kernelFunc:F_e},M_e=p((function e(t,n,r){l(this,e),this.variableNames=["x"],this.outputShape=n.map((function(e,n){return e[0]+t[n]+e[1]}));var a=t.length,i=JNe(a),o=n.map((function(e){return e[0]})).join(","),s=n.map((function(e,n){return e[0]+t[n]})).join(","),u=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,a),c="reflect"===r?0:1;this.userCode=1!==a?"\n ".concat(i," start = ").concat(i,"(").concat(o,");\n ").concat(i," end = ").concat(i,"(").concat(s,");\n\n void main() {\n ").concat(i," outC = getOutputCoords();\n for (int i = 0; i < ").concat(a,"; i++) {\n if (outC[i] < start[i]) {\n outC[i] = start[i] * 2 - outC[i] - ").concat(c,";\n } else if(outC[i] >= end[i]) {\n outC[i] = (end[i] - 1) * 2 - outC[i] + ").concat(c,";\n }\n }\n ").concat(i," coords = outC - start;\n setOutput(getX(").concat(u,"));\n }\n "):"\n int start = ".concat(o,";\n int end = ").concat(s,";\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start) {\n outC = start * 2 - outC - ").concat(c,";\n } else if(outC >= end) {\n outC = (end - 1) * 2 - outC + ").concat(c,";\n }\n setOutput(getX(outC - start));\n }\n ")})),L_e=p((function e(t,n,r){l(this,e),this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=n.map((function(e,n){return e[0]+t[n]+e[1]}));var a=t.length,i=JNe(a),o=n.map((function(e){return e[0]})).join(","),s=n.map((function(e,n){return e[0]+t[n]})).join(","),u=FTe("rc",a),c=FTe("source",a),h="".concat(u[a-1]," < ").concat(this.outputShape[a-1]),p=1===a?"source":"vec2(".concat(c.slice(-2).join(),")"),f="reflect"===r?0:1,d="";if(1===a){var v="\n ".concat(i," source = rc;\n if (source < start) {\n source = start * 2 - source - ").concat(f,";\n } else if (source >= end) {\n source = (end - 1) * 2 - source + ").concat(f,";\n }\n source -= start;\n ");d="\n ".concat(i," rc = outputLoc;\n ").concat(v,"\n result[0] = getChannel(getX(").concat(c.join(),"), ").concat(p,");\n ").concat(u[a-1]," += 1;\n if(").concat(h,") {\n ").concat(v,"\n result[1] = getChannel(getX(").concat(c.join(),"), ").concat(p,");\n }\n ")}else{var m="\n ".concat(i," source = rc;\n ").concat(i," lt = ").concat(i,"(lessThan(source, start));\n ").concat(i," gte = ").concat(i,"(greaterThanEqual(source, end));\n ").concat(i," orig = 1 - (lt + gte);\n source = orig * source +\n lt * (start * 2 - source - ").concat(f,") +\n gte * ((end - 1) * 2 - source + ").concat(f,");\n source -= start;\n ");d="\n ".concat(i," rc = outputLoc;\n ").concat(m,"\n result[0] = getChannel(getX(").concat(c.join(),"), ").concat(p,");\n ").concat(u[a-1]," += 1;\n if(").concat(h,") {\n ").concat(m,"\n result[1] = getChannel(getX(").concat(c.join(),"), ").concat(p,");\n }\n rc = outputLoc;\n ").concat(u[a-2]," += 1;\n if(").concat(u[a-2]," < ").concat(this.outputShape[a-2],") {\n ").concat(m,"\n result[2] = getChannel(getX(").concat(c.join(),"), ").concat(p,");\n ").concat(u[a-1]," += 1;\n if(").concat(h,") {\n ").concat(m,"\n result[3] = getChannel(getX(").concat(c.join(),"), ").concat(p,");\n }\n }\n ")}this.userCode="\n const ".concat(i," start = ").concat(i,"(").concat(o,");\n const ").concat(i," end = ").concat(i,"(").concat(s,");\n\n void main() {\n ").concat(i," outputLoc = getOutputCoords();\n vec4 result = vec4(0.);\n ").concat(d,"\n setOutput(result);\n }\n ")})),z_e={kernelName:d2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.paddings,o=r.mode,s=k0().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new L_e(a.shape,i,o):new M_e(a.shape,i,o);return n.runWebGLProgram(s,[a],a.dtype)}},P_e=IEe({opSnippet:"if (b == 0.0) return NAN;\n return mod(a, b);",packedOpSnippet:"\n vec4 result = mod(a, b);\n bvec4 isNaN = equal(b, vec4(0.0));\n \n result.r = isNaN.r ? NAN : result.r;\n result.g = isNaN.g ? NAN : result.g;\n result.b = isNaN.b ? NAN : result.b;\n result.a = isNaN.a ? NAN : result.a;\n\n return result;\n"}),B_e={kernelName:v2,backendName:"webgl",kernelFunc:P_e},W_e=p((function e(t,n,r){l(this,e),this.variableNames=["probs"],this.customUniforms=[{name:"seed",type:"float"}],this.outputShape=[t,r],this.userCode="\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 < ".concat(n-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(").concat(n-1,"));\n }\n ")})),V_e=IEe({opSnippet:"\nif (a == b) {\n return 1.0;\n};\nreturn a / b;",packedOpSnippet:"\n // vec4 one = vec4(equal(a, b));\n // return one + (vec4(1.0) - one) * a / b;\n vec4 result = a / b;\n if(a.x == b.x) {\n result.x = 1.;\n }\n if(a.y == b.y) {\n result.y = 1.;\n }\n if(a.z == b.z) {\n result.z = 1.;\n }\n if(a.w == b.w) {\n result.w = 1.;\n }\n\n return result;\n",checkOutOfBounds:!0}),U_e={kernelName:k1,backendName:"webgl",kernelFunc:V_e},G_e="return a - b;",j_e=IEe({opSnippet:G_e,packedOpSnippet:G_e,supportsComplex:!0,cpuKernelImpl:ETe}),H_e={kernelName:x3,backendName:"webgl",kernelFunc:j_e};function q_e(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.logits,i=j$([r.dim],a.shape),o=x_e({inputs:{x:a},backend:n,attrs:{reductionIndices:i,keepDims:!1}}),s=G7(o.shape,i),u=OEe({inputs:{x:o},backend:n,attrs:{shape:s}}),c=j_e({inputs:{a:a,b:u},backend:n}),l=hRe({inputs:{x:c},backend:n}),h=WEe({inputs:{x:l},backend:n,attrs:{axis:i,keepDims:!1}}),p=OEe({inputs:{x:h},backend:n,attrs:{shape:s}}),f=V_e({inputs:{a:l,b:p},backend:n});return n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(c),n.disposeIntermediateTensorInfo(l),n.disposeIntermediateTensorInfo(h),n.disposeIntermediateTensorInfo(p),f}var K_e={kernelName:s3,backendName:"webgl",kernelFunc:q_e};var X_e={kernelName:m2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.logits,i=r.numSamples,o=r.seed,s=r.normalized,u=s?a:q_e({inputs:{logits:a},backend:n,attrs:{dim:a.shape.length-1}}),c=u.shape[0],l=u.shape[1],h=new W_e(c,l,i),p=[[o]],f=n.runWebGLProgram(h,[u],"int32",p);return s||n.disposeIntermediateTensorInfo(u),f}};var Y_e={kernelName:y2,backendName:"webgl",kernelFunc:function(e){var t,n=e.inputs,r=e.backend,a=n.x;if(r.shouldExecuteOnCPU([a])){var i=r.texData.get(a.dataId),o=S(oTe(i.values,a.shape,a.dtype),2),s=o[0],u=o[1];return r.makeTensorInfo(u,a.dtype,s)}return t=k0().getBool("WEBGL_PACK_UNARY_OPERATIONS")?new eEe(a.shape,"\n vec4 result = -x;\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n"):new WTe(a.shape,"if (isnan(x)) return x;\n return -x;\n"),r.runWebGLProgram(t,[a],a.dtype)}},J_e=zne;var Z_e={kernelName:x2,backendName:"webgl",kernelFunc:function(e){z3("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");var t=e.inputs,n=e.backend,r=e.attrs,a=t.boxes,i=t.scores,o=r.maxOutputSize,s=r.iouThreshold,u=r.scoreThreshold,c=n.readSync(a.dataId),l=n.readSync(i.dataId),h=J_e(c,l,o,s,u).selectedIndices;return n.makeTensorInfo([h.length],"int32",new Int32Array(h))}},Q_e=Pne;var $_e={kernelName:k2,backendName:"webgl",kernelFunc:function(e){z3("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");var t=e.inputs,n=e.backend,r=e.attrs,a=t.boxes,i=t.scores,o=r.maxOutputSize,s=r.iouThreshold,u=r.scoreThreshold,c=r.padToMaxOutputSize,l=n.readSync(a.dataId),h=n.readSync(i.dataId),p=Q_e(l,h,o,s,u,c),f=p.selectedIndices,d=p.validOutputs;return[n.makeTensorInfo([f.length],"int32",new Int32Array(f)),n.makeTensorInfo([],"int32",new Int32Array([d]))]}},eOe=Bne;var tOe={kernelName:w2,backendName:"webgl",kernelFunc:function(e){z3("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");var t=e.inputs,n=e.backend,r=e.attrs,a=t.boxes,i=t.scores,o=r.maxOutputSize,s=r.iouThreshold,u=r.scoreThreshold,c=r.softNmsSigma,l=n.readSync(a.dataId),h=n.readSync(i.dataId),p=eOe(l,h,o,s,u,c),f=p.selectedIndices,d=p.selectedScores;return[n.makeTensorInfo([f.length],"int32",new Int32Array(f)),n.makeTensorInfo([d.length],"float32",new Float32Array(d))]}},nOe=p((function e(t,n,r,a){l(this,e),this.variableNames=["indices"],this.outputShape=[t,n],this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int index = round(getIndices(coords.x));\n setOutput(mix(float(".concat(a,"), float(").concat(r,"),\n float(index == coords.y)));\n }\n ")})),rOe={kernelName:N2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.indices,i=r.dtype,o=r.depth,s=r.onValue,u=r.offValue,c=L$(a.shape),l=new nOe(c,o,s,u),h=OEe({inputs:{x:a},backend:n,attrs:{shape:[c]}}),p=n.runWebGLProgram(l,[h],i);n.disposeIntermediateTensorInfo(h);var f=OEe({inputs:{x:p},backend:n,attrs:{shape:[].concat(T(a.shape),[o])}});return n.disposeIntermediateTensorInfo(p),f}};function aOe(e){var t=e.inputs,n=e.backend,r=t.x;if("complex64"===r.dtype){var a=qCe({inputs:{input:r},backend:n}),i=aOe({inputs:{x:a},backend:n}),o=sAe({inputs:{input:r},backend:n}),s=aOe({inputs:{x:o},backend:n}),u=dEe({inputs:{real:i,imag:s},backend:n});return n.disposeIntermediateTensorInfo(a),n.disposeIntermediateTensorInfo(i),n.disposeIntermediateTensorInfo(o),n.disposeIntermediateTensorInfo(s),u}return wRe({attrs:{shape:r.shape,dtype:r.dtype,value:"string"===r.dtype?"":0},backend:n})}var iOe={kernelName:R3,backendName:"webgl",kernelFunc:aOe};var oOe={kernelName:I2,backendName:"webgl",kernelFunc:function e(t){var n=t.inputs,r=t.backend,a=n.x;if("string"===a.dtype)throw new Error("onesLike is not supported under string dtype");if("complex64"===a.dtype){var i=qCe({inputs:{input:a},backend:r}),o=e({inputs:{x:i},backend:r}),s=sAe({inputs:{input:a},backend:r}),u=aOe({inputs:{x:s},backend:r}),c=dEe({inputs:{real:o,imag:u},backend:r});return r.disposeIntermediateTensorInfo(i),r.disposeIntermediateTensorInfo(o),r.disposeIntermediateTensorInfo(s),r.disposeIntermediateTensorInfo(u),c}return wRe({attrs:{shape:a.shape,dtype:a.dtype,value:1},backend:r})}};var sOe={kernelName:S2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs.axis;if(1===t.length)return fRe({inputs:{input:t[0]},backend:n,attrs:{dim:r}});var a=t[0].shape,i=t[0].dtype;t.forEach((function(e){D$(a,e.shape,"All tensors passed to stack must have matching shapes"),F$(i===e.dtype,(function(){return"All tensors passed to stack must have matching dtypes"}))}));var o=[],s=lAe({inputs:t.map((function(e){var t=fRe({inputs:{input:e},backend:n,attrs:{dim:r}});return o.push(t),t})),backend:n,attrs:{axis:r}});return o.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),s}},uOe=p((function e(t,n,r){l(this,e),this.variableNames=["x"],this.customUniforms=[{name:"value",type:"float"}],this.outputShape=n.map((function(e,n){return e[0]+t[n]+e[1]}));var a=t.length,i=JNe(a),o=n.map((function(e){return e[0]})).join(","),s=n.map((function(e,n){return e[0]+t[n]})).join(","),u=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,a);this.userCode=1!==a?"\n ".concat(i," start = ").concat(i,"(").concat(o,");\n ").concat(i," end = ").concat(i,"(").concat(s,");\n\n void main() {\n ").concat(i," outC = getOutputCoords();\n if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {\n setOutput(value);\n } else {\n ").concat(i," coords = outC - start;\n setOutput(getX(").concat(u,"));\n }\n }\n "):"\n int start = ".concat(o,";\n int end = ").concat(s,";\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start || outC >= end) {\n setOutput(value);\n } else {\n setOutput(getX(outC - start));\n }\n }\n ")})),cOe=p((function e(t,n,r){l(this,e),this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"value",type:"float"}],this.outputShape=n.map((function(e,n){return e[0]+t[n]+e[1]}));for(var a=t.length,i=JNe(a),o=n.map((function(e){return e[0]})).join(","),s=n.map((function(e,n){return e[0]+t[n]})).join(","),u=FTe("rc",a),c=FTe("source",a),h="".concat(u[a-1]," < ").concat(this.outputShape[a-1]),p=1===a?"source":"vec2(".concat(c.slice(-2).join(),")"),f=["".concat(i," rc = outputLoc;"),"".concat(u[a-1]," += 1;\n if(").concat(h,") {\n "),1===a?"":"}\n rc = outputLoc;\n ".concat(u[a-2]," += 1;\n if(").concat(u[a-2]," < ").concat(this.outputShape[a-2],") {"),1===a?"":" ".concat(u[a-1]," += 1;\n if(").concat(h,") {")],d=1===a?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))",v="",m=0,g=1===a?2:4;m<g;m++)v+="\n ".concat(f[m],"\n if (").concat(d,") {\n result[").concat(m,"] = float(value);\n } else {\n ").concat(i," source = rc - start;\n result[").concat(m,"] = getChannel(getX(").concat(c.join(),"), ").concat(p,");\n }\n ");v+=1===a?"} ":"}}",this.userCode="\n const ".concat(i," start = ").concat(i,"(").concat(o,");\n const ").concat(i," end = ").concat(i,"(").concat(s,");\n\n void main() {\n ").concat(i," outputLoc = getOutputCoords();\n vec4 result = vec4(0.);\n ").concat(v,"\n setOutput(result);\n }\n ")})),lOe=function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.paddings,o=r.constantValue;if(0===L$(a.shape)){var s=i.map((function(e,t){return e[0]+a.shape[t]+e[1]}));return wRe({backend:n,attrs:{shape:s,value:o,dtype:a.dtype}})}var u=k0().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new cOe(a.shape,i,o):new uOe(a.shape,i,o),c=[[o]];return n.runWebGLProgram(u,[a],a.dtype,c)},hOe={kernelName:T2,backendName:"webgl",kernelFunc:lOe},pOe=IEe({opSnippet:"\n if(a < 0.0 && floor(b) < b){\n return NAN;\n }\n if (b == 0.0) {\n return 1.0;\n }\n return (round(mod(b, 2.0)) != 1) ?\n pow(abs(a), b) : sign(a) * pow(abs(a), b);\n",packedOpSnippet:"\n // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.\n vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1)));\n vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);\n vec4 result = multiplier * pow(abs(a), b);\n\n // Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS\n bvec4 isExpZero = equal(b, vec4(0.0));\n result.r = isExpZero.r ? 1.0 : result.r;\n result.g = isExpZero.g ? 1.0 : result.g;\n result.b = isExpZero.b ? 1.0 : result.b;\n result.a = isExpZero.a ? 1.0 : result.a;\n\n bvec4 isNaN1 = lessThan(a, vec4(0.0));\n bvec4 isNaN2 = lessThan(floor(b), b);\n bvec4 isNaN = bvec4(isNaN1.x && isNaN2.x, isNaN1.y && isNaN2.y, isNaN1.z && isNaN2.z, isNaN1.w && isNaN2.w);\n \n result.r = isNaN.r ? NAN : result.r;\n result.g = isNaN.g ? NAN : result.g;\n result.b = isNaN.b ? NAN : result.b;\n result.a = isNaN.a ? NAN : result.a;\n\n return result;\n"}),fOe={kernelName:E2,backendName:"webgl",kernelFunc:pOe};var dOe={kernelName:A2,backendName:"webgl",kernelFunc:function(e){var t,n=e.inputs,r=e.backend,a=e.attrs,i=n.x,o=a.axis,s=a.keepDims,u=i.shape.length,c=[],l=j$(o,i.shape),h=l,p=H7(h,u),f=i;if(null!=p&&(f=UEe({inputs:{x:i},backend:r,attrs:{perm:p}}),h=K7(h.length,u),c.push(f)),j7("prod",h,u),r.shouldExecuteOnCPU([f])){var d=r.texData.get(f.dataId).values,v=uTe(f.shape,f.dtype,d,h),m=v.outVals,g=v.outShape,y=v.outDtype;t=r.makeTensorInfo(g,y,m)}else{var b=S(U7(f.shape,h),2),x=b[0],k=L$(b[1]),w=OEe({inputs:{x:f},backend:r,attrs:{shape:[-1,k]}}),I=LEe(w,p5(i.dtype),"prod",r);t=OEe({inputs:{x:I},backend:r,attrs:{shape:x}}),c.push(w),c.push(I)}if(s){c.push(t);var N=G7(t.shape,l);t=OEe({inputs:{x:t},backend:r,attrs:{shape:N}})}return c.forEach((function(e){return r.disposeIntermediateTensorInfo(e)})),t}};var vOe={kernelName:R2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.paramsNestedSplits,i=t.paramsDenseValues,o=t.indices,s=r.outputRaggedRank,u=a.map((function(e){return n.readSync(e.dataId)})),c=a.map((function(e){return e.shape})),l=n.readSync(i.dataId),h=n.readSync(o.dataId),p=S(cTe(u,c,l,i.shape,i.dtype,h,o.shape,s),3),f=p[0],d=p[1],v=p[2],m=f.map((function(e){return n.makeTensorInfo([e.length],"int32",e)})),g=n.makeTensorInfo(v,i.dtype,d);return m.concat([g])}};var mOe={kernelName:_2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.starts,a=t.limits,i=t.deltas,o=n.readSync(r.dataId),s=n.readSync(a.dataId),u=n.readSync(i.dataId),c=S(lTe(o,r.shape,r.dtype,s,a.shape,u,i.shape),2),l=c[0],h=c[1];return[n.makeTensorInfo([l.length],"int32",l),n.makeTensorInfo([h.length],r.dtype,h)]}};var gOe={kernelName:O2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.shape,i=t.values,o=t.defaultValue,s=t.rowPartitionTensors,u=r.rowPartitionTypes,c=n.readSync(a.dataId),l=n.readSync(i.dataId),h=n.readSync(o.dataId),p=s.map((function(e){return n.readSync(e.dataId)})),f=s.map((function(e){return e.shape})),d=S(hTe(c,a.shape,l,i.shape,i.dtype,h,o.shape,p,f,u),2),v=d[0],m=d[1];return n.makeTensorInfo(v,i.dtype,m)}},yOe=function(e){var t=e.backend,n=e.attrs,r=n.start,a=n.stop,i=n.step,o=n.dtype,s=pTe(r,a,i,o);return t.makeTensorInfo([s.length],o,s)},bOe={kernelName:F2,backendName:"webgl",kernelFunc:yOe},xOe=wEe({opSnippet:"return 1.0 / x;"}),kOe={kernelName:M2,backendName:"webgl",kernelFunc:xOe},wOe=wEe({opSnippet:"if (isnan(x)) return x;\n return (x < 0.0) ? 0.0 : x;\n",packedOpSnippet:"\n vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n"}),IOe={kernelName:L2,backendName:"webgl",kernelFunc:wOe},NOe=wEe({opSnippet:"if (isnan(x)) return x;\n return (x < 0.0) ? 0.0 : min(6.0, x);\n",packedOpSnippet:"\n vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n"}),SOe={kernelName:U2,backendName:"webgl",kernelFunc:NOe},TOe=p((function e(t,n,r,a,i){l(this,e),this.variableNames=["A"],this.outputShape=[];var o=S(t,4),s=o[0],u=o[1],c=o[2],h=o[3];this.outputShape=[s,n,r,h];var p,f=[a&&n>1?u-1:u,a&&r>1?c-1:c],d=[a&&n>1?n-1:n,a&&r>1?r-1:r];p=i?"(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC - vec2(0.5)":"vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode="\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n ".concat(f[0]/d[0],",\n ").concat(f[1]/d[1],");\n const vec2 inputShapeRC = vec2(").concat(u,".0, ").concat(c,".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 = ").concat(p,";\n\n // Compute the four integer indices.\n ivec2 sourceFloorRC = ivec2(max(sourceFracIndexRC, vec2(0.0)));\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 ")})),EOe=p((function e(t,n,r,a,i){l(this,e),this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];var o=S(t,4),s=o[0],u=o[1],c=o[2],h=o[3];this.outputShape=[s,n,r,h];var p,f=[a&&n>1?u-1:u,a&&r>1?c-1:c],d=[a&&n>1?n-1:n,a&&r>1?r-1:r];p=i?"(vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC - vec3(0.5)":"vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode="\n const vec3 effectiveInputOverOutputRatioRC = vec3(\n ".concat(f[0]/d[0],",\n ").concat(f[1]/d[1],",\n ").concat(f[1]/d[1],");\n const vec3 inputShapeRC = vec3(").concat(u,".0, ").concat(c,".0,\n ").concat(c,".0);\n\n float getAValue(int b, int r, int c, int d) {\n return getChannel(getA(b, r, c, d), vec2(c, d));\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n // Calculate values for next column in yRC.z.\n ivec3 yRC = coords.yzz + ivec3(0, 0, 1);\n\n // Fractional source index.\n vec3 sourceFracIndexRC = ").concat(p,";\n\n // Compute the four integer indices.\n ivec3 sourceFloorRC = ivec3(max(sourceFracIndexRC, vec3(0.0)));\n ivec3 sourceCeilRC = ivec3(\n min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n // Should we calculate next column and row elements in 2x2 packed cell.\n bool hasNextCol = d < ").concat(h-1,";\n bool hasNextRow = coords.z < ").concat(r-1,";\n\n // In parallel, construct four corners for all four components in\n // packed 2x2 cell.\n vec4 topLeft = vec4(\n getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d),\n hasNextCol ? getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n vec4 bottomLeft = vec4(\n getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d),\n hasNextCol ? getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n vec4 topRight = vec4(\n getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d),\n hasNextCol ? getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n vec4 bottomRight = vec4(\n getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d),\n hasNextCol ? getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n vec3 fracRC = sourceFracIndexRC - vec3(sourceFloorRC);\n\n vec4 top = mix(topLeft, topRight, fracRC.yyzz);\n vec4 bottom = mix(bottomLeft, bottomRight, fracRC.yyzz);\n vec4 newValue = mix(top, bottom, fracRC.x);\n\n setOutput(newValue);\n }\n ")}));var COe={kernelName:W2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.images,i=r.alignCorners,o=r.halfPixelCenters,s=S(r.size,2),u=s[0],c=s[1],l=k0().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new EOe(a.shape,u,c,i,o):new TOe(a.shape,u,c,i,o);return n.runWebGLProgram(l,[a],"float32")}},AOe=p((function e(t,n,r){l(this,e),this.variableNames=["dy"],this.outputShape=[],this.outputShape=n;var a=S(n,3),i=a[1],o=a[2],s=S(t,3),u=s[1],c=s[2],h=[r&&u>1?i-1:i,r&&c>1?o-1:o],p=[r&&u>1?u-1:u,r&&c>1?c-1:c],f=h[0]/p[0],d=h[1]/p[1],v=1/f,m=1/d,g=2*Math.ceil(v)+2,y=2*Math.ceil(m)+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(".concat(f,");\n const float widthScale = float(").concat(d,");\n\n const float invHeightScale = float(").concat(v,");\n const float invWidthScale = float(").concat(m,");\n\n const int winHeight = int(").concat(g,");\n const int winWidth = int(").concat(y,");\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 >= ").concat(u,") {\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 >= ").concat(c,") {\n continue;\n }\n\n float dxR = float(dyR) * heightScale;\n int topDxRIndex = int(floor(dxR));\n int bottomDxRIndex = int(min(ceil(dxR), ").concat(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), ").concat(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 ")}));var ROe={kernelName:V2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.images,i=t.dy,o=r.alignCorners,s=new AOe(i.shape,a.shape,o);return n.runWebGLProgram(s,[i],i.dtype)}},_Oe=p((function e(t,n,r,a,i){l(this,e),this.variableNames=["A"],this.outputShape=[];var o=S(t,4),s=o[0],u=o[1],c=o[2],h=o[3];this.outputShape=[s,n,r,h];var p,f=[a&&n>1?u-1:u,a&&r>1?c-1:c],d=[a&&n>1?n-1:n,a&&r>1?r-1:r],v=a?"0.5":"0.0";p=i?"max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC, vec2(0.0))":"vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode="\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n ".concat(f[0]/d[0],",\n ").concat(f[1]/d[1],");\n const vec2 inputShapeRC = vec2(").concat(u,".0, ").concat(c,".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 = ").concat(p,";\n\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestRC = ivec2(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ").concat(v,")));\n float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);\n\n setOutput(newValue);\n }\n ")})),OOe=p((function e(t,n,r,a,i){l(this,e),this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];var o=S(t,4),s=o[0],u=o[1],c=o[2],h=o[3];this.outputShape=[s,n,r,h];var p,f=[a&&n>1?u-1:u,a&&r>1?c-1:c],d=[a&&n>1?n-1:n,a&&r>1?r-1:r],v=a?"0.5":"0.0";p=i?"max((vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC, vec3(0.0))":"vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode="\n const vec3 effectiveInputOverOutputRatioRC = vec3(\n ".concat(f[0]/d[0],",\n ").concat(f[1]/d[1],",\n ").concat(f[1]/d[1],");\n const vec3 inputShapeRC = vec3(").concat(u,".0, ").concat(c,".0,\n ").concat(c,".0);\n\n float getAValue(int b, int r, int c, int d) {\n return getChannel(getA(b, r, c, d), vec2(c, d));\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n // Calculate values for next column in yRC.z.\n ivec3 yRC = coords.yzz + ivec3(0, 0, 1);\n\n // Fractional source index.\n vec3 sourceFracIndexRC = ").concat(p,";\n\n // Compute the coordinators of nearest neighbor point.\n ivec3 sourceNearestRC = ivec3(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + ").concat(v,")));\n\n // Should we calculate next column and row elements in 2x2 packed cell.\n bool hasNextCol = d < ").concat(h-1,";\n bool hasNextRow = coords.z < ").concat(r-1,";\n\n vec4 newValue = vec4(\n getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d),\n hasNextCol ? getAValue(b, sourceNearestRC.x, sourceNearestRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceNearestRC.x, sourceNearestRC.z, d + 1) : 0.0);\n\n setOutput(newValue);\n }\n ")}));var FOe={kernelName:P2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.images,i=r.alignCorners,o=r.halfPixelCenters,s=S(r.size,2),u=s[0],c=s[1],l=k0().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new OOe(a.shape,u,c,i,o):new _Oe(a.shape,u,c,i,o);return n.runWebGLProgram(l,[a],a.dtype)}},DOe=p((function e(t,n,r){l(this,e),this.variableNames=["dy"],this.outputShape=[],this.outputShape=n;var a=S(n,3),i=a[1],o=a[2],s=S(t,3),u=s[1],c=s[2],h=[r&&u>1?i-1:i,r&&c>1?o-1:o],p=[r&&u>1?u-1:u,r&&c>1?c-1:c],f=h[0]/p[0],d=h[1]/p[1],v=1/f,m=1/d,g=2*Math.ceil(v)+2,y=2*Math.ceil(m)+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(".concat(f,");\n const float widthScale = float(").concat(d,");\n\n const float invHeightScale = float(").concat(v,");\n const float invWidthScale = float(").concat(m,");\n\n const int winHeight = int(").concat(g,");\n const int winWidth = int(").concat(y,");\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 >= ").concat(u,") {\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 >= ").concat(c,") {\n continue;\n }\n\n float sourceFracRow =\n float(").concat(h[0],") *\n (float(dyR) / float(").concat(p[0],"));\n\n float sourceFracCol =\n float(").concat(h[1],") *\n (float(dyC) / float(").concat(p[1],"));\n\n int sourceNearestRow = int(min(\n float(int(").concat(i,") - 1),\n ").concat(r," ? float(round(sourceFracRow)) :\n float(floor(sourceFracRow))));\n\n int sourceNearestCol = int(min(\n float(int(").concat(o,") - 1),\n ").concat(r," ? 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 ")}));var MOe={kernelName:B2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.images,i=t.dy,o=r.alignCorners,s=new DOe(i.shape,a.shape,o);return n.runWebGLProgram(s,[i],i.dtype)}},LOe=p((function e(t,n){l(this,e),this.variableNames=["x"];var r=t.length;if(r>4)throw new Error("WebGL backend: Reverse of rank-".concat(r," tensor is not yet supported"));if(this.outputShape=t,1!==r){var a=t.map((function(e,r){return function(e){return-1!==n.indexOf(e)&&1!==t[e]?"".concat(t[e]," - coords[").concat(e,"] - 1"):"coords[".concat(e,"]")}(r)})).join(","),i=JNe(r);this.userCode="\n void main() {\n ".concat(i," coords = getOutputCoords();\n setOutput(getX(").concat(a,"));\n }\n ")}else this.userCode="\n void main() {\n int coord = getOutputCoords();\n setOutput(getX(".concat(t[0]," - coord - 1));\n }\n ")})),zOe=p((function e(t,n){l(this,e),this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;var r=t.length;if(r>4)throw new Error("WebGL backend: Reverse of rank-".concat(r," tensor is not yet supported"));this.outputShape=t;var a=FTe("rc",r),i="".concat(a[r-1]," + 1 < ").concat(this.outputShape[r-1]),o="".concat(a[r-2]," + 1 < ").concat(this.outputShape[r-2]),s=JNe(r);function u(e){var r=t.map((function(r,a){return function(e,r){return-1!==n.indexOf(e)&&1!==t[e]?"".concat(t[e]," - ").concat(r[e]," - 1"):"".concat(r[e])}(a,e)})),a=r.join(","),i=r.slice(-2).join(",");return"getChannel(getX(".concat(a,"), vec2(").concat(i,"))")}this.userCode=1===r?"\n void main(){\n int rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = getChannel(getX(".concat(t[0]," - rc - 1),\n ").concat(t[0]," - rc - 1);\n if(").concat(i,"){\n result.g = getChannel(getX(").concat(t[0]," - (rc + 1) - 1),\n ").concat(t[0]," - (rc + 1) - 1);\n }\n setOutput(result);\n }\n "):"\n void main() {\n ".concat(s," rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = ").concat(function(e){return u(e)}(a.slice()),";\n if(").concat(i,"){\n result.g = ").concat(function(e){return e[r-1]="("+e[r-1]+" + 1)",u(e)}(a.slice()),";\n }\n if(").concat(o,") {\n result.b = ").concat(function(e){return e[r-2]="("+e[r-2]+" + 1)",u(e)}(a.slice()),";\n if(").concat(i,") {\n result.a = ").concat(function(e){return e[r-1]="("+e[r-1]+" + 1)",e[r-2]="("+e[r-2]+" + 1)",u(e)}(a.slice()),";\n }\n }\n setOutput(result);\n }\n ")}));var POe={kernelName:G2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.dims,o=a.shape.length,s=j$(i,a.shape);if(0===o)return pEe({inputs:{x:a},backend:n});var u=k0().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new zOe(a.shape,s):new LOe(a.shape,s);return n.runWebGLProgram(u,[a],a.dtype)}},BOe=p((function e(t,n){l(this,e),this.variableNames=["Image"],this.outputShape=[],this.customUniforms=[{name:"params",type:"vec4"}];var r=t[1],a=t[2];this.outputShape=t;var i="";i="number"==typeof n?"float outputValue = ".concat(n.toFixed(2),";"):"\n vec3 fill = vec3(".concat(n.join(","),");\n float outputValue = fill[coords[3]];"),this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int x = coords[2];\n int y = coords[1];\n float coordXFloat = (float(x) - params[0]) * params[3] -\n (float(y) - params[1]) * params[2];\n float coordYFloat = (float(x) - params[0]) * params[2] +\n (float(y) - params[1]) * params[3];\n int coordX = int(round(coordXFloat + params[0]));\n int coordY = int(round(coordYFloat + params[1]));\n ".concat(i,"\n if(coordX >= 0 && coordX < ").concat(a," && coordY >= 0 && coordY < ").concat(r,") {\n outputValue = getImage(coords[0], coordY, coordX, coords[3]);\n }\n setOutput(outputValue);\n }\n ")})),WOe={kernelName:F3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.attrs,r=e.backend,a=t.image,i=n.radians,o=n.fillValue,s=n.center,u=r,c=new BOe(a.shape,o),l=S(eie(s,a.shape[1],a.shape[2]),2),h=[[l[0],l[1],Math.sin(i),Math.cos(i)]];return u.runWebGLProgram(c,[a],a.dtype,h)}},VOe=wEe({opSnippet:"\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"}),UOe={kernelName:j2,backendName:"webgl",kernelFunc:VOe},GOe=wEe({opSnippet:"return inversesqrt(x);",cpuKernelImpl:fTe}),jOe={kernelName:H2,backendName:"webgl",kernelFunc:GOe},HOe=p((function e(t,n,r,a,i,o){var s=arguments.length>7&&void 0!==arguments[7]&&arguments[7];l(this,e),this.variableNames=["updates","indices","defaultValue"],this.outputShape=o;var u=JNe(i.length),c=JNe(o.length),h="";1===r?h="i":2===r&&(h="i, j");var p="getIndices(".concat(h,")"),f="";1===a?f="i":2===a&&(f="i, coords[1]");var d="getUpdates(".concat(f,")"),v="";s&&(v="coords[0], coords[1]");var m="getDefaultValue(".concat(v,")"),g=n>1?"strides[j]":"strides";this.userCode="\n ".concat(u," strides = ").concat(u,"(").concat(i,");\n\n void main() {\n ").concat(c," coords = getOutputCoords();\n float sum = 0.0;\n bool found = false;\n for (int i = 0; i < ").concat(t,"; i++) {\n int flattenedIndex = 0;\n for (int j = 0; j < ").concat(n,"; j++) {\n int index = round(").concat(p,");\n flattenedIndex += index * ").concat(g,";\n }\n if (flattenedIndex == coords[0]) {\n sum += ").concat(d,";\n found = true;\n }\n }\n setOutput(mix(").concat(m,", sum, float(found)));\n }\n ")})),qOe=p((function e(t,n,r,a,i,o){var s=arguments.length>7&&void 0!==arguments[7]&&arguments[7];l(this,e),this.variableNames=["updates","indices","defaultValue"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=o;var u=JNe(i.length),c=JNe(o.length),h="";1===r?h="i":2===r&&(h="i, j");var p="getIndices(".concat(h,")"),f="";1===a?f="i":2===a&&(f="i, coords[1]");var d="getUpdates(".concat(f,")"),v="";s&&(v="coords[0], coords[1]");var m="getDefaultValue(".concat(v,")"),g=n>1?"strides[j]":"strides",y=n>1?"strides[j + 1]":"strides";this.userCode="\n ".concat(u," strides = ").concat(u,"(").concat(i,");\n\n void main() {\n ").concat(c," coords = getOutputCoords();\n vec4 sum = vec4(0.);\n vec4 found = vec4(0.);\n for (int i = 0; i < ").concat(t,"; i+=2) {\n ivec2 flattenedIndex = ivec2(0);\n for (int j = 0; j < ").concat(n,"; j+=2) {\n ivec4 index = round(").concat(p,");\n flattenedIndex += index.xz * ").concat(g,";\n if (j + 1 < ").concat(n,") {\n flattenedIndex += index.yw * ").concat(y,";\n }\n }\n if (flattenedIndex[0] == coords[0] || flattenedIndex[1] == coords[0] ||\n flattenedIndex[0] == coords[0] + 1 || flattenedIndex[1] == coords[0] + 1) {\n vec4 updVals = ").concat(d,";\n if (flattenedIndex[0] == coords[0]) {\n sum.xy += updVals.xy;\n found.xy = vec2(1.);\n } else if (flattenedIndex[0] == coords[0] + 1) {\n sum.zw += updVals.xy;\n found.zw = vec2(1.);\n }\n if (flattenedIndex[1] == coords[0]) {\n sum.xy += updVals.zw;\n found.xy = vec2(1.);\n } else if (flattenedIndex[1] == coords[0] + 1) {\n sum.zw += updVals.zw;\n found.zw = vec2(1.);\n }\n }\n }\n setOutput(mix(").concat(m,", sum, found));\n }\n ")}));var KOe={kernelName:q2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.indices,i=t.updates,o=r.shape,s=Ute(0,a,o),u=s.sliceRank,c=s.numUpdates,l=s.sliceSize,h=s.strides,p=s.outputSize,f=[p/l,l];if(0===p)return n.makeTensorInfo(o,a.dtype);var d,v=OEe({inputs:{x:a},backend:n,attrs:{shape:[c,u]}}),m=OEe({inputs:{x:i},backend:n,attrs:{shape:[c,l]}}),g=n.makeTensorInfo([],"float32",new Float32Array([0]));d=k0().getBool("WEBGL_PACK")?new qOe(c,u,v.shape.length,m.shape.length,h,f):new HOe(c,u,v.shape.length,m.shape.length,h,f);var y=n.runWebGLProgram(d,[m,v,g],m.dtype),b=OEe({inputs:{x:y},backend:n,attrs:{shape:o}});return n.disposeIntermediateTensorInfo(v),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(y),n.disposeIntermediateTensorInfo(g),b}},XOe=p((function e(t,n,r,a){l(this,e),this.variableNames=["sortedSequence","values"],this.customUniforms=[{name:"numInputs",type:"int"}],this.outputShape=[t,r];var i="for (int i = 0; i < ".concat(Math.ceil(Math.log2(n+1)),"; ++i) { if (left >= right) break;"),o=2===k0().getNumber("WEBGL_VERSION")?"while (left < right) {":i,s="left"===a?"<":"<=";this.userCode="\n int findBound(int batch, float value) {\n int left = 0;\n int right = numInputs;\n int mid;\n ".concat(o,"\n mid = (left + right) / 2;\n if (getSortedSequence(batch, mid) ").concat(s," value) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }\n return right;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int valueIndex = coords[1];\n\n float value = getValues(batch, valueIndex);\n\n setOutput(float(findBound(batch, value)));\n }\n ")}));var YOe={kernelName:X2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.sortedSequence,i=t.values,o=r.side,s=new XOe(a.shape[0],a.shape[1],i.shape[1],o),u=[[a.shape[1]]];return n.runWebGLProgram(s,[a,i],"int32",u)}},JOe=p((function e(t,n,r){var a,i;if(l(this,e),this.variableNames=["c","a","b"],this.outputShape=n,r>4)throw Error("Where for rank ".concat(r," is not yet supported"));if(1===r)i="resRC",a="resRC";else{for(var o=["resRC.x","resRC.y","resRC.z","resRC.w"],s=[],u=[],c=0;c<n.length;c++)u.push("".concat(o[c])),c<t&&s.push("".concat(o[c]));a=s.join(),i=u.join()}var h=JNe(r);this.userCode="\n void main() {\n ".concat(h," resRC = getOutputCoords();\n float cVal = getC(").concat(a,");\n if (cVal >= 1.0) {\n setOutput(getA(").concat(i,"));\n } else {\n setOutput(getB(").concat(i,"));\n }\n }\n ")}));var ZOe={kernelName:Y2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.condition,a=t.t,i=t.e,o=new JOe(r.shape.length,a.shape,a.shape.length);return n.runWebGLProgram(o,[r,a,i],h5(a.dtype,i.dtype))}},QOe=wEe({opSnippet:"\n // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.\n // see: https://arxiv.org/abs/1706.02515\n float scaleAlpha = ".concat(oie,";\n float scale = ").concat(sie,";\n return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n")}),$Oe={kernelName:J2,backendName:"webgl",kernelFunc:QOe},eFe=wEe({opSnippet:"if (isnan(x)) return x;\n return 1.0 / (1.0 + exp(-1.0 * x));\n",packedOpSnippet:"\n vec4 result = 1.0 / (1.0 + exp(-1.0 * x));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n",cpuKernelImpl:vTe}),tFe={kernelName:t3,backendName:"webgl",kernelFunc:eFe},nFe=wEe({opSnippet:"\n if (isnan(x)) { return 0.0; }\n return sign(x);\n"}),rFe={kernelName:e3,backendName:"webgl",kernelFunc:nFe},aFe=wEe({opSnippet:"if (isnan(x)) return x;\n return sin(x);\n",packedOpSnippet:"\n vec4 result = sin(x);\n bvec4 isNaN = isnan(x);\n ".concat(lEe,"\n return result;\n")}),iFe={kernelName:Q2,backendName:"webgl",kernelFunc:aFe},oFe=wEe({opSnippet:"\n float e2x = exp(x);\n return (e2x - 1.0 / e2x) / 2.0;\n"}),sFe={kernelName:$2,backendName:"webgl",kernelFunc:oFe},uFe=wEe({opSnippet:"\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"}),cFe={kernelName:n3,backendName:"webgl",kernelFunc:uFe},lFe={kernelName:i3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.blockShape,o=r.paddings;F$(a.shape.length<=4,(function(){return"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet"}));var s=i.reduce((function(e,t){return e*t})),u=[[0,0]];u.push.apply(u,T(o));for(var c=1+i.length;c<a.shape.length;++c)u.push([0,0]);var l=[],h=lOe({inputs:{x:a},backend:n,attrs:{paddings:u,constantValue:0}}),p=tie(h.shape,i,s,!1),f=nie(p.length,i.length,!1),d=rie(h.shape,i,s,!1),v=OEe({inputs:{x:h},backend:n,attrs:{shape:p}}),m=UEe({inputs:{x:v},backend:n,attrs:{perm:f}}),g=OEe({inputs:{x:m},backend:n,attrs:{shape:d}});return l.push(h),l.push(v),l.push(m),l.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),g}};var hFe={kernelName:u3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.indices,a=t.values,i=t.denseShape,o=t.defaultValue;if(1!==i.shape.length)throw new Error("Dense shape must be a vector, saw:\n ".concat(i.shape));if(2!==r.shape.length)throw new Error("Indices must be a matrix, saw:\n ".concat(r.shape));if(1!==a.shape.length)throw new Error("Values must be a vector, saw:\n ".concat(a.shape));if(0!==o.shape.length)throw new Error("Default value must be a scalar, saw:\n ".concat(o.shape));var s=n.readSync(r.dataId),u=n.readSync(a.dataId),c=n.readSync(i.dataId),l=n.readSync(o.dataId)[0],h=S(yTe(s,r.shape,r.dtype,u,a.dtype,c,l),5),p=h[0],f=h[1],d=h[2],v=h[3],m=h[4];return[n.makeTensorInfo(f,r.dtype,p),n.makeTensorInfo([f[0]],a.dtype,d),n.makeTensorInfo([v.length],"bool",new Uint8Array(v.map((function(e){return Number(e)})))),n.makeTensorInfo([m.length],r.dtype,new Int32Array(m))]}};var pFe={kernelName:c3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.inputIndices,a=t.inputShape,i=t.newShape;if(2!==r.shape.length)throw new Error("Input indices should be a matrix but received shape ".concat(r.shape));if(1!==a.shape.length)throw new Error("Input shape should be a vector but received shape ".concat(a.shape));if(1!==i.shape.length)throw new Error("Target shape should be a vector but received shape ".concat(i.shape));var o=Array.from(n.readSync(a.dataId)),s=n.readSync(r.dataId),u=Array.from(n.readSync(i.dataId)),c=S(bTe(s,r.shape,r.dtype,o,u),3),l=c[0],h=c[1],p=c[2];return[n.makeTensorInfo(h,r.dtype,l),n.makeTensorInfo([p.length],i.dtype,new Int32Array(p))]}};var fFe={kernelName:l3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.data,a=t.indices,i=t.segmentIds;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.shape.length)throw new Error("Indices should be a vector but received shape\n ".concat(a.shape));if(1!==i.shape.length)throw new Error("Segment ids should be a vector but received shape\n ".concat(i.shape));var o=n.readSync(r.dataId),s=n.readSync(a.dataId),u=n.readSync(i.dataId),c=S(xTe(o,r.shape,r.dtype,s,u,!0),2),l=c[0],h=c[1];return n.makeTensorInfo(h,r.dtype,l)}};var dFe={kernelName:h3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=t.data,a=t.indices,i=t.segmentIds;if(r.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(1!==a.shape.length)throw new Error("Indices should be a vector but received shape\n ".concat(a.shape));if(1!==i.shape.length)throw new Error("Segment ids should be a vector but received shape\n ".concat(i.shape));var o=n.readSync(r.dataId),s=n.readSync(a.dataId),u=n.readSync(i.dataId),c=S(xTe(o,r.shape,r.dtype,s,u),2),l=c[0],h=c[1];return n.makeTensorInfo(h,r.dtype,l)}};var vFe={kernelName:p3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.sparseIndices,i=t.sparseValues,o=t.defaultValue,s=r.outputShape,u=Ute(0,a,s),c=u.sliceRank,l=u.numUpdates,h=u.sliceSize,p=u.strides,f=u.outputSize;if("string"===i.dtype){var d=n.bufferSync(a),v=n.bufferSync(i),m=W4(n.readSync(o.dataId)[0]),g=dTe(d,v,s,f,h,l,c,p,m,false);return n.makeTensorInfo(s,g.dtype,g.values)}var y=new HOe(l,c,a.shape.length,i.shape.length,p,[f,1],false),b=n.runWebGLProgram(y,[i,a,o],i.dtype),x=OEe({inputs:{x:b},backend:n,attrs:{shape:s}});return n.disposeIntermediateTensorInfo(b),x}};var mFe={kernelName:o3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.numOrSizeSplits,o=j$(r.axis,a.shape)[0],s=Rie(a,i,o),u=a.shape.length,c=new Array(u).fill(0),l=a.shape.slice();return s.map((function(e){var t=T(l);t[o]=e;var r=PCe({inputs:{x:a},backend:n,attrs:{begin:c,size:t}});return c[o]+=e,r}))}},gFe="return sqrt(x);",yFe=wEe({opSnippet:gFe,packedOpSnippet:gFe,cpuKernelImpl:kTe}),bFe={kernelName:r3,backendName:"webgl",kernelFunc:yFe},xFe={kernelName:d3,backendName:"webgl",kernelFunc:wEe({opSnippet:"return x * x;"})},kFe="return (a - b) * (a - b);",wFe=IEe({opSnippet:kFe,packedOpSnippet:kFe}),IFe={kernelName:f3,backendName:"webgl",kernelFunc:wFe};var NFe={kernelName:v3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x;if("string"!==a.dtype)throw new Error("Input must be of datatype string");var i=qie(n.readSync(a.dataId)),o=wTe(i,"string",r);return n.makeTensorInfo(a.shape,"string",o)}};var SFe={kernelName:_3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.attrs,r=e.backend,a=t.x,i=VTe+"\n return x > 0.0 ? 1.0 : float(".concat(n.alpha,");\n "),o=new WTe(a.shape,i);return r.runWebGLProgram(o,[a],a.dtype)}},TFe=p((function e(t,n,r){l(this,e),this.variableNames=["x"],this.outputShape=r;var a=r.length,i=JNe(r.length),o=JNe(r.length),s="";if(1===a)s="coords * strides + begin";else{var u=0;s=r.map((function(e,t){return u++,1===r.length?"coords * strides[".concat(t,"] + begin[").concat(t,"]"):"coords[".concat(u-1,"] * strides[").concat(t,"] + begin[").concat(t,"]")})).join(",")}this.userCode="\n ".concat(i," begin = ").concat(i,"(").concat(t,");\n ").concat(i," strides = ").concat(i,"(").concat(n,");\n\n void main() {\n ").concat(o," coords = getOutputCoords();\n setOutput(getX(").concat(s,"));\n }\n ")}));var EFe={kernelName:m3,backendName:"webgl",kernelFunc:function(e){var t,n=e.inputs,r=e.backend,a=e.attrs,i=n.x,o=a.begin,s=a.end,u=a.strides,c=a.beginMask,l=a.endMask,h=a.ellipsisMask,p=a.newAxisMask,f=a.shrinkAxisMask,d=Pae(i.shape,o,s,u,c,l,h,p,f),v=d.finalShapeSparse,m=d.finalShape,g=d.isIdentity,y=d.sliceDim0,b=d.isSimpleSlice,x=d.begin,k=d.end,w=d.strides;if(g)t=OEe({inputs:{x:i},backend:r,attrs:{shape:m}});else if(y||b){F$(i.shape.length>=1,(function(){return"Input must have rank at least 1, got: ".concat(i.shape.length)}));var I=Tae(x,k,w),N=PCe({inputs:{x:i},backend:r,attrs:{begin:x,size:I}});t=OEe({inputs:{x:N},backend:r,attrs:{shape:m}}),r.disposeIntermediateTensorInfo(N)}else{if(r.shouldExecuteOnCPU([i])){var S=r.readSync(i.dataId),T=K6(i.shape,i.dtype,S),E=ITe(v,T,w,x);t=r.makeTensorInfo(m,i.dtype,E.values)}else{var C=new TFe(x,w,v);t=r.runWebGLProgram(C,[i],i.dtype)}}var A=OEe({inputs:{x:t},backend:r,attrs:{shape:m}});return r.disposeIntermediateTensorInfo(t),A}};var CFe={kernelName:g3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=r.separator,i=r.nGramWidths,o=r.leftPad,s=r.rightPad,u=r.padWidth,c=r.preserveShortSequences,l=t.data,h=t.dataSplits,p=n.readSync(l.dataId),f=n.readSync(h.dataId),d=S(NTe(p,f,a,i,o,s,u,c),2),v=d[0],m=d[1];return[n.makeTensorInfo([v.length],"string",v),n.makeTensorInfo(h.shape,"int32",m)]}};var AFe={kernelName:y3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs.skipEmpty,a=t.input,i=t.delimiter;if("string"!==a.dtype)throw new Error("Input must be of datatype string");if(1!==a.shape.length)throw new Error("Input must be a vector, got shape: ".concat(a.shape));if(0!==i.shape.length)throw new Error("Delimiter must be a scalar, got shape: ".concat(i.shape));var o=n.readSync(a.dataId),s=n.readSync(i.dataId)[0],u=S(STe(o,s,r),3),c=u[0],l=u[1],h=u[2],p=l.length;return[n.makeTensorInfo([p,2],"int32",c),n.makeTensorInfo([p],"string",l),n.makeTensorInfo([2],"int32",new Int32Array(h))]}};var RFe={kernelName:b3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs.numBuckets,a=t.input;if("string"!==a.dtype)throw new Error("Input must be of datatype string");if(r<=0)throw new Error("Number of buckets must be at least 1");var i=n.readSync(a.dataId),o=TTe(i,r);return n.makeTensorInfo(a.shape,"int32",o)}},_Fe=wEe({opSnippet:"return tan(x);"}),OFe={kernelName:k3,backendName:"webgl",kernelFunc:_Fe},FFe=wEe({opSnippet:"\n float e2x = exp(-2.0 * abs(x));\n return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n"}),DFe={kernelName:w3,backendName:"webgl",kernelFunc:FFe};var MFe={kernelName:K2,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.tensor,i=t.indices,o=t.updates;!function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(r);var s=Ute(0,i,a.shape),u=s.sliceRank,c=s.numUpdates,l=s.sliceSize,h=s.strides,p=s.outputSize,f=[p/l,l];if(0===p)return n.makeTensorInfo(a.shape,i.dtype);var d=OEe({inputs:{x:i},backend:n,attrs:{shape:[c,u]}}),v=OEe({inputs:{x:o},backend:n,attrs:{shape:[c,l]}}),m=OEe({inputs:{x:a},backend:n,attrs:{shape:f}}),g=new HOe(c,u,d.shape.length,v.shape.length,h,f,!1,!0),y=n.runWebGLProgram(g,[v,d,m],m.dtype),b=OEe({inputs:{x:y},backend:n,attrs:{shape:a.shape}});return n.disposeIntermediateTensorInfo(d),n.disposeIntermediateTensorInfo(v),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(y),b}},LFe=p((function e(t,n){l(this,e),this.variableNames=["A"];for(var r=new Array(t.length),a=0;a<r.length;a++)r[a]=t[a]*n[a];this.outputShape=r,this.rank=r.length;var i=JNe(this.rank),o=function(e){var t=e.length;if(t>5)throw Error("Tile for rank ".concat(t," is not yet supported"));if(1===t)return"imod(resRC, ".concat(e[0],")");for(var n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],r=[],a=0;a<e.length;a++)r.push("imod(".concat(n[a],", ").concat(e[a],")"));return r.join()}(t);this.userCode="\n void main() {\n ".concat(i," resRC = getOutputCoords();\n setOutput(getA(").concat(o,"));\n }\n ")}));function zFe(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.reps;if("string"===a.dtype||a.shape.length>5){var o=n.readSync(a.dataId),s="string"===a.dtype?o.map((function(e){return W4(e)})):o,u=K6(a.shape,a.dtype,s),c=CTe(u,i);return n.makeTensorInfo(c.shape,c.dtype,c.values)}var l=new LFe(a.shape,i);return n.runWebGLProgram(l,[a],a.dtype)}var PFe={kernelName:I3,backendName:"webgl",kernelFunc:zFe},BFe=p((function e(t){l(this,e),this.variableNames=["x","indices"],this.customUniforms=[{name:"n",type:"int"},{name:"firstPass",type:"int"},{name:"negativeInf",type:"float"},{name:"dir",type:"int"},{name:"inc",type:"int"}],this.outputShape=t,this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int elemIdx = coords[1];\n\n // We compare elements pair-wise within a group of size 2 * inc.\n // The comparing rule for each group alternates between ascending\n // and descending. Within each group, we compare each pair at\n // positions i and i+inc. To decide whether an element at position i\n // is x0 or x1, we mod it by 2 * inc, if the result is smaller than\n // inc, it is in the first half of the group, we denote it as x0,\n // otherwise we denote it as x1.\n // For example, as shown in the Bitonic top K paper referenced above,\n // Figure5(a) shows that element[1] is in the\n // second half of the group when group size is 2, but it is in the\n // first half of the group when group size is 4.\n\n bool isFirstInPair = imod(elemIdx, 2 * inc) < inc;\n int i = isFirstInPair ? elemIdx : elemIdx - inc;\n\n int i0 = firstPass == 1 ? i : int(getIndices(batch, i));\n int i1 = firstPass == 1 ? i + inc : int(getIndices(batch, i + inc));\n float x0 = i0 < n ? getX(batch, i0) : negativeInf;\n float x1 = i1 < n ? getX(batch, i1) : negativeInf;\n\n // Denotes which direction indices are in (ascending or descending).\n bool reverse = imod(elemIdx, 2 * dir) >= dir;\n bool isGreater = x0 > x1 || (x0 == x1 && i1 > i0);\n if (reverse == isGreater) { // Elements in opposite order of direction\n int iTemp = i0;\n i0 = i1;\n i1 = iTemp;\n }\n if (isFirstInPair) {\n setOutput(float(i0));\n } else {\n setOutput(float(i1));\n }\n }\n "})),WFe=p((function e(t){l(this,e),this.variableNames=["x","indices"],this.customUniforms=[{name:"n",type:"int"},{name:"firstPass",type:"int"},{name:"k",type:"int"}],this.outputShape=t,this.userCode="\n void main() {\n // Takes max of indices (0, k), (1, k + 1), (2, k + 2) ...\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int elemIdx = coords[1];\n\n // The output size is half of the previous size.\n // If the previous sequence is | | | | _ _ _ _ | | | | _ _ _ _ (k=4),\n // we only need to output the indices at positions |, the indices at\n // positions _ can be thrown away, see Figure5(b) After Phase 2\n // (Merge phase) in the Bitonic Top K paper referenced above.\n // For example, the paper shows we only need to output the orange bars.\n // The output sequence should look like this | | | | | | | |.\n // Because the sequence is halved, to map the output index back\n // to the previous sequence to find the corresponding value,\n // we need to double the index. When we double the index,\n // we basically interpolate a position, so 2i looks like\n // | _ | _ | _ | _ | _ | _ | _. We move the | to the first k position\n // of each 2k positions by - elemIdx % k. E.g. for output at\n // index 4,5,6,7, we want to get the corresponding element at\n // original index 8,9,10,11, for output at index 8,9,10,11,\n // we want to get the corresponding element at original index\n // 16,17,18,19, so on and so forth.\n\n int i = elemIdx < k ? elemIdx : (elemIdx * 2 - imod(elemIdx, k));\n int i0 = firstPass == 1 ? i : int(getIndices(batch, i));\n int i1 = firstPass == 1 ? i + k : int(getIndices(batch, i + k));\n\n float x0 = getX(batch, i0);\n float x1 = i1 < n ? getX(batch, i1) : x0;\n\n setOutput(x0 >= x1 ? float(i0) : float(i1));\n }\n "}));function VFe(e,t){null!==t&&e.disposeIntermediateTensorInfo(t)}function UFe(e){for(var t=1;t<e;)t*=2;return t}var GFe={kernelName:N3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=r.k,o=r.sorted,s=k0().getNumber("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD"),u=k0().getNumber("TOPK_K_CPU_HANDOFF_THRESHOLD"),c=a.shape,l=c[c.length-1];if(n.shouldExecuteOnCPU([a])||l<s||i>u){var h=n.readSync(a.dataId),p=S(ATe(h,c,a.dtype,i,o),2),f=p[0],d=p[1];return[n.makeTensorInfo(f.shape,f.dtype,f.values),n.makeTensorInfo(d.shape,d.dtype,d.values)]}if(0===i)return c[c.length-1]=0,[n.makeTensorInfo(c,a.dtype,[]),n.makeTensorInfo(c,"int32",[])];if(1===l)return[a,wRe({attrs:{shape:c,dtype:"int32",value:0},backend:n})];var v=n.texData.get(a.dataId),m=null!==v&&v.isPacked,g=m?n.unpackTensor(a):a,y=L$(c)/l,b=OEe({inputs:{x:g},attrs:{shape:[y,l]},backend:n});m&&VFe(n,g);for(var x=UFe(i),k=UFe(l),w=null,I=function(){return null===w?[b,b]:[b,w]},N=function(e,t,r){var a=I(),i=new BFe(r),o=[[l],[null===w?1:0],[Number.NEGATIVE_INFINITY],[e],[t]],s=w;w=n.runWebGLProgram(i,a,"int32",o),VFe(n,s)},T=1;T<x;T*=2)for(var E=2*T,C=T;C>=1;C/=2)N(E,C,[y,k]);for(var A=k;A>x;A/=2){var R=I(),_=new WFe([y,A/2]),O=[[l],[null===w?1:0],[x]],F=w;w=n.runWebGLProgram(_,R,"int32",O),VFe(n,F);for(var D=x/2,M=2*D,L=D;L>=1;L/=2)N(M,L,w.shape)}var z=w;w=PCe({inputs:{x:w},backend:n,attrs:{begin:0,size:[y,i]}}),VFe(n,z);var P=VRe({inputs:{x:b,indices:w},backend:n,attrs:{axis:1,batchDims:1}});VFe(n,b);var B=c.slice(0,-1);B.push(i),z=w,w=OEe({inputs:{x:w},attrs:{shape:B},backend:n}),VFe(n,z);var W=P;return P=OEe({inputs:{x:P},attrs:{shape:B},backend:n}),VFe(n,W),[P,w]}},jFe=p((function e(t,n,r,a,i,o){l(this,e),this.variableNames=["Image","Transforms"],this.outputShape=o;var s,u="nearest"===r?1:2;switch(a){case"constant":default:s=1;break;case"reflect":s=2;break;case"wrap":s=3;break;case"nearest":s=4}this.userCode="\n float mapCoord(float outCoord, float len) {\n float inCoord = outCoord;\n if(".concat(s," == 2) {\n if (inCoord < 0.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz2 = 2.0 * len;\n if (inCoord < sz2) {\n inCoord = sz2 * float(int(float(-inCoord / sz2))) +\n inCoord;\n }\n inCoord = inCoord < -len ? inCoord + sz2 : -inCoord - 1.0;\n }\n } else if (inCoord > len - 1.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz2 = 2.0 * len;\n inCoord -= sz2 * float(int(float(inCoord / sz2)));\n if (inCoord >= len) {\n inCoord = sz2 - inCoord - 1.0;\n }\n }\n }\n return clamp(inCoord, 0.0, len - 1.0);\n } else if (").concat(s," == 3) {\n if (inCoord < 0.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz = len - 1.0;\n inCoord += len * (float(int(float(-inCoord / sz))) + 1.0);\n }\n } else if (inCoord > len - 1.0) {\n if (len <= 1.0) {\n inCoord = 0.0;\n } else {\n float sz = len - 1.0;\n inCoord -= len * float(int(float(inCoord / sz)));\n }\n }\n return clamp(inCoord, 0.0, len - 1.0);\n } else if (").concat(s," == 4) {\n return clamp(outCoord, 0.0, len - 1.0);\n } else {\n return outCoord;\n }\n }\n\n float readWithFillValue(int batch, int coordY, int coordX,\n int channel) {\n float outputValue;\n if (0 <= coordY && coordY < ").concat(t," && 0 <= coordX && coordX < ").concat(n,") {\n outputValue = getImage(batch, coordY, coordX, channel);\n } else {\n outputValue = float(").concat(i,");\n }\n return outputValue;\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n float outputValue;\n int batch = coords[0];\n int x = coords[2];\n int y = coords[1];\n int channel = coords[3];\n float xf = float(x);\n float yf = float(y);\n float a1 = getTransforms(batch, 0);\n float a2 = getTransforms(batch, 1);\n float a3 = getTransforms(batch, 2);\n float b1 = getTransforms(batch, 3);\n float b2 = getTransforms(batch, 4);\n float b3 = getTransforms(batch, 5);\n float c1 = getTransforms(batch, 6);\n float c2 = getTransforms(batch, 7);\n float projection = c1 * xf + c2 * yf + 1.0;\n if (projection == 0.0) {\n outputValue = float(").concat(i,");\n } else {\n float inX = (a1 * xf + a2 * yf + a3) / projection;\n float inY = (b1 * xf + b2 * yf + b3) / projection;\n float mapX = mapCoord(inX, float(").concat(n,"));\n float mapY = mapCoord(inY, float(").concat(t,"));\n\n if (").concat(u," == 1) {\n int coordY = int(round(mapY));\n int coordX = int(round(mapX));\n outputValue = readWithFillValue(batch, coordY, coordX,\n channel);\n } else {\n float yFloor = floor(mapY);\n float xFloor = floor(mapX);\n float yCeil = yFloor + 1.0;\n float xCeil = xFloor + 1.0;\n float valueYFloor = (xCeil - mapX) *\n readWithFillValue(batch, int(yFloor), int(xFloor), channel) +\n (mapX - xFloor) *\n readWithFillValue(batch, int(yFloor), int(xCeil), channel);\n float valueYCeil = (xCeil - mapX) *\n readWithFillValue(batch, int(yCeil), int(xFloor), channel) +\n (mapX - xFloor) *\n readWithFillValue(batch, int(yCeil), int(xCeil), channel);\n outputValue = (yCeil - mapY) * valueYFloor +\n (mapY - yFloor) * valueYCeil;\n }\n }\n setOutput(outputValue);\n }\n ")}));var HFe={kernelName:S3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.image,i=t.transforms,o=r.interpolation,s=r.fillMode,u=r.fillValue,c=r.outputShape,l=S(a.shape,4),h=l[0],p=l[1],f=l[2],d=l[3],v=S(null!=c?c:[p,f],2),m=v[0],g=v[1],y=new jFe(p,f,o,s,u,[h,m,g,d]);return n.runWebGLProgram(y,[a,i],"float32")}};var qFe={kernelName:E3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.attrs,r=e.backend,a=n.axis,i=t.x;wNe(i,"unique"),console.warn("WARNING: ","UI might be locked temporarily as data is being downloaded");var o=r.readSync(i.dataId),s=_Te(o,a,i.shape,i.dtype),u=s.outputValues,c=s.outputShape,l=s.indices;return[r.makeTensorInfo(c,i.dtype,u),r.makeTensorInfo([l.length],"int32",l)]}};var KFe={kernelName:C3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.value,i=r.axis;i<0&&(i+=a.shape.length);for(var o=a,s=o.shape.length,u=a.shape[i],c=new Array(s-1),l=0,h=0;h<s;h++)h!==i&&(c[l++]=o.shape[h]);var p=[],f=new Array(s).fill(0),d=o.shape.slice();d[i]=1;for(var v=new Array(u),m=0;m<v.length;m++){f[i]=m;var g=PCe({inputs:{x:o},backend:n,attrs:{begin:f,size:d}}),y=OEe({inputs:{x:g},backend:n,attrs:{shape:c}});v[m]=y,p.push(g)}return p.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),v}},XFe=p((function e(t,n){l(this,e),this.variableNames=["x","segmentIds"];var r=t.windowSize,a=t.batchSize,i=t.inSize,o=t.numSegments,s=o*Math.ceil(i/r);this.outputShape=[a,s];var u=4*Math.floor(r/4),c=r%4,h="\n sumValue += dot(values, segFilter);\n ",p="";i%r>0&&(p="\n if (inIdx < 0 || inIdx >= ".concat(i,") {\n return initializationValue;\n }\n "));var f="";i%r>0&&(f="\n if (inIdx < 0 || inIdx >= ".concat(i,") {\n return -1.0;\n }\n ")),this.userCode="\n const float initializationValue = ".concat("0.0",";\n\n float getValue(int batch, int inIdx) {\n ").concat(p,"\n return getX(batch, inIdx);\n }\n\n float getSegmentIdAtIndex(int inIdx) {\n ").concat(f,"\n return getSegmentIds(inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = int(floor(float(outIdx) / float(\n ").concat(o,")) * float(").concat(r,"));\n int currentSeg = int(mod(float(outIdx), float(").concat(o,")));\n\n float sumValue = 0.0;\n\n for (int i = 0; i < ").concat(u,"; i += 4) {\n int inIdx = inOffset + i;\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0\n );\n\n ").concat(h,"\n }\n\n int inIdx = inOffset + ").concat(u,";\n if (").concat(1===c,") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n int inIdxSeg = int(getSegmentIdAtIndex(inIdx));\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n 0,\n 0,\n 0\n );\n\n ").concat(h,"\n } else if (").concat(2===c,") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n 0,\n 0\n );\n\n ").concat(h,"\n } else if (").concat(3===c,") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n 0\n );\n\n ").concat(h,"\n }\n setOutput(").concat("sumValue",");\n }\n ")}));for(var YFe={kernelName:A3,backendName:"webgl",kernelFunc:function(e){var t=e.inputs,n=e.backend,r=e.attrs,a=t.x,i=t.segmentIds,o=r.numSegments,s=a.shape.length,u=[],c=0,l=H7([c],s),h=a;null!=l&&(h=UEe({inputs:{x:a},backend:n,attrs:{perm:l}}),u.push(h),c=K7(1,s)[0]);var p=jie(h.shape,c,o),f=L$([h.shape[c]]),d=OEe({inputs:{x:h},backend:n,attrs:{shape:[-1,f]}});u.push(d);var v=function e(t,r,a,i,o){var s=t.shape[0],c=t.shape[1],l=Gie(c,o),h=new XFe({windowSize:l,inSize:c,batchSize:s,numSegments:o},r),p=n.compileAndRun(h,[t,a],i);if(u.push(p),p.shape[1]===o)return p;var f=yOe({backend:n,attrs:{start:0,stop:o,step:1,dtype:"float32"}}),d=zFe({inputs:{x:f},backend:n,attrs:{reps:[c/l]}});return u.push(f),u.push(d),e(p,r,d,i,o)}(d,"unsortedSegmentSum",i,p5(a.dtype),o),m=OEe({inputs:{x:v},backend:n,attrs:{shape:p}}),g=m;if(null!=l){u.push(m);var y=q7(l);g=UEe({inputs:{x:g},backend:n,attrs:{perm:y}})}return u.forEach((function(e){return n.disposeIntermediateTensorInfo(e)})),g}},JFe=0,ZFe=[HEe,KEe,YEe,ZEe,eCe,rCe,aCe,iCe,hCe,pCe,dCe,mCe,yCe,xCe,wCe,SCe,TCe,ACe,RCe,_Ce,DCe,WCe,VCe,UCe,GCe,XCe,ZCe,eAe,vEe,rAe,hAe,bAe,NAe,TAe,EAe,CAe,RAe,OAe,DAe,LAe,VAe,UAe,GAe,HAe,XAe,ZAe,QAe,eRe,nRe,rRe,iRe,oRe,uRe,lRe,pRe,dRe,gRe,xRe,NRe,TRe,ARe,_Re,DRe,LRe,zRe,BRe,URe,jRe,qRe,fEe,KRe,uAe,YRe,ZRe,$Re,yEe,t_e,r_e,a_e,o_e,u_e,l_e,p_e,d_e,g_e,b_e,k_e,I_e,N_e,S_e,C_e,A_e,R_e,__e,O_e,D_e,z_e,B_e,X_e,_Ee,Y_e,Z_e,$_e,tOe,HCe,rOe,oOe,sOe,hOe,fOe,kEe,dOe,vOe,mOe,gOe,bOe,KCe,U_e,kOe,IOe,SOe,FEe,COe,ROe,FOe,MOe,POe,WOe,UOe,jOe,KOe,YOe,ZOe,$Oe,tFe,rFe,iFe,sFe,BCe,K_e,cFe,lFe,hFe,pFe,fFe,dFe,vFe,mFe,bFe,xFe,IFe,NFe,SFe,EFe,CFe,AFe,RFe,H_e,VEe,OFe,DFe,MFe,PFe,GFe,HFe,GEe,qFe,KFe,YFe,iOe];JFe<ZFe.length;JFe++){G3(ZFe[JFe])}var QFe={"tfjs-core":Uae,"tfjs-backend-cpu":wbe,"tfjs-backend-webgl":oEe,"tfjs-data":jme,"tfjs-layers":Ele,"tfjs-converter":Dve,tfjs:"4.6.0"};e.Abs=N0,e.Acos=S0,e.Acosh=T0,e.AdadeltaOptimizer=Bre,e.AdagradOptimizer=Wre,e.AdamOptimizer=Vre,e.AdamaxOptimizer=Ure,e.Add=E0,e.AddN=C0,e.All=A0,e.Any=R0,e.ArgMax=_0,e.ArgMin=O0,e.Asin=F0,e.Asinh=D0,e.Atan=M0,e.Atan2=z0,e.Atanh=L0,e.AvgPool=P0,e.AvgPool3D=W0,e.AvgPool3DGrad=V0,e.AvgPoolGrad=B0,e.BatchMatMul=U0,e.BatchToSpaceND=G0,e.Bincount=j0,e.BitwiseAnd=H0,e.BroadcastArgs=K0,e.BroadcastTo=q0,e.Callback=Wfe,e.CallbackList=Pce,e.Cast=X0,e.Ceil=Y0,e.ClipByValue=J0,e.Complex=Z0,e.ComplexAbs=Q0,e.Concat=$0,e.Conv2D=e1,e.Conv2DBackpropFilter=t1,e.Conv2DBackpropInput=n1,e.Conv3D=r1,e.Conv3DBackpropFilterV2=a1,e.Conv3DBackpropInputV2=i1,e.Cos=o1,e.Cosh=s1,e.CropAndResize=l1,e.Cumprod=u1,e.Cumsum=c1,e.CustomCallback=Vce,e.DataStorage=S$,e.DenseBincount=h1,e.DepthToSpace=p1,e.DepthwiseConv2dNative=f1,e.DepthwiseConv2dNativeBackpropFilter=d1,e.DepthwiseConv2dNativeBackpropInput=v1,e.Diag=m1,e.Dilation2D=g1,e.Dilation2DBackpropFilter=b1,e.Dilation2DBackpropInput=y1,e.Draw=x1,e.EarlyStopping=Gfe,e.Einsum=w1,e.Elu=I1,e.EluGrad=N1,e.Environment=y0,e.Equal=T1,e.Erf=S1,e.Exp=E1,e.ExpandDims=C1,e.Expm1=A1,e.FFT=R1,e.Fill=_1,e.FlipLeftRight=O1,e.Floor=F1,e.FloorDiv=D1,e.FromPixels=O3,e.FusedBatchNorm=M1,e.FusedConv2D=M3,e.FusedDepthwiseConv2D=L3,e.GPGPUContext=LSe,e.GatherNd=z1,e.GatherV2=L1,e.GraphModel=_ve,e.Greater=P1,e.GreaterEqual=B1,e.History=Wce,e.IFFT=V1,e.Identity=W1,e.Imag=U1,e.InputSpec=ice,e.IsFinite=G1,e.IsInf=j1,e.IsNan=H1,e.KernelBackend=T$,e.LRN=n2,e.LRNGrad=r2,e.LayerVariable=nce,e.LayersModel=nhe,e.LeakyRelu=q1,e.Less=K1,e.LessEqual=X1,e.LinSpace=Y1,e.Log=J1,e.Log1p=Z1,e.LogSoftmax=t2,e.LogicalAnd=Q1,e.LogicalNot=$1,e.LogicalOr=e2,e.LogicalXor="LogicalXor",e.LowerBound="LowerBound",e.MathBackendCPU=Xme,e.MathBackendWebGL=iEe,e.MatrixBandPart="MatrixBandPart",e.Max=a2,e.MaxPool=o2,e.MaxPool3D=u2,e.MaxPool3DGrad=c2,e.MaxPoolGrad=s2,e.MaxPoolWithArgmax=l2,e.Maximum=i2,e.Mean=h2,e.Min=p2,e.Minimum=f2,e.MirrorPad=d2,e.Mod=v2,e.MomentumOptimizer=jre,e.Multinomial=m2,e.Multiply=g2,e.Neg=y2,e.NonMaxSuppressionV3=x2,e.NonMaxSuppressionV4=k2,e.NonMaxSuppressionV5=w2,e.NotEqual=b2,e.OP_SCOPE_SUFFIX=P5,e.OneHot=N2,e.OnesLike=I2,e.Optimizer=Pre,e.OptimizerConstructors=Gae,e.Pack=S2,e.PadV2=T2,e.Pool="Pool",e.Pow=E2,e.Prelu=C2,e.Prod=A2,e.RMSPropOptimizer=Hre,e.RNN=lpe,e.RaggedGather=R2,e.RaggedRange=_2,e.RaggedTensorToTensor=O2,e.Range=F2,e.Real=D2,e.RealDiv=k1,e.Reciprocal=M2,e.Relu=L2,e.Relu6=U2,e.Reshape=z2,e.ResizeBilinear=W2,e.ResizeBilinearGrad=V2,e.ResizeNearestNeighbor=P2,e.ResizeNearestNeighborGrad=B2,e.Reverse=G2,e.RotateWithOffset=F3,e.Round=j2,e.Rsqrt=H2,e.SGDOptimizer=Gre,e.ScatterNd=q2,e.SearchSorted=X2,e.Select=Y2,e.Selu=J2,e.Sequential=che,e.Sigmoid=t3,e.Sign=e3,e.Sin=Q2,e.Sinh=$2,e.Slice=Z2,e.Softmax=s3,e.Softplus=n3,e.SpaceToBatchND=i3,e.SparseFillEmptyRows=u3,e.SparseReshape=c3,e.SparseSegmentMean=l3,e.SparseSegmentSum=h3,e.SparseToDense=p3,e.SplitV=o3,e.Sqrt=r3,e.Square=d3,e.SquaredDifference=f3,e.StaticRegexReplace=v3,e.Step=_3,e.StridedSlice=m3,e.StringNGrams=g3,e.StringSplit=y3,e.StringToHashBucketFast=b3,e.Sub=x3,e.Sum=a3,e.SymbolicTensor=oce,e.Tan=k3,e.Tanh=w3,e.Tensor=n5,e.TensorBuffer=$4,e.TensorScatterUpdate=K2,e.Tile=I3,e.TopK=N3,e.Transform=S3,e.Transpose=T3,e.Unique=E3,e.Unpack=C3,e.UnsortedSegmentSum=A3,e.UpperBound="UpperBound",e.Variable=c5,e.ZerosLike=R3,e._FusedMatMul=D3,e.abs=l8,e.acos=h8,e.acosh=p8,e.add=o8,e.addN=f8,e.all=d8,e.any=v8,e.argMax=m8,e.argMin=g8,e.asin=y8,e.asinh=b8,e.atan=x8,e.atan2=k8,e.atanh=w8,e.avgPool=V8,e.avgPool3d=U8,e.backend=i8,e.backend_util=Xie,e.basicLSTMCell=X8,e.batchNorm=J8,e.batchNorm2d=Z8,e.batchNorm3d=Q8,e.batchNorm4d=$8,e.batchToSpaceND=Y8,e.bincount=e7,e.bitwiseAnd=t7,e.booleanMaskAsync=nne,e.broadcastArgs=n7,e.broadcastTo=r7,e.broadcast_util=R7,e.browser=wae,e.buffer=K6,e.callbacks=qfe,e.cast=X6,e.ceil=a7,e.clipByValue=o7,e.clone=Y6,e.complex=W5,e.concat=G8,e.concat1d=s7,e.concat2d=u7,e.concat3d=c7,e.concat4d=l7,e.constraints=_ce,e.conv1d=p7,e.conv2d=h7,e.conv2dTranspose=d7,e.conv3d=v7,e.conv3dTranspose=g7,e.copyRegisteredKernels=function(e,t){U3(e).forEach((function(e){G3(Object.assign({},e,{backendName:t}))}))},e.cos=y7,e.cosh=b7,e.cosineWindow=hne,e.cumprod=x7,e.cumsum=k7,e.customGrad=S9,e.data=Hme,e.denseBincount=w7,e.deprecationWarn=Z6,e.depthToSpace=I7,e.depthwiseConv2d=N7,e.deregisterOp=function(e){delete Kfe[e]},e.device_util=_5,e.diag=S7,e.dilation2d=T7,e.disableDeprecationWarnings=function(){k0().set("DEPRECATION_WARNINGS_ENABLED",!1),console.warn("TensorFlow.js deprecation warnings have been disabled.")},e.dispose=t8,e.disposeVariables=function(){E5.disposeVariables()},e.div=u8,e.divNoNan=D7,e.dot=M7,e.dropout=cne,e.einsum=L7,e.elu=z7,e.enableDebugMode=function(){k0().set("DEBUG",!0)},e.enableProdMode=function(){k0().set("PROD",!0)},e.enclosingPowerOfTwo=lne,e.engine=Q6,e.ensureShape=P7,e.env=k0,e.equal=_7,e.erf=B7,e.euclideanNorm=r9,e.exp=a9,e.expandDims=i9,e.expm1=o9,e.eye=u9,e.fft=Ite,e.fill=i7,e.findBackend=function(e){return E5.findBackend(e)},e.findBackendFactory=function(e){return E5.findBackendFactory(e)},e.floor=c9,e.floorDiv=s8,e.forceHalfFloat=sEe,e.fused=Nne,e.gather=l9,e.gatherND=une,e.gather_util=Nae,e.getBackend=function(){return E5.backendName},e.getGradient=V3,e.getKernel=W3,e.getKernelsForBackend=U3,e.gpgpu_util=MSe,e.grad=function(e){return F$(r0(e),(function(){return"The f passed in grad(f) must be a function"})),function(t,n){var r=L5(t,"x","tf.grad","string_or_numeric"),a=null!=n?L5(n,"dy","tf.grad"):null;return E5.tidy((function(){var t=E5.gradients((function(){return e(r)}),[r],a),n=t.value,i=t.grads;return null!=a&&D$(n.shape,a.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),T9(i),i[0]}))}},e.grads=function(e){return F$(r0(e),(function(){return"The f passed in grads(f) must be a function"})),function(t,n){F$(Array.isArray(t),(function(){return"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s"}));var r=z5(t,"args","tf.grads","string_or_numeric"),a=null!=n?L5(n,"dy","tf.grads"):null;return E5.tidy((function(){var t=E5.gradients((function(){return e.apply(void 0,T(r))}),r,a),n=t.value,i=t.grads;return null!=a&&D$(n.shape,a.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),T9(i),i}))}},e.greater=h9,e.greaterEqual=p9,e.ifft=Nte,e.imag=f9,e.image=Are,e.inTopKAsync=fne,e.initializers=Fce,e.input=lhe,e.io=pae,e.irfft=Ste,e.isFinite=d9,e.isInf=v9,e.isNaN=m9,e.keep=n8,e.kernel_impls=Yie,e.layers=Lfe,e.leakyRelu=g9,e.less=y9,e.lessEqual=b9,e.linalg=Rre,e.linspace=x9,e.loadGraphModel=function(e){return Ove.apply(this,arguments)},e.loadGraphModelSync=function(e){if(null==e)throw new Error("modelUrl in loadGraphModelSync() cannot be null. Please provide model artifacts or an IOHandler that loads the model");var t;if(e instanceof Array){var n=S(e,2),r=n[0],a=n[1];if(!r)throw new Error("modelJSON must be the first element of the array");if(!(a&&a instanceof ArrayBuffer))throw new Error("An ArrayBuffer of weights must be the second element of the array");if(!("modelTopology"in r))throw new Error("Model JSON is missing 'modelTopology'");if(!("weightsManifest"in r))throw new Error("Model JSON is missing 'weightsManifest'");t=hae(n6(r,o6(r.weightsManifest),a))}else if("load"in e)t=e;else{if(!("modelTopology"in e&&"weightSpecs"in e&&"weightData"in e))throw new Error("Unknown model format");t=hae(e)}var i=new _ve(t);return i.load(),i},e.loadLayersModel=function(e,t){return ihe.apply(this,arguments)},e.localResponseNormalization=k9,e.log=w9,e.log1p=I9,e.logSigmoid=A9,e.logSoftmax=_9,e.logSumExp=O9,e.logicalAnd=F9,e.logicalNot=D9,e.logicalOr=M9,e.logicalXor=L9,e.losses=_re,e.lowerBound=B9,e.matMul=j8,e.math=dae,e.max=X7,e.maxPool=W9,e.maxPool3d=V9,e.maxPoolWithArgmax=U9,e.maximum=G9,e.mean=j9,e.memory=$6,e.meshgrid=K9,e.metrics=zfe,e.min=Y7,e.minimum=X9,e.mirrorPad=Y9,e.mod=J9,e.model=function(e){return new nhe(e)},e.models=Pfe,e.moments=Z9,e.movingAverage=ane,e.mul=c8,e.multiRNNCell=Q9,e.multinomial=$9,e.neg=E9,e.nextFrame=qae,e.norm=n9,e.notEqual=eee,e.oneHot=tee,e.ones=q9,e.onesLike=nee,e.op=B5,e.outerProduct=ree,e.pad=aee,e.pad1d=iee,e.pad2d=oee,e.pad3d=see,e.pad4d=uee,e.pool=lee,e.pow=J7,e.prelu=hee,e.print=J6,e.prod=pee,e.profile=function(e){return E5.profile(e)},e.raggedGather=fee,e.raggedRange=dee,e.raggedTensorToTensor=vee,e.rand=mee,e.randomGamma=Xee,e.randomNormal=Yee,e.randomStandardNormal=Jee,e.randomUniform=Zee,e.randomUniformInt=Qee,e.range=$ee,e.ready=function(){return E5.ready()},e.real=ete,e.reciprocal=tte,e.registerBackend=a8,e.registerCallbackConstructor=function(e,t){Gce.registerCallbackConstructor(e,t)},e.registerGradient=j3,e.registerKernel=G3,e.registerOp=function(e,t){var n={tfOpName:e,category:"custom",inputs:[],attrs:[],customExecutor:t};Kfe[e]=n},e.regularizers=Bfe,e.relu=nte,e.relu6=rte,e.removeBackend=function(e){E5.removeBackend(e)},e.reshape=W8,e.reverse=ate,e.reverse1d=ite,e.reverse2d=ote,e.reverse3d=ste,e.reverse4d=ute,e.rfft=Ete,e.round=cte,e.rsqrt=lte,e.scalar=Z7,e.scatterND=ine,e.scatter_util=Gte,e.searchSorted=P9,e.selu=hte,e.separableConv2d=pte,e.sequential=function(e){return new che(e)},e.serialization=zre,e.setBackend=r8,e.setPlatform=function(e,t){k0().setPlatform(e,t)},e.setWebGLContext=TIe,e.setdiff1dAsync=dte,e.shared=kbe,e.sigmoid=H8,e.sign=vte,e.signal=Cre,e.sin=mte,e.sinh=gte,e.slice=q8,e.slice1d=yte,e.slice2d=bte,e.slice3d=xte,e.slice4d=kte,e.slice_util=Vae,e.softmax=wte,e.softplus=C9,e.spaceToBatchND=cee,e.sparse=Ore,e.sparseToDense=sne,e.spectral=Ere,e.split=Tte,e.sqrt=Q7,e.square=$7,e.squaredDifference=Cte,e.squeeze=Ate,e.stack=Rte,e.step=_te,e.stridedSlice=Ote,e.string=Fre,e.sub=R9,e.sum=e9,e.sumOutType=p5,e.tan=Fte,e.tanh=K8,e.tensor=U5,e.tensor1d=Dte,e.tensor2d=Mte,e.tensor3d=Lte,e.tensor4d=zte,e.tensor5d=Pte,e.tensor6d=Bte,e.tensorScatterUpdate=jte,e.tensor_util=x5,e.test_util=jee,e.tidy=e8,e.tile=s9,e.time=function(e){return E5.time(e)},e.topk=Hte,e.train=jae,e.transpose=rne,e.truncatedNormal=qte,e.unique=Kte,e.unregisterGradient=function(e){if(!B3.has(e))throw new Error("The gradient '".concat(e,"' for backend is not registered"));B3.delete(e)},e.unregisterKernel=function(e,t){var n=H3(e,t);if(!P3.has(n))throw new Error("The kernel '".concat(e,"' for backend ")+"'".concat(t,"' is not registered"));P3.delete(n)},e.unsortedSegmentSum=Xte,e.unstack=Yte,e.upcastType=h5,e.upperBound=Jte,e.util=G4,e.valueAndGrad=function(e){return F$(r0(e),(function(){return"The f passed in valueAndGrad(f) must be a function"})),function(t,n){F$(t instanceof n5,(function(){return"The x passed in valueAndGrad(f)(x) must be a tensor"})),F$(null==n||n instanceof n5,(function(){return"The dy passed in valueAndGrad(f)(x, dy) must be a tensor"}));var r=E5.gradients((function(){return e(t)}),[t],n),a=r.grads,i=r.value;return T9(a),{grad:a[0],value:i}}},e.valueAndGrads=function(e){return F$(r0(e),(function(){return"The f passed in valueAndGrads(f) must be a function"})),function(t,n){F$(Array.isArray(t)&&t.every((function(e){return e instanceof n5})),(function(){return"The args passed in valueAndGrads(f)(args) must be array of tensors"})),F$(null==n||n instanceof n5,(function(){return"The dy passed in valueAndGrads(f)(args, dy) must be a tensor"}));var r=E5.gradients((function(){return e.apply(void 0,T(t))}),t,n);return null!=n&&D$(r.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),T9(r.grads),r}},e.variable=Zte,e.variableGrads=N9,e.version=QFe,e.version_converter=Dve,e.version_core=Uae,e.version_cpu=wbe,e.version_layers=Ele,e.version_webgl=oEe,e.webgl=uEe,e.webgl_util=INe,e.where=O7,e.whereAsync=ene,e.zeros=H9,e.zerosLike=F7}));
//# sourceMappingURL=tf.min.js.map