From 6c3ebc73c1982bfc13f734f65388f65cb2b46810 Mon Sep 17 00:00:00 2001 From: HenryXII Date: Tue, 28 May 2024 04:48:01 +0000 Subject: [PATCH] deploy: 23fbd9658417f4183e7aba3babdba432d0537544 --- build/bundle.js | 14 +++++++------- build/bundle.js.map | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build/bundle.js b/build/bundle.js index 043e623..6894726 100644 --- a/build/bundle.js +++ b/build/bundle.js @@ -1,4 +1,4 @@ -var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function r(t){t.forEach(e)}function i(t){return"function"==typeof t}function o(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function a(t,e){t.appendChild(e)}function s(t,e,n){t.insertBefore(e,n||null)}function u(t){t.parentNode&&t.parentNode.removeChild(t)}function c(t){return document.createElement(t)}function l(){return t=" ",document.createTextNode(t);var t}function f(t,e,n,r){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)}function h(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}let p;function d(t){p=t}function m(t){(function(){if(!p)throw new Error("Function called outside component initialization");return p})().$$.on_mount.push(t)}const g=[],v=[];let y=[];const b=[],x=Promise.resolve();let w=!1;function k(t){y.push(t)}const E=new Set;let C=0;function S(){if(0!==C)return;const t=p;do{try{for(;C{O.delete(t),r&&(n&&t.d(1),r())})),t.o(e)}else r&&r()}function D(t){t&&t.c()}function I(t,n,o,a){const{fragment:s,after_update:u}=t.$$;s&&s.m(n,o),a||k((()=>{const n=t.$$.on_mount.map(e).filter(i);t.$$.on_destroy?t.$$.on_destroy.push(...n):r(n),t.$$.on_mount=[]})),u.forEach(k)}function R(t,e){const n=t.$$;null!==n.fragment&&(!function(t){const e=[],n=[];y.forEach((r=>-1===t.indexOf(r)?e.push(r):n.push(r))),n.forEach((t=>t())),y=e}(n.after_update),r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function F(t,e){-1===t.$$.dirty[0]&&(g.push(t),w||(w=!0,x.then(S)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const i=r.length?r[0]:n;return m.ctx&&s(m.ctx[t],m.ctx[t]=i)&&(!m.skip_bound&&m.bound[t]&&m.bound[t](i),g&&F(e,t)),n})):[],m.update(),g=!0,r(m.before_update),m.fragment=!!a&&a(m.ctx),i.target){if(i.hydrate){const t=function(t){return Array.from(t.childNodes)}(i.target);m.fragment&&m.fragment.l(t),t.forEach(u)}else m.fragment&&m.fragment.c();i.intro&&N(e.$$.fragment),I(e,i.target,i.anchor,i.customElement),S()}d(h)}class B{$destroy(){R(this,1),this.$destroy=t}$on(e,n){if(!i(n))return t;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const t=r.indexOf(n);-1!==t&&r.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function z(e){let n,r,i,o,s,l,f,p,d,m;return{c(){n=c("meta"),r=c("meta"),i=c("meta"),o=c("meta"),s=c("meta"),l=c("meta"),f=c("meta"),p=c("meta"),d=c("meta"),m=c("meta"),document.title="MLU-Explain:",h(n,"charset","utf-8"),h(r,"http-equiv","X-UA-Compatible"),h(r,"content","IE=edge"),h(i,"name","viewport"),h(i,"content","width=device-width,initial-scale=1"),h(o,"name","viewport"),h(o,"content","width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"),h(s,"name","description"),h(s,"content","Svelte Interactive Article Starter"),h(l,"property","og:image"),h(l,"content",""),h(f,"property","og:title"),h(f,"content","Svelte Interactive Article Starter"),h(p,"property","og:description"),h(p,"content","Svelte Interactive Article Starter"),h(d,"property","og:image:width"),h(d,"content","1000"),h(m,"property","og:image:height"),h(m,"content","630")},m(t,e){a(document.head,n),a(document.head,r),a(document.head,i),a(document.head,o),a(document.head,s),a(document.head,l),a(document.head,f),a(document.head,p),a(document.head,d),a(document.head,m)},p:t,i:t,o:t,d(t){u(n),u(r),u(i),u(o),u(s),u(l),u(f),u(p),u(d),u(m)}}}class j extends B{constructor(t){super(),M(this,t,null,z,o,{})}}function P(e){let n;return{c(){n=c("section"),n.innerHTML='

Classifying MNIST Dataset With K-Nearest Neighbors

\n

Introducing K-Nearest Neighbors and how it can be used for handwritten digit\n classification using the MNIST dataset.

\n

Monica Dai, Joyce Lu, Henry Xu, May 2024

',h(n,"id","intro"),h(n,"class","svelte-1c8kzz5")},m(t,e){s(t,n,e)},p:t,i:t,o:t,d(t){t&&u(n)}}}class L extends B{constructor(t){super(),M(this,t,null,P,o,{})}}function W(e){let n;return{c(){n=c("section"),n.innerHTML='

K-nearest neighbors (KNN)\n algorithm is one of the simplest classification and regression classifiers. It\n is a non-parametric algorithm, which means that it does not assume any specific\n data distribution. It operates based on the idea that similar data points are\n close to each other in a multi-dimensional space. KNN classifies a new data point\n based on the majority class of its 'k' nearest neighbors. 'k' controls the complexity\n of the decision boundary, thus influencing the overall performance of the model.\n When k is small, the decision boundary tends to be more complex, following the\n contours of training data more closely; as k increases, the decision boundary\n tends to be smoother and simpler. Choosing the right k helps balance between\n overfitting and underfitting.

'},m(t,e){s(t,n,e)},p:t,i:t,o:t,d(t){t&&u(n)}}}class U extends B{constructor(t){super(),M(this,t,null,W,o,{})}}var V="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function q(t){var e={exports:{}};return t(e,e.exports),e.exports}function H(e){let n;return{c(){n=c("section"),n.innerHTML='

Concluding Text

\n

Lorem ipsum dolor, sit amet consectetur adipisicing elit. Eos voluptas dicta\n blanditiis doloremque dolorum asperiores fugiat non, obcaecati maiores id,\n voluptatum possimus libero iure laudantium dignissimos corrupti? Iure omnis\n consectetur aperiam ipsam quod eum quas similique atque laboriosam ex\n accusantium quaerat laudantium, est a libero sed cumque odio perspiciatis\n enim, sequi, corrupti alias beatae nulla. Iure est ut dignissimos debitis\n optio quasi vel distinctio officiis doloremque, ad voluptates, omnis nam\n corporis, aut exercitationem ex excepturi tempore et modi unde alias nemo\n accusantium. Tempore odio nulla ex ad ut molestiae unde minima ipsam\n aliquid, omnis, labore commodi aliquam incidunt ratione autem?

',h(n,"id","conclusion"),h(n,"class","svelte-x4u2ks")},m(t,e){s(t,n,e)},p:t,i:t,o:t,d(t){t&&u(n)}}}q((function(t,e){var n;"undefined"!=typeof self&&self,n=function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(t,e,n){},function(t,e,n){n.r(e),n(0);var r=function(){function t(t,e,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=e,this.end=n}return t.range=function(e,n){return n?e&&e.loc&&n.loc&&e.loc.lexer===n.loc.lexer?new t(e.loc.lexer,e.loc.start,n.loc.end):null:e&&e.loc},t}(),i=function(){function t(t,e){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=t,this.loc=e}return t.prototype.range=function(e,n){return new t(n,r.range(this,e))},t}(),o=function t(e,n){this.position=void 0;var r,i="KaTeX parse error: "+e,o=n&&n.loc;if(o&&o.start<=o.end){var a=o.lexer.input;r=o.start;var s=o.end;r===a.length?i+=" at end of input: ":i+=" at position "+(r+1)+": ";var u=a.slice(r,s).replace(/[^]/g,"$&̲");i+=(r>15?"…"+a.slice(r-15,r):a.slice(0,r))+u+(s+15":">","<":"<",'"':""","'":"'"},c=/[&><"']/g,l=function t(e){return"ordgroup"===e.type||"color"===e.type?1===e.body.length?t(e.body[0]):e:"font"===e.type?t(e.body):e},f={contains:function(t,e){return-1!==t.indexOf(e)},deflt:function(t,e){return void 0===t?e:t},escape:function(t){return String(t).replace(c,(function(t){return u[t]}))},hyphenate:function(t){return t.replace(s,"-$1").toLowerCase()},getBaseElem:l,isCharacterBox:function(t){var e=l(t);return"mathord"===e.type||"textord"===e.type||"atom"===e.type},protocolFromUrl:function(t){var e=/^\s*([^\\/#]*?)(?::|�*58|�*3a)/i.exec(t);return null!=e?e[1]:"_relative"}},h=function(){function t(t){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{},this.displayMode=f.deflt(t.displayMode,!1),this.output=f.deflt(t.output,"htmlAndMathml"),this.leqno=f.deflt(t.leqno,!1),this.fleqn=f.deflt(t.fleqn,!1),this.throwOnError=f.deflt(t.throwOnError,!0),this.errorColor=f.deflt(t.errorColor,"#cc0000"),this.macros=t.macros||{},this.minRuleThickness=Math.max(0,f.deflt(t.minRuleThickness,0)),this.colorIsTextColor=f.deflt(t.colorIsTextColor,!1),this.strict=f.deflt(t.strict,"warn"),this.trust=f.deflt(t.trust,!1),this.maxSize=Math.max(0,f.deflt(t.maxSize,1/0)),this.maxExpand=Math.max(0,f.deflt(t.maxExpand,1e3)),this.globalGroup=f.deflt(t.globalGroup,!1)}var e=t.prototype;return e.reportNonstrict=function(t,e,n){var r=this.strict;if("function"==typeof r&&(r=r(t,e,n)),r&&"ignore"!==r){if(!0===r||"error"===r)throw new a("LaTeX-incompatible input and strict mode is set to 'error': "+e+" ["+t+"]",n);"warn"===r?"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+e+" ["+t+"]"):"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+r+"': "+e+" ["+t+"]")}},e.useStrictBehavior=function(t,e,n){var r=this.strict;if("function"==typeof r)try{r=r(t,e,n)}catch(t){r="error"}return!(!r||"ignore"===r||!0!==r&&"error"!==r&&("warn"===r?("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+e+" ["+t+"]"),1):("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+r+"': "+e+" ["+t+"]"),1)))},e.isTrusted=function(t){t.url&&!t.protocol&&(t.protocol=f.protocolFromUrl(t.url));var e="function"==typeof this.trust?this.trust(t):this.trust;return Boolean(e)},t}(),p=function(){function t(t,e,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=e,this.cramped=n}var e=t.prototype;return e.sup=function(){return d[m[this.id]]},e.sub=function(){return d[g[this.id]]},e.fracNum=function(){return d[v[this.id]]},e.fracDen=function(){return d[y[this.id]]},e.cramp=function(){return d[b[this.id]]},e.text=function(){return d[x[this.id]]},e.isTight=function(){return this.size>=2},t}(),d=[new p(0,0,!1),new p(1,0,!0),new p(2,1,!1),new p(3,1,!0),new p(4,2,!1),new p(5,2,!0),new p(6,3,!1),new p(7,3,!0)],m=[4,5,4,5,6,7,6,7],g=[5,5,5,5,7,7,7,7],v=[2,3,4,5,6,7,6,7],y=[3,3,5,5,7,7,7,7],b=[1,1,3,3,5,5,7,7],x=[0,1,2,3,2,3,2,3],w={DISPLAY:d[0],TEXT:d[2],SCRIPT:d[4],SCRIPTSCRIPT:d[6]},k=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}],E=[];function C(t){for(var e=0;e=E[e]&&t<=E[e+1])return!0;return!1}k.forEach((function(t){return t.blocks.forEach((function(t){return E.push.apply(E,t)}))}));var S=80,A={leftParenInner:"M291 0 H417 V300 H291 z",rightParenInner:"M457 0 H583 V300 H457 z",doubleleftarrow:"M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",doublerightarrow:"M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",leftarrow:"M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",leftbrace:"M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",leftbraceunder:"M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",leftgroup:"M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z",leftgroupunder:"M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z",leftharpoon:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z",leftharpoonplus:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z",leftharpoondown:"M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z",leftharpoondownplus:"M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z",lefthook:"M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z",leftlinesegment:"M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",leftmapsto:"M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",leftToFrom:"M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z",longequal:"M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",midbrace:"M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z",midbraceunder:"M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z",oiintSize1:"M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",oiintSize2:"M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",oiiintSize1:"M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",oiiintSize2:"M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",rightarrow:"M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z",rightbrace:"M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z",rightbraceunder:"M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z",rightgroup:"M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z",rightgroupunder:"M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z",rightharpoon:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z",rightharpoonplus:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z",rightharpoondown:"M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z",rightharpoondownplus:"M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z",righthook:"M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z",rightlinesegment:"M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",rightToFrom:"M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z",twoheadleftarrow:"M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z",twoheadrightarrow:"M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z",tilde1:"M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z",tilde2:"M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z",tilde3:"M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z",tilde4:"M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z",vec:"M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",widehat1:"M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z",widehat2:"M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat3:"M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat4:"M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widecheck1:"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",widecheck2:"M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck3:"M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck4:"M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",baraboveleftarrow:"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",rightarrowabovebar:"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",baraboveshortleftharpoon:"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",rightharpoonaboveshortbar:"M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",shortbaraboveleftharpoon:"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"},O=function(){function t(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}var e=t.prototype;return e.hasClass=function(t){return f.contains(this.classes,t)},e.toNode=function(){for(var t=document.createDocumentFragment(),e=0;e"},I=function(){function t(t,e,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,N.call(this,t,n,r),this.children=e||[]}var e=t.prototype;return e.setAttribute=function(t,e){this.attributes[t]=e},e.hasClass=function(t){return f.contains(this.classes,t)},e.toNode=function(){return T.call(this,"span")},e.toMarkup=function(){return D.call(this,"span")},t}(),R=function(){function t(t,e,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,N.call(this,e,r),this.children=n||[],this.setAttribute("href",t)}var e=t.prototype;return e.setAttribute=function(t,e){this.attributes[t]=e},e.hasClass=function(t){return f.contains(this.classes,t)},e.toNode=function(){return T.call(this,"a")},e.toMarkup=function(){return D.call(this,"a")},t}(),F=function(){function t(t,e,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=e,this.src=t,this.classes=["mord"],this.style=n}var e=t.prototype;return e.hasClass=function(t){return f.contains(this.classes,t)},e.toNode=function(){var t=document.createElement("img");for(var e in t.src=this.src,t.alt=this.alt,t.className="mord",this.style)this.style.hasOwnProperty(e)&&(t.style[e]=this.style[e]);return t},e.toMarkup=function(){var t=""+this.alt+"=i[0]&&t<=i[1])return n.name}return null}(this.text.charCodeAt(0));u&&this.classes.push(u+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=M[this.text])}var e=t.prototype;return e.hasClass=function(t){return f.contains(this.classes,t)},e.toNode=function(){var t=document.createTextNode(this.text),e=null;for(var n in this.italic>0&&((e=document.createElement("span")).style.marginRight=this.italic+"em"),this.classes.length>0&&((e=e||document.createElement("span")).className=_(this.classes)),this.style)this.style.hasOwnProperty(n)&&((e=e||document.createElement("span")).style[n]=this.style[n]);return e?(e.appendChild(t),e):t},e.toMarkup=function(){var t=!1,e="0&&(n+="margin-right:"+this.italic+"em;"),this.style)this.style.hasOwnProperty(r)&&(n+=f.hyphenate(r)+":"+this.style[r]+";");n&&(t=!0,e+=' style="'+f.escape(n)+'"');var i=f.escape(this.text);return t?(e+=">",e+=i,e+=""):i},t}(),z=function(){function t(t,e){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=e||{}}var e=t.prototype;return e.toNode=function(){var t=document.createElementNS("http://www.w3.org/2000/svg","svg");for(var e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&t.setAttribute(e,this.attributes[e]);for(var n=0;n":""},t}(),P=function(){function t(t){this.attributes=void 0,this.attributes=t||{}}var e=t.prototype;return e.toNode=function(){var t=document.createElementNS("http://www.w3.org/2000/svg","line");for(var e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&t.setAttribute(e,this.attributes[e]);return t},e.toMarkup=function(){var t="","\\gt",!0),Y(J,Q,ct,"∈","\\in",!0),Y(J,Q,ct,"","\\@not"),Y(J,Q,ct,"⊂","\\subset",!0),Y(J,Q,ct,"⊃","\\supset",!0),Y(J,Q,ct,"⊆","\\subseteq",!0),Y(J,Q,ct,"⊇","\\supseteq",!0),Y(J,tt,ct,"⊈","\\nsubseteq",!0),Y(J,tt,ct,"⊉","\\nsupseteq",!0),Y(J,Q,ct,"⊨","\\models"),Y(J,Q,ct,"←","\\leftarrow",!0),Y(J,Q,ct,"≤","\\le"),Y(J,Q,ct,"≤","\\leq",!0),Y(J,Q,ct,"<","\\lt",!0),Y(J,Q,ct,"→","\\rightarrow",!0),Y(J,Q,ct,"→","\\to"),Y(J,tt,ct,"≱","\\ngeq",!0),Y(J,tt,ct,"≰","\\nleq",!0),Y(J,Q,lt," ","\\ "),Y(J,Q,lt," ","~"),Y(J,Q,lt," ","\\space"),Y(J,Q,lt," ","\\nobreakspace"),Y(Z,Q,lt," ","\\ "),Y(Z,Q,lt," "," "),Y(Z,Q,lt," ","~"),Y(Z,Q,lt," ","\\space"),Y(Z,Q,lt," ","\\nobreakspace"),Y(J,Q,lt,null,"\\nobreak"),Y(J,Q,lt,null,"\\allowbreak"),Y(J,Q,ut,",",","),Y(J,Q,ut,";",";"),Y(J,tt,nt,"⊼","\\barwedge",!0),Y(J,tt,nt,"⊻","\\veebar",!0),Y(J,Q,nt,"⊙","\\odot",!0),Y(J,Q,nt,"⊕","\\oplus",!0),Y(J,Q,nt,"⊗","\\otimes",!0),Y(J,Q,ft,"∂","\\partial",!0),Y(J,Q,nt,"⊘","\\oslash",!0),Y(J,tt,nt,"⊚","\\circledcirc",!0),Y(J,tt,nt,"⊡","\\boxdot",!0),Y(J,Q,nt,"△","\\bigtriangleup"),Y(J,Q,nt,"▽","\\bigtriangledown"),Y(J,Q,nt,"†","\\dagger"),Y(J,Q,nt,"⋄","\\diamond"),Y(J,Q,nt,"⋆","\\star"),Y(J,Q,nt,"◃","\\triangleleft"),Y(J,Q,nt,"▹","\\triangleright"),Y(J,Q,st,"{","\\{"),Y(Z,Q,ft,"{","\\{"),Y(Z,Q,ft,"{","\\textbraceleft"),Y(J,Q,rt,"}","\\}"),Y(Z,Q,ft,"}","\\}"),Y(Z,Q,ft,"}","\\textbraceright"),Y(J,Q,st,"{","\\lbrace"),Y(J,Q,rt,"}","\\rbrace"),Y(J,Q,st,"[","\\lbrack",!0),Y(Z,Q,ft,"[","\\lbrack",!0),Y(J,Q,rt,"]","\\rbrack",!0),Y(Z,Q,ft,"]","\\rbrack",!0),Y(J,Q,st,"(","\\lparen",!0),Y(J,Q,rt,")","\\rparen",!0),Y(Z,Q,ft,"<","\\textless",!0),Y(Z,Q,ft,">","\\textgreater",!0),Y(J,Q,st,"⌊","\\lfloor",!0),Y(J,Q,rt,"⌋","\\rfloor",!0),Y(J,Q,st,"⌈","\\lceil",!0),Y(J,Q,rt,"⌉","\\rceil",!0),Y(J,Q,ft,"\\","\\backslash"),Y(J,Q,ft,"∣","|"),Y(J,Q,ft,"∣","\\vert"),Y(Z,Q,ft,"|","\\textbar",!0),Y(J,Q,ft,"∥","\\|"),Y(J,Q,ft,"∥","\\Vert"),Y(Z,Q,ft,"∥","\\textbardbl"),Y(Z,Q,ft,"~","\\textasciitilde"),Y(Z,Q,ft,"\\","\\textbackslash"),Y(Z,Q,ft,"^","\\textasciicircum"),Y(J,Q,ct,"↑","\\uparrow",!0),Y(J,Q,ct,"⇑","\\Uparrow",!0),Y(J,Q,ct,"↓","\\downarrow",!0),Y(J,Q,ct,"⇓","\\Downarrow",!0),Y(J,Q,ct,"↕","\\updownarrow",!0),Y(J,Q,ct,"⇕","\\Updownarrow",!0),Y(J,Q,at,"∐","\\coprod"),Y(J,Q,at,"⋁","\\bigvee"),Y(J,Q,at,"⋀","\\bigwedge"),Y(J,Q,at,"⨄","\\biguplus"),Y(J,Q,at,"⋂","\\bigcap"),Y(J,Q,at,"⋃","\\bigcup"),Y(J,Q,at,"∫","\\int"),Y(J,Q,at,"∫","\\intop"),Y(J,Q,at,"∬","\\iint"),Y(J,Q,at,"∭","\\iiint"),Y(J,Q,at,"∏","\\prod"),Y(J,Q,at,"∑","\\sum"),Y(J,Q,at,"⨂","\\bigotimes"),Y(J,Q,at,"⨁","\\bigoplus"),Y(J,Q,at,"⨀","\\bigodot"),Y(J,Q,at,"∮","\\oint"),Y(J,Q,at,"⨆","\\bigsqcup"),Y(J,Q,at,"∫","\\smallint"),Y(Z,Q,it,"…","\\textellipsis"),Y(J,Q,it,"…","\\mathellipsis"),Y(Z,Q,it,"…","\\ldots",!0),Y(J,Q,it,"…","\\ldots",!0),Y(J,Q,it,"⋯","\\@cdots",!0),Y(J,Q,it,"⋱","\\ddots",!0),Y(J,Q,ft,"⋮","\\varvdots"),Y(J,Q,et,"ˊ","\\acute"),Y(J,Q,et,"ˋ","\\grave"),Y(J,Q,et,"¨","\\ddot"),Y(J,Q,et,"~","\\tilde"),Y(J,Q,et,"ˉ","\\bar"),Y(J,Q,et,"˘","\\breve"),Y(J,Q,et,"ˇ","\\check"),Y(J,Q,et,"^","\\hat"),Y(J,Q,et,"⃗","\\vec"),Y(J,Q,et,"˙","\\dot"),Y(J,Q,et,"˚","\\mathring"),Y(J,Q,ot,"","\\@imath"),Y(J,Q,ot,"","\\@jmath"),Y(J,Q,ft,"ı","ı"),Y(J,Q,ft,"ȷ","ȷ"),Y(Z,Q,ft,"ı","\\i",!0),Y(Z,Q,ft,"ȷ","\\j",!0),Y(Z,Q,ft,"ß","\\ss",!0),Y(Z,Q,ft,"æ","\\ae",!0),Y(Z,Q,ft,"œ","\\oe",!0),Y(Z,Q,ft,"ø","\\o",!0),Y(Z,Q,ft,"Æ","\\AE",!0),Y(Z,Q,ft,"Œ","\\OE",!0),Y(Z,Q,ft,"Ø","\\O",!0),Y(Z,Q,et,"ˊ","\\'"),Y(Z,Q,et,"ˋ","\\`"),Y(Z,Q,et,"ˆ","\\^"),Y(Z,Q,et,"˜","\\~"),Y(Z,Q,et,"ˉ","\\="),Y(Z,Q,et,"˘","\\u"),Y(Z,Q,et,"˙","\\."),Y(Z,Q,et,"˚","\\r"),Y(Z,Q,et,"ˇ","\\v"),Y(Z,Q,et,"¨",'\\"'),Y(Z,Q,et,"˝","\\H"),Y(Z,Q,et,"◯","\\textcircled");var ht={"--":!0,"---":!0,"``":!0,"''":!0};Y(Z,Q,ft,"–","--",!0),Y(Z,Q,ft,"–","\\textendash"),Y(Z,Q,ft,"—","---",!0),Y(Z,Q,ft,"—","\\textemdash"),Y(Z,Q,ft,"‘","`",!0),Y(Z,Q,ft,"‘","\\textquoteleft"),Y(Z,Q,ft,"’","'",!0),Y(Z,Q,ft,"’","\\textquoteright"),Y(Z,Q,ft,"“","``",!0),Y(Z,Q,ft,"“","\\textquotedblleft"),Y(Z,Q,ft,"”","''",!0),Y(Z,Q,ft,"”","\\textquotedblright"),Y(J,Q,ft,"°","\\degree",!0),Y(Z,Q,ft,"°","\\degree"),Y(Z,Q,ft,"°","\\textdegree",!0),Y(J,Q,ft,"£","\\pounds"),Y(J,Q,ft,"£","\\mathsterling",!0),Y(Z,Q,ft,"£","\\pounds"),Y(Z,Q,ft,"£","\\textsterling",!0),Y(J,tt,ft,"✠","\\maltese"),Y(Z,tt,ft,"✠","\\maltese");for(var pt='0123456789/@."',dt=0;dt<14;dt++){var mt=pt.charAt(dt);Y(J,Q,ft,mt,mt)}for(var gt='0123456789!@*()-=+";:?/.,',vt=0;vt<25;vt++){var yt=gt.charAt(vt);Y(Z,Q,ft,yt,yt)}for(var bt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",xt=0;xt<52;xt++){var wt=bt.charAt(xt);Y(J,Q,ot,wt,wt),Y(Z,Q,ft,wt,wt)}Y(J,tt,ft,"C","ℂ"),Y(Z,tt,ft,"C","ℂ"),Y(J,tt,ft,"H","ℍ"),Y(Z,tt,ft,"H","ℍ"),Y(J,tt,ft,"N","ℕ"),Y(Z,tt,ft,"N","ℕ"),Y(J,tt,ft,"P","ℙ"),Y(Z,tt,ft,"P","ℙ"),Y(J,tt,ft,"Q","ℚ"),Y(Z,tt,ft,"Q","ℚ"),Y(J,tt,ft,"R","ℝ"),Y(Z,tt,ft,"R","ℝ"),Y(J,tt,ft,"Z","ℤ"),Y(Z,tt,ft,"Z","ℤ"),Y(J,Q,ot,"h","ℎ"),Y(Z,Q,ot,"h","ℎ");for(var kt="",Et=0;Et<52;Et++){var Ct=bt.charAt(Et);Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56320+Et)),Y(Z,Q,ft,Ct,kt),Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56372+Et)),Y(Z,Q,ft,Ct,kt),Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56424+Et)),Y(Z,Q,ft,Ct,kt),Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56580+Et)),Y(Z,Q,ft,Ct,kt),Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56736+Et)),Y(Z,Q,ft,Ct,kt),Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56788+Et)),Y(Z,Q,ft,Ct,kt),Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56840+Et)),Y(Z,Q,ft,Ct,kt),Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56944+Et)),Y(Z,Q,ft,Ct,kt),Et<26&&(Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56632+Et)),Y(Z,Q,ft,Ct,kt),Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56476+Et)),Y(Z,Q,ft,Ct,kt))}Y(J,Q,ot,"k",kt=String.fromCharCode(55349,56668)),Y(Z,Q,ft,"k",kt);for(var St=0;St<10;St++){var At=St.toString();Y(J,Q,ot,At,kt=String.fromCharCode(55349,57294+St)),Y(Z,Q,ft,At,kt),Y(J,Q,ot,At,kt=String.fromCharCode(55349,57314+St)),Y(Z,Q,ft,At,kt),Y(J,Q,ot,At,kt=String.fromCharCode(55349,57324+St)),Y(Z,Q,ft,At,kt),Y(J,Q,ot,At,kt=String.fromCharCode(55349,57334+St)),Y(Z,Q,ft,At,kt)}for(var Ot="ÇÐÞçþ",_t=0;_t<5;_t++){var Nt=Ot.charAt(_t);Y(J,Q,ot,Nt,Nt),Y(Z,Q,ft,Nt,Nt)}var Tt=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["","",""],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],Dt=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],It=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Rt=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Ft=function(t,e){return e.size<2?t:It[t-1][e.size-1]},Mt=function(){function t(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||t.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=Rt[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}var e=t.prototype;return e.extend=function(e){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return new t(n)},e.havingStyle=function(t){return this.style===t?this:this.extend({style:t,size:Ft(this.textSize,t)})},e.havingCrampedStyle=function(){return this.havingStyle(this.style.cramp())},e.havingSize=function(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:Rt[t-1]})},e.havingBaseStyle=function(e){e=e||this.style.text();var n=Ft(t.BASESIZE,e);return this.size===n&&this.textSize===t.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})},e.havingBaseSizing=function(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})},e.withColor=function(t){return this.extend({color:t})},e.withPhantom=function(){return this.extend({phantom:!0})},e.withFont=function(t){return this.extend({font:t})},e.withTextFontFamily=function(t){return this.extend({fontFamily:t,font:""})},e.withTextFontWeight=function(t){return this.extend({fontWeight:t,font:""})},e.withTextFontShape=function(t){return this.extend({fontShape:t,font:""})},e.sizingClasses=function(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]},e.baseSizingClasses=function(){return this.size!==t.BASESIZE?["sizing","reset-size"+this.size,"size"+t.BASESIZE]:[]},e.fontMetrics=function(){return this._fontMetrics||(this._fontMetrics=function(t){var e;if(!H[e=t>=5?0:t>=3?1:2]){var n=H[e]={cssEmPerMu:U.quad[e]/18};for(var r in U)U.hasOwnProperty(r)&&(n[r]=U[r][e])}return H[e]}(this.size)),this._fontMetrics},e.getColor=function(){return this.phantom?"transparent":this.color},t}();Mt.BASESIZE=6;var Bt=Mt,zt={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:1.00375,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:1.00375},jt={ex:!0,em:!0,mu:!0},Pt=function(t){return"string"!=typeof t&&(t=t.unit),t in zt||t in jt||"ex"===t},Lt=function(t,e){var n;if(t.unit in zt)n=zt[t.unit]/e.fontMetrics().ptPerEm/e.sizeMultiplier;else if("mu"===t.unit)n=e.fontMetrics().cssEmPerMu;else{var r;if(r=e.style.isTight()?e.havingStyle(e.style.text()):e,"ex"===t.unit)n=r.fontMetrics().xHeight;else{if("em"!==t.unit)throw new a("Invalid unit: '"+t.unit+"'");n=r.fontMetrics().quad}r!==e&&(n*=r.sizeMultiplier/e.sizeMultiplier)}return Math.min(t.number*n,e.maxSize)},Wt=function(t,e,n){return X[n][t]&&X[n][t].replace&&(t=X[n][t].replace),{value:t,metrics:q(t,e,n)}},Ut=function(t,e,n,r,i){var o,a=Wt(t,e,n),s=a.metrics;if(t=a.value,s){var u=s.italic;("text"===n||r&&"mathit"===r.font)&&(u=0),o=new B(t,s.height,s.depth,u,s.skew,s.width,i)}else"undefined"!=typeof console&&console.warn("No character metrics for '"+t+"' in style '"+e+"' and mode '"+n+"'"),o=new B(t,0,0,0,0,0,i);if(r){o.maxFontSize=r.sizeMultiplier,r.style.isTight()&&o.classes.push("mtight");var c=r.getColor();c&&(o.style.color=c)}return o},Vt=function(t,e){if(_(t.classes)!==_(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize)return!1;for(var n in t.style)if(t.style.hasOwnProperty(n)&&t.style[n]!==e.style[n])return!1;for(var r in e.style)if(e.style.hasOwnProperty(r)&&t.style[r]!==e.style[r])return!1;return!0},qt=function(t){for(var e=0,n=0,r=0,i=0;ie&&(e=o.height),o.depth>n&&(n=o.depth),o.maxFontSize>r&&(r=o.maxFontSize)}t.height=e,t.depth=n,t.maxFontSize=r},Ht=function(t,e,n,r){var i=new I(t,e,n,r);return qt(i),i},Gt=function(t,e,n,r){return new I(t,e,n,r)},$t=function(t){var e=new O(t);return qt(e),e},Kt=function(t,e,n){var r="";switch(t){case"amsrm":r="AMS";break;case"textrm":r="Main";break;case"textsf":r="SansSerif";break;case"texttt":r="Typewriter";break;default:r=t}return r+"-"+("textbf"===e&&"textit"===n?"BoldItalic":"textbf"===e?"Bold":"textit"===e?"Italic":"Regular")},Xt={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},Yt={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659],leftParenInner:["leftParenInner",.875,.3],rightParenInner:["rightParenInner",.875,.3]},Jt={fontMap:Xt,makeSymbol:Ut,mathsym:function(t,e,n,r){return void 0===r&&(r=[]),"boldsymbol"===n.font&&Wt(t,"Main-Bold",e).metrics?Ut(t,"Main-Bold",e,n,r.concat(["mathbf"])):"\\"===t||"main"===X[e][t].font?Ut(t,"Main-Regular",e,n,r):Ut(t,"AMS-Regular",e,n,r.concat(["amsrm"]))},makeSpan:Ht,makeSvgSpan:Gt,makeLineSpan:function(t,e,n){var r=Ht([t],[],e);return r.height=Math.max(n||e.fontMetrics().defaultRuleThickness,e.minRuleThickness),r.style.borderBottomWidth=r.height+"em",r.maxFontSize=1,r},makeAnchor:function(t,e,n,r){var i=new R(t,e,n,r);return qt(i),i},makeFragment:$t,wrapFragment:function(t,e){return t instanceof O?Ht([],[t],e):t},makeVList:function(t,e){for(var n=function(t){if("individualShift"===t.positionType){for(var e=t.children,n=[e[0]],r=-e[0].shift-e[0].elem.depth,i=r,o=1;o0&&(o.push(we(a,e)),a=[]),o.push(i[s]));a.length>0&&o.push(we(a,e)),n&&((r=we(de(n,e,!0))).classes=["tag"],o.push(r));var c=ce(["katex-html"],o);if(c.setAttribute("aria-hidden","true"),r){var l=r.children[0];l.style.height=c.height+c.depth+"em",l.style.verticalAlign=-c.depth+"em"}return c}function Ee(t){return new O(t)}var Ce=function(){function t(t,e){this.type=void 0,this.attributes=void 0,this.children=void 0,this.type=t,this.attributes={},this.children=e||[]}var e=t.prototype;return e.setAttribute=function(t,e){this.attributes[t]=e},e.getAttribute=function(t){return this.attributes[t]},e.toNode=function(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&t.setAttribute(e,this.attributes[e]);for(var n=0;n"},e.toText=function(){return this.children.map((function(t){return t.toText()})).join("")},t}(),Se=function(){function t(t){this.text=void 0,this.text=t}var e=t.prototype;return e.toNode=function(){return document.createTextNode(this.text)},e.toMarkup=function(){return f.escape(this.toText())},e.toText=function(){return this.text},t}(),Ae={MathNode:Ce,TextNode:Se,SpaceNode:function(){function t(t){this.width=void 0,this.character=void 0,this.width=t,this.character=t>=.05555&&t<=.05556?" ":t>=.1666&&t<=.1667?" ":t>=.2222&&t<=.2223?" ":t>=.2777&&t<=.2778?"  ":t>=-.05556&&t<=-.05555?" ⁣":t>=-.1667&&t<=-.1666?" ⁣":t>=-.2223&&t<=-.2222?" ⁣":t>=-.2778&&t<=-.2777?" ⁣":null}var e=t.prototype;return e.toNode=function(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",this.width+"em"),t},e.toMarkup=function(){return this.character?""+this.character+"":''},e.toText=function(){return this.character?this.character:" "},t}(),newDocumentFragment:Ee},Oe=function(t,e,n){return!X[e][t]||!X[e][t].replace||55349===t.charCodeAt(0)||ht.hasOwnProperty(t)&&n&&(n.fontFamily&&"tt"===n.fontFamily.substr(4,2)||n.font&&"tt"===n.font.substr(4,2))||(t=X[e][t].replace),new Ae.TextNode(t)},_e=function(t){return 1===t.length?t[0]:new Ae.MathNode("mrow",t)},Ne=function(t,e){if("texttt"===e.fontFamily)return"monospace";if("textsf"===e.fontFamily)return"textit"===e.fontShape&&"textbf"===e.fontWeight?"sans-serif-bold-italic":"textit"===e.fontShape?"sans-serif-italic":"textbf"===e.fontWeight?"bold-sans-serif":"sans-serif";if("textit"===e.fontShape&&"textbf"===e.fontWeight)return"bold-italic";if("textit"===e.fontShape)return"italic";if("textbf"===e.fontWeight)return"bold";var n=e.font;if(!n||"mathnormal"===n)return null;var r=t.mode;if("mathit"===n)return"italic";if("boldsymbol"===n)return"textord"===t.type?"bold":"bold-italic";if("mathbf"===n)return"bold";if("mathbb"===n)return"double-struck";if("mathfrak"===n)return"fraktur";if("mathscr"===n||"mathcal"===n)return"script";if("mathsf"===n)return"sans-serif";if("mathtt"===n)return"monospace";var i=t.text;return f.contains(["\\imath","\\jmath"],i)?null:(X[r][i]&&X[r][i].replace&&(i=X[r][i].replace),q(i,Jt.fontMap[n].fontName,r)?Jt.fontMap[n].variant:null)},Te=function(t,e,n){if(1===t.length){var r=Ie(t[0],e);return n&&r instanceof Ce&&"mo"===r.type&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}for(var i,o=[],a=0;a0&&(p.text=p.text.slice(0,1)+"̸"+p.text.slice(1),o.pop())}}}o.push(s),i=s}return o},De=function(t,e,n){return _e(Te(t,e,n))},Ie=function(t,e){if(!t)return new Ae.MathNode("mrow");if(oe[t.type])return oe[t.type](t,e);throw new a("Got group of unknown type: '"+t.type+"'")};function Re(t,e,n,r,i){var o,a=Te(t,n);o=1===a.length&&a[0]instanceof Ce&&f.contains(["mrow","mtable"],a[0].type)?a[0]:new Ae.MathNode("mrow",a);var s=new Ae.MathNode("annotation",[new Ae.TextNode(e)]);s.setAttribute("encoding","application/x-tex");var u=new Ae.MathNode("semantics",[o,s]),c=new Ae.MathNode("math",[u]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var l=i?"katex":"katex-mathml";return Jt.makeSpan([l],[c])}var Fe=function(t){return new Bt({style:t.displayMode?w.DISPLAY:w.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},Me=function(t,e){if(e.displayMode){var n=["katex-display"];e.leqno&&n.push("leqno"),e.fleqn&&n.push("fleqn"),t=Jt.makeSpan(n,[t])}return t},Be={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋"},ze={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},je=function(t,e,n,r){var i,o=t.height+t.depth+2*n;if(/fbox|color/.test(e)){if(i=Jt.makeSpan(["stretchy",e],[],r),"fbox"===e){var a=r.color&&r.getColor();a&&(i.style.borderColor=a)}}else{var s=[];/^[bx]cancel$/.test(e)&&s.push(new P({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(e)&&s.push(new P({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var u=new z(s,{width:"100%",height:o+"em"});i=Jt.makeSvgSpan([],[u],r)}return i.height=o,i.style.height=o+"em",i},Pe=function(t){var e=new Ae.MathNode("mo",[new Ae.TextNode(Be[t.substr(1)])]);return e.setAttribute("stretchy","true"),e},Le=function(t,e){var n=function(){var n=4e5,r=t.label.substr(1);if(f.contains(["widehat","widecheck","widetilde","utilde"],r)){var i,o,a,s="ordgroup"===(d=t.base).type?d.body.length:1;if(s>5)"widehat"===r||"widecheck"===r?(i=420,n=2364,a=.42,o=r+"4"):(i=312,n=2340,a=.34,o="tilde4");else{var u=[1,1,2,2,3,3][s];"widehat"===r||"widecheck"===r?(n=[0,1062,2364,2364,2364][u],i=[0,239,300,360,420][u],a=[0,.24,.3,.3,.36,.42][u],o=r+u):(n=[0,600,1033,2339,2340][u],i=[0,260,286,306,312][u],a=[0,.26,.286,.3,.306,.34][u],o="tilde"+u)}var c=new j(o),l=new z([c],{width:"100%",height:a+"em",viewBox:"0 0 "+n+" "+i,preserveAspectRatio:"none"});return{span:Jt.makeSvgSpan([],[l],e),minWidth:0,height:a}}var h,p,d,m=[],g=ze[r],v=g[0],y=g[1],b=g[2],x=b/1e3,w=v.length;if(1===w)h=["hide-tail"],p=[g[3]];else if(2===w)h=["halfarrow-left","halfarrow-right"],p=["xMinYMin","xMaxYMin"];else{if(3!==w)throw new Error("Correct katexImagesData or update code here to support\n "+w+" children.");h=["brace-left","brace-center","brace-right"],p=["xMinYMin","xMidYMin","xMaxYMin"]}for(var k=0;k0&&(r.style.minWidth=i+"em"),r};function We(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function Ue(t){var e=Ve(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function Ve(t){return t&&("atom"===t.type||$.hasOwnProperty(t.type))?t:null}var qe=function(t,e){var n,r,i;t&&"supsub"===t.type?(n=(r=We(t.base,"accent")).base,t.base=n,i=function(t){if(t instanceof I)return t;throw new Error("Expected span but got "+String(t)+".")}(xe(t,e)),t.base=r):n=(r=We(t,"accent")).base;var o=xe(n,e.havingCrampedStyle()),a=0;if(r.isShifty&&f.isCharacterBox(n)){var s=f.getBaseElem(n);a=L(xe(s,e.havingCrampedStyle())).skew}var u,c=Math.min(o.height,e.fontMetrics().xHeight);if(r.isStretchy)u=Le(r,e),u=Jt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"elem",elem:u,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+2*a+"em)",marginLeft:2*a+"em"}:void 0}]},e);else{var l,h;"\\vec"===r.label?(l=Jt.staticSvg("vec",e),h=Jt.svgData.vec[1]):((l=L(l=Jt.makeOrd({mode:r.mode,text:r.label},e,"textord"))).italic=0,h=l.width),u=Jt.makeSpan(["accent-body"],[l]);var p="\\textcircled"===r.label;p&&(u.classes.push("accent-full"),c=o.height);var d=a;p||(d-=h/2),u.style.left=d+"em","\\textcircled"===r.label&&(u.style.top=".2em"),u=Jt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:-c},{type:"elem",elem:u}]},e)}var m=Jt.makeSpan(["mord","accent"],[u],e);return i?(i.children[0]=m,i.height=Math.max(m.height,i.height),i.classes[0]="mord",i):m},He=function(t,e){var n=t.isStretchy?Pe(t.label):new Ae.MathNode("mo",[Oe(t.label,t.mode)]),r=new Ae.MathNode("mover",[Ie(t.base,e),n]);return r.setAttribute("accent","true"),r},Ge=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map((function(t){return"\\"+t})).join("|"));ae({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:function(t,e){var n=e[0],r=!Ge.test(t.funcName),i=!r||"\\widehat"===t.funcName||"\\widetilde"===t.funcName||"\\widecheck"===t.funcName;return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:i,base:n}},htmlBuilder:qe,mathmlBuilder:He}),ae({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!1},handler:function(t,e){var n=e[0];return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:qe,mathmlBuilder:He}),ae({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:function(t,e){var n=t.parser,r=t.funcName,i=e[0];return{type:"accentUnder",mode:n.mode,label:r,base:i}},htmlBuilder:function(t,e){var n=xe(t.base,e),r=Le(t,e),i="\\utilde"===t.label?.12:0,o=Jt.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:n}]},e);return Jt.makeSpan(["mord","accentunder"],[o],e)},mathmlBuilder:function(t,e){var n=Pe(t.label),r=new Ae.MathNode("munder",[Ie(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var $e=function(t){var e=new Ae.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};ae({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium"],props:{numArgs:1,numOptionalArgs:1},handler:function(t,e,n){var r=t.parser,i=t.funcName;return{type:"xArrow",mode:r.mode,label:i,body:e[0],below:n[0]}},htmlBuilder:function(t,e){var n,r=e.style,i=e.havingStyle(r.sup()),o=Jt.wrapFragment(xe(t.body,i,e),e);o.classes.push("x-arrow-pad"),t.below&&(i=e.havingStyle(r.sub()),(n=Jt.wrapFragment(xe(t.below,i,e),e)).classes.push("x-arrow-pad"));var a,s=Le(t,e),u=-e.fontMetrics().axisHeight+.5*s.height,c=-e.fontMetrics().axisHeight-.5*s.height-.111;if((o.depth>.25||"\\xleftequilibrium"===t.label)&&(c-=o.depth),n){var l=-e.fontMetrics().axisHeight+n.height+.5*s.height+.111;a=Jt.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:c},{type:"elem",elem:s,shift:u},{type:"elem",elem:n,shift:l}]},e)}else a=Jt.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:c},{type:"elem",elem:s,shift:u}]},e);return a.children[0].children[0].children[1].classes.push("svg-align"),Jt.makeSpan(["mrel","x-arrow"],[a],e)},mathmlBuilder:function(t,e){var n,r=Pe(t.label);if(t.body){var i=$e(Ie(t.body,e));if(t.below){var o=$e(Ie(t.below,e));n=new Ae.MathNode("munderover",[r,o,i])}else n=new Ae.MathNode("mover",[r,i])}else if(t.below){var a=$e(Ie(t.below,e));n=new Ae.MathNode("munder",[r,a])}else n=$e(),n=new Ae.MathNode("mover",[r,n]);return n}}),ae({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler:function(t,e){for(var n=t.parser,r=We(e[0],"ordgroup").body,i="",o=0;o","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],hn=[0,1.2,1.8,2.4,3],pn=[{type:"small",style:w.SCRIPTSCRIPT},{type:"small",style:w.SCRIPT},{type:"small",style:w.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],dn=[{type:"small",style:w.SCRIPTSCRIPT},{type:"small",style:w.SCRIPT},{type:"small",style:w.TEXT},{type:"stack"}],mn=[{type:"small",style:w.SCRIPTSCRIPT},{type:"small",style:w.SCRIPT},{type:"small",style:w.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],gn=function(t){if("small"===t.type)return"Main-Regular";if("large"===t.type)return"Size"+t.size+"-Regular";if("stack"===t.type)return"Size4-Regular";throw new Error("Add support for delim type '"+t.type+"' here.")},vn=function(t,e,n,r){for(var i=Math.min(2,3-r.style.size);ie)return n[i]}return n[n.length-1]},yn=function(t,e,n,r,i,o){var a;"<"===t||"\\lt"===t||"⟨"===t?t="\\langle":">"!==t&&"\\gt"!==t&&"⟩"!==t||(t="\\rangle"),a=f.contains(fn,t)?pn:f.contains(cn,t)?mn:dn;var s=vn(t,e,a,r);return"small"===s.type?function(t,e,n,r,i,o){var a=Jt.makeSymbol(t,"Main-Regular",i,r),s=tn(a,e,r,o);return n&&en(s,r,e),s}(t,s.style,n,r,i,o):"large"===s.type?nn(t,s.size,n,r,i,o):an(t,e,n,r,i,o)},bn=function(t,e){var n,r,i=e.havingBaseSizing(),o=vn("\\surd",t*i.sizeMultiplier,mn,i),a=i.sizeMultiplier,s=Math.max(0,e.minRuleThickness-e.fontMetrics().sqrtRuleThickness),u=0,c=0,l=0;return"small"===o.type?(t<1?a=1:t<1.4&&(a=.7),c=(1+s)/a,(n=un("sqrtMain",u=(1+s+sn)/a,l=1e3+1e3*s+80,s,e)).style.minWidth="0.853em",r=.833/a):"large"===o.type?(l=1080*hn[o.size],c=(hn[o.size]+s)/a,u=(hn[o.size]+s+sn)/a,(n=un("sqrtSize"+o.size,u,l,s,e)).style.minWidth="1.02em",r=1/a):(u=t+s+sn,c=t+s,l=Math.floor(1e3*t+s)+80,(n=un("sqrtTall",u,l,s,e)).style.minWidth="0.742em",r=1.056),n.height=c,n.style.height=u+"em",{span:n,advanceWidth:r,ruleWidth:(e.fontMetrics().sqrtRuleThickness+s)*a}},xn=function(t,e,n,r,i){if("<"===t||"\\lt"===t||"⟨"===t?t="\\langle":">"!==t&&"\\gt"!==t&&"⟩"!==t||(t="\\rangle"),f.contains(cn,t)||f.contains(fn,t))return nn(t,e,!1,n,r,i);if(f.contains(ln,t))return an(t,hn[e],!1,n,r,i);throw new a("Illegal delimiter: '"+t+"'")},wn=yn,kn=function(t,e,n,r,i,o){var a=r.fontMetrics().axisHeight*r.sizeMultiplier,s=5/r.fontMetrics().ptPerEm,u=Math.max(e-a,n+a),c=Math.max(u/500*901,2*u-s);return yn(t,c,!0,r,i,o)},En={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Cn=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Sn(t,e){var n=Ve(t);if(n&&f.contains(Cn,n.text))return n;throw new a(n?"Invalid delimiter '"+n.text+"' after '"+e.funcName+"'":"Invalid delimiter type '"+t.type+"'",t)}function An(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}ae({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1},handler:function(t,e){var n=Sn(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:En[t.funcName].size,mclass:En[t.funcName].mclass,delim:n.text}},htmlBuilder:function(t,e){return"."===t.delim?Jt.makeSpan([t.mclass]):xn(t.delim,t.size,e,t.mode,[t.mclass])},mathmlBuilder:function(t){var e=[];"."!==t.delim&&e.push(Oe(t.delim,t.mode));var n=new Ae.MathNode("mo",e);return"mopen"===t.mclass||"mclose"===t.mclass?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n}}),ae({type:"leftright-right",names:["\\right"],props:{numArgs:1},handler:function(t,e){var n=t.parser.gullet.macros.get("\\current@color");if(n&&"string"!=typeof n)throw new a("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:Sn(e[0],t).text,color:n}}}),ae({type:"leftright",names:["\\left"],props:{numArgs:1},handler:function(t,e){var n=Sn(e[0],t),r=t.parser;++r.leftrightDepth;var i=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var o=We(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:i,left:n.text,right:o.delim,rightColor:o.color}},htmlBuilder:function(t,e){An(t);for(var n,r,i=de(t.body,e,!0,["mopen","mclose"]),o=0,a=0,s=!1,u=0;u-1?"mpadded":"menclose",[Ie(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\fcolorbox":case"\\colorbox":if(n=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),"\\fcolorbox"===t.label){var i=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+i+"em solid "+String(t.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike")}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};ae({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,greediness:3,argTypes:["color","text"]},handler:function(t,e,n){var r=t.parser,i=t.funcName,o=We(e[0],"color-token").color,a=e[1];return{type:"enclose",mode:r.mode,label:i,backgroundColor:o,body:a}},htmlBuilder:On,mathmlBuilder:_n}),ae({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,greediness:3,argTypes:["color","color","text"]},handler:function(t,e,n){var r=t.parser,i=t.funcName,o=We(e[0],"color-token").color,a=We(e[1],"color-token").color,s=e[2];return{type:"enclose",mode:r.mode,label:i,backgroundColor:a,borderColor:o,body:s}},htmlBuilder:On,mathmlBuilder:_n}),ae({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:function(t,e){return{type:"enclose",mode:t.parser.mode,label:"\\fbox",body:e[0]}}}),ae({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout"],props:{numArgs:1},handler:function(t,e,n){var r=t.parser,i=t.funcName,o=e[0];return{type:"enclose",mode:r.mode,label:i,body:o}},htmlBuilder:On,mathmlBuilder:_n});var Nn={};function Tn(t){for(var e=t.type,n=t.names,r=t.props,i=t.handler,o=t.htmlBuilder,a=t.mathmlBuilder,s={type:e,numArgs:r.numArgs||0,greediness:1,allowedInText:!1,numOptionalArgs:0,handler:i},u=0;u0&&(b+=.25),c.push({pos:b,isDashed:t[e]})}for(x(o[0]),n=0;n0&&(C<(_+=y)&&(C=_),_=0),t.addJot&&(C+=m),S.height=E,S.depth=C,b+=E,S.pos=b,b+=C+_,u[n]=S,x(o[n+1])}var N,T,D=b/2+e.fontMetrics().axisHeight,I=t.cols||[],R=[];for(r=0,T=0;r=s)){var j=void 0;(r>0||t.hskipBeforeAndAfter)&&0!==(j=f.deflt(F.pregap,p))&&((N=Jt.makeSpan(["arraycolsep"],[])).style.width=j+"em",R.push(N));var P=[];for(n=0;n0){for(var V=Jt.makeLineSpan("hline",e,l),q=Jt.makeLineSpan("hdashline",e,l),H=[{type:"elem",elem:u,shift:0}];c.length>0;){var G=c.pop(),$=G.pos-D;G.isDashed?H.push({type:"elem",elem:q,shift:$}):H.push({type:"elem",elem:V,shift:$})}u=Jt.makeVList({positionType:"individualShift",children:H},e)}return Jt.makeSpan(["mord"],[u],e)},Mn={c:"center ",l:"left ",r:"right "},Bn=function(t,e){var n=new Ae.MathNode("mtable",t.body.map((function(t){return new Ae.MathNode("mtr",t.map((function(t){return new Ae.MathNode("mtd",[Ie(t,e)])})))}))),r=.5===t.arraystretch?.1:.16+t.arraystretch-1+(t.addJot?.09:0);n.setAttribute("rowspacing",r+"em");var i="",o="";if(t.cols&&t.cols.length>0){var a=t.cols,s="",u=!1,c=0,l=a.length;"separator"===a[0].type&&(i+="top ",c=1),"separator"===a[a.length-1].type&&(i+="bottom ",l-=1);for(var f=c;f0?"left ":"",i+=g[g.length-1].length>0?"right ":"";for(var v=1;v0&&l&&(p=1),r[f]={type:"align",align:h,pregap:p,postgap:0}}return i.colSeparationType=l?"align":"alignat",i};Tn({type:"array",names:["array","darray"],props:{numArgs:1},handler:function(t,e){var n=(Ve(e[0])?[e[0]]:We(e[0],"ordgroup").body).map((function(t){var e=Ue(t).text;if(-1!=="lcr".indexOf(e))return{type:"align",align:e};if("|"===e)return{type:"separator",separator:"|"};if(":"===e)return{type:"separator",separator:":"};throw new a("Unknown column alignment: "+e,t)})),r={cols:n,hskipBeforeAndAfter:!0};return In(t.parser,r,Rn(t.envName))},htmlBuilder:Fn,mathmlBuilder:Bn}),Tn({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix"],props:{numArgs:0},handler:function(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName],n=In(t.parser,{hskipBeforeAndAfter:!1},Rn(t.envName));return e?{type:"leftright",mode:t.mode,body:[n],left:e[0],right:e[1],rightColor:void 0}:n},htmlBuilder:Fn,mathmlBuilder:Bn}),Tn({type:"array",names:["smallmatrix"],props:{numArgs:0},handler:function(t){var e=In(t.parser,{arraystretch:.5},"script");return e.colSeparationType="small",e},htmlBuilder:Fn,mathmlBuilder:Bn}),Tn({type:"array",names:["subarray"],props:{numArgs:1},handler:function(t,e){var n=(Ve(e[0])?[e[0]]:We(e[0],"ordgroup").body).map((function(t){var e=Ue(t).text;if(-1!=="lc".indexOf(e))return{type:"align",align:e};throw new a("Unknown column alignment: "+e,t)}));if(n.length>1)throw new a("{subarray} can contain only one column");var r={cols:n,hskipBeforeAndAfter:!1,arraystretch:.5};if((r=In(t.parser,r,"script")).body.length>0&&r.body[0].length>1)throw new a("{subarray} can contain only one column");return r},htmlBuilder:Fn,mathmlBuilder:Bn}),Tn({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler:function(t){var e=In(t.parser,{arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},Rn(t.envName));return{type:"leftright",mode:t.mode,body:[e],left:t.envName.indexOf("r")>-1?".":"\\{",right:t.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:Fn,mathmlBuilder:Bn}),Tn({type:"array",names:["aligned"],props:{numArgs:0},handler:zn,htmlBuilder:Fn,mathmlBuilder:Bn}),Tn({type:"array",names:["gathered"],props:{numArgs:0},handler:function(t){return In(t.parser,{cols:[{type:"align",align:"c"}],addJot:!0},"display")},htmlBuilder:Fn,mathmlBuilder:Bn}),Tn({type:"array",names:["alignedat"],props:{numArgs:1},handler:zn,htmlBuilder:Fn,mathmlBuilder:Bn}),ae({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler:function(t,e){throw new a(t.funcName+" valid only within array environment")}});var jn=Nn;ae({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler:function(t,e){var n=t.parser,r=t.funcName,i=e[0];if("ordgroup"!==i.type)throw new a("Invalid environment name",i);for(var o="",s=0;s=w.SCRIPT.id?n.text():w.DISPLAY:"text"===t&&n.size===w.DISPLAY.size?n=w.TEXT:"script"===t?n=w.SCRIPT:"scriptscript"===t&&(n=w.SCRIPTSCRIPT),n},$n=function(t,e){var n,r=Gn(t.size,e.style),i=r.fracNum(),o=r.fracDen();n=e.havingStyle(i);var a=xe(t.numer,n,e);if(t.continued){var s=8.5/e.fontMetrics().ptPerEm,u=3.5/e.fontMetrics().ptPerEm;a.height=a.height0?3*f:7*f,d=e.fontMetrics().denom1):(l>0?(h=e.fontMetrics().num2,p=f):(h=e.fontMetrics().num3,p=3*f),d=e.fontMetrics().denom2),c){var x=e.fontMetrics().axisHeight;h-a.depth-(x+.5*l)0&&(e="."===(e=t)?null:e),e};ae({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,greediness:6,argTypes:["math","math","size","text","math","math"]},handler:function(t,e){var n,r=t.parser,i=e[4],o=e[5],a="atom"===e[0].type&&"open"===e[0].family?Yn(e[0].text):null,s="atom"===e[1].type&&"close"===e[1].family?Yn(e[1].text):null,u=We(e[2],"size"),c=null;n=!!u.isBlank||(c=u.value).number>0;var l="auto",f=e[3];if("ordgroup"===f.type){if(f.body.length>0){var h=We(f.body[0],"textord");l=Xn[Number(h.text)]}}else f=We(f,"textord"),l=Xn[Number(f.text)];return{type:"genfrac",mode:r.mode,numer:i,denom:o,continued:!1,hasBarLine:n,barSize:c,leftDelim:a,rightDelim:s,size:l}},htmlBuilder:$n,mathmlBuilder:Kn}),ae({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler:function(t,e){var n=t.parser;t.funcName;var r=t.token;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:We(e[0],"size").value,token:r}}}),ae({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:function(t,e){var n=t.parser;t.funcName;var r=e[0],i=function(t){if(!t)throw new Error("Expected non-null, but got "+String(t));return t}(We(e[1],"infix").size),o=e[2],a=i.number>0;return{type:"genfrac",mode:n.mode,numer:r,denom:o,continued:!1,hasBarLine:a,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:$n,mathmlBuilder:Kn});var Jn=function(t,e){var n,r,i=e.style;"supsub"===t.type?(n=t.sup?xe(t.sup,e.havingStyle(i.sup()),e):xe(t.sub,e.havingStyle(i.sub()),e),r=We(t.base,"horizBrace")):r=We(t,"horizBrace");var o,a=xe(r.base,e.havingBaseStyle(w.DISPLAY)),s=Le(r,e);if(r.isOver?(o=Jt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:s}]},e)).children[0].children[0].children[1].classes.push("svg-align"):(o=Jt.makeVList({positionType:"bottom",positionData:a.depth+.1+s.height,children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:a}]},e)).children[0].children[0].children[0].classes.push("svg-align"),n){var u=Jt.makeSpan(["mord",r.isOver?"mover":"munder"],[o],e);o=r.isOver?Jt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:u},{type:"kern",size:.2},{type:"elem",elem:n}]},e):Jt.makeVList({positionType:"bottom",positionData:u.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:u}]},e)}return Jt.makeSpan(["mord",r.isOver?"mover":"munder"],[o],e)};ae({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler:function(t,e){var n=t.parser,r=t.funcName;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:e[0]}},htmlBuilder:Jn,mathmlBuilder:function(t,e){var n=Pe(t.label);return new Ae.MathNode(t.isOver?"mover":"munder",[Ie(t.base,e),n])}}),ae({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:function(t,e){var n=t.parser,r=e[1],i=We(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:n.mode,href:i,body:ue(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:function(t,e){var n=de(t.body,e,!1);return Jt.makeAnchor(t.href,[],n,e)},mathmlBuilder:function(t,e){var n=De(t.body,e);return n instanceof Ce||(n=new Ce("mrow",[n])),n.setAttribute("href",t.href),n}}),ae({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:function(t,e){var n=t.parser,r=We(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var i=[],o=0;o0&&(r=Lt(t.totalheight,e)-n,r=Number(r.toFixed(2)));var i=0;t.width.number>0&&(i=Lt(t.width,e));var o={height:n+r+"em"};i>0&&(o.width=i+"em"),r>0&&(o.verticalAlign=-r+"em");var a=new F(t.src,t.alt,o);return a.height=n,a.depth=r,a},mathmlBuilder:function(t,e){var n=new Ae.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=Lt(t.height,e),i=0;if(t.totalheight.number>0&&(i=(i=Lt(t.totalheight,e)-r).toFixed(2),n.setAttribute("valign","-"+i+"em")),n.setAttribute("height",r+i+"em"),t.width.number>0){var o=Lt(t.width,e);n.setAttribute("width",o+"em")}return n.setAttribute("src",t.src),n}}),ae({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],allowedInText:!0},handler:function(t,e){var n=t.parser,r=t.funcName,i=We(e[0],"size");if(n.settings.strict){var o="m"===r[1],a="mu"===i.value.unit;o?(a||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, not "+i.value.unit+" units"),"math"!==n.mode&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):a&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:i.value}},htmlBuilder:function(t,e){return Jt.makeGlue(t.dimension,e)},mathmlBuilder:function(t,e){var n=Lt(t.dimension,e);return new Ae.SpaceNode(n)}}),ae({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:function(t,e){var n=t.parser,r=t.funcName,i=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:i}},htmlBuilder:function(t,e){var n;"clap"===t.alignment?(n=Jt.makeSpan([],[xe(t.body,e)]),n=Jt.makeSpan(["inner"],[n],e)):n=Jt.makeSpan(["inner"],[xe(t.body,e)]);var r=Jt.makeSpan(["fix"],[]),i=Jt.makeSpan([t.alignment],[n,r],e),o=Jt.makeSpan(["strut"]);return o.style.height=i.height+i.depth+"em",o.style.verticalAlign=-i.depth+"em",i.children.unshift(o),i=Jt.makeSpan(["thinbox"],[i],e),Jt.makeSpan(["mord","vbox"],[i],e)},mathmlBuilder:function(t,e){var n=new Ae.MathNode("mpadded",[Ie(t.body,e)]);if("rlap"!==t.alignment){var r="llap"===t.alignment?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}}),ae({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler:function(t,e){var n=t.funcName,r=t.parser,i=r.mode;r.switchMode("math");var o="\\("===n?"\\)":"$",a=r.parseExpression(!1,o);return r.expect(o),r.switchMode(i),{type:"styling",mode:r.mode,style:"text",body:a}}}),ae({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler:function(t,e){throw new a("Mismatched "+t.funcName)}});var Qn=function(t,e){switch(e.style.size){case w.DISPLAY.size:return t.display;case w.TEXT.size:return t.text;case w.SCRIPT.size:return t.script;case w.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};ae({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4},handler:function(t,e){return{type:"mathchoice",mode:t.parser.mode,display:ue(e[0]),text:ue(e[1]),script:ue(e[2]),scriptscript:ue(e[3])}},htmlBuilder:function(t,e){var n=Qn(t,e),r=de(n,e,!1);return Jt.makeFragment(r)},mathmlBuilder:function(t,e){var n=Qn(t,e);return De(n,e)}});var tr=function(t,e,n,r,i,o,a){var s,u,c;if(t=Jt.makeSpan([],[t]),e){var l=xe(e,r.havingStyle(i.sup()),r);u={elem:l,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-l.depth)}}if(n){var f=xe(n,r.havingStyle(i.sub()),r);s={elem:f,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-f.height)}}if(u&&s){var h=r.fontMetrics().bigOpSpacing5+s.elem.height+s.elem.depth+s.kern+t.depth+a;c=Jt.makeVList({positionType:"bottom",positionData:h,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:-o+"em"},{type:"kern",size:s.kern},{type:"elem",elem:t},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:o+"em"},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(s){var p=t.height-a;c=Jt.makeVList({positionType:"top",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:-o+"em"},{type:"kern",size:s.kern},{type:"elem",elem:t}]},r)}else{if(!u)return t;var d=t.depth+a;c=Jt.makeVList({positionType:"bottom",positionData:d,children:[{type:"elem",elem:t},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:o+"em"},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}return Jt.makeSpan(["mop","op-limits"],[c],r)},er=["\\smallint"],nr=function(t,e){var n,r,i,o=!1;"supsub"===t.type?(n=t.sup,r=t.sub,i=We(t.base,"op"),o=!0):i=We(t,"op");var a,s=e.style,u=!1;if(s.size===w.DISPLAY.size&&i.symbol&&!f.contains(er,i.name)&&(u=!0),i.symbol){var c=u?"Size2-Regular":"Size1-Regular",l="";if("\\oiint"!==i.name&&"\\oiiint"!==i.name||(l=i.name.substr(1),i.name="oiint"===l?"\\iint":"\\iiint"),a=Jt.makeSymbol(i.name,c,"math",e,["mop","op-symbol",u?"large-op":"small-op"]),l.length>0){var h=a.italic,p=Jt.staticSvg(l+"Size"+(u?"2":"1"),e);a=Jt.makeVList({positionType:"individualShift",children:[{type:"elem",elem:a,shift:0},{type:"elem",elem:p,shift:u?.08:0}]},e),i.name="\\"+l,a.classes.unshift("mop"),a.italic=h}}else if(i.body){var d=de(i.body,e,!0);1===d.length&&d[0]instanceof B?(a=d[0]).classes[0]="mop":a=Jt.makeSpan(["mop"],Jt.tryCombineChars(d),e)}else{for(var m=[],g=1;g0){for(var s=i.body.map((function(t){var e=t.text;return"string"==typeof e?{type:"textord",mode:t.mode,text:e}:t})),u=de(s,e.withFont("mathrm"),!0),c=0;c=0?s.setAttribute("height","+"+i+"em"):(s.setAttribute("height",i+"em"),s.setAttribute("depth","+"+-i+"em")),s.setAttribute("voffset",i+"em"),s}});var ur=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];ae({type:"sizing",names:ur,props:{numArgs:0,allowedInText:!0},handler:function(t,e){var n=t.breakOnTokenText,r=t.funcName,i=t.parser,o=i.parseExpression(!1,n);return{type:"sizing",mode:i.mode,size:ur.indexOf(r)+1,body:o}},htmlBuilder:function(t,e){var n=e.havingSize(t.size);return sr(t.body,n,e)},mathmlBuilder:function(t,e){var n=e.havingSize(t.size),r=Te(t.body,n),i=new Ae.MathNode("mstyle",r);return i.setAttribute("mathsize",n.sizeMultiplier+"em"),i}}),ae({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:function(t,e,n){var r=t.parser,i=!1,o=!1,a=n[0]&&We(n[0],"ordgroup");if(a)for(var s="",u=0;un.height+n.depth+o&&(o=(o+f-n.height-n.depth)/2);var h=u.height-n.height-o-c;n.style.paddingLeft=l+"em";var p=Jt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+h)},{type:"elem",elem:u},{type:"kern",size:c}]},e);if(t.index){var d=e.havingStyle(w.SCRIPTSCRIPT),m=xe(t.index,d,e),g=.6*(p.height-p.depth),v=Jt.makeVList({positionType:"shift",positionData:-g,children:[{type:"elem",elem:m}]},e),y=Jt.makeSpan(["root"],[v]);return Jt.makeSpan(["mord","sqrt"],[y,p],e)}return Jt.makeSpan(["mord","sqrt"],[p],e)},mathmlBuilder:function(t,e){var n=t.body,r=t.index;return r?new Ae.MathNode("mroot",[Ie(n,e),Ie(r,e)]):new Ae.MathNode("msqrt",[Ie(n,e)])}});var cr={display:w.DISPLAY,text:w.TEXT,script:w.SCRIPT,scriptscript:w.SCRIPTSCRIPT};ae({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0},handler:function(t,e){var n=t.breakOnTokenText,r=t.funcName,i=t.parser,o=i.parseExpression(!0,n),a=r.slice(1,r.length-5);return{type:"styling",mode:i.mode,style:a,body:o}},htmlBuilder:function(t,e){var n=cr[t.style],r=e.havingStyle(n).withFont("");return sr(t.body,r,e)},mathmlBuilder:function(t,e){var n=cr[t.style],r=e.havingStyle(n),i=Te(t.body,r),o=new Ae.MathNode("mstyle",i),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]}[t.style];return o.setAttribute("scriptlevel",a[0]),o.setAttribute("displaystyle",a[1]),o}}),se({type:"supsub",htmlBuilder:function(t,e){var n=function(t,e){var n=t.base;return n?"op"===n.type?n.limits&&(e.style.size===w.DISPLAY.size||n.alwaysHandleSupSub)?nr:null:"operatorname"===n.type?n.alwaysHandleSupSub&&(e.style.size===w.DISPLAY.size||n.limits)?ar:null:"accent"===n.type?f.isCharacterBox(n.base)?qe:null:"horizBrace"===n.type&&!t.sub===n.isOver?Jn:null:null}(t,e);if(n)return n(t,e);var r,i,o,a=t.base,s=t.sup,u=t.sub,c=xe(a,e),l=e.fontMetrics(),h=0,p=0,d=a&&f.isCharacterBox(a);if(s){var m=e.havingStyle(e.style.sup());r=xe(s,m,e),d||(h=c.height-m.fontMetrics().supDrop*m.sizeMultiplier/e.sizeMultiplier)}if(u){var g=e.havingStyle(e.style.sub());i=xe(u,g,e),d||(p=c.depth+g.fontMetrics().subDrop*g.sizeMultiplier/e.sizeMultiplier)}o=e.style===w.DISPLAY?l.sup1:e.style.cramped?l.sup3:l.sup2;var v,y=e.sizeMultiplier,b=.5/l.ptPerEm/y+"em",x=null;if(i){var k=t.base&&"op"===t.base.type&&t.base.name&&("\\oiint"===t.base.name||"\\oiiint"===t.base.name);(c instanceof B||k)&&(x=-c.italic+"em")}if(r&&i){h=Math.max(h,o,r.depth+.25*l.xHeight),p=Math.max(p,l.sub2);var E=4*l.defaultRuleThickness;if(h-r.depth-(i.height-p)0&&(h+=C,p-=C)}var S=[{type:"elem",elem:i,shift:p,marginRight:b,marginLeft:x},{type:"elem",elem:r,shift:-h,marginRight:b}];v=Jt.makeVList({positionType:"individualShift",children:S},e)}else if(i){p=Math.max(p,l.sub1,i.height-.8*l.xHeight);var A=[{type:"elem",elem:i,marginLeft:x,marginRight:b}];v=Jt.makeVList({positionType:"shift",positionData:p,children:A},e)}else{if(!r)throw new Error("supsub must have either sup or sub.");h=Math.max(h,o,r.depth+.25*l.xHeight),v=Jt.makeVList({positionType:"shift",positionData:-h,children:[{type:"elem",elem:r,marginRight:b}]},e)}var O=ye(c,"right")||"mord";return Jt.makeSpan([O],[c,Jt.makeSpan(["msupsub"],[v])],e)},mathmlBuilder:function(t,e){var n,r=!1;t.base&&"horizBrace"===t.base.type&&!!t.sup===t.base.isOver&&(r=!0,n=t.base.isOver),!t.base||"op"!==t.base.type&&"operatorname"!==t.base.type||(t.base.parentIsSupSub=!0);var i,o=[Ie(t.base,e)];if(t.sub&&o.push(Ie(t.sub,e)),t.sup&&o.push(Ie(t.sup,e)),r)i=n?"mover":"munder";else if(t.sub)if(t.sup){var a=t.base;i=a&&"op"===a.type&&a.limits&&e.style===w.DISPLAY||a&&"operatorname"===a.type&&a.alwaysHandleSupSub&&(e.style===w.DISPLAY||a.limits)?"munderover":"msubsup"}else{var s=t.base;i=s&&"op"===s.type&&s.limits&&(e.style===w.DISPLAY||s.alwaysHandleSupSub)||s&&"operatorname"===s.type&&s.alwaysHandleSupSub&&(s.limits||e.style===w.DISPLAY)?"munder":"msub"}else{var u=t.base;i=u&&"op"===u.type&&u.limits&&(e.style===w.DISPLAY||u.alwaysHandleSupSub)||u&&"operatorname"===u.type&&u.alwaysHandleSupSub&&(u.limits||e.style===w.DISPLAY)?"mover":"msup"}return new Ae.MathNode(i,o)}}),se({type:"atom",htmlBuilder:function(t,e){return Jt.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder:function(t,e){var n=new Ae.MathNode("mo",[Oe(t.text,t.mode)]);if("bin"===t.family){var r=Ne(t,e);"bold-italic"===r&&n.setAttribute("mathvariant",r)}else"punct"===t.family?n.setAttribute("separator","true"):"open"!==t.family&&"close"!==t.family||n.setAttribute("stretchy","false");return n}});var lr={mi:"italic",mn:"normal",mtext:"normal"};se({type:"mathord",htmlBuilder:function(t,e){return Jt.makeOrd(t,e,"mathord")},mathmlBuilder:function(t,e){var n=new Ae.MathNode("mi",[Oe(t.text,t.mode,e)]),r=Ne(t,e)||"italic";return r!==lr[n.type]&&n.setAttribute("mathvariant",r),n}}),se({type:"textord",htmlBuilder:function(t,e){return Jt.makeOrd(t,e,"textord")},mathmlBuilder:function(t,e){var n,r=Oe(t.text,t.mode,e),i=Ne(t,e)||"normal";return n="text"===t.mode?new Ae.MathNode("mtext",[r]):/[0-9]/.test(t.text)?new Ae.MathNode("mn",[r]):"\\prime"===t.text?new Ae.MathNode("mo",[r]):new Ae.MathNode("mi",[r]),i!==lr[n.type]&&n.setAttribute("mathvariant",i),n}});var fr={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},hr={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};se({type:"spacing",htmlBuilder:function(t,e){if(hr.hasOwnProperty(t.text)){var n=hr[t.text].className||"";if("text"===t.mode){var r=Jt.makeOrd(t,e,"textord");return r.classes.push(n),r}return Jt.makeSpan(["mspace",n],[Jt.mathsym(t.text,t.mode,e)],e)}if(fr.hasOwnProperty(t.text))return Jt.makeSpan(["mspace",fr[t.text]],[],e);throw new a('Unknown type of space "'+t.text+'"')},mathmlBuilder:function(t,e){if(!hr.hasOwnProperty(t.text)){if(fr.hasOwnProperty(t.text))return new Ae.MathNode("mspace");throw new a('Unknown type of space "'+t.text+'"')}return new Ae.MathNode("mtext",[new Ae.TextNode(" ")])}});var pr=function(){var t=new Ae.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};se({type:"tag",mathmlBuilder:function(t,e){var n=new Ae.MathNode("mtable",[new Ae.MathNode("mtr",[pr(),new Ae.MathNode("mtd",[De(t.body,e)]),pr(),new Ae.MathNode("mtd",[De(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var dr={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},mr={"\\textbf":"textbf","\\textmd":"textmd"},gr={"\\textit":"textit","\\textup":"textup"},vr=function(t,e){var n=t.font;return n?dr[n]?e.withTextFontFamily(dr[n]):mr[n]?e.withTextFontWeight(mr[n]):e.withTextFontShape(gr[n]):e};ae({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup"],props:{numArgs:1,argTypes:["text"],greediness:2,allowedInText:!0},handler:function(t,e){var n=t.parser,r=t.funcName,i=e[0];return{type:"text",mode:n.mode,body:ue(i),font:r}},htmlBuilder:function(t,e){var n=vr(t,e),r=de(t.body,n,!0);return Jt.makeSpan(["mord","text"],Jt.tryCombineChars(r),n)},mathmlBuilder:function(t,e){var n=vr(t,e);return De(t.body,n)}}),ae({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler:function(t,e){return{type:"underline",mode:t.parser.mode,body:e[0]}},htmlBuilder:function(t,e){var n=xe(t.body,e),r=Jt.makeLineSpan("underline-line",e),i=e.fontMetrics().defaultRuleThickness,o=Jt.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:i},{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n}]},e);return Jt.makeSpan(["mord","underline"],[o],e)},mathmlBuilder:function(t,e){var n=new Ae.MathNode("mo",[new Ae.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Ae.MathNode("munder",[Ie(t.body,e),n]);return r.setAttribute("accentunder","true"),r}}),ae({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler:function(t,e,n){throw new a("\\verb ended by end of line instead of matching delimiter")},htmlBuilder:function(t,e){for(var n=yr(t),r=[],i=e.havingStyle(e.style.text()),o=0;o0&&(this.undefStack[this.undefStack.length-1][t]=e)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(t)&&(i[t]=this.current[t])}this.current[t]=e},t}(),Nr={},Tr=Nr;function Dr(t,e){Nr[t]=e}Dr("\\noexpand",(function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}})),Dr("\\expandafter",(function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}})),Dr("\\@firstoftwo",(function(t){return{tokens:t.consumeArgs(2)[0],numArgs:0}})),Dr("\\@secondoftwo",(function(t){return{tokens:t.consumeArgs(2)[1],numArgs:0}})),Dr("\\@ifnextchar",(function(t){var e=t.consumeArgs(3);t.consumeSpaces();var n=t.future();return 1===e[0].length&&e[0][0].text===n.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}})),Dr("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),Dr("\\TextOrMath",(function(t){var e=t.consumeArgs(2);return"text"===t.mode?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}}));var Ir={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Dr("\\char",(function(t){var e,n=t.popToken(),r="";if("'"===n.text)e=8,n=t.popToken();else if('"'===n.text)e=16,n=t.popToken();else if("`"===n.text)if("\\"===(n=t.popToken()).text[0])r=n.text.charCodeAt(1);else{if("EOF"===n.text)throw new a("\\char` missing argument");r=n.text.charCodeAt(0)}else e=10;if(e){if(null==(r=Ir[n.text])||r>=e)throw new a("Invalid base-"+e+" digit "+n.text);for(var i;null!=(i=Ir[t.future().text])&&i":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};Dr("\\dots",(function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in Fr?e=Fr[n]:("\\not"===n.substr(0,4)||n in X.math&&f.contains(["bin","rel"],X.math[n].group))&&(e="\\dotsb"),e}));var Mr={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Dr("\\dotso",(function(t){return t.future().text in Mr?"\\ldots\\,":"\\ldots"})),Dr("\\dotsc",(function(t){var e=t.future().text;return e in Mr&&","!==e?"\\ldots\\,":"\\ldots"})),Dr("\\cdots",(function(t){return t.future().text in Mr?"\\@cdots\\,":"\\@cdots"})),Dr("\\dotsb","\\cdots"),Dr("\\dotsm","\\cdots"),Dr("\\dotsi","\\!\\cdots"),Dr("\\dotsx","\\ldots\\,"),Dr("\\DOTSI","\\relax"),Dr("\\DOTSB","\\relax"),Dr("\\DOTSX","\\relax"),Dr("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),Dr("\\,","\\tmspace+{3mu}{.1667em}"),Dr("\\thinspace","\\,"),Dr("\\>","\\mskip{4mu}"),Dr("\\:","\\tmspace+{4mu}{.2222em}"),Dr("\\medspace","\\:"),Dr("\\;","\\tmspace+{5mu}{.2777em}"),Dr("\\thickspace","\\;"),Dr("\\!","\\tmspace-{3mu}{.1667em}"),Dr("\\negthinspace","\\!"),Dr("\\negmedspace","\\tmspace-{4mu}{.2222em}"),Dr("\\negthickspace","\\tmspace-{5mu}{.277em}"),Dr("\\enspace","\\kern.5em "),Dr("\\enskip","\\hskip.5em\\relax"),Dr("\\quad","\\hskip1em\\relax"),Dr("\\qquad","\\hskip2em\\relax"),Dr("\\tag","\\@ifstar\\tag@literal\\tag@paren"),Dr("\\tag@paren","\\tag@literal{({#1})}"),Dr("\\tag@literal",(function(t){if(t.macros.get("\\df@tag"))throw new a("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"})),Dr("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),Dr("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),Dr("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),Dr("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),Dr("\\pmb","\\html@mathml{\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}{\\mathbf{#1}}"),Dr("\\\\","\\newline"),Dr("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Br=W["Main-Regular"]["T".charCodeAt(0)][1]-.7*W["Main-Regular"]["A".charCodeAt(0)][1]+"em";Dr("\\LaTeX","\\textrm{\\html@mathml{L\\kern-.36em\\raisebox{"+Br+"}{\\scriptstyle A}\\kern-.15em\\TeX}{LaTeX}}"),Dr("\\KaTeX","\\textrm{\\html@mathml{K\\kern-.17em\\raisebox{"+Br+"}{\\scriptstyle A}\\kern-.15em\\TeX}{KaTeX}}"),Dr("\\hspace","\\@ifstar\\@hspacer\\@hspace"),Dr("\\@hspace","\\hskip #1\\relax"),Dr("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),Dr("\\ordinarycolon",":"),Dr("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),Dr("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),Dr("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),Dr("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),Dr("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),Dr("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),Dr("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),Dr("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),Dr("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),Dr("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),Dr("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),Dr("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),Dr("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),Dr("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),Dr("∷","\\dblcolon"),Dr("∹","\\eqcolon"),Dr("≔","\\coloneqq"),Dr("≕","\\eqqcolon"),Dr("⩴","\\Coloneqq"),Dr("\\ratio","\\vcentcolon"),Dr("\\coloncolon","\\dblcolon"),Dr("\\colonequals","\\coloneqq"),Dr("\\coloncolonequals","\\Coloneqq"),Dr("\\equalscolon","\\eqqcolon"),Dr("\\equalscoloncolon","\\Eqqcolon"),Dr("\\colonminus","\\coloneq"),Dr("\\coloncolonminus","\\Coloneq"),Dr("\\minuscolon","\\eqcolon"),Dr("\\minuscoloncolon","\\Eqcolon"),Dr("\\coloncolonapprox","\\Colonapprox"),Dr("\\coloncolonsim","\\Colonsim"),Dr("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),Dr("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),Dr("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),Dr("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),Dr("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}"),Dr("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),Dr("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),Dr("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}"),Dr("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}"),Dr("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}"),Dr("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}"),Dr("\\nleqq","\\html@mathml{\\@nleqq}{≰}"),Dr("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}"),Dr("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}"),Dr("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}"),Dr("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}"),Dr("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}"),Dr("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}"),Dr("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}"),Dr("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}"),Dr("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}"),Dr("\\imath","\\html@mathml{\\@imath}{ı}"),Dr("\\jmath","\\html@mathml{\\@jmath}{ȷ}"),Dr("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}"),Dr("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}"),Dr("⟦","\\llbracket"),Dr("⟧","\\rrbracket"),Dr("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}"),Dr("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}"),Dr("⦃","\\lBrace"),Dr("⦄","\\rBrace"),Dr("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"),Dr("⦵","\\minuso"),Dr("\\darr","\\downarrow"),Dr("\\dArr","\\Downarrow"),Dr("\\Darr","\\Downarrow"),Dr("\\lang","\\langle"),Dr("\\rang","\\rangle"),Dr("\\uarr","\\uparrow"),Dr("\\uArr","\\Uparrow"),Dr("\\Uarr","\\Uparrow"),Dr("\\N","\\mathbb{N}"),Dr("\\R","\\mathbb{R}"),Dr("\\Z","\\mathbb{Z}"),Dr("\\alef","\\aleph"),Dr("\\alefsym","\\aleph"),Dr("\\Alpha","\\mathrm{A}"),Dr("\\Beta","\\mathrm{B}"),Dr("\\bull","\\bullet"),Dr("\\Chi","\\mathrm{X}"),Dr("\\clubs","\\clubsuit"),Dr("\\cnums","\\mathbb{C}"),Dr("\\Complex","\\mathbb{C}"),Dr("\\Dagger","\\ddagger"),Dr("\\diamonds","\\diamondsuit"),Dr("\\empty","\\emptyset"),Dr("\\Epsilon","\\mathrm{E}"),Dr("\\Eta","\\mathrm{H}"),Dr("\\exist","\\exists"),Dr("\\harr","\\leftrightarrow"),Dr("\\hArr","\\Leftrightarrow"),Dr("\\Harr","\\Leftrightarrow"),Dr("\\hearts","\\heartsuit"),Dr("\\image","\\Im"),Dr("\\infin","\\infty"),Dr("\\Iota","\\mathrm{I}"),Dr("\\isin","\\in"),Dr("\\Kappa","\\mathrm{K}"),Dr("\\larr","\\leftarrow"),Dr("\\lArr","\\Leftarrow"),Dr("\\Larr","\\Leftarrow"),Dr("\\lrarr","\\leftrightarrow"),Dr("\\lrArr","\\Leftrightarrow"),Dr("\\Lrarr","\\Leftrightarrow"),Dr("\\Mu","\\mathrm{M}"),Dr("\\natnums","\\mathbb{N}"),Dr("\\Nu","\\mathrm{N}"),Dr("\\Omicron","\\mathrm{O}"),Dr("\\plusmn","\\pm"),Dr("\\rarr","\\rightarrow"),Dr("\\rArr","\\Rightarrow"),Dr("\\Rarr","\\Rightarrow"),Dr("\\real","\\Re"),Dr("\\reals","\\mathbb{R}"),Dr("\\Reals","\\mathbb{R}"),Dr("\\Rho","\\mathrm{P}"),Dr("\\sdot","\\cdot"),Dr("\\sect","\\S"),Dr("\\spades","\\spadesuit"),Dr("\\sub","\\subset"),Dr("\\sube","\\subseteq"),Dr("\\supe","\\supseteq"),Dr("\\Tau","\\mathrm{T}"),Dr("\\thetasym","\\vartheta"),Dr("\\weierp","\\wp"),Dr("\\Zeta","\\mathrm{Z}"),Dr("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),Dr("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),Dr("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),Dr("\\bra","\\mathinner{\\langle{#1}|}"),Dr("\\ket","\\mathinner{|{#1}\\rangle}"),Dr("\\braket","\\mathinner{\\langle{#1}\\rangle}"),Dr("\\Bra","\\left\\langle#1\\right|"),Dr("\\Ket","\\left|#1\\right\\rangle"),Dr("\\blue","\\textcolor{##6495ed}{#1}"),Dr("\\orange","\\textcolor{##ffa500}{#1}"),Dr("\\pink","\\textcolor{##ff00af}{#1}"),Dr("\\red","\\textcolor{##df0030}{#1}"),Dr("\\green","\\textcolor{##28ae7b}{#1}"),Dr("\\gray","\\textcolor{gray}{#1}"),Dr("\\purple","\\textcolor{##9d38bd}{#1}"),Dr("\\blueA","\\textcolor{##ccfaff}{#1}"),Dr("\\blueB","\\textcolor{##80f6ff}{#1}"),Dr("\\blueC","\\textcolor{##63d9ea}{#1}"),Dr("\\blueD","\\textcolor{##11accd}{#1}"),Dr("\\blueE","\\textcolor{##0c7f99}{#1}"),Dr("\\tealA","\\textcolor{##94fff5}{#1}"),Dr("\\tealB","\\textcolor{##26edd5}{#1}"),Dr("\\tealC","\\textcolor{##01d1c1}{#1}"),Dr("\\tealD","\\textcolor{##01a995}{#1}"),Dr("\\tealE","\\textcolor{##208170}{#1}"),Dr("\\greenA","\\textcolor{##b6ffb0}{#1}"),Dr("\\greenB","\\textcolor{##8af281}{#1}"),Dr("\\greenC","\\textcolor{##74cf70}{#1}"),Dr("\\greenD","\\textcolor{##1fab54}{#1}"),Dr("\\greenE","\\textcolor{##0d923f}{#1}"),Dr("\\goldA","\\textcolor{##ffd0a9}{#1}"),Dr("\\goldB","\\textcolor{##ffbb71}{#1}"),Dr("\\goldC","\\textcolor{##ff9c39}{#1}"),Dr("\\goldD","\\textcolor{##e07d10}{#1}"),Dr("\\goldE","\\textcolor{##a75a05}{#1}"),Dr("\\redA","\\textcolor{##fca9a9}{#1}"),Dr("\\redB","\\textcolor{##ff8482}{#1}"),Dr("\\redC","\\textcolor{##f9685d}{#1}"),Dr("\\redD","\\textcolor{##e84d39}{#1}"),Dr("\\redE","\\textcolor{##bc2612}{#1}"),Dr("\\maroonA","\\textcolor{##ffbde0}{#1}"),Dr("\\maroonB","\\textcolor{##ff92c6}{#1}"),Dr("\\maroonC","\\textcolor{##ed5fa6}{#1}"),Dr("\\maroonD","\\textcolor{##ca337c}{#1}"),Dr("\\maroonE","\\textcolor{##9e034e}{#1}"),Dr("\\purpleA","\\textcolor{##ddd7ff}{#1}"),Dr("\\purpleB","\\textcolor{##c6b9fc}{#1}"),Dr("\\purpleC","\\textcolor{##aa87ff}{#1}"),Dr("\\purpleD","\\textcolor{##7854ab}{#1}"),Dr("\\purpleE","\\textcolor{##543b78}{#1}"),Dr("\\mintA","\\textcolor{##f5f9e8}{#1}"),Dr("\\mintB","\\textcolor{##edf2df}{#1}"),Dr("\\mintC","\\textcolor{##e0e5cc}{#1}"),Dr("\\grayA","\\textcolor{##f6f7f7}{#1}"),Dr("\\grayB","\\textcolor{##f0f1f2}{#1}"),Dr("\\grayC","\\textcolor{##e3e5e6}{#1}"),Dr("\\grayD","\\textcolor{##d6d8da}{#1}"),Dr("\\grayE","\\textcolor{##babec2}{#1}"),Dr("\\grayF","\\textcolor{##888d93}{#1}"),Dr("\\grayG","\\textcolor{##626569}{#1}"),Dr("\\grayH","\\textcolor{##3b3e40}{#1}"),Dr("\\grayI","\\textcolor{##21242c}{#1}"),Dr("\\kaBlue","\\textcolor{##314453}{#1}"),Dr("\\kaGreen","\\textcolor{##71B307}{#1}");var zr={"\\relax":!0,"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},jr=function(){function t(t,e,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=e,this.expansionCount=0,this.feed(t),this.macros=new _r(Tr,e.macros),this.mode=n,this.stack=[]}var e=t.prototype;return e.feed=function(t){this.lexer=new Or(t,this.settings)},e.switchMode=function(t){this.mode=t},e.beginGroup=function(){this.macros.beginGroup()},e.endGroup=function(){this.macros.endGroup()},e.future=function(){return 0===this.stack.length&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]},e.popToken=function(){return this.future(),this.stack.pop()},e.pushToken=function(t){this.stack.push(t)},e.pushTokens=function(t){var e;(e=this.stack).push.apply(e,t)},e.consumeSpaces=function(){for(;" "===this.future().text;)this.stack.pop()},e.consumeArgs=function(t){for(var e=[],n=0;nthis.settings.maxExpand)throw new a("Too many expansions: infinite loop or need to increase maxExpand setting");var i=r.tokens;if(r.numArgs)for(var o=this.consumeArgs(r.numArgs),s=(i=i.slice()).length-1;s>=0;--s){var u=i[s];if("#"===u.text){if(0===s)throw new a("Incomplete placeholder at end of macro body",u);if("#"===(u=i[--s]).text)i.splice(s+1,1);else{if(!/^[1-9]$/.test(u.text))throw new a("Not a valid argument number",u);var c;(c=i).splice.apply(c,[s,2].concat(o[+u.text-1]))}}}return this.pushTokens(i),i},e.expandAfterFuture=function(){return this.expandOnce(),this.future()},e.expandNextToken=function(){for(;;){var t=this.expandOnce();if(t instanceof i){if("\\relax"!==t.text&&!t.treatAsRelax)return this.stack.pop();this.stack.pop()}}throw new Error},e.expandMacro=function(t){return this.macros.has(t)?this.expandTokens([new i(t)]):void 0},e.expandTokens=function(t){var e=[],n=this.stack.length;for(this.pushTokens(t);this.stack.length>n;){var r=this.expandOnce(!0);r instanceof i&&(r.treatAsRelax&&(r.noexpand=!1,r.treatAsRelax=!1),e.push(this.stack.pop()))}return e},e.expandMacroAsText=function(t){var e=this.expandMacro(t);return e?e.map((function(t){return t.text})).join(""):e},e._getExpansion=function(t){var e=this.macros.get(t);if(null==e)return e;var n="function"==typeof e?e(this):e;if("string"==typeof n){var r=0;if(-1!==n.indexOf("#"))for(var i=n.replace(/##/g,"");-1!==i.indexOf("#"+(r+1));)++r;for(var o=new Or(n,this.settings),a=[],s=o.lex();"EOF"!==s.text;)a.push(s),s=o.lex();return a.reverse(),{tokens:a,numArgs:r}}return n},e.isDefined=function(t){return this.macros.has(t)||br.hasOwnProperty(t)||X.math.hasOwnProperty(t)||X.text.hasOwnProperty(t)||zr.hasOwnProperty(t)},e.isExpandable=function(t){var e=this.macros.get(t);return null!=e?"string"==typeof e||"function"==typeof e||!e.unexpandable:br.hasOwnProperty(t)},t}(),Pr={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"}},Lr={"á":"á","à":"à","ä":"ä","ǟ":"ǟ","ã":"ã","ā":"ā","ă":"ă","ắ":"ắ","ằ":"ằ","ẵ":"ẵ","ǎ":"ǎ","â":"â","ấ":"ấ","ầ":"ầ","ẫ":"ẫ","ȧ":"ȧ","ǡ":"ǡ","å":"å","ǻ":"ǻ","ḃ":"ḃ","ć":"ć","č":"č","ĉ":"ĉ","ċ":"ċ","ď":"ď","ḋ":"ḋ","é":"é","è":"è","ë":"ë","ẽ":"ẽ","ē":"ē","ḗ":"ḗ","ḕ":"ḕ","ĕ":"ĕ","ě":"ě","ê":"ê","ế":"ế","ề":"ề","ễ":"ễ","ė":"ė","ḟ":"ḟ","ǵ":"ǵ","ḡ":"ḡ","ğ":"ğ","ǧ":"ǧ","ĝ":"ĝ","ġ":"ġ","ḧ":"ḧ","ȟ":"ȟ","ĥ":"ĥ","ḣ":"ḣ","í":"í","ì":"ì","ï":"ï","ḯ":"ḯ","ĩ":"ĩ","ī":"ī","ĭ":"ĭ","ǐ":"ǐ","î":"î","ǰ":"ǰ","ĵ":"ĵ","ḱ":"ḱ","ǩ":"ǩ","ĺ":"ĺ","ľ":"ľ","ḿ":"ḿ","ṁ":"ṁ","ń":"ń","ǹ":"ǹ","ñ":"ñ","ň":"ň","ṅ":"ṅ","ó":"ó","ò":"ò","ö":"ö","ȫ":"ȫ","õ":"õ","ṍ":"ṍ","ṏ":"ṏ","ȭ":"ȭ","ō":"ō","ṓ":"ṓ","ṑ":"ṑ","ŏ":"ŏ","ǒ":"ǒ","ô":"ô","ố":"ố","ồ":"ồ","ỗ":"ỗ","ȯ":"ȯ","ȱ":"ȱ","ő":"ő","ṕ":"ṕ","ṗ":"ṗ","ŕ":"ŕ","ř":"ř","ṙ":"ṙ","ś":"ś","ṥ":"ṥ","š":"š","ṧ":"ṧ","ŝ":"ŝ","ṡ":"ṡ","ẗ":"ẗ","ť":"ť","ṫ":"ṫ","ú":"ú","ù":"ù","ü":"ü","ǘ":"ǘ","ǜ":"ǜ","ǖ":"ǖ","ǚ":"ǚ","ũ":"ũ","ṹ":"ṹ","ū":"ū","ṻ":"ṻ","ŭ":"ŭ","ǔ":"ǔ","û":"û","ů":"ů","ű":"ű","ṽ":"ṽ","ẃ":"ẃ","ẁ":"ẁ","ẅ":"ẅ","ŵ":"ŵ","ẇ":"ẇ","ẘ":"ẘ","ẍ":"ẍ","ẋ":"ẋ","ý":"ý","ỳ":"ỳ","ÿ":"ÿ","ỹ":"ỹ","ȳ":"ȳ","ŷ":"ŷ","ẏ":"ẏ","ẙ":"ẙ","ź":"ź","ž":"ž","ẑ":"ẑ","ż":"ż","Á":"Á","À":"À","Ä":"Ä","Ǟ":"Ǟ","Ã":"Ã","Ā":"Ā","Ă":"Ă","Ắ":"Ắ","Ằ":"Ằ","Ẵ":"Ẵ","Ǎ":"Ǎ","Â":"Â","Ấ":"Ấ","Ầ":"Ầ","Ẫ":"Ẫ","Ȧ":"Ȧ","Ǡ":"Ǡ","Å":"Å","Ǻ":"Ǻ","Ḃ":"Ḃ","Ć":"Ć","Č":"Č","Ĉ":"Ĉ","Ċ":"Ċ","Ď":"Ď","Ḋ":"Ḋ","É":"É","È":"È","Ë":"Ë","Ẽ":"Ẽ","Ē":"Ē","Ḗ":"Ḗ","Ḕ":"Ḕ","Ĕ":"Ĕ","Ě":"Ě","Ê":"Ê","Ế":"Ế","Ề":"Ề","Ễ":"Ễ","Ė":"Ė","Ḟ":"Ḟ","Ǵ":"Ǵ","Ḡ":"Ḡ","Ğ":"Ğ","Ǧ":"Ǧ","Ĝ":"Ĝ","Ġ":"Ġ","Ḧ":"Ḧ","Ȟ":"Ȟ","Ĥ":"Ĥ","Ḣ":"Ḣ","Í":"Í","Ì":"Ì","Ï":"Ï","Ḯ":"Ḯ","Ĩ":"Ĩ","Ī":"Ī","Ĭ":"Ĭ","Ǐ":"Ǐ","Î":"Î","İ":"İ","Ĵ":"Ĵ","Ḱ":"Ḱ","Ǩ":"Ǩ","Ĺ":"Ĺ","Ľ":"Ľ","Ḿ":"Ḿ","Ṁ":"Ṁ","Ń":"Ń","Ǹ":"Ǹ","Ñ":"Ñ","Ň":"Ň","Ṅ":"Ṅ","Ó":"Ó","Ò":"Ò","Ö":"Ö","Ȫ":"Ȫ","Õ":"Õ","Ṍ":"Ṍ","Ṏ":"Ṏ","Ȭ":"Ȭ","Ō":"Ō","Ṓ":"Ṓ","Ṑ":"Ṑ","Ŏ":"Ŏ","Ǒ":"Ǒ","Ô":"Ô","Ố":"Ố","Ồ":"Ồ","Ỗ":"Ỗ","Ȯ":"Ȯ","Ȱ":"Ȱ","Ő":"Ő","Ṕ":"Ṕ","Ṗ":"Ṗ","Ŕ":"Ŕ","Ř":"Ř","Ṙ":"Ṙ","Ś":"Ś","Ṥ":"Ṥ","Š":"Š","Ṧ":"Ṧ","Ŝ":"Ŝ","Ṡ":"Ṡ","Ť":"Ť","Ṫ":"Ṫ","Ú":"Ú","Ù":"Ù","Ü":"Ü","Ǘ":"Ǘ","Ǜ":"Ǜ","Ǖ":"Ǖ","Ǚ":"Ǚ","Ũ":"Ũ","Ṹ":"Ṹ","Ū":"Ū","Ṻ":"Ṻ","Ŭ":"Ŭ","Ǔ":"Ǔ","Û":"Û","Ů":"Ů","Ű":"Ű","Ṽ":"Ṽ","Ẃ":"Ẃ","Ẁ":"Ẁ","Ẅ":"Ẅ","Ŵ":"Ŵ","Ẇ":"Ẇ","Ẍ":"Ẍ","Ẋ":"Ẋ","Ý":"Ý","Ỳ":"Ỳ","Ÿ":"Ÿ","Ỹ":"Ỹ","Ȳ":"Ȳ","Ŷ":"Ŷ","Ẏ":"Ẏ","Ź":"Ź","Ž":"Ž","Ẑ":"Ẑ","Ż":"Ż","ά":"ά","ὰ":"ὰ","ᾱ":"ᾱ","ᾰ":"ᾰ","έ":"έ","ὲ":"ὲ","ή":"ή","ὴ":"ὴ","ί":"ί","ὶ":"ὶ","ϊ":"ϊ","ΐ":"ΐ","ῒ":"ῒ","ῑ":"ῑ","ῐ":"ῐ","ό":"ό","ὸ":"ὸ","ύ":"ύ","ὺ":"ὺ","ϋ":"ϋ","ΰ":"ΰ","ῢ":"ῢ","ῡ":"ῡ","ῠ":"ῠ","ώ":"ώ","ὼ":"ὼ","Ύ":"Ύ","Ὺ":"Ὺ","Ϋ":"Ϋ","Ῡ":"Ῡ","Ῠ":"Ῠ","Ώ":"Ώ","Ὼ":"Ὼ"},Wr=function(){function t(t,e){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new jr(t,e,this.mode),this.settings=e,this.leftrightDepth=0}var e=t.prototype;return e.expect=function(t,e){if(void 0===e&&(e=!0),this.fetch().text!==t)throw new a("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());e&&this.consume()},e.consume=function(){this.nextToken=null},e.fetch=function(){return null==this.nextToken&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken},e.switchMode=function(t){this.mode=t,this.gullet.switchMode(t)},e.parse=function(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t},e.parseExpression=function(e,n){for(var r=[];;){"math"===this.mode&&this.consumeSpaces();var i=this.fetch();if(-1!==t.endOfExpression.indexOf(i.text))break;if(n&&i.text===n)break;if(e&&br[i.text]&&br[i.text].infix)break;var o=this.parseAtom(n);if(!o)break;"internal"!==o.type&&r.push(o)}return"text"===this.mode&&this.formLigatures(r),this.handleInfixNodes(r)},e.handleInfixNodes=function(t){for(var e,n=-1,r=0;r0&&!c||0===s&&!c&&"math"===this.mode,f=this.parseGroupOfType("argument to '"+t+"'",u,c,r,l);if(!f){if(c){o.push(null);continue}throw new a("Expected group after '"+t+"'",this.fetch())}(c?o:i).push(f)}return{args:i,optArgs:o}},e.parseGroupOfType=function(t,e,n,r,i){switch(e){case"color":return i&&this.consumeSpaces(),this.parseColorGroup(n);case"size":return i&&this.consumeSpaces(),this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n,i);case"math":case"text":return this.parseGroup(t,n,r,void 0,e,i);case"hbox":var o=this.parseGroup(t,n,r,void 0,"text",i);return o?{type:"styling",mode:o.mode,body:[o],style:"text"}:o;case"raw":if(i&&this.consumeSpaces(),n&&"{"===this.fetch().text)return null;var s=this.parseStringGroup("raw",n,!0);if(s)return{type:"raw",mode:"text",string:s.text};throw new a("Expected raw group",this.fetch());case"original":case null:case void 0:return this.parseGroup(t,n,r,void 0,void 0,i);default:throw new a("Unknown group type as "+t,this.fetch())}},e.consumeSpaces=function(){for(;" "===this.fetch().text;)this.consume()},e.parseStringGroup=function(t,e,n){var r=e?"[":"{",i=e?"]":"}",o=this.fetch();if(o.text!==r){if(e)return null;if(n&&"EOF"!==o.text&&/[^{}[\]]/.test(o.text))return this.consume(),o}var s=this.mode;this.mode="text",this.expect(r);for(var u,c="",l=this.fetch(),f=0,h=l;(u=this.fetch()).text!==i||n&&f>0;){switch(u.text){case"EOF":throw new a("Unexpected end of input in "+t,l.range(h,c));case r:f++;break;case i:f--}c+=(h=u).text,this.consume()}return this.expect(i),this.mode=s,l.range(h,c)},e.parseRegexGroup=function(t,e){var n=this.mode;this.mode="text";for(var r,i=this.fetch(),o=i,s="";"EOF"!==(r=this.fetch()).text&&t.test(s+r.text);)s+=(o=r).text,this.consume();if(""===s)throw new a("Invalid "+e+": '"+i.text+"'",i);return this.mode=n,i.range(o,s)},e.parseColorGroup=function(t){var e=this.parseStringGroup("color",t);if(!e)return null;var n=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(e.text);if(!n)throw new a("Invalid color: '"+e.text+"'",e);var r=n[0];return/^[0-9a-f]{6}$/i.test(r)&&(r="#"+r),{type:"color-token",mode:this.mode,color:r}},e.parseSizeGroup=function(t){var e,n=!1;if(!(e=t||"{"===this.fetch().text?this.parseStringGroup("size",t):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size")))return null;t||0!==e.text.length||(e.text="0pt",n=!0);var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e.text);if(!r)throw new a("Invalid size: '"+e.text+"'",e);var i={number:+(r[1]+r[2]),unit:r[3]};if(!Pt(i))throw new a("Invalid unit: '"+i.unit+"'",e);return{type:"size",mode:this.mode,value:i,isBlank:n}},e.parseUrlGroup=function(t,e){this.gullet.lexer.setCatcode("%",13);var n=this.parseStringGroup("url",t,!0);if(this.gullet.lexer.setCatcode("%",14),!n)return null;var r=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}},e.parseGroup=function(e,n,i,o,s,u){var c=this.mode;s&&this.switchMode(s),u&&this.consumeSpaces();var l,f=this.fetch(),h=f.text;if(n?"["===h:"{"===h||"\\begingroup"===h){this.consume();var p=t.endOfGroup[h];this.gullet.beginGroup();var d=this.parseExpression(!1,p),m=this.fetch();this.expect(p),this.gullet.endGroup(),l={type:"ordgroup",mode:this.mode,loc:r.range(f,m),body:d,semisimple:"\\begingroup"===h||void 0}}else if(n)l=null;else if(null==(l=this.parseFunction(o,e,i)||this.parseSymbol())&&"\\"===h[0]&&!zr.hasOwnProperty(h)){if(this.settings.throwOnError)throw new a("Undefined control sequence: "+h,f);l=this.formatUnsupportedCmd(h),this.consume()}return s&&this.switchMode(c),l},e.formLigatures=function(t){for(var e=t.length-1,n=0;n=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+e[0]+'" used in math mode',t);var u,c=X[this.mode][e].group,l=r.range(t);if(G.hasOwnProperty(c)){var f=c;u={type:"atom",mode:this.mode,family:f,loc:l,text:e}}else u={type:c,mode:this.mode,loc:l,text:e};o=u}else{if(!(e.charCodeAt(0)>=128))return null;this.settings.strict&&(C(e.charCodeAt(0))?"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+e[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+e[0]+'" ('+e.charCodeAt(0)+")",t)),o={type:"textord",mode:"text",loc:r.range(t),text:e}}if(this.consume(),s)for(var h=0;hReferences + Open Source \n

This article is a product of the following resources:\n

\n

D3.js \n (Mike Bostock & Philippe Rivière)

\n

LayerCake \n (Michael Keller)

\n

KaTeX \n (Emily Eisenberg & Sophie Alpert)

\n

Svelte \n (Rich Harris)

',h(n,"id","resources"),h(n,"class","svelte-1jnlkqb")},m(t,e){s(t,n,e)},p:t,i:t,o:t,d(t){t&&u(n)}}}class K extends B{constructor(t){super(),M(this,t,null,$,o,{})}}var X=q((function(t,e){window,t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s=581)}([function(t,e,n){n.r(e),function(t,r,i,o){n.d(e,"AdadeltaOptimizer",(function(){return Nh})),n.d(e,"AdagradOptimizer",(function(){return Th})),n.d(e,"AdamOptimizer",(function(){return Dh})),n.d(e,"AdamaxOptimizer",(function(){return Ih})),n.d(e,"Add",(function(){return Er})),n.d(e,"AddN",(function(){return Cr})),n.d(e,"BroadcastTo",(function(){return Dr})),n.d(e,"DataStorage",(function(){return ho})),n.d(e,"Div",(function(){return Sr})),n.d(e,"ENV",(function(){return h})),n.d(e,"Environment",(function(){return l})),n.d(e,"FromPixels",(function(){return Br})),n.d(e,"FusedBatchNorm",(function(){return Ar})),n.d(e,"Identity",(function(){return Rr})),n.d(e,"KernelBackend",(function(){return po})),n.d(e,"MaxPoolWithArgmax",(function(){return zr})),n.d(e,"MomentumOptimizer",(function(){return Fh})),n.d(e,"NonMaxSuppressionV5",(function(){return Tr})),n.d(e,"OneHot",(function(){return Ir})),n.d(e,"Optimizer",(function(){return _h})),n.d(e,"PadV2",(function(){return Mr})),n.d(e,"RMSPropOptimizer",(function(){return Mh})),n.d(e,"Rank",(function(){return At})),n.d(e,"Reduction",(function(){return dl})),n.d(e,"SGDOptimizer",(function(){return Rh})),n.d(e,"Square",(function(){return _r})),n.d(e,"SquaredDifference",(function(){return Or})),n.d(e,"Tensor",(function(){return St})),n.d(e,"TensorBuffer",(function(){return wt})),n.d(e,"Tile",(function(){return Fr})),n.d(e,"Transpose",(function(){return Nr})),n.d(e,"Variable",(function(){return Dt})),n.d(e,"abs",(function(){return Ur})),n.d(e,"acos",(function(){return Vr})),n.d(e,"acosh",(function(){return qr})),n.d(e,"add",(function(){return jr})),n.d(e,"addN",(function(){return js})),n.d(e,"addStrict",(function(){return ki})),n.d(e,"all",(function(){return Rc})),n.d(e,"any",(function(){return Fc})),n.d(e,"argMax",(function(){return Mc})),n.d(e,"argMin",(function(){return Bc})),n.d(e,"asin",(function(){return Hr})),n.d(e,"asinh",(function(){return Gr})),n.d(e,"atan",(function(){return $r})),n.d(e,"atan2",(function(){return Ei})),n.d(e,"atanh",(function(){return Kr})),n.d(e,"avgPool",(function(){return kc})),n.d(e,"avgPool3d",(function(){return Sc})),n.d(e,"backend",(function(){return mn})),n.d(e,"backend_util",(function(){return Do})),n.d(e,"basicLSTMCell",(function(){return Zc})),n.d(e,"batchNorm",(function(){return qs})),n.d(e,"batchNorm2d",(function(){return $s})),n.d(e,"batchNorm3d",(function(){return Ys})),n.d(e,"batchNorm4d",(function(){return Qs})),n.d(e,"batchNormalization",(function(){return Vs})),n.d(e,"batchNormalization2d",(function(){return Gs})),n.d(e,"batchNormalization3d",(function(){return Xs})),n.d(e,"batchNormalization4d",(function(){return Zs})),n.d(e,"batchToSpaceND",(function(){return sr})),n.d(e,"booleanMaskAsync",(function(){return Yu})),n.d(e,"broadcastTo",(function(){return tu})),n.d(e,"browser",(function(){return wh})),n.d(e,"buffer",(function(){return or})),n.d(e,"cast",(function(){return ur})),n.d(e,"ceil",(function(){return Xr})),n.d(e,"clipByValue",(function(){return Yr})),n.d(e,"clone",(function(){return eu})),n.d(e,"complex",(function(){return Rn})),n.d(e,"concat",(function(){return Qn})),n.d(e,"concat1d",(function(){return tr})),n.d(e,"concat2d",(function(){return er})),n.d(e,"concat3d",(function(){return nr})),n.d(e,"concat4d",(function(){return rr})),n.d(e,"conv1d",(function(){return tc})),n.d(e,"conv2d",(function(){return ec})),n.d(e,"conv2dTranspose",(function(){return cc})),n.d(e,"conv3d",(function(){return nc})),n.d(e,"conv3dTranspose",(function(){return lc})),n.d(e,"cos",(function(){return Jr})),n.d(e,"cosh",(function(){return Zr})),n.d(e,"cumsum",(function(){return cr})),n.d(e,"customGrad",(function(){return so})),n.d(e,"deprecationWarn",(function(){return Ze})),n.d(e,"depthToSpace",(function(){return lr})),n.d(e,"depthwiseConv2d",(function(){return oc})),n.d(e,"diag",(function(){return fl})),n.d(e,"disableDeprecationWarnings",(function(){return Je})),n.d(e,"dispose",(function(){return on})),n.d(e,"disposeVariables",(function(){return Qe})),n.d(e,"div",(function(){return Pi})),n.d(e,"divNoNan",(function(){return uu})),n.d(e,"divStrict",(function(){return Ci})),n.d(e,"dot",(function(){return hc})),n.d(e,"dropout",(function(){return hl})),n.d(e,"elu",(function(){return qc})),n.d(e,"enableDebugMode",(function(){return Ye})),n.d(e,"enableProdMode",(function(){return Xe})),n.d(e,"engine",(function(){return tn})),n.d(e,"env",(function(){return f})),n.d(e,"equal",(function(){return Fu})),n.d(e,"equalStrict",(function(){return Mu})),n.d(e,"erf",(function(){return Qr})),n.d(e,"exp",(function(){return ti})),n.d(e,"expandDims",(function(){return fr})),n.d(e,"expm1",(function(){return ei})),n.d(e,"eye",(function(){return lu})),n.d(e,"fft",(function(){return il})),n.d(e,"fill",(function(){return Kn})),n.d(e,"findBackend",(function(){return hn})),n.d(e,"findBackendFactory",(function(){return pn})),n.d(e,"floor",(function(){return ni})),n.d(e,"floorDiv",(function(){return Si})),n.d(e,"frame",(function(){return vl})),n.d(e,"fused",(function(){return Yl})),n.d(e,"gather",(function(){return Ku})),n.d(e,"gatherND",(function(){return ll})),n.d(e,"gather_util",(function(){return Wi})),n.d(e,"getBackend",(function(){return ln})),n.d(e,"getGradient",(function(){return g})),n.d(e,"getKernel",(function(){return m})),n.d(e,"getKernelsForBackend",(function(){return v})),n.d(e,"grad",(function(){return no})),n.d(e,"grads",(function(){return ro})),n.d(e,"greater",(function(){return Bu})),n.d(e,"greaterEqual",(function(){return zu})),n.d(e,"greaterEqualStrict",(function(){return ju})),n.d(e,"greaterStrict",(function(){return Pu})),n.d(e,"hammingWindow",(function(){return gl})),n.d(e,"hannWindow",(function(){return ml})),n.d(e,"ifft",(function(){return ol})),n.d(e,"imag",(function(){return Mn})),n.d(e,"image",(function(){return Ul})),n.d(e,"inTopKAsync",(function(){return xl})),n.d(e,"io",(function(){return vh})),n.d(e,"irfft",(function(){return sl})),n.d(e,"isFinite",(function(){return di})),n.d(e,"isInf",(function(){return pi})),n.d(e,"isNaN",(function(){return hi})),n.d(e,"keep",(function(){return an})),n.d(e,"leakyRelu",(function(){return Hc})),n.d(e,"less",(function(){return Lu})),n.d(e,"lessEqual",(function(){return Wu})),n.d(e,"lessEqualStrict",(function(){return Uu})),n.d(e,"lessStrict",(function(){return Vu})),n.d(e,"linalg",(function(){return Ml})),n.d(e,"linspace",(function(){return Xn})),n.d(e,"localResponseNormalization",(function(){return Yc})),n.d(e,"log",(function(){return ri})),n.d(e,"log1p",(function(){return ii})),n.d(e,"logSigmoid",(function(){return oi})),n.d(e,"logSoftmax",(function(){return lo})),n.d(e,"logSumExp",(function(){return zc})),n.d(e,"logicalAnd",(function(){return nu})),n.d(e,"logicalNot",(function(){return ru})),n.d(e,"logicalOr",(function(){return iu})),n.d(e,"logicalXor",(function(){return ou})),n.d(e,"losses",(function(){return Tl})),n.d(e,"matMul",(function(){return fc})),n.d(e,"math",(function(){return bh})),n.d(e,"max",(function(){return jc})),n.d(e,"maxPool",(function(){return wc})),n.d(e,"maxPool3d",(function(){return Cc})),n.d(e,"maxPoolWithArgmax",(function(){return Ac})),n.d(e,"maximum",(function(){return Ai})),n.d(e,"maximumStrict",(function(){return Oi})),n.d(e,"mean",(function(){return Pc})),n.d(e,"memory",(function(){return en})),n.d(e,"min",(function(){return Lc})),n.d(e,"minimum",(function(){return _i})),n.d(e,"minimumStrict",(function(){return Ni})),n.d(e,"mod",(function(){return Ti})),n.d(e,"modStrict",(function(){return Di})),n.d(e,"moments",(function(){return Wc})),n.d(e,"movingAverage",(function(){return tl})),n.d(e,"mul",(function(){return Ii})),n.d(e,"mulStrict",(function(){return Ri})),n.d(e,"multiRNNCell",(function(){return Qc})),n.d(e,"multinomial",(function(){return fu})),n.d(e,"neg",(function(){return ai})),n.d(e,"nextFrame",(function(){return Ph})),n.d(e,"norm",(function(){return Jc})),n.d(e,"notEqual",(function(){return qu})),n.d(e,"notEqualStrict",(function(){return Hu})),n.d(e,"oneHot",(function(){return hu})),n.d(e,"ones",(function(){return Gn})),n.d(e,"onesLike",(function(){return Jn})),n.d(e,"op",(function(){return In})),n.d(e,"outerProduct",(function(){return pc})),n.d(e,"pad",(function(){return pu})),n.d(e,"pad1d",(function(){return du})),n.d(e,"pad2d",(function(){return mu})),n.d(e,"pad3d",(function(){return gu})),n.d(e,"pad4d",(function(){return vu})),n.d(e,"pool",(function(){return Ec})),n.d(e,"pow",(function(){return Fi})),n.d(e,"powStrict",(function(){return Mi})),n.d(e,"prelu",(function(){return Gc})),n.d(e,"print",(function(){return ar})),n.d(e,"prod",(function(){return Vc})),n.d(e,"profile",(function(){return nn})),n.d(e,"rand",(function(){return yu})),n.d(e,"randomGamma",(function(){return _u})),n.d(e,"randomNormal",(function(){return Nu})),n.d(e,"randomUniform",(function(){return Tu})),n.d(e,"range",(function(){return Yn})),n.d(e,"ready",(function(){return cn})),n.d(e,"real",(function(){return Fn})),n.d(e,"reciprocal",(function(){return si})),n.d(e,"registerBackend",(function(){return dn})),n.d(e,"registerGradient",(function(){return b})),n.d(e,"registerKernel",(function(){return y})),n.d(e,"relu",(function(){return $c})),n.d(e,"relu6",(function(){return Kc})),n.d(e,"removeBackend",(function(){return fn})),n.d(e,"reshape",(function(){return hr})),n.d(e,"reverse",(function(){return dc})),n.d(e,"reverse1d",(function(){return mc})),n.d(e,"reverse2d",(function(){return gc})),n.d(e,"reverse3d",(function(){return vc})),n.d(e,"reverse4d",(function(){return yc})),n.d(e,"rfft",(function(){return al})),n.d(e,"round",(function(){return ui})),n.d(e,"rsqrt",(function(){return ci})),n.d(e,"scalar",(function(){return jn})),n.d(e,"scatterND",(function(){return rl})),n.d(e,"scatter_util",(function(){return $i})),n.d(e,"selu",(function(){return Xc})),n.d(e,"separableConv2d",(function(){return uc})),n.d(e,"serialization",(function(){return Sh})),n.d(e,"setBackend",(function(){return un})),n.d(e,"setPlatform",(function(){return gn})),n.d(e,"setdiff1dAsync",(function(){return vr})),n.d(e,"sigmoid",(function(){return li})),n.d(e,"sign",(function(){return fi})),n.d(e,"signal",(function(){return bl})),n.d(e,"sin",(function(){return mi})),n.d(e,"sinh",(function(){return gi})),n.d(e,"slice",(function(){return Oc})),n.d(e,"slice1d",(function(){return _c})),n.d(e,"slice2d",(function(){return Nc})),n.d(e,"slice3d",(function(){return Tc})),n.d(e,"slice4d",(function(){return Dc})),n.d(e,"slice_util",(function(){return eo})),n.d(e,"softmax",(function(){return co})),n.d(e,"softplus",(function(){return vi})),n.d(e,"spaceToBatchND",(function(){return pr})),n.d(e,"sparseToDense",(function(){return cl})),n.d(e,"spectral",(function(){return ul})),n.d(e,"split",(function(){return ir})),n.d(e,"sqrt",(function(){return yi})),n.d(e,"square",(function(){return Du})),n.d(e,"squaredDifference",(function(){return Iu})),n.d(e,"squaredDifferenceStrict",(function(){return Bi})),n.d(e,"squeeze",(function(){return dr})),n.d(e,"stack",(function(){return mr})),n.d(e,"step",(function(){return bi})),n.d(e,"stft",(function(){return yl})),n.d(e,"stridedSlice",(function(){return el})),n.d(e,"sub",(function(){return zi})),n.d(e,"subStrict",(function(){return ji})),n.d(e,"sum",(function(){return Uc})),n.d(e,"sumOutType",(function(){return Ft})),n.d(e,"tan",(function(){return xi})),n.d(e,"tanh",(function(){return wi})),n.d(e,"tensor",(function(){return Bn})),n.d(e,"tensor1d",(function(){return Pn})),n.d(e,"tensor2d",(function(){return Ln})),n.d(e,"tensor3d",(function(){return Wn})),n.d(e,"tensor4d",(function(){return Un})),n.d(e,"tensor5d",(function(){return Vn})),n.d(e,"tensor6d",(function(){return qn})),n.d(e,"tensor_util",(function(){return Pt})),n.d(e,"test_util",(function(){return Cu})),n.d(e,"tidy",(function(){return rn})),n.d(e,"tile",(function(){return cu})),n.d(e,"time",(function(){return sn})),n.d(e,"topk",(function(){return nl})),n.d(e,"train",(function(){return zh})),n.d(e,"transpose",(function(){return fo})),n.d(e,"truncatedNormal",(function(){return Ru})),n.d(e,"unregisterGradient",(function(){return w})),n.d(e,"unregisterKernel",(function(){return x})),n.d(e,"unsortedSegmentSum",(function(){return Xu})),n.d(e,"unstack",(function(){return gr})),n.d(e,"util",(function(){return ht})),n.d(e,"valueAndGrad",(function(){return io})),n.d(e,"valueAndGrads",(function(){return oo})),n.d(e,"variable",(function(){return Hn})),n.d(e,"variableGrads",(function(){return ao})),n.d(e,"version_core",(function(){return Ah})),n.d(e,"webgl",(function(){return Oh})),n.d(e,"where",(function(){return au})),n.d(e,"whereAsync",(function(){return su})),n.d(e,"zeros",(function(){return $n})),n.d(e,"zerosLike",(function(){return Zn})); +var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function r(t){t.forEach(e)}function i(t){return"function"==typeof t}function o(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function a(t,e){t.appendChild(e)}function s(t,e,n){t.insertBefore(e,n||null)}function u(t){t.parentNode&&t.parentNode.removeChild(t)}function c(t){return document.createElement(t)}function l(t){return document.createTextNode(t)}function f(){return l(" ")}function h(t,e,n,r){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)}function p(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function d(t){return""===t?null:+t}function m(t,e){e=""+e,t.data!==e&&(t.data=e)}function g(t,e){t.value=null==e?"":e}let v;function y(t){v=t}function b(t){(function(){if(!v)throw new Error("Function called outside component initialization");return v})().$$.on_mount.push(t)}const x=[],w=[];let k=[];const E=[],C=Promise.resolve();let S=!1;function A(t){k.push(t)}const O=new Set;let _=0;function N(){if(0!==_)return;const t=v;do{try{for(;_{D.delete(t),r&&(n&&t.d(1),r())})),t.o(e)}else r&&r()}function M(t){t&&t.c()}function B(t,n,o,a){const{fragment:s,after_update:u}=t.$$;s&&s.m(n,o),a||A((()=>{const n=t.$$.on_mount.map(e).filter(i);t.$$.on_destroy?t.$$.on_destroy.push(...n):r(n),t.$$.on_mount=[]})),u.forEach(A)}function z(t,e){const n=t.$$;null!==n.fragment&&(!function(t){const e=[],n=[];k.forEach((r=>-1===t.indexOf(r)?e.push(r):n.push(r))),n.forEach((t=>t())),k=e}(n.after_update),r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function j(t,e){-1===t.$$.dirty[0]&&(x.push(t),S||(S=!0,C.then(N)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const i=r.length?r[0]:n;return p.ctx&&s(p.ctx[t],p.ctx[t]=i)&&(!p.skip_bound&&p.bound[t]&&p.bound[t](i),d&&j(e,t)),n})):[],p.update(),d=!0,r(p.before_update),p.fragment=!!a&&a(p.ctx),i.target){if(i.hydrate){const t=function(t){return Array.from(t.childNodes)}(i.target);p.fragment&&p.fragment.l(t),t.forEach(u)}else p.fragment&&p.fragment.c();i.intro&&R(e.$$.fragment),B(e,i.target,i.anchor,i.customElement),N()}y(h)}class L{$destroy(){z(this,1),this.$destroy=t}$on(e,n){if(!i(n))return t;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const t=r.indexOf(n);-1!==t&&r.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function W(e){let n,r,i,o,s,l,f,h,d,m;return{c(){n=c("meta"),r=c("meta"),i=c("meta"),o=c("meta"),s=c("meta"),l=c("meta"),f=c("meta"),h=c("meta"),d=c("meta"),m=c("meta"),document.title="MLU-Explain:",p(n,"charset","utf-8"),p(r,"http-equiv","X-UA-Compatible"),p(r,"content","IE=edge"),p(i,"name","viewport"),p(i,"content","width=device-width,initial-scale=1"),p(o,"name","viewport"),p(o,"content","width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"),p(s,"name","description"),p(s,"content","Svelte Interactive Article Starter"),p(l,"property","og:image"),p(l,"content",""),p(f,"property","og:title"),p(f,"content","Svelte Interactive Article Starter"),p(h,"property","og:description"),p(h,"content","Svelte Interactive Article Starter"),p(d,"property","og:image:width"),p(d,"content","1000"),p(m,"property","og:image:height"),p(m,"content","630")},m(t,e){a(document.head,n),a(document.head,r),a(document.head,i),a(document.head,o),a(document.head,s),a(document.head,l),a(document.head,f),a(document.head,h),a(document.head,d),a(document.head,m)},p:t,i:t,o:t,d(t){u(n),u(r),u(i),u(o),u(s),u(l),u(f),u(h),u(d),u(m)}}}class U extends L{constructor(t){super(),P(this,t,null,W,o,{})}}function V(e){let n;return{c(){n=c("section"),n.innerHTML='

Classifying MNIST Dataset With K-Nearest Neighbors

\n

Introducing K-Nearest Neighbors and how it can be used for handwritten digit\n classification using the MNIST dataset.

\n

Monica Dai, Joyce Lu, Henry Xu, May 2024

',p(n,"id","intro"),p(n,"class","svelte-1c8kzz5")},m(t,e){s(t,n,e)},p:t,i:t,o:t,d(t){t&&u(n)}}}class q extends L{constructor(t){super(),P(this,t,null,V,o,{})}}function H(e){let n;return{c(){n=c("section"),n.innerHTML='

K-nearest neighbors (KNN)\n algorithm is one of the simplest classification and regression classifiers. It\n is a non-parametric algorithm, which means that it does not assume any specific\n data distribution. It operates based on the idea that similar data points are\n close to each other in a multi-dimensional space. KNN classifies a new data point\n based on the majority class of its 'k' nearest neighbors. 'k' controls the complexity\n of the decision boundary, thus influencing the overall performance of the model.\n When k is small, the decision boundary tends to be more complex, following the\n contours of training data more closely; as k increases, the decision boundary\n tends to be smoother and simpler. Choosing the right k helps balance between\n overfitting and underfitting.

'},m(t,e){s(t,n,e)},p:t,i:t,o:t,d(t){t&&u(n)}}}class G extends L{constructor(t){super(),P(this,t,null,H,o,{})}}var $="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function K(t){var e={exports:{}};return t(e,e.exports),e.exports}function X(e){let n;return{c(){n=c("section"),n.innerHTML='

Concluding Text

\n

Lorem ipsum dolor, sit amet consectetur adipisicing elit. Eos voluptas dicta\n blanditiis doloremque dolorum asperiores fugiat non, obcaecati maiores id,\n voluptatum possimus libero iure laudantium dignissimos corrupti? Iure omnis\n consectetur aperiam ipsam quod eum quas similique atque laboriosam ex\n accusantium quaerat laudantium, est a libero sed cumque odio perspiciatis\n enim, sequi, corrupti alias beatae nulla. Iure est ut dignissimos debitis\n optio quasi vel distinctio officiis doloremque, ad voluptates, omnis nam\n corporis, aut exercitationem ex excepturi tempore et modi unde alias nemo\n accusantium. Tempore odio nulla ex ad ut molestiae unde minima ipsam\n aliquid, omnis, labore commodi aliquam incidunt ratione autem?

',p(n,"id","conclusion"),p(n,"class","svelte-x4u2ks")},m(t,e){s(t,n,e)},p:t,i:t,o:t,d(t){t&&u(n)}}}K((function(t,e){var n;"undefined"!=typeof self&&self,n=function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(t,e,n){},function(t,e,n){n.r(e),n(0);var r=function(){function t(t,e,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=e,this.end=n}return t.range=function(e,n){return n?e&&e.loc&&n.loc&&e.loc.lexer===n.loc.lexer?new t(e.loc.lexer,e.loc.start,n.loc.end):null:e&&e.loc},t}(),i=function(){function t(t,e){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=t,this.loc=e}return t.prototype.range=function(e,n){return new t(n,r.range(this,e))},t}(),o=function t(e,n){this.position=void 0;var r,i="KaTeX parse error: "+e,o=n&&n.loc;if(o&&o.start<=o.end){var a=o.lexer.input;r=o.start;var s=o.end;r===a.length?i+=" at end of input: ":i+=" at position "+(r+1)+": ";var u=a.slice(r,s).replace(/[^]/g,"$&̲");i+=(r>15?"…"+a.slice(r-15,r):a.slice(0,r))+u+(s+15":">","<":"<",'"':""","'":"'"},c=/[&><"']/g,l=function t(e){return"ordgroup"===e.type||"color"===e.type?1===e.body.length?t(e.body[0]):e:"font"===e.type?t(e.body):e},f={contains:function(t,e){return-1!==t.indexOf(e)},deflt:function(t,e){return void 0===t?e:t},escape:function(t){return String(t).replace(c,(function(t){return u[t]}))},hyphenate:function(t){return t.replace(s,"-$1").toLowerCase()},getBaseElem:l,isCharacterBox:function(t){var e=l(t);return"mathord"===e.type||"textord"===e.type||"atom"===e.type},protocolFromUrl:function(t){var e=/^\s*([^\\/#]*?)(?::|�*58|�*3a)/i.exec(t);return null!=e?e[1]:"_relative"}},h=function(){function t(t){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{},this.displayMode=f.deflt(t.displayMode,!1),this.output=f.deflt(t.output,"htmlAndMathml"),this.leqno=f.deflt(t.leqno,!1),this.fleqn=f.deflt(t.fleqn,!1),this.throwOnError=f.deflt(t.throwOnError,!0),this.errorColor=f.deflt(t.errorColor,"#cc0000"),this.macros=t.macros||{},this.minRuleThickness=Math.max(0,f.deflt(t.minRuleThickness,0)),this.colorIsTextColor=f.deflt(t.colorIsTextColor,!1),this.strict=f.deflt(t.strict,"warn"),this.trust=f.deflt(t.trust,!1),this.maxSize=Math.max(0,f.deflt(t.maxSize,1/0)),this.maxExpand=Math.max(0,f.deflt(t.maxExpand,1e3)),this.globalGroup=f.deflt(t.globalGroup,!1)}var e=t.prototype;return e.reportNonstrict=function(t,e,n){var r=this.strict;if("function"==typeof r&&(r=r(t,e,n)),r&&"ignore"!==r){if(!0===r||"error"===r)throw new a("LaTeX-incompatible input and strict mode is set to 'error': "+e+" ["+t+"]",n);"warn"===r?"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+e+" ["+t+"]"):"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+r+"': "+e+" ["+t+"]")}},e.useStrictBehavior=function(t,e,n){var r=this.strict;if("function"==typeof r)try{r=r(t,e,n)}catch(t){r="error"}return!(!r||"ignore"===r||!0!==r&&"error"!==r&&("warn"===r?("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+e+" ["+t+"]"),1):("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+r+"': "+e+" ["+t+"]"),1)))},e.isTrusted=function(t){t.url&&!t.protocol&&(t.protocol=f.protocolFromUrl(t.url));var e="function"==typeof this.trust?this.trust(t):this.trust;return Boolean(e)},t}(),p=function(){function t(t,e,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=e,this.cramped=n}var e=t.prototype;return e.sup=function(){return d[m[this.id]]},e.sub=function(){return d[g[this.id]]},e.fracNum=function(){return d[v[this.id]]},e.fracDen=function(){return d[y[this.id]]},e.cramp=function(){return d[b[this.id]]},e.text=function(){return d[x[this.id]]},e.isTight=function(){return this.size>=2},t}(),d=[new p(0,0,!1),new p(1,0,!0),new p(2,1,!1),new p(3,1,!0),new p(4,2,!1),new p(5,2,!0),new p(6,3,!1),new p(7,3,!0)],m=[4,5,4,5,6,7,6,7],g=[5,5,5,5,7,7,7,7],v=[2,3,4,5,6,7,6,7],y=[3,3,5,5,7,7,7,7],b=[1,1,3,3,5,5,7,7],x=[0,1,2,3,2,3,2,3],w={DISPLAY:d[0],TEXT:d[2],SCRIPT:d[4],SCRIPTSCRIPT:d[6]},k=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}],E=[];function C(t){for(var e=0;e=E[e]&&t<=E[e+1])return!0;return!1}k.forEach((function(t){return t.blocks.forEach((function(t){return E.push.apply(E,t)}))}));var S=80,A={leftParenInner:"M291 0 H417 V300 H291 z",rightParenInner:"M457 0 H583 V300 H457 z",doubleleftarrow:"M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",doublerightarrow:"M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",leftarrow:"M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",leftbrace:"M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",leftbraceunder:"M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",leftgroup:"M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z",leftgroupunder:"M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z",leftharpoon:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z",leftharpoonplus:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z",leftharpoondown:"M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z",leftharpoondownplus:"M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z",lefthook:"M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z",leftlinesegment:"M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",leftmapsto:"M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",leftToFrom:"M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z",longequal:"M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",midbrace:"M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z",midbraceunder:"M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z",oiintSize1:"M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",oiintSize2:"M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",oiiintSize1:"M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",oiiintSize2:"M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",rightarrow:"M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z",rightbrace:"M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z",rightbraceunder:"M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z",rightgroup:"M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z",rightgroupunder:"M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z",rightharpoon:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z",rightharpoonplus:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z",rightharpoondown:"M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z",rightharpoondownplus:"M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z",righthook:"M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z",rightlinesegment:"M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",rightToFrom:"M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z",twoheadleftarrow:"M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z",twoheadrightarrow:"M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z",tilde1:"M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z",tilde2:"M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z",tilde3:"M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z",tilde4:"M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z",vec:"M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",widehat1:"M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z",widehat2:"M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat3:"M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat4:"M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widecheck1:"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",widecheck2:"M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck3:"M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck4:"M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",baraboveleftarrow:"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",rightarrowabovebar:"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",baraboveshortleftharpoon:"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",rightharpoonaboveshortbar:"M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",shortbaraboveleftharpoon:"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"},O=function(){function t(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}var e=t.prototype;return e.hasClass=function(t){return f.contains(this.classes,t)},e.toNode=function(){for(var t=document.createDocumentFragment(),e=0;e"},I=function(){function t(t,e,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,N.call(this,t,n,r),this.children=e||[]}var e=t.prototype;return e.setAttribute=function(t,e){this.attributes[t]=e},e.hasClass=function(t){return f.contains(this.classes,t)},e.toNode=function(){return T.call(this,"span")},e.toMarkup=function(){return D.call(this,"span")},t}(),R=function(){function t(t,e,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,N.call(this,e,r),this.children=n||[],this.setAttribute("href",t)}var e=t.prototype;return e.setAttribute=function(t,e){this.attributes[t]=e},e.hasClass=function(t){return f.contains(this.classes,t)},e.toNode=function(){return T.call(this,"a")},e.toMarkup=function(){return D.call(this,"a")},t}(),F=function(){function t(t,e,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=e,this.src=t,this.classes=["mord"],this.style=n}var e=t.prototype;return e.hasClass=function(t){return f.contains(this.classes,t)},e.toNode=function(){var t=document.createElement("img");for(var e in t.src=this.src,t.alt=this.alt,t.className="mord",this.style)this.style.hasOwnProperty(e)&&(t.style[e]=this.style[e]);return t},e.toMarkup=function(){var t=""+this.alt+"=i[0]&&t<=i[1])return n.name}return null}(this.text.charCodeAt(0));u&&this.classes.push(u+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=M[this.text])}var e=t.prototype;return e.hasClass=function(t){return f.contains(this.classes,t)},e.toNode=function(){var t=document.createTextNode(this.text),e=null;for(var n in this.italic>0&&((e=document.createElement("span")).style.marginRight=this.italic+"em"),this.classes.length>0&&((e=e||document.createElement("span")).className=_(this.classes)),this.style)this.style.hasOwnProperty(n)&&((e=e||document.createElement("span")).style[n]=this.style[n]);return e?(e.appendChild(t),e):t},e.toMarkup=function(){var t=!1,e="0&&(n+="margin-right:"+this.italic+"em;"),this.style)this.style.hasOwnProperty(r)&&(n+=f.hyphenate(r)+":"+this.style[r]+";");n&&(t=!0,e+=' style="'+f.escape(n)+'"');var i=f.escape(this.text);return t?(e+=">",e+=i,e+=""):i},t}(),z=function(){function t(t,e){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=e||{}}var e=t.prototype;return e.toNode=function(){var t=document.createElementNS("http://www.w3.org/2000/svg","svg");for(var e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&t.setAttribute(e,this.attributes[e]);for(var n=0;n":""},t}(),P=function(){function t(t){this.attributes=void 0,this.attributes=t||{}}var e=t.prototype;return e.toNode=function(){var t=document.createElementNS("http://www.w3.org/2000/svg","line");for(var e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&t.setAttribute(e,this.attributes[e]);return t},e.toMarkup=function(){var t="","\\gt",!0),Y(J,Q,ct,"∈","\\in",!0),Y(J,Q,ct,"","\\@not"),Y(J,Q,ct,"⊂","\\subset",!0),Y(J,Q,ct,"⊃","\\supset",!0),Y(J,Q,ct,"⊆","\\subseteq",!0),Y(J,Q,ct,"⊇","\\supseteq",!0),Y(J,tt,ct,"⊈","\\nsubseteq",!0),Y(J,tt,ct,"⊉","\\nsupseteq",!0),Y(J,Q,ct,"⊨","\\models"),Y(J,Q,ct,"←","\\leftarrow",!0),Y(J,Q,ct,"≤","\\le"),Y(J,Q,ct,"≤","\\leq",!0),Y(J,Q,ct,"<","\\lt",!0),Y(J,Q,ct,"→","\\rightarrow",!0),Y(J,Q,ct,"→","\\to"),Y(J,tt,ct,"≱","\\ngeq",!0),Y(J,tt,ct,"≰","\\nleq",!0),Y(J,Q,lt," ","\\ "),Y(J,Q,lt," ","~"),Y(J,Q,lt," ","\\space"),Y(J,Q,lt," ","\\nobreakspace"),Y(Z,Q,lt," ","\\ "),Y(Z,Q,lt," "," "),Y(Z,Q,lt," ","~"),Y(Z,Q,lt," ","\\space"),Y(Z,Q,lt," ","\\nobreakspace"),Y(J,Q,lt,null,"\\nobreak"),Y(J,Q,lt,null,"\\allowbreak"),Y(J,Q,ut,",",","),Y(J,Q,ut,";",";"),Y(J,tt,nt,"⊼","\\barwedge",!0),Y(J,tt,nt,"⊻","\\veebar",!0),Y(J,Q,nt,"⊙","\\odot",!0),Y(J,Q,nt,"⊕","\\oplus",!0),Y(J,Q,nt,"⊗","\\otimes",!0),Y(J,Q,ft,"∂","\\partial",!0),Y(J,Q,nt,"⊘","\\oslash",!0),Y(J,tt,nt,"⊚","\\circledcirc",!0),Y(J,tt,nt,"⊡","\\boxdot",!0),Y(J,Q,nt,"△","\\bigtriangleup"),Y(J,Q,nt,"▽","\\bigtriangledown"),Y(J,Q,nt,"†","\\dagger"),Y(J,Q,nt,"⋄","\\diamond"),Y(J,Q,nt,"⋆","\\star"),Y(J,Q,nt,"◃","\\triangleleft"),Y(J,Q,nt,"▹","\\triangleright"),Y(J,Q,st,"{","\\{"),Y(Z,Q,ft,"{","\\{"),Y(Z,Q,ft,"{","\\textbraceleft"),Y(J,Q,rt,"}","\\}"),Y(Z,Q,ft,"}","\\}"),Y(Z,Q,ft,"}","\\textbraceright"),Y(J,Q,st,"{","\\lbrace"),Y(J,Q,rt,"}","\\rbrace"),Y(J,Q,st,"[","\\lbrack",!0),Y(Z,Q,ft,"[","\\lbrack",!0),Y(J,Q,rt,"]","\\rbrack",!0),Y(Z,Q,ft,"]","\\rbrack",!0),Y(J,Q,st,"(","\\lparen",!0),Y(J,Q,rt,")","\\rparen",!0),Y(Z,Q,ft,"<","\\textless",!0),Y(Z,Q,ft,">","\\textgreater",!0),Y(J,Q,st,"⌊","\\lfloor",!0),Y(J,Q,rt,"⌋","\\rfloor",!0),Y(J,Q,st,"⌈","\\lceil",!0),Y(J,Q,rt,"⌉","\\rceil",!0),Y(J,Q,ft,"\\","\\backslash"),Y(J,Q,ft,"∣","|"),Y(J,Q,ft,"∣","\\vert"),Y(Z,Q,ft,"|","\\textbar",!0),Y(J,Q,ft,"∥","\\|"),Y(J,Q,ft,"∥","\\Vert"),Y(Z,Q,ft,"∥","\\textbardbl"),Y(Z,Q,ft,"~","\\textasciitilde"),Y(Z,Q,ft,"\\","\\textbackslash"),Y(Z,Q,ft,"^","\\textasciicircum"),Y(J,Q,ct,"↑","\\uparrow",!0),Y(J,Q,ct,"⇑","\\Uparrow",!0),Y(J,Q,ct,"↓","\\downarrow",!0),Y(J,Q,ct,"⇓","\\Downarrow",!0),Y(J,Q,ct,"↕","\\updownarrow",!0),Y(J,Q,ct,"⇕","\\Updownarrow",!0),Y(J,Q,at,"∐","\\coprod"),Y(J,Q,at,"⋁","\\bigvee"),Y(J,Q,at,"⋀","\\bigwedge"),Y(J,Q,at,"⨄","\\biguplus"),Y(J,Q,at,"⋂","\\bigcap"),Y(J,Q,at,"⋃","\\bigcup"),Y(J,Q,at,"∫","\\int"),Y(J,Q,at,"∫","\\intop"),Y(J,Q,at,"∬","\\iint"),Y(J,Q,at,"∭","\\iiint"),Y(J,Q,at,"∏","\\prod"),Y(J,Q,at,"∑","\\sum"),Y(J,Q,at,"⨂","\\bigotimes"),Y(J,Q,at,"⨁","\\bigoplus"),Y(J,Q,at,"⨀","\\bigodot"),Y(J,Q,at,"∮","\\oint"),Y(J,Q,at,"⨆","\\bigsqcup"),Y(J,Q,at,"∫","\\smallint"),Y(Z,Q,it,"…","\\textellipsis"),Y(J,Q,it,"…","\\mathellipsis"),Y(Z,Q,it,"…","\\ldots",!0),Y(J,Q,it,"…","\\ldots",!0),Y(J,Q,it,"⋯","\\@cdots",!0),Y(J,Q,it,"⋱","\\ddots",!0),Y(J,Q,ft,"⋮","\\varvdots"),Y(J,Q,et,"ˊ","\\acute"),Y(J,Q,et,"ˋ","\\grave"),Y(J,Q,et,"¨","\\ddot"),Y(J,Q,et,"~","\\tilde"),Y(J,Q,et,"ˉ","\\bar"),Y(J,Q,et,"˘","\\breve"),Y(J,Q,et,"ˇ","\\check"),Y(J,Q,et,"^","\\hat"),Y(J,Q,et,"⃗","\\vec"),Y(J,Q,et,"˙","\\dot"),Y(J,Q,et,"˚","\\mathring"),Y(J,Q,ot,"","\\@imath"),Y(J,Q,ot,"","\\@jmath"),Y(J,Q,ft,"ı","ı"),Y(J,Q,ft,"ȷ","ȷ"),Y(Z,Q,ft,"ı","\\i",!0),Y(Z,Q,ft,"ȷ","\\j",!0),Y(Z,Q,ft,"ß","\\ss",!0),Y(Z,Q,ft,"æ","\\ae",!0),Y(Z,Q,ft,"œ","\\oe",!0),Y(Z,Q,ft,"ø","\\o",!0),Y(Z,Q,ft,"Æ","\\AE",!0),Y(Z,Q,ft,"Œ","\\OE",!0),Y(Z,Q,ft,"Ø","\\O",!0),Y(Z,Q,et,"ˊ","\\'"),Y(Z,Q,et,"ˋ","\\`"),Y(Z,Q,et,"ˆ","\\^"),Y(Z,Q,et,"˜","\\~"),Y(Z,Q,et,"ˉ","\\="),Y(Z,Q,et,"˘","\\u"),Y(Z,Q,et,"˙","\\."),Y(Z,Q,et,"˚","\\r"),Y(Z,Q,et,"ˇ","\\v"),Y(Z,Q,et,"¨",'\\"'),Y(Z,Q,et,"˝","\\H"),Y(Z,Q,et,"◯","\\textcircled");var ht={"--":!0,"---":!0,"``":!0,"''":!0};Y(Z,Q,ft,"–","--",!0),Y(Z,Q,ft,"–","\\textendash"),Y(Z,Q,ft,"—","---",!0),Y(Z,Q,ft,"—","\\textemdash"),Y(Z,Q,ft,"‘","`",!0),Y(Z,Q,ft,"‘","\\textquoteleft"),Y(Z,Q,ft,"’","'",!0),Y(Z,Q,ft,"’","\\textquoteright"),Y(Z,Q,ft,"“","``",!0),Y(Z,Q,ft,"“","\\textquotedblleft"),Y(Z,Q,ft,"”","''",!0),Y(Z,Q,ft,"”","\\textquotedblright"),Y(J,Q,ft,"°","\\degree",!0),Y(Z,Q,ft,"°","\\degree"),Y(Z,Q,ft,"°","\\textdegree",!0),Y(J,Q,ft,"£","\\pounds"),Y(J,Q,ft,"£","\\mathsterling",!0),Y(Z,Q,ft,"£","\\pounds"),Y(Z,Q,ft,"£","\\textsterling",!0),Y(J,tt,ft,"✠","\\maltese"),Y(Z,tt,ft,"✠","\\maltese");for(var pt='0123456789/@."',dt=0;dt<14;dt++){var mt=pt.charAt(dt);Y(J,Q,ft,mt,mt)}for(var gt='0123456789!@*()-=+";:?/.,',vt=0;vt<25;vt++){var yt=gt.charAt(vt);Y(Z,Q,ft,yt,yt)}for(var bt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",xt=0;xt<52;xt++){var wt=bt.charAt(xt);Y(J,Q,ot,wt,wt),Y(Z,Q,ft,wt,wt)}Y(J,tt,ft,"C","ℂ"),Y(Z,tt,ft,"C","ℂ"),Y(J,tt,ft,"H","ℍ"),Y(Z,tt,ft,"H","ℍ"),Y(J,tt,ft,"N","ℕ"),Y(Z,tt,ft,"N","ℕ"),Y(J,tt,ft,"P","ℙ"),Y(Z,tt,ft,"P","ℙ"),Y(J,tt,ft,"Q","ℚ"),Y(Z,tt,ft,"Q","ℚ"),Y(J,tt,ft,"R","ℝ"),Y(Z,tt,ft,"R","ℝ"),Y(J,tt,ft,"Z","ℤ"),Y(Z,tt,ft,"Z","ℤ"),Y(J,Q,ot,"h","ℎ"),Y(Z,Q,ot,"h","ℎ");for(var kt="",Et=0;Et<52;Et++){var Ct=bt.charAt(Et);Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56320+Et)),Y(Z,Q,ft,Ct,kt),Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56372+Et)),Y(Z,Q,ft,Ct,kt),Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56424+Et)),Y(Z,Q,ft,Ct,kt),Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56580+Et)),Y(Z,Q,ft,Ct,kt),Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56736+Et)),Y(Z,Q,ft,Ct,kt),Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56788+Et)),Y(Z,Q,ft,Ct,kt),Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56840+Et)),Y(Z,Q,ft,Ct,kt),Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56944+Et)),Y(Z,Q,ft,Ct,kt),Et<26&&(Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56632+Et)),Y(Z,Q,ft,Ct,kt),Y(J,Q,ot,Ct,kt=String.fromCharCode(55349,56476+Et)),Y(Z,Q,ft,Ct,kt))}Y(J,Q,ot,"k",kt=String.fromCharCode(55349,56668)),Y(Z,Q,ft,"k",kt);for(var St=0;St<10;St++){var At=St.toString();Y(J,Q,ot,At,kt=String.fromCharCode(55349,57294+St)),Y(Z,Q,ft,At,kt),Y(J,Q,ot,At,kt=String.fromCharCode(55349,57314+St)),Y(Z,Q,ft,At,kt),Y(J,Q,ot,At,kt=String.fromCharCode(55349,57324+St)),Y(Z,Q,ft,At,kt),Y(J,Q,ot,At,kt=String.fromCharCode(55349,57334+St)),Y(Z,Q,ft,At,kt)}for(var Ot="ÇÐÞçþ",_t=0;_t<5;_t++){var Nt=Ot.charAt(_t);Y(J,Q,ot,Nt,Nt),Y(Z,Q,ft,Nt,Nt)}var Tt=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["","",""],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],Dt=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],It=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Rt=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Ft=function(t,e){return e.size<2?t:It[t-1][e.size-1]},Mt=function(){function t(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||t.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=Rt[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}var e=t.prototype;return e.extend=function(e){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return new t(n)},e.havingStyle=function(t){return this.style===t?this:this.extend({style:t,size:Ft(this.textSize,t)})},e.havingCrampedStyle=function(){return this.havingStyle(this.style.cramp())},e.havingSize=function(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:Rt[t-1]})},e.havingBaseStyle=function(e){e=e||this.style.text();var n=Ft(t.BASESIZE,e);return this.size===n&&this.textSize===t.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})},e.havingBaseSizing=function(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})},e.withColor=function(t){return this.extend({color:t})},e.withPhantom=function(){return this.extend({phantom:!0})},e.withFont=function(t){return this.extend({font:t})},e.withTextFontFamily=function(t){return this.extend({fontFamily:t,font:""})},e.withTextFontWeight=function(t){return this.extend({fontWeight:t,font:""})},e.withTextFontShape=function(t){return this.extend({fontShape:t,font:""})},e.sizingClasses=function(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]},e.baseSizingClasses=function(){return this.size!==t.BASESIZE?["sizing","reset-size"+this.size,"size"+t.BASESIZE]:[]},e.fontMetrics=function(){return this._fontMetrics||(this._fontMetrics=function(t){var e;if(!H[e=t>=5?0:t>=3?1:2]){var n=H[e]={cssEmPerMu:U.quad[e]/18};for(var r in U)U.hasOwnProperty(r)&&(n[r]=U[r][e])}return H[e]}(this.size)),this._fontMetrics},e.getColor=function(){return this.phantom?"transparent":this.color},t}();Mt.BASESIZE=6;var Bt=Mt,zt={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:1.00375,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:1.00375},jt={ex:!0,em:!0,mu:!0},Pt=function(t){return"string"!=typeof t&&(t=t.unit),t in zt||t in jt||"ex"===t},Lt=function(t,e){var n;if(t.unit in zt)n=zt[t.unit]/e.fontMetrics().ptPerEm/e.sizeMultiplier;else if("mu"===t.unit)n=e.fontMetrics().cssEmPerMu;else{var r;if(r=e.style.isTight()?e.havingStyle(e.style.text()):e,"ex"===t.unit)n=r.fontMetrics().xHeight;else{if("em"!==t.unit)throw new a("Invalid unit: '"+t.unit+"'");n=r.fontMetrics().quad}r!==e&&(n*=r.sizeMultiplier/e.sizeMultiplier)}return Math.min(t.number*n,e.maxSize)},Wt=function(t,e,n){return X[n][t]&&X[n][t].replace&&(t=X[n][t].replace),{value:t,metrics:q(t,e,n)}},Ut=function(t,e,n,r,i){var o,a=Wt(t,e,n),s=a.metrics;if(t=a.value,s){var u=s.italic;("text"===n||r&&"mathit"===r.font)&&(u=0),o=new B(t,s.height,s.depth,u,s.skew,s.width,i)}else"undefined"!=typeof console&&console.warn("No character metrics for '"+t+"' in style '"+e+"' and mode '"+n+"'"),o=new B(t,0,0,0,0,0,i);if(r){o.maxFontSize=r.sizeMultiplier,r.style.isTight()&&o.classes.push("mtight");var c=r.getColor();c&&(o.style.color=c)}return o},Vt=function(t,e){if(_(t.classes)!==_(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize)return!1;for(var n in t.style)if(t.style.hasOwnProperty(n)&&t.style[n]!==e.style[n])return!1;for(var r in e.style)if(e.style.hasOwnProperty(r)&&t.style[r]!==e.style[r])return!1;return!0},qt=function(t){for(var e=0,n=0,r=0,i=0;ie&&(e=o.height),o.depth>n&&(n=o.depth),o.maxFontSize>r&&(r=o.maxFontSize)}t.height=e,t.depth=n,t.maxFontSize=r},Ht=function(t,e,n,r){var i=new I(t,e,n,r);return qt(i),i},Gt=function(t,e,n,r){return new I(t,e,n,r)},$t=function(t){var e=new O(t);return qt(e),e},Kt=function(t,e,n){var r="";switch(t){case"amsrm":r="AMS";break;case"textrm":r="Main";break;case"textsf":r="SansSerif";break;case"texttt":r="Typewriter";break;default:r=t}return r+"-"+("textbf"===e&&"textit"===n?"BoldItalic":"textbf"===e?"Bold":"textit"===e?"Italic":"Regular")},Xt={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},Yt={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659],leftParenInner:["leftParenInner",.875,.3],rightParenInner:["rightParenInner",.875,.3]},Jt={fontMap:Xt,makeSymbol:Ut,mathsym:function(t,e,n,r){return void 0===r&&(r=[]),"boldsymbol"===n.font&&Wt(t,"Main-Bold",e).metrics?Ut(t,"Main-Bold",e,n,r.concat(["mathbf"])):"\\"===t||"main"===X[e][t].font?Ut(t,"Main-Regular",e,n,r):Ut(t,"AMS-Regular",e,n,r.concat(["amsrm"]))},makeSpan:Ht,makeSvgSpan:Gt,makeLineSpan:function(t,e,n){var r=Ht([t],[],e);return r.height=Math.max(n||e.fontMetrics().defaultRuleThickness,e.minRuleThickness),r.style.borderBottomWidth=r.height+"em",r.maxFontSize=1,r},makeAnchor:function(t,e,n,r){var i=new R(t,e,n,r);return qt(i),i},makeFragment:$t,wrapFragment:function(t,e){return t instanceof O?Ht([],[t],e):t},makeVList:function(t,e){for(var n=function(t){if("individualShift"===t.positionType){for(var e=t.children,n=[e[0]],r=-e[0].shift-e[0].elem.depth,i=r,o=1;o0&&(o.push(we(a,e)),a=[]),o.push(i[s]));a.length>0&&o.push(we(a,e)),n&&((r=we(de(n,e,!0))).classes=["tag"],o.push(r));var c=ce(["katex-html"],o);if(c.setAttribute("aria-hidden","true"),r){var l=r.children[0];l.style.height=c.height+c.depth+"em",l.style.verticalAlign=-c.depth+"em"}return c}function Ee(t){return new O(t)}var Ce=function(){function t(t,e){this.type=void 0,this.attributes=void 0,this.children=void 0,this.type=t,this.attributes={},this.children=e||[]}var e=t.prototype;return e.setAttribute=function(t,e){this.attributes[t]=e},e.getAttribute=function(t){return this.attributes[t]},e.toNode=function(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&t.setAttribute(e,this.attributes[e]);for(var n=0;n"},e.toText=function(){return this.children.map((function(t){return t.toText()})).join("")},t}(),Se=function(){function t(t){this.text=void 0,this.text=t}var e=t.prototype;return e.toNode=function(){return document.createTextNode(this.text)},e.toMarkup=function(){return f.escape(this.toText())},e.toText=function(){return this.text},t}(),Ae={MathNode:Ce,TextNode:Se,SpaceNode:function(){function t(t){this.width=void 0,this.character=void 0,this.width=t,this.character=t>=.05555&&t<=.05556?" ":t>=.1666&&t<=.1667?" ":t>=.2222&&t<=.2223?" ":t>=.2777&&t<=.2778?"  ":t>=-.05556&&t<=-.05555?" ⁣":t>=-.1667&&t<=-.1666?" ⁣":t>=-.2223&&t<=-.2222?" ⁣":t>=-.2778&&t<=-.2777?" ⁣":null}var e=t.prototype;return e.toNode=function(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",this.width+"em"),t},e.toMarkup=function(){return this.character?""+this.character+"":''},e.toText=function(){return this.character?this.character:" "},t}(),newDocumentFragment:Ee},Oe=function(t,e,n){return!X[e][t]||!X[e][t].replace||55349===t.charCodeAt(0)||ht.hasOwnProperty(t)&&n&&(n.fontFamily&&"tt"===n.fontFamily.substr(4,2)||n.font&&"tt"===n.font.substr(4,2))||(t=X[e][t].replace),new Ae.TextNode(t)},_e=function(t){return 1===t.length?t[0]:new Ae.MathNode("mrow",t)},Ne=function(t,e){if("texttt"===e.fontFamily)return"monospace";if("textsf"===e.fontFamily)return"textit"===e.fontShape&&"textbf"===e.fontWeight?"sans-serif-bold-italic":"textit"===e.fontShape?"sans-serif-italic":"textbf"===e.fontWeight?"bold-sans-serif":"sans-serif";if("textit"===e.fontShape&&"textbf"===e.fontWeight)return"bold-italic";if("textit"===e.fontShape)return"italic";if("textbf"===e.fontWeight)return"bold";var n=e.font;if(!n||"mathnormal"===n)return null;var r=t.mode;if("mathit"===n)return"italic";if("boldsymbol"===n)return"textord"===t.type?"bold":"bold-italic";if("mathbf"===n)return"bold";if("mathbb"===n)return"double-struck";if("mathfrak"===n)return"fraktur";if("mathscr"===n||"mathcal"===n)return"script";if("mathsf"===n)return"sans-serif";if("mathtt"===n)return"monospace";var i=t.text;return f.contains(["\\imath","\\jmath"],i)?null:(X[r][i]&&X[r][i].replace&&(i=X[r][i].replace),q(i,Jt.fontMap[n].fontName,r)?Jt.fontMap[n].variant:null)},Te=function(t,e,n){if(1===t.length){var r=Ie(t[0],e);return n&&r instanceof Ce&&"mo"===r.type&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}for(var i,o=[],a=0;a0&&(p.text=p.text.slice(0,1)+"̸"+p.text.slice(1),o.pop())}}}o.push(s),i=s}return o},De=function(t,e,n){return _e(Te(t,e,n))},Ie=function(t,e){if(!t)return new Ae.MathNode("mrow");if(oe[t.type])return oe[t.type](t,e);throw new a("Got group of unknown type: '"+t.type+"'")};function Re(t,e,n,r,i){var o,a=Te(t,n);o=1===a.length&&a[0]instanceof Ce&&f.contains(["mrow","mtable"],a[0].type)?a[0]:new Ae.MathNode("mrow",a);var s=new Ae.MathNode("annotation",[new Ae.TextNode(e)]);s.setAttribute("encoding","application/x-tex");var u=new Ae.MathNode("semantics",[o,s]),c=new Ae.MathNode("math",[u]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var l=i?"katex":"katex-mathml";return Jt.makeSpan([l],[c])}var Fe=function(t){return new Bt({style:t.displayMode?w.DISPLAY:w.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},Me=function(t,e){if(e.displayMode){var n=["katex-display"];e.leqno&&n.push("leqno"),e.fleqn&&n.push("fleqn"),t=Jt.makeSpan(n,[t])}return t},Be={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋"},ze={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},je=function(t,e,n,r){var i,o=t.height+t.depth+2*n;if(/fbox|color/.test(e)){if(i=Jt.makeSpan(["stretchy",e],[],r),"fbox"===e){var a=r.color&&r.getColor();a&&(i.style.borderColor=a)}}else{var s=[];/^[bx]cancel$/.test(e)&&s.push(new P({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(e)&&s.push(new P({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var u=new z(s,{width:"100%",height:o+"em"});i=Jt.makeSvgSpan([],[u],r)}return i.height=o,i.style.height=o+"em",i},Pe=function(t){var e=new Ae.MathNode("mo",[new Ae.TextNode(Be[t.substr(1)])]);return e.setAttribute("stretchy","true"),e},Le=function(t,e){var n=function(){var n=4e5,r=t.label.substr(1);if(f.contains(["widehat","widecheck","widetilde","utilde"],r)){var i,o,a,s="ordgroup"===(d=t.base).type?d.body.length:1;if(s>5)"widehat"===r||"widecheck"===r?(i=420,n=2364,a=.42,o=r+"4"):(i=312,n=2340,a=.34,o="tilde4");else{var u=[1,1,2,2,3,3][s];"widehat"===r||"widecheck"===r?(n=[0,1062,2364,2364,2364][u],i=[0,239,300,360,420][u],a=[0,.24,.3,.3,.36,.42][u],o=r+u):(n=[0,600,1033,2339,2340][u],i=[0,260,286,306,312][u],a=[0,.26,.286,.3,.306,.34][u],o="tilde"+u)}var c=new j(o),l=new z([c],{width:"100%",height:a+"em",viewBox:"0 0 "+n+" "+i,preserveAspectRatio:"none"});return{span:Jt.makeSvgSpan([],[l],e),minWidth:0,height:a}}var h,p,d,m=[],g=ze[r],v=g[0],y=g[1],b=g[2],x=b/1e3,w=v.length;if(1===w)h=["hide-tail"],p=[g[3]];else if(2===w)h=["halfarrow-left","halfarrow-right"],p=["xMinYMin","xMaxYMin"];else{if(3!==w)throw new Error("Correct katexImagesData or update code here to support\n "+w+" children.");h=["brace-left","brace-center","brace-right"],p=["xMinYMin","xMidYMin","xMaxYMin"]}for(var k=0;k0&&(r.style.minWidth=i+"em"),r};function We(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function Ue(t){var e=Ve(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function Ve(t){return t&&("atom"===t.type||$.hasOwnProperty(t.type))?t:null}var qe=function(t,e){var n,r,i;t&&"supsub"===t.type?(n=(r=We(t.base,"accent")).base,t.base=n,i=function(t){if(t instanceof I)return t;throw new Error("Expected span but got "+String(t)+".")}(xe(t,e)),t.base=r):n=(r=We(t,"accent")).base;var o=xe(n,e.havingCrampedStyle()),a=0;if(r.isShifty&&f.isCharacterBox(n)){var s=f.getBaseElem(n);a=L(xe(s,e.havingCrampedStyle())).skew}var u,c=Math.min(o.height,e.fontMetrics().xHeight);if(r.isStretchy)u=Le(r,e),u=Jt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"elem",elem:u,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+2*a+"em)",marginLeft:2*a+"em"}:void 0}]},e);else{var l,h;"\\vec"===r.label?(l=Jt.staticSvg("vec",e),h=Jt.svgData.vec[1]):((l=L(l=Jt.makeOrd({mode:r.mode,text:r.label},e,"textord"))).italic=0,h=l.width),u=Jt.makeSpan(["accent-body"],[l]);var p="\\textcircled"===r.label;p&&(u.classes.push("accent-full"),c=o.height);var d=a;p||(d-=h/2),u.style.left=d+"em","\\textcircled"===r.label&&(u.style.top=".2em"),u=Jt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:-c},{type:"elem",elem:u}]},e)}var m=Jt.makeSpan(["mord","accent"],[u],e);return i?(i.children[0]=m,i.height=Math.max(m.height,i.height),i.classes[0]="mord",i):m},He=function(t,e){var n=t.isStretchy?Pe(t.label):new Ae.MathNode("mo",[Oe(t.label,t.mode)]),r=new Ae.MathNode("mover",[Ie(t.base,e),n]);return r.setAttribute("accent","true"),r},Ge=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map((function(t){return"\\"+t})).join("|"));ae({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:function(t,e){var n=e[0],r=!Ge.test(t.funcName),i=!r||"\\widehat"===t.funcName||"\\widetilde"===t.funcName||"\\widecheck"===t.funcName;return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:i,base:n}},htmlBuilder:qe,mathmlBuilder:He}),ae({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!1},handler:function(t,e){var n=e[0];return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:qe,mathmlBuilder:He}),ae({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:function(t,e){var n=t.parser,r=t.funcName,i=e[0];return{type:"accentUnder",mode:n.mode,label:r,base:i}},htmlBuilder:function(t,e){var n=xe(t.base,e),r=Le(t,e),i="\\utilde"===t.label?.12:0,o=Jt.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:n}]},e);return Jt.makeSpan(["mord","accentunder"],[o],e)},mathmlBuilder:function(t,e){var n=Pe(t.label),r=new Ae.MathNode("munder",[Ie(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var $e=function(t){var e=new Ae.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};ae({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium"],props:{numArgs:1,numOptionalArgs:1},handler:function(t,e,n){var r=t.parser,i=t.funcName;return{type:"xArrow",mode:r.mode,label:i,body:e[0],below:n[0]}},htmlBuilder:function(t,e){var n,r=e.style,i=e.havingStyle(r.sup()),o=Jt.wrapFragment(xe(t.body,i,e),e);o.classes.push("x-arrow-pad"),t.below&&(i=e.havingStyle(r.sub()),(n=Jt.wrapFragment(xe(t.below,i,e),e)).classes.push("x-arrow-pad"));var a,s=Le(t,e),u=-e.fontMetrics().axisHeight+.5*s.height,c=-e.fontMetrics().axisHeight-.5*s.height-.111;if((o.depth>.25||"\\xleftequilibrium"===t.label)&&(c-=o.depth),n){var l=-e.fontMetrics().axisHeight+n.height+.5*s.height+.111;a=Jt.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:c},{type:"elem",elem:s,shift:u},{type:"elem",elem:n,shift:l}]},e)}else a=Jt.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:c},{type:"elem",elem:s,shift:u}]},e);return a.children[0].children[0].children[1].classes.push("svg-align"),Jt.makeSpan(["mrel","x-arrow"],[a],e)},mathmlBuilder:function(t,e){var n,r=Pe(t.label);if(t.body){var i=$e(Ie(t.body,e));if(t.below){var o=$e(Ie(t.below,e));n=new Ae.MathNode("munderover",[r,o,i])}else n=new Ae.MathNode("mover",[r,i])}else if(t.below){var a=$e(Ie(t.below,e));n=new Ae.MathNode("munder",[r,a])}else n=$e(),n=new Ae.MathNode("mover",[r,n]);return n}}),ae({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler:function(t,e){for(var n=t.parser,r=We(e[0],"ordgroup").body,i="",o=0;o","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],hn=[0,1.2,1.8,2.4,3],pn=[{type:"small",style:w.SCRIPTSCRIPT},{type:"small",style:w.SCRIPT},{type:"small",style:w.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],dn=[{type:"small",style:w.SCRIPTSCRIPT},{type:"small",style:w.SCRIPT},{type:"small",style:w.TEXT},{type:"stack"}],mn=[{type:"small",style:w.SCRIPTSCRIPT},{type:"small",style:w.SCRIPT},{type:"small",style:w.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],gn=function(t){if("small"===t.type)return"Main-Regular";if("large"===t.type)return"Size"+t.size+"-Regular";if("stack"===t.type)return"Size4-Regular";throw new Error("Add support for delim type '"+t.type+"' here.")},vn=function(t,e,n,r){for(var i=Math.min(2,3-r.style.size);ie)return n[i]}return n[n.length-1]},yn=function(t,e,n,r,i,o){var a;"<"===t||"\\lt"===t||"⟨"===t?t="\\langle":">"!==t&&"\\gt"!==t&&"⟩"!==t||(t="\\rangle"),a=f.contains(fn,t)?pn:f.contains(cn,t)?mn:dn;var s=vn(t,e,a,r);return"small"===s.type?function(t,e,n,r,i,o){var a=Jt.makeSymbol(t,"Main-Regular",i,r),s=tn(a,e,r,o);return n&&en(s,r,e),s}(t,s.style,n,r,i,o):"large"===s.type?nn(t,s.size,n,r,i,o):an(t,e,n,r,i,o)},bn=function(t,e){var n,r,i=e.havingBaseSizing(),o=vn("\\surd",t*i.sizeMultiplier,mn,i),a=i.sizeMultiplier,s=Math.max(0,e.minRuleThickness-e.fontMetrics().sqrtRuleThickness),u=0,c=0,l=0;return"small"===o.type?(t<1?a=1:t<1.4&&(a=.7),c=(1+s)/a,(n=un("sqrtMain",u=(1+s+sn)/a,l=1e3+1e3*s+80,s,e)).style.minWidth="0.853em",r=.833/a):"large"===o.type?(l=1080*hn[o.size],c=(hn[o.size]+s)/a,u=(hn[o.size]+s+sn)/a,(n=un("sqrtSize"+o.size,u,l,s,e)).style.minWidth="1.02em",r=1/a):(u=t+s+sn,c=t+s,l=Math.floor(1e3*t+s)+80,(n=un("sqrtTall",u,l,s,e)).style.minWidth="0.742em",r=1.056),n.height=c,n.style.height=u+"em",{span:n,advanceWidth:r,ruleWidth:(e.fontMetrics().sqrtRuleThickness+s)*a}},xn=function(t,e,n,r,i){if("<"===t||"\\lt"===t||"⟨"===t?t="\\langle":">"!==t&&"\\gt"!==t&&"⟩"!==t||(t="\\rangle"),f.contains(cn,t)||f.contains(fn,t))return nn(t,e,!1,n,r,i);if(f.contains(ln,t))return an(t,hn[e],!1,n,r,i);throw new a("Illegal delimiter: '"+t+"'")},wn=yn,kn=function(t,e,n,r,i,o){var a=r.fontMetrics().axisHeight*r.sizeMultiplier,s=5/r.fontMetrics().ptPerEm,u=Math.max(e-a,n+a),c=Math.max(u/500*901,2*u-s);return yn(t,c,!0,r,i,o)},En={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Cn=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function Sn(t,e){var n=Ve(t);if(n&&f.contains(Cn,n.text))return n;throw new a(n?"Invalid delimiter '"+n.text+"' after '"+e.funcName+"'":"Invalid delimiter type '"+t.type+"'",t)}function An(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}ae({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1},handler:function(t,e){var n=Sn(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:En[t.funcName].size,mclass:En[t.funcName].mclass,delim:n.text}},htmlBuilder:function(t,e){return"."===t.delim?Jt.makeSpan([t.mclass]):xn(t.delim,t.size,e,t.mode,[t.mclass])},mathmlBuilder:function(t){var e=[];"."!==t.delim&&e.push(Oe(t.delim,t.mode));var n=new Ae.MathNode("mo",e);return"mopen"===t.mclass||"mclose"===t.mclass?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n}}),ae({type:"leftright-right",names:["\\right"],props:{numArgs:1},handler:function(t,e){var n=t.parser.gullet.macros.get("\\current@color");if(n&&"string"!=typeof n)throw new a("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:Sn(e[0],t).text,color:n}}}),ae({type:"leftright",names:["\\left"],props:{numArgs:1},handler:function(t,e){var n=Sn(e[0],t),r=t.parser;++r.leftrightDepth;var i=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var o=We(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:i,left:n.text,right:o.delim,rightColor:o.color}},htmlBuilder:function(t,e){An(t);for(var n,r,i=de(t.body,e,!0,["mopen","mclose"]),o=0,a=0,s=!1,u=0;u-1?"mpadded":"menclose",[Ie(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\fcolorbox":case"\\colorbox":if(n=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),"\\fcolorbox"===t.label){var i=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+i+"em solid "+String(t.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike")}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};ae({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,greediness:3,argTypes:["color","text"]},handler:function(t,e,n){var r=t.parser,i=t.funcName,o=We(e[0],"color-token").color,a=e[1];return{type:"enclose",mode:r.mode,label:i,backgroundColor:o,body:a}},htmlBuilder:On,mathmlBuilder:_n}),ae({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,greediness:3,argTypes:["color","color","text"]},handler:function(t,e,n){var r=t.parser,i=t.funcName,o=We(e[0],"color-token").color,a=We(e[1],"color-token").color,s=e[2];return{type:"enclose",mode:r.mode,label:i,backgroundColor:a,borderColor:o,body:s}},htmlBuilder:On,mathmlBuilder:_n}),ae({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:function(t,e){return{type:"enclose",mode:t.parser.mode,label:"\\fbox",body:e[0]}}}),ae({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout"],props:{numArgs:1},handler:function(t,e,n){var r=t.parser,i=t.funcName,o=e[0];return{type:"enclose",mode:r.mode,label:i,body:o}},htmlBuilder:On,mathmlBuilder:_n});var Nn={};function Tn(t){for(var e=t.type,n=t.names,r=t.props,i=t.handler,o=t.htmlBuilder,a=t.mathmlBuilder,s={type:e,numArgs:r.numArgs||0,greediness:1,allowedInText:!1,numOptionalArgs:0,handler:i},u=0;u0&&(b+=.25),c.push({pos:b,isDashed:t[e]})}for(x(o[0]),n=0;n0&&(C<(_+=y)&&(C=_),_=0),t.addJot&&(C+=m),S.height=E,S.depth=C,b+=E,S.pos=b,b+=C+_,u[n]=S,x(o[n+1])}var N,T,D=b/2+e.fontMetrics().axisHeight,I=t.cols||[],R=[];for(r=0,T=0;r=s)){var j=void 0;(r>0||t.hskipBeforeAndAfter)&&0!==(j=f.deflt(F.pregap,p))&&((N=Jt.makeSpan(["arraycolsep"],[])).style.width=j+"em",R.push(N));var P=[];for(n=0;n0){for(var V=Jt.makeLineSpan("hline",e,l),q=Jt.makeLineSpan("hdashline",e,l),H=[{type:"elem",elem:u,shift:0}];c.length>0;){var G=c.pop(),$=G.pos-D;G.isDashed?H.push({type:"elem",elem:q,shift:$}):H.push({type:"elem",elem:V,shift:$})}u=Jt.makeVList({positionType:"individualShift",children:H},e)}return Jt.makeSpan(["mord"],[u],e)},Mn={c:"center ",l:"left ",r:"right "},Bn=function(t,e){var n=new Ae.MathNode("mtable",t.body.map((function(t){return new Ae.MathNode("mtr",t.map((function(t){return new Ae.MathNode("mtd",[Ie(t,e)])})))}))),r=.5===t.arraystretch?.1:.16+t.arraystretch-1+(t.addJot?.09:0);n.setAttribute("rowspacing",r+"em");var i="",o="";if(t.cols&&t.cols.length>0){var a=t.cols,s="",u=!1,c=0,l=a.length;"separator"===a[0].type&&(i+="top ",c=1),"separator"===a[a.length-1].type&&(i+="bottom ",l-=1);for(var f=c;f0?"left ":"",i+=g[g.length-1].length>0?"right ":"";for(var v=1;v0&&l&&(p=1),r[f]={type:"align",align:h,pregap:p,postgap:0}}return i.colSeparationType=l?"align":"alignat",i};Tn({type:"array",names:["array","darray"],props:{numArgs:1},handler:function(t,e){var n=(Ve(e[0])?[e[0]]:We(e[0],"ordgroup").body).map((function(t){var e=Ue(t).text;if(-1!=="lcr".indexOf(e))return{type:"align",align:e};if("|"===e)return{type:"separator",separator:"|"};if(":"===e)return{type:"separator",separator:":"};throw new a("Unknown column alignment: "+e,t)})),r={cols:n,hskipBeforeAndAfter:!0};return In(t.parser,r,Rn(t.envName))},htmlBuilder:Fn,mathmlBuilder:Bn}),Tn({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix"],props:{numArgs:0},handler:function(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName],n=In(t.parser,{hskipBeforeAndAfter:!1},Rn(t.envName));return e?{type:"leftright",mode:t.mode,body:[n],left:e[0],right:e[1],rightColor:void 0}:n},htmlBuilder:Fn,mathmlBuilder:Bn}),Tn({type:"array",names:["smallmatrix"],props:{numArgs:0},handler:function(t){var e=In(t.parser,{arraystretch:.5},"script");return e.colSeparationType="small",e},htmlBuilder:Fn,mathmlBuilder:Bn}),Tn({type:"array",names:["subarray"],props:{numArgs:1},handler:function(t,e){var n=(Ve(e[0])?[e[0]]:We(e[0],"ordgroup").body).map((function(t){var e=Ue(t).text;if(-1!=="lc".indexOf(e))return{type:"align",align:e};throw new a("Unknown column alignment: "+e,t)}));if(n.length>1)throw new a("{subarray} can contain only one column");var r={cols:n,hskipBeforeAndAfter:!1,arraystretch:.5};if((r=In(t.parser,r,"script")).body.length>0&&r.body[0].length>1)throw new a("{subarray} can contain only one column");return r},htmlBuilder:Fn,mathmlBuilder:Bn}),Tn({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler:function(t){var e=In(t.parser,{arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},Rn(t.envName));return{type:"leftright",mode:t.mode,body:[e],left:t.envName.indexOf("r")>-1?".":"\\{",right:t.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:Fn,mathmlBuilder:Bn}),Tn({type:"array",names:["aligned"],props:{numArgs:0},handler:zn,htmlBuilder:Fn,mathmlBuilder:Bn}),Tn({type:"array",names:["gathered"],props:{numArgs:0},handler:function(t){return In(t.parser,{cols:[{type:"align",align:"c"}],addJot:!0},"display")},htmlBuilder:Fn,mathmlBuilder:Bn}),Tn({type:"array",names:["alignedat"],props:{numArgs:1},handler:zn,htmlBuilder:Fn,mathmlBuilder:Bn}),ae({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler:function(t,e){throw new a(t.funcName+" valid only within array environment")}});var jn=Nn;ae({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler:function(t,e){var n=t.parser,r=t.funcName,i=e[0];if("ordgroup"!==i.type)throw new a("Invalid environment name",i);for(var o="",s=0;s=w.SCRIPT.id?n.text():w.DISPLAY:"text"===t&&n.size===w.DISPLAY.size?n=w.TEXT:"script"===t?n=w.SCRIPT:"scriptscript"===t&&(n=w.SCRIPTSCRIPT),n},$n=function(t,e){var n,r=Gn(t.size,e.style),i=r.fracNum(),o=r.fracDen();n=e.havingStyle(i);var a=xe(t.numer,n,e);if(t.continued){var s=8.5/e.fontMetrics().ptPerEm,u=3.5/e.fontMetrics().ptPerEm;a.height=a.height0?3*f:7*f,d=e.fontMetrics().denom1):(l>0?(h=e.fontMetrics().num2,p=f):(h=e.fontMetrics().num3,p=3*f),d=e.fontMetrics().denom2),c){var x=e.fontMetrics().axisHeight;h-a.depth-(x+.5*l)0&&(e="."===(e=t)?null:e),e};ae({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,greediness:6,argTypes:["math","math","size","text","math","math"]},handler:function(t,e){var n,r=t.parser,i=e[4],o=e[5],a="atom"===e[0].type&&"open"===e[0].family?Yn(e[0].text):null,s="atom"===e[1].type&&"close"===e[1].family?Yn(e[1].text):null,u=We(e[2],"size"),c=null;n=!!u.isBlank||(c=u.value).number>0;var l="auto",f=e[3];if("ordgroup"===f.type){if(f.body.length>0){var h=We(f.body[0],"textord");l=Xn[Number(h.text)]}}else f=We(f,"textord"),l=Xn[Number(f.text)];return{type:"genfrac",mode:r.mode,numer:i,denom:o,continued:!1,hasBarLine:n,barSize:c,leftDelim:a,rightDelim:s,size:l}},htmlBuilder:$n,mathmlBuilder:Kn}),ae({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler:function(t,e){var n=t.parser;t.funcName;var r=t.token;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:We(e[0],"size").value,token:r}}}),ae({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:function(t,e){var n=t.parser;t.funcName;var r=e[0],i=function(t){if(!t)throw new Error("Expected non-null, but got "+String(t));return t}(We(e[1],"infix").size),o=e[2],a=i.number>0;return{type:"genfrac",mode:n.mode,numer:r,denom:o,continued:!1,hasBarLine:a,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:$n,mathmlBuilder:Kn});var Jn=function(t,e){var n,r,i=e.style;"supsub"===t.type?(n=t.sup?xe(t.sup,e.havingStyle(i.sup()),e):xe(t.sub,e.havingStyle(i.sub()),e),r=We(t.base,"horizBrace")):r=We(t,"horizBrace");var o,a=xe(r.base,e.havingBaseStyle(w.DISPLAY)),s=Le(r,e);if(r.isOver?(o=Jt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:s}]},e)).children[0].children[0].children[1].classes.push("svg-align"):(o=Jt.makeVList({positionType:"bottom",positionData:a.depth+.1+s.height,children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:a}]},e)).children[0].children[0].children[0].classes.push("svg-align"),n){var u=Jt.makeSpan(["mord",r.isOver?"mover":"munder"],[o],e);o=r.isOver?Jt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:u},{type:"kern",size:.2},{type:"elem",elem:n}]},e):Jt.makeVList({positionType:"bottom",positionData:u.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:u}]},e)}return Jt.makeSpan(["mord",r.isOver?"mover":"munder"],[o],e)};ae({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler:function(t,e){var n=t.parser,r=t.funcName;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:e[0]}},htmlBuilder:Jn,mathmlBuilder:function(t,e){var n=Pe(t.label);return new Ae.MathNode(t.isOver?"mover":"munder",[Ie(t.base,e),n])}}),ae({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:function(t,e){var n=t.parser,r=e[1],i=We(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:n.mode,href:i,body:ue(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:function(t,e){var n=de(t.body,e,!1);return Jt.makeAnchor(t.href,[],n,e)},mathmlBuilder:function(t,e){var n=De(t.body,e);return n instanceof Ce||(n=new Ce("mrow",[n])),n.setAttribute("href",t.href),n}}),ae({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:function(t,e){var n=t.parser,r=We(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var i=[],o=0;o0&&(r=Lt(t.totalheight,e)-n,r=Number(r.toFixed(2)));var i=0;t.width.number>0&&(i=Lt(t.width,e));var o={height:n+r+"em"};i>0&&(o.width=i+"em"),r>0&&(o.verticalAlign=-r+"em");var a=new F(t.src,t.alt,o);return a.height=n,a.depth=r,a},mathmlBuilder:function(t,e){var n=new Ae.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=Lt(t.height,e),i=0;if(t.totalheight.number>0&&(i=(i=Lt(t.totalheight,e)-r).toFixed(2),n.setAttribute("valign","-"+i+"em")),n.setAttribute("height",r+i+"em"),t.width.number>0){var o=Lt(t.width,e);n.setAttribute("width",o+"em")}return n.setAttribute("src",t.src),n}}),ae({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],allowedInText:!0},handler:function(t,e){var n=t.parser,r=t.funcName,i=We(e[0],"size");if(n.settings.strict){var o="m"===r[1],a="mu"===i.value.unit;o?(a||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, not "+i.value.unit+" units"),"math"!==n.mode&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):a&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:i.value}},htmlBuilder:function(t,e){return Jt.makeGlue(t.dimension,e)},mathmlBuilder:function(t,e){var n=Lt(t.dimension,e);return new Ae.SpaceNode(n)}}),ae({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:function(t,e){var n=t.parser,r=t.funcName,i=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:i}},htmlBuilder:function(t,e){var n;"clap"===t.alignment?(n=Jt.makeSpan([],[xe(t.body,e)]),n=Jt.makeSpan(["inner"],[n],e)):n=Jt.makeSpan(["inner"],[xe(t.body,e)]);var r=Jt.makeSpan(["fix"],[]),i=Jt.makeSpan([t.alignment],[n,r],e),o=Jt.makeSpan(["strut"]);return o.style.height=i.height+i.depth+"em",o.style.verticalAlign=-i.depth+"em",i.children.unshift(o),i=Jt.makeSpan(["thinbox"],[i],e),Jt.makeSpan(["mord","vbox"],[i],e)},mathmlBuilder:function(t,e){var n=new Ae.MathNode("mpadded",[Ie(t.body,e)]);if("rlap"!==t.alignment){var r="llap"===t.alignment?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}}),ae({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler:function(t,e){var n=t.funcName,r=t.parser,i=r.mode;r.switchMode("math");var o="\\("===n?"\\)":"$",a=r.parseExpression(!1,o);return r.expect(o),r.switchMode(i),{type:"styling",mode:r.mode,style:"text",body:a}}}),ae({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler:function(t,e){throw new a("Mismatched "+t.funcName)}});var Qn=function(t,e){switch(e.style.size){case w.DISPLAY.size:return t.display;case w.TEXT.size:return t.text;case w.SCRIPT.size:return t.script;case w.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};ae({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4},handler:function(t,e){return{type:"mathchoice",mode:t.parser.mode,display:ue(e[0]),text:ue(e[1]),script:ue(e[2]),scriptscript:ue(e[3])}},htmlBuilder:function(t,e){var n=Qn(t,e),r=de(n,e,!1);return Jt.makeFragment(r)},mathmlBuilder:function(t,e){var n=Qn(t,e);return De(n,e)}});var tr=function(t,e,n,r,i,o,a){var s,u,c;if(t=Jt.makeSpan([],[t]),e){var l=xe(e,r.havingStyle(i.sup()),r);u={elem:l,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-l.depth)}}if(n){var f=xe(n,r.havingStyle(i.sub()),r);s={elem:f,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-f.height)}}if(u&&s){var h=r.fontMetrics().bigOpSpacing5+s.elem.height+s.elem.depth+s.kern+t.depth+a;c=Jt.makeVList({positionType:"bottom",positionData:h,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:-o+"em"},{type:"kern",size:s.kern},{type:"elem",elem:t},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:o+"em"},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(s){var p=t.height-a;c=Jt.makeVList({positionType:"top",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:-o+"em"},{type:"kern",size:s.kern},{type:"elem",elem:t}]},r)}else{if(!u)return t;var d=t.depth+a;c=Jt.makeVList({positionType:"bottom",positionData:d,children:[{type:"elem",elem:t},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:o+"em"},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}return Jt.makeSpan(["mop","op-limits"],[c],r)},er=["\\smallint"],nr=function(t,e){var n,r,i,o=!1;"supsub"===t.type?(n=t.sup,r=t.sub,i=We(t.base,"op"),o=!0):i=We(t,"op");var a,s=e.style,u=!1;if(s.size===w.DISPLAY.size&&i.symbol&&!f.contains(er,i.name)&&(u=!0),i.symbol){var c=u?"Size2-Regular":"Size1-Regular",l="";if("\\oiint"!==i.name&&"\\oiiint"!==i.name||(l=i.name.substr(1),i.name="oiint"===l?"\\iint":"\\iiint"),a=Jt.makeSymbol(i.name,c,"math",e,["mop","op-symbol",u?"large-op":"small-op"]),l.length>0){var h=a.italic,p=Jt.staticSvg(l+"Size"+(u?"2":"1"),e);a=Jt.makeVList({positionType:"individualShift",children:[{type:"elem",elem:a,shift:0},{type:"elem",elem:p,shift:u?.08:0}]},e),i.name="\\"+l,a.classes.unshift("mop"),a.italic=h}}else if(i.body){var d=de(i.body,e,!0);1===d.length&&d[0]instanceof B?(a=d[0]).classes[0]="mop":a=Jt.makeSpan(["mop"],Jt.tryCombineChars(d),e)}else{for(var m=[],g=1;g0){for(var s=i.body.map((function(t){var e=t.text;return"string"==typeof e?{type:"textord",mode:t.mode,text:e}:t})),u=de(s,e.withFont("mathrm"),!0),c=0;c=0?s.setAttribute("height","+"+i+"em"):(s.setAttribute("height",i+"em"),s.setAttribute("depth","+"+-i+"em")),s.setAttribute("voffset",i+"em"),s}});var ur=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];ae({type:"sizing",names:ur,props:{numArgs:0,allowedInText:!0},handler:function(t,e){var n=t.breakOnTokenText,r=t.funcName,i=t.parser,o=i.parseExpression(!1,n);return{type:"sizing",mode:i.mode,size:ur.indexOf(r)+1,body:o}},htmlBuilder:function(t,e){var n=e.havingSize(t.size);return sr(t.body,n,e)},mathmlBuilder:function(t,e){var n=e.havingSize(t.size),r=Te(t.body,n),i=new Ae.MathNode("mstyle",r);return i.setAttribute("mathsize",n.sizeMultiplier+"em"),i}}),ae({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:function(t,e,n){var r=t.parser,i=!1,o=!1,a=n[0]&&We(n[0],"ordgroup");if(a)for(var s="",u=0;un.height+n.depth+o&&(o=(o+f-n.height-n.depth)/2);var h=u.height-n.height-o-c;n.style.paddingLeft=l+"em";var p=Jt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+h)},{type:"elem",elem:u},{type:"kern",size:c}]},e);if(t.index){var d=e.havingStyle(w.SCRIPTSCRIPT),m=xe(t.index,d,e),g=.6*(p.height-p.depth),v=Jt.makeVList({positionType:"shift",positionData:-g,children:[{type:"elem",elem:m}]},e),y=Jt.makeSpan(["root"],[v]);return Jt.makeSpan(["mord","sqrt"],[y,p],e)}return Jt.makeSpan(["mord","sqrt"],[p],e)},mathmlBuilder:function(t,e){var n=t.body,r=t.index;return r?new Ae.MathNode("mroot",[Ie(n,e),Ie(r,e)]):new Ae.MathNode("msqrt",[Ie(n,e)])}});var cr={display:w.DISPLAY,text:w.TEXT,script:w.SCRIPT,scriptscript:w.SCRIPTSCRIPT};ae({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0},handler:function(t,e){var n=t.breakOnTokenText,r=t.funcName,i=t.parser,o=i.parseExpression(!0,n),a=r.slice(1,r.length-5);return{type:"styling",mode:i.mode,style:a,body:o}},htmlBuilder:function(t,e){var n=cr[t.style],r=e.havingStyle(n).withFont("");return sr(t.body,r,e)},mathmlBuilder:function(t,e){var n=cr[t.style],r=e.havingStyle(n),i=Te(t.body,r),o=new Ae.MathNode("mstyle",i),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]}[t.style];return o.setAttribute("scriptlevel",a[0]),o.setAttribute("displaystyle",a[1]),o}}),se({type:"supsub",htmlBuilder:function(t,e){var n=function(t,e){var n=t.base;return n?"op"===n.type?n.limits&&(e.style.size===w.DISPLAY.size||n.alwaysHandleSupSub)?nr:null:"operatorname"===n.type?n.alwaysHandleSupSub&&(e.style.size===w.DISPLAY.size||n.limits)?ar:null:"accent"===n.type?f.isCharacterBox(n.base)?qe:null:"horizBrace"===n.type&&!t.sub===n.isOver?Jn:null:null}(t,e);if(n)return n(t,e);var r,i,o,a=t.base,s=t.sup,u=t.sub,c=xe(a,e),l=e.fontMetrics(),h=0,p=0,d=a&&f.isCharacterBox(a);if(s){var m=e.havingStyle(e.style.sup());r=xe(s,m,e),d||(h=c.height-m.fontMetrics().supDrop*m.sizeMultiplier/e.sizeMultiplier)}if(u){var g=e.havingStyle(e.style.sub());i=xe(u,g,e),d||(p=c.depth+g.fontMetrics().subDrop*g.sizeMultiplier/e.sizeMultiplier)}o=e.style===w.DISPLAY?l.sup1:e.style.cramped?l.sup3:l.sup2;var v,y=e.sizeMultiplier,b=.5/l.ptPerEm/y+"em",x=null;if(i){var k=t.base&&"op"===t.base.type&&t.base.name&&("\\oiint"===t.base.name||"\\oiiint"===t.base.name);(c instanceof B||k)&&(x=-c.italic+"em")}if(r&&i){h=Math.max(h,o,r.depth+.25*l.xHeight),p=Math.max(p,l.sub2);var E=4*l.defaultRuleThickness;if(h-r.depth-(i.height-p)0&&(h+=C,p-=C)}var S=[{type:"elem",elem:i,shift:p,marginRight:b,marginLeft:x},{type:"elem",elem:r,shift:-h,marginRight:b}];v=Jt.makeVList({positionType:"individualShift",children:S},e)}else if(i){p=Math.max(p,l.sub1,i.height-.8*l.xHeight);var A=[{type:"elem",elem:i,marginLeft:x,marginRight:b}];v=Jt.makeVList({positionType:"shift",positionData:p,children:A},e)}else{if(!r)throw new Error("supsub must have either sup or sub.");h=Math.max(h,o,r.depth+.25*l.xHeight),v=Jt.makeVList({positionType:"shift",positionData:-h,children:[{type:"elem",elem:r,marginRight:b}]},e)}var O=ye(c,"right")||"mord";return Jt.makeSpan([O],[c,Jt.makeSpan(["msupsub"],[v])],e)},mathmlBuilder:function(t,e){var n,r=!1;t.base&&"horizBrace"===t.base.type&&!!t.sup===t.base.isOver&&(r=!0,n=t.base.isOver),!t.base||"op"!==t.base.type&&"operatorname"!==t.base.type||(t.base.parentIsSupSub=!0);var i,o=[Ie(t.base,e)];if(t.sub&&o.push(Ie(t.sub,e)),t.sup&&o.push(Ie(t.sup,e)),r)i=n?"mover":"munder";else if(t.sub)if(t.sup){var a=t.base;i=a&&"op"===a.type&&a.limits&&e.style===w.DISPLAY||a&&"operatorname"===a.type&&a.alwaysHandleSupSub&&(e.style===w.DISPLAY||a.limits)?"munderover":"msubsup"}else{var s=t.base;i=s&&"op"===s.type&&s.limits&&(e.style===w.DISPLAY||s.alwaysHandleSupSub)||s&&"operatorname"===s.type&&s.alwaysHandleSupSub&&(s.limits||e.style===w.DISPLAY)?"munder":"msub"}else{var u=t.base;i=u&&"op"===u.type&&u.limits&&(e.style===w.DISPLAY||u.alwaysHandleSupSub)||u&&"operatorname"===u.type&&u.alwaysHandleSupSub&&(u.limits||e.style===w.DISPLAY)?"mover":"msup"}return new Ae.MathNode(i,o)}}),se({type:"atom",htmlBuilder:function(t,e){return Jt.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder:function(t,e){var n=new Ae.MathNode("mo",[Oe(t.text,t.mode)]);if("bin"===t.family){var r=Ne(t,e);"bold-italic"===r&&n.setAttribute("mathvariant",r)}else"punct"===t.family?n.setAttribute("separator","true"):"open"!==t.family&&"close"!==t.family||n.setAttribute("stretchy","false");return n}});var lr={mi:"italic",mn:"normal",mtext:"normal"};se({type:"mathord",htmlBuilder:function(t,e){return Jt.makeOrd(t,e,"mathord")},mathmlBuilder:function(t,e){var n=new Ae.MathNode("mi",[Oe(t.text,t.mode,e)]),r=Ne(t,e)||"italic";return r!==lr[n.type]&&n.setAttribute("mathvariant",r),n}}),se({type:"textord",htmlBuilder:function(t,e){return Jt.makeOrd(t,e,"textord")},mathmlBuilder:function(t,e){var n,r=Oe(t.text,t.mode,e),i=Ne(t,e)||"normal";return n="text"===t.mode?new Ae.MathNode("mtext",[r]):/[0-9]/.test(t.text)?new Ae.MathNode("mn",[r]):"\\prime"===t.text?new Ae.MathNode("mo",[r]):new Ae.MathNode("mi",[r]),i!==lr[n.type]&&n.setAttribute("mathvariant",i),n}});var fr={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},hr={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};se({type:"spacing",htmlBuilder:function(t,e){if(hr.hasOwnProperty(t.text)){var n=hr[t.text].className||"";if("text"===t.mode){var r=Jt.makeOrd(t,e,"textord");return r.classes.push(n),r}return Jt.makeSpan(["mspace",n],[Jt.mathsym(t.text,t.mode,e)],e)}if(fr.hasOwnProperty(t.text))return Jt.makeSpan(["mspace",fr[t.text]],[],e);throw new a('Unknown type of space "'+t.text+'"')},mathmlBuilder:function(t,e){if(!hr.hasOwnProperty(t.text)){if(fr.hasOwnProperty(t.text))return new Ae.MathNode("mspace");throw new a('Unknown type of space "'+t.text+'"')}return new Ae.MathNode("mtext",[new Ae.TextNode(" ")])}});var pr=function(){var t=new Ae.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};se({type:"tag",mathmlBuilder:function(t,e){var n=new Ae.MathNode("mtable",[new Ae.MathNode("mtr",[pr(),new Ae.MathNode("mtd",[De(t.body,e)]),pr(),new Ae.MathNode("mtd",[De(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var dr={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},mr={"\\textbf":"textbf","\\textmd":"textmd"},gr={"\\textit":"textit","\\textup":"textup"},vr=function(t,e){var n=t.font;return n?dr[n]?e.withTextFontFamily(dr[n]):mr[n]?e.withTextFontWeight(mr[n]):e.withTextFontShape(gr[n]):e};ae({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup"],props:{numArgs:1,argTypes:["text"],greediness:2,allowedInText:!0},handler:function(t,e){var n=t.parser,r=t.funcName,i=e[0];return{type:"text",mode:n.mode,body:ue(i),font:r}},htmlBuilder:function(t,e){var n=vr(t,e),r=de(t.body,n,!0);return Jt.makeSpan(["mord","text"],Jt.tryCombineChars(r),n)},mathmlBuilder:function(t,e){var n=vr(t,e);return De(t.body,n)}}),ae({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler:function(t,e){return{type:"underline",mode:t.parser.mode,body:e[0]}},htmlBuilder:function(t,e){var n=xe(t.body,e),r=Jt.makeLineSpan("underline-line",e),i=e.fontMetrics().defaultRuleThickness,o=Jt.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:i},{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n}]},e);return Jt.makeSpan(["mord","underline"],[o],e)},mathmlBuilder:function(t,e){var n=new Ae.MathNode("mo",[new Ae.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Ae.MathNode("munder",[Ie(t.body,e),n]);return r.setAttribute("accentunder","true"),r}}),ae({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler:function(t,e,n){throw new a("\\verb ended by end of line instead of matching delimiter")},htmlBuilder:function(t,e){for(var n=yr(t),r=[],i=e.havingStyle(e.style.text()),o=0;o0&&(this.undefStack[this.undefStack.length-1][t]=e)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(t)&&(i[t]=this.current[t])}this.current[t]=e},t}(),Nr={},Tr=Nr;function Dr(t,e){Nr[t]=e}Dr("\\noexpand",(function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}})),Dr("\\expandafter",(function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}})),Dr("\\@firstoftwo",(function(t){return{tokens:t.consumeArgs(2)[0],numArgs:0}})),Dr("\\@secondoftwo",(function(t){return{tokens:t.consumeArgs(2)[1],numArgs:0}})),Dr("\\@ifnextchar",(function(t){var e=t.consumeArgs(3);t.consumeSpaces();var n=t.future();return 1===e[0].length&&e[0][0].text===n.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}})),Dr("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),Dr("\\TextOrMath",(function(t){var e=t.consumeArgs(2);return"text"===t.mode?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}}));var Ir={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Dr("\\char",(function(t){var e,n=t.popToken(),r="";if("'"===n.text)e=8,n=t.popToken();else if('"'===n.text)e=16,n=t.popToken();else if("`"===n.text)if("\\"===(n=t.popToken()).text[0])r=n.text.charCodeAt(1);else{if("EOF"===n.text)throw new a("\\char` missing argument");r=n.text.charCodeAt(0)}else e=10;if(e){if(null==(r=Ir[n.text])||r>=e)throw new a("Invalid base-"+e+" digit "+n.text);for(var i;null!=(i=Ir[t.future().text])&&i":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};Dr("\\dots",(function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in Fr?e=Fr[n]:("\\not"===n.substr(0,4)||n in X.math&&f.contains(["bin","rel"],X.math[n].group))&&(e="\\dotsb"),e}));var Mr={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Dr("\\dotso",(function(t){return t.future().text in Mr?"\\ldots\\,":"\\ldots"})),Dr("\\dotsc",(function(t){var e=t.future().text;return e in Mr&&","!==e?"\\ldots\\,":"\\ldots"})),Dr("\\cdots",(function(t){return t.future().text in Mr?"\\@cdots\\,":"\\@cdots"})),Dr("\\dotsb","\\cdots"),Dr("\\dotsm","\\cdots"),Dr("\\dotsi","\\!\\cdots"),Dr("\\dotsx","\\ldots\\,"),Dr("\\DOTSI","\\relax"),Dr("\\DOTSB","\\relax"),Dr("\\DOTSX","\\relax"),Dr("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),Dr("\\,","\\tmspace+{3mu}{.1667em}"),Dr("\\thinspace","\\,"),Dr("\\>","\\mskip{4mu}"),Dr("\\:","\\tmspace+{4mu}{.2222em}"),Dr("\\medspace","\\:"),Dr("\\;","\\tmspace+{5mu}{.2777em}"),Dr("\\thickspace","\\;"),Dr("\\!","\\tmspace-{3mu}{.1667em}"),Dr("\\negthinspace","\\!"),Dr("\\negmedspace","\\tmspace-{4mu}{.2222em}"),Dr("\\negthickspace","\\tmspace-{5mu}{.277em}"),Dr("\\enspace","\\kern.5em "),Dr("\\enskip","\\hskip.5em\\relax"),Dr("\\quad","\\hskip1em\\relax"),Dr("\\qquad","\\hskip2em\\relax"),Dr("\\tag","\\@ifstar\\tag@literal\\tag@paren"),Dr("\\tag@paren","\\tag@literal{({#1})}"),Dr("\\tag@literal",(function(t){if(t.macros.get("\\df@tag"))throw new a("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"})),Dr("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),Dr("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),Dr("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),Dr("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),Dr("\\pmb","\\html@mathml{\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}{\\mathbf{#1}}"),Dr("\\\\","\\newline"),Dr("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Br=W["Main-Regular"]["T".charCodeAt(0)][1]-.7*W["Main-Regular"]["A".charCodeAt(0)][1]+"em";Dr("\\LaTeX","\\textrm{\\html@mathml{L\\kern-.36em\\raisebox{"+Br+"}{\\scriptstyle A}\\kern-.15em\\TeX}{LaTeX}}"),Dr("\\KaTeX","\\textrm{\\html@mathml{K\\kern-.17em\\raisebox{"+Br+"}{\\scriptstyle A}\\kern-.15em\\TeX}{KaTeX}}"),Dr("\\hspace","\\@ifstar\\@hspacer\\@hspace"),Dr("\\@hspace","\\hskip #1\\relax"),Dr("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),Dr("\\ordinarycolon",":"),Dr("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),Dr("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),Dr("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),Dr("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),Dr("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),Dr("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),Dr("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),Dr("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),Dr("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),Dr("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),Dr("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),Dr("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),Dr("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),Dr("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),Dr("∷","\\dblcolon"),Dr("∹","\\eqcolon"),Dr("≔","\\coloneqq"),Dr("≕","\\eqqcolon"),Dr("⩴","\\Coloneqq"),Dr("\\ratio","\\vcentcolon"),Dr("\\coloncolon","\\dblcolon"),Dr("\\colonequals","\\coloneqq"),Dr("\\coloncolonequals","\\Coloneqq"),Dr("\\equalscolon","\\eqqcolon"),Dr("\\equalscoloncolon","\\Eqqcolon"),Dr("\\colonminus","\\coloneq"),Dr("\\coloncolonminus","\\Coloneq"),Dr("\\minuscolon","\\eqcolon"),Dr("\\minuscoloncolon","\\Eqcolon"),Dr("\\coloncolonapprox","\\Colonapprox"),Dr("\\coloncolonsim","\\Colonsim"),Dr("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),Dr("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),Dr("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),Dr("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),Dr("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}"),Dr("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),Dr("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),Dr("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}"),Dr("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}"),Dr("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}"),Dr("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}"),Dr("\\nleqq","\\html@mathml{\\@nleqq}{≰}"),Dr("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}"),Dr("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}"),Dr("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}"),Dr("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}"),Dr("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}"),Dr("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}"),Dr("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}"),Dr("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}"),Dr("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}"),Dr("\\imath","\\html@mathml{\\@imath}{ı}"),Dr("\\jmath","\\html@mathml{\\@jmath}{ȷ}"),Dr("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}"),Dr("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}"),Dr("⟦","\\llbracket"),Dr("⟧","\\rrbracket"),Dr("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}"),Dr("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}"),Dr("⦃","\\lBrace"),Dr("⦄","\\rBrace"),Dr("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"),Dr("⦵","\\minuso"),Dr("\\darr","\\downarrow"),Dr("\\dArr","\\Downarrow"),Dr("\\Darr","\\Downarrow"),Dr("\\lang","\\langle"),Dr("\\rang","\\rangle"),Dr("\\uarr","\\uparrow"),Dr("\\uArr","\\Uparrow"),Dr("\\Uarr","\\Uparrow"),Dr("\\N","\\mathbb{N}"),Dr("\\R","\\mathbb{R}"),Dr("\\Z","\\mathbb{Z}"),Dr("\\alef","\\aleph"),Dr("\\alefsym","\\aleph"),Dr("\\Alpha","\\mathrm{A}"),Dr("\\Beta","\\mathrm{B}"),Dr("\\bull","\\bullet"),Dr("\\Chi","\\mathrm{X}"),Dr("\\clubs","\\clubsuit"),Dr("\\cnums","\\mathbb{C}"),Dr("\\Complex","\\mathbb{C}"),Dr("\\Dagger","\\ddagger"),Dr("\\diamonds","\\diamondsuit"),Dr("\\empty","\\emptyset"),Dr("\\Epsilon","\\mathrm{E}"),Dr("\\Eta","\\mathrm{H}"),Dr("\\exist","\\exists"),Dr("\\harr","\\leftrightarrow"),Dr("\\hArr","\\Leftrightarrow"),Dr("\\Harr","\\Leftrightarrow"),Dr("\\hearts","\\heartsuit"),Dr("\\image","\\Im"),Dr("\\infin","\\infty"),Dr("\\Iota","\\mathrm{I}"),Dr("\\isin","\\in"),Dr("\\Kappa","\\mathrm{K}"),Dr("\\larr","\\leftarrow"),Dr("\\lArr","\\Leftarrow"),Dr("\\Larr","\\Leftarrow"),Dr("\\lrarr","\\leftrightarrow"),Dr("\\lrArr","\\Leftrightarrow"),Dr("\\Lrarr","\\Leftrightarrow"),Dr("\\Mu","\\mathrm{M}"),Dr("\\natnums","\\mathbb{N}"),Dr("\\Nu","\\mathrm{N}"),Dr("\\Omicron","\\mathrm{O}"),Dr("\\plusmn","\\pm"),Dr("\\rarr","\\rightarrow"),Dr("\\rArr","\\Rightarrow"),Dr("\\Rarr","\\Rightarrow"),Dr("\\real","\\Re"),Dr("\\reals","\\mathbb{R}"),Dr("\\Reals","\\mathbb{R}"),Dr("\\Rho","\\mathrm{P}"),Dr("\\sdot","\\cdot"),Dr("\\sect","\\S"),Dr("\\spades","\\spadesuit"),Dr("\\sub","\\subset"),Dr("\\sube","\\subseteq"),Dr("\\supe","\\supseteq"),Dr("\\Tau","\\mathrm{T}"),Dr("\\thetasym","\\vartheta"),Dr("\\weierp","\\wp"),Dr("\\Zeta","\\mathrm{Z}"),Dr("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),Dr("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),Dr("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),Dr("\\bra","\\mathinner{\\langle{#1}|}"),Dr("\\ket","\\mathinner{|{#1}\\rangle}"),Dr("\\braket","\\mathinner{\\langle{#1}\\rangle}"),Dr("\\Bra","\\left\\langle#1\\right|"),Dr("\\Ket","\\left|#1\\right\\rangle"),Dr("\\blue","\\textcolor{##6495ed}{#1}"),Dr("\\orange","\\textcolor{##ffa500}{#1}"),Dr("\\pink","\\textcolor{##ff00af}{#1}"),Dr("\\red","\\textcolor{##df0030}{#1}"),Dr("\\green","\\textcolor{##28ae7b}{#1}"),Dr("\\gray","\\textcolor{gray}{#1}"),Dr("\\purple","\\textcolor{##9d38bd}{#1}"),Dr("\\blueA","\\textcolor{##ccfaff}{#1}"),Dr("\\blueB","\\textcolor{##80f6ff}{#1}"),Dr("\\blueC","\\textcolor{##63d9ea}{#1}"),Dr("\\blueD","\\textcolor{##11accd}{#1}"),Dr("\\blueE","\\textcolor{##0c7f99}{#1}"),Dr("\\tealA","\\textcolor{##94fff5}{#1}"),Dr("\\tealB","\\textcolor{##26edd5}{#1}"),Dr("\\tealC","\\textcolor{##01d1c1}{#1}"),Dr("\\tealD","\\textcolor{##01a995}{#1}"),Dr("\\tealE","\\textcolor{##208170}{#1}"),Dr("\\greenA","\\textcolor{##b6ffb0}{#1}"),Dr("\\greenB","\\textcolor{##8af281}{#1}"),Dr("\\greenC","\\textcolor{##74cf70}{#1}"),Dr("\\greenD","\\textcolor{##1fab54}{#1}"),Dr("\\greenE","\\textcolor{##0d923f}{#1}"),Dr("\\goldA","\\textcolor{##ffd0a9}{#1}"),Dr("\\goldB","\\textcolor{##ffbb71}{#1}"),Dr("\\goldC","\\textcolor{##ff9c39}{#1}"),Dr("\\goldD","\\textcolor{##e07d10}{#1}"),Dr("\\goldE","\\textcolor{##a75a05}{#1}"),Dr("\\redA","\\textcolor{##fca9a9}{#1}"),Dr("\\redB","\\textcolor{##ff8482}{#1}"),Dr("\\redC","\\textcolor{##f9685d}{#1}"),Dr("\\redD","\\textcolor{##e84d39}{#1}"),Dr("\\redE","\\textcolor{##bc2612}{#1}"),Dr("\\maroonA","\\textcolor{##ffbde0}{#1}"),Dr("\\maroonB","\\textcolor{##ff92c6}{#1}"),Dr("\\maroonC","\\textcolor{##ed5fa6}{#1}"),Dr("\\maroonD","\\textcolor{##ca337c}{#1}"),Dr("\\maroonE","\\textcolor{##9e034e}{#1}"),Dr("\\purpleA","\\textcolor{##ddd7ff}{#1}"),Dr("\\purpleB","\\textcolor{##c6b9fc}{#1}"),Dr("\\purpleC","\\textcolor{##aa87ff}{#1}"),Dr("\\purpleD","\\textcolor{##7854ab}{#1}"),Dr("\\purpleE","\\textcolor{##543b78}{#1}"),Dr("\\mintA","\\textcolor{##f5f9e8}{#1}"),Dr("\\mintB","\\textcolor{##edf2df}{#1}"),Dr("\\mintC","\\textcolor{##e0e5cc}{#1}"),Dr("\\grayA","\\textcolor{##f6f7f7}{#1}"),Dr("\\grayB","\\textcolor{##f0f1f2}{#1}"),Dr("\\grayC","\\textcolor{##e3e5e6}{#1}"),Dr("\\grayD","\\textcolor{##d6d8da}{#1}"),Dr("\\grayE","\\textcolor{##babec2}{#1}"),Dr("\\grayF","\\textcolor{##888d93}{#1}"),Dr("\\grayG","\\textcolor{##626569}{#1}"),Dr("\\grayH","\\textcolor{##3b3e40}{#1}"),Dr("\\grayI","\\textcolor{##21242c}{#1}"),Dr("\\kaBlue","\\textcolor{##314453}{#1}"),Dr("\\kaGreen","\\textcolor{##71B307}{#1}");var zr={"\\relax":!0,"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},jr=function(){function t(t,e,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=e,this.expansionCount=0,this.feed(t),this.macros=new _r(Tr,e.macros),this.mode=n,this.stack=[]}var e=t.prototype;return e.feed=function(t){this.lexer=new Or(t,this.settings)},e.switchMode=function(t){this.mode=t},e.beginGroup=function(){this.macros.beginGroup()},e.endGroup=function(){this.macros.endGroup()},e.future=function(){return 0===this.stack.length&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]},e.popToken=function(){return this.future(),this.stack.pop()},e.pushToken=function(t){this.stack.push(t)},e.pushTokens=function(t){var e;(e=this.stack).push.apply(e,t)},e.consumeSpaces=function(){for(;" "===this.future().text;)this.stack.pop()},e.consumeArgs=function(t){for(var e=[],n=0;nthis.settings.maxExpand)throw new a("Too many expansions: infinite loop or need to increase maxExpand setting");var i=r.tokens;if(r.numArgs)for(var o=this.consumeArgs(r.numArgs),s=(i=i.slice()).length-1;s>=0;--s){var u=i[s];if("#"===u.text){if(0===s)throw new a("Incomplete placeholder at end of macro body",u);if("#"===(u=i[--s]).text)i.splice(s+1,1);else{if(!/^[1-9]$/.test(u.text))throw new a("Not a valid argument number",u);var c;(c=i).splice.apply(c,[s,2].concat(o[+u.text-1]))}}}return this.pushTokens(i),i},e.expandAfterFuture=function(){return this.expandOnce(),this.future()},e.expandNextToken=function(){for(;;){var t=this.expandOnce();if(t instanceof i){if("\\relax"!==t.text&&!t.treatAsRelax)return this.stack.pop();this.stack.pop()}}throw new Error},e.expandMacro=function(t){return this.macros.has(t)?this.expandTokens([new i(t)]):void 0},e.expandTokens=function(t){var e=[],n=this.stack.length;for(this.pushTokens(t);this.stack.length>n;){var r=this.expandOnce(!0);r instanceof i&&(r.treatAsRelax&&(r.noexpand=!1,r.treatAsRelax=!1),e.push(this.stack.pop()))}return e},e.expandMacroAsText=function(t){var e=this.expandMacro(t);return e?e.map((function(t){return t.text})).join(""):e},e._getExpansion=function(t){var e=this.macros.get(t);if(null==e)return e;var n="function"==typeof e?e(this):e;if("string"==typeof n){var r=0;if(-1!==n.indexOf("#"))for(var i=n.replace(/##/g,"");-1!==i.indexOf("#"+(r+1));)++r;for(var o=new Or(n,this.settings),a=[],s=o.lex();"EOF"!==s.text;)a.push(s),s=o.lex();return a.reverse(),{tokens:a,numArgs:r}}return n},e.isDefined=function(t){return this.macros.has(t)||br.hasOwnProperty(t)||X.math.hasOwnProperty(t)||X.text.hasOwnProperty(t)||zr.hasOwnProperty(t)},e.isExpandable=function(t){var e=this.macros.get(t);return null!=e?"string"==typeof e||"function"==typeof e||!e.unexpandable:br.hasOwnProperty(t)},t}(),Pr={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"}},Lr={"á":"á","à":"à","ä":"ä","ǟ":"ǟ","ã":"ã","ā":"ā","ă":"ă","ắ":"ắ","ằ":"ằ","ẵ":"ẵ","ǎ":"ǎ","â":"â","ấ":"ấ","ầ":"ầ","ẫ":"ẫ","ȧ":"ȧ","ǡ":"ǡ","å":"å","ǻ":"ǻ","ḃ":"ḃ","ć":"ć","č":"č","ĉ":"ĉ","ċ":"ċ","ď":"ď","ḋ":"ḋ","é":"é","è":"è","ë":"ë","ẽ":"ẽ","ē":"ē","ḗ":"ḗ","ḕ":"ḕ","ĕ":"ĕ","ě":"ě","ê":"ê","ế":"ế","ề":"ề","ễ":"ễ","ė":"ė","ḟ":"ḟ","ǵ":"ǵ","ḡ":"ḡ","ğ":"ğ","ǧ":"ǧ","ĝ":"ĝ","ġ":"ġ","ḧ":"ḧ","ȟ":"ȟ","ĥ":"ĥ","ḣ":"ḣ","í":"í","ì":"ì","ï":"ï","ḯ":"ḯ","ĩ":"ĩ","ī":"ī","ĭ":"ĭ","ǐ":"ǐ","î":"î","ǰ":"ǰ","ĵ":"ĵ","ḱ":"ḱ","ǩ":"ǩ","ĺ":"ĺ","ľ":"ľ","ḿ":"ḿ","ṁ":"ṁ","ń":"ń","ǹ":"ǹ","ñ":"ñ","ň":"ň","ṅ":"ṅ","ó":"ó","ò":"ò","ö":"ö","ȫ":"ȫ","õ":"õ","ṍ":"ṍ","ṏ":"ṏ","ȭ":"ȭ","ō":"ō","ṓ":"ṓ","ṑ":"ṑ","ŏ":"ŏ","ǒ":"ǒ","ô":"ô","ố":"ố","ồ":"ồ","ỗ":"ỗ","ȯ":"ȯ","ȱ":"ȱ","ő":"ő","ṕ":"ṕ","ṗ":"ṗ","ŕ":"ŕ","ř":"ř","ṙ":"ṙ","ś":"ś","ṥ":"ṥ","š":"š","ṧ":"ṧ","ŝ":"ŝ","ṡ":"ṡ","ẗ":"ẗ","ť":"ť","ṫ":"ṫ","ú":"ú","ù":"ù","ü":"ü","ǘ":"ǘ","ǜ":"ǜ","ǖ":"ǖ","ǚ":"ǚ","ũ":"ũ","ṹ":"ṹ","ū":"ū","ṻ":"ṻ","ŭ":"ŭ","ǔ":"ǔ","û":"û","ů":"ů","ű":"ű","ṽ":"ṽ","ẃ":"ẃ","ẁ":"ẁ","ẅ":"ẅ","ŵ":"ŵ","ẇ":"ẇ","ẘ":"ẘ","ẍ":"ẍ","ẋ":"ẋ","ý":"ý","ỳ":"ỳ","ÿ":"ÿ","ỹ":"ỹ","ȳ":"ȳ","ŷ":"ŷ","ẏ":"ẏ","ẙ":"ẙ","ź":"ź","ž":"ž","ẑ":"ẑ","ż":"ż","Á":"Á","À":"À","Ä":"Ä","Ǟ":"Ǟ","Ã":"Ã","Ā":"Ā","Ă":"Ă","Ắ":"Ắ","Ằ":"Ằ","Ẵ":"Ẵ","Ǎ":"Ǎ","Â":"Â","Ấ":"Ấ","Ầ":"Ầ","Ẫ":"Ẫ","Ȧ":"Ȧ","Ǡ":"Ǡ","Å":"Å","Ǻ":"Ǻ","Ḃ":"Ḃ","Ć":"Ć","Č":"Č","Ĉ":"Ĉ","Ċ":"Ċ","Ď":"Ď","Ḋ":"Ḋ","É":"É","È":"È","Ë":"Ë","Ẽ":"Ẽ","Ē":"Ē","Ḗ":"Ḗ","Ḕ":"Ḕ","Ĕ":"Ĕ","Ě":"Ě","Ê":"Ê","Ế":"Ế","Ề":"Ề","Ễ":"Ễ","Ė":"Ė","Ḟ":"Ḟ","Ǵ":"Ǵ","Ḡ":"Ḡ","Ğ":"Ğ","Ǧ":"Ǧ","Ĝ":"Ĝ","Ġ":"Ġ","Ḧ":"Ḧ","Ȟ":"Ȟ","Ĥ":"Ĥ","Ḣ":"Ḣ","Í":"Í","Ì":"Ì","Ï":"Ï","Ḯ":"Ḯ","Ĩ":"Ĩ","Ī":"Ī","Ĭ":"Ĭ","Ǐ":"Ǐ","Î":"Î","İ":"İ","Ĵ":"Ĵ","Ḱ":"Ḱ","Ǩ":"Ǩ","Ĺ":"Ĺ","Ľ":"Ľ","Ḿ":"Ḿ","Ṁ":"Ṁ","Ń":"Ń","Ǹ":"Ǹ","Ñ":"Ñ","Ň":"Ň","Ṅ":"Ṅ","Ó":"Ó","Ò":"Ò","Ö":"Ö","Ȫ":"Ȫ","Õ":"Õ","Ṍ":"Ṍ","Ṏ":"Ṏ","Ȭ":"Ȭ","Ō":"Ō","Ṓ":"Ṓ","Ṑ":"Ṑ","Ŏ":"Ŏ","Ǒ":"Ǒ","Ô":"Ô","Ố":"Ố","Ồ":"Ồ","Ỗ":"Ỗ","Ȯ":"Ȯ","Ȱ":"Ȱ","Ő":"Ő","Ṕ":"Ṕ","Ṗ":"Ṗ","Ŕ":"Ŕ","Ř":"Ř","Ṙ":"Ṙ","Ś":"Ś","Ṥ":"Ṥ","Š":"Š","Ṧ":"Ṧ","Ŝ":"Ŝ","Ṡ":"Ṡ","Ť":"Ť","Ṫ":"Ṫ","Ú":"Ú","Ù":"Ù","Ü":"Ü","Ǘ":"Ǘ","Ǜ":"Ǜ","Ǖ":"Ǖ","Ǚ":"Ǚ","Ũ":"Ũ","Ṹ":"Ṹ","Ū":"Ū","Ṻ":"Ṻ","Ŭ":"Ŭ","Ǔ":"Ǔ","Û":"Û","Ů":"Ů","Ű":"Ű","Ṽ":"Ṽ","Ẃ":"Ẃ","Ẁ":"Ẁ","Ẅ":"Ẅ","Ŵ":"Ŵ","Ẇ":"Ẇ","Ẍ":"Ẍ","Ẋ":"Ẋ","Ý":"Ý","Ỳ":"Ỳ","Ÿ":"Ÿ","Ỹ":"Ỹ","Ȳ":"Ȳ","Ŷ":"Ŷ","Ẏ":"Ẏ","Ź":"Ź","Ž":"Ž","Ẑ":"Ẑ","Ż":"Ż","ά":"ά","ὰ":"ὰ","ᾱ":"ᾱ","ᾰ":"ᾰ","έ":"έ","ὲ":"ὲ","ή":"ή","ὴ":"ὴ","ί":"ί","ὶ":"ὶ","ϊ":"ϊ","ΐ":"ΐ","ῒ":"ῒ","ῑ":"ῑ","ῐ":"ῐ","ό":"ό","ὸ":"ὸ","ύ":"ύ","ὺ":"ὺ","ϋ":"ϋ","ΰ":"ΰ","ῢ":"ῢ","ῡ":"ῡ","ῠ":"ῠ","ώ":"ώ","ὼ":"ὼ","Ύ":"Ύ","Ὺ":"Ὺ","Ϋ":"Ϋ","Ῡ":"Ῡ","Ῠ":"Ῠ","Ώ":"Ώ","Ὼ":"Ὼ"},Wr=function(){function t(t,e){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new jr(t,e,this.mode),this.settings=e,this.leftrightDepth=0}var e=t.prototype;return e.expect=function(t,e){if(void 0===e&&(e=!0),this.fetch().text!==t)throw new a("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());e&&this.consume()},e.consume=function(){this.nextToken=null},e.fetch=function(){return null==this.nextToken&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken},e.switchMode=function(t){this.mode=t,this.gullet.switchMode(t)},e.parse=function(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t},e.parseExpression=function(e,n){for(var r=[];;){"math"===this.mode&&this.consumeSpaces();var i=this.fetch();if(-1!==t.endOfExpression.indexOf(i.text))break;if(n&&i.text===n)break;if(e&&br[i.text]&&br[i.text].infix)break;var o=this.parseAtom(n);if(!o)break;"internal"!==o.type&&r.push(o)}return"text"===this.mode&&this.formLigatures(r),this.handleInfixNodes(r)},e.handleInfixNodes=function(t){for(var e,n=-1,r=0;r0&&!c||0===s&&!c&&"math"===this.mode,f=this.parseGroupOfType("argument to '"+t+"'",u,c,r,l);if(!f){if(c){o.push(null);continue}throw new a("Expected group after '"+t+"'",this.fetch())}(c?o:i).push(f)}return{args:i,optArgs:o}},e.parseGroupOfType=function(t,e,n,r,i){switch(e){case"color":return i&&this.consumeSpaces(),this.parseColorGroup(n);case"size":return i&&this.consumeSpaces(),this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n,i);case"math":case"text":return this.parseGroup(t,n,r,void 0,e,i);case"hbox":var o=this.parseGroup(t,n,r,void 0,"text",i);return o?{type:"styling",mode:o.mode,body:[o],style:"text"}:o;case"raw":if(i&&this.consumeSpaces(),n&&"{"===this.fetch().text)return null;var s=this.parseStringGroup("raw",n,!0);if(s)return{type:"raw",mode:"text",string:s.text};throw new a("Expected raw group",this.fetch());case"original":case null:case void 0:return this.parseGroup(t,n,r,void 0,void 0,i);default:throw new a("Unknown group type as "+t,this.fetch())}},e.consumeSpaces=function(){for(;" "===this.fetch().text;)this.consume()},e.parseStringGroup=function(t,e,n){var r=e?"[":"{",i=e?"]":"}",o=this.fetch();if(o.text!==r){if(e)return null;if(n&&"EOF"!==o.text&&/[^{}[\]]/.test(o.text))return this.consume(),o}var s=this.mode;this.mode="text",this.expect(r);for(var u,c="",l=this.fetch(),f=0,h=l;(u=this.fetch()).text!==i||n&&f>0;){switch(u.text){case"EOF":throw new a("Unexpected end of input in "+t,l.range(h,c));case r:f++;break;case i:f--}c+=(h=u).text,this.consume()}return this.expect(i),this.mode=s,l.range(h,c)},e.parseRegexGroup=function(t,e){var n=this.mode;this.mode="text";for(var r,i=this.fetch(),o=i,s="";"EOF"!==(r=this.fetch()).text&&t.test(s+r.text);)s+=(o=r).text,this.consume();if(""===s)throw new a("Invalid "+e+": '"+i.text+"'",i);return this.mode=n,i.range(o,s)},e.parseColorGroup=function(t){var e=this.parseStringGroup("color",t);if(!e)return null;var n=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(e.text);if(!n)throw new a("Invalid color: '"+e.text+"'",e);var r=n[0];return/^[0-9a-f]{6}$/i.test(r)&&(r="#"+r),{type:"color-token",mode:this.mode,color:r}},e.parseSizeGroup=function(t){var e,n=!1;if(!(e=t||"{"===this.fetch().text?this.parseStringGroup("size",t):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size")))return null;t||0!==e.text.length||(e.text="0pt",n=!0);var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e.text);if(!r)throw new a("Invalid size: '"+e.text+"'",e);var i={number:+(r[1]+r[2]),unit:r[3]};if(!Pt(i))throw new a("Invalid unit: '"+i.unit+"'",e);return{type:"size",mode:this.mode,value:i,isBlank:n}},e.parseUrlGroup=function(t,e){this.gullet.lexer.setCatcode("%",13);var n=this.parseStringGroup("url",t,!0);if(this.gullet.lexer.setCatcode("%",14),!n)return null;var r=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}},e.parseGroup=function(e,n,i,o,s,u){var c=this.mode;s&&this.switchMode(s),u&&this.consumeSpaces();var l,f=this.fetch(),h=f.text;if(n?"["===h:"{"===h||"\\begingroup"===h){this.consume();var p=t.endOfGroup[h];this.gullet.beginGroup();var d=this.parseExpression(!1,p),m=this.fetch();this.expect(p),this.gullet.endGroup(),l={type:"ordgroup",mode:this.mode,loc:r.range(f,m),body:d,semisimple:"\\begingroup"===h||void 0}}else if(n)l=null;else if(null==(l=this.parseFunction(o,e,i)||this.parseSymbol())&&"\\"===h[0]&&!zr.hasOwnProperty(h)){if(this.settings.throwOnError)throw new a("Undefined control sequence: "+h,f);l=this.formatUnsupportedCmd(h),this.consume()}return s&&this.switchMode(c),l},e.formLigatures=function(t){for(var e=t.length-1,n=0;n=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+e[0]+'" used in math mode',t);var u,c=X[this.mode][e].group,l=r.range(t);if(G.hasOwnProperty(c)){var f=c;u={type:"atom",mode:this.mode,family:f,loc:l,text:e}}else u={type:c,mode:this.mode,loc:l,text:e};o=u}else{if(!(e.charCodeAt(0)>=128))return null;this.settings.strict&&(C(e.charCodeAt(0))?"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+e[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+e[0]+'" ('+e.charCodeAt(0)+")",t)),o={type:"textord",mode:"text",loc:r.range(t),text:e}}if(this.consume(),s)for(var h=0;hReferences + Open Source \n

This article is a product of the following resources:\n

\n

D3.js \n (Mike Bostock & Philippe Rivière)

\n

LayerCake \n (Michael Keller)

\n

KaTeX \n (Emily Eisenberg & Sophie Alpert)

\n

Svelte \n (Rich Harris)

',p(n,"id","resources"),p(n,"class","svelte-1jnlkqb")},m(t,e){s(t,n,e)},p:t,i:t,o:t,d(t){t&&u(n)}}}class Z extends L{constructor(t){super(),P(this,t,null,J,o,{})}}var Q=K((function(t,e){window,t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s=581)}([function(t,e,n){n.r(e),function(t,r,i,o){n.d(e,"AdadeltaOptimizer",(function(){return Nh})),n.d(e,"AdagradOptimizer",(function(){return Th})),n.d(e,"AdamOptimizer",(function(){return Dh})),n.d(e,"AdamaxOptimizer",(function(){return Ih})),n.d(e,"Add",(function(){return Er})),n.d(e,"AddN",(function(){return Cr})),n.d(e,"BroadcastTo",(function(){return Dr})),n.d(e,"DataStorage",(function(){return ho})),n.d(e,"Div",(function(){return Sr})),n.d(e,"ENV",(function(){return h})),n.d(e,"Environment",(function(){return l})),n.d(e,"FromPixels",(function(){return Br})),n.d(e,"FusedBatchNorm",(function(){return Ar})),n.d(e,"Identity",(function(){return Rr})),n.d(e,"KernelBackend",(function(){return po})),n.d(e,"MaxPoolWithArgmax",(function(){return zr})),n.d(e,"MomentumOptimizer",(function(){return Fh})),n.d(e,"NonMaxSuppressionV5",(function(){return Tr})),n.d(e,"OneHot",(function(){return Ir})),n.d(e,"Optimizer",(function(){return _h})),n.d(e,"PadV2",(function(){return Mr})),n.d(e,"RMSPropOptimizer",(function(){return Mh})),n.d(e,"Rank",(function(){return At})),n.d(e,"Reduction",(function(){return dl})),n.d(e,"SGDOptimizer",(function(){return Rh})),n.d(e,"Square",(function(){return _r})),n.d(e,"SquaredDifference",(function(){return Or})),n.d(e,"Tensor",(function(){return St})),n.d(e,"TensorBuffer",(function(){return wt})),n.d(e,"Tile",(function(){return Fr})),n.d(e,"Transpose",(function(){return Nr})),n.d(e,"Variable",(function(){return Dt})),n.d(e,"abs",(function(){return Ur})),n.d(e,"acos",(function(){return Vr})),n.d(e,"acosh",(function(){return qr})),n.d(e,"add",(function(){return jr})),n.d(e,"addN",(function(){return js})),n.d(e,"addStrict",(function(){return ki})),n.d(e,"all",(function(){return Rc})),n.d(e,"any",(function(){return Fc})),n.d(e,"argMax",(function(){return Mc})),n.d(e,"argMin",(function(){return Bc})),n.d(e,"asin",(function(){return Hr})),n.d(e,"asinh",(function(){return Gr})),n.d(e,"atan",(function(){return $r})),n.d(e,"atan2",(function(){return Ei})),n.d(e,"atanh",(function(){return Kr})),n.d(e,"avgPool",(function(){return kc})),n.d(e,"avgPool3d",(function(){return Sc})),n.d(e,"backend",(function(){return mn})),n.d(e,"backend_util",(function(){return Do})),n.d(e,"basicLSTMCell",(function(){return Zc})),n.d(e,"batchNorm",(function(){return qs})),n.d(e,"batchNorm2d",(function(){return $s})),n.d(e,"batchNorm3d",(function(){return Ys})),n.d(e,"batchNorm4d",(function(){return Qs})),n.d(e,"batchNormalization",(function(){return Vs})),n.d(e,"batchNormalization2d",(function(){return Gs})),n.d(e,"batchNormalization3d",(function(){return Xs})),n.d(e,"batchNormalization4d",(function(){return Zs})),n.d(e,"batchToSpaceND",(function(){return sr})),n.d(e,"booleanMaskAsync",(function(){return Yu})),n.d(e,"broadcastTo",(function(){return tu})),n.d(e,"browser",(function(){return wh})),n.d(e,"buffer",(function(){return or})),n.d(e,"cast",(function(){return ur})),n.d(e,"ceil",(function(){return Xr})),n.d(e,"clipByValue",(function(){return Yr})),n.d(e,"clone",(function(){return eu})),n.d(e,"complex",(function(){return Rn})),n.d(e,"concat",(function(){return Qn})),n.d(e,"concat1d",(function(){return tr})),n.d(e,"concat2d",(function(){return er})),n.d(e,"concat3d",(function(){return nr})),n.d(e,"concat4d",(function(){return rr})),n.d(e,"conv1d",(function(){return tc})),n.d(e,"conv2d",(function(){return ec})),n.d(e,"conv2dTranspose",(function(){return cc})),n.d(e,"conv3d",(function(){return nc})),n.d(e,"conv3dTranspose",(function(){return lc})),n.d(e,"cos",(function(){return Jr})),n.d(e,"cosh",(function(){return Zr})),n.d(e,"cumsum",(function(){return cr})),n.d(e,"customGrad",(function(){return so})),n.d(e,"deprecationWarn",(function(){return Ze})),n.d(e,"depthToSpace",(function(){return lr})),n.d(e,"depthwiseConv2d",(function(){return oc})),n.d(e,"diag",(function(){return fl})),n.d(e,"disableDeprecationWarnings",(function(){return Je})),n.d(e,"dispose",(function(){return on})),n.d(e,"disposeVariables",(function(){return Qe})),n.d(e,"div",(function(){return Pi})),n.d(e,"divNoNan",(function(){return uu})),n.d(e,"divStrict",(function(){return Ci})),n.d(e,"dot",(function(){return hc})),n.d(e,"dropout",(function(){return hl})),n.d(e,"elu",(function(){return qc})),n.d(e,"enableDebugMode",(function(){return Ye})),n.d(e,"enableProdMode",(function(){return Xe})),n.d(e,"engine",(function(){return tn})),n.d(e,"env",(function(){return f})),n.d(e,"equal",(function(){return Fu})),n.d(e,"equalStrict",(function(){return Mu})),n.d(e,"erf",(function(){return Qr})),n.d(e,"exp",(function(){return ti})),n.d(e,"expandDims",(function(){return fr})),n.d(e,"expm1",(function(){return ei})),n.d(e,"eye",(function(){return lu})),n.d(e,"fft",(function(){return il})),n.d(e,"fill",(function(){return Kn})),n.d(e,"findBackend",(function(){return hn})),n.d(e,"findBackendFactory",(function(){return pn})),n.d(e,"floor",(function(){return ni})),n.d(e,"floorDiv",(function(){return Si})),n.d(e,"frame",(function(){return vl})),n.d(e,"fused",(function(){return Yl})),n.d(e,"gather",(function(){return Ku})),n.d(e,"gatherND",(function(){return ll})),n.d(e,"gather_util",(function(){return Wi})),n.d(e,"getBackend",(function(){return ln})),n.d(e,"getGradient",(function(){return g})),n.d(e,"getKernel",(function(){return m})),n.d(e,"getKernelsForBackend",(function(){return v})),n.d(e,"grad",(function(){return no})),n.d(e,"grads",(function(){return ro})),n.d(e,"greater",(function(){return Bu})),n.d(e,"greaterEqual",(function(){return zu})),n.d(e,"greaterEqualStrict",(function(){return ju})),n.d(e,"greaterStrict",(function(){return Pu})),n.d(e,"hammingWindow",(function(){return gl})),n.d(e,"hannWindow",(function(){return ml})),n.d(e,"ifft",(function(){return ol})),n.d(e,"imag",(function(){return Mn})),n.d(e,"image",(function(){return Ul})),n.d(e,"inTopKAsync",(function(){return xl})),n.d(e,"io",(function(){return vh})),n.d(e,"irfft",(function(){return sl})),n.d(e,"isFinite",(function(){return di})),n.d(e,"isInf",(function(){return pi})),n.d(e,"isNaN",(function(){return hi})),n.d(e,"keep",(function(){return an})),n.d(e,"leakyRelu",(function(){return Hc})),n.d(e,"less",(function(){return Lu})),n.d(e,"lessEqual",(function(){return Wu})),n.d(e,"lessEqualStrict",(function(){return Uu})),n.d(e,"lessStrict",(function(){return Vu})),n.d(e,"linalg",(function(){return Ml})),n.d(e,"linspace",(function(){return Xn})),n.d(e,"localResponseNormalization",(function(){return Yc})),n.d(e,"log",(function(){return ri})),n.d(e,"log1p",(function(){return ii})),n.d(e,"logSigmoid",(function(){return oi})),n.d(e,"logSoftmax",(function(){return lo})),n.d(e,"logSumExp",(function(){return zc})),n.d(e,"logicalAnd",(function(){return nu})),n.d(e,"logicalNot",(function(){return ru})),n.d(e,"logicalOr",(function(){return iu})),n.d(e,"logicalXor",(function(){return ou})),n.d(e,"losses",(function(){return Tl})),n.d(e,"matMul",(function(){return fc})),n.d(e,"math",(function(){return bh})),n.d(e,"max",(function(){return jc})),n.d(e,"maxPool",(function(){return wc})),n.d(e,"maxPool3d",(function(){return Cc})),n.d(e,"maxPoolWithArgmax",(function(){return Ac})),n.d(e,"maximum",(function(){return Ai})),n.d(e,"maximumStrict",(function(){return Oi})),n.d(e,"mean",(function(){return Pc})),n.d(e,"memory",(function(){return en})),n.d(e,"min",(function(){return Lc})),n.d(e,"minimum",(function(){return _i})),n.d(e,"minimumStrict",(function(){return Ni})),n.d(e,"mod",(function(){return Ti})),n.d(e,"modStrict",(function(){return Di})),n.d(e,"moments",(function(){return Wc})),n.d(e,"movingAverage",(function(){return tl})),n.d(e,"mul",(function(){return Ii})),n.d(e,"mulStrict",(function(){return Ri})),n.d(e,"multiRNNCell",(function(){return Qc})),n.d(e,"multinomial",(function(){return fu})),n.d(e,"neg",(function(){return ai})),n.d(e,"nextFrame",(function(){return Ph})),n.d(e,"norm",(function(){return Jc})),n.d(e,"notEqual",(function(){return qu})),n.d(e,"notEqualStrict",(function(){return Hu})),n.d(e,"oneHot",(function(){return hu})),n.d(e,"ones",(function(){return Gn})),n.d(e,"onesLike",(function(){return Jn})),n.d(e,"op",(function(){return In})),n.d(e,"outerProduct",(function(){return pc})),n.d(e,"pad",(function(){return pu})),n.d(e,"pad1d",(function(){return du})),n.d(e,"pad2d",(function(){return mu})),n.d(e,"pad3d",(function(){return gu})),n.d(e,"pad4d",(function(){return vu})),n.d(e,"pool",(function(){return Ec})),n.d(e,"pow",(function(){return Fi})),n.d(e,"powStrict",(function(){return Mi})),n.d(e,"prelu",(function(){return Gc})),n.d(e,"print",(function(){return ar})),n.d(e,"prod",(function(){return Vc})),n.d(e,"profile",(function(){return nn})),n.d(e,"rand",(function(){return yu})),n.d(e,"randomGamma",(function(){return _u})),n.d(e,"randomNormal",(function(){return Nu})),n.d(e,"randomUniform",(function(){return Tu})),n.d(e,"range",(function(){return Yn})),n.d(e,"ready",(function(){return cn})),n.d(e,"real",(function(){return Fn})),n.d(e,"reciprocal",(function(){return si})),n.d(e,"registerBackend",(function(){return dn})),n.d(e,"registerGradient",(function(){return b})),n.d(e,"registerKernel",(function(){return y})),n.d(e,"relu",(function(){return $c})),n.d(e,"relu6",(function(){return Kc})),n.d(e,"removeBackend",(function(){return fn})),n.d(e,"reshape",(function(){return hr})),n.d(e,"reverse",(function(){return dc})),n.d(e,"reverse1d",(function(){return mc})),n.d(e,"reverse2d",(function(){return gc})),n.d(e,"reverse3d",(function(){return vc})),n.d(e,"reverse4d",(function(){return yc})),n.d(e,"rfft",(function(){return al})),n.d(e,"round",(function(){return ui})),n.d(e,"rsqrt",(function(){return ci})),n.d(e,"scalar",(function(){return jn})),n.d(e,"scatterND",(function(){return rl})),n.d(e,"scatter_util",(function(){return $i})),n.d(e,"selu",(function(){return Xc})),n.d(e,"separableConv2d",(function(){return uc})),n.d(e,"serialization",(function(){return Sh})),n.d(e,"setBackend",(function(){return un})),n.d(e,"setPlatform",(function(){return gn})),n.d(e,"setdiff1dAsync",(function(){return vr})),n.d(e,"sigmoid",(function(){return li})),n.d(e,"sign",(function(){return fi})),n.d(e,"signal",(function(){return bl})),n.d(e,"sin",(function(){return mi})),n.d(e,"sinh",(function(){return gi})),n.d(e,"slice",(function(){return Oc})),n.d(e,"slice1d",(function(){return _c})),n.d(e,"slice2d",(function(){return Nc})),n.d(e,"slice3d",(function(){return Tc})),n.d(e,"slice4d",(function(){return Dc})),n.d(e,"slice_util",(function(){return eo})),n.d(e,"softmax",(function(){return co})),n.d(e,"softplus",(function(){return vi})),n.d(e,"spaceToBatchND",(function(){return pr})),n.d(e,"sparseToDense",(function(){return cl})),n.d(e,"spectral",(function(){return ul})),n.d(e,"split",(function(){return ir})),n.d(e,"sqrt",(function(){return yi})),n.d(e,"square",(function(){return Du})),n.d(e,"squaredDifference",(function(){return Iu})),n.d(e,"squaredDifferenceStrict",(function(){return Bi})),n.d(e,"squeeze",(function(){return dr})),n.d(e,"stack",(function(){return mr})),n.d(e,"step",(function(){return bi})),n.d(e,"stft",(function(){return yl})),n.d(e,"stridedSlice",(function(){return el})),n.d(e,"sub",(function(){return zi})),n.d(e,"subStrict",(function(){return ji})),n.d(e,"sum",(function(){return Uc})),n.d(e,"sumOutType",(function(){return Ft})),n.d(e,"tan",(function(){return xi})),n.d(e,"tanh",(function(){return wi})),n.d(e,"tensor",(function(){return Bn})),n.d(e,"tensor1d",(function(){return Pn})),n.d(e,"tensor2d",(function(){return Ln})),n.d(e,"tensor3d",(function(){return Wn})),n.d(e,"tensor4d",(function(){return Un})),n.d(e,"tensor5d",(function(){return Vn})),n.d(e,"tensor6d",(function(){return qn})),n.d(e,"tensor_util",(function(){return Pt})),n.d(e,"test_util",(function(){return Cu})),n.d(e,"tidy",(function(){return rn})),n.d(e,"tile",(function(){return cu})),n.d(e,"time",(function(){return sn})),n.d(e,"topk",(function(){return nl})),n.d(e,"train",(function(){return zh})),n.d(e,"transpose",(function(){return fo})),n.d(e,"truncatedNormal",(function(){return Ru})),n.d(e,"unregisterGradient",(function(){return w})),n.d(e,"unregisterKernel",(function(){return x})),n.d(e,"unsortedSegmentSum",(function(){return Xu})),n.d(e,"unstack",(function(){return gr})),n.d(e,"util",(function(){return ht})),n.d(e,"valueAndGrad",(function(){return io})),n.d(e,"valueAndGrads",(function(){return oo})),n.d(e,"variable",(function(){return Hn})),n.d(e,"variableGrads",(function(){return ao})),n.d(e,"version_core",(function(){return Ah})),n.d(e,"webgl",(function(){return Oh})),n.d(e,"where",(function(){return au})),n.d(e,"whereAsync",(function(){return su})),n.d(e,"zeros",(function(){return $n})),n.d(e,"zerosLike",(function(){return Zn})); /** * @license * Copyright 2020 Google LLC. All Rights Reserved. @@ -1370,7 +1370,7 @@ var r=n(206);n(33).Tensor.prototype.add=function(t){return r.add(this,t)}},funct */ n(383),n(377),n(375),n(371),n(363),n(361),n(359),n(357),n(355),n(353)},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e,n){(function(t,e){!function(t,n){if(!t.setImmediate){var r,i=1,o={},a=!1,s=t.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(t);u=u&&u.setTimeout?u:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){l(t)}))}:function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?function(){var e="setImmediate$"+Math.random()+"$",n=function(n){n.source===t&&"string"==typeof n.data&&0===n.data.indexOf(e)&&l(+n.data.slice(e.length))};t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n),r=function(n){t.postMessage(e+n,"*")}}():t.MessageChannel?function(){var t=new MessageChannel;t.port1.onmessage=function(t){l(t.data)},r=function(e){t.port2.postMessage(e)}}():s&&"onreadystatechange"in s.createElement("script")?function(){var t=s.documentElement;r=function(e){var n=s.createElement("script");n.onreadystatechange=function(){l(e),n.onreadystatechange=null,t.removeChild(n),n=null},t.appendChild(n)}}():r=function(t){setTimeout(l,0,t)},u.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n */ -e.read=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,l=-7,f=n?i-1:0,h=n?-1:1,p=t[e+f];for(f+=h,o=p&(1<<-l)-1,p>>=-l,l+=s;l>0;o=256*o+t[e+f],f+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+t[e+f],f+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),o-=c}return(p?-1:1)*a*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(e*u-1)*Math.pow(2,i),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;t[n+p]=255&s,p+=d,s/=256,i-=8);for(a=a<0;t[n+p]=255&a,p+=d,a/=256,c-=8);t[n+p-d]|=128*m}},function(t,e,n){e.byteLength=function(t){var e=c(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,r=c(t),a=r[0],s=r[1],u=new o(function(t,e,n){return 3*(e+n)/4-n}(0,a,s)),l=0,f=s>0?a-4:a;for(n=0;n>16&255,u[l++]=e>>8&255,u[l++]=255&e;return 2===s&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,u[l++]=255&e),1===s&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e),u},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],a=0,s=n-i;as?s:a+16383));return 1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function l(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function f(t,e,n){for(var r,i=[],o=e;o=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:N(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}(t.exports);try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},function(t,e,n){for(var r=n(155),i=n(82),o=n(38),a=n(16),s=n(42),u=n(96),c=n(19),l=c("iterator"),f=c("toStringTag"),h=u.Array,p={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},d=i(p),m=0;m2,i=!!r&&a.call(arguments,2);return t(r?function(){("function"==typeof e?e:Function(e)).apply(this,i)}:e,n)}};i(i.G+i.B+i.F*s,{setTimeout:u(r.setTimeout),setInterval:u(r.setInterval)})},function(t,e,n){n(411),n(410),n(409),t.exports=n(24)},function(t,e,n){var r=n(8),i=n(24),o=n(16),a=n(104),s=n(216);r(r.P+r.R,"Promise",{finally:function(t){var e=a(this,i.Promise||o.Promise),n="function"==typeof t;return this.then(n?function(n){return s(e,t()).then((function(){return n}))}:t,n?function(n){return s(e,t()).then((function(){throw n}))}:t)}})},function(t,e,n){n(218),n(413),t.exports=n(24).Promise.finally},function(t,e,n){var r=n(8),i=n(210)(!0);r(r.S,"Object",{entries:function(t){return i(t)}})},function(t,e,n){n(415),t.exports=n(24).Object.entries},function(t,e,n){var r=n(8),i=n(210)(!1);r(r.S,"Object",{values:function(t){return i(t)}})},function(t,e,n){n(417),t.exports=n(24).Object.values},function(t,e,n){var r=n(8),i=n(212),o=n(41),a=n(53),s=n(158);r(r.S,"Object",{getOwnPropertyDescriptors:function(t){for(var e,n,r=o(t),u=a.f,c=i(r),l={},f=0;c.length>f;)void 0!==(n=u(r,e=c[f++]))&&s(l,e,n);return l}})},function(t,e,n){n(419),t.exports=n(24).Object.getOwnPropertyDescriptors},function(t,e,n){n(239)("asyncIterator")},function(t,e,n){n(421),t.exports=n(174).f("asyncIterator")},function(t,e,n){n(97)("trimRight",(function(t){return function(){return t(this,2)}}),"trimEnd")},function(t,e,n){n(423),t.exports=n(24).String.trimRight},function(t,e,n){n(97)("trimLeft",(function(t){return function(){return t(this,1)}}),"trimStart")},function(t,e,n){n(425),t.exports=n(24).String.trimLeft},function(t,e,n){var r=n(8),i=n(211),o=n(120),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(o);r(r.P+r.F*a,"String",{padEnd:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0,!1)}})},function(t,e,n){n(427),t.exports=n(24).String.padEnd},function(t,e,n){var r=n(8),i=n(211),o=n(120),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(o);r(r.P+r.F*a,"String",{padStart:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0,!0)}})},function(t,e,n){n(429),t.exports=n(24).String.padStart},function(t,e,n){var r=n(126),i=n(13),o=n(22),a=n(56),s=n(19)("isConcatSpreadable");t.exports=function t(e,n,u,c,l,f,h,p){for(var d,m,g=l,v=0,y=!!h&&a(h,p,3);v0)g=t(e,n,d,o(d.length),g,f-1)-1;else{if(g>=9007199254740991)throw TypeError();e[g]=d}g++}v++}return g}},function(t,e,n){var r=n(8),i=n(431),o=n(34),a=n(22),s=n(55),u=n(224);r(r.P,"Array",{flatMap:function(t){var e,n,r=o(this);return s(t),e=a(r.length),n=u(r,0),i(n,r,r,e,0,1,t,arguments[1]),n}}),n(77)("flatMap")},function(t,e,n){n(432),t.exports=n(24).Array.flatMap},function(t,e,n){var r=n(8),i=n(128)(!0);r(r.P,"Array",{includes:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(77)("includes")},function(t,e,n){n(434),t.exports=n(24).Array.includes},function(t,e,n){var r=n(8),i=n(170);i&&r(r.S,"Reflect",{setPrototypeOf:function(t,e){i.check(t,e);try{return i.set(t,e),!0}catch(t){return!1}}})},function(t,e,n){var r=n(26),i=n(53),o=n(78),a=n(43),s=n(8),u=n(85),c=n(14),l=n(13);s(s.S,"Reflect",{set:function t(e,n,s){var f,h,p=arguments.length<4?e:arguments[3],d=i.f(c(e),n);if(!d){if(l(h=o(e)))return t(h,n,s,p);d=u(0)}if(a(d,"value")){if(!1===d.writable||!l(p))return!1;if(f=i.f(p,n)){if(f.get||f.set||!1===f.writable)return!1;f.value=s,r.f(p,n,f)}else r.f(p,n,u(0,s));return!0}return void 0!==d.set&&(d.set.call(p,s),!0)}})},function(t,e,n){var r=n(8),i=n(14),o=Object.preventExtensions;r(r.S,"Reflect",{preventExtensions:function(t){i(t);try{return o&&o(t),!0}catch(t){return!1}}})},function(t,e,n){var r=n(8);r(r.S,"Reflect",{ownKeys:n(212)})},function(t,e,n){var r=n(8),i=n(14),o=Object.isExtensible;r(r.S,"Reflect",{isExtensible:function(t){return i(t),!o||o(t)}})},function(t,e,n){var r=n(8);r(r.S,"Reflect",{has:function(t,e){return e in t}})},function(t,e,n){var r=n(8),i=n(78),o=n(14);r(r.S,"Reflect",{getPrototypeOf:function(t){return i(o(t))}})},function(t,e,n){var r=n(53),i=n(8),o=n(14);i(i.S,"Reflect",{getOwnPropertyDescriptor:function(t,e){return r.f(o(t),e)}})},function(t,e,n){var r=n(53),i=n(78),o=n(43),a=n(8),s=n(13),u=n(14);a(a.S,"Reflect",{get:function t(e,n){var a,c,l=arguments.length<3?e:arguments[2];return u(e)===l?e[n]:(a=r.f(e,n))?o(a,"value")?a.value:void 0!==a.get?a.get.call(l):void 0:s(c=i(e))?t(c,n,l):void 0}})},function(t,e,n){var r=n(8),i=n(14),o=function(t){this._t=i(t),this._i=0;var e,n=this._k=[];for(e in t)n.push(e)};n(226)(o,"Object",(function(){var t,e=this._k;do{if(this._i>=e.length)return{value:void 0,done:!0}}while(!((t=e[this._i++])in this._t));return{value:t,done:!1}})),r(r.S,"Reflect",{enumerate:function(t){return new o(t)}})},function(t,e,n){var r=n(8),i=n(53).f,o=n(14);r(r.S,"Reflect",{deleteProperty:function(t,e){var n=i(o(t),e);return!(n&&!n.configurable)&&delete t[e]}})},function(t,e,n){var r=n(26),i=n(8),o=n(14),a=n(66);i(i.S+i.F*n(15)((function(){Reflect.defineProperty(r.f({},1,{value:1}),1,{value:2})})),"Reflect",{defineProperty:function(t,e,n){o(t),e=a(e,!0),o(n);try{return r.f(t,e,n),!0}catch(t){return!1}}})},function(t,e,n){var r=n(8),i=n(80),o=n(55),a=n(14),s=n(13),u=n(15),c=n(233),l=(n(16).Reflect||{}).construct,f=u((function(){function t(){}return!(l((function(){}),[],t)instanceof t)})),h=!u((function(){l((function(){}))}));r(r.S+r.F*(f||h),"Reflect",{construct:function(t,e){o(t),a(e);var n=arguments.length<3?t:o(arguments[2]);if(h&&!f)return l(t,e,n);if(t==n){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var r=[null];return r.push.apply(r,e),new(c.apply(t,r))}var u=n.prototype,p=i(s(u)?u:Object.prototype),d=Function.apply.call(t,p,e);return s(d)?d:p}})},function(t,e,n){var r=n(8),i=n(55),o=n(14),a=(n(16).Reflect||{}).apply,s=Function.apply;r(r.S+r.F*!n(15)((function(){a((function(){}))})),"Reflect",{apply:function(t,e,n){var r=i(t),u=o(n);return a?a(r,e,u):s.call(r,e,u)}})},function(t,e,n){n(60)("Float64",8,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},function(t,e,n){n(60)("Float32",4,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},function(t,e,n){n(60)("Uint32",4,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},function(t,e,n){n(60)("Int32",4,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},function(t,e,n){n(60)("Uint16",2,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},function(t,e,n){n(60)("Int16",2,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},function(t,e,n){n(60)("Uint8",1,(function(t){return function(e,n,r){return t(this,e,n,r)}}),!0)},function(t,e,n){n(60)("Uint8",1,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},function(t,e,n){n(60)("Int8",1,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},function(t,e,n){var r=n(8);r(r.G+r.W+r.F*!n(118).ABV,{DataView:n(151).DataView})},function(t,e,n){var r=n(8),i=n(118),o=n(151),a=n(14),s=n(81),u=n(22),c=n(13),l=n(16).ArrayBuffer,f=n(104),h=o.ArrayBuffer,p=o.DataView,d=i.ABV&&l.isView,m=h.prototype.slice,g=i.VIEW;r(r.G+r.W+r.F*(l!==h),{ArrayBuffer:h}),r(r.S+r.F*!i.CONSTR,"ArrayBuffer",{isView:function(t){return d&&d(t)||c(t)&&g in t}}),r(r.P+r.U+r.F*n(15)((function(){return!new h(2).slice(1,void 0).byteLength})),"ArrayBuffer",{slice:function(t,e){if(void 0!==m&&void 0===e)return m.call(a(this),t);for(var n=a(this).byteLength,r=s(t,n),i=s(void 0===e?n:e,n),o=new(f(this,h))(u(i-r)),c=new p(this),l=new p(o),d=0;r0?arguments[0]:void 0)}}),{add:function(t){return r.def(i(this,"WeakSet"),t,!0)}},r,!1,!0)},function(t,e,n){var r,i=n(16),o=n(51)(0),a=n(38),s=n(65),u=n(235),c=n(214),l=n(13),f=n(76),h=n(76),p=!i.ActiveXObject&&"ActiveXObject"in i,d=s.getWeak,m=Object.isExtensible,g=c.ufstore,v=function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},y={get:function(t){if(l(t)){var e=d(t);return!0===e?g(f(this,"WeakMap")).get(t):e?e[this._i]:void 0}},set:function(t,e){return c.def(f(this,"WeakMap"),t,e)}},b=t.exports=n(119)("WeakMap",v,y,c,!0,!0);h&&p&&(u((r=c.getConstructor(v,"WeakMap")).prototype,y),s.NEED=!0,o(["delete","has","get","set"],(function(t){var e=b.prototype,n=e[t];a(e,t,(function(e,i){if(l(e)&&!m(e)){this._f||(this._f=new r);var o=this._f[t](e,i);return"set"==t?this:o}return n.call(this,e,i)}))})))},function(t,e,n){var r=n(215),i=n(76);t.exports=n(119)("Set",(function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}}),{add:function(t){return r.def(i(this,"Set"),t=0===t?0:t,t)}},r)},function(t,e,n){var r=n(215),i=n(76);t.exports=n(119)("Map",(function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}}),{get:function(t){var e=r.getEntry(i(this,"Map"),t);return e&&e.v},set:function(t,e){return r.def(i(this,"Map"),0===t?0:t,e)}},r,!0)},function(t,e){t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},function(t,e,n){var r=n(16),i=n(152).set,o=r.MutationObserver||r.WebKitMutationObserver,a=r.process,s=r.Promise,u="process"==n(62)(a);t.exports=function(){var t,e,n,c=function(){var r,i;for(u&&(r=a.domain)&&r.exit();t;){i=t.fn,t=t.next;try{i()}catch(r){throw t?n():e=void 0,r}}e=void 0,r&&r.enter()};if(u)n=function(){a.nextTick(c)};else if(!o||r.navigator&&r.navigator.standalone)if(s&&s.resolve){var l=s.resolve(void 0);n=function(){l.then(c)}}else n=function(){i.call(r,c)};else{var f=!0,h=document.createTextNode("");new o(c).observe(h,{characterData:!0}),n=function(){h.data=f=!f}}return function(r){var i={fn:r,next:void 0};e&&(e.next=i),t||(t=i,n()),e=i}}},function(t,e,n){var r=n(161),i=n(14),o=n(104),a=n(153),s=n(22),u=n(123),c=n(154),l=n(15),f=Math.min,h=[].push,p=!l((function(){}));n(122)("split",2,(function(t,e,n,l){var d;return d="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,e){var i=String(this);if(void 0===t&&0===e)return[];if(!r(t))return n.call(i,t,e);for(var o,a,s,u=[],l=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),f=0,p=void 0===e?4294967295:e>>>0,d=new RegExp(t.source,l+"g");(o=c.call(d,i))&&!((a=d.lastIndex)>f&&(u.push(i.slice(f,o.index)),o.length>1&&o.index=p));)d.lastIndex===o.index&&d.lastIndex++;return f===i.length?!s&&d.test("")||u.push(""):u.push(i.slice(f)),u.length>p?u.slice(0,p):u}:"0".split(void 0,0).length?function(t,e){return void 0===t&&0===e?[]:n.call(this,t,e)}:n,[function(n,r){var i=t(this),o=null==n?void 0:n[e];return void 0!==o?o.call(n,i,r):d.call(String(i),n,r)},function(t,e){var r=l(d,t,this,e,d!==n);if(r.done)return r.value;var c=i(t),h=String(this),m=o(c,RegExp),g=c.unicode,v=(c.ignoreCase?"i":"")+(c.multiline?"m":"")+(c.unicode?"u":"")+(p?"y":"g"),y=new m(p?c:"^(?:"+c.source+")",v),b=void 0===e?4294967295:e>>>0;if(0===b)return[];if(0===h.length)return null===u(y,h)?[h]:[];for(var x=0,w=0,k=[];w]*>)/g,p=/\$([$&`']|\d\d?)/g,d=function(t){return void 0===t?t:String(t)};n(122)("replace",2,(function(t,e,n,m){return[function(r,i){var o=t(this),a=null==r?void 0:r[e];return void 0!==a?a.call(r,o,i):n.call(String(o),r,i)},function(t,e){var i=m(n,t,this,e);if(i.done)return i.value;var f=r(t),h=String(this),p="function"==typeof e;p||(e=String(e));var v=f.global;if(v){var y=f.unicode;f.lastIndex=0}for(var b=[];;){var x=u(f,h);if(null===x)break;if(b.push(x),!v)break;""===String(x[0])&&(f.lastIndex=s(h,o(f.lastIndex),y))}for(var w="",k=0,E=0;E=k&&(w+=h.slice(k,S)+T,k=S+C.length)}return w+h.slice(k)}];function g(t,e,r,o,a,s){var u=r+t.length,c=o.length,l=p;return void 0!==a&&(a=i(a),l=h),n.call(s,l,(function(n,i){var s;switch(i.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,r);case"'":return e.slice(u);case"<":s=a[i.slice(1,-1)];break;default:var l=+i;if(0===l)return n;if(l>c){var h=f(l/10);return 0===h?n:h<=c?void 0===o[h-1]?i.charAt(1):o[h-1]+i.charAt(1):n}s=o[l-1]}return void 0===s?"":s}))}}))},function(t,e,n){var r=n(14),i=n(22),o=n(153),a=n(123);n(122)("match",1,(function(t,e,n,s){return[function(n){var r=t(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,r):new RegExp(n)[e](String(r))},function(t){var e=s(n,t,this);if(e.done)return e.value;var u=r(t),c=String(this);if(!u.global)return a(u,c);var l=u.unicode;u.lastIndex=0;for(var f,h=[],p=0;null!==(f=a(u,c));){var d=String(f[0]);h[p]=d,""===d&&(u.lastIndex=o(c,i(u.lastIndex),l)),p++}return 0===p?null:h}]}))},function(t,e,n){n(219);var r=n(14),i=n(124),o=n(27),a=/./.toString,s=function(t){n(38)(RegExp.prototype,"toString",t,!0)};n(15)((function(){return"/a/b"!=a.call({source:"a",flags:"b"})}))?s((function(){var t=r(this);return"/".concat(t.source,"/","flags"in t?t.flags:!o&&t instanceof RegExp?i.call(t):void 0)})):"toString"!=a.name&&s((function(){return a.call(this)}))},function(t,e,n){var r=n(16),i=n(168),o=n(26).f,a=n(79).f,s=n(161),u=n(124),c=r.RegExp,l=c,f=c.prototype,h=/a/g,p=/a/g,d=new c(h)!==h;if(n(27)&&(!d||n(15)((function(){return p[n(19)("match")]=!1,c(h)!=h||c(p)==p||"/a/i"!=c(h,"i")})))){c=function(t,e){var n=this instanceof c,r=s(t),o=void 0===e;return!n&&r&&t.constructor===c&&o?t:i(d?new l(r&&!o?t.source:t,e):l((r=t instanceof c)?t.source:t,r&&o?u.call(t):e),n?this:f,c)};for(var m=function(t){t in c||o(c,t,{configurable:!0,get:function(){return l[t]},set:function(e){l[t]=e}})},g=a(l),v=0;g.length>v;)m(g[v++]);f.constructor=c,c.prototype=f,n(38)(r,"RegExp",c)}n(95)("RegExp")},function(t,e,n){n(95)("Array")},function(t,e,n){var r=n(8),i=n(51)(6),o="findIndex",a=!0;o in[]&&Array(1)[o]((function(){a=!1})),r(r.P+r.F*a,"Array",{findIndex:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(77)(o)},function(t,e,n){var r=n(8),i=n(51)(5),o=!0;"find"in[]&&Array(1).find((function(){o=!1})),r(r.P+r.F*o,"Array",{find:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(77)("find")},function(t,e,n){var r=n(8);r(r.P,"Array",{fill:n(156)}),n(77)("fill")},function(t,e,n){var r=n(8);r(r.P,"Array",{copyWithin:n(222)}),n(77)("copyWithin")},function(t,e,n){var r=n(8),i=n(41),o=n(54),a=n(22),s=[].lastIndexOf,u=!!s&&1/[1].lastIndexOf(1,-0)<0;r(r.P+r.F*(u||!n(49)(s)),"Array",{lastIndexOf:function(t){if(u)return s.apply(this,arguments)||0;var e=i(this),n=a(e.length),r=n-1;for(arguments.length>1&&(r=Math.min(r,o(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in e&&e[r]===t)return r||0;return-1}})},function(t,e,n){var r=n(8),i=n(128)(!1),o=[].indexOf,a=!!o&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(a||!n(49)(o)),"Array",{indexOf:function(t){return a?o.apply(this,arguments)||0:i(this,t,arguments[1])}})},function(t,e,n){var r=n(8),i=n(223);r(r.P+r.F*!n(49)([].reduceRight,!0),"Array",{reduceRight:function(t){return i(this,t,arguments.length,arguments[1],!0)}})},function(t,e,n){var r=n(8),i=n(223);r(r.P+r.F*!n(49)([].reduce,!0),"Array",{reduce:function(t){return i(this,t,arguments.length,arguments[1],!1)}})},function(t,e,n){var r=n(8),i=n(51)(4);r(r.P+r.F*!n(49)([].every,!0),"Array",{every:function(t){return i(this,t,arguments[1])}})},function(t,e,n){var r=n(8),i=n(51)(3);r(r.P+r.F*!n(49)([].some,!0),"Array",{some:function(t){return i(this,t,arguments[1])}})},function(t,e,n){var r=n(8),i=n(51)(2);r(r.P+r.F*!n(49)([].filter,!0),"Array",{filter:function(t){return i(this,t,arguments[1])}})},function(t,e,n){var r=n(8),i=n(51)(1);r(r.P+r.F*!n(49)([].map,!0),"Array",{map:function(t){return i(this,t,arguments[1])}})},function(t,e,n){var r=n(13),i=n(126),o=n(19)("species");t.exports=function(t){var e;return i(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!i(e.prototype)||(e=void 0),r(e)&&null===(e=e[o])&&(e=void 0)),void 0===e?Array:e}},function(t,e,n){var r=n(8),i=n(51)(0),o=n(49)([].forEach,!0);r(r.P+r.F*!o,"Array",{forEach:function(t){return i(this,t,arguments[1])}})},function(t,e,n){var r=n(8),i=n(55),o=n(34),a=n(15),s=[].sort,u=[1,2,3];r(r.P+r.F*(a((function(){u.sort(void 0)}))||!a((function(){u.sort(null)}))||!n(49)(s)),"Array",{sort:function(t){return void 0===t?s.call(o(this)):s.call(o(this),i(t))}})},function(t,e,n){var r=n(8),i=n(171),o=n(62),a=n(81),s=n(22),u=[].slice;r(r.P+r.F*n(15)((function(){i&&u.call(i)})),"Array",{slice:function(t,e){var n=s(this.length),r=o(this);if(e=void 0===e?n:e,"Array"==r)return u.call(this,t,e);for(var i=a(t,n),c=a(e,n),l=s(c-i),f=new Array(l),h=0;ht;)i(n,t,arguments[t++]);return n.length=e,n}})},function(t,e,n){var r=n(56),i=n(8),o=n(34),a=n(225),s=n(159),u=n(22),c=n(158),l=n(157);i(i.S+i.F*!n(125)((function(t){Array.from(t)})),"Array",{from:function(t){var e,n,i,f,h=o(t),p="function"==typeof this?this:Array,d=arguments.length,m=d>1?arguments[1]:void 0,g=void 0!==m,v=0,y=l(h);if(g&&(m=r(m,d>2?arguments[2]:void 0,2)),null==y||p==Array&&s(y))for(n=new p(e=u(h.length));e>v;v++)c(n,v,g?m(h[v],v):h[v]);else for(f=y.call(h),n=new p;!(i=f.next()).done;v++)c(n,v,g?a(f,m,[i.value,v],!0):i.value);return n.length=v,n}})},function(t,e,n){var r=n(8);r(r.S,"Array",{isArray:n(126)})},function(t,e,n){var r=n(14),i=n(66);t.exports=function(t){if("string"!==t&&"number"!==t&&"default"!==t)throw TypeError("Incorrect hint");return i(r(this),"number"!=t)}},function(t,e,n){var r=n(19)("toPrimitive"),i=Date.prototype;r in i||n(42)(i,r,n(494))},function(t,e,n){var r=Date.prototype,i=r.toString,o=r.getTime;new Date(NaN)+""!="Invalid Date"&&n(38)(r,"toString",(function(){var t=o.call(this);return t==t?i.call(this):"Invalid Date"}))},function(t,e,n){var r=n(15),i=Date.prototype.getTime,o=Date.prototype.toISOString,a=function(t){return t>9?t:"0"+t};t.exports=r((function(){return"0385-07-25T07:06:39.999Z"!=o.call(new Date(-50000000000001))}))||!r((function(){o.call(new Date(NaN))}))?function(){if(!isFinite(i.call(this)))throw RangeError("Invalid time value");var t=this,e=t.getUTCFullYear(),n=t.getUTCMilliseconds(),r=e<0?"-":e>9999?"+":"";return r+("00000"+Math.abs(e)).slice(r?-6:-4)+"-"+a(t.getUTCMonth()+1)+"-"+a(t.getUTCDate())+"T"+a(t.getUTCHours())+":"+a(t.getUTCMinutes())+":"+a(t.getUTCSeconds())+"."+(n>99?n:"0"+a(n))+"Z"}:o},function(t,e,n){var r=n(8),i=n(497);r(r.P+r.F*(Date.prototype.toISOString!==i),"Date",{toISOString:i})},function(t,e,n){var r=n(8),i=n(34),o=n(66);r(r.P+r.F*n(15)((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})})),"Date",{toJSON:function(t){var e=i(this),n=o(e);return"number"!=typeof n||isFinite(n)?e.toISOString():null}})},function(t,e,n){var r=n(8);r(r.S,"Date",{now:function(){return(new Date).getTime()}})},function(t,e,n){n(37)("sup",(function(t){return function(){return t(this,"sup","","")}}))},function(t,e,n){n(37)("sub",(function(t){return function(){return t(this,"sub","","")}}))},function(t,e,n){n(37)("strike",(function(t){return function(){return t(this,"strike","","")}}))},function(t,e,n){n(37)("small",(function(t){return function(){return t(this,"small","","")}}))},function(t,e,n){n(37)("link",(function(t){return function(e){return t(this,"a","href",e)}}))},function(t,e,n){n(37)("italics",(function(t){return function(){return t(this,"i","","")}}))},function(t,e,n){n(37)("fontsize",(function(t){return function(e){return t(this,"font","size",e)}}))},function(t,e,n){n(37)("fontcolor",(function(t){return function(e){return t(this,"font","color",e)}}))},function(t,e,n){n(37)("fixed",(function(t){return function(){return t(this,"tt","","")}}))},function(t,e,n){n(37)("bold",(function(t){return function(){return t(this,"b","","")}}))},function(t,e,n){n(37)("blink",(function(t){return function(){return t(this,"blink","","")}}))},function(t,e,n){n(37)("big",(function(t){return function(){return t(this,"big","","")}}))},function(t,e,n){n(37)("anchor",(function(t){return function(e){return t(this,"a","name",e)}}))},function(t,e,n){var r=n(8),i=n(22),o=n(162),a="".startsWith;r(r.P+r.F*n(160)("startsWith"),"String",{startsWith:function(t){var e=o(this,t,"startsWith"),n=i(Math.min(arguments.length>1?arguments[1]:void 0,e.length)),r=String(t);return a?a.call(e,r,n):e.slice(n,n+r.length)===r}})},function(t,e,n){var r=n(8);r(r.P,"String",{repeat:n(167)})},function(t,e,n){var r=n(8),i=n(162);r(r.P+r.F*n(160)("includes"),"String",{includes:function(t){return!!~i(this,t,"includes").indexOf(t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(8),i=n(22),o=n(162),a="".endsWith;r(r.P+r.F*n(160)("endsWith"),"String",{endsWith:function(t){var e=o(this,t,"endsWith"),n=arguments.length>1?arguments[1]:void 0,r=i(e.length),s=void 0===n?r:Math.min(i(n),r),u=String(t);return a?a.call(e,u,s):e.slice(s-u.length,s)===u}})},function(t,e,n){var r=n(8),i=n(164)(!1);r(r.P,"String",{codePointAt:function(t){return i(this,t)}})},function(t,e,n){var r=n(164)(!0);n(163)(String,"String",(function(t){this._t=String(t),this._i=0}),(function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})}))},function(t,e,n){n(97)("trim",(function(t){return function(){return t(this,3)}}))},function(t,e,n){var r=n(8),i=n(41),o=n(22);r(r.S,"String",{raw:function(t){for(var e=i(t.raw),n=o(e.length),r=arguments.length,a=[],s=0;n>s;)a.push(String(e[s++])),sa;){if(e=+arguments[a++],i(e,1114111)!==e)throw RangeError(e+" is not a valid code point");n.push(e<65536?o(e):o(55296+((e-=65536)>>10),e%1024+56320))}return n.join("")}})},function(t,e,n){var r=n(8);r(r.S,"Math",{trunc:function(t){return(t>0?Math.floor:Math.ceil)(t)}})},function(t,e,n){var r=n(8),i=n(165),o=Math.exp;r(r.S,"Math",{tanh:function(t){var e=i(t=+t),n=i(-t);return e==1/0?1:n==1/0?-1:(e-n)/(o(t)+o(-t))}})},function(t,e,n){var r=n(8),i=n(165),o=Math.exp;r(r.S+r.F*n(15)((function(){return-2e-17!=!Math.sinh(-2e-17)})),"Math",{sinh:function(t){return Math.abs(t=+t)<1?(i(t)-i(-t))/2:(o(t-1)-o(-t-1))*(Math.E/2)}})},function(t,e,n){var r=n(8);r(r.S,"Math",{sign:n(166)})},function(t,e,n){var r=n(8);r(r.S,"Math",{log2:function(t){return Math.log(t)/Math.LN2}})},function(t,e,n){var r=n(8);r(r.S,"Math",{log1p:n(227)})},function(t,e,n){var r=n(8);r(r.S,"Math",{log10:function(t){return Math.log(t)*Math.LOG10E}})},function(t,e,n){var r=n(8),i=Math.imul;r(r.S+r.F*n(15)((function(){return-5!=i(4294967295,5)||2!=i.length})),"Math",{imul:function(t,e){var n=+t,r=+e,i=65535&n,o=65535&r;return 0|i*o+((65535&n>>>16)*o+i*(65535&r>>>16)<<16>>>0)}})},function(t,e,n){var r=n(8),i=Math.abs;r(r.S,"Math",{hypot:function(t,e){for(var n,r,o=0,a=0,s=arguments.length,u=0;a0?(r=n/u)*r:n;return u===1/0?1/0:u*Math.sqrt(o)}})},function(t,e,n){var r=n(166),i=Math.pow,o=i(2,-52),a=i(2,-23),s=i(2,127)*(2-a),u=i(2,-126);t.exports=Math.fround||function(t){var e,n,i=Math.abs(t),c=r(t);return is||n!=n?c*(1/0):c*n}},function(t,e,n){var r=n(8);r(r.S,"Math",{fround:n(532)})},function(t,e,n){var r=n(8),i=n(165);r(r.S+r.F*(i!=Math.expm1),"Math",{expm1:i})},function(t,e,n){var r=n(8),i=Math.exp;r(r.S,"Math",{cosh:function(t){return(i(t=+t)+i(-t))/2}})},function(t,e,n){var r=n(8);r(r.S,"Math",{clz32:function(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},function(t,e,n){var r=n(8),i=n(166);r(r.S,"Math",{cbrt:function(t){return i(t=+t)*Math.pow(Math.abs(t),1/3)}})},function(t,e,n){var r=n(8),i=Math.atanh;r(r.S+r.F*!(i&&1/i(-0)<0),"Math",{atanh:function(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}})},function(t,e,n){var r=n(8),i=Math.asinh;r(r.S+r.F*!(i&&1/i(0)>0),"Math",{asinh:function t(e){return isFinite(e=+e)&&0!=e?e<0?-t(-e):Math.log(e+Math.sqrt(e*e+1)):e}})},function(t,e,n){var r=n(8),i=n(227),o=Math.sqrt,a=Math.acosh;r(r.S+r.F*!(a&&710==Math.floor(a(Number.MAX_VALUE))&&a(1/0)==1/0),"Math",{acosh:function(t){return(t=+t)<1?NaN:t>94906265.62425156?Math.log(t)+Math.LN2:i(t-1+o(t-1)*o(t+1))}})},function(t,e,n){var r=n(8),i=n(231);r(r.S+r.F*(Number.parseInt!=i),"Number",{parseInt:i})},function(t,e,n){var r=n(8),i=n(230);r(r.S+r.F*(Number.parseFloat!=i),"Number",{parseFloat:i})},function(t,e,n){var r=n(8);r(r.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},function(t,e,n){var r=n(8);r(r.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},function(t,e,n){var r=n(8),i=n(228),o=Math.abs;r(r.S,"Number",{isSafeInteger:function(t){return i(t)&&o(t)<=9007199254740991}})},function(t,e,n){var r=n(8);r(r.S,"Number",{isNaN:function(t){return t!=t}})},function(t,e,n){var r=n(8);r(r.S,"Number",{isInteger:n(228)})},function(t,e,n){var r=n(8),i=n(16).isFinite;r(r.S,"Number",{isFinite:function(t){return"number"==typeof t&&i(t)}})},function(t,e,n){var r=n(8);r(r.S,"Number",{EPSILON:Math.pow(2,-52)})},function(t,e,n){var r=n(8),i=n(15),o=n(229),a=1..toPrecision;r(r.P+r.F*(i((function(){return"1"!==a.call(1,void 0)}))||!i((function(){a.call({})}))),"Number",{toPrecision:function(t){var e=o(this,"Number#toPrecision: incorrect invocation!");return void 0===t?a.call(e):a.call(e,t)}})},function(t,e,n){var r=n(8),i=n(54),o=n(229),a=n(167),s=1..toFixed,u=Math.floor,c=[0,0,0,0,0,0],l="Number.toFixed: incorrect invocation!",f=function(t,e){for(var n=-1,r=e;++n<6;)r+=t*c[n],c[n]=r%1e7,r=u(r/1e7)},h=function(t){for(var e=6,n=0;--e>=0;)n+=c[e],c[e]=u(n/t),n=n%t*1e7},p=function(){for(var t=6,e="";--t>=0;)if(""!==e||0===t||0!==c[t]){var n=String(c[t]);e=""===e?n:e+a.call("0",7-n.length)+n}return e},d=function(t,e,n){return 0===e?n:e%2==1?d(t,e-1,n*t):d(t*t,e/2,n)};r(r.P+r.F*(!!s&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!n(15)((function(){s.call({})}))),"Number",{toFixed:function(t){var e,n,r,s,u=o(this,l),c=i(t),m="",g="0";if(c<0||c>20)throw RangeError(l);if(u!=u)return"NaN";if(u<=-1e21||u>=1e21)return String(u);if(u<0&&(m="-",u=-u),u>1e-21)if(n=(e=function(t){for(var e=0,n=t;n>=4096;)e+=12,n/=4096;for(;n>=2;)e+=1,n/=2;return e}(u*d(2,69,1))-69)<0?u*d(2,-e,1):u/d(2,e,1),n*=4503599627370496,(e=52-e)>0){for(f(0,n),r=c;r>=7;)f(1e7,0),r-=7;for(f(d(10,r,1),0),r=e-1;r>=23;)h(1<<23),r-=23;h(1<0?m+((s=g.length)<=c?"0."+a.call("0",c-s)+g:g.slice(0,s-c)+"."+g.slice(s-c)):m+g}})},function(t,e,n){var r=n(16),i=n(43),o=n(62),a=n(168),s=n(66),u=n(15),c=n(79).f,l=n(53).f,f=n(26).f,h=n(97).trim,p=r.Number,d=p,m=p.prototype,g="Number"==o(n(80)(m)),v="trim"in String.prototype,y=function(t){var e=s(t,!1);if("string"==typeof e&&e.length>2){var n,r,i,o=(e=v?e.trim():h(e,3)).charCodeAt(0);if(43===o||45===o){if(88===(n=e.charCodeAt(2))||120===n)return NaN}else if(48===o){switch(e.charCodeAt(1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+e}for(var a,u=e.slice(2),c=0,l=u.length;ci)return NaN;return parseInt(u,r)}}return+e};if(!p(" 0o1")||!p("0b1")||p("+0x1")){p=function(t){var e=arguments.length<1?0:t,n=this;return n instanceof p&&(g?u((function(){m.valueOf.call(n)})):"Number"!=o(n))?a(new d(y(e)),n,p):y(e)};for(var b,x=n(27)?c(d):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),w=0;x.length>w;w++)i(d,b=x[w])&&!i(p,b)&&f(p,b,l(d,b));p.prototype=m,m.constructor=p,n(38)(r,"Number",p)}},function(t,e,n){var r=n(8),i=n(230);r(r.G+r.F*(parseFloat!=i),{parseFloat:i})},function(t,e,n){var r=n(8),i=n(231);r(r.G+r.F*(parseInt!=i),{parseInt:i})},function(t,e,n){var r=n(13),i=n(78),o=n(19)("hasInstance"),a=Function.prototype;o in a||n(26).f(a,o,{value:function(t){if("function"!=typeof this||!r(t))return!1;if(!r(this.prototype))return t instanceof this;for(;t=i(t);)if(this.prototype===t)return!0;return!1}})},function(t,e,n){var r=n(26).f,i=Function.prototype,o=/^\s*function ([^ (]*)/;"name"in i||n(27)&&r(i,"name",{configurable:!0,get:function(){try{return(""+this).match(o)[1]}catch(t){return""}}})},function(t,e,n){var r=n(8);r(r.P,"Function",{bind:n(233)})},function(t,e,n){var r=n(105),i={};i[n(19)("toStringTag")]="z",i+""!="[object z]"&&n(38)(Object.prototype,"toString",(function(){return"[object "+r(this)+"]"}),!0)},function(t,e,n){var r=n(8);r(r.S,"Object",{setPrototypeOf:n(170).set})},function(t,e,n){var r=n(8);r(r.S,"Object",{is:n(234)})},function(t,e,n){var r=n(8);r(r.S+r.F,"Object",{assign:n(235)})},function(t,e,n){var r=n(13);n(52)("isExtensible",(function(t){return function(e){return!!r(e)&&(!t||t(e))}}))},function(t,e,n){var r=n(13);n(52)("isSealed",(function(t){return function(e){return!r(e)||!!t&&t(e)}}))},function(t,e,n){var r=n(13);n(52)("isFrozen",(function(t){return function(e){return!r(e)||!!t&&t(e)}}))},function(t,e,n){var r=n(13),i=n(65).onFreeze;n(52)("preventExtensions",(function(t){return function(e){return t&&r(e)?t(i(e)):e}}))},function(t,e,n){var r=n(13),i=n(65).onFreeze;n(52)("seal",(function(t){return function(e){return t&&r(e)?t(i(e)):e}}))},function(t,e,n){var r=n(13),i=n(65).onFreeze;n(52)("freeze",(function(t){return function(e){return t&&r(e)?t(i(e)):e}}))},function(t,e,n){n(52)("getOwnPropertyNames",(function(){return n(236).f}))},function(t,e,n){var r=n(34),i=n(82);n(52)("keys",(function(){return function(t){return i(r(t))}}))},function(t,e,n){var r=n(34),i=n(78);n(52)("getPrototypeOf",(function(){return function(t){return i(r(t))}}))},function(t,e,n){var r=n(41),i=n(53).f;n(52)("getOwnPropertyDescriptor",(function(){return function(t,e){return i(r(t),e)}}))},function(t,e,n){var r=n(8);r(r.S+r.F*!n(27),"Object",{defineProperties:n(237)})},function(t,e,n){var r=n(8);r(r.S+r.F*!n(27),"Object",{defineProperty:n(26).f})},function(t,e,n){var r=n(8);r(r.S,"Object",{create:n(80)})},function(t,e,n){var r=n(82),i=n(127),o=n(106);t.exports=function(t){var e=r(t),n=i.f;if(n)for(var a,s=n(t),u=o.f,c=0;s.length>c;)u.call(t,a=s[c++])&&e.push(a);return e}},function(t,e,n){t.exports=n(129)("native-function-to-string",Function.toString)},function(t,e,n){var r=n(16),i=n(43),o=n(27),a=n(8),s=n(38),u=n(65).KEY,c=n(15),l=n(129),f=n(98),h=n(84),p=n(19),d=n(174),m=n(239),g=n(575),v=n(126),y=n(14),b=n(13),x=n(34),w=n(41),k=n(66),E=n(85),C=n(80),S=n(236),A=n(53),O=n(127),_=n(26),N=n(82),T=A.f,D=_.f,I=S.f,R=r.Symbol,F=r.JSON,M=F&&F.stringify,B=p("_hidden"),z=p("toPrimitive"),j={}.propertyIsEnumerable,P=l("symbol-registry"),L=l("symbols"),W=l("op-symbols"),U=Object.prototype,V="function"==typeof R&&!!O.f,q=r.QObject,H=!q||!q.prototype||!q.prototype.findChild,G=o&&c((function(){return 7!=C(D({},"a",{get:function(){return D(this,"a",{value:7}).a}})).a}))?function(t,e,n){var r=T(U,e);r&&delete U[e],D(t,e,n),r&&t!==U&&D(U,e,r)}:D,$=function(t){var e=L[t]=C(R.prototype);return e._k=t,e},K=V&&"symbol"==typeof R.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof R},X=function(t,e,n){return t===U&&X(W,e,n),y(t),e=k(e,!0),y(n),i(L,e)?(n.enumerable?(i(t,B)&&t[B][e]&&(t[B][e]=!1),n=C(n,{enumerable:E(0,!1)})):(i(t,B)||D(t,B,E(1,{})),t[B][e]=!0),G(t,e,n)):D(t,e,n)},Y=function(t,e){y(t);for(var n,r=g(e=w(e)),i=0,o=r.length;o>i;)X(t,n=r[i++],e[n]);return t},J=function(t){var e=j.call(this,t=k(t,!0));return!(this===U&&i(L,t)&&!i(W,t))&&(!(e||!i(this,t)||!i(L,t)||i(this,B)&&this[B][t])||e)},Z=function(t,e){if(t=w(t),e=k(e,!0),t!==U||!i(L,e)||i(W,e)){var n=T(t,e);return!n||!i(L,e)||i(t,B)&&t[B][e]||(n.enumerable=!0),n}},Q=function(t){for(var e,n=I(w(t)),r=[],o=0;n.length>o;)i(L,e=n[o++])||e==B||e==u||r.push(e);return r},tt=function(t){for(var e,n=t===U,r=I(n?W:w(t)),o=[],a=0;r.length>a;)!i(L,e=r[a++])||n&&!i(U,e)||o.push(L[e]);return o};V||(s((R=function(){if(this instanceof R)throw TypeError("Symbol is not a constructor!");var t=h(arguments.length>0?arguments[0]:void 0),e=function(n){this===U&&e.call(W,n),i(this,B)&&i(this[B],t)&&(this[B][t]=!1),G(this,t,E(1,n))};return o&&H&&G(U,t,{configurable:!0,set:e}),$(t)}).prototype,"toString",(function(){return this._k})),A.f=Z,_.f=X,n(79).f=S.f=Q,n(106).f=J,O.f=tt,o&&!n(83)&&s(U,"propertyIsEnumerable",J,!0),d.f=function(t){return $(p(t))}),a(a.G+a.W+a.F*!V,{Symbol:R});for(var et="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),nt=0;et.length>nt;)p(et[nt++]);for(var rt=N(p.store),it=0;rt.length>it;)m(rt[it++]);a(a.S+a.F*!V,"Symbol",{for:function(t){return i(P,t+="")?P[t]:P[t]=R(t)},keyFor:function(t){if(!K(t))throw TypeError(t+" is not a symbol!");for(var e in P)if(P[e]===t)return e},useSetter:function(){H=!0},useSimple:function(){H=!1}}),a(a.S+a.F*!V,"Object",{create:function(t,e){return void 0===e?C(t):Y(C(t),e)},defineProperty:X,defineProperties:Y,getOwnPropertyDescriptor:Z,getOwnPropertyNames:Q,getOwnPropertySymbols:tt});var ot=c((function(){O.f(1)}));a(a.S+a.F*ot,"Object",{getOwnPropertySymbols:function(t){return O.f(x(t))}}),F&&a(a.S+a.F*(!V||c((function(){var t=R();return"[null]"!=M([t])||"{}"!=M({a:t})||"{}"!=M(Object(t))}))),"JSON",{stringify:function(t){for(var e,n,r=[t],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=e=r[1],(b(e)||void 0!==t)&&!K(t))return v(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!K(e))return e}),r[1]=e,M.apply(F,r)}}),R.prototype[z]||n(42)(R.prototype,z,R.prototype.valueOf),f(R,"Symbol"),f(Math,"Math",!0),f(r.JSON,"JSON",!0)},function(t,e,n){n(577),n(574),n(573),n(572),n(571),n(570),n(569),n(568),n(567),n(566),n(565),n(564),n(563),n(562),n(561),n(560),n(559),n(558),n(557),n(556),n(555),n(554),n(553),n(552),n(551),n(550),n(549),n(548),n(547),n(546),n(545),n(544),n(543),n(542),n(541),n(540),n(539),n(538),n(537),n(536),n(535),n(534),n(533),n(531),n(530),n(529),n(528),n(527),n(526),n(525),n(524),n(523),n(522),n(521),n(520),n(519),n(518),n(517),n(516),n(515),n(514),n(513),n(512),n(511),n(510),n(509),n(508),n(507),n(506),n(505),n(504),n(503),n(502),n(501),n(500),n(499),n(498),n(496),n(495),n(493),n(492),n(491),n(490),n(489),n(488),n(487),n(485),n(484),n(483),n(482),n(481),n(480),n(479),n(478),n(477),n(476),n(475),n(474),n(473),n(155),n(472),n(220),n(471),n(219),n(470),n(469),n(468),n(467),n(218),n(464),n(463),n(462),n(461),n(460),n(459),n(458),n(457),n(456),n(455),n(454),n(453),n(452),n(451),n(450),n(449),n(448),n(447),n(446),n(445),n(444),n(443),n(442),n(441),n(440),n(439),n(438),n(437),n(436),t.exports=n(24)},function(t,e,n){n(578),n(435),n(433),n(430),n(428),n(426),n(424),n(422),n(420),n(418),n(416),n(414),n(412),n(408)},function(t,e,n){n(579);var r=function(t){return t&&t.__esModule?t:{default:t}}(n(407));r.default._babelPolyfill&&"undefined"!=typeof console&&console.warn&&console.warn("@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning."),r.default._babelPolyfill=!0},function(t,e,n){n(580),t.exports=n(248)},function(t,e,n){var r={},i={},o=34,a=10,s=13;function u(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function c(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var r in t)r in e||n.push(e[r]=r)})),n}function l(t,e){var n=t+"",r=n.length;return r9999?"+"+l(t,6):l(t,4)}(t.getUTCFullYear())+"-"+l(t.getUTCMonth()+1,2)+"-"+l(t.getUTCDate(),2)+(i?"T"+l(e,2)+":"+l(n,2)+":"+l(r,2)+"."+l(i,3)+"Z":r?"T"+l(e,2)+":"+l(n,2)+":"+l(r,2)+"Z":n||e?"T"+l(e,2)+":"+l(n,2)+"Z":"")}e.a=function(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function l(t,e){var u,c=[],l=t.length,f=0,h=0,p=l<=0,d=!1;function m(){if(p)return i;if(d)return d=!1,r;var e,u,c=f;if(t.charCodeAt(c)===o){for(;f++=l?p=!0:(u=t.charCodeAt(f++))===a?d=!0:u===s&&(d=!0,t.charCodeAt(f)===a&&++f),t.slice(c+1,e-1).replace(/""/g,'"')}for(;f>1,l=-7,f=n?i-1:0,h=n?-1:1,p=t[e+f];for(f+=h,o=p&(1<<-l)-1,p>>=-l,l+=s;l>0;o=256*o+t[e+f],f+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+t[e+f],f+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),o-=c}return(p?-1:1)*a*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(e*u-1)*Math.pow(2,i),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;t[n+p]=255&s,p+=d,s/=256,i-=8);for(a=a<0;t[n+p]=255&a,p+=d,a/=256,c-=8);t[n+p-d]|=128*m}},function(t,e,n){e.byteLength=function(t){var e=c(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,r=c(t),a=r[0],s=r[1],u=new o(function(t,e,n){return 3*(e+n)/4-n}(0,a,s)),l=0,f=s>0?a-4:a;for(n=0;n>16&255,u[l++]=e>>8&255,u[l++]=255&e;return 2===s&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,u[l++]=255&e),1===s&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e),u},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],a=0,s=n-i;as?s:a+16383));return 1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function l(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function f(t,e,n){for(var r,i=[],o=e;o=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:N(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}(t.exports);try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},function(t,e,n){for(var r=n(155),i=n(82),o=n(38),a=n(16),s=n(42),u=n(96),c=n(19),l=c("iterator"),f=c("toStringTag"),h=u.Array,p={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},d=i(p),m=0;m2,i=!!r&&a.call(arguments,2);return t(r?function(){("function"==typeof e?e:Function(e)).apply(this,i)}:e,n)}};i(i.G+i.B+i.F*s,{setTimeout:u(r.setTimeout),setInterval:u(r.setInterval)})},function(t,e,n){n(411),n(410),n(409),t.exports=n(24)},function(t,e,n){var r=n(8),i=n(24),o=n(16),a=n(104),s=n(216);r(r.P+r.R,"Promise",{finally:function(t){var e=a(this,i.Promise||o.Promise),n="function"==typeof t;return this.then(n?function(n){return s(e,t()).then((function(){return n}))}:t,n?function(n){return s(e,t()).then((function(){throw n}))}:t)}})},function(t,e,n){n(218),n(413),t.exports=n(24).Promise.finally},function(t,e,n){var r=n(8),i=n(210)(!0);r(r.S,"Object",{entries:function(t){return i(t)}})},function(t,e,n){n(415),t.exports=n(24).Object.entries},function(t,e,n){var r=n(8),i=n(210)(!1);r(r.S,"Object",{values:function(t){return i(t)}})},function(t,e,n){n(417),t.exports=n(24).Object.values},function(t,e,n){var r=n(8),i=n(212),o=n(41),a=n(53),s=n(158);r(r.S,"Object",{getOwnPropertyDescriptors:function(t){for(var e,n,r=o(t),u=a.f,c=i(r),l={},f=0;c.length>f;)void 0!==(n=u(r,e=c[f++]))&&s(l,e,n);return l}})},function(t,e,n){n(419),t.exports=n(24).Object.getOwnPropertyDescriptors},function(t,e,n){n(239)("asyncIterator")},function(t,e,n){n(421),t.exports=n(174).f("asyncIterator")},function(t,e,n){n(97)("trimRight",(function(t){return function(){return t(this,2)}}),"trimEnd")},function(t,e,n){n(423),t.exports=n(24).String.trimRight},function(t,e,n){n(97)("trimLeft",(function(t){return function(){return t(this,1)}}),"trimStart")},function(t,e,n){n(425),t.exports=n(24).String.trimLeft},function(t,e,n){var r=n(8),i=n(211),o=n(120),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(o);r(r.P+r.F*a,"String",{padEnd:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0,!1)}})},function(t,e,n){n(427),t.exports=n(24).String.padEnd},function(t,e,n){var r=n(8),i=n(211),o=n(120),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(o);r(r.P+r.F*a,"String",{padStart:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0,!0)}})},function(t,e,n){n(429),t.exports=n(24).String.padStart},function(t,e,n){var r=n(126),i=n(13),o=n(22),a=n(56),s=n(19)("isConcatSpreadable");t.exports=function t(e,n,u,c,l,f,h,p){for(var d,m,g=l,v=0,y=!!h&&a(h,p,3);v0)g=t(e,n,d,o(d.length),g,f-1)-1;else{if(g>=9007199254740991)throw TypeError();e[g]=d}g++}v++}return g}},function(t,e,n){var r=n(8),i=n(431),o=n(34),a=n(22),s=n(55),u=n(224);r(r.P,"Array",{flatMap:function(t){var e,n,r=o(this);return s(t),e=a(r.length),n=u(r,0),i(n,r,r,e,0,1,t,arguments[1]),n}}),n(77)("flatMap")},function(t,e,n){n(432),t.exports=n(24).Array.flatMap},function(t,e,n){var r=n(8),i=n(128)(!0);r(r.P,"Array",{includes:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(77)("includes")},function(t,e,n){n(434),t.exports=n(24).Array.includes},function(t,e,n){var r=n(8),i=n(170);i&&r(r.S,"Reflect",{setPrototypeOf:function(t,e){i.check(t,e);try{return i.set(t,e),!0}catch(t){return!1}}})},function(t,e,n){var r=n(26),i=n(53),o=n(78),a=n(43),s=n(8),u=n(85),c=n(14),l=n(13);s(s.S,"Reflect",{set:function t(e,n,s){var f,h,p=arguments.length<4?e:arguments[3],d=i.f(c(e),n);if(!d){if(l(h=o(e)))return t(h,n,s,p);d=u(0)}if(a(d,"value")){if(!1===d.writable||!l(p))return!1;if(f=i.f(p,n)){if(f.get||f.set||!1===f.writable)return!1;f.value=s,r.f(p,n,f)}else r.f(p,n,u(0,s));return!0}return void 0!==d.set&&(d.set.call(p,s),!0)}})},function(t,e,n){var r=n(8),i=n(14),o=Object.preventExtensions;r(r.S,"Reflect",{preventExtensions:function(t){i(t);try{return o&&o(t),!0}catch(t){return!1}}})},function(t,e,n){var r=n(8);r(r.S,"Reflect",{ownKeys:n(212)})},function(t,e,n){var r=n(8),i=n(14),o=Object.isExtensible;r(r.S,"Reflect",{isExtensible:function(t){return i(t),!o||o(t)}})},function(t,e,n){var r=n(8);r(r.S,"Reflect",{has:function(t,e){return e in t}})},function(t,e,n){var r=n(8),i=n(78),o=n(14);r(r.S,"Reflect",{getPrototypeOf:function(t){return i(o(t))}})},function(t,e,n){var r=n(53),i=n(8),o=n(14);i(i.S,"Reflect",{getOwnPropertyDescriptor:function(t,e){return r.f(o(t),e)}})},function(t,e,n){var r=n(53),i=n(78),o=n(43),a=n(8),s=n(13),u=n(14);a(a.S,"Reflect",{get:function t(e,n){var a,c,l=arguments.length<3?e:arguments[2];return u(e)===l?e[n]:(a=r.f(e,n))?o(a,"value")?a.value:void 0!==a.get?a.get.call(l):void 0:s(c=i(e))?t(c,n,l):void 0}})},function(t,e,n){var r=n(8),i=n(14),o=function(t){this._t=i(t),this._i=0;var e,n=this._k=[];for(e in t)n.push(e)};n(226)(o,"Object",(function(){var t,e=this._k;do{if(this._i>=e.length)return{value:void 0,done:!0}}while(!((t=e[this._i++])in this._t));return{value:t,done:!1}})),r(r.S,"Reflect",{enumerate:function(t){return new o(t)}})},function(t,e,n){var r=n(8),i=n(53).f,o=n(14);r(r.S,"Reflect",{deleteProperty:function(t,e){var n=i(o(t),e);return!(n&&!n.configurable)&&delete t[e]}})},function(t,e,n){var r=n(26),i=n(8),o=n(14),a=n(66);i(i.S+i.F*n(15)((function(){Reflect.defineProperty(r.f({},1,{value:1}),1,{value:2})})),"Reflect",{defineProperty:function(t,e,n){o(t),e=a(e,!0),o(n);try{return r.f(t,e,n),!0}catch(t){return!1}}})},function(t,e,n){var r=n(8),i=n(80),o=n(55),a=n(14),s=n(13),u=n(15),c=n(233),l=(n(16).Reflect||{}).construct,f=u((function(){function t(){}return!(l((function(){}),[],t)instanceof t)})),h=!u((function(){l((function(){}))}));r(r.S+r.F*(f||h),"Reflect",{construct:function(t,e){o(t),a(e);var n=arguments.length<3?t:o(arguments[2]);if(h&&!f)return l(t,e,n);if(t==n){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var r=[null];return r.push.apply(r,e),new(c.apply(t,r))}var u=n.prototype,p=i(s(u)?u:Object.prototype),d=Function.apply.call(t,p,e);return s(d)?d:p}})},function(t,e,n){var r=n(8),i=n(55),o=n(14),a=(n(16).Reflect||{}).apply,s=Function.apply;r(r.S+r.F*!n(15)((function(){a((function(){}))})),"Reflect",{apply:function(t,e,n){var r=i(t),u=o(n);return a?a(r,e,u):s.call(r,e,u)}})},function(t,e,n){n(60)("Float64",8,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},function(t,e,n){n(60)("Float32",4,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},function(t,e,n){n(60)("Uint32",4,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},function(t,e,n){n(60)("Int32",4,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},function(t,e,n){n(60)("Uint16",2,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},function(t,e,n){n(60)("Int16",2,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},function(t,e,n){n(60)("Uint8",1,(function(t){return function(e,n,r){return t(this,e,n,r)}}),!0)},function(t,e,n){n(60)("Uint8",1,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},function(t,e,n){n(60)("Int8",1,(function(t){return function(e,n,r){return t(this,e,n,r)}}))},function(t,e,n){var r=n(8);r(r.G+r.W+r.F*!n(118).ABV,{DataView:n(151).DataView})},function(t,e,n){var r=n(8),i=n(118),o=n(151),a=n(14),s=n(81),u=n(22),c=n(13),l=n(16).ArrayBuffer,f=n(104),h=o.ArrayBuffer,p=o.DataView,d=i.ABV&&l.isView,m=h.prototype.slice,g=i.VIEW;r(r.G+r.W+r.F*(l!==h),{ArrayBuffer:h}),r(r.S+r.F*!i.CONSTR,"ArrayBuffer",{isView:function(t){return d&&d(t)||c(t)&&g in t}}),r(r.P+r.U+r.F*n(15)((function(){return!new h(2).slice(1,void 0).byteLength})),"ArrayBuffer",{slice:function(t,e){if(void 0!==m&&void 0===e)return m.call(a(this),t);for(var n=a(this).byteLength,r=s(t,n),i=s(void 0===e?n:e,n),o=new(f(this,h))(u(i-r)),c=new p(this),l=new p(o),d=0;r0?arguments[0]:void 0)}}),{add:function(t){return r.def(i(this,"WeakSet"),t,!0)}},r,!1,!0)},function(t,e,n){var r,i=n(16),o=n(51)(0),a=n(38),s=n(65),u=n(235),c=n(214),l=n(13),f=n(76),h=n(76),p=!i.ActiveXObject&&"ActiveXObject"in i,d=s.getWeak,m=Object.isExtensible,g=c.ufstore,v=function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},y={get:function(t){if(l(t)){var e=d(t);return!0===e?g(f(this,"WeakMap")).get(t):e?e[this._i]:void 0}},set:function(t,e){return c.def(f(this,"WeakMap"),t,e)}},b=t.exports=n(119)("WeakMap",v,y,c,!0,!0);h&&p&&(u((r=c.getConstructor(v,"WeakMap")).prototype,y),s.NEED=!0,o(["delete","has","get","set"],(function(t){var e=b.prototype,n=e[t];a(e,t,(function(e,i){if(l(e)&&!m(e)){this._f||(this._f=new r);var o=this._f[t](e,i);return"set"==t?this:o}return n.call(this,e,i)}))})))},function(t,e,n){var r=n(215),i=n(76);t.exports=n(119)("Set",(function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}}),{add:function(t){return r.def(i(this,"Set"),t=0===t?0:t,t)}},r)},function(t,e,n){var r=n(215),i=n(76);t.exports=n(119)("Map",(function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}}),{get:function(t){var e=r.getEntry(i(this,"Map"),t);return e&&e.v},set:function(t,e){return r.def(i(this,"Map"),0===t?0:t,e)}},r,!0)},function(t,e){t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},function(t,e,n){var r=n(16),i=n(152).set,o=r.MutationObserver||r.WebKitMutationObserver,a=r.process,s=r.Promise,u="process"==n(62)(a);t.exports=function(){var t,e,n,c=function(){var r,i;for(u&&(r=a.domain)&&r.exit();t;){i=t.fn,t=t.next;try{i()}catch(r){throw t?n():e=void 0,r}}e=void 0,r&&r.enter()};if(u)n=function(){a.nextTick(c)};else if(!o||r.navigator&&r.navigator.standalone)if(s&&s.resolve){var l=s.resolve(void 0);n=function(){l.then(c)}}else n=function(){i.call(r,c)};else{var f=!0,h=document.createTextNode("");new o(c).observe(h,{characterData:!0}),n=function(){h.data=f=!f}}return function(r){var i={fn:r,next:void 0};e&&(e.next=i),t||(t=i,n()),e=i}}},function(t,e,n){var r=n(161),i=n(14),o=n(104),a=n(153),s=n(22),u=n(123),c=n(154),l=n(15),f=Math.min,h=[].push,p=!l((function(){}));n(122)("split",2,(function(t,e,n,l){var d;return d="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,e){var i=String(this);if(void 0===t&&0===e)return[];if(!r(t))return n.call(i,t,e);for(var o,a,s,u=[],l=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),f=0,p=void 0===e?4294967295:e>>>0,d=new RegExp(t.source,l+"g");(o=c.call(d,i))&&!((a=d.lastIndex)>f&&(u.push(i.slice(f,o.index)),o.length>1&&o.index=p));)d.lastIndex===o.index&&d.lastIndex++;return f===i.length?!s&&d.test("")||u.push(""):u.push(i.slice(f)),u.length>p?u.slice(0,p):u}:"0".split(void 0,0).length?function(t,e){return void 0===t&&0===e?[]:n.call(this,t,e)}:n,[function(n,r){var i=t(this),o=null==n?void 0:n[e];return void 0!==o?o.call(n,i,r):d.call(String(i),n,r)},function(t,e){var r=l(d,t,this,e,d!==n);if(r.done)return r.value;var c=i(t),h=String(this),m=o(c,RegExp),g=c.unicode,v=(c.ignoreCase?"i":"")+(c.multiline?"m":"")+(c.unicode?"u":"")+(p?"y":"g"),y=new m(p?c:"^(?:"+c.source+")",v),b=void 0===e?4294967295:e>>>0;if(0===b)return[];if(0===h.length)return null===u(y,h)?[h]:[];for(var x=0,w=0,k=[];w]*>)/g,p=/\$([$&`']|\d\d?)/g,d=function(t){return void 0===t?t:String(t)};n(122)("replace",2,(function(t,e,n,m){return[function(r,i){var o=t(this),a=null==r?void 0:r[e];return void 0!==a?a.call(r,o,i):n.call(String(o),r,i)},function(t,e){var i=m(n,t,this,e);if(i.done)return i.value;var f=r(t),h=String(this),p="function"==typeof e;p||(e=String(e));var v=f.global;if(v){var y=f.unicode;f.lastIndex=0}for(var b=[];;){var x=u(f,h);if(null===x)break;if(b.push(x),!v)break;""===String(x[0])&&(f.lastIndex=s(h,o(f.lastIndex),y))}for(var w="",k=0,E=0;E=k&&(w+=h.slice(k,S)+T,k=S+C.length)}return w+h.slice(k)}];function g(t,e,r,o,a,s){var u=r+t.length,c=o.length,l=p;return void 0!==a&&(a=i(a),l=h),n.call(s,l,(function(n,i){var s;switch(i.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,r);case"'":return e.slice(u);case"<":s=a[i.slice(1,-1)];break;default:var l=+i;if(0===l)return n;if(l>c){var h=f(l/10);return 0===h?n:h<=c?void 0===o[h-1]?i.charAt(1):o[h-1]+i.charAt(1):n}s=o[l-1]}return void 0===s?"":s}))}}))},function(t,e,n){var r=n(14),i=n(22),o=n(153),a=n(123);n(122)("match",1,(function(t,e,n,s){return[function(n){var r=t(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,r):new RegExp(n)[e](String(r))},function(t){var e=s(n,t,this);if(e.done)return e.value;var u=r(t),c=String(this);if(!u.global)return a(u,c);var l=u.unicode;u.lastIndex=0;for(var f,h=[],p=0;null!==(f=a(u,c));){var d=String(f[0]);h[p]=d,""===d&&(u.lastIndex=o(c,i(u.lastIndex),l)),p++}return 0===p?null:h}]}))},function(t,e,n){n(219);var r=n(14),i=n(124),o=n(27),a=/./.toString,s=function(t){n(38)(RegExp.prototype,"toString",t,!0)};n(15)((function(){return"/a/b"!=a.call({source:"a",flags:"b"})}))?s((function(){var t=r(this);return"/".concat(t.source,"/","flags"in t?t.flags:!o&&t instanceof RegExp?i.call(t):void 0)})):"toString"!=a.name&&s((function(){return a.call(this)}))},function(t,e,n){var r=n(16),i=n(168),o=n(26).f,a=n(79).f,s=n(161),u=n(124),c=r.RegExp,l=c,f=c.prototype,h=/a/g,p=/a/g,d=new c(h)!==h;if(n(27)&&(!d||n(15)((function(){return p[n(19)("match")]=!1,c(h)!=h||c(p)==p||"/a/i"!=c(h,"i")})))){c=function(t,e){var n=this instanceof c,r=s(t),o=void 0===e;return!n&&r&&t.constructor===c&&o?t:i(d?new l(r&&!o?t.source:t,e):l((r=t instanceof c)?t.source:t,r&&o?u.call(t):e),n?this:f,c)};for(var m=function(t){t in c||o(c,t,{configurable:!0,get:function(){return l[t]},set:function(e){l[t]=e}})},g=a(l),v=0;g.length>v;)m(g[v++]);f.constructor=c,c.prototype=f,n(38)(r,"RegExp",c)}n(95)("RegExp")},function(t,e,n){n(95)("Array")},function(t,e,n){var r=n(8),i=n(51)(6),o="findIndex",a=!0;o in[]&&Array(1)[o]((function(){a=!1})),r(r.P+r.F*a,"Array",{findIndex:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(77)(o)},function(t,e,n){var r=n(8),i=n(51)(5),o=!0;"find"in[]&&Array(1).find((function(){o=!1})),r(r.P+r.F*o,"Array",{find:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(77)("find")},function(t,e,n){var r=n(8);r(r.P,"Array",{fill:n(156)}),n(77)("fill")},function(t,e,n){var r=n(8);r(r.P,"Array",{copyWithin:n(222)}),n(77)("copyWithin")},function(t,e,n){var r=n(8),i=n(41),o=n(54),a=n(22),s=[].lastIndexOf,u=!!s&&1/[1].lastIndexOf(1,-0)<0;r(r.P+r.F*(u||!n(49)(s)),"Array",{lastIndexOf:function(t){if(u)return s.apply(this,arguments)||0;var e=i(this),n=a(e.length),r=n-1;for(arguments.length>1&&(r=Math.min(r,o(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in e&&e[r]===t)return r||0;return-1}})},function(t,e,n){var r=n(8),i=n(128)(!1),o=[].indexOf,a=!!o&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(a||!n(49)(o)),"Array",{indexOf:function(t){return a?o.apply(this,arguments)||0:i(this,t,arguments[1])}})},function(t,e,n){var r=n(8),i=n(223);r(r.P+r.F*!n(49)([].reduceRight,!0),"Array",{reduceRight:function(t){return i(this,t,arguments.length,arguments[1],!0)}})},function(t,e,n){var r=n(8),i=n(223);r(r.P+r.F*!n(49)([].reduce,!0),"Array",{reduce:function(t){return i(this,t,arguments.length,arguments[1],!1)}})},function(t,e,n){var r=n(8),i=n(51)(4);r(r.P+r.F*!n(49)([].every,!0),"Array",{every:function(t){return i(this,t,arguments[1])}})},function(t,e,n){var r=n(8),i=n(51)(3);r(r.P+r.F*!n(49)([].some,!0),"Array",{some:function(t){return i(this,t,arguments[1])}})},function(t,e,n){var r=n(8),i=n(51)(2);r(r.P+r.F*!n(49)([].filter,!0),"Array",{filter:function(t){return i(this,t,arguments[1])}})},function(t,e,n){var r=n(8),i=n(51)(1);r(r.P+r.F*!n(49)([].map,!0),"Array",{map:function(t){return i(this,t,arguments[1])}})},function(t,e,n){var r=n(13),i=n(126),o=n(19)("species");t.exports=function(t){var e;return i(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!i(e.prototype)||(e=void 0),r(e)&&null===(e=e[o])&&(e=void 0)),void 0===e?Array:e}},function(t,e,n){var r=n(8),i=n(51)(0),o=n(49)([].forEach,!0);r(r.P+r.F*!o,"Array",{forEach:function(t){return i(this,t,arguments[1])}})},function(t,e,n){var r=n(8),i=n(55),o=n(34),a=n(15),s=[].sort,u=[1,2,3];r(r.P+r.F*(a((function(){u.sort(void 0)}))||!a((function(){u.sort(null)}))||!n(49)(s)),"Array",{sort:function(t){return void 0===t?s.call(o(this)):s.call(o(this),i(t))}})},function(t,e,n){var r=n(8),i=n(171),o=n(62),a=n(81),s=n(22),u=[].slice;r(r.P+r.F*n(15)((function(){i&&u.call(i)})),"Array",{slice:function(t,e){var n=s(this.length),r=o(this);if(e=void 0===e?n:e,"Array"==r)return u.call(this,t,e);for(var i=a(t,n),c=a(e,n),l=s(c-i),f=new Array(l),h=0;ht;)i(n,t,arguments[t++]);return n.length=e,n}})},function(t,e,n){var r=n(56),i=n(8),o=n(34),a=n(225),s=n(159),u=n(22),c=n(158),l=n(157);i(i.S+i.F*!n(125)((function(t){Array.from(t)})),"Array",{from:function(t){var e,n,i,f,h=o(t),p="function"==typeof this?this:Array,d=arguments.length,m=d>1?arguments[1]:void 0,g=void 0!==m,v=0,y=l(h);if(g&&(m=r(m,d>2?arguments[2]:void 0,2)),null==y||p==Array&&s(y))for(n=new p(e=u(h.length));e>v;v++)c(n,v,g?m(h[v],v):h[v]);else for(f=y.call(h),n=new p;!(i=f.next()).done;v++)c(n,v,g?a(f,m,[i.value,v],!0):i.value);return n.length=v,n}})},function(t,e,n){var r=n(8);r(r.S,"Array",{isArray:n(126)})},function(t,e,n){var r=n(14),i=n(66);t.exports=function(t){if("string"!==t&&"number"!==t&&"default"!==t)throw TypeError("Incorrect hint");return i(r(this),"number"!=t)}},function(t,e,n){var r=n(19)("toPrimitive"),i=Date.prototype;r in i||n(42)(i,r,n(494))},function(t,e,n){var r=Date.prototype,i=r.toString,o=r.getTime;new Date(NaN)+""!="Invalid Date"&&n(38)(r,"toString",(function(){var t=o.call(this);return t==t?i.call(this):"Invalid Date"}))},function(t,e,n){var r=n(15),i=Date.prototype.getTime,o=Date.prototype.toISOString,a=function(t){return t>9?t:"0"+t};t.exports=r((function(){return"0385-07-25T07:06:39.999Z"!=o.call(new Date(-50000000000001))}))||!r((function(){o.call(new Date(NaN))}))?function(){if(!isFinite(i.call(this)))throw RangeError("Invalid time value");var t=this,e=t.getUTCFullYear(),n=t.getUTCMilliseconds(),r=e<0?"-":e>9999?"+":"";return r+("00000"+Math.abs(e)).slice(r?-6:-4)+"-"+a(t.getUTCMonth()+1)+"-"+a(t.getUTCDate())+"T"+a(t.getUTCHours())+":"+a(t.getUTCMinutes())+":"+a(t.getUTCSeconds())+"."+(n>99?n:"0"+a(n))+"Z"}:o},function(t,e,n){var r=n(8),i=n(497);r(r.P+r.F*(Date.prototype.toISOString!==i),"Date",{toISOString:i})},function(t,e,n){var r=n(8),i=n(34),o=n(66);r(r.P+r.F*n(15)((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})})),"Date",{toJSON:function(t){var e=i(this),n=o(e);return"number"!=typeof n||isFinite(n)?e.toISOString():null}})},function(t,e,n){var r=n(8);r(r.S,"Date",{now:function(){return(new Date).getTime()}})},function(t,e,n){n(37)("sup",(function(t){return function(){return t(this,"sup","","")}}))},function(t,e,n){n(37)("sub",(function(t){return function(){return t(this,"sub","","")}}))},function(t,e,n){n(37)("strike",(function(t){return function(){return t(this,"strike","","")}}))},function(t,e,n){n(37)("small",(function(t){return function(){return t(this,"small","","")}}))},function(t,e,n){n(37)("link",(function(t){return function(e){return t(this,"a","href",e)}}))},function(t,e,n){n(37)("italics",(function(t){return function(){return t(this,"i","","")}}))},function(t,e,n){n(37)("fontsize",(function(t){return function(e){return t(this,"font","size",e)}}))},function(t,e,n){n(37)("fontcolor",(function(t){return function(e){return t(this,"font","color",e)}}))},function(t,e,n){n(37)("fixed",(function(t){return function(){return t(this,"tt","","")}}))},function(t,e,n){n(37)("bold",(function(t){return function(){return t(this,"b","","")}}))},function(t,e,n){n(37)("blink",(function(t){return function(){return t(this,"blink","","")}}))},function(t,e,n){n(37)("big",(function(t){return function(){return t(this,"big","","")}}))},function(t,e,n){n(37)("anchor",(function(t){return function(e){return t(this,"a","name",e)}}))},function(t,e,n){var r=n(8),i=n(22),o=n(162),a="".startsWith;r(r.P+r.F*n(160)("startsWith"),"String",{startsWith:function(t){var e=o(this,t,"startsWith"),n=i(Math.min(arguments.length>1?arguments[1]:void 0,e.length)),r=String(t);return a?a.call(e,r,n):e.slice(n,n+r.length)===r}})},function(t,e,n){var r=n(8);r(r.P,"String",{repeat:n(167)})},function(t,e,n){var r=n(8),i=n(162);r(r.P+r.F*n(160)("includes"),"String",{includes:function(t){return!!~i(this,t,"includes").indexOf(t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(8),i=n(22),o=n(162),a="".endsWith;r(r.P+r.F*n(160)("endsWith"),"String",{endsWith:function(t){var e=o(this,t,"endsWith"),n=arguments.length>1?arguments[1]:void 0,r=i(e.length),s=void 0===n?r:Math.min(i(n),r),u=String(t);return a?a.call(e,u,s):e.slice(s-u.length,s)===u}})},function(t,e,n){var r=n(8),i=n(164)(!1);r(r.P,"String",{codePointAt:function(t){return i(this,t)}})},function(t,e,n){var r=n(164)(!0);n(163)(String,"String",(function(t){this._t=String(t),this._i=0}),(function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})}))},function(t,e,n){n(97)("trim",(function(t){return function(){return t(this,3)}}))},function(t,e,n){var r=n(8),i=n(41),o=n(22);r(r.S,"String",{raw:function(t){for(var e=i(t.raw),n=o(e.length),r=arguments.length,a=[],s=0;n>s;)a.push(String(e[s++])),sa;){if(e=+arguments[a++],i(e,1114111)!==e)throw RangeError(e+" is not a valid code point");n.push(e<65536?o(e):o(55296+((e-=65536)>>10),e%1024+56320))}return n.join("")}})},function(t,e,n){var r=n(8);r(r.S,"Math",{trunc:function(t){return(t>0?Math.floor:Math.ceil)(t)}})},function(t,e,n){var r=n(8),i=n(165),o=Math.exp;r(r.S,"Math",{tanh:function(t){var e=i(t=+t),n=i(-t);return e==1/0?1:n==1/0?-1:(e-n)/(o(t)+o(-t))}})},function(t,e,n){var r=n(8),i=n(165),o=Math.exp;r(r.S+r.F*n(15)((function(){return-2e-17!=!Math.sinh(-2e-17)})),"Math",{sinh:function(t){return Math.abs(t=+t)<1?(i(t)-i(-t))/2:(o(t-1)-o(-t-1))*(Math.E/2)}})},function(t,e,n){var r=n(8);r(r.S,"Math",{sign:n(166)})},function(t,e,n){var r=n(8);r(r.S,"Math",{log2:function(t){return Math.log(t)/Math.LN2}})},function(t,e,n){var r=n(8);r(r.S,"Math",{log1p:n(227)})},function(t,e,n){var r=n(8);r(r.S,"Math",{log10:function(t){return Math.log(t)*Math.LOG10E}})},function(t,e,n){var r=n(8),i=Math.imul;r(r.S+r.F*n(15)((function(){return-5!=i(4294967295,5)||2!=i.length})),"Math",{imul:function(t,e){var n=+t,r=+e,i=65535&n,o=65535&r;return 0|i*o+((65535&n>>>16)*o+i*(65535&r>>>16)<<16>>>0)}})},function(t,e,n){var r=n(8),i=Math.abs;r(r.S,"Math",{hypot:function(t,e){for(var n,r,o=0,a=0,s=arguments.length,u=0;a0?(r=n/u)*r:n;return u===1/0?1/0:u*Math.sqrt(o)}})},function(t,e,n){var r=n(166),i=Math.pow,o=i(2,-52),a=i(2,-23),s=i(2,127)*(2-a),u=i(2,-126);t.exports=Math.fround||function(t){var e,n,i=Math.abs(t),c=r(t);return is||n!=n?c*(1/0):c*n}},function(t,e,n){var r=n(8);r(r.S,"Math",{fround:n(532)})},function(t,e,n){var r=n(8),i=n(165);r(r.S+r.F*(i!=Math.expm1),"Math",{expm1:i})},function(t,e,n){var r=n(8),i=Math.exp;r(r.S,"Math",{cosh:function(t){return(i(t=+t)+i(-t))/2}})},function(t,e,n){var r=n(8);r(r.S,"Math",{clz32:function(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},function(t,e,n){var r=n(8),i=n(166);r(r.S,"Math",{cbrt:function(t){return i(t=+t)*Math.pow(Math.abs(t),1/3)}})},function(t,e,n){var r=n(8),i=Math.atanh;r(r.S+r.F*!(i&&1/i(-0)<0),"Math",{atanh:function(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}})},function(t,e,n){var r=n(8),i=Math.asinh;r(r.S+r.F*!(i&&1/i(0)>0),"Math",{asinh:function t(e){return isFinite(e=+e)&&0!=e?e<0?-t(-e):Math.log(e+Math.sqrt(e*e+1)):e}})},function(t,e,n){var r=n(8),i=n(227),o=Math.sqrt,a=Math.acosh;r(r.S+r.F*!(a&&710==Math.floor(a(Number.MAX_VALUE))&&a(1/0)==1/0),"Math",{acosh:function(t){return(t=+t)<1?NaN:t>94906265.62425156?Math.log(t)+Math.LN2:i(t-1+o(t-1)*o(t+1))}})},function(t,e,n){var r=n(8),i=n(231);r(r.S+r.F*(Number.parseInt!=i),"Number",{parseInt:i})},function(t,e,n){var r=n(8),i=n(230);r(r.S+r.F*(Number.parseFloat!=i),"Number",{parseFloat:i})},function(t,e,n){var r=n(8);r(r.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},function(t,e,n){var r=n(8);r(r.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},function(t,e,n){var r=n(8),i=n(228),o=Math.abs;r(r.S,"Number",{isSafeInteger:function(t){return i(t)&&o(t)<=9007199254740991}})},function(t,e,n){var r=n(8);r(r.S,"Number",{isNaN:function(t){return t!=t}})},function(t,e,n){var r=n(8);r(r.S,"Number",{isInteger:n(228)})},function(t,e,n){var r=n(8),i=n(16).isFinite;r(r.S,"Number",{isFinite:function(t){return"number"==typeof t&&i(t)}})},function(t,e,n){var r=n(8);r(r.S,"Number",{EPSILON:Math.pow(2,-52)})},function(t,e,n){var r=n(8),i=n(15),o=n(229),a=1..toPrecision;r(r.P+r.F*(i((function(){return"1"!==a.call(1,void 0)}))||!i((function(){a.call({})}))),"Number",{toPrecision:function(t){var e=o(this,"Number#toPrecision: incorrect invocation!");return void 0===t?a.call(e):a.call(e,t)}})},function(t,e,n){var r=n(8),i=n(54),o=n(229),a=n(167),s=1..toFixed,u=Math.floor,c=[0,0,0,0,0,0],l="Number.toFixed: incorrect invocation!",f=function(t,e){for(var n=-1,r=e;++n<6;)r+=t*c[n],c[n]=r%1e7,r=u(r/1e7)},h=function(t){for(var e=6,n=0;--e>=0;)n+=c[e],c[e]=u(n/t),n=n%t*1e7},p=function(){for(var t=6,e="";--t>=0;)if(""!==e||0===t||0!==c[t]){var n=String(c[t]);e=""===e?n:e+a.call("0",7-n.length)+n}return e},d=function(t,e,n){return 0===e?n:e%2==1?d(t,e-1,n*t):d(t*t,e/2,n)};r(r.P+r.F*(!!s&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!n(15)((function(){s.call({})}))),"Number",{toFixed:function(t){var e,n,r,s,u=o(this,l),c=i(t),m="",g="0";if(c<0||c>20)throw RangeError(l);if(u!=u)return"NaN";if(u<=-1e21||u>=1e21)return String(u);if(u<0&&(m="-",u=-u),u>1e-21)if(n=(e=function(t){for(var e=0,n=t;n>=4096;)e+=12,n/=4096;for(;n>=2;)e+=1,n/=2;return e}(u*d(2,69,1))-69)<0?u*d(2,-e,1):u/d(2,e,1),n*=4503599627370496,(e=52-e)>0){for(f(0,n),r=c;r>=7;)f(1e7,0),r-=7;for(f(d(10,r,1),0),r=e-1;r>=23;)h(1<<23),r-=23;h(1<0?m+((s=g.length)<=c?"0."+a.call("0",c-s)+g:g.slice(0,s-c)+"."+g.slice(s-c)):m+g}})},function(t,e,n){var r=n(16),i=n(43),o=n(62),a=n(168),s=n(66),u=n(15),c=n(79).f,l=n(53).f,f=n(26).f,h=n(97).trim,p=r.Number,d=p,m=p.prototype,g="Number"==o(n(80)(m)),v="trim"in String.prototype,y=function(t){var e=s(t,!1);if("string"==typeof e&&e.length>2){var n,r,i,o=(e=v?e.trim():h(e,3)).charCodeAt(0);if(43===o||45===o){if(88===(n=e.charCodeAt(2))||120===n)return NaN}else if(48===o){switch(e.charCodeAt(1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+e}for(var a,u=e.slice(2),c=0,l=u.length;ci)return NaN;return parseInt(u,r)}}return+e};if(!p(" 0o1")||!p("0b1")||p("+0x1")){p=function(t){var e=arguments.length<1?0:t,n=this;return n instanceof p&&(g?u((function(){m.valueOf.call(n)})):"Number"!=o(n))?a(new d(y(e)),n,p):y(e)};for(var b,x=n(27)?c(d):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),w=0;x.length>w;w++)i(d,b=x[w])&&!i(p,b)&&f(p,b,l(d,b));p.prototype=m,m.constructor=p,n(38)(r,"Number",p)}},function(t,e,n){var r=n(8),i=n(230);r(r.G+r.F*(parseFloat!=i),{parseFloat:i})},function(t,e,n){var r=n(8),i=n(231);r(r.G+r.F*(parseInt!=i),{parseInt:i})},function(t,e,n){var r=n(13),i=n(78),o=n(19)("hasInstance"),a=Function.prototype;o in a||n(26).f(a,o,{value:function(t){if("function"!=typeof this||!r(t))return!1;if(!r(this.prototype))return t instanceof this;for(;t=i(t);)if(this.prototype===t)return!0;return!1}})},function(t,e,n){var r=n(26).f,i=Function.prototype,o=/^\s*function ([^ (]*)/;"name"in i||n(27)&&r(i,"name",{configurable:!0,get:function(){try{return(""+this).match(o)[1]}catch(t){return""}}})},function(t,e,n){var r=n(8);r(r.P,"Function",{bind:n(233)})},function(t,e,n){var r=n(105),i={};i[n(19)("toStringTag")]="z",i+""!="[object z]"&&n(38)(Object.prototype,"toString",(function(){return"[object "+r(this)+"]"}),!0)},function(t,e,n){var r=n(8);r(r.S,"Object",{setPrototypeOf:n(170).set})},function(t,e,n){var r=n(8);r(r.S,"Object",{is:n(234)})},function(t,e,n){var r=n(8);r(r.S+r.F,"Object",{assign:n(235)})},function(t,e,n){var r=n(13);n(52)("isExtensible",(function(t){return function(e){return!!r(e)&&(!t||t(e))}}))},function(t,e,n){var r=n(13);n(52)("isSealed",(function(t){return function(e){return!r(e)||!!t&&t(e)}}))},function(t,e,n){var r=n(13);n(52)("isFrozen",(function(t){return function(e){return!r(e)||!!t&&t(e)}}))},function(t,e,n){var r=n(13),i=n(65).onFreeze;n(52)("preventExtensions",(function(t){return function(e){return t&&r(e)?t(i(e)):e}}))},function(t,e,n){var r=n(13),i=n(65).onFreeze;n(52)("seal",(function(t){return function(e){return t&&r(e)?t(i(e)):e}}))},function(t,e,n){var r=n(13),i=n(65).onFreeze;n(52)("freeze",(function(t){return function(e){return t&&r(e)?t(i(e)):e}}))},function(t,e,n){n(52)("getOwnPropertyNames",(function(){return n(236).f}))},function(t,e,n){var r=n(34),i=n(82);n(52)("keys",(function(){return function(t){return i(r(t))}}))},function(t,e,n){var r=n(34),i=n(78);n(52)("getPrototypeOf",(function(){return function(t){return i(r(t))}}))},function(t,e,n){var r=n(41),i=n(53).f;n(52)("getOwnPropertyDescriptor",(function(){return function(t,e){return i(r(t),e)}}))},function(t,e,n){var r=n(8);r(r.S+r.F*!n(27),"Object",{defineProperties:n(237)})},function(t,e,n){var r=n(8);r(r.S+r.F*!n(27),"Object",{defineProperty:n(26).f})},function(t,e,n){var r=n(8);r(r.S,"Object",{create:n(80)})},function(t,e,n){var r=n(82),i=n(127),o=n(106);t.exports=function(t){var e=r(t),n=i.f;if(n)for(var a,s=n(t),u=o.f,c=0;s.length>c;)u.call(t,a=s[c++])&&e.push(a);return e}},function(t,e,n){t.exports=n(129)("native-function-to-string",Function.toString)},function(t,e,n){var r=n(16),i=n(43),o=n(27),a=n(8),s=n(38),u=n(65).KEY,c=n(15),l=n(129),f=n(98),h=n(84),p=n(19),d=n(174),m=n(239),g=n(575),v=n(126),y=n(14),b=n(13),x=n(34),w=n(41),k=n(66),E=n(85),C=n(80),S=n(236),A=n(53),O=n(127),_=n(26),N=n(82),T=A.f,D=_.f,I=S.f,R=r.Symbol,F=r.JSON,M=F&&F.stringify,B=p("_hidden"),z=p("toPrimitive"),j={}.propertyIsEnumerable,P=l("symbol-registry"),L=l("symbols"),W=l("op-symbols"),U=Object.prototype,V="function"==typeof R&&!!O.f,q=r.QObject,H=!q||!q.prototype||!q.prototype.findChild,G=o&&c((function(){return 7!=C(D({},"a",{get:function(){return D(this,"a",{value:7}).a}})).a}))?function(t,e,n){var r=T(U,e);r&&delete U[e],D(t,e,n),r&&t!==U&&D(U,e,r)}:D,$=function(t){var e=L[t]=C(R.prototype);return e._k=t,e},K=V&&"symbol"==typeof R.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof R},X=function(t,e,n){return t===U&&X(W,e,n),y(t),e=k(e,!0),y(n),i(L,e)?(n.enumerable?(i(t,B)&&t[B][e]&&(t[B][e]=!1),n=C(n,{enumerable:E(0,!1)})):(i(t,B)||D(t,B,E(1,{})),t[B][e]=!0),G(t,e,n)):D(t,e,n)},Y=function(t,e){y(t);for(var n,r=g(e=w(e)),i=0,o=r.length;o>i;)X(t,n=r[i++],e[n]);return t},J=function(t){var e=j.call(this,t=k(t,!0));return!(this===U&&i(L,t)&&!i(W,t))&&(!(e||!i(this,t)||!i(L,t)||i(this,B)&&this[B][t])||e)},Z=function(t,e){if(t=w(t),e=k(e,!0),t!==U||!i(L,e)||i(W,e)){var n=T(t,e);return!n||!i(L,e)||i(t,B)&&t[B][e]||(n.enumerable=!0),n}},Q=function(t){for(var e,n=I(w(t)),r=[],o=0;n.length>o;)i(L,e=n[o++])||e==B||e==u||r.push(e);return r},tt=function(t){for(var e,n=t===U,r=I(n?W:w(t)),o=[],a=0;r.length>a;)!i(L,e=r[a++])||n&&!i(U,e)||o.push(L[e]);return o};V||(s((R=function(){if(this instanceof R)throw TypeError("Symbol is not a constructor!");var t=h(arguments.length>0?arguments[0]:void 0),e=function(n){this===U&&e.call(W,n),i(this,B)&&i(this[B],t)&&(this[B][t]=!1),G(this,t,E(1,n))};return o&&H&&G(U,t,{configurable:!0,set:e}),$(t)}).prototype,"toString",(function(){return this._k})),A.f=Z,_.f=X,n(79).f=S.f=Q,n(106).f=J,O.f=tt,o&&!n(83)&&s(U,"propertyIsEnumerable",J,!0),d.f=function(t){return $(p(t))}),a(a.G+a.W+a.F*!V,{Symbol:R});for(var et="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),nt=0;et.length>nt;)p(et[nt++]);for(var rt=N(p.store),it=0;rt.length>it;)m(rt[it++]);a(a.S+a.F*!V,"Symbol",{for:function(t){return i(P,t+="")?P[t]:P[t]=R(t)},keyFor:function(t){if(!K(t))throw TypeError(t+" is not a symbol!");for(var e in P)if(P[e]===t)return e},useSetter:function(){H=!0},useSimple:function(){H=!1}}),a(a.S+a.F*!V,"Object",{create:function(t,e){return void 0===e?C(t):Y(C(t),e)},defineProperty:X,defineProperties:Y,getOwnPropertyDescriptor:Z,getOwnPropertyNames:Q,getOwnPropertySymbols:tt});var ot=c((function(){O.f(1)}));a(a.S+a.F*ot,"Object",{getOwnPropertySymbols:function(t){return O.f(x(t))}}),F&&a(a.S+a.F*(!V||c((function(){var t=R();return"[null]"!=M([t])||"{}"!=M({a:t})||"{}"!=M(Object(t))}))),"JSON",{stringify:function(t){for(var e,n,r=[t],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=e=r[1],(b(e)||void 0!==t)&&!K(t))return v(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!K(e))return e}),r[1]=e,M.apply(F,r)}}),R.prototype[z]||n(42)(R.prototype,z,R.prototype.valueOf),f(R,"Symbol"),f(Math,"Math",!0),f(r.JSON,"JSON",!0)},function(t,e,n){n(577),n(574),n(573),n(572),n(571),n(570),n(569),n(568),n(567),n(566),n(565),n(564),n(563),n(562),n(561),n(560),n(559),n(558),n(557),n(556),n(555),n(554),n(553),n(552),n(551),n(550),n(549),n(548),n(547),n(546),n(545),n(544),n(543),n(542),n(541),n(540),n(539),n(538),n(537),n(536),n(535),n(534),n(533),n(531),n(530),n(529),n(528),n(527),n(526),n(525),n(524),n(523),n(522),n(521),n(520),n(519),n(518),n(517),n(516),n(515),n(514),n(513),n(512),n(511),n(510),n(509),n(508),n(507),n(506),n(505),n(504),n(503),n(502),n(501),n(500),n(499),n(498),n(496),n(495),n(493),n(492),n(491),n(490),n(489),n(488),n(487),n(485),n(484),n(483),n(482),n(481),n(480),n(479),n(478),n(477),n(476),n(475),n(474),n(473),n(155),n(472),n(220),n(471),n(219),n(470),n(469),n(468),n(467),n(218),n(464),n(463),n(462),n(461),n(460),n(459),n(458),n(457),n(456),n(455),n(454),n(453),n(452),n(451),n(450),n(449),n(448),n(447),n(446),n(445),n(444),n(443),n(442),n(441),n(440),n(439),n(438),n(437),n(436),t.exports=n(24)},function(t,e,n){n(578),n(435),n(433),n(430),n(428),n(426),n(424),n(422),n(420),n(418),n(416),n(414),n(412),n(408)},function(t,e,n){n(579);var r=function(t){return t&&t.__esModule?t:{default:t}}(n(407));r.default._babelPolyfill&&"undefined"!=typeof console&&console.warn&&console.warn("@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning."),r.default._babelPolyfill=!0},function(t,e,n){n(580),t.exports=n(248)},function(t,e,n){var r={},i={},o=34,a=10,s=13;function u(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function c(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var r in t)r in e||n.push(e[r]=r)})),n}function l(t,e){var n=t+"",r=n.length;return r9999?"+"+l(t,6):l(t,4)}(t.getUTCFullYear())+"-"+l(t.getUTCMonth()+1,2)+"-"+l(t.getUTCDate(),2)+(i?"T"+l(e,2)+":"+l(n,2)+":"+l(r,2)+"."+l(i,3)+"Z":r?"T"+l(e,2)+":"+l(n,2)+":"+l(r,2)+"Z":n||e?"T"+l(e,2)+":"+l(n,2)+"Z":"")}e.a=function(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function l(t,e){var u,c=[],l=t.length,f=0,h=0,p=l<=0,d=!1;function m(){if(p)return i;if(d)return d=!1,r;var e,u,c=f;if(t.charCodeAt(c)===o){for(;f++=l?p=!0:(u=t.charCodeAt(f++))===a?d=!0:u===s&&(d=!0,t.charCodeAt(f)===a&&++f),t.slice(c+1,e-1).replace(/""/g,'"')}for(;f>1,l=-7,f=n?i-1:0,h= * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function J(t,e){function n(){this.constructor=t}Y(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function Z(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))}function Q(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0;)r=Math.random()*e|0,n=t[--e],t[e]=t[r],t[r]=n}function ht(t,e,n){return Math.max(t,Math.min(e,n))}function pt(t){return t%2==0?t:t+1}function dt(t){for(var e=0,n=0;n=n?i():setTimeout(a,s)}};a()}))}function At(t,e){for(var n=1,r=-1,i=0;i=0)n*=t[i];else if(-1===t[i]){if(-1!==r)throw Error("Shapes can only have 1 implicit size. Found -1 at dim "+r+" and dim "+i);r=i}else if(t[i]<0)throw Error("Shapes can not be < 0. Found "+t[i]+" at dim "+i);if(-1===r){if(e>0&&e!==n)throw Error("Size("+e+") must match the product of shape "+t);return t}if(0===n)throw Error("Cannot infer the missing size in ["+t+"] when there are 0 elements");if(e%n!=0)throw Error("The implicit shape can't be a fractional number. Got "+e+" / "+n);var o=t.slice();return o[r]=e/n,o}function Ot(t,e){var n=e.length;return mt((t=null==t?e.map((function(t,e){return e})):[].concat(t)).every((function(t){return t>=-n&&ts)&&1===t[s]&&(n.push(t[s]),r.push(s)),o[a]<=s&&a++}1!==t[s]&&(n.push(t[s]),r.push(s))}return{newShape:n,keptDims:r}}function Nt(t,e){var n=null;if(null==t||"float32"===t)n=new Float32Array(e);else if("int32"===t)n=new Int32Array(e);else{if("bool"!==t)throw new Error("Unknown data type "+t);n=new Uint8Array(e)}return n}function Tt(t,e){var n=null;if(null==t||"float32"===t)n=new Float32Array(e);else if("int32"===t)n=new Int32Array(e);else if("bool"===t)n=new Uint8Array(e);else{if("string"!==t)throw new Error("Unknown data type "+t);n=new Array(e)}return n}function Dt(t,e){for(var n=0;n=0;--r)n[r]=n[r+1]*t[r+1];return n}function qt(t,e,n){if("string"===e)throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(t)&&(t=yt(t)),n&&Dt(t,e),function(t,e){return t instanceof Float32Array&&"float32"===e||t instanceof Int32Array&&"int32"===e||t instanceof Uint8Array&&"bool"===e}(t,e))return t;if(null==e||"float32"===e||"complex64"===e)return new Float32Array(t);if("int32"===e)return new Int32Array(t);if("bool"===e){for(var r=new Uint8Array(t.length),i=0;i=0,(function(){return"Tensor must have a shape comprised of positive integers but got shape ["+t+"]."}))}))}function Yt(t,e){return void 0===e&&(e="utf-8"),e=e||"utf-8",et().platform.encode(t,e)}function Jt(t,e){return void 0===e&&(e="utf-8"),e=e||"utf-8",et().platform.decode(t,e)}function Zt(t,e,n){if(0===e)return 0;if(1===e)return t[0];for(var r=t[t.length-1],i=0;i0?p:"")+" "}console.log("%c"+s+"\t%c"+a+"\t%c"+u+"D "+l+"\t%c"+c+"\t%c"+f+"\t%c"+o,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")},t}(),re=7;function ie(t,e,n){return Ct(Array.isArray(t)?parseFloat(t[0].toFixed(re))+" + "+parseFloat(t[1].toFixed(re))+"j":zt(t)?"'"+t+"'":"bool"===n?oe(t):parseFloat(t.toFixed(re)).toString(),e)}function oe(t){return 0===t?"false":"true"}function ae(t){for(var e=[],n=0;n=this.shape[n]){var a="Requested out of range element at "+t+". Buffer shape="+this.shape;throw new Error(a)}n++}for(var s=t[t.length-1],u=0;u1)for(var c=0;c20){var l=3*s,f=Array.from(e.slice(0,l)),h=Array.from(e.slice((u-3)*s,u*s));return"complex64"===r&&(f=ae(f),h=ae(h)),["["+f.map((function(t,e){return ie(t,o[e],r)})).join(", ")+", ..., "+h.map((function(t,e){return ie(t,o[u-3+e],r)})).join(", ")+"]"]}return["["+("complex64"===r?ae(e):Array.from(e)).map((function(t,e){return ie(t,o[e],r)})).join(", ")+"]"]}var p=n.slice(1),d=i.slice(1),m=i[0]*s,g=[];if(u>20){for(var v=0;v<3;v++){var y=(b=v*m)+m;g.push.apply(g,t(e.slice(b,y),p,r,d,o,!1))}for(g.push("..."),v=u-3;v0)throw new Error("Backend '"+this.backendName+"' has an internal memory leak ("+a+" data ids) after running '"+t+"'")},t.prototype.runKernelFunc=function(t,e,n,r,i,o,a){var s,u=this,c=[],l=this.isTapeOn();null==r&&(r=null!=this.state.activeScope?this.state.activeScope.name:"");var f,h=this.state.numBytes,p=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);var d,m=ot(r,this.backendName);if(null!=m)f=function(){var t=u.backend.numDataIds();d=m.kernelFunc({inputs:e,attrs:i,backend:u.backend});var n=Array.isArray(d)?d:[d];u.shouldCheckForMemLeaks()&&u.checkKernelForMemLeak(r,t,n);var s=n.map((function(t){var e=t.dataId,n=t.shape,r=t.dtype;return u.makeTensorFromDataId(e,n,r)}));if(l){var f=u.getTensorsForGradient(r,e,s);if(null==f){null==a&&(a=[]);var h=s.filter((function(t,e){return a[e]}));f=(o||[]).slice().concat(h)}c=u.saveTensorsForBackwardMode(f)}return s};else{var g=function(t){l&&(c=t.map((function(t){return u.keep(u.clone(t))})))};f=function(){var e=u.backend.numDataIds();d=u.tidy((function(){return t(u.backend,g)}));var n=Array.isArray(d)?d:[d];return u.shouldCheckForMemLeaks()&&u.checkKernelForMemLeak(r,e,n),n}}return this.scopedRun((function(){return u.state.kernelDepth++}),(function(){return u.state.kernelDepth--}),(function(){s=u.ENV.getBool("DEBUG")?u.profiler.profileKernel(r,e,(function(){return f()})):f()})),l&&this.addTapeNode(r,e,s,n,c,i),this.state.profiling&&this.state.activeProfile.kernels.push({name:r,bytesAdded:this.state.numBytes-h,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-p,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(e).map((function(t){return e[t].shape})),outputShapes:s.map((function(t){return t.shape}))}),Array.isArray(d)?s:s[0]},t.prototype.saveTensorsForBackwardMode=function(t){var e=this;return t.map((function(t){return e.keep(e.clone(t))}))},t.prototype.getTensorsForGradient=function(t,e,n){var r=at(t);if(null!=r){var i=r.inputsToSave||[],o=r.outputsToSave||[],a=void 0;r.saveAllInputs?(mt(Array.isArray(e),(function(){return"saveAllInputs is true, expected inputs to be an array."})),a=Object.keys(e).map((function(t){return e[t]}))):a=i.map((function(t){return e[t]}));var s=n.filter((function(t,e){return o[e]}));return a.concat(s)}return null},t.prototype.makeTensor=function(t,e,n,r){if(null==t)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",r=r||this.backend;var i=t;"string"===n&&zt(t[0])&&(i=t.map((function(t){return Yt(t)})));var o=r.write(i,e,n),a=new fe(e,n,o,this.nextTensorId());if(this.incRef(a,r),"string"===n){var s=this.state.tensorInfo.get(o),u=Bt(i);this.state.numBytes+=u-s.bytes,s.bytes=u}return a},t.prototype.makeTensorFromDataId=function(t,e,n,r){var i=new fe(e,n=n||"float32",t,this.nextTensorId());return this.incRef(i,r),i},t.prototype.makeVariable=function(t,e,n,r){void 0===e&&(e=!0),n=n||this.nextVariableId().toString(),null!=r&&r!==t.dtype&&(t=t.asType(r));var i=new ve(t,e,n,this.nextTensorId());if(null!=this.state.registeredVariables[i.name])throw new Error("Variable with name "+i.name+" was already registered");return this.state.registeredVariables[i.name]=i,this.incRef(i,this.backend),i},t.prototype.incRef=function(t,e){var n=this.state.tensorInfo.has(t.dataId)?this.state.tensorInfo.get(t.dataId).refCount:0;if(this.state.numTensors++,"string"===t.dtype&&this.state.numStringTensors++,0===n){this.state.numDataBuffers++;var r=0;"complex64"!==t.dtype&&"string"!==t.dtype&&(r=t.size*Mt(t.dtype)),this.state.tensorInfo.set(t.dataId,{backend:e||this.backend,dtype:t.dtype,shape:t.shape,bytes:r,refCount:0}),this.state.numBytes+=r}this.state.tensorInfo.get(t.dataId).refCount++,t instanceof ve||this.track(t)},t.prototype.disposeTensor=function(t){if(this.state.tensorInfo.has(t.dataId)){this.state.numTensors--,"string"===t.dtype&&this.state.numStringTensors--;var e=this.state.tensorInfo.get(t.dataId);e.refCount<=1?("complex64"!==t.dtype&&(this.state.numBytes-=e.bytes),this.state.numDataBuffers--,e.backend.disposeData(t.dataId),this.state.tensorInfo.delete(t.dataId)):this.state.tensorInfo.get(t.dataId).refCount--}},t.prototype.disposeVariables=function(){for(var t in this.state.registeredVariables){var e=this.state.registeredVariables[t];this.disposeVariable(e)}},t.prototype.disposeVariable=function(t){this.disposeTensor(t),null!=this.state.registeredVariables[t.name]&&delete this.state.registeredVariables[t.name]},t.prototype.memory=function(){var t=this.backend.memory();return t.numTensors=this.state.numTensors,t.numDataBuffers=this.state.numDataBuffers,t.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(t.unreliable=!0,null==t.reasons&&(t.reasons=[]),t.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),t},t.prototype.profile=function(t){return Z(this,void 0,void 0,(function(){var e,n;return Q(this,(function(r){return this.state.profiling=!0,e=this.state.numBytes,n=this.state.numTensors,this.state.activeProfile.kernels=[],this.state.activeProfile.result=t(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max.apply(Math,this.state.activeProfile.kernels.map((function(t){return t.totalBytesSnapshot}))),this.state.activeProfile.newBytes=this.state.numBytes-e,this.state.activeProfile.newTensors=this.state.numTensors-n,[2,this.state.activeProfile]}))}))},t.prototype.isTapeOn=function(){return this.state.gradientDepth>0&&0===this.state.kernelDepth},t.prototype.addTapeNode=function(t,e,n,r,i,o){var a=this,s={id:this.state.nextTapeNodeId++,kernelName:t,inputs:e,outputs:n,saved:i},u=at(t);null!=u&&(r=u.gradFunc),null!=r&&(s.gradient=function(t){return t=t.map((function(t,e){if(null==t){var r=n[e],i=$t(r.size,r.dtype);return a.makeTensor(i,r.shape,r.dtype)}return t})),r(t.length>1?t:t[0],i,o)}),this.state.activeTape.push(s)},t.prototype.keep=function(t){return t.kept=!0,t},t.prototype.startTape=function(){0===this.state.gradientDepth&&(this.state.activeTape=[]),this.state.gradientDepth++},t.prototype.endTape=function(){this.state.gradientDepth--},t.prototype.startScope=function(t){var e={track:[],name:"unnamed scope",id:this.state.nextScopeId++};t&&(e.name=t),this.state.scopeStack.push(e),this.state.activeScope=e},t.prototype.endScope=function(t){for(var e=this,n=Ee(t),r=new Set(n.map((function(t){return t.id}))),i=0;i0,(function(){return"gradients() received an empty list of xs."})),null!=n&&"float32"!==n.dtype)throw new Error("dy must have 'float32' dtype, but has '"+n.dtype+"'");var o=this.scopedRun((function(){return i.startTape()}),(function(){return i.endTape()}),(function(){return i.tidy("forward",t)}));mt(o instanceof fe,(function(){return"The result y returned by f() must be a tensor."}));var a=function(t,e,n){for(var r={},i={},o=0;o=0;o--)for(a=(d=t[o]).inputs,l=0;l0)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 t,r,s={};s[o.id]=null==n?(r=Gt(bt(t=o.shape),"float32"),_e.makeTensor(r,t,"float32")):n,function(t,e,n){for(var r=function(r){var i=e[r],o=[];if(i.outputs.forEach((function(e){var n=t[e.id];null!=n?o.push(n):o.push(null)})),null==i.gradient)throw new Error("Cannot compute gradient: gradient function not found for "+i.kernelName+".");var a=i.gradient(o),s=function(e){if(!(e in a))throw new Error("Cannot backprop through input "+e+". Available gradients found: "+Object.keys(a)+".");var r=n((function(){return a[e]()}));if("float32"!==r.dtype)throw new Error("Error in gradient for op "+i.kernelName+". The gradient of input "+e+" must have 'float32' dtype, but has '"+r.dtype+"'");var o=i.inputs[e];if(!xt(r.shape,o.shape))throw new Error("Error in gradient for op "+i.kernelName+". The gradient of input '"+e+"' has shape '"+r.shape+"', which does not match the shape of the input '"+o.shape+"'");if(null==t[o.id])t[o.id]=r;else{var s=t[o.id];t[o.id]=s.add(r),s.dispose()}};for(var u in i.inputs)s(u)},i=e.length-1;i>=0;i--)r(i)}(s,a,(function(t){return i.tidy(t)}));var u=e.map((function(t){return s[t.id]}));return 0===i.state.gradientDepth&&(i.state.activeTape.forEach((function(t){for(var e=0,n=t.saved;en||e>n)throw r="["+t+"x"+e+"]",new Error("Requested texture size "+r+" greater than WebGL maximum on this browser / GPU ["+n+"x"+n+"].")}function on(t,e){return mn(t,e,(function(){return t.createFramebuffer()}),"Unable to create WebGLFramebuffer.")}function an(t,e,n,r,i,o,a,s){var u=t.getAttribLocation(n,r);return-1!==u&&(Ue(t,e,(function(){return t.bindBuffer(t.ARRAY_BUFFER,i)})),Ue(t,e,(function(){return t.vertexAttribPointer(u,o,t.FLOAT,!1,a,s)})),Ue(t,e,(function(){return t.enableVertexAttribArray(u)})),!0)}function sn(t,e,n,r){gn(t,r),Ue(t,e,(function(){return t.activeTexture(t.TEXTURE0+r)})),Ue(t,e,(function(){return t.bindTexture(t.TEXTURE_2D,n)}))}function un(t,e,n,r){return mn(t,e,(function(){return t.getUniformLocation(n,r)}),'uniform "'+r+'" not present in program.')}function cn(t,e,n){return t.getUniformLocation(e,n)}function ln(t,e,n,r,i,o){Ue(t,e,(function(){return sn(t,e,r,o)})),Ue(t,e,(function(){return t.uniform1i(i,o)}))}function fn(t,e,n,r){Ue(t,e,(function(){return t.bindFramebuffer(t.FRAMEBUFFER,r)})),Ue(t,e,(function(){return t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0)}))}function hn(t,e,n){Ue(t,e,(function(){return t.bindFramebuffer(t.FRAMEBUFFER,n)})),Ue(t,e,(function(){return t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,null,0)}))}function pn(t){var e=t.checkFramebufferStatus(t.FRAMEBUFFER);if(e!==t.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+dn(t,e))}function dn(t,e){switch(e){case t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case t.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return"unknown error "+e}}function mn(t,e,n,r){var i=Ue(t,e,(function(){return n()}));if(null==i)throw new Error(r);return i}function gn(t,e){var n=t.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,r=e+t.TEXTURE0;if(rn)throw new Error("textureUnit must be in [gl.TEXTURE0, gl.TEXTURE"+n+"].")}function vn(t,e){return void 0===e&&(e=2),bt(t.slice(0,t.length-e))}function yn(t){if(0===t.length)throw Error("Cannot get rows and columns of an empty shape array.");return[t.length>1?t[t.length-2]:1,t[t.length-1]]}function bn(t){var e=[1,1,1];return 0===t.length||1===t.length&&1===t[0]||(e=[vn(t)].concat(yn(t))),e}function xn(t,e){var n;void 0===e&&(e=!1);var r=et().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(e&&(r*=2,1===(t=t.map((function(e,n){return n>=t.length-2?pt(t[n]):t[n]}))).length&&(t=[2,t[0]])),2!==t.length){var i=_t(t);t=i.newShape}var o=bt(t);if(t.length<=1&&o<=r)return[1,o];if(2===t.length&&t[0]<=r&&t[1]<=r)return t;if(3===t.length&&t[0]*t[1]<=r&&t[2]<=r)return[t[0]*t[1],t[2]];if(3===t.length&&t[0]<=r&&t[1]*t[2]<=r)return[t[0],t[1]*t[2]];if(4===t.length&&t[0]*t[1]*t[2]<=r&&t[3]<=r)return[t[0]*t[1]*t[2],t[3]];if(4===t.length&&t[0]<=r&&t[1]*t[2]*t[3]<=r)return[t[0],t[1]*t[2]*t[3]];if(e){var a=vn(t),s=2,u=2;return t.length&&(s=(n=yn(t))[0],u=n[1]),Et(o=a*(s/2)*(u/2)).map((function(t){return 2*t}))}return Et(o)}function wn(t){return t%2==0}function kn(t,e){if(xt(t=t.slice(-2),e=e.slice(-2)))return!0;if(!t.length||!e.length)return!0;if(0===t[0]||0===t[1]||0===e[0]||0===e[1])return!0;if(t.length!==e.length){var n=t.slice(-1)[0],r=e.slice(-1)[0];if(n===r)return!0;if(wn(n)&&wn(r)&&(1===t[0]||1===e[0]))return!0}return t[1]===e[1]&&wn(t[0])&&wn(e[0])}function En(t){if(null==Ke){var e=ze(t);Ke=e.getParameter(e.MAX_TEXTURE_SIZE)}return Ke}function Cn(t){if(null==Xe){var e=ze(t);Xe=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,Xe)}function Sn(t){if(0===t)return 0;var e=ze(t);return An(e,"EXT_disjoint_timer_query_webgl2")&&2===t?2:An(e,"EXT_disjoint_timer_query")?1:0}function An(t,e){return null!=t.getExtension(e)}function On(t){try{if(null!=ze(t))return!0}catch(t){return!1}return!1}function _n(t){if(0===t)return!1;var e=ze(t);if(1===t){if(!An(e,"OES_texture_float"))return!1}else if(!An(e,"EXT_color_buffer_float"))return!1;return Tn(e)}function Nn(t){if(0===t)return!1;var e=ze(t);if(1!==t){if(An(e,"EXT_color_buffer_float"))return Tn(e);if(An(e,"EXT_color_buffer_half_float")){var n=e.getExtension("EXT_color_buffer_half_float");return function(t,e){var n=We(t,e),r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,n.internalFormatHalfFloat,1,1,0,n.textureFormatFloat,n.textureTypeHalfFloat,null);var i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0);var o=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;return t.bindTexture(t.TEXTURE_2D,null),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteTexture(r),t.deleteFramebuffer(i),o}(e,n)}return!1}return!!An(e,"OES_texture_float")&&!!An(e,"WEBGL_color_buffer_float")&&Tn(e)}function Tn(t){var e=We(t),n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n),t.texImage2D(t.TEXTURE_2D,0,e.internalFormatFloat,1,1,0,e.textureFormatFloat,e.textureTypeFloat,null);var r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0);var i=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;return t.bindTexture(t.TEXTURE_2D,null),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteTexture(n),t.deleteFramebuffer(r),i}function Dn(t){return 2===t&&null!=ze(t).fenceSync}var In=Object.freeze({callAndCheck:Ue,canBeRepresented:Ve,getWebGLErrorMessage:qe,getExtensionOrThrow:He,createVertexShader:Ge,createFragmentShader:$e,createProgram:Je,linkProgram:Ze,validateProgram:Qe,createStaticVertexBuffer:tn,createStaticIndexBuffer:en,getNumChannels:function(){return 2===et().getNumber("WEBGL_VERSION")?1:4},createTexture:nn,validateTextureSize:rn,createFramebuffer:on,bindVertexBufferToProgramAttribute:an,bindTextureUnit:sn,unbindTextureUnit:function(t,e,n){gn(t,n),Ue(t,e,(function(){return t.activeTexture(t.TEXTURE0+n)})),Ue(t,e,(function(){return t.bindTexture(t.TEXTURE_2D,null)}))},getProgramUniformLocationOrThrow:un,getProgramUniformLocation:cn,bindTextureToProgramUniformSampler:ln,bindCanvasToFramebuffer:function(t,e){Ue(t,e,(function(){return t.bindFramebuffer(t.FRAMEBUFFER,null)})),Ue(t,e,(function(){return t.viewport(0,0,t.canvas.width,t.canvas.height)})),Ue(t,e,(function(){return t.scissor(0,0,t.canvas.width,t.canvas.height)}))},bindColorTextureToFramebuffer:fn,unbindColorTextureFromFramebuffer:hn,validateFramebuffer:pn,getFramebufferErrorMessage:dn,getBatchDim:vn,getRowsCols:yn,getShapeAs3D:bn,getTextureShapeFromLogicalShape:xn,isReshapeFree:kn,getWebGLMaxTextureSize:En,resetMaxTextureSize:function(){Ke=null},resetMaxTexturesInShader:function(){Xe=null},getMaxTexturesInShader:Cn,getWebGLDisjointQueryTimerVersion:Sn,hasExtension:An,isWebGLVersionEnabled:On,isCapableOfRenderingToFloatTexture:_n,isDownloadFloatTextureEnabled:Nn,isWebGLFenceEnabled:Dn}),Rn=et();function Fn(t){et().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(t+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}function Mn(){return _e.memory()}function Bn(t,e){return _e.tidy(t,e)}function zn(t){Ee(t).forEach((function(t){return t.dispose()}))}function jn(t){return _e.keep(t)}function Pn(){for(var t=[],e=0;e0,(function(){return"Element arr["+r.join("][")+"] should be a primitive, but is an array of "+e.length+" elements"})),mt(e.length===n[0],(function(){return"Element arr["+r.join("][")+"] should have "+n[0]+" elements, but has "+e.length+" elements"}));for(var i=n.slice(1),o=0;o=0&&(i=r),Wn(r,i,e,n),null==t||!Ft(t)&&!Array.isArray(t)&&"number"!=typeof t&&"boolean"!=typeof t&&"string"!=typeof t){var o=null==t?"null":t.constructor.name;throw new Error("Argument '"+e+"' passed to '"+n+"' must be a Tensor or TensorLike, but got '"+o+"'")}var a=Ln(t,i);Ft(t)||Array.isArray(t)||(t=[t]);var s="string"!==i?qt(t,i,et().getBool("DEBUG")):yt(t,[],!0);return _e.makeTensor(s,a,i)}function Vn(t,e,n,r){if(void 0===r&&(r="numeric"),!Array.isArray(t))throw new Error("Argument "+e+" passed to "+n+" must be a `Tensor[]` or `TensorLike[]`");return t.map((function(t,r){return Un(t,e+"["+r+"]",n)}),r)}function qn(t,e){for(var n=0;n=0&&e0})),Rn.registerFlag("WEBGL_VERSION",(function(){return On(2)?2:On(1)?1:0})),Rn.registerFlag("WEBGL_BUFFER_SUPPORTED",(function(){return 2===Rn.get("WEBGL_VERSION")})),Rn.registerFlag("WEBGL_CPU_FORWARD",(function(){return!0})),Rn.registerFlag("WEBGL_FORCE_F16_TEXTURES",(function(){return!1})),Rn.registerFlag("WEBGL_PACK",(function(){return Rn.getBool("HAS_WEBGL")})),Rn.registerFlag("WEBGL_PACK_NORMALIZATION",(function(){return Rn.getBool("WEBGL_PACK")})),Rn.registerFlag("WEBGL_PACK_CLIP",(function(){return Rn.getBool("WEBGL_PACK")})),Rn.registerFlag("WEBGL_PACK_DEPTHWISECONV",(function(){return!1})),Rn.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",(function(){return Rn.getBool("WEBGL_PACK")})),Rn.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",(function(){return Rn.getBool("WEBGL_PACK")})),Rn.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",(function(){return Rn.getBool("WEBGL_PACK")})),Rn.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",(function(){return Rn.getBool("WEBGL_PACK")})),Rn.registerFlag("WEBGL_PACK_REDUCE",(function(){return Rn.getBool("WEBGL_PACK")})),Rn.registerFlag("WEBGL_LAZILY_UNPACK",(function(){return Rn.getBool("WEBGL_PACK")})),Rn.registerFlag("WEBGL_CONV_IM2COL",(function(){return Rn.getBool("WEBGL_PACK")})),Rn.registerFlag("WEBGL_MAX_TEXTURE_SIZE",(function(){return En(Rn.getNumber("WEBGL_VERSION"))})),Rn.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",(function(){return Cn(Rn.getNumber("WEBGL_VERSION"))})),Rn.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",(function(){var t=Rn.getNumber("WEBGL_VERSION");return 0===t?0:Sn(t)})),Rn.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",(function(){return Rn.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&(t=navigator.userAgent||navigator.vendor||window.opera,!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(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))));var t})),Rn.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",(function(){return _n(Rn.getNumber("WEBGL_VERSION"))})),Rn.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",(function(){return!Rn.getBool("WEBGL_FORCE_F16_TEXTURES")&&Rn.getBool("WEBGL_RENDER_FLOAT32_CAPABLE")})),Rn.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",(function(){return Nn(Rn.getNumber("WEBGL_VERSION"))})),Rn.registerFlag("WEBGL_FENCE_API_ENABLED",(function(){return Dn(Rn.getNumber("WEBGL_VERSION"))})),Rn.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",(function(){return Rn.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0})),le=Fn;var er=tr({complex_:function(t,e){var n=Un(t,"real","complex"),r=Un(e,"imag","complex");return gt(n.shape,r.shape,"real and imag shapes, "+n.shape+" and "+r.shape+", must match in call to tf.complex()."),_e.runKernelFunc((function(t){return t.complex(n,r)}),{$real:n,$imag:r})}}),nr=tr({real_:function(t){var e=Un(t,"input","real");return _e.runKernelFunc((function(t){return t.real(e)}),{$input:e})}}),rr=tr({imag_:function(t){var e=Un(t,"input","imag");return _e.runKernelFunc((function(t){return t.imag(e)}),{$input:e})}});function ir(t,e,n){return or(t,e,Ln(t,n),n)}function or(t,e,n,r){if(null==r&&(r=Lt(t)),"complex64"===r)throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!Ft(t)&&!Array.isArray(t)&&"number"!=typeof t&&"boolean"!=typeof t&&"string"!=typeof t)throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(null!=e){Xt(e);var i=bt(e),o=bt(n);mt(i===o,(function(){return"Based on the provided shape, ["+e+"], the tensor should have "+i+" values but has "+o}));for(var a=0;a1)return pr([0],r);var i=$t(Math.abs(Math.ceil((e-t)/n)),r);e=1,(function(){return"Pass at least one tensor to concat"}));var n=Vn(t,"tensors","concat");"complex64"===n[0].dtype&&n.forEach((function(t){if("complex64"!==t.dtype)throw new Error("Cannot concatenate complex64 tensors with a tensor\n with dtype "+t.dtype+". ")})),e=Ot(e,n[0].shape)[0];var r=Qn(n.map((function(t){return t.shape})),e);if(0===bt(r))return ir([],r);if(1===(n=n.filter((function(t){return t.size>0}))).length)return n[0];var i=n.map((function(t){return t.shape}));Zn(i,e);var o=n,a={axis:e};return _e.runKernelFunc((function(t){return t.concat(n,e)}),o,(function(t){var n=i.map((function(t){return t[e]}));return Cr(t,n,e).map((function(t){return function(){return t}}))}),"Concat",a)}}),xr=tr({concat1d_:function(t){return br(t,0)}}),wr=tr({concat2d_:function(t,e){return br(t,e)}}),kr=tr({concat3d_:function(t,e){return br(t,e)}}),Er=tr({concat4d_:function(t,e){return br(t,e)}}),Cr=tr({split_:function(t,e,n){void 0===n&&(n=0);var r,i=Un(t,"x","split");return n=Ot(n,i.shape)[0],"number"==typeof e?(mt(i.shape[n]%e==0,(function(){return"Number of splits must evenly divide the axis."})),r=new Array(e).fill(i.shape[n]/e)):(mt(i.shape[n]===e.reduce((function(t,e){return t+e})),(function(){return"The sum of sizes must match the size of the axis dimension."})),r=e),_e.runKernelFunc((function(t){return t.split(i,r,n)}),{$x:i},(function(t){return{$x:function(){return br(t,n)}}}))}});function Sr(t,e,n){return void 0===e&&(e="float32"),e=e||"float32",Xt(t),new se(t,e,n)}var Ar=tr({batchToSpaceND_:function(t,e,n){var r=Un(t,"x","batchToSpaceND"),i=e.reduce((function(t,e){return t*e}));return mt(r.rank>=1+e.length,(function(){return"input rank is "+r.rank+" but should be > than blockShape.length "+e.length})),mt(n.length===e.length,(function(){return"crops.length is "+n.length+" but should be equal to blockShape.length "+e.length})),mt(r.shape[0]%i==0,(function(){return"input tensor batch is "+r.shape[0]+" but is not divisible by the product of the elements of blockShape "+e.join(" * ")+" === "+i})),_e.runKernelFunc((function(t){return t.batchToSpaceND(r,e,n)}),{$x:r},(function(t){return{$x:function(){return t.spaceToBatchND(e,n)}}}))}}),Or=tr({cast_:function(t,e){var n=Un(t,"x","cast");if(!It(e))throw new Error("Failed to cast to unknown dtype "+e);if("string"===e&&"string"!==n.dtype||"string"!==e&&"string"===n.dtype)throw new Error("Only strings can be casted to strings");var r={dtype:e};return _e.runKernelFunc((function(t){return t.cast(n,e)}),{x:n},(function(t){return{x:function(){return t.clone()}}}),"Cast",r)}}),_r=tr({cumsum_:function(t,e,n,r){void 0===e&&(e=0),void 0===n&&(n=!1),void 0===r&&(r=!1);var i=Un(t,"x","cumsum"),o=Xn([e|=0],i.rank),a=i;null!=o&&(a=i.transpose(o));var s=Jn(1,i.rank)[0],u=_e.runKernelFunc((function(t){return t.cumsum(a,s,n,r)}),{permutedX:a},(function(t){return{permutedX:function(){return t.cumsum(e,n,!r)}}}));return null!=o&&(u=u.transpose(o)),u}}),Nr=tr({depthToSpace_:function(t,e,n){void 0===n&&(n="NHWC");var r=Un(t,"x","depthToSpace"),i="NHWC"===n?r.shape[1]:r.shape[2],o="NHWC"===n?r.shape[2]:r.shape[3],a="NHWC"===n?r.shape[3]:r.shape[1];return mt(i*e>=0,(function(){return"Negative dimension size caused by overflow when multiplying\n "+i+" and "+e+" for depthToSpace with input shape\n "+r.shape})),mt(o*e>=0,(function(){return"Negative dimension size caused by overflow when multiplying\n "+o+" and "+e+" for depthToSpace with input shape\n "+r.shape})),mt(a%(e*e)==0,(function(){return"Dimension size must be evenly divisible by "+e*e+" but is "+a+" for depthToSpace with input shape "+r.shape})),_e.runKernelFunc((function(t){return t.depthToSpace(r,e,n)}),{$x:r})}}),Tr=tr({expandDims_:function(t,e){void 0===e&&(e=0);var n=Un(t,"x","expandDims",null);mt(e<=n.rank,(function(){return"Axis must be <= rank of the tensor"}));var r=n.shape.slice();return e<0&&(mt(-(n.rank+1)<=e,(function(){return"Axis must be in the interval ["+-(n.rank+1)+", "+n.rank+"]"})),e=n.rank+e+1),r.splice(e,0,1),Dr(n,r)}}),Dr=tr({reshape_:function(t,e){var n=Un(t,"x","reshape",null);e=At(e,n.size),mt(n.size===bt(e),(function(){return"new shape and old shape must have the same number of elements."}));var r={shape:e};return _e.runKernelFunc((function(t){return t.reshape(n,e)}),{x:n},(function(t){return{x:function(){return t.reshape(n.shape)}}}),"Reshape",r)}}),Ir=tr({spaceToBatchND_:function(t,e,n){var r=Un(t,"x","spaceToBatchND");return mt(r.rank>=1+e.length,(function(){return"input rank "+r.rank+" should be > than [blockShape] "+e.length})),mt(n.length===e.length,(function(){return"paddings.shape[0] "+n.length+" must be equal to [blockShape] "+e.length})),mt(r.shape.reduce((function(t,r,i){return i>0&&i<=e.length?t&&(r+n[i-1][0]+n[i-1][1])%e[i-1]==0:t}),!0),(function(){return"input spatial dimensions "+r.shape.slice(1)+" with paddings "+n.toString()+" must be divisible by blockShapes "+e.toString()})),_e.runKernelFunc((function(t){return t.spaceToBatchND(r,e,n)}),{$x:r},(function(t){return{$x:function(){return t.batchToSpaceND(e,n)}}}))}}),Rr=tr({squeeze_:function(t,e){var n=Un(t,"x","squeeze");return Dr(n,_t(n.shape,e).newShape)}}),Fr=tr({stack_:function(t,e){void 0===e&&(e=0);var n=Vn(t,"tensors","stack");if(mt(n.length>=1,(function(){return"Pass at least one tensor to tf.stack"})),1===n.length)return n[0].expandDims(e);var r=n[0].rank,i=n[0].shape,o=n[0].dtype;mt(e<=r,(function(){return"Axis must be <= rank of the tensor"})),n.forEach((function(t){gt(i,t.shape,"All tensors passed to stack must have matching shapes")})),n.forEach((function(t){mt(o===t.dtype,(function(){return"All tensors passed to stack must have matching dtypes"}))}));var a=n.map((function(t){return t.expandDims(e)}));return br(a,e)}}),Mr=tr({unstack_:function(t,e){void 0===e&&(e=0),e=e||0;var n=Un(t,"x","unstack");mt(e>=-n.shape.length&&e=2*e+1||i%2==1?a.push(i):o.push(i);r.push.apply(r,o),r.push(0),r.push.apply(r,a)}return r}function Pr(t,e,n,r){void 0===r&&(r=!0);var i=[];r?i.push(t[0]/n):i.push(t[0]*n);for(var o=1;o1&&1===a&&r.unshift(o)}return r}function Jr(t,e){for(var n=[],r=0;r1)&&n.unshift(o)}return n}function Zr(t,e){for(var n=[],r=Math.max(t.length,e.length),i=0;i0&&(i=i.sum(a)),i.reshape(n.shape)},$b:function(){var e=Xr(n.square(),r.square()),i=vi(t.mul(n.div(e))),a=Jr(r.shape,o);return a.length>0&&(i=i.sum(a)),i.reshape(r.shape)}}}))}}),Mi=tr({divStrict_:function(t,e){var n=Un(t,"a","div"),r=Un(e,"b","div");return gt(n.shape,r.shape,"Error in divideStrict: "),n.div(r)}}),Bi=tr({floorDiv_:function(t,e){var n,r=Un(t,"a","floorDiv"),i=Un(e,"b","floorDiv");n=we(r,i),r=n[0],i=n[1];var o=Zr(r.shape,i.shape);return _e.runKernelFunc((function(t,e){var n=t.floorDiv(r,i);return e([r,i]),n}),{a:r,b:i},(function(t,e){var n=e[0],r=e[1];return{a:function(){var e=t.div(r.toFloat()),i=Jr(n.shape,o);return i.length>0?e.sum(i).reshape(n.shape):e},b:function(){var e=t.mul(n.toFloat()),i=Jr(r.shape,o);i.length>0&&(e=e.sum(i).reshape(r.shape));var a=r.square();return e.div(a.toFloat()).neg()}}}),"FloorDiv")}}),zi=tr({maximum_:function(t,e){var n,r=Un(t,"a","maximum"),i=Un(e,"b","maximum");return n=we(r,i),r=n[0],i=n[1],"bool"===r.dtype&&(r=r.toInt(),i=i.toInt()),Zr(r.shape,i.shape),_e.runKernelFunc((function(t,e){var n=t.maximum(r,i);return e([r,i]),n}),{a:r,b:i},(function(t,e){var n=e[0],r=e[1];return{a:function(){return t.mul(n.greaterEqual(r).toFloat())},b:function(){return t.mul(n.less(r).toFloat())}}}),"Maximum")}}),ji=tr({maximumStrict_:function(t,e){var n=Un(t,"a","maximumStrict"),r=Un(e,"b","maximumStrict");return gt(n.shape,r.shape,"Error in maximumStrict: "),n.maximum(r)}}),Pi=tr({minimum_:function(t,e){var n,r=Un(t,"a","minimum"),i=Un(e,"b","minimum");return n=we(r,i),r=n[0],i=n[1],"bool"===r.dtype&&(r=r.toInt(),i=i.toInt()),Zr(r.shape,i.shape),_e.runKernelFunc((function(t,e){var n=t.minimum(r,i);return e([r,i]),n}),{a:r,b:i},(function(t,e){var n=e[0],r=e[1];return{a:function(){return t.mul(n.lessEqual(r).toFloat())},b:function(){return t.mul(n.greater(r).toFloat())}}}),"Minimum")}}),Li=tr({minimumStrict_:function(t,e){var n=Un(t,"a","minimumStrict"),r=Un(e,"b","minimumStrict");return gt(n.shape,r.shape,"Error in minimumStrict: "),n.minimum(r)}}),Wi=tr({mod_:function(t,e){var n,r=Un(t,"a","mod"),i=Un(e,"b","mod");n=we(r,i),r=n[0],i=n[1];var o=Zr(r.shape,i.shape);return _e.runKernelFunc((function(t,e){var n=t.mod(r,i);return e([r,i]),n}),{$a:r,$b:i},(function(t,e){var n=e[0],r=e[1];return{$a:function(){var e=Jr(n.shape,o);return e.length>0?t.sum(e).reshape(n.shape):t},$b:function(){var e=t.mul(n.div(r).floor().neg()),i=Jr(r.shape,o);return i.length>0?e.sum(i).reshape(r.shape):e}}}))}}),Ui=tr({modStrict_:function(t,e){var n=Un(t,"a","modStrict"),r=Un(e,"b","modStrict");return gt(n.shape,r.shape,"Error in modStrict: "),n.mod(r)}}),Vi=tr({mul_:function(t,e){var n,r=Un(t,"a","mul"),i=Un(e,"b","mul");n=we(r,i),r=n[0],i=n[1];var o=Zr(r.shape,i.shape);return _e.runKernelFunc((function(t,e){var n=t.multiply(r,i);return e([r,i]),n}),{a:r,b:i},(function(t,e){var n=e[0],r=e[1];return{a:function(){var e=t.mul(r.toFloat()),i=Jr(n.shape,o);return i.length>0?e.sum(i).reshape(n.shape):e},b:function(){var e=t.mul(n.toFloat()),i=Jr(r.shape,o);return i.length>0?e.sum(i).reshape(r.shape):e}}}),"Mul")}}),qi=tr({mulStrict_:function(t,e){var n=Un(t,"a","mul"),r=Un(e,"b","mul");return gt(n.shape,r.shape,"Error in multiplyStrict: "),n.mul(r)}}),Hi=tr({pow_:function(t,e){var n,r=Un(t,"base","pow"),i=Un(e,"exp","pow");n=we(r,i),r=n[0],i=n[1];var o=Zr(r.shape,i.shape),a=[r,i];return _e.runKernelFunc((function(t,e){var n=t.pow(r,i);return e([r,i,n]),n}),{a:r,b:i},(function(t,e){var n=e[0],r=e[1],i=e[2];return{a:function(){var e=r.toFloat(),i=t.mul(e.mul(n.pow(e.sub(ar(1))))),a=Jr(n.shape,o);return a.length>0&&(i=i.sum(a)),i.reshape(n.shape)},b:function(){var e=n.greater(0),a=n.log().where(e,yr(n)),s=t.mul(i.mul(a)),u=Jr(r.shape,o);return u.length>0&&(s=s.sum(u)),s.reshape(r.shape)}}}),"Pow",{},a,[!0])}}),Gi=tr({powStrict_:function(t,e){return gt(t.shape,e.shape,"Error in powStrict: "),t.pow(e)}}),$i=tr({squaredDifferenceStrict_:function(t,e){var n=Un(t,"a","squaredDifferenceStrict"),r=Un(e,"b","squaredDifferenceStrict");return gt(n.shape,r.shape,"Error in squaredDifferenceStrict: "),n.squaredDifference(r)}}),Ki=tr({sub_:function(t,e){var n,r=Un(t,"a","sub"),i=Un(e,"b","sub");n=we(r,i),r=n[0],i=n[1];var o=Zr(r.shape,i.shape);return _e.runKernelFunc((function(t){return t.subtract(r,i)}),{a:r,b:i},(function(t){return{a:function(){var e=t,n=Jr(r.shape,o);return n.length>0&&(e=e.sum(n)),e.reshape(r.shape)},b:function(){var e=t,n=Jr(i.shape,o);return n.length>0&&(e=e.sum(n)),e.neg().reshape(i.shape)}}}),"Sub")}}),Xi=tr({subStrict_:function(t,e){var n=Un(t,"a","subStrict"),r=Un(e,"b","subStrict");return gt(n.shape,r.shape,"Error in subStrict: "),n.sub(r)}}),Yi=tr({div_:function(t,e){var n,r=Un(t,"a","div"),i=Un(e,"b","div");if(n=we(r,i),r=n[0],i=n[1],"int32"===r.dtype&&"int32"===i.dtype)return Bi(r,i);var o={a:r,b:i};return _e.runKernelFunc((function(t,e){var n=t.realDivide(r,i);return e([r,i]),n}),o,null,Ur,{})}});function Ji(t,e){if(t.rank<1)throw new Error("tf.gatherND() expects the input to be rank 1 or higher, but the rank was "+t.rank+".");if(e.rank<1)throw new Error("tf.gatherND() expects the indices to be rank 1 or higher, but the rank was "+e.rank+".");if("int32"!==e.dtype)throw new Error("tf.gatherND() expects the indices to be int32 type, but the dtype was "+e.dtype+".");if(e.shape[e.rank-1]>t.rank)throw new Error("index innermost dimension length must be <= tensor rank; saw: "+e.shape[e.rank-1]+" vs. "+t.rank);if(0===t.size)throw new Error("Requested more than 0 entries, but input is empty. Input shape: "+t.shape+".");for(var n=e.shape,r=n[n.length-1],i=1,o=0;o1?e.shape[e.rank-1]:1,i=e.rank>1?e.rank-1:1,o="Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: "+n.shape+", indices.shape: "+e.shape+", shape: "+t+", sliceDim: "+r+", and batchDim: "+i+".";if(n.rank1?e.shape[r-1]:1,o=n.length,a=1,s=i;s0;)1&t&&e.push(n),t/=2,n++;return e}function io(t,e,n){for(var r=[],i=0;i0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);var s=r[i];return o<0&&(o+=s),ht(0,o,s-1)}function ao(t,e,n,r,i){var o=e[i],a=n[i]||1;(t&1<0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);var s=r[i];return o<0&&(o+=s),a>0?ht(0,o,s):ht(-1,o,s-1)}function so(t,e,n){for(var r=n.length,i=0;i1){r=i;break}for(i=r+1;i0||n[i]!==t[i])return!1;return!0}function uo(t,e){for(var n=t.length>0?t[t.length-1]:1,r=0;r=0&&t>>1)]);s>0?r=o+1:(i=o,a=!s)}return a?r:-r-1}(t,e,n||zo)}(t,e,n),i=r<0?-(r+1):r;t.splice(i,0,e)}function zo(t,e){return t>e?1:ti})).sort(Vo),c=o>0?-.5/o:0,l=[],f=[];l.length0;){var h=u.pop(),p=h.score,d=h.boxIndex,m=h.suppressBeginIndex;if(p=m;--v){var y=Wo(t,d,l[v]);if(y>=r){g=!0;break}if(h.score=h.score*Uo(r,c,y),h.score<=i)break}h.suppressBeginIndex=l.length,g||(h.score===p?(l.push(d),f.push(h.score)):h.score>i&&Bo(u,h,Vo))}var b=l.length;return s&&(l.fill(0,b),f.fill(0,b)),{selectedIndices:sr(l,"int32"),selectedScores:sr(f,"float32"),numValidOutputs:ar(b,"int32")}}function Wo(t,e,n){var r=t.subarray(4*e,4*e+4),i=t.subarray(4*n,4*n+4),o=Math.min(r[0],r[2]),a=Math.min(r[1],r[3]),s=Math.max(r[0],r[2]),u=Math.max(r[1],r[3]),c=Math.min(i[0],i[2]),l=Math.min(i[1],i[3]),f=Math.max(i[0],i[2]),h=Math.max(i[1],i[3]),p=(s-o)*(u-a),d=(f-c)*(h-l);if(p<=0||d<=0)return 0;var m=Math.max(o,c),g=Math.max(a,l),v=Math.min(s,f),y=Math.min(u,h),b=Math.max(v-m,0)*Math.max(y-g,0);return b/(p+d-b)}function Uo(t,e,n){var r=Math.exp(e*n*n);return n<=t?r:0}function Vo(t,e){return t.score-e.score||t.score===e.score&&e.boxIndex-t.boxIndex}function qo(t,e,n){var r=new Array(t.rank).fill(0),i=t.shape.slice();return e.map((function(e){i[n]=e;var o=t.slice(r,i);return r[n]+=e,o}))}function Ho(t,e){for(var n=new Array(t.rank),r=0;r":"<",u=n?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * "+r+";\n\n int bestIndex = inOffset;\n float bestValue = getA(batch, bestIndex);\n\n for (int i = 0; i < "+r+"; i++) {\n int inIdx = "+u+";\n float candidate = getA(batch, inIdx);\n if (candidate "+s+" bestValue) {\n bestValue = candidate;\n bestIndex = inIdx;\n }\n }\n setOutput(float(bestIndex));\n }\n "};function Jo(t,e){return["x","y","z","w","u","v"].slice(0,e).map((function(e){return t+"."+e}))}function Zo(t,e){return 1===e?[t]:Jo(t,e)}function Qo(){var t,e,n,r,i,o,a,s,u,c;return 2===et().getNumber("WEBGL_VERSION")?(t="#version 300 es",e="in",n="out",r="in",i="texture",o="outputColor",a="out vec4 outputColor;",s="\n bool isnan_custom(float val) {\n return (val > 0.0 || val < 0.0) ? false : val != 0.0;\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 "):(t="",e="attribute",n="varying",r="varying",i="texture2D",o="gl_FragColor",a="",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:t,attribute:e,varyingVs:n,varyingFs:r,texture2D:i,output:o,defineOutput:a,defineSpecialNaN:s,defineSpecialInf:u,defineRound:c}}function ta(t,e,n){void 0===n&&(n="index");var r=Vt(e);return r.map((function(e,i){return"int "+t[i]+" = "+n+" / "+e+"; "+(i===r.length-1?"int "+t[i+1]+" = "+n+" - "+t[i]+" * "+e:"index -= "+t[i]+" * "+e)+";"})).join("")}function ea(t){var e=Vt(t).map((function(t){return t.toString()}));return"\n int getFlatIndex(ivec3 coords) {\n return coords.x * "+e[0]+" + coords.y * "+e[1]+" + coords.z;\n }\n"}var na="\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";function ra(t,e,n,r){var i=[];t.forEach((function(t){var e=bt(t.shapeInfo.logicalShape);t.shapeInfo.isUniform?i.push("uniform float "+t.name+(e>1?"["+e+"]":"")+";"):(i.push("uniform sampler2D "+t.name+";"),i.push("uniform int offset"+t.name+";"))}));var o,a,s=i.join("\n"),u=t.map((function(t){return function(t,e,n){void 0===n&&(n=!1);var r="";r+=n?oa(t):ia(t);var i=t.shapeInfo.logicalShape,o=e.logicalShape;return i.length<=o.length&&(r+=n?function(t,e){var n,r=t.name,i=r.charAt(0).toUpperCase()+r.slice(1),o="get"+i+"AtOutCoords",a=t.shapeInfo.logicalShape.length,s=e.logicalShape.length,u=Yr(t.shapeInfo.logicalShape,e.logicalShape),c=ha(s),l=s-a,f=["x","y","z","w","u","v"];n=0===a?"":s<2&&u.length>=1?"coords = 0;":u.map((function(t){return"coords."+f[t+l]+" = 0;"})).join("\n");var h;h=s<2&&a>0?"coords":t.shapeInfo.logicalShape.map((function(t,e){return"coords."+f[e+l]})).join(", ");var p="return outputValue;",d=1===bt(t.shapeInfo.logicalShape),m=1===bt(e.logicalShape);if(1!==a||d||m){if(d&&!m)p=1===s?"\n return vec4(outputValue.x, outputValue.x, 0., 0.);\n ":"\n return vec4(outputValue.x);\n ";else if(u.length){var g=a-2,v=a-1;u.indexOf(g)>-1&&u.indexOf(v)>-1?p="return vec4(outputValue.x);":u.indexOf(g)>-1?p="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":u.indexOf(v)>-1&&(p="return vec4(outputValue.xx, outputValue.zz);")}}else p="\n return vec4(outputValue.xy, outputValue.xy);\n ";return"\n vec4 "+o+"() {\n "+c+" coords = getOutputCoords();\n "+n+"\n vec4 outputValue = get"+i+"("+h+");\n "+p+"\n }\n "}(t,e):function(t,e){var n=t.name,r=n.charAt(0).toUpperCase()+n.slice(1),i="get"+r+"AtOutCoords",o=e.texShape,a=t.shapeInfo.texShape,s=t.shapeInfo.logicalShape.length,u=e.logicalShape.length;if(!t.shapeInfo.isUniform&&s===u&&null==t.shapeInfo.flatOffset&&xt(a,o))return"\n float "+i+"() {\n return sampleTexture("+n+", resultUV);\n }\n ";var c,l=ha(u),f=Yr(t.shapeInfo.logicalShape,e.logicalShape),h=u-s,p=["x","y","z","w","u","v"];c=0===s?"":u<2&&f.length>=1?"coords = 0;":f.map((function(t){return"coords."+p[t+h]+" = 0;"})).join("\n");var d;return d=u<2&&s>0?"coords":t.shapeInfo.logicalShape.map((function(t,e){return"coords."+p[e+h]})).join(", "),"\n float "+i+"() {\n "+l+" coords = getOutputCoords();\n "+c+"\n return get"+r+"("+d+");\n }\n "}(t,e)),r}(t,e,r)})).join("\n"),c=e.texShape,l=Qo(),f=function(t){return"\n float sampleTexture(sampler2D textureSampler, vec2 uv) {\n return "+t.texture2D+"(textureSampler, uv).r;\n }\n "}(l),h=function(t){return t.version+"\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n "+t.varyingFs+" vec2 resultUV;\n "+t.defineOutput+"\n const vec2 halfCR = vec2(0.5, 0.5);\n\n struct ivec5\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n };\n\n struct ivec6\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n int v;\n };\n\n uniform float NAN;\n "+t.defineSpecialNaN+"\n "+t.defineSpecialInf+"\n "+t.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 "+aa+"\n "+sa+"\n "+ua+"\n "}(l);return e.isPacked?(o=function(t,e){switch(t.length){case 0:return"\n int getOutputCoords() {\n return 0;\n }\n ";case 1:return function(t,e){var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];return 1===n[0]?"\n int getOutputCoords() {\n return 2 * int(resultUV.x * "+n[1]+".0);\n }\n ":1===n[1]?"\n int getOutputCoords() {\n return 2 * int(resultUV.y * "+n[0]+".0);\n }\n ":"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+n[0]+", "+n[1]+"));\n return 2 * (resTexRC.x * "+n[1]+" + resTexRC.y);\n }\n "}(0,e);case 2:return function(t,e){var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];if(xt(t,e))return"\n ivec2 getOutputCoords() {\n return 2 * ivec2(resultUV.yx * vec2("+n[0]+", "+n[1]+"));\n }\n ";var r=Math.ceil(t[1]/2);return"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+n[0]+", "+n[1]+"));\n\n int index = resTexRC.x * "+n[1]+" + resTexRC.y;\n int r = 2 * (index / "+r+");\n int c = imod(index, "+r+") * 2;\n\n return ivec2(r, c);\n }\n "}(t,e);case 3:return n=t,r=e,i=[Math.ceil(r[0]/2),Math.ceil(r[1]/2)],a=(o=Math.ceil(n[2]/2))*Math.ceil(n[1]/2),"\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+i[0]+", "+i[1]+"));\n int index = resTexRC.x * "+i[1]+" + resTexRC.y;\n\n int b = index / "+a+";\n index -= b * "+a+";\n\n int r = 2 * (index / "+o+");\n int c = imod(index, "+o+") * 2;\n\n return ivec3(b, r, c);\n }\n ";default:return function(t,e){for(var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)],r=Math.ceil(t[t.length-1]/2),i=r*Math.ceil(t[t.length-2]/2),o=i,a="",s="b, r, c",u=2;u2,(function(){return"Packed arg"+(n.charAt(0).toUpperCase()+n.slice(1))+" supports only inputs with rank above 2."}));var i=t[t.length-1],o=Math.ceil(i/e);this.outputShape=t.slice(0,-1),o>1&&this.outputShape.push(o),r||this.variableNames.push("bestIndicesA");var a,s,u=this.outputShape,c=u.length,l=ha(c),f=Zo("coords",c);if(1===o){var h=ha(s=c+1);a="\n "+h+" sourceLocR = "+h+"("+f.join()+", 0);\n ++"+f[c-1]+";\n "+h+" sourceLocG = "+h+"("+f.join()+", 0);\n ++"+f[c-2]+";\n "+h+" sourceLocA = "+h+"("+f.join()+", 0);\n --"+f[c-1]+";\n "+h+" sourceLocB = "+h+"("+f.join()+", 0);\n --"+f[c-2]+";"}else s=c,a="\n "+l+" sourceLocR = coords;\n ++"+f[c-1]+";\n "+l+" sourceLocG = coords;\n ++"+f[c-2]+";\n "+l+" sourceLocA = coords;\n --"+f[c-1]+";\n "+l+" sourceLocB = coords;\n --"+f[c-2]+";";var p=["x","y","z","w","u","v"].slice(0,s),d="."+p[s-1],m=p.map((function(t){return"int "+t})),g=Zo("sourceLocR",s-1).concat("inIdx.r"),v=Zo("sourceLocG",s-1).concat("inIdx.g"),y=Zo("sourceLocB",s-1).concat("inIdx.b"),b=Zo("sourceLocA",s-1).concat("inIdx.a"),x="max"===n?"greaterThan":"lessThan",w=r?"":"\n inIdx = round(vec4(getBestIndicesAChannel("+g.join()+"),\n getBestIndicesAChannel("+v.join()+"),\n getBestIndicesAChannel("+y.join()+"),\n getBestIndicesAChannel("+b.join()+")));",k="vec4(\n getAChannel("+g.join()+"),\n hasNextCol ? getAChannel("+v.join()+") : 0.,\n hasNextRow ? getAChannel("+y.join()+") : 0.,\n hasNextRow && hasNextCol ? getAChannel("+b.join()+") : 0.)",E=r?"":"\n float getBestIndicesAChannel("+m.join()+") {\n return getChannel(getBestIndicesA("+p.join()+"),\n vec2("+p.slice(-2).join()+"));\n }";this.userCode="\n float getAChannel("+m.join()+") {\n return getChannel(getA("+p.join()+"),\n vec2("+p.slice(-2).join()+"));\n }\n "+E+"\n void main() {\n "+l+" coords = getOutputCoords();\n bool hasNextCol = "+f[c-1]+" < "+(u[c-1]-1)+";\n bool hasNextRow = "+f[c-2]+" < "+(u[c-2]-1)+";\n "+a+"\n ivec4 srcIdx = ivec4(sourceLocR"+d+", sourceLocG"+d+",\n sourceLocB"+d+", sourceLocA"+d+") * "+e+";\n ivec4 inIdx = srcIdx;\n vec4 bestIndex = vec4(inIdx);\n vec4 bestValue = "+k+";\n\n for (int i = 0; i < "+e+"; i++) {\n inIdx = srcIdx;\n "+w+"\n vec4 candidate = "+k+";\n bvec4 nan = isnan(candidate);\n bvec4 replace = bvec4(\n vec4("+x+"(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 "},ga=function(t){this.variableNames=["dy"],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,r=t.strideHeight,i=t.strideWidth,o=t.dilationHeight,a=t.dilationWidth,s=t.effectiveFilterHeight,u=t.effectiveFilterWidth,c=s-1-t.padInfo.top,l=u-1-t.padInfo.left,f=1/(e*n);this.userCode="\n const ivec2 pads = ivec2("+c+", "+l+");\n const float avgMultiplier = float("+f+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+s+";\n wR += "+o+") {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+u+";\n wC+= "+a+") {\n float dyC = float(dyCCorner + wC) / "+i+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n setOutput(dotProd);\n }\n "},va=function(t){this.variableNames=["dy"],this.outputShape=t.inShape;var e=t.filterDepth,n=t.filterHeight,r=t.filterWidth,i=t.strideDepth,o=t.strideHeight,a=t.strideWidth,s=t.dilationDepth,u=t.dilationHeight,c=t.dilationWidth,l=t.effectiveFilterDepth,f=t.effectiveFilterHeight,h=t.effectiveFilterWidth,p=l-1-t.padInfo.front,d=f-1-t.padInfo.top,m=h-1-t.padInfo.left,g=1/(e*n*r);this.userCode="\n const ivec3 pads = ivec3("+p+", "+d+", "+m+");\n const float avgMultiplier = float("+g+");\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 < "+l+";\n wD += "+s+") {\n float dyD = float(dyDCorner + wD) / "+i+".0;\n\n if (dyD < 0.0 || dyD >= "+t.outDepth+".0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < "+f+";\n wR += "+u+") {\n float dyR = float(dyRCorner + wR) / "+o+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+h+";\n wC += "+c+") {\n float dyC = float(dyCCorner + wC) / "+a+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n }\n setOutput(dotProd);\n }\n "},ya=function(t,e,n,r,i,o){this.outputShape=[],this.variableNames=["x","mean","variance"],Zr(t,e),Zr(t,n);var a="0.0";null!=r&&(Zr(t,r),this.variableNames.push("offset"),a="getOffsetAtOutCoords()");var s="1.0";null!=i&&(Zr(t,i),this.variableNames.push("scale"),s="getScaleAtOutCoords()"),this.outputShape=t,this.userCode="\n void main() {\n float x = getXAtOutCoords();\n float mean = getMeanAtOutCoords();\n float variance = getVarianceAtOutCoords();\n float offset = "+a+";\n float scale = "+s+";\n float inv = scale * inversesqrt(variance + float("+o+"));\n setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));\n }\n "},ba=function(t,e,n,r,i,o){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],Zr(t,e),Zr(t,n);var a="vec4(0.0)";null!=r&&(Zr(t,r),this.variableNames.push("offset"),a="getOffsetAtOutCoords()");var s="vec4(1.0)";null!=i&&(Zr(t,i),this.variableNames.push("scale"),s="getScaleAtOutCoords()"),this.outputShape=t,this.userCode="\n void main() {\n vec4 offset = "+a+";\n vec4 scale = "+s+";\n\n vec4 x = getXAtOutCoords();\n vec4 mean = getMeanAtOutCoords();\n vec4 variance = getVarianceAtOutCoords();\n\n vec4 inv = scale * inversesqrt(variance + vec4("+o+"));\n\n setOutput((x - mean) * inv + offset);\n }\n "},xa=function(t,e,n){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=Zr(e,n),this.userCode="\n float binaryOpComplex(\n float areal, float aimag, float breal, float bimag) {\n "+t+"\n }\n\n void main() {\n float areal = getARealAtOutCoords();\n float aimag = getAImagAtOutCoords();\n float breal = getBRealAtOutCoords();\n float bimag = getBImagAtOutCoords();\n setOutput(binaryOpComplex(areal, aimag, breal, bimag));\n }\n "},wa="return a + b;",ka="return a - b;",Ea="return a * b;",Ca="return (a < 0.) ? b * a : a;",Sa=function(t,e,n){this.variableNames=["A","B"],this.outputShape=Zr(e,n),this.userCode="\n float binaryOperation(float a, float b) {\n "+t+"\n }\n\n void main() {\n float a = getAAtOutCoords();\n float b = getBAtOutCoords();\n setOutput(binaryOperation(a, b));\n }\n "},Aa="\n vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n",Oa=function(t,e,n,r){void 0===r&&(r=!1),this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=Zr(e,n);var i=this.outputShape.length,o="";if(r)if(0===i||1===bt(this.outputShape))o="\n result.y = 0.;\n result.z = 0.;\n result.w = 0.;\n ";else if(o="\n "+ha(i)+" coords = getOutputCoords();\n ",1===i)o+="\n result.y = (coords + 1) >= "+this.outputShape[0]+" ? 0. : result.y;\n result.z = 0.;\n result.w = 0.;\n ";else{var a=Zo("coords",i);o+="\n bool nextRowOutOfBounds =\n ("+a[i-2]+" + 1) >= "+this.outputShape[i-2]+";\n bool nextColOutOfBounds =\n ("+a[i-1]+" + 1) >= "+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 "+t+"\n }\n\n void main() {\n vec4 a = getAAtOutCoords();\n vec4 b = getBAtOutCoords();\n\n vec4 result = binaryOperation(a, b);\n "+o+"\n\n setOutput(result);\n }\n "},_a=function(){function t(t){this.variableNames=["A"],this.outputShape=t,this.userCode="\n uniform float minVal;\n uniform float maxVal;\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 "}return t.prototype.getCustomSetupFunc=function(t,e){var n=this;return function(r,i){null==n.minLoc&&(n.minLoc=r.getUniformLocationNoThrow(i,"minVal"),n.maxLoc=r.getUniformLocationNoThrow(i,"maxVal")),r.gl.uniform1f(n.minLoc,t),r.gl.uniform1f(n.maxLoc,e)}},t}(),Na=function(){function t(t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t,this.userCode="\n uniform float minVal;\n uniform float maxVal;\n\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 "}return t.prototype.getCustomSetupFunc=function(t,e){var n=this;return function(r,i){null==n.minLoc&&(n.minLoc=r.getUniformLocationNoThrow(i,"minVal"),n.maxLoc=r.getUniformLocationNoThrow(i,"maxVal")),r.gl.uniform1f(n.minLoc,t),r.gl.uniform1f(n.maxLoc,e)}},t}(),Ta=function(t){this.variableNames=["real","imag"],this.outputShape=t,this.userCode="\n void main() {\n float re = abs(getRealAtOutCoords());\n float im = abs(getImagAtOutCoords());\n float mx = max(re, im);\n\n // sadly the length function in glsl is not underflow-safe\n // (at least not on Intel GPUs). So the safe solution is\n // to ensure underflow-safety in all cases.\n setOutput(\n mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx))\n );\n }\n "},Da=function(t){this.outputShape=[],this.outputShape=Qn(t,1),this.variableNames=t.map((function(t,e){return"T"+e}));var e=new Array(t.length-1);e[0]=t[0][1];for(var n=1;n= "+s[u-1]+") {\n return getChannel(\n getT"+u+"("+Ra(a,c,p)+"),\n vec2("+Ra(l,c,p)+"));\n }"}var d=s.length,m=s[s.length-1];h+="\n return getChannel(\n getT"+d+"("+Ra(a,c,m)+"),\n vec2("+Ra(l,c,m)+"));",this.userCode="\n float getValue("+a.map((function(t){return"int "+t}))+") {\n "+h+"\n }\n\n void main() {\n "+i+" coords = getOutputCoords();\n vec4 result = vec4(getValue("+o+"), 0., 0., 0.);\n\n "+o[r-1]+" = "+o[r-1]+" + 1;\n if ("+o[r-1]+" < "+n[r-1]+") {\n result.g = getValue("+o+");\n }\n\n "+o[r-2]+" = "+o[r-2]+" + 1;\n if ("+o[r-2]+" < "+n[r-2]+") {\n result.a = getValue("+o+");\n }\n\n "+o[r-1]+" = "+o[r-1]+" - 1;\n if ("+o[r-2]+" < "+n[r-2]+" &&\n "+o[r-1]+" < "+n[r-1]+") {\n result.b = getValue("+o+");\n }\n setOutput(result);\n }\n "};function Ra(t,e,n){var r=t.indexOf(e);return t.map((function(t,e){return e===r?t+" - "+n:t})).join()}var Fa=function(t){this.variableNames=["x","dy"],this.outputShape=t.filterShape;var e=t.strideHeight,n=t.strideWidth,r=t.padInfo.top,i=t.padInfo.left,o="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 < "+t.batchSize+"; b++) {\n for (int yR = 0; yR < "+t.outHeight+"; yR++) {\n int xR = wR + yR * "+e+" - "+r+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n int xC = wC + yC * "+n+" - "+i+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n if ("+o+") {\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n } else {\n float dyValue = getDy(b, d2, yR, yC);\n float xValue = getX(b, d1, xR, xC);\n dotProd += (xValue * dyValue);\n }\n\n }\n }\n }\n setOutput(dotProd);\n }\n "},Ma=function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,r=t.strideHeight,i=t.strideWidth,o="channelsLast"===t.dataFormat,a=e-1-t.padInfo.top,s=n-1-t.padInfo.left,u=o?1:2,c=o?2:3,l=o?3:1;this.userCode="\n const ivec2 pads = ivec2("+a+", "+s+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords["+l+"];\n\n ivec2 dyCorner = ivec2(coords["+u+"], coords["+c+"]) - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+e+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+e+" - 1 - wR;\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+i+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+n+" - 1 - wC;\n\n for (int d2 = 0; d2 < "+t.outChannels+"; d2++) {\n\n if ("+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 "},Ba=function(t){this.variableNames=["x","dy"],this.outputShape=t.filterShape;var e=t.strideDepth,n=t.strideHeight,r=t.strideWidth,i=t.padInfo.front,o=t.padInfo.top,a=t.padInfo.left;this.userCode="\n void main() {\n ivec5 coords = getOutputCoords();\n int wF = coords.x;\n int wR = coords.y;\n int wC = coords.z;\n int d1 = coords.w;\n int d2 = coords.u;\n\n float dotProd = 0.0;\n\n for (int b = 0; b < "+t.batchSize+"; b++) {\n for (int yF = 0; yF < "+t.outDepth+"; yF++) {\n int xF = wF + yF * "+e+" - "+i+";\n\n if (xF < 0 || xF >= "+t.inDepth+") {\n continue;\n }\n\n for (int yR = 0; yR < "+t.outHeight+"; yR++) {\n int xR = wR + yR * "+n+" - "+o+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n int xC = wC + yC * "+r+" - "+a+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float dyValue = getDy(b, yF, yR, yC, d2);\n float xValue = getX(b, xF, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n "},za=function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterDepth,n=t.filterHeight,r=t.filterWidth,i=t.strideDepth,o=t.strideHeight,a=t.strideWidth,s=e-1-t.padInfo.front,u=n-1-t.padInfo.top,c=r-1-t.padInfo.left;this.userCode="\n const ivec3 pads = ivec3("+s+", "+u+", "+c+");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d1 = coords.u;\n\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyFCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n float dotProd = 0.0;\n for (int wF = 0; wF < "+e+"; wF++) {\n float dyF = float(dyFCorner + wF) / "+i+".0;\n\n if (dyF < 0.0 || dyF >= "+t.outDepth+".0 || fract(dyF) > 0.0) {\n continue;\n }\n int idyF = int(dyF);\n\n int wFPerm = "+e+" - 1 - wF;\n\n for (int wR = 0; wR < "+n+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+o+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+n+" - 1 - wR;\n\n for (int wC = 0; wC < "+r+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+a+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+r+" - 1 - wC;\n\n for (int d2 = 0; d2 < "+t.outChannels+"; d2++) {\n float xValue = getDy(batch, idyF, idyR, idyC, d2);\n float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n }\n }\n }\n setOutput(dotProd);\n }\n "},ja=function(t){this.variableNames=["x","dy"],this.outputShape=t.filterShape;var e=t.strideHeight,n=t.strideWidth,r=t.padInfo.top,i=t.padInfo.left,o=t.outChannels/t.inChannels;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int dm = coords.w;\n int d2 = d1 * "+o+" + dm;\n\n float dotProd = 0.0;\n\n // TO DO: Vec4 over the batch size\n for (int b = 0; b < "+t.batchSize+"; b++) {\n for (int yR = 0; yR < "+t.outHeight+"; yR++) {\n int xR = wR + yR * "+e+" - "+r+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n int xC = wC + yC * "+n+" - "+i+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n setOutput(dotProd);\n }\n "},Pa=function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,r=t.strideHeight,i=t.strideWidth,o=e-1-t.padInfo.top,a=n-1-t.padInfo.left,s=t.outChannels/t.inChannels;this.userCode="\n const ivec2 pads = ivec2("+o+", "+a+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[3];\n ivec2 dyCorner = coords.yz - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n float dotProd = 0.0;\n\n for (int wR = 0; wR < "+e+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+e+" - 1 - wR;\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+i+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+n+" - 1 - wC;\n\n // TO DO: Vec4 over the channelMul\n for (int dm = 0; dm < "+s+"; dm++) {\n int d2 = d1 * "+s+" + dm;\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, dm);\n dotProd += xValue * wValue;\n }\n }\n }\n setOutput(dotProd);\n }\n "},La=function(t,e,n,r){void 0===e&&(e=!1),void 0===n&&(n=null),void 0===r&&(r=!1),this.variableNames=["x","W"],this.outputShape=t.outShape;var i=t.padInfo.top,o=t.padInfo.left,a=t.strideHeight,s=t.strideWidth,u=t.dilationHeight,c=t.dilationWidth,l=t.filterHeight,f=t.filterWidth,h=4*Math.floor(t.inChannels/4),p=t.inChannels%4,d="channelsLast"===t.dataFormat,m=d?1:2,g=d?2:3,v=d?3:1,y="",b="";n&&(y=r?"float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n "+n+"\n }":"\n float activation(float x) {\n "+n+"\n }\n ",b="result = activation(result);");var x=e?"result += getBiasAtOutCoords();":"";e&&this.variableNames.push("bias"),r&&this.variableNames.push("preluActivationWeights"),this.userCode="\n "+y+"\n\n const ivec2 strides = ivec2("+a+", "+s+");\n const ivec2 pads = ivec2("+i+", "+o+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d2 = coords["+v+"];\n\n ivec2 xRCCorner =\n ivec2(coords["+m+"], coords["+g+"]) * 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 < "+l+"; wR++) {\n int xR = xRCorner + wR * "+u+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+f+"; wC++) {\n int xC = xCCorner + wC * "+c+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n for (int d1 = 0; d1 < "+h+"; 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 ("+d+") {\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 ("+(1===p)+") {\n\n if ("+d+") {\n dotProd +=\n getX(batch, xR, xC, "+h+") *\n getW(wR, wC, "+h+", d2);\n } else {\n dotProd +=\n getX(batch, "+h+", xR, xC) *\n getW(wR, wC, "+h+", d2);\n }\n\n } else if ("+(2===p)+") {\n vec2 wValues = vec2(\n getW(wR, wC, "+h+", d2),\n getW(wR, wC, "+h+" + 1, d2)\n );\n\n if ("+d+") {\n vec2 xValues = vec2(\n getX(batch, xR, xC, "+h+"),\n getX(batch, xR, xC, "+h+" + 1)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec2 xValues = vec2(\n getX(batch, "+h+", xR, xC),\n getX(batch, "+h+" + 1, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n } else if ("+(3===p)+") {\n vec3 wValues = vec3(\n getW(wR, wC, "+h+", d2),\n getW(wR, wC, "+h+" + 1, d2),\n getW(wR, wC, "+h+" + 2, d2)\n );\n\n if ("+d+") {\n vec3 xValues = vec3(\n getX(batch, xR, xC, "+h+"),\n getX(batch, xR, xC, "+h+" + 1),\n getX(batch, xR, xC, "+h+" + 2)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec3 xValues = vec3(\n getX(batch, "+h+", xR, xC),\n getX(batch, "+h+" + 1, xR, xC),\n getX(batch, "+h+" + 2, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n }\n }\n }\n\n float result = dotProd;\n "+x+"\n "+b+"\n setOutput(result);\n }\n "},Wa=function(t){this.variableNames=["x","W"],this.outputShape=t.outShape;var e=t.padInfo.front,n=t.padInfo.top,r=t.padInfo.left,i=t.strideDepth,o=t.strideHeight,a=t.strideWidth,s=t.dilationDepth,u=t.dilationHeight,c=t.dilationWidth,l=t.filterDepth,f=t.filterHeight,h=t.filterWidth,p=4*Math.floor(t.inChannels/4),d=t.inChannels%4;this.userCode="\n const ivec3 strides = ivec3("+i+", "+o+", "+a+");\n const ivec3 pads = ivec3("+e+", "+n+", "+r+");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d2 = coords.u;\n\n ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xFCorner = xFRCCorner.x;\n int xRCorner = xFRCCorner.y;\n int xCCorner = xFRCCorner.z;\n\n // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get\n // y(yF, yR, yC, d2). ? = to be determined. : = across all\n // values in that axis.\n float dotProd = 0.0;\n for (int wF = 0; wF < "+l+"; wF++) {\n int xF = xFCorner + wF * "+s+";\n\n if (xF < 0 || xF >= "+t.inDepth+") {\n continue;\n }\n\n for (int wR = 0; wR < "+f+"; wR++) {\n int xR = xRCorner + wR * "+u+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+h+"; wC++) {\n int xC = xCCorner + wC * "+c+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n for (int d1 = 0; d1 < "+p+"; d1 += 4) {\n vec4 xValues = vec4(\n getX(batch, xF, xR, xC, d1),\n getX(batch, xF, xR, xC, d1 + 1),\n getX(batch, xF, xR, xC, d1 + 2),\n getX(batch, xF, xR, xC, d1 + 3)\n );\n vec4 wValues = vec4(\n getW(wF, wR, wC, d1, d2),\n getW(wF, wR, wC, d1 + 1, d2),\n getW(wF, wR, wC, d1 + 2, d2),\n getW(wF, wR, wC, d1 + 3, d2)\n );\n\n dotProd += dot(xValues, wValues);\n }\n\n if ("+(1===d)+") {\n dotProd +=\n getX(batch, xF, xR, xC, "+p+") *\n getW(wF, wR, wC, "+p+", d2);\n } else if ("+(2===d)+") {\n vec2 xValues = vec2(\n getX(batch, xF, xR, xC, "+p+"),\n getX(batch, xF, xR, xC, "+p+" + 1)\n );\n vec2 wValues = vec2(\n getW(wF, wR, wC, "+p+", d2),\n getW(wF, wR, wC, "+p+" + 1, d2)\n );\n dotProd += dot(xValues, wValues);\n } else if ("+(3===d)+") {\n vec3 xValues = vec3(\n getX(batch, xF, xR, xC, "+p+"),\n getX(batch, xF, xR, xC, "+p+" + 1),\n getX(batch, xF, xR, xC, "+p+" + 2)\n );\n vec3 wValues = vec3(\n getW(wF, wR, wC, "+p+", d2),\n getW(wF, wR, wC, "+p+" + 1, d2),\n getW(wF, wR, wC, "+p+" + 2, d2)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n "},Ua=function(t,e,n,r){void 0===e&&(e=!1),void 0===n&&(n=null),void 0===r&&(r=!1),this.variableNames=["x","W"],this.outputShape=t.outShape;var i=t.inHeight,o=t.inWidth,a=t.padInfo.top,s=t.padInfo.left,u=t.strideHeight,c=t.strideWidth,l=t.dilationHeight,f=t.dilationWidth,h=t.filterHeight,p=t.filterWidth,d=t.outChannels/t.inChannels,m="",g="";n&&(m=r?"float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n "+n+"\n }":"\n float activation(float x) {\n "+n+"\n }\n ",g="result = activation(result);");var v=e?"result += getBiasAtOutCoords();":"";e&&this.variableNames.push("bias"),r&&this.variableNames.push("preluActivationWeights"),this.userCode="\n "+m+"\n\n const ivec2 strides = ivec2("+u+", "+c+");\n const ivec2 pads = ivec2("+a+", "+s+");\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 / "+d+";\n int q = d2 - d1 * "+d+";\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 < "+h+"; wR++) {\n int xR = xRCorner + wR * "+l+";\n\n if (xR < 0 || xR >= "+i+") {\n continue;\n }\n\n for (int wC = 0; wC < "+p+"; wC++) {\n int xC = xCCorner + wC * "+f+";\n\n if (xC < 0 || xC >= "+o+") {\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 "+v+"\n "+g+"\n setOutput(result);\n }\n "},Va=function(t,e,n,r){void 0===e&&(e=!1),void 0===n&&(n=null),void 0===r&&(r=!1),this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.outShape;for(var i=t.inHeight,o=t.inWidth,a=t.padInfo.top,s=t.padInfo.left,u=t.strideHeight,c=t.strideWidth,l=t.dilationHeight,f=t.dilationWidth,h=t.filterHeight,p=t.filterWidth,d=p,m="int xR; int xC; int xCOffset;",g=0;g= 0 && xR < "+i+" && xCOffset >= 0 && xCOffset < "+o+") {\n xTexelR"+g+"C"+v+" = 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 >= "+o+") {\n xTexelR"+g+"C"+v+".zw = vec2(0.);\n }\n } else {\n xTexelR"+g+"C"+v+" = vec4(0.);\n }\n\n xCOffset = xC + 1 - 2;\n if(xR >= 0 && xR < "+i+" && xCOffset >= 0 && xCOffset < "+o+") {\n vec4 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 >= "+o+") {\n previous.zw = vec2(0.);\n }\n\n xR"+g+"C"+v+" = vec4(previous.zw, xTexelR"+g+"C"+v+".xy);\n } else {\n xR"+g+"C"+v+" = vec4(0, 0, xTexelR"+g+"C"+v+".xy);\n }\n ":"\n if(xR >= 0 && xR < "+i+" && xC >= 0 && xC < "+o+") {\n xTexelR"+g+"C"+v+" = getX(batch, xR, xC, d1);\n } else {\n xTexelR"+g+"C"+v+" = vec4(0.);\n }\n\n xR"+g+"C"+v+" = xTexelR"+g+"C"+v+";\n ",v+1= 0 && xR < "+i+" &&\n xCOffset >= 0 && xCOffset < "+o+") {\n xTexelR"+g+"C"+(v+2)+" = getX(batch, xR, xCOffset, d1);\n }\n ",f>1&&(m+="\n xCOffset -= 2;\n if(xR >= 0 && xR < "+i+" &&\n xCOffset >= 0 && xCOffset < "+o+") {\n xTexelR"+g+"C"+v+" = getX(batch, xR, xCOffset, d1);\n } else {\n xTexelR"+g+"C"+v+" = vec4(0.);\n }\n "),m+="\n xR"+g+"C"+(v+1)+" = vec4(\n xTexelR"+g+"C"+v+".zw, xTexelR"+g+"C"+(v+2)+".xy);\n "):m+="\n xCOffset = xC + "+b+";\n\n if(xR >= 0 && xR < "+i+" &&\n xCOffset >= 0 && xCOffset < "+o+") {\n xTexelR"+g+"C"+(v+2)+" = getX(batch, xR, xCOffset, d1);\n }\n\n xR"+g+"C"+(v+1)+" = xTexelR"+g+"C"+(v+2)+";\n "}}else v= 0 && xR < "+i+") {\n ",s%2==1?(m+="\n xCOffset = xC + 1 - "+c+";\n if(xCOffset >= 0 && xCOffset < "+o+") {\n xTexelR"+g+"C"+v+" = getX(batch, xR, xCOffset, d1);\n } else {\n xTexelR"+g+"C"+v+" = vec4(0.);\n }\n\n if(xC + 1 >= 0 && xC + 1 < "+o+") {\n xTexelR"+g+"C"+(v+2)+" = getX(batch, xR, xC + 1, d1);\n } else {\n xTexelR"+g+"C"+(v+2)+" = vec4(0.);\n }\n\n xR"+g+"C"+v+" = vec4(\n xTexelR"+g+"C"+v+".zw, xTexelR"+g+"C"+(v+2)+".zw);\n ",v+1= 0 && xCOffset < "+o+") {\n final = getX(batch, xR, xCOffset, d1);\n }\n xR"+g+"C"+(v+1)+" = vec4(xTexelR"+g+"C"+(v+2)+".xy, final.xy);\n ")):(m+="\n if(xC >= 0 && xC < "+o+") {\n xTexelR"+g+"C"+v+" = getX(batch, xR, xC, d1);\n } else {\n xTexelR"+g+"C"+v+" = vec4(0.);\n }\n\n xCOffset = xC + "+c+";\n if(xCOffset >= 0 && xCOffset < "+o+") {\n xTexelR"+g+"C"+(v+2)+" = getX(batch, xR, xCOffset, d1);\n } else {\n xTexelR"+g+"C"+(v+2)+" = vec4(0.);\n }\n\n xR"+g+"C"+v+" = vec4(\n xTexelR"+g+"C"+v+".xy, xTexelR"+g+"C"+(v+2)+".xy);\n ",v+11?[""+(a-1)/(l-1),"(y2-y1) * height_ratio","y1*"+d+" + float(y)*(height_scale)"]:["0.0","0.0","0.5 * (y1+y2) * "+d],v=g[0],y=g[1],b=g[2],x=f>1?[""+(s-1)/(f-1),"(x2-x1) * width_ratio","x1*"+m+" + float(x)*(width_scale)"]:["0.0","0.0","0.5 * (x1+x2) * "+m],w=x[0],k=x[1],E=x[2];this.userCode="\n const float height_ratio = float("+v+");\n const float width_ratio = float("+w+");\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int y = coords[1];\n int x = coords[2];\n int d = coords[3];\n\n // get box vals\n float y1 = getBoxes(b,0);\n float x1 = getBoxes(b,1);\n float y2 = getBoxes(b,2);\n float x2 = getBoxes(b,3);\n\n // get image in batch index\n int bInd = round(getBoxInd(b));\n if(bInd < 0 || bInd >= "+o+") {\n return;\n }\n\n float height_scale = "+y+";\n float width_scale = "+k+";\n\n float in_y = "+b+";\n if( in_y < 0.0 || in_y > "+d+" ) {\n setOutput(float("+i+"));\n return;\n }\n float in_x = "+E+";\n if( in_x < 0.0 || in_x > "+m+" ) {\n setOutput(float("+i+"));\n return;\n }\n\n vec2 sourceFracIndexCR = vec2(in_x,in_y);\n if("+h+" == 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 "},Ha=function(t,e,n){this.variableNames=["x"],this.outputShape=t;var r=t.length,i=t[t.length-1],o=n?"<":">";this.userCode="\n int getIndex(int i) {\n "+(n?"return "+i+" -i - 1;":"return i;")+"\n }\n\n void main() {\n "+ha(r)+" coords = getOutputCoords();\n int end = "+Ga(r,"coords")+";\n float val = 0.0;\n for (int i = "+i+" - 1; i >= 0; i -= 1) {\n int idx = getIndex(i);\n if (idx "+o+" end) {\n continue;\n }\n if (idx == end && "+e+") {\n continue;\n }\n "+Ga(r,"coords")+" = idx;\n val += getX("+function(t,e){if(1===t)return""+e;if(2===t)return e+".x, "+e+".y";if(3===t)return e+".x, "+e+".y, "+e+".z";if(4===t)return e+".x, "+e+".y, "+e+".z, "+e+".w";throw Error("Cumulative sum for rank "+t+" is not yet supported")}(r,"coords")+");\n }\n setOutput(val);\n }\n "};function Ga(t,e){if(1===t)return""+e;if(2===t)return e+".y";if(3===t)return e+".z";if(4===t)return e+".w";throw Error("Cumulative sum for rank "+t+" is not yet supported")}var $a=function(t){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=De.DENSE;var e=Pe(t),n=Qo();this.outputShape=t,this.userCode="\n ivec3 outCoordsFromFlatIndex(int index) {\n "+ta(["r","c","d"],t)+"\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = 4 * (resTexRC.x * "+e[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 "+n.output+" = result;\n }\n "},Ka=function(t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=De.DENSE;var e=Pe(t),n=Qo();this.outputShape=t,this.userCode="\n ivec3 outCoordsFromFlatIndex(int index) {\n "+ta(["r","c","d"],t)+"\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = 4 * (resTexRC.x * "+e[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 "+n.output+" = result;\n }\n "},Xa=function(){function t(t,e,n){this.variableNames=["x"],this.outputShape=[],this.outputShape=t,this.blockSize=e,this.dataFormat=n,this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int h = "+this.getHeightCoordString()+";\n int w = "+this.getWidthCoordString()+";\n int d = "+this.getDepthCoordString()+";\n\n int in_h = h / "+e+";\n int offset_h = imod(h, "+e+");\n int in_w = w / "+e+";\n int offset_w = imod(w, "+e+");\n int offset_d = (offset_h * "+e+" + offset_w) *\n "+this.getOutputDepthSize()+";\n int in_d = d + offset_d;\n\n float result = "+this.getInputSamplingString()+";\n setOutput(result);\n }\n "}return t.prototype.getHeightCoordString=function(){return"NHWC"===this.dataFormat?"coords[1]":"coords[2]"},t.prototype.getWidthCoordString=function(){return"NHWC"===this.dataFormat?"coords[2]":"coords[3]"},t.prototype.getDepthCoordString=function(){return"NHWC"===this.dataFormat?"coords[3]":"coords[1]"},t.prototype.getOutputDepthSize=function(){return"NHWC"===this.dataFormat?this.outputShape[3]:this.outputShape[1]},t.prototype.getInputSamplingString=function(){return"NHWC"===this.dataFormat?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"},t}(),Ya=function(t){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 "},Ja=function(t){this.variableNames=["A"],this.outTexUsage=Ie.DOWNLOAD;var e=Qo();this.outputShape=t,this.userCode="\n "+na+"\n\n void main() {\n float x = getAAtOutCoords();\n "+e.output+" = encode_float(x);\n }\n "},Za=function(t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=Ie.DOWNLOAD;var e=Qo();this.outputShape=t,this.userCode="\n "+na+"\n\n void main() {\n ivec3 coords = getOutputCoords();\n float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z));\n "+e.output+" = encode_float(x);\n }\n "},Qa=function(t,e,n){void 0===n&&(n=!1),this.variableNames=["A"];var r=Qo(),i=e[0],o=e[1];this.outputShape=t;var a="result";n&&(a="floor(result * 255. + 0.5)"),this.userCode="\n "+ea(t)+"\n\n void main() {\n ivec3 coords = getOutputCoords();\n\n int flatIndex = getFlatIndex(coords);\n int offset = imod(flatIndex, 4);\n\n flatIndex = idiv(flatIndex, 4, 1.);\n \n int r = flatIndex / "+o+";\n int c = imod(flatIndex, "+o+");\n vec2 uv = (vec2(c, r) + halfCR) / vec2("+o+".0, "+i+".0);\n vec4 values = "+r.texture2D+"(A, uv);\n\n float result;\n\n if(offset == 0) {\n result = values[0];\n } else if(offset == 1) {\n result = values[1];\n } else if(offset == 2) {\n result = values[2];\n } else {\n result = values[3];\n }\n\n "+r.output+" = vec4("+a+", 0., 0., 0.);\n }\n "},ts=function(t,e,n){void 0===n&&(n=!1),this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;var r=Qo(),i=e[0],o=e[1];this.outputShape=t;var a="",s="result";n&&(s="floor(result * 255. + 0.5)");for(var u=0;u<=1;u++)for(var c=0;c<=1;c++){var l=2*u+c;a+="\n localCoords = coords;\n if(localCoords[2] + "+c+" < "+t[2]+") {\n localCoords[2] += "+c+";\n if(localCoords[1] + "+u+" < "+t[1]+") {\n localCoords[1] += "+u+";\n\n flatIndex = getFlatIndex(localCoords);\n offset = imod(flatIndex, 4);\n\n flatIndex = idiv(flatIndex, 4, 1.);\n\n r = flatIndex / "+o+";\n c = imod(flatIndex, "+o+");\n uv = (vec2(c, r) + halfCR) / vec2("+o+".0, "+i+".0);\n values = "+r.texture2D+"(A, uv);\n\n if(offset == 0) {\n result["+l+"] = values[0];\n } else if(offset == 1) {\n result["+l+"] = values[1];\n } else if(offset == 2) {\n result["+l+"] = values[2];\n } else {\n result["+l+"] = values[3];\n }\n }\n }\n "}this.userCode="\n "+ea(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 "+a+"\n\n "+r.output+" = "+s+";\n }\n "},es=function(t,e,n){this.variableNames=["real","imag"];var r=e[1];this.outputShape=e;var i=n?"2.0 * "+Math.PI:"-2.0 * "+Math.PI,o=n?r+".0":"1.0";this.userCode="\n const float exponentMultiplier = "+i+";\n\n float unaryOpComplex(float real, float expR, float imag, float expI) {\n "+t+"\n }\n\n float mulMatDFT(int batch, int index) {\n float indexRatio = float(index) / float("+r+");\n float exponentMultiplierTimesIndexRatio =\n exponentMultiplier * indexRatio;\n\n float result = 0.0;\n\n for (int i = 0; i < "+r+"; i++) {\n // x = (-2|2 * PI / N) * index * i;\n float x = exponentMultiplierTimesIndexRatio * float(i);\n float expR = cos(x);\n float expI = sin(x);\n float real = getReal(batch, i);\n float imag = getImag(batch, i);\n\n result +=\n unaryOpComplex(real, expR, imag, expI) / "+o+";\n }\n\n return result;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n setOutput(mulMatDFT(coords[0], coords[1]));\n }\n "},ns=function(){function t(t,e){this.outputShape=[],this.variableNames=["x"],this.outputShape=t,this.userCode="\n uniform float value;\n void main() {\n // Input can be obtained from uniform value.\n setOutput(value);\n }\n "}return t.prototype.getCustomSetupFunc=function(t){var e=this;return function(n,r){null==e.valueLoc&&(e.valueLoc=n.getUniformLocationNoThrow(r,"value")),n.gl.uniform1f(e.valueLoc,t)}},t}(),rs=function(t,e,n){this.variableNames=["A","indices"];var r=t.slice();r[n]=e,this.outputShape=r,this.rank=r.length;var i=ha(this.rank),o=function(t,e){var n=t.length;if(n>4)throw Error("Gather for rank "+n+" is not yet supported");if(1===n)return"int(getIndices(resRC))";for(var r=["resRC.x","resRC.y","resRC.z","resRC.w"],i=[],o=0;o1?"strides[j]":"strides";this.userCode="\n "+r+" strides = "+r+"("+this.strides+");\n void main() {\n "+i+" coords = getOutputCoords();\n int flattenIndex = 0;\n for (int j = 0; j < "+this.sliceDim+"; j++) {\n int index = round(getIndices(coords[0], j));\n flattenIndex += index * "+o+";\n }\n setOutput(getX(flattenIndex, coords[1]));\n }\n "};function os(t,e){var n=Qo();return Ge(t,e,n.version+"\n precision highp float;\n "+n.attribute+" vec3 clipSpacePos;\n "+n.attribute+" vec2 uv;\n "+n.varyingVs+" vec2 resultUV;\n\n void main() {\n gl_Position = vec4(clipSpacePos, 1);\n resultUV = uv;\n }")}function as(t,e){return tn(t,e,new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]))}function ss(t,e){return en(t,e,new Uint16Array([0,1,2,2,1,3]))}function us(t,e,n,r,i,o,a){rn(n,r);var s=nn(t,e),u=t.TEXTURE_2D;return Ue(t,e,(function(){return t.bindTexture(u,s)})),Ue(t,e,(function(){return t.texParameteri(u,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE)})),Ue(t,e,(function(){return t.texParameteri(u,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)})),Ue(t,e,(function(){return t.texParameteri(u,t.TEXTURE_MIN_FILTER,t.NEAREST)})),Ue(t,e,(function(){return t.texParameteri(u,t.TEXTURE_MAG_FILTER,t.NEAREST)})),Ue(t,e,(function(){return t.texImage2D(u,0,i,n,r,0,o,a,null)})),Ue(t,e,(function(){return t.bindTexture(t.TEXTURE_2D,null)})),s}function cs(t,e,n,r,i){var o=je(n,r);return us(t,e,o[0],o[1],i.internalFormatFloat,i.textureFormatFloat,t.FLOAT)}function ls(t,e,n,r,i){var o=je(n,r);return us(t,e,o[0],o[1],i.internalFormatHalfFloat,i.textureFormatFloat,i.textureTypeHalfFloat)}function fs(t,e,n,r,i){var o=je(n,r);return us(t,e,o[0],o[1],t.RGBA,t.RGBA,t.UNSIGNED_BYTE)}function hs(t,e,n,r,i){var o=Le(n,r);return us(t,e,o[0],o[1],i.internalFormatPackedFloat,t.RGBA,t.FLOAT)}function ps(t,e,n,r,i){var o=Le(n,r);return us(t,e,o[0],o[1],i.internalFormatPackedHalfFloat,t.RGBA,i.textureTypeHalfFloat)}function ds(t,e,n,r){return Ue(t,e,(function(){return t.bindBuffer(t.ARRAY_BUFFER,r)})),an(t,e,n,"clipSpacePos",r,3,20,0)&&an(t,e,n,"uv",r,2,20,12)}function ms(t,e,n,r,i,o,a){var s,u,c;Ue(t,e,(function(){return t.bindTexture(t.TEXTURE_2D,n)})),o instanceof Uint8Array?(s=new Uint8Array(r*i*4),u=t.UNSIGNED_BYTE,c=t.RGBA):(s=new Float32Array(r*i*4),u=t.FLOAT,c=a.internalFormatPackedFloat),s.set(o),Ue(t,e,(function(){return t.texImage2D(t.TEXTURE_2D,0,c,r,i,0,t.RGBA,u,s)})),Ue(t,e,(function(){return t.bindTexture(t.TEXTURE_2D,null)}))}function gs(t,e,n,r){Ue(t,e,(function(){return t.bindTexture(t.TEXTURE_2D,n)})),r.data instanceof Uint8Array?Ue(t,e,(function(){return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,r.width,r.height,0,t.RGBA,t.UNSIGNED_BYTE,r.data)})):Ue(t,e,(function(){return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r)})),Ue(t,e,(function(){return t.bindTexture(t.TEXTURE_2D,null)}))}function vs(t,e,n,r,i){var o=t.createBuffer();Ue(t,e,(function(){return t.bindBuffer(t.PIXEL_PACK_BUFFER,o)}));var a=16*n*r;return Ue(t,e,(function(){return t.bufferData(t.PIXEL_PACK_BUFFER,a,t.STREAM_READ)})),Ue(t,e,(function(){return t.readPixels(0,0,r,n,t.RGBA,t.FLOAT,0)})),Ue(t,e,(function(){return t.bindBuffer(t.PIXEL_PACK_BUFFER,null)})),o}function ys(t,e,n){var r=t,i=new Float32Array(n);return r.bindBuffer(r.PIXEL_PACK_BUFFER,e),r.getBufferSubData(r.PIXEL_PACK_BUFFER,0,i),r.bindBuffer(r.PIXEL_PACK_BUFFER,null),i}function bs(t,e,n,r,i){var o=je(n,r),a=o[0],s=o[1],u=new Uint8Array(n*r*4);return Ue(t,e,(function(){return t.readPixels(0,0,a,s,i.downloadTextureFormat,t.UNSIGNED_BYTE,u)})),new Float32Array(u.buffer)}function xs(t,e,n,r,i,o,a,s){var u=t,c=new Float32Array(function(t,e){var n=Le(t,e);return n[0]*n[1]*4}(o,a));return u.bindBuffer(u.PIXEL_PACK_BUFFER,e),u.getBufferSubData(u.PIXEL_PACK_BUFFER,0,c),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),c}function ws(t,e,n,r){var i=new Float32Array(n*r*4);return Ue(t,e,(function(){return t.readPixels(0,0,r,n,t.RGBA,t.FLOAT,i)})),i}var ks=Object.freeze({createVertexShader:os,createVertexBuffer:as,createIndexBuffer:ss,createFloat32MatrixTexture:cs,createFloat16MatrixTexture:ls,createUnsignedBytesMatrixTexture:fs,createPackedMatrixTexture:hs,createFloat16PackedMatrixTexture:ps,bindVertexProgramAttributeStreams:ds,uploadDenseMatrixToTexture:ms,uploadPixelDataToTexture:gs,createBufferFromOutputTexture:vs,downloadFloat32MatrixFromBuffer:ys,downloadByteEncodedFloatMatrixFromOutputTexture:bs,downloadPackedMatrixFromBuffer:xs,downloadMatrixFromPackedOutputTexture:ws}),Es=function(){function t(t){this.outputTexture=null,this.program=null,this.disposed=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[];var e=et().getNumber("WEBGL_VERSION");null!=t?(this.gl=t,Be(e,t)):this.gl=ze(e);var n="WEBGL_color_buffer_float";if(1===et().getNumber("WEBGL_VERSION")){if(this.textureFloatExtension=He(this.gl,this.debug,"OES_texture_float"),An(this.gl,"OES_texture_half_float"))this.textureHalfFloatExtension=He(this.gl,this.debug,"OES_texture_half_float");else if(et().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(n),An(this.gl,"EXT_color_buffer_half_float"))this.colorBufferHalfFloatExtension=He(this.gl,this.debug,"EXT_color_buffer_half_float");else if(et().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(n="EXT_color_buffer_float",An(this.gl,n))this.colorBufferFloatExtension=this.gl.getExtension(n);else{if(!An(this.gl,"EXT_color_buffer_half_float"))throw new Error("GL context does not support color renderable floats");this.colorBufferHalfFloatExtension=this.gl.getExtension("EXT_color_buffer_half_float")}this.vertexBuffer=as(this.gl,this.debug),this.indexBuffer=ss(this.gl,this.debug),this.framebuffer=on(this.gl,this.debug),this.textureConfig=We(this.gl,this.textureHalfFloatExtension)}return Object.defineProperty(t.prototype,"debug",{get:function(){return et().getBool("DEBUG")},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){var t=this;if(!this.disposed){null!=this.program&&console.warn("Disposing a GPGPUContext that still has a bound WebGLProgram. This is probably a resource leak, delete the program with GPGPUContext.deleteProgram before disposing."),null!=this.outputTexture&&console.warn("Disposing a GPGPUContext that still has a bound output matrix texture. This is probably a resource leak, delete the output matrix texture with GPGPUContext.deleteMatrixTexture before disposing.");var e=this.gl;Ue(e,this.debug,(function(){return e.finish()})),Ue(e,this.debug,(function(){return e.bindFramebuffer(e.FRAMEBUFFER,null)})),Ue(e,this.debug,(function(){return e.deleteFramebuffer(t.framebuffer)})),Ue(e,this.debug,(function(){return e.bindBuffer(e.ARRAY_BUFFER,null)})),Ue(e,this.debug,(function(){return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)})),Ue(e,this.debug,(function(){return e.deleteBuffer(t.indexBuffer)})),this.disposed=!0}},t.prototype.createFloat32MatrixTexture=function(t,e){return this.throwIfDisposed(),cs(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.createFloat16MatrixTexture=function(t,e){return this.throwIfDisposed(),ls(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.createUnsignedBytesMatrixTexture=function(t,e){return this.throwIfDisposed(),fs(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.uploadPixelDataToTexture=function(t,e){this.throwIfDisposed(),gs(this.gl,this.debug,t,e)},t.prototype.uploadDenseMatrixToTexture=function(t,e,n,r){this.throwIfDisposed(),ms(this.gl,this.debug,t,e,n,r,this.textureConfig)},t.prototype.createFloat16PackedMatrixTexture=function(t,e){return this.throwIfDisposed(),ps(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.createPackedMatrixTexture=function(t,e){return this.throwIfDisposed(),hs(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.deleteMatrixTexture=function(t){var e=this;this.throwIfDisposed(),this.outputTexture===t&&(hn(this.gl,this.debug,this.framebuffer),this.outputTexture=null),Ue(this.gl,this.debug,(function(){return e.gl.deleteTexture(t)}))},t.prototype.downloadByteEncodedFloatMatrixFromOutputTexture=function(t,e,n){var r=this;return this.downloadMatrixDriver(t,(function(){return bs(r.gl,r.debug,e,n,r.textureConfig)}))},t.prototype.downloadPackedMatrixFromBuffer=function(t,e,n,r,i,o){return xs(this.gl,t,0,0,0,i,o,this.textureConfig)},t.prototype.downloadFloat32MatrixFromBuffer=function(t,e){return ys(this.gl,t,e)},t.prototype.createBufferFromTexture=function(t,e,n){this.bindTextureToFrameBuffer(t);var r=vs(this.gl,this.debug,e,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),r},t.prototype.createAndWaitForFence=function(){var t=this.createFence(this.gl);return this.pollFence(t)},t.prototype.createFence=function(t){var e,n,r=this;if(et().getBool("WEBGL_FENCE_API_ENABLED")){var i=t,o=i.fenceSync(i.SYNC_GPU_COMMANDS_COMPLETE,0);t.flush(),n=function(){var t=i.clientWaitSync(o,0,0);return t===i.ALREADY_SIGNALED||t===i.CONDITION_SATISFIED},e=o}else et().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(e=this.beginQuery(),this.endQuery(),n=function(){return r.isQueryAvailable(e,et().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}):n=function(){return!0};return{query:e,isFencePassed:n}},t.prototype.downloadMatrixFromPackedTexture=function(t,e,n){var r=this;return this.downloadMatrixDriver(t,(function(){return ws(r.gl,r.debug,e,n)}))},t.prototype.createProgram=function(t){this.throwIfDisposed();var e=this.gl,n=$e(e,this.debug,t),r=os(e,this.debug),i=Je(e,this.debug);return Ue(e,this.debug,(function(){return e.attachShader(i,r)})),Ue(e,this.debug,(function(){return e.attachShader(i,n)})),Ze(e,this.debug,i),this.debug&&Qe(e,this.debug,i),this.vertexAttrsAreBound||(this.setProgram(i),this.vertexAttrsAreBound=ds(e,this.debug,this.program,this.vertexBuffer)),i},t.prototype.deleteProgram=function(t){var e=this;this.throwIfDisposed(),t===this.program&&(this.program=null),null!=t&&Ue(this.gl,this.debug,(function(){return e.gl.deleteProgram(t)}))},t.prototype.setProgram=function(t){var e=this;this.throwIfDisposed(),this.program=t,null!=this.program&&this.debug&&Qe(this.gl,this.debug,this.program),Ue(this.gl,this.debug,(function(){return e.gl.useProgram(t)}))},t.prototype.getUniformLocation=function(t,e,n){return void 0===n&&(n=!0),this.throwIfDisposed(),n?un(this.gl,this.debug,t,e):cn(this.gl,t,e)},t.prototype.getAttributeLocation=function(t,e){var n=this;return this.throwIfDisposed(),Ue(this.gl,this.debug,(function(){return n.gl.getAttribLocation(t,e)}))},t.prototype.getUniformLocationNoThrow=function(t,e){return this.throwIfDisposed(),this.gl.getUniformLocation(t,e)},t.prototype.setInputMatrixTexture=function(t,e,n){this.throwIfDisposed(),this.throwIfNoProgram(),ln(this.gl,this.debug,this.program,t,e,n)},t.prototype.setOutputMatrixTexture=function(t,e,n){this.setOutputMatrixTextureDriver(t,n,e)},t.prototype.setOutputPackedMatrixTexture=function(t,e,n){this.throwIfDisposed();var r=Le(e,n),i=r[0],o=r[1];this.setOutputMatrixTextureDriver(t,i,o)},t.prototype.setOutputMatrixWriteRegion=function(t,e,n,r){this.setOutputMatrixWriteRegionDriver(n,t,r,e)},t.prototype.setOutputPackedMatrixWriteRegion=function(t,e,n,r){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")},t.prototype.debugValidate=function(){null!=this.program&&Qe(this.gl,this.debug,this.program),pn(this.gl)},t.prototype.executeProgram=function(){this.throwIfDisposed(),this.throwIfNoProgram();var t=this.gl;this.debug&&this.debugValidate(),Ue(t,this.debug,(function(){return t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0)}))},t.prototype.blockUntilAllProgramsCompleted=function(){var t=this;this.throwIfDisposed(),Ue(this.gl,this.debug,(function(){return t.gl.finish()}))},t.prototype.getQueryTimerExtension=function(){return null==this.disjointQueryTimerExtension&&(this.disjointQueryTimerExtension=He(this.gl,this.debug,2===et().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension},t.prototype.getQueryTimerExtensionWebGL2=function(){return this.getQueryTimerExtension()},t.prototype.getQueryTimerExtensionWebGL1=function(){return this.getQueryTimerExtension()},t.prototype.beginQuery=function(){if(2===et().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var t=this.gl,e=this.getQueryTimerExtensionWebGL2(),n=t.createQuery();return t.beginQuery(e.TIME_ELAPSED_EXT,n),n}var r=this.getQueryTimerExtensionWebGL1(),i=r.createQueryEXT();return r.beginQueryEXT(r.TIME_ELAPSED_EXT,i),i},t.prototype.endQuery=function(){if(2!==et().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var t=this.getQueryTimerExtensionWebGL1();t.endQueryEXT(t.TIME_ELAPSED_EXT)}else{var e=this.gl,n=this.getQueryTimerExtensionWebGL2();e.endQuery(n.TIME_ELAPSED_EXT)}},t.prototype.waitForQueryAndGetTime=function(t){return Z(this,void 0,void 0,(function(){var e=this;return Q(this,(function(n){switch(n.label){case 0:return[4,St((function(){return e.disposed||e.isQueryAvailable(t,et().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}))];case 1:return n.sent(),[2,this.getQueryTime(t,et().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))]}}))}))},t.prototype.getQueryTime=function(t,e){if(0===e)return null;if(2===e){var n=this.gl;return n.getQueryParameter(t,n.QUERY_RESULT)/1e6}var r=this.getQueryTimerExtensionWebGL1();return r.getQueryObjectEXT(t,r.QUERY_RESULT_EXT)/1e6},t.prototype.isQueryAvailable=function(t,e){if(0===e)return!0;if(2===e){var n=this.gl,r=this.getQueryTimerExtensionWebGL2(),i=n.getQueryParameter(t,n.QUERY_RESULT_AVAILABLE);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(r.GPU_DISJOINT_EXT)),i&&!this.disjoint}return i=(r=this.getQueryTimerExtensionWebGL1()).getQueryObjectEXT(t,r.QUERY_RESULT_AVAILABLE_EXT),null==this.disjoint&&(this.disjoint=this.gl.getParameter(r.GPU_DISJOINT_EXT)),i&&!this.disjoint},t.prototype.pollFence=function(t){var e=this;return new Promise((function(n){e.addItemToPoll((function(){return t.isFencePassed()}),(function(){return n()}))}))},t.prototype.pollItems=function(){for(var t=function(t){for(var e=0;e1||St((function(){return n.pollItems(),0===n.itemsToPoll.length}))},t.prototype.bindTextureToFrameBuffer=function(t){this.throwIfDisposed(),fn(this.gl,this.debug,t,this.framebuffer),this.debug&&pn(this.gl)},t.prototype.unbindTextureToFrameBuffer=function(){null!=this.outputTexture?(fn(this.gl,this.debug,this.outputTexture,this.framebuffer),this.debug&&pn(this.gl)):hn(this.gl,this.debug,this.framebuffer)},t.prototype.downloadMatrixDriver=function(t,e){this.bindTextureToFrameBuffer(t);var n=e();return this.unbindTextureToFrameBuffer(),n},t.prototype.setOutputMatrixTextureDriver=function(t,e,n){this.throwIfDisposed();var r=this.gl;fn(r,this.debug,t,this.framebuffer),this.debug&&pn(r),this.outputTexture=t,Ue(r,this.debug,(function(){return r.viewport(0,0,e,n)})),Ue(r,this.debug,(function(){return r.scissor(0,0,e,n)}))},t.prototype.setOutputMatrixWriteRegionDriver=function(t,e,n,r){var i=this;this.throwIfDisposed(),Ue(this.gl,this.debug,(function(){return i.gl.scissor(t,e,n,r)}))},t.prototype.throwIfDisposed=function(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")},t.prototype.throwIfNoProgram=function(){if(null==this.program)throw new Error("No GPU program is currently set.")},t}();function Cs(t,e){if(t.length!==e.length)throw Error("Binary was compiled with "+t.length+" inputs, but was executed with "+e.length+" inputs");t.forEach((function(t,n){var r=t.logicalShape,i=e[n],o=i.shape;if(!xt(r,o))throw Error("Binary was compiled with different shapes than the current args. Shapes "+r+" and "+o+" must match");if(!t.isUniform||!i.isUniform){var a=t.texShape,s=i.isUniform?null:i.texData.texShape;if(!xt(a,s))throw Error("Binary was compiled with different texture shapes than the current args. Shape "+a+" and "+s+" must match")}}))}var Ss=function(t,e,n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t;for(var r=n.filterWidth,i=n.inChannels,o=n.strideWidth,a=n.strideHeight,s=n.padInfo,u=n.outWidth,c=n.dilationWidth,l=n.dilationHeight,f=n.dataFormat,h=s.left,p=s.top,d=i*r,m=Qo(),g="channelsLast"===f,v=g?0:1,y=g?1:2,b="",x=0;x<=1;x++)for(var w=0;w<=1;w++)b+="\n blockIndex = rc.y + "+w+";\n pos = rc.x + "+x+";\n\n if(blockIndex < "+t[1]+" && pos < "+t[0]+") {\n offsetY = int(blockIndex / ("+u+")) * "+a+" - "+p+";\n d0 = offsetY + "+l+" * (pos / "+d+");\n\n if(d0 < "+e[v]+" && d0 >= 0) {\n\n offsetX = int(mod(float(blockIndex), "+u+".) * "+o+". - "+h+".);\n d1 = offsetX + "+c+" * (int(mod(float(pos), "+d+".) / "+i+".));\n\n if(d1 < "+e[y]+" && d1 >= 0) {\n\n ch = int(mod(float(pos), "+i+".));\n\n if ("+g+") {\n innerDims = vec2(d1, ch);\n result["+(2*x+w)+"] = getChannel(\n getA(d0, int(innerDims.x),\n int(innerDims.y)), innerDims);\n } else {\n innerDims = vec2(d0, d1);\n result["+(2*x+w)+"] = getChannel(\n getA(ch, int(innerDims.x),\n int(innerDims.y)), innerDims);\n }\n }\n }\n }\n ";this.userCode="\n void main() {\n ivec2 rc = getOutputCoords();\n\n vec4 result = vec4(0);\n\n int blockIndex, pos, offsetY, d0, offsetX, d1, ch;\n vec2 innerDims;\n\n "+b+"\n\n "+m.output+" = result;\n }\n "},As=function(t,e,n,r,i){this.variableNames=["x"],this.outputShape=[];var o,a=e,s=t[3]-1;this.outputShape=t;var u="float("+n+") + float("+r+") * sum";o=.5===i?"inversesqrt("+u+")":1===i?"1.0/("+u+")":"exp(log("+u+") * float(-"+i+"));",this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n int d = coords[3];\n float x = getX(b, r, c, d);\n float sum = 0.0;\n for (int j = -"+a+"; j <= "+a+"; j++) {\n int idx = d + j;\n if (idx >= 0 && idx <= "+s+") {\n float z = getX(b, r, c, idx);\n sum += z * z;\n }\n }\n float val = x * "+o+";\n setOutput(val);\n }\n "},Os=function(t,e,n,r,i){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=t,this.depth=t[3],this.depthRadius=e,this.bias=n,this.alpha=r,this.beta=i,this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n\n float result = 0.0;\n for (int d = 0; d < "+this.depth+"; ++d) {\n int depthBegin = int(max(0.0, float(d - "+e+")));\n int depthEnd = int(min(float("+this.depth+"),\n float(d + "+e+" + 1)));\n\n const int MIN_DEPTH_BEGIN = 0;\n const int MAX_DEPTH_END = "+this.depth+";\n\n float norm = 0.0;\n for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) {\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd) {\n norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);\n }\n else {\n break;\n }\n }\n\n norm = float("+r+") * norm + float("+n+");\n\n for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd){\n float dyi = -2.0 * float("+r+")\n * float("+i+")\n * getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d)\n / norm;\n if (k == d) {\n dyi += pow(norm, -1.0 * "+i+");\n }\n if (k == coords[3]) {\n dyi *= getDy(b, r, c, d);\n result += dyi;\n }\n }\n else {\n break;\n }\n }\n }\n setOutput(result);\n }\n "},_s=function(t,e,n,r,i){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;var o,a=e,s=t[3]-1;this.outputShape=t;var u="float("+n+") + float("+r+") * sum";o=.5===i?"inversesqrt("+u+")":1===i?"1.0/("+u+")":"exp(log("+u+") * float(-"+i+"));",this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords.x;\n int r = coords.y;\n int c = coords.z;\n int d = coords.w;\n\n bool hasNextCol = d < "+this.outputShape[3]+";\n bool hasNextRow = c < "+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 - "+a+";\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 = - "+a+"; j <= "+a+"; j++) {\n ivec2 idx = depth + j;\n bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0));\n bvec2 belowUpperBound = lessThanEqual(idx, ivec2("+s+"));\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 * "+o+";\n setOutput(result);\n }\n "},Ns=function(t){this.variableNames=["dy","maxPos"],this.outputShape=t.inShape;var e=t.strideHeight,n=t.strideWidth,r=t.dilationHeight,i=t.effectiveFilterHeight,o=t.effectiveFilterWidth,a=i-1-t.padInfo.top,s=o-1-t.padInfo.left,u=i*o-1;this.userCode="\n const ivec2 pads = ivec2("+a+", "+s+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+i+";\n wR += "+r+") {\n float dyR = float(dyRCorner + wR) / "+e+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+o+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+n+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n int maxPosValue = "+u+" - int(getMaxPos(b, idyR, idyC, d));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue = wR * "+o+" + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n setOutput(dotProd);\n }\n "},Ts=function(t){this.variableNames=["dy","maxPos"],this.outputShape=t.inShape;var e=t.strideDepth,n=t.strideHeight,r=t.strideWidth,i=t.dilationDepth,o=t.dilationHeight,a=t.dilationWidth,s=t.effectiveFilterDepth,u=t.effectiveFilterHeight,c=t.effectiveFilterWidth,l=s-1-t.padInfo.front,f=u-1-t.padInfo.top,h=c-1-t.padInfo.left,p=s*u*c-1;this.userCode="\n const ivec3 pads = ivec3("+l+", "+f+", "+h+");\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 < "+s+";\n wD += "+i+") {\n float dyD = float(dyDCorner + wD) / "+e+".0;\n\n if (dyD < 0.0 || dyD >= "+t.outDepth+".0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < "+u+";\n wR += "+o+") {\n float dyR = float(dyRCorner + wR) / "+n+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+c+";\n wC += "+a+") {\n float dyC = float(dyCCorner + wC) / "+r+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n int maxPosValue = "+p+" -\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 * "+u+" * "+c+" +\n wR * "+c+" + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n }\n setOutput(dotProd);\n }\n "},Ds=function(t,e,n,r,i,o,a){void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===i&&(i=!1),void 0===o&&(o=null),void 0===a&&(a=!1),this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e;var s=n?t[1]:t[2],u=Math.ceil(s/2),c=n?"i * 2, rc.y":"rc.y, i * 2",l=r?"rc.z, i * 2":"i * 2, rc.z",f=n?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],h=r?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],p="",d="";o&&(p=a?"vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n "+o+"\n }":"vec4 activation(vec4 x) {\n "+o+"\n }",d="result = activation(result);");var m=i?"result += getBiasAtOutCoords();":"";i&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),this.userCode="\n "+p+"\n\n const float sharedDimension = "+u+".0;\n\n vec4 dot2x2ARowBCol(ivec3 rc) {\n vec4 result = vec4(0);\n for (int i = 0; i < "+u+"; i++) {\n vec4 a = getMatrixA(rc.x, "+c+");\n vec4 b = getMatrixB(rc.x, "+l+");\n\n // These swizzled products need to be separately added.\n // See: https://github.com/tensorflow/tfjs/issues/1735\n result += ("+f[0]+" * "+h[0]+");\n result += ("+f[1]+" * "+h[1]+");\n }\n return result;\n }\n\n void main() {\n ivec3 rc = getOutputCoords();\n vec4 result = dot2x2ARowBCol(rc);\n\n "+m+"\n\n "+d+"\n\n setOutput(result);\n }\n "},Is=function(){function t(t,e,n){this.variableNames=["probs"],this.outputShape=[t,n],this.userCode="\n uniform float seed;\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n\n float r = random(seed);\n float cdf = 0.0;\n\n for (int i = 0; i < "+(e-1)+"; i++) {\n cdf += getProbs(batch, i);\n\n if (r < cdf) {\n setOutput(float(i));\n return;\n }\n }\n\n // If no other event happened, last event happened.\n setOutput(float("+(e-1)+"));\n }\n "}return t.prototype.getCustomSetupFunc=function(t){var e=this;return function(n,r){null==e.seedLoc&&(e.seedLoc=n.getUniformLocation(r,"seed")),n.gl.uniform1f(e.seedLoc,t)}},t}(),Rs=function(t,e,n,r){this.variableNames=["indices"],this.outputShape=[t,e],this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int index = round(getIndices(coords.x));\n setOutput(mix(float("+r+"), float("+n+"),\n float(index == coords.y)));\n }\n "},Fs=function(t){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outputShape=t;var e=t.length;if(0===e)this.userCode="\n void main() {\n setOutput(vec4(getA(), 0., 0., 0.));\n }\n ";else{var n=Zo("rc",e),r=ha(e),i=function(t,e,n){if(1===t)return"rc > "+e[0];for(var r="",i=t-2;i= "+e[i],i= "+e+";\n bool rEdge = rp1 >= "+n+";\n "}(e,t[t.length-1],t[t.length-2],n),a=function(t,e){var n=t.length,r=function(t,e){for(var n=[],r=0;r<=1;r++)for(var i=0;i<=1;i++){for(var o=(0===r?"r":"rp1")+", "+(0===i?"c":"cp1"),a=2;a= "+t[0]+" ? 0. : getA(rc + 1),\n 0, 0":"getA("+r[0]+"),\n cEdge ? 0. : getA("+r[1]+"),\n rEdge ? 0. : getA("+r[2]+"),\n rEdge || cEdge ? 0. : getA("+r[3]+")"}(t,n);this.userCode="\n void main() {\n "+r+" rc = getOutputCoords();\n\n if("+i+") {\n setOutput(vec4(0));\n } else {\n "+o+"\n\n setOutput(vec4("+a+"));\n }\n }\n "}},Ms=function(t,e,n){this.variableNames=["x"],this.outputShape=e.map((function(e,n){return e[0]+t[n]+e[1]}));var r=t.length,i=ha(r),o=e.map((function(t){return t[0]})).join(","),a=e.map((function(e,n){return e[0]+t[n]})).join(","),s=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,r);this.userCode=1!==r?"\n "+i+" start = "+i+"("+o+");\n "+i+" end = "+i+"("+a+");\n\n void main() {\n "+i+" outC = getOutputCoords();\n if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {\n setOutput(float("+n+"));\n } else {\n "+i+" coords = outC - start;\n setOutput(getX("+s+"));\n }\n }\n ":"\n int start = "+o+";\n int end = "+a+";\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start || outC >= end) {\n setOutput(float("+n+"));\n } else {\n setOutput(getX(outC - start));\n }\n }\n "},Bs=function(t,e,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e.map((function(e,n){return e[0]+t[n]+e[1]}));for(var r=t.length,i=ha(r),o=e.map((function(t){return t[0]})).join(","),a=e.map((function(e,n){return e[0]+t[n]})).join(","),s=Zo("rc",r),u=Zo("source",r),c=s[r-1]+" < "+this.outputShape[r-1],l=1===r?"source":"vec2("+u.slice(-2).join()+")",f=[i+" rc = outputLoc;",s[r-1]+" += 1;\n if("+c+") {\n ",1===r?"":"}\n rc = outputLoc;\n "+s[r-2]+" += 1;\n if("+s[r-2]+" < "+this.outputShape[r-2]+") {",1===r?"":" "+s[r-1]+" += 1;\n if("+c+") {"],h=1===r?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))",p="",d=0,m=1===r?2:4;d= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+f+";\n wC += "+c+") {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float value = getX(batch, xR, xC, d);\n\n // If a min / max value has already been found, use it. If not,\n // use the current value.\n float currMinMaxValue = mix(\n value, minMaxValue, minMaxValueFound);\n if (value >= currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = "+(r?i?m:g:"wR * "+f+" + wC")+";\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n ";else{var y=e+"("+e+"("+e+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"avg"===e&&(y="avgValue / count");var b=4*Math.floor(o/4),x=o%4,w="\n if ("+d+") {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = max(values, minMaxValue);\n }\n ";this.userCode="\n const ivec2 strides = ivec2("+a+", "+s+");\n const ivec2 pads = ivec2("+h+", "+p+");\n const float initializationValue = "+v+";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float count = 0.0;\n\n float getValue(int batch, int xR, int xC, int d) {\n if (xC < 0 || xC >= "+t.inWidth+") {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xR, xC, d);\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n vec4 minMaxValue = vec4("+v+");\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wR = 0; wR < "+l+";\n wR += "+u+") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+b+"; wC += 4) {\n int xC = xCCorner + wC * "+c+";\n\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + "+c+", d),\n getValue(batch, xR, xC + 2 * "+c+", d),\n getValue(batch, xR, xC + 3 * "+c+", d)\n );\n\n "+w+"\n }\n\n int xC = xCCorner + "+b+";\n if ("+(1===x)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+w+"\n } else if ("+(2===x)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + "+c+", d),\n initializationValue,\n initializationValue\n );\n\n "+w+"\n } else if ("+(3===x)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + "+c+", d),\n getValue(batch, xR, xC + 2 * "+c+", d),\n initializationValue\n );\n\n "+w+"\n }\n }\n setOutput("+y+");\n }\n "}},js=function(t,e,n,r,i){if(void 0===r&&(r=!1),void 0===i&&(i=!1),this.variableNames=["x"],"avg"===e&&n)throw new Error("Cannot compute positions for average pool.");var o=t.filterWidth,a=t.strideDepth,s=t.strideHeight,u=t.strideWidth,c=t.dilationDepth,l=t.dilationHeight,f=t.dilationWidth,h=t.effectiveFilterDepth,p=t.effectiveFilterHeight,d=t.effectiveFilterWidth,m=t.padInfo.front,g=t.padInfo.top,v=t.padInfo.left;this.outputShape=t.outShape;var y="avg"===e,b="0.0";if(y||(b="-1.0 / 1e-20"),n)this.userCode="\n const ivec3 strides =\n ivec3("+a+", "+s+", "+u+");\n const ivec3 pads = ivec3("+m+", "+g+", "+v+");\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 < "+h+";\n wD += "+c+") {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= "+t.inDepth+") {\n continue;\n }\n\n for (int wR = 0; wR < "+p+";\n wR += "+l+") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+d+";\n wC += "+f+") {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= "+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 >= currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = "+(r?i?"(((batch * "+t.inDepth+" + xD) * "+t.inHeight+" + xR) * "+t.inWidth+" + xC) * "+t.inChannels+" + ch":"((xD * "+t.inHeight+" + xR) * "+t.inWidth+" + xC) * "+t.inChannels+" + ch":"wD * "+p+" * "+d+" +\n wR * "+d+" + wC")+";\n }\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n ";else{var x=e+"("+e+"("+e+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"avg"===e&&(x="avgValue / count");var w=4*Math.floor(o/4),k=o%4,E="\n if ("+y+") {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = max(values, minMaxValue);\n }\n ";this.userCode="\n const ivec3 strides =\n ivec3("+a+", "+s+", "+u+");\n const ivec3 pads = ivec3("+m+", "+g+", "+v+");\n const float initializationValue = "+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 xD, int xR, int xC, int ch) {\n if (xC < 0 || xC >= "+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("+b+");\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wD = 0; wD < "+h+";\n wD += "+c+") {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= "+t.inDepth+") {\n continue;\n }\n\n for (int wR = 0; wR < "+p+";\n wR += "+l+") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+w+"; wC += 4) {\n int xC = xCCorner + wC * "+f+";\n\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + "+f+", ch),\n getValue(batch, xD, xR, xC + 2 * "+f+", ch),\n getValue(batch, xD, xR, xC + 3 * "+f+", ch)\n );\n\n "+E+"\n }\n\n int xC = xCCorner + "+w+";\n if ("+(1===k)+") {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+E+"\n } else if ("+(2===k)+") {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + "+f+", ch),\n initializationValue,\n initializationValue\n );\n\n "+E+"\n } else if ("+(3===k)+") {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + "+f+", ch),\n getValue(batch, xD, xR, xC + 2 * "+f+", ch),\n initializationValue\n );\n\n "+E+"\n }\n }\n setOutput("+x+");\n }\n }\n "}},Ps=function(t,e){this.variableNames=["x"];var n=t.windowSize,r=t.batchSize,i=t.inSize,o=Math.ceil(i/n);this.outputShape=[r,o];var a="0.0",s="";"prod"===e?a="1.0":"min"===e?(a="1.0 / 1e-20",s="min"):"max"===e&&(a="-1.0 / 1e-20",s="max");var u=e+"("+e+"("+e+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"sum"===e?u="sumValue":"prod"===e?u="prodValue":"all"===e?u="allValue":"any"===e&&(u="anyValue");var c=4*Math.floor(n/4),l=n%4,f="\n if ("+("sum"===e)+") {\n sumValue += dot(values, ones);\n } else if ("+("prod"===e)+") {\n vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);\n prodValue *= tmp[0] * tmp[1];\n } else {\n minMaxValue = "+s+"(values, minMaxValue);\n }\n ",h="vec4";"all"===e?(a="1.0",f="\n bool reducedAllValue = all(values);\n float floatedReducedAllValue = float(reducedAllValue);\n allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);\n ",h="bvec4"):"any"===e&&(a="0.0",f="\n bool reducedAnyValue = any(values);\n float floatedReducedAnyValue = float(reducedAnyValue);\n anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);\n ",h="bvec4");var p="";i%n>0&&(p="\n if (inIdx < 0 || inIdx >= "+i+") {\n return initializationValue;\n }\n "),this.userCode="\n const float initializationValue = "+a+";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n "+p+"\n return getX(batch, inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * "+n+";\n\n vec4 minMaxValue = vec4("+a+");\n float prodValue = 1.0;\n float sumValue = 0.0;\n float allValue = 1.0;\n float anyValue = 0.0;\n\n for (int i = 0; i < "+c+"; i += 4) {\n int inIdx = inOffset + i;\n "+h+" values = "+h+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n "+f+"\n }\n\n int inIdx = inOffset + "+c+";\n if ("+(1===l)+") {\n "+h+" values = "+h+"(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+f+"\n } else if ("+(2===l)+") {\n "+h+" values = "+h+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n "+f+"\n } else if ("+(3===l)+") {\n "+h+" values = "+h+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n "+f+"\n }\n setOutput("+u+");\n }\n "},Ls=function(t,e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t;for(var n="",r=0;r<4;r++){var i="thisRC = rc;";r%2==1&&(i+="thisRC.z += 1;"),r>1&&(i+="thisRC.y += 1;"),n+="\n "+i+"\n "+(r>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["+r+"] =\n getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);\n "+(r>0?"}":"")+"\n "}this.userCode="\n \n ivec3 inputCoordsFromReshapedOutCoords(int index) {\n "+ta(["r","c","d"],e)+"\n return ivec3(r, c, d);\n }\n \n "+ea(t)+"\n\n void main() {\n ivec3 rc = getOutputCoords();\n\n vec4 result = vec4(0.);\n\n ivec3 thisRC;\n int rows = "+t[1]+";\n int cols = "+t[2]+";\n\n "+n+"\n\n setOutput(result);\n }\n "},Ws=function(t,e,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=e.shape;var r=e.shape,i=r[1],o=r[2],a=t.shape,s=a[1],u=a[2],c=[n&&s>1?i-1:i,n&&u>1?o-1:o],l=[n&&s>1?s-1:s,n&&u>1?u-1:u],f=c[0]/l[0],h=c[1]/l[1],p=1/f,d=1/h,m=2*Math.ceil(p)+2,g=2*Math.ceil(d)+2;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float("+f+");\n const float widthScale = float("+h+");\n\n const float invHeightScale = float("+p+");\n const float invWidthScale = float("+d+");\n\n const int winHeight = int("+m+");\n const int winWidth = int("+g+");\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(startRLerp - float(winHeight / 2));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(startCLerp - float(winWidth / 2));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= "+s+") {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= "+u+") {\n continue;\n }\n\n float dxR = float(dyR) * heightScale;\n int topDxRIndex = int(floor(dxR));\n int bottomDxRIndex = int(min(ceil(dxR), "+(i-1)+".0));\n float dxRLerp = dxR - float(topDxRIndex);\n float inverseDxRLerp = 1.0 - dxRLerp;\n\n float dxC = float(dyC) * widthScale;\n int leftDxCIndex = int(floor(dxC));\n int rightDxCIndex = int(min(ceil(dxC), "+(o-1)+".0));\n float dxCLerp = dxC - float(leftDxCIndex);\n float inverseDxCLerp = 1.0 - dxCLerp;\n\n if (r == topDxRIndex && c == leftDxCIndex) {\n // topLeft\n accumulator +=\n getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;\n }\n\n if (r == topDxRIndex && c == rightDxCIndex) {\n // topRight\n accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;\n }\n\n if (r == bottomDxRIndex && c == leftDxCIndex) {\n // bottomLeft\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;\n }\n\n if (r == bottomDxRIndex && c == rightDxCIndex) {\n // bottomRight\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n "},Us=function(t,e,n,r){this.variableNames=["A"],this.outputShape=[];var i=t[0],o=t[1],a=t[2],s=t[3];this.outputShape=[i,e,n,s];var u=[r&&e>1?o-1:o,r&&n>1?a-1:a],c=[r&&e>1?e-1:e,r&&n>1?n-1:n];this.userCode="\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n "+u[0]/c[0]+",\n "+u[1]/c[1]+");\n const vec2 inputShapeRC = vec2("+o+".0, "+a+".0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;\n\n // Compute the four integer indices.\n ivec2 sourceFloorRC = ivec2(sourceFracIndexRC);\n ivec2 sourceCeilRC = ivec2(\n min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d);\n float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d);\n float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d);\n float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d);\n\n vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);\n\n float top = topLeft + (topRight - topLeft) * fracRC.y;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;\n float newValue = top + (bottom - top) * fracRC.x;\n\n setOutput(newValue);\n }\n "},Vs=function(t,e,n,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];var i=t[0],o=t[1],a=t[2],s=t[3];this.outputShape=[i,e,n,s];var u=[r&&e>1?o-1:o,r&&n>1?a-1:a],c=[r&&e>1?e-1:e,r&&n>1?n-1:n];this.userCode="\n const vec3 effectiveInputOverOutputRatioRC = vec3(\n "+u[0]/c[0]+",\n "+u[1]/c[1]+",\n "+u[1]/c[1]+");\n const vec3 inputShapeRC = vec3("+o+".0, "+a+".0,\n "+a+".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 = vec3(yRC) * effectiveInputOverOutputRatioRC;\n\n // Compute the four integer indices.\n ivec3 sourceFloorRC = ivec3(sourceFracIndexRC);\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 < "+(s-1)+";\n bool hasNextRow = coords.z < "+(n-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 "},qs=function(t,e,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=e.shape;var r=e.shape,i=r[1],o=r[2],a=t.shape,s=a[1],u=a[2],c=[n&&s>1?i-1:i,n&&u>1?o-1:o],l=[n&&s>1?s-1:s,n&&u>1?u-1:u],f=c[0]/l[0],h=c[1]/l[1],p=1/f,d=1/h,m=2*Math.ceil(p)+2,g=2*Math.ceil(d)+2;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float("+f+");\n const float widthScale = float("+h+");\n\n const float invHeightScale = float("+p+");\n const float invWidthScale = float("+d+");\n\n const int winHeight = int("+m+");\n const int winWidth = int("+g+");\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(floor(startRLerp - float(winHeight / 2)));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(floor(startCLerp - float(winWidth / 2)));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= "+s+") {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= "+u+") {\n continue;\n }\n\n float sourceFracRow =\n float("+c[0]+") *\n (float(dyR) / float("+l[0]+"));\n\n float sourceFracCol =\n float("+c[1]+") *\n (float(dyC) / float("+l[1]+"));\n\n int sourceNearestRow = int(min(\n float(int("+i+") - 1),\n "+n+" ? float(round(sourceFracRow)) :\n float(floor(sourceFracRow))));\n\n int sourceNearestCol = int(min(\n float(int("+o+") - 1),\n "+n+" ? float(round(sourceFracCol)) :\n float(floor(sourceFracCol))));\n\n if (r == sourceNearestRow && c == sourceNearestCol) {\n accumulator += getDy(b, dyR, dyC, d);\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n "},Hs=function(t,e,n,r){this.variableNames=["A"],this.outputShape=[];var i=t[0],o=t[1],a=t[2],s=t[3];this.outputShape=[i,e,n,s];var u=[r&&e>1?o-1:o,r&&n>1?a-1:a],c=[r&&e>1?e-1:e,r&&n>1?n-1:n],l=r?"0.5":"0.0";this.userCode="\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n "+u[0]/c[0]+",\n "+u[1]/c[1]+");\n const vec2 inputShapeRC = vec2("+o+".0, "+a+".0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;\n\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestRC = ivec2(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + "+l+")));\n\n float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);\n\n setOutput(newValue);\n }\n "},Gs=function(t,e){this.variableNames=["x"];var n=t.length;if(n>4)throw new Error("WebGL backend: Reverse of rank-"+n+" tensor is not yet supported");if(this.outputShape=t,1!==n){var r=t.map((function(n,r){return function(n){return-1!==e.indexOf(n)&&1!==t[n]?t[n]+" - coords["+n+"] - 1":"coords["+n+"]"}(r)})).join(","),i=ha(n);this.userCode="\n void main() {\n "+i+" coords = getOutputCoords();\n setOutput(getX("+r+"));\n }\n "}else this.userCode="\n void main() {\n int coord = getOutputCoords();\n setOutput(getX("+t[0]+" - coord - 1));\n }\n "},$s=function(t,e){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;var n=t.length;if(n>4)throw new Error("WebGL backend: Reverse of rank-"+n+" tensor is not yet supported");this.outputShape=t;var r=Zo("rc",n),i=r[n-1]+" + 1 < "+this.outputShape[n-1],o=r[n-2]+" + 1 < "+this.outputShape[n-2],a=ha(n);function s(n){var r=t.map((function(r,i){return function(n,r){return-1!==e.indexOf(n)&&1!==t[n]?t[n]+" - "+r[n]+" - 1":""+r[n]}(i,n)}));return"getChannel(getX("+r.join(",")+"), vec2("+r.slice(-2).join(",")+"))"}this.userCode=1===n?"\n void main(){\n int rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = getChannel(getX("+t[0]+" - rc - 1),\n "+t[0]+" - rc - 1);\n if("+i+"){\n result.g = getChannel(getX("+t[0]+" - (rc + 1) - 1),\n "+t[0]+" - (rc + 1) - 1);\n }\n setOutput(result);\n }\n ":"\n void main() {\n "+a+" rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = "+function(t){return s(t)}(r.slice())+";\n if("+i+"){\n result.g = "+function(t){return t[n-1]="("+t[n-1]+" + 1)",s(t)}(r.slice())+";\n }\n if("+o+") {\n result.b = "+function(t){return t[n-2]="("+t[n-2]+" + 1)",s(t)}(r.slice())+";\n if("+i+") {\n result.a = "+function(t){return t[n-1]="("+t[n-1]+" + 1)",t[n-2]="("+t[n-2]+" + 1)",s(t)}(r.slice())+";\n }\n }\n setOutput(result);\n }\n "},Ks=function(t,e,n,r,i,o,a){this.variableNames=["updates","indices","defaultValue"],this.outputShape=o;var s=ha(i.length),u=ha(o.length),c="";1===n?c="i":2===n&&(c="i, j");var l="getIndices("+c+")",f="";1===r?f="i":2===r&&(f="i, coords[1]");var h="getUpdates("+f+")",p=e>1?"strides[j]":"strides";this.userCode="\n "+s+" strides = "+s+"("+i+");\n\n void main() {\n "+u+" coords = getOutputCoords();\n float sum = 0.0;\n bool found = false;\n for (int i = 0; i < "+t+"; i++) {\n int flattenedIndex = 0;\n for (int j = 0; j < "+e+"; j++) {\n int index = round("+l+");\n flattenedIndex += index * "+p+";\n }\n if (flattenedIndex == coords[0]) {\n sum += "+h+";\n found = true;\n }\n }\n setOutput(mix(getDefaultValue(), sum, float(found)));\n }\n "},Xs=function(t,e){this.variableNames=["x","segmentIds"];var n=t.windowSize,r=t.batchSize,i=t.inSize,o=t.numSegments,a=o*Math.ceil(i/n);this.outputShape=[r,a];var s=4*Math.floor(n/4),u=n%4,c="\n sumValue += dot(values, segFilter);\n ",l="";i%n>0&&(l="\n if (inIdx < 0 || inIdx >= "+i+") {\n return initializationValue;\n }\n ");var f="";i%n>0&&(f="\n if (inIdx < 0 || inIdx >= "+i+") {\n return -1.0;\n }\n "),this.userCode="\n const float initializationValue = 0.0;\n\n float getValue(int batch, int inIdx) {\n "+l+"\n return getX(batch, inIdx);\n }\n\n float getSegmentIdAtIndex(int inIdx) {\n "+f+"\n return getSegmentIds(inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = int(floor(float(outIdx) / float(\n "+o+")) * float("+n+"));\n int currentSeg = int(mod(float(outIdx), float("+o+")));\n\n float sumValue = 0.0;\n\n for (int i = 0; i < "+s+"; i += 4) {\n int inIdx = inOffset + i;\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0\n );\n\n "+c+"\n }\n\n int inIdx = inOffset + "+s+";\n if ("+(1===u)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n int inIdxSeg = int(getSegmentIdAtIndex(inIdx));\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n 0,\n 0,\n 0\n );\n\n "+c+"\n } else if ("+(2===u)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n 0,\n 0\n );\n\n "+c+"\n } else if ("+(3===u)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n 0\n );\n\n "+c+"\n }\n setOutput(sumValue);\n }\n "},Ys=function(t,e,n){var r,i;if(this.variableNames=["c","a","b"],this.outputShape=e,n>4)throw Error("Where for rank "+n+" is not yet supported");if(1===n)i="resRC",r="resRC";else{for(var o=["resRC.x","resRC.y","resRC.z","resRC.w"],a=[],s=[],u=0;u= 1.0) {\n setOutput(getA("+i+"));\n } else {\n setOutput(getB("+i+"));\n }\n }\n "},Js=function(){function t(t){this.variableNames=["source"],this.outputShape=t,this.rank=t.length;var e,n=ha(this.rank),r="uniform int start["+this.rank+"];",i=function(t){if(1===t)return"sourceLoc";if(t<=6)return Zs.slice(0,t).map((function(t){return"sourceLoc."+t})).join(",");throw Error("Slicing for rank "+t+" is not yet supported")}(this.rank);e="\n "+n+" sourceLoc;\n "+n+" coords = getOutputCoords();\n "+t.map((function(t,e){return"sourceLoc."+Zs[e]+" = start["+e+"] + coords."+Zs[e]+";"})).join("\n")+"\n ",this.userCode="\n "+r+"\n void main() {\n "+e+"\n setOutput(getSource("+i+"));\n }\n "}return t.prototype.getCustomSetupFunc=function(t){var e=this;if(t.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+t.length+")");return function(n,r){null==e.startLoc&&(e.startLoc=n.getUniformLocationNoThrow(r,"start"),null==e.startLoc)||n.gl.uniform1iv(e.startLoc,t)}},t}(),Zs=["x","y","z","w","u","v"],Qs=function(){function t(t){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t,this.rank=t.length;var e=ha(this.rank),n=Zo("coords",this.rank),r=Zo("sourceLoc",this.rank),i=1===this.rank?"sourceLoc":"vec2("+r.slice(-2).join()+")",o="getChannel(getSource("+r.join()+"), "+i+")",a="\n result.x = "+o+";\n if (++"+n[this.rank-1]+" < "+t[this.rank-1]+") {\n ++"+r[this.rank-1]+";\n result.y = "+o+";\n --"+r[this.rank-1]+";\n }\n ",s=1===this.rank?"":"\n --"+n[this.rank-1]+";\n if (++"+n[this.rank-2]+" < "+t[this.rank-2]+") {\n ++"+r[this.rank-2]+";\n result.z = "+o+";\n if (++"+n[this.rank-1]+" < "+t[this.rank-1]+") {\n ++"+r[this.rank-1]+";\n result.w = "+o+";\n }\n }\n ",u=this.rank<=4?"sourceLoc = coords +\n "+e+"("+t.map((function(t,e){return"start["+e+"]"})).join()+");":t.map((function(t,e){return r[e]+" = "+n[e]+" + start["+e+"];"})).join("\n");this.userCode="\n uniform int start["+this.rank+"];\n void main() {\n "+e+" coords = getOutputCoords();\n "+e+" sourceLoc;\n "+u+"\n vec4 result = vec4(0.);\n "+a+"\n "+s+"\n setOutput(result);\n }\n "}return t.prototype.getCustomSetupFunc=function(t){var e=this;if(t.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+t.length+")");return function(n,r){null==e.startLoc&&(e.startLoc=n.getUniformLocationNoThrow(r,"start"),null==e.startLoc)||n.gl.uniform1iv(e.startLoc,t)}},t}(),tu=function(t,e,n){this.variableNames=["x"],this.outputShape=n;var r=n.length,i=ha(n.length),o=ha(n.length),a="";if(1===r)a="coords * strides + begin";else{var s=0;a=n.map((function(t,e){return s++,1===n.length?"coords * strides["+e+"] + begin["+e+"]":"coords["+(s-1)+"] * strides["+e+"] + begin["+e+"]"})).join(",")}this.userCode="\n "+i+" begin = "+i+"("+t+");\n "+i+" strides = "+i+"("+e+");\n\n void main() {\n "+o+" coords = getOutputCoords();\n setOutput(getX("+a+"));\n }\n "},eu=function(){function t(t){this.gpgpu=t,this.numUsedTextures=0,this.numFreeTextures=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}return t.prototype.acquireTexture=function(t,e,n){var r,i=nu(e,n),o=ru(t,i,n);if(o in this.freeTextures||(this.freeTextures[o]=[]),o in this.usedTextures||(this.usedTextures[o]=[]),this.freeTextures[o].length>0){this.numFreeTextures--,this.numUsedTextures++,this.log();var a=this.freeTextures[o].shift();return this.usedTextures[o].push(a),a}return this.numUsedTextures++,this.log(),i===Re.PACKED_2X2_FLOAT32?r=this.gpgpu.createPackedMatrixTexture(t[0],t[1]):i===Re.PACKED_2X2_FLOAT16?r=this.gpgpu.createFloat16PackedMatrixTexture(t[0],t[1]):i===Re.UNPACKED_FLOAT32?r=this.gpgpu.createFloat32MatrixTexture(t[0],t[1]):i===Re.UNPACKED_FLOAT16?r=this.gpgpu.createFloat16MatrixTexture(t[0],t[1]):i===Re.PACKED_4X1_UNSIGNED_BYTE&&(r=this.gpgpu.createUnsignedBytesMatrixTexture(t[0],t[1])),this.usedTextures[o].push(r),r},t.prototype.releaseTexture=function(t,e,n,r){if(null!=this.freeTextures){var i=ru(e,nu(n,r),r);i in this.freeTextures||(this.freeTextures[i]=[]),this.freeTextures[i].push(t),this.numFreeTextures++,this.numUsedTextures--;var o=this.usedTextures[i],a=o.indexOf(t);if(a<0)throw new Error("Cannot release a texture that was never provided by this texture manager");o.splice(a,1),this.log()}},t.prototype.log=function(){if(this.logEnabled){var t=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",this.numFreeTextures+" / "+this.numUsedTextures,"("+t+")")}},t.prototype.getNumUsedTextures=function(){return this.numUsedTextures},t.prototype.getNumFreeTextures=function(){return this.numFreeTextures},t.prototype.dispose=function(){var t=this;if(null!=this.freeTextures){for(var e in this.freeTextures)this.freeTextures[e].forEach((function(e){t.gpgpu.deleteMatrixTexture(e)}));for(var e in this.usedTextures)this.usedTextures[e].forEach((function(e){t.gpgpu.deleteMatrixTexture(e)}));this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0}},t}();function nu(t,e){if(t===Ie.UPLOAD)return Re.PACKED_2X2_FLOAT32;if(t===Ie.RENDER||null==t)return function(t){return et().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?t?Re.PACKED_2X2_FLOAT32:Re.UNPACKED_FLOAT32:t?Re.PACKED_2X2_FLOAT16:Re.UNPACKED_FLOAT16}(e);if(t===Ie.DOWNLOAD||t===Ie.PIXELS)return Re.PACKED_4X1_UNSIGNED_BYTE;throw new Error("Unknown logical texture type "+t)}function ru(t,e,n){return t[0]+"_"+t[1]+"_"+e+"_"+n}var iu=function(t,e){this.variableNames=["A"];for(var n=new Array(t.length),r=0;r5)throw Error("Tile for rank "+e+" is not yet supported");if(1===e)return"imod(resRC, "+t[0]+")";for(var n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],r=[],i=0;i= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n",du="return -x;",mu="return ceil(x);",gu="return floor(x);",vu="return exp(x);",yu="return exp(x) - 1.0;",bu=uu+"\n return sin(x);\n",xu=uu+"\n return cos(x);\n",wu=uu+"\n if (abs(x) > 1.) {\n return NAN;\n }\n return asin(x);\n",ku=uu+"\n if (abs(x) > 1.) {\n return NAN;\n }\n return acos(x);\n",Eu=uu+"\n return atan(x);\n",Cu=uu+"return log(x + sqrt(x * x + 1.0));",Su=uu+"\n if (x < 1.0) return NAN;\n return log(x + sqrt(x * x - 1.0));",Au=uu+"\n if ((x < -1.0) || (x > 1.0)) return NAN;\n return (log(1.0 + x) - log(1.0 - x)) / 2.0;",Ou="return x;",_u="\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",Nu="\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",Tu="\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",Du=function(t,e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t,this.userCode="\n vec4 unaryOperation(vec4 x) {\n "+e+"\n }\n\n void main() {\n vec4 x = getAAtOutCoords();\n vec4 y = unaryOperation(x);\n\n setOutput(y);\n }\n "},Iu=function(t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=t;var e=t.length,n=Zo("rc",e),r=ha(e),i=function(t,e){if(1===t)return"rc";for(var n="",r=0;r0?[4,Promise.all(i)]:[3,2];case 1:return s=u.sent(),a.kernelMs=dt(s),a.getExtraProfileInfo=function(){return s.map((function(t,e){return{name:o[e],ms:t}})).map((function(t){return t.name+": "+t.ms})).join(", ")},[3,3];case 2:a.kernelMs={error:"WebGL query timers are not supported in this environment."},u.label=3;case 3:return this.uploadWaitMs=0,this.downloadWaitMs=0,[2,a]}}))}))},e.prototype.memory=function(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU}},e.prototype.startTimer=function(){return et().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:Kt(),endMs:null}},e.prototype.endTimer=function(t){return et().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),t):(t.endMs=Kt(),t)},e.prototype.getQueryTime=function(t){return Z(this,void 0,void 0,(function(){var e;return Q(this,(function(n){return et().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?[2,this.gpgpu.waitForQueryAndGetTime(t)]:[2,(e=t).endMs-e.startMs]}))}))},e.prototype.disposeData=function(t){if(!this.pendingDisposal.has(t)){if(this.pendingRead.has(t))return this.pendingDisposal.add(t),void this.pendingDeletes++;if(this.texData.has(t)){this.releaseGPUData(t);var e=this.texData.get(t).complexTensors;null!=e&&(e.real.dispose(),e.imag.dispose()),this.texData.delete(t)}}},e.prototype.releaseGPUData=function(t){var e=this.texData.get(t),n=e.texture,r=e.dtype,i=e.texShape,o=e.usage,a=e.isPacked,s=e.slice,u=s&&s.origDataId||t,c=this.dataRefCount.get(u);c>1?this.dataRefCount.set(u,c-1):(this.dataRefCount.delete(u),null!=n&&(this.numBytesInGPU-=this.computeBytes(i,r),this.textureManager.releaseTexture(n,i,o,a)));var l=this.texData.get(t);l.texture=null,l.texShape=null,l.isPacked=!1,l.slice=null},e.prototype.getTexture=function(t){return this.uploadToGPU(t),this.texData.get(t).texture},e.prototype.getDataInfo=function(t){return this.texData.get(t)},e.prototype.getCPUBackend=function(){return et().getBool("WEBGL_CPU_FORWARD")?(null==this.cpuBackend&&(this.cpuBackend=_e.findBackend("cpu")),this.cpuBackend):null},e.prototype.shouldExecuteOnCPU=function(t,e){var n=this;return void 0===e&&(e=128),null!=this.getCPUBackend()&&t.every((function(t){return null==n.texData.get(t.dataId).texture&&bt(t.shape)et().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){var i=Math.floor(t.length/2),o=this.concat(t.slice(0,i),e),a=this.concat(t.slice(i),e);return this.concat([o,a],e)}if(et().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&t[0].rank>1){var s=new Ia(t.map((function(t){return t.shape})),e);return this.compileAndRun(s,t)}var u=Qn(t.map((function(t){return t.shape})),e),c=t.map((function(t){return t.as2D(-1,bt(t.shape.slice(e)))})),l=new Da(c.map((function(t){return t.shape})));return this.compileAndRun(l,c).reshape(u)},e.prototype.neg=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.neg(t);if(et().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,du,t.dtype);var e=new su(t.shape,du);return this.compileAndRun(e,[t])},e.prototype.batchMatMul=function(t,e,n,r){var i=n?t.shape[2]:t.shape[1],o=r?e.shape[1]:e.shape[2],a=n?t.shape[1]:t.shape[2],s=t.shape[0];if((1===i||1===o)&&a>1e3){n&&(t=ho(t,[0,2,1])),r&&(e=ho(e,[0,2,1]));var u=1===o?t:t.as3D(s,a,1),c=1===o?2:1,l=1===o?e.as3D(s,1,a):e;return this.multiply(u,l).sum(c,!0)}var f=be(t.dtype,e.dtype),h=new Ds(t.shape,[s,i,o],n,r);return this.compileAndRun(h,[t,e],f)},e.prototype.fusedBatchMatMul=function(t){var e=t.a,n=t.b,r=t.transposeA,i=t.transposeB,o=t.bias,a=t.activation,s=t.preluActivationWeights,u=r?e.shape[2]:e.shape[1],c=i?n.shape[1]:n.shape[2],l=e.shape[0],f=be(e.dtype,n.dtype),h=null!=o,p=null!=s,d=a?Fu(a,!0):null,m=new Ds(e.shape,[l,u,c],r,i,h,d,p),g=[e,n];return o&&g.push(o),s&&g.push(s),this.compileAndRun(m,g,f)},e.prototype.multiply=function(t,e){if("complex64"===t.dtype){var n=this.texData.get(t.dataId),r=this.texData.get(e.dataId),i=new xa("return areal * breal - aimag * bimag;",t.shape,e.shape),o=new xa("return areal * bimag + aimag * breal;",t.shape,e.shape),a=[this.makeComplexComponentTensorInfo(t,n.complexTensors.real),this.makeComplexComponentTensorInfo(t,n.complexTensors.imag),this.makeComplexComponentTensorInfo(e,r.complexTensors.real),this.makeComplexComponentTensorInfo(e,r.complexTensors.imag)],s=this.compileAndRun(i,a),u=this.compileAndRun(o,a),c=this.complex(s,u);return s.dispose(),u.dispose(),c}if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.multiply(t,e);if(et().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,Ea,t.dtype);var l=new Sa(Ea,t.shape,e.shape);return this.compileAndRun(l,[t,e],t.dtype)},e.prototype.batchNormalization=function(t,e,n,r,i,o){var a=[t,e,n],s=null;null!=o&&(s=o.shape,a.push(o));var u=null;if(null!=i&&(u=i.shape,a.push(i)),et().getBool("WEBGL_PACK_NORMALIZATION")){var c=new ba(t.shape,e.shape,n.shape,s,u,r);return this.compileAndRun(c,a)}var l=new ya(t.shape,e.shape,n.shape,s,u,r);return this.compileAndRun(l,a)},e.prototype.localResponseNormalization4D=function(t,e,n,r,i){var o=et().getBool("WEBGL_PACK_NORMALIZATION")?new _s(t.shape,e,n,r,i):new As(t.shape,e,n,r,i);return this.compileAndRun(o,[t])},e.prototype.LRNGrad=function(t,e,n,r,i,o,a){var s=new Os(e.shape,r,i,o,a);return this.compileAndRun(s,[e,n,t])},e.prototype.tile=function(t,e){if("string"===t.dtype){var n=this.readSync(t.dataId).map((function(t){return Jt(t)}));return Ho(Sr(t.shape,t.dtype,n),e)}var r=new iu(t.shape,e);return this.compileAndRun(r,[t])},e.prototype.pad=function(t,e,n){var r=et().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Bs(t.shape,e,n):new Ms(t.shape,e,n);return this.compileAndRun(r,[t])},e.prototype.gather=function(t,e,n){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.gather(t,e,n);var r=new rs(t.shape,e.size,n);return this.compileAndRun(r,[t,e])},e.prototype.batchToSpaceND=function(t,e,n){mt(t.rank<=4,(function(){return"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet"}));var r=e.reduce((function(t,e){return t*e})),i=zr(t.shape,e,r),o=jr(i.length,e.length),a=Pr(t.shape,e,r),s=Lr(n,e.length),u=Wr(a,n,e.length);return ho(t.reshape(i),o).reshape(a).slice(s,u)},e.prototype.spaceToBatchND=function(t,e,n){mt(t.rank<=4,(function(){return"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet"}));var r=e.reduce((function(t,e){return t*e})),i=[[0,0]];i.push.apply(i,n);for(var o=1+e.length;oe||n===t?r=!0:n=Ut(t,n+1);return n}(a,i),u=new Xs({windowSize:s,inSize:a,batchSize:o,numSegments:i}),c=this.compileAndRun(u,[t,n],r);return c.shape[1]===i?c:(n=gr(0,i).tile([a/s]),this.segOpCompute(c,e,n,r,i))},e.prototype.argMinMaxReduce=function(t,e,n){var r=[e];if(Kn("arg"+n.charAt(0).toUpperCase()+n.slice(1),r,t.rank),!et().getBool("WEBGL_PACK_REDUCE")||t.rank<=2){var i=Gn(t.shape,r),o=i[0],a=bt(i[1]),s=t.as2D(-1,a);return this.argReduce(s,n).reshape(o)}return this.argReducePacked(t,n)},e.prototype.argMin=function(t,e){return this.argMinMaxReduce(t,e,"min")},e.prototype.argMax=function(t,e){return this.argMinMaxReduce(t,e,"max")},e.prototype.cumsum=function(t,e,n,r){if(e!==t.rank-1)throw new Error("WebGL cumsum shader expects an inner-most axis="+(t.rank-1)+" but got axis="+e);var i=new Ha(t.shape,n,r);return this.compileAndRun(i,[t])},e.prototype.equal=function(t,e){if(et().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(equal(a, b));\n","bool");var n=new Sa("return float(a == b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.notEqual=function(t,e){if(et().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(notEqual(a, b));\n","bool");var n=new Sa("return float(a != b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.less=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.less(t,e);if(et().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(lessThan(a, b));\n","bool");var n=new Sa("return float(a < b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.lessEqual=function(t,e){if(et().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(lessThanEqual(a, b));\n","bool");var n=new Sa("return float(a <= b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.greater=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.greater(t,e);if(et().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(greaterThan(a, b));\n","bool");var n=new Sa("return float(a > b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.greaterEqual=function(t,e){if(et().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(greaterThanEqual(a, b));\n","bool");var n=new Sa("return float(a >= b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.logicalNot=function(t){var e=new su(t.shape,"return float(!(x >= 1.0));");return this.compileAndRun(e,[t])},e.prototype.logicalAnd=function(t,e){if(et().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(\n vec4(greaterThanEqual(a, vec4(1.0))) *\n vec4(greaterThanEqual(b, vec4(1.0))));\n","bool");var n=new Sa("return float(a >= 1.0 && b >= 1.0);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.logicalOr=function(t,e){if(et().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return min(\n vec4(greaterThanEqual(a, vec4(1.0))) +\n vec4(greaterThanEqual(b, vec4(1.0))),\n vec4(1.0));\n","bool");var n=new Sa("return float(a >= 1.0 || b >= 1.0);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.select=function(t,e,n){var r=new Ys(t.rank,e.shape,e.rank);return this.compileAndRun(r,[t,e,n],be(e.dtype,n.dtype))},e.prototype.where=function(t){Pn("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");var e=t.dataSync();return $o(t.shape,e)},e.prototype.topk=function(t,e,n){return Go(t.dataSync(),t.shape,t.dtype,e)},e.prototype.min=function(t,e){Kn("min",e,t.rank);var n=Gn(t.shape,e),r=n[0],i=bt(n[1]),o=t.as2D(-1,i);return this.reduce(o,"min",o.dtype).reshape(r)},e.prototype.minimum=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.minimum(t,e);var n=et().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Oa("\n vec4 result = vec4(min(a, b));\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Sa("\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return min(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.mod=function(t,e){var n=et().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Oa("\n vec4 result = mod(a, b);\n vec4 isNaN = vec4(equal(b, vec4(0.0)));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Sa("if (b == 0.0) return NAN;\n return mod(a, b);",t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.max=function(t,e){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.max(t,e);Kn("max",e,t.rank);var n=Gn(t.shape,e),r=n[0],i=bt(n[1]),o=t.as2D(-1,i);return this.reduce(o,"max",o.dtype).reshape(r)},e.prototype.maximum=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.maximum(t,e);var n=et().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Oa("\n vec4 result = vec4(max(a, b));\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Sa("\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return max(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.all=function(t,e){Kn("all",e,t.rank);var n=Gn(t.shape,e),r=n[0],i=bt(n[1]),o=t.as2D(-1,i);return this.reduce(o,"all",o.dtype).reshape(r)},e.prototype.any=function(t,e){Kn("any",e,t.rank);var n=Gn(t.shape,e),r=n[0],i=bt(n[1]),o=t.as2D(-1,i);return this.reduce(o,"any",o.dtype).reshape(r)},e.prototype.floorDiv=function(t,e){if(et().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\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","int32");var n=new Sa("\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",t.shape,e.shape);return this.compileAndRun(n,[t,e],"int32")},e.prototype.add=function(t,e){if("complex64"===t.dtype&&"complex64"===e.dtype)return this.complexSeparableBinaryOp(t,e,wa);if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.add(t,e);var n=be(t.dtype,e.dtype);if(et().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,wa,n);var r=new Sa(wa,t.shape,e.shape);return this.compileAndRun(r,[t,e],n)},e.prototype.packedUnaryOp=function(t,e,n){var r=new Du(t.shape,e);return this.compileAndRun(r,[t],n)},e.prototype.packedBinaryOp=function(t,e,n,r,i){void 0===i&&(i=!1);var o=new Oa(n,t.shape,e.shape,i);return this.compileAndRun(o,[t,e],r)},e.prototype.complexSeparableBinaryOp=function(t,e,n){var r=this,i=this.texData.get(t.dataId),o=this.texData.get(e.dataId),a=[[i.complexTensors.real,o.complexTensors.real],[i.complexTensors.imag,o.complexTensors.imag]].map((function(i){var o=i[0],a=i[1],s=r.makeComplexComponentTensorInfo(t,o),u=r.makeComplexComponentTensorInfo(e,a),c=new Sa(n,t.shape,e.shape);return r.compileAndRun(c,[s,u],be(o.dtype,a.dtype))})),s=a[0],u=a[1],c=this.complex(s,u);return s.dispose(),u.dispose(),c},e.prototype.makeComplexComponentTensorInfo=function(t,e){return{dataId:e.dataId,dtype:e.dtype,shape:t.shape}},e.prototype.addN=function(t){if(1===t.length)return t[0];if(t.length>et().get("WEBGL_MAX_TEXTURES_IN_SHADER")){var e=Math.floor(t.length/2),n=this.addN(t.slice(0,e)),r=this.addN(t.slice(e));return this.addN([n,r])}var i=t.map((function(t){return t.dtype})).reduce((function(t,e){return be(t,e)})),o=t.map((function(t){return t.shape})),a=et().getBool("WEBGL_PACK")?new Xo(t[0].shape,o):new Ko(t[0].shape,o);return this.compileAndRun(a,t,i)},e.prototype.subtract=function(t,e){if("complex64"===t.dtype&&"complex64"===e.dtype)return this.complexSeparableBinaryOp(t,e,ka);if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.subtract(t,e);var n=be(t.dtype,e.dtype);if(et().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,ka,t.dtype);var r=new Sa(ka,t.shape,e.shape);return this.compileAndRun(r,[t,e],n)},e.prototype.pow=function(t,e){var n=et().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Oa("\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 vec4 isNaN = vec4(lessThan(a, vec4(0.0))) * vec4(lessThan(floor(b), b));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Sa("\nif(a < 0.0 && floor(b) < b){\n return NAN;\n}\nif (b == 0.0) {\n return 1.0;\n}\nreturn (round(mod(b, 2.0)) != 1) ?\n pow(abs(a), b) : sign(a) * pow(abs(a), b);\n",t.shape,e.shape),r=be(t.dtype,e.dtype);return this.compileAndRun(n,[t,e],r)},e.prototype.ceil=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.ceil(t);if(et().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,mu,t.dtype);var e=new su(t.shape,mu);return this.compileAndRun(e,[t])},e.prototype.floor=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.floor(t);if(et().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,gu,t.dtype);var e=new su(t.shape,gu);return this.compileAndRun(e,[t])},e.prototype.sign=function(t){var e=new su(t.shape,"\n if (isnan(x)) { return 0.0; }\n return sign(x);\n");return this.compileAndRun(e,[t])},e.prototype.isNaN=function(t){var e=new su(t.shape,"return float(isnan(x));");return this.compileAndRun(e,[t],"bool")},e.prototype.isInf=function(t){var e=new su(t.shape,"return float(isinf(x));");return this.compileAndRun(e,[t],"bool")},e.prototype.isFinite=function(t){var e=new su(t.shape,"return float(!isnan(x) && !isinf(x));");return this.compileAndRun(e,[t],"bool")},e.prototype.round=function(t){var e=new su(t.shape,"\n // OpenGL ES does not support round function.\n // The algorithm is based on banker's rounding.\n float base = floor(x);\n if ((x - base) < 0.5) {\n return floor(x);\n } else if ((x - base) > 0.5) {\n return ceil(x);\n } else {\n if (mod(base, 2.0) == 0.0) {\n return base;\n } else {\n return base + 1.0;\n }\n }\n");return this.compileAndRun(e,[t])},e.prototype.exp=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.exp(t);if(et().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,vu,t.dtype);var e=new su(t.shape,vu);return this.compileAndRun(e,[t])},e.prototype.expm1=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.expm1(t);if(et().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,yu,t.dtype);var e=new su(t.shape,yu);return this.compileAndRun(e,[t])},e.prototype.softmax=function(t,e){var n=Ot([e],t.shape),r=this.max(t,n),i=$n(r.shape,n),o=this.subtract(t,r.reshape(i)),a=this.exp(o),s=this.sum(a,n).reshape(i);return Yi(a,s)},e.prototype.log=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.log(t);if(et().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,"\n vec4 result = log(x);\n vec4 isNaN = vec4(lessThan(x, vec4(0.0)));\n result.r = isNaN.r == 1.0 ? NAN : result.r;\n result.g = isNaN.g == 1.0 ? NAN : result.g;\n result.b = isNaN.b == 1.0 ? NAN : result.b;\n result.a = isNaN.a == 1.0 ? NAN : result.a;\n\n return result;\n",t.dtype);var e=new su(t.shape,"if (x < 0.0) return NAN;\n return log(x);");return this.compileAndRun(e,[t])},e.prototype.log1p=function(t){var e=new su(t.shape,"return log(1.0 + x);");return this.compileAndRun(e,[t])},e.prototype.sqrt=function(t){var e=new su(t.shape,"return sqrt(x);");return this.compileAndRun(e,[t])},e.prototype.rsqrt=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.rsqrt(t);var e=new su(t.shape,"return inversesqrt(x);");return this.compileAndRun(e,[t])},e.prototype.reciprocal=function(t){var e=new su(t.shape,"return 1.0 / x;");return this.compileAndRun(e,[t])},e.prototype.relu=function(t){var e;return e=et().getBool("WEBGL_PACK")?new Du(t.shape,_u):new su(t.shape,lu),this.compileAndRun(e,[t])},e.prototype.relu6=function(t){var e;return e=et().getBool("WEBGL_PACK")?new Du(t.shape,Nu):new su(t.shape,fu),this.compileAndRun(e,[t])},e.prototype.prelu=function(t,e){var n=et().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Oa(Aa,t.shape,e.shape):new Sa(Ca,t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.elu=function(t){if(et().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,Tu,t.dtype);var e=new su(t.shape,hu);return this.compileAndRun(e,[t])},e.prototype.eluDer=function(t,e){var n=et().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Oa("\n vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));\n return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));\n",t.shape,e.shape):new Sa("return (b >= 1.0) ? a : a * (b + 1.0);",t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.selu=function(t){var e=new su(t.shape,pu);return this.compileAndRun(e,[t])},e.prototype.int=function(t){var e=new su(t.shape,"return float(int(x));");return this.compileAndRun(e,[t],"int32")},e.prototype.clip=function(t,e,n){var r,i=(r=et().getBool("WEBGL_PACK_CLIP")?new Na(t.shape):new _a(t.shape)).getCustomSetupFunc(e,n);return this.compileAndRun(r,[t],null,i)},e.prototype.abs=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.abs(t);if(et().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,cu,t.dtype);var e=new su(t.shape,cu);return this.compileAndRun(e,[t])},e.prototype.complexAbs=function(t){var e=this.texData.get(t.dataId),n=new Ta(t.shape),r=[this.makeComplexComponentTensorInfo(t,e.complexTensors.real),this.makeComplexComponentTensorInfo(t,e.complexTensors.imag)];return this.compileAndRun(n,r)},e.prototype.sigmoid=function(t){var e=new su(t.shape,"return 1.0 / (1.0 + exp(-1.0 * x));");return this.compileAndRun(e,[t])},e.prototype.softplus=function(t){var e=new su(t.shape,"\n float epsilon = 1.1920928955078125e-7;\n float threshold = log(epsilon) + 2.0;\n\n bool too_large = x > -threshold;\n bool too_small = x < threshold;\n\n float result;\n float exp_x = exp(x);\n\n if (too_large){\n result = x;\n }\n else if (too_small){\n result = exp_x;\n }\n else{\n result = log(exp_x + 1.0);\n }\n return result;\n");return this.compileAndRun(e,[t])},e.prototype.sin=function(t){var e=new su(t.shape,bu);return this.compileAndRun(e,[t])},e.prototype.cos=function(t){var e=new su(t.shape,xu);return this.compileAndRun(e,[t])},e.prototype.tan=function(t){var e=new su(t.shape,"return tan(x);");return this.compileAndRun(e,[t])},e.prototype.asin=function(t){var e=new su(t.shape,wu);return this.compileAndRun(e,[t])},e.prototype.acos=function(t){var e=new su(t.shape,ku);return this.compileAndRun(e,[t])},e.prototype.atan=function(t){var e=new su(t.shape,Eu);return this.compileAndRun(e,[t])},e.prototype.atan2=function(t,e){var n=et().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Oa("\n vec4 result = atan(a, b);\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Sa("\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return atan(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.sinh=function(t){var e=new su(t.shape,"\n float e2x = exp(x);\n return (e2x - 1.0 / e2x) / 2.0;\n");return this.compileAndRun(e,[t])},e.prototype.cosh=function(t){var e=new su(t.shape,"\n float e2x = exp(-x);\n return (e2x + 1.0 / e2x) / 2.0;\n");return this.compileAndRun(e,[t])},e.prototype.tanh=function(t){var e=new su(t.shape,"\n float e2x = exp(-2.0 * abs(x));\n return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n");return this.compileAndRun(e,[t])},e.prototype.asinh=function(t){var e=new su(t.shape,Cu);return this.compileAndRun(e,[t])},e.prototype.acosh=function(t){var e=new su(t.shape,Su);return this.compileAndRun(e,[t])},e.prototype.atanh=function(t){var e=new su(t.shape,Au);return this.compileAndRun(e,[t])},e.prototype.erf=function(t){var e=new su(t.shape,'\n // Error function is calculated approximately with elementary function.\n // See "Handbook of Mathematical Functions with Formulas,\n // Graphs, and Mathematical Tables", Abramowitz and Stegun.\n float p = 0.3275911;\n float a1 = 0.254829592;\n float a2 = -0.284496736;\n float a3 = 1.421413741;\n float a4 = -1.453152027;\n float a5 = 1.061405429;\n\n float 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');return this.compileAndRun(e,[t])},e.prototype.step=function(t,e){var n=new su(t.shape,function(t){return void 0===t&&(t=0),uu+"\n return x > 0.0 ? 1.0 : float("+t+");\n "}(e));return this.compileAndRun(n,[t])},e.prototype.conv2dByMatMul=function(t,e,n,r,i,o){var a=t.shape,s=this.texData.get(t.dataId),u=n.inChannels,c=a[0]*a[1]*a[2],l=n.outChannels,f="channelsLast"===n.dataFormat,h=(1===c||1===l)&&u>1e3,p=a[2]%2!=0&&!!s.isPacked;if(h||!et().getBool("WEBGL_LAZILY_UNPACK")||!et().getBool("WEBGL_PACK_BINARY_OPERATIONS")||!p){var d=f?a[0]*a[1]*a[2]:a[0]*a[2]*a[3],m=this.reshape(t,[1,d,n.inChannels]),g=this.reshape(e,[1,n.inChannels,n.outChannels]);return this.reshape(this.fusedBatchMatMul({a:m,b:g,transposeA:!1,transposeB:!1,bias:r,activation:i,preluActivationWeights:o}),n.outShape)}var v=f?a[0]*a[1]*(a[2]+1):a[0]*a[2]*(a[3]+1),y={dataId:t.dataId,shape:[1,v,n.inChannels],dtype:t.dtype},b=s.shape;s.shape=s.shape.slice(),s.shape[s.shape.length-2]++,mt(kn(s.shape,y.shape),(function(){return"packed reshape "+s.shape+" to "+y.shape+" isn't free"}));var x=this.reshape(e,[1,n.inChannels,n.outChannels]),w=this.fusedBatchMatMul({a:y,b:x,transposeA:!1,transposeB:!1,bias:r,activation:i,preluActivationWeights:o}),k=this.texData.get(w.dataId);return mt(k.isPacked,(function(){return"batchMatMul result is expected to be packed"})),s.shape=b,k.shape=n.outShape,_e.makeTensorFromDataId(w.dataId,n.outShape,w.dtype)},e.prototype.conv2dWithIm2Row=function(t,e,n,r,i,o){var a=n.filterWidth,s=n.filterHeight,u=n.inChannels,c=n.outWidth,l=n.outHeight,f="channelsLast"===n.dataFormat,h=a*s*u,p=l*c,d=[h,p],m=t.squeeze([0]),g=e.reshape([1,h,-1]),v=new Ss(d,m.shape,n),y=this.compileAndRun(v,[m]).reshape([1,d[0],d[1]]),b=null!=r,x=null!=o,w=i?Fu(i,!0):null,k=new Ds(y.shape,[1,p,n.outChannels],!0,!1,b,w,x),E=[y,g];r&&E.push(r),x&&E.push(o);var C=this.compileAndRun(k,E);return f?C.reshape([1,l,c,n.outChannels]):C.reshape([1,n.outChannels,l,c])},e.prototype.fusedConv2d=function(t){var e=t.input,n=t.filter,r=t.convInfo,i=t.bias,o=t.activation,a=t.preluActivationWeights;if(1===r.filterHeight&&1===r.filterWidth&&1===r.dilationHeight&&1===r.dilationWidth&&1===r.strideHeight&&1===r.strideWidth&&("SAME"===r.padInfo.type||"VALID"===r.padInfo.type))return this.conv2dByMatMul(e,n,r,i,o,a);if(et().getBool("WEBGL_CONV_IM2COL")&&1===e.shape[0])return this.conv2dWithIm2Row(e,n,r,i,o,a);var s=null!=i,u=null!=a,c=o?Fu(o,!1):null,l=new La(r,s,c,u),f=[e,n];return i&&f.push(i),a&&f.push(a),this.compileAndRun(l,f)},e.prototype.conv2d=function(t,e,n){if(1===n.filterHeight&&1===n.filterWidth&&1===n.dilationHeight&&1===n.dilationWidth&&1===n.strideHeight&&1===n.strideWidth&&("SAME"===n.padInfo.type||"VALID"===n.padInfo.type))return this.conv2dByMatMul(t,e,n);if(et().getBool("WEBGL_CONV_IM2COL")&&1===t.shape[0])return this.conv2dWithIm2Row(t,e,n);var r=new La(n);return this.compileAndRun(r,[t,e])},e.prototype.conv2dDerInput=function(t,e,n){var r=new Ma(n);return this.compileAndRun(r,[t,e])},e.prototype.conv2dDerFilter=function(t,e,n){var r=new Fa(n);return this.compileAndRun(r,[t,e])},e.prototype.fusedDepthwiseConv2D=function(t){var e,n=t.input,r=t.filter,i=t.convInfo,o=t.bias,a=t.activation,s=t.preluActivationWeights,u=et().getBool("WEBGL_PACK_DEPTHWISECONV")&&i.strideWidth<=2&&i.outChannels/i.inChannels==1,c=a?Fu(a,u):null,l=[n,r],f=null!=o,h=null!=s;return f&&l.push(o),h&&l.push(s),u?(e=new Va(i,f,c,h),this.compileAndRun(e,l)):(e=new Ua(i,f,c,h),this.compileAndRun(e,l))},e.prototype.depthwiseConv2D=function(t,e,n){var r;return et().getBool("WEBGL_PACK_DEPTHWISECONV")&&n.strideWidth<=2&&n.outChannels/n.inChannels==1?(r=new Va(n),this.compileAndRun(r,[t,e])):(r=new Ua(n),this.compileAndRun(r,[t,e]))},e.prototype.depthwiseConv2DDerInput=function(t,e,n){var r=new Pa(n);return this.compileAndRun(r,[t,e])},e.prototype.depthwiseConv2DDerFilter=function(t,e,n){var r=new ja(n);return this.compileAndRun(r,[t,e])},e.prototype.conv3d=function(t,e,n){var r=new Wa(n);return this.compileAndRun(r,[t,e])},e.prototype.conv3dDerInput=function(t,e,n){var r=new za(n);return this.compileAndRun(r,[t,e])},e.prototype.conv3dDerFilter=function(t,e,n){var r=new Ba(n);return this.compileAndRun(r,[t,e])},e.prototype.maxPool=function(t,e){var n=new zs(e,"max",!1);return this.compileAndRun(n,[t])},e.prototype.avgPool=function(t,e){var n=new zs(e,"avg",!1);return this.compileAndRun(n,[t],"float32")},e.prototype.maxPoolBackprop=function(t,e,n,r){var i=new zs(r,"max",!0),o=this.compileAndRun(i,[e]),a=new Ns(r),s=this.compileAndRun(a,[t,o],e.dtype);return o.dispose(),s},e.prototype.avgPoolBackprop=function(t,e,n){var r=new ga(n);return this.compileAndRun(r,[t],e.dtype)},e.prototype.cast=function(t,e){return No(t,e,this)},e.prototype.unstack=function(t,e){for(var n=t.shape[e],r=new Array(t.rank-1),i=0,o=0;o1,(function(){return"blockSize should be > 1 for depthToSpace, but was: "+e}));var r=t.shape[0],i="NHWC"===n?t.shape[1]:t.shape[2],o="NHWC"===n?t.shape[2]:t.shape[3],a="NHWC"===n?t.shape[3]:t.shape[1],s=i*e,u=o*e,c=a/(e*e),l=new Xa("NHWC"===n?[r,s,u,c]:[r,c,s,u],e,n);return this.compileAndRun(l,[t])},e.prototype.split=function(t,e,n){return qo(t,e,n)},e.prototype.scatterND=function(t,e,n){var r=eo(0,t,n),i=r.sliceRank,o=r.numUpdates,a=r.sliceSize,s=r.strides,u=r.outputSize,c=[u/a,a],l=t.reshape([o,i]),f=e.reshape([o,a]);if(0===u)return To(ir([]),n);var h=ar(0),p=new Ks(o,i,l.rank,f.rank,s,c);return this.compileAndRun(p,[f,l,h]).reshape(n)},e.prototype.sparseToDense=function(t,e,n,r){var i=eo(0,t,n),o=i.sliceRank,a=i.numUpdates,s=i.strides,u=i.outputSize,c=new Ks(a,o,t.rank,e.rank,s,[u,1]);return this.compileAndRun(c,[e,t,r]).reshape(n)},e.prototype.fft=function(t){return this.fftImpl(t,!1)},e.prototype.ifft=function(t){return this.fftImpl(t,!0)},e.prototype.fftImpl=function(t,e){var n=this.texData.get(t.dataId),r=new es("return real * expR - imag * expI;",t.shape,e),i=new es("return real * expI + imag * expR;",t.shape,e),o=[this.makeComplexComponentTensorInfo(t,n.complexTensors.real),this.makeComplexComponentTensorInfo(t,n.complexTensors.imag)],a=this.compileAndRun(r,o),s=this.compileAndRun(i,o),u=this.complex(a,s).as2D(t.shape[0],t.shape[1]);return a.dispose(),s.dispose(),u},e.prototype.gatherND=function(t,e){var n=e.shape,r=n[n.length-1],i=Ji(t,e),o=i[0],a=i[1],s=i[2],u=i[3],c=e.reshape([a,r]),l=t.reshape([t.size/s,s]),f=new is(r,u,[a,s]);return this.compileAndRun(f,[l,c]).reshape(o)},e.prototype.fill=function(t,e,n){if("string"===(n=n||Lt(e))){var r=Tt(n,bt(t));return r.fill(e),_e.makeTensor(r,t,n,this)}var i=new ns(t,e),o=i.getCustomSetupFunc(e);return this.compileAndRun(i,[],n,o)},e.prototype.onesLike=function(t){if("string"===t.dtype)throw new Error("onesLike is not supported under string dtype");return this.fill(t.shape,1,t.dtype)},e.prototype.zerosLike=function(t){return this.fill(t.shape,"string"===t.dtype?"":0,t.dtype)},e.prototype.linspace=function(t,e,n){return Do(t,e,n)},e.prototype.makeTensorInfo=function(t,e){var n=this.write(null,t,e);return this.texData.get(n).usage=null,{dataId:n,shape:t,dtype:e}},e.prototype.makeOutput=function(t,e){var n=this.makeTensorInfo(t,e).dataId;return _e.makeTensorFromDataId(n,t,e,this)},e.prototype.unpackTensor=function(t){var e=new Iu(t.shape);return this.runWebGLProgram(e,[t],t.dtype)},e.prototype.packTensor=function(t){var e=new Fs(t.shape);return this.runWebGLProgram(e,[t],t.dtype,null,!0)},e.prototype.packedReshape=function(t,e){var n=[vn(t.shape)].concat(yn(t.shape)),r={dtype:t.dtype,shape:n,dataId:t.dataId},i=[vn(e)].concat(yn(e)),o=new Ls(i,n),a=this.runWebGLProgram(o,[r],t.dtype,null,!0);return{dataId:a.dataId,shape:e,dtype:a.dtype}},e.prototype.decode=function(t){var e,n=this.texData.get(t),r=n.isPacked,i=n.shape,o=n.dtype,a=bn(i);return e=r?new Ka(a):new $a(a),{dtype:o,shape:i,dataId:this.runWebGLProgram(e,[{shape:a,dtype:o,dataId:t}],o,null,!0).dataId}},e.prototype.runWebGLProgram=function(t,e,n,r,i){var o=this;void 0===i&&(i=!1);var a=this.makeTensorInfo(t.outputShape,n),s=this.texData.get(a.dataId);if(t.packedOutput&&(s.isPacked=!0),t.outPackingScheme===De.DENSE){var u=Pe(t.outputShape);s.texShape=u.map((function(t){return 2*t}))}if(null!=t.outTexUsage&&(s.usage=t.outTexUsage),0===bt(a.shape))return s.values=Nt(a.dtype,0),a;var c=[],l=e.map((function(e){if("complex64"===e.dtype)throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");var n=o.texData.get(e.dataId);if(null==n.texture){if(!t.packedInputs&&bt(e.shape)<=et().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:e.shape,texData:null,isUniform:!0,uniformValues:n.values};t.packedInputs&&(n.isPacked=!0,n.shape=e.shape)}else if(!!n.isPacked!=!!t.packedInputs)e=n.isPacked?o.unpackTensor(e):o.packTensor(e),c.push(e),n=o.texData.get(e.dataId);else if(n.isPacked&&!kn(n.shape,e.shape)){var r=e,i=e.shape;e.shape=n.shape,e=o.packedReshape(e,i),c.push(e),n=o.texData.get(e.dataId),r.shape=i}return o.uploadToGPU(e.dataId),{shape:e.shape,texData:n,isUniform:!1}}));this.uploadToGPU(a.dataId);var f,h={shape:a.shape,texData:s,isUniform:!1},p=function(t,e,n){var r="";e.concat(n).forEach((function(t){var e=null!=t.texData&&null!=t.texData.slice&&t.texData.slice.flatOffset>0,n=t.isUniform?"uniform":t.texData.texShape;r+=t.shape+"_"+n+"_"+e}));var i=t.userCode;return t.constructor.name+"_"+r+"_"+i}(t,l,h),d=this.getAndSaveBinary(p,(function(){return function(t,e,n,r){var i=e.userCode,o=n.map((function(t,n){var r={logicalShape:t.shape,texShape:t.isUniform?null:t.texData.texShape,isUniform:t.isUniform,isPacked:!t.isUniform&&t.texData.isPacked,flatOffset:null};return null!=t.texData&&null!=t.texData.slice&&t.texData.slice.flatOffset>0&&(r.flatOffset=t.texData.slice.flatOffset),{name:e.variableNames[n],shapeInfo:r}})),a=o.map((function(t){return t.shapeInfo})),s={logicalShape:r.shape,texShape:r.texData.texShape,isUniform:!1,isPacked:r.texData.isPacked,flatOffset:null},u=ra(o,s,i,e.packedInputs),c=t.createProgram(u),l=null,f=t.getUniformLocation(c,"NAN",!1);1===et().getNumber("WEBGL_VERSION")&&(l=t.getUniformLocation(c,"INFINITY",!1));for(var h={},p=0;p0)return 32}return 16}))),this.floatPrecisionValue},e.prototype.epsilon=function(){return 32===this.floatPrecision()?1e-7:1e-4},e.prototype.uploadToGPU=function(t){var e,n=this.texData.get(t),r=n.shape,i=n.dtype,o=n.values,a=n.texture,s=n.usage,u=n.isPacked;if(null==a){var c,l=null!=this.activeTimers;l&&(c=Kt());var f=n.texShape;if(null==f&&(f=xn(r,u),n.texShape=f),null!=o){var h=bn(r),p=void 0,d=f[1],m=f[0],g=o instanceof Uint8Array;u?(d=(e=Le(f[0],f[1]))[0],m=e[1],p=new ts(h,[m,d],g)):p=new Qa(h,[m,d],g);var v=this.makeTensorInfo([m,d],i);this.texData.get(v.dataId).usage=g?Ie.PIXELS:Ie.UPLOAD,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(v.dataId),d,m,o);var y=this.runWebGLProgram(p,[v],i,null,!0),b=this.texData.get(y.dataId);n.texture=b.texture,n.texShape=b.texShape,n.isPacked=b.isPacked,n.usage=b.usage,this.disposeData(v.dataId),this.texData.delete(y.dataId),n.values=null,l&&(this.uploadWaitMs+=Kt()-c)}else{var x=this.acquireTexture(f,s,i,u);n.texture=x}}},e.prototype.convertAndCacheOnCPU=function(t,e){var n=this.texData.get(t),r=n.dtype;return this.releaseGPUData(t),null!=e&&(n.values=function(t,e){if("float32"===e||"complex64"===e)return t;if("int32"===e||"bool"===e){for(var n="int32"===e?new Int32Array(t.length):new Uint8Array(t.length),r=0;r1024*this.numMBBeforeWarning*1024){var i=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn("High memory usage in GPU: "+i+" MB, most likely due to a memory leak")}return this.textureManager.acquireTexture(t,e,r)},e.prototype.computeBytes=function(t,e){return t[0]*t[1]*Mt(e)},e}(mo);function Bu(t,e){return t(e={exports:{}},e.exports),e.exports}Ne()&&_e.registerBackend("webgl",(function(){return new Mu}),2);var zu=Bu((function(t){!function(t,e,n){function r(t){var e,n=this,r=(e=4022871197,function(t){t=t.toString();for(var n=0;n>>0,e=(r*=e)>>>0,e+=4294967296*(r-=e)}return 2.3283064365386963e-10*(e>>>0)});n.next=function(){var t=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=t-(n.c=0|t)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(t),n.s0<0&&(n.s0+=1),n.s1-=r(t),n.s1<0&&(n.s1+=1),n.s2-=r(t),n.s2<0&&(n.s2+=1),r=null}function i(t,e){return e.c=t.c,e.s0=t.s0,e.s1=t.s1,e.s2=t.s2,e}function o(t,e){var n=new r(t),o=e&&e.state,a=n.next;return a.int32=function(){return 4294967296*n.next()|0},a.double=function(){return a()+11102230246251565e-32*(2097152*a()|0)},a.quick=a,o&&("object"==typeof o&&i(o,n),a.state=function(){return i(n,{})}),a}e&&e.exports?e.exports=o:this.alea=o}(0,t)})),ju=Bu((function(t){!function(t,e,n){function r(t){var e=this,n="";e.x=0,e.y=0,e.z=0,e.w=0,e.next=function(){var t=e.x^e.x<<11;return e.x=e.y,e.y=e.z,e.z=e.w,e.w^=e.w>>>19^t^t>>>8},t===(0|t)?e.x=t:n+=t;for(var r=0;r>>0)/4294967296};return a.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},a.int32=n.next,a.quick=a,o&&("object"==typeof o&&i(o,n),a.state=function(){return i(n,{})}),a}e&&e.exports?e.exports=o:this.xor128=o}(0,t)})),Pu=Bu((function(t){!function(t,e,n){function r(t){var e=this,n="";e.next=function(){var t=e.x^e.x>>>2;return e.x=e.y,e.y=e.z,e.z=e.w,e.w=e.v,(e.d=e.d+362437|0)+(e.v=e.v^e.v<<4^t^t<<1)|0},e.x=0,e.y=0,e.z=0,e.w=0,e.v=0,t===(0|t)?e.x=t:n+=t;for(var r=0;r>>4),e.next()}function i(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e.v=t.v,e.d=t.d,e}function o(t,e){var n=new r(t),o=e&&e.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},a.int32=n.next,a.quick=a,o&&("object"==typeof o&&i(o,n),a.state=function(){return i(n,{})}),a}e&&e.exports?e.exports=o:this.xorwow=o}(0,t)})),Lu=Bu((function(t){!function(t,e,n){function r(t){var e=this;e.next=function(){var t,n,r=e.x,i=e.i;return t=r[i],n=(t^=t>>>7)^t<<24,n^=(t=r[i+1&7])^t>>>10,n^=(t=r[i+3&7])^t>>>3,n^=(t=r[i+4&7])^t<<7,t=r[i+7&7],n^=(t^=t<<13)^t<<9,r[i]=n,e.i=i+1&7,n},function(t,e){var n,r=[];if(e===(0|e))r[0]=e;else for(e=""+e,n=0;n0;--n)t.next()}(e,t)}function i(t,e){return e.x=t.x.slice(),e.i=t.i,e}function o(t,e){null==t&&(t=+new Date);var n=new r(t),o=e&&e.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},a.int32=n.next,a.quick=a,o&&(o.x&&i(o,n),a.state=function(){return i(n,{})}),a}e&&e.exports?e.exports=o:this.xorshift7=o}(0,t)})),Wu=Bu((function(t){!function(t,e,n){function r(t){var e=this;e.next=function(){var t,n,r=e.w,i=e.X,o=e.i;return e.w=r=r+1640531527|0,n=i[o+34&127],t=i[o=o+1&127],n^=n<<13,t^=t<<17,n^=n>>>15,t^=t>>>12,n=i[o]=n^t,e.i=o,n+(r^r>>>16)|0},function(t,e){var n,r,i,o,a,s=[],u=128;for(e===(0|e)?(r=e,e=null):(e+="\0",r=0,u=Math.max(u,e.length)),i=0,o=-32;o>>15,r^=r<<4,r^=r>>>13,o>=0&&(a=a+1640531527|0,i=0==(n=s[127&o]^=r+a)?i+1:0);for(i>=128&&(s[127&(e&&e.length||0)]=-1),i=127,o=512;o>0;--o)r=s[i+34&127],n=s[i=i+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[i]=r^n;t.w=a,t.X=s,t.i=i}(e,t)}function i(t,e){return e.i=t.i,e.w=t.w,e.X=t.X.slice(),e}function o(t,e){null==t&&(t=+new Date);var n=new r(t),o=e&&e.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},a.int32=n.next,a.quick=a,o&&(o.X&&i(o,n),a.state=function(){return i(n,{})}),a}e&&e.exports?e.exports=o:this.xor4096=o}(0,t)})),Uu=Bu((function(t){!function(t,e,n){function r(t){var e=this,n="";e.next=function(){var t=e.b,n=e.c,r=e.d,i=e.a;return t=t<<25^t>>>7^n,n=n-r|0,r=r<<24^r>>>8^i,i=i-t|0,e.b=t=t<<20^t>>>12^n,e.c=n=n-r|0,e.d=r<<16^n>>>16^i,e.a=i-t|0},e.a=0,e.b=0,e.c=-1640531527,e.d=1367130551,t===Math.floor(t)?(e.a=t/4294967296|0,e.b=0|t):n+=t;for(var r=0;r>>0)/4294967296};return a.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},a.int32=n.next,a.quick=a,o&&("object"==typeof o&&i(o,n),a.state=function(){return i(n,{})}),a}e&&e.exports?e.exports=o:this.tychei=o}(0,t)})),Vu=Bu((function(t){!function(e,n){var r,i=this,o=256,a="random",s=n.pow(o,6),u=n.pow(2,52),c=2*u,l=o-1;function f(t,l,f){var g=[],v=d(function t(e,n){var r,i=[],o=typeof e;if(n&&"object"==o)for(r in e)try{i.push(t(e[r],n-1))}catch(t){}return i.length?i:"string"==o?e:e+"\0"}((l=1==l?{entropy:!0}:l||{}).entropy?[t,m(e)]:null==t?function(){try{var t;return r&&(t=r.randomBytes)?t=t(o):(t=new Uint8Array(o),(i.crypto||i.msCrypto).getRandomValues(t)),m(t)}catch(t){var n=i.navigator,a=n&&n.plugins;return[+new Date,i,a,i.screen,m(e)]}}():t,3),g),y=new h(g),b=function(){for(var t=y.g(6),e=s,n=0;t=c;)t/=2,e/=2,n>>>=1;return(t+n)/e};return b.int32=function(){return 0|y.g(4)},b.quick=function(){return y.g(4)/4294967296},b.double=b,d(m(y.S),e),(l.pass||f||function(t,e,r,i){return i&&(i.S&&p(i,y),t.state=function(){return p(y,{})}),r?(n[a]=t,e):t})(b,v,"global"in l?l.global:this==n,l.state)}function h(t){var e,n=t.length,r=this,i=0,a=r.i=r.j=0,s=r.S=[];for(n||(t=[n++]);i=1,(function(){return"Must pass at least one tensor to tf.addN(), but got "+t.length}));var e=t.map((function(t,e){return Un(t,"tensors"+e,"addN")})),n=e[0];e.forEach((function(t){if(t.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")})),e.forEach((function(t){if(!xt(t.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")}));var r=e;return _e.runKernelFunc((function(t,n){return t.addN(e)}),r,null,"AddN")}});function Gu(){Fn("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon")}function $u(t){return 0===t.rank||1===t.rank?t.as4D(1,1,1,t.size):2===t.rank?t.as4D(1,1,t.shape[0],t.shape[1]):3===t.rank?t.as4D(1,t.shape[0],t.shape[1],t.shape[2]):t}function Ku(t,e,n,r,i,o){null==o&&(o=.001);var a,s,u=Un(t,"x","batchNorm"),c=Un(e,"mean","batchNorm"),l=Un(n,"variance","batchNorm");null!=i&&(a=Un(i,"scale","batchNorm")),null!=r&&(s=Un(r,"offset","batchNorm")),mt(c.rank===l.rank,(function(){return"Batch normalization gradient requires mean and variance to have equal ranks."})),mt(null==s||c.rank===s.rank,(function(){return"Batch normalization gradient requires mean and offset to have equal ranks."})),mt(null==a||c.rank===a.rank,(function(){return"Batch normalization gradient requires mean and scale to have equal ranks."}));var f={x:u,scale:a,offset:s,mean:c,variance:l},h={varianceEpsilon:o};return _e.runKernelFunc((function(t,e){var n=$u(u),r=t.batchNormalization(n,Xu(c),Xu(l),o,Xu(a),Xu(s));return e([u,c,l,a]),r}),f,null,"FusedBatchNorm",h).reshape(u.shape)}function Xu(t){return null==t?null:0===t.rank?t.as1D():1===t.rank?t:2===t.rank?t.as4D(1,1,t.shape[0],t.shape[1]):3===t.rank?t.as4D(1,t.shape[0],t.shape[1],t.shape[2]):t}var Yu=tr({batchNormalization_:function(t,e,n,r,i,o){return void 0===r&&(r=.001),Gu(),Ku(t,e,n,o,i,r)}}),Ju=tr({batchNorm_:Ku});function Zu(t,e,n,r,i,o){var a,s,u=Un(t,"x","batchNorm"),c=Un(e,"mean","batchNorm"),l=Un(n,"variance","batchNorm");return null!=i&&(a=Un(i,"scale","batchNorm")),null!=r&&(s=Un(r,"offset","batchNorm")),mt(2===u.rank,(function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+u.rank+"."})),mt(2===c.rank||1===c.rank,(function(){return"Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank "+c.rank+"."})),mt(2===l.rank||1===l.rank,(function(){return"Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank "+l.rank+"."})),null!=a&&mt(2===a.rank||1===a.rank,(function(){return"Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank "+a.rank+"."})),null!=s&&mt(2===s.rank||1===s.rank,(function(){return"Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank "+s.rank+"."})),Ju(u,c,l,s,a,o)}var Qu=tr({batchNormalization2d_:function(t,e,n,r,i,o){return void 0===r&&(r=.001),Gu(),Zu(t,e,n,o,i,r)}}),tc=tr({batchNorm2d_:Zu});function ec(t,e,n,r,i,o){var a,s,u=Un(t,"x","batchNorm"),c=Un(e,"mean","batchNorm"),l=Un(n,"variance","batchNorm");return null!=i&&(a=Un(i,"scale","batchNorm")),null!=r&&(s=Un(r,"offset","batchNorm")),mt(3===u.rank,(function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+u.rank+"."})),mt(3===c.rank||1===c.rank,(function(){return"Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank "+c.rank+"."})),mt(3===l.rank||1===l.rank,(function(){return"Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank "+l.rank+"."})),null!=a&&mt(3===a.rank||1===a.rank,(function(){return"Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank "+a.rank+"."})),null!=s&&mt(3===s.rank||1===s.rank,(function(){return"Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank "+s.rank+"."})),Ju(u,c,l,s,a,o)}var nc=tr({batchNormalization3d_:function(t,e,n,r,i,o){return void 0===r&&(r=.001),Gu(),ec(t,e,n,o,i,r)}}),rc=tr({batchNorm3d_:ec});function ic(t,e,n,r,i,o){var a,s,u=Un(t,"x","batchNorm"),c=Un(e,"mean","batchNorm"),l=Un(n,"variance","batchNorm");return null!=i&&(a=Un(i,"scale","batchNorm")),null!=r&&(s=Un(r,"offset","batchNorm")),mt(4===u.rank,(function(){return"Error in batchNorm4D: x must be rank 4 but got rank "+u.rank+"."})),mt(4===c.rank||1===c.rank,(function(){return"Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank "+c.rank+"."})),mt(4===l.rank||1===l.rank,(function(){return"Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank "+l.rank+"."})),null!=a&&mt(4===a.rank||1===a.rank,(function(){return"Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank "+a.rank+"."})),null!=s&&mt(4===s.rank||1===s.rank,(function(){return"Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank "+s.rank+"."})),Ju(u,c,l,s,a,o)}var oc=tr({batchNormalization4d_:function(t,e,n,r,i,o){return void 0===r&&(r=.001),Gu(),ic(t,e,n,o,i,r)}}),ac=tr({batchNorm4d_:ic}),sc=tr({broadcastTo_:function(t,e){var n=Un(t,"broadcastTo","x"),r=n.shape;if(e.some((function(t){return!(t>0)||t%1!=0})))throw new Error("broadcastTo(): Invalid broadcast shape ["+e+"].");if(e.lengthn.rank){for(var i=n.shape.slice();i.length=0;s--)if(o[s]===e[s])a[s]=1;else if(1!==n.shape[s])throw new Error("broadcastTo(): ["+r+"] cannot be broadcast to ["+e+"].");var u=a.map((function(t,e){return t>1?e:-1})).filter((function(t){return t>=0}));if(0===u.length)return n.clone();var c={x:n},l={shape:e,inputShape:o};return _e.runKernelFunc((function(t){return t.tile(n,a)}),c,(function(t){return{x:function(){return t.sum(u,!0)}}}),qr,l)}}),uc=tr({clone_:function(t){var e=Un(t,"x","clone",null);return _e.runKernelFunc((function(){return _e.makeTensorFromDataId(e.dataId,e.shape,e.dtype)}),{x:e},null,Gr)}}),cc=tr({logicalAnd_:function(t,e){var n=Un(t,"a","logicalAnd","bool"),r=Un(e,"b","logicalAnd","bool");return Zr(n.shape,r.shape),_e.runKernelFunc((function(t){return t.logicalAnd(n,r)}),{a:n,b:r},null,"LogicalAnd")}}),lc=tr({logicalNot_:function(t){var e=Un(t,"x","logicalNot","bool");return _e.runKernelFunc((function(t){return t.logicalNot(e)}),{$x:e})}}),fc=tr({logicalOr_:function(t,e){var n=Un(t,"a","logicalOr","bool"),r=Un(e,"b","logicalOr","bool");return Zr(n.shape,r.shape),_e.runKernelFunc((function(t){return t.logicalOr(n,r)}),{$a:n,$b:r})}}),hc=tr({logicalXor_:function(t,e){var n=Un(t,"a","logicalXor","bool"),r=Un(e,"b","logicalXor","bool");return Zr(n.shape,r.shape),fc(t,e).logicalAnd(cc(t,e).logicalNot())}}),pc=tr({where_:function(t,e,n){var r=Un(e,"a","where"),i=Un(n,"b","where"),o=Un(t,"condition","where","bool");return gt(r.shape,i.shape,"Error in where: "),1===o.rank?mt(o.shape[0]===r.shape[0],(function(){return"The first dimension of `a` must match the size of `condition`."})):gt(o.shape,i.shape,"Error in where: "),_e.runKernelFunc((function(t,e){var n=t.select(o,r,i);return e([o]),n}),{$condition:o,$a:r,$b:i},(function(t,e){var n=e[0];return{$condition:function(){return yr(n).toFloat()},$a:function(){return t.mul(n.cast(t.dtype))},$b:function(){return t.mul(n.logicalNot().cast(t.dtype))}}}))}}),dc=function(t){return Z(this,void 0,void 0,(function(){var e,n,r;return Q(this,(function(i){switch(i.label){case 0:return[4,(e=Un(t,"condition","whereAsync","bool")).data()];case 1:return n=i.sent(),r=$o(e.shape,n),t!==e&&e.dispose(),[2,r]}}))}))},mc=tr({divNoNan_:function(t,e){var n,r=Un(t,"a","div"),i=Un(e,"b","div");r=(n=we(r,i))[0],i=n[1];var o=Yi(r,i),a=yr(o),s=i.equal(a);return pc(s,a,o)}}),gc=tr({tile_:function(t,e){var n=Un(t,"x","tile",null);mt(n.rank===e.length,(function(){return"Error in transpose: rank of input "+n.rank+" must match length of reps "+e+"."}));var r=[n],i={x:n},o={reps:e};return _e.runKernelFunc((function(t,r){var i=t.tile(n,e);return r([n]),i}),i,null,$r,o,r)}}),vc=tr({eye_:function(t,e,n,r){void 0===r&&(r="float32"),null==e&&(e=t);for(var i=Sr([t,e],r),o=t<=e?t:e,a=0;a2)throw new Error("Rank of probabilities must be 1 or 2, but is "+a);n=n||Math.random();var s=1===a?i.as2D(1,-1):i,u=_e.runKernelFunc((function(t){return t.multinomial(s,r,e,n)}),{logits2D:s});return 1===a?u.as1D():u}}),bc=tr({oneHot_:function(t,e,n,r){if(void 0===n&&(n=1),void 0===r&&(r=0),e<2)throw new Error("Error in oneHot: depth must be >=2, but it is "+e);var i=Un(t,"indices","oneHot","int32"),o=i.shape.concat([e]),a={indices:i=i.flatten()},s={depth:e,onValue:n,offValue:r};return _e.runKernelFunc((function(t,o){return o([i]),t.oneHot(i,e,n,r)}),a,null,Hr,s).reshape(o)}}),xc=tr({pad_:function(t,e,n){void 0===n&&(n=0);var r=Un(t,"x","pad");if(0===r.rank)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");var i={paddings:e,constantValue:n},o={x:r};return _e.runKernelFunc((function(t,i){return i([r]),t.pad(r,e,n)}),o,null,Kr,i)}}),wc=tr({pad1d_:function(t,e,n){return void 0===n&&(n=0),mt(2===e.length,(function(){return"Invalid number of paddings. Must be length of 2."})),xc(t,[e],n)}}),kc=tr({pad2d_:function(t,e,n){return void 0===n&&(n=0),mt(2===e.length&&2===e[0].length&&2===e[1].length,(function(){return"Invalid number of paddings. Must be length of 2 each."})),xc(t,e,n)}}),Ec=tr({pad3d_:function(t,e,n){return void 0===n&&(n=0),mt(3===e.length&&2===e[0].length&&2===e[1].length&&2===e[2].length,(function(){return"Invalid number of paddings. Must be length of 2 each."})),xc(t,e,n)}}),Cc=tr({pad4d_:function(t,e,n){return void 0===n&&(n=0),mt(4===e.length&&2===e[0].length&&2===e[1].length&&2===e[2].length&&2===e[3].length,(function(){return"Invalid number of paddings. Must be length of 2 each."})),xc(t,e,n)}}),Sc=tr({rand_:function(t,e,n){var r=bt(t),i=null;if(null==n||"float32"===n)i=new Float32Array(r);else if("int32"===n)i=new Int32Array(r);else{if("bool"!==n)throw new Error("Unknown data type "+n);i=new Uint8Array(r)}for(var o=0;on)}Object.freeze({TEST_EPSILON_FLOAT16:.1,expectArraysClose:function(t,e,n){return null==n&&(n=Ac()),Oc(t,e,(function(t,e){return _c(t,e,n)}))},testEpsilon:Ac,expectPromiseToFail:function(t,e){t().then((function(){return e.fail()}),(function(){return e()}))},expectArraysEqual:function(t,e){var n="string"==typeof e||"number"==typeof e||"boolean"==typeof e?[e]:e;return zt(t)||zt(t[0])||zt(e)||zt(e[0])?Oc(t,n,(function(t,e){return t==e})):Oc(t,e,(function(t,e){return _c(t,e,0)}))},expectNumbersClose:function(t,e,n){if(null==n&&(n=Ac()),!_c(t,e,n))throw new Error("Numbers differ: actual === "+t+", expected === "+e)},expectValuesInRange:function(t,e,n){for(var r=0;rn)throw new Error("Value out of range:"+t[r]+" low: "+e+", high: "+n)},expectArrayBuffersEqual:function(t,e){expect(new Float32Array(t)).toEqual(new Float32Array(e))}});var Nc=function(){function t(t,e,n,r,i){this.mean=t,this.stdDev=e,this.dtype=n,this.nextVal=NaN,this.truncated=r,this.truncated&&(this.upper=this.mean+2*this.stdDev,this.lower=this.mean-2*this.stdDev);var o=i||Math.random();this.random=qu(o.toString())}return t.prototype.nextValue=function(){if(!isNaN(this.nextVal)){var t=this.nextVal;return this.nextVal=NaN,t}for(var e,n,r=!1;!r;){var i=void 0,o=void 0,a=void 0;do{a=(i=2*this.random()-1)*i+(o=2*this.random()-1)*o}while(a>=1||0===a);var s=Math.sqrt(-2*Math.log(a)/a);e=this.mean+this.stdDev*i*s,n=this.mean+this.stdDev*o*s,this.truncated&&!this.isValidTruncated(e)||(r=!0)}return this.truncated&&!this.isValidTruncated(n)||(this.nextVal=this.convertValue(n)),this.convertValue(e)},t.prototype.convertValue=function(t){return null==this.dtype||"float32"===this.dtype?t:Math.round(t)},t.prototype.isValidTruncated=function(t){return t<=this.upper&&t>=this.lower},t}(),Tc=function(){function t(t,e,n,r){this.alpha=t,this.beta=1/e,this.dtype=n;var i=r||Math.random();this.randu=qu(i.toString()),this.randn=new Nc(0,1,n,!1,this.randu()),this.d=t<1?t+2/3:t-1/3,this.c=1/Math.sqrt(9*this.d)}return t.prototype.nextValue=function(){for(var t,e,n,r,i,o;;){do{r=this.randn.nextValue(),o=1+this.c*r}while(o<=0);if(o*=o*o,e=1-.331*(t=r*r)*t,n=.5*t+this.d*(1-o+Math.log(o)),(i=this.randu())=2&&a.rank>=2&&o.rank===a.rank,(function(){return"Error in matMul: inputs must have the same rank of at least 2, got ranks "+o.rank+" and "+a.rank+"."})),mt(xt(f,h),(function(){return"Error in matMul: outer dimensions ("+f+") and ("+h+") of Tensors with shapes "+o.shape+" and "+a.shape+" must match."})),mt(s===u,(function(){return"Error in matMul: inner shapes ("+s+") and ("+u+") of Tensors with shapes "+o.shape+" and "+a.shape+" and transposeA="+n+" and transposeB="+r+" must match."}));var m=o.shape.slice(0,-2).concat([c,l]),g=n?o.as3D(p,s,c):o.as3D(p,c,s),v=r?a.as3D(d,l,u):a.as3D(d,u,l),y={transposeA:n,transposeB:r};return _e.runKernelFunc((function(t,e){var i=t.batchMatMul(g,v,n,r);return e([g,v]),i}),{a:g,b:v},(function(t,e){var i=e,o=i[0],a=i[1];return n||r?!n&&r?{a:function(){return t.matMul(a,!1,!1)},b:function(){return t.matMul(o,!0,!1)}}:n&&!r?{a:function(){return a.matMul(t,!1,!0)},b:function(){return o.matMul(t,!1,!1)}}:{a:function(){return a.matMul(t,!0,!0)},b:function(){return t.matMul(o,!0,!0)}}:{a:function(){return t.matMul(a,!1,!0)},b:function(){return o.matMul(t,!0,!1)}}}),"BatchMatMul",y).reshape(m)}}),ml=tr({dot_:function(t,e){var n=Un(t,"t1","dot"),r=Un(e,"t2","dot");mt(!(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 "+n.rank+" and "+r.rank+"."}));var i=1===n.rank?n.size:n.shape[1],o=1===r.rank?r.size:r.shape[0];return mt(i===o,(function(){return"Error in dot: inner dimensions of inputs must match, but got "+i+" and "+o+"."})),1===n.rank&&1===r.rank?n.as2D(1,-1).matMul(r.as2D(-1,1)).asScalar():1===n.rank&&2===r.rank?n.as2D(1,-1).matMul(r.as2D(r.shape[0],r.shape[1])).as1D():2===n.rank&&1===r.rank?n.matMul(r.as2D(-1,1)).as1D():n.matMul(r.as2D(r.shape[0],r.shape[1]))}}),gl=tr({outerProduct_:function(t,e){var n=Un(t,"v1","outerProduct"),r=Un(e,"v2","outerProduct");return mt(1===n.rank&&1===r.rank,(function(){return"Error in outerProduct: inputs must be rank 1, but got ranks "+n.rank+" and "+r.rank+"."})),n.as2D(-1,1).matMul(r.as2D(1,-1))}}),vl=tr({reverse_:function(t,e){var n=Un(t,"x","reverse");if(0===n.rank)return n.clone();var r=Ot(e,n.shape);return _e.runKernelFunc((function(t){return t.reverse(n,r)}),{$x:n},(function(t){return{$x:function(){return t.reverse(r)}}})).reshapeAs(n)}}),yl=tr({reverse1d_:function(t){var e=Un(t,"x","reverse");return mt(1===e.rank,(function(){return"Error in reverse1D: x must be rank 1 but got rank "+e.rank+"."})),vl(e,0)}}),bl=tr({reverse2d_:function(t,e){var n=Un(t,"x","reverse");return mt(2===n.rank,(function(){return"Error in reverse2D: x must be rank 2 but got rank "+n.rank+"."})),vl(n,e)}}),xl=tr({reverse3d_:function(t,e){var n=Un(t,"x","reverse");return mt(3===n.rank,(function(){return"Error in reverse3D: x must be rank 3 but got rank "+n.rank+"."})),vl(n,e)}}),wl=tr({reverse4d_:function(t,e){var n=Un(t,"x","reverse");return mt(4===n.rank,(function(){return"Error in reverse4D: x must be rank 4 but got rank "+n.rank+"."})),vl(n,e)}});function kl(t,e,n,r,i,o){var a=Un(t,"x","maxPool"),s=a,u=!1;3===a.rank&&(u=!0,s=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),null==r&&(r=[1,1]),mt(4===s.rank,(function(){return"Error in maxPool: input must be rank 4 but got rank "+s.rank+"."})),mt(Oo(n,r),(function(){return"Error in maxPool: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+r+"'"})),null!=o&&mt(wt(i),(function(){return"Error in maxPool: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+i+"."}));var c=vo(s.shape,e,n,r,i,o);if(1===c.filterWidth&&1===c.filterHeight&&xt(c.inShape,c.outShape))return a.clone();var l=[s],f=_e.runKernelFunc((function(t,e){var n=t.maxPool(s,c);return e([s,n]),n}),{x:s},(function(t,o){var a=o[0],s=o[1];return{x:function(){return function(t,e,n,r,i,o,a,s){var u=Un(t,"dy","maxPoolBackprop"),c=Un(e,"input","maxPoolBackprop"),l=Un(n,"output","maxPoolBackprop");mt(c.rank===u.rank,(function(){return"Rank of input ("+c.rank+") does not match rank of dy ("+u.rank+")"})),null==o&&(o=[1,1]),mt(Oo(i,o),(function(){return"Error in maxPoolBackProp: Either strides or dilations must be 1. Got strides "+i+" and dilations '"+o+"'"})),mt(4===u.rank,(function(){return"Error in maxPoolBackprop: dy must be rank 4 but got rank "+u.rank+"."})),mt(4===c.rank,(function(){return"Error in maxPoolBackprop: input must be rank 4 but got rank "+c.rank+"."}));var f=vo(c.shape,r,i,o,a,s);return _e.runKernelFunc((function(t){return t.maxPoolBackprop(u,c,l,f)}),{$dy:u,$input:c})}(t,a,s,e,n,r,i)}}}),"MaxPool",c,l);return u?f.as3D(f.shape[1],f.shape[2],f.shape[3]):f}function El(t,e,n,r,i,o){var a=Un(t,"x","avgPool","float32");null==r&&(r=[1,1]),mt(Oo(n,r),(function(){return"Error in avgPool: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+r+"'"}));var s=a,u=!1;3===a.rank&&(u=!0,s=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),mt(4===s.rank,(function(){return"Error in avgPool: x must be rank 4 but got rank "+s.rank+"."})),null!=o&&mt(wt(i),(function(){return"Error in avgPool: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+i+"."}));var c=vo(s.shape,e,n,r,i,o);if(1===c.filterWidth&&1===c.filterHeight&&xt(c.inShape,c.outShape))return a.clone();var l=_e.runKernelFunc((function(t){return t.avgPool(s,c)}),{x:s},(function(t){return{x:function(){return function(t,e,n,r,i,o){var a=Un(t,"dy","avgPoolBackprop"),s=Un(e,"input","avgPoolBackprop");mt(s.rank===a.rank,(function(){return"Rank of input ("+s.rank+") does not match rank of dy ("+a.rank+")"})),null==i&&(i=[1,1]),mt(Oo(r,i),(function(){return"Error in avgPoolBackprop: Either strides or dilations must be 1. Got strides "+r+" and dilations '"+i+"'"}));var u=s,c=a,l=!1;3===s.rank&&(l=!0,u=s.as4D(1,s.shape[0],s.shape[1],s.shape[2]),c=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),mt(4===c.rank,(function(){return"Error in avgPoolBackprop: dy must be rank 4 but got rank "+c.rank+"."})),mt(4===u.rank,(function(){return"Error in avgPoolBackprop: input must be rank 4 but got rank "+u.rank+"."}));var f=vo(u.shape,n,r,i,o),h=_e.runKernelFunc((function(t){return t.avgPoolBackprop(c,u,f)}),{dy4D:c,input4D:u});return l?h.as3D(h.shape[1],h.shape[2],h.shape[3]):h}(t,s,e,n,r,i)}}}),"AvgPool",c);return l=l.cast(a.dtype),u?l.as3D(l.shape[1],l.shape[2],l.shape[3]):l}var Cl=tr({maxPool_:function(t,e,n,r,i){return kl(t,e,n,1,r,i)}}),Sl=tr({avgPool_:function(t,e,n,r,i){return El(t,e,n,1,r,i)}}),Al=tr({pool_:function(t,e,n,r,i,o){null==i&&(i=[1,1]),null==o&&(o=1),0===r&&(r="valid");var a=Un(t,"x","maxPool"),s=a,u=!1;3===a.rank&&(u=!0,s=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),mt(Oo(o,i),(function(){return"Error in pool: Either strides or dilations must be 1. Got strides "+o+" and dilations '"+i+"'"}));var c,l=vo(s.shape,e,o,i,r),f=[l.dilationHeight,l.dilationWidth];c="same"===r?function(t,e){var n=t.map((function(t,n){return t+(t-1)*(e[n]-1)})).map((function(t){return t-1})),r=n.map((function(t){return Math.floor(t/2)})),i=n.map((function(t,e){return t-r[e]}));return n.map((function(t,e){return[r[e],i[e]]}))}([l.filterHeight,l.filterWidth],f):[[0,0],[0,0]];var h=1===f[0]&&1===f[1],p=function(t,e,n){var r=n.map((function(t){return t[0]})),i=n.map((function(t){return t[1]})),o=t.concat(r,i),a=e.map((function(t,e){return(t-o[e]%t)%t})),s=i.map((function(t,e){return t+a[e]}));return[e.map((function(t,e){return[r[e],s[e]]})),e.map((function(t,e){return[0,a[e]]}))]}([l.inHeight,l.inWidth],f,c),d=p[0],m=p[1],g=h?r:"valid",v=h?s:Ir(s,f,d),y=("avg"===n?function(){return El(v,e,o,1,g)}:function(){return kl(v,e,o,1,g)})(),b=h?y:Ar(y,f,m);return u?b.as3D(b.shape[1],b.shape[2],b.shape[3]):b}}),Ol=tr({maxPool3d_:function(t,e,n,r,i,o,a){void 0===o&&(o="NDHWC");var s=Un(t,"x","maxPool3d"),u=s,c=!1;4===s.rank&&(c=!0,u=s.as5D(1,s.shape[0],s.shape[1],s.shape[2],s.shape[3])),null==a&&(a=[1,1,1]),mt(5===u.rank,(function(){return"Error in maxPool3d: x must be rank 5 but got rank "+u.rank+"."})),mt("NDHWC"===o,(function(){return"Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of "+o})),mt(Oo(n,a),(function(){return"Error in maxPool3d: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+a+"'"})),null!=i&&mt(wt(r),(function(){return"Error in maxPool3d: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+r+"."}));var l=yo(u.shape,e,n,a,r,i,o),f=_e.runKernelFunc((function(t,e){var n=t.maxPool3d(u,l);return e([u,n]),n}),{x:u},(function(t,o){var s=o[0],u=o[1];return{x:function(){return function(t,e,n,r,i,o,a,s){var u=Un(t,"dy","maxPool3dBackprop"),c=Un(e,"input","maxPool3dBackprop"),l=Un(n,"output","maxPool3dBackprop"),f=u,h=c,p=l,d=!1;4===c.rank&&(d=!0,f=u.as5D(1,u.shape[0],u.shape[1],u.shape[2],u.shape[3]),h=c.as5D(1,c.shape[0],c.shape[1],c.shape[2],c.shape[3]),p=l.as5D(1,l.shape[0],l.shape[1],l.shape[2],l.shape[3])),mt(5===f.rank,(function(){return"Error in maxPool3dBackprop: dy must be rank 5 but got rank "+f.rank+"."})),mt(5===h.rank,(function(){return"Error in maxPool3dBackprop: input must be rank 5 but got rank "+h.rank+"."})),mt(5===p.rank,(function(){return"Error in maxPool3dBackprop: output must be rank 5 but got rank "+p.rank+"."})),null==o&&(o=[1,1,1]),mt(Oo(i,o),(function(){return"Error in maxPool3dBackprop: Either strides or dilations must be 1. Got strides "+i+" and dilations '"+o+"'"})),null!=s&&mt(wt(a),(function(){return"Error in maxPool3dBackprop: pad must be an integer when using, dimRoundingMode "+s+" but got pad "+a+"."}));var m=yo(h.shape,r,i,o,a,s),g=_e.runKernelFunc((function(t){return t.maxPool3dBackprop(f,h,p,m)}),{dy5D:f,input5D:h});return d?g.as4D(g.shape[1],g.shape[2],g.shape[3],g.shape[4]):g}(t,s,u,e,n,a,r,i)}}}));return c?f.as4D(f.shape[1],f.shape[2],f.shape[3],f.shape[4]):f}}),_l=tr({avgPool3d_:function(t,e,n,r,i,o,a){void 0===o&&(o="NDHWC");var s=Un(t,"x","avgPool3d","float32"),u=s,c=!1;4===s.rank&&(c=!0,u=s.as5D(1,s.shape[0],s.shape[1],s.shape[2],s.shape[3])),null==a&&(a=[1,1,1]),mt(5===u.rank,(function(){return"Error in avgPool3d: x must be rank 5 but got rank "+u.rank+"."})),mt("NDHWC"===o,(function(){return"Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of "+o})),mt(Oo(n,a),(function(){return"Error in avgPool3d: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+a+"'"})),null!=i&&mt(wt(r),(function(){return"Error in avgPool3d: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+r+"."}));var l=yo(u.shape,e,n,a,r,i,o),f=_e.runKernelFunc((function(t){return t.avgPool3d(u,l)}),{x:u},(function(t){return{x:function(){return function(t,e,n,r,i,o,a){var s=Un(t,"dy","avgPool3dBackprop"),u=Un(e,"input","avgPool3dBackprop"),c=s,l=u,f=!1;4===u.rank&&(f=!0,c=s.as5D(1,s.shape[0],s.shape[1],s.shape[2],s.shape[3]),l=u.as5D(1,u.shape[0],u.shape[1],u.shape[2],u.shape[3])),mt(5===c.rank,(function(){return"Error in avgPool3dBackprop: dy must be rank 5 but got rank "+c.rank+"."})),mt(5===l.rank,(function(){return"Error in avgPool3dBackprop: input must be rank 5 but got rank "+l.rank+"."})),null==i&&(i=[1,1,1]),mt(Oo(r,i),(function(){return"Error in avgPool3dBackprop: Either strides or dilations must be 1. Got strides "+r+" and dilations '"+i+"'"})),null!=a&&mt(wt(o),(function(){return"Error in maxPool3dBackprop: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+o+"."}));var h=yo(l.shape,n,r,i,o,a),p=_e.runKernelFunc((function(t){return t.avgPool3dBackprop(c,l,h)}),{dy5D:c,input5D:l});return f?p.as4D(p.shape[1],p.shape[2],p.shape[3],p.shape[4]):p}(t,u,e,n,a,r,i)}}}));return f=f.cast(u.dtype),c?f.as4D(f.shape[1],f.shape[2],f.shape[3],f.shape[4]):f}}),Nl=tr({maxPoolWithArgmax_:function(t,e,n,r,i){void 0===i&&(i=!1);var o=Un(t,"x","maxPoolWithArgmax"),a={filterSize:e,strides:n,pad:r,includeBatchInIndex:i},s=_e.runKernel("MaxPoolWithArgmax",{x:o},a);return{result:s[0],indexes:s[1]}}}),Tl=tr({slice_:function(t,e,n){var r,i,o=Un(t,"x","slice");if(0===o.rank)throw new Error("Slicing scalar is not possible");(r="number"==typeof e?[e].concat(new Array(o.rank-1).fill(0)):e.length=0?t:(mt(-1===t,(function(){return"Negative size values should be exactly -1 but got "+t+" for the slice() size at index "+e+"."})),o.shape[e]-r[e])})),no(o,r,i);var a=o.shape,s={begin:r,size:i};return _e.runKernelFunc((function(t){return t.slice(o,r,i)}),{x:o},(function(t){for(var e=[],n=0;n0&&(e=e.sum(o)),e.reshape(r.shape)}}}),"Prelu")}}),Yl=tr({relu_:function(t){var e=Un(t,"x","relu");return"bool"===e.dtype?e.toInt():_e.runKernelFunc((function(t,n){var r=t.relu(e);return n([e]),r}),{x:e},(function(t,e){var n=e[0];return{x:function(){return t.mulStrict(n.step().toFloat())}}}),"Relu")}}),Jl=tr({relu6_:function(t){var e=Un(t,"x","relu6");return"bool"===e.dtype?e.toInt():_e.runKernelFunc((function(t,n){var r=t.relu6(e);return n([e]),r}),{x:e},(function(t,e){var n=e[0],r=n.lessEqual(6).mul(n.step());return{x:function(){return t.mulStrict(r.toFloat())}}}),"Relu6")}}),Zl=tr({selu_:function(t){var e=Un(t,"x","selu");return _e.runKernelFunc((function(t,n){var r=t.selu(e);return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){var e=n.greater(ar(0)),r=ar(ou),i=ar(au),o=t.mul(i),a=t.mul(r).mul(n.toFloat().exp());return pc(e,o,a)}}}))}}),Ql=tr({localResponseNormalization_:function(t,e,n,r,i){void 0===e&&(e=5),void 0===n&&(n=1),void 0===r&&(r=1),void 0===i&&(i=.5);var o=Un(t,"x","localResponseNormalization");mt(4===o.rank||3===o.rank,(function(){return"Error in localResponseNormalization: x must be rank 3 or 4 but got\n rank "+o.rank+"."})),mt(wt(e),(function(){return"Error in localResponseNormalization: depthRadius must be an integer but got depthRadius "+e+"."}));var a=o,s=!1;3===o.rank&&(s=!0,a=o.as4D(1,o.shape[0],o.shape[1],o.shape[2]));var u=_e.runKernelFunc((function(t,o){var s=t.localResponseNormalization4D(a,e,n,r,i);return o([a,s]),s}),{x4D:a},(function(t,o){var a=o[0],s=o[1];return{x4D:function(){return _e.runKernelFunc((function(o){return o.LRNGrad(t,a,s,e,n,r,i)}),{})}}}));return s?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),tf=tr({norm_:function(t,e,n,r){void 0===e&&(e="euclidean"),void 0===n&&(n=null),void 0===r&&(r=!1);var i=function t(e,n,r){if(void 0===r&&(r=null),0===e.rank)return e.abs();if(1!==e.rank&&null===r)return t(e.reshape([-1]),n,r);if(1===e.rank||"number"==typeof r||Array.isArray(r)&&1===r.length){if(1===n)return e.abs().sum(r);if(n===1/0)return e.abs().max(r);if(n===-1/0)return e.abs().min(r);if("euclidean"===n||2===n)return e.abs().pow(ar(2,"int32")).sum(r).sqrt();throw new Error("Error in norm: invalid ord value: "+n)}if(Array.isArray(r)&&2===r.length){if(1===n)return e.abs().sum(r[0]).max(r[1]-1);if(n===1/0)return e.abs().sum(r[1]).max(r[0]);if(n===-1/0)return e.abs().sum(r[1]).min(r[0]);if("fro"===n||"euclidean"===n)return e.square().sum(r).sqrt();throw new Error("Error in norm: invalid ord value: "+n)}throw new Error("Error in norm: invalid axis: "+r)}(t=Un(t,"x","norm"),e,n),o=i.shape;if(r){var a=Ot(n,t.shape);o=$n(i.shape,a)}return i.reshape(o)}}),ef=tr({basicLSTMCell_:function(t,e,n,r,i,o){var a=Un(t,"forgetBias","basicLSTMCell"),s=Un(e,"lstmKernel","basicLSTMCell"),u=Un(n,"lstmBias","basicLSTMCell"),c=Un(r,"data","basicLSTMCell"),l=Un(i,"c","basicLSTMCell"),f=Un(o,"h","basicLSTMCell"),h=c.concat(f,1).matMul(s).add(u),p=h.shape[0],d=h.shape[1]/4,m=[p,d],g=h.slice([0,0],m),v=h.slice([0,d],m),y=h.slice([0,2*d],m),b=h.slice([0,3*d],m),x=g.sigmoid().mulStrict(v.tanh()).addStrict(l.mulStrict(a.add(y).sigmoid())),w=x.tanh().mulStrict(b.sigmoid());return[x,w]}}),nf=tr({multiRNNCell_:function(t,e,n,r){for(var i=Un(e,"data","multiRNNCell"),o=Vn(n,"c","multiRNNCell"),a=Vn(r,"h","multiRNNCell"),s=i,u=[],c=0;ci)throw new Error("'k' passed to topk() must be <= the last dimension ("+i+") but got "+e);var o=_e.runKernelFunc((function(t){return t.topk(r,e,n)}),{$x:r});return{values:o[0],indices:o[1]}}}),sf=tr({scatterND_:function(t,e,n){var r=Un(t,"indices","scatterND","int32"),i=Un(e,"updates","scatterND");return to(i,r,n),_e.runKernelFunc((function(t){return t.scatterND(r,i,n)}),{indices:r,updates:i},null,"ScatterNd",{shape:n})}}),uf=tr({fft_:function(t){mt("complex64"===t.dtype,(function(){return"The dtype for tf.spectral.fft() must be complex64 but got "+t.dtype+"."}));var e=t.shape[t.shape.length-1],n=t.size/e,r=t.as2D(n,e);return _e.runKernelFunc((function(t){return t.fft(r)}),{input:t}).reshape(t.shape)}}),cf=tr({ifft_:function(t){mt("complex64"===t.dtype,(function(){return"The dtype for tf.spectral.ifft() must be complex64 but got "+t.dtype+"."}));var e=t.shape[t.shape.length-1],n=t.size/e,r=t.as2D(n,e);return _e.runKernelFunc((function(t){return t.ifft(r)}),{input:t}).reshape(t.shape)}}),lf=tr({rfft_:function(t,e){mt("float32"===t.dtype,(function(){return"The dtype for rfft() must be real value but got "+t.dtype}));var n,r=t.shape[t.shape.length-1],i=t.size/r;if(null!=e&&er){var s=t.shape.map((function(t){return t}));s[t.shape.length-1]=e-r,n=t.concat(pr(s),t.shape.length-1),r=e}else n=t;var u=n.zerosLike(),c=er(n,u).as2D(i,r),l=uf(c),f=Math.floor(r/2)+1,h=nr(l),p=rr(l),d=h.split([f,r-f],h.shape.length-1),m=p.split([f,r-f],p.shape.length-1),g=n.shape.slice();return g[n.shape.length-1]=f,er(d[0],m[0]).reshape(g)}}),ff=tr({irfft_:function(t){var e=t.shape[t.shape.length-1],n=t.size/e;if(e<=2){var r=t.as2D(n,e),i=cf(r);return nr(i)}var o=[n,2*(e-1)],a=nr(t).as2D(n,e),s=rr(t).as2D(n,e),u=a.slice([0,1],[n,e-2]).reverse(1),c=s.slice([0,1],[n,e-2]).reverse(1).mul(ar(-1)),l=a.concat(u,1),f=s.concat(c,1);return r=er(l,f).as2D(o[0],o[1]),i=cf(r),nr(i)}}),hf=Object.freeze({fft:uf,ifft:cf,rfft:lf,irfft:ff}),pf=tr({sparseToDense_:function(t,e,n,r){void 0===r&&(r=0);var i=Un(t,"sparseIndices","sparseToDense","int32"),o=Un(e,"sparseValues","sparseToDense"),a=Un(r,"defaultValue","sparseToDense",o.dtype);return function(t,e,n,r){if("int32"!==t.dtype)throw new Error("tf.sparseToDense() expects the indices to be int32 type, but the dtype was "+t.dtype+".");if(t.rank>2)throw new Error("sparseIndices should be a scalar, vector, or matrix, but got shape "+t.shape+".");var i=t.rank>0?t.shape[0]:1,o=t.rank>1?t.shape[1]:1;if(n.length!==o)throw new Error("outputShape has incorrect number of elements:, "+n.length+", should be: "+o+".");var a=e.size;if(0!==e.rank&&(1!==e.rank||a!==i))throw new Error("sparseValues has incorrect shape "+e.shape+", should be [] or ["+i+"]");if(e.dtype!==r.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}(i,o,n,a),_e.runKernelFunc((function(t){return t.sparseToDense(i,o,n,a)}),{$sparseIndices:i,$sparseValues:o,$defaultValue:a})}}),df=tr({gatherND_:function(t,e){var n=Un(e,"indices","gatherND","int32"),r=Un(t,"x","gatherND");return _e.runKernelFunc((function(t){return t.gatherND(r,n)}),{x:r,indices:n},null,"GatherNd")}}),mf=tr({diag_:function(t){var e=Un(t,"x","diag").flatten(),n=t.shape.concat(t.shape);return _e.runKernelFunc((function(t){return t.diag(e)}),{$x:e}).reshape(n)}}),gf=tr({dropout_:function(t,e,n,r){var i=Un(t,"x","dropout");if(mt("float32"===i.dtype,(function(){return"x has to be a floating point tensor since it's going to be scaled, but got a "+i.dtype+" tensor instead."})),mt(e>=0&&e<1,(function(){return"rate must be a float in the range [0, 1), but got "+e+"."})),0===e)return t instanceof fe?i.clone():i;var o=function(t,e){if(null==e)return t.shape.slice();if(xt(t.shape,e))return e;if(t.shape.length===e.length){for(var n=[],r=0;r1?s.div(ar(a)):s}if(n===yf.SUM_BY_NONZERO_WEIGHTS){if(null==i)return o.sum().div(ar(r.size));var u=i.mul(hr(r.shape)).notEqual(ar(0)).sum().toFloat();return o.sum().div(u)}throw Error("Unknown reduction: "+n)}}),Af=tr({cosineDistance_:function(t,e,n,r,i){void 0===i&&(i=yf.SUM_BY_NONZERO_WEIGHTS);var o=Un(t,"labels","cosineDistance"),a=Un(e,"predictions","cosineDistance"),s=null;null!=r&&(s=Un(r,"weights","cosineDistance")),gt(o.shape,a.shape,"Error in cosineDistance: ");var u=ar(1).sub(o.mul(a).sum(n,!0));return Sf(u,s,i)}}),Of=tr({hingeLoss_:function(t,e,n,r){void 0===r&&(r=yf.SUM_BY_NONZERO_WEIGHTS);var i=Un(t,"labels","hingeLoss"),o=Un(e,"predictions","hingeLoss"),a=null;null!=n&&(a=Un(n,"weights","hingeLoss")),gt(i.shape,o.shape,"Error in hingeLoss: ");var s=ar(1);i=ar(2).mul(i).sub(s);var u=s.sub(i.mul(o)).relu();return Sf(u,a,r)}}),_f=tr({huberLoss_:function(t,e,n,r,i){void 0===r&&(r=1),void 0===i&&(i=yf.SUM_BY_NONZERO_WEIGHTS);var o=Un(t,"labels","huberLoss"),a=Un(e,"predictions","huberLoss"),s=null;null!=n&&(s=Un(n,"weights","huberLoss")),gt(o.shape,a.shape,"Error in huberLoss: ");var u=ar(r),c=a.sub(o).abs(),l=Pi(c,u),f=c.sub(l),h=ar(.5).mul(l.square()).add(u.mul(f));return Sf(h,s,i)}}),Nf=tr({logLoss_:function(t,e,n,r,i){void 0===r&&(r=1e-7),void 0===i&&(i=yf.SUM_BY_NONZERO_WEIGHTS);var o=Un(t,"labels","logLoss"),a=Un(e,"predictions","logLoss"),s=null;null!=n&&(s=Un(n,"weights","logLoss")),gt(o.shape,a.shape,"Error in logLoss: ");var u=ar(1),c=ar(r),l=o.mul(a.add(c).log()).neg().sub(u.sub(o).mul(u.sub(a).add(c).log()));return Sf(l,s,i)}}),Tf=tr({meanSquaredError_:function(t,e,n,r){void 0===r&&(r=yf.SUM_BY_NONZERO_WEIGHTS);var i=Un(t,"labels","meanSquaredError"),o=Un(e,"predictions","meanSquaredError"),a=null;null!=n&&(a=Un(n,"weights","meanSquaredError")),gt(i.shape,o.shape,"Error in meanSquaredError: ");var s=i.squaredDifference(o);return Sf(s,a,r)}}),Df=tr({sigmoidCrossEntropy_:function(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=yf.SUM_BY_NONZERO_WEIGHTS);var o=Un(t,"multiClassLabels","sigmoidCrossEntropy"),a=Un(e,"logits","sigmoidCrossEntropy"),s=null;if(null!=n&&(s=Un(n,"weights","sigmoidCrossEntropy")),gt(o.shape,a.shape,"Error in sigmoidCrossEntropy: "),r>0){var u=ar(r),c=ar(1),l=ar(.5);o=o.mul(c.sub(u)).add(l.mul(u))}var f=function(t,e){var n=Un(t,"labels","sigmoidCrossEntropyWithLogits"),r=Un(e,"logits","sigmoidCrossEntropyWithLogits");gt(n.shape,r.shape,"Error in sigmoidCrossEntropyWithLogits: ");var i=r.relu(),o=r.mul(n),a=r.abs().neg().exp().log1p();return i.sub(o).add(a)}(o,a);return Sf(f,s,i)}}),If=tr({softmaxCrossEntropy_:function(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=yf.SUM_BY_NONZERO_WEIGHTS);var o=Un(t,"onehotLabels","softmaxCrossEntropy"),a=Un(e,"logits","softmaxCrossEntropy"),s=null;if(null!=n&&(s=Un(n,"weights","softmaxCrossEntropy")),gt(o.shape,a.shape,"Error in softmaxCrossEntropy: "),r>0){var u=ar(r),c=ar(1),l=ar(o.shape[1]);o=o.mul(c.sub(u)).add(u.div(l))}var f=function(t,e,n){if(void 0===n&&(n=-1),-1===n&&(n=e.rank-1),n!==e.rank-1)throw Error("Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank "+e.rank+" and dim was "+n);return co((function(t,e,r){var i=e.logSumExp([n],!0),o=e.toFloat().sub(i);return r([t,o]),{value:o.mul(t).neg().sum([n]),gradFunc:function(t,e){var r=e[0],i=e[1],o=$n(t.shape,[n]);return[t.reshape(o).mul(r.toFloat().sub(i.exp())),t.reshape(o).mul(i.exp().sub(r.toFloat()))]}}}))(t,e)}(o,a);return Sf(f,s,i)}}),Rf=Object.freeze({get Reduction(){return yf},absoluteDifference:Cf,computeWeightedLoss:Sf,cosineDistance:Af,hingeLoss:Of,huberLoss:_f,logLoss:Nf,meanSquaredError:Tf,sigmoidCrossEntropy:Df,softmaxCrossEntropy:If});function Ff(t,e){return void 0===e&&(e=!1),_e.tidy((function(){if(2!==t.shape.length)throw new Error("qr2d() requires a 2D Tensor, but got a "+t.shape.length+"D Tensor.");for(var n=t.shape[0],r=t.shape[1],i=vc(n),o=t.clone(),a=ur([[1]],[1,1]),s=a.clone(),u=n>=r?r:n,c=function(t){var e,u=o,c=s,l=i;e=_e.tidy((function(){var e=o.slice([t,t],[n-t,1]),u=e.norm(),c=o.slice([t,t],[1,1]),l=ur([[-1]]).where(c.greater(0),ur([[1]])),f=c.sub(l.mul(u)),h=e.div(f);s=1===h.shape[0]?a.clone():a.concat(h.slice([1,0],[h.shape[0]-1,h.shape[1]]),0);var p=l.matMul(f).div(u).neg(),d=o.slice([t,0],[n-t,r]),m=p.mul(s),g=s.transpose();if(0===t)o=d.sub(m.matMul(g.matMul(d)));else{var v=d.sub(m.matMul(g.matMul(d)));o=o.slice([0,0],[t,r]).concat(v,0)}var y=m.transpose(),b=i.slice([0,t],[n,i.shape[1]-t]);if(0===t)i=b.sub(b.matMul(s).matMul(y));else{var x=b.sub(b.matMul(s).matMul(y));i=i.slice([0,0],[n,t]).concat(x,1)}return[s,o,i]})),s=e[0],o=e[1],i=e[2],zn([u,c,l])},l=0;lr&&(i=i.slice([0,0],[n,r]),o=o.slice([0,0],[r,r])),[i,o]}))}var Mf=tr({bandPart_:function(t,e,n){if(e%1!=0)throw new Error("bandPart(): numLower must be an integer, got "+e+".");if(n%1!=0)throw new Error("bandPart(): numUpper must be an integer, got "+n+".");var r=Un(t,"a","bandPart");if(r.rank<2)throw new Error("bandPart(): Rank must be at least 2, got "+r.rank+".");var i=r.shape,o=r.shape.slice(-2),a=o[0],s=o[1];if(!(e<=a))throw new Error("bandPart(): numLower ("+e+") must not be greater than the number of rows ("+a+").");if(!(n<=s))throw new Error("bandPart(): numUpper ("+n+") must not be greater than the number of columns ("+s+").");e<0&&(e=a),n<0&&(n=s);var u=gr(0,a,1,"int32").reshape([-1,1]),c=gr(0,s,1,"int32"),l=Ki(u,c),f=cc(l.lessEqual(ar(+e,"int32")),l.greaterEqual(ar(-n,"int32"))),h=pr([a,s],r.dtype);return Fr(Mr(r.reshape([-1,a,s])).map((function(t){return pc(f,t,h)}))).reshape(i)}}),Bf=tr({gramSchmidt_:function(t){var e;if(Array.isArray(t)){e=!1,mt(null!=t&&t.length>0,(function(){return"Gram-Schmidt process: input must not be null, undefined, or empty"}));for(var n=t[0].shape[0],r=function(e){mt(t[e].shape[0]===n,(function(){return"Gram-Schmidt: Non-unique lengths found in the input vectors: ("+t[e].shape[0]+" vs. "+n+")"}))},i=1;i0)for(var n=0;n= 2, but got rank "+t.rank);if(2===t.rank)return Ff(t,e);var n=t.shape.slice(0,t.shape.length-2).reduce((function(t,e){return t*e})),r=Mr(t.reshape([n,t.shape[t.shape.length-2],t.shape[t.shape.length-1]]),0),i=[],o=[];return r.forEach((function(t){var n=Ff(t,e),r=n[0],a=n[1];i.push(r),o.push(a)})),[Fr(i,0).reshape(t.shape),Fr(o,0).reshape(t.shape)]}}),jf=Object.freeze({bandPart:Mf,gramSchmidt:Bf,qr:zf});function Pf(t,e,n,r,i,o){null==r&&(r=.5),null==i&&(i=Number.NEGATIVE_INFINITY),null==o&&(o=0);var a=t.shape[0];return n=Math.min(n,a),mt(0<=r&&r<=1,(function(){return"iouThreshold must be in [0, 1], but was '"+r+"'"})),mt(2===t.rank,(function(){return"boxes must be a 2D tensor, but was of rank '"+t.rank+"'"})),mt(4===t.shape[1],(function(){return"boxes must have 4 columns, but 2nd dimension was "+t.shape[1]})),mt(1===e.rank,(function(){return"scores must be a 1D tensor"})),mt(e.shape[0]===a,(function(){return"scores has incompatible shape with boxes. Expected "+a+", but was "+e.shape[0]})),mt(0<=o&&o<=1,(function(){return"softNmsSigma must be in [0, 1], but was '"+o+"'"})),{maxOutputSize:n,iouThreshold:r,scoreThreshold:i,softNmsSigma:o}}var Lf=tr({resizeBilinear_:function(t,e,n){void 0===n&&(n=!1);var r=Un(t,"images","resizeBilinear");mt(3===r.rank||4===r.rank,(function(){return"Error in resizeBilinear: x must be rank 3 or 4, but got rank "+r.rank+"."})),mt(2===e.length,(function(){return"Error in resizeBilinear: new shape must 2D, but got shape "+e+"."}));var i=r,o=!1;3===r.rank&&(o=!0,i=r.as4D(1,r.shape[0],r.shape[1],r.shape[2]));var a=e[0],s=e[1],u=_e.runKernelFunc((function(t,e){return e([i]),t.resizeBilinear(i,a,s,n)}),{x:i},(function(t,e){return{x:function(){return _e.runKernelFunc((function(r){return r.resizeBilinearBackprop(t,e[0],n)}),{})}}}),"ResizeBilinear",{alignCorners:n,newHeight:a,newWidth:s});return o?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),Wf=tr({resizeNearestNeighbor_:function(t,e,n){void 0===n&&(n=!1);var r=Un(t,"images","resizeNearestNeighbor");mt(3===r.rank||4===r.rank,(function(){return"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank "+r.rank+"."})),mt(2===e.length,(function(){return"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+e+"."})),mt("float32"===r.dtype||"int32"===r.dtype,(function(){return"`images` must have `int32` or `float32` as dtype"}));var i=r,o=!1;3===r.rank&&(o=!0,i=r.as4D(1,r.shape[0],r.shape[1],r.shape[2]));var a=e[0],s=e[1],u=_e.runKernelFunc((function(t,e){return e([i]),t.resizeNearestNeighbor(i,a,s,n)}),{batchImages:i},(function(t,e){return{batchImages:function(){return _e.runKernelFunc((function(r){return r.resizeNearestNeighborBackprop(t,e[0],n)}),{})}}}));return o?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),Uf=tr({nonMaxSuppression_:function(t,e,n,r,i){void 0===r&&(r=.5),void 0===i&&(i=Number.NEGATIVE_INFINITY);var o=Un(t,"boxes","nonMaxSuppression"),a=Un(e,"scores","nonMaxSuppression"),s=Pf(o,a,n,r,i);n=s.maxOutputSize,r=s.iouThreshold,i=s.scoreThreshold;var u={maxOutputSize:n,iouThreshold:r,scoreThreshold:i};return _e.runKernelFunc((function(t){return t.nonMaxSuppression(o,a,n,r,i)}),{boxes:o,scores:a},null,"NonMaxSuppressionV3",u)}}),Vf=tr({nonMaxSuppressionWithScore_:function(t,e,n,r,i,o){void 0===r&&(r=.5),void 0===i&&(i=Number.NEGATIVE_INFINITY),void 0===o&&(o=0);var a=Un(t,"boxes","nonMaxSuppression"),s=Un(e,"scores","nonMaxSuppression"),u=Pf(a,s,n,r,i,o),c={maxOutputSize:n=u.maxOutputSize,iouThreshold:r=u.iouThreshold,scoreThreshold:i=u.scoreThreshold,softNmsSigma:o=u.softNmsSigma},l=_e.runKernel("NonMaxSuppressionV5",{boxes:a,scores:s},c);return{selectedIndices:l[0],selectedScores:l[1]}}}),qf=tr({cropAndResize_:function(t,e,n,r,i,o){var a=Un(t,"image","cropAndResize"),s=Un(e,"boxes","cropAndResize","float32"),u=Un(n,"boxInd","cropAndResize","int32");i=i||"bilinear",o=o||0;var c=s.shape[0];return mt(4===a.rank,(function(){return"Error in cropAndResize: image must be rank 4,but got rank "+a.rank+"."})),mt(2===s.rank&&4===s.shape[1],(function(){return"Error in cropAndResize: boxes must be have size ["+c+",4] but had shape "+s.shape+"."})),mt(1===u.rank&&u.shape[0]===c,(function(){return"Error in cropAndResize: boxInd must be have size ["+c+"] but had shape "+s.shape+"."})),mt(2===r.length,(function(){return"Error in cropAndResize: cropSize must be of length 2, but got length "+r.length+"."})),mt(r[0]>=1&&r[1]>=1,(function(){return"cropSize must be atleast [1,1], but was "+r})),mt("bilinear"===i||"nearest"===i,(function(){return"method must be bilinear or nearest, but was "+i})),_e.runKernelFunc((function(t,e){return t.cropAndResize(a,s,u,r,i,o)}),{images:a,boxes:s,boxInd:u},null,"CropAndResize",{method:i,extrapolationValue:o,cropSize:r})}}),Hf=Object.freeze({resizeBilinear:Lf,resizeNearestNeighbor:Wf,nonMaxSuppression:Uf,nonMaxSuppressionAsync:function(t,e,n,r,i){return void 0===r&&(r=.5),void 0===i&&(i=Number.NEGATIVE_INFINITY),Z(this,void 0,void 0,(function(){var o,a,s,u,c,l,f;return Q(this,(function(h){switch(h.label){case 0:return o=Un(t,"boxes","nonMaxSuppressionAsync"),a=Un(e,"scores","nonMaxSuppressionAsync"),s=Pf(o,a,n,r,i),n=s.maxOutputSize,r=s.iouThreshold,i=s.scoreThreshold,[4,Promise.all([o.data(),a.data()])];case 1:return u=h.sent(),c=u[0],l=u[1],f=jo(c,l,n,r,i),o!==t&&o.dispose(),a!==e&&a.dispose(),[2,f]}}))}))},nonMaxSuppressionWithScore:Vf,nonMaxSuppressionWithScoreAsync:function(t,e,n,r,i,o){return void 0===r&&(r=.5),void 0===i&&(i=Number.NEGATIVE_INFINITY),void 0===o&&(o=0),Z(this,void 0,void 0,(function(){var a,s,u,c,l,f,h;return Q(this,(function(p){switch(p.label){case 0:return a=Un(t,"boxes","nonMaxSuppressionAsync"),s=Un(e,"scores","nonMaxSuppressionAsync"),u=Pf(a,s,n,r,i,o),n=u.maxOutputSize,r=u.iouThreshold,i=u.scoreThreshold,o=u.softNmsSigma,[4,Promise.all([a.data(),s.data()])];case 1:return c=p.sent(),l=c[0],f=c[1],h=Po(l,f,n,r,i,o),a!==t&&a.dispose(),s!==e&&s.dispose(),[2,h]}}))}))},cropAndResize:qf}),Gf=function(t,e){return!(t>0)||"linear"===e},$f=function(t,e,n){if(null==n||"linear"===n)return t;if("relu"===n)return t.mul(e.step());throw new Error("Gradient for activation "+n+" has not been implemented yet.")},Kf=function(t,e){var n=e,r=Jr(t.shape,e.shape);return r.length>0&&(n=n.sum(r)),n.reshape(t.shape)},Xf=function(t,e,n){if("linear"===e)return t;if("relu"===e)return Yl(t);if("elu"===e)return $l(t);if("relu6"===e)return Jl(t);if("prelu"===e)return Xl(t,n);throw new Error("Unknown fused activation "+e+".")},Yf=tr({fusedMatMul_:function(t){var e,n=t.a,r=t.b,i=t.transposeA,o=void 0!==i&&i,a=t.transposeB,s=void 0!==a&&a,u=t.bias,c=t.activation,l=void 0===c?"linear":c,f=t.preluActivationWeights;if(!1===Gf(_e.state.gradientDepth,l)){var h=dl(n,r,o,s);return null!=u&&(h=Xr(h,u)),Xf(h,l,f)}var p=Un(n,"a","fused matMul"),d=Un(r,"b","fused matMul");e=we(p,d),p=e[0],d=e[1];var m=o?p.shape[p.rank-2]:p.shape[p.rank-1],g=s?d.shape[d.rank-1]:d.shape[d.rank-2],v=o?p.shape[p.rank-1]:p.shape[p.rank-2],y=s?d.shape[d.rank-2]:d.shape[d.rank-1],b=p.shape.slice(0,-2),x=d.shape.slice(0,-2),w=bt(b),k=bt(x);mt(p.rank>=2&&d.rank>=2&&p.rank===d.rank,(function(){return"Error in fused matMul: inputs must have the same rank of at least 2, got ranks "+p.rank+" and "+d.rank+"."})),mt(xt(b,x),(function(){return"Error in fused matMul: outer dimensions ("+b+") and ("+x+") of Tensors with shapes "+p.shape+" and "+d.shape+" must match."})),mt(m===g,(function(){return"Error in fused matMul: inner shapes ("+m+") and ("+g+") of Tensors with shapes "+p.shape+" and "+d.shape+" and transposeA="+o+" and transposeB="+s+" must match."}));var E,C,S=p.shape.slice(0,-2).concat([v,y]),A=o?p.as3D(w,m,v):p.as3D(w,v,m),O=s?d.as3D(k,y,g):d.as3D(k,g,y);null!=u&&Zr(S,(E=we(E=Un(u,"bias","fused matMul"),p)[0]).shape),null!=f&&(C=Un(f,"prelu weights","fused matMul"));var _={a:A,b:O};null!=u&&(_.bias=E),null!=f&&(_.preluActivationWeights=C);var N=[A,O];return _e.runKernelFunc((function(t,e){var n=t.fusedBatchMatMul({a:A,b:O,transposeA:o,transposeB:s,bias:E,activation:l,preluActivationWeights:C});return e([A,O,n]),n}),_,(function(t,e){var n=e[0],r=e[1],i=e[2],a=$f(t,i,l),c={};return null!=u&&(c={bias:function(){return Kf(E,a)}}),o||s?!o&&s?Object.assign({a:function(){return a.matMul(r,!1,!1)},b:function(){return a.matMul(n,!0,!1)}},c):o&&!s?Object.assign({a:function(){return r.matMul(a,!1,!0)},b:function(){return n.matMul(a,!1,!1)}},c):Object.assign({a:function(){return r.matMul(a,!0,!0)},b:function(){return a.matMul(n,!0,!0)}},c):Object.assign({a:function(){return a.matMul(r,!1,!0)},b:function(){return n.matMul(a,!0,!1)}},c)}),"_FusedMatMul",{transposeA:o,transposeB:s,activation:l},N,[!0]).reshape(S)}}),Jf=tr({fusedConv2d_:function(t){var e=t.x,n=t.filter,r=t.strides,i=t.pad,o=t.dataFormat,a=void 0===o?"NHWC":o,s=t.dilations,u=void 0===s?[1,1]:s,c=t.dimRoundingMode,l=t.bias,f=t.activation,h=void 0===f?"linear":f,p=t.preluActivationWeights;if(h=h||"linear",!1===Gf(_e.state.gradientDepth,h)){var d=il(e,n,r,i,a,u,c);return null!=l&&(d=Xr(d,l)),Xf(d,h,p)}var m=Un(e,"x","conv2d"),g=Un(n,"filter","conv2d"),v=m,y=!1;3===m.rank&&(y=!0,v=m.as4D(1,m.shape[0],m.shape[1],m.shape[2])),mt(4===v.rank,(function(){return"Error in fused conv2d: input must be rank 4, but got rank "+v.rank+"."})),mt(4===g.rank,(function(){return"Error in fused conv2d: filter must be rank 4, but got rank "+g.rank+"."})),null!=c&&mt(wt(i),(function(){return"Error in fused conv2d: pad must be an integer when using, dimRoundingMode "+c+" but got pad "+i+"."})),mt(v.shape[3]===g.shape[2],(function(){return"Error in conv2d: depth of input ("+v.shape[3]+") must match input depth for filter "+g.shape[2]+"."})),mt(Oo(r,u),(function(){return"Error in conv2D: Either strides or dilations must be 1. Got strides "+r+" and dilations '"+u+"'"})),mt("NHWC"===a,(function(){return"Error in conv2d: got dataFormat of "+a+" but only NHWC is currently supported."}));var b,x,w=bo(v.shape,g.shape,r,u,i,c);null!=l&&(b=we(b=Un(l,"bias","fused conv2d"),m)[0],Zr(w.outShape,b.shape)),null!=p&&(x=Un(p,"prelu weights","fused conv2d"));var k={x:v,filter:g};null!=l&&(k.bias=b),null!=p&&(k.preluActivationWeights=x);var E=[g,v],C=_e.runKernelFunc((function(t,e){var n=t.fusedConv2d({input:v,filter:g,convInfo:w,bias:b,activation:h,preluActivationWeights:x});return e([g,v,n]),n}),k,(function(t,e){var n=e,o=n[0],a=n[1],s=n[2],c=$f(t,s,h);mt(Ao(u),(function(){return"Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+u+"'"}));var f={};return null!=l&&(f={bias:function(){return Kf(b,c)}}),Object.assign({x:function(){return sl(a.shape,c,o,r,i)},filter:function(){return al(a,c,o.shape,r,i)}},f)}),"FusedConv2D",{convInfo:w,activation:h},E,[!0]);return y?C.as3D(C.shape[1],C.shape[2],C.shape[3]):C}}),Zf=tr({fusedDepthwiseConv2d_:function(t){var e=t.x,n=t.filter,r=t.strides,i=t.pad,o=t.dataFormat,a=void 0===o?"NHWC":o,s=t.dilations,u=void 0===s?[1,1]:s,c=t.dimRoundingMode,l=t.bias,f=t.activation,h=void 0===f?"linear":f,p=t.preluActivationWeights;if(!1===Gf(_e.state.gradientDepth,h)){var d=ul(e,n,r,i,a,u,c);return null!=l&&(d=Xr(d,l)),Xf(d,h,p)}var m=Un(e,"x","depthwiseConv2d"),g=Un(n,"filter","depthwiseConv2d"),v=m,y=!1;3===m.rank&&(y=!0,v=m.as4D(1,m.shape[0],m.shape[1],m.shape[2])),mt(4===v.rank,(function(){return"Error in fused depthwiseConv2d: input must be rank 4, but got rank "+v.rank+"."})),mt(4===g.rank,(function(){return"Error in fused depthwiseConv2d: filter must be rank 4, but got rank "+g.rank+"."})),mt(v.shape[3]===g.shape[2],(function(){return"Error in fused depthwiseConv2d: number of input channels ("+v.shape[3]+") must match the inChannels dimension in filter "+g.shape[2]+"."})),null==u&&(u=[1,1]),mt(Oo(r,u),(function(){return"Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides "+r+" and dilations '"+u+"'"})),null!=c&&mt(wt(i),(function(){return"Error in fused depthwiseConv2d: pad must be an integer when using dimRoundingMode "+c+" but got pad "+i+"."}));var b,x,w=bo(v.shape,g.shape,r,u,i,c,!0);null!=l&&(b=we(b=Un(l,"bias","fused conv2d"),m)[0],Zr(w.outShape,b.shape)),null!=p&&(x=Un(p,"prelu weights","fused depthwiseConv2d"));var k={x:v,filter:g};null!=l&&(k.bias=b),null!=p&&(k.preluActivationWeights=x);var E=[g,v],C=_e.runKernelFunc((function(t,e){var n=t.fusedDepthwiseConv2D({input:v,filter:g,convInfo:w,bias:b,activation:h,preluActivationWeights:x});return e([g,v,n]),n}),k,(function(t,e){mt(Ao(u),(function(){return"Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+u+"'"}));var n=e[0],r=e[1],i=e[2],o=$f(t,i,h),a={};return null!=l&&(a={bias:function(){return Kf(b,o)}}),Object.assign({x:function(){return cl(r.shape,o,n,w)},filter:function(){return ll(r,o,n.shape,w)}},a)}),"FusedDepthwiseConv2D",{convInfo:w,activation:h},E,[!0]);return y?C.as3D(C.shape[1],C.shape[2],C.shape[3]):C}}),Qf=Object.freeze({matMul:Yf,conv2d:Jf,depthwiseConv2d:Zf}),th=Object.freeze({image:Hf,linalg:jf,losses:Rf,spectral:hf,fused:Qf,signal:Ef,add:Xr,addN:Hu,batchNorm:Ju,batchNormalization:Yu,batchNorm2d:tc,batchNormalization2d:Qu,batchNorm3d:rc,batchNormalization3d:nc,batchNorm4d:ac,batchNormalization4d:oc,broadcastTo:sc,clone:uc,div:Yi,divNoNan:mc,eye:vc,multinomial:yc,oneHot:bc,pad:xc,pad1d:wc,pad2d:kc,pad3d:Ec,pad4d:Cc,rand:Sc,randomGamma:Ic,randomNormal:Rc,randomUniform:Fc,square:Mc,squaredDifference:Bc,tile:gc,truncatedNormal:zc,conv1d:rl,conv2d:il,conv3d:ol,depthwiseConv2d:ul,separableConv2d:fl,conv2dTranspose:hl,conv3dTranspose:pl,op:tr,booleanMaskAsync:function(t,e,n){return Z(this,void 0,void 0,(function(){var r,i,o,a,s,u,c,l,f,h,p,d,m;return Q(this,(function(g){switch(g.label){case 0:for(r=Un(t,"tensor","boolMask"),i=Un(e,"mask","boolMask","bool"),o=null==n?0:n,a=i.rank,s=r.shape,mt(a>0,(function(){return"mask cannot be scalar"})),gt(s.slice(o,o+a),i.shape,"mask's shape must match the first K dimensions of tensor's shape,"),u=1,c=o;c1,(function(){return"inTopK() expects the predictions to be of rank 2 or higher, but got "+r.rank})),mt(r.rank-1===i.rank,(function(){return"predictions rank should be 1 larger than targets rank, but got predictions rank "+r.rank+" and targets rank "+i.rank})),gt(r.shape.slice(0,r.shape.length-1),i.shape,"predictions's shape should be align with the targets' shape, except the last dimension."),o=r.shape[r.shape.length-1],mt(n>0&&n<=o,(function(){return"'k' passed to inTopK() must be > 0 && <= the predictions last dimension ("+o+"), but got "+n})),[4,r.data()];case 1:return a=v.sent(),[4,i.data()];case 2:for(s=v.sent(),u=[a.length/o,o],l=u[1],f=Nt("bool",c=u[0]),h=0;hR?R=P:"avg"===o&&(F+=P,M++)}if(isNaN(R))break}g[_+N*b+E]="avg"===o?F/M:R}return m}function rh(t,e,n,r,i,o){void 0===i&&(i=!1),void 0===o&&(o=!1);for(var a=Sr(r.outShape,"int32"),s=r.strideHeight,u=r.strideWidth,c=r.dilationHeight,l=r.dilationWidth,f=r.effectiveFilterHeight,h=r.effectiveFilterWidth,p=r.padInfo.top,d=r.padInfo.left,m=Sr(e,n,t),g=0;gA&&(A=I,O=i?o?((g*r.inHeight+_)*r.inWidth+T)*r.inChannels+v:(_*r.inWidth+T)*r.inChannels+v:N*h+D)}a.set(O,g,y,k,v)}}return a}function ih(t,e,n,r){if("linear"===n)return t.linear(e);if("relu"===n)return t.relu(e);if("elu"===n)return t.elu(e);if("relu6"===n)return t.relu6(e);if("prelu"===n)return t.prelu(e,r);throw new Error("Activation "+n+" has not been implemented for the CPU backend.")}var oh=function(t){function e(){var e=t.call(this)||this;return e.blockSize=48,e.firstUse=!0,e.data=new po(e,_e),e}return J(e,t),e.prototype.write=function(t,e,n){this.firstUse&&(this.firstUse=!1,et().get("IS_NODE")&&Pn("\n============================\nHi there 👋. Looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, which binds to TensorFlow C++, by running npm i @tensorflow/tfjs-node, or npm i @tensorflow/tfjs-node-gpu if you have CUDA. Then call require('@tensorflow/tfjs-node'); (-gpu suffix for CUDA) at the start of your program. Visit https://github.com/tensorflow/tfjs-node for more details.\n============================"));var r={};return this.data.set(r,{values:t,dtype:n}),r},e.prototype.move=function(t,e,n,r){this.data.set(t,{values:e,dtype:r})},e.prototype.numDataIds=function(){return this.data.numDataIds()},e.prototype.read=function(t){return Z(this,void 0,void 0,(function(){return Q(this,(function(e){return[2,this.readSync(t)]}))}))},e.prototype.readSync=function(t){var e=this.data.get(t),n=e.dtype,r=e.complexTensors;return"complex64"===n?Io(this.readSync(r.real.dataId),this.readSync(r.imag.dataId)):this.data.get(t).values},e.prototype.bufferSync=function(t){var e=this.readSync(t.dataId),n=e;if("string"===t.dtype)try{n=e.map((function(t){return Jt(t)}))}catch(t){throw new Error("Failed to decode encoded string bytes into utf-8")}return Sr(t.shape,t.dtype,n)},e.prototype.makeOutput=function(t,e,n){var r=this.write(t,e,n);return _e.makeTensorFromDataId(r,e,n,this)},e.prototype.disposeData=function(t){if(this.data.has(t)){var e=this.data.get(t).complexTensors;null!=e&&(e.real.dispose(),e.imag.dispose()),this.data.delete(t)}},e.prototype.time=function(t){return Z(this,void 0,void 0,(function(){var e;return Q(this,(function(n){return e=Kt(),t(),[2,{kernelMs:Kt()-e}]}))}))},e.prototype.memory=function(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}},e.prototype.complex=function(t,e){var n=this.makeOutput(null,t.shape,"complex64");return this.data.get(n.dataId).complexTensors={real:_e.keep(t.clone()),imag:_e.keep(e.clone())},n},e.prototype.real=function(t){return this.data.get(t.dataId).complexTensors.real.clone()},e.prototype.imag=function(t){return this.data.get(t.dataId).complexTensors.imag.clone()},e.prototype.slice=function(t,e,n){if(eh(t,"slice"),so(t.shape,e,n)){var r=uo(e,t.strides),i=bt(n);return ir(this.readSync(t.dataId).subarray(r,r+i),n,t.dtype)}for(var o=Sr(n,t.dtype),a=this.bufferSync(t),s=0;sh&&(h=m,p=d)}u[l]=p}return a},e.prototype.cumsum=function(t,e,n,r){if(eh(t,"cumsum"),e!==t.rank-1)throw new Error("backend.cumsum in CPU expects an inner-most axis="+(t.rank-1)+" but got axis="+e);for(var i=be(t.dtype,"int32"),o=pr(t.shape,i),a=this.readSync(o.dataId),s=this.readSync(t.dataId),u=t.shape[t.rank-1],c=r?function(t,e){return t+u-e-1}:function(t,e){return t+e},l=0;le?1:0}))},e.prototype.greaterEqual=function(t,e){return eh([t,e],"greaterEqual"),this.broadcastedBinaryOp(t,e,"bool",(function(t,e){return t>=e?1:0}))},e.prototype.logicalNot=function(t){eh(t,"logicalNot");for(var e=this.readSync(t.dataId),n=new Uint8Array(e.length),r=0;r1||1===e.rank?1:bt(e.shape.slice(1)),l=0;l=0&&e>=0?n:(n+e)%e}))},e.prototype.max=function(t,e){eh(t,"max"),Kn("max",e,t.rank);for(var n=Gn(t.shape,e),r=n[0],i=n[1],o=pr(r,t.dtype),a=bt(i),s=this.readSync(o.dataId),u=this.readSync(t.dataId),c=0;cf&&(f=p)}s[c]=f}return o},e.prototype.maximum=function(t,e){return eh([t,e],"maximum"),this.broadcastedBinaryOp(t,e,t.dtype,(function(t,e){return Math.max(t,e)}))},e.prototype.all=function(t,e){eh(t,"all"),Kn("all",e,t.rank);for(var n=Gn(t.shape,e),r=n[0],i=n[1],o=pr(r,t.dtype),a=bt(i),s=this.readSync(o.dataId),u=this.readSync(t.dataId),c=0;c0?n[r]=1:n[r]=0;return this.makeOutput(n,t.shape,"float32")},e.prototype.isNaN=function(t){eh(t,"x");for(var e=this.readSync(t.dataId),n=new Uint8Array(e.length),r=0;r.5?n[r]=Math.ceil(e[r]):n[r]=i%2==0?i:i+1}return this.makeOutput(n,t.shape,"float32")},e.prototype.exp=function(t){eh(t,"exp");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r=0?i:Math.exp(i)-1}return this.makeOutput(e,t.shape,"float32")},e.prototype.eluDer=function(t,e){eh([t,e],"eluDer");for(var n=new Float32Array(e.size),r=this.readSync(e.dataId),i=this.readSync(t.dataId),o=0;o=1?i[o]:i[o]*(a+1)}return this.makeOutput(n,e.shape,"float32")},e.prototype.selu=function(t){eh(t,"selu");for(var e=ou,n=au,r=new Float32Array(t.size),i=this.readSync(t.dataId),o=0;o=0?n*a:e*(Math.exp(a)-1)}return this.makeOutput(r,t.shape,"float32")},e.prototype.clip=function(t,e,n){eh(t,"clip");for(var r=new Float32Array(t.size),i=this.readSync(t.dataId),o=0;on?n:a-e,s=r[i]0?1:e}return this.makeOutput(n,t.shape,"float32")},e.prototype.fusedConv2d=function(t){var e=t.input,n=t.filter,r=t.convInfo,i=t.bias,o=t.activation,a=t.preluActivationWeights,s=this.conv2d(e,n,r);return i&&(s=this.add(s,i)),o&&(s=ih(this,s,o,a)),s},e.prototype.conv2d=function(t,e,n){eh([t,e],"conv2d");for(var r=n.filterHeight,i=n.filterWidth,o=n.dilationHeight,a=n.dilationWidth,s=n.padInfo.left,u=n.padInfo.top,c="channelsLast"===n.dataFormat,l=Sr(n.outShape,t.dtype),f=t.strides[0],h=c?t.strides[1]:t.strides[2],p=c?t.strides[2]:1,d=c?1:t.strides[1],m=l.strides[0],g=c?l.strides[1]:l.strides[2],v=c?l.strides[2]:1,y=c?1:l.strides[1],b=this.readSync(t.dataId),x=this.readSync(e.dataId),w=l.values,k=0;k=n.inHeight))for(var T=_*e.strides[0],D=E+N*h,I=0;I=n.inWidth))for(var z=D+B*p,j=T+M*e.strides[1],P=0;P=n.inDepth))for(var C=k*e.strides[0],S=v+E*t.strides[1],A=0;A=n.inHeight))for(var D=C+N*e.strides[1],I=S+T*t.strides[2],R=0;R=n.inWidth))for(var j=D+B*e.strides[2],P=I+z*n.inChannels,L=j,W=0;W=n.inHeight))for(var k=x*e.strides[0],E=m+w*t.strides[1],C=0;C=n.inWidth))for(var N=k+O*e.strides[1],T=E+_*n.inChannels,D=S,I=N,R=0;R=r.outHeight||Math.floor(C)!==C))for(var S=0;S=r.outWidth||Math.floor(A)!==A)){var O=l*f-1-o.get(g,C,A,v)===E*f+S?1:0;0!==O&&(k+=m.get(g,C,A,v)*O)}}}d.set(k,g,y,b,v)}return d.toTensor()},e.prototype.avgPoolBackprop=function(t,e,n){eh([t,e],"avgPoolBackprop");for(var r=n.strideHeight,i=n.strideWidth,o=n.filterHeight,a=n.filterWidth,s=n.dilationHeight,u=n.dilationWidth,c=n.effectiveFilterHeight,l=n.effectiveFilterWidth,f=l-1-n.padInfo.left,h=c-1-n.padInfo.top,p=Sr(e.shape,"float32"),d=1/(o*a),m=this.bufferSync(t),g=0;g=n.outHeight||Math.floor(C)!==C))for(var S=0;S=n.outWidth||Math.floor(A)!==A||(k+=m.get(g,C,A,v))}}p.set(k*d,g,y,b,v)}return p.toTensor()},e.prototype.pool3d=function(t,e,n){eh(t,"pool3d");for(var r=e.strideDepth,i=e.strideHeight,o=e.strideWidth,a=e.dilationDepth,s=e.dilationHeight,u=e.dilationWidth,c=e.effectiveFilterDepth,l=e.effectiveFilterHeight,f=e.effectiveFilterWidth,h=e.padInfo.front,p=e.padInfo.top,d=e.padInfo.left,m="max"===n?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,g=this.readSync(t.dataId),v=Sr(e.outShape,t.dtype),y=v.values,b=e.outShape[1]*e.outShape[2]*e.outShape[3]*e.outShape[4],x=e.outShape[2]*e.outShape[3]*e.outShape[4],w=e.outShape[3]*e.outShape[4],k=e.outShape[4],E=0;EU?U=Y:"avg"===n&&(V+=Y,q++),isNaN(U))break}if(isNaN(U))break}if(isNaN(U))break}y[W+A]="avg"===n?V/q:U}}}return v.toTensor()},e.prototype.avgPool3d=function(t,e){return eh(t,"avgPool3d"),this.pool3d(t,e,"avg").toFloat()},e.prototype.avgPool3dBackprop=function(t,e,n){eh([t,e],"avgPool3dBackprop");for(var r=n.strideDepth,i=n.strideHeight,o=n.strideWidth,a=n.filterDepth,s=n.filterHeight,u=n.filterWidth,c=n.dilationDepth,l=n.dilationHeight,f=n.dilationWidth,h=n.effectiveFilterDepth,p=n.effectiveFilterHeight,d=n.effectiveFilterWidth,m=h-1-n.padInfo.front,g=d-1-n.padInfo.left,v=p-1-n.padInfo.top,y=Sr(e.shape,"float32"),b=1/(a*s*u),x=this.bufferSync(t),w=0;w=n.outDepth||Math.floor(D)!==D))for(var I=0;I=n.outHeight||Math.floor(R)!==R))for(var F=0;F=n.outWidth||Math.floor(M)!==M||(N+=x.get(w,D,R,M,k))}}}y.set(N*b,w,E,C,S,k)}return y.toTensor()},e.prototype.maxPool3d=function(t,e){return eh(t,"maxPool3d"),this.pool3d(t,e,"max").toFloat()},e.prototype.maxPool3dPositions=function(t,e){for(var n=Sr(e.outShape,"int32"),r=e.strideDepth,i=e.strideHeight,o=e.strideWidth,a=e.dilationDepth,s=e.dilationHeight,u=e.dilationWidth,c=e.effectiveFilterDepth,l=e.effectiveFilterHeight,f=e.effectiveFilterWidth,h=e.padInfo.front,p=e.padInfo.top,d=e.padInfo.left,m=this.bufferSync(t),g=0;g=T&&(T=j,D=R*l*f+M*l+z)}n.set(D,g,y,k,A,v)}}}return n.toTensor()},e.prototype.maxPool3dBackprop=function(t,e,n,r){eh([e,n],"maxPool3dBackprop");for(var i=this.maxPool3dPositions(e,r),o=r.strideDepth,a=r.strideHeight,s=r.strideWidth,u=r.dilationDepth,c=r.dilationHeight,l=r.dilationWidth,f=r.effectiveFilterDepth,h=r.effectiveFilterHeight,p=r.effectiveFilterWidth,d=f-1-r.padInfo.front,m=p-1-r.padInfo.left,g=h-1-r.padInfo.top,v=Sr(e.shape,"float32"),y=this.bufferSync(i),b=this.bufferSync(t),x=0;x=r.outDepth||Math.floor(T)!==T))for(var D=0;D=r.outHeight||Math.floor(I)!==I))for(var R=0;R=r.outWidth||Math.floor(F)!==F)){var M=f*h*p-1-y.get(x,T,I,F,w)===N*h*p+D*p+R?1:0;0!==M&&(_+=b.get(x,T,I,F,w)*M)}}}}v.set(_,x,k,E,C,w)}return v.toTensor()},e.prototype.cast=function(t,e){return No(t,e,this)},e.prototype.reshape=function(t,e){return To(t,e)},e.prototype.avgPool=function(t,e){return eh(t,"avgPool"),eh(t,"maxPool"),nh(this.readSync(t.dataId),t.shape,t.dtype,t.strides,e,"avg").toTensor().toFloat()},e.prototype.resizeBilinear=function(t,e,n,r){eh(t,"resizeBilinear");for(var i=t.shape,o=i[0],a=i[1],s=i[2],u=i[3],c=this.readSync(t.dataId),l=new Float32Array(bt([o,e,n,u])),f=[r&&e>1?a-1:a,r&&n>1?s-1:s],h=[r&&e>1?e-1:e,r&&n>1?n-1:n],p=0,d=f[0]/h[0],m=f[1]/h[1],g=0;g1?o-1:o,n&&l>1?a-1:a],p=[n&&c>1?c-1:c,n&&l>1?l-1:l],d=h[0]/p[0],m=h[1]/p[1],g=this.readSync(t.dataId),v=0,y=0;y1?a-1:a,r&&n>1?s-1:s],h=[r&&e>1?e-1:e,r&&n>1?n-1:n],p=f[0]/h[0],d=f[1]/h[1],m=0,g=0;g1?o-1:o,n&&l>1?a-1:a],d=[n&&c>1?c-1:c,n&&l>1?l-1:l],m=p[0]/d[0],g=p[1]/d[1],v=1/m,y=1/g,b=2*Math.ceil(v)+2,x=2*Math.ceil(y)+2,w=0;w=c)){var M=k+F*t.strides[1],B=F*m;if(E===Math.min(o-1,n?Math.round(B):Math.floor(B)))for(var z=0;z=l)){var P=M+j*t.strides[2],L=j*g;O===Math.min(a-1,n?Math.round(L):Math.floor(L))&&(I+=h[P+D])}}}}f[_+D]=I}return lr(f,e.shape,e.dtype)},e.prototype.batchNormalization=function(t,e,n,r,i,o){eh([t,e,n,i,o],"batchNorm");for(var a=this.readSync(t.dataId),s=this.readSync(e.dataId),u=this.readSync(n.dataId),c=i?this.readSync(i.dataId):new Float32Array([1]),l=o?this.readSync(o.dataId):new Float32Array([0]),f=new Float32Array(a.length),h=l.length,p=c.length,d=u.length,m=s.length,g=0,v=0,y=0,b=0,x=0;x=h&&(g=0),v>=m&&(v=0),y>=p&&(y=0),b>=d&&(b=0);return lr(f,t.shape)},e.prototype.localResponseNormalization4D=function(t,e,n,r,i){eh(t,"localResponseNormalization4D");var o=t.shape[3],a=o-1,s=this.readSync(t.dataId),u=t.size,c=new Float32Array(u);function l(t){for(var n=t%o,r=t-n+Math.max(0,n-e),i=t-n+Math.min(n+e,a),u=0;r<=i;r++){var c=s[r];u+=c*c}return u}for(var f=0;f=0&&o[a]1,(function(){return"blockSize should be > 1 for depthToSpace, but was: "+e}));for(var r=t.shape[0],i=t.shape[1],o=t.shape[2],a=t.shape[3],s=i*e,u=o*e,c=a/(e*e),l=this.readSync(t.dataId),f=new Float32Array(r*s*u*c),h=0,p=0;p=s))for(var O=h>1?(C-k)*(u-1)/(h-1):0,_=p>1?(S-E)*(c-1)/(p-1):0,N=0;N1?k*(u-1)+N*O:.5*(k+C)*(u-1);if(T<0||T>u-1)for(var D=0;D1?E*(c-1)+D*_:.5*(E+S)*(c-1))<0||H>c-1)for(I=0;I1?E*(c-1)+D*_:.5*(E+S)*(c-1))<0||H>c-1)for(I=0;I=t.size/s)throw new Error("Invalid indices: "+p+" does not index into "+t.shape);for(var v=0;v=r/i)throw new Error("Invalid indices: "+m+" does not index into "+n);for(var b=0;b6)throw Error("Transpose for rank "+e+" is not yet supported");for(var n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],r=new Array(e),i=0;i6)throw Error("Packed transpose for rank "+this.rank+" is not yet supported.");var i=ha(this.rank),o=Jo("rc",this.rank),a=new Array(this.rank);for(r=0;r0&&(e=e.sum(r)),e.reshape(n.shape)},b:function(){var e=t,n=Jr(r.shape,i);return n.length>0&&(e=e.sum(n)),e.reshape(r.shape)}}}},{kernelName:"AddN",saveAllInputs:!0,gradFunc:function(t,e){var n={};return e.forEach((function(e,r){n[r]=function(){return t.clone()}})),n}},{kernelName:qr,gradFunc:function(t,e,n){for(var r=n,i=r.inputShape,o=r.shape,a=Array.from(o),s=i.length-1;s>=0;s--)if(i[s]===o[s])a[s]=1;else if(1!==i[s])throw new Error("broadcastTo(): ["+i+"] cannot be broadcast to ["+o+"].");var u=[];for(s=0;s1&&u.push(s);return{x:function(){return t.sum(u,!0)}}}},{kernelName:Ur,inputsToSave:["a","b"],gradFunc:function(t,e){var n=e[0],r=e[1],i=Zr(n.shape,r.shape);return{a:function(){var e=Yi(t,r.toFloat()),o=Jr(n.shape,i);return o.length>0?Hl(e,o).reshape(n.shape):e},b:function(){var e=t.mul(n.toFloat()),o=Jr(r.shape,i);o.length>0&&(e=Hl(e,o).reshape(r.shape));var a=Mc(r);return vi(Yi(e,a.toFloat()))}}}},{kernelName:"FusedBatchNorm",inputsToSave:["x","mean","variance","scale"],gradFunc:function(t,e,n){var r=n.varianceEpsilon,i=e[0],o=e[1],a=e[2],s=e[3],u=$u(i),c=null==s?ar(1):s,l=Jr(o.shape,u.shape),f=[];if(1===o.rank){for(var h=0;h0,(function(){return"scheme must not be an empty string."}));var r=t.getInstance();mt(null==r.managers[e],(function(){return"A model store manager is already registered for scheme '"+e+"'."})),r.managers[e]=n},t.getManager=function(t){var e=this.getInstance().managers[t];if(null==e)throw new Error("Cannot find model manager for scheme '"+t+"'");return e},t.getSchemes=function(){return Object.keys(this.getInstance().managers)},t}();function Wh(t){if(-1===t.indexOf(Ph))throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+Lh.getSchemes().join(","));return{scheme:t.split(Ph)[0],path:t.split(Ph)[1]}}function Uh(t,e,n){return void 0===n&&(n=!1),Z(this,void 0,void 0,(function(){var r,i,o,a,s,u,c,l,f;return Q(this,(function(h){switch(h.label){case 0:return mt(t!==e,(function(){return"Old path and new path are the same: '"+t+"'"})),mt((r=jh.getLoadHandlers(t)).length>0,(function(){return"Copying failed because no load handler is found for source URL "+t+"."})),mt(r.length<2,(function(){return"Copying failed because more than one ("+r.length+") load handlers for source URL "+t+"."})),i=r[0],mt((o=jh.getSaveHandlers(e)).length>0,(function(){return"Copying failed because no save handler is found for destination URL "+e+"."})),mt(o.length<2,(function(){return"Copying failed because more than one ("+r.length+") save handlers for destination URL "+e+"."})),a=o[0],s=Wh(t).scheme,u=Wh(t).path,c=s===Wh(t).scheme,[4,i.load()];case 1:return l=h.sent(),n&&c?[4,Lh.getManager(s).removeModel(u)]:[3,3];case 2:h.sent(),h.label=3;case 3:return[4,a.save(l)];case 4:return f=h.sent(),!n||c?[3,6]:[4,Lh.getManager(s).removeModel(u)];case 5:h.sent(),h.label=6;case 6:return[2,f.modelArtifactsInfo]}}))}))}var Vh="models_store",qh="model_info_store";function Hh(){if(!et().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");var t=window||self,e=t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB||t.shimIndexedDB;if(null==e)throw new Error("The current browser does not appear to support IndexedDB.");return e}function Gh(t){var e=t.result;e.createObjectStore(Vh,{keyPath:"modelPath"}),e.createObjectStore(qh,{keyPath:"modelPath"})}var $h=function(){function t(t){if(this.indexedDB=Hh(),null==t||!t)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=t}return t.prototype.save=function(t){return Z(this,void 0,void 0,(function(){return Q(this,(function(e){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return[2,this.databaseAction(this.modelPath,t)]}))}))},t.prototype.load=function(){return Z(this,void 0,void 0,(function(){return Q(this,(function(t){return[2,this.databaseAction(this.modelPath)]}))}))},t.prototype.databaseAction=function(t,e){var n=this;return new Promise((function(t,r){var i=n.indexedDB.open("tensorflowjs",1);i.onupgradeneeded=function(){return Gh(i)},i.onsuccess=function(){var o=i.result;if(null==e){var a=o.transaction(Vh,"readonly"),s=a.objectStore(Vh).get(n.modelPath);s.onsuccess=function(){if(null==s.result)return o.close(),r(new Error("Cannot find model with path '"+n.modelPath+"' in IndexedDB."));t(s.result.modelArtifacts)},s.onerror=function(t){return o.close(),r(s.error)},a.oncomplete=function(){return o.close()}}else{var u,c=zh(e),l=o.transaction(qh,"readwrite"),f=l.objectStore(qh),h=f.put({modelPath:n.modelPath,modelArtifactsInfo:c});h.onsuccess=function(){var i=(u=o.transaction(Vh,"readwrite")).objectStore(Vh).put({modelPath:n.modelPath,modelArtifacts:e,modelArtifactsInfo:c});i.onsuccess=function(){return t({modelArtifactsInfo:c})},i.onerror=function(t){var e=(f=l.objectStore(qh)).delete(n.modelPath);e.onsuccess=function(){return o.close(),r(i.error)},e.onerror=function(t){return o.close(),r(i.error)}}},h.onerror=function(t){return o.close(),r(h.error)},l.oncomplete=function(){null==u?o.close():u.oncomplete=function(){return o.close()}}}},i.onerror=function(t){return r(i.error)}}))},t.URL_SCHEME="indexeddb://",t}(),Kh=function(t){return et().getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith($h.URL_SCHEME)?(e=t.slice($h.URL_SCHEME.length),new $h(e)):null;var e};jh.registerSaveRouter(Kh),jh.registerLoadRouter(Kh);var Xh=function(){function t(){this.indexedDB=Hh()}return t.prototype.listModels=function(){return Z(this,void 0,void 0,(function(){var t=this;return Q(this,(function(e){return[2,new Promise((function(e,n){var r=t.indexedDB.open("tensorflowjs",1);r.onupgradeneeded=function(){return Gh(r)},r.onsuccess=function(){var t=r.result,i=t.transaction(qh,"readonly"),o=i.objectStore(qh).getAll();o.onsuccess=function(){for(var t={},n=0,r=o.result;n0,(function(){return"promises must be a none empty array"}))}(t),function(t,e){mt(t>=0&&t<=1,(function(){return"Progress fraction must be in range [0, 1], but got startFraction "+t})),mt(e>=0&&e<=1,(function(){return"Progress fraction must be in range [0, 1], but got endFraction "+e})),mt(e>=t,(function(){return"startFraction must be no more than endFraction, but got startFraction "+t+" and endFraction "+e}))}(n=null==n?0:n,r=null==r?1:r);var i=0;return Promise.all(t.map((function(o){return o.then((function(o){var a=n+ ++i/t.length*(r-n);return e(a),o})),o})))}function hp(t,e){return Z(this,void 0,void 0,(function(){var n,r,i,o,a,s,u,c,l;return Q(this,(function(f){switch(f.label){case 0:return null==e&&(e={}),n=null==e.fetchFunc?et().platform.fetch:e.fetchFunc,r=t.map((function(t){return n(t,e.requestInit,{isBinary:!0})})),i=0,o=.5,null!=e.onProgress?[3,2]:[4,Promise.all(r)];case 1:return a=f.sent(),[3,4];case 2:return[4,fp(r,e.onProgress,i,o)];case 3:a=f.sent(),f.label=4;case 4:return s=a.map((function(t){return t.arrayBuffer()})),u=.5,c=1,null!=e.onProgress?[3,6]:[4,Promise.all(s)];case 5:return l=f.sent(),[3,8];case 6:return[4,fp(s,e.onProgress,u,c)];case 7:l=f.sent(),f.label=8;case 8:return[2,l]}}))}))}function pp(t){var e=this;return function(n,r,i){return void 0===r&&(r=""),Z(e,void 0,void 0,(function(){var e,o,a,s,u,c,l,f,h,p;return Q(this,(function(d){switch(d.label){case 0:if(e=n.map((function(){return!1})),o={},a=null!=i?i.map((function(){return!1})):[],s=[],n.forEach((function(t,n){var r=0;t.weights.forEach((function(t){var u="quantization"in t?t.quantization.dtype:t.dtype,c=Nh[u]*bt(t.shape),l=function(){e[n]=!0,null==o[n]&&(o[n]=[]),o[n].push({manifestEntry:t,groupOffset:r,sizeBytes:c})};null!=i?i.forEach((function(e,n){e===t.name&&(l(),a[n]=!0)})):l(),s.push(t.name),r+=c}))})),!a.every((function(t){return t})))throw u=i.filter((function(t,e){return!a[e]})),new Error("Could not find weights in manifest with names: "+u.join(", ")+". \nManifest JSON has weights with names: "+s.join(", ")+".");return c=e.reduce((function(t,e,n){return e&&t.push(n),t}),[]),l=[],c.forEach((function(t){n[t].paths.forEach((function(t){var e=r+(r.endsWith("/")?"":"/")+t;l.push(e)}))})),[4,t(l)];case 1:return f=d.sent(),h={},p=0,c.forEach((function(t){for(var e=n[t].paths.length,r=0,i=0;i0,(function(){return"URL path for http must not be null, undefined or empty."})),Array.isArray(t)&&mt(2===t.length,(function(){return"URL paths for http must have a length of 2, (actual length is "+t.length+")."})),this.path=t,null!=e.requestInit&&null!=e.requestInit.body)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=e.requestInit||{}}return t.prototype.save=function(t){return Z(this,void 0,void 0,(function(){var e,n,r,i;return Q(this,(function(o){switch(o.label){case 0:if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");return(e=Object.assign({method:this.DEFAULT_METHOD},this.requestInit)).body=new FormData,n=[{paths:["./model.weights.bin"],weights:t.weightSpecs}],r={modelTopology:t.modelTopology,format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,userDefinedMetadata:t.userDefinedMetadata,weightsManifest:n},e.body.append("model.json",new Blob([JSON.stringify(r)],{type:"application/json"}),"model.json"),null!=t.weightData&&e.body.append("model.weights.bin",new Blob([t.weightData],{type:"application/octet-stream"}),"model.weights.bin"),[4,this.fetch(this.path,e)];case 1:if((i=o.sent()).ok)return[2,{modelArtifactsInfo:zh(t),responses:[i]}];throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+i.status+".")}}))}))},t.prototype.load=function(){return Z(this,void 0,void 0,(function(){var t,e,n,r,i,o,a,s,u,c,l,f;return Q(this,(function(h){switch(h.label){case 0:return[4,this.fetch(this.path,this.requestInit)];case 1:if(!(t=h.sent()).ok)throw new Error("Request to "+this.path+" failed with status code "+t.status+". Please verify this URL points to the model JSON of the model to load.");h.label=2;case 2:return h.trys.push([2,4,,5]),[4,t.json()];case 3:return e=h.sent(),[3,5];case 4:throw h.sent(),n="Failed to parse model JSON of response from "+this.path+".",this.path.endsWith(".pb")?n+=" 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.":n+=" Please make sure the server is serving valid JSON for this request.",new Error(n);case 5:if(r=e.modelTopology,i=e.weightsManifest,o=e.generatedBy,a=e.convertedBy,s=e.format,u=e.userDefinedMetadata,null==r&&null==i)throw new Error("The JSON from HTTP path "+this.path+" contains neither model topology or manifest for weights.");return null==i?[3,7]:[4,this.loadWeights(i)];case 6:f=h.sent(),c=f[0],l=f[1],h.label=7;case 7:return[2,{modelTopology:r,weightSpecs:c,weightData:l,userDefinedMetadata:u,generatedBy:o,convertedBy:a,format:s}]}}))}))},t.prototype.loadWeights=function(t){return Z(this,void 0,void 0,(function(){var e,n,r,i,o,a,s,u,c,l,f;return Q(this,(function(h){switch(h.label){case 0:for(e=Array.isArray(this.path)?this.path[1]:this.path,n=function(t){var e=t.lastIndexOf("/"),n=t.lastIndexOf("?");return[t.substring(0,e)+"/",n>e?t.substring(n):""]}(e),r=n[0],i=n[1],o=this.weightPathPrefix||r,a=[],s=0,u=t;s0&&Number.isInteger(n),(function(){return"If provided, numClasses must be a positive integer, but got "+n})),mt(1===r.rank,(function(){return"Expected the rank of labels to be 1, but got "+r.rank})),mt(1===i.rank,(function(){return"Expected the rank of predictions to be 1, but got "+i.rank})),mt(r.shape[0]===i.shape[0],(function(){return"Mismatch in the number of examples: "+r.shape[0]+" vs. "+i.shape[0]+". Labels and predictions should have the same number of elements."})),mt(n>0&&Number.isInteger(n),(function(){return"numClasses is required to be a positive integer, but got "+n}));var o=bc(r.asType("int32"),n),a=bc(i.asType("int32"),n);return o.transpose().matMul(a).asType("int32")}});Object.freeze({confusionMatrix:kp});var Ep=tr({fromPixels_:function(t,e){if(void 0===e&&(e=3),e>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(null==t)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");var n=!1,r=!1,i=!1,o=!1,a=!1;if(t.data instanceof Uint8Array)n=!0;else if("undefined"!=typeof ImageData&&t instanceof ImageData)r=!0;else if("undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement)i=!0;else if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement)o=!0;else{if(null==t.getContext)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 "+t.constructor.name);a=!0}if(i&&i&&t.readyState<2)throw new Error("The video element has not loaded data yet. Please wait for `loadeddata` event on the